"use strict";(self["webpackChunkplatypush"]=self["webpackChunkplatypush"]||[]).push([[9461],{8140:function(e,a,l){l.d(a,{Z:function(){return w}});var t=l(6252),n=l(3577),s=l(9963);const i={class:"slider-wrapper"},u=["textContent"],r=["textContent"],o={class:"slider-container"},d=["min","max","step","disabled","value"],p=["textContent"];function c(e,a,l,c,v,g){return(0,t.wg)(),(0,t.iD)("label",i,[l.withRange?((0,t.wg)(),(0,t.iD)("span",{key:0,class:(0,n.C_)(["range-labels",{"with-label":l.withLabel}])},[l.withRange?((0,t.wg)(),(0,t.iD)("span",{key:0,class:"label left",textContent:(0,n.zw)(l.range[0])},null,8,u)):(0,t.kq)("",!0),l.withRange?((0,t.wg)(),(0,t.iD)("span",{key:1,class:"label right",textContent:(0,n.zw)(l.range[1])},null,8,r)):(0,t.kq)("",!0)],2)):(0,t.kq)("",!0),(0,t._)("span",o,[(0,t._)("input",{class:(0,n.C_)(["slider",{"with-label":l.withLabel}]),type:"range",min:l.range[0],max:l.range[1],step:l.step,disabled:l.disabled,value:l.value,ref:"range",onInput:a[0]||(a[0]=(0,s.iM)((a=>e.$emit("input",a)),["stop"])),onChange:a[1]||(a[1]=(0,s.iM)((a=>e.$emit("change",a)),["stop"]))},null,42,d),l.withLabel?((0,t.wg)(),(0,t.iD)("span",{key:0,class:"label",textContent:(0,n.zw)(l.value),ref:"label"},null,8,p)):(0,t.kq)("",!0)])])}var v={emits:["input","change"],props:{value:{type:Number},disabled:{type:Boolean,default:!1},range:{type:Array,default:()=>[0,100]},step:{type:Number,default:1},withLabel:{type:Boolean,default:!1},withRange:{type:Boolean,default:!1}}},g=l(3744);const h=(0,g.Z)(v,[["render",c],["__scopeId","data-v-d90e850c"]]);var w=h},9461:function(e,a,l){l.r(a),l.d(a,{default:function(){return q}});var t=l(6252),n=l(3577),s=l(9963);const i={class:"entity dimmer-container"},u={class:"icon"},r={class:"label"},o=["textContent"],d={class:"value-container pull-right"},p=["textContent"],c={class:"row"},v={key:0,class:"input"},g={class:"col-10"},h={class:"col-2 value"},w=["value"],m={key:1,class:"input"},y={class:"col-12 value"},f=["value"];function b(e,a,l,b,_,C){const k=(0,t.up)("EntityIcon"),x=(0,t.up)("Slider");return(0,t.wg)(),(0,t.iD)("div",i,[(0,t._)("div",{class:(0,n.C_)(["head",{collapsed:e.collapsed}])},[(0,t._)("div",u,[(0,t.Wm)(k,{entity:e.value,loading:e.loading,error:e.error},null,8,["entity","loading","error"])]),(0,t._)("div",r,[(0,t._)("div",{class:"name",textContent:(0,n.zw)(e.value.name)},null,8,o)]),(0,t._)("div",d,[null!=C.parsedValue?((0,t.wg)(),(0,t.iD)("span",{key:0,class:"value",textContent:(0,n.zw)(C.parsedValue)},null,8,p)):(0,t.kq)("",!0),(0,t._)("button",{onClick:a[0]||(a[0]=(0,s.iM)((a=>e.collapsed=!e.collapsed),["stop"]))},[(0,t._)("i",{class:(0,n.C_)(["fas",{"fa-angle-up":!e.collapsed,"fa-angle-down":e.collapsed}])},null,2)])])],2),e.collapsed?(0,t.kq)("",!0):((0,t.wg)(),(0,t.iD)("div",{key:0,class:"body",onClick:a[3]||(a[3]=(0,s.iM)(((...e)=>C.prevent&&C.prevent(...e)),["stop"]))},[(0,t._)("div",c,[null!=e.value?.min&&null!=e.value?.max?((0,t.wg)(),(0,t.iD)("div",v,[(0,t._)("div",g,[(0,t.Wm)(x,{range:[e.value.min,e.value.max],"with-range":"",value:e.value.value,onChange:C.setValue},null,8,["range","value","onChange"])]),(0,t._)("div",h,[(0,t._)("input",{type:"number",value:e.value.value,onChange:a[1]||(a[1]=(...e)=>C.setValue&&C.setValue(...e))},null,40,w)])])):((0,t.wg)(),(0,t.iD)("div",m,[(0,t._)("div",y,[(0,t._)("input",{type:"number",value:e.value.value,onChange:a[2]||(a[2]=(...e)=>C.setValue&&C.setValue(...e))},null,40,f)])]))])]))])}var _=l(8140),C=l(847),k=l(4967),x={name:"Dimmer",components:{Slider:_.Z,EntityIcon:k["default"]},mixins:[C["default"]],computed:{parsedValue(){if(this.value?.is_write_only||null==this.value?.value)return null;let e=this.value.value;return this.value.unit&&(e=`${e} ${this.value.unit}`),e}},methods:{prevent(e){return e.stopPropagation(),!1},async setValue(e){if(e.target.value?.length){this.$emit("loading",!0);try{await this.request("entities.execute",{id:this.value.id,action:"set",value:+e.target.value})}finally{this.$emit("loading",!1)}}}}},D=l(3744);const V=(0,D.Z)(x,[["render",b],["__scopeId","data-v-05503f62"]]);var q=V}}]);
//# sourceMappingURL=9461.1b6014d3.js.map