"use strict";(self["webpackChunkplatypush"]=self["webpackChunkplatypush"]||[]).push([[518,3499],{6:function(t,e,o){o.d(e,{Z:function(){return v}});var l=o(6252),n=o(3577),i=o(9963);const a=t=>((0,l.dD)("data-v-a6396ae8"),t=t(),(0,l.Cn)(),t),c=["checked"],s=a((()=>(0,l._)("div",{class:"switch"},[(0,l._)("div",{class:"dot"})],-1))),r={class:"label"};function d(t,e,o,a,d,u){return(0,l.wg)(),(0,l.iD)("div",{class:(0,n.C_)(["power-switch",{disabled:o.disabled}]),onClick:e[0]||(e[0]=(0,i.iM)(((...t)=>u.onInput&&u.onInput(...t)),["stop"]))},[(0,l._)("input",{type:"checkbox",checked:o.value},null,8,c),(0,l._)("label",null,[s,(0,l._)("span",r,[(0,l.WI)(t.$slots,"default",{},void 0,!0)])])],2)}var u={name:"ToggleSwitch",emits:["input"],props:{value:{type:Boolean,default:!1},disabled:{type:Boolean,default:!1}},methods:{onInput(t){if(this.disabled)return!1;this.$emit("input",t)}}},p=o(3744);const h=(0,p.Z)(u,[["render",d],["__scopeId","data-v-a6396ae8"]]);var v=h},3499:function(t,e,o){o.r(e),o.d(e,{default:function(){return h}});var l=o(6252),n=o(3577),i=o(3540);const a={key:0,src:i,class:"loading"},c={key:1,class:"fas fa-circle-exclamation error"};function s(t,e,o,i,s,r){const d=(0,l.up)("Icon");return(0,l.wg)(),(0,l.iD)("div",{class:(0,n.C_)(["entity-icon-container",{"with-color-fill":!!r.colorFill}]),style:(0,n.j5)(r.colorFillStyle)},[o.loading?((0,l.wg)(),(0,l.iD)("img",a)):o.error?((0,l.wg)(),(0,l.iD)("i",c)):((0,l.wg)(),(0,l.j4)(d,(0,n.vs)((0,l.dG)({key:2},r.computedIcon)),null,16))],6)}var r=o(1478),d={name:"EntityIcon",components:{Icon:r.Z},props:{loading:{type:Boolean,default:!1},error:{type:Boolean,default:!1},icon:{type:Object,required:!0},hasColorFill:{type:Boolean,default:!1}},data(){return{component:null,modalVisible:!1}},computed:{colorFill(){return this.hasColorFill&&this.icon.color?this.icon.color:null},colorFillStyle(){return this.colorFill?{background:this.colorFill}:{}},computedIcon(){const t={...this.icon};return this.colorFill&&delete t.color,t},type(){let t=this.entity.type||"";return t.charAt(0).toUpperCase()+t.slice(1)}}},u=o(3744);const p=(0,u.Z)(d,[["render",s],["__scopeId","data-v-6f83c443"]]);var h=p},518:function(t,e,o){o.r(e),o.d(e,{default:function(){return w}});var l=o(6252),n=o(3577),i=o(9963);const a={class:"entity switch-container"},c={class:"head"},s={class:"col-1 icon"},r={class:"col-9 label"},d=["textContent"],u={class:"col-2 switch pull-right"};function p(t,e,o,p,h,v){const g=(0,l.up)("EntityIcon"),f=(0,l.up)("ToggleSwitch");return(0,l.wg)(),(0,l.iD)("div",a,[(0,l._)("div",c,[(0,l._)("div",s,[(0,l.Wm)(g,{icon:t.value.meta?.icon||{},loading:t.loading,error:t.error},null,8,["icon","loading","error"])]),(0,l._)("div",r,[(0,l._)("div",{class:"name",textContent:(0,n.zw)(t.value.name)},null,8,d)]),(0,l._)("div",u,[(0,l.Wm)(f,{value:t.value.state,onInput:v.toggle,onClick:e[0]||(e[0]=(0,i.iM)((()=>{}),["stop"])),disabled:t.loading||t.value.is_read_only},null,8,["value","onInput","disabled"])])])])}var h=o(6),v=o(3499),g=o(7909),f={name:"Switch",components:{ToggleSwitch:h.Z,EntityIcon:v["default"]},mixins:[g["default"]],methods:{async toggle(t){t.stopPropagation(),this.$emit("loading",!0);try{await this.request("entities.execute",{id:this.value.id,action:"toggle"})}finally{this.$emit("loading",!1)}}}},y=o(3744);const m=(0,y.Z)(f,[["render",p],["__scopeId","data-v-7feeaa4b"]]);var w=m},3540:function(t,e,o){t.exports=o.p+"static/img/spinner.c0bee445.gif"}}]);
//# sourceMappingURL=518.89a856bf.js.map