export const id=5287;export const ids=[5287];export const modules={55287:(e,t,r)=>{r.r(t),r.d(t,{HaQrCode:()=>l});var a=r(36312),i=r(68689),o=(r(16891),r(50289)),s=r(29818),d=r(50240),n=(r(1082),r(68785));let l=(0,a.A)([(0,s.EM)("ha-qr-code")],(function(e,t){class r extends t{constructor(...t){super(...t),e(this)}}return{F:r,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,i.A)(r,"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 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"),i=(0,n.v2)(r.split(",").map((e=>parseInt(e,10)))),o=(0,n.v2)(a.split(",").map((e=>parseInt(e,10))));if(d.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:o,dark:i}}).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)}}}}},{kind:"method",key:"render",value:function(){return this.data?this._error?o.qy`<ha-alert alert-type="error">${this._error}</ha-alert>`:o.qy`<canvas></canvas>`:o.s6}},{kind:"field",static:!0,key:"styles",value:()=>o.AH`:host{display:block}`}]}}),o.WF)}};
//# sourceMappingURL=5287.RxdhMwWTRus.js.map