{"version":3,"file":"SnapWrapper.BWaiU_Po.mjs","names":["useState","useRef","__legacyOverrideHOC_DataObserverContext","_jsx"],"sources":["https:/framerusercontent.com/modules/dB9xuTYm8VzZFpwfXqe9/K4cIu0a5wllcDoAJdB0p/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(()=>{// Better section selector - targets common Framer elements\nconst getSections=()=>{return document.querySelectorAll('section, [data-framer-name*=\"Section\"], div[class*=\"framer-\"]');};// Hide all sections except #result and #nav on load\nconst hideOtherSections=()=>{const resultSection=document.querySelector(\"#result\");const navSection=document.querySelector(\"#nav\");if(!resultSection){console.warn(\"Result section not found\");return;}const allSections=getSections();allSections.forEach(section=>{// Skip if it's the result section, nav section, or contained within them\nif(section===resultSection||resultSection.contains(section)||section.contains(resultSection)||section===navSection||navSection&&(navSection.contains(section)||section.contains(navSection))){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\";});// Ensure result and nav sections are visible\nresultSection.style.opacity=\"1\";resultSection.style.pointerEvents=\"auto\";if(navSection){navSection.style.opacity=\"1\";navSection.style.pointerEvents=\"auto\";}// Scroll to top\nwindow.scrollTo({top:0,behavior:\"instant\"});initialized.current=true;};// Show all content\nconst showAllContent=()=>{const allSections=getSections();allSections.forEach(section=>{section.style.opacity=\"1\";section.style.pointerEvents=\"auto\";});setIsAtResult(false);};// Hide content except result and nav\nconst hideContentExceptResult=()=>{const resultSection=document.querySelector(\"#result\");const navSection=document.querySelector(\"#nav\");if(!resultSection)return;const allSections=getSections();allSections.forEach(section=>{if(section===resultSection||resultSection.contains(section)||section.contains(resultSection)||section===navSection||navSection&&(navSection.contains(section)||section.contains(navSection))){section.style.opacity=\"1\";section.style.pointerEvents=\"auto\";return;}section.style.opacity=\"0\";section.style.pointerEvents=\"none\";});setIsAtResult(true);};// Initialize after a short delay to ensure DOM is ready\nconst initTimer=setTimeout(hideOtherSections,200);// Check if user is at or past hero section (and show content accordingly)\nconst checkPositionAndShowContent=()=>{const heroSection=document.querySelector(\"#hero\");if(!heroSection)return;const heroRect=heroSection.getBoundingClientRect();const heroTop=heroRect.top;const windowHeight=window.innerHeight;// If hero section is visible or we've scrolled past the result section\nif(heroTop<windowHeight*.75){showAllContent();}else if(window.scrollY<100){hideContentExceptResult();}};// Enhanced scroll monitoring to detect navigation to hero section\nconst handleScroll=()=>{if(isScrolling.current)return;// Check position and update content visibility\ncheckPositionAndShowContent();};// Add scroll listener for passive monitoring\nwindow.addEventListener(\"scroll\",handleScroll,{passive:true});// Function to snap to hero section\nconst snapToHero=()=>{if(isScrolling.current)return;const heroSection=document.querySelector(\"#hero\");if(!heroSection){console.warn(\"Hero section not found\");return;}isScrolling.current=true;// Show all content first\nshowAllContent();// Small delay to ensure visibility changes are applied\nsetTimeout(()=>{heroSection.scrollIntoView({behavior:\"smooth\",block:\"start\"});// Reset scrolling flag after animation\nsetTimeout(()=>{isScrolling.current=false;},1e3);},50);};// Function to snap back to result\nconst snapToResult=()=>{if(isScrolling.current)return;const resultSection=document.querySelector(\"#result\");if(!resultSection){console.warn(\"Result section not found\");return;}isScrolling.current=true;resultSection.scrollIntoView({behavior:\"smooth\",block:\"start\"});// Hide other content after scrolling back\nsetTimeout(()=>{hideContentExceptResult();isScrolling.current=false;},1e3);};// Handle wheel events with less aggressive prevention\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();// Throttle wheel events\nif(now-lastScrollTime.current<300){return;}// At result section (top), scrolling down\nif(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();}};// Handle touch events for mobile\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 touchEnd=e.changedTouches[0].clientY;const diff=touchStart.current-touchEnd;const now=Date.now();if(now-lastScrollTime.current<300)return;// Swipe up from result (minimum 30px swipe)\nif(scrollTop<50&&diff>30){lastScrollTime.current=now;snapToHero();}else if(heroRect.top<=50&&heroRect.top>=-50&&diff<-30){lastScrollTime.current=now;snapToResult();}};// Handle keyboard with less aggressive prevention\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;// Down arrow from result\nif(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();}};// Add event listeners with proper options\nwindow.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);// Show all content on cleanup\nconst allSections=getSections();allSections.forEach(section=>{section.style.opacity=\"1\";section.style.pointerEvents=\"auto\";});window.removeEventListener(\"wheel\",handleWheel);window.removeEventListener(\"touchstart\",handleTouchStart);window.removeEventListener(\"touchend\",handleTouchEnd);window.removeEventListener(\"keydown\",handleKeyDown);};},[]);// Return empty object - no style overrides needed\nreturn{};}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":"iTACA,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,CA+BnN,OA/BoN,MAAc,CAClO,IAAM,MAAwB,SAAS,iBAAiB,gEAAgE,CAClH,MAAsB,CAAC,IAAM,EAAc,SAAS,cAAc,UAAU,CAAO,EAAW,SAAS,cAAc,OAAO,CAAC,GAAG,CAAC,EAAc,CAAC,QAAQ,KAAK,2BAA2B,CAAC,OAA0B,GAAa,CAAa,QAAQ,GAAS,CACjQ,IAAU,GAAe,EAAc,SAAS,EAAQ,EAAE,EAAQ,SAAS,EAAc,EAAE,IAAU,GAAY,IAAa,EAAW,SAAS,EAAQ,EAAE,EAAQ,SAAS,EAAW,IACvL,EAAQ,MAAM,aAAY,EAAQ,MAAM,WAAW,4BAA4B,EAAQ,MAAM,QAAQ,IAAI,EAAQ,MAAM,cAAc,SAAS,CAClJ,EAAc,MAAM,QAAQ,IAAI,EAAc,MAA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