export const __webpack_id__="706";export const __webpack_ids__=["706"];export const __webpack_modules__={69273:function(e,t,r){r.r(t),r.d(t,{HaQrCode:()=>d});r(65315),r(37089);var a=r(69868),o=r(84922),s=r(11991),i=r(11936),c=(r(94124),r(83510));class d extends o.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),r=e.getPropertyValue("--rgb-primary-text-color"),a=e.getPropertyValue("--rgb-card-background-color"),o=(0,c.v2)(r.split(",").map(e=>parseInt(e,10))),s=(0,c.v2)(a.split(",").map(e=>parseInt(e,10)));if(i.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:o}}).catch(e=>{this._error=e.message}),this.centerImage){const e=this._canvas.getContext("2d"),r=new Image;r.src=this.centerImage,r.onload=()=>{e?.drawImage(r,.375*t.width,.375*t.height,t.width/4,t.height/4)}}}}render(){return this.data?this._error?o.qy`<ha-alert alert-type="error">${this._error}</ha-alert>`:o.qy`<canvas></canvas>`:o.s6}constructor(...e){super(...e),this.errorCorrectionLevel="medium",this.width=4,this.scale=4,this.margin=4}}d.styles=o.AH`:host{display:block}`,(0,a.__decorate)([(0,s.MZ)()],d.prototype,"data",void 0),(0,a.__decorate)([(0,s.MZ)({attribute:"error-correction-level"})],d.prototype,"errorCorrectionLevel",void 0),(0,a.__decorate)([(0,s.MZ)({type:Number})],d.prototype,"width",void 0),(0,a.__decorate)([(0,s.MZ)({type:Number})],d.prototype,"scale",void 0),(0,a.__decorate)([(0,s.MZ)({type:Number})],d.prototype,"margin",void 0),(0,a.__decorate)([(0,s.MZ)({attribute:!1,type:Number})],d.prototype,"maskPattern",void 0),(0,a.__decorate)([(0,s.MZ)({attribute:"center-image"})],d.prototype,"centerImage",void 0),(0,a.__decorate)([(0,s.wk)()],d.prototype,"_error",void 0),(0,a.__decorate)([(0,s.P)("canvas")],d.prototype,"_canvas",void 0),d=(0,a.__decorate)([(0,s.EM)("ha-qr-code")],d)}};
//# sourceMappingURL=706.2eb53172e0356f79.js.map