brsh 3.10.1 → 3.10.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/shell.es.js CHANGED
@@ -96,7 +96,7 @@ var u, d, f, p, m, h, g, _, v, y, b = e((() => {
96
96
  if (typeof e == "string") return g(e, t);
97
97
  if (o.isView(e)) return y(e);
98
98
  if (e == null) throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof e);
99
- if (Z(e, o) || e && Z(e.buffer, o) || s !== void 0 && (Z(e, s) || e && Z(e.buffer, s))) return b(e, t, n);
99
+ if (X(e, o) || e && X(e.buffer, o) || s !== void 0 && (X(e, s) || e && X(e.buffer, s))) return b(e, t, n);
100
100
  if (typeof e == "number") throw TypeError("The \"value\" argument must not be of type number. Received type number");
101
101
  let r = e.valueOf && e.valueOf();
102
102
  if (r != null && r !== e) return u.from(r, t, n);
@@ -137,7 +137,7 @@ var u, d, f, p, m, h, g, _, v, y, b = e((() => {
137
137
  return n;
138
138
  }
139
139
  function y(e) {
140
- if (Z(e, a)) {
140
+ if (X(e, a)) {
141
141
  let t = new a(e);
142
142
  return b(t.buffer, t.byteOffset, t.byteLength);
143
143
  }
@@ -154,7 +154,7 @@ var u, d, f, p, m, h, g, _, v, y, b = e((() => {
154
154
  let t = S(e.length) | 0, n = l(t);
155
155
  return n.length === 0 || e.copy(n, 0, 0, t), n;
156
156
  }
157
- if (e.length !== void 0) return typeof e.length != "number" || fe(e.length) ? l(0) : _(e);
157
+ if (e.length !== void 0) return typeof e.length != "number" || pe(e.length) ? l(0) : _(e);
158
158
  if (e.type === "Buffer" && Array.isArray(e.data)) return _(e.data);
159
159
  }
160
160
  function S(e) {
@@ -167,7 +167,7 @@ var u, d, f, p, m, h, g, _, v, y, b = e((() => {
167
167
  u.isBuffer = function(e) {
168
168
  return e != null && e._isBuffer === !0 && e !== u.prototype;
169
169
  }, u.compare = function(e, t) {
170
- if (Z(e, a) && (e = u.from(e, e.offset, e.byteLength)), Z(t, a) && (t = u.from(t, t.offset, t.byteLength)), !u.isBuffer(e) || !u.isBuffer(t)) throw TypeError("The \"buf1\", \"buf2\" arguments must be one of type Buffer or Uint8Array");
170
+ if (X(e, a) && (e = u.from(e, e.offset, e.byteLength)), X(t, a) && (t = u.from(t, t.offset, t.byteLength)), !u.isBuffer(e) || !u.isBuffer(t)) throw TypeError("The \"buf1\", \"buf2\" arguments must be one of type Buffer or Uint8Array");
171
171
  if (e === t) return 0;
172
172
  let n = e.length, r = t.length;
173
173
  for (let i = 0, a = Math.min(n, r); i < a; ++i) if (e[i] !== t[i]) {
@@ -198,7 +198,7 @@ var u, d, f, p, m, h, g, _, v, y, b = e((() => {
198
198
  let r = u.allocUnsafe(t), i = 0;
199
199
  for (n = 0; n < e.length; ++n) {
200
200
  let t = e[n];
201
- if (Z(t, a)) i + t.length > r.length ? (u.isBuffer(t) || (t = u.from(t)), t.copy(r, i)) : a.prototype.set.call(r, t, i);
201
+ if (X(t, a)) i + t.length > r.length ? (u.isBuffer(t) || (t = u.from(t)), t.copy(r, i)) : a.prototype.set.call(r, t, i);
202
202
  else if (u.isBuffer(t)) t.copy(r, i);
203
203
  else throw TypeError("\"list\" argument must be an Array of Buffers");
204
204
  i += t.length;
@@ -207,7 +207,7 @@ var u, d, f, p, m, h, g, _, v, y, b = e((() => {
207
207
  };
208
208
  function w(e, t) {
209
209
  if (u.isBuffer(e)) return e.length;
210
- if (o.isView(e) || Z(e, o)) return e.byteLength;
210
+ if (o.isView(e) || X(e, o)) return e.byteLength;
211
211
  if (typeof e != "string") throw TypeError("The \"string\" argument must be one of type string, Buffer, or ArrayBuffer. Received type " + typeof e);
212
212
  let n = e.length, r = arguments.length > 2 && arguments[2] === !0;
213
213
  if (!r && n === 0) return 0;
@@ -217,15 +217,15 @@ var u, d, f, p, m, h, g, _, v, y, b = e((() => {
217
217
  case "latin1":
218
218
  case "binary": return n;
219
219
  case "utf8":
220
- case "utf-8": return se(e).length;
220
+ case "utf-8": return ce(e).length;
221
221
  case "ucs2":
222
222
  case "ucs-2":
223
223
  case "utf16le":
224
224
  case "utf-16le": return n * 2;
225
225
  case "hex": return n >>> 1;
226
- case "base64": return ue(e).length;
226
+ case "base64": return de(e).length;
227
227
  default:
228
- if (i) return r ? -1 : se(e).length;
228
+ if (i) return r ? -1 : ce(e).length;
229
229
  t = ("" + t).toLowerCase(), i = !0;
230
230
  }
231
231
  }
@@ -234,17 +234,17 @@ var u, d, f, p, m, h, g, _, v, y, b = e((() => {
234
234
  let r = !1;
235
235
  if ((t === void 0 || t < 0) && (t = 0), t > this.length || ((n === void 0 || n > this.length) && (n = this.length), n <= 0) || (n >>>= 0, t >>>= 0, n <= t)) return "";
236
236
  for (e ||= "utf8";;) switch (e) {
237
- case "hex": return R(this, t, n);
237
+ case "hex": return L(this, t, n);
238
238
  case "utf8":
239
239
  case "utf-8": return F(this, t, n);
240
- case "ascii": return ee(this, t, n);
240
+ case "ascii": return te(this, t, n);
241
241
  case "latin1":
242
- case "binary": return te(this, t, n);
242
+ case "binary": return ne(this, t, n);
243
243
  case "base64": return P(this, t, n);
244
244
  case "ucs2":
245
245
  case "ucs-2":
246
246
  case "utf16le":
247
- case "utf-16le": return z(this, t, n);
247
+ case "utf-16le": return R(this, t, n);
248
248
  default:
249
249
  if (r) throw TypeError("Unknown encoding: " + e);
250
250
  e = (e + "").toLowerCase(), r = !0;
@@ -280,7 +280,7 @@ var u, d, f, p, m, h, g, _, v, y, b = e((() => {
280
280
  let t = "", n = e.INSPECT_MAX_BYTES;
281
281
  return t = this.toString("hex", 0, n).replace(/(.{2})/g, "$1 ").trim(), this.length > n && (t += " ... "), "<Buffer " + t + ">";
282
282
  }, r && (u.prototype[r] = u.prototype.inspect), u.prototype.compare = function(e, t, n, r, i) {
283
- if (Z(e, a) && (e = u.from(e, e.offset, e.byteLength)), !u.isBuffer(e)) throw TypeError("The \"target\" argument must be one of type Buffer or Uint8Array. Received type " + typeof e);
283
+ if (X(e, a) && (e = u.from(e, e.offset, e.byteLength)), !u.isBuffer(e)) throw TypeError("The \"target\" argument must be one of type Buffer or Uint8Array. Received type " + typeof e);
284
284
  if (t === void 0 && (t = 0), n === void 0 && (n = e ? e.length : 0), r === void 0 && (r = 0), i === void 0 && (i = this.length), t < 0 || n > e.length || r < 0 || i > this.length) throw RangeError("out of range index");
285
285
  if (r >= i && t >= n) return 0;
286
286
  if (r >= i) return -1;
@@ -295,7 +295,7 @@ var u, d, f, p, m, h, g, _, v, y, b = e((() => {
295
295
  };
296
296
  function D(e, t, n, r, i) {
297
297
  if (e.length === 0) return -1;
298
- if (typeof n == "string" ? (r = n, n = 0) : n > 2147483647 ? n = 2147483647 : n < -2147483648 && (n = -2147483648), n = +n, fe(n) && (n = i ? 0 : e.length - 1), n < 0 && (n = e.length + n), n >= e.length) {
298
+ if (typeof n == "string" ? (r = n, n = 0) : n > 2147483647 ? n = 2147483647 : n < -2147483648 && (n = -2147483648), n = +n, pe(n) && (n = i ? 0 : e.length - 1), n < 0 && (n = e.length + n), n >= e.length) {
299
299
  if (i) return -1;
300
300
  n = e.length - 1;
301
301
  } else if (n < 0) if (i) n = 0;
@@ -345,22 +345,22 @@ var u, d, f, p, m, h, g, _, v, y, b = e((() => {
345
345
  let o;
346
346
  for (o = 0; o < r; ++o) {
347
347
  let r = parseInt(t.substr(o * 2, 2), 16);
348
- if (fe(r)) return o;
348
+ if (pe(r)) return o;
349
349
  e[n + o] = r;
350
350
  }
351
351
  return o;
352
352
  }
353
353
  function A(e, t, n, r) {
354
- return de(se(t, e.length - n), e, n, r);
354
+ return fe(ce(t, e.length - n), e, n, r);
355
355
  }
356
356
  function j(e, t, n, r) {
357
- return de(ce(t), e, n, r);
357
+ return fe(le(t), e, n, r);
358
358
  }
359
359
  function M(e, t, n, r) {
360
- return de(ue(t), e, n, r);
360
+ return fe(de(t), e, n, r);
361
361
  }
362
362
  function N(e, t, n, r) {
363
- return de(le(t, e.length - n), e, n, r);
363
+ return fe(ue(t, e.length - n), e, n, r);
364
364
  }
365
365
  u.prototype.write = function(e, t, n, r) {
366
366
  if (t === void 0) r = "utf8", n = this.length, t = 0;
@@ -418,36 +418,36 @@ var u, d, f, p, m, h, g, _, v, y, b = e((() => {
418
418
  }
419
419
  a === null ? (a = 65533, o = 1) : a > 65535 && (a -= 65536, r.push(a >>> 10 & 1023 | 55296), a = 56320 | a & 1023), r.push(a), i += o;
420
420
  }
421
- return L(r);
421
+ return ee(r);
422
422
  }
423
423
  let I = 4096;
424
- function L(e) {
424
+ function ee(e) {
425
425
  let t = e.length;
426
426
  if (t <= I) return String.fromCharCode.apply(String, e);
427
427
  let n = "", r = 0;
428
428
  for (; r < t;) n += String.fromCharCode.apply(String, e.slice(r, r += I));
429
429
  return n;
430
430
  }
431
- function ee(e, t, n) {
431
+ function te(e, t, n) {
432
432
  let r = "";
433
433
  n = Math.min(e.length, n);
434
434
  for (let i = t; i < n; ++i) r += String.fromCharCode(e[i] & 127);
435
435
  return r;
436
436
  }
437
- function te(e, t, n) {
437
+ function ne(e, t, n) {
438
438
  let r = "";
439
439
  n = Math.min(e.length, n);
440
440
  for (let i = t; i < n; ++i) r += String.fromCharCode(e[i]);
441
441
  return r;
442
442
  }
443
- function R(e, t, n) {
443
+ function L(e, t, n) {
444
444
  let r = e.length;
445
445
  (!t || t < 0) && (t = 0), (!n || n < 0 || n > r) && (n = r);
446
446
  let i = "";
447
- for (let r = t; r < n; ++r) i += pe[e[r]];
447
+ for (let r = t; r < n; ++r) i += me[e[r]];
448
448
  return i;
449
449
  }
450
- function z(e, t, n) {
450
+ function R(e, t, n) {
451
451
  let r = e.slice(t, n), i = "";
452
452
  for (let e = 0; e < r.length - 1; e += 2) i += String.fromCharCode(r[e] + r[e + 1] * 256);
453
453
  return i;
@@ -458,88 +458,88 @@ var u, d, f, p, m, h, g, _, v, y, b = e((() => {
458
458
  let r = this.subarray(e, t);
459
459
  return Object.setPrototypeOf(r, u.prototype), r;
460
460
  };
461
- function B(e, t, n) {
461
+ function z(e, t, n) {
462
462
  if (e % 1 != 0 || e < 0) throw RangeError("offset is not uint");
463
463
  if (e + t > n) throw RangeError("Trying to access beyond buffer length");
464
464
  }
465
465
  u.prototype.readUintLE = u.prototype.readUIntLE = function(e, t, n) {
466
- e >>>= 0, t >>>= 0, n || B(e, t, this.length);
466
+ e >>>= 0, t >>>= 0, n || z(e, t, this.length);
467
467
  let r = this[e], i = 1, a = 0;
468
468
  for (; ++a < t && (i *= 256);) r += this[e + a] * i;
469
469
  return r;
470
470
  }, u.prototype.readUintBE = u.prototype.readUIntBE = function(e, t, n) {
471
- e >>>= 0, t >>>= 0, n || B(e, t, this.length);
471
+ e >>>= 0, t >>>= 0, n || z(e, t, this.length);
472
472
  let r = this[e + --t], i = 1;
473
473
  for (; t > 0 && (i *= 256);) r += this[e + --t] * i;
474
474
  return r;
475
475
  }, u.prototype.readUint8 = u.prototype.readUInt8 = function(e, t) {
476
- return e >>>= 0, t || B(e, 1, this.length), this[e];
476
+ return e >>>= 0, t || z(e, 1, this.length), this[e];
477
477
  }, u.prototype.readUint16LE = u.prototype.readUInt16LE = function(e, t) {
478
- return e >>>= 0, t || B(e, 2, this.length), this[e] | this[e + 1] << 8;
478
+ return e >>>= 0, t || z(e, 2, this.length), this[e] | this[e + 1] << 8;
479
479
  }, u.prototype.readUint16BE = u.prototype.readUInt16BE = function(e, t) {
480
- return e >>>= 0, t || B(e, 2, this.length), this[e] << 8 | this[e + 1];
480
+ return e >>>= 0, t || z(e, 2, this.length), this[e] << 8 | this[e + 1];
481
481
  }, u.prototype.readUint32LE = u.prototype.readUInt32LE = function(e, t) {
482
- return e >>>= 0, t || B(e, 4, this.length), (this[e] | this[e + 1] << 8 | this[e + 2] << 16) + this[e + 3] * 16777216;
482
+ return e >>>= 0, t || z(e, 4, this.length), (this[e] | this[e + 1] << 8 | this[e + 2] << 16) + this[e + 3] * 16777216;
483
483
  }, u.prototype.readUint32BE = u.prototype.readUInt32BE = function(e, t) {
484
- return e >>>= 0, t || B(e, 4, this.length), this[e] * 16777216 + (this[e + 1] << 16 | this[e + 2] << 8 | this[e + 3]);
485
- }, u.prototype.readBigUInt64LE = me(function(e) {
486
- e >>>= 0, Y(e, "offset");
484
+ return e >>>= 0, t || z(e, 4, this.length), this[e] * 16777216 + (this[e + 1] << 16 | this[e + 2] << 8 | this[e + 3]);
485
+ }, u.prototype.readBigUInt64LE = Z(function(e) {
486
+ e >>>= 0, J(e, "offset");
487
487
  let t = this[e], n = this[e + 7];
488
- (t === void 0 || n === void 0) && X(e, this.length - 8);
488
+ (t === void 0 || n === void 0) && Y(e, this.length - 8);
489
489
  let r = t + this[++e] * 2 ** 8 + this[++e] * 2 ** 16 + this[++e] * 2 ** 24, i = this[++e] + this[++e] * 2 ** 8 + this[++e] * 2 ** 16 + n * 2 ** 24;
490
490
  return BigInt(r) + (BigInt(i) << BigInt(32));
491
- }), u.prototype.readBigUInt64BE = me(function(e) {
492
- e >>>= 0, Y(e, "offset");
491
+ }), u.prototype.readBigUInt64BE = Z(function(e) {
492
+ e >>>= 0, J(e, "offset");
493
493
  let t = this[e], n = this[e + 7];
494
- (t === void 0 || n === void 0) && X(e, this.length - 8);
494
+ (t === void 0 || n === void 0) && Y(e, this.length - 8);
495
495
  let r = t * 2 ** 24 + this[++e] * 2 ** 16 + this[++e] * 2 ** 8 + this[++e], i = this[++e] * 2 ** 24 + this[++e] * 2 ** 16 + this[++e] * 2 ** 8 + n;
496
496
  return (BigInt(r) << BigInt(32)) + BigInt(i);
497
497
  }), u.prototype.readIntLE = function(e, t, n) {
498
- e >>>= 0, t >>>= 0, n || B(e, t, this.length);
498
+ e >>>= 0, t >>>= 0, n || z(e, t, this.length);
499
499
  let r = this[e], i = 1, a = 0;
500
500
  for (; ++a < t && (i *= 256);) r += this[e + a] * i;
501
501
  return i *= 128, r >= i && (r -= 2 ** (8 * t)), r;
502
502
  }, u.prototype.readIntBE = function(e, t, n) {
503
- e >>>= 0, t >>>= 0, n || B(e, t, this.length);
503
+ e >>>= 0, t >>>= 0, n || z(e, t, this.length);
504
504
  let r = t, i = 1, a = this[e + --r];
505
505
  for (; r > 0 && (i *= 256);) a += this[e + --r] * i;
506
506
  return i *= 128, a >= i && (a -= 2 ** (8 * t)), a;
507
507
  }, u.prototype.readInt8 = function(e, t) {
508
- return e >>>= 0, t || B(e, 1, this.length), this[e] & 128 ? (255 - this[e] + 1) * -1 : this[e];
508
+ return e >>>= 0, t || z(e, 1, this.length), this[e] & 128 ? (255 - this[e] + 1) * -1 : this[e];
509
509
  }, u.prototype.readInt16LE = function(e, t) {
510
- e >>>= 0, t || B(e, 2, this.length);
510
+ e >>>= 0, t || z(e, 2, this.length);
511
511
  let n = this[e] | this[e + 1] << 8;
512
512
  return n & 32768 ? n | 4294901760 : n;
513
513
  }, u.prototype.readInt16BE = function(e, t) {
514
- e >>>= 0, t || B(e, 2, this.length);
514
+ e >>>= 0, t || z(e, 2, this.length);
515
515
  let n = this[e + 1] | this[e] << 8;
516
516
  return n & 32768 ? n | 4294901760 : n;
517
517
  }, u.prototype.readInt32LE = function(e, t) {
518
- return e >>>= 0, t || B(e, 4, this.length), this[e] | this[e + 1] << 8 | this[e + 2] << 16 | this[e + 3] << 24;
518
+ return e >>>= 0, t || z(e, 4, this.length), this[e] | this[e + 1] << 8 | this[e + 2] << 16 | this[e + 3] << 24;
519
519
  }, u.prototype.readInt32BE = function(e, t) {
520
- return e >>>= 0, t || B(e, 4, this.length), this[e] << 24 | this[e + 1] << 16 | this[e + 2] << 8 | this[e + 3];
521
- }, u.prototype.readBigInt64LE = me(function(e) {
522
- e >>>= 0, Y(e, "offset");
520
+ return e >>>= 0, t || z(e, 4, this.length), this[e] << 24 | this[e + 1] << 16 | this[e + 2] << 8 | this[e + 3];
521
+ }, u.prototype.readBigInt64LE = Z(function(e) {
522
+ e >>>= 0, J(e, "offset");
523
523
  let t = this[e], n = this[e + 7];
524
- (t === void 0 || n === void 0) && X(e, this.length - 8);
524
+ (t === void 0 || n === void 0) && Y(e, this.length - 8);
525
525
  let r = this[e + 4] + this[e + 5] * 2 ** 8 + this[e + 6] * 2 ** 16 + (n << 24);
526
526
  return (BigInt(r) << BigInt(32)) + BigInt(t + this[++e] * 2 ** 8 + this[++e] * 2 ** 16 + this[++e] * 2 ** 24);
527
- }), u.prototype.readBigInt64BE = me(function(e) {
528
- e >>>= 0, Y(e, "offset");
527
+ }), u.prototype.readBigInt64BE = Z(function(e) {
528
+ e >>>= 0, J(e, "offset");
529
529
  let t = this[e], n = this[e + 7];
530
- (t === void 0 || n === void 0) && X(e, this.length - 8);
530
+ (t === void 0 || n === void 0) && Y(e, this.length - 8);
531
531
  let r = (t << 24) + this[++e] * 2 ** 16 + this[++e] * 2 ** 8 + this[++e];
532
532
  return (BigInt(r) << BigInt(32)) + BigInt(this[++e] * 2 ** 24 + this[++e] * 2 ** 16 + this[++e] * 2 ** 8 + n);
533
533
  }), u.prototype.readFloatLE = function(e, t) {
534
- return e >>>= 0, t || B(e, 4, this.length), n.read(this, e, !0, 23, 4);
534
+ return e >>>= 0, t || z(e, 4, this.length), n.read(this, e, !0, 23, 4);
535
535
  }, u.prototype.readFloatBE = function(e, t) {
536
- return e >>>= 0, t || B(e, 4, this.length), n.read(this, e, !1, 23, 4);
536
+ return e >>>= 0, t || z(e, 4, this.length), n.read(this, e, !1, 23, 4);
537
537
  }, u.prototype.readDoubleLE = function(e, t) {
538
- return e >>>= 0, t || B(e, 8, this.length), n.read(this, e, !0, 52, 8);
538
+ return e >>>= 0, t || z(e, 8, this.length), n.read(this, e, !0, 52, 8);
539
539
  }, u.prototype.readDoubleBE = function(e, t) {
540
- return e >>>= 0, t || B(e, 8, this.length), n.read(this, e, !1, 52, 8);
540
+ return e >>>= 0, t || z(e, 8, this.length), n.read(this, e, !1, 52, 8);
541
541
  };
542
- function V(e, t, n, r, i, a) {
542
+ function B(e, t, n, r, i, a) {
543
543
  if (!u.isBuffer(e)) throw TypeError("\"buffer\" argument must be a Buffer instance");
544
544
  if (t > i || t < a) throw RangeError("\"value\" argument is out of bounds");
545
545
  if (n + r > e.length) throw RangeError("Index out of range");
@@ -547,7 +547,7 @@ var u, d, f, p, m, h, g, _, v, y, b = e((() => {
547
547
  u.prototype.writeUintLE = u.prototype.writeUIntLE = function(e, t, n, r) {
548
548
  if (e = +e, t >>>= 0, n >>>= 0, !r) {
549
549
  let r = 2 ** (8 * n) - 1;
550
- V(this, e, t, n, r, 0);
550
+ B(this, e, t, n, r, 0);
551
551
  }
552
552
  let i = 1, a = 0;
553
553
  for (this[t] = e & 255; ++a < n && (i *= 256);) this[t + a] = e / i & 255;
@@ -555,44 +555,44 @@ var u, d, f, p, m, h, g, _, v, y, b = e((() => {
555
555
  }, u.prototype.writeUintBE = u.prototype.writeUIntBE = function(e, t, n, r) {
556
556
  if (e = +e, t >>>= 0, n >>>= 0, !r) {
557
557
  let r = 2 ** (8 * n) - 1;
558
- V(this, e, t, n, r, 0);
558
+ B(this, e, t, n, r, 0);
559
559
  }
560
560
  let i = n - 1, a = 1;
561
561
  for (this[t + i] = e & 255; --i >= 0 && (a *= 256);) this[t + i] = e / a & 255;
562
562
  return t + n;
563
563
  }, u.prototype.writeUint8 = u.prototype.writeUInt8 = function(e, t, n) {
564
- return e = +e, t >>>= 0, n || V(this, e, t, 1, 255, 0), this[t] = e & 255, t + 1;
564
+ return e = +e, t >>>= 0, n || B(this, e, t, 1, 255, 0), this[t] = e & 255, t + 1;
565
565
  }, u.prototype.writeUint16LE = u.prototype.writeUInt16LE = function(e, t, n) {
566
- return e = +e, t >>>= 0, n || V(this, e, t, 2, 65535, 0), this[t] = e & 255, this[t + 1] = e >>> 8, t + 2;
566
+ return e = +e, t >>>= 0, n || B(this, e, t, 2, 65535, 0), this[t] = e & 255, this[t + 1] = e >>> 8, t + 2;
567
567
  }, u.prototype.writeUint16BE = u.prototype.writeUInt16BE = function(e, t, n) {
568
- return e = +e, t >>>= 0, n || V(this, e, t, 2, 65535, 0), this[t] = e >>> 8, this[t + 1] = e & 255, t + 2;
568
+ return e = +e, t >>>= 0, n || B(this, e, t, 2, 65535, 0), this[t] = e >>> 8, this[t + 1] = e & 255, t + 2;
569
569
  }, u.prototype.writeUint32LE = u.prototype.writeUInt32LE = function(e, t, n) {
570
- return e = +e, t >>>= 0, n || V(this, e, t, 4, 4294967295, 0), this[t + 3] = e >>> 24, this[t + 2] = e >>> 16, this[t + 1] = e >>> 8, this[t] = e & 255, t + 4;
570
+ return e = +e, t >>>= 0, n || B(this, e, t, 4, 4294967295, 0), this[t + 3] = e >>> 24, this[t + 2] = e >>> 16, this[t + 1] = e >>> 8, this[t] = e & 255, t + 4;
571
571
  }, u.prototype.writeUint32BE = u.prototype.writeUInt32BE = function(e, t, n) {
572
- return e = +e, t >>>= 0, n || V(this, e, t, 4, 4294967295, 0), this[t] = e >>> 24, this[t + 1] = e >>> 16, this[t + 2] = e >>> 8, this[t + 3] = e & 255, t + 4;
572
+ return e = +e, t >>>= 0, n || B(this, e, t, 4, 4294967295, 0), this[t] = e >>> 24, this[t + 1] = e >>> 16, this[t + 2] = e >>> 8, this[t + 3] = e & 255, t + 4;
573
573
  };
574
- function H(e, t, n, r, i) {
575
- J(t, r, i, e, n, 7);
574
+ function V(e, t, n, r, i) {
575
+ q(t, r, i, e, n, 7);
576
576
  let a = Number(t & BigInt(4294967295));
577
577
  e[n++] = a, a >>= 8, e[n++] = a, a >>= 8, e[n++] = a, a >>= 8, e[n++] = a;
578
578
  let o = Number(t >> BigInt(32) & BigInt(4294967295));
579
579
  return e[n++] = o, o >>= 8, e[n++] = o, o >>= 8, e[n++] = o, o >>= 8, e[n++] = o, n;
580
580
  }
581
- function ne(e, t, n, r, i) {
582
- J(t, r, i, e, n, 7);
581
+ function re(e, t, n, r, i) {
582
+ q(t, r, i, e, n, 7);
583
583
  let a = Number(t & BigInt(4294967295));
584
584
  e[n + 7] = a, a >>= 8, e[n + 6] = a, a >>= 8, e[n + 5] = a, a >>= 8, e[n + 4] = a;
585
585
  let o = Number(t >> BigInt(32) & BigInt(4294967295));
586
586
  return e[n + 3] = o, o >>= 8, e[n + 2] = o, o >>= 8, e[n + 1] = o, o >>= 8, e[n] = o, n + 8;
587
587
  }
588
- u.prototype.writeBigUInt64LE = me(function(e, t = 0) {
589
- return H(this, e, t, BigInt(0), BigInt("0xffffffffffffffff"));
590
- }), u.prototype.writeBigUInt64BE = me(function(e, t = 0) {
591
- return ne(this, e, t, BigInt(0), BigInt("0xffffffffffffffff"));
588
+ u.prototype.writeBigUInt64LE = Z(function(e, t = 0) {
589
+ return V(this, e, t, BigInt(0), BigInt("0xffffffffffffffff"));
590
+ }), u.prototype.writeBigUInt64BE = Z(function(e, t = 0) {
591
+ return re(this, e, t, BigInt(0), BigInt("0xffffffffffffffff"));
592
592
  }), u.prototype.writeIntLE = function(e, t, n, r) {
593
593
  if (e = +e, t >>>= 0, !r) {
594
594
  let r = 2 ** (8 * n - 1);
595
- V(this, e, t, n, r - 1, -r);
595
+ B(this, e, t, n, r - 1, -r);
596
596
  }
597
597
  let i = 0, a = 1, o = 0;
598
598
  for (this[t] = e & 255; ++i < n && (a *= 256);) e < 0 && o === 0 && this[t + i - 1] !== 0 && (o = 1), this[t + i] = (e / a >> 0) - o & 255;
@@ -600,44 +600,44 @@ var u, d, f, p, m, h, g, _, v, y, b = e((() => {
600
600
  }, u.prototype.writeIntBE = function(e, t, n, r) {
601
601
  if (e = +e, t >>>= 0, !r) {
602
602
  let r = 2 ** (8 * n - 1);
603
- V(this, e, t, n, r - 1, -r);
603
+ B(this, e, t, n, r - 1, -r);
604
604
  }
605
605
  let i = n - 1, a = 1, o = 0;
606
606
  for (this[t + i] = e & 255; --i >= 0 && (a *= 256);) e < 0 && o === 0 && this[t + i + 1] !== 0 && (o = 1), this[t + i] = (e / a >> 0) - o & 255;
607
607
  return t + n;
608
608
  }, u.prototype.writeInt8 = function(e, t, n) {
609
- return e = +e, t >>>= 0, n || V(this, e, t, 1, 127, -128), e < 0 && (e = 255 + e + 1), this[t] = e & 255, t + 1;
609
+ return e = +e, t >>>= 0, n || B(this, e, t, 1, 127, -128), e < 0 && (e = 255 + e + 1), this[t] = e & 255, t + 1;
610
610
  }, u.prototype.writeInt16LE = function(e, t, n) {
611
- return e = +e, t >>>= 0, n || V(this, e, t, 2, 32767, -32768), this[t] = e & 255, this[t + 1] = e >>> 8, t + 2;
611
+ return e = +e, t >>>= 0, n || B(this, e, t, 2, 32767, -32768), this[t] = e & 255, this[t + 1] = e >>> 8, t + 2;
612
612
  }, u.prototype.writeInt16BE = function(e, t, n) {
613
- return e = +e, t >>>= 0, n || V(this, e, t, 2, 32767, -32768), this[t] = e >>> 8, this[t + 1] = e & 255, t + 2;
613
+ return e = +e, t >>>= 0, n || B(this, e, t, 2, 32767, -32768), this[t] = e >>> 8, this[t + 1] = e & 255, t + 2;
614
614
  }, u.prototype.writeInt32LE = function(e, t, n) {
615
- return e = +e, t >>>= 0, n || V(this, e, t, 4, 2147483647, -2147483648), this[t] = e & 255, this[t + 1] = e >>> 8, this[t + 2] = e >>> 16, this[t + 3] = e >>> 24, t + 4;
615
+ return e = +e, t >>>= 0, n || B(this, e, t, 4, 2147483647, -2147483648), this[t] = e & 255, this[t + 1] = e >>> 8, this[t + 2] = e >>> 16, this[t + 3] = e >>> 24, t + 4;
616
616
  }, u.prototype.writeInt32BE = function(e, t, n) {
617
- return e = +e, t >>>= 0, n || V(this, e, t, 4, 2147483647, -2147483648), e < 0 && (e = 4294967295 + e + 1), this[t] = e >>> 24, this[t + 1] = e >>> 16, this[t + 2] = e >>> 8, this[t + 3] = e & 255, t + 4;
618
- }, u.prototype.writeBigInt64LE = me(function(e, t = 0) {
619
- return H(this, e, t, -BigInt("0x8000000000000000"), BigInt("0x7fffffffffffffff"));
620
- }), u.prototype.writeBigInt64BE = me(function(e, t = 0) {
621
- return ne(this, e, t, -BigInt("0x8000000000000000"), BigInt("0x7fffffffffffffff"));
617
+ return e = +e, t >>>= 0, n || B(this, e, t, 4, 2147483647, -2147483648), e < 0 && (e = 4294967295 + e + 1), this[t] = e >>> 24, this[t + 1] = e >>> 16, this[t + 2] = e >>> 8, this[t + 3] = e & 255, t + 4;
618
+ }, u.prototype.writeBigInt64LE = Z(function(e, t = 0) {
619
+ return V(this, e, t, -BigInt("0x8000000000000000"), BigInt("0x7fffffffffffffff"));
620
+ }), u.prototype.writeBigInt64BE = Z(function(e, t = 0) {
621
+ return re(this, e, t, -BigInt("0x8000000000000000"), BigInt("0x7fffffffffffffff"));
622
622
  });
623
- function U(e, t, n, r, i, a) {
623
+ function H(e, t, n, r, i, a) {
624
624
  if (n + r > e.length || n < 0) throw RangeError("Index out of range");
625
625
  }
626
- function re(e, t, r, i, a) {
627
- return t = +t, r >>>= 0, a || U(e, t, r, 4), n.write(e, t, r, i, 23, 4), r + 4;
626
+ function ie(e, t, r, i, a) {
627
+ return t = +t, r >>>= 0, a || H(e, t, r, 4), n.write(e, t, r, i, 23, 4), r + 4;
628
628
  }
629
629
  u.prototype.writeFloatLE = function(e, t, n) {
630
- return re(this, e, t, !0, n);
630
+ return ie(this, e, t, !0, n);
631
631
  }, u.prototype.writeFloatBE = function(e, t, n) {
632
- return re(this, e, t, !1, n);
632
+ return ie(this, e, t, !1, n);
633
633
  };
634
- function ie(e, t, r, i, a) {
635
- return t = +t, r >>>= 0, a || U(e, t, r, 8), n.write(e, t, r, i, 52, 8), r + 8;
634
+ function ae(e, t, r, i, a) {
635
+ return t = +t, r >>>= 0, a || H(e, t, r, 8), n.write(e, t, r, i, 52, 8), r + 8;
636
636
  }
637
637
  u.prototype.writeDoubleLE = function(e, t, n) {
638
- return ie(this, e, t, !0, n);
638
+ return ae(this, e, t, !0, n);
639
639
  }, u.prototype.writeDoubleBE = function(e, t, n) {
640
- return ie(this, e, t, !1, n);
640
+ return ae(this, e, t, !1, n);
641
641
  }, u.prototype.copy = function(e, t, n, r) {
642
642
  if (!u.isBuffer(e)) throw TypeError("argument should be a Buffer");
643
643
  if (n ||= 0, !r && r !== 0 && (r = this.length), t >= e.length && (t = e.length), t ||= 0, r > 0 && r < n && (r = n), r === n || e.length === 0 || this.length === 0) return 0;
@@ -668,9 +668,9 @@ var u, d, f, p, m, h, g, _, v, y, b = e((() => {
668
668
  }
669
669
  return this;
670
670
  };
671
- let W = {};
672
- function G(e, t, n) {
673
- W[e] = class extends n {
671
+ let U = {};
672
+ function W(e, t, n) {
673
+ U[e] = class extends n {
674
674
  constructor() {
675
675
  super(), Object.defineProperty(this, "message", {
676
676
  value: t.apply(this, arguments),
@@ -694,42 +694,42 @@ var u, d, f, p, m, h, g, _, v, y, b = e((() => {
694
694
  }
695
695
  };
696
696
  }
697
- G("ERR_BUFFER_OUT_OF_BOUNDS", function(e) {
697
+ W("ERR_BUFFER_OUT_OF_BOUNDS", function(e) {
698
698
  return e ? `${e} is outside of buffer bounds` : "Attempt to access memory outside buffer bounds";
699
- }, RangeError), G("ERR_INVALID_ARG_TYPE", function(e, t) {
699
+ }, RangeError), W("ERR_INVALID_ARG_TYPE", function(e, t) {
700
700
  return `The "${e}" argument must be of type number. Received type ${typeof t}`;
701
- }, TypeError), G("ERR_OUT_OF_RANGE", function(e, t, n) {
701
+ }, TypeError), W("ERR_OUT_OF_RANGE", function(e, t, n) {
702
702
  let r = `The value of "${e}" is out of range.`, i = n;
703
- return Number.isInteger(n) && Math.abs(n) > 2 ** 32 ? i = K(String(n)) : typeof n == "bigint" && (i = String(n), (n > BigInt(2) ** BigInt(32) || n < -(BigInt(2) ** BigInt(32))) && (i = K(i)), i += "n"), r += ` It must be ${t}. Received ${i}`, r;
703
+ return Number.isInteger(n) && Math.abs(n) > 2 ** 32 ? i = G(String(n)) : typeof n == "bigint" && (i = String(n), (n > BigInt(2) ** BigInt(32) || n < -(BigInt(2) ** BigInt(32))) && (i = G(i)), i += "n"), r += ` It must be ${t}. Received ${i}`, r;
704
704
  }, RangeError);
705
- function K(e) {
705
+ function G(e) {
706
706
  let t = "", n = e.length, r = +(e[0] === "-");
707
707
  for (; n >= r + 4; n -= 3) t = `_${e.slice(n - 3, n)}${t}`;
708
708
  return `${e.slice(0, n)}${t}`;
709
709
  }
710
- function q(e, t, n) {
711
- Y(t, "offset"), (e[t] === void 0 || e[t + n] === void 0) && X(t, e.length - (n + 1));
710
+ function K(e, t, n) {
711
+ J(t, "offset"), (e[t] === void 0 || e[t + n] === void 0) && Y(t, e.length - (n + 1));
712
712
  }
713
- function J(e, t, n, r, i, a) {
713
+ function q(e, t, n, r, i, a) {
714
714
  if (e > n || e < t) {
715
715
  let r = typeof t == "bigint" ? "n" : "", i;
716
- throw i = a > 3 ? t === 0 || t === BigInt(0) ? `>= 0${r} and < 2${r} ** ${(a + 1) * 8}${r}` : `>= -(2${r} ** ${(a + 1) * 8 - 1}${r}) and < 2 ** ${(a + 1) * 8 - 1}${r}` : `>= ${t}${r} and <= ${n}${r}`, new W.ERR_OUT_OF_RANGE("value", i, e);
716
+ throw i = a > 3 ? t === 0 || t === BigInt(0) ? `>= 0${r} and < 2${r} ** ${(a + 1) * 8}${r}` : `>= -(2${r} ** ${(a + 1) * 8 - 1}${r}) and < 2 ** ${(a + 1) * 8 - 1}${r}` : `>= ${t}${r} and <= ${n}${r}`, new U.ERR_OUT_OF_RANGE("value", i, e);
717
717
  }
718
- q(r, i, a);
718
+ K(r, i, a);
719
719
  }
720
- function Y(e, t) {
721
- if (typeof e != "number") throw new W.ERR_INVALID_ARG_TYPE(t, "number", e);
720
+ function J(e, t) {
721
+ if (typeof e != "number") throw new U.ERR_INVALID_ARG_TYPE(t, "number", e);
722
722
  }
723
- function X(e, t, n) {
724
- throw Math.floor(e) === e ? t < 0 ? new W.ERR_BUFFER_OUT_OF_BOUNDS() : new W.ERR_OUT_OF_RANGE(n || "offset", `>= ${+!!n} and <= ${t}`, e) : (Y(e, n), new W.ERR_OUT_OF_RANGE(n || "offset", "an integer", e));
723
+ function Y(e, t, n) {
724
+ throw Math.floor(e) === e ? t < 0 ? new U.ERR_BUFFER_OUT_OF_BOUNDS() : new U.ERR_OUT_OF_RANGE(n || "offset", `>= ${+!!n} and <= ${t}`, e) : (J(e, n), new U.ERR_OUT_OF_RANGE(n || "offset", "an integer", e));
725
725
  }
726
- let ae = /[^+/0-9A-Za-z-_]/g;
727
- function oe(e) {
728
- if (e = e.split("=")[0], e = e.trim().replace(ae, ""), e.length < 2) return "";
726
+ let oe = /[^+/0-9A-Za-z-_]/g;
727
+ function se(e) {
728
+ if (e = e.split("=")[0], e = e.trim().replace(oe, ""), e.length < 2) return "";
729
729
  for (; e.length % 4 != 0;) e += "=";
730
730
  return e;
731
731
  }
732
- function se(e, t) {
732
+ function ce(e, t) {
733
733
  t ||= Infinity;
734
734
  let n, r = e.length, i = null, a = [];
735
735
  for (let o = 0; o < r; ++o) {
@@ -767,31 +767,31 @@ var u, d, f, p, m, h, g, _, v, y, b = e((() => {
767
767
  }
768
768
  return a;
769
769
  }
770
- function ce(e) {
770
+ function le(e) {
771
771
  let t = [];
772
772
  for (let n = 0; n < e.length; ++n) t.push(e.charCodeAt(n) & 255);
773
773
  return t;
774
774
  }
775
- function le(e, t) {
775
+ function ue(e, t) {
776
776
  let n, r, i, a = [];
777
777
  for (let o = 0; o < e.length && !((t -= 2) < 0); ++o) n = e.charCodeAt(o), r = n >> 8, i = n % 256, a.push(i), a.push(r);
778
778
  return a;
779
779
  }
780
- function ue(e) {
781
- return t.toByteArray(oe(e));
780
+ function de(e) {
781
+ return t.toByteArray(se(e));
782
782
  }
783
- function de(e, t, n, r) {
783
+ function fe(e, t, n, r) {
784
784
  let i;
785
785
  for (i = 0; i < r && !(i + n >= t.length || i >= e.length); ++i) t[i + n] = e[i];
786
786
  return i;
787
787
  }
788
- function Z(e, t) {
788
+ function X(e, t) {
789
789
  return e instanceof t || e != null && e.constructor != null && e.constructor.name != null && e.constructor.name === t.name;
790
790
  }
791
- function fe(e) {
791
+ function pe(e) {
792
792
  return e !== e;
793
793
  }
794
- let pe = (function() {
794
+ let me = (function() {
795
795
  let e = "0123456789abcdef", t = Array(256);
796
796
  for (let n = 0; n < 16; ++n) {
797
797
  let r = n * 16;
@@ -799,7 +799,7 @@ var u, d, f, p, m, h, g, _, v, y, b = e((() => {
799
799
  }
800
800
  return t;
801
801
  })();
802
- function me(e) {
802
+ function Z(e) {
803
803
  return typeof BigInt > "u" ? he : e;
804
804
  }
805
805
  function he() {
@@ -1187,11 +1187,12 @@ var u, d, f, p, m, h, g, _, v, y, b = e((() => {
1187
1187
  if (!this.captureInput) return;
1188
1188
  let t = a(e);
1189
1189
  for (let e of t) {
1190
- if (e === "^C" && !(this.stdinStream && this.stdinStream.isRaw)) {
1190
+ let t = !!(this.isRaw || this.stdinStream && this.stdinStream.isRaw);
1191
+ if (e === "^C" && !t) {
1191
1192
  this.kill("SIGINT");
1192
1193
  return;
1193
1194
  }
1194
- !this.interactive && !this.stdinStream.isRaw && (e === "Enter" ? this.stdout.write("\r\n") : e === "Backspace" ? this.stdout.write("\b \b") : e.length === 1 && this.stdout.write(e)), this.onInput(e);
1195
+ !this.interactive && !t && (e === "Enter" ? this.stdout.write("\r\n") : e === "Backspace" ? this.stdout.write("\b \b") : e.length === 1 && this.stdout.write(e)), this.onInput(e);
1195
1196
  }
1196
1197
  }, this.stdinStream.on("data", this._onStdinStreamData);
1197
1198
  }
@@ -1249,6 +1250,7 @@ var u, d, f, p, m, h, g, _, v, y, b = e((() => {
1249
1250
  }
1250
1251
  };
1251
1252
  })), D = /* @__PURE__ */ t(((e, t) => {
1253
+ b();
1252
1254
  var n = E(), { parseVtKeys: r, hasCustomStdinListener: i } = w();
1253
1255
  function a(e) {
1254
1256
  return /^#!\/(sh\.js|bin\/(sh|brsh))/.test(e);
@@ -1266,7 +1268,11 @@ var u, d, f, p, m, h, g, _, v, y, b = e((() => {
1266
1268
  return !!(this.sandbox && this.sandbox.runningCommand && this.sandbox.runningCommand.interactive);
1267
1269
  }
1268
1270
  get isRaw() {
1269
- return !!(this.stdinStream && this.stdinStream.isRaw || this.sandbox && this.sandbox.runningCommand && (this.sandbox.runningCommand.isRaw || this.sandbox.runningCommand.stdinStream && this.sandbox.runningCommand.stdinStream.isRaw));
1271
+ if (this.sandbox && this.sandbox.runningCommand) {
1272
+ let e = this.sandbox.runningCommand;
1273
+ return !!(e.isRaw || e.stdinStream && e.stdinStream.isRaw);
1274
+ }
1275
+ return !!(this.stdinStream && this.stdinStream.isRaw);
1270
1276
  }
1271
1277
  get _inAltScreen() {
1272
1278
  return !!(this.__inAltScreen || this.sandbox && this.sandbox.runningCommand && this.sandbox.runningCommand._inAltScreen);
@@ -1275,10 +1281,14 @@ var u, d, f, p, m, h, g, _, v, y, b = e((() => {
1275
1281
  this.__inAltScreen = !!e;
1276
1282
  }
1277
1283
  onInput(e) {
1284
+ if ((e === "^C" || e === "") && !this.isRaw) {
1285
+ this.kill("SIGINT");
1286
+ return;
1287
+ }
1278
1288
  this.sandbox && this.sandbox.onInput(e);
1279
1289
  }
1280
1290
  kill(e = "SIGINT") {
1281
- this.sandbox && this.sandbox.runningCommand && typeof this.sandbox.runningCommand.kill == "function" && this.sandbox.runningCommand.kill(e), this.sandbox && typeof this.sandbox.destroy == "function" && this.sandbox.destroy(130), super.kill(e);
1291
+ this._killed = !0, this.sandbox && this.sandbox.runningCommand && typeof this.sandbox.runningCommand.kill == "function" && this.sandbox.runningCommand.kill(e), this.sandbox && typeof this.sandbox.destroy == "function" && this.sandbox.destroy(130), super.kill(e);
1282
1292
  }
1283
1293
  run() {
1284
1294
  this._managesOwnStdinCapture = !0;
@@ -1295,20 +1305,22 @@ var u, d, f, p, m, h, g, _, v, y, b = e((() => {
1295
1305
  typeof this.sandbox.setTerminalSize == "function" && this.sandbox.setTerminalSize(o, s), Array.isArray(this.arguments) && (this.arguments.forEach((e, t) => this.sandbox.context.setVar(String(t + 1), e)), this.sandbox.context.setVar("#", String(this.arguments.length)), this.sandbox.context.setVar("@", this.arguments.join(" ")), this.sandbox.context.setVar("*", this.arguments.join(" "))), this._onStdinStreamData && this.stdinStream && typeof this.stdinStream.off == "function" && this.stdinStream.off("data", this._onStdinStreamData);
1296
1306
  let c = (e) => {
1297
1307
  if (!this.sandbox || !this.sandbox.runningCommand) return;
1298
- let t = this.sandbox.runningCommand, n = i(t);
1299
- if (t.interactive || t._inAltScreen || n) {
1308
+ let t = this.sandbox.runningCommand, n = !!(t.isRaw || t.stdinStream && t.stdinStream.isRaw);
1309
+ if ((typeof e == "string" && e === "" || e instanceof Uint8Array && e.length === 1 && e[0] === 3 || y !== void 0 && y.isBuffer(e) && e.length === 1 && e[0] === 3) && !n) {
1310
+ this.kill("SIGINT");
1311
+ return;
1312
+ }
1313
+ let a = i(t);
1314
+ if (t.interactive || t._inAltScreen || a) {
1300
1315
  t.stdinStream && t.stdinStream.pushData(e);
1301
1316
  return;
1302
1317
  }
1303
- if (t.captureInput && typeof t.onInput == "function") {
1304
- let n = !!(t.isRaw || t.stdinStream && t.stdinStream.isRaw);
1305
- for (let i of r(e)) {
1306
- if (i === "^C" && !n) {
1307
- this.kill("SIGINT");
1308
- return;
1309
- }
1310
- n || (i === "Enter" ? this.stdout.write("\r\n") : i === "Backspace" ? this.stdout.write("\b \b") : i.length === 1 && this.stdout.write(i)), t.onInput(i);
1318
+ if (t.captureInput && typeof t.onInput == "function") for (let i of r(e)) {
1319
+ if (i === "^C" && !n) {
1320
+ this.kill("SIGINT");
1321
+ return;
1311
1322
  }
1323
+ n || (i === "Enter" ? this.stdout.write("\r\n") : i === "Backspace" ? this.stdout.write("\b \b") : i.length === 1 && this.stdout.write(i)), t.onInput(i);
1312
1324
  }
1313
1325
  }, l = () => {
1314
1326
  this.sandbox && typeof this.sandbox.setTerminalSize == "function" && this.stdinStream && this.sandbox.setTerminalSize(this.stdinStream.columns, this.stdinStream.rows);
@@ -1488,25 +1500,41 @@ var u, d, f, p, m, h, g, _, v, y, b = e((() => {
1488
1500
  };
1489
1501
  }
1490
1502
  async _executeNodes(e) {
1491
- for (let t of e) await this._executeNode(t);
1503
+ for (let t of e) {
1504
+ if (this._killed || this.sandbox && this.sandbox.destroyed) break;
1505
+ await this._executeNode(t);
1506
+ }
1492
1507
  }
1493
1508
  _executeNode(e) {
1509
+ if (this._killed || this.sandbox && this.sandbox.destroyed) return Promise.resolve();
1494
1510
  if (e.type === "function") {
1495
1511
  let t = e.name, n = e.bodyLines, r = this, i = E(), a = class extends i {
1496
1512
  static get name() {
1497
1513
  return t;
1498
1514
  }
1499
1515
  run() {
1500
- let e = this.arguments.map((e, t) => ({
1501
- key: String(t + 1),
1502
- prev: r.sandbox.context.getVar(String(t + 1))
1503
- }));
1504
- this.arguments.forEach((e, t) => r.sandbox.context.setVar(String(t + 1), e));
1505
- let t = () => e.forEach(({ key: e, prev: t }) => t ? r.sandbox.context.setVar(e, t) : r.sandbox.context.unsetVar(e));
1516
+ let e = parseInt(r.sandbox.context.getVar("#") || "0", 10) || 0, t = Math.max(e, this.arguments.length), i = [];
1517
+ for (let e = 1; e <= t; e++) {
1518
+ let t = String(e);
1519
+ i.push({
1520
+ key: t,
1521
+ prev: r.sandbox.context.getVar(t)
1522
+ }), e <= this.arguments.length ? r.sandbox.context.setVar(t, this.arguments[e - 1]) : r.sandbox.context.unsetVar(t);
1523
+ }
1524
+ for (let e of [
1525
+ "#",
1526
+ "@",
1527
+ "*"
1528
+ ]) i.push({
1529
+ key: e,
1530
+ prev: r.sandbox.context.getVar(e)
1531
+ });
1532
+ r.sandbox.context.setVar("#", String(this.arguments.length)), r.sandbox.context.setVar("@", this.arguments.join(" ")), r.sandbox.context.setVar("*", this.arguments.join(" "));
1533
+ let a = () => i.forEach(({ key: e, prev: t }) => t ? r.sandbox.context.setVar(e, t) : r.sandbox.context.unsetVar(e));
1506
1534
  return r._executeFunctionBody(n).then(() => {
1507
- t();
1535
+ a();
1508
1536
  }).catch((e) => {
1509
- if (t(), e && e.__type === "return") {
1537
+ if (a(), e && e.__type === "return") {
1510
1538
  this.exitCode = e.code;
1511
1539
  return;
1512
1540
  }
@@ -1548,11 +1576,14 @@ var u, d, f, p, m, h, g, _, v, y, b = e((() => {
1548
1576
  return e.type === "if" ? this._executeIf(e) : e.type === "while" ? this._executeWhile(e) : e.type === "for" ? this._executeFor(e) : e.type === "case" ? this._executeCase(e) : Promise.resolve();
1549
1577
  }
1550
1578
  async _executeIf(e) {
1551
- for (let t of e.clauses) if (await this.sandbox.onCommand(t.condition, !1), this.sandbox.lastCode === 0) return this._executeNodes(this._parseLines(t.bodyLines));
1552
- if (e.elseLines.length > 0) return this._executeNodes(this._parseLines(e.elseLines));
1579
+ for (let t of e.clauses) {
1580
+ if (this._killed || this.sandbox && this.sandbox.destroyed || (await this.sandbox.onCommand(t.condition, !1), this._killed || this.sandbox && this.sandbox.destroyed)) return;
1581
+ if (this.sandbox.lastCode === 0) return this._executeNodes(this._parseLines(t.bodyLines));
1582
+ }
1583
+ if (e.elseLines.length > 0 && !this._killed && !(this.sandbox && this.sandbox.destroyed)) return this._executeNodes(this._parseLines(e.elseLines));
1553
1584
  }
1554
1585
  async _executeWhile(e) {
1555
- for (; await this.sandbox.onCommand(e.condition, !1), this.sandbox.lastCode === 0;) try {
1586
+ for (; !this._killed && !(this.sandbox && this.sandbox.destroyed) && (await this.sandbox.onCommand(e.condition, !1), !(this._killed || this.sandbox && this.sandbox.destroyed || this.sandbox.lastCode !== 0));) try {
1556
1587
  await this._executeNodes(this._parseLines(e.bodyLines));
1557
1588
  } catch (e) {
1558
1589
  if (e && e.__type === "break") {
@@ -1580,6 +1611,7 @@ var u, d, f, p, m, h, g, _, v, y, b = e((() => {
1580
1611
  for (let n = 1; n <= e; n++) t.push(this.sandbox.context.getVar(String(n)) || "");
1581
1612
  } else t = (await this.sandbox._replaceVariables(e.list)).split(/\s+/).filter(Boolean);
1582
1613
  for (let n of t) {
1614
+ if (this._killed || this.sandbox && this.sandbox.destroyed) break;
1583
1615
  this.sandbox.context.setVar(e.variable, n);
1584
1616
  try {
1585
1617
  await this._executeNodes(this._parseLines(e.bodyLines));
@@ -1701,14 +1733,14 @@ var u, d, f, p, m, h, g, _, v, y, b = e((() => {
1701
1733
  t.exports = null;
1702
1734
  })), k = /* @__PURE__ */ t(((e, t) => {
1703
1735
  b();
1704
- var n = D(), { BinaryFile: r } = X(), i = 0, a = 6, o = 8, s = 20, c = 27, l = 28, u = 31, d = 44, f = 54, p = 70, m = 0, h = 2, g = 3, _ = 4, v = 1, x = 2, S = 4, C = 8, w = 1, E = 4, k = class extends n {
1736
+ var n = D(), { BinaryFile: r } = Y(), i = 0, a = 6, o = 8, s = 20, c = 27, l = 28, u = 31, d = 44, f = 54, p = 70, m = 0, h = 2, g = 3, _ = 4, v = 1, x = 2, S = 4, C = 8, w = 1, E = 4, k = 1, A = class extends n {
1705
1737
  constructor(e, t, n) {
1706
1738
  super(e, t, n), this._ensurePkgMeta();
1707
1739
  }
1708
1740
  _ensurePkgMeta() {
1709
1741
  if (this._pkgMeta === void 0 && this.script) {
1710
1742
  let e = this.context && this.context.fs || this.fs;
1711
- e && (this._pkgMeta = te(e, this.script));
1743
+ e && (this._pkgMeta = L(e, this.script));
1712
1744
  }
1713
1745
  return this._pkgMeta || null;
1714
1746
  }
@@ -1728,6 +1760,32 @@ var u, d, f, p, m, h, g, _, v, y, b = e((() => {
1728
1760
  get captureInput() {
1729
1761
  return this.interactive;
1730
1762
  }
1763
+ get isRaw() {
1764
+ if (typeof this._getTermiosLflag == "function") try {
1765
+ let e = (this._getTermiosLflag() >>> 0 & k) == 0;
1766
+ return this._inAltScreen && this.stdinStream && typeof this.stdinStream.setRawMode == "function" && this.stdinStream.isRaw !== e && this.stdinStream.setRawMode(e), e;
1767
+ } catch {}
1768
+ let e = this._ensurePkgMeta();
1769
+ return e && (e.raw !== void 0 || e.wasm?.raw !== void 0) ? !!(e.raw ?? e.wasm?.raw) : !!(this.stdinStream && this.stdinStream.isRaw);
1770
+ }
1771
+ _syncRawMode() {
1772
+ if (!this.stdinStream || typeof this.stdinStream.setRawMode != "function") return;
1773
+ if (!this._inAltScreen && !this._isInteractive) {
1774
+ this.stdinStream.isRaw && this.stdinStream.setRawMode(!1);
1775
+ return;
1776
+ }
1777
+ if (typeof this._getTermiosLflag == "function") try {
1778
+ let e = (this._getTermiosLflag() >>> 0 & k) == 0;
1779
+ this.stdinStream.setRawMode(e);
1780
+ return;
1781
+ } catch {}
1782
+ let e = this._ensurePkgMeta();
1783
+ if (e && (e.raw !== void 0 || e.wasm?.raw !== void 0)) {
1784
+ this.stdinStream.setRawMode(!!(e.raw ?? e.wasm?.raw));
1785
+ return;
1786
+ }
1787
+ this.stdinStream.setRawMode(!1);
1788
+ }
1731
1789
  kill(e = "SIGINT") {
1732
1790
  if (this._killed = !0, this.exitCode = 130, this._exitAltScreen(), this._asyncifyReject) {
1733
1791
  try {
@@ -1745,7 +1803,7 @@ var u, d, f, p, m, h, g, _, v, y, b = e((() => {
1745
1803
  super.kill(e);
1746
1804
  }
1747
1805
  _enterAltScreen() {
1748
- this._inAltScreen || (this._inAltScreen = !0, this.stdinStream && typeof this.stdinStream.setRawMode == "function" && this.stdinStream.setRawMode(!0), this.stdout && typeof this.stdout.write == "function" && this.stdout.write("\x1B[?1049h\x1B[2J\x1B[H"));
1806
+ this._inAltScreen || (this._inAltScreen = !0, this._syncRawMode(), this.stdout && typeof this.stdout.write == "function" && this.stdout.write("\x1B[?1049h\x1B[2J\x1B[H"));
1749
1807
  }
1750
1808
  _exitAltScreen() {
1751
1809
  this._inAltScreen && (this._inAltScreen = !1, this.stdinStream && typeof this.stdinStream.setRawMode == "function" && this.stdinStream.setRawMode(!1), this.stdout && typeof this.stdout.write == "function" && this.stdout.write("\x1B[0m\x1B[?1l\x1B[?1000l\x1B[?1002l\x1B[?1003l\x1B[?1006l\x1B[?1049l\x1B[?25h"));
@@ -1857,7 +1915,7 @@ var u, d, f, p, m, h, g, _, v, y, b = e((() => {
1857
1915
  isWat: this._isWat(e, i)
1858
1916
  });
1859
1917
  }
1860
- return r.then((e) => (!e.isWat && e.bytes && (this._inspectedWasm = F(e.bytes), this._inspectedWasm.isInteractive && (this._isInteractive = !0)), e));
1918
+ return r.then((e) => (!e.isWat && e.bytes && (this._inspectedWasm = I(e.bytes), this._inspectedWasm.isInteractive && (this._isInteractive = !0)), e));
1861
1919
  }
1862
1920
  _isWat(e, t) {
1863
1921
  return e.endsWith(".wat") ? !0 : t.length > 0 && t[0] === 40;
@@ -1898,12 +1956,12 @@ var u, d, f, p, m, h, g, _, v, y, b = e((() => {
1898
1956
  let t = {
1899
1957
  1: "",
1900
1958
  2: ""
1901
- }, n = new TextDecoder(), b = new TextEncoder(), T = null, D = null, O = !1, k = 0, A = null, j = null, M = null, N = !1, P = !1, L = !1, ee = null, te = null, R = null, z = this.stdin === void 0 || this.stdin === null || this.stdin === this.stdinStream || this.stdin && this.stdin.isTTY, B = !!(this.interactive && z);
1902
- B && (this.emit("interactive"), this.context && typeof this.context.emit == "function" && this.context.emit("interactive"));
1903
- let V = () => {
1904
- B || !z || (B = !0, this._isInteractive = !0, this.emit("interactive"), this.context && typeof this.context.emit == "function" && this.context.emit("interactive"), this._enterAltScreen(), t[1] &&= (this.stdout && typeof this.stdout.write == "function" && this.stdout.write(t[1]), ""), t[2] &&= (this.stderr && typeof this.stderr.write == "function" && this.stderr.write(t[2]), ""), this.stdinStream && typeof this.stdinStream.setRawMode == "function" && this.stdinStream.setRawMode(!0));
1905
- }, H = (e, n) => {
1906
- if (B && (e === 1 || e === 2)) {
1959
+ }, n = new TextDecoder(), b = new TextEncoder(), T = null, D = null, O = !1, k = 0, A = null, j = null, M = null, N = !1, P = !1, F = !1, te = null, ne = null, L = null, R = this.stdin === void 0 || this.stdin === null || this.stdin === this.stdinStream || this.stdin && this.stdin.isTTY, z = !!(this.interactive && R);
1960
+ z && (this.emit("interactive"), this.context && typeof this.context.emit == "function" && this.context.emit("interactive"));
1961
+ let B = () => {
1962
+ z || !R || (z = !0, this._isInteractive = !0, this.emit("interactive"), this.context && typeof this.context.emit == "function" && this.context.emit("interactive"), this._enterAltScreen(), t[1] &&= (this.stdout && typeof this.stdout.write == "function" && this.stdout.write(t[1]), ""), t[2] &&= (this.stderr && typeof this.stderr.write == "function" && this.stderr.write(t[2]), ""), this._syncRawMode());
1963
+ }, V = (e, n) => {
1964
+ if (z && (e === 1 || e === 2)) {
1907
1965
  if (e === 1 && this.stdout) {
1908
1966
  this.stdout.write(n);
1909
1967
  return;
@@ -1917,63 +1975,69 @@ var u, d, f, p, m, h, g, _, v, y, b = e((() => {
1917
1975
  let r = t[e].split("\n");
1918
1976
  t[e] = r.pop();
1919
1977
  for (let t of r) e === 1 ? this.stdOut = t : this.stdErr = t;
1920
- }, ne = () => {
1921
- t[1] &&= (B && this.stdout ? this.stdout.write(t[1]) : this.stdOut = t[1], ""), t[2] &&= (B && this.stderr ? this.stderr.write(t[2]) : this.stdErr = t[2], "");
1922
- }, U = [], re = (e) => {
1923
- if (!(!e || e.length === 0)) {
1924
- for (let t = 0; t < e.length; t++) U.push(e[t]);
1925
- if (j) {
1926
- let e = j;
1927
- j = null, e();
1978
+ }, re = () => {
1979
+ t[1] &&= (z && this.stdout ? this.stdout.write(t[1]) : this.stdOut = t[1], ""), t[2] &&= (z && this.stderr ? this.stderr.write(t[2]) : this.stdErr = t[2], "");
1980
+ }, H = [], ie = (e) => {
1981
+ if (!e || e.length === 0) return;
1982
+ let t = this.isRaw;
1983
+ for (let n = 0; n < e.length; n++) {
1984
+ if (e[n] === 3 && !t) {
1985
+ this.kill("SIGINT");
1986
+ return;
1928
1987
  }
1988
+ H.push(e[n]);
1989
+ }
1990
+ if (j) {
1991
+ let e = j;
1992
+ j = null, e();
1929
1993
  }
1930
1994
  };
1931
- R = (e) => {
1995
+ L = (e) => {
1932
1996
  this._handlingStreamData = !0;
1933
1997
  try {
1934
- re(typeof e == "string" ? b.encode(e) : e instanceof Uint8Array ? e : y !== void 0 && y.isBuffer(e) ? new Uint8Array(e) : b.encode(String(e ?? "")));
1998
+ ie(typeof e == "string" ? b.encode(e) : e instanceof Uint8Array ? e : y !== void 0 && y.isBuffer(e) ? new Uint8Array(e) : b.encode(String(e ?? "")));
1935
1999
  } finally {
1936
2000
  this._handlingStreamData = !1;
1937
2001
  }
1938
2002
  }, this._externalKeyHandler = (e) => {
1939
2003
  if (this._handlingStreamData) return;
1940
2004
  let t = this._keyToBytes(e);
1941
- t && re(t);
2005
+ t && ie(t);
1942
2006
  };
1943
- let ie = !!(this._onStdinStreamData && this.stdinStream && typeof this.stdinStream.listeners == "function" && this.stdinStream.listeners("data").includes(this._onStdinStreamData));
1944
- ie && typeof this.stdinStream.off == "function" && this.stdinStream.off("data", this._onStdinStreamData), z && this.stdinStream && typeof this.stdinStream.on == "function" && this.stdinStream.on("data", R), z && this.stdin && this.stdin !== this.stdinStream && typeof this.stdin.on == "function" && this.stdin.on("data", R);
1945
- let W = !z && typeof this.stdin == "string" ? b.encode(this.stdin) : !z && this.stdin instanceof Uint8Array ? this.stdin : !z && y !== void 0 && y.isBuffer(this.stdin) ? new Uint8Array(this.stdin) : new Uint8Array(), G = 0, K = this.context && this.context.fs ? this.context.fs : this.fs, q = this.context && this.context.fs && this.context.fs.cwd || this.fs && this.fs.cwd || this.context && typeof this.context.getVar == "function" && this.context.getVar("PWD") || K && K.cwd || "/", J = q.length > 1 && q.endsWith("/") ? q.slice(0, -1) : q, Y = 5, X = new Map([[3, {
2007
+ let ae = !!(this._onStdinStreamData && this.stdinStream && typeof this.stdinStream.listeners == "function" && this.stdinStream.listeners("data").includes(this._onStdinStreamData));
2008
+ ae && typeof this.stdinStream.off == "function" && this.stdinStream.off("data", this._onStdinStreamData), R && this.stdinStream && typeof this.stdinStream.on == "function" && this.stdinStream.on("data", L), R && this.stdin && this.stdin !== this.stdinStream && typeof this.stdin.on == "function" && this.stdin.on("data", L);
2009
+ let U = !R && typeof this.stdin == "string" ? b.encode(this.stdin) : !R && this.stdin instanceof Uint8Array ? this.stdin : !R && y !== void 0 && y.isBuffer(this.stdin) ? new Uint8Array(this.stdin) : new Uint8Array(), W = 0, G = this.context && this.context.fs ? this.context.fs : this.fs, K = this.context && this.context.fs && this.context.fs.cwd || this.fs && this.fs.cwd || this.context && typeof this.context.getVar == "function" && this.context.getVar("PWD") || G && G.cwd || "/", q = K.length > 1 && K.endsWith("/") ? K.slice(0, -1) : K, J = 5, Y = new Map([[3, {
1946
2010
  type: "preopen",
1947
2011
  path: "/",
1948
2012
  guestName: "/"
1949
2013
  }], [4, {
1950
2014
  type: "preopen",
1951
- path: J,
2015
+ path: q,
1952
2016
  guestName: "."
1953
- }]]), ae = new Map([
2017
+ }]]), oe = new Map([
1954
2018
  [0, 0],
1955
2019
  [1, 0],
1956
2020
  [2, 0]
1957
- ]), oe = (e) => {
2021
+ ]), se = (e) => {
1958
2022
  let t = e.split("/").filter(Boolean);
1959
2023
  return t.pop(), "/" + t.join("/");
1960
- }, se = (e, t) => {
1961
- let n = X.get(e);
2024
+ }, ce = (e, t) => {
2025
+ let n = Y.get(e);
1962
2026
  if (!n || n.type !== "preopen" && n.type !== "dir") return null;
1963
- if (t.startsWith("/")) return K.absolutePath(t);
1964
- if (!t || t === ".") return K.absolutePath(n.path);
1965
- let r = n.path.endsWith("/") ? n.path : n.path + "/", i = K.absolutePath(r + t), a = K.absolutePath("/" + t);
2027
+ if (t.startsWith("/")) return G.absolutePath(t);
2028
+ if (!t || t === ".") return G.absolutePath(n.path);
2029
+ let r = n.path.endsWith("/") ? n.path : n.path + "/", i = G.absolutePath(r + t), a = G.absolutePath("/" + t);
1966
2030
  if (n.path !== "/") {
1967
- if (K.exists(i)) return i;
1968
- if (K.exists(a)) return a;
1969
- let e = K.exists(oe(i));
1970
- return K.exists(oe(a)) && !e ? a : i;
1971
- }
1972
- if (K.exists(i)) return i;
1973
- let o = K.absolutePath(t);
1974
- return K.exists(o) ? o : i;
1975
- }, ce = (e) => {
1976
- if (!(!e || e.type !== "file" || !e.dirty || !K)) try {
2031
+ if (G.exists(i)) return i;
2032
+ if (G.exists(a)) return a;
2033
+ let e = G.exists(se(i));
2034
+ return G.exists(se(a)) && !e ? a : i;
2035
+ }
2036
+ if (G.exists(i)) return i;
2037
+ let o = G.absolutePath(t);
2038
+ return G.exists(o) ? o : i;
2039
+ }, le = (e) => {
2040
+ if (!(!e || e.type !== "file" || !e.dirty || !G)) try {
1977
2041
  let t = !0;
1978
2042
  for (let n = 0; n < e.bytes.length; n++) if (e.bytes[n] === 0) {
1979
2043
  t = !1;
@@ -1981,20 +2045,20 @@ var u, d, f, p, m, h, g, _, v, y, b = e((() => {
1981
2045
  }
1982
2046
  if (t) {
1983
2047
  let t = n.decode(e.bytes);
1984
- K.setFileByPath(e.path, t, !0);
2048
+ G.setFileByPath(e.path, t, !0);
1985
2049
  } else {
1986
2050
  let t = new Uint8Array(e.bytes.length);
1987
- t.set(e.bytes), K.setFileByPath(e.path, new r(t.buffer, "application/octet-stream"), !0);
2051
+ t.set(e.bytes), G.setFileByPath(e.path, new r(t.buffer, "application/octet-stream"), !0);
1988
2052
  }
1989
2053
  e.dirty = !1;
1990
2054
  } catch {}
1991
- }, le = this.stdout && this.stdout.columns || this.stdinStream && this.stdinStream.columns || this.context && typeof this.context.getVar == "function" && parseInt(this.context.getVar("COLUMNS"), 10) || 80, ue = this.stdout && this.stdout.rows || this.stdinStream && this.stdinStream.rows || this.context && typeof this.context.getVar == "function" && parseInt(this.context.getVar("LINES"), 10) || 24, de = {
2055
+ }, ue = this.stdout && this.stdout.columns || this.stdinStream && this.stdinStream.columns || this.context && typeof this.context.getVar == "function" && parseInt(this.context.getVar("COLUMNS"), 10) || 80, de = this.stdout && this.stdout.rows || this.stdinStream && this.stdinStream.rows || this.context && typeof this.context.getVar == "function" && parseInt(this.context.getVar("LINES"), 10) || 24, fe = {
1992
2056
  TERM: "xterm-256color",
1993
2057
  COLORTERM: "truecolor",
1994
2058
  ...this.context && this.context.vars || {},
1995
- COLUMNS: String(le),
1996
- LINES: String(ue)
1997
- }, Z = Object.entries(de).map(([e, t]) => `${e}=${t}`), fe = new Proxy({
2059
+ COLUMNS: String(ue),
2060
+ LINES: String(de)
2061
+ }, X = Object.entries(fe).map(([e, t]) => `${e}=${t}`), pe = new Proxy({
1998
2062
  fd_write: (e, t, r, a) => {
1999
2063
  if (!T) return o;
2000
2064
  let s = new DataView(T.buffer);
@@ -2002,11 +2066,11 @@ var u, d, f, p, m, h, g, _, v, y, b = e((() => {
2002
2066
  let o = 0;
2003
2067
  for (let i = 0; i < r; i++) {
2004
2068
  let r = s.getUint32(t + i * 8, !0), a = s.getUint32(t + i * 8 + 4, !0);
2005
- a > 0 && H(e, n.decode(new Uint8Array(T.buffer, r, a))), o += a;
2069
+ a > 0 && V(e, n.decode(new Uint8Array(T.buffer, r, a))), o += a;
2006
2070
  }
2007
2071
  return s.setUint32(a, o, !0), i;
2008
2072
  }
2009
- let c = X.get(e);
2073
+ let c = Y.get(e);
2010
2074
  if (!c) return o;
2011
2075
  if (c.type === "dev_null" || c.type === "dev_zero") {
2012
2076
  let e = 0;
@@ -2017,7 +2081,7 @@ var u, d, f, p, m, h, g, _, v, y, b = e((() => {
2017
2081
  let e = 0;
2018
2082
  for (let i = 0; i < r; i++) {
2019
2083
  let r = s.getUint32(t + i * 8, !0), a = s.getUint32(t + i * 8 + 4, !0);
2020
- a > 0 && H(1, n.decode(new Uint8Array(T.buffer, r, a))), e += a;
2084
+ a > 0 && V(1, n.decode(new Uint8Array(T.buffer, r, a))), e += a;
2021
2085
  }
2022
2086
  return s.setUint32(a, e, !0), i;
2023
2087
  }
@@ -2038,52 +2102,52 @@ var u, d, f, p, m, h, g, _, v, y, b = e((() => {
2038
2102
  },
2039
2103
  fd_read: (e, t, n, r) => {
2040
2104
  if (!T) return o;
2041
- let s = new DataView(T.buffer), l = X.get(e), u = !!(l && l.type === "dev_tty");
2042
- if (e === 0 || B && e === 2 || u) {
2043
- (u || e === 2) && V();
2044
- let o = !!((ae.get(e) || 0) & E);
2105
+ let s = new DataView(T.buffer), l = Y.get(e), u = !!(l && l.type === "dev_tty");
2106
+ if (e === 0 || z && e === 2 || u) {
2107
+ (u || e === 2) && B(), this._syncRawMode();
2108
+ let o = !!((oe.get(e) || 0) & E);
2045
2109
  if (O) {
2046
2110
  if ((typeof D?.exports?.asyncify_get_state == "function" ? D.exports.asyncify_get_state() : 0) === 2) {
2047
- if (D.exports.asyncify_stop_rewind(), L && U.length === 0) return L = !1, s.setUint32(r, 0, !0), c;
2048
- L = !1;
2111
+ if (D.exports.asyncify_stop_rewind(), F && H.length === 0) return F = !1, s.setUint32(r, 0, !0), c;
2112
+ F = !1;
2049
2113
  let e = 0;
2050
- for (let r = 0; r < n && U.length > 0; r++) {
2051
- let n = s.getUint32(t + r * 8, !0), i = s.getUint32(t + r * 8 + 4, !0), a = Math.min(i, U.length), o = U.splice(0, a);
2114
+ for (let r = 0; r < n && H.length > 0; r++) {
2115
+ let n = s.getUint32(t + r * 8, !0), i = s.getUint32(t + r * 8 + 4, !0), a = Math.min(i, H.length), o = H.splice(0, a);
2052
2116
  new Uint8Array(T.buffer).set(o, n), e += a;
2053
2117
  }
2054
2118
  return s.setUint32(r, e, !0), i;
2055
2119
  }
2056
- if (U.length > 0) {
2120
+ if (H.length > 0) {
2057
2121
  let e = 0;
2058
- for (let r = 0; r < n && U.length > 0; r++) {
2059
- let n = s.getUint32(t + r * 8, !0), i = s.getUint32(t + r * 8 + 4, !0), a = Math.min(i, U.length), o = U.splice(0, a);
2122
+ for (let r = 0; r < n && H.length > 0; r++) {
2123
+ let n = s.getUint32(t + r * 8, !0), i = s.getUint32(t + r * 8 + 4, !0), a = Math.min(i, H.length), o = H.splice(0, a);
2060
2124
  new Uint8Array(T.buffer).set(o, n), e += a;
2061
2125
  }
2062
2126
  return s.setUint32(r, e, !0), i;
2063
2127
  }
2064
- return o ? (s.setUint32(r, 0, !0), a) : (L = !1, D.exports.asyncify_start_unwind(k), A = new Promise((e, t) => {
2128
+ return o ? (s.setUint32(r, 0, !0), a) : (F = !1, D.exports.asyncify_start_unwind(k), A = new Promise((e, t) => {
2065
2129
  let n = () => {
2066
- L = !1, j = null, M = null, this._pendingReadResolve = null, this._asyncifyReject = null, e();
2130
+ F = !1, j = null, M = null, this._pendingReadResolve = null, this._asyncifyReject = null, e();
2067
2131
  };
2068
2132
  j = n, this._pendingReadResolve = n, M = () => {
2069
- L = !0, j = null, M = null, this._pendingReadResolve = null, this._asyncifyReject = null, e();
2133
+ F = !0, j = null, M = null, this._pendingReadResolve = null, this._asyncifyReject = null, e();
2070
2134
  }, this._asyncifyReject = t;
2071
2135
  }), s.setUint32(r, 0, !0), i);
2072
2136
  }
2073
- if (U.length > 0) {
2137
+ if (H.length > 0) {
2074
2138
  let e = 0;
2075
- for (let r = 0; r < n && U.length > 0; r++) {
2076
- let n = s.getUint32(t + r * 8, !0), i = s.getUint32(t + r * 8 + 4, !0), a = Math.min(i, U.length), o = U.splice(0, a);
2139
+ for (let r = 0; r < n && H.length > 0; r++) {
2140
+ let n = s.getUint32(t + r * 8, !0), i = s.getUint32(t + r * 8 + 4, !0), a = Math.min(i, H.length), o = H.splice(0, a);
2077
2141
  new Uint8Array(T.buffer).set(o, n), e += a;
2078
2142
  }
2079
2143
  return s.setUint32(r, e, !0), i;
2080
2144
  }
2081
2145
  let l = 0;
2082
- for (let e = 0; e < n && G < W.length; e++) {
2083
- let n = s.getUint32(t + e * 8, !0), r = s.getUint32(t + e * 8 + 4, !0), i = Math.min(r, W.length - G);
2084
- new Uint8Array(T.buffer).set(W.slice(G, G + i), n), G += i, l += i;
2146
+ for (let e = 0; e < n && W < U.length; e++) {
2147
+ let n = s.getUint32(t + e * 8, !0), r = s.getUint32(t + e * 8 + 4, !0), i = Math.min(r, U.length - W);
2148
+ new Uint8Array(T.buffer).set(U.slice(W, W + i), n), W += i, l += i;
2085
2149
  }
2086
- return l === 0 && o && G >= W.length ? (s.setUint32(r, 0, !0), a) : (s.setUint32(r, l, !0), i);
2150
+ return l === 0 && o && W >= U.length ? (s.setUint32(r, 0, !0), a) : (s.setUint32(r, l, !0), i);
2087
2151
  }
2088
2152
  if (!l) return o;
2089
2153
  if (l.type === "dev_null") return s.setUint32(r, 0, !0), i;
@@ -2116,7 +2180,7 @@ var u, d, f, p, m, h, g, _, v, y, b = e((() => {
2116
2180
  fd_seek: (e, t, n, r, a) => {
2117
2181
  if (!T) return o;
2118
2182
  if (e <= 2) return p;
2119
- let s = X.get(e);
2183
+ let s = Y.get(e);
2120
2184
  if (!s) return o;
2121
2185
  if (s.type === "dev_tty" || s.type === "dev_null" || s.type === "dev_zero" || s.type === "dev_urandom") return p;
2122
2186
  if (s.type !== "file") return o;
@@ -2131,32 +2195,32 @@ var u, d, f, p, m, h, g, _, v, y, b = e((() => {
2131
2195
  },
2132
2196
  fd_tell: (e, t) => {
2133
2197
  if (!T) return o;
2134
- let n = X.get(e);
2198
+ let n = Y.get(e);
2135
2199
  return !n || n.type !== "file" ? o : (new DataView(T.buffer).setBigUint64(t, BigInt(n.pos), !0), i);
2136
2200
  },
2137
2201
  fd_close: (e) => {
2138
2202
  if (e <= 2) return i;
2139
- let t = X.get(e);
2140
- return t ? (t.type === "file" && ce(t), X.delete(e), ae.delete(e), i) : o;
2203
+ let t = Y.get(e);
2204
+ return t ? (t.type === "file" && le(t), Y.delete(e), oe.delete(e), i) : o;
2141
2205
  },
2142
2206
  fd_sync: (e) => {
2143
- let t = X.get(e);
2144
- return t && ce(t), i;
2207
+ let t = Y.get(e);
2208
+ return t && le(t), i;
2145
2209
  },
2146
2210
  fd_datasync: (e) => {
2147
- let t = X.get(e);
2148
- return t && ce(t), i;
2211
+ let t = Y.get(e);
2212
+ return t && le(t), i;
2149
2213
  },
2150
2214
  fd_prestat_get: (e, t) => {
2151
2215
  if (!T) return o;
2152
- let n = X.get(e);
2216
+ let n = Y.get(e);
2153
2217
  if (!n || n.type !== "preopen") return o;
2154
2218
  let r = new DataView(T.buffer), a = b.encode(n.guestName);
2155
2219
  return r.setUint8(t, 0), r.setUint32(t + 4, a.length, !0), i;
2156
2220
  },
2157
2221
  fd_prestat_dir_name: (e, t, n) => {
2158
2222
  if (!T) return o;
2159
- let r = X.get(e);
2223
+ let r = Y.get(e);
2160
2224
  if (!r || r.type !== "preopen") return o;
2161
2225
  let a = b.encode(r.guestName);
2162
2226
  return new Uint8Array(T.buffer, t, Math.min(n, a.length)).set(a.subarray(0, n)), i;
@@ -2166,75 +2230,75 @@ var u, d, f, p, m, h, g, _, v, y, b = e((() => {
2166
2230
  let n = new DataView(T.buffer), r = m;
2167
2231
  if (e <= 2) r = h;
2168
2232
  else {
2169
- let t = X.get(e);
2233
+ let t = Y.get(e);
2170
2234
  if (!t) return o;
2171
2235
  r = t.type === "dev_null" || t.type === "dev_zero" || t.type === "dev_urandom" || t.type === "dev_tty" ? h : t.type === "preopen" || t.type === "dir" ? g : _;
2172
2236
  }
2173
2237
  for (let e = 0; e < 24; e++) n.setUint8(t + e, 0);
2174
2238
  n.setUint8(t, r);
2175
- let a = ae.get(e) || (X.get(e)?.append ? w : 0);
2239
+ let a = oe.get(e) || (Y.get(e)?.append ? w : 0);
2176
2240
  return n.setUint16(t + 2, a, !0), n.setBigUint64(t + 8, 18446744073709551615n, !0), n.setBigUint64(t + 16, 18446744073709551615n, !0), i;
2177
2241
  },
2178
2242
  fd_fdstat_set_flags: (e, t) => {
2179
- if (!T || e > 2 && !X.has(e)) return o;
2180
- ae.set(e, t);
2181
- let n = X.get(e);
2182
- return n && (n.append = !!(t & w)), (e === 0 || e === 2 || n && n.type === "dev_tty") && t & E && V(), i;
2243
+ if (!T || e > 2 && !Y.has(e)) return o;
2244
+ oe.set(e, t);
2245
+ let n = Y.get(e);
2246
+ return n && (n.append = !!(t & w)), (e === 0 || e === 2 || n && n.type === "dev_tty") && t & E && B(), i;
2183
2247
  },
2184
2248
  fd_filestat_get: (e, t) => {
2185
2249
  if (!T) return o;
2186
2250
  let n = new DataView(T.buffer);
2187
2251
  for (let e = 0; e < 64; e++) n.setUint8(t + e, 0);
2188
2252
  if (e <= 2) return n.setUint8(t + 16, h), i;
2189
- let r = X.get(e);
2253
+ let r = Y.get(e);
2190
2254
  if (!r) return o;
2191
2255
  if (r.type === "dev_null" || r.type === "dev_zero" || r.type === "dev_urandom" || r.type === "dev_tty") return n.setUint8(t + 16, h), n.setBigUint64(t + 24, 1n, !0), i;
2192
2256
  let a = r.type === "preopen" || r.type === "dir";
2193
2257
  return n.setUint8(t + 16, a ? g : _), n.setBigUint64(t + 24, 1n, !0), n.setBigUint64(t + 32, BigInt(r.bytes ? r.bytes.length : 0), !0), i;
2194
2258
  },
2195
2259
  path_open: (e, t, r, a, c, l, p, m, h) => {
2196
- if (!T || !K) return o;
2197
- let g = se(e, n.decode(new Uint8Array(T.buffer, r, a)));
2260
+ if (!T || !G) return o;
2261
+ let g = ce(e, n.decode(new Uint8Array(T.buffer, r, a)));
2198
2262
  if (!g) return o;
2199
2263
  let _ = g.replace(/\/+/g, "/").replace(/\/$/, "") || "/";
2200
2264
  if (_ === "/dev/null") {
2201
- let e = Y++;
2202
- return X.set(e, {
2265
+ let e = J++;
2266
+ return Y.set(e, {
2203
2267
  type: "dev_null",
2204
2268
  path: "/dev/null"
2205
2269
  }), new DataView(T.buffer).setUint32(h, e, !0), i;
2206
2270
  }
2207
2271
  if (_ === "/dev/zero") {
2208
- let e = Y++;
2209
- return X.set(e, {
2272
+ let e = J++;
2273
+ return Y.set(e, {
2210
2274
  type: "dev_zero",
2211
2275
  path: "/dev/zero"
2212
2276
  }), new DataView(T.buffer).setUint32(h, e, !0), i;
2213
2277
  }
2214
2278
  if (_ === "/dev/urandom" || _ === "/dev/random") {
2215
- let e = Y++;
2216
- return X.set(e, {
2279
+ let e = J++;
2280
+ return Y.set(e, {
2217
2281
  type: "dev_urandom",
2218
2282
  path: _
2219
2283
  }), new DataView(T.buffer).setUint32(h, e, !0), i;
2220
2284
  }
2221
2285
  if (_ === "/dev/tty" || _ === "/dev/stdin") {
2222
- V();
2223
- let e = Y++;
2224
- return X.set(e, {
2286
+ B();
2287
+ let e = J++;
2288
+ return Y.set(e, {
2225
2289
  type: "dev_tty",
2226
2290
  path: _
2227
2291
  }), new DataView(T.buffer).setUint32(h, e, !0), i;
2228
2292
  }
2229
2293
  if (_ === "/dev/stdout") return new DataView(T.buffer).setUint32(h, 1, !0), i;
2230
2294
  if (_ === "/dev/stderr") return new DataView(T.buffer).setUint32(h, 2, !0), i;
2231
- let y = K.stat(g), E = y !== null;
2295
+ let y = G.stat(g), E = y !== null;
2232
2296
  if (c & S && c & v && E) return s;
2233
2297
  if (c & x) {
2234
2298
  if (!E) return d;
2235
2299
  if (!y.isDirectory) return f;
2236
- let e = Y++;
2237
- return X.set(e, {
2300
+ let e = J++;
2301
+ return Y.set(e, {
2238
2302
  type: "dir",
2239
2303
  path: g
2240
2304
  }), new DataView(T.buffer).setUint32(h, e, !0), i;
@@ -2243,11 +2307,11 @@ var u, d, f, p, m, h, g, _, v, y, b = e((() => {
2243
2307
  if (!E && !(c & v)) return d;
2244
2308
  let D = new Uint8Array(), O = !1;
2245
2309
  if (E && !(c & C)) {
2246
- let e = K.getFileByPath(g);
2310
+ let e = G.getFileByPath(g);
2247
2311
  e != null && (D = typeof e == "string" ? b.encode(e) : new Uint8Array(this._contentToBytes(e)));
2248
2312
  } else O = !0;
2249
- let k = Y++;
2250
- return X.set(k, {
2313
+ let k = J++;
2314
+ return Y.set(k, {
2251
2315
  type: "file",
2252
2316
  path: g,
2253
2317
  bytes: D,
@@ -2257,10 +2321,10 @@ var u, d, f, p, m, h, g, _, v, y, b = e((() => {
2257
2321
  }), new DataView(T.buffer).setUint32(h, k, !0), i;
2258
2322
  },
2259
2323
  path_filestat_get: (e, t, r, a, s) => {
2260
- if (!T || !K) return o;
2261
- let c = se(e, n.decode(new Uint8Array(T.buffer, r, a)));
2324
+ if (!T || !G) return o;
2325
+ let c = ce(e, n.decode(new Uint8Array(T.buffer, r, a)));
2262
2326
  if (!c) return o;
2263
- let l = c.replace(/\/+/g, "/").replace(/\/$/, "") || "/", u = K.stat(c);
2327
+ let l = c.replace(/\/+/g, "/").replace(/\/$/, "") || "/", u = G.stat(c);
2264
2328
  if (l === "/dev/null" || l === "/dev/zero" || l === "/dev/urandom" || l === "/dev/random" || l === "/dev/tty" || l === "/dev/stdin" || l === "/dev/stdout" || l === "/dev/stderr" || u && (u.isDevice || u.isCharacterDevice)) {
2265
2329
  let e = new DataView(T.buffer);
2266
2330
  for (let t = 0; t < 64; t++) e.setUint8(s + t, 0);
@@ -2269,48 +2333,48 @@ var u, d, f, p, m, h, g, _, v, y, b = e((() => {
2269
2333
  if (!u) return d;
2270
2334
  let f = new DataView(T.buffer);
2271
2335
  for (let e = 0; e < 64; e++) f.setUint8(s + e, 0);
2272
- return f.setUint8(s + 16, u.isDirectory ? g : _), f.setBigUint64(s + 24, 1n, !0), f.setBigUint64(s + 32, BigInt(K.getSize(c) || 0), !0), i;
2336
+ return f.setUint8(s + 16, u.isDirectory ? g : _), f.setBigUint64(s + 24, 1n, !0), f.setBigUint64(s + 32, BigInt(G.getSize(c) || 0), !0), i;
2273
2337
  },
2274
2338
  path_create_directory: (e, t, r) => {
2275
- if (!T || !K) return o;
2276
- let a = se(e, n.decode(new Uint8Array(T.buffer, t, r)));
2339
+ if (!T || !G) return o;
2340
+ let a = ce(e, n.decode(new Uint8Array(T.buffer, t, r)));
2277
2341
  if (!a) return o;
2278
- if (K.exists(a)) return s;
2342
+ if (G.exists(a)) return s;
2279
2343
  try {
2280
- return K.setFileByPath(a, {}, !0), i;
2344
+ return G.setFileByPath(a, {}, !0), i;
2281
2345
  } catch {
2282
2346
  return l;
2283
2347
  }
2284
2348
  },
2285
2349
  path_unlink_file: (e, t, r) => {
2286
- if (!T || !K) return o;
2287
- let a = se(e, n.decode(new Uint8Array(T.buffer, t, r)));
2288
- if (!a || !K.exists(a)) return d;
2350
+ if (!T || !G) return o;
2351
+ let a = ce(e, n.decode(new Uint8Array(T.buffer, t, r)));
2352
+ if (!a || !G.exists(a)) return d;
2289
2353
  try {
2290
- return K.deleteFileByPath(a), i;
2354
+ return G.deleteFileByPath(a), i;
2291
2355
  } catch {
2292
2356
  return l;
2293
2357
  }
2294
2358
  },
2295
2359
  path_remove_directory: (e, t, r) => {
2296
- if (!T || !K) return o;
2297
- let a = se(e, n.decode(new Uint8Array(T.buffer, t, r)));
2298
- if (!a || !K.exists(a)) return d;
2360
+ if (!T || !G) return o;
2361
+ let a = ce(e, n.decode(new Uint8Array(T.buffer, t, r)));
2362
+ if (!a || !G.exists(a)) return d;
2299
2363
  try {
2300
- return K.deleteFileByPath(a), i;
2364
+ return G.deleteFileByPath(a), i;
2301
2365
  } catch {
2302
2366
  return l;
2303
2367
  }
2304
2368
  },
2305
2369
  path_rename: (e, t, r, a, s, c) => {
2306
- if (!T || !K) return o;
2307
- let u = n.decode(new Uint8Array(T.buffer, t, r)), f = n.decode(new Uint8Array(T.buffer, s, c)), p = se(e, u), m = se(a, f);
2370
+ if (!T || !G) return o;
2371
+ let u = n.decode(new Uint8Array(T.buffer, t, r)), f = n.decode(new Uint8Array(T.buffer, s, c)), p = ce(e, u), m = ce(a, f);
2308
2372
  if (!p || !m) return o;
2309
- if (!K.exists(p)) return d;
2310
- for (let e of X.values()) e.path === p && (ce(e), e.path = m);
2373
+ if (!G.exists(p)) return d;
2374
+ for (let e of Y.values()) e.path === p && (le(e), e.path = m);
2311
2375
  try {
2312
- let e = K.getFileByPath(p);
2313
- return K.setFileByPath(m, e, !0), K.deleteFileByPath(p), i;
2376
+ let e = G.getFileByPath(p);
2377
+ return G.setFileByPath(m, e, !0), G.deleteFileByPath(p), i;
2314
2378
  } catch {
2315
2379
  return l;
2316
2380
  }
@@ -2339,16 +2403,16 @@ var u, d, f, p, m, h, g, _, v, y, b = e((() => {
2339
2403
  environ_sizes_get: (e, t) => {
2340
2404
  if (!T) return l;
2341
2405
  let n = new DataView(T.buffer);
2342
- n.setUint32(e, Z.length, !0);
2343
- let r = Z.reduce((e, t) => e + b.encode(t).length + 1, 0);
2406
+ n.setUint32(e, X.length, !0);
2407
+ let r = X.reduce((e, t) => e + b.encode(t).length + 1, 0);
2344
2408
  return n.setUint32(t, r, !0), i;
2345
2409
  },
2346
2410
  environ_get: (e, t) => {
2347
2411
  if (!T) return l;
2348
2412
  let n = new DataView(T.buffer), r = t;
2349
- for (let t = 0; t < Z.length; t++) {
2413
+ for (let t = 0; t < X.length; t++) {
2350
2414
  n.setUint32(e + t * 4, r, !0);
2351
- let i = b.encode(Z[t] + "\0");
2415
+ let i = b.encode(X[t] + "\0");
2352
2416
  new Uint8Array(T.buffer).set(i, r), r += i.length;
2353
2417
  }
2354
2418
  return i;
@@ -2374,28 +2438,35 @@ var u, d, f, p, m, h, g, _, v, y, b = e((() => {
2374
2438
  let e = BigInt(Date.now()) * 1000000n;
2375
2439
  c = s > e ? Number((s - e) / 1000000n) : 0;
2376
2440
  } else c = Number(s / 1000000n);
2377
- return O && c > 0 ? (typeof D?.exports?.asyncify_get_state == "function" ? D.exports.asyncify_get_state() : 0) === 2 ? (D.exports.asyncify_stop_rewind(), i) : (D.exports.asyncify_start_unwind(k), A = new Promise((e) => setTimeout(e, Math.max(1, c))), i) : i;
2441
+ return O && c > 0 ? (typeof D?.exports?.asyncify_get_state == "function" ? D.exports.asyncify_get_state() : 0) === 2 ? (D.exports.asyncify_stop_rewind(), i) : (D.exports.asyncify_start_unwind(k), A = new Promise((e, t) => {
2442
+ let n = setTimeout(() => {
2443
+ this._asyncifyReject = null, e();
2444
+ }, Math.max(1, c));
2445
+ this._asyncifyReject = (e) => {
2446
+ clearTimeout(n), this._asyncifyReject = null, t(e);
2447
+ };
2448
+ }), i) : i;
2378
2449
  },
2379
2450
  poll_oneoff: (e, t, n, r) => {
2380
2451
  if (!T) return o;
2381
2452
  let a = new DataView(T.buffer);
2382
- if (O) {
2453
+ if (this._syncRawMode(), O) {
2383
2454
  if ((typeof D?.exports?.asyncify_get_state == "function" ? D.exports.asyncify_get_state() : 0) === 2) {
2384
- if (D.exports.asyncify_stop_rewind(), P && U.length === 0) return P = !1, a.setUint32(r, 0, !0), c;
2455
+ if (D.exports.asyncify_stop_rewind(), P && H.length === 0) return P = !1, a.setUint32(r, 0, !0), c;
2385
2456
  P = !1;
2386
2457
  let o = 0;
2387
2458
  for (let r = 0; r < n; r++) {
2388
2459
  let n = e + r * 48, s = a.getBigUint64(n, !0), c = a.getUint8(n + 8), l = !1;
2389
2460
  if (c === 0) l = N;
2390
2461
  else if (c === 1) {
2391
- let e = a.getUint32(n + 16, !0), t = X.get(e), r = !!(t && t.type === "dev_tty");
2392
- (e === 0 || B && e === 2 || r) && U.length > 0 && (l = !0);
2462
+ let e = a.getUint32(n + 16, !0), t = Y.get(e), r = !!(t && t.type === "dev_tty");
2463
+ (e === 0 || z && e === 2 || r) && H.length > 0 && (l = !0);
2393
2464
  } else c === 2 && (l = !0);
2394
2465
  if (l) {
2395
2466
  let e = t + o * 32;
2396
2467
  a.setBigUint64(e, s, !0), a.setUint16(e + 8, i, !0), a.setUint8(e + 10, c);
2397
2468
  for (let t = 11; t < 32; t++) a.setUint8(e + t, 0);
2398
- c === 1 && a.setBigUint64(e + 16, BigInt(U.length), !0), o++;
2469
+ c === 1 && a.setBigUint64(e + 16, BigInt(H.length), !0), o++;
2399
2470
  }
2400
2471
  }
2401
2472
  return a.setUint32(r, o, !0), i;
@@ -2412,8 +2483,8 @@ var u, d, f, p, m, h, g, _, v, y, b = e((() => {
2412
2483
  r < l && (l = r);
2413
2484
  } else if (r === 1) {
2414
2485
  s = !0;
2415
- let e = a.getUint32(n + 16, !0), t = X.get(e), r = !!(t && t.type === "dev_tty");
2416
- (e === 0 || e === 2 || r) && V(), (e === 0 || B && e === 2 || r) && U.length > 0 && o++;
2486
+ let e = a.getUint32(n + 16, !0), t = Y.get(e), r = !!(t && t.type === "dev_tty");
2487
+ (e === 0 || e === 2 || r) && B(), (e === 0 || z && e === 2 || r) && H.length > 0 && o++;
2417
2488
  } else r === 2 && o++;
2418
2489
  }
2419
2490
  if (o > 0 || l === 0) {
@@ -2422,21 +2493,23 @@ var u, d, f, p, m, h, g, _, v, y, b = e((() => {
2422
2493
  let n = e + r * 48, s = a.getBigUint64(n, !0), c = a.getUint8(n + 8), u = !1;
2423
2494
  if (c === 0 && l === 0) u = !0;
2424
2495
  else if (c === 1) {
2425
- let e = a.getUint32(n + 16, !0), t = X.get(e), r = !!(t && t.type === "dev_tty");
2426
- (e === 0 || B && e === 2 || r) && U.length > 0 && (u = !0);
2496
+ let e = a.getUint32(n + 16, !0), t = Y.get(e), r = !!(t && t.type === "dev_tty");
2497
+ (e === 0 || z && e === 2 || r) && H.length > 0 && (u = !0);
2427
2498
  } else c === 2 && (u = !0);
2428
2499
  if (u) {
2429
2500
  let e = t + o * 32;
2430
2501
  a.setBigUint64(e, s, !0), a.setUint16(e + 8, i, !0), a.setUint8(e + 10, c);
2431
2502
  for (let t = 11; t < 32; t++) a.setUint8(e + t, 0);
2432
- c === 1 && a.setBigUint64(e + 16, BigInt(U.length), !0), o++;
2503
+ c === 1 && a.setBigUint64(e + 16, BigInt(H.length), !0), o++;
2433
2504
  }
2434
2505
  }
2435
2506
  return a.setUint32(r, o, !0), i;
2436
2507
  }
2437
2508
  return N = !1, P = !1, D.exports.asyncify_start_unwind(k), A = new Promise((e, t) => {
2438
2509
  let n = null;
2439
- this._asyncifyReject = t;
2510
+ this._asyncifyReject = (e) => {
2511
+ n && clearTimeout(n), j = null, M = null, this._pendingReadResolve = null, this._asyncifyReject = null, t(e);
2512
+ };
2440
2513
  let r = () => {
2441
2514
  n && clearTimeout(n), N = !1, P = !1, j = null, M = null, this._pendingReadResolve = null, this._asyncifyReject = null, e();
2442
2515
  };
@@ -2451,7 +2524,7 @@ var u, d, f, p, m, h, g, _, v, y, b = e((() => {
2451
2524
  }
2452
2525
  }, { get(e, t) {
2453
2526
  return t in e ? e[t] : () => 0;
2454
- } }), pe = (e) => {
2527
+ } }), me = (e) => {
2455
2528
  if (!T || !e) return "";
2456
2529
  try {
2457
2530
  let t = new DataView(T.buffer).getUint32(e - 4, !0), n = new Uint16Array(T.buffer, e, t >>> 1);
@@ -2459,33 +2532,33 @@ var u, d, f, p, m, h, g, _, v, y, b = e((() => {
2459
2532
  } catch {
2460
2533
  return "";
2461
2534
  }
2462
- }, me = {
2463
- wasi_snapshot_preview1: fe,
2464
- wasi_unstable: fe,
2535
+ }, Z = {
2536
+ wasi_snapshot_preview1: pe,
2537
+ wasi_unstable: pe,
2465
2538
  env: new Proxy({
2466
2539
  print: (e, t) => {
2467
- T && H(1, n.decode(new Uint8Array(T.buffer, e, t)));
2540
+ T && V(1, n.decode(new Uint8Array(T.buffer, e, t)));
2468
2541
  },
2469
2542
  eprint: (e, t) => {
2470
- T && H(2, n.decode(new Uint8Array(T.buffer, e, t)));
2543
+ T && V(2, n.decode(new Uint8Array(T.buffer, e, t)));
2471
2544
  },
2472
2545
  log: (e) => {
2473
- H(1, pe(e) + "\n");
2546
+ V(1, me(e) + "\n");
2474
2547
  },
2475
2548
  logi: (e) => {
2476
- H(1, String(e) + "\n");
2549
+ V(1, String(e) + "\n");
2477
2550
  },
2478
2551
  logf: (e) => {
2479
- H(1, String(e) + "\n");
2552
+ V(1, String(e) + "\n");
2480
2553
  },
2481
2554
  trace: (e, t, ...n) => {
2482
2555
  let r = t > 0 ? " " + n.slice(0, t).join(", ") : "";
2483
- H(1, `trace: ${pe(e)}${r}\n`);
2556
+ V(1, `trace: ${me(e)}${r}\n`);
2484
2557
  },
2485
2558
  seed: () => Date.now() * Math.random(),
2486
2559
  abort: (e, t, n, r) => {
2487
- let i = pe(e), a = pe(t);
2488
- throw (i || a) && H(2, `abort: ${i || "aborted"} at ${a || this.script}:${n || 0}:${r || 0}\n`), this.exitCode = 134, {
2560
+ let i = me(e), a = me(t);
2561
+ throw (i || a) && V(2, `abort: ${i || "aborted"} at ${a || this.script}:${n || 0}:${r || 0}\n`), this.exitCode = 134, {
2489
2562
  _wasmExit: !0,
2490
2563
  code: 134
2491
2564
  };
@@ -2501,9 +2574,9 @@ var u, d, f, p, m, h, g, _, v, y, b = e((() => {
2501
2574
  initial: 1,
2502
2575
  maximum: 256
2503
2576
  });
2504
- T = t, me[e.module] || (me[e.module] = {}), me[e.module][e.name] = t;
2577
+ T = t, Z[e.module] || (Z[e.module] = {}), Z[e.module][e.name] = t;
2505
2578
  }
2506
- if (D = await WebAssembly.instantiate(t, me), D.exports.memory && (T = D.exports.memory), O = !!(D.exports.asyncify_start_unwind && D.exports.asyncify_stop_unwind), O && T) {
2579
+ if (D = await WebAssembly.instantiate(t, Z), D.exports.memory && (T = D.exports.memory), this._getTermiosLflag = typeof D.exports.get_termios_lflag == "function" ? D.exports.get_termios_lflag : null, O = !!(D.exports.asyncify_start_unwind && D.exports.asyncify_stop_unwind), O && T) {
2507
2580
  try {
2508
2581
  k = T.grow(1) * 65536;
2509
2582
  } catch {
@@ -2512,7 +2585,7 @@ var u, d, f, p, m, h, g, _, v, y, b = e((() => {
2512
2585
  let e = k + 8, t = k + 65536 - 8;
2513
2586
  new Int32Array(T.buffer, k, 2).set([e, t]);
2514
2587
  }
2515
- typeof D.exports.set_terminal_size == "function" && V(), B && this._enterAltScreen();
2588
+ typeof D.exports.set_terminal_size == "function" && B(), z && (this._enterAltScreen(), this._syncRawMode());
2516
2589
  let n = this.stdout && this.stdout.columns || this.stdinStream && this.stdinStream.columns || this.context && typeof this.context.getVar == "function" && parseInt(this.context.getVar("COLUMNS"), 10) || 80, r = this.stdout && this.stdout.rows || this.stdinStream && this.stdinStream.rows || this.context && typeof this.context.getVar == "function" && parseInt(this.context.getVar("LINES"), 10) || 24;
2517
2590
  if (typeof D.exports.set_terminal_size == "function") try {
2518
2591
  D.exports.set_terminal_size(n, r);
@@ -2533,11 +2606,11 @@ var u, d, f, p, m, h, g, _, v, y, b = e((() => {
2533
2606
  }
2534
2607
  }
2535
2608
  };
2536
- ee = () => {
2609
+ te = () => {
2537
2610
  o(this.stdout && this.stdout.columns || this.context && typeof this.context.getVar == "function" && parseInt(this.context.getVar("COLUMNS"), 10) || 80, this.stdout && this.stdout.rows || this.context && typeof this.context.getVar == "function" && parseInt(this.context.getVar("LINES"), 10) || 24);
2538
- }, te = () => {
2611
+ }, ne = () => {
2539
2612
  o(this.stdinStream && this.stdinStream.columns || this.stdout && this.stdout.columns || this.context && typeof this.context.getVar == "function" && parseInt(this.context.getVar("COLUMNS"), 10) || 80, this.stdinStream && this.stdinStream.rows || this.stdout && this.stdout.rows || this.context && typeof this.context.getVar == "function" && parseInt(this.context.getVar("LINES"), 10) || 24);
2540
- }, this.stdout && typeof this.stdout.on == "function" && this.stdout.on("resize", ee), this.stdinStream && this.stdinStream !== this.stdout && typeof this.stdinStream.on == "function" && this.stdinStream.on("resize", te);
2613
+ }, this.stdout && typeof this.stdout.on == "function" && this.stdout.on("resize", te), this.stdinStream && this.stdinStream !== this.stdout && typeof this.stdinStream.on == "function" && this.stdinStream.on("resize", ne);
2541
2614
  let s = D.exports._start || D.exports.__wasi_command || D.exports.main || D.exports.run;
2542
2615
  if (s) try {
2543
2616
  let e = s();
@@ -2573,10 +2646,10 @@ var u, d, f, p, m, h, g, _, v, y, b = e((() => {
2573
2646
  } catch (e) {
2574
2647
  this._killed ? this.exitCode = 130 : (!e || !e._wasmExit) && (this.stdErr = `${this.script}: ${e?.message || String(e)}`, this.exitCode = 1);
2575
2648
  } finally {
2576
- B && this._exitAltScreen(), R && (this.stdinStream && typeof this.stdinStream.off == "function" && this.stdinStream.off("data", R), this.stdin && typeof this.stdin.off == "function" && this.stdin.off("data", R)), ie && this._onStdinStreamData && this.stdinStream && typeof this.stdinStream.on == "function" && this.stdinStream.on("data", this._onStdinStreamData), ee && this.stdout && typeof this.stdout.off == "function" && this.stdout.off("resize", ee), te && this.stdinStream && typeof this.stdinStream.off == "function" && this.stdinStream.off("resize", te), this._externalKeyHandler = null;
2577
- for (let e of X.values()) ce(e);
2649
+ z && this._exitAltScreen(), L && (this.stdinStream && typeof this.stdinStream.off == "function" && this.stdinStream.off("data", L), this.stdin && typeof this.stdin.off == "function" && this.stdin.off("data", L)), ae && this._onStdinStreamData && this.stdinStream && typeof this.stdinStream.on == "function" && this.stdinStream.on("data", this._onStdinStreamData), te && this.stdout && typeof this.stdout.off == "function" && this.stdout.off("resize", te), ne && this.stdinStream && typeof this.stdinStream.off == "function" && this.stdinStream.off("resize", ne), this._externalKeyHandler = null, this._getTermiosLflag = null;
2650
+ for (let e of Y.values()) le(e);
2578
2651
  }
2579
- ne();
2652
+ re();
2580
2653
  let he = this.arguments || [];
2581
2654
  if (!(this.result && this.result.getStdOutput && this.result.getStdOutput().length > 0) && (this.exitCode === 0 || this.exitCode === void 0)) {
2582
2655
  let t = this._ensurePkgMeta(), n = t && t.bin || (this.script || "wasm").split("/").pop(), r = Object.assign({
@@ -2585,13 +2658,13 @@ var u, d, f, p, m, h, g, _, v, y, b = e((() => {
2585
2658
  description: `WebAssembly WASI binary (${this.script})`
2586
2659
  }, t || {});
2587
2660
  if (he.includes("--help") || he.includes("-h")) {
2588
- let t = F(e);
2589
- for (let e of I(n, r, t)) this.stdOut = e;
2661
+ let t = I(e);
2662
+ for (let e of ee(n, r, t)) this.stdOut = e;
2590
2663
  } else (he.includes("--version") || he.includes("-V") || he.includes("-v")) && (this.stdOut = `${n} (${r.name} ${r.version} wasm)`);
2591
2664
  }
2592
2665
  }
2593
- }, A = /* @__PURE__ */ new Map();
2594
- function j(e, t) {
2666
+ }, j = /* @__PURE__ */ new Map();
2667
+ function M(e, t) {
2595
2668
  if (!e || !e.exists(t)) return null;
2596
2669
  if (e.isRealFilesystem) try {
2597
2670
  let n = O();
@@ -2618,7 +2691,7 @@ var u, d, f, p, m, h, g, _, v, y, b = e((() => {
2618
2691
  }
2619
2692
  return null;
2620
2693
  }
2621
- function M(e, t, n, i = "application/octet-stream") {
2694
+ function N(e, t, n, i = "application/octet-stream") {
2622
2695
  let a = n instanceof Uint8Array ? n : new Uint8Array(n);
2623
2696
  if (e && e.isRealFilesystem) {
2624
2697
  e.setFileByPath(t, a, !0);
@@ -2633,7 +2706,7 @@ var u, d, f, p, m, h, g, _, v, y, b = e((() => {
2633
2706
  }
2634
2707
  e.setFileByPath(t, s, !0);
2635
2708
  }
2636
- async function N(e, t, n = null) {
2709
+ async function P(e, t, n = null) {
2637
2710
  if (typeof n == "function") {
2638
2711
  let r = await n(e, t);
2639
2712
  if (r) return r;
@@ -2661,7 +2734,7 @@ var u, d, f, p, m, h, g, _, v, y, b = e((() => {
2661
2734
  }
2662
2735
  throw Error(`Package '${e}' could not be loaded`);
2663
2736
  }
2664
- function P(e, t = !1) {
2737
+ function F(e, t = !1) {
2665
2738
  let n = {
2666
2739
  usage: null,
2667
2740
  options: []
@@ -2678,7 +2751,7 @@ var u, d, f, p, m, h, g, _, v, y, b = e((() => {
2678
2751
  }
2679
2752
  return n;
2680
2753
  }
2681
- function F(e) {
2754
+ function I(e) {
2682
2755
  let t = {
2683
2756
  usage: null,
2684
2757
  options: [],
@@ -2703,12 +2776,12 @@ var u, d, f, p, m, h, g, _, v, y, b = e((() => {
2703
2776
  r.length >= 4 && n.push(r);
2704
2777
  let i = n.join("\n");
2705
2778
  t.isInteractive || (i.includes("/dev/tty") || i.includes("\x1B[?1049h") || i.includes("smcup") || i.includes("xterm")) && (t.isInteractive = !0);
2706
- let a = P(i, !0);
2779
+ let a = F(i, !0);
2707
2780
  t.usage = a.usage, t.options = a.options;
2708
2781
  } catch {}
2709
2782
  return t;
2710
2783
  }
2711
- function I(e, t = {}, n = null) {
2784
+ function ee(e, t = {}, n = null) {
2712
2785
  let r = t.name || e, i = t.version || "wasm", a = t.description || "WebAssembly binary", o = t && typeof t.repl == "object" ? t.repl : t.repl ? {} : null, s = n && n.usage || t.usage, c = s ? s.replace(/%s/g, e) : null, l = o ? `${e} [options] ${o.evalFlag ? `[${o.evalFlag} <code>] ` : ""}[file] [args...]` : `${e} [options] [args...]`, u = [`${e} (${r} ${i} wasm) — ${a}`, `Usage: ${c || l}`];
2713
2786
  t.details && u.push("", t.details), u.push("", "Options:");
2714
2787
  let d = n && n.options && n.options.length > 0 ? n.options : Array.isArray(t.options) ? t.options : [];
@@ -2716,7 +2789,7 @@ var u, d, f, p, m, h, g, _, v, y, b = e((() => {
2716
2789
  else o && (o.evalFlag && u.push(` ${o.evalFlag.padEnd(20)}Evaluate inline code and print result`), u.push(` (no arguments) Start interactive ${e} REPL shell`));
2717
2790
  return u.push(" -h, --help Show this help message and exit"), u.push(" -V, --version Show WebAssembly binary version and exit"), n && n.exports && n.exports.length > 0 && u.push("", `WASM Exports: ${n.exports.join(", ")}`), Array.isArray(t.aliases) && t.aliases.length > 0 && u.push("", `Aliases: ${t.aliases.join(", ")}`), (t.homepage || t.cdnUrl || t.wasmUrl) && u.push(`Source: ${t.homepage || t.cdnUrl || t.wasmUrl}`), u;
2718
2791
  }
2719
- function L(e, t = {}, n = null) {
2792
+ function te(e, t = {}, n = null) {
2720
2793
  let r = T(), i = (n || e.bin || e.name).toLowerCase();
2721
2794
  class a extends r {
2722
2795
  static get name() {
@@ -2735,7 +2808,7 @@ var u, d, f, p, m, h, g, _, v, y, b = e((() => {
2735
2808
  return this._subCommand ? !!this._subCommand.captureInput : this.interactive;
2736
2809
  }
2737
2810
  get isRaw() {
2738
- return !!(this.stdinStream && this.stdinStream.isRaw || this._subCommand && (this._subCommand.isRaw || this._subCommand.stdinStream && this._subCommand.stdinStream.isRaw));
2811
+ return this._subCommand ? !!(this._subCommand.isRaw || this._subCommand.stdinStream && this._subCommand.stdinStream.isRaw) : !!(this.stdinStream && this.stdinStream.isRaw);
2739
2812
  }
2740
2813
  get _inAltScreen() {
2741
2814
  return !!(this.__inAltScreen || this._subCommand && this._subCommand._inAltScreen);
@@ -2751,7 +2824,7 @@ var u, d, f, p, m, h, g, _, v, y, b = e((() => {
2751
2824
  }
2752
2825
  async run() {
2753
2826
  let n = [...this.arguments || []], r = n.includes("--help") || n.includes("-h"), a = !r && (n.includes("--version") || n.includes("-V") || n.includes("-v")), o = this.fs || this.context && this.context.fs;
2754
- this._inspectedWasm = null, this._persistedWasmBytes = e.wasmPath ? j(o, e.wasmPath) : null, r && this._persistedWasmBytes && this._persistedWasmBytes.byteLength > 0 && (this._inspectedWasm = F(this._persistedWasmBytes));
2827
+ this._inspectedWasm = null, this._persistedWasmBytes = e.wasmPath ? M(o, e.wasmPath) : null, r && this._persistedWasmBytes && this._persistedWasmBytes.byteLength > 0 && (this._inspectedWasm = I(this._persistedWasmBytes));
2755
2828
  try {
2756
2829
  if ((e.type === "wasm" || e.type === "custom-wasm") && (this._persistedWasmBytes || e.wasmUrl)) {
2757
2830
  let i = this._persistedWasmBytes;
@@ -2760,7 +2833,7 @@ var u, d, f, p, m, h, g, _, v, y, b = e((() => {
2760
2833
  n instanceof Uint8Array || n instanceof ArrayBuffer ? i = n instanceof Uint8Array ? n : new Uint8Array(n) : n && (n.wasmBytes || n.wasm || n.wasmBinary) && (i = n.wasmBytes || n.wasm || n.wasmBinary);
2761
2834
  } catch {}
2762
2835
  if (!i && e.wasmUrl && (i = await this._fetchWasmBytes(e.wasmUrl)), i) {
2763
- r && (this._inspectedWasm = F(i)), await this._runRawWasmBytes(i, n);
2836
+ r && (this._inspectedWasm = I(i)), await this._runRawWasmBytes(i, n);
2764
2837
  return;
2765
2838
  }
2766
2839
  } else {
@@ -2777,19 +2850,19 @@ var u, d, f, p, m, h, g, _, v, y, b = e((() => {
2777
2850
  }
2778
2851
  let c, l;
2779
2852
  try {
2780
- c = await N(e.name, o, t.moduleLoader), l = c && c.default !== void 0 ? c.default : c, l && typeof l.then == "function" && (l = await l);
2853
+ c = await P(e.name, o, t.moduleLoader), l = c && c.default !== void 0 ? c.default : c, l && typeof l.then == "function" && (l = await l);
2781
2854
  } finally {
2782
2855
  s && (globalThis.fetch = s);
2783
2856
  }
2784
2857
  if (l instanceof Uint8Array || l instanceof ArrayBuffer) {
2785
2858
  let e = l instanceof Uint8Array ? l : new Uint8Array(l);
2786
- r && (this._inspectedWasm = F(e)), await this._runRawWasmBytes(e, n);
2859
+ r && (this._inspectedWasm = I(e)), await this._runRawWasmBytes(e, n);
2787
2860
  } else if (l && (l.wasmBytes instanceof Uint8Array || l.wasm instanceof Uint8Array)) {
2788
2861
  let e = l.wasmBytes || l.wasm;
2789
- r && (this._inspectedWasm = F(e)), await this._runRawWasmBytes(e, n);
2862
+ r && (this._inspectedWasm = I(e)), await this._runRawWasmBytes(e, n);
2790
2863
  } else if (typeof l == "function") await this._runFunctionOrEmscripten(l, n, r, a);
2791
2864
  else if (l && typeof l == "object") {
2792
- l.ready && await l.ready, r && (l.HEAPU8 instanceof Uint8Array || l.wasmBinary instanceof Uint8Array) && (this._inspectedWasm = F(l.wasmBinary || l.HEAPU8));
2865
+ l.ready && await l.ready, r && (l.HEAPU8 instanceof Uint8Array || l.wasmBinary instanceof Uint8Array) && (this._inspectedWasm = I(l.wasmBinary || l.HEAPU8));
2793
2866
  let t = l.main || l.run || l.callMain || l.exec;
2794
2867
  if (typeof t == "function") await this._invokeCliFunction(t.bind(l), n);
2795
2868
  else if (l.promised || typeof l.raw == "function" || typeof l.json == "function") {
@@ -2817,29 +2890,29 @@ var u, d, f, p, m, h, g, _, v, y, b = e((() => {
2817
2890
  }
2818
2891
  }
2819
2892
  if (r || a) {
2820
- let t = this.result && this.result.getStdOutput ? this.result.getStdOutput() : [], n = t.map((e) => e.string).join("\n"), o = r ? P(n) : null, s = r && !!(o && (o.usage || o.options.length > 0) || t.some((e) => /\b(usage|options):/i.test(e.string))), c = t.filter((e) => e.type === "out").map((e) => e.string), l = a && c.length > 0 && (this.exitCode === 0 || this.exitCode === void 0);
2893
+ let t = this.result && this.result.getStdOutput ? this.result.getStdOutput() : [], n = t.map((e) => e.string).join("\n"), o = r ? F(n) : null, s = r && !!(o && (o.usage || o.options.length > 0) || t.some((e) => /\b(usage|options):/i.test(e.string))), c = t.filter((e) => e.type === "out").map((e) => e.string), l = a && c.length > 0 && (this.exitCode === 0 || this.exitCode === void 0);
2821
2894
  if (r) if (s) {
2822
2895
  let e = t.map((e) => e.string);
2823
2896
  this.result && Array.isArray(this.result.std) && (this.result.std.length = 0), this.exitCode = 0;
2824
2897
  for (let t of e) this.stdOut = t;
2825
2898
  } else {
2826
2899
  this.result && Array.isArray(this.result.std) && (this.result.std.length = 0), this.exitCode = 0;
2827
- for (let t of I(i, e, this._inspectedWasm)) this.stdOut = t;
2900
+ for (let t of ee(i, e, this._inspectedWasm)) this.stdOut = t;
2828
2901
  }
2829
2902
  else a && !l ? (this.result && Array.isArray(this.result.std) && (this.result.std.length = 0), this.exitCode = 0, this.stdOut = `${i} (${e.name} ${e.version || "wasm"} wasm)`) : this.exitCode = 0;
2830
2903
  }
2831
2904
  }
2832
2905
  async _fetchWasmBytes(e) {
2833
- if (A.has(e)) return A.get(e);
2906
+ if (j.has(e)) return j.get(e);
2834
2907
  let n = t.fetch || (typeof fetch == "function" ? fetch : null);
2835
2908
  if (!n) throw Error("fetch is not available in this environment");
2836
2909
  let r = await n(e);
2837
2910
  if (!r || !r.ok) throw Error(`HTTP ${r ? r.status : "error"} fetching ${e}`);
2838
2911
  let i = new Uint8Array(await r.arrayBuffer());
2839
- return A.set(e, i), i;
2912
+ return j.set(e, i), i;
2840
2913
  }
2841
2914
  async _runRawWasmBytes(t, n) {
2842
- let r = new k(i, n, this.context);
2915
+ let r = new A(i, n, this.context);
2843
2916
  r.script = i, r.arguments = n, r.context = this.context, r.fs = this.fs, r._pkgMeta = e, r.stdinStream = this.stdinStream, r.stdout = this.stdout, r.stderr = this.stderr, r.stdin = this.stdin && !this.stdin.isTTY ? this.stdin : this.stdinStream, this._onStdinStreamData && this.stdinStream && typeof this.stdinStream.off == "function" && this.stdinStream.off("data", this._onStdinStreamData);
2844
2917
  let a = () => {
2845
2918
  this.emit("interactive"), this.context && typeof this.context.emit == "function" && this.context.emit("interactive");
@@ -2872,13 +2945,13 @@ var u, d, f, p, m, h, g, _, v, y, b = e((() => {
2872
2945
  let n = t && t !== "." && !e.startsWith("/") ? `${t.replace(/\/+$/, "")}/${e}` : e, r = this.fs.getFileByPath(n) ?? this.fs.getFileByPath(e);
2873
2946
  return r == null ? null : typeof r == "string" ? r : new TextDecoder().decode(r);
2874
2947
  },
2875
- readBytes: (e) => j(this.fs, e),
2948
+ readBytes: (e) => M(this.fs, e),
2876
2949
  writeFile: (e, t, n) => {
2877
2950
  if (!this.fs) return;
2878
2951
  let r = n && n !== "." && !e.startsWith("/") ? `${n.replace(/\/+$/, "")}/${e}` : e;
2879
2952
  if (t instanceof Uint8Array || ArrayBuffer.isView(t)) {
2880
2953
  let e = r.endsWith(".wasm") ? "application/wasm" : "application/octet-stream";
2881
- M(this.fs, r, t, e);
2954
+ N(this.fs, r, t, e);
2882
2955
  } else this.fs.setFileByPath(r, String(t), !0);
2883
2956
  if (r.endsWith(".wasm") || r.endsWith(".wat")) try {
2884
2957
  this.fs.setMode(r, 493);
@@ -2914,7 +2987,7 @@ var u, d, f, p, m, h, g, _, v, y, b = e((() => {
2914
2987
  if (e && typeof e.status == "number") this.exitCode = e.status;
2915
2988
  else throw e;
2916
2989
  }
2917
- if (f && typeof f == "object") if (r && (f.wasmBinary instanceof Uint8Array || f.HEAPU8 instanceof Uint8Array) && (this._inspectedWasm = F(f.wasmBinary || f.HEAPU8)), typeof f.callMain == "function") {
2990
+ if (f && typeof f == "object") if (r && (f.wasmBinary instanceof Uint8Array || f.HEAPU8 instanceof Uint8Array) && (this._inspectedWasm = I(f.wasmBinary || f.HEAPU8)), typeof f.callMain == "function") {
2918
2991
  f.FS && l.size === 0 && (l = this._syncBrshToEmscriptenFs(f.FS, n));
2919
2992
  try {
2920
2993
  let e = await f.callMain(n);
@@ -2977,14 +3050,14 @@ var u, d, f, p, m, h, g, _, v, y, b = e((() => {
2977
3050
  }), !t.loaded && typeof t.load == "function" && await t.load(e.coreUrl ? { coreURL: e.coreUrl } : void 0);
2978
3051
  let a = /* @__PURE__ */ new Set(), o = [];
2979
3052
  for (let e of n) if (!e.startsWith("-") && (o.push(e), this.fs.exists(e))) {
2980
- let n = j(this.fs, e);
3053
+ let n = M(this.fs, e);
2981
3054
  n && (await t.writeFile(e, n), a.add(e));
2982
3055
  }
2983
3056
  let s = await t.exec(n);
2984
3057
  for (let e of o) if (!a.has(e)) try {
2985
3058
  if (typeof t.readFile == "function") {
2986
3059
  let n = await t.readFile(e);
2987
- n && M(this.fs, e, n);
3060
+ n && N(this.fs, e, n);
2988
3061
  }
2989
3062
  } catch {}
2990
3063
  typeof s == "number" && s !== 0 && (this.exitCode = s, i.length === 0 && r.length > 0 && i.push(...r.splice(0, r.length)));
@@ -3001,7 +3074,7 @@ var u, d, f, p, m, h, g, _, v, y, b = e((() => {
3001
3074
  let n = /* @__PURE__ */ new Set();
3002
3075
  if (!this.fs || !e || typeof e.writeFile != "function") return n;
3003
3076
  for (let r of t) if (!r.startsWith("-") && this.fs.exists(r)) {
3004
- let t = j(this.fs, r);
3077
+ let t = M(this.fs, r);
3005
3078
  if (t) try {
3006
3079
  e.writeFile(r, t), n.add(r);
3007
3080
  } catch {}
@@ -3014,7 +3087,7 @@ var u, d, f, p, m, h, g, _, v, y, b = e((() => {
3014
3087
  let t = e.readFile(r);
3015
3088
  if (t) {
3016
3089
  let e = r.endsWith(".wasm") ? "application/wasm" : "application/octet-stream";
3017
- if (M(this.fs, r, t, e), r.endsWith(".wasm") || r.endsWith(".wat")) try {
3090
+ if (N(this.fs, r, t, e), r.endsWith(".wasm") || r.endsWith(".wat")) try {
3018
3091
  this.fs.setMode(r, 493);
3019
3092
  } catch {}
3020
3093
  }
@@ -3024,10 +3097,10 @@ var u, d, f, p, m, h, g, _, v, y, b = e((() => {
3024
3097
  }
3025
3098
  return a;
3026
3099
  }
3027
- function ee(e, t) {
3100
+ function ne(e, t) {
3028
3101
  return e && (e.endsWith(".wasm") || e.endsWith(".wat")) ? !0 : t instanceof Uint8Array ? t.length >= 4 && t[0] === 0 && t[1] === 97 && t[2] === 115 && t[3] === 109 : typeof t == "string" ? t.charCodeAt(0) === 0 && t.slice(1, 4) === "asm" ? !0 : t.trimStart().startsWith("(module") : !1;
3029
3102
  }
3030
- function te(e, t) {
3103
+ function L(e, t) {
3031
3104
  if (!e || !t || typeof e.exists != "function" || typeof e.getFileByPath != "function") return null;
3032
3105
  try {
3033
3106
  let n = t.split("/").filter(Boolean);
@@ -3040,7 +3113,7 @@ var u, d, f, p, m, h, g, _, v, y, b = e((() => {
3040
3113
  } catch {}
3041
3114
  return null;
3042
3115
  }
3043
- k.isWasmFile = ee, k.readSiblingPkgMeta = te, k.readBytesFromFs = j, k.writeBytesToFs = M, k.loadModule = N, k.extractHelpFromText = P, k.inspectWasmBytes = F, k.formatWasmHelp = I, k.createGenericWasmCommand = L, k.createCommand = L, t.exports = k;
3116
+ A.isWasmFile = ne, A.readSiblingPkgMeta = L, A.readBytesFromFs = M, A.writeBytesToFs = N, A.loadModule = P, A.extractHelpFromText = F, A.inspectWasmBytes = I, A.formatWasmHelp = ee, A.createGenericWasmCommand = te, A.createCommand = te, t.exports = A;
3044
3117
  })), A = /* @__PURE__ */ t(((e, t) => {
3045
3118
  var n = T();
3046
3119
  t.exports = class extends n {
@@ -3480,81 +3553,81 @@ function F() {
3480
3553
  function I() {
3481
3554
  throw Error("clearTimeout has not been defined");
3482
3555
  }
3483
- function L(e) {
3484
- if (ne === setTimeout) return setTimeout(e, 0);
3485
- if ((ne === F || !ne) && setTimeout) return ne = setTimeout, setTimeout(e, 0);
3556
+ function ee(e) {
3557
+ if (re === setTimeout) return setTimeout(e, 0);
3558
+ if ((re === F || !re) && setTimeout) return re = setTimeout, setTimeout(e, 0);
3486
3559
  try {
3487
- return ne(e, 0);
3560
+ return re(e, 0);
3488
3561
  } catch {
3489
3562
  try {
3490
- return ne.call(null, e, 0);
3563
+ return re.call(null, e, 0);
3491
3564
  } catch {
3492
- return ne.call(this, e, 0);
3565
+ return re.call(this, e, 0);
3493
3566
  }
3494
3567
  }
3495
3568
  }
3496
- function ee(e) {
3497
- if (U === clearTimeout) return clearTimeout(e);
3498
- if ((U === I || !U) && clearTimeout) return U = clearTimeout, clearTimeout(e);
3569
+ function te(e) {
3570
+ if (H === clearTimeout) return clearTimeout(e);
3571
+ if ((H === I || !H) && clearTimeout) return H = clearTimeout, clearTimeout(e);
3499
3572
  try {
3500
- return U(e);
3573
+ return H(e);
3501
3574
  } catch {
3502
3575
  try {
3503
- return U.call(null, e);
3576
+ return H.call(null, e);
3504
3577
  } catch {
3505
- return U.call(this, e);
3578
+ return H.call(this, e);
3506
3579
  }
3507
3580
  }
3508
3581
  }
3509
- function te() {
3510
- !ie || !W || (ie = !1, W.length ? re = W.concat(re) : G = -1, re.length && R());
3582
+ function ne() {
3583
+ !ae || !U || (ae = !1, U.length ? ie = U.concat(ie) : W = -1, ie.length && L());
3511
3584
  }
3512
- function R() {
3513
- if (!ie) {
3514
- var e = L(te);
3515
- ie = !0;
3516
- for (var t = re.length; t;) {
3517
- for (W = re, re = []; ++G < t;) W && W[G].run();
3518
- G = -1, t = re.length;
3585
+ function L() {
3586
+ if (!ae) {
3587
+ var e = ee(ne);
3588
+ ae = !0;
3589
+ for (var t = ie.length; t;) {
3590
+ for (U = ie, ie = []; ++W < t;) U && U[W].run();
3591
+ W = -1, t = ie.length;
3519
3592
  }
3520
- W = null, ie = !1, ee(e);
3593
+ U = null, ae = !1, te(e);
3521
3594
  }
3522
3595
  }
3523
- function z(e, t) {
3596
+ function R(e, t) {
3524
3597
  this.fun = e, this.array = t;
3525
3598
  }
3526
- function B() {}
3527
- var V, H, ne, U, re, ie, W, G, K, q, J = e((() => {
3528
- V = { exports: {} }, H = V.exports = {}, (function() {
3599
+ function z() {}
3600
+ var B, V, re, H, ie, ae, U, W, G, K, q = e((() => {
3601
+ B = { exports: {} }, V = B.exports = {}, (function() {
3529
3602
  try {
3530
- ne = typeof setTimeout == "function" ? setTimeout : F;
3603
+ re = typeof setTimeout == "function" ? setTimeout : F;
3531
3604
  } catch {
3532
- ne = F;
3605
+ re = F;
3533
3606
  }
3534
3607
  try {
3535
- U = typeof clearTimeout == "function" ? clearTimeout : I;
3608
+ H = typeof clearTimeout == "function" ? clearTimeout : I;
3536
3609
  } catch {
3537
- U = I;
3610
+ H = I;
3538
3611
  }
3539
- })(), re = [], ie = !1, G = -1, H.nextTick = function(e) {
3612
+ })(), ie = [], ae = !1, W = -1, V.nextTick = function(e) {
3540
3613
  var t = Array(arguments.length - 1);
3541
3614
  if (arguments.length > 1) for (var n = 1; n < arguments.length; n++) t[n - 1] = arguments[n];
3542
- re.push(new z(e, t)), re.length === 1 && !ie && L(R);
3543
- }, z.prototype.run = function() {
3615
+ ie.push(new R(e, t)), ie.length === 1 && !ae && ee(L);
3616
+ }, R.prototype.run = function() {
3544
3617
  this.fun.apply(null, this.array);
3545
- }, H.title = "browser", H.browser = !0, H.env = {}, H.argv = [], H.version = "", H.versions = {}, H.on = B, H.addListener = B, H.once = B, H.off = B, H.removeListener = B, H.removeAllListeners = B, H.emit = B, H.prependListener = B, H.prependOnceListener = B, H.listeners = function(e) {
3618
+ }, V.title = "browser", V.browser = !0, V.env = {}, V.argv = [], V.version = "", V.versions = {}, V.on = z, V.addListener = z, V.once = z, V.off = z, V.removeListener = z, V.removeAllListeners = z, V.emit = z, V.prependListener = z, V.prependOnceListener = z, V.listeners = function(e) {
3546
3619
  return [];
3547
- }, H.binding = function(e) {
3620
+ }, V.binding = function(e) {
3548
3621
  throw Error("process.binding is not supported");
3549
- }, H.cwd = function() {
3622
+ }, V.cwd = function() {
3550
3623
  return "/";
3551
- }, H.chdir = function(e) {
3624
+ }, V.chdir = function(e) {
3552
3625
  throw Error("process.chdir is not supported");
3553
- }, H.umask = function() {
3626
+ }, V.umask = function() {
3554
3627
  return 0;
3555
- }, K = V.exports, q = /* @__PURE__ */ P(K);
3556
- })), Y = /* @__PURE__ */ t(((e, t) => {
3557
- b(), J();
3628
+ }, G = B.exports, K = /* @__PURE__ */ P(G);
3629
+ })), J = /* @__PURE__ */ t(((e, t) => {
3630
+ b(), q();
3558
3631
  var { BinaryFile: n, SymlinkRef: r, DeviceFile: i } = N(), a = new Uint8Array([
3559
3632
  66,
3560
3633
  82,
@@ -3693,8 +3766,8 @@ var V, H, ne, U, re, ie, W, G, K, q, J = e((() => {
3693
3766
  let t = new DecompressionStream("gzip"), n = new Blob([e]).stream().pipeThrough(t), r = await new Response(n).arrayBuffer();
3694
3767
  return new Uint8Array(r);
3695
3768
  }
3696
- if (q !== void 0 && typeof q.getBuiltinModule == "function") {
3697
- let t = q.getBuiltinModule("zlib");
3769
+ if (K !== void 0 && typeof K.getBuiltinModule == "function") {
3770
+ let t = K.getBuiltinModule("zlib");
3698
3771
  if (t) return new Uint8Array(t.gunzipSync(y.from(e.buffer, e.byteOffset, e.byteLength)));
3699
3772
  }
3700
3773
  throw Error("Gzip decompression is not supported in this environment");
@@ -3713,8 +3786,8 @@ var V, H, ne, U, re, ie, W, G, K, q, J = e((() => {
3713
3786
  return p(new Uint8Array(n), t);
3714
3787
  }
3715
3788
  if (typeof e == "string") {
3716
- if (!/^https?:\/\//i.test(e) && q !== void 0 && typeof q.getBuiltinModule == "function" && typeof window > "u") try {
3717
- let n = q.getBuiltinModule("fs");
3789
+ if (!/^https?:\/\//i.test(e) && K !== void 0 && typeof K.getBuiltinModule == "function" && typeof window > "u") try {
3790
+ let n = K.getBuiltinModule("fs");
3718
3791
  if (n && n.existsSync(e)) {
3719
3792
  let r = await n.promises.readFile(e);
3720
3793
  return p(new Uint8Array(r.buffer, r.byteOffset, r.byteLength), t);
@@ -3826,7 +3899,7 @@ var V, H, ne, U, re, ie, W, G, K, q, J = e((() => {
3826
3899
  }
3827
3900
  }
3828
3901
  };
3829
- })), X = /* @__PURE__ */ t(((e, t) => {
3902
+ })), Y = /* @__PURE__ */ t(((e, t) => {
3830
3903
  b();
3831
3904
  var n = N(), { BinaryFile: r, SymlinkRef: i, DeviceFile: a } = n;
3832
3905
  function o(e) {
@@ -3852,10 +3925,10 @@ var V, H, ne, U, re, ie, W, G, K, q, J = e((() => {
3852
3925
  t.exports = class extends n {
3853
3926
  constructor(e = "/", t = {}, n = {}, r = null) {
3854
3927
  if (super(), t instanceof Uint8Array || t instanceof ArrayBuffer) {
3855
- let { deserializeBinaryFilesystem: e } = Y(), r = e(t);
3928
+ let { deserializeBinaryFilesystem: e } = J(), r = e(t);
3856
3929
  t = r.filesystem, n = Object.assign({}, r.permissions, n);
3857
3930
  } else if (t && typeof t == "object" && t.filesystem && (t.filesystem instanceof Uint8Array || typeof t.filesystem == "object") && (n = Object.assign({}, t.permissions || {}, n), t = t.filesystem, t instanceof Uint8Array || t instanceof ArrayBuffer)) {
3858
- let { deserializeBinaryFilesystem: e } = Y(), r = e(t);
3931
+ let { deserializeBinaryFilesystem: e } = J(), r = e(t);
3859
3932
  t = r.filesystem, n = Object.assign({}, r.permissions, n);
3860
3933
  }
3861
3934
  o(t), this.fileSystem = t, this.permissions = Object.assign({}, n), this.cwd = e.endsWith("/") ? e : e + "/", this._onChange = r, this._changeScheduled = !1, this._initDevices();
@@ -3897,11 +3970,11 @@ var V, H, ne, U, re, ie, W, G, K, q, J = e((() => {
3897
3970
  }), this._devices.stdin = new i("/dev/tty"), this._devices.stdout = new i("/dev/tty"), this._devices.stderr = new i("/dev/tty");
3898
3971
  }
3899
3972
  toBinaryContainer(e = {}) {
3900
- let { serializeBinaryFilesystem: t } = Y();
3973
+ let { serializeBinaryFilesystem: t } = J();
3901
3974
  return t(this.fileSystem, this.permissions, e);
3902
3975
  }
3903
3976
  static fromBinaryContainer(e, t = {}) {
3904
- let { deserializeBinaryFilesystem: n } = Y();
3977
+ let { deserializeBinaryFilesystem: n } = J();
3905
3978
  return n(e, t);
3906
3979
  }
3907
3980
  getFileByPath(e) {
@@ -4146,8 +4219,8 @@ var V, H, ne, U, re, ie, W, G, K, q, J = e((() => {
4146
4219
  return null;
4147
4220
  }
4148
4221
  }, t.exports.BinaryFile = r, t.exports.SymlinkRef = i;
4149
- })), ae = /* @__PURE__ */ t(((e, t) => {
4150
- J();
4222
+ })), oe = /* @__PURE__ */ t(((e, t) => {
4223
+ q();
4151
4224
  function n(e) {
4152
4225
  if (typeof e != "string") throw TypeError("Path must be a string. Received " + JSON.stringify(e));
4153
4226
  }
@@ -4185,7 +4258,7 @@ var V, H, ne, U, re, ie, W, G, K, q, J = e((() => {
4185
4258
  resolve: function() {
4186
4259
  for (var e = "", t = !1, i, a = arguments.length - 1; a >= -1 && !t; a--) {
4187
4260
  var o;
4188
- a >= 0 ? o = arguments[a] : (i === void 0 && (i = q.cwd()), o = i), n(o), o.length !== 0 && (e = o + "/" + e, t = o.charCodeAt(0) === 47);
4261
+ a >= 0 ? o = arguments[a] : (i === void 0 && (i = K.cwd()), o = i), n(o), o.length !== 0 && (e = o + "/" + e, t = o.charCodeAt(0) === 47);
4189
4262
  }
4190
4263
  return e = r(e, !t), t ? e.length > 0 ? "/" + e : "/" : e.length > 0 ? e : ".";
4191
4264
  },
@@ -4314,12 +4387,12 @@ var V, H, ne, U, re, ie, W, G, K, q, J = e((() => {
4314
4387
  posix: null
4315
4388
  };
4316
4389
  a.posix = a, t.exports = a;
4317
- })), oe = /* @__PURE__ */ t(((e, t) => {
4318
- b(), J();
4319
- var r = O(), i = ae(), a = N(), { BinaryFile: o, SymlinkRef: s, isUtf8Text: c } = a;
4390
+ })), se = /* @__PURE__ */ t(((e, t) => {
4391
+ b(), q();
4392
+ var r = O(), i = oe(), a = N(), { BinaryFile: o, SymlinkRef: s, isUtf8Text: c } = a;
4320
4393
  t.exports = class extends a {
4321
4394
  constructor(e = "/", t = null, n = {}) {
4322
- super(), this._onChange = t, this._changeScheduled = !1, this._virtualFiles = {}, this._rootDir = n && n.rootDir ? i.resolve(n.rootDir) : null, this.cwd = this._normalizeCwd(e || (this._rootDir ? "/" : q.cwd()));
4395
+ super(), this._onChange = t, this._changeScheduled = !1, this._virtualFiles = {}, this._rootDir = n && n.rootDir ? i.resolve(n.rootDir) : null, this.cwd = this._normalizeCwd(e || (this._rootDir ? "/" : K.cwd()));
4323
4396
  }
4324
4397
  get isRealFilesystem() {
4325
4398
  return !0;
@@ -4602,8 +4675,8 @@ var V, H, ne, U, re, ie, W, G, K, q, J = e((() => {
4602
4675
  }
4603
4676
  }
4604
4677
  };
4605
- })), se = /* @__PURE__ */ t(((e, t) => {
4606
- var n = X();
4678
+ })), ce = /* @__PURE__ */ t(((e, t) => {
4679
+ var n = Y();
4607
4680
  t.exports = class {
4608
4681
  constructor(e) {
4609
4682
  this.options = e;
@@ -4637,7 +4710,7 @@ var V, H, ne, U, re, ie, W, G, K, q, J = e((() => {
4637
4710
  return this.fs._getFileRaw(t) || null;
4638
4711
  }
4639
4712
  setNodeFilesystem(e) {
4640
- let t = oe(), n = this.fs._onChange;
4713
+ let t = se(), n = this.fs._onChange;
4641
4714
  this.fs = new t(e, n);
4642
4715
  }
4643
4716
  setFilesystem(e, t = {}) {
@@ -4657,7 +4730,7 @@ var V, H, ne, U, re, ie, W, G, K, q, J = e((() => {
4657
4730
  typeof this._destroyFn == "function" && this._destroyFn(e);
4658
4731
  }
4659
4732
  };
4660
- })), ce = /* @__PURE__ */ t(((e, t) => {
4733
+ })), le = /* @__PURE__ */ t(((e, t) => {
4661
4734
  var r = k();
4662
4735
  t.exports = class e {
4663
4736
  static isCommandClass(e) {
@@ -4706,7 +4779,7 @@ var V, H, ne, U, re, ie, W, G, K, q, J = e((() => {
4706
4779
  return r.createGenericWasmCommand(c, { moduleLoader: async () => n }, i);
4707
4780
  }
4708
4781
  };
4709
- })), le = /* @__PURE__ */ t(((e, t) => {
4782
+ })), ue = /* @__PURE__ */ t(((e, t) => {
4710
4783
  var n = T(), r = class extends n {
4711
4784
  static get name() {
4712
4785
  return "test";
@@ -4791,7 +4864,7 @@ var V, H, ne, U, re, ie, W, G, K, q, J = e((() => {
4791
4864
  }
4792
4865
  }
4793
4866
  };
4794
- })), ue = /* @__PURE__ */ t(((e, t) => {
4867
+ })), de = /* @__PURE__ */ t(((e, t) => {
4795
4868
  var n = T();
4796
4869
  t.exports = class extends n {
4797
4870
  static get name() {
@@ -4832,7 +4905,7 @@ var V, H, ne, U, re, ie, W, G, K, q, J = e((() => {
4832
4905
  return o.forEach((e) => this.stdOut = e), Promise.resolve();
4833
4906
  }
4834
4907
  };
4835
- })), de = /* @__PURE__ */ t(((e, t) => {
4908
+ })), fe = /* @__PURE__ */ t(((e, t) => {
4836
4909
  function n(e) {
4837
4910
  return typeof e == "object" && !!e;
4838
4911
  }
@@ -4843,7 +4916,7 @@ var V, H, ne, U, re, ie, W, G, K, q, J = e((() => {
4843
4916
  return Array.isArray(e) ? e : e === void 0 ? [] : r(e) || e instanceof Set ? Array.from(e) : [e];
4844
4917
  }
4845
4918
  t.exports = i;
4846
- })), Z = /* @__PURE__ */ t(((e, t) => {
4919
+ })), X = /* @__PURE__ */ t(((e, t) => {
4847
4920
  function n(e, t, ...n) {
4848
4921
  let r = [];
4849
4922
  if (!Array.isArray(e)) throw Error("Input must be an array");
@@ -4863,7 +4936,7 @@ var V, H, ne, U, re, ie, W, G, K, q, J = e((() => {
4863
4936
  return e;
4864
4937
  }
4865
4938
  t.exports = n;
4866
- })), fe = /* @__PURE__ */ t(((e) => {
4939
+ })), pe = /* @__PURE__ */ t(((e) => {
4867
4940
  Object.defineProperty(e, "__esModule", { value: !0 });
4868
4941
  function t(e) {
4869
4942
  return !isNaN(parseFloat(e));
@@ -4942,25 +5015,25 @@ var V, H, ne, U, re, ie, W, G, K, q, J = e((() => {
4942
5015
  isFunction: h,
4943
5016
  isAsyncFunction: g
4944
5017
  }, e.isArrayLike = i, e.isAsyncFunction = g, e.isClass = u, e.isDefined = o, e.isDefinedValue = l, e.isFiniteNumber = n, e.isFunction = h, e.isIterable = p, e.isNull = c, e.isNumber = t, e.isObject = a, e.isPlainObject = r, e.isPrimitive = d, e.isPromise = f, e.isString = m, e.isUndefined = s;
4945
- })), pe, me = e((() => {
4946
- pe = globalThis || self;
5018
+ })), me, Z = e((() => {
5019
+ me = globalThis || self;
4947
5020
  })), he = /* @__PURE__ */ t(((e, t) => {
4948
- me();
4949
- var n = Infinity, r = "[object Symbol]", i = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g, a = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g, o = "\\ud800-\\udfff", s = "\\u0300-\\u036f\\ufe20-\\ufe23", c = "\\u20d0-\\u20f0", l = "\\u2700-\\u27bf", u = "a-z\\xdf-\\xf6\\xf8-\\xff", d = "\\xac\\xb1\\xd7\\xf7", f = "\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf", p = "\\u2000-\\u206f", m = " \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000", h = "A-Z\\xc0-\\xd6\\xd8-\\xde", g = "\\ufe0e\\ufe0f", _ = d + f + p + m, v = "['’]", y = "[" + o + "]", b = "[" + _ + "]", x = "[" + s + c + "]", S = "\\d+", C = "[" + l + "]", w = "[" + u + "]", T = "[^" + o + _ + S + l + u + h + "]", E = "\\ud83c[\\udffb-\\udfff]", D = "(?:" + x + "|" + E + ")", O = "[^" + o + "]", k = "(?:\\ud83c[\\udde6-\\uddff]){2}", A = "[\\ud800-\\udbff][\\udc00-\\udfff]", j = "[" + h + "]", M = "\\u200d", N = "(?:" + w + "|" + T + ")", P = "(?:" + j + "|" + T + ")", F = "(?:" + v + "(?:d|ll|m|re|s|t|ve))?", I = "(?:" + v + "(?:D|LL|M|RE|S|T|VE))?", L = D + "?", ee = "[" + g + "]?", te = "(?:" + M + "(?:" + [
5021
+ Z();
5022
+ var n = Infinity, r = "[object Symbol]", i = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g, a = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g, o = "\\ud800-\\udfff", s = "\\u0300-\\u036f\\ufe20-\\ufe23", c = "\\u20d0-\\u20f0", l = "\\u2700-\\u27bf", u = "a-z\\xdf-\\xf6\\xf8-\\xff", d = "\\xac\\xb1\\xd7\\xf7", f = "\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf", p = "\\u2000-\\u206f", m = " \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000", h = "A-Z\\xc0-\\xd6\\xd8-\\xde", g = "\\ufe0e\\ufe0f", _ = d + f + p + m, v = "['’]", y = "[" + o + "]", b = "[" + _ + "]", x = "[" + s + c + "]", S = "\\d+", C = "[" + l + "]", w = "[" + u + "]", T = "[^" + o + _ + S + l + u + h + "]", E = "\\ud83c[\\udffb-\\udfff]", D = "(?:" + x + "|" + E + ")", O = "[^" + o + "]", k = "(?:\\ud83c[\\udde6-\\uddff]){2}", A = "[\\ud800-\\udbff][\\udc00-\\udfff]", j = "[" + h + "]", M = "\\u200d", N = "(?:" + w + "|" + T + ")", P = "(?:" + j + "|" + T + ")", F = "(?:" + v + "(?:d|ll|m|re|s|t|ve))?", I = "(?:" + v + "(?:D|LL|M|RE|S|T|VE))?", ee = D + "?", te = "[" + g + "]?", ne = "(?:" + M + "(?:" + [
4950
5023
  O,
4951
5024
  k,
4952
5025
  A
4953
- ].join("|") + ")" + ee + L + ")*", R = ee + L + te, z = "(?:" + [
5026
+ ].join("|") + ")" + te + ee + ")*", L = te + ee + ne, R = "(?:" + [
4954
5027
  C,
4955
5028
  k,
4956
5029
  A
4957
- ].join("|") + ")" + R, B = "(?:" + [
5030
+ ].join("|") + ")" + L, z = "(?:" + [
4958
5031
  O + x + "?",
4959
5032
  x,
4960
5033
  k,
4961
5034
  A,
4962
5035
  y
4963
- ].join("|") + ")", V = RegExp(v, "g"), H = RegExp(x, "g"), ne = RegExp(E + "(?=" + E + ")|" + B + R, "g"), U = RegExp([
5036
+ ].join("|") + ")", B = RegExp(v, "g"), V = RegExp(x, "g"), re = RegExp(E + "(?=" + E + ")|" + z + L, "g"), H = RegExp([
4964
5037
  j + "?" + w + "+" + F + "(?=" + [
4965
5038
  b,
4966
5039
  j,
@@ -4974,8 +5047,8 @@ var V, H, ne, U, re, ie, W, G, K, q, J = e((() => {
4974
5047
  j + "?" + N + "+" + F,
4975
5048
  j + "+" + I,
4976
5049
  S,
4977
- z
4978
- ].join("|"), "g"), re = RegExp("[" + M + o + s + c + g + "]"), ie = /[a-z][A-Z]|[A-Z]{2,}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/, W = {
5050
+ R
5051
+ ].join("|"), "g"), ie = RegExp("[" + M + o + s + c + g + "]"), ae = /[a-z][A-Z]|[A-Z]{2,}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/, U = {
4979
5052
  À: "A",
4980
5053
  Á: "A",
4981
5054
  Â: "A",
@@ -5166,40 +5239,40 @@ var V, H, ne, U, re, ie, W, G, K, q, J = e((() => {
5166
5239
  œ: "oe",
5167
5240
  ʼn: "'n",
5168
5241
  ſ: "ss"
5169
- }, G = typeof pe == "object" && pe && pe.Object === Object && pe, K = typeof self == "object" && self && self.Object === Object && self, q = G || K || Function("return this")();
5170
- function J(e, t, n, r) {
5242
+ }, W = typeof me == "object" && me && me.Object === Object && me, G = typeof self == "object" && self && self.Object === Object && self, K = W || G || Function("return this")();
5243
+ function q(e, t, n, r) {
5171
5244
  var i = -1, a = e ? e.length : 0;
5172
5245
  for (r && a && (n = e[++i]); ++i < a;) n = t(n, e[i], i, e);
5173
5246
  return n;
5174
5247
  }
5175
- function Y(e) {
5248
+ function J(e) {
5176
5249
  return e.split("");
5177
5250
  }
5178
- function X(e) {
5251
+ function Y(e) {
5179
5252
  return e.match(i) || [];
5180
5253
  }
5181
- function ae(e) {
5254
+ function oe(e) {
5182
5255
  return function(t) {
5183
5256
  return e?.[t];
5184
5257
  };
5185
5258
  }
5186
- var oe = ae(W);
5187
- function se(e) {
5188
- return re.test(e);
5189
- }
5259
+ var se = oe(U);
5190
5260
  function ce(e) {
5191
5261
  return ie.test(e);
5192
5262
  }
5193
5263
  function le(e) {
5194
- return se(e) ? ue(e) : Y(e);
5264
+ return ae.test(e);
5195
5265
  }
5196
5266
  function ue(e) {
5197
- return e.match(ne) || [];
5267
+ return ce(e) ? de(e) : J(e);
5198
5268
  }
5199
5269
  function de(e) {
5200
- return e.match(U) || [];
5270
+ return e.match(re) || [];
5271
+ }
5272
+ function fe(e) {
5273
+ return e.match(H) || [];
5201
5274
  }
5202
- var Z = Object.prototype.toString, fe = q.Symbol, he = fe ? fe.prototype : void 0, ge = he ? he.toString : void 0;
5275
+ var X = Object.prototype.toString, pe = K.Symbol, he = pe ? pe.prototype : void 0, ge = he ? he.toString : void 0;
5203
5276
  function _e(e, t, n) {
5204
5277
  var r = -1, i = e.length;
5205
5278
  t < 0 && (t = -t > i ? 0 : i + t), n = n > i ? i : n, n < 0 && (n += i), i = t > n ? 0 : n - t >>> 0, t >>>= 0;
@@ -5219,20 +5292,20 @@ var V, H, ne, U, re, ie, W, G, K, q, J = e((() => {
5219
5292
  function be(e) {
5220
5293
  return function(t) {
5221
5294
  t = we(t);
5222
- var n = se(t) ? le(t) : void 0, r = n ? n[0] : t.charAt(0), i = n ? ye(n, 1).join("") : t.slice(1);
5295
+ var n = ce(t) ? ue(t) : void 0, r = n ? n[0] : t.charAt(0), i = n ? ye(n, 1).join("") : t.slice(1);
5223
5296
  return r[e]() + i;
5224
5297
  };
5225
5298
  }
5226
5299
  function xe(e) {
5227
5300
  return function(t) {
5228
- return J(ke(De(t).replace(V, "")), e, "");
5301
+ return q(ke(De(t).replace(B, "")), e, "");
5229
5302
  };
5230
5303
  }
5231
5304
  function Se(e) {
5232
5305
  return !!e && typeof e == "object";
5233
5306
  }
5234
5307
  function Ce(e) {
5235
- return typeof e == "symbol" || Se(e) && Z.call(e) == r;
5308
+ return typeof e == "symbol" || Se(e) && X.call(e) == r;
5236
5309
  }
5237
5310
  function we(e) {
5238
5311
  return e == null ? "" : ve(e);
@@ -5244,26 +5317,26 @@ var V, H, ne, U, re, ie, W, G, K, q, J = e((() => {
5244
5317
  return Oe(we(e).toLowerCase());
5245
5318
  }
5246
5319
  function De(e) {
5247
- return e = we(e), e && e.replace(a, oe).replace(H, "");
5320
+ return e = we(e), e && e.replace(a, se).replace(V, "");
5248
5321
  }
5249
5322
  var Oe = be("toUpperCase");
5250
5323
  function ke(e, t, n) {
5251
- return e = we(e), t = n ? void 0 : t, t === void 0 ? ce(e) ? de(e) : X(e) : e.match(t) || [];
5324
+ return e = we(e), t = n ? void 0 : t, t === void 0 ? le(e) ? fe(e) : Y(e) : e.match(t) || [];
5252
5325
  }
5253
5326
  t.exports = Te;
5254
5327
  })), ge = /* @__PURE__ */ t(((e, t) => {
5255
- J();
5256
- var n = de(), r = Z(), i = fe(), a = he(), o = {
5328
+ q();
5329
+ var n = fe(), r = X(), i = pe(), a = he(), o = {
5257
5330
  short: /^-([^\d-])$/,
5258
5331
  long: /^--(\S+)/,
5259
5332
  combinedShort: /^-[^\d-]{2,}$/,
5260
5333
  optEquals: /^(--\S+?)=(.*)/
5261
5334
  }, s = class extends Array {
5262
5335
  load(e) {
5263
- if (this.clear(), e && e !== q.argv) e = n(e);
5336
+ if (this.clear(), e && e !== K.argv) e = n(e);
5264
5337
  else {
5265
- e = q.argv.slice(0);
5266
- let t = q.execArgv.some(m) ? 1 : 2;
5338
+ e = K.argv.slice(0);
5339
+ let t = K.execArgv.some(m) ? 1 : 2;
5267
5340
  e.splice(0, t);
5268
5341
  }
5269
5342
  e.forEach((e) => this.push(String(e)));
@@ -5873,9 +5946,9 @@ var V, H, ne, U, re, ie, W, G, K, q, J = e((() => {
5873
5946
  }
5874
5947
  };
5875
5948
  })), Ce = /* @__PURE__ */ t(((e, t) => {
5876
- var { Test: n, TestBracket: r } = le();
5949
+ var { Test: n, TestBracket: r } = ue();
5877
5950
  t.exports = [
5878
- ue(),
5951
+ de(),
5879
5952
  _e(),
5880
5953
  ve(),
5881
5954
  ye(),
@@ -6218,7 +6291,7 @@ var V, H, ne, U, re, ie, W, G, K, q, J = e((() => {
6218
6291
  continue;
6219
6292
  }
6220
6293
  try {
6221
- let e = ae();
6294
+ let e = oe();
6222
6295
  r.mkdirSync(e.dirname(i), { recursive: !0 }), r.renameSync(n, i);
6223
6296
  } catch (n) {
6224
6297
  this.stdErr = `mv: cannot move '${e}' to '${t}': ${n.message}`, this.exitCode = 1;
@@ -6683,7 +6756,7 @@ var V, H, ne, U, re, ie, W, G, K, q, J = e((() => {
6683
6756
  let e = new TextDecoder().decode(t);
6684
6757
  this.fs.setFileByPath(s, e, !0);
6685
6758
  } else {
6686
- let { BinaryFile: e } = X(), r = e ? new e(t.buffer, n || "application/octet-stream") : t;
6759
+ let { BinaryFile: e } = Y(), r = e ? new e(t.buffer, n || "application/octet-stream") : t;
6687
6760
  this.fs.setFileByPath(s, r, !0);
6688
6761
  }
6689
6762
  } catch (e) {
@@ -7151,15 +7224,15 @@ var V, H, ne, U, re, ie, W, G, K, q, J = e((() => {
7151
7224
  "%URIErrorPrototype%": ["URIError", "prototype"],
7152
7225
  "%WeakMapPrototype%": ["WeakMap", "prototype"],
7153
7226
  "%WeakSetPrototype%": ["WeakSet", "prototype"]
7154
- }, F = ht(), I = Ct(), L = F.call(k, Array.prototype.concat), ee = F.call(O, Array.prototype.splice), te = F.call(k, String.prototype.replace), R = F.call(k, String.prototype.slice), z = F.call(k, RegExp.prototype.exec), B = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g, V = /\\(\\)?/g, H = function(e) {
7155
- var t = R(e, 0, 1), n = R(e, -1);
7227
+ }, F = ht(), I = Ct(), ee = F.call(k, Array.prototype.concat), te = F.call(O, Array.prototype.splice), ne = F.call(k, String.prototype.replace), L = F.call(k, String.prototype.slice), R = F.call(k, RegExp.prototype.exec), z = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g, B = /\\(\\)?/g, V = function(e) {
7228
+ var t = L(e, 0, 1), n = L(e, -1);
7156
7229
  if (t === "%" && n !== "%") throw new c("invalid intrinsic syntax, expected closing `%`");
7157
7230
  if (n === "%" && t !== "%") throw new c("invalid intrinsic syntax, expected opening `%`");
7158
7231
  var r = [];
7159
- return te(e, B, function(e, t, n, i) {
7160
- r[r.length] = n ? te(i, V, "$1") : t || e;
7232
+ return ne(e, z, function(e, t, n, i) {
7233
+ r[r.length] = n ? ne(i, B, "$1") : t || e;
7161
7234
  }), r;
7162
- }, ne = function(e, t) {
7235
+ }, re = function(e, t) {
7163
7236
  var n = e, r;
7164
7237
  if (I(P, n) && (r = P[n], n = "%" + r[0] + "%"), I(M, n)) {
7165
7238
  var i = M[n];
@@ -7175,11 +7248,11 @@ var V, H, ne, U, re, ie, W, G, K, q, J = e((() => {
7175
7248
  t.exports = function(e, t) {
7176
7249
  if (typeof e != "string" || e.length === 0) throw new l("intrinsic name must be a non-empty string");
7177
7250
  if (arguments.length > 1 && typeof t != "boolean") throw new l("\"allowMissing\" argument must be a boolean");
7178
- if (z(/^%?[^%]*%?$/, e) === null) throw new c("`%` may not be present anywhere but at the beginning and end of the intrinsic name");
7179
- var n = H(e), r = n.length > 0 ? n[0] : "", i = ne("%" + r + "%", t), a = i.name, o = i.value, s = !1, u = i.alias;
7180
- u && (r = u[0], ee(n, L([0, 1], u)));
7251
+ if (R(/^%?[^%]*%?$/, e) === null) throw new c("`%` may not be present anywhere but at the beginning and end of the intrinsic name");
7252
+ var n = V(e), r = n.length > 0 ? n[0] : "", i = re("%" + r + "%", t), a = i.name, o = i.value, s = !1, u = i.alias;
7253
+ u && (r = u[0], te(n, ee([0, 1], u)));
7181
7254
  for (var d = 1, f = !0; d < n.length; d += 1) {
7182
- var p = n[d], m = R(p, 0, 1), h = R(p, -1);
7255
+ var p = n[d], m = L(p, 0, 1), h = L(p, -1);
7183
7256
  if ((m === "\"" || m === "'" || m === "`" || h === "\"" || h === "'" || h === "`") && m !== h) throw new c("property names with quotes must have matching quotes");
7184
7257
  if ((p === "constructor" || !f) && (s = !0), r += "." + p, a = "%" + r + "%", I(M, a)) o = M[a];
7185
7258
  else if (o != null) {
@@ -7377,7 +7450,7 @@ var V, H, ne, U, re, ie, W, G, K, q, J = e((() => {
7377
7450
  })), Lt = /* @__PURE__ */ t(((e, t) => {
7378
7451
  t.exports = {};
7379
7452
  })), Rt = /* @__PURE__ */ t(((e, t) => {
7380
- me();
7453
+ Z();
7381
7454
  var n = typeof Map == "function" && Map.prototype, r = Object.getOwnPropertyDescriptor && n ? Object.getOwnPropertyDescriptor(Map.prototype, "size") : null, i = n && r && typeof r.get == "function" ? r.get : null, a = n && Map.prototype.forEach, o = typeof Set == "function" && Set.prototype, s = Object.getOwnPropertyDescriptor && o ? Object.getOwnPropertyDescriptor(Set.prototype, "size") : null, c = o && s && typeof s.get == "function" ? s.get : null, l = o && Set.prototype.forEach, u = typeof WeakMap == "function" && WeakMap.prototype ? WeakMap.prototype.has : null, d = typeof WeakSet == "function" && WeakSet.prototype ? WeakSet.prototype.has : null, f = typeof WeakRef == "function" && WeakRef.prototype ? WeakRef.prototype.deref : null, p = Boolean.prototype.valueOf, m = Object.prototype.toString, h = Function.prototype.toString, g = String.prototype.match, _ = String.prototype.slice, v = String.prototype.replace, y = String.prototype.toUpperCase, b = String.prototype.toLowerCase, x = RegExp.prototype.test, S = Array.prototype.concat, C = Array.prototype.join, w = Array.prototype.slice, T = Math.floor, E = typeof BigInt == "function" ? BigInt.prototype.valueOf : null, D = Object.getOwnPropertySymbols, O = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? Symbol.prototype.toString : null, k = typeof Symbol == "function" && typeof Symbol.iterator == "object", A = typeof Symbol == "function" && Symbol.toStringTag ? Symbol.toStringTag : null, j = Object.prototype.propertyIsEnumerable, M = (typeof Reflect == "function" ? Reflect.getPrototypeOf : Object.getPrototypeOf) || ([].__proto__ === Array.prototype ? function(e) {
7382
7455
  return e.__proto__;
7383
7456
  } : null);
@@ -7393,28 +7466,28 @@ var V, H, ne, U, re, ie, W, G, K, q, J = e((() => {
7393
7466
  }
7394
7467
  return v.call(t, n, "$&_");
7395
7468
  }
7396
- var P = Lt(), F = P.custom, I = W(F) ? F : null, L = {
7469
+ var P = Lt(), F = P.custom, I = U(F) ? F : null, ee = {
7397
7470
  __proto__: null,
7398
7471
  double: "\"",
7399
7472
  single: "'"
7400
- }, ee = {
7473
+ }, te = {
7401
7474
  __proto__: null,
7402
7475
  double: /(["\\])/g,
7403
7476
  single: /(['\\])/g
7404
7477
  };
7405
7478
  t.exports = function e(t, n, r, o) {
7406
7479
  var s = n || {};
7407
- if (q(s, "quoteStyle") && !q(L, s.quoteStyle)) throw TypeError("option \"quoteStyle\" must be \"single\" or \"double\"");
7408
- if (q(s, "maxStringLength") && (typeof s.maxStringLength == "number" ? s.maxStringLength < 0 && s.maxStringLength !== Infinity : s.maxStringLength !== null)) throw TypeError("option \"maxStringLength\", if provided, must be a positive integer, Infinity, or `null`");
7409
- var u = q(s, "customInspect") ? s.customInspect : !0;
7480
+ if (K(s, "quoteStyle") && !K(ee, s.quoteStyle)) throw TypeError("option \"quoteStyle\" must be \"single\" or \"double\"");
7481
+ if (K(s, "maxStringLength") && (typeof s.maxStringLength == "number" ? s.maxStringLength < 0 && s.maxStringLength !== Infinity : s.maxStringLength !== null)) throw TypeError("option \"maxStringLength\", if provided, must be a positive integer, Infinity, or `null`");
7482
+ var u = K(s, "customInspect") ? s.customInspect : !0;
7410
7483
  if (typeof u != "boolean" && u !== "symbol") throw TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");
7411
- if (q(s, "indent") && s.indent !== null && s.indent !== " " && !(parseInt(s.indent, 10) === s.indent && s.indent > 0)) throw TypeError("option \"indent\" must be \"\\t\", an integer > 0, or `null`");
7412
- if (q(s, "numericSeparator") && typeof s.numericSeparator != "boolean") throw TypeError("option \"numericSeparator\", if provided, must be `true` or `false`");
7484
+ if (K(s, "indent") && s.indent !== null && s.indent !== " " && !(parseInt(s.indent, 10) === s.indent && s.indent > 0)) throw TypeError("option \"indent\" must be \"\\t\", an integer > 0, or `null`");
7485
+ if (K(s, "numericSeparator") && typeof s.numericSeparator != "boolean") throw TypeError("option \"numericSeparator\", if provided, must be `true` or `false`");
7413
7486
  var d = s.numericSeparator;
7414
7487
  if (t === void 0) return "undefined";
7415
7488
  if (t === null) return "null";
7416
7489
  if (typeof t == "boolean") return t ? "true" : "false";
7417
- if (typeof t == "string") return de(t, s);
7490
+ if (typeof t == "string") return fe(t, s);
7418
7491
  if (typeof t == "number") {
7419
7492
  if (t === 0) return Infinity / t > 0 ? "0" : "-0";
7420
7493
  var f = String(t);
@@ -7425,101 +7498,101 @@ var V, H, ne, U, re, ie, W, G, K, q, J = e((() => {
7425
7498
  return d ? N(t, m) : m;
7426
7499
  }
7427
7500
  var h = s.depth === void 0 ? 5 : s.depth;
7428
- if (r === void 0 && (r = 0), r >= h && h > 0 && typeof t == "object") return B(t) ? "[Array]" : "[Object]";
7501
+ if (r === void 0 && (r = 0), r >= h && h > 0 && typeof t == "object") return z(t) ? "[Array]" : "[Object]";
7429
7502
  var g = ve(s, r);
7430
7503
  if (o === void 0) o = [];
7431
- else if (X(o, t) >= 0) return "[Circular]";
7504
+ else if (Y(o, t) >= 0) return "[Circular]";
7432
7505
  function y(t, n, i) {
7433
7506
  if (n && (o = w.call(o), o.push(n)), i) {
7434
7507
  var a = { depth: s.depth };
7435
- return q(s, "quoteStyle") && (a.quoteStyle = s.quoteStyle), e(t, a, r + 1, o);
7508
+ return K(s, "quoteStyle") && (a.quoteStyle = s.quoteStyle), e(t, a, r + 1, o);
7436
7509
  }
7437
7510
  return e(t, s, r + 1, o);
7438
7511
  }
7439
- if (typeof t == "function" && !H(t)) {
7440
- var x = Y(t), T = be(t, y);
7512
+ if (typeof t == "function" && !V(t)) {
7513
+ var x = J(t), T = be(t, y);
7441
7514
  return "[Function" + (x ? ": " + x : " (anonymous)") + "]" + (T.length > 0 ? " { " + C.call(T, ", ") + " }" : "");
7442
7515
  }
7443
- if (W(t)) {
7516
+ if (U(t)) {
7444
7517
  var D = k ? v.call(String(t), /^(Symbol\(.*\))_[^)]*$/, "$1") : O.call(t);
7445
- return typeof t == "object" && !k ? fe(D) : D;
7518
+ return typeof t == "object" && !k ? pe(D) : D;
7446
7519
  }
7447
- if (ue(t)) {
7448
- for (var F = "<" + b.call(String(t.nodeName)), ee = t.attributes || [], z = 0; z < ee.length; z++) F += " " + ee[z].name + "=" + te(R(ee[z].value), "double", s);
7520
+ if (de(t)) {
7521
+ for (var F = "<" + b.call(String(t.nodeName)), te = t.attributes || [], R = 0; R < te.length; R++) F += " " + te[R].name + "=" + ne(L(te[R].value), "double", s);
7449
7522
  return F += ">", t.childNodes && t.childNodes.length && (F += "..."), F += "</" + b.call(String(t.nodeName)) + ">", F;
7450
7523
  }
7451
- if (B(t)) {
7524
+ if (z(t)) {
7452
7525
  if (t.length === 0) return "[]";
7453
- var K = be(t, y);
7454
- return g && !_e(K) ? "[" + ye(K, g) + "]" : "[ " + C.call(K, ", ") + " ]";
7526
+ var G = be(t, y);
7527
+ return g && !_e(G) ? "[" + ye(G, g) + "]" : "[ " + C.call(G, ", ") + " ]";
7455
7528
  }
7456
- if (ne(t)) {
7457
- var Z = be(t, y);
7458
- return !("cause" in Error.prototype) && "cause" in t && !j.call(t, "cause") ? "{ [" + String(t) + "] " + C.call(S.call("[cause]: " + y(t.cause), Z), ", ") + " }" : Z.length === 0 ? "[" + String(t) + "]" : "{ [" + String(t) + "] " + C.call(Z, ", ") + " }";
7529
+ if (re(t)) {
7530
+ var X = be(t, y);
7531
+ return !("cause" in Error.prototype) && "cause" in t && !j.call(t, "cause") ? "{ [" + String(t) + "] " + C.call(S.call("[cause]: " + y(t.cause), X), ", ") + " }" : X.length === 0 ? "[" + String(t) + "]" : "{ [" + String(t) + "] " + C.call(X, ", ") + " }";
7459
7532
  }
7460
7533
  if (typeof t == "object" && u) {
7461
7534
  if (I && typeof t[I] == "function" && P) return P(t, { depth: h - r });
7462
7535
  if (u !== "symbol" && typeof t.inspect == "function") return t.inspect();
7463
7536
  }
7464
- if (ae(t)) {
7465
- var me = [];
7537
+ if (oe(t)) {
7538
+ var Z = [];
7466
7539
  return a && a.call(t, function(e, n) {
7467
- me.push(y(n, t, !0) + " => " + y(e, t));
7468
- }), ge("Map", i.call(t), me, g);
7540
+ Z.push(y(n, t, !0) + " => " + y(e, t));
7541
+ }), ge("Map", i.call(t), Z, g);
7469
7542
  }
7470
- if (ce(t)) {
7543
+ if (le(t)) {
7471
7544
  var xe = [];
7472
7545
  return l && l.call(t, function(e) {
7473
7546
  xe.push(y(e, t));
7474
7547
  }), ge("Set", c.call(t), xe, g);
7475
7548
  }
7476
- if (oe(t)) return he("WeakMap");
7477
- if (le(t)) return he("WeakSet");
7478
- if (se(t)) return he("WeakRef");
7479
- if (re(t)) return fe(y(Number(t)));
7480
- if (G(t)) return fe(y(E.call(t)));
7481
- if (ie(t)) return fe(p.call(t));
7482
- if (U(t)) return fe(y(String(t)));
7549
+ if (se(t)) return he("WeakMap");
7550
+ if (ue(t)) return he("WeakSet");
7551
+ if (ce(t)) return he("WeakRef");
7552
+ if (ie(t)) return pe(y(Number(t)));
7553
+ if (W(t)) return pe(y(E.call(t)));
7554
+ if (ae(t)) return pe(p.call(t));
7555
+ if (H(t)) return pe(y(String(t)));
7483
7556
  if (typeof window < "u" && t === window) return "{ [object Window] }";
7484
- if (typeof globalThis < "u" && t === globalThis || pe !== void 0 && t === pe) return "{ [object globalThis] }";
7485
- if (!V(t) && !H(t)) {
7486
- var Se = be(t, y), Ce = M ? M(t) === Object.prototype : t instanceof Object || t.constructor === Object, we = t instanceof Object ? "" : "null prototype", Te = !Ce && A && Object(t) === t && A in t ? _.call(J(t), 8, -1) : we ? "Object" : "", Ee = (Ce || typeof t.constructor != "function" ? "" : t.constructor.name ? t.constructor.name + " " : "") + (Te || we ? "[" + C.call(S.call([], Te || [], we || []), ": ") + "] " : "");
7557
+ if (typeof globalThis < "u" && t === globalThis || me !== void 0 && t === me) return "{ [object globalThis] }";
7558
+ if (!B(t) && !V(t)) {
7559
+ var Se = be(t, y), Ce = M ? M(t) === Object.prototype : t instanceof Object || t.constructor === Object, we = t instanceof Object ? "" : "null prototype", Te = !Ce && A && Object(t) === t && A in t ? _.call(q(t), 8, -1) : we ? "Object" : "", Ee = (Ce || typeof t.constructor != "function" ? "" : t.constructor.name ? t.constructor.name + " " : "") + (Te || we ? "[" + C.call(S.call([], Te || [], we || []), ": ") + "] " : "");
7487
7560
  return Se.length === 0 ? Ee + "{}" : g ? Ee + "{" + ye(Se, g) + "}" : Ee + "{ " + C.call(Se, ", ") + " }";
7488
7561
  }
7489
7562
  return String(t);
7490
7563
  };
7491
- function te(e, t, n) {
7492
- var r = L[n.quoteStyle || t];
7564
+ function ne(e, t, n) {
7565
+ var r = ee[n.quoteStyle || t];
7493
7566
  return r + e + r;
7494
7567
  }
7495
- function R(e) {
7568
+ function L(e) {
7496
7569
  return v.call(String(e), /"/g, "&quot;");
7497
7570
  }
7498
- function z(e) {
7571
+ function R(e) {
7499
7572
  return !A || !(typeof e == "object" && (A in e || e[A] !== void 0));
7500
7573
  }
7574
+ function z(e) {
7575
+ return q(e) === "[object Array]" && R(e);
7576
+ }
7501
7577
  function B(e) {
7502
- return J(e) === "[object Array]" && z(e);
7578
+ return q(e) === "[object Date]" && R(e);
7503
7579
  }
7504
7580
  function V(e) {
7505
- return J(e) === "[object Date]" && z(e);
7506
- }
7507
- function H(e) {
7508
- return J(e) === "[object RegExp]" && z(e);
7509
- }
7510
- function ne(e) {
7511
- return J(e) === "[object Error]" && z(e);
7512
- }
7513
- function U(e) {
7514
- return J(e) === "[object String]" && z(e);
7581
+ return q(e) === "[object RegExp]" && R(e);
7515
7582
  }
7516
7583
  function re(e) {
7517
- return J(e) === "[object Number]" && z(e);
7584
+ return q(e) === "[object Error]" && R(e);
7585
+ }
7586
+ function H(e) {
7587
+ return q(e) === "[object String]" && R(e);
7518
7588
  }
7519
7589
  function ie(e) {
7520
- return J(e) === "[object Boolean]" && z(e);
7590
+ return q(e) === "[object Number]" && R(e);
7521
7591
  }
7522
- function W(e) {
7592
+ function ae(e) {
7593
+ return q(e) === "[object Boolean]" && R(e);
7594
+ }
7595
+ function U(e) {
7523
7596
  if (k) return e && typeof e == "object" && e instanceof Symbol;
7524
7597
  if (typeof e == "symbol") return !0;
7525
7598
  if (!e || typeof e != "object" || !O) return !1;
@@ -7528,33 +7601,33 @@ var V, H, ne, U, re, ie, W, G, K, q, J = e((() => {
7528
7601
  } catch {}
7529
7602
  return !1;
7530
7603
  }
7531
- function G(e) {
7604
+ function W(e) {
7532
7605
  if (!e || typeof e != "object" || !E) return !1;
7533
7606
  try {
7534
7607
  return E.call(e), !0;
7535
7608
  } catch {}
7536
7609
  return !1;
7537
7610
  }
7538
- var K = Object.prototype.hasOwnProperty || function(e) {
7611
+ var G = Object.prototype.hasOwnProperty || function(e) {
7539
7612
  return e in this;
7540
7613
  };
7541
- function q(e, t) {
7542
- return K.call(e, t);
7614
+ function K(e, t) {
7615
+ return G.call(e, t);
7543
7616
  }
7544
- function J(e) {
7617
+ function q(e) {
7545
7618
  return m.call(e);
7546
7619
  }
7547
- function Y(e) {
7620
+ function J(e) {
7548
7621
  if (e.name) return e.name;
7549
7622
  var t = g.call(h.call(e), /^function\s*([\w$]+)/);
7550
7623
  return t ? t[1] : null;
7551
7624
  }
7552
- function X(e, t) {
7625
+ function Y(e, t) {
7553
7626
  if (e.indexOf) return e.indexOf(t);
7554
7627
  for (var n = 0, r = e.length; n < r; n++) if (e[n] === t) return n;
7555
7628
  return -1;
7556
7629
  }
7557
- function ae(e) {
7630
+ function oe(e) {
7558
7631
  if (!i || !e || typeof e != "object") return !1;
7559
7632
  try {
7560
7633
  i.call(e);
@@ -7567,7 +7640,7 @@ var V, H, ne, U, re, ie, W, G, K, q, J = e((() => {
7567
7640
  } catch {}
7568
7641
  return !1;
7569
7642
  }
7570
- function oe(e) {
7643
+ function se(e) {
7571
7644
  if (!u || !e || typeof e != "object") return !1;
7572
7645
  try {
7573
7646
  u.call(e, u);
@@ -7580,14 +7653,14 @@ var V, H, ne, U, re, ie, W, G, K, q, J = e((() => {
7580
7653
  } catch {}
7581
7654
  return !1;
7582
7655
  }
7583
- function se(e) {
7656
+ function ce(e) {
7584
7657
  if (!f || !e || typeof e != "object") return !1;
7585
7658
  try {
7586
7659
  return f.call(e), !0;
7587
7660
  } catch {}
7588
7661
  return !1;
7589
7662
  }
7590
- function ce(e) {
7663
+ function le(e) {
7591
7664
  if (!c || !e || typeof e != "object") return !1;
7592
7665
  try {
7593
7666
  c.call(e);
@@ -7600,7 +7673,7 @@ var V, H, ne, U, re, ie, W, G, K, q, J = e((() => {
7600
7673
  } catch {}
7601
7674
  return !1;
7602
7675
  }
7603
- function le(e) {
7676
+ function ue(e) {
7604
7677
  if (!d || !e || typeof e != "object") return !1;
7605
7678
  try {
7606
7679
  d.call(e, d);
@@ -7613,18 +7686,18 @@ var V, H, ne, U, re, ie, W, G, K, q, J = e((() => {
7613
7686
  } catch {}
7614
7687
  return !1;
7615
7688
  }
7616
- function ue(e) {
7689
+ function de(e) {
7617
7690
  return !e || typeof e != "object" ? !1 : typeof HTMLElement < "u" && e instanceof HTMLElement ? !0 : typeof e.nodeName == "string" && typeof e.getAttribute == "function";
7618
7691
  }
7619
- function de(e, t) {
7692
+ function fe(e, t) {
7620
7693
  if (e.length > t.maxStringLength) {
7621
7694
  var n = e.length - t.maxStringLength, r = "... " + n + " more character" + (n > 1 ? "s" : "");
7622
- return de(_.call(e, 0, t.maxStringLength), t) + r;
7695
+ return fe(_.call(e, 0, t.maxStringLength), t) + r;
7623
7696
  }
7624
- var i = ee[t.quoteStyle || "single"];
7625
- return i.lastIndex = 0, te(v.call(v.call(e, i, "\\$1"), /[\x00-\x1f]/g, Z), "single", t);
7697
+ var i = te[t.quoteStyle || "single"];
7698
+ return i.lastIndex = 0, ne(v.call(v.call(e, i, "\\$1"), /[\x00-\x1f]/g, X), "single", t);
7626
7699
  }
7627
- function Z(e) {
7700
+ function X(e) {
7628
7701
  var t = e.charCodeAt(0), n = {
7629
7702
  8: "b",
7630
7703
  9: "t",
@@ -7634,7 +7707,7 @@ var V, H, ne, U, re, ie, W, G, K, q, J = e((() => {
7634
7707
  }[t];
7635
7708
  return n ? "\\" + n : "\\x" + (t < 16 ? "0" : "") + y.call(t.toString(16));
7636
7709
  }
7637
- function fe(e) {
7710
+ function pe(e) {
7638
7711
  return "Object(" + e + ")";
7639
7712
  }
7640
7713
  function he(e) {
@@ -7645,7 +7718,7 @@ var V, H, ne, U, re, ie, W, G, K, q, J = e((() => {
7645
7718
  return e + " (" + t + ") {" + i + "}";
7646
7719
  }
7647
7720
  function _e(e) {
7648
- for (var t = 0; t < e.length; t++) if (X(e[t], "\n") >= 0) return !1;
7721
+ for (var t = 0; t < e.length; t++) if (Y(e[t], "\n") >= 0) return !1;
7649
7722
  return !0;
7650
7723
  }
7651
7724
  function ve(e, t) {
@@ -7664,17 +7737,17 @@ var V, H, ne, U, re, ie, W, G, K, q, J = e((() => {
7664
7737
  return n + C.call(e, "," + n) + "\n" + t.prev;
7665
7738
  }
7666
7739
  function be(e, t) {
7667
- var n = B(e), r = [];
7740
+ var n = z(e), r = [];
7668
7741
  if (n) {
7669
7742
  r.length = e.length;
7670
- for (var i = 0; i < e.length; i++) r[i] = q(e, i) ? t(e[i], e) : "";
7743
+ for (var i = 0; i < e.length; i++) r[i] = K(e, i) ? t(e[i], e) : "";
7671
7744
  }
7672
7745
  var a = typeof D == "function" ? D(e) : [], o;
7673
7746
  if (k) {
7674
7747
  o = {};
7675
7748
  for (var s = 0; s < a.length; s++) o["$" + a[s]] = a[s];
7676
7749
  }
7677
- for (var c in e) q(e, c) && (n && String(Number(c)) === c && c < e.length || k && o["$" + c] instanceof Symbol || (x.call(/[^\w$]/, c) ? r.push(t(c, e) + ": " + t(e[c], e)) : r.push(c + ": " + t(e[c], e))));
7750
+ for (var c in e) K(e, c) && (n && String(Number(c)) === c && c < e.length || k && o["$" + c] instanceof Symbol || (x.call(/[^\w$]/, c) ? r.push(t(c, e) + ": " + t(e[c], e)) : r.push(c + ": " + t(e[c], e))));
7678
7751
  if (typeof D == "function") for (var l = 0; l < a.length; l++) j.call(e, a[l]) && r.push("[" + t(a[l]) + "]: " + t(e[a[l]], e));
7679
7752
  return r;
7680
7753
  }
@@ -8588,7 +8661,7 @@ var V, H, ne, U, re, ie, W, G, K, q, J = e((() => {
8588
8661
  }), t.exports = s;
8589
8662
  })), ur = /* @__PURE__ */ t(((e, t) => {
8590
8663
  b();
8591
- var n = se(), r = E(), i = D(), a = k(), o = ce(), s = T(), c = A(), { TtyStream: l, hasCustomStdinListener: u } = w(), d = "/.brsh_history", f = Ce(), p = Ge(), m = x(), h = N(), { isAsyncFilesystemSource: g, resolveFilesystemSource: _ } = Y(), v = /\$(?:\{([\w\d?#@*-]+)\}|([\w\d]+|[?#@*-]))/g, S = m.EventEmitter || m.default || m;
8664
+ var n = ce(), r = E(), i = D(), a = k(), o = le(), s = T(), c = A(), { TtyStream: l, hasCustomStdinListener: u } = w(), d = "/.brsh_history", f = Ce(), p = Ge(), m = x(), h = N(), { isAsyncFilesystemSource: g, resolveFilesystemSource: _ } = J(), v = /\$(?:\{([\w\d?#@*-]+)\}|([\w\d]+|[?#@*-]))/g, S = m.EventEmitter || m.default || m;
8592
8665
  String.prototype.regexIndexOf = function(e, t) {
8593
8666
  let n = this.substring(t || 0).search(e);
8594
8667
  return n >= 0 ? n + (t || 0) : n;
@@ -8688,7 +8761,14 @@ var V, H, ne, U, re, ie, W, G, K, q, J = e((() => {
8688
8761
  this.setTerminalSize(e, t);
8689
8762
  }
8690
8763
  onInput(e) {
8691
- if (this.runningCommand && this.runningCommand.onInput && this.runningCommand.captureInput) return this.runningCommand.onInput(e), !0;
8764
+ if (this.runningCommand) {
8765
+ let t = this.runningCommand;
8766
+ if ((e === "^C" || e === "") && !(t.isRaw || t.stdinStream && t.stdinStream.isRaw)) {
8767
+ let e = !!(t.interactive || t._inAltScreen);
8768
+ return typeof t.kill == "function" && t.kill("SIGINT"), e || this.stdout.write("^C\r\n"), !0;
8769
+ }
8770
+ if (t.onInput && t.captureInput) return t.onInput(e), !0;
8771
+ }
8692
8772
  }
8693
8773
  setTerminalSize(e, t) {
8694
8774
  this._terminalSize = {
@@ -9161,7 +9241,8 @@ var V, H, ne, U, re, ie, W, G, K, q, J = e((() => {
9161
9241
  if (this.runningCommand) {
9162
9242
  let t = this.runningCommand, n = typeof e == "string" && e === "" || e instanceof Uint8Array && e.length === 1 && e[0] === 3 || y !== void 0 && y.isBuffer(e) && e.length === 1 && e[0] === 3, r = !!(t.isRaw || t.stdinStream && t.stdinStream.isRaw);
9163
9243
  if (n && !r) {
9164
- typeof t.kill == "function" && t.kill("SIGINT"), !t.interactive && !t._inAltScreen && this.stdout.write("^C\r\n");
9244
+ let e = !!(t.interactive || t._inAltScreen);
9245
+ typeof t.kill == "function" && t.kill("SIGINT"), e || this.stdout.write("^C\r\n");
9165
9246
  return;
9166
9247
  }
9167
9248
  let i = u(t);
@@ -9360,11 +9441,32 @@ var V, H, ne, U, re, ie, W, G, K, q, J = e((() => {
9360
9441
  throw Error(`${e}: Command not found`);
9361
9442
  }
9362
9443
  async _parseCommandLine(t) {
9363
- let n = e._splitCommand(t);
9364
- return (await Promise.all(n.map(({ value: e, hasQuote: t }) => this._replaceVariables(e).then((e) => ({
9365
- value: e,
9366
- hasQuote: t
9367
- }))))).filter(({ value: e, hasQuote: t }) => e.length > 0 || t);
9444
+ let n = e._splitCommand(t), r = n.length > 0 ? n[0].value : "", i = r === "export" || r === "alias" || r === "local", a = [];
9445
+ for (let e = 0; e < n.length; e++) {
9446
+ let { value: t, hasQuote: r } = n[e];
9447
+ if (r && t === "$@") {
9448
+ let e = parseInt(this.context.getVar("#") || "0", 10) || 0;
9449
+ for (let t = 1; t <= e; t++) a.push({
9450
+ value: String(this.context.getVar(String(t))),
9451
+ hasQuote: !0
9452
+ });
9453
+ continue;
9454
+ }
9455
+ let o = await this._replaceVariables(t), s = n.length === 1 && /^[A-Za-z_]\w*=/.test(t), c = e > 0 && i && /^[A-Za-z_]\w*=/.test(t);
9456
+ if (r || s || c || !t.includes("$")) {
9457
+ (o.length > 0 || r) && a.push({
9458
+ value: o,
9459
+ hasQuote: r
9460
+ });
9461
+ continue;
9462
+ }
9463
+ let l = o.trim().split(/\s+/).filter(Boolean);
9464
+ for (let e of l) a.push({
9465
+ value: e,
9466
+ hasQuote: !1
9467
+ });
9468
+ }
9469
+ return a;
9368
9470
  }
9369
9471
  static _sanitiseCommandPart(e) {
9370
9472
  return e.startsWith("\"") && e.endsWith("\"") || e.startsWith("'") && e.endsWith("'") ? e.substring(1, e.length - 1) : e;
@@ -9516,7 +9618,7 @@ var V, H, ne, U, re, ie, W, G, K, q, J = e((() => {
9516
9618
  return e.create(Object.assign({}, n, { filesystem: t }));
9517
9619
  }
9518
9620
  };
9519
- C.STATUS_READY = "READY", C.STATUS_WORKING = "WORKING", C.STATUS_DESTROYED = "DESTROYED", C.Command = s, C.InteractiveCommand = c, C.WasmCommand = a, C.createWasmCommand = a.createGenericWasmCommand || a.createCommand, C.ReplCommand = j(), C.JsCommand = o, C.FS = h, C.BinaryContainer = Y(), C.Storage = C.BinaryContainer.FilesystemStorage, globalThis.shell = C, globalThis.Shell = C, t.exports = C;
9621
+ C.STATUS_READY = "READY", C.STATUS_WORKING = "WORKING", C.STATUS_DESTROYED = "DESTROYED", C.Command = s, C.InteractiveCommand = c, C.WasmCommand = a, C.createWasmCommand = a.createGenericWasmCommand || a.createCommand, C.ReplCommand = j(), C.JsCommand = o, C.FS = h, C.BinaryContainer = J(), C.Storage = C.BinaryContainer.FilesystemStorage, globalThis.shell = C, globalThis.Shell = C, t.exports = C;
9520
9622
  }));
9521
9623
  //#endregion
9522
9624
  export default ur();