{"version":3,"file":"AnimatedCounter.DheFbDPF.mjs","names":["useRef","useState","useMemo","useId","useCallback"],"sources":["https:/framerusercontent.com/modules/kAzsrlejEbYKwhGnAH9Z/psT6pTmmnWlnC9pjUeap/AnimatedCounter.js"],"sourcesContent":["import{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{addPropertyControls,ControlType,useIsStaticRenderer}from\"framer\";import{motion,useInView}from\"framer-motion\";import{startTransition,useCallback,useEffect,useId,useMemo,useRef,useState}from\"react\";/**\n * @framerSupportedLayoutWidth auto\n * @framerSupportedLayoutHeight auto\n */export default function AnimatedCounter(props){const{value=52,minDigits=1,duration=1,delayPerDigit=.08,easing=\"easeOut\",digitColor=\"#000000\",postfixColor=\"#000000\",digitFont,postfixFont,gap=0,postfix=\"\",postfixGap=6,align=\"left\",ariaLabel=\"Counter\",style}=props;const isStatic=useIsStaticRenderer();const rootRef=useRef(null);const isInView=useInView(rootRef,{amount:.2,once:false});const[hasStarted,setHasStarted]=useState(false);const target=useMemo(()=>{const n=Number.isFinite(value)?Math.trunc(value):0;return Math.max(0,n);},[value]);const displayString=useMemo(()=>{const s=String(target);if(minDigits<=1)return s;return s.padStart(minDigits,\"0\");},[target,minDigits]);const digits=useMemo(()=>displayString.split(\"\").map(d=>d>=\"0\"&&d<=\"9\"?Number(d):0),[displayString]);const measureId=useId();const measureRef=useRef(null);const[digitHeight,setDigitHeight]=useState(0);useEffect(()=>{if(typeof window===\"undefined\")return;const el=measureRef.current;if(!el)return;const update=()=>{const rect=el.getBoundingClientRect();const h=Math.max(1,Math.round(rect.height));startTransition(()=>setDigitHeight(h));};update();let ro=null;if(\"ResizeObserver\"in window){ro=new ResizeObserver(()=>update());ro.observe(el);}else{const setIntervalSafe=globalThis?.setInterval;const clearIntervalSafe=globalThis?.clearInterval;const t=typeof setIntervalSafe===\"function\"?setIntervalSafe(update,250):0;return()=>{if(typeof clearIntervalSafe===\"function\")clearIntervalSafe(t);};}return()=>{if(ro)ro.disconnect();};},[displayString,digitFont?.fontSize,digitFont?.lineHeight,digitFont?.letterSpacing,digitFont?.fontFamily]);const getFlowForIndex=useCallback(index=>{// Leftmost digit: top-to-bottom (down), then alternate.\nreturn index%2===0?\"down\":\"up\";},[]);const transitionEase=useMemo(()=>{if(easing===\"linear\")return\"linear\";if(easing===\"easeInOut\")return[.4,0,.2,1];return[.16,1,.3,1]// easeOut-ish\n;},[easing]);useEffect(()=>{if(isStatic)return;if(isInView){startTransition(()=>setHasStarted(true));}},[isInView,isStatic]);const shouldAnimate=!isStatic&&hasStarted&&digitHeight>0;const containerJustify=useMemo(()=>{if(align===\"center\")return\"center\";if(align===\"right\")return\"flex-end\";return\"flex-start\";},[align]);const numberTextStatic=useMemo(()=>{return displayString+(postfix?` ${postfix}`:\"\");},[displayString,postfix]);if(isStatic){return /*#__PURE__*/_jsxs(\"div\",{ref:rootRef,style:{position:\"relative\",display:\"inline-flex\",alignItems:\"baseline\",justifyContent:containerJustify,width:\"max-content\",height:\"max-content\",...style},\"aria-label\":ariaLabel,children:[/*#__PURE__*/_jsx(\"span\",{style:{...digitFont,color:digitColor,whiteSpace:\"pre\"},children:displayString}),postfix?/*#__PURE__*/_jsx(\"span\",{style:{...postfixFont,color:postfixColor,marginLeft:postfixGap,whiteSpace:\"pre\"},children:postfix}):null]});}return /*#__PURE__*/_jsxs(\"div\",{ref:rootRef,style:{position:\"relative\",display:\"inline-flex\",alignItems:\"baseline\",justifyContent:containerJustify,width:\"max-content\",height:\"max-content\",...style},role:\"img\",\"aria-label\":ariaLabel,title:numberTextStatic,children:[/*#__PURE__*/_jsx(\"span\",{ref:measureRef,id:measureId,\"aria-hidden\":\"true\",style:{position:\"absolute\",left:-99999,top:-99999,visibility:\"hidden\",whiteSpace:\"pre\",...digitFont},children:\"0\"}),/*#__PURE__*/_jsx(\"div\",{style:{position:\"relative\",display:\"inline-flex\",alignItems:\"baseline\",gap,height:digitHeight>0?digitHeight:\"1em\"},children:digits.map((digit,i)=>{const flow=getFlowForIndex(i);// We render digits as a descending column: 9..0.\n// Index of a digit in that list is (9 - digit).\nconst indexInColumn=9-digit;const yTarget=-indexInColumn*(digitHeight||0);const delay=i*Math.max(0,delayPerDigit);const invertForDown=flow===\"down\";return /*#__PURE__*/_jsx(\"span\",{style:{position:\"relative\",display:\"inline-block\",overflow:\"hidden\",height:digitHeight>0?digitHeight:\"1em\",width:\"max-content\",verticalAlign:\"baseline\",transform:invertForDown?\"scaleY(-1)\":undefined,transformOrigin:\"50% 50%\"},\"aria-hidden\":\"true\",children:/*#__PURE__*/_jsx(motion.span,{style:{position:\"relative\",display:\"block\",willChange:\"transform\",color:digitColor,...digitFont},initial:{y:0},animate:shouldAnimate?{y:yTarget}:{y:0},transition:shouldAnimate?{duration:Math.max(0,duration),ease:transitionEase,delay}:{duration:0},children:[9,8,7,6,5,4,3,2,1,0].map(n=>/*#__PURE__*/_jsx(\"span\",{style:{display:\"block\",height:digitHeight>0?digitHeight:\"1em\",lineHeight:digitFont?.lineHeight??\"1em\",transform:invertForDown?\"scaleY(-1)\":undefined,transformOrigin:\"50% 50%\"},children:n},n))})},`${i}-${digit}`);})}),postfix?/*#__PURE__*/_jsx(\"span\",{style:{marginLeft:postfixGap,whiteSpace:\"pre\",color:postfixColor,...postfixFont},children:postfix}):null]});}addPropertyControls(AnimatedCounter,{value:{type:ControlType.Number,title:\"Value\",defaultValue:52,min:0,max:999999999,step:1},minDigits:{type:ControlType.Number,title:\"Min Digits\",defaultValue:1,min:1,max:12,step:1},duration:{type:ControlType.Number,title:\"Duration\",defaultValue:1,min:0,max:5,step:.05,unit:\"s\"},delayPerDigit:{type:ControlType.Number,title:\"Digit Delay\",defaultValue:.08,min:0,max:.5,step:.01,unit:\"s\"},easing:{type:ControlType.Enum,title:\"Easing\",options:[\"easeOut\",\"easeInOut\",\"linear\"],optionTitles:[\"Ease Out\",\"Ease In Out\",\"Linear\"],defaultValue:\"easeOut\"},digitColor:{type:ControlType.Color,title:\"Digit Color\",defaultValue:\"#000000\"},postfixColor:{type:ControlType.Color,title:\"Postfix Color\",defaultValue:\"#000000\"},digitFont:{type:ControlType.Font,title:\"Digit Font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:\"40px\",variant:\"Bold\",letterSpacing:\"-0.04em\",lineHeight:\"1em\"}},postfixFont:{type:ControlType.Font,title:\"Postfix Font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:\"15px\",variant:\"Medium\",letterSpacing:\"-0.01em\",lineHeight:\"1.3em\"}},gap:{type:ControlType.Number,title:\"Digit Gap\",defaultValue:0,min:0,max:40,step:1,unit:\"px\"},postfix:{type:ControlType.String,title:\"Postfix\",defaultValue:\"\"},postfixGap:{type:ControlType.Number,title:\"Postfix Gap\",defaultValue:6,min:0,max:60,step:1,unit:\"px\"},align:{type:ControlType.Enum,title:\"Align\",options:[\"left\",\"center\",\"right\"],optionTitles:[\"Left\",\"Center\",\"Right\"],defaultValue:\"left\",displaySegmentedControl:true},ariaLabel:{type:ControlType.String,title:\"ARIA Label\",defaultValue:\"Counter\"}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"AnimatedCounter\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutHeight\":\"auto\",\"framerContractVersion\":\"1\",\"framerSupportedLayoutWidth\":\"auto\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./AnimatedCounter.map"],"mappings":"qSAGG,SAAwB,EAAgB,EAAM,CAAC,GAAK,CAAC,QAAM,GAAG,YAAU,EAAE,WAAS,EAAE,gBAAc,IAAI,SAAO,UAAU,aAAW,UAAU,eAAa,UAAU,YAAU,cAAY,MAAI,EAAE,UAAQ,GAAG,aAAW,EAAE,QAAM,OAAO,YAAU,UAAU,SAAO,EAAY,EAAS,EAAoB,EAAQ,EAAQA,EAAO,IAAI,EAAQ,EAAS,EAAU,EAAQ,CAAC,OAAO,GAAG,KAAK,EAAK,CAAC,EAAO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