"use strict";(self["webpackChunkplatypush"]=self["webpackChunkplatypush"]||[]).push([[5953],{5953:function(e,t,n){n.r(t),n.d(t,{default:function(){return g}});var s=n(641),a=n(33);const r={class:"calendar"},i={key:1,class:"no-events"},d={key:2,class:"event upcoming-event"},l=["textContent"],o=["textContent"],u={class:"time"},v={key:3,class:"event-list"},c=["textContent"],m=["textContent"],f=["textContent"];function h(e,t,n,h,C,p){const y=(0,s.g2)("Loading");return(0,s.uX)(),(0,s.CE)("div",r,[e.loading?((0,s.uX)(),(0,s.Wv)(y,{key:0})):e.events.length?e.events.length>0?((0,s.uX)(),(0,s.CE)("div",d,[(0,s.Lk)("div",{class:"date",textContent:(0,a.v_)(e.formatDate(e.events[0].start))},null,8,l),(0,s.Lk)("div",{class:"summary",textContent:(0,a.v_)(e.events[0].summary)},null,8,o),(0,s.Lk)("div",u,(0,a.v_)(e.formatTime(e.events[0].start,!1))+" - "+(0,a.v_)(e.formatTime(e.events[0].end,!1)),1)])):(0,s.Q3)("",!0):((0,s.uX)(),(0,s.CE)("div",i," No events found ")),e.events.length>1?((0,s.uX)(),(0,s.CE)("div",v,[((0,s.uX)(!0),(0,s.CE)(s.FK,null,(0,s.pI)(e.events.slice(1,n.maxEvents),(t=>((0,s.uX)(),(0,s.CE)("div",{class:"event",key:t.id},[(0,s.Lk)("div",{class:"date col-2",textContent:(0,a.v_)(e.formatDate(t.start))},null,8,c),(0,s.Lk)("div",{class:"time col-2",textContent:(0,a.v_)(e.formatTime(t.start,!1))},null,8,m),(0,s.Lk)("div",{class:"summary col-8",textContent:(0,a.v_)(t.summary)},null,8,f)])))),128))])):(0,s.Q3)("",!0)])}var C=n(2002),p=n(9828),y={name:"Calendar",components:{Loading:p.A},mixins:[C.A],props:{maxEvents:{type:Number,required:!1,default:10},refreshSeconds:{type:Number,required:!1,default:600}},data:function(){return{events:[],loading:!1}},methods:{refresh:async function(){this.loading=!0;try{this.events=(await this.request("calendar.get_upcoming_events")).map((e=>(e.start&&(e.start=new Date(e.start.dateTime||e.start.date)),e.end&&(e.end=new Date(e.end.dateTime||e.end.date)),e)))}finally{this.loading=!1}}},mounted:function(){this.refresh(),setInterval(this.refresh,parseInt((1e3*this.refreshSeconds).toFixed(0)))}},k=n(6262);const x=(0,k.A)(y,[["render",h],["__scopeId","data-v-44a3b988"]]);var g=x}}]);
//# sourceMappingURL=5953.3ee4e3f1.js.map