@nsshunt/stsui 1.9.20 → 1.9.22

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/dist/stsui.mjs ADDED
@@ -0,0 +1,1087 @@
1
+ var he = Object.defineProperty;
2
+ var de = (r, e, t) => e in r ? he(r, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : r[e] = t;
3
+ var d = (r, e, t) => (de(r, typeof e != "symbol" ? e + "" : e, t), t), J = (r, e, t) => {
4
+ if (!e.has(r))
5
+ throw TypeError("Cannot " + t);
6
+ };
7
+ var p = (r, e, t) => (J(r, e, "read from private field"), t ? t.call(r) : e.get(r)), _ = (r, e, t) => {
8
+ if (e.has(r))
9
+ throw TypeError("Cannot add the same private member more than once");
10
+ e instanceof WeakSet ? e.add(r) : e.set(r, t);
11
+ }, O = (r, e, t, i) => (J(r, e, "write to private field"), i ? i.call(r, t) : e.set(r, t), t);
12
+ var S = (r, e, t) => (J(r, e, "access private method"), t);
13
+ import E from "blessed";
14
+ const le = {}, fe = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
15
+ __proto__: null,
16
+ default: le
17
+ }, Symbol.toStringTag, { value: "Module" }));
18
+ function pe(r) {
19
+ if (r.__esModule)
20
+ return r;
21
+ var e = r.default;
22
+ if (typeof e == "function") {
23
+ var t = function i() {
24
+ if (this instanceof i) {
25
+ var n = [null];
26
+ n.push.apply(n, arguments);
27
+ var s = Function.bind.apply(e, n);
28
+ return new s();
29
+ }
30
+ return e.apply(this, arguments);
31
+ };
32
+ t.prototype = e.prototype;
33
+ } else
34
+ t = {};
35
+ return Object.defineProperty(t, "__esModule", { value: !0 }), Object.keys(r).forEach(function(i) {
36
+ var n = Object.getOwnPropertyDescriptor(r, i);
37
+ Object.defineProperty(t, i, n.get ? n : {
38
+ enumerable: !0,
39
+ get: function() {
40
+ return r[i];
41
+ }
42
+ });
43
+ }), t;
44
+ }
45
+ var te = {}, ge = {
46
+ get exports() {
47
+ return te;
48
+ },
49
+ set exports(r) {
50
+ te = r;
51
+ }
52
+ }, A = {}, be = {
53
+ get exports() {
54
+ return A;
55
+ },
56
+ set exports(r) {
57
+ A = r;
58
+ }
59
+ };
60
+ const ce = /* @__PURE__ */ pe(fe);
61
+ var X = {}, me = {
62
+ get exports() {
63
+ return X;
64
+ },
65
+ set exports(r) {
66
+ X = r;
67
+ }
68
+ };
69
+ (function(r) {
70
+ var e = {};
71
+ r.exports = e;
72
+ var t = {
73
+ reset: [0, 0],
74
+ bold: [1, 22],
75
+ dim: [2, 22],
76
+ italic: [3, 23],
77
+ underline: [4, 24],
78
+ inverse: [7, 27],
79
+ hidden: [8, 28],
80
+ strikethrough: [9, 29],
81
+ black: [30, 39],
82
+ red: [31, 39],
83
+ green: [32, 39],
84
+ yellow: [33, 39],
85
+ blue: [34, 39],
86
+ magenta: [35, 39],
87
+ cyan: [36, 39],
88
+ white: [37, 39],
89
+ gray: [90, 39],
90
+ grey: [90, 39],
91
+ brightRed: [91, 39],
92
+ brightGreen: [92, 39],
93
+ brightYellow: [93, 39],
94
+ brightBlue: [94, 39],
95
+ brightMagenta: [95, 39],
96
+ brightCyan: [96, 39],
97
+ brightWhite: [97, 39],
98
+ bgBlack: [40, 49],
99
+ bgRed: [41, 49],
100
+ bgGreen: [42, 49],
101
+ bgYellow: [43, 49],
102
+ bgBlue: [44, 49],
103
+ bgMagenta: [45, 49],
104
+ bgCyan: [46, 49],
105
+ bgWhite: [47, 49],
106
+ bgGray: [100, 49],
107
+ bgGrey: [100, 49],
108
+ bgBrightRed: [101, 49],
109
+ bgBrightGreen: [102, 49],
110
+ bgBrightYellow: [103, 49],
111
+ bgBrightBlue: [104, 49],
112
+ bgBrightMagenta: [105, 49],
113
+ bgBrightCyan: [106, 49],
114
+ bgBrightWhite: [107, 49],
115
+ // legacy styles for colors pre v1.0.0
116
+ blackBG: [40, 49],
117
+ redBG: [41, 49],
118
+ greenBG: [42, 49],
119
+ yellowBG: [43, 49],
120
+ blueBG: [44, 49],
121
+ magentaBG: [45, 49],
122
+ cyanBG: [46, 49],
123
+ whiteBG: [47, 49]
124
+ };
125
+ Object.keys(t).forEach(function(i) {
126
+ var n = t[i], s = e[i] = [];
127
+ s.open = "\x1B[" + n[0] + "m", s.close = "\x1B[" + n[1] + "m";
128
+ });
129
+ })(me);
130
+ var ye = function(r, e) {
131
+ e = e || process.argv;
132
+ var t = e.indexOf("--"), i = /^-{1,2}/.test(r) ? "" : "--", n = e.indexOf(i + r);
133
+ return n !== -1 && (t === -1 ? !0 : n < t);
134
+ }, ve = ce, C = ye, x = process.env, j = void 0;
135
+ C("no-color") || C("no-colors") || C("color=false") ? j = !1 : (C("color") || C("colors") || C("color=true") || C("color=always")) && (j = !0);
136
+ "FORCE_COLOR" in x && (j = x.FORCE_COLOR.length === 0 || parseInt(x.FORCE_COLOR, 10) !== 0);
137
+ function we(r) {
138
+ return r === 0 ? !1 : {
139
+ level: r,
140
+ hasBasic: !0,
141
+ has256: r >= 2,
142
+ has16m: r >= 3
143
+ };
144
+ }
145
+ function xe(r) {
146
+ if (j === !1)
147
+ return 0;
148
+ if (C("color=16m") || C("color=full") || C("color=truecolor"))
149
+ return 3;
150
+ if (C("color=256"))
151
+ return 2;
152
+ if (r && !r.isTTY && j !== !0)
153
+ return 0;
154
+ var e = j ? 1 : 0;
155
+ if (process.platform === "win32") {
156
+ var t = ve.release().split(".");
157
+ return Number(process.versions.node.split(".")[0]) >= 8 && Number(t[0]) >= 10 && Number(t[2]) >= 10586 ? Number(t[2]) >= 14931 ? 3 : 2 : 1;
158
+ }
159
+ if ("CI" in x)
160
+ return ["TRAVIS", "CIRCLECI", "APPVEYOR", "GITLAB_CI"].some(function(n) {
161
+ return n in x;
162
+ }) || x.CI_NAME === "codeship" ? 1 : e;
163
+ if ("TEAMCITY_VERSION" in x)
164
+ return /^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(x.TEAMCITY_VERSION) ? 1 : 0;
165
+ if ("TERM_PROGRAM" in x) {
166
+ var i = parseInt((x.TERM_PROGRAM_VERSION || "").split(".")[0], 10);
167
+ switch (x.TERM_PROGRAM) {
168
+ case "iTerm.app":
169
+ return i >= 3 ? 3 : 2;
170
+ case "Hyper":
171
+ return 3;
172
+ case "Apple_Terminal":
173
+ return 2;
174
+ }
175
+ }
176
+ return /-256(color)?$/i.test(x.TERM) ? 2 : /^screen|^xterm|^vt100|^rxvt|color|ansi|cygwin|linux/i.test(x.TERM) || "COLORTERM" in x ? 1 : (x.TERM === "dumb", e);
177
+ }
178
+ function Q(r) {
179
+ var e = xe(r);
180
+ return we(e);
181
+ }
182
+ var Ce = {
183
+ supportsColor: Q,
184
+ stdout: Q(process.stdout),
185
+ stderr: Q(process.stderr)
186
+ }, N = {}, Re = {
187
+ get exports() {
188
+ return N;
189
+ },
190
+ set exports(r) {
191
+ N = r;
192
+ }
193
+ }, re;
194
+ function _e() {
195
+ return re || (re = 1, function(r) {
196
+ r.exports = function(t, i) {
197
+ var n = "";
198
+ t = t || "Run the trap, drop the bass", t = t.split("");
199
+ var s = {
200
+ a: ["@", "Ą", "Ⱥ", "Ʌ", "Δ", "Λ", "Д"],
201
+ b: ["ß", "Ɓ", "Ƀ", "ɮ", "β", "฿"],
202
+ c: ["©", "Ȼ", "Ͼ"],
203
+ d: ["Ð", "Ɗ", "Ԁ", "ԁ", "Ԃ", "ԃ"],
204
+ e: [
205
+ "Ë",
206
+ "ĕ",
207
+ "Ǝ",
208
+ "ɘ",
209
+ "Σ",
210
+ "ξ",
211
+ "Ҽ",
212
+ "੬"
213
+ ],
214
+ f: ["Ӻ"],
215
+ g: ["ɢ"],
216
+ h: ["Ħ", "ƕ", "Ң", "Һ", "Ӈ", "Ԋ"],
217
+ i: ["༏"],
218
+ j: ["Ĵ"],
219
+ k: ["ĸ", "Ҡ", "Ӄ", "Ԟ"],
220
+ l: ["Ĺ"],
221
+ m: ["ʍ", "Ӎ", "ӎ", "Ԡ", "ԡ", "൩"],
222
+ n: ["Ñ", "ŋ", "Ɲ", "Ͷ", "Π", "Ҋ"],
223
+ o: [
224
+ "Ø",
225
+ "õ",
226
+ "ø",
227
+ "Ǿ",
228
+ "ʘ",
229
+ "Ѻ",
230
+ "ם",
231
+ "۝",
232
+ "๏"
233
+ ],
234
+ p: ["Ƿ", "Ҏ"],
235
+ q: ["্"],
236
+ r: ["®", "Ʀ", "Ȑ", "Ɍ", "ʀ", "Я"],
237
+ s: ["§", "Ϟ", "ϟ", "Ϩ"],
238
+ t: ["Ł", "Ŧ", "ͳ"],
239
+ u: ["Ʊ", "Ս"],
240
+ v: ["ט"],
241
+ w: ["Ш", "Ѡ", "Ѽ", "൰"],
242
+ x: ["Ҳ", "Ӿ", "Ӽ", "ӽ"],
243
+ y: ["¥", "Ұ", "Ӌ"],
244
+ z: ["Ƶ", "ɀ"]
245
+ };
246
+ return t.forEach(function(l) {
247
+ l = l.toLowerCase();
248
+ var c = s[l] || [" "], w = Math.floor(Math.random() * c.length);
249
+ typeof s[l] < "u" ? n += s[l][w] : n += l;
250
+ }), n;
251
+ };
252
+ }(Re)), N;
253
+ }
254
+ var $ = {}, Se = {
255
+ get exports() {
256
+ return $;
257
+ },
258
+ set exports(r) {
259
+ $ = r;
260
+ }
261
+ }, ie;
262
+ function Oe() {
263
+ return ie || (ie = 1, function(r) {
264
+ r.exports = function(t, i) {
265
+ t = t || " he is here ";
266
+ var n = {
267
+ up: [
268
+ "̍",
269
+ "̎",
270
+ "̄",
271
+ "̅",
272
+ "̿",
273
+ "̑",
274
+ "̆",
275
+ "̐",
276
+ "͒",
277
+ "͗",
278
+ "͑",
279
+ "̇",
280
+ "̈",
281
+ "̊",
282
+ "͂",
283
+ "̓",
284
+ "̈",
285
+ "͊",
286
+ "͋",
287
+ "͌",
288
+ "̃",
289
+ "̂",
290
+ "̌",
291
+ "͐",
292
+ "̀",
293
+ "́",
294
+ "̋",
295
+ "̏",
296
+ "̒",
297
+ "̓",
298
+ "̔",
299
+ "̽",
300
+ "̉",
301
+ "ͣ",
302
+ "ͤ",
303
+ "ͥ",
304
+ "ͦ",
305
+ "ͧ",
306
+ "ͨ",
307
+ "ͩ",
308
+ "ͪ",
309
+ "ͫ",
310
+ "ͬ",
311
+ "ͭ",
312
+ "ͮ",
313
+ "ͯ",
314
+ "̾",
315
+ "͛",
316
+ "͆",
317
+ "̚"
318
+ ],
319
+ down: [
320
+ "̖",
321
+ "̗",
322
+ "̘",
323
+ "̙",
324
+ "̜",
325
+ "̝",
326
+ "̞",
327
+ "̟",
328
+ "̠",
329
+ "̤",
330
+ "̥",
331
+ "̦",
332
+ "̩",
333
+ "̪",
334
+ "̫",
335
+ "̬",
336
+ "̭",
337
+ "̮",
338
+ "̯",
339
+ "̰",
340
+ "̱",
341
+ "̲",
342
+ "̳",
343
+ "̹",
344
+ "̺",
345
+ "̻",
346
+ "̼",
347
+ "ͅ",
348
+ "͇",
349
+ "͈",
350
+ "͉",
351
+ "͍",
352
+ "͎",
353
+ "͓",
354
+ "͔",
355
+ "͕",
356
+ "͖",
357
+ "͙",
358
+ "͚",
359
+ "̣"
360
+ ],
361
+ mid: [
362
+ "̕",
363
+ "̛",
364
+ "̀",
365
+ "́",
366
+ "͘",
367
+ "̡",
368
+ "̢",
369
+ "̧",
370
+ "̨",
371
+ "̴",
372
+ "̵",
373
+ "̶",
374
+ "͜",
375
+ "͝",
376
+ "͞",
377
+ "͟",
378
+ "͠",
379
+ "͢",
380
+ "̸",
381
+ "̷",
382
+ "͡",
383
+ " ҉"
384
+ ]
385
+ }, s = [].concat(n.up, n.down, n.mid);
386
+ function l(u) {
387
+ var h = Math.floor(Math.random() * u);
388
+ return h;
389
+ }
390
+ function c(u) {
391
+ var h = !1;
392
+ return s.filter(function(g) {
393
+ h = g === u;
394
+ }), h;
395
+ }
396
+ function w(u, h) {
397
+ var g = "", b, T;
398
+ h = h || {}, h.up = typeof h.up < "u" ? h.up : !0, h.mid = typeof h.mid < "u" ? h.mid : !0, h.down = typeof h.down < "u" ? h.down : !0, h.size = typeof h.size < "u" ? h.size : "maxi", u = u.split("");
399
+ for (T in u)
400
+ if (!c(T)) {
401
+ switch (g = g + u[T], b = { up: 0, down: 0, mid: 0 }, h.size) {
402
+ case "mini":
403
+ b.up = l(8), b.mid = l(2), b.down = l(8);
404
+ break;
405
+ case "maxi":
406
+ b.up = l(16) + 3, b.mid = l(4) + 1, b.down = l(64) + 3;
407
+ break;
408
+ default:
409
+ b.up = l(8) + 1, b.mid = l(6) / 2, b.down = l(8) + 1;
410
+ break;
411
+ }
412
+ var P = ["up", "mid", "down"];
413
+ for (var o in P)
414
+ for (var a = P[o], f = 0; f <= b[a]; f++)
415
+ h[a] && (g = g + n[a][l(n[a].length)]);
416
+ }
417
+ return g;
418
+ }
419
+ return w(t, i);
420
+ };
421
+ }(Se)), $;
422
+ }
423
+ var V = {}, ke = {
424
+ get exports() {
425
+ return V;
426
+ },
427
+ set exports(r) {
428
+ V = r;
429
+ }
430
+ }, ne;
431
+ function Ie() {
432
+ return ne || (ne = 1, function(r) {
433
+ r.exports = function(e) {
434
+ return function(t, i, n) {
435
+ if (t === " ")
436
+ return t;
437
+ switch (i % 3) {
438
+ case 0:
439
+ return e.red(t);
440
+ case 1:
441
+ return e.white(t);
442
+ case 2:
443
+ return e.blue(t);
444
+ }
445
+ };
446
+ };
447
+ }(ke)), V;
448
+ }
449
+ var F = {}, Ee = {
450
+ get exports() {
451
+ return F;
452
+ },
453
+ set exports(r) {
454
+ F = r;
455
+ }
456
+ }, se;
457
+ function Te() {
458
+ return se || (se = 1, function(r) {
459
+ r.exports = function(e) {
460
+ return function(t, i, n) {
461
+ return i % 2 === 0 ? t : e.inverse(t);
462
+ };
463
+ };
464
+ }(Ee)), F;
465
+ }
466
+ var W = {}, Be = {
467
+ get exports() {
468
+ return W;
469
+ },
470
+ set exports(r) {
471
+ W = r;
472
+ }
473
+ }, oe;
474
+ function Pe() {
475
+ return oe || (oe = 1, function(r) {
476
+ r.exports = function(e) {
477
+ var t = ["red", "yellow", "green", "blue", "magenta"];
478
+ return function(i, n, s) {
479
+ return i === " " ? i : e[t[n++ % t.length]](i);
480
+ };
481
+ };
482
+ }(Be)), W;
483
+ }
484
+ var Y = {}, Ue = {
485
+ get exports() {
486
+ return Y;
487
+ },
488
+ set exports(r) {
489
+ Y = r;
490
+ }
491
+ }, ue;
492
+ function je() {
493
+ return ue || (ue = 1, function(r) {
494
+ r.exports = function(e) {
495
+ var t = [
496
+ "underline",
497
+ "inverse",
498
+ "grey",
499
+ "yellow",
500
+ "red",
501
+ "green",
502
+ "blue",
503
+ "white",
504
+ "cyan",
505
+ "magenta",
506
+ "brightYellow",
507
+ "brightRed",
508
+ "brightGreen",
509
+ "brightBlue",
510
+ "brightWhite",
511
+ "brightCyan",
512
+ "brightMagenta"
513
+ ];
514
+ return function(i, n, s) {
515
+ return i === " " ? i : e[t[Math.round(Math.random() * (t.length - 2))]](i);
516
+ };
517
+ };
518
+ }(Ue)), Y;
519
+ }
520
+ (function(r) {
521
+ var e = {};
522
+ r.exports = e, e.themes = {};
523
+ var t = ce, i = e.styles = X, n = Object.defineProperties, s = new RegExp(/[\r\n]+/g);
524
+ e.supportsColor = Ce.supportsColor, typeof e.enabled > "u" && (e.enabled = e.supportsColor() !== !1), e.enable = function() {
525
+ e.enabled = !0;
526
+ }, e.disable = function() {
527
+ e.enabled = !1;
528
+ }, e.stripColors = e.strip = function(o) {
529
+ return ("" + o).replace(/\x1B\[\d+m/g, "");
530
+ }, e.stylize = function(a, f) {
531
+ if (!e.enabled)
532
+ return a + "";
533
+ var m = i[f];
534
+ return !m && f in e ? e[f](a) : m.open + a + m.close;
535
+ };
536
+ var l = /[|\\{}()[\]^$+*?.]/g, c = function(o) {
537
+ if (typeof o != "string")
538
+ throw new TypeError("Expected a string");
539
+ return o.replace(l, "\\$&");
540
+ };
541
+ function w(o) {
542
+ var a = function f() {
543
+ return g.apply(f, arguments);
544
+ };
545
+ return a._styles = o, a.__proto__ = h, a;
546
+ }
547
+ var u = function() {
548
+ var o = {};
549
+ return i.grey = i.gray, Object.keys(i).forEach(function(a) {
550
+ i[a].closeRe = new RegExp(c(i[a].close), "g"), o[a] = {
551
+ get: function() {
552
+ return w(this._styles.concat(a));
553
+ }
554
+ };
555
+ }), o;
556
+ }(), h = n(function() {
557
+ }, u);
558
+ function g() {
559
+ var o = Array.prototype.slice.call(arguments), a = o.map(function(U) {
560
+ return U != null && U.constructor === String ? U : t.inspect(U);
561
+ }).join(" ");
562
+ if (!e.enabled || !a)
563
+ return a;
564
+ for (var f = a.indexOf(`
565
+ `) != -1, m = this._styles, R = m.length; R--; ) {
566
+ var I = i[m[R]];
567
+ a = I.open + a.replace(I.closeRe, I.open) + I.close, f && (a = a.replace(s, function(U) {
568
+ return I.close + U + I.open;
569
+ }));
570
+ }
571
+ return a;
572
+ }
573
+ e.setTheme = function(o) {
574
+ if (typeof o == "string") {
575
+ console.log("colors.setTheme now only accepts an object, not a string. If you are trying to set a theme from a file, it is now your (the caller's) responsibility to require the file. The old syntax looked like colors.setTheme(__dirname + '/../themes/generic-logging.js'); The new syntax looks like colors.setTheme(require(__dirname + '/../themes/generic-logging.js'));");
576
+ return;
577
+ }
578
+ for (var a in o)
579
+ (function(f) {
580
+ e[f] = function(m) {
581
+ if (typeof o[f] == "object") {
582
+ var R = m;
583
+ for (var I in o[f])
584
+ R = e[o[f][I]](R);
585
+ return R;
586
+ }
587
+ return e[o[f]](m);
588
+ };
589
+ })(a);
590
+ };
591
+ function b() {
592
+ var o = {};
593
+ return Object.keys(u).forEach(function(a) {
594
+ o[a] = {
595
+ get: function() {
596
+ return w([a]);
597
+ }
598
+ };
599
+ }), o;
600
+ }
601
+ var T = function(a, f) {
602
+ var m = f.split("");
603
+ return m = m.map(a), m.join("");
604
+ };
605
+ e.trap = _e(), e.zalgo = Oe(), e.maps = {}, e.maps.america = Ie()(e), e.maps.zebra = Te()(e), e.maps.rainbow = Pe()(e), e.maps.random = je()(e);
606
+ for (var P in e.maps)
607
+ (function(o) {
608
+ e[o] = function(a) {
609
+ return T(e.maps[o], a);
610
+ };
611
+ })(P);
612
+ n(e, b());
613
+ })(be);
614
+ var ee = {}, Me = {
615
+ get exports() {
616
+ return ee;
617
+ },
618
+ set exports(r) {
619
+ ee = r;
620
+ }
621
+ };
622
+ (function(r) {
623
+ var e = A;
624
+ r.exports = function() {
625
+ var t = function(s, l) {
626
+ String.prototype.__defineGetter__(s, l);
627
+ };
628
+ t("strip", function() {
629
+ return e.strip(this);
630
+ }), t("stripColors", function() {
631
+ return e.strip(this);
632
+ }), t("trap", function() {
633
+ return e.trap(this);
634
+ }), t("zalgo", function() {
635
+ return e.zalgo(this);
636
+ }), t("zebra", function() {
637
+ return e.zebra(this);
638
+ }), t("rainbow", function() {
639
+ return e.rainbow(this);
640
+ }), t("random", function() {
641
+ return e.random(this);
642
+ }), t("america", function() {
643
+ return e.america(this);
644
+ });
645
+ var i = Object.keys(e.styles);
646
+ i.forEach(function(s) {
647
+ t(s, function() {
648
+ return e.stylize(this, s);
649
+ });
650
+ });
651
+ function n(s) {
652
+ var l = [
653
+ "__defineGetter__",
654
+ "__defineSetter__",
655
+ "__lookupGetter__",
656
+ "__lookupSetter__",
657
+ "charAt",
658
+ "constructor",
659
+ "hasOwnProperty",
660
+ "isPrototypeOf",
661
+ "propertyIsEnumerable",
662
+ "toLocaleString",
663
+ "toString",
664
+ "valueOf",
665
+ "charCodeAt",
666
+ "indexOf",
667
+ "lastIndexOf",
668
+ "length",
669
+ "localeCompare",
670
+ "match",
671
+ "repeat",
672
+ "replace",
673
+ "search",
674
+ "slice",
675
+ "split",
676
+ "substring",
677
+ "toLocaleLowerCase",
678
+ "toLocaleUpperCase",
679
+ "toLowerCase",
680
+ "toUpperCase",
681
+ "trim",
682
+ "trimLeft",
683
+ "trimRight"
684
+ ];
685
+ Object.keys(s).forEach(function(c) {
686
+ if (l.indexOf(c) !== -1)
687
+ console.log("warn: ".red + ("String.prototype" + c).magenta + " is probably something you don't want to override. Ignoring style name");
688
+ else if (typeof s[c] == "string")
689
+ e[c] = e[s[c]], t(c, function() {
690
+ return e[c](this);
691
+ });
692
+ else {
693
+ var w = function(u) {
694
+ for (var h = u || this, g = 0; g < s[c].length; g++)
695
+ h = e[s[c][g]](h);
696
+ return h;
697
+ };
698
+ t(c, w), e[c] = function(u) {
699
+ return w(u);
700
+ };
701
+ }
702
+ });
703
+ }
704
+ e.setTheme = function(s) {
705
+ if (typeof s == "string") {
706
+ console.log("colors.setTheme now only accepts an object, not a string. If you are trying to set a theme from a file, it is now your (the caller's) responsibility to require the file. The old syntax looked like colors.setTheme(__dirname + '/../themes/generic-logging.js'); The new syntax looks like colors.setTheme(require(__dirname + '/../themes/generic-logging.js'));");
707
+ return;
708
+ } else
709
+ n(s);
710
+ };
711
+ };
712
+ })(Me);
713
+ (function(r) {
714
+ var e = A;
715
+ r.exports = e, ee();
716
+ })(ge);
717
+ let L;
718
+ const He = new Uint8Array(16);
719
+ function ze() {
720
+ if (!L && (L = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !L))
721
+ throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
722
+ return L(He);
723
+ }
724
+ const y = [];
725
+ for (let r = 0; r < 256; ++r)
726
+ y.push((r + 256).toString(16).slice(1));
727
+ function Ge(r, e = 0) {
728
+ return (y[r[e + 0]] + y[r[e + 1]] + y[r[e + 2]] + y[r[e + 3]] + "-" + y[r[e + 4]] + y[r[e + 5]] + "-" + y[r[e + 6]] + y[r[e + 7]] + "-" + y[r[e + 8]] + y[r[e + 9]] + "-" + y[r[e + 10]] + y[r[e + 11]] + y[r[e + 12]] + y[r[e + 13]] + y[r[e + 14]] + y[r[e + 15]]).toLowerCase();
729
+ }
730
+ const qe = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), ae = {
731
+ randomUUID: qe
732
+ };
733
+ function Le(r, e, t) {
734
+ if (ae.randomUUID && !e && !r)
735
+ return ae.randomUUID();
736
+ r = r || {};
737
+ const i = r.random || (r.rng || ze)();
738
+ if (i[6] = i[6] & 15 | 64, i[8] = i[8] & 63 | 128, e) {
739
+ t = t || 0;
740
+ for (let n = 0; n < 16; ++n)
741
+ e[t + n] = i[n];
742
+ return e;
743
+ }
744
+ return Ge(i);
745
+ }
746
+ class De {
747
+ // options := { screen: <blessed screen>, top: <bool>, menuitems: [ { text: <string>, key: <string>, cb: <call back func> } ] }
748
+ constructor(e, t) {
749
+ d(this, "listb", null);
750
+ const i = {
751
+ parent: e,
752
+ left: 0,
753
+ right: 0,
754
+ height: 1,
755
+ width: "shrink",
756
+ mouse: !0,
757
+ keys: !0,
758
+ autoCommandKeys: !0,
759
+ scrollable: !0,
760
+ style: {
761
+ fg: "yellow",
762
+ bg: "blue",
763
+ item: {
764
+ hover: {
765
+ fg: "white",
766
+ bg: "green"
767
+ }
768
+ },
769
+ selected: {
770
+ fg: "black",
771
+ bg: "yellow"
772
+ }
773
+ }
774
+ };
775
+ t.top === !0 ? i.top = 0 : i.bottom = 0, i.commands = {}, t.menuitems.forEach((n) => {
776
+ i.commands && (i.commands[n.text] = {
777
+ keys: [n.key],
778
+ callback: n.cb
779
+ });
780
+ }), this.listb = E.listbar(i);
781
+ }
782
+ get listbar() {
783
+ return this.listb;
784
+ }
785
+ }
786
+ var v, M, H, z, q, Z, K, G, D, k, B;
787
+ class $e extends le {
788
+ /**
789
+ *
790
+ * @param {*} data The screen layout data. Schema: { title: <str>,
791
+ * grid: { rows: <int>, cols: <int> },
792
+ * panels: [ { id: <str>, pos: { row: <int>, col: <int>, rowSpan: <int>, colSpan: <int> },
793
+ * template: <handlebars func>, widgets: { [ { <prop_name>: <blessed widget> } ] } } ] }
794
+ */
795
+ constructor(t, i = null) {
796
+ super();
797
+ /**
798
+ *
799
+ * Setup all panels
800
+ */
801
+ _(this, G);
802
+ _(this, k);
803
+ d(this, "uiBoxes", {});
804
+ // { box: <<blessed box>>, boxHeader: <<blessed box>> }
805
+ d(this, "screen", null);
806
+ _(this, v, 0);
807
+ // panel index with the complete model data.
808
+ _(this, M, null);
809
+ d(this, "screenHeaderText", "...");
810
+ d(this, "minRows", 1);
811
+ d(this, "minCols", 1);
812
+ d(this, "minWidth", 40);
813
+ d(this, "minHeight", 7);
814
+ _(this, H, null);
815
+ d(this, "sortInfo", null);
816
+ // Current sort mode UI box control
817
+ d(this, "screenHeader", null);
818
+ d(this, "uidata");
819
+ /**
820
+ *
821
+ * @param {number} position The index (0 based) for the panel item to be calculated
822
+ * @returns object with top, left, width and height correctly set
823
+ */
824
+ _(this, z, (t) => {
825
+ if (!this.screen || !t.pos)
826
+ return null;
827
+ let i = this.screen.height;
828
+ this.uidata.menu !== null && (i -= this.uidata.menu.length);
829
+ const n = this.screen.width, s = this.uidata.grid.rows, l = this.uidata.grid.cols, c = t.pos, w = Math.floor(n / l), u = Math.floor(i / s);
830
+ let h = 0;
831
+ if (this.uidata.menu !== null) {
832
+ for (const [, b] of Object.entries(this.uidata.menu))
833
+ if (b.top === !0) {
834
+ h = 1;
835
+ break;
836
+ }
837
+ }
838
+ const g = {
839
+ top: c.row * u + h,
840
+ left: c.col * w,
841
+ width: w * c.colSpan,
842
+ height: u * c.rowSpan
843
+ };
844
+ return c.col + c.colSpan === l && (g.width = n - c.col * w), c.row + c.rowSpan === s && (g.height = i - c.row * u), g;
845
+ });
846
+ _(this, q, (t, i) => {
847
+ const n = p(this, z).call(this, t);
848
+ if (n && (i.box.top = n.top, i.box.left = n.left, i.box.width = n.width, i.box.height = n.height, i.boxHeader.top = n.top, i.boxHeader.left = n.left + 2, typeof t.widgets < "u" && t.widgets !== null)) {
849
+ for (const [, s] of Object.entries(t.widgets))
850
+ if (s.widget === "log") {
851
+ const l = i.box.get(s.widget);
852
+ l.position.top >= i.box.height - 4 ? l.position.top = i.box.height - 4 : s.options.top && (l.position.top = s.options.top);
853
+ }
854
+ }
855
+ });
856
+ /**
857
+ * ReSize the grid layout
858
+ */
859
+ _(this, Z, () => {
860
+ for (const [, t] of Object.entries(this.uiBoxes))
861
+ p(this, q).call(this, t.box.get("panel"), t);
862
+ });
863
+ _(this, K, (t, i, n, s) => {
864
+ t.pos = { row: i, col: n, rowSpan: 1, colSpan: 1 }, p(this, q).call(this, t, s), s.boxHeader.setContent(t.panelHeader);
865
+ });
866
+ // https://www.npmjs.com/package/blessed
867
+ // data:= { title: <str>,
868
+ // grid: { rows: <int>, cols: <int> },
869
+ // menu: [ { top: <bool>, menuitems: [ { text: <string>, key: <string>, cb: <func> } ] } ]
870
+ // panels: [ { id: <str>, pos: { row: <int>, col: <int>, rowSpan: <int>, colSpan: <int> }, template: <str> } ] }
871
+ /**
872
+ *
873
+ * @param {*} data UI Data
874
+ */
875
+ d(this, "SetupUI", () => {
876
+ if (this.DestroyUI(), this.screen === null && (this.screen = E.screen({
877
+ smartCSR: !0
878
+ })), !this.screen)
879
+ return;
880
+ const t = this.uidata;
881
+ if (this.screen.title = t.title, this.screen.on("resize", () => {
882
+ p(this, Z).call(this), this.Render();
883
+ }), t.menu !== null)
884
+ for (let i = 0; i < t.menu.length; i++)
885
+ new De(this.screen, t.menu[i]);
886
+ this.screen.key(["C-c"], () => {
887
+ this.DestroyUI(), this.emit("exit");
888
+ }), this.screen.key(["escape"], () => {
889
+ this.emit("escape");
890
+ }), S(this, G, D).call(this), O(this, H, E.box({
891
+ parent: this.screen,
892
+ bottom: 0,
893
+ right: 0,
894
+ width: "shrink",
895
+ height: 1,
896
+ style: {
897
+ bg: "gray",
898
+ fg: "white"
899
+ },
900
+ keys: !1,
901
+ // Do not allow default key handling for this box
902
+ mouse: !1,
903
+ content: "",
904
+ tags: !0
905
+ // Allow style in-line tags such as bolt, italics, etc.
906
+ })), this.sortInfo = E.box({
907
+ parent: this.screen,
908
+ top: 0,
909
+ right: 0,
910
+ width: "shrink",
911
+ height: 1,
912
+ style: {
913
+ bg: "gray",
914
+ fg: "white"
915
+ },
916
+ keys: !1,
917
+ // Do not allow default key handling for this box
918
+ mouse: !1,
919
+ content: "",
920
+ tags: !0
921
+ // Allow style in-line tags such as bolt, italics, etc.
922
+ }), this.screenHeader = E.box({
923
+ parent: this.screen,
924
+ top: 0,
925
+ left: "center",
926
+ width: "shrink",
927
+ height: 1,
928
+ style: {
929
+ bg: "gray",
930
+ fg: "white"
931
+ },
932
+ keys: !1,
933
+ // Do not allow default key handling for this box
934
+ mouse: !1,
935
+ content: "[ ... ]",
936
+ tags: !0
937
+ // Allow style in-line tags such as bolt, italics, etc.
938
+ }), this.UpdateCursorInfo(), this.UpdateSortInfo("Default"), this.UpdateScreenHeader(this.screenHeaderText), this.Render();
939
+ });
940
+ d(this, "UpdateCursorInfo", () => {
941
+ p(this, H) && p(this, H).setContent(`Cursor: ${p(this, v)} / ${this.TotalPanelNumber}`);
942
+ });
943
+ d(this, "UpdateSortInfo", (t) => {
944
+ this.sortInfo && this.sortInfo.setContent(`Sort: ${t}`);
945
+ });
946
+ d(this, "UpdateScreenHeader", (t) => {
947
+ this.screenHeaderText = t, this.screenHeader && this.screenHeader.setContent(`[ ${t} ]`);
948
+ });
949
+ d(this, "IncRows", () => {
950
+ this.screen && this.screen.height / (this.uidata.grid.rows + 1) > this.minHeight && (this.uidata.grid.rows++, this.CheckCursor(), S(this, k, B).call(this));
951
+ });
952
+ d(this, "DecRows", () => {
953
+ this.uidata.grid.rows > this.minRows && (this.uidata.grid.rows--, this.CheckCursor(), S(this, k, B).call(this));
954
+ });
955
+ d(this, "IncCols", () => {
956
+ this.screen && this.screen.width / (this.uidata.grid.cols + 1) > this.minWidth && (this.uidata.grid.cols++, this.CheckCursor(), S(this, k, B).call(this));
957
+ });
958
+ d(this, "DecCols", () => {
959
+ this.uidata.grid.cols > this.minCols && (this.uidata.grid.cols--, this.CheckCursor(), S(this, k, B).call(this));
960
+ });
961
+ d(this, "CheckCursor", () => {
962
+ p(this, v) > this.TotalPanelNumber - this.ScreenCells && (O(this, v, this.TotalPanelNumber - this.ScreenCells), p(this, v) < 0 && O(this, v, 0)), this.UpdateCursorInfo();
963
+ });
964
+ d(this, "NextPage", () => {
965
+ const t = this.TotalPanelNumber - this.ScreenCells;
966
+ p(this, v) < t && (O(this, v, p(this, v) + this.ScreenCells), p(this, v) > t && O(this, v, t), S(this, k, B).call(this));
967
+ });
968
+ d(this, "PrevPage", () => {
969
+ p(this, v) > 0 && (O(this, v, p(this, v) - this.ScreenCells), p(this, v) < 0 && O(this, v, 0), S(this, k, B).call(this));
970
+ });
971
+ d(this, "Exit", () => {
972
+ this.DestroyUI(), this.emit("exit");
973
+ });
974
+ /**
975
+ *
976
+ */
977
+ d(this, "DestroyUI", () => {
978
+ this.screen !== null && (this.uiBoxes = {}, this.screen.destroy(), this.screen = null);
979
+ });
980
+ /**
981
+ * Render the screen.
982
+ */
983
+ d(this, "Render", () => {
984
+ this.screen && this.screen.render();
985
+ });
986
+ this.uidata = t, O(this, M, i), this.SetupUI();
987
+ }
988
+ get gridData() {
989
+ return this.uidata;
990
+ }
991
+ set gridData(t) {
992
+ this.uidata = t, S(this, G, D).call(this), this.UpdateCursorInfo(), this.Render();
993
+ }
994
+ get gridDataPanels() {
995
+ return this.uidata.panels;
996
+ }
997
+ set gridDataPanels(t) {
998
+ this.uidata.panels = t, S(this, G, D).call(this), this.UpdateCursorInfo(), this.Render();
999
+ }
1000
+ get rows() {
1001
+ return this.uidata.grid.rows;
1002
+ }
1003
+ get cols() {
1004
+ return this.uidata.grid.cols;
1005
+ }
1006
+ get ScreenCells() {
1007
+ return this.uidata.grid.cols * this.uidata.grid.rows;
1008
+ }
1009
+ get TotalPanelNumber() {
1010
+ return Object.keys(this.uidata.panels).length;
1011
+ }
1012
+ }
1013
+ v = new WeakMap(), M = new WeakMap(), H = new WeakMap(), z = new WeakMap(), q = new WeakMap(), Z = new WeakMap(), K = new WeakMap(), G = new WeakSet(), D = function() {
1014
+ if (!this.screen)
1015
+ return;
1016
+ const t = Object.keys(this.uidata.panels), i = Object.keys(this.uiBoxes);
1017
+ for (let s = 0; s < i.length; s++)
1018
+ if (typeof this.uidata.panels[i[s]] > "u") {
1019
+ let l = this.uiBoxes[i[s]];
1020
+ typeof l < "u" && (this.screen.remove(l.boxHeader), this.screen.remove(l.box), l = null, delete this.uiBoxes[i[s]]);
1021
+ }
1022
+ const n = {};
1023
+ for (let s = 0; s < this.uidata.grid.cols * this.uidata.grid.rows; s++) {
1024
+ const l = p(this, v) + s, c = s % this.uidata.grid.cols, w = Math.floor(s / this.uidata.grid.cols), u = this.uidata.panels[t[l]];
1025
+ if (typeof u < "u") {
1026
+ if (typeof this.uiBoxes[u.id] > "u") {
1027
+ if (u.pos = { row: w, col: c, rowSpan: 1, colSpan: 1 }, !p(this, z).call(this, u))
1028
+ return;
1029
+ const { top: g, left: b, width: T, height: P } = p(this, z).call(this, u), o = E.box({
1030
+ parent: this.screen,
1031
+ top: g,
1032
+ left: b,
1033
+ width: T,
1034
+ height: P,
1035
+ style: {
1036
+ bg: "#101010",
1037
+ fg: "white"
1038
+ },
1039
+ border: {
1040
+ type: "line"
1041
+ },
1042
+ keys: !1,
1043
+ // Do not allow default key handling for this box
1044
+ tags: !0
1045
+ // Allow style in-line tags such as bolt, italics, etc.
1046
+ }), a = E.box({
1047
+ parent: this.screen,
1048
+ top: g,
1049
+ left: b + 2,
1050
+ width: "shrink",
1051
+ height: 1,
1052
+ style: {
1053
+ bg: "gray",
1054
+ fg: "white"
1055
+ },
1056
+ keys: !1,
1057
+ // Do not allow default key handling for this box
1058
+ mouse: !1,
1059
+ content: u.panelHeader,
1060
+ tags: !0
1061
+ // Allow style in-line tags such as bolt, italics, etc.
1062
+ });
1063
+ if (this.uiBoxes[u.id] = { box: o, boxHeader: a }, a.setIndex(-1), o.on("click", () => {
1064
+ this.emit("click", o.get("panel"));
1065
+ }), typeof u.widgets < "u" && u.widgets !== null)
1066
+ for (const [, f] of Object.entries(u.widgets)) {
1067
+ const m = { ...f.options };
1068
+ m.top && m.top >= o.height - 3 && (m.top = o.height - 4);
1069
+ const R = E[f.widget].call(this, m);
1070
+ R.set("id", Le()), o.append(R), o.set(f.widget, R);
1071
+ }
1072
+ o.set("panel", u), this.uiBoxes[u.id].box = o, n[u.id] = !0;
1073
+ } else
1074
+ p(this, K).call(this, u, w, c, this.uiBoxes[u.id]), n[u.id] = !0;
1075
+ p(this, M) && p(this, M).call(this, this.uiBoxes[u.id].box, u);
1076
+ }
1077
+ }
1078
+ for (const [s] of Object.entries(this.uiBoxes))
1079
+ typeof n[s] > "u" ? (this.uiBoxes[s].box.hide(), this.uiBoxes[s].boxHeader.hide()) : (this.uiBoxes[s].box.show(), this.uiBoxes[s].boxHeader.show());
1080
+ }, k = new WeakSet(), B = function() {
1081
+ this.SetupUI();
1082
+ };
1083
+ export {
1084
+ De as MenuBar,
1085
+ $e as STSUIFrame
1086
+ };
1087
+ //# sourceMappingURL=stsui.mjs.map