"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("vue");function x(t,n,a,l){return(t/=l/2)<1?a/2*t*t*t+n:a/2*((t-=2)*t*t+2)+n}const F={class:"scroll-item-wrapper"},V={style:{opacity:"0",display:"inline-block"}},k=e.defineComponent({__name:"ScrollNumberItem",props:{value:{},transformDuration:{}},emits:["cancelAnimationFrame"],setup(t){const n=t;e.watch(()=>n.value,i=>{v?(a=o.value,l=i,s=null):(a=l,l=i,y())});let a=n.value,l=n.value;const o=e.ref(n.value%10),r=e.computed(()=>Math.floor(o.value)),c=e.computed(()=>Math.floor(o.value)+1),b=e.computed(()=>({transform:`translateY(${(o.value-r.value)*100*-1}%)`,opacity:1-Math.abs(o.value-r.value)})),d=e.computed(()=>({transform:`translateY(${(c.value-o.value)*100}%)`,opacity:Math.abs(o.value-r.value)}));let f=null;function y(){f=u(m)}function g(i){f&&(window.cancelAnimationFrame(f),f=null,o.value=i%10,s=null,v=!1)}function u(i){return window.requestAnimationFrame(i)}let s=null,v=!1;function m(i){if(v=!0,s||(s=i),(i-s)/n.transformDuration>1){g(l);return}o.value=x(i-s,a,l-a,n.transformDuration)%10,f=u(m)}return(i,D)=>(e.openBlock(),e.createElementBlock("div",F,[e.createElementVNode("div",V,e.toDisplayString(r.value),1),e.createElementVNode("div",{class:"scroll-numbers",style:e.normalizeStyle(b.value)},e.toDisplayString(r.value),5),e.createElementVNode("div",{class:"scroll-numbers",style:e.normalizeStyle(d.value)},e.toDisplayString(c.value),5)]))}}),S=(t,n)=>{const a=t.__vccOpts||t;for(const[l,o]of n)a[l]=o;return a},N=S(k,[["__scopeId","data-v-12dbea03"]]),h={transformDuration:1500,fractionDigits:0,prefix:"",infix:"",suffix:"",thousandSeparator:","};function p(t){return h[t]}function w(t){Object.assign(h,t)}const A={name:"ScrollNumber",props:{value:{type:Number,required:!0},transformDuration:{type:Number,default:()=>p("transformDuration")},fractionDigits:{type:Number,default:()=>p("fractionDigits")},prefix:{type:String,default:()=>p("prefix")},infix:{type:String,default:()=>p("infix")},suffix:{type:String,default:()=>p("suffix")},thousandSeparator:{type:String,default:()=>p("thousandSeparator")}},components:{ScrollNumberItem:N},setup(t){function n(r){return!Number.isNaN(+r)}let a=0;function l(r,c,b,d,f,y){const g=r<0,u=r.toFixed(c).split("");if(a=c<=0?u.length:u.length-1,y){let s=0;const v=g?1:0;for(let m=u.length-c-2;m>v;m--)s++,s>0&&s%3==0&&u.splice(m,0,y)}return f&&u.push(f),d&&(r<0?u.splice(1,0,d):u.unshift(d)),b&&u.unshift(b),u}const o=e.computed(()=>l(t.value,t.fractionDigits,t.prefix,t.infix,t.suffix,t.thousandSeparator));return()=>o.value.map((r,c)=>n(r)?e.createVNode(N,{key:a-c,value:Number(r),transformDuration:t.transformDuration},null):e.createVNode("span",{key:r},[r]))}},_=S(A,[["__scopeId","data-v-154afd88"]]);function M(t,n){t.component(_.name,_),n&&w(n)}exports.ScrollNumber=_;exports.default=M;