{"version":3,"file":"Scroll_Progress.Cxt6r97V.mjs","names":["useState","useRef","_Fragment"],"sources":["https:/framerusercontent.com/modules/5sMyyRNBCFou1FTdi7TY/dzcArUzEjrhkQuoIf5Uh/Scroll_Progress.js"],"sourcesContent":["import{jsx as _jsx,Fragment as _Fragment}from\"react/jsx-runtime\";import{useState,useEffect,useRef}from\"react\";import{useProgressStore}from\"https://framerusercontent.com/modules/c61m7y27y4l9UUTWlfvc/MyJWl2bkS9Bm96WNq9cP/globalStore.js\";import{ControlType,addPropertyControls}from\"framer\";export function withProgress(Component){return props=>{const[isScrolling,setIsScrolling]=useState(false);const prevScrollY=useRef(0);const[progress,setProgress]=useProgressStore();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(_Fragment,{children:/*#__PURE__*/_jsx(Component,{...props,style:{width:`${progress}%`,transition:isScrolling?\"none\":\"width 0.5s ease-in-out\"}})});};}addPropertyControls(withProgress,{showScroll:{type:ControlType.Boolean,title:\"Show Scroll\",defaultValue:true}});\nexport const __FramerMetadata__ = {\"exports\":{\"withProgress\":{\"type\":\"reactHoc\",\"name\":\"withProgress\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Scroll_Progress.map"],"mappings":"mQAA+R,SAAgB,EAAa,EAAU,CAAC,MAAO,IAAO,CAAC,GAAK,CAAC,EAAY,GAAgBA,EAAS,GAAM,CAAO,EAAYC,EAAO,EAAE,CAAM,CAAC,EAAS,GAAa,GAAkB,CAAs6B,OAAr6B,MAAc,CAAC,IAAM,MAAsB,CAAC,IAAM,EAAQ,SAAS,eAAe,QAAQ,CAAO,EAAM,SAAS,eAAe,MAAM,CAAC,GAAG,GAAS,EAAM,CAAC,IAAM,EAAc,EAAM,UAAU,EAAQ,UAAiN,IAAlL,EAAO,aAAa,SAAS,gBAAgB,WAAqD,EAAQ,WAAsD,EAAc,IAAgC,GAAU,MAAiB,CAAC,IAAM,EAAQ,EAAO,aAAa,SAAS,gBAAgB,UAAa,IAAU,EAAY,UAAS,EAAY,QAAQ,EAAQ,GAAmB,CAAC,EAAe,GAAK,GAAU,MAAoB,CAAC,EAAe,GAAM,EAA2H,OAAxH,GAAmB,CAAC,EAAO,iBAAiB,SAAS,EAAa,CAAC,EAAO,iBAAiB,YAAY,EAAgB,KAAW,CAAC,EAAO,oBAAoB,SAAS,EAAa,CAAC,EAAO,oBAAoB,YAAY,EAAgB,GAAK,EAAE,CAAC,CAAqB,EAAKC,EAAU,CAAC,SAAsB,EAAK,EAAU,CAAC,GAAG,EAAM,MAAM,CAAC,MAAM,GAAG,EAAS,GAAG,WAAW,EAAY,OAAO,yBAAyB,CAAC,CAAC,CAAC,CAAC,uBAAj+C,IAA6C,IAA6H,IAAoD,CAAuwC,EAAoB,EAAa,CAAC,WAAW,CAAC,KAAK,EAAY,QAAQ,MAAM,cAAc,aAAa,GAAK,CAAC,CAAC"}