export const id=8185;export const ids=[8185,5287];export const modules={55287:(e,r,t)=>{t.r(r),t.d(r,{HaQrCode:()=>n});var a=t(36312),o=t(68689),i=(t(16891),t(50289)),s=t(29818),d=t(50240),c=(t(1082),t(68785));let n=(0,a.A)([(0,s.EM)("ha-qr-code")],(function(e,r){class t extends r{constructor(...r){super(...r),e(this)}}return{F:t,d:[{kind:"field",decorators:[(0,s.MZ)()],key:"data",value:void 0},{kind:"field",decorators:[(0,s.MZ)({attribute:"error-correction-level"})],key:"errorCorrectionLevel",value:()=>"medium"},{kind:"field",decorators:[(0,s.MZ)({type:Number})],key:"width",value:()=>4},{kind:"field",decorators:[(0,s.MZ)({type:Number})],key:"scale",value:()=>4},{kind:"field",decorators:[(0,s.MZ)({type:Number})],key:"margin",value:()=>4},{kind:"field",decorators:[(0,s.MZ)({type:Number})],key:"maskPattern",value:void 0},{kind:"field",decorators:[(0,s.MZ)({attribute:"center-image"})],key:"centerImage",value:void 0},{kind:"field",decorators:[(0,s.wk)()],key:"_error",value:void 0},{kind:"field",decorators:[(0,s.P)("canvas")],key:"_canvas",value:void 0},{kind:"method",key:"willUpdate",value:function(e){(0,o.A)(t,"willUpdate",this,3)([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)}},{kind:"method",key:"updated",value:function(e){const r=this._canvas;if(r&&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),t=e.getPropertyValue("--rgb-primary-text-color"),a=e.getPropertyValue("--rgb-card-background-color"),o=(0,c.v2)(t.split(",").map((e=>parseInt(e,10)))),i=(0,c.v2)(a.split(",").map((e=>parseInt(e,10))));if(d.toCanvas(r,this.data,{errorCorrectionLevel:this.errorCorrectionLevel||(this.centerImage?"Q":"M"),width:this.width,scale:this.scale,margin:this.margin,maskPattern:this.maskPattern,color:{light:i,dark:o}}).catch((e=>{this._error=e.message})),this.centerImage){const e=this._canvas.getContext("2d"),t=new Image;t.src=this.centerImage,t.onload=()=>{e?.drawImage(t,.375*r.width,.375*r.height,r.width/4,r.height/4)}}}}},{kind:"method",key:"render",value:function(){return this.data?this._error?i.qy`<ha-alert alert-type="error">${this._error}</ha-alert>`:i.qy`<canvas></canvas>`:i.s6}},{kind:"field",static:!0,key:"styles",value:()=>i.AH`:host{display:block}`}]}}),i.WF)},48185:(e,r,t)=>{t.r(r),t.d(r,{HaSelectorQRCode:()=>s});var a=t(36312),o=t(50289),i=t(29818);t(55287);let s=(0,a.A)([(0,i.EM)("ha-selector-qr_code")],(function(e,r){return{F:class extends r{constructor(...r){super(...r),e(this)}},d:[{kind:"field",decorators:[(0,i.MZ)({attribute:!1})],key:"selector",value:void 0},{kind:"method",key:"render",value:function(){return o.qy`<ha-qr-code .data="${this.selector.qr_code?.data}" .scale="${this.selector.qr_code?.scale}" .errorCorrectionLevel="${this.selector.qr_code?.error_correction_level}" .centerImage="${this.selector.qr_code?.center_image}"></ha-qr-code>`}},{kind:"field",static:!0,key:"styles",value:()=>o.AH`ha-qr-code{text-align:center}`}]}}),o.WF)}};
//# sourceMappingURL=8185.Ld2OhojW5kA.js.map