import{f as w,e as u,F as $,T as M,z as x,o,k as f,n as A,d as T,w as B,j as m,W as D,A as a,X as N,G as z,U as j}from"../modules/vue-DkYzewYG.js";import{j as F,l as V,v as b,w as E}from"../index-Dgc7rSMr.js";const G={class:"relative flex gap-px"},U=w({__name:"CurrentProgressBar",props:{clicksContext:{},current:{}},setup(r){const e=r,s=F(),t=a(()=>e.clicksContext??s.clicksContext.value),l=a(()=>e.current??s.currentSlideNo.value),{total:n}=s;return(d,g)=>(o(),u("div",G,[(o(!0),u($,null,M(x(n)-1,i=>(o(),u("div",{key:i,class:A(["border-x border-b border-main h-4px transition-all",i<l.value?"bg-primary border-primary":""]),style:f({width:`${1/(x(n)-1)*100}%`})},[T(D,{name:"fade"},{default:B(()=>[i===l.value?(o(),u("div",{key:0,class:"h-full bg-primary op75 transition-all",style:f({width:`${t.value.total===0?0:t.value.current/(t.value.total+1)*100}%`})},null,4)):m("v-if",!0)]),_:2},1024)],6))),128))]))}});function I(){const r=a(()=>b.timer||"stopwatch"),e=a(()=>E(b.duration).seconds),s=N(100,{controls:!0}),t=z(V,"timer"),l=a(()=>t.value?.status),n=a(()=>(s.counter.value,t.value.status==="stopped"||!t.value.startedAt?0:t.value.status==="paused"?t.value.pausedAt-t.value.startedAt:Date.now()-t.value.startedAt)),d=a(()=>n.value/1e3),g=a(()=>d.value/e.value*100),i=a(()=>{if(r.value==="stopwatch"&&(t.value.status==="stopped"||!t.value.startedAt))return{h:"",m:"-",s:"--",ms:"-"};const c=r.value==="countdown"?e.value*1e3-n.value:n.value;let p=Math.floor(c/1e3/60/60).toString();p==="0"&&(p="");let v=Math.floor(c/1e3/60%60).toString();p&&(v=v.padStart(2,"0"));const C=Math.floor(c/1e3%60).toString().padStart(2,"0"),S=Math.floor(c%1e3/100).toString();return{h:p,m:v,s:C,ms:S}});function y(){s.pause(),t.value={status:"stopped",slides:{},startedAt:0,pausedAt:0}}function h(){t.value&&(t.value?.status==="stopped"?(t.value.status="running",t.value.startedAt=Date.now()):t.value.status==="paused"&&(t.value.status="running",t.value.startedAt=Date.now()-(t.value.pausedAt-t.value.startedAt)),s.resume())}function _(){t.value.status="paused",t.value.pausedAt=Date.now(),s.pause()}function k(){t.value.status==="running"?_():h()}return{state:t,status:l,timer:i,reset:y,toggle:k,resume:h,pause:_,passed:d,percentage:g,duration:e,mode:r}}const L={class:"border-b mt-px border-main relative flex h-4px"},W=w({__name:"TimerBar",setup(r){const e=j(I()),s=a(()=>e.status==="stopped"?"op50":e.status==="paused"?"bg-blue":e.percentage>100?"bg-red":e.percentage>80?"bg-yellow":"bg-green");return(t,l)=>(o(),u("div",L,[e.status!=="stopped"?(o(),u("div",{key:0,class:A(["h-4px",s.value]),style:f({width:`${e.percentage}%`})},null,6)):m("v-if",!0),m(" {{ timesplits }} ")]))}});export{U as _,W as a,I as u};
