brsh 3.7.0 → 3.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/Readme.md +128 -0
- package/dist/shell.es.js +633 -458
- package/dist/shell.es.js.map +1 -1
- package/dist/shell.min.js +18 -18
- package/dist/shell.min.js.map +1 -1
- package/dist/wbt.es.js +626 -451
- package/dist/wbt.es.js.map +1 -1
- package/dist/wbt.min.js +12 -12
- package/dist/wbt.min.js.map +1 -1
- package/lib/Command.js +3 -2
- package/lib/Readme.md +23 -1
- package/lib/TtyStream.js +12 -2
- package/lib/WasmCommand.js +380 -37
- package/package.json +1 -1
- package/test/wasm-cli.test.js +64 -0
- package/test/wbt.test.js +43 -4
package/dist/wbt.es.js
CHANGED
|
@@ -96,7 +96,7 @@ var u, d, f, p, m, h, g, _, v, y, b = e((() => {
|
|
|
96
96
|
if (typeof e == "string") return g(e, t);
|
|
97
97
|
if (o.isView(e)) return y(e);
|
|
98
98
|
if (e == null) throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof e);
|
|
99
|
-
if (
|
|
99
|
+
if ($(e, o) || e && $(e.buffer, o) || s !== void 0 && ($(e, s) || e && $(e.buffer, s))) return b(e, t, n);
|
|
100
100
|
if (typeof e == "number") throw TypeError("The \"value\" argument must not be of type number. Received type number");
|
|
101
101
|
let r = e.valueOf && e.valueOf();
|
|
102
102
|
if (r != null && r !== e) return u.from(r, t, n);
|
|
@@ -137,7 +137,7 @@ var u, d, f, p, m, h, g, _, v, y, b = e((() => {
|
|
|
137
137
|
return n;
|
|
138
138
|
}
|
|
139
139
|
function y(e) {
|
|
140
|
-
if (
|
|
140
|
+
if ($(e, a)) {
|
|
141
141
|
let t = new a(e);
|
|
142
142
|
return b(t.buffer, t.byteOffset, t.byteLength);
|
|
143
143
|
}
|
|
@@ -154,7 +154,7 @@ var u, d, f, p, m, h, g, _, v, y, b = e((() => {
|
|
|
154
154
|
let t = S(e.length) | 0, n = l(t);
|
|
155
155
|
return n.length === 0 || e.copy(n, 0, 0, t), n;
|
|
156
156
|
}
|
|
157
|
-
if (e.length !== void 0) return typeof e.length != "number" ||
|
|
157
|
+
if (e.length !== void 0) return typeof e.length != "number" || ue(e.length) ? l(0) : _(e);
|
|
158
158
|
if (e.type === "Buffer" && Array.isArray(e.data)) return _(e.data);
|
|
159
159
|
}
|
|
160
160
|
function S(e) {
|
|
@@ -167,7 +167,7 @@ var u, d, f, p, m, h, g, _, v, y, b = e((() => {
|
|
|
167
167
|
u.isBuffer = function(e) {
|
|
168
168
|
return e != null && e._isBuffer === !0 && e !== u.prototype;
|
|
169
169
|
}, u.compare = function(e, t) {
|
|
170
|
-
if (
|
|
170
|
+
if ($(e, a) && (e = u.from(e, e.offset, e.byteLength)), $(t, a) && (t = u.from(t, t.offset, t.byteLength)), !u.isBuffer(e) || !u.isBuffer(t)) throw TypeError("The \"buf1\", \"buf2\" arguments must be one of type Buffer or Uint8Array");
|
|
171
171
|
if (e === t) return 0;
|
|
172
172
|
let n = e.length, r = t.length;
|
|
173
173
|
for (let i = 0, a = Math.min(n, r); i < a; ++i) if (e[i] !== t[i]) {
|
|
@@ -198,7 +198,7 @@ var u, d, f, p, m, h, g, _, v, y, b = e((() => {
|
|
|
198
198
|
let r = u.allocUnsafe(t), i = 0;
|
|
199
199
|
for (n = 0; n < e.length; ++n) {
|
|
200
200
|
let t = e[n];
|
|
201
|
-
if (
|
|
201
|
+
if ($(t, a)) i + t.length > r.length ? (u.isBuffer(t) || (t = u.from(t)), t.copy(r, i)) : a.prototype.set.call(r, t, i);
|
|
202
202
|
else if (u.isBuffer(t)) t.copy(r, i);
|
|
203
203
|
else throw TypeError("\"list\" argument must be an Array of Buffers");
|
|
204
204
|
i += t.length;
|
|
@@ -207,7 +207,7 @@ var u, d, f, p, m, h, g, _, v, y, b = e((() => {
|
|
|
207
207
|
};
|
|
208
208
|
function w(e, t) {
|
|
209
209
|
if (u.isBuffer(e)) return e.length;
|
|
210
|
-
if (o.isView(e) ||
|
|
210
|
+
if (o.isView(e) || $(e, o)) return e.byteLength;
|
|
211
211
|
if (typeof e != "string") throw TypeError("The \"string\" argument must be one of type string, Buffer, or ArrayBuffer. Received type " + typeof e);
|
|
212
212
|
let n = e.length, r = arguments.length > 2 && arguments[2] === !0;
|
|
213
213
|
if (!r && n === 0) return 0;
|
|
@@ -217,15 +217,15 @@ var u, d, f, p, m, h, g, _, v, y, b = e((() => {
|
|
|
217
217
|
case "latin1":
|
|
218
218
|
case "binary": return n;
|
|
219
219
|
case "utf8":
|
|
220
|
-
case "utf-8": return
|
|
220
|
+
case "utf-8": return ae(e).length;
|
|
221
221
|
case "ucs2":
|
|
222
222
|
case "ucs-2":
|
|
223
223
|
case "utf16le":
|
|
224
224
|
case "utf-16le": return n * 2;
|
|
225
225
|
case "hex": return n >>> 1;
|
|
226
|
-
case "base64": return
|
|
226
|
+
case "base64": return ce(e).length;
|
|
227
227
|
default:
|
|
228
|
-
if (i) return r ? -1 :
|
|
228
|
+
if (i) return r ? -1 : ae(e).length;
|
|
229
229
|
t = ("" + t).toLowerCase(), i = !0;
|
|
230
230
|
}
|
|
231
231
|
}
|
|
@@ -234,17 +234,17 @@ var u, d, f, p, m, h, g, _, v, y, b = e((() => {
|
|
|
234
234
|
let r = !1;
|
|
235
235
|
if ((t === void 0 || t < 0) && (t = 0), t > this.length || ((n === void 0 || n > this.length) && (n = this.length), n <= 0) || (n >>>= 0, t >>>= 0, n <= t)) return "";
|
|
236
236
|
for (e ||= "utf8";;) switch (e) {
|
|
237
|
-
case "hex": return
|
|
237
|
+
case "hex": return B(this, t, n);
|
|
238
238
|
case "utf8":
|
|
239
239
|
case "utf-8": return F(this, t, n);
|
|
240
|
-
case "ascii": return
|
|
240
|
+
case "ascii": return R(this, t, n);
|
|
241
241
|
case "latin1":
|
|
242
|
-
case "binary": return
|
|
242
|
+
case "binary": return z(this, t, n);
|
|
243
243
|
case "base64": return P(this, t, n);
|
|
244
244
|
case "ucs2":
|
|
245
245
|
case "ucs-2":
|
|
246
246
|
case "utf16le":
|
|
247
|
-
case "utf-16le": return
|
|
247
|
+
case "utf-16le": return V(this, t, n);
|
|
248
248
|
default:
|
|
249
249
|
if (r) throw TypeError("Unknown encoding: " + e);
|
|
250
250
|
e = (e + "").toLowerCase(), r = !0;
|
|
@@ -280,7 +280,7 @@ var u, d, f, p, m, h, g, _, v, y, b = e((() => {
|
|
|
280
280
|
let t = "", n = e.INSPECT_MAX_BYTES;
|
|
281
281
|
return t = this.toString("hex", 0, n).replace(/(.{2})/g, "$1 ").trim(), this.length > n && (t += " ... "), "<Buffer " + t + ">";
|
|
282
282
|
}, r && (u.prototype[r] = u.prototype.inspect), u.prototype.compare = function(e, t, n, r, i) {
|
|
283
|
-
if (
|
|
283
|
+
if ($(e, a) && (e = u.from(e, e.offset, e.byteLength)), !u.isBuffer(e)) throw TypeError("The \"target\" argument must be one of type Buffer or Uint8Array. Received type " + typeof e);
|
|
284
284
|
if (t === void 0 && (t = 0), n === void 0 && (n = e ? e.length : 0), r === void 0 && (r = 0), i === void 0 && (i = this.length), t < 0 || n > e.length || r < 0 || i > this.length) throw RangeError("out of range index");
|
|
285
285
|
if (r >= i && t >= n) return 0;
|
|
286
286
|
if (r >= i) return -1;
|
|
@@ -295,7 +295,7 @@ var u, d, f, p, m, h, g, _, v, y, b = e((() => {
|
|
|
295
295
|
};
|
|
296
296
|
function D(e, t, n, r, i) {
|
|
297
297
|
if (e.length === 0) return -1;
|
|
298
|
-
if (typeof n == "string" ? (r = n, n = 0) : n > 2147483647 ? n = 2147483647 : n < -2147483648 && (n = -2147483648), n = +n,
|
|
298
|
+
if (typeof n == "string" ? (r = n, n = 0) : n > 2147483647 ? n = 2147483647 : n < -2147483648 && (n = -2147483648), n = +n, ue(n) && (n = i ? 0 : e.length - 1), n < 0 && (n = e.length + n), n >= e.length) {
|
|
299
299
|
if (i) return -1;
|
|
300
300
|
n = e.length - 1;
|
|
301
301
|
} else if (n < 0) if (i) n = 0;
|
|
@@ -345,22 +345,22 @@ var u, d, f, p, m, h, g, _, v, y, b = e((() => {
|
|
|
345
345
|
let o;
|
|
346
346
|
for (o = 0; o < r; ++o) {
|
|
347
347
|
let r = parseInt(t.substr(o * 2, 2), 16);
|
|
348
|
-
if (
|
|
348
|
+
if (ue(r)) return o;
|
|
349
349
|
e[n + o] = r;
|
|
350
350
|
}
|
|
351
351
|
return o;
|
|
352
352
|
}
|
|
353
353
|
function A(e, t, n, r) {
|
|
354
|
-
return
|
|
354
|
+
return le(ae(t, e.length - n), e, n, r);
|
|
355
355
|
}
|
|
356
356
|
function j(e, t, n, r) {
|
|
357
|
-
return
|
|
357
|
+
return le(oe(t), e, n, r);
|
|
358
358
|
}
|
|
359
359
|
function M(e, t, n, r) {
|
|
360
|
-
return
|
|
360
|
+
return le(ce(t), e, n, r);
|
|
361
361
|
}
|
|
362
362
|
function N(e, t, n, r) {
|
|
363
|
-
return
|
|
363
|
+
return le(se(t, e.length - n), e, n, r);
|
|
364
364
|
}
|
|
365
365
|
u.prototype.write = function(e, t, n, r) {
|
|
366
366
|
if (t === void 0) r = "utf8", n = this.length, t = 0;
|
|
@@ -428,26 +428,26 @@ var u, d, f, p, m, h, g, _, v, y, b = e((() => {
|
|
|
428
428
|
for (; r < t;) n += String.fromCharCode.apply(String, e.slice(r, r += I));
|
|
429
429
|
return n;
|
|
430
430
|
}
|
|
431
|
-
function
|
|
431
|
+
function R(e, t, n) {
|
|
432
432
|
let r = "";
|
|
433
433
|
n = Math.min(e.length, n);
|
|
434
434
|
for (let i = t; i < n; ++i) r += String.fromCharCode(e[i] & 127);
|
|
435
435
|
return r;
|
|
436
436
|
}
|
|
437
|
-
function
|
|
437
|
+
function z(e, t, n) {
|
|
438
438
|
let r = "";
|
|
439
439
|
n = Math.min(e.length, n);
|
|
440
440
|
for (let i = t; i < n; ++i) r += String.fromCharCode(e[i]);
|
|
441
441
|
return r;
|
|
442
442
|
}
|
|
443
|
-
function
|
|
443
|
+
function B(e, t, n) {
|
|
444
444
|
let r = e.length;
|
|
445
445
|
(!t || t < 0) && (t = 0), (!n || n < 0 || n > r) && (n = r);
|
|
446
446
|
let i = "";
|
|
447
|
-
for (let r = t; r < n; ++r) i +=
|
|
447
|
+
for (let r = t; r < n; ++r) i += de[e[r]];
|
|
448
448
|
return i;
|
|
449
449
|
}
|
|
450
|
-
function
|
|
450
|
+
function V(e, t, n) {
|
|
451
451
|
let r = e.slice(t, n), i = "";
|
|
452
452
|
for (let e = 0; e < r.length - 1; e += 2) i += String.fromCharCode(r[e] + r[e + 1] * 256);
|
|
453
453
|
return i;
|
|
@@ -458,88 +458,88 @@ var u, d, f, p, m, h, g, _, v, y, b = e((() => {
|
|
|
458
458
|
let r = this.subarray(e, t);
|
|
459
459
|
return Object.setPrototypeOf(r, u.prototype), r;
|
|
460
460
|
};
|
|
461
|
-
function
|
|
461
|
+
function H(e, t, n) {
|
|
462
462
|
if (e % 1 != 0 || e < 0) throw RangeError("offset is not uint");
|
|
463
463
|
if (e + t > n) throw RangeError("Trying to access beyond buffer length");
|
|
464
464
|
}
|
|
465
465
|
u.prototype.readUintLE = u.prototype.readUIntLE = function(e, t, n) {
|
|
466
|
-
e >>>= 0, t >>>= 0, n ||
|
|
466
|
+
e >>>= 0, t >>>= 0, n || H(e, t, this.length);
|
|
467
467
|
let r = this[e], i = 1, a = 0;
|
|
468
468
|
for (; ++a < t && (i *= 256);) r += this[e + a] * i;
|
|
469
469
|
return r;
|
|
470
470
|
}, u.prototype.readUintBE = u.prototype.readUIntBE = function(e, t, n) {
|
|
471
|
-
e >>>= 0, t >>>= 0, n ||
|
|
471
|
+
e >>>= 0, t >>>= 0, n || H(e, t, this.length);
|
|
472
472
|
let r = this[e + --t], i = 1;
|
|
473
473
|
for (; t > 0 && (i *= 256);) r += this[e + --t] * i;
|
|
474
474
|
return r;
|
|
475
475
|
}, u.prototype.readUint8 = u.prototype.readUInt8 = function(e, t) {
|
|
476
|
-
return e >>>= 0, t ||
|
|
476
|
+
return e >>>= 0, t || H(e, 1, this.length), this[e];
|
|
477
477
|
}, u.prototype.readUint16LE = u.prototype.readUInt16LE = function(e, t) {
|
|
478
|
-
return e >>>= 0, t ||
|
|
478
|
+
return e >>>= 0, t || H(e, 2, this.length), this[e] | this[e + 1] << 8;
|
|
479
479
|
}, u.prototype.readUint16BE = u.prototype.readUInt16BE = function(e, t) {
|
|
480
|
-
return e >>>= 0, t ||
|
|
480
|
+
return e >>>= 0, t || H(e, 2, this.length), this[e] << 8 | this[e + 1];
|
|
481
481
|
}, u.prototype.readUint32LE = u.prototype.readUInt32LE = function(e, t) {
|
|
482
|
-
return e >>>= 0, t ||
|
|
482
|
+
return e >>>= 0, t || H(e, 4, this.length), (this[e] | this[e + 1] << 8 | this[e + 2] << 16) + this[e + 3] * 16777216;
|
|
483
483
|
}, u.prototype.readUint32BE = u.prototype.readUInt32BE = function(e, t) {
|
|
484
|
-
return e >>>= 0, t ||
|
|
485
|
-
}, u.prototype.readBigUInt64LE =
|
|
486
|
-
e >>>= 0,
|
|
484
|
+
return e >>>= 0, t || H(e, 4, this.length), this[e] * 16777216 + (this[e + 1] << 16 | this[e + 2] << 8 | this[e + 3]);
|
|
485
|
+
}, u.prototype.readBigUInt64LE = fe(function(e) {
|
|
486
|
+
e >>>= 0, Q(e, "offset");
|
|
487
487
|
let t = this[e], n = this[e + 7];
|
|
488
|
-
(t === void 0 || n === void 0) &&
|
|
488
|
+
(t === void 0 || n === void 0) && ne(e, this.length - 8);
|
|
489
489
|
let r = t + this[++e] * 2 ** 8 + this[++e] * 2 ** 16 + this[++e] * 2 ** 24, i = this[++e] + this[++e] * 2 ** 8 + this[++e] * 2 ** 16 + n * 2 ** 24;
|
|
490
490
|
return BigInt(r) + (BigInt(i) << BigInt(32));
|
|
491
|
-
}), u.prototype.readBigUInt64BE =
|
|
492
|
-
e >>>= 0,
|
|
491
|
+
}), u.prototype.readBigUInt64BE = fe(function(e) {
|
|
492
|
+
e >>>= 0, Q(e, "offset");
|
|
493
493
|
let t = this[e], n = this[e + 7];
|
|
494
|
-
(t === void 0 || n === void 0) &&
|
|
494
|
+
(t === void 0 || n === void 0) && ne(e, this.length - 8);
|
|
495
495
|
let r = t * 2 ** 24 + this[++e] * 2 ** 16 + this[++e] * 2 ** 8 + this[++e], i = this[++e] * 2 ** 24 + this[++e] * 2 ** 16 + this[++e] * 2 ** 8 + n;
|
|
496
496
|
return (BigInt(r) << BigInt(32)) + BigInt(i);
|
|
497
497
|
}), u.prototype.readIntLE = function(e, t, n) {
|
|
498
|
-
e >>>= 0, t >>>= 0, n ||
|
|
498
|
+
e >>>= 0, t >>>= 0, n || H(e, t, this.length);
|
|
499
499
|
let r = this[e], i = 1, a = 0;
|
|
500
500
|
for (; ++a < t && (i *= 256);) r += this[e + a] * i;
|
|
501
501
|
return i *= 128, r >= i && (r -= 2 ** (8 * t)), r;
|
|
502
502
|
}, u.prototype.readIntBE = function(e, t, n) {
|
|
503
|
-
e >>>= 0, t >>>= 0, n ||
|
|
503
|
+
e >>>= 0, t >>>= 0, n || H(e, t, this.length);
|
|
504
504
|
let r = t, i = 1, a = this[e + --r];
|
|
505
505
|
for (; r > 0 && (i *= 256);) a += this[e + --r] * i;
|
|
506
506
|
return i *= 128, a >= i && (a -= 2 ** (8 * t)), a;
|
|
507
507
|
}, u.prototype.readInt8 = function(e, t) {
|
|
508
|
-
return e >>>= 0, t ||
|
|
508
|
+
return e >>>= 0, t || H(e, 1, this.length), this[e] & 128 ? (255 - this[e] + 1) * -1 : this[e];
|
|
509
509
|
}, u.prototype.readInt16LE = function(e, t) {
|
|
510
|
-
e >>>= 0, t ||
|
|
510
|
+
e >>>= 0, t || H(e, 2, this.length);
|
|
511
511
|
let n = this[e] | this[e + 1] << 8;
|
|
512
512
|
return n & 32768 ? n | 4294901760 : n;
|
|
513
513
|
}, u.prototype.readInt16BE = function(e, t) {
|
|
514
|
-
e >>>= 0, t ||
|
|
514
|
+
e >>>= 0, t || H(e, 2, this.length);
|
|
515
515
|
let n = this[e + 1] | this[e] << 8;
|
|
516
516
|
return n & 32768 ? n | 4294901760 : n;
|
|
517
517
|
}, u.prototype.readInt32LE = function(e, t) {
|
|
518
|
-
return e >>>= 0, t ||
|
|
518
|
+
return e >>>= 0, t || H(e, 4, this.length), this[e] | this[e + 1] << 8 | this[e + 2] << 16 | this[e + 3] << 24;
|
|
519
519
|
}, u.prototype.readInt32BE = function(e, t) {
|
|
520
|
-
return e >>>= 0, t ||
|
|
521
|
-
}, u.prototype.readBigInt64LE =
|
|
522
|
-
e >>>= 0,
|
|
520
|
+
return e >>>= 0, t || H(e, 4, this.length), this[e] << 24 | this[e + 1] << 16 | this[e + 2] << 8 | this[e + 3];
|
|
521
|
+
}, u.prototype.readBigInt64LE = fe(function(e) {
|
|
522
|
+
e >>>= 0, Q(e, "offset");
|
|
523
523
|
let t = this[e], n = this[e + 7];
|
|
524
|
-
(t === void 0 || n === void 0) &&
|
|
524
|
+
(t === void 0 || n === void 0) && ne(e, this.length - 8);
|
|
525
525
|
let r = this[e + 4] + this[e + 5] * 2 ** 8 + this[e + 6] * 2 ** 16 + (n << 24);
|
|
526
526
|
return (BigInt(r) << BigInt(32)) + BigInt(t + this[++e] * 2 ** 8 + this[++e] * 2 ** 16 + this[++e] * 2 ** 24);
|
|
527
|
-
}), u.prototype.readBigInt64BE =
|
|
528
|
-
e >>>= 0,
|
|
527
|
+
}), u.prototype.readBigInt64BE = fe(function(e) {
|
|
528
|
+
e >>>= 0, Q(e, "offset");
|
|
529
529
|
let t = this[e], n = this[e + 7];
|
|
530
|
-
(t === void 0 || n === void 0) &&
|
|
530
|
+
(t === void 0 || n === void 0) && ne(e, this.length - 8);
|
|
531
531
|
let r = (t << 24) + this[++e] * 2 ** 16 + this[++e] * 2 ** 8 + this[++e];
|
|
532
532
|
return (BigInt(r) << BigInt(32)) + BigInt(this[++e] * 2 ** 24 + this[++e] * 2 ** 16 + this[++e] * 2 ** 8 + n);
|
|
533
533
|
}), u.prototype.readFloatLE = function(e, t) {
|
|
534
|
-
return e >>>= 0, t ||
|
|
534
|
+
return e >>>= 0, t || H(e, 4, this.length), n.read(this, e, !0, 23, 4);
|
|
535
535
|
}, u.prototype.readFloatBE = function(e, t) {
|
|
536
|
-
return e >>>= 0, t ||
|
|
536
|
+
return e >>>= 0, t || H(e, 4, this.length), n.read(this, e, !1, 23, 4);
|
|
537
537
|
}, u.prototype.readDoubleLE = function(e, t) {
|
|
538
|
-
return e >>>= 0, t ||
|
|
538
|
+
return e >>>= 0, t || H(e, 8, this.length), n.read(this, e, !0, 52, 8);
|
|
539
539
|
}, u.prototype.readDoubleBE = function(e, t) {
|
|
540
|
-
return e >>>= 0, t ||
|
|
540
|
+
return e >>>= 0, t || H(e, 8, this.length), n.read(this, e, !1, 52, 8);
|
|
541
541
|
};
|
|
542
|
-
function
|
|
542
|
+
function U(e, t, n, r, i, a) {
|
|
543
543
|
if (!u.isBuffer(e)) throw TypeError("\"buffer\" argument must be a Buffer instance");
|
|
544
544
|
if (t > i || t < a) throw RangeError("\"value\" argument is out of bounds");
|
|
545
545
|
if (n + r > e.length) throw RangeError("Index out of range");
|
|
@@ -547,7 +547,7 @@ var u, d, f, p, m, h, g, _, v, y, b = e((() => {
|
|
|
547
547
|
u.prototype.writeUintLE = u.prototype.writeUIntLE = function(e, t, n, r) {
|
|
548
548
|
if (e = +e, t >>>= 0, n >>>= 0, !r) {
|
|
549
549
|
let r = 2 ** (8 * n) - 1;
|
|
550
|
-
|
|
550
|
+
U(this, e, t, n, r, 0);
|
|
551
551
|
}
|
|
552
552
|
let i = 1, a = 0;
|
|
553
553
|
for (this[t] = e & 255; ++a < n && (i *= 256);) this[t + a] = e / i & 255;
|
|
@@ -555,44 +555,44 @@ var u, d, f, p, m, h, g, _, v, y, b = e((() => {
|
|
|
555
555
|
}, u.prototype.writeUintBE = u.prototype.writeUIntBE = function(e, t, n, r) {
|
|
556
556
|
if (e = +e, t >>>= 0, n >>>= 0, !r) {
|
|
557
557
|
let r = 2 ** (8 * n) - 1;
|
|
558
|
-
|
|
558
|
+
U(this, e, t, n, r, 0);
|
|
559
559
|
}
|
|
560
560
|
let i = n - 1, a = 1;
|
|
561
561
|
for (this[t + i] = e & 255; --i >= 0 && (a *= 256);) this[t + i] = e / a & 255;
|
|
562
562
|
return t + n;
|
|
563
563
|
}, u.prototype.writeUint8 = u.prototype.writeUInt8 = function(e, t, n) {
|
|
564
|
-
return e = +e, t >>>= 0, n ||
|
|
564
|
+
return e = +e, t >>>= 0, n || U(this, e, t, 1, 255, 0), this[t] = e & 255, t + 1;
|
|
565
565
|
}, u.prototype.writeUint16LE = u.prototype.writeUInt16LE = function(e, t, n) {
|
|
566
|
-
return e = +e, t >>>= 0, n ||
|
|
566
|
+
return e = +e, t >>>= 0, n || U(this, e, t, 2, 65535, 0), this[t] = e & 255, this[t + 1] = e >>> 8, t + 2;
|
|
567
567
|
}, u.prototype.writeUint16BE = u.prototype.writeUInt16BE = function(e, t, n) {
|
|
568
|
-
return e = +e, t >>>= 0, n ||
|
|
568
|
+
return e = +e, t >>>= 0, n || U(this, e, t, 2, 65535, 0), this[t] = e >>> 8, this[t + 1] = e & 255, t + 2;
|
|
569
569
|
}, u.prototype.writeUint32LE = u.prototype.writeUInt32LE = function(e, t, n) {
|
|
570
|
-
return e = +e, t >>>= 0, n ||
|
|
570
|
+
return e = +e, t >>>= 0, n || U(this, e, t, 4, 4294967295, 0), this[t + 3] = e >>> 24, this[t + 2] = e >>> 16, this[t + 1] = e >>> 8, this[t] = e & 255, t + 4;
|
|
571
571
|
}, u.prototype.writeUint32BE = u.prototype.writeUInt32BE = function(e, t, n) {
|
|
572
|
-
return e = +e, t >>>= 0, n ||
|
|
572
|
+
return e = +e, t >>>= 0, n || U(this, e, t, 4, 4294967295, 0), this[t] = e >>> 24, this[t + 1] = e >>> 16, this[t + 2] = e >>> 8, this[t + 3] = e & 255, t + 4;
|
|
573
573
|
};
|
|
574
|
-
function
|
|
575
|
-
|
|
574
|
+
function W(e, t, n, r, i) {
|
|
575
|
+
te(t, r, i, e, n, 7);
|
|
576
576
|
let a = Number(t & BigInt(4294967295));
|
|
577
577
|
e[n++] = a, a >>= 8, e[n++] = a, a >>= 8, e[n++] = a, a >>= 8, e[n++] = a;
|
|
578
578
|
let o = Number(t >> BigInt(32) & BigInt(4294967295));
|
|
579
579
|
return e[n++] = o, o >>= 8, e[n++] = o, o >>= 8, e[n++] = o, o >>= 8, e[n++] = o, n;
|
|
580
580
|
}
|
|
581
|
-
function
|
|
582
|
-
|
|
581
|
+
function G(e, t, n, r, i) {
|
|
582
|
+
te(t, r, i, e, n, 7);
|
|
583
583
|
let a = Number(t & BigInt(4294967295));
|
|
584
584
|
e[n + 7] = a, a >>= 8, e[n + 6] = a, a >>= 8, e[n + 5] = a, a >>= 8, e[n + 4] = a;
|
|
585
585
|
let o = Number(t >> BigInt(32) & BigInt(4294967295));
|
|
586
586
|
return e[n + 3] = o, o >>= 8, e[n + 2] = o, o >>= 8, e[n + 1] = o, o >>= 8, e[n] = o, n + 8;
|
|
587
587
|
}
|
|
588
|
-
u.prototype.writeBigUInt64LE =
|
|
589
|
-
return U(this, e, t, BigInt(0), BigInt("0xffffffffffffffff"));
|
|
590
|
-
}), u.prototype.writeBigUInt64BE = $(function(e, t = 0) {
|
|
588
|
+
u.prototype.writeBigUInt64LE = fe(function(e, t = 0) {
|
|
591
589
|
return W(this, e, t, BigInt(0), BigInt("0xffffffffffffffff"));
|
|
590
|
+
}), u.prototype.writeBigUInt64BE = fe(function(e, t = 0) {
|
|
591
|
+
return G(this, e, t, BigInt(0), BigInt("0xffffffffffffffff"));
|
|
592
592
|
}), u.prototype.writeIntLE = function(e, t, n, r) {
|
|
593
593
|
if (e = +e, t >>>= 0, !r) {
|
|
594
594
|
let r = 2 ** (8 * n - 1);
|
|
595
|
-
|
|
595
|
+
U(this, e, t, n, r - 1, -r);
|
|
596
596
|
}
|
|
597
597
|
let i = 0, a = 1, o = 0;
|
|
598
598
|
for (this[t] = e & 255; ++i < n && (a *= 256);) e < 0 && o === 0 && this[t + i - 1] !== 0 && (o = 1), this[t + i] = (e / a >> 0) - o & 255;
|
|
@@ -600,44 +600,44 @@ var u, d, f, p, m, h, g, _, v, y, b = e((() => {
|
|
|
600
600
|
}, u.prototype.writeIntBE = function(e, t, n, r) {
|
|
601
601
|
if (e = +e, t >>>= 0, !r) {
|
|
602
602
|
let r = 2 ** (8 * n - 1);
|
|
603
|
-
|
|
603
|
+
U(this, e, t, n, r - 1, -r);
|
|
604
604
|
}
|
|
605
605
|
let i = n - 1, a = 1, o = 0;
|
|
606
606
|
for (this[t + i] = e & 255; --i >= 0 && (a *= 256);) e < 0 && o === 0 && this[t + i + 1] !== 0 && (o = 1), this[t + i] = (e / a >> 0) - o & 255;
|
|
607
607
|
return t + n;
|
|
608
608
|
}, u.prototype.writeInt8 = function(e, t, n) {
|
|
609
|
-
return e = +e, t >>>= 0, n ||
|
|
609
|
+
return e = +e, t >>>= 0, n || U(this, e, t, 1, 127, -128), e < 0 && (e = 255 + e + 1), this[t] = e & 255, t + 1;
|
|
610
610
|
}, u.prototype.writeInt16LE = function(e, t, n) {
|
|
611
|
-
return e = +e, t >>>= 0, n ||
|
|
611
|
+
return e = +e, t >>>= 0, n || U(this, e, t, 2, 32767, -32768), this[t] = e & 255, this[t + 1] = e >>> 8, t + 2;
|
|
612
612
|
}, u.prototype.writeInt16BE = function(e, t, n) {
|
|
613
|
-
return e = +e, t >>>= 0, n ||
|
|
613
|
+
return e = +e, t >>>= 0, n || U(this, e, t, 2, 32767, -32768), this[t] = e >>> 8, this[t + 1] = e & 255, t + 2;
|
|
614
614
|
}, u.prototype.writeInt32LE = function(e, t, n) {
|
|
615
|
-
return e = +e, t >>>= 0, n ||
|
|
615
|
+
return e = +e, t >>>= 0, n || U(this, e, t, 4, 2147483647, -2147483648), this[t] = e & 255, this[t + 1] = e >>> 8, this[t + 2] = e >>> 16, this[t + 3] = e >>> 24, t + 4;
|
|
616
616
|
}, u.prototype.writeInt32BE = function(e, t, n) {
|
|
617
|
-
return e = +e, t >>>= 0, n ||
|
|
618
|
-
}, u.prototype.writeBigInt64LE =
|
|
619
|
-
return U(this, e, t, -BigInt("0x8000000000000000"), BigInt("0x7fffffffffffffff"));
|
|
620
|
-
}), u.prototype.writeBigInt64BE = $(function(e, t = 0) {
|
|
617
|
+
return e = +e, t >>>= 0, n || U(this, e, t, 4, 2147483647, -2147483648), e < 0 && (e = 4294967295 + e + 1), this[t] = e >>> 24, this[t + 1] = e >>> 16, this[t + 2] = e >>> 8, this[t + 3] = e & 255, t + 4;
|
|
618
|
+
}, u.prototype.writeBigInt64LE = fe(function(e, t = 0) {
|
|
621
619
|
return W(this, e, t, -BigInt("0x8000000000000000"), BigInt("0x7fffffffffffffff"));
|
|
620
|
+
}), u.prototype.writeBigInt64BE = fe(function(e, t = 0) {
|
|
621
|
+
return G(this, e, t, -BigInt("0x8000000000000000"), BigInt("0x7fffffffffffffff"));
|
|
622
622
|
});
|
|
623
|
-
function
|
|
623
|
+
function ee(e, t, n, r, i, a) {
|
|
624
624
|
if (n + r > e.length || n < 0) throw RangeError("Index out of range");
|
|
625
625
|
}
|
|
626
626
|
function K(e, t, r, i, a) {
|
|
627
|
-
return t = +t, r >>>= 0, a ||
|
|
627
|
+
return t = +t, r >>>= 0, a || ee(e, t, r, 4), n.write(e, t, r, i, 23, 4), r + 4;
|
|
628
628
|
}
|
|
629
629
|
u.prototype.writeFloatLE = function(e, t, n) {
|
|
630
630
|
return K(this, e, t, !0, n);
|
|
631
631
|
}, u.prototype.writeFloatBE = function(e, t, n) {
|
|
632
632
|
return K(this, e, t, !1, n);
|
|
633
633
|
};
|
|
634
|
-
function
|
|
635
|
-
return t = +t, r >>>= 0, a ||
|
|
634
|
+
function q(e, t, r, i, a) {
|
|
635
|
+
return t = +t, r >>>= 0, a || ee(e, t, r, 8), n.write(e, t, r, i, 52, 8), r + 8;
|
|
636
636
|
}
|
|
637
637
|
u.prototype.writeDoubleLE = function(e, t, n) {
|
|
638
|
-
return
|
|
638
|
+
return q(this, e, t, !0, n);
|
|
639
639
|
}, u.prototype.writeDoubleBE = function(e, t, n) {
|
|
640
|
-
return
|
|
640
|
+
return q(this, e, t, !1, n);
|
|
641
641
|
}, u.prototype.copy = function(e, t, n, r) {
|
|
642
642
|
if (!u.isBuffer(e)) throw TypeError("argument should be a Buffer");
|
|
643
643
|
if (n ||= 0, !r && r !== 0 && (r = this.length), t >= e.length && (t = e.length), t ||= 0, r > 0 && r < n && (r = n), r === n || e.length === 0 || this.length === 0) return 0;
|
|
@@ -668,9 +668,9 @@ var u, d, f, p, m, h, g, _, v, y, b = e((() => {
|
|
|
668
668
|
}
|
|
669
669
|
return this;
|
|
670
670
|
};
|
|
671
|
-
let
|
|
672
|
-
function
|
|
673
|
-
|
|
671
|
+
let J = {};
|
|
672
|
+
function Y(e, t, n) {
|
|
673
|
+
J[e] = class extends n {
|
|
674
674
|
constructor() {
|
|
675
675
|
super(), Object.defineProperty(this, "message", {
|
|
676
676
|
value: t.apply(this, arguments),
|
|
@@ -694,42 +694,42 @@ var u, d, f, p, m, h, g, _, v, y, b = e((() => {
|
|
|
694
694
|
}
|
|
695
695
|
};
|
|
696
696
|
}
|
|
697
|
-
|
|
697
|
+
Y("ERR_BUFFER_OUT_OF_BOUNDS", function(e) {
|
|
698
698
|
return e ? `${e} is outside of buffer bounds` : "Attempt to access memory outside buffer bounds";
|
|
699
|
-
}, RangeError),
|
|
699
|
+
}, RangeError), Y("ERR_INVALID_ARG_TYPE", function(e, t) {
|
|
700
700
|
return `The "${e}" argument must be of type number. Received type ${typeof t}`;
|
|
701
|
-
}, TypeError),
|
|
701
|
+
}, TypeError), Y("ERR_OUT_OF_RANGE", function(e, t, n) {
|
|
702
702
|
let r = `The value of "${e}" is out of range.`, i = n;
|
|
703
|
-
return Number.isInteger(n) && Math.abs(n) > 2 ** 32 ? i =
|
|
703
|
+
return Number.isInteger(n) && Math.abs(n) > 2 ** 32 ? i = X(String(n)) : typeof n == "bigint" && (i = String(n), (n > BigInt(2) ** BigInt(32) || n < -(BigInt(2) ** BigInt(32))) && (i = X(i)), i += "n"), r += ` It must be ${t}. Received ${i}`, r;
|
|
704
704
|
}, RangeError);
|
|
705
|
-
function
|
|
705
|
+
function X(e) {
|
|
706
706
|
let t = "", n = e.length, r = +(e[0] === "-");
|
|
707
707
|
for (; n >= r + 4; n -= 3) t = `_${e.slice(n - 3, n)}${t}`;
|
|
708
708
|
return `${e.slice(0, n)}${t}`;
|
|
709
709
|
}
|
|
710
|
-
function
|
|
711
|
-
|
|
710
|
+
function Z(e, t, n) {
|
|
711
|
+
Q(t, "offset"), (e[t] === void 0 || e[t + n] === void 0) && ne(t, e.length - (n + 1));
|
|
712
712
|
}
|
|
713
|
-
function
|
|
713
|
+
function te(e, t, n, r, i, a) {
|
|
714
714
|
if (e > n || e < t) {
|
|
715
715
|
let r = typeof t == "bigint" ? "n" : "", i;
|
|
716
|
-
throw i = a > 3 ? t === 0 || t === BigInt(0) ? `>= 0${r} and < 2${r} ** ${(a + 1) * 8}${r}` : `>= -(2${r} ** ${(a + 1) * 8 - 1}${r}) and < 2 ** ${(a + 1) * 8 - 1}${r}` : `>= ${t}${r} and <= ${n}${r}`, new
|
|
716
|
+
throw i = a > 3 ? t === 0 || t === BigInt(0) ? `>= 0${r} and < 2${r} ** ${(a + 1) * 8}${r}` : `>= -(2${r} ** ${(a + 1) * 8 - 1}${r}) and < 2 ** ${(a + 1) * 8 - 1}${r}` : `>= ${t}${r} and <= ${n}${r}`, new J.ERR_OUT_OF_RANGE("value", i, e);
|
|
717
717
|
}
|
|
718
|
-
|
|
718
|
+
Z(r, i, a);
|
|
719
719
|
}
|
|
720
|
-
function
|
|
721
|
-
if (typeof e != "number") throw new
|
|
720
|
+
function Q(e, t) {
|
|
721
|
+
if (typeof e != "number") throw new J.ERR_INVALID_ARG_TYPE(t, "number", e);
|
|
722
722
|
}
|
|
723
|
-
function
|
|
724
|
-
throw Math.floor(e) === e ? t < 0 ? new
|
|
723
|
+
function ne(e, t, n) {
|
|
724
|
+
throw Math.floor(e) === e ? t < 0 ? new J.ERR_BUFFER_OUT_OF_BOUNDS() : new J.ERR_OUT_OF_RANGE(n || "offset", `>= ${+!!n} and <= ${t}`, e) : (Q(e, n), new J.ERR_OUT_OF_RANGE(n || "offset", "an integer", e));
|
|
725
725
|
}
|
|
726
|
-
let
|
|
727
|
-
function
|
|
728
|
-
if (e = e.split("=")[0], e = e.trim().replace(
|
|
726
|
+
let re = /[^+/0-9A-Za-z-_]/g;
|
|
727
|
+
function ie(e) {
|
|
728
|
+
if (e = e.split("=")[0], e = e.trim().replace(re, ""), e.length < 2) return "";
|
|
729
729
|
for (; e.length % 4 != 0;) e += "=";
|
|
730
730
|
return e;
|
|
731
731
|
}
|
|
732
|
-
function
|
|
732
|
+
function ae(e, t) {
|
|
733
733
|
t ||= Infinity;
|
|
734
734
|
let n, r = e.length, i = null, a = [];
|
|
735
735
|
for (let o = 0; o < r; ++o) {
|
|
@@ -767,31 +767,31 @@ var u, d, f, p, m, h, g, _, v, y, b = e((() => {
|
|
|
767
767
|
}
|
|
768
768
|
return a;
|
|
769
769
|
}
|
|
770
|
-
function
|
|
770
|
+
function oe(e) {
|
|
771
771
|
let t = [];
|
|
772
772
|
for (let n = 0; n < e.length; ++n) t.push(e.charCodeAt(n) & 255);
|
|
773
773
|
return t;
|
|
774
774
|
}
|
|
775
|
-
function
|
|
775
|
+
function se(e, t) {
|
|
776
776
|
let n, r, i, a = [];
|
|
777
777
|
for (let o = 0; o < e.length && !((t -= 2) < 0); ++o) n = e.charCodeAt(o), r = n >> 8, i = n % 256, a.push(i), a.push(r);
|
|
778
778
|
return a;
|
|
779
779
|
}
|
|
780
|
-
function
|
|
781
|
-
return t.toByteArray(
|
|
780
|
+
function ce(e) {
|
|
781
|
+
return t.toByteArray(ie(e));
|
|
782
782
|
}
|
|
783
|
-
function
|
|
783
|
+
function le(e, t, n, r) {
|
|
784
784
|
let i;
|
|
785
785
|
for (i = 0; i < r && !(i + n >= t.length || i >= e.length); ++i) t[i + n] = e[i];
|
|
786
786
|
return i;
|
|
787
787
|
}
|
|
788
|
-
function
|
|
788
|
+
function $(e, t) {
|
|
789
789
|
return e instanceof t || e != null && e.constructor != null && e.constructor.name != null && e.constructor.name === t.name;
|
|
790
790
|
}
|
|
791
|
-
function
|
|
791
|
+
function ue(e) {
|
|
792
792
|
return e !== e;
|
|
793
793
|
}
|
|
794
|
-
let
|
|
794
|
+
let de = (function() {
|
|
795
795
|
let e = "0123456789abcdef", t = Array(256);
|
|
796
796
|
for (let n = 0; n < 16; ++n) {
|
|
797
797
|
let r = n * 16;
|
|
@@ -799,7 +799,7 @@ var u, d, f, p, m, h, g, _, v, y, b = e((() => {
|
|
|
799
799
|
}
|
|
800
800
|
return t;
|
|
801
801
|
})();
|
|
802
|
-
function
|
|
802
|
+
function fe(e) {
|
|
803
803
|
return typeof BigInt > "u" ? pe : e;
|
|
804
804
|
}
|
|
805
805
|
function pe() {
|
|
@@ -1079,10 +1079,24 @@ var u, d, f, p, m, h, g, _, v, y, b = e((() => {
|
|
|
1079
1079
|
super(), this.isTTY = e.isTTY !== !1, this.readable = !0, this.writable = !0, this.columns = e.columns || 80, this.rows = e.rows || 24, this.isRaw = !1, this._encoding = null, this._onWrite = e.onWrite || null;
|
|
1080
1080
|
}
|
|
1081
1081
|
write(e, t, n) {
|
|
1082
|
-
|
|
1082
|
+
if (e == null) return !0;
|
|
1083
|
+
typeof this._onWrite == "function" && this._onWrite(e), this._isPushing = !0;
|
|
1084
|
+
try {
|
|
1085
|
+
this.emit("data", this._formatChunk(e));
|
|
1086
|
+
} finally {
|
|
1087
|
+
this._isPushing = !1;
|
|
1088
|
+
}
|
|
1089
|
+
return typeof t == "function" ? t() : typeof n == "function" && n(), !0;
|
|
1083
1090
|
}
|
|
1084
1091
|
pushData(e) {
|
|
1085
|
-
e != null
|
|
1092
|
+
if (e != null) {
|
|
1093
|
+
this._isPushing = !0;
|
|
1094
|
+
try {
|
|
1095
|
+
this.emit("data", this._formatChunk(e));
|
|
1096
|
+
} finally {
|
|
1097
|
+
this._isPushing = !1;
|
|
1098
|
+
}
|
|
1099
|
+
}
|
|
1086
1100
|
}
|
|
1087
1101
|
_formatChunk(e) {
|
|
1088
1102
|
return this._encoding ? typeof e == "string" ? e : e instanceof Uint8Array || y !== void 0 && y.isBuffer(e) ? new TextDecoder().decode(e) : String(e) : e;
|
|
@@ -1143,11 +1157,11 @@ var u, d, f, p, m, h, g, _, v, y, b = e((() => {
|
|
|
1143
1157
|
columns: n,
|
|
1144
1158
|
rows: o,
|
|
1145
1159
|
onWrite: (e) => this.emit("stderr", e)
|
|
1146
|
-
}), this.
|
|
1160
|
+
}), this._onStdinStreamData = (e) => {
|
|
1147
1161
|
if (!this.captureInput) return;
|
|
1148
1162
|
let t = a(e);
|
|
1149
1163
|
for (let e of t) !this.interactive && !this.stdinStream.isRaw && (e === "Enter" ? this.stdout.write("\r\n") : e === "Backspace" ? this.stdout.write("\b \b") : e.length === 1 && this.stdout.write(e)), this.onInput(e);
|
|
1150
|
-
});
|
|
1164
|
+
}, this.stdinStream.on("data", this._onStdinStreamData);
|
|
1151
1165
|
}
|
|
1152
1166
|
get name() {
|
|
1153
1167
|
return "unnamed";
|
|
@@ -1664,79 +1678,79 @@ function j() {
|
|
|
1664
1678
|
throw Error("clearTimeout has not been defined");
|
|
1665
1679
|
}
|
|
1666
1680
|
function M(e) {
|
|
1667
|
-
if (
|
|
1668
|
-
if ((
|
|
1681
|
+
if (B === setTimeout) return setTimeout(e, 0);
|
|
1682
|
+
if ((B === A || !B) && setTimeout) return B = setTimeout, setTimeout(e, 0);
|
|
1669
1683
|
try {
|
|
1670
|
-
return
|
|
1684
|
+
return B(e, 0);
|
|
1671
1685
|
} catch {
|
|
1672
1686
|
try {
|
|
1673
|
-
return
|
|
1687
|
+
return B.call(null, e, 0);
|
|
1674
1688
|
} catch {
|
|
1675
|
-
return
|
|
1689
|
+
return B.call(this, e, 0);
|
|
1676
1690
|
}
|
|
1677
1691
|
}
|
|
1678
1692
|
}
|
|
1679
1693
|
function N(e) {
|
|
1680
|
-
if (
|
|
1681
|
-
if ((
|
|
1694
|
+
if (V === clearTimeout) return clearTimeout(e);
|
|
1695
|
+
if ((V === j || !V) && clearTimeout) return V = clearTimeout, clearTimeout(e);
|
|
1682
1696
|
try {
|
|
1683
|
-
return
|
|
1697
|
+
return V(e);
|
|
1684
1698
|
} catch {
|
|
1685
1699
|
try {
|
|
1686
|
-
return
|
|
1700
|
+
return V.call(null, e);
|
|
1687
1701
|
} catch {
|
|
1688
|
-
return
|
|
1702
|
+
return V.call(this, e);
|
|
1689
1703
|
}
|
|
1690
1704
|
}
|
|
1691
1705
|
}
|
|
1692
1706
|
function P() {
|
|
1693
|
-
!
|
|
1707
|
+
!U || !W || (U = !1, W.length ? H = W.concat(H) : G = -1, H.length && F());
|
|
1694
1708
|
}
|
|
1695
1709
|
function F() {
|
|
1696
|
-
if (!
|
|
1710
|
+
if (!U) {
|
|
1697
1711
|
var e = M(P);
|
|
1698
|
-
|
|
1699
|
-
for (var t =
|
|
1700
|
-
for (
|
|
1701
|
-
|
|
1712
|
+
U = !0;
|
|
1713
|
+
for (var t = H.length; t;) {
|
|
1714
|
+
for (W = H, H = []; ++G < t;) W && W[G].run();
|
|
1715
|
+
G = -1, t = H.length;
|
|
1702
1716
|
}
|
|
1703
|
-
|
|
1717
|
+
W = null, U = !1, N(e);
|
|
1704
1718
|
}
|
|
1705
1719
|
}
|
|
1706
1720
|
function I(e, t) {
|
|
1707
1721
|
this.fun = e, this.array = t;
|
|
1708
1722
|
}
|
|
1709
1723
|
function L() {}
|
|
1710
|
-
var
|
|
1711
|
-
|
|
1724
|
+
var R, z, B, V, H, U, W, G, ee, K, q = e((() => {
|
|
1725
|
+
R = { exports: {} }, z = R.exports = {}, (function() {
|
|
1712
1726
|
try {
|
|
1713
|
-
|
|
1727
|
+
B = typeof setTimeout == "function" ? setTimeout : A;
|
|
1714
1728
|
} catch {
|
|
1715
|
-
|
|
1729
|
+
B = A;
|
|
1716
1730
|
}
|
|
1717
1731
|
try {
|
|
1718
|
-
|
|
1732
|
+
V = typeof clearTimeout == "function" ? clearTimeout : j;
|
|
1719
1733
|
} catch {
|
|
1720
|
-
|
|
1734
|
+
V = j;
|
|
1721
1735
|
}
|
|
1722
|
-
})(),
|
|
1736
|
+
})(), H = [], U = !1, G = -1, z.nextTick = function(e) {
|
|
1723
1737
|
var t = Array(arguments.length - 1);
|
|
1724
1738
|
if (arguments.length > 1) for (var n = 1; n < arguments.length; n++) t[n - 1] = arguments[n];
|
|
1725
|
-
|
|
1739
|
+
H.push(new I(e, t)), H.length === 1 && !U && M(F);
|
|
1726
1740
|
}, I.prototype.run = function() {
|
|
1727
1741
|
this.fun.apply(null, this.array);
|
|
1728
|
-
},
|
|
1742
|
+
}, z.title = "browser", z.browser = !0, z.env = {}, z.argv = [], z.version = "", z.versions = {}, z.on = L, z.addListener = L, z.once = L, z.off = L, z.removeListener = L, z.removeAllListeners = L, z.emit = L, z.prependListener = L, z.prependOnceListener = L, z.listeners = function(e) {
|
|
1729
1743
|
return [];
|
|
1730
|
-
},
|
|
1744
|
+
}, z.binding = function(e) {
|
|
1731
1745
|
throw Error("process.binding is not supported");
|
|
1732
|
-
},
|
|
1746
|
+
}, z.cwd = function() {
|
|
1733
1747
|
return "/";
|
|
1734
|
-
},
|
|
1748
|
+
}, z.chdir = function(e) {
|
|
1735
1749
|
throw Error("process.chdir is not supported");
|
|
1736
|
-
},
|
|
1750
|
+
}, z.umask = function() {
|
|
1737
1751
|
return 0;
|
|
1738
|
-
},
|
|
1739
|
-
})),
|
|
1752
|
+
}, ee = R.exports, K = /* @__PURE__ */ k(ee);
|
|
1753
|
+
})), J = /* @__PURE__ */ t(((e, t) => {
|
|
1740
1754
|
var n = T();
|
|
1741
1755
|
t.exports = class extends n {
|
|
1742
1756
|
get captureInput() {
|
|
@@ -1766,8 +1780,8 @@ var ee, R, z, B, V, H, U, W, G, K, te = e((() => {
|
|
|
1766
1780
|
});
|
|
1767
1781
|
}
|
|
1768
1782
|
};
|
|
1769
|
-
})),
|
|
1770
|
-
b(),
|
|
1783
|
+
})), Y = /* @__PURE__ */ t(((e, t) => {
|
|
1784
|
+
b(), q();
|
|
1771
1785
|
var { BinaryFile: n, SymlinkRef: r } = O(), i = new Uint8Array([
|
|
1772
1786
|
66,
|
|
1773
1787
|
82,
|
|
@@ -1872,7 +1886,7 @@ var ee, R, z, B, V, H, U, W, G, K, te = e((() => {
|
|
|
1872
1886
|
let t = e.$c;
|
|
1873
1887
|
if (m[t]) return m[t];
|
|
1874
1888
|
if (f.inlineCommands && f.inlineCommands[t]) try {
|
|
1875
|
-
let e = T(), n =
|
|
1889
|
+
let e = T(), n = J();
|
|
1876
1890
|
return Function("Command", "InteractiveCommand", `return (${f.inlineCommands[t]});`)(e, n);
|
|
1877
1891
|
} catch {
|
|
1878
1892
|
return null;
|
|
@@ -2037,7 +2051,7 @@ var ee, R, z, B, V, H, U, W, G, K, te = e((() => {
|
|
|
2037
2051
|
}
|
|
2038
2052
|
}
|
|
2039
2053
|
};
|
|
2040
|
-
})),
|
|
2054
|
+
})), X = /* @__PURE__ */ t(((e, t) => {
|
|
2041
2055
|
b();
|
|
2042
2056
|
var n = O(), { BinaryFile: r, SymlinkRef: i } = n;
|
|
2043
2057
|
function a(e) {
|
|
@@ -2062,20 +2076,20 @@ var ee, R, z, B, V, H, U, W, G, K, te = e((() => {
|
|
|
2062
2076
|
t.exports = class extends n {
|
|
2063
2077
|
constructor(e = "/", t = {}, n = {}, r = null) {
|
|
2064
2078
|
if (super(), t instanceof Uint8Array || t instanceof ArrayBuffer) {
|
|
2065
|
-
let { deserializeBinaryFilesystem: e } =
|
|
2079
|
+
let { deserializeBinaryFilesystem: e } = Y(), r = e(t);
|
|
2066
2080
|
t = r.filesystem, n = Object.assign({}, r.permissions, n);
|
|
2067
2081
|
} else if (t && typeof t == "object" && t.filesystem && (t.filesystem instanceof Uint8Array || typeof t.filesystem == "object") && (n = Object.assign({}, t.permissions || {}, n), t = t.filesystem, t instanceof Uint8Array || t instanceof ArrayBuffer)) {
|
|
2068
|
-
let { deserializeBinaryFilesystem: e } =
|
|
2082
|
+
let { deserializeBinaryFilesystem: e } = Y(), r = e(t);
|
|
2069
2083
|
t = r.filesystem, n = Object.assign({}, r.permissions, n);
|
|
2070
2084
|
}
|
|
2071
2085
|
a(t), this.fileSystem = t, this.permissions = Object.assign({}, n), this.cwd = e.endsWith("/") ? e : e + "/", this._onChange = r, this._changeScheduled = !1;
|
|
2072
2086
|
}
|
|
2073
2087
|
toBinaryContainer(e = {}) {
|
|
2074
|
-
let { serializeBinaryFilesystem: t } =
|
|
2088
|
+
let { serializeBinaryFilesystem: t } = Y();
|
|
2075
2089
|
return t(this.fileSystem, this.permissions, e);
|
|
2076
2090
|
}
|
|
2077
2091
|
static fromBinaryContainer(e, t = {}) {
|
|
2078
|
-
let { deserializeBinaryFilesystem: n } =
|
|
2092
|
+
let { deserializeBinaryFilesystem: n } = Y();
|
|
2079
2093
|
return n(e, t);
|
|
2080
2094
|
}
|
|
2081
2095
|
getFileByPath(e) {
|
|
@@ -2253,10 +2267,10 @@ var ee, R, z, B, V, H, U, W, G, K, te = e((() => {
|
|
|
2253
2267
|
return null;
|
|
2254
2268
|
}
|
|
2255
2269
|
}, t.exports.BinaryFile = r, t.exports.SymlinkRef = i;
|
|
2256
|
-
})),
|
|
2270
|
+
})), Z = /* @__PURE__ */ t(((e, t) => {
|
|
2257
2271
|
t.exports = null;
|
|
2258
|
-
})),
|
|
2259
|
-
|
|
2272
|
+
})), te = /* @__PURE__ */ t(((e, t) => {
|
|
2273
|
+
q();
|
|
2260
2274
|
function n(e) {
|
|
2261
2275
|
if (typeof e != "string") throw TypeError("Path must be a string. Received " + JSON.stringify(e));
|
|
2262
2276
|
}
|
|
@@ -2423,9 +2437,9 @@ var ee, R, z, B, V, H, U, W, G, K, te = e((() => {
|
|
|
2423
2437
|
posix: null
|
|
2424
2438
|
};
|
|
2425
2439
|
a.posix = a, t.exports = a;
|
|
2426
|
-
})),
|
|
2440
|
+
})), Q = /* @__PURE__ */ t(((e, t) => {
|
|
2427
2441
|
b();
|
|
2428
|
-
var n = D(), { BinaryFile: r } =
|
|
2442
|
+
var n = D(), { BinaryFile: r } = X(), i = 0, a = 6, o = 8, s = 20, c = 28, l = 31, u = 44, d = 54, f = 70, p = 0, m = 2, h = 3, g = 4, _ = 1, v = 2, x = 4, S = 8, C = 1, w = 4, T = class extends n {
|
|
2429
2443
|
get name() {
|
|
2430
2444
|
return "wasm";
|
|
2431
2445
|
}
|
|
@@ -2476,7 +2490,7 @@ var ee, R, z, B, V, H, U, W, G, K, te = e((() => {
|
|
|
2476
2490
|
return n[e] ? new TextEncoder().encode(n[e]) : new TextEncoder().encode(e);
|
|
2477
2491
|
}
|
|
2478
2492
|
onInput(e) {
|
|
2479
|
-
if (!this._handlingStreamData) {
|
|
2493
|
+
if (!this._handlingStreamData && !(this.stdinStream && this.stdinStream._isPushing)) {
|
|
2480
2494
|
if (typeof this._externalKeyHandler == "function") {
|
|
2481
2495
|
this._externalKeyHandler(e);
|
|
2482
2496
|
return;
|
|
@@ -2492,7 +2506,7 @@ var ee, R, z, B, V, H, U, W, G, K, te = e((() => {
|
|
|
2492
2506
|
run() {
|
|
2493
2507
|
let e = this.script, t = (() => {
|
|
2494
2508
|
try {
|
|
2495
|
-
return
|
|
2509
|
+
return Z();
|
|
2496
2510
|
} catch {
|
|
2497
2511
|
return null;
|
|
2498
2512
|
}
|
|
@@ -2560,8 +2574,10 @@ var ee, R, z, B, V, H, U, W, G, K, te = e((() => {
|
|
|
2560
2574
|
let t = {
|
|
2561
2575
|
1: "",
|
|
2562
2576
|
2: ""
|
|
2563
|
-
}, n = new TextDecoder(), b = new TextEncoder(),
|
|
2564
|
-
|
|
2577
|
+
}, n = new TextDecoder(), b = new TextEncoder(), T = null, E = null, D = !1, O = 0, k = null, A = null, j = null, M = null, F = this.stdin === void 0 || this.stdin === null || this.stdin === this.stdinStream || this.stdin && this.stdin.isTTY, I = !!(this.interactive && F), L = () => {
|
|
2578
|
+
I || !F || (I = !0, this._isInteractive = !0, t[1] &&= (this.stdout && typeof this.stdout.write == "function" && this.stdout.write(t[1]), ""), t[2] &&= (this.stderr && typeof this.stderr.write == "function" && this.stderr.write(t[2]), ""), this.stdinStream && typeof this.stdinStream.setRawMode == "function" && this.stdinStream.setRawMode(!0));
|
|
2579
|
+
}, R = (e, n) => {
|
|
2580
|
+
if (I && (e === 1 || e === 2)) {
|
|
2565
2581
|
if (e === 1 && this.stdout) {
|
|
2566
2582
|
this.stdout.write(n);
|
|
2567
2583
|
return;
|
|
@@ -2575,57 +2591,61 @@ var ee, R, z, B, V, H, U, W, G, K, te = e((() => {
|
|
|
2575
2591
|
let r = t[e].split("\n");
|
|
2576
2592
|
t[e] = r.pop();
|
|
2577
2593
|
for (let t of r) e === 1 ? this.stdOut = t : this.stdErr = t;
|
|
2578
|
-
},
|
|
2579
|
-
t[1] &&= (
|
|
2580
|
-
},
|
|
2594
|
+
}, z = () => {
|
|
2595
|
+
t[1] &&= (I && this.stdout ? this.stdout.write(t[1]) : this.stdOut = t[1], ""), t[2] &&= (I && this.stderr ? this.stderr.write(t[2]) : this.stdErr = t[2], "");
|
|
2596
|
+
}, B = [], V = (e) => {
|
|
2581
2597
|
if (!(!e || e.length === 0)) {
|
|
2582
|
-
for (let t = 0; t < e.length; t++)
|
|
2583
|
-
if (
|
|
2584
|
-
let e =
|
|
2585
|
-
|
|
2598
|
+
for (let t = 0; t < e.length; t++) B.push(e[t]);
|
|
2599
|
+
if (A) {
|
|
2600
|
+
let e = A;
|
|
2601
|
+
A = null, e();
|
|
2586
2602
|
}
|
|
2587
2603
|
}
|
|
2588
2604
|
};
|
|
2589
|
-
|
|
2605
|
+
M = (e) => {
|
|
2590
2606
|
this._handlingStreamData = !0;
|
|
2591
2607
|
try {
|
|
2592
|
-
|
|
2608
|
+
V(typeof e == "string" ? b.encode(e) : e instanceof Uint8Array ? e : y !== void 0 && y.isBuffer(e) ? new Uint8Array(e) : b.encode(String(e ?? "")));
|
|
2593
2609
|
} finally {
|
|
2594
2610
|
this._handlingStreamData = !1;
|
|
2595
2611
|
}
|
|
2596
2612
|
}, this._externalKeyHandler = (e) => {
|
|
2597
2613
|
if (this._handlingStreamData) return;
|
|
2598
2614
|
let t = this._keyToBytes(e);
|
|
2599
|
-
t &&
|
|
2600
|
-
},
|
|
2601
|
-
let
|
|
2615
|
+
t && V(t);
|
|
2616
|
+
}, this._onStdinStreamData && this.stdinStream && typeof this.stdinStream.off == "function" && this.stdinStream.off("data", this._onStdinStreamData), F && this.stdinStream && typeof this.stdinStream.on == "function" && this.stdinStream.on("data", M), F && this.stdin && this.stdin !== this.stdinStream && typeof this.stdin.on == "function" && this.stdin.on("data", M);
|
|
2617
|
+
let H = !F && typeof this.stdin == "string" ? b.encode(this.stdin) : !F && this.stdin instanceof Uint8Array ? this.stdin : !F && y !== void 0 && y.isBuffer(this.stdin) ? new Uint8Array(this.stdin) : new Uint8Array(), U = 0, W = this.context && this.context.fs ? this.context.fs : this.fs, G = this.context && this.context.fs && this.context.fs.cwd || this.fs && this.fs.cwd || this.context && typeof this.context.getVar == "function" && this.context.getVar("PWD") || W && W.cwd || "/", ee = G.length > 1 && G.endsWith("/") ? G.slice(0, -1) : G, K = 5, q = new Map([[3, {
|
|
2602
2618
|
type: "preopen",
|
|
2603
2619
|
path: "/",
|
|
2604
2620
|
guestName: "/"
|
|
2605
2621
|
}], [4, {
|
|
2606
2622
|
type: "preopen",
|
|
2607
|
-
path:
|
|
2623
|
+
path: ee,
|
|
2608
2624
|
guestName: "."
|
|
2609
|
-
}]]),
|
|
2625
|
+
}]]), J = new Map([
|
|
2626
|
+
[0, 0],
|
|
2627
|
+
[1, 0],
|
|
2628
|
+
[2, 0]
|
|
2629
|
+
]), Y = (e) => {
|
|
2610
2630
|
let t = e.split("/").filter(Boolean);
|
|
2611
2631
|
return t.pop(), "/" + t.join("/");
|
|
2612
|
-
},
|
|
2613
|
-
let n =
|
|
2632
|
+
}, X = (e, t) => {
|
|
2633
|
+
let n = q.get(e);
|
|
2614
2634
|
if (!n || n.type !== "preopen" && n.type !== "dir") return null;
|
|
2615
|
-
if (t.startsWith("/")) return
|
|
2616
|
-
if (!t || t === ".") return
|
|
2617
|
-
let r = n.path.endsWith("/") ? n.path : n.path + "/", i =
|
|
2635
|
+
if (t.startsWith("/")) return W.absolutePath(t);
|
|
2636
|
+
if (!t || t === ".") return W.absolutePath(n.path);
|
|
2637
|
+
let r = n.path.endsWith("/") ? n.path : n.path + "/", i = W.absolutePath(r + t), a = W.absolutePath("/" + t);
|
|
2618
2638
|
if (n.path !== "/") {
|
|
2619
|
-
if (
|
|
2620
|
-
if (
|
|
2621
|
-
let e =
|
|
2622
|
-
return
|
|
2639
|
+
if (W.exists(i)) return i;
|
|
2640
|
+
if (W.exists(a)) return a;
|
|
2641
|
+
let e = W.exists(Y(i));
|
|
2642
|
+
return W.exists(Y(a)) && !e ? a : i;
|
|
2623
2643
|
}
|
|
2624
|
-
if (
|
|
2625
|
-
let o =
|
|
2626
|
-
return
|
|
2627
|
-
},
|
|
2628
|
-
if (!(!e || e.type !== "file" || !e.dirty || !
|
|
2644
|
+
if (W.exists(i)) return i;
|
|
2645
|
+
let o = W.absolutePath(t);
|
|
2646
|
+
return W.exists(o) ? o : i;
|
|
2647
|
+
}, Z = (e) => {
|
|
2648
|
+
if (!(!e || e.type !== "file" || !e.dirty || !W)) try {
|
|
2629
2649
|
let t = !0;
|
|
2630
2650
|
for (let n = 0; n < e.bytes.length; n++) if (e.bytes[n] === 0) {
|
|
2631
2651
|
t = !1;
|
|
@@ -2633,10 +2653,10 @@ var ee, R, z, B, V, H, U, W, G, K, te = e((() => {
|
|
|
2633
2653
|
}
|
|
2634
2654
|
if (t) {
|
|
2635
2655
|
let t = n.decode(e.bytes);
|
|
2636
|
-
|
|
2656
|
+
W.setFileByPath(e.path, t, !0);
|
|
2637
2657
|
} else {
|
|
2638
2658
|
let t = new Uint8Array(e.bytes.length);
|
|
2639
|
-
t.set(e.bytes),
|
|
2659
|
+
t.set(e.bytes), W.setFileByPath(e.path, new r(t.buffer, "application/octet-stream"), !0);
|
|
2640
2660
|
}
|
|
2641
2661
|
e.dirty = !1;
|
|
2642
2662
|
} catch {}
|
|
@@ -2646,25 +2666,39 @@ var ee, R, z, B, V, H, U, W, G, K, te = e((() => {
|
|
|
2646
2666
|
COLUMNS: String(this.stdout && this.stdout.columns || this.context && typeof this.context.getVar == "function" && this.context.getVar("COLUMNS") || 80),
|
|
2647
2667
|
LINES: String(this.stdout && this.stdout.rows || this.context && typeof this.context.getVar == "function" && this.context.getVar("LINES") || 24),
|
|
2648
2668
|
...this.context && this.context.vars || {}
|
|
2649
|
-
},
|
|
2650
|
-
fd_write: (e, t, r,
|
|
2651
|
-
if (!
|
|
2652
|
-
let s = new DataView(
|
|
2669
|
+
}, Q = Object.entries(te).map(([e, t]) => `${e}=${t}`), ne = new Proxy({
|
|
2670
|
+
fd_write: (e, t, r, a) => {
|
|
2671
|
+
if (!T) return o;
|
|
2672
|
+
let s = new DataView(T.buffer);
|
|
2653
2673
|
if (e === 1 || e === 2) {
|
|
2654
|
-
let
|
|
2674
|
+
let o = 0;
|
|
2655
2675
|
for (let i = 0; i < r; i++) {
|
|
2656
|
-
let r = s.getUint32(t + i * 8, !0),
|
|
2657
|
-
|
|
2676
|
+
let r = s.getUint32(t + i * 8, !0), a = s.getUint32(t + i * 8 + 4, !0);
|
|
2677
|
+
a > 0 && R(e, n.decode(new Uint8Array(T.buffer, r, a))), o += a;
|
|
2658
2678
|
}
|
|
2659
|
-
return s.setUint32(
|
|
2679
|
+
return s.setUint32(a, o, !0), i;
|
|
2660
2680
|
}
|
|
2661
|
-
let c =
|
|
2662
|
-
if (!c
|
|
2681
|
+
let c = q.get(e);
|
|
2682
|
+
if (!c) return o;
|
|
2683
|
+
if (c.type === "dev_null" || c.type === "dev_zero") {
|
|
2684
|
+
let e = 0;
|
|
2685
|
+
for (let n = 0; n < r; n++) e += s.getUint32(t + n * 8 + 4, !0);
|
|
2686
|
+
return s.setUint32(a, e, !0), i;
|
|
2687
|
+
}
|
|
2688
|
+
if (c.type === "dev_tty") {
|
|
2689
|
+
let e = 0;
|
|
2690
|
+
for (let i = 0; i < r; i++) {
|
|
2691
|
+
let r = s.getUint32(t + i * 8, !0), a = s.getUint32(t + i * 8 + 4, !0);
|
|
2692
|
+
a > 0 && R(1, n.decode(new Uint8Array(T.buffer, r, a))), e += a;
|
|
2693
|
+
}
|
|
2694
|
+
return s.setUint32(a, e, !0), i;
|
|
2695
|
+
}
|
|
2696
|
+
if (c.type !== "file") return o;
|
|
2663
2697
|
let l = 0;
|
|
2664
2698
|
for (let e = 0; e < r; e++) {
|
|
2665
2699
|
let n = s.getUint32(t + e * 8, !0), r = s.getUint32(t + e * 8 + 4, !0);
|
|
2666
2700
|
if (r > 0) {
|
|
2667
|
-
let e = new Uint8Array(
|
|
2701
|
+
let e = new Uint8Array(T.buffer, n, r), t = c.append ? c.bytes.length : c.pos, i = t + r;
|
|
2668
2702
|
if (i > c.bytes.length) {
|
|
2669
2703
|
let e = new Uint8Array(i);
|
|
2670
2704
|
e.set(c.bytes), c.bytes = e;
|
|
@@ -2672,202 +2706,277 @@ var ee, R, z, B, V, H, U, W, G, K, te = e((() => {
|
|
|
2672
2706
|
c.bytes.set(e, t), c.pos = t + r, c.dirty = !0, l += r;
|
|
2673
2707
|
}
|
|
2674
2708
|
}
|
|
2675
|
-
return s.setUint32(
|
|
2709
|
+
return s.setUint32(a, l, !0), i;
|
|
2676
2710
|
},
|
|
2677
2711
|
fd_read: (e, t, n, r) => {
|
|
2678
|
-
if (!
|
|
2679
|
-
let
|
|
2680
|
-
if (e === 0) {
|
|
2681
|
-
|
|
2682
|
-
|
|
2683
|
-
|
|
2712
|
+
if (!T) return o;
|
|
2713
|
+
let s = new DataView(T.buffer), c = q.get(e), l = !!(c && c.type === "dev_tty");
|
|
2714
|
+
if (e === 0 || I && e === 2 || l) {
|
|
2715
|
+
(l || e === 2) && L();
|
|
2716
|
+
let o = !!((J.get(e) || 0) & w);
|
|
2717
|
+
if (D) {
|
|
2718
|
+
if ((typeof E?.exports?.asyncify_get_state == "function" ? E.exports.asyncify_get_state() : 0) === 2) {
|
|
2719
|
+
E.exports.asyncify_stop_rewind();
|
|
2684
2720
|
let e = 0;
|
|
2685
|
-
for (let r = 0; r < n &&
|
|
2686
|
-
let n =
|
|
2687
|
-
new Uint8Array(
|
|
2721
|
+
for (let r = 0; r < n && B.length > 0; r++) {
|
|
2722
|
+
let n = s.getUint32(t + r * 8, !0), i = s.getUint32(t + r * 8 + 4, !0), a = Math.min(i, B.length), o = B.splice(0, a);
|
|
2723
|
+
new Uint8Array(T.buffer).set(o, n), e += a;
|
|
2688
2724
|
}
|
|
2689
|
-
return
|
|
2725
|
+
return s.setUint32(r, e, !0), i;
|
|
2690
2726
|
}
|
|
2691
|
-
if (
|
|
2727
|
+
if (B.length > 0) {
|
|
2692
2728
|
let e = 0;
|
|
2693
|
-
for (let r = 0; r < n &&
|
|
2694
|
-
let n =
|
|
2695
|
-
new Uint8Array(
|
|
2729
|
+
for (let r = 0; r < n && B.length > 0; r++) {
|
|
2730
|
+
let n = s.getUint32(t + r * 8, !0), i = s.getUint32(t + r * 8 + 4, !0), a = Math.min(i, B.length), o = B.splice(0, a);
|
|
2731
|
+
new Uint8Array(T.buffer).set(o, n), e += a;
|
|
2696
2732
|
}
|
|
2697
|
-
return
|
|
2733
|
+
return s.setUint32(r, e, !0), i;
|
|
2698
2734
|
}
|
|
2699
|
-
return
|
|
2700
|
-
|
|
2701
|
-
}),
|
|
2735
|
+
return o ? (s.setUint32(r, 0, !0), a) : (E.exports.asyncify_start_unwind(O), k = new Promise((e) => {
|
|
2736
|
+
A = e;
|
|
2737
|
+
}), s.setUint32(r, 0, !0), i);
|
|
2702
2738
|
}
|
|
2739
|
+
if (B.length > 0) {
|
|
2740
|
+
let e = 0;
|
|
2741
|
+
for (let r = 0; r < n && B.length > 0; r++) {
|
|
2742
|
+
let n = s.getUint32(t + r * 8, !0), i = s.getUint32(t + r * 8 + 4, !0), a = Math.min(i, B.length), o = B.splice(0, a);
|
|
2743
|
+
new Uint8Array(T.buffer).set(o, n), e += a;
|
|
2744
|
+
}
|
|
2745
|
+
return s.setUint32(r, e, !0), i;
|
|
2746
|
+
}
|
|
2747
|
+
let c = 0;
|
|
2748
|
+
for (let e = 0; e < n && U < H.length; e++) {
|
|
2749
|
+
let n = s.getUint32(t + e * 8, !0), r = s.getUint32(t + e * 8 + 4, !0), i = Math.min(r, H.length - U);
|
|
2750
|
+
new Uint8Array(T.buffer).set(H.slice(U, U + i), n), U += i, c += i;
|
|
2751
|
+
}
|
|
2752
|
+
return c === 0 && o && U >= H.length ? (s.setUint32(r, 0, !0), a) : (s.setUint32(r, c, !0), i);
|
|
2753
|
+
}
|
|
2754
|
+
if (!c) return o;
|
|
2755
|
+
if (c.type === "dev_null") return s.setUint32(r, 0, !0), i;
|
|
2756
|
+
if (c.type === "dev_zero") {
|
|
2703
2757
|
let e = 0;
|
|
2704
|
-
for (let r = 0; r < n
|
|
2705
|
-
let n =
|
|
2706
|
-
new Uint8Array(
|
|
2758
|
+
for (let r = 0; r < n; r++) {
|
|
2759
|
+
let n = s.getUint32(t + r * 8, !0), i = s.getUint32(t + r * 8 + 4, !0);
|
|
2760
|
+
new Uint8Array(T.buffer, n, i).fill(0), e += i;
|
|
2707
2761
|
}
|
|
2708
|
-
return
|
|
2762
|
+
return s.setUint32(r, e, !0), i;
|
|
2709
2763
|
}
|
|
2710
|
-
|
|
2711
|
-
|
|
2712
|
-
|
|
2713
|
-
|
|
2714
|
-
|
|
2715
|
-
|
|
2764
|
+
if (c.type === "dev_urandom") {
|
|
2765
|
+
let e = 0;
|
|
2766
|
+
for (let r = 0; r < n; r++) {
|
|
2767
|
+
let n = s.getUint32(t + r * 8, !0), i = s.getUint32(t + r * 8 + 4, !0), a = new Uint8Array(T.buffer, n, i);
|
|
2768
|
+
if (typeof crypto < "u" && crypto.getRandomValues) crypto.getRandomValues(a);
|
|
2769
|
+
else for (let e = 0; e < i; e++) a[e] = Math.floor(Math.random() * 256);
|
|
2770
|
+
e += i;
|
|
2771
|
+
}
|
|
2772
|
+
return s.setUint32(r, e, !0), i;
|
|
2716
2773
|
}
|
|
2717
|
-
|
|
2774
|
+
if (c.type !== "file") return o;
|
|
2775
|
+
let u = 0;
|
|
2776
|
+
for (let e = 0; e < n && c.pos < c.bytes.length; e++) {
|
|
2777
|
+
let n = s.getUint32(t + e * 8, !0), r = s.getUint32(t + e * 8 + 4, !0), i = Math.min(r, c.bytes.length - c.pos);
|
|
2778
|
+
new Uint8Array(T.buffer).set(c.bytes.subarray(c.pos, c.pos + i), n), c.pos += i, u += i;
|
|
2779
|
+
}
|
|
2780
|
+
return s.setUint32(r, u, !0), i;
|
|
2718
2781
|
},
|
|
2719
|
-
fd_seek: (e, t, n, r,
|
|
2720
|
-
if (!
|
|
2721
|
-
if (e <= 2) return
|
|
2722
|
-
let
|
|
2723
|
-
if (!
|
|
2724
|
-
|
|
2725
|
-
|
|
2726
|
-
let
|
|
2782
|
+
fd_seek: (e, t, n, r, a) => {
|
|
2783
|
+
if (!T) return o;
|
|
2784
|
+
if (e <= 2) return f;
|
|
2785
|
+
let s = q.get(e);
|
|
2786
|
+
if (!s) return o;
|
|
2787
|
+
if (s.type === "dev_tty" || s.type === "dev_null" || s.type === "dev_zero" || s.type === "dev_urandom") return f;
|
|
2788
|
+
if (s.type !== "file") return o;
|
|
2789
|
+
let l, u, d;
|
|
2790
|
+
typeof t == "bigint" ? (l = Number(t), u = n, d = r) : (l = t, u = r, d = a);
|
|
2791
|
+
let p = s.pos;
|
|
2727
2792
|
if (u === 0) p = l;
|
|
2728
|
-
else if (u === 1) p =
|
|
2729
|
-
else if (u === 2) p =
|
|
2730
|
-
else return
|
|
2731
|
-
return p < 0 ?
|
|
2793
|
+
else if (u === 1) p = s.pos + l;
|
|
2794
|
+
else if (u === 2) p = s.bytes.length + l;
|
|
2795
|
+
else return c;
|
|
2796
|
+
return p < 0 ? c : (s.pos = p, d && new DataView(T.buffer).setBigUint64(d, BigInt(s.pos), !0), i);
|
|
2732
2797
|
},
|
|
2733
2798
|
fd_tell: (e, t) => {
|
|
2734
|
-
if (!
|
|
2735
|
-
let n =
|
|
2736
|
-
return !n || n.type !== "file" ?
|
|
2799
|
+
if (!T) return o;
|
|
2800
|
+
let n = q.get(e);
|
|
2801
|
+
return !n || n.type !== "file" ? o : (new DataView(T.buffer).setBigUint64(t, BigInt(n.pos), !0), i);
|
|
2737
2802
|
},
|
|
2738
2803
|
fd_close: (e) => {
|
|
2739
2804
|
if (e <= 2) return i;
|
|
2740
|
-
let t =
|
|
2741
|
-
return t ? (
|
|
2805
|
+
let t = q.get(e);
|
|
2806
|
+
return t ? (t.type === "file" && Z(t), q.delete(e), J.delete(e), i) : o;
|
|
2742
2807
|
},
|
|
2743
2808
|
fd_sync: (e) => {
|
|
2744
|
-
let t =
|
|
2745
|
-
return t &&
|
|
2809
|
+
let t = q.get(e);
|
|
2810
|
+
return t && Z(t), i;
|
|
2746
2811
|
},
|
|
2747
2812
|
fd_datasync: (e) => {
|
|
2748
|
-
let t =
|
|
2749
|
-
return t &&
|
|
2813
|
+
let t = q.get(e);
|
|
2814
|
+
return t && Z(t), i;
|
|
2750
2815
|
},
|
|
2751
2816
|
fd_prestat_get: (e, t) => {
|
|
2752
|
-
if (!
|
|
2753
|
-
let n =
|
|
2754
|
-
if (!n || n.type !== "preopen") return
|
|
2755
|
-
let r = new DataView(
|
|
2756
|
-
return r.setUint8(t, 0), r.setUint32(t + 4,
|
|
2817
|
+
if (!T) return o;
|
|
2818
|
+
let n = q.get(e);
|
|
2819
|
+
if (!n || n.type !== "preopen") return o;
|
|
2820
|
+
let r = new DataView(T.buffer), a = b.encode(n.guestName);
|
|
2821
|
+
return r.setUint8(t, 0), r.setUint32(t + 4, a.length, !0), i;
|
|
2757
2822
|
},
|
|
2758
2823
|
fd_prestat_dir_name: (e, t, n) => {
|
|
2759
|
-
if (!
|
|
2760
|
-
let r =
|
|
2761
|
-
if (!r || r.type !== "preopen") return
|
|
2762
|
-
let
|
|
2763
|
-
return new Uint8Array(
|
|
2824
|
+
if (!T) return o;
|
|
2825
|
+
let r = q.get(e);
|
|
2826
|
+
if (!r || r.type !== "preopen") return o;
|
|
2827
|
+
let a = b.encode(r.guestName);
|
|
2828
|
+
return new Uint8Array(T.buffer, t, Math.min(n, a.length)).set(a.subarray(0, n)), i;
|
|
2764
2829
|
},
|
|
2765
2830
|
fd_fdstat_get: (e, t) => {
|
|
2766
|
-
if (!
|
|
2767
|
-
let n = new DataView(
|
|
2768
|
-
if (e <= 2) r =
|
|
2831
|
+
if (!T) return o;
|
|
2832
|
+
let n = new DataView(T.buffer), r = p;
|
|
2833
|
+
if (e <= 2) r = m;
|
|
2769
2834
|
else {
|
|
2770
|
-
let t =
|
|
2771
|
-
if (!t) return
|
|
2772
|
-
r = t.type === "preopen" || t.type === "dir" ?
|
|
2835
|
+
let t = q.get(e);
|
|
2836
|
+
if (!t) return o;
|
|
2837
|
+
r = t.type === "dev_null" || t.type === "dev_zero" || t.type === "dev_urandom" || t.type === "dev_tty" ? m : t.type === "preopen" || t.type === "dir" ? h : g;
|
|
2773
2838
|
}
|
|
2774
2839
|
for (let e = 0; e < 24; e++) n.setUint8(t + e, 0);
|
|
2775
|
-
|
|
2840
|
+
n.setUint8(t, r);
|
|
2841
|
+
let a = J.get(e) || (q.get(e)?.append ? C : 0);
|
|
2842
|
+
return n.setUint16(t + 2, a, !0), n.setBigUint64(t + 8, 18446744073709551615n, !0), n.setBigUint64(t + 16, 18446744073709551615n, !0), i;
|
|
2843
|
+
},
|
|
2844
|
+
fd_fdstat_set_flags: (e, t) => {
|
|
2845
|
+
if (!T || e > 2 && !q.has(e)) return o;
|
|
2846
|
+
J.set(e, t);
|
|
2847
|
+
let n = q.get(e);
|
|
2848
|
+
return n && (n.append = !!(t & C)), (e === 0 || e === 2 || n && n.type === "dev_tty") && t & w && L(), i;
|
|
2776
2849
|
},
|
|
2777
|
-
fd_fdstat_set_flags: () => i,
|
|
2778
2850
|
fd_filestat_get: (e, t) => {
|
|
2779
|
-
if (!
|
|
2780
|
-
let n = new DataView(
|
|
2851
|
+
if (!T) return o;
|
|
2852
|
+
let n = new DataView(T.buffer);
|
|
2781
2853
|
for (let e = 0; e < 64; e++) n.setUint8(t + e, 0);
|
|
2782
|
-
if (e <= 2) return n.setUint8(t + 16,
|
|
2783
|
-
let r =
|
|
2784
|
-
if (!r) return
|
|
2785
|
-
|
|
2786
|
-
|
|
2854
|
+
if (e <= 2) return n.setUint8(t + 16, m), i;
|
|
2855
|
+
let r = q.get(e);
|
|
2856
|
+
if (!r) return o;
|
|
2857
|
+
if (r.type === "dev_null" || r.type === "dev_zero" || r.type === "dev_urandom" || r.type === "dev_tty") return n.setUint8(t + 16, m), n.setBigUint64(t + 24, 1n, !0), i;
|
|
2858
|
+
let a = r.type === "preopen" || r.type === "dir";
|
|
2859
|
+
return n.setUint8(t + 16, a ? h : g), n.setBigUint64(t + 24, 1n, !0), n.setBigUint64(t + 32, BigInt(r.bytes ? r.bytes.length : 0), !0), i;
|
|
2787
2860
|
},
|
|
2788
|
-
path_open: (e, t, r,
|
|
2789
|
-
if (!
|
|
2790
|
-
let
|
|
2791
|
-
if (!
|
|
2792
|
-
let
|
|
2793
|
-
if (
|
|
2794
|
-
|
|
2795
|
-
|
|
2796
|
-
|
|
2797
|
-
|
|
2798
|
-
|
|
2799
|
-
|
|
2861
|
+
path_open: (e, t, r, a, c, f, p, m, h) => {
|
|
2862
|
+
if (!T || !W) return o;
|
|
2863
|
+
let g = X(e, n.decode(new Uint8Array(T.buffer, r, a)));
|
|
2864
|
+
if (!g) return o;
|
|
2865
|
+
let y = g.replace(/\/+/g, "/").replace(/\/$/, "") || "/";
|
|
2866
|
+
if (y === "/dev/null") {
|
|
2867
|
+
let e = K++;
|
|
2868
|
+
return q.set(e, {
|
|
2869
|
+
type: "dev_null",
|
|
2870
|
+
path: "/dev/null"
|
|
2871
|
+
}), new DataView(T.buffer).setUint32(h, e, !0), i;
|
|
2872
|
+
}
|
|
2873
|
+
if (y === "/dev/zero") {
|
|
2874
|
+
let e = K++;
|
|
2875
|
+
return q.set(e, {
|
|
2876
|
+
type: "dev_zero",
|
|
2877
|
+
path: "/dev/zero"
|
|
2878
|
+
}), new DataView(T.buffer).setUint32(h, e, !0), i;
|
|
2879
|
+
}
|
|
2880
|
+
if (y === "/dev/urandom" || y === "/dev/random") {
|
|
2881
|
+
let e = K++;
|
|
2882
|
+
return q.set(e, {
|
|
2883
|
+
type: "dev_urandom",
|
|
2800
2884
|
path: y
|
|
2801
|
-
}), new DataView(
|
|
2885
|
+
}), new DataView(T.buffer).setUint32(h, e, !0), i;
|
|
2886
|
+
}
|
|
2887
|
+
if (y === "/dev/tty") {
|
|
2888
|
+
L();
|
|
2889
|
+
let e = K++;
|
|
2890
|
+
return q.set(e, {
|
|
2891
|
+
type: "dev_tty",
|
|
2892
|
+
path: "/dev/tty"
|
|
2893
|
+
}), new DataView(T.buffer).setUint32(h, e, !0), i;
|
|
2802
2894
|
}
|
|
2803
|
-
|
|
2804
|
-
if (
|
|
2805
|
-
|
|
2806
|
-
|
|
2807
|
-
|
|
2808
|
-
e
|
|
2809
|
-
|
|
2810
|
-
|
|
2811
|
-
|
|
2895
|
+
let w = W.stat(g), E = w !== null;
|
|
2896
|
+
if (c & x && c & _ && E) return s;
|
|
2897
|
+
if (c & v) {
|
|
2898
|
+
if (!E) return u;
|
|
2899
|
+
if (!w.isDirectory) return d;
|
|
2900
|
+
let e = K++;
|
|
2901
|
+
return q.set(e, {
|
|
2902
|
+
type: "dir",
|
|
2903
|
+
path: g
|
|
2904
|
+
}), new DataView(T.buffer).setUint32(h, e, !0), i;
|
|
2905
|
+
}
|
|
2906
|
+
if (E && w.isDirectory) return l;
|
|
2907
|
+
if (!E && !(c & _)) return u;
|
|
2908
|
+
let D = new Uint8Array(), O = !1;
|
|
2909
|
+
if (E && !(c & S)) {
|
|
2910
|
+
let e = W.getFileByPath(g);
|
|
2911
|
+
e != null && (D = typeof e == "string" ? b.encode(e) : new Uint8Array(this._contentToBytes(e)));
|
|
2912
|
+
} else O = !0;
|
|
2913
|
+
let k = K++;
|
|
2914
|
+
return q.set(k, {
|
|
2812
2915
|
type: "file",
|
|
2813
|
-
path:
|
|
2814
|
-
bytes:
|
|
2815
|
-
pos: m &
|
|
2816
|
-
append: !!(m &
|
|
2817
|
-
dirty:
|
|
2818
|
-
}), new DataView(
|
|
2916
|
+
path: g,
|
|
2917
|
+
bytes: D,
|
|
2918
|
+
pos: m & C ? D.length : 0,
|
|
2919
|
+
append: !!(m & C),
|
|
2920
|
+
dirty: O
|
|
2921
|
+
}), new DataView(T.buffer).setUint32(h, k, !0), i;
|
|
2819
2922
|
},
|
|
2820
|
-
path_filestat_get: (e, t, r,
|
|
2821
|
-
if (!
|
|
2822
|
-
let c =
|
|
2823
|
-
if (!c) return
|
|
2824
|
-
let
|
|
2825
|
-
if (
|
|
2826
|
-
|
|
2827
|
-
|
|
2828
|
-
|
|
2923
|
+
path_filestat_get: (e, t, r, a, s) => {
|
|
2924
|
+
if (!T || !W) return o;
|
|
2925
|
+
let c = X(e, n.decode(new Uint8Array(T.buffer, r, a)));
|
|
2926
|
+
if (!c) return o;
|
|
2927
|
+
let l = c.replace(/\/+/g, "/").replace(/\/$/, "") || "/";
|
|
2928
|
+
if (l === "/dev/null" || l === "/dev/zero" || l === "/dev/urandom" || l === "/dev/random" || l === "/dev/tty") {
|
|
2929
|
+
let e = new DataView(T.buffer);
|
|
2930
|
+
for (let t = 0; t < 64; t++) e.setUint8(s + t, 0);
|
|
2931
|
+
return e.setUint8(s + 16, m), e.setBigUint64(s + 24, 1n, !0), i;
|
|
2932
|
+
}
|
|
2933
|
+
let d = W.stat(c);
|
|
2934
|
+
if (!d) return u;
|
|
2935
|
+
let f = new DataView(T.buffer);
|
|
2936
|
+
for (let e = 0; e < 64; e++) f.setUint8(s + e, 0);
|
|
2937
|
+
return f.setUint8(s + 16, d.isDirectory ? h : g), f.setBigUint64(s + 24, 1n, !0), f.setBigUint64(s + 32, BigInt(W.getSize(c) || 0), !0), i;
|
|
2829
2938
|
},
|
|
2830
2939
|
path_create_directory: (e, t, r) => {
|
|
2831
|
-
if (!
|
|
2832
|
-
let
|
|
2833
|
-
if (!
|
|
2940
|
+
if (!T || !W) return o;
|
|
2941
|
+
let a = X(e, n.decode(new Uint8Array(T.buffer, t, r)));
|
|
2942
|
+
if (!a) return o;
|
|
2834
2943
|
try {
|
|
2835
|
-
return
|
|
2944
|
+
return W.setFileByPath(a, {}, !0), i;
|
|
2836
2945
|
} catch {
|
|
2837
|
-
return
|
|
2946
|
+
return c;
|
|
2838
2947
|
}
|
|
2839
2948
|
},
|
|
2840
2949
|
path_unlink_file: (e, t, r) => {
|
|
2841
|
-
if (!
|
|
2842
|
-
let
|
|
2843
|
-
if (!
|
|
2950
|
+
if (!T || !W) return o;
|
|
2951
|
+
let a = X(e, n.decode(new Uint8Array(T.buffer, t, r)));
|
|
2952
|
+
if (!a || !W.exists(a)) return u;
|
|
2844
2953
|
try {
|
|
2845
|
-
return
|
|
2954
|
+
return W.deleteFileByPath(a), i;
|
|
2846
2955
|
} catch {
|
|
2847
|
-
return
|
|
2956
|
+
return c;
|
|
2848
2957
|
}
|
|
2849
2958
|
},
|
|
2850
2959
|
path_remove_directory: (e, t, r) => {
|
|
2851
|
-
if (!
|
|
2852
|
-
let
|
|
2853
|
-
if (!
|
|
2960
|
+
if (!T || !W) return o;
|
|
2961
|
+
let a = X(e, n.decode(new Uint8Array(T.buffer, t, r)));
|
|
2962
|
+
if (!a || !W.exists(a)) return u;
|
|
2854
2963
|
try {
|
|
2855
|
-
return
|
|
2964
|
+
return W.deleteFileByPath(a), i;
|
|
2856
2965
|
} catch {
|
|
2857
|
-
return
|
|
2966
|
+
return c;
|
|
2858
2967
|
}
|
|
2859
2968
|
},
|
|
2860
|
-
path_rename: (e, t, r,
|
|
2861
|
-
if (!
|
|
2862
|
-
let d = n.decode(new Uint8Array(
|
|
2863
|
-
if (!p || !m) return
|
|
2864
|
-
if (!
|
|
2865
|
-
for (let e of
|
|
2969
|
+
path_rename: (e, t, r, a, s, l) => {
|
|
2970
|
+
if (!T || !W) return o;
|
|
2971
|
+
let d = n.decode(new Uint8Array(T.buffer, t, r)), f = n.decode(new Uint8Array(T.buffer, s, l)), p = X(e, d), m = X(a, f);
|
|
2972
|
+
if (!p || !m) return o;
|
|
2973
|
+
if (!W.exists(p)) return u;
|
|
2974
|
+
for (let e of q.values()) e.path === p && (Z(e), e.path = m);
|
|
2866
2975
|
try {
|
|
2867
|
-
let e =
|
|
2868
|
-
return
|
|
2976
|
+
let e = W.getFileByPath(p);
|
|
2977
|
+
return W.setFileByPath(m, e, !0), W.deleteFileByPath(p), i;
|
|
2869
2978
|
} catch {
|
|
2870
|
-
return
|
|
2979
|
+
return c;
|
|
2871
2980
|
}
|
|
2872
2981
|
},
|
|
2873
2982
|
proc_exit: (e) => {
|
|
@@ -2877,88 +2986,156 @@ var ee, R, z, B, V, H, U, W, G, K, te = e((() => {
|
|
|
2877
2986
|
};
|
|
2878
2987
|
},
|
|
2879
2988
|
args_sizes_get: (e, t) => {
|
|
2880
|
-
if (!
|
|
2881
|
-
let n = [this.script, ...this.arguments || []], r = new DataView(
|
|
2989
|
+
if (!T) return c;
|
|
2990
|
+
let n = [this.script, ...this.arguments || []], r = new DataView(T.buffer);
|
|
2882
2991
|
return r.setUint32(e, n.length, !0), r.setUint32(t, n.reduce((e, t) => e + b.encode(t).length + 1, 0), !0), i;
|
|
2883
2992
|
},
|
|
2884
2993
|
args_get: (e, t) => {
|
|
2885
|
-
if (!
|
|
2886
|
-
let n = [this.script, ...this.arguments || []], r = new DataView(
|
|
2994
|
+
if (!T) return c;
|
|
2995
|
+
let n = [this.script, ...this.arguments || []], r = new DataView(T.buffer), a = t;
|
|
2887
2996
|
for (let t = 0; t < n.length; t++) {
|
|
2888
2997
|
r.setUint32(e + t * 4, a, !0);
|
|
2889
2998
|
let i = b.encode(n[t] + "\0");
|
|
2890
|
-
new Uint8Array(
|
|
2999
|
+
new Uint8Array(T.buffer).set(i, a), a += i.length;
|
|
2891
3000
|
}
|
|
2892
3001
|
return i;
|
|
2893
3002
|
},
|
|
2894
3003
|
environ_sizes_get: (e, t) => {
|
|
2895
|
-
if (!
|
|
2896
|
-
let n = new DataView(
|
|
2897
|
-
n.setUint32(e,
|
|
2898
|
-
let r =
|
|
3004
|
+
if (!T) return c;
|
|
3005
|
+
let n = new DataView(T.buffer);
|
|
3006
|
+
n.setUint32(e, Q.length, !0);
|
|
3007
|
+
let r = Q.reduce((e, t) => e + b.encode(t).length + 1, 0);
|
|
2899
3008
|
return n.setUint32(t, r, !0), i;
|
|
2900
3009
|
},
|
|
2901
3010
|
environ_get: (e, t) => {
|
|
2902
|
-
if (!
|
|
2903
|
-
let n = new DataView(
|
|
2904
|
-
for (let t = 0; t <
|
|
3011
|
+
if (!T) return c;
|
|
3012
|
+
let n = new DataView(T.buffer), r = t;
|
|
3013
|
+
for (let t = 0; t < Q.length; t++) {
|
|
2905
3014
|
n.setUint32(e + t * 4, r, !0);
|
|
2906
|
-
let i = b.encode(
|
|
2907
|
-
new Uint8Array(
|
|
3015
|
+
let i = b.encode(Q[t] + "\0");
|
|
3016
|
+
new Uint8Array(T.buffer).set(i, r), r += i.length;
|
|
2908
3017
|
}
|
|
2909
3018
|
return i;
|
|
2910
3019
|
},
|
|
2911
3020
|
clock_time_get: (e, t, n) => {
|
|
2912
|
-
if (
|
|
3021
|
+
if (T) {
|
|
2913
3022
|
let e = BigInt(Date.now()) * 1000000n;
|
|
2914
|
-
new DataView(
|
|
3023
|
+
new DataView(T.buffer).setBigUint64(n, e, !0);
|
|
2915
3024
|
}
|
|
2916
3025
|
return i;
|
|
2917
3026
|
},
|
|
2918
3027
|
random_get: (e, t) => {
|
|
2919
|
-
if (
|
|
2920
|
-
let n = new Uint8Array(
|
|
3028
|
+
if (T) {
|
|
3029
|
+
let n = new Uint8Array(T.buffer, e, t);
|
|
2921
3030
|
for (let e = 0; e < t; e++) n[e] = Math.random() * 256 | 0;
|
|
2922
3031
|
}
|
|
2923
3032
|
return i;
|
|
3033
|
+
},
|
|
3034
|
+
clock_nanosleep: (e, t, n, r, a) => {
|
|
3035
|
+
if (!T) return o;
|
|
3036
|
+
let s = new DataView(T.buffer).getBigUint64(n, !0), c = 0;
|
|
3037
|
+
if (t & 1) {
|
|
3038
|
+
let e = BigInt(Date.now()) * 1000000n;
|
|
3039
|
+
c = s > e ? Number((s - e) / 1000000n) : 0;
|
|
3040
|
+
} else c = Number(s / 1000000n);
|
|
3041
|
+
return D && c > 0 ? (typeof E?.exports?.asyncify_get_state == "function" ? E.exports.asyncify_get_state() : 0) === 2 ? (E.exports.asyncify_stop_rewind(), i) : (E.exports.asyncify_start_unwind(O), k = new Promise((e) => setTimeout(e, Math.max(1, c))), i) : i;
|
|
3042
|
+
},
|
|
3043
|
+
poll_oneoff: (e, t, n, r) => {
|
|
3044
|
+
if (!T) return o;
|
|
3045
|
+
let a = new DataView(T.buffer);
|
|
3046
|
+
if (D) {
|
|
3047
|
+
if ((typeof E?.exports?.asyncify_get_state == "function" ? E.exports.asyncify_get_state() : 0) === 2) {
|
|
3048
|
+
E.exports.asyncify_stop_rewind();
|
|
3049
|
+
let o = 0;
|
|
3050
|
+
for (let r = 0; r < n; r++) {
|
|
3051
|
+
let n = e + r * 48, s = a.getBigUint64(n, !0), c = a.getUint8(n + 8), l = t + o * 32;
|
|
3052
|
+
a.setBigUint64(l, s, !0), a.setUint16(l + 8, i, !0), a.setUint8(l + 10, c);
|
|
3053
|
+
for (let e = 11; e < 32; e++) a.setUint8(l + e, 0);
|
|
3054
|
+
c === 1 && a.setBigUint64(l + 16, BigInt(B.length), !0), o++;
|
|
3055
|
+
}
|
|
3056
|
+
return a.setUint32(r, o, !0), i;
|
|
3057
|
+
}
|
|
3058
|
+
let o = 0, s = Infinity;
|
|
3059
|
+
for (let t = 0; t < n; t++) {
|
|
3060
|
+
let n = e + t * 48, r = a.getUint8(n + 8);
|
|
3061
|
+
if (r === 0) {
|
|
3062
|
+
let e = a.getBigUint64(n + 24, !0), t = a.getUint16(n + 40, !0), r = 0;
|
|
3063
|
+
if (t & 1) {
|
|
3064
|
+
let t = BigInt(Date.now()) * 1000000n;
|
|
3065
|
+
r = e > t ? Number((e - t) / 1000000n) : 0;
|
|
3066
|
+
} else r = Number(e / 1000000n);
|
|
3067
|
+
r < s && (s = r);
|
|
3068
|
+
} else if (r === 1) {
|
|
3069
|
+
let e = a.getUint32(n + 16, !0), t = q.get(e), r = !!(t && t.type === "dev_tty");
|
|
3070
|
+
(e === 0 || e === 2 || r) && L(), (e === 0 || I && e === 2 || r) && B.length > 0 && o++;
|
|
3071
|
+
} else r === 2 && o++;
|
|
3072
|
+
}
|
|
3073
|
+
if (o > 0 || s === 0) {
|
|
3074
|
+
let o = 0;
|
|
3075
|
+
for (let r = 0; r < n; r++) {
|
|
3076
|
+
let n = e + r * 48, c = a.getBigUint64(n, !0), l = a.getUint8(n + 8), u = !1;
|
|
3077
|
+
if (l === 0 && s === 0) u = !0;
|
|
3078
|
+
else if (l === 1) {
|
|
3079
|
+
let e = a.getUint32(n + 16, !0), t = q.get(e), r = !!(t && t.type === "dev_tty");
|
|
3080
|
+
(e === 0 || I && e === 2 || r) && B.length > 0 && (u = !0);
|
|
3081
|
+
} else l === 2 && (u = !0);
|
|
3082
|
+
if (u) {
|
|
3083
|
+
let e = t + o * 32;
|
|
3084
|
+
a.setBigUint64(e, c, !0), a.setUint16(e + 8, i, !0), a.setUint8(e + 10, l);
|
|
3085
|
+
for (let t = 11; t < 32; t++) a.setUint8(e + t, 0);
|
|
3086
|
+
l === 1 && a.setBigUint64(e + 16, BigInt(B.length), !0), o++;
|
|
3087
|
+
}
|
|
3088
|
+
}
|
|
3089
|
+
return a.setUint32(r, o, !0), i;
|
|
3090
|
+
}
|
|
3091
|
+
return E.exports.asyncify_start_unwind(O), k = new Promise((e) => {
|
|
3092
|
+
let t = null;
|
|
3093
|
+
A = () => {
|
|
3094
|
+
t && clearTimeout(t), A = null, e();
|
|
3095
|
+
}, s !== Infinity && (t = setTimeout(() => {
|
|
3096
|
+
A = null, e();
|
|
3097
|
+
}, Math.max(1, s)));
|
|
3098
|
+
}), a.setUint32(r, 0, !0), i;
|
|
3099
|
+
}
|
|
3100
|
+
return a.setUint32(r, 0, !0), i;
|
|
2924
3101
|
}
|
|
2925
3102
|
}, { get(e, t) {
|
|
2926
3103
|
return t in e ? e[t] : () => 0;
|
|
2927
|
-
} }),
|
|
2928
|
-
if (!
|
|
3104
|
+
} }), re = (e) => {
|
|
3105
|
+
if (!T || !e) return "";
|
|
2929
3106
|
try {
|
|
2930
|
-
let t = new DataView(
|
|
3107
|
+
let t = new DataView(T.buffer).getUint32(e - 4, !0), n = new Uint16Array(T.buffer, e, t >>> 1);
|
|
2931
3108
|
return String.fromCharCode(...n);
|
|
2932
3109
|
} catch {
|
|
2933
3110
|
return "";
|
|
2934
3111
|
}
|
|
2935
|
-
},
|
|
2936
|
-
wasi_snapshot_preview1:
|
|
2937
|
-
wasi_unstable:
|
|
3112
|
+
}, ie = {
|
|
3113
|
+
wasi_snapshot_preview1: ne,
|
|
3114
|
+
wasi_unstable: ne,
|
|
2938
3115
|
env: new Proxy({
|
|
2939
3116
|
print: (e, t) => {
|
|
2940
|
-
|
|
3117
|
+
T && R(1, n.decode(new Uint8Array(T.buffer, e, t)));
|
|
2941
3118
|
},
|
|
2942
3119
|
eprint: (e, t) => {
|
|
2943
|
-
|
|
3120
|
+
T && R(2, n.decode(new Uint8Array(T.buffer, e, t)));
|
|
2944
3121
|
},
|
|
2945
3122
|
log: (e) => {
|
|
2946
|
-
|
|
3123
|
+
R(1, re(e) + "\n");
|
|
2947
3124
|
},
|
|
2948
3125
|
logi: (e) => {
|
|
2949
|
-
|
|
3126
|
+
R(1, String(e) + "\n");
|
|
2950
3127
|
},
|
|
2951
3128
|
logf: (e) => {
|
|
2952
|
-
|
|
3129
|
+
R(1, String(e) + "\n");
|
|
2953
3130
|
},
|
|
2954
3131
|
trace: (e, t, ...n) => {
|
|
2955
3132
|
let r = t > 0 ? " " + n.slice(0, t).join(", ") : "";
|
|
2956
|
-
|
|
3133
|
+
R(1, `trace: ${re(e)}${r}\n`);
|
|
2957
3134
|
},
|
|
2958
3135
|
seed: () => Date.now() * Math.random(),
|
|
2959
3136
|
abort: (e, t, n, r) => {
|
|
2960
|
-
let i =
|
|
2961
|
-
throw (i || a) &&
|
|
3137
|
+
let i = re(e), a = re(t);
|
|
3138
|
+
throw (i || a) && R(2, `abort: ${i || "aborted"} at ${a || this.script}:${n || 0}:${r || 0}\n`), this.exitCode = 134, {
|
|
2962
3139
|
_wasmExit: !0,
|
|
2963
3140
|
code: 134
|
|
2964
3141
|
};
|
|
@@ -2974,66 +3151,64 @@ var ee, R, z, B, V, H, U, W, G, K, te = e((() => {
|
|
|
2974
3151
|
initial: 1,
|
|
2975
3152
|
maximum: 256
|
|
2976
3153
|
});
|
|
2977
|
-
|
|
3154
|
+
T = t, ie[e.module] || (ie[e.module] = {}), ie[e.module][e.name] = t;
|
|
2978
3155
|
}
|
|
2979
|
-
if (
|
|
3156
|
+
if (E = await WebAssembly.instantiate(t, ie), E.exports.memory && (T = E.exports.memory), D = !!(E.exports.asyncify_start_unwind && E.exports.asyncify_stop_unwind), D && T) {
|
|
2980
3157
|
try {
|
|
2981
|
-
|
|
3158
|
+
O = T.grow(1) * 65536;
|
|
2982
3159
|
} catch {
|
|
2983
|
-
|
|
3160
|
+
O = 16;
|
|
2984
3161
|
}
|
|
2985
|
-
let e =
|
|
2986
|
-
new Int32Array(
|
|
3162
|
+
let e = O + 8, t = O + 65536 - 8;
|
|
3163
|
+
new Int32Array(T.buffer, O, 2).set([e, t]);
|
|
2987
3164
|
}
|
|
2988
|
-
|
|
2989
|
-
|
|
3165
|
+
typeof E.exports.set_terminal_size == "function" && L(), I && this._enterAltScreen();
|
|
3166
|
+
let n = this.stdout && this.stdout.columns || this.context && typeof this.context.getVar == "function" && parseInt(this.context.getVar("COLUMNS"), 10) || 80, r = this.stdout && this.stdout.rows || this.context && typeof this.context.getVar == "function" && parseInt(this.context.getVar("LINES"), 10) || 24;
|
|
3167
|
+
if (typeof E.exports.set_terminal_size == "function") try {
|
|
3168
|
+
E.exports.set_terminal_size(n, r);
|
|
3169
|
+
} catch {}
|
|
3170
|
+
j = () => {
|
|
2990
3171
|
let e = this.stdout && this.stdout.columns || this.context && typeof this.context.getVar == "function" && parseInt(this.context.getVar("COLUMNS"), 10) || 80, t = this.stdout && this.stdout.rows || this.context && typeof this.context.getVar == "function" && parseInt(this.context.getVar("LINES"), 10) || 24;
|
|
2991
|
-
if (typeof
|
|
2992
|
-
|
|
3172
|
+
if (typeof E?.exports?.set_terminal_size == "function") try {
|
|
3173
|
+
E.exports.set_terminal_size(e, t);
|
|
2993
3174
|
} catch {}
|
|
2994
|
-
|
|
2995
|
-
|
|
2996
|
-
|
|
2997
|
-
|
|
2998
|
-
|
|
2999
|
-
}, this.stdout && typeof this.stdout.on == "function" && this.stdout.on("resize", k), this.stdinStream && typeof this.stdinStream.on == "function" && this.stdinStream.on("resize", k);
|
|
3000
|
-
}
|
|
3001
|
-
let n = w.exports._start || w.exports.__wasi_command || w.exports.main || w.exports.run;
|
|
3002
|
-
if (n) try {
|
|
3003
|
-
let e = n();
|
|
3004
|
-
for (e && typeof e.then == "function" && (e = await e); T && typeof w.exports.asyncify_get_state == "function" && w.exports.asyncify_get_state() === 1;) w.exports.asyncify_stop_unwind(), D &&= (await D, null), w.exports.asyncify_start_rewind(E), e = n(), e && typeof e.then == "function" && (e = await e);
|
|
3175
|
+
}, this.stdout && typeof this.stdout.on == "function" && this.stdout.on("resize", j), this.stdinStream && typeof this.stdinStream.on == "function" && this.stdinStream.on("resize", j);
|
|
3176
|
+
let i = E.exports._start || E.exports.__wasi_command || E.exports.main || E.exports.run;
|
|
3177
|
+
if (i) try {
|
|
3178
|
+
let e = i();
|
|
3179
|
+
for (e && typeof e.then == "function" && (e = await e); D && typeof E.exports.asyncify_get_state == "function" && E.exports.asyncify_get_state() === 1;) E.exports.asyncify_stop_unwind(), k &&= (await k, null), E.exports.asyncify_start_rewind(O), e = i(), e && typeof e.then == "function" && (e = await e);
|
|
3005
3180
|
} catch (e) {
|
|
3006
3181
|
(!e || !e._wasmExit) && (this.stdErr = `${this.script}: runtime error: ${e?.message || String(e)}`, this.exitCode = 1);
|
|
3007
3182
|
}
|
|
3008
3183
|
else {
|
|
3009
|
-
let e = Object.entries(
|
|
3184
|
+
let e = Object.entries(E.exports).filter(([, e]) => typeof e == "function").map(([e]) => e), t = e.length > 0 ? ` (module is a library exporting: ${e.join(", ")})` : "";
|
|
3010
3185
|
this.stdErr = `${this.script}: no CLI entry point found (expected _start, main, or run)${t}`, this.exitCode = 1;
|
|
3011
3186
|
}
|
|
3012
3187
|
} catch (e) {
|
|
3013
3188
|
(!e || !e._wasmExit) && (this.stdErr = `${this.script}: ${e?.message || String(e)}`, this.exitCode = 1);
|
|
3014
3189
|
} finally {
|
|
3015
|
-
|
|
3016
|
-
for (let e of
|
|
3190
|
+
I && this._exitAltScreen(), M && (this.stdinStream && typeof this.stdinStream.off == "function" && this.stdinStream.off("data", M), this.stdin && typeof this.stdin.off == "function" && this.stdin.off("data", M)), this._onStdinStreamData && this.stdinStream && typeof this.stdinStream.on == "function" && this.stdinStream.on("data", this._onStdinStreamData), j && (this.stdout && typeof this.stdout.off == "function" && this.stdout.off("resize", j), this.stdinStream && typeof this.stdinStream.off == "function" && this.stdinStream.off("resize", j)), this._externalKeyHandler = null;
|
|
3191
|
+
for (let e of q.values()) Z(e);
|
|
3017
3192
|
}
|
|
3018
|
-
|
|
3019
|
-
let
|
|
3193
|
+
z();
|
|
3194
|
+
let ae = this.arguments || [];
|
|
3020
3195
|
if (!(this.result && this.result.getStdOutput && this.result.getStdOutput().length > 0) && (this.exitCode === 0 || this.exitCode === void 0)) {
|
|
3021
3196
|
let t = (this.script || "wasm").split("/").pop(), n = Object.assign({
|
|
3022
3197
|
name: t,
|
|
3023
3198
|
version: "wasi",
|
|
3024
3199
|
description: `WebAssembly WASI binary (${this.script})`
|
|
3025
3200
|
}, this._pkgMeta || {});
|
|
3026
|
-
if (
|
|
3027
|
-
let r =
|
|
3028
|
-
for (let e of
|
|
3029
|
-
} else (
|
|
3201
|
+
if (ae.includes("--help") || ae.includes("-h")) {
|
|
3202
|
+
let r = N(e);
|
|
3203
|
+
for (let e of P(t, n, r)) this.stdOut = e;
|
|
3204
|
+
} else (ae.includes("--version") || ae.includes("-V") || ae.includes("-v")) && (this.stdOut = `${t} (${n.name} ${n.version} wasm)`);
|
|
3030
3205
|
}
|
|
3031
3206
|
}
|
|
3032
|
-
},
|
|
3033
|
-
function
|
|
3207
|
+
}, O = /* @__PURE__ */ new Map();
|
|
3208
|
+
function k(e, t) {
|
|
3034
3209
|
if (!e || !e.exists(t)) return null;
|
|
3035
3210
|
if (e.isRealFilesystem) try {
|
|
3036
|
-
let n =
|
|
3211
|
+
let n = Z();
|
|
3037
3212
|
return new Uint8Array(n.readFileSync(e.absolutePath(t)));
|
|
3038
3213
|
} catch {}
|
|
3039
3214
|
let n = e.getFileByPath(t);
|
|
@@ -3057,12 +3232,12 @@ var ee, R, z, B, V, H, U, W, G, K, te = e((() => {
|
|
|
3057
3232
|
}
|
|
3058
3233
|
return null;
|
|
3059
3234
|
}
|
|
3060
|
-
function
|
|
3235
|
+
function A(e, t, n, i = "application/octet-stream") {
|
|
3061
3236
|
let a = n instanceof Uint8Array ? n : new Uint8Array(n), o = new Uint8Array(a.byteLength);
|
|
3062
3237
|
o.set(a);
|
|
3063
3238
|
let s = new r(o.buffer, i);
|
|
3064
3239
|
if (e.isRealFilesystem) try {
|
|
3065
|
-
let n =
|
|
3240
|
+
let n = Z(), r = te(), i = e.absolutePath(t);
|
|
3066
3241
|
n.mkdirSync(r.dirname(i), { recursive: !0 }), n.writeFileSync(i, y.from(a.buffer, a.byteOffset, a.byteLength));
|
|
3067
3242
|
return;
|
|
3068
3243
|
} catch {
|
|
@@ -3077,7 +3252,7 @@ var ee, R, z, B, V, H, U, W, G, K, te = e((() => {
|
|
|
3077
3252
|
}
|
|
3078
3253
|
e.setFileByPath(t, s, !0);
|
|
3079
3254
|
}
|
|
3080
|
-
async function
|
|
3255
|
+
async function j(e, t, n = null) {
|
|
3081
3256
|
if (typeof n == "function") {
|
|
3082
3257
|
let r = await n(e, t);
|
|
3083
3258
|
if (r) return r;
|
|
@@ -3105,7 +3280,7 @@ var ee, R, z, B, V, H, U, W, G, K, te = e((() => {
|
|
|
3105
3280
|
}
|
|
3106
3281
|
throw Error(`Package '${e}' could not be loaded`);
|
|
3107
3282
|
}
|
|
3108
|
-
function
|
|
3283
|
+
function M(e, t = !1) {
|
|
3109
3284
|
let n = {
|
|
3110
3285
|
usage: null,
|
|
3111
3286
|
options: []
|
|
@@ -3122,7 +3297,7 @@ var ee, R, z, B, V, H, U, W, G, K, te = e((() => {
|
|
|
3122
3297
|
}
|
|
3123
3298
|
return n;
|
|
3124
3299
|
}
|
|
3125
|
-
function
|
|
3300
|
+
function N(e) {
|
|
3126
3301
|
let t = {
|
|
3127
3302
|
usage: null,
|
|
3128
3303
|
options: [],
|
|
@@ -3143,12 +3318,12 @@ var ee, R, z, B, V, H, U, W, G, K, te = e((() => {
|
|
|
3143
3318
|
i >= 32 && i <= 126 || i === 9 || i === 10 ? r += String.fromCharCode(i) : (r.length >= 4 && n.push(r), r = "");
|
|
3144
3319
|
}
|
|
3145
3320
|
r.length >= 4 && n.push(r);
|
|
3146
|
-
let i =
|
|
3321
|
+
let i = M(n.join("\n"), !0);
|
|
3147
3322
|
t.usage = i.usage, t.options = i.options;
|
|
3148
3323
|
} catch {}
|
|
3149
3324
|
return t;
|
|
3150
3325
|
}
|
|
3151
|
-
function
|
|
3326
|
+
function P(e, t = {}, n = null) {
|
|
3152
3327
|
let r = t.name || e, i = t.version || "wasm", a = t.description || "WebAssembly binary", o = t && typeof t.repl == "object" ? t.repl : t.repl ? {} : null, s = n && n.usage || t.usage, c = s ? s.replace(/%s/g, e) : null, l = o ? `${e} [options] ${o.evalFlag ? `[${o.evalFlag} <code>] ` : ""}[file] [args...]` : `${e} [options] [args...]`, u = [`${e} (${r} ${i} wasm) — ${a}`, `Usage: ${c || l}`];
|
|
3153
3328
|
t.details && u.push("", t.details), u.push("", "Options:");
|
|
3154
3329
|
let d = n && n.options && n.options.length > 0 ? n.options : Array.isArray(t.options) ? t.options : [];
|
|
@@ -3156,7 +3331,7 @@ var ee, R, z, B, V, H, U, W, G, K, te = e((() => {
|
|
|
3156
3331
|
else o && (o.evalFlag && u.push(` ${o.evalFlag.padEnd(20)}Evaluate inline code and print result`), u.push(` (no arguments) Start interactive ${e} REPL shell`));
|
|
3157
3332
|
return u.push(" -h, --help Show this help message and exit"), u.push(" -V, --version Show WebAssembly binary version and exit"), n && n.exports && n.exports.length > 0 && u.push("", `WASM Exports: ${n.exports.join(", ")}`), Array.isArray(t.aliases) && t.aliases.length > 0 && u.push("", `Aliases: ${t.aliases.join(", ")}`), (t.homepage || t.cdnUrl || t.wasmUrl) && u.push(`Source: ${t.homepage || t.cdnUrl || t.wasmUrl}`), u;
|
|
3158
3333
|
}
|
|
3159
|
-
function
|
|
3334
|
+
function F(e, t = {}, n = null) {
|
|
3160
3335
|
let r = E(), i = (n || e.bin || e.name).toLowerCase();
|
|
3161
3336
|
class a extends r {
|
|
3162
3337
|
static get name() {
|
|
@@ -3170,7 +3345,7 @@ var ee, R, z, B, V, H, U, W, G, K, te = e((() => {
|
|
|
3170
3345
|
}
|
|
3171
3346
|
async run() {
|
|
3172
3347
|
let n = [...this.arguments || []], r = n.includes("--help") || n.includes("-h"), a = !r && (n.includes("--version") || n.includes("-V") || n.includes("-v"));
|
|
3173
|
-
this._inspectedWasm = null, this._persistedWasmBytes = e.wasmPath ?
|
|
3348
|
+
this._inspectedWasm = null, this._persistedWasmBytes = e.wasmPath ? k(this.context && this.context.fs || this.fs, e.wasmPath) : null, r && this._persistedWasmBytes && this._persistedWasmBytes.byteLength > 0 && (this._inspectedWasm = N(this._persistedWasmBytes));
|
|
3174
3349
|
try {
|
|
3175
3350
|
if ((e.type === "wasm" || e.type === "custom-wasm") && (this._persistedWasmBytes || e.wasmUrl)) {
|
|
3176
3351
|
let i = this._persistedWasmBytes;
|
|
@@ -3179,7 +3354,7 @@ var ee, R, z, B, V, H, U, W, G, K, te = e((() => {
|
|
|
3179
3354
|
n instanceof Uint8Array || n instanceof ArrayBuffer ? i = n instanceof Uint8Array ? n : new Uint8Array(n) : n && (n.wasmBytes || n.wasm || n.wasmBinary) && (i = n.wasmBytes || n.wasm || n.wasmBinary);
|
|
3180
3355
|
} catch {}
|
|
3181
3356
|
if (!i && e.wasmUrl && (i = await this._fetchWasmBytes(e.wasmUrl)), i) {
|
|
3182
|
-
r && (this._inspectedWasm =
|
|
3357
|
+
r && (this._inspectedWasm = N(i)), await this._runRawWasmBytes(i, n);
|
|
3183
3358
|
return;
|
|
3184
3359
|
}
|
|
3185
3360
|
} else {
|
|
@@ -3196,19 +3371,19 @@ var ee, R, z, B, V, H, U, W, G, K, te = e((() => {
|
|
|
3196
3371
|
}
|
|
3197
3372
|
let c, l;
|
|
3198
3373
|
try {
|
|
3199
|
-
c = await
|
|
3374
|
+
c = await j(e.name, o, t.moduleLoader), l = c && c.default !== void 0 ? c.default : c, l && typeof l.then == "function" && (l = await l);
|
|
3200
3375
|
} finally {
|
|
3201
3376
|
s && (globalThis.fetch = s);
|
|
3202
3377
|
}
|
|
3203
3378
|
if (l instanceof Uint8Array || l instanceof ArrayBuffer) {
|
|
3204
3379
|
let e = l instanceof Uint8Array ? l : new Uint8Array(l);
|
|
3205
|
-
r && (this._inspectedWasm =
|
|
3380
|
+
r && (this._inspectedWasm = N(e)), await this._runRawWasmBytes(e, n);
|
|
3206
3381
|
} else if (l && (l.wasmBytes instanceof Uint8Array || l.wasm instanceof Uint8Array)) {
|
|
3207
3382
|
let e = l.wasmBytes || l.wasm;
|
|
3208
|
-
r && (this._inspectedWasm =
|
|
3383
|
+
r && (this._inspectedWasm = N(e)), await this._runRawWasmBytes(e, n);
|
|
3209
3384
|
} else if (typeof l == "function") await this._runFunctionOrEmscripten(l, n, r);
|
|
3210
3385
|
else if (l && typeof l == "object") {
|
|
3211
|
-
l.ready && await l.ready, r && (l.HEAPU8 instanceof Uint8Array || l.wasmBinary instanceof Uint8Array) && (this._inspectedWasm =
|
|
3386
|
+
l.ready && await l.ready, r && (l.HEAPU8 instanceof Uint8Array || l.wasmBinary instanceof Uint8Array) && (this._inspectedWasm = N(l.wasmBinary || l.HEAPU8));
|
|
3212
3387
|
let t = l.main || l.run || l.callMain || l.exec;
|
|
3213
3388
|
if (typeof t == "function") await this._invokeCliFunction(t.bind(l), n);
|
|
3214
3389
|
else if (l.promised || typeof l.raw == "function" || typeof l.json == "function") {
|
|
@@ -3236,29 +3411,29 @@ var ee, R, z, B, V, H, U, W, G, K, te = e((() => {
|
|
|
3236
3411
|
}
|
|
3237
3412
|
}
|
|
3238
3413
|
if (r || a) {
|
|
3239
|
-
let t = this.result && this.result.getStdOutput ? this.result.getStdOutput() : [], n = t.map((e) => e.string).join("\n"), o = r ?
|
|
3414
|
+
let t = this.result && this.result.getStdOutput ? this.result.getStdOutput() : [], n = t.map((e) => e.string).join("\n"), o = r ? M(n) : null, s = r && !!(o && (o.usage || o.options.length > 0) || t.some((e) => /\b(usage|options):/i.test(e.string))), c = t.filter((e) => e.type === "out").map((e) => e.string), l = a && c.length > 0 && (this.exitCode === 0 || this.exitCode === void 0);
|
|
3240
3415
|
if (r) if (s) {
|
|
3241
3416
|
let e = t.map((e) => e.string);
|
|
3242
3417
|
this.result && Array.isArray(this.result.std) && (this.result.std.length = 0), this.exitCode = 0;
|
|
3243
3418
|
for (let t of e) this.stdOut = t;
|
|
3244
3419
|
} else {
|
|
3245
3420
|
this.result && Array.isArray(this.result.std) && (this.result.std.length = 0), this.exitCode = 0;
|
|
3246
|
-
for (let t of
|
|
3421
|
+
for (let t of P(i, e, this._inspectedWasm)) this.stdOut = t;
|
|
3247
3422
|
}
|
|
3248
3423
|
else a && !l ? (this.result && Array.isArray(this.result.std) && (this.result.std.length = 0), this.exitCode = 0, this.stdOut = `${i} (${e.name} ${e.version || "wasm"} wasm)`) : this.exitCode = 0;
|
|
3249
3424
|
}
|
|
3250
3425
|
}
|
|
3251
3426
|
async _fetchWasmBytes(e) {
|
|
3252
|
-
if (
|
|
3427
|
+
if (O.has(e)) return O.get(e);
|
|
3253
3428
|
let n = t.fetch || (typeof fetch == "function" ? fetch : null);
|
|
3254
3429
|
if (!n) throw Error("fetch is not available in this environment");
|
|
3255
3430
|
let r = await n(e);
|
|
3256
3431
|
if (!r || !r.ok) throw Error(`HTTP ${r ? r.status : "error"} fetching ${e}`);
|
|
3257
3432
|
let i = new Uint8Array(await r.arrayBuffer());
|
|
3258
|
-
return
|
|
3433
|
+
return O.set(e, i), i;
|
|
3259
3434
|
}
|
|
3260
3435
|
async _runRawWasmBytes(t, n) {
|
|
3261
|
-
let r = new
|
|
3436
|
+
let r = new T(i, n, this.context);
|
|
3262
3437
|
r.script = i, r.arguments = n, r.context = this.context, r.fs = this.fs, r._pkgMeta = e, this.stdin !== void 0 && (r.stdin = this.stdin), await r._runWasm(t);
|
|
3263
3438
|
for (let e of r.result.getStdOutput()) e.type === "out" ? this.stdOut = e.string : e.type === "err" && (this.stdErr = e.string);
|
|
3264
3439
|
this.exitCode = r.result.getExitCode();
|
|
@@ -3282,13 +3457,13 @@ var ee, R, z, B, V, H, U, W, G, K, te = e((() => {
|
|
|
3282
3457
|
let n = t && t !== "." && !e.startsWith("/") ? `${t.replace(/\/+$/, "")}/${e}` : e, r = this.fs.getFileByPath(n) ?? this.fs.getFileByPath(e);
|
|
3283
3458
|
return r == null ? null : typeof r == "string" ? r : new TextDecoder().decode(r);
|
|
3284
3459
|
},
|
|
3285
|
-
readBytes: (e) =>
|
|
3460
|
+
readBytes: (e) => k(this.fs, e),
|
|
3286
3461
|
writeFile: (e, t, n) => {
|
|
3287
3462
|
if (!this.fs) return;
|
|
3288
3463
|
let r = n && n !== "." && !e.startsWith("/") ? `${n.replace(/\/+$/, "")}/${e}` : e;
|
|
3289
3464
|
if (t instanceof Uint8Array || ArrayBuffer.isView(t)) {
|
|
3290
3465
|
let e = r.endsWith(".wasm") ? "application/wasm" : "application/octet-stream";
|
|
3291
|
-
|
|
3466
|
+
A(this.fs, r, t, e);
|
|
3292
3467
|
} else this.fs.setFileByPath(r, String(t), !0);
|
|
3293
3468
|
if (r.endsWith(".wasm") || r.endsWith(".wat")) try {
|
|
3294
3469
|
this.context && this.context.fs ? this.context.fs.setMode(r, 493) : this.fs.setMode(r, 493);
|
|
@@ -3324,7 +3499,7 @@ var ee, R, z, B, V, H, U, W, G, K, te = e((() => {
|
|
|
3324
3499
|
if (e && typeof e.status == "number") this.exitCode = e.status;
|
|
3325
3500
|
else throw e;
|
|
3326
3501
|
}
|
|
3327
|
-
if (d && typeof d == "object") if (r && (d.wasmBinary instanceof Uint8Array || d.HEAPU8 instanceof Uint8Array) && (this._inspectedWasm =
|
|
3502
|
+
if (d && typeof d == "object") if (r && (d.wasmBinary instanceof Uint8Array || d.HEAPU8 instanceof Uint8Array) && (this._inspectedWasm = N(d.wasmBinary || d.HEAPU8)), typeof d.callMain == "function") {
|
|
3328
3503
|
d.FS && c.size === 0 && (c = this._syncBrshToEmscriptenFs(d.FS, n));
|
|
3329
3504
|
try {
|
|
3330
3505
|
let e = await d.callMain(n);
|
|
@@ -3387,14 +3562,14 @@ var ee, R, z, B, V, H, U, W, G, K, te = e((() => {
|
|
|
3387
3562
|
}), !t.loaded && typeof t.load == "function" && await t.load(e.coreUrl ? { coreURL: e.coreUrl } : void 0);
|
|
3388
3563
|
let a = /* @__PURE__ */ new Set(), o = [];
|
|
3389
3564
|
for (let e of n) if (!e.startsWith("-") && (o.push(e), this.fs.exists(e))) {
|
|
3390
|
-
let n =
|
|
3565
|
+
let n = k(this.fs, e);
|
|
3391
3566
|
n && (await t.writeFile(e, n), a.add(e));
|
|
3392
3567
|
}
|
|
3393
3568
|
let s = await t.exec(n);
|
|
3394
3569
|
for (let e of o) if (!a.has(e)) try {
|
|
3395
3570
|
if (typeof t.readFile == "function") {
|
|
3396
3571
|
let n = await t.readFile(e);
|
|
3397
|
-
n &&
|
|
3572
|
+
n && A(this.fs, e, n);
|
|
3398
3573
|
}
|
|
3399
3574
|
} catch {}
|
|
3400
3575
|
typeof s == "number" && s !== 0 && (this.exitCode = s, i.length === 0 && r.length > 0 && i.push(...r.splice(0, r.length)));
|
|
@@ -3411,7 +3586,7 @@ var ee, R, z, B, V, H, U, W, G, K, te = e((() => {
|
|
|
3411
3586
|
let n = /* @__PURE__ */ new Set();
|
|
3412
3587
|
if (!this.fs || !e || typeof e.writeFile != "function") return n;
|
|
3413
3588
|
for (let r of t) if (!r.startsWith("-") && this.fs.exists(r)) {
|
|
3414
|
-
let t =
|
|
3589
|
+
let t = k(this.fs, r);
|
|
3415
3590
|
if (t) try {
|
|
3416
3591
|
e.writeFile(r, t), n.add(r);
|
|
3417
3592
|
} catch {}
|
|
@@ -3424,7 +3599,7 @@ var ee, R, z, B, V, H, U, W, G, K, te = e((() => {
|
|
|
3424
3599
|
let t = e.readFile(r);
|
|
3425
3600
|
if (t) {
|
|
3426
3601
|
let e = r.endsWith(".wasm") ? "application/wasm" : "application/octet-stream";
|
|
3427
|
-
if (
|
|
3602
|
+
if (A(this.fs, r, t, e), r.endsWith(".wasm") || r.endsWith(".wat")) try {
|
|
3428
3603
|
this.context && this.context.fs ? this.context.fs.setMode(r, 493) : this.fs.setMode(r, 493);
|
|
3429
3604
|
} catch {}
|
|
3430
3605
|
}
|
|
@@ -3434,9 +3609,9 @@ var ee, R, z, B, V, H, U, W, G, K, te = e((() => {
|
|
|
3434
3609
|
}
|
|
3435
3610
|
return a;
|
|
3436
3611
|
}
|
|
3437
|
-
|
|
3438
|
-
})),
|
|
3439
|
-
var n =
|
|
3612
|
+
T.readBytesFromFs = k, T.writeBytesToFs = A, T.loadModule = j, T.extractHelpFromText = M, T.inspectWasmBytes = N, T.formatWasmHelp = P, T.createGenericWasmCommand = F, T.createCommand = F, t.exports = T;
|
|
3613
|
+
})), ne = /* @__PURE__ */ t(((e, t) => {
|
|
3614
|
+
var n = J(), { createGenericWasmCommand: r } = Q(), i = "\x1B[2J\x1B[H", a = "\x1B[0m", o = "\x1B[7m", s = "\x1B[1m", c = "\x1B[2m", l = "\x1B[36m", u = "\x1B[31m", d = "\x1B[32m", f = class extends n {
|
|
3440
3615
|
get requiresFilesystem() {
|
|
3441
3616
|
return !0;
|
|
3442
3617
|
}
|
|
@@ -3705,7 +3880,7 @@ var ee, R, z, B, V, H, U, W, G, K, te = e((() => {
|
|
|
3705
3880
|
return s;
|
|
3706
3881
|
}
|
|
3707
3882
|
f.createReplWasmCommand = p, f.createCommand = p, t.exports = f;
|
|
3708
|
-
})),
|
|
3883
|
+
})), re = /* @__PURE__ */ t(((e, t) => {
|
|
3709
3884
|
var n = {
|
|
3710
3885
|
sqlite3: {
|
|
3711
3886
|
name: "sqlite3",
|
|
@@ -3925,7 +4100,7 @@ var ee, R, z, B, V, H, U, W, G, K, te = e((() => {
|
|
|
3925
4100
|
PACKAGE_ALIASES: r,
|
|
3926
4101
|
resolvePackageName: i
|
|
3927
4102
|
};
|
|
3928
|
-
})),
|
|
4103
|
+
})), ie = /* @__PURE__ */ t(((e, t) => {
|
|
3929
4104
|
function n(e, t, n = {}) {
|
|
3930
4105
|
let { showRowCount: r = !0 } = n;
|
|
3931
4106
|
if (!e || e.length === 0) return [];
|
|
@@ -3961,7 +4136,7 @@ var ee, R, z, B, V, H, U, W, G, K, te = e((() => {
|
|
|
3961
4136
|
}
|
|
3962
4137
|
return i;
|
|
3963
4138
|
}
|
|
3964
|
-
var { readBytesFromFs: a, writeBytesToFs: o, loadModule: s, extractHelpFromText: c, inspectWasmBytes: l, formatWasmHelp: u } =
|
|
4139
|
+
var { readBytesFromFs: a, writeBytesToFs: o, loadModule: s, extractHelpFromText: c, inspectWasmBytes: l, formatWasmHelp: u } = Q();
|
|
3965
4140
|
t.exports = {
|
|
3966
4141
|
formatTable: n,
|
|
3967
4142
|
formatPipeList: r,
|
|
@@ -3973,9 +4148,9 @@ var ee, R, z, B, V, H, U, W, G, K, te = e((() => {
|
|
|
3973
4148
|
inspectWasmBytes: l,
|
|
3974
4149
|
formatWasmHelp: u
|
|
3975
4150
|
};
|
|
3976
|
-
})),
|
|
4151
|
+
})), ae = /* @__PURE__ */ t(((e, t) => {
|
|
3977
4152
|
T();
|
|
3978
|
-
var n =
|
|
4153
|
+
var n = ne(), { readBytesFromFs: r, writeBytesToFs: i, loadModule: a } = ie(), o = {
|
|
3979
4154
|
smol: "https://huggingface.co/bartowski/SmolLM2-135M-Instruct-GGUF/resolve/main/SmolLM2-135M-Instruct-Q4_K_M.gguf",
|
|
3980
4155
|
smollm: "https://huggingface.co/bartowski/SmolLM2-135M-Instruct-GGUF/resolve/main/SmolLM2-135M-Instruct-Q4_K_M.gguf",
|
|
3981
4156
|
smollm2: "https://huggingface.co/bartowski/SmolLM2-135M-Instruct-GGUF/resolve/main/SmolLM2-135M-Instruct-Q4_K_M.gguf",
|
|
@@ -4868,9 +5043,9 @@ var ee, R, z, B, V, H, U, W, G, K, te = e((() => {
|
|
|
4868
5043
|
name: "wllama",
|
|
4869
5044
|
version: "3.8.1"
|
|
4870
5045
|
}), t.exports.wllamaInstances = u, t.exports.getDefaultPersistPath = d, t.exports.DEFAULT_PERSIST_DIR = l, t.exports.resolveModelSpec = h, t.exports.formatDownloadProgress = p, t.exports.DEFAULT_MODEL_URL = s, t.exports.MODEL_ALIASES = o;
|
|
4871
|
-
})),
|
|
5046
|
+
})), oe = /* @__PURE__ */ t(((e, t) => {
|
|
4872
5047
|
b();
|
|
4873
|
-
var r = E(), i =
|
|
5048
|
+
var r = E(), i = Q(), a = ne(), { DEFAULT_REGISTRY: o, resolvePackageName: s } = re(), c = ae(), { writeBytesToFs: l, createGenericWasmCommand: u } = i, { createReplWasmCommand: d } = a, f = "/var/lib/wbt/installed.json", p = "/var/cache/wbt";
|
|
4874
5049
|
function m(e, t, n = {}) {
|
|
4875
5050
|
class r extends i {
|
|
4876
5051
|
static get name() {
|
|
@@ -5252,7 +5427,7 @@ var ee, R, z, B, V, H, U, W, G, K, te = e((() => {
|
|
|
5252
5427
|
return null;
|
|
5253
5428
|
}
|
|
5254
5429
|
async _pullPackageWasm(e, t = !1, n = !1) {
|
|
5255
|
-
let r = this.constructor._config || {}, i = r.fetch || (typeof fetch == "function" ? fetch : null), { loadModule: a } =
|
|
5430
|
+
let r = this.constructor._config || {}, i = r.fetch || (typeof fetch == "function" ? fetch : null), { loadModule: a } = ie(), o = null, s = null, c = e.wasmUrl || (/\.(wasm|wat)(\?.*)?$/i.test(e.cdnUrl || "") ? e.cdnUrl : null);
|
|
5256
5431
|
if (c && i) try {
|
|
5257
5432
|
let n = await i(c);
|
|
5258
5433
|
n && n.ok ? o = await this._readResponseBytes(n, `${e.name}.wasm`, t) : s = /* @__PURE__ */ Error(`HTTP ${n ? n.status : "error"} fetching ${c}`);
|
|
@@ -5560,6 +5735,6 @@ var ee, R, z, B, V, H, U, W, G, K, te = e((() => {
|
|
|
5560
5735
|
t.exports = h, t.exports.Wbt = h, t.exports.DEFAULT_REGISTRY = o, t.exports.createGenericWasmCommand = u, t.exports.createReplWasmCommand = d;
|
|
5561
5736
|
}));
|
|
5562
5737
|
//#endregion
|
|
5563
|
-
export default
|
|
5738
|
+
export default oe();
|
|
5564
5739
|
|
|
5565
5740
|
//# sourceMappingURL=wbt.es.js.map
|