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