@neuralsea/workspace-indexer 0.4.0 → 0.4.1

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