@weapp-sqlite/sqljs 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/lite.cjs ADDED
@@ -0,0 +1,2377 @@
1
+ Object.defineProperties(exports, {
2
+ __esModule: { value: true },
3
+ [Symbol.toStringTag]: { value: "Module" }
4
+ });
5
+ const require_rolldown_runtime = require("./rolldown-runtime-y5ARvAq5.cjs");
6
+ //#region src/vendor/sql-wasm-lite.js
7
+ var require_sql_wasm_lite = /* @__PURE__ */ require_rolldown_runtime.__commonJSMin(((exports, module) => {
8
+ var initSqlJsPromise = void 0;
9
+ var initSqlJs = function(moduleConfig) {
10
+ if (initSqlJsPromise) return initSqlJsPromise;
11
+ initSqlJsPromise = new Promise(function(resolveModule, reject) {
12
+ var Module = typeof moduleConfig !== "undefined" ? moduleConfig : {};
13
+ var originalOnAbortFunction = Module["onAbort"];
14
+ Module["onAbort"] = function(errorThatCausedAbort) {
15
+ reject(new Error(errorThatCausedAbort));
16
+ if (originalOnAbortFunction) originalOnAbortFunction(errorThatCausedAbort);
17
+ };
18
+ Module["postRun"] = Module["postRun"] || [];
19
+ Module["postRun"].push(function() {
20
+ resolveModule(Module);
21
+ });
22
+ module = void 0;
23
+ var k;
24
+ k ||= typeof Module != "undefined" ? Module : {};
25
+ var aa = !!globalThis.window, ba = !!globalThis.WorkerGlobalScope, ca = globalThis.process?.versions?.node && "renderer" != globalThis.process?.type;
26
+ k.onRuntimeInitialized = function() {
27
+ function a(f, l) {
28
+ switch (typeof l) {
29
+ case "boolean":
30
+ cc(f, l ? 1 : 0);
31
+ break;
32
+ case "number":
33
+ dc(f, l);
34
+ break;
35
+ case "string":
36
+ ec(f, l, -1, -1);
37
+ break;
38
+ case "object":
39
+ if (null === l) lb(f);
40
+ else if (null != l.length) {
41
+ var n = da(l.length);
42
+ m.set(l, n);
43
+ fc(f, n, l.length, -1);
44
+ ea(n);
45
+ } else va(f, "Wrong API use : tried to return a value of an unknown type (" + l + ").", -1);
46
+ break;
47
+ default: lb(f);
48
+ }
49
+ }
50
+ function b(f, l) {
51
+ for (var n = [], p = 0; p < f; p += 1) {
52
+ var r = t(l + 4 * p, "i32"), w = gc(r);
53
+ if (1 === w || 2 === w) r = hc(r);
54
+ else if (3 === w) r = ic(r);
55
+ else if (4 === w) {
56
+ w = r;
57
+ r = jc(w);
58
+ w = kc(w);
59
+ for (var J = new Uint8Array(r), I = 0; I < r; I += 1) J[I] = m[w + I];
60
+ r = J;
61
+ } else r = null;
62
+ n.push(r);
63
+ }
64
+ return n;
65
+ }
66
+ function c(f, l) {
67
+ this.Na = f;
68
+ this.db = l;
69
+ this.La = 1;
70
+ this.jb = [];
71
+ }
72
+ function d(f, l) {
73
+ this.db = l;
74
+ this.bb = fa(f);
75
+ if (null === this.bb) throw Error("Unable to allocate memory for the SQL string");
76
+ this.ib = this.bb;
77
+ this.Xa = this.pb = null;
78
+ }
79
+ function e(f) {
80
+ this.filename = "dbfile_" + (4294967295 * Math.random() >>> 0);
81
+ if (null != f) {
82
+ var l = this.filename, n = "/", p = l;
83
+ n && (n = "string" == typeof n ? n : ha(n), p = l ? ia(n + "/" + l) : n);
84
+ l = ja(!0, !0);
85
+ p = la(p, l);
86
+ if (f) {
87
+ if ("string" == typeof f) {
88
+ n = Array(f.length);
89
+ for (var r = 0, w = f.length; r < w; ++r) n[r] = f.charCodeAt(r);
90
+ f = n;
91
+ }
92
+ ma(p, l | 146);
93
+ n = na(p, 577);
94
+ oa(n, f, 0, f.length, 0);
95
+ pa(n);
96
+ ma(p, l);
97
+ }
98
+ }
99
+ this.handleError(q(this.filename, g));
100
+ this.db = t(g, "i32");
101
+ this.cb = {};
102
+ this.Pa = {};
103
+ }
104
+ var g = y(4), h = k.cwrap, q = h("sqlite3_open", "number", ["string", "number"]), v = h("sqlite3_close_v2", "number", ["number"]), u = h("sqlite3_exec", "number", [
105
+ "number",
106
+ "string",
107
+ "number",
108
+ "number",
109
+ "number"
110
+ ]), x = h("sqlite3_changes", "number", ["number"]), C = h("sqlite3_prepare_v2", "number", [
111
+ "number",
112
+ "string",
113
+ "number",
114
+ "number",
115
+ "number"
116
+ ]), ob = h("sqlite3_sql", "string", ["number"]), pb = h("sqlite3_prepare_v2", "number", [
117
+ "number",
118
+ "number",
119
+ "number",
120
+ "number",
121
+ "number"
122
+ ]), mc = h("sqlite3_bind_text", "number", [
123
+ "number",
124
+ "number",
125
+ "number",
126
+ "number",
127
+ "number"
128
+ ]), qb = h("sqlite3_bind_blob", "number", [
129
+ "number",
130
+ "number",
131
+ "number",
132
+ "number",
133
+ "number"
134
+ ]), nc = h("sqlite3_bind_double", "number", [
135
+ "number",
136
+ "number",
137
+ "number"
138
+ ]), oc = h("sqlite3_bind_int", "number", [
139
+ "number",
140
+ "number",
141
+ "number"
142
+ ]), pc = h("sqlite3_bind_parameter_index", "number", ["number", "string"]), qc = h("sqlite3_step", "number", ["number"]), rc = h("sqlite3_errmsg", "string", ["number"]), sc = h("sqlite3_column_count", "number", ["number"]), tc = h("sqlite3_data_count", "number", ["number"]), uc = h("sqlite3_column_double", "number", ["number", "number"]), rb = h("sqlite3_column_text", "string", ["number", "number"]), vc = h("sqlite3_column_blob", "number", ["number", "number"]), wc = h("sqlite3_column_bytes", "number", ["number", "number"]), xc = h("sqlite3_column_type", "number", ["number", "number"]), yc = h("sqlite3_column_name", "string", ["number", "number"]), zc = h("sqlite3_reset", "number", ["number"]), Ac = h("sqlite3_clear_bindings", "number", ["number"]), Bc = h("sqlite3_finalize", "number", ["number"]), sb = h("sqlite3_create_function_v2", "number", "number string number number number number number number number".split(" ")), gc = h("sqlite3_value_type", "number", ["number"]), jc = h("sqlite3_value_bytes", "number", ["number"]), ic = h("sqlite3_value_text", "string", ["number"]), kc = h("sqlite3_value_blob", "number", ["number"]), hc = h("sqlite3_value_double", "number", ["number"]), dc = h("sqlite3_result_double", "", ["number", "number"]), lb = h("sqlite3_result_null", "", ["number"]), ec = h("sqlite3_result_text", "", [
143
+ "number",
144
+ "string",
145
+ "number",
146
+ "number"
147
+ ]), fc = h("sqlite3_result_blob", "", [
148
+ "number",
149
+ "number",
150
+ "number",
151
+ "number"
152
+ ]), cc = h("sqlite3_result_int", "", ["number", "number"]), va = h("sqlite3_result_error", "", [
153
+ "number",
154
+ "string",
155
+ "number"
156
+ ]), tb = h("sqlite3_aggregate_context", "number", ["number", "number"]), ub = h("sqlite3_update_hook", "number", [
157
+ "number",
158
+ "number",
159
+ "number"
160
+ ]);
161
+ c.prototype.bind = function(f) {
162
+ if (!this.Na) throw "Statement closed";
163
+ this.reset();
164
+ return Array.isArray(f) ? this.Db(f) : null != f && "object" === typeof f ? this.Eb(f) : !0;
165
+ };
166
+ c.prototype.step = function() {
167
+ if (!this.Na) throw "Statement closed";
168
+ this.La = 1;
169
+ var f = qc(this.Na);
170
+ switch (f) {
171
+ case 100: return !0;
172
+ case 101: return !1;
173
+ default: throw this.db.handleError(f);
174
+ }
175
+ };
176
+ c.prototype.xb = function(f) {
177
+ f ?? (f = this.La, this.La += 1);
178
+ return uc(this.Na, f);
179
+ };
180
+ c.prototype.Lb = function(f) {
181
+ f ?? (f = this.La, this.La += 1);
182
+ f = rb(this.Na, f);
183
+ if ("function" !== typeof BigInt) throw Error("BigInt is not supported");
184
+ return BigInt(f);
185
+ };
186
+ c.prototype.Pb = function(f) {
187
+ f ?? (f = this.La, this.La += 1);
188
+ return rb(this.Na, f);
189
+ };
190
+ c.prototype.getBlob = function(f) {
191
+ f ?? (f = this.La, this.La += 1);
192
+ var l = wc(this.Na, f);
193
+ f = vc(this.Na, f);
194
+ for (var n = new Uint8Array(l), p = 0; p < l; p += 1) n[p] = m[f + p];
195
+ return n;
196
+ };
197
+ c.prototype.get = function(f, l) {
198
+ l = l || {};
199
+ null != f && this.bind(f) && this.step();
200
+ f = [];
201
+ for (var n = tc(this.Na), p = 0; p < n; p += 1) switch (xc(this.Na, p)) {
202
+ case 1:
203
+ var r = l.useBigInt ? this.Lb(p) : this.xb(p);
204
+ f.push(r);
205
+ break;
206
+ case 2:
207
+ f.push(this.xb(p));
208
+ break;
209
+ case 3:
210
+ f.push(this.Pb(p));
211
+ break;
212
+ case 4:
213
+ f.push(this.getBlob(p));
214
+ break;
215
+ default: f.push(null);
216
+ }
217
+ return f;
218
+ };
219
+ c.prototype.nb = function() {
220
+ for (var f = [], l = sc(this.Na), n = 0; n < l; n += 1) f.push(yc(this.Na, n));
221
+ return f;
222
+ };
223
+ c.prototype.wb = function(f, l) {
224
+ f = this.get(f, l);
225
+ l = this.nb();
226
+ for (var n = {}, p = 0; p < l.length; p += 1) n[l[p]] = f[p];
227
+ return n;
228
+ };
229
+ c.prototype.Ob = function() {
230
+ return ob(this.Na);
231
+ };
232
+ c.prototype.run = function(f) {
233
+ null != f && this.bind(f);
234
+ this.step();
235
+ return this.reset();
236
+ };
237
+ c.prototype.tb = function(f, l) {
238
+ l ?? (l = this.La, this.La += 1);
239
+ f = fa(f);
240
+ this.jb.push(f);
241
+ this.db.handleError(mc(this.Na, l, f, -1, 0));
242
+ };
243
+ c.prototype.Cb = function(f, l) {
244
+ l ?? (l = this.La, this.La += 1);
245
+ var n = da(f.length);
246
+ m.set(f, n);
247
+ this.jb.push(n);
248
+ this.db.handleError(qb(this.Na, l, n, f.length, 0));
249
+ };
250
+ c.prototype.sb = function(f, l) {
251
+ l ?? (l = this.La, this.La += 1);
252
+ this.db.handleError((f === (f | 0) ? oc : nc)(this.Na, l, f));
253
+ };
254
+ c.prototype.Fb = function(f) {
255
+ f ?? (f = this.La, this.La += 1);
256
+ qb(this.Na, f, 0, 0, 0);
257
+ };
258
+ c.prototype.ub = function(f, l) {
259
+ l ?? (l = this.La, this.La += 1);
260
+ switch (typeof f) {
261
+ case "string":
262
+ this.tb(f, l);
263
+ return;
264
+ case "number":
265
+ this.sb(f, l);
266
+ return;
267
+ case "bigint":
268
+ this.tb(f.toString(), l);
269
+ return;
270
+ case "boolean":
271
+ this.sb(f + 0, l);
272
+ return;
273
+ case "object":
274
+ if (null === f) {
275
+ this.Fb(l);
276
+ return;
277
+ }
278
+ if (null != f.length) {
279
+ this.Cb(f, l);
280
+ return;
281
+ }
282
+ }
283
+ throw "Wrong API use : tried to bind a value of an unknown type (" + f + ").";
284
+ };
285
+ c.prototype.Eb = function(f) {
286
+ var l = this;
287
+ Object.keys(f).forEach(function(n) {
288
+ var p = pc(l.Na, n);
289
+ 0 !== p && l.ub(f[n], p);
290
+ });
291
+ return !0;
292
+ };
293
+ c.prototype.Db = function(f) {
294
+ for (var l = 0; l < f.length; l += 1) this.ub(f[l], l + 1);
295
+ return !0;
296
+ };
297
+ c.prototype.reset = function() {
298
+ this.freemem();
299
+ return 0 === Ac(this.Na) && 0 === zc(this.Na);
300
+ };
301
+ c.prototype.freemem = function() {
302
+ for (var f; void 0 !== (f = this.jb.pop());) ea(f);
303
+ };
304
+ c.prototype.Va = function() {
305
+ this.freemem();
306
+ var f = 0 === Bc(this.Na);
307
+ delete this.db.cb[this.Na];
308
+ this.Na = 0;
309
+ return f;
310
+ };
311
+ d.prototype.next = function() {
312
+ if (null === this.bb) return { done: !0 };
313
+ null !== this.Xa && (this.Xa.Va(), this.Xa = null);
314
+ if (!this.db.db) throw this.lb(), Error("Database closed");
315
+ var f = qa(), l = y(4);
316
+ ra(g);
317
+ ra(l);
318
+ try {
319
+ this.db.handleError(pb(this.db.db, this.ib, -1, g, l));
320
+ this.ib = t(l, "i32");
321
+ var n = t(g, "i32");
322
+ if (0 === n) return this.lb(), { done: !0 };
323
+ this.Xa = new c(n, this.db);
324
+ this.db.cb[n] = this.Xa;
325
+ return {
326
+ value: this.Xa,
327
+ done: !1
328
+ };
329
+ } catch (p) {
330
+ throw this.pb = z(this.ib), this.lb(), p;
331
+ } finally {
332
+ sa(f);
333
+ }
334
+ };
335
+ d.prototype.lb = function() {
336
+ ea(this.bb);
337
+ this.bb = null;
338
+ };
339
+ d.prototype.Mb = function() {
340
+ return null !== this.pb ? this.pb : z(this.ib);
341
+ };
342
+ "function" === typeof Symbol && "symbol" === typeof Symbol.iterator && (d.prototype[Symbol.iterator] = function() {
343
+ return this;
344
+ });
345
+ e.prototype.run = function(f, l) {
346
+ if (!this.db) throw "Database closed";
347
+ if (l) {
348
+ f = this.qb(f, l);
349
+ try {
350
+ f.step();
351
+ } finally {
352
+ f.Va();
353
+ }
354
+ } else this.handleError(u(this.db, f, 0, 0, g));
355
+ return this;
356
+ };
357
+ e.prototype.exec = function(f, l, n) {
358
+ if (!this.db) throw "Database closed";
359
+ var p = qa(), r = null, w = null, J = null;
360
+ try {
361
+ J = w = fa(f);
362
+ var I = y(4);
363
+ for (f = []; 0 !== t(J, "i8");) {
364
+ ra(g);
365
+ ra(I);
366
+ this.handleError(pb(this.db, J, -1, g, I));
367
+ var L = t(g, "i32");
368
+ J = t(I, "i32");
369
+ if (0 !== L) {
370
+ var G = null;
371
+ r = new c(L, this);
372
+ for (null != l && r.bind(l); r.step();) null === G && (G = {
373
+ columns: r.nb(),
374
+ values: []
375
+ }, f.push(G)), G.values.push(r.get(null, n));
376
+ r.Va();
377
+ }
378
+ }
379
+ return f;
380
+ } catch (ka) {
381
+ throw r && r.Va(), ka;
382
+ } finally {
383
+ w && ea(w), sa(p);
384
+ }
385
+ };
386
+ e.prototype.Jb = function(f, l, n, p, r) {
387
+ "function" === typeof l && (p = n, n = l, l = void 0);
388
+ f = this.qb(f, l);
389
+ try {
390
+ for (; f.step();) n(f.wb(null, r));
391
+ } finally {
392
+ f.Va();
393
+ }
394
+ if ("function" === typeof p) return p();
395
+ };
396
+ e.prototype.qb = function(f, l) {
397
+ ra(g);
398
+ this.handleError(C(this.db, f, -1, g, 0));
399
+ f = t(g, "i32");
400
+ if (0 === f) throw "Nothing to prepare";
401
+ var n = new c(f, this);
402
+ null != l && n.bind(l);
403
+ return this.cb[f] = n;
404
+ };
405
+ e.prototype.Qb = function(f) {
406
+ return new d(f, this);
407
+ };
408
+ e.prototype.Kb = function() {
409
+ Object.values(this.cb).forEach(function(l) {
410
+ l.Va();
411
+ });
412
+ Object.values(this.Pa).forEach(A);
413
+ this.Pa = {};
414
+ this.handleError(v(this.db));
415
+ var f = ta(this.filename);
416
+ this.handleError(q(this.filename, g));
417
+ this.db = t(g, "i32");
418
+ return f;
419
+ };
420
+ e.prototype.close = function() {
421
+ null !== this.db && (Object.values(this.cb).forEach(function(f) {
422
+ f.Va();
423
+ }), Object.values(this.Pa).forEach(A), this.Pa = {}, this.Wa && (A(this.Wa), this.Wa = void 0), this.handleError(v(this.db)), ua("/" + this.filename), this.db = null);
424
+ };
425
+ e.prototype.handleError = function(f) {
426
+ if (0 === f) return null;
427
+ f = rc(this.db);
428
+ throw Error(f);
429
+ };
430
+ e.prototype.Nb = function() {
431
+ return x(this.db);
432
+ };
433
+ e.prototype.Hb = function(f, l) {
434
+ Object.prototype.hasOwnProperty.call(this.Pa, f) && (A(this.Pa[f]), delete this.Pa[f]);
435
+ var n = wa(function(p, r, w) {
436
+ r = b(r, w);
437
+ try {
438
+ var J = l.apply(null, r);
439
+ } catch (I) {
440
+ va(p, I, -1);
441
+ return;
442
+ }
443
+ a(p, J);
444
+ }, "viii");
445
+ this.Pa[f] = n;
446
+ this.handleError(sb(this.db, f, l.length, 1, 0, n, 0, 0, 0));
447
+ return this;
448
+ };
449
+ e.prototype.Gb = function(f, l) {
450
+ var n = l.init || function() {
451
+ return null;
452
+ }, p = l.finalize || function(L) {
453
+ return L;
454
+ }, r = l.step;
455
+ if (!r) throw "An aggregate function must have a step function in " + f;
456
+ var w = {};
457
+ Object.hasOwnProperty.call(this.Pa, f) && (A(this.Pa[f]), delete this.Pa[f]);
458
+ l = f + "__finalize";
459
+ Object.hasOwnProperty.call(this.Pa, l) && (A(this.Pa[l]), delete this.Pa[l]);
460
+ var J = wa(function(L, G, ka) {
461
+ var V = tb(L, 1);
462
+ Object.hasOwnProperty.call(w, V) || (w[V] = n());
463
+ G = b(G, ka);
464
+ G = [w[V]].concat(G);
465
+ try {
466
+ w[V] = r.apply(null, G);
467
+ } catch (Dc) {
468
+ delete w[V], va(L, Dc, -1);
469
+ }
470
+ }, "viii"), I = wa(function(L) {
471
+ var G = tb(L, 1);
472
+ try {
473
+ var ka = p(w[G]);
474
+ } catch (V) {
475
+ delete w[G];
476
+ va(L, V, -1);
477
+ return;
478
+ }
479
+ a(L, ka);
480
+ delete w[G];
481
+ }, "vi");
482
+ this.Pa[f] = J;
483
+ this.Pa[l] = I;
484
+ this.handleError(sb(this.db, f, r.length - 1, 1, 0, 0, J, I, 0));
485
+ return this;
486
+ };
487
+ e.prototype.Vb = function(f) {
488
+ this.Wa && (ub(this.db, 0, 0), A(this.Wa), this.Wa = void 0);
489
+ if (!f) return this;
490
+ this.Wa = wa(function(l, n, p, r, w) {
491
+ switch (n) {
492
+ case 18:
493
+ l = "insert";
494
+ break;
495
+ case 23:
496
+ l = "update";
497
+ break;
498
+ case 9:
499
+ l = "delete";
500
+ break;
501
+ default: throw "unknown operationCode in updateHook callback: " + n;
502
+ }
503
+ p = z(p);
504
+ r = z(r);
505
+ if (w > Number.MAX_SAFE_INTEGER) throw "rowId too big to fit inside a Number";
506
+ f(l, p, r, Number(w));
507
+ }, "viiiij");
508
+ ub(this.db, this.Wa, 0);
509
+ return this;
510
+ };
511
+ c.prototype.bind = c.prototype.bind;
512
+ c.prototype.step = c.prototype.step;
513
+ c.prototype.get = c.prototype.get;
514
+ c.prototype.getColumnNames = c.prototype.nb;
515
+ c.prototype.getAsObject = c.prototype.wb;
516
+ c.prototype.getSQL = c.prototype.Ob;
517
+ c.prototype.getNormalizedSQL = c.prototype.cc;
518
+ c.prototype.run = c.prototype.run;
519
+ c.prototype.reset = c.prototype.reset;
520
+ c.prototype.freemem = c.prototype.freemem;
521
+ c.prototype.free = c.prototype.Va;
522
+ d.prototype.next = d.prototype.next;
523
+ d.prototype.getRemainingSQL = d.prototype.Mb;
524
+ e.prototype.run = e.prototype.run;
525
+ e.prototype.exec = e.prototype.exec;
526
+ e.prototype.each = e.prototype.Jb;
527
+ e.prototype.prepare = e.prototype.qb;
528
+ e.prototype.iterateStatements = e.prototype.Qb;
529
+ e.prototype["export"] = e.prototype.Kb;
530
+ e.prototype.close = e.prototype.close;
531
+ e.prototype.handleError = e.prototype.handleError;
532
+ e.prototype.getRowsModified = e.prototype.Nb;
533
+ e.prototype.create_function = e.prototype.Hb;
534
+ e.prototype.create_aggregate = e.prototype.Gb;
535
+ e.prototype.updateHook = e.prototype.Vb;
536
+ k.Database = e;
537
+ };
538
+ var xa = "./this.program", ya = (a, b) => {
539
+ throw b;
540
+ }, za = globalThis.document?.currentScript?.src;
541
+ "undefined" != typeof __filename ? za = __filename : ba && (za = self.location.href);
542
+ var Aa = "", Ba, Ca;
543
+ if (ca) {
544
+ var fs = require("node:fs");
545
+ Aa = __dirname + "/";
546
+ Ca = (a) => {
547
+ a = Da(a) ? new URL(a) : a;
548
+ return fs.readFileSync(a);
549
+ };
550
+ Ba = async (a) => {
551
+ a = Da(a) ? new URL(a) : a;
552
+ return fs.readFileSync(a, void 0);
553
+ };
554
+ 1 < process.argv.length && (xa = process.argv[1].replace(/\\/g, "/"));
555
+ process.argv.slice(2);
556
+ "undefined" != typeof module && (module.exports = k);
557
+ ya = (a, b) => {
558
+ process.exitCode = a;
559
+ throw b;
560
+ };
561
+ } else if (aa || ba) {
562
+ try {
563
+ Aa = new URL(".", za).href;
564
+ } catch {}
565
+ ba && (Ca = (a) => {
566
+ var b = new XMLHttpRequest();
567
+ b.open("GET", a, !1);
568
+ b.responseType = "arraybuffer";
569
+ b.send(null);
570
+ return new Uint8Array(b.response);
571
+ });
572
+ Ba = async (a) => {
573
+ if (Da(a)) return new Promise((c, d) => {
574
+ var e = new XMLHttpRequest();
575
+ e.open("GET", a, !0);
576
+ e.responseType = "arraybuffer";
577
+ e.onload = () => {
578
+ 200 == e.status || 0 == e.status && e.response ? c(e.response) : d(e.status);
579
+ };
580
+ e.onerror = d;
581
+ e.send(null);
582
+ });
583
+ var b = await fetch(a, { credentials: "same-origin" });
584
+ if (b.ok) return b.arrayBuffer();
585
+ throw Error(b.status + " : " + b.url);
586
+ };
587
+ }
588
+ var Ea = console.log.bind(console), B = console.error.bind(console), Fa, Ga = !1, Ha, Da = (a) => a.startsWith("file://"), m, D, Ia, E, F, Ja, Ka, H;
589
+ function La() {
590
+ var a = Ma.buffer;
591
+ m = new Int8Array(a);
592
+ Ia = new Int16Array(a);
593
+ D = new Uint8Array(a);
594
+ new Uint16Array(a);
595
+ E = new Int32Array(a);
596
+ F = new Uint32Array(a);
597
+ Ja = new Float32Array(a);
598
+ Ka = new Float64Array(a);
599
+ H = new BigInt64Array(a);
600
+ new BigUint64Array(a);
601
+ }
602
+ function Na(a) {
603
+ k.onAbort?.(a);
604
+ a = "Aborted(" + a + ")";
605
+ B(a);
606
+ Ga = !0;
607
+ throw new WebAssembly.RuntimeError(a + ". Build with -sASSERTIONS for more info.");
608
+ }
609
+ var Oa;
610
+ async function Pa(a) {
611
+ if (!Fa) try {
612
+ var b = await Ba(a);
613
+ return new Uint8Array(b);
614
+ } catch {}
615
+ if (a == Oa && Fa) a = new Uint8Array(Fa);
616
+ else if (Ca) a = Ca(a);
617
+ else throw "both async and sync fetching of the wasm failed";
618
+ return a;
619
+ }
620
+ async function Qa(a, b) {
621
+ try {
622
+ var c = await Pa(a);
623
+ return await WebAssembly.instantiate(c, b);
624
+ } catch (d) {
625
+ B(`failed to asynchronously prepare wasm: ${d}`), Na(d);
626
+ }
627
+ }
628
+ async function Ra(a) {
629
+ var b = Oa;
630
+ if (!Fa && !Da(b) && !ca) try {
631
+ var c = fetch(b, { credentials: "same-origin" });
632
+ return await WebAssembly.instantiateStreaming(c, a);
633
+ } catch (d) {
634
+ B(`wasm streaming compile failed: ${d}`), B("falling back to ArrayBuffer instantiation");
635
+ }
636
+ return Qa(b, a);
637
+ }
638
+ class Sa {
639
+ name = "ExitStatus";
640
+ constructor(a) {
641
+ this.message = `Program terminated with exit(${a})`;
642
+ this.status = a;
643
+ }
644
+ }
645
+ var Ta = (a) => {
646
+ for (; 0 < a.length;) a.shift()(k);
647
+ }, Ua = [], Va = [], Wa = () => {
648
+ var a = k.preRun.shift();
649
+ Va.push(a);
650
+ }, K = 0, Xa = null;
651
+ function t(a, b = "i8") {
652
+ b.endsWith("*") && (b = "*");
653
+ switch (b) {
654
+ case "i1": return m[a];
655
+ case "i8": return m[a];
656
+ case "i16": return Ia[a >> 1];
657
+ case "i32": return E[a >> 2];
658
+ case "i64": return H[a >> 3];
659
+ case "float": return Ja[a >> 2];
660
+ case "double": return Ka[a >> 3];
661
+ case "*": return F[a >> 2];
662
+ default: Na(`invalid type for getValue: ${b}`);
663
+ }
664
+ }
665
+ var Ya = !0;
666
+ function ra(a) {
667
+ var b = "i32";
668
+ b.endsWith("*") && (b = "*");
669
+ switch (b) {
670
+ case "i1":
671
+ m[a] = 0;
672
+ break;
673
+ case "i8":
674
+ m[a] = 0;
675
+ break;
676
+ case "i16":
677
+ Ia[a >> 1] = 0;
678
+ break;
679
+ case "i32":
680
+ E[a >> 2] = 0;
681
+ break;
682
+ case "i64":
683
+ H[a >> 3] = BigInt(0);
684
+ break;
685
+ case "float":
686
+ Ja[a >> 2] = 0;
687
+ break;
688
+ case "double":
689
+ Ka[a >> 3] = 0;
690
+ break;
691
+ case "*":
692
+ F[a >> 2] = 0;
693
+ break;
694
+ default: Na(`invalid type for setValue: ${b}`);
695
+ }
696
+ }
697
+ var Za = (a, b) => {
698
+ for (var c = 0, d = a.length - 1; 0 <= d; d--) {
699
+ var e = a[d];
700
+ "." === e ? a.splice(d, 1) : ".." === e ? (a.splice(d, 1), c++) : c && (a.splice(d, 1), c--);
701
+ }
702
+ if (b) for (; c; c--) a.unshift("..");
703
+ return a;
704
+ }, ia = (a) => {
705
+ var b = "/" === a.charAt(0), c = "/" === a.slice(-1);
706
+ (a = Za(a.split("/").filter((d) => !!d), !b).join("/")) || b || (a = ".");
707
+ a && c && (a += "/");
708
+ return (b ? "/" : "") + a;
709
+ }, $a = (a) => {
710
+ var b = /^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/.exec(a).slice(1);
711
+ a = b[0];
712
+ b = b[1];
713
+ if (!a && !b) return ".";
714
+ b &&= b.slice(0, -1);
715
+ return a + b;
716
+ }, ab = (a) => a && a.match(/([^\/]+|\/)\/*$/)[1], bb = () => {
717
+ if (ca) {
718
+ var a = require("node:crypto");
719
+ return (b) => a.randomFillSync(b);
720
+ }
721
+ return (b) => crypto.getRandomValues(b);
722
+ }, cb = (a) => {
723
+ (cb = bb())(a);
724
+ }, db = (...a) => {
725
+ for (var b = "", c = !1, d = a.length - 1; -1 <= d && !c; d--) {
726
+ c = 0 <= d ? a[d] : "/";
727
+ if ("string" != typeof c) throw new TypeError("Arguments to path.resolve must be strings");
728
+ if (!c) return "";
729
+ b = c + "/" + b;
730
+ c = "/" === c.charAt(0);
731
+ }
732
+ b = Za(b.split("/").filter((e) => !!e), !c).join("/");
733
+ return (c ? "/" : "") + b || ".";
734
+ }, eb = new TextDecoder(), fb = (a, b, c, d) => {
735
+ c = b + c;
736
+ if (d) return c;
737
+ for (; a[b] && !(b >= c);) ++b;
738
+ return b;
739
+ }, gb = (a) => {
740
+ var b = fb(a, 0);
741
+ return eb.decode(a.buffer ? a.subarray(0, b) : new Uint8Array(a.slice(0, b)));
742
+ }, hb = [], ib = (a) => {
743
+ for (var b = 0, c = 0; c < a.length; ++c) {
744
+ var d = a.charCodeAt(c);
745
+ 127 >= d ? b++ : 2047 >= d ? b += 2 : 55296 <= d && 57343 >= d ? (b += 4, ++c) : b += 3;
746
+ }
747
+ return b;
748
+ }, M = (a, b, c, d) => {
749
+ if (!(0 < d)) return 0;
750
+ var e = c;
751
+ d = c + d - 1;
752
+ for (var g = 0; g < a.length; ++g) {
753
+ var h = a.codePointAt(g);
754
+ if (127 >= h) {
755
+ if (c >= d) break;
756
+ b[c++] = h;
757
+ } else if (2047 >= h) {
758
+ if (c + 1 >= d) break;
759
+ b[c++] = 192 | h >> 6;
760
+ b[c++] = 128 | h & 63;
761
+ } else if (65535 >= h) {
762
+ if (c + 2 >= d) break;
763
+ b[c++] = 224 | h >> 12;
764
+ b[c++] = 128 | h >> 6 & 63;
765
+ b[c++] = 128 | h & 63;
766
+ } else {
767
+ if (c + 3 >= d) break;
768
+ b[c++] = 240 | h >> 18;
769
+ b[c++] = 128 | h >> 12 & 63;
770
+ b[c++] = 128 | h >> 6 & 63;
771
+ b[c++] = 128 | h & 63;
772
+ g++;
773
+ }
774
+ }
775
+ b[c] = 0;
776
+ return c - e;
777
+ }, jb = [];
778
+ function kb(a, b) {
779
+ jb[a] = {
780
+ input: [],
781
+ output: [],
782
+ ab: b
783
+ };
784
+ mb(a, nb);
785
+ }
786
+ var nb = {
787
+ open(a) {
788
+ var b = jb[a.node.rdev];
789
+ if (!b) throw new N(43);
790
+ a.tty = b;
791
+ a.seekable = !1;
792
+ },
793
+ close(a) {
794
+ a.tty.ab.fsync(a.tty);
795
+ },
796
+ fsync(a) {
797
+ a.tty.ab.fsync(a.tty);
798
+ },
799
+ read(a, b, c, d) {
800
+ if (!a.tty || !a.tty.ab.yb) throw new N(60);
801
+ for (var e = 0, g = 0; g < d; g++) {
802
+ try {
803
+ var h = a.tty.ab.yb(a.tty);
804
+ } catch (q) {
805
+ throw new N(29);
806
+ }
807
+ if (void 0 === h && 0 === e) throw new N(6);
808
+ if (null === h || void 0 === h) break;
809
+ e++;
810
+ b[c + g] = h;
811
+ }
812
+ e && (a.node.atime = Date.now());
813
+ return e;
814
+ },
815
+ write(a, b, c, d) {
816
+ if (!a.tty || !a.tty.ab.rb) throw new N(60);
817
+ try {
818
+ for (var e = 0; e < d; e++) a.tty.ab.rb(a.tty, b[c + e]);
819
+ } catch (g) {
820
+ throw new N(29);
821
+ }
822
+ d && (a.node.mtime = a.node.ctime = Date.now());
823
+ return e;
824
+ }
825
+ }, vb = {
826
+ yb() {
827
+ a: {
828
+ if (!hb.length) {
829
+ var a = null;
830
+ if (ca) {
831
+ var b = Buffer.alloc(256), c = 0, d = process.stdin.fd;
832
+ try {
833
+ c = fs.readSync(d, b, 0, 256);
834
+ } catch (e) {
835
+ if (e.toString().includes("EOF")) c = 0;
836
+ else throw e;
837
+ }
838
+ 0 < c && (a = b.slice(0, c).toString("utf-8"));
839
+ } else globalThis.window?.prompt && (a = window.prompt("Input: "), null !== a && (a += "\n"));
840
+ if (!a) {
841
+ a = null;
842
+ break a;
843
+ }
844
+ b = Array(ib(a) + 1);
845
+ a = M(a, b, 0, b.length);
846
+ b.length = a;
847
+ hb = b;
848
+ }
849
+ a = hb.shift();
850
+ }
851
+ return a;
852
+ },
853
+ rb(a, b) {
854
+ null === b || 10 === b ? (Ea(gb(a.output)), a.output = []) : 0 != b && a.output.push(b);
855
+ },
856
+ fsync(a) {
857
+ 0 < a.output?.length && (Ea(gb(a.output)), a.output = []);
858
+ },
859
+ dc() {
860
+ return {
861
+ Yb: 25856,
862
+ $b: 5,
863
+ Xb: 191,
864
+ Zb: 35387,
865
+ Wb: [
866
+ 3,
867
+ 28,
868
+ 127,
869
+ 21,
870
+ 4,
871
+ 0,
872
+ 1,
873
+ 0,
874
+ 17,
875
+ 19,
876
+ 26,
877
+ 0,
878
+ 18,
879
+ 15,
880
+ 23,
881
+ 22,
882
+ 0,
883
+ 0,
884
+ 0,
885
+ 0,
886
+ 0,
887
+ 0,
888
+ 0,
889
+ 0,
890
+ 0,
891
+ 0,
892
+ 0,
893
+ 0,
894
+ 0,
895
+ 0,
896
+ 0,
897
+ 0
898
+ ]
899
+ };
900
+ },
901
+ ec() {
902
+ return 0;
903
+ },
904
+ fc() {
905
+ return [24, 80];
906
+ }
907
+ }, wb = {
908
+ rb(a, b) {
909
+ null === b || 10 === b ? (B(gb(a.output)), a.output = []) : 0 != b && a.output.push(b);
910
+ },
911
+ fsync(a) {
912
+ 0 < a.output?.length && (B(gb(a.output)), a.output = []);
913
+ }
914
+ }, O = {
915
+ Ta: null,
916
+ Ua() {
917
+ return O.createNode(null, "/", 16895, 0);
918
+ },
919
+ createNode(a, b, c, d) {
920
+ if (24576 === (c & 61440) || 4096 === (c & 61440)) throw new N(63);
921
+ O.Ta || (O.Ta = {
922
+ dir: {
923
+ node: {
924
+ Qa: O.Ia.Qa,
925
+ Ra: O.Ia.Ra,
926
+ lookup: O.Ia.lookup,
927
+ fb: O.Ia.fb,
928
+ rename: O.Ia.rename,
929
+ unlink: O.Ia.unlink,
930
+ rmdir: O.Ia.rmdir,
931
+ readdir: O.Ia.readdir,
932
+ symlink: O.Ia.symlink
933
+ },
934
+ stream: { Sa: O.Ja.Sa }
935
+ },
936
+ file: {
937
+ node: {
938
+ Qa: O.Ia.Qa,
939
+ Ra: O.Ia.Ra
940
+ },
941
+ stream: {
942
+ Sa: O.Ja.Sa,
943
+ read: O.Ja.read,
944
+ write: O.Ja.write,
945
+ gb: O.Ja.gb,
946
+ hb: O.Ja.hb
947
+ }
948
+ },
949
+ link: {
950
+ node: {
951
+ Qa: O.Ia.Qa,
952
+ Ra: O.Ia.Ra,
953
+ readlink: O.Ia.readlink
954
+ },
955
+ stream: {}
956
+ },
957
+ vb: {
958
+ node: {
959
+ Qa: O.Ia.Qa,
960
+ Ra: O.Ia.Ra
961
+ },
962
+ stream: xb
963
+ }
964
+ });
965
+ c = yb(a, b, c, d);
966
+ P(c.mode) ? (c.Ia = O.Ta.dir.node, c.Ja = O.Ta.dir.stream, c.Ka = {}) : 32768 === (c.mode & 61440) ? (c.Ia = O.Ta.file.node, c.Ja = O.Ta.file.stream, c.Oa = 0, c.Ka = null) : 40960 === (c.mode & 61440) ? (c.Ia = O.Ta.link.node, c.Ja = O.Ta.link.stream) : 8192 === (c.mode & 61440) && (c.Ia = O.Ta.vb.node, c.Ja = O.Ta.vb.stream);
967
+ c.atime = c.mtime = c.ctime = Date.now();
968
+ a && (a.Ka[b] = c, a.atime = a.mtime = a.ctime = c.atime);
969
+ return c;
970
+ },
971
+ bc(a) {
972
+ return a.Ka ? a.Ka.subarray ? a.Ka.subarray(0, a.Oa) : new Uint8Array(a.Ka) : /* @__PURE__ */ new Uint8Array(0);
973
+ },
974
+ Ia: {
975
+ Qa(a) {
976
+ var b = {};
977
+ b.dev = 8192 === (a.mode & 61440) ? a.id : 1;
978
+ b.ino = a.id;
979
+ b.mode = a.mode;
980
+ b.nlink = 1;
981
+ b.uid = 0;
982
+ b.gid = 0;
983
+ b.rdev = a.rdev;
984
+ P(a.mode) ? b.size = 4096 : 32768 === (a.mode & 61440) ? b.size = a.Oa : 40960 === (a.mode & 61440) ? b.size = a.link.length : b.size = 0;
985
+ b.atime = new Date(a.atime);
986
+ b.mtime = new Date(a.mtime);
987
+ b.ctime = new Date(a.ctime);
988
+ b.blksize = 4096;
989
+ b.blocks = Math.ceil(b.size / b.blksize);
990
+ return b;
991
+ },
992
+ Ra(a, b) {
993
+ for (var c of [
994
+ "mode",
995
+ "atime",
996
+ "mtime",
997
+ "ctime"
998
+ ]) null != b[c] && (a[c] = b[c]);
999
+ void 0 !== b.size && (b = b.size, a.Oa != b && (0 == b ? (a.Ka = null, a.Oa = 0) : (c = a.Ka, a.Ka = new Uint8Array(b), c && a.Ka.set(c.subarray(0, Math.min(b, a.Oa))), a.Oa = b)));
1000
+ },
1001
+ lookup() {
1002
+ O.kb || (O.kb = new N(44), O.kb.stack = "<generic error, no stack>");
1003
+ throw O.kb;
1004
+ },
1005
+ fb(a, b, c, d) {
1006
+ return O.createNode(a, b, c, d);
1007
+ },
1008
+ rename(a, b, c) {
1009
+ try {
1010
+ var d = Q(b, c);
1011
+ } catch (g) {}
1012
+ if (d) {
1013
+ if (P(a.mode)) for (var e in d.Ka) throw new N(55);
1014
+ zb(d);
1015
+ }
1016
+ delete a.parent.Ka[a.name];
1017
+ b.Ka[c] = a;
1018
+ a.name = c;
1019
+ b.ctime = b.mtime = a.parent.ctime = a.parent.mtime = Date.now();
1020
+ },
1021
+ unlink(a, b) {
1022
+ delete a.Ka[b];
1023
+ a.ctime = a.mtime = Date.now();
1024
+ },
1025
+ rmdir(a, b) {
1026
+ var c = Q(a, b), d;
1027
+ for (d in c.Ka) throw new N(55);
1028
+ delete a.Ka[b];
1029
+ a.ctime = a.mtime = Date.now();
1030
+ },
1031
+ readdir(a) {
1032
+ return [
1033
+ ".",
1034
+ "..",
1035
+ ...Object.keys(a.Ka)
1036
+ ];
1037
+ },
1038
+ symlink(a, b, c) {
1039
+ a = O.createNode(a, b, 41471, 0);
1040
+ a.link = c;
1041
+ return a;
1042
+ },
1043
+ readlink(a) {
1044
+ if (40960 !== (a.mode & 61440)) throw new N(28);
1045
+ return a.link;
1046
+ }
1047
+ },
1048
+ Ja: {
1049
+ read(a, b, c, d, e) {
1050
+ var g = a.node.Ka;
1051
+ if (e >= a.node.Oa) return 0;
1052
+ a = Math.min(a.node.Oa - e, d);
1053
+ if (8 < a && g.subarray) b.set(g.subarray(e, e + a), c);
1054
+ else for (d = 0; d < a; d++) b[c + d] = g[e + d];
1055
+ return a;
1056
+ },
1057
+ write(a, b, c, d, e, g) {
1058
+ b.buffer === m.buffer && (g = !1);
1059
+ if (!d) return 0;
1060
+ a = a.node;
1061
+ a.mtime = a.ctime = Date.now();
1062
+ if (b.subarray && (!a.Ka || a.Ka.subarray)) {
1063
+ if (g) return a.Ka = b.subarray(c, c + d), a.Oa = d;
1064
+ if (0 === a.Oa && 0 === e) return a.Ka = b.slice(c, c + d), a.Oa = d;
1065
+ if (e + d <= a.Oa) return a.Ka.set(b.subarray(c, c + d), e), d;
1066
+ }
1067
+ g = e + d;
1068
+ var h = a.Ka ? a.Ka.length : 0;
1069
+ h >= g || (g = Math.max(g, h * (1048576 > h ? 2 : 1.125) >>> 0), 0 != h && (g = Math.max(g, 256)), h = a.Ka, a.Ka = new Uint8Array(g), 0 < a.Oa && a.Ka.set(h.subarray(0, a.Oa), 0));
1070
+ if (a.Ka.subarray && b.subarray) a.Ka.set(b.subarray(c, c + d), e);
1071
+ else for (g = 0; g < d; g++) a.Ka[e + g] = b[c + g];
1072
+ a.Oa = Math.max(a.Oa, e + d);
1073
+ return d;
1074
+ },
1075
+ Sa(a, b, c) {
1076
+ 1 === c ? b += a.position : 2 === c && 32768 === (a.node.mode & 61440) && (b += a.node.Oa);
1077
+ if (0 > b) throw new N(28);
1078
+ return b;
1079
+ },
1080
+ gb(a, b, c, d, e) {
1081
+ if (32768 !== (a.node.mode & 61440)) throw new N(43);
1082
+ a = a.node.Ka;
1083
+ if (e & 2 || !a || a.buffer !== m.buffer) {
1084
+ e = !0;
1085
+ d = 65536 * Math.ceil(b / 65536);
1086
+ var g = Ab(65536, d);
1087
+ g && D.fill(0, g, g + d);
1088
+ d = g;
1089
+ if (!d) throw new N(48);
1090
+ if (a) {
1091
+ if (0 < c || c + b < a.length) a.subarray ? a = a.subarray(c, c + b) : a = Array.prototype.slice.call(a, c, c + b);
1092
+ m.set(a, d);
1093
+ }
1094
+ } else e = !1, d = a.byteOffset;
1095
+ return {
1096
+ Tb: d,
1097
+ Bb: e
1098
+ };
1099
+ },
1100
+ hb(a, b, c, d) {
1101
+ O.Ja.write(a, b, 0, d, c, !1);
1102
+ return 0;
1103
+ }
1104
+ }
1105
+ }, ja = (a, b) => {
1106
+ var c = 0;
1107
+ a && (c |= 365);
1108
+ b && (c |= 146);
1109
+ return c;
1110
+ }, Bb = null, Cb = {}, Db = [], Eb = 1, R = null, Fb = !1, Gb = !0, Hb = {}, N = class {
1111
+ name = "ErrnoError";
1112
+ constructor(a) {
1113
+ this.Ma = a;
1114
+ }
1115
+ }, Ib = class {
1116
+ eb = {};
1117
+ node = null;
1118
+ get flags() {
1119
+ return this.eb.flags;
1120
+ }
1121
+ set flags(a) {
1122
+ this.eb.flags = a;
1123
+ }
1124
+ get position() {
1125
+ return this.eb.position;
1126
+ }
1127
+ set position(a) {
1128
+ this.eb.position = a;
1129
+ }
1130
+ }, Jb = class {
1131
+ Ia = {};
1132
+ Ja = {};
1133
+ Za = null;
1134
+ constructor(a, b, c, d) {
1135
+ a ||= this;
1136
+ this.parent = a;
1137
+ this.Ua = a.Ua;
1138
+ this.id = Eb++;
1139
+ this.name = b;
1140
+ this.mode = c;
1141
+ this.rdev = d;
1142
+ this.atime = this.mtime = this.ctime = Date.now();
1143
+ }
1144
+ get read() {
1145
+ return 365 === (this.mode & 365);
1146
+ }
1147
+ set read(a) {
1148
+ a ? this.mode |= 365 : this.mode &= -366;
1149
+ }
1150
+ get write() {
1151
+ return 146 === (this.mode & 146);
1152
+ }
1153
+ set write(a) {
1154
+ a ? this.mode |= 146 : this.mode &= -147;
1155
+ }
1156
+ };
1157
+ function S(a, b = {}) {
1158
+ if (!a) throw new N(44);
1159
+ b.mb ?? (b.mb = !0);
1160
+ "/" === a.charAt(0) || (a = "//" + a);
1161
+ var c = 0;
1162
+ a: for (; 40 > c; c++) {
1163
+ a = a.split("/").filter((q) => !!q);
1164
+ for (var d = Bb, e = "/", g = 0; g < a.length; g++) {
1165
+ var h = g === a.length - 1;
1166
+ if (h && b.parent) break;
1167
+ if ("." !== a[g]) if (".." === a[g]) if (e = $a(e), d === d.parent) {
1168
+ a = e + "/" + a.slice(g + 1).join("/");
1169
+ c--;
1170
+ continue a;
1171
+ } else d = d.parent;
1172
+ else {
1173
+ e = ia(e + "/" + a[g]);
1174
+ try {
1175
+ d = Q(d, a[g]);
1176
+ } catch (q) {
1177
+ if (44 === q?.Ma && h && b.Sb) return { path: e };
1178
+ throw q;
1179
+ }
1180
+ !d.Za || h && !b.mb || (d = d.Za.root);
1181
+ if (40960 === (d.mode & 61440) && (!h || b.Ya)) {
1182
+ if (!d.Ia.readlink) throw new N(52);
1183
+ d = d.Ia.readlink(d);
1184
+ "/" === d.charAt(0) || (d = $a(e) + "/" + d);
1185
+ a = d + "/" + a.slice(g + 1).join("/");
1186
+ continue a;
1187
+ }
1188
+ }
1189
+ }
1190
+ return {
1191
+ path: e,
1192
+ node: d
1193
+ };
1194
+ }
1195
+ throw new N(32);
1196
+ }
1197
+ function ha(a) {
1198
+ for (var b;;) {
1199
+ if (a === a.parent) return a = a.Ua.Ab, b ? "/" !== a[a.length - 1] ? `${a}/${b}` : a + b : a;
1200
+ b = b ? `${a.name}/${b}` : a.name;
1201
+ a = a.parent;
1202
+ }
1203
+ }
1204
+ function Kb(a, b) {
1205
+ for (var c = 0, d = 0; d < b.length; d++) c = (c << 5) - c + b.charCodeAt(d) | 0;
1206
+ return (a + c >>> 0) % R.length;
1207
+ }
1208
+ function zb(a) {
1209
+ var b = Kb(a.parent.id, a.name);
1210
+ if (R[b] === a) R[b] = a.$a;
1211
+ else for (b = R[b]; b;) {
1212
+ if (b.$a === a) {
1213
+ b.$a = a.$a;
1214
+ break;
1215
+ }
1216
+ b = b.$a;
1217
+ }
1218
+ }
1219
+ function Q(a, b) {
1220
+ var c = P(a.mode) ? (c = Lb(a, "x")) ? c : a.Ia.lookup ? 0 : 2 : 54;
1221
+ if (c) throw new N(c);
1222
+ for (c = R[Kb(a.id, b)]; c; c = c.$a) {
1223
+ var d = c.name;
1224
+ if (c.parent.id === a.id && d === b) return c;
1225
+ }
1226
+ return a.Ia.lookup(a, b);
1227
+ }
1228
+ function yb(a, b, c, d) {
1229
+ a = new Jb(a, b, c, d);
1230
+ b = Kb(a.parent.id, a.name);
1231
+ a.$a = R[b];
1232
+ return R[b] = a;
1233
+ }
1234
+ function P(a) {
1235
+ return 16384 === (a & 61440);
1236
+ }
1237
+ function Mb(a) {
1238
+ var b = [
1239
+ "r",
1240
+ "w",
1241
+ "rw"
1242
+ ][a & 3];
1243
+ a & 512 && (b += "w");
1244
+ return b;
1245
+ }
1246
+ function Lb(a, b) {
1247
+ if (Gb) return 0;
1248
+ if (!b.includes("r") || a.mode & 292) {
1249
+ if (b.includes("w") && !(a.mode & 146) || b.includes("x") && !(a.mode & 73)) return 2;
1250
+ } else return 2;
1251
+ return 0;
1252
+ }
1253
+ function Nb(a, b) {
1254
+ if (!P(a.mode)) return 54;
1255
+ try {
1256
+ return Q(a, b), 20;
1257
+ } catch (c) {}
1258
+ return Lb(a, "wx");
1259
+ }
1260
+ function Ob(a, b, c) {
1261
+ try {
1262
+ var d = Q(a, b);
1263
+ } catch (e) {
1264
+ return e.Ma;
1265
+ }
1266
+ if (a = Lb(a, "wx")) return a;
1267
+ if (c) {
1268
+ if (!P(d.mode)) return 54;
1269
+ if (d === d.parent || "/" === ha(d)) return 10;
1270
+ } else if (P(d.mode)) return 31;
1271
+ return 0;
1272
+ }
1273
+ function Pb(a) {
1274
+ if (!a) throw new N(63);
1275
+ return a;
1276
+ }
1277
+ function T(a) {
1278
+ a = Db[a];
1279
+ if (!a) throw new N(8);
1280
+ return a;
1281
+ }
1282
+ function Qb(a, b = -1) {
1283
+ a = Object.assign(new Ib(), a);
1284
+ if (-1 == b) a: {
1285
+ for (b = 0; 4096 >= b; b++) if (!Db[b]) break a;
1286
+ throw new N(33);
1287
+ }
1288
+ a.fd = b;
1289
+ return Db[b] = a;
1290
+ }
1291
+ function Rb(a, b = -1) {
1292
+ a = Qb(a, b);
1293
+ a.Ja?.ac?.(a);
1294
+ return a;
1295
+ }
1296
+ function Sb(a, b, c) {
1297
+ var d = a?.Ja.Ra;
1298
+ a = d ? a : b;
1299
+ d ??= b.Ia.Ra;
1300
+ Pb(d);
1301
+ d(a, c);
1302
+ }
1303
+ var xb = {
1304
+ open(a) {
1305
+ a.Ja = Cb[a.node.rdev].Ja;
1306
+ a.Ja.open?.(a);
1307
+ },
1308
+ Sa() {
1309
+ throw new N(70);
1310
+ }
1311
+ };
1312
+ function mb(a, b) {
1313
+ Cb[a] = { Ja: b };
1314
+ }
1315
+ function Tb(a, b) {
1316
+ var c = "/" === b;
1317
+ if (c && Bb) throw new N(10);
1318
+ if (!c && b) {
1319
+ var d = S(b, { mb: !1 });
1320
+ b = d.path;
1321
+ d = d.node;
1322
+ if (d.Za) throw new N(10);
1323
+ if (!P(d.mode)) throw new N(54);
1324
+ }
1325
+ b = {
1326
+ type: a,
1327
+ hc: {},
1328
+ Ab: b,
1329
+ Rb: []
1330
+ };
1331
+ a = a.Ua(b);
1332
+ a.Ua = b;
1333
+ b.root = a;
1334
+ c ? Bb = a : d && (d.Za = b, d.Ua && d.Ua.Rb.push(b));
1335
+ }
1336
+ function Ub(a, b, c) {
1337
+ var d = S(a, { parent: !0 }).node;
1338
+ a = ab(a);
1339
+ if (!a) throw new N(28);
1340
+ if ("." === a || ".." === a) throw new N(20);
1341
+ var e = Nb(d, a);
1342
+ if (e) throw new N(e);
1343
+ if (!d.Ia.fb) throw new N(63);
1344
+ return d.Ia.fb(d, a, b, c);
1345
+ }
1346
+ function la(a, b = 438) {
1347
+ return Ub(a, b & 4095 | 32768, 0);
1348
+ }
1349
+ function U(a, b = 511) {
1350
+ return Ub(a, b & 1023 | 16384, 0);
1351
+ }
1352
+ function Vb(a, b, c) {
1353
+ "undefined" == typeof c && (c = b, b = 438);
1354
+ Ub(a, b | 8192, c);
1355
+ }
1356
+ function Wb(a, b) {
1357
+ if (!db(a)) throw new N(44);
1358
+ var c = S(b, { parent: !0 }).node;
1359
+ if (!c) throw new N(44);
1360
+ b = ab(b);
1361
+ var d = Nb(c, b);
1362
+ if (d) throw new N(d);
1363
+ if (!c.Ia.symlink) throw new N(63);
1364
+ c.Ia.symlink(c, b, a);
1365
+ }
1366
+ function Xb(a) {
1367
+ var b = S(a, { parent: !0 }).node;
1368
+ a = ab(a);
1369
+ var c = Q(b, a), d = Ob(b, a, !0);
1370
+ if (d) throw new N(d);
1371
+ if (!b.Ia.rmdir) throw new N(63);
1372
+ if (c.Za) throw new N(10);
1373
+ b.Ia.rmdir(b, a);
1374
+ zb(c);
1375
+ }
1376
+ function ua(a) {
1377
+ var b = S(a, { parent: !0 }).node;
1378
+ if (!b) throw new N(44);
1379
+ a = ab(a);
1380
+ var c = Q(b, a), d = Ob(b, a, !1);
1381
+ if (d) throw new N(d);
1382
+ if (!b.Ia.unlink) throw new N(63);
1383
+ if (c.Za) throw new N(10);
1384
+ b.Ia.unlink(b, a);
1385
+ zb(c);
1386
+ }
1387
+ function Yb(a, b) {
1388
+ a = S(a, { Ya: !b }).node;
1389
+ return Pb(a.Ia.Qa)(a);
1390
+ }
1391
+ function Zb(a, b, c, d) {
1392
+ Sb(a, b, {
1393
+ mode: c & 4095 | b.mode & -4096,
1394
+ ctime: Date.now(),
1395
+ Ib: d
1396
+ });
1397
+ }
1398
+ function ma(a, b) {
1399
+ a = "string" == typeof a ? S(a, { Ya: !0 }).node : a;
1400
+ Zb(null, a, b);
1401
+ }
1402
+ function $b(a, b, c) {
1403
+ if (P(b.mode)) throw new N(31);
1404
+ if (32768 !== (b.mode & 61440)) throw new N(28);
1405
+ var d = Lb(b, "w");
1406
+ if (d) throw new N(d);
1407
+ Sb(a, b, {
1408
+ size: c,
1409
+ timestamp: Date.now()
1410
+ });
1411
+ }
1412
+ function na(a, b, c = 438) {
1413
+ if ("" === a) throw new N(44);
1414
+ if ("string" == typeof b) {
1415
+ var d = {
1416
+ r: 0,
1417
+ "r+": 2,
1418
+ w: 577,
1419
+ "w+": 578,
1420
+ a: 1089,
1421
+ "a+": 1090
1422
+ }[b];
1423
+ if ("undefined" == typeof d) throw Error(`Unknown file open mode: ${b}`);
1424
+ b = d;
1425
+ }
1426
+ c = b & 64 ? c & 4095 | 32768 : 0;
1427
+ if ("object" == typeof a) d = a;
1428
+ else {
1429
+ var e = a.endsWith("/");
1430
+ a = S(a, {
1431
+ Ya: !(b & 131072),
1432
+ Sb: !0
1433
+ });
1434
+ d = a.node;
1435
+ a = a.path;
1436
+ }
1437
+ var g = !1;
1438
+ if (b & 64) if (d) {
1439
+ if (b & 128) throw new N(20);
1440
+ } else {
1441
+ if (e) throw new N(31);
1442
+ d = Ub(a, c | 511, 0);
1443
+ g = !0;
1444
+ }
1445
+ if (!d) throw new N(44);
1446
+ 8192 === (d.mode & 61440) && (b &= -513);
1447
+ if (b & 65536 && !P(d.mode)) throw new N(54);
1448
+ if (!g && (e = d ? 40960 === (d.mode & 61440) ? 32 : P(d.mode) && ("r" !== Mb(b) || b & 576) ? 31 : Lb(d, Mb(b)) : 44)) throw new N(e);
1449
+ b & 512 && !g && (e = d, e = "string" == typeof e ? S(e, { Ya: !0 }).node : e, $b(null, e, 0));
1450
+ b &= -131713;
1451
+ e = Qb({
1452
+ node: d,
1453
+ path: ha(d),
1454
+ flags: b,
1455
+ seekable: !0,
1456
+ position: 0,
1457
+ Ja: d.Ja,
1458
+ Ub: [],
1459
+ error: !1
1460
+ });
1461
+ e.Ja.open && e.Ja.open(e);
1462
+ g && ma(d, c & 511);
1463
+ !k.logReadFiles || b & 1 || a in Hb || (Hb[a] = 1);
1464
+ return e;
1465
+ }
1466
+ function pa(a) {
1467
+ if (null === a.fd) throw new N(8);
1468
+ a.ob && (a.ob = null);
1469
+ try {
1470
+ a.Ja.close && a.Ja.close(a);
1471
+ } catch (b) {
1472
+ throw b;
1473
+ } finally {
1474
+ Db[a.fd] = null;
1475
+ }
1476
+ a.fd = null;
1477
+ }
1478
+ function ac(a, b, c) {
1479
+ if (null === a.fd) throw new N(8);
1480
+ if (!a.seekable || !a.Ja.Sa) throw new N(70);
1481
+ if (0 != c && 1 != c && 2 != c) throw new N(28);
1482
+ a.position = a.Ja.Sa(a, b, c);
1483
+ a.Ub = [];
1484
+ }
1485
+ function bc(a, b, c, d, e) {
1486
+ if (0 > d || 0 > e) throw new N(28);
1487
+ if (null === a.fd) throw new N(8);
1488
+ if (1 === (a.flags & 2097155)) throw new N(8);
1489
+ if (P(a.node.mode)) throw new N(31);
1490
+ if (!a.Ja.read) throw new N(28);
1491
+ var g = "undefined" != typeof e;
1492
+ if (!g) e = a.position;
1493
+ else if (!a.seekable) throw new N(70);
1494
+ b = a.Ja.read(a, b, c, d, e);
1495
+ g || (a.position += b);
1496
+ return b;
1497
+ }
1498
+ function oa(a, b, c, d, e) {
1499
+ if (0 > d || 0 > e) throw new N(28);
1500
+ if (null === a.fd) throw new N(8);
1501
+ if (0 === (a.flags & 2097155)) throw new N(8);
1502
+ if (P(a.node.mode)) throw new N(31);
1503
+ if (!a.Ja.write) throw new N(28);
1504
+ a.seekable && a.flags & 1024 && ac(a, 0, 2);
1505
+ var g = "undefined" != typeof e;
1506
+ if (!g) e = a.position;
1507
+ else if (!a.seekable) throw new N(70);
1508
+ b = a.Ja.write(a, b, c, d, e, void 0);
1509
+ g || (a.position += b);
1510
+ return b;
1511
+ }
1512
+ function ta(a) {
1513
+ var b = b || 0;
1514
+ var c = "binary";
1515
+ "utf8" !== c && "binary" !== c && Na(`Invalid encoding type "${c}"`);
1516
+ b = na(a, b);
1517
+ a = Yb(a).size;
1518
+ var d = new Uint8Array(a);
1519
+ bc(b, d, 0, a, 0);
1520
+ "utf8" === c && (d = gb(d));
1521
+ pa(b);
1522
+ return d;
1523
+ }
1524
+ function W(a, b, c) {
1525
+ a = ia("/dev/" + a);
1526
+ var d = ja(!!b, !!c);
1527
+ W.zb ?? (W.zb = 64);
1528
+ var e = W.zb++ << 8 | 0;
1529
+ mb(e, {
1530
+ open(g) {
1531
+ g.seekable = !1;
1532
+ },
1533
+ close() {
1534
+ c?.buffer?.length && c(10);
1535
+ },
1536
+ read(g, h, q, v) {
1537
+ for (var u = 0, x = 0; x < v; x++) {
1538
+ try {
1539
+ var C = b();
1540
+ } catch (ob) {
1541
+ throw new N(29);
1542
+ }
1543
+ if (void 0 === C && 0 === u) throw new N(6);
1544
+ if (null === C || void 0 === C) break;
1545
+ u++;
1546
+ h[q + x] = C;
1547
+ }
1548
+ u && (g.node.atime = Date.now());
1549
+ return u;
1550
+ },
1551
+ write(g, h, q, v) {
1552
+ for (var u = 0; u < v; u++) try {
1553
+ c(h[q + u]);
1554
+ } catch (x) {
1555
+ throw new N(29);
1556
+ }
1557
+ v && (g.node.mtime = g.node.ctime = Date.now());
1558
+ return u;
1559
+ }
1560
+ });
1561
+ Vb(a, d, e);
1562
+ }
1563
+ var X = {}, z = (a, b, c) => a ? eb.decode(D.subarray(a, fb(D, a, b, c))) : "";
1564
+ function Y(a, b, c) {
1565
+ if ("/" === b.charAt(0)) return b;
1566
+ a = -100 === a ? "/" : T(a).path;
1567
+ if (0 == b.length) {
1568
+ if (!c) throw new N(44);
1569
+ return a;
1570
+ }
1571
+ return a + "/" + b;
1572
+ }
1573
+ function lc(a, b) {
1574
+ F[a >> 2] = b.dev;
1575
+ F[a + 4 >> 2] = b.mode;
1576
+ F[a + 8 >> 2] = b.nlink;
1577
+ F[a + 12 >> 2] = b.uid;
1578
+ F[a + 16 >> 2] = b.gid;
1579
+ F[a + 20 >> 2] = b.rdev;
1580
+ H[a + 24 >> 3] = BigInt(b.size);
1581
+ E[a + 32 >> 2] = 4096;
1582
+ E[a + 36 >> 2] = b.blocks;
1583
+ var c = b.atime.getTime(), d = b.mtime.getTime(), e = b.ctime.getTime();
1584
+ H[a + 40 >> 3] = BigInt(Math.floor(c / 1e3));
1585
+ F[a + 48 >> 2] = c % 1e3 * 1e6;
1586
+ H[a + 56 >> 3] = BigInt(Math.floor(d / 1e3));
1587
+ F[a + 64 >> 2] = d % 1e3 * 1e6;
1588
+ H[a + 72 >> 3] = BigInt(Math.floor(e / 1e3));
1589
+ F[a + 80 >> 2] = e % 1e3 * 1e6;
1590
+ H[a + 88 >> 3] = BigInt(b.ino);
1591
+ return 0;
1592
+ }
1593
+ var Cc = void 0, Ec = () => {
1594
+ var a = E[+Cc >> 2];
1595
+ Cc += 4;
1596
+ return a;
1597
+ }, Fc = 0, Gc = [
1598
+ 0,
1599
+ 31,
1600
+ 60,
1601
+ 91,
1602
+ 121,
1603
+ 152,
1604
+ 182,
1605
+ 213,
1606
+ 244,
1607
+ 274,
1608
+ 305,
1609
+ 335
1610
+ ], Hc = [
1611
+ 0,
1612
+ 31,
1613
+ 59,
1614
+ 90,
1615
+ 120,
1616
+ 151,
1617
+ 181,
1618
+ 212,
1619
+ 243,
1620
+ 273,
1621
+ 304,
1622
+ 334
1623
+ ], Ic = {}, Jc = (a) => {
1624
+ Ha = a;
1625
+ Ya || 0 < Fc || (k.onExit?.(a), Ga = !0);
1626
+ ya(a, new Sa(a));
1627
+ }, Kc = (a) => {
1628
+ if (!Ga) try {
1629
+ a();
1630
+ } catch (b) {
1631
+ b instanceof Sa || "unwind" == b || ya(1, b);
1632
+ } finally {
1633
+ if (!(Ya || 0 < Fc)) try {
1634
+ Ha = a = Ha, Jc(a);
1635
+ } catch (b) {
1636
+ b instanceof Sa || "unwind" == b || ya(1, b);
1637
+ }
1638
+ }
1639
+ }, Lc = {}, Nc = () => {
1640
+ if (!Mc) {
1641
+ var a = {
1642
+ USER: "web_user",
1643
+ LOGNAME: "web_user",
1644
+ PATH: "/",
1645
+ PWD: "/",
1646
+ HOME: "/home/web_user",
1647
+ LANG: (globalThis.navigator?.language ?? "C").replace("-", "_") + ".UTF-8",
1648
+ _: xa || "./this.program"
1649
+ }, b;
1650
+ for (b in Lc) void 0 === Lc[b] ? delete a[b] : a[b] = Lc[b];
1651
+ var c = [];
1652
+ for (b in a) c.push(`${b}=${a[b]}`);
1653
+ Mc = c;
1654
+ }
1655
+ return Mc;
1656
+ }, Mc, Oc = (a, b, c, d) => {
1657
+ var e = {
1658
+ string: (u) => {
1659
+ var x = 0;
1660
+ if (null !== u && void 0 !== u && 0 !== u) {
1661
+ x = ib(u) + 1;
1662
+ var C = y(x);
1663
+ M(u, D, C, x);
1664
+ x = C;
1665
+ }
1666
+ return x;
1667
+ },
1668
+ array: (u) => {
1669
+ var x = y(u.length);
1670
+ m.set(u, x);
1671
+ return x;
1672
+ }
1673
+ };
1674
+ a = k["_" + a];
1675
+ var g = [], h = 0;
1676
+ if (d) for (var q = 0; q < d.length; q++) {
1677
+ var v = e[c[q]];
1678
+ v ? (0 === h && (h = qa()), g[q] = v(d[q])) : g[q] = d[q];
1679
+ }
1680
+ c = a(...g);
1681
+ return c = function(u) {
1682
+ 0 !== h && sa(h);
1683
+ return "string" === b ? z(u) : "boolean" === b ? !!u : u;
1684
+ }(c);
1685
+ }, fa = (a) => {
1686
+ var b = ib(a) + 1, c = da(b);
1687
+ c && M(a, D, c, b);
1688
+ return c;
1689
+ }, Pc, Qc = [], A = (a) => {
1690
+ Pc.delete(Z.get(a));
1691
+ Z.set(a, null);
1692
+ Qc.push(a);
1693
+ }, Rc = (a) => {
1694
+ const b = a.length;
1695
+ return [
1696
+ b % 128 | 128,
1697
+ b >> 7,
1698
+ ...a
1699
+ ];
1700
+ }, Sc = {
1701
+ i: 127,
1702
+ p: 127,
1703
+ j: 126,
1704
+ f: 125,
1705
+ d: 124,
1706
+ e: 111
1707
+ }, Tc = (a) => Rc(Array.from(a, (b) => Sc[b])), wa = (a, b) => {
1708
+ if (!Pc) {
1709
+ Pc = /* @__PURE__ */ new WeakMap();
1710
+ var c = Z.length;
1711
+ if (Pc) for (var d = 0; d < 0 + c; d++) {
1712
+ var e = Z.get(d);
1713
+ e && Pc.set(e, d);
1714
+ }
1715
+ }
1716
+ if (c = Pc.get(a) || 0) return c;
1717
+ c = Qc.length ? Qc.pop() : Z.grow(1);
1718
+ try {
1719
+ Z.set(c, a);
1720
+ } catch (g) {
1721
+ if (!(g instanceof TypeError)) throw g;
1722
+ b = Uint8Array.of(0, 97, 115, 109, 1, 0, 0, 0, 1, ...Rc([
1723
+ 1,
1724
+ 96,
1725
+ ...Tc(b.slice(1)),
1726
+ ...Tc("v" === b[0] ? "" : b[0])
1727
+ ]), 2, 7, 1, 1, 101, 1, 102, 0, 0, 7, 5, 1, 1, 102, 0, 0);
1728
+ b = new WebAssembly.Module(b);
1729
+ b = new WebAssembly.Instance(b, { e: { f: a } }).exports.f;
1730
+ Z.set(c, b);
1731
+ }
1732
+ Pc.set(a, c);
1733
+ return c;
1734
+ };
1735
+ R = Array(4096);
1736
+ Tb(O, "/");
1737
+ U("/tmp");
1738
+ U("/home");
1739
+ U("/home/web_user");
1740
+ (function() {
1741
+ U("/dev");
1742
+ mb(259, {
1743
+ read: () => 0,
1744
+ write: (d, e, g, h) => h,
1745
+ Sa: () => 0
1746
+ });
1747
+ Vb("/dev/null", 259);
1748
+ kb(1280, vb);
1749
+ kb(1536, wb);
1750
+ Vb("/dev/tty", 1280);
1751
+ Vb("/dev/tty1", 1536);
1752
+ var a = /* @__PURE__ */ new Uint8Array(1024), b = 0, c = () => {
1753
+ 0 === b && (cb(a), b = a.byteLength);
1754
+ return a[--b];
1755
+ };
1756
+ W("random", c);
1757
+ W("urandom", c);
1758
+ U("/dev/shm");
1759
+ U("/dev/shm/tmp");
1760
+ })();
1761
+ (function() {
1762
+ U("/proc");
1763
+ var a = U("/proc/self");
1764
+ U("/proc/self/fd");
1765
+ Tb({ Ua() {
1766
+ var b = yb(a, "fd", 16895, 73);
1767
+ b.Ja = { Sa: O.Ja.Sa };
1768
+ b.Ia = {
1769
+ lookup(c, d) {
1770
+ c = +d;
1771
+ var e = T(c);
1772
+ c = {
1773
+ parent: null,
1774
+ Ua: { Ab: "fake" },
1775
+ Ia: { readlink: () => e.path },
1776
+ id: c + 1
1777
+ };
1778
+ return c.parent = c;
1779
+ },
1780
+ readdir() {
1781
+ return Array.from(Db.entries()).filter(([, c]) => c).map(([c]) => c.toString());
1782
+ }
1783
+ };
1784
+ return b;
1785
+ } }, "/proc/self/fd");
1786
+ })();
1787
+ k.noExitRuntime && (Ya = k.noExitRuntime);
1788
+ k.print && (Ea = k.print);
1789
+ k.printErr && (B = k.printErr);
1790
+ k.wasmBinary && (Fa = k.wasmBinary);
1791
+ k.thisProgram && (xa = k.thisProgram);
1792
+ if (k.preInit) for ("function" == typeof k.preInit && (k.preInit = [k.preInit]); 0 < k.preInit.length;) k.preInit.shift()();
1793
+ k.stackSave = () => qa();
1794
+ k.stackRestore = (a) => sa(a);
1795
+ k.stackAlloc = (a) => y(a);
1796
+ k.cwrap = (a, b, c, d) => {
1797
+ var e = !c || c.every((g) => "number" === g || "boolean" === g);
1798
+ return "string" !== b && e && !d ? k["_" + a] : (...g) => Oc(a, b, c, g);
1799
+ };
1800
+ k.addFunction = wa;
1801
+ k.removeFunction = A;
1802
+ k.UTF8ToString = z;
1803
+ k.stringToNewUTF8 = fa;
1804
+ k.writeArrayToMemory = (a, b) => {
1805
+ m.set(a, b);
1806
+ };
1807
+ var da, ea, Ab, Uc, sa, y, qa, Ma, Z, Vc = {
1808
+ i: function(a, b) {
1809
+ try {
1810
+ return a = z(a), ma(a, b), 0;
1811
+ } catch (c) {
1812
+ if ("undefined" == typeof X || "ErrnoError" !== c.name) throw c;
1813
+ return -c.Ma;
1814
+ }
1815
+ },
1816
+ K: function(a, b, c) {
1817
+ try {
1818
+ b = z(b);
1819
+ b = Y(a, b);
1820
+ if (c & -8) return -28;
1821
+ var d = S(b, { Ya: !0 }).node;
1822
+ if (!d) return -44;
1823
+ a = "";
1824
+ c & 4 && (a += "r");
1825
+ c & 2 && (a += "w");
1826
+ c & 1 && (a += "x");
1827
+ return a && Lb(d, a) ? -2 : 0;
1828
+ } catch (e) {
1829
+ if ("undefined" == typeof X || "ErrnoError" !== e.name) throw e;
1830
+ return -e.Ma;
1831
+ }
1832
+ },
1833
+ q: function(a, b) {
1834
+ try {
1835
+ var c = T(a);
1836
+ Zb(c, c.node, b, !1);
1837
+ return 0;
1838
+ } catch (d) {
1839
+ if ("undefined" == typeof X || "ErrnoError" !== d.name) throw d;
1840
+ return -d.Ma;
1841
+ }
1842
+ },
1843
+ h: function(a) {
1844
+ try {
1845
+ var b = T(a);
1846
+ Sb(b, b.node, {
1847
+ timestamp: Date.now(),
1848
+ Ib: !1
1849
+ });
1850
+ return 0;
1851
+ } catch (c) {
1852
+ if ("undefined" == typeof X || "ErrnoError" !== c.name) throw c;
1853
+ return -c.Ma;
1854
+ }
1855
+ },
1856
+ a: function(a, b, c) {
1857
+ Cc = c;
1858
+ try {
1859
+ var d = T(a);
1860
+ switch (b) {
1861
+ case 0:
1862
+ var e = Ec();
1863
+ if (0 > e) break;
1864
+ for (; Db[e];) e++;
1865
+ return Rb(d, e).fd;
1866
+ case 1:
1867
+ case 2: return 0;
1868
+ case 3: return d.flags;
1869
+ case 4: return e = Ec(), d.flags |= e, 0;
1870
+ case 12: return e = Ec(), Ia[e + 0 >> 1] = 2, 0;
1871
+ case 13:
1872
+ case 14: return 0;
1873
+ }
1874
+ return -28;
1875
+ } catch (g) {
1876
+ if ("undefined" == typeof X || "ErrnoError" !== g.name) throw g;
1877
+ return -g.Ma;
1878
+ }
1879
+ },
1880
+ g: function(a, b) {
1881
+ try {
1882
+ var c = T(a), d = c.node, e = c.Ja.Qa;
1883
+ a = e ? c : d;
1884
+ e ??= d.Ia.Qa;
1885
+ Pb(e);
1886
+ return lc(b, e(a));
1887
+ } catch (h) {
1888
+ if ("undefined" == typeof X || "ErrnoError" !== h.name) throw h;
1889
+ return -h.Ma;
1890
+ }
1891
+ },
1892
+ H: function(a, b) {
1893
+ b = -9007199254740992 > b || 9007199254740992 < b ? NaN : Number(b);
1894
+ try {
1895
+ if (isNaN(b)) return -61;
1896
+ var c = T(a);
1897
+ if (0 > b || 0 === (c.flags & 2097155)) throw new N(28);
1898
+ $b(c, c.node, b);
1899
+ return 0;
1900
+ } catch (d) {
1901
+ if ("undefined" == typeof X || "ErrnoError" !== d.name) throw d;
1902
+ return -d.Ma;
1903
+ }
1904
+ },
1905
+ G: function(a, b) {
1906
+ try {
1907
+ if (0 === b) return -28;
1908
+ var c = ib("/") + 1;
1909
+ if (b < c) return -68;
1910
+ M("/", D, a, b);
1911
+ return c;
1912
+ } catch (d) {
1913
+ if ("undefined" == typeof X || "ErrnoError" !== d.name) throw d;
1914
+ return -d.Ma;
1915
+ }
1916
+ },
1917
+ e: function(a, b) {
1918
+ try {
1919
+ return a = z(a), lc(b, Yb(a, !0));
1920
+ } catch (c) {
1921
+ if ("undefined" == typeof X || "ErrnoError" !== c.name) throw c;
1922
+ return -c.Ma;
1923
+ }
1924
+ },
1925
+ C: function(a, b, c) {
1926
+ try {
1927
+ return b = z(b), b = Y(a, b), U(b, c), 0;
1928
+ } catch (d) {
1929
+ if ("undefined" == typeof X || "ErrnoError" !== d.name) throw d;
1930
+ return -d.Ma;
1931
+ }
1932
+ },
1933
+ J: function(a, b, c, d) {
1934
+ try {
1935
+ b = z(b);
1936
+ var e = d & 256;
1937
+ b = Y(a, b, d & 4096);
1938
+ return lc(c, e ? Yb(b, !0) : Yb(b));
1939
+ } catch (g) {
1940
+ if ("undefined" == typeof X || "ErrnoError" !== g.name) throw g;
1941
+ return -g.Ma;
1942
+ }
1943
+ },
1944
+ x: function(a, b, c, d) {
1945
+ Cc = d;
1946
+ try {
1947
+ b = z(b);
1948
+ b = Y(a, b);
1949
+ var e = d ? Ec() : 0;
1950
+ return na(b, c, e).fd;
1951
+ } catch (g) {
1952
+ if ("undefined" == typeof X || "ErrnoError" !== g.name) throw g;
1953
+ return -g.Ma;
1954
+ }
1955
+ },
1956
+ v: function(a, b, c, d) {
1957
+ try {
1958
+ b = z(b);
1959
+ b = Y(a, b);
1960
+ if (0 >= d) return -28;
1961
+ var e = S(b).node;
1962
+ if (!e) throw new N(44);
1963
+ if (!e.Ia.readlink) throw new N(28);
1964
+ var g = e.Ia.readlink(e);
1965
+ var h = Math.min(d, ib(g)), q = m[c + h];
1966
+ M(g, D, c, d + 1);
1967
+ m[c + h] = q;
1968
+ return h;
1969
+ } catch (v) {
1970
+ if ("undefined" == typeof X || "ErrnoError" !== v.name) throw v;
1971
+ return -v.Ma;
1972
+ }
1973
+ },
1974
+ u: function(a) {
1975
+ try {
1976
+ return a = z(a), Xb(a), 0;
1977
+ } catch (b) {
1978
+ if ("undefined" == typeof X || "ErrnoError" !== b.name) throw b;
1979
+ return -b.Ma;
1980
+ }
1981
+ },
1982
+ f: function(a, b) {
1983
+ try {
1984
+ return a = z(a), lc(b, Yb(a));
1985
+ } catch (c) {
1986
+ if ("undefined" == typeof X || "ErrnoError" !== c.name) throw c;
1987
+ return -c.Ma;
1988
+ }
1989
+ },
1990
+ s: function(a, b, c) {
1991
+ try {
1992
+ b = z(b);
1993
+ b = Y(a, b);
1994
+ if (c) if (512 === c) Xb(b);
1995
+ else return -28;
1996
+ else ua(b);
1997
+ return 0;
1998
+ } catch (d) {
1999
+ if ("undefined" == typeof X || "ErrnoError" !== d.name) throw d;
2000
+ return -d.Ma;
2001
+ }
2002
+ },
2003
+ r: function(a, b, c) {
2004
+ try {
2005
+ b = z(b);
2006
+ b = Y(a, b, !0);
2007
+ var d = Date.now(), e, g;
2008
+ if (c) {
2009
+ var h = F[c >> 2] + 4294967296 * E[c + 4 >> 2], q = E[c + 8 >> 2];
2010
+ 1073741823 == q ? e = d : 1073741822 == q ? e = null : e = 1e3 * h + q / 1e6;
2011
+ c += 16;
2012
+ h = F[c >> 2] + 4294967296 * E[c + 4 >> 2];
2013
+ q = E[c + 8 >> 2];
2014
+ 1073741823 == q ? g = d : 1073741822 == q ? g = null : g = 1e3 * h + q / 1e6;
2015
+ } else g = e = d;
2016
+ if (null !== (g ?? e)) {
2017
+ a = e;
2018
+ var v = S(b, { Ya: !0 }).node;
2019
+ Pb(v.Ia.Ra)(v, {
2020
+ atime: a,
2021
+ mtime: g
2022
+ });
2023
+ }
2024
+ return 0;
2025
+ } catch (u) {
2026
+ if ("undefined" == typeof X || "ErrnoError" !== u.name) throw u;
2027
+ return -u.Ma;
2028
+ }
2029
+ },
2030
+ l: () => Na(""),
2031
+ k: () => {
2032
+ Ya = !1;
2033
+ Fc = 0;
2034
+ },
2035
+ A: function(a, b) {
2036
+ a = -9007199254740992 > a || 9007199254740992 < a ? NaN : Number(a);
2037
+ a = /* @__PURE__ */ new Date(1e3 * a);
2038
+ E[b >> 2] = a.getSeconds();
2039
+ E[b + 4 >> 2] = a.getMinutes();
2040
+ E[b + 8 >> 2] = a.getHours();
2041
+ E[b + 12 >> 2] = a.getDate();
2042
+ E[b + 16 >> 2] = a.getMonth();
2043
+ E[b + 20 >> 2] = a.getFullYear() - 1900;
2044
+ E[b + 24 >> 2] = a.getDay();
2045
+ var c = a.getFullYear();
2046
+ E[b + 28 >> 2] = (0 !== c % 4 || 0 === c % 100 && 0 !== c % 400 ? Hc : Gc)[a.getMonth()] + a.getDate() - 1 | 0;
2047
+ E[b + 36 >> 2] = -(60 * a.getTimezoneOffset());
2048
+ c = new Date(a.getFullYear(), 6, 1).getTimezoneOffset();
2049
+ var d = new Date(a.getFullYear(), 0, 1).getTimezoneOffset();
2050
+ E[b + 32 >> 2] = (c != d && a.getTimezoneOffset() == Math.min(d, c)) | 0;
2051
+ },
2052
+ y: function(a, b, c, d, e, g, h) {
2053
+ e = -9007199254740992 > e || 9007199254740992 < e ? NaN : Number(e);
2054
+ try {
2055
+ var q = T(d);
2056
+ if (0 !== (b & 2) && 0 === (c & 2) && 2 !== (q.flags & 2097155)) throw new N(2);
2057
+ if (1 === (q.flags & 2097155)) throw new N(2);
2058
+ if (!q.Ja.gb) throw new N(43);
2059
+ if (!a) throw new N(28);
2060
+ var v = q.Ja.gb(q, a, e, b, c);
2061
+ var u = v.Tb;
2062
+ E[g >> 2] = v.Bb;
2063
+ F[h >> 2] = u;
2064
+ return 0;
2065
+ } catch (x) {
2066
+ if ("undefined" == typeof X || "ErrnoError" !== x.name) throw x;
2067
+ return -x.Ma;
2068
+ }
2069
+ },
2070
+ z: function(a, b, c, d, e, g) {
2071
+ g = -9007199254740992 > g || 9007199254740992 < g ? NaN : Number(g);
2072
+ try {
2073
+ var h = T(e);
2074
+ if (c & 2) {
2075
+ c = g;
2076
+ if (32768 !== (h.node.mode & 61440)) throw new N(43);
2077
+ if (!(d & 2)) {
2078
+ var q = D.slice(a, a + b);
2079
+ h.Ja.hb && h.Ja.hb(h, q, c, b, d);
2080
+ }
2081
+ }
2082
+ } catch (v) {
2083
+ if ("undefined" == typeof X || "ErrnoError" !== v.name) throw v;
2084
+ return -v.Ma;
2085
+ }
2086
+ },
2087
+ m: (a, b) => {
2088
+ Ic[a] && (clearTimeout(Ic[a].id), delete Ic[a]);
2089
+ if (!b) return 0;
2090
+ Ic[a] = {
2091
+ id: setTimeout(() => {
2092
+ delete Ic[a];
2093
+ Kc(() => Uc(a, performance.now()));
2094
+ }, b),
2095
+ ic: b
2096
+ };
2097
+ return 0;
2098
+ },
2099
+ B: (a, b, c, d) => {
2100
+ var e = (/* @__PURE__ */ new Date()).getFullYear(), g = new Date(e, 0, 1).getTimezoneOffset();
2101
+ e = new Date(e, 6, 1).getTimezoneOffset();
2102
+ F[a >> 2] = 60 * Math.max(g, e);
2103
+ E[b >> 2] = Number(g != e);
2104
+ b = (h) => {
2105
+ var q = Math.abs(h);
2106
+ return `UTC${0 <= h ? "-" : "+"}${String(Math.floor(q / 60)).padStart(2, "0")}${String(q % 60).padStart(2, "0")}`;
2107
+ };
2108
+ a = b(g);
2109
+ b = b(e);
2110
+ e < g ? (M(a, D, c, 17), M(b, D, d, 17)) : (M(a, D, d, 17), M(b, D, c, 17));
2111
+ },
2112
+ c: () => Date.now(),
2113
+ t: () => 2147483648,
2114
+ b: () => performance.now(),
2115
+ n: (a) => {
2116
+ var b = D.length;
2117
+ a >>>= 0;
2118
+ if (2147483648 < a) return !1;
2119
+ for (var c = 1; 4 >= c; c *= 2) {
2120
+ var d = b * (1 + .2 / c);
2121
+ d = Math.min(d, a + 100663296);
2122
+ a: {
2123
+ d = (Math.min(2147483648, 65536 * Math.ceil(Math.max(a, d) / 65536)) - Ma.buffer.byteLength + 65535) / 65536 | 0;
2124
+ try {
2125
+ Ma.grow(d);
2126
+ La();
2127
+ var e = 1;
2128
+ break a;
2129
+ } catch (g) {}
2130
+ e = void 0;
2131
+ }
2132
+ if (e) return !0;
2133
+ }
2134
+ return !1;
2135
+ },
2136
+ E: (a, b) => {
2137
+ var c = 0, d = 0, e;
2138
+ for (e of Nc()) {
2139
+ var g = b + c;
2140
+ F[a + d >> 2] = g;
2141
+ c += M(e, D, g, Infinity) + 1;
2142
+ d += 4;
2143
+ }
2144
+ return 0;
2145
+ },
2146
+ F: (a, b) => {
2147
+ var c = Nc();
2148
+ F[a >> 2] = c.length;
2149
+ a = 0;
2150
+ for (var d of c) a += ib(d) + 1;
2151
+ F[b >> 2] = a;
2152
+ return 0;
2153
+ },
2154
+ d: function(a) {
2155
+ try {
2156
+ pa(T(a));
2157
+ return 0;
2158
+ } catch (c) {
2159
+ if ("undefined" == typeof X || "ErrnoError" !== c.name) throw c;
2160
+ return c.Ma;
2161
+ }
2162
+ },
2163
+ p: function(a, b) {
2164
+ try {
2165
+ var c = T(a);
2166
+ m[b] = c.tty ? 2 : P(c.mode) ? 3 : 40960 === (c.mode & 61440) ? 7 : 4;
2167
+ Ia[b + 2 >> 1] = 0;
2168
+ H[b + 8 >> 3] = BigInt(0);
2169
+ H[b + 16 >> 3] = BigInt(0);
2170
+ return 0;
2171
+ } catch (d) {
2172
+ if ("undefined" == typeof X || "ErrnoError" !== d.name) throw d;
2173
+ return d.Ma;
2174
+ }
2175
+ },
2176
+ w: function(a, b, c, d) {
2177
+ try {
2178
+ a: {
2179
+ var e = T(a);
2180
+ a = b;
2181
+ for (var g, h = b = 0; h < c; h++) {
2182
+ var q = F[a >> 2], v = F[a + 4 >> 2];
2183
+ a += 8;
2184
+ var u = bc(e, m, q, v, g);
2185
+ if (0 > u) {
2186
+ var x = -1;
2187
+ break a;
2188
+ }
2189
+ b += u;
2190
+ if (u < v) break;
2191
+ "undefined" != typeof g && (g += u);
2192
+ }
2193
+ x = b;
2194
+ }
2195
+ F[d >> 2] = x;
2196
+ return 0;
2197
+ } catch (C) {
2198
+ if ("undefined" == typeof X || "ErrnoError" !== C.name) throw C;
2199
+ return C.Ma;
2200
+ }
2201
+ },
2202
+ D: function(a, b, c, d) {
2203
+ b = -9007199254740992 > b || 9007199254740992 < b ? NaN : Number(b);
2204
+ try {
2205
+ if (isNaN(b)) return 61;
2206
+ var e = T(a);
2207
+ ac(e, b, c);
2208
+ H[d >> 3] = BigInt(e.position);
2209
+ e.ob && 0 === b && 0 === c && (e.ob = null);
2210
+ return 0;
2211
+ } catch (g) {
2212
+ if ("undefined" == typeof X || "ErrnoError" !== g.name) throw g;
2213
+ return g.Ma;
2214
+ }
2215
+ },
2216
+ I: function(a) {
2217
+ try {
2218
+ var b = T(a);
2219
+ return b.Ja?.fsync?.(b);
2220
+ } catch (c) {
2221
+ if ("undefined" == typeof X || "ErrnoError" !== c.name) throw c;
2222
+ return c.Ma;
2223
+ }
2224
+ },
2225
+ o: function(a, b, c, d) {
2226
+ try {
2227
+ a: {
2228
+ var e = T(a);
2229
+ a = b;
2230
+ for (var g, h = b = 0; h < c; h++) {
2231
+ var q = F[a >> 2], v = F[a + 4 >> 2];
2232
+ a += 8;
2233
+ var u = oa(e, m, q, v, g);
2234
+ if (0 > u) {
2235
+ var x = -1;
2236
+ break a;
2237
+ }
2238
+ b += u;
2239
+ if (u < v) break;
2240
+ "undefined" != typeof g && (g += u);
2241
+ }
2242
+ x = b;
2243
+ }
2244
+ F[d >> 2] = x;
2245
+ return 0;
2246
+ } catch (C) {
2247
+ if ("undefined" == typeof X || "ErrnoError" !== C.name) throw C;
2248
+ return C.Ma;
2249
+ }
2250
+ },
2251
+ j: Jc
2252
+ };
2253
+ function Wc() {
2254
+ function a() {
2255
+ k.calledRun = !0;
2256
+ if (!Ga) {
2257
+ if (!k.noFSInit && !Fb) {
2258
+ var b, c;
2259
+ Fb = !0;
2260
+ b ??= k.stdin;
2261
+ c ??= k.stdout;
2262
+ d ??= k.stderr;
2263
+ b ? W("stdin", b) : Wb("/dev/tty", "/dev/stdin");
2264
+ c ? W("stdout", null, c) : Wb("/dev/tty", "/dev/stdout");
2265
+ d ? W("stderr", null, d) : Wb("/dev/tty1", "/dev/stderr");
2266
+ na("/dev/stdin", 0);
2267
+ na("/dev/stdout", 1);
2268
+ na("/dev/stderr", 1);
2269
+ }
2270
+ Xc.M();
2271
+ Gb = !1;
2272
+ k.onRuntimeInitialized?.();
2273
+ if (k.postRun) for ("function" == typeof k.postRun && (k.postRun = [k.postRun]); k.postRun.length;) {
2274
+ var d = k.postRun.shift();
2275
+ Ua.push(d);
2276
+ }
2277
+ Ta(Ua);
2278
+ }
2279
+ }
2280
+ if (0 < K) Xa = Wc;
2281
+ else {
2282
+ if (k.preRun) for ("function" == typeof k.preRun && (k.preRun = [k.preRun]); k.preRun.length;) Wa();
2283
+ Ta(Va);
2284
+ 0 < K ? Xa = Wc : k.setStatus ? (k.setStatus("Running..."), setTimeout(() => {
2285
+ setTimeout(() => k.setStatus(""), 1);
2286
+ a();
2287
+ }, 1)) : a();
2288
+ }
2289
+ }
2290
+ var Xc;
2291
+ (async function() {
2292
+ function a(c) {
2293
+ c = Xc = c.exports;
2294
+ k._sqlite3_free = c.O;
2295
+ k._sqlite3_value_text = c.P;
2296
+ k._sqlite3_prepare_v2 = c.Q;
2297
+ k._sqlite3_step = c.R;
2298
+ k._sqlite3_reset = c.S;
2299
+ k._sqlite3_exec = c.T;
2300
+ k._sqlite3_finalize = c.U;
2301
+ k._sqlite3_column_name = c.V;
2302
+ k._sqlite3_column_text = c.W;
2303
+ k._sqlite3_column_type = c.X;
2304
+ k._sqlite3_errmsg = c.Y;
2305
+ k._sqlite3_clear_bindings = c.Z;
2306
+ k._sqlite3_value_blob = c._;
2307
+ k._sqlite3_value_bytes = c.$;
2308
+ k._sqlite3_value_double = c.aa;
2309
+ k._sqlite3_value_int = c.ba;
2310
+ k._sqlite3_value_type = c.ca;
2311
+ k._sqlite3_result_blob = c.da;
2312
+ k._sqlite3_result_double = c.ea;
2313
+ k._sqlite3_result_error = c.fa;
2314
+ k._sqlite3_result_int = c.ga;
2315
+ k._sqlite3_result_int64 = c.ha;
2316
+ k._sqlite3_result_null = c.ia;
2317
+ k._sqlite3_result_text = c.ja;
2318
+ k._sqlite3_aggregate_context = c.ka;
2319
+ k._sqlite3_column_count = c.la;
2320
+ k._sqlite3_data_count = c.ma;
2321
+ k._sqlite3_column_blob = c.na;
2322
+ k._sqlite3_column_bytes = c.oa;
2323
+ k._sqlite3_column_double = c.pa;
2324
+ k._sqlite3_bind_blob = c.qa;
2325
+ k._sqlite3_bind_double = c.ra;
2326
+ k._sqlite3_bind_int = c.sa;
2327
+ k._sqlite3_bind_text = c.ta;
2328
+ k._sqlite3_bind_parameter_index = c.ua;
2329
+ k._sqlite3_sql = c.va;
2330
+ k._sqlite3_changes = c.wa;
2331
+ k._sqlite3_close_v2 = c.xa;
2332
+ k._sqlite3_create_function_v2 = c.ya;
2333
+ k._sqlite3_update_hook = c.za;
2334
+ k._sqlite3_open = c.Aa;
2335
+ da = k._malloc = c.Ba;
2336
+ ea = k._free = c.Ca;
2337
+ Ab = c.Da;
2338
+ Uc = c.Ea;
2339
+ sa = c.Fa;
2340
+ y = c.Ga;
2341
+ qa = c.Ha;
2342
+ Ma = c.L;
2343
+ Z = c.N;
2344
+ La();
2345
+ K--;
2346
+ k.monitorRunDependencies?.(K);
2347
+ 0 == K && Xa && (c = Xa, Xa = null, c());
2348
+ return Xc;
2349
+ }
2350
+ K++;
2351
+ k.monitorRunDependencies?.(K);
2352
+ var b = { a: Vc };
2353
+ if (k.instantiateWasm) return new Promise((c) => {
2354
+ k.instantiateWasm(b, (d, e) => {
2355
+ c(a(d, e));
2356
+ });
2357
+ });
2358
+ Oa ??= k.locateFile ? k.locateFile("sql-wasm.wasm", Aa) : Aa + "sql-wasm.wasm";
2359
+ return a((await Ra(b)).instance);
2360
+ })();
2361
+ Wc();
2362
+ return Module;
2363
+ });
2364
+ return initSqlJsPromise;
2365
+ };
2366
+ if (typeof exports === "object" && typeof module === "object") {
2367
+ module.exports = initSqlJs;
2368
+ module.exports.default = initSqlJs;
2369
+ } else if (typeof define === "function" && define["amd"]) define([], function() {
2370
+ return initSqlJs;
2371
+ });
2372
+ else if (typeof exports === "object") exports["Module"] = initSqlJs;
2373
+ }));
2374
+ const initSqlJsLite = (/* @__PURE__ */ require_rolldown_runtime.__toESM(require_sql_wasm_lite(), 1)).default;
2375
+ //#endregion
2376
+ exports.default = initSqlJsLite;
2377
+ exports.initSqlJsLite = initSqlJsLite;