export const __rspack_esm_id="33425";export const __rspack_esm_ids=["33425"];export const __webpack_modules__={60543(e,t,i){i.r(t),i.d(t,{HaQrCode:()=>n});i(18111),i(61701);var a=i(62826),r=i(96196),s=i(44457),o=i(81298),c=(i(38962),i(79468));class n extends r.WF{willUpdate(e){super.willUpdate(e),(e.has("data")||e.has("scale")||e.has("width")||e.has("margin")||e.has("maskPattern")||e.has("errorCorrectionLevel"))&&this._error&&(this._error=void 0)}updated(e){const t=this._canvas;if(t&&this.data&&(e.has("data")||e.has("scale")||e.has("width")||e.has("margin")||e.has("maskPattern")||e.has("errorCorrectionLevel")||e.has("centerImage"))){const e=getComputedStyle(this),i=e.getPropertyValue("--rgb-primary-text-color"),a=e.getPropertyValue("--rgb-card-background-color"),r=(0,c.v2)(i.split(",").map(e=>parseInt(e,10))),s=(0,c.v2)(a.split(",").map(e=>parseInt(e,10)));if(o.toCanvas(t,this.data,{errorCorrectionLevel:this.errorCorrectionLevel||(this.centerImage?"Q":"M"),width:this.width,scale:this.scale,margin:this.margin,maskPattern:this.maskPattern,color:{light:s,dark:r}}).catch(e=>{this._error=e.message}),this.centerImage){const e=this._canvas.getContext("2d"),i=new Image;i.src=this.centerImage,i.onload=()=>{e?.drawImage(i,.375*t.width,.375*t.height,t.width/4,t.height/4)}}}}render(){return this.data?this._error?r.qy`<ha-alert alert-type="error">${this._error}</ha-alert>`:r.qy`<canvas></canvas>`:r.s6}constructor(...e){super(...e),this.errorCorrectionLevel="medium",this.width=4,this.scale=4,this.margin=4}}n.styles=r.AH`:host{display:block}`,(0,a.Cg)([(0,s.MZ)()],n.prototype,"data",void 0),(0,a.Cg)([(0,s.MZ)({attribute:"error-correction-level"})],n.prototype,"errorCorrectionLevel",void 0),(0,a.Cg)([(0,s.MZ)({type:Number})],n.prototype,"width",void 0),(0,a.Cg)([(0,s.MZ)({type:Number})],n.prototype,"scale",void 0),(0,a.Cg)([(0,s.MZ)({type:Number})],n.prototype,"margin",void 0),(0,a.Cg)([(0,s.MZ)({attribute:!1,type:Number})],n.prototype,"maskPattern",void 0),(0,a.Cg)([(0,s.MZ)({attribute:"center-image"})],n.prototype,"centerImage",void 0),(0,a.Cg)([(0,s.wk)()],n.prototype,"_error",void 0),(0,a.Cg)([(0,s.P)("canvas")],n.prototype,"_canvas",void 0),n=(0,a.Cg)([(0,s.EM)("ha-qr-code")],n)},21288(e,t,i){i.a(e,async function(e,a){try{i.r(t);i(18111),i(61701);var r=i(62826),s=i(96196),o=i(44457),c=i(1087),n=i(72554),d=(i(8630),i(28732),i(60543),i(65829)),h=i(20559),l=i(65063),g=i(14503),_=e([d]);d=(_.then?(await _)():_)[0];const p="M19,4H15.5L14.5,3H9.5L8.5,4H5V6H19M6,19A2,2 0 0,0 8,21H16A2,2 0 0,0 18,19V7H6V19Z";class m extends s.WF{async showDialog(e){this.device_id=e.device_id,this._fetchNodeDetails()}render(){return this.device_id?s.qy` <ha-dialog open hideActions @closed="${this.closeDialog}" .heading="${(0,n.l)(this.hass,this.hass.localize("ui.panel.config.matter.manage_fabrics.title"))}"> <p> ${this.hass.localize("ui.panel.config.matter.manage_fabrics.fabrics")} </p> ${this._nodeDiagnostics?s.qy`<ha-list> ${this._nodeDiagnostics.active_fabrics.map(e=>s.qy`<ha-list-item noninteractive .hasMeta="${this._nodeDiagnostics.available&&e.fabric_index!==this._nodeDiagnostics.active_fabric_index}">${e.vendor_name||e.fabric_label||e.vendor_id} <ha-icon-button @click="${this._removeFabric}" slot="meta" .fabric="${e}" .path="${p}"></ha-icon-button> </ha-list-item>`)} </ha-list>`:s.qy`<div class="center"> <ha-spinner></ha-spinner> </div>`} </ha-dialog> `:s.s6}async _fetchNodeDetails(){if(this.device_id)try{this._nodeDiagnostics=await(0,h.eB)(this.hass,this.device_id)}catch(e){this._nodeDiagnostics=void 0}}async _removeFabric(e){const t=e.target.fabric;if(this._nodeDiagnostics.active_fabric_index===t.fabric_index)return;const i=t.vendor_name||t.fabric_label||t.vendor_id.toString();if(await(0,l.dk)(this,{title:this.hass.localize("ui.panel.config.matter.manage_fabrics.remove_fabric_confirm_header",{fabric:i}),text:this.hass.localize("ui.panel.config.matter.manage_fabrics.remove_fabric_confirm_text",{fabric:i}),warning:!0}))try{await(0,h.vX)(this.hass,this.device_id,t.fabric_index),this._fetchNodeDetails()}catch(e){(0,l.showAlertDialog)(this,{title:this.hass.localize("ui.panel.config.matter.manage_fabrics.remove_fabric_failed_header",{fabric:i}),text:this.hass.localize("ui.panel.config.matter.manage_fabrics.remove_fabric_failed_text")})}}closeDialog(){this.device_id=void 0,this._nodeDiagnostics=void 0,(0,c.r)(this,"dialog-closed",{dialog:this.localName})}static get styles(){return[g.nA,s.AH`ha-dialog{--dialog-content-padding:0;--mdc-list-side-padding:24px;--mdc-list-side-padding-right:16px;--mdc-list-item-meta-size:48px}p{margin:8px 24px}.center{display:flex;align-items:center;justify-content:center}`]}}(0,r.Cg)([(0,o.MZ)({attribute:!1})],m.prototype,"hass",void 0),(0,r.Cg)([(0,o.wk)()],m.prototype,"device_id",void 0),(0,r.Cg)([(0,o.wk)()],m.prototype,"_nodeDiagnostics",void 0),m=(0,r.Cg)([(0,o.EM)("dialog-matter-manage-fabrics")],m),a()}catch(e){a(e)}})}};
//# sourceMappingURL=33425.c65845c10a72df5c.js.map