export const __rspack_esm_id="81135";export const __rspack_esm_ids=["81135"];export const __webpack_modules__={90322(e,t,a){a.a(e,async function(e,s){try{a.r(t),a.d(t,{ZHAAddGroupPage:()=>c});a(18111),a(61701);var i=a(62826),o=a(96196),d=a(44457),h=a(91926),n=a(18350),r=a(84621),p=(a(81310),a(20820),a(75709),a(10879),e([n]));n=(p.then?(await p)():p)[0];class c 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 o.qy` <hass-subpage .hass="${this.hass}" .narrow="${this.narrow}" .header="${this.hass.localize("ui.panel.config.zha.groups.create_group")}"> <ha-config-section .isWide="${!this.narrow}"> <p slot="introduction"> ${this.hass.localize("ui.panel.config.zha.groups.create_group_details")} </p> <ha-textfield type="string" .value="${this._groupName}" @change="${this._handleNameChange}" .placeholder="${this.hass.localize("ui.panel.config.zha.groups.group_name_placeholder")}"></ha-textfield> <ha-textfield type="number" .value="${this._groupId}" @change="${this._handleGroupIdChange}" .placeholder="${this.hass.localize("ui.panel.config.zha.groups.group_id_placeholder")}"></ha-textfield> <div class="header"> ${this.hass.localize("ui.panel.config.zha.groups.add_members")} </div> <zha-device-endpoint-data-table .hass="${this.hass}" .deviceEndpoints="${this.deviceEndpoints}" .narrow="${this.narrow}" selectable @selection-changed="${this._handleAddSelectionChanged}"> </zha-device-endpoint-data-table> <div class="buttons"> <ha-button .disabled="${!this._groupName||""===this._groupName||this._processingAdd}" @click="${this._createGroup}" class="button" .loading="${this._processingAdd}"> ${this.hass.localize("ui.panel.config.zha.groups.create")}</ha-button> </div> </ha-config-section> </hass-subpage> `}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[o.AH`.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,d.MZ)({attribute:!1})],c.prototype,"hass",void 0),(0,i.Cg)([(0,d.MZ)({type:Boolean})],c.prototype,"narrow",void 0),(0,i.Cg)([(0,d.MZ)({attribute:!1,type:Array})],c.prototype,"deviceEndpoints",void 0),(0,i.Cg)([(0,d.wk)()],c.prototype,"_processingAdd",void 0),(0,i.Cg)([(0,d.wk)()],c.prototype,"_groupName",void 0),(0,i.Cg)([(0,d.wk)()],c.prototype,"_groupId",void 0),(0,i.Cg)([(0,d.P)("zha-device-endpoint-data-table",!0)],c.prototype,"_zhaDevicesDataTable",void 0),c=(0,i.Cg)([(0,d.EM)("zha-add-group-page")],c),s()}catch(e){s(e)}})}};
//# sourceMappingURL=81135.4655b5e23f78cf44.js.map