brsh 3.5.0 → 3.6.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
@@ -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,34 +694,34 @@ 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 = re(String(n)) : typeof n == "bigint" && (i = String(n), (n > BigInt(2) ** BigInt(32) || n < -(BigInt(2) ** BigInt(32))) && (i = re(i)), i += "n"), r += ` It must be ${t}. Received ${i}`, r;
704
704
  }, RangeError);
705
- function ie(e) {
705
+ function re(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) {
710
+ function ie(e, t, n) {
711
711
  J(t, "offset"), (e[t] === void 0 || e[t + n] === void 0) && oe(t, e.length - (n + 1));
712
712
  }
713
713
  function ae(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
+ ie(r, i, a);
719
719
  }
720
720
  function J(e, t) {
721
- if (typeof e != "number") throw new G.ERR_INVALID_ARG_TYPE(t, "number", e);
721
+ if (typeof e != "number") throw new K.ERR_INVALID_ARG_TYPE(t, "number", e);
722
722
  }
723
723
  function oe(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) : (J(e, n), new G.ERR_OUT_OF_RANGE(n || "offset", "an integer", e));
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) : (J(e, n), new K.ERR_OUT_OF_RANGE(n || "offset", "an integer", e));
725
725
  }
726
726
  let se = /[^+/0-9A-Za-z-_]/g;
727
727
  function ce(e) {
@@ -1365,7 +1365,7 @@ var j, M, N, P, F, I, L, R, z, B, V = e((() => {
1365
1365
  });
1366
1366
  }
1367
1367
  };
