import{a7 as u,t as r,z as S,y as m,u as p,d as h,a8 as D,D as w,Z as H,W as v,c as C,x as g}from"./index.8f93de0e.js";function x(e,n){const{days:i}=n;let{hours:s,minutes:c,seconds:l,milliseconds:t}=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)):l+=c*60,e.includes("ss")?e=e.replace("ss",u(l)):t+=l*1e3,e.includes("S")){const a=u(t,3);e.includes("SSS")?e=e.replace("SSS",a):e.includes("SS")?e=e.replace("SS",a.slice(0,2)):e=e.replace("S",a.charAt(0))}return e}const[P,N]=r("count-down"),k={time:S(0),format:m("HH:mm:ss"),autoStart:p,millisecond:Boolean};var y=h({name:P,props:k,emits:["change","finish"],setup(e,{emit:n,slots:i}){const{start:s,pause:c,reset:l,current:t}=D({time:+e.time,millisecond:e.millisecond,onChange:o=>n("change",o),onFinish:()=>n("finish")}),a=w(()=>x(e.format,t.value)),d=()=>{l(+e.time),e.autoStart&&s()};return H(()=>e.time,d,{immediate:!0}),v({start:s,pause:c,reset:d}),()=>C("div",{role:"timer",class:N()},[i.default?i.default(t.value):a.value])}});const Z=g(y);export{Z as C};
