analogger 1.30.2 → 1.30.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -311,8 +311,8 @@ function getHtmlToImage() {
311
311
  * SOFTWARE.
312
312
  */
313
313
  const code = [];
314
- code.push(`!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).htmlToImage={})}(this,(function(t){"use strict";function e(t,e,n,r){return new(n||(n=Promise))((function(i,o){function u(t){try{a(r.next(t))}catch(t){o(t)}}function c(t){try{a(r.throw(t))}catch(t){o(t)}}function a(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(u,c)}a((r=r.apply(t,e||[])).next())}))}function n(t,e){var n,r,i,o,u={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function c(c){return function(a){return function(c){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,c[0]&&(u=0)),u;)try{if(n=1,r&&(i=2&c[0]?r.return:c[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,c[1])).done)return i;switch(r=0,i&&(c=[2&c[0],i.value]),c[0]){case 0:case 1:i=c;break;case 4:return u.label++,{value:c[1],done:!1};case 5:u.label++,r=c[1],c=[0];continue;case 7:c=u.ops.pop(),u.trys.pop();continue;default:if(!(i=u.trys,(i=i.length>0&&i[i.length-1])||6!==c[0]&&2!==c[0])){u=0;continue}if(3===c[0]&&(!i||c[1]>i[0]&&c[1]<i[3])){u.label=c[1];break}if(6===c[0]&&u.label<i[1]){u.label=i[1],i=c;break}if(i&&u.label<i[2]){u.label=i[2],u.ops.push(c);break}i[2]&&u.ops.pop(),u.trys.pop();continue}c=e.call(t,u)}catch(t){c=[6,t],r=0}finally{n=i=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,a])}}}var r,i=(r=0,function(){return r+=1,"u".concat("0000".concat((Math.random()*Math.pow(36,4)<<0).toString(36)).slice(-4)).concat(r)});function o(t){for(var e=[],n=0,r=t.length;n<r;n++)e.push(t[n]);return e}var u=null;function c(t){return void 0===t&&(t={}),u||(u=t.includeStyleProperties?t.includeStyleProperties:o(window.getComputedStyle(document.documentElement)))}function a(t,e){var n=(t.ownerDocument.defaultView||window).getComputedStyle(t).getPropertyValue(e);return n?parseFloat(n.replace("px","")):0}function s(t,e){void 0===e&&(e={});var n,r,i,o=e.width||(r=a(n=t,"border-left-width"),i=a(n,"border-right-width"),n.clientWidth+r+i),u=e.height||function(t){var e=a(t,"border-top-width"),n=a(t,"border-bottom-width");return t.clientHeight+e+n}(t);return{width:o,height:u}}var l=16384;function f(t,e){return void 0===e&&(e={}),t.toBlob?new Promise((function(n){t.toBlob(n,e.type?e.type:"image/png",e.quality?e.quality:1)})):new Promise((function(n){for(var r=window.atob(t.toDataURL(e.type?e.type:void 0,e.quality?e.quality:void 0).split(",")[1]),i=r.length,o=new Uint8Array(i),u=0;u<i;u+=1)o[u]=r.charCodeAt(u);n(new Blob([o],{type:e.type?e.type:"image/png"}))}))}function h(t){return new Promise((function(e,n){var r=new Image;r.onload=function(){r.decode().then((function(){requestAnimationFrame((function(){return e(r)}))}))},r.onerror=n,r.crossOrigin="anonymous",r.decoding="async",r.src=t}))}function d(t){return e(this,void 0,void 0,(function(){return n(this,(function(e){return[2,Promise.resolve().then((function(){return(new XMLSerializer).serializeToString(t)})).then(encodeURIComponent).then((function(t){return"data:image/svg+xml;charset=utf-8,".concat(t)}))]}))}))}function v(t,r,i){return e(this,void 0,void 0,(function(){var e,o,u;return n(this,(function(n){return e="http://www.w3.org/2000/svg",o=document.createElementNS(e,"svg"),u=document.createElementNS(e,"foreignObject"),o.setAttribute("width","".concat(r)),o.setAttribute("height","".concat(i)),o.setAttribute("viewBox","0 0 ".concat(r," ").concat(i)),u.setAttribute("width","100%"),u.setAttribute("height","100%"),u.setAttribute("x","0"),u.setAttribute("y","0"),u.setAttribute("externalResourcesRequired","true"),o.appendChild(u),u.appendChild(t),[2,d(o)]}))}))}var p=function(t,e){if(t instanceof e)return!0;var n=Object.getPrototypeOf(t);return null!==n&&(n.constructor.name===e.name||p(n,e))};function g(t,e,n,r){var i=".".concat(t,":").concat(e),o=n.cssText?function(t){var e=t.getPropertyValue("content");return"".concat(t.cssText," content: '").concat(e.replace(/'|"/g,""),"';")}(n):function(t,e){return c(e).map((function(e){var n=t.getPropertyValue(e),r=t.getPropertyPriority(e);return"".concat(e,": ").concat(n).concat(r?" !important":"",";")})).join(" ")}(n,r);return document.createTextNode("".concat(i,"{").concat(o,"}"))}function m(t,e,n,r){var o=window.getComputedStyle(t,n),u=o.getPropertyValue("content");if(""!==u&&"none"!==u){var c=i();try{e.className="".concat(e.className," ").concat(c)}catch(t){return}var a=document.createElement("style");a.appendChild(g(c,n,o,r)),e.appendChild(a)}}var w="application/font-woff",y="image/jpeg",b={woff:w,woff2:w,ttf:"application/font-truetype",eot:"application/vnd.ms-fontobject",png:"image/png",jpg:y,jpeg:y,gif:"image/gif",tiff:"image/tiff",svg:"image/svg+xml",webp:"image/webp"};function S(t){var e=function(t){var e=/\\.([^./]*?)$/g.exec(t);return e?e[1]:""}(t).toLowerCase();return b[e]||""}function E(t){return-1!==t.search(/^(data:)/)}function x(t,e){return"data:".concat(e,";base64,").concat(t)}function C(t,r,i){return e(this,void 0,void 0,(function(){var e,o;return n(this,(function(n){switch(n.label){case 0:return[4,fetch(t,r)];case 1:if(404===(e=n.sent()).status)throw new Error('Resource "'.concat(e.url,'" not found'));return[4,e.blob()];case 2:return o=n.sent(),[2,new Promise((function(t,n){var r=new FileReader;r.onerror=n,r.onloadend=function(){try{t(i({res:e,result:r.result}))}catch(t){n(t)}},r.readAsDataURL(o)}))]}}))}))}var P={};function R(t,r,i){return e(this,void 0,void 0,(function(){var e,o,u,c,a;return n(this,(function(n){switch(n.label){case 0:if(e=function(t,e,n){var r=t.replace(/\\?.*/,"");return n&&(r=t),/ttf|otf|eot|woff2?/i.test(r)&&(r=r.replace(/.*\\//,"")),e?"[".concat(e,"]").concat(r):r}(t,r,i.includeQueryParams),null!=P[e])return[2,P[e]];i.cacheBust&&(t+=(/\\?/.test(t)?"&":"?")+(new Date).getTime()),n.label=1;case 1:return n.trys.push([1,3,,4]),[4,C(t,i.fetchRequestInit,(function(t){var e=t.res,n=t.result;return r||(r=e.headers.get("Content-Type")||""),function(t){return t.split(/,/)[1]}(n)}))];case 2:return u=n.sent(),o=x(u,r),[3,4];case 3:return c=n.sent(),o=i.imagePlaceholder||"",a="Failed to fetch resource: ".concat(t),c&&(a="string"==typeof c?c:c.message),a&&console.warn(a),[3,4];case 4:return P[e]=o,[2,o]}}))}))}function T(t){return e(this,void 0,void 0,(function(){var e;return n(this,(function(n){return"data:,"===(e=t.toDataURL())?[2,t.cloneNode(!1)]:[2,h(e)]}))}))}function A(t,r){return e(this,void 0,void 0,(function(){var e,i,o,u;return n(this,(function(n){switch(n.label){case 0:return t.currentSrc?(e=document.createElement("canvas"),i=e.getContext("2d"),e.width=t.clientWidth,e.height=t.clientHeight,null==i||i.drawImage(t,0,0,e.width,e.height),[2,h(e.toDataURL())]):(o=t.poster,u=S(o),[4,R(o,u,r)]);case 1:return[2,h(n.sent())]}}))}))}function k(t,r){var i;return e(this,void 0,void 0,(function(){return n(this,(function(e){switch(e.label){case 0:return e.trys.push([0,3,,4]),(null===(i=null==t?void 0:t.contentDocument)||void 0===i?void 0:i.body)?[4,I(t.contentDocument.body,r,!0)]:[3,2];case 1:return[2,e.sent()];case 2:return[3,4];case 3:return e.sent(),[3,4];case 4:return[2,t.cloneNode(!1)]}}))}))}var L=function(t){return null!=t.tagName&&"SVG"===t.tagName.toUpperCase()};function N(t,e,n){return p(e,Element)&&(function(t,e,n){var r=e.style;if(r){var i=window.getComputedStyle(t);i.cssText?(r.cssText=i.cssText,r.transformOrigin=i.transformOrigin):c(n).forEach((function(n){var o=i.getPropertyValue(n);if("font-size"===n&&o.endsWith("px")){var u=Math.floor(parseFloat(o.substring(0,o.length-2)))-.1;o="".concat(u,"px")}p(t,HTMLIFrameElement)&&"display"===n&&"inline"===o&&(o="block"),"d"===n&&e.getAttribute("d")&&(o="path(".concat(e.getAttribute("d"),")")),r.setProperty(n,o,i.getPropertyPriority(n))}))}}(t,e,n),function(t,e,n){m(t,e,":before",n),m(t,e,":after",n)}(t,e,n),function(t,e){p(t,HTMLTextAreaElement)&&(e.innerHTML=t.value),p(t,HTMLInputElement)&&e.setAttribute("value",t.value)}(t,e),function(t,e){if(p(t,HTMLSelectElement)){var n=e,r=Array.from(n.children).find((function(e){return t.value===e.getAttribute("value")}));r&&r.setAttribute("selected","")}}(t,e)),e}function I(t,r,i){return e(this,void 0,void 0,(function(){return n(this,(function(u){return i||!r.filter||r.filter(t)?[2,Promise.resolve(t).then((function(t){return function(t,r){return e(this,void 0,void 0,(function(){return n(this,(function(e){return p(t,HTMLCanvasElement)?[2,T(t)]:p(t,HTMLVideoElement)?[2,A(t,r)]:p(t,HTMLIFrameElement)?[2,k(t,r)]:[2,t.cloneNode(L(t))]}))}))}(t,r)})).then((function(i){return function(t,r,i){var u,c;return e(this,void 0,void 0,(function(){var e;return n(this,(function(n){switch(n.label){case 0:return L(r)?[2,r]:(e=[],0===(e=null!=(a=t).tagName&&"SLOT"===a.tagName.toUpperCase()&&t.assignedNodes?o(t.assignedNodes()):p(t,HTMLIFrameElement)&&(null===(u=t.contentDocument)||void 0===u?void 0:u.body)?o(t.contentDocument.body.childNodes):o((null!==(c=t.shadowRoot)&&void 0!==c?c:t).childNodes)).length||p(t,HTMLVideoElement)?[2,r]:[4,e.reduce((function(t,e){return t.then((function(){return I(e,i)})).then((function(t){t&&r.appendChild(t)}))}),Promise.resolve())]);case 1:return n.sent(),[2,r]}var a}))}))}(t,i,r)})).then((function(e){return N(t,e,r)})).then((function(t){return function(t,r){return e(this,void 0,void 0,(function(){var e,i,o,u,c,a,s,l,f,h,d,v,p;return n(this,(function(n){switch(n.label){case 0:if(0===(e=t.querySelectorAll?t.querySelectorAll("use"):[]).length)return[2,t];i={},p=0,n.label=1;case 1:return p<e.length?(o=e[p],(u=o.getAttribute("xlink:href"))?(c=t.querySelector(u),a=document.querySelector(u),c||!a||i[u]?[3,3]:(s=i,l=u,[4,I(a,r,!0)])):[3,3]):[3,4];case 2:s[l]=n.sent(),n.label=3;case 3:return p++,[3,1];case 4:if((f=Object.values(i)).length){for(h="http://www.w3.org/1999/xhtml",(d=document.createElementNS(h,"svg")).setAttribute("xmlns",h),d.style.position="absolute",d.style.width="0",d.style.height="0",d.style.overflow="hidden",d.style.display="none",v=document.createElementNS(h,"defs"),d.appendChild(v),p=0;p<f.length;p++)v.appendChild(f[p]);t.appendChild(d)}return[2,t]}}))}))}(t,r)}))]:[2,null]}))}))}var D=/url\\((['"]?)([^'"]+?)\\1\\)/g,H=/url\\([^)]+\\)\\s*format\\((["']?)([^"']+)\\1\\)/g,M=/src:\\s*(?:url\\([^)]+\\)\\s*format\\([^)]+\\)[,;]\\s*)+/g;function F(t,r,i,o,u){return e(this,void 0,void 0,(function(){var e,c,a,s;return n(this,(function(n){switch(n.label){case 0:return n.trys.push([0,5,,6]),e=i?function(t,e){if(t.match(/^[a-z]+:\\/\\//i))return t;if(t.match(/^\\/\\//))return window.location.protocol+t;if(t.match(/^[a-z]+:/i))return t;var n=document.implementation.createHTMLDocument(),r=n.createElement("base"),i=n.createElement("a");return n.head.appendChild(r),n.body.appendChild(i),e&&(r.href=e),i.href=t,i.href}(r,i):r,c=S(r),a=void 0,u?[4,u(e)]:[3,2];case 1:return s=n.sent(),a=x(s,c),[3,4];case 2:return[4,R(e,c,o)];case 3:a=n.sent(),n.label=4;case 4:return[2,t.replace((l=r,f=l.replace(/([.*+?^${`);
315
- code.push(`}()|\\[\\]\\/\\\\])/g,"\\\\$1"),new RegExp("(url\\\\(['\\"]?)(".concat(f,")(['\\"]?\\\\))"),"g")),"$1".concat(a,"$3"))];case 5:return n.sent(),[3,6];case 6:return[2,t]}var l,f}))}))}function V(t){return-1!==t.search(D)}function q(t,r,i){return e(this,void 0,void 0,(function(){var e,o;return n(this,(function(n){return V(t)?(e=function(t,e){var n=e.preferredFontFormat;return n?t.replace(M,(function(t){for(;;){var e=H.exec(t)||[],r=e[0],i=e[2];if(!i)return"";if(i===n)return"src: ".concat(r,";")}})):t}(t,i),o=function(t){var e=[];return t.replace(D,(function(t,n,r){return e.push(r),t})),e.filter((function(t){return!E(t)}))}(e),[2,o.reduce((function(t,e){return t.then((function(t){return F(t,e,r,i)}))}),Promise.resolve(e))]):[2,t]}))}))}function U(t,r,i){var o;return e(this,void 0,void 0,(function(){var e,u;return n(this,(function(n){switch(n.label){case 0:return(e=null===(o=r.style)||void 0===o?void 0:o.getPropertyValue(t))?[4,q(e,null,i)]:[3,2];case 1:return u=n.sent(),r.style.setProperty(t,u,r.style.getPropertyPriority(t)),[2,!0];case 2:return[2,!1]}}))}))}function j(t,r){return e(this,void 0,void 0,(function(){var e,i;return n(this,(function(n){switch(n.label){case 0:return[4,U("background",t,r)];case 1:return n.sent()?[3,3]:[4,U("background-image",t,r)];case 2:n.sent(),n.label=3;case 3:return[4,U("mask",t,r)];case 4:return(i=n.sent())?[3,6]:[4,U("-webkit-mask",t,r)];case 5:i=n.sent(),n.label=6;case 6:return(e=i)?[3,8]:[4,U("mask-image",t,r)];case 7:e=n.sent(),n.label=8;case 8:return e?[3,10]:[4,U("-webkit-mask-image",t,r)];case 9:n.sent(),n.label=10;case 10:return[2]}}))}))}function O(t,r){return e(this,void 0,void 0,(function(){var e,i,o;return n(this,(function(n){switch(n.label){case 0:return(e=p(t,HTMLImageElement))&&!E(t.src)||p(t,SVGImageElement)&&!E(t.href.baseVal)?[4,R(i=e?t.src:t.href.baseVal,S(i),r)]:[2];case 1:return o=n.sent(),[4,new Promise((function(n,i){t.onload=n,t.onerror=r.onImageErrorHandler?function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];try{n(r.onImageErrorHandler.apply(r,t))}catch(t){i(t)}}:i;var u=t;u.decode&&(u.decode=n),"lazy"===u.loading&&(u.loading="eager"),e?(t.srcset="",t.src=o):t.href.baseVal=o}))];case 2:return n.sent(),[2]}}))}))}function B(t,r){return e(this,void 0,void 0,(function(){var e,i;return n(this,(function(n){switch(n.label){case 0:return e=o(t.childNodes),i=e.map((function(t){return z(t,r)})),[4,Promise.all(i).then((function(){return t}))];case 1:return n.sent(),[2]}}))}))}function z(t,r){return e(this,void 0,void 0,(function(){return n(this,(function(e){switch(e.label){case 0:return p(t,Element)?[4,j(t,r)]:[3,4];case 1:return e.sent(),[4,O(t,r)];case 2:return e.sent(),[4,B(t,r)];case 3:e.sent(),e.label=4;case 4:return[2]}}))}))}var W={};function $(t){return e(this,void 0,void 0,(function(){var e,r;return n(this,(function(n){switch(n.label){case 0:return null!=(e=W[t])?[2,e]:[4,fetch(t)];case 1:return[4,n.sent().text()];case 2:return r=n.sent(),e={url:t,cssText:r},W[t]=e,[2,e]}}))}))}function G(t,r){return e(this,void 0,void 0,(function(){var i,o,u,c,a=this;return n(this,(function(s){return i=t.cssText,o=/url\\(["']?([^"')]+)["']?\\)/g,u=i.match(/url\\([^)]+\\)/g)||[],c=u.map((function(u){return e(a,void 0,void 0,(function(){var e;return n(this,(function(n){return(e=u.replace(o,"$1")).startsWith("https://")||(e=new URL(e,t.url).href),[2,C(e,r.fetchRequestInit,(function(t){var e=t.result;return i=i.replace(u,"url(".concat(e,")")),[u,e]}))]}))}))})),[2,Promise.all(c).then((function(){return i}))]}))}))}function _(t){if(null==t)return[];for(var e=[],n=t.replace(/(\\/\\*[\\s\\S]*?\\*\\/)/gi,""),r=new RegExp("((@.*?keyframes [\\\\s\\\\S]*?){([\\\\s\\\\S]*?}\\\\s*?)})","gi");;){if(null===(u=r.exec(n)))break;e.push(u[0])}n=n.replace(r,"");for(var i=/@import[\\s\\S]*?url\\([^)]*\\)[\\s\\S]*?;/gi,o=new RegExp("((\\\\s*?(?:\\\\/\\\\*[\\\\s\\\\S]*?\\\\*\\\\/)?\\\\s*?@media[\\\\s\\\\S]*?){([\\\\s\\\\S]*?)}\\\\s*?})|(([\\\\s\\\\S]*?){([\\\\s\\\\S]*?)})","gi");;){var u;if(null===(u=i.exec(n))){if(null===(u=o.exec(n)))break;i.lastIndex=o.lastIndex}else o.lastIndex=i.lastIndex;e.push(u[0])}return e}function J(t,r){return e(this,void 0,void 0,(function(){var e,i;return n(this,(function(n){return e=[],i=[],t.forEach((function(e){if("cssRules"in e)try{o(e.cssRules||[]).forEach((function(t,n){if(t.type===CSSRule.IMPORT_RULE){var o=n+1,u=$(t.href).then((function(t){return G(t,r)})).then((function(t){return _(t).forEach((function(t){try{e.insertRule(t,t.startsWith("@import")?o+=1:e.cssRules.length)}catch(e){console.error("Error inserting rule from remote css",{rule:t,error:e})}}))})).catch((function(t){console.error("Error loading remote css",t.toString())}));i.push(u)}}))}catch(o){var n=t.find((function(t){return null==t.href}))||document.styleSheets[0];null!=e.href&&i.push($(e.href).then((function(t){return G(t,r)})).then((function(t){return _(t).forEach((function(t){n.insertRule(t,n.cssRules.length)}))})).catch((function(t){console.error("Error loading remote stylesheet",t)}))),console.error("Error inlining remote css file",o)}})),[2,Promise.all(i).then((function(){return t.forEach((function(t){if("cssRules"in t)try{o(t.cssRules||[]).forEach((function(t){e.push(t)}))}catch(e){console.error("Error while reading CSS rules from ".concat(t.href),e)}})),e}))]}))}))}function Q(t){return t.filter((function(t){return t.type===CSSRule.FONT_FACE_RULE})).filter((function(t){return V(t.style.getPropertyValue("src"))}))}function X(t,r){return e(this,void 0,void 0,(function(){return n(this,(function(e){switch(e.label){case 0:if(null==t.ownerDocument)throw new Error("Provided element is not within a Document");return[4,J(o(t.ownerDocument.styleSheets),r)];case 1:return[2,Q(e.sent())]}}))}))}function K(t){return t.trim().replace(/["']/g,"")}function Y(t,r){return e(this,void 0,void 0,(function(){var e,i;return n(this,(function(n){switch(n.label){case 0:return[4,X(t,r)];case 1:return e=n.sent(),i=function(t){var e=new Set;return function t(n){(n.style.fontFamily||getComputedStyle(n).fontFamily).split(",").forEach((function(t){e.add(K(t))})),Array.from(n.children).forEach((function(e){e instanceof HTMLElement&&t(e)}))}(t),e}(t),[4,Promise.all(e.filter((function(t){return i.has(K(t.style.fontFamily))})).map((function(t){var e=t.parentStyleSheet?t.parentStyleSheet.href:null;return q(t.cssText,e,r)})))];case 2:return[2,n.sent().join("\\n")]}}))}))}function Z(t,r){return e(this,void 0,void 0,(function(){var e,i,o,u,c;return n(this,(function(n){switch(n.label){case 0:return null==r.fontEmbedCSS?[3,1]:(i=r.fontEmbedCSS,[3,5]);case 1:return r.skipFonts?(o=null,[3,4]):[3,2];case 2:return[4,Y(t,r)];case 3:o=n.sent(),n.label=4;case 4:i=o,n.label=5;case 5:return(e=i)&&(u=document.createElement("style"),c=document.createTextNode(e),u.appendChild(c),t.firstChild?t.insertBefore(u,t.firstChild):t.appendChild(u)),[2]}}))}))}function tt(t,r){return void 0===r&&(r={}),e(this,void 0,void 0,(function(){var e,i,o,u;return n(this,(function(n){switch(n.label){case 0:return e=s(t,r),i=e.width,o=e.height,[4,I(t,r,!0)];case 1:return[4,Z(u=n.sent(),r)];case 2:return n.sent(),[4,z(u,r)];case 3:return n.sent(),function(t,e){var n=t.style;e.backgroundColor&&(n.backgroundColor=e.backgroundColor),e.width&&(n.width="".concat(e.width,"px")),e.height&&(n.height="".concat(e.height,"px"));var r=e.style;null!=r&&Object.keys(r).forEach((function(t){n[t]=r[t]}))}(u,r),[4,v(u,i,o)];case 4:return[2,n.sent()]}}))}))}function et(t,r){return void 0===r&&(r={}),e(this,void 0,void 0,(function(){var e,i,o,u,c,a,f,d,v;return n(this,(function(n){switch(n.label){case 0:return e=s(t,r),i=e.width,o=e.height,[4,tt(t,r)];case 1:return[4,h(n.sent())];case 2:return u=n.sent(),c=document.createElement("canvas"),a=c.getContext("2d"),f=r.pixelRatio||function(){var t,e;try{e=process}catch(t){}var n=e&&e.env?e.env.devicePixelRatio:null;return n&&(t=parseInt(n,10),Number.isNaN(t)&&(t=1)),t||window.devicePixelRatio||1}(),d=r.canvasWidth||i,v=r.canvasHeight||o,c.width=d*f,c.height=v*f,r.skipAutoScale||function(t){(t.width>l||t.height>l)&&(t.width>l&&t.height>l?t.width>t.height?(t.height*=l/t.width,t.width=l):(t.width*=l/t.height,t.height=l):t.width>l?(t.height*=l/t.width,t.width=l):(t.width*=l/t.height,t.height=l))}(c),c.style.width="".concat(d),c.style.height="".concat(v),r.backgroundColor&&(a.fillStyle=r.backgroundColor,a.fillRect(0,0,c.width,c.height)),a.drawImage(u,0,0,c.width,c.height),[2,c]}}))}))}t.getFontEmbedCSS=function(t,r){return void 0===r&&(r={}),e(this,void 0,void 0,(function(){return n(this,(function(e){return[2,Y(t,r)]}))}))},t.toBlob=function(t,r){return void 0===r&&(r={}),e(this,void 0,void 0,(function(){return n(this,(function(e){switch(e.label){case 0:return[4,et(t,r)];case 1:return[4,f(e.sent())];case 2:return[2,e.sent()]}}))}))},t.toCanvas=et,t.toJpeg=function(t,r){return void 0===r&&(r={}),e(this,void 0,void 0,(function(){return n(this,(function(e){switch(e.label){case 0:return[4,et(t,r)];case 1:return[2,e.sent().toDataURL("image/jpeg",r.quality||1)]}}))}))},t.toPixelData=function(t,r){return void 0===r&&(r={}),e(this,void 0,void 0,(function(){var e,i,o,u;return n(this,(function(n){switch(n.label){case 0:return e=s(t,r),i=e.width,o=e.height,[4,et(t,r)];case 1:return u=n.sent(),[2,u.getContext("2d").getImageData(0,0,i,o).data]}}))}))},t.toPng=function(t,r){return void 0===r&&(r={}),e(this,void 0,void 0,(function(){return n(this,(function(e){switch(e.label){case 0:return[4,et(t,r)];case 1:return[2,e.sent().toDataURL()]}}))}))},t.toSvg=tt}));`);
314
+ code.push(`!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).htmlToImage={})}(this,(function(t){"use strict";function e(t,e,n,r){return new(n||(n=Promise))((function(i,o){function u(t){try{a(r.next(t))}catch(t){o(t)}}function c(t){try{a(r.throw(t))}catch(t){o(t)}}function a(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(u,c)}a((r=r.apply(t,e||[])).next())}))}function n(t,e){var n,r,i,o,u={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function c(c){return function(a){return function(c){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,c[0]&&(u=0)),u;)try{if(n=1,r&&(i=2&c[0]?r.return:c[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,c[1])).done)return i;switch(r=0,i&&(c=[2&c[0],i.value]),c[0]){case 0:case 1:i=c;break;case 4:return u.label++,{value:c[1],done:!1};case 5:u.label++,r=c[1],c=[0];continue;case 7:c=u.ops.pop(),u.trys.pop();continue;default:if(!(i=u.trys,(i=i.length>0&&i[i.length-1])||6!==c[0]&&2!==c[0])){u=0;continue}if(3===c[0]&&(!i||c[1]>i[0]&&c[1]<i[3])){u.label=c[1];break}if(6===c[0]&&u.label<i[1]){u.label=i[1],i=c;break}if(i&&u.label<i[2]){u.label=i[2],u.ops.push(c);break}i[2]&&u.ops.pop(),u.trys.pop();continue}c=e.call(t,u)}catch(t){c=[6,t],r=0}finally{n=i=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,a])}}}var r,i=(r=0,function(){return r+=1,"u".concat("0000".concat((Math.random()*Math.pow(36,4)<<0).toString(36)).slice(-4)).concat(r)});function o(t){for(var e=[],n=0,r=t.length;n<r;n++)e.push(t[n]);return e}var u=null;function c(t){return void 0===t&&(t={}),u||(u=t.includeStyleProperties?t.includeStyleProperties:o(window.getComputedStyle(document.documentElement)))}function a(t,e){var n=(t.ownerDocument.defaultView||window).getComputedStyle(t).getPropertyValue(e);return n?parseFloat(n.replace("px","")):0}function s(t,e){void 0===e&&(e={});var n,r,i,o=e.width||(r=a(n=t,"border-left-width"),i=a(n,"border-right-width"),n.clientWidth+r+i),u=e.height||function(t){var e=a(t,"border-top-width"),n=a(t,"border-bottom-width");return t.clientHeight+e+n}(t);return{width:o,height:u}}var l=16384;function f(t,e){return void 0===e&&(e={}),t.toBlob?new Promise((function(n){t.toBlob(n,e.type?e.type:"image/png",e.quality?e.quality:1)})):new Promise((function(n){for(var r=window.atob(t.toDataURL(e.type?e.type:void 0,e.quality?e.quality:void 0).split(",")[1]),i=r.length,o=new Uint8Array(i),u=0;u<i;u+=1)o[u]=r.charCodeAt(u);n(new Blob([o],{type:e.type?e.type:"image/png"}))}))}function h(t){return new Promise((function(e,n){var r=new Image;r.onload=function(){r.decode().then((function(){requestAnimationFrame((function(){return e(r)}))}))},r.onerror=n,r.crossOrigin="anonymous",r.decoding="async",r.src=t}))}function d(t){return e(this,void 0,void 0,(function(){return n(this,(function(e){return[2,Promise.resolve().then((function(){return(new XMLSerializer).serializeToString(t)})).then(encodeURIComponent).then((function(t){return"data:image/svg+xml;charset=utf-8,".concat(t)}))]}))}))}function v(t,r,i){return e(this,void 0,void 0,(function(){var e,o,u;return n(this,(function(n){return e="http://www.w3.org/2000/svg",o=document.createElementNS(e,"svg"),u=document.createElementNS(e,"foreignObject"),o.setAttribute("width","".concat(r)),o.setAttribute("height","".concat(i)),o.setAttribute("viewBox","0 0 ".concat(r," ").concat(i)),u.setAttribute("width","100%"),u.setAttribute("height","100%"),u.setAttribute("x","0"),u.setAttribute("y","0"),u.setAttribute("externalResourcesRequired","true"),o.appendChild(u),u.appendChild(t),[2,d(o)]}))}))}var p=function(t,e){if(t instanceof e)return!0;var n=Object.getPrototypeOf(t);return null!==n&&(n.constructor.name===e.name||p(n,e))};function g(t,e,n,r){var i=".".concat(t,":").concat(e),o=n.cssText?function(t){var e=t.getPropertyValue("content");return"".concat(t.cssText," content: '").concat(e.replace(/'|"/g,""),"';")}(n):function(t,e){return c(e).map((function(e){var n=t.getPropertyValue(e),r=t.getPropertyPriority(e);return"".concat(e,": ").concat(n).concat(r?" !important":"",";")})).join(" ")}(n,r);return document.createTextNode("".concat(i,"{").concat(o,"}"))}function m(t,e,n,r){var o=window.getComputedStyle(t,n),u=o.getPropertyValue("content");if(""!==u&&"none"!==u){var c=i();try{e.className="".concat(e.className," ").concat(c)}catch(t){return}var a=document.createElement("style");a.appendChild(g(c,n,o,r)),e.appendChild(a)}}var w="application/font-woff",y="image/jpeg",b={woff:w,woff2:w,ttf:"application/font-truetype",eot:"application/vnd.ms-fontobject",png:"image/png",jpg:y,jpeg:y,gif:"image/gif",tiff:"image/tiff",svg:"image/svg+xml",webp:"image/webp"};function S(t){var e=function(t){var e=/\\.([^./]*?)$/g.exec(t);return e?e[1]:""}(t).toLowerCase();return b[e]||""}function E(t){return-1!==t.search(/^(data:)/)}function x(t,e){return"data:".concat(e,";base64,").concat(t)}function C(t,r,i){return e(this,void 0,void 0,(function(){var e,o;return n(this,(function(n){switch(n.label){case 0:return[4,fetch(t,r)];case 1:if(404===(e=n.sent()).status)throw new Error('Resource "'.concat(e.url,'" not found'));return[4,e.blob()];case 2:return o=n.sent(),[2,new Promise((function(t,n){var r=new FileReader;r.onerror=n,r.onloadend=function(){try{t(i({res:e,result:r.result}))}catch(t){n(t)}},r.readAsDataURL(o)}))]}}))}))}var P={};function R(t,r,i){return e(this,void 0,void 0,(function(){var e,o,u,c,a;return n(this,(function(n){switch(n.label){case 0:if(e=function(t,e,n){var r=t.replace(/\\?.*/,"");return n&&(r=t),/ttf|otf|eot|woff2?/i.test(r)&&(r=r.replace(/.*\\//,"")),e?"[".concat(e,"]").concat(r):r}(t,r,i.includeQueryParams),null!=P[e])return[2,P[e]];i.cacheBust&&(t+=(/\\?/.test(t)?"&":"?")+(new Date).getTime()),n.label=1;case 1:return n.trys.push([1,3,,4]),[4,C(t,i.fetchRequestInit,(function(t){var e=t.res,n=t.result;return r||(r=e.headers.get("Content-Type")||""),function(t){return t.split(/,/)[1]}(n)}))];case 2:return u=n.sent(),o=x(u,r),[3,4];case 3:return c=n.sent(),o=i.imagePlaceholder||"",a="Failed to fetch resource: ".concat(t),c&&(a="string"==typeof c?c:c.message),a&&console.warn(a),[3,4];case 4:return P[e]=o,[2,o]}}))}))}function T(t){return e(this,void 0,void 0,(function(){var e;return n(this,(function(n){return"data:,"===(e=t.toDataURL())?[2,t.cloneNode(!1)]:[2,h(e)]}))}))}function A(t,r){return e(this,void 0,void 0,(function(){var e,i,o,u;return n(this,(function(n){switch(n.label){case 0:return t.currentSrc?(e=document.createElement("canvas"),i=e.getContext("2d"),e.width=t.clientWidth,e.height=t.clientHeight,null==i||i.drawImage(t,0,0,e.width,e.height),[2,h(e.toDataURL())]):(o=t.poster,u=S(o),[4,R(o,u,r)]);case 1:return[2,h(n.sent())]}}))}))}function k(t,r){var i;return e(this,void 0,void 0,(function(){return n(this,(function(e){switch(e.label){case 0:return e.trys.push([0,3,,4]),(null===(i=null==t?void 0:t.contentDocument)||void 0===i?void 0:i.body)?[4,I(t.contentDocument.body,r,!0)]:[3,2];case 1:return[2,e.sent()];case 2:return[3,4];case 3:return e.sent(),[3,4];case 4:return[2,t.cloneNode(!1)]}}))}))}var L=function(t){return null!=t.tagName&&"SVG"===t.tagName.toUpperCase()};function N(t,e,n){return p(e,Element)&&(function(t,e,n){var r=e.style;if(r){var i=window.getComputedStyle(t);i.cssText?(r.cssText=i.cssText,r.transformOrigin=i.transformOrigin):c(n).forEach((function(n){var o=i.getPropertyValue(n);if("font-size"===n&&o.endsWith("px")){var u=Math.floor(parseFloat(o.substring(0,o.length-2)))-.1;o="".concat(u,"px")}p(t,HTMLIFrameElement)&&"display"===n&&"inline"===o&&(o="block"),"d"===n&&e.getAttribute("d")&&(o="path(".concat(e.getAttribute("d"),")")),r.setProperty(n,o,i.getPropertyPriority(n))}))}}(t,e,n),function(t,e,n){m(t,e,":before",n),m(t,e,":after",n)}(t,e,n),function(t,e){p(t,HTMLTextAreaElement)&&(e.innerHTML=t.value),p(t,HTMLInputElement)&&e.setAttribute("value",t.value)}(t,e),function(t,e){if(p(t,HTMLSelectElement)){var n=e,r=Array.from(n.children).find((function(e){return t.value===e.getAttribute("value")}));r&&r.setAttribute("selected","")}}(t,e)),e}function I(t,r,i){return e(this,void 0,void 0,(function(){return n(this,(function(u){return i||!r.filter||r.filter(t)?[2,Promise.resolve(t).then((function(t){return function(t,r){return e(this,void 0,void 0,(function(){return n(this,(function(e){return p(t,HTMLCanvasElement)?[2,T(t)]:p(t,HTMLVideoElement)?[2,A(t,r)]:p(t,HTMLIFrameElement)?[2,k(t,r)]:[2,t.cloneNode(L(t))]}))}))}(t,r)})).then((function(i){return function(t,r,i){var u,c;return e(this,void 0,void 0,(function(){var e;return n(this,(function(n){switch(n.label){case 0:return L(r)?[2,r]:(e=[],0===(e=null!=(a=t).tagName&&"SLOT"===a.tagName.toUpperCase()&&t.assignedNodes?o(t.assignedNodes()):p(t,HTMLIFrameElement)&&(null===(u=t.contentDocument)||void 0===u?void 0:u.body)?o(t.contentDocument.body.childNodes):o((null!==(c=t.shadowRoot)&&void 0!==c?c:t).childNodes)).length||p(t,HTMLVideoElement)?[2,r]:[4,e.reduce((function(t,e){return t.then((function(){return I(e,i)})).then((function(t){t&&r.appendChild(t)}))}),Promise.resolve())]);case 1:return n.sent(),[2,r]}var a}))}))}(t,i,r)})).then((function(e){return N(t,e,r)})).then((function(t){return function(t,r){return e(this,void 0,void 0,(function(){var e,i,o,u,c,a,s,l,f,h,d,v,p;return n(this,(function(n){switch(n.label){case 0:if(0===(e=t.querySelectorAll?t.querySelectorAll("use"):[]).length)return[2,t];i={},p=0,n.label=1;case 1:return p<e.length?(o=e[p],(u=o.getAttribute("xlink:href"))?(c=t.querySelector(u),a=document.querySelector(u),c||!a||i[u]?[3,3]:(s=i,l=u,[4,I(a,r,!0)])):[3,3]):[3,4];case 2:s[l]=n.sent(),n.label=3;case 3:return p++,[3,1];case 4:if((f=Object.values(i)).length){for(h="http://www.w3.org/1999/xhtml",(d=document.createElementNS(h,"svg")).setAttribute("xmlns",h),d.style.position="absolute",d.style.width="0",d.style.height="0",d.style.overflow="hidden",d.style.display="none",v=document.createElementNS(h,"defs"),d.appendChild(v),p=0;p<f.length;p++)v.appendChild(f[p]);t.appendChild(d)}return[2,t]}}))}))}(t,r)}))]:[2,null]}))}))}var D=/url\\((['"]?)([^'"]+?)\\1\\)/g,H=/url\\([^)]+\\)\\s*format\\((["']?)([^"']+)\\1\\)/g,M=/src:\\s*(?:url\\([^)]+\\)\\s*format\\([^)]+\\)[,;]\\s*)+/g;function F(t,r,i,o,u){return e(this,void 0,void 0,(function(){var e,c,a,s;return n(this,(function(n){switch(n.label){case 0:return n.trys.push([0,5,,6]),e=i?function(t,e){if(t.match(/^[a-z]+:\\/\\//i))return t;if(t.match(/^\\/\\//))return window.location.protocol+t;if(t.match(/^[a-z]+:/i))return t;var n=document.implementation.createHTMLDocument(),r=n.createElement("base"),i=n.createElement("a");return n.head.appendChild(r),n.body.appendChild(i),e&&(r.href=e),i.href=t,i.href}(r,i):r,c=S(r),a=void 0,u?[4,u(e)]:[3,2];case 1:return s=n.sent(),a=x(s,c),[3,4];case 2:return[4,R(e,c,o)];case 3:a=n.sent(),n.label=4;case 4:return[2,t.replace((l=r,f=l.replace(/([.*+?^$`);
315
+ code.push(`{}()|\\[\\]\\/\\\\])/g,"\\\\$1"),new RegExp("(url\\\\(['\\"]?)(".concat(f,")(['\\"]?\\\\))"),"g")),"$1".concat(a,"$3"))];case 5:return n.sent(),[3,6];case 6:return[2,t]}var l,f}))}))}function V(t){return-1!==t.search(D)}function q(t,r,i){return e(this,void 0,void 0,(function(){var e,o;return n(this,(function(n){return V(t)?(e=function(t,e){var n=e.preferredFontFormat;return n?t.replace(M,(function(t){for(;;){var e=H.exec(t)||[],r=e[0],i=e[2];if(!i)return"";if(i===n)return"src: ".concat(r,";")}})):t}(t,i),o=function(t){var e=[];return t.replace(D,(function(t,n,r){return e.push(r),t})),e.filter((function(t){return!E(t)}))}(e),[2,o.reduce((function(t,e){return t.then((function(t){return F(t,e,r,i)}))}),Promise.resolve(e))]):[2,t]}))}))}function U(t,r,i){var o;return e(this,void 0,void 0,(function(){var e,u;return n(this,(function(n){switch(n.label){case 0:return(e=null===(o=r.style)||void 0===o?void 0:o.getPropertyValue(t))?[4,q(e,null,i)]:[3,2];case 1:return u=n.sent(),r.style.setProperty(t,u,r.style.getPropertyPriority(t)),[2,!0];case 2:return[2,!1]}}))}))}function j(t,r){return e(this,void 0,void 0,(function(){var e,i;return n(this,(function(n){switch(n.label){case 0:return[4,U("background",t,r)];case 1:return n.sent()?[3,3]:[4,U("background-image",t,r)];case 2:n.sent(),n.label=3;case 3:return[4,U("mask",t,r)];case 4:return(i=n.sent())?[3,6]:[4,U("-webkit-mask",t,r)];case 5:i=n.sent(),n.label=6;case 6:return(e=i)?[3,8]:[4,U("mask-image",t,r)];case 7:e=n.sent(),n.label=8;case 8:return e?[3,10]:[4,U("-webkit-mask-image",t,r)];case 9:n.sent(),n.label=10;case 10:return[2]}}))}))}function O(t,r){return e(this,void 0,void 0,(function(){var e,i,o;return n(this,(function(n){switch(n.label){case 0:return(e=p(t,HTMLImageElement))&&!E(t.src)||p(t,SVGImageElement)&&!E(t.href.baseVal)?[4,R(i=e?t.src:t.href.baseVal,S(i),r)]:[2];case 1:return o=n.sent(),[4,new Promise((function(n,i){t.onload=n,t.onerror=r.onImageErrorHandler?function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];try{n(r.onImageErrorHandler.apply(r,t))}catch(t){i(t)}}:i;var u=t;u.decode&&(u.decode=n),"lazy"===u.loading&&(u.loading="eager"),e?(t.srcset="",t.src=o):t.href.baseVal=o}))];case 2:return n.sent(),[2]}}))}))}function B(t,r){return e(this,void 0,void 0,(function(){var e,i;return n(this,(function(n){switch(n.label){case 0:return e=o(t.childNodes),i=e.map((function(t){return z(t,r)})),[4,Promise.all(i).then((function(){return t}))];case 1:return n.sent(),[2]}}))}))}function z(t,r){return e(this,void 0,void 0,(function(){return n(this,(function(e){switch(e.label){case 0:return p(t,Element)?[4,j(t,r)]:[3,4];case 1:return e.sent(),[4,O(t,r)];case 2:return e.sent(),[4,B(t,r)];case 3:e.sent(),e.label=4;case 4:return[2]}}))}))}var W={};function $(t){return e(this,void 0,void 0,(function(){var e,r;return n(this,(function(n){switch(n.label){case 0:return null!=(e=W[t])?[2,e]:[4,fetch(t)];case 1:return[4,n.sent().text()];case 2:return r=n.sent(),e={url:t,cssText:r},W[t]=e,[2,e]}}))}))}function G(t,r){return e(this,void 0,void 0,(function(){var i,o,u,c,a=this;return n(this,(function(s){return i=t.cssText,o=/url\\(["']?([^"')]+)["']?\\)/g,u=i.match(/url\\([^)]+\\)/g)||[],c=u.map((function(u){return e(a,void 0,void 0,(function(){var e;return n(this,(function(n){return(e=u.replace(o,"$1")).startsWith("https://")||(e=new URL(e,t.url).href),[2,C(e,r.fetchRequestInit,(function(t){var e=t.result;return i=i.replace(u,"url(".concat(e,")")),[u,e]}))]}))}))})),[2,Promise.all(c).then((function(){return i}))]}))}))}function _(t){if(null==t)return[];for(var e=[],n=t.replace(/(\\/\\*[\\s\\S]*?\\*\\/)/gi,""),r=new RegExp("((@.*?keyframes [\\\\s\\\\S]*?){([\\\\s\\\\S]*?}\\\\s*?)})","gi");;){if(null===(u=r.exec(n)))break;e.push(u[0])}n=n.replace(r,"");for(var i=/@import[\\s\\S]*?url\\([^)]*\\)[\\s\\S]*?;/gi,o=new RegExp("((\\\\s*?(?:\\\\/\\\\*[\\\\s\\\\S]*?\\\\*\\\\/)?\\\\s*?@media[\\\\s\\\\S]*?){([\\\\s\\\\S]*?)}\\\\s*?})|(([\\\\s\\\\S]*?){([\\\\s\\\\S]*?)})","gi");;){var u;if(null===(u=i.exec(n))){if(null===(u=o.exec(n)))break;i.lastIndex=o.lastIndex}else o.lastIndex=i.lastIndex;e.push(u[0])}return e}function J(t,r){return e(this,void 0,void 0,(function(){var e,i;return n(this,(function(n){return e=[],i=[],t.forEach((function(e){if("cssRules"in e)try{o(e.cssRules||[]).forEach((function(t,n){if(t.type===CSSRule.IMPORT_RULE){var o=n+1,u=$(t.href).then((function(t){return G(t,r)})).then((function(t){return _(t).forEach((function(t){try{e.insertRule(t,t.startsWith("@import")?o+=1:e.cssRules.length)}catch(e){console.error("Error inserting rule from remote css",{rule:t,error:e})}}))})).catch((function(t){console.error("Error loading remote css",t.toString())}));i.push(u)}}))}catch(o){var n=t.find((function(t){return null==t.href}))||document.styleSheets[0];null!=e.href&&i.push($(e.href).then((function(t){return G(t,r)})).then((function(t){return _(t).forEach((function(t){n.insertRule(t,n.cssRules.length)}))})).catch((function(t){console.error("Error loading remote stylesheet",t)}))),console.error("Error inlining remote css file",o)}})),[2,Promise.all(i).then((function(){return t.forEach((function(t){if("cssRules"in t)try{o(t.cssRules||[]).forEach((function(t){e.push(t)}))}catch(e){console.error("Error while reading CSS rules from ".concat(t.href),e)}})),e}))]}))}))}function Q(t){return t.filter((function(t){return t.type===CSSRule.FONT_FACE_RULE})).filter((function(t){return V(t.style.getPropertyValue("src"))}))}function X(t,r){return e(this,void 0,void 0,(function(){return n(this,(function(e){switch(e.label){case 0:if(null==t.ownerDocument)throw new Error("Provided element is not within a Document");return[4,J(o(t.ownerDocument.styleSheets),r)];case 1:return[2,Q(e.sent())]}}))}))}function K(t){return t.trim().replace(/["']/g,"")}function Y(t,r){return e(this,void 0,void 0,(function(){var e,i;return n(this,(function(n){switch(n.label){case 0:return[4,X(t,r)];case 1:return e=n.sent(),i=function(t){var e=new Set;return function t(n){(n.style.fontFamily||getComputedStyle(n).fontFamily).split(",").forEach((function(t){e.add(K(t))})),Array.from(n.children).forEach((function(e){e instanceof HTMLElement&&t(e)}))}(t),e}(t),[4,Promise.all(e.filter((function(t){return i.has(K(t.style.fontFamily))})).map((function(t){var e=t.parentStyleSheet?t.parentStyleSheet.href:null;return q(t.cssText,e,r)})))];case 2:return[2,n.sent().join("\\n")]}}))}))}function Z(t,r){return e(this,void 0,void 0,(function(){var e,i,o,u,c;return n(this,(function(n){switch(n.label){case 0:return null==r.fontEmbedCSS?[3,1]:(i=r.fontEmbedCSS,[3,5]);case 1:return r.skipFonts?(o=null,[3,4]):[3,2];case 2:return[4,Y(t,r)];case 3:o=n.sent(),n.label=4;case 4:i=o,n.label=5;case 5:return(e=i)&&(u=document.createElement("style"),c=document.createTextNode(e),u.appendChild(c),t.firstChild?t.insertBefore(u,t.firstChild):t.appendChild(u)),[2]}}))}))}function tt(t,r){return void 0===r&&(r={}),e(this,void 0,void 0,(function(){var e,i,o,u;return n(this,(function(n){switch(n.label){case 0:return e=s(t,r),i=e.width,o=e.height,[4,I(t,r,!0)];case 1:return[4,Z(u=n.sent(),r)];case 2:return n.sent(),[4,z(u,r)];case 3:return n.sent(),function(t,e){var n=t.style;e.backgroundColor&&(n.backgroundColor=e.backgroundColor),e.width&&(n.width="".concat(e.width,"px")),e.height&&(n.height="".concat(e.height,"px"));var r=e.style;null!=r&&Object.keys(r).forEach((function(t){n[t]=r[t]}))}(u,r),[4,v(u,i,o)];case 4:return[2,n.sent()]}}))}))}function et(t,r){return void 0===r&&(r={}),e(this,void 0,void 0,(function(){var e,i,o,u,c,a,f,d,v;return n(this,(function(n){switch(n.label){case 0:return e=s(t,r),i=e.width,o=e.height,[4,tt(t,r)];case 1:return[4,h(n.sent())];case 2:return u=n.sent(),c=document.createElement("canvas"),a=c.getContext("2d"),f=r.pixelRatio||function(){var t,e;try{e=process}catch(t){}var n=e&&e.env?e.env.devicePixelRatio:null;return n&&(t=parseInt(n,10),Number.isNaN(t)&&(t=1)),t||window.devicePixelRatio||1}(),d=r.canvasWidth||i,v=r.canvasHeight||o,c.width=d*f,c.height=v*f,r.skipAutoScale||function(t){(t.width>l||t.height>l)&&(t.width>l&&t.height>l?t.width>t.height?(t.height*=l/t.width,t.width=l):(t.width*=l/t.height,t.height=l):t.width>l?(t.height*=l/t.width,t.width=l):(t.width*=l/t.height,t.height=l))}(c),c.style.width="".concat(d),c.style.height="".concat(v),r.backgroundColor&&(a.fillStyle=r.backgroundColor,a.fillRect(0,0,c.width,c.height)),a.drawImage(u,0,0,c.width,c.height),[2,c]}}))}))}t.getFontEmbedCSS=function(t,r){return void 0===r&&(r={}),e(this,void 0,void 0,(function(){return n(this,(function(e){return[2,Y(t,r)]}))}))},t.toBlob=function(t,r){return void 0===r&&(r={}),e(this,void 0,void 0,(function(){return n(this,(function(e){switch(e.label){case 0:return[4,et(t,r)];case 1:return[4,f(e.sent())];case 2:return[2,e.sent()]}}))}))},t.toCanvas=et,t.toJpeg=function(t,r){return void 0===r&&(r={}),e(this,void 0,void 0,(function(){return n(this,(function(e){switch(e.label){case 0:return[4,et(t,r)];case 1:return[2,e.sent().toDataURL("image/jpeg",r.quality||1)]}}))}))},t.toPixelData=function(t,r){return void 0===r&&(r={}),e(this,void 0,void 0,(function(){var e,i,o,u;return n(this,(function(n){switch(n.label){case 0:return e=s(t,r),i=e.width,o=e.height,[4,et(t,r)];case 1:return u=n.sent(),[2,u.getContext("2d").getImageData(0,0,i,o).data]}}))}))},t.toPng=function(t,r){return void 0===r&&(r={}),e(this,void 0,void 0,(function(){return n(this,(function(e){switch(e.label){case 0:return[4,et(t,r)];case 1:return[2,e.sent().toDataURL()]}}))}))},t.toSvg=tt}));`);
316
316
  return code.join("");
317
317
  }
