import{i,n,e,r,u}from"./chunk-p42kdtn4.js";function k(o){let f=(o.textContent?.trim()??"").match(/^(\D*)([\d,]*\.?\d+)(\D*)$/);if(!f)return;let[,d,s,x]=f,a=Number(s.replace(/,/g,""));if(!Number.isFinite(a))return;let g=s.includes(".")?s.split(".")[1].length:0,D=s.includes(","),l=(t)=>t.toLocaleString("en-US",{minimumFractionDigits:g,maximumFractionDigits:g,useGrouping:D});o.textContent="";let m=(t,S)=>{let c=document.createElement("span");return c.className=t,c.textContent=S,o.appendChild(c),c};if(d)m("counter_prefix",d);let b=m("counter_number",l(i?a:0));if(x)m("counter_suffix",x);let p={value:0},h=null,C=u(o,{threshold:0.3,autoStart:!1,once:!0,callback:({isIn:t})=>{if(!t)return;if(i){b.textContent=l(a);return}h=n.timeline().to(p,{value:a,duration:2,ease:"expo.out",onUpdate:()=>{b.textContent=l(p.value)}})}});e(()=>{C.start()}),r(()=>{h?.kill(),n.killTweensOf(p),C.destroy()})}export{k as default};