brsh 3.6.2 → 3.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/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 (X(e, o) || e && X(e.buffer, o) || s !== void 0 && (X(e, s) || e && X(e.buffer, s))) return b(e, t, n);
99
+ if (fe(e, o) || e && fe(e.buffer, o) || s !== void 0 && (fe(e, s) || e && fe(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 (X(e, a)) {
140
+ if (fe(e, a)) {
141
141
  let t = new a(e);
142
142
  return b(t.buffer, t.byteOffset, t.byteLength);
143
143
  }
@@ -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 (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");
170
+ if (fe(e, a) && (e = u.from(e, e.offset, e.byteLength)), fe(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 (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);
201
+ if (fe(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) || X(e, o)) return e.byteLength;
210
+ if (o.isView(e) || fe(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 ce(e).length;
220
+ case "utf-8": return se(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 de(e).length;
226
+ case "base64": return ue(e).length;
227
227
  default:
228
- if (i) return r ? -1 : ce(e).length;
228
+ if (i) return r ? -1 : se(e).length;
229
229
  t = ("" + t).toLowerCase(), i = !0;
230
230
  }
231
231
  }
@@ -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 (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);
283
+ if (fe(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;
@@ -351,16 +351,16 @@ var u, d, f, p, m, h, g, _, v, y, b = e((() => {
351
351
  return o;
352
352
  }
353
353
  function A(e, t, n, r) {
354
- return fe(ce(t, e.length - n), e, n, r);
354
+ return de(se(t, e.length - n), e, n, r);
355
355
  }
356
356
  function j(e, t, n, r) {
357
- return fe(le(t), e, n, r);
357
+ return de(ce(t), e, n, r);
358
358
  }
359
359
  function M(e, t, n, r) {
360
- return fe(de(t), e, n, r);
360
+ return de(ue(t), e, n, r);
361
361
  }
362
362
  function N(e, t, n, r) {
363
- return fe(ue(t, e.length - n), e, n, r);
363
+ return de(le(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;
@@ -483,15 +483,15 @@ var u, d, f, p, m, h, g, _, v, y, b = e((() => {
483
483
  }, u.prototype.readUint32BE = u.prototype.readUInt32BE = function(e, t) {
484
484
  return e >>>= 0, t || V(e, 4, this.length), this[e] * 16777216 + (this[e + 1] << 16 | this[e + 2] << 8 | this[e + 3]);
485
485
  }, u.prototype.readBigUInt64LE = Z(function(e) {
486
- e >>>= 0, Y(e, "offset");
486
+ e >>>= 0, X(e, "offset");
487
487
  let t = this[e], n = this[e + 7];
488
- (t === void 0 || n === void 0) && ae(e, this.length - 8);
488
+ (t === void 0 || n === void 0) && ie(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
491
  }), u.prototype.readBigUInt64BE = Z(function(e) {
492
- e >>>= 0, Y(e, "offset");
492
+ e >>>= 0, X(e, "offset");
493
493
  let t = this[e], n = this[e + 7];
494
- (t === void 0 || n === void 0) && ae(e, this.length - 8);
494
+ (t === void 0 || n === void 0) && ie(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) {
@@ -519,15 +519,15 @@ var u, d, f, p, m, h, g, _, v, y, b = e((() => {
519
519
  }, u.prototype.readInt32BE = function(e, t) {
520
520
  return e >>>= 0, t || V(e, 4, this.length), this[e] << 24 | this[e + 1] << 16 | this[e + 2] << 8 | this[e + 3];
521
521
  }, u.prototype.readBigInt64LE = Z(function(e) {
522
- e >>>= 0, Y(e, "offset");
522
+ e >>>= 0, X(e, "offset");
523
523
  let t = this[e], n = this[e + 7];
524
- (t === void 0 || n === void 0) && ae(e, this.length - 8);
524
+ (t === void 0 || n === void 0) && ie(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
527
  }), u.prototype.readBigInt64BE = Z(function(e) {
528
- e >>>= 0, Y(e, "offset");
528
+ e >>>= 0, X(e, "offset");
529
529
  let t = this[e], n = this[e + 7];
530
- (t === void 0 || n === void 0) && ae(e, this.length - 8);
530
+ (t === void 0 || n === void 0) && ie(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) {
@@ -572,14 +572,14 @@ var u, d, f, p, m, h, g, _, v, y, b = e((() => {
572
572
  return e = +e, t >>>= 0, n || H(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
574
  function U(e, t, n, r, i) {
575
- J(t, r, i, e, n, 7);
575
+ re(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
581
  function te(e, t, n, r, i) {
582
- J(t, r, i, e, n, 7);
582
+ re(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));
@@ -631,13 +631,13 @@ var u, d, f, p, m, h, g, _, v, y, b = e((() => {
631
631
  }, u.prototype.writeFloatBE = function(e, t, n) {
632
632
  return ne(this, e, t, !1, n);
633
633
  };
634
- function re(e, t, r, i, a) {
634
+ function G(e, t, r, i, a) {
635
635
  return t = +t, r >>>= 0, a || W(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 re(this, e, t, !0, n);
638
+ return G(this, e, t, !0, n);
639
639
  }, u.prototype.writeDoubleBE = function(e, t, n) {
640
- return re(this, e, t, !1, n);
640
+ return G(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 G = {};
672
- function K(e, t, n) {
673
- G[e] = class extends n {
671
+ let K = {};
672
+ function q(e, t, n) {
673
+ K[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
- K("ERR_BUFFER_OUT_OF_BOUNDS", function(e) {
697
+ q("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), K("ERR_INVALID_ARG_TYPE", function(e, t) {
699
+ }, RangeError), q("ERR_INVALID_ARG_TYPE", function(e, t) {
700
700
  return `The "${e}" argument must be of type number. Received type ${typeof t}`;
701
- }, TypeError), K("ERR_OUT_OF_RANGE", function(e, t, n) {
701
+ }, TypeError), q("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 = ie(String(n)) : typeof n == "bigint" && (i = String(n), (n > BigInt(2) ** BigInt(32) || n < -(BigInt(2) ** BigInt(32))) && (i = ie(i)), i += "n"), r += ` It must be ${t}. Received ${i}`, r;
703
+ return Number.isInteger(n) && Math.abs(n) > 2 ** 32 ? i = J(String(n)) : typeof n == "bigint" && (i = String(n), (n > BigInt(2) ** BigInt(32) || n < -(BigInt(2) ** BigInt(32))) && (i = J(i)), i += "n"), r += ` It must be ${t}. Received ${i}`, r;
704
704
  }, RangeError);
705
- function ie(e) {
705
+ function J(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) && ae(t, e.length - (n + 1));
710
+ function Y(e, t, n) {
711
+ X(t, "offset"), (e[t] === void 0 || e[t + n] === void 0) && ie(t, e.length - (n + 1));
712
712
  }
713
- function J(e, t, n, r, i, a) {
713
+ function re(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 G.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 K.ERR_OUT_OF_RANGE("value", i, e);
717
717
  }
718
- q(r, i, a);
718
+ Y(r, i, a);
719
719
  }
720
- function Y(e, t) {
721
- if (typeof e != "number") throw new G.ERR_INVALID_ARG_TYPE(t, "number", e);
720
+ function X(e, t) {
721
+ if (typeof e != "number") throw new K.ERR_INVALID_ARG_TYPE(t, "number", e);
722
722
  }
723
- function ae(e, t, n) {
724
- throw Math.floor(e) === e ? t < 0 ? new G.ERR_BUFFER_OUT_OF_BOUNDS() : new G.ERR_OUT_OF_RANGE(n || "offset", `>= ${+!!n} and <= ${t}`, e) : (Y(e, n), new G.ERR_OUT_OF_RANGE(n || "offset", "an integer", e));
723
+ function ie(e, t, n) {
724
+ throw Math.floor(e) === e ? t < 0 ? new K.ERR_BUFFER_OUT_OF_BOUNDS() : new K.ERR_OUT_OF_RANGE(n || "offset", `>= ${+!!n} and <= ${t}`, e) : (X(e, n), new K.ERR_OUT_OF_RANGE(n || "offset", "an integer", e));
725
725
  }
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 "";
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 "";
729
729
  for (; e.length % 4 != 0;) e += "=";
730
730
  return e;
731
731
  }
732
- function ce(e, t) {
732
+ function se(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,25 +767,25 @@ var u, d, f, p, m, h, g, _, v, y, b = e((() => {
767
767
  }
768
768
  return a;
769
769
  }
770
- function le(e) {
770
+ function ce(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 ue(e, t) {
775
+ function le(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 de(e) {
781
- return t.toByteArray(se(e));
780
+ function ue(e) {
781
+ return t.toByteArray(oe(e));
782
782
  }
783
- function fe(e, t, n, r) {
783
+ function de(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 X(e, t) {
788
+ function fe(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
791
  function pe(e) {
@@ -1366,7 +1366,7 @@ var j, M, N, P, F, I, L, R, ee, z, B = e((() => {
1366
1366
  });
1367
1367
  }
1368
1368
  };
1369
- })), re = /* @__PURE__ */ t(((e, t) => {
1369
+ })), G = /* @__PURE__ */ t(((e, t) => {
1370
1370
  b(), B();
1371
1371
  var { BinaryFile: n, SymlinkRef: r } = x(), i = new Uint8Array([
1372
1372
  66,
@@ -1637,7 +1637,7 @@ var j, M, N, P, F, I, L, R, ee, z, B = e((() => {
1637
1637
  }
1638
1638
  }
1639
1639
  };
1640
- })), G = /* @__PURE__ */ t(((e, t) => {
1640
+ })), K = /* @__PURE__ */ t(((e, t) => {
1641
1641
  b();
1642
1642
  var n = x(), { BinaryFile: r, SymlinkRef: i } = n;
1643
1643
  function a(e) {
@@ -1662,20 +1662,20 @@ var j, M, N, P, F, I, L, R, ee, z, B = e((() => {
1662
1662
  t.exports = class extends n {
1663
1663
  constructor(e = "/", t = {}, n = {}, r = null) {
1664
1664
  if (super(), t instanceof Uint8Array || t instanceof ArrayBuffer) {
1665
- let { deserializeBinaryFilesystem: e } = re(), r = e(t);
1665
+ let { deserializeBinaryFilesystem: e } = G(), r = e(t);
1666
1666
  t = r.filesystem, n = Object.assign({}, r.permissions, n);
1667
1667
  } 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)) {
1668
- let { deserializeBinaryFilesystem: e } = re(), r = e(t);
1668
+ let { deserializeBinaryFilesystem: e } = G(), r = e(t);
1669
1669
  t = r.filesystem, n = Object.assign({}, r.permissions, n);
1670
1670
  }
1671
1671
  a(t), this.fileSystem = t, this.permissions = Object.assign({}, n), this.cwd = e.endsWith("/") ? e : e + "/", this._onChange = r, this._changeScheduled = !1;
1672
1672
  }
1673
1673
  toBinaryContainer(e = {}) {
1674
- let { serializeBinaryFilesystem: t } = re();
1674
+ let { serializeBinaryFilesystem: t } = G();
1675
1675
  return t(this.fileSystem, this.permissions, e);
1676
1676
  }
1677
1677
  static fromBinaryContainer(e, t = {}) {
1678
- let { deserializeBinaryFilesystem: n } = re();
1678
+ let { deserializeBinaryFilesystem: n } = G();
1679
1679
  return n(e, t);
1680
1680
  }
1681
1681
  getFileByPath(e) {
@@ -1853,9 +1853,9 @@ var j, M, N, P, F, I, L, R, ee, z, B = e((() => {
1853
1853
  return null;
1854
1854
  }
1855
1855
  }, t.exports.BinaryFile = r, t.exports.SymlinkRef = i;
1856
- })), K = /* @__PURE__ */ t(((e, t) => {
1856
+ })), q = /* @__PURE__ */ t(((e, t) => {
1857
1857
  t.exports = null;
1858
- })), ie = /* @__PURE__ */ t(((e, t) => {
1858
+ })), J = /* @__PURE__ */ t(((e, t) => {
1859
1859
  B();
1860
1860
  function n(e) {
1861
1861
  if (typeof e != "string") throw TypeError("Path must be a string. Received " + JSON.stringify(e));
@@ -2023,9 +2023,9 @@ var j, M, N, P, F, I, L, R, ee, z, B = e((() => {
2023
2023
  posix: null
2024
2024
  };
2025
2025
  a.posix = a, t.exports = a;
2026
- })), q = /* @__PURE__ */ t(((e, t) => {
2026
+ })), Y = /* @__PURE__ */ t(((e, t) => {
2027
2027
  B();
2028
- var n = K(), r = ie(), i = x();
2028
+ var n = q(), r = J(), i = x();
2029
2029
  t.exports = class extends i {
2030
2030
  constructor(e, t = null) {
2031
2031
  super(), this._onChange = t, this._changeScheduled = !1, this._virtualFiles = {}, this.cwd = this._normalizeCwd(e || z.cwd());
@@ -2232,8 +2232,8 @@ var j, M, N, P, F, I, L, R, ee, z, B = e((() => {
2232
2232
  }
2233
2233
  }
2234
2234
  };
2235
- })), J = /* @__PURE__ */ t(((e, t) => {
2236
- var n = G();
2235
+ })), re = /* @__PURE__ */ t(((e, t) => {
2236
+ var n = K();
2237
2237
  t.exports = class {
2238
2238
  constructor(e) {
2239
2239
  this.options = e;
@@ -2267,7 +2267,7 @@ var j, M, N, P, F, I, L, R, ee, z, B = e((() => {
2267
2267
  return this.fs._getFileRaw(t) || null;
2268
2268
  }
2269
2269
  setNodeFilesystem(e) {
2270
- let t = q(), n = this.fs._onChange;
2270
+ let t = Y(), n = this.fs._onChange;
2271
2271
  this.fs = new t(e, n);
2272
2272
  }
2273
2273
  setFilesystem(e, t = {}) {
@@ -2287,15 +2287,15 @@ var j, M, N, P, F, I, L, R, ee, z, B = e((() => {
2287
2287
  typeof this._destroyFn == "function" && this._destroyFn(e);
2288
2288
  }
2289
2289
  };
2290
- })), Y = /* @__PURE__ */ t(((e, t) => {
2290
+ })), X = /* @__PURE__ */ t(((e, t) => {
2291
2291
  var n = W();
2292
2292
  t.exports = class extends n {
2293
2293
  constructor(e, t) {
2294
2294
  super(e, t);
2295
2295
  }
2296
2296
  };
2297
- })), ae = /* @__PURE__ */ t(((e, t) => {
2298
- var n = Y();
2297
+ })), ie = /* @__PURE__ */ t(((e, t) => {
2298
+ var n = X();
2299
2299
  function r(e) {
2300
2300
  return /^#!\/(sh\.js|bin\/(sh|brsh))/.test(e);
2301
2301
  }
@@ -2487,7 +2487,7 @@ var j, M, N, P, F, I, L, R, ee, z, B = e((() => {
2487
2487
  }
2488
2488
  _executeNode(e) {
2489
2489
  if (e.type === "function") {
2490
- let t = e.name, n = e.bodyLines, r = this, i = Y(), a = class extends i {
2490
+ let t = e.name, n = e.bodyLines, r = this, i = X(), a = class extends i {
2491
2491
  static get name() {
2492
2492
  return t;
2493
2493
  }
@@ -2687,9 +2687,9 @@ var j, M, N, P, F, I, L, R, ee, z, B = e((() => {
2687
2687
  }
2688
2688
  }
2689
2689
  }, t.exports.isKnownInterpreter = r;
2690
- })), oe = /* @__PURE__ */ t(((e, t) => {
2690
+ })), ae = /* @__PURE__ */ t(((e, t) => {
2691
2691
  b();
2692
- var n = ae(), { BinaryFile: r } = G(), i = 0, a = 8, o = 20, s = 28, c = 31, l = 44, u = 54, d = 70, f = 0, p = 2, m = 3, h = 4, g = 1, _ = 2, v = 4, x = 8, S = 1, C = class extends n {
2692
+ var n = ie(), { BinaryFile: r } = K(), i = 0, a = 6, o = 8, s = 20, c = 28, l = 31, u = 44, d = 54, f = 70, p = 0, m = 2, h = 3, g = 4, _ = 1, v = 2, x = 4, S = 8, C = 1, w = 4, T = class extends n {
2693
2693
  get name() {
2694
2694
  return "wasm";
2695
2695
  }
@@ -2756,7 +2756,7 @@ var j, M, N, P, F, I, L, R, ee, z, B = e((() => {
2756
2756
  run() {
2757
2757
  let e = this.script, t = (() => {
2758
2758
  try {
2759
- return K();
2759
+ return q();
2760
2760
  } catch {
2761
2761
  return null;
2762
2762
  }
@@ -2824,8 +2824,10 @@ var j, M, N, P, F, I, L, R, ee, z, B = e((() => {
2824
2824
  let t = {
2825
2825
  1: "",
2826
2826
  2: ""
2827
- }, n = new TextDecoder(), b = new TextEncoder(), C = null, w = null, T = !1, E = 0, D = null, O = null, j = null, M = null, N = !!(this.interactive && (this.stdin === void 0 || this.stdin === null || this.stdin === this.stdinStream || this.stdin && this.stdin.isTTY)), P = (e, n) => {
2828
- if (N && (e === 1 || e === 2)) {
2827
+ }, n = new TextDecoder(), b = new TextEncoder(), T = null, E = null, D = !1, O = 0, k = null, A = null, N = null, P = null, F = this.stdin === void 0 || this.stdin === null || this.stdin === this.stdinStream || this.stdin && this.stdin.isTTY, I = !!(this.interactive && F), L = () => {
2828
+ I || !F || (I = !0, this._isInteractive = !0, 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));
2829
+ }, R = (e, n) => {
2830
+ if (I && (e === 1 || e === 2)) {
2829
2831
  if (e === 1 && this.stdout) {
2830
2832
  this.stdout.write(n);
2831
2833
  return;
@@ -2839,57 +2841,61 @@ var j, M, N, P, F, I, L, R, ee, z, B = e((() => {
2839
2841
  let r = t[e].split("\n");
2840
2842
  t[e] = r.pop();
2841
2843
  for (let t of r) e === 1 ? this.stdOut = t : this.stdErr = t;
2842
- }, F = () => {
2843
- t[1] &&= (N && this.stdout ? this.stdout.write(t[1]) : this.stdOut = t[1], ""), t[2] &&= (N && this.stderr ? this.stderr.write(t[2]) : this.stdErr = t[2], "");
2844
- }, I = [], L = (e) => {
2844
+ }, ee = () => {
2845
+ t[1] &&= (I && this.stdout ? this.stdout.write(t[1]) : this.stdOut = t[1], ""), t[2] &&= (I && this.stderr ? this.stderr.write(t[2]) : this.stdErr = t[2], "");
2846
+ }, z = [], B = (e) => {
2845
2847
  if (!(!e || e.length === 0)) {
2846
- for (let t = 0; t < e.length; t++) I.push(e[t]);
2847
- if (O) {
2848
- let e = O;
2849
- O = null, e();
2848
+ for (let t = 0; t < e.length; t++) z.push(e[t]);
2849
+ if (A) {
2850
+ let e = A;
2851
+ A = null, e();
2850
2852
  }
2851
2853
  }
2852
2854
  };
2853
- M = (e) => {
2855
+ P = (e) => {
2854
2856
  this._handlingStreamData = !0;
2855
2857
  try {
2856
- L(typeof e == "string" ? b.encode(e) : e instanceof Uint8Array ? e : y !== void 0 && y.isBuffer(e) ? new Uint8Array(e) : b.encode(String(e ?? "")));
2858
+ B(typeof e == "string" ? b.encode(e) : e instanceof Uint8Array ? e : y !== void 0 && y.isBuffer(e) ? new Uint8Array(e) : b.encode(String(e ?? "")));
2857
2859
  } finally {
2858
2860
  this._handlingStreamData = !1;
2859
2861
  }
2860
2862
  }, this._externalKeyHandler = (e) => {
2861
2863
  if (this._handlingStreamData) return;
2862
2864
  let t = this._keyToBytes(e);
2863
- t && L(t);
2864
- }, N && this.stdinStream && typeof this.stdinStream.on == "function" && this.stdinStream.on("data", M), N && this.stdin && this.stdin !== this.stdinStream && typeof this.stdin.on == "function" && this.stdin.on("data", M);
2865
- let R = !N && typeof this.stdin == "string" ? b.encode(this.stdin) : !N && this.stdin instanceof Uint8Array ? this.stdin : !N && y !== void 0 && y.isBuffer(this.stdin) ? new Uint8Array(this.stdin) : new Uint8Array(), ee = 0, z = this.context && this.context.fs ? this.context.fs : this.fs, B = 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") || z && z.cwd || "/", V = B.length > 1 && B.endsWith("/") ? B.slice(0, -1) : B, H = 5, U = new Map([[3, {
2865
+ t && B(t);
2866
+ }, F && this.stdinStream && typeof this.stdinStream.on == "function" && this.stdinStream.on("data", P), F && this.stdin && this.stdin !== this.stdinStream && typeof this.stdin.on == "function" && this.stdin.on("data", P);
2867
+ let V = !F && typeof this.stdin == "string" ? b.encode(this.stdin) : !F && this.stdin instanceof Uint8Array ? this.stdin : !F && y !== void 0 && y.isBuffer(this.stdin) ? new Uint8Array(this.stdin) : new Uint8Array(), H = 0, U = this.context && this.context.fs ? this.context.fs : this.fs, te = 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") || U && U.cwd || "/", W = te.length > 1 && te.endsWith("/") ? te.slice(0, -1) : te, ne = 5, G = new Map([[3, {
2866
2868
  type: "preopen",
2867
2869
  path: "/",
2868
2870
  guestName: "/"
2869
2871
  }], [4, {
2870
2872
  type: "preopen",
2871
- path: V,
2873
+ path: W,
2872
2874
  guestName: "."
2873
- }]]), te = (e) => {
2875
+ }]]), K = new Map([
2876
+ [0, 0],
2877
+ [1, 0],
2878
+ [2, 0]
2879
+ ]), q = (e) => {
2874
2880
  let t = e.split("/").filter(Boolean);
2875
2881
  return t.pop(), "/" + t.join("/");
2876
- }, W = (e, t) => {
2877
- let n = U.get(e);
2882
+ }, J = (e, t) => {
2883
+ let n = G.get(e);
2878
2884
  if (!n || n.type !== "preopen" && n.type !== "dir") return null;
2879
- if (t.startsWith("/")) return z.absolutePath(t);
2880
- if (!t || t === ".") return z.absolutePath(n.path);
2881
- let r = n.path.endsWith("/") ? n.path : n.path + "/", i = z.absolutePath(r + t), a = z.absolutePath("/" + t);
2885
+ if (t.startsWith("/")) return U.absolutePath(t);
2886
+ if (!t || t === ".") return U.absolutePath(n.path);
2887
+ let r = n.path.endsWith("/") ? n.path : n.path + "/", i = U.absolutePath(r + t), a = U.absolutePath("/" + t);
2882
2888
  if (n.path !== "/") {
2883
- if (z.exists(i)) return i;
2884
- if (z.exists(a)) return a;
2885
- let e = z.exists(te(i));
2886
- return z.exists(te(a)) && !e ? a : i;
2887
- }
2888
- if (z.exists(i)) return i;
2889
- let o = z.absolutePath(t);
2890
- return z.exists(o) ? o : i;
2891
- }, ne = (e) => {
2892
- if (!(!e || e.type !== "file" || !e.dirty || !z)) try {
2889
+ if (U.exists(i)) return i;
2890
+ if (U.exists(a)) return a;
2891
+ let e = U.exists(q(i));
2892
+ return U.exists(q(a)) && !e ? a : i;
2893
+ }
2894
+ if (U.exists(i)) return i;
2895
+ let o = U.absolutePath(t);
2896
+ return U.exists(o) ? o : i;
2897
+ }, Y = (e) => {
2898
+ if (!(!e || e.type !== "file" || !e.dirty || !U)) try {
2893
2899
  let t = !0;
2894
2900
  for (let n = 0; n < e.bytes.length; n++) if (e.bytes[n] === 0) {
2895
2901
  t = !1;
@@ -2897,10 +2903,10 @@ var j, M, N, P, F, I, L, R, ee, z, B = e((() => {
2897
2903
  }
2898
2904
  if (t) {
2899
2905
  let t = n.decode(e.bytes);
2900
- z.setFileByPath(e.path, t, !0);
2906
+ U.setFileByPath(e.path, t, !0);
2901
2907
  } else {
2902
2908
  let t = new Uint8Array(e.bytes.length);
2903
- t.set(e.bytes), z.setFileByPath(e.path, new r(t.buffer, "application/octet-stream"), !0);
2909
+ t.set(e.bytes), U.setFileByPath(e.path, new r(t.buffer, "application/octet-stream"), !0);
2904
2910
  }
2905
2911
  e.dirty = !1;
2906
2912
  } catch {}
@@ -2910,25 +2916,39 @@ var j, M, N, P, F, I, L, R, ee, z, B = e((() => {
2910
2916
  COLUMNS: String(this.stdout && this.stdout.columns || this.context && typeof this.context.getVar == "function" && this.context.getVar("COLUMNS") || 80),
2911
2917
  LINES: String(this.stdout && this.stdout.rows || this.context && typeof this.context.getVar == "function" && this.context.getVar("LINES") || 24),
2912
2918
  ...this.context && this.context.vars || {}
2913
- }, G = Object.entries(re).map(([e, t]) => `${e}=${t}`), K = new Proxy({
2914
- fd_write: (e, t, r, o) => {
2915
- if (!C) return a;
2916
- let s = new DataView(C.buffer);
2919
+ }, X = Object.entries(re).map(([e, t]) => `${e}=${t}`), ie = new Proxy({
2920
+ fd_write: (e, t, r, a) => {
2921
+ if (!T) return o;
2922
+ let s = new DataView(T.buffer);
2917
2923
  if (e === 1 || e === 2) {
2918
- let a = 0;
2924
+ let o = 0;
2925
+ for (let i = 0; i < r; i++) {
2926
+ let r = s.getUint32(t + i * 8, !0), a = s.getUint32(t + i * 8 + 4, !0);
2927
+ a > 0 && R(e, n.decode(new Uint8Array(T.buffer, r, a))), o += a;
2928
+ }
2929
+ return s.setUint32(a, o, !0), i;
2930
+ }
2931
+ let c = G.get(e);
2932
+ if (!c) return o;
2933
+ if (c.type === "dev_null" || c.type === "dev_zero") {
2934
+ let e = 0;
2935
+ for (let n = 0; n < r; n++) e += s.getUint32(t + n * 8 + 4, !0);
2936
+ return s.setUint32(a, e, !0), i;
2937
+ }
2938
+ if (c.type === "dev_tty") {
2939
+ let e = 0;
2919
2940
  for (let i = 0; i < r; i++) {
2920
- let r = s.getUint32(t + i * 8, !0), o = s.getUint32(t + i * 8 + 4, !0);
2921
- o > 0 && P(e, n.decode(new Uint8Array(C.buffer, r, o))), a += o;
2941
+ let r = s.getUint32(t + i * 8, !0), a = s.getUint32(t + i * 8 + 4, !0);
2942
+ a > 0 && R(1, n.decode(new Uint8Array(T.buffer, r, a))), e += a;
2922
2943
  }
2923
- return s.setUint32(o, a, !0), i;
2944
+ return s.setUint32(a, e, !0), i;
2924
2945
  }
2925
- let c = U.get(e);
2926
- if (!c || c.type !== "file") return a;
2946
+ if (c.type !== "file") return o;
2927
2947
  let l = 0;
2928
2948
  for (let e = 0; e < r; e++) {
2929
2949
  let n = s.getUint32(t + e * 8, !0), r = s.getUint32(t + e * 8 + 4, !0);
2930
2950
  if (r > 0) {
2931
- let e = new Uint8Array(C.buffer, n, r), t = c.append ? c.bytes.length : c.pos, i = t + r;
2951
+ let e = new Uint8Array(T.buffer, n, r), t = c.append ? c.bytes.length : c.pos, i = t + r;
2932
2952
  if (i > c.bytes.length) {
2933
2953
  let e = new Uint8Array(i);
2934
2954
  e.set(c.bytes), c.bytes = e;
@@ -2936,202 +2956,277 @@ var j, M, N, P, F, I, L, R, ee, z, B = e((() => {
2936
2956
  c.bytes.set(e, t), c.pos = t + r, c.dirty = !0, l += r;
2937
2957
  }
2938
2958
  }
2939
- return s.setUint32(o, l, !0), i;
2959
+ return s.setUint32(a, l, !0), i;
2940
2960
  },
2941
2961
  fd_read: (e, t, n, r) => {
2942
- if (!C) return a;
2943
- let o = new DataView(C.buffer);
2944
- if (e === 0) {
2945
- if (N && T) {
2946
- if ((typeof w?.exports?.asyncify_get_state == "function" ? w.exports.asyncify_get_state() : 0) === 2) {
2947
- w.exports.asyncify_stop_rewind();
2962
+ if (!T) return o;
2963
+ let s = new DataView(T.buffer), c = G.get(e), l = !!(c && c.type === "dev_tty");
2964
+ if (e === 0 || I && e === 2 || l) {
2965
+ (l || e === 2) && L();
2966
+ let o = !!((K.get(e) || 0) & w);
2967
+ if (D) {
2968
+ if ((typeof E?.exports?.asyncify_get_state == "function" ? E.exports.asyncify_get_state() : 0) === 2) {
2969
+ E.exports.asyncify_stop_rewind();
2948
2970
  let e = 0;
2949
- for (let r = 0; r < n && I.length > 0; r++) {
2950
- let n = o.getUint32(t + r * 8, !0), i = o.getUint32(t + r * 8 + 4, !0), a = Math.min(i, I.length), s = I.splice(0, a);
2951
- new Uint8Array(C.buffer).set(s, n), e += a;
2971
+ for (let r = 0; r < n && z.length > 0; r++) {
2972
+ let n = s.getUint32(t + r * 8, !0), i = s.getUint32(t + r * 8 + 4, !0), a = Math.min(i, z.length), o = z.splice(0, a);
2973
+ new Uint8Array(T.buffer).set(o, n), e += a;
2952
2974
  }
2953
- return o.setUint32(r, e, !0), i;
2975
+ return s.setUint32(r, e, !0), i;
2954
2976
  }
2955
- if (I.length > 0) {
2977
+ if (z.length > 0) {
2956
2978
  let e = 0;
2957
- for (let r = 0; r < n && I.length > 0; r++) {
2958
- let n = o.getUint32(t + r * 8, !0), i = o.getUint32(t + r * 8 + 4, !0), a = Math.min(i, I.length), s = I.splice(0, a);
2959
- new Uint8Array(C.buffer).set(s, n), e += a;
2979
+ for (let r = 0; r < n && z.length > 0; r++) {
2980
+ let n = s.getUint32(t + r * 8, !0), i = s.getUint32(t + r * 8 + 4, !0), a = Math.min(i, z.length), o = z.splice(0, a);
2981
+ new Uint8Array(T.buffer).set(o, n), e += a;
2960
2982
  }
2961
- return o.setUint32(r, e, !0), i;
2983
+ return s.setUint32(r, e, !0), i;
2962
2984
  }
2963
- return w.exports.asyncify_start_unwind(E), D = new Promise((e) => {
2964
- O = e;
2965
- }), o.setUint32(r, 0, !0), i;
2985
+ return o ? (s.setUint32(r, 0, !0), a) : (E.exports.asyncify_start_unwind(O), k = new Promise((e) => {
2986
+ A = e;
2987
+ }), s.setUint32(r, 0, !0), i);
2988
+ }
2989
+ if (z.length > 0) {
2990
+ let e = 0;
2991
+ for (let r = 0; r < n && z.length > 0; r++) {
2992
+ let n = s.getUint32(t + r * 8, !0), i = s.getUint32(t + r * 8 + 4, !0), a = Math.min(i, z.length), o = z.splice(0, a);
2993
+ new Uint8Array(T.buffer).set(o, n), e += a;
2994
+ }
2995
+ return s.setUint32(r, e, !0), i;
2996
+ }
2997
+ let c = 0;
2998
+ for (let e = 0; e < n && H < V.length; e++) {
2999
+ let n = s.getUint32(t + e * 8, !0), r = s.getUint32(t + e * 8 + 4, !0), i = Math.min(r, V.length - H);
3000
+ new Uint8Array(T.buffer).set(V.slice(H, H + i), n), H += i, c += i;
3001
+ }
3002
+ return c === 0 && o && H >= V.length ? (s.setUint32(r, 0, !0), a) : (s.setUint32(r, c, !0), i);
3003
+ }
3004
+ if (!c) return o;
3005
+ if (c.type === "dev_null") return s.setUint32(r, 0, !0), i;
3006
+ if (c.type === "dev_zero") {
3007
+ let e = 0;
3008
+ for (let r = 0; r < n; r++) {
3009
+ let n = s.getUint32(t + r * 8, !0), i = s.getUint32(t + r * 8 + 4, !0);
3010
+ new Uint8Array(T.buffer, n, i).fill(0), e += i;
2966
3011
  }
3012
+ return s.setUint32(r, e, !0), i;
3013
+ }
3014
+ if (c.type === "dev_urandom") {
2967
3015
  let e = 0;
2968
- for (let r = 0; r < n && ee < R.length; r++) {
2969
- let n = o.getUint32(t + r * 8, !0), i = o.getUint32(t + r * 8 + 4, !0), a = Math.min(i, R.length - ee);
2970
- new Uint8Array(C.buffer).set(R.slice(ee, ee + a), n), ee += a, e += a;
3016
+ for (let r = 0; r < n; r++) {
3017
+ let n = s.getUint32(t + r * 8, !0), i = s.getUint32(t + r * 8 + 4, !0), a = new Uint8Array(T.buffer, n, i);
3018
+ if (typeof crypto < "u" && crypto.getRandomValues) crypto.getRandomValues(a);
3019
+ else for (let e = 0; e < i; e++) a[e] = Math.floor(Math.random() * 256);
3020
+ e += i;
2971
3021
  }
2972
- return o.setUint32(r, e, !0), i;
3022
+ return s.setUint32(r, e, !0), i;
2973
3023
  }
2974
- let s = U.get(e);
2975
- if (!s || s.type !== "file") return a;
2976
- let c = 0;
2977
- for (let e = 0; e < n && s.pos < s.bytes.length; e++) {
2978
- let n = o.getUint32(t + e * 8, !0), r = o.getUint32(t + e * 8 + 4, !0), i = Math.min(r, s.bytes.length - s.pos);
2979
- new Uint8Array(C.buffer).set(s.bytes.subarray(s.pos, s.pos + i), n), s.pos += i, c += i;
3024
+ if (c.type !== "file") return o;
3025
+ let u = 0;
3026
+ for (let e = 0; e < n && c.pos < c.bytes.length; e++) {
3027
+ let n = s.getUint32(t + e * 8, !0), r = s.getUint32(t + e * 8 + 4, !0), i = Math.min(r, c.bytes.length - c.pos);
3028
+ new Uint8Array(T.buffer).set(c.bytes.subarray(c.pos, c.pos + i), n), c.pos += i, u += i;
2980
3029
  }
2981
- return o.setUint32(r, c, !0), i;
3030
+ return s.setUint32(r, u, !0), i;
2982
3031
  },
2983
- fd_seek: (e, t, n, r, o) => {
2984
- if (!C) return a;
2985
- if (e <= 2) return d;
2986
- let c = U.get(e);
2987
- if (!c || c.type !== "file") return a;
2988
- let l, u, f;
2989
- typeof t == "bigint" ? (l = Number(t), u = n, f = r) : (l = t, u = r, f = o);
2990
- let p = c.pos;
3032
+ fd_seek: (e, t, n, r, a) => {
3033
+ if (!T) return o;
3034
+ if (e <= 2) return f;
3035
+ let s = G.get(e);
3036
+ if (!s) return o;
3037
+ if (s.type === "dev_tty" || s.type === "dev_null" || s.type === "dev_zero" || s.type === "dev_urandom") return f;
3038
+ if (s.type !== "file") return o;
3039
+ let l, u, d;
3040
+ typeof t == "bigint" ? (l = Number(t), u = n, d = r) : (l = t, u = r, d = a);
3041
+ let p = s.pos;
2991
3042
  if (u === 0) p = l;
2992
- else if (u === 1) p = c.pos + l;
2993
- else if (u === 2) p = c.bytes.length + l;
2994
- else return s;
2995
- return p < 0 ? s : (c.pos = p, f && new DataView(C.buffer).setBigUint64(f, BigInt(c.pos), !0), i);
3043
+ else if (u === 1) p = s.pos + l;
3044
+ else if (u === 2) p = s.bytes.length + l;
3045
+ else return c;
3046
+ return p < 0 ? c : (s.pos = p, d && new DataView(T.buffer).setBigUint64(d, BigInt(s.pos), !0), i);
2996
3047
  },
2997
3048
  fd_tell: (e, t) => {
2998
- if (!C) return a;
2999
- let n = U.get(e);
3000
- return !n || n.type !== "file" ? a : (new DataView(C.buffer).setBigUint64(t, BigInt(n.pos), !0), i);
3049
+ if (!T) return o;
3050
+ let n = G.get(e);
3051
+ return !n || n.type !== "file" ? o : (new DataView(T.buffer).setBigUint64(t, BigInt(n.pos), !0), i);
3001
3052
  },
3002
3053
  fd_close: (e) => {
3003
3054
  if (e <= 2) return i;
3004
- let t = U.get(e);
3005
- return t ? (ne(t), U.delete(e), i) : a;
3055
+ let t = G.get(e);
3056
+ return t ? (t.type === "file" && Y(t), G.delete(e), K.delete(e), i) : o;
3006
3057
  },
3007
3058
  fd_sync: (e) => {
3008
- let t = U.get(e);
3009
- return t && ne(t), i;
3059
+ let t = G.get(e);
3060
+ return t && Y(t), i;
3010
3061
  },
3011
3062
  fd_datasync: (e) => {
3012
- let t = U.get(e);
3013
- return t && ne(t), i;
3063
+ let t = G.get(e);
3064
+ return t && Y(t), i;
3014
3065
  },
3015
3066
  fd_prestat_get: (e, t) => {
3016
- if (!C) return a;
3017
- let n = U.get(e);
3018
- if (!n || n.type !== "preopen") return a;
3019
- let r = new DataView(C.buffer), o = b.encode(n.guestName);
3020
- return r.setUint8(t, 0), r.setUint32(t + 4, o.length, !0), i;
3067
+ if (!T) return o;
3068
+ let n = G.get(e);
3069
+ if (!n || n.type !== "preopen") return o;
3070
+ let r = new DataView(T.buffer), a = b.encode(n.guestName);
3071
+ return r.setUint8(t, 0), r.setUint32(t + 4, a.length, !0), i;
3021
3072
  },
3022
3073
  fd_prestat_dir_name: (e, t, n) => {
3023
- if (!C) return a;
3024
- let r = U.get(e);
3025
- if (!r || r.type !== "preopen") return a;
3026
- let o = b.encode(r.guestName);
3027
- return new Uint8Array(C.buffer, t, Math.min(n, o.length)).set(o.subarray(0, n)), i;
3074
+ if (!T) return o;
3075
+ let r = G.get(e);
3076
+ if (!r || r.type !== "preopen") return o;
3077
+ let a = b.encode(r.guestName);
3078
+ return new Uint8Array(T.buffer, t, Math.min(n, a.length)).set(a.subarray(0, n)), i;
3028
3079
  },
3029
3080
  fd_fdstat_get: (e, t) => {
3030
- if (!C) return a;
3031
- let n = new DataView(C.buffer), r = f;
3032
- if (e <= 2) r = p;
3081
+ if (!T) return o;
3082
+ let n = new DataView(T.buffer), r = p;
3083
+ if (e <= 2) r = m;
3033
3084
  else {
3034
- let t = U.get(e);
3035
- if (!t) return a;
3036
- r = t.type === "preopen" || t.type === "dir" ? m : h;
3085
+ let t = G.get(e);
3086
+ if (!t) return o;
3087
+ r = t.type === "dev_null" || t.type === "dev_zero" || t.type === "dev_urandom" || t.type === "dev_tty" ? m : t.type === "preopen" || t.type === "dir" ? h : g;
3037
3088
  }
3038
3089
  for (let e = 0; e < 24; e++) n.setUint8(t + e, 0);
3039
- return n.setUint8(t, r), n.setBigUint64(t + 8, 18446744073709551615n, !0), n.setBigUint64(t + 16, 18446744073709551615n, !0), i;
3090
+ n.setUint8(t, r);
3091
+ let a = K.get(e) || (G.get(e)?.append ? C : 0);
3092
+ return n.setUint16(t + 2, a, !0), n.setBigUint64(t + 8, 18446744073709551615n, !0), n.setBigUint64(t + 16, 18446744073709551615n, !0), i;
3093
+ },
3094
+ fd_fdstat_set_flags: (e, t) => {
3095
+ if (!T || e > 2 && !G.has(e)) return o;
3096
+ K.set(e, t);
3097
+ let n = G.get(e);
3098
+ return n && (n.append = !!(t & C)), (e === 0 || e === 2 || n && n.type === "dev_tty") && t & w && L(), i;
3040
3099
  },
3041
- fd_fdstat_set_flags: () => i,
3042
3100
  fd_filestat_get: (e, t) => {
3043
- if (!C) return a;
3044
- let n = new DataView(C.buffer);
3101
+ if (!T) return o;
3102
+ let n = new DataView(T.buffer);
3045
3103
  for (let e = 0; e < 64; e++) n.setUint8(t + e, 0);
3046
- if (e <= 2) return n.setUint8(t + 16, p), i;
3047
- let r = U.get(e);
3048
- if (!r) return a;
3049
- let o = r.type === "preopen" || r.type === "dir";
3050
- return n.setUint8(t + 16, o ? m : h), n.setBigUint64(t + 24, 1n, !0), n.setBigUint64(t + 32, BigInt(r.bytes ? r.bytes.length : 0), !0), i;
3104
+ if (e <= 2) return n.setUint8(t + 16, m), i;
3105
+ let r = G.get(e);
3106
+ if (!r) return o;
3107
+ if (r.type === "dev_null" || r.type === "dev_zero" || r.type === "dev_urandom" || r.type === "dev_tty") return n.setUint8(t + 16, m), n.setBigUint64(t + 24, 1n, !0), i;
3108
+ let a = r.type === "preopen" || r.type === "dir";
3109
+ return n.setUint8(t + 16, a ? h : g), n.setBigUint64(t + 24, 1n, !0), n.setBigUint64(t + 32, BigInt(r.bytes ? r.bytes.length : 0), !0), i;
3051
3110
  },
3052
- path_open: (e, t, r, s, d, f, p, m, h) => {
3053
- if (!C || !z) return a;
3054
- let y = W(e, n.decode(new Uint8Array(C.buffer, r, s)));
3055
- if (!y) return a;
3056
- let w = z.stat(y), T = w !== null;
3057
- if (d & v && d & g && T) return o;
3058
- if (d & _) {
3059
- if (!T) return l;
3060
- if (!w.isDirectory) return u;
3061
- let e = H++;
3062
- return U.set(e, {
3063
- type: "dir",
3111
+ path_open: (e, t, r, a, c, f, p, m, h) => {
3112
+ if (!T || !U) return o;
3113
+ let g = J(e, n.decode(new Uint8Array(T.buffer, r, a)));
3114
+ if (!g) return o;
3115
+ let y = g.replace(/\/+/g, "/").replace(/\/$/, "") || "/";
3116
+ if (y === "/dev/null") {
3117
+ let e = ne++;
3118
+ return G.set(e, {
3119
+ type: "dev_null",
3120
+ path: "/dev/null"
3121
+ }), new DataView(T.buffer).setUint32(h, e, !0), i;
3122
+ }
3123
+ if (y === "/dev/zero") {
3124
+ let e = ne++;
3125
+ return G.set(e, {
3126
+ type: "dev_zero",
3127
+ path: "/dev/zero"
3128
+ }), new DataView(T.buffer).setUint32(h, e, !0), i;
3129
+ }
3130
+ if (y === "/dev/urandom" || y === "/dev/random") {
3131
+ let e = ne++;
3132
+ return G.set(e, {
3133
+ type: "dev_urandom",
3064
3134
  path: y
3065
- }), new DataView(C.buffer).setUint32(h, e, !0), i;
3135
+ }), new DataView(T.buffer).setUint32(h, e, !0), i;
3136
+ }
3137
+ if (y === "/dev/tty") {
3138
+ L();
3139
+ let e = ne++;
3140
+ return G.set(e, {
3141
+ type: "dev_tty",
3142
+ path: "/dev/tty"
3143
+ }), new DataView(T.buffer).setUint32(h, e, !0), i;
3066
3144
  }
3067
- if (T && w.isDirectory) return c;
3068
- if (!T && !(d & g)) return l;
3069
- let E = new Uint8Array(), D = !1;
3070
- if (T && !(d & x)) {
3071
- let e = z.getFileByPath(y);
3072
- e != null && (E = typeof e == "string" ? b.encode(e) : new Uint8Array(this._contentToBytes(e)));
3073
- } else D = !0;
3074
- let O = H++;
3075
- return U.set(O, {
3145
+ let w = U.stat(g), E = w !== null;
3146
+ if (c & x && c & _ && E) return s;
3147
+ if (c & v) {
3148
+ if (!E) return u;
3149
+ if (!w.isDirectory) return d;
3150
+ let e = ne++;
3151
+ return G.set(e, {
3152
+ type: "dir",
3153
+ path: g
3154
+ }), new DataView(T.buffer).setUint32(h, e, !0), i;
3155
+ }
3156
+ if (E && w.isDirectory) return l;
3157
+ if (!E && !(c & _)) return u;
3158
+ let D = new Uint8Array(), O = !1;
3159
+ if (E && !(c & S)) {
3160
+ let e = U.getFileByPath(g);
3161
+ e != null && (D = typeof e == "string" ? b.encode(e) : new Uint8Array(this._contentToBytes(e)));
3162
+ } else O = !0;
3163
+ let k = ne++;
3164
+ return G.set(k, {
3076
3165
  type: "file",
3077
- path: y,
3078
- bytes: E,
3079
- pos: m & S ? E.length : 0,
3080
- append: !!(m & S),
3081
- dirty: D
3082
- }), new DataView(C.buffer).setUint32(h, O, !0), i;
3166
+ path: g,
3167
+ bytes: D,
3168
+ pos: m & C ? D.length : 0,
3169
+ append: !!(m & C),
3170
+ dirty: O
3171
+ }), new DataView(T.buffer).setUint32(h, k, !0), i;
3083
3172
  },
3084
- path_filestat_get: (e, t, r, o, s) => {
3085
- if (!C || !z) return a;
3086
- let c = W(e, n.decode(new Uint8Array(C.buffer, r, o)));
3087
- if (!c) return a;
3088
- let u = z.stat(c);
3089
- if (!u) return l;
3090
- let d = new DataView(C.buffer);
3091
- for (let e = 0; e < 64; e++) d.setUint8(s + e, 0);
3092
- return d.setUint8(s + 16, u.isDirectory ? m : h), d.setBigUint64(s + 24, 1n, !0), d.setBigUint64(s + 32, BigInt(z.getSize(c) || 0), !0), i;
3173
+ path_filestat_get: (e, t, r, a, s) => {
3174
+ if (!T || !U) return o;
3175
+ let c = J(e, n.decode(new Uint8Array(T.buffer, r, a)));
3176
+ if (!c) return o;
3177
+ let l = c.replace(/\/+/g, "/").replace(/\/$/, "") || "/";
3178
+ if (l === "/dev/null" || l === "/dev/zero" || l === "/dev/urandom" || l === "/dev/random" || l === "/dev/tty") {
3179
+ let e = new DataView(T.buffer);
3180
+ for (let t = 0; t < 64; t++) e.setUint8(s + t, 0);
3181
+ return e.setUint8(s + 16, m), e.setBigUint64(s + 24, 1n, !0), i;
3182
+ }
3183
+ let d = U.stat(c);
3184
+ if (!d) return u;
3185
+ let f = new DataView(T.buffer);
3186
+ for (let e = 0; e < 64; e++) f.setUint8(s + e, 0);
3187
+ return f.setUint8(s + 16, d.isDirectory ? h : g), f.setBigUint64(s + 24, 1n, !0), f.setBigUint64(s + 32, BigInt(U.getSize(c) || 0), !0), i;
3093
3188
  },
3094
3189
  path_create_directory: (e, t, r) => {
3095
- if (!C || !z) return a;
3096
- let o = W(e, n.decode(new Uint8Array(C.buffer, t, r)));
3097
- if (!o) return a;
3190
+ if (!T || !U) return o;
3191
+ let a = J(e, n.decode(new Uint8Array(T.buffer, t, r)));
3192
+ if (!a) return o;
3098
3193
  try {
3099
- return z.setFileByPath(o, {}, !0), i;
3194
+ return U.setFileByPath(a, {}, !0), i;
3100
3195
  } catch {
3101
- return s;
3196
+ return c;
3102
3197
  }
3103
3198
  },
3104
3199
  path_unlink_file: (e, t, r) => {
3105
- if (!C || !z) return a;
3106
- let o = W(e, n.decode(new Uint8Array(C.buffer, t, r)));
3107
- if (!o || !z.exists(o)) return l;
3200
+ if (!T || !U) return o;
3201
+ let a = J(e, n.decode(new Uint8Array(T.buffer, t, r)));
3202
+ if (!a || !U.exists(a)) return u;
3108
3203
  try {
3109
- return z.deleteFileByPath(o), i;
3204
+ return U.deleteFileByPath(a), i;
3110
3205
  } catch {
3111
- return s;
3206
+ return c;
3112
3207
  }
3113
3208
  },
3114
3209
  path_remove_directory: (e, t, r) => {
3115
- if (!C || !z) return a;
3116
- let o = W(e, n.decode(new Uint8Array(C.buffer, t, r)));
3117
- if (!o || !z.exists(o)) return l;
3210
+ if (!T || !U) return o;
3211
+ let a = J(e, n.decode(new Uint8Array(T.buffer, t, r)));
3212
+ if (!a || !U.exists(a)) return u;
3118
3213
  try {
3119
- return z.deleteFileByPath(o), i;
3214
+ return U.deleteFileByPath(a), i;
3120
3215
  } catch {
3121
- return s;
3216
+ return c;
3122
3217
  }
3123
3218
  },
3124
- path_rename: (e, t, r, o, c, u) => {
3125
- if (!C || !z) return a;
3126
- let d = n.decode(new Uint8Array(C.buffer, t, r)), f = n.decode(new Uint8Array(C.buffer, c, u)), p = W(e, d), m = W(o, f);
3127
- if (!p || !m) return a;
3128
- if (!z.exists(p)) return l;
3129
- for (let e of U.values()) e.path === p && (ne(e), e.path = m);
3219
+ path_rename: (e, t, r, a, s, l) => {
3220
+ if (!T || !U) return o;
3221
+ let d = n.decode(new Uint8Array(T.buffer, t, r)), f = n.decode(new Uint8Array(T.buffer, s, l)), p = J(e, d), m = J(a, f);
3222
+ if (!p || !m) return o;
3223
+ if (!U.exists(p)) return u;
3224
+ for (let e of G.values()) e.path === p && (Y(e), e.path = m);
3130
3225
  try {
3131
- let e = z.getFileByPath(p);
3132
- return z.setFileByPath(m, e, !0), z.deleteFileByPath(p), i;
3226
+ let e = U.getFileByPath(p);
3227
+ return U.setFileByPath(m, e, !0), U.deleteFileByPath(p), i;
3133
3228
  } catch {
3134
- return s;
3229
+ return c;
3135
3230
  }
3136
3231
  },
3137
3232
  proc_exit: (e) => {
@@ -3141,88 +3236,156 @@ var j, M, N, P, F, I, L, R, ee, z, B = e((() => {
3141
3236
  };
3142
3237
  },
3143
3238
  args_sizes_get: (e, t) => {
3144
- if (!C) return s;
3145
- let n = [this.script, ...this.arguments || []], r = new DataView(C.buffer);
3239
+ if (!T) return c;
3240
+ let n = [this.script, ...this.arguments || []], r = new DataView(T.buffer);
3146
3241
  return r.setUint32(e, n.length, !0), r.setUint32(t, n.reduce((e, t) => e + b.encode(t).length + 1, 0), !0), i;
3147
3242
  },
3148
3243
  args_get: (e, t) => {
3149
- if (!C) return s;
3150
- let n = [this.script, ...this.arguments || []], r = new DataView(C.buffer), a = t;
3244
+ if (!T) return c;
3245
+ let n = [this.script, ...this.arguments || []], r = new DataView(T.buffer), a = t;
3151
3246
  for (let t = 0; t < n.length; t++) {
3152
3247
  r.setUint32(e + t * 4, a, !0);
3153
3248
  let i = b.encode(n[t] + "\0");
3154
- new Uint8Array(C.buffer).set(i, a), a += i.length;
3249
+ new Uint8Array(T.buffer).set(i, a), a += i.length;
3155
3250
  }
3156
3251
  return i;
3157
3252
  },
3158
3253
  environ_sizes_get: (e, t) => {
3159
- if (!C) return s;
3160
- let n = new DataView(C.buffer);
3161
- n.setUint32(e, G.length, !0);
3162
- let r = G.reduce((e, t) => e + b.encode(t).length + 1, 0);
3254
+ if (!T) return c;
3255
+ let n = new DataView(T.buffer);
3256
+ n.setUint32(e, X.length, !0);
3257
+ let r = X.reduce((e, t) => e + b.encode(t).length + 1, 0);
3163
3258
  return n.setUint32(t, r, !0), i;
3164
3259
  },
3165
3260
  environ_get: (e, t) => {
3166
- if (!C) return s;
3167
- let n = new DataView(C.buffer), r = t;
3168
- for (let t = 0; t < G.length; t++) {
3261
+ if (!T) return c;
3262
+ let n = new DataView(T.buffer), r = t;
3263
+ for (let t = 0; t < X.length; t++) {
3169
3264
  n.setUint32(e + t * 4, r, !0);
3170
- let i = b.encode(G[t] + "\0");
3171
- new Uint8Array(C.buffer).set(i, r), r += i.length;
3265
+ let i = b.encode(X[t] + "\0");
3266
+ new Uint8Array(T.buffer).set(i, r), r += i.length;
3172
3267
  }
3173
3268
  return i;
3174
3269
  },
3175
3270
  clock_time_get: (e, t, n) => {
3176
- if (C) {
3271
+ if (T) {
3177
3272
  let e = BigInt(Date.now()) * 1000000n;
3178
- new DataView(C.buffer).setBigUint64(n, e, !0);
3273
+ new DataView(T.buffer).setBigUint64(n, e, !0);
3179
3274
  }
3180
3275
  return i;
3181
3276
  },
3182
3277
  random_get: (e, t) => {
3183
- if (C) {
3184
- let n = new Uint8Array(C.buffer, e, t);
3278
+ if (T) {
3279
+ let n = new Uint8Array(T.buffer, e, t);
3185
3280
  for (let e = 0; e < t; e++) n[e] = Math.random() * 256 | 0;
3186
3281
  }
3187
3282
  return i;
3283
+ },
3284
+ clock_nanosleep: (e, t, n, r, a) => {
3285
+ if (!T) return o;
3286
+ let s = new DataView(T.buffer).getBigUint64(n, !0), c = 0;
3287
+ if (t & 1) {
3288
+ let e = BigInt(Date.now()) * 1000000n;
3289
+ c = s > e ? Number((s - e) / 1000000n) : 0;
3290
+ } else c = Number(s / 1000000n);
3291
+ return D && c > 0 ? (typeof E?.exports?.asyncify_get_state == "function" ? E.exports.asyncify_get_state() : 0) === 2 ? (E.exports.asyncify_stop_rewind(), i) : (E.exports.asyncify_start_unwind(O), k = new Promise((e) => setTimeout(e, Math.max(1, c))), i) : i;
3292
+ },
3293
+ poll_oneoff: (e, t, n, r) => {
3294
+ if (!T) return o;
3295
+ let a = new DataView(T.buffer);
3296
+ if (D) {
3297
+ if ((typeof E?.exports?.asyncify_get_state == "function" ? E.exports.asyncify_get_state() : 0) === 2) {
3298
+ E.exports.asyncify_stop_rewind();
3299
+ let o = 0;
3300
+ for (let r = 0; r < n; r++) {
3301
+ let n = e + r * 48, s = a.getBigUint64(n, !0), c = a.getUint8(n + 8), l = t + o * 32;
3302
+ a.setBigUint64(l, s, !0), a.setUint16(l + 8, i, !0), a.setUint8(l + 10, c);
3303
+ for (let e = 11; e < 32; e++) a.setUint8(l + e, 0);
3304
+ c === 1 && a.setBigUint64(l + 16, BigInt(z.length), !0), o++;
3305
+ }
3306
+ return a.setUint32(r, o, !0), i;
3307
+ }
3308
+ let o = 0, s = Infinity;
3309
+ for (let t = 0; t < n; t++) {
3310
+ let n = e + t * 48, r = a.getUint8(n + 8);
3311
+ if (r === 0) {
3312
+ let e = a.getBigUint64(n + 24, !0), t = a.getUint16(n + 40, !0), r = 0;
3313
+ if (t & 1) {
3314
+ let t = BigInt(Date.now()) * 1000000n;
3315
+ r = e > t ? Number((e - t) / 1000000n) : 0;
3316
+ } else r = Number(e / 1000000n);
3317
+ r < s && (s = r);
3318
+ } else if (r === 1) {
3319
+ let e = a.getUint32(n + 16, !0), t = G.get(e), r = !!(t && t.type === "dev_tty");
3320
+ (e === 0 || e === 2 || r) && L(), (e === 0 || I && e === 2 || r) && z.length > 0 && o++;
3321
+ } else r === 2 && o++;
3322
+ }
3323
+ if (o > 0 || s === 0) {
3324
+ let o = 0;
3325
+ for (let r = 0; r < n; r++) {
3326
+ let n = e + r * 48, c = a.getBigUint64(n, !0), l = a.getUint8(n + 8), u = !1;
3327
+ if (l === 0 && s === 0) u = !0;
3328
+ else if (l === 1) {
3329
+ let e = a.getUint32(n + 16, !0), t = G.get(e), r = !!(t && t.type === "dev_tty");
3330
+ (e === 0 || I && e === 2 || r) && z.length > 0 && (u = !0);
3331
+ } else l === 2 && (u = !0);
3332
+ if (u) {
3333
+ let e = t + o * 32;
3334
+ a.setBigUint64(e, c, !0), a.setUint16(e + 8, i, !0), a.setUint8(e + 10, l);
3335
+ for (let t = 11; t < 32; t++) a.setUint8(e + t, 0);
3336
+ l === 1 && a.setBigUint64(e + 16, BigInt(z.length), !0), o++;
3337
+ }
3338
+ }
3339
+ return a.setUint32(r, o, !0), i;
3340
+ }
3341
+ return E.exports.asyncify_start_unwind(O), k = new Promise((e) => {
3342
+ let t = null;
3343
+ A = () => {
3344
+ t && clearTimeout(t), A = null, e();
3345
+ }, s !== Infinity && (t = setTimeout(() => {
3346
+ A = null, e();
3347
+ }, Math.max(1, s)));
3348
+ }), a.setUint32(r, 0, !0), i;
3349
+ }
3350
+ return a.setUint32(r, 0, !0), i;
3188
3351
  }
3189
3352
  }, { get(e, t) {
3190
3353
  return t in e ? e[t] : () => 0;
3191
- } }), ie = (e) => {
3192
- if (!C || !e) return "";
3354
+ } }), ae = (e) => {
3355
+ if (!T || !e) return "";
3193
3356
  try {
3194
- let t = new DataView(C.buffer).getUint32(e - 4, !0), n = new Uint16Array(C.buffer, e, t >>> 1);
3357
+ let t = new DataView(T.buffer).getUint32(e - 4, !0), n = new Uint16Array(T.buffer, e, t >>> 1);
3195
3358
  return String.fromCharCode(...n);
3196
3359
  } catch {
3197
3360
  return "";
3198
3361
  }
3199
- }, q = {
3200
- wasi_snapshot_preview1: K,
3201
- wasi_unstable: K,
3362
+ }, oe = {
3363
+ wasi_snapshot_preview1: ie,
3364
+ wasi_unstable: ie,
3202
3365
  env: new Proxy({
3203
3366
  print: (e, t) => {
3204
- C && P(1, n.decode(new Uint8Array(C.buffer, e, t)));
3367
+ T && R(1, n.decode(new Uint8Array(T.buffer, e, t)));
3205
3368
  },
3206
3369
  eprint: (e, t) => {
3207
- C && P(2, n.decode(new Uint8Array(C.buffer, e, t)));
3370
+ T && R(2, n.decode(new Uint8Array(T.buffer, e, t)));
3208
3371
  },
3209
3372
  log: (e) => {
3210
- P(1, ie(e) + "\n");
3373
+ R(1, ae(e) + "\n");
3211
3374
  },
3212
3375
  logi: (e) => {
3213
- P(1, String(e) + "\n");
3376
+ R(1, String(e) + "\n");
3214
3377
  },
3215
3378
  logf: (e) => {
3216
- P(1, String(e) + "\n");
3379
+ R(1, String(e) + "\n");
3217
3380
  },
3218
3381
  trace: (e, t, ...n) => {
3219
3382
  let r = t > 0 ? " " + n.slice(0, t).join(", ") : "";
3220
- P(1, `trace: ${ie(e)}${r}\n`);
3383
+ R(1, `trace: ${ae(e)}${r}\n`);
3221
3384
  },
3222
3385
  seed: () => Date.now() * Math.random(),
3223
3386
  abort: (e, t, n, r) => {
3224
- let i = ie(e), a = ie(t);
3225
- throw (i || a) && P(2, `abort: ${i || "aborted"} at ${a || this.script}:${n || 0}:${r || 0}\n`), this.exitCode = 134, {
3387
+ let i = ae(e), a = ae(t);
3388
+ throw (i || a) && R(2, `abort: ${i || "aborted"} at ${a || this.script}:${n || 0}:${r || 0}\n`), this.exitCode = 134, {
3226
3389
  _wasmExit: !0,
3227
3390
  code: 134
3228
3391
  };
@@ -3238,66 +3401,64 @@ var j, M, N, P, F, I, L, R, ee, z, B = e((() => {
3238
3401
  initial: 1,
3239
3402
  maximum: 256
3240
3403
  });
3241
- C = t, q[e.module] || (q[e.module] = {}), q[e.module][e.name] = t;
3404
+ T = t, oe[e.module] || (oe[e.module] = {}), oe[e.module][e.name] = t;
3242
3405
  }
3243
- if (w = await WebAssembly.instantiate(t, q), w.exports.memory && (C = w.exports.memory), T = !!(w.exports.asyncify_start_unwind && w.exports.asyncify_stop_unwind), T && C) {
3406
+ if (E = await WebAssembly.instantiate(t, oe), E.exports.memory && (T = E.exports.memory), D = !!(E.exports.asyncify_start_unwind && E.exports.asyncify_stop_unwind), D && T) {
3244
3407
  try {
3245
- E = C.grow(1) * 65536;
3408
+ O = T.grow(1) * 65536;
3246
3409
  } catch {
3247
- E = 16;
3410
+ O = 16;
3248
3411
  }
3249
- let e = E + 8, t = E + 65536 - 8;
3250
- new Int32Array(C.buffer, E, 2).set([e, t]);
3412
+ let e = O + 8, t = O + 65536 - 8;
3413
+ new Int32Array(T.buffer, O, 2).set([e, t]);
3251
3414
  }
3252
- if (N) {
3253
- this._enterAltScreen();
3415
+ typeof E.exports.set_terminal_size == "function" && L(), I && this._enterAltScreen();
3416
+ let n = this.stdout && this.stdout.columns || this.context && typeof this.context.getVar == "function" && parseInt(this.context.getVar("COLUMNS"), 10) || 80, r = this.stdout && this.stdout.rows || this.context && typeof this.context.getVar == "function" && parseInt(this.context.getVar("LINES"), 10) || 24;
3417
+ if (typeof E.exports.set_terminal_size == "function") try {
3418
+ E.exports.set_terminal_size(n, r);
3419
+ } catch {}
3420
+ N = () => {
3254
3421
  let e = this.stdout && this.stdout.columns || this.context && typeof this.context.getVar == "function" && parseInt(this.context.getVar("COLUMNS"), 10) || 80, t = this.stdout && this.stdout.rows || this.context && typeof this.context.getVar == "function" && parseInt(this.context.getVar("LINES"), 10) || 24;
3255
- if (typeof w.exports.set_terminal_size == "function") try {
3256
- w.exports.set_terminal_size(e, t);
3422
+ if (typeof E?.exports?.set_terminal_size == "function") try {
3423
+ E.exports.set_terminal_size(e, t);
3257
3424
  } catch {}
3258
- j = () => {
3259
- let e = this.stdout && this.stdout.columns || 80, t = this.stdout && this.stdout.rows || 24;
3260
- if (typeof w?.exports?.set_terminal_size == "function") try {
3261
- w.exports.set_terminal_size(e, t);
3262
- } catch {}
3263
- }, this.stdout && typeof this.stdout.on == "function" && this.stdout.on("resize", j), this.stdinStream && typeof this.stdinStream.on == "function" && this.stdinStream.on("resize", j);
3264
- }
3265
- let n = w.exports._start || w.exports.__wasi_command || w.exports.main || w.exports.run;
3266
- if (n) try {
3267
- let e = n();
3268
- for (e && typeof e.then == "function" && (e = await e); T && typeof w.exports.asyncify_get_state == "function" && w.exports.asyncify_get_state() === 1;) w.exports.asyncify_stop_unwind(), D &&= (await D, null), w.exports.asyncify_start_rewind(E), e = n(), e && typeof e.then == "function" && (e = await e);
3425
+ }, this.stdout && typeof this.stdout.on == "function" && this.stdout.on("resize", N), this.stdinStream && typeof this.stdinStream.on == "function" && this.stdinStream.on("resize", N);
3426
+ let i = E.exports._start || E.exports.__wasi_command || E.exports.main || E.exports.run;
3427
+ if (i) try {
3428
+ let e = i();
3429
+ for (e && typeof e.then == "function" && (e = await e); D && typeof E.exports.asyncify_get_state == "function" && E.exports.asyncify_get_state() === 1;) E.exports.asyncify_stop_unwind(), k &&= (await k, null), E.exports.asyncify_start_rewind(O), e = i(), e && typeof e.then == "function" && (e = await e);
3269
3430
  } catch (e) {
3270
3431
  (!e || !e._wasmExit) && (this.stdErr = `${this.script}: runtime error: ${e?.message || String(e)}`, this.exitCode = 1);
3271
3432
  }
3272
3433
  else {
3273
- let e = Object.entries(w.exports).filter(([, e]) => typeof e == "function").map(([e]) => e), t = e.length > 0 ? ` (module is a library exporting: ${e.join(", ")})` : "";
3434
+ let e = Object.entries(E.exports).filter(([, e]) => typeof e == "function").map(([e]) => e), t = e.length > 0 ? ` (module is a library exporting: ${e.join(", ")})` : "";
3274
3435
  this.stdErr = `${this.script}: no CLI entry point found (expected _start, main, or run)${t}`, this.exitCode = 1;
3275
3436
  }
3276
3437
  } catch (e) {
3277
3438
  (!e || !e._wasmExit) && (this.stdErr = `${this.script}: ${e?.message || String(e)}`, this.exitCode = 1);
3278
3439
  } finally {
3279
- N && this._exitAltScreen(), N && M && (this.stdinStream && typeof this.stdinStream.off == "function" && this.stdinStream.off("data", M), this.stdin && typeof this.stdin.off == "function" && this.stdin.off("data", M)), j && (this.stdout && typeof this.stdout.off == "function" && this.stdout.off("resize", j), this.stdinStream && typeof this.stdinStream.off == "function" && this.stdinStream.off("resize", j)), this._externalKeyHandler = null;
3280
- for (let e of U.values()) ne(e);
3440
+ I && this._exitAltScreen(), I && P && (this.stdinStream && typeof this.stdinStream.off == "function" && this.stdinStream.off("data", P), this.stdin && typeof this.stdin.off == "function" && this.stdin.off("data", P)), N && (this.stdout && typeof this.stdout.off == "function" && this.stdout.off("resize", N), this.stdinStream && typeof this.stdinStream.off == "function" && this.stdinStream.off("resize", N)), this._externalKeyHandler = null;
3441
+ for (let e of G.values()) Y(e);
3281
3442
  }
3282
- F();
3283
- let J = this.arguments || [];
3443
+ ee();
3444
+ let se = this.arguments || [];
3284
3445
  if (!(this.result && this.result.getStdOutput && this.result.getStdOutput().length > 0) && (this.exitCode === 0 || this.exitCode === void 0)) {
3285
3446
  let t = (this.script || "wasm").split("/").pop(), n = Object.assign({
3286
3447
  name: t,
3287
3448
  version: "wasi",
3288
3449
  description: `WebAssembly WASI binary (${this.script})`
3289
3450
  }, this._pkgMeta || {});
3290
- if (J.includes("--help") || J.includes("-h")) {
3291
- let r = k(e);
3292
- for (let e of A(t, n, r)) this.stdOut = e;
3293
- } else (J.includes("--version") || J.includes("-V") || J.includes("-v")) && (this.stdOut = `${t} (${n.name} ${n.version} wasm)`);
3451
+ if (se.includes("--help") || se.includes("-h")) {
3452
+ let r = j(e);
3453
+ for (let e of M(t, n, r)) this.stdOut = e;
3454
+ } else (se.includes("--version") || se.includes("-V") || se.includes("-v")) && (this.stdOut = `${t} (${n.name} ${n.version} wasm)`);
3294
3455
  }
3295
3456
  }
3296
- }, w = /* @__PURE__ */ new Map();
3297
- function T(e, t) {
3457
+ }, E = /* @__PURE__ */ new Map();
3458
+ function D(e, t) {
3298
3459
  if (!e || !e.exists(t)) return null;
3299
3460
  if (e.isRealFilesystem) try {
3300
- let n = K();
3461
+ let n = q();
3301
3462
  return new Uint8Array(n.readFileSync(e.absolutePath(t)));
3302
3463
  } catch {}
3303
3464
  let n = e.getFileByPath(t);
@@ -3321,12 +3482,12 @@ var j, M, N, P, F, I, L, R, ee, z, B = e((() => {
3321
3482
  }
3322
3483
  return null;
3323
3484
  }
3324
- function E(e, t, n, i = "application/octet-stream") {
3485
+ function O(e, t, n, i = "application/octet-stream") {
3325
3486
  let a = n instanceof Uint8Array ? n : new Uint8Array(n), o = new Uint8Array(a.byteLength);
3326
3487
  o.set(a);
3327
3488
  let s = new r(o.buffer, i);
3328
3489
  if (e.isRealFilesystem) try {
3329
- let n = K(), r = ie(), i = e.absolutePath(t);
3490
+ let n = q(), r = J(), i = e.absolutePath(t);
3330
3491
  n.mkdirSync(r.dirname(i), { recursive: !0 }), n.writeFileSync(i, y.from(a.buffer, a.byteOffset, a.byteLength));
3331
3492
  return;
3332
3493
  } catch {
@@ -3341,7 +3502,7 @@ var j, M, N, P, F, I, L, R, ee, z, B = e((() => {
3341
3502
  }
3342
3503
  e.setFileByPath(t, s, !0);
3343
3504
  }
3344
- async function D(e, t, n = null) {
3505
+ async function k(e, t, n = null) {
3345
3506
  if (typeof n == "function") {
3346
3507
  let r = await n(e, t);
3347
3508
  if (r) return r;
@@ -3369,7 +3530,7 @@ var j, M, N, P, F, I, L, R, ee, z, B = e((() => {
3369
3530
  }
3370
3531
  throw Error(`Package '${e}' could not be loaded`);
3371
3532
  }
3372
- function O(e, t = !1) {
3533
+ function A(e, t = !1) {
3373
3534
  let n = {
3374
3535
  usage: null,
3375
3536
  options: []
@@ -3386,7 +3547,7 @@ var j, M, N, P, F, I, L, R, ee, z, B = e((() => {
3386
3547
  }
3387
3548
  return n;
3388
3549
  }
3389
- function k(e) {
3550
+ function j(e) {
3390
3551
  let t = {
3391
3552
  usage: null,
3392
3553
  options: [],
@@ -3407,12 +3568,12 @@ var j, M, N, P, F, I, L, R, ee, z, B = e((() => {
3407
3568
  i >= 32 && i <= 126 || i === 9 || i === 10 ? r += String.fromCharCode(i) : (r.length >= 4 && n.push(r), r = "");
3408
3569
  }
3409
3570
  r.length >= 4 && n.push(r);
3410
- let i = O(n.join("\n"), !0);
3571
+ let i = A(n.join("\n"), !0);
3411
3572
  t.usage = i.usage, t.options = i.options;
3412
3573
  } catch {}
3413
3574
  return t;
3414
3575
  }
3415
- function A(e, t = {}, n = null) {
3576
+ function M(e, t = {}, n = null) {
3416
3577
  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}`];
3417
3578
  t.details && u.push("", t.details), u.push("", "Options:");
3418
3579
  let d = n && n.options && n.options.length > 0 ? n.options : Array.isArray(t.options) ? t.options : [];
@@ -3420,8 +3581,8 @@ var j, M, N, P, F, I, L, R, ee, z, B = e((() => {
3420
3581
  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`));
3421
3582
  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;
3422
3583
  }
3423
- function j(e, t = {}, n = null) {
3424
- let r = Y(), i = (n || e.bin || e.name).toLowerCase();
3584
+ function N(e, t = {}, n = null) {
3585
+ let r = X(), i = (n || e.bin || e.name).toLowerCase();
3425
3586
  class a extends r {
3426
3587
  static get name() {
3427
3588
  return i;
@@ -3434,7 +3595,7 @@ var j, M, N, P, F, I, L, R, ee, z, B = e((() => {
3434
3595
  }
3435
3596
  async run() {
3436
3597
  let n = [...this.arguments || []], r = n.includes("--help") || n.includes("-h"), a = !r && (n.includes("--version") || n.includes("-V") || n.includes("-v"));
3437
- this._inspectedWasm = null, this._persistedWasmBytes = e.wasmPath ? T(this.context && this.context.fs || this.fs, e.wasmPath) : null, r && this._persistedWasmBytes && this._persistedWasmBytes.byteLength > 0 && (this._inspectedWasm = k(this._persistedWasmBytes));
3598
+ this._inspectedWasm = null, this._persistedWasmBytes = e.wasmPath ? D(this.context && this.context.fs || this.fs, e.wasmPath) : null, r && this._persistedWasmBytes && this._persistedWasmBytes.byteLength > 0 && (this._inspectedWasm = j(this._persistedWasmBytes));
3438
3599
  try {
3439
3600
  if ((e.type === "wasm" || e.type === "custom-wasm") && (this._persistedWasmBytes || e.wasmUrl)) {
3440
3601
  let i = this._persistedWasmBytes;
@@ -3443,7 +3604,7 @@ var j, M, N, P, F, I, L, R, ee, z, B = e((() => {
3443
3604
  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);
3444
3605
  } catch {}
3445
3606
  if (!i && e.wasmUrl && (i = await this._fetchWasmBytes(e.wasmUrl)), i) {
3446
- r && (this._inspectedWasm = k(i)), await this._runRawWasmBytes(i, n);
3607
+ r && (this._inspectedWasm = j(i)), await this._runRawWasmBytes(i, n);
3447
3608
  return;
3448
3609
  }
3449
3610
  } else {
@@ -3460,19 +3621,19 @@ var j, M, N, P, F, I, L, R, ee, z, B = e((() => {
3460
3621
  }
3461
3622
  let c, l;
3462
3623
  try {
3463
- c = await D(e.name, o, t.moduleLoader), l = c && c.default !== void 0 ? c.default : c, l && typeof l.then == "function" && (l = await l);
3624
+ c = await k(e.name, o, t.moduleLoader), l = c && c.default !== void 0 ? c.default : c, l && typeof l.then == "function" && (l = await l);
3464
3625
  } finally {
3465
3626
  s && (globalThis.fetch = s);
3466
3627
  }
3467
3628
  if (l instanceof Uint8Array || l instanceof ArrayBuffer) {
3468
3629
  let e = l instanceof Uint8Array ? l : new Uint8Array(l);
3469
- r && (this._inspectedWasm = k(e)), await this._runRawWasmBytes(e, n);
3630
+ r && (this._inspectedWasm = j(e)), await this._runRawWasmBytes(e, n);
3470
3631
  } else if (l && (l.wasmBytes instanceof Uint8Array || l.wasm instanceof Uint8Array)) {
3471
3632
  let e = l.wasmBytes || l.wasm;
3472
- r && (this._inspectedWasm = k(e)), await this._runRawWasmBytes(e, n);
3633
+ r && (this._inspectedWasm = j(e)), await this._runRawWasmBytes(e, n);
3473
3634
  } else if (typeof l == "function") await this._runFunctionOrEmscripten(l, n, r);
3474
3635
  else if (l && typeof l == "object") {
3475
- l.ready && await l.ready, r && (l.HEAPU8 instanceof Uint8Array || l.wasmBinary instanceof Uint8Array) && (this._inspectedWasm = k(l.wasmBinary || l.HEAPU8));
3636
+ l.ready && await l.ready, r && (l.HEAPU8 instanceof Uint8Array || l.wasmBinary instanceof Uint8Array) && (this._inspectedWasm = j(l.wasmBinary || l.HEAPU8));
3476
3637
  let t = l.main || l.run || l.callMain || l.exec;
3477
3638
  if (typeof t == "function") await this._invokeCliFunction(t.bind(l), n);
3478
3639
  else if (l.promised || typeof l.raw == "function" || typeof l.json == "function") {
@@ -3500,29 +3661,29 @@ var j, M, N, P, F, I, L, R, ee, z, B = e((() => {
3500
3661
  }
3501
3662
  }
3502
3663
  if (r || a) {
3503
- let t = this.result && this.result.getStdOutput ? this.result.getStdOutput() : [], n = t.map((e) => e.string).join("\n"), o = r ? O(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);
3664
+ let t = this.result && this.result.getStdOutput ? this.result.getStdOutput() : [], n = t.map((e) => e.string).join("\n"), o = r ? A(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);
3504
3665
  if (r) if (s) {
3505
3666
  let e = t.map((e) => e.string);
3506
3667
  this.result && Array.isArray(this.result.std) && (this.result.std.length = 0), this.exitCode = 0;
3507
3668
  for (let t of e) this.stdOut = t;
3508
3669
  } else {
3509
3670
  this.result && Array.isArray(this.result.std) && (this.result.std.length = 0), this.exitCode = 0;
3510
- for (let t of A(i, e, this._inspectedWasm)) this.stdOut = t;
3671
+ for (let t of M(i, e, this._inspectedWasm)) this.stdOut = t;
3511
3672
  }
3512
3673
  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;
3513
3674
  }
3514
3675
  }
3515
3676
  async _fetchWasmBytes(e) {
3516
- if (w.has(e)) return w.get(e);
3677
+ if (E.has(e)) return E.get(e);
3517
3678
  let n = t.fetch || (typeof fetch == "function" ? fetch : null);
3518
3679
  if (!n) throw Error("fetch is not available in this environment");
3519
3680
  let r = await n(e);
3520
3681
  if (!r || !r.ok) throw Error(`HTTP ${r ? r.status : "error"} fetching ${e}`);
3521
3682
  let i = new Uint8Array(await r.arrayBuffer());
3522
- return w.set(e, i), i;
3683
+ return E.set(e, i), i;
3523
3684
  }
3524
3685
  async _runRawWasmBytes(t, n) {
3525
- let r = new C(i, n, this.context);
3686
+ let r = new T(i, n, this.context);
3526
3687
  r.script = i, r.arguments = n, r.context = this.context, r.fs = this.fs, r._pkgMeta = e, this.stdin !== void 0 && (r.stdin = this.stdin), await r._runWasm(t);
3527
3688
  for (let e of r.result.getStdOutput()) e.type === "out" ? this.stdOut = e.string : e.type === "err" && (this.stdErr = e.string);
3528
3689
  this.exitCode = r.result.getExitCode();
@@ -3546,13 +3707,13 @@ var j, M, N, P, F, I, L, R, ee, z, B = e((() => {
3546
3707
  let n = t && t !== "." && !e.startsWith("/") ? `${t.replace(/\/+$/, "")}/${e}` : e, r = this.fs.getFileByPath(n) ?? this.fs.getFileByPath(e);
3547
3708
  return r == null ? null : typeof r == "string" ? r : new TextDecoder().decode(r);
3548
3709
  },
3549
- readBytes: (e) => T(this.fs, e),
3710
+ readBytes: (e) => D(this.fs, e),
3550
3711
  writeFile: (e, t, n) => {
3551
3712
  if (!this.fs) return;
3552
3713
  let r = n && n !== "." && !e.startsWith("/") ? `${n.replace(/\/+$/, "")}/${e}` : e;
3553
3714
  if (t instanceof Uint8Array || ArrayBuffer.isView(t)) {
3554
3715
  let e = r.endsWith(".wasm") ? "application/wasm" : "application/octet-stream";
3555
- E(this.fs, r, t, e);
3716
+ O(this.fs, r, t, e);
3556
3717
  } else this.fs.setFileByPath(r, String(t), !0);
3557
3718
  if (r.endsWith(".wasm") || r.endsWith(".wat")) try {
3558
3719
  this.context && this.context.fs ? this.context.fs.setMode(r, 493) : this.fs.setMode(r, 493);
@@ -3588,7 +3749,7 @@ var j, M, N, P, F, I, L, R, ee, z, B = e((() => {
3588
3749
  if (e && typeof e.status == "number") this.exitCode = e.status;
3589
3750
  else throw e;
3590
3751
  }
3591
- if (d && typeof d == "object") if (r && (d.wasmBinary instanceof Uint8Array || d.HEAPU8 instanceof Uint8Array) && (this._inspectedWasm = k(d.wasmBinary || d.HEAPU8)), typeof d.callMain == "function") {
3752
+ if (d && typeof d == "object") if (r && (d.wasmBinary instanceof Uint8Array || d.HEAPU8 instanceof Uint8Array) && (this._inspectedWasm = j(d.wasmBinary || d.HEAPU8)), typeof d.callMain == "function") {
3592
3753
  d.FS && c.size === 0 && (c = this._syncBrshToEmscriptenFs(d.FS, n));
3593
3754
  try {
3594
3755
  let e = await d.callMain(n);
@@ -3651,14 +3812,14 @@ var j, M, N, P, F, I, L, R, ee, z, B = e((() => {
3651
3812
  }), !t.loaded && typeof t.load == "function" && await t.load(e.coreUrl ? { coreURL: e.coreUrl } : void 0);
3652
3813
  let a = /* @__PURE__ */ new Set(), o = [];
3653
3814
  for (let e of n) if (!e.startsWith("-") && (o.push(e), this.fs.exists(e))) {
3654
- let n = T(this.fs, e);
3815
+ let n = D(this.fs, e);
3655
3816
  n && (await t.writeFile(e, n), a.add(e));
3656
3817
  }
3657
3818
  let s = await t.exec(n);
3658
3819
  for (let e of o) if (!a.has(e)) try {
3659
3820
  if (typeof t.readFile == "function") {
3660
3821
  let n = await t.readFile(e);
3661
- n && E(this.fs, e, n);
3822
+ n && O(this.fs, e, n);
3662
3823
  }
3663
3824
  } catch {}
3664
3825
  typeof s == "number" && s !== 0 && (this.exitCode = s, i.length === 0 && r.length > 0 && i.push(...r.splice(0, r.length)));
@@ -3675,7 +3836,7 @@ var j, M, N, P, F, I, L, R, ee, z, B = e((() => {
3675
3836
  let n = /* @__PURE__ */ new Set();
3676
3837
  if (!this.fs || !e || typeof e.writeFile != "function") return n;
3677
3838
  for (let r of t) if (!r.startsWith("-") && this.fs.exists(r)) {
3678
- let t = T(this.fs, r);
3839
+ let t = D(this.fs, r);
3679
3840
  if (t) try {
3680
3841
  e.writeFile(r, t), n.add(r);
3681
3842
  } catch {}
@@ -3688,7 +3849,7 @@ var j, M, N, P, F, I, L, R, ee, z, B = e((() => {
3688
3849
  let t = e.readFile(r);
3689
3850
  if (t) {
3690
3851
  let e = r.endsWith(".wasm") ? "application/wasm" : "application/octet-stream";
3691
- if (E(this.fs, r, t, e), r.endsWith(".wasm") || r.endsWith(".wat")) try {
3852
+ if (O(this.fs, r, t, e), r.endsWith(".wasm") || r.endsWith(".wat")) try {
3692
3853
  this.context && this.context.fs ? this.context.fs.setMode(r, 493) : this.fs.setMode(r, 493);
3693
3854
  } catch {}
3694
3855
  }
@@ -3698,8 +3859,8 @@ var j, M, N, P, F, I, L, R, ee, z, B = e((() => {
3698
3859
  }
3699
3860
  return a;
3700
3861
  }
3701
- C.readBytesFromFs = T, C.writeBytesToFs = E, C.loadModule = D, C.extractHelpFromText = O, C.inspectWasmBytes = k, C.formatWasmHelp = A, C.createGenericWasmCommand = j, C.createCommand = j, t.exports = C;
3702
- })), se = /* @__PURE__ */ t(((e, t) => {
3862
+ T.readBytesFromFs = D, T.writeBytesToFs = O, T.loadModule = k, T.extractHelpFromText = A, T.inspectWasmBytes = j, T.formatWasmHelp = M, T.createGenericWasmCommand = N, T.createCommand = N, t.exports = T;
3863
+ })), oe = /* @__PURE__ */ t(((e, t) => {
3703
3864
  var n = W(), r = class extends n {
3704
3865
  static get name() {
3705
3866
  return "test";
@@ -3784,7 +3945,7 @@ var j, M, N, P, F, I, L, R, ee, z, B = e((() => {
3784
3945
  }
3785
3946
  }
3786
3947
  };
3787
- })), ce = /* @__PURE__ */ t(((e, t) => {
3948
+ })), se = /* @__PURE__ */ t(((e, t) => {
3788
3949
  var n = W();
3789
3950
  t.exports = class extends n {
3790
3951
  static get name() {
@@ -3825,7 +3986,7 @@ var j, M, N, P, F, I, L, R, ee, z, B = e((() => {
3825
3986
  return o.forEach((e) => this.stdOut = e), Promise.resolve();
3826
3987
  }
3827
3988
  };
3828
- })), le = /* @__PURE__ */ t(((e, t) => {
3989
+ })), ce = /* @__PURE__ */ t(((e, t) => {
3829
3990
  function n(e) {
3830
3991
  return typeof e == "object" && !!e;
3831
3992
  }
@@ -3836,7 +3997,7 @@ var j, M, N, P, F, I, L, R, ee, z, B = e((() => {
3836
3997
  return Array.isArray(e) ? e : e === void 0 ? [] : r(e) || e instanceof Set ? Array.from(e) : [e];
3837
3998
  }
3838
3999
  t.exports = i;
3839
- })), ue = /* @__PURE__ */ t(((e, t) => {
4000
+ })), le = /* @__PURE__ */ t(((e, t) => {
3840
4001
  function n(e, t, ...n) {
3841
4002
  let r = [];
3842
4003
  if (!Array.isArray(e)) throw Error("Input must be an array");
@@ -3856,7 +4017,7 @@ var j, M, N, P, F, I, L, R, ee, z, B = e((() => {
3856
4017
  return e;
3857
4018
  }
3858
4019
  t.exports = n;
3859
- })), de = /* @__PURE__ */ t(((e) => {
4020
+ })), ue = /* @__PURE__ */ t(((e) => {
3860
4021
  Object.defineProperty(e, "__esModule", { value: !0 });
3861
4022
  function t(e) {
3862
4023
  return !isNaN(parseFloat(e));
@@ -3935,10 +4096,10 @@ var j, M, N, P, F, I, L, R, ee, z, B = e((() => {
3935
4096
  isFunction: h,
3936
4097
  isAsyncFunction: g
3937
4098
  }, 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;
3938
- })), fe, X = e((() => {
3939
- fe = globalThis || self;
4099
+ })), de, fe = e((() => {
4100
+ de = globalThis || self;
3940
4101
  })), pe = /* @__PURE__ */ t(((e, t) => {
3941
- X();
4102
+ fe();
3942
4103
  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 + "?", R = "[" + g + "]?", ee = "(?:" + M + "(?:" + [
3943
4104
  O,
3944
4105
  k,
@@ -3968,7 +4129,7 @@ var j, M, N, P, F, I, L, R, ee, z, B = e((() => {
3968
4129
  j + "+" + I,
3969
4130
  S,
3970
4131
  B
3971
- ].join("|"), "g"), ne = RegExp("[" + M + o + s + c + g + "]"), re = /[a-z][A-Z]|[A-Z]{2,}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/, G = {
4132
+ ].join("|"), "g"), ne = RegExp("[" + M + o + s + c + g + "]"), G = /[a-z][A-Z]|[A-Z]{2,}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/, K = {
3972
4133
  À: "A",
3973
4134
  Á: "A",
3974
4135
  Â: "A",
@@ -4159,40 +4320,40 @@ var j, M, N, P, F, I, L, R, ee, z, B = e((() => {
4159
4320
  œ: "oe",
4160
4321
  ʼn: "'n",
4161
4322
  ſ: "ss"
4162
- }, K = typeof fe == "object" && fe && fe.Object === Object && fe, ie = typeof self == "object" && self && self.Object === Object && self, q = K || ie || Function("return this")();
4163
- function J(e, t, n, r) {
4323
+ }, q = typeof de == "object" && de && de.Object === Object && de, J = typeof self == "object" && self && self.Object === Object && self, Y = q || J || Function("return this")();
4324
+ function re(e, t, n, r) {
4164
4325
  var i = -1, a = e ? e.length : 0;
4165
4326
  for (r && a && (n = e[++i]); ++i < a;) n = t(n, e[i], i, e);
4166
4327
  return n;
4167
4328
  }
4168
- function Y(e) {
4329
+ function X(e) {
4169
4330
  return e.split("");
4170
4331
  }
4171
- function ae(e) {
4332
+ function ie(e) {
4172
4333
  return e.match(i) || [];
4173
4334
  }
4174
- function oe(e) {
4335
+ function ae(e) {
4175
4336
  return function(t) {
4176
4337
  return e?.[t];
4177
4338
  };
4178
4339
  }
4179
- var se = oe(G);
4180
- function ce(e) {
4340
+ var oe = ae(K);
4341
+ function se(e) {
4181
4342
  return ne.test(e);
4182
4343
  }
4344
+ function ce(e) {
4345
+ return G.test(e);
4346
+ }
4183
4347
  function le(e) {
4184
- return re.test(e);
4348
+ return se(e) ? ue(e) : X(e);
4185
4349
  }
4186
4350
  function ue(e) {
4187
- return ce(e) ? de(e) : Y(e);
4188
- }
4189
- function de(e) {
4190
4351
  return e.match(te) || [];
4191
4352
  }
4192
4353
  function pe(e) {
4193
4354
  return e.match(W) || [];
4194
4355
  }
4195
- var me = Object.prototype.toString, Z = q.Symbol, he = Z ? Z.prototype : void 0, ge = he ? he.toString : void 0;
4356
+ var me = Object.prototype.toString, Z = Y.Symbol, he = Z ? Z.prototype : void 0, ge = he ? he.toString : void 0;
4196
4357
  function _e(e, t, n) {
4197
4358
  var r = -1, i = e.length;
4198
4359
  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;
@@ -4212,13 +4373,13 @@ var j, M, N, P, F, I, L, R, ee, z, B = e((() => {
4212
4373
  function be(e) {
4213
4374
  return function(t) {
4214
4375
  t = we(t);
4215
- var n = ce(t) ? ue(t) : void 0, r = n ? n[0] : t.charAt(0), i = n ? ye(n, 1).join("") : t.slice(1);
4376
+ var n = se(t) ? le(t) : void 0, r = n ? n[0] : t.charAt(0), i = n ? ye(n, 1).join("") : t.slice(1);
4216
4377
  return r[e]() + i;
4217
4378
  };
4218
4379
  }
4219
4380
  function xe(e) {
4220
4381
  return function(t) {
4221
- return J(ke(De(t).replace(H, "")), e, "");
4382
+ return re(ke(De(t).replace(H, "")), e, "");
4222
4383
  };
4223
4384
  }
4224
4385
  function Se(e) {
@@ -4237,16 +4398,16 @@ var j, M, N, P, F, I, L, R, ee, z, B = e((() => {
4237
4398
  return Oe(we(e).toLowerCase());
4238
4399
  }
4239
4400
  function De(e) {
4240
- return e = we(e), e && e.replace(a, se).replace(U, "");
4401
+ return e = we(e), e && e.replace(a, oe).replace(U, "");
4241
4402
  }
4242
4403
  var Oe = be("toUpperCase");
4243
4404
  function ke(e, t, n) {
4244
- return e = we(e), t = n ? void 0 : t, t === void 0 ? le(e) ? pe(e) : ae(e) : e.match(t) || [];
4405
+ return e = we(e), t = n ? void 0 : t, t === void 0 ? ce(e) ? pe(e) : ie(e) : e.match(t) || [];
4245
4406
  }
4246
4407
  t.exports = Te;
4247
4408
  })), me = /* @__PURE__ */ t(((e, t) => {
4248
4409
  B();
4249
- var n = le(), r = ue(), i = de(), a = pe(), o = {
4410
+ var n = ce(), r = le(), i = ue(), a = pe(), o = {
4250
4411
  short: /^-([^\d-])$/,
4251
4412
  long: /^--(\S+)/,
4252
4413
  combinedShort: /^-[^\d-]{2,}$/,
@@ -4866,9 +5027,9 @@ var j, M, N, P, F, I, L, R, ee, z, B = e((() => {
4866
5027
  }
4867
5028
  };
4868
5029
  })), be = /* @__PURE__ */ t(((e, t) => {
4869
- var { Test: n, TestBracket: r } = se();
5030
+ var { Test: n, TestBracket: r } = oe();
4870
5031
  t.exports = [
4871
- ce(),
5032
+ se(),
4872
5033
  Z(),
4873
5034
  he(),
4874
5035
  ge(),
@@ -4879,7 +5040,7 @@ var j, M, N, P, F, I, L, R, ee, z, B = e((() => {
4879
5040
  r
4880
5041
  ];
4881
5042
  })), xe = /* @__PURE__ */ t(((e, t) => {
4882
- var n = Y();
5043
+ var n = X();
4883
5044
  t.exports = class extends n {
4884
5045
  static get name() {
4885
5046
  return "alias";
@@ -4891,7 +5052,7 @@ var j, M, N, P, F, I, L, R, ee, z, B = e((() => {
4891
5052
  }
4892
5053
  };
4893
5054
  })), Se = /* @__PURE__ */ t(((e, t) => {
4894
- var n = Y();
5055
+ var n = X();
4895
5056
  t.exports = class extends n {
4896
5057
  static get name() {
4897
5058
  return "export";
@@ -4903,7 +5064,7 @@ var j, M, N, P, F, I, L, R, ee, z, B = e((() => {
4903
5064
  }
4904
5065
  };
4905
5066
  })), Ce = /* @__PURE__ */ t(((e, t) => {
4906
- var n = Y();
5067
+ var n = X();
4907
5068
  t.exports = class extends n {
4908
5069
  static get name() {
4909
5070
  return "cd";
@@ -4915,7 +5076,7 @@ var j, M, N, P, F, I, L, R, ee, z, B = e((() => {
4915
5076
  }
4916
5077
  };
4917
5078
  })), we = /* @__PURE__ */ t(((e, t) => {
4918
- var n = Y();
5079
+ var n = X();
4919
5080
  t.exports = class extends n {
4920
5081
  static get name() {
4921
5082
  return "chmod";
@@ -4971,7 +5132,7 @@ var j, M, N, P, F, I, L, R, ee, z, B = e((() => {
4971
5132
  }
4972
5133
  };
4973
5134
  })), Te = /* @__PURE__ */ t(((e, t) => {
4974
- var n = Y(), r = K();
5135
+ var n = X(), r = q();
4975
5136
  t.exports = class extends n {
4976
5137
  static get name() {
4977
5138
  return "cp";
@@ -5067,9 +5228,9 @@ var j, M, N, P, F, I, L, R, ee, z, B = e((() => {
5067
5228
  }
5068
5229
  };
5069
5230
  })), Ee = /* @__PURE__ */ t(((e, t) => {
5070
- var n = Y(), r = (() => {
5231
+ var n = X(), r = (() => {
5071
5232
  try {
5072
- return K();
5233
+ return q();
5073
5234
  } catch {
5074
5235
  return null;
5075
5236
  }
@@ -5140,7 +5301,7 @@ var j, M, N, P, F, I, L, R, ee, z, B = e((() => {
5140
5301
  }
5141
5302
  };
5142
5303
  })), De = /* @__PURE__ */ t(((e, t) => {
5143
- var n = Y();
5304
+ var n = X();
5144
5305
  t.exports = class extends n {
5145
5306
  static get name() {
5146
5307
  return "mkdir";
@@ -5167,7 +5328,7 @@ var j, M, N, P, F, I, L, R, ee, z, B = e((() => {
5167
5328
  }
5168
5329
  };
5169
5330
  })), Oe = /* @__PURE__ */ t(((e, t) => {
5170
- var n = Y(), r = K();
5331
+ var n = X(), r = q();
5171
5332
  t.exports = class extends n {
5172
5333
  static get name() {
5173
5334
  return "mv";
@@ -5211,7 +5372,7 @@ var j, M, N, P, F, I, L, R, ee, z, B = e((() => {
5211
5372
  continue;
5212
5373
  }
5213
5374
  try {
5214
- let e = ie();
5375
+ let e = J();
5215
5376
  r.mkdirSync(e.dirname(i), { recursive: !0 }), r.renameSync(n, i);
5216
5377
  } catch (n) {
5217
5378
  this.stdErr = `mv: cannot move '${e}' to '${t}': ${n.message}`, this.exitCode = 1;
@@ -5240,7 +5401,7 @@ var j, M, N, P, F, I, L, R, ee, z, B = e((() => {
5240
5401
  }
5241
5402
  };
5242
5403
  })), ke = /* @__PURE__ */ t(((e, t) => {
5243
- var n = Y();
5404
+ var n = X();
5244
5405
  t.exports = class extends n {
5245
5406
  static get name() {
5246
5407
  return "pwd";
@@ -5251,7 +5412,7 @@ var j, M, N, P, F, I, L, R, ee, z, B = e((() => {
5251
5412
  }
5252
5413
  };
5253
5414
  })), Ae = /* @__PURE__ */ t(((e, t) => {
5254
- var n = Y(), r = K();
5415
+ var n = X(), r = q();
5255
5416
  t.exports = class extends n {
5256
5417
  static get name() {
5257
5418
  return "rm";
@@ -5296,9 +5457,9 @@ var j, M, N, P, F, I, L, R, ee, z, B = e((() => {
5296
5457
  }
5297
5458
  };
5298
5459
  })), je = /* @__PURE__ */ t(((e, t) => {
5299
- var n = Y(), r = (() => {
5460
+ var n = X(), r = (() => {
5300
5461
  try {
5301
- return K();
5462
+ return q();
5302
5463
  } catch {
5303
5464
  return null;
5304
5465
  }
@@ -5365,9 +5526,9 @@ var j, M, N, P, F, I, L, R, ee, z, B = e((() => {
5365
5526
  }
5366
5527
  };
5367
5528
  })), Me = /* @__PURE__ */ t(((e, t) => {
5368
- var n = Y(), r = (() => {
5529
+ var n = X(), r = (() => {
5369
5530
  try {
5370
- return K();
5531
+ return q();
5371
5532
  } catch {
5372
5533
  return null;
5373
5534
  }
@@ -5406,7 +5567,7 @@ var j, M, N, P, F, I, L, R, ee, z, B = e((() => {
5406
5567
  }
5407
5568
  };
5408
5569
  })), Ne = /* @__PURE__ */ t(((e, t) => {
5409
- var n = Y();
5570
+ var n = X();
5410
5571
  t.exports = class extends n {
5411
5572
  static get name() {
5412
5573
  return "which";
@@ -5418,7 +5579,7 @@ var j, M, N, P, F, I, L, R, ee, z, B = e((() => {
5418
5579
  }
5419
5580
  };
5420
5581
  })), Pe = /* @__PURE__ */ t(((e, t) => {
5421
- var n = ae(), r = Y();
5582
+ var n = ie(), r = X();
5422
5583
  t.exports = class extends r {
5423
5584
  static get name() {
5424
5585
  return "source";
@@ -5447,7 +5608,7 @@ var j, M, N, P, F, I, L, R, ee, z, B = e((() => {
5447
5608
  }
5448
5609
  };
5449
5610
  })), Fe = /* @__PURE__ */ t(((e, t) => {
5450
- var n = Y();
5611
+ var n = X();
5451
5612
  t.exports = class extends n {
5452
5613
  static get name() {
5453
5614
  return "clear";
@@ -5457,7 +5618,7 @@ var j, M, N, P, F, I, L, R, ee, z, B = e((() => {
5457
5618
  }
5458
5619
  };
5459
5620
  })), Ie = /* @__PURE__ */ t(((e, t) => {
5460
- var n = Y();
5621
+ var n = X();
5461
5622
  t.exports = class extends n {
5462
5623
  static get name() {
5463
5624
  return "exit";
@@ -5468,7 +5629,7 @@ var j, M, N, P, F, I, L, R, ee, z, B = e((() => {
5468
5629
  }
5469
5630
  };
5470
5631
  })), Le = /* @__PURE__ */ t(((e, t) => {
5471
- var n = Y(), r = me();
5632
+ var n = X(), r = me();
5472
5633
  t.exports = class extends n {
5473
5634
  static get name() {
5474
5635
  return "read";
@@ -5542,7 +5703,7 @@ var j, M, N, P, F, I, L, R, ee, z, B = e((() => {
5542
5703
  }
5543
5704
  };
5544
5705
  })), Re = /* @__PURE__ */ t(((e, t) => {
5545
- var n = Y(), r = W();
5706
+ var n = X(), r = W();
5546
5707
  t.exports = class extends n {
5547
5708
  static get name() {
5548
5709
  return "jsfunction";
@@ -5578,7 +5739,7 @@ var j, M, N, P, F, I, L, R, ee, z, B = e((() => {
5578
5739
  }
5579
5740
  };
5580
5741
  })), ze = /* @__PURE__ */ t(((e, t) => {
5581
- var n = Y();
5742
+ var n = X();
5582
5743
  function r(e) {
5583
5744
  return e >= 1048576 ? (e / 1048576).toFixed(1) + " MB" : e >= 1024 ? (e / 1024).toFixed(1) + " KB" : e + " B";
5584
5745
  }
@@ -5676,7 +5837,7 @@ var j, M, N, P, F, I, L, R, ee, z, B = e((() => {
5676
5837
  let e = new TextDecoder().decode(t);
5677
5838
  this.fs.setFileByPath(s, e, !0);
5678
5839
  } else {
5679
- let { BinaryFile: e } = G(), r = e ? new e(t.buffer, n || "application/octet-stream") : t;
5840
+ let { BinaryFile: e } = K(), r = e ? new e(t.buffer, n || "application/octet-stream") : t;
5680
5841
  this.fs.setFileByPath(s, r, !0);
5681
5842
  }
5682
5843
  } catch (e) {
@@ -5699,7 +5860,7 @@ var j, M, N, P, F, I, L, R, ee, z, B = e((() => {
5699
5860
  }
5700
5861
  };
5701
5862
  })), Be = /* @__PURE__ */ t(((e, t) => {
5702
- var n = Y(), r = {
5863
+ var n = X(), r = {
5703
5864
  errexit: "e",
5704
5865
  xtrace: "x",
5705
5866
  nounset: "u",
@@ -6370,7 +6531,7 @@ var j, M, N, P, F, I, L, R, ee, z, B = e((() => {
6370
6531
  })), Pt = /* @__PURE__ */ t(((e, t) => {
6371
6532
  t.exports = {};
6372
6533
  })), Ft = /* @__PURE__ */ t(((e, t) => {
6373
- X();
6534
+ fe();
6374
6535
  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) {
6375
6536
  return e.__proto__;
6376
6537
  } : null);
@@ -6386,7 +6547,7 @@ var j, M, N, P, F, I, L, R, ee, z, B = e((() => {
6386
6547
  }
6387
6548
  return v.call(t, n, "$&_");
6388
6549
  }
6389
- var P = Pt(), F = P.custom, I = G(F) ? F : null, L = {
6550
+ var P = Pt(), F = P.custom, I = K(F) ? F : null, L = {
6390
6551
  __proto__: null,
6391
6552
  double: "\"",
6392
6553
  single: "'"
@@ -6397,12 +6558,12 @@ var j, M, N, P, F, I, L, R, ee, z, B = e((() => {
6397
6558
  };
6398
6559
  t.exports = function e(t, n, r, o) {
6399
6560
  var s = n || {};
6400
- if (q(s, "quoteStyle") && !q(L, s.quoteStyle)) throw TypeError("option \"quoteStyle\" must be \"single\" or \"double\"");
6401
- 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`");
6402
- var u = q(s, "customInspect") ? s.customInspect : !0;
6561
+ if (Y(s, "quoteStyle") && !Y(L, s.quoteStyle)) throw TypeError("option \"quoteStyle\" must be \"single\" or \"double\"");
6562
+ if (Y(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`");
6563
+ var u = Y(s, "customInspect") ? s.customInspect : !0;
6403
6564
  if (typeof u != "boolean" && u !== "symbol") throw TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");
6404
- 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`");
6405
- if (q(s, "numericSeparator") && typeof s.numericSeparator != "boolean") throw TypeError("option \"numericSeparator\", if provided, must be `true` or `false`");
6565
+ if (Y(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`");
6566
+ if (Y(s, "numericSeparator") && typeof s.numericSeparator != "boolean") throw TypeError("option \"numericSeparator\", if provided, must be `true` or `false`");
6406
6567
  var d = s.numericSeparator;
6407
6568
  if (t === void 0) return "undefined";
6408
6569
  if (t === null) return "null";
@@ -6421,62 +6582,62 @@ var j, M, N, P, F, I, L, R, ee, z, B = e((() => {
6421
6582
  if (r === void 0 && (r = 0), r >= h && h > 0 && typeof t == "object") return V(t) ? "[Array]" : "[Object]";
6422
6583
  var g = ve(s, r);
6423
6584
  if (o === void 0) o = [];
6424
- else if (ae(o, t) >= 0) return "[Circular]";
6585
+ else if (ie(o, t) >= 0) return "[Circular]";
6425
6586
  function y(t, n, i) {
6426
6587
  if (n && (o = w.call(o), o.push(n)), i) {
6427
6588
  var a = { depth: s.depth };
6428
- return q(s, "quoteStyle") && (a.quoteStyle = s.quoteStyle), e(t, a, r + 1, o);
6589
+ return Y(s, "quoteStyle") && (a.quoteStyle = s.quoteStyle), e(t, a, r + 1, o);
6429
6590
  }
6430
6591
  return e(t, s, r + 1, o);
6431
6592
  }
6432
6593
  if (typeof t == "function" && !U(t)) {
6433
- var x = Y(t), T = be(t, y);
6594
+ var x = X(t), T = be(t, y);
6434
6595
  return "[Function" + (x ? ": " + x : " (anonymous)") + "]" + (T.length > 0 ? " { " + C.call(T, ", ") + " }" : "");
6435
6596
  }
6436
- if (G(t)) {
6597
+ if (K(t)) {
6437
6598
  var D = k ? v.call(String(t), /^(Symbol\(.*\))_[^)]*$/, "$1") : O.call(t);
6438
6599
  return typeof t == "object" && !k ? Z(D) : D;
6439
6600
  }
6440
- if (de(t)) {
6601
+ if (ue(t)) {
6441
6602
  for (var F = "<" + b.call(String(t.nodeName)), R = t.attributes || [], B = 0; B < R.length; B++) F += " " + R[B].name + "=" + ee(z(R[B].value), "double", s);
6442
6603
  return F += ">", t.childNodes && t.childNodes.length && (F += "..."), F += "</" + b.call(String(t.nodeName)) + ">", F;
6443
6604
  }
6444
6605
  if (V(t)) {
6445
6606
  if (t.length === 0) return "[]";
6446
- var ie = be(t, y);
6447
- return g && !_e(ie) ? "[" + ye(ie, g) + "]" : "[ " + C.call(ie, ", ") + " ]";
6607
+ var J = be(t, y);
6608
+ return g && !_e(J) ? "[" + ye(J, g) + "]" : "[ " + C.call(J, ", ") + " ]";
6448
6609
  }
6449
6610
  if (te(t)) {
6450
- var X = be(t, y);
6451
- 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, ", ") + " }";
6611
+ var fe = be(t, y);
6612
+ return !("cause" in Error.prototype) && "cause" in t && !j.call(t, "cause") ? "{ [" + String(t) + "] " + C.call(S.call("[cause]: " + y(t.cause), fe), ", ") + " }" : fe.length === 0 ? "[" + String(t) + "]" : "{ [" + String(t) + "] " + C.call(fe, ", ") + " }";
6452
6613
  }
6453
6614
  if (typeof t == "object" && u) {
6454
6615
  if (I && typeof t[I] == "function" && P) return P(t, { depth: h - r });
6455
6616
  if (u !== "symbol" && typeof t.inspect == "function") return t.inspect();
6456
6617
  }
6457
- if (oe(t)) {
6618
+ if (ae(t)) {
6458
6619
  var me = [];
6459
6620
  return a && a.call(t, function(e, n) {
6460
6621
  me.push(y(n, t, !0) + " => " + y(e, t));
6461
6622
  }), ge("Map", i.call(t), me, g);
6462
6623
  }
6463
- if (le(t)) {
6624
+ if (ce(t)) {
6464
6625
  var xe = [];
6465
6626
  return l && l.call(t, function(e) {
6466
6627
  xe.push(y(e, t));
6467
6628
  }), ge("Set", c.call(t), xe, g);
6468
6629
  }
6469
- if (se(t)) return he("WeakMap");
6470
- if (ue(t)) return he("WeakSet");
6471
- if (ce(t)) return he("WeakRef");
6630
+ if (oe(t)) return he("WeakMap");
6631
+ if (le(t)) return he("WeakSet");
6632
+ if (se(t)) return he("WeakRef");
6472
6633
  if (ne(t)) return Z(y(Number(t)));
6473
- if (K(t)) return Z(y(E.call(t)));
6474
- if (re(t)) return Z(p.call(t));
6634
+ if (q(t)) return Z(y(E.call(t)));
6635
+ if (G(t)) return Z(p.call(t));
6475
6636
  if (W(t)) return Z(y(String(t)));
6476
6637
  if (typeof window < "u" && t === window) return "{ [object Window] }";
6477
- if (typeof globalThis < "u" && t === globalThis || fe !== void 0 && t === fe) return "{ [object globalThis] }";
6638
+ if (typeof globalThis < "u" && t === globalThis || de !== void 0 && t === de) return "{ [object globalThis] }";
6478
6639
  if (!H(t) && !U(t)) {
6479
- 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 || []), ": ") + "] " : "");
6640
+ 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(re(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 || []), ": ") + "] " : "");
6480
6641
  return Se.length === 0 ? Ee + "{}" : g ? Ee + "{" + ye(Se, g) + "}" : Ee + "{ " + C.call(Se, ", ") + " }";
6481
6642
  }
6482
6643
  return String(t);
@@ -6492,27 +6653,27 @@ var j, M, N, P, F, I, L, R, ee, z, B = e((() => {
6492
6653
  return !A || !(typeof e == "object" && (A in e || e[A] !== void 0));
6493
6654
  }
6494
6655
  function V(e) {
6495
- return J(e) === "[object Array]" && B(e);
6656
+ return re(e) === "[object Array]" && B(e);
6496
6657
  }
6497
6658
  function H(e) {
6498
- return J(e) === "[object Date]" && B(e);
6659
+ return re(e) === "[object Date]" && B(e);
6499
6660
  }
6500
6661
  function U(e) {
6501
- return J(e) === "[object RegExp]" && B(e);
6662
+ return re(e) === "[object RegExp]" && B(e);
6502
6663
  }
6503
6664
  function te(e) {
6504
- return J(e) === "[object Error]" && B(e);
6665
+ return re(e) === "[object Error]" && B(e);
6505
6666
  }
6506
6667
  function W(e) {
6507
- return J(e) === "[object String]" && B(e);
6668
+ return re(e) === "[object String]" && B(e);
6508
6669
  }
6509
6670
  function ne(e) {
6510
- return J(e) === "[object Number]" && B(e);
6511
- }
6512
- function re(e) {
6513
- return J(e) === "[object Boolean]" && B(e);
6671
+ return re(e) === "[object Number]" && B(e);
6514
6672
  }
6515
6673
  function G(e) {
6674
+ return re(e) === "[object Boolean]" && B(e);
6675
+ }
6676
+ function K(e) {
6516
6677
  if (k) return e && typeof e == "object" && e instanceof Symbol;
6517
6678
  if (typeof e == "symbol") return !0;
6518
6679
  if (!e || typeof e != "object" || !O) return !1;
@@ -6521,33 +6682,33 @@ var j, M, N, P, F, I, L, R, ee, z, B = e((() => {
6521
6682
  } catch {}
6522
6683
  return !1;
6523
6684
  }
6524
- function K(e) {
6685
+ function q(e) {
6525
6686
  if (!e || typeof e != "object" || !E) return !1;
6526
6687
  try {
6527
6688
  return E.call(e), !0;
6528
6689
  } catch {}
6529
6690
  return !1;
6530
6691
  }
6531
- var ie = Object.prototype.hasOwnProperty || function(e) {
6692
+ var J = Object.prototype.hasOwnProperty || function(e) {
6532
6693
  return e in this;
6533
6694
  };
6534
- function q(e, t) {
6535
- return ie.call(e, t);
6695
+ function Y(e, t) {
6696
+ return J.call(e, t);
6536
6697
  }
6537
- function J(e) {
6698
+ function re(e) {
6538
6699
  return m.call(e);
6539
6700
  }
6540
- function Y(e) {
6701
+ function X(e) {
6541
6702
  if (e.name) return e.name;
6542
6703
  var t = g.call(h.call(e), /^function\s*([\w$]+)/);
6543
6704
  return t ? t[1] : null;
6544
6705
  }
6545
- function ae(e, t) {
6706
+ function ie(e, t) {
6546
6707
  if (e.indexOf) return e.indexOf(t);
6547
6708
  for (var n = 0, r = e.length; n < r; n++) if (e[n] === t) return n;
6548
6709
  return -1;
6549
6710
  }
6550
- function oe(e) {
6711
+ function ae(e) {
6551
6712
  if (!i || !e || typeof e != "object") return !1;
6552
6713
  try {
6553
6714
  i.call(e);
@@ -6560,7 +6721,7 @@ var j, M, N, P, F, I, L, R, ee, z, B = e((() => {
6560
6721
  } catch {}
6561
6722
  return !1;
6562
6723
  }
6563
- function se(e) {
6724
+ function oe(e) {
6564
6725
  if (!u || !e || typeof e != "object") return !1;
6565
6726
  try {
6566
6727
  u.call(e, u);
@@ -6573,14 +6734,14 @@ var j, M, N, P, F, I, L, R, ee, z, B = e((() => {
6573
6734
  } catch {}
6574
6735
  return !1;
6575
6736
  }
6576
- function ce(e) {
6737
+ function se(e) {
6577
6738
  if (!f || !e || typeof e != "object") return !1;
6578
6739
  try {
6579
6740
  return f.call(e), !0;
6580
6741
  } catch {}
6581
6742
  return !1;
6582
6743
  }
6583
- function le(e) {
6744
+ function ce(e) {
6584
6745
  if (!c || !e || typeof e != "object") return !1;
6585
6746
  try {
6586
6747
  c.call(e);
@@ -6593,7 +6754,7 @@ var j, M, N, P, F, I, L, R, ee, z, B = e((() => {
6593
6754
  } catch {}
6594
6755
  return !1;
6595
6756
  }
6596
- function ue(e) {
6757
+ function le(e) {
6597
6758
  if (!d || !e || typeof e != "object") return !1;
6598
6759
  try {
6599
6760
  d.call(e, d);
@@ -6606,7 +6767,7 @@ var j, M, N, P, F, I, L, R, ee, z, B = e((() => {
6606
6767
  } catch {}
6607
6768
  return !1;
6608
6769
  }
6609
- function de(e) {
6770
+ function ue(e) {
6610
6771
  return !e || typeof e != "object" ? !1 : typeof HTMLElement < "u" && e instanceof HTMLElement ? !0 : typeof e.nodeName == "string" && typeof e.getAttribute == "function";
6611
6772
  }
6612
6773
  function pe(e, t) {
@@ -6638,7 +6799,7 @@ var j, M, N, P, F, I, L, R, ee, z, B = e((() => {
6638
6799
  return e + " (" + t + ") {" + i + "}";
6639
6800
  }
6640
6801
  function _e(e) {
6641
- for (var t = 0; t < e.length; t++) if (ae(e[t], "\n") >= 0) return !1;
6802
+ for (var t = 0; t < e.length; t++) if (ie(e[t], "\n") >= 0) return !1;
6642
6803
  return !0;
6643
6804
  }
6644
6805
  function ve(e, t) {
@@ -6660,14 +6821,14 @@ var j, M, N, P, F, I, L, R, ee, z, B = e((() => {
6660
6821
  var n = V(e), r = [];
6661
6822
  if (n) {
6662
6823
  r.length = e.length;
6663
- for (var i = 0; i < e.length; i++) r[i] = q(e, i) ? t(e[i], e) : "";
6824
+ for (var i = 0; i < e.length; i++) r[i] = Y(e, i) ? t(e[i], e) : "";
6664
6825
  }
6665
6826
  var a = typeof D == "function" ? D(e) : [], o;
6666
6827
  if (k) {
6667
6828
  o = {};
6668
6829
  for (var s = 0; s < a.length; s++) o["$" + a[s]] = a[s];
6669
6830
  }
6670
- 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))));
6831
+ for (var c in e) Y(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))));
6671
6832
  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));
6672
6833
  return r;
6673
6834
  }
@@ -7580,7 +7741,7 @@ var j, M, N, P, F, I, L, R, ee, z, B = e((() => {
7580
7741
  shim: o
7581
7742
  }), t.exports = s;
7582
7743
  })), sr = /* @__PURE__ */ t(((e, t) => {
7583
- var n = ne(), { createGenericWasmCommand: r } = oe(), i = "\x1B[2J\x1B[H", a = "\x1B[0m", o = "\x1B[7m", s = "\x1B[1m", c = "\x1B[2m", l = "\x1B[36m", u = "\x1B[31m", d = "\x1B[32m", f = class extends n {
7744
+ var n = ne(), { createGenericWasmCommand: r } = ae(), i = "\x1B[2J\x1B[H", a = "\x1B[0m", o = "\x1B[7m", s = "\x1B[1m", c = "\x1B[2m", l = "\x1B[36m", u = "\x1B[31m", d = "\x1B[32m", f = class extends n {
7584
7745
  get requiresFilesystem() {
7585
7746
  return !0;
7586
7747
  }
@@ -7851,7 +8012,7 @@ var j, M, N, P, F, I, L, R, ee, z, B = e((() => {
7851
8012
  f.createReplWasmCommand = p, f.createCommand = p, t.exports = f;
7852
8013
  })), cr = /* @__PURE__ */ t(((e, t) => {
7853
8014
  b();
7854
- var r = J(), i = Y(), a = ae(), o = oe(), s = W(), c = ne(), { TtyStream: l } = te(), u = "/.brsh_history", d = be(), f = He(), p = V(), m = x(), { isAsyncFilesystemSource: h, resolveFilesystemSource: g } = re(), _ = /\$(?:\{([\w\d?#@*-]+)\}|([\w\d]+|[?#@*-]))/g, v = p.EventEmitter || p.default || p;
8015
+ var r = re(), i = X(), a = ie(), o = ae(), s = W(), c = ne(), { TtyStream: l } = te(), u = "/.brsh_history", d = be(), f = He(), p = V(), m = x(), { isAsyncFilesystemSource: h, resolveFilesystemSource: g } = G(), _ = /\$(?:\{([\w\d?#@*-]+)\}|([\w\d]+|[?#@*-]))/g, v = p.EventEmitter || p.default || p;
7855
8016
  String.prototype.regexIndexOf = function(e, t) {
7856
8017
  let n = this.substring(t || 0).search(e);
7857
8018
  return n >= 0 ? n + (t || 0) : n;
@@ -8764,7 +8925,7 @@ var j, M, N, P, F, I, L, R, ee, z, B = e((() => {
8764
8925
  return e.create(Object.assign({}, n, { filesystem: t }));
8765
8926
  }
8766
8927
  };
8767
- S.STATUS_READY = "READY", S.STATUS_WORKING = "WORKING", S.STATUS_DESTROYED = "DESTROYED", S.Command = s, S.InteractiveCommand = c, S.WasmCommand = o, S.createWasmCommand = o.createGenericWasmCommand || o.createCommand, S.ReplCommand = sr(), S.FS = m, S.BinaryContainer = re(), S.Storage = S.BinaryContainer.FilesystemStorage, globalThis.shell = S, globalThis.Shell = S, t.exports = S;
8928
+ S.STATUS_READY = "READY", S.STATUS_WORKING = "WORKING", S.STATUS_DESTROYED = "DESTROYED", S.Command = s, S.InteractiveCommand = c, S.WasmCommand = o, S.createWasmCommand = o.createGenericWasmCommand || o.createCommand, S.ReplCommand = sr(), S.FS = m, S.BinaryContainer = G(), S.Storage = S.BinaryContainer.FilesystemStorage, globalThis.shell = S, globalThis.Shell = S, t.exports = S;
8768
8929
  }));
8769
8930
  //#endregion
8770
8931
  export default cr();