{"version":3,"file":"ReadingTime.COMU87mD.mjs","names":["useState","__legacyOverrideHOC_DataObserverContext","_jsx"],"sources":["https:/framerusercontent.com/modules/n72m7RuBPBA1vL71BQQ5/s0TlOX5hTPqB7B3mCSKZ/ReadingTime.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useState,useEffect}from\"react\";export function ReadingTimeOfPage(){const[readingTimeText,setReadingTimeText]=useState(\"\");const[loading,setLoading]=useState(true);useEffect(()=>{// Set up a loading animation: update a random 3-digit number every 75ms\nconst loadingInterval=setInterval(()=>{const randomNum=Math.floor(Math.random()*1e3);const formatted=String(randomNum).padStart(3,\"0\");setReadingTimeText(`${formatted} min`);},75);// Function to calculate the reading time based on all text layers\nconst calculateReadingTime=()=>{const textElements=document.querySelectorAll(\".framer-text\");let combinedText=\"\";textElements.forEach(el=>{combinedText+=\" \"+el.innerText;});const words=combinedText.trim().split(/\\s+/).filter(Boolean);const wordCount=words.length;const minutes=Math.ceil(wordCount/200);// Stop loading and set the final reading time\nsetReadingTimeText(`${minutes} min`);setLoading(false);clearInterval(loadingInterval);};// Minimal delay to allow DOM text to render\nconst calcTimeout=setTimeout(calculateReadingTime,50);window.addEventListener(\"resize\",calculateReadingTime);return()=>{clearInterval(loadingInterval);clearTimeout(calcTimeout);window.removeEventListener(\"resize\",calculateReadingTime);};},[]);return{text:readingTimeText,// No extra styling for the ghost effect\nstyle:{}};}import{useContext as __legacyOverrideHOC_useContext}from\"react\";import{DataObserverContext as __legacyOverrideHOC_DataObserverContext}from\"framer\";export function withReadingTimeOfPage(C){return props=>{__legacyOverrideHOC_useContext(__legacyOverrideHOC_DataObserverContext);return _jsx(C,{...props,...ReadingTimeOfPage(props)});};}withReadingTimeOfPage.displayName=\"ReadingTimeOfPage\";\nexport const __FramerMetadata__ = {\"exports\":{\"withReadingTimeOfPage\":{\"type\":\"reactHoc\",\"name\":\"withReadingTimeOfPage\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"ReadingTimeOfPage\":{\"type\":\"override\",\"name\":\"ReadingTimeOfPage\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ReadingTime.map"],"mappings":"2LAAiF,SAAgB,GAAmB,CAAC,GAAK,CAAC,EAAgB,GAAoBA,EAAS,GAAG,CAAM,CAAC,EAAQ,GAAYA,EAAS,GAAK,CAI+B,OAJ9B,MAAc,CACnO,IAAM,EAAgB,gBAAgB,CAAC,IAAM,EAAU,KAAK,MAAM,KAAK,QAAQ,CAAC,IAAI,CAAmD,EAAmB,GAArD,OAAO,EAAU,CAAC,SAAS,EAAE,IAAI,CAAiC,MAAM,EAAG,GAAG,CAC7K,MAAyB,CAAC,IAAM,EAAa,SAAS,iBAAiB,eAAe,CAAK,EAAa,GAAG,EAAa,QAAQ,GAAI,CAAC,GAAc,IAAI,EAAG,WAAY,CAA8D,IAAM,EAAvD,EAAa,MAAM,CAAC,MAAM,MAAM,CAAC,OAAO,QAAQ,CAAuB,OAChQ,EAAmB,GADkQ,KAAK,KAAK,EAAU,IAAI,CAC/Q,MAAM,CAAC,EAAW,GAAM,CAAC,cAAc,EAAgB,EAC/E,EAAY,WAAW,EAAqB,GAAG,CAAwD,OAAvD,EAAO,iBAAiB,SAAS,EAAqB,KAAW,CAAC,cAAc,EAAgB,CAAC,aAAa,EAAY,CAAC,EAAO,oBAAoB,SAAS,EAAqB,GAAK,EAAE,CAAC,CAAO,CAAC,KAAK,EAC/P,MAAM,EAAE,CAAC,CAAqJ,SAAgB,EAAsB,EAAE,CAAC,MAAO,KAAQ,EAA+BC,EAAwC,CAAQC,EAAK,EAAE,CAAC,GAAG,EAAM,GAAG,EAAkB,EAAM,CAAC,CAAC,uBALxS,IAAsC,IAK6E,CAAyL,EAAsB,YAAY"}