{"version":3,"file":"Smooth_Scroll.xI_DGMTc.mjs","names":["useRef","Lenis","_Fragment","__esmMin","init_npm_react_18_3_1","window","de","init_jsx_runtime","c","ce","init_ssg_sandbox_shims","init_framer_BWFVvmND","addPropertyControls","ControlType","l$1","init_lenis_modern","SmoothScroll","props","lenis","overlayElement","observer","mutation","mutationsList","htmlElement","allElements","i","element","intensity","raf","time","styleElement","l","init_Smooth_Scroll"],"sources":["https:/framerusercontent.com/modules/11ESVHhCyl2YUkxbseoQ/1nHvxJd1hqosXG9cD1wF/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":"A,6PAEG,SAAwBgB,EAAa,EAAM,CAAC,GAAK,CAAC,aAAWC,EAAYC,EAAMlB,EAAO,IAAI,EAqBQ,OArBNS,MAAc,CAAIS,EAAM,SAAQA,EAAM,QAAQ,SAAS,EAAE,CAAC,UAAU,EAAI,CAAC,CAAE,EAAE,CAACA,CAAK,CAAC,EAAET,MAAc,CAAC,IAAMU,EAAe,SAAS,eAAe,SAAS,EAAE,GAAGA,EAAe,CACT,IAAMC,EAAS,IAAI,kBADa,EAAc,IAAW,CAAC,IAAI,IAAMC,KAAYC,EAAe,GAAGD,EAAS,OAAO,aAA+BF,EAAe,SAAS,OAAO,EAAiB,CACtc,IAAMI,EAAY,SAAS,gBAAoClB,EAAO,iBAAiBkB,CAAgD,CAAC,CAAC,iBAAiB,UAAU,IAAI,UAA8BJ,EAAe,aAAa,qBAAqB,MAAM,CAAG,CAAG,CAAoD,EAAwE,OA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