(self["webpackChunkplatypush"]=self["webpackChunkplatypush"]||[]).push([[945],{85377:function(e,s,t){"use strict";t.r(s),t.d(s,{default:function(){return I}});var r=t(20641),a=t(90033);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(50953),l=t(91387),d=t(81350);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(66262);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(63422)(`./${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},63422:function(e,s,t){var r={"./Calendar/Index":[81405,[1405]],"./Camera/Index":[38211,[8211]],"./Component/Index":[60730,[5184,9769,730]],"./DateTime/Index":[23798,[5788,3798]],"./DateTimeWeather/Index":[89592,[1677,1250,5788,9592]],"./ImageCarousel/Index":[67164,[1677,1250,5788,7164]],"./Music/Index":[8823,[5184,2184,8823]],"./Plugin/Index":[47291,[7291]],"./RssNews/Index":[90960,[960]],"./Weather/Index":[1414,[1677,1250,1414]]};function a(e){try{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})}catch(n){return Promise.reject(n)}var s=r[e],a=s[0];return Promise.all(s[1].map(t.e)).then(function(){return t(a)})}a.keys=function(){return Object.keys(r)},a.id=63422,e.exports=a}}]);
//# sourceMappingURL=dashboard.77a69ccb.js.map