import{u as Q}from"./widget-qjKd4HCd.js";import{$ as x,Q as W,i as a,n as j}from"./app-JmgyQoR0.js";import{b as q,a as n,h,t as w,u as e,E as t,z as l,K as u,x as P,y as g,I as A,J as G}from"./vue-y3KLWBaS.js";const L=d=>(A("data-v-82901336"),d=d(),G(),d),O={class:"month-and-year"},R={class:"year"},U={class:"month"},Z={key:0,class:"day"},ee=L(()=>e("span",{style:{display:"inline-block",transform:"scaleX(-1)"}},"🎉",-1)),ae={key:1,class:"day"},te={class:"week-day"},se={class:"info"},ne={class:"meter"},oe={class:"meter"},le={class:"meter"},B="calendar",de=q({__name:"calendar",props:{widget:{}},emits:["updateProps"],setup(d,{expose:I,emit:M}){var T;const N={transparent:{type:"boolean",default:!1}},y=d,S=M,{widgetProps:X,configure:$}=Q(B,N,y,S),F=!!((T=x)!=null&&T.birthday),f=n(0),r=n(0),i=n(0),D=n(""),m=n(0),v=n(0),p=n(0),k=n(!1),b=n(!1);return W(()=>{const s=new Date,_=s.getDate(),c=s.getMonth(),o=s.getFullYear();f.value=o,r.value=c+1,i.value=_,D.value=[a.ts._weekday.sunday,a.ts._weekday.monday,a.ts._weekday.tuesday,a.ts._weekday.wednesday,a.ts._weekday.thursday,a.ts._weekday.friday,a.ts._weekday.saturday][s.getDay()];const z=s.getTime()-new Date(o,c,_).getTime(),Y=1e3*60*60*24,C=s.getTime()-new Date(o,c,1).getTime(),E=new Date(o,c+1,1).getTime()-new Date(o,c,1).getTime(),H=s.getTime()-new Date(o,0,1).getTime(),V=new Date(o+1,0,1).getTime()-new Date(o,0,1).getTime();if(p.value=z/Y*100,v.value=C/E*100,m.value=H/V*100,k.value=s.getDay()===0||s.getDay()===6,F){const[ce,J,K]=x.birthday.split("-");r.value===+J&&i.value==+K&&(b.value=!0)}},1e3,{immediate:!0,afterMounted:!1}),I({name:B,configure:$,id:y.widget?y.widget.id:null}),(s,_)=>(h(),w("div",{class:P(["mkw-calendar",{_panel:!l(X).transparent}])},[e("div",{class:P(["calendar",{isHoliday:k.value}])},[e("p",O,[e("span",R,t(l(a).t("yearX",{year:f.value})),1),e("span",U,t(l(a).t("monthX",{month:r.value})),1)]),r.value===1&&i.value===1||b.value?(h(),w("p",Z,[u(" 🎉"+t(l(a).t("dayX",{day:i.value})),1),ee])):(h(),w("p",ae,t(l(a).t("dayX",{day:i.value})),1)),e("p",te,t(D.value),1)],2),e("div",se,[e("div",null,[e("p",null,[u(t(l(a).ts.today)+": ",1),e("b",null,t(p.value.toFixed(1))+"%",1)]),e("div",ne,[e("div",{class:"val",style:g({width:`${p.value}%`})},null,4)])]),e("div",null,[e("p",null,[u(t(l(a).ts.thisMonth)+": ",1),e("b",null,t(v.value.toFixed(1))+"%",1)]),e("div",oe,[e("div",{class:"val",style:g({width:`${v.value}%`})},null,4)])]),e("div",null,[e("p",null,[u(t(l(a).ts.thisYear)+": ",1),e("b",null,t(m.value.toFixed(1))+"%",1)]),e("div",le,[e("div",{class:"val",style:g({width:`${m.value}%`})},null,4)])])])],2))}}),me=j(de,[["__scopeId","data-v-82901336"]]);export{me as default};
