export const id=8353;export const ids=[8353,3599];export const modules={3599:(e,r,t)=>{t.r(r),t.d(r,{HaQrCode:()=>c});var a=t(5461),o=t(9534),i=t(8597),s=t(196),d=t(8345),n=(t(1074),t(6709));let c=(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(){return"medium"}},{kind:"field",decorators:[(0,s.MZ)({type:Number})],key:"width",value(){return 4}},{kind:"field",decorators:[(0,s.MZ)({type:Number})],key:"scale",value(){return 4}},{kind:"field",decorators:[(0,s.MZ)({type:Number})],key:"margin",value(){return 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,n.v2)(t.split(",").map((e=>parseInt(e,10)))),i=(0,n.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(){return i.AH`
    :host {
      display: block;
    }
  `}}]}}),i.WF)},8353:(e,r,t)=>{t.r(r),t.d(r,{HaSelectorQRCode:()=>s});var a=t(5461),o=t(8597),i=t(196);t(3599);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(){return o.AH`
    ha-qr-code {
      text-align: center;
    }
  `}}]}}),o.WF)}};
//# sourceMappingURL=Ah5nhTUq.js.map