index.3efa3471.js 1.1 KB

1
  1. import{aQ as u,E as r,ab as S,a0 as m,H as p,d as h,aR as D,W as H,a3 as v,ak as w,j as C,O as g}from"./ResizeObserver.es.39b48a47.js";function x(e,n){const{days:i}=n;let{hours:s,minutes:a,seconds:c,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)):a+=s*60,e.includes("mm")?e=e.replace("mm",u(a)):c+=a*60,e.includes("ss")?e=e.replace("ss",u(c)):l+=c*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[P,k]=r("count-down"),N={time:S(0),format:m("HH:mm:ss"),autoStart:p,millisecond:Boolean};var b=h({name:P,props:N,emits:["change","finish"],setup(e,{emit:n,slots:i}){const{start:s,pause:a,reset:c,current:l}=D({time:+e.time,millisecond:e.millisecond,onChange:o=>n("change",o),onFinish:()=>n("finish")}),t=H(()=>x(e.format,l.value)),d=()=>{c(+e.time),e.autoStart&&s()};return v(()=>e.time,d,{immediate:!0}),w({start:s,pause:a,reset:d}),()=>C("div",{role:"timer",class:k()},[i.default?i.default(l.value):t.value])}});const F=g(b);export{F as C};