{"version":3,"file":"Scroll_progress.SVTdcIYV.mjs","names":["useState","useRef"],"sources":["https:/framerusercontent.com/modules/Jdwd2lQo4iw4woCsxxHv/l811n4YOdl8etbAt5PC0/Scroll_progress.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useState,useEffect,useRef}from\"react\";export function withProgress(Component){return props=>{const[progress,setProgress]=useState(0);const[isScrolling,setIsScrolling]=useState(false);const prevScrollY=useRef(0);useEffect(()=>{const calculateProgress=()=>{const startEl=document.getElementById(\"start\");const endEl=document.getElementById(\"end\");if(startEl&&endEl){const sectionHeight=endEl.offsetTop-startEl.offsetTop;const scrollDistance=window.pageYOffset||document.documentElement.scrollTop;const sectionScrollDistance=scrollDistance-startEl.offsetTop;const sectionProgress=sectionScrollDistance/sectionHeight*100;setProgress(sectionProgress);}};const handleScroll=()=>{const scrollY=window.pageYOffset||document.documentElement.scrollTop;if(scrollY!==prevScrollY.current){prevScrollY.current=scrollY;calculateProgress();setIsScrolling(true);}};const handleScrollEnd=()=>{setIsScrolling(false);};calculateProgress();window.addEventListener(\"scroll\",handleScroll);window.addEventListener(\"scrollend\",handleScrollEnd);return()=>{window.removeEventListener(\"scroll\",handleScroll);window.removeEventListener(\"scrollend\",handleScrollEnd);};},[]);return /*#__PURE__*/_jsx(Component,{...props,style:{width:`${progress}%`,transition:isScrolling?\"none\":\"width 0.5s ease-in-out\"}});};}\nexport const __FramerMetadata__ = {\"exports\":{\"withProgress\":{\"type\":\"reactHoc\",\"name\":\"withProgress\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Scroll_progress.map"],"mappings":"mNAAwF,SAAgB,EAAa,EAAU,CAAC,MAAO,IAAO,CAAC,GAAK,CAAC,EAAS,EAAY,CAACA,EAAS,GAAQ,CAAC,EAAY,EAAe,CAACA,EAAS,IAAa,EAAYC,EAAO,GAAw6B,OAAr6B,MAAc,CAAC,IAAM,MAAsB,CAAC,IAAM,EAAQ,SAAS,eAAe,SAAe,EAAM,SAAS,eAAe,OAAO,GAAG,GAAS,EAAM,CAAC,IAAM,EAAc,EAAM,UAAU,EAAQ,UAAgB,EAAe,EAAO,aAAa,SAAS,gBAAgB,UAAgB,EAAsB,EAAe,EAAQ,UAAgB,EAAgB,EAAsB,EAAc,IAAI,EAAY,EAAkB,CAAC,EAAO,MAAiB,CAAC,IAAM,EAAQ,EAAO,aAAa,SAAS,gBAAgB,UAAa,IAAU,EAAY,UAAS,EAAY,QAAQ,EAAQ,IAAoB,EAAe,IAAQ,EAAO,MAAoB,CAAC,EAAe,GAAQ,EAAyH,OAAxH,IAAoB,EAAO,iBAAiB,SAAS,GAAc,EAAO,iBAAiB,YAAY,OAA2B,CAAC,EAAO,oBAAoB,SAAS,GAAc,EAAO,oBAAoB,YAAY,EAAkB,CAAE,EAAC,EAAE,EAAsB,EAAK,EAAU,CAAC,GAAG,EAAM,MAAM,CAAC,MAAM,GAAG,EAAS,GAAG,WAAW,EAAY,OAAO,yBAAyB,CAAC,CAAG,CAAE"}