{"version":3,"file":"CountUp.DogFXPIa.mjs","names":["useRef","useState"],"sources":["https:/framerusercontent.com/modules/Nf22WLsEtdxjJ0NXD3lG/nOvttLAGqMsjeUPjLxgr/CountUp.js"],"sourcesContent":["// CountUp — one-time count-up on scroll into view. Reusable on any stat text.\n// First used: \"The numbers that matter\" (home #12).\n//\n// Apply in Framer: select the stat TEXT layer (plain text, e.g. \"800+\")\n// → Code Overrides → File: CountUp → Override: withCountUp.\n// The target value is read from the layer's own text, so one override serves\n// every stat: \"800+\", \"8,000+\", \"38\", \"97%\", \"300,000+\", \"16,000\" all work.\n// Prefix/suffix and comma grouping preserved; lands exactly on the designed\n// text; animates once, never re-triggers. Respects prefers-reduced-motion.\n//\n// Canonical copy: 05-development/overrides/CountUp.tsx — edit here, re-sync.\nimport{jsx as _jsx}from\"react/jsx-runtime\";import{forwardRef,useEffect,useRef,useState}from\"react\";import{animate,useInView,useReducedMotion}from\"framer-motion\";const DURATION=1.6// seconds\n;const IN_VIEW_AMOUNT=1// the whole number must be visible…\n;const VIEW_MARGIN=\"0px 0px -15% 0px\"// …and past the bottom 15% of the viewport\n;const START_DELAY=.15// small beat so card appear-effects land first (seconds)\n;function extractText(props){if(typeof props.text===\"string\")return props.text;// fallback: first string found in children\nlet found=\"\";const walk=node=>{if(found||node==null)return;if(typeof node===\"string\")found=node;else if(Array.isArray(node))node.forEach(walk);else if(node.props?.children)walk(node.props.children);};walk(props.children);return found;}export function withCountUp(Component){return /*#__PURE__*/forwardRef((props,_ref)=>{const ref=useRef(null);const inView=useInView(ref,{once:true,amount:IN_VIEW_AMOUNT,margin:VIEW_MARGIN});const reducedMotion=useReducedMotion();const original=extractText(props);// split \"300,000+\" → prefix \"\" · number 300000 · suffix \"+\"\nconst match=original.match(/^([^\\d]*)([\\d,]+(?:\\.\\d+)?)(.*)$/);const target=match?parseFloat(match[2].replace(/,/g,\"\")):0;const prefix=match?match[1]:\"\";const suffix=match?match[3]:\"\";const grouped=match?match[2].includes(\",\"):false;const decimals=match?.[2].includes(\".\")?match[2].split(\".\")[1].length:0;const[display,setDisplay]=useState(match?`${prefix}0${suffix}`:original);useEffect(()=>{if(!match||!inView)return;if(reducedMotion){setDisplay(original);return;}const controls=animate(0,target,{duration:DURATION,delay:START_DELAY,ease:[.16,1,.3,1],onUpdate:v=>{const num=decimals?v.toFixed(decimals):Math.round(v).toString();const formatted=grouped?Number(num).toLocaleString(\"en-US\",{minimumFractionDigits:decimals}):num;setDisplay(`${prefix}${formatted}${suffix}`);},onComplete:()=>setDisplay(original)});return()=>controls.stop();},[inView]);return /*#__PURE__*/_jsx(Component,{ref:ref,...props,text:display});});}\nexport const __FramerMetadata__ = {\"exports\":{\"withCountUp\":{\"type\":\"reactHoc\",\"name\":\"withCountUp\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./CountUp.map"],"mappings":"sMAeC,SAAS,EAAY,EAAM,CAAC,GAAG,OAAO,EAAM,MAAO,SAAS,OAAO,EAAM,KAC1E,IAAI,EAAM,GAAS,EAAK,GAAM,CAAI,GAAO,GAAM,OAAe,OAAO,GAAO,SAAS,EAAM,EAAa,MAAM,QAAQ,CAAI,EAAE,EAAK,QAAQ,CAAI,EAAU,EAAK,OAAO,UAAS,EAAK,EAAK,MAAM,QAAQ,EAAE,EAAuB,OAArB,EAAK,EAAM,QAAQ,EAAS,CAAM,CAAC,SAAgB,EAAY,EAAU,CAAC,OAAoB,GAAY,EAAM,IAAO,CAAC,IAAM,EAAIA,EAAO,IAAI,EAAQ,EAAO,EAAU,EAAI,CAAC,KAAK,GAAK,OAAO,EAAe,OAAO,CAAW,CAAC,EAAQ,EAAc,EAAiB,EAAQ,EAAS,EAAY,CAAK,EACze,EAAM,EAAS,MAAM,kCAAkC,EAAQ,EAAO,EAAM,WAAW,EAAM,EAAE,CAAC,QAAQ,KAAK,EAAE,CAAC,EAAE,EAAQ,EAAO,EAAM,EAAM,GAAG,GAAS,EAA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