brsh 3.6.2 → 3.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/Readme.md +128 -0
- package/dist/shell.es.js +614 -453
- 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/terminal.cjs.js +5 -5
- package/dist/terminal.cjs.js.map +1 -1
- package/dist/terminal.es.js +167 -86
- package/dist/terminal.es.js.map +1 -1
- package/dist/terminal.min.js +5 -5
- package/dist/terminal.min.js.map +1 -1
- package/dist/wbt.es.js +607 -446
- package/dist/wbt.es.js.map +1 -1
- package/dist/wbt.min.js +10 -10
- package/dist/wbt.min.js.map +1 -1
- package/lib/Readme.md +23 -1
- package/lib/WasmCommand.js +370 -36
- package/lib/terminal/ScreenBuffer.js +201 -18
- package/package.json +1 -1
- package/test/terminal.test.js +70 -0
- package/test/wasm-cli.test.js +64 -0
- package/test/wbt.test.js +4 -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() {
|
|
@@ -1664,79 +1664,79 @@ function j() {
|
|
|
1664
1664
|
throw Error("clearTimeout has not been defined");
|
|
1665
1665
|
}
|
|
1666
1666
|
function M(e) {
|
|
1667
|
-
if (
|
|
1668
|
-
if ((
|
|
1667
|
+
if (B === setTimeout) return setTimeout(e, 0);
|
|
1668
|
+
if ((B === A || !B) && setTimeout) return B = setTimeout, setTimeout(e, 0);
|
|
1669
1669
|
try {
|
|
1670
|
-
return
|
|
1670
|
+
return B(e, 0);
|
|
1671
1671
|
} catch {
|
|
1672
1672
|
try {
|
|
1673
|
-
return
|
|
1673
|
+
return B.call(null, e, 0);
|
|
1674
1674
|
} catch {
|
|
1675
|
-
return
|
|
1675
|
+
return B.call(this, e, 0);
|
|
1676
1676
|
}
|
|
1677
1677
|
}
|
|
1678
1678
|
}
|
|
1679
1679
|
function N(e) {
|
|
1680
|
-
if (
|
|
1681
|
-
if ((
|
|
1680
|
+
if (V === clearTimeout) return clearTimeout(e);
|
|
1681
|
+
if ((V === j || !V) && clearTimeout) return V = clearTimeout, clearTimeout(e);
|
|
1682
1682
|
try {
|
|
1683
|
-
return
|
|
1683
|
+
return V(e);
|
|
1684
1684
|
} catch {
|
|
1685
1685
|
try {
|
|
1686
|
-
return
|
|
1686
|
+
return V.call(null, e);
|
|
1687
1687
|
} catch {
|
|
1688
|
-
return
|
|
1688
|
+
return V.call(this, e);
|
|
1689
1689
|
}
|
|
1690
1690
|
}
|
|
1691
1691
|
}
|
|
1692
1692
|
function P() {
|
|
1693
|
-
!
|
|
1693
|
+
!U || !W || (U = !1, W.length ? H = W.concat(H) : G = -1, H.length && F());
|
|
1694
1694
|
}
|
|
1695
1695
|
function F() {
|
|
1696
|
-
if (!
|
|
1696
|
+
if (!U) {
|
|
1697
1697
|
var e = M(P);
|
|
1698
|
-
|
|
1699
|
-
for (var t =
|
|
1700
|
-
for (
|
|
1701
|
-
|
|
1698
|
+
U = !0;
|
|
1699
|
+
for (var t = H.length; t;) {
|
|
1700
|
+
for (W = H, H = []; ++G < t;) W && W[G].run();
|
|
1701
|
+
G = -1, t = H.length;
|
|
1702
1702
|
}
|
|
1703
|
-
|
|
1703
|
+
W = null, U = !1, N(e);
|
|
1704
1704
|
}
|
|
1705
1705
|
}
|
|
1706
1706
|
function I(e, t) {
|
|
1707
1707
|
this.fun = e, this.array = t;
|
|
1708
1708
|
}
|
|
1709
1709
|
function L() {}
|
|
1710
|
-
var
|
|
1711
|
-
|
|
1710
|
+
var R, z, B, V, H, U, W, G, ee, K, q = e((() => {
|
|
1711
|
+
R = { exports: {} }, z = R.exports = {}, (function() {
|
|
1712
1712
|
try {
|
|
1713
|
-
|
|
1713
|
+
B = typeof setTimeout == "function" ? setTimeout : A;
|
|
1714
1714
|
} catch {
|
|
1715
|
-
|
|
1715
|
+
B = A;
|
|
1716
1716
|
}
|
|
1717
1717
|
try {
|
|
1718
|
-
|
|
1718
|
+
V = typeof clearTimeout == "function" ? clearTimeout : j;
|
|
1719
1719
|
} catch {
|
|
1720
|
-
|
|
1720
|
+
V = j;
|
|
1721
1721
|
}
|
|
1722
|
-
})(),
|
|
1722
|
+
})(), H = [], U = !1, G = -1, z.nextTick = function(e) {
|
|
1723
1723
|
var t = Array(arguments.length - 1);
|
|
1724
1724
|
if (arguments.length > 1) for (var n = 1; n < arguments.length; n++) t[n - 1] = arguments[n];
|
|
1725
|
-
|
|
1725
|
+
H.push(new I(e, t)), H.length === 1 && !U && M(F);
|
|
1726
1726
|
}, I.prototype.run = function() {
|
|
1727
1727
|
this.fun.apply(null, this.array);
|
|
1728
|
-
},
|
|
1728
|
+
}, 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
1729
|
return [];
|
|
1730
|
-
},
|
|
1730
|
+
}, z.binding = function(e) {
|
|
1731
1731
|
throw Error("process.binding is not supported");
|
|
1732
|
-
},
|
|
1732
|
+
}, z.cwd = function() {
|
|
1733
1733
|
return "/";
|
|
1734
|
-
},
|
|
1734
|
+
}, z.chdir = function(e) {
|
|
1735
1735
|
throw Error("process.chdir is not supported");
|
|
1736
|
-
},
|
|
1736
|
+
}, z.umask = function() {
|
|
1737
1737
|
return 0;
|
|
1738
|
-
},
|
|
1739
|
-
})),
|
|
1738
|
+
}, ee = R.exports, K = /* @__PURE__ */ k(ee);
|
|
1739
|
+
})), J = /* @__PURE__ */ t(((e, t) => {
|
|
1740
1740
|
var n = T();
|
|
1741
1741
|
t.exports = class extends n {
|
|
1742
1742
|
get captureInput() {
|
|
@@ -1766,8 +1766,8 @@ var ee, R, z, B, V, H, U, W, G, K, te = e((() => {
|
|
|
1766
1766
|
});
|
|
1767
1767
|
}
|
|
1768
1768
|
};
|
|
1769
|
-
})),
|
|
1770
|
-
b(),
|
|
1769
|
+
})), Y = /* @__PURE__ */ t(((e, t) => {
|
|
1770
|
+
b(), q();
|
|
1771
1771
|
var { BinaryFile: n, SymlinkRef: r } = O(), i = new Uint8Array([
|
|
1772
1772
|
66,
|
|
1773
1773
|
82,
|
|
@@ -1872,7 +1872,7 @@ var ee, R, z, B, V, H, U, W, G, K, te = e((() => {
|
|
|
1872
1872
|
let t = e.$c;
|
|
1873
1873
|
if (m[t]) return m[t];
|
|
1874
1874
|
if (f.inlineCommands && f.inlineCommands[t]) try {
|
|
1875
|
-
let e = T(), n =
|
|
1875
|
+
let e = T(), n = J();
|
|
1876
1876
|
return Function("Command", "InteractiveCommand", `return (${f.inlineCommands[t]});`)(e, n);
|
|
1877
1877
|
} catch {
|
|
1878
1878
|
return null;
|
|
@@ -2037,7 +2037,7 @@ var ee, R, z, B, V, H, U, W, G, K, te = e((() => {
|
|
|
2037
2037
|
}
|
|
2038
2038
|
}
|
|
2039
2039
|
};
|
|
2040
|
-
})),
|
|
2040
|
+
})), X = /* @__PURE__ */ t(((e, t) => {
|
|
2041
2041
|
b();
|
|
2042
2042
|
var n = O(), { BinaryFile: r, SymlinkRef: i } = n;
|
|
2043
2043
|
function a(e) {
|
|
@@ -2062,20 +2062,20 @@ var ee, R, z, B, V, H, U, W, G, K, te = e((() => {
|
|
|
2062
2062
|
t.exports = class extends n {
|
|
2063
2063
|
constructor(e = "/", t = {}, n = {}, r = null) {
|
|
2064
2064
|
if (super(), t instanceof Uint8Array || t instanceof ArrayBuffer) {
|
|
2065
|
-
let { deserializeBinaryFilesystem: e } =
|
|
2065
|
+
let { deserializeBinaryFilesystem: e } = Y(), r = e(t);
|
|
2066
2066
|
t = r.filesystem, n = Object.assign({}, r.permissions, n);
|
|
2067
2067
|
} 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 } =
|
|
2068
|
+
let { deserializeBinaryFilesystem: e } = Y(), r = e(t);
|
|
2069
2069
|
t = r.filesystem, n = Object.assign({}, r.permissions, n);
|
|
2070
2070
|
}
|
|
2071
2071
|
a(t), this.fileSystem = t, this.permissions = Object.assign({}, n), this.cwd = e.endsWith("/") ? e : e + "/", this._onChange = r, this._changeScheduled = !1;
|
|
2072
2072
|
}
|
|
2073
2073
|
toBinaryContainer(e = {}) {
|
|
2074
|
-
let { serializeBinaryFilesystem: t } =
|
|
2074
|
+
let { serializeBinaryFilesystem: t } = Y();
|
|
2075
2075
|
return t(this.fileSystem, this.permissions, e);
|
|
2076
2076
|
}
|
|
2077
2077
|
static fromBinaryContainer(e, t = {}) {
|
|
2078
|
-
let { deserializeBinaryFilesystem: n } =
|
|
2078
|
+
let { deserializeBinaryFilesystem: n } = Y();
|
|
2079
2079
|
return n(e, t);
|
|
2080
2080
|
}
|
|
2081
2081
|
getFileByPath(e) {
|
|
@@ -2253,10 +2253,10 @@ var ee, R, z, B, V, H, U, W, G, K, te = e((() => {
|
|
|
2253
2253
|
return null;
|
|
2254
2254
|
}
|
|
2255
2255
|
}, t.exports.BinaryFile = r, t.exports.SymlinkRef = i;
|
|
2256
|
-
})),
|
|
2256
|
+
})), Z = /* @__PURE__ */ t(((e, t) => {
|
|
2257
2257
|
t.exports = null;
|
|
2258
|
-
})),
|
|
2259
|
-
|
|
2258
|
+
})), te = /* @__PURE__ */ t(((e, t) => {
|
|
2259
|
+
q();
|
|
2260
2260
|
function n(e) {
|
|
2261
2261
|
if (typeof e != "string") throw TypeError("Path must be a string. Received " + JSON.stringify(e));
|
|
2262
2262
|
}
|
|
@@ -2423,9 +2423,9 @@ var ee, R, z, B, V, H, U, W, G, K, te = e((() => {
|
|
|
2423
2423
|
posix: null
|
|
2424
2424
|
};
|
|
2425
2425
|
a.posix = a, t.exports = a;
|
|
2426
|
-
})),
|
|
2426
|
+
})), Q = /* @__PURE__ */ t(((e, t) => {
|
|
2427
2427
|
b();
|
|
2428
|
-
var n = D(), { BinaryFile: r } =
|
|
2428
|
+
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
2429
|
get name() {
|
|
2430
2430
|
return "wasm";
|
|
2431
2431
|
}
|
|
@@ -2492,7 +2492,7 @@ var ee, R, z, B, V, H, U, W, G, K, te = e((() => {
|
|
|
2492
2492
|
run() {
|
|
2493
2493
|
let e = this.script, t = (() => {
|
|
2494
2494
|
try {
|
|
2495
|
-
return
|
|
2495
|
+
return Z();
|
|
2496
2496
|
} catch {
|
|
2497
2497
|
return null;
|
|
2498
2498
|
}
|
|
@@ -2560,8 +2560,10 @@ var ee, R, z, B, V, H, U, W, G, K, te = e((() => {
|
|
|
2560
2560
|
let t = {
|
|
2561
2561
|
1: "",
|
|
2562
2562
|
2: ""
|
|
2563
|
-
}, n = new TextDecoder(), b = new TextEncoder(),
|
|
2564
|
-
|
|
2563
|
+
}, 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 = () => {
|
|
2564
|
+
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));
|
|
2565
|
+
}, R = (e, n) => {
|
|
2566
|
+
if (I && (e === 1 || e === 2)) {
|
|
2565
2567
|
if (e === 1 && this.stdout) {
|
|
2566
2568
|
this.stdout.write(n);
|
|
2567
2569
|
return;
|
|
@@ -2575,57 +2577,61 @@ var ee, R, z, B, V, H, U, W, G, K, te = e((() => {
|
|
|
2575
2577
|
let r = t[e].split("\n");
|
|
2576
2578
|
t[e] = r.pop();
|
|
2577
2579
|
for (let t of r) e === 1 ? this.stdOut = t : this.stdErr = t;
|
|
2578
|
-
},
|
|
2579
|
-
t[1] &&= (
|
|
2580
|
-
},
|
|
2580
|
+
}, z = () => {
|
|
2581
|
+
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], "");
|
|
2582
|
+
}, B = [], V = (e) => {
|
|
2581
2583
|
if (!(!e || e.length === 0)) {
|
|
2582
|
-
for (let t = 0; t < e.length; t++)
|
|
2583
|
-
if (
|
|
2584
|
-
let e =
|
|
2585
|
-
|
|
2584
|
+
for (let t = 0; t < e.length; t++) B.push(e[t]);
|
|
2585
|
+
if (A) {
|
|
2586
|
+
let e = A;
|
|
2587
|
+
A = null, e();
|
|
2586
2588
|
}
|
|
2587
2589
|
}
|
|
2588
2590
|
};
|
|
2589
|
-
|
|
2591
|
+
M = (e) => {
|
|
2590
2592
|
this._handlingStreamData = !0;
|
|
2591
2593
|
try {
|
|
2592
|
-
|
|
2594
|
+
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
2595
|
} finally {
|
|
2594
2596
|
this._handlingStreamData = !1;
|
|
2595
2597
|
}
|
|
2596
2598
|
}, this._externalKeyHandler = (e) => {
|
|
2597
2599
|
if (this._handlingStreamData) return;
|
|
2598
2600
|
let t = this._keyToBytes(e);
|
|
2599
|
-
t &&
|
|
2600
|
-
},
|
|
2601
|
-
let
|
|
2601
|
+
t && V(t);
|
|
2602
|
+
}, 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);
|
|
2603
|
+
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
2604
|
type: "preopen",
|
|
2603
2605
|
path: "/",
|
|
2604
2606
|
guestName: "/"
|
|
2605
2607
|
}], [4, {
|
|
2606
2608
|
type: "preopen",
|
|
2607
|
-
path:
|
|
2609
|
+
path: ee,
|
|
2608
2610
|
guestName: "."
|
|
2609
|
-
}]]),
|
|
2611
|
+
}]]), J = new Map([
|
|
2612
|
+
[0, 0],
|
|
2613
|
+
[1, 0],
|
|
2614
|
+
[2, 0]
|
|
2615
|
+
]), Y = (e) => {
|
|
2610
2616
|
let t = e.split("/").filter(Boolean);
|
|
2611
2617
|
return t.pop(), "/" + t.join("/");
|
|
2612
|
-
},
|
|
2613
|
-
let n =
|
|
2618
|
+
}, X = (e, t) => {
|
|
2619
|
+
let n = q.get(e);
|
|
2614
2620
|
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 =
|
|
2621
|
+
if (t.startsWith("/")) return W.absolutePath(t);
|
|
2622
|
+
if (!t || t === ".") return W.absolutePath(n.path);
|
|
2623
|
+
let r = n.path.endsWith("/") ? n.path : n.path + "/", i = W.absolutePath(r + t), a = W.absolutePath("/" + t);
|
|
2618
2624
|
if (n.path !== "/") {
|
|
2619
|
-
if (
|
|
2620
|
-
if (
|
|
2621
|
-
let e =
|
|
2622
|
-
return
|
|
2625
|
+
if (W.exists(i)) return i;
|
|
2626
|
+
if (W.exists(a)) return a;
|
|
2627
|
+
let e = W.exists(Y(i));
|
|
2628
|
+
return W.exists(Y(a)) && !e ? a : i;
|
|
2623
2629
|
}
|
|
2624
|
-
if (
|
|
2625
|
-
let o =
|
|
2626
|
-
return
|
|
2627
|
-
},
|
|
2628
|
-
if (!(!e || e.type !== "file" || !e.dirty || !
|
|
2630
|
+
if (W.exists(i)) return i;
|
|
2631
|
+
let o = W.absolutePath(t);
|
|
2632
|
+
return W.exists(o) ? o : i;
|
|
2633
|
+
}, Z = (e) => {
|
|
2634
|
+
if (!(!e || e.type !== "file" || !e.dirty || !W)) try {
|
|
2629
2635
|
let t = !0;
|
|
2630
2636
|
for (let n = 0; n < e.bytes.length; n++) if (e.bytes[n] === 0) {
|
|
2631
2637
|
t = !1;
|
|
@@ -2633,10 +2639,10 @@ var ee, R, z, B, V, H, U, W, G, K, te = e((() => {
|
|
|
2633
2639
|
}
|
|
2634
2640
|
if (t) {
|
|
2635
2641
|
let t = n.decode(e.bytes);
|
|
2636
|
-
|
|
2642
|
+
W.setFileByPath(e.path, t, !0);
|
|
2637
2643
|
} else {
|
|
2638
2644
|
let t = new Uint8Array(e.bytes.length);
|
|
2639
|
-
t.set(e.bytes),
|
|
2645
|
+
t.set(e.bytes), W.setFileByPath(e.path, new r(t.buffer, "application/octet-stream"), !0);
|
|
2640
2646
|
}
|
|
2641
2647
|
e.dirty = !1;
|
|
2642
2648
|
} catch {}
|
|
@@ -2646,25 +2652,39 @@ var ee, R, z, B, V, H, U, W, G, K, te = e((() => {
|
|
|
2646
2652
|
COLUMNS: String(this.stdout && this.stdout.columns || this.context && typeof this.context.getVar == "function" && this.context.getVar("COLUMNS") || 80),
|
|
2647
2653
|
LINES: String(this.stdout && this.stdout.rows || this.context && typeof this.context.getVar == "function" && this.context.getVar("LINES") || 24),
|
|
2648
2654
|
...this.context && this.context.vars || {}
|
|
2649
|
-
},
|
|
2650
|
-
fd_write: (e, t, r,
|
|
2651
|
-
if (!
|
|
2652
|
-
let s = new DataView(
|
|
2655
|
+
}, Q = Object.entries(te).map(([e, t]) => `${e}=${t}`), ne = new Proxy({
|
|
2656
|
+
fd_write: (e, t, r, a) => {
|
|
2657
|
+
if (!T) return o;
|
|
2658
|
+
let s = new DataView(T.buffer);
|
|
2653
2659
|
if (e === 1 || e === 2) {
|
|
2654
|
-
let
|
|
2660
|
+
let o = 0;
|
|
2661
|
+
for (let i = 0; i < r; i++) {
|
|
2662
|
+
let r = s.getUint32(t + i * 8, !0), a = s.getUint32(t + i * 8 + 4, !0);
|
|
2663
|
+
a > 0 && R(e, n.decode(new Uint8Array(T.buffer, r, a))), o += a;
|
|
2664
|
+
}
|
|
2665
|
+
return s.setUint32(a, o, !0), i;
|
|
2666
|
+
}
|
|
2667
|
+
let c = q.get(e);
|
|
2668
|
+
if (!c) return o;
|
|
2669
|
+
if (c.type === "dev_null" || c.type === "dev_zero") {
|
|
2670
|
+
let e = 0;
|
|
2671
|
+
for (let n = 0; n < r; n++) e += s.getUint32(t + n * 8 + 4, !0);
|
|
2672
|
+
return s.setUint32(a, e, !0), i;
|
|
2673
|
+
}
|
|
2674
|
+
if (c.type === "dev_tty") {
|
|
2675
|
+
let e = 0;
|
|
2655
2676
|
for (let i = 0; i < r; i++) {
|
|
2656
|
-
let r = s.getUint32(t + i * 8, !0),
|
|
2657
|
-
|
|
2677
|
+
let r = s.getUint32(t + i * 8, !0), a = s.getUint32(t + i * 8 + 4, !0);
|
|
2678
|
+
a > 0 && R(1, n.decode(new Uint8Array(T.buffer, r, a))), e += a;
|
|
2658
2679
|
}
|
|
2659
|
-
return s.setUint32(
|
|
2680
|
+
return s.setUint32(a, e, !0), i;
|
|
2660
2681
|
}
|
|
2661
|
-
|
|
2662
|
-
if (!c || c.type !== "file") return a;
|
|
2682
|
+
if (c.type !== "file") return o;
|
|
2663
2683
|
let l = 0;
|
|
2664
2684
|
for (let e = 0; e < r; e++) {
|
|
2665
2685
|
let n = s.getUint32(t + e * 8, !0), r = s.getUint32(t + e * 8 + 4, !0);
|
|
2666
2686
|
if (r > 0) {
|
|
2667
|
-
let e = new Uint8Array(
|
|
2687
|
+
let e = new Uint8Array(T.buffer, n, r), t = c.append ? c.bytes.length : c.pos, i = t + r;
|
|
2668
2688
|
if (i > c.bytes.length) {
|
|
2669
2689
|
let e = new Uint8Array(i);
|
|
2670
2690
|
e.set(c.bytes), c.bytes = e;
|
|
@@ -2672,202 +2692,277 @@ var ee, R, z, B, V, H, U, W, G, K, te = e((() => {
|
|
|
2672
2692
|
c.bytes.set(e, t), c.pos = t + r, c.dirty = !0, l += r;
|
|
2673
2693
|
}
|
|
2674
2694
|
}
|
|
2675
|
-
return s.setUint32(
|
|
2695
|
+
return s.setUint32(a, l, !0), i;
|
|
2676
2696
|
},
|
|
2677
2697
|
fd_read: (e, t, n, r) => {
|
|
2678
|
-
if (!
|
|
2679
|
-
let
|
|
2680
|
-
if (e === 0) {
|
|
2681
|
-
|
|
2682
|
-
|
|
2683
|
-
|
|
2698
|
+
if (!T) return o;
|
|
2699
|
+
let s = new DataView(T.buffer), c = q.get(e), l = !!(c && c.type === "dev_tty");
|
|
2700
|
+
if (e === 0 || I && e === 2 || l) {
|
|
2701
|
+
(l || e === 2) && L();
|
|
2702
|
+
let o = !!((J.get(e) || 0) & w);
|
|
2703
|
+
if (D) {
|
|
2704
|
+
if ((typeof E?.exports?.asyncify_get_state == "function" ? E.exports.asyncify_get_state() : 0) === 2) {
|
|
2705
|
+
E.exports.asyncify_stop_rewind();
|
|
2684
2706
|
let e = 0;
|
|
2685
|
-
for (let r = 0; r < n &&
|
|
2686
|
-
let n =
|
|
2687
|
-
new Uint8Array(
|
|
2707
|
+
for (let r = 0; r < n && B.length > 0; r++) {
|
|
2708
|
+
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);
|
|
2709
|
+
new Uint8Array(T.buffer).set(o, n), e += a;
|
|
2688
2710
|
}
|
|
2689
|
-
return
|
|
2711
|
+
return s.setUint32(r, e, !0), i;
|
|
2690
2712
|
}
|
|
2691
|
-
if (
|
|
2713
|
+
if (B.length > 0) {
|
|
2692
2714
|
let e = 0;
|
|
2693
|
-
for (let r = 0; r < n &&
|
|
2694
|
-
let n =
|
|
2695
|
-
new Uint8Array(
|
|
2715
|
+
for (let r = 0; r < n && B.length > 0; r++) {
|
|
2716
|
+
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);
|
|
2717
|
+
new Uint8Array(T.buffer).set(o, n), e += a;
|
|
2696
2718
|
}
|
|
2697
|
-
return
|
|
2719
|
+
return s.setUint32(r, e, !0), i;
|
|
2698
2720
|
}
|
|
2699
|
-
return
|
|
2700
|
-
|
|
2701
|
-
}),
|
|
2721
|
+
return o ? (s.setUint32(r, 0, !0), a) : (E.exports.asyncify_start_unwind(O), k = new Promise((e) => {
|
|
2722
|
+
A = e;
|
|
2723
|
+
}), s.setUint32(r, 0, !0), i);
|
|
2724
|
+
}
|
|
2725
|
+
if (B.length > 0) {
|
|
2726
|
+
let e = 0;
|
|
2727
|
+
for (let r = 0; r < n && B.length > 0; r++) {
|
|
2728
|
+
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);
|
|
2729
|
+
new Uint8Array(T.buffer).set(o, n), e += a;
|
|
2730
|
+
}
|
|
2731
|
+
return s.setUint32(r, e, !0), i;
|
|
2732
|
+
}
|
|
2733
|
+
let c = 0;
|
|
2734
|
+
for (let e = 0; e < n && U < H.length; e++) {
|
|
2735
|
+
let n = s.getUint32(t + e * 8, !0), r = s.getUint32(t + e * 8 + 4, !0), i = Math.min(r, H.length - U);
|
|
2736
|
+
new Uint8Array(T.buffer).set(H.slice(U, U + i), n), U += i, c += i;
|
|
2737
|
+
}
|
|
2738
|
+
return c === 0 && o && U >= H.length ? (s.setUint32(r, 0, !0), a) : (s.setUint32(r, c, !0), i);
|
|
2739
|
+
}
|
|
2740
|
+
if (!c) return o;
|
|
2741
|
+
if (c.type === "dev_null") return s.setUint32(r, 0, !0), i;
|
|
2742
|
+
if (c.type === "dev_zero") {
|
|
2743
|
+
let e = 0;
|
|
2744
|
+
for (let r = 0; r < n; r++) {
|
|
2745
|
+
let n = s.getUint32(t + r * 8, !0), i = s.getUint32(t + r * 8 + 4, !0);
|
|
2746
|
+
new Uint8Array(T.buffer, n, i).fill(0), e += i;
|
|
2702
2747
|
}
|
|
2748
|
+
return s.setUint32(r, e, !0), i;
|
|
2749
|
+
}
|
|
2750
|
+
if (c.type === "dev_urandom") {
|
|
2703
2751
|
let e = 0;
|
|
2704
|
-
for (let r = 0; r < n
|
|
2705
|
-
let n =
|
|
2706
|
-
|
|
2752
|
+
for (let r = 0; r < n; r++) {
|
|
2753
|
+
let n = s.getUint32(t + r * 8, !0), i = s.getUint32(t + r * 8 + 4, !0), a = new Uint8Array(T.buffer, n, i);
|
|
2754
|
+
if (typeof crypto < "u" && crypto.getRandomValues) crypto.getRandomValues(a);
|
|
2755
|
+
else for (let e = 0; e < i; e++) a[e] = Math.floor(Math.random() * 256);
|
|
2756
|
+
e += i;
|
|
2707
2757
|
}
|
|
2708
|
-
return
|
|
2758
|
+
return s.setUint32(r, e, !0), i;
|
|
2709
2759
|
}
|
|
2710
|
-
|
|
2711
|
-
|
|
2712
|
-
let
|
|
2713
|
-
|
|
2714
|
-
|
|
2715
|
-
new Uint8Array(C.buffer).set(s.bytes.subarray(s.pos, s.pos + i), n), s.pos += i, c += i;
|
|
2760
|
+
if (c.type !== "file") return o;
|
|
2761
|
+
let u = 0;
|
|
2762
|
+
for (let e = 0; e < n && c.pos < c.bytes.length; e++) {
|
|
2763
|
+
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);
|
|
2764
|
+
new Uint8Array(T.buffer).set(c.bytes.subarray(c.pos, c.pos + i), n), c.pos += i, u += i;
|
|
2716
2765
|
}
|
|
2717
|
-
return
|
|
2766
|
+
return s.setUint32(r, u, !0), i;
|
|
2718
2767
|
},
|
|
2719
|
-
fd_seek: (e, t, n, r,
|
|
2720
|
-
if (!
|
|
2721
|
-
if (e <= 2) return
|
|
2722
|
-
let
|
|
2723
|
-
if (!
|
|
2724
|
-
|
|
2725
|
-
|
|
2726
|
-
let
|
|
2768
|
+
fd_seek: (e, t, n, r, a) => {
|
|
2769
|
+
if (!T) return o;
|
|
2770
|
+
if (e <= 2) return f;
|
|
2771
|
+
let s = q.get(e);
|
|
2772
|
+
if (!s) return o;
|
|
2773
|
+
if (s.type === "dev_tty" || s.type === "dev_null" || s.type === "dev_zero" || s.type === "dev_urandom") return f;
|
|
2774
|
+
if (s.type !== "file") return o;
|
|
2775
|
+
let l, u, d;
|
|
2776
|
+
typeof t == "bigint" ? (l = Number(t), u = n, d = r) : (l = t, u = r, d = a);
|
|
2777
|
+
let p = s.pos;
|
|
2727
2778
|
if (u === 0) p = l;
|
|
2728
|
-
else if (u === 1) p =
|
|
2729
|
-
else if (u === 2) p =
|
|
2730
|
-
else return
|
|
2731
|
-
return p < 0 ?
|
|
2779
|
+
else if (u === 1) p = s.pos + l;
|
|
2780
|
+
else if (u === 2) p = s.bytes.length + l;
|
|
2781
|
+
else return c;
|
|
2782
|
+
return p < 0 ? c : (s.pos = p, d && new DataView(T.buffer).setBigUint64(d, BigInt(s.pos), !0), i);
|
|
2732
2783
|
},
|
|
2733
2784
|
fd_tell: (e, t) => {
|
|
2734
|
-
if (!
|
|
2735
|
-
let n =
|
|
2736
|
-
return !n || n.type !== "file" ?
|
|
2785
|
+
if (!T) return o;
|
|
2786
|
+
let n = q.get(e);
|
|
2787
|
+
return !n || n.type !== "file" ? o : (new DataView(T.buffer).setBigUint64(t, BigInt(n.pos), !0), i);
|
|
2737
2788
|
},
|
|
2738
2789
|
fd_close: (e) => {
|
|
2739
2790
|
if (e <= 2) return i;
|
|
2740
|
-
let t =
|
|
2741
|
-
return t ? (
|
|
2791
|
+
let t = q.get(e);
|
|
2792
|
+
return t ? (t.type === "file" && Z(t), q.delete(e), J.delete(e), i) : o;
|
|
2742
2793
|
},
|
|
2743
2794
|
fd_sync: (e) => {
|
|
2744
|
-
let t =
|
|
2745
|
-
return t &&
|
|
2795
|
+
let t = q.get(e);
|
|
2796
|
+
return t && Z(t), i;
|
|
2746
2797
|
},
|
|
2747
2798
|
fd_datasync: (e) => {
|
|
2748
|
-
let t =
|
|
2749
|
-
return t &&
|
|
2799
|
+
let t = q.get(e);
|
|
2800
|
+
return t && Z(t), i;
|
|
2750
2801
|
},
|
|
2751
2802
|
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,
|
|
2803
|
+
if (!T) return o;
|
|
2804
|
+
let n = q.get(e);
|
|
2805
|
+
if (!n || n.type !== "preopen") return o;
|
|
2806
|
+
let r = new DataView(T.buffer), a = b.encode(n.guestName);
|
|
2807
|
+
return r.setUint8(t, 0), r.setUint32(t + 4, a.length, !0), i;
|
|
2757
2808
|
},
|
|
2758
2809
|
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(
|
|
2810
|
+
if (!T) return o;
|
|
2811
|
+
let r = q.get(e);
|
|
2812
|
+
if (!r || r.type !== "preopen") return o;
|
|
2813
|
+
let a = b.encode(r.guestName);
|
|
2814
|
+
return new Uint8Array(T.buffer, t, Math.min(n, a.length)).set(a.subarray(0, n)), i;
|
|
2764
2815
|
},
|
|
2765
2816
|
fd_fdstat_get: (e, t) => {
|
|
2766
|
-
if (!
|
|
2767
|
-
let n = new DataView(
|
|
2768
|
-
if (e <= 2) r =
|
|
2817
|
+
if (!T) return o;
|
|
2818
|
+
let n = new DataView(T.buffer), r = p;
|
|
2819
|
+
if (e <= 2) r = m;
|
|
2769
2820
|
else {
|
|
2770
|
-
let t =
|
|
2771
|
-
if (!t) return
|
|
2772
|
-
r = t.type === "preopen" || t.type === "dir" ?
|
|
2821
|
+
let t = q.get(e);
|
|
2822
|
+
if (!t) return o;
|
|
2823
|
+
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
2824
|
}
|
|
2774
2825
|
for (let e = 0; e < 24; e++) n.setUint8(t + e, 0);
|
|
2775
|
-
|
|
2826
|
+
n.setUint8(t, r);
|
|
2827
|
+
let a = J.get(e) || (q.get(e)?.append ? C : 0);
|
|
2828
|
+
return n.setUint16(t + 2, a, !0), n.setBigUint64(t + 8, 18446744073709551615n, !0), n.setBigUint64(t + 16, 18446744073709551615n, !0), i;
|
|
2829
|
+
},
|
|
2830
|
+
fd_fdstat_set_flags: (e, t) => {
|
|
2831
|
+
if (!T || e > 2 && !q.has(e)) return o;
|
|
2832
|
+
J.set(e, t);
|
|
2833
|
+
let n = q.get(e);
|
|
2834
|
+
return n && (n.append = !!(t & C)), (e === 0 || e === 2 || n && n.type === "dev_tty") && t & w && L(), i;
|
|
2776
2835
|
},
|
|
2777
|
-
fd_fdstat_set_flags: () => i,
|
|
2778
2836
|
fd_filestat_get: (e, t) => {
|
|
2779
|
-
if (!
|
|
2780
|
-
let n = new DataView(
|
|
2837
|
+
if (!T) return o;
|
|
2838
|
+
let n = new DataView(T.buffer);
|
|
2781
2839
|
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
|
-
|
|
2840
|
+
if (e <= 2) return n.setUint8(t + 16, m), i;
|
|
2841
|
+
let r = q.get(e);
|
|
2842
|
+
if (!r) return o;
|
|
2843
|
+
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;
|
|
2844
|
+
let a = r.type === "preopen" || r.type === "dir";
|
|
2845
|
+
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
2846
|
},
|
|
2788
|
-
path_open: (e, t, r,
|
|
2789
|
-
if (!
|
|
2790
|
-
let
|
|
2791
|
-
if (!
|
|
2792
|
-
let
|
|
2793
|
-
if (
|
|
2794
|
-
|
|
2795
|
-
|
|
2796
|
-
|
|
2797
|
-
|
|
2798
|
-
|
|
2799
|
-
|
|
2847
|
+
path_open: (e, t, r, a, c, f, p, m, h) => {
|
|
2848
|
+
if (!T || !W) return o;
|
|
2849
|
+
let g = X(e, n.decode(new Uint8Array(T.buffer, r, a)));
|
|
2850
|
+
if (!g) return o;
|
|
2851
|
+
let y = g.replace(/\/+/g, "/").replace(/\/$/, "") || "/";
|
|
2852
|
+
if (y === "/dev/null") {
|
|
2853
|
+
let e = K++;
|
|
2854
|
+
return q.set(e, {
|
|
2855
|
+
type: "dev_null",
|
|
2856
|
+
path: "/dev/null"
|
|
2857
|
+
}), new DataView(T.buffer).setUint32(h, e, !0), i;
|
|
2858
|
+
}
|
|
2859
|
+
if (y === "/dev/zero") {
|
|
2860
|
+
let e = K++;
|
|
2861
|
+
return q.set(e, {
|
|
2862
|
+
type: "dev_zero",
|
|
2863
|
+
path: "/dev/zero"
|
|
2864
|
+
}), new DataView(T.buffer).setUint32(h, e, !0), i;
|
|
2865
|
+
}
|
|
2866
|
+
if (y === "/dev/urandom" || y === "/dev/random") {
|
|
2867
|
+
let e = K++;
|
|
2868
|
+
return q.set(e, {
|
|
2869
|
+
type: "dev_urandom",
|
|
2800
2870
|
path: y
|
|
2801
|
-
}), new DataView(
|
|
2871
|
+
}), new DataView(T.buffer).setUint32(h, e, !0), i;
|
|
2802
2872
|
}
|
|
2803
|
-
if (
|
|
2804
|
-
|
|
2805
|
-
|
|
2806
|
-
|
|
2807
|
-
|
|
2808
|
-
|
|
2809
|
-
|
|
2810
|
-
|
|
2811
|
-
|
|
2873
|
+
if (y === "/dev/tty") {
|
|
2874
|
+
L();
|
|
2875
|
+
let e = K++;
|
|
2876
|
+
return q.set(e, {
|
|
2877
|
+
type: "dev_tty",
|
|
2878
|
+
path: "/dev/tty"
|
|
2879
|
+
}), new DataView(T.buffer).setUint32(h, e, !0), i;
|
|
2880
|
+
}
|
|
2881
|
+
let w = W.stat(g), E = w !== null;
|
|
2882
|
+
if (c & x && c & _ && E) return s;
|
|
2883
|
+
if (c & v) {
|
|
2884
|
+
if (!E) return u;
|
|
2885
|
+
if (!w.isDirectory) return d;
|
|
2886
|
+
let e = K++;
|
|
2887
|
+
return q.set(e, {
|
|
2888
|
+
type: "dir",
|
|
2889
|
+
path: g
|
|
2890
|
+
}), new DataView(T.buffer).setUint32(h, e, !0), i;
|
|
2891
|
+
}
|
|
2892
|
+
if (E && w.isDirectory) return l;
|
|
2893
|
+
if (!E && !(c & _)) return u;
|
|
2894
|
+
let D = new Uint8Array(), O = !1;
|
|
2895
|
+
if (E && !(c & S)) {
|
|
2896
|
+
let e = W.getFileByPath(g);
|
|
2897
|
+
e != null && (D = typeof e == "string" ? b.encode(e) : new Uint8Array(this._contentToBytes(e)));
|
|
2898
|
+
} else O = !0;
|
|
2899
|
+
let k = K++;
|
|
2900
|
+
return q.set(k, {
|
|
2812
2901
|
type: "file",
|
|
2813
|
-
path:
|
|
2814
|
-
bytes:
|
|
2815
|
-
pos: m &
|
|
2816
|
-
append: !!(m &
|
|
2817
|
-
dirty:
|
|
2818
|
-
}), new DataView(
|
|
2902
|
+
path: g,
|
|
2903
|
+
bytes: D,
|
|
2904
|
+
pos: m & C ? D.length : 0,
|
|
2905
|
+
append: !!(m & C),
|
|
2906
|
+
dirty: O
|
|
2907
|
+
}), new DataView(T.buffer).setUint32(h, k, !0), i;
|
|
2819
2908
|
},
|
|
2820
|
-
path_filestat_get: (e, t, r,
|
|
2821
|
-
if (!
|
|
2822
|
-
let c =
|
|
2823
|
-
if (!c) return
|
|
2824
|
-
let
|
|
2825
|
-
if (
|
|
2826
|
-
|
|
2827
|
-
|
|
2828
|
-
|
|
2909
|
+
path_filestat_get: (e, t, r, a, s) => {
|
|
2910
|
+
if (!T || !W) return o;
|
|
2911
|
+
let c = X(e, n.decode(new Uint8Array(T.buffer, r, a)));
|
|
2912
|
+
if (!c) return o;
|
|
2913
|
+
let l = c.replace(/\/+/g, "/").replace(/\/$/, "") || "/";
|
|
2914
|
+
if (l === "/dev/null" || l === "/dev/zero" || l === "/dev/urandom" || l === "/dev/random" || l === "/dev/tty") {
|
|
2915
|
+
let e = new DataView(T.buffer);
|
|
2916
|
+
for (let t = 0; t < 64; t++) e.setUint8(s + t, 0);
|
|
2917
|
+
return e.setUint8(s + 16, m), e.setBigUint64(s + 24, 1n, !0), i;
|
|
2918
|
+
}
|
|
2919
|
+
let d = W.stat(c);
|
|
2920
|
+
if (!d) return u;
|
|
2921
|
+
let f = new DataView(T.buffer);
|
|
2922
|
+
for (let e = 0; e < 64; e++) f.setUint8(s + e, 0);
|
|
2923
|
+
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
2924
|
},
|
|
2830
2925
|
path_create_directory: (e, t, r) => {
|
|
2831
|
-
if (!
|
|
2832
|
-
let
|
|
2833
|
-
if (!
|
|
2926
|
+
if (!T || !W) return o;
|
|
2927
|
+
let a = X(e, n.decode(new Uint8Array(T.buffer, t, r)));
|
|
2928
|
+
if (!a) return o;
|
|
2834
2929
|
try {
|
|
2835
|
-
return
|
|
2930
|
+
return W.setFileByPath(a, {}, !0), i;
|
|
2836
2931
|
} catch {
|
|
2837
|
-
return
|
|
2932
|
+
return c;
|
|
2838
2933
|
}
|
|
2839
2934
|
},
|
|
2840
2935
|
path_unlink_file: (e, t, r) => {
|
|
2841
|
-
if (!
|
|
2842
|
-
let
|
|
2843
|
-
if (!
|
|
2936
|
+
if (!T || !W) return o;
|
|
2937
|
+
let a = X(e, n.decode(new Uint8Array(T.buffer, t, r)));
|
|
2938
|
+
if (!a || !W.exists(a)) return u;
|
|
2844
2939
|
try {
|
|
2845
|
-
return
|
|
2940
|
+
return W.deleteFileByPath(a), i;
|
|
2846
2941
|
} catch {
|
|
2847
|
-
return
|
|
2942
|
+
return c;
|
|
2848
2943
|
}
|
|
2849
2944
|
},
|
|
2850
2945
|
path_remove_directory: (e, t, r) => {
|
|
2851
|
-
if (!
|
|
2852
|
-
let
|
|
2853
|
-
if (!
|
|
2946
|
+
if (!T || !W) return o;
|
|
2947
|
+
let a = X(e, n.decode(new Uint8Array(T.buffer, t, r)));
|
|
2948
|
+
if (!a || !W.exists(a)) return u;
|
|
2854
2949
|
try {
|
|
2855
|
-
return
|
|
2950
|
+
return W.deleteFileByPath(a), i;
|
|
2856
2951
|
} catch {
|
|
2857
|
-
return
|
|
2952
|
+
return c;
|
|
2858
2953
|
}
|
|
2859
2954
|
},
|
|
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
|
|
2955
|
+
path_rename: (e, t, r, a, s, l) => {
|
|
2956
|
+
if (!T || !W) return o;
|
|
2957
|
+
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);
|
|
2958
|
+
if (!p || !m) return o;
|
|
2959
|
+
if (!W.exists(p)) return u;
|
|
2960
|
+
for (let e of q.values()) e.path === p && (Z(e), e.path = m);
|
|
2866
2961
|
try {
|
|
2867
|
-
let e =
|
|
2868
|
-
return
|
|
2962
|
+
let e = W.getFileByPath(p);
|
|
2963
|
+
return W.setFileByPath(m, e, !0), W.deleteFileByPath(p), i;
|
|
2869
2964
|
} catch {
|
|
2870
|
-
return
|
|
2965
|
+
return c;
|
|
2871
2966
|
}
|
|
2872
2967
|
},
|
|
2873
2968
|
proc_exit: (e) => {
|
|
@@ -2877,88 +2972,156 @@ var ee, R, z, B, V, H, U, W, G, K, te = e((() => {
|
|
|
2877
2972
|
};
|
|
2878
2973
|
},
|
|
2879
2974
|
args_sizes_get: (e, t) => {
|
|
2880
|
-
if (!
|
|
2881
|
-
let n = [this.script, ...this.arguments || []], r = new DataView(
|
|
2975
|
+
if (!T) return c;
|
|
2976
|
+
let n = [this.script, ...this.arguments || []], r = new DataView(T.buffer);
|
|
2882
2977
|
return r.setUint32(e, n.length, !0), r.setUint32(t, n.reduce((e, t) => e + b.encode(t).length + 1, 0), !0), i;
|
|
2883
2978
|
},
|
|
2884
2979
|
args_get: (e, t) => {
|
|
2885
|
-
if (!
|
|
2886
|
-
let n = [this.script, ...this.arguments || []], r = new DataView(
|
|
2980
|
+
if (!T) return c;
|
|
2981
|
+
let n = [this.script, ...this.arguments || []], r = new DataView(T.buffer), a = t;
|
|
2887
2982
|
for (let t = 0; t < n.length; t++) {
|
|
2888
2983
|
r.setUint32(e + t * 4, a, !0);
|
|
2889
2984
|
let i = b.encode(n[t] + "\0");
|
|
2890
|
-
new Uint8Array(
|
|
2985
|
+
new Uint8Array(T.buffer).set(i, a), a += i.length;
|
|
2891
2986
|
}
|
|
2892
2987
|
return i;
|
|
2893
2988
|
},
|
|
2894
2989
|
environ_sizes_get: (e, t) => {
|
|
2895
|
-
if (!
|
|
2896
|
-
let n = new DataView(
|
|
2897
|
-
n.setUint32(e,
|
|
2898
|
-
let r =
|
|
2990
|
+
if (!T) return c;
|
|
2991
|
+
let n = new DataView(T.buffer);
|
|
2992
|
+
n.setUint32(e, Q.length, !0);
|
|
2993
|
+
let r = Q.reduce((e, t) => e + b.encode(t).length + 1, 0);
|
|
2899
2994
|
return n.setUint32(t, r, !0), i;
|
|
2900
2995
|
},
|
|
2901
2996
|
environ_get: (e, t) => {
|
|
2902
|
-
if (!
|
|
2903
|
-
let n = new DataView(
|
|
2904
|
-
for (let t = 0; t <
|
|
2997
|
+
if (!T) return c;
|
|
2998
|
+
let n = new DataView(T.buffer), r = t;
|
|
2999
|
+
for (let t = 0; t < Q.length; t++) {
|
|
2905
3000
|
n.setUint32(e + t * 4, r, !0);
|
|
2906
|
-
let i = b.encode(
|
|
2907
|
-
new Uint8Array(
|
|
3001
|
+
let i = b.encode(Q[t] + "\0");
|
|
3002
|
+
new Uint8Array(T.buffer).set(i, r), r += i.length;
|
|
2908
3003
|
}
|
|
2909
3004
|
return i;
|
|
2910
3005
|
},
|
|
2911
3006
|
clock_time_get: (e, t, n) => {
|
|
2912
|
-
if (
|
|
3007
|
+
if (T) {
|
|
2913
3008
|
let e = BigInt(Date.now()) * 1000000n;
|
|
2914
|
-
new DataView(
|
|
3009
|
+
new DataView(T.buffer).setBigUint64(n, e, !0);
|
|
2915
3010
|
}
|
|
2916
3011
|
return i;
|
|
2917
3012
|
},
|
|
2918
3013
|
random_get: (e, t) => {
|
|
2919
|
-
if (
|
|
2920
|
-
let n = new Uint8Array(
|
|
3014
|
+
if (T) {
|
|
3015
|
+
let n = new Uint8Array(T.buffer, e, t);
|
|
2921
3016
|
for (let e = 0; e < t; e++) n[e] = Math.random() * 256 | 0;
|
|
2922
3017
|
}
|
|
2923
3018
|
return i;
|
|
3019
|
+
},
|
|
3020
|
+
clock_nanosleep: (e, t, n, r, a) => {
|
|
3021
|
+
if (!T) return o;
|
|
3022
|
+
let s = new DataView(T.buffer).getBigUint64(n, !0), c = 0;
|
|
3023
|
+
if (t & 1) {
|
|
3024
|
+
let e = BigInt(Date.now()) * 1000000n;
|
|
3025
|
+
c = s > e ? Number((s - e) / 1000000n) : 0;
|
|
3026
|
+
} else c = Number(s / 1000000n);
|
|
3027
|
+
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;
|
|
3028
|
+
},
|
|
3029
|
+
poll_oneoff: (e, t, n, r) => {
|
|
3030
|
+
if (!T) return o;
|
|
3031
|
+
let a = new DataView(T.buffer);
|
|
3032
|
+
if (D) {
|
|
3033
|
+
if ((typeof E?.exports?.asyncify_get_state == "function" ? E.exports.asyncify_get_state() : 0) === 2) {
|
|
3034
|
+
E.exports.asyncify_stop_rewind();
|
|
3035
|
+
let o = 0;
|
|
3036
|
+
for (let r = 0; r < n; r++) {
|
|
3037
|
+
let n = e + r * 48, s = a.getBigUint64(n, !0), c = a.getUint8(n + 8), l = t + o * 32;
|
|
3038
|
+
a.setBigUint64(l, s, !0), a.setUint16(l + 8, i, !0), a.setUint8(l + 10, c);
|
|
3039
|
+
for (let e = 11; e < 32; e++) a.setUint8(l + e, 0);
|
|
3040
|
+
c === 1 && a.setBigUint64(l + 16, BigInt(B.length), !0), o++;
|
|
3041
|
+
}
|
|
3042
|
+
return a.setUint32(r, o, !0), i;
|
|
3043
|
+
}
|
|
3044
|
+
let o = 0, s = Infinity;
|
|
3045
|
+
for (let t = 0; t < n; t++) {
|
|
3046
|
+
let n = e + t * 48, r = a.getUint8(n + 8);
|
|
3047
|
+
if (r === 0) {
|
|
3048
|
+
let e = a.getBigUint64(n + 24, !0), t = a.getUint16(n + 40, !0), r = 0;
|
|
3049
|
+
if (t & 1) {
|
|
3050
|
+
let t = BigInt(Date.now()) * 1000000n;
|
|
3051
|
+
r = e > t ? Number((e - t) / 1000000n) : 0;
|
|
3052
|
+
} else r = Number(e / 1000000n);
|
|
3053
|
+
r < s && (s = r);
|
|
3054
|
+
} else if (r === 1) {
|
|
3055
|
+
let e = a.getUint32(n + 16, !0), t = q.get(e), r = !!(t && t.type === "dev_tty");
|
|
3056
|
+
(e === 0 || e === 2 || r) && L(), (e === 0 || I && e === 2 || r) && B.length > 0 && o++;
|
|
3057
|
+
} else r === 2 && o++;
|
|
3058
|
+
}
|
|
3059
|
+
if (o > 0 || s === 0) {
|
|
3060
|
+
let o = 0;
|
|
3061
|
+
for (let r = 0; r < n; r++) {
|
|
3062
|
+
let n = e + r * 48, c = a.getBigUint64(n, !0), l = a.getUint8(n + 8), u = !1;
|
|
3063
|
+
if (l === 0 && s === 0) u = !0;
|
|
3064
|
+
else if (l === 1) {
|
|
3065
|
+
let e = a.getUint32(n + 16, !0), t = q.get(e), r = !!(t && t.type === "dev_tty");
|
|
3066
|
+
(e === 0 || I && e === 2 || r) && B.length > 0 && (u = !0);
|
|
3067
|
+
} else l === 2 && (u = !0);
|
|
3068
|
+
if (u) {
|
|
3069
|
+
let e = t + o * 32;
|
|
3070
|
+
a.setBigUint64(e, c, !0), a.setUint16(e + 8, i, !0), a.setUint8(e + 10, l);
|
|
3071
|
+
for (let t = 11; t < 32; t++) a.setUint8(e + t, 0);
|
|
3072
|
+
l === 1 && a.setBigUint64(e + 16, BigInt(B.length), !0), o++;
|
|
3073
|
+
}
|
|
3074
|
+
}
|
|
3075
|
+
return a.setUint32(r, o, !0), i;
|
|
3076
|
+
}
|
|
3077
|
+
return E.exports.asyncify_start_unwind(O), k = new Promise((e) => {
|
|
3078
|
+
let t = null;
|
|
3079
|
+
A = () => {
|
|
3080
|
+
t && clearTimeout(t), A = null, e();
|
|
3081
|
+
}, s !== Infinity && (t = setTimeout(() => {
|
|
3082
|
+
A = null, e();
|
|
3083
|
+
}, Math.max(1, s)));
|
|
3084
|
+
}), a.setUint32(r, 0, !0), i;
|
|
3085
|
+
}
|
|
3086
|
+
return a.setUint32(r, 0, !0), i;
|
|
2924
3087
|
}
|
|
2925
3088
|
}, { get(e, t) {
|
|
2926
3089
|
return t in e ? e[t] : () => 0;
|
|
2927
|
-
} }),
|
|
2928
|
-
if (!
|
|
3090
|
+
} }), re = (e) => {
|
|
3091
|
+
if (!T || !e) return "";
|
|
2929
3092
|
try {
|
|
2930
|
-
let t = new DataView(
|
|
3093
|
+
let t = new DataView(T.buffer).getUint32(e - 4, !0), n = new Uint16Array(T.buffer, e, t >>> 1);
|
|
2931
3094
|
return String.fromCharCode(...n);
|
|
2932
3095
|
} catch {
|
|
2933
3096
|
return "";
|
|
2934
3097
|
}
|
|
2935
|
-
},
|
|
2936
|
-
wasi_snapshot_preview1:
|
|
2937
|
-
wasi_unstable:
|
|
3098
|
+
}, ie = {
|
|
3099
|
+
wasi_snapshot_preview1: ne,
|
|
3100
|
+
wasi_unstable: ne,
|
|
2938
3101
|
env: new Proxy({
|
|
2939
3102
|
print: (e, t) => {
|
|
2940
|
-
|
|
3103
|
+
T && R(1, n.decode(new Uint8Array(T.buffer, e, t)));
|
|
2941
3104
|
},
|
|
2942
3105
|
eprint: (e, t) => {
|
|
2943
|
-
|
|
3106
|
+
T && R(2, n.decode(new Uint8Array(T.buffer, e, t)));
|
|
2944
3107
|
},
|
|
2945
3108
|
log: (e) => {
|
|
2946
|
-
|
|
3109
|
+
R(1, re(e) + "\n");
|
|
2947
3110
|
},
|
|
2948
3111
|
logi: (e) => {
|
|
2949
|
-
|
|
3112
|
+
R(1, String(e) + "\n");
|
|
2950
3113
|
},
|
|
2951
3114
|
logf: (e) => {
|
|
2952
|
-
|
|
3115
|
+
R(1, String(e) + "\n");
|
|
2953
3116
|
},
|
|
2954
3117
|
trace: (e, t, ...n) => {
|
|
2955
3118
|
let r = t > 0 ? " " + n.slice(0, t).join(", ") : "";
|
|
2956
|
-
|
|
3119
|
+
R(1, `trace: ${re(e)}${r}\n`);
|
|
2957
3120
|
},
|
|
2958
3121
|
seed: () => Date.now() * Math.random(),
|
|
2959
3122
|
abort: (e, t, n, r) => {
|
|
2960
|
-
let i =
|
|
2961
|
-
throw (i || a) &&
|
|
3123
|
+
let i = re(e), a = re(t);
|
|
3124
|
+
throw (i || a) && R(2, `abort: ${i || "aborted"} at ${a || this.script}:${n || 0}:${r || 0}\n`), this.exitCode = 134, {
|
|
2962
3125
|
_wasmExit: !0,
|
|
2963
3126
|
code: 134
|
|
2964
3127
|
};
|
|
@@ -2974,66 +3137,64 @@ var ee, R, z, B, V, H, U, W, G, K, te = e((() => {
|
|
|
2974
3137
|
initial: 1,
|
|
2975
3138
|
maximum: 256
|
|
2976
3139
|
});
|
|
2977
|
-
|
|
3140
|
+
T = t, ie[e.module] || (ie[e.module] = {}), ie[e.module][e.name] = t;
|
|
2978
3141
|
}
|
|
2979
|
-
if (
|
|
3142
|
+
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
3143
|
try {
|
|
2981
|
-
|
|
3144
|
+
O = T.grow(1) * 65536;
|
|
2982
3145
|
} catch {
|
|
2983
|
-
|
|
3146
|
+
O = 16;
|
|
2984
3147
|
}
|
|
2985
|
-
let e =
|
|
2986
|
-
new Int32Array(
|
|
3148
|
+
let e = O + 8, t = O + 65536 - 8;
|
|
3149
|
+
new Int32Array(T.buffer, O, 2).set([e, t]);
|
|
2987
3150
|
}
|
|
2988
|
-
|
|
2989
|
-
|
|
3151
|
+
typeof E.exports.set_terminal_size == "function" && L(), I && this._enterAltScreen();
|
|
3152
|
+
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;
|
|
3153
|
+
if (typeof E.exports.set_terminal_size == "function") try {
|
|
3154
|
+
E.exports.set_terminal_size(n, r);
|
|
3155
|
+
} catch {}
|
|
3156
|
+
j = () => {
|
|
2990
3157
|
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
|
-
|
|
3158
|
+
if (typeof E?.exports?.set_terminal_size == "function") try {
|
|
3159
|
+
E.exports.set_terminal_size(e, t);
|
|
2993
3160
|
} 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);
|
|
3161
|
+
}, this.stdout && typeof this.stdout.on == "function" && this.stdout.on("resize", j), this.stdinStream && typeof this.stdinStream.on == "function" && this.stdinStream.on("resize", j);
|
|
3162
|
+
let i = E.exports._start || E.exports.__wasi_command || E.exports.main || E.exports.run;
|
|
3163
|
+
if (i) try {
|
|
3164
|
+
let e = i();
|
|
3165
|
+
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
3166
|
} catch (e) {
|
|
3006
3167
|
(!e || !e._wasmExit) && (this.stdErr = `${this.script}: runtime error: ${e?.message || String(e)}`, this.exitCode = 1);
|
|
3007
3168
|
}
|
|
3008
3169
|
else {
|
|
3009
|
-
let e = Object.entries(
|
|
3170
|
+
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
3171
|
this.stdErr = `${this.script}: no CLI entry point found (expected _start, main, or run)${t}`, this.exitCode = 1;
|
|
3011
3172
|
}
|
|
3012
3173
|
} catch (e) {
|
|
3013
3174
|
(!e || !e._wasmExit) && (this.stdErr = `${this.script}: ${e?.message || String(e)}`, this.exitCode = 1);
|
|
3014
3175
|
} finally {
|
|
3015
|
-
|
|
3016
|
-
for (let e of
|
|
3176
|
+
I && this._exitAltScreen(), I && M && (this.stdinStream && typeof this.stdinStream.off == "function" && this.stdinStream.off("data", M), this.stdin && typeof this.stdin.off == "function" && this.stdin.off("data", M)), j && (this.stdout && typeof this.stdout.off == "function" && this.stdout.off("resize", j), this.stdinStream && typeof this.stdinStream.off == "function" && this.stdinStream.off("resize", j)), this._externalKeyHandler = null;
|
|
3177
|
+
for (let e of q.values()) Z(e);
|
|
3017
3178
|
}
|
|
3018
|
-
|
|
3019
|
-
let
|
|
3179
|
+
z();
|
|
3180
|
+
let ae = this.arguments || [];
|
|
3020
3181
|
if (!(this.result && this.result.getStdOutput && this.result.getStdOutput().length > 0) && (this.exitCode === 0 || this.exitCode === void 0)) {
|
|
3021
3182
|
let t = (this.script || "wasm").split("/").pop(), n = Object.assign({
|
|
3022
3183
|
name: t,
|
|
3023
3184
|
version: "wasi",
|
|
3024
3185
|
description: `WebAssembly WASI binary (${this.script})`
|
|
3025
3186
|
}, this._pkgMeta || {});
|
|
3026
|
-
if (
|
|
3027
|
-
let r =
|
|
3028
|
-
for (let e of
|
|
3029
|
-
} else (
|
|
3187
|
+
if (ae.includes("--help") || ae.includes("-h")) {
|
|
3188
|
+
let r = N(e);
|
|
3189
|
+
for (let e of P(t, n, r)) this.stdOut = e;
|
|
3190
|
+
} else (ae.includes("--version") || ae.includes("-V") || ae.includes("-v")) && (this.stdOut = `${t} (${n.name} ${n.version} wasm)`);
|
|
3030
3191
|
}
|
|
3031
3192
|
}
|
|
3032
|
-
},
|
|
3033
|
-
function
|
|
3193
|
+
}, O = /* @__PURE__ */ new Map();
|
|
3194
|
+
function k(e, t) {
|
|
3034
3195
|
if (!e || !e.exists(t)) return null;
|
|
3035
3196
|
if (e.isRealFilesystem) try {
|
|
3036
|
-
let n =
|
|
3197
|
+
let n = Z();
|
|
3037
3198
|
return new Uint8Array(n.readFileSync(e.absolutePath(t)));
|
|
3038
3199
|
} catch {}
|
|
3039
3200
|
let n = e.getFileByPath(t);
|
|
@@ -3057,12 +3218,12 @@ var ee, R, z, B, V, H, U, W, G, K, te = e((() => {
|
|
|
3057
3218
|
}
|
|
3058
3219
|
return null;
|
|
3059
3220
|
}
|
|
3060
|
-
function
|
|
3221
|
+
function A(e, t, n, i = "application/octet-stream") {
|
|
3061
3222
|
let a = n instanceof Uint8Array ? n : new Uint8Array(n), o = new Uint8Array(a.byteLength);
|
|
3062
3223
|
o.set(a);
|
|
3063
3224
|
let s = new r(o.buffer, i);
|
|
3064
3225
|
if (e.isRealFilesystem) try {
|
|
3065
|
-
let n =
|
|
3226
|
+
let n = Z(), r = te(), i = e.absolutePath(t);
|
|
3066
3227
|
n.mkdirSync(r.dirname(i), { recursive: !0 }), n.writeFileSync(i, y.from(a.buffer, a.byteOffset, a.byteLength));
|
|
3067
3228
|
return;
|
|
3068
3229
|
} catch {
|
|
@@ -3077,7 +3238,7 @@ var ee, R, z, B, V, H, U, W, G, K, te = e((() => {
|
|
|
3077
3238
|
}
|
|
3078
3239
|
e.setFileByPath(t, s, !0);
|
|
3079
3240
|
}
|
|
3080
|
-
async function
|
|
3241
|
+
async function j(e, t, n = null) {
|
|
3081
3242
|
if (typeof n == "function") {
|
|
3082
3243
|
let r = await n(e, t);
|
|
3083
3244
|
if (r) return r;
|
|
@@ -3105,7 +3266,7 @@ var ee, R, z, B, V, H, U, W, G, K, te = e((() => {
|
|
|
3105
3266
|
}
|
|
3106
3267
|
throw Error(`Package '${e}' could not be loaded`);
|
|
3107
3268
|
}
|
|
3108
|
-
function
|
|
3269
|
+
function M(e, t = !1) {
|
|
3109
3270
|
let n = {
|
|
3110
3271
|
usage: null,
|
|
3111
3272
|
options: []
|
|
@@ -3122,7 +3283,7 @@ var ee, R, z, B, V, H, U, W, G, K, te = e((() => {
|
|
|
3122
3283
|
}
|
|
3123
3284
|
return n;
|
|
3124
3285
|
}
|
|
3125
|
-
function
|
|
3286
|
+
function N(e) {
|
|
3126
3287
|
let t = {
|
|
3127
3288
|
usage: null,
|
|
3128
3289
|
options: [],
|
|
@@ -3143,12 +3304,12 @@ var ee, R, z, B, V, H, U, W, G, K, te = e((() => {
|
|
|
3143
3304
|
i >= 32 && i <= 126 || i === 9 || i === 10 ? r += String.fromCharCode(i) : (r.length >= 4 && n.push(r), r = "");
|
|
3144
3305
|
}
|
|
3145
3306
|
r.length >= 4 && n.push(r);
|
|
3146
|
-
let i =
|
|
3307
|
+
let i = M(n.join("\n"), !0);
|
|
3147
3308
|
t.usage = i.usage, t.options = i.options;
|
|
3148
3309
|
} catch {}
|
|
3149
3310
|
return t;
|
|
3150
3311
|
}
|
|
3151
|
-
function
|
|
3312
|
+
function P(e, t = {}, n = null) {
|
|
3152
3313
|
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
3314
|
t.details && u.push("", t.details), u.push("", "Options:");
|
|
3154
3315
|
let d = n && n.options && n.options.length > 0 ? n.options : Array.isArray(t.options) ? t.options : [];
|
|
@@ -3156,7 +3317,7 @@ var ee, R, z, B, V, H, U, W, G, K, te = e((() => {
|
|
|
3156
3317
|
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
3318
|
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
3319
|
}
|
|
3159
|
-
function
|
|
3320
|
+
function F(e, t = {}, n = null) {
|
|
3160
3321
|
let r = E(), i = (n || e.bin || e.name).toLowerCase();
|
|
3161
3322
|
class a extends r {
|
|
3162
3323
|
static get name() {
|
|
@@ -3170,7 +3331,7 @@ var ee, R, z, B, V, H, U, W, G, K, te = e((() => {
|
|
|
3170
3331
|
}
|
|
3171
3332
|
async run() {
|
|
3172
3333
|
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 ?
|
|
3334
|
+
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
3335
|
try {
|
|
3175
3336
|
if ((e.type === "wasm" || e.type === "custom-wasm") && (this._persistedWasmBytes || e.wasmUrl)) {
|
|
3176
3337
|
let i = this._persistedWasmBytes;
|
|
@@ -3179,7 +3340,7 @@ var ee, R, z, B, V, H, U, W, G, K, te = e((() => {
|
|
|
3179
3340
|
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
3341
|
} catch {}
|
|
3181
3342
|
if (!i && e.wasmUrl && (i = await this._fetchWasmBytes(e.wasmUrl)), i) {
|
|
3182
|
-
r && (this._inspectedWasm =
|
|
3343
|
+
r && (this._inspectedWasm = N(i)), await this._runRawWasmBytes(i, n);
|
|
3183
3344
|
return;
|
|
3184
3345
|
}
|
|
3185
3346
|
} else {
|
|
@@ -3196,19 +3357,19 @@ var ee, R, z, B, V, H, U, W, G, K, te = e((() => {
|
|
|
3196
3357
|
}
|
|
3197
3358
|
let c, l;
|
|
3198
3359
|
try {
|
|
3199
|
-
c = await
|
|
3360
|
+
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
3361
|
} finally {
|
|
3201
3362
|
s && (globalThis.fetch = s);
|
|
3202
3363
|
}
|
|
3203
3364
|
if (l instanceof Uint8Array || l instanceof ArrayBuffer) {
|
|
3204
3365
|
let e = l instanceof Uint8Array ? l : new Uint8Array(l);
|
|
3205
|
-
r && (this._inspectedWasm =
|
|
3366
|
+
r && (this._inspectedWasm = N(e)), await this._runRawWasmBytes(e, n);
|
|
3206
3367
|
} else if (l && (l.wasmBytes instanceof Uint8Array || l.wasm instanceof Uint8Array)) {
|
|
3207
3368
|
let e = l.wasmBytes || l.wasm;
|
|
3208
|
-
r && (this._inspectedWasm =
|
|
3369
|
+
r && (this._inspectedWasm = N(e)), await this._runRawWasmBytes(e, n);
|
|
3209
3370
|
} else if (typeof l == "function") await this._runFunctionOrEmscripten(l, n, r);
|
|
3210
3371
|
else if (l && typeof l == "object") {
|
|
3211
|
-
l.ready && await l.ready, r && (l.HEAPU8 instanceof Uint8Array || l.wasmBinary instanceof Uint8Array) && (this._inspectedWasm =
|
|
3372
|
+
l.ready && await l.ready, r && (l.HEAPU8 instanceof Uint8Array || l.wasmBinary instanceof Uint8Array) && (this._inspectedWasm = N(l.wasmBinary || l.HEAPU8));
|
|
3212
3373
|
let t = l.main || l.run || l.callMain || l.exec;
|
|
3213
3374
|
if (typeof t == "function") await this._invokeCliFunction(t.bind(l), n);
|
|
3214
3375
|
else if (l.promised || typeof l.raw == "function" || typeof l.json == "function") {
|
|
@@ -3236,29 +3397,29 @@ var ee, R, z, B, V, H, U, W, G, K, te = e((() => {
|
|
|
3236
3397
|
}
|
|
3237
3398
|
}
|
|
3238
3399
|
if (r || a) {
|
|
3239
|
-
let t = this.result && this.result.getStdOutput ? this.result.getStdOutput() : [], n = t.map((e) => e.string).join("\n"), o = r ?
|
|
3400
|
+
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
3401
|
if (r) if (s) {
|
|
3241
3402
|
let e = t.map((e) => e.string);
|
|
3242
3403
|
this.result && Array.isArray(this.result.std) && (this.result.std.length = 0), this.exitCode = 0;
|
|
3243
3404
|
for (let t of e) this.stdOut = t;
|
|
3244
3405
|
} else {
|
|
3245
3406
|
this.result && Array.isArray(this.result.std) && (this.result.std.length = 0), this.exitCode = 0;
|
|
3246
|
-
for (let t of
|
|
3407
|
+
for (let t of P(i, e, this._inspectedWasm)) this.stdOut = t;
|
|
3247
3408
|
}
|
|
3248
3409
|
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
3410
|
}
|
|
3250
3411
|
}
|
|
3251
3412
|
async _fetchWasmBytes(e) {
|
|
3252
|
-
if (
|
|
3413
|
+
if (O.has(e)) return O.get(e);
|
|
3253
3414
|
let n = t.fetch || (typeof fetch == "function" ? fetch : null);
|
|
3254
3415
|
if (!n) throw Error("fetch is not available in this environment");
|
|
3255
3416
|
let r = await n(e);
|
|
3256
3417
|
if (!r || !r.ok) throw Error(`HTTP ${r ? r.status : "error"} fetching ${e}`);
|
|
3257
3418
|
let i = new Uint8Array(await r.arrayBuffer());
|
|
3258
|
-
return
|
|
3419
|
+
return O.set(e, i), i;
|
|
3259
3420
|
}
|
|
3260
3421
|
async _runRawWasmBytes(t, n) {
|
|
3261
|
-
let r = new
|
|
3422
|
+
let r = new T(i, n, this.context);
|
|
3262
3423
|
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
3424
|
for (let e of r.result.getStdOutput()) e.type === "out" ? this.stdOut = e.string : e.type === "err" && (this.stdErr = e.string);
|
|
3264
3425
|
this.exitCode = r.result.getExitCode();
|
|
@@ -3282,13 +3443,13 @@ var ee, R, z, B, V, H, U, W, G, K, te = e((() => {
|
|
|
3282
3443
|
let n = t && t !== "." && !e.startsWith("/") ? `${t.replace(/\/+$/, "")}/${e}` : e, r = this.fs.getFileByPath(n) ?? this.fs.getFileByPath(e);
|
|
3283
3444
|
return r == null ? null : typeof r == "string" ? r : new TextDecoder().decode(r);
|
|
3284
3445
|
},
|
|
3285
|
-
readBytes: (e) =>
|
|
3446
|
+
readBytes: (e) => k(this.fs, e),
|
|
3286
3447
|
writeFile: (e, t, n) => {
|
|
3287
3448
|
if (!this.fs) return;
|
|
3288
3449
|
let r = n && n !== "." && !e.startsWith("/") ? `${n.replace(/\/+$/, "")}/${e}` : e;
|
|
3289
3450
|
if (t instanceof Uint8Array || ArrayBuffer.isView(t)) {
|
|
3290
3451
|
let e = r.endsWith(".wasm") ? "application/wasm" : "application/octet-stream";
|
|
3291
|
-
|
|
3452
|
+
A(this.fs, r, t, e);
|
|
3292
3453
|
} else this.fs.setFileByPath(r, String(t), !0);
|
|
3293
3454
|
if (r.endsWith(".wasm") || r.endsWith(".wat")) try {
|
|
3294
3455
|
this.context && this.context.fs ? this.context.fs.setMode(r, 493) : this.fs.setMode(r, 493);
|
|
@@ -3324,7 +3485,7 @@ var ee, R, z, B, V, H, U, W, G, K, te = e((() => {
|
|
|
3324
3485
|
if (e && typeof e.status == "number") this.exitCode = e.status;
|
|
3325
3486
|
else throw e;
|
|
3326
3487
|
}
|
|
3327
|
-
if (d && typeof d == "object") if (r && (d.wasmBinary instanceof Uint8Array || d.HEAPU8 instanceof Uint8Array) && (this._inspectedWasm =
|
|
3488
|
+
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
3489
|
d.FS && c.size === 0 && (c = this._syncBrshToEmscriptenFs(d.FS, n));
|
|
3329
3490
|
try {
|
|
3330
3491
|
let e = await d.callMain(n);
|
|
@@ -3387,14 +3548,14 @@ var ee, R, z, B, V, H, U, W, G, K, te = e((() => {
|
|
|
3387
3548
|
}), !t.loaded && typeof t.load == "function" && await t.load(e.coreUrl ? { coreURL: e.coreUrl } : void 0);
|
|
3388
3549
|
let a = /* @__PURE__ */ new Set(), o = [];
|
|
3389
3550
|
for (let e of n) if (!e.startsWith("-") && (o.push(e), this.fs.exists(e))) {
|
|
3390
|
-
let n =
|
|
3551
|
+
let n = k(this.fs, e);
|
|
3391
3552
|
n && (await t.writeFile(e, n), a.add(e));
|
|
3392
3553
|
}
|
|
3393
3554
|
let s = await t.exec(n);
|
|
3394
3555
|
for (let e of o) if (!a.has(e)) try {
|
|
3395
3556
|
if (typeof t.readFile == "function") {
|
|
3396
3557
|
let n = await t.readFile(e);
|
|
3397
|
-
n &&
|
|
3558
|
+
n && A(this.fs, e, n);
|
|
3398
3559
|
}
|
|
3399
3560
|
} catch {}
|
|
3400
3561
|
typeof s == "number" && s !== 0 && (this.exitCode = s, i.length === 0 && r.length > 0 && i.push(...r.splice(0, r.length)));
|
|
@@ -3411,7 +3572,7 @@ var ee, R, z, B, V, H, U, W, G, K, te = e((() => {
|
|
|
3411
3572
|
let n = /* @__PURE__ */ new Set();
|
|
3412
3573
|
if (!this.fs || !e || typeof e.writeFile != "function") return n;
|
|
3413
3574
|
for (let r of t) if (!r.startsWith("-") && this.fs.exists(r)) {
|
|
3414
|
-
let t =
|
|
3575
|
+
let t = k(this.fs, r);
|
|
3415
3576
|
if (t) try {
|
|
3416
3577
|
e.writeFile(r, t), n.add(r);
|
|
3417
3578
|
} catch {}
|
|
@@ -3424,7 +3585,7 @@ var ee, R, z, B, V, H, U, W, G, K, te = e((() => {
|
|
|
3424
3585
|
let t = e.readFile(r);
|
|
3425
3586
|
if (t) {
|
|
3426
3587
|
let e = r.endsWith(".wasm") ? "application/wasm" : "application/octet-stream";
|
|
3427
|
-
if (
|
|
3588
|
+
if (A(this.fs, r, t, e), r.endsWith(".wasm") || r.endsWith(".wat")) try {
|
|
3428
3589
|
this.context && this.context.fs ? this.context.fs.setMode(r, 493) : this.fs.setMode(r, 493);
|
|
3429
3590
|
} catch {}
|
|
3430
3591
|
}
|
|
@@ -3434,9 +3595,9 @@ var ee, R, z, B, V, H, U, W, G, K, te = e((() => {
|
|
|
3434
3595
|
}
|
|
3435
3596
|
return a;
|
|
3436
3597
|
}
|
|
3437
|
-
|
|
3438
|
-
})),
|
|
3439
|
-
var n =
|
|
3598
|
+
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;
|
|
3599
|
+
})), ne = /* @__PURE__ */ t(((e, t) => {
|
|
3600
|
+
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
3601
|
get requiresFilesystem() {
|
|
3441
3602
|
return !0;
|
|
3442
3603
|
}
|
|
@@ -3705,7 +3866,7 @@ var ee, R, z, B, V, H, U, W, G, K, te = e((() => {
|
|
|
3705
3866
|
return s;
|
|
3706
3867
|
}
|
|
3707
3868
|
f.createReplWasmCommand = p, f.createCommand = p, t.exports = f;
|
|
3708
|
-
})),
|
|
3869
|
+
})), re = /* @__PURE__ */ t(((e, t) => {
|
|
3709
3870
|
var n = {
|
|
3710
3871
|
sqlite3: {
|
|
3711
3872
|
name: "sqlite3",
|
|
@@ -3925,7 +4086,7 @@ var ee, R, z, B, V, H, U, W, G, K, te = e((() => {
|
|
|
3925
4086
|
PACKAGE_ALIASES: r,
|
|
3926
4087
|
resolvePackageName: i
|
|
3927
4088
|
};
|
|
3928
|
-
})),
|
|
4089
|
+
})), ie = /* @__PURE__ */ t(((e, t) => {
|
|
3929
4090
|
function n(e, t, n = {}) {
|
|
3930
4091
|
let { showRowCount: r = !0 } = n;
|
|
3931
4092
|
if (!e || e.length === 0) return [];
|
|
@@ -3961,7 +4122,7 @@ var ee, R, z, B, V, H, U, W, G, K, te = e((() => {
|
|
|
3961
4122
|
}
|
|
3962
4123
|
return i;
|
|
3963
4124
|
}
|
|
3964
|
-
var { readBytesFromFs: a, writeBytesToFs: o, loadModule: s, extractHelpFromText: c, inspectWasmBytes: l, formatWasmHelp: u } =
|
|
4125
|
+
var { readBytesFromFs: a, writeBytesToFs: o, loadModule: s, extractHelpFromText: c, inspectWasmBytes: l, formatWasmHelp: u } = Q();
|
|
3965
4126
|
t.exports = {
|
|
3966
4127
|
formatTable: n,
|
|
3967
4128
|
formatPipeList: r,
|
|
@@ -3973,9 +4134,9 @@ var ee, R, z, B, V, H, U, W, G, K, te = e((() => {
|
|
|
3973
4134
|
inspectWasmBytes: l,
|
|
3974
4135
|
formatWasmHelp: u
|
|
3975
4136
|
};
|
|
3976
|
-
})),
|
|
4137
|
+
})), ae = /* @__PURE__ */ t(((e, t) => {
|
|
3977
4138
|
T();
|
|
3978
|
-
var n =
|
|
4139
|
+
var n = ne(), { readBytesFromFs: r, writeBytesToFs: i, loadModule: a } = ie(), o = {
|
|
3979
4140
|
smol: "https://huggingface.co/bartowski/SmolLM2-135M-Instruct-GGUF/resolve/main/SmolLM2-135M-Instruct-Q4_K_M.gguf",
|
|
3980
4141
|
smollm: "https://huggingface.co/bartowski/SmolLM2-135M-Instruct-GGUF/resolve/main/SmolLM2-135M-Instruct-Q4_K_M.gguf",
|
|
3981
4142
|
smollm2: "https://huggingface.co/bartowski/SmolLM2-135M-Instruct-GGUF/resolve/main/SmolLM2-135M-Instruct-Q4_K_M.gguf",
|
|
@@ -4868,9 +5029,9 @@ var ee, R, z, B, V, H, U, W, G, K, te = e((() => {
|
|
|
4868
5029
|
name: "wllama",
|
|
4869
5030
|
version: "3.8.1"
|
|
4870
5031
|
}), 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
|
-
})),
|
|
5032
|
+
})), oe = /* @__PURE__ */ t(((e, t) => {
|
|
4872
5033
|
b();
|
|
4873
|
-
var r = E(), i =
|
|
5034
|
+
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
5035
|
function m(e, t, n = {}) {
|
|
4875
5036
|
class r extends i {
|
|
4876
5037
|
static get name() {
|
|
@@ -5252,7 +5413,7 @@ var ee, R, z, B, V, H, U, W, G, K, te = e((() => {
|
|
|
5252
5413
|
return null;
|
|
5253
5414
|
}
|
|
5254
5415
|
async _pullPackageWasm(e, t = !1, n = !1) {
|
|
5255
|
-
let r = this.constructor._config || {}, i = r.fetch || (typeof fetch == "function" ? fetch : null), { loadModule: a } =
|
|
5416
|
+
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
5417
|
if (c && i) try {
|
|
5257
5418
|
let n = await i(c);
|
|
5258
5419
|
n && n.ok ? o = await this._readResponseBytes(n, `${e.name}.wasm`, t) : s = /* @__PURE__ */ Error(`HTTP ${n ? n.status : "error"} fetching ${c}`);
|
|
@@ -5560,6 +5721,6 @@ var ee, R, z, B, V, H, U, W, G, K, te = e((() => {
|
|
|
5560
5721
|
t.exports = h, t.exports.Wbt = h, t.exports.DEFAULT_REGISTRY = o, t.exports.createGenericWasmCommand = u, t.exports.createReplWasmCommand = d;
|
|
5561
5722
|
}));
|
|
5562
5723
|
//#endregion
|
|
5563
|
-
export default
|
|
5724
|
+
export default oe();
|
|
5564
5725
|
|
|
5565
5726
|
//# sourceMappingURL=wbt.es.js.map
|