appium-session-recorder 0.0.3 → 0.0.4

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/index.js CHANGED
@@ -19,122 +19,52 @@ var __toESM = (mod, isNodeMode, target) => {
19
19
  var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
20
20
  var __require = import.meta.require;
21
21
 
22
- // node_modules/picocolors/picocolors.js
23
- var require_picocolors = __commonJS((exports, module) => {
24
- var p = process || {};
25
- var argv = p.argv || [];
26
- var env = p.env || {};
27
- var isColorSupported = !(!!env.NO_COLOR || argv.includes("--no-color")) && (!!env.FORCE_COLOR || argv.includes("--color") || p.platform === "win32" || (p.stdout || {}).isTTY && env.TERM !== "dumb" || !!env.CI);
28
- var formatter = (open, close, replace = open) => (input) => {
29
- let string = "" + input, index = string.indexOf(close, open.length);
30
- return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close;
31
- };
32
- var replaceClose = (string, close, replace, index) => {
33
- let result = "", cursor = 0;
34
- do {
35
- result += string.substring(cursor, index) + replace;
36
- cursor = index + close.length;
37
- index = string.indexOf(close, cursor);
38
- } while (~index);
39
- return result + string.substring(cursor);
40
- };
41
- var createColors = (enabled = isColorSupported) => {
42
- let f = enabled ? formatter : () => String;
43
- return {
44
- isColorSupported: enabled,
45
- reset: f("\x1B[0m", "\x1B[0m"),
46
- bold: f("\x1B[1m", "\x1B[22m", "\x1B[22m\x1B[1m"),
47
- dim: f("\x1B[2m", "\x1B[22m", "\x1B[22m\x1B[2m"),
48
- italic: f("\x1B[3m", "\x1B[23m"),
49
- underline: f("\x1B[4m", "\x1B[24m"),
50
- inverse: f("\x1B[7m", "\x1B[27m"),
51
- hidden: f("\x1B[8m", "\x1B[28m"),
52
- strikethrough: f("\x1B[9m", "\x1B[29m"),
53
- black: f("\x1B[30m", "\x1B[39m"),
54
- red: f("\x1B[31m", "\x1B[39m"),
55
- green: f("\x1B[32m", "\x1B[39m"),
56
- yellow: f("\x1B[33m", "\x1B[39m"),
57
- blue: f("\x1B[34m", "\x1B[39m"),
58
- magenta: f("\x1B[35m", "\x1B[39m"),
59
- cyan: f("\x1B[36m", "\x1B[39m"),
60
- white: f("\x1B[37m", "\x1B[39m"),
61
- gray: f("\x1B[90m", "\x1B[39m"),
62
- bgBlack: f("\x1B[40m", "\x1B[49m"),
63
- bgRed: f("\x1B[41m", "\x1B[49m"),
64
- bgGreen: f("\x1B[42m", "\x1B[49m"),
65
- bgYellow: f("\x1B[43m", "\x1B[49m"),
66
- bgBlue: f("\x1B[44m", "\x1B[49m"),
67
- bgMagenta: f("\x1B[45m", "\x1B[49m"),
68
- bgCyan: f("\x1B[46m", "\x1B[49m"),
69
- bgWhite: f("\x1B[47m", "\x1B[49m"),
70
- blackBright: f("\x1B[90m", "\x1B[39m"),
71
- redBright: f("\x1B[91m", "\x1B[39m"),
72
- greenBright: f("\x1B[92m", "\x1B[39m"),
73
- yellowBright: f("\x1B[93m", "\x1B[39m"),
74
- blueBright: f("\x1B[94m", "\x1B[39m"),
75
- magentaBright: f("\x1B[95m", "\x1B[39m"),
76
- cyanBright: f("\x1B[96m", "\x1B[39m"),
77
- whiteBright: f("\x1B[97m", "\x1B[39m"),
78
- bgBlackBright: f("\x1B[100m", "\x1B[49m"),
79
- bgRedBright: f("\x1B[101m", "\x1B[49m"),
80
- bgGreenBright: f("\x1B[102m", "\x1B[49m"),
81
- bgYellowBright: f("\x1B[103m", "\x1B[49m"),
82
- bgBlueBright: f("\x1B[104m", "\x1B[49m"),
83
- bgMagentaBright: f("\x1B[105m", "\x1B[49m"),
84
- bgCyanBright: f("\x1B[106m", "\x1B[49m"),
85
- bgWhiteBright: f("\x1B[107m", "\x1B[49m")
86
- };
87
- };
88
- module.exports = createColors();
89
- module.exports.createColors = createColors;
90
- });
91
-
92
22
  // node_modules/sisteransi/src/index.js
93
23
  var require_src = __commonJS((exports, module) => {
94
- var ESC = "\x1B";
95
- var CSI = `${ESC}[`;
24
+ var ESC2 = "\x1B";
25
+ var CSI2 = `${ESC2}[`;
96
26
  var beep = "\x07";
97
27
  var cursor = {
98
28
  to(x, y) {
99
29
  if (!y)
100
- return `${CSI}${x + 1}G`;
101
- return `${CSI}${y + 1};${x + 1}H`;
30
+ return `${CSI2}${x + 1}G`;
31
+ return `${CSI2}${y + 1};${x + 1}H`;
102
32
  },
103
33
  move(x, y) {
104
34
  let ret = "";
105
35
  if (x < 0)
106
- ret += `${CSI}${-x}D`;
36
+ ret += `${CSI2}${-x}D`;
107
37
  else if (x > 0)
108
- ret += `${CSI}${x}C`;
38
+ ret += `${CSI2}${x}C`;
109
39
  if (y < 0)
110
- ret += `${CSI}${-y}A`;
40
+ ret += `${CSI2}${-y}A`;
111
41
  else if (y > 0)
112
- ret += `${CSI}${y}B`;
42
+ ret += `${CSI2}${y}B`;
113
43
  return ret;
114
44
  },
115
- up: (count = 1) => `${CSI}${count}A`,
116
- down: (count = 1) => `${CSI}${count}B`,
117
- forward: (count = 1) => `${CSI}${count}C`,
118
- backward: (count = 1) => `${CSI}${count}D`,
119
- nextLine: (count = 1) => `${CSI}E`.repeat(count),
120
- prevLine: (count = 1) => `${CSI}F`.repeat(count),
121
- left: `${CSI}G`,
122
- hide: `${CSI}?25l`,
123
- show: `${CSI}?25h`,
124
- save: `${ESC}7`,
125
- restore: `${ESC}8`
45
+ up: (count = 1) => `${CSI2}${count}A`,
46
+ down: (count = 1) => `${CSI2}${count}B`,
47
+ forward: (count = 1) => `${CSI2}${count}C`,
48
+ backward: (count = 1) => `${CSI2}${count}D`,
49
+ nextLine: (count = 1) => `${CSI2}E`.repeat(count),
50
+ prevLine: (count = 1) => `${CSI2}F`.repeat(count),
51
+ left: `${CSI2}G`,
52
+ hide: `${CSI2}?25l`,
53
+ show: `${CSI2}?25h`,
54
+ save: `${ESC2}7`,
55
+ restore: `${ESC2}8`
126
56
  };
127
57
  var scroll = {
128
- up: (count = 1) => `${CSI}S`.repeat(count),
129
- down: (count = 1) => `${CSI}T`.repeat(count)
58
+ up: (count = 1) => `${CSI2}S`.repeat(count),
59
+ down: (count = 1) => `${CSI2}T`.repeat(count)
130
60
  };
131
61
  var erase = {
132
- screen: `${CSI}2J`,
133
- up: (count = 1) => `${CSI}1J`.repeat(count),
134
- down: (count = 1) => `${CSI}J`.repeat(count),
135
- line: `${CSI}2K`,
136
- lineEnd: `${CSI}K`,
137
- lineStart: `${CSI}1K`,
62
+ screen: `${CSI2}2J`,
63
+ up: (count = 1) => `${CSI2}1J`.repeat(count),
64
+ down: (count = 1) => `${CSI2}J`.repeat(count),
65
+ line: `${CSI2}2K`,
66
+ lineEnd: `${CSI2}K`,
67
+ lineStart: `${CSI2}1K`,
138
68
  lines(count) {
139
69
  let clear = "";
140
70
  for (let i = 0;i < count; i++)
@@ -484,19 +414,19 @@ var require_web_outgoing = __commonJS((exports, module) => {
484
414
  setRedirectHostRewrite: function setRedirectHostRewrite(req, res, proxyRes, options) {
485
415
  if ((options.hostRewrite || options.autoRewrite || options.protocolRewrite) && proxyRes.headers["location"] && redirectRegex.test(proxyRes.statusCode)) {
486
416
  var target = url.parse(options.target);
487
- var u = url.parse(proxyRes.headers["location"]);
488
- if (target.host != u.host) {
417
+ var u2 = url.parse(proxyRes.headers["location"]);
418
+ if (target.host != u2.host) {
489
419
  return;
490
420
  }
491
421
  if (options.hostRewrite) {
492
- u.host = options.hostRewrite;
422
+ u2.host = options.hostRewrite;
493
423
  } else if (options.autoRewrite) {
494
- u.host = req.headers["host"];
424
+ u2.host = req.headers["host"];
495
425
  }
496
426
  if (options.protocolRewrite) {
497
- u.protocol = options.protocolRewrite;
427
+ u2.protocol = options.protocolRewrite;
498
428
  }
499
- proxyRes.headers["location"] = u.format();
429
+ proxyRes.headers["location"] = u2.format();
500
430
  }
501
431
  },
502
432
  writeHeaders: function writeHeaders(req, res, proxyRes, options) {
@@ -547,10 +477,10 @@ var require_web_outgoing = __commonJS((exports, module) => {
547
477
  var require_ms = __commonJS((exports, module) => {
548
478
  var s = 1000;
549
479
  var m = s * 60;
550
- var h2 = m * 60;
551
- var d = h2 * 24;
552
- var w3 = d * 7;
553
- var y2 = d * 365.25;
480
+ var h = m * 60;
481
+ var d3 = h * 24;
482
+ var w3 = d3 * 7;
483
+ var y2 = d3 * 365.25;
554
484
  module.exports = function(val, options) {
555
485
  options = options || {};
556
486
  var type = typeof val;
@@ -586,13 +516,13 @@ var require_ms = __commonJS((exports, module) => {
586
516
  case "days":
587
517
  case "day":
588
518
  case "d":
589
- return n * d;
519
+ return n * d3;
590
520
  case "hours":
591
521
  case "hour":
592
522
  case "hrs":
593
523
  case "hr":
594
524
  case "h":
595
- return n * h2;
525
+ return n * h;
596
526
  case "minutes":
597
527
  case "minute":
598
528
  case "mins":
@@ -617,11 +547,11 @@ var require_ms = __commonJS((exports, module) => {
617
547
  }
618
548
  function fmtShort(ms) {
619
549
  var msAbs = Math.abs(ms);
620
- if (msAbs >= d) {
621
- return Math.round(ms / d) + "d";
550
+ if (msAbs >= d3) {
551
+ return Math.round(ms / d3) + "d";
622
552
  }
623
- if (msAbs >= h2) {
624
- return Math.round(ms / h2) + "h";
553
+ if (msAbs >= h) {
554
+ return Math.round(ms / h) + "h";
625
555
  }
626
556
  if (msAbs >= m) {
627
557
  return Math.round(ms / m) + "m";
@@ -633,11 +563,11 @@ var require_ms = __commonJS((exports, module) => {
633
563
  }
634
564
  function fmtLong(ms) {
635
565
  var msAbs = Math.abs(ms);
636
- if (msAbs >= d) {
637
- return plural(ms, msAbs, d, "day");
566
+ if (msAbs >= d3) {
567
+ return plural(ms, msAbs, d3, "day");
638
568
  }
639
- if (msAbs >= h2) {
640
- return plural(ms, msAbs, h2, "hour");
569
+ if (msAbs >= h) {
570
+ return plural(ms, msAbs, h, "hour");
641
571
  }
642
572
  if (msAbs >= m) {
643
573
  return plural(ms, msAbs, m, "minute");
@@ -937,8 +867,8 @@ var require_browser = __commonJS((exports, module) => {
937
867
  if (!this.useColors) {
938
868
  return;
939
869
  }
940
- const c = "color: " + this.color;
941
- args.splice(1, 0, c, "color: inherit");
870
+ const c2 = "color: " + this.color;
871
+ args.splice(1, 0, c2, "color: inherit");
942
872
  let index = 0;
943
873
  let lastC = 0;
944
874
  args[0].replace(/%[a-zA-Z%]/g, (match) => {
@@ -950,7 +880,7 @@ var require_browser = __commonJS((exports, module) => {
950
880
  lastC = index;
951
881
  }
952
882
  });
953
- args.splice(lastC, 0, c);
883
+ args.splice(lastC, 0, c2);
954
884
  }
955
885
  exports.log = console.debug || console.log || (() => {});
956
886
  function save(namespaces) {
@@ -1195,8 +1125,8 @@ var require_node = __commonJS((exports, module) => {
1195
1125
  exports.inspectOpts = Object.keys(process.env).filter((key) => {
1196
1126
  return /^debug_/i.test(key);
1197
1127
  }).reduce((obj, key) => {
1198
- const prop = key.substring(6).toLowerCase().replace(/_([a-z])/g, (_2, k3) => {
1199
- return k3.toUpperCase();
1128
+ const prop = key.substring(6).toLowerCase().replace(/_([a-z])/g, (_2, k2) => {
1129
+ return k2.toUpperCase();
1200
1130
  });
1201
1131
  let val = process.env[key];
1202
1132
  if (/^(yes|on|true|enabled)$/i.test(val)) {
@@ -1217,8 +1147,8 @@ var require_node = __commonJS((exports, module) => {
1217
1147
  function formatArgs(args) {
1218
1148
  const { namespace: name, useColors: useColors2 } = this;
1219
1149
  if (useColors2) {
1220
- const c = this.color;
1221
- const colorCode = "\x1B[3" + (c < 8 ? c : "8;5;" + c);
1150
+ const c2 = this.color;
1151
+ const colorCode = "\x1B[3" + (c2 < 8 ? c2 : "8;5;" + c2);
1222
1152
  const prefix = ` ${colorCode};1m${name} \x1B[0m`;
1223
1153
  args[0] = prefix + args[0].split(`
1224
1154
  `).join(`
@@ -2357,25 +2287,25 @@ var require_proxy_events = __commonJS((exports) => {
2357
2287
 
2358
2288
  // node_modules/http-proxy-middleware/dist/plugins/default/index.js
2359
2289
  var require_default = __commonJS((exports) => {
2360
- var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k3, k22) {
2290
+ var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k2, k22) {
2361
2291
  if (k22 === undefined)
2362
- k22 = k3;
2363
- var desc = Object.getOwnPropertyDescriptor(m, k3);
2292
+ k22 = k2;
2293
+ var desc = Object.getOwnPropertyDescriptor(m, k2);
2364
2294
  if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
2365
2295
  desc = { enumerable: true, get: function() {
2366
- return m[k3];
2296
+ return m[k2];
2367
2297
  } };
2368
2298
  }
2369
2299
  Object.defineProperty(o, k22, desc);
2370
- } : function(o, m, k3, k22) {
2300
+ } : function(o, m, k2, k22) {
2371
2301
  if (k22 === undefined)
2372
- k22 = k3;
2373
- o[k22] = m[k3];
2302
+ k22 = k2;
2303
+ o[k22] = m[k2];
2374
2304
  });
2375
2305
  var __exportStar = exports && exports.__exportStar || function(m, exports2) {
2376
- for (var p in m)
2377
- if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p))
2378
- __createBinding(exports2, m, p);
2306
+ for (var p2 in m)
2307
+ if (p2 !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p2))
2308
+ __createBinding(exports2, m, p2);
2379
2309
  };
2380
2310
  Object.defineProperty(exports, "__esModule", { value: true });
2381
2311
  __exportStar(require_debug_proxy_errors_plugin(), exports);
@@ -3194,18 +3124,18 @@ var require_expand = __commonJS((exports, module) => {
3194
3124
  const rangeLimit = options.rangeLimit === undefined ? 1000 : options.rangeLimit;
3195
3125
  const walk = (node, parent = {}) => {
3196
3126
  node.queue = [];
3197
- let p = parent;
3198
- let q3 = parent.queue;
3199
- while (p.type !== "brace" && p.type !== "root" && p.parent) {
3200
- p = p.parent;
3201
- q3 = p.queue;
3127
+ let p2 = parent;
3128
+ let q2 = parent.queue;
3129
+ while (p2.type !== "brace" && p2.type !== "root" && p2.parent) {
3130
+ p2 = p2.parent;
3131
+ q2 = p2.queue;
3202
3132
  }
3203
3133
  if (node.invalid || node.dollar) {
3204
- q3.push(append(q3.pop(), stringify(node, options)));
3134
+ q2.push(append(q2.pop(), stringify(node, options)));
3205
3135
  return;
3206
3136
  }
3207
3137
  if (node.type === "brace" && node.invalid !== true && node.nodes.length === 2) {
3208
- q3.push(append(q3.pop(), ["{}"]));
3138
+ q2.push(append(q2.pop(), ["{}"]));
3209
3139
  return;
3210
3140
  }
3211
3141
  if (node.nodes && node.ranges > 0) {
@@ -3217,7 +3147,7 @@ var require_expand = __commonJS((exports, module) => {
3217
3147
  if (range.length === 0) {
3218
3148
  range = stringify(node, options);
3219
3149
  }
3220
- q3.push(append(q3.pop(), range));
3150
+ q2.push(append(q2.pop(), range));
3221
3151
  node.nodes = [];
3222
3152
  return;
3223
3153
  }
@@ -3237,7 +3167,7 @@ var require_expand = __commonJS((exports, module) => {
3237
3167
  continue;
3238
3168
  }
3239
3169
  if (child.type === "close") {
3240
- q3.push(append(q3.pop(), queue, enclose));
3170
+ q2.push(append(q2.pop(), queue, enclose));
3241
3171
  continue;
3242
3172
  }
3243
3173
  if (child.value && child.type !== "open") {
@@ -4980,7 +4910,7 @@ var require_picomatch = __commonJS((exports, module) => {
4980
4910
  picomatch.isMatch = (str, patterns, options) => picomatch(patterns, options)(str);
4981
4911
  picomatch.parse = (pattern, options) => {
4982
4912
  if (Array.isArray(pattern))
4983
- return pattern.map((p) => picomatch.parse(p, options));
4913
+ return pattern.map((p2) => picomatch.parse(p2, options));
4984
4914
  return parse(pattern, { ...options, fastpaths: false });
4985
4915
  };
4986
4916
  picomatch.scan = (input, options) => scan(input, options);
@@ -5077,7 +5007,7 @@ var require_micromatch = __commonJS((exports, module) => {
5077
5007
  throw new Error(`No matches found for "${patterns.join(", ")}"`);
5078
5008
  }
5079
5009
  if (options.nonull === true || options.nullglob === true) {
5080
- return options.unescape ? patterns.map((p) => p.replace(/\\/g, "")) : patterns;
5010
+ return options.unescape ? patterns.map((p2) => p2.replace(/\\/g, "")) : patterns;
5081
5011
  }
5082
5012
  }
5083
5013
  return matches;
@@ -5108,7 +5038,7 @@ var require_micromatch = __commonJS((exports, module) => {
5108
5038
  throw new TypeError(`Expected a string: "${util.inspect(str)}"`);
5109
5039
  }
5110
5040
  if (Array.isArray(pattern)) {
5111
- return pattern.some((p) => micromatch.contains(str, p, options));
5041
+ return pattern.some((p2) => micromatch.contains(str, p2, options));
5112
5042
  }
5113
5043
  if (typeof pattern === "string") {
5114
5044
  if (isEmptyString(str) || isEmptyString(pattern)) {
@@ -5154,7 +5084,7 @@ var require_micromatch = __commonJS((exports, module) => {
5154
5084
  if (typeof str !== "string") {
5155
5085
  throw new TypeError(`Expected a string: "${util.inspect(str)}"`);
5156
5086
  }
5157
- return [].concat(patterns).every((p) => picomatch(p, options)(str));
5087
+ return [].concat(patterns).every((p2) => picomatch(p2, options)(str));
5158
5088
  };
5159
5089
  micromatch.capture = (glob, input, options) => {
5160
5090
  let posix = utils.isWindows(options);
@@ -5585,7 +5515,7 @@ var require_response_interceptor = __commonJS((exports) => {
5585
5515
  let value = originalResponse.headers[key];
5586
5516
  if (key === "set-cookie") {
5587
5517
  value = Array.isArray(value) ? value : [value];
5588
- value = value.map((x3) => x3.replace(/Domain=[^;]+?/i, ""));
5518
+ value = value.map((x) => x.replace(/Domain=[^;]+?/i, ""));
5589
5519
  }
5590
5520
  response.setHeader(key, value);
5591
5521
  });
@@ -5654,25 +5584,25 @@ var require_public = __commonJS((exports) => {
5654
5584
 
5655
5585
  // node_modules/http-proxy-middleware/dist/handlers/index.js
5656
5586
  var require_handlers = __commonJS((exports) => {
5657
- var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k3, k22) {
5587
+ var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k2, k22) {
5658
5588
  if (k22 === undefined)
5659
- k22 = k3;
5660
- var desc = Object.getOwnPropertyDescriptor(m, k3);
5589
+ k22 = k2;
5590
+ var desc = Object.getOwnPropertyDescriptor(m, k2);
5661
5591
  if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
5662
5592
  desc = { enumerable: true, get: function() {
5663
- return m[k3];
5593
+ return m[k2];
5664
5594
  } };
5665
5595
  }
5666
5596
  Object.defineProperty(o, k22, desc);
5667
- } : function(o, m, k3, k22) {
5597
+ } : function(o, m, k2, k22) {
5668
5598
  if (k22 === undefined)
5669
- k22 = k3;
5670
- o[k22] = m[k3];
5599
+ k22 = k2;
5600
+ o[k22] = m[k2];
5671
5601
  });
5672
5602
  var __exportStar = exports && exports.__exportStar || function(m, exports2) {
5673
- for (var p in m)
5674
- if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p))
5675
- __createBinding(exports2, m, p);
5603
+ for (var p2 in m)
5604
+ if (p2 !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p2))
5605
+ __createBinding(exports2, m, p2);
5676
5606
  };
5677
5607
  Object.defineProperty(exports, "__esModule", { value: true });
5678
5608
  __exportStar(require_public(), exports);
@@ -5795,25 +5725,25 @@ var require_public2 = __commonJS((exports) => {
5795
5725
 
5796
5726
  // node_modules/http-proxy-middleware/dist/legacy/index.js
5797
5727
  var require_legacy = __commonJS((exports) => {
5798
- var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k3, k22) {
5728
+ var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k2, k22) {
5799
5729
  if (k22 === undefined)
5800
- k22 = k3;
5801
- var desc = Object.getOwnPropertyDescriptor(m, k3);
5730
+ k22 = k2;
5731
+ var desc = Object.getOwnPropertyDescriptor(m, k2);
5802
5732
  if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
5803
5733
  desc = { enumerable: true, get: function() {
5804
- return m[k3];
5734
+ return m[k2];
5805
5735
  } };
5806
5736
  }
5807
5737
  Object.defineProperty(o, k22, desc);
5808
- } : function(o, m, k3, k22) {
5738
+ } : function(o, m, k2, k22) {
5809
5739
  if (k22 === undefined)
5810
- k22 = k3;
5811
- o[k22] = m[k3];
5740
+ k22 = k2;
5741
+ o[k22] = m[k2];
5812
5742
  });
5813
5743
  var __exportStar = exports && exports.__exportStar || function(m, exports2) {
5814
- for (var p in m)
5815
- if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p))
5816
- __createBinding(exports2, m, p);
5744
+ for (var p2 in m)
5745
+ if (p2 !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p2))
5746
+ __createBinding(exports2, m, p2);
5817
5747
  };
5818
5748
  Object.defineProperty(exports, "__esModule", { value: true });
5819
5749
  __exportStar(require_public2(), exports);
@@ -5821,25 +5751,25 @@ var require_legacy = __commonJS((exports) => {
5821
5751
 
5822
5752
  // node_modules/http-proxy-middleware/dist/index.js
5823
5753
  var require_dist = __commonJS((exports) => {
5824
- var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k3, k22) {
5754
+ var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k2, k22) {
5825
5755
  if (k22 === undefined)
5826
- k22 = k3;
5827
- var desc = Object.getOwnPropertyDescriptor(m, k3);
5756
+ k22 = k2;
5757
+ var desc = Object.getOwnPropertyDescriptor(m, k2);
5828
5758
  if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
5829
5759
  desc = { enumerable: true, get: function() {
5830
- return m[k3];
5760
+ return m[k2];
5831
5761
  } };
5832
5762
  }
5833
5763
  Object.defineProperty(o, k22, desc);
5834
- } : function(o, m, k3, k22) {
5764
+ } : function(o, m, k2, k22) {
5835
5765
  if (k22 === undefined)
5836
- k22 = k3;
5837
- o[k22] = m[k3];
5766
+ k22 = k2;
5767
+ o[k22] = m[k2];
5838
5768
  });
5839
5769
  var __exportStar = exports && exports.__exportStar || function(m, exports2) {
5840
- for (var p in m)
5841
- if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p))
5842
- __createBinding(exports2, m, p);
5770
+ for (var p2 in m)
5771
+ if (p2 !== "default" && !Object.prototype.hasOwnProperty.call(exports2, p2))
5772
+ __createBinding(exports2, m, p2);
5843
5773
  };
5844
5774
  Object.defineProperty(exports, "__esModule", { value: true });
5845
5775
  __exportStar(require_factory(), exports);
@@ -8228,15 +8158,15 @@ var require_dbcs_codec = __commonJS((exports) => {
8228
8158
  throw new Error("gb18030 decode tables conflict at byte 2");
8229
8159
  }
8230
8160
  var thirdByteNode = this.decodeTables[NODE_START - secondByteNode[j2]];
8231
- for (var k3 = 129;k3 <= 254; k3++) {
8232
- if (thirdByteNode[k3] === UNASSIGNED) {
8233
- thirdByteNode[k3] = NODE_START - commonFourthByteNodeIdx;
8234
- } else if (thirdByteNode[k3] === NODE_START - commonFourthByteNodeIdx) {
8161
+ for (var k2 = 129;k2 <= 254; k2++) {
8162
+ if (thirdByteNode[k2] === UNASSIGNED) {
8163
+ thirdByteNode[k2] = NODE_START - commonFourthByteNodeIdx;
8164
+ } else if (thirdByteNode[k2] === NODE_START - commonFourthByteNodeIdx) {
8235
8165
  continue;
8236
- } else if (thirdByteNode[k3] > NODE_START) {
8166
+ } else if (thirdByteNode[k2] > NODE_START) {
8237
8167
  throw new Error("gb18030 decode tables conflict at byte 3");
8238
8168
  }
8239
- var fourthByteNode = this.decodeTables[NODE_START - thirdByteNode[k3]];
8169
+ var fourthByteNode = this.decodeTables[NODE_START - thirdByteNode[k2]];
8240
8170
  for (var l = 48;l <= 57; l++) {
8241
8171
  if (fourthByteNode[l] === UNASSIGNED) {
8242
8172
  fourthByteNode[l] = GB18030_CODE;
@@ -8304,8 +8234,8 @@ var require_dbcs_codec = __commonJS((exports) => {
8304
8234
  var curAddr = parseInt(chunk[0], 16);
8305
8235
  var writeTable = this._getDecodeTrieNode(curAddr);
8306
8236
  curAddr = curAddr & 255;
8307
- for (var k3 = 1;k3 < chunk.length; k3++) {
8308
- var part = chunk[k3];
8237
+ for (var k2 = 1;k2 < chunk.length; k2++) {
8238
+ var part = chunk[k2];
8309
8239
  if (typeof part === "string") {
8310
8240
  for (var l = 0;l < part.length; ) {
8311
8241
  var code = part.charCodeAt(l++);
@@ -8583,8 +8513,8 @@ var require_dbcs_codec = __commonJS((exports) => {
8583
8513
  continue;
8584
8514
  } else if (uCode <= SEQ_START) {
8585
8515
  var seq = this.decodeTableSeq[SEQ_START - uCode];
8586
- for (var k3 = 0;k3 < seq.length - 1; k3++) {
8587
- uCode = seq[k3];
8516
+ for (var k2 = 0;k2 < seq.length - 1; k2++) {
8517
+ uCode = seq[k2];
8588
8518
  newBuf[j2++] = uCode & 255;
8589
8519
  newBuf[j2++] = uCode >> 8;
8590
8520
  }
@@ -10563,10 +10493,10 @@ var require_ee_first = __commonJS((exports, module) => {
10563
10493
  done.apply(null, arguments);
10564
10494
  }
10565
10495
  function cleanup() {
10566
- var x3;
10496
+ var x;
10567
10497
  for (var i2 = 0;i2 < cleanups.length; i2++) {
10568
- x3 = cleanups[i2];
10569
- x3.ee.removeListener(x3.event, x3.fn);
10498
+ x = cleanups[i2];
10499
+ x.ee.removeListener(x.event, x.fn);
10570
10500
  }
10571
10501
  }
10572
10502
  function thunk(fn2) {
@@ -21147,95 +21077,95 @@ var require_object_inspect = __commonJS((exports, module) => {
21147
21077
  }
21148
21078
  return null;
21149
21079
  }
21150
- function indexOf(xs, x3) {
21080
+ function indexOf(xs, x) {
21151
21081
  if (xs.indexOf) {
21152
- return xs.indexOf(x3);
21082
+ return xs.indexOf(x);
21153
21083
  }
21154
21084
  for (var i = 0, l = xs.length;i < l; i++) {
21155
- if (xs[i] === x3) {
21085
+ if (xs[i] === x) {
21156
21086
  return i;
21157
21087
  }
21158
21088
  }
21159
21089
  return -1;
21160
21090
  }
21161
- function isMap(x3) {
21162
- if (!mapSize || !x3 || typeof x3 !== "object") {
21091
+ function isMap(x) {
21092
+ if (!mapSize || !x || typeof x !== "object") {
21163
21093
  return false;
21164
21094
  }
21165
21095
  try {
21166
- mapSize.call(x3);
21096
+ mapSize.call(x);
21167
21097
  try {
21168
- setSize.call(x3);
21098
+ setSize.call(x);
21169
21099
  } catch (s) {
21170
21100
  return true;
21171
21101
  }
21172
- return x3 instanceof Map;
21102
+ return x instanceof Map;
21173
21103
  } catch (e) {}
21174
21104
  return false;
21175
21105
  }
21176
- function isWeakMap(x3) {
21177
- if (!weakMapHas || !x3 || typeof x3 !== "object") {
21106
+ function isWeakMap(x) {
21107
+ if (!weakMapHas || !x || typeof x !== "object") {
21178
21108
  return false;
21179
21109
  }
21180
21110
  try {
21181
- weakMapHas.call(x3, weakMapHas);
21111
+ weakMapHas.call(x, weakMapHas);
21182
21112
  try {
21183
- weakSetHas.call(x3, weakSetHas);
21113
+ weakSetHas.call(x, weakSetHas);
21184
21114
  } catch (s) {
21185
21115
  return true;
21186
21116
  }
21187
- return x3 instanceof WeakMap;
21117
+ return x instanceof WeakMap;
21188
21118
  } catch (e) {}
21189
21119
  return false;
21190
21120
  }
21191
- function isWeakRef(x3) {
21192
- if (!weakRefDeref || !x3 || typeof x3 !== "object") {
21121
+ function isWeakRef(x) {
21122
+ if (!weakRefDeref || !x || typeof x !== "object") {
21193
21123
  return false;
21194
21124
  }
21195
21125
  try {
21196
- weakRefDeref.call(x3);
21126
+ weakRefDeref.call(x);
21197
21127
  return true;
21198
21128
  } catch (e) {}
21199
21129
  return false;
21200
21130
  }
21201
- function isSet(x3) {
21202
- if (!setSize || !x3 || typeof x3 !== "object") {
21131
+ function isSet(x) {
21132
+ if (!setSize || !x || typeof x !== "object") {
21203
21133
  return false;
21204
21134
  }
21205
21135
  try {
21206
- setSize.call(x3);
21136
+ setSize.call(x);
21207
21137
  try {
21208
- mapSize.call(x3);
21138
+ mapSize.call(x);
21209
21139
  } catch (m) {
21210
21140
  return true;
21211
21141
  }
21212
- return x3 instanceof Set;
21142
+ return x instanceof Set;
21213
21143
  } catch (e) {}
21214
21144
  return false;
21215
21145
  }
21216
- function isWeakSet(x3) {
21217
- if (!weakSetHas || !x3 || typeof x3 !== "object") {
21146
+ function isWeakSet(x) {
21147
+ if (!weakSetHas || !x || typeof x !== "object") {
21218
21148
  return false;
21219
21149
  }
21220
21150
  try {
21221
- weakSetHas.call(x3, weakSetHas);
21151
+ weakSetHas.call(x, weakSetHas);
21222
21152
  try {
21223
- weakMapHas.call(x3, weakMapHas);
21153
+ weakMapHas.call(x, weakMapHas);
21224
21154
  } catch (s) {
21225
21155
  return true;
21226
21156
  }
21227
- return x3 instanceof WeakSet;
21157
+ return x instanceof WeakSet;
21228
21158
  } catch (e) {}
21229
21159
  return false;
21230
21160
  }
21231
- function isElement(x3) {
21232
- if (!x3 || typeof x3 !== "object") {
21161
+ function isElement(x) {
21162
+ if (!x || typeof x !== "object") {
21233
21163
  return false;
21234
21164
  }
21235
- if (typeof HTMLElement !== "undefined" && x3 instanceof HTMLElement) {
21165
+ if (typeof HTMLElement !== "undefined" && x instanceof HTMLElement) {
21236
21166
  return true;
21237
21167
  }
21238
- return typeof x3.nodeName === "string" && typeof x3.getAttribute === "function";
21168
+ return typeof x.nodeName === "string" && typeof x.getAttribute === "function";
21239
21169
  }
21240
21170
  function inspectString(str, opts) {
21241
21171
  if (str.length > opts.maxStringLength) {
@@ -21248,17 +21178,17 @@ var require_object_inspect = __commonJS((exports, module) => {
21248
21178
  var s = $replace.call($replace.call(str, quoteRE, "\\$1"), /[\x00-\x1f]/g, lowbyte);
21249
21179
  return wrapQuotes(s, "single", opts);
21250
21180
  }
21251
- function lowbyte(c) {
21252
- var n = c.charCodeAt(0);
21253
- var x3 = {
21181
+ function lowbyte(c2) {
21182
+ var n = c2.charCodeAt(0);
21183
+ var x = {
21254
21184
  8: "b",
21255
21185
  9: "t",
21256
21186
  10: "n",
21257
21187
  12: "f",
21258
21188
  13: "r"
21259
21189
  }[n];
21260
- if (x3) {
21261
- return "\\" + x3;
21190
+ if (x) {
21191
+ return "\\" + x;
21262
21192
  }
21263
21193
  return "\\x" + (n < 16 ? "0" : "") + $toUpperCase.call(n.toString(16));
21264
21194
  }
@@ -21317,8 +21247,8 @@ var require_object_inspect = __commonJS((exports, module) => {
21317
21247
  var symMap;
21318
21248
  if (hasShammedSymbols) {
21319
21249
  symMap = {};
21320
- for (var k3 = 0;k3 < syms.length; k3++) {
21321
- symMap["$" + syms[k3]] = syms[k3];
21250
+ for (var k2 = 0;k2 < syms.length; k2++) {
21251
+ symMap["$" + syms[k2]] = syms[k2];
21322
21252
  }
21323
21253
  }
21324
21254
  for (var key in obj) {
@@ -22448,26 +22378,26 @@ var require_utils4 = __commonJS((exports, module) => {
22448
22378
  var segment = string.length >= limit ? string.slice(j2, j2 + limit) : string;
22449
22379
  var arr = [];
22450
22380
  for (var i = 0;i < segment.length; ++i) {
22451
- var c = segment.charCodeAt(i);
22452
- if (c === 45 || c === 46 || c === 95 || c === 126 || c >= 48 && c <= 57 || c >= 65 && c <= 90 || c >= 97 && c <= 122 || format === formats.RFC1738 && (c === 40 || c === 41)) {
22381
+ var c2 = segment.charCodeAt(i);
22382
+ if (c2 === 45 || c2 === 46 || c2 === 95 || c2 === 126 || c2 >= 48 && c2 <= 57 || c2 >= 65 && c2 <= 90 || c2 >= 97 && c2 <= 122 || format === formats.RFC1738 && (c2 === 40 || c2 === 41)) {
22453
22383
  arr[arr.length] = segment.charAt(i);
22454
22384
  continue;
22455
22385
  }
22456
- if (c < 128) {
22457
- arr[arr.length] = hexTable[c];
22386
+ if (c2 < 128) {
22387
+ arr[arr.length] = hexTable[c2];
22458
22388
  continue;
22459
22389
  }
22460
- if (c < 2048) {
22461
- arr[arr.length] = hexTable[192 | c >> 6] + hexTable[128 | c & 63];
22390
+ if (c2 < 2048) {
22391
+ arr[arr.length] = hexTable[192 | c2 >> 6] + hexTable[128 | c2 & 63];
22462
22392
  continue;
22463
22393
  }
22464
- if (c < 55296 || c >= 57344) {
22465
- arr[arr.length] = hexTable[224 | c >> 12] + hexTable[128 | c >> 6 & 63] + hexTable[128 | c & 63];
22394
+ if (c2 < 55296 || c2 >= 57344) {
22395
+ arr[arr.length] = hexTable[224 | c2 >> 12] + hexTable[128 | c2 >> 6 & 63] + hexTable[128 | c2 & 63];
22466
22396
  continue;
22467
22397
  }
22468
22398
  i += 1;
22469
- c = 65536 + ((c & 1023) << 10 | segment.charCodeAt(i) & 1023);
22470
- arr[arr.length] = hexTable[240 | c >> 18] + hexTable[128 | c >> 12 & 63] + hexTable[128 | c >> 6 & 63] + hexTable[128 | c & 63];
22399
+ c2 = 65536 + ((c2 & 1023) << 10 | segment.charCodeAt(i) & 1023);
22400
+ arr[arr.length] = hexTable[240 | c2 >> 18] + hexTable[128 | c2 >> 12 & 63] + hexTable[128 | c2 >> 6 & 63] + hexTable[128 | c2 & 63];
22471
22401
  }
22472
22402
  out += arr.join("");
22473
22403
  }
@@ -23708,7 +23638,7 @@ var require_ipaddr = __commonJS((exports, module) => {
23708
23638
  return true;
23709
23639
  };
23710
23640
  ipaddr.subnetMatch = function(address, rangeList, defaultName) {
23711
- var k3, len, rangeName, rangeSubnets, subnet;
23641
+ var k2, len, rangeName, rangeSubnets, subnet;
23712
23642
  if (defaultName == null) {
23713
23643
  defaultName = "unicast";
23714
23644
  }
@@ -23717,8 +23647,8 @@ var require_ipaddr = __commonJS((exports, module) => {
23717
23647
  if (rangeSubnets[0] && !(rangeSubnets[0] instanceof Array)) {
23718
23648
  rangeSubnets = [rangeSubnets];
23719
23649
  }
23720
- for (k3 = 0, len = rangeSubnets.length;k3 < len; k3++) {
23721
- subnet = rangeSubnets[k3];
23650
+ for (k2 = 0, len = rangeSubnets.length;k2 < len; k2++) {
23651
+ subnet = rangeSubnets[k2];
23722
23652
  if (address.kind() === subnet[0].kind()) {
23723
23653
  if (address.match.apply(address, subnet)) {
23724
23654
  return rangeName;
@@ -23730,12 +23660,12 @@ var require_ipaddr = __commonJS((exports, module) => {
23730
23660
  };
23731
23661
  ipaddr.IPv4 = function() {
23732
23662
  function IPv4(octets) {
23733
- var k3, len, octet;
23663
+ var k2, len, octet;
23734
23664
  if (octets.length !== 4) {
23735
23665
  throw new Error("ipaddr: ipv4 octet count should be 4");
23736
23666
  }
23737
- for (k3 = 0, len = octets.length;k3 < len; k3++) {
23738
- octet = octets[k3];
23667
+ for (k2 = 0, len = octets.length;k2 < len; k2++) {
23668
+ octet = octets[k2];
23739
23669
  if (!(0 <= octet && octet <= 255)) {
23740
23670
  throw new Error("ipaddr: ipv4 octet should fit in 8 bits");
23741
23671
  }
@@ -23781,7 +23711,7 @@ var require_ipaddr = __commonJS((exports, module) => {
23781
23711
  return ipaddr.IPv6.parse("::ffff:" + this.toString());
23782
23712
  };
23783
23713
  IPv4.prototype.prefixLengthFromSubnetMask = function() {
23784
- var cidr, i, k3, octet, stop, zeros, zerotable;
23714
+ var cidr, i, k2, octet, stop, zeros, zerotable;
23785
23715
  zerotable = {
23786
23716
  0: 8,
23787
23717
  128: 7,
@@ -23795,7 +23725,7 @@ var require_ipaddr = __commonJS((exports, module) => {
23795
23725
  };
23796
23726
  cidr = 0;
23797
23727
  stop = false;
23798
- for (i = k3 = 3;k3 >= 0; i = k3 += -1) {
23728
+ for (i = k2 = 3;k2 >= 0; i = k2 += -1) {
23799
23729
  octet = this.octets[i];
23800
23730
  if (octet in zerotable) {
23801
23731
  zeros = zerotable[octet];
@@ -23830,11 +23760,11 @@ var require_ipaddr = __commonJS((exports, module) => {
23830
23760
  };
23831
23761
  if (match = string.match(ipv4Regexes.fourOctet)) {
23832
23762
  return function() {
23833
- var k3, len, ref, results;
23763
+ var k2, len, ref, results;
23834
23764
  ref = match.slice(1, 6);
23835
23765
  results = [];
23836
- for (k3 = 0, len = ref.length;k3 < len; k3++) {
23837
- part = ref[k3];
23766
+ for (k2 = 0, len = ref.length;k2 < len; k2++) {
23767
+ part = ref[k2];
23838
23768
  results.push(parseIntAuto(part));
23839
23769
  }
23840
23770
  return results;
@@ -23845,9 +23775,9 @@ var require_ipaddr = __commonJS((exports, module) => {
23845
23775
  throw new Error("ipaddr: address outside defined range");
23846
23776
  }
23847
23777
  return function() {
23848
- var k3, results;
23778
+ var k2, results;
23849
23779
  results = [];
23850
- for (shift = k3 = 0;k3 <= 24; shift = k3 += 8) {
23780
+ for (shift = k2 = 0;k2 <= 24; shift = k2 += 8) {
23851
23781
  results.push(value >> shift & 255);
23852
23782
  }
23853
23783
  return results;
@@ -23858,10 +23788,10 @@ var require_ipaddr = __commonJS((exports, module) => {
23858
23788
  };
23859
23789
  ipaddr.IPv6 = function() {
23860
23790
  function IPv6(parts, zoneId) {
23861
- var i, k3, l, len, part, ref;
23791
+ var i, k2, l, len, part, ref;
23862
23792
  if (parts.length === 16) {
23863
23793
  this.parts = [];
23864
- for (i = k3 = 0;k3 <= 14; i = k3 += 2) {
23794
+ for (i = k2 = 0;k2 <= 14; i = k2 += 2) {
23865
23795
  this.parts.push(parts[i] << 8 | parts[i + 1]);
23866
23796
  }
23867
23797
  } else if (parts.length === 8) {
@@ -23904,11 +23834,11 @@ var require_ipaddr = __commonJS((exports, module) => {
23904
23834
  return string.substring(0, bestMatchIndex) + "::" + string.substring(bestMatchIndex + bestMatchLength);
23905
23835
  };
23906
23836
  IPv6.prototype.toByteArray = function() {
23907
- var bytes, k3, len, part, ref;
23837
+ var bytes, k2, len, part, ref;
23908
23838
  bytes = [];
23909
23839
  ref = this.parts;
23910
- for (k3 = 0, len = ref.length;k3 < len; k3++) {
23911
- part = ref[k3];
23840
+ for (k2 = 0, len = ref.length;k2 < len; k2++) {
23841
+ part = ref[k2];
23912
23842
  bytes.push(part >> 8);
23913
23843
  bytes.push(part & 255);
23914
23844
  }
@@ -23917,11 +23847,11 @@ var require_ipaddr = __commonJS((exports, module) => {
23917
23847
  IPv6.prototype.toNormalizedString = function() {
23918
23848
  var addr, part, suffix;
23919
23849
  addr = function() {
23920
- var k3, len, ref, results;
23850
+ var k2, len, ref, results;
23921
23851
  ref = this.parts;
23922
23852
  results = [];
23923
- for (k3 = 0, len = ref.length;k3 < len; k3++) {
23924
- part = ref[k3];
23853
+ for (k2 = 0, len = ref.length;k2 < len; k2++) {
23854
+ part = ref[k2];
23925
23855
  results.push(part.toString(16));
23926
23856
  }
23927
23857
  return results;
@@ -23935,11 +23865,11 @@ var require_ipaddr = __commonJS((exports, module) => {
23935
23865
  IPv6.prototype.toFixedLengthString = function() {
23936
23866
  var addr, part, suffix;
23937
23867
  addr = function() {
23938
- var k3, len, ref, results;
23868
+ var k2, len, ref, results;
23939
23869
  ref = this.parts;
23940
23870
  results = [];
23941
- for (k3 = 0, len = ref.length;k3 < len; k3++) {
23942
- part = ref[k3];
23871
+ for (k2 = 0, len = ref.length;k2 < len; k2++) {
23872
+ part = ref[k2];
23943
23873
  results.push(part.toString(16).padStart(4, "0"));
23944
23874
  }
23945
23875
  return results;
@@ -23988,7 +23918,7 @@ var require_ipaddr = __commonJS((exports, module) => {
23988
23918
  return new ipaddr.IPv4([high >> 8, high & 255, low >> 8, low & 255]);
23989
23919
  };
23990
23920
  IPv6.prototype.prefixLengthFromSubnetMask = function() {
23991
- var cidr, i, k3, part, stop, zeros, zerotable;
23921
+ var cidr, i, k2, part, stop, zeros, zerotable;
23992
23922
  zerotable = {
23993
23923
  0: 16,
23994
23924
  32768: 15,
@@ -24010,7 +23940,7 @@ var require_ipaddr = __commonJS((exports, module) => {
24010
23940
  };
24011
23941
  cidr = 0;
24012
23942
  stop = false;
24013
- for (i = k3 = 7;k3 >= 0; i = k3 += -1) {
23943
+ for (i = k2 = 7;k2 >= 0; i = k2 += -1) {
24014
23944
  part = this.parts[i];
24015
23945
  if (part in zerotable) {
24016
23946
  zeros = zerotable[part];
@@ -24073,11 +24003,11 @@ var require_ipaddr = __commonJS((exports, module) => {
24073
24003
  string = string.slice(0, -1);
24074
24004
  }
24075
24005
  parts = function() {
24076
- var k3, len, ref, results;
24006
+ var k2, len, ref, results;
24077
24007
  ref = string.split(":");
24078
24008
  results = [];
24079
- for (k3 = 0, len = ref.length;k3 < len; k3++) {
24080
- part = ref[k3];
24009
+ for (k2 = 0, len = ref.length;k2 < len; k2++) {
24010
+ part = ref[k2];
24081
24011
  results.push(parseInt(part, 16));
24082
24012
  }
24083
24013
  return results;
@@ -24088,7 +24018,7 @@ var require_ipaddr = __commonJS((exports, module) => {
24088
24018
  };
24089
24019
  };
24090
24020
  ipaddr.IPv6.parser = function(string) {
24091
- var addr, k3, len, match, octet, octets, zoneId;
24021
+ var addr, k2, len, match, octet, octets, zoneId;
24092
24022
  if (ipv6Regexes["native"].test(string)) {
24093
24023
  return expandIPv6(string, 8);
24094
24024
  } else if (match = string.match(ipv6Regexes["transitional"])) {
@@ -24096,8 +24026,8 @@ var require_ipaddr = __commonJS((exports, module) => {
24096
24026
  addr = expandIPv6(match[1].slice(0, -1) + zoneId, 6);
24097
24027
  if (addr.parts) {
24098
24028
  octets = [parseInt(match[2]), parseInt(match[3]), parseInt(match[4]), parseInt(match[5])];
24099
- for (k3 = 0, len = octets.length;k3 < len; k3++) {
24100
- octet = octets[k3];
24029
+ for (k2 = 0, len = octets.length;k2 < len; k2++) {
24030
+ octet = octets[k2];
24101
24031
  if (!(0 <= octet && octet <= 255)) {
24102
24032
  return null;
24103
24033
  }
@@ -24601,8 +24531,8 @@ var require_wrappy = __commonJS((exports, module) => {
24601
24531
  return wrappy(fn)(cb);
24602
24532
  if (typeof fn !== "function")
24603
24533
  throw new TypeError("need wrapper function");
24604
- Object.keys(fn).forEach(function(k3) {
24605
- wrapper[k3] = fn[k3];
24534
+ Object.keys(fn).forEach(function(k2) {
24535
+ wrapper[k2] = fn[k2];
24606
24536
  });
24607
24537
  return wrapper;
24608
24538
  function wrapper() {
@@ -24613,8 +24543,8 @@ var require_wrappy = __commonJS((exports, module) => {
24613
24543
  var ret = fn.apply(this, args);
24614
24544
  var cb2 = args[args.length - 1];
24615
24545
  if (typeof ret === "function" && ret !== cb2) {
24616
- Object.keys(cb2).forEach(function(k3) {
24617
- ret[k3] = cb2[k3];
24546
+ Object.keys(cb2).forEach(function(k2) {
24547
+ ret[k2] = cb2[k2];
24618
24548
  });
24619
24549
  }
24620
24550
  return ret;
@@ -24923,8 +24853,8 @@ var require_dist2 = __commonJS((exports) => {
24923
24853
  }
24924
24854
  function pathsToArray(paths, init) {
24925
24855
  if (Array.isArray(paths)) {
24926
- for (const p of paths)
24927
- pathsToArray(p, init);
24856
+ for (const p2 of paths)
24857
+ pathsToArray(p2, init);
24928
24858
  } else {
24929
24859
  init.push(paths);
24930
24860
  }
@@ -25064,8 +24994,8 @@ var require_layer = __commonJS((exports, module) => {
25064
24994
  offset: m.index
25065
24995
  });
25066
24996
  }
25067
- return function regexpMatcher(p) {
25068
- const match = _path.exec(p);
24997
+ return function regexpMatcher(p2) {
24998
+ const match = _path.exec(p2);
25069
24999
  if (!match) {
25070
25000
  return false;
25071
25001
  }
@@ -25173,8 +25103,8 @@ var require_layer = __commonJS((exports, module) => {
25173
25103
  if (path instanceof RegExp || path === "/") {
25174
25104
  return path;
25175
25105
  }
25176
- return Array.isArray(path) ? path.map(function(p) {
25177
- return loosen(p);
25106
+ return Array.isArray(path) ? path.map(function(p2) {
25107
+ return loosen(p2);
25178
25108
  }) : String(path).replace(TRAILING_SLASH_REGEXP, "");
25179
25109
  }
25180
25110
  });
@@ -25464,8 +25394,8 @@ var require_router2 = __commonJS((exports, module) => {
25464
25394
  next(layerError);
25465
25395
  return;
25466
25396
  }
25467
- const c = path[layerPath.length];
25468
- if (c && c !== "/") {
25397
+ const c2 = path[layerPath.length];
25398
+ if (c2 && c2 !== "/") {
25469
25399
  next(layerError);
25470
25400
  return;
25471
25401
  }
@@ -25990,20 +25920,20 @@ var require_charset = __commonJS((exports, module) => {
25990
25920
  if (!match)
25991
25921
  return null;
25992
25922
  var charset = match[1];
25993
- var q3 = 1;
25923
+ var q2 = 1;
25994
25924
  if (match[2]) {
25995
25925
  var params = match[2].split(";");
25996
25926
  for (var j2 = 0;j2 < params.length; j2++) {
25997
- var p = params[j2].trim().split("=");
25998
- if (p[0] === "q") {
25999
- q3 = parseFloat(p[1]);
25927
+ var p2 = params[j2].trim().split("=");
25928
+ if (p2[0] === "q") {
25929
+ q2 = parseFloat(p2[1]);
26000
25930
  break;
26001
25931
  }
26002
25932
  }
26003
25933
  }
26004
25934
  return {
26005
25935
  charset,
26006
- q: q3,
25936
+ q: q2,
26007
25937
  i
26008
25938
  };
26009
25939
  }
@@ -26086,20 +26016,20 @@ var require_encoding = __commonJS((exports, module) => {
26086
26016
  if (!match)
26087
26017
  return null;
26088
26018
  var encoding = match[1];
26089
- var q3 = 1;
26019
+ var q2 = 1;
26090
26020
  if (match[2]) {
26091
26021
  var params = match[2].split(";");
26092
26022
  for (var j2 = 0;j2 < params.length; j2++) {
26093
- var p = params[j2].trim().split("=");
26094
- if (p[0] === "q") {
26095
- q3 = parseFloat(p[1]);
26023
+ var p2 = params[j2].trim().split("=");
26024
+ if (p2[0] === "q") {
26025
+ q2 = parseFloat(p2[1]);
26096
26026
  break;
26097
26027
  }
26098
26028
  }
26099
26029
  }
26100
26030
  return {
26101
26031
  encoding,
26102
- q: q3,
26032
+ q: q2,
26103
26033
  i
26104
26034
  };
26105
26035
  }
@@ -26190,19 +26120,19 @@ var require_language = __commonJS((exports, module) => {
26190
26120
  var full = prefix;
26191
26121
  if (suffix)
26192
26122
  full += "-" + suffix;
26193
- var q3 = 1;
26123
+ var q2 = 1;
26194
26124
  if (match[3]) {
26195
26125
  var params = match[3].split(";");
26196
26126
  for (var j2 = 0;j2 < params.length; j2++) {
26197
- var p = params[j2].split("=");
26198
- if (p[0] === "q")
26199
- q3 = parseFloat(p[1]);
26127
+ var p2 = params[j2].split("=");
26128
+ if (p2[0] === "q")
26129
+ q2 = parseFloat(p2[1]);
26200
26130
  }
26201
26131
  }
26202
26132
  return {
26203
26133
  prefix,
26204
26134
  suffix,
26205
- q: q3,
26135
+ q: q2,
26206
26136
  i,
26207
26137
  full
26208
26138
  };
@@ -26218,15 +26148,15 @@ var require_language = __commonJS((exports, module) => {
26218
26148
  return priority;
26219
26149
  }
26220
26150
  function specify(language, spec, index) {
26221
- var p = parseLanguage(language);
26222
- if (!p)
26151
+ var p2 = parseLanguage(language);
26152
+ if (!p2)
26223
26153
  return null;
26224
26154
  var s = 0;
26225
- if (spec.full.toLowerCase() === p.full.toLowerCase()) {
26155
+ if (spec.full.toLowerCase() === p2.full.toLowerCase()) {
26226
26156
  s |= 4;
26227
- } else if (spec.prefix.toLowerCase() === p.full.toLowerCase()) {
26157
+ } else if (spec.prefix.toLowerCase() === p2.full.toLowerCase()) {
26228
26158
  s |= 2;
26229
- } else if (spec.full.toLowerCase() === p.prefix.toLowerCase()) {
26159
+ } else if (spec.full.toLowerCase() === p2.prefix.toLowerCase()) {
26230
26160
  s |= 1;
26231
26161
  } else if (spec.full !== "*") {
26232
26162
  return null;
@@ -26282,7 +26212,7 @@ var require_mediaType = __commonJS((exports, module) => {
26282
26212
  if (!match)
26283
26213
  return null;
26284
26214
  var params = Object.create(null);
26285
- var q3 = 1;
26215
+ var q2 = 1;
26286
26216
  var subtype = match[2];
26287
26217
  var type = match[1];
26288
26218
  if (match[3]) {
@@ -26293,7 +26223,7 @@ var require_mediaType = __commonJS((exports, module) => {
26293
26223
  var val = pair[1];
26294
26224
  var value = val && val[0] === '"' && val[val.length - 1] === '"' ? val.slice(1, -1) : val;
26295
26225
  if (key === "q") {
26296
- q3 = parseFloat(value);
26226
+ q2 = parseFloat(value);
26297
26227
  break;
26298
26228
  }
26299
26229
  params[key] = value;
@@ -26303,7 +26233,7 @@ var require_mediaType = __commonJS((exports, module) => {
26303
26233
  type,
26304
26234
  subtype,
26305
26235
  params,
26306
- q: q3,
26236
+ q: q2,
26307
26237
  i
26308
26238
  };
26309
26239
  }
@@ -26318,25 +26248,25 @@ var require_mediaType = __commonJS((exports, module) => {
26318
26248
  return priority;
26319
26249
  }
26320
26250
  function specify(type, spec, index) {
26321
- var p = parseMediaType(type);
26251
+ var p2 = parseMediaType(type);
26322
26252
  var s = 0;
26323
- if (!p) {
26253
+ if (!p2) {
26324
26254
  return null;
26325
26255
  }
26326
- if (spec.type.toLowerCase() == p.type.toLowerCase()) {
26256
+ if (spec.type.toLowerCase() == p2.type.toLowerCase()) {
26327
26257
  s |= 4;
26328
26258
  } else if (spec.type != "*") {
26329
26259
  return null;
26330
26260
  }
26331
- if (spec.subtype.toLowerCase() == p.subtype.toLowerCase()) {
26261
+ if (spec.subtype.toLowerCase() == p2.subtype.toLowerCase()) {
26332
26262
  s |= 2;
26333
26263
  } else if (spec.subtype != "*") {
26334
26264
  return null;
26335
26265
  }
26336
26266
  var keys = Object.keys(spec.params);
26337
26267
  if (keys.length > 0) {
26338
- if (keys.every(function(k3) {
26339
- return spec.params[k3] == "*" || (spec.params[k3] || "").toLowerCase() == (p.params[k3] || "").toLowerCase();
26268
+ if (keys.every(function(k2) {
26269
+ return spec.params[k2] == "*" || (spec.params[k2] || "").toLowerCase() == (p2.params[k2] || "").toLowerCase();
26340
26270
  })) {
26341
26271
  s |= 1;
26342
26272
  } else {
@@ -27554,15 +27484,15 @@ var require_send = __commonJS((exports, module) => {
27554
27484
  if (self._extensions.length <= i) {
27555
27485
  return err ? self.onStatError(err) : self.error(404);
27556
27486
  }
27557
- var p = path2 + "." + self._extensions[i++];
27558
- debug('stat "%s"', p);
27559
- fs.stat(p, function(err2, stat) {
27487
+ var p2 = path2 + "." + self._extensions[i++];
27488
+ debug('stat "%s"', p2);
27489
+ fs.stat(p2, function(err2, stat) {
27560
27490
  if (err2)
27561
27491
  return next(err2);
27562
27492
  if (stat.isDirectory())
27563
27493
  return next();
27564
- self.emit("file", p, stat);
27565
- self.send(p, stat);
27494
+ self.emit("file", p2, stat);
27495
+ self.send(p2, stat);
27566
27496
  });
27567
27497
  }
27568
27498
  };
@@ -27575,15 +27505,15 @@ var require_send = __commonJS((exports, module) => {
27575
27505
  return self.onStatError(err);
27576
27506
  return self.error(404);
27577
27507
  }
27578
- var p = join(path2, self._index[i]);
27579
- debug('stat "%s"', p);
27580
- fs.stat(p, function(err2, stat) {
27508
+ var p2 = join(path2, self._index[i]);
27509
+ debug('stat "%s"', p2);
27510
+ fs.stat(p2, function(err2, stat) {
27581
27511
  if (err2)
27582
27512
  return next(err2);
27583
27513
  if (stat.isDirectory())
27584
27514
  return next();
27585
- self.emit("file", p, stat);
27586
- self.send(p, stat);
27515
+ self.emit("file", p2, stat);
27516
+ self.send(p2, stat);
27587
27517
  });
27588
27518
  }
27589
27519
  next();
@@ -28059,8 +27989,8 @@ var require_response = __commonJS((exports, module) => {
28059
27989
  return this.sendFile(fullPath, opts, done);
28060
27990
  };
28061
27991
  res.contentType = res.type = function contentType(type) {
28062
- var ct2 = type.indexOf("/") === -1 ? mime.contentType(type) || "application/octet-stream" : type;
28063
- return this.set("Content-Type", ct2);
27992
+ var ct = type.indexOf("/") === -1 ? mime.contentType(type) || "application/octet-stream" : type;
27993
+ return this.set("Content-Type", ct);
28064
27994
  };
28065
27995
  res.format = function(obj) {
28066
27996
  var req = this.req;
@@ -28174,8 +28104,8 @@ var require_response = __commonJS((exports, module) => {
28174
28104
  body = statuses.message[status] + ". Redirecting to " + address;
28175
28105
  },
28176
28106
  html: function() {
28177
- var u = escapeHtml(address);
28178
- body = "<p>" + statuses.message[status] + ". Redirecting to " + u + "</p>";
28107
+ var u2 = escapeHtml(address);
28108
+ body = "<p>" + statuses.message[status] + ". Redirecting to " + u2 + "</p>";
28179
28109
  },
28180
28110
  default: function() {
28181
28111
  body = "";
@@ -28277,8 +28207,8 @@ var require_response = __commonJS((exports, module) => {
28277
28207
  var obj = options.headers;
28278
28208
  var keys = Object.keys(obj);
28279
28209
  for (var i = 0;i < keys.length; i++) {
28280
- var k3 = keys[i];
28281
- res3.setHeader(k3, obj[k3]);
28210
+ var k2 = keys[i];
28211
+ res3.setHeader(k2, obj[k2]);
28282
28212
  }
28283
28213
  });
28284
28214
  }
@@ -28287,8 +28217,8 @@ var require_response = __commonJS((exports, module) => {
28287
28217
  function stringify(value, replacer, spaces, escape2) {
28288
28218
  var json = replacer || spaces ? JSON.stringify(value, replacer, spaces) : JSON.stringify(value);
28289
28219
  if (escape2 && typeof json === "string") {
28290
- json = json.replace(/[<>&]/g, function(c) {
28291
- switch (c.charCodeAt(0)) {
28220
+ json = json.replace(/[<>&]/g, function(c2) {
28221
+ switch (c2.charCodeAt(0)) {
28292
28222
  case 60:
28293
28223
  return "\\u003c";
28294
28224
  case 62:
@@ -28296,7 +28226,7 @@ var require_response = __commonJS((exports, module) => {
28296
28226
  case 38:
28297
28227
  return "\\u0026";
28298
28228
  default:
28299
- return c;
28229
+ return c2;
28300
28230
  }
28301
28231
  });
28302
28232
  }
@@ -28479,246 +28409,459 @@ var require_express2 = __commonJS((exports, module) => {
28479
28409
  });
28480
28410
 
28481
28411
  // node_modules/@clack/core/dist/index.mjs
28482
- var import_picocolors = __toESM(require_picocolors(), 1);
28483
- var import_sisteransi = __toESM(require_src(), 1);
28484
- import { stdout as R, stdin as q } from "process";
28485
- import * as k from "readline";
28486
- import ot from "readline";
28487
- import { ReadStream as J } from "tty";
28488
- var at = (t) => t === 161 || t === 164 || t === 167 || t === 168 || t === 170 || t === 173 || t === 174 || t >= 176 && t <= 180 || t >= 182 && t <= 186 || t >= 188 && t <= 191 || t === 198 || t === 208 || t === 215 || t === 216 || t >= 222 && t <= 225 || t === 230 || t >= 232 && t <= 234 || t === 236 || t === 237 || t === 240 || t === 242 || t === 243 || t >= 247 && t <= 250 || t === 252 || t === 254 || t === 257 || t === 273 || t === 275 || t === 283 || t === 294 || t === 295 || t === 299 || t >= 305 && t <= 307 || t === 312 || t >= 319 && t <= 322 || t === 324 || t >= 328 && t <= 331 || t === 333 || t === 338 || t === 339 || t === 358 || t === 359 || t === 363 || t === 462 || t === 464 || t === 466 || t === 468 || t === 470 || t === 472 || t === 474 || t === 476 || t === 593 || t === 609 || t === 708 || t === 711 || t >= 713 && t <= 715 || t === 717 || t === 720 || t >= 728 && t <= 731 || t === 733 || t === 735 || t >= 768 && t <= 879 || t >= 913 && t <= 929 || t >= 931 && t <= 937 || t >= 945 && t <= 961 || t >= 963 && t <= 969 || t === 1025 || t >= 1040 && t <= 1103 || t === 1105 || t === 8208 || t >= 8211 && t <= 8214 || t === 8216 || t === 8217 || t === 8220 || t === 8221 || t >= 8224 && t <= 8226 || t >= 8228 && t <= 8231 || t === 8240 || t === 8242 || t === 8243 || t === 8245 || t === 8251 || t === 8254 || t === 8308 || t === 8319 || t >= 8321 && t <= 8324 || t === 8364 || t === 8451 || t === 8453 || t === 8457 || t === 8467 || t === 8470 || t === 8481 || t === 8482 || t === 8486 || t === 8491 || t === 8531 || t === 8532 || t >= 8539 && t <= 8542 || t >= 8544 && t <= 8555 || t >= 8560 && t <= 8569 || t === 8585 || t >= 8592 && t <= 8601 || t === 8632 || t === 8633 || t === 8658 || t === 8660 || t === 8679 || t === 8704 || t === 8706 || t === 8707 || t === 8711 || t === 8712 || t === 8715 || t === 8719 || t === 8721 || t === 8725 || t === 8730 || t >= 8733 && t <= 8736 || t === 8739 || t === 8741 || t >= 8743 && t <= 8748 || t === 8750 || t >= 8756 && t <= 8759 || t === 8764 || t === 8765 || t === 8776 || t === 8780 || t === 8786 || t === 8800 || t === 8801 || t >= 8804 && t <= 8807 || t === 8810 || t === 8811 || t === 8814 || t === 8815 || t === 8834 || t === 8835 || t === 8838 || t === 8839 || t === 8853 || t === 8857 || t === 8869 || t === 8895 || t === 8978 || t >= 9312 && t <= 9449 || t >= 9451 && t <= 9547 || t >= 9552 && t <= 9587 || t >= 9600 && t <= 9615 || t >= 9618 && t <= 9621 || t === 9632 || t === 9633 || t >= 9635 && t <= 9641 || t === 9650 || t === 9651 || t === 9654 || t === 9655 || t === 9660 || t === 9661 || t === 9664 || t === 9665 || t >= 9670 && t <= 9672 || t === 9675 || t >= 9678 && t <= 9681 || t >= 9698 && t <= 9701 || t === 9711 || t === 9733 || t === 9734 || t === 9737 || t === 9742 || t === 9743 || t === 9756 || t === 9758 || t === 9792 || t === 9794 || t === 9824 || t === 9825 || t >= 9827 && t <= 9829 || t >= 9831 && t <= 9834 || t === 9836 || t === 9837 || t === 9839 || t === 9886 || t === 9887 || t === 9919 || t >= 9926 && t <= 9933 || t >= 9935 && t <= 9939 || t >= 9941 && t <= 9953 || t === 9955 || t === 9960 || t === 9961 || t >= 9963 && t <= 9969 || t === 9972 || t >= 9974 && t <= 9977 || t === 9979 || t === 9980 || t === 9982 || t === 9983 || t === 10045 || t >= 10102 && t <= 10111 || t >= 11094 && t <= 11097 || t >= 12872 && t <= 12879 || t >= 57344 && t <= 63743 || t >= 65024 && t <= 65039 || t === 65533 || t >= 127232 && t <= 127242 || t >= 127248 && t <= 127277 || t >= 127280 && t <= 127337 || t >= 127344 && t <= 127373 || t === 127375 || t === 127376 || t >= 127387 && t <= 127404 || t >= 917760 && t <= 917999 || t >= 983040 && t <= 1048573 || t >= 1048576 && t <= 1114109;
28489
- var lt = (t) => t === 12288 || t >= 65281 && t <= 65376 || t >= 65504 && t <= 65510;
28490
- var ht = (t) => t >= 4352 && t <= 4447 || t === 8986 || t === 8987 || t === 9001 || t === 9002 || t >= 9193 && t <= 9196 || t === 9200 || t === 9203 || t === 9725 || t === 9726 || t === 9748 || t === 9749 || t >= 9800 && t <= 9811 || t === 9855 || t === 9875 || t === 9889 || t === 9898 || t === 9899 || t === 9917 || t === 9918 || t === 9924 || t === 9925 || t === 9934 || t === 9940 || t === 9962 || t === 9970 || t === 9971 || t === 9973 || t === 9978 || t === 9981 || t === 9989 || t === 9994 || t === 9995 || t === 10024 || t === 10060 || t === 10062 || t >= 10067 && t <= 10069 || t === 10071 || t >= 10133 && t <= 10135 || t === 10160 || t === 10175 || t === 11035 || t === 11036 || t === 11088 || t === 11093 || t >= 11904 && t <= 11929 || t >= 11931 && t <= 12019 || t >= 12032 && t <= 12245 || t >= 12272 && t <= 12287 || t >= 12289 && t <= 12350 || t >= 12353 && t <= 12438 || t >= 12441 && t <= 12543 || t >= 12549 && t <= 12591 || t >= 12593 && t <= 12686 || t >= 12688 && t <= 12771 || t >= 12783 && t <= 12830 || t >= 12832 && t <= 12871 || t >= 12880 && t <= 19903 || t >= 19968 && t <= 42124 || t >= 42128 && t <= 42182 || t >= 43360 && t <= 43388 || t >= 44032 && t <= 55203 || t >= 63744 && t <= 64255 || t >= 65040 && t <= 65049 || t >= 65072 && t <= 65106 || t >= 65108 && t <= 65126 || t >= 65128 && t <= 65131 || t >= 94176 && t <= 94180 || t === 94192 || t === 94193 || t >= 94208 && t <= 100343 || t >= 100352 && t <= 101589 || t >= 101632 && t <= 101640 || t >= 110576 && t <= 110579 || t >= 110581 && t <= 110587 || t === 110589 || t === 110590 || t >= 110592 && t <= 110882 || t === 110898 || t >= 110928 && t <= 110930 || t === 110933 || t >= 110948 && t <= 110951 || t >= 110960 && t <= 111355 || t === 126980 || t === 127183 || t === 127374 || t >= 127377 && t <= 127386 || t >= 127488 && t <= 127490 || t >= 127504 && t <= 127547 || t >= 127552 && t <= 127560 || t === 127568 || t === 127569 || t >= 127584 && t <= 127589 || t >= 127744 && t <= 127776 || t >= 127789 && t <= 127797 || t >= 127799 && t <= 127868 || t >= 127870 && t <= 127891 || t >= 127904 && t <= 127946 || t >= 127951 && t <= 127955 || t >= 127968 && t <= 127984 || t === 127988 || t >= 127992 && t <= 128062 || t === 128064 || t >= 128066 && t <= 128252 || t >= 128255 && t <= 128317 || t >= 128331 && t <= 128334 || t >= 128336 && t <= 128359 || t === 128378 || t === 128405 || t === 128406 || t === 128420 || t >= 128507 && t <= 128591 || t >= 128640 && t <= 128709 || t === 128716 || t >= 128720 && t <= 128722 || t >= 128725 && t <= 128727 || t >= 128732 && t <= 128735 || t === 128747 || t === 128748 || t >= 128756 && t <= 128764 || t >= 128992 && t <= 129003 || t === 129008 || t >= 129292 && t <= 129338 || t >= 129340 && t <= 129349 || t >= 129351 && t <= 129535 || t >= 129648 && t <= 129660 || t >= 129664 && t <= 129672 || t >= 129680 && t <= 129725 || t >= 129727 && t <= 129733 || t >= 129742 && t <= 129755 || t >= 129760 && t <= 129768 || t >= 129776 && t <= 129784 || t >= 131072 && t <= 196605 || t >= 196608 && t <= 262141;
28491
- var O = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/y;
28492
- var y = /[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y;
28493
- var M = /\t{1,1000}/y;
28494
- var P = /[\u{1F1E6}-\u{1F1FF}]{2}|\u{1F3F4}[\u{E0061}-\u{E007A}]{2}[\u{E0030}-\u{E0039}\u{E0061}-\u{E007A}]{1,3}\u{E007F}|(?:\p{Emoji}\uFE0F\u20E3?|\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation})(?:\u200D(?:\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F\u20E3?))*/yu;
28495
- var L = /(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y;
28496
- var ct = /\p{M}+/gu;
28497
- var pt = { limit: 1 / 0, ellipsis: "" };
28498
- var X = (t, e = {}, s = {}) => {
28499
- const i = e.limit ?? 1 / 0, r = e.ellipsis ?? "", n = e?.ellipsisWidth ?? (r ? X(r, pt, s).width : 0), u = s.ansiWidth ?? 0, a = s.controlWidth ?? 0, l = s.tabWidth ?? 8, E = s.ambiguousWidth ?? 1, g = s.emojiWidth ?? 2, m = s.fullWidthWidth ?? 2, A = s.regularWidth ?? 1, V = s.wideWidth ?? 2;
28500
- let h = 0, o = 0, f = t.length, v = 0, F = false, d = f, b = Math.max(0, i - n), C = 0, B = 0, c = 0, p = 0;
28501
- t:
28502
- for (;; ) {
28503
- if (B > C || o >= f && o > h) {
28504
- const ut = t.slice(C, B) || t.slice(h, o);
28505
- v = 0;
28506
- for (const Y of ut.replaceAll(ct, "")) {
28507
- const $ = Y.codePointAt(0) || 0;
28508
- if (lt($) ? p = m : ht($) ? p = V : E !== A && at($) ? p = E : p = A, c + p > b && (d = Math.min(d, Math.max(C, h) + v)), c + p > i) {
28509
- F = true;
28510
- break t;
28412
+ import { styleText as y } from "util";
28413
+ import { stdout as S, stdin as $ } from "process";
28414
+ import * as _ from "readline";
28415
+ import P from "readline";
28416
+
28417
+ // node_modules/fast-string-truncated-width/dist/utils.js
28418
+ var isAmbiguous = (x) => {
28419
+ return x === 161 || x === 164 || x === 167 || x === 168 || x === 170 || x === 173 || x === 174 || x >= 176 && x <= 180 || x >= 182 && x <= 186 || x >= 188 && x <= 191 || x === 198 || x === 208 || x === 215 || x === 216 || x >= 222 && x <= 225 || x === 230 || x >= 232 && x <= 234 || x === 236 || x === 237 || x === 240 || x === 242 || x === 243 || x >= 247 && x <= 250 || x === 252 || x === 254 || x === 257 || x === 273 || x === 275 || x === 283 || x === 294 || x === 295 || x === 299 || x >= 305 && x <= 307 || x === 312 || x >= 319 && x <= 322 || x === 324 || x >= 328 && x <= 331 || x === 333 || x === 338 || x === 339 || x === 358 || x === 359 || x === 363 || x === 462 || x === 464 || x === 466 || x === 468 || x === 470 || x === 472 || x === 474 || x === 476 || x === 593 || x === 609 || x === 708 || x === 711 || x >= 713 && x <= 715 || x === 717 || x === 720 || x >= 728 && x <= 731 || x === 733 || x === 735 || x >= 768 && x <= 879 || x >= 913 && x <= 929 || x >= 931 && x <= 937 || x >= 945 && x <= 961 || x >= 963 && x <= 969 || x === 1025 || x >= 1040 && x <= 1103 || x === 1105 || x === 8208 || x >= 8211 && x <= 8214 || x === 8216 || x === 8217 || x === 8220 || x === 8221 || x >= 8224 && x <= 8226 || x >= 8228 && x <= 8231 || x === 8240 || x === 8242 || x === 8243 || x === 8245 || x === 8251 || x === 8254 || x === 8308 || x === 8319 || x >= 8321 && x <= 8324 || x === 8364 || x === 8451 || x === 8453 || x === 8457 || x === 8467 || x === 8470 || x === 8481 || x === 8482 || x === 8486 || x === 8491 || x === 8531 || x === 8532 || x >= 8539 && x <= 8542 || x >= 8544 && x <= 8555 || x >= 8560 && x <= 8569 || x === 8585 || x >= 8592 && x <= 8601 || x === 8632 || x === 8633 || x === 8658 || x === 8660 || x === 8679 || x === 8704 || x === 8706 || x === 8707 || x === 8711 || x === 8712 || x === 8715 || x === 8719 || x === 8721 || x === 8725 || x === 8730 || x >= 8733 && x <= 8736 || x === 8739 || x === 8741 || x >= 8743 && x <= 8748 || x === 8750 || x >= 8756 && x <= 8759 || x === 8764 || x === 8765 || x === 8776 || x === 8780 || x === 8786 || x === 8800 || x === 8801 || x >= 8804 && x <= 8807 || x === 8810 || x === 8811 || x === 8814 || x === 8815 || x === 8834 || x === 8835 || x === 8838 || x === 8839 || x === 8853 || x === 8857 || x === 8869 || x === 8895 || x === 8978 || x >= 9312 && x <= 9449 || x >= 9451 && x <= 9547 || x >= 9552 && x <= 9587 || x >= 9600 && x <= 9615 || x >= 9618 && x <= 9621 || x === 9632 || x === 9633 || x >= 9635 && x <= 9641 || x === 9650 || x === 9651 || x === 9654 || x === 9655 || x === 9660 || x === 9661 || x === 9664 || x === 9665 || x >= 9670 && x <= 9672 || x === 9675 || x >= 9678 && x <= 9681 || x >= 9698 && x <= 9701 || x === 9711 || x === 9733 || x === 9734 || x === 9737 || x === 9742 || x === 9743 || x === 9756 || x === 9758 || x === 9792 || x === 9794 || x === 9824 || x === 9825 || x >= 9827 && x <= 9829 || x >= 9831 && x <= 9834 || x === 9836 || x === 9837 || x === 9839 || x === 9886 || x === 9887 || x === 9919 || x >= 9926 && x <= 9933 || x >= 9935 && x <= 9939 || x >= 9941 && x <= 9953 || x === 9955 || x === 9960 || x === 9961 || x >= 9963 && x <= 9969 || x === 9972 || x >= 9974 && x <= 9977 || x === 9979 || x === 9980 || x === 9982 || x === 9983 || x === 10045 || x >= 10102 && x <= 10111 || x >= 11094 && x <= 11097 || x >= 12872 && x <= 12879 || x >= 57344 && x <= 63743 || x >= 65024 && x <= 65039 || x === 65533 || x >= 127232 && x <= 127242 || x >= 127248 && x <= 127277 || x >= 127280 && x <= 127337 || x >= 127344 && x <= 127373 || x === 127375 || x === 127376 || x >= 127387 && x <= 127404 || x >= 917760 && x <= 917999 || x >= 983040 && x <= 1048573 || x >= 1048576 && x <= 1114109;
28420
+ };
28421
+ var isFullWidth = (x) => {
28422
+ return x === 12288 || x >= 65281 && x <= 65376 || x >= 65504 && x <= 65510;
28423
+ };
28424
+ var isWide = (x) => {
28425
+ return x >= 4352 && x <= 4447 || x === 8986 || x === 8987 || x === 9001 || x === 9002 || x >= 9193 && x <= 9196 || x === 9200 || x === 9203 || x === 9725 || x === 9726 || x === 9748 || x === 9749 || x >= 9800 && x <= 9811 || x === 9855 || x === 9875 || x === 9889 || x === 9898 || x === 9899 || x === 9917 || x === 9918 || x === 9924 || x === 9925 || x === 9934 || x === 9940 || x === 9962 || x === 9970 || x === 9971 || x === 9973 || x === 9978 || x === 9981 || x === 9989 || x === 9994 || x === 9995 || x === 10024 || x === 10060 || x === 10062 || x >= 10067 && x <= 10069 || x === 10071 || x >= 10133 && x <= 10135 || x === 10160 || x === 10175 || x === 11035 || x === 11036 || x === 11088 || x === 11093 || x >= 11904 && x <= 11929 || x >= 11931 && x <= 12019 || x >= 12032 && x <= 12245 || x >= 12272 && x <= 12287 || x >= 12289 && x <= 12350 || x >= 12353 && x <= 12438 || x >= 12441 && x <= 12543 || x >= 12549 && x <= 12591 || x >= 12593 && x <= 12686 || x >= 12688 && x <= 12771 || x >= 12783 && x <= 12830 || x >= 12832 && x <= 12871 || x >= 12880 && x <= 19903 || x >= 19968 && x <= 42124 || x >= 42128 && x <= 42182 || x >= 43360 && x <= 43388 || x >= 44032 && x <= 55203 || x >= 63744 && x <= 64255 || x >= 65040 && x <= 65049 || x >= 65072 && x <= 65106 || x >= 65108 && x <= 65126 || x >= 65128 && x <= 65131 || x >= 94176 && x <= 94180 || x === 94192 || x === 94193 || x >= 94208 && x <= 100343 || x >= 100352 && x <= 101589 || x >= 101632 && x <= 101640 || x >= 110576 && x <= 110579 || x >= 110581 && x <= 110587 || x === 110589 || x === 110590 || x >= 110592 && x <= 110882 || x === 110898 || x >= 110928 && x <= 110930 || x === 110933 || x >= 110948 && x <= 110951 || x >= 110960 && x <= 111355 || x === 126980 || x === 127183 || x === 127374 || x >= 127377 && x <= 127386 || x >= 127488 && x <= 127490 || x >= 127504 && x <= 127547 || x >= 127552 && x <= 127560 || x === 127568 || x === 127569 || x >= 127584 && x <= 127589 || x >= 127744 && x <= 127776 || x >= 127789 && x <= 127797 || x >= 127799 && x <= 127868 || x >= 127870 && x <= 127891 || x >= 127904 && x <= 127946 || x >= 127951 && x <= 127955 || x >= 127968 && x <= 127984 || x === 127988 || x >= 127992 && x <= 128062 || x === 128064 || x >= 128066 && x <= 128252 || x >= 128255 && x <= 128317 || x >= 128331 && x <= 128334 || x >= 128336 && x <= 128359 || x === 128378 || x === 128405 || x === 128406 || x === 128420 || x >= 128507 && x <= 128591 || x >= 128640 && x <= 128709 || x === 128716 || x >= 128720 && x <= 128722 || x >= 128725 && x <= 128727 || x >= 128732 && x <= 128735 || x === 128747 || x === 128748 || x >= 128756 && x <= 128764 || x >= 128992 && x <= 129003 || x === 129008 || x >= 129292 && x <= 129338 || x >= 129340 && x <= 129349 || x >= 129351 && x <= 129535 || x >= 129648 && x <= 129660 || x >= 129664 && x <= 129672 || x >= 129680 && x <= 129725 || x >= 129727 && x <= 129733 || x >= 129742 && x <= 129755 || x >= 129760 && x <= 129768 || x >= 129776 && x <= 129784 || x >= 131072 && x <= 196605 || x >= 196608 && x <= 262141;
28426
+ };
28427
+
28428
+ // node_modules/fast-string-truncated-width/dist/index.js
28429
+ var ANSI_RE = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/y;
28430
+ var CONTROL_RE = /[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y;
28431
+ var TAB_RE = /\t{1,1000}/y;
28432
+ var EMOJI_RE = /[\u{1F1E6}-\u{1F1FF}]{2}|\u{1F3F4}[\u{E0061}-\u{E007A}]{2}[\u{E0030}-\u{E0039}\u{E0061}-\u{E007A}]{1,3}\u{E007F}|(?:\p{Emoji}\uFE0F\u20E3?|\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation})(?:\u200D(?:\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F\u20E3?))*/yu;
28433
+ var LATIN_RE = /(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y;
28434
+ var MODIFIER_RE = /\p{M}+/gu;
28435
+ var NO_TRUNCATION = { limit: Infinity, ellipsis: "" };
28436
+ var getStringTruncatedWidth = (input, truncationOptions = {}, widthOptions = {}) => {
28437
+ const LIMIT = truncationOptions.limit ?? Infinity;
28438
+ const ELLIPSIS = truncationOptions.ellipsis ?? "";
28439
+ const ELLIPSIS_WIDTH = truncationOptions?.ellipsisWidth ?? (ELLIPSIS ? getStringTruncatedWidth(ELLIPSIS, NO_TRUNCATION, widthOptions).width : 0);
28440
+ const ANSI_WIDTH = widthOptions.ansiWidth ?? 0;
28441
+ const CONTROL_WIDTH = widthOptions.controlWidth ?? 0;
28442
+ const TAB_WIDTH = widthOptions.tabWidth ?? 8;
28443
+ const AMBIGUOUS_WIDTH = widthOptions.ambiguousWidth ?? 1;
28444
+ const EMOJI_WIDTH = widthOptions.emojiWidth ?? 2;
28445
+ const FULL_WIDTH_WIDTH = widthOptions.fullWidthWidth ?? 2;
28446
+ const REGULAR_WIDTH = widthOptions.regularWidth ?? 1;
28447
+ const WIDE_WIDTH = widthOptions.wideWidth ?? 2;
28448
+ let indexPrev = 0;
28449
+ let index = 0;
28450
+ let length = input.length;
28451
+ let lengthExtra = 0;
28452
+ let truncationEnabled = false;
28453
+ let truncationIndex = length;
28454
+ let truncationLimit = Math.max(0, LIMIT - ELLIPSIS_WIDTH);
28455
+ let unmatchedStart = 0;
28456
+ let unmatchedEnd = 0;
28457
+ let width = 0;
28458
+ let widthExtra = 0;
28459
+ outer:
28460
+ while (true) {
28461
+ if (unmatchedEnd > unmatchedStart || index >= length && index > indexPrev) {
28462
+ const unmatched = input.slice(unmatchedStart, unmatchedEnd) || input.slice(indexPrev, index);
28463
+ lengthExtra = 0;
28464
+ for (const char of unmatched.replaceAll(MODIFIER_RE, "")) {
28465
+ const codePoint = char.codePointAt(0) || 0;
28466
+ if (isFullWidth(codePoint)) {
28467
+ widthExtra = FULL_WIDTH_WIDTH;
28468
+ } else if (isWide(codePoint)) {
28469
+ widthExtra = WIDE_WIDTH;
28470
+ } else if (AMBIGUOUS_WIDTH !== REGULAR_WIDTH && isAmbiguous(codePoint)) {
28471
+ widthExtra = AMBIGUOUS_WIDTH;
28472
+ } else {
28473
+ widthExtra = REGULAR_WIDTH;
28511
28474
  }
28512
- v += Y.length, c += p;
28475
+ if (width + widthExtra > truncationLimit) {
28476
+ truncationIndex = Math.min(truncationIndex, Math.max(unmatchedStart, indexPrev) + lengthExtra);
28477
+ }
28478
+ if (width + widthExtra > LIMIT) {
28479
+ truncationEnabled = true;
28480
+ break outer;
28481
+ }
28482
+ lengthExtra += char.length;
28483
+ width += widthExtra;
28513
28484
  }
28514
- C = B = 0;
28485
+ unmatchedStart = unmatchedEnd = 0;
28515
28486
  }
28516
- if (o >= f)
28487
+ if (index >= length)
28517
28488
  break;
28518
- if (L.lastIndex = o, L.test(t)) {
28519
- if (v = L.lastIndex - o, p = v * A, c + p > b && (d = Math.min(d, o + Math.floor((b - c) / A))), c + p > i) {
28520
- F = true;
28489
+ LATIN_RE.lastIndex = index;
28490
+ if (LATIN_RE.test(input)) {
28491
+ lengthExtra = LATIN_RE.lastIndex - index;
28492
+ widthExtra = lengthExtra * REGULAR_WIDTH;
28493
+ if (width + widthExtra > truncationLimit) {
28494
+ truncationIndex = Math.min(truncationIndex, index + Math.floor((truncationLimit - width) / REGULAR_WIDTH));
28495
+ }
28496
+ if (width + widthExtra > LIMIT) {
28497
+ truncationEnabled = true;
28521
28498
  break;
28522
28499
  }
28523
- c += p, C = h, B = o, o = h = L.lastIndex;
28500
+ width += widthExtra;
28501
+ unmatchedStart = indexPrev;
28502
+ unmatchedEnd = index;
28503
+ index = indexPrev = LATIN_RE.lastIndex;
28524
28504
  continue;
28525
28505
  }
28526
- if (O.lastIndex = o, O.test(t)) {
28527
- if (c + u > b && (d = Math.min(d, o)), c + u > i) {
28528
- F = true;
28506
+ ANSI_RE.lastIndex = index;
28507
+ if (ANSI_RE.test(input)) {
28508
+ if (width + ANSI_WIDTH > truncationLimit) {
28509
+ truncationIndex = Math.min(truncationIndex, index);
28510
+ }
28511
+ if (width + ANSI_WIDTH > LIMIT) {
28512
+ truncationEnabled = true;
28529
28513
  break;
28530
28514
  }
28531
- c += u, C = h, B = o, o = h = O.lastIndex;
28515
+ width += ANSI_WIDTH;
28516
+ unmatchedStart = indexPrev;
28517
+ unmatchedEnd = index;
28518
+ index = indexPrev = ANSI_RE.lastIndex;
28532
28519
  continue;
28533
28520
  }
28534
- if (y.lastIndex = o, y.test(t)) {
28535
- if (v = y.lastIndex - o, p = v * a, c + p > b && (d = Math.min(d, o + Math.floor((b - c) / a))), c + p > i) {
28536
- F = true;
28521
+ CONTROL_RE.lastIndex = index;
28522
+ if (CONTROL_RE.test(input)) {
28523
+ lengthExtra = CONTROL_RE.lastIndex - index;
28524
+ widthExtra = lengthExtra * CONTROL_WIDTH;
28525
+ if (width + widthExtra > truncationLimit) {
28526
+ truncationIndex = Math.min(truncationIndex, index + Math.floor((truncationLimit - width) / CONTROL_WIDTH));
28527
+ }
28528
+ if (width + widthExtra > LIMIT) {
28529
+ truncationEnabled = true;
28537
28530
  break;
28538
28531
  }
28539
- c += p, C = h, B = o, o = h = y.lastIndex;
28532
+ width += widthExtra;
28533
+ unmatchedStart = indexPrev;
28534
+ unmatchedEnd = index;
28535
+ index = indexPrev = CONTROL_RE.lastIndex;
28540
28536
  continue;
28541
28537
  }
28542
- if (M.lastIndex = o, M.test(t)) {
28543
- if (v = M.lastIndex - o, p = v * l, c + p > b && (d = Math.min(d, o + Math.floor((b - c) / l))), c + p > i) {
28544
- F = true;
28538
+ TAB_RE.lastIndex = index;
28539
+ if (TAB_RE.test(input)) {
28540
+ lengthExtra = TAB_RE.lastIndex - index;
28541
+ widthExtra = lengthExtra * TAB_WIDTH;
28542
+ if (width + widthExtra > truncationLimit) {
28543
+ truncationIndex = Math.min(truncationIndex, index + Math.floor((truncationLimit - width) / TAB_WIDTH));
28544
+ }
28545
+ if (width + widthExtra > LIMIT) {
28546
+ truncationEnabled = true;
28545
28547
  break;
28546
28548
  }
28547
- c += p, C = h, B = o, o = h = M.lastIndex;
28549
+ width += widthExtra;
28550
+ unmatchedStart = indexPrev;
28551
+ unmatchedEnd = index;
28552
+ index = indexPrev = TAB_RE.lastIndex;
28548
28553
  continue;
28549
28554
  }
28550
- if (P.lastIndex = o, P.test(t)) {
28551
- if (c + g > b && (d = Math.min(d, o)), c + g > i) {
28552
- F = true;
28555
+ EMOJI_RE.lastIndex = index;
28556
+ if (EMOJI_RE.test(input)) {
28557
+ if (width + EMOJI_WIDTH > truncationLimit) {
28558
+ truncationIndex = Math.min(truncationIndex, index);
28559
+ }
28560
+ if (width + EMOJI_WIDTH > LIMIT) {
28561
+ truncationEnabled = true;
28553
28562
  break;
28554
28563
  }
28555
- c += g, C = h, B = o, o = h = P.lastIndex;
28564
+ width += EMOJI_WIDTH;
28565
+ unmatchedStart = indexPrev;
28566
+ unmatchedEnd = index;
28567
+ index = indexPrev = EMOJI_RE.lastIndex;
28556
28568
  continue;
28557
28569
  }
28558
- o += 1;
28570
+ index += 1;
28559
28571
  }
28560
- return { width: F ? b : c, index: F ? d : f, truncated: F, ellipsed: F && i >= n };
28572
+ return {
28573
+ width: truncationEnabled ? truncationLimit : width,
28574
+ index: truncationEnabled ? truncationIndex : length,
28575
+ truncated: truncationEnabled,
28576
+ ellipsed: truncationEnabled && LIMIT >= ELLIPSIS_WIDTH
28577
+ };
28578
+ };
28579
+ var dist_default = getStringTruncatedWidth;
28580
+
28581
+ // node_modules/fast-string-width/dist/index.js
28582
+ var NO_TRUNCATION2 = {
28583
+ limit: Infinity,
28584
+ ellipsis: "",
28585
+ ellipsisWidth: 0
28586
+ };
28587
+ var fastStringWidth = (input, options = {}) => {
28588
+ return dist_default(input, NO_TRUNCATION2, options).width;
28561
28589
  };
28562
- var ft = { limit: 1 / 0, ellipsis: "", ellipsisWidth: 0 };
28563
- var S = (t, e = {}) => X(t, ft, e).width;
28564
- var W = "\x1B";
28565
- var Z = "\x9B";
28566
- var Ft = 39;
28567
- var j = "\x07";
28568
- var Q = "[";
28569
- var dt = "]";
28570
- var tt = "m";
28571
- var U = `${dt}8;;`;
28572
- var et = new RegExp(`(?:\\${Q}(?<code>\\d+)m|\\${U}(?<uri>.*)${j})`, "y");
28573
- var mt = (t) => {
28574
- if (t >= 30 && t <= 37 || t >= 90 && t <= 97)
28590
+ var dist_default2 = fastStringWidth;
28591
+
28592
+ // node_modules/fast-wrap-ansi/lib/main.js
28593
+ var ESC = "\x1B";
28594
+ var CSI = "\x9B";
28595
+ var END_CODE = 39;
28596
+ var ANSI_ESCAPE_BELL = "\x07";
28597
+ var ANSI_CSI = "[";
28598
+ var ANSI_OSC = "]";
28599
+ var ANSI_SGR_TERMINATOR = "m";
28600
+ var ANSI_ESCAPE_LINK = `${ANSI_OSC}8;;`;
28601
+ var GROUP_REGEX = new RegExp(`(?:\\${ANSI_CSI}(?<code>\\d+)m|\\${ANSI_ESCAPE_LINK}(?<uri>.*)${ANSI_ESCAPE_BELL})`, "y");
28602
+ var getClosingCode = (openingCode) => {
28603
+ if (openingCode >= 30 && openingCode <= 37)
28604
+ return 39;
28605
+ if (openingCode >= 90 && openingCode <= 97)
28575
28606
  return 39;
28576
- if (t >= 40 && t <= 47 || t >= 100 && t <= 107)
28607
+ if (openingCode >= 40 && openingCode <= 47)
28608
+ return 49;
28609
+ if (openingCode >= 100 && openingCode <= 107)
28577
28610
  return 49;
28578
- if (t === 1 || t === 2)
28611
+ if (openingCode === 1 || openingCode === 2)
28579
28612
  return 22;
28580
- if (t === 3)
28613
+ if (openingCode === 3)
28581
28614
  return 23;
28582
- if (t === 4)
28615
+ if (openingCode === 4)
28583
28616
  return 24;
28584
- if (t === 7)
28617
+ if (openingCode === 7)
28585
28618
  return 27;
28586
- if (t === 8)
28619
+ if (openingCode === 8)
28587
28620
  return 28;
28588
- if (t === 9)
28621
+ if (openingCode === 9)
28589
28622
  return 29;
28590
- if (t === 0)
28623
+ if (openingCode === 0)
28591
28624
  return 0;
28625
+ return;
28592
28626
  };
28593
- var st = (t) => `${W}${Q}${t}${tt}`;
28594
- var it = (t) => `${W}${U}${t}${j}`;
28595
- var gt = (t) => t.map((e) => S(e));
28596
- var G = (t, e, s) => {
28597
- const i = e[Symbol.iterator]();
28598
- let r = false, n = false, u = t.at(-1), a = u === undefined ? 0 : S(u), l = i.next(), E = i.next(), g = 0;
28599
- for (;!l.done; ) {
28600
- const m = l.value, A = S(m);
28601
- a + A <= s ? t[t.length - 1] += m : (t.push(m), a = 0), (m === W || m === Z) && (r = true, n = e.startsWith(U, g + 1)), r ? n ? m === j && (r = false, n = false) : m === tt && (r = false) : (a += A, a === s && !E.done && (t.push(""), a = 0)), l = E, E = i.next(), g += m.length;
28602
- }
28603
- u = t.at(-1), !a && u !== undefined && u.length > 0 && t.length > 1 && (t[t.length - 2] += t.pop());
28627
+ var wrapAnsiCode = (code) => `${ESC}${ANSI_CSI}${code}${ANSI_SGR_TERMINATOR}`;
28628
+ var wrapAnsiHyperlink = (url) => `${ESC}${ANSI_ESCAPE_LINK}${url}${ANSI_ESCAPE_BELL}`;
28629
+ var wrapWord = (rows, word, columns) => {
28630
+ const characters = word[Symbol.iterator]();
28631
+ let isInsideEscape = false;
28632
+ let isInsideLinkEscape = false;
28633
+ let lastRow = rows.at(-1);
28634
+ let visible = lastRow === undefined ? 0 : dist_default2(lastRow);
28635
+ let currentCharacter = characters.next();
28636
+ let nextCharacter = characters.next();
28637
+ let rawCharacterIndex = 0;
28638
+ while (!currentCharacter.done) {
28639
+ const character = currentCharacter.value;
28640
+ const characterLength = dist_default2(character);
28641
+ if (visible + characterLength <= columns) {
28642
+ rows[rows.length - 1] += character;
28643
+ } else {
28644
+ rows.push(character);
28645
+ visible = 0;
28646
+ }
28647
+ if (character === ESC || character === CSI) {
28648
+ isInsideEscape = true;
28649
+ isInsideLinkEscape = word.startsWith(ANSI_ESCAPE_LINK, rawCharacterIndex + 1);
28650
+ }
28651
+ if (isInsideEscape) {
28652
+ if (isInsideLinkEscape) {
28653
+ if (character === ANSI_ESCAPE_BELL) {
28654
+ isInsideEscape = false;
28655
+ isInsideLinkEscape = false;
28656
+ }
28657
+ } else if (character === ANSI_SGR_TERMINATOR) {
28658
+ isInsideEscape = false;
28659
+ }
28660
+ } else {
28661
+ visible += characterLength;
28662
+ if (visible === columns && !nextCharacter.done) {
28663
+ rows.push("");
28664
+ visible = 0;
28665
+ }
28666
+ }
28667
+ currentCharacter = nextCharacter;
28668
+ nextCharacter = characters.next();
28669
+ rawCharacterIndex += character.length;
28670
+ }
28671
+ lastRow = rows.at(-1);
28672
+ if (!visible && lastRow !== undefined && lastRow.length && rows.length > 1) {
28673
+ rows[rows.length - 2] += rows.pop();
28674
+ }
28604
28675
  };
28605
- var vt = (t) => {
28606
- const e = t.split(" ");
28607
- let s = e.length;
28608
- for (;s > 0 && !(S(e[s - 1]) > 0); )
28609
- s--;
28610
- return s === e.length ? t : e.slice(0, s).join(" ") + e.slice(s).join("");
28676
+ var stringVisibleTrimSpacesRight = (string) => {
28677
+ const words = string.split(" ");
28678
+ let last = words.length;
28679
+ while (last) {
28680
+ if (dist_default2(words[last - 1])) {
28681
+ break;
28682
+ }
28683
+ last--;
28684
+ }
28685
+ if (last === words.length) {
28686
+ return string;
28687
+ }
28688
+ return words.slice(0, last).join(" ") + words.slice(last).join("");
28611
28689
  };
28612
- var Et = (t, e, s = {}) => {
28613
- if (s.trim !== false && t.trim() === "")
28690
+ var exec = (string, columns, options = {}) => {
28691
+ if (options.trim !== false && string.trim() === "") {
28614
28692
  return "";
28615
- let i = "", r, n;
28616
- const u = t.split(" "), a = gt(u);
28617
- let l = [""];
28618
- for (const [h, o] of u.entries()) {
28619
- s.trim !== false && (l[l.length - 1] = (l.at(-1) ?? "").trimStart());
28620
- let f = S(l.at(-1) ?? "");
28621
- if (h !== 0 && (f >= e && (s.wordWrap === false || s.trim === false) && (l.push(""), f = 0), (f > 0 || s.trim === false) && (l[l.length - 1] += " ", f++)), s.hard && a[h] > e) {
28622
- const v = e - f, F = 1 + Math.floor((a[h] - v - 1) / e);
28623
- Math.floor((a[h] - 1) / e) < F && l.push(""), G(l, o, e);
28693
+ }
28694
+ let returnValue = "";
28695
+ let escapeCode;
28696
+ let escapeUrl;
28697
+ const words = string.split(" ");
28698
+ let rows = [""];
28699
+ let rowLength = 0;
28700
+ for (let index = 0;index < words.length; index++) {
28701
+ const word = words[index];
28702
+ if (options.trim !== false) {
28703
+ const row = rows.at(-1) ?? "";
28704
+ const trimmed = row.trimStart();
28705
+ if (row.length !== trimmed.length) {
28706
+ rows[rows.length - 1] = trimmed;
28707
+ rowLength = dist_default2(trimmed);
28708
+ }
28709
+ }
28710
+ if (index !== 0) {
28711
+ if (rowLength >= columns && (options.wordWrap === false || options.trim === false)) {
28712
+ rows.push("");
28713
+ rowLength = 0;
28714
+ }
28715
+ if (rowLength || options.trim === false) {
28716
+ rows[rows.length - 1] += " ";
28717
+ rowLength++;
28718
+ }
28719
+ }
28720
+ const wordLength = dist_default2(word);
28721
+ if (options.hard && wordLength > columns) {
28722
+ const remainingColumns = columns - rowLength;
28723
+ const breaksStartingThisLine = 1 + Math.floor((wordLength - remainingColumns - 1) / columns);
28724
+ const breaksStartingNextLine = Math.floor((wordLength - 1) / columns);
28725
+ if (breaksStartingNextLine < breaksStartingThisLine) {
28726
+ rows.push("");
28727
+ }
28728
+ wrapWord(rows, word, columns);
28729
+ rowLength = dist_default2(rows.at(-1) ?? "");
28624
28730
  continue;
28625
28731
  }
28626
- if (f + a[h] > e && f > 0 && a[h] > 0) {
28627
- if (s.wordWrap === false && f < e) {
28628
- G(l, o, e);
28732
+ if (rowLength + wordLength > columns && rowLength && wordLength) {
28733
+ if (options.wordWrap === false && rowLength < columns) {
28734
+ wrapWord(rows, word, columns);
28735
+ rowLength = dist_default2(rows.at(-1) ?? "");
28629
28736
  continue;
28630
28737
  }
28631
- l.push("");
28738
+ rows.push("");
28739
+ rowLength = 0;
28632
28740
  }
28633
- if (f + a[h] > e && s.wordWrap === false) {
28634
- G(l, o, e);
28741
+ if (rowLength + wordLength > columns && options.wordWrap === false) {
28742
+ wrapWord(rows, word, columns);
28743
+ rowLength = dist_default2(rows.at(-1) ?? "");
28635
28744
  continue;
28636
28745
  }
28637
- l[l.length - 1] += o;
28638
- }
28639
- s.trim !== false && (l = l.map((h) => vt(h)));
28640
- const E = l.join(`
28641
- `), g = E[Symbol.iterator]();
28642
- let m = g.next(), A = g.next(), V = 0;
28643
- for (;!m.done; ) {
28644
- const h = m.value, o = A.value;
28645
- if (i += h, h === W || h === Z) {
28646
- et.lastIndex = V + 1;
28647
- const F = et.exec(E)?.groups;
28648
- if (F?.code !== undefined) {
28649
- const d = Number.parseFloat(F.code);
28650
- r = d === Ft ? undefined : d;
28651
- } else
28652
- F?.uri !== undefined && (n = F.uri.length === 0 ? undefined : F.uri);
28746
+ rows[rows.length - 1] += word;
28747
+ rowLength += wordLength;
28748
+ }
28749
+ if (options.trim !== false) {
28750
+ rows = rows.map((row) => stringVisibleTrimSpacesRight(row));
28751
+ }
28752
+ const preString = rows.join(`
28753
+ `);
28754
+ let inSurrogate = false;
28755
+ for (let i = 0;i < preString.length; i++) {
28756
+ const character = preString[i];
28757
+ returnValue += character;
28758
+ if (!inSurrogate) {
28759
+ inSurrogate = character >= "\uD800" && character <= "\uDBFF";
28760
+ } else {
28761
+ continue;
28762
+ }
28763
+ if (character === ESC || character === CSI) {
28764
+ GROUP_REGEX.lastIndex = i + 1;
28765
+ const groupsResult = GROUP_REGEX.exec(preString);
28766
+ const groups = groupsResult?.groups;
28767
+ if (groups?.code !== undefined) {
28768
+ const code = Number.parseFloat(groups.code);
28769
+ escapeCode = code === END_CODE ? undefined : code;
28770
+ } else if (groups?.uri !== undefined) {
28771
+ escapeUrl = groups.uri.length === 0 ? undefined : groups.uri;
28772
+ }
28773
+ }
28774
+ if (preString[i + 1] === `
28775
+ `) {
28776
+ if (escapeUrl) {
28777
+ returnValue += wrapAnsiHyperlink("");
28778
+ }
28779
+ const closingCode = escapeCode ? getClosingCode(escapeCode) : undefined;
28780
+ if (escapeCode && closingCode) {
28781
+ returnValue += wrapAnsiCode(closingCode);
28782
+ }
28783
+ } else if (character === `
28784
+ `) {
28785
+ if (escapeCode && getClosingCode(escapeCode)) {
28786
+ returnValue += wrapAnsiCode(escapeCode);
28787
+ }
28788
+ if (escapeUrl) {
28789
+ returnValue += wrapAnsiHyperlink(escapeUrl);
28790
+ }
28653
28791
  }
28654
- const f = r ? mt(r) : undefined;
28655
- o === `
28656
- ` ? (n && (i += it("")), r && f && (i += st(f))) : h === `
28657
- ` && (r && f && (i += st(r)), n && (i += it(n))), V += h.length, m = A, A = g.next();
28658
28792
  }
28659
- return i;
28793
+ return returnValue;
28660
28794
  };
28661
- function K(t, e, s) {
28662
- return String(t).normalize().replaceAll(`\r
28663
- `, `
28664
- `).split(`
28665
- `).map((i) => Et(i, e, s)).join(`
28795
+ var CRLF_OR_LF = /\r?\n/;
28796
+ function wrapAnsi(string, columns, options) {
28797
+ return String(string).normalize().split(CRLF_OR_LF).map((line) => exec(line, columns, options)).join(`
28666
28798
  `);
28667
28799
  }
28668
- var At = ["up", "down", "left", "right", "space", "enter", "cancel"];
28669
- var _ = { actions: new Set(At), aliases: new Map([["k", "up"], ["j", "down"], ["h", "left"], ["l", "right"], ["\x03", "cancel"], ["escape", "cancel"]]), messages: { cancel: "Canceled", error: "Something went wrong" }, withGuide: true };
28670
- function H(t, e) {
28671
- if (typeof t == "string")
28672
- return _.aliases.get(t) === e;
28673
- for (const s of t)
28674
- if (s !== undefined && H(s, e))
28800
+
28801
+ // node_modules/@clack/core/dist/index.mjs
28802
+ var import_sisteransi = __toESM(require_src(), 1);
28803
+ import { ReadStream as D } from "tty";
28804
+ function d(r, t, e) {
28805
+ if (!e.some((o) => !o.disabled))
28806
+ return r;
28807
+ const s = r + t, i = Math.max(e.length - 1, 0), n = s < 0 ? i : s > i ? 0 : s;
28808
+ return e[n].disabled ? d(n, t < 0 ? -1 : 1, e) : n;
28809
+ }
28810
+ var E = ["up", "down", "left", "right", "space", "enter", "cancel"];
28811
+ var G = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
28812
+ var u = { actions: new Set(E), aliases: new Map([["k", "up"], ["j", "down"], ["h", "left"], ["l", "right"], ["\x03", "cancel"], ["escape", "cancel"]]), messages: { cancel: "Canceled", error: "Something went wrong" }, withGuide: true, date: { monthNames: [...G], messages: { required: "Please enter a valid date", invalidMonth: "There are only 12 months in a year", invalidDay: (r, t) => `There are only ${r} days in ${t}`, afterMin: (r) => `Date must be on or after ${r.toISOString().slice(0, 10)}`, beforeMax: (r) => `Date must be on or before ${r.toISOString().slice(0, 10)}` } } };
28813
+ function V(r, t) {
28814
+ if (typeof r == "string")
28815
+ return u.aliases.get(r) === t;
28816
+ for (const e of r)
28817
+ if (e !== undefined && V(e, t))
28675
28818
  return true;
28676
28819
  return false;
28677
28820
  }
28678
- function _t(t, e) {
28679
- if (t === e)
28821
+ function j(r, t) {
28822
+ if (r === t)
28680
28823
  return;
28681
- const s = t.split(`
28682
- `), i = e.split(`
28683
- `), r = Math.max(s.length, i.length), n = [];
28684
- for (let u = 0;u < r; u++)
28685
- s[u] !== i[u] && n.push(u);
28686
- return { lines: n, numLinesBefore: s.length, numLinesAfter: i.length, numLines: r };
28824
+ const e = r.split(`
28825
+ `), s = t.split(`
28826
+ `), i = Math.max(e.length, s.length), n = [];
28827
+ for (let o = 0;o < i; o++)
28828
+ e[o] !== s[o] && n.push(o);
28829
+ return { lines: n, numLinesBefore: e.length, numLinesAfter: s.length, numLines: i };
28687
28830
  }
28688
- var bt = globalThis.process.platform.startsWith("win");
28689
- var z = Symbol("clack:cancel");
28690
- function Ct(t) {
28691
- return t === z;
28831
+ var Y = globalThis.process.platform.startsWith("win");
28832
+ var C = Symbol("clack:cancel");
28833
+ function q(r) {
28834
+ return r === C;
28692
28835
  }
28693
- function T(t, e) {
28694
- const s = t;
28695
- s.isTTY && s.setRawMode(e);
28836
+ function w(r, t) {
28837
+ const e = r;
28838
+ e.isTTY && e.setRawMode(t);
28696
28839
  }
28697
- function xt({ input: t = q, output: e = R, overwrite: s = true, hideCursor: i = true } = {}) {
28698
- const r = k.createInterface({ input: t, output: e, prompt: "", tabSize: 1 });
28699
- k.emitKeypressEvents(t, r), t instanceof J && t.isTTY && t.setRawMode(true);
28700
- const n = (u, { name: a, sequence: l }) => {
28701
- const E = String(u);
28702
- if (H([E, a, l], "cancel")) {
28703
- i && e.write(import_sisteransi.cursor.show), process.exit(0);
28840
+ function z({ input: r = $, output: t = S, overwrite: e = true, hideCursor: s = true } = {}) {
28841
+ const i = _.createInterface({ input: r, output: t, prompt: "", tabSize: 1 });
28842
+ _.emitKeypressEvents(r, i), r instanceof D && r.isTTY && r.setRawMode(true);
28843
+ const n = (o, { name: a, sequence: h }) => {
28844
+ const l = String(o);
28845
+ if (V([l, a, h], "cancel")) {
28846
+ s && t.write(import_sisteransi.cursor.show), process.exit(0);
28704
28847
  return;
28705
28848
  }
28706
- if (!s)
28849
+ if (!e)
28707
28850
  return;
28708
- const g = a === "return" ? 0 : -1, m = a === "return" ? -1 : 0;
28709
- k.moveCursor(e, g, m, () => {
28710
- k.clearLine(e, 1, () => {
28711
- t.once("keypress", n);
28851
+ const f = a === "return" ? 0 : -1, v = a === "return" ? -1 : 0;
28852
+ _.moveCursor(t, f, v, () => {
28853
+ _.clearLine(t, 1, () => {
28854
+ r.once("keypress", n);
28712
28855
  });
28713
28856
  });
28714
28857
  };
28715
- return i && e.write(import_sisteransi.cursor.hide), t.once("keypress", n), () => {
28716
- t.off("keypress", n), i && e.write(import_sisteransi.cursor.show), t instanceof J && t.isTTY && !bt && t.setRawMode(false), r.terminal = false, r.close();
28858
+ return s && t.write(import_sisteransi.cursor.hide), r.once("keypress", n), () => {
28859
+ r.off("keypress", n), s && t.write(import_sisteransi.cursor.show), r instanceof D && r.isTTY && !Y && r.setRawMode(false), i.terminal = false, i.close();
28717
28860
  };
28718
28861
  }
28719
- var rt = (t) => ("columns" in t) && typeof t.columns == "number" ? t.columns : 80;
28720
- var nt = (t) => ("rows" in t) && typeof t.rows == "number" ? t.rows : 20;
28721
- class x {
28862
+ var O = (r) => ("columns" in r) && typeof r.columns == "number" ? r.columns : 80;
28863
+ var A = (r) => ("rows" in r) && typeof r.rows == "number" ? r.rows : 20;
28864
+ var p = class {
28722
28865
  input;
28723
28866
  output;
28724
28867
  _abortSignal;
@@ -28733,227 +28876,418 @@ class x {
28733
28876
  error = "";
28734
28877
  value;
28735
28878
  userInput = "";
28736
- constructor(e, s = true) {
28737
- const { input: i = q, output: r = R, render: n, signal: u, ...a } = e;
28738
- this.opts = a, this.onKeypress = this.onKeypress.bind(this), this.close = this.close.bind(this), this.render = this.render.bind(this), this._render = n.bind(this), this._track = s, this._abortSignal = u, this.input = i, this.output = r;
28879
+ constructor(t, e = true) {
28880
+ const { input: s = $, output: i = S, render: n, signal: o, ...a } = t;
28881
+ this.opts = a, this.onKeypress = this.onKeypress.bind(this), this.close = this.close.bind(this), this.render = this.render.bind(this), this._render = n.bind(this), this._track = e, this._abortSignal = o, this.input = s, this.output = i;
28739
28882
  }
28740
28883
  unsubscribe() {
28741
28884
  this._subscribers.clear();
28742
28885
  }
28743
- setSubscriber(e, s) {
28744
- const i = this._subscribers.get(e) ?? [];
28745
- i.push(s), this._subscribers.set(e, i);
28886
+ setSubscriber(t, e) {
28887
+ const s = this._subscribers.get(t) ?? [];
28888
+ s.push(e), this._subscribers.set(t, s);
28746
28889
  }
28747
- on(e, s) {
28748
- this.setSubscriber(e, { cb: s });
28890
+ on(t, e) {
28891
+ this.setSubscriber(t, { cb: e });
28749
28892
  }
28750
- once(e, s) {
28751
- this.setSubscriber(e, { cb: s, once: true });
28893
+ once(t, e) {
28894
+ this.setSubscriber(t, { cb: e, once: true });
28752
28895
  }
28753
- emit(e, ...s) {
28754
- const i = this._subscribers.get(e) ?? [], r = [];
28896
+ emit(t, ...e) {
28897
+ const s = this._subscribers.get(t) ?? [], i = [];
28898
+ for (const n of s)
28899
+ n.cb(...e), n.once && i.push(() => s.splice(s.indexOf(n), 1));
28755
28900
  for (const n of i)
28756
- n.cb(...s), n.once && r.push(() => i.splice(i.indexOf(n), 1));
28757
- for (const n of r)
28758
28901
  n();
28759
28902
  }
28760
28903
  prompt() {
28761
- return new Promise((e) => {
28904
+ return new Promise((t) => {
28762
28905
  if (this._abortSignal) {
28763
28906
  if (this._abortSignal.aborted)
28764
- return this.state = "cancel", this.close(), e(z);
28907
+ return this.state = "cancel", this.close(), t(C);
28765
28908
  this._abortSignal.addEventListener("abort", () => {
28766
28909
  this.state = "cancel", this.close();
28767
28910
  }, { once: true });
28768
28911
  }
28769
- this.rl = ot.createInterface({ input: this.input, tabSize: 2, prompt: "", escapeCodeTimeout: 50, terminal: true }), this.rl.prompt(), this.opts.initialUserInput !== undefined && this._setUserInput(this.opts.initialUserInput, true), this.input.on("keypress", this.onKeypress), T(this.input, true), this.output.on("resize", this.render), this.render(), this.once("submit", () => {
28770
- this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), T(this.input, false), e(this.value);
28912
+ this.rl = P.createInterface({ input: this.input, tabSize: 2, prompt: "", escapeCodeTimeout: 50, terminal: true }), this.rl.prompt(), this.opts.initialUserInput !== undefined && this._setUserInput(this.opts.initialUserInput, true), this.input.on("keypress", this.onKeypress), w(this.input, true), this.output.on("resize", this.render), this.render(), this.once("submit", () => {
28913
+ this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), w(this.input, false), t(this.value);
28771
28914
  }), this.once("cancel", () => {
28772
- this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), T(this.input, false), e(z);
28915
+ this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), w(this.input, false), t(C);
28773
28916
  });
28774
28917
  });
28775
28918
  }
28776
- _isActionKey(e, s) {
28777
- return e === "\t";
28919
+ _isActionKey(t, e) {
28920
+ return t === "\t";
28778
28921
  }
28779
- _setValue(e) {
28780
- this.value = e, this.emit("value", this.value);
28922
+ _setValue(t) {
28923
+ this.value = t, this.emit("value", this.value);
28781
28924
  }
28782
- _setUserInput(e, s) {
28783
- this.userInput = e ?? "", this.emit("userInput", this.userInput), s && this._track && this.rl && (this.rl.write(this.userInput), this._cursor = this.rl.cursor);
28925
+ _setUserInput(t, e) {
28926
+ this.userInput = t ?? "", this.emit("userInput", this.userInput), e && this._track && this.rl && (this.rl.write(this.userInput), this._cursor = this.rl.cursor);
28784
28927
  }
28785
28928
  _clearUserInput() {
28786
28929
  this.rl?.write(null, { ctrl: true, name: "u" }), this._setUserInput("");
28787
28930
  }
28788
- onKeypress(e, s) {
28789
- if (this._track && s.name !== "return" && (s.name && this._isActionKey(e, s) && this.rl?.write(null, { ctrl: true, name: "h" }), this._cursor = this.rl?.cursor ?? 0, this._setUserInput(this.rl?.line)), this.state === "error" && (this.state = "active"), s?.name && (!this._track && _.aliases.has(s.name) && this.emit("cursor", _.aliases.get(s.name)), _.actions.has(s.name) && this.emit("cursor", s.name)), e && (e.toLowerCase() === "y" || e.toLowerCase() === "n") && this.emit("confirm", e.toLowerCase() === "y"), this.emit("key", e?.toLowerCase(), s), s?.name === "return") {
28931
+ onKeypress(t, e) {
28932
+ if (this._track && e.name !== "return" && (e.name && this._isActionKey(t, e) && this.rl?.write(null, { ctrl: true, name: "h" }), this._cursor = this.rl?.cursor ?? 0, this._setUserInput(this.rl?.line)), this.state === "error" && (this.state = "active"), e?.name && (!this._track && u.aliases.has(e.name) && this.emit("cursor", u.aliases.get(e.name)), u.actions.has(e.name) && this.emit("cursor", e.name)), t && (t.toLowerCase() === "y" || t.toLowerCase() === "n") && this.emit("confirm", t.toLowerCase() === "y"), this.emit("key", t?.toLowerCase(), e), e?.name === "return") {
28790
28933
  if (this.opts.validate) {
28791
- const i = this.opts.validate(this.value);
28792
- i && (this.error = i instanceof Error ? i.message : i, this.state = "error", this.rl?.write(this.userInput));
28934
+ const s = this.opts.validate(this.value);
28935
+ s && (this.error = s instanceof Error ? s.message : s, this.state = "error", this.rl?.write(this.userInput));
28793
28936
  }
28794
28937
  this.state !== "error" && (this.state = "submit");
28795
28938
  }
28796
- H([e, s?.name, s?.sequence], "cancel") && (this.state = "cancel"), (this.state === "submit" || this.state === "cancel") && this.emit("finalize"), this.render(), (this.state === "submit" || this.state === "cancel") && this.close();
28939
+ V([t, e?.name, e?.sequence], "cancel") && (this.state = "cancel"), (this.state === "submit" || this.state === "cancel") && this.emit("finalize"), this.render(), (this.state === "submit" || this.state === "cancel") && this.close();
28797
28940
  }
28798
28941
  close() {
28799
28942
  this.input.unpipe(), this.input.removeListener("keypress", this.onKeypress), this.output.write(`
28800
- `), T(this.input, false), this.rl?.close(), this.rl = undefined, this.emit(`${this.state}`, this.value), this.unsubscribe();
28943
+ `), w(this.input, false), this.rl?.close(), this.rl = undefined, this.emit(`${this.state}`, this.value), this.unsubscribe();
28801
28944
  }
28802
28945
  restoreCursor() {
28803
- const e = K(this._prevFrame, process.stdout.columns, { hard: true, trim: false }).split(`
28946
+ const t = wrapAnsi(this._prevFrame, process.stdout.columns, { hard: true, trim: false }).split(`
28804
28947
  `).length - 1;
28805
- this.output.write(import_sisteransi.cursor.move(-999, e * -1));
28948
+ this.output.write(import_sisteransi.cursor.move(-999, t * -1));
28806
28949
  }
28807
28950
  render() {
28808
- const e = K(this._render(this) ?? "", process.stdout.columns, { hard: true, trim: false });
28809
- if (e !== this._prevFrame) {
28951
+ const t = wrapAnsi(this._render(this) ?? "", process.stdout.columns, { hard: true, trim: false });
28952
+ if (t !== this._prevFrame) {
28810
28953
  if (this.state === "initial")
28811
28954
  this.output.write(import_sisteransi.cursor.hide);
28812
28955
  else {
28813
- const s = _t(this._prevFrame, e), i = nt(this.output);
28814
- if (this.restoreCursor(), s) {
28815
- const r = Math.max(0, s.numLinesAfter - i), n = Math.max(0, s.numLinesBefore - i);
28816
- let u = s.lines.find((a) => a >= r);
28817
- if (u === undefined) {
28818
- this._prevFrame = e;
28956
+ const e = j(this._prevFrame, t), s = A(this.output);
28957
+ if (this.restoreCursor(), e) {
28958
+ const i = Math.max(0, e.numLinesAfter - s), n = Math.max(0, e.numLinesBefore - s);
28959
+ let o = e.lines.find((a) => a >= i);
28960
+ if (o === undefined) {
28961
+ this._prevFrame = t;
28819
28962
  return;
28820
28963
  }
28821
- if (s.lines.length === 1) {
28822
- this.output.write(import_sisteransi.cursor.move(0, u - n)), this.output.write(import_sisteransi.erase.lines(1));
28823
- const a = e.split(`
28964
+ if (e.lines.length === 1) {
28965
+ this.output.write(import_sisteransi.cursor.move(0, o - n)), this.output.write(import_sisteransi.erase.lines(1));
28966
+ const a = t.split(`
28824
28967
  `);
28825
- this.output.write(a[u]), this._prevFrame = e, this.output.write(import_sisteransi.cursor.move(0, a.length - u - 1));
28968
+ this.output.write(a[o]), this._prevFrame = t, this.output.write(import_sisteransi.cursor.move(0, a.length - o - 1));
28826
28969
  return;
28827
- } else if (s.lines.length > 1) {
28828
- if (r < n)
28829
- u = r;
28970
+ } else if (e.lines.length > 1) {
28971
+ if (i < n)
28972
+ o = i;
28830
28973
  else {
28831
- const l = u - n;
28832
- l > 0 && this.output.write(import_sisteransi.cursor.move(0, l));
28974
+ const h = o - n;
28975
+ h > 0 && this.output.write(import_sisteransi.cursor.move(0, h));
28833
28976
  }
28834
28977
  this.output.write(import_sisteransi.erase.down());
28835
- const a = e.split(`
28836
- `).slice(u);
28978
+ const a = t.split(`
28979
+ `).slice(o);
28837
28980
  this.output.write(a.join(`
28838
- `)), this._prevFrame = e;
28981
+ `)), this._prevFrame = t;
28839
28982
  return;
28840
28983
  }
28841
28984
  }
28842
28985
  this.output.write(import_sisteransi.erase.down());
28843
28986
  }
28844
- this.output.write(e), this.state === "initial" && (this.state = "active"), this._prevFrame = e;
28987
+ this.output.write(t), this.state === "initial" && (this.state = "active"), this._prevFrame = t;
28845
28988
  }
28846
28989
  }
28847
- }
28848
- function wt(t, e) {
28849
- if (t === undefined || e.length === 0)
28990
+ };
28991
+ function W(r, t) {
28992
+ if (r === undefined || t.length === 0)
28850
28993
  return 0;
28851
- const s = e.findIndex((i) => i.value === t);
28852
- return s !== -1 ? s : 0;
28994
+ const e = t.findIndex((s) => s.value === r);
28995
+ return e !== -1 ? e : 0;
28853
28996
  }
28854
- function Dt(t, e) {
28855
- return (e.label ?? String(e.value)).toLowerCase().includes(t.toLowerCase());
28997
+ function B(r, t) {
28998
+ return (t.label ?? String(t.value)).toLowerCase().includes(r.toLowerCase());
28856
28999
  }
28857
- function St(t, e) {
28858
- if (e)
28859
- return t ? e : e[0];
29000
+ function J(r, t) {
29001
+ if (t)
29002
+ return r ? t : t[0];
28860
29003
  }
28861
-
28862
- class Vt extends x {
29004
+ var H = class extends p {
28863
29005
  filteredOptions;
28864
29006
  multiple;
28865
29007
  isNavigating = false;
28866
29008
  selectedValues = [];
28867
29009
  focusedValue;
28868
- #t = 0;
28869
- #s = "";
28870
- #i;
28871
- #e;
29010
+ #e = 0;
29011
+ #o = "";
29012
+ #t;
29013
+ #n;
29014
+ #a;
28872
29015
  get cursor() {
28873
- return this.#t;
29016
+ return this.#e;
28874
29017
  }
28875
29018
  get userInputWithCursor() {
28876
29019
  if (!this.userInput)
28877
- return import_picocolors.default.inverse(import_picocolors.default.hidden("_"));
29020
+ return y(["inverse", "hidden"], "_");
28878
29021
  if (this._cursor >= this.userInput.length)
28879
29022
  return `${this.userInput}\u2588`;
28880
- const e = this.userInput.slice(0, this._cursor), [s, ...i] = this.userInput.slice(this._cursor);
28881
- return `${e}${import_picocolors.default.inverse(s)}${i.join("")}`;
29023
+ const t = this.userInput.slice(0, this._cursor), [e, ...s] = this.userInput.slice(this._cursor);
29024
+ return `${t}${y("inverse", e)}${s.join("")}`;
28882
29025
  }
28883
29026
  get options() {
28884
- return typeof this.#e == "function" ? this.#e() : this.#e;
29027
+ return typeof this.#n == "function" ? this.#n() : this.#n;
29028
+ }
29029
+ constructor(t) {
29030
+ super(t), this.#n = t.options, this.#a = t.placeholder;
29031
+ const e = this.options;
29032
+ this.filteredOptions = [...e], this.multiple = t.multiple === true, this.#t = typeof t.options == "function" ? t.filter : t.filter ?? B;
29033
+ let s;
29034
+ if (t.initialValue && Array.isArray(t.initialValue) ? this.multiple ? s = t.initialValue : s = t.initialValue.slice(0, 1) : !this.multiple && this.options.length > 0 && (s = [this.options[0].value]), s)
29035
+ for (const i of s) {
29036
+ const n = e.findIndex((o) => o.value === i);
29037
+ n !== -1 && (this.toggleSelected(i), this.#e = n);
29038
+ }
29039
+ this.focusedValue = this.options[this.#e]?.value, this.on("key", (i, n) => this.#s(i, n)), this.on("userInput", (i) => this.#i(i));
29040
+ }
29041
+ _isActionKey(t, e) {
29042
+ return t === "\t" || this.multiple && this.isNavigating && e.name === "space" && t !== undefined && t !== "";
29043
+ }
29044
+ #s(t, e) {
29045
+ const s = e.name === "up", i = e.name === "down", n = e.name === "return", o = this.userInput === "" || this.userInput === "\t", a = this.#a, h = this.options, l = a !== undefined && a !== "" && h.some((f) => !f.disabled && (this.#t ? this.#t(a, f) : true));
29046
+ if (e.name === "tab" && o && l) {
29047
+ this.userInput === "\t" && this._clearUserInput(), this._setUserInput(a, true), this.isNavigating = false;
29048
+ return;
29049
+ }
29050
+ s || i ? (this.#e = d(this.#e, s ? -1 : 1, this.filteredOptions), this.focusedValue = this.filteredOptions[this.#e]?.value, this.multiple || (this.selectedValues = [this.focusedValue]), this.isNavigating = true) : n ? this.value = J(this.multiple, this.selectedValues) : this.multiple ? this.focusedValue !== undefined && (e.name === "tab" || this.isNavigating && e.name === "space") ? this.toggleSelected(this.focusedValue) : this.isNavigating = false : (this.focusedValue && (this.selectedValues = [this.focusedValue]), this.isNavigating = false);
28885
29051
  }
28886
- constructor(e) {
28887
- super(e), this.#e = e.options;
28888
- const s = this.options;
28889
- this.filteredOptions = [...s], this.multiple = e.multiple === true, this.#i = e.filter ?? Dt;
28890
- let i;
28891
- if (e.initialValue && Array.isArray(e.initialValue) ? this.multiple ? i = e.initialValue : i = e.initialValue.slice(0, 1) : !this.multiple && this.options.length > 0 && (i = [this.options[0].value]), i)
28892
- for (const r of i) {
28893
- const n = s.findIndex((u) => u.value === r);
28894
- n !== -1 && (this.toggleSelected(r), this.#t = n);
28895
- }
28896
- this.focusedValue = this.options[this.#t]?.value, this.on("key", (r, n) => this.#r(r, n)), this.on("userInput", (r) => this.#n(r));
29052
+ deselectAll() {
29053
+ this.selectedValues = [];
28897
29054
  }
28898
- _isActionKey(e, s) {
28899
- return e === "\t" || this.multiple && this.isNavigating && s.name === "space" && e !== undefined && e !== "";
29055
+ toggleSelected(t) {
29056
+ this.filteredOptions.length !== 0 && (this.multiple ? this.selectedValues.includes(t) ? this.selectedValues = this.selectedValues.filter((e) => e !== t) : this.selectedValues = [...this.selectedValues, t] : this.selectedValues = [t]);
28900
29057
  }
28901
- #r(e, s) {
28902
- const i = s.name === "up", r = s.name === "down", n = s.name === "return";
28903
- i || r ? (this.#t = Math.max(0, Math.min(this.#t + (i ? -1 : 1), this.filteredOptions.length - 1)), this.focusedValue = this.filteredOptions[this.#t]?.value, this.multiple || (this.selectedValues = [this.focusedValue]), this.isNavigating = true) : n ? this.value = St(this.multiple, this.selectedValues) : this.multiple ? this.focusedValue !== undefined && (s.name === "tab" || this.isNavigating && s.name === "space") ? this.toggleSelected(this.focusedValue) : this.isNavigating = false : (this.focusedValue && (this.selectedValues = [this.focusedValue]), this.isNavigating = false);
29058
+ #i(t) {
29059
+ if (t !== this.#o) {
29060
+ this.#o = t;
29061
+ const e = this.options;
29062
+ t && this.#t ? this.filteredOptions = e.filter((n) => this.#t?.(t, n)) : this.filteredOptions = [...e];
29063
+ const s = W(this.focusedValue, this.filteredOptions);
29064
+ this.#e = d(s, 0, this.filteredOptions);
29065
+ const i = this.filteredOptions[this.#e];
29066
+ i && !i.disabled ? this.focusedValue = i.value : this.focusedValue = undefined, this.multiple || (this.focusedValue !== undefined ? this.toggleSelected(this.focusedValue) : this.deselectAll());
29067
+ }
28904
29068
  }
28905
- deselectAll() {
28906
- this.selectedValues = [];
29069
+ };
29070
+ var X = { Y: { type: "year", len: 4 }, M: { type: "month", len: 2 }, D: { type: "day", len: 2 } };
29071
+ function L(r) {
29072
+ return [...r].map((t) => X[t]);
29073
+ }
29074
+ function Z(r) {
29075
+ const t = new Intl.DateTimeFormat(r, { year: "numeric", month: "2-digit", day: "2-digit" }).formatToParts(new Date(2000, 0, 15)), e = [];
29076
+ let s = "/";
29077
+ for (const i of t)
29078
+ i.type === "literal" ? s = i.value.trim() || i.value : (i.type === "year" || i.type === "month" || i.type === "day") && e.push({ type: i.type, len: i.type === "year" ? 4 : 2 });
29079
+ return { segments: e, separator: s };
29080
+ }
29081
+ function k(r) {
29082
+ return Number.parseInt((r || "0").replace(/_/g, "0"), 10) || 0;
29083
+ }
29084
+ function I(r) {
29085
+ return { year: k(r.year), month: k(r.month), day: k(r.day) };
29086
+ }
29087
+ function T(r, t) {
29088
+ return new Date(r || 2001, t || 1, 0).getDate();
29089
+ }
29090
+ function F(r) {
29091
+ const { year: t, month: e, day: s } = I(r);
29092
+ if (!t || t < 0 || t > 9999 || !e || e < 1 || e > 12 || !s || s < 1)
29093
+ return;
29094
+ const i = new Date(Date.UTC(t, e - 1, s));
29095
+ if (!(i.getUTCFullYear() !== t || i.getUTCMonth() !== e - 1 || i.getUTCDate() !== s))
29096
+ return { year: t, month: e, day: s };
29097
+ }
29098
+ function N(r) {
29099
+ const t = F(r);
29100
+ return t ? new Date(Date.UTC(t.year, t.month - 1, t.day)) : undefined;
29101
+ }
29102
+ function tt(r, t, e, s) {
29103
+ const i = e ? { year: e.getUTCFullYear(), month: e.getUTCMonth() + 1, day: e.getUTCDate() } : null, n = s ? { year: s.getUTCFullYear(), month: s.getUTCMonth() + 1, day: s.getUTCDate() } : null;
29104
+ return r === "year" ? { min: i?.year ?? 1, max: n?.year ?? 9999 } : r === "month" ? { min: i && t.year === i.year ? i.month : 1, max: n && t.year === n.year ? n.month : 12 } : { min: i && t.year === i.year && t.month === i.month ? i.day : 1, max: n && t.year === n.year && t.month === n.month ? n.day : T(t.year, t.month) };
29105
+ }
29106
+
29107
+ class et extends p {
29108
+ #e;
29109
+ #o;
29110
+ #t;
29111
+ #n;
29112
+ #a;
29113
+ #s = { segmentIndex: 0, positionInSegment: 0 };
29114
+ #i = true;
29115
+ #r = null;
29116
+ inlineError = "";
29117
+ get segmentCursor() {
29118
+ return { ...this.#s };
29119
+ }
29120
+ get segmentValues() {
29121
+ return { ...this.#t };
29122
+ }
29123
+ get segments() {
29124
+ return this.#e;
29125
+ }
29126
+ get separator() {
29127
+ return this.#o;
29128
+ }
29129
+ get formattedValue() {
29130
+ return this.#c(this.#t);
29131
+ }
29132
+ #c(t) {
29133
+ return this.#e.map((e) => t[e.type]).join(this.#o);
29134
+ }
29135
+ #h() {
29136
+ this._setUserInput(this.#c(this.#t)), this._setValue(N(this.#t) ?? undefined);
29137
+ }
29138
+ constructor(t) {
29139
+ const e = t.format ? { segments: L(t.format), separator: t.separator ?? "/" } : Z(t.locale), s = t.separator ?? e.separator, i = t.format ? L(t.format) : e.segments, n = t.initialValue ?? t.defaultValue, o = n ? { year: String(n.getUTCFullYear()).padStart(4, "0"), month: String(n.getUTCMonth() + 1).padStart(2, "0"), day: String(n.getUTCDate()).padStart(2, "0") } : { year: "____", month: "__", day: "__" }, a = i.map((h) => o[h.type]).join(s);
29140
+ super({ ...t, initialUserInput: a }, false), this.#e = i, this.#o = s, this.#t = o, this.#n = t.minDate, this.#a = t.maxDate, this.#h(), this.on("cursor", (h) => this.#d(h)), this.on("key", (h, l) => this.#f(h, l)), this.on("finalize", () => this.#g(t));
29141
+ }
29142
+ #u() {
29143
+ const t = Math.max(0, Math.min(this.#s.segmentIndex, this.#e.length - 1)), e = this.#e[t];
29144
+ if (e)
29145
+ return this.#s.positionInSegment = Math.max(0, Math.min(this.#s.positionInSegment, e.len - 1)), { segment: e, index: t };
29146
+ }
29147
+ #l(t) {
29148
+ this.inlineError = "", this.#r = null;
29149
+ const e = this.#u();
29150
+ e && (this.#s.segmentIndex = Math.max(0, Math.min(this.#e.length - 1, e.index + t)), this.#s.positionInSegment = 0, this.#i = true);
29151
+ }
29152
+ #p(t) {
29153
+ const e = this.#u();
29154
+ if (!e)
29155
+ return;
29156
+ const { segment: s } = e, i = this.#t[s.type], n = !i || i.replace(/_/g, "") === "", o = Number.parseInt((i || "0").replace(/_/g, "0"), 10) || 0, a = tt(s.type, I(this.#t), this.#n, this.#a);
29157
+ let h;
29158
+ n ? h = t === 1 ? a.min : a.max : h = Math.max(Math.min(a.max, o + t), a.min), this.#t = { ...this.#t, [s.type]: h.toString().padStart(s.len, "0") }, this.#i = true, this.#r = null, this.#h();
29159
+ }
29160
+ #d(t) {
29161
+ if (t)
29162
+ switch (t) {
29163
+ case "right":
29164
+ return this.#l(1);
29165
+ case "left":
29166
+ return this.#l(-1);
29167
+ case "up":
29168
+ return this.#p(1);
29169
+ case "down":
29170
+ return this.#p(-1);
29171
+ }
28907
29172
  }
28908
- toggleSelected(e) {
28909
- this.filteredOptions.length !== 0 && (this.multiple ? this.selectedValues.includes(e) ? this.selectedValues = this.selectedValues.filter((s) => s !== e) : this.selectedValues = [...this.selectedValues, e] : this.selectedValues = [e]);
29173
+ #f(t, e) {
29174
+ if (e?.name === "backspace" || e?.sequence === "\x7F" || e?.sequence === "\b" || t === "\x7F" || t === "\b") {
29175
+ this.inlineError = "";
29176
+ const s = this.#u();
29177
+ if (!s)
29178
+ return;
29179
+ if (!this.#t[s.segment.type].replace(/_/g, "")) {
29180
+ this.#l(-1);
29181
+ return;
29182
+ }
29183
+ this.#t[s.segment.type] = "_".repeat(s.segment.len), this.#i = true, this.#s.positionInSegment = 0, this.#h();
29184
+ return;
29185
+ }
29186
+ if (e?.name === "tab") {
29187
+ this.inlineError = "";
29188
+ const s = this.#u();
29189
+ if (!s)
29190
+ return;
29191
+ const i = e.shift ? -1 : 1, n = s.index + i;
29192
+ n >= 0 && n < this.#e.length && (this.#s.segmentIndex = n, this.#s.positionInSegment = 0, this.#i = true);
29193
+ return;
29194
+ }
29195
+ if (t && /^[0-9]$/.test(t)) {
29196
+ const s = this.#u();
29197
+ if (!s)
29198
+ return;
29199
+ const { segment: i } = s, n = !this.#t[i.type].replace(/_/g, "");
29200
+ if (this.#i && this.#r !== null && !n) {
29201
+ const m = this.#r + t, g = { ...this.#t, [i.type]: m }, b = this.#m(g, i);
29202
+ if (b) {
29203
+ this.inlineError = b, this.#r = null, this.#i = false;
29204
+ return;
29205
+ }
29206
+ this.inlineError = "", this.#t[i.type] = m, this.#r = null, this.#i = false, this.#h(), s.index < this.#e.length - 1 && (this.#s.segmentIndex = s.index + 1, this.#s.positionInSegment = 0, this.#i = true);
29207
+ return;
29208
+ }
29209
+ this.#i && !n && (this.#t[i.type] = "_".repeat(i.len), this.#s.positionInSegment = 0), this.#i = false, this.#r = null;
29210
+ const o = this.#t[i.type], a = o.indexOf("_"), h = a >= 0 ? a : Math.min(this.#s.positionInSegment, i.len - 1);
29211
+ if (h < 0 || h >= i.len)
29212
+ return;
29213
+ let l = o.slice(0, h) + t + o.slice(h + 1), f = false;
29214
+ if (h === 0 && o === "__" && (i.type === "month" || i.type === "day")) {
29215
+ const m = Number.parseInt(t, 10);
29216
+ l = `0${t}`, f = m <= (i.type === "month" ? 1 : 2);
29217
+ }
29218
+ if (i.type === "year" && (l = (o.replace(/_/g, "") + t).padStart(i.len, "_")), !l.includes("_")) {
29219
+ const m = { ...this.#t, [i.type]: l }, g = this.#m(m, i);
29220
+ if (g) {
29221
+ this.inlineError = g;
29222
+ return;
29223
+ }
29224
+ }
29225
+ this.inlineError = "", this.#t[i.type] = l;
29226
+ const v = l.includes("_") ? undefined : F(this.#t);
29227
+ if (v) {
29228
+ const { year: m, month: g } = v, b = T(m, g);
29229
+ this.#t = { year: String(Math.max(0, Math.min(9999, m))).padStart(4, "0"), month: String(Math.max(1, Math.min(12, g))).padStart(2, "0"), day: String(Math.max(1, Math.min(b, v.day))).padStart(2, "0") };
29230
+ }
29231
+ this.#h();
29232
+ const U = l.indexOf("_");
29233
+ f ? (this.#i = true, this.#r = t) : U >= 0 ? this.#s.positionInSegment = U : a >= 0 && s.index < this.#e.length - 1 ? (this.#s.segmentIndex = s.index + 1, this.#s.positionInSegment = 0, this.#i = true) : this.#s.positionInSegment = Math.min(h + 1, i.len - 1);
29234
+ }
29235
+ }
29236
+ #m(t, e) {
29237
+ const { month: s, day: i } = I(t);
29238
+ if (e.type === "month" && (s < 0 || s > 12))
29239
+ return u.date.messages.invalidMonth;
29240
+ if (e.type === "day" && (i < 0 || i > 31))
29241
+ return u.date.messages.invalidDay(31, "any month");
28910
29242
  }
28911
- #n(e) {
28912
- if (e !== this.#s) {
28913
- this.#s = e;
28914
- const s = this.options;
28915
- e ? this.filteredOptions = s.filter((i) => this.#i(e, i)) : this.filteredOptions = [...s], this.#t = wt(this.focusedValue, this.filteredOptions), this.focusedValue = this.filteredOptions[this.#t]?.value, this.multiple || (this.focusedValue !== undefined ? this.toggleSelected(this.focusedValue) : this.deselectAll());
29243
+ #g(t) {
29244
+ const { year: e, month: s, day: i } = I(this.#t);
29245
+ if (e && s && i) {
29246
+ const n = T(e, s);
29247
+ this.#t = { ...this.#t, day: String(Math.min(i, n)).padStart(2, "0") };
28916
29248
  }
29249
+ this.value = N(this.#t) ?? t.defaultValue ?? undefined;
28917
29250
  }
28918
29251
  }
28919
- class yt extends x {
29252
+
29253
+ class st extends p {
28920
29254
  options;
28921
29255
  cursor = 0;
28922
- #t;
28923
- getGroupItems(e) {
28924
- return this.options.filter((s) => s.group === e);
29256
+ #e;
29257
+ getGroupItems(t) {
29258
+ return this.options.filter((e) => e.group === t);
28925
29259
  }
28926
- isGroupSelected(e) {
28927
- const s = this.getGroupItems(e), i = this.value;
28928
- return i === undefined ? false : s.every((r) => i.includes(r.value));
29260
+ isGroupSelected(t) {
29261
+ const e = this.getGroupItems(t), s = this.value;
29262
+ return s === undefined ? false : e.every((i) => s.includes(i.value));
28929
29263
  }
28930
29264
  toggleValue() {
28931
- const e = this.options[this.cursor];
28932
- if (this.value === undefined && (this.value = []), e.group === true) {
28933
- const s = e.value, i = this.getGroupItems(s);
28934
- this.isGroupSelected(s) ? this.value = this.value.filter((r) => i.findIndex((n) => n.value === r) === -1) : this.value = [...this.value, ...i.map((r) => r.value)], this.value = Array.from(new Set(this.value));
29265
+ const t = this.options[this.cursor];
29266
+ if (this.value === undefined && (this.value = []), t.group === true) {
29267
+ const e = t.value, s = this.getGroupItems(e);
29268
+ this.isGroupSelected(e) ? this.value = this.value.filter((i) => s.findIndex((n) => n.value === i) === -1) : this.value = [...this.value, ...s.map((i) => i.value)], this.value = Array.from(new Set(this.value));
28935
29269
  } else {
28936
- const s = this.value.includes(e.value);
28937
- this.value = s ? this.value.filter((i) => i !== e.value) : [...this.value, e.value];
29270
+ const e = this.value.includes(t.value);
29271
+ this.value = e ? this.value.filter((s) => s !== t.value) : [...this.value, t.value];
28938
29272
  }
28939
29273
  }
28940
- constructor(e) {
28941
- super(e, false);
28942
- const { options: s } = e;
28943
- this.#t = e.selectableGroups !== false, this.options = Object.entries(s).flatMap(([i, r]) => [{ value: i, group: true, label: i }, ...r.map((n) => ({ ...n, group: i }))]), this.value = [...e.initialValues ?? []], this.cursor = Math.max(this.options.findIndex(({ value: i }) => i === e.cursorAt), this.#t ? 0 : 1), this.on("cursor", (i) => {
28944
- switch (i) {
29274
+ constructor(t) {
29275
+ super(t, false);
29276
+ const { options: e } = t;
29277
+ this.#e = t.selectableGroups !== false, this.options = Object.entries(e).flatMap(([s, i]) => [{ value: s, group: true, label: s }, ...i.map((n) => ({ ...n, group: s }))]), this.value = [...t.initialValues ?? []], this.cursor = Math.max(this.options.findIndex(({ value: s }) => s === t.cursorAt), this.#e ? 0 : 1), this.on("cursor", (s) => {
29278
+ switch (s) {
28945
29279
  case "left":
28946
29280
  case "up": {
28947
29281
  this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1;
28948
- const r = this.options[this.cursor]?.group === true;
28949
- !this.#t && r && (this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1);
29282
+ const i = this.options[this.cursor]?.group === true;
29283
+ !this.#e && i && (this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1);
28950
29284
  break;
28951
29285
  }
28952
29286
  case "down":
28953
29287
  case "right": {
28954
29288
  this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1;
28955
- const r = this.options[this.cursor]?.group === true;
28956
- !this.#t && r && (this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1);
29289
+ const i = this.options[this.cursor]?.group === true;
29290
+ !this.#e && i && (this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1);
28957
29291
  break;
28958
29292
  }
28959
29293
  case "space":
@@ -28963,370 +29297,193 @@ class yt extends x {
28963
29297
  });
28964
29298
  }
28965
29299
  }
28966
- class $t extends x {
29300
+ class at extends p {
28967
29301
  get userInputWithCursor() {
28968
29302
  if (this.state === "submit")
28969
29303
  return this.userInput;
28970
- const e = this.userInput;
28971
- if (this.cursor >= e.length)
29304
+ const t = this.userInput;
29305
+ if (this.cursor >= t.length)
28972
29306
  return `${this.userInput}\u2588`;
28973
- const s = e.slice(0, this.cursor), [i, ...r] = e.slice(this.cursor);
28974
- return `${s}${import_picocolors.default.inverse(i)}${r.join("")}`;
29307
+ const e = t.slice(0, this.cursor), [s, ...i] = t.slice(this.cursor);
29308
+ return `${e}${y("inverse", s)}${i.join("")}`;
28975
29309
  }
28976
29310
  get cursor() {
28977
29311
  return this._cursor;
28978
29312
  }
28979
- constructor(e) {
28980
- super({ ...e, initialUserInput: e.initialUserInput ?? e.initialValue }), this.on("userInput", (s) => {
28981
- this._setValue(s);
29313
+ constructor(t) {
29314
+ super({ ...t, initialUserInput: t.initialUserInput ?? t.initialValue }), this.on("userInput", (e) => {
29315
+ this._setValue(e);
28982
29316
  }), this.on("finalize", () => {
28983
- this.value || (this.value = e.defaultValue), this.value === undefined && (this.value = "");
29317
+ this.value || (this.value = t.defaultValue), this.value === undefined && (this.value = "");
28984
29318
  });
28985
29319
  }
28986
29320
  }
28987
29321
 
28988
29322
  // node_modules/@clack/prompts/dist/index.mjs
28989
- var import_picocolors2 = __toESM(require_picocolors(), 1);
29323
+ import { styleText as t, stripVTControlCharacters as ne } from "util";
28990
29324
  import P2 from "process";
28991
29325
  var import_sisteransi2 = __toESM(require_src(), 1);
28992
- function ht2() {
29326
+ function Ze() {
28993
29327
  return P2.platform !== "win32" ? P2.env.TERM !== "linux" : !!P2.env.CI || !!P2.env.WT_SESSION || !!P2.env.TERMINUS_SUBLIME || P2.env.ConEmuTask === "{cmd::Cmder}" || P2.env.TERM_PROGRAM === "Terminus-Sublime" || P2.env.TERM_PROGRAM === "vscode" || P2.env.TERM === "xterm-256color" || P2.env.TERM === "alacritty" || P2.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
28994
29328
  }
28995
- var ee = ht2();
28996
- var ue = () => process.env.CI === "true";
28997
- var w2 = (e, r) => ee ? e : r;
28998
- var Me = w2("\u25C6", "*");
28999
- var ce = w2("\u25A0", "x");
29000
- var de = w2("\u25B2", "x");
29001
- var k2 = w2("\u25C7", "o");
29002
- var $e = w2("\u250C", "T");
29003
- var h = w2("\u2502", "|");
29004
- var x2 = w2("\u2514", "\u2014");
29005
- var Re = w2("\u2510", "T");
29006
- var Oe = w2("\u2518", "\u2014");
29007
- var Y = w2("\u25CF", ">");
29008
- var K2 = w2("\u25CB", " ");
29329
+ var ee = Ze();
29330
+ var ae = () => process.env.CI === "true";
29331
+ var w2 = (e, i) => ee ? e : i;
29332
+ var _e = w2("\u25C6", "*");
29333
+ var oe = w2("\u25A0", "x");
29334
+ var ue = w2("\u25B2", "x");
29335
+ var F2 = w2("\u25C7", "o");
29336
+ var le = w2("\u250C", "T");
29337
+ var d2 = w2("\u2502", "|");
29338
+ var E2 = w2("\u2514", "\u2014");
29339
+ var Ie = w2("\u2510", "T");
29340
+ var Ee = w2("\u2518", "\u2014");
29341
+ var z2 = w2("\u25CF", ">");
29342
+ var H2 = w2("\u25CB", " ");
29009
29343
  var te = w2("\u25FB", "[\u2022]");
29010
- var G2 = w2("\u25FC", "[+]");
29011
- var z2 = w2("\u25FB", "[ ]");
29012
- var Pe = w2("\u25AA", "\u2022");
29344
+ var U = w2("\u25FC", "[+]");
29345
+ var J2 = w2("\u25FB", "[ ]");
29346
+ var xe = w2("\u25AA", "\u2022");
29013
29347
  var se = w2("\u2500", "-");
29014
- var he = w2("\u256E", "+");
29015
- var Ne = w2("\u251C", "+");
29016
- var me = w2("\u256F", "+");
29017
- var pe = w2("\u2570", "+");
29018
- var We = w2("\u256D", "+");
29019
- var ge = w2("\u25CF", "\u2022");
29020
- var fe = w2("\u25C6", "*");
29021
- var Fe = w2("\u25B2", "!");
29022
- var ye = w2("\u25A0", "x");
29023
- var N2 = (e) => {
29348
+ var ce = w2("\u256E", "+");
29349
+ var Ge = w2("\u251C", "+");
29350
+ var $e = w2("\u256F", "+");
29351
+ var de = w2("\u2570", "+");
29352
+ var Oe = w2("\u256D", "+");
29353
+ var he = w2("\u25CF", "\u2022");
29354
+ var pe = w2("\u25C6", "*");
29355
+ var me = w2("\u25B2", "!");
29356
+ var ge = w2("\u25A0", "x");
29357
+ var V2 = (e) => {
29024
29358
  switch (e) {
29025
29359
  case "initial":
29026
29360
  case "active":
29027
- return import_picocolors2.default.cyan(Me);
29361
+ return t("cyan", _e);
29028
29362
  case "cancel":
29029
- return import_picocolors2.default.red(ce);
29363
+ return t("red", oe);
29030
29364
  case "error":
29031
- return import_picocolors2.default.yellow(de);
29365
+ return t("yellow", ue);
29032
29366
  case "submit":
29033
- return import_picocolors2.default.green(k2);
29034
- }
29035
- };
29036
- var mt2 = (e) => e === 161 || e === 164 || e === 167 || e === 168 || e === 170 || e === 173 || e === 174 || e >= 176 && e <= 180 || e >= 182 && e <= 186 || e >= 188 && e <= 191 || e === 198 || e === 208 || e === 215 || e === 216 || e >= 222 && e <= 225 || e === 230 || e >= 232 && e <= 234 || e === 236 || e === 237 || e === 240 || e === 242 || e === 243 || e >= 247 && e <= 250 || e === 252 || e === 254 || e === 257 || e === 273 || e === 275 || e === 283 || e === 294 || e === 295 || e === 299 || e >= 305 && e <= 307 || e === 312 || e >= 319 && e <= 322 || e === 324 || e >= 328 && e <= 331 || e === 333 || e === 338 || e === 339 || e === 358 || e === 359 || e === 363 || e === 462 || e === 464 || e === 466 || e === 468 || e === 470 || e === 472 || e === 474 || e === 476 || e === 593 || e === 609 || e === 708 || e === 711 || e >= 713 && e <= 715 || e === 717 || e === 720 || e >= 728 && e <= 731 || e === 733 || e === 735 || e >= 768 && e <= 879 || e >= 913 && e <= 929 || e >= 931 && e <= 937 || e >= 945 && e <= 961 || e >= 963 && e <= 969 || e === 1025 || e >= 1040 && e <= 1103 || e === 1105 || e === 8208 || e >= 8211 && e <= 8214 || e === 8216 || e === 8217 || e === 8220 || e === 8221 || e >= 8224 && e <= 8226 || e >= 8228 && e <= 8231 || e === 8240 || e === 8242 || e === 8243 || e === 8245 || e === 8251 || e === 8254 || e === 8308 || e === 8319 || e >= 8321 && e <= 8324 || e === 8364 || e === 8451 || e === 8453 || e === 8457 || e === 8467 || e === 8470 || e === 8481 || e === 8482 || e === 8486 || e === 8491 || e === 8531 || e === 8532 || e >= 8539 && e <= 8542 || e >= 8544 && e <= 8555 || e >= 8560 && e <= 8569 || e === 8585 || e >= 8592 && e <= 8601 || e === 8632 || e === 8633 || e === 8658 || e === 8660 || e === 8679 || e === 8704 || e === 8706 || e === 8707 || e === 8711 || e === 8712 || e === 8715 || e === 8719 || e === 8721 || e === 8725 || e === 8730 || e >= 8733 && e <= 8736 || e === 8739 || e === 8741 || e >= 8743 && e <= 8748 || e === 8750 || e >= 8756 && e <= 8759 || e === 8764 || e === 8765 || e === 8776 || e === 8780 || e === 8786 || e === 8800 || e === 8801 || e >= 8804 && e <= 8807 || e === 8810 || e === 8811 || e === 8814 || e === 8815 || e === 8834 || e === 8835 || e === 8838 || e === 8839 || e === 8853 || e === 8857 || e === 8869 || e === 8895 || e === 8978 || e >= 9312 && e <= 9449 || e >= 9451 && e <= 9547 || e >= 9552 && e <= 9587 || e >= 9600 && e <= 9615 || e >= 9618 && e <= 9621 || e === 9632 || e === 9633 || e >= 9635 && e <= 9641 || e === 9650 || e === 9651 || e === 9654 || e === 9655 || e === 9660 || e === 9661 || e === 9664 || e === 9665 || e >= 9670 && e <= 9672 || e === 9675 || e >= 9678 && e <= 9681 || e >= 9698 && e <= 9701 || e === 9711 || e === 9733 || e === 9734 || e === 9737 || e === 9742 || e === 9743 || e === 9756 || e === 9758 || e === 9792 || e === 9794 || e === 9824 || e === 9825 || e >= 9827 && e <= 9829 || e >= 9831 && e <= 9834 || e === 9836 || e === 9837 || e === 9839 || e === 9886 || e === 9887 || e === 9919 || e >= 9926 && e <= 9933 || e >= 9935 && e <= 9939 || e >= 9941 && e <= 9953 || e === 9955 || e === 9960 || e === 9961 || e >= 9963 && e <= 9969 || e === 9972 || e >= 9974 && e <= 9977 || e === 9979 || e === 9980 || e === 9982 || e === 9983 || e === 10045 || e >= 10102 && e <= 10111 || e >= 11094 && e <= 11097 || e >= 12872 && e <= 12879 || e >= 57344 && e <= 63743 || e >= 65024 && e <= 65039 || e === 65533 || e >= 127232 && e <= 127242 || e >= 127248 && e <= 127277 || e >= 127280 && e <= 127337 || e >= 127344 && e <= 127373 || e === 127375 || e === 127376 || e >= 127387 && e <= 127404 || e >= 917760 && e <= 917999 || e >= 983040 && e <= 1048573 || e >= 1048576 && e <= 1114109;
29037
- var pt2 = (e) => e === 12288 || e >= 65281 && e <= 65376 || e >= 65504 && e <= 65510;
29038
- var gt2 = (e) => e >= 4352 && e <= 4447 || e === 8986 || e === 8987 || e === 9001 || e === 9002 || e >= 9193 && e <= 9196 || e === 9200 || e === 9203 || e === 9725 || e === 9726 || e === 9748 || e === 9749 || e >= 9800 && e <= 9811 || e === 9855 || e === 9875 || e === 9889 || e === 9898 || e === 9899 || e === 9917 || e === 9918 || e === 9924 || e === 9925 || e === 9934 || e === 9940 || e === 9962 || e === 9970 || e === 9971 || e === 9973 || e === 9978 || e === 9981 || e === 9989 || e === 9994 || e === 9995 || e === 10024 || e === 10060 || e === 10062 || e >= 10067 && e <= 10069 || e === 10071 || e >= 10133 && e <= 10135 || e === 10160 || e === 10175 || e === 11035 || e === 11036 || e === 11088 || e === 11093 || e >= 11904 && e <= 11929 || e >= 11931 && e <= 12019 || e >= 12032 && e <= 12245 || e >= 12272 && e <= 12287 || e >= 12289 && e <= 12350 || e >= 12353 && e <= 12438 || e >= 12441 && e <= 12543 || e >= 12549 && e <= 12591 || e >= 12593 && e <= 12686 || e >= 12688 && e <= 12771 || e >= 12783 && e <= 12830 || e >= 12832 && e <= 12871 || e >= 12880 && e <= 19903 || e >= 19968 && e <= 42124 || e >= 42128 && e <= 42182 || e >= 43360 && e <= 43388 || e >= 44032 && e <= 55203 || e >= 63744 && e <= 64255 || e >= 65040 && e <= 65049 || e >= 65072 && e <= 65106 || e >= 65108 && e <= 65126 || e >= 65128 && e <= 65131 || e >= 94176 && e <= 94180 || e === 94192 || e === 94193 || e >= 94208 && e <= 100343 || e >= 100352 && e <= 101589 || e >= 101632 && e <= 101640 || e >= 110576 && e <= 110579 || e >= 110581 && e <= 110587 || e === 110589 || e === 110590 || e >= 110592 && e <= 110882 || e === 110898 || e >= 110928 && e <= 110930 || e === 110933 || e >= 110948 && e <= 110951 || e >= 110960 && e <= 111355 || e === 126980 || e === 127183 || e === 127374 || e >= 127377 && e <= 127386 || e >= 127488 && e <= 127490 || e >= 127504 && e <= 127547 || e >= 127552 && e <= 127560 || e === 127568 || e === 127569 || e >= 127584 && e <= 127589 || e >= 127744 && e <= 127776 || e >= 127789 && e <= 127797 || e >= 127799 && e <= 127868 || e >= 127870 && e <= 127891 || e >= 127904 && e <= 127946 || e >= 127951 && e <= 127955 || e >= 127968 && e <= 127984 || e === 127988 || e >= 127992 && e <= 128062 || e === 128064 || e >= 128066 && e <= 128252 || e >= 128255 && e <= 128317 || e >= 128331 && e <= 128334 || e >= 128336 && e <= 128359 || e === 128378 || e === 128405 || e === 128406 || e === 128420 || e >= 128507 && e <= 128591 || e >= 128640 && e <= 128709 || e === 128716 || e >= 128720 && e <= 128722 || e >= 128725 && e <= 128727 || e >= 128732 && e <= 128735 || e === 128747 || e === 128748 || e >= 128756 && e <= 128764 || e >= 128992 && e <= 129003 || e === 129008 || e >= 129292 && e <= 129338 || e >= 129340 && e <= 129349 || e >= 129351 && e <= 129535 || e >= 129648 && e <= 129660 || e >= 129664 && e <= 129672 || e >= 129680 && e <= 129725 || e >= 129727 && e <= 129733 || e >= 129742 && e <= 129755 || e >= 129760 && e <= 129768 || e >= 129776 && e <= 129784 || e >= 131072 && e <= 196605 || e >= 196608 && e <= 262141;
29039
- var ve = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/y;
29040
- var re = /[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y;
29041
- var ie = /\t{1,1000}/y;
29042
- var Ae = /[\u{1F1E6}-\u{1F1FF}]{2}|\u{1F3F4}[\u{E0061}-\u{E007A}]{2}[\u{E0030}-\u{E0039}\u{E0061}-\u{E007A}]{1,3}\u{E007F}|(?:\p{Emoji}\uFE0F\u20E3?|\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation})(?:\u200D(?:\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F\u20E3?))*/yu;
29043
- var ne = /(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y;
29044
- var ft2 = /\p{M}+/gu;
29045
- var Ft2 = { limit: 1 / 0, ellipsis: "" };
29046
- var Le = (e, r = {}, s = {}) => {
29047
- const i = r.limit ?? 1 / 0, n = r.ellipsis ?? "", o = r?.ellipsisWidth ?? (n ? Le(n, Ft2, s).width : 0), u = s.ansiWidth ?? 0, l = s.controlWidth ?? 0, a = s.tabWidth ?? 8, d = s.ambiguousWidth ?? 1, g = s.emojiWidth ?? 2, E = s.fullWidthWidth ?? 2, p = s.regularWidth ?? 1, y2 = s.wideWidth ?? 2;
29048
- let $ = 0, c = 0, m = e.length, f = 0, F = false, v = m, S2 = Math.max(0, i - o), B = 0, b = 0, A = 0, C = 0;
29049
- e:
29050
- for (;; ) {
29051
- if (b > B || c >= m && c > $) {
29052
- const _2 = e.slice(B, b) || e.slice($, c);
29053
- f = 0;
29054
- for (const D of _2.replaceAll(ft2, "")) {
29055
- const T2 = D.codePointAt(0) || 0;
29056
- if (pt2(T2) ? C = E : gt2(T2) ? C = y2 : d !== p && mt2(T2) ? C = d : C = p, A + C > S2 && (v = Math.min(v, Math.max(B, $) + f)), A + C > i) {
29057
- F = true;
29058
- break e;
29059
- }
29060
- f += D.length, A += C;
29061
- }
29062
- B = b = 0;
29063
- }
29064
- if (c >= m)
29065
- break;
29066
- if (ne.lastIndex = c, ne.test(e)) {
29067
- if (f = ne.lastIndex - c, C = f * p, A + C > S2 && (v = Math.min(v, c + Math.floor((S2 - A) / p))), A + C > i) {
29068
- F = true;
29069
- break;
29070
- }
29071
- A += C, B = $, b = c, c = $ = ne.lastIndex;
29072
- continue;
29073
- }
29074
- if (ve.lastIndex = c, ve.test(e)) {
29075
- if (A + u > S2 && (v = Math.min(v, c)), A + u > i) {
29076
- F = true;
29077
- break;
29078
- }
29079
- A += u, B = $, b = c, c = $ = ve.lastIndex;
29080
- continue;
29081
- }
29082
- if (re.lastIndex = c, re.test(e)) {
29083
- if (f = re.lastIndex - c, C = f * l, A + C > S2 && (v = Math.min(v, c + Math.floor((S2 - A) / l))), A + C > i) {
29084
- F = true;
29085
- break;
29086
- }
29087
- A += C, B = $, b = c, c = $ = re.lastIndex;
29088
- continue;
29089
- }
29090
- if (ie.lastIndex = c, ie.test(e)) {
29091
- if (f = ie.lastIndex - c, C = f * a, A + C > S2 && (v = Math.min(v, c + Math.floor((S2 - A) / a))), A + C > i) {
29092
- F = true;
29093
- break;
29094
- }
29095
- A += C, B = $, b = c, c = $ = ie.lastIndex;
29096
- continue;
29097
- }
29098
- if (Ae.lastIndex = c, Ae.test(e)) {
29099
- if (A + g > S2 && (v = Math.min(v, c)), A + g > i) {
29100
- F = true;
29101
- break;
29102
- }
29103
- A += g, B = $, b = c, c = $ = Ae.lastIndex;
29104
- continue;
29105
- }
29106
- c += 1;
29107
- }
29108
- return { width: F ? S2 : A, index: F ? v : m, truncated: F, ellipsed: F && i >= o };
29109
- };
29110
- var yt2 = { limit: 1 / 0, ellipsis: "", ellipsisWidth: 0 };
29111
- var M2 = (e, r = {}) => Le(e, yt2, r).width;
29112
- var ae = "\x1B";
29113
- var je = "\x9B";
29114
- var Et2 = 39;
29115
- var Ce = "\x07";
29116
- var Ve = "[";
29117
- var vt2 = "]";
29118
- var ke = "m";
29119
- var we = `${vt2}8;;`;
29120
- var Ge = new RegExp(`(?:\\${Ve}(?<code>\\d+)m|\\${we}(?<uri>.*)${Ce})`, "y");
29121
- var At2 = (e) => {
29122
- if (e >= 30 && e <= 37 || e >= 90 && e <= 97)
29123
- return 39;
29124
- if (e >= 40 && e <= 47 || e >= 100 && e <= 107)
29125
- return 49;
29126
- if (e === 1 || e === 2)
29127
- return 22;
29128
- if (e === 3)
29129
- return 23;
29130
- if (e === 4)
29131
- return 24;
29132
- if (e === 7)
29133
- return 27;
29134
- if (e === 8)
29135
- return 28;
29136
- if (e === 9)
29137
- return 29;
29138
- if (e === 0)
29139
- return 0;
29140
- };
29141
- var He = (e) => `${ae}${Ve}${e}${ke}`;
29142
- var Ue = (e) => `${ae}${we}${e}${Ce}`;
29143
- var Ct2 = (e) => e.map((r) => M2(r));
29144
- var Se = (e, r, s) => {
29145
- const i = r[Symbol.iterator]();
29146
- let n = false, o = false, u = e.at(-1), l = u === undefined ? 0 : M2(u), a = i.next(), d = i.next(), g = 0;
29147
- for (;!a.done; ) {
29148
- const E = a.value, p = M2(E);
29149
- l + p <= s ? e[e.length - 1] += E : (e.push(E), l = 0), (E === ae || E === je) && (n = true, o = r.startsWith(we, g + 1)), n ? o ? E === Ce && (n = false, o = false) : E === ke && (n = false) : (l += p, l === s && !d.done && (e.push(""), l = 0)), a = d, d = i.next(), g += E.length;
29150
- }
29151
- u = e.at(-1), !l && u !== undefined && u.length > 0 && e.length > 1 && (e[e.length - 2] += e.pop());
29152
- };
29153
- var wt2 = (e) => {
29154
- const r = e.split(" ");
29155
- let s = r.length;
29156
- for (;s > 0 && !(M2(r[s - 1]) > 0); )
29157
- s--;
29158
- return s === r.length ? e : r.slice(0, s).join(" ") + r.slice(s).join("");
29159
- };
29160
- var St2 = (e, r, s = {}) => {
29161
- if (s.trim !== false && e.trim() === "")
29162
- return "";
29163
- let i = "", n, o;
29164
- const u = e.split(" "), l = Ct2(u);
29165
- let a = [""];
29166
- for (const [$, c] of u.entries()) {
29167
- s.trim !== false && (a[a.length - 1] = (a.at(-1) ?? "").trimStart());
29168
- let m = M2(a.at(-1) ?? "");
29169
- if ($ !== 0 && (m >= r && (s.wordWrap === false || s.trim === false) && (a.push(""), m = 0), (m > 0 || s.trim === false) && (a[a.length - 1] += " ", m++)), s.hard && l[$] > r) {
29170
- const f = r - m, F = 1 + Math.floor((l[$] - f - 1) / r);
29171
- Math.floor((l[$] - 1) / r) < F && a.push(""), Se(a, c, r);
29172
- continue;
29173
- }
29174
- if (m + l[$] > r && m > 0 && l[$] > 0) {
29175
- if (s.wordWrap === false && m < r) {
29176
- Se(a, c, r);
29177
- continue;
29178
- }
29179
- a.push("");
29180
- }
29181
- if (m + l[$] > r && s.wordWrap === false) {
29182
- Se(a, c, r);
29183
- continue;
29184
- }
29185
- a[a.length - 1] += c;
29186
- }
29187
- s.trim !== false && (a = a.map(($) => wt2($)));
29188
- const d = a.join(`
29189
- `), g = d[Symbol.iterator]();
29190
- let E = g.next(), p = g.next(), y2 = 0;
29191
- for (;!E.done; ) {
29192
- const $ = E.value, c = p.value;
29193
- if (i += $, $ === ae || $ === je) {
29194
- Ge.lastIndex = y2 + 1;
29195
- const F = Ge.exec(d)?.groups;
29196
- if (F?.code !== undefined) {
29197
- const v = Number.parseFloat(F.code);
29198
- n = v === Et2 ? undefined : v;
29199
- } else
29200
- F?.uri !== undefined && (o = F.uri.length === 0 ? undefined : F.uri);
29201
- }
29202
- const m = n ? At2(n) : undefined;
29203
- c === `
29204
- ` ? (o && (i += Ue("")), n && m && (i += He(m))) : $ === `
29205
- ` && (n && m && (i += He(n)), o && (i += Ue(o))), y2 += $.length, E = p, p = g.next();
29367
+ return t("green", F2);
29206
29368
  }
29207
- return i;
29208
29369
  };
29209
- function q2(e, r, s) {
29210
- return String(e).normalize().replaceAll(`\r
29211
- `, `
29212
- `).split(`
29213
- `).map((i) => St2(i, r, s)).join(`
29214
- `);
29215
- }
29216
- var Rt = async (e, r) => {
29217
- const s = {}, i = Object.keys(e);
29218
- for (const n of i) {
29219
- const o = e[n], u = await o({ results: s })?.catch((l) => {
29220
- throw l;
29370
+ var dt = async (e, i) => {
29371
+ const s = {}, r = Object.keys(e);
29372
+ for (const u2 of r) {
29373
+ const n = e[u2], o = await n({ results: s })?.catch((c2) => {
29374
+ throw c2;
29221
29375
  });
29222
- if (typeof r?.onCancel == "function" && Ct(u)) {
29223
- s[n] = "canceled", r.onCancel({ results: s });
29376
+ if (typeof i?.onCancel == "function" && q(o)) {
29377
+ s[u2] = "canceled", i.onCancel({ results: s });
29224
29378
  continue;
29225
29379
  }
29226
- s[n] = u;
29380
+ s[u2] = o;
29227
29381
  }
29228
29382
  return s;
29229
29383
  };
29230
- var Pt = (e = "", r) => {
29231
- (r?.output ?? process.stdout).write(`${import_picocolors2.default.gray(x2)} ${import_picocolors2.default.red(e)}
29384
+ var pt = (e = "", i) => {
29385
+ const s = i?.output ?? process.stdout, r = i?.withGuide ?? u.withGuide ? `${t("gray", E2)} ` : "";
29386
+ s.write(`${r}${t("red", e)}
29232
29387
 
29233
29388
  `);
29234
29389
  };
29235
- var Nt = (e = "", r) => {
29236
- (r?.output ?? process.stdout).write(`${import_picocolors2.default.gray($e)} ${e}
29390
+ var mt = (e = "", i) => {
29391
+ const s = i?.output ?? process.stdout, r = i?.withGuide ?? u.withGuide ? `${t("gray", le)} ` : "";
29392
+ s.write(`${r}${e}
29237
29393
  `);
29238
29394
  };
29239
- var Wt2 = (e = "", r) => {
29240
- (r?.output ?? process.stdout).write(`${import_picocolors2.default.gray(h)}
29241
- ${import_picocolors2.default.gray(x2)} ${e}
29395
+ var gt = (e = "", i) => {
29396
+ const s = i?.output ?? process.stdout, r = i?.withGuide ?? u.withGuide ? `${t("gray", d2)}
29397
+ ${t("gray", E2)} ` : "";
29398
+ s.write(`${r}${e}
29242
29399
 
29243
29400
  `);
29244
29401
  };
29245
- var Ut = import_picocolors2.default.magenta;
29246
- var Ie = ({ indicator: e = "dots", onCancel: r, output: s = process.stdout, cancelMessage: i, errorMessage: n, frames: o = ee ? ["\u25D2", "\u25D0", "\u25D3", "\u25D1"] : ["\u2022", "o", "O", "0"], delay: u = ee ? 80 : 120, signal: l, ...a } = {}) => {
29247
- const d = ue();
29248
- let g, E, p = false, y2 = false, $ = "", c, m = performance.now();
29249
- const f = rt(s), F = a?.styleFrame ?? Ut, v = (I2) => {
29250
- const O2 = I2 > 1 ? n ?? _.messages.error : i ?? _.messages.cancel;
29251
- y2 = I2 === 1, p && (W2(O2, I2), y2 && typeof r == "function" && r());
29252
- }, S2 = () => v(2), B = () => v(1), b = () => {
29253
- process.on("uncaughtExceptionMonitor", S2), process.on("unhandledRejection", S2), process.on("SIGINT", B), process.on("SIGTERM", B), process.on("exit", v), l && l.addEventListener("abort", B);
29254
- }, A = () => {
29255
- process.removeListener("uncaughtExceptionMonitor", S2), process.removeListener("unhandledRejection", S2), process.removeListener("SIGINT", B), process.removeListener("SIGTERM", B), process.removeListener("exit", v), l && l.removeEventListener("abort", B);
29256
- }, C = () => {
29257
- if (c === undefined)
29402
+ var Ct = (e) => t("magenta", e);
29403
+ var fe = ({ indicator: e = "dots", onCancel: i, output: s = process.stdout, cancelMessage: r, errorMessage: u2, frames: n = ee ? ["\u25D2", "\u25D0", "\u25D3", "\u25D1"] : ["\u2022", "o", "O", "0"], delay: o = ee ? 80 : 120, signal: c2, ...a } = {}) => {
29404
+ const l = ae();
29405
+ let $2, y2, p2 = false, m = false, g = "", S2, h = performance.now();
29406
+ const f = O(s), v = a?.styleFrame ?? Ct, T2 = (_2) => {
29407
+ const A2 = _2 > 1 ? u2 ?? u.messages.error : r ?? u.messages.cancel;
29408
+ m = _2 === 1, p2 && (W2(A2, _2), m && typeof i == "function" && i());
29409
+ }, C2 = () => T2(2), b = () => T2(1), x = () => {
29410
+ process.on("uncaughtExceptionMonitor", C2), process.on("unhandledRejection", C2), process.on("SIGINT", b), process.on("SIGTERM", b), process.on("exit", T2), c2 && c2.addEventListener("abort", b);
29411
+ }, G2 = () => {
29412
+ process.removeListener("uncaughtExceptionMonitor", C2), process.removeListener("unhandledRejection", C2), process.removeListener("SIGINT", b), process.removeListener("SIGTERM", b), process.removeListener("exit", T2), c2 && c2.removeEventListener("abort", b);
29413
+ }, M2 = () => {
29414
+ if (S2 === undefined)
29258
29415
  return;
29259
- d && s.write(`
29416
+ l && s.write(`
29260
29417
  `);
29261
- const I2 = q2(c, f, { hard: true, trim: false }).split(`
29418
+ const _2 = wrapAnsi(S2, f, { hard: true, trim: false }).split(`
29262
29419
  `);
29263
- I2.length > 1 && s.write(import_sisteransi2.cursor.up(I2.length - 1)), s.write(import_sisteransi2.cursor.to(0)), s.write(import_sisteransi2.erase.down());
29264
- }, _2 = (I2) => I2.replace(/\.+$/, ""), D = (I2) => {
29265
- const O2 = (performance.now() - I2) / 1000, L2 = Math.floor(O2 / 60), j2 = Math.floor(O2 % 60);
29266
- return L2 > 0 ? `[${L2}m ${j2}s]` : `[${j2}s]`;
29267
- }, T2 = (I2 = "") => {
29268
- p = true, g = xt({ output: s }), $ = _2(I2), m = performance.now(), s.write(`${import_picocolors2.default.gray(h)}
29420
+ _2.length > 1 && s.write(import_sisteransi2.cursor.up(_2.length - 1)), s.write(import_sisteransi2.cursor.to(0)), s.write(import_sisteransi2.erase.down());
29421
+ }, R2 = (_2) => _2.replace(/\.+$/, ""), j2 = (_2) => {
29422
+ const A2 = (performance.now() - _2) / 1000, k2 = Math.floor(A2 / 60), L2 = Math.floor(A2 % 60);
29423
+ return k2 > 0 ? `[${k2}m ${L2}s]` : `[${L2}s]`;
29424
+ }, D2 = a.withGuide ?? u.withGuide, ie = (_2 = "") => {
29425
+ p2 = true, $2 = z({ output: s }), g = R2(_2), h = performance.now(), D2 && s.write(`${t("gray", d2)}
29269
29426
  `);
29270
- let O2 = 0, L2 = 0;
29271
- b(), E = setInterval(() => {
29272
- if (d && $ === c)
29427
+ let A2 = 0, k2 = 0;
29428
+ x(), y2 = setInterval(() => {
29429
+ if (l && g === S2)
29273
29430
  return;
29274
- C(), c = $;
29275
- const j2 = F(o[O2]);
29431
+ M2(), S2 = g;
29432
+ const L2 = v(n[A2]);
29276
29433
  let Z2;
29277
- if (d)
29278
- Z2 = `${j2} ${$}...`;
29434
+ if (l)
29435
+ Z2 = `${L2} ${g}...`;
29279
29436
  else if (e === "timer")
29280
- Z2 = `${j2} ${$} ${D(m)}`;
29437
+ Z2 = `${L2} ${g} ${j2(h)}`;
29281
29438
  else {
29282
- const Ze = ".".repeat(Math.floor(L2)).slice(0, 3);
29283
- Z2 = `${j2} ${$}${Ze}`;
29284
- }
29285
- const Qe = q2(Z2, f, { hard: true, trim: false });
29286
- s.write(Qe), O2 = O2 + 1 < o.length ? O2 + 1 : 0, L2 = L2 < 4 ? L2 + 0.125 : 0;
29287
- }, u);
29288
- }, W2 = (I2 = "", O2 = 0, L2 = false) => {
29289
- if (!p)
29439
+ const Be = ".".repeat(Math.floor(k2)).slice(0, 3);
29440
+ Z2 = `${L2} ${g}${Be}`;
29441
+ }
29442
+ const Ne = wrapAnsi(Z2, f, { hard: true, trim: false });
29443
+ s.write(Ne), A2 = A2 + 1 < n.length ? A2 + 1 : 0, k2 = k2 < 4 ? k2 + 0.125 : 0;
29444
+ }, o);
29445
+ }, W2 = (_2 = "", A2 = 0, k2 = false) => {
29446
+ if (!p2)
29290
29447
  return;
29291
- p = false, clearInterval(E), C();
29292
- const j2 = O2 === 0 ? import_picocolors2.default.green(k2) : O2 === 1 ? import_picocolors2.default.red(ce) : import_picocolors2.default.red(de);
29293
- $ = I2 ?? $, L2 || (e === "timer" ? s.write(`${j2} ${$} ${D(m)}
29294
- `) : s.write(`${j2} ${$}
29295
- `)), A(), g();
29296
- };
29297
- return { start: T2, stop: (I2 = "") => W2(I2, 0), message: (I2 = "") => {
29298
- $ = _2(I2 ?? $);
29299
- }, cancel: (I2 = "") => W2(I2, 1), error: (I2 = "") => W2(I2, 2), clear: () => W2("", 0, true), get isCancelled() {
29300
- return y2;
29448
+ p2 = false, clearInterval(y2), M2();
29449
+ const L2 = A2 === 0 ? t("green", F2) : A2 === 1 ? t("red", oe) : t("red", ue);
29450
+ g = _2 ?? g, k2 || (e === "timer" ? s.write(`${L2} ${g} ${j2(h)}
29451
+ `) : s.write(`${L2} ${g}
29452
+ `)), G2(), $2();
29453
+ };
29454
+ return { start: ie, stop: (_2 = "") => W2(_2, 0), message: (_2 = "") => {
29455
+ g = R2(_2 ?? g);
29456
+ }, cancel: (_2 = "") => W2(_2, 1), error: (_2 = "") => W2(_2, 2), clear: () => W2("", 0, true), get isCancelled() {
29457
+ return m;
29301
29458
  } };
29302
29459
  };
29303
- var Ye = { light: w2("\u2500", "-"), heavy: w2("\u2501", "="), block: w2("\u2588", "#") };
29304
- var ze = `${import_picocolors2.default.gray(h)} `;
29305
- var Qt = (e) => new $t({ validate: e.validate, placeholder: e.placeholder, defaultValue: e.defaultValue, initialValue: e.initialValue, output: e.output, signal: e.signal, input: e.input, render() {
29306
- const r = (e?.withGuide ?? _.withGuide) !== false, s = `${`${r ? `${import_picocolors2.default.gray(h)}
29307
- ` : ""}${N2(this.state)} `}${e.message}
29308
- `, i = e.placeholder ? import_picocolors2.default.inverse(e.placeholder[0]) + import_picocolors2.default.dim(e.placeholder.slice(1)) : import_picocolors2.default.inverse(import_picocolors2.default.hidden("_")), n = this.userInput ? this.userInputWithCursor : i, o = this.value ?? "";
29460
+ var Ve = { light: w2("\u2500", "-"), heavy: w2("\u2501", "="), block: w2("\u2588", "#") };
29461
+ var je = `${t("gray", d2)} `;
29462
+ var Ot = (e) => new at({ validate: e.validate, placeholder: e.placeholder, defaultValue: e.defaultValue, initialValue: e.initialValue, output: e.output, signal: e.signal, input: e.input, render() {
29463
+ const i = e?.withGuide ?? u.withGuide, s = `${`${i ? `${t("gray", d2)}
29464
+ ` : ""}${V2(this.state)} `}${e.message}
29465
+ `, r = e.placeholder ? t("inverse", e.placeholder[0]) + t("dim", e.placeholder.slice(1)) : t(["inverse", "hidden"], "_"), u2 = this.userInput ? this.userInputWithCursor : r, n = this.value ?? "";
29309
29466
  switch (this.state) {
29310
29467
  case "error": {
29311
- const u = this.error ? ` ${import_picocolors2.default.yellow(this.error)}` : "", l = r ? `${import_picocolors2.default.yellow(h)} ` : "", a = r ? import_picocolors2.default.yellow(x2) : "";
29468
+ const o = this.error ? ` ${t("yellow", this.error)}` : "", c2 = i ? `${t("yellow", d2)} ` : "", a = i ? t("yellow", E2) : "";
29312
29469
  return `${s.trim()}
29313
- ${l}${n}
29314
- ${a}${u}
29470
+ ${c2}${u2}
29471
+ ${a}${o}
29315
29472
  `;
29316
29473
  }
29317
29474
  case "submit": {
29318
- const u = o ? ` ${import_picocolors2.default.dim(o)}` : "", l = r ? import_picocolors2.default.gray(h) : "";
29319
- return `${s}${l}${u}`;
29475
+ const o = n ? ` ${t("dim", n)}` : "", c2 = i ? t("gray", d2) : "";
29476
+ return `${s}${c2}${o}`;
29320
29477
  }
29321
29478
  case "cancel": {
29322
- const u = o ? ` ${import_picocolors2.default.strikethrough(import_picocolors2.default.dim(o))}` : "", l = r ? import_picocolors2.default.gray(h) : "";
29323
- return `${s}${l}${u}${o.trim() ? `
29324
- ${l}` : ""}`;
29479
+ const o = n ? ` ${t(["strikethrough", "dim"], n)}` : "", c2 = i ? t("gray", d2) : "";
29480
+ return `${s}${c2}${o}${n.trim() ? `
29481
+ ${c2}` : ""}`;
29325
29482
  }
29326
29483
  default: {
29327
- const u = r ? `${import_picocolors2.default.cyan(h)} ` : "", l = r ? import_picocolors2.default.cyan(x2) : "";
29328
- return `${s}${u}${n}
29329
- ${l}
29484
+ const o = i ? `${t("cyan", d2)} ` : "", c2 = i ? t("cyan", E2) : "";
29485
+ return `${s}${o}${u2}
29486
+ ${c2}
29330
29487
  `;
29331
29488
  }
29332
29489
  }
@@ -29335,14 +29492,14 @@ ${l}
29335
29492
  // src/cli/prompts.ts
29336
29493
  async function runPrompts() {
29337
29494
  console.clear();
29338
- Nt("\uD83C\uDFAC Appium Session Recorder");
29495
+ mt("\uD83C\uDFAC Appium Session Recorder");
29339
29496
  const defaults = {
29340
29497
  port: "4724",
29341
29498
  host: "127.0.0.1",
29342
29499
  appiumUrl: "http://127.0.0.1:4723"
29343
29500
  };
29344
- const answers = await Rt({
29345
- port: () => Qt({
29501
+ const answers = await dt({
29502
+ port: () => Ot({
29346
29503
  message: `Proxy port (default: ${defaults.port}):`,
29347
29504
  placeholder: defaults.port,
29348
29505
  defaultValue: defaults.port,
@@ -29355,7 +29512,7 @@ async function runPrompts() {
29355
29512
  }
29356
29513
  }
29357
29514
  }),
29358
- host: () => Qt({
29515
+ host: () => Ot({
29359
29516
  message: `Proxy host (default: ${defaults.host}):`,
29360
29517
  placeholder: defaults.host,
29361
29518
  defaultValue: defaults.host,
@@ -29364,7 +29521,7 @@ async function runPrompts() {
29364
29521
  return;
29365
29522
  }
29366
29523
  }),
29367
- appiumUrl: () => Qt({
29524
+ appiumUrl: () => Ot({
29368
29525
  message: `Appium server URL (default: ${defaults.appiumUrl}):`,
29369
29526
  placeholder: defaults.appiumUrl,
29370
29527
  defaultValue: defaults.appiumUrl,
@@ -29380,7 +29537,7 @@ async function runPrompts() {
29380
29537
  })
29381
29538
  }, {
29382
29539
  onCancel: () => {
29383
- Pt("Operation cancelled.");
29540
+ pt("Operation cancelled.");
29384
29541
  process.exit(0);
29385
29542
  }
29386
29543
  });
@@ -29480,37 +29637,122 @@ class InteractionRecorder {
29480
29637
  }
29481
29638
  // src/server/proxy-middleware.ts
29482
29639
  var import_http_proxy_middleware = __toESM(require_dist(), 1);
29640
+ var W3C_ELEMENT_KEY = "element-6066-11e4-a52e-4f735466cecf";
29641
+ function classifyAction(method, path) {
29642
+ if (/\/element\/[^/]+\/click$/.test(path))
29643
+ return "tap";
29644
+ if (/\/element\/[^/]+\/value$/.test(path))
29645
+ return "type";
29646
+ if (/\/element\/[^/]+\/clear$/.test(path))
29647
+ return "clear";
29648
+ if (/\/back$/.test(path))
29649
+ return "back";
29650
+ if (/\/touch\/perform$/.test(path))
29651
+ return "swipe";
29652
+ if (/\/actions$/.test(path) && method === "POST")
29653
+ return "swipe";
29654
+ if (/\/element$/.test(path) || /\/elements$/.test(path))
29655
+ return "find";
29656
+ return "unknown";
29657
+ }
29658
+ function extractSelector(body) {
29659
+ if (body?.using && body?.value) {
29660
+ return {
29661
+ using: body.using,
29662
+ value: body.value
29663
+ };
29664
+ }
29665
+ return;
29666
+ }
29667
+ function extractElementIdFromActionPath(path) {
29668
+ return path.match(/\/element\/([^/]+)\/(?:click|value|clear)$/)?.[1];
29669
+ }
29670
+ function isFindRequest(path) {
29671
+ return /\/element$/.test(path) || /\/elements$/.test(path);
29672
+ }
29673
+ function extractElementIdsFromResponseBody(body) {
29674
+ if (!body)
29675
+ return [];
29676
+ try {
29677
+ const parsed = JSON.parse(body);
29678
+ const value = parsed?.value;
29679
+ const values = Array.isArray(value) ? value : [value];
29680
+ return values.map((entry) => {
29681
+ if (!entry || typeof entry !== "object")
29682
+ return null;
29683
+ const candidate = entry;
29684
+ return candidate[W3C_ELEMENT_KEY] || candidate.ELEMENT;
29685
+ }).filter((entry) => typeof entry === "string" && entry.length > 0);
29686
+ } catch {
29687
+ return [];
29688
+ }
29689
+ }
29483
29690
  function createSessionMiddleware(recorder, appiumClient) {
29691
+ const selectorsByElementId = new Map;
29484
29692
  return async (req, res, next) => {
29485
29693
  const { sessionId } = req.params;
29486
29694
  if (!recorder.shouldRecord(req.method, req.originalUrl)) {
29487
29695
  return next();
29488
29696
  }
29489
29697
  const isAction = recorder.isActionEndpoint(req.method, req.path);
29698
+ const actionKind = classifyAction(req.method, req.path);
29699
+ const requestSelector = extractSelector(req.body);
29700
+ const actionElementId = extractElementIdFromActionPath(req.path);
29701
+ const mappedSelector = actionElementId ? selectorsByElementId.get(`${sessionId}:${actionElementId}`) : undefined;
29490
29702
  const interactionData = {
29491
29703
  method: req.method,
29492
29704
  path: req.originalUrl,
29493
- body: req.body && Object.keys(req.body).length > 0 ? req.body : undefined
29705
+ body: req.body && Object.keys(req.body).length > 0 ? req.body : undefined,
29706
+ sessionId,
29707
+ actionKind
29494
29708
  };
29495
- if (req.body?.using && req.body?.value) {
29496
- interactionData.elementInfo = {
29497
- using: req.body.using,
29498
- value: req.body.value
29709
+ if (requestSelector || mappedSelector) {
29710
+ interactionData.elementInfo = requestSelector || mappedSelector;
29711
+ }
29712
+ const shouldCaptureSelectorMapping = !!requestSelector && isFindRequest(req.path);
29713
+ const responseChunks = [];
29714
+ if (shouldCaptureSelectorMapping) {
29715
+ const originalWrite = res.write.bind(res);
29716
+ const originalEnd = res.end.bind(res);
29717
+ res.write = (chunk, ...args) => {
29718
+ if (chunk) {
29719
+ responseChunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));
29720
+ }
29721
+ return originalWrite(chunk, ...args);
29722
+ };
29723
+ res.end = (chunk, ...args) => {
29724
+ if (chunk) {
29725
+ responseChunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));
29726
+ }
29727
+ return originalEnd(chunk, ...args);
29499
29728
  };
29500
29729
  }
29501
29730
  const interaction = recorder.recordInteraction(interactionData);
29502
- console.log(`[${interaction.id}] ${req.method} ${req.originalUrl}`);
29731
+ console.log(`[${interaction.id}] ${req.method} ${req.originalUrl} (${actionKind})`);
29503
29732
  if (interaction.body) {
29504
29733
  console.log("Body:", JSON.stringify(interaction.body, null, 2));
29505
29734
  }
29506
- if (isAction) {
29735
+ if (isAction || shouldCaptureSelectorMapping) {
29507
29736
  res.on("finish", async () => {
29508
- const state = await appiumClient.captureState(sessionId);
29509
- recorder.updateInteraction(interaction.id, {
29510
- screenshot: state.screenshot,
29511
- source: state.source
29512
- });
29513
- console.log(`[${interaction.id}] State captured (screenshot + source)`);
29737
+ if (shouldCaptureSelectorMapping && requestSelector) {
29738
+ const body = Buffer.concat(responseChunks).toString("utf8");
29739
+ const elementIds = extractElementIdsFromResponseBody(body);
29740
+ elementIds.forEach((elementId) => {
29741
+ selectorsByElementId.set(`${sessionId}:${elementId}`, requestSelector);
29742
+ });
29743
+ }
29744
+ if (!isAction)
29745
+ return;
29746
+ try {
29747
+ const state = await appiumClient.captureState(sessionId);
29748
+ recorder.updateInteraction(interaction.id, {
29749
+ screenshot: state.screenshot,
29750
+ source: state.source
29751
+ });
29752
+ console.log(`[${interaction.id}] State captured (screenshot + source)`);
29753
+ } catch (error) {
29754
+ console.error(`[${interaction.id}] Failed to capture state`, error);
29755
+ }
29514
29756
  });
29515
29757
  }
29516
29758
  next();
@@ -29538,7 +29780,7 @@ function resolveUiDir() {
29538
29780
  path.join(__dirname2, "../../dist/ui"),
29539
29781
  path.join(__dirname2, "ui")
29540
29782
  ];
29541
- return candidates.find((p) => fs.existsSync(p)) || candidates[0];
29783
+ return candidates.find((p2) => fs.existsSync(p2)) || candidates[0];
29542
29784
  }
29543
29785
  var uiDir = resolveUiDir();
29544
29786
  function createRoutes(recorder) {
@@ -29815,7 +30057,7 @@ function ensureNoUnexpectedFlags(flags, allowed) {
29815
30057
  }
29816
30058
 
29817
30059
  // src/core/appium/client.ts
29818
- var W3C_ELEMENT_KEY = "element-6066-11e4-a52e-4f735466cecf";
30060
+ var W3C_ELEMENT_KEY2 = "element-6066-11e4-a52e-4f735466cecf";
29819
30061
 
29820
30062
  class AppiumCommandError extends Error {
29821
30063
  code;
@@ -29942,7 +30184,7 @@ class AppiumCommandClient {
29942
30184
  using,
29943
30185
  value
29944
30186
  });
29945
- return result[W3C_ELEMENT_KEY] || result.ELEMENT;
30187
+ return result[W3C_ELEMENT_KEY2] || result.ELEMENT;
29946
30188
  }
29947
30189
  async tap(sessionId, using, value) {
29948
30190
  const elementId = await this.findElement(sessionId, using, value);
@@ -29952,6 +30194,9 @@ class AppiumCommandClient {
29952
30194
  value
29953
30195
  });
29954
30196
  }
30197
+ await this.tapElement(sessionId, elementId);
30198
+ }
30199
+ async tapElement(sessionId, elementId) {
29955
30200
  await this.request("POST", `/session/${sessionId}/element/${elementId}/click`, {});
29956
30201
  }
29957
30202
  async clear(sessionId, using, value) {
@@ -29962,6 +30207,9 @@ class AppiumCommandClient {
29962
30207
  value
29963
30208
  });
29964
30209
  }
30210
+ await this.clearElement(sessionId, elementId);
30211
+ }
30212
+ async clearElement(sessionId, elementId) {
29965
30213
  await this.request("POST", `/session/${sessionId}/element/${elementId}/clear`, {});
29966
30214
  }
29967
30215
  async type(sessionId, using, value, text, clearFirst) {
@@ -29973,8 +30221,11 @@ class AppiumCommandClient {
29973
30221
  });
29974
30222
  }
29975
30223
  if (clearFirst) {
29976
- await this.request("POST", `/session/${sessionId}/element/${elementId}/clear`, {});
30224
+ await this.clearElement(sessionId, elementId);
29977
30225
  }
30226
+ await this.typeElement(sessionId, elementId, text);
30227
+ }
30228
+ async typeElement(sessionId, elementId, text) {
29978
30229
  await this.request("POST", `/session/${sessionId}/element/${elementId}/value`, {
29979
30230
  text,
29980
30231
  value: [...text]
@@ -30025,12 +30276,12 @@ class AppiumCommandClient {
30025
30276
  var SCROLL_DIRECTIONS = ["up", "down", "left", "right"];
30026
30277
  function parsePoint(name, value) {
30027
30278
  const [xRaw, yRaw] = value.split(",");
30028
- const x3 = Number(xRaw);
30279
+ const x = Number(xRaw);
30029
30280
  const y2 = Number(yRaw);
30030
- if (!Number.isFinite(x3) || !Number.isFinite(y2)) {
30281
+ if (!Number.isFinite(x) || !Number.isFinite(y2)) {
30031
30282
  throw new Error(`--${name} must be in format x,y`);
30032
30283
  }
30033
- return { x: x3, y: y2 };
30284
+ return { x, y: y2 };
30034
30285
  }
30035
30286
  async function runDriveTap(args) {
30036
30287
  const parsed = parseFlags(args);
@@ -30206,6 +30457,16 @@ var isName = function(string) {
30206
30457
  function isExist(v) {
30207
30458
  return typeof v !== "undefined";
30208
30459
  }
30460
+ var DANGEROUS_PROPERTY_NAMES = [
30461
+ "hasOwnProperty",
30462
+ "toString",
30463
+ "valueOf",
30464
+ "__defineGetter__",
30465
+ "__defineSetter__",
30466
+ "__lookupGetter__",
30467
+ "__lookupSetter__"
30468
+ ];
30469
+ var criticalProperties = ["__proto__", "constructor", "prototype"];
30209
30470
 
30210
30471
  // node_modules/fast-xml-parser/src/validator.js
30211
30472
  var defaultOptions = {
@@ -30442,7 +30703,7 @@ function validateAttributeString(attrStr, options) {
30442
30703
  if (!validateAttrName(attrName)) {
30443
30704
  return getErrorObject("InvalidAttr", "Attribute '" + attrName + "' is an invalid name.", getPositionFromMatch(matches[i]));
30444
30705
  }
30445
- if (!attrNames.hasOwnProperty(attrName)) {
30706
+ if (!Object.prototype.hasOwnProperty.call(attrNames, attrName)) {
30446
30707
  attrNames[attrName] = 1;
30447
30708
  } else {
30448
30709
  return getErrorObject("InvalidAttr", "Attribute '" + attrName + "' is repeated.", getPositionFromMatch(matches[i]));
@@ -30451,15 +30712,15 @@ function validateAttributeString(attrStr, options) {
30451
30712
  return true;
30452
30713
  }
30453
30714
  function validateNumberAmpersand(xmlData, i) {
30454
- let re2 = /\d/;
30715
+ let re = /\d/;
30455
30716
  if (xmlData[i] === "x") {
30456
30717
  i++;
30457
- re2 = /[\da-fA-F]/;
30718
+ re = /[\da-fA-F]/;
30458
30719
  }
30459
30720
  for (;i < xmlData.length; i++) {
30460
30721
  if (xmlData[i] === ";")
30461
30722
  return i;
30462
- if (!xmlData[i].match(re2))
30723
+ if (!xmlData[i].match(re))
30463
30724
  break;
30464
30725
  }
30465
30726
  return -1;
@@ -30510,6 +30771,12 @@ function getPositionFromMatch(match) {
30510
30771
  }
30511
30772
 
30512
30773
  // node_modules/fast-xml-parser/src/xmlparser/OptionsBuilder.js
30774
+ var defaultOnDangerousProperty = (name) => {
30775
+ if (DANGEROUS_PROPERTY_NAMES.includes(name)) {
30776
+ return "__" + name;
30777
+ }
30778
+ return name;
30779
+ };
30513
30780
  var defaultOptions2 = {
30514
30781
  preserveOrder: false,
30515
30782
  attributeNamePrefix: "@_",
@@ -30547,10 +30814,78 @@ var defaultOptions2 = {
30547
30814
  updateTag: function(tagName, jPath, attrs) {
30548
30815
  return tagName;
30549
30816
  },
30550
- captureMetaData: false
30817
+ captureMetaData: false,
30818
+ maxNestedTags: 100,
30819
+ strictReservedNames: true,
30820
+ jPath: true,
30821
+ onDangerousProperty: defaultOnDangerousProperty
30551
30822
  };
30823
+ function validatePropertyName(propertyName, optionName) {
30824
+ if (typeof propertyName !== "string") {
30825
+ return;
30826
+ }
30827
+ const normalized = propertyName.toLowerCase();
30828
+ if (DANGEROUS_PROPERTY_NAMES.some((dangerous) => normalized === dangerous.toLowerCase())) {
30829
+ throw new Error(`[SECURITY] Invalid ${optionName}: "${propertyName}" is a reserved JavaScript keyword that could cause prototype pollution`);
30830
+ }
30831
+ if (criticalProperties.some((dangerous) => normalized === dangerous.toLowerCase())) {
30832
+ throw new Error(`[SECURITY] Invalid ${optionName}: "${propertyName}" is a reserved JavaScript keyword that could cause prototype pollution`);
30833
+ }
30834
+ }
30835
+ function normalizeProcessEntities(value) {
30836
+ if (typeof value === "boolean") {
30837
+ return {
30838
+ enabled: value,
30839
+ maxEntitySize: 1e4,
30840
+ maxExpansionDepth: 10,
30841
+ maxTotalExpansions: 1000,
30842
+ maxExpandedLength: 1e5,
30843
+ maxEntityCount: 100,
30844
+ allowedTags: null,
30845
+ tagFilter: null
30846
+ };
30847
+ }
30848
+ if (typeof value === "object" && value !== null) {
30849
+ return {
30850
+ enabled: value.enabled !== false,
30851
+ maxEntitySize: Math.max(1, value.maxEntitySize ?? 1e4),
30852
+ maxExpansionDepth: Math.max(1, value.maxExpansionDepth ?? 10),
30853
+ maxTotalExpansions: Math.max(1, value.maxTotalExpansions ?? 1000),
30854
+ maxExpandedLength: Math.max(1, value.maxExpandedLength ?? 1e5),
30855
+ maxEntityCount: Math.max(1, value.maxEntityCount ?? 100),
30856
+ allowedTags: value.allowedTags ?? null,
30857
+ tagFilter: value.tagFilter ?? null
30858
+ };
30859
+ }
30860
+ return normalizeProcessEntities(true);
30861
+ }
30552
30862
  var buildOptions = function(options) {
30553
- return Object.assign({}, defaultOptions2, options);
30863
+ const built = Object.assign({}, defaultOptions2, options);
30864
+ const propertyNameOptions = [
30865
+ { value: built.attributeNamePrefix, name: "attributeNamePrefix" },
30866
+ { value: built.attributesGroupName, name: "attributesGroupName" },
30867
+ { value: built.textNodeName, name: "textNodeName" },
30868
+ { value: built.cdataPropName, name: "cdataPropName" },
30869
+ { value: built.commentPropName, name: "commentPropName" }
30870
+ ];
30871
+ for (const { value, name } of propertyNameOptions) {
30872
+ if (value) {
30873
+ validatePropertyName(value, name);
30874
+ }
30875
+ }
30876
+ if (built.onDangerousProperty === null) {
30877
+ built.onDangerousProperty = defaultOnDangerousProperty;
30878
+ }
30879
+ built.processEntities = normalizeProcessEntities(built.processEntities);
30880
+ if (built.stopNodes && Array.isArray(built.stopNodes)) {
30881
+ built.stopNodes = built.stopNodes.map((node) => {
30882
+ if (typeof node === "string" && node.startsWith("*.")) {
30883
+ return ".." + node.substring(2);
30884
+ }
30885
+ return node;
30886
+ });
30887
+ }
30888
+ return built;
30554
30889
  };
30555
30890
 
30556
30891
  // node_modules/fast-xml-parser/src/xmlparser/xmlNode.js
@@ -30565,7 +30900,7 @@ class XmlNode {
30565
30900
  constructor(tagname) {
30566
30901
  this.tagname = tagname;
30567
30902
  this.child = [];
30568
- this[":@"] = {};
30903
+ this[":@"] = Object.create(null);
30569
30904
  }
30570
30905
  add(key, val) {
30571
30906
  if (key === "__proto__")
@@ -30591,11 +30926,13 @@ class XmlNode {
30591
30926
 
30592
30927
  // node_modules/fast-xml-parser/src/xmlparser/DocTypeReader.js
30593
30928
  class DocTypeReader {
30594
- constructor(processEntities) {
30595
- this.suppressValidationErr = !processEntities;
30929
+ constructor(options) {
30930
+ this.suppressValidationErr = !options;
30931
+ this.options = options;
30596
30932
  }
30597
30933
  readDocType(xmlData, i) {
30598
- const entities = {};
30934
+ const entities = Object.create(null);
30935
+ let entityCount = 0;
30599
30936
  if (xmlData[i + 3] === "O" && xmlData[i + 4] === "C" && xmlData[i + 5] === "T" && xmlData[i + 6] === "Y" && xmlData[i + 7] === "P" && xmlData[i + 8] === "E") {
30600
30937
  i = i + 9;
30601
30938
  let angleBracketsCount = 1;
@@ -30607,11 +30944,17 @@ class DocTypeReader {
30607
30944
  i += 7;
30608
30945
  let entityName, val;
30609
30946
  [entityName, val, i] = this.readEntityExp(xmlData, i + 1, this.suppressValidationErr);
30610
- if (val.indexOf("&") === -1)
30947
+ if (val.indexOf("&") === -1) {
30948
+ if (this.options.enabled !== false && this.options.maxEntityCount != null && entityCount >= this.options.maxEntityCount) {
30949
+ throw new Error(`Entity count (${entityCount + 1}) exceeds maximum allowed (${this.options.maxEntityCount})`);
30950
+ }
30951
+ const escaped = entityName.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
30611
30952
  entities[entityName] = {
30612
- regx: RegExp(`&${entityName};`, "g"),
30953
+ regx: RegExp(`&${escaped};`, "g"),
30613
30954
  val
30614
30955
  };
30956
+ entityCount++;
30957
+ }
30615
30958
  } else if (hasBody && hasSeq(xmlData, "!ELEMENT", i)) {
30616
30959
  i += 8;
30617
30960
  const { index } = this.readElementExp(xmlData, i + 1);
@@ -30656,11 +30999,11 @@ class DocTypeReader {
30656
30999
  }
30657
31000
  readEntityExp(xmlData, i) {
30658
31001
  i = skipWhitespace(xmlData, i);
30659
- let entityName = "";
31002
+ const startIndex = i;
30660
31003
  while (i < xmlData.length && !/\s/.test(xmlData[i]) && xmlData[i] !== '"' && xmlData[i] !== "'") {
30661
- entityName += xmlData[i];
30662
31004
  i++;
30663
31005
  }
31006
+ let entityName = xmlData.substring(startIndex, i);
30664
31007
  validateEntityName(entityName);
30665
31008
  i = skipWhitespace(xmlData, i);
30666
31009
  if (!this.suppressValidationErr) {
@@ -30672,16 +31015,19 @@ class DocTypeReader {
30672
31015
  }
30673
31016
  let entityValue = "";
30674
31017
  [i, entityValue] = this.readIdentifierVal(xmlData, i, "entity");
31018
+ if (this.options.enabled !== false && this.options.maxEntitySize != null && entityValue.length > this.options.maxEntitySize) {
31019
+ throw new Error(`Entity "${entityName}" size (${entityValue.length}) exceeds maximum allowed size (${this.options.maxEntitySize})`);
31020
+ }
30675
31021
  i--;
30676
31022
  return [entityName, entityValue, i];
30677
31023
  }
30678
31024
  readNotationExp(xmlData, i) {
30679
31025
  i = skipWhitespace(xmlData, i);
30680
- let notationName = "";
31026
+ const startIndex = i;
30681
31027
  while (i < xmlData.length && !/\s/.test(xmlData[i])) {
30682
- notationName += xmlData[i];
30683
31028
  i++;
30684
31029
  }
31030
+ let notationName = xmlData.substring(startIndex, i);
30685
31031
  !this.suppressValidationErr && validateEntityName(notationName);
30686
31032
  i = skipWhitespace(xmlData, i);
30687
31033
  const identifierType = xmlData.substring(i, i + 6).toUpperCase();
@@ -30713,10 +31059,11 @@ class DocTypeReader {
30713
31059
  throw new Error(`Expected quoted string, found "${startChar}"`);
30714
31060
  }
30715
31061
  i++;
31062
+ const startIndex = i;
30716
31063
  while (i < xmlData.length && xmlData[i] !== startChar) {
30717
- identifierVal += xmlData[i];
30718
31064
  i++;
30719
31065
  }
31066
+ identifierVal = xmlData.substring(startIndex, i);
30720
31067
  if (xmlData[i] !== startChar) {
30721
31068
  throw new Error(`Unterminated ${type} value`);
30722
31069
  }
@@ -30725,11 +31072,11 @@ class DocTypeReader {
30725
31072
  }
30726
31073
  readElementExp(xmlData, i) {
30727
31074
  i = skipWhitespace(xmlData, i);
30728
- let elementName = "";
31075
+ const startIndex = i;
30729
31076
  while (i < xmlData.length && !/\s/.test(xmlData[i])) {
30730
- elementName += xmlData[i];
30731
31077
  i++;
30732
31078
  }
31079
+ let elementName = xmlData.substring(startIndex, i);
30733
31080
  if (!this.suppressValidationErr && !isName(elementName)) {
30734
31081
  throw new Error(`Invalid element name: "${elementName}"`);
30735
31082
  }
@@ -30741,10 +31088,11 @@ class DocTypeReader {
30741
31088
  i += 2;
30742
31089
  else if (xmlData[i] === "(") {
30743
31090
  i++;
31091
+ const startIndex2 = i;
30744
31092
  while (i < xmlData.length && xmlData[i] !== ")") {
30745
- contentModel += xmlData[i];
30746
31093
  i++;
30747
31094
  }
31095
+ contentModel = xmlData.substring(startIndex2, i);
30748
31096
  if (xmlData[i] !== ")") {
30749
31097
  throw new Error("Unterminated content model");
30750
31098
  }
@@ -30759,18 +31107,18 @@ class DocTypeReader {
30759
31107
  }
30760
31108
  readAttlistExp(xmlData, i) {
30761
31109
  i = skipWhitespace(xmlData, i);
30762
- let elementName = "";
31110
+ let startIndex = i;
30763
31111
  while (i < xmlData.length && !/\s/.test(xmlData[i])) {
30764
- elementName += xmlData[i];
30765
31112
  i++;
30766
31113
  }
31114
+ let elementName = xmlData.substring(startIndex, i);
30767
31115
  validateEntityName(elementName);
30768
31116
  i = skipWhitespace(xmlData, i);
30769
- let attributeName = "";
31117
+ startIndex = i;
30770
31118
  while (i < xmlData.length && !/\s/.test(xmlData[i])) {
30771
- attributeName += xmlData[i];
30772
31119
  i++;
30773
31120
  }
31121
+ let attributeName = xmlData.substring(startIndex, i);
30774
31122
  if (!validateEntityName(attributeName)) {
30775
31123
  throw new Error(`Invalid attribute name: "${attributeName}"`);
30776
31124
  }
@@ -30786,11 +31134,11 @@ class DocTypeReader {
30786
31134
  i++;
30787
31135
  let allowedNotations = [];
30788
31136
  while (i < xmlData.length && xmlData[i] !== ")") {
30789
- let notation = "";
31137
+ const startIndex2 = i;
30790
31138
  while (i < xmlData.length && xmlData[i] !== "|" && xmlData[i] !== ")") {
30791
- notation += xmlData[i];
30792
31139
  i++;
30793
31140
  }
31141
+ let notation = xmlData.substring(startIndex2, i);
30794
31142
  notation = notation.trim();
30795
31143
  if (!validateEntityName(notation)) {
30796
31144
  throw new Error(`Invalid notation name: "${notation}"`);
@@ -30807,10 +31155,11 @@ class DocTypeReader {
30807
31155
  i++;
30808
31156
  attributeType += " (" + allowedNotations.join("|") + ")";
30809
31157
  } else {
31158
+ const startIndex2 = i;
30810
31159
  while (i < xmlData.length && !/\s/.test(xmlData[i])) {
30811
- attributeType += xmlData[i];
30812
31160
  i++;
30813
31161
  }
31162
+ attributeType += xmlData.substring(startIndex2, i);
30814
31163
  const validTypes = ["CDATA", "ID", "IDREF", "IDREFS", "ENTITY", "ENTITIES", "NMTOKEN", "NMTOKENS"];
30815
31164
  if (!this.suppressValidationErr && !validTypes.includes(attributeType.toUpperCase())) {
30816
31165
  throw new Error(`Invalid attribute type: "${attributeType}"`);
@@ -30863,19 +31212,24 @@ var consider = {
30863
31212
  hex: true,
30864
31213
  leadingZeros: true,
30865
31214
  decimalPoint: ".",
30866
- eNotation: true
31215
+ eNotation: true,
31216
+ infinity: "original"
30867
31217
  };
30868
31218
  function toNumber(str, options = {}) {
30869
31219
  options = Object.assign({}, consider, options);
30870
31220
  if (!str || typeof str !== "string")
30871
31221
  return str;
30872
31222
  let trimmedStr = str.trim();
30873
- if (options.skipLike !== undefined && options.skipLike.test(trimmedStr))
31223
+ if (trimmedStr.length === 0)
31224
+ return str;
31225
+ else if (options.skipLike !== undefined && options.skipLike.test(trimmedStr))
30874
31226
  return str;
30875
- else if (str === "0")
31227
+ else if (trimmedStr === "0")
30876
31228
  return 0;
30877
31229
  else if (options.hex && hexRegex.test(trimmedStr)) {
30878
31230
  return parse_int(trimmedStr, 16);
31231
+ } else if (!isFinite(trimmedStr)) {
31232
+ return handleInfinity(str, Number(trimmedStr), options);
30879
31233
  } else if (trimmedStr.includes("e") || trimmedStr.includes("E")) {
30880
31234
  return resolveEnotation(str, trimmedStr, options);
30881
31235
  } else {
@@ -30933,11 +31287,15 @@ function resolveEnotation(str, trimmedStr, options) {
30933
31287
  return str;
30934
31288
  else if (leadingZeros.length === 1 && (notation[3].startsWith(`.${eChar}`) || notation[3][0] === eChar)) {
30935
31289
  return Number(trimmedStr);
30936
- } else if (options.leadingZeros && !eAdjacentToLeadingZeros) {
30937
- trimmedStr = (notation[1] || "") + notation[3];
31290
+ } else if (leadingZeros.length > 0) {
31291
+ if (options.leadingZeros && !eAdjacentToLeadingZeros) {
31292
+ trimmedStr = (notation[1] || "") + notation[3];
31293
+ return Number(trimmedStr);
31294
+ } else
31295
+ return str;
31296
+ } else {
30938
31297
  return Number(trimmedStr);
30939
- } else
30940
- return str;
31298
+ }
30941
31299
  } else {
30942
31300
  return str;
30943
31301
  }
@@ -30965,6 +31323,20 @@ function parse_int(numStr, base) {
30965
31323
  else
30966
31324
  throw new Error("parseInt, Number.parseInt, window.parseInt are not supported");
30967
31325
  }
31326
+ function handleInfinity(str, num, options) {
31327
+ const isPositive = num === Infinity;
31328
+ switch (options.infinity.toLowerCase()) {
31329
+ case "null":
31330
+ return null;
31331
+ case "infinity":
31332
+ return num;
31333
+ case "string":
31334
+ return isPositive ? "Infinity" : "-Infinity";
31335
+ case "original":
31336
+ default:
31337
+ return str;
31338
+ }
31339
+ }
30968
31340
 
30969
31341
  // node_modules/fast-xml-parser/src/ignoreAttributes.js
30970
31342
  function getIgnoreAttributesFn(ignoreAttributes) {
@@ -30986,7 +31358,407 @@ function getIgnoreAttributesFn(ignoreAttributes) {
30986
31358
  return () => false;
30987
31359
  }
30988
31360
 
31361
+ // node_modules/path-expression-matcher/src/Expression.js
31362
+ class Expression {
31363
+ constructor(pattern, options = {}) {
31364
+ this.pattern = pattern;
31365
+ this.separator = options.separator || ".";
31366
+ this.segments = this._parse(pattern);
31367
+ this._hasDeepWildcard = this.segments.some((seg) => seg.type === "deep-wildcard");
31368
+ this._hasAttributeCondition = this.segments.some((seg) => seg.attrName !== undefined);
31369
+ this._hasPositionSelector = this.segments.some((seg) => seg.position !== undefined);
31370
+ }
31371
+ _parse(pattern) {
31372
+ const segments = [];
31373
+ let i = 0;
31374
+ let currentPart = "";
31375
+ while (i < pattern.length) {
31376
+ if (pattern[i] === this.separator) {
31377
+ if (i + 1 < pattern.length && pattern[i + 1] === this.separator) {
31378
+ if (currentPart.trim()) {
31379
+ segments.push(this._parseSegment(currentPart.trim()));
31380
+ currentPart = "";
31381
+ }
31382
+ segments.push({ type: "deep-wildcard" });
31383
+ i += 2;
31384
+ } else {
31385
+ if (currentPart.trim()) {
31386
+ segments.push(this._parseSegment(currentPart.trim()));
31387
+ }
31388
+ currentPart = "";
31389
+ i++;
31390
+ }
31391
+ } else {
31392
+ currentPart += pattern[i];
31393
+ i++;
31394
+ }
31395
+ }
31396
+ if (currentPart.trim()) {
31397
+ segments.push(this._parseSegment(currentPart.trim()));
31398
+ }
31399
+ return segments;
31400
+ }
31401
+ _parseSegment(part) {
31402
+ const segment = { type: "tag" };
31403
+ let bracketContent = null;
31404
+ let withoutBrackets = part;
31405
+ const bracketMatch = part.match(/^([^\[]+)(\[[^\]]*\])(.*)$/);
31406
+ if (bracketMatch) {
31407
+ withoutBrackets = bracketMatch[1] + bracketMatch[3];
31408
+ if (bracketMatch[2]) {
31409
+ const content = bracketMatch[2].slice(1, -1);
31410
+ if (content) {
31411
+ bracketContent = content;
31412
+ }
31413
+ }
31414
+ }
31415
+ let namespace = undefined;
31416
+ let tagAndPosition = withoutBrackets;
31417
+ if (withoutBrackets.includes("::")) {
31418
+ const nsIndex = withoutBrackets.indexOf("::");
31419
+ namespace = withoutBrackets.substring(0, nsIndex).trim();
31420
+ tagAndPosition = withoutBrackets.substring(nsIndex + 2).trim();
31421
+ if (!namespace) {
31422
+ throw new Error(`Invalid namespace in pattern: ${part}`);
31423
+ }
31424
+ }
31425
+ let tag = undefined;
31426
+ let positionMatch = null;
31427
+ if (tagAndPosition.includes(":")) {
31428
+ const colonIndex = tagAndPosition.lastIndexOf(":");
31429
+ const tagPart = tagAndPosition.substring(0, colonIndex).trim();
31430
+ const posPart = tagAndPosition.substring(colonIndex + 1).trim();
31431
+ const isPositionKeyword = ["first", "last", "odd", "even"].includes(posPart) || /^nth\(\d+\)$/.test(posPart);
31432
+ if (isPositionKeyword) {
31433
+ tag = tagPart;
31434
+ positionMatch = posPart;
31435
+ } else {
31436
+ tag = tagAndPosition;
31437
+ }
31438
+ } else {
31439
+ tag = tagAndPosition;
31440
+ }
31441
+ if (!tag) {
31442
+ throw new Error(`Invalid segment pattern: ${part}`);
31443
+ }
31444
+ segment.tag = tag;
31445
+ if (namespace) {
31446
+ segment.namespace = namespace;
31447
+ }
31448
+ if (bracketContent) {
31449
+ if (bracketContent.includes("=")) {
31450
+ const eqIndex = bracketContent.indexOf("=");
31451
+ segment.attrName = bracketContent.substring(0, eqIndex).trim();
31452
+ segment.attrValue = bracketContent.substring(eqIndex + 1).trim();
31453
+ } else {
31454
+ segment.attrName = bracketContent.trim();
31455
+ }
31456
+ }
31457
+ if (positionMatch) {
31458
+ const nthMatch = positionMatch.match(/^nth\((\d+)\)$/);
31459
+ if (nthMatch) {
31460
+ segment.position = "nth";
31461
+ segment.positionValue = parseInt(nthMatch[1], 10);
31462
+ } else {
31463
+ segment.position = positionMatch;
31464
+ }
31465
+ }
31466
+ return segment;
31467
+ }
31468
+ get length() {
31469
+ return this.segments.length;
31470
+ }
31471
+ hasDeepWildcard() {
31472
+ return this._hasDeepWildcard;
31473
+ }
31474
+ hasAttributeCondition() {
31475
+ return this._hasAttributeCondition;
31476
+ }
31477
+ hasPositionSelector() {
31478
+ return this._hasPositionSelector;
31479
+ }
31480
+ toString() {
31481
+ return this.pattern;
31482
+ }
31483
+ }
31484
+
31485
+ // node_modules/path-expression-matcher/src/Matcher.js
31486
+ var MUTATING_METHODS = new Set(["push", "pop", "reset", "updateCurrent", "restore"]);
31487
+
31488
+ class Matcher {
31489
+ constructor(options = {}) {
31490
+ this.separator = options.separator || ".";
31491
+ this.path = [];
31492
+ this.siblingStacks = [];
31493
+ }
31494
+ push(tagName, attrValues = null, namespace = null) {
31495
+ if (this.path.length > 0) {
31496
+ const prev = this.path[this.path.length - 1];
31497
+ prev.values = undefined;
31498
+ }
31499
+ const currentLevel = this.path.length;
31500
+ if (!this.siblingStacks[currentLevel]) {
31501
+ this.siblingStacks[currentLevel] = new Map;
31502
+ }
31503
+ const siblings = this.siblingStacks[currentLevel];
31504
+ const siblingKey = namespace ? `${namespace}:${tagName}` : tagName;
31505
+ const counter = siblings.get(siblingKey) || 0;
31506
+ let position = 0;
31507
+ for (const count of siblings.values()) {
31508
+ position += count;
31509
+ }
31510
+ siblings.set(siblingKey, counter + 1);
31511
+ const node = {
31512
+ tag: tagName,
31513
+ position,
31514
+ counter
31515
+ };
31516
+ if (namespace !== null && namespace !== undefined) {
31517
+ node.namespace = namespace;
31518
+ }
31519
+ if (attrValues !== null && attrValues !== undefined) {
31520
+ node.values = attrValues;
31521
+ }
31522
+ this.path.push(node);
31523
+ }
31524
+ pop() {
31525
+ if (this.path.length === 0) {
31526
+ return;
31527
+ }
31528
+ const node = this.path.pop();
31529
+ if (this.siblingStacks.length > this.path.length + 1) {
31530
+ this.siblingStacks.length = this.path.length + 1;
31531
+ }
31532
+ return node;
31533
+ }
31534
+ updateCurrent(attrValues) {
31535
+ if (this.path.length > 0) {
31536
+ const current = this.path[this.path.length - 1];
31537
+ if (attrValues !== null && attrValues !== undefined) {
31538
+ current.values = attrValues;
31539
+ }
31540
+ }
31541
+ }
31542
+ getCurrentTag() {
31543
+ return this.path.length > 0 ? this.path[this.path.length - 1].tag : undefined;
31544
+ }
31545
+ getCurrentNamespace() {
31546
+ return this.path.length > 0 ? this.path[this.path.length - 1].namespace : undefined;
31547
+ }
31548
+ getAttrValue(attrName) {
31549
+ if (this.path.length === 0)
31550
+ return;
31551
+ const current = this.path[this.path.length - 1];
31552
+ return current.values?.[attrName];
31553
+ }
31554
+ hasAttr(attrName) {
31555
+ if (this.path.length === 0)
31556
+ return false;
31557
+ const current = this.path[this.path.length - 1];
31558
+ return current.values !== undefined && attrName in current.values;
31559
+ }
31560
+ getPosition() {
31561
+ if (this.path.length === 0)
31562
+ return -1;
31563
+ return this.path[this.path.length - 1].position ?? 0;
31564
+ }
31565
+ getCounter() {
31566
+ if (this.path.length === 0)
31567
+ return -1;
31568
+ return this.path[this.path.length - 1].counter ?? 0;
31569
+ }
31570
+ getIndex() {
31571
+ return this.getPosition();
31572
+ }
31573
+ getDepth() {
31574
+ return this.path.length;
31575
+ }
31576
+ toString(separator, includeNamespace = true) {
31577
+ const sep = separator || this.separator;
31578
+ return this.path.map((n) => {
31579
+ if (includeNamespace && n.namespace) {
31580
+ return `${n.namespace}:${n.tag}`;
31581
+ }
31582
+ return n.tag;
31583
+ }).join(sep);
31584
+ }
31585
+ toArray() {
31586
+ return this.path.map((n) => n.tag);
31587
+ }
31588
+ reset() {
31589
+ this.path = [];
31590
+ this.siblingStacks = [];
31591
+ }
31592
+ matches(expression) {
31593
+ const segments = expression.segments;
31594
+ if (segments.length === 0) {
31595
+ return false;
31596
+ }
31597
+ if (expression.hasDeepWildcard()) {
31598
+ return this._matchWithDeepWildcard(segments);
31599
+ }
31600
+ return this._matchSimple(segments);
31601
+ }
31602
+ _matchSimple(segments) {
31603
+ if (this.path.length !== segments.length) {
31604
+ return false;
31605
+ }
31606
+ for (let i = 0;i < segments.length; i++) {
31607
+ const segment = segments[i];
31608
+ const node = this.path[i];
31609
+ const isCurrentNode = i === this.path.length - 1;
31610
+ if (!this._matchSegment(segment, node, isCurrentNode)) {
31611
+ return false;
31612
+ }
31613
+ }
31614
+ return true;
31615
+ }
31616
+ _matchWithDeepWildcard(segments) {
31617
+ let pathIdx = this.path.length - 1;
31618
+ let segIdx = segments.length - 1;
31619
+ while (segIdx >= 0 && pathIdx >= 0) {
31620
+ const segment = segments[segIdx];
31621
+ if (segment.type === "deep-wildcard") {
31622
+ segIdx--;
31623
+ if (segIdx < 0) {
31624
+ return true;
31625
+ }
31626
+ const nextSeg = segments[segIdx];
31627
+ let found = false;
31628
+ for (let i = pathIdx;i >= 0; i--) {
31629
+ const isCurrentNode = i === this.path.length - 1;
31630
+ if (this._matchSegment(nextSeg, this.path[i], isCurrentNode)) {
31631
+ pathIdx = i - 1;
31632
+ segIdx--;
31633
+ found = true;
31634
+ break;
31635
+ }
31636
+ }
31637
+ if (!found) {
31638
+ return false;
31639
+ }
31640
+ } else {
31641
+ const isCurrentNode = pathIdx === this.path.length - 1;
31642
+ if (!this._matchSegment(segment, this.path[pathIdx], isCurrentNode)) {
31643
+ return false;
31644
+ }
31645
+ pathIdx--;
31646
+ segIdx--;
31647
+ }
31648
+ }
31649
+ return segIdx < 0;
31650
+ }
31651
+ _matchSegment(segment, node, isCurrentNode) {
31652
+ if (segment.tag !== "*" && segment.tag !== node.tag) {
31653
+ return false;
31654
+ }
31655
+ if (segment.namespace !== undefined) {
31656
+ if (segment.namespace !== "*" && segment.namespace !== node.namespace) {
31657
+ return false;
31658
+ }
31659
+ }
31660
+ if (segment.attrName !== undefined) {
31661
+ if (!isCurrentNode) {
31662
+ return false;
31663
+ }
31664
+ if (!node.values || !(segment.attrName in node.values)) {
31665
+ return false;
31666
+ }
31667
+ if (segment.attrValue !== undefined) {
31668
+ const actualValue = node.values[segment.attrName];
31669
+ if (String(actualValue) !== String(segment.attrValue)) {
31670
+ return false;
31671
+ }
31672
+ }
31673
+ }
31674
+ if (segment.position !== undefined) {
31675
+ if (!isCurrentNode) {
31676
+ return false;
31677
+ }
31678
+ const counter = node.counter ?? 0;
31679
+ if (segment.position === "first" && counter !== 0) {
31680
+ return false;
31681
+ } else if (segment.position === "odd" && counter % 2 !== 1) {
31682
+ return false;
31683
+ } else if (segment.position === "even" && counter % 2 !== 0) {
31684
+ return false;
31685
+ } else if (segment.position === "nth") {
31686
+ if (counter !== segment.positionValue) {
31687
+ return false;
31688
+ }
31689
+ }
31690
+ }
31691
+ return true;
31692
+ }
31693
+ snapshot() {
31694
+ return {
31695
+ path: this.path.map((node) => ({ ...node })),
31696
+ siblingStacks: this.siblingStacks.map((map) => new Map(map))
31697
+ };
31698
+ }
31699
+ restore(snapshot) {
31700
+ this.path = snapshot.path.map((node) => ({ ...node }));
31701
+ this.siblingStacks = snapshot.siblingStacks.map((map) => new Map(map));
31702
+ }
31703
+ readOnly() {
31704
+ const self = this;
31705
+ return new Proxy(self, {
31706
+ get(target, prop, receiver) {
31707
+ if (MUTATING_METHODS.has(prop)) {
31708
+ return () => {
31709
+ throw new TypeError(`Cannot call '${prop}' on a read-only Matcher. ` + `Obtain a writable instance to mutate state.`);
31710
+ };
31711
+ }
31712
+ const value = Reflect.get(target, prop, receiver);
31713
+ if (prop === "path" || prop === "siblingStacks") {
31714
+ return Object.freeze(Array.isArray(value) ? value.map((item) => item instanceof Map ? Object.freeze(new Map(item)) : Object.freeze({ ...item })) : value);
31715
+ }
31716
+ if (typeof value === "function") {
31717
+ return value.bind(target);
31718
+ }
31719
+ return value;
31720
+ },
31721
+ set(_target, prop) {
31722
+ throw new TypeError(`Cannot set property '${String(prop)}' on a read-only Matcher.`);
31723
+ },
31724
+ deleteProperty(_target, prop) {
31725
+ throw new TypeError(`Cannot delete property '${String(prop)}' from a read-only Matcher.`);
31726
+ }
31727
+ });
31728
+ }
31729
+ }
31730
+
30989
31731
  // node_modules/fast-xml-parser/src/xmlparser/OrderedObjParser.js
31732
+ function extractRawAttributes(prefixedAttrs, options) {
31733
+ if (!prefixedAttrs)
31734
+ return {};
31735
+ const attrs = options.attributesGroupName ? prefixedAttrs[options.attributesGroupName] : prefixedAttrs;
31736
+ if (!attrs)
31737
+ return {};
31738
+ const rawAttrs = {};
31739
+ for (const key in attrs) {
31740
+ if (key.startsWith(options.attributeNamePrefix)) {
31741
+ const rawName = key.substring(options.attributeNamePrefix.length);
31742
+ rawAttrs[rawName] = attrs[key];
31743
+ } else {
31744
+ rawAttrs[key] = attrs[key];
31745
+ }
31746
+ }
31747
+ return rawAttrs;
31748
+ }
31749
+ function extractNamespace(rawTagName) {
31750
+ if (!rawTagName || typeof rawTagName !== "string")
31751
+ return;
31752
+ const colonIndex = rawTagName.indexOf(":");
31753
+ if (colonIndex !== -1 && colonIndex > 0) {
31754
+ const ns = rawTagName.substring(0, colonIndex);
31755
+ if (ns !== "xmlns") {
31756
+ return ns;
31757
+ }
31758
+ }
31759
+ return;
31760
+ }
31761
+
30990
31762
  class OrderedObjParser {
30991
31763
  constructor(options) {
30992
31764
  this.options = options;
@@ -31023,17 +31795,19 @@ class OrderedObjParser {
31023
31795
  this.saveTextToParentTag = saveTextToParentTag;
31024
31796
  this.addChild = addChild;
31025
31797
  this.ignoreAttributesFn = getIgnoreAttributesFn(this.options.ignoreAttributes);
31798
+ this.entityExpansionCount = 0;
31799
+ this.currentExpandedLength = 0;
31800
+ this.matcher = new Matcher;
31801
+ this.readonlyMatcher = this.matcher.readOnly();
31802
+ this.isCurrentNodeStopNode = false;
31026
31803
  if (this.options.stopNodes && this.options.stopNodes.length > 0) {
31027
- this.stopNodesExact = new Set;
31028
- this.stopNodesWildcard = new Set;
31804
+ this.stopNodeExpressions = [];
31029
31805
  for (let i = 0;i < this.options.stopNodes.length; i++) {
31030
31806
  const stopNodeExp = this.options.stopNodes[i];
31031
- if (typeof stopNodeExp !== "string")
31032
- continue;
31033
- if (stopNodeExp.startsWith("*.")) {
31034
- this.stopNodesWildcard.add(stopNodeExp.substring(2));
31035
- } else {
31036
- this.stopNodesExact.add(stopNodeExp);
31807
+ if (typeof stopNodeExp === "string") {
31808
+ this.stopNodeExpressions.push(new Expression(stopNodeExp));
31809
+ } else if (stopNodeExp instanceof Expression) {
31810
+ this.stopNodeExpressions.push(stopNodeExp);
31037
31811
  }
31038
31812
  }
31039
31813
  }
@@ -31043,8 +31817,9 @@ function addExternalEntities(externalEntities) {
31043
31817
  const entKeys = Object.keys(externalEntities);
31044
31818
  for (let i = 0;i < entKeys.length; i++) {
31045
31819
  const ent = entKeys[i];
31820
+ const escaped = ent.replace(/[.\-+*:]/g, "\\.");
31046
31821
  this.lastEntities[ent] = {
31047
- regex: new RegExp("&" + ent + ";", "g"),
31822
+ regex: new RegExp("&" + escaped + ";", "g"),
31048
31823
  val: externalEntities[ent]
31049
31824
  };
31050
31825
  }
@@ -31056,8 +31831,9 @@ function parseTextData(val, tagName, jPath, dontTrim, hasAttributes, isLeafNode,
31056
31831
  }
31057
31832
  if (val.length > 0) {
31058
31833
  if (!escapeEntities)
31059
- val = this.replaceEntitiesValue(val);
31060
- const newval = this.options.tagValueProcessor(tagName, val, jPath, hasAttributes, isLeafNode);
31834
+ val = this.replaceEntitiesValue(val, tagName, jPath);
31835
+ const jPathOrMatcher = this.options.jPath ? jPath.toString() : jPath;
31836
+ const newval = this.options.tagValueProcessor(tagName, val, jPathOrMatcher, hasAttributes, isLeafNode);
31061
31837
  if (newval === null || newval === undefined) {
31062
31838
  return val;
31063
31839
  } else if (typeof newval !== typeof val || newval !== val) {
@@ -31089,14 +31865,31 @@ function resolveNameSpace(tagname) {
31089
31865
  return tagname;
31090
31866
  }
31091
31867
  var attrsRegx = new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`, "gm");
31092
- function buildAttributesMap(attrStr, jPath) {
31868
+ function buildAttributesMap(attrStr, jPath, tagName) {
31093
31869
  if (this.options.ignoreAttributes !== true && typeof attrStr === "string") {
31094
31870
  const matches = getAllMatches(attrStr, attrsRegx);
31095
31871
  const len = matches.length;
31096
31872
  const attrs = {};
31873
+ const rawAttrsForMatcher = {};
31097
31874
  for (let i = 0;i < len; i++) {
31098
31875
  const attrName = this.resolveNameSpace(matches[i][1]);
31099
- if (this.ignoreAttributesFn(attrName, jPath)) {
31876
+ const oldVal = matches[i][4];
31877
+ if (attrName.length && oldVal !== undefined) {
31878
+ let parsedVal = oldVal;
31879
+ if (this.options.trimValues) {
31880
+ parsedVal = parsedVal.trim();
31881
+ }
31882
+ parsedVal = this.replaceEntitiesValue(parsedVal, tagName, this.readonlyMatcher);
31883
+ rawAttrsForMatcher[attrName] = parsedVal;
31884
+ }
31885
+ }
31886
+ if (Object.keys(rawAttrsForMatcher).length > 0 && typeof jPath === "object" && jPath.updateCurrent) {
31887
+ jPath.updateCurrent(rawAttrsForMatcher);
31888
+ }
31889
+ for (let i = 0;i < len; i++) {
31890
+ const attrName = this.resolveNameSpace(matches[i][1]);
31891
+ const jPathStr = this.options.jPath ? jPath.toString() : this.readonlyMatcher;
31892
+ if (this.ignoreAttributesFn(attrName, jPathStr)) {
31100
31893
  continue;
31101
31894
  }
31102
31895
  let oldVal = matches[i][4];
@@ -31105,14 +31898,14 @@ function buildAttributesMap(attrStr, jPath) {
31105
31898
  if (this.options.transformAttributeName) {
31106
31899
  aName = this.options.transformAttributeName(aName);
31107
31900
  }
31108
- if (aName === "__proto__")
31109
- aName = "#__proto__";
31901
+ aName = sanitizeName(aName, this.options);
31110
31902
  if (oldVal !== undefined) {
31111
31903
  if (this.options.trimValues) {
31112
31904
  oldVal = oldVal.trim();
31113
31905
  }
31114
- oldVal = this.replaceEntitiesValue(oldVal);
31115
- const newVal = this.options.attributeValueProcessor(attrName, oldVal, jPath);
31906
+ oldVal = this.replaceEntitiesValue(oldVal, tagName, this.readonlyMatcher);
31907
+ const jPathOrMatcher = this.options.jPath ? jPath.toString() : this.readonlyMatcher;
31908
+ const newVal = this.options.attributeValueProcessor(attrName, oldVal, jPathOrMatcher);
31116
31909
  if (newVal === null || newVal === undefined) {
31117
31910
  attrs[aName] = oldVal;
31118
31911
  } else if (typeof newVal !== typeof oldVal || newVal !== oldVal) {
@@ -31142,7 +31935,9 @@ var parseXml = function(xmlData) {
31142
31935
  const xmlObj = new XmlNode("!xml");
31143
31936
  let currentNode = xmlObj;
31144
31937
  let textData = "";
31145
- let jPath = "";
31938
+ this.matcher.reset();
31939
+ this.entityExpansionCount = 0;
31940
+ this.currentExpandedLength = 0;
31146
31941
  const docTypeReader = new DocTypeReader(this.options.processEntities);
31147
31942
  for (let i = 0;i < xmlData.length; i++) {
31148
31943
  const ch = xmlData[i];
@@ -31156,24 +31951,20 @@ var parseXml = function(xmlData) {
31156
31951
  tagName = tagName.substr(colonIndex + 1);
31157
31952
  }
31158
31953
  }
31159
- if (this.options.transformTagName) {
31160
- tagName = this.options.transformTagName(tagName);
31161
- }
31954
+ tagName = transformTagName(this.options.transformTagName, tagName, "", this.options).tagName;
31162
31955
  if (currentNode) {
31163
- textData = this.saveTextToParentTag(textData, currentNode, jPath);
31956
+ textData = this.saveTextToParentTag(textData, currentNode, this.readonlyMatcher);
31164
31957
  }
31165
- const lastTagName = jPath.substring(jPath.lastIndexOf(".") + 1);
31958
+ const lastTagName = this.matcher.getCurrentTag();
31166
31959
  if (tagName && this.options.unpairedTags.indexOf(tagName) !== -1) {
31167
31960
  throw new Error(`Unpaired tag can not be used as closing tag: </${tagName}>`);
31168
31961
  }
31169
- let propIndex = 0;
31170
31962
  if (lastTagName && this.options.unpairedTags.indexOf(lastTagName) !== -1) {
31171
- propIndex = jPath.lastIndexOf(".", jPath.lastIndexOf(".") - 1);
31963
+ this.matcher.pop();
31172
31964
  this.tagsNodeStack.pop();
31173
- } else {
31174
- propIndex = jPath.lastIndexOf(".");
31175
31965
  }
31176
- jPath = jPath.substring(0, propIndex);
31966
+ this.matcher.pop();
31967
+ this.isCurrentNodeStopNode = false;
31177
31968
  currentNode = this.tagsNodeStack.pop();
31178
31969
  textData = "";
31179
31970
  i = closeIndex;
@@ -31181,21 +31972,21 @@ var parseXml = function(xmlData) {
31181
31972
  let tagData = readTagExp(xmlData, i, false, "?>");
31182
31973
  if (!tagData)
31183
31974
  throw new Error("Pi Tag is not closed.");
31184
- textData = this.saveTextToParentTag(textData, currentNode, jPath);
31975
+ textData = this.saveTextToParentTag(textData, currentNode, this.readonlyMatcher);
31185
31976
  if (this.options.ignoreDeclaration && tagData.tagName === "?xml" || this.options.ignorePiTags) {} else {
31186
31977
  const childNode = new XmlNode(tagData.tagName);
31187
31978
  childNode.add(this.options.textNodeName, "");
31188
31979
  if (tagData.tagName !== tagData.tagExp && tagData.attrExpPresent) {
31189
- childNode[":@"] = this.buildAttributesMap(tagData.tagExp, jPath);
31980
+ childNode[":@"] = this.buildAttributesMap(tagData.tagExp, this.matcher, tagData.tagName);
31190
31981
  }
31191
- this.addChild(currentNode, childNode, jPath, i);
31982
+ this.addChild(currentNode, childNode, this.readonlyMatcher, i);
31192
31983
  }
31193
31984
  i = tagData.closeIndex + 1;
31194
31985
  } else if (xmlData.substr(i + 1, 3) === "!--") {
31195
31986
  const endIndex = findClosingIndex(xmlData, "-->", i + 4, "Comment is not closed.");
31196
31987
  if (this.options.commentPropName) {
31197
31988
  const comment = xmlData.substring(i + 4, endIndex - 2);
31198
- textData = this.saveTextToParentTag(textData, currentNode, jPath);
31989
+ textData = this.saveTextToParentTag(textData, currentNode, this.readonlyMatcher);
31199
31990
  currentNode.add(this.options.commentPropName, [{ [this.options.textNodeName]: comment }]);
31200
31991
  }
31201
31992
  i = endIndex;
@@ -31206,8 +31997,8 @@ var parseXml = function(xmlData) {
31206
31997
  } else if (xmlData.substr(i + 1, 2) === "![") {
31207
31998
  const closeIndex = findClosingIndex(xmlData, "]]>", i, "CDATA is not closed.") - 2;
31208
31999
  const tagExp = xmlData.substring(i + 9, closeIndex);
31209
- textData = this.saveTextToParentTag(textData, currentNode, jPath);
31210
- let val = this.parseTextData(tagExp, currentNode.tagname, jPath, true, false, true, true);
32000
+ textData = this.saveTextToParentTag(textData, currentNode, this.readonlyMatcher);
32001
+ let val = this.parseTextData(tagExp, currentNode.tagname, this.readonlyMatcher, true, false, true, true);
31211
32002
  if (val == undefined)
31212
32003
  val = "";
31213
32004
  if (this.options.cdataPropName) {
@@ -31218,42 +32009,60 @@ var parseXml = function(xmlData) {
31218
32009
  i = closeIndex + 2;
31219
32010
  } else {
31220
32011
  let result = readTagExp(xmlData, i, this.options.removeNSPrefix);
32012
+ if (!result) {
32013
+ const context = xmlData.substring(Math.max(0, i - 50), Math.min(xmlData.length, i + 50));
32014
+ throw new Error(`readTagExp returned undefined at position ${i}. Context: "${context}"`);
32015
+ }
31221
32016
  let tagName = result.tagName;
31222
32017
  const rawTagName = result.rawTagName;
31223
32018
  let tagExp = result.tagExp;
31224
32019
  let attrExpPresent = result.attrExpPresent;
31225
32020
  let closeIndex = result.closeIndex;
31226
- if (this.options.transformTagName) {
31227
- const newTagName = this.options.transformTagName(tagName);
31228
- if (tagExp === tagName) {
31229
- tagExp = newTagName;
31230
- }
31231
- tagName = newTagName;
32021
+ ({ tagName, tagExp } = transformTagName(this.options.transformTagName, tagName, tagExp, this.options));
32022
+ if (this.options.strictReservedNames && (tagName === this.options.commentPropName || tagName === this.options.cdataPropName || tagName === this.options.textNodeName || tagName === this.options.attributesGroupName)) {
32023
+ throw new Error(`Invalid tag name: ${tagName}`);
31232
32024
  }
31233
32025
  if (currentNode && textData) {
31234
32026
  if (currentNode.tagname !== "!xml") {
31235
- textData = this.saveTextToParentTag(textData, currentNode, jPath, false);
32027
+ textData = this.saveTextToParentTag(textData, currentNode, this.readonlyMatcher, false);
31236
32028
  }
31237
32029
  }
31238
32030
  const lastTag = currentNode;
31239
32031
  if (lastTag && this.options.unpairedTags.indexOf(lastTag.tagname) !== -1) {
31240
32032
  currentNode = this.tagsNodeStack.pop();
31241
- jPath = jPath.substring(0, jPath.lastIndexOf("."));
32033
+ this.matcher.pop();
32034
+ }
32035
+ let isSelfClosing = false;
32036
+ if (tagExp.length > 0 && tagExp.lastIndexOf("/") === tagExp.length - 1) {
32037
+ isSelfClosing = true;
32038
+ if (tagName[tagName.length - 1] === "/") {
32039
+ tagName = tagName.substr(0, tagName.length - 1);
32040
+ tagExp = tagName;
32041
+ } else {
32042
+ tagExp = tagExp.substr(0, tagExp.length - 1);
32043
+ }
32044
+ attrExpPresent = tagName !== tagExp;
32045
+ }
32046
+ let prefixedAttrs = null;
32047
+ let rawAttrs = {};
32048
+ let namespace = undefined;
32049
+ namespace = extractNamespace(rawTagName);
32050
+ if (tagName !== xmlObj.tagname) {
32051
+ this.matcher.push(tagName, {}, namespace);
32052
+ }
32053
+ if (tagName !== tagExp && attrExpPresent) {
32054
+ prefixedAttrs = this.buildAttributesMap(tagExp, this.matcher, tagName);
32055
+ if (prefixedAttrs) {
32056
+ rawAttrs = extractRawAttributes(prefixedAttrs, this.options);
32057
+ }
31242
32058
  }
31243
32059
  if (tagName !== xmlObj.tagname) {
31244
- jPath += jPath ? "." + tagName : tagName;
32060
+ this.isCurrentNodeStopNode = this.isItStopNode(this.stopNodeExpressions, this.matcher);
31245
32061
  }
31246
32062
  const startIndex = i;
31247
- if (this.isItStopNode(this.stopNodesExact, this.stopNodesWildcard, jPath, tagName)) {
32063
+ if (this.isCurrentNodeStopNode) {
31248
32064
  let tagContent = "";
31249
- if (tagExp.length > 0 && tagExp.lastIndexOf("/") === tagExp.length - 1) {
31250
- if (tagName[tagName.length - 1] === "/") {
31251
- tagName = tagName.substr(0, tagName.length - 1);
31252
- jPath = jPath.substr(0, jPath.length - 1);
31253
- tagExp = tagName;
31254
- } else {
31255
- tagExp = tagExp.substr(0, tagExp.length - 1);
31256
- }
32065
+ if (isSelfClosing) {
31257
32066
  i = result.closeIndex;
31258
32067
  } else if (this.options.unpairedTags.indexOf(tagName) !== -1) {
31259
32068
  i = result.closeIndex;
@@ -31265,44 +32074,43 @@ var parseXml = function(xmlData) {
31265
32074
  tagContent = result2.tagContent;
31266
32075
  }
31267
32076
  const childNode = new XmlNode(tagName);
31268
- if (tagName !== tagExp && attrExpPresent) {
31269
- childNode[":@"] = this.buildAttributesMap(tagExp, jPath);
31270
- }
31271
- if (tagContent) {
31272
- tagContent = this.parseTextData(tagContent, tagName, jPath, true, attrExpPresent, true, true);
32077
+ if (prefixedAttrs) {
32078
+ childNode[":@"] = prefixedAttrs;
31273
32079
  }
31274
- jPath = jPath.substr(0, jPath.lastIndexOf("."));
31275
32080
  childNode.add(this.options.textNodeName, tagContent);
31276
- this.addChild(currentNode, childNode, jPath, startIndex);
32081
+ this.matcher.pop();
32082
+ this.isCurrentNodeStopNode = false;
32083
+ this.addChild(currentNode, childNode, this.readonlyMatcher, startIndex);
31277
32084
  } else {
31278
- if (tagExp.length > 0 && tagExp.lastIndexOf("/") === tagExp.length - 1) {
31279
- if (tagName[tagName.length - 1] === "/") {
31280
- tagName = tagName.substr(0, tagName.length - 1);
31281
- jPath = jPath.substr(0, jPath.length - 1);
31282
- tagExp = tagName;
31283
- } else {
31284
- tagExp = tagExp.substr(0, tagExp.length - 1);
31285
- }
31286
- if (this.options.transformTagName) {
31287
- const newTagName = this.options.transformTagName(tagName);
31288
- if (tagExp === tagName) {
31289
- tagExp = newTagName;
31290
- }
31291
- tagName = newTagName;
32085
+ if (isSelfClosing) {
32086
+ ({ tagName, tagExp } = transformTagName(this.options.transformTagName, tagName, tagExp, this.options));
32087
+ const childNode = new XmlNode(tagName);
32088
+ if (prefixedAttrs) {
32089
+ childNode[":@"] = prefixedAttrs;
31292
32090
  }
32091
+ this.addChild(currentNode, childNode, this.readonlyMatcher, startIndex);
32092
+ this.matcher.pop();
32093
+ this.isCurrentNodeStopNode = false;
32094
+ } else if (this.options.unpairedTags.indexOf(tagName) !== -1) {
31293
32095
  const childNode = new XmlNode(tagName);
31294
- if (tagName !== tagExp && attrExpPresent) {
31295
- childNode[":@"] = this.buildAttributesMap(tagExp, jPath);
32096
+ if (prefixedAttrs) {
32097
+ childNode[":@"] = prefixedAttrs;
31296
32098
  }
31297
- this.addChild(currentNode, childNode, jPath, startIndex);
31298
- jPath = jPath.substr(0, jPath.lastIndexOf("."));
32099
+ this.addChild(currentNode, childNode, this.readonlyMatcher, startIndex);
32100
+ this.matcher.pop();
32101
+ this.isCurrentNodeStopNode = false;
32102
+ i = result.closeIndex;
32103
+ continue;
31299
32104
  } else {
31300
32105
  const childNode = new XmlNode(tagName);
32106
+ if (this.tagsNodeStack.length > this.options.maxNestedTags) {
32107
+ throw new Error("Maximum nested tags exceeded");
32108
+ }
31301
32109
  this.tagsNodeStack.push(currentNode);
31302
- if (tagName !== tagExp && attrExpPresent) {
31303
- childNode[":@"] = this.buildAttributesMap(tagExp, jPath);
32110
+ if (prefixedAttrs) {
32111
+ childNode[":@"] = prefixedAttrs;
31304
32112
  }
31305
- this.addChild(currentNode, childNode, jPath, startIndex);
32113
+ this.addChild(currentNode, childNode, this.readonlyMatcher, startIndex);
31306
32114
  currentNode = childNode;
31307
32115
  }
31308
32116
  textData = "";
@@ -31315,10 +32123,11 @@ var parseXml = function(xmlData) {
31315
32123
  }
31316
32124
  return xmlObj.child;
31317
32125
  };
31318
- function addChild(currentNode, childNode, jPath, startIndex) {
32126
+ function addChild(currentNode, childNode, matcher, startIndex) {
31319
32127
  if (!this.options.captureMetaData)
31320
32128
  startIndex = undefined;
31321
- const result = this.options.updateTag(childNode.tagname, jPath, childNode[":@"]);
32129
+ const jPathOrMatcher = this.options.jPath ? matcher.toString() : matcher;
32130
+ const result = this.options.updateTag(childNode.tagname, jPathOrMatcher, childNode[":@"]);
31322
32131
  if (result === false) {} else if (typeof result === "string") {
31323
32132
  childNode.tagname = result;
31324
32133
  currentNode.addChild(childNode, startIndex);
@@ -31326,42 +32135,90 @@ function addChild(currentNode, childNode, jPath, startIndex) {
31326
32135
  currentNode.addChild(childNode, startIndex);
31327
32136
  }
31328
32137
  }
31329
- var replaceEntitiesValue = function(val) {
31330
- if (this.options.processEntities) {
31331
- for (let entityName in this.docTypeEntities) {
31332
- const entity = this.docTypeEntities[entityName];
32138
+ function replaceEntitiesValue(val, tagName, jPath) {
32139
+ const entityConfig = this.options.processEntities;
32140
+ if (!entityConfig || !entityConfig.enabled) {
32141
+ return val;
32142
+ }
32143
+ if (entityConfig.allowedTags) {
32144
+ const jPathOrMatcher = this.options.jPath ? jPath.toString() : jPath;
32145
+ const allowed = Array.isArray(entityConfig.allowedTags) ? entityConfig.allowedTags.includes(tagName) : entityConfig.allowedTags(tagName, jPathOrMatcher);
32146
+ if (!allowed) {
32147
+ return val;
32148
+ }
32149
+ }
32150
+ if (entityConfig.tagFilter) {
32151
+ const jPathOrMatcher = this.options.jPath ? jPath.toString() : jPath;
32152
+ if (!entityConfig.tagFilter(tagName, jPathOrMatcher)) {
32153
+ return val;
32154
+ }
32155
+ }
32156
+ for (const entityName of Object.keys(this.docTypeEntities)) {
32157
+ const entity = this.docTypeEntities[entityName];
32158
+ const matches = val.match(entity.regx);
32159
+ if (matches) {
32160
+ this.entityExpansionCount += matches.length;
32161
+ if (entityConfig.maxTotalExpansions && this.entityExpansionCount > entityConfig.maxTotalExpansions) {
32162
+ throw new Error(`Entity expansion limit exceeded: ${this.entityExpansionCount} > ${entityConfig.maxTotalExpansions}`);
32163
+ }
32164
+ const lengthBefore = val.length;
31333
32165
  val = val.replace(entity.regx, entity.val);
32166
+ if (entityConfig.maxExpandedLength) {
32167
+ this.currentExpandedLength += val.length - lengthBefore;
32168
+ if (this.currentExpandedLength > entityConfig.maxExpandedLength) {
32169
+ throw new Error(`Total expanded content size exceeded: ${this.currentExpandedLength} > ${entityConfig.maxExpandedLength}`);
32170
+ }
32171
+ }
31334
32172
  }
31335
- for (let entityName in this.lastEntities) {
31336
- const entity = this.lastEntities[entityName];
31337
- val = val.replace(entity.regex, entity.val);
32173
+ }
32174
+ for (const entityName of Object.keys(this.lastEntities)) {
32175
+ const entity = this.lastEntities[entityName];
32176
+ const matches = val.match(entity.regex);
32177
+ if (matches) {
32178
+ this.entityExpansionCount += matches.length;
32179
+ if (entityConfig.maxTotalExpansions && this.entityExpansionCount > entityConfig.maxTotalExpansions) {
32180
+ throw new Error(`Entity expansion limit exceeded: ${this.entityExpansionCount} > ${entityConfig.maxTotalExpansions}`);
32181
+ }
31338
32182
  }
31339
- if (this.options.htmlEntities) {
31340
- for (let entityName in this.htmlEntities) {
31341
- const entity = this.htmlEntities[entityName];
31342
- val = val.replace(entity.regex, entity.val);
32183
+ val = val.replace(entity.regex, entity.val);
32184
+ }
32185
+ if (val.indexOf("&") === -1)
32186
+ return val;
32187
+ if (this.options.htmlEntities) {
32188
+ for (const entityName of Object.keys(this.htmlEntities)) {
32189
+ const entity = this.htmlEntities[entityName];
32190
+ const matches = val.match(entity.regex);
32191
+ if (matches) {
32192
+ this.entityExpansionCount += matches.length;
32193
+ if (entityConfig.maxTotalExpansions && this.entityExpansionCount > entityConfig.maxTotalExpansions) {
32194
+ throw new Error(`Entity expansion limit exceeded: ${this.entityExpansionCount} > ${entityConfig.maxTotalExpansions}`);
32195
+ }
31343
32196
  }
32197
+ val = val.replace(entity.regex, entity.val);
31344
32198
  }
31345
- val = val.replace(this.ampEntity.regex, this.ampEntity.val);
31346
32199
  }
32200
+ val = val.replace(this.ampEntity.regex, this.ampEntity.val);
31347
32201
  return val;
31348
- };
31349
- function saveTextToParentTag(textData, currentNode, jPath, isLeafNode) {
32202
+ }
32203
+ function saveTextToParentTag(textData, parentNode, matcher, isLeafNode) {
31350
32204
  if (textData) {
31351
32205
  if (isLeafNode === undefined)
31352
- isLeafNode = currentNode.child.length === 0;
31353
- textData = this.parseTextData(textData, currentNode.tagname, jPath, false, currentNode[":@"] ? Object.keys(currentNode[":@"]).length !== 0 : false, isLeafNode);
32206
+ isLeafNode = parentNode.child.length === 0;
32207
+ textData = this.parseTextData(textData, parentNode.tagname, matcher, false, parentNode[":@"] ? Object.keys(parentNode[":@"]).length !== 0 : false, isLeafNode);
31354
32208
  if (textData !== undefined && textData !== "")
31355
- currentNode.add(this.options.textNodeName, textData);
32209
+ parentNode.add(this.options.textNodeName, textData);
31356
32210
  textData = "";
31357
32211
  }
31358
32212
  return textData;
31359
32213
  }
31360
- function isItStopNode(stopNodesExact, stopNodesWildcard, jPath, currentTagName) {
31361
- if (stopNodesWildcard && stopNodesWildcard.has(currentTagName))
31362
- return true;
31363
- if (stopNodesExact && stopNodesExact.has(jPath))
31364
- return true;
32214
+ function isItStopNode(stopNodeExpressions, matcher) {
32215
+ if (!stopNodeExpressions || stopNodeExpressions.length === 0)
32216
+ return false;
32217
+ for (let i = 0;i < stopNodeExpressions.length; i++) {
32218
+ if (matcher.matches(stopNodeExpressions[i])) {
32219
+ return true;
32220
+ }
32221
+ }
31365
32222
  return false;
31366
32223
  }
31367
32224
  function tagExpWithClosingIndex(xmlData, i, closingChar = ">") {
@@ -31496,23 +32353,57 @@ function fromCodePoint(str, base, prefix) {
31496
32353
  return prefix + str + ";";
31497
32354
  }
31498
32355
  }
32356
+ function transformTagName(fn, tagName, tagExp, options) {
32357
+ if (fn) {
32358
+ const newTagName = fn(tagName);
32359
+ if (tagExp === tagName) {
32360
+ tagExp = newTagName;
32361
+ }
32362
+ tagName = newTagName;
32363
+ }
32364
+ tagName = sanitizeName(tagName, options);
32365
+ return { tagName, tagExp };
32366
+ }
32367
+ function sanitizeName(name, options) {
32368
+ if (criticalProperties.includes(name)) {
32369
+ throw new Error(`[SECURITY] Invalid name: "${name}" is a reserved JavaScript keyword that could cause prototype pollution`);
32370
+ } else if (DANGEROUS_PROPERTY_NAMES.includes(name)) {
32371
+ return options.onDangerousProperty(name);
32372
+ }
32373
+ return name;
32374
+ }
31499
32375
 
31500
32376
  // node_modules/fast-xml-parser/src/xmlparser/node2json.js
31501
32377
  var METADATA_SYMBOL2 = XmlNode.getMetaDataSymbol();
31502
- function prettify(node, options) {
31503
- return compress(node, options);
32378
+ function stripAttributePrefix(attrs, prefix) {
32379
+ if (!attrs || typeof attrs !== "object")
32380
+ return {};
32381
+ if (!prefix)
32382
+ return attrs;
32383
+ const rawAttrs = {};
32384
+ for (const key in attrs) {
32385
+ if (key.startsWith(prefix)) {
32386
+ const rawName = key.substring(prefix.length);
32387
+ rawAttrs[rawName] = attrs[key];
32388
+ } else {
32389
+ rawAttrs[key] = attrs[key];
32390
+ }
32391
+ }
32392
+ return rawAttrs;
32393
+ }
32394
+ function prettify(node, options, matcher, readonlyMatcher) {
32395
+ return compress(node, options, matcher, readonlyMatcher);
31504
32396
  }
31505
- function compress(arr, options, jPath) {
32397
+ function compress(arr, options, matcher, readonlyMatcher) {
31506
32398
  let text;
31507
32399
  const compressedObj = {};
31508
32400
  for (let i = 0;i < arr.length; i++) {
31509
32401
  const tagObj = arr[i];
31510
32402
  const property = propName(tagObj);
31511
- let newJpath = "";
31512
- if (jPath === undefined)
31513
- newJpath = property;
31514
- else
31515
- newJpath = jPath + "." + property;
32403
+ if (property !== undefined && property !== options.textNodeName) {
32404
+ const rawAttrs = stripAttributePrefix(tagObj[":@"] || {}, options.attributeNamePrefix);
32405
+ matcher.push(property, rawAttrs);
32406
+ }
31516
32407
  if (property === options.textNodeName) {
31517
32408
  if (text === undefined)
31518
32409
  text = tagObj[property];
@@ -31521,13 +32412,10 @@ function compress(arr, options, jPath) {
31521
32412
  } else if (property === undefined) {
31522
32413
  continue;
31523
32414
  } else if (tagObj[property]) {
31524
- let val = compress(tagObj[property], options, newJpath);
32415
+ let val = compress(tagObj[property], options, matcher, readonlyMatcher);
31525
32416
  const isLeaf = isLeafTag(val, options);
31526
- if (tagObj[METADATA_SYMBOL2] !== undefined) {
31527
- val[METADATA_SYMBOL2] = tagObj[METADATA_SYMBOL2];
31528
- }
31529
32417
  if (tagObj[":@"]) {
31530
- assignAttributes(val, tagObj[":@"], newJpath, options);
32418
+ assignAttributes(val, tagObj[":@"], readonlyMatcher, options);
31531
32419
  } else if (Object.keys(val).length === 1 && val[options.textNodeName] !== undefined && !options.alwaysCreateTextNode) {
31532
32420
  val = val[options.textNodeName];
31533
32421
  } else if (Object.keys(val).length === 0) {
@@ -31536,18 +32424,25 @@ function compress(arr, options, jPath) {
31536
32424
  else
31537
32425
  val = "";
31538
32426
  }
31539
- if (compressedObj[property] !== undefined && compressedObj.hasOwnProperty(property)) {
32427
+ if (tagObj[METADATA_SYMBOL2] !== undefined && typeof val === "object" && val !== null) {
32428
+ val[METADATA_SYMBOL2] = tagObj[METADATA_SYMBOL2];
32429
+ }
32430
+ if (compressedObj[property] !== undefined && Object.prototype.hasOwnProperty.call(compressedObj, property)) {
31540
32431
  if (!Array.isArray(compressedObj[property])) {
31541
32432
  compressedObj[property] = [compressedObj[property]];
31542
32433
  }
31543
32434
  compressedObj[property].push(val);
31544
32435
  } else {
31545
- if (options.isArray(property, newJpath, isLeaf)) {
32436
+ const jPathOrMatcher = options.jPath ? readonlyMatcher.toString() : readonlyMatcher;
32437
+ if (options.isArray(property, jPathOrMatcher, isLeaf)) {
31546
32438
  compressedObj[property] = [val];
31547
32439
  } else {
31548
32440
  compressedObj[property] = val;
31549
32441
  }
31550
32442
  }
32443
+ if (property !== undefined && property !== options.textNodeName) {
32444
+ matcher.pop();
32445
+ }
31551
32446
  }
31552
32447
  }
31553
32448
  if (typeof text === "string") {
@@ -31565,13 +32460,15 @@ function propName(obj) {
31565
32460
  return key;
31566
32461
  }
31567
32462
  }
31568
- function assignAttributes(obj, attrMap, jpath, options) {
32463
+ function assignAttributes(obj, attrMap, readonlyMatcher, options) {
31569
32464
  if (attrMap) {
31570
32465
  const keys = Object.keys(attrMap);
31571
32466
  const len = keys.length;
31572
32467
  for (let i = 0;i < len; i++) {
31573
32468
  const atrrName = keys[i];
31574
- if (options.isArray(atrrName, jpath + "." + atrrName, true, true)) {
32469
+ const rawAttrName = atrrName.startsWith(options.attributeNamePrefix) ? atrrName.substring(options.attributeNamePrefix.length) : atrrName;
32470
+ const jPathOrMatcher = options.jPath ? readonlyMatcher.toString() + "." + rawAttrName : readonlyMatcher;
32471
+ if (options.isArray(atrrName, jPathOrMatcher, true, true)) {
31575
32472
  obj[atrrName] = [attrMap[atrrName]];
31576
32473
  } else {
31577
32474
  obj[atrrName] = attrMap[atrrName];
@@ -31617,7 +32514,7 @@ class XMLParser {
31617
32514
  if (this.options.preserveOrder || orderedResult === undefined)
31618
32515
  return orderedResult;
31619
32516
  else
31620
- return prettify(orderedResult, this.options);
32517
+ return prettify(orderedResult, this.options, orderedObjParser.matcher, orderedObjParser.readonlyMatcher);
31621
32518
  }
31622
32519
  addEntity(key, value) {
31623
32520
  if (value.indexOf("&") !== -1) {
@@ -31666,12 +32563,12 @@ function parseAndroidBounds(bounds) {
31666
32563
  }
31667
32564
  const x1 = Number(match[1]);
31668
32565
  const y1 = Number(match[2]);
31669
- const x22 = Number(match[3]);
32566
+ const x2 = Number(match[3]);
31670
32567
  const y2 = Number(match[4]);
31671
32568
  return {
31672
32569
  x: x1,
31673
32570
  y: y1,
31674
- width: Math.max(0, x22 - x1),
32571
+ width: Math.max(0, x2 - x1),
31675
32572
  height: Math.max(0, y2 - y1)
31676
32573
  };
31677
32574
  }
@@ -31742,7 +32639,7 @@ function parseSource(xmlString) {
31742
32639
  const xpath = `${parentXpath}/${type}[${siblingIndex}]`;
31743
32640
  const platform2 = detectPlatform(type, attrs);
31744
32641
  const bounds = attrs.bounds ? parseAndroidBounds(attrs.bounds) : undefined;
31745
- const x3 = attrs.x !== undefined ? asNumber(attrs.x) : bounds?.x ?? 0;
32642
+ const x = attrs.x !== undefined ? asNumber(attrs.x) : bounds?.x ?? 0;
31746
32643
  const y2 = attrs.y !== undefined ? asNumber(attrs.y) : bounds?.y ?? 0;
31747
32644
  const width = attrs.width !== undefined ? asNumber(attrs.width) : bounds?.width ?? 0;
31748
32645
  const height = attrs.height !== undefined ? asNumber(attrs.height) : bounds?.height ?? 0;
@@ -31768,7 +32665,7 @@ function parseSource(xmlString) {
31768
32665
  visible: asBoolean(attrs.visible) || asBoolean(attrs.displayed),
31769
32666
  accessible: asBoolean(attrs.accessible),
31770
32667
  clickable: asBoolean(attrs.clickable),
31771
- x: x3,
32668
+ x,
31772
32669
  y: y2,
31773
32670
  width,
31774
32671
  height,
@@ -32357,8 +33254,8 @@ async function runLegacyCLI(argv) {
32357
33254
  promptConfig = await runPrompts();
32358
33255
  }
32359
33256
  console.log("");
32360
- Nt("\uD83C\uDFAC Starting Appium Session Recorder");
32361
- const s = Ie();
33257
+ mt("\uD83C\uDFAC Starting Appium Session Recorder");
33258
+ const s = fe();
32362
33259
  s.start("Initializing server...");
32363
33260
  try {
32364
33261
  startServer(promptConfig);
@@ -32368,7 +33265,7 @@ async function runLegacyCLI(argv) {
32368
33265
  console.log(` Port: ${promptConfig.port}`);
32369
33266
  console.log(` Appium URL: ${promptConfig.appiumUrl}`);
32370
33267
  console.log(` Host: ${promptConfig.host}`);
32371
- Wt2("\uD83D\uDE80 Server is running! Press Ctrl+C to stop.");
33268
+ gt("\uD83D\uDE80 Server is running! Press Ctrl+C to stop.");
32372
33269
  } catch (error) {
32373
33270
  s.stop("\u274C Failed to start server");
32374
33271
  console.error(error);
@@ -32377,7 +33274,7 @@ async function runLegacyCLI(argv) {
32377
33274
  process.on("SIGINT", () => {
32378
33275
  console.log(`
32379
33276
  `);
32380
- Wt2("\uD83D\uDC4B Shutting down...");
33277
+ gt("\uD83D\uDC4B Shutting down...");
32381
33278
  process.exit(0);
32382
33279
  });
32383
33280
  }