{"version":3,"file":"SnapWrapper.DGFcHEO2.mjs","names":["useState","useRef","__legacyOverrideHOC_DataObserverContext","_jsx"],"sources":["https:/framerusercontent.com/modules/dB9xuTYm8VzZFpwfXqe9/0leYmtFJbj9AWJLC8H8s/SnapWrapper.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect,useRef,useState}from\"react\";// Fixed Snap Scroll Override with content visibility control\nexport function SnapScrollWithVisibility(){const[isAtResult,setIsAtResult]=useState(true);const isScrolling=useRef(false);const lastScrollTime=useRef(0);const touchStart=useRef(0);const initialized=useRef(false);useEffect(()=>{// Helper: find main sections\nconst getSections=()=>{return document.querySelectorAll('section, [data-framer-name*=\"Section\"], div[class*=\"framer-\"]');};const getNav=()=>document.querySelector(\"#nav\")||null;const getResult=()=>document.querySelector(\"#result\")||null;// Utility: skip any node that is nav or contains nav / is contained by nav\nconst isNavRelated=(section,navSection)=>{if(!navSection)return false;return section===navSection||navSection.contains(section)||section.contains(navSection);};// Hide all sections except #result and #nav on load\nconst hideOtherSections=()=>{const resultSection=getResult();const navSection=getNav();if(!resultSection){console.warn(\"Result section not found\");return;}const allSections=getSections();allSections.forEach(sectionNode=>{const section=sectionNode;// Skip nav and anything structurally related to nav\nif(isNavRelated(section,navSection))return;// Skip result and anything inside/around result\nif(section===resultSection||resultSection.contains(section)||section.contains(resultSection)){// Ensure visible\nsection.style.opacity=\"1\";section.style.pointerEvents=\"auto\";return;}// Hide everything else initially\nif(!section.style.transition){section.style.transition=\"opacity 0.3s ease-in-out\";}section.style.opacity=\"0\";section.style.pointerEvents=\"none\";});// Explicitly ensure result is visible\nresultSection.style.opacity=\"1\";resultSection.style.pointerEvents=\"auto\";// Note: nav is never touched here; its own CSS (sticky) rules\n// continue to apply unchanged.\n// Scroll to top\nwindow.scrollTo({top:0,behavior:\"instant\"});initialized.current=true;};// Show all content (but still never touch nav)\nconst showAllContent=()=>{const navSection=getNav();const allSections=getSections();allSections.forEach(sectionNode=>{const section=sectionNode;// Never touch nav or its structural relatives\nif(isNavRelated(section,navSection))return;section.style.opacity=\"1\";section.style.pointerEvents=\"auto\";});setIsAtResult(false);};// Hide content except result (and never touch nav)\nconst hideContentExceptResult=()=>{const resultSection=getResult();const navSection=getNav();if(!resultSection)return;const allSections=getSections();allSections.forEach(sectionNode=>{const section=sectionNode;// Never modify nav or its structural relatives\nif(isNavRelated(section,navSection))return;if(section===resultSection||resultSection.contains(section)||section.contains(resultSection)){section.style.opacity=\"1\";section.style.pointerEvents=\"auto\";return;}section.style.opacity=\"0\";section.style.pointerEvents=\"none\";});setIsAtResult(true);};// Initialise after DOM ready\nconst initTimer=setTimeout(hideOtherSections,200);// Check if user is at/past hero section\nconst checkPositionAndShowContent=()=>{const heroSection=document.querySelector(\"#hero\");if(!heroSection)return;const heroRect=heroSection.getBoundingClientRect();const heroTop=heroRect.top;const windowHeight=window.innerHeight;if(heroTop<windowHeight*.75){// Hero visible or above threshold → reveal everything\nshowAllContent();}else if(window.scrollY<100){// Near top → hide again\nhideContentExceptResult();}};const handleScroll=()=>{if(isScrolling.current)return;checkPositionAndShowContent();};window.addEventListener(\"scroll\",handleScroll,{passive:true});// Snap to hero\nconst snapToHero=()=>{if(isScrolling.current)return;const heroSection=document.querySelector(\"#hero\");if(!heroSection){console.warn(\"Hero section not found\");return;}isScrolling.current=true;showAllContent();setTimeout(()=>{heroSection.scrollIntoView({behavior:\"smooth\",block:\"start\"});setTimeout(()=>{isScrolling.current=false;},1e3);},50);};// Snap back to result\nconst snapToResult=()=>{if(isScrolling.current)return;const resultSection=getResult();if(!resultSection){console.warn(\"Result section not found\");return;}isScrolling.current=true;resultSection.scrollIntoView({behavior:\"smooth\",block:\"start\"});setTimeout(()=>{hideContentExceptResult();isScrolling.current=false;},1e3);};// Wheel\nconst handleWheel=e=>{if(!initialized.current||isScrolling.current){return;}const scrollTop=window.scrollY;const heroSection=document.querySelector(\"#hero\");if(!heroSection)return;const heroRect=heroSection.getBoundingClientRect();const now=Date.now();if(now-lastScrollTime.current<300){return;}if(scrollTop<50&&e.deltaY>0){e.preventDefault();lastScrollTime.current=now;snapToHero();}else if(heroRect.top<=50&&heroRect.top>=-50&&e.deltaY<0){e.preventDefault();lastScrollTime.current=now;snapToResult();}};// Touch\nconst handleTouchStart=e=>{touchStart.current=e.touches[0].clientY;};const handleTouchEnd=e=>{if(!initialized.current||isScrolling.current){return;}const scrollTop=window.scrollY;const heroSection=document.querySelector(\"#hero\");if(!heroSection)return;const heroRect=heroSection.getBoundingClientRect();const touchEndY=e.changedTouches[0].clientY;const diff=touchStart.current-touchEndY;const now=Date.now();if(now-lastScrollTime.current<300)return;if(scrollTop<50&&diff>30){lastScrollTime.current=now;snapToHero();}else if(heroRect.top<=50&&heroRect.top>=-50&&diff<-30){lastScrollTime.current=now;snapToResult();}};// Keyboard\nconst handleKeyDown=e=>{if(!initialized.current||isScrolling.current){return;}const scrollTop=window.scrollY;const heroSection=document.querySelector(\"#hero\");if(!heroSection)return;const heroRect=heroSection.getBoundingClientRect();const now=Date.now();if(now-lastScrollTime.current<300)return;if(scrollTop<50&&(e.key===\"ArrowDown\"||e.key===\"PageDown\"||e.key===\" \")){e.preventDefault();lastScrollTime.current=now;snapToHero();}else if(heroRect.top<=50&&heroRect.top>=-50&&(e.key===\"ArrowUp\"||e.key===\"PageUp\")){e.preventDefault();lastScrollTime.current=now;snapToResult();}};window.addEventListener(\"wheel\",handleWheel,{passive:false});window.addEventListener(\"touchstart\",handleTouchStart,{passive:true});window.addEventListener(\"touchend\",handleTouchEnd,{passive:true});window.addEventListener(\"keydown\",handleKeyDown);// Cleanup\nreturn()=>{clearTimeout(initTimer);const navSection=getNav();const allSections=getSections();allSections.forEach(sectionNode=>{const section=sectionNode;if(isNavRelated(section,navSection))return;section.style.opacity=\"1\";section.style.pointerEvents=\"auto\";});window.removeEventListener(\"wheel\",handleWheel);window.removeEventListener(\"touchstart\",handleTouchStart);window.removeEventListener(\"touchend\",handleTouchEnd);window.removeEventListener(\"keydown\",handleKeyDown);window.removeEventListener(\"scroll\",handleScroll);};},[]);return{};}import{useContext as __legacyOverrideHOC_useContext}from\"react\";import{DataObserverContext as __legacyOverrideHOC_DataObserverContext}from\"framer\";export function withSnapScrollWithVisibility(C){return props=>{__legacyOverrideHOC_useContext(__legacyOverrideHOC_DataObserverContext);return _jsx(C,{...props,...SnapScrollWithVisibility(props)});};}withSnapScrollWithVisibility.displayName=\"SnapScrollWithVisibility\";\nexport const __FramerMetadata__ = {\"exports\":{\"withSnapScrollWithVisibility\":{\"type\":\"reactHoc\",\"name\":\"withSnapScrollWithVisibility\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"SnapScrollWithVisibility\":{\"type\":\"override\",\"name\":\"SnapScrollWithVisibility\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./SnapWrapper.map"],"mappings":"iMACA,SAAgB,GAA0B,CAAC,GAAK,CAAC,EAAW,GAAeA,EAAS,GAAK,CAAO,EAAYC,EAAO,GAAM,CAAO,EAAeA,EAAO,EAAE,CAAO,EAAWA,EAAO,EAAE,CAAO,EAAYA,EAAO,GAAM,CAyB+T,OAzB9T,MAAc,CAClO,IAAM,MAAwB,SAAS,iBAAiB,gEAAgE,CAAS,MAAW,SAAS,cAAc,OAAO,EAAE,KAAW,MAAc,SAAS,cAAc,UAAU,EAAE,KAClO,GAAc,EAAQ,IAAkB,EAA+B,IAAU,GAAY,EAAW,SAAS,EAAQ,EAAE,EAAQ,SAAS,EAAW,CAA7F,GAC1D,MAAsB,CAAC,IAAM,EAAc,GAAW,CAAO,EAAW,GAAQ,CAAC,GAAG,CAAC,EAAc,CAAC,QAAQ,KAAK,2BAA2B,CAAC,OAA0B,GAAa,CAAa,QAAQ,GAAa,CAAC,IAAM,EAAQ,EACxO,MAAa,EAAQ,EAAW,CACnC,IAAG,IAAU,GAAe,EAAc,SAAS,EAAQ,EAAE,EAAQ,SAAS,EAAc,CAAC,CAC7F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