{"version":3,"file":"ReadingTime.CnHCf8ED.mjs","names":["useState"],"sources":["https:/framer.com/m/framer/default-utils.js@^0.45.0","https:/framerusercontent.com/modules/AW7AXBasv13i3EOiMU0I/1L2s3GaLF1SihMw6aRl0/ReadingTime.js"],"sourcesContent":["/*\n * index (framer/default-utils@0.45.0)\n *\n * Learn More: https://www.framer.com/asset-urls\n */\n\nexport * from \"https://framerusercontent.com/modules/G4IfyjvwmaeSBpdb4TWu/OIjZRBmWDcIE2B6qgG1j/index.js\"\n","import{jsx as _jsx}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import{fontControls}from\"https://framer.com/m/framer/default-utils.js@^0.45.0\";import{useEffect,useState}from\"react\";export function ReadingTime(props){const{font,fontColor,title,prefix,suffix,readingSpeed,transform}=props;const[wordCount,setWordCount]=useState(0);useEffect(()=>{if(typeof window===\"undefined\")return;const div=document.createElement(\"div\");div.innerHTML=typeof title===\"string\"?title:JSON.stringify(title);const text=div.textContent||div.innerText||\"\";const words=text.trim().length===0?0:text.trim().split(/\\s+/).length;setWordCount(words);},[title]);const ttr=Math.max(1,Math.ceil(wordCount/Math.max(1,Number(readingSpeed)||200)));let value=`${ttr} min read`;const applyTransform=(s,mode)=>{if(!s)return s;if(mode===\"uppercase\")return s.toUpperCase();if(mode===\"lowercase\")return s.toLowerCase();if(mode===\"capitalize\")return s.replace(/\\b\\w/g,ch=>ch.toUpperCase());return s;};const shown=`${prefix||\"\"}${applyTransform(value,transform)}${suffix||\"\"}`;return /*#__PURE__*/_jsx(\"div\",{style:{...font,color:fontColor,display:\"flex\",justifyContent:\"center\",alignItems:\"center\",padding:0},children:shown});}ReadingTime.defaultProps={title:\"<p>Connect content</p>\",font:fontControls.defaultProps,fontColor:\"#000\",prefix:\"\",suffix:\"\",readingSpeed:200,transform:\"none\"};addPropertyControls(ReadingTime,{title:{title:\"Title\",//@ts-ignore – Framer-specific prop type\ntype:ControlType.RichText},font:{type:ControlType.Font,controls:\"extended\",title:\"Font\"},fontColor:{title:\"Font Color\",type:ControlType.Color,defaultValue:ReadingTime.defaultProps.fontColor},prefix:{title:\"Prefix\",type:ControlType.String,defaultValue:ReadingTime.defaultProps.prefix,placeholder:\"e.g. ~ \"},suffix:{title:\"Suffix\",type:ControlType.String,defaultValue:ReadingTime.defaultProps.suffix,placeholder:\" e.g. min\"},readingSpeed:{title:\"Reading Speed\",description:\"Words Per Minute\",type:ControlType.Number,defaultValue:ReadingTime.defaultProps.readingSpeed,min:60,max:1020,displayStepper:true},transform:{title:\"Transform\",type:ControlType.Enum,options:[\"none\",\"uppercase\",\"lowercase\",\"capitalize\"],optionTitles:[\"None\",\"Uppercase\",\"Lowercase\",\"Capitalize\"],defaultValue:ReadingTime.defaultProps.transform}});\nexport const __FramerMetadata__ = {\"exports\":{\"ReadingTime\":{\"type\":\"reactComponent\",\"name\":\"ReadingTime\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./ReadingTime.map"],"mappings":"mRCAoN,SAAgB,EAAY,EAAM,CAAC,GAAK,CAAC,OAAK,YAAU,QAAM,SAAO,SAAO,eAAa,aAAW,EAAW,CAAC,EAAU,GAAcA,EAAS,EAAE,CAAC,MAAc,CAAC,GAAU,IAAS,OAAY,OAAO,IAAM,EAAI,SAAS,cAAc,MAAM,CAAC,EAAI,UAAU,OAAO,GAAQ,SAAS,EAAM,KAAK,UAAU,EAAM,CAAC,IAAM,EAAK,EAAI,aAAa,EAAI,WAAW,GAAwE,EAAzD,EAAK,MAAM,CAAC,SAAS,EAAE,EAAE,EAAK,MAAM,CAAC,MAAM,MAAM,CAAC,OAA0B,EAAG,CAAC,EAAM,CAAC,CAAkF,IAAI,EAAM,GAAjF,KAAK,IAAI,EAAE,KAAK,KAAK,EAAU,KAAK,IAAI,EAAE,OAAO,EAAa,EAAE,IAAI,CAAC,CAAC,CAAkB,WAA2O,EAAM,GAAG,GAAQ,OAA3N,EAAE,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