import{P as p}from"./ProgressTimerView.js";import{c as S}from"./time4.js";import{u as T}from"./useTimer.js";import{r as C,o as h,c as b,b as E,w as m,j as f,_ as v,Q as a,J as w}from"./index.js";const U={class:"progress-timer"};function _(e,s,t,r,c,d){const n=C("ProgressTimerView");return h(),b("div",U,[E(n,{type:t.type,progress:r.progress,time:r.formattedTime,iconColor:t.iconColor,progressColor:t.progressColor,barColor:t.barColor,propgressOpacity:t.propgressOpacity,barOpacity:t.barOpacity,timeColor:t.timeColor,sizeType:t.sizeType,iconType:t.iconType,isTimeUp:r.isTimeUp,highlightTimeUp:t.highlightTimeUp},{after:m(()=>[f(e.$slots,"after")]),default:m(()=>[f(e.$slots,"default")]),_:3},8,["type","progress","time","iconColor","progressColor","barColor","propgressOpacity","barOpacity","timeColor","sizeType","iconType","isTimeUp","highlightTimeUp"])])}const O={props:{type:{type:String,validator:e=>["rect","circle"].includes(e),default:"circle"},sizeType:{type:String,validator:e=>["s","m"].includes(e),default:"s"},iconColor:{type:String,default:"#EEEEE6"},progressColor:{type:String,default:"#FF6D00"},barColor:{type:String,default:"#eeeee6"},propgressOpacity:{type:Number,default:1},barOpacity:{type:Number,default:.2},timeColor:{type:String,default:"#EEEEE6"},currentSeconds:{type:Number,required:!0},isCountdown:{type:Boolean,default:!0},startSeconds:{type:Number,default:0},endSeconds:{type:Number,default:0},iconType:{type:String,validator:e=>["clock","sandClock"].includes(e),default:"clock"},isMobile:{type:Boolean,default:!1},highlightTimeUp:{type:Boolean,default:!1}},components:{ProgressTimerView:p},setup(e,{emit:s}){const{time:t}=T(e.currentSeconds,e.isCountdown,e.endSeconds),r=a(()=>{const i=e.isCountdown?e.startSeconds:e.endSeconds;let o=["minutes","seconds"];const l=3600,u=l*24;i>=l&&(o=["hours","minutes","seconds"]),i>=u&&e.currentSeconds>=u&&(o=["days","hours","minutes"]);const y=S(t.value*1e3);return o.map(g=>String(y[g]).padStart(2,"0")).join(":")}),c=a(()=>t.value<=10),d=a(()=>e.isCountdown?t.value/e.startSeconds:1-t.value/e.endSeconds);function n(){s("update:time",t.value)}return w(t,(i,o)=>{n(),e.isCountdown?o>0&&i<=0&&s("finish"):e.endSeconds>0&&o<e.endSeconds&&i>=e.endSeconds&&s("finish")}),{formattedTime:r,progress:d,isTimeUp:c}}},z=v(O,[["render",_]]);export{z as P};
