import{aR as u,G as r,ac as S,a1 as m,I as p,d as h,aS as D,X as v,a4 as w,al as H,j as C,P}from"./ResizeObserver.es.62ab429c.js";function g(e,n){const{days:i}=n;let{hours:s,minutes:c,seconds:a,milliseconds:l}=n;if(e.includes("DD")?e=e.replace("DD",u(i)):s+=i*24,e.includes("HH")?e=e.replace("HH",u(s)):c+=s*60,e.includes("mm")?e=e.replace("mm",u(c)):a+=c*60,e.includes("ss")?e=e.replace("ss",u(a)):l+=a*1e3,e.includes("S")){const t=u(l,3);e.includes("SSS")?e=e.replace("SSS",t):e.includes("SS")?e=e.replace("SS",t.slice(0,2)):e=e.replace("S",t.charAt(0))}return e}const[x,N]=r("count-down"),k={time:S(0),format:m("HH:mm:ss"),autoStart:p,millisecond:Boolean};var F=h({name:x,props:k,emits:["change","finish"],setup(e,{emit:n,slots:i}){const{start:s,pause:c,reset:a,current:l}=D({time:+e.time,millisecond:e.millisecond,onChange:o=>n("change",o),onFinish:()=>n("finish")}),t=v(()=>g(e.format,l.value)),d=()=>{a(+e.time),e.autoStart&&s()};return w(()=>e.time,d,{immediate:!0}),H({start:s,pause:c,reset:d}),()=>C("div",{role:"timer",class:N()},[i.default?i.default(l.value):t.value])}});const b=P(F);export{b as C};
