"use strict";(self.webpackChunkhome_assistant_frontend=self.webpackChunkhome_assistant_frontend||[]).push([["81135"],{90322:function(e,t,a){a.a(e,async function(e,s){try{a.r(t),a.d(t,{ZHAAddGroupPage:function(){return f}});a(18111),a(61701),a(3362),a(62953);var i=a(40445),o=a(96196),n=a(77845),h=a(91926),d=a(18350),r=a(84621),p=a(81310),c=(a(20820),a(75709),a(10879)),l=e([d,p,c]);[d,p,c]=l.then?(await l)():l;let g,u,_=e=>e;class f extends o.WF{connectedCallback(){super.connectedCallback(),this.hass&&this._firstUpdatedCalled&&this._fetchData()}firstUpdated(e){super.firstUpdated(e),this.hass&&this._fetchData(),this._firstUpdatedCalled=!0}render(){return(0,o.qy)(g||(g=_` <hass-subpage .hass="${0}" .narrow="${0}" .header="${0}"> <ha-config-section .isWide="${0}"> <p slot="introduction"> ${0} </p> <ha-textfield type="string" .value="${0}" @change="${0}" .placeholder="${0}"></ha-textfield> <ha-textfield type="number" .value="${0}" @change="${0}" .placeholder="${0}"></ha-textfield> <div class="header"> ${0} </div> <zha-device-endpoint-data-table .hass="${0}" .deviceEndpoints="${0}" .narrow="${0}" selectable @selection-changed="${0}"> </zha-device-endpoint-data-table> <div class="buttons"> <ha-button .disabled="${0}" @click="${0}" class="button" .loading="${0}"> ${0}</ha-button> </div> </ha-config-section> </hass-subpage> `),this.hass,this.narrow,this.hass.localize("ui.panel.config.zha.groups.create_group"),!this.narrow,this.hass.localize("ui.panel.config.zha.groups.create_group_details"),this._groupName,this._handleNameChange,this.hass.localize("ui.panel.config.zha.groups.group_name_placeholder"),this._groupId,this._handleGroupIdChange,this.hass.localize("ui.panel.config.zha.groups.group_id_placeholder"),this.hass.localize("ui.panel.config.zha.groups.add_members"),this.hass,this.deviceEndpoints,this.narrow,this._handleAddSelectionChanged,!this._groupName||""===this._groupName||this._processingAdd,this._createGroup,this._processingAdd,this.hass.localize("ui.panel.config.zha.groups.create"))}async _fetchData(){this.deviceEndpoints=await(0,r.zt)(this.hass)}_handleAddSelectionChanged(e){this._selectedDevicesToAdd=e.detail.value}async _createGroup(){this._processingAdd=!0;const e=this._selectedDevicesToAdd.map(e=>{const t=e.split("_");return{ieee:t[0],endpoint_id:t[1]}}),t=this._groupId?parseInt(this._groupId,10):void 0,a=await(0,r.$)(this.hass,this._groupName,t,e);this._selectedDevicesToAdd=[],this._processingAdd=!1,this._groupName="",this._zhaDevicesDataTable.clearSelection(),(0,h.o)(`/config/zha/group/${a.group_id}`,{replace:!0})}_handleGroupIdChange(e){this._groupId=e.target.value}_handleNameChange(e){this._groupName=e.target.value||""}static get styles(){return[(0,o.AH)(u||(u=_`.header{font-family:var(--ha-font-family-body);-webkit-font-smoothing:var(--ha-font-smoothing);-moz-osx-font-smoothing:var(--ha-moz-osx-font-smoothing);font-size:var(--ha-font-size-4xl);font-weight:var(--ha-font-weight-normal);line-height:var(--ha-line-height-condensed);opacity:var(--dark-primary-opacity)}.button{float:right}ha-config-section :last-child{padding-bottom:24px}.buttons{align-items:flex-end;padding:16px}.buttons .warning{--mdc-theme-primary:var(--error-color)}`))]}constructor(...e){super(...e),this.narrow=!1,this.deviceEndpoints=[],this._processingAdd=!1,this._groupName="",this._firstUpdatedCalled=!1,this._selectedDevicesToAdd=[]}}(0,i.Cg)([(0,n.MZ)({attribute:!1})],f.prototype,"hass",void 0),(0,i.Cg)([(0,n.MZ)({type:Boolean})],f.prototype,"narrow",void 0),(0,i.Cg)([(0,n.MZ)({attribute:!1})],f.prototype,"deviceEndpoints",void 0),(0,i.Cg)([(0,n.wk)()],f.prototype,"_processingAdd",void 0),(0,i.Cg)([(0,n.wk)()],f.prototype,"_groupName",void 0),(0,i.Cg)([(0,n.wk)()],f.prototype,"_groupId",void 0),(0,i.Cg)([(0,n.P)("zha-device-endpoint-data-table",!0)],f.prototype,"_zhaDevicesDataTable",void 0),f=(0,i.Cg)([(0,n.EM)("zha-add-group-page")],f),s()}catch(g){s(g)}})}}]);
//# sourceMappingURL=81135.8a80fd0bf83c8026.js.map