import{aP as g,L as D,P as O,n as h,e as p,K as w,aQ as E,V as N,F as r,_ as M,w as b}from"./index-B_2CoVdl.js";import{d as I,f as S,w as Y,a2 as y,a3 as B,a5 as $}from"./vue-vendor-CxLCUzY4.js";const c=1e3,l=c*60,u=l*60,T=u*24,H=I({name:"Time",props:{value:r.oneOfType([r.number,r.instanceOf(Date),r.string]).isRequired,step:r.number.def(60),mode:r.oneOf(["date","datetime","relative"]).def("relative")},setup(i){const m=S(""),{t:s}=w();g(d,i.step*c),Y(()=>i.value,()=>{d()},{immediate:!0});function v(){const{value:e}=i;let n=0;if(D(e)){const a=e.toString().length>10?e:e*1e3;n=new Date(a).getTime()}else O(e)?n=new Date(e).getTime():h(e)&&(n=e.getTime());return n}function d(){const{mode:e,value:n}=i,a=v();e==="relative"?m.value=_(a):e==="datetime"?m.value=E(n):e==="date"&&(m.value=N(n))}function _(e){const n=new Date().getTime(),a=p(e).isBefore(n);let t=n-e;a||(t=-t);let o="",f=s(a?"component.time.before":"component.time.after");return t<c?o=s("component.time.just"):t<l?o=parseInt(t/c)+s("component.time.seconds")+f:t>=l&&t<u?o=Math.floor(t/l)+s("component.time.minutes")+f:t>=u&&t<T?o=Math.floor(t/u)+s("component.time.hours")+f:t>=T&&t<262386e4?o=Math.floor(t/T)+s("component.time.days")+f:t>=262386e4&&t<=3156786e4&&a?o=p(e).format("MM-DD-HH-mm"):o=p(e).format("YYYY"),o}return{date:m}}});function R(i,m,s,v,d,_){return y(),B("span",null,$(i.date),1)}const U=M(H,[["render",R]]),x=b(U);export{x as T};
