analogger 2.11.0 → 2.12.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 CHANGED
@@ -397,6 +397,7 @@ Display the browser native message box if run from it; otherwise, it displays th
397
397
  | hideError | false | boolean | _Hide errors from console_ |
398
398
  | hideHookMessage | false | boolean | _Hide the automatic message shown when some native console methods are overridden_ |
399
399
  | hidePassingTests | false | boolean | _Hide Live test results_ |
400
+ | keepBreadcrumb | false | boolean | _Show brief history graph_ |
400
401
  | logToDom | false | string (DOM Selector) | _display log in a DOM container_ |
401
402
  | logToFile | false | string (File path) | _write log to a file if running from Node_ |
402
403
  | logToRemote | undefined | string (URL) | _Send log to a remote (more info in the next version)_ |
package/ana-logger.d.cts CHANGED
@@ -83,6 +83,7 @@ declare class ____AnaLogger {
83
83
  };
84
84
  _seenCount: {};
85
85
  _testResults: any[];
86
+ _breadcrumbHistory: any[];
86
87
  getName(): string;
87
88
  getId(): string;
88
89
  /**
@@ -131,7 +132,7 @@ declare class ____AnaLogger {
131
132
  resetLogger(): void;
132
133
  remoteWaitCount: any;
133
134
  resetOptions(): void;
134
- setOptions({ timeLenMax, contextLenMax, idLenMax, lidLenMax, only, symbolLenMax, enableTrace, messageLenMax, hideLog, hideError, hideHookMessage, hidePassingTests, logToDom, logToFile, logMaxSize, logMaxArchives, logIndexArchive, addArchiveTimestamp, addArchiveIndex, compressArchives, compressionLevel, logToRemote, logToRemoteUrl, logToRemoteBinaryUrl, loopback, requiredLogLevel, oneConsolePerContext, silent, enableDate, enableMillisec, logToLocalStorage, logToLocalStorageMax, logToLocalStorageSize, logToRemoteMaxEntries, logToRemoteDebounce, logToRemoteMaxSize, logToRemoteMinSize, logUidToRemote, protocol, host, port, pathname, binarypathname, loadHtmlToImage }?: any): void;
135
+ setOptions({ timeLenMax, contextLenMax, idLenMax, lidLenMax, only, symbolLenMax, enableTrace, messageLenMax, hideLog, hideError, hideHookMessage, hidePassingTests, logToDom, logToFile, logMaxSize, logMaxArchives, logIndexArchive, addArchiveTimestamp, addArchiveIndex, compressArchives, compressionLevel, logToRemote, logToRemoteUrl, logToRemoteBinaryUrl, loopback, requiredLogLevel, oneConsolePerContext, silent, enableDate, enableMillisec, logToLocalStorage, logToLocalStorageMax, logToLocalStorageSize, logToRemoteMaxEntries, logToRemoteDebounce, logToRemoteMaxSize, logToRemoteMinSize, logUidToRemote, protocol, host, port, pathname, binarypathname, loadHtmlToImage, keepBreadcrumb }?: any): void;
135
136
  EOL: string;
136
137
  updateOptions(options: any): void;
137
138
  getOptions(): {
@@ -337,6 +338,10 @@ declare class ____AnaLogger {
337
338
  * anaLogger.resetMaxSeen(); // reset every lid counter
338
339
  */
339
340
  resetMaxSeen(lids: string | string[]): string[];
