import{u as S}from"./widget-qjKd4HCd.js";import{b as M,a as u,w,o as z,h as s,t as a,z as t,H as r,u as f,E as _,x as h,y as I}from"./vue-y3KLWBaS.js";import{n as P}from"./app-JmgyQoR0.js";const T={key:0,class:"label"},B={class:"time"},D=["textContent"],E=["textContent"],L={key:1,class:"label"},v="unixClock",N=M({__name:"unix-clock",props:{widget:{}},emits:["updateProps"],setup(g,{expose:x,emit:C}){const k={transparent:{type:"boolean",default:!1},fontSize:{type:"number",default:1.5,step:.1},showMs:{type:"boolean",default:!0},showLabel:{type:"boolean",default:!0}},c=g,y=C,{widgetProps:e,configure:b}=S(v,k,c,y);let n;const l=u(""),d=u(""),i=u(!1);let p=null;w(i,o=>{o&&window.setTimeout(()=>{i.value=!1},30)});const m=()=>{const o=new Date;l.value=Math.floor(o.getTime()/1e3).toString(),d.value=Math.floor(o.getTime()%1e3/10).toString().padStart(2,"0"),l.value!==p&&(i.value=!0),p=l.value};return m(),w(()=>e.showMs,()=>{n&&window.clearInterval(n),n=window.setInterval(m,e.showMs?10:1e3)},{immediate:!0}),z(()=>{window.clearInterval(n)}),x({name:v,configure:b,id:c.widget?c.widget.id:null}),(o,U)=>(s(),a("div",{class:h(["mkw-unixClock _monospace",{_panel:!t(e).transparent}]),style:I({fontSize:`${t(e).fontSize}em`})},[t(e).showLabel?(s(),a("div",T,"UNIX Epoch")):r("",!0),f("div",B,[f("span",{textContent:_(l.value)},null,8,D),t(e).showMs?(s(),a("span",{key:0,class:h(["colon",{showColon:i.value}])},":",2)):r("",!0),t(e).showMs?(s(),a("span",{key:1,textContent:_(d.value)},null,8,E)):r("",!0)]),t(e).showLabel?(s(),a("div",L,"UTC")):r("",!0)],6))}}),X=P(N,[["__scopeId","data-v-c55789ac"]]);export{X as default};
