{"version":3,"file":"Rolling_CounterPro_5.DaptXR8B.mjs","names":["React.useState","React.useRef"],"sources":["https:/framerusercontent.com/modules/mwXgs9xnHEVybchwzGDg/ID5VkYzj7efUqQPBMWBd/Rolling_CounterPro_5.js"],"sourcesContent":["// Rolling counter component with gradient text and smooth animations\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import*as React from\"react\";import{motion}from\"framer-motion\";import{useInView}from\"framer-motion\";import{addPropertyControls,ControlType}from\"framer\";function getDigits(number,maxLength,showLeadingZeros){const raw=number.toString();const padded=showLeadingZeros?raw.padStart(maxLength,\"0\"):raw;return padded.split(\"\").map(d=>parseInt(d,10));}/**\n * @framerSupportedLayoutWidth auto\n * @framerSupportedLayoutHeight auto\n */export default function RollingCounter(props){const{start=0,end=2,speed=100,loop=false,selectedFont,prefix=\"\",suffix=\"\",prefixColor=\"#ffffff\",suffixColor=\"#ffffff\",showLeadingZeros=false,color1=\"#003B92\",color2=\"#003B92\"}=props;const[count,setCount]=React.useState(start);const maxLen=end.toString().length;const[digits,setDigits]=React.useState(getDigits(start,maxLen,showLeadingZeros));const containerRef=React.useRef(null);const inView=useInView(containerRef,{once:true});const hasStarted=React.useRef(false);React.useEffect(()=>{if(!inView||hasStarted.current)return;hasStarted.current=true;const interval=setInterval(()=>{setCount(prev=>{const next=prev+1;const value=next>end?loop?start:end:next;React.startTransition(()=>{setDigits(getDigits(value,maxLen,showLeadingZeros));});return value;});},speed);return()=>clearInterval(interval);},[inView,start,end,speed,loop,showLeadingZeros,maxLen]);const digitTextStyle={background:`linear-gradient(to right, ${color1}, ${color2})`,WebkitBackgroundClip:\"text\",WebkitTextFillColor:\"transparent\",backgroundClip:\"text\",textAlign:\"center\",height:\"1em\"};return /*#__PURE__*/_jsxs(\"div\",{ref:containerRef,style:{display:\"flex\",alignItems:\"center\",fontSize:selectedFont?.fontSize,fontFamily:selectedFont?.fontFamily,fontWeight:selectedFont?.fontWeight,fontStyle:selectedFont?.fontStyle,lineHeight:1,fontVariantNumeric:\"tabular-nums\",width:\"max-content\"},children:[prefix&&prefix.length>0&&/*#__PURE__*/_jsx(\"span\",{style:{color:prefixColor,marginRight:4},children:prefix}),digits.map((digit,i)=>/*#__PURE__*/_jsx(\"div\",{style:{width:\"0.65em\",height:\"1em\",overflow:\"hidden\",position:\"relative\",display:\"inline-block\"},children:/*#__PURE__*/_jsx(motion.div,{initial:false,animate:{y:`-${digit}em`},transition:{duration:.4,ease:[.2,.8,.2,1]},style:{display:\"flex\",flexDirection:\"column\",position:\"absolute\",top:0,left:0},children:[...Array(10).keys()].map(d=>/*#__PURE__*/_jsx(\"div\",{style:digitTextStyle,children:d},d))})},i)),suffix&&suffix.length>0&&/*#__PURE__*/_jsx(\"span\",{style:{color:suffixColor,marginLeft:4},children:suffix})]});}addPropertyControls(RollingCounter,{selectedFont:{title:\"Font\",type:ControlType.Font,controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:64,variant:\"Medium\"},description:\"Choose the font family and style for the counter digits\"},start:{type:ControlType.Number,title:\"Start\",defaultValue:0,description:\"The starting number for the counter animation\"},end:{type:ControlType.Number,title:\"End\",defaultValue:2,displayStepper:true,description:\"The ending number where the counter stops\"},speed:{type:ControlType.Number,title:\"Speed (ms)\",min:10,max:5e3,defaultValue:100,description:\"Time in milliseconds between each number increment\"},loop:{type:ControlType.Boolean,title:\"Loop\",defaultValue:false,description:\"Enable to restart the counter after reaching the end\"},prefix:{type:ControlType.String,title:\"Prefix\",defaultValue:\"\",description:\"Text to display before the counter (e.g., '$' or '#')\"},suffix:{type:ControlType.String,title:\"Suffix\",defaultValue:\"\",description:\"Text to display after the counter (e.g., '%' or 'K')\"},prefixColor:{type:ControlType.Color,title:\"Prefix Color\",defaultValue:\"#ffffff\",description:\"Color for the prefix text\"},suffixColor:{type:ControlType.Color,title:\"Suffix Color\",defaultValue:\"#ffffff\",description:\"Color for the suffix text\"},showLeadingZeros:{type:ControlType.Boolean,title:\"Leading Zeros\",defaultValue:false,description:\"Display leading zeros (e.g., 001, 002, 003)\"},color1:{type:ControlType.Color,title:\"Gradient Color 1\",defaultValue:\"#003B92\",description:\"Starting color of the gradient applied to digits\"},color2:{type:ControlType.Color,title:\"Gradient Color 2\",defaultValue:\"#003B92\",description:\"Ending color of the gradient applied to digits\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"RollingCounter\",\"slots\":[],\"annotations\":{\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"auto\",\"framerSupportedLayoutHeight\":\"auto\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Rolling_CounterPro_5.map"],"mappings":"8PACgN,SAAS,EAAU,EAAO,EAAU,EAAiB,CAAC,IAAM,EAAI,EAAO,SAAS,EAAgE,OAAjD,EAAiB,EAAI,SAAS,EAAU,GAAG,EAAE,EAAA,CAAkB,MAAM,EAAE,CAAC,CAAC,IAAI,GAAG,SAAS,EAAE,EAAE,CAAC,CAAE,CAG5Y,SAAwB,EAAe,EAAM,CAAC,GAAK,CAAC,QAAM,EAAE,MAAI,EAAE,QAAM,IAAI,OAAK,GAAM,eAAa,SAAO,GAAG,SAAO,GAAG,cAAY,UAAU,cAAY,UAAU,mBAAiB,GAAM,SAAO,UAAU,SAAO,WAAW,EAAW,CAAC,EAAM,GAAUA,EAAe,CAAK,EAAQ,EAAO,EAAI,SAAS,CAAC,CAAC,OAAY,CAAC,EAAO,GAAWA,EAAe,EAAU,EAAM,EAAO,CAAgB,CAAC,EAAQ,EAAaC,EAAa,IAAI,EAAQ,EAAO,EAAU,EAAa,CAAC,KAAK,EAAI,CAAC,EAAQ,EAAWA,EAAa,EAAK,EAAE,MAAoB,CAAC,GAAG,CAAC,GAAQ,EAAW,QAAQ,OAAO,EAAW,QAAQ,GAAK,IAAM,EAAS,gBAAgB,CAAC,EAAS,GAAM,CAAC,IAAM,EAAK,EAAK,EAAQ,EAAM,EAAK,EAAI,EAAK,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