@monaco-neovim-wasm/lib 0.1.7 → 0.1.9

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.
@@ -1,1351 +0,0 @@
1
- const Ut = 0, St = 1, bt = 0, At = 6, vt = 8;
2
- const Dt = 21, Tt = 28;
3
- const xt = 58;
4
- const Ct = 2, Bt = 64;
5
- class W {
6
- static read_bytes(e, t) {
7
- const i = new W();
8
- return i.buf = e.getUint32(t, !0), i.buf_len = e.getUint32(t + 4, !0), i;
9
- }
10
- static read_bytes_array(e, t, i) {
11
- const o = [];
12
- for (let r = 0; r < i; r++)
13
- o.push(W.read_bytes(e, t + 8 * r));
14
- return o;
15
- }
16
- }
17
- class Y {
18
- static read_bytes(e, t) {
19
- const i = new Y();
20
- return i.buf = e.getUint32(t, !0), i.buf_len = e.getUint32(t + 4, !0), i;
21
- }
22
- static read_bytes_array(e, t, i) {
23
- const o = [];
24
- for (let r = 0; r < i; r++)
25
- o.push(Y.read_bytes(e, t + 8 * r));
26
- return o;
27
- }
28
- }
29
- const Xe = 0, qe = 1, xe = 2, m = 3, J = 4;
30
- class ie {
31
- head_length() {
32
- return 24;
33
- }
34
- name_length() {
35
- return this.dir_name.byteLength;
36
- }
37
- write_head_bytes(e, t) {
38
- e.setBigUint64(t, this.d_next, !0), e.setBigUint64(t + 8, this.d_ino, !0), e.setUint32(t + 16, this.dir_name.length, !0), e.setUint8(t + 20, this.d_type);
39
- }
40
- write_name_bytes(e, t, i) {
41
- e.set(this.dir_name.slice(0, Math.min(this.dir_name.byteLength, i)), t);
42
- }
43
- constructor(e, t, i, o) {
44
- const r = new TextEncoder().encode(i);
45
- this.d_next = e, this.d_ino = t, this.d_namlen = r.byteLength, this.d_type = o, this.dir_name = r;
46
- }
47
- }
48
- const $e = 1;
49
- class Ce {
50
- write_bytes(e, t) {
51
- e.setUint8(t, this.fs_filetype), e.setUint16(t + 2, this.fs_flags, !0), e.setBigUint64(t + 8, this.fs_rights_base, !0), e.setBigUint64(t + 16, this.fs_rights_inherited, !0);
52
- }
53
- constructor(e, t) {
54
- this.fs_rights_base = 0n, this.fs_rights_inherited = 0n, this.fs_filetype = e, this.fs_flags = t;
55
- }
56
- }
57
- const ae = 1, V = 2, ve = 4, De = 8;
58
- class Be {
59
- write_bytes(e, t) {
60
- e.setBigUint64(t, this.dev, !0), e.setBigUint64(t + 8, this.ino, !0), e.setUint8(t + 16, this.filetype), e.setBigUint64(t + 24, this.nlink, !0), e.setBigUint64(t + 32, this.size, !0), e.setBigUint64(t + 38, this.atim, !0), e.setBigUint64(t + 46, this.mtim, !0), e.setBigUint64(t + 52, this.ctim, !0);
61
- }
62
- constructor(e, t, i) {
63
- this.dev = 0n, this.nlink = 0n, this.atim = 0n, this.mtim = 0n, this.ctim = 0n, this.ino = e, this.filetype = t, this.size = i;
64
- }
65
- }
66
- const Je = 0, It = 1, Ft = 2, Qe = 1;
67
- class Re {
68
- static read_bytes(e, t) {
69
- return new Re(e.getBigUint64(t, !0), e.getUint8(t + 8), e.getUint32(t + 16, !0), e.getBigUint64(t + 24, !0), e.getUint16(t + 36, !0));
70
- }
71
- constructor(e, t, i, o, r) {
72
- this.userdata = e, this.eventtype = t, this.clockid = i, this.timeout = o, this.flags = r;
73
- }
74
- }
75
- class Ze {
76
- write_bytes(e, t) {
77
- e.setBigUint64(t, this.userdata, !0), e.setUint16(t + 8, this.error, !0), e.setUint8(t + 10, this.eventtype);
78
- }
79
- constructor(e, t, i) {
80
- this.userdata = e, this.error = t, this.eventtype = i;
81
- }
82
- }
83
- const et = 0;
84
- class tt {
85
- write_bytes(e, t) {
86
- e.setUint32(t, this.pr_name.byteLength, !0);
87
- }
88
- constructor(e) {
89
- this.pr_name = new TextEncoder().encode(e);
90
- }
91
- }
92
- class Ee {
93
- static dir(e) {
94
- const t = new Ee();
95
- return t.tag = et, t.inner = new tt(e), t;
96
- }
97
- write_bytes(e, t) {
98
- e.setUint32(t, this.tag, !0), this.inner.write_bytes(e, t + 4);
99
- }
100
- }
101
- let rt = class {
102
- enable(e) {
103
- this.log = nt(e === void 0 ? !0 : e, this.prefix);
104
- }
105
- get enabled() {
106
- return this.isEnabled;
107
- }
108
- constructor(e) {
109
- this.isEnabled = e, this.prefix = "wasi:", this.enable(e);
110
- }
111
- };
112
- function nt(s, e) {
113
- return s ? console.log.bind(console, "%c%s", "color: #265BA0", e) : () => {
114
- };
115
- }
116
- const O = new rt(!1);
117
- class Te extends Error {
118
- constructor(e) {
119
- super("exit with exit code " + e), this.code = e;
120
- }
121
- }
122
- let Pt = class {
123
- start(e) {
124
- this.inst = e;
125
- try {
126
- return e.exports._start(), 0;
127
- } catch (t) {
128
- if (t instanceof Te)
129
- return t.code;
130
- throw t;
131
- }
132
- }
133
- initialize(e) {
134
- this.inst = e, e.exports._initialize && e.exports._initialize();
135
- }
136
- constructor(e, t, i, o = {}) {
137
- this.args = [], this.env = [], this.fds = [], O.enable(o.debug), this.args = e, this.env = t, this.fds = i;
138
- const r = this;
139
- this.wasiImport = { args_sizes_get(n, a) {
140
- const f = new DataView(r.inst.exports.memory.buffer);
141
- f.setUint32(n, r.args.length, !0);
142
- let l = 0;
143
- for (const _ of r.args)
144
- l += _.length + 1;
145
- return f.setUint32(a, l, !0), O.log(f.getUint32(n, !0), f.getUint32(a, !0)), 0;
146
- }, args_get(n, a) {
147
- const f = new DataView(r.inst.exports.memory.buffer), l = new Uint8Array(r.inst.exports.memory.buffer), _ = a;
148
- for (let u = 0; u < r.args.length; u++) {
149
- f.setUint32(n, a, !0), n += 4;
150
- const c = new TextEncoder().encode(r.args[u]);
151
- l.set(c, a), f.setUint8(a + c.length, 0), a += c.length + 1;
152
- }
153
- return O.enabled && O.log(new TextDecoder("utf-8").decode(l.slice(_, a))), 0;
154
- }, environ_sizes_get(n, a) {
155
- const f = new DataView(r.inst.exports.memory.buffer);
156
- f.setUint32(n, r.env.length, !0);
157
- let l = 0;
158
- for (const _ of r.env)
159
- l += new TextEncoder().encode(_).length + 1;
160
- return f.setUint32(a, l, !0), O.log(f.getUint32(n, !0), f.getUint32(a, !0)), 0;
161
- }, environ_get(n, a) {
162
- const f = new DataView(r.inst.exports.memory.buffer), l = new Uint8Array(r.inst.exports.memory.buffer), _ = a;
163
- for (let u = 0; u < r.env.length; u++) {
164
- f.setUint32(n, a, !0), n += 4;
165
- const c = new TextEncoder().encode(r.env[u]);
166
- l.set(c, a), f.setUint8(a + c.length, 0), a += c.length + 1;
167
- }
168
- return O.enabled && O.log(new TextDecoder("utf-8").decode(l.slice(_, a))), 0;
169
- }, clock_res_get(n, a) {
170
- let f;
171
- switch (n) {
172
- case 1: {
173
- f = 5000n;
174
- break;
175
- }
176
- case 0: {
177
- f = 1000000n;
178
- break;
179
- }
180
- default:
181
- return 52;
182
- }
183
- return new DataView(r.inst.exports.memory.buffer).setBigUint64(a, f, !0), 0;
184
- }, clock_time_get(n, a, f) {
185
- const l = new DataView(r.inst.exports.memory.buffer);
186
- if (n === 0)
187
- l.setBigUint64(f, BigInt((/* @__PURE__ */ new Date()).getTime()) * 1000000n, !0);
188
- else if (n == 1) {
189
- let _;
190
- try {
191
- _ = BigInt(Math.round(performance.now() * 1e6));
192
- } catch {
193
- _ = 0n;
194
- }
195
- l.setBigUint64(f, _, !0);
196
- } else
197
- l.setBigUint64(f, 0n, !0);
198
- return 0;
199
- }, fd_advise(n, a, f, l) {
200
- return r.fds[n] != null ? 0 : 8;
201
- }, fd_allocate(n, a, f) {
202
- return r.fds[n] != null ? r.fds[n].fd_allocate(a, f) : 8;
203
- }, fd_close(n) {
204
- if (r.fds[n] != null) {
205
- const a = r.fds[n].fd_close();
206
- return r.fds[n] = void 0, a;
207
- } else
208
- return 8;
209
- }, fd_datasync(n) {
210
- return r.fds[n] != null ? r.fds[n].fd_sync() : 8;
211
- }, fd_fdstat_get(n, a) {
212
- if (r.fds[n] != null) {
213
- const { ret: f, fdstat: l } = r.fds[n].fd_fdstat_get();
214
- return l?.write_bytes(new DataView(r.inst.exports.memory.buffer), a), f;
215
- } else
216
- return 8;
217
- }, fd_fdstat_set_flags(n, a) {
218
- return r.fds[n] != null ? r.fds[n].fd_fdstat_set_flags(a) : 8;
219
- }, fd_fdstat_set_rights(n, a, f) {
220
- return r.fds[n] != null ? r.fds[n].fd_fdstat_set_rights(a, f) : 8;
221
- }, fd_filestat_get(n, a) {
222
- if (r.fds[n] != null) {
223
- const { ret: f, filestat: l } = r.fds[n].fd_filestat_get();
224
- return l?.write_bytes(new DataView(r.inst.exports.memory.buffer), a), f;
225
- } else
226
- return 8;
227
- }, fd_filestat_set_size(n, a) {
228
- return r.fds[n] != null ? r.fds[n].fd_filestat_set_size(a) : 8;
229
- }, fd_filestat_set_times(n, a, f, l) {
230
- return r.fds[n] != null ? r.fds[n].fd_filestat_set_times(a, f, l) : 8;
231
- }, fd_pread(n, a, f, l, _) {
232
- const u = new DataView(r.inst.exports.memory.buffer), c = new Uint8Array(r.inst.exports.memory.buffer);
233
- if (r.fds[n] != null) {
234
- const d = W.read_bytes_array(u, a, f);
235
- let R = 0;
236
- for (const h of d) {
237
- const { ret: E, data: p } = r.fds[n].fd_pread(h.buf_len, l);
238
- if (E != 0)
239
- return u.setUint32(_, R, !0), E;
240
- if (c.set(p, h.buf), R += p.length, l += BigInt(p.length), p.length != h.buf_len)
241
- break;
242
- }
243
- return u.setUint32(_, R, !0), 0;
244
- } else
245
- return 8;
246
- }, fd_prestat_get(n, a) {
247
- const f = new DataView(r.inst.exports.memory.buffer);
248
- if (r.fds[n] != null) {
249
- const { ret: l, prestat: _ } = r.fds[n].fd_prestat_get();
250
- return _?.write_bytes(f, a), l;
251
- } else
252
- return 8;
253
- }, fd_prestat_dir_name(n, a, f) {
254
- if (r.fds[n] != null) {
255
- const { ret: l, prestat: _ } = r.fds[n].fd_prestat_get();
256
- if (_ == null)
257
- return l;
258
- const u = _.inner.pr_name;
259
- return new Uint8Array(r.inst.exports.memory.buffer).set(u.slice(0, f), a), u.byteLength > f ? 37 : 0;
260
- } else
261
- return 8;
262
- }, fd_pwrite(n, a, f, l, _) {
263
- const u = new DataView(r.inst.exports.memory.buffer), c = new Uint8Array(r.inst.exports.memory.buffer);
264
- if (r.fds[n] != null) {
265
- const d = Y.read_bytes_array(u, a, f);
266
- let R = 0;
267
- for (const h of d) {
268
- const E = c.slice(h.buf, h.buf + h.buf_len), { ret: p, nwritten: b } = r.fds[n].fd_pwrite(E, l);
269
- if (p != 0)
270
- return u.setUint32(_, R, !0), p;
271
- if (R += b, l += BigInt(b), b != E.byteLength)
272
- break;
273
- }
274
- return u.setUint32(_, R, !0), 0;
275
- } else
276
- return 8;
277
- }, fd_read(n, a, f, l) {
278
- const _ = new DataView(r.inst.exports.memory.buffer), u = new Uint8Array(r.inst.exports.memory.buffer);
279
- if (r.fds[n] != null) {
280
- const c = W.read_bytes_array(_, a, f);
281
- let d = 0;
282
- for (const R of c) {
283
- const { ret: h, data: E } = r.fds[n].fd_read(R.buf_len);
284
- if (h != 0)
285
- return _.setUint32(l, d, !0), h;
286
- if (u.set(E, R.buf), d += E.length, E.length != R.buf_len)
287
- break;
288
- }
289
- return _.setUint32(l, d, !0), 0;
290
- } else
291
- return 8;
292
- }, fd_readdir(n, a, f, l, _) {
293
- const u = new DataView(r.inst.exports.memory.buffer), c = new Uint8Array(r.inst.exports.memory.buffer);
294
- if (r.fds[n] != null) {
295
- let d = 0;
296
- for (; ; ) {
297
- const { ret: R, dirent: h } = r.fds[n].fd_readdir_single(l);
298
- if (R != 0)
299
- return u.setUint32(_, d, !0), R;
300
- if (h == null)
301
- break;
302
- if (f - d < h.head_length()) {
303
- d = f;
304
- break;
305
- }
306
- const E = new ArrayBuffer(h.head_length());
307
- if (h.write_head_bytes(new DataView(E), 0), c.set(new Uint8Array(E).slice(0, Math.min(E.byteLength, f - d)), a), a += h.head_length(), d += h.head_length(), f - d < h.name_length()) {
308
- d = f;
309
- break;
310
- }
311
- h.write_name_bytes(c, a, f - d), a += h.name_length(), d += h.name_length(), l = h.d_next;
312
- }
313
- return u.setUint32(_, d, !0), 0;
314
- } else
315
- return 8;
316
- }, fd_renumber(n, a) {
317
- if (r.fds[n] != null && r.fds[a] != null) {
318
- const f = r.fds[a].fd_close();
319
- return f != 0 ? f : (r.fds[a] = r.fds[n], r.fds[n] = void 0, 0);
320
- } else
321
- return 8;
322
- }, fd_seek(n, a, f, l) {
323
- const _ = new DataView(r.inst.exports.memory.buffer);
324
- if (r.fds[n] != null) {
325
- const { ret: u, offset: c } = r.fds[n].fd_seek(a, f);
326
- return _.setBigInt64(l, c, !0), u;
327
- } else
328
- return 8;
329
- }, fd_sync(n) {
330
- return r.fds[n] != null ? r.fds[n].fd_sync() : 8;
331
- }, fd_tell(n, a) {
332
- const f = new DataView(r.inst.exports.memory.buffer);
333
- if (r.fds[n] != null) {
334
- const { ret: l, offset: _ } = r.fds[n].fd_tell();
335
- return f.setBigUint64(a, _, !0), l;
336
- } else
337
- return 8;
338
- }, fd_write(n, a, f, l) {
339
- const _ = new DataView(r.inst.exports.memory.buffer), u = new Uint8Array(r.inst.exports.memory.buffer);
340
- if (r.fds[n] != null) {
341
- const c = Y.read_bytes_array(_, a, f);
342
- let d = 0;
343
- for (const R of c) {
344
- const h = u.slice(R.buf, R.buf + R.buf_len), { ret: E, nwritten: p } = r.fds[n].fd_write(h);
345
- if (E != 0)
346
- return _.setUint32(l, d, !0), E;
347
- if (d += p, p != h.byteLength)
348
- break;
349
- }
350
- return _.setUint32(l, d, !0), 0;
351
- } else
352
- return 8;
353
- }, path_create_directory(n, a, f) {
354
- const l = new Uint8Array(r.inst.exports.memory.buffer);
355
- if (r.fds[n] != null) {
356
- const _ = new TextDecoder("utf-8").decode(l.slice(a, a + f));
357
- return r.fds[n].path_create_directory(_);
358
- } else
359
- return 8;
360
- }, path_filestat_get(n, a, f, l, _) {
361
- const u = new DataView(r.inst.exports.memory.buffer), c = new Uint8Array(r.inst.exports.memory.buffer);
362
- if (r.fds[n] != null) {
363
- const d = new TextDecoder("utf-8").decode(c.slice(f, f + l)), { ret: R, filestat: h } = r.fds[n].path_filestat_get(a, d);
364
- return h?.write_bytes(u, _), R;
365
- } else
366
- return 8;
367
- }, path_filestat_set_times(n, a, f, l, _, u, c) {
368
- const d = new Uint8Array(r.inst.exports.memory.buffer);
369
- if (r.fds[n] != null) {
370
- const R = new TextDecoder("utf-8").decode(d.slice(f, f + l));
371
- return r.fds[n].path_filestat_set_times(a, R, _, u, c);
372
- } else
373
- return 8;
374
- }, path_link(n, a, f, l, _, u, c) {
375
- const d = new Uint8Array(r.inst.exports.memory.buffer);
376
- if (r.fds[n] != null && r.fds[_] != null) {
377
- const R = new TextDecoder("utf-8").decode(d.slice(f, f + l)), h = new TextDecoder("utf-8").decode(d.slice(u, u + c)), { ret: E, inode_obj: p } = r.fds[n].path_lookup(R, a);
378
- return p == null ? E : r.fds[_].path_link(h, p, !1);
379
- } else
380
- return 8;
381
- }, path_open(n, a, f, l, _, u, c, d, R) {
382
- const h = new DataView(r.inst.exports.memory.buffer), E = new Uint8Array(r.inst.exports.memory.buffer);
383
- if (r.fds[n] != null) {
384
- const p = new TextDecoder("utf-8").decode(E.slice(f, f + l));
385
- O.log(p);
386
- const { ret: b, fd_obj: y } = r.fds[n].path_open(a, p, _, u, c, d);
387
- if (b != 0)
388
- return b;
389
- r.fds.push(y);
390
- const k = r.fds.length - 1;
391
- return h.setUint32(R, k, !0), 0;
392
- } else
393
- return 8;
394
- }, path_readlink(n, a, f, l, _, u) {
395
- const c = new DataView(r.inst.exports.memory.buffer), d = new Uint8Array(r.inst.exports.memory.buffer);
396
- if (r.fds[n] != null) {
397
- const R = new TextDecoder("utf-8").decode(d.slice(a, a + f));
398
- O.log(R);
399
- const { ret: h, data: E } = r.fds[n].path_readlink(R);
400
- if (E != null) {
401
- const p = new TextEncoder().encode(E);
402
- if (p.length > _)
403
- return c.setUint32(u, 0, !0), 8;
404
- d.set(p, l), c.setUint32(u, p.length, !0);
405
- }
406
- return h;
407
- } else
408
- return 8;
409
- }, path_remove_directory(n, a, f) {
410
- const l = new Uint8Array(r.inst.exports.memory.buffer);
411
- if (r.fds[n] != null) {
412
- const _ = new TextDecoder("utf-8").decode(l.slice(a, a + f));
413
- return r.fds[n].path_remove_directory(_);
414
- } else
415
- return 8;
416
- }, path_rename(n, a, f, l, _, u) {
417
- const c = new Uint8Array(r.inst.exports.memory.buffer);
418
- if (r.fds[n] != null && r.fds[l] != null) {
419
- const d = new TextDecoder("utf-8").decode(c.slice(a, a + f)), R = new TextDecoder("utf-8").decode(c.slice(_, _ + u));
420
- let { ret: h, inode_obj: E } = r.fds[n].path_unlink(d);
421
- if (E == null)
422
- return h;
423
- if (h = r.fds[l].path_link(R, E, !0), h != 0 && r.fds[n].path_link(d, E, !0) != 0)
424
- throw "path_link should always return success when relinking an inode back to the original place";
425
- return h;
426
- } else
427
- return 8;
428
- }, path_symlink(n, a, f, l, _) {
429
- const u = new Uint8Array(r.inst.exports.memory.buffer);
430
- return r.fds[f] != null ? (new TextDecoder("utf-8").decode(u.slice(n, n + a)), new TextDecoder("utf-8").decode(u.slice(l, l + _)), 58) : 8;
431
- }, path_unlink_file(n, a, f) {
432
- const l = new Uint8Array(r.inst.exports.memory.buffer);
433
- if (r.fds[n] != null) {
434
- const _ = new TextDecoder("utf-8").decode(l.slice(a, a + f));
435
- return r.fds[n].path_unlink_file(_);
436
- } else
437
- return 8;
438
- }, poll_oneoff(n, a, f) {
439
- if (f === 0)
440
- return 28;
441
- if (f > 1)
442
- return O.log("poll_oneoff: only a single subscription is supported"), 58;
443
- const l = new DataView(r.inst.exports.memory.buffer), _ = Re.read_bytes(l, n), u = _.eventtype, c = _.clockid, d = _.timeout;
444
- if (u !== Je)
445
- return O.log("poll_oneoff: only clock subscriptions are supported"), 58;
446
- let R;
447
- if (c === 1)
448
- R = () => BigInt(Math.round(performance.now() * 1e6));
449
- else if (c === 0)
450
- R = () => BigInt((/* @__PURE__ */ new Date()).getTime()) * 1000000n;
451
- else
452
- return 28;
453
- const h = _.flags & Qe ? d : R() + d;
454
- for (; h > R(); )
455
- ;
456
- return new Ze(_.userdata, 0, u).write_bytes(l, a), 0;
457
- }, proc_exit(n) {
458
- throw new Te(n);
459
- }, proc_raise(n) {
460
- throw "raised signal " + n;
461
- }, sched_yield() {
462
- }, random_get(n, a) {
463
- const f = new Uint8Array(r.inst.exports.memory.buffer).subarray(n, n + a);
464
- if ("crypto" in globalThis && (typeof SharedArrayBuffer > "u" || !(r.inst.exports.memory.buffer instanceof SharedArrayBuffer)))
465
- for (let l = 0; l < a; l += 65536)
466
- crypto.getRandomValues(f.subarray(l, l + 65536));
467
- else
468
- for (let l = 0; l < a; l++)
469
- f[l] = Math.random() * 256 | 0;
470
- }, sock_recv(n, a, f) {
471
- throw "sockets not supported";
472
- }, sock_send(n, a, f) {
473
- throw "sockets not supported";
474
- }, sock_shutdown(n, a) {
475
- throw "sockets not supported";
476
- }, sock_accept(n, a) {
477
- throw "sockets not supported";
478
- } };
479
- }
480
- };
481
- class Ie {
482
- fd_allocate(e, t) {
483
- return 58;
484
- }
485
- fd_close() {
486
- return 0;
487
- }
488
- fd_fdstat_get() {
489
- return { ret: 58, fdstat: null };
490
- }
491
- fd_fdstat_set_flags(e) {
492
- return 58;
493
- }
494
- fd_fdstat_set_rights(e, t) {
495
- return 58;
496
- }
497
- fd_filestat_get() {
498
- return { ret: 58, filestat: null };
499
- }
500
- fd_filestat_set_size(e) {
501
- return 58;
502
- }
503
- fd_filestat_set_times(e, t, i) {
504
- return 58;
505
- }
506
- fd_pread(e, t) {
507
- return { ret: 58, data: new Uint8Array() };
508
- }
509
- fd_prestat_get() {
510
- return { ret: 58, prestat: null };
511
- }
512
- fd_pwrite(e, t) {
513
- return { ret: 58, nwritten: 0 };
514
- }
515
- fd_read(e) {
516
- return { ret: 58, data: new Uint8Array() };
517
- }
518
- fd_readdir_single(e) {
519
- return { ret: 58, dirent: null };
520
- }
521
- fd_seek(e, t) {
522
- return { ret: 58, offset: 0n };
523
- }
524
- fd_sync() {
525
- return 0;
526
- }
527
- fd_tell() {
528
- return { ret: 58, offset: 0n };
529
- }
530
- fd_write(e) {
531
- return { ret: 58, nwritten: 0 };
532
- }
533
- path_create_directory(e) {
534
- return 58;
535
- }
536
- path_filestat_get(e, t) {
537
- return { ret: 58, filestat: null };
538
- }
539
- path_filestat_set_times(e, t, i, o, r) {
540
- return 58;
541
- }
542
- path_link(e, t, i) {
543
- return 58;
544
- }
545
- path_unlink(e) {
546
- return { ret: 58, inode_obj: null };
547
- }
548
- path_lookup(e, t) {
549
- return { ret: 58, inode_obj: null };
550
- }
551
- path_open(e, t, i, o, r, n) {
552
- return { ret: 54, fd_obj: null };
553
- }
554
- path_readlink(e) {
555
- return { ret: 58, data: null };
556
- }
557
- path_remove_directory(e) {
558
- return 58;
559
- }
560
- path_rename(e, t, i) {
561
- return 58;
562
- }
563
- path_unlink_file(e) {
564
- return 58;
565
- }
566
- }
567
- class C {
568
- static issue_ino() {
569
- return C.next_ino++;
570
- }
571
- static root_ino() {
572
- return 0n;
573
- }
574
- constructor() {
575
- this.ino = C.issue_ino();
576
- }
577
- }
578
- C.next_ino = 1n;
579
- class st extends Ie {
580
- fd_allocate(e, t) {
581
- if (!(this.file.size > e + t)) {
582
- const i = new Uint8Array(Number(e + t));
583
- i.set(this.file.data, 0), this.file.data = i;
584
- }
585
- return 0;
586
- }
587
- fd_fdstat_get() {
588
- return { ret: 0, fdstat: new Ce(J, 0) };
589
- }
590
- fd_filestat_set_size(e) {
591
- if (this.file.size > e)
592
- this.file.data = new Uint8Array(this.file.data.buffer.slice(0, Number(e)));
593
- else {
594
- const t = new Uint8Array(Number(e));
595
- t.set(this.file.data, 0), this.file.data = t;
596
- }
597
- return 0;
598
- }
599
- fd_read(e) {
600
- const t = this.file.data.slice(Number(this.file_pos), Number(this.file_pos + BigInt(e)));
601
- return this.file_pos += BigInt(t.length), { ret: 0, data: t };
602
- }
603
- fd_pread(e, t) {
604
- return { ret: 0, data: this.file.data.slice(Number(t), Number(t + BigInt(e))) };
605
- }
606
- fd_seek(e, t) {
607
- let i;
608
- switch (t) {
609
- case Xe:
610
- i = e;
611
- break;
612
- case qe:
613
- i = this.file_pos + e;
614
- break;
615
- case xe:
616
- i = BigInt(this.file.data.byteLength) + e;
617
- break;
618
- default:
619
- return { ret: 28, offset: 0n };
620
- }
621
- return i < 0 ? { ret: 28, offset: 0n } : (this.file_pos = i, { ret: 0, offset: this.file_pos });
622
- }
623
- fd_tell() {
624
- return { ret: 0, offset: this.file_pos };
625
- }
626
- fd_write(e) {
627
- if (this.file.readonly) return { ret: 8, nwritten: 0 };
628
- if (this.file_pos + BigInt(e.byteLength) > this.file.size) {
629
- const t = this.file.data;
630
- this.file.data = new Uint8Array(Number(this.file_pos + BigInt(e.byteLength))), this.file.data.set(t);
631
- }
632
- return this.file.data.set(e, Number(this.file_pos)), this.file_pos += BigInt(e.byteLength), { ret: 0, nwritten: e.byteLength };
633
- }
634
- fd_pwrite(e, t) {
635
- if (this.file.readonly) return { ret: 8, nwritten: 0 };
636
- if (t + BigInt(e.byteLength) > this.file.size) {
637
- const i = this.file.data;
638
- this.file.data = new Uint8Array(Number(t + BigInt(e.byteLength))), this.file.data.set(i);
639
- }
640
- return this.file.data.set(e, Number(t)), { ret: 0, nwritten: e.byteLength };
641
- }
642
- fd_filestat_get() {
643
- return { ret: 0, filestat: this.file.stat() };
644
- }
645
- constructor(e) {
646
- super(), this.file_pos = 0n, this.file = e;
647
- }
648
- }
649
- class Fe extends Ie {
650
- fd_seek(e, t) {
651
- return { ret: 8, offset: 0n };
652
- }
653
- fd_tell() {
654
- return { ret: 8, offset: 0n };
655
- }
656
- fd_allocate(e, t) {
657
- return 8;
658
- }
659
- fd_fdstat_get() {
660
- return { ret: 0, fdstat: new Ce(m, 0) };
661
- }
662
- fd_readdir_single(e) {
663
- if (O.enabled && (O.log("readdir_single", e), O.log(e, this.dir.contents.keys())), e == 0n)
664
- return { ret: 0, dirent: new ie(1n, this.dir.ino, ".", m) };
665
- if (e == 1n)
666
- return { ret: 0, dirent: new ie(2n, this.dir.parent_ino(), "..", m) };
667
- if (e >= BigInt(this.dir.contents.size) + 2n)
668
- return { ret: 0, dirent: null };
669
- const [t, i] = Array.from(this.dir.contents.entries())[Number(e - 2n)];
670
- return { ret: 0, dirent: new ie(e + 1n, i.ino, t, i.stat().filetype) };
671
- }
672
- path_filestat_get(e, t) {
673
- const { ret: i, path: o } = T.from(t);
674
- if (o == null)
675
- return { ret: i, filestat: null };
676
- const { ret: r, entry: n } = this.dir.get_entry_for_path(o);
677
- return n == null ? { ret: r, filestat: null } : { ret: 0, filestat: n.stat() };
678
- }
679
- path_lookup(e, t) {
680
- const { ret: i, path: o } = T.from(e);
681
- if (o == null)
682
- return { ret: i, inode_obj: null };
683
- const { ret: r, entry: n } = this.dir.get_entry_for_path(o);
684
- return n == null ? { ret: r, inode_obj: null } : { ret: 0, inode_obj: n };
685
- }
686
- path_open(e, t, i, o, r, n) {
687
- const { ret: a, path: f } = T.from(t);
688
- if (f == null)
689
- return { ret: a, fd_obj: null };
690
- let { ret: l, entry: _ } = this.dir.get_entry_for_path(f);
691
- if (_ == null) {
692
- if (l != 44)
693
- return { ret: l, fd_obj: null };
694
- if ((i & ae) == ae) {
695
- const { ret: u, entry: c } = this.dir.create_entry_for_path(t, (i & V) == V);
696
- if (c == null)
697
- return { ret: u, fd_obj: null };
698
- _ = c;
699
- } else
700
- return { ret: 44, fd_obj: null };
701
- } else if ((i & ve) == ve)
702
- return { ret: 20, fd_obj: null };
703
- return (i & V) == V && _.stat().filetype !== m ? { ret: 54, fd_obj: null } : _.path_open(i, o, n);
704
- }
705
- path_create_directory(e) {
706
- return this.path_open(0, e, ae | V, 0n, 0n, 0).ret;
707
- }
708
- path_link(e, t, i) {
709
- const { ret: o, path: r } = T.from(e);
710
- if (r == null)
711
- return o;
712
- if (r.is_dir)
713
- return 44;
714
- const { ret: n, parent_entry: a, filename: f, entry: l } = this.dir.get_parent_dir_and_entry_for_path(r, !0);
715
- if (a == null || f == null)
716
- return n;
717
- if (l != null) {
718
- const _ = t.stat().filetype == m, u = l.stat().filetype == m;
719
- if (_ && u)
720
- if (i && l instanceof x) {
721
- if (l.contents.size != 0) return 55;
722
- } else
723
- return 20;
724
- else {
725
- if (_ && !u)
726
- return 54;
727
- if (!_ && u)
728
- return 31;
729
- if (!(t.stat().filetype == J && l.stat().filetype == J)) return 20;
730
- }
731
- }
732
- return !i && t.stat().filetype == m ? 63 : (a.contents.set(f, t), 0);
733
- }
734
- path_unlink(e) {
735
- const { ret: t, path: i } = T.from(e);
736
- if (i == null)
737
- return { ret: t, inode_obj: null };
738
- const { ret: o, parent_entry: r, filename: n, entry: a } = this.dir.get_parent_dir_and_entry_for_path(i, !0);
739
- return r == null || n == null ? { ret: o, inode_obj: null } : a == null ? { ret: 44, inode_obj: null } : (r.contents.delete(n), { ret: 0, inode_obj: a });
740
- }
741
- path_unlink_file(e) {
742
- const { ret: t, path: i } = T.from(e);
743
- if (i == null)
744
- return t;
745
- const { ret: o, parent_entry: r, filename: n, entry: a } = this.dir.get_parent_dir_and_entry_for_path(i, !1);
746
- return r == null || n == null || a == null ? o : a.stat().filetype === m ? 31 : (r.contents.delete(n), 0);
747
- }
748
- path_remove_directory(e) {
749
- const { ret: t, path: i } = T.from(e);
750
- if (i == null)
751
- return t;
752
- const { ret: o, parent_entry: r, filename: n, entry: a } = this.dir.get_parent_dir_and_entry_for_path(i, !1);
753
- return r == null || n == null || a == null ? o : !(a instanceof x) || a.stat().filetype !== m ? 54 : a.contents.size !== 0 ? 55 : r.contents.delete(n) ? 0 : 44;
754
- }
755
- fd_filestat_get() {
756
- return { ret: 0, filestat: this.dir.stat() };
757
- }
758
- fd_filestat_set_size(e) {
759
- return 8;
760
- }
761
- fd_read(e) {
762
- return { ret: 8, data: new Uint8Array() };
763
- }
764
- fd_pread(e, t) {
765
- return { ret: 8, data: new Uint8Array() };
766
- }
767
- fd_write(e) {
768
- return { ret: 8, nwritten: 0 };
769
- }
770
- fd_pwrite(e, t) {
771
- return { ret: 8, nwritten: 0 };
772
- }
773
- constructor(e) {
774
- super(), this.dir = e;
775
- }
776
- }
777
- class Vt extends Fe {
778
- fd_prestat_get() {
779
- return { ret: 0, prestat: Ee.dir(this.prestat_name) };
780
- }
781
- constructor(e, t) {
782
- super(new x(t)), this.prestat_name = e;
783
- }
784
- }
785
- class it extends C {
786
- path_open(e, t, i) {
787
- if (this.readonly && (t & BigInt(64)) == BigInt(64))
788
- return { ret: 63, fd_obj: null };
789
- if ((e & De) == De) {
790
- if (this.readonly) return { ret: 63, fd_obj: null };
791
- this.data = new Uint8Array([]);
792
- }
793
- const o = new st(this);
794
- return i & $e && o.fd_seek(0n, xe), { ret: 0, fd_obj: o };
795
- }
796
- get size() {
797
- return BigInt(this.data.byteLength);
798
- }
799
- stat() {
800
- return new Be(this.ino, J, this.size);
801
- }
802
- constructor(e, t) {
803
- super(), this.data = new Uint8Array(e), this.readonly = !!t?.readonly;
804
- }
805
- }
806
- let T = class ke {
807
- static from(e) {
808
- const t = new ke();
809
- if (t.is_dir = e.endsWith("/"), e.startsWith("/"))
810
- return { ret: 76, path: null };
811
- if (e.includes("\0"))
812
- return { ret: 28, path: null };
813
- for (const i of e.split("/"))
814
- if (!(i === "" || i === ".")) {
815
- if (i === "..") {
816
- if (t.parts.pop() == null)
817
- return { ret: 76, path: null };
818
- continue;
819
- }
820
- t.parts.push(i);
821
- }
822
- return { ret: 0, path: t };
823
- }
824
- to_path_string() {
825
- let e = this.parts.join("/");
826
- return this.is_dir && (e += "/"), e;
827
- }
828
- constructor() {
829
- this.parts = [], this.is_dir = !1;
830
- }
831
- };
832
- class x extends C {
833
- parent_ino() {
834
- return this.parent == null ? C.root_ino() : this.parent.ino;
835
- }
836
- path_open(e, t, i) {
837
- return { ret: 0, fd_obj: new Fe(this) };
838
- }
839
- stat() {
840
- return new Be(this.ino, m, 0n);
841
- }
842
- get_entry_for_path(e) {
843
- let t = this;
844
- for (const i of e.parts) {
845
- if (!(t instanceof x))
846
- return { ret: 54, entry: null };
847
- const o = t.contents.get(i);
848
- if (o !== void 0)
849
- t = o;
850
- else
851
- return O.log(i), { ret: 44, entry: null };
852
- }
853
- return e.is_dir && t.stat().filetype != m ? { ret: 54, entry: null } : { ret: 0, entry: t };
854
- }
855
- get_parent_dir_and_entry_for_path(e, t) {
856
- const i = e.parts.pop();
857
- if (i === void 0)
858
- return { ret: 28, parent_entry: null, filename: null, entry: null };
859
- const { ret: o, entry: r } = this.get_entry_for_path(e);
860
- if (r == null)
861
- return { ret: o, parent_entry: null, filename: null, entry: null };
862
- if (!(r instanceof x))
863
- return { ret: 54, parent_entry: null, filename: null, entry: null };
864
- const n = r.contents.get(i);
865
- return n === void 0 ? t ? { ret: 0, parent_entry: r, filename: i, entry: null } : { ret: 44, parent_entry: null, filename: null, entry: null } : e.is_dir && n.stat().filetype != m ? { ret: 54, parent_entry: null, filename: null, entry: null } : { ret: 0, parent_entry: r, filename: i, entry: n };
866
- }
867
- create_entry_for_path(e, t) {
868
- const { ret: i, path: o } = T.from(e);
869
- if (o == null)
870
- return { ret: i, entry: null };
871
- let { ret: r, parent_entry: n, filename: a, entry: f } = this.get_parent_dir_and_entry_for_path(o, !0);
872
- if (n == null || a == null)
873
- return { ret: r, entry: null };
874
- if (f != null)
875
- return { ret: 20, entry: null };
876
- O.log("create", o);
877
- let l;
878
- return t ? l = new x(/* @__PURE__ */ new Map()) : l = new it(new ArrayBuffer(0)), n.contents.set(a, l), f = l, { ret: 0, entry: f };
879
- }
880
- constructor(e) {
881
- super(), this.parent = null, e instanceof Array ? this.contents = new Map(e) : this.contents = e;
882
- for (const t of this.contents.values())
883
- t instanceof x && (t.parent = this);
884
- }
885
- }
886
- var N = Uint8Array, F = Uint16Array, at = Int32Array, Pe = new N([
887
- 0,
888
- 0,
889
- 0,
890
- 0,
891
- 0,
892
- 0,
893
- 0,
894
- 0,
895
- 1,
896
- 1,
897
- 1,
898
- 1,
899
- 2,
900
- 2,
901
- 2,
902
- 2,
903
- 3,
904
- 3,
905
- 3,
906
- 3,
907
- 4,
908
- 4,
909
- 4,
910
- 4,
911
- 5,
912
- 5,
913
- 5,
914
- 5,
915
- 0,
916
- /* unused */
917
- 0,
918
- 0,
919
- /* impossible */
920
- 0
921
- ]), Le = new N([
922
- 0,
923
- 0,
924
- 0,
925
- 0,
926
- 1,
927
- 1,
928
- 2,
929
- 2,
930
- 3,
931
- 3,
932
- 4,
933
- 4,
934
- 5,
935
- 5,
936
- 6,
937
- 6,
938
- 7,
939
- 7,
940
- 8,
941
- 8,
942
- 9,
943
- 9,
944
- 10,
945
- 10,
946
- 11,
947
- 11,
948
- 12,
949
- 12,
950
- 13,
951
- 13,
952
- /* unused */
953
- 0,
954
- 0
955
- ]), ft = new N([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]), Ve = function(s, e) {
956
- for (var t = new F(31), i = 0; i < 31; ++i)
957
- t[i] = e += 1 << s[i - 1];
958
- for (var o = new at(t[30]), i = 1; i < 30; ++i)
959
- for (var r = t[i]; r < t[i + 1]; ++r)
960
- o[r] = r - t[i] << 5 | i;
961
- return { b: t, r: o };
962
- }, Me = Ve(Pe, 2), je = Me.b, ot = Me.r;
963
- je[28] = 258, ot[258] = 28;
964
- var lt = Ve(Le, 0), ut = lt.b, he = new F(32768);
965
- for (var g = 0; g < 32768; ++g) {
966
- var D = (g & 43690) >> 1 | (g & 21845) << 1;
967
- D = (D & 52428) >> 2 | (D & 13107) << 2, D = (D & 61680) >> 4 | (D & 3855) << 4, he[g] = ((D & 65280) >> 8 | (D & 255) << 8) >> 1;
968
- }
969
- var G = function(s, e, t) {
970
- for (var i = s.length, o = 0, r = new F(e); o < i; ++o)
971
- s[o] && ++r[s[o] - 1];
972
- var n = new F(e);
973
- for (o = 1; o < e; ++o)
974
- n[o] = n[o - 1] + r[o - 1] << 1;
975
- var a;
976
- if (t) {
977
- a = new F(1 << e);
978
- var f = 15 - e;
979
- for (o = 0; o < i; ++o)
980
- if (s[o])
981
- for (var l = o << 4 | s[o], _ = e - s[o], u = n[s[o] - 1]++ << _, c = u | (1 << _) - 1; u <= c; ++u)
982
- a[he[u] >> f] = l;
983
- } else
984
- for (a = new F(i), o = 0; o < i; ++o)
985
- s[o] && (a[o] = he[n[s[o] - 1]++] >> 15 - s[o]);
986
- return a;
987
- }, K = new N(288);
988
- for (var g = 0; g < 144; ++g)
989
- K[g] = 8;
990
- for (var g = 144; g < 256; ++g)
991
- K[g] = 9;
992
- for (var g = 256; g < 280; ++g)
993
- K[g] = 7;
994
- for (var g = 280; g < 288; ++g)
995
- K[g] = 8;
996
- var ze = new N(32);
997
- for (var g = 0; g < 32; ++g)
998
- ze[g] = 5;
999
- var _t = /* @__PURE__ */ G(K, 9, 1), ct = /* @__PURE__ */ G(ze, 5, 1), fe = function(s) {
1000
- for (var e = s[0], t = 1; t < s.length; ++t)
1001
- s[t] > e && (e = s[t]);
1002
- return e;
1003
- }, U = function(s, e, t) {
1004
- var i = e / 8 | 0;
1005
- return (s[i] | s[i + 1] << 8) >> (e & 7) & t;
1006
- }, oe = function(s, e) {
1007
- var t = e / 8 | 0;
1008
- return (s[t] | s[t + 1] << 8 | s[t + 2] << 16) >> (e & 7);
1009
- }, dt = function(s) {
1010
- return (s + 7) / 8 | 0;
1011
- }, ht = function(s, e, t) {
1012
- return (t == null || t > s.length) && (t = s.length), new N(s.subarray(e, t));
1013
- }, Rt = [
1014
- "unexpected EOF",
1015
- "invalid block type",
1016
- "invalid length/literal",
1017
- "invalid distance",
1018
- "stream finished",
1019
- "no stream handler",
1020
- ,
1021
- "no callback",
1022
- "invalid UTF-8 data",
1023
- "extra field too long",
1024
- "date not in range 1980-2099",
1025
- "filename too long",
1026
- "stream finishing",
1027
- "invalid zip data"
1028
- // determined by unknown compression method
1029
- ], S = function(s, e, t) {
1030
- var i = new Error(e || Rt[s]);
1031
- if (i.code = s, Error.captureStackTrace && Error.captureStackTrace(i, S), !t)
1032
- throw i;
1033
- return i;
1034
- }, Et = function(s, e, t, i) {
1035
- var o = s.length, r = 0;
1036
- if (!o || e.f && !e.l)
1037
- return t || new N(0);
1038
- var n = !t, a = n || e.i != 2, f = e.i;
1039
- n && (t = new N(o * 3));
1040
- var l = function(Se) {
1041
- var be = t.length;
1042
- if (Se > be) {
1043
- var Ae = new N(Math.max(be * 2, Se));
1044
- Ae.set(t), t = Ae;
1045
- }
1046
- }, _ = e.f || 0, u = e.p || 0, c = e.b || 0, d = e.l, R = e.d, h = e.m, E = e.n, p = o * 8;
1047
- do {
1048
- if (!d) {
1049
- _ = U(s, u, 1);
1050
- var b = U(s, u + 1, 3);
1051
- if (u += 3, b)
1052
- if (b == 1)
1053
- d = _t, R = ct, h = 9, E = 5;
1054
- else if (b == 2) {
1055
- var ee = U(s, u, 31) + 257, ge = U(s, u + 10, 15) + 4, pe = ee + U(s, u + 5, 31) + 1;
1056
- u += 14;
1057
- for (var P = new N(pe), te = new N(19), w = 0; w < ge; ++w)
1058
- te[ft[w]] = U(s, u + w * 3, 7);
1059
- u += ge * 3;
1060
- for (var Oe = fe(te), Ge = (1 << Oe) - 1, We = G(te, Oe, 1), w = 0; w < pe; ) {
1061
- var Ne = We[U(s, u, Ge)];
1062
- u += Ne & 15;
1063
- var y = Ne >> 4;
1064
- if (y < 16)
1065
- P[w++] = y;
1066
- else {
1067
- var B = 0, H = 0;
1068
- for (y == 16 ? (H = 3 + U(s, u, 3), u += 2, B = P[w - 1]) : y == 17 ? (H = 3 + U(s, u, 7), u += 3) : y == 18 && (H = 11 + U(s, u, 127), u += 7); H--; )
1069
- P[w++] = B;
1070
- }
1071
- }
1072
- var ye = P.subarray(0, ee), v = P.subarray(ee);
1073
- h = fe(ye), E = fe(v), d = G(ye, h, 1), R = G(v, E, 1);
1074
- } else
1075
- S(1);
1076
- else {
1077
- var y = dt(u) + 4, k = s[y - 4] | s[y - 3] << 8, Z = y + k;
1078
- if (Z > o) {
1079
- f && S(0);
1080
- break;
1081
- }
1082
- a && l(c + k), t.set(s.subarray(y, Z), c), e.b = c += k, e.p = u = Z * 8, e.f = _;
1083
- continue;
1084
- }
1085
- if (u > p) {
1086
- f && S(0);
1087
- break;
1088
- }
1089
- }
1090
- a && l(c + 131072);
1091
- for (var Ye = (1 << h) - 1, Ke = (1 << E) - 1, re = u; ; re = u) {
1092
- var B = d[oe(s, u) & Ye], I = B >> 4;
1093
- if (u += B & 15, u > p) {
1094
- f && S(0);
1095
- break;
1096
- }
1097
- if (B || S(2), I < 256)
1098
- t[c++] = I;
1099
- else if (I == 256) {
1100
- re = u, d = null;
1101
- break;
1102
- } else {
1103
- var we = I - 254;
1104
- if (I > 264) {
1105
- var w = I - 257, L = Pe[w];
1106
- we = U(s, u, (1 << L) - 1) + je[w], u += L;
1107
- }
1108
- var ne = R[oe(s, u) & Ke], se = ne >> 4;
1109
- ne || S(3), u += ne & 15;
1110
- var v = ut[se];
1111
- if (se > 3) {
1112
- var L = Le[se];
1113
- v += oe(s, u) & (1 << L) - 1, u += L;
1114
- }
1115
- if (u > p) {
1116
- f && S(0);
1117
- break;
1118
- }
1119
- a && l(c + 131072);
1120
- var me = c + we;
1121
- if (c < v) {
1122
- var Ue = r - v, He = Math.min(v, me);
1123
- for (Ue + c < 0 && S(3); c < He; ++c)
1124
- t[c] = i[Ue + c];
1125
- }
1126
- for (; c < me; ++c)
1127
- t[c] = t[c - v];
1128
- }
1129
- }
1130
- e.l = d, e.p = re, e.b = c, e.f = _, d && (_ = 1, e.m = h, e.d = R, e.n = E);
1131
- } while (!_);
1132
- return c != t.length && n ? ht(t, 0, c) : t.subarray(0, c);
1133
- }, gt = /* @__PURE__ */ new N(0), pt = function(s) {
1134
- (s[0] != 31 || s[1] != 139 || s[2] != 8) && S(6, "invalid gzip data");
1135
- var e = s[3], t = 10;
1136
- e & 4 && (t += (s[10] | s[11] << 8) + 2);
1137
- for (var i = (e >> 3 & 1) + (e >> 4 & 1); i > 0; i -= !s[t++])
1138
- ;
1139
- return t + (e & 2);
1140
- }, Ot = function(s) {
1141
- var e = s.length;
1142
- return (s[e - 4] | s[e - 3] << 8 | s[e - 2] << 16 | s[e - 1] << 24) >>> 0;
1143
- };
1144
- function Mt(s, e) {
1145
- var t = pt(s);
1146
- return t + 8 > s.length && S(6, "invalid gzip data"), Et(s.subarray(t, -8), { i: 2 }, new N(Ot(s)), e);
1147
- }
1148
- var Nt = typeof TextDecoder < "u" && /* @__PURE__ */ new TextDecoder(), yt = 0;
1149
- try {
1150
- Nt.decode(gt, { stream: !0 }), yt = 1;
1151
- } catch {
1152
- }
1153
- class jt {
1154
- buffer;
1155
- onMessage;
1156
- constructor(e) {
1157
- this.onMessage = e, this.buffer = new Uint8Array();
1158
- }
1159
- push(e) {
1160
- this.buffer = wt(this.buffer, e);
1161
- let t = 0;
1162
- for (; t < this.buffer.length; )
1163
- try {
1164
- const { value: i, nextOffset: o } = Q(this.buffer, t);
1165
- t = o, this.onMessage(i);
1166
- } catch (i) {
1167
- if (i.incomplete) break;
1168
- throw i;
1169
- }
1170
- t > 0 && (this.buffer = this.buffer.slice(t));
1171
- }
1172
- }
1173
- function wt(s, e) {
1174
- const t = new Uint8Array(s.length + e.length);
1175
- return t.set(s, 0), t.set(e, s.length), t;
1176
- }
1177
- function A() {
1178
- const s = new Error("incomplete msgpack buffer");
1179
- return s.incomplete = !0, s;
1180
- }
1181
- function Q(s, e) {
1182
- if (e >= s.length) throw A();
1183
- const t = s[e];
1184
- if (t <= 127) return { value: t, nextOffset: e + 1 };
1185
- if (t >= 128 && t <= 143) return _e(s, e, t & 15, 1);
1186
- if (t >= 144 && t <= 159) return ue(s, e, t & 15, 1);
1187
- if (t >= 160 && t <= 191) return X(s, e, t & 31, 1);
1188
- if (t >= 224) return { value: t - 256, nextOffset: e + 1 };
1189
- switch (t) {
1190
- case 192:
1191
- return { value: null, nextOffset: e + 1 };
1192
- case 194:
1193
- return { value: !1, nextOffset: e + 1 };
1194
- case 195:
1195
- return { value: !0, nextOffset: e + 1 };
1196
- case 199:
1197
- return ce(s, e, de(s, e + 1, 1), 3);
1198
- case 200:
1199
- return ce(s, e, de(s, e + 1, 2), 4);
1200
- case 201:
1201
- return ce(s, e, de(s, e + 1, 4), 6);
1202
- case 204:
1203
- return q(s, e, 1, !1);
1204
- case 205:
1205
- return q(s, e, 2, !1);
1206
- case 206:
1207
- return q(s, e, 4, !1);
1208
- case 207:
1209
- return q(s, e, 8, !0);
1210
- case 208:
1211
- return $(s, e, 1);
1212
- case 209:
1213
- return $(s, e, 2);
1214
- case 210:
1215
- return $(s, e, 4);
1216
- case 211:
1217
- return $(s, e, 8);
1218
- case 212:
1219
- return M(s, e, 1);
1220
- case 213:
1221
- return M(s, e, 2);
1222
- case 214:
1223
- return M(s, e, 4);
1224
- case 215:
1225
- return M(s, e, 8);
1226
- case 216:
1227
- return M(s, e, 16);
1228
- case 217:
1229
- return X(s, e, s[e + 1], 2);
1230
- case 218:
1231
- return X(s, e, j(s, e + 1), 3);
1232
- case 219:
1233
- return X(s, e, z(s, e + 1), 5);
1234
- case 220:
1235
- return ue(s, e, j(s, e + 1), 3);
1236
- case 221:
1237
- return ue(s, e, z(s, e + 1), 5);
1238
- case 222:
1239
- return _e(s, e, j(s, e + 1), 3);
1240
- case 223:
1241
- return _e(s, e, z(s, e + 1), 5);
1242
- case 196:
1243
- return le(s, e, s[e + 1], 2);
1244
- case 197:
1245
- return le(s, e, j(s, e + 1), 3);
1246
- case 198:
1247
- return le(s, e, z(s, e + 1), 5);
1248
- case 203:
1249
- return mt(s, e, 8);
1250
- default:
1251
- throw new Error(`Unsupported msgpack type: 0x${t.toString(16)}`);
1252
- }
1253
- }
1254
- function le(s, e, t, i) {
1255
- const o = e + i, r = o + t;
1256
- if (r > s.length) throw A();
1257
- return { value: s.slice(o, r), nextOffset: r };
1258
- }
1259
- function X(s, e, t, i) {
1260
- const o = e + i, r = o + t;
1261
- if (r > s.length) throw A();
1262
- return { value: new TextDecoder().decode(s.slice(o, r)), nextOffset: r };
1263
- }
1264
- function ue(s, e, t, i) {
1265
- let o = e + i;
1266
- const r = [];
1267
- for (let n = 0; n < t; n += 1) {
1268
- const { value: a, nextOffset: f } = Q(s, o);
1269
- r.push(a), o = f;
1270
- }
1271
- return { value: r, nextOffset: o };
1272
- }
1273
- function _e(s, e, t, i) {
1274
- let o = e + i;
1275
- const r = {};
1276
- for (let n = 0; n < t; n += 1) {
1277
- const a = Q(s, o), f = Q(s, a.nextOffset);
1278
- r[String(a.value)] = f.value, o = f.nextOffset;
1279
- }
1280
- return { value: r, nextOffset: o };
1281
- }
1282
- function M(s, e, t) {
1283
- const i = e + 2, o = i + t;
1284
- if (o > s.length) throw A();
1285
- const r = s.slice(i, o);
1286
- return { value: { type: s[e + 1], data: r }, nextOffset: o };
1287
- }
1288
- function ce(s, e, t, i) {
1289
- const o = s[e + i - 1], r = e + i, n = r + t;
1290
- if (n > s.length) throw A();
1291
- const a = s.slice(r, n);
1292
- return { value: { type: o, data: a }, nextOffset: n };
1293
- }
1294
- function q(s, e, t, i) {
1295
- const o = e + 1, r = o + t;
1296
- if (r > s.length) throw A();
1297
- const n = new DataView(s.slice(o, r).buffer);
1298
- let a;
1299
- return t === 1 ? a = n.getUint8(0) : t === 2 ? a = n.getUint16(0) : t === 4 ? a = n.getUint32(0) : a = n.getBigUint64(0), { value: i ? a : Number(a), nextOffset: r };
1300
- }
1301
- function $(s, e, t) {
1302
- const i = e + 1, o = i + t;
1303
- if (o > s.length) throw A();
1304
- const r = new DataView(s.slice(i, o).buffer);
1305
- let n;
1306
- return t === 1 ? n = r.getInt8(0) : t === 2 ? n = r.getInt16(0) : t === 4 ? n = r.getInt32(0) : n = r.getBigInt64(0), { value: Number(n), nextOffset: o };
1307
- }
1308
- function mt(s, e, t) {
1309
- const i = e + 1, o = i + t;
1310
- if (o > s.length) throw A();
1311
- const r = new DataView(s.slice(i, o).buffer);
1312
- return { value: t === 4 ? r.getFloat32(0) : r.getFloat64(0), nextOffset: o };
1313
- }
1314
- function de(s, e, t) {
1315
- const i = e;
1316
- if (i + t > s.length) throw A();
1317
- return t === 1 ? s[i] : t === 2 ? j(s, i) : z(s, i);
1318
- }
1319
- function j(s, e) {
1320
- return s[e] << 8 | s[e + 1];
1321
- }
1322
- function z(s, e) {
1323
- return s[e] * 16777216 + (s[e + 1] << 16 | s[e + 2] << 8 | s[e + 3]);
1324
- }
1325
- export {
1326
- St as C,
1327
- x as D,
1328
- xt as E,
1329
- it as F,
1330
- Vt as P,
1331
- Ct as R,
1332
- Qe as S,
1333
- Pt as W,
1334
- jt as a,
1335
- Ie as b,
1336
- Ce as c,
1337
- Bt as d,
1338
- bt as e,
1339
- At as f,
1340
- Mt as g,
1341
- vt as h,
1342
- J as i,
1343
- Te as j,
1344
- Dt as k,
1345
- Tt as l,
1346
- It as m,
1347
- Ft as n,
1348
- Je as o,
1349
- Ze as p,
1350
- Ut as q
1351
- };