{"version":3,"file":"Smooth_Scroll.UayHzkgB.mjs","names":["useRef","Lenis","_Fragment"],"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":"6PAEG,SAAwB,EAAa,EAAM,CAAC,GAAK,CAAC,aAAW,EAAY,EAAMA,EAAO,KAAK,CAqBW,OArBV,MAAc,CAAI,EAAM,SAAQ,EAAM,QAAQ,SAAS,EAAE,CAAC,UAAU,GAAK,CAAC,EAAG,CAAC,EAAM,CAAC,CAAC,MAAc,CAAC,IAAM,EAAe,SAAS,eAAe,UAAU,CAAC,GAAG,EAAe,CACW,IAAM,EAAS,IAAI,kBADP,EAAc,IAAW,CAAC,IAAI,IAAM,KAAY,EAAe,GAAG,EAAS,OAAO,YAAgE,GAAjC,EAAe,SAAS,OAAO,EAAiB,CACtc,IAAM,EAAY,SAAS,gBAAoC,EAAO,iBAAiB,EAAY,CAAsC,iBAAiB,WAAW,GAAG,SAA8B,EAAM,QAAQ,MAAM,CAAO,EAAM,QAAQ,OAAO,MAAQ,EAAM,QAAQ,OAAO,EAAyD,CAAuE,OAAxC,EAAS,QAAQ,EAAlC,CAAC,UAAU,GAAK,CAAwC,KAAW,EAAS,YAAY,GAAI,EAAE,CAAC,CAAC,MAAc,CAAC,EAAM,QAAQ,IAAIC,EAAM,CAAC,SAAS,EAAU,GAAG,CAAC,CAAC,IAAM,EAAI,GAAM,CAAI,EAAM,UAAS,EAAM,QAAQ,IAAI,EAAK,CAAC,sBAAsB,EAAI,GAA+B,OAA3B,sBAAsB,EAAI,KAAW,CAAC,AAA0C,EAAM,WAA9B,EAAM,QAAQ,SAAS,CAAe,QAAU,EAAE,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