318
318
 
@@ -1,6 +1,5 @@
1
1
  var qe=Object.defineProperty;var $e=(i,t,n)=>t in i?qe(i,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):i[t]=n;var p=(i,t,n)=>($e(i,typeof t!="symbol"?t+"":t,n),n),te=(i,t,n)=>{if(!t.has(i))throw TypeError("Cannot "+n)};var m=(i,t,n)=>(te(i,t,"read from private field"),n?n.call(i):t.get(i)),O=(i,t,n)=>{if(t.has(i))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(i):t.set(i,n)},ne=(i,t,n,r)=>(te(i,t,"write to private field"),r?r.call(i,n):t.set(i,n),n);var re=(i,t,n)=>(te(i,t,"access private method"),n);var he={Foreground:38,Background:48},S="\x1B[1D",de="\x1B[0m"+S,j={Bold:"\x1B[1m"+S,Underline:"\x1B[4m"+S,Reversed:"\x1B[7m"+S},Ve={Bold:"\x1B[1m"+S,Underline:"\x1B[4m"+S,Reversed:"\x1B[7m"+S},oe={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",honeydew:"#f0fff0",hotpink:"#ff69b4","indianred ":"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgrey:"#d3d3d3",lightgreen:"#90ee90",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370d8",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#d87093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"};function We(i){return!!oe[i]}var ge=(i,t,n)=>i===t&&t===n?i<8?16:i>248?231:Math.round((i-8)/247*24)+232:16+36*Math.round(i/255*5)+6*Math.round(t/255*5)+Math.round(n/255*5),pe=i=>{let t=/^#?([a-f\d])([a-f\d])([a-f\d])$/i;i=i.replace(t,function(r,o,s,a){return o+o+s+s+a+a});let n=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(i);return n?{red:parseInt(n[1],16),blue:parseInt(n[2],16),green:parseInt(n[3],16)}:{}},me=function({red:i,green:t,blue:n}){let r=i<<16|t<<8|n<<0;return"#"+(16777216+r).toString(16).slice(1)},ve=function(i){let t=i.matchAll(/\d+/g),n=[];for(let r of t){let o=parseInt(r[0]);if(o>255)return null;n.push(o)}return n.length!==3?null:{red:n[0],green:n[1],blue:n[2]}},ze=function(i){let t=ve(i);return t&&me(t)},G=function(t,n,r){return r<0&&(r+=1),r>1&&(r-=1),r<1/6?t+(n-t)*6*r:r<1/2?n:r<2/3?t+(n-t)*(2/3-r)*6:t},ye=({hue:i,saturation:t,lightness:n})=>{let r,o,s;if(t===0)r=o=s=n;else{let a=n<.5?n*(1+t):n+t-n*t,l=2*n-a;r=G(l,a,i+1/3),o=G(l,a,i),s=G(l,a,i-1/3)}return{red:Math.round(r*255),blue:Math.round(s*255),green:Math.round(o*255)}},be=i=>{let t=i.toLowerCase();return typeof oe[t]<"u"?oe[t]:""};function M({red:i,blue:t,green:n},r=!0){if(i===void 0||t===void 0||n===void 0)return"";let o=ge(i,t,n);return`\x1B[${r?he.Foreground:he.Background};5;`+o+"m "+S}function I(i,t=!0){let{red:n,green:r,blue:o}=pe(i);return M({red:n,green:r,blue:o},t)}function q({hue:i,saturation:t,lightness:n},r){let{red:o,green:s,blue:a}=ye({hue:i,saturation:t,lightness:n});return M({red:o,green:s,blue:a},r)}function ie(i,t=!0){try{let n;return i=i||"",i?((typeof i=="string"||i instanceof String)&&(i=i.trim()),We(i)?(n=be(i),I(n,t)):typeof i=="object"&&!!i.red&&!!i.blue&&!!i.green?M(i,t):typeof i=="object"&&!!i.hue&&!!i.saturation&&!!i.lightness?q(i,t):i.startsWith("#")?I(i,t):(i=i.toString(),/^[\da-fA-F]+$/.test(i)?I("#"+i,t):"")):""}catch(n){console.error("TO_ANSI_INVALID_ARGUMENT_ERROR",n.message)}}function $(i,{fg:t,bg:n,isUnderline:r=!1,isBold:o=!1,isReversed:s=!1}){let a=!1,l="";return t&&(a=!0,l=l+t),n&&(a=!0,l=l+n),r&&(a=!0,l=l+j.Underline),o&&(a=!0,l=l+j.Bold),s&&(a=!0,l=l+j.Reversed),a?l+i+de:i}function Ye(i,{fg:t={},bg:n={},isUnderline:r=!1,isBold:o=!1,isReversed:s=!1}){return t&&(t=M({...t})),n&&(n=M({...n},!1)),$(i,{fg:t,bg:n,isUnderline:r,isBold:o,isReversed:s})}function Je(i,{fg:t="",bg:n="",isUnderline:r=!1,isBold:o=!1,isReversed:s=!1}){return t&&(t=q({...t})),n&&(n=q({...n},!1)),$(i,{fg:t,bg:n,isUnderline:r,isBold:o,isReversed:s})}function Xe(i,{fg:t="",bg:n="",isUnderline:r=!1,isBold:o=!1,isReversed:s=!1}){return t&&(t=I(t)),n&&(n=I(n,!1)),$(i,{fg:t,bg:n,isUnderline:r,isBold:o,isReversed:s})}function Ke(i,t=null){if(!t)return i;let{fg:n="",bg:r="",isUnderline:o=!1,isBold:s=!1,isReversed:a=!1}=t;return n&&(n=ie(n)),r&&(r=ie(r,!1)),$(i,{fg:n,bg:r,isUnderline:o,isBold:s,isReversed:a})}var V={fromRgb:M,fromHexa:I,fromHsl:q,fromColor:ie,getTextFromRgb:Ye,getTextFromHsl:Je,getTextFromHex:Xe,getTextFromColor:Ke,colorNameToHex:be,hslToRgb:ye,hexToRgb:pe,rgbToHex:me,rgbToAnsi256:ge,rgbStringToRgb:ve,rgbStringToHex:ze,hue2rgb:G,RESET:de,FONT_STYLE:j,STYLE:Ve};var Ee={COLOR_TABLE:["#d2466e","#FFA07A","#FF7F50","#FF6347","#FFE4B5","#ADFF2F","#808000","#40E0D0","#1E90FF","#EE82EE","#708090","#DEB887","#FE642E","#210B61","#088A4B","#5E610B","#FA8258","#088A68","#B40431"],SYSTEM:{BROWSER:"BROWSER",NODE:"NODE"}},D=Ee.COLOR_TABLE,U=Ee.SYSTEM,se=2e3,ae="analogger-removed-notif",ce="analogger-header",le="analogger-view",ue="analogger-footer",Le="to-esm-line",W={TOP:"TOP",BOTTOM:"BOTTOM"},we="ANALOGGER",z={DEFAULT_FORMAT:"FORMAT1"};var{parse:mt,stringify:Qe}=JSON,{keys:vt}=Object,Ze=String,et="string";var Te="object",tt=(i,t)=>t;var xe=(i,t,n)=>{let r=Ze(t.push(n)-1);return i.set(n,r),r};var Oe=(i,t,n)=>{let r=t&&typeof t===Te?(h,g)=>h===""||-1<t.indexOf(h)?g:void 0:t||tt,o=new Map,s=[],a=[],l=+xe(o,s,r.call({"":i},"",i)),f=!l;for(;l<s.length;)f=!0,a[l]=Qe(s[l++],d,n);return"["+a.join(",")+"]";function d(h,g){if(f)return f=!f,g;let v=r.call(this,h,g);switch(typeof v){case Te:if(v===null)return v;case et:return o.get(v)||xe(o,s,v)}return v}};var E={moduleName:"analogger",protocol:"http://",host:"localhost",port:12e3,pathname:"analogger",binarypathname:"uploaded",loopback:"localhost",consoleDomId:"#analogger",logFilename:"./analogger.log"},k={ALL:"ALL",USER:"USER"},y={FATAL:5e3,ERROR:4e3,WARN:3e3,INFO:2e3,LOG:1e3,DEBUG:500,ALL:200,OFF:0,INHERIT:-1},Se={LOCAL:"local",GLOBAL:"global"},_={DEFAULT:{contextName:"DEFAULT",logLevel:y.LOG,symbol:"check"},LOG:{contextName:"LOG",logLevel:y.LOG,symbol:"check"},DEBUG:{contextName:"DEBUG",logLevel:y.DEBUG},INFO:{contextName:"INFO",logLevel:y.INFO,color:"#B18904",symbol:"diamonds"},WARN:{contextName:"WARN",logLevel:y.WARN,color:D[0],symbol:"cross"},ERROR:{contextName:"ERROR",logLevel:y.ERROR},CRITICAL:{contextName:"CRITICAL",logLevel:y.CRITICAL}},nt=`
2
- `,Y={airplane:"\u2708",anchor:"\u2693",arrow_backward:"\u25C0",arrow_double_up:"\u23EB",arrow_double_down:"\u23EC",arrow_forward:"\u25B6",arrow_lower_right:"\u2198",arrow_lower_left:"\u2199",arrow_right_hook:"\u21AA",arrow_up_down:"\u2195",arrow_upper_left:"\u2196",arrow_upper_right:"\u2197",ballot_box_with_check:"\u2611",biohazard:"\u2623",black_circle:"\u23FA",black_medium_small_square:"\u25FE",black_medium_square:"\u25FC",black_nib:"\u2712",black_small_square:"\u25AA",black_square:"\u23F9",chains:"\u26D3",check:"\u2714",chess_pawn:"\u265F",cloud_and_rain:"\u26C8",clubs:"\u2663",coffee:"\u2615",copyright:"\xA9",cross:"\u274C",diamonds:"\u2666",divisions_ign:"\u2797",double_triangle_right:"\u23ED",double_triangle_left:"\u23EE",email:"\u2709",eject:"\u23CF",exclamation_mark:"\u2757",fast_forward:"\u23E9",female_sign:"\u2640",fist:"\u270A",fuel_pump:"\u26FD",gear:"\u2699",hammer_and_pick:"\u2692",hand:"\u270B",hearts:"\u2665",infinity:"\u267E",information:"\u2139",left_right_arrow:"\u2194",leftwards_arrow_with_hook:"\u21A9",male_sign:"\u2642",minus_sign:"\u2796",no_entry:"\u26D4",partly_sunny:"\u26C5",pencil:"\u270F",phone:"\u260E",plus_sign:"\u2795",question:"\u2754",radioactive:"\u2622",raised_hand:"\u270B",recycle:"\u267B",registered:"\xAE",relaxed:"\u263A",rewind:"\u23EA",scissors:"\u2702",snowman:"\u2603",spades:"\u2660",sparkles:"\u2728",star:"\u2B50",sunny:"\u2600",tent:"\u26FA",trademark:"\u2122",triangle_with_vertical_bar:"\u23EF",umbrella:"\u2614",vertical_bars:"\u23F8",watch:"\u231A",white_frowning_face:"\u2639",white_medium_square:"\u25FB",white_medium_small_square:"\u25FD",white_small_square:"\u25AB",wheelchair:"\u267F",white_circle:"\u26AA",writing_hand:"\u270D"};function rt(i){try{let t=path.extname(i),n=path.basename(i,t),r=path.dirname(i),o=i.slice(0,i.length-t.length);return{extension:t,filePath:o,basename:n,dirname:r}}catch(t){console.error("FILEPATH_EXT_FAILURE: ",t.message)}return{extension:".log",filePath:i}}function ot(){return new Date().toISOString().replace(/:/g,"-").replace(/\./g,"-")}function it(i,t,n,r,o,s,a){fs.readdir(i,(l,f)=>{if(l){a(l,null);return}let d=[],h=0,g=(b,w)=>{if(!fs.existsSync(b)){w(null,null);return}fs.unlink(b,F=>{F?console.error(`DELETION_FAILURE: Error deleting file ${b}: ${F}`):d.push(b),h++,h===f.length&&w(null,d)})},v=b=>{if(b.startsWith(t+".")&&b.endsWith(n+r)){let w=path.join(i,b);o&&ct(w,o,s),g(w,a)}else h++,h===f.length&&a(null,d)};f.length===0?a(null,d):f.forEach(v,s)})}function st(i,t={}){let n=document.createElement("script");n.textContent=i;for(let r in t)n.setAttribute(r,t[r]);document.head.appendChild(n),n.remove()}function at(){let i=[];return i.push(`!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).htmlToImage={})}(this,(function(t){"use strict";function e(t,e,n,r){return new(n||(n=Promise))((function(i,o){function u(t){try{a(r.next(t))}catch(t){o(t)}}function c(t){try{a(r.throw(t))}catch(t){o(t)}}function a(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(u,c)}a((r=r.apply(t,e||[])).next())}))}function n(t,e){var n,r,i,o,u={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function c(c){return function(a){return function(c){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,c[0]&&(u=0)),u;)try{if(n=1,r&&(i=2&c[0]?r.return:c[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,c[1])).done)return i;switch(r=0,i&&(c=[2&c[0],i.value]),c[0]){case 0:case 1:i=c;break;case 4:return u.label++,{value:c[1],done:!1};case 5:u.label++,r=c[1],c=[0];continue;case 7:c=u.ops.pop(),u.trys.pop();continue;default:if(!(i=u.trys,(i=i.length>0&&i[i.length-1])||6!==c[0]&&2!==c[0])){u=0;continue}if(3===c[0]&&(!i||c[1]>i[0]&&c[1]<i[3])){u.label=c[1];break}if(6===c[0]&&u.label<i[1]){u.label=i[1],i=c;break}if(i&&u.label<i[2]){u.label=i[2],u.ops.push(c);break}i[2]&&u.ops.pop(),u.trys.pop();continue}c=e.call(t,u)}catch(t){c=[6,t],r=0}finally{n=i=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,a])}}}var r,i=(r=0,function(){return r+=1,"u".concat("0000".concat((Math.random()*Math.pow(36,4)<<0).toString(36)).slice(-4)).concat(r)});function o(t){for(var e=[],n=0,r=t.length;n<r;n++)e.push(t[n]);return e}var u=null;function c(t){return void 0===t&&(t={}),u||(u=t.includeStyleProperties?t.includeStyleProperties:o(window.getComputedStyle(document.documentElement)))}function a(t,e){var n=(t.ownerDocument.defaultView||window).getComputedStyle(t).getPropertyValue(e);return n?parseFloat(n.replace("px","")):0}function s(t,e){void 0===e&&(e={});var n,r,i,o=e.width||(r=a(n=t,"border-left-width"),i=a(n,"border-right-width"),n.clientWidth+r+i),u=e.height||function(t){var e=a(t,"border-top-width"),n=a(t,"border-bottom-width");return t.clientHeight+e+n}(t);return{width:o,height:u}}var l=16384;function f(t,e){return void 0===e&&(e={}),t.toBlob?new Promise((function(n){t.toBlob(n,e.type?e.type:"image/png",e.quality?e.quality:1)})):new Promise((function(n){for(var r=window.atob(t.toDataURL(e.type?e.type:void 0,e.quality?e.quality:void 0).split(",")[1]),i=r.length,o=new Uint8Array(i),u=0;u<i;u+=1)o[u]=r.charCodeAt(u);n(new Blob([o],{type:e.type?e.type:"image/png"}))}))}function h(t){return new Promise((function(e,n){var r=new Image;r.onload=function(){r.decode().then((function(){requestAnimationFrame((function(){return e(r)}))}))},r.onerror=n,r.crossOrigin="anonymous",r.decoding="async",r.src=t}))}function d(t){return e(this,void 0,void 0,(function(){return n(this,(function(e){return[2,Promise.resolve().then((function(){return(new XMLSerializer).serializeToString(t)})).then(encodeURIComponent).then((function(t){return"data:image/svg+xml;charset=utf-8,".concat(t)}))]}))}))}function v(t,r,i){return e(this,void 0,void 0,(function(){var e,o,u;return n(this,(function(n){return e="http://www.w3.org/2000/svg",o=document.createElementNS(e,"svg"),u=document.createElementNS(e,"foreignObject"),o.setAttribute("width","".concat(r)),o.setAttribute("height","".concat(i)),o.setAttribute("viewBox","0 0 ".concat(r," ").concat(i)),u.setAttribute("width","100%"),u.setAttribute("height","100%"),u.setAttribute("x","0"),u.setAttribute("y","0"),u.setAttribute("externalResourcesRequired","true"),o.appendChild(u),u.appendChild(t),[2,d(o)]}))}))}var p=function(t,e){if(t instanceof e)return!0;var n=Object.getPrototypeOf(t);return null!==n&&(n.constructor.name===e.name||p(n,e))};function g(t,e,n,r){var i=".".concat(t,":").concat(e),o=n.cssText?function(t){var e=t.getPropertyValue("content");return"".concat(t.cssText," content: '").concat(e.replace(/'|"/g,""),"';")}(n):function(t,e){return c(e).map((function(e){var n=t.getPropertyValue(e),r=t.getPropertyPriority(e);return"".concat(e,": ").concat(n).concat(r?" !important":"",";")})).join(" ")}(n,r);return document.createTextNode("".concat(i,"{").concat(o,"}"))}function m(t,e,n,r){var o=window.getComputedStyle(t,n),u=o.getPropertyValue("content");if(""!==u&&"none"!==u){var c=i();try{e.className="".concat(e.className," ").concat(c)}catch(t){return}var a=document.createElement("style");a.appendChild(g(c,n,o,r)),e.appendChild(a)}}var w="application/font-woff",y="image/jpeg",b={woff:w,woff2:w,ttf:"application/font-truetype",eot:"application/vnd.ms-fontobject",png:"image/png",jpg:y,jpeg:y,gif:"image/gif",tiff:"image/tiff",svg:"image/svg+xml",webp:"image/webp"};function S(t){var e=function(t){var e=/\\.([^./]*?)$/g.exec(t);return e?e[1]:""}(t).toLowerCase();return b[e]||""}function E(t){return-1!==t.search(/^(data:)/)}function x(t,e){return"data:".concat(e,";base64,").concat(t)}function C(t,r,i){return e(this,void 0,void 0,(function(){var e,o;return n(this,(function(n){switch(n.label){case 0:return[4,fetch(t,r)];case 1:if(404===(e=n.sent()).status)throw new Error('Resource "'.concat(e.url,'" not found'));return[4,e.blob()];case 2:return o=n.sent(),[2,new Promise((function(t,n){var r=new FileReader;r.onerror=n,r.onloadend=function(){try{t(i({res:e,result:r.result}))}catch(t){n(t)}},r.readAsDataURL(o)}))]}}))}))}var P={};function R(t,r,i){return e(this,void 0,void 0,(function(){var e,o,u,c,a;return n(this,(function(n){switch(n.label){case 0:if(e=function(t,e,n){var r=t.replace(/\\?.*/,"");return n&&(r=t),/ttf|otf|eot|woff2?/i.test(r)&&(r=r.replace(/.*\\//,"")),e?"[".concat(e,"]").concat(r):r}(t,r,i.includeQueryParams),null!=P[e])return[2,P[e]];i.cacheBust&&(t+=(/\\?/.test(t)?"&":"?")+(new Date).getTime()),n.label=1;case 1:return n.trys.push([1,3,,4]),[4,C(t,i.fetchRequestInit,(function(t){var e=t.res,n=t.result;return r||(r=e.headers.get("Content-Type")||""),function(t){return t.split(/,/)[1]}(n)}))];case 2:return u=n.sent(),o=x(u,r),[3,4];case 3:return c=n.sent(),o=i.imagePlaceholder||"",a="Failed to fetch resource: ".concat(t),c&&(a="string"==typeof c?c:c.message),a&&console.warn(a),[3,4];case 4:return P[e]=o,[2,o]}}))}))}function T(t){return e(this,void 0,void 0,(function(){var e;return n(this,(function(n){return"data:,"===(e=t.toDataURL())?[2,t.cloneNode(!1)]:[2,h(e)]}))}))}function A(t,r){return e(this,void 0,void 0,(function(){var e,i,o,u;return n(this,(function(n){switch(n.label){case 0:return t.currentSrc?(e=document.createElement("canvas"),i=e.getContext("2d"),e.width=t.clientWidth,e.height=t.clientHeight,null==i||i.drawImage(t,0,0,e.width,e.height),[2,h(e.toDataURL())]):(o=t.poster,u=S(o),[4,R(o,u,r)]);case 1:return[2,h(n.sent())]}}))}))}function k(t,r){var i;return e(this,void 0,void 0,(function(){return n(this,(function(e){switch(e.label){case 0:return e.trys.push([0,3,,4]),(null===(i=null==t?void 0:t.contentDocument)||void 0===i?void 0:i.body)?[4,I(t.contentDocument.body,r,!0)]:[3,2];case 1:return[2,e.sent()];case 2:return[3,4];case 3:return e.sent(),[3,4];case 4:return[2,t.cloneNode(!1)]}}))}))}var L=function(t){return null!=t.tagName&&"SVG"===t.tagName.toUpperCase()};function N(t,e,n){return p(e,Element)&&(function(t,e,n){var r=e.style;if(r){var i=window.getComputedStyle(t);i.cssText?(r.cssText=i.cssText,r.transformOrigin=i.transformOrigin):c(n).forEach((function(n){var o=i.getPropertyValue(n);if("font-size"===n&&o.endsWith("px")){var u=Math.floor(parseFloat(o.substring(0,o.length-2)))-.1;o="".concat(u,"px")}p(t,HTMLIFrameElement)&&"display"===n&&"inline"===o&&(o="block"),"d"===n&&e.getAttribute("d")&&(o="path(".concat(e.getAttribute("d"),")")),r.setProperty(n,o,i.getPropertyPriority(n))}))}}(t,e,n),function(t,e,n){m(t,e,":before",n),m(t,e,":after",n)}(t,e,n),function(t,e){p(t,HTMLTextAreaElement)&&(e.innerHTML=t.value),p(t,HTMLInputElement)&&e.setAttribute("value",t.value)}(t,e),function(t,e){if(p(t,HTMLSelectElement)){var n=e,r=Array.from(n.children).find((function(e){return t.value===e.getAttribute("value")}));r&&r.setAttribute("selected","")}}(t,e)),e}function I(t,r,i){return e(this,void 0,void 0,(function(){return n(this,(function(u){return i||!r.filter||r.filter(t)?[2,Promise.resolve(t).then((function(t){return function(t,r){return e(this,void 0,void 0,(function(){return n(this,(function(e){return p(t,HTMLCanvasElement)?[2,T(t)]:p(t,HTMLVideoElement)?[2,A(t,r)]:p(t,HTMLIFrameElement)?[2,k(t,r)]:[2,t.cloneNode(L(t))]}))}))}(t,r)})).then((function(i){return function(t,r,i){var u,c;return e(this,void 0,void 0,(function(){var e;return n(this,(function(n){switch(n.label){case 0:return L(r)?[2,r]:(e=[],0===(e=null!=(a=t).tagName&&"SLOT"===a.tagName.toUpperCase()&&t.assignedNodes?o(t.assignedNodes()):p(t,HTMLIFrameElement)&&(null===(u=t.contentDocument)||void 0===u?void 0:u.body)?o(t.contentDocument.body.childNodes):o((null!==(c=t.shadowRoot)&&void 0!==c?c:t).childNodes)).length||p(t,HTMLVideoElement)?[2,r]:[4,e.reduce((function(t,e){return t.then((function(){return I(e,i)})).then((function(t){t&&r.appendChild(t)}))}),Promise.resolve())]);case 1:return n.sent(),[2,r]}var a}))}))}(t,i,r)})).then((function(e){return N(t,e,r)})).then((function(t){return function(t,r){return e(this,void 0,void 0,(function(){var e,i,o,u,c,a,s,l,f,h,d,v,p;return n(this,(function(n){switch(n.label){case 0:if(0===(e=t.querySelectorAll?t.querySelectorAll("use"):[]).length)return[2,t];i={},p=0,n.label=1;case 1:return p<e.length?(o=e[p],(u=o.getAttribute("xlink:href"))?(c=t.querySelector(u),a=document.querySelector(u),c||!a||i[u]?[3,3]:(s=i,l=u,[4,I(a,r,!0)])):[3,3]):[3,4];case 2:s[l]=n.sent(),n.label=3;case 3:return p++,[3,1];case 4:if((f=Object.values(i)).length){for(h="http://www.w3.org/1999/xhtml",(d=document.createElementNS(h,"svg")).setAttribute("xmlns",h),d.style.position="absolute",d.style.width="0",d.style.height="0",d.style.overflow="hidden",d.style.display="none",v=document.createElementNS(h,"defs"),d.appendChild(v),p=0;p<f.length;p++)v.appendChild(f[p]);t.appendChild(d)}return[2,t]}}))}))}(t,r)}))]:[2,null]}))}))}var D=/url\\((['"]?)([^'"]+?)\\1\\)/g,H=/url\\([^)]+\\)\\s*format\\((["']?)([^"']+)\\1\\)/g,M=/src:\\s*(?:url\\([^)]+\\)\\s*format\\([^)]+\\)[,;]\\s*)+/g;function F(t,r,i,o,u){return e(this,void 0,void 0,(function(){var e,c,a,s;return n(this,(function(n){switch(n.label){case 0:return n.trys.push([0,5,,6]),e=i?function(t,e){if(t.match(/^[a-z]+:\\/\\//i))return t;if(t.match(/^\\/\\//))return window.location.protocol+t;if(t.match(/^[a-z]+:/i))return t;var n=document.implementation.createHTMLDocument(),r=n.createElement("base"),i=n.createElement("a");return n.head.appendChild(r),n.body.appendChild(i),e&&(r.href=e),i.href=t,i.href}(r,i):r,c=S(r),a=void 0,u?[4,u(e)]:[3,2];case 1:return s=n.sent(),a=x(s,c),[3,4];case 2:return[4,R(e,c,o)];case 3:a=n.sent(),n.label=4;case 4:return[2,t.replace((l=r,f=l.replace(/([.*+?^);
3
- code.push(()|\\[\\]\\/\\\\])/g,"\\\\$1"),new RegExp("(url\\\\(['\\"]?)(".concat(f,")(['\\"]?\\\\))"),"g")),"$1".concat(a,"$3"))];case 5:return n.sent(),[3,6];case 6:return[2,t]}var l,f}))}))}function V(t){return-1!==t.search(D)}function q(t,r,i){return e(this,void 0,void 0,(function(){var e,o;return n(this,(function(n){return V(t)?(e=function(t,e){var n=e.preferredFontFormat;return n?t.replace(M,(function(t){for(;;){var e=H.exec(t)||[],r=e[0],i=e[2];if(!i)return"";if(i===n)return"src: ".concat(r,";")}})):t}(t,i),o=function(t){var e=[];return t.replace(D,(function(t,n,r){return e.push(r),t})),e.filter((function(t){return!E(t)}))}(e),[2,o.reduce((function(t,e){return t.then((function(t){return F(t,e,r,i)}))}),Promise.resolve(e))]):[2,t]}))}))}function U(t,r,i){var o;return e(this,void 0,void 0,(function(){var e,u;return n(this,(function(n){switch(n.label){case 0:return(e=null===(o=r.style)||void 0===o?void 0:o.getPropertyValue(t))?[4,q(e,null,i)]:[3,2];case 1:return u=n.sent(),r.style.setProperty(t,u,r.style.getPropertyPriority(t)),[2,!0];case 2:return[2,!1]}}))}))}function j(t,r){return e(this,void 0,void 0,(function(){var e,i;return n(this,(function(n){switch(n.label){case 0:return[4,U("background",t,r)];case 1:return n.sent()?[3,3]:[4,U("background-image",t,r)];case 2:n.sent(),n.label=3;case 3:return[4,U("mask",t,r)];case 4:return(i=n.sent())?[3,6]:[4,U("-webkit-mask",t,r)];case 5:i=n.sent(),n.label=6;case 6:return(e=i)?[3,8]:[4,U("mask-image",t,r)];case 7:e=n.sent(),n.label=8;case 8:return e?[3,10]:[4,U("-webkit-mask-image",t,r)];case 9:n.sent(),n.label=10;case 10:return[2]}}))}))}function O(t,r){return e(this,void 0,void 0,(function(){var e,i,o;return n(this,(function(n){switch(n.label){case 0:return(e=p(t,HTMLImageElement))&&!E(t.src)||p(t,SVGImageElement)&&!E(t.href.baseVal)?[4,R(i=e?t.src:t.href.baseVal,S(i),r)]:[2];case 1:return o=n.sent(),[4,new Promise((function(n,i){t.onload=n,t.onerror=r.onImageErrorHandler?function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];try{n(r.onImageErrorHandler.apply(r,t))}catch(t){i(t)}}:i;var u=t;u.decode&&(u.decode=n),"lazy"===u.loading&&(u.loading="eager"),e?(t.srcset="",t.src=o):t.href.baseVal=o}))];case 2:return n.sent(),[2]}}))}))}function B(t,r){return e(this,void 0,void 0,(function(){var e,i;return n(this,(function(n){switch(n.label){case 0:return e=o(t.childNodes),i=e.map((function(t){return z(t,r)})),[4,Promise.all(i).then((function(){return t}))];case 1:return n.sent(),[2]}}))}))}function z(t,r){return e(this,void 0,void 0,(function(){return n(this,(function(e){switch(e.label){case 0:return p(t,Element)?[4,j(t,r)]:[3,4];case 1:return e.sent(),[4,O(t,r)];case 2:return e.sent(),[4,B(t,r)];case 3:e.sent(),e.label=4;case 4:return[2]}}))}))}var W={};function $(t){return e(this,void 0,void 0,(function(){var e,r;return n(this,(function(n){switch(n.label){case 0:return null!=(e=W[t])?[2,e]:[4,fetch(t)];case 1:return[4,n.sent().text()];case 2:return r=n.sent(),e={url:t,cssText:r},W[t]=e,[2,e]}}))}))}function G(t,r){return e(this,void 0,void 0,(function(){var i,o,u,c,a=this;return n(this,(function(s){return i=t.cssText,o=/url\\(["']?([^"')]+)["']?\\)/g,u=i.match(/url\\([^)]+\\)/g)||[],c=u.map((function(u){return e(a,void 0,void 0,(function(){var e;return n(this,(function(n){return(e=u.replace(o,"$1")).startsWith("https://")||(e=new URL(e,t.url).href),[2,C(e,r.fetchRequestInit,(function(t){var e=t.result;return i=i.replace(u,"url(".concat(e,")")),[u,e]}))]}))}))})),[2,Promise.all(c).then((function(){return i}))]}))}))}function _(t){if(null==t)return[];for(var e=[],n=t.replace(/(\\/\\*[\\s\\S]*?\\*\\/)/gi,""),r=new RegExp("((@.*?keyframes [\\\\s\\\\S]*?){([\\\\s\\\\S]*?}\\\\s*?)})","gi");;){if(null===(u=r.exec(n)))break;e.push(u[0])}n=n.replace(r,"");for(var i=/@import[\\s\\S]*?url\\([^)]*\\)[\\s\\S]*?;/gi,o=new RegExp("((\\\\s*?(?:\\\\/\\\\*[\\\\s\\\\S]*?\\\\*\\\\/)?\\\\s*?@media[\\\\s\\\\S]*?){([\\\\s\\\\S]*?)}\\\\s*?})|(([\\\\s\\\\S]*?){([\\\\s\\\\S]*?)})","gi");;){var u;if(null===(u=i.exec(n))){if(null===(u=o.exec(n)))break;i.lastIndex=o.lastIndex}else o.lastIndex=i.lastIndex;e.push(u[0])}return e}function J(t,r){return e(this,void 0,void 0,(function(){var e,i;return n(this,(function(n){return e=[],i=[],t.forEach((function(e){if("cssRules"in e)try{o(e.cssRules||[]).forEach((function(t,n){if(t.type===CSSRule.IMPORT_RULE){var o=n+1,u=$(t.href).then((function(t){return G(t,r)})).then((function(t){return _(t).forEach((function(t){try{e.insertRule(t,t.startsWith("@import")?o+=1:e.cssRules.length)}catch(e){console.error("Error inserting rule from remote css",{rule:t,error:e})}}))})).catch((function(t){console.error("Error loading remote css",t.toString())}));i.push(u)}}))}catch(o){var n=t.find((function(t){return null==t.href}))||document.styleSheets[0];null!=e.href&&i.push($(e.href).then((function(t){return G(t,r)})).then((function(t){return _(t).forEach((function(t){n.insertRule(t,n.cssRules.length)}))})).catch((function(t){console.error("Error loading remote stylesheet",t)}))),console.error("Error inlining remote css file",o)}})),[2,Promise.all(i).then((function(){return t.forEach((function(t){if("cssRules"in t)try{o(t.cssRules||[]).forEach((function(t){e.push(t)}))}catch(e){console.error("Error while reading CSS rules from ".concat(t.href),e)}})),e}))]}))}))}function Q(t){return t.filter((function(t){return t.type===CSSRule.FONT_FACE_RULE})).filter((function(t){return V(t.style.getPropertyValue("src"))}))}function X(t,r){return e(this,void 0,void 0,(function(){return n(this,(function(e){switch(e.label){case 0:if(null==t.ownerDocument)throw new Error("Provided element is not within a Document");return[4,J(o(t.ownerDocument.styleSheets),r)];case 1:return[2,Q(e.sent())]}}))}))}function K(t){return t.trim().replace(/["']/g,"")}function Y(t,r){return e(this,void 0,void 0,(function(){var e,i;return n(this,(function(n){switch(n.label){case 0:return[4,X(t,r)];case 1:return e=n.sent(),i=function(t){var e=new Set;return function t(n){(n.style.fontFamily||getComputedStyle(n).fontFamily).split(",").forEach((function(t){e.add(K(t))})),Array.from(n.children).forEach((function(e){e instanceof HTMLElement&&t(e)}))}(t),e}(t),[4,Promise.all(e.filter((function(t){return i.has(K(t.style.fontFamily))})).map((function(t){var e=t.parentStyleSheet?t.parentStyleSheet.href:null;return q(t.cssText,e,r)})))];case 2:return[2,n.sent().join("\\n")]}}))}))}function Z(t,r){return e(this,void 0,void 0,(function(){var e,i,o,u,c;return n(this,(function(n){switch(n.label){case 0:return null==r.fontEmbedCSS?[3,1]:(i=r.fontEmbedCSS,[3,5]);case 1:return r.skipFonts?(o=null,[3,4]):[3,2];case 2:return[4,Y(t,r)];case 3:o=n.sent(),n.label=4;case 4:i=o,n.label=5;case 5:return(e=i)&&(u=document.createElement("style"),c=document.createTextNode(e),u.appendChild(c),t.firstChild?t.insertBefore(u,t.firstChild):t.appendChild(u)),[2]}}))}))}function tt(t,r){return void 0===r&&(r={}),e(this,void 0,void 0,(function(){var e,i,o,u;return n(this,(function(n){switch(n.label){case 0:return e=s(t,r),i=e.width,o=e.height,[4,I(t,r,!0)];case 1:return[4,Z(u=n.sent(),r)];case 2:return n.sent(),[4,z(u,r)];case 3:return n.sent(),function(t,e){var n=t.style;e.backgroundColor&&(n.backgroundColor=e.backgroundColor),e.width&&(n.width="".concat(e.width,"px")),e.height&&(n.height="".concat(e.height,"px"));var r=e.style;null!=r&&Object.keys(r).forEach((function(t){n[t]=r[t]}))}(u,r),[4,v(u,i,o)];case 4:return[2,n.sent()]}}))}))}function et(t,r){return void 0===r&&(r={}),e(this,void 0,void 0,(function(){var e,i,o,u,c,a,f,d,v;return n(this,(function(n){switch(n.label){case 0:return e=s(t,r),i=e.width,o=e.height,[4,tt(t,r)];case 1:return[4,h(n.sent())];case 2:return u=n.sent(),c=document.createElement("canvas"),a=c.getContext("2d"),f=r.pixelRatio||function(){var t,e;try{e=process}catch(t){}var n=e&&e.env?e.env.devicePixelRatio:null;return n&&(t=parseInt(n,10),Number.isNaN(t)&&(t=1)),t||window.devicePixelRatio||1}(),d=r.canvasWidth||i,v=r.canvasHeight||o,c.width=d*f,c.height=v*f,r.skipAutoScale||function(t){(t.width>l||t.height>l)&&(t.width>l&&t.height>l?t.width>t.height?(t.height*=l/t.width,t.width=l):(t.width*=l/t.height,t.height=l):t.width>l?(t.height*=l/t.width,t.width=l):(t.width*=l/t.height,t.height=l))}(c),c.style.width="".concat(d),c.style.height="".concat(v),r.backgroundColor&&(a.fillStyle=r.backgroundColor,a.fillRect(0,0,c.width,c.height)),a.drawImage(u,0,0,c.width,c.height),[2,c]}}))}))}t.getFontEmbedCSS=function(t,r){return void 0===r&&(r={}),e(this,void 0,void 0,(function(){return n(this,(function(e){return[2,Y(t,r)]}))}))},t.toBlob=function(t,r){return void 0===r&&(r={}),e(this,void 0,void 0,(function(){return n(this,(function(e){switch(e.label){case 0:return[4,et(t,r)];case 1:return[4,f(e.sent())];case 2:return[2,e.sent()]}}))}))},t.toCanvas=et,t.toJpeg=function(t,r){return void 0===r&&(r={}),e(this,void 0,void 0,(function(){return n(this,(function(e){switch(e.label){case 0:return[4,et(t,r)];case 1:return[2,e.sent().toDataURL("image/jpeg",r.quality||1)]}}))}))},t.toPixelData=function(t,r){return void 0===r&&(r={}),e(this,void 0,void 0,(function(){var e,i,o,u;return n(this,(function(n){switch(n.label){case 0:return e=s(t,r),i=e.width,o=e.height,[4,et(t,r)];case 1:return u=n.sent(),[2,u.getContext("2d").getImageData(0,0,i,o).data]}}))}))},t.toPng=function(t,r){return void 0===r&&(r={}),e(this,void 0,void 0,(function(){return n(this,(function(e){switch(e.label){case 0:return[4,et(t,r)];case 1:return[2,e.sent().toDataURL()]}}))}))},t.toSvg=tt}));`),i.join("")}function ct(i,t,n=1){try{if(!fs.existsSync(i))return;if(!fs.existsSync(t)){let o=fs.mkdtempSync(path.join(os.tmpdir(),"tar-gz-init-"));try{let s=path.join(o,path.basename(i));fs.copyFileSync(i,s),c({sync:!0,gzip:{level:n},file:t,cwd:o,portable:!0},[path.basename(i)])}finally{fs.rmSync(o,{recursive:!0,force:!0})}return}let r=fs.mkdtempSync(path.join(os.tmpdir(),"tar-gz-append-"));try{x({file:t,cwd:r,sync:!0});let o=path.join(r,path.basename(i));fs.copyFileSync(i,o),c({gzip:!0,file:t,cwd:r,sync:!0,portable:!0},fs.readdirSync(r))}finally{fs.rmSync(r,{recursive:!0,force:!0})}}catch{console.error(`ARCHIVE_FAILURE: ${e.message}`)}}function Ae(){return typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node<"u"?U.NODE:U.BROWSER}var lt=Ae();function ut(){return lt===U.NODE}var ft=["alert","assert","keepLogHistory","getLogHistory","truncateMessage","truncateMessage","rawLog","removeOverride","removeOverrideError","overrideConsole","overrideError","table","rawInfo","rawWarn","rawError","hasSeenLid","addToLogHistory","releaseLogHistory","resetLogHistory","setLogFormat","resetLogFormatter","getRawLogHistory"],B,A,C,N,T,J,Re,X,Ce,u=class{constructor({name:t="default"}={}){O(this,J);O(this,X);p(this,"system","");p(this,"instanceId","");p(this,"instanceName","");p(this,"logIndex",0);p(this,"logCounter",0);O(this,A,[]);O(this,C,{});O(this,N,{});p(this,"activeTargets",[]);p(this,"indexColor",0);p(this,"format","");p(this,"keepLog",!1);p(this,"logHistory",[]);p(this,"$containers",null);p(this,"options",{hideHookMessage:!1});O(this,T,{log:!1,info:!1,warn:!1,error:!1});p(this,"originalFormatFunction");p(this,"removeDomOldEntries",t=>{if(t.childElementCount>se){let r=Math.ceil(se/10);for(let o=0;o<r;++o)t.removeChild(t.firstChild);return r}return 0});p(this,"scrollDivToBottom",t=>{let n=t.scrollHeight-(t.clientHeight+t.scrollTop),r=t.clientHeight||t.offsetHeight;n>r/2||(t.scrollTop=t.scrollHeight)});this.system=Ae(),this.format=this.onBuildLog.bind(this),this.originalFormatFunction=this.format,this.instanceName=t,this.instanceId=u.instanceCount+"-"+Date.now(),m(u,B)[u.instanceCount]=this,++u.instanceCount,this.errorTargetHandler=this.onError.bind(this),this.errorUserTargetHandler=this.onErrorForUserTarget.bind(this),this.setOptions(this.options),u.Console||(u.Console={log:console.log,info:console.info,warn:console.warn,error:console.error,debug:console.debug,table:console.table}),this.rawLog=u.Console.log,this.rawInfo=u.Console.info,this.rawWarn=u.Console.warn,this.rawError=u.Console.error,this.ALIGN=u.ALIGN,this.ENVIRONMENT_TYPE=u.ENVIRONMENT_TYPE,re(this,X,Ce).call(this),this.resetLogHistory()}getName(){return this.instanceName}getId(){return this.instanceId}keepLogHistory(){this.keepLog=!0}releaseLogHistory(){this.keepLog=!1}resetLogHistory(){this.logHistory=[]}addToLogHistory(t){t=t||{},this.logHistory.push(Object.assign({},t))}getLogHistory(t=!0,n=nt){let r=this.logHistory||[],o=[];return r.forEach(s=>{let{text:a}=s;o.push(a)}),t?o.join(n):o}getRawLogHistory(){return this.logHistory||[]}hasSeenLid(t){this.logHistory=this.logHistory||[];for(let n=0;n<this.logHistory.length;++n){let o=(this.logHistory[n]||{}).context||{};if(t===o.lid)return!0}return!1}forceEnvironment(t){this.forcedSystem=t}isNode(){return this&&this.forcedSystem?this.forcedSystem===U.NODE:ut()}isBrowser(){return!this.isNode()}resetLogger(){this.options={},this.options.timeLenMax=12,this.options.contextLenMax=10,this.options.idLenMax=5,this.options.lidLenMax=6,this.options.messageLenMax=void 0,this.options.symbolLenMax=60,this.options.hideHookMessage=void 0,this.options.hidePassingTests=void 0,this.options.hideLog=void 0,this.options.hideError=void 0,this.options.oneConsolePerContext=!0,this.options.logToDom=void 0,this.options.logToFile=void 0,this.options.logMaxSize=0,this.options.logMaxArchives=3,this.options.logIndexArchive=0,this.options.logToRemote=void 0,this.options.addArchiveTimestamp=!0,this.options.addArchiveIndex=!0,this.options.logToRemoteUrl=void 0,this.options.logToRemoteBinaryUrl=void 0,this.options.compressArchives=!1,this.options.compressionLevel=1,this.options.protocol=void 0,this.options.host=void 0,this.options.port=void 0,this.options.pathname=void 0,this.options.binarypathname=void 0,this.options.enableDate=void 0}resetOptions(){this.resetLogger()}setOptions({contextLenMax:t=10,idLenMax:n=5,lidLenMax:r=6,symbolLenMax:o=2,messageLenMax:s=void 0,hideLog:a=void 0,hideError:l=void 0,hideHookMessage:f=void 0,hidePassingTests:d=void 0,logToDom:h=void 0,logToFile:g=void 0,logMaxSize:v=0,logMaxArchives:b=3,logIndexArchive:w=0,addArchiveTimestamp:F=!0,addArchiveIndex:K=!0,compressArchives:Q=!1,compressionLevel:Z=1,logToRemote:Ne=void 0,logToRemoteUrl:Fe=void 0,logToRemoteBinaryUrl:Ie=void 0,loopback:Me=E.loopback,requiredLogLevel:De=y.LOG,oneConsolePerContext:ke=void 0,silent:fe=void 0,enableDate:Pe=void 0,protocol:He=void 0,host:Ue=void 0,port:_e=void 0,pathname:Be=void 0,binarypathname:je=void 0,loadHtmlToImage:Ge=!1}=null){if(this.options.contextLenMax=t,this.options.idLenMax=n,this.options.lidLenMax=r,this.options.messageLenMax=s,this.options.symbolLenMax=o,this.options.logMaxSize=v,this.options.logMaxArchives=b,this.options.logIndexArchive=w,this.options.addArchiveTimestamp=F,this.options.addArchiveIndex=K,this.options.compressArchives=Q,this.options.compressionLevel=Z,this.options.requiredLogLevel=De,Ge){let R=at();st(R)}let ee;fe!==void 0?ee=!!fe:a!==void 0&&(ee=!!a),[{hideLog:ee},{oneConsolePerContext:ke},{hideError:l},{enableDate:Pe},{hideHookMessage:f},{hidePassingTests:d},{logToRemote:Ne}].forEach(R=>{let P=Object.keys(R)[0],H=R[P];H!==void 0&&(this.options[P]=!!H)}),[{logToRemoteBinaryUrl:Ie},{logToRemoteUrl:Fe},{loopback:Me},{protocol:He},{host:Ue},{port:_e},{pathname:Be},{binarypathname:je}].forEach(R=>{let P=Object.keys(R)[0],H=R[P];H!==void 0&&(this.options[P]=H)}),this.options.logToRemote&&!this.options.logToRemoteUrl&&(this.options.logToRemoteUrl=this.convertToUrl({protocol:this.options.protocol,host:this.options.host,port:this.options.port,pathname:this.options.pathname})),this.options.logToRemote&&!this.options.logToRemoteBinaryUrl&&(this.options.logToRemoteBinaryUrl=this.convertToUrl({protocol:this.options.protocol,host:this.options.host,port:this.options.port,pathname:this.options.binarypathname||E.binarypathname})),h===!1?this.options.logToDom=!1:h!==void 0&&(this.options.logToDom=h===!0?E.consoleDomId:h),g===!1?this.options.logToFile=!1:g!==void 0&&(this.isBrowser()||(this.options.logToFile=g||E.logFilename),u.Console.log("LogToFile is not supported in this environment. "))}getOptions(){return this.options}truncateMessage(t="",{fit:n=0,align:r=u.ALIGN.LEFT,ellipsis:o="..."}={}){return t=""+t,n&&t.length>n&&(t=t.substring(0,n-o.length)+o),t=r===u.ALIGN.LEFT?t.padEnd(n," "):t.padStart(n," "),t}onBuildLog({contextName:t,message:n="",lid:r="",symbol:o=""}={}){try{let s="",a=n.split(/\n/g);for(let l=0;l<a.length;++l){let f=a[l],d=new Date,h=("0"+d.getHours()).slice(-2)+":"+("0"+d.getMinutes()).slice(-2)+":"+("0"+d.getSeconds()).slice(-2);this.options.enableDate&&(h=d.getFullYear().toString().slice(-2)+"-"+(d.getMonth()+1).toString().padStart(2,"0")+"-"+d.getDate().toString().padStart(2,"0")+" "+h),h=this.truncateMessage(h,{fit:this.options.timeLenMax}),l>0&&(t="",r=""),t=this.truncateMessage(t,{fit:this.options.contextLenMax,align:u.ALIGN.RIGHT}),r=this.truncateMessage(r,{fit:this.options.lidLenMax}),this.options.messageLenMax!==void 0&&(f=this.truncateMessage(f,{fit:this.options.messageLenMax})),o=this.truncateMessage(o,{fit:this.options.symbolLenMax}),l<=0?s+=`[${h}] ${t}: (${r}) ${o} ${f}`:l<a.length-1?(s+=`
2
+ `,Y={airplane:"\u2708",anchor:"\u2693",arrow_backward:"\u25C0",arrow_double_up:"\u23EB",arrow_double_down:"\u23EC",arrow_forward:"\u25B6",arrow_lower_right:"\u2198",arrow_lower_left:"\u2199",arrow_right_hook:"\u21AA",arrow_up_down:"\u2195",arrow_upper_left:"\u2196",arrow_upper_right:"\u2197",ballot_box_with_check:"\u2611",biohazard:"\u2623",black_circle:"\u23FA",black_medium_small_square:"\u25FE",black_medium_square:"\u25FC",black_nib:"\u2712",black_small_square:"\u25AA",black_square:"\u23F9",chains:"\u26D3",check:"\u2714",chess_pawn:"\u265F",cloud_and_rain:"\u26C8",clubs:"\u2663",coffee:"\u2615",copyright:"\xA9",cross:"\u274C",diamonds:"\u2666",divisions_ign:"\u2797",double_triangle_right:"\u23ED",double_triangle_left:"\u23EE",email:"\u2709",eject:"\u23CF",exclamation_mark:"\u2757",fast_forward:"\u23E9",female_sign:"\u2640",fist:"\u270A",fuel_pump:"\u26FD",gear:"\u2699",hammer_and_pick:"\u2692",hand:"\u270B",hearts:"\u2665",infinity:"\u267E",information:"\u2139",left_right_arrow:"\u2194",leftwards_arrow_with_hook:"\u21A9",male_sign:"\u2642",minus_sign:"\u2796",no_entry:"\u26D4",partly_sunny:"\u26C5",pencil:"\u270F",phone:"\u260E",plus_sign:"\u2795",question:"\u2754",radioactive:"\u2622",raised_hand:"\u270B",recycle:"\u267B",registered:"\xAE",relaxed:"\u263A",rewind:"\u23EA",scissors:"\u2702",snowman:"\u2603",spades:"\u2660",sparkles:"\u2728",star:"\u2B50",sunny:"\u2600",tent:"\u26FA",trademark:"\u2122",triangle_with_vertical_bar:"\u23EF",umbrella:"\u2614",vertical_bars:"\u23F8",watch:"\u231A",white_frowning_face:"\u2639",white_medium_square:"\u25FB",white_medium_small_square:"\u25FD",white_small_square:"\u25AB",wheelchair:"\u267F",white_circle:"\u26AA",writing_hand:"\u270D"};function rt(i){try{let t=path.extname(i),n=path.basename(i,t),r=path.dirname(i),o=i.slice(0,i.length-t.length);return{extension:t,filePath:o,basename:n,dirname:r}}catch(t){console.error("FILEPATH_EXT_FAILURE: ",t.message)}return{extension:".log",filePath:i}}function ot(){return new Date().toISOString().replace(/:/g,"-").replace(/\./g,"-")}function it(i,t,n,r,o,s,a){fs.readdir(i,(l,f)=>{if(l){a(l,null);return}let d=[],h=0,g=(b,w)=>{if(!fs.existsSync(b)){w(null,null);return}fs.unlink(b,F=>{F?console.error(`DELETION_FAILURE: Error deleting file ${b}: ${F}`):d.push(b),h++,h===f.length&&w(null,d)})},v=b=>{if(b.startsWith(t+".")&&b.endsWith(n+r)){let w=path.join(i,b);o&&ct(w,o,s),g(w,a)}else h++,h===f.length&&a(null,d)};f.length===0?a(null,d):f.forEach(v,s)})}function st(i,t={}){let n=document.createElement("script");n.textContent=i;for(let r in t)n.setAttribute(r,t[r]);document.head.appendChild(n),n.remove()}function at(){let i=[];return i.push(`!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).htmlToImage={})}(this,(function(t){"use strict";function e(t,e,n,r){return new(n||(n=Promise))((function(i,o){function u(t){try{a(r.next(t))}catch(t){o(t)}}function c(t){try{a(r.throw(t))}catch(t){o(t)}}function a(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(u,c)}a((r=r.apply(t,e||[])).next())}))}function n(t,e){var n,r,i,o,u={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function c(c){return function(a){return function(c){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,c[0]&&(u=0)),u;)try{if(n=1,r&&(i=2&c[0]?r.return:c[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,c[1])).done)return i;switch(r=0,i&&(c=[2&c[0],i.value]),c[0]){case 0:case 1:i=c;break;case 4:return u.label++,{value:c[1],done:!1};case 5:u.label++,r=c[1],c=[0];continue;case 7:c=u.ops.pop(),u.trys.pop();continue;default:if(!(i=u.trys,(i=i.length>0&&i[i.length-1])||6!==c[0]&&2!==c[0])){u=0;continue}if(3===c[0]&&(!i||c[1]>i[0]&&c[1]<i[3])){u.label=c[1];break}if(6===c[0]&&u.label<i[1]){u.label=i[1],i=c;break}if(i&&u.label<i[2]){u.label=i[2],u.ops.push(c);break}i[2]&&u.ops.pop(),u.trys.pop();continue}c=e.call(t,u)}catch(t){c=[6,t],r=0}finally{n=i=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,a])}}}var r,i=(r=0,function(){return r+=1,"u".concat("0000".concat((Math.random()*Math.pow(36,4)<<0).toString(36)).slice(-4)).concat(r)});function o(t){for(var e=[],n=0,r=t.length;n<r;n++)e.push(t[n]);return e}var u=null;function c(t){return void 0===t&&(t={}),u||(u=t.includeStyleProperties?t.includeStyleProperties:o(window.getComputedStyle(document.documentElement)))}function a(t,e){var n=(t.ownerDocument.defaultView||window).getComputedStyle(t).getPropertyValue(e);return n?parseFloat(n.replace("px","")):0}function s(t,e){void 0===e&&(e={});var n,r,i,o=e.width||(r=a(n=t,"border-left-width"),i=a(n,"border-right-width"),n.clientWidth+r+i),u=e.height||function(t){var e=a(t,"border-top-width"),n=a(t,"border-bottom-width");return t.clientHeight+e+n}(t);return{width:o,height:u}}var l=16384;function f(t,e){return void 0===e&&(e={}),t.toBlob?new Promise((function(n){t.toBlob(n,e.type?e.type:"image/png",e.quality?e.quality:1)})):new Promise((function(n){for(var r=window.atob(t.toDataURL(e.type?e.type:void 0,e.quality?e.quality:void 0).split(",")[1]),i=r.length,o=new Uint8Array(i),u=0;u<i;u+=1)o[u]=r.charCodeAt(u);n(new Blob([o],{type:e.type?e.type:"image/png"}))}))}function h(t){return new Promise((function(e,n){var r=new Image;r.onload=function(){r.decode().then((function(){requestAnimationFrame((function(){return e(r)}))}))},r.onerror=n,r.crossOrigin="anonymous",r.decoding="async",r.src=t}))}function d(t){return e(this,void 0,void 0,(function(){return n(this,(function(e){return[2,Promise.resolve().then((function(){return(new XMLSerializer).serializeToString(t)})).then(encodeURIComponent).then((function(t){return"data:image/svg+xml;charset=utf-8,".concat(t)}))]}))}))}function v(t,r,i){return e(this,void 0,void 0,(function(){var e,o,u;return n(this,(function(n){return e="http://www.w3.org/2000/svg",o=document.createElementNS(e,"svg"),u=document.createElementNS(e,"foreignObject"),o.setAttribute("width","".concat(r)),o.setAttribute("height","".concat(i)),o.setAttribute("viewBox","0 0 ".concat(r," ").concat(i)),u.setAttribute("width","100%"),u.setAttribute("height","100%"),u.setAttribute("x","0"),u.setAttribute("y","0"),u.setAttribute("externalResourcesRequired","true"),o.appendChild(u),u.appendChild(t),[2,d(o)]}))}))}var p=function(t,e){if(t instanceof e)return!0;var n=Object.getPrototypeOf(t);return null!==n&&(n.constructor.name===e.name||p(n,e))};function g(t,e,n,r){var i=".".concat(t,":").concat(e),o=n.cssText?function(t){var e=t.getPropertyValue("content");return"".concat(t.cssText," content: '").concat(e.replace(/'|"/g,""),"';")}(n):function(t,e){return c(e).map((function(e){var n=t.getPropertyValue(e),r=t.getPropertyPriority(e);return"".concat(e,": ").concat(n).concat(r?" !important":"",";")})).join(" ")}(n,r);return document.createTextNode("".concat(i,"{").concat(o,"}"))}function m(t,e,n,r){var o=window.getComputedStyle(t,n),u=o.getPropertyValue("content");if(""!==u&&"none"!==u){var c=i();try{e.className="".concat(e.className," ").concat(c)}catch(t){return}var a=document.createElement("style");a.appendChild(g(c,n,o,r)),e.appendChild(a)}}var w="application/font-woff",y="image/jpeg",b={woff:w,woff2:w,ttf:"application/font-truetype",eot:"application/vnd.ms-fontobject",png:"image/png",jpg:y,jpeg:y,gif:"image/gif",tiff:"image/tiff",svg:"image/svg+xml",webp:"image/webp"};function S(t){var e=function(t){var e=/\\.([^./]*?)$/g.exec(t);return e?e[1]:""}(t).toLowerCase();return b[e]||""}function E(t){return-1!==t.search(/^(data:)/)}function x(t,e){return"data:".concat(e,";base64,").concat(t)}function C(t,r,i){return e(this,void 0,void 0,(function(){var e,o;return n(this,(function(n){switch(n.label){case 0:return[4,fetch(t,r)];case 1:if(404===(e=n.sent()).status)throw new Error('Resource "'.concat(e.url,'" not found'));return[4,e.blob()];case 2:return o=n.sent(),[2,new Promise((function(t,n){var r=new FileReader;r.onerror=n,r.onloadend=function(){try{t(i({res:e,result:r.result}))}catch(t){n(t)}},r.readAsDataURL(o)}))]}}))}))}var P={};function R(t,r,i){return e(this,void 0,void 0,(function(){var e,o,u,c,a;return n(this,(function(n){switch(n.label){case 0:if(e=function(t,e,n){var r=t.replace(/\\?.*/,"");return n&&(r=t),/ttf|otf|eot|woff2?/i.test(r)&&(r=r.replace(/.*\\//,"")),e?"[".concat(e,"]").concat(r):r}(t,r,i.includeQueryParams),null!=P[e])return[2,P[e]];i.cacheBust&&(t+=(/\\?/.test(t)?"&":"?")+(new Date).getTime()),n.label=1;case 1:return n.trys.push([1,3,,4]),[4,C(t,i.fetchRequestInit,(function(t){var e=t.res,n=t.result;return r||(r=e.headers.get("Content-Type")||""),function(t){return t.split(/,/)[1]}(n)}))];case 2:return u=n.sent(),o=x(u,r),[3,4];case 3:return c=n.sent(),o=i.imagePlaceholder||"",a="Failed to fetch resource: ".concat(t),c&&(a="string"==typeof c?c:c.message),a&&console.warn(a),[3,4];case 4:return P[e]=o,[2,o]}}))}))}function T(t){return e(this,void 0,void 0,(function(){var e;return n(this,(function(n){return"data:,"===(e=t.toDataURL())?[2,t.cloneNode(!1)]:[2,h(e)]}))}))}function A(t,r){return e(this,void 0,void 0,(function(){var e,i,o,u;return n(this,(function(n){switch(n.label){case 0:return t.currentSrc?(e=document.createElement("canvas"),i=e.getContext("2d"),e.width=t.clientWidth,e.height=t.clientHeight,null==i||i.drawImage(t,0,0,e.width,e.height),[2,h(e.toDataURL())]):(o=t.poster,u=S(o),[4,R(o,u,r)]);case 1:return[2,h(n.sent())]}}))}))}function k(t,r){var i;return e(this,void 0,void 0,(function(){return n(this,(function(e){switch(e.label){case 0:return e.trys.push([0,3,,4]),(null===(i=null==t?void 0:t.contentDocument)||void 0===i?void 0:i.body)?[4,I(t.contentDocument.body,r,!0)]:[3,2];case 1:return[2,e.sent()];case 2:return[3,4];case 3:return e.sent(),[3,4];case 4:return[2,t.cloneNode(!1)]}}))}))}var L=function(t){return null!=t.tagName&&"SVG"===t.tagName.toUpperCase()};function N(t,e,n){return p(e,Element)&&(function(t,e,n){var r=e.style;if(r){var i=window.getComputedStyle(t);i.cssText?(r.cssText=i.cssText,r.transformOrigin=i.transformOrigin):c(n).forEach((function(n){var o=i.getPropertyValue(n);if("font-size"===n&&o.endsWith("px")){var u=Math.floor(parseFloat(o.substring(0,o.length-2)))-.1;o="".concat(u,"px")}p(t,HTMLIFrameElement)&&"display"===n&&"inline"===o&&(o="block"),"d"===n&&e.getAttribute("d")&&(o="path(".concat(e.getAttribute("d"),")")),r.setProperty(n,o,i.getPropertyPriority(n))}))}}(t,e,n),function(t,e,n){m(t,e,":before",n),m(t,e,":after",n)}(t,e,n),function(t,e){p(t,HTMLTextAreaElement)&&(e.innerHTML=t.value),p(t,HTMLInputElement)&&e.setAttribute("value",t.value)}(t,e),function(t,e){if(p(t,HTMLSelectElement)){var n=e,r=Array.from(n.children).find((function(e){return t.value===e.getAttribute("value")}));r&&r.setAttribute("selected","")}}(t,e)),e}function I(t,r,i){return e(this,void 0,void 0,(function(){return n(this,(function(u){return i||!r.filter||r.filter(t)?[2,Promise.resolve(t).then((function(t){return function(t,r){return e(this,void 0,void 0,(function(){return n(this,(function(e){return p(t,HTMLCanvasElement)?[2,T(t)]:p(t,HTMLVideoElement)?[2,A(t,r)]:p(t,HTMLIFrameElement)?[2,k(t,r)]:[2,t.cloneNode(L(t))]}))}))}(t,r)})).then((function(i){return function(t,r,i){var u,c;return e(this,void 0,void 0,(function(){var e;return n(this,(function(n){switch(n.label){case 0:return L(r)?[2,r]:(e=[],0===(e=null!=(a=t).tagName&&"SLOT"===a.tagName.toUpperCase()&&t.assignedNodes?o(t.assignedNodes()):p(t,HTMLIFrameElement)&&(null===(u=t.contentDocument)||void 0===u?void 0:u.body)?o(t.contentDocument.body.childNodes):o((null!==(c=t.shadowRoot)&&void 0!==c?c:t).childNodes)).length||p(t,HTMLVideoElement)?[2,r]:[4,e.reduce((function(t,e){return t.then((function(){return I(e,i)})).then((function(t){t&&r.appendChild(t)}))}),Promise.resolve())]);case 1:return n.sent(),[2,r]}var a}))}))}(t,i,r)})).then((function(e){return N(t,e,r)})).then((function(t){return function(t,r){return e(this,void 0,void 0,(function(){var e,i,o,u,c,a,s,l,f,h,d,v,p;return n(this,(function(n){switch(n.label){case 0:if(0===(e=t.querySelectorAll?t.querySelectorAll("use"):[]).length)return[2,t];i={},p=0,n.label=1;case 1:return p<e.length?(o=e[p],(u=o.getAttribute("xlink:href"))?(c=t.querySelector(u),a=document.querySelector(u),c||!a||i[u]?[3,3]:(s=i,l=u,[4,I(a,r,!0)])):[3,3]):[3,4];case 2:s[l]=n.sent(),n.label=3;case 3:return p++,[3,1];case 4:if((f=Object.values(i)).length){for(h="http://www.w3.org/1999/xhtml",(d=document.createElementNS(h,"svg")).setAttribute("xmlns",h),d.style.position="absolute",d.style.width="0",d.style.height="0",d.style.overflow="hidden",d.style.display="none",v=document.createElementNS(h,"defs"),d.appendChild(v),p=0;p<f.length;p++)v.appendChild(f[p]);t.appendChild(d)}return[2,t]}}))}))}(t,r)}))]:[2,null]}))}))}var D=/url\\((['"]?)([^'"]+?)\\1\\)/g,H=/url\\([^)]+\\)\\s*format\\((["']?)([^"']+)\\1\\)/g,M=/src:\\s*(?:url\\([^)]+\\)\\s*format\\([^)]+\\)[,;]\\s*)+/g;function F(t,r,i,o,u){return e(this,void 0,void 0,(function(){var e,c,a,s;return n(this,(function(n){switch(n.label){case 0:return n.trys.push([0,5,,6]),e=i?function(t,e){if(t.match(/^[a-z]+:\\/\\//i))return t;if(t.match(/^\\/\\//))return window.location.protocol+t;if(t.match(/^[a-z]+:/i))return t;var n=document.implementation.createHTMLDocument(),r=n.createElement("base"),i=n.createElement("a");return n.head.appendChild(r),n.body.appendChild(i),e&&(r.href=e),i.href=t,i.href}(r,i):r,c=S(r),a=void 0,u?[4,u(e)]:[3,2];case 1:return s=n.sent(),a=x(s,c),[3,4];case 2:return[4,R(e,c,o)];case 3:a=n.sent(),n.label=4;case 4:return[2,t.replace((l=r,f=l.replace(/([.*+?^$`),i.push(`{}()|\\[\\]\\/\\\\])/g,"\\\\$1"),new RegExp("(url\\\\(['\\"]?)(".concat(f,")(['\\"]?\\\\))"),"g")),"$1".concat(a,"$3"))];case 5:return n.sent(),[3,6];case 6:return[2,t]}var l,f}))}))}function V(t){return-1!==t.search(D)}function q(t,r,i){return e(this,void 0,void 0,(function(){var e,o;return n(this,(function(n){return V(t)?(e=function(t,e){var n=e.preferredFontFormat;return n?t.replace(M,(function(t){for(;;){var e=H.exec(t)||[],r=e[0],i=e[2];if(!i)return"";if(i===n)return"src: ".concat(r,";")}})):t}(t,i),o=function(t){var e=[];return t.replace(D,(function(t,n,r){return e.push(r),t})),e.filter((function(t){return!E(t)}))}(e),[2,o.reduce((function(t,e){return t.then((function(t){return F(t,e,r,i)}))}),Promise.resolve(e))]):[2,t]}))}))}function U(t,r,i){var o;return e(this,void 0,void 0,(function(){var e,u;return n(this,(function(n){switch(n.label){case 0:return(e=null===(o=r.style)||void 0===o?void 0:o.getPropertyValue(t))?[4,q(e,null,i)]:[3,2];case 1:return u=n.sent(),r.style.setProperty(t,u,r.style.getPropertyPriority(t)),[2,!0];case 2:return[2,!1]}}))}))}function j(t,r){return e(this,void 0,void 0,(function(){var e,i;return n(this,(function(n){switch(n.label){case 0:return[4,U("background",t,r)];case 1:return n.sent()?[3,3]:[4,U("background-image",t,r)];case 2:n.sent(),n.label=3;case 3:return[4,U("mask",t,r)];case 4:return(i=n.sent())?[3,6]:[4,U("-webkit-mask",t,r)];case 5:i=n.sent(),n.label=6;case 6:return(e=i)?[3,8]:[4,U("mask-image",t,r)];case 7:e=n.sent(),n.label=8;case 8:return e?[3,10]:[4,U("-webkit-mask-image",t,r)];case 9:n.sent(),n.label=10;case 10:return[2]}}))}))}function O(t,r){return e(this,void 0,void 0,(function(){var e,i,o;return n(this,(function(n){switch(n.label){case 0:return(e=p(t,HTMLImageElement))&&!E(t.src)||p(t,SVGImageElement)&&!E(t.href.baseVal)?[4,R(i=e?t.src:t.href.baseVal,S(i),r)]:[2];case 1:return o=n.sent(),[4,new Promise((function(n,i){t.onload=n,t.onerror=r.onImageErrorHandler?function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];try{n(r.onImageErrorHandler.apply(r,t))}catch(t){i(t)}}:i;var u=t;u.decode&&(u.decode=n),"lazy"===u.loading&&(u.loading="eager"),e?(t.srcset="",t.src=o):t.href.baseVal=o}))];case 2:return n.sent(),[2]}}))}))}function B(t,r){return e(this,void 0,void 0,(function(){var e,i;return n(this,(function(n){switch(n.label){case 0:return e=o(t.childNodes),i=e.map((function(t){return z(t,r)})),[4,Promise.all(i).then((function(){return t}))];case 1:return n.sent(),[2]}}))}))}function z(t,r){return e(this,void 0,void 0,(function(){return n(this,(function(e){switch(e.label){case 0:return p(t,Element)?[4,j(t,r)]:[3,4];case 1:return e.sent(),[4,O(t,r)];case 2:return e.sent(),[4,B(t,r)];case 3:e.sent(),e.label=4;case 4:return[2]}}))}))}var W={};function $(t){return e(this,void 0,void 0,(function(){var e,r;return n(this,(function(n){switch(n.label){case 0:return null!=(e=W[t])?[2,e]:[4,fetch(t)];case 1:return[4,n.sent().text()];case 2:return r=n.sent(),e={url:t,cssText:r},W[t]=e,[2,e]}}))}))}function G(t,r){return e(this,void 0,void 0,(function(){var i,o,u,c,a=this;return n(this,(function(s){return i=t.cssText,o=/url\\(["']?([^"')]+)["']?\\)/g,u=i.match(/url\\([^)]+\\)/g)||[],c=u.map((function(u){return e(a,void 0,void 0,(function(){var e;return n(this,(function(n){return(e=u.replace(o,"$1")).startsWith("https://")||(e=new URL(e,t.url).href),[2,C(e,r.fetchRequestInit,(function(t){var e=t.result;return i=i.replace(u,"url(".concat(e,")")),[u,e]}))]}))}))})),[2,Promise.all(c).then((function(){return i}))]}))}))}function _(t){if(null==t)return[];for(var e=[],n=t.replace(/(\\/\\*[\\s\\S]*?\\*\\/)/gi,""),r=new RegExp("((@.*?keyframes [\\\\s\\\\S]*?){([\\\\s\\\\S]*?}\\\\s*?)})","gi");;){if(null===(u=r.exec(n)))break;e.push(u[0])}n=n.replace(r,"");for(var i=/@import[\\s\\S]*?url\\([^)]*\\)[\\s\\S]*?;/gi,o=new RegExp("((\\\\s*?(?:\\\\/\\\\*[\\\\s\\\\S]*?\\\\*\\\\/)?\\\\s*?@media[\\\\s\\\\S]*?){([\\\\s\\\\S]*?)}\\\\s*?})|(([\\\\s\\\\S]*?){([\\\\s\\\\S]*?)})","gi");;){var u;if(null===(u=i.exec(n))){if(null===(u=o.exec(n)))break;i.lastIndex=o.lastIndex}else o.lastIndex=i.lastIndex;e.push(u[0])}return e}function J(t,r){return e(this,void 0,void 0,(function(){var e,i;return n(this,(function(n){return e=[],i=[],t.forEach((function(e){if("cssRules"in e)try{o(e.cssRules||[]).forEach((function(t,n){if(t.type===CSSRule.IMPORT_RULE){var o=n+1,u=$(t.href).then((function(t){return G(t,r)})).then((function(t){return _(t).forEach((function(t){try{e.insertRule(t,t.startsWith("@import")?o+=1:e.cssRules.length)}catch(e){console.error("Error inserting rule from remote css",{rule:t,error:e})}}))})).catch((function(t){console.error("Error loading remote css",t.toString())}));i.push(u)}}))}catch(o){var n=t.find((function(t){return null==t.href}))||document.styleSheets[0];null!=e.href&&i.push($(e.href).then((function(t){return G(t,r)})).then((function(t){return _(t).forEach((function(t){n.insertRule(t,n.cssRules.length)}))})).catch((function(t){console.error("Error loading remote stylesheet",t)}))),console.error("Error inlining remote css file",o)}})),[2,Promise.all(i).then((function(){return t.forEach((function(t){if("cssRules"in t)try{o(t.cssRules||[]).forEach((function(t){e.push(t)}))}catch(e){console.error("Error while reading CSS rules from ".concat(t.href),e)}})),e}))]}))}))}function Q(t){return t.filter((function(t){return t.type===CSSRule.FONT_FACE_RULE})).filter((function(t){return V(t.style.getPropertyValue("src"))}))}function X(t,r){return e(this,void 0,void 0,(function(){return n(this,(function(e){switch(e.label){case 0:if(null==t.ownerDocument)throw new Error("Provided element is not within a Document");return[4,J(o(t.ownerDocument.styleSheets),r)];case 1:return[2,Q(e.sent())]}}))}))}function K(t){return t.trim().replace(/["']/g,"")}function Y(t,r){return e(this,void 0,void 0,(function(){var e,i;return n(this,(function(n){switch(n.label){case 0:return[4,X(t,r)];case 1:return e=n.sent(),i=function(t){var e=new Set;return function t(n){(n.style.fontFamily||getComputedStyle(n).fontFamily).split(",").forEach((function(t){e.add(K(t))})),Array.from(n.children).forEach((function(e){e instanceof HTMLElement&&t(e)}))}(t),e}(t),[4,Promise.all(e.filter((function(t){return i.has(K(t.style.fontFamily))})).map((function(t){var e=t.parentStyleSheet?t.parentStyleSheet.href:null;return q(t.cssText,e,r)})))];case 2:return[2,n.sent().join("\\n")]}}))}))}function Z(t,r){return e(this,void 0,void 0,(function(){var e,i,o,u,c;return n(this,(function(n){switch(n.label){case 0:return null==r.fontEmbedCSS?[3,1]:(i=r.fontEmbedCSS,[3,5]);case 1:return r.skipFonts?(o=null,[3,4]):[3,2];case 2:return[4,Y(t,r)];case 3:o=n.sent(),n.label=4;case 4:i=o,n.label=5;case 5:return(e=i)&&(u=document.createElement("style"),c=document.createTextNode(e),u.appendChild(c),t.firstChild?t.insertBefore(u,t.firstChild):t.appendChild(u)),[2]}}))}))}function tt(t,r){return void 0===r&&(r={}),e(this,void 0,void 0,(function(){var e,i,o,u;return n(this,(function(n){switch(n.label){case 0:return e=s(t,r),i=e.width,o=e.height,[4,I(t,r,!0)];case 1:return[4,Z(u=n.sent(),r)];case 2:return n.sent(),[4,z(u,r)];case 3:return n.sent(),function(t,e){var n=t.style;e.backgroundColor&&(n.backgroundColor=e.backgroundColor),e.width&&(n.width="".concat(e.width,"px")),e.height&&(n.height="".concat(e.height,"px"));var r=e.style;null!=r&&Object.keys(r).forEach((function(t){n[t]=r[t]}))}(u,r),[4,v(u,i,o)];case 4:return[2,n.sent()]}}))}))}function et(t,r){return void 0===r&&(r={}),e(this,void 0,void 0,(function(){var e,i,o,u,c,a,f,d,v;return n(this,(function(n){switch(n.label){case 0:return e=s(t,r),i=e.width,o=e.height,[4,tt(t,r)];case 1:return[4,h(n.sent())];case 2:return u=n.sent(),c=document.createElement("canvas"),a=c.getContext("2d"),f=r.pixelRatio||function(){var t,e;try{e=process}catch(t){}var n=e&&e.env?e.env.devicePixelRatio:null;return n&&(t=parseInt(n,10),Number.isNaN(t)&&(t=1)),t||window.devicePixelRatio||1}(),d=r.canvasWidth||i,v=r.canvasHeight||o,c.width=d*f,c.height=v*f,r.skipAutoScale||function(t){(t.width>l||t.height>l)&&(t.width>l&&t.height>l?t.width>t.height?(t.height*=l/t.width,t.width=l):(t.width*=l/t.height,t.height=l):t.width>l?(t.height*=l/t.width,t.width=l):(t.width*=l/t.height,t.height=l))}(c),c.style.width="".concat(d),c.style.height="".concat(v),r.backgroundColor&&(a.fillStyle=r.backgroundColor,a.fillRect(0,0,c.width,c.height)),a.drawImage(u,0,0,c.width,c.height),[2,c]}}))}))}t.getFontEmbedCSS=function(t,r){return void 0===r&&(r={}),e(this,void 0,void 0,(function(){return n(this,(function(e){return[2,Y(t,r)]}))}))},t.toBlob=function(t,r){return void 0===r&&(r={}),e(this,void 0,void 0,(function(){return n(this,(function(e){switch(e.label){case 0:return[4,et(t,r)];case 1:return[4,f(e.sent())];case 2:return[2,e.sent()]}}))}))},t.toCanvas=et,t.toJpeg=function(t,r){return void 0===r&&(r={}),e(this,void 0,void 0,(function(){return n(this,(function(e){switch(e.label){case 0:return[4,et(t,r)];case 1:return[2,e.sent().toDataURL("image/jpeg",r.quality||1)]}}))}))},t.toPixelData=function(t,r){return void 0===r&&(r={}),e(this,void 0,void 0,(function(){var e,i,o,u;return n(this,(function(n){switch(n.label){case 0:return e=s(t,r),i=e.width,o=e.height,[4,et(t,r)];case 1:return u=n.sent(),[2,u.getContext("2d").getImageData(0,0,i,o).data]}}))}))},t.toPng=function(t,r){return void 0===r&&(r={}),e(this,void 0,void 0,(function(){return n(this,(function(e){switch(e.label){case 0:return[4,et(t,r)];case 1:return[2,e.sent().toDataURL()]}}))}))},t.toSvg=tt}));`),i.join("")}function ct(i,t,n=1){try{if(!fs.existsSync(i))return;if(!fs.existsSync(t)){let o=fs.mkdtempSync(path.join(os.tmpdir(),"tar-gz-init-"));try{let s=path.join(o,path.basename(i));fs.copyFileSync(i,s),c({sync:!0,gzip:{level:n},file:t,cwd:o,portable:!0},[path.basename(i)])}finally{fs.rmSync(o,{recursive:!0,force:!0})}return}let r=fs.mkdtempSync(path.join(os.tmpdir(),"tar-gz-append-"));try{x({file:t,cwd:r,sync:!0});let o=path.join(r,path.basename(i));fs.copyFileSync(i,o),c({gzip:!0,file:t,cwd:r,sync:!0,portable:!0},fs.readdirSync(r))}finally{fs.rmSync(r,{recursive:!0,force:!0})}}catch{console.error(`ARCHIVE_FAILURE: ${e.message}`)}}function Ae(){return typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node<"u"?U.NODE:U.BROWSER}var lt=Ae();function ut(){return lt===U.NODE}var ft=["alert","assert","keepLogHistory","getLogHistory","truncateMessage","truncateMessage","rawLog","removeOverride","removeOverrideError","overrideConsole","overrideError","table","rawInfo","rawWarn","rawError","hasSeenLid","addToLogHistory","releaseLogHistory","resetLogHistory","setLogFormat","resetLogFormatter","getRawLogHistory"],B,A,C,N,T,J,Re,X,Ce,u=class{constructor({name:t="default"}={}){O(this,J);O(this,X);p(this,"system","");p(this,"instanceId","");p(this,"instanceName","");p(this,"logIndex",0);p(this,"logCounter",0);O(this,A,[]);O(this,C,{});O(this,N,{});p(this,"activeTargets",[]);p(this,"indexColor",0);p(this,"format","");p(this,"keepLog",!1);p(this,"logHistory",[]);p(this,"$containers",null);p(this,"options",{hideHookMessage:!1});O(this,T,{log:!1,info:!1,warn:!1,error:!1});p(this,"originalFormatFunction");p(this,"removeDomOldEntries",t=>{if(t.childElementCount>se){let r=Math.ceil(se/10);for(let o=0;o<r;++o)t.removeChild(t.firstChild);return r}return 0});p(this,"scrollDivToBottom",t=>{let n=t.scrollHeight-(t.clientHeight+t.scrollTop),r=t.clientHeight||t.offsetHeight;n>r/2||(t.scrollTop=t.scrollHeight)});this.system=Ae(),this.format=this.onBuildLog.bind(this),this.originalFormatFunction=this.format,this.instanceName=t,this.instanceId=u.instanceCount+"-"+Date.now(),m(u,B)[u.instanceCount]=this,++u.instanceCount,this.errorTargetHandler=this.onError.bind(this),this.errorUserTargetHandler=this.onErrorForUserTarget.bind(this),this.setOptions(this.options),u.Console||(u.Console={log:console.log,info:console.info,warn:console.warn,error:console.error,debug:console.debug,table:console.table}),this.rawLog=u.Console.log,this.rawInfo=u.Console.info,this.rawWarn=u.Console.warn,this.rawError=u.Console.error,this.ALIGN=u.ALIGN,this.ENVIRONMENT_TYPE=u.ENVIRONMENT_TYPE,re(this,X,Ce).call(this),this.resetLogHistory()}getName(){return this.instanceName}getId(){return this.instanceId}keepLogHistory(){this.keepLog=!0}releaseLogHistory(){this.keepLog=!1}resetLogHistory(){this.logHistory=[]}addToLogHistory(t){t=t||{},this.logHistory.push(Object.assign({},t))}getLogHistory(t=!0,n=nt){let r=this.logHistory||[],o=[];return r.forEach(s=>{let{text:a}=s;o.push(a)}),t?o.join(n):o}getRawLogHistory(){return this.logHistory||[]}hasSeenLid(t){this.logHistory=this.logHistory||[];for(let n=0;n<this.logHistory.length;++n){let o=(this.logHistory[n]||{}).context||{};if(t===o.lid)return!0}return!1}forceEnvironment(t){this.forcedSystem=t}isNode(){return this&&this.forcedSystem?this.forcedSystem===U.NODE:ut()}isBrowser(){return!this.isNode()}resetLogger(){this.options={},this.options.timeLenMax=12,this.options.contextLenMax=10,this.options.idLenMax=5,this.options.lidLenMax=6,this.options.messageLenMax=void 0,this.options.symbolLenMax=60,this.options.hideHookMessage=void 0,this.options.hidePassingTests=void 0,this.options.hideLog=void 0,this.options.hideError=void 0,this.options.oneConsolePerContext=!0,this.options.logToDom=void 0,this.options.logToFile=void 0,this.options.logMaxSize=0,this.options.logMaxArchives=3,this.options.logIndexArchive=0,this.options.logToRemote=void 0,this.options.addArchiveTimestamp=!0,this.options.addArchiveIndex=!0,this.options.logToRemoteUrl=void 0,this.options.logToRemoteBinaryUrl=void 0,this.options.compressArchives=!1,this.options.compressionLevel=1,this.options.protocol=void 0,this.options.host=void 0,this.options.port=void 0,this.options.pathname=void 0,this.options.binarypathname=void 0,this.options.enableDate=void 0}resetOptions(){this.resetLogger()}setOptions({contextLenMax:t=10,idLenMax:n=5,lidLenMax:r=6,symbolLenMax:o=2,messageLenMax:s=void 0,hideLog:a=void 0,hideError:l=void 0,hideHookMessage:f=void 0,hidePassingTests:d=void 0,logToDom:h=void 0,logToFile:g=void 0,logMaxSize:v=0,logMaxArchives:b=3,logIndexArchive:w=0,addArchiveTimestamp:F=!0,addArchiveIndex:K=!0,compressArchives:Q=!1,compressionLevel:Z=1,logToRemote:Ne=void 0,logToRemoteUrl:Fe=void 0,logToRemoteBinaryUrl:Ie=void 0,loopback:Me=E.loopback,requiredLogLevel:De=y.LOG,oneConsolePerContext:ke=void 0,silent:fe=void 0,enableDate:Pe=void 0,protocol:He=void 0,host:Ue=void 0,port:_e=void 0,pathname:Be=void 0,binarypathname:je=void 0,loadHtmlToImage:Ge=!1}=null){if(this.options.contextLenMax=t,this.options.idLenMax=n,this.options.lidLenMax=r,this.options.messageLenMax=s,this.options.symbolLenMax=o,this.options.logMaxSize=v,this.options.logMaxArchives=b,this.options.logIndexArchive=w,this.options.addArchiveTimestamp=F,this.options.addArchiveIndex=K,this.options.compressArchives=Q,this.options.compressionLevel=Z,this.options.requiredLogLevel=De,Ge){let R=at();st(R)}let ee;fe!==void 0?ee=!!fe:a!==void 0&&(ee=!!a),[{hideLog:ee},{oneConsolePerContext:ke},{hideError:l},{enableDate:Pe},{hideHookMessage:f},{hidePassingTests:d},{logToRemote:Ne}].forEach(R=>{let P=Object.keys(R)[0],H=R[P];H!==void 0&&(this.options[P]=!!H)}),[{logToRemoteBinaryUrl:Ie},{logToRemoteUrl:Fe},{loopback:Me},{protocol:He},{host:Ue},{port:_e},{pathname:Be},{binarypathname:je}].forEach(R=>{let P=Object.keys(R)[0],H=R[P];H!==void 0&&(this.options[P]=H)}),this.options.logToRemote&&!this.options.logToRemoteUrl&&(this.options.logToRemoteUrl=this.convertToUrl({protocol:this.options.protocol,host:this.options.host,port:this.options.port,pathname:this.options.pathname})),this.options.logToRemote&&!this.options.logToRemoteBinaryUrl&&(this.options.logToRemoteBinaryUrl=this.convertToUrl({protocol:this.options.protocol,host:this.options.host,port:this.options.port,pathname:this.options.binarypathname||E.binarypathname})),h===!1?this.options.logToDom=!1:h!==void 0&&(this.options.logToDom=h===!0?E.consoleDomId:h),g===!1?this.options.logToFile=!1:g!==void 0&&(this.isBrowser()||(this.options.logToFile=g||E.logFilename),u.Console.log("LogToFile is not supported in this environment. "))}getOptions(){return this.options}truncateMessage(t="",{fit:n=0,align:r=u.ALIGN.LEFT,ellipsis:o="..."}={}){return t=""+t,n&&t.length>n&&(t=t.substring(0,n-o.length)+o),t=r===u.ALIGN.LEFT?t.padEnd(n," "):t.padStart(n," "),t}onBuildLog({contextName:t,message:n="",lid:r="",symbol:o=""}={}){try{let s="",a=n.split(/\n/g);for(let l=0;l<a.length;++l){let f=a[l],d=new Date,h=("0"+d.getHours()).slice(-2)+":"+("0"+d.getMinutes()).slice(-2)+":"+("0"+d.getSeconds()).slice(-2);this.options.enableDate&&(h=d.getFullYear().toString().slice(-2)+"-"+(d.getMonth()+1).toString().padStart(2,"0")+"-"+d.getDate().toString().padStart(2,"0")+" "+h),h=this.truncateMessage(h,{fit:this.options.timeLenMax}),l>0&&(t="",r=""),t=this.truncateMessage(t,{fit:this.options.contextLenMax,align:u.ALIGN.RIGHT}),r=this.truncateMessage(r,{fit:this.options.lidLenMax}),this.options.messageLenMax!==void 0&&(f=this.truncateMessage(f,{fit:this.options.messageLenMax})),o=this.truncateMessage(o,{fit:this.options.symbolLenMax}),l<=0?s+=`[${h}] ${t}: (${r}) ${o} ${f}`:l<a.length-1?(s+=`
4
3
  `,s+=`[${h}] ${t} ${r} ${f}`):f&&(s+=`
5
4
  `,s+=`[${h}] ${t} ${r} ${f}`)}return s}catch(s){console.rawError(s.message)}return""}onErrorForUserTarget(t,...n){this.errorUserTargetHandler(t,...n)}onError(t,...n){t.target===m(this,C).USER&&this.onErrorForUserTarget(t,...n)}onDisplayLog(...t){this.log(...t)}assistStask(t){try{let n=t.stack.split(`
6
5
  `),r=[];for(let o=0;o<n.length;++o){let s=n[o];r.push(s)}return r}catch(n){console.rawError(n.message)}return t.message}onDisplayError(...t){try{let n=-1,r=null;for(let o=0;o<t.length;++o){let s=t[o];if(s instanceof Error&&s.stack){n=o,r=this.assistStask(s)||[];break}}if(!r){this.error(...t);return}for(let o=0;o<r.length;++o)t[n]=r[o],this.error(...t)}catch(n){console.rawError(n)}}setLogFormat(t){if(typeof t!="function")return console.error("Invalid parameter for setFormat. It is expecting a function or method."),!1;this.format=t.bind(this)}resetLogFormatter(){this.format=this.originalFormatFunction}setErrorHandler(t){this.errorTargetHandler=t.bind(this)}setErrorHandlerForUserTarget(t){this.errorUserTargetHandler=t.bind(this)}isContextValid(t){return typeof t=="object"&&!Array.isArray(t)&&t!==null?t.hasOwnProperty("contextName")&&t.hasOwnProperty("target"):!1}setDefaultContext(t){this.setContext(_.DEFAULT.contextName,t)}generateDefaultContext(){let t=m(this,A)[_.DEFAULT.contextName]||{};return t=Object.assign({},{lid:"",contextName:_.DEFAULT.contextName,target:k.ALL,symbol:"\u26A1",color:D[1],logLevel:y.LOG},t),t.name=t.contextName,t.id=this.logIndex++,t}generateNewContext(){let t=this.generateDefaultContext();return t.color=D[this.indexColor++%(D.length-3)+2],t.symbol="",t}generateErrorContext(){let t=this.generateDefaultContext();return t.contextName=_.ERROR.contextName,t.name=t.contextName,t.color=D[0],t.symbol="\u274C",t.error=!0,t.logLevel=y.ERROR,t}setContext(t,n={}){n.contextName=t,n.name=t,n=re(this,J,Re).call(this,n),m(this,A)[t]=n}getContext(t){return m(this,A)[t]}setContexts(t){Object.keys(t).forEach(r=>{let o=t[r]||{};this.setContext(r,o),t[r]=m(this,A)[r]})}getContexts(){return Object.freeze(m(this,A))}setTargets(t={}){let n={};if(Array.isArray(t))try{for(let r=0;r<t.length;++r){let o=t[r];if(typeof o=="string"||o instanceof String)n[o]=o;else if(typeof o=="object"){let s=null;for(let a in o){let l=o[a];if(a=a.trim(),!a){console.error("Invalid target");break}if(typeof l=="string"||l instanceof String){l=l.trim(),s=[a,l];break}if(typeof l=="number")break}s&&(n[s[0]]=s[1])}}}catch(r){console.error({lid:4321},r.message)}else n=t;ne(this,C,Object.assign({},n,{...k}))}addTargets(t){let n=m(this,C),r=Object.assign({},n,t);this.setTargets(r)}getTargets(){return Object.freeze(m(this,C))}setActiveTargets(t=null){if(t===null){this.activeTargets=[k.ALL];return}else if(typeof t=="string"||t instanceof String)t=t.split(",");else if(typeof t=="object"||typeof t=="function")return;for(let n=0;n<t.length;++n)t[n]=t[n].trim();this.activeTargets=t}getActiveTarget(){return this.activeTargets}setActiveTarget(t){this.activeTargets=[],this.setActiveTargets(t),this.activeTargets=[this.activeTargets[0]]}setLogLevel(t,n){m(this,N)[t]=n}getLogLevel(t){return m(this,N)[t]}setLogLevels(t){ne(this,N,t)}getLogLevels(){return Object.freeze(m(this,N))}isTargetAllowed(t){return!t||!this.activeTargets||!this.activeTargets.length||t===k.ALL||this.activeTargets.includes(k.ALL)?!0:this.activeTargets.includes(t)}setColumns(t,n,r){let o=0;for(let a in n){if(!["contextName","symbol","lid","text"].includes(a))continue;let l=n[a],f=document.createElement("span");f.classList.add("analogger-col",`analogger-col-${a}`,`analogger-col-${o}`),++o,f.textContent=l,t.append(f)}let s=document.createElement("span");s.classList.add("analogger-col","analogger-col-text",`analogger-col-${o}`),s.textContent=r,t.append(s);for(let a=1;a<=3;++a)s=document.createElement("span"),s.classList.add("analogger-col","analogger-col-extra",`analogger-extra-${a}`),t.append(s)}checkOnLoggingToDom(t,n){try{let r=t.onLoggingToDom;return typeof r!="function"?void 0:r.call(this,t,n)}catch{}}addLineToDom(t,n,{context:r,addType:o,message:s,text:a,args:l}){if(this.checkOnLoggingToDom(r,{message:s,text:a,args:l,logCounter:this.logCounter,$view:t,$line:n,addType:o})===!1)return;if(o===W.BOTTOM?t.append(n):t.insertBefore(n,t.firstChild),this.removeDomOldEntries(t)){if(t.getElementsByClassName(ae).length)return;this.showRemovedNotification(r);return}this.scrollDivToBottom(t)}showRemovedNotification(t){t.contextName=we,t.symbol="\u{1F5D1}",t.color="orange",t.className=ae,clearTimeout(this.timerAddLineToDomID),this.timerAddLineToDomID=setTimeout(()=>{this.timerAddLineToDomID=null,this.writeLogToDom(t,"",{addType:W.TOP,message:"Oldest entries removed"})},500)}writeLogToDom(t,n,{addType:r=W.BOTTOM,message:o="",args:s=null}={}){this.$containers=this.$containers||document.querySelectorAll(this.options.logToDom),n=o||n;for(let a=0;a<this.$containers.length;++a){let l=this.$containers[a],f=l.querySelector("."+ce);f||(f=document.createElement("div"),f.classList.add(ce),f.append(document.createElement("span")),f.append(document.createElement("span")),f.append(document.createElement("span")),l.append(f));let d=l.querySelector("."+le);d||(d=document.createElement("div"),d.classList.add(le),l.append(d));let h=l.querySelector("."+ue);h||(h=document.createElement("div"),h.classList.add(ue),h.append(document.createElement("span")),h.append(document.createElement("span")),h.append(document.createElement("span")),l.append(h));let g=document.createElement("div");g.classList.add(Le),t.className&&g.classList.add(t.className),g.style.color=t.color,this.setColumns(g,t,n,s),setTimeout(function(v,b,{addType:w,context:F,message:K,text:Q,args:Z}){this.addLineToDom(v,b,{addType:w,context:F,message:K,text:Q,args:Z})}.bind(this,d,g,{addType:r,context:t,message:o,text:n,args:s}),0)}}writeLogToFile(t){try{if(!fs.existsSync(this.options.logToFilePath)){let n=path.dirname(this.options.logToFilePath);fs.existsSync(n)||fs.mkdirSync(n,{recursive:!0}),fs.writeFileSync(this.options.logToFilePath,"")}if(this.options.logMaxSize&&fs.statSync(this.options.logToFilePath).size>this.options.logMaxSize){this.options.logIndexArchive<this.options.logMaxArchives?++this.options.logIndexArchive:this.options.logIndexArchive=1;let o=this.options.logMaxArchives.toString().length+1,{filePath:s,extension:a,basename:l,dirname:f}=rt(this.options.logToFilePath),d,h;d=this.options.addArchiveIndex?"."+this.options.logIndexArchive.toString().padStart(o,"0"):"",h=this.options.addArchiveTimestamp?"."+ot():"";let g=`${s}${h}${d}${a}`,v=this.options.compressArchives?`${s}.tar.gz`:"";it(f,l,d,a,v,this.options.compressionLevel,b=>{b&&console.error("DELETION_FAILURE: Failed to delete some files")}),fs.renameSync(this.options.logToFilePath,g),fs.writeFileSync(this.options.logToFilePath,"")}fs.appendFileSync(this.options.logToFilePath,t+this.EOL)}catch(n){console.rawError("LOG_TO_FILE_FAILURE: ",n.message)}}writeLogToRemote(...t){try{let n=this.generateLogToRemoteUrl(this.options.logToRemoteUrl);if(!n)return null;let r=[...t],o=JSON.stringify(r);fetch(n,{method:"post",body:o,headers:{"Content-Type":"application/json"}}).then(s=>s.json()).catch(()=>null)}catch(n){console.rawError("LOG_TO_REMOTE_FAILURE: ",n.message)}}uploadDataToRemote(t,n=null,r=null){try{if(!this.options.logToRemote)return;let o=this.generateLogToRemoteUrl(this.options.logToRemoteBinaryUrl,{pathname:E.binarypathname});if(!o)return null;let s=t;n&&(s=JSON.stringify({raw:t,context:n})),fetch(o,{method:"post",body:s}).then(a=>a.json()).then(a=>r&&r(a)).catch(a=>a)}catch(o){console.rawError("BINARY_TO_REMOTE_FAILURE: ",o.message)}}stringifyEntry(t){let n;try{n=JSON.stringify(t)}catch{}if(!n)try{n=Oe(t)}catch{}return n}convertEntry(t){try{if(t==null||t==="")return t;if(typeof t=="boolean")return t;if(typeof t=="symbol"||typeof t=="number")return t;if(typeof t=="string"||myVar instanceof t)return t;if(t instanceof Date)return t}catch{}return this.stringifyEntry(t)}convertArgumentsToText(t){let n=[],r,o=t.length;for(let s=0;s<o;++s){let a,l=t[s];a=this.convertEntry(l),n.push(a)}return r=n.join("\u2022"),r}writeToConsole(t,n){let r=[t];this.isBrowser()&&r.push(`color: ${n.color}`);let o=n.contextLevel||y.LOG;o>=y.ERROR?u.Console.error(...r):o>=y.WARN?u.Console.warn(...r):o>=y.INFO?u.Console.info(...r):o>=y.LOG?u.Console.log(...r):o>=y.DEBUG&&u.Console.debug(...r)}checkPlugins(t,{message:n,text:r,args:o,logCounter:s}){try{if(!Object.keys(u.pluginTable).length)return;let a=!0;for(let l in t){let f=t[l];if(!f)continue;let d=u.pluginTable[l];if(!d||typeof d!="object")continue;let{callback:h,methodName:g,type:v}=d;if(typeof h!="function")continue;h.call(this,t,{message:n,text:r,args:o,logCounter:s,methodName:g,type:v,pluginOptions:f})===!1&&(a=!1)}return a}catch{}}checkOnLogging(t,n,r,o){if(!!o)try{let s=t[o];return typeof s!="function"?void 0:s.call(this,n,r)}catch{}}processOutput(t={}){try{let n="";if(this.applySymbolByName(t),this.checkOnLogging(t,t,arguments,"onContext"),!this.isTargetAllowed(t.target)||t.logLevel===y.OFF||this.options.requiredLogLevel>t.logLevel)return;let r=this.checkOnLogging(t,arguments&&arguments.length>1?arguments[1]:arguments,arguments,"onMessage");r!==void 0&&(arguments[1]=r);let o=Array.prototype.slice.call(arguments,1);n=this.convertArgumentsToText(o);let s="",a=this.format({...t,message:n});this.keepLog&&this.addToLogHistory({context:t,message:n,text:a}),++this.logCounter;let l=this.checkOnLogging(t,a,{message:n,args:o,logCounter:this.logCounter},"onOutput");if(l===!1||((typeof l=="string"||l instanceof String)&&(a=l),l=this.checkPlugins(t,{message:n,text:a,args:o,logCounter:this.logCounter}),l===!1)||(this.options.logToRemote&&this.writeLogToRemote(t,...o),this.isBrowser()?(t.environnment=u.ENVIRONMENT_TYPE.BROWSER,this.options.logToDom&&this.writeLogToDom(t,a,{message:n,args:o}),s=`%c${a}`):(t.environnment=u.ENVIRONMENT_TYPE.NODE,s=V.getTextFromColor(a,{fg:t.color,bg:t.bgColor,isBold:t.bold,isUnderline:t.underline,isReversed:t.reversed}),this.options.logToFile&&this.writeLogToFile(a)),this.options.hideLog||t.hideLog||t.silent))return;this.writeToConsole(s,t),this.errorTargetHandler(t,o)}catch(n){console.rawError("AnaLogger:",n.message)}}isExtendedOptionsPassed(t){return typeof t!="object"?!1:t.hasOwnProperty("context")||t.hasOwnProperty("target")||t.hasOwnProperty("color")||t.hasOwnProperty("contextName")||t.hasOwnProperty("raw")||t.hasOwnProperty("lid")}extractContextFromInput(t){return(typeof t=="string"||t instanceof String)&&t.toLowerCase().indexOf("lid:")!==0,t}listSymbols(){for(let t in Y)console.rawLog(Y[t]+` ${t} `)}applySymbolByName(t){try{t.symbol&&Y[t.symbol]&&(t.symbol=Y[t.symbol])}catch{}}convertToContext(t,n){t=t||n;let r=t;if(t.context&&typeof t.context=="object"){let o=Object.assign({},t);delete o.context,r=Object.assign({},t.context,o)}return r=Object.assign({},n,r),delete r.context,r}log(t,...n){if(t=this.extractContextFromInput(t),!this.isExtendedOptionsPassed(t)){let s=this.generateDefaultContext();this.processOutput.apply(this,[s,t,...n]);return}let r=this.generateDefaultContext(),o=this.convertToContext(t,r);if(o.raw){u.Console.log(...n);return}this.processOutput.apply(this,[o,...n])}error(t,...n){if(this.options.hideError)return;if(t=this.extractContextFromInput(t),!this.isExtendedOptionsPassed(t)){let a=this.generateErrorContext();this.processOutput.apply(this,[a,t,...n]);return}let r=this.generateErrorContext(),o=this.convertToContext(t,r),s=Array.prototype.slice.call(arguments,1);this.log(o,...s)}overrideError(){this.options.hideHookMessage||u.Console.log("AnaLogger: Hook placed on console.error"),m(this,T).error=!0,console.error=this.onDisplayError.bind(this)}attachConsole(){try{return console.rawLog=u.Console.log,console.raw=u.Console.log,console.rawInfo=u.Console.info,console.rawWarn=u.Console.warn,console.rawError=u.Console.error,console.logHistory=this.logHistory,console.logHistory=this.logHistory,ft.forEach(t=>{console[t]=function(...n){this[t](...n)}.bind(this)}),!0}catch(t){console.error({lid:4321},t.message)}return!1}overrideConsole({log:t=!0,info:n=!0,warn:r=!0,error:o=!1}={}){this.options.hideHookMessage||u.Console.log("AnaLogger: Hook placed on console.log"),[{log:t},{info:n},{warn:r}].forEach(function(s){let a=Object.keys(s)[0];s[a]&&(m(this,T)[a]=!0,console[a]=this.onDisplayLog.bind(this))}.bind(this)),o&&this.overrideError(),this.attachConsole()}removeOverrideError(){console.error=u.Console.error,m(this,T).error=!1}removeOverride({log:t=!0,info:n=!0,warn:r=!0,error:o=!1}={}){t&&(console.log=u.Console.log,m(this,T).log=!1),n&&(console.info=u.Console.info,m(this,T).info=!1),r&&(console.warn=u.Console.warn,m(this,T).warn=!1),o&&this.removeOverrideError()}info(...t){return this.log(...t)}warn(...t){return this.log(...t)}table(...t){if(!m(this,T).log){u.Console.table(...t);return}let n=console.log;console.log=u.Console.log,u.Console.table(...t),console.log=n}takeScreenshot(t={selector:"body",quality:.95,canvasHeight:480,canvasWidth:640}){return new Promise((n,r)=>{if(!this.isBrowser())return;let o="";if(!htmlToImage){o="MISSING_HTML_IMAGE_LIBRARY: htmlToImage is not defined. Please install it first.",u.Console.error(o),r(new Error);return}let{selector:s,quality:a,canvasHeight:l,canvasWidth:f}=t,d=document.querySelector(s),h={quality:a,canvasHeight:l,canvasWidth:f};htmlToImage.toPng(d,h).then(function(g,v){this.uploadDataToRemote(v,g,b=>{n({imageData:v,serverResponse:b})})}.bind(this,t)).catch(function(g){o=`IMAGE_PROCESSING_FAILURE: ${g.message}`,u.Console.error(o),r(new Error(o))})})}alert(...t){if(!this.isBrowser())return this.log(...t);let n;if(t&&(t[0]&&t[0].hasOwnProperty("lid")||this.isContextValid(t[0]))){let r=this.generateDefaultContext();n=this.convertToContext(t[0],r).lid+": "+t.slice(1).join(" | ")}else n=t.join(" | ");alert(n)}assert(t,n=!0,...r){let o;try{return typeof t=="function"?(o=t(...r),o!==n?(this.error("Asset failed"),!1):(this.options.hidePassingTests||this.log("SUCCESS: Assert passed"),!0)):t!==n?(this.error("Assert failed"),!1):(this.options.hidePassingTests||this.log("SUCCESS: Assert passed"),!0)}catch{this.error("Unexpected error in assert")}return!1}applyAnalogFormatting({activeTarget:t="",override:n=!1}={}){try{let o={STANDARD:null,TEST:{color:"#B18904",symbol:"diamonds"}};return this.setDefaultContext(o.DEFAULT),t&&this.setActiveTarget(t),this.setOptions({silent:!1,hideError:!1,hideHookMessage:!0,lidLenMax:6}),n&&(this.overrideConsole(),this.overrideError()),!0}catch(r){console.error({lid:3249},r.message)}return!1}applyPredefinedFormat(t=z.DEFAULT_FORMAT,{activeTarget:n="",override:r=!1}={}){if(t===z.DEFAULT_FORMAT)return this.applyAnalogFormatting({activeTarget:n,override:r})}static generateInstance(){return new u}static getInstance(t=0){return u.instanceCount?m(u,B)[t]:null}static generateMainInstance(){let t=u.getInstance();return t||new u}static startLogger(){u.generateMainInstance().applyPredefinedFormat(z.DEFAULT_FORMAT,{override:!0})}static stopLogger(){let t=u.generateMainInstance();t.removeOverride(),t.removeOverrideError()}convertToUrl({protocol:t=E.protocol,host:n=E.host,port:r=E.port,pathname:o=E.pathname}={}){let s=new URL("http://localhost");return s.protocol=t,s.host=n,s.port=r,o&&(s.pathname=o),s.toString()}generateLogToRemoteUrl(t=null,{pathname:n=E.pathname}={}){if(typeof t=="string"||t instanceof String)return t;if(!this.isBrowser())return null;let r=this.options.protocol||window.location.protocol+"//",o=this.options.host||window.location.host||E.host,s=this.options.port||E.port;return n=this.options.pathname||n,this.convertToUrl({protocol:r,host:o,port:s,pathname:n})}addPlugin(t,n,r=""){r=r||t,this[t]=n,u.pluginTable[r]={type:Se.LOCAL,methodName:t,callback:n}}addGlobalPlugin(t,n,r){u[t]=n,u.pluginTable[r]={type:Se.GLOBAL,methodName:t,callback:n}}getPluginList(){return Object.keys(u.pluginTable)}validatePlugin(t){return u.pluginTable[t]?!0:(console.warn(`The plugin ${t} is not registered`),!1)}},L=u;B=new WeakMap,A=new WeakMap,C=new WeakMap,N=new WeakMap,T=new WeakMap,J=new WeakSet,Re=function(t){let n=this.generateNewContext(),r=Object.assign({},n,t);return r.color.toLowerCase().indexOf("rgb")>-1?r.color=V.rgbStringToHex(r.color):r.color.indexOf("#")===-1&&(r.color=V.colorNameToHex(r.color)),r},X=new WeakSet,Ce=function(){try{this.setTargets(k),this.setLogLevels(y),this.setContexts(_)}catch(t){console.error({lid:4321},t.message)}return!1},O(L,B,[]),p(L,"Console",null),p(L,"ALIGN",{LEFT:"LEFT",RIGHT:"RIGHT"}),p(L,"ENVIRONMENT_TYPE",{BROWSER:"BROWSER",NODE:"NODE",OTHER:"OTHER"}),p(L,"instanceCount",0),p(L,"pluginTable",{});var ht=L,Tt=ht,xt=L.generateMainInstance();var Ot=L;export{Ot as AnaLogger,_ as DEFAULT_LOG_CONTEXTS,y as DEFAULT_LOG_LEVELS,k as DEFAULT_LOG_TARGETS,xt as anaLogger,Tt as default};
@@ -1,6 +1,5 @@
1
1
  var qe=Object.defineProperty;var $e=(i,t,n)=>t in i?qe(i,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):i[t]=n;var p=(i,t,n)=>($e(i,typeof t!="symbol"?t+"":t,n),n),te=(i,t,n)=>{if(!t.has(i))throw TypeError("Cannot "+n)};var m=(i,t,n)=>(te(i,t,"read from private field"),n?n.call(i):t.get(i)),O=(i,t,n)=>{if(t.has(i))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(i):t.set(i,n)},ne=(i,t,n,r)=>(te(i,t,"write to private field"),r?r.call(i,n):t.set(i,n),n);var re=(i,t,n)=>(te(i,t,"access private method"),n);var he={Foreground:38,Background:48},S="\x1B[1D",de="\x1B[0m"+S,j={Bold:"\x1B[1m"+S,Underline:"\x1B[4m"+S,Reversed:"\x1B[7m"+S},Ve={Bold:"\x1B[1m"+S,Underline:"\x1B[4m"+S,Reversed:"\x1B[7m"+S},oe={aliceblue:"#f0f8ff",antiquewhite:"#faebd7",aqua:"#00ffff",aquamarine:"#7fffd4",azure:"#f0ffff",beige:"#f5f5dc",bisque:"#ffe4c4",black:"#000000",blanchedalmond:"#ffebcd",blue:"#0000ff",blueviolet:"#8a2be2",brown:"#a52a2a",burlywood:"#deb887",cadetblue:"#5f9ea0",chartreuse:"#7fff00",chocolate:"#d2691e",coral:"#ff7f50",cornflowerblue:"#6495ed",cornsilk:"#fff8dc",crimson:"#dc143c",cyan:"#00ffff",darkblue:"#00008b",darkcyan:"#008b8b",darkgoldenrod:"#b8860b",darkgray:"#a9a9a9",darkgreen:"#006400",darkkhaki:"#bdb76b",darkmagenta:"#8b008b",darkolivegreen:"#556b2f",darkorange:"#ff8c00",darkorchid:"#9932cc",darkred:"#8b0000",darksalmon:"#e9967a",darkseagreen:"#8fbc8f",darkslateblue:"#483d8b",darkslategray:"#2f4f4f",darkturquoise:"#00ced1",darkviolet:"#9400d3",deeppink:"#ff1493",deepskyblue:"#00bfff",dimgray:"#696969",dodgerblue:"#1e90ff",firebrick:"#b22222",floralwhite:"#fffaf0",forestgreen:"#228b22",fuchsia:"#ff00ff",gainsboro:"#dcdcdc",ghostwhite:"#f8f8ff",gold:"#ffd700",goldenrod:"#daa520",gray:"#808080",green:"#008000",greenyellow:"#adff2f",honeydew:"#f0fff0",hotpink:"#ff69b4","indianred ":"#cd5c5c",indigo:"#4b0082",ivory:"#fffff0",khaki:"#f0e68c",lavender:"#e6e6fa",lavenderblush:"#fff0f5",lawngreen:"#7cfc00",lemonchiffon:"#fffacd",lightblue:"#add8e6",lightcoral:"#f08080",lightcyan:"#e0ffff",lightgoldenrodyellow:"#fafad2",lightgrey:"#d3d3d3",lightgreen:"#90ee90",lightpink:"#ffb6c1",lightsalmon:"#ffa07a",lightseagreen:"#20b2aa",lightskyblue:"#87cefa",lightslategray:"#778899",lightsteelblue:"#b0c4de",lightyellow:"#ffffe0",lime:"#00ff00",limegreen:"#32cd32",linen:"#faf0e6",magenta:"#ff00ff",maroon:"#800000",mediumaquamarine:"#66cdaa",mediumblue:"#0000cd",mediumorchid:"#ba55d3",mediumpurple:"#9370d8",mediumseagreen:"#3cb371",mediumslateblue:"#7b68ee",mediumspringgreen:"#00fa9a",mediumturquoise:"#48d1cc",mediumvioletred:"#c71585",midnightblue:"#191970",mintcream:"#f5fffa",mistyrose:"#ffe4e1",moccasin:"#ffe4b5",navajowhite:"#ffdead",navy:"#000080",oldlace:"#fdf5e6",olive:"#808000",olivedrab:"#6b8e23",orange:"#ffa500",orangered:"#ff4500",orchid:"#da70d6",palegoldenrod:"#eee8aa",palegreen:"#98fb98",paleturquoise:"#afeeee",palevioletred:"#d87093",papayawhip:"#ffefd5",peachpuff:"#ffdab9",peru:"#cd853f",pink:"#ffc0cb",plum:"#dda0dd",powderblue:"#b0e0e6",purple:"#800080",rebeccapurple:"#663399",red:"#ff0000",rosybrown:"#bc8f8f",royalblue:"#4169e1",saddlebrown:"#8b4513",salmon:"#fa8072",sandybrown:"#f4a460",seagreen:"#2e8b57",seashell:"#fff5ee",sienna:"#a0522d",silver:"#c0c0c0",skyblue:"#87ceeb",slateblue:"#6a5acd",slategray:"#708090",snow:"#fffafa",springgreen:"#00ff7f",steelblue:"#4682b4",tan:"#d2b48c",teal:"#008080",thistle:"#d8bfd8",tomato:"#ff6347",turquoise:"#40e0d0",violet:"#ee82ee",wheat:"#f5deb3",white:"#ffffff",whitesmoke:"#f5f5f5",yellow:"#ffff00",yellowgreen:"#9acd32"};function We(i){return!!oe[i]}var ge=(i,t,n)=>i===t&&t===n?i<8?16:i>248?231:Math.round((i-8)/247*24)+232:16+36*Math.round(i/255*5)+6*Math.round(t/255*5)+Math.round(n/255*5),pe=i=>{let t=/^#?([a-f\d])([a-f\d])([a-f\d])$/i;i=i.replace(t,function(r,o,s,a){return o+o+s+s+a+a});let n=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(i);return n?{red:parseInt(n[1],16),blue:parseInt(n[2],16),green:parseInt(n[3],16)}:{}},me=function({red:i,green:t,blue:n}){let r=i<<16|t<<8|n<<0;return"#"+(16777216+r).toString(16).slice(1)},ve=function(i){let t=i.matchAll(/\d+/g),n=[];for(let r of t){let o=parseInt(r[0]);if(o>255)return null;n.push(o)}return n.length!==3?null:{red:n[0],green:n[1],blue:n[2]}},ze=function(i){let t=ve(i);return t&&me(t)},G=function(t,n,r){return r<0&&(r+=1),r>1&&(r-=1),r<1/6?t+(n-t)*6*r:r<1/2?n:r<2/3?t+(n-t)*(2/3-r)*6:t},ye=({hue:i,saturation:t,lightness:n})=>{let r,o,s;if(t===0)r=o=s=n;else{let a=n<.5?n*(1+t):n+t-n*t,l=2*n-a;r=G(l,a,i+1/3),o=G(l,a,i),s=G(l,a,i-1/3)}return{red:Math.round(r*255),blue:Math.round(s*255),green:Math.round(o*255)}},be=i=>{let t=i.toLowerCase();return typeof oe[t]<"u"?oe[t]:""};function M({red:i,blue:t,green:n},r=!0){if(i===void 0||t===void 0||n===void 0)return"";let o=ge(i,t,n);return`\x1B[${r?he.Foreground:he.Background};5;`+o+"m "+S}function I(i,t=!0){let{red:n,green:r,blue:o}=pe(i);return M({red:n,green:r,blue:o},t)}function q({hue:i,saturation:t,lightness:n},r){let{red:o,green:s,blue:a}=ye({hue:i,saturation:t,lightness:n});return M({red:o,green:s,blue:a},r)}function ie(i,t=!0){try{let n;return i=i||"",i?((typeof i=="string"||i instanceof String)&&(i=i.trim()),We(i)?(n=be(i),I(n,t)):typeof i=="object"&&!!i.red&&!!i.blue&&!!i.green?M(i,t):typeof i=="object"&&!!i.hue&&!!i.saturation&&!!i.lightness?q(i,t):i.startsWith("#")?I(i,t):(i=i.toString(),/^[\da-fA-F]+$/.test(i)?I("#"+i,t):"")):""}catch(n){console.error("TO_ANSI_INVALID_ARGUMENT_ERROR",n.message)}}function $(i,{fg:t,bg:n,isUnderline:r=!1,isBold:o=!1,isReversed:s=!1}){let a=!1,l="";return t&&(a=!0,l=l+t),n&&(a=!0,l=l+n),r&&(a=!0,l=l+j.Underline),o&&(a=!0,l=l+j.Bold),s&&(a=!0,l=l+j.Reversed),a?l+i+de:i}function Ye(i,{fg:t={},bg:n={},isUnderline:r=!1,isBold:o=!1,isReversed:s=!1}){return t&&(t=M({...t})),n&&(n=M({...n},!1)),$(i,{fg:t,bg:n,isUnderline:r,isBold:o,isReversed:s})}function Je(i,{fg:t="",bg:n="",isUnderline:r=!1,isBold:o=!1,isReversed:s=!1}){return t&&(t=q({...t})),n&&(n=q({...n},!1)),$(i,{fg:t,bg:n,isUnderline:r,isBold:o,isReversed:s})}function Xe(i,{fg:t="",bg:n="",isUnderline:r=!1,isBold:o=!1,isReversed:s=!1}){return t&&(t=I(t)),n&&(n=I(n,!1)),$(i,{fg:t,bg:n,isUnderline:r,isBold:o,isReversed:s})}function Ke(i,t=null){if(!t)return i;let{fg:n="",bg:r="",isUnderline:o=!1,isBold:s=!1,isReversed:a=!1}=t;return n&&(n=ie(n)),r&&(r=ie(r,!1)),$(i,{fg:n,bg:r,isUnderline:o,isBold:s,isReversed:a})}var V={fromRgb:M,fromHexa:I,fromHsl:q,fromColor:ie,getTextFromRgb:Ye,getTextFromHsl:Je,getTextFromHex:Xe,getTextFromColor:Ke,colorNameToHex:be,hslToRgb:ye,hexToRgb:pe,rgbToHex:me,rgbToAnsi256:ge,rgbStringToRgb:ve,rgbStringToHex:ze,hue2rgb:G,RESET:de,FONT_STYLE:j,STYLE:Ve};var Ee={COLOR_TABLE:["#d2466e","#FFA07A","#FF7F50","#FF6347","#FFE4B5","#ADFF2F","#808000","#40E0D0","#1E90FF","#EE82EE","#708090","#DEB887","#FE642E","#210B61","#088A4B","#5E610B","#FA8258","#088A68","#B40431"],SYSTEM:{BROWSER:"BROWSER",NODE:"NODE"}},D=Ee.COLOR_TABLE,U=Ee.SYSTEM,se=2e3,ae="analogger-removed-notif",ce="analogger-header",le="analogger-view",ue="analogger-footer",Le="to-esm-line",W={TOP:"TOP",BOTTOM:"BOTTOM"},we="ANALOGGER",z={DEFAULT_FORMAT:"FORMAT1"};var{parse:mt,stringify:Qe}=JSON,{keys:vt}=Object,Ze=String,et="string";var Te="object",tt=(i,t)=>t;var xe=(i,t,n)=>{let r=Ze(t.push(n)-1);return i.set(n,r),r};var Oe=(i,t,n)=>{let r=t&&typeof t===Te?(h,g)=>h===""||-1<t.indexOf(h)?g:void 0:t||tt,o=new Map,s=[],a=[],l=+xe(o,s,r.call({"":i},"",i)),f=!l;for(;l<s.length;)f=!0,a[l]=Qe(s[l++],d,n);return"["+a.join(",")+"]";function d(h,g){if(f)return f=!f,g;let v=r.call(this,h,g);switch(typeof v){case Te:if(v===null)return v;case et:return o.get(v)||xe(o,s,v)}return v}};var E={moduleName:"analogger",protocol:"http://",host:"localhost",port:12e3,pathname:"analogger",binarypathname:"uploaded",loopback:"localhost",consoleDomId:"#analogger",logFilename:"./analogger.log"},k={ALL:"ALL",USER:"USER"},y={FATAL:5e3,ERROR:4e3,WARN:3e3,INFO:2e3,LOG:1e3,DEBUG:500,ALL:200,OFF:0,INHERIT:-1},Se={LOCAL:"local",GLOBAL:"global"},_={DEFAULT:{contextName:"DEFAULT",logLevel:y.LOG,symbol:"check"},LOG:{contextName:"LOG",logLevel:y.LOG,symbol:"check"},DEBUG:{contextName:"DEBUG",logLevel:y.DEBUG},INFO:{contextName:"INFO",logLevel:y.INFO,color:"#B18904",symbol:"diamonds"},WARN:{contextName:"WARN",logLevel:y.WARN,color:D[0],symbol:"cross"},ERROR:{contextName:"ERROR",logLevel:y.ERROR},CRITICAL:{contextName:"CRITICAL",logLevel:y.CRITICAL}},nt=`
2
- `,Y={airplane:"\u2708",anchor:"\u2693",arrow_backward:"\u25C0",arrow_double_up:"\u23EB",arrow_double_down:"\u23EC",arrow_forward:"\u25B6",arrow_lower_right:"\u2198",arrow_lower_left:"\u2199",arrow_right_hook:"\u21AA",arrow_up_down:"\u2195",arrow_upper_left:"\u2196",arrow_upper_right:"\u2197",ballot_box_with_check:"\u2611",biohazard:"\u2623",black_circle:"\u23FA",black_medium_small_square:"\u25FE",black_medium_square:"\u25FC",black_nib:"\u2712",black_small_square:"\u25AA",black_square:"\u23F9",chains:"\u26D3",check:"\u2714",chess_pawn:"\u265F",cloud_and_rain:"\u26C8",clubs:"\u2663",coffee:"\u2615",copyright:"\xA9",cross:"\u274C",diamonds:"\u2666",divisions_ign:"\u2797",double_triangle_right:"\u23ED",double_triangle_left:"\u23EE",email:"\u2709",eject:"\u23CF",exclamation_mark:"\u2757",fast_forward:"\u23E9",female_sign:"\u2640",fist:"\u270A",fuel_pump:"\u26FD",gear:"\u2699",hammer_and_pick:"\u2692",hand:"\u270B",hearts:"\u2665",infinity:"\u267E",information:"\u2139",left_right_arrow:"\u2194",leftwards_arrow_with_hook:"\u21A9",male_sign:"\u2642",minus_sign:"\u2796",no_entry:"\u26D4",partly_sunny:"\u26C5",pencil:"\u270F",phone:"\u260E",plus_sign:"\u2795",question:"\u2754",radioactive:"\u2622",raised_hand:"\u270B",recycle:"\u267B",registered:"\xAE",relaxed:"\u263A",rewind:"\u23EA",scissors:"\u2702",snowman:"\u2603",spades:"\u2660",sparkles:"\u2728",star:"\u2B50",sunny:"\u2600",tent:"\u26FA",trademark:"\u2122",triangle_with_vertical_bar:"\u23EF",umbrella:"\u2614",vertical_bars:"\u23F8",watch:"\u231A",white_frowning_face:"\u2639",white_medium_square:"\u25FB",white_medium_small_square:"\u25FD",white_small_square:"\u25AB",wheelchair:"\u267F",white_circle:"\u26AA",writing_hand:"\u270D"};function rt(i){try{let t=path.extname(i),n=path.basename(i,t),r=path.dirname(i),o=i.slice(0,i.length-t.length);return{extension:t,filePath:o,basename:n,dirname:r}}catch(t){console.error("FILEPATH_EXT_FAILURE: ",t.message)}return{extension:".log",filePath:i}}function ot(){return new Date().toISOString().replace(/:/g,"-").replace(/\./g,"-")}function it(i,t,n,r,o,s,a){fs.readdir(i,(l,f)=>{if(l){a(l,null);return}let d=[],h=0,g=(b,w)=>{if(!fs.existsSync(b)){w(null,null);return}fs.unlink(b,F=>{F?console.error(`DELETION_FAILURE: Error deleting file ${b}: ${F}`):d.push(b),h++,h===f.length&&w(null,d)})},v=b=>{if(b.startsWith(t+".")&&b.endsWith(n+r)){let w=path.join(i,b);o&&ct(w,o,s),g(w,a)}else h++,h===f.length&&a(null,d)};f.length===0?a(null,d):f.forEach(v,s)})}function st(i,t={}){let n=document.createElement("script");n.textContent=i;for(let r in t)n.setAttribute(r,t[r]);document.head.appendChild(n),n.remove()}function at(){let i=[];return i.push(`!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).htmlToImage={})}(this,(function(t){"use strict";function e(t,e,n,r){return new(n||(n=Promise))((function(i,o){function u(t){try{a(r.next(t))}catch(t){o(t)}}function c(t){try{a(r.throw(t))}catch(t){o(t)}}function a(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(u,c)}a((r=r.apply(t,e||[])).next())}))}function n(t,e){var n,r,i,o,u={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function c(c){return function(a){return function(c){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,c[0]&&(u=0)),u;)try{if(n=1,r&&(i=2&c[0]?r.return:c[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,c[1])).done)return i;switch(r=0,i&&(c=[2&c[0],i.value]),c[0]){case 0:case 1:i=c;break;case 4:return u.label++,{value:c[1],done:!1};case 5:u.label++,r=c[1],c=[0];continue;case 7:c=u.ops.pop(),u.trys.pop();continue;default:if(!(i=u.trys,(i=i.length>0&&i[i.length-1])||6!==c[0]&&2!==c[0])){u=0;continue}if(3===c[0]&&(!i||c[1]>i[0]&&c[1]<i[3])){u.label=c[1];break}if(6===c[0]&&u.label<i[1]){u.label=i[1],i=c;break}if(i&&u.label<i[2]){u.label=i[2],u.ops.push(c);break}i[2]&&u.ops.pop(),u.trys.pop();continue}c=e.call(t,u)}catch(t){c=[6,t],r=0}finally{n=i=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,a])}}}var r,i=(r=0,function(){return r+=1,"u".concat("0000".concat((Math.random()*Math.pow(36,4)<<0).toString(36)).slice(-4)).concat(r)});function o(t){for(var e=[],n=0,r=t.length;n<r;n++)e.push(t[n]);return e}var u=null;function c(t){return void 0===t&&(t={}),u||(u=t.includeStyleProperties?t.includeStyleProperties:o(window.getComputedStyle(document.documentElement)))}function a(t,e){var n=(t.ownerDocument.defaultView||window).getComputedStyle(t).getPropertyValue(e);return n?parseFloat(n.replace("px","")):0}function s(t,e){void 0===e&&(e={});var n,r,i,o=e.width||(r=a(n=t,"border-left-width"),i=a(n,"border-right-width"),n.clientWidth+r+i),u=e.height||function(t){var e=a(t,"border-top-width"),n=a(t,"border-bottom-width");return t.clientHeight+e+n}(t);return{width:o,height:u}}var l=16384;function f(t,e){return void 0===e&&(e={}),t.toBlob?new Promise((function(n){t.toBlob(n,e.type?e.type:"image/png",e.quality?e.quality:1)})):new Promise((function(n){for(var r=window.atob(t.toDataURL(e.type?e.type:void 0,e.quality?e.quality:void 0).split(",")[1]),i=r.length,o=new Uint8Array(i),u=0;u<i;u+=1)o[u]=r.charCodeAt(u);n(new Blob([o],{type:e.type?e.type:"image/png"}))}))}function h(t){return new Promise((function(e,n){var r=new Image;r.onload=function(){r.decode().then((function(){requestAnimationFrame((function(){return e(r)}))}))},r.onerror=n,r.crossOrigin="anonymous",r.decoding="async",r.src=t}))}function d(t){return e(this,void 0,void 0,(function(){return n(this,(function(e){return[2,Promise.resolve().then((function(){return(new XMLSerializer).serializeToString(t)})).then(encodeURIComponent).then((function(t){return"data:image/svg+xml;charset=utf-8,".concat(t)}))]}))}))}function v(t,r,i){return e(this,void 0,void 0,(function(){var e,o,u;return n(this,(function(n){return e="http://www.w3.org/2000/svg",o=document.createElementNS(e,"svg"),u=document.createElementNS(e,"foreignObject"),o.setAttribute("width","".concat(r)),o.setAttribute("height","".concat(i)),o.setAttribute("viewBox","0 0 ".concat(r," ").concat(i)),u.setAttribute("width","100%"),u.setAttribute("height","100%"),u.setAttribute("x","0"),u.setAttribute("y","0"),u.setAttribute("externalResourcesRequired","true"),o.appendChild(u),u.appendChild(t),[2,d(o)]}))}))}var p=function(t,e){if(t instanceof e)return!0;var n=Object.getPrototypeOf(t);return null!==n&&(n.constructor.name===e.name||p(n,e))};function g(t,e,n,r){var i=".".concat(t,":").concat(e),o=n.cssText?function(t){var e=t.getPropertyValue("content");return"".concat(t.cssText," content: '").concat(e.replace(/'|"/g,""),"';")}(n):function(t,e){return c(e).map((function(e){var n=t.getPropertyValue(e),r=t.getPropertyPriority(e);return"".concat(e,": ").concat(n).concat(r?" !important":"",";")})).join(" ")}(n,r);return document.createTextNode("".concat(i,"{").concat(o,"}"))}function m(t,e,n,r){var o=window.getComputedStyle(t,n),u=o.getPropertyValue("content");if(""!==u&&"none"!==u){var c=i();try{e.className="".concat(e.className," ").concat(c)}catch(t){return}var a=document.createElement("style");a.appendChild(g(c,n,o,r)),e.appendChild(a)}}var w="application/font-woff",y="image/jpeg",b={woff:w,woff2:w,ttf:"application/font-truetype",eot:"application/vnd.ms-fontobject",png:"image/png",jpg:y,jpeg:y,gif:"image/gif",tiff:"image/tiff",svg:"image/svg+xml",webp:"image/webp"};function S(t){var e=function(t){var e=/\\.([^./]*?)$/g.exec(t);return e?e[1]:""}(t).toLowerCase();return b[e]||""}function E(t){return-1!==t.search(/^(data:)/)}function x(t,e){return"data:".concat(e,";base64,").concat(t)}function C(t,r,i){return e(this,void 0,void 0,(function(){var e,o;return n(this,(function(n){switch(n.label){case 0:return[4,fetch(t,r)];case 1:if(404===(e=n.sent()).status)throw new Error('Resource "'.concat(e.url,'" not found'));return[4,e.blob()];case 2:return o=n.sent(),[2,new Promise((function(t,n){var r=new FileReader;r.onerror=n,r.onloadend=function(){try{t(i({res:e,result:r.result}))}catch(t){n(t)}},r.readAsDataURL(o)}))]}}))}))}var P={};function R(t,r,i){return e(this,void 0,void 0,(function(){var e,o,u,c,a;return n(this,(function(n){switch(n.label){case 0:if(e=function(t,e,n){var r=t.replace(/\\?.*/,"");return n&&(r=t),/ttf|otf|eot|woff2?/i.test(r)&&(r=r.replace(/.*\\//,"")),e?"[".concat(e,"]").concat(r):r}(t,r,i.includeQueryParams),null!=P[e])return[2,P[e]];i.cacheBust&&(t+=(/\\?/.test(t)?"&":"?")+(new Date).getTime()),n.label=1;case 1:return n.trys.push([1,3,,4]),[4,C(t,i.fetchRequestInit,(function(t){var e=t.res,n=t.result;return r||(r=e.headers.get("Content-Type")||""),function(t){return t.split(/,/)[1]}(n)}))];case 2:return u=n.sent(),o=x(u,r),[3,4];case 3:return c=n.sent(),o=i.imagePlaceholder||"",a="Failed to fetch resource: ".concat(t),c&&(a="string"==typeof c?c:c.message),a&&console.warn(a),[3,4];case 4:return P[e]=o,[2,o]}}))}))}function T(t){return e(this,void 0,void 0,(function(){var e;return n(this,(function(n){return"data:,"===(e=t.toDataURL())?[2,t.cloneNode(!1)]:[2,h(e)]}))}))}function A(t,r){return e(this,void 0,void 0,(function(){var e,i,o,u;return n(this,(function(n){switch(n.label){case 0:return t.currentSrc?(e=document.createElement("canvas"),i=e.getContext("2d"),e.width=t.clientWidth,e.height=t.clientHeight,null==i||i.drawImage(t,0,0,e.width,e.height),[2,h(e.toDataURL())]):(o=t.poster,u=S(o),[4,R(o,u,r)]);case 1:return[2,h(n.sent())]}}))}))}function k(t,r){var i;return e(this,void 0,void 0,(function(){return n(this,(function(e){switch(e.label){case 0:return e.trys.push([0,3,,4]),(null===(i=null==t?void 0:t.contentDocument)||void 0===i?void 0:i.body)?[4,I(t.contentDocument.body,r,!0)]:[3,2];case 1:return[2,e.sent()];case 2:return[3,4];case 3:return e.sent(),[3,4];case 4:return[2,t.cloneNode(!1)]}}))}))}var L=function(t){return null!=t.tagName&&"SVG"===t.tagName.toUpperCase()};function N(t,e,n){return p(e,Element)&&(function(t,e,n){var r=e.style;if(r){var i=window.getComputedStyle(t);i.cssText?(r.cssText=i.cssText,r.transformOrigin=i.transformOrigin):c(n).forEach((function(n){var o=i.getPropertyValue(n);if("font-size"===n&&o.endsWith("px")){var u=Math.floor(parseFloat(o.substring(0,o.length-2)))-.1;o="".concat(u,"px")}p(t,HTMLIFrameElement)&&"display"===n&&"inline"===o&&(o="block"),"d"===n&&e.getAttribute("d")&&(o="path(".concat(e.getAttribute("d"),")")),r.setProperty(n,o,i.getPropertyPriority(n))}))}}(t,e,n),function(t,e,n){m(t,e,":before",n),m(t,e,":after",n)}(t,e,n),function(t,e){p(t,HTMLTextAreaElement)&&(e.innerHTML=t.value),p(t,HTMLInputElement)&&e.setAttribute("value",t.value)}(t,e),function(t,e){if(p(t,HTMLSelectElement)){var n=e,r=Array.from(n.children).find((function(e){return t.value===e.getAttribute("value")}));r&&r.setAttribute("selected","")}}(t,e)),e}function I(t,r,i){return e(this,void 0,void 0,(function(){return n(this,(function(u){return i||!r.filter||r.filter(t)?[2,Promise.resolve(t).then((function(t){return function(t,r){return e(this,void 0,void 0,(function(){return n(this,(function(e){return p(t,HTMLCanvasElement)?[2,T(t)]:p(t,HTMLVideoElement)?[2,A(t,r)]:p(t,HTMLIFrameElement)?[2,k(t,r)]:[2,t.cloneNode(L(t))]}))}))}(t,r)})).then((function(i){return function(t,r,i){var u,c;return e(this,void 0,void 0,(function(){var e;return n(this,(function(n){switch(n.label){case 0:return L(r)?[2,r]:(e=[],0===(e=null!=(a=t).tagName&&"SLOT"===a.tagName.toUpperCase()&&t.assignedNodes?o(t.assignedNodes()):p(t,HTMLIFrameElement)&&(null===(u=t.contentDocument)||void 0===u?void 0:u.body)?o(t.contentDocument.body.childNodes):o((null!==(c=t.shadowRoot)&&void 0!==c?c:t).childNodes)).length||p(t,HTMLVideoElement)?[2,r]:[4,e.reduce((function(t,e){return t.then((function(){return I(e,i)})).then((function(t){t&&r.appendChild(t)}))}),Promise.resolve())]);case 1:return n.sent(),[2,r]}var a}))}))}(t,i,r)})).then((function(e){return N(t,e,r)})).then((function(t){return function(t,r){return e(this,void 0,void 0,(function(){var e,i,o,u,c,a,s,l,f,h,d,v,p;return n(this,(function(n){switch(n.label){case 0:if(0===(e=t.querySelectorAll?t.querySelectorAll("use"):[]).length)return[2,t];i={},p=0,n.label=1;case 1:return p<e.length?(o=e[p],(u=o.getAttribute("xlink:href"))?(c=t.querySelector(u),a=document.querySelector(u),c||!a||i[u]?[3,3]:(s=i,l=u,[4,I(a,r,!0)])):[3,3]):[3,4];case 2:s[l]=n.sent(),n.label=3;case 3:return p++,[3,1];case 4:if((f=Object.values(i)).length){for(h="http://www.w3.org/1999/xhtml",(d=document.createElementNS(h,"svg")).setAttribute("xmlns",h),d.style.position="absolute",d.style.width="0",d.style.height="0",d.style.overflow="hidden",d.style.display="none",v=document.createElementNS(h,"defs"),d.appendChild(v),p=0;p<f.length;p++)v.appendChild(f[p]);t.appendChild(d)}return[2,t]}}))}))}(t,r)}))]:[2,null]}))}))}var D=/url\\((['"]?)([^'"]+?)\\1\\)/g,H=/url\\([^)]+\\)\\s*format\\((["']?)([^"']+)\\1\\)/g,M=/src:\\s*(?:url\\([^)]+\\)\\s*format\\([^)]+\\)[,;]\\s*)+/g;function F(t,r,i,o,u){return e(this,void 0,void 0,(function(){var e,c,a,s;return n(this,(function(n){switch(n.label){case 0:return n.trys.push([0,5,,6]),e=i?function(t,e){if(t.match(/^[a-z]+:\\/\\//i))return t;if(t.match(/^\\/\\//))return window.location.protocol+t;if(t.match(/^[a-z]+:/i))return t;var n=document.implementation.createHTMLDocument(),r=n.createElement("base"),i=n.createElement("a");return n.head.appendChild(r),n.body.appendChild(i),e&&(r.href=e),i.href=t,i.href}(r,i):r,c=S(r),a=void 0,u?[4,u(e)]:[3,2];case 1:return s=n.sent(),a=x(s,c),[3,4];case 2:return[4,R(e,c,o)];case 3:a=n.sent(),n.label=4;case 4:return[2,t.replace((l=r,f=l.replace(/([.*+?^);
3
- code.push(()|\\[\\]\\/\\\\])/g,"\\\\$1"),new RegExp("(url\\\\(['\\"]?)(".concat(f,")(['\\"]?\\\\))"),"g")),"$1".concat(a,"$3"))];case 5:return n.sent(),[3,6];case 6:return[2,t]}var l,f}))}))}function V(t){return-1!==t.search(D)}function q(t,r,i){return e(this,void 0,void 0,(function(){var e,o;return n(this,(function(n){return V(t)?(e=function(t,e){var n=e.preferredFontFormat;return n?t.replace(M,(function(t){for(;;){var e=H.exec(t)||[],r=e[0],i=e[2];if(!i)return"";if(i===n)return"src: ".concat(r,";")}})):t}(t,i),o=function(t){var e=[];return t.replace(D,(function(t,n,r){return e.push(r),t})),e.filter((function(t){return!E(t)}))}(e),[2,o.reduce((function(t,e){return t.then((function(t){return F(t,e,r,i)}))}),Promise.resolve(e))]):[2,t]}))}))}function U(t,r,i){var o;return e(this,void 0,void 0,(function(){var e,u;return n(this,(function(n){switch(n.label){case 0:return(e=null===(o=r.style)||void 0===o?void 0:o.getPropertyValue(t))?[4,q(e,null,i)]:[3,2];case 1:return u=n.sent(),r.style.setProperty(t,u,r.style.getPropertyPriority(t)),[2,!0];case 2:return[2,!1]}}))}))}function j(t,r){return e(this,void 0,void 0,(function(){var e,i;return n(this,(function(n){switch(n.label){case 0:return[4,U("background",t,r)];case 1:return n.sent()?[3,3]:[4,U("background-image",t,r)];case 2:n.sent(),n.label=3;case 3:return[4,U("mask",t,r)];case 4:return(i=n.sent())?[3,6]:[4,U("-webkit-mask",t,r)];case 5:i=n.sent(),n.label=6;case 6:return(e=i)?[3,8]:[4,U("mask-image",t,r)];case 7:e=n.sent(),n.label=8;case 8:return e?[3,10]:[4,U("-webkit-mask-image",t,r)];case 9:n.sent(),n.label=10;case 10:return[2]}}))}))}function O(t,r){return e(this,void 0,void 0,(function(){var e,i,o;return n(this,(function(n){switch(n.label){case 0:return(e=p(t,HTMLImageElement))&&!E(t.src)||p(t,SVGImageElement)&&!E(t.href.baseVal)?[4,R(i=e?t.src:t.href.baseVal,S(i),r)]:[2];case 1:return o=n.sent(),[4,new Promise((function(n,i){t.onload=n,t.onerror=r.onImageErrorHandler?function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];try{n(r.onImageErrorHandler.apply(r,t))}catch(t){i(t)}}:i;var u=t;u.decode&&(u.decode=n),"lazy"===u.loading&&(u.loading="eager"),e?(t.srcset="",t.src=o):t.href.baseVal=o}))];case 2:return n.sent(),[2]}}))}))}function B(t,r){return e(this,void 0,void 0,(function(){var e,i;return n(this,(function(n){switch(n.label){case 0:return e=o(t.childNodes),i=e.map((function(t){return z(t,r)})),[4,Promise.all(i).then((function(){return t}))];case 1:return n.sent(),[2]}}))}))}function z(t,r){return e(this,void 0,void 0,(function(){return n(this,(function(e){switch(e.label){case 0:return p(t,Element)?[4,j(t,r)]:[3,4];case 1:return e.sent(),[4,O(t,r)];case 2:return e.sent(),[4,B(t,r)];case 3:e.sent(),e.label=4;case 4:return[2]}}))}))}var W={};function $(t){return e(this,void 0,void 0,(function(){var e,r;return n(this,(function(n){switch(n.label){case 0:return null!=(e=W[t])?[2,e]:[4,fetch(t)];case 1:return[4,n.sent().text()];case 2:return r=n.sent(),e={url:t,cssText:r},W[t]=e,[2,e]}}))}))}function G(t,r){return e(this,void 0,void 0,(function(){var i,o,u,c,a=this;return n(this,(function(s){return i=t.cssText,o=/url\\(["']?([^"')]+)["']?\\)/g,u=i.match(/url\\([^)]+\\)/g)||[],c=u.map((function(u){return e(a,void 0,void 0,(function(){var e;return n(this,(function(n){return(e=u.replace(o,"$1")).startsWith("https://")||(e=new URL(e,t.url).href),[2,C(e,r.fetchRequestInit,(function(t){var e=t.result;return i=i.replace(u,"url(".concat(e,")")),[u,e]}))]}))}))})),[2,Promise.all(c).then((function(){return i}))]}))}))}function _(t){if(null==t)return[];for(var e=[],n=t.replace(/(\\/\\*[\\s\\S]*?\\*\\/)/gi,""),r=new RegExp("((@.*?keyframes [\\\\s\\\\S]*?){([\\\\s\\\\S]*?}\\\\s*?)})","gi");;){if(null===(u=r.exec(n)))break;e.push(u[0])}n=n.replace(r,"");for(var i=/@import[\\s\\S]*?url\\([^)]*\\)[\\s\\S]*?;/gi,o=new RegExp("((\\\\s*?(?:\\\\/\\\\*[\\\\s\\\\S]*?\\\\*\\\\/)?\\\\s*?@media[\\\\s\\\\S]*?){([\\\\s\\\\S]*?)}\\\\s*?})|(([\\\\s\\\\S]*?){([\\\\s\\\\S]*?)})","gi");;){var u;if(null===(u=i.exec(n))){if(null===(u=o.exec(n)))break;i.lastIndex=o.lastIndex}else o.lastIndex=i.lastIndex;e.push(u[0])}return e}function J(t,r){return e(this,void 0,void 0,(function(){var e,i;return n(this,(function(n){return e=[],i=[],t.forEach((function(e){if("cssRules"in e)try{o(e.cssRules||[]).forEach((function(t,n){if(t.type===CSSRule.IMPORT_RULE){var o=n+1,u=$(t.href).then((function(t){return G(t,r)})).then((function(t){return _(t).forEach((function(t){try{e.insertRule(t,t.startsWith("@import")?o+=1:e.cssRules.length)}catch(e){console.error("Error inserting rule from remote css",{rule:t,error:e})}}))})).catch((function(t){console.error("Error loading remote css",t.toString())}));i.push(u)}}))}catch(o){var n=t.find((function(t){return null==t.href}))||document.styleSheets[0];null!=e.href&&i.push($(e.href).then((function(t){return G(t,r)})).then((function(t){return _(t).forEach((function(t){n.insertRule(t,n.cssRules.length)}))})).catch((function(t){console.error("Error loading remote stylesheet",t)}))),console.error("Error inlining remote css file",o)}})),[2,Promise.all(i).then((function(){return t.forEach((function(t){if("cssRules"in t)try{o(t.cssRules||[]).forEach((function(t){e.push(t)}))}catch(e){console.error("Error while reading CSS rules from ".concat(t.href),e)}})),e}))]}))}))}function Q(t){return t.filter((function(t){return t.type===CSSRule.FONT_FACE_RULE})).filter((function(t){return V(t.style.getPropertyValue("src"))}))}function X(t,r){return e(this,void 0,void 0,(function(){return n(this,(function(e){switch(e.label){case 0:if(null==t.ownerDocument)throw new Error("Provided element is not within a Document");return[4,J(o(t.ownerDocument.styleSheets),r)];case 1:return[2,Q(e.sent())]}}))}))}function K(t){return t.trim().replace(/["']/g,"")}function Y(t,r){return e(this,void 0,void 0,(function(){var e,i;return n(this,(function(n){switch(n.label){case 0:return[4,X(t,r)];case 1:return e=n.sent(),i=function(t){var e=new Set;return function t(n){(n.style.fontFamily||getComputedStyle(n).fontFamily).split(",").forEach((function(t){e.add(K(t))})),Array.from(n.children).forEach((function(e){e instanceof HTMLElement&&t(e)}))}(t),e}(t),[4,Promise.all(e.filter((function(t){return i.has(K(t.style.fontFamily))})).map((function(t){var e=t.parentStyleSheet?t.parentStyleSheet.href:null;return q(t.cssText,e,r)})))];case 2:return[2,n.sent().join("\\n")]}}))}))}function Z(t,r){return e(this,void 0,void 0,(function(){var e,i,o,u,c;return n(this,(function(n){switch(n.label){case 0:return null==r.fontEmbedCSS?[3,1]:(i=r.fontEmbedCSS,[3,5]);case 1:return r.skipFonts?(o=null,[3,4]):[3,2];case 2:return[4,Y(t,r)];case 3:o=n.sent(),n.label=4;case 4:i=o,n.label=5;case 5:return(e=i)&&(u=document.createElement("style"),c=document.createTextNode(e),u.appendChild(c),t.firstChild?t.insertBefore(u,t.firstChild):t.appendChild(u)),[2]}}))}))}function tt(t,r){return void 0===r&&(r={}),e(this,void 0,void 0,(function(){var e,i,o,u;return n(this,(function(n){switch(n.label){case 0:return e=s(t,r),i=e.width,o=e.height,[4,I(t,r,!0)];case 1:return[4,Z(u=n.sent(),r)];case 2:return n.sent(),[4,z(u,r)];case 3:return n.sent(),function(t,e){var n=t.style;e.backgroundColor&&(n.backgroundColor=e.backgroundColor),e.width&&(n.width="".concat(e.width,"px")),e.height&&(n.height="".concat(e.height,"px"));var r=e.style;null!=r&&Object.keys(r).forEach((function(t){n[t]=r[t]}))}(u,r),[4,v(u,i,o)];case 4:return[2,n.sent()]}}))}))}function et(t,r){return void 0===r&&(r={}),e(this,void 0,void 0,(function(){var e,i,o,u,c,a,f,d,v;return n(this,(function(n){switch(n.label){case 0:return e=s(t,r),i=e.width,o=e.height,[4,tt(t,r)];case 1:return[4,h(n.sent())];case 2:return u=n.sent(),c=document.createElement("canvas"),a=c.getContext("2d"),f=r.pixelRatio||function(){var t,e;try{e=process}catch(t){}var n=e&&e.env?e.env.devicePixelRatio:null;return n&&(t=parseInt(n,10),Number.isNaN(t)&&(t=1)),t||window.devicePixelRatio||1}(),d=r.canvasWidth||i,v=r.canvasHeight||o,c.width=d*f,c.height=v*f,r.skipAutoScale||function(t){(t.width>l||t.height>l)&&(t.width>l&&t.height>l?t.width>t.height?(t.height*=l/t.width,t.width=l):(t.width*=l/t.height,t.height=l):t.width>l?(t.height*=l/t.width,t.width=l):(t.width*=l/t.height,t.height=l))}(c),c.style.width="".concat(d),c.style.height="".concat(v),r.backgroundColor&&(a.fillStyle=r.backgroundColor,a.fillRect(0,0,c.width,c.height)),a.drawImage(u,0,0,c.width,c.height),[2,c]}}))}))}t.getFontEmbedCSS=function(t,r){return void 0===r&&(r={}),e(this,void 0,void 0,(function(){return n(this,(function(e){return[2,Y(t,r)]}))}))},t.toBlob=function(t,r){return void 0===r&&(r={}),e(this,void 0,void 0,(function(){return n(this,(function(e){switch(e.label){case 0:return[4,et(t,r)];case 1:return[4,f(e.sent())];case 2:return[2,e.sent()]}}))}))},t.toCanvas=et,t.toJpeg=function(t,r){return void 0===r&&(r={}),e(this,void 0,void 0,(function(){return n(this,(function(e){switch(e.label){case 0:return[4,et(t,r)];case 1:return[2,e.sent().toDataURL("image/jpeg",r.quality||1)]}}))}))},t.toPixelData=function(t,r){return void 0===r&&(r={}),e(this,void 0,void 0,(function(){var e,i,o,u;return n(this,(function(n){switch(n.label){case 0:return e=s(t,r),i=e.width,o=e.height,[4,et(t,r)];case 1:return u=n.sent(),[2,u.getContext("2d").getImageData(0,0,i,o).data]}}))}))},t.toPng=function(t,r){return void 0===r&&(r={}),e(this,void 0,void 0,(function(){return n(this,(function(e){switch(e.label){case 0:return[4,et(t,r)];case 1:return[2,e.sent().toDataURL()]}}))}))},t.toSvg=tt}));`),i.join("")}function ct(i,t,n=1){try{if(!fs.existsSync(i))return;if(!fs.existsSync(t)){let o=fs.mkdtempSync(path.join(os.tmpdir(),"tar-gz-init-"));try{let s=path.join(o,path.basename(i));fs.copyFileSync(i,s),c({sync:!0,gzip:{level:n},file:t,cwd:o,portable:!0},[path.basename(i)])}finally{fs.rmSync(o,{recursive:!0,force:!0})}return}let r=fs.mkdtempSync(path.join(os.tmpdir(),"tar-gz-append-"));try{x({file:t,cwd:r,sync:!0});let o=path.join(r,path.basename(i));fs.copyFileSync(i,o),c({gzip:!0,file:t,cwd:r,sync:!0,portable:!0},fs.readdirSync(r))}finally{fs.rmSync(r,{recursive:!0,force:!0})}}catch{console.error(`ARCHIVE_FAILURE: ${e.message}`)}}function Ae(){return typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node<"u"?U.NODE:U.BROWSER}var lt=Ae();function ut(){return lt===U.NODE}var ft=["alert","assert","keepLogHistory","getLogHistory","truncateMessage","truncateMessage","rawLog","removeOverride","removeOverrideError","overrideConsole","overrideError","table","rawInfo","rawWarn","rawError","hasSeenLid","addToLogHistory","releaseLogHistory","resetLogHistory","setLogFormat","resetLogFormatter","getRawLogHistory"],B,A,C,N,T,J,Re,X,Ce,u=class{constructor({name:t="default"}={}){O(this,J);O(this,X);p(this,"system","");p(this,"instanceId","");p(this,"instanceName","");p(this,"logIndex",0);p(this,"logCounter",0);O(this,A,[]);O(this,C,{});O(this,N,{});p(this,"activeTargets",[]);p(this,"indexColor",0);p(this,"format","");p(this,"keepLog",!1);p(this,"logHistory",[]);p(this,"$containers",null);p(this,"options",{hideHookMessage:!1});O(this,T,{log:!1,info:!1,warn:!1,error:!1});p(this,"originalFormatFunction");p(this,"removeDomOldEntries",t=>{if(t.childElementCount>se){let r=Math.ceil(se/10);for(let o=0;o<r;++o)t.removeChild(t.firstChild);return r}return 0});p(this,"scrollDivToBottom",t=>{let n=t.scrollHeight-(t.clientHeight+t.scrollTop),r=t.clientHeight||t.offsetHeight;n>r/2||(t.scrollTop=t.scrollHeight)});this.system=Ae(),this.format=this.onBuildLog.bind(this),this.originalFormatFunction=this.format,this.instanceName=t,this.instanceId=u.instanceCount+"-"+Date.now(),m(u,B)[u.instanceCount]=this,++u.instanceCount,this.errorTargetHandler=this.onError.bind(this),this.errorUserTargetHandler=this.onErrorForUserTarget.bind(this),this.setOptions(this.options),u.Console||(u.Console={log:console.log,info:console.info,warn:console.warn,error:console.error,debug:console.debug,table:console.table}),this.rawLog=u.Console.log,this.rawInfo=u.Console.info,this.rawWarn=u.Console.warn,this.rawError=u.Console.error,this.ALIGN=u.ALIGN,this.ENVIRONMENT_TYPE=u.ENVIRONMENT_TYPE,re(this,X,Ce).call(this),this.resetLogHistory()}getName(){return this.instanceName}getId(){return this.instanceId}keepLogHistory(){this.keepLog=!0}releaseLogHistory(){this.keepLog=!1}resetLogHistory(){this.logHistory=[]}addToLogHistory(t){t=t||{},this.logHistory.push(Object.assign({},t))}getLogHistory(t=!0,n=nt){let r=this.logHistory||[],o=[];return r.forEach(s=>{let{text:a}=s;o.push(a)}),t?o.join(n):o}getRawLogHistory(){return this.logHistory||[]}hasSeenLid(t){this.logHistory=this.logHistory||[];for(let n=0;n<this.logHistory.length;++n){let o=(this.logHistory[n]||{}).context||{};if(t===o.lid)return!0}return!1}forceEnvironment(t){this.forcedSystem=t}isNode(){return this&&this.forcedSystem?this.forcedSystem===U.NODE:ut()}isBrowser(){return!this.isNode()}resetLogger(){this.options={},this.options.timeLenMax=12,this.options.contextLenMax=10,this.options.idLenMax=5,this.options.lidLenMax=6,this.options.messageLenMax=void 0,this.options.symbolLenMax=60,this.options.hideHookMessage=void 0,this.options.hidePassingTests=void 0,this.options.hideLog=void 0,this.options.hideError=void 0,this.options.oneConsolePerContext=!0,this.options.logToDom=void 0,this.options.logToFile=void 0,this.options.logMaxSize=0,this.options.logMaxArchives=3,this.options.logIndexArchive=0,this.options.logToRemote=void 0,this.options.addArchiveTimestamp=!0,this.options.addArchiveIndex=!0,this.options.logToRemoteUrl=void 0,this.options.logToRemoteBinaryUrl=void 0,this.options.compressArchives=!1,this.options.compressionLevel=1,this.options.protocol=void 0,this.options.host=void 0,this.options.port=void 0,this.options.pathname=void 0,this.options.binarypathname=void 0,this.options.enableDate=void 0}resetOptions(){this.resetLogger()}setOptions({contextLenMax:t=10,idLenMax:n=5,lidLenMax:r=6,symbolLenMax:o=2,messageLenMax:s=void 0,hideLog:a=void 0,hideError:l=void 0,hideHookMessage:f=void 0,hidePassingTests:d=void 0,logToDom:h=void 0,logToFile:g=void 0,logMaxSize:v=0,logMaxArchives:b=3,logIndexArchive:w=0,addArchiveTimestamp:F=!0,addArchiveIndex:K=!0,compressArchives:Q=!1,compressionLevel:Z=1,logToRemote:Ne=void 0,logToRemoteUrl:Fe=void 0,logToRemoteBinaryUrl:Ie=void 0,loopback:Me=E.loopback,requiredLogLevel:De=y.LOG,oneConsolePerContext:ke=void 0,silent:fe=void 0,enableDate:Pe=void 0,protocol:He=void 0,host:Ue=void 0,port:_e=void 0,pathname:Be=void 0,binarypathname:je=void 0,loadHtmlToImage:Ge=!1}=null){if(this.options.contextLenMax=t,this.options.idLenMax=n,this.options.lidLenMax=r,this.options.messageLenMax=s,this.options.symbolLenMax=o,this.options.logMaxSize=v,this.options.logMaxArchives=b,this.options.logIndexArchive=w,this.options.addArchiveTimestamp=F,this.options.addArchiveIndex=K,this.options.compressArchives=Q,this.options.compressionLevel=Z,this.options.requiredLogLevel=De,Ge){let R=at();st(R)}let ee;fe!==void 0?ee=!!fe:a!==void 0&&(ee=!!a),[{hideLog:ee},{oneConsolePerContext:ke},{hideError:l},{enableDate:Pe},{hideHookMessage:f},{hidePassingTests:d},{logToRemote:Ne}].forEach(R=>{let P=Object.keys(R)[0],H=R[P];H!==void 0&&(this.options[P]=!!H)}),[{logToRemoteBinaryUrl:Ie},{logToRemoteUrl:Fe},{loopback:Me},{protocol:He},{host:Ue},{port:_e},{pathname:Be},{binarypathname:je}].forEach(R=>{let P=Object.keys(R)[0],H=R[P];H!==void 0&&(this.options[P]=H)}),this.options.logToRemote&&!this.options.logToRemoteUrl&&(this.options.logToRemoteUrl=this.convertToUrl({protocol:this.options.protocol,host:this.options.host,port:this.options.port,pathname:this.options.pathname})),this.options.logToRemote&&!this.options.logToRemoteBinaryUrl&&(this.options.logToRemoteBinaryUrl=this.convertToUrl({protocol:this.options.protocol,host:this.options.host,port:this.options.port,pathname:this.options.binarypathname||E.binarypathname})),h===!1?this.options.logToDom=!1:h!==void 0&&(this.options.logToDom=h===!0?E.consoleDomId:h),g===!1?this.options.logToFile=!1:g!==void 0&&(this.isBrowser()||(this.options.logToFile=g||E.logFilename),u.Console.log("LogToFile is not supported in this environment. "))}getOptions(){return this.options}truncateMessage(t="",{fit:n=0,align:r=u.ALIGN.LEFT,ellipsis:o="..."}={}){return t=""+t,n&&t.length>n&&(t=t.substring(0,n-o.length)+o),t=r===u.ALIGN.LEFT?t.padEnd(n," "):t.padStart(n," "),t}onBuildLog({contextName:t,message:n="",lid:r="",symbol:o=""}={}){try{let s="",a=n.split(/\n/g);for(let l=0;l<a.length;++l){let f=a[l],d=new Date,h=("0"+d.getHours()).slice(-2)+":"+("0"+d.getMinutes()).slice(-2)+":"+("0"+d.getSeconds()).slice(-2);this.options.enableDate&&(h=d.getFullYear().toString().slice(-2)+"-"+(d.getMonth()+1).toString().padStart(2,"0")+"-"+d.getDate().toString().padStart(2,"0")+" "+h),h=this.truncateMessage(h,{fit:this.options.timeLenMax}),l>0&&(t="",r=""),t=this.truncateMessage(t,{fit:this.options.contextLenMax,align:u.ALIGN.RIGHT}),r=this.truncateMessage(r,{fit:this.options.lidLenMax}),this.options.messageLenMax!==void 0&&(f=this.truncateMessage(f,{fit:this.options.messageLenMax})),o=this.truncateMessage(o,{fit:this.options.symbolLenMax}),l<=0?s+=`[${h}] ${t}: (${r}) ${o} ${f}`:l<a.length-1?(s+=`
2
+ `,Y={airplane:"\u2708",anchor:"\u2693",arrow_backward:"\u25C0",arrow_double_up:"\u23EB",arrow_double_down:"\u23EC",arrow_forward:"\u25B6",arrow_lower_right:"\u2198",arrow_lower_left:"\u2199",arrow_right_hook:"\u21AA",arrow_up_down:"\u2195",arrow_upper_left:"\u2196",arrow_upper_right:"\u2197",ballot_box_with_check:"\u2611",biohazard:"\u2623",black_circle:"\u23FA",black_medium_small_square:"\u25FE",black_medium_square:"\u25FC",black_nib:"\u2712",black_small_square:"\u25AA",black_square:"\u23F9",chains:"\u26D3",check:"\u2714",chess_pawn:"\u265F",cloud_and_rain:"\u26C8",clubs:"\u2663",coffee:"\u2615",copyright:"\xA9",cross:"\u274C",diamonds:"\u2666",divisions_ign:"\u2797",double_triangle_right:"\u23ED",double_triangle_left:"\u23EE",email:"\u2709",eject:"\u23CF",exclamation_mark:"\u2757",fast_forward:"\u23E9",female_sign:"\u2640",fist:"\u270A",fuel_pump:"\u26FD",gear:"\u2699",hammer_and_pick:"\u2692",hand:"\u270B",hearts:"\u2665",infinity:"\u267E",information:"\u2139",left_right_arrow:"\u2194",leftwards_arrow_with_hook:"\u21A9",male_sign:"\u2642",minus_sign:"\u2796",no_entry:"\u26D4",partly_sunny:"\u26C5",pencil:"\u270F",phone:"\u260E",plus_sign:"\u2795",question:"\u2754",radioactive:"\u2622",raised_hand:"\u270B",recycle:"\u267B",registered:"\xAE",relaxed:"\u263A",rewind:"\u23EA",scissors:"\u2702",snowman:"\u2603",spades:"\u2660",sparkles:"\u2728",star:"\u2B50",sunny:"\u2600",tent:"\u26FA",trademark:"\u2122",triangle_with_vertical_bar:"\u23EF",umbrella:"\u2614",vertical_bars:"\u23F8",watch:"\u231A",white_frowning_face:"\u2639",white_medium_square:"\u25FB",white_medium_small_square:"\u25FD",white_small_square:"\u25AB",wheelchair:"\u267F",white_circle:"\u26AA",writing_hand:"\u270D"};function rt(i){try{let t=path.extname(i),n=path.basename(i,t),r=path.dirname(i),o=i.slice(0,i.length-t.length);return{extension:t,filePath:o,basename:n,dirname:r}}catch(t){console.error("FILEPATH_EXT_FAILURE: ",t.message)}return{extension:".log",filePath:i}}function ot(){return new Date().toISOString().replace(/:/g,"-").replace(/\./g,"-")}function it(i,t,n,r,o,s,a){fs.readdir(i,(l,f)=>{if(l){a(l,null);return}let d=[],h=0,g=(b,w)=>{if(!fs.existsSync(b)){w(null,null);return}fs.unlink(b,F=>{F?console.error(`DELETION_FAILURE: Error deleting file ${b}: ${F}`):d.push(b),h++,h===f.length&&w(null,d)})},v=b=>{if(b.startsWith(t+".")&&b.endsWith(n+r)){let w=path.join(i,b);o&&ct(w,o,s),g(w,a)}else h++,h===f.length&&a(null,d)};f.length===0?a(null,d):f.forEach(v,s)})}function st(i,t={}){let n=document.createElement("script");n.textContent=i;for(let r in t)n.setAttribute(r,t[r]);document.head.appendChild(n),n.remove()}function at(){let i=[];return i.push(`!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports):"function"==typeof define&&define.amd?define(["exports"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).htmlToImage={})}(this,(function(t){"use strict";function e(t,e,n,r){return new(n||(n=Promise))((function(i,o){function u(t){try{a(r.next(t))}catch(t){o(t)}}function c(t){try{a(r.throw(t))}catch(t){o(t)}}function a(t){var e;t.done?i(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(u,c)}a((r=r.apply(t,e||[])).next())}))}function n(t,e){var n,r,i,o,u={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return o={next:c(0),throw:c(1),return:c(2)},"function"==typeof Symbol&&(o[Symbol.iterator]=function(){return this}),o;function c(c){return function(a){return function(c){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,c[0]&&(u=0)),u;)try{if(n=1,r&&(i=2&c[0]?r.return:c[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,c[1])).done)return i;switch(r=0,i&&(c=[2&c[0],i.value]),c[0]){case 0:case 1:i=c;break;case 4:return u.label++,{value:c[1],done:!1};case 5:u.label++,r=c[1],c=[0];continue;case 7:c=u.ops.pop(),u.trys.pop();continue;default:if(!(i=u.trys,(i=i.length>0&&i[i.length-1])||6!==c[0]&&2!==c[0])){u=0;continue}if(3===c[0]&&(!i||c[1]>i[0]&&c[1]<i[3])){u.label=c[1];break}if(6===c[0]&&u.label<i[1]){u.label=i[1],i=c;break}if(i&&u.label<i[2]){u.label=i[2],u.ops.push(c);break}i[2]&&u.ops.pop(),u.trys.pop();continue}c=e.call(t,u)}catch(t){c=[6,t],r=0}finally{n=i=0}if(5&c[0])throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}([c,a])}}}var r,i=(r=0,function(){return r+=1,"u".concat("0000".concat((Math.random()*Math.pow(36,4)<<0).toString(36)).slice(-4)).concat(r)});function o(t){for(var e=[],n=0,r=t.length;n<r;n++)e.push(t[n]);return e}var u=null;function c(t){return void 0===t&&(t={}),u||(u=t.includeStyleProperties?t.includeStyleProperties:o(window.getComputedStyle(document.documentElement)))}function a(t,e){var n=(t.ownerDocument.defaultView||window).getComputedStyle(t).getPropertyValue(e);return n?parseFloat(n.replace("px","")):0}function s(t,e){void 0===e&&(e={});var n,r,i,o=e.width||(r=a(n=t,"border-left-width"),i=a(n,"border-right-width"),n.clientWidth+r+i),u=e.height||function(t){var e=a(t,"border-top-width"),n=a(t,"border-bottom-width");return t.clientHeight+e+n}(t);return{width:o,height:u}}var l=16384;function f(t,e){return void 0===e&&(e={}),t.toBlob?new Promise((function(n){t.toBlob(n,e.type?e.type:"image/png",e.quality?e.quality:1)})):new Promise((function(n){for(var r=window.atob(t.toDataURL(e.type?e.type:void 0,e.quality?e.quality:void 0).split(",")[1]),i=r.length,o=new Uint8Array(i),u=0;u<i;u+=1)o[u]=r.charCodeAt(u);n(new Blob([o],{type:e.type?e.type:"image/png"}))}))}function h(t){return new Promise((function(e,n){var r=new Image;r.onload=function(){r.decode().then((function(){requestAnimationFrame((function(){return e(r)}))}))},r.onerror=n,r.crossOrigin="anonymous",r.decoding="async",r.src=t}))}function d(t){return e(this,void 0,void 0,(function(){return n(this,(function(e){return[2,Promise.resolve().then((function(){return(new XMLSerializer).serializeToString(t)})).then(encodeURIComponent).then((function(t){return"data:image/svg+xml;charset=utf-8,".concat(t)}))]}))}))}function v(t,r,i){return e(this,void 0,void 0,(function(){var e,o,u;return n(this,(function(n){return e="http://www.w3.org/2000/svg",o=document.createElementNS(e,"svg"),u=document.createElementNS(e,"foreignObject"),o.setAttribute("width","".concat(r)),o.setAttribute("height","".concat(i)),o.setAttribute("viewBox","0 0 ".concat(r," ").concat(i)),u.setAttribute("width","100%"),u.setAttribute("height","100%"),u.setAttribute("x","0"),u.setAttribute("y","0"),u.setAttribute("externalResourcesRequired","true"),o.appendChild(u),u.appendChild(t),[2,d(o)]}))}))}var p=function(t,e){if(t instanceof e)return!0;var n=Object.getPrototypeOf(t);return null!==n&&(n.constructor.name===e.name||p(n,e))};function g(t,e,n,r){var i=".".concat(t,":").concat(e),o=n.cssText?function(t){var e=t.getPropertyValue("content");return"".concat(t.cssText," content: '").concat(e.replace(/'|"/g,""),"';")}(n):function(t,e){return c(e).map((function(e){var n=t.getPropertyValue(e),r=t.getPropertyPriority(e);return"".concat(e,": ").concat(n).concat(r?" !important":"",";")})).join(" ")}(n,r);return document.createTextNode("".concat(i,"{").concat(o,"}"))}function m(t,e,n,r){var o=window.getComputedStyle(t,n),u=o.getPropertyValue("content");if(""!==u&&"none"!==u){var c=i();try{e.className="".concat(e.className," ").concat(c)}catch(t){return}var a=document.createElement("style");a.appendChild(g(c,n,o,r)),e.appendChild(a)}}var w="application/font-woff",y="image/jpeg",b={woff:w,woff2:w,ttf:"application/font-truetype",eot:"application/vnd.ms-fontobject",png:"image/png",jpg:y,jpeg:y,gif:"image/gif",tiff:"image/tiff",svg:"image/svg+xml",webp:"image/webp"};function S(t){var e=function(t){var e=/\\.([^./]*?)$/g.exec(t);return e?e[1]:""}(t).toLowerCase();return b[e]||""}function E(t){return-1!==t.search(/^(data:)/)}function x(t,e){return"data:".concat(e,";base64,").concat(t)}function C(t,r,i){return e(this,void 0,void 0,(function(){var e,o;return n(this,(function(n){switch(n.label){case 0:return[4,fetch(t,r)];case 1:if(404===(e=n.sent()).status)throw new Error('Resource "'.concat(e.url,'" not found'));return[4,e.blob()];case 2:return o=n.sent(),[2,new Promise((function(t,n){var r=new FileReader;r.onerror=n,r.onloadend=function(){try{t(i({res:e,result:r.result}))}catch(t){n(t)}},r.readAsDataURL(o)}))]}}))}))}var P={};function R(t,r,i){return e(this,void 0,void 0,(function(){var e,o,u,c,a;return n(this,(function(n){switch(n.label){case 0:if(e=function(t,e,n){var r=t.replace(/\\?.*/,"");return n&&(r=t),/ttf|otf|eot|woff2?/i.test(r)&&(r=r.replace(/.*\\//,"")),e?"[".concat(e,"]").concat(r):r}(t,r,i.includeQueryParams),null!=P[e])return[2,P[e]];i.cacheBust&&(t+=(/\\?/.test(t)?"&":"?")+(new Date).getTime()),n.label=1;case 1:return n.trys.push([1,3,,4]),[4,C(t,i.fetchRequestInit,(function(t){var e=t.res,n=t.result;return r||(r=e.headers.get("Content-Type")||""),function(t){return t.split(/,/)[1]}(n)}))];case 2:return u=n.sent(),o=x(u,r),[3,4];case 3:return c=n.sent(),o=i.imagePlaceholder||"",a="Failed to fetch resource: ".concat(t),c&&(a="string"==typeof c?c:c.message),a&&console.warn(a),[3,4];case 4:return P[e]=o,[2,o]}}))}))}function T(t){return e(this,void 0,void 0,(function(){var e;return n(this,(function(n){return"data:,"===(e=t.toDataURL())?[2,t.cloneNode(!1)]:[2,h(e)]}))}))}function A(t,r){return e(this,void 0,void 0,(function(){var e,i,o,u;return n(this,(function(n){switch(n.label){case 0:return t.currentSrc?(e=document.createElement("canvas"),i=e.getContext("2d"),e.width=t.clientWidth,e.height=t.clientHeight,null==i||i.drawImage(t,0,0,e.width,e.height),[2,h(e.toDataURL())]):(o=t.poster,u=S(o),[4,R(o,u,r)]);case 1:return[2,h(n.sent())]}}))}))}function k(t,r){var i;return e(this,void 0,void 0,(function(){return n(this,(function(e){switch(e.label){case 0:return e.trys.push([0,3,,4]),(null===(i=null==t?void 0:t.contentDocument)||void 0===i?void 0:i.body)?[4,I(t.contentDocument.body,r,!0)]:[3,2];case 1:return[2,e.sent()];case 2:return[3,4];case 3:return e.sent(),[3,4];case 4:return[2,t.cloneNode(!1)]}}))}))}var L=function(t){return null!=t.tagName&&"SVG"===t.tagName.toUpperCase()};function N(t,e,n){return p(e,Element)&&(function(t,e,n){var r=e.style;if(r){var i=window.getComputedStyle(t);i.cssText?(r.cssText=i.cssText,r.transformOrigin=i.transformOrigin):c(n).forEach((function(n){var o=i.getPropertyValue(n);if("font-size"===n&&o.endsWith("px")){var u=Math.floor(parseFloat(o.substring(0,o.length-2)))-.1;o="".concat(u,"px")}p(t,HTMLIFrameElement)&&"display"===n&&"inline"===o&&(o="block"),"d"===n&&e.getAttribute("d")&&(o="path(".concat(e.getAttribute("d"),")")),r.setProperty(n,o,i.getPropertyPriority(n))}))}}(t,e,n),function(t,e,n){m(t,e,":before",n),m(t,e,":after",n)}(t,e,n),function(t,e){p(t,HTMLTextAreaElement)&&(e.innerHTML=t.value),p(t,HTMLInputElement)&&e.setAttribute("value",t.value)}(t,e),function(t,e){if(p(t,HTMLSelectElement)){var n=e,r=Array.from(n.children).find((function(e){return t.value===e.getAttribute("value")}));r&&r.setAttribute("selected","")}}(t,e)),e}function I(t,r,i){return e(this,void 0,void 0,(function(){return n(this,(function(u){return i||!r.filter||r.filter(t)?[2,Promise.resolve(t).then((function(t){return function(t,r){return e(this,void 0,void 0,(function(){return n(this,(function(e){return p(t,HTMLCanvasElement)?[2,T(t)]:p(t,HTMLVideoElement)?[2,A(t,r)]:p(t,HTMLIFrameElement)?[2,k(t,r)]:[2,t.cloneNode(L(t))]}))}))}(t,r)})).then((function(i){return function(t,r,i){var u,c;return e(this,void 0,void 0,(function(){var e;return n(this,(function(n){switch(n.label){case 0:return L(r)?[2,r]:(e=[],0===(e=null!=(a=t).tagName&&"SLOT"===a.tagName.toUpperCase()&&t.assignedNodes?o(t.assignedNodes()):p(t,HTMLIFrameElement)&&(null===(u=t.contentDocument)||void 0===u?void 0:u.body)?o(t.contentDocument.body.childNodes):o((null!==(c=t.shadowRoot)&&void 0!==c?c:t).childNodes)).length||p(t,HTMLVideoElement)?[2,r]:[4,e.reduce((function(t,e){return t.then((function(){return I(e,i)})).then((function(t){t&&r.appendChild(t)}))}),Promise.resolve())]);case 1:return n.sent(),[2,r]}var a}))}))}(t,i,r)})).then((function(e){return N(t,e,r)})).then((function(t){return function(t,r){return e(this,void 0,void 0,(function(){var e,i,o,u,c,a,s,l,f,h,d,v,p;return n(this,(function(n){switch(n.label){case 0:if(0===(e=t.querySelectorAll?t.querySelectorAll("use"):[]).length)return[2,t];i={},p=0,n.label=1;case 1:return p<e.length?(o=e[p],(u=o.getAttribute("xlink:href"))?(c=t.querySelector(u),a=document.querySelector(u),c||!a||i[u]?[3,3]:(s=i,l=u,[4,I(a,r,!0)])):[3,3]):[3,4];case 2:s[l]=n.sent(),n.label=3;case 3:return p++,[3,1];case 4:if((f=Object.values(i)).length){for(h="http://www.w3.org/1999/xhtml",(d=document.createElementNS(h,"svg")).setAttribute("xmlns",h),d.style.position="absolute",d.style.width="0",d.style.height="0",d.style.overflow="hidden",d.style.display="none",v=document.createElementNS(h,"defs"),d.appendChild(v),p=0;p<f.length;p++)v.appendChild(f[p]);t.appendChild(d)}return[2,t]}}))}))}(t,r)}))]:[2,null]}))}))}var D=/url\\((['"]?)([^'"]+?)\\1\\)/g,H=/url\\([^)]+\\)\\s*format\\((["']?)([^"']+)\\1\\)/g,M=/src:\\s*(?:url\\([^)]+\\)\\s*format\\([^)]+\\)[,;]\\s*)+/g;function F(t,r,i,o,u){return e(this,void 0,void 0,(function(){var e,c,a,s;return n(this,(function(n){switch(n.label){case 0:return n.trys.push([0,5,,6]),e=i?function(t,e){if(t.match(/^[a-z]+:\\/\\//i))return t;if(t.match(/^\\/\\//))return window.location.protocol+t;if(t.match(/^[a-z]+:/i))return t;var n=document.implementation.createHTMLDocument(),r=n.createElement("base"),i=n.createElement("a");return n.head.appendChild(r),n.body.appendChild(i),e&&(r.href=e),i.href=t,i.href}(r,i):r,c=S(r),a=void 0,u?[4,u(e)]:[3,2];case 1:return s=n.sent(),a=x(s,c),[3,4];case 2:return[4,R(e,c,o)];case 3:a=n.sent(),n.label=4;case 4:return[2,t.replace((l=r,f=l.replace(/([.*+?^$`),i.push(`{}()|\\[\\]\\/\\\\])/g,"\\\\$1"),new RegExp("(url\\\\(['\\"]?)(".concat(f,")(['\\"]?\\\\))"),"g")),"$1".concat(a,"$3"))];case 5:return n.sent(),[3,6];case 6:return[2,t]}var l,f}))}))}function V(t){return-1!==t.search(D)}function q(t,r,i){return e(this,void 0,void 0,(function(){var e,o;return n(this,(function(n){return V(t)?(e=function(t,e){var n=e.preferredFontFormat;return n?t.replace(M,(function(t){for(;;){var e=H.exec(t)||[],r=e[0],i=e[2];if(!i)return"";if(i===n)return"src: ".concat(r,";")}})):t}(t,i),o=function(t){var e=[];return t.replace(D,(function(t,n,r){return e.push(r),t})),e.filter((function(t){return!E(t)}))}(e),[2,o.reduce((function(t,e){return t.then((function(t){return F(t,e,r,i)}))}),Promise.resolve(e))]):[2,t]}))}))}function U(t,r,i){var o;return e(this,void 0,void 0,(function(){var e,u;return n(this,(function(n){switch(n.label){case 0:return(e=null===(o=r.style)||void 0===o?void 0:o.getPropertyValue(t))?[4,q(e,null,i)]:[3,2];case 1:return u=n.sent(),r.style.setProperty(t,u,r.style.getPropertyPriority(t)),[2,!0];case 2:return[2,!1]}}))}))}function j(t,r){return e(this,void 0,void 0,(function(){var e,i;return n(this,(function(n){switch(n.label){case 0:return[4,U("background",t,r)];case 1:return n.sent()?[3,3]:[4,U("background-image",t,r)];case 2:n.sent(),n.label=3;case 3:return[4,U("mask",t,r)];case 4:return(i=n.sent())?[3,6]:[4,U("-webkit-mask",t,r)];case 5:i=n.sent(),n.label=6;case 6:return(e=i)?[3,8]:[4,U("mask-image",t,r)];case 7:e=n.sent(),n.label=8;case 8:return e?[3,10]:[4,U("-webkit-mask-image",t,r)];case 9:n.sent(),n.label=10;case 10:return[2]}}))}))}function O(t,r){return e(this,void 0,void 0,(function(){var e,i,o;return n(this,(function(n){switch(n.label){case 0:return(e=p(t,HTMLImageElement))&&!E(t.src)||p(t,SVGImageElement)&&!E(t.href.baseVal)?[4,R(i=e?t.src:t.href.baseVal,S(i),r)]:[2];case 1:return o=n.sent(),[4,new Promise((function(n,i){t.onload=n,t.onerror=r.onImageErrorHandler?function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];try{n(r.onImageErrorHandler.apply(r,t))}catch(t){i(t)}}:i;var u=t;u.decode&&(u.decode=n),"lazy"===u.loading&&(u.loading="eager"),e?(t.srcset="",t.src=o):t.href.baseVal=o}))];case 2:return n.sent(),[2]}}))}))}function B(t,r){return e(this,void 0,void 0,(function(){var e,i;return n(this,(function(n){switch(n.label){case 0:return e=o(t.childNodes),i=e.map((function(t){return z(t,r)})),[4,Promise.all(i).then((function(){return t}))];case 1:return n.sent(),[2]}}))}))}function z(t,r){return e(this,void 0,void 0,(function(){return n(this,(function(e){switch(e.label){case 0:return p(t,Element)?[4,j(t,r)]:[3,4];case 1:return e.sent(),[4,O(t,r)];case 2:return e.sent(),[4,B(t,r)];case 3:e.sent(),e.label=4;case 4:return[2]}}))}))}var W={};function $(t){return e(this,void 0,void 0,(function(){var e,r;return n(this,(function(n){switch(n.label){case 0:return null!=(e=W[t])?[2,e]:[4,fetch(t)];case 1:return[4,n.sent().text()];case 2:return r=n.sent(),e={url:t,cssText:r},W[t]=e,[2,e]}}))}))}function G(t,r){return e(this,void 0,void 0,(function(){var i,o,u,c,a=this;return n(this,(function(s){return i=t.cssText,o=/url\\(["']?([^"')]+)["']?\\)/g,u=i.match(/url\\([^)]+\\)/g)||[],c=u.map((function(u){return e(a,void 0,void 0,(function(){var e;return n(this,(function(n){return(e=u.replace(o,"$1")).startsWith("https://")||(e=new URL(e,t.url).href),[2,C(e,r.fetchRequestInit,(function(t){var e=t.result;return i=i.replace(u,"url(".concat(e,")")),[u,e]}))]}))}))})),[2,Promise.all(c).then((function(){return i}))]}))}))}function _(t){if(null==t)return[];for(var e=[],n=t.replace(/(\\/\\*[\\s\\S]*?\\*\\/)/gi,""),r=new RegExp("((@.*?keyframes [\\\\s\\\\S]*?){([\\\\s\\\\S]*?}\\\\s*?)})","gi");;){if(null===(u=r.exec(n)))break;e.push(u[0])}n=n.replace(r,"");for(var i=/@import[\\s\\S]*?url\\([^)]*\\)[\\s\\S]*?;/gi,o=new RegExp("((\\\\s*?(?:\\\\/\\\\*[\\\\s\\\\S]*?\\\\*\\\\/)?\\\\s*?@media[\\\\s\\\\S]*?){([\\\\s\\\\S]*?)}\\\\s*?})|(([\\\\s\\\\S]*?){([\\\\s\\\\S]*?)})","gi");;){var u;if(null===(u=i.exec(n))){if(null===(u=o.exec(n)))break;i.lastIndex=o.lastIndex}else o.lastIndex=i.lastIndex;e.push(u[0])}return e}function J(t,r){return e(this,void 0,void 0,(function(){var e,i;return n(this,(function(n){return e=[],i=[],t.forEach((function(e){if("cssRules"in e)try{o(e.cssRules||[]).forEach((function(t,n){if(t.type===CSSRule.IMPORT_RULE){var o=n+1,u=$(t.href).then((function(t){return G(t,r)})).then((function(t){return _(t).forEach((function(t){try{e.insertRule(t,t.startsWith("@import")?o+=1:e.cssRules.length)}catch(e){console.error("Error inserting rule from remote css",{rule:t,error:e})}}))})).catch((function(t){console.error("Error loading remote css",t.toString())}));i.push(u)}}))}catch(o){var n=t.find((function(t){return null==t.href}))||document.styleSheets[0];null!=e.href&&i.push($(e.href).then((function(t){return G(t,r)})).then((function(t){return _(t).forEach((function(t){n.insertRule(t,n.cssRules.length)}))})).catch((function(t){console.error("Error loading remote stylesheet",t)}))),console.error("Error inlining remote css file",o)}})),[2,Promise.all(i).then((function(){return t.forEach((function(t){if("cssRules"in t)try{o(t.cssRules||[]).forEach((function(t){e.push(t)}))}catch(e){console.error("Error while reading CSS rules from ".concat(t.href),e)}})),e}))]}))}))}function Q(t){return t.filter((function(t){return t.type===CSSRule.FONT_FACE_RULE})).filter((function(t){return V(t.style.getPropertyValue("src"))}))}function X(t,r){return e(this,void 0,void 0,(function(){return n(this,(function(e){switch(e.label){case 0:if(null==t.ownerDocument)throw new Error("Provided element is not within a Document");return[4,J(o(t.ownerDocument.styleSheets),r)];case 1:return[2,Q(e.sent())]}}))}))}function K(t){return t.trim().replace(/["']/g,"")}function Y(t,r){return e(this,void 0,void 0,(function(){var e,i;return n(this,(function(n){switch(n.label){case 0:return[4,X(t,r)];case 1:return e=n.sent(),i=function(t){var e=new Set;return function t(n){(n.style.fontFamily||getComputedStyle(n).fontFamily).split(",").forEach((function(t){e.add(K(t))})),Array.from(n.children).forEach((function(e){e instanceof HTMLElement&&t(e)}))}(t),e}(t),[4,Promise.all(e.filter((function(t){return i.has(K(t.style.fontFamily))})).map((function(t){var e=t.parentStyleSheet?t.parentStyleSheet.href:null;return q(t.cssText,e,r)})))];case 2:return[2,n.sent().join("\\n")]}}))}))}function Z(t,r){return e(this,void 0,void 0,(function(){var e,i,o,u,c;return n(this,(function(n){switch(n.label){case 0:return null==r.fontEmbedCSS?[3,1]:(i=r.fontEmbedCSS,[3,5]);case 1:return r.skipFonts?(o=null,[3,4]):[3,2];case 2:return[4,Y(t,r)];case 3:o=n.sent(),n.label=4;case 4:i=o,n.label=5;case 5:return(e=i)&&(u=document.createElement("style"),c=document.createTextNode(e),u.appendChild(c),t.firstChild?t.insertBefore(u,t.firstChild):t.appendChild(u)),[2]}}))}))}function tt(t,r){return void 0===r&&(r={}),e(this,void 0,void 0,(function(){var e,i,o,u;return n(this,(function(n){switch(n.label){case 0:return e=s(t,r),i=e.width,o=e.height,[4,I(t,r,!0)];case 1:return[4,Z(u=n.sent(),r)];case 2:return n.sent(),[4,z(u,r)];case 3:return n.sent(),function(t,e){var n=t.style;e.backgroundColor&&(n.backgroundColor=e.backgroundColor),e.width&&(n.width="".concat(e.width,"px")),e.height&&(n.height="".concat(e.height,"px"));var r=e.style;null!=r&&Object.keys(r).forEach((function(t){n[t]=r[t]}))}(u,r),[4,v(u,i,o)];case 4:return[2,n.sent()]}}))}))}function et(t,r){return void 0===r&&(r={}),e(this,void 0,void 0,(function(){var e,i,o,u,c,a,f,d,v;return n(this,(function(n){switch(n.label){case 0:return e=s(t,r),i=e.width,o=e.height,[4,tt(t,r)];case 1:return[4,h(n.sent())];case 2:return u=n.sent(),c=document.createElement("canvas"),a=c.getContext("2d"),f=r.pixelRatio||function(){var t,e;try{e=process}catch(t){}var n=e&&e.env?e.env.devicePixelRatio:null;return n&&(t=parseInt(n,10),Number.isNaN(t)&&(t=1)),t||window.devicePixelRatio||1}(),d=r.canvasWidth||i,v=r.canvasHeight||o,c.width=d*f,c.height=v*f,r.skipAutoScale||function(t){(t.width>l||t.height>l)&&(t.width>l&&t.height>l?t.width>t.height?(t.height*=l/t.width,t.width=l):(t.width*=l/t.height,t.height=l):t.width>l?(t.height*=l/t.width,t.width=l):(t.width*=l/t.height,t.height=l))}(c),c.style.width="".concat(d),c.style.height="".concat(v),r.backgroundColor&&(a.fillStyle=r.backgroundColor,a.fillRect(0,0,c.width,c.height)),a.drawImage(u,0,0,c.width,c.height),[2,c]}}))}))}t.getFontEmbedCSS=function(t,r){return void 0===r&&(r={}),e(this,void 0,void 0,(function(){return n(this,(function(e){return[2,Y(t,r)]}))}))},t.toBlob=function(t,r){return void 0===r&&(r={}),e(this,void 0,void 0,(function(){return n(this,(function(e){switch(e.label){case 0:return[4,et(t,r)];case 1:return[4,f(e.sent())];case 2:return[2,e.sent()]}}))}))},t.toCanvas=et,t.toJpeg=function(t,r){return void 0===r&&(r={}),e(this,void 0,void 0,(function(){return n(this,(function(e){switch(e.label){case 0:return[4,et(t,r)];case 1:return[2,e.sent().toDataURL("image/jpeg",r.quality||1)]}}))}))},t.toPixelData=function(t,r){return void 0===r&&(r={}),e(this,void 0,void 0,(function(){var e,i,o,u;return n(this,(function(n){switch(n.label){case 0:return e=s(t,r),i=e.width,o=e.height,[4,et(t,r)];case 1:return u=n.sent(),[2,u.getContext("2d").getImageData(0,0,i,o).data]}}))}))},t.toPng=function(t,r){return void 0===r&&(r={}),e(this,void 0,void 0,(function(){return n(this,(function(e){switch(e.label){case 0:return[4,et(t,r)];case 1:return[2,e.sent().toDataURL()]}}))}))},t.toSvg=tt}));`),i.join("")}function ct(i,t,n=1){try{if(!fs.existsSync(i))return;if(!fs.existsSync(t)){let o=fs.mkdtempSync(path.join(os.tmpdir(),"tar-gz-init-"));try{let s=path.join(o,path.basename(i));fs.copyFileSync(i,s),c({sync:!0,gzip:{level:n},file:t,cwd:o,portable:!0},[path.basename(i)])}finally{fs.rmSync(o,{recursive:!0,force:!0})}return}let r=fs.mkdtempSync(path.join(os.tmpdir(),"tar-gz-append-"));try{x({file:t,cwd:r,sync:!0});let o=path.join(r,path.basename(i));fs.copyFileSync(i,o),c({gzip:!0,file:t,cwd:r,sync:!0,portable:!0},fs.readdirSync(r))}finally{fs.rmSync(r,{recursive:!0,force:!0})}}catch{console.error(`ARCHIVE_FAILURE: ${e.message}`)}}function Ae(){return typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node<"u"?U.NODE:U.BROWSER}var lt=Ae();function ut(){return lt===U.NODE}var ft=["alert","assert","keepLogHistory","getLogHistory","truncateMessage","truncateMessage","rawLog","removeOverride","removeOverrideError","overrideConsole","overrideError","table","rawInfo","rawWarn","rawError","hasSeenLid","addToLogHistory","releaseLogHistory","resetLogHistory","setLogFormat","resetLogFormatter","getRawLogHistory"],B,A,C,N,T,J,Re,X,Ce,u=class{constructor({name:t="default"}={}){O(this,J);O(this,X);p(this,"system","");p(this,"instanceId","");p(this,"instanceName","");p(this,"logIndex",0);p(this,"logCounter",0);O(this,A,[]);O(this,C,{});O(this,N,{});p(this,"activeTargets",[]);p(this,"indexColor",0);p(this,"format","");p(this,"keepLog",!1);p(this,"logHistory",[]);p(this,"$containers",null);p(this,"options",{hideHookMessage:!1});O(this,T,{log:!1,info:!1,warn:!1,error:!1});p(this,"originalFormatFunction");p(this,"removeDomOldEntries",t=>{if(t.childElementCount>se){let r=Math.ceil(se/10);for(let o=0;o<r;++o)t.removeChild(t.firstChild);return r}return 0});p(this,"scrollDivToBottom",t=>{let n=t.scrollHeight-(t.clientHeight+t.scrollTop),r=t.clientHeight||t.offsetHeight;n>r/2||(t.scrollTop=t.scrollHeight)});this.system=Ae(),this.format=this.onBuildLog.bind(this),this.originalFormatFunction=this.format,this.instanceName=t,this.instanceId=u.instanceCount+"-"+Date.now(),m(u,B)[u.instanceCount]=this,++u.instanceCount,this.errorTargetHandler=this.onError.bind(this),this.errorUserTargetHandler=this.onErrorForUserTarget.bind(this),this.setOptions(this.options),u.Console||(u.Console={log:console.log,info:console.info,warn:console.warn,error:console.error,debug:console.debug,table:console.table}),this.rawLog=u.Console.log,this.rawInfo=u.Console.info,this.rawWarn=u.Console.warn,this.rawError=u.Console.error,this.ALIGN=u.ALIGN,this.ENVIRONMENT_TYPE=u.ENVIRONMENT_TYPE,re(this,X,Ce).call(this),this.resetLogHistory()}getName(){return this.instanceName}getId(){return this.instanceId}keepLogHistory(){this.keepLog=!0}releaseLogHistory(){this.keepLog=!1}resetLogHistory(){this.logHistory=[]}addToLogHistory(t){t=t||{},this.logHistory.push(Object.assign({},t))}getLogHistory(t=!0,n=nt){let r=this.logHistory||[],o=[];return r.forEach(s=>{let{text:a}=s;o.push(a)}),t?o.join(n):o}getRawLogHistory(){return this.logHistory||[]}hasSeenLid(t){this.logHistory=this.logHistory||[];for(let n=0;n<this.logHistory.length;++n){let o=(this.logHistory[n]||{}).context||{};if(t===o.lid)return!0}return!1}forceEnvironment(t){this.forcedSystem=t}isNode(){return this&&this.forcedSystem?this.forcedSystem===U.NODE:ut()}isBrowser(){return!this.isNode()}resetLogger(){this.options={},this.options.timeLenMax=12,this.options.contextLenMax=10,this.options.idLenMax=5,this.options.lidLenMax=6,this.options.messageLenMax=void 0,this.options.symbolLenMax=60,this.options.hideHookMessage=void 0,this.options.hidePassingTests=void 0,this.options.hideLog=void 0,this.options.hideError=void 0,this.options.oneConsolePerContext=!0,this.options.logToDom=void 0,this.options.logToFile=void 0,this.options.logMaxSize=0,this.options.logMaxArchives=3,this.options.logIndexArchive=0,this.options.logToRemote=void 0,this.options.addArchiveTimestamp=!0,this.options.addArchiveIndex=!0,this.options.logToRemoteUrl=void 0,this.options.logToRemoteBinaryUrl=void 0,this.options.compressArchives=!1,this.options.compressionLevel=1,this.options.protocol=void 0,this.options.host=void 0,this.options.port=void 0,this.options.pathname=void 0,this.options.binarypathname=void 0,this.options.enableDate=void 0}resetOptions(){this.resetLogger()}setOptions({contextLenMax:t=10,idLenMax:n=5,lidLenMax:r=6,symbolLenMax:o=2,messageLenMax:s=void 0,hideLog:a=void 0,hideError:l=void 0,hideHookMessage:f=void 0,hidePassingTests:d=void 0,logToDom:h=void 0,logToFile:g=void 0,logMaxSize:v=0,logMaxArchives:b=3,logIndexArchive:w=0,addArchiveTimestamp:F=!0,addArchiveIndex:K=!0,compressArchives:Q=!1,compressionLevel:Z=1,logToRemote:Ne=void 0,logToRemoteUrl:Fe=void 0,logToRemoteBinaryUrl:Ie=void 0,loopback:Me=E.loopback,requiredLogLevel:De=y.LOG,oneConsolePerContext:ke=void 0,silent:fe=void 0,enableDate:Pe=void 0,protocol:He=void 0,host:Ue=void 0,port:_e=void 0,pathname:Be=void 0,binarypathname:je=void 0,loadHtmlToImage:Ge=!1}=null){if(this.options.contextLenMax=t,this.options.idLenMax=n,this.options.lidLenMax=r,this.options.messageLenMax=s,this.options.symbolLenMax=o,this.options.logMaxSize=v,this.options.logMaxArchives=b,this.options.logIndexArchive=w,this.options.addArchiveTimestamp=F,this.options.addArchiveIndex=K,this.options.compressArchives=Q,this.options.compressionLevel=Z,this.options.requiredLogLevel=De,Ge){let R=at();st(R)}let ee;fe!==void 0?ee=!!fe:a!==void 0&&(ee=!!a),[{hideLog:ee},{oneConsolePerContext:ke},{hideError:l},{enableDate:Pe},{hideHookMessage:f},{hidePassingTests:d},{logToRemote:Ne}].forEach(R=>{let P=Object.keys(R)[0],H=R[P];H!==void 0&&(this.options[P]=!!H)}),[{logToRemoteBinaryUrl:Ie},{logToRemoteUrl:Fe},{loopback:Me},{protocol:He},{host:Ue},{port:_e},{pathname:Be},{binarypathname:je}].forEach(R=>{let P=Object.keys(R)[0],H=R[P];H!==void 0&&(this.options[P]=H)}),this.options.logToRemote&&!this.options.logToRemoteUrl&&(this.options.logToRemoteUrl=this.convertToUrl({protocol:this.options.protocol,host:this.options.host,port:this.options.port,pathname:this.options.pathname})),this.options.logToRemote&&!this.options.logToRemoteBinaryUrl&&(this.options.logToRemoteBinaryUrl=this.convertToUrl({protocol:this.options.protocol,host:this.options.host,port:this.options.port,pathname:this.options.binarypathname||E.binarypathname})),h===!1?this.options.logToDom=!1:h!==void 0&&(this.options.logToDom=h===!0?E.consoleDomId:h),g===!1?this.options.logToFile=!1:g!==void 0&&(this.isBrowser()||(this.options.logToFile=g||E.logFilename),u.Console.log("LogToFile is not supported in this environment. "))}getOptions(){return this.options}truncateMessage(t="",{fit:n=0,align:r=u.ALIGN.LEFT,ellipsis:o="..."}={}){return t=""+t,n&&t.length>n&&(t=t.substring(0,n-o.length)+o),t=r===u.ALIGN.LEFT?t.padEnd(n," "):t.padStart(n," "),t}onBuildLog({contextName:t,message:n="",lid:r="",symbol:o=""}={}){try{let s="",a=n.split(/\n/g);for(let l=0;l<a.length;++l){let f=a[l],d=new Date,h=("0"+d.getHours()).slice(-2)+":"+("0"+d.getMinutes()).slice(-2)+":"+("0"+d.getSeconds()).slice(-2);this.options.enableDate&&(h=d.getFullYear().toString().slice(-2)+"-"+(d.getMonth()+1).toString().padStart(2,"0")+"-"+d.getDate().toString().padStart(2,"0")+" "+h),h=this.truncateMessage(h,{fit:this.options.timeLenMax}),l>0&&(t="",r=""),t=this.truncateMessage(t,{fit:this.options.contextLenMax,align:u.ALIGN.RIGHT}),r=this.truncateMessage(r,{fit:this.options.lidLenMax}),this.options.messageLenMax!==void 0&&(f=this.truncateMessage(f,{fit:this.options.messageLenMax})),o=this.truncateMessage(o,{fit:this.options.symbolLenMax}),l<=0?s+=`[${h}] ${t}: (${r}) ${o} ${f}`:l<a.length-1?(s+=`
4
3
  `,s+=`[${h}] ${t} ${r} ${f}`):f&&(s+=`
5
4
  `,s+=`[${h}] ${t} ${r} ${f}`)}return s}catch(s){console.rawError(s.message)}return""}onErrorForUserTarget(t,...n){this.errorUserTargetHandler(t,...n)}onError(t,...n){t.target===m(this,C).USER&&this.onErrorForUserTarget(t,...n)}onDisplayLog(...t){this.log(...t)}assistStask(t){try{let n=t.stack.split(`
6
5
  `),r=[];for(let o=0;o<n.length;++o){let s=n[o];r.push(s)}return r}catch(n){console.rawError(n.message)}return t.message}onDisplayError(...t){try{let n=-1,r=null;for(let o=0;o<t.length;++o){let s=t[o];if(s instanceof Error&&s.stack){n=o,r=this.assistStask(s)||[];break}}if(!r){this.error(...t);return}for(let o=0;o<r.length;++o)t[n]=r[o],this.error(...t)}catch(n){console.rawError(n)}}setLogFormat(t){if(typeof t!="function")return console.error("Invalid parameter for setFormat. It is expecting a function or method."),!1;this.format=t.bind(this)}resetLogFormatter(){this.format=this.originalFormatFunction}setErrorHandler(t){this.errorTargetHandler=t.bind(this)}setErrorHandlerForUserTarget(t){this.errorUserTargetHandler=t.bind(this)}isContextValid(t){return typeof t=="object"&&!Array.isArray(t)&&t!==null?t.hasOwnProperty("contextName")&&t.hasOwnProperty("target"):!1}setDefaultContext(t){this.setContext(_.DEFAULT.contextName,t)}generateDefaultContext(){let t=m(this,A)[_.DEFAULT.contextName]||{};return t=Object.assign({},{lid:"",contextName:_.DEFAULT.contextName,target:k.ALL,symbol:"\u26A1",color:D[1],logLevel:y.LOG},t),t.name=t.contextName,t.id=this.logIndex++,t}generateNewContext(){let t=this.generateDefaultContext();return t.color=D[this.indexColor++%(D.length-3)+2],t.symbol="",t}generateErrorContext(){let t=this.generateDefaultContext();return t.contextName=_.ERROR.contextName,t.name=t.contextName,t.color=D[0],t.symbol="\u274C",t.error=!0,t.logLevel=y.ERROR,t}setContext(t,n={}){n.contextName=t,n.name=t,n=re(this,J,Re).call(this,n),m(this,A)[t]=n}getContext(t){return m(this,A)[t]}setContexts(t){Object.keys(t).forEach(r=>{let o=t[r]||{};this.setContext(r,o),t[r]=m(this,A)[r]})}getContexts(){return Object.freeze(m(this,A))}setTargets(t={}){let n={};if(Array.isArray(t))try{for(let r=0;r<t.length;++r){let o=t[r];if(typeof o=="string"||o instanceof String)n[o]=o;else if(typeof o=="object"){let s=null;for(let a in o){let l=o[a];if(a=a.trim(),!a){console.error("Invalid target");break}if(typeof l=="string"||l instanceof String){l=l.trim(),s=[a,l];break}if(typeof l=="number")break}s&&(n[s[0]]=s[1])}}}catch(r){console.error({lid:4321},r.message)}else n=t;ne(this,C,Object.assign({},n,{...k}))}addTargets(t){let n=m(this,C),r=Object.assign({},n,t);this.setTargets(r)}getTargets(){return Object.freeze(m(this,C))}setActiveTargets(t=null){if(t===null){this.activeTargets=[k.ALL];return}else if(typeof t=="string"||t instanceof String)t=t.split(",");else if(typeof t=="object"||typeof t=="function")return;for(let n=0;n<t.length;++n)t[n]=t[n].trim();this.activeTargets=t}getActiveTarget(){return this.activeTargets}setActiveTarget(t){this.activeTargets=[],this.setActiveTargets(t),this.activeTargets=[this.activeTargets[0]]}setLogLevel(t,n){m(this,N)[t]=n}getLogLevel(t){return m(this,N)[t]}setLogLevels(t){ne(this,N,t)}getLogLevels(){return Object.freeze(m(this,N))}isTargetAllowed(t){return!t||!this.activeTargets||!this.activeTargets.length||t===k.ALL||this.activeTargets.includes(k.ALL)?!0:this.activeTargets.includes(t)}setColumns(t,n,r){let o=0;for(let a in n){if(!["contextName","symbol","lid","text"].includes(a))continue;let l=n[a],f=document.createElement("span");f.classList.add("analogger-col",`analogger-col-${a}`,`analogger-col-${o}`),++o,f.textContent=l,t.append(f)}let s=document.createElement("span");s.classList.add("analogger-col","analogger-col-text",`analogger-col-${o}`),s.textContent=r,t.append(s);for(let a=1;a<=3;++a)s=document.createElement("span"),s.classList.add("analogger-col","analogger-col-extra",`analogger-extra-${a}`),t.append(s)}checkOnLoggingToDom(t,n){try{let r=t.onLoggingToDom;return typeof r!="function"?void 0:r.call(this,t,n)}catch{}}addLineToDom(t,n,{context:r,addType:o,message:s,text:a,args:l}){if(this.checkOnLoggingToDom(r,{message:s,text:a,args:l,logCounter:this.logCounter,$view:t,$line:n,addType:o})===!1)return;if(o===W.BOTTOM?t.append(n):t.insertBefore(n,t.firstChild),this.removeDomOldEntries(t)){if(t.getElementsByClassName(ae).length)return;this.showRemovedNotification(r);return}this.scrollDivToBottom(t)}showRemovedNotification(t){t.contextName=we,t.symbol="\u{1F5D1}",t.color="orange",t.className=ae,clearTimeout(this.timerAddLineToDomID),this.timerAddLineToDomID=setTimeout(()=>{this.timerAddLineToDomID=null,this.writeLogToDom(t,"",{addType:W.TOP,message:"Oldest entries removed"})},500)}writeLogToDom(t,n,{addType:r=W.BOTTOM,message:o="",args:s=null}={}){this.$containers=this.$containers||document.querySelectorAll(this.options.logToDom),n=o||n;for(let a=0;a<this.$containers.length;++a){let l=this.$containers[a],f=l.querySelector("."+ce);f||(f=document.createElement("div"),f.classList.add(ce),f.append(document.createElement("span")),f.append(document.createElement("span")),f.append(document.createElement("span")),l.append(f));let d=l.querySelector("."+le);d||(d=document.createElement("div"),d.classList.add(le),l.append(d));let h=l.querySelector("."+ue);h||(h=document.createElement("div"),h.classList.add(ue),h.append(document.createElement("span")),h.append(document.createElement("span")),h.append(document.createElement("span")),l.append(h));let g=document.createElement("div");g.classList.add(Le),t.className&&g.classList.add(t.className),g.style.color=t.color,this.setColumns(g,t,n,s),setTimeout(function(v,b,{addType:w,context:F,message:K,text:Q,args:Z}){this.addLineToDom(v,b,{addType:w,context:F,message:K,text:Q,args:Z})}.bind(this,d,g,{addType:r,context:t,message:o,text:n,args:s}),0)}}writeLogToFile(t){try{if(!fs.existsSync(this.options.logToFilePath)){let n=path.dirname(this.options.logToFilePath);fs.existsSync(n)||fs.mkdirSync(n,{recursive:!0}),fs.writeFileSync(this.options.logToFilePath,"")}if(this.options.logMaxSize&&fs.statSync(this.options.logToFilePath).size>this.options.logMaxSize){this.options.logIndexArchive<this.options.logMaxArchives?++this.options.logIndexArchive:this.options.logIndexArchive=1;let o=this.options.logMaxArchives.toString().length+1,{filePath:s,extension:a,basename:l,dirname:f}=rt(this.options.logToFilePath),d,h;d=this.options.addArchiveIndex?"."+this.options.logIndexArchive.toString().padStart(o,"0"):"",h=this.options.addArchiveTimestamp?"."+ot():"";let g=`${s}${h}${d}${a}`,v=this.options.compressArchives?`${s}.tar.gz`:"";it(f,l,d,a,v,this.options.compressionLevel,b=>{b&&console.error("DELETION_FAILURE: Failed to delete some files")}),fs.renameSync(this.options.logToFilePath,g),fs.writeFileSync(this.options.logToFilePath,"")}fs.appendFileSync(this.options.logToFilePath,t+this.EOL)}catch(n){console.rawError("LOG_TO_FILE_FAILURE: ",n.message)}}writeLogToRemote(...t){try{let n=this.generateLogToRemoteUrl(this.options.logToRemoteUrl);if(!n)return null;let r=[...t],o=JSON.stringify(r);fetch(n,{method:"post",body:o,headers:{"Content-Type":"application/json"}}).then(s=>s.json()).catch(()=>null)}catch(n){console.rawError("LOG_TO_REMOTE_FAILURE: ",n.message)}}uploadDataToRemote(t,n=null,r=null){try{if(!this.options.logToRemote)return;let o=this.generateLogToRemoteUrl(this.options.logToRemoteBinaryUrl,{pathname:E.binarypathname});if(!o)return null;let s=t;n&&(s=JSON.stringify({raw:t,context:n})),fetch(o,{method:"post",body:s}).then(a=>a.json()).then(a=>r&&r(a)).catch(a=>a)}catch(o){console.rawError("BINARY_TO_REMOTE_FAILURE: ",o.message)}}stringifyEntry(t){let n;try{n=JSON.stringify(t)}catch{}if(!n)try{n=Oe(t)}catch{}return n}convertEntry(t){try{if(t==null||t==="")return t;if(typeof t=="boolean")return t;if(typeof t=="symbol"||typeof t=="number")return t;if(typeof t=="string"||myVar instanceof t)return t;if(t instanceof Date)return t}catch{}return this.stringifyEntry(t)}convertArgumentsToText(t){let n=[],r,o=t.length;for(let s=0;s<o;++s){let a,l=t[s];a=this.convertEntry(l),n.push(a)}return r=n.join("\u2022"),r}writeToConsole(t,n){let r=[t];this.isBrowser()&&r.push(`color: ${n.color}`);let o=n.contextLevel||y.LOG;o>=y.ERROR?u.Console.error(...r):o>=y.WARN?u.Console.warn(...r):o>=y.INFO?u.Console.info(...r):o>=y.LOG?u.Console.log(...r):o>=y.DEBUG&&u.Console.debug(...r)}checkPlugins(t,{message:n,text:r,args:o,logCounter:s}){try{if(!Object.keys(u.pluginTable).length)return;let a=!0;for(let l in t){let f=t[l];if(!f)continue;let d=u.pluginTable[l];if(!d||typeof d!="object")continue;let{callback:h,methodName:g,type:v}=d;if(typeof h!="function")continue;h.call(this,t,{message:n,text:r,args:o,logCounter:s,methodName:g,type:v,pluginOptions:f})===!1&&(a=!1)}return a}catch{}}checkOnLogging(t,n,r,o){if(!!o)try{let s=t[o];return typeof s!="function"?void 0:s.call(this,n,r)}catch{}}processOutput(t={}){try{let n="";if(this.applySymbolByName(t),this.checkOnLogging(t,t,arguments,"onContext"),!this.isTargetAllowed(t.target)||t.logLevel===y.OFF||this.options.requiredLogLevel>t.logLevel)return;let r=this.checkOnLogging(t,arguments&&arguments.length>1?arguments[1]:arguments,arguments,"onMessage");r!==void 0&&(arguments[1]=r);let o=Array.prototype.slice.call(arguments,1);n=this.convertArgumentsToText(o);let s="",a=this.format({...t,message:n});this.keepLog&&this.addToLogHistory({context:t,message:n,text:a}),++this.logCounter;let l=this.checkOnLogging(t,a,{message:n,args:o,logCounter:this.logCounter},"onOutput");if(l===!1||((typeof l=="string"||l instanceof String)&&(a=l),l=this.checkPlugins(t,{message:n,text:a,args:o,logCounter:this.logCounter}),l===!1)||(this.options.logToRemote&&this.writeLogToRemote(t,...o),this.isBrowser()?(t.environnment=u.ENVIRONMENT_TYPE.BROWSER,this.options.logToDom&&this.writeLogToDom(t,a,{message:n,args:o}),s=`%c${a}`):(t.environnment=u.ENVIRONMENT_TYPE.NODE,s=V.getTextFromColor(a,{fg:t.color,bg:t.bgColor,isBold:t.bold,isUnderline:t.underline,isReversed:t.reversed}),this.options.logToFile&&this.writeLogToFile(a)),this.options.hideLog||t.hideLog||t.silent))return;this.writeToConsole(s,t),this.errorTargetHandler(t,o)}catch(n){console.rawError("AnaLogger:",n.message)}}isExtendedOptionsPassed(t){return typeof t!="object"?!1:t.hasOwnProperty("context")||t.hasOwnProperty("target")||t.hasOwnProperty("color")||t.hasOwnProperty("contextName")||t.hasOwnProperty("raw")||t.hasOwnProperty("lid")}extractContextFromInput(t){return(typeof t=="string"||t instanceof String)&&t.toLowerCase().indexOf("lid:")!==0,t}listSymbols(){for(let t in Y)console.rawLog(Y[t]+` ${t} `)}applySymbolByName(t){try{t.symbol&&Y[t.symbol]&&(t.symbol=Y[t.symbol])}catch{}}convertToContext(t,n){t=t||n;let r=t;if(t.context&&typeof t.context=="object"){let o=Object.assign({},t);delete o.context,r=Object.assign({},t.context,o)}return r=Object.assign({},n,r),delete r.context,r}log(t,...n){if(t=this.extractContextFromInput(t),!this.isExtendedOptionsPassed(t)){let s=this.generateDefaultContext();this.processOutput.apply(this,[s,t,...n]);return}let r=this.generateDefaultContext(),o=this.convertToContext(t,r);if(o.raw){u.Console.log(...n);return}this.processOutput.apply(this,[o,...n])}error(t,...n){if(this.options.hideError)return;if(t=this.extractContextFromInput(t),!this.isExtendedOptionsPassed(t)){let a=this.generateErrorContext();this.processOutput.apply(this,[a,t,...n]);return}let r=this.generateErrorContext(),o=this.convertToContext(t,r),s=Array.prototype.slice.call(arguments,1);this.log(o,...s)}overrideError(){this.options.hideHookMessage||u.Console.log("AnaLogger: Hook placed on console.error"),m(this,T).error=!0,console.error=this.onDisplayError.bind(this)}attachConsole(){try{return console.rawLog=u.Console.log,console.raw=u.Console.log,console.rawInfo=u.Console.info,console.rawWarn=u.Console.warn,console.rawError=u.Console.error,console.logHistory=this.logHistory,console.logHistory=this.logHistory,ft.forEach(t=>{console[t]=function(...n){this[t](...n)}.bind(this)}),!0}catch(t){console.error({lid:4321},t.message)}return!1}overrideConsole({log:t=!0,info:n=!0,warn:r=!0,error:o=!1}={}){this.options.hideHookMessage||u.Console.log("AnaLogger: Hook placed on console.log"),[{log:t},{info:n},{warn:r}].forEach(function(s){let a=Object.keys(s)[0];s[a]&&(m(this,T)[a]=!0,console[a]=this.onDisplayLog.bind(this))}.bind(this)),o&&this.overrideError(),this.attachConsole()}removeOverrideError(){console.error=u.Console.error,m(this,T).error=!1}removeOverride({log:t=!0,info:n=!0,warn:r=!0,error:o=!1}={}){t&&(console.log=u.Console.log,m(this,T).log=!1),n&&(console.info=u.Console.info,m(this,T).info=!1),r&&(console.warn=u.Console.warn,m(this,T).warn=!1),o&&this.removeOverrideError()}info(...t){return this.log(...t)}warn(...t){return this.log(...t)}table(...t){if(!m(this,T).log){u.Console.table(...t);return}let n=console.log;console.log=u.Console.log,u.Console.table(...t),console.log=n}takeScreenshot(t={selector:"body",quality:.95,canvasHeight:480,canvasWidth:640}){return new Promise((n,r)=>{if(!this.isBrowser())return;let o="";if(!htmlToImage){o="MISSING_HTML_IMAGE_LIBRARY: htmlToImage is not defined. Please install it first.",u.Console.error(o),r(new Error);return}let{selector:s,quality:a,canvasHeight:l,canvasWidth:f}=t,d=document.querySelector(s),h={quality:a,canvasHeight:l,canvasWidth:f};htmlToImage.toPng(d,h).then(function(g,v){this.uploadDataToRemote(v,g,b=>{n({imageData:v,serverResponse:b})})}.bind(this,t)).catch(function(g){o=`IMAGE_PROCESSING_FAILURE: ${g.message}`,u.Console.error(o),r(new Error(o))})})}alert(...t){if(!this.isBrowser())return this.log(...t);let n;if(t&&(t[0]&&t[0].hasOwnProperty("lid")||this.isContextValid(t[0]))){let r=this.generateDefaultContext();n=this.convertToContext(t[0],r).lid+": "+t.slice(1).join(" | ")}else n=t.join(" | ");alert(n)}assert(t,n=!0,...r){let o;try{return typeof t=="function"?(o=t(...r),o!==n?(this.error("Asset failed"),!1):(this.options.hidePassingTests||this.log("SUCCESS: Assert passed"),!0)):t!==n?(this.error("Assert failed"),!1):(this.options.hidePassingTests||this.log("SUCCESS: Assert passed"),!0)}catch{this.error("Unexpected error in assert")}return!1}applyAnalogFormatting({activeTarget:t="",override:n=!1}={}){try{let o={STANDARD:null,TEST:{color:"#B18904",symbol:"diamonds"}};return this.setDefaultContext(o.DEFAULT),t&&this.setActiveTarget(t),this.setOptions({silent:!1,hideError:!1,hideHookMessage:!0,lidLenMax:6}),n&&(this.overrideConsole(),this.overrideError()),!0}catch(r){console.error({lid:3249},r.message)}return!1}applyPredefinedFormat(t=z.DEFAULT_FORMAT,{activeTarget:n="",override:r=!1}={}){if(t===z.DEFAULT_FORMAT)return this.applyAnalogFormatting({activeTarget:n,override:r})}static generateInstance(){return new u}static getInstance(t=0){return u.instanceCount?m(u,B)[t]:null}static generateMainInstance(){let t=u.getInstance();return t||new u}static startLogger(){u.generateMainInstance().applyPredefinedFormat(z.DEFAULT_FORMAT,{override:!0})}static stopLogger(){let t=u.generateMainInstance();t.removeOverride(),t.removeOverrideError()}convertToUrl({protocol:t=E.protocol,host:n=E.host,port:r=E.port,pathname:o=E.pathname}={}){let s=new URL("http://localhost");return s.protocol=t,s.host=n,s.port=r,o&&(s.pathname=o),s.toString()}generateLogToRemoteUrl(t=null,{pathname:n=E.pathname}={}){if(typeof t=="string"||t instanceof String)return t;if(!this.isBrowser())return null;let r=this.options.protocol||window.location.protocol+"//",o=this.options.host||window.location.host||E.host,s=this.options.port||E.port;return n=this.options.pathname||n,this.convertToUrl({protocol:r,host:o,port:s,pathname:n})}addPlugin(t,n,r=""){r=r||t,this[t]=n,u.pluginTable[r]={type:Se.LOCAL,methodName:t,callback:n}}addGlobalPlugin(t,n,r){u[t]=n,u.pluginTable[r]={type:Se.GLOBAL,methodName:t,callback:n}}getPluginList(){return Object.keys(u.pluginTable)}validatePlugin(t){return u.pluginTable[t]?!0:(console.warn(`The plugin ${t} is not registered`),!1)}},L=u;B=new WeakMap,A=new WeakMap,C=new WeakMap,N=new WeakMap,T=new WeakMap,J=new WeakSet,Re=function(t){let n=this.generateNewContext(),r=Object.assign({},n,t);return r.color.toLowerCase().indexOf("rgb")>-1?r.color=V.rgbStringToHex(r.color):r.color.indexOf("#")===-1&&(r.color=V.colorNameToHex(r.color)),r},X=new WeakSet,Ce=function(){try{this.setTargets(k),this.setLogLevels(y),this.setContexts(_)}catch(t){console.error({lid:4321},t.message)}return!1},O(L,B,[]),p(L,"Console",null),p(L,"ALIGN",{LEFT:"LEFT",RIGHT:"RIGHT"}),p(L,"ENVIRONMENT_TYPE",{BROWSER:"BROWSER",NODE:"NODE",OTHER:"OTHER"}),p(L,"instanceCount",0),p(L,"pluginTable",{});var ht=L,Tt=ht,xt=L.generateMainInstance();var Ot=L;export{Ot as AnaLogger,_ as DEFAULT_LOG_CONTEXTS,y as DEFAULT_LOG_LEVELS,k as DEFAULT_LOG_TARGETS,xt as anaLogger,Tt as default};