"use strict";(self.webpackChunkhacs_frontend=self.webpackChunkhacs_frontend||[]).push([["2685"],{9643:function(e,r,t){t.r(r),t.d(r,{HaQrCode:function(){return v}});var a=t(73577),o=t(72621),i=(t(71695),t(23669),t(13334),t(47021),t(57243)),d=t(50778),n=t(54647),s=(t(17949),t(91635));let c,l,h,u=e=>e,v=(0,a.Z)([(0,d.Mo)("ha-qr-code")],(function(e,r){class t extends r{constructor(...r){super(...r),e(this)}}return{F:t,d:[{kind:"field",decorators:[(0,d.Cb)()],key:"data",value:void 0},{kind:"field",decorators:[(0,d.Cb)({attribute:"error-correction-level"})],key:"errorCorrectionLevel",value(){return"medium"}},{kind:"field",decorators:[(0,d.Cb)({type:Number})],key:"width",value(){return 4}},{kind:"field",decorators:[(0,d.Cb)({type:Number})],key:"scale",value(){return 4}},{kind:"field",decorators:[(0,d.Cb)({type:Number})],key:"margin",value(){return 4}},{kind:"field",decorators:[(0,d.Cb)({attribute:!1,type:Number})],key:"maskPattern",value:void 0},{kind:"field",decorators:[(0,d.Cb)({attribute:"center-image"})],key:"centerImage",value:void 0},{kind:"field",decorators:[(0,d.SB)()],key:"_error",value:void 0},{kind:"field",decorators:[(0,d.IO)("canvas")],key:"_canvas",value:void 0},{kind:"method",key:"willUpdate",value:function(e){(0,o.Z)(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,s.CO)(t.split(",").map((e=>parseInt(e,10)))),i=(0,s.CO)(a.split(",").map((e=>parseInt(e,10))));if(n.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=()=>{null==e||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?(0,i.dy)(c||(c=u`<ha-alert alert-type="error">${0}</ha-alert>`),this._error):(0,i.dy)(l||(l=u`<canvas></canvas>`)):i.Ld}},{kind:"field",static:!0,key:"styles",value(){return(0,i.iv)(h||(h=u`:host{display:block}`))}}]}}),i.oi)},34043:function(e,r,t){t.r(r),t.d(r,{HaSelectorQRCode:function(){return c}});var a=t(73577),o=(t(71695),t(47021),t(57243)),i=t(50778);t(9643);let d,n,s=e=>e,c=(0,a.Z)([(0,i.Mo)("ha-selector-qr_code")],(function(e,r){return{F:class extends r{constructor(...r){super(...r),e(this)}},d:[{kind:"field",decorators:[(0,i.Cb)({attribute:!1})],key:"selector",value:void 0},{kind:"method",key:"render",value:function(){var e,r,t,a;return(0,o.dy)(d||(d=s`<ha-qr-code .data="${0}" .scale="${0}" .errorCorrectionLevel="${0}" .centerImage="${0}"></ha-qr-code>`),null===(e=this.selector.qr_code)||void 0===e?void 0:e.data,null===(r=this.selector.qr_code)||void 0===r?void 0:r.scale,null===(t=this.selector.qr_code)||void 0===t?void 0:t.error_correction_level,null===(a=this.selector.qr_code)||void 0===a?void 0:a.center_image)}},{kind:"field",static:!0,key:"styles",value(){return(0,o.iv)(n||(n=s`ha-qr-code{text-align:center}`))}}]}}),o.oi)}}]);
//# sourceMappingURL=2685.02559ac4065d147d.js.map