{"version":3,"file":"NumberCounter.ORMUJktK.mjs","names":["useRef","useState","__esmMin","init_npm_react_18_3_1","te","de","init_jsx_runtime","c","p","ce","_e","useInView","motion","init_framer_motion_DhsWWWsN","init_framer_BpuvUAiZ","useIsStaticRenderer","addPropertyControls","ControlType","NumberCounter","props","isStatic","ref","isInView","loopAnimation","replay","displayValue","setDisplayValue","start","rafRef","end","duration","speed","startTime","range","tick","elapsed","now","progress","current","formatNumber","integerPart","decimalPart","incrementType","value","endStr","endDecimalPlaces","numStr","thousandSep","decimalSep","separator","formattedInteger","isFixedWidth","isFixedHeight","gapSize","prefix","prefixFont","prefixColor","font","fontColor","suffix","suffixFont","suffixColor","init_NumberCounter"],"sources":["https:/framerusercontent.com/modules/0wLUxAWo95o4Xh3sjvIh/GeZfESt1LSZPCtEmyw0u/NumberCounter.js"],"sourcesContent":["// Number counter component with customizable prefix, suffix, separator, and animation\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useEffect,useState,useRef,startTransition}from\"react\";import{addPropertyControls,ControlType,useIsStaticRenderer}from\"framer\";import{motion,useInView}from\"framer-motion\";/**\n * Number Counter\n *\n * @framerIntrinsicWidth 200\n * @framerIntrinsicHeight 60\n *\n * @framerSupportedLayoutWidth auto\n * @framerSupportedLayoutHeight auto\n */export default function NumberCounter(props){const{start=0,end=100,separator=\"comma\",incrementType=\"integer\",prefix=\"\",prefixFont,prefixColor=\"#000000\",suffix=\"\",suffixFont,suffixColor=\"#000000\",font,fontColor=\"#000000\",gapSize=0,speed=120,loopAnimation=false,replay=false}=props;const isStatic=useIsStaticRenderer();const ref=useRef(null);const isInView=useInView(ref,{once:!loopAnimation&&!replay});const[displayValue,setDisplayValue]=useState(start);const rafRef=useRef(null);useEffect(()=>{if(isStatic){setDisplayValue(end);return;}if(rafRef.current)cancelAnimationFrame(rafRef.current);if(!isInView){if(loopAnimation||replay)setDisplayValue(start);return;}// speed range 10–300, mapped to duration 3000ms–100ms\nconst duration=Math.max(100,3200-speed*10);const startTime=performance.now();const range=end-start;const tick=now=>{const elapsed=now-startTime;const progress=Math.min(elapsed/duration,1);const current=start+range*progress;startTransition(()=>setDisplayValue(current));if(progress<1){rafRef.current=requestAnimationFrame(tick);}else{setDisplayValue(end);}};rafRef.current=requestAnimationFrame(tick);return()=>{if(rafRef.current)cancelAnimationFrame(rafRef.current);};},[isInView,end,start,speed,loopAnimation,replay,isStatic]);const formatNumber=value=>{let integerPart;let decimalPart;if(incrementType===\"integer\"){integerPart=Math.floor(value).toString();decimalPart=undefined;}else{// Detect decimal places from end value\nconst endStr=end.toString();const endDecimalPlaces=endStr.includes(\".\")?endStr.split(\".\")[1].length:0;const numStr=value.toFixed(endDecimalPlaces);[integerPart,decimalPart]=numStr.split(\".\");}// Choose separator characters for thousands and decimal parts\nlet thousandSep=\"\";let decimalSep=\".\";switch(separator){case\"comma\":thousandSep=\",\";decimalSep=\".\";break;case\"dot\":// European style: 1.234,56\nthousandSep=\".\";decimalSep=\",\";break;case\"space\":thousandSep=\" \";decimalSep=\".\";break;case\"none\":default:thousandSep=\"\";decimalSep=\".\";break;}const formattedInteger=thousandSep?integerPart.replace(/\\B(?=(\\d{3})+(?!\\d))/g,thousandSep):integerPart;return decimalPart!==undefined?`${formattedInteger}${decimalSep}${decimalPart}`:formattedInteger;};const isFixedWidth=props?.style&&props.style.width===\"100%\";const isFixedHeight=props?.style&&props.style.height===\"100%\";return /*#__PURE__*/_jsxs(\"div\",{ref:ref,style:{...props.style,position:\"relative\",display:\"flex\",alignItems:\"center\",justifyContent:\"center\",gap:`${gapSize}px`,...!isFixedWidth&&{width:\"max-content\"},...!isFixedHeight&&{height:\"max-content\"}},children:[prefix&&/*#__PURE__*/_jsx(\"span\",{style:{...prefixFont,color:prefixColor},children:prefix}),/*#__PURE__*/_jsx(motion.span,{style:{...font,color:fontColor},children:formatNumber(displayValue)}),suffix&&/*#__PURE__*/_jsx(\"span\",{style:{...suffixFont,color:suffixColor},children:suffix})]});}addPropertyControls(NumberCounter,{replay:{type:ControlType.Boolean,title:\"Replay\",defaultValue:false,enabledTitle:\"Yes\",disabledTitle:\"No\"},font:{type:ControlType.Font,title:\"Font\",defaultValue:{fontSize:\"40px\",fontWeight:\"700\",letterSpacing:\"-0.04em\",lineHeight:\"1em\"},controls:\"extended\",defaultFontType:\"sans-serif\"},fontColor:{type:ControlType.Color,title:\"Font Color\",defaultValue:\"#000000\"},start:{type:ControlType.Number,title:\"Start\",defaultValue:0,step:.01},end:{type:ControlType.Number,title:\"End\",defaultValue:100,step:.01},separator:{type:ControlType.Enum,title:\"Separator\",options:[\"comma\",\"dot\",\"space\",\"none\"],optionTitles:[\"Comma\",\"Dot\",\"Space\",\"None\"],defaultValue:\"comma\"},incrementType:{type:ControlType.Enum,title:\"Increment Type\",options:[\"integer\",\"decimal\"],optionTitles:[\"Integer\",\"Decimal\"],defaultValue:\"integer\"},prefix:{type:ControlType.String,title:\"Prefix\",defaultValue:\"\"},prefixFont:{type:ControlType.Font,title:\"Prefix Font\",defaultValue:{fontSize:\"40px\",fontWeight:\"700\",letterSpacing:\"-0.04em\",lineHeight:\"1em\"},controls:\"extended\",defaultFontType:\"sans-serif\",hidden:({prefix})=>!prefix||prefix.length===0},prefixColor:{type:ControlType.Color,title:\"Prefix Color\",defaultValue:\"#000000\",hidden:({prefix})=>!prefix||prefix.length===0},suffix:{type:ControlType.String,title:\"Suffix\",defaultValue:\"\"},suffixFont:{type:ControlType.Font,title:\"Suffix Font\",defaultValue:{fontSize:\"40px\",fontWeight:\"700\",letterSpacing:\"-0.04em\",lineHeight:\"1em\"},controls:\"extended\",defaultFontType:\"sans-serif\",hidden:({suffix})=>!suffix||suffix.length===0},suffixColor:{type:ControlType.Color,title:\"Suffix Color\",defaultValue:\"#000000\",hidden:({suffix})=>!suffix||suffix.length===0},gapSize:{type:ControlType.Number,title:\"Gap Size\",defaultValue:0,min:0,max:50,step:1,unit:\"px\"},speed:{type:ControlType.Number,title:\"Speed (%)\",defaultValue:120,min:10,max:300,step:10},loopAnimation:{type:ControlType.Boolean,title:\"Loop Animation\",defaultValue:false,enabledTitle:\"Yes\",disabledTitle:\"No\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"NumberCounter\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"auto\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutHeight\":\"auto\",\"framerIntrinsicWidth\":\"200\",\"framerIntrinsicHeight\":\"60\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./NumberCounter.map"],"mappings":"A,sQASG,SAAwBkB,EAAc,EAAM,CAAC,GAAK,CAAC,QAAM,EAAE,MAAI,IAAI,YAAU,QAAQ,gBAAc,UAAU,SAAO,GAAG,aAAW,cAAY,UAAU,SAAO,GAAG,aAAW,cAAY,UAAU,OAAK,YAAU,UAAU,UAAQ,EAAE,QAAM,IAAI,gBAAc,GAAM,SAAO,IAAOC,EAAYC,EAASL,EAAoB,EAAQM,EAAIrB,EAAO,IAAI,EAAQsB,EAASX,EAAUU,EAAI,CAAC,KAAK,CAACE,GAAe,CAACC,CAAM,CAAC,EAAO,CAACC,EAAaC,GAAiBzB,EAAS0B,CAAK,EAAQC,EAAO5B,EAAO,IAAI,EAAES,MAAc,CAAC,GAAGW,EAAS,CAACM,EAAgBG,CAAG,EAAE,MAAO,CAAwD,GAApDD,EAAO,SAAQ,qBAAqBA,EAAO,OAAO,EAAK,CAACN,EAAS,EAAIC,GAAeC,IAAOE,EAAgBC,CAAK,EAAE,MAAO,CACvpB,IAAMG,EAAS,KAAK,IAAI,IAAI,KAAKC,EAAM,EAAE,EAAQC,EAAU,YAAY,IAAI,EAAQC,EAAMJ,EAAIF,EAAYO,EAAK,GAAK,CAAC,IAAMC,EAAQC,EAAIJ,EAAgBK,EAAS,KAAK,IAAIF,EAAQL,EAAS,CAAC,EAAQQ,EAAQX,EAAMM,EAAMI,EAASjC,MAAoBsB,EAAgBY,CA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