{"version":3,"file":"ReadingProgress.CfuxHnJA.mjs","names":["React.useRef","React.useMemo","React.useCallback"],"sources":["https:/framerusercontent.com/modules/nv2FM4zCMRbKXlS76nnn/iKgb5lnG260gqLwumg3n/ReadingProgress.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import*as React from\"react\";import{addPropertyControls,ControlType,useIsStaticRenderer}from\"framer\";const GRADIENT_PAN_CLASS=\"framer-gradient-pan\";const GRADIENT_PAN_STYLE_ID=\"framer-gradient-pan-style\";/**\n * @framerSupportedLayoutWidth any-prefer-fixed\n * @framerSupportedLayoutHeight fixed\n */export default function ReadingProgress(props){const{barHeight,color1,color2,color3}=props;const fillRef=React.useRef(null);const rafRef=React.useRef(null);const isStaticRenderer=useIsStaticRenderer();const gradient=React.useMemo(()=>`linear-gradient(120deg, ${color1} 0%, ${color2} 50%, ${color3} 100%)`,[color1,color2,color3]);const updateProgress=React.useCallback(()=>{if(typeof window===\"undefined\")return;if(!fillRef.current)return;const scrollTop=window.scrollY||window.pageYOffset||document.documentElement.scrollTop||0;const doc=document.documentElement;const maxScroll=doc.scrollHeight-window.innerHeight;const progress=maxScroll>0?Math.min(1,Math.max(0,scrollTop/maxScroll)):1;fillRef.current.style.width=`${progress*100}%`;},[]);const scheduleUpdate=React.useCallback(()=>{if(typeof window===\"undefined\")return;if(rafRef.current!==null)return;rafRef.current=window.requestAnimationFrame(()=>{rafRef.current=null;updateProgress();});},[updateProgress]);React.useEffect(()=>{if(isStaticRenderer)return;if(typeof window===\"undefined\")return;updateProgress();const onScroll=()=>scheduleUpdate();const onResize=()=>scheduleUpdate();window.addEventListener(\"scroll\",onScroll,{passive:true});window.addEventListener(\"resize\",onResize,{passive:true});return()=>{window.removeEventListener(\"scroll\",onScroll);window.removeEventListener(\"resize\",onResize);if(rafRef.current!==null){window.cancelAnimationFrame(rafRef.current);}};},[isStaticRenderer,scheduleUpdate,updateProgress]);const fallbackWidth=isStaticRenderer?\"30%\":\"0%\";return /*#__PURE__*/_jsx(\"div\",{style:{position:\"relative\",width:\"100%\",height:Math.max(1,barHeight),background:\"transparent\",overflow:\"hidden\",pointerEvents:\"none\"},children:/*#__PURE__*/_jsx(\"div\",{ref:fillRef,style:{width:fallbackWidth,height:\"100%\",backgroundImage:gradient,transition:\"none\",willChange:\"width\"}})});}addPropertyControls(ReadingProgress,{barHeight:{type:ControlType.Number,title:\"Bar Height\",defaultValue:2,min:1,max:20,unit:\"px\",step:1},color1:{type:ControlType.Color,title:\"Color 1\",defaultValue:\"#FFB88C\"},color2:{type:ControlType.Color,title:\"Color 2\",defaultValue:\"#FF8FB2\"},color3:{type:ControlType.Color,title:\"Color 3\",defaultValue:\"#B8A6FF\"}});export function withGradientPan(Component){return /*#__PURE__*/React.forwardRef(function GradientPanOverride(props,ref){const hostRef=React.useRef(null);const isStaticRenderer=useIsStaticRenderer();const setRefs=React.useCallback(node=>{hostRef.current=node;if(typeof ref===\"function\"){ref(node);return;}if(ref&&typeof ref===\"object\"){ref.current=node;}},[ref]);React.useEffect(()=>{if(isStaticRenderer)return;if(typeof window===\"undefined\"||typeof document===\"undefined\")return;const root=hostRef.current;if(!root)return;const reducedMotion=window.matchMedia?.(\"(prefers-reduced-motion: reduce)\").matches;if(!reducedMotion&&!document.getElementById(GRADIENT_PAN_STYLE_ID)){const style=document.createElement(\"style\");style.id=GRADIENT_PAN_STYLE_ID;style.textContent=`\n@keyframes framerGradientPanX {\n  0% { background-position: 0% 50%; }\n  100% { background-position: 100% 50%; }\n}\n.${GRADIENT_PAN_CLASS} {\n  animation: framerGradientPanX 12s linear infinite alternate;\n}`;document.head.appendChild(style);}const targetSpans=Array.from(root.querySelectorAll(\"span\"));const touched=[];for(const node of targetSpans){const styles=window.getComputedStyle(node);const colorValue=styles.color.replace(/\\s+/g,\"\").toLowerCase();if(colorValue!==\"rgb(255,143,178)\")continue;touched.push({node,backgroundImage:node.style.backgroundImage,backgroundSize:node.style.backgroundSize,webkitBackgroundClip:node.style.webkitBackgroundClip,backgroundClip:node.style.backgroundClip,webkitTextFillColor:node.style.webkitTextFillColor,color:node.style.color,willChange:node.style.willChange});node.style.backgroundImage=\"linear-gradient(120deg, #FFB88C 0%, #FF8FB2 50%, #B8A6FF 100%)\";node.style.backgroundSize=\"200% 100%\";node.style.webkitBackgroundClip=\"text\";node.style.backgroundClip=\"text\";node.style.webkitTextFillColor=\"transparent\";node.style.color=\"transparent\";node.style.willChange=\"background-position\";if(!reducedMotion){node.classList.add(GRADIENT_PAN_CLASS);}else{node.classList.remove(GRADIENT_PAN_CLASS);}}return()=>{touched.forEach(item=>{item.node.classList.remove(GRADIENT_PAN_CLASS);item.node.style.backgroundImage=item.backgroundImage;item.node.style.backgroundSize=item.backgroundSize;item.node.style.webkitBackgroundClip=item.webkitBackgroundClip;item.node.style.backgroundClip=item.backgroundClip;item.node.style.webkitTextFillColor=item.webkitTextFillColor;item.node.style.color=item.color;item.node.style.willChange=item.willChange;});};},[isStaticRenderer]);return /*#__PURE__*/_jsx(Component,{ref:setRefs,...props});});}\nexport const __FramerMetadata__ = {\"exports\":{\"withGradientPan\":{\"type\":\"reactHoc\",\"name\":\"withGradientPan\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"default\":{\"type\":\"reactComponent\",\"name\":\"ReadingProgress\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"fixed\",\"framerSupportedLayoutWidth\":\"any-prefer-fixed\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ReadingProgress.map"],"mappings":"4NAGG,SAAwB,EAAgB,EAAM,CAAC,GAAK,CAAC,YAAU,SAAO,SAAO,UAAQ,EAAY,EAAQA,EAAa,IAAI,EAAQ,EAAOA,EAAa,IAAI,EAAQ,EAAiB,EAAoB,EAAQ,EAASC,MAAkB,2BAA2B,EAAO,OAAO,EAAO,QAAQ,EAAO,QAAQ,CAAC,EAAO,EAAO,CAAM,CAAC,EAAQ,EAAeC,MAAsB,CAA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