"use strict";(self.webpackChunkhome_assistant_frontend=self.webpackChunkhome_assistant_frontend||[]).push([["71523"],{12284:function(t,e,s){s.d(e,{BJ:function(){return r},KY:function(){return i},MG:function(){return a},d_:function(){return h},m4:function(){return n}});const i=(t,e,s)=>t.callService(e.split(".",1)[0],"set_value",{value:s,entity_id:e}),a=t=>t.callWS({type:"input_text/list"}),n=(t,e)=>t.callWS(Object.assign({type:"input_text/create"},e)),r=(t,e,s)=>t.callWS(Object.assign({type:"input_text/update",input_text_id:e},s)),h=(t,e)=>t.callWS({type:"input_text/delete",input_text_id:e})},57198:function(t,e,s){s.a(t,async function(t,i){try{s.r(e);var a=s(69235),n=(s(16280),s(3362),s(40445)),r=s(96196),h=s(77845),d=s(9899),u=s(70759),l=(s(75709),s(22675)),c=s(12284),o=s(784),b=s(79757),_=s(85979),p=t([a,u,b,_]);[a,u,b,_]=p.then?(await p)():p;let f,m,g,y,x,v=t=>t;class C extends r.WF{setConfig(t){if(!t)throw new Error("Invalid configuration");this._config=t}connectedCallback(){super.connectedCallback(),this._updated&&!this._loaded&&this._initialLoad(),this._attachObserver()}disconnectedCallback(){var t;super.disconnectedCallback(),null===(t=this._resizeObserver)||void 0===t||t.disconnect()}firstUpdated(){this._updated=!0,this.isConnected&&!this._loaded&&this._initialLoad(),this._attachObserver()}shouldUpdate(t){return(0,o.LX)(this,t)}render(){if(!this._config||!this.hass)return r.s6;const t=this.hass.states[this._config.entity];return t?(0,r.qy)(m||(m=v` <hui-generic-entity-row .hass="${0}" .config="${0}"> ${0} </hui-generic-entity-row> `),this.hass,this._config,"slider"===t.attributes.mode||"auto"===t.attributes.mode&&(Number(t.attributes.max)-Number(t.attributes.min))/Number(t.attributes.step)<=256?(0,r.qy)(g||(g=v` <div class="flex"> <ha-slider labeled .disabled="${0}" .step="${0}" .min="${0}" .max="${0}" .value="${0}" @change="${0}"></ha-slider> <span class="state"> ${0} </span> </div> `),t.state===l.Hh,Number(t.attributes.step),Number(t.attributes.min),Number(t.attributes.max),Number(t.state),this._selectedValueChanged,this.hass.formatEntityState(t)):(0,r.qy)(y||(y=v` <div class="flex state"> <ha-textfield autoValidate .disabled="${0}" pattern="[0-9]+([\\.][0-9]+)?" .step="${0}" .min="${0}" .max="${0}" .value="${0}" .suffix="${0}" type="number" @change="${0}"></ha-textfield> </div> `),t.state===l.Hh,Number(t.attributes.step),Number(t.attributes.min),Number(t.attributes.max),t.state,t.attributes.unit_of_measurement,this._selectedValueChanged)):(0,r.qy)(f||(f=v` <hui-warning .hass="${0}"> ${0} </hui-warning> `),this.hass,(0,_.j)(this.hass,this._config.entity))}async _initialLoad(){this._loaded=!0,await this.updateComplete,this._measureCard()}_measureCard(){if(!this.isConnected)return;const t=this.shadowRoot.querySelector(".state");t&&(t.hidden=this.clientWidth<=300)}async _attachObserver(){this._resizeObserver||(this._resizeObserver=new ResizeObserver((0,d.s)(()=>this._measureCard(),250,!1))),this.isConnected&&this._resizeObserver.observe(this)}_selectedValueChanged(t){const e=this.hass.states[this._config.entity];t.target.value!==e.state&&(0,c.KY)(this.hass,e.entity_id,t.target.value)}}C.styles=(0,r.AH)(x||(x=v`:host{display:block}.flex{display:flex;align-items:center;justify-content:flex-end;flex-grow:2}.state{min-width:45px;text-align:end}ha-textfield{text-align:end;direction:ltr!important}ha-slider{width:100%;max-width:200px}`)),(0,n.Cg)([(0,h.MZ)({attribute:!1})],C.prototype,"hass",void 0),(0,n.Cg)([(0,h.wk)()],C.prototype,"_config",void 0),C=(0,n.Cg)([(0,h.EM)("hui-number-entity-row")],C),i()}catch(f){i(f)}})}}]);
//# sourceMappingURL=71523.de30a05f716e82da.js.map