{"version":3,"file":"Relative_path.C_WHtOcw.mjs","names":["forwardRef","useRef","useEffect","_jsx","__esmMin","init_ssg_sandbox_shims","de","init_jsx_runtime","J","c","init_npm_react_18_3_1","ce","window","GoToLinkPath","Component","props","forwardedRef","innerRef","setRef","node","installGlobalHandler","apply","obs","timers","ms","t","fiberOf","el","key","k","resolveLink","a","f","href","newTab","depth","p","h","root","anchors","resolved","url","dest","rewriteProdLinks","SANDBOX_PROD_HOSTS","GoToLinkPathSandbox","Inner","init_Relative_path"],"sources":["https:/framerusercontent.com/modules/0FXgiipSDisSoYxBAP40/C6Yj2rYzUsV289p0pJWe/Relative_path.js"],"sourcesContent":["// Relative_path.tsx\n// ---------------------------------------------------------------------------\n// GoToLinkPath — make a Framer INLINE text link navigate to its real\n// destination, on a hybrid Framer + separate-React-app + Gatsby site.\n//\n// WHAT WE FOUND ON THE LIVE SITE (verified in the DOM + React fiber)\n//   The \"Browse All Games\" / \"Learn How to Use Factile…\" links are inline\n//   rich-text links: <a class=\"framer-text\" href=\"./\">. Framer does NOT put\n//   the real destination in the href — the href stays \"./\", which resolves to\n//   the HOMEPAGE, and Framer even marks it data-framer-page-link-current=\"true\".\n//   The real path (\"/search\", \"/blog/why-play-…\") lives only in a PARENT React\n//   fiber's props (props.href), because those targets aren't Framer pages so\n//   Framer can't bake them into a normal href.  THAT \"./\" href is the whole\n//   bug: every click just follows \"./\" to the homepage.\n//\n//   Also verified: an anchor-level click listener does NOT reliably win against\n//   Framer/React here, but a DOCUMENT-level capture listener fires first (before\n//   React's root delegation) and controls the navigation. So we intercept there.\n//\n// WHAT THIS DOES\n//   Per text layer it's applied to, it:\n//     1. Walks the React fiber up from each inline <a> to recover the REAL path\n//        Framer stored (props.href, ignoring the \"./\" placeholder). Nothing is\n//        hardcoded — each link resolves its own \"Link To\" value.\n//     2. Writes that path into the DOM href (so hover/copy-link/middle-click and\n//        crawlers see the right target) and tags the anchor as \"managed\".\n//   A single document-level capture click listener (installed once) then does a\n//   real full navigation for managed same-origin links — window.location.assign\n//   (or a new tab if the link's \"New Tab\" is on) — so the separate React app\n//   (/search, /signin) and Gatsby (/blog) pages load correctly instead of\n//   Framer trying to SPA-route them.  Modifier/middle clicks are left to the\n//   browser (correct href now), and genuinely external links are untouched.\n//\n// USE\n//   Apply to each inline text link's Text layer.\n//   File: Relative_path   Override: GoToLinkPath\n// ---------------------------------------------------------------------------\nimport{jsx as _jsx}from\"react/jsx-runtime\";import{forwardRef,useEffect,useRef}from\"react\";export function GoToLinkPath(Component){return /*#__PURE__*/forwardRef((props,forwardedRef)=>{const innerRef=useRef(null);const setRef=node=>{innerRef.current=node;if(typeof forwardedRef===\"function\")forwardedRef(node);else if(forwardedRef)forwardedRef.current=node;};useEffect(()=>{installGlobalHandler();const node=innerRef.current;if(!node)return;apply(node);const obs=new MutationObserver(()=>apply(node));obs.observe(node,{childList:true,subtree:true});const timers=[150,400,900].map(ms=>window.setTimeout(()=>apply(node),ms));return()=>{obs.disconnect();timers.forEach(t=>window.clearTimeout(t));};},[]);return /*#__PURE__*/_jsx(Component,{...props,ref:setRef});});}// --- fiber helpers ---------------------------------------------------------\nfunction fiberOf(el){const key=Object.keys(el).find(k=>k.indexOf(\"__reactFiber$\")===0||k.indexOf(\"__reactInternalInstance$\")===0);return key?el[key]:null;}// Recover the destination Framer stored for this anchor by walking the fiber\n// tree upward. Returns { href, newTab } or null if nothing real was found.\nfunction resolveLink(a){let f=fiberOf(a);let href=null;let newTab=null;let depth=0;while(f&&depth<30){const p=f.memoizedProps;if(p){if(href==null&&typeof p.href===\"string\"){const h=p.href.trim();if(h&&h!==\"./\"&&h!==\".\"&&h!==\"#\")href=h;}if(newTab==null){if(typeof p.openInNewTab===\"boolean\")newTab=p.openInNewTab;else if(p.target===\"_blank\")newTab=true;}}f=f.return;depth++;}if(!href)return null;return{href,newTab:newTab===true};}// --- per-layer: fix hrefs + tag managed links ------------------------------\nfunction apply(root){const anchors=[];if(root.tagName===\"A\")anchors.push(root);root.querySelectorAll(\"a\").forEach(a=>anchors.push(a));anchors.forEach(a=>{if(a.dataset.goLinkBound===\"1\")return;const resolved=resolveLink(a);if(!resolved)return;// couldn't recover a real path — leave it alone\nlet url;try{url=new URL(resolved.href,window.location.href);}catch{return;}a.dataset.goLinkBound=\"1\";if(url.origin!==window.location.origin){// External: just make the href correct; don't intercept.\na.setAttribute(\"href\",resolved.href);return;}// Same-origin: correct the href AND mark it for the global handler.\nconst dest=url.pathname+url.search+url.hash;a.setAttribute(\"href\",dest);a.dataset.goLinkTo=dest;if(resolved.newTab)a.dataset.goLinkNewtab=\"1\";});}// --- global, document-level capture click handler (installed once) ---------\nfunction installGlobalHandler(){if(window.__goLinkHandler)return;window.__goLinkHandler=true;document.addEventListener(\"click\",e=>{// Let the browser handle modifier / middle / right clicks normally\n// (the href is already correct, so new-tab/copy behave right).\nif(e.defaultPrevented||e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey)return;const t=e.target;const a=t&&t.closest?t.closest(\"a\"):null;if(!a)return;const dest=a.dataset?a.dataset.goLinkTo:null;if(!dest)return;// not a link we manage\n// Document-capture fires before Framer's router; take over cleanly.\ne.preventDefault();e.stopImmediatePropagation();if(a.dataset.goLinkNewtab===\"1\")window.open(dest,\"_blank\",\"noopener\");else window.location.assign(dest);},true// capture\n);}// --- Sandbox variant --------------------------------------------------------\n// Same as GoToLinkPath, plus: on any host other than playfactile.com (e.g. the\n// awspf.com sandbox), links pointing at playfactile.com are rewritten to the\n// current domain. Production behavior is unchanged.\nconst SANDBOX_PROD_HOSTS=[\"playfactile.com\",\"www.playfactile.com\"];function rewriteProdLinks(root){if(typeof window===\"undefined\")return;if(SANDBOX_PROD_HOSTS.includes(window.location.hostname))return;root.querySelectorAll(\"a[href]\").forEach(a=>{let url;try{url=new URL(a.getAttribute(\"href\")||\"\",window.location.href);}catch{return;}if(!SANDBOX_PROD_HOSTS.includes(url.hostname))return;a.setAttribute(\"href\",window.location.origin+url.pathname+url.search+url.hash);});}export function GoToLinkPathSandbox(Component){const Inner=GoToLinkPath(Component);return /*#__PURE__*/forwardRef((props,forwardedRef)=>{const innerRef=useRef(null);const setRef=node=>{innerRef.current=node;if(typeof forwardedRef===\"function\")forwardedRef(node);else if(forwardedRef)forwardedRef.current=node;};useEffect(()=>{const node=innerRef.current;if(!node)return;rewriteProdLinks(node);const obs=new MutationObserver(()=>rewriteProdLinks(node));obs.observe(node,{childList:true,subtree:true,attributes:true,attributeFilter:[\"href\"]});return()=>obs.disconnect();},[]);return /*#__PURE__*/_jsx(Inner,{...props,ref:setRef});});}\nexport const __FramerMetadata__ = {\"exports\":{\"GoToLinkPath\":{\"type\":\"reactHoc\",\"name\":\"GoToLinkPath\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"GoToLinkPathSandbox\":{\"type\":\"reactHoc\",\"name\":\"GoToLinkPathSandbox\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Relative_path.map"],"mappings":"A,8IAqC0F,SAAgBa,EAAaC,EAAU,CAAC,MAAoBd,iBAAYe,EAAMC,IAAe,CAAC,IAAMC,EAAShB,EAAO,IAAI,EAAQiB,EAAOC,GAAM,CAACF,EAAS,QAAQE,EAAQ,OAAOH,GAAe,WAAWA,EAAaG,CAAI,EAAUH,IAAaA,EAAa,QAAQG,EAAK,EAAwV,OAAtVjB,MAAc,CAACkB,EAAqB,EAAE,IAAMD,EAAKF,EAAS,QAAQ,GAAG,CAACE,EAAK,OAAOE,EAAMF,CAAI,EAAE,IAAMG,EAAI,IAAI,qBAAqBD,EAAMF,CAAI,CAAC,EAAEG,EAAI,QAAQH,EAAK,CAAC,UAAU,GAAK,QAAQ,EAAI,CAAC,EAAE,IAAMI,EAAO,CAAC,IAAI,IAAI,GAAG,CAAC,CAAC,IAAIC,GAAIZ,EAAO,eAAeS,EAAMF,CAAI,EAAEK,CAAE,CAAC,EAAE,UAAU,CAACF,EAAI,WAAW,EAAEC,EAAO,QA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