brsh 2.1.1 → 2.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/.github/workflows/pages.yml +12 -1
  2. package/.nvmrc +1 -0
  3. package/CHANGELOG.md +14 -0
  4. package/Readme.md +191 -3
  5. package/bin/brsh-shell.js +65 -0
  6. package/dist/brsh.css +1 -1
  7. package/dist/shell.es.js +854 -577
  8. package/dist/shell.es.js.map +1 -1
  9. package/dist/shell.min.js +13 -9
  10. package/dist/shell.min.js.map +1 -1
  11. package/dist/terminal.es.js +874 -588
  12. package/dist/terminal.es.js.map +1 -1
  13. package/dist/terminal.min.js +16 -12
  14. package/dist/terminal.min.js.map +1 -1
  15. package/index.js +65 -10
  16. package/lib/BaseFileSystem.js +82 -0
  17. package/lib/Command.js +3 -1
  18. package/lib/Context.js +3 -2
  19. package/lib/FileSystem.js +55 -26
  20. package/lib/NodeFileSystem.js +31 -17
  21. package/lib/Terminal.js +34 -5
  22. package/lib/WasmCommand.js +14 -7
  23. package/lib/buildFilesystemStructure.js +9 -4
  24. package/lib/builtins/cat.js +4 -1
  25. package/lib/builtins/echo.js +2 -0
  26. package/lib/builtins/false.js +1 -1
  27. package/lib/builtins/grep.js +10 -2
  28. package/lib/builtins/ls.js +6 -2
  29. package/lib/builtins/test.js +2 -4
  30. package/lib/builtins/true.js +1 -1
  31. package/lib/local/alias.js +2 -0
  32. package/lib/local/cd.js +5 -3
  33. package/lib/local/chmod.js +2 -3
  34. package/lib/local/clear.js +2 -0
  35. package/lib/local/cp.js +13 -8
  36. package/lib/local/curl.js +138 -0
  37. package/lib/local/exit.js +2 -0
  38. package/lib/local/export.js +2 -0
  39. package/lib/local/index.js +2 -1
  40. package/lib/local/jsfunction.js +1 -1
  41. package/lib/local/mkdir.js +3 -3
  42. package/lib/local/mv.js +12 -6
  43. package/lib/local/pwd.js +2 -0
  44. package/lib/local/read.js +2 -0
  45. package/lib/local/rm.js +1 -1
  46. package/lib/local/source.js +5 -4
  47. package/lib/local/which.js +2 -0
  48. package/package.json +9 -4
  49. package/styles/terminal.css +8 -1
  50. package/test/builtins.test.js +11 -0
  51. package/test/exportFileSystem.test.js +28 -8
  52. package/test/local-commands.test.js +11 -0
  53. package/test/scripts.test.js +57 -0
  54. package/test/shell.test.js +42 -0
  55. package/vite.config.demo.js +35 -0
  56. package/vite.config.js +34 -0
@@ -1,192 +1,83 @@
1
1
  //#region \0rolldown/runtime.js
