{"version":3,"file":"ReturnPointTracker.D7KZuwbb.mjs","names":[],"sources":["https:/framerusercontent.com/modules/IRsYVPwG3Bxn5UyvZhkc/sggMjfy4PB7fXmXHDmVO/ReturnPointTracker.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{RenderTarget}from\"framer\";import{addPropertyControls,ControlType}from\"framer\";import{useEffect}from\"react\";// Same key CloseButton reads from — keep these in sync.\nconst RETURN_URL_KEY=\"vc_project_return_url\";/**\n * Return Point Tracker\n *\n * Invisible marker — place ONE instance of this on every page you want\n * the \"Close\" button on project pages to send visitors back to (your\n * slider/home page and your grid page). Do NOT place it on project\n * detail pages themselves.\n *\n * What it does, simply: it watches for taps/clicks on this page. The\n * moment you press a link that opens a project, it saves this page's\n * current URL (exactly as it is right then — filters and all) so Close\n * can return to that exact spot later, no matter how many times you hit\n * Next/Previous inside the project.\n *\n * @framerSupportedLayoutWidth fixed\n * @framerSupportedLayoutHeight fixed\n * @framerIntrinsicWidth 1\n * @framerIntrinsicHeight 1\n */export default function ReturnPointTracker(props){const{projectPathPrefix}=props;const isCanvas=RenderTarget.current()===RenderTarget.canvas;useEffect(()=>{if(isCanvas)return;if(typeof window===\"undefined\")return;const prefix=(projectPathPrefix||\"/works-main\").trim();const handlePress=e=>{const link=e.target&&e.target.closest&&e.target.closest(\"a\");if(!link)return;const href=link.getAttribute(\"href\");if(!href)return;let path;try{path=new URL(href,window.location.origin).pathname;}catch(err){return;}// Only record when the press is about to open a project —\n// i.e. the link goes into the CMS collection.\nif(path===prefix||path.startsWith(prefix+\"/\")){try{sessionStorage.setItem(RETURN_URL_KEY,window.location.href);}catch(err){// sessionStorage unavailable — Close will just use its fallback link\n}}};// Listens on \"pointerdown\" rather than \"click\". On mobile this\n// page's smooth-scroll behavior (Lenis) can swallow or delay the\n// synthetic \"click\" event a touch normally fires, so a listener\n// that only caught \"click\" could miss the tap entirely — that's\n// what caused Close to fall back to the wrong page on phones.\n// \"pointerdown\" fires for both mouse and touch, and fires the\n// moment the press starts, before anything else has a chance to\n// intercept it.\ndocument.addEventListener(\"pointerdown\",handlePress,true);return()=>document.removeEventListener(\"pointerdown\",handlePress,true);},[projectPathPrefix]);if(isCanvas){return /*#__PURE__*/_jsx(\"div\",{style:{width:\"100%\",height:\"100%\",background:\"repeating-linear-gradient(45deg, #FF3366, #FF3366 4px, transparent 4px, transparent 8px)\",outline:\"1px solid #FF3366\",boxSizing:\"border-box\"}});}return null;}ReturnPointTracker.defaultProps={projectPathPrefix:\"/works-main\"};addPropertyControls(ReturnPointTracker,{projectPathPrefix:{type:ControlType.String,title:\"Project Path Prefix\",defaultValue:\"/works-main\",placeholder:\"/works-main\",description:'Your project CMS collection\\'s URL (e.g. \"/works-main\"). Used to detect when a click on this page is opening a project.'}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"ReturnPointTracker\",\"slots\":[],\"annotations\":{\"framerIntrinsicHeight\":\"1\",\"framerSupportedLayoutHeight\":\"fixed\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"fixed\",\"framerIntrinsicWidth\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ReturnPointTracker.map"],"mappings":"+LAmBG,SAAwB,EAAmB,EAAM,CAAC,GAAK,CAAC,qBAAmB,EAAY,EAAS,EAAa,QAAQ,IAAI,EAAa,OAW2P,OAXpP,MAAc,CAAoB,GAAhB,GAA0B,IAAS,OAAY,OAAO,IAAM,GAAQ,GAAmB,cAAA,CAAe,KAAK,EAAQ,EAAY,GAAG,CAAC,IAAM,EAAK,EAAE,QAAQ,EAAE,OAAO,SAAS,EAAE,OAAO,QAAQ,GAAG,EAAE,GAAG,CAAC,EAAK,OAAO,IAAM,EAAK,EAAK,aAAa,MAAM,EAAE,GAAG,CAAC,EAAK,OAAO,IAAI,EAAK,GAAG,CAAC,EAAK,IAAI,IAAI,EAAK,EAAO,SAAS,MAAM,CAAC,CAAC,QAA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