analogger 2.8.0 → 2.9.0
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.
- package/README.md +187 -0
- package/ana-logger.d.cts +63 -0
- package/browser/ana-logger.mjs +354 -0
- package/dist/analogger-browser.min.mjs +51 -8
- package/dist/html-to-image-plugin.min.mjs +51 -8
- package/esm/ana-logger.mjs +379 -0
- package/package.json +1 -1
- package/src/ana-logger.cjs +379 -0
|
@@ -1,9 +1,52 @@
|
|
|
1
|
-
var
|
|
2
|
-
`,ee={airplane:"\u2708",anchor:"\u2693",announcement:"\u{1F4E2}",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",computer:"\u{1F4BB}",computer_disk:"\u{1F4BD}",computer_mouse:"\u{1F5B1}\uFE0F",copyright:"\xA9",cross:"\u274C",desktop_computer:"\u{1F5A5}\uFE0F",diamonds:"\u2666",divisions_ign:"\u2797",double_triangle_right:"\u23ED",double_triangle_left:"\u23EE",email:"\u2709",eject:"\u23CF",envelope:"\u2709\uFE0F",exclamation_mark:"\u2757",fast_forward:"\u23E9",female_sign:"\u2640",fire:"\u{1F525}",fist:"\u270A",floppy_disk:"\u{1F4BE}",fuel_pump:"\u26FD",gear:"\u2699",hammer_and_pick:"\u2692",hand:"\u270B",hearts:"\u2665",identification_card:"\u{1F194}",infinity:"\u267E",information:"\u2139",information_source:"\u2139\uFE0F",key:"\u{1F511}",left_right_arrow:"\u2194",leftwards_arrow_with_hook:"\u21A9",lock:"\u{1F512}",male_sign:"\u2642",minus_sign:"\u2796",money_bag:"\u{1F4B0}",no_entry:"\u26D4",old_key:"\u{1F5DD}\uFE0F",partly_sunny:"\u26C5",pencil:"\u270F",phone:"\u260E",pile_of_poo:"\u{1F4A9}",plus_sign:"\u2795",question:"\u2754",radioactive:"\u2622",raised_hand:"\u270B",recycle:"\u267B",registered:"\xAE",relaxed:"\u263A",rewind:"\u23EA",scissors:"\u2702",settings:"\u2699\uFE0F",shield:"\u{1F6E1}\uFE0F",screen_with_curl:"\u{1F4DC}",snowman:"\u2603",spades:"\u2660",sparkles:"\u2728",speech_bubble:"\u{1F4AC}",squared_cancellation_mark:"\u274E",star:"\u2B50",sunny:"\u2600",tent:"\u26FA",thought_balloon:"\u{1F4AD}",trademark:"\u2122",triangle_with_vertical_bar:"\u23EF",umbrella:"\u2614",unlock:"\u{1F513}",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",white_square_containing_black_small_square:"\u25FD",writing_hand:"\u270D"};function Ot(i){try{let e=path.extname(i),t=path.basename(i,e),n=path.dirname(i),r=i.slice(0,i.length-e.length);return{extension:e,filePath:r,basename:t,dirname:n}}catch(e){console.error("FILEPATH_EXT_FAILURE: ",e.message)}return{extension:".log",filePath:i}}function Rt(){return new Date().toISOString().replace(/:/g,"-").replace(/\./g,"-")}function At(i,e,t,n,r,o,s){fs.readdir(i,(a,l)=>{if(a){s(a,null);return}let f=[],h=0,d=(g,v)=>{if(!fs.existsSync(g)){v(null,null);return}fs.unlink(g,O=>{O?console.error(`DELETION_FAILURE: Error deleting file ${g}: ${O}`):f.push(g),h++,h===l.length&&v(null,f)})},p=g=>{if(g.startsWith(e+".")&&g.endsWith(t+n)){let v=path.join(i,g);r&&Mt(v,r,o),d(v,s)}else h++,h===l.length&&s(null,f)};l.length===0?s(null,f):l.forEach(p,o)})}function xt(i,e={}){let t=document.createElement("script");t.textContent=i;for(let n in e)t.setAttribute(n,e[n]);document.head.appendChild(t),t.remove()}function Ct(){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 Mt(i,e,t=1){try{if(!fs.existsSync(i))return;if(!fs.existsSync(e)){let r=fs.mkdtempSync(path.join(os.tmpdir(),"tar-gz-init-"));try{let o=path.join(r,path.basename(i));fs.copyFileSync(i,o),c({sync:!0,gzip:{level:t},file:e,cwd:r,portable:!0},[path.basename(i)])}finally{fs.rmSync(r,{recursive:!0,force:!0})}return}let n=fs.mkdtempSync(path.join(os.tmpdir(),"tar-gz-append-"));try{x({file:e,cwd:n,sync:!0});let r=path.join(n,path.basename(i));fs.copyFileSync(i,r),c({gzip:!0,file:e,cwd:n,sync:!0,portable:!0},fs.readdirSync(n))}finally{fs.rmSync(n,{recursive:!0,force:!0})}}catch(n){console.error(`ARCHIVE_FAILURE: ${n.message}`)}}function ye(){try{let e=new Error().stack,t="ana-logger",n=!1,r=null,o,s=[];if(e){let a=e.split(`
|
|
3
|
-
`),
|
|
4
|
-
`)+a.slice(
|
|
5
|
-
`);let v=parseInt(g.pop()),O=parseInt(g.pop()),D=g.pop(),I=g.pop().split(" "),W=null;for(let H=0;H<I.length;H++){let $=I[H];if(!!$&&$.indexOf("at")!==0){W=$;break}}r={file:D,line:O,col:v,method:W,isMinified:n,stack:o};break}return r}}}catch{}return null}function $e(i=8){try{let e=ye();if(!e)return`LID${Date.now()}`;let n=e.method.split(".")[0].toUpperCase().substring(0,3);if(n.length>=i)return n.substring(0,i);let r=`${n}:${e.line}`;if(r.length>=i)return r=r.replaceAll(":",""),r.substring(0,i);let o=`${n}:${e.line}:${e.col}`;return o.length>i?o.substring(0,i).endsWith(":")?`${n}${e.line}:${e.col}`.substring(0,i):o.substring(0,i):`${n}${e.line}:${e.col}`.substring(0,i)}catch{return`ERR_LID${Date.now()}`}}function Ue(){return typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node<"u"?G.NODE:G.BROWSER}var Nt=Ue();function Ft(){return Nt===G.NODE}var Dt=["alert","assert","keepLogHistory","getLogHistory","truncateMessage","truncateMessage","rawLog","removeOverride","removeOverrideError","overrideConsole","overrideError","table","rawInfo","rawWarn","rawError","hasSeenLid","addToLogHistory","releaseLogHistory","resetLogHistory","setLogFormat","resetLogFormatter","getRawLogHistory","restoreLogs"],q,R,C,F,S,te,Be,ne,je,re,Ge,oe,ze,ie,qe,se,Ve,u=class{constructor({name:e="default"}={}){T(this,te);T(this,ne);T(this,re);T(this,oe);T(this,ie);T(this,se);m(this,"system","");m(this,"instanceId","");m(this,"instanceName","");m(this,"logIndex",0);m(this,"logCounter",0);T(this,R,[]);T(this,C,{...w});T(this,F,{});m(this,"activeTargets",[Object.values(w)]);m(this,"indexColor",0);m(this,"format","");m(this,"keepLog",!1);m(this,"logHistory",[]);m(this,"$containers",null);m(this,"options",{hideHookMessage:!1});m(this,"remoteBuffer",[]);m(this,"remoteTimer",null);T(this,S,{log:!1,info:!1,warn:!1,error:!1});m(this,"originalFormatFunction");m(this,"forceLidOn",!1);m(this,"resolveLineCall",!1);m(this,"resolveErrorLineCall",!1);m(this,"removeDomOldEntries",e=>{if(e.childElementCount>he){let n=Math.ceil(he/10);for(let r=0;r<n;++r)e.removeChild(e.firstChild);return n}return 0});m(this,"scrollDivToBottom",e=>{let t=e.scrollHeight-(e.clientHeight+e.scrollTop),n=e.clientHeight||e.offsetHeight;t>n/2||(e.scrollTop=e.scrollHeight)});this.system=Ue(),this.format=this.onBuildLog.bind(this),this.originalFormatFunction=this.format,this.instanceName=e,this.instanceId=u.instanceCount+"-"+Date.now(),y(u,q)[u.instanceCount]=this,++u.instanceCount,this.errorTargetHandler=this.onError.bind(this),this.errorUserTargetHandler=this.onErrorForUserTarget.bind(this),this.remoteBuffer=[],this.remoteTimer=null,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,N(this,se,Ve).call(this),this.resetLogHistory(),this._localOnlyFilter=void 0,this._localOnlyLabel=void 0,this._lastOrderEntry=null,this._seenCount={},this._testResults=[]}getName(){return this.instanceName}getId(){return this.instanceId}forceLid(e=!0){this.forceLidOn=!!e}forceResolveLineCall(e=!0){this.resolveLineCall=!!e}forceResolveErrorLineCall(e=!0){this.resolveErrorLineCall=!!e}importLids(e){for(let t in e){let n=e[t]||{};n.lid=n.lid||t,n.callCount=0,n.callTimes=[],u.lidTable[t]=n}u.lidTableOn=!0}loadLids(e){e=e||{},this.importLids(e)}convertTimestampToDate(e){let t=new Date(e),n=t.getFullYear(),r=String(t.getMonth()+1).padStart(2,"0"),o=String(t.getDate()).padStart(2,"0"),s=String(t.getHours()).padStart(2,"0"),a=String(t.getMinutes()).padStart(2,"0"),l=String(t.getSeconds()).padStart(2,"0"),f=String(t.getMilliseconds()).padStart(3,"0");return`${n}-${r}-${o} ${s}:${a}:${l}.${f}`}getLids(){let e={...We.lidTable};for(let t in e){let n=e[t]||{};if(n.callTimes.length){n.dates=[];for(let r=0;r<n.callTimes.length;++r){let o=n.callTimes[r],s=this.convertTimestampToDate(o);n.dates.push(s)}}}return e}keepLogHistory(){this.keepLog=!0}releaseLogHistory(){this.keepLog=!1}resetLogHistory(){this.logHistory=[]}addToLogHistory(e){e=e||{},this.logHistory.push(Object.assign({},e))}getLogHistory(e=!0,t=St){let n=this.logHistory||[],r=[];return n.forEach(o=>{let{text:s}=o;r.push(s)}),e?r.join(t):r}getRawLogHistory(){return this.logHistory||[]}hasSeenLid(e){this.logHistory=this.logHistory||[];for(let t=0;t<this.logHistory.length;++t){let r=(this.logHistory[t]||{}).context||{};if(e===r.lid)return!0}return!1}forceEnvironment(e){this.forcedSystem=e}isNode(){return this&&this.forcedSystem?this.forcedSystem===G.NODE:Ft()}isBrowser(){return!this.isNode()}getUid(){if(!this.isBrowser()||typeof window>"u"||!window.localStorage)return null;let e="analogger-uid",t=window.localStorage.getItem(e);return t||(t="uid-"+Date.now()+"-"+Math.floor(Math.random()*1e6),window.localStorage.setItem(e,t)),t}resetLogger(){this.options={},this.options.timeLenMax=12,this.options.contextLenMax=10,this.options.idLenMax=5,this.options.lidLenMax=6,this.options.only=void 0,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,this.options.enableMillisec=void 0,this.options.logToLocalStorage=void 0,this.options.logToLocalStorageMax=50,this.options.logToLocalStorageSize=1e4,this.options.logToRemoteMaxEntries=void 0,this.options.logToRemoteDebounce=void 0,this.options.logToRemoteMaxSize=void 0,this.options.logToRemoteMinSize=void 0,this.options.logUidToRemote=void 0,this.remoteBuffer=[],this.remoteTimer=null,this.remoteWaitCount=0}resetOptions(){this.resetLogger()}setOptions({timeLenMax:e=void 0,contextLenMax:t=10,idLenMax:n=5,lidLenMax:r=6,only:o=void 0,symbolLenMax:s=2,enableTrace:a=!0,messageLenMax:l=void 0,hideLog:f=void 0,hideError:h=void 0,hideHookMessage:d=void 0,hidePassingTests:p=void 0,logToDom:g=void 0,logToFile:v=void 0,logMaxSize:O=0,logMaxArchives:D=3,logIndexArchive:V=0,addArchiveTimestamp:I=!0,addArchiveIndex:W=!0,compressArchives:H=!1,compressionLevel:$=1,logToRemote:be=void 0,logToRemoteUrl:ve=void 0,logToRemoteBinaryUrl:Le=void 0,loopback:Ye=E.loopback,requiredLogLevel:Je=b.LOG,oneConsolePerContext:Xe=void 0,silent:Te=void 0,enableDate:Ke=void 0,enableMillisec:Ee=void 0,logToLocalStorage:Qe=void 0,logToLocalStorageMax:Ze=50,logToLocalStorageSize:et=1e4,logToRemoteMaxEntries:tt=void 0,logToRemoteDebounce:nt=void 0,logToRemoteMaxSize:rt=void 0,logToRemoteMinSize:ot=void 0,logUidToRemote:we=void 0,protocol:it=void 0,host:st=void 0,port:at=void 0,pathname:lt=void 0,binarypathname:ct=void 0,loadHtmlToImage:ut=!1}=null){if(this.options.contextLenMax=t,this.options.idLenMax=n,this.options.lidLenMax=r,this.options.only=o,this.options.messageLenMax=l,this.options.symbolLenMax=s,this.options.enableMillisec=Ee,this.options.timeLenMax=e,this.options.logMaxSize=O,this.options.logMaxArchives=D,this.options.logIndexArchive=V,this.options.addArchiveTimestamp=I,this.options.addArchiveIndex=W,this.options.compressArchives=H,this.options.compressionLevel=$,this.options.requiredLogLevel=Je,this.options.enableTrace=a,this.options.enableMillisec=Ee,this.options.enableMillisec&&(this.options.timeLenMax+=4),this.options.logToLocalStorageMax=Ze,this.options.logToLocalStorageSize=et,this.options.logToRemote=be,this.options.logToRemoteUrl=ve,this.options.logToRemoteBinaryUrl=Le,this.options.logToRemoteMaxEntries=tt,this.options.logToRemoteDebounce=nt,this.options.logToRemoteMaxSize=rt,this.options.logToRemoteMinSize=ot,this.options.logUidToRemote=we,ut){let M=Ct();xt(M)}let ae;Te!==void 0?ae=!!Te:f!==void 0&&(ae=!!f),[{hideLog:ae},{oneConsolePerContext:Xe},{hideError:h},{enableDate:Ke},{hideHookMessage:d},{hidePassingTests:p},{logToRemote:be},{logToLocalStorage:Qe},{logUidToRemote:we}].forEach(M=>{let U=Object.keys(M)[0],B=M[U];B!==void 0&&(this.options[U]=!!B)}),[{logToRemoteBinaryUrl:Le},{logToRemoteUrl:ve},{loopback:Ye},{protocol:it},{host:st},{port:at},{pathname:lt},{binarypathname:ct}].forEach(M=>{let U=Object.keys(M)[0],B=M[U];B!==void 0&&(this.options[U]=B)}),this.options.enableDate&&this.options.timeLenMax===void 0&&(this.options.timeLenMax=17),this.options.timeLenMax===void 0&&(this.options.enableDate?this.options.timeLenMax=17:this.options.timeLenMax=8),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})),g===!1?this.options.logToDom=!1:g!==void 0&&(this.options.logToDom=g===!0?E.consoleDomId:g),v===!1?this.options.logToFile=!1:v!==void 0&&(this.isBrowser()||(this.options.logToFile=v||E.logFilename),u.Console.log("LogToFile is not supported in this environment. "))}updateOptions(e){this.setOptions({...this.options,...e})}getOptions(){return this.options}truncateMessage(e="",{fit:t=0,align:n=u.ALIGN.LEFT,ellipsis:r="..."}={}){return e=""+e,t&&e.length>t&&(e=e.substring(0,t-r.length)+r),e=n===u.ALIGN.LEFT?e.padEnd(t," "):e.padStart(t," "),e}onBuildLog(e={}){try{let{contextName:t,message:n="",lid:r="",symbol:o=""}=e,s="",a=n.split(/\n/g);for(let l=0;l<a.length;++l){let f=a[l],h=new Date,d=("0"+h.getHours()).slice(-2)+":"+("0"+h.getMinutes()).slice(-2)+":"+("0"+h.getSeconds()).slice(-2);(e.hasOwnProperty("enableMillisec")?e.enableMillisec:this.options.enableMillisec)&&(d+=","+("00"+h.getMilliseconds()).slice(-3)),(e.hasOwnProperty("enableDate")?e.enableDate:this.options.enableDate)&&(d=h.getFullYear().toString().slice(-2)+"-"+(h.getMonth()+1).toString().padStart(2,"0")+"-"+h.getDate().toString().padStart(2,"0")+" "+d);let v=e.hasOwnProperty("timeLenMax")?e.timeLenMax:this.options.timeLenMax;d=this.truncateMessage(d,{fit:v}),l>0&&(t="",r=""),t=this.truncateMessage(t,{fit:this.options.contextLenMax,align:u.ALIGN.RIGHT}),r=this.truncateMessage(r,{fit:this.options.lidLenMax}),(e.hasOwnProperty("messageLenMax")?e.messageLenMax:this.options.messageLenMax)!==void 0&&(f=this.truncateMessage(f,{fit:this.options.messageLenMax})),o=this.truncateMessage(o,{fit:this.options.symbolLenMax}),l<=0?s+=`[${d}] ${t}: (${r}) ${o} ${f}`:l<a.length-1?(s+=`
|
|
6
|
-
`,s+=`[${
|
|
7
|
-
`,s+=`[${
|
|
8
|
-
`),n=[];for(let r=0;r<t.length;++r){let o=t[r];n.push(o)}return n}catch(t){u.Console.error(`ANALOGGER_FAILURE_1002: ${t.message}`)}return e.message}onDisplayError(...e){try{let t=-1,n=null;for(let r=0;r<e.length;++r){let o=e[r];if(o instanceof Error&&o.stack){t=r,n=this.assistStask(o)||[];break}}if(!n){this.error(...e);return}for(let r=0;r<n.length;++r)e[t]=n[r],this.error(...e)}catch(t){u.Console.error(`ANALOGGER_FAILURE_1003: ${t.message}`)}}setLogFormat(e){if(typeof e!="function")return console.error("Invalid parameter for setFormat. It is expecting a function or method."),!1;this.format=e.bind(this)}resetLogFormatter(){this.format=this.originalFormatFunction}setErrorHandler(e){this.errorTargetHandler=e.bind(this)}setErrorHandlerForUserTarget(e){this.errorUserTargetHandler=e.bind(this)}isContextValid(e){return typeof e=="object"&&!Array.isArray(e)&&e!==null?e.hasOwnProperty("contextName")&&e.hasOwnProperty("target"):!1}setDefaultContext(e){this.setContext(z.DEFAULT.contextName,e)}generateDefaultContext(){let e=y(this,R)[z.DEFAULT.contextName]||{};return e=Object.assign({},{lid:"",contextName:z.DEFAULT.contextName,target:w.ALL,symbol:"\u26A1",color:_[1],logLevel:b.LOG},e),e.name=e.contextName,e.id=this.logIndex++,e}generateNewContext(){let e=this.generateDefaultContext();return e.color=_[this.indexColor++%(_.length-3)+2],e.symbol="",e}generateErrorContext(){let e=this.generateDefaultContext();return e.contextName=z.ERROR.contextName,e.name=e.contextName,e.color=_[0],e.symbol="\u274C",e.error=!0,e.logLevel=b.ERROR,e}setContext(e,t={}){t.contextName=e,t.name=e,t=N(this,te,Be).call(this,t),y(this,R)[e]=t}getContext(e){return y(this,R)[e]}setContexts(e){Object.keys(e).forEach(n=>{let r=e[n]||{};this.setContext(n,r),e[n]=y(this,R)[n]})}getContexts(){return Object.freeze(y(this,R))}setTargets(e={}){let t={};if(Array.isArray(e))try{for(let n=0;n<e.length;++n){let r=e[n];if(typeof r=="string"||r instanceof String)t[r]=r;else if(typeof r=="object"){let o=null;for(let s in r){let a=r[s];if(s=s.trim(),!s){console.error("Invalid target");break}if(typeof a=="string"||a instanceof String){a=a.trim(),o=[s,a];break}if(typeof a=="number")break}o&&(t[o[0]]=o[1])}}}catch(n){console.error({lid:4321},n.message)}else t=e;ce(this,C,Object.assign({},t,{...w}))}addTargets(e){let t=y(this,C),n=Object.assign({},t,e);this.setTargets(n)}getTargets(){return Object.freeze(y(this,C))}setActiveTargets(e=null){if(e==null){this.activeTargets=[w.ALL];return}if(typeof e=="function"&&(e=e.call(this)),e===null){this.activeTargets=[w.ALL];return}else if(typeof e=="string"||e instanceof String)e=e.split(",");else if(typeof e=="function")e=e.call(this);else if(typeof e=="object")e=Object.values(e);else if(!Array.isArray(e))return;let t=[];for(let n=0;n<e.length;++n){let r=e[n].trim();Object.values(y(this,C)).includes(r)&&t.push(r)}this.activeTargets=t}getActiveTargets(){return this.activeTargets}getActiveTarget(){return(this.getActiveTargets()||[])[0]||w.NONE}setActiveTarget(e){this.activeTargets=[],this.setActiveTargets(e);let t=this.activeTargets[0]||w.NONE;this.activeTargets=[t]}setLogLevel(e,t){y(this,F)[e]=t}getLogLevel(e){return y(this,F)[e]}setLogLevels(e){ce(this,F,e)}getLogLevels(){return Object.freeze(y(this,F))}isTargetAllowed(e){return e===w.NONE?!1:e===w.ALL||this.getActiveTarget()===w.ALL?!0:this.activeTargets.includes(e)}getCurrentTime(){let e=new Date,t=String(e.getHours()).padStart(2,"0"),n=String(e.getMinutes()).padStart(2,"0"),r=String(e.getSeconds()).padStart(2,"0");return`${t}:${n}:${r}`}getCurrentDate(){let e=new Date,t=String(e.getDate()).padStart(2,"0"),n=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getFullYear()).slice(-2);return`${t}-${n}-${r}`}setColumns(e,t,n){let r=1,o=!1;for(let a in t){if(!["contextName","symbol","lid","text","enableDate","enableTime"].includes(a))continue;let l=t[a];a==="enableDate"&&(l=this.getCurrentDate()+" "+this.getCurrentTime()),a==="enableTime"&&(l=this.getCurrentTime());let f=document.createElement("span");f.classList.add("analogger-col",`analogger-col-${a}`,`analogger-col-${r}`),++r,a!=="enableDate"&&a!=="enableTime"?(f.textContent=l,e.append(f)):(f.textContent=`[${l}]`,o=f)}o&&(o.classList.add("analogger-col","analogger-col-time","analogger-col-0"),e.prepend(o));let s=document.createElement("span");s.classList.add("analogger-col","analogger-col-text",`analogger-col-${r}`),s.textContent=n,e.append(s);for(let a=1;a<=3;++a)s=document.createElement("span"),s.classList.add("analogger-col","analogger-col-extra",`analogger-extra-${a}`),e.append(s)}checkOnLoggingToDom(e,t){try{let n=e.onLoggingToDom;return typeof n!="function"?void 0:n.call(this,e,t)}catch{}}addLineToDom(e,t,{context:n,addType:r,message:o,text:s,args:a}){if(this.checkOnLoggingToDom(n,{message:o,text:s,args:a,logCounter:this.logCounter,$view:e,$line:t,addType:r})===!1)return;if(r===Q.BOTTOM?e.append(t):e.insertBefore(t,e.firstChild),this.removeDomOldEntries(e)){if(e.getElementsByClassName(de).length)return;this.showRemovedNotification(n);return}this.scrollDivToBottom(e)}showRemovedNotification(e){e.contextName=Ie,e.symbol="\u{1F5D1}",e.color="orange",e.className=de,clearTimeout(this.timerAddLineToDomID),this.timerAddLineToDomID=setTimeout(()=>{this.timerAddLineToDomID=null,this.writeLogToDom(e,"",{addType:Q.TOP,message:"Oldest entries removed"})},500)}writeLogToDom(e,t,{addType:n=Q.BOTTOM,message:r="",args:o=null}={}){(!this.$containers||!this.$containers.length)&&(this.$containers=document.querySelectorAll(this.options.logToDom)),t=r||t;for(let s=0;s<this.$containers.length;++s){let a=this.$containers[s],l=a.querySelector("."+ge);l||(l=document.createElement("div"),l.classList.add(ge),l.append(document.createElement("span")),l.append(document.createElement("span")),l.append(document.createElement("span")),a.append(l));let f=a.querySelector("."+pe);f||(f=document.createElement("div"),f.classList.add(pe),a.append(f));let h=a.querySelector("."+me);h||(h=document.createElement("div"),h.classList.add(me),h.append(document.createElement("span")),h.append(document.createElement("span")),h.append(document.createElement("span")),a.append(h));let d=document.createElement("div");d.classList.add(De),e.className&&d.classList.add(e.className),d.style.color=e.color,this.setColumns(d,e,t,o),setTimeout(function(p,g,{addType:v,context:O,message:D,text:V,args:I}){this.addLineToDom(p,g,{addType:v,context:O,message:D,text:V,args:I})}.bind(this,f,d,{addType:n,context:e,message:r,text:t,args:o}),0)}}writeLogToFile(e){try{if(!fs.existsSync(this.options.logToFilePath)){let t=path.dirname(this.options.logToFilePath);fs.existsSync(t)||fs.mkdirSync(t,{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 r=this.options.logMaxArchives.toString().length+1,{filePath:o,extension:s,basename:a,dirname:l}=Ot(this.options.logToFilePath),f,h;f=this.options.addArchiveIndex?"."+this.options.logIndexArchive.toString().padStart(r,"0"):"",h=this.options.addArchiveTimestamp?"."+Rt():"";let d=`${o}${h}${f}${s}`,p=this.options.compressArchives?`${o}.tar.gz`:"";At(l,a,f,s,p,this.options.compressionLevel,g=>{g&&console.error("DELETION_FAILURE: Failed to delete some files")}),fs.renameSync(this.options.logToFilePath,d),fs.writeFileSync(this.options.logToFilePath,"")}fs.appendFileSync(this.options.logToFilePath,e+this.EOL)}catch(t){u.Console.error("LOG_TO_FILE_FAILURE: ",t.message)}}writeLogToRemote(...e){try{if(this.options.logToRemoteMaxEntries===void 0&&this.options.logToRemoteDebounce===void 0&&this.options.logToRemoteMaxSize===void 0){this.performRemotePost([...e]);return}if(Array.isArray(this.remoteBuffer)){if(this.remoteBuffer.push([...e]),this.options.logToRemoteMaxEntries!==void 0&&this.remoteBuffer.length>=this.options.logToRemoteMaxEntries){this.flushRemoteLogs(!0);return}if(this.options.logToRemoteMaxSize!==void 0&&JSON.stringify(this.remoteBuffer).length>=this.options.logToRemoteMaxSize){this.flushRemoteLogs(!0);return}}this.options.logToRemoteDebounce!==void 0&&!this.remoteTimer&&(this.remoteTimer=setTimeout(()=>{this.flushRemoteLogs()},this.options.logToRemoteDebounce))}catch(t){u.Console.error("LOG_TO_REMOTE_FAILURE: ",t.message)}}flushRemoteLogs(e=!1){if(this.remoteBuffer.length===0)return;if(!e&&this.options.logToRemoteMinSize!==void 0&&JSON.stringify(this.remoteBuffer).length<this.options.logToRemoteMinSize&&(this.remoteWaitCount=(this.remoteWaitCount||0)+1,this.remoteWaitCount<2)){this.options.logToRemoteDebounce!==void 0&&(this.remoteTimer&&clearTimeout(this.remoteTimer),this.remoteTimer=setTimeout(()=>{this.flushRemoteLogs()},this.options.logToRemoteDebounce));return}this.remoteTimer&&(clearTimeout(this.remoteTimer),this.remoteTimer=null),this.remoteWaitCount=0;let t=[...this.remoteBuffer];this.remoteBuffer=[],this.performRemotePost(t)}performRemotePost(e){try{let t=this.generateLogToRemoteUrl(this.options.logToRemoteUrl);if(!t)return null;let n=JSON.stringify(e);fetch(t,{method:"post",body:n,headers:{"Content-Type":"application/json"}}).then(r=>r.json()).catch(()=>null)}catch(t){u.Console.error("REMOTE_POST_FAILURE: ",t.message)}}writeLogToLocalStorage(e,...t){try{if(!this.isBrowser()||!window.localStorage)return;let n=`analogger_history_${this.instanceName}`,r=[];try{let l=localStorage.getItem(n);l&&(r=JSON.parse(l))}catch{r=[]}r.push({context:e,args:t});let o=this.options.logToLocalStorageMax||50;r.length>o&&(r=r.slice(r.length-o));let s=this.options.logToLocalStorageSize||1e4,a=JSON.stringify(r);for(;a.length>s&&r.length>1;)r.shift(),a=JSON.stringify(r);localStorage.setItem(n,a)}catch(n){u.Console.error("LOG_TO_LOCAL_STORAGE_FAILURE: ",n.message)}}restoreLogs(){try{if(!this.isBrowser()||!window.localStorage)return;let e=`analogger_history_${this.instanceName}`,t=localStorage.getItem(e);if(!t)return;let n=JSON.parse(t);if(!Array.isArray(n))return;let r=this.options.logToLocalStorage;this.options.logToLocalStorage=!1,n.forEach(o=>{let{context:s,args:a}=o;s&&(s.symbol="floppy_disk",delete s.order,delete s.maxSeen,delete s.test),this.processOutput(s,...a)}),this.options.logToLocalStorage=r}catch(e){u.Console.error("RESTORE_LOGS_FAILURE: ",e.message)}}uploadDataToRemote(e,t=null,n=null){try{if(!this.options.logToRemote)return;let r=this.generateLogToRemoteUrl(this.options.logToRemoteBinaryUrl,{pathname:E.binarypathname});if(!r)return null;let o=e;t&&(o=JSON.stringify({raw:e,context:t})),fetch(r,{method:"post",body:o}).then(s=>s.json()).then(s=>n&&n(s)).catch(s=>s)}catch(r){u.Console.error("BINARY_TO_REMOTE_FAILURE: ",r.message)}}stringifyEntry(e){let t;try{t=JSON.stringify(e)}catch{}if(!t)try{t=_e(e)}catch{}return t}convertEntry(e){try{if(e==null||e==="")return e;if(typeof e=="boolean")return e;if(typeof e=="symbol"||typeof e=="number")return e;if(typeof e=="string"||myVar instanceof e)return e;if(e instanceof Date)return e}catch{}return this.stringifyEntry(e)}convertArgumentsToText(e){let t=[],n,r=e.length;for(let o=0;o<r;++o){let s,a=e[o];s=this.convertEntry(a),t.push(s)}return n=t.join("\u2022"),n}writeToConsole(e,t){let n=[e];this.isBrowser()&&n.push(`color: ${t.color}`);let r=t.contextLevel||b.LOG;r>=b.ERROR?u.Console.error(...n):r>=b.WARN?u.Console.warn(...n):r>=b.INFO?u.Console.info(...n):r>=b.LOG?u.Console.log(...n):r>=b.DEBUG&&u.Console.debug(...n)}checkPlugins(e,{message:t,text:n,args:r,logCounter:o}){try{if(!Object.keys(u.pluginTable).length)return;let s=!0;for(let a in e){let l=e[a];if(!l)continue;let f=u.pluginTable[a];if(!f||typeof f!="object")continue;let{callback:h,methodName:d,type:p}=f;if(typeof h!="function")continue;h.call(this,e,{message:t,text:n,args:r,logCounter:o,methodName:d,type:p,pluginOptions:l})===!1&&(s=!1)}return s}catch{}}checkOnLogging(e,t,n,r){if(!!r)try{let o=e[r];return typeof o!="function"?void 0:o.call(this,t,n)}catch{}}isContextMessagePattern(e){return/\{\{[^}]+}}/.test(e)}transformContextMessage(e,t){let n=e;for(let r in t){let o=`{{${r}}}`,s=t[r];n=n.replaceAll(o,s)}return n}report(){let e=this._testResults.length,t=this._testResults.filter(l=>l.passed).length,n=e-t,r=n>0,o="================== ANALOGGER TEST RESULT ================",s="==========================================================",a=[o,` Total : ${e}`,` Passed : ${t}`,` Failed : ${n}`,s];if(this.isBrowser()){let l=r?"color: red; font-weight: bold;":"color: green; font-weight: bold;";a.forEach(f=>u.Console.log(`%c${f}`,l))}else a.forEach(l=>{let f=j.getTextFromColor(l,{fg:r?"#FF0000":"#00CC44",isBold:!0});u.Console.log(f)});return{total:e,passed:t,failed:n}}processOutput(e={},...t){try{let n="";if(u.lidTableOn&&e.lid){let f=u.lidTable[e.lid];f?(e.message=e.message||f.message,f.callCount=f.callCount||0,++f.callCount,f.callTimes.push(Date.now())):u.lidTable[e.lid]={...e,message:t[0],lid:e.lid,callCount:1,callTimes:[Date.now()]}}if(e.message&&(this.isContextMessagePattern(e.message)&&t.length>=1&&typeof t[0]=="object"&&(e.message=this.transformContextMessage(e.message,t[0]),t.shift()),t.unshift(e.message)),this.applySymbolByName(e),this.checkOnLogging(e,e,t,"onContext"),!this.isTargetAllowed(e.target)||e.logLevel===b.OFF||this.options.requiredLogLevel>e.logLevel||this.options.only!==void 0&&this.options.only!==null&&!(Array.isArray(this.options.only)?this.options.only:[this.options.only]).some(d=>{let p=e.lid||"",g=e.only||"";return d instanceof RegExp?d.test(p)||d.test(g):typeof d=="string"?p.includes(d)||g.includes(d):d===p||d===g})||!N(this,ie,qe).call(this,e))return;N(this,ne,je).call(this,e),N(this,re,Ge).call(this,e);let r=this.checkOnLogging(e,t[0],arguments,"onMessage");r!==void 0&&(arguments[1]=r);let o=t;n=this.convertArgumentsToText(o),N(this,oe,ze).call(this,e,n),this.options.logUidToRemote&&(e.uid=this.getUid());let s="",a=this.format({...e,message:n});this.keepLog&&this.addToLogHistory({context:e,message:n,text:a}),++this.logCounter;let l=this.checkOnLogging(e,a,{message:n,args:o,logCounter:this.logCounter},"onOutput");if(l===!1||((typeof l=="string"||l instanceof String)&&(a=l),l=this.checkPlugins(e,{message:n,text:a,args:o,logCounter:this.logCounter}),l===!1)||(this.options.logToRemote&&this.writeLogToRemote(e,...o),this.options.logToLocalStorage&&this.writeLogToLocalStorage(e,...o),this.isBrowser()?(e.environnment=u.ENVIRONMENT_TYPE.BROWSER,this.options.logToDom&&this.writeLogToDom(e,a,{message:n,args:o}),s=`%c${a}`):(e.environnment=u.ENVIRONMENT_TYPE.NODE,s=j.getTextFromColor(a,{fg:e.color,bg:e.bgColor,isBold:e.bold,isUnderline:e.underline,isReversed:e.reversed}),this.options.logToFile&&this.writeLogToFile(a)),!(e.silent===!1||e.hideLog===!1)&&(this.options.hideLog||e.hideLog||e.silent)))return;this.writeToConsole(s,e),this.errorTargetHandler(e,o)}catch{}}isExtendedOptionsPassed(e){return typeof e!="object"?!1:e.hasOwnProperty("context")||e.hasOwnProperty("target")||e.hasOwnProperty("color")||e.hasOwnProperty("contextName")||e.hasOwnProperty("raw")||e.hasOwnProperty("only")||e.hasOwnProperty("lid")}stringToObject(e){try{if(e=e.trim(),e.startsWith("{")&&e.endsWith("}")&&(e=e.slice(1,-1).trim()),!e)return{};let t={},n=e.split(",");for(let r of n){let o=r.trim().split(":");if(o.length<2){if(o.length===2){let h=o[0].trim().replace(/^['"]|['"]$/g,"");t[h]=o[1].trim().replace(/^['"]|['"]$/g,"")}else if(o.length===1&&Object.keys(t).length>0){let h=Object.keys(t).pop();t[h]instanceof Array?t[h].push(o[0].trim().replace(/^['"]|['"]$/g,"")):t[h]=[t[h],o[0].trim().replace(/^['"]|['"]$/g,"")]}continue}let s=o[0],a=o.slice(1).join(":"),l=s.trim().replace(/^['"]|['"]$/g,""),f=a.trim().replace(/^['"]|['"]$/g,"");!isNaN(f)&&!isNaN(parseFloat(f))?t[l]=parseFloat(f):t[l]=f}return t}catch{return null}}extractContextFromInput(e){if(typeof e=="string"||e instanceof String){if(e.toLowerCase().indexOf("lid:")!==0)return e;let t=this.stringToObject(e);t&&(e=t)}if(typeof e=="object"&&!Array.isArray(e)&&e!==null&&this.isExtendedOptionsPassed(e)){if(e.contextName){let t=y(this,R)[e.contextName];t&&(e=Object.assign({},t,e))}e.target||(e.target=this.getActiveTarget())}return e}listSymbols(){for(let e in ee)console.rawLog(ee[e]+` ${e} `)}applySymbolByName(e){try{e.symbol&&ee[e.symbol]&&(e.symbol=ee[e.symbol])}catch{}}convertToContext(e,t){e=e||t;let n=e;if(e.context&&typeof e.context=="object"){let r=Object.assign({},e);delete r.context,n=Object.assign({},e.context,r)}return n=Object.assign({},t,n),delete n.context,n}log(e,...t){if(e=this.extractContextFromInput(e),!this.isExtendedOptionsPassed(e)){if(!this.forceLidOn){let s=this.generateDefaultContext();this.processOutput.apply(this,[s,e,...t]);return}(!t||!t.length)&&(t=[e]),e={lid:$e(this.options.lidLenMax)}}let n=this.generateDefaultContext(),r=this.convertToContext(e,n);if(r.raw){u.Console.log(...t);return}this.resolveLineCall&&(this.resolveErrorLineCall||(r.stack=ye())),this.processOutput.apply(this,[r,...t])}error(e,...t){if(this.options.hideError)return;if(e=this.extractContextFromInput(e),!this.isExtendedOptionsPassed(e)){if(!this.forceLidOn){let s=this.generateErrorContext();this.processOutput.apply(this,[s,e,...t]);return}e={lid:$e(this.options.lidLenMax)}}let n=this.generateErrorContext(),r=this.convertToContext(e,n);this.resolveErrorLineCall&&(r.stack=ye()),this.log(r,...t),this.options.enableTrace&&console.trace(...t)}overrideError(){this.options.hideHookMessage||u.Console.log("AnaLogger: Hook placed on console.error"),y(this,S).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,Dt.forEach(e=>{console[e]=function(...t){this[e](...t)}.bind(this)}),!0}catch(e){console.error({lid:4321},e.message)}return!1}overrideConsole({log:e=!0,info:t=!0,warn:n=!0,error:r=!1}={}){this.options.hideHookMessage||u.Console.log("AnaLogger: Hook placed on console.log"),[{log:e},{info:t},{warn:n}].forEach(function(o){let s=Object.keys(o)[0];o[s]&&(y(this,S)[s]=!0,console[s]=this.onDisplayLog.bind(this))}.bind(this)),r&&this.overrideError(),this.attachConsole()}removeOverrideError(){console.error=u.Console.error,y(this,S).error=!1}removeOverride({log:e=!0,info:t=!0,warn:n=!0,error:r=!1}={}){e&&(console.log=u.Console.log,y(this,S).log=!1),t&&(console.info=u.Console.info,y(this,S).info=!1),n&&(console.warn=u.Console.warn,y(this,S).warn=!1),r&&this.removeOverrideError()}info(...e){return this.log(...e)}warn(...e){return this.log(...e)}table(...e){if(!y(this,S).log){u.Console.table(...e);return}let t=console.log;console.log=u.Console.log,u.Console.table(...e),console.log=t}takeScreenshot(e={selector:"body",quality:.95,canvasHeight:480,canvasWidth:640}){return new Promise((t,n)=>{if(!this.isBrowser())return;let r="";if(!htmlToImage){r="MISSING_HTML_IMAGE_LIBRARY: htmlToImage is not defined. Please install it first.",u.Console.error(r),n(new Error);return}let{selector:o,quality:s,canvasHeight:a,canvasWidth:l}=e,f=document.querySelector(o),h={quality:s,canvasHeight:a,canvasWidth:l};htmlToImage.toPng(f,h).then(function(d,p){this.uploadDataToRemote(p,d,g=>{t({imageData:p,serverResponse:g})})}.bind(this,e)).catch(function(d){r=`IMAGE_PROCESSING_FAILURE: ${d.message}`,u.Console.error(r),n(new Error(r))})})}alert(...e){if(!this.isBrowser())return this.log(...e);let t;if(e&&(e[0]&&e[0].hasOwnProperty("lid")||this.isContextValid(e[0]))){let n=this.generateDefaultContext();t=this.convertToContext(e[0],n).lid+": "+e.slice(1).join(" | ")}else t=e.join(" | ");alert(t)}assert(e,t=!0,...n){let r;try{return typeof e=="function"?(r=e(...n),r!==t?(this.error("Asset failed"),!1):(this.options.hidePassingTests||this.log("SUCCESS: Assert passed"),!0)):e!==t?(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:e="",override:t=!1}={}){try{let r={STANDARD:null,TEST:{color:"#B18904",symbol:"diamonds"}};return this.setDefaultContext(r.DEFAULT),e&&this.setActiveTarget(e),this.setOptions({silent:!1,hideError:!1,hideHookMessage:!0,lidLenMax:6}),t&&(this.overrideConsole(),this.overrideError()),!0}catch(n){console.error({lid:3249},n.message)}return!1}applyPredefinedFormat(e=Z.DEFAULT_FORMAT,{activeTarget:t="",override:n=!1}={}){if(e===Z.DEFAULT_FORMAT)return this.applyAnalogFormatting({activeTarget:t,override:n})}static generateInstance(){return new u}static getInstance(e=0){return u.instanceCount?y(u,q)[e]:null}static generateMainInstance(){let e=u.getInstance();return e||new u}static startLogger(){u.generateMainInstance().applyPredefinedFormat(Z.DEFAULT_FORMAT,{override:!0})}static stopLogger(){let e=u.generateMainInstance();e.removeOverride(),e.removeOverrideError()}convertToUrl({protocol:e=E.protocol,host:t=E.host,port:n=E.port,pathname:r=E.pathname}={}){let o=new URL("http://localhost");return o.protocol=e,o.host=t,o.port=n,r&&(o.pathname=r),o.toString()}generateLogToRemoteUrl(e=null,{pathname:t=E.pathname}={}){if(typeof e=="string"||e instanceof String)return e;if(!this.isBrowser())return null;let n=this.options.protocol||window.location.protocol+"//",r=this.options.host||window.location.host||E.host,o=this.options.port||E.port;return t=this.options.pathname||t,this.convertToUrl({protocol:n,host:r,port:o,pathname:t})}addPlugin(e,t,n=""){n=n||e,this[e]=t,u.pluginTable[n]={type:He.LOCAL,methodName:e,callback:t}}addGlobalPlugin(e,t,n){u[e]=t,u.pluginTable[n]={type:He.GLOBAL,methodName:e,callback:t}}getPluginList(){return Object.keys(u.pluginTable)}validatePlugin(e){return u.pluginTable[e]?!0:(console.warn(`The plugin ${e} is not registered`),!1)}},L=u;q=new WeakMap,R=new WeakMap,C=new WeakMap,F=new WeakMap,S=new WeakMap,te=new WeakSet,Be=function(e){let t=this.generateNewContext(),n=Object.assign({},t,e);return n.color.toLowerCase().indexOf("rgb")>-1?n.color=j.rgbStringToHex(n.color):n.color.indexOf("#")===-1&&(n.color=j.colorNameToHex(n.color)),n},ne=new WeakSet,je=function(e){if(e.order===void 0||e.order===null)return;let t=e.order,n=e.lid||"";if(this._lastOrderEntry!==null){let{lid:r,order:o}=this._lastOrderEntry;if(t<o){let s=`! Order mismatch: [${n}| order: ${t}] appeared after [${r}| order: ${o}]`;u.Console.warn(s)}}this._lastOrderEntry={lid:n,order:t}},re=new WeakSet,Ge=function(e){if(e.maxSeen===void 0||e.maxSeen===null)return;let t=e.lid||"",n=e.maxSeen;this._seenCount[t]=(this._seenCount[t]||0)+1;let r=this._seenCount[t];if(r>n){let o=`! MaxSeen exceeded: [${t}| maxSeen: ${n}] has been seen ${r} time(s)`;u.Console.warn(o)}},oe=new WeakSet,ze=function(e,t){if(!e.hasOwnProperty("test"))return;let n=e.lid||"",r=e.test,o=typeof r=="function"?!!r():!!r;this._testResults.push({lid:n,passed:o,message:t}),o||u.Console.warn(`! Test failed: [${n}] ${t}`)},ie=new WeakSet,qe=function(e){let t=e.only,n=(l,f)=>l instanceof RegExp?l.test(f):typeof l=="string"||l instanceof String?f.includes(l):l===f,r=(l,f)=>Array.isArray(l)?l.some(h=>n(h,f)):n(l,f),o=l=>Array.isArray(l)?l.map(f=>f instanceof RegExp?f.toString():String(f)).join(", "):l instanceof RegExp?l.toString():String(l),s=e.lid||"";if(t==null)return this._localOnlyFilter!==void 0?r(this._localOnlyFilter,s):!0;if(!r(t,s))return!1;let a=o(t);if(this._localOnlyFilter===void 0)this.isBrowser()?u.Console.clear?u.Console.clear():typeof console<"u"&&console.clear&&console.clear():process.stdout.write("\x1Bc");else if(this._localOnlyLabel!==a){let l=`\u2500\u2500\u2500 only switched to ${a} \u2500\u2500\u2500`;this.isBrowser()?u.Console.log(`%c${l}`,"color: #888; font-style: italic"):u.Console.log(l)}return this._localOnlyFilter=t,this._localOnlyLabel=a,!0},se=new WeakSet,Ve=function(){try{this.setTargets(w),this.setLogLevels(b),this.setContexts(z)}catch(e){console.error({lid:4321},e.message)}return!1},T(L,q,[]),m(L,"Console",null),m(L,"ALIGN",{LEFT:"LEFT",RIGHT:"RIGHT"}),m(L,"ENVIRONMENT_TYPE",{BROWSER:"BROWSER",NODE:"NODE",OTHER:"OTHER"}),m(L,"instanceCount",0),m(L,"pluginTable",{}),m(L,"lidTable",{}),m(L,"lidTableOn",!1);var We=L,zt=We,qt=L.generateMainInstance();var Vt=L;export{Vt as AnaLogger,z as DEFAULT_LOG_CONTEXTS,b as DEFAULT_LOG_LEVELS,w as DEFAULT_LOG_TARGETS,qt as anaLogger,zt as default};
|
|
1
|
+
var St=Object.defineProperty;var xt=(i,e,t)=>e in i?St(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t;var y=(i,e,t)=>(xt(i,typeof e!="symbol"?e+"":e,t),t),Te=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)};var L=(i,e,t)=>(Te(i,e,"read from private field"),t?t.call(i):e.get(i)),T=(i,e,t)=>{if(e.has(i))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(i):e.set(i,t)},Ee=(i,e,t,n)=>(Te(i,e,"write to private field"),n?n.call(i,t):e.set(i,t),t);var O=(i,e,t)=>(Te(i,e,"access private method"),t);var ke={Foreground:38,Background:48},k="\x1B[1D",_e="\x1B[0m"+k,Z={Bold:"\x1B[1m"+k,Underline:"\x1B[4m"+k,Reversed:"\x1B[7m"+k},Ot={Bold:"\x1B[1m"+k,Underline:"\x1B[4m"+k,Reversed:"\x1B[7m"+k},we={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 Rt(i){return!!we[i]}var Pe=(i,e,t)=>i===e&&e===t?i<8?16:i>248?231:Math.round((i-8)/247*24)+232:16+36*Math.round(i/255*5)+6*Math.round(e/255*5)+Math.round(t/255*5),He=i=>{let e=/^#?([a-f\d])([a-f\d])([a-f\d])$/i;i=i.replace(e,function(n,o,r,s){return o+o+r+r+s+s});let t=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(i);return t?{red:parseInt(t[1],16),blue:parseInt(t[2],16),green:parseInt(t[3],16)}:{}},Be=function({red:i,green:e,blue:t}){let n=i<<16|e<<8|t<<0;return"#"+(16777216+n).toString(16).slice(1)},Ue=function(i){let e=i.matchAll(/\d+/g),t=[];for(let n of e){let o=parseInt(n[0]);if(o>255)return null;t.push(o)}return t.length!==3?null:{red:t[0],green:t[1],blue:t[2]}},At=function(i){let e=Ue(i);return e&&Be(e)},ee=function(e,t,n){return n<0&&(n+=1),n>1&&(n-=1),n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e},je=({hue:i,saturation:e,lightness:t})=>{let n,o,r;if(e===0)n=o=r=t;else{let s=t<.5?t*(1+e):t+e-t*e,a=2*t-s;n=ee(a,s,i+1/3),o=ee(a,s,i),r=ee(a,s,i-1/3)}return{red:Math.round(n*255),blue:Math.round(r*255),green:Math.round(o*255)}},Ge=i=>{let e=i.toLowerCase();return typeof we[e]<"u"?we[e]:""};function j({red:i,blue:e,green:t},n=!0){if(i===void 0||e===void 0||t===void 0)return"";let o=Pe(i,e,t);return`\x1B[${n?ke.Foreground:ke.Background};5;`+o+"m "+k}function U(i,e=!0){let{red:t,green:n,blue:o}=He(i);return j({red:t,green:n,blue:o},e)}function te({hue:i,saturation:e,lightness:t},n){let{red:o,green:r,blue:s}=je({hue:i,saturation:e,lightness:t});return j({red:o,green:r,blue:s},n)}function Se(i,e=!0){try{let t;return i=i||"",i?((typeof i=="string"||i instanceof String)&&(i=i.trim()),Rt(i)?(t=Ge(i),U(t,e)):typeof i=="object"&&!!i.red&&!!i.blue&&!!i.green?j(i,e):typeof i=="object"&&!!i.hue&&!!i.saturation&&!!i.lightness?te(i,e):i.startsWith("#")?U(i,e):(i=i.toString(),/^[\da-fA-F]+$/.test(i)?U("#"+i,e):"")):""}catch(t){console.error("TO_ANSI_INVALID_ARGUMENT_ERROR",t.message)}}function ne(i,{fg:e,bg:t,isUnderline:n=!1,isBold:o=!1,isReversed:r=!1}){let s=!1,a="";return e&&(s=!0,a=a+e),t&&(s=!0,a=a+t),n&&(s=!0,a=a+Z.Underline),o&&(s=!0,a=a+Z.Bold),r&&(s=!0,a=a+Z.Reversed),s?a+i+_e:i}function Ct(i,{fg:e={},bg:t={},isUnderline:n=!1,isBold:o=!1,isReversed:r=!1}){return e&&(e=j({...e})),t&&(t=j({...t},!1)),ne(i,{fg:e,bg:t,isUnderline:n,isBold:o,isReversed:r})}function Nt(i,{fg:e="",bg:t="",isUnderline:n=!1,isBold:o=!1,isReversed:r=!1}){return e&&(e=te({...e})),t&&(t=te({...t},!1)),ne(i,{fg:e,bg:t,isUnderline:n,isBold:o,isReversed:r})}function Mt(i,{fg:e="",bg:t="",isUnderline:n=!1,isBold:o=!1,isReversed:r=!1}){return e&&(e=U(e)),t&&(t=U(t,!1)),ne(i,{fg:e,bg:t,isUnderline:n,isBold:o,isReversed:r})}function Ft(i,e=null){if(!e)return i;let{fg:t="",bg:n="",isUnderline:o=!1,isBold:r=!1,isReversed:s=!1}=e;return t&&(t=Se(t)),n&&(n=Se(n,!1)),ne(i,{fg:t,bg:n,isUnderline:o,isBold:r,isReversed:s})}var Y={fromRgb:j,fromHexa:U,fromHsl:te,fromColor:Se,getTextFromRgb:Ct,getTextFromHsl:Nt,getTextFromHex:Mt,getTextFromColor:Ft,colorNameToHex:Ge,hslToRgb:je,hexToRgb:He,rgbToHex:Be,rgbToAnsi256:Pe,rgbStringToRgb:Ue,rgbStringToHex:At,hue2rgb:ee,RESET:_e,FONT_STYLE:Z,STYLE:Ot};var ze={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"}},G=ze.COLOR_TABLE,J=ze.SYSTEM,xe=2e3,Oe="analogger-removed-notif",Re="analogger-header",Ae="analogger-view",Ce="analogger-footer",qe="to-esm-line",oe={TOP:"TOP",BOTTOM:"BOTTOM"},Ve="ANALOGGER",re={DEFAULT_FORMAT:"FORMAT1"};var{parse:Xt,stringify:$t}=JSON,{keys:Qt}=Object,It=String,Dt="string";var We="object",kt=(i,e)=>e;var Ye=(i,e,t)=>{let n=It(e.push(t)-1);return i.set(t,n),n};var Je=(i,e,t)=>{let n=e&&typeof e===We?(d,h)=>d===""||-1<e.indexOf(d)?h:void 0:e||kt,o=new Map,r=[],s=[],a=+Ye(o,r,n.call({"":i},"",i)),u=!a;for(;a<r.length;)u=!0,s[a]=$t(r[a++],l,t);return"["+s.join(",")+"]";function l(d,h){if(u)return u=!u,h;let g=n.call(this,d,h);switch(typeof g){case We:if(g===null)return g;case Dt:return o.get(g)||Ye(o,r,g)}return g}};var N={moduleName:"analogger",protocol:"http://",host:"localhost",port:12e3,pathname:"analogger",binarypathname:"uploaded",loopback:"localhost",consoleDomId:"#analogger",logFilename:"./analogger.log"},M={ALL:"ALL",USER:"USER",NONE:"NONE"},E={FATAL:5e3,ERROR:4e3,WARN:3e3,INFO:2e3,LOG:1e3,DEBUG:500,ALL:200,OFF:0,INHERIT:-1},Ke={LOCAL:"local",GLOBAL:"global"},K={DEFAULT:{contextName:"DEFAULT",logLevel:E.LOG,symbol:"check"},LOG:{contextName:"LOG",logLevel:E.LOG,symbol:"check"},DEBUG:{contextName:"DEBUG",logLevel:E.DEBUG},INFO:{contextName:"INFO",logLevel:E.INFO,color:"#B18904",symbol:"diamonds"},WARN:{contextName:"WARN",logLevel:E.WARN,color:G[0],symbol:"cross"},ERROR:{contextName:"ERROR",logLevel:E.ERROR},CRITICAL:{contextName:"CRITICAL",logLevel:E.CRITICAL}},_t=`
|
|
2
|
+
`,ie={airplane:"\u2708",anchor:"\u2693",announcement:"\u{1F4E2}",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",computer:"\u{1F4BB}",computer_disk:"\u{1F4BD}",computer_mouse:"\u{1F5B1}\uFE0F",copyright:"\xA9",cross:"\u274C",desktop_computer:"\u{1F5A5}\uFE0F",diamonds:"\u2666",divisions_ign:"\u2797",double_triangle_right:"\u23ED",double_triangle_left:"\u23EE",email:"\u2709",eject:"\u23CF",envelope:"\u2709\uFE0F",exclamation_mark:"\u2757",fast_forward:"\u23E9",female_sign:"\u2640",fire:"\u{1F525}",fist:"\u270A",floppy_disk:"\u{1F4BE}",fuel_pump:"\u26FD",gear:"\u2699",hammer_and_pick:"\u2692",hand:"\u270B",hearts:"\u2665",identification_card:"\u{1F194}",infinity:"\u267E",information:"\u2139",information_source:"\u2139\uFE0F",key:"\u{1F511}",left_right_arrow:"\u2194",leftwards_arrow_with_hook:"\u21A9",lock:"\u{1F512}",male_sign:"\u2642",minus_sign:"\u2796",money_bag:"\u{1F4B0}",no_entry:"\u26D4",old_key:"\u{1F5DD}\uFE0F",partly_sunny:"\u26C5",pencil:"\u270F",phone:"\u260E",pile_of_poo:"\u{1F4A9}",plus_sign:"\u2795",question:"\u2754",radioactive:"\u2622",raised_hand:"\u270B",recycle:"\u267B",registered:"\xAE",relaxed:"\u263A",rewind:"\u23EA",scissors:"\u2702",settings:"\u2699\uFE0F",shield:"\u{1F6E1}\uFE0F",screen_with_curl:"\u{1F4DC}",snowman:"\u2603",spades:"\u2660",sparkles:"\u2728",speech_bubble:"\u{1F4AC}",squared_cancellation_mark:"\u274E",star:"\u2B50",sunny:"\u2600",tent:"\u26FA",thought_balloon:"\u{1F4AD}",trademark:"\u2122",triangle_with_vertical_bar:"\u23EF",umbrella:"\u2614",unlock:"\u{1F513}",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",white_square_containing_black_small_square:"\u25FD",writing_hand:"\u270D"};function Pt(i){try{let e=path.extname(i),t=path.basename(i,e),n=path.dirname(i),o=i.slice(0,i.length-e.length);return{extension:e,filePath:o,basename:t,dirname:n}}catch(e){console.error("FILEPATH_EXT_FAILURE: ",e.message)}return{extension:".log",filePath:i}}function Ht(){return new Date().toISOString().replace(/:/g,"-").replace(/\./g,"-")}function Bt(i,e,t,n,o,r,s){fs.readdir(i,(a,u)=>{if(a){s(a,null);return}let l=[],d=0,h=(p,b)=>{if(!fs.existsSync(p)){b(null,null);return}fs.unlink(p,w=>{w?console.error(`DELETION_FAILURE: Error deleting file ${p}: ${w}`):l.push(p),d++,d===u.length&&b(null,l)})},g=p=>{if(p.startsWith(e+".")&&p.endsWith(t+n)){let b=path.join(i,p);o&&Gt(b,o,r),h(b,s)}else d++,d===u.length&&s(null,l)};u.length===0?s(null,l):u.forEach(g,r)})}function Ut(i,e={}){let t=document.createElement("script");t.textContent=i;for(let n in e)t.setAttribute(n,e[n]);document.head.appendChild(t),t.remove()}function jt(){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 Gt(i,e,t=1){try{if(!fs.existsSync(i))return;if(!fs.existsSync(e)){let o=fs.mkdtempSync(path.join(os.tmpdir(),"tar-gz-init-"));try{let r=path.join(o,path.basename(i));fs.copyFileSync(i,r),c({sync:!0,gzip:{level:t},file:e,cwd:o,portable:!0},[path.basename(i)])}finally{fs.rmSync(o,{recursive:!0,force:!0})}return}let n=fs.mkdtempSync(path.join(os.tmpdir(),"tar-gz-append-"));try{x({file:e,cwd:n,sync:!0});let o=path.join(n,path.basename(i));fs.copyFileSync(i,o),c({gzip:!0,file:e,cwd:n,sync:!0,portable:!0},fs.readdirSync(n))}finally{fs.rmSync(n,{recursive:!0,force:!0})}}catch(n){console.error(`ARCHIVE_FAILURE: ${n.message}`)}}function Ne(){try{let e=new Error().stack,t="ana-logger",n=!1,o=null,r,s=[];if(e){let a=e.split(`
|
|
3
|
+
`),u=null;if(a.length>=3){let l=0;for(let d=0,h=a.length;d<h;d++){let g=a[d],p=g.split(":");if(p.length<3){s.push(g);continue}if(l=d,u=p[p.length-3],g.indexOf(t)===-1)break;if(g.indexOf("getInvocationLine")===-1){n=!0,t=u.split(/[\\/]/).pop();break}break}for(let d=l+1,h=a.length;d<h;d++){let g=a[d];if(g.indexOf(u)>-1)continue;let p=g.split(":");if(p.length<3)continue;r=s.join(`
|
|
4
|
+
`)+a.slice(d).join(`
|
|
5
|
+
`);let b=parseInt(p.pop()),w=parseInt(p.pop()),R=p.pop(),m=p.pop().split(" "),S=null;for(let A=0;A<m.length;A++){let D=m[A];if(!!D&&D.indexOf("at")!==0){S=D;break}}o={file:R,line:w,col:b,method:S,isMinified:n,stack:r};break}return o}}}catch{}return null}function Xe(i=8){try{let e=Ne();if(!e)return`LID${Date.now()}`;let n=e.method.split(".")[0].toUpperCase().substring(0,3);if(n.length>=i)return n.substring(0,i);let o=`${n}:${e.line}`;if(o.length>=i)return o=o.replaceAll(":",""),o.substring(0,i);let r=`${n}:${e.line}:${e.col}`;return r.length>i?r.substring(0,i).endsWith(":")?`${n}${e.line}:${e.col}`.substring(0,i):r.substring(0,i):`${n}${e.line}:${e.col}`.substring(0,i)}catch{return`ERR_LID${Date.now()}`}}function Qe(){return typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node<"u"?J.NODE:J.BROWSER}var zt=Qe();function qt(){return zt===J.NODE}var Vt=["alert","assert","keepLogHistory","getLogHistory","truncateMessage","truncateMessage","rawLog","removeOverride","removeOverrideError","overrideConsole","overrideError","table","rawInfo","rawWarn","rawError","hasSeenLid","addToLogHistory","releaseLogHistory","resetLogHistory","setLogFormat","resetLogFormatter","getRawLogHistory","restoreLogs"],X,$,_,B,F,ae,Ze,le,et,ce,tt,ue,nt,fe,ot,Fe,Wt,Q,Me,de,rt,z,se,he,it,ge,st,pe,at,me,lt,f=class{constructor({name:e="default"}={}){T(this,ae);T(this,le);T(this,ce);T(this,ue);T(this,fe);T(this,Fe);T(this,Q);T(this,de);T(this,z);T(this,he);T(this,ge);T(this,pe);T(this,me);y(this,"system","");y(this,"instanceId","");y(this,"instanceName","");y(this,"logIndex",0);y(this,"logCounter",0);T(this,$,[]);T(this,_,{...M});T(this,B,{});y(this,"activeTargets",[Object.values(M)]);y(this,"indexColor",0);y(this,"format","");y(this,"keepLog",!1);y(this,"logHistory",[]);y(this,"$containers",null);y(this,"options",{hideHookMessage:!1});y(this,"remoteBuffer",[]);y(this,"remoteTimer",null);T(this,F,{log:!1,info:!1,warn:!1,error:!1});y(this,"originalFormatFunction");y(this,"forceLidOn",!1);y(this,"resolveLineCall",!1);y(this,"resolveErrorLineCall",!1);y(this,"removeDomOldEntries",e=>{if(e.childElementCount>xe){let n=Math.ceil(xe/10);for(let o=0;o<n;++o)e.removeChild(e.firstChild);return n}return 0});y(this,"scrollDivToBottom",e=>{let t=e.scrollHeight-(e.clientHeight+e.scrollTop),n=e.clientHeight||e.offsetHeight;t>n/2||(e.scrollTop=e.scrollHeight)});this.system=Qe(),this.format=this.onBuildLog.bind(this),this.originalFormatFunction=this.format,this.instanceName=e,this.instanceId=f.instanceCount+"-"+Date.now(),L(f,X)[f.instanceCount]=this,++f.instanceCount,this.errorTargetHandler=this.onError.bind(this),this.errorUserTargetHandler=this.onErrorForUserTarget.bind(this),this.remoteBuffer=[],this.remoteTimer=null,this.setOptions(this.options),f.Console||(f.Console={log:console.log,info:console.info,warn:console.warn,error:console.error,debug:console.debug,table:console.table}),this.rawLog=f.Console.log,this.rawInfo=f.Console.info,this.rawWarn=f.Console.warn,this.rawError=f.Console.error,this.ALIGN=f.ALIGN,this.ENVIRONMENT_TYPE=f.ENVIRONMENT_TYPE,O(this,me,lt).call(this),this.resetLogHistory(),this._localOnlyFilter=void 0,this._localOnlyLabel=void 0,this._lastOrderEntry=null,this._seenCount={},this._testResults=[]}getName(){return this.instanceName}getId(){return this.instanceId}forceLid(e=!0){this.forceLidOn=!!e}forceResolveLineCall(e=!0){this.resolveLineCall=!!e}forceResolveErrorLineCall(e=!0){this.resolveErrorLineCall=!!e}importLids(e){for(let t in e){let n=e[t]||{};n.lid=n.lid||t,n.callCount=0,n.callTimes=[],f.lidTable[t]=n}f.lidTableOn=!0}loadLids(e){e=e||{},this.importLids(e)}convertTimestampToDate(e){let t=new Date(e),n=t.getFullYear(),o=String(t.getMonth()+1).padStart(2,"0"),r=String(t.getDate()).padStart(2,"0"),s=String(t.getHours()).padStart(2,"0"),a=String(t.getMinutes()).padStart(2,"0"),u=String(t.getSeconds()).padStart(2,"0"),l=String(t.getMilliseconds()).padStart(3,"0");return`${n}-${o}-${r} ${s}:${a}:${u}.${l}`}getLids(){let e={...ct.lidTable};for(let t in e){let n=e[t]||{};if(n.callTimes.length){n.dates=[];for(let o=0;o<n.callTimes.length;++o){let r=n.callTimes[o],s=this.convertTimestampToDate(r);n.dates.push(s)}}}return e}keepLogHistory(){this.keepLog=!0}releaseLogHistory(){this.keepLog=!1}resetLogHistory(){this.logHistory=[]}addToLogHistory(e){e=e||{},this.logHistory.push(Object.assign({},e))}getLogHistory(e=!0,t=_t){let n=this.logHistory||[],o=[];return n.forEach(r=>{let{text:s}=r;o.push(s)}),e?o.join(t):o}getRawLogHistory(){return this.logHistory||[]}hasSeenLid(e){this.logHistory=this.logHistory||[];for(let t=0;t<this.logHistory.length;++t){let o=(this.logHistory[t]||{}).context||{};if(e===o.lid)return!0}return!1}forceEnvironment(e){this.forcedSystem=e}isNode(){return this&&this.forcedSystem?this.forcedSystem===J.NODE:qt()}isBrowser(){return!this.isNode()}getUid(){if(!this.isBrowser()||typeof window>"u"||!window.localStorage)return null;let e="analogger-uid",t=window.localStorage.getItem(e);return t||(t="uid-"+Date.now()+"-"+Math.floor(Math.random()*1e6),window.localStorage.setItem(e,t)),t}resetLogger(){this.options={},this.options.timeLenMax=12,this.options.contextLenMax=10,this.options.idLenMax=5,this.options.lidLenMax=6,this.options.only=void 0,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,this.options.enableMillisec=void 0,this.options.logToLocalStorage=void 0,this.options.logToLocalStorageMax=50,this.options.logToLocalStorageSize=1e4,this.options.logToRemoteMaxEntries=void 0,this.options.logToRemoteDebounce=void 0,this.options.logToRemoteMaxSize=void 0,this.options.logToRemoteMinSize=void 0,this.options.logUidToRemote=void 0,this.remoteBuffer=[],this.remoteTimer=null,this.remoteWaitCount=0}resetOptions(){this.resetLogger()}setOptions({timeLenMax:e=void 0,contextLenMax:t=10,idLenMax:n=5,lidLenMax:o=6,only:r=void 0,symbolLenMax:s=2,enableTrace:a=!0,messageLenMax:u=void 0,hideLog:l=void 0,hideError:d=void 0,hideHookMessage:h=void 0,hidePassingTests:g=void 0,logToDom:p=void 0,logToFile:b=void 0,logMaxSize:w=0,logMaxArchives:R=3,logIndexArchive:I=0,addArchiveTimestamp:m=!0,addArchiveIndex:S=!0,compressArchives:A=!1,compressionLevel:D=1,logToRemote:v=void 0,logToRemoteUrl:P=void 0,logToRemoteBinaryUrl:q=void 0,loopback:ye=N.loopback,requiredLogLevel:be=E.LOG,oneConsolePerContext:ve=void 0,silent:$e=void 0,enableDate:ut=void 0,enableMillisec:Ie=void 0,logToLocalStorage:ft=void 0,logToLocalStorageMax:dt=50,logToLocalStorageSize:ht=1e4,logToRemoteMaxEntries:gt=void 0,logToRemoteDebounce:pt=void 0,logToRemoteMaxSize:mt=void 0,logToRemoteMinSize:yt=void 0,logUidToRemote:De=void 0,protocol:bt=void 0,host:vt=void 0,port:Lt=void 0,pathname:Tt=void 0,binarypathname:Et=void 0,loadHtmlToImage:wt=!1}=null){if(this.options.contextLenMax=t,this.options.idLenMax=n,this.options.lidLenMax=o,this.options.only=r,this.options.messageLenMax=u,this.options.symbolLenMax=s,this.options.enableMillisec=Ie,this.options.timeLenMax=e,this.options.logMaxSize=w,this.options.logMaxArchives=R,this.options.logIndexArchive=I,this.options.addArchiveTimestamp=m,this.options.addArchiveIndex=S,this.options.compressArchives=A,this.options.compressionLevel=D,this.options.requiredLogLevel=be,this.options.enableTrace=a,this.options.enableMillisec=Ie,this.options.enableMillisec&&(this.options.timeLenMax+=4),this.options.logToLocalStorageMax=dt,this.options.logToLocalStorageSize=ht,this.options.logToRemote=v,this.options.logToRemoteUrl=P,this.options.logToRemoteBinaryUrl=q,this.options.logToRemoteMaxEntries=gt,this.options.logToRemoteDebounce=pt,this.options.logToRemoteMaxSize=mt,this.options.logToRemoteMinSize=yt,this.options.logUidToRemote=De,wt){let H=jt();Ut(H)}let Le;$e!==void 0?Le=!!$e:l!==void 0&&(Le=!!l),[{hideLog:Le},{oneConsolePerContext:ve},{hideError:d},{enableDate:ut},{hideHookMessage:h},{hidePassingTests:g},{logToRemote:v},{logToLocalStorage:ft},{logUidToRemote:De}].forEach(H=>{let V=Object.keys(H)[0],W=H[V];W!==void 0&&(this.options[V]=!!W)}),[{logToRemoteBinaryUrl:q},{logToRemoteUrl:P},{loopback:ye},{protocol:bt},{host:vt},{port:Lt},{pathname:Tt},{binarypathname:Et}].forEach(H=>{let V=Object.keys(H)[0],W=H[V];W!==void 0&&(this.options[V]=W)}),this.options.enableDate&&this.options.timeLenMax===void 0&&(this.options.timeLenMax=17),this.options.timeLenMax===void 0&&(this.options.enableDate?this.options.timeLenMax=17:this.options.timeLenMax=8),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||N.binarypathname})),p===!1?this.options.logToDom=!1:p!==void 0&&(this.options.logToDom=p===!0?N.consoleDomId:p),b===!1?this.options.logToFile=!1:b!==void 0&&(this.isBrowser()||(this.options.logToFile=b||N.logFilename),f.Console.log("LogToFile is not supported in this environment. "))}updateOptions(e){this.setOptions({...this.options,...e})}getOptions(){return this.options}truncateMessage(e="",{fit:t=0,align:n=f.ALIGN.LEFT,ellipsis:o="..."}={}){return e=""+e,t&&e.length>t&&(e=e.substring(0,t-o.length)+o),e=n===f.ALIGN.LEFT?e.padEnd(t," "):e.padStart(t," "),e}onBuildLog(e={}){try{let{contextName:t,message:n="",lid:o="",symbol:r=""}=e,s="",a=n.split(/\n/g);for(let u=0;u<a.length;++u){let l=a[u],d=new Date,h=("0"+d.getHours()).slice(-2)+":"+("0"+d.getMinutes()).slice(-2)+":"+("0"+d.getSeconds()).slice(-2);(e.hasOwnProperty("enableMillisec")?e.enableMillisec:this.options.enableMillisec)&&(h+=","+("00"+d.getMilliseconds()).slice(-3)),(e.hasOwnProperty("enableDate")?e.enableDate:this.options.enableDate)&&(h=d.getFullYear().toString().slice(-2)+"-"+(d.getMonth()+1).toString().padStart(2,"0")+"-"+d.getDate().toString().padStart(2,"0")+" "+h);let b=e.hasOwnProperty("timeLenMax")?e.timeLenMax:this.options.timeLenMax;h=this.truncateMessage(h,{fit:b}),u>0&&(t="",o=""),t=this.truncateMessage(t,{fit:this.options.contextLenMax,align:f.ALIGN.RIGHT}),o=this.truncateMessage(o,{fit:this.options.lidLenMax}),(e.hasOwnProperty("messageLenMax")?e.messageLenMax:this.options.messageLenMax)!==void 0&&(l=this.truncateMessage(l,{fit:this.options.messageLenMax})),r=this.truncateMessage(r,{fit:this.options.symbolLenMax}),u<=0?s+=`[${h}] ${t}: (${o}) ${r} ${l}`:u<a.length-1?(s+=`
|
|
6
|
+
`,s+=`[${h}] ${t} ${o} ${l}`):l&&(s+=`
|
|
7
|
+
`,s+=`[${h}] ${t} ${o} ${l}`)}return s}catch(t){f.Console.error(`ANALOGGER_FAILURE_1001: ${t.message}`)}return""}onErrorForUserTarget(e,...t){this.errorUserTargetHandler(e,...t)}onError(e,...t){e.target===L(this,_).USER&&this.onErrorForUserTarget(e,...t)}onDisplayLog(...e){this.log(...e)}assistStask(e){try{let t=e.stack.split(`
|
|
8
|
+
`),n=[];for(let o=0;o<t.length;++o){let r=t[o];n.push(r)}return n}catch(t){f.Console.error(`ANALOGGER_FAILURE_1002: ${t.message}`)}return e.message}onDisplayError(...e){try{let t=-1,n=null;for(let o=0;o<e.length;++o){let r=e[o];if(r instanceof Error&&r.stack){t=o,n=this.assistStask(r)||[];break}}if(!n){this.error(...e);return}for(let o=0;o<n.length;++o)e[t]=n[o],this.error(...e)}catch(t){f.Console.error(`ANALOGGER_FAILURE_1003: ${t.message}`)}}setLogFormat(e){if(typeof e!="function")return console.error("Invalid parameter for setFormat. It is expecting a function or method."),!1;this.format=e.bind(this)}resetLogFormatter(){this.format=this.originalFormatFunction}setErrorHandler(e){this.errorTargetHandler=e.bind(this)}setErrorHandlerForUserTarget(e){this.errorUserTargetHandler=e.bind(this)}isContextValid(e){return typeof e=="object"&&!Array.isArray(e)&&e!==null?e.hasOwnProperty("contextName")&&e.hasOwnProperty("target"):!1}setDefaultContext(e){this.setContext(K.DEFAULT.contextName,e)}generateDefaultContext(){let e=L(this,$)[K.DEFAULT.contextName]||{};return e=Object.assign({},{lid:"",contextName:K.DEFAULT.contextName,target:M.ALL,symbol:"\u26A1",color:G[1],logLevel:E.LOG},e),e.name=e.contextName,e.id=this.logIndex++,e}generateNewContext(){let e=this.generateDefaultContext();return e.color=G[this.indexColor++%(G.length-3)+2],e.symbol="",e}generateErrorContext(){let e=this.generateDefaultContext();return e.contextName=K.ERROR.contextName,e.name=e.contextName,e.color=G[0],e.symbol="\u274C",e.error=!0,e.logLevel=E.ERROR,e}setContext(e,t={}){t.contextName=e,t.name=e,t=O(this,ae,Ze).call(this,t),L(this,$)[e]=t}getContext(e){return L(this,$)[e]}setContexts(e){Object.keys(e).forEach(n=>{let o=e[n]||{};this.setContext(n,o),e[n]=L(this,$)[n]})}getContexts(){return Object.freeze(L(this,$))}setTargets(e={}){let t={};if(Array.isArray(e))try{for(let n=0;n<e.length;++n){let o=e[n];if(typeof o=="string"||o instanceof String)t[o]=o;else if(typeof o=="object"){let r=null;for(let s in o){let a=o[s];if(s=s.trim(),!s){console.error("Invalid target");break}if(typeof a=="string"||a instanceof String){a=a.trim(),r=[s,a];break}if(typeof a=="number")break}r&&(t[r[0]]=r[1])}}}catch(n){console.error({lid:4321},n.message)}else t=e;Ee(this,_,Object.assign({},t,{...M}))}addTargets(e){let t=L(this,_),n=Object.assign({},t,e);this.setTargets(n)}getTargets(){return Object.freeze(L(this,_))}setActiveTargets(e=null){if(e==null){this.activeTargets=[M.ALL];return}if(typeof e=="function"&&(e=e.call(this)),e===null){this.activeTargets=[M.ALL];return}else if(typeof e=="string"||e instanceof String)e=e.split(",");else if(typeof e=="function")e=e.call(this);else if(typeof e=="object")e=Object.values(e);else if(!Array.isArray(e))return;let t=[];for(let n=0;n<e.length;++n){let o=e[n].trim();Object.values(L(this,_)).includes(o)&&t.push(o)}this.activeTargets=t}getActiveTargets(){return this.activeTargets}getActiveTarget(){return(this.getActiveTargets()||[])[0]||M.NONE}setActiveTarget(e){this.activeTargets=[],this.setActiveTargets(e);let t=this.activeTargets[0]||M.NONE;this.activeTargets=[t]}setLogLevel(e,t){L(this,B)[e]=t}getLogLevel(e){return L(this,B)[e]}setLogLevels(e){Ee(this,B,e)}getLogLevels(){return Object.freeze(L(this,B))}isTargetAllowed(e){return e===M.NONE?!1:e===M.ALL||this.getActiveTarget()===M.ALL?!0:this.activeTargets.includes(e)}getCurrentTime(){let e=new Date,t=String(e.getHours()).padStart(2,"0"),n=String(e.getMinutes()).padStart(2,"0"),o=String(e.getSeconds()).padStart(2,"0");return`${t}:${n}:${o}`}getCurrentDate(){let e=new Date,t=String(e.getDate()).padStart(2,"0"),n=String(e.getMonth()+1).padStart(2,"0"),o=String(e.getFullYear()).slice(-2);return`${t}-${n}-${o}`}setColumns(e,t,n){let o=1,r=!1;for(let a in t){if(!["contextName","symbol","lid","text","enableDate","enableTime"].includes(a))continue;let u=t[a];a==="enableDate"&&(u=this.getCurrentDate()+" "+this.getCurrentTime()),a==="enableTime"&&(u=this.getCurrentTime());let l=document.createElement("span");l.classList.add("analogger-col",`analogger-col-${a}`,`analogger-col-${o}`),++o,a!=="enableDate"&&a!=="enableTime"?(l.textContent=u,e.append(l)):(l.textContent=`[${u}]`,r=l)}r&&(r.classList.add("analogger-col","analogger-col-time","analogger-col-0"),e.prepend(r));let s=document.createElement("span");s.classList.add("analogger-col","analogger-col-text",`analogger-col-${o}`),s.textContent=n,e.append(s);for(let a=1;a<=3;++a)s=document.createElement("span"),s.classList.add("analogger-col","analogger-col-extra",`analogger-extra-${a}`),e.append(s)}checkOnLoggingToDom(e,t){try{let n=e.onLoggingToDom;return typeof n!="function"?void 0:n.call(this,e,t)}catch{}}addLineToDom(e,t,{context:n,addType:o,message:r,text:s,args:a}){if(this.checkOnLoggingToDom(n,{message:r,text:s,args:a,logCounter:this.logCounter,$view:e,$line:t,addType:o})===!1)return;if(o===oe.BOTTOM?e.append(t):e.insertBefore(t,e.firstChild),this.removeDomOldEntries(e)){if(e.getElementsByClassName(Oe).length)return;this.showRemovedNotification(n);return}this.scrollDivToBottom(e)}showRemovedNotification(e){e.contextName=Ve,e.symbol="\u{1F5D1}",e.color="orange",e.className=Oe,clearTimeout(this.timerAddLineToDomID),this.timerAddLineToDomID=setTimeout(()=>{this.timerAddLineToDomID=null,this.writeLogToDom(e,"",{addType:oe.TOP,message:"Oldest entries removed"})},500)}writeLogToDom(e,t,{addType:n=oe.BOTTOM,message:o="",args:r=null}={}){(!this.$containers||!this.$containers.length)&&(this.$containers=document.querySelectorAll(this.options.logToDom)),t=o||t;for(let s=0;s<this.$containers.length;++s){let a=this.$containers[s],u=a.querySelector("."+Re);u||(u=document.createElement("div"),u.classList.add(Re),u.append(document.createElement("span")),u.append(document.createElement("span")),u.append(document.createElement("span")),a.append(u));let l=a.querySelector("."+Ae);l||(l=document.createElement("div"),l.classList.add(Ae),a.append(l));let d=a.querySelector("."+Ce);d||(d=document.createElement("div"),d.classList.add(Ce),d.append(document.createElement("span")),d.append(document.createElement("span")),d.append(document.createElement("span")),a.append(d));let h=document.createElement("div");h.classList.add(qe),e.className&&h.classList.add(e.className),h.style.color=e.color,this.setColumns(h,e,t,r),setTimeout(function(g,p,{addType:b,context:w,message:R,text:I,args:m}){this.addLineToDom(g,p,{addType:b,context:w,message:R,text:I,args:m})}.bind(this,l,h,{addType:n,context:e,message:o,text:t,args:r}),0)}}writeLogToFile(e){try{if(!fs.existsSync(this.options.logToFilePath)){let t=path.dirname(this.options.logToFilePath);fs.existsSync(t)||fs.mkdirSync(t,{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:r,extension:s,basename:a,dirname:u}=Pt(this.options.logToFilePath),l,d;l=this.options.addArchiveIndex?"."+this.options.logIndexArchive.toString().padStart(o,"0"):"",d=this.options.addArchiveTimestamp?"."+Ht():"";let h=`${r}${d}${l}${s}`,g=this.options.compressArchives?`${r}.tar.gz`:"";Bt(u,a,l,s,g,this.options.compressionLevel,p=>{p&&console.error("DELETION_FAILURE: Failed to delete some files")}),fs.renameSync(this.options.logToFilePath,h),fs.writeFileSync(this.options.logToFilePath,"")}fs.appendFileSync(this.options.logToFilePath,e+this.EOL)}catch(t){f.Console.error("LOG_TO_FILE_FAILURE: ",t.message)}}writeLogToRemote(...e){try{if(this.options.logToRemoteMaxEntries===void 0&&this.options.logToRemoteDebounce===void 0&&this.options.logToRemoteMaxSize===void 0){this.performRemotePost([...e]);return}if(Array.isArray(this.remoteBuffer)){if(this.remoteBuffer.push([...e]),this.options.logToRemoteMaxEntries!==void 0&&this.remoteBuffer.length>=this.options.logToRemoteMaxEntries){this.flushRemoteLogs(!0);return}if(this.options.logToRemoteMaxSize!==void 0&&JSON.stringify(this.remoteBuffer).length>=this.options.logToRemoteMaxSize){this.flushRemoteLogs(!0);return}}this.options.logToRemoteDebounce!==void 0&&!this.remoteTimer&&(this.remoteTimer=setTimeout(()=>{this.flushRemoteLogs()},this.options.logToRemoteDebounce))}catch(t){f.Console.error("LOG_TO_REMOTE_FAILURE: ",t.message)}}flushRemoteLogs(e=!1){if(this.remoteBuffer.length===0)return;if(!e&&this.options.logToRemoteMinSize!==void 0&&JSON.stringify(this.remoteBuffer).length<this.options.logToRemoteMinSize&&(this.remoteWaitCount=(this.remoteWaitCount||0)+1,this.remoteWaitCount<2)){this.options.logToRemoteDebounce!==void 0&&(this.remoteTimer&&clearTimeout(this.remoteTimer),this.remoteTimer=setTimeout(()=>{this.flushRemoteLogs()},this.options.logToRemoteDebounce));return}this.remoteTimer&&(clearTimeout(this.remoteTimer),this.remoteTimer=null),this.remoteWaitCount=0;let t=[...this.remoteBuffer];this.remoteBuffer=[],this.performRemotePost(t)}performRemotePost(e){try{let t=this.generateLogToRemoteUrl(this.options.logToRemoteUrl);if(!t)return null;let n=JSON.stringify(e);fetch(t,{method:"post",body:n,headers:{"Content-Type":"application/json"}}).then(o=>o.json()).catch(()=>null)}catch(t){f.Console.error("REMOTE_POST_FAILURE: ",t.message)}}writeLogToLocalStorage(e,...t){try{if(!this.isBrowser()||!window.localStorage)return;let n=`analogger_history_${this.instanceName}`,o=[];try{let u=localStorage.getItem(n);u&&(o=JSON.parse(u))}catch{o=[]}o.push({context:e,args:t});let r=this.options.logToLocalStorageMax||50;o.length>r&&(o=o.slice(o.length-r));let s=this.options.logToLocalStorageSize||1e4,a=JSON.stringify(o);for(;a.length>s&&o.length>1;)o.shift(),a=JSON.stringify(o);localStorage.setItem(n,a)}catch(n){f.Console.error("LOG_TO_LOCAL_STORAGE_FAILURE: ",n.message)}}restoreLogs(){try{if(!this.isBrowser()||!window.localStorage)return;let e=`analogger_history_${this.instanceName}`,t=localStorage.getItem(e);if(!t)return;let n=JSON.parse(t);if(!Array.isArray(n))return;let o=this.options.logToLocalStorage;this.options.logToLocalStorage=!1,n.forEach(r=>{let{context:s,args:a}=r;s&&(s.symbol="floppy_disk",delete s.order,delete s.maxSeen,delete s.test),this.processOutput(s,...a)}),this.options.logToLocalStorage=o}catch(e){f.Console.error("RESTORE_LOGS_FAILURE: ",e.message)}}uploadDataToRemote(e,t=null,n=null){try{if(!this.options.logToRemote)return;let o=this.generateLogToRemoteUrl(this.options.logToRemoteBinaryUrl,{pathname:N.binarypathname});if(!o)return null;let r=e;t&&(r=JSON.stringify({raw:e,context:t})),fetch(o,{method:"post",body:r}).then(s=>s.json()).then(s=>n&&n(s)).catch(s=>s)}catch(o){f.Console.error("BINARY_TO_REMOTE_FAILURE: ",o.message)}}stringifyEntry(e){let t;try{t=JSON.stringify(e)}catch{}if(!t)try{t=Je(e)}catch{}return t}convertEntry(e){try{if(e==null||e==="")return e;if(typeof e=="boolean")return e;if(typeof e=="symbol"||typeof e=="number")return e;if(typeof e=="string"||myVar instanceof e)return e;if(e instanceof Date)return e}catch{}return this.stringifyEntry(e)}convertArgumentsToText(e){let t=[],n,o=e.length;for(let r=0;r<o;++r){let s,a=e[r];s=this.convertEntry(a),t.push(s)}return n=t.join("\u2022"),n}writeToConsole(e,t){let n=[e];this.isBrowser()&&n.push(`color: ${t.color}`);let o=t.contextLevel||E.LOG;o>=E.ERROR?f.Console.error(...n):o>=E.WARN?f.Console.warn(...n):o>=E.INFO?f.Console.info(...n):o>=E.LOG?f.Console.log(...n):o>=E.DEBUG&&f.Console.debug(...n)}checkPlugins(e,{message:t,text:n,args:o,logCounter:r}){try{if(!Object.keys(f.pluginTable).length)return;let s=!0;for(let a in e){let u=e[a];if(!u)continue;let l=f.pluginTable[a];if(!l||typeof l!="object")continue;let{callback:d,methodName:h,type:g}=l;if(typeof d!="function")continue;d.call(this,e,{message:t,text:n,args:o,logCounter:r,methodName:h,type:g,pluginOptions:u})===!1&&(s=!1)}return s}catch{}}checkOnLogging(e,t,n,o){if(!!o)try{let r=e[o];return typeof r!="function"?void 0:r.call(this,t,n)}catch{}}isContextMessagePattern(e){return/\{\{[^}]+}}/.test(e)}transformContextMessage(e,t){let n=e;for(let o in t){let r=`{{${o}}}`,s=t[o];n=n.replaceAll(r,s)}return n}report(){let e=this._testResults.length,t=this._testResults.filter(u=>u.passed).length,n=e-t,o=n>0,r="================== ANALOGGER TEST RESULT ================",s="==========================================================",a=[r,` Total : ${e}`,` Passed : ${t}`,` Failed : ${n}`,s];if(this.isBrowser()){let u=o?"color: red; font-weight: bold;":"color: green; font-weight: bold;";a.forEach(l=>f.Console.log(`%c${l}`,u))}else a.forEach(u=>{let l=Y.getTextFromColor(u,{fg:o?"#FF0000":"#00CC44",isBold:!0});f.Console.log(l)});return{total:e,passed:t,failed:n}}processOutput(e={},...t){try{let n="";if(f.lidTableOn&&e.lid){let l=f.lidTable[e.lid];l?(e.message=e.message||l.message,l.callCount=l.callCount||0,++l.callCount,l.callTimes.push(Date.now())):f.lidTable[e.lid]={...e,message:t[0],lid:e.lid,callCount:1,callTimes:[Date.now()]}}if(e.message&&(this.isContextMessagePattern(e.message)&&t.length>=1&&typeof t[0]=="object"&&(e.message=this.transformContextMessage(e.message,t[0]),t.shift()),t.unshift(e.message)),this.applySymbolByName(e),this.checkOnLogging(e,e,t,"onContext"),!this.isTargetAllowed(e.target)||e.logLevel===E.OFF||this.options.requiredLogLevel>e.logLevel||this.options.only!==void 0&&this.options.only!==null&&!(Array.isArray(this.options.only)?this.options.only:[this.options.only]).some(h=>{let g=e.lid||"",p=e.only||"";return h instanceof RegExp?h.test(g)||h.test(p):typeof h=="string"?g.includes(h)||p.includes(h):h===g||h===p})||!O(this,fe,ot).call(this,e))return;O(this,le,et).call(this,e),O(this,ce,tt).call(this,e);let o=this.checkOnLogging(e,t[0],arguments,"onMessage");o!==void 0&&(arguments[1]=o);let r=t;n=this.convertArgumentsToText(r),O(this,ue,nt).call(this,e,n),this.options.logUidToRemote&&(e.uid=this.getUid());let s="",a=this.format({...e,message:n});this.keepLog&&this.addToLogHistory({context:e,message:n,text:a}),++this.logCounter;let u=this.checkOnLogging(e,a,{message:n,args:r,logCounter:this.logCounter},"onOutput");if(u===!1||((typeof u=="string"||u instanceof String)&&(a=u),u=this.checkPlugins(e,{message:n,text:a,args:r,logCounter:this.logCounter}),u===!1)||(this.options.logToRemote&&this.writeLogToRemote(e,...r),this.options.logToLocalStorage&&this.writeLogToLocalStorage(e,...r),this.isBrowser()?(e.environnment=f.ENVIRONMENT_TYPE.BROWSER,this.options.logToDom&&this.writeLogToDom(e,a,{message:n,args:r}),s=`%c${a}`):(e.environnment=f.ENVIRONMENT_TYPE.NODE,s=Y.getTextFromColor(a,{fg:e.color,bg:e.bgColor,isBold:e.bold,isUnderline:e.underline,isReversed:e.reversed}),this.options.logToFile&&this.writeLogToFile(a)),!(e.silent===!1||e.hideLog===!1)&&(this.options.hideLog||e.hideLog||e.silent)))return;this.writeToConsole(s,e),this.errorTargetHandler(e,r)}catch{}}isExtendedOptionsPassed(e){return typeof e!="object"?!1:e.hasOwnProperty("context")||e.hasOwnProperty("target")||e.hasOwnProperty("color")||e.hasOwnProperty("contextName")||e.hasOwnProperty("raw")||e.hasOwnProperty("only")||e.hasOwnProperty("lid")}stringToObject(e){try{if(e=e.trim(),e.startsWith("{")&&e.endsWith("}")&&(e=e.slice(1,-1).trim()),!e)return{};let t={},n=e.split(",");for(let o of n){let r=o.trim().split(":");if(r.length<2){if(r.length===2){let d=r[0].trim().replace(/^['"]|['"]$/g,"");t[d]=r[1].trim().replace(/^['"]|['"]$/g,"")}else if(r.length===1&&Object.keys(t).length>0){let d=Object.keys(t).pop();t[d]instanceof Array?t[d].push(r[0].trim().replace(/^['"]|['"]$/g,"")):t[d]=[t[d],r[0].trim().replace(/^['"]|['"]$/g,"")]}continue}let s=r[0],a=r.slice(1).join(":"),u=s.trim().replace(/^['"]|['"]$/g,""),l=a.trim().replace(/^['"]|['"]$/g,"");!isNaN(l)&&!isNaN(parseFloat(l))?t[u]=parseFloat(l):t[u]=l}return t}catch{return null}}extractContextFromInput(e){if(typeof e=="string"||e instanceof String){if(e.toLowerCase().indexOf("lid:")!==0)return e;let t=this.stringToObject(e);t&&(e=t)}if(typeof e=="object"&&!Array.isArray(e)&&e!==null&&this.isExtendedOptionsPassed(e)){if(e.contextName){let t=L(this,$)[e.contextName];t&&(e=Object.assign({},t,e))}e.target||(e.target=this.getActiveTarget())}return e}listSymbols(){for(let e in ie)console.rawLog(ie[e]+` ${e} `)}applySymbolByName(e){try{e.symbol&&ie[e.symbol]&&(e.symbol=ie[e.symbol])}catch{}}convertToContext(e,t){e=e||t;let n=e;if(e.context&&typeof e.context=="object"){let o=Object.assign({},e);delete o.context,n=Object.assign({},e.context,o)}return n=Object.assign({},t,n),delete n.context,n}log(e,...t){if(e=this.extractContextFromInput(e),!this.isExtendedOptionsPassed(e)){if(!this.forceLidOn){let s=this.generateDefaultContext();this.processOutput.apply(this,[s,e,...t]);return}(!t||!t.length)&&(t=[e]),e={lid:Xe(this.options.lidLenMax)}}let n=this.generateDefaultContext(),o=this.convertToContext(e,n);if(o.raw){f.Console.log(...t);return}this.resolveLineCall&&(this.resolveErrorLineCall||(o.stack=Ne())),this.processOutput.apply(this,[o,...t])}error(e,...t){if(this.options.hideError)return;if(e=this.extractContextFromInput(e),!this.isExtendedOptionsPassed(e)){if(!this.forceLidOn){let s=this.generateErrorContext();this.processOutput.apply(this,[s,e,...t]);return}e={lid:Xe(this.options.lidLenMax)}}let n=this.generateErrorContext(),o=this.convertToContext(e,n);this.resolveErrorLineCall&&(o.stack=Ne()),this.log(o,...t),this.options.enableTrace&&console.trace(...t)}overrideError(){this.options.hideHookMessage||f.Console.log("AnaLogger: Hook placed on console.error"),L(this,F).error=!0,console.error=this.onDisplayError.bind(this)}attachConsole(){try{return console.rawLog=f.Console.log,console.raw=f.Console.log,console.rawInfo=f.Console.info,console.rawWarn=f.Console.warn,console.rawError=f.Console.error,console.logHistory=this.logHistory,console.logHistory=this.logHistory,Vt.forEach(e=>{console[e]=function(...t){this[e](...t)}.bind(this)}),!0}catch(e){console.error({lid:4321},e.message)}return!1}overrideConsole({log:e=!0,info:t=!0,warn:n=!0,error:o=!1}={}){this.options.hideHookMessage||f.Console.log("AnaLogger: Hook placed on console.log"),[{log:e},{info:t},{warn:n}].forEach(function(r){let s=Object.keys(r)[0];r[s]&&(L(this,F)[s]=!0,console[s]=this.onDisplayLog.bind(this))}.bind(this)),o&&this.overrideError(),this.attachConsole()}removeOverrideError(){console.error=f.Console.error,L(this,F).error=!1}removeOverride({log:e=!0,info:t=!0,warn:n=!0,error:o=!1}={}){e&&(console.log=f.Console.log,L(this,F).log=!1),t&&(console.info=f.Console.info,L(this,F).info=!1),n&&(console.warn=f.Console.warn,L(this,F).warn=!1),o&&this.removeOverrideError()}info(...e){return this.log(...e)}warn(...e){return this.log(...e)}table(...e){if(!L(this,F).log){f.Console.table(...e);return}let t=console.log;console.log=f.Console.log,f.Console.table(...e),console.log=t}takeScreenshot(e={selector:"body",quality:.95,canvasHeight:480,canvasWidth:640}){return new Promise((t,n)=>{if(!this.isBrowser())return;let o="";if(!htmlToImage){o="MISSING_HTML_IMAGE_LIBRARY: htmlToImage is not defined. Please install it first.",f.Console.error(o),n(new Error);return}let{selector:r,quality:s,canvasHeight:a,canvasWidth:u}=e,l=document.querySelector(r),d={quality:s,canvasHeight:a,canvasWidth:u};htmlToImage.toPng(l,d).then(function(h,g){this.uploadDataToRemote(g,h,p=>{t({imageData:g,serverResponse:p})})}.bind(this,e)).catch(function(h){o=`IMAGE_PROCESSING_FAILURE: ${h.message}`,f.Console.error(o),n(new Error(o))})})}alert(...e){if(!this.isBrowser())return this.log(...e);let t;if(e&&(e[0]&&e[0].hasOwnProperty("lid")||this.isContextValid(e[0]))){let n=this.generateDefaultContext();t=this.convertToContext(e[0],n).lid+": "+e.slice(1).join(" | ")}else t=e.join(" | ");alert(t)}assert(e,t=!0,...n){let o;try{return typeof e=="function"?(o=e(...n),o!==t?(this.error("Asset failed"),!1):(this.options.hidePassingTests||this.log("SUCCESS: Assert passed"),!0)):e!==t?(this.error("Assert failed"),!1):(this.options.hidePassingTests||this.log("SUCCESS: Assert passed"),!0)}catch{this.error("Unexpected error in assert")}return!1}startSnapshotProcess(){let e=this.getRawLogHistory?this.getRawLogHistory():this.logHistory||[];this._snapshotWindowStart=e.length,console.log(`[AnaLogger] Snapshot window started at history index ${this._snapshotWindowStart}.`)}takeSnapshot(e,t={}){try{if(!e||typeof e!="string")return console.warn("[AnaLogger] takeSnapshot: snapshotID must be a non-empty string."),[];let{messages:n=!0,context:o=!0}=t,r=O(this,he,it).call(this,{messages:n,context:o}),s={snapshotID:e,timestamp:Date.now(),options:{messages:n,context:o},entries:r};return O(this,de,rt).call(this,O(this,z,se).call(this,e),JSON.stringify(s)),console.log(`[AnaLogger] Snapshot "${e}" saved - ${r.length} lid(s) captured.`),r}catch(n){return console.error("[AnaLogger] takeSnapshot error:",n.message),[]}}compareSnapshots(e,t,n=[]){try{let o=O(this,Q,Me).call(this,O(this,z,se).call(this,e)),r=O(this,Q,Me).call(this,O(this,z,se).call(this,t));if(o||console.warn(`[AnaLogger] compareSnapshots: snapshot "${e}" not found.`),r||console.warn(`[AnaLogger] compareSnapshots: snapshot "${t}" not found.`),!o||!r)return null;let s=JSON.parse(o),a=JSON.parse(r),u=!!(n[0]&&n[0].messages),l=!!(n[1]&&n[1].messages),d=new Map(s.entries.map(m=>[m.lid,m])),h=new Map(a.entries.map(m=>[m.lid,m])),g=new Set([...d.keys(),...h.keys()]),p=[],b=[],w=[];for(let m of g){let S=d.has(m),A=h.has(m);S&&A?p.push(m):S?b.push(m):w.push(m)}let R=[];for(let m of p)R.push({left:m,right:m,status:"both",msgLeft:d.get(m)?.message??"",msgRight:h.get(m)?.message??""});let I=Math.max(b.length,w.length);for(let m=0;m<I;m++){let S=b[m]??"",A=w[m]??"";R.push({left:S,right:A,status:S&&A?"diff":S?"left":"right",msgLeft:S?d.get(S)?.message??"":"",msgRight:A?h.get(A)?.message??"":""})}return O(this,ge,st).call(this,e,t,R,s,a,{showMsg1:u,showMsg2:l}),{onlyInSnap1:b,onlyInSnap2:w,inBoth:p}}catch(o){return console.error("[AnaLogger] compareSnapshots error:",o.message),null}}applyAnalogFormatting({activeTarget:e="",override:t=!1}={}){try{let o={STANDARD:null,TEST:{color:"#B18904",symbol:"diamonds"}};return this.setDefaultContext(o.DEFAULT),e&&this.setActiveTarget(e),this.setOptions({silent:!1,hideError:!1,hideHookMessage:!0,lidLenMax:6}),t&&(this.overrideConsole(),this.overrideError()),!0}catch(n){console.error({lid:3249},n.message)}return!1}applyPredefinedFormat(e=re.DEFAULT_FORMAT,{activeTarget:t="",override:n=!1}={}){if(e===re.DEFAULT_FORMAT)return this.applyAnalogFormatting({activeTarget:t,override:n})}static generateInstance(){return new f}static getInstance(e=0){return f.instanceCount?L(f,X)[e]:null}static generateMainInstance(){let e=f.getInstance();return e||new f}static startLogger(){f.generateMainInstance().applyPredefinedFormat(re.DEFAULT_FORMAT,{override:!0})}static stopLogger(){let e=f.generateMainInstance();e.removeOverride(),e.removeOverrideError()}convertToUrl({protocol:e=N.protocol,host:t=N.host,port:n=N.port,pathname:o=N.pathname}={}){let r=new URL("http://localhost");return r.protocol=e,r.host=t,r.port=n,o&&(r.pathname=o),r.toString()}generateLogToRemoteUrl(e=null,{pathname:t=N.pathname}={}){if(typeof e=="string"||e instanceof String)return e;if(!this.isBrowser())return null;let n=this.options.protocol||window.location.protocol+"//",o=this.options.host||window.location.host||N.host,r=this.options.port||N.port;return t=this.options.pathname||t,this.convertToUrl({protocol:n,host:o,port:r,pathname:t})}addPlugin(e,t,n=""){n=n||e,this[e]=t,f.pluginTable[n]={type:Ke.LOCAL,methodName:e,callback:t}}addGlobalPlugin(e,t,n){f[e]=t,f.pluginTable[n]={type:Ke.GLOBAL,methodName:e,callback:t}}getPluginList(){return Object.keys(f.pluginTable)}validatePlugin(e){return f.pluginTable[e]?!0:(console.warn(`The plugin ${e} is not registered`),!1)}},C=f;X=new WeakMap,$=new WeakMap,_=new WeakMap,B=new WeakMap,F=new WeakMap,ae=new WeakSet,Ze=function(e){let t=this.generateNewContext(),n=Object.assign({},t,e);return n.color.toLowerCase().indexOf("rgb")>-1?n.color=Y.rgbStringToHex(n.color):n.color.indexOf("#")===-1&&(n.color=Y.colorNameToHex(n.color)),n},le=new WeakSet,et=function(e){if(e.order===void 0||e.order===null)return;let t=e.order,n=e.lid||"";if(this._lastOrderEntry!==null){let{lid:o,order:r}=this._lastOrderEntry;if(t<r){let s=`! Order mismatch: [${n}| order: ${t}] appeared after [${o}| order: ${r}]`;f.Console.warn(s)}}this._lastOrderEntry={lid:n,order:t}},ce=new WeakSet,tt=function(e){if(e.maxSeen===void 0||e.maxSeen===null)return;let t=e.lid||"",n=e.maxSeen;this._seenCount[t]=(this._seenCount[t]||0)+1;let o=this._seenCount[t];if(o>n){let r=`! MaxSeen exceeded: [${t}| maxSeen: ${n}] has been seen ${o} time(s)`;f.Console.warn(r)}},ue=new WeakSet,nt=function(e,t){if(!e.hasOwnProperty("test"))return;let n=e.lid||"",o=e.test,r=typeof o=="function"?!!o():!!o;this._testResults.push({lid:n,passed:r,message:t}),r||f.Console.warn(`! Test failed: [${n}] ${t}`)},fe=new WeakSet,ot=function(e){let t=e.only,n=(u,l)=>u instanceof RegExp?u.test(l):typeof u=="string"||u instanceof String?l.includes(u):u===l,o=(u,l)=>Array.isArray(u)?u.some(d=>n(d,l)):n(u,l),r=u=>Array.isArray(u)?u.map(l=>l instanceof RegExp?l.toString():String(l)).join(", "):u instanceof RegExp?u.toString():String(u),s=e.lid||"";if(t==null)return this._localOnlyFilter!==void 0?o(this._localOnlyFilter,s):!0;if(!o(t,s))return!1;let a=r(t);if(this._localOnlyFilter===void 0)this.isBrowser()?f.Console.clear?f.Console.clear():typeof console<"u"&&console.clear&&console.clear():process.stdout.write("\x1Bc");else if(this._localOnlyLabel!==a){let u=`\u2500\u2500\u2500 only switched to ${a} \u2500\u2500\u2500`;this.isBrowser()?f.Console.log(`%c${u}`,"color: #888; font-style: italic"):f.Console.log(u)}return this._localOnlyFilter=t,this._localOnlyLabel=a,!0},Fe=new WeakSet,Wt=function(e){},Q=new WeakSet,Me=function(e){try{if(this.isBrowser()&&typeof localStorage<"u")return localStorage.getItem(e)}catch{}return null},de=new WeakSet,rt=function(e,t){try{if(this.isBrowser()&&typeof localStorage<"u"){localStorage.setItem(e,t);return}}catch{}},z=new WeakSet,se=function(e){return`analogger_snapshot_${this.instanceName||"default"}_${e}`},he=new WeakSet,it=function(e={}){let{messages:t=!0,context:n=!0}=e,o=this.getRawLogHistory?this.getRawLogHistory():this.logHistory||[],r=this._snapshotWindowStart!==void 0?o.slice(this._snapshotWindowStart):o,s=new Map;for(let a of r){let u=a.context||{},l=u.lid;if(!l)continue;let d={lid:l};t&&(d.message=a.message??""),n&&(d.context={...u}),s.set(l,d)}return Array.from(s.values())},ge=new WeakSet,st=function(e,t,n,o,r,{showMsg1:s=!1,showMsg2:a=!1}={}){let u=g=>g.timestamp?new Date(g.timestamp).toLocaleTimeString():"-";console.log(`
|
|
9
|
+
Snapshot comparison: "${e}" vs "${t}"`),console.log(` ${e} captured at ${u(o)} - ${o.entries.length} lid(s)`),console.log(` ${t} captured at ${u(r)} - ${r.entries.length} lid(s)
|
|
10
|
+
`);let l=`${e} message`,d=`${t} message`,h=n.length?n.map(g=>{let p={[e]:g.left,[t]:g.right};return s&&(p[l]=g.msgLeft),a&&(p[d]=g.msgRight),p}):[(()=>{let g={[e]:"(empty)",[t]:"(empty)"};return s&&(g[l]=""),a&&(g[d]=""),g})()];console.table(h),typeof document<"u"&&O(this,pe,at).call(this,e,t,n,o,r,u,{showMsg1:s,showMsg2:a})},pe=new WeakSet,at=function(e,t,n,o,r,s,{showMsg1:a=!1,showMsg2:u=!1}={}){try{let l={both:"#1e293b",bothBg:"#f8fafc",left:"#7f1d1d",leftBg:"#fef2f2",right:"#14532d",rightBg:"#f0fdf4",msg:"#475569",msgBg:"#f8fafc",header:"#1e40af",border:"#e2e8f0"},d=o.entries.filter(v=>r.entries.some(P=>P.lid===v.lid)).length,h=o.entries.length-d,g=r.entries.length-d,p=3+(a?1:0)+(u?1:0),b=(v="")=>`padding:4px 10px;font-family:monospace;font-size:12px;border-bottom:1px solid ${l.border};${v}`,w=(v="")=>`padding:4px 10px;font-size:11px;color:${l.msg};border-bottom:1px solid ${l.border};max-width:200px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;${v}`,R=`padding:5px 10px;text-align:left;background:#f1f5f9;font-size:11px;color:#475569;border-bottom:2px solid ${l.border}`,I=v=>{let P=v.status==="left"?l.leftBg:l.bothBg,q=v.status==="right"?l.rightBg:l.bothBg,ye=v.status==="left"?l.left:v.status==="right"?"#94a3b8":l.both,be=v.status==="right"?l.right:v.status==="left"?"#94a3b8":l.both,ve=v.status==="both"?"=":v.status==="left"?"\u25C0":v.status==="right"?"\u25B6":"\u2260";return`<tr>
|
|
11
|
+
<td style="${b(`background:${P};color:${ye}`)}">${v.left||""}</td>
|
|
12
|
+
${a?`<td style="${w(`background:${P}`)}" title="${(v.msgLeft||"").replace(/"/g,""")}">${v.msgLeft||""}</td>`:""}
|
|
13
|
+
<td style="width:20px;text-align:center;border-bottom:1px solid ${l.border};color:#94a3b8;font-size:10px">${ve}</td>
|
|
14
|
+
<td style="${b(`background:${q};color:${be}`)}">${v.right||""}</td>
|
|
15
|
+
${u?`<td style="${w(`background:${q}`)}" title="${(v.msgRight||"").replace(/"/g,""")}">${v.msgRight||""}</td>`:""}
|
|
16
|
+
</tr>`},m=`
|
|
17
|
+
<div id="analogger-snapshot-cmp" style="
|
|
18
|
+
font-family:system-ui,sans-serif;font-size:13px;
|
|
19
|
+
border:1px solid ${l.border};border-radius:8px;overflow:hidden;
|
|
20
|
+
max-width:${a||u?"820px":"520px"};margin:12px 0;box-shadow:0 2px 8px rgba(0,0,0,.08)">
|
|
21
|
+
<div style="background:${l.header};color:#fff;padding:8px 14px;font-weight:600">
|
|
22
|
+
Snapshot diff —
|
|
23
|
+
<code style="font-size:12px">${e}</code>
|
|
24
|
+
<span style="opacity:.7"> vs </span>
|
|
25
|
+
<code style="font-size:12px">${t}</code>
|
|
26
|
+
</div>
|
|
27
|
+
<div style="display:flex;background:#e2e8f0;font-size:11px;color:#64748b;padding:3px 0">
|
|
28
|
+
<span style="flex:1;padding-left:10px">${e} · ${s(o)} · ${o.entries.length} lids</span>
|
|
29
|
+
<span style="width:20px"></span>
|
|
30
|
+
<span style="flex:1;padding-left:10px">${t} · ${s(r)} · ${r.entries.length} lids</span>
|
|
31
|
+
</div>
|
|
32
|
+
<table style="width:100%;border-collapse:collapse">
|
|
33
|
+
<thead>
|
|
34
|
+
<tr>
|
|
35
|
+
<th style="${R}">${e}</th>
|
|
36
|
+
${a?`<th style="${R};color:#94a3b8;font-style:italic">message</th>`:""}
|
|
37
|
+
<th style="width:20px;background:#f1f5f9;border-bottom:2px solid ${l.border}"></th>
|
|
38
|
+
<th style="${R}">${t}</th>
|
|
39
|
+
${u?`<th style="${R};color:#94a3b8;font-style:italic">message</th>`:""}
|
|
40
|
+
</tr>
|
|
41
|
+
</thead>
|
|
42
|
+
<tbody>
|
|
43
|
+
${n.length?n.map(I).join(""):`<tr><td colspan="${p}" style="padding:10px;color:#94a3b8;text-align:center">(no lids in either snapshot)</td></tr>`}
|
|
44
|
+
</tbody>
|
|
45
|
+
</table>
|
|
46
|
+
<div style="background:#f8fafc;padding:5px 10px;font-size:11px;color:#64748b;display:flex;gap:16px">
|
|
47
|
+
<span>✔ ${d} shared</span>
|
|
48
|
+
<span style="color:${l.left}">◄ ${h} only in ${e}</span>
|
|
49
|
+
<span style="color:${l.right}">► ${g} only in ${t}</span>
|
|
50
|
+
</div>
|
|
51
|
+
</div>`,S=document.getElementById("analogger-snapshot-cmp");S&&S.remove();let A=document.querySelector("#analogger")||document.body,D=document.createElement("div");D.innerHTML=m,A.appendChild(D.firstElementChild)}catch{}},me=new WeakSet,lt=function(){try{this.setTargets(M),this.setLogLevels(E),this.setContexts(K)}catch(e){console.error({lid:4321},e.message)}return!1},T(C,X,[]),y(C,"Console",null),y(C,"ALIGN",{LEFT:"LEFT",RIGHT:"RIGHT"}),y(C,"ENVIRONMENT_TYPE",{BROWSER:"BROWSER",NODE:"NODE",OTHER:"OTHER"}),y(C,"instanceCount",0),y(C,"pluginTable",{}),y(C,"lidTable",{}),y(C,"lidTableOn",!1);var ct=C,rn=ct,sn=C.generateMainInstance();var an=C;export{an as AnaLogger,K as DEFAULT_LOG_CONTEXTS,E as DEFAULT_LOG_LEVELS,M as DEFAULT_LOG_TARGETS,sn as anaLogger,rn as default};
|
|
9
52
|
|