{"version":3,"file":"Number_Counter.CrW8eaMR.mjs","names":["useRef","useState"],"sources":["https:/framerusercontent.com/modules/uyUwmjRPElqXvtYBJeXq/2fO3CWTTwRuXt5lK6VLc/Number_Counter.js"],"sourcesContent":["import{jsx as _jsx}from\"react/jsx-runtime\";import{useRef,useEffect,useState}from\"react\";import{animate,useInView}from\"framer-motion\";export function withScrollCountUp(Component){return props=>{const ref=useRef(null);// Tracks the element entering the screen\nconst isInView=useInView(ref,{once:true});const[currentText,setCurrentText]=useState(\"\");const[hasStarted,setHasStarted]=useState(false);useEffect(()=>{// 1. Safely hunt down the text, whether Framer passes it as 'text', 'content', or we have to read the HTML natively.\nlet rawText=\"0\";if(typeof props.text===\"string\")rawText=props.text;else if(typeof props.content===\"string\")rawText=props.content;else if(ref.current)rawText=ref.current.innerText||\"0\";// 2. Extract numbers and symbols\nconst match=String(rawText).match(/(\\D*)(\\d+)(\\D*)/);let prefix=\"\";let targetNumber=0;let suffix=\"\";if(match){prefix=match[1]||\"\";targetNumber=parseInt(match[2],10);suffix=match[3]||\"\";}else{// Absolute fallback: strip everything but numbers\ntargetNumber=parseInt(String(rawText).replace(/[^\\d]/g,\"\"),10)||0;}// 3. Set to 0 before scrolling into view\nif(!isInView){setCurrentText(`${prefix}0${suffix}`);return;}setHasStarted(true);// 4. Animate!\nconst controls=animate(0,targetNumber,{duration:2,ease:\"easeOut\",onUpdate(value){setCurrentText(`${prefix}${Math.round(value)}${suffix}`);}});return()=>controls.stop();},[isInView,props.text,props.content]);// We use inline-block so the Intersection Observer (scroll tracker) can physically see the box\nreturn /*#__PURE__*/_jsx(\"div\",{ref:ref,style:{display:\"inline-block\",width:\"100%\",height:\"100%\"},children:/*#__PURE__*/_jsx(Component,{...props,text:hasStarted?currentText:props.text,content:hasStarted?currentText:props.content})});};}\nexport const __FramerMetadata__ = {\"exports\":{\"withScrollCountUp\":{\"type\":\"reactHoc\",\"name\":\"withScrollCountUp\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"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