{"version":3,"file":"WorkScrollHandler.nnnwAOZZ.mjs","names":[],"sources":["https:/framerusercontent.com/modules/IVz9A7QJ5i3JVseDlPwi/nAHc2nVAEdUDAHWwCogU/WorkScrollHandler.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import*as React from\"react\";import{addPropertyControls,ControlType,RenderTarget}from\"framer\";const DATE_PATTERN=/^(?:\\d{2}\\s*[•·|]\\s*)?(?:Jan(?:uary)?|Feb(?:ruary)?|Mar(?:ch)?|Apr(?:il)?|May|Jun(?:e)?|Jul(?:y)?|Aug(?:ust)?|Sep(?:tember)?|Oct(?:ober)?|Nov(?:ember)?|Dec(?:ember)?)\\s+20\\d{2}$/i;function visible(element){const rect=element.getBoundingClientRect();if(rect.width<=0||rect.height<=0)return false;if(rect.right<=0||rect.left>=window.innerWidth)return false;let node=element;while(node&&node!==document.body){const styles=getComputedStyle(node);if(styles.display===\"none\"||styles.visibility===\"hidden\"||Number(styles.opacity)<.02)return false;node=node.parentElement;}return true;}function findFirstProject(){const date=Array.from(document.querySelectorAll(\"p\")).find(node=>{const text=node.textContent?.trim().replace(/\\s+/g,\" \")||\"\";return visible(node)&&DATE_PATTERN.test(text);});if(!date)return null;let row=date;while(row?.parentElement){const rect=row.getBoundingClientRect();if(rect.height>=window.innerHeight*.45&&rect.width>=window.innerWidth*.45)break;row=row.parentElement;}return row;}/**\n * Handles cross-page Work navigation and centers the first homepage project.\n *\n * @framerIntrinsicWidth 1\n * @framerIntrinsicHeight 1\n * @framerSupportedLayoutWidth fixed\n * @framerSupportedLayoutHeight fixed\n */export default function WorkScrollHandler({queryKey}){const isCanvas=RenderTarget.current()===RenderTarget.canvas;React.useEffect(()=>{if(isCanvas)return;const params=new URLSearchParams(window.location.search);const shouldScroll=params.get(queryKey)===\"1\"||window.location.hash===`#${queryKey}`;if(!shouldScroll)return;let attempts=0;const scrollWhenReady=()=>{const row=findFirstProject();if(!row&&attempts++<40){window.setTimeout(scrollWhenReady,100);return;}if(!row)return;const rect=row.getBoundingClientRect();const top=window.scrollY+rect.top+rect.height/2-window.innerHeight/2;window.scrollTo({top:Math.max(0,top),behavior:\"smooth\"});window.history.replaceState({},\"\",window.location.pathname);};window.setTimeout(scrollWhenReady,60);},[isCanvas,queryKey]);return /*#__PURE__*/_jsx(\"div\",{\"aria-hidden\":\"true\",style:{width:1,height:1,pointerEvents:\"none\",opacity:0}});}addPropertyControls(WorkScrollHandler,{queryKey:{type:ControlType.String,title:\"Query Key\",defaultValue:\"work\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"WorkScrollHandler\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerIntrinsicHeight\":\"1\",\"framerSupportedLayoutHeight\":\"fixed\",\"framerSupportedLayoutWidth\":\"fixed\",\"framerIntrinsicWidth\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./WorkScrollHandler.map"],"mappings":"+LAAgV,SAAS,EAAQ,EAAQ,CAAC,IAAM,EAAK,EAAQ,uBAAuB,CAA+C,GAA3C,EAAK,OAAO,GAAG,EAAK,QAAQ,GAAkB,EAAK,OAAO,GAAG,EAAK,MAAM,EAAO,WAAW,MAAO,GAAM,IAAI,EAAK,EAAQ,KAAM,GAAM,IAAO,SAAS,MAAK,CAAC,IAAM,EAAO,iBAAiB,EAAK,CAAC,GAAG,EAAO,UAAU,QAAQ,EAAO,aAAa,UAAU,OAAO,EAAO,QAAQ,CAAC,IAAI,MAAO,GAAM,EAAK,EAAK,cAAe,MAAO,GAAM,SAAS,GAAkB,CAAC,IAAM,EAAK,MAAM,KAAK,SAAS,iBAAiB,IAAI,CAAC,CAAC,KAAK,GAAM,CAAC,IAAM,EAAK,EAAK,aAAa,MAAM,CAAC,QAAQ,OAAO,IAAI,EAAE,GAAG,OAAO,EAAQ,EAAK,EAAE,EAAa,KAAK,EAAK,EAAG,CAAC,GAAG,CAAC,EAAK,OAAO,KAAK,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