import{d as P,p as n,f as q,b7 as v,B as E,b as k,aP as w,a as o,o as $,c as B,t as G,W as H,Y as M,b9 as N,_ as O,__tla as R}from"./index-2c56227b.js";let S,W=Promise.all([(()=>{try{return R}catch{}})()]).then(async()=>{S=O(P({name:"CountTo",__name:"CountTo",props:{startVal:n.number.def(0),endVal:n.number.def(2021),duration:n.number.def(3e3),autoplay:n.bool.def(!0),decimals:n.number.validate(i=>i>=0).def(0),decimal:n.string.def("."),separator:n.string.def(","),prefix:n.string.def(""),suffix:n.string.def(""),useEasing:n.bool.def(!0),easingFn:{type:Function,default:(i,m,p,d)=>p*(1-Math.pow(2,-10*i/d))*1024/1023+m}},emits:["mounted","callback"],setup(i,{expose:m,emit:p}){const{getPrefixCls:d}=M(),T=d("count-to"),t=i,b=p,V=e=>{const{decimals:s,decimal:u,separator:l,suffix:r,prefix:C}=t;e=Number(e).toFixed(s);const g=(e+="").split(".");let c=g[0];const h=g.length>1?u+g[1]:"",A=/(\d+)(\d{3})/;if(l&&!N(l))for(;A.test(c);)c=c.replace(A,"$1"+l+"$2");return C+c+h+r},a=q({localStartVal:t.startVal,displayValue:V(t.startVal),printVal:null,paused:!1,localDuration:t.duration,startTime:null,timestamp:null,remaining:null,rAF:null}),D=v(a,"displayValue");E(()=>{t.autoplay&&F(),b("mounted")});const f=k(()=>t.startVal>t.endVal);w([()=>t.startVal,()=>t.endVal],()=>{t.autoplay&&F()});const F=()=>{const{startVal:e,duration:s}=t;a.localStartVal=e,a.startTime=null,a.localDuration=s,a.paused=!1,a.rAF=requestAnimationFrame(_)},y=()=>{cancelAnimationFrame(a.rAF)},x=()=>{a.startTime=null,a.localDuration=+a.remaining,a.localStartVal=+a.printVal,requestAnimationFrame(_)},_=e=>{const{useEasing:s,easingFn:u,endVal:l}=t;a.startTime||(a.startTime=e),a.timestamp=e;const r=e-a.startTime;a.remaining=a.localDuration-r,s?o(f)?a.printVal=a.localStartVal-u(r,0,a.localStartVal-l,a.localDuration):a.printVal=u(r,a.localStartVal,l-a.localStartVal,a.localDuration):o(f)?a.printVal=a.localStartVal-(a.localStartVal-l)*(r/a.localDuration):a.printVal=a.localStartVal+(l-a.localStartVal)*(r/a.localDuration),o(f)?a.printVal=a.printVal<l?l:a.printVal:a.printVal=a.printVal>l?l:a.printVal,a.displayValue=V(a.printVal),r<a.localDuration?a.rAF=requestAnimationFrame(_):b("callback")};return m({pauseResume:()=>{a.paused?(x(),a.paused=!1):(y(),a.paused=!0)},reset:()=>{a.startTime=null,cancelAnimationFrame(a.rAF),a.displayValue=V(t.startVal)},start:F,pause:y}),(e,s)=>($(),B("span",{class:H(o(T))},G(o(D)),3))}}),[["__file","E:/GAOHP_2023/mall/newfeifan-front/yudao-ui-admin-vue3/src/components/CountTo/src/CountTo.vue"]])});export{S as _,W as __tla};
