import{d as k,H as A,b as C,g as N,p as n,j as u,z as i,m as x,A as e,B as d,i as o,n as w,o as a}from"./CSSikKpG.js";const B={class:"c-statistic-emph c-statistic-placeholder"},V=["textContent"],q=["textContent"],z={class:"c-statistic-emph c-statistic-number"},O=["textContent"],T=["textContent"],j=["textContent"],F=k({__name:"AtomsStatistic",props:{number:{type:Number,required:!0},before:{type:String,default:void 0},after:{type:String,default:void 0},caption:{type:String,default:void 0},delay:{type:Number,default:0},duration:{type:Number,default:1}},setup(t){const c=t,{observer:g,intersected:m}=A({triggerOnce:!0}),f=C("0"),s=C(0);function p(b,r,v,S){let l=null;const y=h=>{l||(l=h),s.value=Math.min((h-l)/S,1),b.value=Math.floor(s.value*(v-r)+r).toLocaleString("en"),s.value<1&&window.requestAnimationFrame(y)};window.requestAnimationFrame(y)}return N(m,()=>setTimeout(()=>p(f,0,c.number,c.duration*1e3),c.delay*1e3)),(b,r)=>(a(),n("div",{ref_key:"observer",ref:g,class:w(["c-statistic",{intersected:o(m),animated:o(s)===1}]),style:d({opacity:o(s)})},[u("span",B,[t.before?(a(),n("span",{key:0,class:"c-statistic-before",textContent:e(t.before)},null,8,V)):i("",!0),x(" "+e(t.number.toLocaleString("en"))+" ",1),t.after?(a(),n("span",{key:1,class:"c-statistic-after",style:d(t.number>9999&&"display: block"),textContent:e(t.after)},null,12,q)):i("",!0)]),u("span",z,[t.before?(a(),n("span",{key:0,class:"c-statistic-before",textContent:e(t.before)},null,8,O)):i("",!0),x(" "+e(o(f))+" ",1),t.after?(a(),n("span",{key:1,class:"c-statistic-after",style:d(t.number>9999&&"display: block"),textContent:e(t.after)},null,12,T)):i("",!0)]),u("p",{class:"c-statistic-caption",textContent:e(t.caption)},null,8,j)],6))}}),M=Object.assign(F,{__name:"CAtomsStatistic"});export{M as default};
