iobroker.lovelace
Version:
With this adapter you can build visualization for ioBroker with Home Assistant Lovelace UI
2 lines • 7.76 kB
JavaScript
export const __webpack_ids__=["47257"];export const __webpack_modules__={50634:function(r,e,t){t.r(e),t.d(e,{HaQrCode:()=>d});var n=t(44249),a=t(72621),i=(t(9359),t(70104),t(57243)),o=t(15093),s=t(54647),c=(t(99426),t(11259));let d=(0,n.Z)([(0,o.Mo)("ha-qr-code")],(function(r,e){class t extends e{constructor(...e){super(...e),r(this)}}return{F:t,d:[{kind:"field",decorators:[(0,o.Cb)()],key:"data",value:void 0},{kind:"field",decorators:[(0,o.Cb)({attribute:"error-correction-level"})],key:"errorCorrectionLevel",value:()=>"medium"},{kind:"field",decorators:[(0,o.Cb)({type:Number})],key:"width",value:()=>4},{kind:"field",decorators:[(0,o.Cb)({type:Number})],key:"scale",value:()=>4},{kind:"field",decorators:[(0,o.Cb)({type:Number})],key:"margin",value:()=>4},{kind:"field",decorators:[(0,o.Cb)({attribute:!1,type:Number})],key:"maskPattern",value:void 0},{kind:"field",decorators:[(0,o.Cb)({attribute:"center-image"})],key:"centerImage",value:void 0},{kind:"field",decorators:[(0,o.SB)()],key:"_error",value:void 0},{kind:"field",decorators:[(0,o.IO)("canvas")],key:"_canvas",value:void 0},{kind:"method",key:"willUpdate",value:function(r){(0,a.Z)(t,"willUpdate",this,3)([r]),(r.has("data")||r.has("scale")||r.has("width")||r.has("margin")||r.has("maskPattern")||r.has("errorCorrectionLevel"))&&this._error&&(this._error=void 0)}},{kind:"method",key:"updated",value:function(r){const e=this._canvas;if(e&&this.data&&(r.has("data")||r.has("scale")||r.has("width")||r.has("margin")||r.has("maskPattern")||r.has("errorCorrectionLevel")||r.has("centerImage"))){const r=getComputedStyle(this),t=r.getPropertyValue("--rgb-primary-text-color"),n=r.getPropertyValue("--rgb-card-background-color"),a=(0,c.CO)(t.split(",").map((r=>parseInt(r,10)))),i=(0,c.CO)(n.split(",").map((r=>parseInt(r,10))));if(s.toCanvas(e,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:a}}).catch((r=>{this._error=r.message})),this.centerImage){const r=this._canvas.getContext("2d"),t=new Image;t.src=this.centerImage,t.onload=()=>{r?.drawImage(t,.375*e.width,.375*e.height,e.width/4,e.height/4)}}}}},{kind:"method",key:"render",value:function(){return this.data?this._error?i.dy`<ha-alert alert-type="error">${this._error}</ha-alert>`:i.dy`<canvas></canvas>`:i.Ld}},{kind:"field",static:!0,key:"styles",value:()=>i.iv`:host{display:block}`}]}}),i.oi)},23534:function(r,e,t){t.r(e),t.d(e,{HaSelectorQRCode:()=>o});var n=t(44249),a=t(57243),i=t(15093);t(50634);let o=(0,n.Z)([(0,i.Mo)("ha-selector-qr_code")],(function(r,e){return{F:class extends e{constructor(...e){super(...e),r(this)}},d:[{kind:"field",decorators:[(0,i.Cb)({attribute:!1})],key:"selector",value:void 0},{kind:"method",key:"render",value:function(){return a.dy`<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:()=>a.iv`ha-qr-code{text-align:center}`}]}}),a.oi)},78344:function(r){var e=TypeError;r.exports=function(r){if("string"==typeof r)return r;throw new e("Argument is not a string")}},87265:function(r,e,t){var n=t(61896),a=String,i=TypeError;r.exports=function(r){if(void 0===r||n(r))return r;throw new i(a(r)+" is not an object or undefined")}},87038:function(r,e,t){var n=t(59069),a=TypeError;r.exports=function(r){if("Uint8Array"===n(r))return r;throw new a("Argument is not an Uint8Array")}},17743:function(r,e,t){var n=t(13053);r.exports=function(r,e,t){for(var a=0,i=arguments.length>2?t:n(e),o=new r(i);i>a;)o[a]=e[a++];return o}},15419:function(r){var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",t=e+"+/",n=e+"-_",a=function(r){for(var e={},t=0;t<64;t++)e[r.charAt(t)]=t;return e};r.exports={i2c:t,c2i:a(t),i2cUrl:n,c2iUrl:a(n)}},93474:function(r){var e=TypeError;r.exports=function(r){var t=r&&r.alphabet;if(void 0===t||"base64"===t||"base64url"===t)return t||"base64";throw new e("Incorrect `alphabet` option")}},47057:function(r,e,t){var n=t(1569),a=t(72878),i=t(87265),o=t(78344),s=t(39129),c=t(15419),d=t(93474),h=t(38511),l=c.c2i,u=c.c2iUrl,f=n.SyntaxError,v=n.TypeError,g=a("".charAt),p=function(r,e){for(var t=r.length;e<t;e++){var n=g(r,e);if(" "!==n&&"\t"!==n&&"\n"!==n&&"\f"!==n&&"\r"!==n)break}return e},y=function(r,e,t){var n=r.length;n<4&&(r+=2===n?"AA":"A");var a=(e[g(r,0)]<<18)+(e[g(r,1)]<<12)+(e[g(r,2)]<<6)+e[g(r,3)],i=[a>>16&255,a>>8&255,255&a];if(2===n){if(t&&0!==i[1])throw new f("Extra bits");return[i[0]]}if(3===n){if(t&&0!==i[2])throw new f("Extra bits");return[i[0],i[1]]}return i},k=function(r,e,t){for(var n=e.length,a=0;a<n;a++)r[t+a]=e[a];return t+n};r.exports=function(r,e,t,n){o(r),i(e);var a="base64"===d(e)?l:u,c=e?e.lastChunkHandling:void 0;if(void 0===c&&(c="loose"),"loose"!==c&&"strict"!==c&&"stop-before-partial"!==c)throw new v("Incorrect `lastChunkHandling` option");t&&h(t.buffer);var b=t||[],w=0,m=0,_="",x=0;if(n)for(;;){if((x=p(r,x))===r.length){if(_.length>0){if("stop-before-partial"===c)break;if("loose"!==c)throw new f("Missing padding");if(1===_.length)throw new f("Malformed padding: exactly one additional character");w=k(b,y(_,a,!1),w)}m=r.length;break}var C=g(r,x);if(++x,"="===C){if(_.length<2)throw new f("Padding is too early");if(x=p(r,x),2===_.length){if(x===r.length){if("stop-before-partial"===c)break;throw new f("Malformed padding: only one =")}"="===g(r,x)&&(++x,x=p(r,x))}if(x<r.length)throw new f("Unexpected character after padding");w=k(b,y(_,a,"strict"===c),w),m=r.length;break}if(!s(a,C))throw new f("Unexpected character");var A=n-w;if(1===A&&2===_.length||2===A&&3===_.length)break;if(4===(_+=C).length&&(w=k(b,y(_,a,!1),w),_="",m=x,w===n))break}return{bytes:b,read:m,written:w}}},35303:function(r,e,t){var n=t(1569),a=t(72878),i=n.Uint8Array,o=n.SyntaxError,s=n.parseInt,c=Math.min,d=/[^\da-f]/i,h=a(d.exec),l=a("".slice);r.exports=function(r,e){var t=r.length;if(t%2!=0)throw new o("String should be an even number of characters");for(var n=e?c(e.length,t/2):t/2,a=e||new i(n),u=0,f=0;f<n;){var v=l(r,u,u+=2);if(h(d,v))throw new o("String should only contain hex characters");a[f++]=s(v,16)}return{bytes:a,read:u}}},21917:function(r,e,t){var n=t(40810),a=t(1569),i=t(47057),o=t(87038);a.Uint8Array&&n({target:"Uint8Array",proto:!0},{setFromBase64:function(r){o(this);var e=i(r,arguments.length>1?arguments[1]:void 0,this,this.length);return{read:e.read,written:e.written}}})},56193:function(r,e,t){var n=t(40810),a=t(1569),i=t(78344),o=t(87038),s=t(38511),c=t(35303);a.Uint8Array&&n({target:"Uint8Array",proto:!0},{setFromHex:function(r){o(this),i(r),s(this.buffer);var e=c(r,this).read;return{read:e,written:e/2}}})},25020:function(r,e,t){var n=t(40810),a=t(1569),i=t(72878),o=t(87265),s=t(87038),c=t(38511),d=t(15419),h=t(93474),l=d.i2c,u=d.i2cUrl,f=i("".charAt);a.Uint8Array&&n({target:"Uint8Array",proto:!0},{toBase64:function(){var r=s(this),e=arguments.length?o(arguments[0]):void 0,t="base64"===h(e)?l:u,n=!!e&&!!e.omitPadding;c(this.buffer);for(var a,i="",d=0,v=r.length,g=function(r){return f(t,a>>6*r&63)};d+2<v;d+=3)a=(r[d]<<16)+(r[d+1]<<8)+r[d+2],i+=g(3)+g(2)+g(1)+g(0);return d+2===v?(a=(r[d]<<16)+(r[d+1]<<8),i+=g(3)+g(2)+g(1)+(n?"":"=")):d+1===v&&(a=r[d]<<16,i+=g(3)+g(2)+(n?"":"==")),i}})},86913:function(r,e,t){var n=t(40810),a=t(1569),i=t(72878),o=t(87038),s=t(38511),c=i(1..toString);a.Uint8Array&&n({target:"Uint8Array",proto:!0},{toHex:function(){o(this),s(this.buffer);for(var r="",e=0,t=this.length;e<t;e++){var n=c(this[e],16);r+=1===n.length?"0"+n:n}return r}})}};
//# sourceMappingURL=47257.43a14b044dfb965e.js.map