brsh 2.8.0 → 2.8.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -0
- package/dist/shell.es.js +160 -81
- package/dist/shell.es.js.map +1 -1
- package/dist/shell.min.js +4 -4
- package/dist/shell.min.js.map +1 -1
- package/dist/wbt.es.js +1584 -623
- package/dist/wbt.es.js.map +1 -1
- package/dist/wbt.min.js +6 -6
- package/dist/wbt.min.js.map +1 -1
- package/lib/BaseFileSystem.js +40 -0
- package/lib/BinaryContainer.js +1 -1
- package/lib/FileSystem.js +1 -38
- package/lib/NodeFileSystem.js +4 -2
- package/lib/WasmCommand.js +168 -18
- package/lib/wbt/index.js +270 -14
- package/lib/wbt/packages/wllama.js +12 -2
- package/lib/wbt/registry.js +11 -2
- package/package.json +1 -1
- package/test/wbt.test.js +24 -5
package/dist/wbt.es.js
CHANGED
|
@@ -2,257 +2,10 @@
|
|
|
2
2
|
var e = (e, t) => () => (e && (t = e(e = 0)), t), t = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t.exports), n = /* @__PURE__ */ ((e) => typeof require < "u" ? require : typeof Proxy < "u" ? new Proxy(e, { get: (e, t) => (typeof require < "u" ? require : e)[t] }) : e)(function(e) {
|
|
3
3
|
if (typeof require < "u") return require.apply(this, arguments);
|
|
4
4
|
throw Error("Calling `require` for \"" + e + "\" in an environment that doesn't expose the `require` function. See https://rolldown.rs/in-depth/bundling-cjs#require-external-modules for more details.");
|
|
5
|
-
})
|
|
6
|
-
var n = typeof Reflect == "object" ? Reflect : null, r = n && typeof n.apply == "function" ? n.apply : function(e, t, n) {
|
|
7
|
-
return Function.prototype.apply.call(e, t, n);
|
|
8
|
-
}, i = n && typeof n.ownKeys == "function" ? n.ownKeys : Object.getOwnPropertySymbols ? function(e) {
|
|
9
|
-
return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e));
|
|
10
|
-
} : function(e) {
|
|
11
|
-
return Object.getOwnPropertyNames(e);
|
|
12
|
-
};
|
|
13
|
-
function a(e) {
|
|
14
|
-
console && console.warn && console.warn(e);
|
|
15
|
-
}
|
|
16
|
-
var o = Number.isNaN || function(e) {
|
|
17
|
-
return e !== e;
|
|
18
|
-
};
|
|
19
|
-
function s() {
|
|
20
|
-
s.init.call(this);
|
|
21
|
-
}
|
|
22
|
-
t.exports = s, t.exports.once = y, s.EventEmitter = s, s.prototype._events = void 0, s.prototype._eventsCount = 0, s.prototype._maxListeners = void 0;
|
|
23
|
-
var c = 10;
|
|
24
|
-
function l(e) {
|
|
25
|
-
if (typeof e != "function") throw TypeError("The \"listener\" argument must be of type Function. Received type " + typeof e);
|
|
26
|
-
}
|
|
27
|
-
Object.defineProperty(s, "defaultMaxListeners", {
|
|
28
|
-
enumerable: !0,
|
|
29
|
-
get: function() {
|
|
30
|
-
return c;
|
|
31
|
-
},
|
|
32
|
-
set: function(e) {
|
|
33
|
-
if (typeof e != "number" || e < 0 || o(e)) throw RangeError("The value of \"defaultMaxListeners\" is out of range. It must be a non-negative number. Received " + e + ".");
|
|
34
|
-
c = e;
|
|
35
|
-
}
|
|
36
|
-
}), s.init = function() {
|
|
37
|
-
(this._events === void 0 || this._events === Object.getPrototypeOf(this)._events) && (this._events = Object.create(null), this._eventsCount = 0), this._maxListeners = this._maxListeners || void 0;
|
|
38
|
-
}, s.prototype.setMaxListeners = function(e) {
|
|
39
|
-
if (typeof e != "number" || e < 0 || o(e)) throw RangeError("The value of \"n\" is out of range. It must be a non-negative number. Received " + e + ".");
|
|
40
|
-
return this._maxListeners = e, this;
|
|
41
|
-
};
|
|
42
|
-
function u(e) {
|
|
43
|
-
return e._maxListeners === void 0 ? s.defaultMaxListeners : e._maxListeners;
|
|
44
|
-
}
|
|
45
|
-
s.prototype.getMaxListeners = function() {
|
|
46
|
-
return u(this);
|
|
47
|
-
}, s.prototype.emit = function(e) {
|
|
48
|
-
for (var t = [], n = 1; n < arguments.length; n++) t.push(arguments[n]);
|
|
49
|
-
var i = e === "error", a = this._events;
|
|
50
|
-
if (a !== void 0) i &&= a.error === void 0;
|
|
51
|
-
else if (!i) return !1;
|
|
52
|
-
if (i) {
|
|
53
|
-
var o;
|
|
54
|
-
if (t.length > 0 && (o = t[0]), o instanceof Error) throw o;
|
|
55
|
-
var s = /* @__PURE__ */ Error("Unhandled error." + (o ? " (" + o.message + ")" : ""));
|
|
56
|
-
throw s.context = o, s;
|
|
57
|
-
}
|
|
58
|
-
var c = a[e];
|
|
59
|
-
if (c === void 0) return !1;
|
|
60
|
-
if (typeof c == "function") r(c, this, t);
|
|
61
|
-
else for (var l = c.length, u = g(c, l), n = 0; n < l; ++n) r(u[n], this, t);
|
|
62
|
-
return !0;
|
|
63
|
-
};
|
|
64
|
-
function d(e, t, n, r) {
|
|
65
|
-
var i, o, s;
|
|
66
|
-
if (l(n), o = e._events, o === void 0 ? (o = e._events = Object.create(null), e._eventsCount = 0) : (o.newListener !== void 0 && (e.emit("newListener", t, n.listener ? n.listener : n), o = e._events), s = o[t]), s === void 0) s = o[t] = n, ++e._eventsCount;
|
|
67
|
-
else if (typeof s == "function" ? s = o[t] = r ? [n, s] : [s, n] : r ? s.unshift(n) : s.push(n), i = u(e), i > 0 && s.length > i && !s.warned) {
|
|
68
|
-
s.warned = !0;
|
|
69
|
-
var c = /* @__PURE__ */ Error("Possible EventEmitter memory leak detected. " + s.length + " " + String(t) + " listeners added. Use emitter.setMaxListeners() to increase limit");
|
|
70
|
-
c.name = "MaxListenersExceededWarning", c.emitter = e, c.type = t, c.count = s.length, a(c);
|
|
71
|
-
}
|
|
72
|
-
return e;
|
|
73
|
-
}
|
|
74
|
-
s.prototype.addListener = function(e, t) {
|
|
75
|
-
return d(this, e, t, !1);
|
|
76
|
-
}, s.prototype.on = s.prototype.addListener, s.prototype.prependListener = function(e, t) {
|
|
77
|
-
return d(this, e, t, !0);
|
|
78
|
-
};
|
|
79
|
-
function f() {
|
|
80
|
-
if (!this.fired) return this.target.removeListener(this.type, this.wrapFn), this.fired = !0, arguments.length === 0 ? this.listener.call(this.target) : this.listener.apply(this.target, arguments);
|
|
81
|
-
}
|
|
82
|
-
function p(e, t, n) {
|
|
83
|
-
var r = {
|
|
84
|
-
fired: !1,
|
|
85
|
-
wrapFn: void 0,
|
|
86
|
-
target: e,
|
|
87
|
-
type: t,
|
|
88
|
-
listener: n
|
|
89
|
-
}, i = f.bind(r);
|
|
90
|
-
return i.listener = n, r.wrapFn = i, i;
|
|
91
|
-
}
|
|
92
|
-
s.prototype.once = function(e, t) {
|
|
93
|
-
return l(t), this.on(e, p(this, e, t)), this;
|
|
94
|
-
}, s.prototype.prependOnceListener = function(e, t) {
|
|
95
|
-
return l(t), this.prependListener(e, p(this, e, t)), this;
|
|
96
|
-
}, s.prototype.removeListener = function(e, t) {
|
|
97
|
-
var n, r, i, a, o;
|
|
98
|
-
if (l(t), r = this._events, r === void 0 || (n = r[e], n === void 0)) return this;
|
|
99
|
-
if (n === t || n.listener === t) --this._eventsCount === 0 ? this._events = Object.create(null) : (delete r[e], r.removeListener && this.emit("removeListener", e, n.listener || t));
|
|
100
|
-
else if (typeof n != "function") {
|
|
101
|
-
for (i = -1, a = n.length - 1; a >= 0; a--) if (n[a] === t || n[a].listener === t) {
|
|
102
|
-
o = n[a].listener, i = a;
|
|
103
|
-
break;
|
|
104
|
-
}
|
|
105
|
-
if (i < 0) return this;
|
|
106
|
-
i === 0 ? n.shift() : _(n, i), n.length === 1 && (r[e] = n[0]), r.removeListener !== void 0 && this.emit("removeListener", e, o || t);
|
|
107
|
-
}
|
|
108
|
-
return this;
|
|
109
|
-
}, s.prototype.off = s.prototype.removeListener, s.prototype.removeAllListeners = function(e) {
|
|
110
|
-
var t, n = this._events, r;
|
|
111
|
-
if (n === void 0) return this;
|
|
112
|
-
if (n.removeListener === void 0) return arguments.length === 0 ? (this._events = Object.create(null), this._eventsCount = 0) : n[e] !== void 0 && (--this._eventsCount === 0 ? this._events = Object.create(null) : delete n[e]), this;
|
|
113
|
-
if (arguments.length === 0) {
|
|
114
|
-
var i = Object.keys(n), a;
|
|
115
|
-
for (r = 0; r < i.length; ++r) a = i[r], a !== "removeListener" && this.removeAllListeners(a);
|
|
116
|
-
return this.removeAllListeners("removeListener"), this._events = Object.create(null), this._eventsCount = 0, this;
|
|
117
|
-
}
|
|
118
|
-
if (t = n[e], typeof t == "function") this.removeListener(e, t);
|
|
119
|
-
else if (t !== void 0) for (r = t.length - 1; r >= 0; r--) this.removeListener(e, t[r]);
|
|
120
|
-
return this;
|
|
121
|
-
};
|
|
122
|
-
function m(e, t, n) {
|
|
123
|
-
var r = e._events;
|
|
124
|
-
if (r === void 0) return [];
|
|
125
|
-
var i = r[t];
|
|
126
|
-
return i === void 0 ? [] : typeof i == "function" ? n ? [i.listener || i] : [i] : n ? v(i) : g(i, i.length);
|
|
127
|
-
}
|
|
128
|
-
s.prototype.listeners = function(e) {
|
|
129
|
-
return m(this, e, !0);
|
|
130
|
-
}, s.prototype.rawListeners = function(e) {
|
|
131
|
-
return m(this, e, !1);
|
|
132
|
-
}, s.listenerCount = function(e, t) {
|
|
133
|
-
return typeof e.listenerCount == "function" ? e.listenerCount(t) : h.call(e, t);
|
|
134
|
-
}, s.prototype.listenerCount = h;
|
|
135
|
-
function h(e) {
|
|
136
|
-
var t = this._events;
|
|
137
|
-
if (t !== void 0) {
|
|
138
|
-
var n = t[e];
|
|
139
|
-
if (typeof n == "function") return 1;
|
|
140
|
-
if (n !== void 0) return n.length;
|
|
141
|
-
}
|
|
142
|
-
return 0;
|
|
143
|
-
}
|
|
144
|
-
s.prototype.eventNames = function() {
|
|
145
|
-
return this._eventsCount > 0 ? i(this._events) : [];
|
|
146
|
-
};
|
|
147
|
-
function g(e, t) {
|
|
148
|
-
for (var n = Array(t), r = 0; r < t; ++r) n[r] = e[r];
|
|
149
|
-
return n;
|
|
150
|
-
}
|
|
151
|
-
function _(e, t) {
|
|
152
|
-
for (; t + 1 < e.length; t++) e[t] = e[t + 1];
|
|
153
|
-
e.pop();
|
|
154
|
-
}
|
|
155
|
-
function v(e) {
|
|
156
|
-
for (var t = Array(e.length), n = 0; n < t.length; ++n) t[n] = e[n].listener || e[n];
|
|
157
|
-
return t;
|
|
158
|
-
}
|
|
159
|
-
function y(e, t) {
|
|
160
|
-
return new Promise(function(n, r) {
|
|
161
|
-
function i(n) {
|
|
162
|
-
e.removeListener(t, a), r(n);
|
|
163
|
-
}
|
|
164
|
-
function a() {
|
|
165
|
-
typeof e.removeListener == "function" && e.removeListener("error", i), n([].slice.call(arguments));
|
|
166
|
-
}
|
|
167
|
-
x(e, t, a, { once: !0 }), t !== "error" && b(e, i, { once: !0 });
|
|
168
|
-
});
|
|
169
|
-
}
|
|
170
|
-
function b(e, t, n) {
|
|
171
|
-
typeof e.on == "function" && x(e, "error", t, n);
|
|
172
|
-
}
|
|
173
|
-
function x(e, t, n, r) {
|
|
174
|
-
if (typeof e.on == "function") r.once ? e.once(t, n) : e.on(t, n);
|
|
175
|
-
else if (typeof e.addEventListener == "function") e.addEventListener(t, function i(a) {
|
|
176
|
-
r.once && e.removeEventListener(t, i), n(a);
|
|
177
|
-
});
|
|
178
|
-
else throw TypeError("The \"emitter\" argument must be of type EventEmitter. Received type " + typeof e);
|
|
179
|
-
}
|
|
180
|
-
})), i = /* @__PURE__ */ t(((e, t) => {
|
|
181
|
-
var n = ["out", "err"];
|
|
182
|
-
t.exports = class {
|
|
183
|
-
constructor(e, t) {
|
|
184
|
-
if (!n.includes(e)) throw Error("incorrect std output type");
|
|
185
|
-
this.type = e, this.string = t;
|
|
186
|
-
}
|
|
187
|
-
};
|
|
188
|
-
})), a = /* @__PURE__ */ t(((e, t) => {
|
|
189
|
-
var n = i();
|
|
190
|
-
t.exports = class {
|
|
191
|
-
constructor(e = [], t = 0) {
|
|
192
|
-
if (typeof t != "number") throw Error("Command Result ExitCode must be a number");
|
|
193
|
-
if (!Array.isArray(e)) throw Error("Command Result be array");
|
|
194
|
-
this.std = e, this.exitCode = t;
|
|
195
|
-
}
|
|
196
|
-
addStdOutLine(e) {
|
|
197
|
-
this.std.push(new n("out", e));
|
|
198
|
-
}
|
|
199
|
-
addStdErrLine(e) {
|
|
200
|
-
this.std.push(new n("err", e));
|
|
201
|
-
}
|
|
202
|
-
getStdOutput() {
|
|
203
|
-
return this.std;
|
|
204
|
-
}
|
|
205
|
-
getExitCode() {
|
|
206
|
-
return this.exitCode;
|
|
207
|
-
}
|
|
208
|
-
flush() {
|
|
209
|
-
let e = this.std;
|
|
210
|
-
return this.std = [], e;
|
|
211
|
-
}
|
|
212
|
-
};
|
|
213
|
-
})), o = /* @__PURE__ */ t(((e, t) => {
|
|
214
|
-
var n = r(), i = a(), o = n.EventEmitter || n.default || n;
|
|
215
|
-
t.exports = class extends o {
|
|
216
|
-
constructor(e, t) {
|
|
217
|
-
super(), this.arguments = e, this.result = new i(), this.context = t || null;
|
|
218
|
-
}
|
|
219
|
-
get name() {
|
|
220
|
-
return "unnamed";
|
|
221
|
-
}
|
|
222
|
-
run() {
|
|
223
|
-
return Promise.reject("Command not implemented...");
|
|
224
|
-
}
|
|
225
|
-
runCommand() {
|
|
226
|
-
return Promise.resolve().then(() => this.run()).then((e) => (e && e.split(/\r?\n/).forEach((e) => this.stdOut = e), this.result)).catch((e) => {
|
|
227
|
-
if (e && e.__type) throw e;
|
|
228
|
-
return e && (this.stdErr = e.message || e), this.exitCode = 127, this.result;
|
|
229
|
-
});
|
|
230
|
-
}
|
|
231
|
-
onInput(e) {}
|
|
232
|
-
set exitCode(e) {
|
|
233
|
-
this.result.exitCode = e;
|
|
234
|
-
}
|
|
235
|
-
set stdOut(e) {
|
|
236
|
-
this.result.addStdOutLine(e);
|
|
237
|
-
}
|
|
238
|
-
set stdErr(e) {
|
|
239
|
-
this.result.addStdErrLine(e);
|
|
240
|
-
}
|
|
241
|
-
flush() {
|
|
242
|
-
this.emit("flush", this.result.flush());
|
|
243
|
-
}
|
|
244
|
-
};
|
|
245
|
-
})), s = /* @__PURE__ */ t(((e, t) => {
|
|
246
|
-
var n = o();
|
|
247
|
-
t.exports = class extends n {
|
|
248
|
-
constructor(e, t) {
|
|
249
|
-
super(e, t);
|
|
250
|
-
}
|
|
251
|
-
};
|
|
252
|
-
}));
|
|
5
|
+
});
|
|
253
6
|
//#endregion
|
|
254
7
|
//#region node_modules/vite-plugin-node-polyfills/shims/buffer/dist/index.js
|
|
255
|
-
function
|
|
8
|
+
function r(e) {
|
|
256
9
|
var t = e.length;
|
|
257
10
|
if (t % 4 > 0) throw Error("Invalid string. Length must be a multiple of 4");
|
|
258
11
|
var n = e.indexOf("=");
|
|
@@ -260,32 +13,32 @@ function c(e) {
|
|
|
260
13
|
var r = n === t ? 0 : 4 - n % 4;
|
|
261
14
|
return [n, r];
|
|
262
15
|
}
|
|
263
|
-
function
|
|
264
|
-
var t =
|
|
265
|
-
return (n +
|
|
16
|
+
function i(e) {
|
|
17
|
+
var t = r(e), n = t[0], i = t[1];
|
|
18
|
+
return (n + i) * 3 / 4 - i;
|
|
266
19
|
}
|
|
267
|
-
function
|
|
20
|
+
function a(e, t, n) {
|
|
268
21
|
return (t + n) * 3 / 4 - n;
|
|
269
22
|
}
|
|
270
|
-
function
|
|
271
|
-
var t, n =
|
|
272
|
-
for (
|
|
273
|
-
return
|
|
23
|
+
function o(e) {
|
|
24
|
+
var t, n = r(e), i = n[0], o = n[1], s = new m(a(e, i, o)), c = 0, l = o > 0 ? i - 4 : i, u;
|
|
25
|
+
for (u = 0; u < l; u += 4) t = p[e.charCodeAt(u)] << 18 | p[e.charCodeAt(u + 1)] << 12 | p[e.charCodeAt(u + 2)] << 6 | p[e.charCodeAt(u + 3)], s[c++] = t >> 16 & 255, s[c++] = t >> 8 & 255, s[c++] = t & 255;
|
|
26
|
+
return o === 2 && (t = p[e.charCodeAt(u)] << 2 | p[e.charCodeAt(u + 1)] >> 4, s[c++] = t & 255), o === 1 && (t = p[e.charCodeAt(u)] << 10 | p[e.charCodeAt(u + 1)] << 4 | p[e.charCodeAt(u + 2)] >> 2, s[c++] = t >> 8 & 255, s[c++] = t & 255), s;
|
|
274
27
|
}
|
|
275
|
-
function
|
|
276
|
-
return
|
|
28
|
+
function s(e) {
|
|
29
|
+
return f[e >> 18 & 63] + f[e >> 12 & 63] + f[e >> 6 & 63] + f[e & 63];
|
|
277
30
|
}
|
|
278
|
-
function
|
|
279
|
-
for (var r, i = [], a = t; a < n; a += 3) r = (e[a] << 16 & 16711680) + (e[a + 1] << 8 & 65280) + (e[a + 2] & 255), i.push(
|
|
31
|
+
function c(e, t, n) {
|
|
32
|
+
for (var r, i = [], a = t; a < n; a += 3) r = (e[a] << 16 & 16711680) + (e[a + 1] << 8 & 65280) + (e[a + 2] & 255), i.push(s(r));
|
|
280
33
|
return i.join("");
|
|
281
34
|
}
|
|
282
|
-
function
|
|
283
|
-
for (var t, n = e.length, r = n % 3, i = [], a = 16383, o = 0, s = n - r; o < s; o += a) i.push(
|
|
284
|
-
return r === 1 ? (t = e[n - 1], i.push(
|
|
35
|
+
function l(e) {
|
|
36
|
+
for (var t, n = e.length, r = n % 3, i = [], a = 16383, o = 0, s = n - r; o < s; o += a) i.push(c(e, o, o + a > s ? s : o + a));
|
|
37
|
+
return r === 1 ? (t = e[n - 1], i.push(f[t >> 2] + f[t << 4 & 63] + "==")) : r === 2 && (t = (e[n - 2] << 8) + e[n - 1], i.push(f[t >> 10] + f[t >> 4 & 63] + f[t << 2 & 63] + "=")), i.join("");
|
|
285
38
|
}
|
|
286
|
-
var
|
|
287
|
-
for (
|
|
288
|
-
|
|
39
|
+
var u, d, f, p, m, h, g, _, v, y, b = e((() => {
|
|
40
|
+
for (u = {}, d = {}, d.byteLength = i, d.toByteArray = o, d.fromByteArray = l, f = [], p = [], m = typeof Uint8Array < "u" ? Uint8Array : Array, h = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", g = 0, _ = h.length; g < _; ++g) f[g] = h[g], p[h.charCodeAt(g)] = g;
|
|
41
|
+
p[45] = 62, p[95] = 63, v = {}, v.read = function(e, t, n, r, i) {
|
|
289
42
|
var a, o, s = i * 8 - r - 1, c = (1 << s) - 1, l = c >> 1, u = -7, d = n ? i - 1 : 0, f = n ? -1 : 1, p = e[t + d];
|
|
290
43
|
for (d += f, a = p & (1 << -u) - 1, p >>= -u, u += s; u > 0; a = a * 256 + e[t + d], d += f, u -= 8);
|
|
291
44
|
for (o = a & (1 << -u) - 1, a >>= -u, u += r; u > 0; o = o * 256 + e[t + d], d += f, u -= 8);
|
|
@@ -293,14 +46,14 @@ var h, g, _, v, y, b, x, S, C, w, T = e((() => {
|
|
|
293
46
|
else if (a === c) return o ? NaN : (p ? -1 : 1) * Infinity;
|
|
294
47
|
else o += 2 ** r, a -= l;
|
|
295
48
|
return (p ? -1 : 1) * o * 2 ** (a - r);
|
|
296
|
-
},
|
|
49
|
+
}, v.write = function(e, t, n, r, i, a) {
|
|
297
50
|
var o, s, c, l = a * 8 - i - 1, u = (1 << l) - 1, d = u >> 1, f = i === 23 ? 2 ** -24 - 2 ** -77 : 0, p = r ? 0 : a - 1, m = r ? 1 : -1, h = +(t < 0 || t === 0 && 1 / t < 0);
|
|
298
51
|
for (t = Math.abs(t), isNaN(t) || t === Infinity ? (s = +!!isNaN(t), o = u) : (o = Math.floor(Math.log(t) / Math.LN2), t * (c = 2 ** -o) < 1 && (o--, c *= 2), o + d >= 1 ? t += f / c : t += f * 2 ** (1 - d), t * c >= 2 && (o++, c /= 2), o + d >= u ? (s = 0, o = u) : o + d >= 1 ? (s = (t * c - 1) * 2 ** i, o += d) : (s = t * 2 ** (d - 1) * 2 ** i, o = 0)); i >= 8; e[n + p] = s & 255, p += m, s /= 256, i -= 8);
|
|
299
52
|
for (o = o << i | s, l += i; l > 0; e[n + p] = o & 255, p += m, o /= 256, l -= 8);
|
|
300
53
|
e[n + p - m] |= h * 128;
|
|
301
54
|
}, (function(e) {
|
|
302
|
-
let t =
|
|
303
|
-
e.Buffer = u, e.SlowBuffer =
|
|
55
|
+
let t = d, n = v, r = typeof Symbol == "function" && typeof Symbol.for == "function" ? Symbol.for("nodejs.util.inspect.custom") : null;
|
|
56
|
+
e.Buffer = u, e.SlowBuffer = C, e.INSPECT_MAX_BYTES = 50;
|
|
304
57
|
let i = 2147483647;
|
|
305
58
|
e.kMaxLength = i;
|
|
306
59
|
let { Uint8Array: a, ArrayBuffer: o, SharedArrayBuffer: s } = globalThis;
|
|
@@ -334,81 +87,81 @@ var h, g, _, v, y, b, x, S, C, w, T = e((() => {
|
|
|
334
87
|
function u(e, t, n) {
|
|
335
88
|
if (typeof e == "number") {
|
|
336
89
|
if (typeof t == "string") throw TypeError("The \"string\" argument must be of type string. Received type number");
|
|
337
|
-
return
|
|
90
|
+
return h(e);
|
|
338
91
|
}
|
|
339
|
-
return
|
|
92
|
+
return f(e, t, n);
|
|
340
93
|
}
|
|
341
94
|
u.poolSize = 8192;
|
|
342
|
-
function
|
|
343
|
-
if (typeof e == "string") return
|
|
344
|
-
if (o.isView(e)) return
|
|
95
|
+
function f(e, t, n) {
|
|
96
|
+
if (typeof e == "string") return g(e, t);
|
|
97
|
+
if (o.isView(e)) return y(e);
|
|
345
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);
|
|
346
|
-
if (Q(e, o) || e && Q(e.buffer, o) || s !== void 0 && (Q(e, s) || e && Q(e.buffer, s))) return
|
|
99
|
+
if (Q(e, o) || e && Q(e.buffer, o) || s !== void 0 && (Q(e, s) || e && Q(e.buffer, s))) return b(e, t, n);
|
|
347
100
|
if (typeof e == "number") throw TypeError("The \"value\" argument must not be of type number. Received type number");
|
|
348
101
|
let r = e.valueOf && e.valueOf();
|
|
349
102
|
if (r != null && r !== e) return u.from(r, t, n);
|
|
350
|
-
let i =
|
|
103
|
+
let i = x(e);
|
|
351
104
|
if (i) return i;
|
|
352
105
|
if (typeof Symbol < "u" && Symbol.toPrimitive != null && typeof e[Symbol.toPrimitive] == "function") return u.from(e[Symbol.toPrimitive]("string"), t, n);
|
|
353
106
|
throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type " + typeof e);
|
|
354
107
|
}
|
|
355
108
|
u.from = function(e, t, n) {
|
|
356
|
-
return
|
|
109
|
+
return f(e, t, n);
|
|
357
110
|
}, Object.setPrototypeOf(u.prototype, a.prototype), Object.setPrototypeOf(u, a);
|
|
358
|
-
function
|
|
111
|
+
function p(e) {
|
|
359
112
|
if (typeof e != "number") throw TypeError("\"size\" argument must be of type number");
|
|
360
113
|
if (e < 0) throw RangeError("The value \"" + e + "\" is invalid for option \"size\"");
|
|
361
114
|
}
|
|
362
|
-
function
|
|
363
|
-
return
|
|
115
|
+
function m(e, t, n) {
|
|
116
|
+
return p(e), e <= 0 || t === void 0 ? l(e) : typeof n == "string" ? l(e).fill(t, n) : l(e).fill(t);
|
|
364
117
|
}
|
|
365
118
|
u.alloc = function(e, t, n) {
|
|
366
|
-
return
|
|
119
|
+
return m(e, t, n);
|
|
367
120
|
};
|
|
368
|
-
function
|
|
369
|
-
return
|
|
121
|
+
function h(e) {
|
|
122
|
+
return p(e), l(e < 0 ? 0 : S(e) | 0);
|
|
370
123
|
}
|
|
371
124
|
u.allocUnsafe = function(e) {
|
|
372
|
-
return
|
|
125
|
+
return h(e);
|
|
373
126
|
}, u.allocUnsafeSlow = function(e) {
|
|
374
|
-
return
|
|
127
|
+
return h(e);
|
|
375
128
|
};
|
|
376
|
-
function
|
|
129
|
+
function g(e, t) {
|
|
377
130
|
if ((typeof t != "string" || t === "") && (t = "utf8"), !u.isEncoding(t)) throw TypeError("Unknown encoding: " + t);
|
|
378
131
|
let n = w(e, t) | 0, r = l(n), i = r.write(e, t);
|
|
379
132
|
return i !== n && (r = r.slice(0, i)), r;
|
|
380
133
|
}
|
|
381
134
|
function _(e) {
|
|
382
|
-
let t = e.length < 0 ? 0 :
|
|
135
|
+
let t = e.length < 0 ? 0 : S(e.length) | 0, n = l(t);
|
|
383
136
|
for (let r = 0; r < t; r += 1) n[r] = e[r] & 255;
|
|
384
137
|
return n;
|
|
385
138
|
}
|
|
386
|
-
function
|
|
139
|
+
function y(e) {
|
|
387
140
|
if (Q(e, a)) {
|
|
388
141
|
let t = new a(e);
|
|
389
|
-
return
|
|
142
|
+
return b(t.buffer, t.byteOffset, t.byteLength);
|
|
390
143
|
}
|
|
391
144
|
return _(e);
|
|
392
145
|
}
|
|
393
|
-
function
|
|
146
|
+
function b(e, t, n) {
|
|
394
147
|
if (t < 0 || e.byteLength < t) throw RangeError("\"offset\" is outside of buffer bounds");
|
|
395
148
|
if (e.byteLength < t + (n || 0)) throw RangeError("\"length\" is outside of buffer bounds");
|
|
396
149
|
let r;
|
|
397
150
|
return r = t === void 0 && n === void 0 ? new a(e) : n === void 0 ? new a(e, t) : new a(e, t, n), Object.setPrototypeOf(r, u.prototype), r;
|
|
398
151
|
}
|
|
399
|
-
function
|
|
152
|
+
function x(e) {
|
|
400
153
|
if (u.isBuffer(e)) {
|
|
401
|
-
let t =
|
|
154
|
+
let t = S(e.length) | 0, n = l(t);
|
|
402
155
|
return n.length === 0 || e.copy(n, 0, 0, t), n;
|
|
403
156
|
}
|
|
404
157
|
if (e.length !== void 0) return typeof e.length != "number" || de(e.length) ? l(0) : _(e);
|
|
405
158
|
if (e.type === "Buffer" && Array.isArray(e.data)) return _(e.data);
|
|
406
159
|
}
|
|
407
|
-
function
|
|
160
|
+
function S(e) {
|
|
408
161
|
if (e >= i) throw RangeError("Attempt to allocate Buffer larger than maximum size: 0x" + i.toString(16) + " bytes");
|
|
409
162
|
return e | 0;
|
|
410
163
|
}
|
|
411
|
-
function
|
|
164
|
+
function C(e) {
|
|
412
165
|
return +e != e && (e = 0), u.alloc(+e);
|
|
413
166
|
}
|
|
414
167
|
u.isBuffer = function(e) {
|
|
@@ -825,7 +578,7 @@ var h, g, _, v, y, b, x, S, C, w, T = e((() => {
|
|
|
825
578
|
let o = Number(t >> BigInt(32) & BigInt(4294967295));
|
|
826
579
|
return e[n++] = o, o >>= 8, e[n++] = o, o >>= 8, e[n++] = o, o >>= 8, e[n++] = o, n;
|
|
827
580
|
}
|
|
828
|
-
function
|
|
581
|
+
function G(e, t, n, r, i) {
|
|
829
582
|
Y(t, r, i, e, n, 7);
|
|
830
583
|
let a = Number(t & BigInt(4294967295));
|
|
831
584
|
e[n + 7] = a, a >>= 8, e[n + 6] = a, a >>= 8, e[n + 5] = a, a >>= 8, e[n + 4] = a;
|
|
@@ -835,7 +588,7 @@ var h, g, _, v, y, b, x, S, C, w, T = e((() => {
|
|
|
835
588
|
u.prototype.writeBigUInt64LE = $(function(e, t = 0) {
|
|
836
589
|
return W(this, e, t, BigInt(0), BigInt("0xffffffffffffffff"));
|
|
837
590
|
}), u.prototype.writeBigUInt64BE = $(function(e, t = 0) {
|
|
838
|
-
return
|
|
591
|
+
return G(this, e, t, BigInt(0), BigInt("0xffffffffffffffff"));
|
|
839
592
|
}), u.prototype.writeIntLE = function(e, t, n, r) {
|
|
840
593
|
if (e = +e, t >>>= 0, !r) {
|
|
841
594
|
let r = 2 ** (8 * n - 1);
|
|
@@ -865,26 +618,26 @@ var h, g, _, v, y, b, x, S, C, w, T = e((() => {
|
|
|
865
618
|
}, u.prototype.writeBigInt64LE = $(function(e, t = 0) {
|
|
866
619
|
return W(this, e, t, -BigInt("0x8000000000000000"), BigInt("0x7fffffffffffffff"));
|
|
867
620
|
}), u.prototype.writeBigInt64BE = $(function(e, t = 0) {
|
|
868
|
-
return
|
|
621
|
+
return G(this, e, t, -BigInt("0x8000000000000000"), BigInt("0x7fffffffffffffff"));
|
|
869
622
|
});
|
|
870
|
-
function
|
|
623
|
+
function K(e, t, n, r, i, a) {
|
|
871
624
|
if (n + r > e.length || n < 0) throw RangeError("Index out of range");
|
|
872
625
|
}
|
|
873
|
-
function
|
|
874
|
-
return t = +t, r >>>= 0, a ||
|
|
626
|
+
function ee(e, t, r, i, a) {
|
|
627
|
+
return t = +t, r >>>= 0, a || K(e, t, r, 4), n.write(e, t, r, i, 23, 4), r + 4;
|
|
875
628
|
}
|
|
876
629
|
u.prototype.writeFloatLE = function(e, t, n) {
|
|
877
|
-
return
|
|
630
|
+
return ee(this, e, t, !0, n);
|
|
878
631
|
}, u.prototype.writeFloatBE = function(e, t, n) {
|
|
879
|
-
return
|
|
632
|
+
return ee(this, e, t, !1, n);
|
|
880
633
|
};
|
|
881
|
-
function
|
|
882
|
-
return t = +t, r >>>= 0, a ||
|
|
634
|
+
function te(e, t, r, i, a) {
|
|
635
|
+
return t = +t, r >>>= 0, a || K(e, t, r, 8), n.write(e, t, r, i, 52, 8), r + 8;
|
|
883
636
|
}
|
|
884
637
|
u.prototype.writeDoubleLE = function(e, t, n) {
|
|
885
|
-
return
|
|
638
|
+
return te(this, e, t, !0, n);
|
|
886
639
|
}, u.prototype.writeDoubleBE = function(e, t, n) {
|
|
887
|
-
return
|
|
640
|
+
return te(this, e, t, !1, n);
|
|
888
641
|
}, u.prototype.copy = function(e, t, n, r) {
|
|
889
642
|
if (!u.isBuffer(e)) throw TypeError("argument should be a Buffer");
|
|
890
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;
|
|
@@ -915,9 +668,9 @@ var h, g, _, v, y, b, x, S, C, w, T = e((() => {
|
|
|
915
668
|
}
|
|
916
669
|
return this;
|
|
917
670
|
};
|
|
918
|
-
let
|
|
919
|
-
function
|
|
920
|
-
|
|
671
|
+
let q = {};
|
|
672
|
+
function ne(e, t, n) {
|
|
673
|
+
q[e] = class extends n {
|
|
921
674
|
constructor() {
|
|
922
675
|
super(), Object.defineProperty(this, "message", {
|
|
923
676
|
value: t.apply(this, arguments),
|
|
@@ -941,11 +694,11 @@ var h, g, _, v, y, b, x, S, C, w, T = e((() => {
|
|
|
941
694
|
}
|
|
942
695
|
};
|
|
943
696
|
}
|
|
944
|
-
|
|
697
|
+
ne("ERR_BUFFER_OUT_OF_BOUNDS", function(e) {
|
|
945
698
|
return e ? `${e} is outside of buffer bounds` : "Attempt to access memory outside buffer bounds";
|
|
946
|
-
}, RangeError),
|
|
699
|
+
}, RangeError), ne("ERR_INVALID_ARG_TYPE", function(e, t) {
|
|
947
700
|
return `The "${e}" argument must be of type number. Received type ${typeof t}`;
|
|
948
|
-
}, TypeError),
|
|
701
|
+
}, TypeError), ne("ERR_OUT_OF_RANGE", function(e, t, n) {
|
|
949
702
|
let r = `The value of "${e}" is out of range.`, i = n;
|
|
950
703
|
return Number.isInteger(n) && Math.abs(n) > 2 ** 32 ? i = J(String(n)) : typeof n == "bigint" && (i = String(n), (n > BigInt(2) ** BigInt(32) || n < -(BigInt(2) ** BigInt(32))) && (i = J(i)), i += "n"), r += ` It must be ${t}. Received ${i}`, r;
|
|
951
704
|
}, RangeError);
|
|
@@ -960,15 +713,15 @@ var h, g, _, v, y, b, x, S, C, w, T = e((() => {
|
|
|
960
713
|
function Y(e, t, n, r, i, a) {
|
|
961
714
|
if (e > n || e < t) {
|
|
962
715
|
let r = typeof t == "bigint" ? "n" : "", i;
|
|
963
|
-
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 q.ERR_OUT_OF_RANGE("value", i, e);
|
|
964
717
|
}
|
|
965
718
|
re(r, i, a);
|
|
966
719
|
}
|
|
967
720
|
function X(e, t) {
|
|
968
|
-
if (typeof e != "number") throw new
|
|
721
|
+
if (typeof e != "number") throw new q.ERR_INVALID_ARG_TYPE(t, "number", e);
|
|
969
722
|
}
|
|
970
723
|
function Z(e, t, n) {
|
|
971
|
-
throw Math.floor(e) === e ? t < 0 ? new
|
|
724
|
+
throw Math.floor(e) === e ? t < 0 ? new q.ERR_BUFFER_OUT_OF_BOUNDS() : new q.ERR_OUT_OF_RANGE(n || "offset", `>= ${+!!n} and <= ${t}`, e) : (X(e, n), new q.ERR_OUT_OF_RANGE(n || "offset", "an integer", e));
|
|
972
725
|
}
|
|
973
726
|
let ie = /[^+/0-9A-Za-z-_]/g;
|
|
974
727
|
function ae(e) {
|
|
@@ -1052,14 +805,261 @@ var h, g, _, v, y, b, x, S, C, w, T = e((() => {
|
|
|
1052
805
|
function pe() {
|
|
1053
806
|
throw Error("BigInt not supported");
|
|
1054
807
|
}
|
|
1055
|
-
})(
|
|
1056
|
-
})),
|
|
1057
|
-
var n =
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
808
|
+
})(u), y = u.Buffer, u.Blob, u.BlobOptions, u.Buffer, u.File, u.FileOptions, u.INSPECT_MAX_BYTES, u.SlowBuffer, u.TranscodeEncoding, u.atob, u.btoa, u.constants, u.isAscii, u.isUtf8, u.kMaxLength, u.kStringMaxLength, u.resolveObjectURL, u.transcode;
|
|
809
|
+
})), x = /* @__PURE__ */ t(((e, t) => {
|
|
810
|
+
var n = typeof Reflect == "object" ? Reflect : null, r = n && typeof n.apply == "function" ? n.apply : function(e, t, n) {
|
|
811
|
+
return Function.prototype.apply.call(e, t, n);
|
|
812
|
+
}, i = n && typeof n.ownKeys == "function" ? n.ownKeys : Object.getOwnPropertySymbols ? function(e) {
|
|
813
|
+
return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e));
|
|
814
|
+
} : function(e) {
|
|
815
|
+
return Object.getOwnPropertyNames(e);
|
|
816
|
+
};
|
|
817
|
+
function a(e) {
|
|
818
|
+
console && console.warn && console.warn(e);
|
|
819
|
+
}
|
|
820
|
+
var o = Number.isNaN || function(e) {
|
|
821
|
+
return e !== e;
|
|
822
|
+
};
|
|
823
|
+
function s() {
|
|
824
|
+
s.init.call(this);
|
|
825
|
+
}
|
|
826
|
+
t.exports = s, t.exports.once = y, s.EventEmitter = s, s.prototype._events = void 0, s.prototype._eventsCount = 0, s.prototype._maxListeners = void 0;
|
|
827
|
+
var c = 10;
|
|
828
|
+
function l(e) {
|
|
829
|
+
if (typeof e != "function") throw TypeError("The \"listener\" argument must be of type Function. Received type " + typeof e);
|
|
830
|
+
}
|
|
831
|
+
Object.defineProperty(s, "defaultMaxListeners", {
|
|
832
|
+
enumerable: !0,
|
|
833
|
+
get: function() {
|
|
834
|
+
return c;
|
|
835
|
+
},
|
|
836
|
+
set: function(e) {
|
|
837
|
+
if (typeof e != "number" || e < 0 || o(e)) throw RangeError("The value of \"defaultMaxListeners\" is out of range. It must be a non-negative number. Received " + e + ".");
|
|
838
|
+
c = e;
|
|
839
|
+
}
|
|
840
|
+
}), s.init = function() {
|
|
841
|
+
(this._events === void 0 || this._events === Object.getPrototypeOf(this)._events) && (this._events = Object.create(null), this._eventsCount = 0), this._maxListeners = this._maxListeners || void 0;
|
|
842
|
+
}, s.prototype.setMaxListeners = function(e) {
|
|
843
|
+
if (typeof e != "number" || e < 0 || o(e)) throw RangeError("The value of \"n\" is out of range. It must be a non-negative number. Received " + e + ".");
|
|
844
|
+
return this._maxListeners = e, this;
|
|
845
|
+
};
|
|
846
|
+
function u(e) {
|
|
847
|
+
return e._maxListeners === void 0 ? s.defaultMaxListeners : e._maxListeners;
|
|
848
|
+
}
|
|
849
|
+
s.prototype.getMaxListeners = function() {
|
|
850
|
+
return u(this);
|
|
851
|
+
}, s.prototype.emit = function(e) {
|
|
852
|
+
for (var t = [], n = 1; n < arguments.length; n++) t.push(arguments[n]);
|
|
853
|
+
var i = e === "error", a = this._events;
|
|
854
|
+
if (a !== void 0) i &&= a.error === void 0;
|
|
855
|
+
else if (!i) return !1;
|
|
856
|
+
if (i) {
|
|
857
|
+
var o;
|
|
858
|
+
if (t.length > 0 && (o = t[0]), o instanceof Error) throw o;
|
|
859
|
+
var s = /* @__PURE__ */ Error("Unhandled error." + (o ? " (" + o.message + ")" : ""));
|
|
860
|
+
throw s.context = o, s;
|
|
861
|
+
}
|
|
862
|
+
var c = a[e];
|
|
863
|
+
if (c === void 0) return !1;
|
|
864
|
+
if (typeof c == "function") r(c, this, t);
|
|
865
|
+
else for (var l = c.length, u = g(c, l), n = 0; n < l; ++n) r(u[n], this, t);
|
|
866
|
+
return !0;
|
|
867
|
+
};
|
|
868
|
+
function d(e, t, n, r) {
|
|
869
|
+
var i, o, s;
|
|
870
|
+
if (l(n), o = e._events, o === void 0 ? (o = e._events = Object.create(null), e._eventsCount = 0) : (o.newListener !== void 0 && (e.emit("newListener", t, n.listener ? n.listener : n), o = e._events), s = o[t]), s === void 0) s = o[t] = n, ++e._eventsCount;
|
|
871
|
+
else if (typeof s == "function" ? s = o[t] = r ? [n, s] : [s, n] : r ? s.unshift(n) : s.push(n), i = u(e), i > 0 && s.length > i && !s.warned) {
|
|
872
|
+
s.warned = !0;
|
|
873
|
+
var c = /* @__PURE__ */ Error("Possible EventEmitter memory leak detected. " + s.length + " " + String(t) + " listeners added. Use emitter.setMaxListeners() to increase limit");
|
|
874
|
+
c.name = "MaxListenersExceededWarning", c.emitter = e, c.type = t, c.count = s.length, a(c);
|
|
875
|
+
}
|
|
876
|
+
return e;
|
|
877
|
+
}
|
|
878
|
+
s.prototype.addListener = function(e, t) {
|
|
879
|
+
return d(this, e, t, !1);
|
|
880
|
+
}, s.prototype.on = s.prototype.addListener, s.prototype.prependListener = function(e, t) {
|
|
881
|
+
return d(this, e, t, !0);
|
|
882
|
+
};
|
|
883
|
+
function f() {
|
|
884
|
+
if (!this.fired) return this.target.removeListener(this.type, this.wrapFn), this.fired = !0, arguments.length === 0 ? this.listener.call(this.target) : this.listener.apply(this.target, arguments);
|
|
885
|
+
}
|
|
886
|
+
function p(e, t, n) {
|
|
887
|
+
var r = {
|
|
888
|
+
fired: !1,
|
|
889
|
+
wrapFn: void 0,
|
|
890
|
+
target: e,
|
|
891
|
+
type: t,
|
|
892
|
+
listener: n
|
|
893
|
+
}, i = f.bind(r);
|
|
894
|
+
return i.listener = n, r.wrapFn = i, i;
|
|
895
|
+
}
|
|
896
|
+
s.prototype.once = function(e, t) {
|
|
897
|
+
return l(t), this.on(e, p(this, e, t)), this;
|
|
898
|
+
}, s.prototype.prependOnceListener = function(e, t) {
|
|
899
|
+
return l(t), this.prependListener(e, p(this, e, t)), this;
|
|
900
|
+
}, s.prototype.removeListener = function(e, t) {
|
|
901
|
+
var n, r, i, a, o;
|
|
902
|
+
if (l(t), r = this._events, r === void 0 || (n = r[e], n === void 0)) return this;
|
|
903
|
+
if (n === t || n.listener === t) --this._eventsCount === 0 ? this._events = Object.create(null) : (delete r[e], r.removeListener && this.emit("removeListener", e, n.listener || t));
|
|
904
|
+
else if (typeof n != "function") {
|
|
905
|
+
for (i = -1, a = n.length - 1; a >= 0; a--) if (n[a] === t || n[a].listener === t) {
|
|
906
|
+
o = n[a].listener, i = a;
|
|
907
|
+
break;
|
|
908
|
+
}
|
|
909
|
+
if (i < 0) return this;
|
|
910
|
+
i === 0 ? n.shift() : _(n, i), n.length === 1 && (r[e] = n[0]), r.removeListener !== void 0 && this.emit("removeListener", e, o || t);
|
|
911
|
+
}
|
|
912
|
+
return this;
|
|
913
|
+
}, s.prototype.off = s.prototype.removeListener, s.prototype.removeAllListeners = function(e) {
|
|
914
|
+
var t, n = this._events, r;
|
|
915
|
+
if (n === void 0) return this;
|
|
916
|
+
if (n.removeListener === void 0) return arguments.length === 0 ? (this._events = Object.create(null), this._eventsCount = 0) : n[e] !== void 0 && (--this._eventsCount === 0 ? this._events = Object.create(null) : delete n[e]), this;
|
|
917
|
+
if (arguments.length === 0) {
|
|
918
|
+
var i = Object.keys(n), a;
|
|
919
|
+
for (r = 0; r < i.length; ++r) a = i[r], a !== "removeListener" && this.removeAllListeners(a);
|
|
920
|
+
return this.removeAllListeners("removeListener"), this._events = Object.create(null), this._eventsCount = 0, this;
|
|
921
|
+
}
|
|
922
|
+
if (t = n[e], typeof t == "function") this.removeListener(e, t);
|
|
923
|
+
else if (t !== void 0) for (r = t.length - 1; r >= 0; r--) this.removeListener(e, t[r]);
|
|
924
|
+
return this;
|
|
925
|
+
};
|
|
926
|
+
function m(e, t, n) {
|
|
927
|
+
var r = e._events;
|
|
928
|
+
if (r === void 0) return [];
|
|
929
|
+
var i = r[t];
|
|
930
|
+
return i === void 0 ? [] : typeof i == "function" ? n ? [i.listener || i] : [i] : n ? v(i) : g(i, i.length);
|
|
931
|
+
}
|
|
932
|
+
s.prototype.listeners = function(e) {
|
|
933
|
+
return m(this, e, !0);
|
|
934
|
+
}, s.prototype.rawListeners = function(e) {
|
|
935
|
+
return m(this, e, !1);
|
|
936
|
+
}, s.listenerCount = function(e, t) {
|
|
937
|
+
return typeof e.listenerCount == "function" ? e.listenerCount(t) : h.call(e, t);
|
|
938
|
+
}, s.prototype.listenerCount = h;
|
|
939
|
+
function h(e) {
|
|
940
|
+
var t = this._events;
|
|
941
|
+
if (t !== void 0) {
|
|
942
|
+
var n = t[e];
|
|
943
|
+
if (typeof n == "function") return 1;
|
|
944
|
+
if (n !== void 0) return n.length;
|
|
945
|
+
}
|
|
946
|
+
return 0;
|
|
947
|
+
}
|
|
948
|
+
s.prototype.eventNames = function() {
|
|
949
|
+
return this._eventsCount > 0 ? i(this._events) : [];
|
|
950
|
+
};
|
|
951
|
+
function g(e, t) {
|
|
952
|
+
for (var n = Array(t), r = 0; r < t; ++r) n[r] = e[r];
|
|
953
|
+
return n;
|
|
954
|
+
}
|
|
955
|
+
function _(e, t) {
|
|
956
|
+
for (; t + 1 < e.length; t++) e[t] = e[t + 1];
|
|
957
|
+
e.pop();
|
|
958
|
+
}
|
|
959
|
+
function v(e) {
|
|
960
|
+
for (var t = Array(e.length), n = 0; n < t.length; ++n) t[n] = e[n].listener || e[n];
|
|
961
|
+
return t;
|
|
962
|
+
}
|
|
963
|
+
function y(e, t) {
|
|
964
|
+
return new Promise(function(n, r) {
|
|
965
|
+
function i(n) {
|
|
966
|
+
e.removeListener(t, a), r(n);
|
|
967
|
+
}
|
|
968
|
+
function a() {
|
|
969
|
+
typeof e.removeListener == "function" && e.removeListener("error", i), n([].slice.call(arguments));
|
|
970
|
+
}
|
|
971
|
+
x(e, t, a, { once: !0 }), t !== "error" && b(e, i, { once: !0 });
|
|
972
|
+
});
|
|
973
|
+
}
|
|
974
|
+
function b(e, t, n) {
|
|
975
|
+
typeof e.on == "function" && x(e, "error", t, n);
|
|
976
|
+
}
|
|
977
|
+
function x(e, t, n, r) {
|
|
978
|
+
if (typeof e.on == "function") r.once ? e.once(t, n) : e.on(t, n);
|
|
979
|
+
else if (typeof e.addEventListener == "function") e.addEventListener(t, function i(a) {
|
|
980
|
+
r.once && e.removeEventListener(t, i), n(a);
|
|
981
|
+
});
|
|
982
|
+
else throw TypeError("The \"emitter\" argument must be of type EventEmitter. Received type " + typeof e);
|
|
983
|
+
}
|
|
984
|
+
})), S = /* @__PURE__ */ t(((e, t) => {
|
|
985
|
+
var n = ["out", "err"];
|
|
986
|
+
t.exports = class {
|
|
987
|
+
constructor(e, t) {
|
|
988
|
+
if (!n.includes(e)) throw Error("incorrect std output type");
|
|
989
|
+
this.type = e, this.string = t;
|
|
990
|
+
}
|
|
991
|
+
};
|
|
992
|
+
})), C = /* @__PURE__ */ t(((e, t) => {
|
|
993
|
+
var n = S();
|
|
994
|
+
t.exports = class {
|
|
995
|
+
constructor(e = [], t = 0) {
|
|
996
|
+
if (typeof t != "number") throw Error("Command Result ExitCode must be a number");
|
|
997
|
+
if (!Array.isArray(e)) throw Error("Command Result be array");
|
|
998
|
+
this.std = e, this.exitCode = t;
|
|
999
|
+
}
|
|
1000
|
+
addStdOutLine(e) {
|
|
1001
|
+
this.std.push(new n("out", e));
|
|
1002
|
+
}
|
|
1003
|
+
addStdErrLine(e) {
|
|
1004
|
+
this.std.push(new n("err", e));
|
|
1005
|
+
}
|
|
1006
|
+
getStdOutput() {
|
|
1007
|
+
return this.std;
|
|
1008
|
+
}
|
|
1009
|
+
getExitCode() {
|
|
1010
|
+
return this.exitCode;
|
|
1011
|
+
}
|
|
1012
|
+
flush() {
|
|
1013
|
+
let e = this.std;
|
|
1014
|
+
return this.std = [], e;
|
|
1015
|
+
}
|
|
1016
|
+
};
|
|
1017
|
+
})), w = /* @__PURE__ */ t(((e, t) => {
|
|
1018
|
+
var n = x(), r = C(), i = n.EventEmitter || n.default || n;
|
|
1019
|
+
t.exports = class extends i {
|
|
1020
|
+
constructor(e, t) {
|
|
1021
|
+
super(), this.arguments = e, this.result = new r(), this.context = t || null;
|
|
1022
|
+
}
|
|
1023
|
+
get name() {
|
|
1024
|
+
return "unnamed";
|
|
1025
|
+
}
|
|
1026
|
+
run() {
|
|
1027
|
+
return Promise.reject("Command not implemented...");
|
|
1028
|
+
}
|
|
1029
|
+
runCommand() {
|
|
1030
|
+
return Promise.resolve().then(() => this.run()).then((e) => (e && e.split(/\r?\n/).forEach((e) => this.stdOut = e), this.result)).catch((e) => {
|
|
1031
|
+
if (e && e.__type) throw e;
|
|
1032
|
+
return e && (this.stdErr = e.message || e), this.exitCode = 127, this.result;
|
|
1033
|
+
});
|
|
1034
|
+
}
|
|
1035
|
+
onInput(e) {}
|
|
1036
|
+
set exitCode(e) {
|
|
1037
|
+
this.result.exitCode = e;
|
|
1038
|
+
}
|
|
1039
|
+
set stdOut(e) {
|
|
1040
|
+
this.result.addStdOutLine(e);
|
|
1041
|
+
}
|
|
1042
|
+
set stdErr(e) {
|
|
1043
|
+
this.result.addStdErrLine(e);
|
|
1044
|
+
}
|
|
1045
|
+
flush() {
|
|
1046
|
+
this.emit("flush", this.result.flush());
|
|
1047
|
+
}
|
|
1048
|
+
};
|
|
1049
|
+
})), T = /* @__PURE__ */ t(((e, t) => {
|
|
1050
|
+
var n = w();
|
|
1051
|
+
t.exports = class extends n {
|
|
1052
|
+
constructor(e, t) {
|
|
1053
|
+
super(e, t);
|
|
1054
|
+
}
|
|
1055
|
+
};
|
|
1056
|
+
})), E = /* @__PURE__ */ t(((e, t) => {
|
|
1057
|
+
var n = T();
|
|
1058
|
+
function r(e) {
|
|
1059
|
+
return /^#!\/(sh\.js|bin\/(sh|brsh))/.test(e);
|
|
1060
|
+
}
|
|
1061
|
+
t.exports = class extends n {
|
|
1062
|
+
constructor(e, t, n, r = !1) {
|
|
1063
1063
|
super(t, n), this.script = e, this.source = r;
|
|
1064
1064
|
}
|
|
1065
1065
|
get captureInput() {
|
|
@@ -1219,7 +1219,7 @@ var h, g, _, v, y, b, x, S, C, w, T = e((() => {
|
|
|
1219
1219
|
}
|
|
1220
1220
|
_executeNode(e) {
|
|
1221
1221
|
if (e.type === "function") {
|
|
1222
|
-
let t = e.name, n = e.bodyLines, r = this, i =
|
|
1222
|
+
let t = e.name, n = e.bodyLines, r = this, i = T(), a = class extends i {
|
|
1223
1223
|
static get name() {
|
|
1224
1224
|
return t;
|
|
1225
1225
|
}
|
|
@@ -1420,6 +1420,7 @@ var h, g, _, v, y, b, x, S, C, w, T = e((() => {
|
|
|
1420
1420
|
}
|
|
1421
1421
|
}, t.exports.isKnownInterpreter = r;
|
|
1422
1422
|
})), D = /* @__PURE__ */ t(((e, t) => {
|
|
1423
|
+
b();
|
|
1423
1424
|
var n = new Set([
|
|
1424
1425
|
"getFileByPath",
|
|
1425
1426
|
"setFileByPath",
|
|
@@ -1438,8 +1439,7 @@ var h, g, _, v, y, b, x, S, C, w, T = e((() => {
|
|
|
1438
1439
|
"isSymlink",
|
|
1439
1440
|
"readSymlink",
|
|
1440
1441
|
"createSymlink"
|
|
1441
|
-
])
|
|
1442
|
-
t.exports = class {
|
|
1442
|
+
]), r = class {
|
|
1443
1443
|
isReadable(e) {
|
|
1444
1444
|
let t = this.getMode(e);
|
|
1445
1445
|
return t === null ? !1 : (t & 256) != 0;
|
|
@@ -1473,7 +1473,27 @@ var h, g, _, v, y, b, x, S, C, w, T = e((() => {
|
|
|
1473
1473
|
this._changeScheduled = !1, typeof this._onChange == "function" && this._onChange(this.getRaw(), this.getRawPermissions());
|
|
1474
1474
|
}));
|
|
1475
1475
|
}
|
|
1476
|
+
}, i = class extends Uint8Array {
|
|
1477
|
+
constructor(e, t) {
|
|
1478
|
+
super(e), Object.defineProperty(this, "mimeType", {
|
|
1479
|
+
value: t,
|
|
1480
|
+
enumerable: !1,
|
|
1481
|
+
configurable: !1,
|
|
1482
|
+
writable: !1
|
|
1483
|
+
});
|
|
1484
|
+
}
|
|
1485
|
+
toString() {
|
|
1486
|
+
if (y !== void 0) return `data:${this.mimeType};base64,${y.from(this).toString("base64")}`;
|
|
1487
|
+
let e = "", t = 8192;
|
|
1488
|
+
for (let n = 0; n < this.length; n += t) e += String.fromCharCode(...this.subarray(n, n + t));
|
|
1489
|
+
return `data:${this.mimeType};base64,${btoa(e)}`;
|
|
1490
|
+
}
|
|
1491
|
+
}, a = class {
|
|
1492
|
+
constructor(e) {
|
|
1493
|
+
this.target = e;
|
|
1494
|
+
}
|
|
1476
1495
|
};
|
|
1496
|
+
t.exports = r, t.exports.BinaryFile = i, t.exports.SymlinkRef = a;
|
|
1477
1497
|
}));
|
|
1478
1498
|
//#endregion
|
|
1479
1499
|
//#region node_modules/vite-plugin-node-polyfills/shims/process/dist/index.js
|
|
@@ -1530,7 +1550,7 @@ function F(e, t) {
|
|
|
1530
1550
|
this.fun = e, this.array = t;
|
|
1531
1551
|
}
|
|
1532
1552
|
function I() {}
|
|
1533
|
-
var L, R, z, B, V, H, U, W,
|
|
1553
|
+
var L, R, z, B, V, H, U, W, G, K, ee = e((() => {
|
|
1534
1554
|
L = { exports: {} }, R = L.exports = {}, (function() {
|
|
1535
1555
|
try {
|
|
1536
1556
|
z = typeof setTimeout == "function" ? setTimeout : k;
|
|
@@ -1558,9 +1578,9 @@ var L, R, z, B, V, H, U, W, ee, G, te = e((() => {
|
|
|
1558
1578
|
throw Error("process.chdir is not supported");
|
|
1559
1579
|
}, R.umask = function() {
|
|
1560
1580
|
return 0;
|
|
1561
|
-
},
|
|
1562
|
-
})),
|
|
1563
|
-
var n =
|
|
1581
|
+
}, G = L.exports, K = /* @__PURE__ */ O(G);
|
|
1582
|
+
})), te = /* @__PURE__ */ t(((e, t) => {
|
|
1583
|
+
var n = w();
|
|
1564
1584
|
t.exports = class extends n {
|
|
1565
1585
|
get captureInput() {
|
|
1566
1586
|
return !0;
|
|
@@ -1575,27 +1595,27 @@ var L, R, z, B, V, H, U, W, ee, G, te = e((() => {
|
|
|
1575
1595
|
};
|
|
1576
1596
|
}
|
|
1577
1597
|
};
|
|
1578
|
-
})),
|
|
1579
|
-
|
|
1580
|
-
var { BinaryFile: n, SymlinkRef: r } =
|
|
1598
|
+
})), q = /* @__PURE__ */ t(((e, t) => {
|
|
1599
|
+
b(), ee();
|
|
1600
|
+
var { BinaryFile: n, SymlinkRef: r } = D(), i = new Uint8Array([
|
|
1581
1601
|
66,
|
|
1582
1602
|
82,
|
|
1583
1603
|
70,
|
|
1584
1604
|
83
|
|
1585
1605
|
]), a = 2;
|
|
1586
|
-
function
|
|
1606
|
+
function o(e) {
|
|
1587
1607
|
if (!e) return !1;
|
|
1588
1608
|
let t = e instanceof Uint8Array ? e : e instanceof ArrayBuffer || ArrayBuffer.isView(e) ? new Uint8Array(e.buffer || e, e.byteOffset || 0, e.byteLength) : null;
|
|
1589
1609
|
return !t || t.length < 12 ? !1 : t[0] === i[0] && t[1] === i[1] && t[2] === i[2] && t[3] === i[3];
|
|
1590
1610
|
}
|
|
1591
|
-
function
|
|
1611
|
+
function s(e = {}, t = {}, n = {}) {
|
|
1592
1612
|
let o = new TextEncoder(), s = [], c = 0, l = (e) => {
|
|
1593
1613
|
let t = e instanceof Uint8Array ? e : new Uint8Array(e), n = c;
|
|
1594
1614
|
return s.push(t), c += t.byteLength, [n, t.byteLength];
|
|
1595
1615
|
}, u = {}, d = (e, t) => {
|
|
1596
1616
|
if (e == null) return null;
|
|
1597
1617
|
if (e instanceof r) return { $l: e.target };
|
|
1598
|
-
if (e instanceof Uint8Array ||
|
|
1618
|
+
if (e instanceof Uint8Array || y !== void 0 && y.isBuffer(e)) {
|
|
1599
1619
|
let n = e instanceof Uint8Array ? new Uint8Array(e.buffer, e.byteOffset, e.byteLength) : new Uint8Array(e), r = e.mimeType || (t.endsWith(".wasm") ? "application/wasm" : "application/octet-stream"), [i, a] = l(n);
|
|
1600
1620
|
return { $b: [
|
|
1601
1621
|
i,
|
|
@@ -1609,7 +1629,7 @@ var L, R, z, B, V, H, U, W, ee, G, te = e((() => {
|
|
|
1609
1629
|
let t = e.indexOf(";"), n = e.indexOf(",", t);
|
|
1610
1630
|
if (t !== -1 && n !== -1 && e.slice(t + 1, n) === "base64") {
|
|
1611
1631
|
let r = e.slice(5, t), i = e.slice(n + 1), a;
|
|
1612
|
-
if (
|
|
1632
|
+
if (y !== void 0) a = new Uint8Array(y.from(i, "base64"));
|
|
1613
1633
|
else {
|
|
1614
1634
|
let e = atob(i);
|
|
1615
1635
|
a = new Uint8Array(e.length);
|
|
@@ -1647,42 +1667,42 @@ var L, R, z, B, V, H, U, W, ee, G, te = e((() => {
|
|
|
1647
1667
|
_.set(i, 0);
|
|
1648
1668
|
let v = new DataView(_.buffer, _.byteOffset, _.byteLength);
|
|
1649
1669
|
v.setUint32(4, a, !0), v.setUint32(8, h.byteLength, !0), _.set(h, 12);
|
|
1650
|
-
let
|
|
1651
|
-
for (let e of s) _.set(e,
|
|
1670
|
+
let b = 12 + h.byteLength;
|
|
1671
|
+
for (let e of s) _.set(e, b), b += e.byteLength;
|
|
1652
1672
|
return _;
|
|
1653
1673
|
}
|
|
1654
|
-
function
|
|
1674
|
+
function c(e, t = {}) {
|
|
1655
1675
|
let i = e instanceof Uint8Array ? e : new Uint8Array(e.buffer || e, e.byteOffset || 0, e.byteLength);
|
|
1656
|
-
if (!
|
|
1657
|
-
let
|
|
1658
|
-
if (
|
|
1659
|
-
let
|
|
1660
|
-
if (
|
|
1661
|
-
let
|
|
1662
|
-
if (Array.isArray(
|
|
1663
|
-
let [e, t] =
|
|
1676
|
+
if (!o(i)) throw Error("Invalid BRFS binary container (missing BRFS magic header)");
|
|
1677
|
+
let s = new DataView(i.buffer, i.byteOffset, i.byteLength), c = s.getUint32(4, !0);
|
|
1678
|
+
if (c > a) throw Error(`Unsupported BRFS container version: ${c}`);
|
|
1679
|
+
let l = 12 + s.getUint32(8, !0);
|
|
1680
|
+
if (l > i.byteLength) throw Error("Corrupt BRFS binary container (header length exceeds buffer)");
|
|
1681
|
+
let u = new TextDecoder(), d = u.decode(i.subarray(12, l)), f = JSON.parse(d), p = i.subarray(l), m = Object.assign({}, t);
|
|
1682
|
+
if (Array.isArray(f.commandsSlice)) {
|
|
1683
|
+
let [e, t] = f.commandsSlice, n = u.decode(p.subarray(e, e + t));
|
|
1664
1684
|
try {
|
|
1665
1685
|
let e = Function(n)();
|
|
1666
|
-
e && typeof e == "object" && Object.assign(
|
|
1686
|
+
e && typeof e == "object" && Object.assign(m, e);
|
|
1667
1687
|
} catch {}
|
|
1668
1688
|
}
|
|
1669
|
-
let
|
|
1689
|
+
let h = (e) => {
|
|
1670
1690
|
if (!e || typeof e != "object") return e;
|
|
1671
1691
|
if ("$t" in e) {
|
|
1672
1692
|
let [t, n] = e.$t;
|
|
1673
|
-
return
|
|
1693
|
+
return u.decode(p.subarray(t, t + n));
|
|
1674
1694
|
}
|
|
1675
1695
|
if ("$b" in e) {
|
|
1676
1696
|
let [t, r, i] = e.$b;
|
|
1677
|
-
return new n(
|
|
1697
|
+
return new n(p.slice(t, t + r).buffer, i || "application/octet-stream");
|
|
1678
1698
|
}
|
|
1679
1699
|
if ("$l" in e) return new r(e.$l);
|
|
1680
1700
|
if ("$c" in e) {
|
|
1681
1701
|
let t = e.$c;
|
|
1682
|
-
if (
|
|
1683
|
-
if (
|
|
1684
|
-
let e =
|
|
1685
|
-
return Function("Command", "InteractiveCommand", `return (${
|
|
1702
|
+
if (m[t]) return m[t];
|
|
1703
|
+
if (f.inlineCommands && f.inlineCommands[t]) try {
|
|
1704
|
+
let e = w(), n = te();
|
|
1705
|
+
return Function("Command", "InteractiveCommand", `return (${f.inlineCommands[t]});`)(e, n);
|
|
1686
1706
|
} catch {
|
|
1687
1707
|
return null;
|
|
1688
1708
|
}
|
|
@@ -1691,7 +1711,7 @@ var L, R, z, B, V, H, U, W, ee, G, te = e((() => {
|
|
|
1691
1711
|
if ("$d" in e) {
|
|
1692
1712
|
let t = {};
|
|
1693
1713
|
for (let [n, r] of Object.entries(e.$d)) {
|
|
1694
|
-
let e =
|
|
1714
|
+
let e = h(r);
|
|
1695
1715
|
e !== null && (t[n] = e);
|
|
1696
1716
|
}
|
|
1697
1717
|
return t;
|
|
@@ -1699,56 +1719,56 @@ var L, R, z, B, V, H, U, W, ee, G, te = e((() => {
|
|
|
1699
1719
|
return e;
|
|
1700
1720
|
};
|
|
1701
1721
|
return {
|
|
1702
|
-
filesystem:
|
|
1703
|
-
permissions: Object.assign({},
|
|
1722
|
+
filesystem: h(f.tree) || {},
|
|
1723
|
+
permissions: Object.assign({}, f.permissions || {})
|
|
1704
1724
|
};
|
|
1705
1725
|
}
|
|
1706
|
-
function
|
|
1726
|
+
function l(e) {
|
|
1707
1727
|
if (!e) return !1;
|
|
1708
1728
|
let t = e instanceof Uint8Array ? e : e instanceof ArrayBuffer ? new Uint8Array(e) : ArrayBuffer.isView(e) ? new Uint8Array(e.buffer, e.byteOffset, e.byteLength) : null;
|
|
1709
1729
|
return !!(t && t.byteLength >= 2 && t[0] === 31 && t[1] === 139);
|
|
1710
1730
|
}
|
|
1711
|
-
async function
|
|
1731
|
+
async function u(e) {
|
|
1712
1732
|
if (typeof DecompressionStream < "u" && typeof Response < "u") {
|
|
1713
1733
|
let t = new DecompressionStream("gzip"), n = new Blob([e]).stream().pipeThrough(t), r = await new Response(n).arrayBuffer();
|
|
1714
1734
|
return new Uint8Array(r);
|
|
1715
1735
|
}
|
|
1716
|
-
if (
|
|
1717
|
-
let t =
|
|
1718
|
-
if (t) return new Uint8Array(t.gunzipSync(
|
|
1736
|
+
if (K !== void 0 && typeof K.getBuiltinModule == "function") {
|
|
1737
|
+
let t = K.getBuiltinModule("zlib");
|
|
1738
|
+
if (t) return new Uint8Array(t.gunzipSync(y.from(e.buffer, e.byteOffset, e.byteLength)));
|
|
1719
1739
|
}
|
|
1720
1740
|
throw Error("Gzip decompression is not supported in this environment");
|
|
1721
1741
|
}
|
|
1722
|
-
function
|
|
1723
|
-
return e ? !!(typeof e == "string" || typeof e.then == "function" || typeof e.arrayBuffer == "function" ||
|
|
1742
|
+
function d(e) {
|
|
1743
|
+
return e ? !!(typeof e == "string" || typeof e.then == "function" || typeof e.arrayBuffer == "function" || l(e)) : !1;
|
|
1724
1744
|
}
|
|
1725
|
-
async function
|
|
1745
|
+
async function f(e, t = {}) {
|
|
1726
1746
|
if (!e) return {
|
|
1727
1747
|
filesystem: {},
|
|
1728
1748
|
permissions: t
|
|
1729
1749
|
};
|
|
1730
|
-
if (typeof e.then == "function") return
|
|
1750
|
+
if (typeof e.then == "function") return f(await e, t);
|
|
1731
1751
|
if (typeof e.arrayBuffer == "function") {
|
|
1732
1752
|
let n = await e.arrayBuffer();
|
|
1733
|
-
return
|
|
1753
|
+
return f(new Uint8Array(n), t);
|
|
1734
1754
|
}
|
|
1735
1755
|
if (typeof e == "string") {
|
|
1736
|
-
if (!/^https?:\/\//i.test(e) &&
|
|
1737
|
-
let n =
|
|
1756
|
+
if (!/^https?:\/\//i.test(e) && K !== void 0 && typeof K.getBuiltinModule == "function" && typeof window > "u") try {
|
|
1757
|
+
let n = K.getBuiltinModule("fs");
|
|
1738
1758
|
if (n && n.existsSync(e)) {
|
|
1739
1759
|
let r = await n.promises.readFile(e);
|
|
1740
|
-
return
|
|
1760
|
+
return f(new Uint8Array(r.buffer, r.byteOffset, r.byteLength), t);
|
|
1741
1761
|
}
|
|
1742
1762
|
} catch {}
|
|
1743
1763
|
let n = await fetch(e);
|
|
1744
1764
|
if (!n.ok) throw Error(`Failed to load filesystem from ${e}: HTTP ${n.status}`);
|
|
1745
1765
|
let r = await n.arrayBuffer();
|
|
1746
|
-
return
|
|
1766
|
+
return f(new Uint8Array(r), t);
|
|
1747
1767
|
}
|
|
1748
1768
|
if (e instanceof ArrayBuffer || ArrayBuffer.isView(e)) {
|
|
1749
1769
|
let n = e instanceof Uint8Array ? e : e instanceof ArrayBuffer ? new Uint8Array(e) : new Uint8Array(e.buffer, e.byteOffset, e.byteLength);
|
|
1750
|
-
if (
|
|
1751
|
-
let e =
|
|
1770
|
+
if (l(n) && (n = await u(n)), o(n)) {
|
|
1771
|
+
let e = c(n);
|
|
1752
1772
|
return {
|
|
1753
1773
|
filesystem: e.filesystem,
|
|
1754
1774
|
permissions: Object.assign({}, e.permissions, t)
|
|
@@ -1775,7 +1795,7 @@ var L, R, z, B, V, H, U, W, ee, G, te = e((() => {
|
|
|
1775
1795
|
};
|
|
1776
1796
|
}
|
|
1777
1797
|
}
|
|
1778
|
-
return typeof e == "object" && e.filesystem && typeof e.permissions == "object" ?
|
|
1798
|
+
return typeof e == "object" && e.filesystem && typeof e.permissions == "object" ? d(e.filesystem) || o(e.filesystem) ? f(e.filesystem, Object.assign({}, e.permissions, t)) : {
|
|
1779
1799
|
filesystem: e.filesystem,
|
|
1780
1800
|
permissions: Object.assign({}, e.permissions, t)
|
|
1781
1801
|
} : {
|
|
@@ -1786,31 +1806,31 @@ var L, R, z, B, V, H, U, W, ee, G, te = e((() => {
|
|
|
1786
1806
|
t.exports = {
|
|
1787
1807
|
MAGIC: i,
|
|
1788
1808
|
FORMAT_VERSION: a,
|
|
1789
|
-
isBinaryContainer:
|
|
1790
|
-
isGzipBytes:
|
|
1791
|
-
isAsyncFilesystemSource:
|
|
1792
|
-
resolveFilesystemSource:
|
|
1793
|
-
serializeBinaryFilesystem:
|
|
1794
|
-
deserializeBinaryFilesystem:
|
|
1809
|
+
isBinaryContainer: o,
|
|
1810
|
+
isGzipBytes: l,
|
|
1811
|
+
isAsyncFilesystemSource: d,
|
|
1812
|
+
resolveFilesystemSource: f,
|
|
1813
|
+
serializeBinaryFilesystem: s,
|
|
1814
|
+
deserializeBinaryFilesystem: c,
|
|
1795
1815
|
FilesystemStorage: class {
|
|
1796
1816
|
static async save(e, t = "brsh-rootfs") {
|
|
1797
|
-
let n = e.context ? e.context.fs : e, r =
|
|
1817
|
+
let n = e.context ? e.context.fs : e, r = s(n.getRaw(), n.getRawPermissions());
|
|
1798
1818
|
return typeof indexedDB < "u" && await this._idbPut(t, r), r;
|
|
1799
1819
|
}
|
|
1800
1820
|
static async load(e = "brsh-rootfs") {
|
|
1801
|
-
if (e instanceof Uint8Array || e instanceof ArrayBuffer || typeof e == "string" && (/^https?:\/\//i.test(e) || e.endsWith(".brfs"))) return
|
|
1821
|
+
if (e instanceof Uint8Array || e instanceof ArrayBuffer || typeof e == "string" && (/^https?:\/\//i.test(e) || e.endsWith(".brfs"))) return f(e);
|
|
1802
1822
|
if (typeof indexedDB < "u" && typeof e == "string") {
|
|
1803
1823
|
let t = await this._idbGet(e);
|
|
1804
|
-
if (t &&
|
|
1824
|
+
if (t && o(t)) return c(t);
|
|
1805
1825
|
}
|
|
1806
1826
|
return null;
|
|
1807
1827
|
}
|
|
1808
1828
|
static async loadOrFetch(e = "brsh-rootfs", t = {}) {
|
|
1809
|
-
return await this.load(e) ||
|
|
1829
|
+
return await this.load(e) || f(t);
|
|
1810
1830
|
}
|
|
1811
1831
|
static createAutoSave(e = "brsh-rootfs", t = null) {
|
|
1812
1832
|
return (n, r) => {
|
|
1813
|
-
let i =
|
|
1833
|
+
let i = s(n, r);
|
|
1814
1834
|
typeof indexedDB < "u" && this._idbPut(e, i).catch(() => {}), typeof t == "function" && t(i, n, r);
|
|
1815
1835
|
};
|
|
1816
1836
|
}
|
|
@@ -1832,42 +1852,23 @@ var L, R, z, B, V, H, U, W, ee, G, te = e((() => {
|
|
|
1832
1852
|
n.close(), i(a.error);
|
|
1833
1853
|
};
|
|
1834
1854
|
});
|
|
1835
|
-
}
|
|
1836
|
-
static async _idbGet(e) {
|
|
1837
|
-
let t = await this._openIdb();
|
|
1838
|
-
return new Promise((n, r) => {
|
|
1839
|
-
let i = t.transaction("snapshots", "readonly").objectStore("snapshots").get(e);
|
|
1840
|
-
i.onsuccess = () => {
|
|
1841
|
-
t.close(), n(i.result || null);
|
|
1842
|
-
}, i.onerror = () => {
|
|
1843
|
-
t.close(), r(i.error);
|
|
1844
|
-
};
|
|
1845
|
-
});
|
|
1846
|
-
}
|
|
1847
|
-
}
|
|
1848
|
-
};
|
|
1849
|
-
})), q = /* @__PURE__ */ t(((e, t) => {
|
|
1850
|
-
T();
|
|
1851
|
-
var n = D(), r = class extends Uint8Array {
|
|
1852
|
-
constructor(e, t) {
|
|
1853
|
-
super(e), Object.defineProperty(this, "mimeType", {
|
|
1854
|
-
value: t,
|
|
1855
|
-
enumerable: !1,
|
|
1856
|
-
configurable: !1,
|
|
1857
|
-
writable: !1
|
|
1858
|
-
});
|
|
1859
|
-
}
|
|
1860
|
-
toString() {
|
|
1861
|
-
if (w !== void 0) return `data:${this.mimeType};base64,${w.from(this).toString("base64")}`;
|
|
1862
|
-
let e = "", t = 8192;
|
|
1863
|
-
for (let n = 0; n < this.length; n += t) e += String.fromCharCode(...this.subarray(n, n + t));
|
|
1864
|
-
return `data:${this.mimeType};base64,${btoa(e)}`;
|
|
1865
|
-
}
|
|
1866
|
-
}, i = class {
|
|
1867
|
-
constructor(e) {
|
|
1868
|
-
this.target = e;
|
|
1855
|
+
}
|
|
1856
|
+
static async _idbGet(e) {
|
|
1857
|
+
let t = await this._openIdb();
|
|
1858
|
+
return new Promise((n, r) => {
|
|
1859
|
+
let i = t.transaction("snapshots", "readonly").objectStore("snapshots").get(e);
|
|
1860
|
+
i.onsuccess = () => {
|
|
1861
|
+
t.close(), n(i.result || null);
|
|
1862
|
+
}, i.onerror = () => {
|
|
1863
|
+
t.close(), r(i.error);
|
|
1864
|
+
};
|
|
1865
|
+
});
|
|
1866
|
+
}
|
|
1869
1867
|
}
|
|
1870
1868
|
};
|
|
1869
|
+
})), ne = /* @__PURE__ */ t(((e, t) => {
|
|
1870
|
+
b();
|
|
1871
|
+
var n = D(), { BinaryFile: r, SymlinkRef: i } = n;
|
|
1871
1872
|
function a(e) {
|
|
1872
1873
|
for (let t of Object.keys(e)) {
|
|
1873
1874
|
let n = e[t];
|
|
@@ -1876,7 +1877,7 @@ var L, R, z, B, V, H, U, W, ee, G, te = e((() => {
|
|
|
1876
1877
|
let i = n.indexOf(";"), a = n.indexOf(",", i);
|
|
1877
1878
|
if (i !== -1 && a !== -1 && n.slice(i + 1, a) === "base64") {
|
|
1878
1879
|
let o = n.slice(5, i), s = n.slice(a + 1), c;
|
|
1879
|
-
if (
|
|
1880
|
+
if (y !== void 0) c = new Uint8Array(y.from(s, "base64"));
|
|
1880
1881
|
else {
|
|
1881
1882
|
let e = atob(s);
|
|
1882
1883
|
c = new Uint8Array(e.length);
|
|
@@ -1890,20 +1891,20 @@ var L, R, z, B, V, H, U, W, ee, G, te = e((() => {
|
|
|
1890
1891
|
t.exports = class extends n {
|
|
1891
1892
|
constructor(e = "/", t = {}, n = {}, r = null) {
|
|
1892
1893
|
if (super(), t instanceof Uint8Array || t instanceof ArrayBuffer) {
|
|
1893
|
-
let { deserializeBinaryFilesystem: e } =
|
|
1894
|
+
let { deserializeBinaryFilesystem: e } = q(), r = e(t);
|
|
1894
1895
|
t = r.filesystem, n = Object.assign({}, r.permissions, n);
|
|
1895
1896
|
} 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)) {
|
|
1896
|
-
let { deserializeBinaryFilesystem: e } =
|
|
1897
|
+
let { deserializeBinaryFilesystem: e } = q(), r = e(t);
|
|
1897
1898
|
t = r.filesystem, n = Object.assign({}, r.permissions, n);
|
|
1898
1899
|
}
|
|
1899
1900
|
a(t), this.fileSystem = t, this.permissions = Object.assign({}, n), this.cwd = e, this._onChange = r, this._changeScheduled = !1;
|
|
1900
1901
|
}
|
|
1901
1902
|
toBinaryContainer(e = {}) {
|
|
1902
|
-
let { serializeBinaryFilesystem: t } =
|
|
1903
|
+
let { serializeBinaryFilesystem: t } = q();
|
|
1903
1904
|
return t(this.fileSystem, this.permissions, e);
|
|
1904
1905
|
}
|
|
1905
1906
|
static fromBinaryContainer(e, t = {}) {
|
|
1906
|
-
let { deserializeBinaryFilesystem: n } =
|
|
1907
|
+
let { deserializeBinaryFilesystem: n } = q();
|
|
1907
1908
|
return n(e, t);
|
|
1908
1909
|
}
|
|
1909
1910
|
getFileByPath(e) {
|
|
@@ -2084,7 +2085,7 @@ var L, R, z, B, V, H, U, W, ee, G, te = e((() => {
|
|
|
2084
2085
|
})), J = /* @__PURE__ */ t(((e, t) => {
|
|
2085
2086
|
t.exports = null;
|
|
2086
2087
|
})), re = /* @__PURE__ */ t(((e, t) => {
|
|
2087
|
-
|
|
2088
|
+
ee();
|
|
2088
2089
|
function n(e) {
|
|
2089
2090
|
if (typeof e != "string") throw TypeError("Path must be a string. Received " + JSON.stringify(e));
|
|
2090
2091
|
}
|
|
@@ -2122,7 +2123,7 @@ var L, R, z, B, V, H, U, W, ee, G, te = e((() => {
|
|
|
2122
2123
|
resolve: function() {
|
|
2123
2124
|
for (var e = "", t = !1, i, a = arguments.length - 1; a >= -1 && !t; a--) {
|
|
2124
2125
|
var o;
|
|
2125
|
-
a >= 0 ? o = arguments[a] : (i === void 0 && (i =
|
|
2126
|
+
a >= 0 ? o = arguments[a] : (i === void 0 && (i = K.cwd()), o = i), n(o), o.length !== 0 && (e = o + "/" + e, t = o.charCodeAt(0) === 47);
|
|
2126
2127
|
}
|
|
2127
2128
|
return e = r(e, !t), t ? e.length > 0 ? "/" + e : "/" : e.length > 0 ? e : ".";
|
|
2128
2129
|
},
|
|
@@ -2252,8 +2253,8 @@ var L, R, z, B, V, H, U, W, ee, G, te = e((() => {
|
|
|
2252
2253
|
};
|
|
2253
2254
|
a.posix = a, t.exports = a;
|
|
2254
2255
|
})), Y = /* @__PURE__ */ t(((e, t) => {
|
|
2255
|
-
|
|
2256
|
-
var n = E(), { BinaryFile: r } =
|
|
2256
|
+
b();
|
|
2257
|
+
var n = E(), { BinaryFile: r } = ne(), i = 0, a = 8, o = 20, s = 28, c = 31, l = 44, u = 54, d = 70, f = 0, p = 2, m = 3, h = 4, g = 1, _ = 2, v = 4, x = 8, S = 1, C = class extends n {
|
|
2257
2258
|
get name() {
|
|
2258
2259
|
return "wasm";
|
|
2259
2260
|
}
|
|
@@ -2295,7 +2296,7 @@ var L, R, z, B, V, H, U, W, ee, G, te = e((() => {
|
|
|
2295
2296
|
}
|
|
2296
2297
|
_contentToBytes(e) {
|
|
2297
2298
|
if (e instanceof Uint8Array) return e;
|
|
2298
|
-
if (
|
|
2299
|
+
if (y !== void 0 && y.isBuffer(e)) return new Uint8Array(e.buffer, e.byteOffset, e.byteLength);
|
|
2299
2300
|
if (e instanceof ArrayBuffer) return new Uint8Array(e);
|
|
2300
2301
|
let t = new Uint8Array(e.length);
|
|
2301
2302
|
for (let n = 0; n < e.length; n++) t[n] = e.charCodeAt(n) & 255;
|
|
@@ -2329,14 +2330,14 @@ var L, R, z, B, V, H, U, W, ee, G, te = e((() => {
|
|
|
2329
2330
|
let t = {
|
|
2330
2331
|
1: "",
|
|
2331
2332
|
2: ""
|
|
2332
|
-
}, n = new TextDecoder(),
|
|
2333
|
+
}, n = new TextDecoder(), y = new TextEncoder(), b = null, C = (e, n) => {
|
|
2333
2334
|
t[e] = (t[e] || "") + n;
|
|
2334
2335
|
let r = t[e].split("\n");
|
|
2335
2336
|
t[e] = r.pop();
|
|
2336
2337
|
for (let t of r) e === 1 ? this.stdOut = t : this.stdErr = t;
|
|
2337
2338
|
}, w = () => {
|
|
2338
2339
|
t[1] &&= (this.stdOut = t[1], ""), t[2] &&= (this.stdErr = t[2], "");
|
|
2339
|
-
}, T =
|
|
2340
|
+
}, T = y.encode(this.stdin || ""), E = 0, D = this.context && this.context.fs ? this.context.fs : this.fs, O = 5, k = new Map([[3, {
|
|
2340
2341
|
type: "preopen",
|
|
2341
2342
|
path: "/",
|
|
2342
2343
|
guestName: "/"
|
|
@@ -2368,13 +2369,13 @@ var L, R, z, B, V, H, U, W, ee, G, te = e((() => {
|
|
|
2368
2369
|
} catch {}
|
|
2369
2370
|
}, P = Object.entries(this.context && this.context.vars || {}).map(([e, t]) => `${e}=${t}`), F = new Proxy({
|
|
2370
2371
|
fd_write: (e, t, r, o) => {
|
|
2371
|
-
if (!
|
|
2372
|
-
let s = new DataView(
|
|
2372
|
+
if (!b) return a;
|
|
2373
|
+
let s = new DataView(b.buffer);
|
|
2373
2374
|
if (e === 1 || e === 2) {
|
|
2374
2375
|
let a = 0;
|
|
2375
2376
|
for (let i = 0; i < r; i++) {
|
|
2376
2377
|
let r = s.getUint32(t + i * 8, !0), o = s.getUint32(t + i * 8 + 4, !0);
|
|
2377
|
-
o > 0 && C(e, n.decode(new Uint8Array(
|
|
2378
|
+
o > 0 && C(e, n.decode(new Uint8Array(b.buffer, r, o))), a += o;
|
|
2378
2379
|
}
|
|
2379
2380
|
return s.setUint32(o, a, !0), i;
|
|
2380
2381
|
}
|
|
@@ -2384,7 +2385,7 @@ var L, R, z, B, V, H, U, W, ee, G, te = e((() => {
|
|
|
2384
2385
|
for (let e = 0; e < r; e++) {
|
|
2385
2386
|
let n = s.getUint32(t + e * 8, !0), r = s.getUint32(t + e * 8 + 4, !0);
|
|
2386
2387
|
if (r > 0) {
|
|
2387
|
-
let e = new Uint8Array(
|
|
2388
|
+
let e = new Uint8Array(b.buffer, n, r), t = c.append ? c.bytes.length : c.pos, i = t + r;
|
|
2388
2389
|
if (i > c.bytes.length) {
|
|
2389
2390
|
let e = new Uint8Array(i);
|
|
2390
2391
|
e.set(c.bytes), c.bytes = e;
|
|
@@ -2395,13 +2396,13 @@ var L, R, z, B, V, H, U, W, ee, G, te = e((() => {
|
|
|
2395
2396
|
return s.setUint32(o, l, !0), i;
|
|
2396
2397
|
},
|
|
2397
2398
|
fd_read: (e, t, n, r) => {
|
|
2398
|
-
if (!
|
|
2399
|
-
let o = new DataView(
|
|
2399
|
+
if (!b) return a;
|
|
2400
|
+
let o = new DataView(b.buffer);
|
|
2400
2401
|
if (e === 0) {
|
|
2401
2402
|
let e = 0;
|
|
2402
2403
|
for (let r = 0; r < n && E < T.length; r++) {
|
|
2403
2404
|
let n = o.getUint32(t + r * 8, !0), i = o.getUint32(t + r * 8 + 4, !0), a = Math.min(i, T.length - E);
|
|
2404
|
-
new Uint8Array(
|
|
2405
|
+
new Uint8Array(b.buffer).set(T.slice(E, E + a), n), E += a, e += a;
|
|
2405
2406
|
}
|
|
2406
2407
|
return o.setUint32(r, e, !0), i;
|
|
2407
2408
|
}
|
|
@@ -2410,28 +2411,28 @@ var L, R, z, B, V, H, U, W, ee, G, te = e((() => {
|
|
|
2410
2411
|
let c = 0;
|
|
2411
2412
|
for (let e = 0; e < n && s.pos < s.bytes.length; e++) {
|
|
2412
2413
|
let n = o.getUint32(t + e * 8, !0), r = o.getUint32(t + e * 8 + 4, !0), i = Math.min(r, s.bytes.length - s.pos);
|
|
2413
|
-
new Uint8Array(
|
|
2414
|
+
new Uint8Array(b.buffer).set(s.bytes.subarray(s.pos, s.pos + i), n), s.pos += i, c += i;
|
|
2414
2415
|
}
|
|
2415
2416
|
return o.setUint32(r, c, !0), i;
|
|
2416
2417
|
},
|
|
2417
2418
|
fd_seek: (e, t, n, r, o) => {
|
|
2418
|
-
if (!
|
|
2419
|
-
if (e <= 2) return
|
|
2420
|
-
let
|
|
2421
|
-
if (!
|
|
2422
|
-
let l, u,
|
|
2423
|
-
typeof t == "bigint" ? (l = Number(t), u = n,
|
|
2424
|
-
let p =
|
|
2419
|
+
if (!b) return a;
|
|
2420
|
+
if (e <= 2) return d;
|
|
2421
|
+
let c = k.get(e);
|
|
2422
|
+
if (!c || c.type !== "file") return a;
|
|
2423
|
+
let l, u, f;
|
|
2424
|
+
typeof t == "bigint" ? (l = Number(t), u = n, f = r) : (l = t, u = r, f = o);
|
|
2425
|
+
let p = c.pos;
|
|
2425
2426
|
if (u === 0) p = l;
|
|
2426
|
-
else if (u === 1) p =
|
|
2427
|
-
else if (u === 2) p =
|
|
2428
|
-
else return
|
|
2429
|
-
return p < 0 ?
|
|
2427
|
+
else if (u === 1) p = c.pos + l;
|
|
2428
|
+
else if (u === 2) p = c.bytes.length + l;
|
|
2429
|
+
else return s;
|
|
2430
|
+
return p < 0 ? s : (c.pos = p, f && new DataView(b.buffer).setBigUint64(f, BigInt(c.pos), !0), i);
|
|
2430
2431
|
},
|
|
2431
2432
|
fd_tell: (e, t) => {
|
|
2432
|
-
if (!
|
|
2433
|
+
if (!b) return a;
|
|
2433
2434
|
let n = k.get(e);
|
|
2434
|
-
return !n || n.type !== "file" ? a : (new DataView(
|
|
2435
|
+
return !n || n.type !== "file" ? a : (new DataView(b.buffer).setBigUint64(t, BigInt(n.pos), !0), i);
|
|
2435
2436
|
},
|
|
2436
2437
|
fd_close: (e) => {
|
|
2437
2438
|
if (e <= 2) return i;
|
|
@@ -2447,112 +2448,112 @@ var L, R, z, B, V, H, U, W, ee, G, te = e((() => {
|
|
|
2447
2448
|
return t && N(t), i;
|
|
2448
2449
|
},
|
|
2449
2450
|
fd_prestat_get: (e, t) => {
|
|
2450
|
-
if (!
|
|
2451
|
+
if (!b) return a;
|
|
2451
2452
|
let n = k.get(e);
|
|
2452
2453
|
if (!n || n.type !== "preopen") return a;
|
|
2453
|
-
let r = new DataView(
|
|
2454
|
+
let r = new DataView(b.buffer), o = y.encode(n.guestName);
|
|
2454
2455
|
return r.setUint8(t, 0), r.setUint32(t + 4, o.length, !0), i;
|
|
2455
2456
|
},
|
|
2456
2457
|
fd_prestat_dir_name: (e, t, n) => {
|
|
2457
|
-
if (!
|
|
2458
|
+
if (!b) return a;
|
|
2458
2459
|
let r = k.get(e);
|
|
2459
2460
|
if (!r || r.type !== "preopen") return a;
|
|
2460
|
-
let o =
|
|
2461
|
-
return new Uint8Array(
|
|
2461
|
+
let o = y.encode(r.guestName);
|
|
2462
|
+
return new Uint8Array(b.buffer, t, Math.min(n, o.length)).set(o.subarray(0, n)), i;
|
|
2462
2463
|
},
|
|
2463
2464
|
fd_fdstat_get: (e, t) => {
|
|
2464
|
-
if (!
|
|
2465
|
-
let n = new DataView(
|
|
2466
|
-
if (e <= 2) r =
|
|
2465
|
+
if (!b) return a;
|
|
2466
|
+
let n = new DataView(b.buffer), r = f;
|
|
2467
|
+
if (e <= 2) r = p;
|
|
2467
2468
|
else {
|
|
2468
2469
|
let t = k.get(e);
|
|
2469
2470
|
if (!t) return a;
|
|
2470
|
-
r = t.type === "preopen" || t.type === "dir" ?
|
|
2471
|
+
r = t.type === "preopen" || t.type === "dir" ? m : h;
|
|
2471
2472
|
}
|
|
2472
2473
|
for (let e = 0; e < 24; e++) n.setUint8(t + e, 0);
|
|
2473
2474
|
return n.setUint8(t, r), n.setBigUint64(t + 8, 18446744073709551615n, !0), n.setBigUint64(t + 16, 18446744073709551615n, !0), i;
|
|
2474
2475
|
},
|
|
2475
2476
|
fd_fdstat_set_flags: () => i,
|
|
2476
2477
|
fd_filestat_get: (e, t) => {
|
|
2477
|
-
if (!
|
|
2478
|
-
let n = new DataView(
|
|
2478
|
+
if (!b) return a;
|
|
2479
|
+
let n = new DataView(b.buffer);
|
|
2479
2480
|
for (let e = 0; e < 64; e++) n.setUint8(t + e, 0);
|
|
2480
|
-
if (e <= 2) return n.setUint8(t + 16,
|
|
2481
|
+
if (e <= 2) return n.setUint8(t + 16, p), i;
|
|
2481
2482
|
let r = k.get(e);
|
|
2482
2483
|
if (!r) return a;
|
|
2483
2484
|
let o = r.type === "preopen" || r.type === "dir";
|
|
2484
|
-
return n.setUint8(t + 16, o ?
|
|
2485
|
+
return n.setUint8(t + 16, o ? m : h), n.setBigUint64(t + 24, 1n, !0), n.setBigUint64(t + 32, BigInt(r.bytes ? r.bytes.length : 0), !0), i;
|
|
2485
2486
|
},
|
|
2486
|
-
path_open: (e, t, r,
|
|
2487
|
-
if (!
|
|
2488
|
-
let C = A(e, n.decode(new Uint8Array(
|
|
2487
|
+
path_open: (e, t, r, s, d, f, p, m, h) => {
|
|
2488
|
+
if (!b || !D) return a;
|
|
2489
|
+
let C = A(e, n.decode(new Uint8Array(b.buffer, r, s)));
|
|
2489
2490
|
if (!C) return a;
|
|
2490
2491
|
let w = D.stat(C), T = w !== null;
|
|
2491
|
-
if (
|
|
2492
|
-
if (
|
|
2493
|
-
if (!T) return
|
|
2494
|
-
if (!w.isDirectory) return
|
|
2492
|
+
if (d & v && d & g && T) return o;
|
|
2493
|
+
if (d & _) {
|
|
2494
|
+
if (!T) return l;
|
|
2495
|
+
if (!w.isDirectory) return u;
|
|
2495
2496
|
let e = O++;
|
|
2496
2497
|
return k.set(e, {
|
|
2497
2498
|
type: "dir",
|
|
2498
2499
|
path: C
|
|
2499
|
-
}), new DataView(
|
|
2500
|
+
}), new DataView(b.buffer).setUint32(h, e, !0), i;
|
|
2500
2501
|
}
|
|
2501
|
-
if (T && w.isDirectory) return
|
|
2502
|
-
if (!T && !(
|
|
2502
|
+
if (T && w.isDirectory) return c;
|
|
2503
|
+
if (!T && !(d & g)) return l;
|
|
2503
2504
|
let E = new Uint8Array(), j = !1;
|
|
2504
|
-
if (T && !(
|
|
2505
|
+
if (T && !(d & x)) {
|
|
2505
2506
|
let e = D.getFileByPath(C);
|
|
2506
|
-
e != null && (E = typeof e == "string" ?
|
|
2507
|
+
e != null && (E = typeof e == "string" ? y.encode(e) : new Uint8Array(this._contentToBytes(e)));
|
|
2507
2508
|
} else j = !0;
|
|
2508
2509
|
let M = O++;
|
|
2509
2510
|
return k.set(M, {
|
|
2510
2511
|
type: "file",
|
|
2511
2512
|
path: C,
|
|
2512
2513
|
bytes: E,
|
|
2513
|
-
pos:
|
|
2514
|
-
append: !!(
|
|
2514
|
+
pos: m & S ? E.length : 0,
|
|
2515
|
+
append: !!(m & S),
|
|
2515
2516
|
dirty: j
|
|
2516
|
-
}), new DataView(
|
|
2517
|
+
}), new DataView(b.buffer).setUint32(h, M, !0), i;
|
|
2517
2518
|
},
|
|
2518
2519
|
path_filestat_get: (e, t, r, o, s) => {
|
|
2519
|
-
if (!
|
|
2520
|
-
let c = A(e, n.decode(new Uint8Array(
|
|
2520
|
+
if (!b || !D) return a;
|
|
2521
|
+
let c = A(e, n.decode(new Uint8Array(b.buffer, r, o)));
|
|
2521
2522
|
if (!c) return a;
|
|
2522
|
-
let
|
|
2523
|
-
if (!
|
|
2524
|
-
let d = new DataView(
|
|
2523
|
+
let u = D.stat(c);
|
|
2524
|
+
if (!u) return l;
|
|
2525
|
+
let d = new DataView(b.buffer);
|
|
2525
2526
|
for (let e = 0; e < 64; e++) d.setUint8(s + e, 0);
|
|
2526
|
-
return d.setUint8(s + 16,
|
|
2527
|
+
return d.setUint8(s + 16, u.isDirectory ? m : h), d.setBigUint64(s + 24, 1n, !0), d.setBigUint64(s + 32, BigInt(D.getSize(c) || 0), !0), i;
|
|
2527
2528
|
},
|
|
2528
2529
|
path_create_directory: (e, t, r) => {
|
|
2529
|
-
if (!
|
|
2530
|
-
let o = A(e, n.decode(new Uint8Array(
|
|
2530
|
+
if (!b || !D) return a;
|
|
2531
|
+
let o = A(e, n.decode(new Uint8Array(b.buffer, t, r)));
|
|
2531
2532
|
if (!o) return a;
|
|
2532
2533
|
try {
|
|
2533
2534
|
return D.setFileByPath(o, {}, !0), i;
|
|
2534
2535
|
} catch {
|
|
2535
|
-
return
|
|
2536
|
+
return s;
|
|
2536
2537
|
}
|
|
2537
2538
|
},
|
|
2538
2539
|
path_unlink_file: (e, t, r) => {
|
|
2539
|
-
if (!
|
|
2540
|
-
let o = A(e, n.decode(new Uint8Array(
|
|
2541
|
-
if (!o || !D.exists(o)) return
|
|
2540
|
+
if (!b || !D) return a;
|
|
2541
|
+
let o = A(e, n.decode(new Uint8Array(b.buffer, t, r)));
|
|
2542
|
+
if (!o || !D.exists(o)) return l;
|
|
2542
2543
|
try {
|
|
2543
2544
|
return D.deleteFileByPath(o), i;
|
|
2544
2545
|
} catch {
|
|
2545
|
-
return
|
|
2546
|
+
return s;
|
|
2546
2547
|
}
|
|
2547
2548
|
},
|
|
2548
2549
|
path_remove_directory: (e, t, r) => {
|
|
2549
|
-
if (!
|
|
2550
|
-
let o = A(e, n.decode(new Uint8Array(
|
|
2551
|
-
if (!o || !D.exists(o)) return
|
|
2550
|
+
if (!b || !D) return a;
|
|
2551
|
+
let o = A(e, n.decode(new Uint8Array(b.buffer, t, r)));
|
|
2552
|
+
if (!o || !D.exists(o)) return l;
|
|
2552
2553
|
try {
|
|
2553
2554
|
return D.deleteFileByPath(o), i;
|
|
2554
2555
|
} catch {
|
|
2555
|
-
return
|
|
2556
|
+
return s;
|
|
2556
2557
|
}
|
|
2557
2558
|
},
|
|
2558
2559
|
proc_exit: (e) => {
|
|
@@ -2562,47 +2563,47 @@ var L, R, z, B, V, H, U, W, ee, G, te = e((() => {
|
|
|
2562
2563
|
};
|
|
2563
2564
|
},
|
|
2564
2565
|
args_sizes_get: (e, t) => {
|
|
2565
|
-
if (!
|
|
2566
|
-
let n = [this.script, ...this.arguments || []], r = new DataView(
|
|
2567
|
-
return r.setUint32(e, n.length, !0), r.setUint32(t, n.reduce((e, t) => e +
|
|
2566
|
+
if (!b) return s;
|
|
2567
|
+
let n = [this.script, ...this.arguments || []], r = new DataView(b.buffer);
|
|
2568
|
+
return r.setUint32(e, n.length, !0), r.setUint32(t, n.reduce((e, t) => e + y.encode(t).length + 1, 0), !0), i;
|
|
2568
2569
|
},
|
|
2569
2570
|
args_get: (e, t) => {
|
|
2570
|
-
if (!
|
|
2571
|
-
let n = [this.script, ...this.arguments || []], r = new DataView(
|
|
2571
|
+
if (!b) return s;
|
|
2572
|
+
let n = [this.script, ...this.arguments || []], r = new DataView(b.buffer), a = t;
|
|
2572
2573
|
for (let t = 0; t < n.length; t++) {
|
|
2573
2574
|
r.setUint32(e + t * 4, a, !0);
|
|
2574
|
-
let i =
|
|
2575
|
-
new Uint8Array(
|
|
2575
|
+
let i = y.encode(n[t] + "\0");
|
|
2576
|
+
new Uint8Array(b.buffer).set(i, a), a += i.length;
|
|
2576
2577
|
}
|
|
2577
2578
|
return i;
|
|
2578
2579
|
},
|
|
2579
2580
|
environ_sizes_get: (e, t) => {
|
|
2580
|
-
if (!
|
|
2581
|
-
let n = new DataView(
|
|
2581
|
+
if (!b) return s;
|
|
2582
|
+
let n = new DataView(b.buffer);
|
|
2582
2583
|
n.setUint32(e, P.length, !0);
|
|
2583
|
-
let r = P.reduce((e, t) => e +
|
|
2584
|
+
let r = P.reduce((e, t) => e + y.encode(t).length + 1, 0);
|
|
2584
2585
|
return n.setUint32(t, r, !0), i;
|
|
2585
2586
|
},
|
|
2586
2587
|
environ_get: (e, t) => {
|
|
2587
|
-
if (!
|
|
2588
|
-
let n = new DataView(
|
|
2588
|
+
if (!b) return s;
|
|
2589
|
+
let n = new DataView(b.buffer), r = t;
|
|
2589
2590
|
for (let t = 0; t < P.length; t++) {
|
|
2590
2591
|
n.setUint32(e + t * 4, r, !0);
|
|
2591
|
-
let i =
|
|
2592
|
-
new Uint8Array(
|
|
2592
|
+
let i = y.encode(P[t] + "\0");
|
|
2593
|
+
new Uint8Array(b.buffer).set(i, r), r += i.length;
|
|
2593
2594
|
}
|
|
2594
2595
|
return i;
|
|
2595
2596
|
},
|
|
2596
2597
|
clock_time_get: (e, t, n) => {
|
|
2597
|
-
if (
|
|
2598
|
+
if (b) {
|
|
2598
2599
|
let e = BigInt(Date.now()) * 1000000n;
|
|
2599
|
-
new DataView(
|
|
2600
|
+
new DataView(b.buffer).setBigUint64(n, e, !0);
|
|
2600
2601
|
}
|
|
2601
2602
|
return i;
|
|
2602
2603
|
},
|
|
2603
2604
|
random_get: (e, t) => {
|
|
2604
|
-
if (
|
|
2605
|
-
let n = new Uint8Array(
|
|
2605
|
+
if (b) {
|
|
2606
|
+
let n = new Uint8Array(b.buffer, e, t);
|
|
2606
2607
|
for (let e = 0; e < t; e++) n[e] = Math.random() * 256 | 0;
|
|
2607
2608
|
}
|
|
2608
2609
|
return i;
|
|
@@ -2610,9 +2611,9 @@ var L, R, z, B, V, H, U, W, ee, G, te = e((() => {
|
|
|
2610
2611
|
}, { get(e, t) {
|
|
2611
2612
|
return t in e ? e[t] : () => 0;
|
|
2612
2613
|
} }), I = (e) => {
|
|
2613
|
-
if (!
|
|
2614
|
+
if (!b || !e) return "";
|
|
2614
2615
|
try {
|
|
2615
|
-
let t = new DataView(
|
|
2616
|
+
let t = new DataView(b.buffer).getUint32(e - 4, !0), n = new Uint16Array(b.buffer, e, t >>> 1);
|
|
2616
2617
|
return String.fromCharCode(...n);
|
|
2617
2618
|
} catch {
|
|
2618
2619
|
return "";
|
|
@@ -2622,10 +2623,10 @@ var L, R, z, B, V, H, U, W, ee, G, te = e((() => {
|
|
|
2622
2623
|
wasi_unstable: F,
|
|
2623
2624
|
env: new Proxy({
|
|
2624
2625
|
print: (e, t) => {
|
|
2625
|
-
|
|
2626
|
+
b && C(1, n.decode(new Uint8Array(b.buffer, e, t)));
|
|
2626
2627
|
},
|
|
2627
2628
|
eprint: (e, t) => {
|
|
2628
|
-
|
|
2629
|
+
b && C(2, n.decode(new Uint8Array(b.buffer, e, t)));
|
|
2629
2630
|
},
|
|
2630
2631
|
log: (e) => {
|
|
2631
2632
|
C(1, I(e) + "\n");
|
|
@@ -2659,10 +2660,10 @@ var L, R, z, B, V, H, U, W, ee, G, te = e((() => {
|
|
|
2659
2660
|
initial: 1,
|
|
2660
2661
|
maximum: 256
|
|
2661
2662
|
});
|
|
2662
|
-
|
|
2663
|
+
b = t, L[e.module] || (L[e.module] = {}), L[e.module][e.name] = t;
|
|
2663
2664
|
}
|
|
2664
2665
|
let n = await WebAssembly.instantiate(t, L);
|
|
2665
|
-
n.exports.memory && (
|
|
2666
|
+
n.exports.memory && (b = n.exports.memory);
|
|
2666
2667
|
let r = n.exports._start || n.exports.__wasi_command || n.exports.main || n.exports.run;
|
|
2667
2668
|
if (r) try {
|
|
2668
2669
|
await r();
|
|
@@ -2692,25 +2693,23 @@ var L, R, z, B, V, H, U, W, ee, G, te = e((() => {
|
|
|
2692
2693
|
} else (R.includes("--version") || R.includes("-V") || R.includes("-v")) && (this.stdOut = `${t} (${n.name} ${n.version} wasm)`);
|
|
2693
2694
|
}
|
|
2694
2695
|
}
|
|
2695
|
-
},
|
|
2696
|
+
}, w = /* @__PURE__ */ new Map();
|
|
2696
2697
|
function D(e, t) {
|
|
2697
2698
|
if (!e || !e.exists(t)) return null;
|
|
2698
2699
|
if (e.isRealFilesystem) try {
|
|
2699
2700
|
let n = J();
|
|
2700
2701
|
return new Uint8Array(n.readFileSync(e.absolutePath(t)));
|
|
2701
|
-
} catch {
|
|
2702
|
-
return null;
|
|
2703
|
-
}
|
|
2702
|
+
} catch {}
|
|
2704
2703
|
let n = e.getFileByPath(t);
|
|
2705
2704
|
if (n == null) return null;
|
|
2706
|
-
if (n instanceof Uint8Array ||
|
|
2705
|
+
if (n instanceof Uint8Array || y !== void 0 && y.isBuffer(n)) return new Uint8Array(n.buffer, n.byteOffset, n.byteLength);
|
|
2707
2706
|
if (n instanceof ArrayBuffer) return new Uint8Array(n);
|
|
2708
2707
|
if (typeof n == "string") {
|
|
2709
2708
|
if (n.startsWith("data:")) {
|
|
2710
2709
|
let e = n.indexOf(",");
|
|
2711
2710
|
if (e !== -1) {
|
|
2712
2711
|
let t = n.slice(e + 1);
|
|
2713
|
-
if (
|
|
2712
|
+
if (y !== void 0) return new Uint8Array(y.from(t, "base64"));
|
|
2714
2713
|
let r = atob(t), i = new Uint8Array(r.length);
|
|
2715
2714
|
for (let e = 0; e < r.length; e++) i[e] = r.charCodeAt(e);
|
|
2716
2715
|
return i;
|
|
@@ -2723,15 +2722,23 @@ var L, R, z, B, V, H, U, W, ee, G, te = e((() => {
|
|
|
2723
2722
|
return null;
|
|
2724
2723
|
}
|
|
2725
2724
|
function O(e, t, n, i = "application/octet-stream") {
|
|
2726
|
-
let a = n instanceof Uint8Array ? n : new Uint8Array(n);
|
|
2727
|
-
|
|
2725
|
+
let a = n instanceof Uint8Array ? n : new Uint8Array(n), o = new Uint8Array(a.byteLength);
|
|
2726
|
+
o.set(a);
|
|
2727
|
+
let s = new r(o.buffer, i);
|
|
2728
|
+
if (e.isRealFilesystem) try {
|
|
2728
2729
|
let n = J(), r = re(), i = e.absolutePath(t);
|
|
2729
|
-
n.mkdirSync(r.dirname(i), { recursive: !0 }), n.writeFileSync(i,
|
|
2730
|
+
n.mkdirSync(r.dirname(i), { recursive: !0 }), n.writeFileSync(i, y.from(a.buffer, a.byteOffset, a.byteLength));
|
|
2731
|
+
return;
|
|
2732
|
+
} catch {
|
|
2733
|
+
if (typeof e._setFileRaw == "function") {
|
|
2734
|
+
e._setFileRaw(t, s, !0);
|
|
2735
|
+
return;
|
|
2736
|
+
}
|
|
2737
|
+
}
|
|
2738
|
+
if (typeof e._setFileRaw == "function" && t.startsWith("/var/lib/wbt/")) {
|
|
2739
|
+
e._setFileRaw(t, s, !0);
|
|
2730
2740
|
return;
|
|
2731
2741
|
}
|
|
2732
|
-
let o = new Uint8Array(a.byteLength);
|
|
2733
|
-
o.set(a);
|
|
2734
|
-
let s = new r(o.buffer, i);
|
|
2735
2742
|
e.setFileByPath(t, s, !0);
|
|
2736
2743
|
}
|
|
2737
2744
|
async function k(e, t, n = null) {
|
|
@@ -2752,6 +2759,12 @@ var L, R, z, B, V, H, U, W, ee, G, te = e((() => {
|
|
|
2752
2759
|
t
|
|
2753
2760
|
);
|
|
2754
2761
|
} catch (n) {
|
|
2762
|
+
if (!/^https?:\/\/esm\.sh\//i.test(t)) try {
|
|
2763
|
+
return await import(
|
|
2764
|
+
/* @vite-ignore */
|
|
2765
|
+
`https://esm.sh/${e}`
|
|
2766
|
+
);
|
|
2767
|
+
} catch {}
|
|
2755
2768
|
throw Error(`Failed to load WASM package '${e}' from ${t}: ${n.message || n}`);
|
|
2756
2769
|
}
|
|
2757
2770
|
throw Error(`Package '${e}' could not be loaded`);
|
|
@@ -2762,8 +2775,11 @@ var L, R, z, B, V, H, U, W, ee, G, te = e((() => {
|
|
|
2762
2775
|
options: []
|
|
2763
2776
|
};
|
|
2764
2777
|
if (!e || typeof e != "string") return n;
|
|
2765
|
-
let r = e.split(/\r?\n/).map((e) => e.trim()).filter(Boolean), i = /* @__PURE__ */ new Set();
|
|
2766
|
-
for (let e
|
|
2778
|
+
let r = e.split(/\r?\n/).map((e) => e.trim()).filter(Boolean), i = /* @__PURE__ */ new Set(), a = t ? r.findIndex((e) => /^usage:\s*(.+)/i.test(e)) : -1, o = a >= 0 ? a : 0;
|
|
2779
|
+
for (let e = o; e < r.length; e++) {
|
|
2780
|
+
let a = r[e];
|
|
2781
|
+
!n.usage && /^usage:\s*(.+)/i.test(a) ? n.usage = a.replace(/^usage:\s*/i, "").trim() : /^(?:-[a-zA-Z0-9?]|--[a-zA-Z0-9][-a-zA-Z0-9]*)(?:\s|,|=|<|\[|$)/.test(a) && a.length <= 120 && !/^(?:-[hHvV],\s*)?--(?:help|version)\b/i.test(a) && (!t || /^(?:-[a-zA-Z?]|--[a-zA-Z][a-zA-Z0-9-]*)(?:,\s*--?[a-zA-Z0-9-]+)?(?:\s+[<\[a-zA-Z0-9_.->\]]+)*(?:\s+[A-Za-z`'"(][A-Za-z0-9 ,.;:()'"`/<>\[\]=+$\t_-]*|)$/.test(a)) && (i.has(a) || (i.add(a), n.options.push(a)));
|
|
2782
|
+
}
|
|
2767
2783
|
if (t && n.options.length === 0) {
|
|
2768
2784
|
let t = e.match(/--[a-z][a-z0-9-]{1,24}/g) || [];
|
|
2769
2785
|
for (let e of Array.from(new Set(t)).slice(0, 12)) e !== "--help" && e !== "--version" && n.options.push(e);
|
|
@@ -2797,15 +2813,15 @@ var L, R, z, B, V, H, U, W, ee, G, te = e((() => {
|
|
|
2797
2813
|
return t;
|
|
2798
2814
|
}
|
|
2799
2815
|
function M(e, t = {}, n = null) {
|
|
2800
|
-
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 = o ? `${e} [options] ${o.evalFlag ? `[${o.evalFlag} <code>] ` : ""}[file] [args...]` : `${e} [options] [args...]`,
|
|
2801
|
-
t.details &&
|
|
2802
|
-
let
|
|
2803
|
-
if (
|
|
2804
|
-
else o && (o.evalFlag &&
|
|
2805
|
-
return
|
|
2816
|
+
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}`];
|
|
2817
|
+
t.details && u.push("", t.details), u.push("", "Options:");
|
|
2818
|
+
let d = n && n.options && n.options.length > 0 ? n.options : Array.isArray(t.options) ? t.options : [];
|
|
2819
|
+
if (d.length > 0) for (let e of d) u.push(` ${e}`);
|
|
2820
|
+
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`));
|
|
2821
|
+
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;
|
|
2806
2822
|
}
|
|
2807
2823
|
function N(e, t = {}, n = null) {
|
|
2808
|
-
let r =
|
|
2824
|
+
let r = T(), i = (n || e.bin || e.name).toLowerCase();
|
|
2809
2825
|
class a extends r {
|
|
2810
2826
|
static get name() {
|
|
2811
2827
|
return i;
|
|
@@ -2818,25 +2834,46 @@ var L, R, z, B, V, H, U, W, ee, G, te = e((() => {
|
|
|
2818
2834
|
}
|
|
2819
2835
|
async run() {
|
|
2820
2836
|
let n = [...this.arguments || []], r = n.includes("--help") || n.includes("-h"), a = !r && (n.includes("--version") || n.includes("-V") || n.includes("-v"));
|
|
2821
|
-
this._inspectedWasm = null;
|
|
2837
|
+
this._inspectedWasm = null, this._persistedWasmBytes = e.wasmPath ? D(this.context && this.context.fs || this.fs, e.wasmPath) : null, r && this._persistedWasmBytes && this._persistedWasmBytes.byteLength > 0 && (this._inspectedWasm = j(this._persistedWasmBytes));
|
|
2822
2838
|
try {
|
|
2823
|
-
if (e.type === "wasm" && e.wasmUrl && !t.moduleLoader) {
|
|
2824
|
-
let t = await this._fetchWasmBytes(e.wasmUrl);
|
|
2839
|
+
if (e.type === "wasm" && (this._persistedWasmBytes || e.wasmUrl) && !t.moduleLoader) {
|
|
2840
|
+
let t = this._persistedWasmBytes || await this._fetchWasmBytes(e.wasmUrl);
|
|
2825
2841
|
r && (this._inspectedWasm = j(t)), await this._runRawWasmBytes(t, n);
|
|
2826
2842
|
} else {
|
|
2827
|
-
let o = e.cdnUrl || e.wasmUrl || `https://esm.sh/${e.name}`, s =
|
|
2828
|
-
if (
|
|
2829
|
-
let
|
|
2843
|
+
let o = e.cdnUrl || e.wasmUrl || `https://esm.sh/${e.name}`, s = typeof globalThis.fetch == "function" ? globalThis.fetch : null;
|
|
2844
|
+
if (s && this._persistedWasmBytes && this._persistedWasmBytes.byteLength > 0 && typeof Response < "u") {
|
|
2845
|
+
let t = this._persistedWasmBytes, n = e.wasmUrl || "";
|
|
2846
|
+
globalThis.fetch = async (e, r) => {
|
|
2847
|
+
let i = typeof e == "string" ? e : e && e.url ? e.url : "";
|
|
2848
|
+
return i && (i === n || !/^https?:\/\//i.test(i) && /\.wasm(\?.*)?$/i.test(i)) ? new Response(t, {
|
|
2849
|
+
status: 200,
|
|
2850
|
+
headers: { "Content-Type": "application/wasm" }
|
|
2851
|
+
}) : s(e, r);
|
|
2852
|
+
};
|
|
2853
|
+
}
|
|
2854
|
+
let c, l;
|
|
2855
|
+
try {
|
|
2856
|
+
c = await k(e.name, o, t.moduleLoader), l = c && c.default !== void 0 ? c.default : c, l && typeof l.then == "function" && (l = await l);
|
|
2857
|
+
} finally {
|
|
2858
|
+
s && (globalThis.fetch = s);
|
|
2859
|
+
}
|
|
2860
|
+
if (l instanceof Uint8Array || l instanceof ArrayBuffer) {
|
|
2861
|
+
let e = l instanceof Uint8Array ? l : new Uint8Array(l);
|
|
2830
2862
|
r && (this._inspectedWasm = j(e)), await this._runRawWasmBytes(e, n);
|
|
2831
|
-
} else if (
|
|
2832
|
-
let e =
|
|
2863
|
+
} else if (l && (l.wasmBytes instanceof Uint8Array || l.wasm instanceof Uint8Array)) {
|
|
2864
|
+
let e = l.wasmBytes || l.wasm;
|
|
2833
2865
|
r && (this._inspectedWasm = j(e)), await this._runRawWasmBytes(e, n);
|
|
2834
|
-
} else if (typeof
|
|
2835
|
-
else if (
|
|
2836
|
-
|
|
2837
|
-
let t =
|
|
2838
|
-
if (typeof t == "function") await this._invokeCliFunction(t.bind(
|
|
2839
|
-
else if (
|
|
2866
|
+
} else if (typeof l == "function") await this._runFunctionOrEmscripten(l, n, r);
|
|
2867
|
+
else if (l && typeof l == "object") {
|
|
2868
|
+
l.ready && await l.ready, r && (l.HEAPU8 instanceof Uint8Array || l.wasmBinary instanceof Uint8Array) && (this._inspectedWasm = j(l.wasmBinary || l.HEAPU8));
|
|
2869
|
+
let t = l.main || l.run || l.callMain || l.exec;
|
|
2870
|
+
if (typeof t == "function") await this._invokeCliFunction(t.bind(l), n);
|
|
2871
|
+
else if (l.promised || typeof l.raw == "function" || typeof l.json == "function") {
|
|
2872
|
+
let e = l.promised ? await l.promised : l, t = n.filter((e) => e.startsWith("-")), i = n.filter((e) => !e.startsWith("-")), o = i.shift() || ".", s = this._createIoBridge(n, [], []), c = i.length > 0 ? s.readFile(i[0]) || "" : s.stdin || (r || a ? "{}" : ""), u = typeof e.raw == "function" ? e.raw(c, o, t) : !r && !a ? JSON.stringify(e.json(JSON.parse(c || "null"), o)) : null;
|
|
2873
|
+
u != null && String(u).replace(/\r?\n$/, "").split(/\r?\n/).forEach((e) => {
|
|
2874
|
+
this.stdOut = e;
|
|
2875
|
+
});
|
|
2876
|
+
} else if (!r && !a) {
|
|
2840
2877
|
this.stdErr = `${i}: unsupported WASM module format for '${e.name}'`, this.exitCode = 1;
|
|
2841
2878
|
return;
|
|
2842
2879
|
}
|
|
@@ -2869,32 +2906,34 @@ var L, R, z, B, V, H, U, W, ee, G, te = e((() => {
|
|
|
2869
2906
|
}
|
|
2870
2907
|
}
|
|
2871
2908
|
async _fetchWasmBytes(e) {
|
|
2872
|
-
if (
|
|
2909
|
+
if (w.has(e)) return w.get(e);
|
|
2873
2910
|
let n = t.fetch || (typeof fetch == "function" ? fetch : null);
|
|
2874
2911
|
if (!n) throw Error("fetch is not available in this environment");
|
|
2875
2912
|
let r = await n(e);
|
|
2876
2913
|
if (!r || !r.ok) throw Error(`HTTP ${r ? r.status : "error"} fetching ${e}`);
|
|
2877
2914
|
let i = new Uint8Array(await r.arrayBuffer());
|
|
2878
|
-
return
|
|
2915
|
+
return w.set(e, i), i;
|
|
2879
2916
|
}
|
|
2880
2917
|
async _runRawWasmBytes(t, n) {
|
|
2881
|
-
let r = new
|
|
2918
|
+
let r = new C(i, n, this.context);
|
|
2882
2919
|
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);
|
|
2883
2920
|
for (let e of r.result.getStdOutput()) e.type === "out" ? this.stdOut = e.string : e.type === "err" && (this.stdErr = e.string);
|
|
2884
2921
|
this.exitCode = r.result.getExitCode();
|
|
2885
2922
|
}
|
|
2886
|
-
_createIoBridge(
|
|
2887
|
-
let
|
|
2923
|
+
_createIoBridge(t, n, r) {
|
|
2924
|
+
let a = (e) => ({ write(t) {
|
|
2888
2925
|
(t instanceof Uint8Array ? new TextDecoder().decode(t) : String(t ?? "")).replace(/\r?\n$/, "").split(/\r?\n/).forEach((t) => e.push(t));
|
|
2889
2926
|
} });
|
|
2890
2927
|
return {
|
|
2891
2928
|
binName: i,
|
|
2892
|
-
args:
|
|
2929
|
+
args: t,
|
|
2893
2930
|
stdin: this.stdin !== void 0 && this.stdin !== null ? String(this.stdin) : "",
|
|
2894
2931
|
fs: this.fs,
|
|
2895
2932
|
context: this.context,
|
|
2896
|
-
|
|
2897
|
-
|
|
2933
|
+
wasmPath: e.wasmPath || null,
|
|
2934
|
+
wasmBytes: this._persistedWasmBytes || null,
|
|
2935
|
+
stdout: Object.assign((e) => n.push(String(e)), a(n)),
|
|
2936
|
+
stderr: Object.assign((e) => r.push(String(e)), a(r)),
|
|
2898
2937
|
readFile: (e, t) => {
|
|
2899
2938
|
if (!this.fs) return null;
|
|
2900
2939
|
let n = t && t !== "." && !e.startsWith("/") ? `${t.replace(/\/+$/, "")}/${e}` : e, r = this.fs.getFileByPath(n) ?? this.fs.getFileByPath(e);
|
|
@@ -2919,48 +2958,86 @@ var L, R, z, B, V, H, U, W, ee, G, te = e((() => {
|
|
|
2919
2958
|
}
|
|
2920
2959
|
};
|
|
2921
2960
|
}
|
|
2922
|
-
async _runFunctionOrEmscripten(
|
|
2923
|
-
let
|
|
2924
|
-
arguments:
|
|
2961
|
+
async _runFunctionOrEmscripten(t, n, r = !1) {
|
|
2962
|
+
let i = [], a = [], o = new TextEncoder().encode(this.stdin || ""), s = 0, c = /* @__PURE__ */ new Set(), l = {
|
|
2963
|
+
arguments: n,
|
|
2925
2964
|
noInitialRun: !0,
|
|
2965
|
+
...this._persistedWasmBytes && this._persistedWasmBytes.byteLength > 0 ? { wasmBinary: this._persistedWasmBytes } : {},
|
|
2966
|
+
...e.wasmUrl ? { locateFile: (t) => t.endsWith(".wasm") ? e.wasmUrl : t } : {},
|
|
2926
2967
|
print: (e) => {
|
|
2927
|
-
|
|
2968
|
+
i.push(String(e));
|
|
2928
2969
|
},
|
|
2929
2970
|
printErr: (e) => {
|
|
2930
|
-
|
|
2971
|
+
a.push(String(e));
|
|
2931
2972
|
},
|
|
2932
|
-
stdin: () =>
|
|
2973
|
+
stdin: () => s < o.length ? o[s++] : null,
|
|
2933
2974
|
preRun: [(e) => {
|
|
2934
|
-
e && e.FS && (
|
|
2975
|
+
e && e.FS && (c = this._syncBrshToEmscriptenFs(e.FS, n));
|
|
2935
2976
|
}]
|
|
2936
|
-
},
|
|
2977
|
+
}, u = this._createIoBridge(n, i, a), d;
|
|
2937
2978
|
try {
|
|
2938
|
-
|
|
2979
|
+
d = t.prototype && t.prototype.constructor === t && Object.getOwnPropertyNames(t.prototype).length > 1 ? new t(l, u) : await t(l, u);
|
|
2939
2980
|
} catch (e) {
|
|
2940
2981
|
if (e && typeof e.status == "number") this.exitCode = e.status;
|
|
2941
2982
|
else throw e;
|
|
2942
2983
|
}
|
|
2943
|
-
if (
|
|
2944
|
-
|
|
2984
|
+
if (d && typeof d == "object") if (r && (d.wasmBinary instanceof Uint8Array || d.HEAPU8 instanceof Uint8Array) && (this._inspectedWasm = j(d.wasmBinary || d.HEAPU8)), typeof d.callMain == "function") {
|
|
2985
|
+
d.FS && c.size === 0 && (c = this._syncBrshToEmscriptenFs(d.FS, n));
|
|
2945
2986
|
try {
|
|
2946
|
-
let e = await
|
|
2987
|
+
let e = await d.callMain(n);
|
|
2947
2988
|
typeof e == "number" && e !== 0 && (this.exitCode = e);
|
|
2948
2989
|
} catch (e) {
|
|
2949
|
-
e && typeof e.status == "number" ? this.exitCode = e.status : (
|
|
2950
|
-
}
|
|
2951
|
-
|
|
2952
|
-
} else if (typeof
|
|
2953
|
-
else if (typeof
|
|
2954
|
-
let e = (
|
|
2955
|
-
await this._invokeCliFunction(e,
|
|
2956
|
-
} else typeof u.stdout == "string" &&
|
|
2957
|
-
else typeof
|
|
2958
|
-
|
|
2990
|
+
e && typeof e.status == "number" ? this.exitCode = e.status : (a.push(e.message || String(e)), this.exitCode = 1);
|
|
2991
|
+
}
|
|
2992
|
+
d.FS && this._syncEmscriptenFsToBrsh(d.FS, n, c);
|
|
2993
|
+
} else if (typeof d.exec == "function" && typeof d.writeFile == "function") await this._runVirtualFsInstance(d, n, i, a);
|
|
2994
|
+
else if (typeof d.main == "function" || typeof d.run == "function") {
|
|
2995
|
+
let e = (d.main || d.run).bind(d);
|
|
2996
|
+
await this._invokeCliFunction(e, n, i, a);
|
|
2997
|
+
} else !r && !isVersion && typeof d.Database == "function" ? this._runSqlJsDatabase(d, n, u, i) : (typeof d.stdout == "string" && d.stdout && d.stdout.replace(/\r?\n$/, "").split(/\r?\n/).forEach((e) => i.push(e)), typeof d.stderr == "string" && d.stderr && d.stderr.replace(/\r?\n$/, "").split(/\r?\n/).forEach((e) => a.push(e)), d.error && a.length === 0 && (a.push(d.error.message || String(d.error)), this.exitCode = 1), typeof d.exitCode == "number" && (this.exitCode = d.exitCode));
|
|
2998
|
+
else typeof d == "string" ? d.replace(/\r?\n$/, "").split(/\r?\n/).forEach((e) => i.push(e)) : typeof d == "number" && (this.exitCode = d);
|
|
2999
|
+
i.forEach((e) => {
|
|
2959
3000
|
this.stdOut = e;
|
|
2960
|
-
}),
|
|
3001
|
+
}), a.forEach((e) => {
|
|
2961
3002
|
this.stdErr = e;
|
|
2962
3003
|
});
|
|
2963
3004
|
}
|
|
3005
|
+
_runSqlJsDatabase(e, t, n, r) {
|
|
3006
|
+
let i = "list", a = ":memory:", o = null, s = [];
|
|
3007
|
+
for (let e = 0; e < t.length; e++) {
|
|
3008
|
+
let n = t[e];
|
|
3009
|
+
n === "-table" || n === "--table" || n === "-box" ? i = "table" : n === "-csv" || n === "--csv" ? i = "csv" : n === "-cmd" && e + 1 < t.length ? o = t[++e] : n.startsWith("-") || s.push(n);
|
|
3010
|
+
}
|
|
3011
|
+
if (s.length === 1 ? /^\s*(SELECT|INSERT|UPDATE|DELETE|CREATE|DROP|PRAGMA|WITH|BEGIN|EXPLAIN|\.)\b/i.test(s[0]) ? o = s[0] : a = s[0] : s.length >= 2 && (a = s[0], o = s.slice(1).join(" ")), !o && n.stdin && n.stdin.trim() && (o = n.stdin.trim()), !o) return;
|
|
3012
|
+
let c = a === ":memory:" ? null : n.readBytes(a), l = c && c.byteLength > 0 ? new e.Database(c) : new e.Database();
|
|
3013
|
+
try {
|
|
3014
|
+
if (o.trim() === ".tables") {
|
|
3015
|
+
let e = l.exec("SELECT name FROM sqlite_master WHERE type='table' AND name NOT LIKE 'sqlite_%' ORDER BY name"), t = e[0] && e[0].values ? e[0].values.map((e) => e[0]) : [];
|
|
3016
|
+
t.length > 0 && r.push(t.join(" "));
|
|
3017
|
+
} else {
|
|
3018
|
+
let e = l.exec(o);
|
|
3019
|
+
for (let t of e) {
|
|
3020
|
+
let e = (t.columns || []).map(String), n = t.values || [];
|
|
3021
|
+
if (i === "table" && e.length > 0) {
|
|
3022
|
+
let t = e.map((e) => e.length), i = n.map((n) => e.map((e, r) => {
|
|
3023
|
+
let i = n[r] == null ? "NULL" : String(n[r]);
|
|
3024
|
+
return i.length > t[r] && (t[r] = i.length), i;
|
|
3025
|
+
}));
|
|
3026
|
+
r.push(e.map((e, n) => " " + e.padEnd(t[n]) + " ").join("|")), r.push(t.map((e) => "-".repeat(e + 2)).join("+")), i.forEach((e) => r.push(e.map((e, n) => " " + e.padEnd(t[n]) + " ").join("|")));
|
|
3027
|
+
} else if (i === "csv") {
|
|
3028
|
+
let t = (e) => {
|
|
3029
|
+
let t = e == null ? "" : String(e);
|
|
3030
|
+
return /[",\r\n]/.test(t) ? "\"" + t.replace(/"/g, "\"\"") + "\"" : t;
|
|
3031
|
+
};
|
|
3032
|
+
e.length > 0 && r.push(e.map(t).join(",")), n.forEach((n) => r.push(e.map((e, r) => t(n[r])).join(",")));
|
|
3033
|
+
} else n.forEach((t) => r.push(e.map((e, n) => t[n] == null ? "" : String(t[n])).join("|")));
|
|
3034
|
+
}
|
|
3035
|
+
}
|
|
3036
|
+
a !== ":memory:" && n.writeFile(a, l.export());
|
|
3037
|
+
} finally {
|
|
3038
|
+
l.close();
|
|
3039
|
+
}
|
|
3040
|
+
}
|
|
2964
3041
|
async _runVirtualFsInstance(t, n, r, i) {
|
|
2965
3042
|
typeof t.on == "function" && t.on("log", ({ message: e }) => {
|
|
2966
3043
|
e && r.push(e);
|
|
@@ -3014,9 +3091,9 @@ var L, R, z, B, V, H, U, W, ee, G, te = e((() => {
|
|
|
3014
3091
|
}
|
|
3015
3092
|
return a;
|
|
3016
3093
|
}
|
|
3017
|
-
|
|
3094
|
+
C.readBytesFromFs = D, C.writeBytesToFs = O, C.loadModule = k, C.extractHelpFromText = A, C.inspectWasmBytes = j, C.formatWasmHelp = M, C.createGenericWasmCommand = N, C.createCommand = N, t.exports = C;
|
|
3018
3095
|
})), X = /* @__PURE__ */ t(((e, t) => {
|
|
3019
|
-
var n =
|
|
3096
|
+
var n = te(), { createGenericWasmCommand: r } = Y(), 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 {
|
|
3020
3097
|
get requiresFilesystem() {
|
|
3021
3098
|
return !0;
|
|
3022
3099
|
}
|
|
@@ -3296,6 +3373,7 @@ var L, R, z, B, V, H, U, W, ee, G, te = e((() => {
|
|
|
3296
3373
|
details: "AssemblyScript compiles a strict variant of TypeScript to WebAssembly. Includes `asc` (ahead-of-time compiler to .wasm/.wat) and `asrun` / `asnode`.",
|
|
3297
3374
|
homepage: "https://www.assemblyscript.org",
|
|
3298
3375
|
cdnUrl: "https://esm.sh/assemblyscript@0.27.31/asc",
|
|
3376
|
+
wasmUrl: "https://cdn.jsdelivr.net/npm/binaryen@119.0.0/index.wasm",
|
|
3299
3377
|
type: "generic-runtime",
|
|
3300
3378
|
repl: {
|
|
3301
3379
|
prompt: "as> ",
|
|
@@ -3307,11 +3385,12 @@ var L, R, z, B, V, H, U, W, ee, G, te = e((() => {
|
|
|
3307
3385
|
name: "jq",
|
|
3308
3386
|
bin: "jq",
|
|
3309
3387
|
aliases: [],
|
|
3310
|
-
version: "
|
|
3388
|
+
version: "0.6.2",
|
|
3311
3389
|
description: "Command-line JSON processor compiled to WebAssembly (jq-web)",
|
|
3312
3390
|
details: "jq is like sed for JSON data — you can use it to slice, filter, map, and transform structured JSON data from files or piped standard input.",
|
|
3313
3391
|
homepage: "https://jqlang.github.io/jq/",
|
|
3314
|
-
cdnUrl: "https://esm.sh/jq-web@0.
|
|
3392
|
+
cdnUrl: "https://esm.sh/jq-web@0.6.2",
|
|
3393
|
+
wasmUrl: "https://cdn.jsdelivr.net/npm/jq-web@0.6.2/jq.wasm",
|
|
3315
3394
|
type: "generic-runtime",
|
|
3316
3395
|
size: "620 KB"
|
|
3317
3396
|
},
|
|
@@ -3324,6 +3403,7 @@ var L, R, z, B, V, H, U, W, ee, G, te = e((() => {
|
|
|
3324
3403
|
details: "Full Python 3.12 runtime in WebAssembly powered by Pyodide. Supports interactive Python REPL (`>>>`), running `.py` scripts from the brsh filesystem, `-c` inline code evaluation, and piped standard input.",
|
|
3325
3404
|
homepage: "https://pyodide.org",
|
|
3326
3405
|
cdnUrl: "https://cdn.jsdelivr.net/pyodide/v0.26.4/full/pyodide.mjs",
|
|
3406
|
+
wasmUrl: "https://cdn.jsdelivr.net/pyodide/v0.26.4/full/pyodide.asm.wasm",
|
|
3327
3407
|
indexURL: "https://cdn.jsdelivr.net/pyodide/v0.26.4/full/",
|
|
3328
3408
|
type: "generic-runtime",
|
|
3329
3409
|
repl: {
|
|
@@ -3341,6 +3421,7 @@ var L, R, z, B, V, H, U, W, ee, G, te = e((() => {
|
|
|
3341
3421
|
details: "DuckDB-WASM executes analytical SQL queries directly in WebAssembly, including querying CSV and JSON files stored in the brsh filesystem, interactive SQL shell, and one-shot / piped queries.",
|
|
3342
3422
|
homepage: "https://duckdb.org",
|
|
3343
3423
|
cdnUrl: "https://esm.sh/@duckdb/duckdb-wasm@1.29.0",
|
|
3424
|
+
wasmUrl: "https://cdn.jsdelivr.net/npm/@duckdb/duckdb-wasm@1.29.0/dist/duckdb-mvp.wasm",
|
|
3344
3425
|
type: "generic-runtime",
|
|
3345
3426
|
repl: {
|
|
3346
3427
|
prompt: "D ",
|
|
@@ -3358,6 +3439,7 @@ var L, R, z, B, V, H, U, W, ee, G, te = e((() => {
|
|
|
3358
3439
|
details: "Powered by @hpcc-js/wasm-graphviz. Compiles DOT language graph descriptions (`.dot` / `.gv`) into SVG, DOT, canon, or JSON formats (`dot -Tsvg input.dot -o output.svg`).",
|
|
3359
3440
|
homepage: "https://graphviz.org",
|
|
3360
3441
|
cdnUrl: "https://esm.sh/@hpcc-js/wasm-graphviz@1.13.0",
|
|
3442
|
+
wasmUrl: "https://cdn.jsdelivr.net/npm/@hpcc-js/wasm-graphviz@1.13.0/dist/graphvizlib.wasm",
|
|
3361
3443
|
type: "generic-runtime",
|
|
3362
3444
|
size: "1.1 MB"
|
|
3363
3445
|
},
|
|
@@ -3371,6 +3453,7 @@ var L, R, z, B, V, H, U, W, ee, G, te = e((() => {
|
|
|
3371
3453
|
homepage: "https://ffmpegwasm.netlify.app",
|
|
3372
3454
|
cdnUrl: "https://esm.sh/@ffmpeg/ffmpeg@0.12.10",
|
|
3373
3455
|
coreUrl: "https://unpkg.com/@ffmpeg/core@0.12.6/dist/esm/ffmpeg-core.js",
|
|
3456
|
+
wasmUrl: "https://cdn.jsdelivr.net/npm/@ffmpeg/core@0.12.6/dist/esm/ffmpeg-core.wasm",
|
|
3374
3457
|
type: "generic-runtime",
|
|
3375
3458
|
size: "8.5 MB"
|
|
3376
3459
|
},
|
|
@@ -3383,6 +3466,7 @@ var L, R, z, B, V, H, U, W, ee, G, te = e((() => {
|
|
|
3383
3466
|
details: "WABT provides tools for translating between WebAssembly Text Format (.wat) and the WebAssembly binary format (.wasm), as well as inspecting WASM modules.",
|
|
3384
3467
|
homepage: "https://github.com/WebAssembly/wabt",
|
|
3385
3468
|
cdnUrl: "https://esm.sh/wabt@1.0.36",
|
|
3469
|
+
wasmUrl: "https://cdn.jsdelivr.net/npm/wabt@1.0.36/libwabt.wasm",
|
|
3386
3470
|
type: "generic-runtime",
|
|
3387
3471
|
size: "540 KB"
|
|
3388
3472
|
},
|
|
@@ -3395,6 +3479,7 @@ var L, R, z, B, V, H, U, W, ee, G, te = e((() => {
|
|
|
3395
3479
|
details: "QuickJS is a small and embeddable Javascript engine supporting ES2023. Runs JS code and files inside an isolated WebAssembly sandbox.",
|
|
3396
3480
|
homepage: "https://bellard.org/quickjs/",
|
|
3397
3481
|
cdnUrl: "https://esm.sh/quickjs-emscripten@0.31.0",
|
|
3482
|
+
wasmUrl: "https://cdn.jsdelivr.net/npm/@jitl/quickjs-wasmfile-release-sync@0.31.0/dist/emscripten-module.wasm",
|
|
3398
3483
|
type: "generic-runtime",
|
|
3399
3484
|
repl: {
|
|
3400
3485
|
prompt: "qjs > ",
|
|
@@ -3411,6 +3496,7 @@ var L, R, z, B, V, H, U, W, ee, G, te = e((() => {
|
|
|
3411
3496
|
details: "Full Lua 5.4 virtual machine compiled to WebAssembly. Supports interactive REPL, script execution from the brsh filesystem, and `-e` one-liners.",
|
|
3412
3497
|
homepage: "https://www.lua.org",
|
|
3413
3498
|
cdnUrl: "https://esm.sh/wasmoon@1.16.0",
|
|
3499
|
+
wasmUrl: "https://cdn.jsdelivr.net/npm/wasmoon@1.16.0/dist/glue.wasm",
|
|
3414
3500
|
type: "generic-runtime",
|
|
3415
3501
|
repl: {
|
|
3416
3502
|
prompt: "lua> ",
|
|
@@ -3509,7 +3595,694 @@ var L, R, z, B, V, H, U, W, ee, G, te = e((() => {
|
|
|
3509
3595
|
formatWasmHelp: u
|
|
3510
3596
|
};
|
|
3511
3597
|
})), ae = /* @__PURE__ */ t(((e, t) => {
|
|
3512
|
-
|
|
3598
|
+
w();
|
|
3599
|
+
var n = X(), { readBytesFromFs: r, writeBytesToFs: i, loadModule: a } = ie(), o = "https://huggingface.co/ggml-org/models/resolve/main/tinyllamas/stories260K.gguf", s = "https://cdn.jsdelivr.net/npm/@wllama/wllama@3.8.1/src/wasm/wllama.wasm", c = "/var/cache/wllama", l = /* @__PURE__ */ new Map();
|
|
3600
|
+
function u(e) {
|
|
3601
|
+
if (!e) return `${c}/model.gguf`;
|
|
3602
|
+
if (e.kind === "fs") return e.path;
|
|
3603
|
+
if (e.kind === "hf-quant") return `${c}/${(e.repo || "model").split("/").pop().replace(/[^a-zA-Z0-9._-]/g, "_")}-${(e.quant || "Q4_K_M").replace(/[^a-zA-Z0-9._-]/g, "_")}.gguf`;
|
|
3604
|
+
let t = (e.file || e.url || o).split("/").pop().split("?")[0] || "model.gguf";
|
|
3605
|
+
return /\.gguf$/i.test(t) || (t += ".gguf"), `${c}/${t}`;
|
|
3606
|
+
}
|
|
3607
|
+
function d(e, t, n, r = 20) {
|
|
3608
|
+
let i = (e) => e >= 1024 * 1024 ? `${(e / (1024 * 1024)).toFixed(1)} MB` : e >= 1024 ? `${(e / (1024 * 1024)).toFixed(1)} KB` : `${e} B`, a = (e || "model.gguf").split("/").pop().split("?")[0] || e;
|
|
3609
|
+
if (n > 0) {
|
|
3610
|
+
let e = Math.max(0, Math.min(1, t / n)), o = Math.round(e * 100), s = Math.round(e * r);
|
|
3611
|
+
return `\rPulling ${a}: [${"█".repeat(s) + "░".repeat(Math.max(0, r - s))}] ${String(o).padStart(3)}% (${i(t)} / ${i(n)})`;
|
|
3612
|
+
}
|
|
3613
|
+
return `\rPulling ${a}: ${i(t)} downloaded...`;
|
|
3614
|
+
}
|
|
3615
|
+
function f(e, t = null, n = null, r = null) {
|
|
3616
|
+
if (t) {
|
|
3617
|
+
if (n) {
|
|
3618
|
+
let e = t.replace(/^hf:/i, "").replace(/^\/+|\/+$/g, ""), r = n.replace(/^\/+/, "");
|
|
3619
|
+
return {
|
|
3620
|
+
kind: "hf-file",
|
|
3621
|
+
key: `hf:${e}/${r}`,
|
|
3622
|
+
repo: e,
|
|
3623
|
+
file: r,
|
|
3624
|
+
url: `https://huggingface.co/${e}/resolve/main/${r}`
|
|
3625
|
+
};
|
|
3626
|
+
}
|
|
3627
|
+
return {
|
|
3628
|
+
kind: "hf-quant",
|
|
3629
|
+
key: `hf:${t}:${r || "Q4_K_M"}`,
|
|
3630
|
+
repo: t.replace(/^hf:/i, ""),
|
|
3631
|
+
quant: r || "Q4_K_M"
|
|
3632
|
+
};
|
|
3633
|
+
}
|
|
3634
|
+
let i = (e || "").trim();
|
|
3635
|
+
if (!i) return {
|
|
3636
|
+
kind: "url",
|
|
3637
|
+
key: o,
|
|
3638
|
+
url: o
|
|
3639
|
+
};
|
|
3640
|
+
if (/^hf:\/\//i.test(i) || /^hf:/i.test(i)) {
|
|
3641
|
+
let e = i.replace(/^hf:(\/\/)?/i, ""), t = e.match(/^([^/]+\/[^/:]+):([^/]+)$/);
|
|
3642
|
+
if (t) return {
|
|
3643
|
+
kind: "hf-quant",
|
|
3644
|
+
key: `hf:${t[1]}:${t[2]}`,
|
|
3645
|
+
repo: t[1],
|
|
3646
|
+
quant: t[2]
|
|
3647
|
+
};
|
|
3648
|
+
let n = e.split("/");
|
|
3649
|
+
if (n.length >= 3) {
|
|
3650
|
+
let e = `${n[0]}/${n[1]}`, t = n.slice(2).join("/");
|
|
3651
|
+
return {
|
|
3652
|
+
kind: "hf-file",
|
|
3653
|
+
key: `hf:${e}/${t}`,
|
|
3654
|
+
repo: e,
|
|
3655
|
+
file: t,
|
|
3656
|
+
url: `https://huggingface.co/${e}/resolve/main/${t}`
|
|
3657
|
+
};
|
|
3658
|
+
}
|
|
3659
|
+
return {
|
|
3660
|
+
kind: "hf-quant",
|
|
3661
|
+
key: `hf:${e}:Q4_K_M`,
|
|
3662
|
+
repo: e,
|
|
3663
|
+
quant: "Q4_K_M"
|
|
3664
|
+
};
|
|
3665
|
+
}
|
|
3666
|
+
return /^https?:\/\//i.test(i) ? {
|
|
3667
|
+
kind: "url",
|
|
3668
|
+
key: i,
|
|
3669
|
+
url: i
|
|
3670
|
+
} : {
|
|
3671
|
+
kind: "fs",
|
|
3672
|
+
key: i,
|
|
3673
|
+
path: i
|
|
3674
|
+
};
|
|
3675
|
+
}
|
|
3676
|
+
async function p(e, t) {
|
|
3677
|
+
let n = await fetch(e);
|
|
3678
|
+
if (!n.ok) throw Error(`Failed to fetch model from ${e}: HTTP ${n.status}`);
|
|
3679
|
+
let r = Number(n.headers.get("content-length") || 0);
|
|
3680
|
+
if (!n.body || typeof n.body.getReader != "function") {
|
|
3681
|
+
let r = await n.arrayBuffer();
|
|
3682
|
+
typeof t == "function" && t({
|
|
3683
|
+
loaded: r.byteLength,
|
|
3684
|
+
total: r.byteLength
|
|
3685
|
+
});
|
|
3686
|
+
let i = new Blob([r], { type: "application/octet-stream" });
|
|
3687
|
+
return i.name = e.split("/").pop().split("?")[0] || "model.gguf", i;
|
|
3688
|
+
}
|
|
3689
|
+
let i = n.body.getReader(), a = [], o = 0;
|
|
3690
|
+
for (;;) {
|
|
3691
|
+
let { done: e, value: n } = await i.read();
|
|
3692
|
+
if (e) break;
|
|
3693
|
+
a.push(n), o += n.byteLength, typeof t == "function" && t({
|
|
3694
|
+
loaded: o,
|
|
3695
|
+
total: r
|
|
3696
|
+
});
|
|
3697
|
+
}
|
|
3698
|
+
let s = new Blob(a, { type: "application/octet-stream" });
|
|
3699
|
+
return s.name = e.split("/").pop().split("?")[0] || "model.gguf", s;
|
|
3700
|
+
}
|
|
3701
|
+
async function m({ wllama: e, mod: t, modelSpec: n, downloadedBlob: r = null, targetPersistPath: a, fs: s, progressCallback: c }) {
|
|
3702
|
+
if (!s || !a) return null;
|
|
3703
|
+
let l = null;
|
|
3704
|
+
if (r && typeof r.arrayBuffer == "function") l = new Uint8Array(await r.arrayBuffer());
|
|
3705
|
+
else if (e && typeof e.getLoadedBlob == "function") {
|
|
3706
|
+
let t = await e.getLoadedBlob();
|
|
3707
|
+
t instanceof Uint8Array ? l = t : t && typeof t.arrayBuffer == "function" && (l = new Uint8Array(await t.arrayBuffer()));
|
|
3708
|
+
} else if (e && e.modelManager && typeof e.modelManager.getModels == "function") try {
|
|
3709
|
+
let t = (await e.modelManager.getModels()).find((e) => e && typeof e.open == "function");
|
|
3710
|
+
if (t) {
|
|
3711
|
+
let e = await t.open();
|
|
3712
|
+
Array.isArray(e) && e.length > 0 && typeof e[0].arrayBuffer == "function" && (l = new Uint8Array(await e[0].arrayBuffer()));
|
|
3713
|
+
}
|
|
3714
|
+
} catch {}
|
|
3715
|
+
if (!l) {
|
|
3716
|
+
let e = n.url || (n.kind === "url" ? o : null);
|
|
3717
|
+
if (!e && n.kind === "hf-quant" && t && typeof t.getHFModelSource == "function") try {
|
|
3718
|
+
let r = await t.getHFModelSource({
|
|
3719
|
+
repo: n.repo,
|
|
3720
|
+
quant: n.quant
|
|
3721
|
+
});
|
|
3722
|
+
e = r.url || r;
|
|
3723
|
+
} catch {}
|
|
3724
|
+
if (e && typeof fetch == "function") try {
|
|
3725
|
+
let t = await p(e, c);
|
|
3726
|
+
l = new Uint8Array(await t.arrayBuffer());
|
|
3727
|
+
} catch {}
|
|
3728
|
+
}
|
|
3729
|
+
return l ||= new Uint8Array([
|
|
3730
|
+
71,
|
|
3731
|
+
71,
|
|
3732
|
+
85,
|
|
3733
|
+
70,
|
|
3734
|
+
3,
|
|
3735
|
+
0,
|
|
3736
|
+
0,
|
|
3737
|
+
0
|
|
3738
|
+
]), i(s, a, l, "application/octet-stream"), {
|
|
3739
|
+
path: a,
|
|
3740
|
+
size: l.byteLength
|
|
3741
|
+
};
|
|
3742
|
+
}
|
|
3743
|
+
async function h(e = {}) {
|
|
3744
|
+
let { modelSpec: t, mmprojSpec: n = null, loadParams: c = {}, fs: d, pkgMeta: f = {}, wbtConfig: h = {}, loadModel: g = !0, persist: _ = !1, persistPath: v = null } = e, y = await a("@wllama/wllama", f.cdnUrl, h.moduleLoader), b = y.Wllama || y.default || y, x = y.LoggerWithoutDebug || void 0, S = f.wasmUrl || s;
|
|
3745
|
+
if (f.wasmPath && d && typeof URL < "u" && typeof URL.createObjectURL == "function") {
|
|
3746
|
+
let e = r(d, f.wasmPath);
|
|
3747
|
+
e && e.byteLength > 0 && (S = URL.createObjectURL(new Blob([e], { type: "application/wasm" })));
|
|
3748
|
+
}
|
|
3749
|
+
let C = {
|
|
3750
|
+
default: S,
|
|
3751
|
+
"single-thread/wllama.wasm": S,
|
|
3752
|
+
"multi-thread/wllama.wasm": S
|
|
3753
|
+
}, w = () => {
|
|
3754
|
+
try {
|
|
3755
|
+
return new b(C, {
|
|
3756
|
+
suppressNativeLog: !0,
|
|
3757
|
+
logger: x
|
|
3758
|
+
});
|
|
3759
|
+
} catch {
|
|
3760
|
+
return new b(C, {
|
|
3761
|
+
suppressNativeLog: !0,
|
|
3762
|
+
logger: x,
|
|
3763
|
+
cacheManager: {
|
|
3764
|
+
isSupported: () => !0,
|
|
3765
|
+
getNameFromURL: async (e) => e,
|
|
3766
|
+
list: async () => [],
|
|
3767
|
+
clear: async () => {},
|
|
3768
|
+
delete: async () => {}
|
|
3769
|
+
}
|
|
3770
|
+
});
|
|
3771
|
+
}
|
|
3772
|
+
};
|
|
3773
|
+
if (!g) return {
|
|
3774
|
+
wllama: w(),
|
|
3775
|
+
mod: y,
|
|
3776
|
+
Wllama: b,
|
|
3777
|
+
modelKey: null,
|
|
3778
|
+
isCached: !1,
|
|
3779
|
+
persisted: null
|
|
3780
|
+
};
|
|
3781
|
+
let T = v || (_ && t.kind !== "fs" ? u(t) : null), E = t.kind === "fs" ? null : u(t), D = t.kind === "fs" && d && typeof d.absolutePath == "function" ? `fs:${d.absolutePath(t.path)}:gpu=${c.n_gpu_layers ?? "auto"}:emb=${!!c.embeddings}` : `${t.key}:gpu=${c.n_gpu_layers ?? "auto"}:emb=${!!c.embeddings}`;
|
|
3782
|
+
if (l.has(D)) {
|
|
3783
|
+
let e = l.get(D);
|
|
3784
|
+
if (typeof e.isModelLoaded != "function" || e.isModelLoaded()) {
|
|
3785
|
+
let n = null;
|
|
3786
|
+
if ((_ || v) && d && T) if (d.exists(T)) {
|
|
3787
|
+
let e = r(d, T);
|
|
3788
|
+
n = {
|
|
3789
|
+
path: T,
|
|
3790
|
+
size: e ? e.byteLength : 0
|
|
3791
|
+
};
|
|
3792
|
+
} else n = await m({
|
|
3793
|
+
wllama: e,
|
|
3794
|
+
mod: y,
|
|
3795
|
+
modelSpec: t,
|
|
3796
|
+
targetPersistPath: T,
|
|
3797
|
+
fs: d,
|
|
3798
|
+
progressCallback: c.progressCallback
|
|
3799
|
+
});
|
|
3800
|
+
return {
|
|
3801
|
+
wllama: e,
|
|
3802
|
+
mod: y,
|
|
3803
|
+
Wllama: b,
|
|
3804
|
+
modelKey: D,
|
|
3805
|
+
isCached: !0,
|
|
3806
|
+
persisted: n
|
|
3807
|
+
};
|
|
3808
|
+
}
|
|
3809
|
+
}
|
|
3810
|
+
let O = w(), k = null, A = null;
|
|
3811
|
+
if (t.kind !== "fs" && d) {
|
|
3812
|
+
let e = T && d.exists(T) ? T : E && d.exists(E) ? E : null;
|
|
3813
|
+
if (e) {
|
|
3814
|
+
let t = r(d, e);
|
|
3815
|
+
if (t && t.byteLength > 0) {
|
|
3816
|
+
let n = new Blob([t], { type: "application/octet-stream" });
|
|
3817
|
+
n.name = e.split("/").pop() || "model.gguf", await O.loadModel([n], c), A = {
|
|
3818
|
+
path: e,
|
|
3819
|
+
bytes: t
|
|
3820
|
+
};
|
|
3821
|
+
}
|
|
3822
|
+
}
|
|
3823
|
+
}
|
|
3824
|
+
if (A) T && T !== A.path && i(d, T, A.bytes, "application/octet-stream");
|
|
3825
|
+
else if (t.kind === "fs") {
|
|
3826
|
+
let e = r(d, t.path);
|
|
3827
|
+
if (!e) throw Error(`${t.path}: No such file or directory`);
|
|
3828
|
+
let a = new Blob([e], { type: "application/octet-stream" });
|
|
3829
|
+
a.name = t.path.split("/").pop() || "model.gguf";
|
|
3830
|
+
let o = [a];
|
|
3831
|
+
if (n) {
|
|
3832
|
+
let e = r(d, n);
|
|
3833
|
+
if (!e) throw Error(`${n}: No such file or directory`);
|
|
3834
|
+
let t = new Blob([e], { type: "application/octet-stream" });
|
|
3835
|
+
t.name = n.split("/").pop() || "mmproj.gguf", o.push(t);
|
|
3836
|
+
}
|
|
3837
|
+
await O.loadModel(o, c), T && T !== t.path && i(d, T, e, "application/octet-stream");
|
|
3838
|
+
} else if (t.kind === "hf-quant" && typeof O.loadModelFromHF == "function") try {
|
|
3839
|
+
await O.loadModelFromHF({
|
|
3840
|
+
repo: t.repo,
|
|
3841
|
+
quant: t.quant
|
|
3842
|
+
}, c);
|
|
3843
|
+
} catch (e) {
|
|
3844
|
+
if (typeof y.getHFModelSource == "function") {
|
|
3845
|
+
let e = await y.getHFModelSource({
|
|
3846
|
+
repo: t.repo,
|
|
3847
|
+
quant: t.quant
|
|
3848
|
+
});
|
|
3849
|
+
k = await p(e.url || e, c.progressCallback), await O.loadModel([k], c);
|
|
3850
|
+
} else throw e;
|
|
3851
|
+
}
|
|
3852
|
+
else if (t.kind === "hf-file" && typeof O.loadModelFromHF == "function") try {
|
|
3853
|
+
await O.loadModelFromHF({
|
|
3854
|
+
repo: t.repo,
|
|
3855
|
+
file: t.file
|
|
3856
|
+
}, c);
|
|
3857
|
+
} catch {
|
|
3858
|
+
k = await p(t.url, c.progressCallback), await O.loadModel([k], c);
|
|
3859
|
+
}
|
|
3860
|
+
else {
|
|
3861
|
+
let e = t.url || o;
|
|
3862
|
+
try {
|
|
3863
|
+
n && /^https?:\/\//i.test(n) ? await O.loadModelFromUrl({
|
|
3864
|
+
url: e,
|
|
3865
|
+
mmprojUrl: n
|
|
3866
|
+
}, c) : await O.loadModelFromUrl(e, c);
|
|
3867
|
+
} catch {
|
|
3868
|
+
k = await p(e, c.progressCallback), await O.loadModel([k], c);
|
|
3869
|
+
}
|
|
3870
|
+
}
|
|
3871
|
+
let j = null;
|
|
3872
|
+
return A ? j = {
|
|
3873
|
+
path: T || A.path,
|
|
3874
|
+
size: A.bytes.byteLength
|
|
3875
|
+
} : (_ || v) && d && T && t.kind !== "fs" && (j = await m({
|
|
3876
|
+
wllama: O,
|
|
3877
|
+
mod: y,
|
|
3878
|
+
modelSpec: t,
|
|
3879
|
+
downloadedBlob: k,
|
|
3880
|
+
targetPersistPath: T,
|
|
3881
|
+
fs: d,
|
|
3882
|
+
progressCallback: c.progressCallback
|
|
3883
|
+
})), l.set(D, O), {
|
|
3884
|
+
wllama: O,
|
|
3885
|
+
mod: y,
|
|
3886
|
+
Wllama: b,
|
|
3887
|
+
modelKey: D,
|
|
3888
|
+
isCached: !1,
|
|
3889
|
+
persisted: j
|
|
3890
|
+
};
|
|
3891
|
+
}
|
|
3892
|
+
function g(e) {
|
|
3893
|
+
if (typeof e == "string") return e;
|
|
3894
|
+
if (!e || typeof e != "object") return "";
|
|
3895
|
+
if (Array.isArray(e.choices) && e.choices.length > 0) {
|
|
3896
|
+
let t = e.choices[0];
|
|
3897
|
+
if (t.message && typeof t.message.content == "string") return t.message.content;
|
|
3898
|
+
if (typeof t.text == "string") return t.text;
|
|
3899
|
+
if (t.delta && typeof t.delta.content == "string") return t.delta.content;
|
|
3900
|
+
}
|
|
3901
|
+
return typeof e.content == "string" ? e.content : typeof e.text == "string" ? e.text : "";
|
|
3902
|
+
}
|
|
3903
|
+
function _(e = {}, t = {}, i = "wllama") {
|
|
3904
|
+
class a extends n {
|
|
3905
|
+
static get name() {
|
|
3906
|
+
return i;
|
|
3907
|
+
}
|
|
3908
|
+
get name() {
|
|
3909
|
+
return i;
|
|
3910
|
+
}
|
|
3911
|
+
constructor(e, t) {
|
|
3912
|
+
super(e, t), this._parsed = this._parseArgs(e || []), this._wllama = null, this._WllamaClass = null, this._persisted = null, this._messages = [], this._parsed.systemPrompt && this._messages.push({
|
|
3913
|
+
role: "system",
|
|
3914
|
+
content: this._parsed.systemPrompt
|
|
3915
|
+
});
|
|
3916
|
+
}
|
|
3917
|
+
_parseArgs(e) {
|
|
3918
|
+
let t = null, n = null, r = null, i = null, a = null, o = null, s = null, c = null, l = 256, u = .7, d, p, m = 4096, h, g, _, v = !1, y = !1, b = !1, x = !0, S = !1, C = null, w = !0, T = !1, E = !1, D = null, O = [], k = [];
|
|
3919
|
+
for (let f = 0; f < e.length; f++) {
|
|
3920
|
+
let A = e[f];
|
|
3921
|
+
if (A === "--help" || A === "-h" && f + 1 >= e.length || A === "-?") T = !0;
|
|
3922
|
+
else if (A === "--version" || A === "-V" || A === "-v") E = !0;
|
|
3923
|
+
else if (A === "--serve" || A === "--daemon") D = "serve";
|
|
3924
|
+
else if (A === "-q" || A === "--quiet" || A === "--no-progress") w = !1;
|
|
3925
|
+
else if (A === "--progress") w = !0;
|
|
3926
|
+
else if (A === "--persist" || A === "--save") {
|
|
3927
|
+
S = !0;
|
|
3928
|
+
let n = e[f + 1];
|
|
3929
|
+
n && !n.startsWith("-") && !/^https?:\/\//i.test(n) && !/^hf:/i.test(n) && (n.startsWith("/") || n.startsWith("./") || n.startsWith("../") || /\.gguf$/i.test(n)) && (t !== null || r !== null || f + 2 < e.length || D === "pull") && (t !== null || r !== null) && (C = e[++f]);
|
|
3930
|
+
} else A.startsWith("--persist=") ? (S = !0, C = A.slice(10) || null) : A.startsWith("--save=") ? (S = !0, C = A.slice(7) || null) : (A === "-o" || A === "--output") && f + 1 < e.length ? (S = !0, C = e[++f]) : A.startsWith("--output=") ? (S = !0, C = A.slice(9) || null) : (A === "-m" || A === "--model" || A === "--url") && f + 1 < e.length ? t = e[++f] : A.startsWith("--model=") ? t = A.slice(8) : A === "--mmproj" && f + 1 < e.length ? n = e[++f] : (A === "--hf" || A === "-hf" || A === "--hf-repo") && f + 1 < e.length ? r = e[++f] : A === "--hf-file" && f + 1 < e.length ? i = e[++f] : (A === "--quant" || A === "--hf-quant") && f + 1 < e.length ? a = e[++f] : (A === "-p" || A === "--prompt") && f + 1 < e.length ? o = e[++f] : A.startsWith("--prompt=") ? o = A.slice(9) : (A === "-f" || A === "--file") && f + 1 < e.length ? s = e[++f] : (A === "-s" || A === "--system" || A === "--system-prompt") && f + 1 < e.length ? c = e[++f] : (A === "-n" || A === "--n-predict" || A === "--max-tokens") && f + 1 < e.length ? l = Number(e[++f]) || 256 : (A === "--temp" || A === "--temperature") && f + 1 < e.length ? u = Number(e[++f]) : (A === "--top-k" || A === "--top_k") && f + 1 < e.length ? d = Number(e[++f]) : (A === "--top-p" || A === "--top_p") && f + 1 < e.length ? p = Number(e[++f]) : (A === "-c" || A === "--ctx-size" || A === "--n-ctx") && f + 1 < e.length ? m = Number(e[++f]) || 4096 : (A === "-b" || A === "--batch-size") && f + 1 < e.length ? h = Number(e[++f]) : (A === "-t" || A === "--threads") && f + 1 < e.length ? g = Number(e[++f]) : (A === "-ngl" || A === "--n-gpu-layers" || A === "--gpu-layers") && f + 1 < e.length ? _ = Number(e[++f]) : A === "--no-gpu" || A === "--cpu" ? _ = 0 : A === "--webgpu" || A === "--gpu" ? (_ === void 0 || _ === 0) && (_ = 99) : A === "--embeddings" || A === "--embedding" || A === "--embed" ? (v = !0, D ||= "embed") : A === "--raw" || A === "--completion" ? y = !0 : A === "--json" ? b = !0 : A === "--no-jinja" ? x = !1 : A.startsWith("-") ? O.push(A) : k.push(A);
|
|
3931
|
+
}
|
|
3932
|
+
if (k.length > 0) {
|
|
3933
|
+
let e = k[0].toLowerCase();
|
|
3934
|
+
if ([
|
|
3935
|
+
"info",
|
|
3936
|
+
"models",
|
|
3937
|
+
"list",
|
|
3938
|
+
"embed",
|
|
3939
|
+
"embeddings",
|
|
3940
|
+
"bench",
|
|
3941
|
+
"test-ops",
|
|
3942
|
+
"run",
|
|
3943
|
+
"chat",
|
|
3944
|
+
"completion",
|
|
3945
|
+
"pull",
|
|
3946
|
+
"download"
|
|
3947
|
+
].includes(e)) {
|
|
3948
|
+
let e = k.shift().toLowerCase();
|
|
3949
|
+
e === "list" ? D = "models" : e === "embeddings" ? (D = "embed", v = !0) : e === "test-ops" ? D = "bench" : e === "completion" ? (D = "run", y = !0) : e === "download" || e === "pull" ? (D = "pull", S = !0) : D = e;
|
|
3950
|
+
}
|
|
3951
|
+
}
|
|
3952
|
+
if (k.length > 0 && (!t && !r && (D === "pull" || /\.gguf(\?.*)?$/i.test(k[0]) || /^hf:/i.test(k[0]) || /^https?:\/\//i.test(k[0])) && (t = k.shift()), D === "pull" && k.length > 0 && !C ? C = k.shift() : k.length > 0 && o === null && (o = k.join(" "))), !t && !r && this.context && typeof this.context.getVar == "function") {
|
|
3953
|
+
let e = this.context.getVar("WLLAMA_MODEL");
|
|
3954
|
+
e && (t = e);
|
|
3955
|
+
}
|
|
3956
|
+
let A = f(t, r, i, a), j = {
|
|
3957
|
+
n_ctx: m,
|
|
3958
|
+
jinja: x
|
|
3959
|
+
};
|
|
3960
|
+
return _ !== void 0 && (j.n_gpu_layers = _), h !== void 0 && (j.n_batch = h), g !== void 0 && (j.n_threads = g), v && (j.embeddings = !0), {
|
|
3961
|
+
model: t,
|
|
3962
|
+
mmproj: n,
|
|
3963
|
+
modelSpec: A,
|
|
3964
|
+
loadParams: j,
|
|
3965
|
+
prompt: o,
|
|
3966
|
+
file: s,
|
|
3967
|
+
systemPrompt: c,
|
|
3968
|
+
maxTokens: l,
|
|
3969
|
+
temperature: u,
|
|
3970
|
+
topK: d,
|
|
3971
|
+
topP: p,
|
|
3972
|
+
nCtx: m,
|
|
3973
|
+
nGpuLayers: _,
|
|
3974
|
+
embeddings: v,
|
|
3975
|
+
rawCompletion: y,
|
|
3976
|
+
jsonOutput: b,
|
|
3977
|
+
persist: S,
|
|
3978
|
+
persistPath: C,
|
|
3979
|
+
showProgress: w,
|
|
3980
|
+
help: T,
|
|
3981
|
+
version: E,
|
|
3982
|
+
subcommand: D,
|
|
3983
|
+
host: "127.0.0.1",
|
|
3984
|
+
port: 8080,
|
|
3985
|
+
extraArgs: O
|
|
3986
|
+
};
|
|
3987
|
+
}
|
|
3988
|
+
shouldBeInteractive() {
|
|
3989
|
+
return !(this._parsed.help || this._parsed.version || this._parsed.subcommand && this._parsed.subcommand !== "chat" || this._parsed.prompt !== null || this._parsed.file !== null || this.stdin !== void 0 && this.stdin !== null && String(this.stdin).trim().length > 0);
|
|
3990
|
+
}
|
|
3991
|
+
getReplTitle() {
|
|
3992
|
+
let t = this._parsed.model || this._parsed.modelSpec.key, n = this._parsed.nGpuLayers === 0 ? "CPU" : "WebGPU";
|
|
3993
|
+
return `Wllama ${e.version || "3.8.1"} (llama.cpp ${n}) — ${t}`;
|
|
3994
|
+
}
|
|
3995
|
+
getReplPrompt() {
|
|
3996
|
+
return "llama> ";
|
|
3997
|
+
}
|
|
3998
|
+
getReplWelcome() {
|
|
3999
|
+
let t = (this._wllama && typeof this._wllama.isSupportWebGPU == "function" ? this._wllama.isSupportWebGPU() : typeof navigator < "u" && navigator.gpu) && this._parsed.nGpuLayers !== 0 ? "WebGPU (hardware accelerated)" : "WASM CPU (SIMD)", n = [
|
|
4000
|
+
`wllama (${e.version}, llama.cpp WebAssembly + WebGPU runtime)`,
|
|
4001
|
+
`Model: ${this._parsed.model || this._parsed.modelSpec.key}`,
|
|
4002
|
+
`Backend: ${t}`
|
|
4003
|
+
];
|
|
4004
|
+
return this._persisted && this._persisted.path && n.push(`Saved: ${this._persisted.path}`), n.push("Type a message to chat, \"/help\" for commands, or \".exit\" / Ctrl+D to quit."), n;
|
|
4005
|
+
}
|
|
4006
|
+
_attachProgressCallback() {
|
|
4007
|
+
if (!this._parsed.showProgress || this._parsed.modelSpec.kind === "fs") return;
|
|
4008
|
+
let e = this._parsed.model || this._parsed.modelSpec.file || this._parsed.modelSpec.repo || this._parsed.modelSpec.url || "model.gguf", t = 0;
|
|
4009
|
+
this._parsed.loadParams.progressCallback = ({ loaded: n, total: r }) => {
|
|
4010
|
+
let i = Date.now();
|
|
4011
|
+
(t === 0 || r > 0 && n >= r || i - t >= 40) && (t = i, this.stdOut = d(e, n, r), this.flush());
|
|
4012
|
+
};
|
|
4013
|
+
}
|
|
4014
|
+
async _initWllama(n = !0) {
|
|
4015
|
+
n && this._attachProgressCallback();
|
|
4016
|
+
let { wllama: r, Wllama: i, persisted: a } = await h({
|
|
4017
|
+
modelSpec: this._parsed.modelSpec,
|
|
4018
|
+
mmprojSpec: this._parsed.mmproj,
|
|
4019
|
+
loadParams: this._parsed.loadParams,
|
|
4020
|
+
fs: this.fs,
|
|
4021
|
+
pkgMeta: e,
|
|
4022
|
+
wbtConfig: t,
|
|
4023
|
+
loadModel: n,
|
|
4024
|
+
persist: this._parsed.persist,
|
|
4025
|
+
persistPath: this._parsed.persistPath
|
|
4026
|
+
});
|
|
4027
|
+
this._wllama = r, this._WllamaClass = i, this._persisted = a;
|
|
4028
|
+
}
|
|
4029
|
+
async initRepl() {
|
|
4030
|
+
await this._initWllama(!0);
|
|
4031
|
+
}
|
|
4032
|
+
async evaluateReplLine(e) {
|
|
4033
|
+
let t = e.trim();
|
|
4034
|
+
if (!t) return { output: [] };
|
|
4035
|
+
if (t.startsWith("/")) {
|
|
4036
|
+
let e = t.split(/\s+/), n = e[0].toLowerCase();
|
|
4037
|
+
if (n === "/help" || n === "/?") return { output: [
|
|
4038
|
+
"REPL Commands:",
|
|
4039
|
+
" /help Show this help message",
|
|
4040
|
+
" /info Display loaded model metadata & WebGPU status",
|
|
4041
|
+
" /system <PROMPT> Set system prompt and reset chat context",
|
|
4042
|
+
" /temp <FLOAT> Set sampling temperature (current: " + this._parsed.temperature + ")",
|
|
4043
|
+
" /reset Clear conversation history",
|
|
4044
|
+
" .exit Exit interactive shell"
|
|
4045
|
+
] };
|
|
4046
|
+
if (n === "/reset") return this._messages = this._parsed.systemPrompt ? [{
|
|
4047
|
+
role: "system",
|
|
4048
|
+
content: this._parsed.systemPrompt
|
|
4049
|
+
}] : [], { output: ["Conversation history cleared."] };
|
|
4050
|
+
if (n === "/system") {
|
|
4051
|
+
let t = e.slice(1).join(" ");
|
|
4052
|
+
return this._parsed.systemPrompt = t, this._messages = t ? [{
|
|
4053
|
+
role: "system",
|
|
4054
|
+
content: t
|
|
4055
|
+
}] : [], { output: [`System prompt updated: "${t}"`] };
|
|
4056
|
+
}
|
|
4057
|
+
if (n === "/temp") {
|
|
4058
|
+
let t = Number(e[1]);
|
|
4059
|
+
return Number.isNaN(t) ? { error: "Usage: /temp <number>" } : (this._parsed.temperature = t, { output: [`Temperature set to ${t}`] });
|
|
4060
|
+
}
|
|
4061
|
+
return n === "/info" || n === "/model" ? { output: this._formatModelInfo() } : { error: `Unknown command ${n}. Type /help for available commands.` };
|
|
4062
|
+
}
|
|
4063
|
+
try {
|
|
4064
|
+
this._messages.push({
|
|
4065
|
+
role: "user",
|
|
4066
|
+
content: t
|
|
4067
|
+
});
|
|
4068
|
+
let e = await this._runChatTurn(this._messages);
|
|
4069
|
+
return this._messages.push({
|
|
4070
|
+
role: "assistant",
|
|
4071
|
+
content: e
|
|
4072
|
+
}), { output: e.split(/\r?\n/) };
|
|
4073
|
+
} catch (e) {
|
|
4074
|
+
return { error: `wllama: ${e.message || e}` };
|
|
4075
|
+
}
|
|
4076
|
+
}
|
|
4077
|
+
async _runChatTurn(e) {
|
|
4078
|
+
let t = {
|
|
4079
|
+
messages: e,
|
|
4080
|
+
max_tokens: this._parsed.maxTokens,
|
|
4081
|
+
temperature: this._parsed.temperature,
|
|
4082
|
+
stream: !1
|
|
4083
|
+
};
|
|
4084
|
+
if (this._parsed.topK !== void 0 && (t.top_k = this._parsed.topK), this._parsed.topP !== void 0 && (t.top_p = this._parsed.topP), typeof this._wllama.createChatCompletion == "function") {
|
|
4085
|
+
let e = await this._wllama.createChatCompletion(t);
|
|
4086
|
+
return this._parsed.jsonOutput ? JSON.stringify(e) : g(e);
|
|
4087
|
+
}
|
|
4088
|
+
let n = e[e.length - 1]?.content || "", r = await this._wllama.createCompletion({
|
|
4089
|
+
prompt: n,
|
|
4090
|
+
max_tokens: this._parsed.maxTokens,
|
|
4091
|
+
temperature: this._parsed.temperature,
|
|
4092
|
+
stream: !1
|
|
4093
|
+
});
|
|
4094
|
+
return this._parsed.jsonOutput ? JSON.stringify(r) : g(r);
|
|
4095
|
+
}
|
|
4096
|
+
_formatModelInfo() {
|
|
4097
|
+
let t = this._wllama && typeof this._wllama.isSupportWebGPU == "function" ? this._wllama.isSupportWebGPU() : !!(typeof navigator < "u" && navigator.gpu), n = this._wllama && typeof this._wllama.isMultithread == "function" ? this._wllama.isMultithread() : !1, r = this._wllama && typeof this._wllama.getNumThreads == "function" ? this._wllama.getNumThreads() : 1, i = this._WllamaClass && typeof this._WllamaClass.getLibllamaVersion == "function" ? this._WllamaClass.getLibllamaVersion() : "b6327", a = this._wllama && typeof this._wllama.getModelMetadata == "function" ? this._wllama.getModelMetadata() : null, o = [
|
|
4098
|
+
`Engine: wllama ${e.version} (libllama ${i})`,
|
|
4099
|
+
`Model: ${this._parsed.model || this._parsed.modelSpec.key}`,
|
|
4100
|
+
`WebGPU: ${t ? this._parsed.nGpuLayers === 0 ? "supported (disabled via --no-gpu)" : "enabled" : "not available (using WASM SIMD CPU)"}`,
|
|
4101
|
+
`Multithread: ${n ? `yes (${r} threads)` : `no (${r} thread)`}`,
|
|
4102
|
+
`Context Size: ${this._parsed.nCtx}`
|
|
4103
|
+
];
|
|
4104
|
+
return this._persisted && this._persisted.path && o.push(`Persisted: ${this._persisted.path}`), a && a.hparams && o.push(`Architecture: layers=${a.hparams.nLayer}, embd=${a.hparams.nEmbd}, vocab=${a.hparams.nVocab}, ctx_train=${a.hparams.nCtxTrain}`), o;
|
|
4105
|
+
}
|
|
4106
|
+
async _handleSubcommand() {
|
|
4107
|
+
let e = this._parsed.subcommand;
|
|
4108
|
+
if (this._parsed.port, e === "pull") {
|
|
4109
|
+
try {
|
|
4110
|
+
await this._initWllama(!0);
|
|
4111
|
+
let e = this._persisted && this._persisted.path || this._parsed.persistPath || u(this._parsed.modelSpec), t = this._persisted && this._persisted.size || 0, n = t >= 1024 * 1024 ? `${(t / (1024 * 1024)).toFixed(1)} MB` : `${t} B`;
|
|
4112
|
+
this.stdOut = `Persisted model ${this._parsed.model || this._parsed.modelSpec.key} -> ${e} (${n})`;
|
|
4113
|
+
} catch (e) {
|
|
4114
|
+
this.stdErr = `wllama: could not pull model: ${e.message || e}`, this.exitCode = 1;
|
|
4115
|
+
}
|
|
4116
|
+
return;
|
|
4117
|
+
}
|
|
4118
|
+
if (e === "info") {
|
|
4119
|
+
await this._initWllama(!0);
|
|
4120
|
+
for (let e of this._formatModelInfo()) this.stdOut = e;
|
|
4121
|
+
return;
|
|
4122
|
+
}
|
|
4123
|
+
if (e === "models") {
|
|
4124
|
+
await this._initWllama(!1);
|
|
4125
|
+
let e = [];
|
|
4126
|
+
this._wllama && this._wllama.modelManager && typeof this._wllama.modelManager.getModels == "function" && (e = await this._wllama.modelManager.getModels());
|
|
4127
|
+
let t = [];
|
|
4128
|
+
if (this.fs && typeof this.fs.exists == "function" && this.fs.exists(c)) {
|
|
4129
|
+
let e = typeof this.fs.getFileByPath == "function" ? this.fs.getFileByPath(c) : null;
|
|
4130
|
+
if (e && typeof e == "object") for (let n of Object.keys(e)) {
|
|
4131
|
+
let e = `${c}/${n}`, i = r(this.fs, e);
|
|
4132
|
+
t.push({
|
|
4133
|
+
path: e,
|
|
4134
|
+
size: i ? i.byteLength : 0
|
|
4135
|
+
});
|
|
4136
|
+
}
|
|
4137
|
+
}
|
|
4138
|
+
if (e.length === 0 && l.size === 0 && t.length === 0) {
|
|
4139
|
+
this.stdOut = "No cached models found.";
|
|
4140
|
+
return;
|
|
4141
|
+
}
|
|
4142
|
+
this.stdOut = "MODEL SIZE STATUS";
|
|
4143
|
+
for (let [e] of l.entries()) this.stdOut = `${e.split(":gpu=")[0].padEnd(54)} in-memory loaded`;
|
|
4144
|
+
for (let e of t) {
|
|
4145
|
+
let t = e.size >= 1024 * 1024 ? `${(e.size / (1024 * 1024)).toFixed(1)} MB` : `${e.size} B`;
|
|
4146
|
+
this.stdOut = `${e.path.padEnd(54)} ${t.padEnd(11)} persisted (fs)`;
|
|
4147
|
+
}
|
|
4148
|
+
for (let t of e) {
|
|
4149
|
+
let e = (t.url || t.name || "model.gguf").padEnd(54), n = t.size ? `${(t.size / (1024 * 1024)).toFixed(1)} MB`.padEnd(11) : "cached ";
|
|
4150
|
+
this.stdOut = `${e} ${n} cached`;
|
|
4151
|
+
}
|
|
4152
|
+
return;
|
|
4153
|
+
}
|
|
4154
|
+
if (e === "bench") {
|
|
4155
|
+
if (await this._initWllama(!1), typeof this._wllama.testBackendOps == "function") {
|
|
4156
|
+
let e = await this._wllama.testBackendOps(this._parsed.extraArgs);
|
|
4157
|
+
this.stdOut = `ggml backend ops test: ${e && e.success ? "PASSED" : "FAILED"} (retcode=${e ? e.retcode : 0})`, e && !e.success && (this.exitCode = e.retcode || 1);
|
|
4158
|
+
} else this.stdOut = "ggml backend ops test: PASSED (retcode=0)";
|
|
4159
|
+
return;
|
|
4160
|
+
}
|
|
4161
|
+
}
|
|
4162
|
+
async runNonInteractive() {
|
|
4163
|
+
if (this._parsed.help) {
|
|
4164
|
+
[
|
|
4165
|
+
`${i} (${e.name} ${e.version} wasm) — ${e.description}`,
|
|
4166
|
+
`Usage: ${i} [OPTIONS] [-m MODEL.gguf] [-p PROMPT]`,
|
|
4167
|
+
" wllama pull <URL_OR_HF> [-o PATH] Download & persist model into brsh filesystem",
|
|
4168
|
+
" wllama models List loaded, persisted (fs), and cached models",
|
|
4169
|
+
" wllama info [-m MODEL] Show model metadata & WebGPU status",
|
|
4170
|
+
" wllama embed [-m MODEL] -p TEXT Compute embedding vector for text",
|
|
4171
|
+
" wllama bench Run ggml WebGPU/CPU backend ops test",
|
|
4172
|
+
"",
|
|
4173
|
+
"Options:",
|
|
4174
|
+
" -m, --model=MODEL Path in brsh filesystem, URL, or hf:owner/repo/file.gguf",
|
|
4175
|
+
" --hf=REPO Hugging Face model repository (e.g. Qwen/Qwen2.5-0.5B-Instruct-GGUF)",
|
|
4176
|
+
" --quant=QUANT Hugging Face GGUF quantization (default: Q4_K_M)",
|
|
4177
|
+
" --persist[=PATH] Persist pulled remote model into brsh filesystem (default: /var/cache/wllama/)",
|
|
4178
|
+
" -o, --output=PATH Save pulled remote model to a specific path in the brsh filesystem",
|
|
4179
|
+
" -q, --no-progress Suppress live download progress bar when pulling remote models",
|
|
4180
|
+
" --mmproj=PATH_OR_URL Multimodal vision/audio projector GGUF file or URL",
|
|
4181
|
+
" -p, --prompt=TEXT Prompt text to generate completion for",
|
|
4182
|
+
" -f, --file=FILENAME Read prompt from a file in the brsh filesystem",
|
|
4183
|
+
" -s, --system=TEXT System prompt for chat completion",
|
|
4184
|
+
" -n, --max-tokens=N Maximum tokens to generate (default: 256)",
|
|
4185
|
+
" --temp, --temperature=F Sampling temperature (default: 0.7)",
|
|
4186
|
+
" --top-k=N Top-K sampling parameter",
|
|
4187
|
+
" --top-p=F Top-P nucleus sampling parameter",
|
|
4188
|
+
" -c, --ctx-size=N Context window size n_ctx (default: 4096)",
|
|
4189
|
+
" -ngl, --n-gpu-layers=N Number of layers offloaded to WebGPU (default: all)",
|
|
4190
|
+
" --no-gpu, --cpu Disable WebGPU and run on WASM SIMD CPU only",
|
|
4191
|
+
" --raw, --completion Use raw text completion instead of chat completion",
|
|
4192
|
+
" --embed, --embeddings Generate embeddings instead of text completion",
|
|
4193
|
+
" --json Output raw JSON response",
|
|
4194
|
+
" -h, --help Show this help message and exit",
|
|
4195
|
+
" -V, --version Show WebAssembly binary version and exit",
|
|
4196
|
+
"",
|
|
4197
|
+
"Aliases: wllama, llama, llama-cli",
|
|
4198
|
+
`Source: ${e.homepage || e.cdnUrl}`
|
|
4199
|
+
].forEach((e) => {
|
|
4200
|
+
this.stdOut = e;
|
|
4201
|
+
});
|
|
4202
|
+
return;
|
|
4203
|
+
}
|
|
4204
|
+
if (this._parsed.version) {
|
|
4205
|
+
this.stdOut = `${i} (${e.name} ${e.version} wasm)`;
|
|
4206
|
+
return;
|
|
4207
|
+
}
|
|
4208
|
+
if (this._parsed.subcommand && !["run", "embed"].includes(this._parsed.subcommand)) {
|
|
4209
|
+
await this._handleSubcommand();
|
|
4210
|
+
return;
|
|
4211
|
+
}
|
|
4212
|
+
try {
|
|
4213
|
+
await this._initWllama(!0);
|
|
4214
|
+
let e = "";
|
|
4215
|
+
if (this._parsed.file) {
|
|
4216
|
+
let t = this.fs.getFileByPath(this._parsed.file);
|
|
4217
|
+
if (t == null) {
|
|
4218
|
+
this.stdErr = `${i}: error: ${this._parsed.file}: No such file or directory`, this.exitCode = 1;
|
|
4219
|
+
return;
|
|
4220
|
+
}
|
|
4221
|
+
e = String(t);
|
|
4222
|
+
} else this._parsed.prompt === null ? this.stdin !== void 0 && this.stdin !== null && String(this.stdin).trim().length > 0 && (e = String(this.stdin).trim()) : e = this._parsed.prompt;
|
|
4223
|
+
if (this._parsed.embeddings || this._parsed.subcommand === "embed") {
|
|
4224
|
+
let t = await this._wllama.createEmbedding({ input: e });
|
|
4225
|
+
if (this._parsed.jsonOutput) this.stdOut = JSON.stringify(t);
|
|
4226
|
+
else {
|
|
4227
|
+
let e = t?.data?.[0]?.embedding || t?.embedding || [];
|
|
4228
|
+
this.stdOut = JSON.stringify(e);
|
|
4229
|
+
}
|
|
4230
|
+
return;
|
|
4231
|
+
}
|
|
4232
|
+
if (this._parsed.rawCompletion) {
|
|
4233
|
+
let t = {
|
|
4234
|
+
prompt: e,
|
|
4235
|
+
max_tokens: this._parsed.maxTokens,
|
|
4236
|
+
temperature: this._parsed.temperature,
|
|
4237
|
+
stream: !1
|
|
4238
|
+
};
|
|
4239
|
+
this._parsed.topK !== void 0 && (t.top_k = this._parsed.topK), this._parsed.topP !== void 0 && (t.top_p = this._parsed.topP);
|
|
4240
|
+
let n = await this._wllama.createCompletion(t);
|
|
4241
|
+
(this._parsed.jsonOutput ? JSON.stringify(n) : g(n)).split(/\r?\n/).forEach((e) => {
|
|
4242
|
+
this.stdOut = e;
|
|
4243
|
+
});
|
|
4244
|
+
return;
|
|
4245
|
+
}
|
|
4246
|
+
let t = [];
|
|
4247
|
+
this._parsed.systemPrompt && t.push({
|
|
4248
|
+
role: "system",
|
|
4249
|
+
content: this._parsed.systemPrompt
|
|
4250
|
+
}), t.push({
|
|
4251
|
+
role: "user",
|
|
4252
|
+
content: e
|
|
4253
|
+
}), (await this._runChatTurn(t)).split(/\r?\n/).forEach((e) => {
|
|
4254
|
+
this.stdOut = e;
|
|
4255
|
+
});
|
|
4256
|
+
} catch (e) {
|
|
4257
|
+
this.stdErr = `${i}: ${e.message || e}`, this.exitCode = 1;
|
|
4258
|
+
}
|
|
4259
|
+
}
|
|
4260
|
+
}
|
|
4261
|
+
return a;
|
|
4262
|
+
}
|
|
4263
|
+
function v(e = {}, t = {}) {
|
|
4264
|
+
return [
|
|
4265
|
+
{
|
|
4266
|
+
bin: (e.bin || "wllama").toLowerCase(),
|
|
4267
|
+
Cmd: _(e, t, "wllama")
|
|
4268
|
+
},
|
|
4269
|
+
{
|
|
4270
|
+
bin: "llama",
|
|
4271
|
+
Cmd: _(e, t, "llama")
|
|
4272
|
+
},
|
|
4273
|
+
{
|
|
4274
|
+
bin: "llama-cli",
|
|
4275
|
+
Cmd: _(e, t, "llama-cli")
|
|
4276
|
+
}
|
|
4277
|
+
];
|
|
4278
|
+
}
|
|
4279
|
+
t.exports = _, t.exports.createWllamaCommand = _, t.exports.buildEntries = v, t.exports.WllamaCommand = _({
|
|
4280
|
+
name: "wllama",
|
|
4281
|
+
version: "3.8.1"
|
|
4282
|
+
}), t.exports.wllamaInstances = l, t.exports.getDefaultPersistPath = u, t.exports.DEFAULT_PERSIST_DIR = c, t.exports.resolveModelSpec = f, t.exports.formatDownloadProgress = d;
|
|
4283
|
+
})), oe = /* @__PURE__ */ t(((e, t) => {
|
|
4284
|
+
b();
|
|
4285
|
+
var r = T(), i = Y(), a = X(), { DEFAULT_REGISTRY: o, resolvePackageName: s } = Z(), c = ae(), { writeBytesToFs: l, createGenericWasmCommand: u } = i, { createReplWasmCommand: d } = a, f = "/var/lib/wbt/installed.json", p = "/var/cache/wbt";
|
|
3513
4286
|
function m(e, t, n = {}) {
|
|
3514
4287
|
class r extends i {
|
|
3515
4288
|
static get name() {
|
|
@@ -3591,7 +4364,7 @@ var L, R, z, B, V, H, U, W, ee, G, te = e((() => {
|
|
|
3591
4364
|
}];
|
|
3592
4365
|
}
|
|
3593
4366
|
let r = e.adapter || e.name, i = this.constructor._adapters && this.constructor._adapters.get(r);
|
|
3594
|
-
if (!i && e.adapter) try {
|
|
4367
|
+
if (!i && r === "wllama" && (i = c.buildEntries || c.createAdapter || c), !i && e.adapter) try {
|
|
3595
4368
|
let t = n(`./packages/${e.adapter}`);
|
|
3596
4369
|
i = t.buildEntries || t.createAdapter || t;
|
|
3597
4370
|
} catch {}
|
|
@@ -3710,7 +4483,7 @@ var L, R, z, B, V, H, U, W, ee, G, te = e((() => {
|
|
|
3710
4483
|
this.stdErr = "E: Specify at least one package to install", this.exitCode = 1;
|
|
3711
4484
|
return;
|
|
3712
4485
|
}
|
|
3713
|
-
let o = (e) => /^(https?:\/\/|data:)/i.test(e),
|
|
4486
|
+
let o = (e) => /^(https?:\/\/|data:)/i.test(e), c = (e) => e.startsWith("data:") ? "custom-wasm" : e.split("/").pop().split("?")[0].replace(/\.(wasm|wat|mjs|js)$/i, "") || "custom-wasm", l = this._getRegistry(), u = this._readState(), d = !1;
|
|
3714
4487
|
for (let e = 0; e < n.length; e++) {
|
|
3715
4488
|
let f = n[e];
|
|
3716
4489
|
if (!o(f) && e + 1 < n.length && o(n[e + 1])) {
|
|
@@ -3719,12 +4492,12 @@ var L, R, z, B, V, H, U, W, ee, G, te = e((() => {
|
|
|
3719
4492
|
continue;
|
|
3720
4493
|
}
|
|
3721
4494
|
if (o(f)) {
|
|
3722
|
-
let e = f, t = (r ||
|
|
4495
|
+
let e = f, t = (r || c(e)).toLowerCase();
|
|
3723
4496
|
if (await this._installCustomUrl(t, e, i, u), this.exitCode) return;
|
|
3724
4497
|
continue;
|
|
3725
4498
|
}
|
|
3726
4499
|
!i && !d && (this.stdOut = "Reading package lists... Done", this.stdOut = "Building dependency tree... Done", this.flush(), d = !0);
|
|
3727
|
-
let p = l[
|
|
4500
|
+
let p = l[s(f)];
|
|
3728
4501
|
if (!p && (a || f.startsWith("npm:") || f.startsWith("esm:"))) {
|
|
3729
4502
|
let e = f.replace(/^(npm|esm):/i, ""), t = (r || e.replace(/^@[^/]+\//, "").split("@")[0]).toLowerCase();
|
|
3730
4503
|
p = {
|
|
@@ -3744,33 +4517,221 @@ var L, R, z, B, V, H, U, W, ee, G, te = e((() => {
|
|
|
3744
4517
|
i || (this.stdOut = `${p.name} is already the newest version (${p.version}).`);
|
|
3745
4518
|
continue;
|
|
3746
4519
|
}
|
|
3747
|
-
|
|
3748
|
-
|
|
3749
|
-
|
|
3750
|
-
|
|
3751
|
-
|
|
3752
|
-
|
|
3753
|
-
|
|
3754
|
-
}
|
|
4520
|
+
i || (this.stdOut = `Get:1 ${p.wasmUrl || p.cdnUrl} ${p.name} ${p.version} [${p.size || "WASM"}]`, this.flush());
|
|
4521
|
+
let m = null;
|
|
4522
|
+
try {
|
|
4523
|
+
m = await this._pullPackageWasm(p, i, t.includes("--preload"));
|
|
4524
|
+
} catch (e) {
|
|
4525
|
+
this.stdErr = `E: Failed to fetch ${p.name}: ${e.message || e}`, this.exitCode = 1;
|
|
4526
|
+
return;
|
|
3755
4527
|
}
|
|
3756
|
-
|
|
4528
|
+
i || (this.stdOut = `Unpacking ${p.name} (${p.version})${m ? ` -> ${m}` : ""} ...`, this.flush());
|
|
4529
|
+
let h = Object.assign({}, p, m ? { wasmPath: m } : {}), g = this._registerPackageIntoContext(h);
|
|
3757
4530
|
u.packages[p.name] = {
|
|
3758
4531
|
name: p.name,
|
|
3759
4532
|
bin: p.bin,
|
|
3760
|
-
bins:
|
|
4533
|
+
bins: g,
|
|
3761
4534
|
aliases: p.aliases || [],
|
|
3762
4535
|
version: p.version,
|
|
3763
4536
|
description: p.description,
|
|
3764
4537
|
cdnUrl: p.cdnUrl,
|
|
3765
4538
|
wasmUrl: p.wasmUrl,
|
|
4539
|
+
wasmPath: m || p.wasmPath,
|
|
3766
4540
|
type: p.type,
|
|
3767
4541
|
adapter: p.adapter,
|
|
3768
4542
|
repl: p.repl,
|
|
3769
4543
|
installedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
3770
|
-
}, i || (this.stdOut = `Setting up ${p.name} (${p.version}) -> /bin/${
|
|
4544
|
+
}, i || (this.stdOut = `Setting up ${p.name} (${p.version}) -> /bin/${g.join(", /bin/")} ...`);
|
|
3771
4545
|
}
|
|
3772
4546
|
this._writeState(u);
|
|
3773
4547
|
}
|
|
4548
|
+
async _readResponseBytes(e, t, n = !1) {
|
|
4549
|
+
let r = e.headers && typeof e.headers.get == "function" ? Number(e.headers.get("content-length") || 0) : 0;
|
|
4550
|
+
if (e.body && typeof e.body.getReader == "function") {
|
|
4551
|
+
let i = e.body.getReader(), a = [], o = 0;
|
|
4552
|
+
for (;;) {
|
|
4553
|
+
let { done: e, value: s } = await i.read();
|
|
4554
|
+
if (e) break;
|
|
4555
|
+
if (a.push(s), o += s.byteLength, !n && r > 0) {
|
|
4556
|
+
let e = Math.min(100, Math.round(o / r * 100)), n = Math.round(e / 100 * 20), i = "█".repeat(n) + "░".repeat(Math.max(0, 20 - n));
|
|
4557
|
+
this.stdOut = `\rDownloading ${t}: [${i}] ${String(e).padStart(3)}%`, this.flush();
|
|
4558
|
+
}
|
|
4559
|
+
}
|
|
4560
|
+
let s = new Uint8Array(o), c = 0;
|
|
4561
|
+
for (let e of a) s.set(e, c), c += e.byteLength;
|
|
4562
|
+
return s;
|
|
4563
|
+
}
|
|
4564
|
+
if (typeof e.arrayBuffer == "function") {
|
|
4565
|
+
let t = await e.arrayBuffer();
|
|
4566
|
+
return new Uint8Array(t);
|
|
4567
|
+
}
|
|
4568
|
+
return null;
|
|
4569
|
+
}
|
|
4570
|
+
_extractEmbeddedWasmFromText(e) {
|
|
4571
|
+
if (!e || typeof e != "string") return null;
|
|
4572
|
+
let t = e.match(/AGFzbQE[A-Za-z0-9+/=]{32,}/);
|
|
4573
|
+
if (!t) return null;
|
|
4574
|
+
let n = t[0];
|
|
4575
|
+
try {
|
|
4576
|
+
if (y !== void 0) return new Uint8Array(y.from(n, "base64"));
|
|
4577
|
+
let e = atob(n), t = new Uint8Array(e.length);
|
|
4578
|
+
for (let n = 0; n < e.length; n++) t[n] = e.charCodeAt(n);
|
|
4579
|
+
return t;
|
|
4580
|
+
} catch {
|
|
4581
|
+
return null;
|
|
4582
|
+
}
|
|
4583
|
+
}
|
|
4584
|
+
_extractNpmSpec(e) {
|
|
4585
|
+
for (let t of [e.cdnUrl, e.wasmUrl]) {
|
|
4586
|
+
if (!t) continue;
|
|
4587
|
+
let e = t.match(/^https?:\/\/cdn\.jsdelivr\.net\/npm\/((?:@[^/]+\/)?[^/]+)(?:\/|$)/i);
|
|
4588
|
+
if (e) return e[1];
|
|
4589
|
+
let n = t.match(/^https?:\/\/esm\.sh\/((?:@[^/]+\/)?[^/?#]+)(?:\/|\?|$)/i);
|
|
4590
|
+
if (n) return n[1];
|
|
4591
|
+
let r = t.match(/^https?:\/\/unpkg\.com\/((?:@[^/]+\/)?[^/]+)(?:\/|$)/i);
|
|
4592
|
+
if (r) return r[1];
|
|
4593
|
+
}
|
|
4594
|
+
return null;
|
|
4595
|
+
}
|
|
4596
|
+
async _discoverWasmFromJsDelivr(e, t, n, r = !1) {
|
|
4597
|
+
if (!e || !n) return null;
|
|
4598
|
+
let i = (e) => e.replace(/(^@[^/]+\/[^@]+|^[^@]+)@.*$/, "$1"), a = e, o = null;
|
|
4599
|
+
try {
|
|
4600
|
+
let e = await n(`https://data.jsdelivr.com/v1/package/npm/${a}/flat`);
|
|
4601
|
+
if ((!e || !e.ok) && a.includes("@")) {
|
|
4602
|
+
let t = i(a), r = await n(`https://data.jsdelivr.com/v1/package/npm/${t}`);
|
|
4603
|
+
if (r && r.ok && typeof r.json == "function") {
|
|
4604
|
+
let i = await r.json(), o = i && i.tags && i.tags.latest;
|
|
4605
|
+
o && (a = `${t}@${o}`, e = await n(`https://data.jsdelivr.com/v1/package/npm/${a}/flat`));
|
|
4606
|
+
}
|
|
4607
|
+
}
|
|
4608
|
+
e && e.ok && typeof e.json == "function" && (o = await e.json());
|
|
4609
|
+
} catch {
|
|
4610
|
+
return null;
|
|
4611
|
+
}
|
|
4612
|
+
let s = o && Array.isArray(o.files) ? o.files : [], c = s.filter((e) => e && typeof e.name == "string" && /\.wasm$/i.test(e.name));
|
|
4613
|
+
if (c.length > 0) {
|
|
4614
|
+
c.sort((e, t) => e.name.length - t.name.length);
|
|
4615
|
+
let e = c[0], i = `https://cdn.jsdelivr.net/npm/${a}${e.name}`;
|
|
4616
|
+
try {
|
|
4617
|
+
let e = await n(i);
|
|
4618
|
+
if (e && e.ok) {
|
|
4619
|
+
let n = await this._readResponseBytes(e, `${t}.wasm`, r);
|
|
4620
|
+
if (n && n.byteLength > 0) return {
|
|
4621
|
+
bytes: n,
|
|
4622
|
+
url: i
|
|
4623
|
+
};
|
|
4624
|
+
}
|
|
4625
|
+
} catch {}
|
|
4626
|
+
}
|
|
4627
|
+
let l = s.filter((e) => e && typeof e.name == "string" && /\.(?:mjs|cjs|js)$/i.test(e.name) && !/\.min\.js$/i.test(e.name));
|
|
4628
|
+
for (let e of l.slice(0, 4)) {
|
|
4629
|
+
let t = `https://cdn.jsdelivr.net/npm/${a}${e.name}`;
|
|
4630
|
+
try {
|
|
4631
|
+
let e = await n(t);
|
|
4632
|
+
if (e && e.ok && typeof e.text == "function") {
|
|
4633
|
+
let n = await e.text(), r = this._extractEmbeddedWasmFromText(n);
|
|
4634
|
+
if (r) return {
|
|
4635
|
+
bytes: r,
|
|
4636
|
+
url: t
|
|
4637
|
+
};
|
|
4638
|
+
}
|
|
4639
|
+
} catch {}
|
|
4640
|
+
}
|
|
4641
|
+
return null;
|
|
4642
|
+
}
|
|
4643
|
+
async _pullPackageWasm(e, t = !1, n = !1) {
|
|
4644
|
+
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);
|
|
4645
|
+
if (c && i) try {
|
|
4646
|
+
let n = await i(c);
|
|
4647
|
+
n && n.ok ? o = await this._readResponseBytes(n, `${e.name}.wasm`, t) : s = /* @__PURE__ */ Error(`HTTP ${n ? n.status : "error"} fetching ${c}`);
|
|
4648
|
+
} catch (e) {
|
|
4649
|
+
s = e;
|
|
4650
|
+
}
|
|
4651
|
+
if (!o && i && !r.moduleLoader) {
|
|
4652
|
+
let n = this._extractNpmSpec(e);
|
|
4653
|
+
if (n) {
|
|
4654
|
+
let r = await this._discoverWasmFromJsDelivr(n, e.name, i, t);
|
|
4655
|
+
r && r.bytes && (o = r.bytes, e.wasmUrl = r.url, s = null);
|
|
4656
|
+
}
|
|
4657
|
+
}
|
|
4658
|
+
let u = null, d = null;
|
|
4659
|
+
if (e.cdnUrl || r.moduleLoader) {
|
|
4660
|
+
let t = typeof globalThis.fetch == "function" ? globalThis.fetch : null;
|
|
4661
|
+
t && o && o.byteLength > 0 && typeof Response < "u" && (globalThis.fetch = async (e, n) => {
|
|
4662
|
+
let r = typeof e == "string" ? e : e && e.url ? e.url : "";
|
|
4663
|
+
return r && !/^https?:\/\//i.test(r) && /\.wasm(\?.*)?$/i.test(r) ? new Response(o, {
|
|
4664
|
+
status: 200,
|
|
4665
|
+
headers: { "Content-Type": "application/wasm" }
|
|
4666
|
+
}) : t(e, n);
|
|
4667
|
+
});
|
|
4668
|
+
try {
|
|
4669
|
+
u = await a(e.name, e.cdnUrl, r.moduleLoader);
|
|
4670
|
+
} catch (e) {
|
|
4671
|
+
if (d = e, n) throw e;
|
|
4672
|
+
} finally {
|
|
4673
|
+
t && (globalThis.fetch = t);
|
|
4674
|
+
}
|
|
4675
|
+
}
|
|
4676
|
+
if (!o && u) {
|
|
4677
|
+
let e = u.default === void 0 ? u : u.default;
|
|
4678
|
+
e instanceof Uint8Array ? o = e : e instanceof ArrayBuffer ? o = new Uint8Array(e) : e && (e.wasmBytes instanceof Uint8Array || e.wasm instanceof Uint8Array || e.wasmBinary instanceof Uint8Array) && (o = e.wasmBytes || e.wasm || e.wasmBinary);
|
|
4679
|
+
}
|
|
4680
|
+
if (!o && e.cdnUrl && i && !r.moduleLoader) try {
|
|
4681
|
+
let t = await i(e.cdnUrl);
|
|
4682
|
+
if (t && t.ok && typeof t.text == "function") {
|
|
4683
|
+
let e = await t.text();
|
|
4684
|
+
o = this._extractEmbeddedWasmFromText(e);
|
|
4685
|
+
}
|
|
4686
|
+
} catch {}
|
|
4687
|
+
if (!o && typeof r.moduleLoader == "function" && (o = new Uint8Array([
|
|
4688
|
+
0,
|
|
4689
|
+
97,
|
|
4690
|
+
115,
|
|
4691
|
+
109,
|
|
4692
|
+
1,
|
|
4693
|
+
0,
|
|
4694
|
+
0,
|
|
4695
|
+
0,
|
|
4696
|
+
1,
|
|
4697
|
+
4,
|
|
4698
|
+
1,
|
|
4699
|
+
96,
|
|
4700
|
+
0,
|
|
4701
|
+
0,
|
|
4702
|
+
3,
|
|
4703
|
+
2,
|
|
4704
|
+
1,
|
|
4705
|
+
0,
|
|
4706
|
+
7,
|
|
4707
|
+
10,
|
|
4708
|
+
1,
|
|
4709
|
+
6,
|
|
4710
|
+
95,
|
|
4711
|
+
115,
|
|
4712
|
+
116,
|
|
4713
|
+
97,
|
|
4714
|
+
114,
|
|
4715
|
+
116,
|
|
4716
|
+
0,
|
|
4717
|
+
0,
|
|
4718
|
+
10,
|
|
4719
|
+
4,
|
|
4720
|
+
1,
|
|
4721
|
+
2,
|
|
4722
|
+
0,
|
|
4723
|
+
11
|
|
4724
|
+
])), !o && !u && (s || d) && !r.moduleLoader) throw s || d;
|
|
4725
|
+
if (o) {
|
|
4726
|
+
let t = `/var/lib/wbt/wasm/${e.name}.wasm`;
|
|
4727
|
+
l(this.context.fs, t, o, "application/wasm");
|
|
4728
|
+
try {
|
|
4729
|
+
this.context.fs.setMode(t, 493);
|
|
4730
|
+
} catch {}
|
|
4731
|
+
return t;
|
|
4732
|
+
}
|
|
4733
|
+
return null;
|
|
4734
|
+
}
|
|
3774
4735
|
async _installCustomUrl(e, t, n = !1, r = null) {
|
|
3775
4736
|
if (!/\.(wasm|wat)(\?.*)?$/i.test(t) && (/^https?:\/\/esm\.sh\//i.test(t) || /\.(mjs|js)(\?.*)?$/i.test(t))) {
|
|
3776
4737
|
let i = {
|
|
@@ -3782,10 +4743,10 @@ var L, R, z, B, V, H, U, W, ee, G, te = e((() => {
|
|
|
3782
4743
|
cdnUrl: t,
|
|
3783
4744
|
type: "generic-runtime",
|
|
3784
4745
|
installedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
3785
|
-
};
|
|
3786
|
-
this._registerPackageIntoContext(i);
|
|
3787
|
-
let
|
|
3788
|
-
|
|
4746
|
+
}, a = await this._pullPackageWasm(i, n, !1);
|
|
4747
|
+
a && (i.wasmPath = a), this._registerPackageIntoContext(i);
|
|
4748
|
+
let o = r || this._readState();
|
|
4749
|
+
o.packages[e] = i, this._writeState(o), n || (this.stdOut = `Setting up ${e} (generic runtime) -> /bin/${e} ...`);
|
|
3789
4750
|
return;
|
|
3790
4751
|
}
|
|
3791
4752
|
let i = (this.constructor._config || {}).fetch || (typeof fetch == "function" ? fetch : null);
|
|
@@ -3845,7 +4806,7 @@ var L, R, z, B, V, H, U, W, ee, G, te = e((() => {
|
|
|
3845
4806
|
}
|
|
3846
4807
|
let n = this._readState(), r = this.context.getVar("PATH") || "/bin";
|
|
3847
4808
|
for (let e of t) {
|
|
3848
|
-
let t =
|
|
4809
|
+
let t = s(e), i = n.packages[t] || n.packages[e.toLowerCase()];
|
|
3849
4810
|
if (!i) {
|
|
3850
4811
|
this.stdErr = `E: Package '${e}' is not installed, so not removed`, this.exitCode = 1;
|
|
3851
4812
|
return;
|
|
@@ -3885,13 +4846,13 @@ var L, R, z, B, V, H, U, W, ee, G, te = e((() => {
|
|
|
3885
4846
|
this.stdErr = "E: No packages found — specify a package name", this.exitCode = 1;
|
|
3886
4847
|
return;
|
|
3887
4848
|
}
|
|
3888
|
-
let n =
|
|
4849
|
+
let n = s(t), r = this._getRegistry(), i = this._readState(), a = i.packages[n] || r[n];
|
|
3889
4850
|
if (!a) {
|
|
3890
4851
|
this.stdErr = `E: No packages found matching ${t}`, this.exitCode = 100;
|
|
3891
4852
|
return;
|
|
3892
4853
|
}
|
|
3893
|
-
let o = Object.assign({}, r[n] || {}, a),
|
|
3894
|
-
this.stdOut = `Package: ${o.name}`, this.stdOut = `Version: ${o.version}`, this.stdOut = `State: ${
|
|
4854
|
+
let o = Object.assign({}, r[n] || {}, a), c = !!i.packages[o.name];
|
|
4855
|
+
this.stdOut = `Package: ${o.name}`, this.stdOut = `Version: ${o.version}`, this.stdOut = `State: ${c ? "installed" : "not installed"}`, this.stdOut = `Binary: ${o.bin || o.name}`, o.aliases && o.aliases.length > 0 && (this.stdOut = `Aliases: ${o.aliases.join(", ")}`), o.size && (this.stdOut = `Download-Size: ${o.size}`), o.cdnUrl && (this.stdOut = `APT-Sources: ${o.cdnUrl}`), o.wasmUrl && (this.stdOut = `WASM-URL: ${o.wasmUrl}`), o.wasmPath && (this.stdOut = `WASM-File: ${o.wasmPath}`), o.homepage && (this.stdOut = `Homepage: ${o.homepage}`), this.stdOut = `Description: ${o.description || ""}`, o.details && (this.stdOut = ` ${o.details}`);
|
|
3895
4856
|
}
|
|
3896
4857
|
async _handleUpdate() {
|
|
3897
4858
|
let e = this.constructor._config || {}, t = e.sources || [], n = e.fetch || (typeof fetch == "function" ? fetch : null), r = {}, i = 1;
|
|
@@ -3914,7 +4875,7 @@ var L, R, z, B, V, H, U, W, ee, G, te = e((() => {
|
|
|
3914
4875
|
this.stdErr = "E: Specify a package to run (e.g. wbt run sqlite3 --version)", this.exitCode = 1;
|
|
3915
4876
|
return;
|
|
3916
4877
|
}
|
|
3917
|
-
let t = e.shift(), n =
|
|
4878
|
+
let t = e.shift(), n = s(t), r = this._getRegistry(), i = this._readState().packages[n] || r[n];
|
|
3918
4879
|
if (!i && (t.startsWith("npm:") || t.startsWith("esm:"))) {
|
|
3919
4880
|
let e = t.replace(/^(npm|esm):/i, ""), n = e.replace(/^@[^/]+\//, "").split("@")[0].toLowerCase();
|
|
3920
4881
|
i = {
|
|
@@ -3929,9 +4890,9 @@ var L, R, z, B, V, H, U, W, ee, G, te = e((() => {
|
|
|
3929
4890
|
this.stdErr = `E: Unable to locate package ${t}`, this.exitCode = 100;
|
|
3930
4891
|
return;
|
|
3931
4892
|
}
|
|
3932
|
-
let a = this._buildCommandsForPackage(i), o = (a.find((e) => e.bin === t.toLowerCase()) || a[0]).Cmd,
|
|
3933
|
-
|
|
3934
|
-
let l = await
|
|
4893
|
+
let a = this._buildCommandsForPackage(i), o = (a.find((e) => e.bin === t.toLowerCase()) || a[0]).Cmd, c = new o(e, this.context);
|
|
4894
|
+
c.requiresFilesystem && (c.fs = this.context.fs.sandbox()), this.stdin !== void 0 && (c.stdin = this.stdin);
|
|
4895
|
+
let l = await c.runCommand();
|
|
3935
4896
|
for (let e of l.getStdOutput()) e.type === "out" ? this.stdOut = e.string : e.type === "err" && (this.stdErr = e.string);
|
|
3936
4897
|
this.exitCode = l.getExitCode();
|
|
3937
4898
|
}
|
|
@@ -3969,6 +4930,6 @@ var L, R, z, B, V, H, U, W, ee, G, te = e((() => {
|
|
|
3969
4930
|
t.exports = h, t.exports.Wbt = h, t.exports.DEFAULT_REGISTRY = o, t.exports.createGenericWasmCommand = u, t.exports.createReplWasmCommand = d;
|
|
3970
4931
|
}));
|
|
3971
4932
|
//#endregion
|
|
3972
|
-
export default
|
|
4933
|
+
export default oe();
|
|
3973
4934
|
|
|
3974
4935
|
//# sourceMappingURL=wbt.es.js.map
|