2
- var e = (e, t) => () => (e && (t = e(e = 0)), t), t = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t.exports), n = /* @__PURE__ */ ((e) => typeof require < "u" ? require : typeof Proxy < "u" ? new Proxy(e, { get: (e, t) => (typeof require < "u" ? require : e)[t] }) : e)(function(e) {
3
- if (typeof require < "u") return require.apply(this, arguments);
4
- throw Error("Calling `require` for \"" + e + "\" in an environment that doesn't expose the `require` function. See https://rolldown.rs/in-depth/bundling-cjs#require-external-modules for more details.");
5
- }), r, i = e((() => {
6
- r = globalThis || self;
7
- })), a = /* @__PURE__ */ t(((e, t) => {
8
- var n = typeof Reflect == "object" ? Reflect : null, r = n && typeof n.apply == "function" ? n.apply : function(e, t, n) {
9
- return Function.prototype.apply.call(e, t, n);
10
- }, i = n && typeof n.ownKeys == "function" ? n.ownKeys : Object.getOwnPropertySymbols ? function(e) {
11
- return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e));
12
- } : function(e) {
13
- return Object.getOwnPropertyNames(e);
14
- };
15
- function a(e) {
16
- console && console.warn && console.warn(e);
17
- }
18
- var o = Number.isNaN || function(e) {
19
- return e !== e;
20
- };
21
- function s() {
22
- s.init.call(this);
23
- }
24
- t.exports = s, t.exports.once = y, s.EventEmitter = s, s.prototype._events = void 0, s.prototype._eventsCount = 0, s.prototype._maxListeners = void 0;
25
- var c = 10;
26
- function l(e) {
27
- if (typeof e != "function") throw TypeError("The \"listener\" argument must be of type Function. Received type " + typeof e);
28
- }
29
- Object.defineProperty(s, "defaultMaxListeners", {
30
- enumerable: !0,
31
- get: function() {
32
- return c;
33
- },
34
- set: function(e) {
35
- if (typeof e != "number" || e < 0 || o(e)) throw RangeError("The value of \"defaultMaxListeners\" is out of range. It must be a non-negative number. Received " + e + ".");
36
- c = e;
37
- }
38
- }), s.init = function() {
39
- (this._events === void 0 || this._events === Object.getPrototypeOf(this)._events) && (this._events = Object.create(null), this._eventsCount = 0), this._maxListeners = this._maxListeners || void 0;
40
- }, s.prototype.setMaxListeners = function(e) {
41
- if (typeof e != "number" || e < 0 || o(e)) throw RangeError("The value of \"n\" is out of range. It must be a non-negative number. Received " + e + ".");
42
- return this._maxListeners = e, this;
43
- };
44
- function u(e) {
45
- return e._maxListeners === void 0 ? s.defaultMaxListeners : e._maxListeners;
46
- }
47
- s.prototype.getMaxListeners = function() {
48
- return u(this);
49
- }, s.prototype.emit = function(e) {
50
- for (var t = [], n = 1; n < arguments.length; n++) t.push(arguments[n]);
51
- var i = e === "error", a = this._events;
52
- if (a !== void 0) i &&= a.error === void 0;
53
- else if (!i) return !1;
54
- if (i) {
55
- var o;
56
- if (t.length > 0 && (o = t[0]), o instanceof Error) throw o;
57
- var s = /* @__PURE__ */ Error("Unhandled error." + (o ? " (" + o.message + ")" : ""));
58
- throw s.context = o, s;
2
+ var e = (e, t) => () => (e && (t = e(e = 0)), t), t = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t.exports), n, r = e((() => {
3
+ n = globalThis || self;
4
+ })), i = /* @__PURE__ */ t(((e, t) => {
5
+ var n = new Set([
6
+ "getFileByPath",
7
+ "setFileByPath",
8
+ "deleteFileByPath",
9
+ "exists",
10
+ "stat",
11
+ "absolutePath",
12
+ "getMode",
13
+ "setMode",
14
+ "isReadable",
15
+ "isWritable",
16
+ "isExecutable",
17
+ "getSize",
18
+ "autoComplete",
19
+ "isRealFilesystem",
20
+ "isSymlink"
21
+ ]);
22
+ t.exports = class {
23
+ isReadable(e) {
24
+ let t = this.getMode(e);
25
+ return t === null ? !1 : (t & 256) != 0;
59
26
  }
60
- var c = a[e];
61
- if (c === void 0) return !1;
62
- if (typeof c == "function") r(c, this, t);
63
- else for (var l = c.length, u = g(c, l), n = 0; n < l; ++n) r(u[n], this, t);
64
- return !0;
65
- };
66
- function d(e, t, n, r) {
67
- var i, o, s;
68
- if (l(n), o = e._events, o === void 0 ? (o = e._events = Object.create(null), e._eventsCount = 0) : (o.newListener !== void 0 && (e.emit("newListener", t, n.listener ? n.listener : n), o = e._events), s = o[t]), s === void 0) s = o[t] = n, ++e._eventsCount;
69
- else if (typeof s == "function" ? s = o[t] = r ? [n, s] : [s, n] : r ? s.unshift(n) : s.push(n), i = u(e), i > 0 && s.length > i && !s.warned) {
70
- s.warned = !0;
71
- var c = /* @__PURE__ */ Error("Possible EventEmitter memory leak detected. " + s.length + " " + String(t) + " listeners added. Use emitter.setMaxListeners() to increase limit");
72
- c.name = "MaxListenersExceededWarning", c.emitter = e, c.type = t, c.count = s.length, a(c);
27
+ isWritable(e) {
28
+ let t = this.getMode(e);
29
+ return t === null ? !1 : (t & 128) != 0;
73
30
  }
74
- return e;
75
- }
76
- s.prototype.addListener = function(e, t) {
77
- return d(this, e, t, !1);
78
- }, s.prototype.on = s.prototype.addListener, s.prototype.prependListener = function(e, t) {
79
- return d(this, e, t, !0);
80
- };
81
- function f() {
82
- if (!this.fired) return this.target.removeListener(this.type, this.wrapFn), this.fired = !0, arguments.length === 0 ? this.listener.call(this.target) : this.listener.apply(this.target, arguments);
83
- }
84
- function p(e, t, n) {
85
- var r = {
86
- fired: !1,
87
- wrapFn: void 0,
88
- target: e,
89
- type: t,
90
- listener: n
91
- }, i = f.bind(r);
92
- return i.listener = n, r.wrapFn = i, i;
93
- }
94
- s.prototype.once = function(e, t) {
95
- return l(t), this.on(e, p(this, e, t)), this;
96
- }, s.prototype.prependOnceListener = function(e, t) {
97
- return l(t), this.prependListener(e, p(this, e, t)), this;
98
- }, s.prototype.removeListener = function(e, t) {
99
- var n, r, i, a, o;
100
- if (l(t), r = this._events, r === void 0 || (n = r[e], n === void 0)) return this;
101
- if (n === t || n.listener === t) --this._eventsCount === 0 ? this._events = Object.create(null) : (delete r[e], r.removeListener && this.emit("removeListener", e, n.listener || t));
102
- else if (typeof n != "function") {
103
- for (i = -1, a = n.length - 1; a >= 0; a--) if (n[a] === t || n[a].listener === t) {
104
- o = n[a].listener, i = a;
105
- break;
106
- }
107
- if (i < 0) return this;
108
- i === 0 ? n.shift() : _(n, i), n.length === 1 && (r[e] = n[0]), r.removeListener !== void 0 && this.emit("removeListener", e, o || t);
31
+ isExecutable(e) {
32
+ let t = this.getMode(e);
33
+ return t === null ? !1 : (t & 64) != 0;
109
34
  }
110
- return this;
111
- }, s.prototype.off = s.prototype.removeListener, s.prototype.removeAllListeners = function(e) {
112
- var t, n = this._events, r;
113
- if (n === void 0) return this;
114
- if (n.removeListener === void 0) return arguments.length === 0 ? (this._events = Object.create(null), this._eventsCount = 0) : n[e] !== void 0 && (--this._eventsCount === 0 ? this._events = Object.create(null) : delete n[e]), this;
115
- if (arguments.length === 0) {
116
- var i = Object.keys(n), a;
117
- for (r = 0; r < i.length; ++r) a = i[r], a !== "removeListener" && this.removeAllListeners(a);
118
- return this.removeAllListeners("removeListener"), this._events = Object.create(null), this._eventsCount = 0, this;
35
+ sandbox() {
36
+ let e = this;
37
+ return new Proxy(Object.create(null), {
38
+ get(t, r) {
39
+ if (!n.has(r)) return;
40
+ let i = e[r];
41
+ return typeof i == "function" ? i.bind(e) : i;
42
+ },
43
+ set() {
44
+ return !1;
45
+ },
46
+ has(e, t) {
47
+ return n.has(t);
48
+ }
49
+ });
119
50
  }
120
- if (t = n[e], typeof t == "function") this.removeListener(e, t);
121
- else if (t !== void 0) for (r = t.length - 1; r >= 0; r--) this.removeListener(e, t[r]);
122
- return this;
123
- };
124
- function m(e, t, n) {
125
- var r = e._events;
126
- if (r === void 0) return [];
127
- var i = r[t];
128
- return i === void 0 ? [] : typeof i == "function" ? n ? [i.listener || i] : [i] : n ? v(i) : g(i, i.length);
129
- }
130
- s.prototype.listeners = function(e) {
131
- return m(this, e, !0);
132
- }, s.prototype.rawListeners = function(e) {
133
- return m(this, e, !1);
134
- }, s.listenerCount = function(e, t) {
135
- return typeof e.listenerCount == "function" ? e.listenerCount(t) : h.call(e, t);
136
- }, s.prototype.listenerCount = h;
137
- function h(e) {
138
- var t = this._events;
139
- if (t !== void 0) {
140
- var n = t[e];
141
- if (typeof n == "function") return 1;
142
- if (n !== void 0) return n.length;
51
+ _triggerChange() {
52
+ !this._onChange || this._changeScheduled || (this._changeScheduled = !0, Promise.resolve().then(() => {
53
+ this._changeScheduled = !1, typeof this._onChange == "function" && this._onChange(this.getRaw(), this.getRawPermissions());
54
+ }));
143
55
  }
144
- return 0;
145
- }
146
- s.prototype.eventNames = function() {
147
- return this._eventsCount > 0 ? i(this._events) : [];
148
56
  };
149
- function g(e, t) {
150
- for (var n = Array(t), r = 0; r < t; ++r) n[r] = e[r];
151
- return n;
152
- }
153
- function _(e, t) {
154
- for (; t + 1 < e.length; t++) e[t] = e[t + 1];
155
- e.pop();
156
- }
157
- function v(e) {
158
- for (var t = Array(e.length), n = 0; n < t.length; ++n) t[n] = e[n].listener || e[n];
159
- return t;
160
- }
161
- function y(e, t) {
162
- return new Promise(function(n, r) {
163
- function i(n) {
164
- e.removeListener(t, a), r(n);
165
- }
166
- function a() {
167
- typeof e.removeListener == "function" && e.removeListener("error", i), n([].slice.call(arguments));
168
- }
169
- x(e, t, a, { once: !0 }), t !== "error" && b(e, i, { once: !0 });
170
- });
171
- }
172
- function b(e, t, n) {
173
- typeof e.on == "function" && x(e, "error", t, n);
174
- }
175
- function x(e, t, n, r) {
176
- if (typeof e.on == "function") r.once ? e.once(t, n) : e.on(t, n);
177
- else if (typeof e.addEventListener == "function") e.addEventListener(t, function i(a) {
178
- r.once && e.removeEventListener(t, i), n(a);
179
- });
180
- else throw TypeError("The \"emitter\" argument must be of type EventEmitter. Received type " + typeof e);
181
- }
182
- })), o = /* @__PURE__ */ t(((e, t) => {
183
- t.exports = class {
57
+ })), a = /* @__PURE__ */ t(((e, t) => {
58
+ var n = i();
59
+ t.exports = class extends n {
184
60
  constructor(e = "/", t = {}, n = {}, r = null) {
185
- this.fileSystem = t, this.permissions = Object.assign({}, n), this.cwd = e, this._onChange = r, this._changeScheduled = !1;
61
+ super(), this.fileSystem = t, this.permissions = Object.assign({}, n), this.cwd = e, this._onChange = r, this._changeScheduled = !1;
186
62
  }
187
63
  getFileByPath(e) {
64
+ let t = this._getFileByAbsolutePath(this._pathToAbsolute(e));
65
+ return t == null || !this.isReadable(e) ? null : t;
66
+ }
67
+ _getFileRaw(e) {
188
68
  return this._getFileByAbsolutePath(this._pathToAbsolute(e));
189
69
  }
70
+ exists(e) {
71
+ return this._getFileByAbsolutePath(this._pathToAbsolute(e)) != null;
72
+ }
73
+ stat(e) {
74
+ let t = this._getFileByAbsolutePath(this._pathToAbsolute(e));
75
+ return t == null ? null : {
76
+ isDirectory: t.constructor === Object,
77
+ isFile: typeof t == "string",
78
+ isCommand: typeof t == "function"
79
+ };
80
+ }
190
81
  _pathToAbsolute(e) {
191
82
  return e.startsWith("./") && (e = e.substring(2)), e.startsWith("/") || (e = this.cwd + e), this._traverseComplexAbsolutePath(e);
192
83
  }
@@ -202,6 +93,18 @@ var e = (e, t) => () => (e && (t = e(e = 0)), t), t = (e, t) => () => (t || (e((
202
93
  return this._pathToAbsolute(e);
203
94
  }
204
95
  setFileByPath(e, t, n = !1) {
96
+ let r = this._pathToAbsolute(e);
97
+ if (this._getFileByAbsolutePath(r) != null) {
98
+ if (!this.isWritable(e)) throw Error("Permission denied");
99
+ } else {
100
+ let e = r.split("/");
101
+ e.pop();
102
+ let t = e.join("/") || "/", n = this.getMode(t);
103
+ if (n !== null && !(n & 128)) throw Error("Permission denied");
104
+ }
105
+ this._setFileByAbsolutePath(r, t, n), this._triggerChange();
106
+ }
107
+ _setFileRaw(e, t, n = !1) {
205
108
  let r = this._pathToAbsolute(e);
206
109
  this._setFileByAbsolutePath(r, t, n), this._triggerChange();
207
110
  }
@@ -247,10 +150,6 @@ var e = (e, t) => () => (e && (t = e(e = 0)), t), t = (e, t) => () => (t || (e((
247
150
  let n = this._pathToAbsolute(e);
248
151
  this.permissions[n] = t, this._triggerChange();
249
152
  }
250
- isExecutable(e) {
251
- let t = this.getMode(e);
252
- return t === null ? !1 : (t & 64) != 0;
253
- }
254
153
  getSize(e) {
255
154
  let t = this._pathToAbsolute(e), n = this._getFileByAbsolutePath(t);
256
155
  return n == null ? 0 : n.constructor === Object ? JSON.stringify(n).length : n.toString().length;
@@ -264,16 +163,13 @@ var e = (e, t) => () => (e && (t = e(e = 0)), t), t = (e, t) => () => (t || (e((
264
163
  getRaw() {
265
164
  return this.fileSystem;
266
165
  }
267
- getRawPermissions() {
268
- return Object.assign({}, this.permissions);
269
- }
270
166
  addFiles(e) {
271
167
  Object.entries(e).forEach(([e, t]) => {
272
- this.setFileByPath(e, t, !0);
168
+ this._setFileRaw(e, t, !0);
273
169
  });
274
170
  }
275
171
  autoComplete(e, t) {
276
- let n = this._pathToAbsolute(e).split("/"), r = n.pop(), i = this.getFileByPath(n.length > 1 ? n.join("/") : "/"), a = this.getFileByPath(t);
172
+ let n = this._pathToAbsolute(e).split("/"), r = n.pop(), i = this._getFileRaw(n.length > 1 ? n.join("/") : "/"), a = this._getFileRaw(t);
277
173
  if (i && i.constructor === Object) {
278
174
  let t = Object.keys(i).filter((e) => e.startsWith(r));
279
175
  r.length < 1 && (t = t.filter((e) => !e.startsWith(".")));
@@ -287,101 +183,96 @@ var e = (e, t) => () => (e && (t = e(e = 0)), t), t = (e, t) => () => (t || (e((
287
183
  }
288
184
  return null;
289
185
  }
290
- _triggerChange() {
291
- !this._onChange || this._changeScheduled || (this._changeScheduled = !0, Promise.resolve().then(() => {
292
- this._changeScheduled = !1, typeof this._onChange == "function" && this._onChange(this.getRaw(), this.getRawPermissions());
293
- }));
294
- }
295
186
  };
296
187
  }));
297
188
  //#endregion
298
189
  //#region node_modules/vite-plugin-node-polyfills/shims/process/dist/index.js
299
- function s(e) {
190
+ function o(e) {
300
191
  return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
301
192
  }
302
- function c() {
193
+ function s() {
303
194
  throw Error("setTimeout has not been defined");
304
195
  }
305
- function l() {
196
+ function c() {
306
197
  throw Error("clearTimeout has not been defined");
307
198
  }
308
- function u(e) {
309
- if (v === setTimeout) return setTimeout(e, 0);
310
- if ((v === c || !v) && setTimeout) return v = setTimeout, setTimeout(e, 0);
199
+ function l(e) {
200
+ if (_ === setTimeout) return setTimeout(e, 0);
201
+ if ((_ === s || !_) && setTimeout) return _ = setTimeout, setTimeout(e, 0);
311
202
  try {
312
- return v(e, 0);
203
+ return _(e, 0);
313
204
  } catch {
314
205
  try {
315
- return v.call(null, e, 0);
206
+ return _.call(null, e, 0);
316
207
  } catch {
317
- return v.call(this, e, 0);
208
+ return _.call(this, e, 0);
318
209
  }
319
210
  }
320
211
  }
321
- function d(e) {
322
- if (y === clearTimeout) return clearTimeout(e);
323
- if ((y === l || !y) && clearTimeout) return y = clearTimeout, clearTimeout(e);
212
+ function u(e) {
213
+ if (v === clearTimeout) return clearTimeout(e);
214
+ if ((v === c || !v) && clearTimeout) return v = clearTimeout, clearTimeout(e);
324
215
  try {
325
- return y(e);
216
+ return v(e);
326
217
  } catch {
327
218
  try {
328
- return y.call(null, e);
219
+ return v.call(null, e);
329
220
  } catch {
330
- return y.call(this, e);
221
+ return v.call(this, e);
331
222
  }
332
223
  }
333
224
  }
334
- function f() {
335
- !x || !S || (x = !1, S.length ? b = S.concat(b) : C = -1, b.length && p());
225
+ function d() {
226
+ !b || !x || (b = !1, x.length ? y = x.concat(y) : S = -1, y.length && f());
336
227
  }
337
- function p() {
338
- if (!x) {
339
- var e = u(f);
340
- x = !0;
341
- for (var t = b.length; t;) {
342
- for (S = b, b = []; ++C < t;) S && S[C].run();
343
- C = -1, t = b.length;
344
- }
345
- S = null, x = !1, d(e);
228
+ function f() {
229
+ if (!b) {
230
+ var e = l(d);
231
+ b = !0;
232
+ for (var t = y.length; t;) {
233
+ for (x = y, y = []; ++S < t;) x && x[S].run();
234
+ S = -1, t = y.length;
235
+ }
236
+ x = null, b = !1, u(e);
346
237
  }
347
238
  }
348
- function m(e, t) {
239
+ function p(e, t) {
349
240
  this.fun = e, this.array = t;
350
241
  }
351
- function h() {}
352
- var g, _, v, y, b, x, S, C, w, T, E = e((() => {
353
- g = { exports: {} }, _ = g.exports = {}, (function() {
242
+ function m() {}
243
+ var h, g, _, v, y, b, x, S, C, w, T = e((() => {
244
+ h = { exports: {} }, g = h.exports = {}, (function() {
354
245
  try {
355
- v = typeof setTimeout == "function" ? setTimeout : c;
246
+ _ = typeof setTimeout == "function" ? setTimeout : s;
356
247
  } catch {
357
- v = c;
248
+ _ = s;
358
249
  }
359
250
  try {
360
- y = typeof clearTimeout == "function" ? clearTimeout : l;
251
+ v = typeof clearTimeout == "function" ? clearTimeout : c;
361
252
  } catch {
362
- y = l;
253
+ v = c;
363
254
  }
364
- })(), b = [], x = !1, C = -1, _.nextTick = function(e) {
255
+ })(), y = [], b = !1, S = -1, g.nextTick = function(e) {
365
256
  var t = Array(arguments.length - 1);
366
257
  if (arguments.length > 1) for (var n = 1; n < arguments.length; n++) t[n - 1] = arguments[n];
367
- b.push(new m(e, t)), b.length === 1 && !x && u(p);
368
- }, m.prototype.run = function() {
258
+ y.push(new p(e, t)), y.length === 1 && !b && l(f);
259
+ }, p.prototype.run = function() {
369
260
  this.fun.apply(null, this.array);
370
- }, _.title = "browser", _.browser = !0, _.env = {}, _.argv = [], _.version = "", _.versions = {}, _.on = h, _.addListener = h, _.once = h, _.off = h, _.removeListener = h, _.removeAllListeners = h, _.emit = h, _.prependListener = h, _.prependOnceListener = h, _.listeners = function(e) {
261
+ }, g.title = "browser", g.browser = !0, g.env = {}, g.argv = [], g.version = "", g.versions = {}, g.on = m, g.addListener = m, g.once = m, g.off = m, g.removeListener = m, g.removeAllListeners = m, g.emit = m, g.prependListener = m, g.prependOnceListener = m, g.listeners = function(e) {
371
262
  return [];
372
- }, _.binding = function(e) {
263
+ }, g.binding = function(e) {
373
264
  throw Error("process.binding is not supported");
374
- }, _.cwd = function() {
265
+ }, g.cwd = function() {
375
266
  return "/";
376
- }, _.chdir = function(e) {
267
+ }, g.chdir = function(e) {
377
268
  throw Error("process.chdir is not supported");
378
- }, _.umask = function() {
269
+ }, g.umask = function() {
379
270
  return 0;
380
- }, w = g.exports, T = /* @__PURE__ */ s(w);
381
- })), D = /* @__PURE__ */ t(((e, t) => {
271
+ }, C = h.exports, w = /* @__PURE__ */ o(C);
272
+ })), E = /* @__PURE__ */ t(((e, t) => {
382
273
  t.exports = null;
383
- })), O = /* @__PURE__ */ t(((e, t) => {
384
- E();
274
+ })), D = /* @__PURE__ */ t(((e, t) => {
275
+ T();
385
276
  function n(e) {
386
277
  if (typeof e != "string") throw TypeError("Path must be a string. Received " + JSON.stringify(e));
387
278
  }
@@ -419,7 +310,7 @@ var g, _, v, y, b, x, S, C, w, T, E = e((() => {
419
310
  resolve: function() {
420
311
  for (var e = "", t = !1, i, a = arguments.length - 1; a >= -1 && !t; a--) {
421
312
  var o;
422
- a >= 0 ? o = arguments[a] : (i === void 0 && (i = T.cwd()), o = i), n(o), o.length !== 0 && (e = o + "/" + e, t = o.charCodeAt(0) === 47);
313
+ a >= 0 ? o = arguments[a] : (i === void 0 && (i = w.cwd()), o = i), n(o), o.length !== 0 && (e = o + "/" + e, t = o.charCodeAt(0) === 47);
423
314
  }
424
315
  return e = r(e, !t), t ? e.length > 0 ? "/" + e : "/" : e.length > 0 ? e : ".";
425
316
  },
@@ -548,12 +439,11 @@ var g, _, v, y, b, x, S, C, w, T, E = e((() => {
548
439
  posix: null
549
440
  };
550
441
  a.posix = a, t.exports = a;
551
- })), k = /* @__PURE__ */ t(((e, t) => {
552
- E();
553
- var n = D(), r = O();
554
- t.exports = class {
442
+ })), O = /* @__PURE__ */ t(((e, t) => {
443
+ T();
444
+ var n = E(), r = D(), a = i(), o = class extends a {
555
445
  constructor(e, t = null) {
556
- this._onChange = t, this._changeScheduled = !1, this._virtualFiles = {}, this.cwd = this._normalizeCwd(e || T.cwd());
446
+ super(), this._onChange = t, this._changeScheduled = !1, this._virtualFiles = {}, this.cwd = this._normalizeCwd(e || w.cwd());
557
447
  }
558
448
  get isRealFilesystem() {
559
449
  return !0;
@@ -633,11 +523,8 @@ var g, _, v, y, b, x, S, C, w, T, E = e((() => {
633
523
  }
634
524
  }
635
525
  setMode(e, t) {
636
- n.chmodSync(this.absolutePath(e), t), this._triggerChange();
637
- }
638
- isExecutable(e) {
639
- let t = this.getMode(e);
640
- return t === null ? !1 : (t & 64) != 0;
526
+ let r = this.absolutePath(e);
527
+ this._virtualFiles[r] === void 0 && (n.chmodSync(r, t), this._triggerChange());
641
528
  }
642
529
  getSize(e) {
643
530
  let t = this.absolutePath(e);
@@ -712,14 +599,43 @@ var g, _, v, y, b, x, S, C, w, T, E = e((() => {
712
599
  })
713
600
  };
714
601
  }
715
- _triggerChange() {
716
- !this._onChange || this._changeScheduled || (this._changeScheduled = !0, Promise.resolve().then(() => {
717
- this._changeScheduled = !1, typeof this._onChange == "function" && this._onChange(null, null);
718
- }));
602
+ _getFileRaw(e) {
603
+ return this.getFileByPath(e);
604
+ }
605
+ exists(e) {
606
+ let t = this.absolutePath(e);
607
+ if (this._virtualFiles[t] !== void 0) return !0;
608
+ try {
609
+ return n.statSync(t), !0;
610
+ } catch {
611
+ return !1;
612
+ }
613
+ }
614
+ stat(e) {
615
+ let t = this.absolutePath(e);
616
+ if (this._virtualFiles[t] !== void 0) {
617
+ let e = this._virtualFiles[t];
618
+ return {
619
+ isDirectory: e != null && e.constructor === Object,
620
+ isFile: typeof e == "string",
621
+ isCommand: typeof e == "function"
622
+ };
623
+ }
624
+ try {
625
+ let e = n.statSync(t);
626
+ return {
627
+ isDirectory: e.isDirectory(),
628
+ isFile: e.isFile(),
629
+ isCommand: !1
630
+ };
631
+ } catch {
632
+ return null;
633
+ }
719
634
  }
720
635
  };
721
- })), A = /* @__PURE__ */ t(((e, t) => {
722
- var n = o();
636
+ t.exports = o, t.exports = o;
637
+ })), k = /* @__PURE__ */ t(((e, t) => {
638
+ var n = a();
723
639
  t.exports = class {
724
640
  constructor(e) {
725
641
  this.options = e;
@@ -746,18 +662,18 @@ var g, _, v, y, b, x, S, C, w, T, E = e((() => {
746
662
  }
747
663
  setCommand(e) {
748
664
  let t = `${this.getVar("PATH")}/${e.name.toLowerCase()}`;
749
- this.fs.addFiles({ [t]: e });
665
+ this.fs.addFiles({ [t]: e }), this.fs.setMode(t, 365);
750
666
  }
751
667
  getCommand(e) {
752
668
  let t = `${this.getVar("PATH")}/${e}`;
753
- return this.fs.getFileByPath(t) || null;
669
+ return this.fs._getFileRaw(t) || null;
754
670
  }
755
671
  setNodeFilesystem(e) {
756
- let t = k(), n = this.fs._onChange;
672
+ let t = O(), n = this.fs._onChange;
757
673
  this.fs = new t(e, n);
758
674
  }
759
675
  setFilesystem(e, t = {}) {
760
- let r = this.fs.getFileByPath(this.getVar("PATH")) || {}, i = this.fs.getRawPermissions(), a = this.fs._onChange;
676
+ let r = this.fs._getFileRaw(this.getVar("PATH")) || {}, i = this.fs.getRawPermissions(), a = this.fs._onChange;
761
677
  this.fs = new n(this.fs.cwd, e, Object.assign({}, i, t), a), this.fs.addFiles(r);
762
678
  }
763
679
  setCwd(e) {
@@ -773,6 +689,181 @@ var g, _, v, y, b, x, S, C, w, T, E = e((() => {
773
689
  typeof this._destroyFn == "function" && this._destroyFn(e);
774
690
  }
775
691
  };
692
+ })), A = /* @__PURE__ */ t(((e, t) => {
693
+ var n = typeof Reflect == "object" ? Reflect : null, r = n && typeof n.apply == "function" ? n.apply : function(e, t, n) {
694
+ return Function.prototype.apply.call(e, t, n);
695
+ }, i = n && typeof n.ownKeys == "function" ? n.ownKeys : Object.getOwnPropertySymbols ? function(e) {
696
+ return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e));
697
+ } : function(e) {
698
+ return Object.getOwnPropertyNames(e);
699
+ };
700
+ function a(e) {
701
+ console && console.warn && console.warn(e);
702
+ }
703
+ var o = Number.isNaN || function(e) {
704
+ return e !== e;
705
+ };
706
+ function s() {
707
+ s.init.call(this);
708
+ }
709
+ t.exports = s, t.exports.once = y, s.EventEmitter = s, s.prototype._events = void 0, s.prototype._eventsCount = 0, s.prototype._maxListeners = void 0;
710
+ var c = 10;
711
+ function l(e) {
712
+ if (typeof e != "function") throw TypeError("The \"listener\" argument must be of type Function. Received type " + typeof e);
713
+ }
714
+ Object.defineProperty(s, "defaultMaxListeners", {
715
+ enumerable: !0,
716
+ get: function() {
717
+ return c;
718
+ },
719
+ set: function(e) {
720
+ if (typeof e != "number" || e < 0 || o(e)) throw RangeError("The value of \"defaultMaxListeners\" is out of range. It must be a non-negative number. Received " + e + ".");
721
+ c = e;
722
+ }
723
+ }), s.init = function() {
724
+ (this._events === void 0 || this._events === Object.getPrototypeOf(this)._events) && (this._events = Object.create(null), this._eventsCount = 0), this._maxListeners = this._maxListeners || void 0;
725
+ }, s.prototype.setMaxListeners = function(e) {
726
+ if (typeof e != "number" || e < 0 || o(e)) throw RangeError("The value of \"n\" is out of range. It must be a non-negative number. Received " + e + ".");
727
+ return this._maxListeners = e, this;
728
+ };
729
+ function u(e) {
730
+ return e._maxListeners === void 0 ? s.defaultMaxListeners : e._maxListeners;
731
+ }
732
+ s.prototype.getMaxListeners = function() {
733
+ return u(this);
734
+ }, s.prototype.emit = function(e) {
735
+ for (var t = [], n = 1; n < arguments.length; n++) t.push(arguments[n]);
736
+ var i = e === "error", a = this._events;
737
+ if (a !== void 0) i &&= a.error === void 0;
738
+ else if (!i) return !1;
739
+ if (i) {
740
+ var o;
741
+ if (t.length > 0 && (o = t[0]), o instanceof Error) throw o;
742
+ var s = /* @__PURE__ */ Error("Unhandled error." + (o ? " (" + o.message + ")" : ""));
743
+ throw s.context = o, s;
744
+ }
745
+ var c = a[e];
746
+ if (c === void 0) return !1;
747
+ if (typeof c == "function") r(c, this, t);
748
+ else for (var l = c.length, u = g(c, l), n = 0; n < l; ++n) r(u[n], this, t);
749
+ return !0;
750
+ };
751
+ function d(e, t, n, r) {
752
+ var i, o, s;
753
+ if (l(n), o = e._events, o === void 0 ? (o = e._events = Object.create(null), e._eventsCount = 0) : (o.newListener !== void 0 && (e.emit("newListener", t, n.listener ? n.listener : n), o = e._events), s = o[t]), s === void 0) s = o[t] = n, ++e._eventsCount;
754
+ else if (typeof s == "function" ? s = o[t] = r ? [n, s] : [s, n] : r ? s.unshift(n) : s.push(n), i = u(e), i > 0 && s.length > i && !s.warned) {
755
+ s.warned = !0;
756
+ var c = /* @__PURE__ */ Error("Possible EventEmitter memory leak detected. " + s.length + " " + String(t) + " listeners added. Use emitter.setMaxListeners() to increase limit");
757
+ c.name = "MaxListenersExceededWarning", c.emitter = e, c.type = t, c.count = s.length, a(c);
758
+ }
759
+ return e;
760
+ }
761
+ s.prototype.addListener = function(e, t) {
762
+ return d(this, e, t, !1);
763
+ }, s.prototype.on = s.prototype.addListener, s.prototype.prependListener = function(e, t) {
764
+ return d(this, e, t, !0);
765
+ };
766
+ function f() {
767
+ if (!this.fired) return this.target.removeListener(this.type, this.wrapFn), this.fired = !0, arguments.length === 0 ? this.listener.call(this.target) : this.listener.apply(this.target, arguments);
768
+ }
769
+ function p(e, t, n) {
770
+ var r = {
771
+ fired: !1,
772
+ wrapFn: void 0,
773
+ target: e,
774
+ type: t,
775
+ listener: n
776
+ }, i = f.bind(r);
777
+ return i.listener = n, r.wrapFn = i, i;
778
+ }
779
+ s.prototype.once = function(e, t) {
780
+ return l(t), this.on(e, p(this, e, t)), this;
781
+ }, s.prototype.prependOnceListener = function(e, t) {
782
+ return l(t), this.prependListener(e, p(this, e, t)), this;
783
+ }, s.prototype.removeListener = function(e, t) {
784
+ var n, r, i, a, o;
785
+ if (l(t), r = this._events, r === void 0 || (n = r[e], n === void 0)) return this;
786
+ if (n === t || n.listener === t) --this._eventsCount === 0 ? this._events = Object.create(null) : (delete r[e], r.removeListener && this.emit("removeListener", e, n.listener || t));
787
+ else if (typeof n != "function") {
788
+ for (i = -1, a = n.length - 1; a >= 0; a--) if (n[a] === t || n[a].listener === t) {
789
+ o = n[a].listener, i = a;
790
+ break;
791
+ }
792
+ if (i < 0) return this;
793
+ i === 0 ? n.shift() : _(n, i), n.length === 1 && (r[e] = n[0]), r.removeListener !== void 0 && this.emit("removeListener", e, o || t);
794
+ }
795
+ return this;
796
+ }, s.prototype.off = s.prototype.removeListener, s.prototype.removeAllListeners = function(e) {
797
+ var t, n = this._events, r;
798
+ if (n === void 0) return this;
799
+ if (n.removeListener === void 0) return arguments.length === 0 ? (this._events = Object.create(null), this._eventsCount = 0) : n[e] !== void 0 && (--this._eventsCount === 0 ? this._events = Object.create(null) : delete n[e]), this;
800
+ if (arguments.length === 0) {
801
+ var i = Object.keys(n), a;
802
+ for (r = 0; r < i.length; ++r) a = i[r], a !== "removeListener" && this.removeAllListeners(a);
803
+ return this.removeAllListeners("removeListener"), this._events = Object.create(null), this._eventsCount = 0, this;
804
+ }
805
+ if (t = n[e], typeof t == "function") this.removeListener(e, t);
806
+ else if (t !== void 0) for (r = t.length - 1; r >= 0; r--) this.removeListener(e, t[r]);
807
+ return this;
808
+ };
809
+ function m(e, t, n) {
810
+ var r = e._events;
811
+ if (r === void 0) return [];
812
+ var i = r[t];
813
+ return i === void 0 ? [] : typeof i == "function" ? n ? [i.listener || i] : [i] : n ? v(i) : g(i, i.length);
814
+ }
815
+ s.prototype.listeners = function(e) {
816
+ return m(this, e, !0);
817
+ }, s.prototype.rawListeners = function(e) {
818
+ return m(this, e, !1);
819
+ }, s.listenerCount = function(e, t) {
820
+ return typeof e.listenerCount == "function" ? e.listenerCount(t) : h.call(e, t);
821
+ }, s.prototype.listenerCount = h;
822
+ function h(e) {
823
+ var t = this._events;
824
+ if (t !== void 0) {
825
+ var n = t[e];
826
+ if (typeof n == "function") return 1;
827
+ if (n !== void 0) return n.length;
828
+ }
829
+ return 0;
830
+ }
831
+ s.prototype.eventNames = function() {
832
+ return this._eventsCount > 0 ? i(this._events) : [];
833
+ };
834
+ function g(e, t) {
835
+ for (var n = Array(t), r = 0; r < t; ++r) n[r] = e[r];
836
+ return n;
837
+ }
838
+ function _(e, t) {
839
+ for (; t + 1 < e.length; t++) e[t] = e[t + 1];
840
+ e.pop();
841
+ }
842
+ function v(e) {
843
+ for (var t = Array(e.length), n = 0; n < t.length; ++n) t[n] = e[n].listener || e[n];
844
+ return t;
845
+ }
846
+ function y(e, t) {
847
+ return new Promise(function(n, r) {
848
+ function i(n) {
849
+ e.removeListener(t, a), r(n);
850
+ }
851
+ function a() {
852
+ typeof e.removeListener == "function" && e.removeListener("error", i), n([].slice.call(arguments));
853
+ }
854
+ x(e, t, a, { once: !0 }), t !== "error" && b(e, i, { once: !0 });
855
+ });
856
+ }
857
+ function b(e, t, n) {
858
+ typeof e.on == "function" && x(e, "error", t, n);
859
+ }
860
+ function x(e, t, n, r) {
861
+ if (typeof e.on == "function") r.once ? e.once(t, n) : e.on(t, n);
862
+ else if (typeof e.addEventListener == "function") e.addEventListener(t, function i(a) {
863
+ r.once && e.removeEventListener(t, i), n(a);
864
+ });
865
+ else throw TypeError("The \"emitter\" argument must be of type EventEmitter. Received type " + typeof e);
866
+ }
776
867
  })), j = /* @__PURE__ */ t(((e, t) => {
777
868
  var n = ["out", "err"];
778
869
  t.exports = class {
@@ -807,8 +898,8 @@ var g, _, v, y, b, x, S, C, w, T, E = e((() => {
807
898
  }
808
899
  };
809
900
  })), N = /* @__PURE__ */ t(((e, t) => {
810
- var n = a(), r = M();
811
- t.exports = class extends n {
901
+ var n = A(), r = M(), i = n.EventEmitter || n.default || n;
902
+ t.exports = class extends i {
812
903
  constructor(e) {
813
904
  super(), this.arguments = e, this.result = new r();
814
905
  }
@@ -843,9 +934,9 @@ var g, _, v, y, b, x, S, C, w, T, E = e((() => {
843
934
  }
844
935
  };
845
936
  })), F = /* @__PURE__ */ t(((e, t) => {
846
- i();
847
- var n = P();
848
- t.exports = class extends n {
937
+ r();
938
+ var i = P();
939
+ t.exports = class extends i {
849
940
  constructor(e, t, n, r = !1) {
850
941
  super(t, n), this.script = e, this.source = r;
851
942
  }
@@ -854,14 +945,14 @@ var g, _, v, y, b, x, S, C, w, T, E = e((() => {
854
945
  filesystem: this.context.fs.getRaw(),
855
946
  permissions: this.context.fs.getRawPermissions()
856
947
  };
857
- this.sandbox = new r.shell({
948
+ this.sandbox = new n.shell({
858
949
  cwd: this.context.fs.cwd,
859
950
  ...e
860
951
  }), this.sandbox.context.source(this.context), this.sandbox.on("stdOut", (e) => this.stdOut = e), this.sandbox.on("stdErr", (e) => this.stdErr = e);
861
952
  let t = this.script.split(/\r?\n/);
862
953
  if (!t[0].startsWith("#!")) return Promise.reject("no interpreter set");
863
- let n = this._parseLines(t.slice(1));
864
- return this._executeNodes(n).then(() => {
954
+ let r = this._parseLines(t.slice(1));
955
+ return this._executeNodes(r).then(() => {
865
956
  this.exitCode = this.sandbox.lastCode, this.source && this.context.source(this.sandbox.context);
866
957
  });
867
958
  }
@@ -1792,8 +1883,8 @@ var B, V, H, U, re, W, G, ie, ae, oe, se = e((() => {
1792
1883
  })(B), oe = B.Buffer, B.Blob, B.BlobOptions, B.Buffer, B.File, B.FileOptions, B.INSPECT_MAX_BYTES, B.SlowBuffer, B.TranscodeEncoding, B.atob, B.btoa, B.constants, B.isAscii, B.isUtf8, B.kMaxLength, B.kStringMaxLength, B.resolveObjectURL, B.transcode;
1793
1884
  })), K = /* @__PURE__ */ t(((e, t) => {
1794
1885
  se();
1795
- var r = F();
1796
- t.exports = class extends r {
1886
+ var n = F();
1887
+ t.exports = class extends n {
1797
1888
  get name() {
1798
1889
  return "wasm";
1799
1890
  }
@@ -1803,7 +1894,7 @@ var B, V, H, U, re, W, G, ie, ae, oe, se = e((() => {
1803
1894
  run() {
1804
1895
  let e = this.script, t = (() => {
1805
1896
  try {
1806
- return D();
1897
+ return E();
1807
1898
  } catch {
1808
1899
  return null;
1809
1900
  }
@@ -1842,15 +1933,24 @@ var B, V, H, U, re, W, G, ie, ae, oe, se = e((() => {
1842
1933
  return t;
1843
1934
  }
1844
1935
  async _runWat(e) {
1845
- let t = new TextDecoder().decode(e), r;
1936
+ let t = new TextDecoder().decode(e), n, r;
1846
1937
  try {
1847
- let e = n("wabt"), { buffer: i } = (typeof e == "function" ? await e() : e).parseWat(this.script, t, { mutable_globals: !0 }).toBinary({});
1848
- r = new Uint8Array(i);
1938
+ r = await import(
1939
+ /* @vite-ignore */
1940
+ "wabt"
1941
+ );
1942
+ } catch {
1943
+ this.stdErr = `${this.script}: WAT execution requires the 'wabt' package\nInstall it with: npm install wabt`, this.exitCode = 1;
1944
+ return;
1945
+ }
1946
+ try {
1947
+ let e = r.default ?? r, { buffer: i } = (typeof e == "function" ? await e() : e).parseWat(this.script, t, { mutable_globals: !0 }).toBinary({});
1948
+ n = new Uint8Array(i);
1849
1949
  } catch (e) {
1850
- e.code === "MODULE_NOT_FOUND" ? (this.stdErr = `${this.script}: WAT execution requires the 'wabt' package`, this.stdErr = "Install it with: npm install wabt") : this.stdErr = `${this.script}: WAT compilation error: ${e.message}`, this.exitCode = 1;
1950
+ this.stdErr = `${this.script}: WAT compilation error: ${e.message}`, this.exitCode = 1;
1851
1951
  return;
1852
1952
  }
1853
- return this._runWasm(r);
1953
+ return this._runWasm(n);
1854
1954
  }
1855
1955
  async _runWasm(e) {
1856
1956
  if (typeof WebAssembly > "u") {
@@ -1982,7 +2082,7 @@ var B, V, H, U, re, W, G, ie, ae, oe, se = e((() => {
1982
2082
  };
1983
2083
  })), q = /* @__PURE__ */ t(((e, t) => {
1984
2084
  var n = N(), r = class extends n {
1985
- get name() {
2085
+ static get name() {
1986
2086
  return "test";
1987
2087
  }
1988
2088
  get requiresFilesystem() {
@@ -2056,18 +2156,21 @@ var B, V, H, U, re, W, G, ie, ae, oe, se = e((() => {
2056
2156
  }
2057
2157
  return !1;
2058
2158
  }
2059
- }, i = class extends r {
2060
- get name() {
2061
- return "[";
2062
- }
2063
2159
  };
2064
- Object.defineProperty(i, "name", { value: "[" }), t.exports = {
2160
+ t.exports = {
2065
2161
  Test: r,
2066
- TestBracket: i
2162
+ TestBracket: class extends r {
2163
+ static get name() {
2164
+ return "[";
2165
+ }
2166
+ }
2067
2167
  };
2068
2168
  })), ce = /* @__PURE__ */ t(((e, t) => {
2069
2169
  var n = N();
2070
2170
  t.exports = class extends n {
2171
+ static get name() {
2172
+ return "cat";
2173
+ }
2071
2174
  get requiresFilesystem() {
2072
2175
  return !0;
2073
2176
  }
@@ -2086,7 +2189,10 @@ var B, V, H, U, re, W, G, ie, ae, oe, se = e((() => {
2086
2189
  continue;
2087
2190
  }
2088
2191
  let t = this.fs.getFileByPath(e);
2089
- if (t == null) return this.stdErr = `${e}: No such file or directory`, this.exitCode = 1, Promise.resolve();
2192
+ if (t == null) {
2193
+ let t = this.fs.exists(e) ? "Permission denied" : "No such file or directory";
2194
+ return this.stdErr = `${e}: ${t}`, this.exitCode = 1, Promise.resolve();
2195
+ }
2090
2196
  if (t.constructor === Object) return this.stdErr = `${e}: Is a directory`, this.exitCode = 1, Promise.resolve();
2091
2197
  i.push(t.toString());
2092
2198
  }
@@ -2211,8 +2317,8 @@ var B, V, H, U, re, W, G, ie, ae, oe, se = e((() => {
2211
2317
  isAsyncFunction: g
2212
2318
  }, 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;
2213
2319
  })), fe = /* @__PURE__ */ t(((e, t) => {
2214
- i();
2215
- var n = Infinity, a = "[object Symbol]", o = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g, s = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g, c = "\\ud800-\\udfff", l = "\\u0300-\\u036f\\ufe20-\\ufe23", u = "\\u20d0-\\u20f0", d = "\\u2700-\\u27bf", f = "a-z\\xdf-\\xf6\\xf8-\\xff", p = "\\xac\\xb1\\xd7\\xf7", m = "\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf", h = "\\u2000-\\u206f", g = " \\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", _ = "A-Z\\xc0-\\xd6\\xd8-\\xde", v = "\\ufe0e\\ufe0f", y = p + m + h + g, b = "['’]", x = "[" + c + "]", S = "[" + y + "]", C = "[" + l + u + "]", w = "\\d+", T = "[" + d + "]", E = "[" + f + "]", D = "[^" + c + y + w + d + f + _ + "]", O = "\\ud83c[\\udffb-\\udfff]", k = "(?:" + C + "|" + O + ")", A = "[^" + c + "]", j = "(?:\\ud83c[\\udde6-\\uddff]){2}", M = "[\\ud800-\\udbff][\\udc00-\\udfff]", N = "[" + _ + "]", P = "\\u200d", F = "(?:" + E + "|" + D + ")", I = "(?:" + N + "|" + D + ")", L = "(?:" + b + "(?:d|ll|m|re|s|t|ve))?", ee = "(?:" + b + "(?:D|LL|M|RE|S|T|VE))?", te = k + "?", R = "[" + v + "]?", z = "(?:" + P + "(?:" + [
2320
+ r();
2321
+ var i = Infinity, a = "[object Symbol]", o = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g, s = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g, c = "\\ud800-\\udfff", l = "\\u0300-\\u036f\\ufe20-\\ufe23", u = "\\u20d0-\\u20f0", d = "\\u2700-\\u27bf", f = "a-z\\xdf-\\xf6\\xf8-\\xff", p = "\\xac\\xb1\\xd7\\xf7", m = "\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf", h = "\\u2000-\\u206f", g = " \\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", _ = "A-Z\\xc0-\\xd6\\xd8-\\xde", v = "\\ufe0e\\ufe0f", y = p + m + h + g, b = "['’]", x = "[" + c + "]", S = "[" + y + "]", C = "[" + l + u + "]", w = "\\d+", T = "[" + d + "]", E = "[" + f + "]", D = "[^" + c + y + w + d + f + _ + "]", O = "\\ud83c[\\udffb-\\udfff]", k = "(?:" + C + "|" + O + ")", A = "[^" + c + "]", j = "(?:\\ud83c[\\udde6-\\uddff]){2}", M = "[\\ud800-\\udbff][\\udc00-\\udfff]", N = "[" + _ + "]", P = "\\u200d", F = "(?:" + E + "|" + D + ")", I = "(?:" + N + "|" + D + ")", L = "(?:" + b + "(?:d|ll|m|re|s|t|ve))?", ee = "(?:" + b + "(?:D|LL|M|RE|S|T|VE))?", te = k + "?", R = "[" + v + "]?", z = "(?:" + P + "(?:" + [
2216
2322
  A,
2217
2323
  j,
2218
2324
  M
@@ -2432,7 +2538,7 @@ var B, V, H, U, re, W, G, ie, ae, oe, se = e((() => {
2432
2538
  œ: "oe",
2433
2539
  ʼn: "'n",
2434
2540
  ſ: "ss"
2435
- }, oe = typeof r == "object" && r && r.Object === Object && r, se = typeof self == "object" && self && self.Object === Object && self, K = oe || se || Function("return this")();
2541
+ }, oe = typeof n == "object" && n && n.Object === Object && n, se = typeof self == "object" && self && self.Object === Object && self, K = oe || se || Function("return this")();
2436
2542
  function q(e, t, n, r) {
2437
2543
  var i = -1, a = e ? e.length : 0;
2438
2544
  for (r && a && (n = e[++i]); ++i < a;) n = t(n, e[i], i, e);
@@ -2476,7 +2582,7 @@ var B, V, H, U, re, W, G, ie, ae, oe, se = e((() => {
2476
2582
  if (typeof e == "string") return e;
2477
2583
  if (Te(e)) return ve ? ve.call(e) : "";
2478
2584
  var t = e + "";
2479
- return t == "0" && 1 / e == -n ? "-0" : t;
2585
+ return t == "0" && 1 / e == -i ? "-0" : t;
2480
2586
  }
2481
2587
  function xe(e, t, n) {
2482
2588
  var r = e.length;
@@ -2518,7 +2624,7 @@ var B, V, H, U, re, W, G, ie, ae, oe, se = e((() => {
2518
2624
  }
2519
2625
  t.exports = De;
2520
2626
  })), pe = /* @__PURE__ */ t(((e, t) => {
2521
- E();
2627
+ T();
2522
2628
  var n = le(), r = ue(), i = de(), a = fe(), o = {
2523
2629
  short: /^-([^\d-])$/,
2524
2630
  long: /^--(\S+)/,
@@ -2526,10 +2632,10 @@ var B, V, H, U, re, W, G, ie, ae, oe, se = e((() => {
2526
2632
  optEquals: /^(--\S+?)=(.*)/
2527
2633
  }, s = class extends Array {
2528
2634
  load(e) {
2529
- if (this.clear(), e && e !== T.argv) e = n(e);
2635
+ if (this.clear(), e && e !== w.argv) e = n(e);
2530
2636
  else {
2531
- e = T.argv.slice(0);
2532
- let t = T.execArgv.some(m) ? 1 : 2;
2637
+ e = w.argv.slice(0);
2638
+ let t = w.execArgv.some(m) ? 1 : 2;
2533
2639
  e.splice(0, t);
2534
2640
  }
2535
2641
  e.forEach((e) => this.push(String(e)));
@@ -2726,7 +2832,7 @@ var B, V, H, U, re, W, G, ie, ae, oe, se = e((() => {
2726
2832
  static create(e) {
2727
2833
  return new this(e);
2728
2834
  }
2729
- }, w = class extends Map {
2835
+ }, E = class extends Map {
2730
2836
  constructor(e) {
2731
2837
  super(), this.definitions = g.from(e), this.set("_unknown", S.create({
2732
2838
  name: "_unknown",
@@ -2743,7 +2849,7 @@ var B, V, H, U, re, W, G, ie, ae, oe, se = e((() => {
2743
2849
  }
2744
2850
  return e.skipUnknown && delete t._unknown, t;
2745
2851
  }
2746
- }, D = class extends w {
2852
+ }, D = class extends E {
2747
2853
  toObject(e) {
2748
2854
  let t = super.toObject({ skipUnknown: e.skipUnknown }), r = super.toObject(e), o = r._unknown;
2749
2855
  delete r._unknown;
@@ -2763,7 +2869,7 @@ var B, V, H, U, re, W, G, ie, ae, oe, se = e((() => {
2763
2869
  argv: t.argv,
2764
2870
  stopAtFirstUnknown: t.stopAtFirstUnknown,
2765
2871
  caseInsensitive: t.caseInsensitive
2766
- }), r = new (e.isGrouped() ? D : w)(e);
2872
+ }), r = new (e.isGrouped() ? D : E)(e);
2767
2873
  for (let e of n) {
2768
2874
  let n = e.subArg || e.arg;
2769
2875
  if (!t.partial) {
@@ -2787,6 +2893,9 @@ var B, V, H, U, re, W, G, ie, ae, oe, se = e((() => {
2787
2893
  })), me = /* @__PURE__ */ t(((e, t) => {
2788
2894
  var n = N(), r = pe();
2789
2895
  t.exports = class extends n {
2896
+ static get name() {
2897
+ return "ls";
2898
+ }
2790
2899
  get requiresFilesystem() {
2791
2900
  return !0;
2792
2901
  }
@@ -2799,7 +2908,10 @@ var B, V, H, U, re, W, G, ie, ae, oe, se = e((() => {
2799
2908
  }
2800
2909
  if (n.one = n.one || t, n.help) return this.printHelp(), Promise.resolve();
2801
2910
  let r = this.fs.getFileByPath(n.path);
2802
- if (!r) return Promise.reject(`${n.path}: No such file or directory`);
2911
+ if (!r) {
2912
+ let e = this.fs.exists(n.path) ? "Permission denied" : "No such file or directory";
2913
+ return Promise.reject(`${n.path}: ${e}`);
2914
+ }
2803
2915
  if (r.constructor === Object) {
2804
2916
  let e = r;
2805
2917
  n.all || (e = Object.entries(e).reduce((e, [t, n]) => (t.startsWith(".") || (e[t] = n), e), {}));
@@ -2822,8 +2934,9 @@ var B, V, H, U, re, W, G, ie, ae, oe, se = e((() => {
2822
2934
  this.stdOut = Object.entries(e).reduce((e, [n, r]) => e + this.padString(this._applyIndicator(n, r, t)), "");
2823
2935
  }
2824
2936
  printLong(e, t) {
2825
- Object.entries(e).forEach(([e, n]) => {
2826
- let r = t + "/" + e, i = n != null && n.constructor === Object, a = this.fs.getMode(r), o = a === null ? i ? 493 : 420 : a, s = this._modeToString(o, i), c = this.fs.getSize(r);
2937
+ let n = t.endsWith("/") ? t.slice(0, -1) : t;
2938
+ Object.entries(e).forEach(([e, t]) => {
2939
+ let r = n + "/" + e, i = t != null && t.constructor === Object, a = this.fs.getMode(r), o = a === null ? i ? 493 : 420 : a, s = this._modeToString(o, i), c = this.fs.getSize(r);
2827
2940
  return this.stdOut = `${s} root users ${this.padString(c, 10)} ${e}`;
2828
2941
  });
2829
2942
  }
@@ -2881,6 +2994,9 @@ var B, V, H, U, re, W, G, ie, ae, oe, se = e((() => {
2881
2994
  })), J = /* @__PURE__ */ t(((e, t) => {
2882
2995
  var n = N();
2883
2996
  t.exports = class extends n {
2997
+ static get name() {
2998
+ return "echo";
2999
+ }
2884
3000
  run() {
2885
3001
  let e = [...this.arguments], t = !1, n = !1;
2886
3002
  for (; e.length > 0 && /^-[neE]+$/.test(e[0]);) {
@@ -2894,6 +3010,9 @@ var B, V, H, U, re, W, G, ie, ae, oe, se = e((() => {
2894
3010
  })), he = /* @__PURE__ */ t(((e, t) => {
2895
3011
  var n = N();
2896
3012
  t.exports = class extends n {
3013
+ static get name() {
3014
+ return "grep";
3015
+ }
2897
3016
  get requiresFilesystem() {
2898
3017
  return !0;
2899
3018
  }
@@ -2972,7 +3091,13 @@ var B, V, H, U, re, W, G, ie, ae, oe, se = e((() => {
2972
3091
  if (p === "-") e = this.stdin || "";
2973
3092
  else {
2974
3093
  let t = this.fs.getFileByPath(p);
2975
- if (t == null) return f || (this.stdErr = `grep: ${p}: No such file or directory`), this.exitCode = 2, Promise.resolve();
3094
+ if (t == null) {
3095
+ if (!f) {
3096
+ let e = this.fs.exists(p) ? "Permission denied" : "No such file or directory";
3097
+ this.stdErr = `grep: ${p}: ${e}`;
3098
+ }
3099
+ return this.exitCode = 2, Promise.resolve();
3100
+ }
2976
3101
  e = t.toString();
2977
3102
  }
2978
3103
  for (let t of e.split("\n")) t.length > 0 && h.push(t);
@@ -2996,7 +3121,11 @@ var B, V, H, U, re, W, G, ie, ae, oe, se = e((() => {
2996
3121
  let x = [], S = !1, C = this.stdin || "", w = (e, t = !1) => {
2997
3122
  let n = this.fs.getFileByPath(e);
2998
3123
  if (n == null) {
2999
- f || (this.stdErr = `grep: ${e}: No such file or directory`), S = !0;
3124
+ if (!f) {
3125
+ let t = this.fs.exists(e) ? "Permission denied" : "No such file or directory";
3126
+ this.stdErr = `grep: ${e}: ${t}`;
3127
+ }
3128
+ S = !0;
3000
3129
  return;
3001
3130
  }
3002
3131
  if (n.constructor === Object) {
@@ -3079,7 +3208,7 @@ var B, V, H, U, re, W, G, ie, ae, oe, se = e((() => {
3079
3208
  })), ge = /* @__PURE__ */ t(((e, t) => {
3080
3209
  var n = N();
3081
3210
  t.exports = class extends n {
3082
- get name() {
3211
+ static get name() {
3083
3212
  return "true";
3084
3213
  }
3085
3214
  run() {
@@ -3089,7 +3218,7 @@ var B, V, H, U, re, W, G, ie, ae, oe, se = e((() => {
3089
3218
  })), Y = /* @__PURE__ */ t(((e, t) => {
3090
3219
  var n = N();
3091
3220
  t.exports = class extends n {
3092
- get name() {
3221
+ static get name() {
3093
3222
  return "false";
3094
3223
  }
3095
3224
  run() {
@@ -3111,6 +3240,9 @@ var B, V, H, U, re, W, G, ie, ae, oe, se = e((() => {
3111
3240
  })), ve = /* @__PURE__ */ t(((e, t) => {
3112
3241
  var n = P();
3113
3242
  t.exports = class extends n {
3243
+ static get name() {
3244
+ return "alias";
3245
+ }
3114
3246
  run() {
3115
3247
  if (this.arguments.length !== 1) return Promise.reject("alias requires a single argument");
3116
3248
  let e = this.arguments[0].split("=");
@@ -3120,6 +3252,9 @@ var B, V, H, U, re, W, G, ie, ae, oe, se = e((() => {
3120
3252
  })), ye = /* @__PURE__ */ t(((e, t) => {
3121
3253
  var n = P();
3122
3254
  t.exports = class extends n {
3255
+ static get name() {
3256
+ return "export";
3257
+ }
3123
3258
  run() {
3124
3259
  if (this.arguments.length !== 1) return Promise.reject("export requires a single argument");
3125
3260
  let e = this.arguments[0].split("=");
@@ -3129,16 +3264,19 @@ var B, V, H, U, re, W, G, ie, ae, oe, se = e((() => {
3129
3264
  })), be = /* @__PURE__ */ t(((e, t) => {
3130
3265
  var n = P();
3131
3266
  t.exports = class extends n {
3267
+ static get name() {
3268
+ return "cd";
3269
+ }
3132
3270
  run() {
3133
3271
  if (this.arguments.length !== 1) return Promise.reject("cd requires a single argument");
3134
- let e = this.context.fs.getFileByPath(this.arguments[0]);
3135
- return e ? e.constructor === Object ? (this.context.setCwd(this.arguments[0]), Promise.resolve()) : Promise.reject(`${this.arguments[0]}: Not a directory`) : Promise.reject("file or directory not found");
3272
+ let e = this.context.fs.stat(this.arguments[0]);
3273
+ return e ? e.isDirectory ? (this.context.setCwd(this.arguments[0]), Promise.resolve()) : Promise.reject(`${this.arguments[0]}: Not a directory`) : Promise.reject("file or directory not found");
3136
3274
  }
3137
3275
  };
3138
3276
  })), xe = /* @__PURE__ */ t(((e, t) => {
3139
3277
  var n = P();
3140
3278
  t.exports = class extends n {
3141
- get name() {
3279
+ static get name() {
3142
3280
  return "chmod";
3143
3281
  }
3144
3282
  get requiresFilesystem() {
@@ -3149,7 +3287,7 @@ var B, V, H, U, re, W, G, ie, ae, oe, se = e((() => {
3149
3287
  if (e.length < 2) return this.stdErr = "chmod: usage: chmod MODE FILE...", this.exitCode = 1, Promise.resolve();
3150
3288
  let t = e[0], n = e.slice(1);
3151
3289
  for (let e of n) {
3152
- if (this.fs.getFileByPath(e) == null) {
3290
+ if (!this.fs.exists(e)) {
3153
3291
  this.stdErr = `chmod: cannot access '${e}': No such file or directory`, this.exitCode = 1;
3154
3292
  continue;
3155
3293
  }
@@ -3192,9 +3330,9 @@ var B, V, H, U, re, W, G, ie, ae, oe, se = e((() => {
3192
3330
  }
3193
3331
  };
3194
3332
  })), Se = /* @__PURE__ */ t(((e, t) => {
3195
- var n = P(), r = D();
3333
+ var n = P(), r = E();
3196
3334
  t.exports = class extends n {
3197
- get name() {
3335
+ static get name() {
3198
3336
  return "cp";
3199
3337
  }
3200
3338
  get requiresFilesystem() {
@@ -3234,14 +3372,14 @@ var B, V, H, U, re, W, G, ie, ae, oe, se = e((() => {
3234
3372
  for (; s < o.length;) a.push(o[s++]);
3235
3373
  let c = t === null ? n ? "preserve" : "follow" : t;
3236
3374
  if (a.length < 2) return this.stdErr = `cp: missing destination file operand${a.length ? ` after '${a[0]}'` : ""}`, this.exitCode = 1, Promise.resolve();
3237
- let l = a[a.length - 1], u = a.slice(0, -1), d = this.fs.getFileByPath(l), f = d != null && d.constructor === Object, p = r || c === "follow_cl" ? "follow" : c, m = r || c === "follow_cl" ? i === null ? "preserve" : i : c;
3375
+ let l = a[a.length - 1], u = a.slice(0, -1), d = this.fs.stat(l), f = d !== null && d.isDirectory, p = r || c === "follow_cl" ? "follow" : c, m = r || c === "follow_cl" ? i === null ? "preserve" : i : c;
3238
3376
  for (let t of u) {
3239
- let n = this.fs.isSymlink ? this.fs.isSymlink(t) : !1, r = this.fs.getFileByPath(t);
3240
- if (r == null) {
3377
+ let n = this.fs.isSymlink ? this.fs.isSymlink(t) : !1, r = this.fs.stat(t);
3378
+ if (r === null) {
3241
3379
  this.stdErr = `cp: cannot stat '${t}': No such file or directory`, this.exitCode = 1;
3242
3380
  continue;
3243
3381
  }
3244
- if (!(n && p === "preserve") && r.constructor === Object && !e) {
3382
+ if (!(n && p === "preserve") && r.isDirectory && !e) {
3245
3383
  this.stdErr = `cp: omitting directory '${t}'`, this.exitCode = 1;
3246
3384
  continue;
3247
3385
  }
@@ -3262,7 +3400,7 @@ var B, V, H, U, re, W, G, ie, ae, oe, se = e((() => {
3262
3400
  return null;
3263
3401
  }
3264
3402
  let o = this.fs.getFileByPath(e);
3265
- if (o == null) return `cp: cannot stat '${e}': No such file or directory`;
3403
+ if (o == null) return `cp: cannot stat '${e}': ${this.fs.exists(e) ? "Permission denied" : "No such file or directory"}`;
3266
3404
  if (o.constructor === Object) {
3267
3405
  try {
3268
3406
  this.fs.setFileByPath(t, {}, !0);
@@ -3279,14 +3417,18 @@ var B, V, H, U, re, W, G, ie, ae, oe, se = e((() => {
3279
3417
  let r = e.replace(/\/$/, "") + "/" + n, i = t.replace(/\/$/, "") + "/" + n, o = this.fs.isSymlink ? this.fs.isSymlink(r) : !1, s = this._copy(r, i, a, o, a);
3280
3418
  s && (this.stdErr = s, this.exitCode = 1);
3281
3419
  }
3282
- } else this.fs.setFileByPath(t, o, !0);
3420
+ } else try {
3421
+ this.fs.setFileByPath(t, o, !0);
3422
+ } catch (e) {
3423
+ return `cp: cannot create '${t}': ${e.message}`;
3424
+ }
3283
3425
  return null;
3284
3426
  }
3285
3427
  };
3286
3428
  })), Ce = /* @__PURE__ */ t(((e, t) => {
3287
3429
  var n = P();
3288
3430
  t.exports = class extends n {
3289
- get name() {
3431
+ static get name() {
3290
3432
  return "mkdir";
3291
3433
  }
3292
3434
  get requiresFilesystem() {
@@ -3297,7 +3439,7 @@ var B, V, H, U, re, W, G, ie, ae, oe, se = e((() => {
3297
3439
  for (let n of this.arguments) n === "-p" || n === "--parents" ? e = !0 : t.push(n);
3298
3440
  if (t.length === 0) return this.stdErr = "mkdir: missing operand", this.exitCode = 1, Promise.resolve();
3299
3441
  for (let n of t) {
3300
- if (this.fs.getFileByPath(n) != null) {
3442
+ if (this.fs.exists(n)) {
3301
3443
  e || (this.stdErr = `mkdir: cannot create directory '${n}': File exists`, this.exitCode = 1);
3302
3444
  continue;
3303
3445
  }
@@ -3311,9 +3453,9 @@ var B, V, H, U, re, W, G, ie, ae, oe, se = e((() => {
3311
3453
  }
3312
3454
  };
3313
3455
  })), we = /* @__PURE__ */ t(((e, t) => {
3314
- var n = P(), r = D();
3456
+ var n = P(), r = E();
3315
3457
  t.exports = class extends n {
3316
- get name() {
3458
+ static get name() {
3317
3459
  return "mv";
3318
3460
  }
3319
3461
  get requiresFilesystem() {
@@ -3343,7 +3485,7 @@ var B, V, H, U, re, W, G, ie, ae, oe, se = e((() => {
3343
3485
  for (; i < n.length;) t.push(n[i++]);
3344
3486
  let a = e === null ? t[t.length - 1] : e, o = e === null ? t.slice(0, -1) : t;
3345
3487
  if (!a || o.length === 0) return this.stdErr = `mv: missing destination file operand${o.length ? ` after '${o[0]}'` : ""}`, this.exitCode = 1, Promise.resolve();
3346
- let s = this.fs.getFileByPath(a), c = s != null && s.constructor === Object;
3488
+ let s = this.fs.stat(a), c = s !== null && s.isDirectory;
3347
3489
  for (let e of o) {
3348
3490
  let t = c ? a.replace(/\/$/, "") + "/" + e.split("/").pop() : a;
3349
3491
  if (this.fs.isRealFilesystem) {
@@ -3355,7 +3497,7 @@ var B, V, H, U, re, W, G, ie, ae, oe, se = e((() => {
3355
3497
  continue;
3356
3498
  }
3357
3499
  try {
3358
- let e = O();
3500
+ let e = D();
3359
3501
  r.mkdirSync(e.dirname(i), { recursive: !0 }), r.renameSync(n, i);
3360
3502
  } catch (n) {
3361
3503
  this.stdErr = `mv: cannot move '${e}' to '${t}': ${n.message}`, this.exitCode = 1;
@@ -3363,10 +3505,15 @@ var B, V, H, U, re, W, G, ie, ae, oe, se = e((() => {
3363
3505
  } else {
3364
3506
  let n = this.fs.getFileByPath(e);
3365
3507
  if (n == null) {
3366
- this.stdErr = `mv: cannot stat '${e}': No such file or directory`, this.exitCode = 1;
3508
+ let t = this.fs.exists(e) ? "Permission denied" : "No such file or directory";
3509
+ this.stdErr = `mv: cannot stat '${e}': ${t}`, this.exitCode = 1;
3367
3510
  continue;
3368
3511
  }
3369
- this.fs.setFileByPath(t, this._deepCopy(n), !0), this.fs.deleteFileByPath(e);
3512
+ try {
3513
+ this.fs.setFileByPath(t, this._deepCopy(n), !0), this.fs.deleteFileByPath(e);
3514
+ } catch (n) {
3515
+ this.stdErr = `mv: cannot move '${e}' to '${t}': ${n.message}`, this.exitCode = 1;
3516
+ }
3370
3517
  }
3371
3518
  }
3372
3519
  return Promise.resolve();
@@ -3381,15 +3528,18 @@ var B, V, H, U, re, W, G, ie, ae, oe, se = e((() => {
3381
3528
  })), Te = /* @__PURE__ */ t(((e, t) => {
3382
3529
  var n = P();
3383
3530
  t.exports = class extends n {
3531
+ static get name() {
3532
+ return "pwd";
3533
+ }
3384
3534
  run() {
3385
3535
  let e = this.context.fs.cwd;
3386
3536
  return this.stdOut = e.endsWith("/") && e !== "/" ? e.slice(0, -1) : e, Promise.resolve();
3387
3537
  }
3388
3538
  };
3389
3539
  })), Ee = /* @__PURE__ */ t(((e, t) => {
3390
- var n = P(), r = D();
3540
+ var n = P(), r = E();
3391
3541
  t.exports = class extends n {
3392
- get name() {
3542
+ static get name() {
3393
3543
  return "rm";
3394
3544
  }
3395
3545
  get requiresFilesystem() {
@@ -3434,6 +3584,9 @@ var B, V, H, U, re, W, G, ie, ae, oe, se = e((() => {
3434
3584
  })), De = /* @__PURE__ */ t(((e, t) => {
3435
3585
  var n = P();
3436
3586
  t.exports = class extends n {
3587
+ static get name() {
3588
+ return "which";
3589
+ }
3437
3590
  run() {
3438
3591
  if (this.arguments.length !== 1) return Promise.reject("which requires a single argument");
3439
3592
  let e = this.context.fs.getFileByPath(`${this.context.getVar("PATH")}/${this.arguments[0]}`);
@@ -3442,7 +3595,10 @@ var B, V, H, U, re, W, G, ie, ae, oe, se = e((() => {
3442
3595
  };
3443
3596
  })), Oe = /* @__PURE__ */ t(((e, t) => {
3444
3597
  var n = F(), r = P();
3445
- Xn(), t.exports = class extends r {
3598
+ t.exports = class extends r {
3599
+ static get name() {
3600
+ return "source";
3601
+ }
3446
3602
  constructor(e, t) {
3447
3603
  if (super(e, t), this.arguments.length !== 1) return Promise.reject("source requires a single argument");
3448
3604
  let r = this.arguments[0];
@@ -3455,9 +3611,12 @@ var B, V, H, U, re, W, G, ie, ae, oe, se = e((() => {
3455
3611
  let e = this.arguments[0];
3456
3612
  if (e.startsWith("./") || e.startsWith("/")) {
3457
3613
  let t = this.context.fs.getFileByPath(e);
3458
- if (!t) return Promise.reject(`${e}: No such file or directory`);
3614
+ if (!t) {
3615
+ let t = this.context.fs.exists(e) ? "Permission denied" : "No such file or directory";
3616
+ return Promise.reject(`${e}: ${t}`);
3617
+ }
3459
3618
  if (t.constructor === Object) return Promise.reject(`${e}: is a directory`);
3460
- if (t.prototype && t.prototype instanceof Command) return Promise.reject(`${e}: command not found`);
3619
+ if (t.prototype && typeof t.prototype.run == "function" && typeof t.prototype.runCommand == "function") return Promise.reject(`${e}: command not found`);
3461
3620
  if (t.constructor === String && t.startsWith("#!")) return Promise.reject("FATAL: should not get here");
3462
3621
  }
3463
3622
  return Promise.reject(`${e}: permission denied`);
@@ -3466,6 +3625,9 @@ var B, V, H, U, re, W, G, ie, ae, oe, se = e((() => {
3466
3625
  })), ke = /* @__PURE__ */ t(((e, t) => {
3467
3626
  var n = P();
3468
3627
  t.exports = class extends n {
3628
+ static get name() {
3629
+ return "clear";
3630
+ }
3469
3631
  run() {
3470
3632
  return this.arguments.length > 0 ? Promise.reject("clear does not require arguments") : (this.context.clear(), Promise.resolve());
3471
3633
  }
@@ -3473,6 +3635,9 @@ var B, V, H, U, re, W, G, ie, ae, oe, se = e((() => {
3473
3635
  })), Ae = /* @__PURE__ */ t(((e, t) => {
3474
3636
  var n = P();
3475
3637
  t.exports = class extends n {
3638
+ static get name() {
3639
+ return "exit";
3640
+ }
3476
3641
  run() {
3477
3642
  let e = parseInt(this.arguments[0]) || 0;
3478
3643
  return this.exitCode = e, this.context.destroy(e), Promise.resolve();
@@ -3481,6 +3646,9 @@ var B, V, H, U, re, W, G, ie, ae, oe, se = e((() => {
3481
3646
  })), je = /* @__PURE__ */ t(((e, t) => {
3482
3647
  var n = P(), r = pe();
3483
3648
  t.exports = class extends n {
3649
+ static get name() {
3650
+ return "read";
3651
+ }
3484
3652
  get requiresFilesystem() {
3485
3653
  return !1;
3486
3654
  }
@@ -3548,7 +3716,7 @@ var B, V, H, U, re, W, G, ie, ae, oe, se = e((() => {
3548
3716
  })), Me = /* @__PURE__ */ t(((e, t) => {
3549
3717
  var n = P(), r = N();
3550
3718
  t.exports = class extends n {
3551
- get name() {
3719
+ static get name() {
3552
3720
  return "jsfunction";
3553
3721
  }
3554
3722
  run() {
@@ -3581,7 +3749,92 @@ var B, V, H, U, re, W, G, ie, ae, oe, se = e((() => {
3581
3749
  }), this.context.setCommand(a), Promise.resolve();
3582
3750
  }
3583
3751
  };
3584
- })), Ne = /* @__PURE__ */ t(((e, t) => {
3752
+ })), Ne = /* @__PURE__ */ t(((e, t) => {
3753
+ var n = P();
3754
+ t.exports = class extends n {
3755
+ static get name() {
3756
+ return "curl";
3757
+ }
3758
+ get requiresFilesystem() {
3759
+ return !0;
3760
+ }
3761
+ run() {
3762
+ let e = [...this.arguments], t = null, n = {}, r = null, i = !1, a = !1, o = null, s = null, c = 0;
3763
+ for (; c < e.length;) {
3764
+ let l = e[c];
3765
+ switch (l) {
3766
+ case "-X":
3767
+ case "--request":
3768
+ t = e[++c];
3769
+ break;
3770
+ case "-H":
3771
+ case "--header": {
3772
+ let t = e[++c] || "", r = t.indexOf(":");
3773
+ r > 0 && (n[t.slice(0, r).trim()] = t.slice(r + 1).trim());
3774
+ break;
3775
+ }
3776
+ case "-d":
3777
+ case "--data":
3778
+ case "--data-raw":
3779
+ r = e[++c], t ||= "POST";
3780
+ break;
3781
+ case "-u":
3782
+ case "--user": {
3783
+ let t = e[++c] || "";
3784
+ n.Authorization = "Basic " + btoa(t);
3785
+ break;
3786
+ }
3787
+ case "-o":
3788
+ case "--output":
3789
+ o = e[++c];
3790
+ break;
3791
+ case "-i":
3792
+ case "--include":
3793
+ i = !0;
3794
+ break;
3795
+ case "-s":
3796
+ case "--silent":
3797
+ a = !0;
3798
+ break;
3799
+ case "-L":
3800
+ case "--location": break;
3801
+ default: l.startsWith("-") ? a || (this.stdErr = `curl: unknown option '${l}'`) : s = l;
3802
+ }
3803
+ c++;
3804
+ }
3805
+ if (!s) return this.stdErr = "curl: no URL specified", this.exitCode = 1, Promise.resolve();
3806
+ if (!/^https?:\/\//i.test(s)) return this.stdErr = `curl: unsupported protocol in URL: ${s}`, this.exitCode = 1, Promise.resolve();
3807
+ let l = {
3808
+ method: t || "GET",
3809
+ headers: n
3810
+ };
3811
+ return r !== null && (l.body = r), fetch(s, l).then(async (e) => {
3812
+ i && (this.stdOut = `HTTP/1.1 ${e.status} ${e.statusText}`, e.headers.forEach((e, t) => {
3813
+ this.stdOut = `${t}: ${e}`;
3814
+ }), this.stdOut = "");
3815
+ let t = await e.text();
3816
+ if (o) try {
3817
+ this.fs.setFileByPath(o, t, !1);
3818
+ } catch (e) {
3819
+ this.stdErr = `curl: cannot write to '${o}': ${e.message}`, this.exitCode = 1;
3820
+ }
3821
+ else t.split(/\r?\n/).forEach((e) => {
3822
+ this.stdOut = e;
3823
+ });
3824
+ e.ok || (this.exitCode = 22);
3825
+ }).catch((e) => {
3826
+ if (!a) {
3827
+ let t = e && e.message ? e.message : String(e);
3828
+ if (e instanceof TypeError && /failed to fetch|networkerror|load failed|fetch is aborted/i.test(t)) {
3829
+ let e = /^https:\/\//i.test(s), t = typeof location < "u" && location.protocol === "https:";
3830
+ !e && t ? this.stdErr = "curl: (35) Mixed content blocked — the page is served over HTTPS but the target URL is HTTP. Browsers block insecure requests from secure pages." : (this.stdErr = `curl: (6) Network request failed — this is likely a CORS error. The server at ${s} did not include the required 'Access-Control-Allow-Origin' response header. You can only fetch cross-origin resources that explicitly allow it.`, this.stdErr = " Hint: try a public CORS proxy, or ensure the server sends 'Access-Control-Allow-Origin: *'.");
3831
+ } else this.stdErr = `curl: (6) Could not connect: ${t}`;
3832
+ }
3833
+ this.exitCode = 6;
3834
+ });
3835
+ }
3836
+ };
3837
+ })), Pe = /* @__PURE__ */ t(((e, t) => {
3585
3838
  t.exports = [
3586
3839
  ve(),
3587
3840
  ye(),
@@ -3597,56 +3850,57 @@ var B, V, H, U, re, W, G, ie, ae, oe, se = e((() => {
3597
3850
  ke(),
3598
3851
  Ae(),
3599
3852
  je(),
3600
- Me()
3853
+ Me(),
3854
+ Ne()
3601
3855
  ];
3602
- })), Pe = /* @__PURE__ */ t(((e, t) => {
3603
- t.exports = Object;
3604
3856
  })), Fe = /* @__PURE__ */ t(((e, t) => {
3605
- t.exports = Error;
3857
+ t.exports = Object;
3606
3858
  })), Ie = /* @__PURE__ */ t(((e, t) => {
3607
- t.exports = EvalError;
3859
+ t.exports = Error;
3608
3860
  })), Le = /* @__PURE__ */ t(((e, t) => {
3609
- t.exports = RangeError;
3861
+ t.exports = EvalError;
3610
3862
  })), Re = /* @__PURE__ */ t(((e, t) => {
3611
- t.exports = ReferenceError;
3863
+ t.exports = RangeError;
3612
3864
  })), ze = /* @__PURE__ */ t(((e, t) => {
3865
+ t.exports = ReferenceError;
3866
+ })), Be = /* @__PURE__ */ t(((e, t) => {
3613
3867
  t.exports = SyntaxError;
3614
3868
  })), X = /* @__PURE__ */ t(((e, t) => {
3615
3869
  t.exports = TypeError;
3616
- })), Be = /* @__PURE__ */ t(((e, t) => {
3617
- t.exports = URIError;
3618
3870
  })), Ve = /* @__PURE__ */ t(((e, t) => {
3619
- t.exports = Math.abs;
3871
+ t.exports = URIError;
3620
3872
  })), He = /* @__PURE__ */ t(((e, t) => {
3621
- t.exports = Math.floor;
3873
+ t.exports = Math.abs;
3622
3874
  })), Ue = /* @__PURE__ */ t(((e, t) => {
3623
- t.exports = Math.max;
3875
+ t.exports = Math.floor;
3624
3876
  })), We = /* @__PURE__ */ t(((e, t) => {
3625
- t.exports = Math.min;
3877
+ t.exports = Math.max;
3626
3878
  })), Ge = /* @__PURE__ */ t(((e, t) => {
3627
- t.exports = Math.pow;
3879
+ t.exports = Math.min;
3628
3880
  })), Ke = /* @__PURE__ */ t(((e, t) => {
3629
- t.exports = Math.round;
3881
+ t.exports = Math.pow;
3630
3882
  })), qe = /* @__PURE__ */ t(((e, t) => {
3883
+ t.exports = Math.round;
3884
+ })), Je = /* @__PURE__ */ t(((e, t) => {
3631
3885
  t.exports = Number.isNaN || function(e) {
3632
3886
  return e !== e;
3633
3887
  };
3634
- })), Je = /* @__PURE__ */ t(((e, t) => {
3635
- var n = qe();
3888
+ })), Ye = /* @__PURE__ */ t(((e, t) => {
3889
+ var n = Je();
3636
3890
  t.exports = function(e) {
3637
3891
  return n(e) || e === 0 ? e : e < 0 ? -1 : 1;
3638
3892
  };
3639
- })), Ye = /* @__PURE__ */ t(((e, t) => {
3640
- t.exports = Object.getOwnPropertyDescriptor;
3641
3893
  })), Xe = /* @__PURE__ */ t(((e, t) => {
3642
- var n = Ye();
3894
+ t.exports = Object.getOwnPropertyDescriptor;
3895
+ })), Ze = /* @__PURE__ */ t(((e, t) => {
3896
+ var n = Xe();
3643
3897
  if (n) try {
3644
3898
  n([], "length");
3645
3899
  } catch {
3646
3900
  n = null;
3647
3901
  }
3648
3902
  t.exports = n;
3649
- })), Ze = /* @__PURE__ */ t(((e, t) => {
3903
+ })), Qe = /* @__PURE__ */ t(((e, t) => {
3650
3904
  var n = Object.defineProperty || !1;
3651
3905
  if (n) try {
3652
3906
  n({}, "a", { value: 1 });
@@ -3654,7 +3908,7 @@ var B, V, H, U, re, W, G, ie, ae, oe, se = e((() => {
3654
3908
  n = !1;
3655
3909
  }
3656
3910
  t.exports = n;
3657
- })), Qe = /* @__PURE__ */ t(((e, t) => {
3911
+ })), $e = /* @__PURE__ */ t(((e, t) => {
3658
3912
  t.exports = function() {
3659
3913
  if (typeof Symbol != "function" || typeof Object.getOwnPropertySymbols != "function") return !1;
3660
3914
  if (typeof Symbol.iterator == "symbol") return !0;
@@ -3671,16 +3925,16 @@ var B, V, H, U, re, W, G, ie, ae, oe, se = e((() => {
3671
3925
  }
3672
3926
  return !0;
3673
3927
  };
3674
- })), $e = /* @__PURE__ */ t(((e, t) => {
3675
- var n = typeof Symbol < "u" && Symbol, r = Qe();
3928
+ })), et = /* @__PURE__ */ t(((e, t) => {
3929
+ var n = typeof Symbol < "u" && Symbol, r = $e();
3676
3930
  t.exports = function() {
3677
3931
  return typeof n != "function" || typeof Symbol != "function" || typeof n("foo") != "symbol" || typeof Symbol("bar") != "symbol" ? !1 : r();
3678
3932
  };
3679
- })), et = /* @__PURE__ */ t(((e, t) => {
3680
- t.exports = typeof Reflect < "u" && Reflect.getPrototypeOf || null;
3681
3933
  })), tt = /* @__PURE__ */ t(((e, t) => {
3682
- t.exports = Pe().getPrototypeOf || null;
3934
+ t.exports = typeof Reflect < "u" && Reflect.getPrototypeOf || null;
3683
3935
  })), nt = /* @__PURE__ */ t(((e, t) => {
3936
+ t.exports = Fe().getPrototypeOf || null;
3937
+ })), rt = /* @__PURE__ */ t(((e, t) => {
3684
3938
  var n = "Function.prototype.bind called on incompatible ", r = Object.prototype.toString, i = Math.max, a = "[object Function]", o = function(e, t) {
3685
3939
  for (var n = [], r = 0; r < e.length; r += 1) n[r] = e[r];
3686
3940
  for (var i = 0; i < t.length; i += 1) n[i + e.length] = t[i];
@@ -3708,26 +3962,26 @@ var B, V, H, U, re, W, G, ie, ae, oe, se = e((() => {
3708
3962
  }
3709
3963
  return u;
3710
3964
  };
3711
- })), rt = /* @__PURE__ */ t(((e, t) => {
3712
- var n = nt();
3713
- t.exports = Function.prototype.bind || n;
3714
3965
  })), it = /* @__PURE__ */ t(((e, t) => {
3715
- t.exports = Function.prototype.call;
3966
+ var n = rt();
3967
+ t.exports = Function.prototype.bind || n;
3716
3968
  })), at = /* @__PURE__ */ t(((e, t) => {
3717
- t.exports = Function.prototype.apply;
3969
+ t.exports = Function.prototype.call;
3718
3970
  })), ot = /* @__PURE__ */ t(((e, t) => {
3719
- t.exports = typeof Reflect < "u" && Reflect && Reflect.apply;
3971
+ t.exports = Function.prototype.apply;
3720
3972
  })), st = /* @__PURE__ */ t(((e, t) => {
3721
- var n = rt(), r = at(), i = it();
3722
- t.exports = ot() || n.call(i, r);
3973
+ t.exports = typeof Reflect < "u" && Reflect && Reflect.apply;
3723
3974
  })), ct = /* @__PURE__ */ t(((e, t) => {
3724
- var n = rt(), r = X(), i = it(), a = st();
3975
+ var n = it(), r = ot(), i = at();
3976
+ t.exports = st() || n.call(i, r);
3977
+ })), lt = /* @__PURE__ */ t(((e, t) => {
3978
+ var n = it(), r = X(), i = at(), a = ct();
3725
3979
  t.exports = function(e) {
3726
3980
  if (e.length < 1 || typeof e[0] != "function") throw new r("a function is required");
3727
3981
  return a(n, i, e);
3728
3982
  };
3729
- })), lt = /* @__PURE__ */ t(((e, t) => {
3730
- var n = ct(), r = Xe(), i;
3983
+ })), ut = /* @__PURE__ */ t(((e, t) => {
3984
+ var n = lt(), r = Ze(), i;
3731
3985
  try {
3732
3986
  i = [].__proto__ === Array.prototype;
3733
3987
  } catch (e) {
@@ -3737,8 +3991,8 @@ var B, V, H, U, re, W, G, ie, ae, oe, se = e((() => {
3737
3991
  t.exports = a && typeof a.get == "function" ? n([a.get]) : typeof s == "function" ? function(e) {
3738
3992
  return s(e == null ? e : o(e));
3739
3993
  } : !1;
3740
- })), ut = /* @__PURE__ */ t(((e, t) => {
3741
- var n = et(), r = tt(), i = lt();
3994
+ })), dt = /* @__PURE__ */ t(((e, t) => {
3995
+ var n = tt(), r = nt(), i = ut();
3742
3996
  t.exports = n ? function(e) {
3743
3997
  return n(e);
3744
3998
  } : r ? function(e) {
@@ -3747,15 +4001,15 @@ var B, V, H, U, re, W, G, ie, ae, oe, se = e((() => {
3747
4001
  } : i ? function(e) {
3748
4002
  return i(e);
3749
4003
  } : null;
3750
- })), dt = /* @__PURE__ */ t(((e, t) => {
4004
+ })), ft = /* @__PURE__ */ t(((e, t) => {
3751
4005
  var n = Function.prototype.call, r = Object.prototype.hasOwnProperty;
3752
- t.exports = rt().call(n, r);
4006
+ t.exports = it().call(n, r);
3753
4007
  })), Z = /* @__PURE__ */ t(((e, t) => {
3754
- var n, r = Pe(), i = Fe(), a = Ie(), o = Le(), s = Re(), c = ze(), l = X(), u = Be(), d = Ve(), f = He(), p = Ue(), m = We(), h = Ge(), g = Ke(), _ = Je(), v = Function, y = function(e) {
4008
+ var n, r = Fe(), i = Ie(), a = Le(), o = Re(), s = ze(), c = Be(), l = X(), u = Ve(), d = He(), f = Ue(), p = We(), m = Ge(), h = Ke(), g = qe(), _ = Ye(), v = Function, y = function(e) {
3755
4009
  try {
3756
4010
  return v("\"use strict\"; return (" + e + ").constructor;")();
3757
4011
  } catch {}
3758
- }, b = Xe(), x = Ze(), S = function() {
4012
+ }, b = Ze(), x = Qe(), S = function() {
3759
4013
  throw new l();
3760
4014
  }, C = b ? function() {
3761
4015
  try {
@@ -3767,7 +4021,7 @@ var B, V, H, U, re, W, G, ie, ae, oe, se = e((() => {
3767
4021
  return S;
3768
4022
  }
3769
4023
  }
3770
- }() : S, w = $e()(), T = ut(), E = tt(), D = et(), O = at(), k = it(), A = {}, j = typeof Uint8Array > "u" || !T ? n : T(Uint8Array), M = {
4024
+ }() : S, w = et()(), T = dt(), E = nt(), D = tt(), O = ot(), k = at(), A = {}, j = typeof Uint8Array > "u" || !T ? n : T(Uint8Array), M = {
3771
4025
  __proto__: null,
3772
4026
  "%AggregateError%": typeof AggregateError > "u" ? n : AggregateError,
3773
4027
  "%Array%": Array,
@@ -3957,7 +4211,7 @@ var B, V, H, U, re, W, G, ie, ae, oe, se = e((() => {
3957
4211
  "%URIErrorPrototype%": ["URIError", "prototype"],
3958
4212
  "%WeakMapPrototype%": ["WeakMap", "prototype"],
3959
4213
  "%WeakSetPrototype%": ["WeakSet", "prototype"]
3960
- }, F = rt(), I = dt(), L = F.call(k, Array.prototype.concat), ee = F.call(O, Array.prototype.splice), te = F.call(k, String.prototype.replace), R = F.call(k, String.prototype.slice), z = F.call(k, RegExp.prototype.exec), ne = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g, B = /\\(\\)?/g, V = function(e) {
4214
+ }, F = it(), I = ft(), L = F.call(k, Array.prototype.concat), ee = F.call(O, Array.prototype.splice), te = F.call(k, String.prototype.replace), R = F.call(k, String.prototype.slice), z = F.call(k, RegExp.prototype.exec), ne = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g, B = /\\(\\)?/g, V = function(e) {
3961
4215
  var t = R(e, 0, 1), n = R(e, -1);
3962
4216
  if (t === "%" && n !== "%") throw new c("invalid intrinsic syntax, expected closing `%`");
3963
4217
  if (n === "%" && t !== "%") throw new c("invalid intrinsic syntax, expected opening `%`");
@@ -4002,8 +4256,8 @@ var B, V, H, U, re, W, G, ie, ae, oe, se = e((() => {
4002
4256
  }
4003
4257
  return o;
4004
4258
  };
4005
- })), ft = /* @__PURE__ */ t(((e, t) => {
4006
- var n = Ze(), r = ze(), i = X(), a = Xe();
4259
+ })), pt = /* @__PURE__ */ t(((e, t) => {
4260
+ var n = Qe(), r = Be(), i = X(), a = Ze();
4007
4261
  t.exports = function(e, t, o) {
4008
4262
  if (!e || typeof e != "object" && typeof e != "function") throw new i("`obj` must be an object or a function`");
4009
4263
  if (typeof t != "string" && typeof t != "symbol") throw new i("`property` must be a string or a symbol`");
@@ -4021,8 +4275,8 @@ var B, V, H, U, re, W, G, ie, ae, oe, se = e((() => {
4021
4275
  else if (u || !s && !c && !l) e[t] = o;
4022
4276
  else throw new r("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.");
4023
4277
  };
4024
- })), pt = /* @__PURE__ */ t(((e, t) => {
4025
- var n = Ze(), r = function() {
4278
+ })), mt = /* @__PURE__ */ t(((e, t) => {
4279
+ var n = Qe(), r = function() {
4026
4280
  return !!n;
4027
4281
  };
4028
4282
  r.hasArrayLengthDefineBug = function() {
@@ -4033,8 +4287,8 @@ var B, V, H, U, re, W, G, ie, ae, oe, se = e((() => {
4033
4287
  return !0;
4034
4288
  }
4035
4289
  }, t.exports = r;
4036
- })), mt = /* @__PURE__ */ t(((e, t) => {
4037
- var n = Z(), r = ft(), i = pt()(), a = Xe(), o = X(), s = n("%Math.floor%");
4290
+ })), ht = /* @__PURE__ */ t(((e, t) => {
4291
+ var n = Z(), r = pt(), i = mt()(), a = Ze(), o = X(), s = n("%Math.floor%");
4038
4292
  t.exports = function(e, t) {
4039
4293
  if (typeof e != "function") throw new o("`fn` is not a function");
4040
4294
  if (typeof t != "number" || t < 0 || t > 4294967295 || s(t) !== t) throw new o("`length` must be a positive 32-bit integer");
@@ -4045,27 +4299,27 @@ var B, V, H, U, re, W, G, ie, ae, oe, se = e((() => {
4045
4299
  }
4046
4300
  return (c || l || !n) && (i ? r(e, "length", t, !0, !0) : r(e, "length", t)), e;
4047
4301
  };
4048
- })), ht = /* @__PURE__ */ t(((e, t) => {
4049
- var n = rt(), r = at(), i = st();
4302
+ })), gt = /* @__PURE__ */ t(((e, t) => {
4303
+ var n = it(), r = ot(), i = ct();
4050
4304
  t.exports = function() {
4051
4305
  return i(n, r, arguments);
4052
4306
  };
4053
- })), gt = /* @__PURE__ */ t(((e, t) => {
4054
- var n = mt(), r = Ze(), i = ct(), a = ht();
4307
+ })), _t = /* @__PURE__ */ t(((e, t) => {
4308
+ var n = ht(), r = Qe(), i = lt(), a = gt();
4055
4309
  t.exports = function(e) {
4056
- var t = i(arguments), r = e.length - (arguments.length - 1);
4057
- return n(t, 1 + (r > 0 ? r : 0), !0);
4310
+ var t = i(arguments), r = 1 + e.length - (arguments.length - 1);
4311
+ return n(t, r > 0 ? r : 0, !0);
4058
4312
  }, r ? r(t.exports, "apply", { value: a }) : t.exports.apply = a;
4059
- })), _t = /* @__PURE__ */ t(((e, t) => {
4313
+ })), vt = /* @__PURE__ */ t(((e, t) => {
4060
4314
  var n = Object.prototype.toString;
4061
4315
  t.exports = function(e) {
4062
4316
  var t = n.call(e), r = t === "[object Arguments]";
4063
4317
  return r ||= t !== "[object Array]" && typeof e == "object" && !!e && typeof e.length == "number" && e.length >= 0 && n.call(e.callee) === "[object Function]", r;
4064
4318
  };
4065
- })), vt = /* @__PURE__ */ t(((e, t) => {
4319
+ })), yt = /* @__PURE__ */ t(((e, t) => {
4066
4320
  var n;
4067
4321
  if (!Object.keys) {
4068
- var r = Object.prototype.hasOwnProperty, i = Object.prototype.toString, a = _t(), o = Object.prototype.propertyIsEnumerable, s = !o.call({ toString: null }, "toString"), c = o.call(function() {}, "prototype"), l = [
4322
+ var r = Object.prototype.hasOwnProperty, i = Object.prototype.toString, a = vt(), o = Object.prototype.propertyIsEnumerable, s = !o.call({ toString: null }, "toString"), c = o.call(function() {}, "prototype"), l = [
4069
4323
  "toString",
4070
4324
  "toLocaleString",
4071
4325
  "valueOf",
@@ -4132,10 +4386,10 @@ var B, V, H, U, re, W, G, ie, ae, oe, se = e((() => {
4132
4386
  };
4133
4387
  }
4134
4388
  t.exports = n;
4135
- })), yt = /* @__PURE__ */ t(((e, t) => {
4136
- var n = Array.prototype.slice, r = _t(), i = Object.keys, a = i ? function(e) {
4389
+ })), bt = /* @__PURE__ */ t(((e, t) => {
4390
+ var n = Array.prototype.slice, r = vt(), i = Object.keys, a = i ? function(e) {
4137
4391
  return i(e);
4138
- } : vt(), o = Object.keys;
4392
+ } : yt(), o = Object.keys;
4139
4393
  a.shim = function() {
4140
4394
  return Object.keys ? function() {
4141
4395
  var e = Object.keys(arguments);
@@ -4144,10 +4398,10 @@ var B, V, H, U, re, W, G, ie, ae, oe, se = e((() => {
4144
4398
  return r(e) ? o(n.call(e)) : o(e);
4145
4399
  }) : Object.keys = a, Object.keys || a;
4146
4400
  }, t.exports = a;
4147
- })), bt = /* @__PURE__ */ t(((e, t) => {
4148
- var n = yt(), r = typeof Symbol == "function" && typeof Symbol("foo") == "symbol", i = Object.prototype.toString, a = Array.prototype.concat, o = ft(), s = function(e) {
4401
+ })), xt = /* @__PURE__ */ t(((e, t) => {
4402
+ var n = bt(), r = typeof Symbol == "function" && typeof Symbol("foo") == "symbol", i = Object.prototype.toString, a = Array.prototype.concat, o = pt(), s = function(e) {
4149
4403
  return typeof e == "function" && i.call(e) === "[object Function]";
4150
- }, c = pt()(), l = function(e, t, n, r) {
4404
+ }, c = mt()(), l = function(e, t, n, r) {
4151
4405
  if (t in e) {
4152
4406
  if (r === !0) {
4153
4407
  if (e[t] === n) return;
@@ -4161,30 +4415,30 @@ var B, V, H, U, re, W, G, ie, ae, oe, se = e((() => {
4161
4415
  };
4162
4416
  u.supportsDescriptors = !!c, t.exports = u;
4163
4417
  })), Q = /* @__PURE__ */ t(((e, t) => {
4164
- var n = Z(), r = ct(), i = r([n("%String.prototype.indexOf%")]);
4418
+ var n = Z(), r = lt(), i = r([n("%String.prototype.indexOf%")]);
4165
4419
  t.exports = function(e, t) {
4166
4420
  var a = n(e, !!t);
4167
4421
  return typeof a == "function" && i(e, ".prototype.") > -1 ? r([a]) : a;
4168
4422
  };
4169
- })), xt = /* @__PURE__ */ t(((e, t) => {
4423
+ })), St = /* @__PURE__ */ t(((e, t) => {
4170
4424
  var n = Z()("%Array%"), r = !n.isArray && Q()("Object.prototype.toString");
4171
4425
  t.exports = n.isArray || function(e) {
4172
4426
  return r(e) === "[object Array]";
4173
4427
  };
4174
- })), St = /* @__PURE__ */ t(((e, t) => {
4175
- t.exports = xt();
4176
4428
  })), Ct = /* @__PURE__ */ t(((e, t) => {
4177
- var n = Z(), r = Q(), i = X(), a = St(), o = n("%Reflect.apply%", !0) || r("Function.prototype.apply");
4429
+ t.exports = St();
4430
+ })), wt = /* @__PURE__ */ t(((e, t) => {
4431
+ var n = Z(), r = Q(), i = X(), a = Ct(), o = n("%Reflect.apply%", !0) || r("Function.prototype.apply");
4178
4432
  t.exports = function(e, t) {
4179
4433
  var n = arguments.length > 2 ? arguments[2] : [];
4180
4434
  if (!a(n)) throw new i("Assertion failed: optional `argumentsList`, if provided, must be a List");
4181
4435
  return o(e, t, n);
4182
4436
  };
4183
- })), wt = /* @__PURE__ */ t(((e, t) => {
4184
- t.exports = {};
4185
4437
  })), Tt = /* @__PURE__ */ t(((e, t) => {
4186
- i();
4187
- var n = typeof Map == "function" && Map.prototype, a = Object.getOwnPropertyDescriptor && n ? Object.getOwnPropertyDescriptor(Map.prototype, "size") : null, o = n && a && typeof a.get == "function" ? a.get : null, s = n && Map.prototype.forEach, c = typeof Set == "function" && Set.prototype, l = Object.getOwnPropertyDescriptor && c ? Object.getOwnPropertyDescriptor(Set.prototype, "size") : null, u = c && l && typeof l.get == "function" ? l.get : null, d = c && Set.prototype.forEach, f = typeof WeakMap == "function" && WeakMap.prototype ? WeakMap.prototype.has : null, p = typeof WeakSet == "function" && WeakSet.prototype ? WeakSet.prototype.has : null, m = typeof WeakRef == "function" && WeakRef.prototype ? WeakRef.prototype.deref : null, h = Boolean.prototype.valueOf, g = Object.prototype.toString, _ = Function.prototype.toString, v = String.prototype.match, y = String.prototype.slice, b = String.prototype.replace, x = String.prototype.toUpperCase, S = String.prototype.toLowerCase, C = RegExp.prototype.test, w = Array.prototype.concat, T = Array.prototype.join, E = Array.prototype.slice, D = Math.floor, O = typeof BigInt == "function" ? BigInt.prototype.valueOf : null, k = Object.getOwnPropertySymbols, A = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? Symbol.prototype.toString : null, j = typeof Symbol == "function" && typeof Symbol.iterator == "object", M = typeof Symbol == "function" && Symbol.toStringTag ? Symbol.toStringTag : null, N = Object.prototype.propertyIsEnumerable, P = (typeof Reflect == "function" ? Reflect.getPrototypeOf : Object.getPrototypeOf) || ([].__proto__ === Array.prototype ? function(e) {
4438
+ t.exports = {};
4439
+ })), Et = /* @__PURE__ */ t(((e, t) => {
4440
+ r();
4441
+ var i = typeof Map == "function" && Map.prototype, a = Object.getOwnPropertyDescriptor && i ? Object.getOwnPropertyDescriptor(Map.prototype, "size") : null, o = i && a && typeof a.get == "function" ? a.get : null, s = i && Map.prototype.forEach, c = typeof Set == "function" && Set.prototype, l = Object.getOwnPropertyDescriptor && c ? Object.getOwnPropertyDescriptor(Set.prototype, "size") : null, u = c && l && typeof l.get == "function" ? l.get : null, d = c && Set.prototype.forEach, f = typeof WeakMap == "function" && WeakMap.prototype ? WeakMap.prototype.has : null, p = typeof WeakSet == "function" && WeakSet.prototype ? WeakSet.prototype.has : null, m = typeof WeakRef == "function" && WeakRef.prototype ? WeakRef.prototype.deref : null, h = Boolean.prototype.valueOf, g = Object.prototype.toString, _ = Function.prototype.toString, v = String.prototype.match, y = String.prototype.slice, b = String.prototype.replace, x = String.prototype.toUpperCase, S = String.prototype.toLowerCase, C = RegExp.prototype.test, w = Array.prototype.concat, T = Array.prototype.join, E = Array.prototype.slice, D = Math.floor, O = typeof BigInt == "function" ? BigInt.prototype.valueOf : null, k = Object.getOwnPropertySymbols, A = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? Symbol.prototype.toString : null, j = typeof Symbol == "function" && typeof Symbol.iterator == "object", M = typeof Symbol == "function" && Symbol.toStringTag ? Symbol.toStringTag : null, N = Object.prototype.propertyIsEnumerable, P = (typeof Reflect == "function" ? Reflect.getPrototypeOf : Object.getPrototypeOf) || ([].__proto__ === Array.prototype ? function(e) {
4188
4442
  return e.__proto__;
4189
4443
  } : null);
4190
4444
  function F(e, t) {
@@ -4199,7 +4453,7 @@ var B, V, H, U, re, W, G, ie, ae, oe, se = e((() => {
4199
4453
  }
4200
4454
  return b.call(t, n, "$&_");
4201
4455
  }
4202
- var I = wt(), L = I.custom, ee = ae(L) ? L : null, te = {
4456
+ var I = Tt(), L = I.custom, ee = ae(L) ? L : null, te = {
4203
4457
  __proto__: null,
4204
4458
  double: "\"",
4205
4459
  single: "'"
@@ -4208,8 +4462,8 @@ var B, V, H, U, re, W, G, ie, ae, oe, se = e((() => {
4208
4462
  double: /(["\\])/g,
4209
4463
  single: /(['\\])/g
4210
4464
  };
4211
- t.exports = function e(t, n, i, a) {
4212
- var c = n || {};
4465
+ t.exports = function e(t, r, i, a) {
4466
+ var c = r || {};
4213
4467
  if (K(c, "quoteStyle") && !K(te, c.quoteStyle)) throw TypeError("option \"quoteStyle\" must be \"single\" or \"double\"");
4214
4468
  if (K(c, "maxStringLength") && (typeof c.maxStringLength == "number" ? c.maxStringLength < 0 && c.maxStringLength !== Infinity : c.maxStringLength !== null)) throw TypeError("option \"maxStringLength\", if provided, must be a positive integer, Infinity, or `null`");
4215
4469
  var l = K(c, "customInspect") ? c.customInspect : !0;
@@ -4287,7 +4541,7 @@ var B, V, H, U, re, W, G, ie, ae, oe, se = e((() => {
4287
4541
  if (ie(t)) return Y(h.call(t));
4288
4542
  if (W(t)) return Y(v(String(t)));
4289
4543
  if (typeof window < "u" && t === window) return "{ [object Window] }";
4290
- if (typeof globalThis < "u" && t === globalThis || r !== void 0 && t === r) return "{ [object globalThis] }";
4544
+ if (typeof globalThis < "u" && t === globalThis || n !== void 0 && t === n) return "{ [object globalThis] }";
4291
4545
  if (!H(t) && !U(t)) {
4292
4546
  var we = Se(t, v), Te = P ? P(t) === Object.prototype : t instanceof Object || t.constructor === Object, Ee = t instanceof Object ? "" : "null prototype", De = !Te && M && Object(t) === t && M in t ? y.call(q(t), 8, -1) : Ee ? "Object" : "", Oe = (Te || typeof t.constructor != "function" ? "" : t.constructor.name ? t.constructor.name + " " : "") + (De || Ee ? "[" + T.call(w.call([], De || [], Ee || []), ": ") + "] " : "");
4293
4547
  return we.length === 0 ? Oe + "{}" : _ ? Oe + "{" + xe(we, _) + "}" : Oe + "{ " + T.call(we, ", ") + " }";
@@ -4484,7 +4738,7 @@ var B, V, H, U, re, W, G, ie, ae, oe, se = e((() => {
4484
4738
  if (typeof k == "function") for (var l = 0; l < a.length; l++) N.call(e, a[l]) && r.push("[" + t(a[l]) + "]: " + t(e[a[l]], e));
4485
4739
  return r;
4486
4740
  }
4487
- })), Et = /* @__PURE__ */ t(((e, t) => {
4741
+ })), Dt = /* @__PURE__ */ t(((e, t) => {
4488
4742
  t.exports = function(e) {
4489
4743
  return typeof e == "string" || typeof e == "symbol";
4490
4744
  };
@@ -4492,20 +4746,20 @@ var B, V, H, U, re, W, G, ie, ae, oe, se = e((() => {
4492
4746
  t.exports = function(e) {
4493
4747
  return !!e && (typeof e == "function" || typeof e == "object");
4494
4748
  };
4495
- })), Dt = /* @__PURE__ */ t(((e, t) => {
4496
- var n = X(), r = Tt(), i = Et(), a = $();
4749
+ })), Ot = /* @__PURE__ */ t(((e, t) => {
4750
+ var n = X(), r = Et(), i = Dt(), a = $();
4497
4751
  t.exports = function(e, t) {
4498
4752
  if (!a(e)) throw new n("Assertion failed: Type(O) is not Object");
4499
4753
  if (!i(t)) throw new n("Assertion failed: P is not a Property Key, got " + r(t));
4500
4754
  return e[t];
4501
4755
  };
4502
- })), Ot = /* @__PURE__ */ t(((e, t) => {
4503
- var n = X(), r = Tt(), i = Et();
4756
+ })), kt = /* @__PURE__ */ t(((e, t) => {
4757
+ var n = X(), r = Et(), i = Dt();
4504
4758
  t.exports = function(e, t) {
4505
4759
  if (!i(t)) throw new n("Assertion failed: P is not a Property Key, got " + r(t));
4506
4760
  return e[t];
4507
4761
  };
4508
- })), kt = /* @__PURE__ */ t(((e, t) => {
4762
+ })), At = /* @__PURE__ */ t(((e, t) => {
4509
4763
  var n = Function.prototype.toString, r = typeof Reflect == "object" && Reflect !== null && Reflect.apply, i, a;
4510
4764
  if (typeof r == "function" && typeof Object.defineProperty == "function") try {
4511
4765
  i = Object.defineProperty({}, "length", { get: function() {
@@ -4560,10 +4814,10 @@ var B, V, H, U, re, W, G, ie, ae, oe, se = e((() => {
4560
4814
  var t = l.call(e);
4561
4815
  return t !== d && t !== f && !/^\[object HTML/.test(t) ? !1 : c(e);
4562
4816
  };
4563
- })), At = /* @__PURE__ */ t(((e, t) => {
4564
- t.exports = kt();
4565
4817
  })), jt = /* @__PURE__ */ t(((e, t) => {
4566
- var n = X(), r = Ot(), i = At(), a = Et(), o = Tt();
4818
+ t.exports = At();
4819
+ })), Mt = /* @__PURE__ */ t(((e, t) => {
4820
+ var n = X(), r = kt(), i = jt(), a = Dt(), o = Et();
4567
4821
  t.exports = function(e, t) {
4568
4822
  if (!a(t)) throw new n("Assertion failed: P is not a Property Key");
4569
4823
  var s = r(e, t);
@@ -4572,13 +4826,13 @@ var B, V, H, U, re, W, G, ie, ae, oe, se = e((() => {
4572
4826
  return s;
4573
4827
  }
4574
4828
  };
4575
- })), Mt = /* @__PURE__ */ t(((e, t) => {
4576
- var n = Qe();
4829
+ })), Nt = /* @__PURE__ */ t(((e, t) => {
4830
+ var n = $e();
4577
4831
  t.exports = function() {
4578
4832
  return n() && !!Symbol.toStringTag;
4579
4833
  };
4580
- })), Nt = /* @__PURE__ */ t(((e, t) => {
4581
- var n = Q(), r = Mt()(), i = dt(), a = Xe(), o;
4834
+ })), Pt = /* @__PURE__ */ t(((e, t) => {
4835
+ var n = Q(), r = Nt()(), i = ft(), a = Ze(), o;
4582
4836
  if (r) {
4583
4837
  var s = n("RegExp.prototype.exec"), c = {}, l = function() {
4584
4838
  throw c;
@@ -4603,12 +4857,12 @@ var B, V, H, U, re, W, G, ie, ae, oe, se = e((() => {
4603
4857
  };
4604
4858
  }
4605
4859
  t.exports = o;
4606
- })), Pt = /* @__PURE__ */ t(((e, t) => {
4860
+ })), Ft = /* @__PURE__ */ t(((e, t) => {
4607
4861
  t.exports = function(e) {
4608
4862
  return !!e;
4609
4863
  };
4610
- })), Ft = /* @__PURE__ */ t(((e, t) => {
4611
- var n = Z()("%Symbol.match%", !0), r = Nt(), i = $(), a = Pt();
4864
+ })), It = /* @__PURE__ */ t(((e, t) => {
4865
+ var n = Z()("%Symbol.match%", !0), r = Pt(), i = $(), a = Ft();
4612
4866
  t.exports = function(e) {
4613
4867
  if (!i(e)) return !1;
4614
4868
  if (n) {
@@ -4617,19 +4871,19 @@ var B, V, H, U, re, W, G, ie, ae, oe, se = e((() => {
4617
4871
  }
4618
4872
  return r(e);
4619
4873
  };
4620
- })), It = /* @__PURE__ */ t(((e, t) => {
4874
+ })), Lt = /* @__PURE__ */ t(((e, t) => {
4621
4875
  var n = Z()("%String%"), r = X();
4622
4876
  t.exports = function(e) {
4623
4877
  if (typeof e == "symbol") throw new r("Cannot convert a Symbol value to a string");
4624
4878
  return n(e);
4625
4879
  };
4626
- })), Lt = /* @__PURE__ */ t(((e, t) => {
4880
+ })), Rt = /* @__PURE__ */ t(((e, t) => {
4627
4881
  var n = X();
4628
4882
  t.exports = function(e) {
4629
4883
  if (e == null) throw new n(arguments.length > 0 && arguments[1] || "Cannot call method on " + e);
4630
4884
  return e;
4631
4885
  };
4632
- })), Rt = /* @__PURE__ */ t(((e, t) => {
4886
+ })), zt = /* @__PURE__ */ t(((e, t) => {
4633
4887
  var n = function() {
4634
4888
  return typeof function() {}.name == "string";
4635
4889
  }, r = Object.getOwnPropertyDescriptor;
@@ -4647,21 +4901,21 @@ var B, V, H, U, re, W, G, ie, ae, oe, se = e((() => {
4647
4901
  n.boundFunctionsHaveNames = function() {
4648
4902
  return n() && typeof i == "function" && function() {}.bind().name !== "";
4649
4903
  }, t.exports = n;
4650
- })), zt = /* @__PURE__ */ t(((e, t) => {
4651
- var n = ft(), r = pt()(), i = Rt().functionsHaveConfigurableNames(), a = X();
4904
+ })), Bt = /* @__PURE__ */ t(((e, t) => {
4905
+ var n = pt(), r = mt()(), i = zt().functionsHaveConfigurableNames(), a = X();
4652
4906
  t.exports = function(e, t) {
4653
4907
  if (typeof e != "function") throw new a("`fn` is not a function");
4654
4908
  return (!(arguments.length > 2 && arguments[2]) || i) && (r ? n(e, "name", t, !0, !0) : n(e, "name", t)), e;
4655
4909
  };
4656
- })), Bt = /* @__PURE__ */ t(((e, t) => {
4657
- var n = zt(), r = X(), i = Object;
4910
+ })), Vt = /* @__PURE__ */ t(((e, t) => {
4911
+ var n = Bt(), r = X(), i = Object;
4658
4912
  t.exports = n(function() {
4659
4913
  if (this == null || this !== i(this)) throw new r("RegExp.prototype.flags getter called on non-object");
4660
4914
  var e = "";
4661
4915
  return this.hasIndices && (e += "d"), this.global && (e += "g"), this.ignoreCase && (e += "i"), this.multiline && (e += "m"), this.dotAll && (e += "s"), this.unicode && (e += "u"), this.unicodeSets && (e += "v"), this.sticky && (e += "y"), e;
4662
4916
  }, "get flags", !0);
4663
- })), Vt = /* @__PURE__ */ t(((e, t) => {
4664
- var n = Bt(), r = bt().supportsDescriptors, i = Object.getOwnPropertyDescriptor;
4917
+ })), Ht = /* @__PURE__ */ t(((e, t) => {
4918
+ var n = Vt(), r = xt().supportsDescriptors, i = Object.getOwnPropertyDescriptor;
4665
4919
  t.exports = function() {
4666
4920
  if (r && /a/gim.flags === "gim") {
4667
4921
  var e = i(RegExp.prototype, "flags");
@@ -4676,8 +4930,8 @@ var B, V, H, U, re, W, G, ie, ae, oe, se = e((() => {
4676
4930
  }
4677
4931
  return n;
4678
4932
  };
4679
- })), Ht = /* @__PURE__ */ t(((e, t) => {
4680
- var n = bt().supportsDescriptors, r = Vt(), i = Xe(), a = Object.defineProperty, o = Fe(), s = ut(), c = /a/;
4933
+ })), Ut = /* @__PURE__ */ t(((e, t) => {
4934
+ var n = xt().supportsDescriptors, r = Ht(), i = Ze(), a = Object.defineProperty, o = Ie(), s = dt(), c = /a/;
4681
4935
  t.exports = function() {
4682
4936
  if (!n || !s) throw new o("RegExp.prototype.flags requires a true ES5 environment that supports property descriptors");
4683
4937
  var e = r(), t = s(c), l = i(t, "flags");
@@ -4687,29 +4941,29 @@ var B, V, H, U, re, W, G, ie, ae, oe, se = e((() => {
4687
4941
  get: e
4688
4942
  }), e;
4689
4943
  };
4690
- })), Ut = /* @__PURE__ */ t(((e, t) => {
4691
- var n = bt(), r = gt(), i = Bt(), a = Vt(), o = Ht(), s = r(a());
4944
+ })), Wt = /* @__PURE__ */ t(((e, t) => {
4945
+ var n = xt(), r = _t(), i = Vt(), a = Ht(), o = Ut(), s = r(a());
4692
4946
  n(s, {
4693
4947
  getPolyfill: a,
4694
4948
  implementation: i,
4695
4949
  shim: o
4696
4950
  }), t.exports = s;
4697
- })), Wt = /* @__PURE__ */ t(((e, t) => {
4951
+ })), Gt = /* @__PURE__ */ t(((e, t) => {
4698
4952
  t.exports = function(e) {
4699
4953
  return typeof e == "number" && e >= 55296 && e <= 56319;
4700
4954
  };
4701
- })), Gt = /* @__PURE__ */ t(((e, t) => {
4955
+ })), Kt = /* @__PURE__ */ t(((e, t) => {
4702
4956
  t.exports = function(e) {
4703
4957
  return typeof e == "number" && e >= 56320 && e <= 57343;
4704
4958
  };
4705
- })), Kt = /* @__PURE__ */ t(((e, t) => {
4706
- var n = Z(), r = X(), i = n("%String.fromCharCode%"), a = Wt(), o = Gt();
4959
+ })), qt = /* @__PURE__ */ t(((e, t) => {
4960
+ var n = Z(), r = X(), i = n("%String.fromCharCode%"), a = Gt(), o = Kt();
4707
4961
  t.exports = function(e, t) {
4708
4962
  if (!a(e) || !o(t)) throw new r("Assertion failed: `lead` must be a leading surrogate char code, and `trail` must be a trailing surrogate char code");
4709
4963
  return i(e) + i(t);
4710
4964
  };
4711
- })), qt = /* @__PURE__ */ t(((e, t) => {
4712
- var n = X(), r = Q(), i = Wt(), a = Gt(), o = Kt(), s = r("String.prototype.charAt"), c = r("String.prototype.charCodeAt");
4965
+ })), Jt = /* @__PURE__ */ t(((e, t) => {
4966
+ var n = X(), r = Q(), i = Gt(), a = Kt(), o = qt(), s = r("String.prototype.charAt"), c = r("String.prototype.charCodeAt");
4713
4967
  t.exports = function(e, t) {
4714
4968
  if (typeof e != "string") throw new n("Assertion failed: `string` must be a String");
4715
4969
  var r = e.length;
@@ -4736,22 +4990,22 @@ var B, V, H, U, re, W, G, ie, ae, oe, se = e((() => {
4736
4990
  "[[IsUnpairedSurrogate]]": !0
4737
4991
  };
4738
4992
  };
4739
- })), Jt = /* @__PURE__ */ t(((e, t) => {
4740
- var n = qe();
4993
+ })), Yt = /* @__PURE__ */ t(((e, t) => {
4994
+ var n = Je();
4741
4995
  t.exports = function(e) {
4742
4996
  return (typeof e == "number" || typeof e == "bigint") && !n(e) && e !== Infinity && e !== -Infinity;
4743
4997
  };
4744
- })), Yt = /* @__PURE__ */ t(((e, t) => {
4745
- var n = Ve(), r = He(), i = qe(), a = Jt();
4998
+ })), Xt = /* @__PURE__ */ t(((e, t) => {
4999
+ var n = He(), r = Ue(), i = Je(), a = Yt();
4746
5000
  t.exports = function(e) {
4747
5001
  if (typeof e != "number" || i(e) || !a(e)) return !1;
4748
5002
  var t = n(e);
4749
5003
  return r(t) === t;
4750
5004
  };
4751
- })), Xt = /* @__PURE__ */ t(((e, t) => {
4752
- t.exports = 2 ** 53 - 1 || 9007199254740991;
4753
5005
  })), Zt = /* @__PURE__ */ t(((e, t) => {
4754
- var n = qt(), r = X(), i = Yt(), a = Xt();
5006
+ t.exports = 2 ** 53 - 1 || 9007199254740991;
5007
+ })), Qt = /* @__PURE__ */ t(((e, t) => {
5008
+ var n = Jt(), r = X(), i = Xt(), a = Zt();
4755
5009
  t.exports = function(e, t, o) {
4756
5010
  if (typeof e != "string") throw new r("Assertion failed: `S` must be a String");
4757
5011
  if (!i(t) || t < 0 || t > a) throw new r("Assertion failed: `length` must be an integer >= 0 and <= 2**53");
@@ -4760,7 +5014,7 @@ var B, V, H, U, re, W, G, ie, ae, oe, se = e((() => {
4760
5014
  var s = e.length;
4761
5015
  return t + 1 >= s ? t + 1 : t + n(e, t)["[[CodeUnitCount]]"];
4762
5016
  };
4763
- })), Qt = /* @__PURE__ */ t(((e, t) => {
5017
+ })), $t = /* @__PURE__ */ t(((e, t) => {
4764
5018
  var n = X();
4765
5019
  t.exports = function(e, t) {
4766
5020
  if (typeof t != "boolean") throw new n("Assertion failed: Type(done) is not Boolean");
@@ -4769,8 +5023,8 @@ var B, V, H, U, re, W, G, ie, ae, oe, se = e((() => {
4769
5023
  done: t
4770
5024
  };
4771
5025
  };
4772
- })), $t = /* @__PURE__ */ t(((e, t) => {
4773
- var n = X(), r = dt(), i = {
5026
+ })), en = /* @__PURE__ */ t(((e, t) => {
5027
+ var n = X(), r = ft(), i = {
4774
5028
  __proto__: null,
4775
5029
  "[[Configurable]]": !0,
4776
5030
  "[[Enumerable]]": !0,
@@ -4786,8 +5040,8 @@ var B, V, H, U, re, W, G, ie, ae, oe, se = e((() => {
4786
5040
  if (a && o) throw new n("Property Descriptors may not be both accessor and data descriptors");
4787
5041
  return !0;
4788
5042
  };
4789
- })), en = /* @__PURE__ */ t(((e, t) => {
4790
- var n = pt(), r = Ze(), i = n.hasArrayLengthDefineBug(), a = i && xt(), o = Q()("Object.prototype.propertyIsEnumerable");
5043
+ })), tn = /* @__PURE__ */ t(((e, t) => {
5044
+ var n = mt(), r = Qe(), i = n.hasArrayLengthDefineBug(), a = i && St(), o = Q()("Object.prototype.propertyIsEnumerable");
4791
5045
  t.exports = function(e, t, n, s, c, l) {
4792
5046
  if (!r) {
4793
5047
  if (!e(l) || !l["[[Configurable]]"] || !l["[[Writable]]"] || c in s && o(s, c) !== !!l["[[Enumerable]]"]) return !1;
@@ -4796,32 +5050,32 @@ var B, V, H, U, re, W, G, ie, ae, oe, se = e((() => {
4796
5050
  }
4797
5051
  return i && c === "length" && "[[Value]]" in l && a(s) && s.length !== l["[[Value]]"] ? (s.length = l["[[Value]]"], s.length === l["[[Value]]"]) : (r(s, c, n(l)), !0);
4798
5052
  };
4799
- })), tn = /* @__PURE__ */ t(((e, t) => {
5053
+ })), nn = /* @__PURE__ */ t(((e, t) => {
4800
5054
  t.exports = function(e) {
4801
5055
  if (e === void 0) return e;
4802
5056
  var t = {};
4803
5057
  return "[[Value]]" in e && (t.value = e["[[Value]]"]), "[[Writable]]" in e && (t.writable = !!e["[[Writable]]"]), "[[Get]]" in e && (t.get = e["[[Get]]"]), "[[Set]]" in e && (t.set = e["[[Set]]"]), "[[Enumerable]]" in e && (t.enumerable = !!e["[[Enumerable]]"]), "[[Configurable]]" in e && (t.configurable = !!e["[[Configurable]]"]), t;
4804
5058
  };
4805
- })), nn = /* @__PURE__ */ t(((e, t) => {
4806
- var n = X(), r = $t(), i = tn();
5059
+ })), rn = /* @__PURE__ */ t(((e, t) => {
5060
+ var n = X(), r = en(), i = nn();
4807
5061
  t.exports = function(e) {
4808
5062
  if (e !== void 0 && !r(e)) throw new n("Assertion failed: `Desc` must be a Property Descriptor");
4809
5063
  return i(e);
4810
5064
  };
4811
- })), rn = /* @__PURE__ */ t(((e, t) => {
4812
- var n = X(), r = dt(), i = $t();
5065
+ })), an = /* @__PURE__ */ t(((e, t) => {
5066
+ var n = X(), r = ft(), i = en();
4813
5067
  t.exports = function(e) {
4814
5068
  if (e === void 0) return !1;
4815
5069
  if (!i(e)) throw new n("Assertion failed: `Desc` must be a Property Descriptor");
4816
5070
  return !(!r(e, "[[Value]]") && !r(e, "[[Writable]]"));
4817
5071
  };
4818
- })), an = /* @__PURE__ */ t(((e, t) => {
4819
- var n = qe();
5072
+ })), on = /* @__PURE__ */ t(((e, t) => {
5073
+ var n = Je();
4820
5074
  t.exports = function(e, t) {
4821
5075
  return e === t ? e === 0 ? 1 / e == 1 / t : !0 : n(e) && n(t);
4822
5076
  };
4823
- })), on = /* @__PURE__ */ t(((e, t) => {
4824
- var n = dt(), r = X(), i = $(), a = At(), o = Pt();
5077
+ })), sn = /* @__PURE__ */ t(((e, t) => {
5078
+ var n = ft(), r = X(), i = $(), a = jt(), o = Ft();
4825
5079
  t.exports = function(e) {
4826
5080
  if (!i(e)) throw new r("ToPropertyDescriptor requires an object");
4827
5081
  var t = {};
@@ -4838,8 +5092,8 @@ var B, V, H, U, re, W, G, ie, ae, oe, se = e((() => {
4838
5092
  if ((n(t, "[[Get]]") || n(t, "[[Set]]")) && (n(t, "[[Value]]") || n(t, "[[Writable]]"))) throw new r("Invalid property descriptor. Cannot both specify accessors and a value or writable attribute");
4839
5093
  return t;
4840
5094
  };
4841
- })), sn = /* @__PURE__ */ t(((e, t) => {
4842
- var n = X(), r = $(), i = $t(), a = en(), o = nn(), s = rn(), c = Et(), l = an(), u = on();
5095
+ })), cn = /* @__PURE__ */ t(((e, t) => {
5096
+ var n = X(), r = $(), i = en(), a = tn(), o = rn(), s = an(), c = Dt(), l = on(), u = sn();
4843
5097
  t.exports = function(e, t, d) {
4844
5098
  if (!r(e)) throw new n("Assertion failed: Type(O) is not Object");
4845
5099
  if (!c(t)) throw new n("Assertion failed: P is not a Property Key");
@@ -4847,19 +5101,19 @@ var B, V, H, U, re, W, G, ie, ae, oe, se = e((() => {
4847
5101
  if (!i(f)) throw new n("Assertion failed: Desc is not a valid Property Descriptor");
4848
5102
  return a(s, l, o, e, t, f);
4849
5103
  };
4850
- })), cn = /* @__PURE__ */ t(((e, t) => {
5104
+ })), ln = /* @__PURE__ */ t(((e, t) => {
4851
5105
  t.exports = function(e) {
4852
5106
  return e === null || typeof e != "function" && typeof e != "object";
4853
5107
  };
4854
- })), ln = /* @__PURE__ */ t(((e, t) => {
4855
- var n = Z(), r = n("%Object.preventExtensions%", !0), i = n("%Object.isExtensible%", !0), a = cn();
5108
+ })), un = /* @__PURE__ */ t(((e, t) => {
5109
+ var n = Z(), r = n("%Object.preventExtensions%", !0), i = n("%Object.isExtensible%", !0), a = ln();
4856
5110
  t.exports = r ? function(e) {
4857
5111
  return !a(e) && i(e);
4858
5112
  } : function(e) {
4859
5113
  return !a(e);
4860
5114
  };
4861
- })), un = /* @__PURE__ */ t(((e, t) => {
4862
- var n = X(), r = $(), i = sn(), a = ln(), o = Et();
5115
+ })), dn = /* @__PURE__ */ t(((e, t) => {
5116
+ var n = X(), r = $(), i = cn(), a = un(), o = Dt();
4863
5117
  t.exports = function(e, t, s, c) {
4864
5118
  if (!r(e)) throw new n("Assertion failed: `homeObject` is not an Object");
4865
5119
  if (!o(t)) throw new n("Assertion failed: `key` is not a Property Key or a Private Name");
@@ -4873,12 +5127,12 @@ var B, V, H, U, re, W, G, ie, ae, oe, se = e((() => {
4873
5127
  "[[Configurable]]": !0
4874
5128
  });
4875
5129
  };
4876
- })), dn = /* @__PURE__ */ t(((e, t) => {
5130
+ })), fn = /* @__PURE__ */ t(((e, t) => {
4877
5131
  t.exports = function(e, t) {
4878
5132
  for (var n = 0; n < e.length; n += 1) t(e[n], n, e);
4879
5133
  };
4880
- })), fn = /* @__PURE__ */ t(((e, t) => {
4881
- var n = Tt(), r = X(), i = function(e, t, n) {
5134
+ })), pn = /* @__PURE__ */ t(((e, t) => {
5135
+ var n = Et(), r = X(), i = function(e, t, n) {
4882
5136
  for (var r = e, i; (i = r.next) != null; r = i) if (i.key === t) return r.next = i.next, n || (i.next = e.next, e.next = i), i;
4883
5137
  }, a = function(e, t) {
4884
5138
  if (e) {
@@ -4903,8 +5157,8 @@ var B, V, H, U, re, W, G, ie, ae, oe, se = e((() => {
4903
5157
  if (!t.has(e)) throw new r("Side channel does not contain " + n(e));
4904
5158
  },
4905
5159
  delete: function(t) {
4906
- var n = e && e.next, r = c(e, t);
4907
- return r && n && n === r && (e = void 0), !!r;
5160
+ var n = c(e, t);
5161
+ return n && e && !e.next && (e = void 0), !!n;
4908
5162
  },
4909
5163
  get: function(t) {
4910
5164
  return a(e, t);
@@ -4918,8 +5172,8 @@ var B, V, H, U, re, W, G, ie, ae, oe, se = e((() => {
4918
5172
  };
4919
5173
  return t;
4920
5174
  };
4921
- })), pn = /* @__PURE__ */ t(((e, t) => {
4922
- var n = Z(), r = Q(), i = Tt(), a = X(), o = n("%Map%", !0), s = r("Map.prototype.get", !0), c = r("Map.prototype.set", !0), l = r("Map.prototype.has", !0), u = r("Map.prototype.delete", !0), d = r("Map.prototype.size", !0);
5175
+ })), mn = /* @__PURE__ */ t(((e, t) => {
5176
+ var n = Z(), r = Q(), i = Et(), a = X(), o = n("%Map%", !0), s = r("Map.prototype.get", !0), c = r("Map.prototype.set", !0), l = r("Map.prototype.has", !0), u = r("Map.prototype.delete", !0), d = r("Map.prototype.size", !0);
4923
5177
  t.exports = !!o && function() {
4924
5178
  var e, t = {
4925
5179
  assert: function(e) {
@@ -4944,8 +5198,8 @@ var B, V, H, U, re, W, G, ie, ae, oe, se = e((() => {
4944
5198
  };
4945
5199
  return t;
4946
5200
  };
4947
- })), mn = /* @__PURE__ */ t(((e, t) => {
4948
- var n = Z(), r = Q(), i = Tt(), a = pn(), o = X(), s = n("%WeakMap%", !0), c = r("WeakMap.prototype.get", !0), l = r("WeakMap.prototype.set", !0), u = r("WeakMap.prototype.has", !0), d = r("WeakMap.prototype.delete", !0);
5201
+ })), hn = /* @__PURE__ */ t(((e, t) => {
5202
+ var n = Z(), r = Q(), i = Et(), a = mn(), o = X(), s = n("%WeakMap%", !0), c = r("WeakMap.prototype.get", !0), l = r("WeakMap.prototype.set", !0), u = r("WeakMap.prototype.has", !0), d = r("WeakMap.prototype.delete", !0);
4949
5203
  t.exports = s ? function() {
4950
5204
  var e, t, n = {
4951
5205
  assert: function(e) {
@@ -4969,8 +5223,8 @@ var B, V, H, U, re, W, G, ie, ae, oe, se = e((() => {
4969
5223
  };
4970
5224
  return n;
4971
5225
  } : a;
4972
- })), hn = /* @__PURE__ */ t(((e, t) => {
4973
- var n = X(), r = Tt(), i = fn(), a = pn(), o = mn() || a || i;
5226
+ })), gn = /* @__PURE__ */ t(((e, t) => {
5227
+ var n = X(), r = Et(), i = pn(), a = mn(), o = hn() || a || i;
4974
5228
  t.exports = function() {
4975
5229
  var e, t = {
4976
5230
  assert: function(e) {
@@ -4991,8 +5245,8 @@ var B, V, H, U, re, W, G, ie, ae, oe, se = e((() => {
4991
5245
  };
4992
5246
  return t;
4993
5247
  };
4994
- })), gn = /* @__PURE__ */ t(((e, t) => {
4995
- var n = dt(), r = hn()(), i = X(), a = {
5248
+ })), _n = /* @__PURE__ */ t(((e, t) => {
5249
+ var n = ft(), r = gn()(), i = X(), a = {
4996
5250
  assert: function(e, t) {
4997
5251
  if (!e || typeof e != "object" && typeof e != "function") throw new i("`O` is not an object");
4998
5252
  if (typeof t != "string") throw new i("`slot` must be a string");
@@ -5018,7 +5272,7 @@ var B, V, H, U, re, W, G, ie, ae, oe, se = e((() => {
5018
5272
  }
5019
5273
  };
5020
5274
  Object.freeze && Object.freeze(a), t.exports = a;
5021
- })), _n = /* @__PURE__ */ t(((e, t) => {
5275
+ })), vn = /* @__PURE__ */ t(((e, t) => {
5022
5276
  var n = {
5023
5277
  __proto__: null,
5024
5278
  foo: {}
@@ -5026,8 +5280,8 @@ var B, V, H, U, re, W, G, ie, ae, oe, se = e((() => {
5026
5280
  t.exports = function() {
5027
5281
  return r;
5028
5282
  };
5029
- })), vn = /* @__PURE__ */ t(((e, t) => {
5030
- var n = Z()("%Object.create%", !0), r = X(), i = ze(), a = $(), o = St(), s = dn(), c = gn(), l = _n()();
5283
+ })), yn = /* @__PURE__ */ t(((e, t) => {
5284
+ var n = Z()("%Object.create%", !0), r = X(), i = Be(), a = $(), o = Ct(), s = fn(), c = _n(), l = vn()();
5031
5285
  t.exports = function(e) {
5032
5286
  if (e !== null && !a(e)) throw new r("Assertion failed: `proto` must be null or an object");
5033
5287
  var t = arguments.length < 2 ? [] : arguments[1];
@@ -5044,8 +5298,8 @@ var B, V, H, U, re, W, G, ie, ae, oe, se = e((() => {
5044
5298
  c.set(u, e, void 0);
5045
5299
  }), u;
5046
5300
  };
5047
- })), yn = /* @__PURE__ */ t(((e, t) => {
5048
- var n = X(), r = $(), i = Q()("RegExp.prototype.exec"), a = Ct(), o = Dt(), s = At();
5301
+ })), bn = /* @__PURE__ */ t(((e, t) => {
5302
+ var n = X(), r = $(), i = Q()("RegExp.prototype.exec"), a = wt(), o = Ot(), s = jt();
5049
5303
  t.exports = function(e, t) {
5050
5304
  if (!r(e)) throw new n("Assertion failed: `R` must be an Object");
5051
5305
  if (typeof t != "string") throw new n("Assertion failed: `S` must be a String");
@@ -5057,8 +5311,8 @@ var B, V, H, U, re, W, G, ie, ae, oe, se = e((() => {
5057
5311
  }
5058
5312
  return i(e, t);
5059
5313
  };
5060
- })), bn = /* @__PURE__ */ t(((e, t) => {
5061
- var n = X(), r = $(), i = Et(), a = an(), o = function() {
5314
+ })), xn = /* @__PURE__ */ t(((e, t) => {
5315
+ var n = X(), r = $(), i = Dt(), a = on(), o = function() {
5062
5316
  try {
5063
5317
  return delete 0, !0;
5064
5318
  } catch {
@@ -5079,31 +5333,31 @@ var B, V, H, U, re, W, G, ie, ae, oe, se = e((() => {
5079
5333
  return !1;
5080
5334
  }
5081
5335
  };
5082
- })), xn = /* @__PURE__ */ t(((e, t) => {
5336
+ })), Sn = /* @__PURE__ */ t(((e, t) => {
5083
5337
  t.exports = function(e) {
5084
5338
  return e === null || typeof e != "function" && typeof e != "object";
5085
5339
  };
5086
- })), Sn = /* @__PURE__ */ t(((e, t) => {
5340
+ })), Cn = /* @__PURE__ */ t(((e, t) => {
5087
5341
  var n = Q(), r = n("Date.prototype.getDay"), i = function(e) {
5088
5342
  try {
5089
5343
  return r(e), !0;
5090
5344
  } catch {
5091
5345
  return !1;
5092
5346
  }
5093
- }, a = n("Object.prototype.toString"), o = "[object Date]", s = Mt()();
5347
+ }, a = n("Object.prototype.toString"), o = "[object Date]", s = Nt()();
5094
5348
  t.exports = function(e) {
5095
5349
  return typeof e != "object" || !e ? !1 : s ? i(e) : a(e) === o;
5096
5350
  };
5097
- })), Cn = /* @__PURE__ */ t(((e, t) => {
5098
- var n = Q(), r = Nt(), i = n("RegExp.prototype.exec"), a = X();
5351
+ })), wn = /* @__PURE__ */ t(((e, t) => {
5352
+ var n = Q(), r = Pt(), i = n("RegExp.prototype.exec"), a = X();
5099
5353
  t.exports = function(e) {
5100
5354
  if (!r(e)) throw new a("`regex` must be a RegExp");
5101
5355
  return function(t) {
5102
5356
  return i(e, t) !== null;
5103
5357
  };
5104
5358
  };
5105
- })), wn = /* @__PURE__ */ t(((e, t) => {
5106
- var n = Q(), r = n("Object.prototype.toString"), i = $e()(), a = Cn();
5359
+ })), Tn = /* @__PURE__ */ t(((e, t) => {
5360
+ var n = Q(), r = n("Object.prototype.toString"), i = et()(), a = wn();
5107
5361
  if (i) {
5108
5362
  var o = n("Symbol.prototype.toString"), s = a(/^Symbol\(.*\)$/), c = function(e) {
5109
5363
  return typeof e.valueOf() == "symbol" ? s(o(e)) : !1;
@@ -5120,8 +5374,8 @@ var B, V, H, U, re, W, G, ie, ae, oe, se = e((() => {
5120
5374
  } else t.exports = function(e) {
5121
5375
  return !1;
5122
5376
  };
5123
- })), Tn = /* @__PURE__ */ t(((e, t) => {
5124
- var n = typeof Symbol == "function" && typeof Symbol.iterator == "symbol", r = xn(), i = kt(), a = Sn(), o = wn(), s = function(e, t) {
5377
+ })), En = /* @__PURE__ */ t(((e, t) => {
5378
+ var n = typeof Symbol == "function" && typeof Symbol.iterator == "symbol", r = Sn(), i = At(), a = Cn(), o = Tn(), s = function(e, t) {
5125
5379
  if (e == null) throw TypeError("Cannot call method on " + e);
5126
5380
  if (typeof t != "string" || t !== "number" && t !== "string") throw TypeError("hint must be \"string\" or \"number\"");
5127
5381
  var n = t === "string" ? ["toString", "valueOf"] : ["valueOf", "toString"], a, o, s;
@@ -5146,29 +5400,29 @@ var B, V, H, U, re, W, G, ie, ae, oe, se = e((() => {
5146
5400
  }
5147
5401
  return t === "default" && (a(e) || o(e)) && (t = "string"), s(e, t === "default" ? "number" : t);
5148
5402
  };
5149
- })), En = /* @__PURE__ */ t(((e, t) => {
5150
- var n = Tn();
5403
+ })), Dn = /* @__PURE__ */ t(((e, t) => {
5404
+ var n = En();
5151
5405
  t.exports = function(e) {
5152
5406
  return arguments.length > 1 ? n(e, arguments[1]) : n(e);
5153
5407
  };
5154
- })), Dn = /* @__PURE__ */ t(((e, t) => {
5155
- var n = Lt(), r = It(), i = Q()("String.prototype.replace"), a = /^\s$/.test("᠎"), o = a ? /^[\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF]+/ : /^[\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF]+/, s = a ? /[\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF]+$/ : /[\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF]+$/;
5408
+ })), On = /* @__PURE__ */ t(((e, t) => {
5409
+ var n = Rt(), r = Lt(), i = Q()("String.prototype.replace"), a = /^\s$/.test("᠎"), o = a ? /^[\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF]+/ : /^[\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF]+/, s = a ? /[\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF]+$/ : /[\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028\u2029\uFEFF]+$/;
5156
5410
  t.exports = function() {
5157
5411
  return i(i(r(n(this)), o, ""), s, "");
5158
5412
  };
5159
- })), On = /* @__PURE__ */ t(((e, t) => {
5160
- var n = Dn(), r = "​", i = "᠎";
5413
+ })), kn = /* @__PURE__ */ t(((e, t) => {
5414
+ var n = On(), r = "​", i = "᠎";
5161
5415
  t.exports = function() {
5162
5416
  return String.prototype.trim && r.trim() === r && i.trim() === i && ("_" + i).trim() === "_" + i && (i + "_").trim() === i + "_" ? String.prototype.trim : n;
5163
5417
  };
5164
- })), kn = /* @__PURE__ */ t(((e, t) => {
5165
- var n = pt()(), r = ft(), i = On();
5418
+ })), An = /* @__PURE__ */ t(((e, t) => {
5419
+ var n = mt()(), r = pt(), i = kn();
5166
5420
  t.exports = function() {
5167
5421
  var e = i();
5168
5422
  return String.prototype.trim !== e && (n ? r(String.prototype, "trim", e, !0) : r(String.prototype, "trim", e)), e;
5169
5423
  };
5170
- })), An = /* @__PURE__ */ t(((e, t) => {
5171
- var n = gt(), r = bt(), i = Lt(), a = Dn(), o = On(), s = kn(), c = n(o()), l = function(e) {
5424
+ })), jn = /* @__PURE__ */ t(((e, t) => {
5425
+ var n = _t(), r = xt(), i = Rt(), a = On(), o = kn(), s = An(), c = n(o()), l = function(e) {
5172
5426
  return i(e), c(e);
5173
5427
  };
5174
5428
  r(l, {
@@ -5176,12 +5430,12 @@ var B, V, H, U, re, W, G, ie, ae, oe, se = e((() => {
5176
5430
  implementation: a,
5177
5431
  shim: s
5178
5432
  }), t.exports = l;
5179
- })), jn = /* @__PURE__ */ t(((e, t) => {
5180
- var n = Z(), r = n("%RegExp%"), i = X(), a = n("%parseInt%"), o = Q(), s = Cn(), c = o("String.prototype.slice"), l = s(/^0b[01]+$/i), u = s(/^0o[0-7]+$/i), d = s(/^[-+]0x[0-9a-f]+$/i), f = s(new r("[" + [
5433
+ })), Mn = /* @__PURE__ */ t(((e, t) => {
5434
+ var n = Z(), r = n("%RegExp%"), i = X(), a = n("%parseInt%"), o = Q(), s = wn(), c = o("String.prototype.slice"), l = s(/^0b[01]+$/i), u = s(/^0o[0-7]+$/i), d = s(/^[-+]0x[0-9a-f]+$/i), f = s(new r("[" + [
5181
5435
  "…",
5182
5436
  "​",
5183
5437
  "￾"
5184
- ].join("") + "]", "g")), p = An();
5438
+ ].join("") + "]", "g")), p = jn();
5185
5439
  t.exports = function e(t) {
5186
5440
  if (typeof t != "string") throw new i("Assertion failed: `argument` is not a String");
5187
5441
  if (l(t)) return +a(c(t, 2), 2);
@@ -5190,40 +5444,40 @@ var B, V, H, U, re, W, G, ie, ae, oe, se = e((() => {
5190
5444
  var n = p(t);
5191
5445
  return n === t ? +t : e(n);
5192
5446
  };
5193
- })), Mn = /* @__PURE__ */ t(((e, t) => {
5194
- var n = Z(), r = X(), i = n("%Number%"), a = cn(), o = En(), s = jn();
5447
+ })), Nn = /* @__PURE__ */ t(((e, t) => {
5448
+ var n = Z(), r = X(), i = n("%Number%"), a = ln(), o = Dn(), s = Mn();
5195
5449
  t.exports = function(e) {
5196
5450
  var t = a(e) ? e : o(e, i);
5197
5451
  if (typeof t == "symbol") throw new r("Cannot convert a Symbol value to a number");
5198
5452
  if (typeof t == "bigint") throw new r("Conversion from 'BigInt' to 'number' is not allowed.");
5199
5453
  return typeof t == "string" ? s(t) : +t;
5200
5454
  };
5201
- })), Nn = /* @__PURE__ */ t(((e, t) => {
5202
- var n = He();
5455
+ })), Pn = /* @__PURE__ */ t(((e, t) => {
5456
+ var n = Ue();
5203
5457
  t.exports = function(e) {
5204
5458
  return typeof e == "bigint" ? e : n(e);
5205
5459
  };
5206
- })), Pn = /* @__PURE__ */ t(((e, t) => {
5207
- var n = Nn(), r = X();
5460
+ })), Fn = /* @__PURE__ */ t(((e, t) => {
5461
+ var n = Pn(), r = X();
5208
5462
  t.exports = function(e) {
5209
5463
  if (typeof e != "number" && typeof e != "bigint") throw new r("argument must be a Number or a BigInt");
5210
5464
  var t = e < 0 ? -n(-e) : n(e);
5211
5465
  return t === 0 ? 0 : t;
5212
5466
  };
5213
- })), Fn = /* @__PURE__ */ t(((e, t) => {
5214
- var n = Mn(), r = Pn(), i = qe(), a = Jt();
5467
+ })), In = /* @__PURE__ */ t(((e, t) => {
5468
+ var n = Nn(), r = Fn(), i = Je(), a = Yt();
5215
5469
  t.exports = function(e) {
5216
5470
  var t = n(e);
5217
5471
  return i(t) || t === 0 ? 0 : a(t) ? r(t) : t;
5218
5472
  };
5219
- })), In = /* @__PURE__ */ t(((e, t) => {
5220
- var n = Xt(), r = Fn();
5473
+ })), Ln = /* @__PURE__ */ t(((e, t) => {
5474
+ var n = Zt(), r = In();
5221
5475
  t.exports = function(e) {
5222
5476
  var t = r(e);
5223
5477
  return t <= 0 ? 0 : t > n ? n : t;
5224
5478
  };
5225
- })), Ln = /* @__PURE__ */ t(((e, t) => {
5226
- var n = Z()("%Object.defineProperty%", !0), r = Mt()(), i = dt(), a = X(), o = r ? Symbol.toStringTag : null;
5479
+ })), Rn = /* @__PURE__ */ t(((e, t) => {
5480
+ var n = Z()("%Object.defineProperty%", !0), r = Nt()(), i = ft(), a = X(), o = r ? Symbol.toStringTag : null;
5227
5481
  t.exports = function(e, t) {
5228
5482
  var r = arguments.length > 2 && !!arguments[2] && arguments[2].force, s = arguments.length > 2 && !!arguments[2] && arguments[2].nonConfigurable;
5229
5483
  if (r !== void 0 && typeof r != "boolean" || s !== void 0 && typeof s != "boolean") throw new a("if provided, the `overrideIfSet` and `nonConfigurable` options must be booleans");
@@ -5234,8 +5488,8 @@ var B, V, H, U, re, W, G, ie, ae, oe, se = e((() => {
5234
5488
  writable: !1
5235
5489
  }) : e[o] = t);
5236
5490
  };
5237
- })), Rn = /* @__PURE__ */ t(((e, t) => {
5238
- var n = Z(), r = $e()(), i = X(), a = $(), o = n("%IteratorPrototype%", !0), s = Zt(), c = Qt(), l = un(), u = Dt(), d = vn(), f = yn(), p = bn(), m = In(), h = It(), g = gn(), _ = Ln(), v = function(e, t, n, r) {
5491
+ })), zn = /* @__PURE__ */ t(((e, t) => {
5492
+ var n = Z(), r = et()(), i = X(), a = $(), o = n("%IteratorPrototype%", !0), s = Qt(), c = $t(), l = dn(), u = Ot(), d = yn(), f = bn(), p = xn(), m = Ln(), h = Lt(), g = _n(), _ = Rn(), v = function(e, t, n, r) {
5239
5493
  if (typeof t != "string") throw new i("`S` must be a string");
5240
5494
  if (typeof n != "boolean") throw new i("`global` must be a boolean");
5241
5495
  if (typeof r != "boolean") throw new i("`fullUnicode` must be a boolean");
@@ -5253,10 +5507,10 @@ var B, V, H, U, re, W, G, ie, ae, oe, se = e((() => {
5253
5507
  }, !1)), t.exports = function(e, t, n, r) {
5254
5508
  return new v(e, t, n, r);
5255
5509
  };
5256
- })), zn = /* @__PURE__ */ t(((e, t) => {
5257
- t.exports = Z();
5258
5510
  })), Bn = /* @__PURE__ */ t(((e, t) => {
5259
- var n = zn()("%Reflect.construct%", !0), r = sn();
5511
+ t.exports = Z();
5512
+ })), Vn = /* @__PURE__ */ t(((e, t) => {
5513
+ var n = Bn()("%Reflect.construct%", !0), r = cn();
5260
5514
  try {
5261
5515
  r({}, "", { "[[Get]]": function() {} });
5262
5516
  } catch {
@@ -5279,8 +5533,8 @@ var B, V, H, U, re, W, G, ie, ae, oe, se = e((() => {
5279
5533
  } else t.exports = function(e) {
5280
5534
  return typeof e == "function" && !!e.prototype;
5281
5535
  };
5282
- })), Vn = /* @__PURE__ */ t(((e, t) => {
5283
- var n = Z()("%Symbol.species%", !0), r = X(), i = $(), a = Bn();
5536
+ })), Hn = /* @__PURE__ */ t(((e, t) => {
5537
+ var n = Z()("%Symbol.species%", !0), r = X(), i = $(), a = Vn();
5284
5538
  t.exports = function(e, t) {
5285
5539
  if (!i(e)) throw new r("Assertion failed: Type(O) is not Object");
5286
5540
  var o = e.constructor;
@@ -5291,7 +5545,7 @@ var B, V, H, U, re, W, G, ie, ae, oe, se = e((() => {
5291
5545
  if (a(s)) return s;
5292
5546
  throw new r("no constructor found");
5293
5547
  };
5294
- })), Hn = /* @__PURE__ */ t(((e, t) => {
5548
+ })), Un = /* @__PURE__ */ t(((e, t) => {
5295
5549
  var n = $();
5296
5550
  t.exports = function(e) {
5297
5551
  if (e === null) return "Null";
@@ -5301,13 +5555,13 @@ var B, V, H, U, re, W, G, ie, ae, oe, se = e((() => {
5301
5555
  if (typeof e == "boolean") return "Boolean";
5302
5556
  if (typeof e == "string") return "String";
5303
5557
  };
5304
- })), Un = /* @__PURE__ */ t(((e, t) => {
5305
- var n = Hn();
5558
+ })), Wn = /* @__PURE__ */ t(((e, t) => {
5559
+ var n = Un();
5306
5560
  t.exports = function(e) {
5307
5561
  return typeof e == "symbol" ? "Symbol" : typeof e == "bigint" ? "BigInt" : n(e);
5308
5562
  };
5309
- })), Wn = /* @__PURE__ */ t(((e, t) => {
5310
- var n = Rn(), r = Dt(), i = bn(), a = Vn(), o = In(), s = It(), c = Un(), l = Ut(), u = zt(), d = Q(), f = Z(), p = X(), m = d("String.prototype.indexOf"), h = f("%RegExp%"), g = "flags" in h.prototype, _ = function(e, t) {
5563
+ })), Gn = /* @__PURE__ */ t(((e, t) => {
5564
+ var n = zn(), r = Ot(), i = xn(), a = Hn(), o = Ln(), s = Lt(), c = Wn(), l = Wt(), u = Bt(), d = Q(), f = Z(), p = X(), m = d("String.prototype.indexOf"), h = f("%RegExp%"), g = "flags" in h.prototype, _ = function(e, t) {
5311
5565
  var n, i = "flags" in t ? r(t, "flags") : s(l(t));
5312
5566
  return n = g && typeof i == "string" ? new e(t, i) : e === h ? new e(t.source, i) : new e(t, i), {
5313
5567
  flags: i,
@@ -5320,13 +5574,13 @@ var B, V, H, U, re, W, G, ie, ae, oe, se = e((() => {
5320
5574
  var l = s(e), u = _(a(t, h), t), d = u.flags, f = u.matcher;
5321
5575
  return i(f, "lastIndex", o(r(t, "lastIndex")), !0), n(f, l, m(d, "g") > -1, m(d, "u") > -1);
5322
5576
  }, "[Symbol.matchAll]", !0);
5323
- })), Gn = /* @__PURE__ */ t(((e, t) => {
5324
- var n = $e()(), r = Wn();
5577
+ })), Kn = /* @__PURE__ */ t(((e, t) => {
5578
+ var n = et()(), r = Gn();
5325
5579
  t.exports = function() {
5326
5580
  return !n || typeof Symbol.matchAll != "symbol" || typeof RegExp.prototype[Symbol.matchAll] != "function" ? r : RegExp.prototype[Symbol.matchAll];
5327
5581
  };
5328
- })), Kn = /* @__PURE__ */ t(((e, t) => {
5329
- var n = Ct(), r = Dt(), i = jt(), a = Ft(), o = It(), s = Lt(), c = Q(), l = $e()(), u = Ut(), d = Z(), f = X(), p = d("%RegExp%"), m = c("String.prototype.indexOf"), h = Gn(), g = function(e) {
5582
+ })), qn = /* @__PURE__ */ t(((e, t) => {
5583
+ var n = wt(), r = Ot(), i = Mt(), a = It(), o = Lt(), s = Rt(), c = Q(), l = et()(), u = Wt(), d = Z(), f = X(), p = d("%RegExp%"), m = c("String.prototype.indexOf"), h = Kn(), g = function(e) {
5330
5584
  var t = h();
5331
5585
  if (l && typeof Symbol.matchAll == "symbol") {
5332
5586
  var n = i(e, Symbol.matchAll);
@@ -5347,8 +5601,8 @@ var B, V, H, U, re, W, G, ie, ae, oe, se = e((() => {
5347
5601
  var l = o(t), d = new p(e, "g");
5348
5602
  return n(g(d), d, [l]);
5349
5603
  };
5350
- })), qn = /* @__PURE__ */ t(((e, t) => {
5351
- var n = Kn();
5604
+ })), Jn = /* @__PURE__ */ t(((e, t) => {
5605
+ var n = qn();
5352
5606
  t.exports = function() {
5353
5607
  if (String.prototype.matchAll) try {
5354
5608
  "".matchAll(RegExp.prototype);
@@ -5357,8 +5611,8 @@ var B, V, H, U, re, W, G, ie, ae, oe, se = e((() => {
5357
5611
  }
5358
5612
  return n;
5359
5613
  };
5360
- })), Jn = /* @__PURE__ */ t(((e, t) => {
5361
- var n = bt(), r = $e()(), i = Xe(), a = qn(), o = Gn(), s = Object.defineProperty;
5614
+ })), Yn = /* @__PURE__ */ t(((e, t) => {
5615
+ var n = xt(), r = et()(), i = Ze(), a = Jn(), o = Kn(), s = Object.defineProperty;
5362
5616
  t.exports = function() {
5363
5617
  var e = a();
5364
5618
  if (n(String.prototype, { matchAll: e }, { matchAll: function() {
@@ -5385,29 +5639,29 @@ var B, V, H, U, re, W, G, ie, ae, oe, se = e((() => {
5385
5639
  }
5386
5640
  return e;
5387
5641
  };
5388
- })), Yn = /* @__PURE__ */ t(((e, t) => {
5389
- var n = gt(), r = bt(), i = Kn(), a = qn(), o = Jn(), s = n(i);
5642
+ })), Xn = /* @__PURE__ */ t(((e, t) => {
5643
+ var n = _t(), r = xt(), i = qn(), a = Jn(), o = Yn(), s = n(i);
5390
5644
  r(s, {
5391
5645
  getPolyfill: a,
5392
5646
  implementation: i,
5393
5647
  shim: o
5394
5648
  }), t.exports = s;
5395
- })), Xn = /* @__PURE__ */ t(((e, t) => {
5396
- i();
5397
- var n = a(), o = A(), s = P(), c = F(), l = K(), u = N(), d = _e(), f = Ne(), p = /\${?([\w\d]+)}?/g;
5649
+ })), Zn = /* @__PURE__ */ t(((e, t) => {
5650
+ r();
5651
+ var a = k(), o = P(), s = F(), c = K(), l = N(), u = _e(), d = Pe(), f = A(), p = i(), m = /\${?([\w\d]+)}?/g, h = f.EventEmitter || f.default || f;
5398
5652
  String.prototype.regexIndexOf = function(e, t) {
5399
5653
  let n = this.substring(t || 0).search(e);
5400
5654
  return n >= 0 ? n + (t || 0) : n;
5401
- }, Yn().shim();
5402
- var m = class e extends n {
5655
+ }, Xn().shim();
5656
+ var g = class e extends h {
5403
5657
  constructor(t) {
5404
5658
  super();
5405
- let { path: n = "/bin", profile: r, hostname: i = "browser", filesystem: a = {}, permissions: s = {}, cwd: c = "/", onFsChange: l, useRealFilesystem: u = !1 } = t;
5406
- this.context = new o(Object.assign({}, t, {
5659
+ let { path: n = "/bin", profile: r, hostname: i = "browser", filesystem: o = {}, permissions: s = {}, cwd: c = "/", onFsChange: l, useRealFilesystem: u = !1 } = t;
5660
+ this.context = new a(Object.assign({}, t, {
5407
5661
  clearFn: this.clear.bind(this),
5408
5662
  destroyFn: this.destroy.bind(this),
5409
5663
  onFsChange: typeof l == "function" ? l : null
5410
- })), this.context.setVar("PATH", n), this.context.setVar("HOST", i), u ? this.context.setNodeFilesystem(c) : this.context.setFilesystem(a, s), this.context.setCwd(c), this._loadDefaultCommands(), this._loadBuiltinCommands(), this._lastCode = 0, r ? this._loadProfile(r) : setTimeout(() => this.emit("status", e.STATUS_READY), 0);
5664
+ })), this.context.setVar("PATH", n), this.context.setVar("HOST", i), u ? this.context.setNodeFilesystem(c) : this.context.setFilesystem(o, s), this.context.setCwd(c), this._loadDefaultCommands(), this._loadBuiltinCommands(), this._lastCode = 0, r ? this._loadProfile(r) : setTimeout(() => this.emit("status", e.STATUS_READY), 0);
5411
5665
  }
5412
5666
  get path() {
5413
5667
  return this.context.getVar("PATH");
@@ -5425,12 +5679,12 @@ var B, V, H, U, re, W, G, ie, ae, oe, se = e((() => {
5425
5679
  if (this.runningCommand && this.runningCommand.onInput && this.runningCommand.captureInput) return this.runningCommand.onInput(e), !0;
5426
5680
  }
5427
5681
  _loadDefaultCommands() {
5428
- f.forEach((e) => {
5682
+ d.forEach((e) => {
5429
5683
  this.context.setCommand(e);
5430
5684
  });
5431
5685
  }
5432
5686
  _loadBuiltinCommands() {
5433
- d.forEach((e) => {
5687
+ u.forEach((e) => {
5434
5688
  this.context.setCommand(e);
5435
5689
  });
5436
5690
  }
@@ -5465,26 +5719,46 @@ var B, V, H, U, re, W, G, ie, ae, oe, se = e((() => {
5465
5719
  return;
5466
5720
  }
5467
5721
  if (!n.length) return;
5468
- let r = n.shift(), i = this.context.getAlias(r);
5469
- if (i) return this.onCommand(i, !1);
5470
- let a;
5722
+ let r = n.shift().value, i = null, a = !1, c = [];
5723
+ for (let e = 0; e < n.length; e++) {
5724
+ let { value: t, hasQuote: r } = n[e];
5725
+ !r && (t === ">>" || t === ">") && e + 1 < n.length ? (a = t === ">>", i = n[++e].value) : !r && t.startsWith(">>") && t.length > 2 ? (a = !0, i = t.slice(2)) : !r && t.startsWith(">") && t.length > 1 ? (a = !1, i = t.slice(1)) : c.push(t);
5726
+ }
5727
+ n = c;
5728
+ let l = this.context.getAlias(r);
5729
+ if (l) return this.onCommand(l, !1);
5730
+ let u;
5471
5731
  try {
5472
- a = this._parseCommand(r.startsWith("/") || r.startsWith("./") ? r : r.toLowerCase());
5732
+ u = this._parseCommand(r.startsWith("/") || r.startsWith("./") ? r : r.toLowerCase());
5473
5733
  } catch (e) {
5474
5734
  this.emit("stdErr", e.message), this.lastCode = 1, this.emit("exitCode", this.lastCode);
5475
5735
  return;
5476
5736
  }
5477
- let o;
5478
- if (a.prototype instanceof s || new a() instanceof c) o = new a(n, this.context);
5479
- else if (a.prototype instanceof u) o = new a(n);
5737
+ let d = (e) => typeof e == "function" && typeof e.prototype.run == "function" && typeof e.prototype.runCommand == "function", f;
5738
+ if (u.prototype instanceof o || new u() instanceof s) f = new u(n, this.context);
5739
+ else if (d(u)) f = new u(n);
5480
5740
  else {
5481
5741
  this.emit("stdErr", `${r}: Command not found`), this.lastCode = 1, this.emit("exitCode", this.lastCode);
5482
5742
  return;
5483
5743
  }
5484
- return o.requiresFilesystem && (o.fs = this.context.fs), this._stdin !== void 0 && (o.stdin = this._stdin), this.runningCommand = o, this.runningCommand.on && this.runningCommand.on("flush", (e) => {
5744
+ return f.requiresFilesystem && (f.fs = this.context.fs.sandbox()), this._stdin !== void 0 && (f.stdin = this._stdin), this.runningCommand = f, this.runningCommand.on && this.runningCommand.on("flush", (e) => {
5485
5745
  this._emitOutput(e);
5486
- }), o.runCommand().then((e) => {
5487
- this._emitOutput(e.getStdOutput()), this.lastCode = e.getExitCode(), this.emit("exitCode", this.lastCode), delete this.runningCommand;
5746
+ }), f.runCommand().then((e) => {
5747
+ let t = e.getStdOutput();
5748
+ if (i) {
5749
+ let e = this.context.fs.absolutePath(i), n = t.filter((e) => e.type === "out").map((e) => e.string), r = a ? (() => {
5750
+ let t = this.context.fs._getFileRaw(e);
5751
+ return typeof t == "string" ? t + "\n" + n.join("\n") : n.join("\n");
5752
+ })() : n.join("\n");
5753
+ try {
5754
+ this.context.fs.setFileByPath(e, r, !0);
5755
+ } catch {
5756
+ this.emit("stdErr", `${i}: Permission denied`), this.lastCode = 1, this.emit("exitCode", this.lastCode), delete this.runningCommand;
5757
+ return;
5758
+ }
5759
+ this._emitOutput(t.filter((e) => e.type === "err"));
5760
+ } else this._emitOutput(t);
5761
+ this.lastCode = e.getExitCode(), this.emit("exitCode", this.lastCode), delete this.runningCommand;
5488
5762
  });
5489
5763
  }
5490
5764
  _emitOutput(e) {
@@ -5550,17 +5824,20 @@ var B, V, H, U, re, W, G, ie, ae, oe, se = e((() => {
5550
5824
  }
5551
5825
  _parseCommand(e) {
5552
5826
  if (e.startsWith("./") || e.startsWith("/")) {
5553
- let t = this.context.fs.getFileByPath(e);
5827
+ let t = this.context.fs._getFileRaw(e);
5554
5828
  if (!t) throw Error(`${e}: No such file or directory`);
5555
5829
  if (t.constructor === Object) throw Error(`${e}: is a directory`);
5556
- if (t.prototype && t.prototype instanceof u) return t;
5830
+ if (t.prototype && typeof t.prototype.run == "function" && typeof t.prototype.runCommand == "function") {
5831
+ if (!this.context.fs.isExecutable(e)) throw Error(`${e}: permission denied`);
5832
+ return t;
5833
+ }
5557
5834
  if (t.constructor === String && t.startsWith("#!")) {
5558
5835
  if (!this.context.fs.isExecutable(e)) throw Error(`${e}: permission denied`);
5559
- return c.bind(this, t);
5836
+ return s.bind(this, t);
5560
5837
  }
5561
5838
  if (this._isWasmFile(e, t)) {
5562
5839
  if (!this.context.fs.isExecutable(e)) throw Error(`${e}: permission denied`);
5563
- return l.bind(null, e);
5840
+ return c.bind(null, e);
5564
5841
  }
5565
5842
  throw Error(`${e}: permission denied`);
5566
5843
  }
@@ -5573,7 +5850,7 @@ var B, V, H, U, re, W, G, ie, ae, oe, se = e((() => {
5573
5850
  return (await Promise.all(n.map(({ value: e, hasQuote: t }) => this._replaceVariables(e).then((e) => ({
5574
5851
  value: e,
5575
5852
  hasQuote: t
5576
- }))))).filter(({ value: e, hasQuote: t }) => e.length > 0 || t).map(({ value: e }) => e);
5853
+ }))))).filter(({ value: e, hasQuote: t }) => e.length > 0 || t);
5577
5854
  }
5578
5855
  static _sanitiseCommandPart(e) {
5579
5856
  return e.startsWith("\"") && e.endsWith("\"") || e.startsWith("'") && e.endsWith("'") ? e.substring(1, e.length - 1) : e;
@@ -5589,7 +5866,7 @@ var B, V, H, U, re, W, G, ie, ae, oe, se = e((() => {
5589
5866
  let n = await this._runAndCapture(e[1]);
5590
5867
  t = t.replace(e[0], n);
5591
5868
  }
5592
- let i = t.matchAll(p), a = i.next();
5869
+ let i = t.matchAll(m), a = i.next();
5593
5870
  for (; !a.done;) {
5594
5871
  let n = this.context.getVar(a.value[1]);
5595
5872
  t = t.replace(new RegExp(e._escapeRegExp(a.value[0]), "g"), String(n)), a = i.next();
@@ -5606,14 +5883,14 @@ var B, V, H, U, re, W, G, ie, ae, oe, se = e((() => {
5606
5883
  }
5607
5884
  }
5608
5885
  async _runAndCapture(e) {
5609
- let t = new r.shell({
5886
+ let t = new n.shell({
5610
5887
  cwd: this.context.fs.cwd,
5611
5888
  filesystem: this.context.fs.getRaw(),
5612
5889
  permissions: this.context.fs.getRawPermissions()
5613
5890
  });
5614
5891
  t.context.source(this.context);
5615
- let n = [];
5616
- return t.on("stdOut", (e) => n.push(e)), await t.onCommand(e, !1), n.join("\n").trimEnd();
5892
+ let r = [];
5893
+ return t.on("stdOut", (e) => r.push(e)), await t.onCommand(e, !1), r.join("\n").trimEnd();
5617
5894
  }
5618
5895
  static _splitCommand(e) {
5619
5896
  let t = /\s/g, n = !1, r = !1, i = 0, a = [], o = !1, s = [];
@@ -5659,8 +5936,8 @@ var B, V, H, U, re, W, G, ie, ae, oe, se = e((() => {
5659
5936
  return e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
5660
5937
  }
5661
5938
  };
5662
- m.STATUS_READY = "READY", m.STATUS_WORKING = "WORKING", m.STATUS_DESTROYED = "DESTROYED", m.Command = u, r.shell = m, t.exports = m;
5663
- })), Zn = /* @__PURE__ */ t(((e) => {
5939
+ g.STATUS_READY = "READY", g.STATUS_WORKING = "WORKING", g.STATUS_DESTROYED = "DESTROYED", g.Command = l, g.FS = p, n.shell = g, t.exports = g;
5940
+ })), Qn = /* @__PURE__ */ t(((e) => {
5664
5941
  (function(t, n) {
5665
5942
  if (typeof define == "function" && define.amd) define(["exports"], n);
5666
5943
  else if (typeof e == "object" && typeof e.nodeName != "string") n(e);
@@ -6001,11 +6278,11 @@ var B, V, H, U, re, W, G, ie, ae, oe, se = e((() => {
6001
6278
  }
6002
6279
  Object.defineProperty(e, "__esModule", { value: !0 }), e.default = r;
6003
6280
  });
6004
- })), Qn = /* @__PURE__ */ t((() => {})), $n = /* @__PURE__ */ t(((e, t) => {
6005
- var n = Xn(), r = Zn(), i = "/.brsh_history";
6281
+ })), $n = /* @__PURE__ */ t((() => {})), er = /* @__PURE__ */ t(((e, t) => {
6282
+ var n = Zn(), r = Qn(), i = r?.default ?? r, a = "/.brsh_history";
6006
6283
  t.exports = class {
6007
6284
  constructor(e) {
6008
- let { el: t, font: i = "Roboto Mono", cursor: a = "none", outputAnimation: o = "none", animateSpeed: s = 1, onExit: c = null, mobileInput: l = "click" } = e;
6285
+ let { el: t, font: r = "Roboto Mono", cursor: a = "none", outputAnimation: o = "none", animateSpeed: s = 1, onExit: c = null, mobileInput: l = "click", lineWrap: u = !1 } = e;
6009
6286
  if (!t) throw Error("you must set `el` option");
6010
6287
  if (![
6011
6288
  "none",
@@ -6014,12 +6291,12 @@ var B, V, H, U, re, W, G, ie, ae, oe, se = e((() => {
6014
6291
  ].includes(a)) throw Error("cursor value must be one of: 'none', 'block', 'blink'");
6015
6292
  if (!["none", "type"].includes(o)) throw Error("outputAnimation value must be one of: 'none', 'type'");
6016
6293
  if (!Number.isInteger(s) || s < 1 || s > 20) throw Error("animateSpeed value must be between 1 and 20");
6017
- this._exitFn = c, this._cursor = a, this._outputAnimation = o, this._animateSpeed = s, this._working = !1, this.cli = new n(e), this._buffer = [], this._cursorPos = 0, this._history = [], this._historyPos = null, this._savedInput = null, this._historyLoaded = !1, this._el = t, this._ansi = new r.default(), this._ansi.use_classes = !0, this._ansi.url_whitelist = {
6294
+ this._exitFn = c, this._cursor = a, this._outputAnimation = o, this._animateSpeed = s, this._lineWrap = u, this._working = !1, this.cli = new n(e), this._buffer = [], this._cursorPos = 0, this._history = [], this._historyPos = null, this._savedInput = null, this._historyLoaded = !1, this._el = t, this._ansi = new i(), this._ansi.use_classes = !0, this._ansi.url_whitelist = {
6018
6295
  http: !0,
6019
6296
  https: !0,
6020
6297
  tel: !0,
6021
6298
  mailto: !0
6022
- }, this._setupDom(this._el, i), this._attachShellListeners(), l === "click" && this._mobileInput();
6299
+ }, this._setupDom(this._el, r), this._attachShellListeners(), l === "click" && this._mobileInput();
6023
6300
  }
6024
6301
  sendKey(e, t = {}) {
6025
6302
  let { alt: n = !1, ctrl: r = !1 } = t, i = this._setCurrentLine.bind(this);
@@ -6068,7 +6345,7 @@ var B, V, H, U, re, W, G, ie, ae, oe, se = e((() => {
6068
6345
  }
6069
6346
  _setupDom(e, t = "Roboto Mono") {
6070
6347
  let n = document.createElement("link");
6071
- n.href = `https://fonts.googleapis.com/css?family=${encodeURIComponent(t)}:ital,wght@0,400;0,700;1,400;1,700&display=swap`, n.rel = "stylesheet", document.head.appendChild(n), this._cmdList = document.createElement("ul"), this._cmdList.style.fontFamily = `'${t}', monospace`, this._cmdList.style.listStyle = "none", this._cmdList.style.padding = "0", e.appendChild(this._cmdList);
6348
+ n.href = `https://fonts.googleapis.com/css?family=${encodeURIComponent(t)}:ital,wght@0,400;0,700;1,400;1,700&display=swap`, n.rel = "stylesheet", document.head.appendChild(n), this._cmdList = document.createElement("ul"), this._cmdList.style.fontFamily = `'${t}', monospace`, this._cmdList.style.listStyle = "none", this._cmdList.style.padding = "0", this._lineWrap && this._cmdList.classList.add("terminal--wrap"), e.appendChild(this._cmdList);
6072
6349
  }
6073
6350
  _newPrompt(e) {
6074
6351
  this._clearCursor(), this._currentLine = document.createElement("li"), this._cmdList.appendChild(this._currentLine), e && e(), this._autoScroll();
@@ -6131,13 +6408,13 @@ var B, V, H, U, re, W, G, ie, ae, oe, se = e((() => {
6131
6408
  }
6132
6409
  _loadHistory() {
6133
6410
  try {
6134
- let e = this.cli.context.fs.getFileByPath(i);
6411
+ let e = this.cli.context.fs._getFileRaw(a);
6135
6412
  e && typeof e == "string" && e.length > 0 && (this._history = e.split("\n").filter((e) => e.length > 0));
6136
6413
  } catch {}
6137
6414
  }
6138
6415
  _saveHistory() {
6139
6416
  try {
6140
- this.cli.context.fs.setFileByPath(i, this._history.join("\n"), !0);
6417
+ this.cli.context.fs._setFileRaw(a, this._history.join("\n"), !0);
6141
6418
  } catch {}
6142
6419
  }
6143
6420
  _navigateHistory(e, t) {
@@ -6185,7 +6462,16 @@ var B, V, H, U, re, W, G, ie, ae, oe, se = e((() => {
6185
6462
  "u",
6186
6463
  "k"
6187
6464
  ].includes(t.key.toLowerCase()) && (t.preventDefault(), this._navKeyEvent(e, t));
6188
- }), t.addEventListener("keyup", (t) => this._keyEvent(e, t.key));
6465
+ }), t.addEventListener("keyup", (t) => this._keyEvent(e, t.key)), window.addEventListener("paste", (t) => {
6466
+ t.preventDefault();
6467
+ let n = (t.clipboardData || window.clipboardData).getData("text");
6468
+ if (!n) return;
6469
+ let r = n.split(/\r?\n/);
6470
+ r.forEach((t, n) => {
6471
+ let i = t.split("");
6472
+ this._buffer.splice(this._cursorPos, 0, ...i), this._cursorPos += i.length, n < r.length - 1 && this._keyEvent(e, "Enter");
6473
+ }), e(this._buffer);
6474
+ });
6189
6475
  }
6190
6476
  _wordLeft() {
6191
6477
  let e = this._cursorPos;
@@ -6220,9 +6506,9 @@ var B, V, H, U, re, W, G, ie, ae, oe, se = e((() => {
6220
6506
  }
6221
6507
  }
6222
6508
  }
6223
- }, Qn();
6509
+ }, $n();
6224
6510
  }));
6225
6511
  //#endregion
6226
- export default $n();
6512
+ export default er();
6227
6513
 
6228
6514
  //# sourceMappingURL=terminal.es.js.map