1368
- })), re = /* @__PURE__ */ t(((e, t) => {
1368
+ })), G = /* @__PURE__ */ t(((e, t) => {
1369
1369
  b(), V();
1370
1370
  var { BinaryFile: n, SymlinkRef: r } = x(), i = new Uint8Array([
1371
1371
  66,
@@ -1636,7 +1636,7 @@ var j, M, N, P, F, I, L, R, z, B, V = e((() => {
1636
1636
  }
1637
1637
  }
1638
1638
  };
1639
- })), G = /* @__PURE__ */ t(((e, t) => {
1639
+ })), K = /* @__PURE__ */ t(((e, t) => {
1640
1640
  b();
1641
1641
  var n = x(), { BinaryFile: r, SymlinkRef: i } = n;
1642
1642
  function a(e) {
@@ -1661,20 +1661,20 @@ var j, M, N, P, F, I, L, R, z, B, V = e((() => {
1661
1661
  t.exports = class extends n {
1662
1662
  constructor(e = "/", t = {}, n = {}, r = null) {
1663
1663
  if (super(), t instanceof Uint8Array || t instanceof ArrayBuffer) {
1664
- let { deserializeBinaryFilesystem: e } = re(), r = e(t);
1664
+ let { deserializeBinaryFilesystem: e } = G(), r = e(t);
1665
1665
  t = r.filesystem, n = Object.assign({}, r.permissions, n);
1666
1666
  } 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)) {
1667
- let { deserializeBinaryFilesystem: e } = re(), r = e(t);
1667
+ let { deserializeBinaryFilesystem: e } = G(), r = e(t);
1668
1668
  t = r.filesystem, n = Object.assign({}, r.permissions, n);
1669
1669
  }
1670
1670
  a(t), this.fileSystem = t, this.permissions = Object.assign({}, n), this.cwd = e, this._onChange = r, this._changeScheduled = !1;
1671
1671
  }
1672
1672
  toBinaryContainer(e = {}) {
1673
- let { serializeBinaryFilesystem: t } = re();
1673
+ let { serializeBinaryFilesystem: t } = G();
1674
1674
  return t(this.fileSystem, this.permissions, e);
1675
1675
  }
1676
1676
  static fromBinaryContainer(e, t = {}) {
1677
- let { deserializeBinaryFilesystem: n } = re();
1677
+ let { deserializeBinaryFilesystem: n } = G();
1678
1678
  return n(e, t);
1679
1679
  }
1680
1680
  getFileByPath(e) {
@@ -1852,9 +1852,9 @@ var j, M, N, P, F, I, L, R, z, B, V = e((() => {
1852
1852
  return null;
1853
1853
  }
1854
1854
  }, t.exports.BinaryFile = r, t.exports.SymlinkRef = i;
1855
- })), K = /* @__PURE__ */ t(((e, t) => {
1855
+ })), q = /* @__PURE__ */ t(((e, t) => {
1856
1856
  t.exports = null;
1857
- })), ie = /* @__PURE__ */ t(((e, t) => {
1857
+ })), re = /* @__PURE__ */ t(((e, t) => {
1858
1858
  V();
1859
1859
  function n(e) {
1860
1860
  if (typeof e != "string") throw TypeError("Path must be a string. Received " + JSON.stringify(e));
@@ -2022,9 +2022,9 @@ var j, M, N, P, F, I, L, R, z, B, V = e((() => {
2022
2022
  posix: null
2023
2023
  };
2024
2024
  a.posix = a, t.exports = a;
2025
- })), q = /* @__PURE__ */ t(((e, t) => {
2025
+ })), ie = /* @__PURE__ */ t(((e, t) => {
2026
2026
  V();
2027
- var n = K(), r = ie(), i = x();
2027
+ var n = q(), r = re(), i = x();
2028
2028
  t.exports = class extends i {
2029
2029
  constructor(e, t = null) {
2030
2030
  super(), this._onChange = t, this._changeScheduled = !1, this._virtualFiles = {}, this.cwd = this._normalizeCwd(e || B.cwd());
@@ -2232,7 +2232,7 @@ var j, M, N, P, F, I, L, R, z, B, V = e((() => {
2232
2232
  }
2233
2233
  };
2234
2234
  })), ae = /* @__PURE__ */ t(((e, t) => {
2235
- var n = G();
2235
+ var n = K();
2236
2236
  t.exports = class {
2237
2237
  constructor(e) {
2238
2238
  this.options = e;
@@ -2266,7 +2266,7 @@ var j, M, N, P, F, I, L, R, z, B, V = e((() => {
2266
2266
  return this.fs._getFileRaw(t) || null;
2267
2267
  }
2268
2268
  setNodeFilesystem(e) {
2269
- let t = q(), n = this.fs._onChange;
2269
+ let t = ie(), n = this.fs._onChange;
2270
2270
  this.fs = new t(e, n);
2271
2271
  }
2272
2272
  setFilesystem(e, t = {}) {
@@ -2688,17 +2688,74 @@ var j, M, N, P, F, I, L, R, z, B, V = e((() => {
2688
2688
  }, t.exports.isKnownInterpreter = r;
2689
2689
  })), se = /* @__PURE__ */ t(((e, t) => {
2690
2690
  b();
2691
- var n = oe(), { 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 {
2691
+ var n = oe(), { BinaryFile: r } = K(), 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
2692
  get name() {
2693
2693
  return "wasm";
2694
2694
  }
2695
2695
  get requiresFilesystem() {
2696
2696
  return !0;
2697
2697
  }
2698
+ get interactive() {
2699
+ if ((this.arguments || []).some((e) => e === "--help" || e === "-h" || e === "--version" || e === "-V" || e === "-v")) return !1;
2700
+ if (this._isInteractive !== void 0) return !!this._isInteractive;
2701
+ if (this._pkgMeta && this._pkgMeta.interactive !== void 0) return !!this._pkgMeta.interactive;
2702
+ let e = (this.script || this.name || "").toLowerCase();
2703
+ return e === "nano" || e.endsWith("/nano") || e.endsWith("nano.wasm");
2704
+ }
2705
+ get captureInput() {
2706
+ return this.interactive;
2707
+ }
2708
+ _enterAltScreen() {
2709
+ this._inAltScreen || (this._inAltScreen = !0, this.stdinStream && typeof this.stdinStream.setRawMode == "function" && this.stdinStream.setRawMode(!0), this.stdout && typeof this.stdout.write == "function" && this.stdout.write("\x1B[?1049h\x1B[2J\x1B[H"));
2710
+ }
2711
+ _exitAltScreen() {
2712
+ this._inAltScreen && (this._inAltScreen = !1, this.stdinStream && typeof this.stdinStream.setRawMode == "function" && this.stdinStream.setRawMode(!1), this.stdout && typeof this.stdout.write == "function" && this.stdout.write("\x1B[?1049l\x1B[?25h"));
2713
+ }
2714
+ _keyToBytes(e) {
2715
+ if (!e) return null;
2716
+ if (typeof e != "string") return e instanceof Uint8Array ? e : new Uint8Array([Number(e) & 255]);
2717
+ let t = e.match(/^\^([A-Za-z@\[\\\]^_?])$/);
2718
+ if (t) {
2719
+ let e = t[1].toUpperCase();
2720
+ return e === "?" ? new Uint8Array([127]) : new Uint8Array([e.charCodeAt(0) - 64]);
2721
+ }
2722
+ let n = {
2723
+ Enter: "\r",
2724
+ Return: "\r",
2725
+ Backspace: "",
2726
+ Tab: " ",
2727
+ Escape: "\x1B",
2728
+ ArrowUp: "\x1B[A",
2729
+ ArrowDown: "\x1B[B",
2730
+ ArrowRight: "\x1B[C",
2731
+ ArrowLeft: "\x1B[D",
2732
+ Home: "\x1B[H",
2733
+ End: "\x1B[F",
2734
+ PageUp: "\x1B[5~",
2735
+ PageDown: "\x1B[6~",
2736
+ Delete: "\x1B[3~",
2737
+ Insert: "\x1B[2~"
2738
+ };
2739
+ return n[e] ? new TextEncoder().encode(n[e]) : new TextEncoder().encode(e);
2740
+ }
2741
+ onInput(e) {
2742
+ if (!this._handlingStreamData) {
2743
+ if (typeof this._externalKeyHandler == "function") {
2744
+ this._externalKeyHandler(e);
2745
+ return;
2746
+ }
2747
+ this.stdinStream && this.stdinStream.isRaw;
2748
+ }
2749
+ }
2750
+ runCommand() {
2751
+ return super.runCommand().finally(() => {
2752
+ this._inAltScreen && this._exitAltScreen();
2753
+ });
2754
+ }
2698
2755
  run() {
2699
2756
  let e = this.script, t = (() => {
2700
2757
  try {
2701
- return K();
2758
+ return q();
2702
2759
  } catch {
2703
2760
  return null;
2704
2761
  }
@@ -2766,29 +2823,61 @@ var j, M, N, P, F, I, L, R, z, B, V = e((() => {
2766
2823
  let t = {
2767
2824
  1: "",
2768
2825
  2: ""
2769
- }, n = new TextDecoder(), b = new TextEncoder(), C = null, w = (e, n) => {
2826
+ }, 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)), P = (e, n) => {
2827
+ if (N && (e === 1 || e === 2)) {
2828
+ if (e === 1 && this.stdout) {
2829
+ this.stdout.write(n);
2830
+ return;
2831
+ }
2832
+ if (e === 2 && this.stderr) {
2833
+ this.stderr.write(n);
2834
+ return;
2835
+ }
2836
+ }
2770
2837
  t[e] = (t[e] || "") + n;
2771
2838
  let r = t[e].split("\n");
2772
2839
  t[e] = r.pop();
2773
2840
  for (let t of r) e === 1 ? this.stdOut = t : this.stdErr = t;
2774
- }, T = () => {
2775
- t[1] &&= (this.stdOut = t[1], ""), t[2] &&= (this.stdErr = t[2], "");
2776
- }, E = typeof this.stdin == "string" ? b.encode(this.stdin) : this.stdin instanceof Uint8Array ? this.stdin : y !== void 0 && y.isBuffer(this.stdin) ? new Uint8Array(this.stdin) : new Uint8Array(), D = 0, O = this.context && this.context.fs ? this.context.fs : this.fs, j = 5, M = new Map([[3, {
2841
+ }, F = () => {
2842
+ 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], "");
2843
+ }, I = [], L = (e) => {
2844
+ if (!(!e || e.length === 0)) {
2845
+ for (let t = 0; t < e.length; t++) I.push(e[t]);
2846
+ if (O) {
2847
+ let e = O;
2848
+ O = null, e();
2849
+ }
2850
+ }
2851
+ };
2852
+ M = (e) => {
2853
+ this._handlingStreamData = !0;
2854
+ try {
2855
+ L(typeof e == "string" ? b.encode(e) : e instanceof Uint8Array ? e : y !== void 0 && y.isBuffer(e) ? new Uint8Array(e) : b.encode(String(e ?? "")));
2856
+ } finally {
2857
+ this._handlingStreamData = !1;
2858
+ }
2859
+ }, this._externalKeyHandler = (e) => {
2860
+ if (this._handlingStreamData) return;
2861
+ let t = this._keyToBytes(e);
2862
+ t && L(t);
2863
+ }, N && this.stdinStream && typeof this.stdinStream.on == "function" && this.stdinStream.on("data", M);
2864
+ 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(), z = 0, B = this.context && this.context.fs ? this.context.fs : this.fs, V = 5, H = new Map([[3, {
2777
2865
  type: "preopen",
2778
2866
  path: "/",
2779
2867
  guestName: "/"
2780
2868
  }], [4, {
2781
2869
  type: "preopen",
2782
- path: O && O.cwd || "/",
2870
+ path: B && B.cwd || "/",
2783
2871
  guestName: "."
2784
- }]]), N = (e, t) => {
2785
- let n = M.get(e);
2872
+ }]]), U = (e, t) => {
2873
+ let n = H.get(e);
2786
2874
  if (!n || n.type !== "preopen" && n.type !== "dir") return null;
2787
- if (t.startsWith("/")) return O.absolutePath(t);
2875
+ if (t.startsWith("/")) return B.absolutePath(t);
2876
+ if (!t || t === ".") return B.absolutePath(n.path);
2788
2877
  let r = n.path.endsWith("/") ? n.path : n.path + "/";
2789
- return O.absolutePath(r + t);
2790
- }, P = (e) => {
2791
- if (!(!e || e.type !== "file" || !e.dirty || !O)) try {
2878
+ return B.absolutePath(r + t);
2879
+ }, ee = (e) => {
2880
+ if (!(!e || e.type !== "file" || !e.dirty || !B)) try {
2792
2881
  let t = !0;
2793
2882
  for (let n = 0; n < e.bytes.length; n++) if (e.bytes[n] === 0) {
2794
2883
  t = !1;
@@ -2796,14 +2885,20 @@ var j, M, N, P, F, I, L, R, z, B, V = e((() => {
2796
2885
  }
2797
2886
  if (t) {
2798
2887
  let t = n.decode(e.bytes);
2799
- O.setFileByPath(e.path, t, !0);
2888
+ B.setFileByPath(e.path, t, !0);
2800
2889
  } else {
2801
2890
  let t = new Uint8Array(e.bytes.length);
2802
- t.set(e.bytes), O.setFileByPath(e.path, new r(t.buffer, "application/octet-stream"), !0);
2891
+ t.set(e.bytes), B.setFileByPath(e.path, new r(t.buffer, "application/octet-stream"), !0);
2803
2892
  }
2804
2893
  e.dirty = !1;
2805
2894
  } catch {}
2806
- }, F = Object.entries(this.context && this.context.vars || {}).map(([e, t]) => `${e}=${t}`), I = new Proxy({
2895
+ }, te = {
2896
+ TERM: "xterm-256color",
2897
+ COLORTERM: "truecolor",
2898
+ COLUMNS: String(this.stdout && this.stdout.columns || this.context && typeof this.context.getVar == "function" && this.context.getVar("COLUMNS") || 80),
2899
+ LINES: String(this.stdout && this.stdout.rows || this.context && typeof this.context.getVar == "function" && this.context.getVar("LINES") || 24),
2900
+ ...this.context && this.context.vars || {}
2901
+ }, W = Object.entries(te).map(([e, t]) => `${e}=${t}`), ne = new Proxy({
2807
2902
  fd_write: (e, t, r, o) => {
2808
2903
  if (!C) return a;
2809
2904
  let s = new DataView(C.buffer);
@@ -2811,11 +2906,11 @@ var j, M, N, P, F, I, L, R, z, B, V = e((() => {
2811
2906
  let a = 0;
2812
2907
  for (let i = 0; i < r; i++) {
2813
2908
  let r = s.getUint32(t + i * 8, !0), o = s.getUint32(t + i * 8 + 4, !0);
2814
- o > 0 && w(e, n.decode(new Uint8Array(C.buffer, r, o))), a += o;
2909
+ o > 0 && P(e, n.decode(new Uint8Array(C.buffer, r, o))), a += o;
2815
2910
  }
2816
2911
  return s.setUint32(o, a, !0), i;
2817
2912
  }
2818
- let c = M.get(e);
2913
+ let c = H.get(e);
2819
2914
  if (!c || c.type !== "file") return a;
2820
2915
  let l = 0;
2821
2916
  for (let e = 0; e < r; e++) {
@@ -2835,14 +2930,36 @@ var j, M, N, P, F, I, L, R, z, B, V = e((() => {
2835
2930
  if (!C) return a;
2836
2931
  let o = new DataView(C.buffer);
2837
2932
  if (e === 0) {
2933
+ if (N && T) {
2934
+ if ((typeof w?.exports?.asyncify_get_state == "function" ? w.exports.asyncify_get_state() : 0) === 2) {
2935
+ w.exports.asyncify_stop_rewind();
2936
+ let e = 0;
2937
+ for (let r = 0; r < n && I.length > 0; r++) {
2938
+ 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);
2939
+ new Uint8Array(C.buffer).set(s, n), e += a;
2940
+ }
2941
+ return o.setUint32(r, e, !0), i;
2942
+ }
2943
+ if (I.length > 0) {
2944
+ let e = 0;
2945
+ for (let r = 0; r < n && I.length > 0; r++) {
2946
+ 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);
2947
+ new Uint8Array(C.buffer).set(s, n), e += a;
2948
+ }
2949
+ return o.setUint32(r, e, !0), i;
2950
+ }
2951
+ return w.exports.asyncify_start_unwind(E), D = new Promise((e) => {
2952
+ O = e;
2953
+ }), o.setUint32(r, 0, !0), i;
2954
+ }
2838
2955
  let e = 0;
2839
- for (let r = 0; r < n && D < E.length; r++) {
2840
- let n = o.getUint32(t + r * 8, !0), i = o.getUint32(t + r * 8 + 4, !0), a = Math.min(i, E.length - D);
2841
- new Uint8Array(C.buffer).set(E.slice(D, D + a), n), D += a, e += a;
2956
+ for (let r = 0; r < n && z < R.length; r++) {
2957
+ let n = o.getUint32(t + r * 8, !0), i = o.getUint32(t + r * 8 + 4, !0), a = Math.min(i, R.length - z);
2958
+ new Uint8Array(C.buffer).set(R.slice(z, z + a), n), z += a, e += a;
2842
2959
  }
2843
2960
  return o.setUint32(r, e, !0), i;
2844
2961
  }
2845
- let s = M.get(e);
2962
+ let s = H.get(e);
2846
2963
  if (!s || s.type !== "file") return a;
2847
2964
  let c = 0;
2848
2965
  for (let e = 0; e < n && s.pos < s.bytes.length; e++) {
@@ -2854,7 +2971,7 @@ var j, M, N, P, F, I, L, R, z, B, V = e((() => {
2854
2971
  fd_seek: (e, t, n, r, o) => {
2855
2972
  if (!C) return a;
2856
2973
  if (e <= 2) return d;
2857
- let c = M.get(e);
2974
+ let c = H.get(e);
2858
2975
  if (!c || c.type !== "file") return a;
2859
2976
  let l, u, f;
2860
2977
  typeof t == "bigint" ? (l = Number(t), u = n, f = r) : (l = t, u = r, f = o);
@@ -2867,32 +2984,32 @@ var j, M, N, P, F, I, L, R, z, B, V = e((() => {
2867
2984
  },
2868
2985
  fd_tell: (e, t) => {
2869
2986
  if (!C) return a;
2870
- let n = M.get(e);
2987
+ let n = H.get(e);
2871
2988
  return !n || n.type !== "file" ? a : (new DataView(C.buffer).setBigUint64(t, BigInt(n.pos), !0), i);
2872
2989
  },
2873
2990
  fd_close: (e) => {
2874
2991
  if (e <= 2) return i;
2875
- let t = M.get(e);
2876
- return t ? (P(t), M.delete(e), i) : a;
2992
+ let t = H.get(e);
2993
+ return t ? (ee(t), H.delete(e), i) : a;
2877
2994
  },
2878
2995
  fd_sync: (e) => {
2879
- let t = M.get(e);
2880
- return t && P(t), i;
2996
+ let t = H.get(e);
2997
+ return t && ee(t), i;
2881
2998
  },
2882
2999
  fd_datasync: (e) => {
2883
- let t = M.get(e);
2884
- return t && P(t), i;
3000
+ let t = H.get(e);
3001
+ return t && ee(t), i;
2885
3002
  },
2886
3003
  fd_prestat_get: (e, t) => {
2887
3004
  if (!C) return a;
2888
- let n = M.get(e);
3005
+ let n = H.get(e);
2889
3006
  if (!n || n.type !== "preopen") return a;
2890
3007
  let r = new DataView(C.buffer), o = b.encode(n.guestName);
2891
3008
  return r.setUint8(t, 0), r.setUint32(t + 4, o.length, !0), i;
2892
3009
  },
2893
3010
  fd_prestat_dir_name: (e, t, n) => {
2894
3011
  if (!C) return a;
2895
- let r = M.get(e);
3012
+ let r = H.get(e);
2896
3013
  if (!r || r.type !== "preopen") return a;
2897
3014
  let o = b.encode(r.guestName);
2898
3015
  return new Uint8Array(C.buffer, t, Math.min(n, o.length)).set(o.subarray(0, n)), i;
@@ -2902,7 +3019,7 @@ var j, M, N, P, F, I, L, R, z, B, V = e((() => {
2902
3019
  let n = new DataView(C.buffer), r = f;
2903
3020
  if (e <= 2) r = p;
2904
3021
  else {
2905
- let t = M.get(e);
3022
+ let t = H.get(e);
2906
3023
  if (!t) return a;
2907
3024
  r = t.type === "preopen" || t.type === "dir" ? m : h;
2908
3025
  }
@@ -2915,22 +3032,22 @@ var j, M, N, P, F, I, L, R, z, B, V = e((() => {
2915
3032
  let n = new DataView(C.buffer);
2916
3033
  for (let e = 0; e < 64; e++) n.setUint8(t + e, 0);
2917
3034
  if (e <= 2) return n.setUint8(t + 16, p), i;
2918
- let r = M.get(e);
3035
+ let r = H.get(e);
2919
3036
  if (!r) return a;
2920
3037
  let o = r.type === "preopen" || r.type === "dir";
2921
3038
  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;
2922
3039
  },
2923
3040
  path_open: (e, t, r, s, d, f, p, m, h) => {
2924
- if (!C || !O) return a;
2925
- let y = N(e, n.decode(new Uint8Array(C.buffer, r, s)));
3041
+ if (!C || !B) return a;
3042
+ let y = U(e, n.decode(new Uint8Array(C.buffer, r, s)));
2926
3043
  if (!y) return a;
2927
- let w = O.stat(y), T = w !== null;
3044
+ let w = B.stat(y), T = w !== null;
2928
3045
  if (d & v && d & g && T) return o;
2929
3046
  if (d & _) {
2930
3047
  if (!T) return l;
2931
3048
  if (!w.isDirectory) return u;
2932
- let e = j++;
2933
- return M.set(e, {
3049
+ let e = V++;
3050
+ return H.set(e, {
2934
3051
  type: "dir",
2935
3052
  path: y
2936
3053
  }), new DataView(C.buffer).setUint32(h, e, !0), i;
@@ -2939,55 +3056,68 @@ var j, M, N, P, F, I, L, R, z, B, V = e((() => {
2939
3056
  if (!T && !(d & g)) return l;
2940
3057
  let E = new Uint8Array(), D = !1;
2941
3058
  if (T && !(d & x)) {
2942
- let e = O.getFileByPath(y);
3059
+ let e = B.getFileByPath(y);
2943
3060
  e != null && (E = typeof e == "string" ? b.encode(e) : new Uint8Array(this._contentToBytes(e)));
2944
3061
  } else D = !0;
2945
- let k = j++;
2946
- return M.set(k, {
3062
+ let O = V++;
3063
+ return H.set(O, {
2947
3064
  type: "file",
2948
3065
  path: y,
2949
3066
  bytes: E,
2950
3067
  pos: m & S ? E.length : 0,
2951
3068
  append: !!(m & S),
2952
3069
  dirty: D
2953
- }), new DataView(C.buffer).setUint32(h, k, !0), i;
3070
+ }), new DataView(C.buffer).setUint32(h, O, !0), i;
2954
3071
  },
2955
3072
  path_filestat_get: (e, t, r, o, s) => {
2956
- if (!C || !O) return a;
2957
- let c = N(e, n.decode(new Uint8Array(C.buffer, r, o)));
3073
+ if (!C || !B) return a;
3074
+ let c = U(e, n.decode(new Uint8Array(C.buffer, r, o)));
2958
3075
  if (!c) return a;
2959
- let u = O.stat(c);
3076
+ let u = B.stat(c);
2960
3077
  if (!u) return l;
2961
3078
  let d = new DataView(C.buffer);
2962
3079
  for (let e = 0; e < 64; e++) d.setUint8(s + e, 0);
2963
- return d.setUint8(s + 16, u.isDirectory ? m : h), d.setBigUint64(s + 24, 1n, !0), d.setBigUint64(s + 32, BigInt(O.getSize(c) || 0), !0), i;
3080
+ return d.setUint8(s + 16, u.isDirectory ? m : h), d.setBigUint64(s + 24, 1n, !0), d.setBigUint64(s + 32, BigInt(B.getSize(c) || 0), !0), i;
2964
3081
  },
2965
3082
  path_create_directory: (e, t, r) => {
2966
- if (!C || !O) return a;
2967
- let o = N(e, n.decode(new Uint8Array(C.buffer, t, r)));
3083
+ if (!C || !B) return a;
3084
+ let o = U(e, n.decode(new Uint8Array(C.buffer, t, r)));
2968
3085
  if (!o) return a;
2969
3086
  try {
2970
- return O.setFileByPath(o, {}, !0), i;
3087
+ return B.setFileByPath(o, {}, !0), i;
2971
3088
  } catch {
2972
3089
  return s;
2973
3090
  }
2974
3091
  },
2975
3092
  path_unlink_file: (e, t, r) => {
2976
- if (!C || !O) return a;
2977
- let o = N(e, n.decode(new Uint8Array(C.buffer, t, r)));
2978
- if (!o || !O.exists(o)) return l;
3093
+ if (!C || !B) return a;
3094
+ let o = U(e, n.decode(new Uint8Array(C.buffer, t, r)));
3095
+ if (!o || !B.exists(o)) return l;
2979
3096
  try {
2980
- return O.deleteFileByPath(o), i;
3097
+ return B.deleteFileByPath(o), i;
2981
3098
  } catch {
2982
3099
  return s;
2983
3100
  }
2984
3101
  },
2985
3102
  path_remove_directory: (e, t, r) => {
2986
- if (!C || !O) return a;
2987
- let o = N(e, n.decode(new Uint8Array(C.buffer, t, r)));
2988
- if (!o || !O.exists(o)) return l;
3103
+ if (!C || !B) return a;
3104
+ let o = U(e, n.decode(new Uint8Array(C.buffer, t, r)));
3105
+ if (!o || !B.exists(o)) return l;
2989
3106
  try {
2990
- return O.deleteFileByPath(o), i;
3107
+ return B.deleteFileByPath(o), i;
3108
+ } catch {
3109
+ return s;
3110
+ }
3111
+ },
3112
+ path_rename: (e, t, r, o, c, u) => {
3113
+ if (!C || !B) return a;
3114
+ let d = n.decode(new Uint8Array(C.buffer, t, r)), f = n.decode(new Uint8Array(C.buffer, c, u)), p = U(e, d), m = U(o, f);
3115
+ if (!p || !m) return a;
3116
+ if (!B.exists(p)) return l;
3117
+ for (let e of H.values()) e.path === p && (ee(e), e.path = m);
3118
+ try {
3119
+ let e = B.getFileByPath(p);
3120
+ return B.setFileByPath(m, e, !0), B.deleteFileByPath(p), i;
2991
3121
  } catch {
2992
3122
  return s;
2993
3123
  }
@@ -3016,16 +3146,16 @@ var j, M, N, P, F, I, L, R, z, B, V = e((() => {
3016
3146
  environ_sizes_get: (e, t) => {
3017
3147
  if (!C) return s;
3018
3148
  let n = new DataView(C.buffer);
3019
- n.setUint32(e, F.length, !0);
3020
- let r = F.reduce((e, t) => e + b.encode(t).length + 1, 0);
3149
+ n.setUint32(e, W.length, !0);
3150
+ let r = W.reduce((e, t) => e + b.encode(t).length + 1, 0);
3021
3151
  return n.setUint32(t, r, !0), i;
3022
3152
  },
3023
3153
  environ_get: (e, t) => {
3024
3154
  if (!C) return s;
3025
3155
  let n = new DataView(C.buffer), r = t;
3026
- for (let t = 0; t < F.length; t++) {
3156
+ for (let t = 0; t < W.length; t++) {
3027
3157
  n.setUint32(e + t * 4, r, !0);
3028
- let i = b.encode(F[t] + "\0");
3158
+ let i = b.encode(W[t] + "\0");
3029
3159
  new Uint8Array(C.buffer).set(i, r), r += i.length;
3030
3160
  }
3031
3161
  return i;
@@ -3046,7 +3176,7 @@ var j, M, N, P, F, I, L, R, z, B, V = e((() => {
3046
3176
  }
3047
3177
  }, { get(e, t) {
3048
3178
  return t in e ? e[t] : () => 0;
3049
- } }), L = (e) => {
3179
+ } }), G = (e) => {
3050
3180
  if (!C || !e) return "";
3051
3181
  try {
3052
3182
  let t = new DataView(C.buffer).getUint32(e - 4, !0), n = new Uint16Array(C.buffer, e, t >>> 1);
@@ -3054,33 +3184,33 @@ var j, M, N, P, F, I, L, R, z, B, V = e((() => {
3054
3184
  } catch {
3055
3185
  return "";
3056
3186
  }
3057
- }, R = {
3058
- wasi_snapshot_preview1: I,
3059
- wasi_unstable: I,
3187
+ }, K = {
3188
+ wasi_snapshot_preview1: ne,
3189
+ wasi_unstable: ne,
3060
3190
  env: new Proxy({
3061
3191
  print: (e, t) => {
3062
- C && w(1, n.decode(new Uint8Array(C.buffer, e, t)));
3192
+ C && P(1, n.decode(new Uint8Array(C.buffer, e, t)));
3063
3193
  },
3064
3194
  eprint: (e, t) => {
3065
- C && w(2, n.decode(new Uint8Array(C.buffer, e, t)));
3195
+ C && P(2, n.decode(new Uint8Array(C.buffer, e, t)));
3066
3196
  },
3067
3197
  log: (e) => {
3068
- w(1, L(e) + "\n");
3198
+ P(1, G(e) + "\n");
3069
3199
  },
3070
3200
  logi: (e) => {
3071
- w(1, String(e) + "\n");
3201
+ P(1, String(e) + "\n");
3072
3202
  },
3073
3203
  logf: (e) => {
3074
- w(1, String(e) + "\n");
3204
+ P(1, String(e) + "\n");
3075
3205
  },
3076
3206
  trace: (e, t, ...n) => {
3077
3207
  let r = t > 0 ? " " + n.slice(0, t).join(", ") : "";
3078
- w(1, `trace: ${L(e)}${r}\n`);
3208
+ P(1, `trace: ${G(e)}${r}\n`);
3079
3209
  },
3080
3210
  seed: () => Date.now() * Math.random(),
3081
3211
  abort: (e, t, n, r) => {
3082
- let i = L(e), a = L(t);
3083
- throw (i || a) && w(2, `abort: ${i || "aborted"} at ${a || this.script}:${n || 0}:${r || 0}\n`), this.exitCode = 134, {
3212
+ let i = G(e), a = G(t);
3213
+ throw (i || a) && P(2, `abort: ${i || "aborted"} at ${a || this.script}:${n || 0}:${r || 0}\n`), this.exitCode = 134, {
3084
3214
  _wasmExit: !0,
3085
3215
  code: 134
3086
3216
  };
@@ -3096,44 +3226,66 @@ var j, M, N, P, F, I, L, R, z, B, V = e((() => {
3096
3226
  initial: 1,
3097
3227
  maximum: 256
3098
3228
  });
3099
- C = t, R[e.module] || (R[e.module] = {}), R[e.module][e.name] = t;
3229
+ C = t, K[e.module] || (K[e.module] = {}), K[e.module][e.name] = t;
3230
+ }
3231
+ if (w = await WebAssembly.instantiate(t, K), w.exports.memory && (C = w.exports.memory), T = !!(w.exports.asyncify_start_unwind && w.exports.asyncify_stop_unwind), T && C) {
3232
+ try {
3233
+ E = C.grow(1) * 65536;
3234
+ } catch {
3235
+ E = 16;
3236
+ }
3237
+ let e = E + 8, t = E + 65536 - 8;
3238
+ new Int32Array(C.buffer, E, 2).set([e, t]);
3239
+ }
3240
+ if (N) {
3241
+ this._enterAltScreen();
3242
+ 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;
3243
+ if (typeof w.exports.set_terminal_size == "function") try {
3244
+ w.exports.set_terminal_size(e, t);
3245
+ } catch {}
3246
+ j = () => {
3247
+ let e = this.stdout && this.stdout.columns || 80, t = this.stdout && this.stdout.rows || 24;
3248
+ if (typeof w?.exports?.set_terminal_size == "function") try {
3249
+ w.exports.set_terminal_size(e, t);
3250
+ } catch {}
3251
+ }, this.stdout && typeof this.stdout.on == "function" && this.stdout.on("resize", j), this.stdinStream && typeof this.stdinStream.on == "function" && this.stdinStream.on("resize", j);
3100
3252
  }
3101
- let n = await WebAssembly.instantiate(t, R);
3102
- n.exports.memory && (C = n.exports.memory);
3103
- let r = n.exports._start || n.exports.__wasi_command || n.exports.main || n.exports.run;
3104
- if (r) try {
3105
- await r();
3253
+ let n = w.exports._start || w.exports.__wasi_command || w.exports.main || w.exports.run;
3254
+ if (n) try {
3255
+ let e = n();
3256
+ 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);
3106
3257
  } catch (e) {
3107
3258
  (!e || !e._wasmExit) && (this.stdErr = `${this.script}: runtime error: ${e?.message || String(e)}`, this.exitCode = 1);
3108
3259
  }
3109
3260
  else {
3110
- let e = Object.entries(n.exports).filter(([, e]) => typeof e == "function").map(([e]) => e), t = e.length > 0 ? ` (module is a library exporting: ${e.join(", ")})` : "";
3261
+ 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(", ")})` : "";
3111
3262
  this.stdErr = `${this.script}: no CLI entry point found (expected _start, main, or run)${t}`, this.exitCode = 1;
3112
3263
  }
3113
3264
  } catch (e) {
3114
3265
  (!e || !e._wasmExit) && (this.stdErr = `${this.script}: ${e?.message || String(e)}`, this.exitCode = 1);
3115
3266
  } finally {
3116
- for (let e of M.values()) P(e);
3267
+ N && this._exitAltScreen(), N && M && this.stdinStream && typeof this.stdinStream.off == "function" && this.stdinStream.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;
3268
+ for (let e of H.values()) ee(e);
3117
3269
  }
3118
- T();
3119
- let z = this.arguments || [];
3270
+ F();
3271
+ let q = this.arguments || [];
3120
3272
  if (!(this.result && this.result.getStdOutput && this.result.getStdOutput().length > 0) && (this.exitCode === 0 || this.exitCode === void 0)) {
3121
3273
  let t = (this.script || "wasm").split("/").pop(), n = Object.assign({
3122
3274
  name: t,
3123
3275
  version: "wasi",
3124
3276
  description: `WebAssembly WASI binary (${this.script})`
3125
3277
  }, this._pkgMeta || {});
3126
- if (z.includes("--help") || z.includes("-h")) {
3278
+ if (q.includes("--help") || q.includes("-h")) {
3127
3279
  let r = k(e);
3128
3280
  for (let e of A(t, n, r)) this.stdOut = e;
3129
- } else (z.includes("--version") || z.includes("-V") || z.includes("-v")) && (this.stdOut = `${t} (${n.name} ${n.version} wasm)`);
3281
+ } else (q.includes("--version") || q.includes("-V") || q.includes("-v")) && (this.stdOut = `${t} (${n.name} ${n.version} wasm)`);
3130
3282
  }
3131
3283
  }
3132
3284
  }, w = /* @__PURE__ */ new Map();
3133
3285
  function T(e, t) {
3134
3286
  if (!e || !e.exists(t)) return null;
3135
3287
  if (e.isRealFilesystem) try {
3136
- let n = K();
3288
+ let n = q();
3137
3289
  return new Uint8Array(n.readFileSync(e.absolutePath(t)));
3138
3290
  } catch {}
3139
3291
  let n = e.getFileByPath(t);
@@ -3162,7 +3314,7 @@ var j, M, N, P, F, I, L, R, z, B, V = e((() => {
3162
3314
  o.set(a);
3163
3315
  let s = new r(o.buffer, i);
3164
3316
  if (e.isRealFilesystem) try {
3165
- let n = K(), r = ie(), i = e.absolutePath(t);
3317
+ let n = q(), r = re(), i = e.absolutePath(t);
3166
3318
  n.mkdirSync(r.dirname(i), { recursive: !0 }), n.writeFileSync(i, y.from(a.buffer, a.byteOffset, a.byteLength));
3167
3319
  return;
3168
3320
  } catch {
@@ -3804,7 +3956,7 @@ var j, M, N, P, F, I, L, R, z, B, V = e((() => {
3804
3956
  j + "+" + I,
3805
3957
  S,
3806
3958
  V
3807
- ].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 = {
3959
+ ].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 = {
3808
3960
  À: "A",
3809
3961
  Á: "A",
3810
3962
  Â: "A",
@@ -3995,7 +4147,7 @@ var j, M, N, P, F, I, L, R, z, B, V = e((() => {
3995
4147
  œ: "oe",
3996
4148
  ʼn: "'n",
3997
4149
  ſ: "ss"
3998
- }, K = typeof pe == "object" && pe && pe.Object === Object && pe, ie = typeof self == "object" && self && self.Object === Object && self, q = K || ie || Function("return this")();
4150
+ }, q = typeof pe == "object" && pe && pe.Object === Object && pe, re = typeof self == "object" && self && self.Object === Object && self, ie = q || re || Function("return this")();
3999
4151
  function ae(e, t, n, r) {
4000
4152
  var i = -1, a = e ? e.length : 0;
4001
4153
  for (r && a && (n = e[++i]); ++i < a;) n = t(n, e[i], i, e);
@@ -4012,12 +4164,12 @@ var j, M, N, P, F, I, L, R, z, B, V = e((() => {
4012
4164
  return e?.[t];
4013
4165
  };
4014
4166
  }
4015
- var ce = se(G);
4167
+ var ce = se(K);
4016
4168
  function le(e) {
4017
4169
  return ne.test(e);
4018
4170
  }
4019
4171
  function ue(e) {
4020
- return re.test(e);
4172
+ return G.test(e);
4021
4173
  }
4022
4174
  function de(e) {
4023
4175
  return le(e) ? fe(e) : J(e);
@@ -4028,7 +4180,7 @@ var j, M, N, P, F, I, L, R, z, B, V = e((() => {
4028
4180
  function me(e) {
4029
4181
  return e.match(W) || [];
4030
4182
  }
4031
- var he = Object.prototype.toString, X = q.Symbol, ge = X ? X.prototype : void 0, _e = ge ? ge.toString : void 0;
4183
+ var he = Object.prototype.toString, X = ie.Symbol, ge = X ? X.prototype : void 0, _e = ge ? ge.toString : void 0;
4032
4184
  function ve(e, t, n) {
4033
4185
  var r = -1, i = e.length;
4034
4186
  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;
@@ -4807,7 +4959,7 @@ var j, M, N, P, F, I, L, R, z, B, V = e((() => {
4807
4959
  }
4808
4960
  };
4809
4961
  })), Ee = /* @__PURE__ */ t(((e, t) => {
4810
- var n = J(), r = K();
4962
+ var n = J(), r = q();
4811
4963
  t.exports = class extends n {
4812
4964
  static get name() {
4813
4965
  return "cp";
@@ -4905,7 +5057,7 @@ var j, M, N, P, F, I, L, R, z, B, V = e((() => {
4905
5057
  })), De = /* @__PURE__ */ t(((e, t) => {
4906
5058
  var n = J(), r = (() => {
4907
5059
  try {
4908
- return K();
5060
+ return q();
4909
5061
  } catch {
4910
5062
  return null;
4911
5063
  }
@@ -5003,7 +5155,7 @@ var j, M, N, P, F, I, L, R, z, B, V = e((() => {
5003
5155
  }
5004
5156
  };
5005
5157
  })), ke = /* @__PURE__ */ t(((e, t) => {
5006
- var n = J(), r = K();
5158
+ var n = J(), r = q();
5007
5159
  t.exports = class extends n {
5008
5160
  static get name() {
5009
5161
  return "mv";
@@ -5047,7 +5199,7 @@ var j, M, N, P, F, I, L, R, z, B, V = e((() => {
5047
5199
  continue;
5048
5200
  }
5049
5201
  try {
5050
- let e = ie();
5202
+ let e = re();
5051
5203
  r.mkdirSync(e.dirname(i), { recursive: !0 }), r.renameSync(n, i);
5052
5204
  } catch (n) {
5053
5205
  this.stdErr = `mv: cannot move '${e}' to '${t}': ${n.message}`, this.exitCode = 1;
@@ -5087,7 +5239,7 @@ var j, M, N, P, F, I, L, R, z, B, V = e((() => {
5087
5239
  }
5088
5240
  };
5089
5241
  })), je = /* @__PURE__ */ t(((e, t) => {
5090
- var n = J(), r = K();
5242
+ var n = J(), r = q();
5091
5243
  t.exports = class extends n {
5092
5244
  static get name() {
5093
5245
  return "rm";
@@ -5134,7 +5286,7 @@ var j, M, N, P, F, I, L, R, z, B, V = e((() => {
5134
5286
  })), Me = /* @__PURE__ */ t(((e, t) => {
5135
5287
  var n = J(), r = (() => {
5136
5288
  try {
5137
- return K();
5289
+ return q();
5138
5290
  } catch {
5139
5291
  return null;
5140
5292
  }
@@ -5203,7 +5355,7 @@ var j, M, N, P, F, I, L, R, z, B, V = e((() => {
5203
5355
  })), Ne = /* @__PURE__ */ t(((e, t) => {
5204
5356
  var n = J(), r = (() => {
5205
5357
  try {
5206
- return K();
5358
+ return q();
5207
5359
  } catch {
5208
5360
  return null;
5209
5361
  }
@@ -5512,7 +5664,7 @@ var j, M, N, P, F, I, L, R, z, B, V = e((() => {
5512
5664
  let e = new TextDecoder().decode(t);
5513
5665
  this.fs.setFileByPath(s, e, !0);
5514
5666
  } else {
5515
- let { BinaryFile: e } = G(), r = e ? new e(t.buffer, n || "application/octet-stream") : t;
5667
+ let { BinaryFile: e } = K(), r = e ? new e(t.buffer, n || "application/octet-stream") : t;
5516
5668
  this.fs.setFileByPath(s, r, !0);
5517
5669
  }
5518
5670
  } catch (e) {
@@ -6222,7 +6374,7 @@ var j, M, N, P, F, I, L, R, z, B, V = e((() => {
6222
6374
  }
6223
6375
  return v.call(t, n, "$&_");
6224
6376
  }
6225
- var P = Pt(), F = P.custom, I = G(F) ? F : null, L = {
6377
+ var P = Pt(), F = P.custom, I = K(F) ? F : null, L = {
6226
6378
  __proto__: null,
6227
6379
  double: "\"",
6228
6380
  single: "'"
@@ -6233,12 +6385,12 @@ var j, M, N, P, F, I, L, R, z, B, V = e((() => {
6233
6385
  };
6234
6386
  t.exports = function e(t, n, r, o) {
6235
6387
  var s = n || {};
6236
- if (q(s, "quoteStyle") && !q(L, s.quoteStyle)) throw TypeError("option \"quoteStyle\" must be \"single\" or \"double\"");
6237
- 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`");
6238
- var u = q(s, "customInspect") ? s.customInspect : !0;
6388
+ if (ie(s, "quoteStyle") && !ie(L, s.quoteStyle)) throw TypeError("option \"quoteStyle\" must be \"single\" or \"double\"");
6389
+ if (ie(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`");
6390
+ var u = ie(s, "customInspect") ? s.customInspect : !0;
6239
6391
  if (typeof u != "boolean" && u !== "symbol") throw TypeError("option \"customInspect\", if provided, must be `true`, `false`, or `'symbol'`");
6240
- 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`");
6241
- if (q(s, "numericSeparator") && typeof s.numericSeparator != "boolean") throw TypeError("option \"numericSeparator\", if provided, must be `true` or `false`");
6392
+ if (ie(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`");
6393
+ if (ie(s, "numericSeparator") && typeof s.numericSeparator != "boolean") throw TypeError("option \"numericSeparator\", if provided, must be `true` or `false`");
6242
6394
  var d = s.numericSeparator;
6243
6395
  if (t === void 0) return "undefined";
6244
6396
  if (t === null) return "null";
@@ -6261,7 +6413,7 @@ var j, M, N, P, F, I, L, R, z, B, V = e((() => {
6261
6413
  function y(t, n, i) {
6262
6414
  if (n && (o = w.call(o), o.push(n)), i) {
6263
6415
  var a = { depth: s.depth };
6264
- return q(s, "quoteStyle") && (a.quoteStyle = s.quoteStyle), e(t, a, r + 1, o);
6416
+ return ie(s, "quoteStyle") && (a.quoteStyle = s.quoteStyle), e(t, a, r + 1, o);
6265
6417
  }
6266
6418
  return e(t, s, r + 1, o);
6267
6419
  }
@@ -6269,7 +6421,7 @@ var j, M, N, P, F, I, L, R, z, B, V = e((() => {
6269
6421
  var x = J(t), T = xe(t, y);
6270
6422
  return "[Function" + (x ? ": " + x : " (anonymous)") + "]" + (T.length > 0 ? " { " + C.call(T, ", ") + " }" : "");
6271
6423
  }
6272
- if (G(t)) {
6424
+ if (K(t)) {
6273
6425
  var D = k ? v.call(String(t), /^(Symbol\(.*\))_[^)]*$/, "$1") : O.call(t);
6274
6426
  return typeof t == "object" && !k ? X(D) : D;
6275
6427
  }
@@ -6279,8 +6431,8 @@ var j, M, N, P, F, I, L, R, z, B, V = e((() => {
6279
6431
  }
6280
6432
  if (H(t)) {
6281
6433
  if (t.length === 0) return "[]";
6282
- var ie = xe(t, y);
6283
- return g && !ve(ie) ? "[" + be(ie, g) + "]" : "[ " + C.call(ie, ", ") + " ]";
6434
+ var re = xe(t, y);
6435
+ return g && !ve(re) ? "[" + be(re, g) + "]" : "[ " + C.call(re, ", ") + " ]";
6284
6436
  }
6285
6437
  if (te(t)) {
6286
6438
  var Y = xe(t, y);
@@ -6306,8 +6458,8 @@ var j, M, N, P, F, I, L, R, z, B, V = e((() => {
6306
6458
  if (de(t)) return ge("WeakSet");
6307
6459
  if (le(t)) return ge("WeakRef");
6308
6460
  if (ne(t)) return X(y(Number(t)));
6309
- if (K(t)) return X(y(E.call(t)));
6310
- if (re(t)) return X(p.call(t));
6461
+ if (q(t)) return X(y(E.call(t)));
6462
+ if (G(t)) return X(p.call(t));
6311
6463
  if (W(t)) return X(y(String(t)));
6312
6464
  if (typeof window < "u" && t === window) return "{ [object Window] }";
6313
6465
  if (typeof globalThis < "u" && t === globalThis || pe !== void 0 && t === pe) return "{ [object globalThis] }";
@@ -6345,10 +6497,10 @@ var j, M, N, P, F, I, L, R, z, B, V = e((() => {
6345
6497
  function ne(e) {
6346
6498
  return ae(e) === "[object Number]" && V(e);
6347
6499
  }
6348
- function re(e) {
6500
+ function G(e) {
6349
6501
  return ae(e) === "[object Boolean]" && V(e);
6350
6502
  }
6351
- function G(e) {
6503
+ function K(e) {
6352
6504
  if (k) return e && typeof e == "object" && e instanceof Symbol;
6353
6505
  if (typeof e == "symbol") return !0;
6354
6506
  if (!e || typeof e != "object" || !O) return !1;
@@ -6357,18 +6509,18 @@ var j, M, N, P, F, I, L, R, z, B, V = e((() => {
6357
6509
  } catch {}
6358
6510
  return !1;
6359
6511
  }
6360
- function K(e) {
6512
+ function q(e) {
6361
6513
  if (!e || typeof e != "object" || !E) return !1;
6362
6514
  try {
6363
6515
  return E.call(e), !0;
6364
6516
  } catch {}
6365
6517
  return !1;
6366
6518
  }
6367
- var ie = Object.prototype.hasOwnProperty || function(e) {
6519
+ var re = Object.prototype.hasOwnProperty || function(e) {
6368
6520
  return e in this;
6369
6521
  };
6370
- function q(e, t) {
6371
- return ie.call(e, t);
6522
+ function ie(e, t) {
6523
+ return re.call(e, t);
6372
6524
  }
6373
6525
  function ae(e) {
6374
6526
  return m.call(e);
@@ -6496,14 +6648,14 @@ var j, M, N, P, F, I, L, R, z, B, V = e((() => {
6496
6648
  var n = H(e), r = [];
6497
6649
  if (n) {
6498
6650
  r.length = e.length;
6499
- for (var i = 0; i < e.length; i++) r[i] = q(e, i) ? t(e[i], e) : "";
6651
+ for (var i = 0; i < e.length; i++) r[i] = ie(e, i) ? t(e[i], e) : "";
6500
6652
  }
6501
6653
  var a = typeof D == "function" ? D(e) : [], o;
6502
6654
  if (k) {
6503
6655
  o = {};
6504
6656
  for (var s = 0; s < a.length; s++) o["$" + a[s]] = a[s];
6505
6657
  }
6506
- 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))));
6658
+ for (var c in e) ie(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))));
6507
6659
  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));
6508
6660
  return r;
6509
6661
  }
@@ -7687,7 +7839,7 @@ var j, M, N, P, F, I, L, R, z, B, V = e((() => {
7687
7839
  f.createReplWasmCommand = p, f.createCommand = p, t.exports = f;
7688
7840
  })), cr = /* @__PURE__ */ t(((e, t) => {
7689
7841
  b();
7690
- var r = ae(), i = J(), a = oe(), o = se(), s = W(), c = ne(), { TtyStream: l } = te(), u = "/.brsh_history", d = xe(), f = Ue(), p = H(), m = x(), { isAsyncFilesystemSource: h, resolveFilesystemSource: g } = re(), _ = /\$(?:\{([\w\d?#@*-]+)\}|([\w\d]+|[?#@*-]))/g, v = p.EventEmitter || p.default || p;
7842
+ var r = ae(), i = J(), a = oe(), o = se(), s = W(), c = ne(), { TtyStream: l } = te(), u = "/.brsh_history", d = xe(), f = Ue(), p = H(), m = x(), { isAsyncFilesystemSource: h, resolveFilesystemSource: g } = G(), _ = /\$(?:\{([\w\d?#@*-]+)\}|([\w\d]+|[?#@*-]))/g, v = p.EventEmitter || p.default || p;
7691
7843
  String.prototype.regexIndexOf = function(e, t) {
7692
7844
  let n = this.substring(t || 0).search(e);
7693
7845
  return n >= 0 ? n + (t || 0) : n;
@@ -8600,7 +8752,7 @@ var j, M, N, P, F, I, L, R, z, B, V = e((() => {
8600
8752
  return e.create(Object.assign({}, n, { filesystem: t }));
8601
8753
  }
8602
8754
  };
8603
- 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;
8755
+ 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;
8604
8756
  }));
8605
8757
  //#endregion
8606
8758
  export default cr();