{"version":3,"file":"PageExit.DH28faOg.mjs","names":["p"],"sources":["https:/framerusercontent.com/modules/dZmSD1wtrV5SPIkUIQm6/JxCv6nho8qT7DvZbNO6O/PageExit.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect}from\"react\";import{useIsStaticRenderer}from\"framer\";// Quick exit fade. Pure opacity, linear (mirrors the entrance, just faster).\nconst ITEM_DURATION=220// ms per unit\n;const STAGGER=30// ms between units (bottom -> top)\n;const EASING=\"linear\";const LINE_TOLERANCE=4// px: tokens within this top-delta are the same line\n;let exiting=false;function inViewport(el){const r=el.getBoundingClientRect();if(r.width<=0||r.height<=0)return false;const vh=window.innerHeight||document.documentElement.clientHeight;const vw=window.innerWidth||document.documentElement.clientWidth;return r.bottom>0&&r.top<vh&&r.right>0&&r.left<vw;}// A Framer text-effect token: a leaf <span> with inline-block + will-change.\nfunction isTextToken(s){if(s.children.length>0)return false;if(!(s.textContent||\"\").trim())return false;const st=s.getAttribute(\"style\")||\"\";return st.includes(\"inline-block\")&&st.includes(\"will-change\");}function collectUnits(){const units=[];// 1) Block elements that carry a Framer appear (entrance) effect.\nlet blocks=Array.from(document.querySelectorAll(\"[data-framer-appear-id]\")).filter(inViewport);const blockSet=new Set(blocks);blocks=blocks.filter(el=>{// keep only the outermost appear elements\nlet p=el.parentElement;while(p){if(blockSet.has(p))return false;p=p.parentElement;}return true;});blocks.forEach(el=>units.push({top:el.getBoundingClientRect().top,els:[el]}));// 2) Text-effect tokens (per-character spans) grouped into visual lines.\n//    Skip any that live inside an appear-id block (that block fades them).\nconst tokens=Array.from(document.querySelectorAll(\"span\")).filter(s=>isTextToken(s)&&inViewport(s)&&!s.closest(\"[data-framer-appear-id]\"));const lines=[];tokens.forEach(tok=>{const top=tok.getBoundingClientRect().top;let line=lines.find(l=>Math.abs(l.top-top)<=LINE_TOLERANCE);if(!line){line={top,els:[]};lines.push(line);}line.els.push(tok);});lines.forEach(l=>units.push({top:l.top,els:l.els}));return units;}function playExitThenNavigate(href){const units=collectUnits();if(units.length===0){window.location.assign(href);return;}// Bottom -> top.\nunits.sort((a,b)=>b.top-a.top);let lastDelay=0;units.forEach((unit,i)=>{const delay=i*STAGGER;lastDelay=delay;unit.els.forEach(el=>el.animate([{opacity:1},{opacity:0}],{duration:ITEM_DURATION,delay,easing:EASING,fill:\"forwards\"}));});const total=lastDelay+ITEM_DURATION+20;window.setTimeout(()=>window.location.assign(href),total);}export function withPageExit(Component){return props=>{const isStatic=useIsStaticRenderer();useEffect(()=>{if(isStatic||typeof window===\"undefined\")return;let downX=0;let downY=0;// Returns the destination href if the target is a link we should\n// intercept (same-origin, different page, same tab), else null.\nfunction qualifyingHref(target){const el=target;const anchor=el?.closest?.(\"a[href]\");if(!anchor||anchor.target===\"_blank\")return null;const url=new URL(anchor.href,window.location.href);if(url.origin!==window.location.origin)return null;if(url.pathname===window.location.pathname)return null;return url.href;}function suppress(e){if(qualifyingHref(e.target)){e.preventDefault();e.stopPropagation();}}function onDown(e){const p=\"touches\"in e?e.touches[0]:e;downX=p?p.clientX:0;downY=p?p.clientY:0;}// Primary intercept: fires on release (covers mouse + touch).\nfunction activate(e){if(exiting){suppress(e);return;}const me=e;if(me.metaKey||me.ctrlKey||me.shiftKey||me.altKey)return;if(me.pointerType===\"mouse\"&&me.button!==0)return;const point=\"changedTouches\"in e&&e.changedTouches[0]?e.changedTouches[0]:e;const moved=Math.hypot((point.clientX??downX)-downX,(point.clientY??downY)-downY);if(moved>10)return;// it was a scroll/drag, not a tap\nconst href=qualifyingHref(e.target);if(!href)return;e.preventDefault();e.stopPropagation();exiting=true;playExitThenNavigate(href);}const opts={capture:true,passive:false};document.addEventListener(\"pointerdown\",onDown,true);document.addEventListener(\"touchstart\",onDown,true);document.addEventListener(\"pointerup\",activate,opts);document.addEventListener(\"touchend\",activate,opts);// Click runs last: suppress the synthesized click, and act as a\n// fallback on platforms where pointer/touch release didn't fire.\ndocument.addEventListener(\"click\",activate,opts);return()=>{document.removeEventListener(\"pointerdown\",onDown,true);document.removeEventListener(\"touchstart\",onDown,true);document.removeEventListener(\"pointerup\",activate,opts);document.removeEventListener(\"touchend\",activate,opts);document.removeEventListener(\"click\",activate,opts);exiting=false;};},[isStatic]);return /*#__PURE__*/_jsx(Component,{...props});};}\nexport const __FramerMetadata__ = {\"exports\":{\"withPageExit\":{\"type\":\"reactHoc\",\"name\":\"withPageExit\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./PageExit.map"],"mappings":"6KAImB,SAAS,EAAW,EAAG,CAAC,IAAM,EAAE,EAAG,uBAAuB,CAAC,GAAG,EAAE,OAAO,GAAG,EAAE,QAAQ,EAAE,MAAO,GAAM,IAAM,EAAG,EAAO,aAAa,SAAS,gBAAgB,aAAmB,EAAG,EAAO,YAAY,SAAS,gBAAgB,YAAY,OAAO,EAAE,OAAO,GAAG,EAAE,IAAI,GAAI,EAAE,MAAM,GAAG,EAAE,KAAK,EACzS,SAAS,EAAY,EAAE,CAAqC,GAAjC,EAAE,SAAS,OAAO,GAAkB,EAAE,EAAE,aAAa,IAAI,MAAM,CAAC,MAAO,GAAM,IAAM,EAAG,EAAE,aAAa,QAAQ,EAAE,GAAG,OAAO,EAAG,SAAS,eAAe,EAAE,EAAG,SAAS,cAAc,CAAE,SAAS,GAAc,CAAC,IAAM,EAAM,EAAE,CAC/O,EAAO,MAAM,KAAK,SAAS,iBAAiB,0BAA0B,CAAC,CAAC,OAAO,EAAW,CAAO,EAAS,IAAI,IAAI,EAAO,CAAC,EAAO,EAAO,OAAO,GAAI,CACvJ,IAAIA,EAAE,EAAG,cAAc,KAAMA,GAAE,CAAC,GAAG,EAAS,IAAIA,EAAE,CAAC,MAAO,GAAM,EAAEA,EAAE,cAAe,MAAO,IAAO,CAAC,EAAO,QAAQ,GAAI,EAAM,KAAK,CAAC,IAAI,EAAG,uBAAuB,CAAC,IAAI,IAAI,CAAC,EAAG,CAAC,CAAC,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