{"version":3,"file":"SmoothScroll.DoT-UXdg.mjs","names":[],"sources":["https:/framerusercontent.com/modules/W6KbGK4q4hLWojBlkkCp/toFPRQ8kaOliowS77Ukt/SmoothScroll.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useEffect}from\"react\";import{addPropertyControls,ControlType}from\"framer\";export default function SmoothScroll({intensity}){useEffect(()=>{const lerp=.015+intensity/100*.165;let current=window.scrollY;let target=window.scrollY;let raf=0;let paused=false;let resizeTimer;// ── Pause during resize so Framer can handle breakpoints freely ────────\nconst onResize=()=>{paused=true;cancelAnimationFrame(raf);clearTimeout(resizeTimer);resizeTimer=setTimeout(()=>{// Re-sync scroll position after Framer has settled\ncurrent=window.scrollY;target=window.scrollY;paused=false;},400);};window.addEventListener(\"resize\",onResize);// ── If target has a scrollable ancestor — let native scroll handle it ──\nconst findScrollableParent=el=>{while(el&&el!==document.documentElement){const s=getComputedStyle(el);if(/auto|scroll/.test(s.overflow+s.overflowY)&&el.scrollHeight>el.clientHeight)return el;el=el.parentElement;}return null;};// ── Respect Framer's \"Page Scroll = Block\" ─────────────────────────────\nconst isPageScrollBlocked=()=>{const b=document.body.style.overflow;const h=document.documentElement.style.overflow;return b===\"hidden\"||h===\"hidden\";};// ── Find the main page scroll container ────────────────────────────────\nconst getPageContainer=()=>{if(document.documentElement.scrollHeight>window.innerHeight)return window;for(const child of Array.from(document.body.children)){const s=getComputedStyle(child);if(/auto|scroll/.test(s.overflow+s.overflowY)&&child.scrollHeight>child.clientHeight)return child;}return window;};const getScrollTop=c=>c===window?window.scrollY:c.scrollTop;const setScrollTop=(c,y)=>c===window?window.scrollTo(0,y):c.scrollTop=y;const getMaxScroll=c=>c===window?document.documentElement.scrollHeight-window.innerHeight:c.scrollHeight-c.clientHeight;const tick=container=>{if(paused)return;const diff=target-current;if(Math.abs(diff)<.1){current=target;return;}current+=diff*lerp;setScrollTop(container,current);raf=requestAnimationFrame(()=>tick(container));};// ── Re-sync after overlay closes (MutationObserver on inline styles) ──\n// When Framer removes overflow:hidden after overlay close, we re-sync\nconst styleObserver=new MutationObserver(()=>{if(!isPageScrollBlocked()){// Overlay just closed — re-sync to actual scroll position\n// so our animation doesn't fight Framer's layout restore\nsetTimeout(()=>{current=window.scrollY;target=window.scrollY;},50);}});styleObserver.observe(document.body,{attributeFilter:[\"style\"]});styleObserver.observe(document.documentElement,{attributeFilter:[\"style\"]});// ── Wheel handler ──────────────────────────────────────────────────────\nconst onWheel=e=>{// Paused during resize — don't touch anything\nif(paused)return;// Inside overlay or any scrollable container — native scroll\nif(findScrollableParent(e.target))return;// Framer has blocked page scroll — respect it, stop animation\nif(isPageScrollBlocked()){e.preventDefault();cancelAnimationFrame(raf);return;}const container=getPageContainer();const max=getMaxScroll(container);if(max<=0)return;e.preventDefault();let delta=e.deltaY;if(e.deltaMode===1)delta*=40;if(e.deltaMode===2)delta*=window.innerHeight;// Re-sync if scroll position drifted (keyboard, touch, etc.)\nconst actual=getScrollTop(container);if(Math.abs(actual-current)>60)current=actual;target=Math.max(0,Math.min(target+delta,max));cancelAnimationFrame(raf);raf=requestAnimationFrame(()=>tick(container));};document.addEventListener(\"wheel\",onWheel,{passive:false,capture:true});return()=>{document.removeEventListener(\"wheel\",onWheel,{capture:true});window.removeEventListener(\"resize\",onResize);styleObserver.disconnect();cancelAnimationFrame(raf);clearTimeout(resizeTimer);};},[intensity]);return /*#__PURE__*/_jsx(\"div\",{style:{position:\"absolute\",width:0,height:0,overflow:\"hidden\",pointerEvents:\"none\",opacity:0}});}SmoothScroll.defaultProps={intensity:20};addPropertyControls(SmoothScroll,{intensity:{type:ControlType.Number,title:\"Intensity\",defaultValue:20,min:1,max:100,step:1,displayStepper:true,description:\"Scroll smoothness. 1 = very soft, 100 = near-native. Recommended: 15–30.\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"SmoothScroll\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__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