(self["webpackChunkplatypush"]=self["webpackChunkplatypush"]||[]).push([[945],{4272:function(e,s,t){"use strict";t.r(s),t.d(s,{default:function(){return I}});var r=t(641),a=t(33);function n(e,s,t,n,o,l){const d=(0,r.g2)("Loading"),i=(0,r.g2)("Widget"),u=(0,r.g2)("Row");return(0,r.uX)(),(0,r.CE)(r.FK,null,[o.loading?((0,r.uX)(),(0,r.Wv)(d,{key:0})):(0,r.Q3)("",!0),(0,r.Lk)("div",{id:"dashboard",class:(0,a.C4)(["col-12",l.classes]),style:(0,a.Tr)(o.style)},[((0,r.uX)(!0),(0,r.CE)(r.FK,null,(0,r.pI)(o.rows,((e,s)=>((0,r.uX)(),(0,r.Wv)(u,{key:s,class:(0,a.C4)(e.class),style:(0,a.Tr)(e.style)},{default:(0,r.k6)((()=>[((0,r.uX)(!0),(0,r.CE)(r.FK,null,(0,r.pI)(e.widgets,((e,s)=>((0,r.uX)(),(0,r.Wv)(r.PR,{key:s},[(0,r.bF)(i,{style:(0,a.Tr)(e.style),class:(0,a.C4)(e.class)},{default:(0,r.k6)((()=>[((0,r.uX)(),(0,r.Wv)((0,r.$y)(e.component),(0,r.v6)({ref_for:!0},l.getWidgetProps(e)),null,16))])),_:2},1032,["style","class"])],1024)))),128))])),_:2},1032,["class","style"])))),128))],6)],64)}var o=t(953),l=t(2002),d=t(9828);function i(e,s,t,n,o,l){return(0,r.uX)(),(0,r.CE)("div",{class:(0,a.C4)(["row",l.classes]),style:(0,a.Tr)(t.style)},[(0,r.RG)(e.$slots,"default",{},void 0,!0)],6)}var u={name:"Row",props:{class:{type:String,required:!1,default:""},style:{type:String,required:!1,default:""}},computed:{classes(){return this.class}}},c=t(6262);const p=(0,c.A)(u,[["render",i],["__scopeId","data-v-1b4663f2"]]);var h=p;function f(e,s,t,n,o,l){return(0,r.uX)(),(0,r.CE)("div",{style:(0,a.Tr)(t.style),class:(0,a.C4)(l.classes)},[(0,r.RG)(e.$slots,"default",{},void 0,!0)],6)}var m={name:"Widget",props:{style:{type:String,required:!1,default:""},class:{type:String,required:!1,default:""}},computed:{classes(){return(this.class?.length?this.class.split(" "):["col-3"]).concat(["widget","column"])}}};const y=(0,c.A)(m,[["render",f],["__scopeId","data-v-5df52982"]]);var g=y,v={name:"Dashboard",mixins:[l.A],components:{Widget:g,Loading:d.A,Row:h},props:{refreshSeconds:{type:Number,required:!1,default:0}},data(){return{rows:[],loading:!1,style:void 0,class:void 0}},computed:{classes(){return this.class},_refreshSeconds(){return parseFloat(this.refreshSeconds)||0}},methods:{getWidgetProps(e){const s={...e.props};return s.class&&delete s.class,s},parseTemplate(e){const s=(new DOMParser).parseFromString(e,"text/xml").childNodes[0],a=this;this.style=s.attributes.style?.nodeValue,this.class=s.attributes.class?.nodeValue,this.rows=[...s.getElementsByTagName("Row")].map((e=>({style:e.attributes.style?.nodeValue,class:e.attributes.class?.nodeValue,widgets:[...e.children].map((e=>{const s=(0,o.IJ)((0,r.$V)((()=>t(3422)(`./${e.nodeName}/Index`)))),n=e.attributes.style?.nodeValue,l=e.attributes.class?.nodeValue,d=[...e.attributes].reduce(((e,s)=>("style"!==s.nodeName&&(e[s.nodeName]=s.nodeValue),e)),{content:e.innerHTML}),i={component:s,style:n,class:l,props:d||{}};return a.$options.components[e.nodeName]=s,i}))}))),this.loading=!1},async refreshDashboard(){this.loading=!0,this.widgets=[];const e=this.$route.params.name,s=await this.request("config.get_dashboard",{name:e});s||this.notifyError(`Dashboard ${e} not found`),this.parseTemplate(s)}},mounted(){if(this.refreshDashboard(),this._refreshSeconds){const e=this;setInterval((()=>{e.refreshDashboard()}),parseInt((1e3*this._refreshSeconds).toFixed(0)))}}};const b=(0,c.A)(v,[["render",n],["__scopeId","data-v-462fad8c"]]);var I=b},3422:function(e,s,t){var r={"./Calendar/Index":[5953,5953],"./Camera/Index":[3851,3851],"./Component/Index":[8466,9769,5184,8466],"./DateTime/Index":[1391,5788,1391],"./DateTimeWeather/Index":[3923,5188,5788,3923],"./ImageCarousel/Index":[5688,5188,5788,3307],"./Music/Index":[9426,5184,6157,9426],"./Plugin/Index":[7896,7896],"./RssNews/Index":[7222,7222],"./Weather/Index":[5188,5188]};function a(e){if(!t.o(r,e))return Promise.resolve().then((function(){var s=new Error("Cannot find module '"+e+"'");throw s.code="MODULE_NOT_FOUND",s}));var s=r[e],a=s[0];return Promise.all(s.slice(1).map(t.e)).then((function(){return t(a)}))}a.keys=function(){return Object.keys(r)},a.id=3422,e.exports=a}}]);
//# sourceMappingURL=dashboard.e7fad48a.js.map