{"version":3,"file":"Smooth_Scroll.CceJHDlx.mjs","names":["useRef","Lenis","_Fragment","__esmMin","init_ssg_sandbox_shims","window","de","l","c","init_jsx_runtime","init_npm_react_18_3_1","ce","addPropertyControls","init_framer_D6uXRwWs","ControlType","init_lenis_modern","l$1","SmoothScroll","props","lenis","overlayElement","observer","mutation","mutationsList","htmlElement","intensity","raf","time","styleElement","init_Smooth_Scroll"],"sources":["https:/framerusercontent.com/modules/Yppqt3Cs3Y8TZqvASnXl/I0BNwkDq86NkxvMxt7DV/Smooth_Scroll.js"],"sourcesContent":["import{jsx as _jsx,Fragment as _Fragment}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import Lenis from\"@studio-freight/lenis\";import{useEffect,useRef}from\"react\";/**\n * @framerDisableUnlink\n */export default function SmoothScroll(props){const{intensity}=props;const lenis=useRef(null);useEffect(()=>{if(lenis.current)lenis.current.scrollTo(0,{immediate:true});},[lenis]);useEffect(()=>{const overlayElement=document.getElementById(\"overlay\");if(overlayElement){const handleMutation=(mutationsList,observer)=>{for(const mutation of mutationsList){if(mutation.type===\"childList\"){const hasChildren=overlayElement.children.length>0;if(hasChildren){// Check if the html tag has the style \"overflow: hidden;\"\nconst htmlElement=document.documentElement;const computedStyle=window.getComputedStyle(htmlElement);const isOverflowHidden=computedStyle.getPropertyValue(\"overflow\")===\"hidden\";if(isOverflowHidden){lenis.current.stop();}else{lenis.current.start();}}else{lenis.current.start();}}}};const observer=new MutationObserver(handleMutation);const config={childList:true};observer.observe(overlayElement,config);return()=>observer.disconnect();}},[]);useEffect(()=>{lenis.current=new Lenis({duration:intensity/10});const raf=time=>{if(lenis.current){lenis.current.raf(time);requestAnimationFrame(raf);}};requestAnimationFrame(raf);return()=>{if(lenis.current){lenis.current.destroy();lenis.current=null;}};},[]);useEffect(()=>{const styleElement=document.createElement(\"style\");styleElement.textContent=`\n        html.lenis {\n            height: auto;\n        }\n\n        .lenis.lenis-smooth {\n            scroll-behavior: auto !important;\n        }\n\n        .lenis.lenis-smooth [data-lenis-prevent] {\n            overscroll-behavior: contain;\n        }\n\n        .lenis.lenis-stopped {\n            overflow: hidden;\n        }\n\n        .lenis.lenis-scrolling iframe {\n            pointer-events: none;\n        }\n    `;document.head.appendChild(styleElement);return()=>{document.head.removeChild(styleElement);};},[]);return /*#__PURE__*/_jsx(_Fragment,{});}SmoothScroll.displayName=\"Smooth Scroll\";addPropertyControls(SmoothScroll,{intensity:{title:\"Intensity\",type:ControlType.Number,defaultValue:10}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"SmoothScroll\",\"slots\":[],\"annotations\":{\"framerDisableUnlink\":\"\",\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Smooth_Scroll.map"],"mappings":"A,uPAEG,SAAwBiB,EAAa,EAAM,CAAC,GAAK,CAAC,aAAWC,EAAYC,EAAMnB,EAAO,IAAI,EAqBY,OArBVW,MAAc,CAAIQ,EAAM,SAAQA,EAAM,QAAQ,SAAS,EAAE,CAAC,UAAU,EAAI,CAAC,CAAE,EAAE,CAACA,CAAK,CAAC,EAAER,MAAc,CAAC,IAAMS,EAAe,SAAS,eAAe,SAAS,EAAE,GAAGA,EAAe,CACW,IAAMC,EAAS,IAAI,kBADP,EAAc,IAAW,CAAC,IAAI,IAAMC,KAAYC,EAAe,GAAGD,EAAS,OAAO,YAAY,CAAoD,GAAjCF,EAAe,SAAS,OAAO,EAAiB,CACtc,IAAMI,EAAY,SAAS,gBAAoCnB,EAAO,iBAAiBmB,CAAgD,CAAC,CAAC,iBAAiB,UAAU,IAAI,SAA8BL,EAAM,QAAQ,KAAK,EAAQA,EAAM,QAAQ,MAAM,CAAG,MAAMA,EAAM,QAAQ,MAAM,CAAG,CAAE,CAAoD,EAAwE,OAAxCE,EAAS,QAAQD,EAAe,CAAhD,UAAU,EAA2C,CAAC,MAAYC,EAAS,WAAW,CAAE,CAAC,EAAE,CA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