{"version":3,"file":"Smooth_Scroll.Bugv6oUY.mjs","names":["observer","Lenis","_Fragment"],"sources":["https:/framerusercontent.com/modules/Yppqt3Cs3Y8TZqvASnXl/qXyG1UgqGGx5DS4G9abM/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){overlayElement.setAttribute(\"data-lenis-prevent\",\"true\");}}}}};const observer=new MutationObserver(handleMutation);const config={childList:true};observer.observe(overlayElement,config);return()=>observer.disconnect();}},[]);useEffect(()=>{const allElements=document.getElementsByTagName(\"*\");for(let i=0;i<allElements.length;i++){const element=allElements[i];const computedStyle=window.getComputedStyle(element);if(computedStyle.getPropertyValue(\"overflow\")===\"auto\"){element.setAttribute(\"data-lenis-prevent\",\"true\");}}},[]);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=`\nhtml.lenis {\nheight: auto;\n}\n.lenis.lenis-smooth {\n\nscroll-behavior: auto !important;\n}\n.lenis.lenis-smooth [data-lenis-prevent] {\n\noverscroll-behavior: contain;\n}\n.lenis.lenis-stopped {\n\noverflow: hidden;\n}\n.lenis.lenis-scrolling iframe {\n\npointer-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\":{\"framerContractVersion\":\"1\",\"framerDisableUnlink\":\"\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Smooth_Scroll.map"],"mappings":"gYAEG,SAAwB,EAAa,EAAM,CAAC,GAAK,CAAC,YAAU,CAAC,EAAY,EAAM,EAAO,KAAK,CAqBO,MArBN,GAAU,IAAI,CAAC,AAAG,EAAM,SAAQ,EAAM,QAAQ,SAAS,EAAE,CAAC,WAAU,CAAK,EAAC,AAAE,EAAC,CAAC,CAAM,EAAC,CAAC,EAAU,IAAI,CAAC,IAAM,EAAe,SAAS,eAAe,UAAU,CAAC,GAAG,EAAe,CAAC,IAAM,EAAe,CAAC,EAAcA,IAAW,CAAC,IAAI,IAAM,KAAY,EAAe,GAAG,EAAS,OAAO,YAAY,CAAC,IAAM,EAAY,EAAe,SAAS,OAAO,EAAE,GAAG,EAAY,CACtc,IAAM,EAAY,SAAS,gBAAsB,EAAc,EAAO,iBAAiB,EAAY,CAAO,EAAiB,EAAc,iBAAiB,WAAW,GAAG,SAAS,AAAG,GAAkB,EAAe,aAAa,qBAAqB,OAAO,AAAG,CAAC,CAAE,EAAO,EAAS,IAAI,iBAAiB,GAAsB,EAAO,CAAC,WAAU,CAAK,EAAyC,MAAxC,GAAS,QAAQ,EAAe,EAAO,CAAO,IAAI,EAAS,YAAY,AAAE,CAAC,EAAC,CAAE,EAAC,CAAC,EAAU,IA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