341
+ /**
342
+ * Reset the breadcrumb history so the trail starts fresh.
343
+ */
344
+ resetBreadcrumb(): void;
340
345
  /**
341
346
  * Print a summary of all test results collected via the "test" context option.
342
347
  * If any test failed the banner and counts are printed in bold red (Node) or
@@ -738,6 +738,10 @@ class ____AnaLogger
738
738
  // Accumulates test results recorded by the "test" context option.
739
739
  // Each entry is { lid, passed, message }.
740
740
  this._testResults = [];
741
+
742
+ // Ordered list of lid values seen so far.
743
+ // Used by the "breadcrumb" context option to print the history path.
744
+ this._breadcrumbHistory = [];
741
745
  }
742
746
 
743
747
  getName()
@@ -984,6 +988,7 @@ class ____AnaLogger
984
988
  this.options.logToRemoteMaxSize = undefined;
985
989
  this.options.logToRemoteMinSize = undefined;
986
990
  this.options.logUidToRemote = undefined;
991
+ this.options.keepBreadcrumb = false;
987
992
  this.remoteBuffer = [];
988
993
  this.remoteTimer = null;
989
994
  this.remoteWaitCount = 0;
@@ -1039,7 +1044,8 @@ class ____AnaLogger
1039
1044
  port = undefined,
1040
1045
  pathname = undefined,
1041
1046
  binarypathname = undefined,
1042
- loadHtmlToImage = false
1047
+ loadHtmlToImage = false,
1048
+ keepBreadcrumb = undefined
1043
1049
  } = null)
1044
1050
  {
1045
1051
  this.options.contextLenMax = contextLenMax;
@@ -1109,6 +1115,7 @@ class ____AnaLogger
1109
1115
  {logToRemote},
1110
1116
  {logToLocalStorage},
1111
1117
  {logUidToRemote},
1118
+ {keepBreadcrumb},
1112
1119
  ].forEach((feature) =>
1113
1120
  {
1114
1121
  const key = Object.keys(feature)[0];
@@ -2716,6 +2723,68 @@ class ____AnaLogger
2716
2723
  return reset;
2717
2724
  }
2718
2725
 
2726
+ /**
2727
+ * Reset the breadcrumb history so the trail starts fresh.
2728
+ */
2729
+ resetBreadcrumb()
2730
+ {
2731
+ this._breadcrumbHistory = [];
2732
+ }
2733
+
2734
+ /**
2735
+ * Handle the "breadcrumb" context option.
2736
+ *
2737
+ * When context.breadcrumb is true the method:
2738
+ * 1. Appends the current context.lid (if any) to the history.
2739
+ * 2. Prints the full trail as: lid1 => lid2 => ... => lidN
2740
+ * 3. Returns true to signal that normal log output should be skipped.
2741
+ *
2742
+ * For every other log call (no breadcrumb flag) the lid is silently
2743
+ * appended to the history so the trail always stays up-to-date.
2744
+ *
2745
+ * @param {object} context
2746
+ * @returns {boolean} true when the call was a breadcrumb display call.
2747
+ */
2748
+ #handleBreadcrumb(context)
2749
+ {
2750
+ const lid = context.lid !== undefined && context.lid !== null && context.lid !== ""
2751
+ ? String(context.lid)
2752
+ : null;
2753
+
2754
+ if (!context.breadcrumb)
2755
+ {
2756
+ // Regular log call — just record the lid if the feature is enabled.
2757
+ if (lid && this.options.keepBreadcrumb)
2758
+ {
2759
+ this._breadcrumbHistory.push(lid);
2760
+ }
2761
+ return false;
2762
+ }
2763
+
2764
+ // breadcrumb: true — append the current lid (if any) and print the trail.
2765
+ // Works even if keepBreadcrumb was just enabled: we record the current lid
2766
+ // so it at least appears in the trail.
2767
+ if (lid && this.options.keepBreadcrumb)
2768
+ {
2769
+ this._breadcrumbHistory.push(lid);
2770
+ }
2771
+
2772
+ const trail = this._breadcrumbHistory.join(" => ") || "(empty)";
2773
+ const label = "Breadcrumb: ";
2774
+
2775
+ if (this.isBrowser())
2776
+ {
2777
+ ____AnaLogger.Console.log(`%c${label}${trail}`, "color: #888; font-style: italic");
2778
+ }
2779
+ else
2780
+ {
2781
+ const styled = toAnsi.getTextFromColor(`${label}${trail}`, {fg: "#888888"});
2782
+ ____AnaLogger.Console.log(styled);
2783
+ }
2784
+
2785
+ return true;
2786
+ }
2787
+
2719
2788
  /**
2720
2789
  * Evaluate the "test" context option and record the result.
2721
2790
  * - If test is a function, it is called with no arguments and its return value is used.
@@ -2953,6 +3022,16 @@ class ____AnaLogger
2953
3022
  }
2954
3023
  this.applySymbolByName(context);
2955
3024
 
3025
+ // Handle the "breadcrumb" option — track lid history and, when
3026
+ // breadcrumb:true, print the trail then skip normal output.
3027
+ // Must run before any filtering (target, logLevel, only) so that:
3028
+ // a) lids are always recorded regardless of active filters, and
3029
+ // b) a breadcrumb display call is never silently suppressed.
3030
+ if (this.#handleBreadcrumb(context))
3031
+ {
3032
+ return;
3033
+ }
3034
+
2956
3035
  this.checkOnLogging(context, context, argsWithoutContext, "onContext");
2957
3036
  if (!this.isTargetAllowed(context.target))
2958
3037
  {
@@ -1,18 +1,18 @@
1
- var St=Object.defineProperty;var Ot=(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)=>(Ot(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},D="\x1B[1D",_e="\x1B[0m"+D,Z={Bold:"\x1B[1m"+D,Underline:"\x1B[4m"+D,Reversed:"\x1B[7m"+D},xt={Bold:"\x1B[1m"+D,Underline:"\x1B[4m"+D,Reversed:"\x1B[7m"+D},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 "+D}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:xt};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,Oe=2e3,xe="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 A={moduleName:"analogger",protocol:"http://",host:"localhost",port:12e3,pathname:"analogger",binarypathname:"uploaded",loopback:"localhost",consoleDomId:"#analogger",logFilename:"./analogger.log"},C={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,v)=>{if(!fs.existsSync(p)){v(null,null);return}fs.unlink(p,w=>{w?console.error(`DELETION_FAILURE: Error deleting file ${p}: ${w}`):l.push(p),d++,d===u.length&&v(null,l)})},g=p=>{if(p.startsWith(e+".")&&p.endsWith(t+n)){let v=path.join(i,p);o&&Gt(v,o,r),h(v,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(`
1
+ var Rt=Object.defineProperty;var At=(i,e,t)=>e in i?Rt(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t;var y=(i,e,t)=>(At(i,typeof e!="symbol"?e+"":e,t),t),Ee=(i,e,t)=>{if(!e.has(i))throw TypeError("Cannot "+t)};var L=(i,e,t)=>(Ee(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)},we=(i,e,t,n)=>(Ee(i,e,"write to private field"),n?n.call(i,t):e.set(i,t),t);var w=(i,e,t)=>(Ee(i,e,"access private method"),t);var _e={Foreground:38,Background:48},I="\x1B[1D",Pe="\x1B[0m"+I,Z={Bold:"\x1B[1m"+I,Underline:"\x1B[4m"+I,Reversed:"\x1B[7m"+I},Ct={Bold:"\x1B[1m"+I,Underline:"\x1B[4m"+I,Reversed:"\x1B[7m"+I},Se={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 Nt(i){return!!Se[i]}var Be=(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)}:{}},Ue=function({red:i,green:e,blue:t}){let n=i<<16|e<<8|t<<0;return"#"+(16777216+n).toString(16).slice(1)},je=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]}},Mt=function(i){let e=je(i);return e&&Ue(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},Ge=({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)}},ze=i=>{let e=i.toLowerCase();return typeof Se[e]<"u"?Se[e]:""};function j({red:i,blue:e,green:t},n=!0){if(i===void 0||e===void 0||t===void 0)return"";let o=Be(i,e,t);return`\x1B[${n?_e.Foreground:_e.Background};5;`+o+"m "+I}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}=Ge({hue:i,saturation:e,lightness:t});return j({red:o,green:r,blue:s},n)}function Oe(i,e=!0){try{let t;return i=i||"",i?((typeof i=="string"||i instanceof String)&&(i=i.trim()),Nt(i)?(t=ze(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+Pe:i}function Ft(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 $t(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 kt(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 It(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=Oe(t)),n&&(n=Oe(n,!1)),ne(i,{fg:t,bg:n,isUnderline:o,isBold:r,isReversed:s})}var G={fromRgb:j,fromHexa:U,fromHsl:te,fromColor:Oe,getTextFromRgb:Ft,getTextFromHsl:$t,getTextFromHex:kt,getTextFromColor:It,colorNameToHex:ze,hslToRgb:Ge,hexToRgb:He,rgbToHex:Ue,rgbToAnsi256:Be,rgbStringToRgb:je,rgbStringToHex:Mt,hue2rgb:ee,RESET:Pe,FONT_STYLE:Z,STYLE:Ct};var qe={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"}},z=qe.COLOR_TABLE,J=qe.SYSTEM,xe=2e3,Re="analogger-removed-notif",Ae="analogger-header",Ce="analogger-view",Ne="analogger-footer",Ve="to-esm-line",oe={TOP:"TOP",BOTTOM:"BOTTOM"},We="ANALOGGER",re={DEFAULT_FORMAT:"FORMAT1"};var{parse:en,stringify:Dt}=JSON,{keys:tn}=Object,_t=String,Pt="string";var Ye="object",Bt=(i,e)=>e;var Je=(i,e,t)=>{let n=_t(e.push(t)-1);return i.set(t,n),n};var Ke=(i,e,t)=>{let n=e&&typeof e===Ye?(d,h)=>d===""||-1<e.indexOf(d)?h:void 0:e||Bt,o=new Map,r=[],s=[],a=+Je(o,r,n.call({"":i},"",i)),u=!a;for(;a<r.length;)u=!0,s[a]=Dt(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 Ye:if(g===null)return g;case Pt:return o.get(g)||Je(o,r,g)}return g}};var A={moduleName:"analogger",protocol:"http://",host:"localhost",port:12e3,pathname:"analogger",binarypathname:"uploaded",loopback:"localhost",consoleDomId:"#analogger",logFilename:"./analogger.log"},C={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},Xe={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:z[0],symbol:"cross"},ERROR:{contextName:"ERROR",logLevel:E.ERROR},CRITICAL:{contextName:"CRITICAL",logLevel:E.CRITICAL}},Ht=`
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 Ut(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 jt(){return new Date().toISOString().replace(/:/g,"-").replace(/\./g,"-")}function Gt(i,e,t,n,o,r,s){fs.readdir(i,(a,u)=>{if(a){s(a,null);return}let l=[],d=0,h=(p,v)=>{if(!fs.existsSync(p)){v(null,null);return}fs.unlink(p,S=>{S?console.error(`DELETION_FAILURE: Error deleting file ${p}: ${S}`):l.push(p),d++,d===u.length&&v(null,l)})},g=p=>{if(p.startsWith(e+".")&&p.endsWith(t+n)){let v=path.join(i,p);o&&Vt(v,o,r),h(v,s)}else d++,d===u.length&&s(null,l)};u.length===0?s(null,l):u.forEach(g,r)})}function zt(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 qt(){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 Vt(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 Me(){try{let e=new Error().stack,t="ana-logger",n=!1,o=null,r,s=[];if(e){let a=e.split(`
3
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
4
  `)+a.slice(d).join(`
5
- `);let v=parseInt(p.pop()),w=parseInt(p.pop()),S=p.pop(),N=p.pop().split(" "),F=null;for(let _=0;_<N.length;_++){let I=N[_];if(!!I&&I.indexOf("at")!==0){F=I;break}}o={file:S,line:w,col:v,method:F,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,$,k,B,M,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,k,{...C});T(this,B,{});y(this,"activeTargets",[Object.values(C)]);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,M,{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>Oe){let n=Math.ceil(Oe/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:v=void 0,logMaxSize:w=0,logMaxArchives:S=3,logIndexArchive:m=0,addArchiveTimestamp:N=!0,addArchiveIndex:F=!0,compressArchives:_=!1,compressionLevel:I=1,logToRemote:b=void 0,logToRemoteUrl:P=void 0,logToRemoteBinaryUrl:q=void 0,loopback:ye=A.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=S,this.options.logIndexArchive=m,this.options.addArchiveTimestamp=N,this.options.addArchiveIndex=F,this.options.compressArchives=_,this.options.compressionLevel=I,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=b,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:b},{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||A.binarypathname})),p===!1?this.options.logToDom=!1:p!==void 0&&(this.options.logToDom=p===!0?A.consoleDomId:p),v===!1?this.options.logToFile=!1:v!==void 0&&(this.isBrowser()||(this.options.logToFile=v||A.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 v=e.hasOwnProperty("timeLenMax")?e.timeLenMax:this.options.timeLenMax;h=this.truncateMessage(h,{fit:v}),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+=`
5
+ `);let v=parseInt(p.pop()),S=parseInt(p.pop()),O=p.pop(),N=p.pop().split(" "),F=null;for(let _=0;_<N.length;_++){let k=N[_];if(!!k&&k.indexOf("at")!==0){F=k;break}}o={file:O,line:S,col:v,method:F,isMinified:n,stack:r};break}return o}}}catch{}return null}function Qe(i=8){try{let e=Me();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 Ze(){return typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node<"u"?J.NODE:J.BROWSER}var Wt=Ze();function Yt(){return Wt===J.NODE}var Jt=["alert","assert","keepLogHistory","getLogHistory","truncateMessage","truncateMessage","rawLog","removeOverride","removeOverrideError","overrideConsole","overrideError","table","rawInfo","rawWarn","rawError","hasSeenLid","addToLogHistory","releaseLogHistory","resetLogHistory","setLogFormat","resetLogFormatter","getRawLogHistory","restoreLogs"],X,$,D,H,M,ae,et,le,tt,ce,nt,ue,ot,fe,rt,de,it,$e,Kt,Q,Fe,he,st,q,se,ge,at,pe,lt,me,ct,ye,ut,f=class{constructor({name:e="default"}={}){T(this,ae);T(this,le);T(this,ce);T(this,ue);T(this,fe);T(this,de);T(this,$e);T(this,Q);T(this,he);T(this,q);T(this,ge);T(this,pe);T(this,me);T(this,ye);y(this,"system","");y(this,"instanceId","");y(this,"instanceName","");y(this,"logIndex",0);y(this,"logCounter",0);T(this,$,[]);T(this,D,{...C});T(this,H,{});y(this,"activeTargets",[Object.values(C)]);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,M,{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=Ze(),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,w(this,ye,ut).call(this),this.resetLogHistory(),this._localOnlyFilter=void 0,this._localOnlyLabel=void 0,this._lastOrderEntry=null,this._seenCount={},this._testResults=[],this._breadcrumbHistory=[]}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={...ft.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=Ht){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:Yt()}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.options.keepBreadcrumb=!1,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:v=void 0,logMaxSize:S=0,logMaxArchives:O=3,logIndexArchive:m=0,addArchiveTimestamp:N=!0,addArchiveIndex:F=!0,compressArchives:_=!1,compressionLevel:k=1,logToRemote:b=void 0,logToRemoteUrl:P=void 0,logToRemoteBinaryUrl:V=void 0,loopback:be=A.loopback,requiredLogLevel:ve=E.LOG,oneConsolePerContext:Le=void 0,silent:ke=void 0,enableDate:dt=void 0,enableMillisec:Ie=void 0,logToLocalStorage:ht=void 0,logToLocalStorageMax:gt=50,logToLocalStorageSize:pt=1e4,logToRemoteMaxEntries:mt=void 0,logToRemoteDebounce:yt=void 0,logToRemoteMaxSize:bt=void 0,logToRemoteMinSize:vt=void 0,logUidToRemote:De=void 0,protocol:Lt=void 0,host:Tt=void 0,port:Et=void 0,pathname:wt=void 0,binarypathname:St=void 0,loadHtmlToImage:Ot=!1,keepBreadcrumb:xt=void 0}=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=S,this.options.logMaxArchives=O,this.options.logIndexArchive=m,this.options.addArchiveTimestamp=N,this.options.addArchiveIndex=F,this.options.compressArchives=_,this.options.compressionLevel=k,this.options.requiredLogLevel=ve,this.options.enableTrace=a,this.options.enableMillisec=Ie,this.options.enableMillisec&&(this.options.timeLenMax+=4),this.options.logToLocalStorageMax=gt,this.options.logToLocalStorageSize=pt,this.options.logToRemote=b,this.options.logToRemoteUrl=P,this.options.logToRemoteBinaryUrl=V,this.options.logToRemoteMaxEntries=mt,this.options.logToRemoteDebounce=yt,this.options.logToRemoteMaxSize=bt,this.options.logToRemoteMinSize=vt,this.options.logUidToRemote=De,Ot){let B=qt();zt(B)}let Te;ke!==void 0?Te=!!ke:l!==void 0&&(Te=!!l),[{hideLog:Te},{oneConsolePerContext:Le},{hideError:d},{enableDate:dt},{hideHookMessage:h},{hidePassingTests:g},{logToRemote:b},{logToLocalStorage:ht},{logUidToRemote:De},{keepBreadcrumb:xt}].forEach(B=>{let W=Object.keys(B)[0],Y=B[W];Y!==void 0&&(this.options[W]=!!Y)}),[{logToRemoteBinaryUrl:V},{logToRemoteUrl:P},{loopback:be},{protocol:Lt},{host:Tt},{port:Et},{pathname:wt},{binarypathname:St}].forEach(B=>{let W=Object.keys(B)[0],Y=B[W];Y!==void 0&&(this.options[W]=Y)}),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||A.binarypathname})),p===!1?this.options.logToDom=!1:p!==void 0&&(this.options.logToDom=p===!0?A.consoleDomId:p),v===!1?this.options.logToFile=!1:v!==void 0&&(this.isBrowser()||(this.options.logToFile=v||A.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 v=e.hasOwnProperty("timeLenMax")?e.timeLenMax:this.options.timeLenMax;h=this.truncateMessage(h,{fit:v}),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
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,k).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:C.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,k,Object.assign({},t,{...C}))}addTargets(e){let t=L(this,k),n=Object.assign({},t,e);this.setTargets(n)}getTargets(){return Object.freeze(L(this,k))}setActiveTargets(e=null){if(e==null){this.activeTargets=[C.ALL];return}if(typeof e=="function"&&(e=e.call(this)),e===null){this.activeTargets=[C.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,k)).includes(o)&&t.push(o)}this.activeTargets=t}getActiveTargets(){return this.activeTargets}getActiveTarget(){return(this.getActiveTargets()||[])[0]||C.NONE}setActiveTarget(e){this.activeTargets=[],this.setActiveTargets(e);let t=this.activeTargets[0]||C.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===C.NONE?!1:e===C.ALL||this.getActiveTarget()===C.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(xe).length)return;this.showRemovedNotification(n);return}this.scrollDivToBottom(e)}showRemovedNotification(e){e.contextName=Ve,e.symbol="\u{1F5D1}",e.color="orange",e.className=xe,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:v,context:w,message:S,text:m,args:N}){this.addLineToDom(g,p,{addType:v,context:w,message:S,text:m,args:N})}.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:A.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}resetOrder(){this._lastOrderEntry=null}resetMaxSeen(e){if(e==null){let o=Object.keys(this._seenCount);return this._seenCount={},o}let t=Array.isArray(e)?e:[e],n=[];for(let o of t)Object.prototype.hasOwnProperty.call(this._seenCount,o)&&(delete this._seenCount[o],n.push(o));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,M).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,M)[s]=!0,console[s]=this.onDisplayLog.bind(this))}.bind(this)),o&&this.overrideError(),this.attachConsole()}removeOverrideError(){console.error=f.Console.error,L(this,M).error=!1}removeOverride({log:e=!0,info:t=!0,warn:n=!0,error:o=!1}={}){e&&(console.log=f.Console.log,L(this,M).log=!1),t&&(console.info=f.Console.info,L(this,M).info=!1),n&&(console.warn=f.Console.warn,L(this,M).warn=!1),o&&this.removeOverrideError()}info(...e){return this.log(...e)}warn(...e){return this.log(...e)}table(...e){if(!L(this,M).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=[],v=[],w=[];for(let m of g){let N=d.has(m),F=h.has(m);N&&F?p.push(m):N?v.push(m):w.push(m)}let S=[];for(let m of p)S.push({left:m,right:m,status:"both",msgLeft:d.get(m)?.message??"",msgRight:h.get(m)?.message??""});for(let m of v)S.push({left:m,right:"",status:"left",msgLeft:d.get(m)?.message??"",msgRight:""});for(let m of w)S.push({left:"",right:m,status:"right",msgLeft:"",msgRight:h.get(m)?.message??""});return O(this,ge,st).call(this,e,t,S,s,a,{showMsg1:u,showMsg2:l}),{onlyInSnap1:v,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=A.protocol,host:t=A.host,port:n=A.port,pathname:o=A.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=A.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||A.host,r=this.options.port||A.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)}},R=f;X=new WeakMap,$=new WeakMap,k=new WeakMap,B=new WeakMap,M=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.resetOrder&&this.resetOrder(),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(`
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,D).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:C.ALL,symbol:"\u26A1",color:z[1],logLevel:E.LOG},e),e.name=e.contextName,e.id=this.logIndex++,e}generateNewContext(){let e=this.generateDefaultContext();return e.color=z[this.indexColor++%(z.length-3)+2],e.symbol="",e}generateErrorContext(){let e=this.generateDefaultContext();return e.contextName=K.ERROR.contextName,e.name=e.contextName,e.color=z[0],e.symbol="\u274C",e.error=!0,e.logLevel=E.ERROR,e}setContext(e,t={}){t.contextName=e,t.name=e,t=w(this,ae,et).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;we(this,D,Object.assign({},t,{...C}))}addTargets(e){let t=L(this,D),n=Object.assign({},t,e);this.setTargets(n)}getTargets(){return Object.freeze(L(this,D))}setActiveTargets(e=null){if(e==null){this.activeTargets=[C.ALL];return}if(typeof e=="function"&&(e=e.call(this)),e===null){this.activeTargets=[C.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,D)).includes(o)&&t.push(o)}this.activeTargets=t}getActiveTargets(){return this.activeTargets}getActiveTarget(){return(this.getActiveTargets()||[])[0]||C.NONE}setActiveTarget(e){this.activeTargets=[],this.setActiveTargets(e);let t=this.activeTargets[0]||C.NONE;this.activeTargets=[t]}setLogLevel(e,t){L(this,H)[e]=t}getLogLevel(e){return L(this,H)[e]}setLogLevels(e){we(this,H,e)}getLogLevels(){return Object.freeze(L(this,H))}isTargetAllowed(e){return e===C.NONE?!1:e===C.ALL||this.getActiveTarget()===C.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(Re).length)return;this.showRemovedNotification(n);return}this.scrollDivToBottom(e)}showRemovedNotification(e){e.contextName=We,e.symbol="\u{1F5D1}",e.color="orange",e.className=Re,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("."+Ae);u||(u=document.createElement("div"),u.classList.add(Ae),u.append(document.createElement("span")),u.append(document.createElement("span")),u.append(document.createElement("span")),a.append(u));let l=a.querySelector("."+Ce);l||(l=document.createElement("div"),l.classList.add(Ce),a.append(l));let d=a.querySelector("."+Ne);d||(d=document.createElement("div"),d.classList.add(Ne),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(Ve),e.className&&h.classList.add(e.className),h.style.color=e.color,this.setColumns(h,e,t,r),setTimeout(function(g,p,{addType:v,context:S,message:O,text:m,args:N}){this.addLineToDom(g,p,{addType:v,context:S,message:O,text:m,args:N})}.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}=Ut(this.options.logToFilePath),l,d;l=this.options.addArchiveIndex?"."+this.options.logIndexArchive.toString().padStart(o,"0"):"",d=this.options.addArchiveTimestamp?"."+jt():"";let h=`${r}${d}${l}${s}`,g=this.options.compressArchives?`${r}.tar.gz`:"";Gt(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:A.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=Ke(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}resetOrder(){this._lastOrderEntry=null}resetMaxSeen(e){if(e==null){let o=Object.keys(this._seenCount);return this._seenCount={},o}let t=Array.isArray(e)?e:[e],n=[];for(let o of t)Object.prototype.hasOwnProperty.call(this._seenCount,o)&&(delete this._seenCount[o],n.push(o));return n}resetBreadcrumb(){this._breadcrumbHistory=[]}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=G.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),w(this,ue,ot).call(this,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})||!w(this,de,it).call(this,e))return;w(this,le,tt).call(this,e),w(this,ce,nt).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),w(this,fe,rt).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=G.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:Qe(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=Me())),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:Qe(this.options.lidLenMax)}}let n=this.generateErrorContext(),o=this.convertToContext(e,n);this.resolveErrorLineCall&&(o.stack=Me()),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,M).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,Jt.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,M)[s]=!0,console[s]=this.onDisplayLog.bind(this))}.bind(this)),o&&this.overrideError(),this.attachConsole()}removeOverrideError(){console.error=f.Console.error,L(this,M).error=!1}removeOverride({log:e=!0,info:t=!0,warn:n=!0,error:o=!1}={}){e&&(console.log=f.Console.log,L(this,M).log=!1),t&&(console.info=f.Console.info,L(this,M).info=!1),n&&(console.warn=f.Console.warn,L(this,M).warn=!1),o&&this.removeOverrideError()}info(...e){return this.log(...e)}warn(...e){return this.log(...e)}table(...e){if(!L(this,M).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=w(this,ge,at).call(this,{messages:n,context:o}),s={snapshotID:e,timestamp:Date.now(),options:{messages:n,context:o},entries:r};return w(this,he,st).call(this,w(this,q,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=w(this,Q,Fe).call(this,w(this,q,se).call(this,e)),r=w(this,Q,Fe).call(this,w(this,q,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=[],v=[],S=[];for(let m of g){let N=d.has(m),F=h.has(m);N&&F?p.push(m):N?v.push(m):S.push(m)}let O=[];for(let m of p)O.push({left:m,right:m,status:"both",msgLeft:d.get(m)?.message??"",msgRight:h.get(m)?.message??""});for(let m of v)O.push({left:m,right:"",status:"left",msgLeft:d.get(m)?.message??"",msgRight:""});for(let m of S)O.push({left:"",right:m,status:"right",msgLeft:"",msgRight:h.get(m)?.message??""});return w(this,pe,lt).call(this,e,t,O,s,a,{showMsg1:u,showMsg2:l}),{onlyInSnap1:v,onlyInSnap2:S,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=A.protocol,host:t=A.host,port:n=A.port,pathname:o=A.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=A.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||A.host,r=this.options.port||A.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:Xe.LOCAL,methodName:e,callback:t}}addGlobalPlugin(e,t,n){f[e]=t,f.pluginTable[n]={type:Xe.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)}},R=f;X=new WeakMap,$=new WeakMap,D=new WeakMap,H=new WeakMap,M=new WeakMap,ae=new WeakSet,et=function(e){let t=this.generateNewContext(),n=Object.assign({},t,e);return n.color.toLowerCase().indexOf("rgb")>-1?n.color=G.rgbStringToHex(n.color):n.color.indexOf("#")===-1&&(n.color=G.colorNameToHex(n.color)),n},le=new WeakSet,tt=function(e){if(e.resetOrder&&this.resetOrder(),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,nt=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,ot=function(e){let t=e.lid!==void 0&&e.lid!==null&&e.lid!==""?String(e.lid):null;if(!e.breadcrumb)return t&&this.options.keepBreadcrumb&&this._breadcrumbHistory.push(t),!1;t&&this.options.keepBreadcrumb&&this._breadcrumbHistory.push(t);let n=this._breadcrumbHistory.join(" => ")||"(empty)",o="Breadcrumb: ";if(this.isBrowser())f.Console.log(`%c${o}${n}`,"color: #888; font-style: italic");else{let r=G.getTextFromColor(`${o}${n}`,{fg:"#888888"});f.Console.log(r)}return!0},fe=new WeakSet,rt=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}`)},de=new WeakSet,it=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},$e=new WeakSet,Kt=function(e){},Q=new WeakSet,Fe=function(e){try{if(this.isBrowser()&&typeof localStorage<"u")return localStorage.getItem(e)}catch{}return null},he=new WeakSet,st=function(e,t){try{if(this.isBrowser()&&typeof localStorage<"u"){localStorage.setItem(e,t);return}}catch{}},q=new WeakSet,se=function(e){return`analogger_snapshot_${this.instanceName||"default"}_${e}`},ge=new WeakSet,at=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())},pe=new WeakSet,lt=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
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(b=>r.entries.some(P=>P.lid===b.lid)).length,h=o.entries.length-d,g=r.entries.length-d,p=3+(a?1:0)+(u?1:0),v=(b="")=>`padding:4px 10px;font-family:monospace;font-size:12px;border-bottom:1px solid ${l.border};${b}`,w=(b="")=>`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;${b}`,S=`padding:5px 10px;text-align:left;background:#f1f5f9;font-size:11px;color:#475569;border-bottom:2px solid ${l.border}`,m=b=>{let P=b.status==="left"?l.leftBg:l.bothBg,q=b.status==="right"?l.rightBg:l.bothBg,ye=b.status==="left"?l.left:b.status==="right"?"#94a3b8":l.both,be=b.status==="right"?l.right:b.status==="left"?"#94a3b8":l.both,ve=b.status==="both"?"=":b.status==="left"?"\u25C0":b.status==="right"?"\u25B6":"\u2260";return`<tr>
11
- <td style="${v(`background:${P};color:${ye}`)}">${b.left||""}</td>
12
- ${a?`<td style="${w(`background:${P}`)}" title="${(b.msgLeft||"").replace(/"/g,"&quot;")}">${b.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="${v(`background:${q};color:${be}`)}">${b.right||""}</td>
15
- ${u?`<td style="${w(`background:${q}`)}" title="${(b.msgRight||"").replace(/"/g,"&quot;")}">${b.msgRight||""}</td>`:""}
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"&&w(this,me,ct).call(this,e,t,n,o,r,u,{showMsg1:s,showMsg2:a})},me=new WeakSet,ct=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(b=>r.entries.some(P=>P.lid===b.lid)).length,h=o.entries.length-d,g=r.entries.length-d,p=3+(a?1:0)+(u?1:0),v=(b="")=>`padding:4px 10px;font-family:monospace;font-size:12px;border-bottom:1px solid ${l.border};${b}`,S=(b="")=>`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;${b}`,O=`padding:5px 10px;text-align:left;background:#f1f5f9;font-size:11px;color:#475569;border-bottom:2px solid ${l.border}`,m=b=>{let P=b.status==="left"?l.leftBg:l.bothBg,V=b.status==="right"?l.rightBg:l.bothBg,be=b.status==="left"?l.left:b.status==="right"?"#94a3b8":l.both,ve=b.status==="right"?l.right:b.status==="left"?"#94a3b8":l.both,Le=b.status==="both"?"=":b.status==="left"?"\u25C0":b.status==="right"?"\u25B6":"\u2260";return`<tr>
11
+ <td style="${v(`background:${P};color:${be}`)}">${b.left||""}</td>
12
+ ${a?`<td style="${S(`background:${P}`)}" title="${(b.msgLeft||"").replace(/"/g,"&quot;")}">${b.msgLeft||""}</td>`:""}
13
+ <td style="width:20px;text-align:center;border-bottom:1px solid ${l.border};color:#94a3b8;font-size:10px">${Le}</td>
14
+ <td style="${v(`background:${V};color:${ve}`)}">${b.right||""}</td>
15
+ ${u?`<td style="${S(`background:${V}`)}" title="${(b.msgRight||"").replace(/"/g,"&quot;")}">${b.msgRight||""}</td>`:""}
16
16
  </tr>`},N=`
17
17
  <div id="analogger-snapshot-cmp" style="
18
18
  font-family:system-ui,sans-serif;font-size:13px;
@@ -32,11 +32,11 @@ Snapshot comparison: "${e}" vs "${t}"`),console.log(` ${e} captured at ${u(o)
32
32
  <table style="width:100%;border-collapse:collapse">
33
33
  <thead>
34
34
  <tr>
35
- <th style="${S}">${e}</th>
36
- ${a?`<th style="${S};color:#94a3b8;font-style:italic">message</th>`:""}
35
+ <th style="${O}">${e}</th>
36
+ ${a?`<th style="${O};color:#94a3b8;font-style:italic">message</th>`:""}
37
37
  <th style="width:20px;background:#f1f5f9;border-bottom:2px solid ${l.border}"></th>
38
- <th style="${S}">${t}</th>
39
- ${u?`<th style="${S};color:#94a3b8;font-style:italic">message</th>`:""}
38
+ <th style="${O}">${t}</th>
39
+ ${u?`<th style="${O};color:#94a3b8;font-style:italic">message</th>`:""}
40
40
  </tr>
41
41
  </thead>
42
42
  <tbody>
@@ -48,5 +48,5 @@ Snapshot comparison: "${e}" vs "${t}"`),console.log(` ${e} captured at ${u(o)
48
48
  <span style="color:${l.left}">&#x25C4; ${h} only in ${e}</span>
49
49
  <span style="color:${l.right}">&#x25BA; ${g} only in ${t}</span>
50
50
  </div>
51
- </div>`,F=document.getElementById("analogger-snapshot-cmp");F&&F.remove();let _=document.querySelector("#analogger")||document.body,I=document.createElement("div");I.innerHTML=N,_.appendChild(I.firstElementChild)}catch{}},me=new WeakSet,lt=function(){try{this.setTargets(C),this.setLogLevels(E),this.setContexts(K)}catch(e){console.error({lid:4321},e.message)}return!1},T(R,X,[]),y(R,"Console",null),y(R,"ALIGN",{LEFT:"LEFT",RIGHT:"RIGHT"}),y(R,"ENVIRONMENT_TYPE",{BROWSER:"BROWSER",NODE:"NODE",OTHER:"OTHER"}),y(R,"instanceCount",0),y(R,"pluginTable",{}),y(R,"lidTable",{}),y(R,"lidTableOn",!1);var ct=R,rn=ct,sn=R.generateMainInstance();var an=R;export{an as AnaLogger,K as DEFAULT_LOG_CONTEXTS,E as DEFAULT_LOG_LEVELS,C as DEFAULT_LOG_TARGETS,sn as anaLogger,rn as default};
51
+ </div>`,F=document.getElementById("analogger-snapshot-cmp");F&&F.remove();let _=document.querySelector("#analogger")||document.body,k=document.createElement("div");k.innerHTML=N,_.appendChild(k.firstElementChild)}catch{}},ye=new WeakSet,ut=function(){try{this.setTargets(C),this.setLogLevels(E),this.setContexts(K)}catch(e){console.error({lid:4321},e.message)}return!1},T(R,X,[]),y(R,"Console",null),y(R,"ALIGN",{LEFT:"LEFT",RIGHT:"RIGHT"}),y(R,"ENVIRONMENT_TYPE",{BROWSER:"BROWSER",NODE:"NODE",OTHER:"OTHER"}),y(R,"instanceCount",0),y(R,"pluginTable",{}),y(R,"lidTable",{}),y(R,"lidTableOn",!1);var ft=R,ln=ft,cn=R.generateMainInstance();var un=R;export{un as AnaLogger,K as DEFAULT_LOG_CONTEXTS,E as DEFAULT_LOG_LEVELS,C as DEFAULT_LOG_TARGETS,cn as anaLogger,ln as default};
52
52