{"version":3,"file":"CountUp.DbSdFsa9.mjs","names":["useState","useRef"],"sources":["https:/framerusercontent.com/modules/KuoPn6FLhJNKD5jL0PWW/8PKyvIPVNN5B0HDvLdqz/CountUp.js"],"sourcesContent":["// Number count up component with CMS integration\nimport{jsx as _jsx,jsxs as _jsxs}from\"react/jsx-runtime\";import{useEffect,useState,useRef,startTransition}from\"react\";import{addPropertyControls,ControlType}from\"framer\";/**\n * @framerSupportedLayoutWidth auto\n * @framerSupportedLayoutHeight auto\n */export default function CountUp(props){const{targetValue=1e3,duration=2e3,prefix=\"\",suffix=\"\",decimals=-1,separator=true,textColor=\"#000000\",font,style}=props;const[count,setCount]=useState(0);const[isInView,setIsInView]=useState(false);const[hasAnimated,setHasAnimated]=useState(false);const elementRef=useRef(null);useEffect(()=>{if(typeof window===\"undefined\")return;const observer=new IntersectionObserver(([entry])=>{if(entry.isIntersecting&&!hasAnimated){startTransition(()=>setIsInView(true));}},{threshold:.1});if(elementRef.current)observer.observe(elementRef.current);return()=>{if(elementRef.current)observer.unobserve(elementRef.current);};},[hasAnimated]);useEffect(()=>{if(!isInView||hasAnimated)return;const startTime=Date.now();const startValue=0;const animate=()=>{const currentTime=Date.now();const elapsed=currentTime-startTime;const progress=Math.min(elapsed/duration,1);const easeOutQuart=1-Math.pow(1-progress,4);const currentCount=startValue+(targetValue-startValue)*easeOutQuart;startTransition(()=>setCount(currentCount));if(progress<1){requestAnimationFrame(animate);}else{startTransition(()=>{setCount(targetValue);setHasAnimated(true);});}};requestAnimationFrame(animate);},[isInView,targetValue,duration,hasAnimated]);const detectDecimals=value=>{// Handles values like 12, 12.3, 12.3400 (as entered, JS number loses trailing zeros)\n// We only care if there is a fractional part.\nconst frac=Math.abs(value)%1;if(frac===0)return 0;// Reasonable precision cap to avoid floating noise like 0.30000000004\nconst asString=value.toString();if(asString.includes(\"e-\")){// e.g. 1e-7 -> 7 decimals\nconst[,exp]=asString.split(\"e-\");const expNum=Number(exp);return Number.isFinite(expNum)?Math.min(expNum,6):2;}const dot=asString.indexOf(\".\");if(dot===-1)return 0;return Math.min(asString.length-dot-1,6);};const resolvedDecimals=decimals>=0?decimals:detectDecimals(targetValue);const formatNumber=num=>{const fixed=num.toFixed(resolvedDecimals);// If resolvedDecimals is 0, no decimal point is included by toFixed(0)\nif(!separator)return fixed;// Split on \".\" (not \",\") — toFixed uses \".\" always\nconst[intPart,fracPart]=fixed.split(\".\");const withCommas=intPart.replace(/\\B(?=(\\d{3})+(?!\\d))/g,\",\");return fracPart!=null?`${withCommas}.${fracPart}`:withCommas;};const displayValue=formatNumber(count);return /*#__PURE__*/_jsx(\"div\",{ref:elementRef,style:{...style,position:\"relative\",width:\"max-content\",minWidth:\"max-content\"},children:/*#__PURE__*/_jsxs(\"span\",{style:{color:textColor,...font,whiteSpace:\"nowrap\"},children:[prefix,displayValue,suffix]})});}addPropertyControls(CountUp,{targetValue:{type:ControlType.Number,title:\"Target Value\",defaultValue:1e3,min:0,step:.01},duration:{type:ControlType.Number,title:\"Duration\",defaultValue:2e3,min:100,max:1e4,step:100,unit:\"ms\"},decimals:{type:ControlType.Number,title:\"Decimals\",defaultValue:-1,min:-1,max:6,step:1,displayStepper:true},separator:{type:ControlType.Boolean,title:\"Separator\",defaultValue:true,enabledTitle:\"On\",disabledTitle:\"Off\"},prefix:{type:ControlType.String,title:\"Prefix\",defaultValue:\"\",placeholder:\"$\"},suffix:{type:ControlType.String,title:\"Suffix\",defaultValue:\"\",placeholder:\"+\"},textColor:{type:ControlType.Color,title:\"Text Color\",defaultValue:\"#000000\"},font:{type:ControlType.Font,title:\"Font\",controls:\"extended\",defaultFontType:\"sans-serif\",defaultValue:{fontSize:\"40px\",variant:\"Bold\",letterSpacing:\"-0.04em\",lineHeight:\"1em\"}}});\nexport const __FramerMetadata__ = {\"exports\":{\"default\":{\"type\":\"reactComponent\",\"name\":\"CountUp\",\"slots\":[],\"annotations\":{\"framerSupportedLayoutWidth\":\"auto\",\"framerContractVersion\":\"1\",\"framerSupportedL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