{"version":3,"file":"OdometerNew.MfF0PPRy.mjs","names":["useState","React"],"sources":["https:/framerusercontent.com/modules/2hjh8bwJdCstQXQkIfwy/p4B5CmrEEZo7M0OBzzPq/OdometerNew.js"],"sourcesContent":["/**\n * For any website & code related support, contact Sam from wealthisteps.com at wealthistep@gmail.com\n * Linkedin - https://www.linkedin.com/in/samagramishra/\n * */import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{addPropertyControls,ControlType}from\"framer\";import React,{useEffect,useState}from\"react\";// Store the reference time globally to ensure all counter instances use the same value\nconst REFERENCE_DATE=new Date(\"2026-01-23\").getTime();// Store the initialization time globally so all counters use the same reference point\nconst INIT_TIME=new Date().getTime();// Calculate initial value based on time elapsed since a reference date\nfunction getInitialValue(baseValue,increaseRate){// Time elapsed in seconds since reference date\nconst secondsElapsed=(INIT_TIME-REFERENCE_DATE)/1e3;// Base value plus accumulated increase\nconst increase=secondsElapsed*increaseRate;return baseValue+increase;}// Create a shared counter state that all instances can reference\nlet sharedCounterState={lastUpdateTime:INIT_TIME,value:null};function Counter({font,color,width,textAlign,baseValue,increaseRate,updateDelay}){// Initialize shared value if not already set\nif(sharedCounterState.value===null){sharedCounterState.value=getInitialValue(baseValue,increaseRate);}// Use the shared counter state\nconst[count,setCount]=useState(sharedCounterState.value);useEffect(()=>{// Update based on the specified delay\nconst interval=setInterval(()=>{// Calculate increase based on delay (converting ms to seconds)\nconst updateIntervalInSeconds=updateDelay/1e3;const newValue=sharedCounterState.value+increaseRate*updateIntervalInSeconds;// Update the shared state\nsharedCounterState.value=newValue;sharedCounterState.lastUpdateTime=new Date().getTime();// Update this component's state\nsetCount(newValue);},updateDelay);return()=>clearInterval(interval);},[increaseRate,updateDelay]);// Format the number with commas\nconst formattedNumber=Math.floor(count).toLocaleString();return /*#__PURE__*/_jsxs(\"span\",{style:{fontFamily:font?.fontFamily,fontWeight:\"inherit\",color:color,display:\"inline-block\",minWidth:`${width}px`,textAlign:textAlign},children:[\"$\",formattedNumber]});}export default function OdometerCounterNew(props){const{font,color,content,textAlign,counterWidth,images=[],styles={},baseValue,increaseRate,updateDelay}=props;// Default styles if not provided\nconst imageStyles={imageWidth:styles.imageWidth||24,imageHeight:styles.imageHeight||24,imageRadius:styles.imageRadius||0,gap:styles.gap||6,offsetY:styles.offsetY||0};const imageAlign=props.imageAlign||\"normal\";const counterSegments=content.split(\"**\");let processedContent=\"\";counterSegments.forEach((segment,index)=>{if(index===0){processedContent=segment;}else{// Add a counter marker and the rest of the segment\nprocessedContent+=\"$$COUNTER$$\"+segment;}});// Now split by image placeholders\nconst segments=processedContent.split(\"[]\");let imageIndex=0;const containerStyle={display:\"block\",width:\"100%\",fontFamily:font?.fontFamily,fontSize:font?.fontSize,fontWeight:font?.fontWeight,lineHeight:font?.lineHeight,letterSpacing:font?.letterSpacing,textAlign:textAlign,color,wordWrap:\"break-word\",overflow:\"visible\"};const imageStyle={display:\"inline-block\",verticalAlign:imageAlign===\"baseline\"?\"bottom\":\"middle\",width:imageStyles.imageWidth,height:imageStyles.imageHeight,borderRadius:imageStyles.imageRadius,objectFit:\"cover\",marginLeft:imageStyles.gap,marginRight:imageStyles.gap,position:\"relative\",overflow:\"visible\",transform:`translateY(${imageStyles.offsetY}px)`};return /*#__PURE__*/_jsx(\"div\",{style:containerStyle,children:segments.map((segment,index)=>/*#__PURE__*/_jsxs(React.Fragment,{children:[segment&&/*#__PURE__*/_jsx(\"span\",{children:segment.split(\"$$COUNTER$$\").map((part,partIndex)=>{if(partIndex===0){return part;}else{return /*#__PURE__*/_jsxs(React.Fragment,{children:[/*#__PURE__*/_jsx(Counter,{font:font,color:color,width:counterWidth,textAlign:textAlign,baseValue:baseValue,increaseRate:increaseRate,updateDelay:updateDelay}),part]},`counter-${partIndex}`);}})}),index<segments.length-1&&images[imageIndex]&&/*#__PURE__*/_jsx(\"img\",{src:images[imageIndex++],alt:`inline-${index}`,style:imageStyle})]},index))});}// Property controls for Framer\naddPropertyControls(OdometerCounterNew,{font:{type:ControlType.Font,controls:\"extended\"},color:{type:ControlType.Color,title:\"Color\",defaultValue:\"black\"},textAlign:{type:ControlType.Enum,title:\"Text Align\",options:[\"left\",\"center\",\"right\",\"justify\"],defaultValue:\"left\"},content:{type:ControlType.String,title:\"Content\",defaultValue:\"Our members saved ** millionin fees[]by choosing Possible.\"},images:{type:ControlType.Array,title:\"Images\",propertyControl:{type:ControlType.Image}},counterWidth:{type:ControlType.Number,title:\"Counter Width\",defaultValue:200,min:100,max:1e3,step:10},baseValue:{type:ControlType.Number,title:\"Base Value\",defaultValue:5e8,min:0,step:1e6,displayStepper:true},increaseRate:{type:ControlType.Number,title:\"Increase Rate/sec\",defaultValue:2.28,min:0,max:100,step:.01,displayStepper:true},updateDelay:{type:ControlType.Number,title:\"Update Delay (ms)\",defaultValue:2e3,min:100,max:1e4,step:100,displayStepper:true},imageAlign:{type:ControlType.Enum,title:\"Image Align\",defaultValue:\"normal\",options:[\"normal\",\"baseline\"],optionTitles:[\"Normal\",\"Baseline\"]},styles:{type:ControlType.Object,title:\"Image Style\",description:\"Developed by [Wealthisteps](https://wealthisteps.com/)\",controls:{gap:{type:ControlType.Number,title:\"Gap\",defaultValue:6},imageWidth:{type:ControlType.Number,title:\"Image Width\",defaultValue:24,min:1},imageHeight:{type:ControlType.Number,title:\"Image Height\",defaultValue:24,min:1},imageRadius:{type:ControlType.BorderRadius,title:\"Image Radius\"},offsetY:{type:ControlType.Number,title:\"Y Offset\",defaultValue:0,step:1,displayStepper:true}}}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"OdometerCounterNew\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./OdometerNew.map"],"mappings":"gMAMA,SAAS,EAAgB,EAAU,EAAa,CAEL,OAAO,GAD5B,EAAU,GAAgB,IAClB,CAAuC,CACR,SAAS,EAAQ,CAAC,OAAK,QAAM,QAA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