{"version":3,"file":"HeaderTheme.F3GLIWvv.mjs","names":["useState","__esmMin","init_npm_react_18_3_1","init_ssg_sandbox_shims","window","_e","c","J","ce","withHeaderTheme","dark","setDark","raf","check","end","onScroll","t","DARK","LIGHT","Component","props","init_HeaderTheme","init_jsx_runtime"],"sources":["https:/framerusercontent.com/modules/DV7JzWKQiMTWK7Iriwuf/v37cASxeBNnUHuuKfwmy/HeaderTheme.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{forwardRef,useEffect,useState}from\"react\";// Header colours follow what is behind it: dark over the dark masthead, light everywhere else.\n// The dark area ends at the frame with id \"dark-end\" (the principles title).\nconst DARK={bg:\"rgb(30, 29, 27)\",ink:\"rgb(222, 220, 215)\"};const LIGHT={bg:\"rgb(244, 243, 238)\",ink:\"rgb(27, 27, 26)\"};export function withHeaderTheme(Component){return /*#__PURE__*/forwardRef((props,ref)=>{const[dark,setDark]=useState(false);useEffect(()=>{if(typeof window===\"undefined\")return;let raf=0;const check=()=>{raf=0;if(document.getElementById(\"light-page\"))return setDark(false);const end=document.getElementById(\"dark-end\");if(!end)return setDark(false);setDark(end.getBoundingClientRect().bottom>64);};const onScroll=()=>{if(!raf)raf=requestAnimationFrame(check);};check();window.addEventListener(\"scroll\",onScroll,{passive:true});window.addEventListener(\"resize\",onScroll);return()=>{window.removeEventListener(\"scroll\",onScroll);window.removeEventListener(\"resize\",onScroll);if(raf)cancelAnimationFrame(raf);};},[]);const t=dark?DARK:LIGHT;return /*#__PURE__*/_jsx(Component,{ref:ref,...props,navColor:t.ink,editionColor:t.ink,style:{...props.style,background:t.bg,transition:\"background-color .4s ease, color .4s ease\"}});});}\nexport const __FramerMetadata__ = {\"exports\":{\"withHeaderTheme\":{\"type\":\"reactHoc\",\"name\":\"withHeaderTheme\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./HeaderTheme.map"],"mappings":"A,yIAEuH,SAAgBS,EAAgB,EAAU,CAAC,MAAoB,iBAAY,EAAM,IAAM,CAAC,GAAK,CAACC,EAAKC,GAASX,EAAS,EAAK,EAAEQ,MAAc,CAAC,GAAUJ,IAAS,OAAY,OAAO,IAAIQ,EAAI,EAAQC,MAAU,CAAO,GAAN,EAAI,EAAK,SAAS,eAAe,YAAY,EAAE,OAAOF,EAAQ,EAAK,EAAE,IAAMG,EAAI,SAAS,eAAe,UAAU,EAAE,GAAG,CAACA,EAAI,OAAOH,EAAQ,EAAK,EAAEA,EAAQG,EAAI,sBAAsB,CAAC,CAAC,OAAO,EAAE,CAAE,EAAQC,MAAa,CAAC,AAAQH,IAAI,sBAAsBC,CAAK,CAAE,EAA+G,OAA7GA,EAAM,EAAET,EAAO,iBAAiB,SAASW,EAAS,CAAC,QAAQ,EAAI,CAAC,EAAEX,EAAO,iBAAiB,SAASW,CAAQ,MAAY,CAACX,EAAO,oBAAoB,SAASW,CAAQ,EAAEX,EAAO,oBAAoB,SAASW,CAAQ,EAAKH,GAAI,qBAAqBA,CAAG,CAAE,CAAE,EAAE,CAAC,CAAC,EAAE,IAAMI,EAAEN,EAAKO,EAAKC,EAAM,MAAoB,gBAAKC,EAAU,CAAK,MAAI,GAAGC,EAAM,SAASJ,EAAE,IAAI,aAAaA,EAAE,IAAI,MAAM,CAAC,GAAGI,EAAM,MAAM,WAAWJ,EAAE,GAAG,WAAW,2CAA2C,CAAC,CAAC,CAAE,CAAC,CAAE,C,kDAA7gC,EAAK,CAAC,GAAG,kBAAkB,IAAI,oBAAoB,EAAQ,EAAM,CAAC,GAAG,qBAAqB,IAAI,iBAAiB,C"}