nolo-cli 0.33.0-alpha.21 → 0.33.0-alpha.23

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.
Files changed (86) hide show
  1. package/{_executeModel-XKWVTZAY.js → _executeModel-C7G6UGVX.js} +21 -18
  2. package/{agentDeleteCommand-ZU4H6F6M.js → agentDeleteCommand-7T2AQL7Q.js} +24 -21
  3. package/{agentEmailCommands-6ULFXW4A.js → agentEmailCommands-M22DG56U.js} +37 -34
  4. package/{agentListCommands-VN7WCW7Z.js → agentListCommands-HDSQVOTR.js} +23 -20
  5. package/{agentMachineCommands-5PALVQBD.js → agentMachineCommands-B7HAFERS.js} +22 -19
  6. package/{agentRecordCommands-XEB66KRX.js → agentRecordCommands-DNEOXRTE.js} +28 -25
  7. package/{agentRunCommand-OJX27NII.js → agentRunCommand-G55YHYDL.js} +30 -27
  8. package/{agentRuntimeLocal-UWDOE55A.js → agentRuntimeLocal-YQGVUJ57.js} +10 -7
  9. package/{agentSlice-SZRRJ3ZX.js → agentSlice-A56VMSUG.js} +1 -1
  10. package/{appDeleteCommands-R63PZAY7.js → appDeleteCommands-57GIWQQ5.js} +17 -14
  11. package/{appDeployCommands-VNRT54YO.js → appDeployCommands-7IMZSUMQ.js} +17 -14
  12. package/{appDeployStatusCommands-6IPTKLEM.js → appDeployStatusCommands-ZNCK7TDT.js} +17 -14
  13. package/{appGetCommands-JPFVMVAI.js → appGetCommands-AZ4JVCGY.js} +17 -14
  14. package/{appListCommands-B3SLTPII.js → appListCommands-ABRHLEL7.js} +17 -14
  15. package/{authCommand-EX5G5PF4.js → authCommand-T5XN3VP2.js} +10 -10
  16. package/{authCommands-VR6Q6GU2.js → authCommands-W74NRPA6.js} +5 -5
  17. package/{chatQueueReduxAdapter-IEX32ZVP.js → chatQueueReduxAdapter-7CKSPWO5.js} +5 -5
  18. package/{chunk-XS543SNR.js → chunk-25MFIHEP.js} +3 -3
  19. package/{chunk-V4MT7AEN.js → chunk-3CVNNFKF.js} +7 -7
  20. package/chunk-3Z32AD6X.js +22 -0
  21. package/{chunk-PU47HKTF.js → chunk-3Z7GNZLS.js} +13 -13
  22. package/{chunk-XTSVOICC.js → chunk-4LSQNSXE.js} +25 -25
  23. package/{chunk-IHEC7VBF.js → chunk-4ZPH5WGJ.js} +1 -1
  24. package/{chunk-6MSSX7FI.js → chunk-AMKT2XOP.js} +2 -2
  25. package/{chunk-EQ6HOWEJ.js → chunk-EF36FMUE.js} +1 -1
  26. package/{chunk-SBPGB6TF.js → chunk-G3ONB6Y5.js} +5 -5
  27. package/{chunk-U2FRXKC7.js → chunk-JSIQQCPR.js} +1 -1
  28. package/{chunk-46JSKTPF.js → chunk-MIN2TNAM.js} +293 -64
  29. package/{chunk-LLKHGZME.js → chunk-O3LO3MRU.js} +13 -13
  30. package/{chunk-LJGEEYGC.js → chunk-OA7LCLY3.js} +1 -1
  31. package/{chunk-37LDAHQN.js → chunk-OH6MOEZN.js} +10 -10
  32. package/{chunk-REOW4YJX.js → chunk-OLFLSOUV.js} +5 -5
  33. package/{chunk-2UDMTJOM.js → chunk-PFJA4C7K.js} +13 -13
  34. package/{chunk-7BNPRRDS.js → chunk-R7UWXBVG.js} +21 -21
  35. package/{chunk-YH3FPBG6.js → chunk-SEFDSJK4.js} +321 -4
  36. package/chunk-TVXJEOU2.js +78 -0
  37. package/{chunk-GTEHJWXU.js → chunk-TZV6ELNR.js} +1 -1
  38. package/{chunk-RO3AEN3L.js → chunk-UCUCOZXY.js} +2 -2
  39. package/chunk-UOLENXLQ.js +1132 -0
  40. package/{chunk-M2YMQOLC.js → chunk-WHLQYPJZ.js} +12 -12
  41. package/{chunk-V44VE7R4.js → chunk-XLUTBJYU.js} +4 -4
  42. package/{chunk-JL2PUYVS.js → chunk-YBWR3WBJ.js} +12 -12
  43. package/{cliExecutor-DW3PHGEL.js → cliExecutor-BBUVQU4L.js} +2 -2
  44. package/{createAgentAutomationAction-72NNXELT.js → createAgentAutomationAction-YTMO34HZ.js} +6 -6
  45. package/{createDialogAction-3CJ2GXNO.js → createDialogAction-3B3FT7Y7.js} +7 -7
  46. package/{createPageAction-HZHQGQO6.js → createPageAction-WHUA54EI.js} +6 -6
  47. package/{dialogCommands-2BF4ZSWH.js → dialogCommands-OJYXBAR2.js} +16 -13
  48. package/{dialogSlice-5R4O4377.js → dialogSlice-S7CBGXUY.js} +5 -5
  49. package/{docCreateCommands-HMZUBFGL.js → docCreateCommands-LJPAIEMJ.js} +16 -13
  50. package/{docDeleteCommands-DFR7GCOR.js → docDeleteCommands-I7TIHWFQ.js} +17 -14
  51. package/{docReadCommands-YM7RDUAZ.js → docReadCommands-7RUZYEAA.js} +16 -13
  52. package/{docStore-A4SRW2DJ.js → docStore-YZACMKQG.js} +7 -7
  53. package/{docUpdateCommands-TTQBD7IU.js → docUpdateCommands-HTR5Y737.js} +16 -13
  54. package/emscripten-module-EDQBMDVK.js +576 -0
  55. package/emscripten-module-LCBQ7VWY.js +1506 -0
  56. package/emscripten-module-OFHQ7EL3.js +482 -0
  57. package/emscripten-module-XM7NDJQA.js +4536 -0
  58. package/ffi-6ZSX3QJ4.js +80 -0
  59. package/ffi-742Y76PE.js +92 -0
  60. package/ffi-AEYWSYLM.js +80 -0
  61. package/ffi-KQC27OUM.js +92 -0
  62. package/{handleSendMessageAction-CIFBZCI2.js → handleSendMessageAction-HJUPYPBF.js} +5 -5
  63. package/index.js +67 -67
  64. package/{machineCommands-QSW4JKR2.js → machineCommands-IJL73WA5.js} +39 -36
  65. package/{machineWsRunDispatch-X3ZC7DZJ.js → machineWsRunDispatch-7RE5KJRG.js} +26 -23
  66. package/module-ES6BEMUI-AFCVSBMS.js +14 -0
  67. package/module-asyncify-2EFITU5U-DEP2F2QP.js +9 -0
  68. package/package.json +1 -1
  69. package/{readlineWorkspace-J2ARMEUC.js → readlineWorkspace-EGSZ26XS.js} +196 -147
  70. package/{runAgentClientLoop-5I2R74NR.js → runAgentClientLoop-7OD74SBW.js} +12 -12
  71. package/{spaceCommands-EZYMMJJH.js → spaceCommands-5NCZJOOC.js} +23 -20
  72. package/{spaceSlice-TL2FR4AF.js → spaceSlice-KD2BB5GS.js} +6 -6
  73. package/{streamAgentChatTurn-UDYSE2ES.js → streamAgentChatTurn-LDQPG7A3.js} +32 -29
  74. package/{tools-KWYWDJ77.js → tools-XAC2C4LK.js} +10 -10
  75. package/{tuiSummaryLlmCaller-WUVAOIYU.js → tuiSummaryLlmCaller-LAOHMDTM.js} +3 -3
  76. package/{updateDialogTitleAction-NQCOEOLF.js → updateDialogTitleAction-PDIR5IVC.js} +8 -8
  77. package/{agentGrantCommands-2LEZDADN.js → agentGrantCommands-OPIGFRDO.js} +2 -2
  78. package/{agentPullCommand-TSWAJPS2.js → agentPullCommand-NYHSK6EW.js} +2 -2
  79. package/{chunk-YDTYDA5W.js → chunk-BY53PPQ2.js} +3 -3
  80. package/{chunk-HCOIKLSH.js → chunk-CP4QR2D2.js} +3 -3
  81. package/{chunk-ZHYK3N56.js → chunk-G7HTVVFL.js} +3 -3
  82. package/{chunk-SAQQLJZ5.js → chunk-JDSUTNYY.js} +3 -3
  83. package/{chunk-N2WDGMD5.js → chunk-N543Q3VR.js} +12 -12
  84. package/{offlineMarxistsAgentCommand-GEH6SNNA.js → offlineMarxistsAgentCommand-HDIQVGKN.js} +3 -3
  85. package/{runtimeDoctorCommands-KHGQKT3B.js → runtimeDoctorCommands-HT4O2PXL.js} +3 -3
  86. package/{tableCommands-64FZBAI3.js → tableCommands-5OKD2DKN.js} +8 -8
@@ -0,0 +1,4536 @@
1
+ import "./chunk-4VNS5WPM.js";
2
+
3
+ // node_modules/@jitl/quickjs-wasmfile-debug-sync/dist/emscripten-module.mjs
4
+ async function QuickJSRaw(moduleArg = {}) {
5
+ var moduleRtn;
6
+ (function() {
7
+ function humanReadableVersionToPacked(str) {
8
+ str = str.split("-")[0];
9
+ var vers = str.split(".").slice(0, 3);
10
+ while (vers.length < 3) vers.push("00");
11
+ vers = vers.map((n, i, arr) => n.padStart(2, "0"));
12
+ return vers.join("");
13
+ }
14
+ var packedVersionToHumanReadable = (n) => [n / 1e4 | 0, (n / 100 | 0) % 100, n % 100].join(".");
15
+ var TARGET_NOT_SUPPORTED = 2147483647;
16
+ var currentNodeVersion = typeof process !== "undefined" && process.versions?.node ? humanReadableVersionToPacked(process.versions.node) : TARGET_NOT_SUPPORTED;
17
+ if (currentNodeVersion < 16e4) {
18
+ throw new Error(`This emscripten-generated code requires node v${packedVersionToHumanReadable(16e4)} (detected v${packedVersionToHumanReadable(currentNodeVersion)})`);
19
+ }
20
+ var userAgent = typeof navigator !== "undefined" && navigator.userAgent;
21
+ if (!userAgent) {
22
+ return;
23
+ }
24
+ var currentSafariVersion = userAgent.includes("Safari/") && !userAgent.includes("Chrome/") && userAgent.match(/Version\/(\d+\.?\d*\.?\d*)/) ? humanReadableVersionToPacked(userAgent.match(/Version\/(\d+\.?\d*\.?\d*)/)[1]) : TARGET_NOT_SUPPORTED;
25
+ if (currentSafariVersion < 15e4) {
26
+ throw new Error(`This emscripten-generated code requires Safari v${packedVersionToHumanReadable(15e4)} (detected v${currentSafariVersion})`);
27
+ }
28
+ var currentFirefoxVersion = userAgent.match(/Firefox\/(\d+(?:\.\d+)?)/) ? parseFloat(userAgent.match(/Firefox\/(\d+(?:\.\d+)?)/)[1]) : TARGET_NOT_SUPPORTED;
29
+ if (currentFirefoxVersion < 79) {
30
+ throw new Error(`This emscripten-generated code requires Firefox v79 (detected v${currentFirefoxVersion})`);
31
+ }
32
+ var currentChromeVersion = userAgent.match(/Chrome\/(\d+(?:\.\d+)?)/) ? parseFloat(userAgent.match(/Chrome\/(\d+(?:\.\d+)?)/)[1]) : TARGET_NOT_SUPPORTED;
33
+ if (currentChromeVersion < 85) {
34
+ throw new Error(`This emscripten-generated code requires Chrome v85 (detected v${currentChromeVersion})`);
35
+ }
36
+ })();
37
+ var Module = moduleArg;
38
+ var ENVIRONMENT_IS_WEB = !!globalThis.window;
39
+ var ENVIRONMENT_IS_WORKER = !!globalThis.WorkerGlobalScope;
40
+ var ENVIRONMENT_IS_NODE = globalThis.process?.versions?.node && globalThis.process?.type != "renderer";
41
+ var ENVIRONMENT_IS_SHELL = !ENVIRONMENT_IS_WEB && !ENVIRONMENT_IS_NODE && !ENVIRONMENT_IS_WORKER;
42
+ if (ENVIRONMENT_IS_NODE) {
43
+ const { createRequire } = await import("node:module");
44
+ var require2 = createRequire(import.meta.url);
45
+ }
46
+ function quickjsEmscriptenInit(debugLog) {
47
+ const log = debugLog || function() {
48
+ };
49
+ const extension = { log };
50
+ for (const init of quickjsEmscriptenInit.inits) {
51
+ init(extension);
52
+ }
53
+ Module["quickJSEmscriptenExtensions"] = extension;
54
+ return extension;
55
+ }
56
+ quickjsEmscriptenInit.inits = [];
57
+ Module["quickjsEmscriptenInit"] = quickjsEmscriptenInit;
58
+ quickjsEmscriptenInit.inits.push((extension) => {
59
+ if (typeof receiveSourceMapJSON !== "undefined") {
60
+ extension["receiveSourceMapJSON"] = (data) => {
61
+ if (typeof wasmSourceMap === "undefined") {
62
+ extension.log("receiveSourceMapJSON: received", data);
63
+ return receiveSourceMapJSON(data);
64
+ } else {
65
+ extension.log("receiveSourceMapJSON: already have data:", wasmSourceMap, "ignoring", data);
66
+ }
67
+ };
68
+ }
69
+ });
70
+ quickjsEmscriptenInit.inits.push((extension) => {
71
+ if (typeof WasmOffsetConverter !== "undefined") {
72
+ extension["WasmOffsetConverter"] = WasmOffsetConverter;
73
+ try {
74
+ extension["existingWasmOffsetConverter"] = wasmOffsetConverter;
75
+ extension["receiveWasmOffsetConverter"] = function(wasmBinary2, wasmModule) {
76
+ if (!wasmOffsetConverter) {
77
+ extension.log("wasmOffsetConverter set");
78
+ wasmOffsetConverter = new WasmOffsetConverter(wasmBinary2, wasmModule);
79
+ } else {
80
+ extension.log("wasmOffsetConverter already set, ignored");
81
+ }
82
+ };
83
+ } catch (error) {
84
+ extension["receiveWasmOffsetConverter"] = function() {
85
+ extension.log("wasmOffsetConverter variable not defined, this is a no-op");
86
+ };
87
+ }
88
+ }
89
+ });
90
+ quickjsEmscriptenInit.inits.push((extension) => {
91
+ extension["getWasmMemory"] = function() {
92
+ return wasmMemory;
93
+ };
94
+ });
95
+ var arguments_ = [];
96
+ var thisProgram = "./this.program";
97
+ var quit_ = (status, toThrow) => {
98
+ throw toThrow;
99
+ };
100
+ var _scriptName = import.meta.url;
101
+ var scriptDirectory = "";
102
+ function locateFile(path) {
103
+ if (Module["locateFile"]) {
104
+ return Module["locateFile"](path, scriptDirectory);
105
+ }
106
+ return scriptDirectory + path;
107
+ }
108
+ var readAsync, readBinary;
109
+ if (ENVIRONMENT_IS_NODE) {
110
+ const isNode = globalThis.process?.versions?.node && globalThis.process?.type != "renderer";
111
+ if (!isNode) throw new Error("not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)");
112
+ var fs = require2("node:fs");
113
+ if (_scriptName.startsWith("file:")) {
114
+ scriptDirectory = require2("node:path").dirname(require2("node:url").fileURLToPath(_scriptName)) + "/";
115
+ }
116
+ readBinary = (filename) => {
117
+ filename = isFileURI(filename) ? new URL(filename) : filename;
118
+ var ret = fs.readFileSync(filename);
119
+ assert(Buffer.isBuffer(ret));
120
+ return ret;
121
+ };
122
+ readAsync = async (filename, binary = true) => {
123
+ filename = isFileURI(filename) ? new URL(filename) : filename;
124
+ var ret = fs.readFileSync(filename, binary ? void 0 : "utf8");
125
+ assert(binary ? Buffer.isBuffer(ret) : typeof ret == "string");
126
+ return ret;
127
+ };
128
+ if (process.argv.length > 1) {
129
+ thisProgram = process.argv[1].replace(/\\/g, "/");
130
+ }
131
+ arguments_ = process.argv.slice(2);
132
+ quit_ = (status, toThrow) => {
133
+ process.exitCode = status;
134
+ throw toThrow;
135
+ };
136
+ } else if (ENVIRONMENT_IS_SHELL) {
137
+ } else if (ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER) {
138
+ try {
139
+ scriptDirectory = new URL(".", _scriptName).href;
140
+ } catch {
141
+ }
142
+ if (!(globalThis.window || globalThis.WorkerGlobalScope)) throw new Error("not compiled for this environment (did you build to HTML and try to run it not on the web, or set ENVIRONMENT to something - like node - and run it someplace else - like on the web?)");
143
+ {
144
+ if (ENVIRONMENT_IS_WORKER) {
145
+ readBinary = (url) => {
146
+ var xhr = new XMLHttpRequest();
147
+ xhr.open("GET", url, false);
148
+ xhr.responseType = "arraybuffer";
149
+ xhr.send(null);
150
+ return new Uint8Array(
151
+ /** @type{!ArrayBuffer} */
152
+ xhr.response
153
+ );
154
+ };
155
+ }
156
+ readAsync = async (url) => {
157
+ if (isFileURI(url)) {
158
+ return new Promise((resolve, reject) => {
159
+ var xhr = new XMLHttpRequest();
160
+ xhr.open("GET", url, true);
161
+ xhr.responseType = "arraybuffer";
162
+ xhr.onload = () => {
163
+ if (xhr.status == 200 || xhr.status == 0 && xhr.response) {
164
+ resolve(xhr.response);
165
+ return;
166
+ }
167
+ reject(xhr.status);
168
+ };
169
+ xhr.onerror = reject;
170
+ xhr.send(null);
171
+ });
172
+ }
173
+ var response = await fetch(url, { credentials: "same-origin" });
174
+ if (response.ok) {
175
+ return response.arrayBuffer();
176
+ }
177
+ throw new Error(response.status + " : " + response.url);
178
+ };
179
+ }
180
+ } else {
181
+ throw new Error("environment detection error");
182
+ }
183
+ var out = console.log.bind(console);
184
+ var err = console.error.bind(console);
185
+ var IDBFS = "IDBFS is no longer included by default; build with -lidbfs.js";
186
+ var PROXYFS = "PROXYFS is no longer included by default; build with -lproxyfs.js";
187
+ var WORKERFS = "WORKERFS is no longer included by default; build with -lworkerfs.js";
188
+ var FETCHFS = "FETCHFS is no longer included by default; build with -lfetchfs.js";
189
+ var ICASEFS = "ICASEFS is no longer included by default; build with -licasefs.js";
190
+ var JSFILEFS = "JSFILEFS is no longer included by default; build with -ljsfilefs.js";
191
+ var OPFS = "OPFS is no longer included by default; build with -lopfs.js";
192
+ var NODEFS = "NODEFS is no longer included by default; build with -lnodefs.js";
193
+ assert(!ENVIRONMENT_IS_SHELL, "shell environment detected but not enabled at build time. Add `shell` to `-sENVIRONMENT` to enable.");
194
+ var wasmBinary;
195
+ if (!globalThis.WebAssembly) {
196
+ err("no native wasm support detected");
197
+ }
198
+ var ABORT = false;
199
+ var EXITSTATUS;
200
+ function assert(condition, text) {
201
+ if (!condition) {
202
+ abort("Assertion failed" + (text ? ": " + text : ""));
203
+ }
204
+ }
205
+ var isFileURI = (filename) => filename.startsWith("file://");
206
+ function writeStackCookie() {
207
+ var max = _emscripten_stack_get_end();
208
+ assert((max & 3) == 0);
209
+ if (max == 0) {
210
+ max += 4;
211
+ }
212
+ HEAPU32[max >> 2] = 34821223;
213
+ HEAPU32[max + 4 >> 2] = 2310721022;
214
+ HEAPU32[0 >> 2] = 1668509029;
215
+ }
216
+ function checkStackCookie() {
217
+ if (ABORT) return;
218
+ var max = _emscripten_stack_get_end();
219
+ if (max == 0) {
220
+ max += 4;
221
+ }
222
+ var cookie1 = HEAPU32[max >> 2];
223
+ var cookie2 = HEAPU32[max + 4 >> 2];
224
+ if (cookie1 != 34821223 || cookie2 != 2310721022) {
225
+ abort(`Stack overflow! Stack cookie has been overwritten at ${ptrToString(max)}, expected hex dwords 0x89BACDFE and 0x2135467, but received ${ptrToString(cookie2)} ${ptrToString(cookie1)}`);
226
+ }
227
+ if (HEAPU32[0 >> 2] != 1668509029) {
228
+ abort("Runtime error: The application has corrupted its heap memory area (address zero)!");
229
+ }
230
+ }
231
+ var runtimeDebug = true;
232
+ function dbg(...args) {
233
+ if (!runtimeDebug && typeof runtimeDebug != "undefined") return;
234
+ console.warn(...args);
235
+ }
236
+ (() => {
237
+ var h16 = new Int16Array(1);
238
+ var h8 = new Int8Array(h16.buffer);
239
+ h16[0] = 25459;
240
+ if (h8[0] !== 115 || h8[1] !== 99) abort("Runtime error: expected the system to be little-endian! (Run with -sSUPPORT_BIG_ENDIAN to bypass)");
241
+ })();
242
+ function consumedModuleProp(prop) {
243
+ if (!Object.getOwnPropertyDescriptor(Module, prop)) {
244
+ Object.defineProperty(Module, prop, {
245
+ configurable: true,
246
+ set() {
247
+ abort(`Attempt to set \`Module.${prop}\` after it has already been processed. This can happen, for example, when code is injected via '--post-js' rather than '--pre-js'`);
248
+ }
249
+ });
250
+ }
251
+ }
252
+ function makeInvalidEarlyAccess(name) {
253
+ return () => assert(false, `call to '${name}' via reference taken before Wasm module initialization`);
254
+ }
255
+ function ignoredModuleProp(prop) {
256
+ if (Object.getOwnPropertyDescriptor(Module, prop)) {
257
+ abort(`\`Module.${prop}\` was supplied but \`${prop}\` not included in INCOMING_MODULE_JS_API`);
258
+ }
259
+ }
260
+ function isExportedByForceFilesystem(name) {
261
+ return name === "FS_createPath" || name === "FS_createDataFile" || name === "FS_createPreloadedFile" || name === "FS_preloadFile" || name === "FS_unlink" || name === "addRunDependency" || // The old FS has some functionality that WasmFS lacks.
262
+ name === "FS_createLazyFile" || name === "FS_createDevice" || name === "removeRunDependency";
263
+ }
264
+ function missingLibrarySymbol(sym) {
265
+ unexportedRuntimeSymbol(sym);
266
+ }
267
+ function unexportedRuntimeSymbol(sym) {
268
+ if (!Object.getOwnPropertyDescriptor(Module, sym)) {
269
+ Object.defineProperty(Module, sym, {
270
+ configurable: true,
271
+ get() {
272
+ var msg = `'${sym}' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the Emscripten FAQ)`;
273
+ if (isExportedByForceFilesystem(sym)) {
274
+ msg += ". Alternatively, forcing filesystem support (-sFORCE_FILESYSTEM) can export this for you";
275
+ }
276
+ abort(msg);
277
+ }
278
+ });
279
+ }
280
+ }
281
+ var readyPromiseResolve, readyPromiseReject;
282
+ var HEAP8, HEAPU8, HEAP16, HEAPU16, HEAP32, HEAPU32, HEAPF32, HEAPF64;
283
+ var HEAP64, HEAPU64;
284
+ var runtimeInitialized = false;
285
+ var runtimeExited = false;
286
+ function updateMemoryViews() {
287
+ var b = wasmMemory.buffer;
288
+ Module["HEAP8"] = HEAP8 = new Int8Array(b);
289
+ HEAP16 = new Int16Array(b);
290
+ Module["HEAPU8"] = HEAPU8 = new Uint8Array(b);
291
+ HEAPU16 = new Uint16Array(b);
292
+ HEAP32 = new Int32Array(b);
293
+ HEAPU32 = new Uint32Array(b);
294
+ HEAPF32 = new Float32Array(b);
295
+ HEAPF64 = new Float64Array(b);
296
+ HEAP64 = new BigInt64Array(b);
297
+ HEAPU64 = new BigUint64Array(b);
298
+ }
299
+ function initMemory() {
300
+ if (Module["wasmMemory"]) {
301
+ wasmMemory = Module["wasmMemory"];
302
+ } else {
303
+ var INITIAL_MEMORY = Module["INITIAL_MEMORY"] || 16777216;
304
+ assert(INITIAL_MEMORY >= 5242880, "INITIAL_MEMORY should be larger than STACK_SIZE, was " + INITIAL_MEMORY + "! (STACK_SIZE=5242880)");
305
+ wasmMemory = new WebAssembly.Memory({
306
+ "initial": INITIAL_MEMORY / 65536,
307
+ // In theory we should not need to emit the maximum if we want "unlimited"
308
+ // or 4GB of memory, but VMs error on that atm, see
309
+ // https://github.com/emscripten-core/emscripten/issues/14130
310
+ // And in the pthreads case we definitely need to emit a maximum. So
311
+ // always emit one.
312
+ "maximum": 32768
313
+ });
314
+ }
315
+ updateMemoryViews();
316
+ }
317
+ assert(
318
+ globalThis.Int32Array && globalThis.Float64Array && Int32Array.prototype.subarray && Int32Array.prototype.set,
319
+ "JS engine does not provide full typed array support"
320
+ );
321
+ function preRun() {
322
+ if (Module["preRun"]) {
323
+ if (typeof Module["preRun"] == "function") Module["preRun"] = [Module["preRun"]];
324
+ while (Module["preRun"].length) {
325
+ addOnPreRun(Module["preRun"].shift());
326
+ }
327
+ }
328
+ consumedModuleProp("preRun");
329
+ callRuntimeCallbacks(onPreRuns);
330
+ }
331
+ function initRuntime() {
332
+ assert(!runtimeInitialized);
333
+ runtimeInitialized = true;
334
+ checkStackCookie();
335
+ if (!Module["noFSInit"] && !FS.initialized) FS.init();
336
+ TTY.init();
337
+ wasmExports["__wasm_call_ctors"]();
338
+ FS.ignorePermissions = false;
339
+ }
340
+ function exitRuntime() {
341
+ assert(!runtimeExited);
342
+ checkStackCookie();
343
+ ___funcs_on_exit();
344
+ FS.quit();
345
+ TTY.shutdown();
346
+ runtimeExited = true;
347
+ }
348
+ function postRun() {
349
+ checkStackCookie();
350
+ if (Module["postRun"]) {
351
+ if (typeof Module["postRun"] == "function") Module["postRun"] = [Module["postRun"]];
352
+ while (Module["postRun"].length) {
353
+ addOnPostRun(Module["postRun"].shift());
354
+ }
355
+ }
356
+ consumedModuleProp("postRun");
357
+ callRuntimeCallbacks(onPostRuns);
358
+ }
359
+ function abort(what) {
360
+ Module["onAbort"]?.(what);
361
+ what = "Aborted(" + what + ")";
362
+ err(what);
363
+ ABORT = true;
364
+ var e = new WebAssembly.RuntimeError(what);
365
+ readyPromiseReject?.(e);
366
+ throw e;
367
+ }
368
+ function createExportWrapper(name, nargs) {
369
+ return (...args) => {
370
+ assert(runtimeInitialized, `native function \`${name}\` called before runtime initialization`);
371
+ assert(!runtimeExited, `native function \`${name}\` called after runtime exit (use NO_EXIT_RUNTIME to keep it alive after main() exits)`);
372
+ var f = wasmExports[name];
373
+ assert(f, `exported native function \`${name}\` not found`);
374
+ assert(args.length <= nargs, `native function \`${name}\` called with ${args.length} args but expects ${nargs}`);
375
+ return f(...args);
376
+ };
377
+ }
378
+ var wasmBinaryFile;
379
+ function findWasmBinary() {
380
+ if (Module["locateFile"]) {
381
+ return locateFile("emscripten-module.wasm");
382
+ }
383
+ return new URL("emscripten-module.wasm", import.meta.url).href;
384
+ }
385
+ function getBinarySync(file) {
386
+ if (file == wasmBinaryFile && wasmBinary) {
387
+ return new Uint8Array(wasmBinary);
388
+ }
389
+ if (readBinary) {
390
+ return readBinary(file);
391
+ }
392
+ throw "both async and sync fetching of the wasm failed";
393
+ }
394
+ async function getWasmBinary(binaryFile) {
395
+ if (!wasmBinary) {
396
+ try {
397
+ var response = await readAsync(binaryFile);
398
+ return new Uint8Array(response);
399
+ } catch {
400
+ }
401
+ }
402
+ return getBinarySync(binaryFile);
403
+ }
404
+ async function instantiateArrayBuffer(binaryFile, imports) {
405
+ try {
406
+ var binary = await getWasmBinary(binaryFile);
407
+ var instance = await WebAssembly.instantiate(binary, imports);
408
+ return instance;
409
+ } catch (reason) {
410
+ err(`failed to asynchronously prepare wasm: ${reason}`);
411
+ if (isFileURI(binaryFile)) {
412
+ err(`warning: Loading from a file URI (${binaryFile}) is not supported in most browsers. See https://emscripten.org/docs/getting_started/FAQ.html#how-do-i-run-a-local-webserver-for-testing-why-does-my-program-stall-in-downloading-or-preparing`);
413
+ }
414
+ abort(reason);
415
+ }
416
+ }
417
+ async function instantiateAsync(binary, binaryFile, imports) {
418
+ if (!binary && !isFileURI(binaryFile) && !ENVIRONMENT_IS_NODE) {
419
+ try {
420
+ var response = fetch(binaryFile, { credentials: "same-origin" });
421
+ var instantiationResult = await WebAssembly.instantiateStreaming(response, imports);
422
+ return instantiationResult;
423
+ } catch (reason) {
424
+ err(`wasm streaming compile failed: ${reason}`);
425
+ err("falling back to ArrayBuffer instantiation");
426
+ }
427
+ ;
428
+ }
429
+ return instantiateArrayBuffer(binaryFile, imports);
430
+ }
431
+ function getWasmImports() {
432
+ var imports = {
433
+ "env": wasmImports,
434
+ "wasi_snapshot_preview1": wasmImports
435
+ };
436
+ return imports;
437
+ }
438
+ async function createWasm() {
439
+ function receiveInstance(instance, module) {
440
+ wasmExports = instance.exports;
441
+ assignWasmExports(wasmExports);
442
+ return wasmExports;
443
+ }
444
+ var trueModule = Module;
445
+ function receiveInstantiationResult(result2) {
446
+ assert(Module === trueModule, "the Module object should not be replaced during async compilation - perhaps the order of HTML elements is wrong?");
447
+ trueModule = null;
448
+ return receiveInstance(result2["instance"]);
449
+ }
450
+ var info = getWasmImports();
451
+ if (Module["instantiateWasm"]) {
452
+ return new Promise((resolve, reject) => {
453
+ try {
454
+ Module["instantiateWasm"](info, (inst, mod) => {
455
+ resolve(receiveInstance(inst, mod));
456
+ });
457
+ } catch (e) {
458
+ err(`Module.instantiateWasm callback failed with error: ${e}`);
459
+ reject(e);
460
+ }
461
+ });
462
+ }
463
+ wasmBinaryFile ??= findWasmBinary();
464
+ var result = await instantiateAsync(wasmBinary, wasmBinaryFile, info);
465
+ var exports = receiveInstantiationResult(result);
466
+ return exports;
467
+ }
468
+ class ExitStatus {
469
+ name = "ExitStatus";
470
+ constructor(status) {
471
+ this.message = `Program terminated with exit(${status})`;
472
+ this.status = status;
473
+ }
474
+ }
475
+ var callRuntimeCallbacks = (callbacks) => {
476
+ while (callbacks.length > 0) {
477
+ callbacks.shift()(Module);
478
+ }
479
+ };
480
+ var onPostRuns = [];
481
+ var addOnPostRun = (cb) => onPostRuns.push(cb);
482
+ var onPreRuns = [];
483
+ var addOnPreRun = (cb) => onPreRuns.push(cb);
484
+ function getValue(ptr, type = "i8") {
485
+ if (type.endsWith("*")) type = "*";
486
+ switch (type) {
487
+ case "i1":
488
+ return HEAP8[ptr];
489
+ case "i8":
490
+ return HEAP8[ptr];
491
+ case "i16":
492
+ return HEAP16[ptr >> 1];
493
+ case "i32":
494
+ return HEAP32[ptr >> 2];
495
+ case "i64":
496
+ return HEAP64[ptr >> 3];
497
+ case "float":
498
+ return HEAPF32[ptr >> 2];
499
+ case "double":
500
+ return HEAPF64[ptr >> 3];
501
+ case "*":
502
+ return HEAPU32[ptr >> 2];
503
+ default:
504
+ abort(`invalid type for getValue: ${type}`);
505
+ }
506
+ }
507
+ var noExitRuntime = false;
508
+ var ptrToString = (ptr) => {
509
+ assert(typeof ptr === "number", `ptrToString expects a number, got ${typeof ptr}`);
510
+ ptr >>>= 0;
511
+ return "0x" + ptr.toString(16).padStart(8, "0");
512
+ };
513
+ function setValue(ptr, value, type = "i8") {
514
+ if (type.endsWith("*")) type = "*";
515
+ switch (type) {
516
+ case "i1":
517
+ HEAP8[ptr] = value;
518
+ break;
519
+ case "i8":
520
+ HEAP8[ptr] = value;
521
+ break;
522
+ case "i16":
523
+ HEAP16[ptr >> 1] = value;
524
+ break;
525
+ case "i32":
526
+ HEAP32[ptr >> 2] = value;
527
+ break;
528
+ case "i64":
529
+ HEAP64[ptr >> 3] = BigInt(value);
530
+ break;
531
+ case "float":
532
+ HEAPF32[ptr >> 2] = value;
533
+ break;
534
+ case "double":
535
+ HEAPF64[ptr >> 3] = value;
536
+ break;
537
+ case "*":
538
+ HEAPU32[ptr >> 2] = value;
539
+ break;
540
+ default:
541
+ abort(`invalid type for setValue: ${type}`);
542
+ }
543
+ }
544
+ var stackRestore = (val) => __emscripten_stack_restore(val);
545
+ var stackSave = () => _emscripten_stack_get_current();
546
+ var warnOnce = (text) => {
547
+ warnOnce.shown ||= {};
548
+ if (!warnOnce.shown[text]) {
549
+ warnOnce.shown[text] = 1;
550
+ if (ENVIRONMENT_IS_NODE) text = "warning: " + text;
551
+ err(text);
552
+ }
553
+ };
554
+ var wasmMemory;
555
+ var UTF8Decoder = globalThis.TextDecoder && new TextDecoder();
556
+ var findStringEnd = (heapOrArray, idx, maxBytesToRead, ignoreNul) => {
557
+ var maxIdx = idx + maxBytesToRead;
558
+ if (ignoreNul) return maxIdx;
559
+ while (heapOrArray[idx] && !(idx >= maxIdx)) ++idx;
560
+ return idx;
561
+ };
562
+ var UTF8ArrayToString = (heapOrArray, idx = 0, maxBytesToRead, ignoreNul) => {
563
+ var endPtr = findStringEnd(heapOrArray, idx, maxBytesToRead, ignoreNul);
564
+ if (endPtr - idx > 16 && heapOrArray.buffer && UTF8Decoder) {
565
+ return UTF8Decoder.decode(heapOrArray.subarray(idx, endPtr));
566
+ }
567
+ var str = "";
568
+ while (idx < endPtr) {
569
+ var u0 = heapOrArray[idx++];
570
+ if (!(u0 & 128)) {
571
+ str += String.fromCharCode(u0);
572
+ continue;
573
+ }
574
+ var u1 = heapOrArray[idx++] & 63;
575
+ if ((u0 & 224) == 192) {
576
+ str += String.fromCharCode((u0 & 31) << 6 | u1);
577
+ continue;
578
+ }
579
+ var u2 = heapOrArray[idx++] & 63;
580
+ if ((u0 & 240) == 224) {
581
+ u0 = (u0 & 15) << 12 | u1 << 6 | u2;
582
+ } else {
583
+ if ((u0 & 248) != 240) warnOnce("Invalid UTF-8 leading byte " + ptrToString(u0) + " encountered when deserializing a UTF-8 string in wasm memory to a JS string!");
584
+ u0 = (u0 & 7) << 18 | u1 << 12 | u2 << 6 | heapOrArray[idx++] & 63;
585
+ }
586
+ if (u0 < 65536) {
587
+ str += String.fromCharCode(u0);
588
+ } else {
589
+ var ch = u0 - 65536;
590
+ str += String.fromCharCode(55296 | ch >> 10, 56320 | ch & 1023);
591
+ }
592
+ }
593
+ return str;
594
+ };
595
+ var UTF8ToString = (ptr, maxBytesToRead, ignoreNul) => {
596
+ assert(typeof ptr == "number", `UTF8ToString expects a number (got ${typeof ptr})`);
597
+ return ptr ? UTF8ArrayToString(HEAPU8, ptr, maxBytesToRead, ignoreNul) : "";
598
+ };
599
+ var ___assert_fail = (condition, filename, line, func) => abort(`Assertion failed: ${UTF8ToString(condition)}, at: ` + [filename ? UTF8ToString(filename) : "unknown filename", line, func ? UTF8ToString(func) : "unknown function"]);
600
+ var PATH = {
601
+ isAbs: (path) => path.charAt(0) === "/",
602
+ splitPath: (filename) => {
603
+ var splitPathRe = /^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;
604
+ return splitPathRe.exec(filename).slice(1);
605
+ },
606
+ normalizeArray: (parts, allowAboveRoot) => {
607
+ var up = 0;
608
+ for (var i = parts.length - 1; i >= 0; i--) {
609
+ var last = parts[i];
610
+ if (last === ".") {
611
+ parts.splice(i, 1);
612
+ } else if (last === "..") {
613
+ parts.splice(i, 1);
614
+ up++;
615
+ } else if (up) {
616
+ parts.splice(i, 1);
617
+ up--;
618
+ }
619
+ }
620
+ if (allowAboveRoot) {
621
+ for (; up; up--) {
622
+ parts.unshift("..");
623
+ }
624
+ }
625
+ return parts;
626
+ },
627
+ normalize: (path) => {
628
+ var isAbsolute = PATH.isAbs(path), trailingSlash = path.slice(-1) === "/";
629
+ path = PATH.normalizeArray(path.split("/").filter((p) => !!p), !isAbsolute).join("/");
630
+ if (!path && !isAbsolute) {
631
+ path = ".";
632
+ }
633
+ if (path && trailingSlash) {
634
+ path += "/";
635
+ }
636
+ return (isAbsolute ? "/" : "") + path;
637
+ },
638
+ dirname: (path) => {
639
+ var result = PATH.splitPath(path), root = result[0], dir = result[1];
640
+ if (!root && !dir) {
641
+ return ".";
642
+ }
643
+ if (dir) {
644
+ dir = dir.slice(0, -1);
645
+ }
646
+ return root + dir;
647
+ },
648
+ basename: (path) => path && path.match(/([^\/]+|\/)\/*$/)[1],
649
+ join: (...paths) => PATH.normalize(paths.join("/")),
650
+ join2: (l, r) => PATH.normalize(l + "/" + r)
651
+ };
652
+ var initRandomFill = () => {
653
+ if (ENVIRONMENT_IS_NODE) {
654
+ var nodeCrypto = require2("node:crypto");
655
+ return (view) => nodeCrypto.randomFillSync(view);
656
+ }
657
+ return (view) => crypto.getRandomValues(view);
658
+ };
659
+ var randomFill = (view) => {
660
+ (randomFill = initRandomFill())(view);
661
+ };
662
+ var PATH_FS = {
663
+ resolve: (...args) => {
664
+ var resolvedPath = "", resolvedAbsolute = false;
665
+ for (var i = args.length - 1; i >= -1 && !resolvedAbsolute; i--) {
666
+ var path = i >= 0 ? args[i] : FS.cwd();
667
+ if (typeof path != "string") {
668
+ throw new TypeError("Arguments to path.resolve must be strings");
669
+ } else if (!path) {
670
+ return "";
671
+ }
672
+ resolvedPath = path + "/" + resolvedPath;
673
+ resolvedAbsolute = PATH.isAbs(path);
674
+ }
675
+ resolvedPath = PATH.normalizeArray(resolvedPath.split("/").filter((p) => !!p), !resolvedAbsolute).join("/");
676
+ return (resolvedAbsolute ? "/" : "") + resolvedPath || ".";
677
+ },
678
+ relative: (from, to) => {
679
+ from = PATH_FS.resolve(from).slice(1);
680
+ to = PATH_FS.resolve(to).slice(1);
681
+ function trim(arr) {
682
+ var start = 0;
683
+ for (; start < arr.length; start++) {
684
+ if (arr[start] !== "") break;
685
+ }
686
+ var end = arr.length - 1;
687
+ for (; end >= 0; end--) {
688
+ if (arr[end] !== "") break;
689
+ }
690
+ if (start > end) return [];
691
+ return arr.slice(start, end - start + 1);
692
+ }
693
+ var fromParts = trim(from.split("/"));
694
+ var toParts = trim(to.split("/"));
695
+ var length = Math.min(fromParts.length, toParts.length);
696
+ var samePartsLength = length;
697
+ for (var i = 0; i < length; i++) {
698
+ if (fromParts[i] !== toParts[i]) {
699
+ samePartsLength = i;
700
+ break;
701
+ }
702
+ }
703
+ var outputParts = [];
704
+ for (var i = samePartsLength; i < fromParts.length; i++) {
705
+ outputParts.push("..");
706
+ }
707
+ outputParts = outputParts.concat(toParts.slice(samePartsLength));
708
+ return outputParts.join("/");
709
+ }
710
+ };
711
+ var FS_stdin_getChar_buffer = [];
712
+ var lengthBytesUTF8 = (str) => {
713
+ var len = 0;
714
+ for (var i = 0; i < str.length; ++i) {
715
+ var c = str.charCodeAt(i);
716
+ if (c <= 127) {
717
+ len++;
718
+ } else if (c <= 2047) {
719
+ len += 2;
720
+ } else if (c >= 55296 && c <= 57343) {
721
+ len += 4;
722
+ ++i;
723
+ } else {
724
+ len += 3;
725
+ }
726
+ }
727
+ return len;
728
+ };
729
+ var stringToUTF8Array = (str, heap, outIdx, maxBytesToWrite) => {
730
+ assert(typeof str === "string", `stringToUTF8Array expects a string (got ${typeof str})`);
731
+ if (!(maxBytesToWrite > 0))
732
+ return 0;
733
+ var startIdx = outIdx;
734
+ var endIdx = outIdx + maxBytesToWrite - 1;
735
+ for (var i = 0; i < str.length; ++i) {
736
+ var u = str.codePointAt(i);
737
+ if (u <= 127) {
738
+ if (outIdx >= endIdx) break;
739
+ heap[outIdx++] = u;
740
+ } else if (u <= 2047) {
741
+ if (outIdx + 1 >= endIdx) break;
742
+ heap[outIdx++] = 192 | u >> 6;
743
+ heap[outIdx++] = 128 | u & 63;
744
+ } else if (u <= 65535) {
745
+ if (outIdx + 2 >= endIdx) break;
746
+ heap[outIdx++] = 224 | u >> 12;
747
+ heap[outIdx++] = 128 | u >> 6 & 63;
748
+ heap[outIdx++] = 128 | u & 63;
749
+ } else {
750
+ if (outIdx + 3 >= endIdx) break;
751
+ if (u > 1114111) warnOnce("Invalid Unicode code point " + ptrToString(u) + " encountered when serializing a JS string to a UTF-8 string in wasm memory! (Valid unicode code points should be in range 0-0x10FFFF).");
752
+ heap[outIdx++] = 240 | u >> 18;
753
+ heap[outIdx++] = 128 | u >> 12 & 63;
754
+ heap[outIdx++] = 128 | u >> 6 & 63;
755
+ heap[outIdx++] = 128 | u & 63;
756
+ i++;
757
+ }
758
+ }
759
+ heap[outIdx] = 0;
760
+ return outIdx - startIdx;
761
+ };
762
+ var intArrayFromString = (stringy, dontAddNull, length) => {
763
+ var len = length > 0 ? length : lengthBytesUTF8(stringy) + 1;
764
+ var u8array = new Array(len);
765
+ var numBytesWritten = stringToUTF8Array(stringy, u8array, 0, u8array.length);
766
+ if (dontAddNull) u8array.length = numBytesWritten;
767
+ return u8array;
768
+ };
769
+ var FS_stdin_getChar = () => {
770
+ if (!FS_stdin_getChar_buffer.length) {
771
+ var result = null;
772
+ if (ENVIRONMENT_IS_NODE) {
773
+ var BUFSIZE = 256;
774
+ var buf = Buffer.alloc(BUFSIZE);
775
+ var bytesRead = 0;
776
+ var fd = process.stdin.fd;
777
+ try {
778
+ bytesRead = fs.readSync(fd, buf, 0, BUFSIZE);
779
+ } catch (e) {
780
+ if (e.toString().includes("EOF")) bytesRead = 0;
781
+ else throw e;
782
+ }
783
+ if (bytesRead > 0) {
784
+ result = buf.slice(0, bytesRead).toString("utf-8");
785
+ }
786
+ } else if (globalThis.window?.prompt) {
787
+ result = window.prompt("Input: ");
788
+ if (result !== null) {
789
+ result += "\n";
790
+ }
791
+ } else {
792
+ }
793
+ if (!result) {
794
+ return null;
795
+ }
796
+ FS_stdin_getChar_buffer = intArrayFromString(result, true);
797
+ }
798
+ return FS_stdin_getChar_buffer.shift();
799
+ };
800
+ var TTY = {
801
+ ttys: [],
802
+ init() {
803
+ },
804
+ shutdown() {
805
+ },
806
+ register(dev, ops) {
807
+ TTY.ttys[dev] = { input: [], output: [], ops };
808
+ FS.registerDevice(dev, TTY.stream_ops);
809
+ },
810
+ stream_ops: {
811
+ open(stream) {
812
+ var tty = TTY.ttys[stream.node.rdev];
813
+ if (!tty) {
814
+ throw new FS.ErrnoError(43);
815
+ }
816
+ stream.tty = tty;
817
+ stream.seekable = false;
818
+ },
819
+ close(stream) {
820
+ stream.tty.ops.fsync(stream.tty);
821
+ },
822
+ fsync(stream) {
823
+ stream.tty.ops.fsync(stream.tty);
824
+ },
825
+ read(stream, buffer, offset, length, pos) {
826
+ if (!stream.tty || !stream.tty.ops.get_char) {
827
+ throw new FS.ErrnoError(60);
828
+ }
829
+ var bytesRead = 0;
830
+ for (var i = 0; i < length; i++) {
831
+ var result;
832
+ try {
833
+ result = stream.tty.ops.get_char(stream.tty);
834
+ } catch (e) {
835
+ throw new FS.ErrnoError(29);
836
+ }
837
+ if (result === void 0 && bytesRead === 0) {
838
+ throw new FS.ErrnoError(6);
839
+ }
840
+ if (result === null || result === void 0) break;
841
+ bytesRead++;
842
+ buffer[offset + i] = result;
843
+ }
844
+ if (bytesRead) {
845
+ stream.node.atime = Date.now();
846
+ }
847
+ return bytesRead;
848
+ },
849
+ write(stream, buffer, offset, length, pos) {
850
+ if (!stream.tty || !stream.tty.ops.put_char) {
851
+ throw new FS.ErrnoError(60);
852
+ }
853
+ try {
854
+ for (var i = 0; i < length; i++) {
855
+ stream.tty.ops.put_char(stream.tty, buffer[offset + i]);
856
+ }
857
+ } catch (e) {
858
+ throw new FS.ErrnoError(29);
859
+ }
860
+ if (length) {
861
+ stream.node.mtime = stream.node.ctime = Date.now();
862
+ }
863
+ return i;
864
+ }
865
+ },
866
+ default_tty_ops: {
867
+ get_char(tty) {
868
+ return FS_stdin_getChar();
869
+ },
870
+ put_char(tty, val) {
871
+ if (val === null || val === 10) {
872
+ out(UTF8ArrayToString(tty.output));
873
+ tty.output = [];
874
+ } else {
875
+ if (val != 0) tty.output.push(val);
876
+ }
877
+ },
878
+ fsync(tty) {
879
+ if (tty.output?.length > 0) {
880
+ out(UTF8ArrayToString(tty.output));
881
+ tty.output = [];
882
+ }
883
+ },
884
+ ioctl_tcgets(tty) {
885
+ return {
886
+ c_iflag: 25856,
887
+ c_oflag: 5,
888
+ c_cflag: 191,
889
+ c_lflag: 35387,
890
+ c_cc: [
891
+ 3,
892
+ 28,
893
+ 127,
894
+ 21,
895
+ 4,
896
+ 0,
897
+ 1,
898
+ 0,
899
+ 17,
900
+ 19,
901
+ 26,
902
+ 0,
903
+ 18,
904
+ 15,
905
+ 23,
906
+ 22,
907
+ 0,
908
+ 0,
909
+ 0,
910
+ 0,
911
+ 0,
912
+ 0,
913
+ 0,
914
+ 0,
915
+ 0,
916
+ 0,
917
+ 0,
918
+ 0,
919
+ 0,
920
+ 0,
921
+ 0,
922
+ 0
923
+ ]
924
+ };
925
+ },
926
+ ioctl_tcsets(tty, optional_actions, data) {
927
+ return 0;
928
+ },
929
+ ioctl_tiocgwinsz(tty) {
930
+ return [24, 80];
931
+ }
932
+ },
933
+ default_tty1_ops: {
934
+ put_char(tty, val) {
935
+ if (val === null || val === 10) {
936
+ err(UTF8ArrayToString(tty.output));
937
+ tty.output = [];
938
+ } else {
939
+ if (val != 0) tty.output.push(val);
940
+ }
941
+ },
942
+ fsync(tty) {
943
+ if (tty.output?.length > 0) {
944
+ err(UTF8ArrayToString(tty.output));
945
+ tty.output = [];
946
+ }
947
+ }
948
+ }
949
+ };
950
+ var zeroMemory = (ptr, size) => HEAPU8.fill(0, ptr, ptr + size);
951
+ var alignMemory = (size, alignment) => {
952
+ assert(alignment, "alignment argument is required");
953
+ return Math.ceil(size / alignment) * alignment;
954
+ };
955
+ var mmapAlloc = (size) => {
956
+ size = alignMemory(size, 65536);
957
+ var ptr = _emscripten_builtin_memalign(65536, size);
958
+ if (ptr) zeroMemory(ptr, size);
959
+ return ptr;
960
+ };
961
+ var MEMFS = {
962
+ ops_table: null,
963
+ mount(mount) {
964
+ return MEMFS.createNode(null, "/", 16895, 0);
965
+ },
966
+ createNode(parent, name, mode, dev) {
967
+ if (FS.isBlkdev(mode) || FS.isFIFO(mode)) {
968
+ throw new FS.ErrnoError(63);
969
+ }
970
+ MEMFS.ops_table ||= {
971
+ dir: {
972
+ node: {
973
+ getattr: MEMFS.node_ops.getattr,
974
+ setattr: MEMFS.node_ops.setattr,
975
+ lookup: MEMFS.node_ops.lookup,
976
+ mknod: MEMFS.node_ops.mknod,
977
+ rename: MEMFS.node_ops.rename,
978
+ unlink: MEMFS.node_ops.unlink,
979
+ rmdir: MEMFS.node_ops.rmdir,
980
+ readdir: MEMFS.node_ops.readdir,
981
+ symlink: MEMFS.node_ops.symlink
982
+ },
983
+ stream: {
984
+ llseek: MEMFS.stream_ops.llseek
985
+ }
986
+ },
987
+ file: {
988
+ node: {
989
+ getattr: MEMFS.node_ops.getattr,
990
+ setattr: MEMFS.node_ops.setattr
991
+ },
992
+ stream: {
993
+ llseek: MEMFS.stream_ops.llseek,
994
+ read: MEMFS.stream_ops.read,
995
+ write: MEMFS.stream_ops.write,
996
+ mmap: MEMFS.stream_ops.mmap,
997
+ msync: MEMFS.stream_ops.msync
998
+ }
999
+ },
1000
+ link: {
1001
+ node: {
1002
+ getattr: MEMFS.node_ops.getattr,
1003
+ setattr: MEMFS.node_ops.setattr,
1004
+ readlink: MEMFS.node_ops.readlink
1005
+ },
1006
+ stream: {}
1007
+ },
1008
+ chrdev: {
1009
+ node: {
1010
+ getattr: MEMFS.node_ops.getattr,
1011
+ setattr: MEMFS.node_ops.setattr
1012
+ },
1013
+ stream: FS.chrdev_stream_ops
1014
+ }
1015
+ };
1016
+ var node = FS.createNode(parent, name, mode, dev);
1017
+ if (FS.isDir(node.mode)) {
1018
+ node.node_ops = MEMFS.ops_table.dir.node;
1019
+ node.stream_ops = MEMFS.ops_table.dir.stream;
1020
+ node.contents = {};
1021
+ } else if (FS.isFile(node.mode)) {
1022
+ node.node_ops = MEMFS.ops_table.file.node;
1023
+ node.stream_ops = MEMFS.ops_table.file.stream;
1024
+ node.usedBytes = 0;
1025
+ node.contents = null;
1026
+ } else if (FS.isLink(node.mode)) {
1027
+ node.node_ops = MEMFS.ops_table.link.node;
1028
+ node.stream_ops = MEMFS.ops_table.link.stream;
1029
+ } else if (FS.isChrdev(node.mode)) {
1030
+ node.node_ops = MEMFS.ops_table.chrdev.node;
1031
+ node.stream_ops = MEMFS.ops_table.chrdev.stream;
1032
+ }
1033
+ node.atime = node.mtime = node.ctime = Date.now();
1034
+ if (parent) {
1035
+ parent.contents[name] = node;
1036
+ parent.atime = parent.mtime = parent.ctime = node.atime;
1037
+ }
1038
+ return node;
1039
+ },
1040
+ getFileDataAsTypedArray(node) {
1041
+ if (!node.contents) return new Uint8Array(0);
1042
+ if (node.contents.subarray) return node.contents.subarray(0, node.usedBytes);
1043
+ return new Uint8Array(node.contents);
1044
+ },
1045
+ expandFileStorage(node, newCapacity) {
1046
+ var prevCapacity = node.contents ? node.contents.length : 0;
1047
+ if (prevCapacity >= newCapacity) return;
1048
+ var CAPACITY_DOUBLING_MAX = 1024 * 1024;
1049
+ newCapacity = Math.max(newCapacity, prevCapacity * (prevCapacity < CAPACITY_DOUBLING_MAX ? 2 : 1.125) >>> 0);
1050
+ if (prevCapacity != 0) newCapacity = Math.max(newCapacity, 256);
1051
+ var oldContents = node.contents;
1052
+ node.contents = new Uint8Array(newCapacity);
1053
+ if (node.usedBytes > 0) node.contents.set(oldContents.subarray(0, node.usedBytes), 0);
1054
+ },
1055
+ resizeFileStorage(node, newSize) {
1056
+ if (node.usedBytes == newSize) return;
1057
+ if (newSize == 0) {
1058
+ node.contents = null;
1059
+ node.usedBytes = 0;
1060
+ } else {
1061
+ var oldContents = node.contents;
1062
+ node.contents = new Uint8Array(newSize);
1063
+ if (oldContents) {
1064
+ node.contents.set(oldContents.subarray(0, Math.min(newSize, node.usedBytes)));
1065
+ }
1066
+ node.usedBytes = newSize;
1067
+ }
1068
+ },
1069
+ node_ops: {
1070
+ getattr(node) {
1071
+ var attr = {};
1072
+ attr.dev = FS.isChrdev(node.mode) ? node.id : 1;
1073
+ attr.ino = node.id;
1074
+ attr.mode = node.mode;
1075
+ attr.nlink = 1;
1076
+ attr.uid = 0;
1077
+ attr.gid = 0;
1078
+ attr.rdev = node.rdev;
1079
+ if (FS.isDir(node.mode)) {
1080
+ attr.size = 4096;
1081
+ } else if (FS.isFile(node.mode)) {
1082
+ attr.size = node.usedBytes;
1083
+ } else if (FS.isLink(node.mode)) {
1084
+ attr.size = node.link.length;
1085
+ } else {
1086
+ attr.size = 0;
1087
+ }
1088
+ attr.atime = new Date(node.atime);
1089
+ attr.mtime = new Date(node.mtime);
1090
+ attr.ctime = new Date(node.ctime);
1091
+ attr.blksize = 4096;
1092
+ attr.blocks = Math.ceil(attr.size / attr.blksize);
1093
+ return attr;
1094
+ },
1095
+ setattr(node, attr) {
1096
+ for (const key of ["mode", "atime", "mtime", "ctime"]) {
1097
+ if (attr[key] != null) {
1098
+ node[key] = attr[key];
1099
+ }
1100
+ }
1101
+ if (attr.size !== void 0) {
1102
+ MEMFS.resizeFileStorage(node, attr.size);
1103
+ }
1104
+ },
1105
+ lookup(parent, name) {
1106
+ throw new FS.ErrnoError(44);
1107
+ },
1108
+ mknod(parent, name, mode, dev) {
1109
+ return MEMFS.createNode(parent, name, mode, dev);
1110
+ },
1111
+ rename(old_node, new_dir, new_name) {
1112
+ var new_node;
1113
+ try {
1114
+ new_node = FS.lookupNode(new_dir, new_name);
1115
+ } catch (e) {
1116
+ }
1117
+ if (new_node) {
1118
+ if (FS.isDir(old_node.mode)) {
1119
+ for (var i in new_node.contents) {
1120
+ throw new FS.ErrnoError(55);
1121
+ }
1122
+ }
1123
+ FS.hashRemoveNode(new_node);
1124
+ }
1125
+ delete old_node.parent.contents[old_node.name];
1126
+ new_dir.contents[new_name] = old_node;
1127
+ old_node.name = new_name;
1128
+ new_dir.ctime = new_dir.mtime = old_node.parent.ctime = old_node.parent.mtime = Date.now();
1129
+ },
1130
+ unlink(parent, name) {
1131
+ delete parent.contents[name];
1132
+ parent.ctime = parent.mtime = Date.now();
1133
+ },
1134
+ rmdir(parent, name) {
1135
+ var node = FS.lookupNode(parent, name);
1136
+ for (var i in node.contents) {
1137
+ throw new FS.ErrnoError(55);
1138
+ }
1139
+ delete parent.contents[name];
1140
+ parent.ctime = parent.mtime = Date.now();
1141
+ },
1142
+ readdir(node) {
1143
+ return [".", "..", ...Object.keys(node.contents)];
1144
+ },
1145
+ symlink(parent, newname, oldpath) {
1146
+ var node = MEMFS.createNode(parent, newname, 511 | 40960, 0);
1147
+ node.link = oldpath;
1148
+ return node;
1149
+ },
1150
+ readlink(node) {
1151
+ if (!FS.isLink(node.mode)) {
1152
+ throw new FS.ErrnoError(28);
1153
+ }
1154
+ return node.link;
1155
+ }
1156
+ },
1157
+ stream_ops: {
1158
+ read(stream, buffer, offset, length, position) {
1159
+ var contents = stream.node.contents;
1160
+ if (position >= stream.node.usedBytes) return 0;
1161
+ var size = Math.min(stream.node.usedBytes - position, length);
1162
+ assert(size >= 0);
1163
+ if (size > 8 && contents.subarray) {
1164
+ buffer.set(contents.subarray(position, position + size), offset);
1165
+ } else {
1166
+ for (var i = 0; i < size; i++) buffer[offset + i] = contents[position + i];
1167
+ }
1168
+ return size;
1169
+ },
1170
+ write(stream, buffer, offset, length, position, canOwn) {
1171
+ assert(!(buffer instanceof ArrayBuffer));
1172
+ if (buffer.buffer === HEAP8.buffer) {
1173
+ canOwn = false;
1174
+ }
1175
+ if (!length) return 0;
1176
+ var node = stream.node;
1177
+ node.mtime = node.ctime = Date.now();
1178
+ if (buffer.subarray && (!node.contents || node.contents.subarray)) {
1179
+ if (canOwn) {
1180
+ assert(position === 0, "canOwn must imply no weird position inside the file");
1181
+ node.contents = buffer.subarray(offset, offset + length);
1182
+ node.usedBytes = length;
1183
+ return length;
1184
+ } else if (node.usedBytes === 0 && position === 0) {
1185
+ node.contents = buffer.slice(offset, offset + length);
1186
+ node.usedBytes = length;
1187
+ return length;
1188
+ } else if (position + length <= node.usedBytes) {
1189
+ node.contents.set(buffer.subarray(offset, offset + length), position);
1190
+ return length;
1191
+ }
1192
+ }
1193
+ MEMFS.expandFileStorage(node, position + length);
1194
+ if (node.contents.subarray && buffer.subarray) {
1195
+ node.contents.set(buffer.subarray(offset, offset + length), position);
1196
+ } else {
1197
+ for (var i = 0; i < length; i++) {
1198
+ node.contents[position + i] = buffer[offset + i];
1199
+ }
1200
+ }
1201
+ node.usedBytes = Math.max(node.usedBytes, position + length);
1202
+ return length;
1203
+ },
1204
+ llseek(stream, offset, whence) {
1205
+ var position = offset;
1206
+ if (whence === 1) {
1207
+ position += stream.position;
1208
+ } else if (whence === 2) {
1209
+ if (FS.isFile(stream.node.mode)) {
1210
+ position += stream.node.usedBytes;
1211
+ }
1212
+ }
1213
+ if (position < 0) {
1214
+ throw new FS.ErrnoError(28);
1215
+ }
1216
+ return position;
1217
+ },
1218
+ mmap(stream, length, position, prot, flags) {
1219
+ if (!FS.isFile(stream.node.mode)) {
1220
+ throw new FS.ErrnoError(43);
1221
+ }
1222
+ var ptr;
1223
+ var allocated;
1224
+ var contents = stream.node.contents;
1225
+ if (!(flags & 2) && contents && contents.buffer === HEAP8.buffer) {
1226
+ allocated = false;
1227
+ ptr = contents.byteOffset;
1228
+ } else {
1229
+ allocated = true;
1230
+ ptr = mmapAlloc(length);
1231
+ if (!ptr) {
1232
+ throw new FS.ErrnoError(48);
1233
+ }
1234
+ if (contents) {
1235
+ if (position > 0 || position + length < contents.length) {
1236
+ if (contents.subarray) {
1237
+ contents = contents.subarray(position, position + length);
1238
+ } else {
1239
+ contents = Array.prototype.slice.call(contents, position, position + length);
1240
+ }
1241
+ }
1242
+ HEAP8.set(contents, ptr);
1243
+ }
1244
+ }
1245
+ return { ptr, allocated };
1246
+ },
1247
+ msync(stream, buffer, offset, length, mmapFlags) {
1248
+ MEMFS.stream_ops.write(stream, buffer, 0, length, offset, false);
1249
+ return 0;
1250
+ }
1251
+ }
1252
+ };
1253
+ var FS_modeStringToFlags = (str) => {
1254
+ var flagModes = {
1255
+ "r": 0,
1256
+ "r+": 2,
1257
+ "w": 512 | 64 | 1,
1258
+ "w+": 512 | 64 | 2,
1259
+ "a": 1024 | 64 | 1,
1260
+ "a+": 1024 | 64 | 2
1261
+ };
1262
+ var flags = flagModes[str];
1263
+ if (typeof flags == "undefined") {
1264
+ throw new Error(`Unknown file open mode: ${str}`);
1265
+ }
1266
+ return flags;
1267
+ };
1268
+ var FS_getMode = (canRead, canWrite) => {
1269
+ var mode = 0;
1270
+ if (canRead) mode |= 292 | 73;
1271
+ if (canWrite) mode |= 146;
1272
+ return mode;
1273
+ };
1274
+ var strError = (errno) => UTF8ToString(_strerror(errno));
1275
+ var ERRNO_CODES = {
1276
+ "EPERM": 63,
1277
+ "ENOENT": 44,
1278
+ "ESRCH": 71,
1279
+ "EINTR": 27,
1280
+ "EIO": 29,
1281
+ "ENXIO": 60,
1282
+ "E2BIG": 1,
1283
+ "ENOEXEC": 45,
1284
+ "EBADF": 8,
1285
+ "ECHILD": 12,
1286
+ "EAGAIN": 6,
1287
+ "EWOULDBLOCK": 6,
1288
+ "ENOMEM": 48,
1289
+ "EACCES": 2,
1290
+ "EFAULT": 21,
1291
+ "ENOTBLK": 105,
1292
+ "EBUSY": 10,
1293
+ "EEXIST": 20,
1294
+ "EXDEV": 75,
1295
+ "ENODEV": 43,
1296
+ "ENOTDIR": 54,
1297
+ "EISDIR": 31,
1298
+ "EINVAL": 28,
1299
+ "ENFILE": 41,
1300
+ "EMFILE": 33,
1301
+ "ENOTTY": 59,
1302
+ "ETXTBSY": 74,
1303
+ "EFBIG": 22,
1304
+ "ENOSPC": 51,
1305
+ "ESPIPE": 70,
1306
+ "EROFS": 69,
1307
+ "EMLINK": 34,
1308
+ "EPIPE": 64,
1309
+ "EDOM": 18,
1310
+ "ERANGE": 68,
1311
+ "ENOMSG": 49,
1312
+ "EIDRM": 24,
1313
+ "ECHRNG": 106,
1314
+ "EL2NSYNC": 156,
1315
+ "EL3HLT": 107,
1316
+ "EL3RST": 108,
1317
+ "ELNRNG": 109,
1318
+ "EUNATCH": 110,
1319
+ "ENOCSI": 111,
1320
+ "EL2HLT": 112,
1321
+ "EDEADLK": 16,
1322
+ "ENOLCK": 46,
1323
+ "EBADE": 113,
1324
+ "EBADR": 114,
1325
+ "EXFULL": 115,
1326
+ "ENOANO": 104,
1327
+ "EBADRQC": 103,
1328
+ "EBADSLT": 102,
1329
+ "EDEADLOCK": 16,
1330
+ "EBFONT": 101,
1331
+ "ENOSTR": 100,
1332
+ "ENODATA": 116,
1333
+ "ETIME": 117,
1334
+ "ENOSR": 118,
1335
+ "ENONET": 119,
1336
+ "ENOPKG": 120,
1337
+ "EREMOTE": 121,
1338
+ "ENOLINK": 47,
1339
+ "EADV": 122,
1340
+ "ESRMNT": 123,
1341
+ "ECOMM": 124,
1342
+ "EPROTO": 65,
1343
+ "EMULTIHOP": 36,
1344
+ "EDOTDOT": 125,
1345
+ "EBADMSG": 9,
1346
+ "ENOTUNIQ": 126,
1347
+ "EBADFD": 127,
1348
+ "EREMCHG": 128,
1349
+ "ELIBACC": 129,
1350
+ "ELIBBAD": 130,
1351
+ "ELIBSCN": 131,
1352
+ "ELIBMAX": 132,
1353
+ "ELIBEXEC": 133,
1354
+ "ENOSYS": 52,
1355
+ "ENOTEMPTY": 55,
1356
+ "ENAMETOOLONG": 37,
1357
+ "ELOOP": 32,
1358
+ "EOPNOTSUPP": 138,
1359
+ "EPFNOSUPPORT": 139,
1360
+ "ECONNRESET": 15,
1361
+ "ENOBUFS": 42,
1362
+ "EAFNOSUPPORT": 5,
1363
+ "EPROTOTYPE": 67,
1364
+ "ENOTSOCK": 57,
1365
+ "ENOPROTOOPT": 50,
1366
+ "ESHUTDOWN": 140,
1367
+ "ECONNREFUSED": 14,
1368
+ "EADDRINUSE": 3,
1369
+ "ECONNABORTED": 13,
1370
+ "ENETUNREACH": 40,
1371
+ "ENETDOWN": 38,
1372
+ "ETIMEDOUT": 73,
1373
+ "EHOSTDOWN": 142,
1374
+ "EHOSTUNREACH": 23,
1375
+ "EINPROGRESS": 26,
1376
+ "EALREADY": 7,
1377
+ "EDESTADDRREQ": 17,
1378
+ "EMSGSIZE": 35,
1379
+ "EPROTONOSUPPORT": 66,
1380
+ "ESOCKTNOSUPPORT": 137,
1381
+ "EADDRNOTAVAIL": 4,
1382
+ "ENETRESET": 39,
1383
+ "EISCONN": 30,
1384
+ "ENOTCONN": 53,
1385
+ "ETOOMANYREFS": 141,
1386
+ "EUSERS": 136,
1387
+ "EDQUOT": 19,
1388
+ "ESTALE": 72,
1389
+ "ENOTSUP": 138,
1390
+ "ENOMEDIUM": 148,
1391
+ "EILSEQ": 25,
1392
+ "EOVERFLOW": 61,
1393
+ "ECANCELED": 11,
1394
+ "ENOTRECOVERABLE": 56,
1395
+ "EOWNERDEAD": 62,
1396
+ "ESTRPIPE": 135
1397
+ };
1398
+ var asyncLoad = async (url) => {
1399
+ var arrayBuffer = await readAsync(url);
1400
+ assert(arrayBuffer, `Loading data file "${url}" failed (no arrayBuffer).`);
1401
+ return new Uint8Array(arrayBuffer);
1402
+ };
1403
+ var FS_createDataFile = (...args) => FS.createDataFile(...args);
1404
+ var getUniqueRunDependency = (id) => {
1405
+ var orig = id;
1406
+ while (1) {
1407
+ if (!runDependencyTracking[id]) return id;
1408
+ id = orig + Math.random();
1409
+ }
1410
+ };
1411
+ var runDependencies = 0;
1412
+ var dependenciesFulfilled = null;
1413
+ var runDependencyTracking = {};
1414
+ var runDependencyWatcher = null;
1415
+ var removeRunDependency = (id) => {
1416
+ runDependencies--;
1417
+ Module["monitorRunDependencies"]?.(runDependencies);
1418
+ assert(id, "removeRunDependency requires an ID");
1419
+ assert(runDependencyTracking[id]);
1420
+ delete runDependencyTracking[id];
1421
+ if (runDependencies == 0) {
1422
+ if (runDependencyWatcher !== null) {
1423
+ clearInterval(runDependencyWatcher);
1424
+ runDependencyWatcher = null;
1425
+ }
1426
+ if (dependenciesFulfilled) {
1427
+ var callback = dependenciesFulfilled;
1428
+ dependenciesFulfilled = null;
1429
+ callback();
1430
+ }
1431
+ }
1432
+ };
1433
+ var addRunDependency = (id) => {
1434
+ runDependencies++;
1435
+ Module["monitorRunDependencies"]?.(runDependencies);
1436
+ assert(id, "addRunDependency requires an ID");
1437
+ assert(!runDependencyTracking[id]);
1438
+ runDependencyTracking[id] = 1;
1439
+ if (runDependencyWatcher === null && globalThis.setInterval) {
1440
+ runDependencyWatcher = setInterval(() => {
1441
+ if (ABORT) {
1442
+ clearInterval(runDependencyWatcher);
1443
+ runDependencyWatcher = null;
1444
+ return;
1445
+ }
1446
+ var shown = false;
1447
+ for (var dep in runDependencyTracking) {
1448
+ if (!shown) {
1449
+ shown = true;
1450
+ err("still waiting on run dependencies:");
1451
+ }
1452
+ err(`dependency: ${dep}`);
1453
+ }
1454
+ if (shown) {
1455
+ err("(end of list)");
1456
+ }
1457
+ }, 1e4);
1458
+ runDependencyWatcher.unref?.();
1459
+ }
1460
+ };
1461
+ var preloadPlugins = [];
1462
+ var FS_handledByPreloadPlugin = async (byteArray, fullname) => {
1463
+ if (typeof Browser != "undefined") Browser.init();
1464
+ for (var plugin of preloadPlugins) {
1465
+ if (plugin["canHandle"](fullname)) {
1466
+ assert(plugin["handle"].constructor.name === "AsyncFunction", "Filesystem plugin handlers must be async functions (See #24914)");
1467
+ return plugin["handle"](byteArray, fullname);
1468
+ }
1469
+ }
1470
+ return byteArray;
1471
+ };
1472
+ var FS_preloadFile = async (parent, name, url, canRead, canWrite, dontCreateFile, canOwn, preFinish) => {
1473
+ var fullname = name ? PATH_FS.resolve(PATH.join2(parent, name)) : parent;
1474
+ var dep = getUniqueRunDependency(`cp ${fullname}`);
1475
+ addRunDependency(dep);
1476
+ try {
1477
+ var byteArray = url;
1478
+ if (typeof url == "string") {
1479
+ byteArray = await asyncLoad(url);
1480
+ }
1481
+ byteArray = await FS_handledByPreloadPlugin(byteArray, fullname);
1482
+ preFinish?.();
1483
+ if (!dontCreateFile) {
1484
+ FS_createDataFile(parent, name, byteArray, canRead, canWrite, canOwn);
1485
+ }
1486
+ } finally {
1487
+ removeRunDependency(dep);
1488
+ }
1489
+ };
1490
+ var FS_createPreloadedFile = (parent, name, url, canRead, canWrite, onload, onerror, dontCreateFile, canOwn, preFinish) => {
1491
+ FS_preloadFile(parent, name, url, canRead, canWrite, dontCreateFile, canOwn, preFinish).then(onload).catch(onerror);
1492
+ };
1493
+ var FS = {
1494
+ root: null,
1495
+ mounts: [],
1496
+ devices: {},
1497
+ streams: [],
1498
+ nextInode: 1,
1499
+ nameTable: null,
1500
+ currentPath: "/",
1501
+ initialized: false,
1502
+ ignorePermissions: true,
1503
+ filesystems: null,
1504
+ syncFSRequests: 0,
1505
+ ErrnoError: class extends Error {
1506
+ name = "ErrnoError";
1507
+ // We set the `name` property to be able to identify `FS.ErrnoError`
1508
+ // - the `name` is a standard ECMA-262 property of error objects. Kind of good to have it anyway.
1509
+ // - when using PROXYFS, an error can come from an underlying FS
1510
+ // as different FS objects have their own FS.ErrnoError each,
1511
+ // the test `err instanceof FS.ErrnoError` won't detect an error coming from another filesystem, causing bugs.
1512
+ // we'll use the reliable test `err.name == "ErrnoError"` instead
1513
+ constructor(errno) {
1514
+ super(runtimeInitialized ? strError(errno) : "");
1515
+ this.errno = errno;
1516
+ for (var key in ERRNO_CODES) {
1517
+ if (ERRNO_CODES[key] === errno) {
1518
+ this.code = key;
1519
+ break;
1520
+ }
1521
+ }
1522
+ }
1523
+ },
1524
+ FSStream: class {
1525
+ shared = {};
1526
+ get object() {
1527
+ return this.node;
1528
+ }
1529
+ set object(val) {
1530
+ this.node = val;
1531
+ }
1532
+ get isRead() {
1533
+ return (this.flags & 2097155) !== 1;
1534
+ }
1535
+ get isWrite() {
1536
+ return (this.flags & 2097155) !== 0;
1537
+ }
1538
+ get isAppend() {
1539
+ return this.flags & 1024;
1540
+ }
1541
+ get flags() {
1542
+ return this.shared.flags;
1543
+ }
1544
+ set flags(val) {
1545
+ this.shared.flags = val;
1546
+ }
1547
+ get position() {
1548
+ return this.shared.position;
1549
+ }
1550
+ set position(val) {
1551
+ this.shared.position = val;
1552
+ }
1553
+ },
1554
+ FSNode: class {
1555
+ node_ops = {};
1556
+ stream_ops = {};
1557
+ readMode = 292 | 73;
1558
+ writeMode = 146;
1559
+ mounted = null;
1560
+ constructor(parent, name, mode, rdev) {
1561
+ if (!parent) {
1562
+ parent = this;
1563
+ }
1564
+ this.parent = parent;
1565
+ this.mount = parent.mount;
1566
+ this.id = FS.nextInode++;
1567
+ this.name = name;
1568
+ this.mode = mode;
1569
+ this.rdev = rdev;
1570
+ this.atime = this.mtime = this.ctime = Date.now();
1571
+ }
1572
+ get read() {
1573
+ return (this.mode & this.readMode) === this.readMode;
1574
+ }
1575
+ set read(val) {
1576
+ val ? this.mode |= this.readMode : this.mode &= ~this.readMode;
1577
+ }
1578
+ get write() {
1579
+ return (this.mode & this.writeMode) === this.writeMode;
1580
+ }
1581
+ set write(val) {
1582
+ val ? this.mode |= this.writeMode : this.mode &= ~this.writeMode;
1583
+ }
1584
+ get isFolder() {
1585
+ return FS.isDir(this.mode);
1586
+ }
1587
+ get isDevice() {
1588
+ return FS.isChrdev(this.mode);
1589
+ }
1590
+ },
1591
+ lookupPath(path, opts = {}) {
1592
+ if (!path) {
1593
+ throw new FS.ErrnoError(44);
1594
+ }
1595
+ opts.follow_mount ??= true;
1596
+ if (!PATH.isAbs(path)) {
1597
+ path = FS.cwd() + "/" + path;
1598
+ }
1599
+ linkloop: for (var nlinks = 0; nlinks < 40; nlinks++) {
1600
+ var parts = path.split("/").filter((p) => !!p);
1601
+ var current = FS.root;
1602
+ var current_path = "/";
1603
+ for (var i = 0; i < parts.length; i++) {
1604
+ var islast = i === parts.length - 1;
1605
+ if (islast && opts.parent) {
1606
+ break;
1607
+ }
1608
+ if (parts[i] === ".") {
1609
+ continue;
1610
+ }
1611
+ if (parts[i] === "..") {
1612
+ current_path = PATH.dirname(current_path);
1613
+ if (FS.isRoot(current)) {
1614
+ path = current_path + "/" + parts.slice(i + 1).join("/");
1615
+ nlinks--;
1616
+ continue linkloop;
1617
+ } else {
1618
+ current = current.parent;
1619
+ }
1620
+ continue;
1621
+ }
1622
+ current_path = PATH.join2(current_path, parts[i]);
1623
+ try {
1624
+ current = FS.lookupNode(current, parts[i]);
1625
+ } catch (e) {
1626
+ if (e?.errno === 44 && islast && opts.noent_okay) {
1627
+ return { path: current_path };
1628
+ }
1629
+ throw e;
1630
+ }
1631
+ if (FS.isMountpoint(current) && (!islast || opts.follow_mount)) {
1632
+ current = current.mounted.root;
1633
+ }
1634
+ if (FS.isLink(current.mode) && (!islast || opts.follow)) {
1635
+ if (!current.node_ops.readlink) {
1636
+ throw new FS.ErrnoError(52);
1637
+ }
1638
+ var link = current.node_ops.readlink(current);
1639
+ if (!PATH.isAbs(link)) {
1640
+ link = PATH.dirname(current_path) + "/" + link;
1641
+ }
1642
+ path = link + "/" + parts.slice(i + 1).join("/");
1643
+ continue linkloop;
1644
+ }
1645
+ }
1646
+ return { path: current_path, node: current };
1647
+ }
1648
+ throw new FS.ErrnoError(32);
1649
+ },
1650
+ getPath(node) {
1651
+ var path;
1652
+ while (true) {
1653
+ if (FS.isRoot(node)) {
1654
+ var mount = node.mount.mountpoint;
1655
+ if (!path) return mount;
1656
+ return mount[mount.length - 1] !== "/" ? `${mount}/${path}` : mount + path;
1657
+ }
1658
+ path = path ? `${node.name}/${path}` : node.name;
1659
+ node = node.parent;
1660
+ }
1661
+ },
1662
+ hashName(parentid, name) {
1663
+ var hash = 0;
1664
+ for (var i = 0; i < name.length; i++) {
1665
+ hash = (hash << 5) - hash + name.charCodeAt(i) | 0;
1666
+ }
1667
+ return (parentid + hash >>> 0) % FS.nameTable.length;
1668
+ },
1669
+ hashAddNode(node) {
1670
+ var hash = FS.hashName(node.parent.id, node.name);
1671
+ node.name_next = FS.nameTable[hash];
1672
+ FS.nameTable[hash] = node;
1673
+ },
1674
+ hashRemoveNode(node) {
1675
+ var hash = FS.hashName(node.parent.id, node.name);
1676
+ if (FS.nameTable[hash] === node) {
1677
+ FS.nameTable[hash] = node.name_next;
1678
+ } else {
1679
+ var current = FS.nameTable[hash];
1680
+ while (current) {
1681
+ if (current.name_next === node) {
1682
+ current.name_next = node.name_next;
1683
+ break;
1684
+ }
1685
+ current = current.name_next;
1686
+ }
1687
+ }
1688
+ },
1689
+ lookupNode(parent, name) {
1690
+ var errCode = FS.mayLookup(parent);
1691
+ if (errCode) {
1692
+ throw new FS.ErrnoError(errCode);
1693
+ }
1694
+ var hash = FS.hashName(parent.id, name);
1695
+ for (var node = FS.nameTable[hash]; node; node = node.name_next) {
1696
+ var nodeName = node.name;
1697
+ if (node.parent.id === parent.id && nodeName === name) {
1698
+ return node;
1699
+ }
1700
+ }
1701
+ return FS.lookup(parent, name);
1702
+ },
1703
+ createNode(parent, name, mode, rdev) {
1704
+ assert(typeof parent == "object");
1705
+ var node = new FS.FSNode(parent, name, mode, rdev);
1706
+ FS.hashAddNode(node);
1707
+ return node;
1708
+ },
1709
+ destroyNode(node) {
1710
+ FS.hashRemoveNode(node);
1711
+ },
1712
+ isRoot(node) {
1713
+ return node === node.parent;
1714
+ },
1715
+ isMountpoint(node) {
1716
+ return !!node.mounted;
1717
+ },
1718
+ isFile(mode) {
1719
+ return (mode & 61440) === 32768;
1720
+ },
1721
+ isDir(mode) {
1722
+ return (mode & 61440) === 16384;
1723
+ },
1724
+ isLink(mode) {
1725
+ return (mode & 61440) === 40960;
1726
+ },
1727
+ isChrdev(mode) {
1728
+ return (mode & 61440) === 8192;
1729
+ },
1730
+ isBlkdev(mode) {
1731
+ return (mode & 61440) === 24576;
1732
+ },
1733
+ isFIFO(mode) {
1734
+ return (mode & 61440) === 4096;
1735
+ },
1736
+ isSocket(mode) {
1737
+ return (mode & 49152) === 49152;
1738
+ },
1739
+ flagsToPermissionString(flag) {
1740
+ var perms = ["r", "w", "rw"][flag & 3];
1741
+ if (flag & 512) {
1742
+ perms += "w";
1743
+ }
1744
+ return perms;
1745
+ },
1746
+ nodePermissions(node, perms) {
1747
+ if (FS.ignorePermissions) {
1748
+ return 0;
1749
+ }
1750
+ if (perms.includes("r") && !(node.mode & 292)) {
1751
+ return 2;
1752
+ }
1753
+ if (perms.includes("w") && !(node.mode & 146)) {
1754
+ return 2;
1755
+ }
1756
+ if (perms.includes("x") && !(node.mode & 73)) {
1757
+ return 2;
1758
+ }
1759
+ return 0;
1760
+ },
1761
+ mayLookup(dir) {
1762
+ if (!FS.isDir(dir.mode)) return 54;
1763
+ var errCode = FS.nodePermissions(dir, "x");
1764
+ if (errCode) return errCode;
1765
+ if (!dir.node_ops.lookup) return 2;
1766
+ return 0;
1767
+ },
1768
+ mayCreate(dir, name) {
1769
+ if (!FS.isDir(dir.mode)) {
1770
+ return 54;
1771
+ }
1772
+ try {
1773
+ var node = FS.lookupNode(dir, name);
1774
+ return 20;
1775
+ } catch (e) {
1776
+ }
1777
+ return FS.nodePermissions(dir, "wx");
1778
+ },
1779
+ mayDelete(dir, name, isdir) {
1780
+ var node;
1781
+ try {
1782
+ node = FS.lookupNode(dir, name);
1783
+ } catch (e) {
1784
+ return e.errno;
1785
+ }
1786
+ var errCode = FS.nodePermissions(dir, "wx");
1787
+ if (errCode) {
1788
+ return errCode;
1789
+ }
1790
+ if (isdir) {
1791
+ if (!FS.isDir(node.mode)) {
1792
+ return 54;
1793
+ }
1794
+ if (FS.isRoot(node) || FS.getPath(node) === FS.cwd()) {
1795
+ return 10;
1796
+ }
1797
+ } else if (FS.isDir(node.mode)) {
1798
+ return 31;
1799
+ }
1800
+ return 0;
1801
+ },
1802
+ mayOpen(node, flags) {
1803
+ if (!node) {
1804
+ return 44;
1805
+ }
1806
+ if (FS.isLink(node.mode)) {
1807
+ return 32;
1808
+ }
1809
+ var mode = FS.flagsToPermissionString(flags);
1810
+ if (FS.isDir(node.mode)) {
1811
+ if (mode !== "r" || flags & (512 | 64)) {
1812
+ return 31;
1813
+ }
1814
+ }
1815
+ return FS.nodePermissions(node, mode);
1816
+ },
1817
+ checkOpExists(op, err2) {
1818
+ if (!op) {
1819
+ throw new FS.ErrnoError(err2);
1820
+ }
1821
+ return op;
1822
+ },
1823
+ MAX_OPEN_FDS: 4096,
1824
+ nextfd() {
1825
+ for (var fd = 0; fd <= FS.MAX_OPEN_FDS; fd++) {
1826
+ if (!FS.streams[fd]) {
1827
+ return fd;
1828
+ }
1829
+ }
1830
+ throw new FS.ErrnoError(33);
1831
+ },
1832
+ getStreamChecked(fd) {
1833
+ var stream = FS.getStream(fd);
1834
+ if (!stream) {
1835
+ throw new FS.ErrnoError(8);
1836
+ }
1837
+ return stream;
1838
+ },
1839
+ getStream: (fd) => FS.streams[fd],
1840
+ createStream(stream, fd = -1) {
1841
+ assert(fd >= -1);
1842
+ stream = Object.assign(new FS.FSStream(), stream);
1843
+ if (fd == -1) {
1844
+ fd = FS.nextfd();
1845
+ }
1846
+ stream.fd = fd;
1847
+ FS.streams[fd] = stream;
1848
+ return stream;
1849
+ },
1850
+ closeStream(fd) {
1851
+ FS.streams[fd] = null;
1852
+ },
1853
+ dupStream(origStream, fd = -1) {
1854
+ var stream = FS.createStream(origStream, fd);
1855
+ stream.stream_ops?.dup?.(stream);
1856
+ return stream;
1857
+ },
1858
+ doSetAttr(stream, node, attr) {
1859
+ var setattr = stream?.stream_ops.setattr;
1860
+ var arg = setattr ? stream : node;
1861
+ setattr ??= node.node_ops.setattr;
1862
+ FS.checkOpExists(setattr, 63);
1863
+ setattr(arg, attr);
1864
+ },
1865
+ chrdev_stream_ops: {
1866
+ open(stream) {
1867
+ var device = FS.getDevice(stream.node.rdev);
1868
+ stream.stream_ops = device.stream_ops;
1869
+ stream.stream_ops.open?.(stream);
1870
+ },
1871
+ llseek() {
1872
+ throw new FS.ErrnoError(70);
1873
+ }
1874
+ },
1875
+ major: (dev) => dev >> 8,
1876
+ minor: (dev) => dev & 255,
1877
+ makedev: (ma, mi) => ma << 8 | mi,
1878
+ registerDevice(dev, ops) {
1879
+ FS.devices[dev] = { stream_ops: ops };
1880
+ },
1881
+ getDevice: (dev) => FS.devices[dev],
1882
+ getMounts(mount) {
1883
+ var mounts = [];
1884
+ var check = [mount];
1885
+ while (check.length) {
1886
+ var m = check.pop();
1887
+ mounts.push(m);
1888
+ check.push(...m.mounts);
1889
+ }
1890
+ return mounts;
1891
+ },
1892
+ syncfs(populate, callback) {
1893
+ if (typeof populate == "function") {
1894
+ callback = populate;
1895
+ populate = false;
1896
+ }
1897
+ FS.syncFSRequests++;
1898
+ if (FS.syncFSRequests > 1) {
1899
+ err(`warning: ${FS.syncFSRequests} FS.syncfs operations in flight at once, probably just doing extra work`);
1900
+ }
1901
+ var mounts = FS.getMounts(FS.root.mount);
1902
+ var completed = 0;
1903
+ function doCallback(errCode) {
1904
+ assert(FS.syncFSRequests > 0);
1905
+ FS.syncFSRequests--;
1906
+ return callback(errCode);
1907
+ }
1908
+ function done(errCode) {
1909
+ if (errCode) {
1910
+ if (!done.errored) {
1911
+ done.errored = true;
1912
+ return doCallback(errCode);
1913
+ }
1914
+ return;
1915
+ }
1916
+ if (++completed >= mounts.length) {
1917
+ doCallback(null);
1918
+ }
1919
+ }
1920
+ ;
1921
+ for (var mount of mounts) {
1922
+ if (mount.type.syncfs) {
1923
+ mount.type.syncfs(mount, populate, done);
1924
+ } else {
1925
+ done(null);
1926
+ }
1927
+ }
1928
+ },
1929
+ mount(type, opts, mountpoint) {
1930
+ if (typeof type == "string") {
1931
+ throw type;
1932
+ }
1933
+ var root = mountpoint === "/";
1934
+ var pseudo = !mountpoint;
1935
+ var node;
1936
+ if (root && FS.root) {
1937
+ throw new FS.ErrnoError(10);
1938
+ } else if (!root && !pseudo) {
1939
+ var lookup = FS.lookupPath(mountpoint, { follow_mount: false });
1940
+ mountpoint = lookup.path;
1941
+ node = lookup.node;
1942
+ if (FS.isMountpoint(node)) {
1943
+ throw new FS.ErrnoError(10);
1944
+ }
1945
+ if (!FS.isDir(node.mode)) {
1946
+ throw new FS.ErrnoError(54);
1947
+ }
1948
+ }
1949
+ var mount = {
1950
+ type,
1951
+ opts,
1952
+ mountpoint,
1953
+ mounts: []
1954
+ };
1955
+ var mountRoot = type.mount(mount);
1956
+ mountRoot.mount = mount;
1957
+ mount.root = mountRoot;
1958
+ if (root) {
1959
+ FS.root = mountRoot;
1960
+ } else if (node) {
1961
+ node.mounted = mount;
1962
+ if (node.mount) {
1963
+ node.mount.mounts.push(mount);
1964
+ }
1965
+ }
1966
+ return mountRoot;
1967
+ },
1968
+ unmount(mountpoint) {
1969
+ var lookup = FS.lookupPath(mountpoint, { follow_mount: false });
1970
+ if (!FS.isMountpoint(lookup.node)) {
1971
+ throw new FS.ErrnoError(28);
1972
+ }
1973
+ var node = lookup.node;
1974
+ var mount = node.mounted;
1975
+ var mounts = FS.getMounts(mount);
1976
+ for (var [hash, current] of Object.entries(FS.nameTable)) {
1977
+ while (current) {
1978
+ var next = current.name_next;
1979
+ if (mounts.includes(current.mount)) {
1980
+ FS.destroyNode(current);
1981
+ }
1982
+ current = next;
1983
+ }
1984
+ }
1985
+ node.mounted = null;
1986
+ var idx = node.mount.mounts.indexOf(mount);
1987
+ assert(idx !== -1);
1988
+ node.mount.mounts.splice(idx, 1);
1989
+ },
1990
+ lookup(parent, name) {
1991
+ return parent.node_ops.lookup(parent, name);
1992
+ },
1993
+ mknod(path, mode, dev) {
1994
+ var lookup = FS.lookupPath(path, { parent: true });
1995
+ var parent = lookup.node;
1996
+ var name = PATH.basename(path);
1997
+ if (!name) {
1998
+ throw new FS.ErrnoError(28);
1999
+ }
2000
+ if (name === "." || name === "..") {
2001
+ throw new FS.ErrnoError(20);
2002
+ }
2003
+ var errCode = FS.mayCreate(parent, name);
2004
+ if (errCode) {
2005
+ throw new FS.ErrnoError(errCode);
2006
+ }
2007
+ if (!parent.node_ops.mknod) {
2008
+ throw new FS.ErrnoError(63);
2009
+ }
2010
+ return parent.node_ops.mknod(parent, name, mode, dev);
2011
+ },
2012
+ statfs(path) {
2013
+ return FS.statfsNode(FS.lookupPath(path, { follow: true }).node);
2014
+ },
2015
+ statfsStream(stream) {
2016
+ return FS.statfsNode(stream.node);
2017
+ },
2018
+ statfsNode(node) {
2019
+ var rtn = {
2020
+ bsize: 4096,
2021
+ frsize: 4096,
2022
+ blocks: 1e6,
2023
+ bfree: 5e5,
2024
+ bavail: 5e5,
2025
+ files: FS.nextInode,
2026
+ ffree: FS.nextInode - 1,
2027
+ fsid: 42,
2028
+ flags: 2,
2029
+ namelen: 255
2030
+ };
2031
+ if (node.node_ops.statfs) {
2032
+ Object.assign(rtn, node.node_ops.statfs(node.mount.opts.root));
2033
+ }
2034
+ return rtn;
2035
+ },
2036
+ create(path, mode = 438) {
2037
+ mode &= 4095;
2038
+ mode |= 32768;
2039
+ return FS.mknod(path, mode, 0);
2040
+ },
2041
+ mkdir(path, mode = 511) {
2042
+ mode &= 511 | 512;
2043
+ mode |= 16384;
2044
+ return FS.mknod(path, mode, 0);
2045
+ },
2046
+ mkdirTree(path, mode) {
2047
+ var dirs = path.split("/");
2048
+ var d = "";
2049
+ for (var dir of dirs) {
2050
+ if (!dir) continue;
2051
+ if (d || PATH.isAbs(path)) d += "/";
2052
+ d += dir;
2053
+ try {
2054
+ FS.mkdir(d, mode);
2055
+ } catch (e) {
2056
+ if (e.errno != 20) throw e;
2057
+ }
2058
+ }
2059
+ },
2060
+ mkdev(path, mode, dev) {
2061
+ if (typeof dev == "undefined") {
2062
+ dev = mode;
2063
+ mode = 438;
2064
+ }
2065
+ mode |= 8192;
2066
+ return FS.mknod(path, mode, dev);
2067
+ },
2068
+ symlink(oldpath, newpath) {
2069
+ if (!PATH_FS.resolve(oldpath)) {
2070
+ throw new FS.ErrnoError(44);
2071
+ }
2072
+ var lookup = FS.lookupPath(newpath, { parent: true });
2073
+ var parent = lookup.node;
2074
+ if (!parent) {
2075
+ throw new FS.ErrnoError(44);
2076
+ }
2077
+ var newname = PATH.basename(newpath);
2078
+ var errCode = FS.mayCreate(parent, newname);
2079
+ if (errCode) {
2080
+ throw new FS.ErrnoError(errCode);
2081
+ }
2082
+ if (!parent.node_ops.symlink) {
2083
+ throw new FS.ErrnoError(63);
2084
+ }
2085
+ return parent.node_ops.symlink(parent, newname, oldpath);
2086
+ },
2087
+ rename(old_path, new_path) {
2088
+ var old_dirname = PATH.dirname(old_path);
2089
+ var new_dirname = PATH.dirname(new_path);
2090
+ var old_name = PATH.basename(old_path);
2091
+ var new_name = PATH.basename(new_path);
2092
+ var lookup, old_dir, new_dir;
2093
+ lookup = FS.lookupPath(old_path, { parent: true });
2094
+ old_dir = lookup.node;
2095
+ lookup = FS.lookupPath(new_path, { parent: true });
2096
+ new_dir = lookup.node;
2097
+ if (!old_dir || !new_dir) throw new FS.ErrnoError(44);
2098
+ if (old_dir.mount !== new_dir.mount) {
2099
+ throw new FS.ErrnoError(75);
2100
+ }
2101
+ var old_node = FS.lookupNode(old_dir, old_name);
2102
+ var relative = PATH_FS.relative(old_path, new_dirname);
2103
+ if (relative.charAt(0) !== ".") {
2104
+ throw new FS.ErrnoError(28);
2105
+ }
2106
+ relative = PATH_FS.relative(new_path, old_dirname);
2107
+ if (relative.charAt(0) !== ".") {
2108
+ throw new FS.ErrnoError(55);
2109
+ }
2110
+ var new_node;
2111
+ try {
2112
+ new_node = FS.lookupNode(new_dir, new_name);
2113
+ } catch (e) {
2114
+ }
2115
+ if (old_node === new_node) {
2116
+ return;
2117
+ }
2118
+ var isdir = FS.isDir(old_node.mode);
2119
+ var errCode = FS.mayDelete(old_dir, old_name, isdir);
2120
+ if (errCode) {
2121
+ throw new FS.ErrnoError(errCode);
2122
+ }
2123
+ errCode = new_node ? FS.mayDelete(new_dir, new_name, isdir) : FS.mayCreate(new_dir, new_name);
2124
+ if (errCode) {
2125
+ throw new FS.ErrnoError(errCode);
2126
+ }
2127
+ if (!old_dir.node_ops.rename) {
2128
+ throw new FS.ErrnoError(63);
2129
+ }
2130
+ if (FS.isMountpoint(old_node) || new_node && FS.isMountpoint(new_node)) {
2131
+ throw new FS.ErrnoError(10);
2132
+ }
2133
+ if (new_dir !== old_dir) {
2134
+ errCode = FS.nodePermissions(old_dir, "w");
2135
+ if (errCode) {
2136
+ throw new FS.ErrnoError(errCode);
2137
+ }
2138
+ }
2139
+ FS.hashRemoveNode(old_node);
2140
+ try {
2141
+ old_dir.node_ops.rename(old_node, new_dir, new_name);
2142
+ old_node.parent = new_dir;
2143
+ } catch (e) {
2144
+ throw e;
2145
+ } finally {
2146
+ FS.hashAddNode(old_node);
2147
+ }
2148
+ },
2149
+ rmdir(path) {
2150
+ var lookup = FS.lookupPath(path, { parent: true });
2151
+ var parent = lookup.node;
2152
+ var name = PATH.basename(path);
2153
+ var node = FS.lookupNode(parent, name);
2154
+ var errCode = FS.mayDelete(parent, name, true);
2155
+ if (errCode) {
2156
+ throw new FS.ErrnoError(errCode);
2157
+ }
2158
+ if (!parent.node_ops.rmdir) {
2159
+ throw new FS.ErrnoError(63);
2160
+ }
2161
+ if (FS.isMountpoint(node)) {
2162
+ throw new FS.ErrnoError(10);
2163
+ }
2164
+ parent.node_ops.rmdir(parent, name);
2165
+ FS.destroyNode(node);
2166
+ },
2167
+ readdir(path) {
2168
+ var lookup = FS.lookupPath(path, { follow: true });
2169
+ var node = lookup.node;
2170
+ var readdir = FS.checkOpExists(node.node_ops.readdir, 54);
2171
+ return readdir(node);
2172
+ },
2173
+ unlink(path) {
2174
+ var lookup = FS.lookupPath(path, { parent: true });
2175
+ var parent = lookup.node;
2176
+ if (!parent) {
2177
+ throw new FS.ErrnoError(44);
2178
+ }
2179
+ var name = PATH.basename(path);
2180
+ var node = FS.lookupNode(parent, name);
2181
+ var errCode = FS.mayDelete(parent, name, false);
2182
+ if (errCode) {
2183
+ throw new FS.ErrnoError(errCode);
2184
+ }
2185
+ if (!parent.node_ops.unlink) {
2186
+ throw new FS.ErrnoError(63);
2187
+ }
2188
+ if (FS.isMountpoint(node)) {
2189
+ throw new FS.ErrnoError(10);
2190
+ }
2191
+ parent.node_ops.unlink(parent, name);
2192
+ FS.destroyNode(node);
2193
+ },
2194
+ readlink(path) {
2195
+ var lookup = FS.lookupPath(path);
2196
+ var link = lookup.node;
2197
+ if (!link) {
2198
+ throw new FS.ErrnoError(44);
2199
+ }
2200
+ if (!link.node_ops.readlink) {
2201
+ throw new FS.ErrnoError(28);
2202
+ }
2203
+ return link.node_ops.readlink(link);
2204
+ },
2205
+ stat(path, dontFollow) {
2206
+ var lookup = FS.lookupPath(path, { follow: !dontFollow });
2207
+ var node = lookup.node;
2208
+ var getattr = FS.checkOpExists(node.node_ops.getattr, 63);
2209
+ return getattr(node);
2210
+ },
2211
+ fstat(fd) {
2212
+ var stream = FS.getStreamChecked(fd);
2213
+ var node = stream.node;
2214
+ var getattr = stream.stream_ops.getattr;
2215
+ var arg = getattr ? stream : node;
2216
+ getattr ??= node.node_ops.getattr;
2217
+ FS.checkOpExists(getattr, 63);
2218
+ return getattr(arg);
2219
+ },
2220
+ lstat(path) {
2221
+ return FS.stat(path, true);
2222
+ },
2223
+ doChmod(stream, node, mode, dontFollow) {
2224
+ FS.doSetAttr(stream, node, {
2225
+ mode: mode & 4095 | node.mode & ~4095,
2226
+ ctime: Date.now(),
2227
+ dontFollow
2228
+ });
2229
+ },
2230
+ chmod(path, mode, dontFollow) {
2231
+ var node;
2232
+ if (typeof path == "string") {
2233
+ var lookup = FS.lookupPath(path, { follow: !dontFollow });
2234
+ node = lookup.node;
2235
+ } else {
2236
+ node = path;
2237
+ }
2238
+ FS.doChmod(null, node, mode, dontFollow);
2239
+ },
2240
+ lchmod(path, mode) {
2241
+ FS.chmod(path, mode, true);
2242
+ },
2243
+ fchmod(fd, mode) {
2244
+ var stream = FS.getStreamChecked(fd);
2245
+ FS.doChmod(stream, stream.node, mode, false);
2246
+ },
2247
+ doChown(stream, node, dontFollow) {
2248
+ FS.doSetAttr(stream, node, {
2249
+ timestamp: Date.now(),
2250
+ dontFollow
2251
+ // we ignore the uid / gid for now
2252
+ });
2253
+ },
2254
+ chown(path, uid, gid, dontFollow) {
2255
+ var node;
2256
+ if (typeof path == "string") {
2257
+ var lookup = FS.lookupPath(path, { follow: !dontFollow });
2258
+ node = lookup.node;
2259
+ } else {
2260
+ node = path;
2261
+ }
2262
+ FS.doChown(null, node, dontFollow);
2263
+ },
2264
+ lchown(path, uid, gid) {
2265
+ FS.chown(path, uid, gid, true);
2266
+ },
2267
+ fchown(fd, uid, gid) {
2268
+ var stream = FS.getStreamChecked(fd);
2269
+ FS.doChown(stream, stream.node, false);
2270
+ },
2271
+ doTruncate(stream, node, len) {
2272
+ if (FS.isDir(node.mode)) {
2273
+ throw new FS.ErrnoError(31);
2274
+ }
2275
+ if (!FS.isFile(node.mode)) {
2276
+ throw new FS.ErrnoError(28);
2277
+ }
2278
+ var errCode = FS.nodePermissions(node, "w");
2279
+ if (errCode) {
2280
+ throw new FS.ErrnoError(errCode);
2281
+ }
2282
+ FS.doSetAttr(stream, node, {
2283
+ size: len,
2284
+ timestamp: Date.now()
2285
+ });
2286
+ },
2287
+ truncate(path, len) {
2288
+ if (len < 0) {
2289
+ throw new FS.ErrnoError(28);
2290
+ }
2291
+ var node;
2292
+ if (typeof path == "string") {
2293
+ var lookup = FS.lookupPath(path, { follow: true });
2294
+ node = lookup.node;
2295
+ } else {
2296
+ node = path;
2297
+ }
2298
+ FS.doTruncate(null, node, len);
2299
+ },
2300
+ ftruncate(fd, len) {
2301
+ var stream = FS.getStreamChecked(fd);
2302
+ if (len < 0 || (stream.flags & 2097155) === 0) {
2303
+ throw new FS.ErrnoError(28);
2304
+ }
2305
+ FS.doTruncate(stream, stream.node, len);
2306
+ },
2307
+ utime(path, atime, mtime) {
2308
+ var lookup = FS.lookupPath(path, { follow: true });
2309
+ var node = lookup.node;
2310
+ var setattr = FS.checkOpExists(node.node_ops.setattr, 63);
2311
+ setattr(node, {
2312
+ atime,
2313
+ mtime
2314
+ });
2315
+ },
2316
+ open(path, flags, mode = 438) {
2317
+ if (path === "") {
2318
+ throw new FS.ErrnoError(44);
2319
+ }
2320
+ flags = typeof flags == "string" ? FS_modeStringToFlags(flags) : flags;
2321
+ if (flags & 64) {
2322
+ mode = mode & 4095 | 32768;
2323
+ } else {
2324
+ mode = 0;
2325
+ }
2326
+ var node;
2327
+ var isDirPath;
2328
+ if (typeof path == "object") {
2329
+ node = path;
2330
+ } else {
2331
+ isDirPath = path.endsWith("/");
2332
+ var lookup = FS.lookupPath(path, {
2333
+ follow: !(flags & 131072),
2334
+ noent_okay: true
2335
+ });
2336
+ node = lookup.node;
2337
+ path = lookup.path;
2338
+ }
2339
+ var created = false;
2340
+ if (flags & 64) {
2341
+ if (node) {
2342
+ if (flags & 128) {
2343
+ throw new FS.ErrnoError(20);
2344
+ }
2345
+ } else if (isDirPath) {
2346
+ throw new FS.ErrnoError(31);
2347
+ } else {
2348
+ node = FS.mknod(path, mode | 511, 0);
2349
+ created = true;
2350
+ }
2351
+ }
2352
+ if (!node) {
2353
+ throw new FS.ErrnoError(44);
2354
+ }
2355
+ if (FS.isChrdev(node.mode)) {
2356
+ flags &= ~512;
2357
+ }
2358
+ if (flags & 65536 && !FS.isDir(node.mode)) {
2359
+ throw new FS.ErrnoError(54);
2360
+ }
2361
+ if (!created) {
2362
+ var errCode = FS.mayOpen(node, flags);
2363
+ if (errCode) {
2364
+ throw new FS.ErrnoError(errCode);
2365
+ }
2366
+ }
2367
+ if (flags & 512 && !created) {
2368
+ FS.truncate(node, 0);
2369
+ }
2370
+ flags &= ~(128 | 512 | 131072);
2371
+ var stream = FS.createStream({
2372
+ node,
2373
+ path: FS.getPath(node),
2374
+ // we want the absolute path to the node
2375
+ flags,
2376
+ seekable: true,
2377
+ position: 0,
2378
+ stream_ops: node.stream_ops,
2379
+ // used by the file family libc calls (fopen, fwrite, ferror, etc.)
2380
+ ungotten: [],
2381
+ error: false
2382
+ });
2383
+ if (stream.stream_ops.open) {
2384
+ stream.stream_ops.open(stream);
2385
+ }
2386
+ if (created) {
2387
+ FS.chmod(node, mode & 511);
2388
+ }
2389
+ return stream;
2390
+ },
2391
+ close(stream) {
2392
+ if (FS.isClosed(stream)) {
2393
+ throw new FS.ErrnoError(8);
2394
+ }
2395
+ if (stream.getdents) stream.getdents = null;
2396
+ try {
2397
+ if (stream.stream_ops.close) {
2398
+ stream.stream_ops.close(stream);
2399
+ }
2400
+ } catch (e) {
2401
+ throw e;
2402
+ } finally {
2403
+ FS.closeStream(stream.fd);
2404
+ }
2405
+ stream.fd = null;
2406
+ },
2407
+ isClosed(stream) {
2408
+ return stream.fd === null;
2409
+ },
2410
+ llseek(stream, offset, whence) {
2411
+ if (FS.isClosed(stream)) {
2412
+ throw new FS.ErrnoError(8);
2413
+ }
2414
+ if (!stream.seekable || !stream.stream_ops.llseek) {
2415
+ throw new FS.ErrnoError(70);
2416
+ }
2417
+ if (whence != 0 && whence != 1 && whence != 2) {
2418
+ throw new FS.ErrnoError(28);
2419
+ }
2420
+ stream.position = stream.stream_ops.llseek(stream, offset, whence);
2421
+ stream.ungotten = [];
2422
+ return stream.position;
2423
+ },
2424
+ read(stream, buffer, offset, length, position) {
2425
+ assert(offset >= 0);
2426
+ if (length < 0 || position < 0) {
2427
+ throw new FS.ErrnoError(28);
2428
+ }
2429
+ if (FS.isClosed(stream)) {
2430
+ throw new FS.ErrnoError(8);
2431
+ }
2432
+ if ((stream.flags & 2097155) === 1) {
2433
+ throw new FS.ErrnoError(8);
2434
+ }
2435
+ if (FS.isDir(stream.node.mode)) {
2436
+ throw new FS.ErrnoError(31);
2437
+ }
2438
+ if (!stream.stream_ops.read) {
2439
+ throw new FS.ErrnoError(28);
2440
+ }
2441
+ var seeking = typeof position != "undefined";
2442
+ if (!seeking) {
2443
+ position = stream.position;
2444
+ } else if (!stream.seekable) {
2445
+ throw new FS.ErrnoError(70);
2446
+ }
2447
+ var bytesRead = stream.stream_ops.read(stream, buffer, offset, length, position);
2448
+ if (!seeking) stream.position += bytesRead;
2449
+ return bytesRead;
2450
+ },
2451
+ write(stream, buffer, offset, length, position, canOwn) {
2452
+ assert(offset >= 0);
2453
+ if (length < 0 || position < 0) {
2454
+ throw new FS.ErrnoError(28);
2455
+ }
2456
+ if (FS.isClosed(stream)) {
2457
+ throw new FS.ErrnoError(8);
2458
+ }
2459
+ if ((stream.flags & 2097155) === 0) {
2460
+ throw new FS.ErrnoError(8);
2461
+ }
2462
+ if (FS.isDir(stream.node.mode)) {
2463
+ throw new FS.ErrnoError(31);
2464
+ }
2465
+ if (!stream.stream_ops.write) {
2466
+ throw new FS.ErrnoError(28);
2467
+ }
2468
+ if (stream.seekable && stream.flags & 1024) {
2469
+ FS.llseek(stream, 0, 2);
2470
+ }
2471
+ var seeking = typeof position != "undefined";
2472
+ if (!seeking) {
2473
+ position = stream.position;
2474
+ } else if (!stream.seekable) {
2475
+ throw new FS.ErrnoError(70);
2476
+ }
2477
+ var bytesWritten = stream.stream_ops.write(stream, buffer, offset, length, position, canOwn);
2478
+ if (!seeking) stream.position += bytesWritten;
2479
+ return bytesWritten;
2480
+ },
2481
+ mmap(stream, length, position, prot, flags) {
2482
+ if ((prot & 2) !== 0 && (flags & 2) === 0 && (stream.flags & 2097155) !== 2) {
2483
+ throw new FS.ErrnoError(2);
2484
+ }
2485
+ if ((stream.flags & 2097155) === 1) {
2486
+ throw new FS.ErrnoError(2);
2487
+ }
2488
+ if (!stream.stream_ops.mmap) {
2489
+ throw new FS.ErrnoError(43);
2490
+ }
2491
+ if (!length) {
2492
+ throw new FS.ErrnoError(28);
2493
+ }
2494
+ return stream.stream_ops.mmap(stream, length, position, prot, flags);
2495
+ },
2496
+ msync(stream, buffer, offset, length, mmapFlags) {
2497
+ assert(offset >= 0);
2498
+ if (!stream.stream_ops.msync) {
2499
+ return 0;
2500
+ }
2501
+ return stream.stream_ops.msync(stream, buffer, offset, length, mmapFlags);
2502
+ },
2503
+ ioctl(stream, cmd, arg) {
2504
+ if (!stream.stream_ops.ioctl) {
2505
+ throw new FS.ErrnoError(59);
2506
+ }
2507
+ return stream.stream_ops.ioctl(stream, cmd, arg);
2508
+ },
2509
+ readFile(path, opts = {}) {
2510
+ opts.flags = opts.flags || 0;
2511
+ opts.encoding = opts.encoding || "binary";
2512
+ if (opts.encoding !== "utf8" && opts.encoding !== "binary") {
2513
+ abort(`Invalid encoding type "${opts.encoding}"`);
2514
+ }
2515
+ var stream = FS.open(path, opts.flags);
2516
+ var stat = FS.stat(path);
2517
+ var length = stat.size;
2518
+ var buf = new Uint8Array(length);
2519
+ FS.read(stream, buf, 0, length, 0);
2520
+ if (opts.encoding === "utf8") {
2521
+ buf = UTF8ArrayToString(buf);
2522
+ }
2523
+ FS.close(stream);
2524
+ return buf;
2525
+ },
2526
+ writeFile(path, data, opts = {}) {
2527
+ opts.flags = opts.flags || 577;
2528
+ var stream = FS.open(path, opts.flags, opts.mode);
2529
+ if (typeof data == "string") {
2530
+ data = new Uint8Array(intArrayFromString(data, true));
2531
+ }
2532
+ if (ArrayBuffer.isView(data)) {
2533
+ FS.write(stream, data, 0, data.byteLength, void 0, opts.canOwn);
2534
+ } else {
2535
+ abort("Unsupported data type");
2536
+ }
2537
+ FS.close(stream);
2538
+ },
2539
+ cwd: () => FS.currentPath,
2540
+ chdir(path) {
2541
+ var lookup = FS.lookupPath(path, { follow: true });
2542
+ if (lookup.node === null) {
2543
+ throw new FS.ErrnoError(44);
2544
+ }
2545
+ if (!FS.isDir(lookup.node.mode)) {
2546
+ throw new FS.ErrnoError(54);
2547
+ }
2548
+ var errCode = FS.nodePermissions(lookup.node, "x");
2549
+ if (errCode) {
2550
+ throw new FS.ErrnoError(errCode);
2551
+ }
2552
+ FS.currentPath = lookup.path;
2553
+ },
2554
+ createDefaultDirectories() {
2555
+ FS.mkdir("/tmp");
2556
+ FS.mkdir("/home");
2557
+ FS.mkdir("/home/web_user");
2558
+ },
2559
+ createDefaultDevices() {
2560
+ FS.mkdir("/dev");
2561
+ FS.registerDevice(FS.makedev(1, 3), {
2562
+ read: () => 0,
2563
+ write: (stream, buffer, offset, length, pos) => length,
2564
+ llseek: () => 0
2565
+ });
2566
+ FS.mkdev("/dev/null", FS.makedev(1, 3));
2567
+ TTY.register(FS.makedev(5, 0), TTY.default_tty_ops);
2568
+ TTY.register(FS.makedev(6, 0), TTY.default_tty1_ops);
2569
+ FS.mkdev("/dev/tty", FS.makedev(5, 0));
2570
+ FS.mkdev("/dev/tty1", FS.makedev(6, 0));
2571
+ var randomBuffer = new Uint8Array(1024), randomLeft = 0;
2572
+ var randomByte = () => {
2573
+ if (randomLeft === 0) {
2574
+ randomFill(randomBuffer);
2575
+ randomLeft = randomBuffer.byteLength;
2576
+ }
2577
+ return randomBuffer[--randomLeft];
2578
+ };
2579
+ FS.createDevice("/dev", "random", randomByte);
2580
+ FS.createDevice("/dev", "urandom", randomByte);
2581
+ FS.mkdir("/dev/shm");
2582
+ FS.mkdir("/dev/shm/tmp");
2583
+ },
2584
+ createSpecialDirectories() {
2585
+ FS.mkdir("/proc");
2586
+ var proc_self = FS.mkdir("/proc/self");
2587
+ FS.mkdir("/proc/self/fd");
2588
+ FS.mount({
2589
+ mount() {
2590
+ var node = FS.createNode(proc_self, "fd", 16895, 73);
2591
+ node.stream_ops = {
2592
+ llseek: MEMFS.stream_ops.llseek
2593
+ };
2594
+ node.node_ops = {
2595
+ lookup(parent, name) {
2596
+ var fd = +name;
2597
+ var stream = FS.getStreamChecked(fd);
2598
+ var ret = {
2599
+ parent: null,
2600
+ mount: { mountpoint: "fake" },
2601
+ node_ops: { readlink: () => stream.path },
2602
+ id: fd + 1
2603
+ };
2604
+ ret.parent = ret;
2605
+ return ret;
2606
+ },
2607
+ readdir() {
2608
+ return Array.from(FS.streams.entries()).filter(([k, v]) => v).map(([k, v]) => k.toString());
2609
+ }
2610
+ };
2611
+ return node;
2612
+ }
2613
+ }, {}, "/proc/self/fd");
2614
+ },
2615
+ createStandardStreams(input, output, error) {
2616
+ if (input) {
2617
+ FS.createDevice("/dev", "stdin", input);
2618
+ } else {
2619
+ FS.symlink("/dev/tty", "/dev/stdin");
2620
+ }
2621
+ if (output) {
2622
+ FS.createDevice("/dev", "stdout", null, output);
2623
+ } else {
2624
+ FS.symlink("/dev/tty", "/dev/stdout");
2625
+ }
2626
+ if (error) {
2627
+ FS.createDevice("/dev", "stderr", null, error);
2628
+ } else {
2629
+ FS.symlink("/dev/tty1", "/dev/stderr");
2630
+ }
2631
+ var stdin = FS.open("/dev/stdin", 0);
2632
+ var stdout = FS.open("/dev/stdout", 1);
2633
+ var stderr = FS.open("/dev/stderr", 1);
2634
+ assert(stdin.fd === 0, `invalid handle for stdin (${stdin.fd})`);
2635
+ assert(stdout.fd === 1, `invalid handle for stdout (${stdout.fd})`);
2636
+ assert(stderr.fd === 2, `invalid handle for stderr (${stderr.fd})`);
2637
+ },
2638
+ staticInit() {
2639
+ FS.nameTable = new Array(4096);
2640
+ FS.mount(MEMFS, {}, "/");
2641
+ FS.createDefaultDirectories();
2642
+ FS.createDefaultDevices();
2643
+ FS.createSpecialDirectories();
2644
+ FS.filesystems = {
2645
+ "MEMFS": MEMFS
2646
+ };
2647
+ },
2648
+ init(input, output, error) {
2649
+ assert(!FS.initialized, "FS.init was previously called. If you want to initialize later with custom parameters, remove any earlier calls (note that one is automatically added to the generated code)");
2650
+ FS.initialized = true;
2651
+ input ??= Module["stdin"];
2652
+ output ??= Module["stdout"];
2653
+ error ??= Module["stderr"];
2654
+ FS.createStandardStreams(input, output, error);
2655
+ },
2656
+ quit() {
2657
+ FS.initialized = false;
2658
+ _fflush(0);
2659
+ for (var stream of FS.streams) {
2660
+ if (stream) {
2661
+ FS.close(stream);
2662
+ }
2663
+ }
2664
+ },
2665
+ findObject(path, dontResolveLastLink) {
2666
+ var ret = FS.analyzePath(path, dontResolveLastLink);
2667
+ if (!ret.exists) {
2668
+ return null;
2669
+ }
2670
+ return ret.object;
2671
+ },
2672
+ analyzePath(path, dontResolveLastLink) {
2673
+ try {
2674
+ var lookup = FS.lookupPath(path, { follow: !dontResolveLastLink });
2675
+ path = lookup.path;
2676
+ } catch (e) {
2677
+ }
2678
+ var ret = {
2679
+ isRoot: false,
2680
+ exists: false,
2681
+ error: 0,
2682
+ name: null,
2683
+ path: null,
2684
+ object: null,
2685
+ parentExists: false,
2686
+ parentPath: null,
2687
+ parentObject: null
2688
+ };
2689
+ try {
2690
+ var lookup = FS.lookupPath(path, { parent: true });
2691
+ ret.parentExists = true;
2692
+ ret.parentPath = lookup.path;
2693
+ ret.parentObject = lookup.node;
2694
+ ret.name = PATH.basename(path);
2695
+ lookup = FS.lookupPath(path, { follow: !dontResolveLastLink });
2696
+ ret.exists = true;
2697
+ ret.path = lookup.path;
2698
+ ret.object = lookup.node;
2699
+ ret.name = lookup.node.name;
2700
+ ret.isRoot = lookup.path === "/";
2701
+ } catch (e) {
2702
+ ret.error = e.errno;
2703
+ }
2704
+ ;
2705
+ return ret;
2706
+ },
2707
+ createPath(parent, path, canRead, canWrite) {
2708
+ parent = typeof parent == "string" ? parent : FS.getPath(parent);
2709
+ var parts = path.split("/").reverse();
2710
+ while (parts.length) {
2711
+ var part = parts.pop();
2712
+ if (!part) continue;
2713
+ var current = PATH.join2(parent, part);
2714
+ try {
2715
+ FS.mkdir(current);
2716
+ } catch (e) {
2717
+ if (e.errno != 20) throw e;
2718
+ }
2719
+ parent = current;
2720
+ }
2721
+ return current;
2722
+ },
2723
+ createFile(parent, name, properties, canRead, canWrite) {
2724
+ var path = PATH.join2(typeof parent == "string" ? parent : FS.getPath(parent), name);
2725
+ var mode = FS_getMode(canRead, canWrite);
2726
+ return FS.create(path, mode);
2727
+ },
2728
+ createDataFile(parent, name, data, canRead, canWrite, canOwn) {
2729
+ var path = name;
2730
+ if (parent) {
2731
+ parent = typeof parent == "string" ? parent : FS.getPath(parent);
2732
+ path = name ? PATH.join2(parent, name) : parent;
2733
+ }
2734
+ var mode = FS_getMode(canRead, canWrite);
2735
+ var node = FS.create(path, mode);
2736
+ if (data) {
2737
+ if (typeof data == "string") {
2738
+ var arr = new Array(data.length);
2739
+ for (var i = 0, len = data.length; i < len; ++i) arr[i] = data.charCodeAt(i);
2740
+ data = arr;
2741
+ }
2742
+ FS.chmod(node, mode | 146);
2743
+ var stream = FS.open(node, 577);
2744
+ FS.write(stream, data, 0, data.length, 0, canOwn);
2745
+ FS.close(stream);
2746
+ FS.chmod(node, mode);
2747
+ }
2748
+ },
2749
+ createDevice(parent, name, input, output) {
2750
+ var path = PATH.join2(typeof parent == "string" ? parent : FS.getPath(parent), name);
2751
+ var mode = FS_getMode(!!input, !!output);
2752
+ FS.createDevice.major ??= 64;
2753
+ var dev = FS.makedev(FS.createDevice.major++, 0);
2754
+ FS.registerDevice(dev, {
2755
+ open(stream) {
2756
+ stream.seekable = false;
2757
+ },
2758
+ close(stream) {
2759
+ if (output?.buffer?.length) {
2760
+ output(10);
2761
+ }
2762
+ },
2763
+ read(stream, buffer, offset, length, pos) {
2764
+ var bytesRead = 0;
2765
+ for (var i = 0; i < length; i++) {
2766
+ var result;
2767
+ try {
2768
+ result = input();
2769
+ } catch (e) {
2770
+ throw new FS.ErrnoError(29);
2771
+ }
2772
+ if (result === void 0 && bytesRead === 0) {
2773
+ throw new FS.ErrnoError(6);
2774
+ }
2775
+ if (result === null || result === void 0) break;
2776
+ bytesRead++;
2777
+ buffer[offset + i] = result;
2778
+ }
2779
+ if (bytesRead) {
2780
+ stream.node.atime = Date.now();
2781
+ }
2782
+ return bytesRead;
2783
+ },
2784
+ write(stream, buffer, offset, length, pos) {
2785
+ for (var i = 0; i < length; i++) {
2786
+ try {
2787
+ output(buffer[offset + i]);
2788
+ } catch (e) {
2789
+ throw new FS.ErrnoError(29);
2790
+ }
2791
+ }
2792
+ if (length) {
2793
+ stream.node.mtime = stream.node.ctime = Date.now();
2794
+ }
2795
+ return i;
2796
+ }
2797
+ });
2798
+ return FS.mkdev(path, mode, dev);
2799
+ },
2800
+ forceLoadFile(obj) {
2801
+ if (obj.isDevice || obj.isFolder || obj.link || obj.contents) return true;
2802
+ if (globalThis.XMLHttpRequest) {
2803
+ abort("Lazy loading should have been performed (contents set) in createLazyFile, but it was not. Lazy loading only works in web workers. Use --embed-file or --preload-file in emcc on the main thread.");
2804
+ } else {
2805
+ try {
2806
+ obj.contents = readBinary(obj.url);
2807
+ } catch (e) {
2808
+ throw new FS.ErrnoError(29);
2809
+ }
2810
+ }
2811
+ },
2812
+ createLazyFile(parent, name, url, canRead, canWrite) {
2813
+ class LazyUint8Array {
2814
+ lengthKnown = false;
2815
+ chunks = [];
2816
+ // Loaded chunks. Index is the chunk number
2817
+ get(idx) {
2818
+ if (idx > this.length - 1 || idx < 0) {
2819
+ return void 0;
2820
+ }
2821
+ var chunkOffset = idx % this.chunkSize;
2822
+ var chunkNum = idx / this.chunkSize | 0;
2823
+ return this.getter(chunkNum)[chunkOffset];
2824
+ }
2825
+ setDataGetter(getter) {
2826
+ this.getter = getter;
2827
+ }
2828
+ cacheLength() {
2829
+ var xhr = new XMLHttpRequest();
2830
+ xhr.open("HEAD", url, false);
2831
+ xhr.send(null);
2832
+ if (!(xhr.status >= 200 && xhr.status < 300 || xhr.status === 304)) abort("Couldn't load " + url + ". Status: " + xhr.status);
2833
+ var datalength = Number(xhr.getResponseHeader("Content-length"));
2834
+ var header;
2835
+ var hasByteServing = (header = xhr.getResponseHeader("Accept-Ranges")) && header === "bytes";
2836
+ var usesGzip = (header = xhr.getResponseHeader("Content-Encoding")) && header === "gzip";
2837
+ var chunkSize = 1024 * 1024;
2838
+ if (!hasByteServing) chunkSize = datalength;
2839
+ var doXHR = (from, to) => {
2840
+ if (from > to) abort("invalid range (" + from + ", " + to + ") or no bytes requested!");
2841
+ if (to > datalength - 1) abort("only " + datalength + " bytes available! programmer error!");
2842
+ var xhr2 = new XMLHttpRequest();
2843
+ xhr2.open("GET", url, false);
2844
+ if (datalength !== chunkSize) xhr2.setRequestHeader("Range", "bytes=" + from + "-" + to);
2845
+ xhr2.responseType = "arraybuffer";
2846
+ if (xhr2.overrideMimeType) {
2847
+ xhr2.overrideMimeType("text/plain; charset=x-user-defined");
2848
+ }
2849
+ xhr2.send(null);
2850
+ if (!(xhr2.status >= 200 && xhr2.status < 300 || xhr2.status === 304)) abort("Couldn't load " + url + ". Status: " + xhr2.status);
2851
+ if (xhr2.response !== void 0) {
2852
+ return new Uint8Array(
2853
+ /** @type{Array<number>} */
2854
+ xhr2.response || []
2855
+ );
2856
+ }
2857
+ return intArrayFromString(xhr2.responseText || "", true);
2858
+ };
2859
+ var lazyArray2 = this;
2860
+ lazyArray2.setDataGetter((chunkNum) => {
2861
+ var start = chunkNum * chunkSize;
2862
+ var end = (chunkNum + 1) * chunkSize - 1;
2863
+ end = Math.min(end, datalength - 1);
2864
+ if (typeof lazyArray2.chunks[chunkNum] == "undefined") {
2865
+ lazyArray2.chunks[chunkNum] = doXHR(start, end);
2866
+ }
2867
+ if (typeof lazyArray2.chunks[chunkNum] == "undefined") abort("doXHR failed!");
2868
+ return lazyArray2.chunks[chunkNum];
2869
+ });
2870
+ if (usesGzip || !datalength) {
2871
+ chunkSize = datalength = 1;
2872
+ datalength = this.getter(0).length;
2873
+ chunkSize = datalength;
2874
+ out("LazyFiles on gzip forces download of the whole file when length is accessed");
2875
+ }
2876
+ this._length = datalength;
2877
+ this._chunkSize = chunkSize;
2878
+ this.lengthKnown = true;
2879
+ }
2880
+ get length() {
2881
+ if (!this.lengthKnown) {
2882
+ this.cacheLength();
2883
+ }
2884
+ return this._length;
2885
+ }
2886
+ get chunkSize() {
2887
+ if (!this.lengthKnown) {
2888
+ this.cacheLength();
2889
+ }
2890
+ return this._chunkSize;
2891
+ }
2892
+ }
2893
+ if (globalThis.XMLHttpRequest) {
2894
+ if (!ENVIRONMENT_IS_WORKER) abort("Cannot do synchronous binary XHRs outside webworkers in modern browsers. Use --embed-file or --preload-file in emcc");
2895
+ var lazyArray = new LazyUint8Array();
2896
+ var properties = { isDevice: false, contents: lazyArray };
2897
+ } else {
2898
+ var properties = { isDevice: false, url };
2899
+ }
2900
+ var node = FS.createFile(parent, name, properties, canRead, canWrite);
2901
+ if (properties.contents) {
2902
+ node.contents = properties.contents;
2903
+ } else if (properties.url) {
2904
+ node.contents = null;
2905
+ node.url = properties.url;
2906
+ }
2907
+ Object.defineProperties(node, {
2908
+ usedBytes: {
2909
+ get: function() {
2910
+ return this.contents.length;
2911
+ }
2912
+ }
2913
+ });
2914
+ var stream_ops = {};
2915
+ for (const [key, fn] of Object.entries(node.stream_ops)) {
2916
+ stream_ops[key] = (...args) => {
2917
+ FS.forceLoadFile(node);
2918
+ return fn(...args);
2919
+ };
2920
+ }
2921
+ function writeChunks(stream, buffer, offset, length, position) {
2922
+ var contents = stream.node.contents;
2923
+ if (position >= contents.length)
2924
+ return 0;
2925
+ var size = Math.min(contents.length - position, length);
2926
+ assert(size >= 0);
2927
+ if (contents.slice) {
2928
+ for (var i = 0; i < size; i++) {
2929
+ buffer[offset + i] = contents[position + i];
2930
+ }
2931
+ } else {
2932
+ for (var i = 0; i < size; i++) {
2933
+ buffer[offset + i] = contents.get(position + i);
2934
+ }
2935
+ }
2936
+ return size;
2937
+ }
2938
+ stream_ops.read = (stream, buffer, offset, length, position) => {
2939
+ FS.forceLoadFile(node);
2940
+ return writeChunks(stream, buffer, offset, length, position);
2941
+ };
2942
+ stream_ops.mmap = (stream, length, position, prot, flags) => {
2943
+ FS.forceLoadFile(node);
2944
+ var ptr = mmapAlloc(length);
2945
+ if (!ptr) {
2946
+ throw new FS.ErrnoError(48);
2947
+ }
2948
+ writeChunks(stream, HEAP8, ptr, length, position);
2949
+ return { ptr, allocated: true };
2950
+ };
2951
+ node.stream_ops = stream_ops;
2952
+ return node;
2953
+ },
2954
+ absolutePath() {
2955
+ abort("FS.absolutePath has been removed; use PATH_FS.resolve instead");
2956
+ },
2957
+ createFolder() {
2958
+ abort("FS.createFolder has been removed; use FS.mkdir instead");
2959
+ },
2960
+ createLink() {
2961
+ abort("FS.createLink has been removed; use FS.symlink instead");
2962
+ },
2963
+ joinPath() {
2964
+ abort("FS.joinPath has been removed; use PATH.join instead");
2965
+ },
2966
+ mmapAlloc() {
2967
+ abort("FS.mmapAlloc has been replaced by the top level function mmapAlloc");
2968
+ },
2969
+ standardizePath() {
2970
+ abort("FS.standardizePath has been removed; use PATH.normalize instead");
2971
+ }
2972
+ };
2973
+ var SYSCALLS = {
2974
+ calculateAt(dirfd, path, allowEmpty) {
2975
+ if (PATH.isAbs(path)) {
2976
+ return path;
2977
+ }
2978
+ var dir;
2979
+ if (dirfd === -100) {
2980
+ dir = FS.cwd();
2981
+ } else {
2982
+ var dirstream = SYSCALLS.getStreamFromFD(dirfd);
2983
+ dir = dirstream.path;
2984
+ }
2985
+ if (path.length == 0) {
2986
+ if (!allowEmpty) {
2987
+ throw new FS.ErrnoError(44);
2988
+ ;
2989
+ }
2990
+ return dir;
2991
+ }
2992
+ return dir + "/" + path;
2993
+ },
2994
+ writeStat(buf, stat) {
2995
+ HEAPU32[buf >> 2] = stat.dev;
2996
+ HEAPU32[buf + 4 >> 2] = stat.mode;
2997
+ HEAPU32[buf + 8 >> 2] = stat.nlink;
2998
+ HEAPU32[buf + 12 >> 2] = stat.uid;
2999
+ HEAPU32[buf + 16 >> 2] = stat.gid;
3000
+ HEAPU32[buf + 20 >> 2] = stat.rdev;
3001
+ HEAP64[buf + 24 >> 3] = BigInt(stat.size);
3002
+ HEAP32[buf + 32 >> 2] = 4096;
3003
+ HEAP32[buf + 36 >> 2] = stat.blocks;
3004
+ var atime = stat.atime.getTime();
3005
+ var mtime = stat.mtime.getTime();
3006
+ var ctime = stat.ctime.getTime();
3007
+ HEAP64[buf + 40 >> 3] = BigInt(Math.floor(atime / 1e3));
3008
+ HEAPU32[buf + 48 >> 2] = atime % 1e3 * 1e3 * 1e3;
3009
+ HEAP64[buf + 56 >> 3] = BigInt(Math.floor(mtime / 1e3));
3010
+ HEAPU32[buf + 64 >> 2] = mtime % 1e3 * 1e3 * 1e3;
3011
+ HEAP64[buf + 72 >> 3] = BigInt(Math.floor(ctime / 1e3));
3012
+ HEAPU32[buf + 80 >> 2] = ctime % 1e3 * 1e3 * 1e3;
3013
+ HEAP64[buf + 88 >> 3] = BigInt(stat.ino);
3014
+ return 0;
3015
+ },
3016
+ writeStatFs(buf, stats) {
3017
+ HEAPU32[buf + 4 >> 2] = stats.bsize;
3018
+ HEAPU32[buf + 60 >> 2] = stats.bsize;
3019
+ HEAP64[buf + 8 >> 3] = BigInt(stats.blocks);
3020
+ HEAP64[buf + 16 >> 3] = BigInt(stats.bfree);
3021
+ HEAP64[buf + 24 >> 3] = BigInt(stats.bavail);
3022
+ HEAP64[buf + 32 >> 3] = BigInt(stats.files);
3023
+ HEAP64[buf + 40 >> 3] = BigInt(stats.ffree);
3024
+ HEAPU32[buf + 48 >> 2] = stats.fsid;
3025
+ HEAPU32[buf + 64 >> 2] = stats.flags;
3026
+ HEAPU32[buf + 56 >> 2] = stats.namelen;
3027
+ },
3028
+ doMsync(addr, stream, len, flags, offset) {
3029
+ if (!FS.isFile(stream.node.mode)) {
3030
+ throw new FS.ErrnoError(43);
3031
+ }
3032
+ if (flags & 2) {
3033
+ return 0;
3034
+ }
3035
+ var buffer = HEAPU8.slice(addr, addr + len);
3036
+ FS.msync(stream, buffer, offset, len, flags);
3037
+ },
3038
+ getStreamFromFD(fd) {
3039
+ var stream = FS.getStreamChecked(fd);
3040
+ return stream;
3041
+ },
3042
+ varargs: void 0,
3043
+ getStr(ptr) {
3044
+ var ret = UTF8ToString(ptr);
3045
+ return ret;
3046
+ }
3047
+ };
3048
+ function ___syscall_dup(fd) {
3049
+ try {
3050
+ var old = SYSCALLS.getStreamFromFD(fd);
3051
+ return FS.dupStream(old).fd;
3052
+ } catch (e) {
3053
+ if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e;
3054
+ return -e.errno;
3055
+ }
3056
+ }
3057
+ function ___syscall_fstat64(fd, buf) {
3058
+ try {
3059
+ return SYSCALLS.writeStat(buf, FS.fstat(fd));
3060
+ } catch (e) {
3061
+ if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e;
3062
+ return -e.errno;
3063
+ }
3064
+ }
3065
+ function ___syscall_lstat64(path, buf) {
3066
+ try {
3067
+ path = SYSCALLS.getStr(path);
3068
+ return SYSCALLS.writeStat(buf, FS.lstat(path));
3069
+ } catch (e) {
3070
+ if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e;
3071
+ return -e.errno;
3072
+ }
3073
+ }
3074
+ function ___syscall_mkdirat(dirfd, path, mode) {
3075
+ try {
3076
+ path = SYSCALLS.getStr(path);
3077
+ path = SYSCALLS.calculateAt(dirfd, path);
3078
+ FS.mkdir(path, mode, 0);
3079
+ return 0;
3080
+ } catch (e) {
3081
+ if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e;
3082
+ return -e.errno;
3083
+ }
3084
+ }
3085
+ function ___syscall_newfstatat(dirfd, path, buf, flags) {
3086
+ try {
3087
+ path = SYSCALLS.getStr(path);
3088
+ var nofollow = flags & 256;
3089
+ var allowEmpty = flags & 4096;
3090
+ flags = flags & ~6400;
3091
+ assert(!flags, `unknown flags in __syscall_newfstatat: ${flags}`);
3092
+ path = SYSCALLS.calculateAt(dirfd, path, allowEmpty);
3093
+ return SYSCALLS.writeStat(buf, nofollow ? FS.lstat(path) : FS.stat(path));
3094
+ } catch (e) {
3095
+ if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e;
3096
+ return -e.errno;
3097
+ }
3098
+ }
3099
+ var syscallGetVarargI = () => {
3100
+ assert(SYSCALLS.varargs != void 0);
3101
+ var ret = HEAP32[+SYSCALLS.varargs >> 2];
3102
+ SYSCALLS.varargs += 4;
3103
+ return ret;
3104
+ };
3105
+ function ___syscall_openat(dirfd, path, flags, varargs) {
3106
+ SYSCALLS.varargs = varargs;
3107
+ try {
3108
+ path = SYSCALLS.getStr(path);
3109
+ path = SYSCALLS.calculateAt(dirfd, path);
3110
+ var mode = varargs ? syscallGetVarargI() : 0;
3111
+ return FS.open(path, flags, mode).fd;
3112
+ } catch (e) {
3113
+ if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e;
3114
+ return -e.errno;
3115
+ }
3116
+ }
3117
+ function ___syscall_stat64(path, buf) {
3118
+ try {
3119
+ path = SYSCALLS.getStr(path);
3120
+ return SYSCALLS.writeStat(buf, FS.stat(path));
3121
+ } catch (e) {
3122
+ if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e;
3123
+ return -e.errno;
3124
+ }
3125
+ }
3126
+ var __abort_js = () => abort("native code called abort()");
3127
+ var getExecutableName = () => thisProgram || "./this.program";
3128
+ var stringToUTF8 = (str, outPtr, maxBytesToWrite) => {
3129
+ assert(typeof maxBytesToWrite == "number", "stringToUTF8(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!");
3130
+ return stringToUTF8Array(str, HEAPU8, outPtr, maxBytesToWrite);
3131
+ };
3132
+ var __emscripten_get_progname = (str, len) => stringToUTF8(getExecutableName(), str, len);
3133
+ var stringToNewUTF8 = (str) => {
3134
+ var size = lengthBytesUTF8(str) + 1;
3135
+ var ret = _malloc(size);
3136
+ if (ret) stringToUTF8(str, ret, size);
3137
+ return ret;
3138
+ };
3139
+ var __emscripten_sanitizer_get_option = (name) => stringToNewUTF8(Module[UTF8ToString(name)] || "");
3140
+ var __emscripten_sanitizer_use_colors = () => {
3141
+ var setting = Module["printWithColors"];
3142
+ if (setting !== void 0) {
3143
+ return setting;
3144
+ }
3145
+ return ENVIRONMENT_IS_NODE && process.stderr.isTTY;
3146
+ };
3147
+ var isLeapYear = (year) => year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);
3148
+ var MONTH_DAYS_LEAP_CUMULATIVE = [0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335];
3149
+ var MONTH_DAYS_REGULAR_CUMULATIVE = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334];
3150
+ var ydayFromDate = (date) => {
3151
+ var leap = isLeapYear(date.getFullYear());
3152
+ var monthDaysCumulative = leap ? MONTH_DAYS_LEAP_CUMULATIVE : MONTH_DAYS_REGULAR_CUMULATIVE;
3153
+ var yday = monthDaysCumulative[date.getMonth()] + date.getDate() - 1;
3154
+ return yday;
3155
+ };
3156
+ var INT53_MAX = 9007199254740992;
3157
+ var INT53_MIN = -9007199254740992;
3158
+ var bigintToI53Checked = (num) => num < INT53_MIN || num > INT53_MAX ? NaN : Number(num);
3159
+ function __localtime_js(time, tmPtr) {
3160
+ time = bigintToI53Checked(time);
3161
+ var date = new Date(time * 1e3);
3162
+ HEAP32[tmPtr >> 2] = date.getSeconds();
3163
+ HEAP32[tmPtr + 4 >> 2] = date.getMinutes();
3164
+ HEAP32[tmPtr + 8 >> 2] = date.getHours();
3165
+ HEAP32[tmPtr + 12 >> 2] = date.getDate();
3166
+ HEAP32[tmPtr + 16 >> 2] = date.getMonth();
3167
+ HEAP32[tmPtr + 20 >> 2] = date.getFullYear() - 1900;
3168
+ HEAP32[tmPtr + 24 >> 2] = date.getDay();
3169
+ var yday = ydayFromDate(date) | 0;
3170
+ HEAP32[tmPtr + 28 >> 2] = yday;
3171
+ HEAP32[tmPtr + 36 >> 2] = -(date.getTimezoneOffset() * 60);
3172
+ var start = new Date(date.getFullYear(), 0, 1);
3173
+ var summerOffset = new Date(date.getFullYear(), 6, 1).getTimezoneOffset();
3174
+ var winterOffset = start.getTimezoneOffset();
3175
+ var dst = (summerOffset != winterOffset && date.getTimezoneOffset() == Math.min(winterOffset, summerOffset)) | 0;
3176
+ HEAP32[tmPtr + 32 >> 2] = dst;
3177
+ ;
3178
+ }
3179
+ function __mmap_js(len, prot, flags, fd, offset, allocated, addr) {
3180
+ offset = bigintToI53Checked(offset);
3181
+ try {
3182
+ assert(!isNaN(offset));
3183
+ var stream = SYSCALLS.getStreamFromFD(fd);
3184
+ var res = FS.mmap(stream, len, offset, prot, flags);
3185
+ var ptr = res.ptr;
3186
+ HEAP32[allocated >> 2] = res.allocated;
3187
+ HEAPU32[addr >> 2] = ptr;
3188
+ return 0;
3189
+ } catch (e) {
3190
+ if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e;
3191
+ return -e.errno;
3192
+ }
3193
+ ;
3194
+ }
3195
+ function __munmap_js(addr, len, prot, flags, fd, offset) {
3196
+ offset = bigintToI53Checked(offset);
3197
+ try {
3198
+ var stream = SYSCALLS.getStreamFromFD(fd);
3199
+ if (prot & 2) {
3200
+ SYSCALLS.doMsync(addr, stream, len, flags, offset);
3201
+ }
3202
+ } catch (e) {
3203
+ if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e;
3204
+ return -e.errno;
3205
+ }
3206
+ ;
3207
+ }
3208
+ var __tzset_js = (timezone, daylight, std_name, dst_name) => {
3209
+ var currentYear = (/* @__PURE__ */ new Date()).getFullYear();
3210
+ var winter = new Date(currentYear, 0, 1);
3211
+ var summer = new Date(currentYear, 6, 1);
3212
+ var winterOffset = winter.getTimezoneOffset();
3213
+ var summerOffset = summer.getTimezoneOffset();
3214
+ var stdTimezoneOffset = Math.max(winterOffset, summerOffset);
3215
+ HEAPU32[timezone >> 2] = stdTimezoneOffset * 60;
3216
+ HEAP32[daylight >> 2] = Number(winterOffset != summerOffset);
3217
+ var extractZone = (timezoneOffset) => {
3218
+ var sign = timezoneOffset >= 0 ? "-" : "+";
3219
+ var absOffset = Math.abs(timezoneOffset);
3220
+ var hours = String(Math.floor(absOffset / 60)).padStart(2, "0");
3221
+ var minutes = String(absOffset % 60).padStart(2, "0");
3222
+ return `UTC${sign}${hours}${minutes}`;
3223
+ };
3224
+ var winterName = extractZone(winterOffset);
3225
+ var summerName = extractZone(summerOffset);
3226
+ assert(winterName);
3227
+ assert(summerName);
3228
+ assert(lengthBytesUTF8(winterName) <= 16, `timezone name truncated to fit in TZNAME_MAX (${winterName})`);
3229
+ assert(lengthBytesUTF8(summerName) <= 16, `timezone name truncated to fit in TZNAME_MAX (${summerName})`);
3230
+ if (summerOffset < winterOffset) {
3231
+ stringToUTF8(winterName, std_name, 17);
3232
+ stringToUTF8(summerName, dst_name, 17);
3233
+ } else {
3234
+ stringToUTF8(winterName, dst_name, 17);
3235
+ stringToUTF8(summerName, std_name, 17);
3236
+ }
3237
+ };
3238
+ var _emscripten_get_now = () => performance.now();
3239
+ var _emscripten_date_now = () => Date.now();
3240
+ var nowIsMonotonic = 1;
3241
+ var checkWasiClock = (clock_id) => clock_id >= 0 && clock_id <= 3;
3242
+ function _clock_time_get(clk_id, ignored_precision, ptime) {
3243
+ ignored_precision = bigintToI53Checked(ignored_precision);
3244
+ if (!checkWasiClock(clk_id)) {
3245
+ return 28;
3246
+ }
3247
+ var now;
3248
+ if (clk_id === 0) {
3249
+ now = _emscripten_date_now();
3250
+ } else if (nowIsMonotonic) {
3251
+ now = _emscripten_get_now();
3252
+ } else {
3253
+ return 52;
3254
+ }
3255
+ var nsec = Math.round(now * 1e3 * 1e3);
3256
+ HEAP64[ptime >> 3] = BigInt(nsec);
3257
+ return 0;
3258
+ ;
3259
+ }
3260
+ var getHeapMax = () => (
3261
+ // Stay one Wasm page short of 4GB: while e.g. Chrome is able to allocate
3262
+ // full 4GB Wasm memories, the size will wrap back to 0 bytes in Wasm side
3263
+ // for any code that deals with heap sizes, which would require special
3264
+ // casing all heap size related code to treat 0 specially.
3265
+ 2147483648
3266
+ );
3267
+ var _emscripten_get_heap_max = () => getHeapMax();
3268
+ var UNWIND_CACHE = {};
3269
+ var convertPCtoSourceLocation = (pc) => {
3270
+ if (UNWIND_CACHE.last_get_source_pc == pc) return UNWIND_CACHE.last_source;
3271
+ var match;
3272
+ var source;
3273
+ if (wasmSourceMap) {
3274
+ source = wasmSourceMap.lookup(pc);
3275
+ }
3276
+ if (!source) {
3277
+ var frame = UNWIND_CACHE[pc];
3278
+ if (!frame) return null;
3279
+ if (match = /\((.*):(\d+):(\d+)\)$/.exec(frame)) {
3280
+ source = { file: match[1], line: match[2], column: match[3] };
3281
+ } else if (match = /@(.*):(\d+):(\d+)/.exec(frame)) {
3282
+ source = { file: match[1], line: match[2], column: match[3] };
3283
+ }
3284
+ }
3285
+ UNWIND_CACHE.last_get_source_pc = pc;
3286
+ UNWIND_CACHE.last_source = source;
3287
+ return source;
3288
+ };
3289
+ var _emscripten_pc_get_column = (pc) => {
3290
+ var result = convertPCtoSourceLocation(pc);
3291
+ return result ? result.column || 0 : 0;
3292
+ };
3293
+ var noLeakCheck = (func) => {
3294
+ if (runtimeInitialized) ___lsan_disable();
3295
+ try {
3296
+ return func();
3297
+ } finally {
3298
+ if (runtimeInitialized) ___lsan_enable();
3299
+ }
3300
+ };
3301
+ var _emscripten_pc_get_file = (pc) => noLeakCheck(() => {
3302
+ var result = convertPCtoSourceLocation(pc);
3303
+ if (!result) return 0;
3304
+ _free(_emscripten_pc_get_file.ret ?? 0);
3305
+ _emscripten_pc_get_file.ret = stringToNewUTF8(result.file);
3306
+ return _emscripten_pc_get_file.ret;
3307
+ });
3308
+ var convertFrameToPC = (frame) => {
3309
+ var match;
3310
+ if (match = /\bwasm-function\[\d+\]:(0x[0-9a-f]+)/.exec(frame)) {
3311
+ return +match[1];
3312
+ } else if (match = /\bwasm-function\[(\d+)\]:(\d+)/.exec(frame)) {
3313
+ warnOnce("legacy backtrace format detected, this version of v8 is no longer supported by the emscripten backtrace mechanism");
3314
+ } else if (match = /:(\d+):\d+(?:\)|$)/.exec(frame)) {
3315
+ return 2147483648 | +match[1];
3316
+ }
3317
+ return 0;
3318
+ };
3319
+ var saveInUnwindCache = (callstack) => {
3320
+ for (var line of callstack) {
3321
+ var pc = convertFrameToPC(line);
3322
+ if (pc) {
3323
+ UNWIND_CACHE[pc] = line;
3324
+ }
3325
+ }
3326
+ };
3327
+ var jsStackTrace = () => new Error().stack.toString();
3328
+ var _emscripten_stack_snapshot = () => {
3329
+ var callstack = jsStackTrace().split("\n");
3330
+ if (callstack[0] == "Error") {
3331
+ callstack.shift();
3332
+ }
3333
+ saveInUnwindCache(callstack);
3334
+ UNWIND_CACHE.last_addr = convertFrameToPC(callstack[3]);
3335
+ UNWIND_CACHE.last_stack = callstack;
3336
+ return UNWIND_CACHE.last_addr;
3337
+ };
3338
+ var _emscripten_pc_get_function = (pc) => noLeakCheck(() => {
3339
+ var frame = UNWIND_CACHE[pc];
3340
+ if (!frame) return 0;
3341
+ var name;
3342
+ var match;
3343
+ if (match = /^\s+at .*\.wasm\.(.*) \(.*\)$/.exec(frame)) {
3344
+ name = match[1];
3345
+ } else if (match = /^\s+at (.*) \(.*\)$/.exec(frame)) {
3346
+ name = match[1];
3347
+ } else if (match = /^(.+?)@/.exec(frame)) {
3348
+ name = match[1];
3349
+ } else {
3350
+ return 0;
3351
+ }
3352
+ _free(_emscripten_pc_get_function.ret ?? 0);
3353
+ _emscripten_pc_get_function.ret = stringToNewUTF8(name);
3354
+ return _emscripten_pc_get_function.ret;
3355
+ });
3356
+ var _emscripten_pc_get_line = (pc) => {
3357
+ var result = convertPCtoSourceLocation(pc);
3358
+ return result ? result.line : 0;
3359
+ };
3360
+ var growMemory = (size) => {
3361
+ var oldHeapSize = wasmMemory.buffer.byteLength;
3362
+ var pages = (size - oldHeapSize + 65535) / 65536 | 0;
3363
+ try {
3364
+ wasmMemory.grow(pages);
3365
+ updateMemoryViews();
3366
+ return 1;
3367
+ } catch (e) {
3368
+ err(`growMemory: Attempted to grow heap from ${oldHeapSize} bytes to ${size} bytes, but got error: ${e}`);
3369
+ }
3370
+ };
3371
+ var _emscripten_resize_heap = (requestedSize) => {
3372
+ var oldSize = HEAPU8.length;
3373
+ requestedSize >>>= 0;
3374
+ assert(requestedSize > oldSize);
3375
+ var maxHeapSize = getHeapMax();
3376
+ if (requestedSize > maxHeapSize) {
3377
+ err(`Cannot enlarge memory, requested ${requestedSize} bytes, but the limit is ${maxHeapSize} bytes!`);
3378
+ return false;
3379
+ }
3380
+ for (var cutDown = 1; cutDown <= 4; cutDown *= 2) {
3381
+ var overGrownHeapSize = oldSize * (1 + 0.2 / cutDown);
3382
+ overGrownHeapSize = Math.min(overGrownHeapSize, requestedSize + 100663296);
3383
+ var newSize = Math.min(maxHeapSize, alignMemory(Math.max(requestedSize, overGrownHeapSize), 65536));
3384
+ var replacement = growMemory(newSize);
3385
+ if (replacement) {
3386
+ return true;
3387
+ }
3388
+ }
3389
+ err(`Failed to grow the heap from ${oldSize} bytes to ${newSize} bytes, not enough memory!`);
3390
+ return false;
3391
+ };
3392
+ var _emscripten_stack_unwind_buffer = (addr, buffer, count) => {
3393
+ var stack;
3394
+ if (UNWIND_CACHE.last_addr == addr) {
3395
+ stack = UNWIND_CACHE.last_stack;
3396
+ } else {
3397
+ stack = jsStackTrace().split("\n");
3398
+ if (stack[0] == "Error") {
3399
+ stack.shift();
3400
+ }
3401
+ saveInUnwindCache(stack);
3402
+ }
3403
+ var offset = 3;
3404
+ while (stack[offset] && convertFrameToPC(stack[offset]) != addr) {
3405
+ ++offset;
3406
+ }
3407
+ for (var i = 0; i < count && stack[i + offset]; ++i) {
3408
+ HEAP32[buffer + i * 4 >> 2] = convertFrameToPC(stack[i + offset]);
3409
+ }
3410
+ return i;
3411
+ };
3412
+ var ENV = {};
3413
+ var getEnvStrings = () => {
3414
+ if (!getEnvStrings.strings) {
3415
+ var lang = (globalThis.navigator?.language ?? "C").replace("-", "_") + ".UTF-8";
3416
+ var env = {
3417
+ "USER": "web_user",
3418
+ "LOGNAME": "web_user",
3419
+ "PATH": "/",
3420
+ "PWD": "/",
3421
+ "HOME": "/home/web_user",
3422
+ "LANG": lang,
3423
+ "_": getExecutableName()
3424
+ };
3425
+ for (var x in ENV) {
3426
+ if (ENV[x] === void 0) delete env[x];
3427
+ else env[x] = ENV[x];
3428
+ }
3429
+ var strings = [];
3430
+ for (var x in env) {
3431
+ strings.push(`${x}=${env[x]}`);
3432
+ }
3433
+ getEnvStrings.strings = strings;
3434
+ }
3435
+ return getEnvStrings.strings;
3436
+ };
3437
+ var _environ_get = (__environ, environ_buf) => {
3438
+ var bufSize = 0;
3439
+ var envp = 0;
3440
+ for (var string of getEnvStrings()) {
3441
+ var ptr = environ_buf + bufSize;
3442
+ HEAPU32[__environ + envp >> 2] = ptr;
3443
+ bufSize += stringToUTF8(string, ptr, Infinity) + 1;
3444
+ envp += 4;
3445
+ }
3446
+ return 0;
3447
+ };
3448
+ var _environ_sizes_get = (penviron_count, penviron_buf_size) => {
3449
+ var strings = getEnvStrings();
3450
+ HEAPU32[penviron_count >> 2] = strings.length;
3451
+ var bufSize = 0;
3452
+ for (var string of strings) {
3453
+ bufSize += lengthBytesUTF8(string) + 1;
3454
+ }
3455
+ HEAPU32[penviron_buf_size >> 2] = bufSize;
3456
+ return 0;
3457
+ };
3458
+ function _fd_close(fd) {
3459
+ try {
3460
+ var stream = SYSCALLS.getStreamFromFD(fd);
3461
+ FS.close(stream);
3462
+ return 0;
3463
+ } catch (e) {
3464
+ if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e;
3465
+ return e.errno;
3466
+ }
3467
+ }
3468
+ var doReadv = (stream, iov, iovcnt, offset) => {
3469
+ var ret = 0;
3470
+ for (var i = 0; i < iovcnt; i++) {
3471
+ var ptr = HEAPU32[iov >> 2];
3472
+ var len = HEAPU32[iov + 4 >> 2];
3473
+ iov += 8;
3474
+ var curr = FS.read(stream, HEAP8, ptr, len, offset);
3475
+ if (curr < 0) return -1;
3476
+ ret += curr;
3477
+ if (curr < len) break;
3478
+ if (typeof offset != "undefined") {
3479
+ offset += curr;
3480
+ }
3481
+ }
3482
+ return ret;
3483
+ };
3484
+ function _fd_read(fd, iov, iovcnt, pnum) {
3485
+ try {
3486
+ var stream = SYSCALLS.getStreamFromFD(fd);
3487
+ var num = doReadv(stream, iov, iovcnt);
3488
+ HEAPU32[pnum >> 2] = num;
3489
+ return 0;
3490
+ } catch (e) {
3491
+ if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e;
3492
+ return e.errno;
3493
+ }
3494
+ }
3495
+ function _fd_seek(fd, offset, whence, newOffset) {
3496
+ offset = bigintToI53Checked(offset);
3497
+ try {
3498
+ if (isNaN(offset)) return 61;
3499
+ var stream = SYSCALLS.getStreamFromFD(fd);
3500
+ FS.llseek(stream, offset, whence);
3501
+ HEAP64[newOffset >> 3] = BigInt(stream.position);
3502
+ if (stream.getdents && offset === 0 && whence === 0) stream.getdents = null;
3503
+ return 0;
3504
+ } catch (e) {
3505
+ if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e;
3506
+ return e.errno;
3507
+ }
3508
+ ;
3509
+ }
3510
+ var doWritev = (stream, iov, iovcnt, offset) => {
3511
+ var ret = 0;
3512
+ for (var i = 0; i < iovcnt; i++) {
3513
+ var ptr = HEAPU32[iov >> 2];
3514
+ var len = HEAPU32[iov + 4 >> 2];
3515
+ iov += 8;
3516
+ var curr = FS.write(stream, HEAP8, ptr, len, offset);
3517
+ if (curr < 0) return -1;
3518
+ ret += curr;
3519
+ if (curr < len) {
3520
+ break;
3521
+ }
3522
+ if (typeof offset != "undefined") {
3523
+ offset += curr;
3524
+ }
3525
+ }
3526
+ return ret;
3527
+ };
3528
+ function _fd_write(fd, iov, iovcnt, pnum) {
3529
+ try {
3530
+ var stream = SYSCALLS.getStreamFromFD(fd);
3531
+ var num = doWritev(stream, iov, iovcnt);
3532
+ HEAPU32[pnum >> 2] = num;
3533
+ return 0;
3534
+ } catch (e) {
3535
+ if (typeof FS == "undefined" || !(e.name === "ErrnoError")) throw e;
3536
+ return e.errno;
3537
+ }
3538
+ }
3539
+ var runtimeKeepaliveCounter = 0;
3540
+ var keepRuntimeAlive = () => noExitRuntime || runtimeKeepaliveCounter > 0;
3541
+ var _proc_exit = (code) => {
3542
+ EXITSTATUS = code;
3543
+ if (!keepRuntimeAlive()) {
3544
+ Module["onExit"]?.(code);
3545
+ ABORT = true;
3546
+ }
3547
+ quit_(code, new ExitStatus(code));
3548
+ };
3549
+ var getCFunc = (ident) => {
3550
+ var func = Module["_" + ident];
3551
+ assert(func, "Cannot call unknown function " + ident + ", make sure it is exported");
3552
+ return func;
3553
+ };
3554
+ var writeArrayToMemory = (array, buffer) => {
3555
+ assert(array.length >= 0, "writeArrayToMemory array must have a length (should be an array or typed array)");
3556
+ HEAP8.set(array, buffer);
3557
+ };
3558
+ var stackAlloc = (sz) => __emscripten_stack_alloc(sz);
3559
+ var stringToUTF8OnStack = (str) => {
3560
+ var size = lengthBytesUTF8(str) + 1;
3561
+ var ret = stackAlloc(size);
3562
+ stringToUTF8(str, ret, size);
3563
+ return ret;
3564
+ };
3565
+ var ccall = (ident, returnType, argTypes, args, opts) => {
3566
+ var toC = {
3567
+ "string": (str) => {
3568
+ var ret2 = 0;
3569
+ if (str !== null && str !== void 0 && str !== 0) {
3570
+ ret2 = stringToUTF8OnStack(str);
3571
+ }
3572
+ return ret2;
3573
+ },
3574
+ "array": (arr) => {
3575
+ var ret2 = stackAlloc(arr.length);
3576
+ writeArrayToMemory(arr, ret2);
3577
+ return ret2;
3578
+ }
3579
+ };
3580
+ function convertReturnValue(ret2) {
3581
+ if (returnType === "string") {
3582
+ return UTF8ToString(ret2);
3583
+ }
3584
+ if (returnType === "boolean") return Boolean(ret2);
3585
+ return ret2;
3586
+ }
3587
+ var func = getCFunc(ident);
3588
+ var cArgs = [];
3589
+ var stack = 0;
3590
+ assert(returnType !== "array", 'Return type should not be "array".');
3591
+ if (args) {
3592
+ for (var i = 0; i < args.length; i++) {
3593
+ var converter = toC[argTypes[i]];
3594
+ if (converter) {
3595
+ if (stack === 0) stack = stackSave();
3596
+ cArgs[i] = converter(args[i]);
3597
+ } else {
3598
+ cArgs[i] = args[i];
3599
+ }
3600
+ }
3601
+ }
3602
+ var ret = func(...cArgs);
3603
+ function onDone(ret2) {
3604
+ if (stack !== 0) stackRestore(stack);
3605
+ return convertReturnValue(ret2);
3606
+ }
3607
+ ret = onDone(ret);
3608
+ return ret;
3609
+ };
3610
+ var cwrap = (ident, returnType, argTypes, opts) => {
3611
+ return (...args) => ccall(ident, returnType, argTypes, args, opts);
3612
+ };
3613
+ FS.createPreloadedFile = FS_createPreloadedFile;
3614
+ FS.preloadFile = FS_preloadFile;
3615
+ FS.staticInit();
3616
+ ;
3617
+ {
3618
+ initMemory();
3619
+ if (Module["noExitRuntime"]) noExitRuntime = Module["noExitRuntime"];
3620
+ if (Module["preloadPlugins"]) preloadPlugins = Module["preloadPlugins"];
3621
+ if (Module["print"]) out = Module["print"];
3622
+ if (Module["printErr"]) err = Module["printErr"];
3623
+ if (Module["wasmBinary"]) wasmBinary = Module["wasmBinary"];
3624
+ checkIncomingModuleAPI();
3625
+ if (Module["arguments"]) arguments_ = Module["arguments"];
3626
+ if (Module["thisProgram"]) thisProgram = Module["thisProgram"];
3627
+ assert(typeof Module["memoryInitializerPrefixURL"] == "undefined", "Module.memoryInitializerPrefixURL option was removed, use Module.locateFile instead");
3628
+ assert(typeof Module["pthreadMainPrefixURL"] == "undefined", "Module.pthreadMainPrefixURL option was removed, use Module.locateFile instead");
3629
+ assert(typeof Module["cdInitializerPrefixURL"] == "undefined", "Module.cdInitializerPrefixURL option was removed, use Module.locateFile instead");
3630
+ assert(typeof Module["filePackagePrefixURL"] == "undefined", "Module.filePackagePrefixURL option was removed, use Module.locateFile instead");
3631
+ assert(typeof Module["read"] == "undefined", "Module.read option was removed");
3632
+ assert(typeof Module["readAsync"] == "undefined", "Module.readAsync option was removed (modify readAsync in JS)");
3633
+ assert(typeof Module["readBinary"] == "undefined", "Module.readBinary option was removed (modify readBinary in JS)");
3634
+ assert(typeof Module["setWindowTitle"] == "undefined", "Module.setWindowTitle option was removed (modify emscripten_set_window_title in JS)");
3635
+ assert(typeof Module["TOTAL_MEMORY"] == "undefined", "Module.TOTAL_MEMORY has been renamed Module.INITIAL_MEMORY");
3636
+ assert(typeof Module["ENVIRONMENT"] == "undefined", "Module.ENVIRONMENT has been deprecated. To force the environment, use the ENVIRONMENT compile-time option (for example, -sENVIRONMENT=web or -sENVIRONMENT=node)");
3637
+ assert(typeof Module["STACK_SIZE"] == "undefined", "STACK_SIZE can no longer be set at runtime. Use -sSTACK_SIZE at link time");
3638
+ if (Module["preInit"]) {
3639
+ if (typeof Module["preInit"] == "function") Module["preInit"] = [Module["preInit"]];
3640
+ while (Module["preInit"].length > 0) {
3641
+ Module["preInit"].shift()();
3642
+ }
3643
+ }
3644
+ consumedModuleProp("preInit");
3645
+ }
3646
+ Module["cwrap"] = cwrap;
3647
+ Module["UTF8ToString"] = UTF8ToString;
3648
+ Module["stringToUTF8"] = stringToUTF8;
3649
+ Module["lengthBytesUTF8"] = lengthBytesUTF8;
3650
+ var missingLibrarySymbols = [
3651
+ "writeI53ToI64",
3652
+ "writeI53ToI64Clamped",
3653
+ "writeI53ToI64Signaling",
3654
+ "writeI53ToU64Clamped",
3655
+ "writeI53ToU64Signaling",
3656
+ "readI53FromI64",
3657
+ "readI53FromU64",
3658
+ "convertI32PairToI53",
3659
+ "convertI32PairToI53Checked",
3660
+ "convertU32PairToI53",
3661
+ "getTempRet0",
3662
+ "setTempRet0",
3663
+ "createNamedFunction",
3664
+ "exitJS",
3665
+ "withStackSave",
3666
+ "inetPton4",
3667
+ "inetNtop4",
3668
+ "inetPton6",
3669
+ "inetNtop6",
3670
+ "readSockaddr",
3671
+ "writeSockaddr",
3672
+ "readEmAsmArgs",
3673
+ "jstoi_q",
3674
+ "autoResumeAudioContext",
3675
+ "getDynCaller",
3676
+ "dynCall",
3677
+ "handleException",
3678
+ "runtimeKeepalivePush",
3679
+ "runtimeKeepalivePop",
3680
+ "callUserCallback",
3681
+ "maybeExit",
3682
+ "asmjsMangle",
3683
+ "HandleAllocator",
3684
+ "addOnInit",
3685
+ "addOnPostCtor",
3686
+ "addOnPreMain",
3687
+ "addOnExit",
3688
+ "STACK_SIZE",
3689
+ "STACK_ALIGN",
3690
+ "POINTER_SIZE",
3691
+ "ASSERTIONS",
3692
+ "convertJsFunctionToWasm",
3693
+ "getEmptyTableSlot",
3694
+ "updateTableMap",
3695
+ "getFunctionAddress",
3696
+ "addFunction",
3697
+ "removeFunction",
3698
+ "intArrayToString",
3699
+ "AsciiToString",
3700
+ "stringToAscii",
3701
+ "UTF16ToString",
3702
+ "stringToUTF16",
3703
+ "lengthBytesUTF16",
3704
+ "UTF32ToString",
3705
+ "stringToUTF32",
3706
+ "lengthBytesUTF32",
3707
+ "registerKeyEventCallback",
3708
+ "maybeCStringToJsString",
3709
+ "findEventTarget",
3710
+ "getBoundingClientRect",
3711
+ "fillMouseEventData",
3712
+ "registerMouseEventCallback",
3713
+ "registerWheelEventCallback",
3714
+ "registerUiEventCallback",
3715
+ "registerFocusEventCallback",
3716
+ "fillDeviceOrientationEventData",
3717
+ "registerDeviceOrientationEventCallback",
3718
+ "fillDeviceMotionEventData",
3719
+ "registerDeviceMotionEventCallback",
3720
+ "screenOrientation",
3721
+ "fillOrientationChangeEventData",
3722
+ "registerOrientationChangeEventCallback",
3723
+ "fillFullscreenChangeEventData",
3724
+ "registerFullscreenChangeEventCallback",
3725
+ "JSEvents_requestFullscreen",
3726
+ "JSEvents_resizeCanvasForFullscreen",
3727
+ "registerRestoreOldStyle",
3728
+ "hideEverythingExceptGivenElement",
3729
+ "restoreHiddenElements",
3730
+ "setLetterbox",
3731
+ "softFullscreenResizeWebGLRenderTarget",
3732
+ "doRequestFullscreen",
3733
+ "fillPointerlockChangeEventData",
3734
+ "registerPointerlockChangeEventCallback",
3735
+ "registerPointerlockErrorEventCallback",
3736
+ "requestPointerLock",
3737
+ "fillVisibilityChangeEventData",
3738
+ "registerVisibilityChangeEventCallback",
3739
+ "registerTouchEventCallback",
3740
+ "fillGamepadEventData",
3741
+ "registerGamepadEventCallback",
3742
+ "registerBeforeUnloadEventCallback",
3743
+ "fillBatteryEventData",
3744
+ "registerBatteryEventCallback",
3745
+ "setCanvasElementSize",
3746
+ "getCanvasElementSize",
3747
+ "getCallstack",
3748
+ "wasiRightsToMuslOFlags",
3749
+ "wasiOFlagsToMuslOFlags",
3750
+ "safeSetTimeout",
3751
+ "setImmediateWrapped",
3752
+ "safeRequestAnimationFrame",
3753
+ "clearImmediateWrapped",
3754
+ "registerPostMainLoop",
3755
+ "registerPreMainLoop",
3756
+ "getPromise",
3757
+ "makePromise",
3758
+ "idsToPromises",
3759
+ "makePromiseCallback",
3760
+ "Browser_asyncPrepareDataCounter",
3761
+ "arraySum",
3762
+ "addDays",
3763
+ "getSocketFromFD",
3764
+ "getSocketAddress",
3765
+ "FS_mkdirTree",
3766
+ "_setNetworkCallback",
3767
+ "ALLOC_NORMAL",
3768
+ "ALLOC_STACK",
3769
+ "allocate",
3770
+ "writeStringToMemory",
3771
+ "writeAsciiToMemory",
3772
+ "allocateUTF8",
3773
+ "allocateUTF8OnStack",
3774
+ "stackTrace",
3775
+ "getNativeTypeSize"
3776
+ ];
3777
+ missingLibrarySymbols.forEach(missingLibrarySymbol);
3778
+ var unexportedSymbols = [
3779
+ "run",
3780
+ "out",
3781
+ "err",
3782
+ "callMain",
3783
+ "abort",
3784
+ "wasmExports",
3785
+ "HEAPF32",
3786
+ "HEAPF64",
3787
+ "HEAP16",
3788
+ "HEAPU16",
3789
+ "HEAP32",
3790
+ "HEAPU32",
3791
+ "HEAP64",
3792
+ "HEAPU64",
3793
+ "WasmSourceMap",
3794
+ "writeStackCookie",
3795
+ "checkStackCookie",
3796
+ "INT53_MAX",
3797
+ "INT53_MIN",
3798
+ "bigintToI53Checked",
3799
+ "stackSave",
3800
+ "stackRestore",
3801
+ "stackAlloc",
3802
+ "ptrToString",
3803
+ "zeroMemory",
3804
+ "getHeapMax",
3805
+ "growMemory",
3806
+ "ENV",
3807
+ "ERRNO_CODES",
3808
+ "strError",
3809
+ "DNS",
3810
+ "Protocols",
3811
+ "Sockets",
3812
+ "timers",
3813
+ "warnOnce",
3814
+ "noLeakCheck",
3815
+ "readEmAsmArgsArray",
3816
+ "getExecutableName",
3817
+ "keepRuntimeAlive",
3818
+ "asyncLoad",
3819
+ "alignMemory",
3820
+ "mmapAlloc",
3821
+ "wasmTable",
3822
+ "wasmMemory",
3823
+ "getUniqueRunDependency",
3824
+ "noExitRuntime",
3825
+ "addRunDependency",
3826
+ "removeRunDependency",
3827
+ "addOnPreRun",
3828
+ "addOnPostRun",
3829
+ "ccall",
3830
+ "freeTableIndexes",
3831
+ "functionsInTableMap",
3832
+ "setValue",
3833
+ "getValue",
3834
+ "PATH",
3835
+ "PATH_FS",
3836
+ "UTF8Decoder",
3837
+ "UTF8ArrayToString",
3838
+ "stringToUTF8Array",
3839
+ "intArrayFromString",
3840
+ "UTF16Decoder",
3841
+ "stringToNewUTF8",
3842
+ "stringToUTF8OnStack",
3843
+ "writeArrayToMemory",
3844
+ "JSEvents",
3845
+ "specialHTMLTargets",
3846
+ "findCanvasEventTarget",
3847
+ "currentFullscreenStrategy",
3848
+ "restoreOldWindowedStyle",
3849
+ "jsStackTrace",
3850
+ "UNWIND_CACHE",
3851
+ "convertPCtoSourceLocation",
3852
+ "ExitStatus",
3853
+ "getEnvStrings",
3854
+ "checkWasiClock",
3855
+ "doReadv",
3856
+ "doWritev",
3857
+ "initRandomFill",
3858
+ "randomFill",
3859
+ "emSetImmediate",
3860
+ "emClearImmediate_deps",
3861
+ "emClearImmediate",
3862
+ "promiseMap",
3863
+ "Browser",
3864
+ "requestFullscreen",
3865
+ "requestFullScreen",
3866
+ "setCanvasSize",
3867
+ "getUserMedia",
3868
+ "createContext",
3869
+ "getPreloadedImageData__data",
3870
+ "wget",
3871
+ "MONTH_DAYS_REGULAR",
3872
+ "MONTH_DAYS_LEAP",
3873
+ "MONTH_DAYS_REGULAR_CUMULATIVE",
3874
+ "MONTH_DAYS_LEAP_CUMULATIVE",
3875
+ "isLeapYear",
3876
+ "ydayFromDate",
3877
+ "SYSCALLS",
3878
+ "preloadPlugins",
3879
+ "FS_createPreloadedFile",
3880
+ "FS_preloadFile",
3881
+ "FS_modeStringToFlags",
3882
+ "FS_getMode",
3883
+ "FS_stdin_getChar_buffer",
3884
+ "FS_stdin_getChar",
3885
+ "FS_unlink",
3886
+ "FS_createPath",
3887
+ "FS_createDevice",
3888
+ "FS_readFile",
3889
+ "FS",
3890
+ "FS_root",
3891
+ "FS_mounts",
3892
+ "FS_devices",
3893
+ "FS_streams",
3894
+ "FS_nextInode",
3895
+ "FS_nameTable",
3896
+ "FS_currentPath",
3897
+ "FS_initialized",
3898
+ "FS_ignorePermissions",
3899
+ "FS_filesystems",
3900
+ "FS_syncFSRequests",
3901
+ "FS_lookupPath",
3902
+ "FS_getPath",
3903
+ "FS_hashName",
3904
+ "FS_hashAddNode",
3905
+ "FS_hashRemoveNode",
3906
+ "FS_lookupNode",
3907
+ "FS_createNode",
3908
+ "FS_destroyNode",
3909
+ "FS_isRoot",
3910
+ "FS_isMountpoint",
3911
+ "FS_isFile",
3912
+ "FS_isDir",
3913
+ "FS_isLink",
3914
+ "FS_isChrdev",
3915
+ "FS_isBlkdev",
3916
+ "FS_isFIFO",
3917
+ "FS_isSocket",
3918
+ "FS_flagsToPermissionString",
3919
+ "FS_nodePermissions",
3920
+ "FS_mayLookup",
3921
+ "FS_mayCreate",
3922
+ "FS_mayDelete",
3923
+ "FS_mayOpen",
3924
+ "FS_checkOpExists",
3925
+ "FS_nextfd",
3926
+ "FS_getStreamChecked",
3927
+ "FS_getStream",
3928
+ "FS_createStream",
3929
+ "FS_closeStream",
3930
+ "FS_dupStream",
3931
+ "FS_doSetAttr",
3932
+ "FS_chrdev_stream_ops",
3933
+ "FS_major",
3934
+ "FS_minor",
3935
+ "FS_makedev",
3936
+ "FS_registerDevice",
3937
+ "FS_getDevice",
3938
+ "FS_getMounts",
3939
+ "FS_syncfs",
3940
+ "FS_mount",
3941
+ "FS_unmount",
3942
+ "FS_lookup",
3943
+ "FS_mknod",
3944
+ "FS_statfs",
3945
+ "FS_statfsStream",
3946
+ "FS_statfsNode",
3947
+ "FS_create",
3948
+ "FS_mkdir",
3949
+ "FS_mkdev",
3950
+ "FS_symlink",
3951
+ "FS_rename",
3952
+ "FS_rmdir",
3953
+ "FS_readdir",
3954
+ "FS_readlink",
3955
+ "FS_stat",
3956
+ "FS_fstat",
3957
+ "FS_lstat",
3958
+ "FS_doChmod",
3959
+ "FS_chmod",
3960
+ "FS_lchmod",
3961
+ "FS_fchmod",
3962
+ "FS_doChown",
3963
+ "FS_chown",
3964
+ "FS_lchown",
3965
+ "FS_fchown",
3966
+ "FS_doTruncate",
3967
+ "FS_truncate",
3968
+ "FS_ftruncate",
3969
+ "FS_utime",
3970
+ "FS_open",
3971
+ "FS_close",
3972
+ "FS_isClosed",
3973
+ "FS_llseek",
3974
+ "FS_read",
3975
+ "FS_write",
3976
+ "FS_mmap",
3977
+ "FS_msync",
3978
+ "FS_ioctl",
3979
+ "FS_writeFile",
3980
+ "FS_cwd",
3981
+ "FS_chdir",
3982
+ "FS_createDefaultDirectories",
3983
+ "FS_createDefaultDevices",
3984
+ "FS_createSpecialDirectories",
3985
+ "FS_createStandardStreams",
3986
+ "FS_staticInit",
3987
+ "FS_init",
3988
+ "FS_quit",
3989
+ "FS_findObject",
3990
+ "FS_analyzePath",
3991
+ "FS_createFile",
3992
+ "FS_createDataFile",
3993
+ "FS_forceLoadFile",
3994
+ "FS_createLazyFile",
3995
+ "FS_absolutePath",
3996
+ "FS_createFolder",
3997
+ "FS_createLink",
3998
+ "FS_joinPath",
3999
+ "FS_mmapAlloc",
4000
+ "FS_standardizePath",
4001
+ "MEMFS",
4002
+ "TTY",
4003
+ "PIPEFS",
4004
+ "SOCKFS",
4005
+ "print",
4006
+ "printErr",
4007
+ "jstoi_s"
4008
+ ];
4009
+ unexportedSymbols.forEach(unexportedRuntimeSymbol);
4010
+ function checkIncomingModuleAPI() {
4011
+ ignoredModuleProp("fetchSettings");
4012
+ ignoredModuleProp("logReadFiles");
4013
+ ignoredModuleProp("loadSplitModule");
4014
+ }
4015
+ function qts_host_ref_free(rt, id) {
4016
+ const asyncify = void 0;
4017
+ Module["callbacks"]["freeHostRef"](asyncify, rt, id);
4018
+ }
4019
+ function qts_host_call_function(ctx, this_ptr, argc, argv, host_ref_id) {
4020
+ const asyncify = void 0;
4021
+ return Module["callbacks"]["callFunction"](asyncify, ctx, this_ptr, argc, argv, host_ref_id);
4022
+ }
4023
+ function qts_host_interrupt_handler(rt) {
4024
+ const asyncify = void 0;
4025
+ return Module["callbacks"]["shouldInterrupt"](asyncify, rt);
4026
+ }
4027
+ function qts_host_load_module_source(rt, ctx, module_name) {
4028
+ const asyncify = void 0;
4029
+ const moduleNameString = UTF8ToString(module_name);
4030
+ return Module["callbacks"]["loadModuleSource"](asyncify, rt, ctx, moduleNameString);
4031
+ }
4032
+ function qts_host_normalize_module(rt, ctx, module_base_name, module_name) {
4033
+ const asyncify = void 0;
4034
+ const moduleBaseNameString = UTF8ToString(module_base_name);
4035
+ const moduleNameString = UTF8ToString(module_name);
4036
+ return Module["callbacks"]["normalizeModule"](asyncify, rt, ctx, moduleBaseNameString, moduleNameString);
4037
+ }
4038
+ var _malloc = Module["_malloc"] = makeInvalidEarlyAccess("_malloc");
4039
+ var _QTS_Throw = Module["_QTS_Throw"] = makeInvalidEarlyAccess("_QTS_Throw");
4040
+ var _QTS_NewError = Module["_QTS_NewError"] = makeInvalidEarlyAccess("_QTS_NewError");
4041
+ var _QTS_RuntimeSetMemoryLimit = Module["_QTS_RuntimeSetMemoryLimit"] = makeInvalidEarlyAccess("_QTS_RuntimeSetMemoryLimit");
4042
+ var _QTS_RuntimeComputeMemoryUsage = Module["_QTS_RuntimeComputeMemoryUsage"] = makeInvalidEarlyAccess("_QTS_RuntimeComputeMemoryUsage");
4043
+ var _QTS_RuntimeDumpMemoryUsage = Module["_QTS_RuntimeDumpMemoryUsage"] = makeInvalidEarlyAccess("_QTS_RuntimeDumpMemoryUsage");
4044
+ var _QTS_RecoverableLeakCheck = Module["_QTS_RecoverableLeakCheck"] = makeInvalidEarlyAccess("_QTS_RecoverableLeakCheck");
4045
+ var _QTS_BuildIsSanitizeLeak = Module["_QTS_BuildIsSanitizeLeak"] = makeInvalidEarlyAccess("_QTS_BuildIsSanitizeLeak");
4046
+ var _QTS_RuntimeSetMaxStackSize = Module["_QTS_RuntimeSetMaxStackSize"] = makeInvalidEarlyAccess("_QTS_RuntimeSetMaxStackSize");
4047
+ var _QTS_GetUndefined = Module["_QTS_GetUndefined"] = makeInvalidEarlyAccess("_QTS_GetUndefined");
4048
+ var _QTS_GetNull = Module["_QTS_GetNull"] = makeInvalidEarlyAccess("_QTS_GetNull");
4049
+ var _QTS_GetFalse = Module["_QTS_GetFalse"] = makeInvalidEarlyAccess("_QTS_GetFalse");
4050
+ var _QTS_GetTrue = Module["_QTS_GetTrue"] = makeInvalidEarlyAccess("_QTS_GetTrue");
4051
+ var _QTS_NewHostRef = Module["_QTS_NewHostRef"] = makeInvalidEarlyAccess("_QTS_NewHostRef");
4052
+ var _QTS_GetHostRefId = Module["_QTS_GetHostRefId"] = makeInvalidEarlyAccess("_QTS_GetHostRefId");
4053
+ var _QTS_NewRuntime = Module["_QTS_NewRuntime"] = makeInvalidEarlyAccess("_QTS_NewRuntime");
4054
+ var _QTS_FreeRuntime = Module["_QTS_FreeRuntime"] = makeInvalidEarlyAccess("_QTS_FreeRuntime");
4055
+ var _free = Module["_free"] = makeInvalidEarlyAccess("_free");
4056
+ var _QTS_NewContext = Module["_QTS_NewContext"] = makeInvalidEarlyAccess("_QTS_NewContext");
4057
+ var _QTS_FreeContext = Module["_QTS_FreeContext"] = makeInvalidEarlyAccess("_QTS_FreeContext");
4058
+ var _QTS_FreeValuePointer = Module["_QTS_FreeValuePointer"] = makeInvalidEarlyAccess("_QTS_FreeValuePointer");
4059
+ var _QTS_FreeValuePointerRuntime = Module["_QTS_FreeValuePointerRuntime"] = makeInvalidEarlyAccess("_QTS_FreeValuePointerRuntime");
4060
+ var _QTS_FreeVoidPointer = Module["_QTS_FreeVoidPointer"] = makeInvalidEarlyAccess("_QTS_FreeVoidPointer");
4061
+ var _QTS_FreeCString = Module["_QTS_FreeCString"] = makeInvalidEarlyAccess("_QTS_FreeCString");
4062
+ var _QTS_DupValuePointer = Module["_QTS_DupValuePointer"] = makeInvalidEarlyAccess("_QTS_DupValuePointer");
4063
+ var _QTS_NewObject = Module["_QTS_NewObject"] = makeInvalidEarlyAccess("_QTS_NewObject");
4064
+ var _QTS_NewObjectProto = Module["_QTS_NewObjectProto"] = makeInvalidEarlyAccess("_QTS_NewObjectProto");
4065
+ var _QTS_NewArray = Module["_QTS_NewArray"] = makeInvalidEarlyAccess("_QTS_NewArray");
4066
+ var _QTS_NewArrayBuffer = Module["_QTS_NewArrayBuffer"] = makeInvalidEarlyAccess("_QTS_NewArrayBuffer");
4067
+ var _QTS_NewFloat64 = Module["_QTS_NewFloat64"] = makeInvalidEarlyAccess("_QTS_NewFloat64");
4068
+ var _QTS_GetFloat64 = Module["_QTS_GetFloat64"] = makeInvalidEarlyAccess("_QTS_GetFloat64");
4069
+ var _QTS_NewString = Module["_QTS_NewString"] = makeInvalidEarlyAccess("_QTS_NewString");
4070
+ var _QTS_GetString = Module["_QTS_GetString"] = makeInvalidEarlyAccess("_QTS_GetString");
4071
+ var _QTS_GetArrayBuffer = Module["_QTS_GetArrayBuffer"] = makeInvalidEarlyAccess("_QTS_GetArrayBuffer");
4072
+ var _QTS_GetArrayBufferLength = Module["_QTS_GetArrayBufferLength"] = makeInvalidEarlyAccess("_QTS_GetArrayBufferLength");
4073
+ var _QTS_NewSymbol = Module["_QTS_NewSymbol"] = makeInvalidEarlyAccess("_QTS_NewSymbol");
4074
+ var _QTS_GetSymbolDescriptionOrKey = Module["_QTS_GetSymbolDescriptionOrKey"] = makeInvalidEarlyAccess("_QTS_GetSymbolDescriptionOrKey");
4075
+ var _QTS_IsGlobalSymbol = Module["_QTS_IsGlobalSymbol"] = makeInvalidEarlyAccess("_QTS_IsGlobalSymbol");
4076
+ var _QTS_IsJobPending = Module["_QTS_IsJobPending"] = makeInvalidEarlyAccess("_QTS_IsJobPending");
4077
+ var _QTS_ExecutePendingJob = Module["_QTS_ExecutePendingJob"] = makeInvalidEarlyAccess("_QTS_ExecutePendingJob");
4078
+ var _QTS_GetProp = Module["_QTS_GetProp"] = makeInvalidEarlyAccess("_QTS_GetProp");
4079
+ var _QTS_GetPropNumber = Module["_QTS_GetPropNumber"] = makeInvalidEarlyAccess("_QTS_GetPropNumber");
4080
+ var _QTS_SetProp = Module["_QTS_SetProp"] = makeInvalidEarlyAccess("_QTS_SetProp");
4081
+ var _QTS_DefineProp = Module["_QTS_DefineProp"] = makeInvalidEarlyAccess("_QTS_DefineProp");
4082
+ var _QTS_GetOwnPropertyNames = Module["_QTS_GetOwnPropertyNames"] = makeInvalidEarlyAccess("_QTS_GetOwnPropertyNames");
4083
+ var _QTS_Call = Module["_QTS_Call"] = makeInvalidEarlyAccess("_QTS_Call");
4084
+ var _QTS_ResolveException = Module["_QTS_ResolveException"] = makeInvalidEarlyAccess("_QTS_ResolveException");
4085
+ var _QTS_Dump = Module["_QTS_Dump"] = makeInvalidEarlyAccess("_QTS_Dump");
4086
+ var _QTS_Eval = Module["_QTS_Eval"] = makeInvalidEarlyAccess("_QTS_Eval");
4087
+ var _QTS_GetModuleNamespace = Module["_QTS_GetModuleNamespace"] = makeInvalidEarlyAccess("_QTS_GetModuleNamespace");
4088
+ var _QTS_Typeof = Module["_QTS_Typeof"] = makeInvalidEarlyAccess("_QTS_Typeof");
4089
+ var _QTS_GetLength = Module["_QTS_GetLength"] = makeInvalidEarlyAccess("_QTS_GetLength");
4090
+ var _QTS_IsEqual = Module["_QTS_IsEqual"] = makeInvalidEarlyAccess("_QTS_IsEqual");
4091
+ var _QTS_GetGlobalObject = Module["_QTS_GetGlobalObject"] = makeInvalidEarlyAccess("_QTS_GetGlobalObject");
4092
+ var _QTS_NewPromiseCapability = Module["_QTS_NewPromiseCapability"] = makeInvalidEarlyAccess("_QTS_NewPromiseCapability");
4093
+ var _QTS_PromiseState = Module["_QTS_PromiseState"] = makeInvalidEarlyAccess("_QTS_PromiseState");
4094
+ var _QTS_PromiseResult = Module["_QTS_PromiseResult"] = makeInvalidEarlyAccess("_QTS_PromiseResult");
4095
+ var _QTS_TestStringArg = Module["_QTS_TestStringArg"] = makeInvalidEarlyAccess("_QTS_TestStringArg");
4096
+ var _QTS_GetDebugLogEnabled = Module["_QTS_GetDebugLogEnabled"] = makeInvalidEarlyAccess("_QTS_GetDebugLogEnabled");
4097
+ var _QTS_SetDebugLogEnabled = Module["_QTS_SetDebugLogEnabled"] = makeInvalidEarlyAccess("_QTS_SetDebugLogEnabled");
4098
+ var _QTS_BuildIsDebug = Module["_QTS_BuildIsDebug"] = makeInvalidEarlyAccess("_QTS_BuildIsDebug");
4099
+ var _QTS_BuildIsAsyncify = Module["_QTS_BuildIsAsyncify"] = makeInvalidEarlyAccess("_QTS_BuildIsAsyncify");
4100
+ var _QTS_NewFunction = Module["_QTS_NewFunction"] = makeInvalidEarlyAccess("_QTS_NewFunction");
4101
+ var _QTS_ArgvGetJSValueConstPointer = Module["_QTS_ArgvGetJSValueConstPointer"] = makeInvalidEarlyAccess("_QTS_ArgvGetJSValueConstPointer");
4102
+ var _QTS_RuntimeEnableInterruptHandler = Module["_QTS_RuntimeEnableInterruptHandler"] = makeInvalidEarlyAccess("_QTS_RuntimeEnableInterruptHandler");
4103
+ var _QTS_RuntimeDisableInterruptHandler = Module["_QTS_RuntimeDisableInterruptHandler"] = makeInvalidEarlyAccess("_QTS_RuntimeDisableInterruptHandler");
4104
+ var _QTS_RuntimeEnableModuleLoader = Module["_QTS_RuntimeEnableModuleLoader"] = makeInvalidEarlyAccess("_QTS_RuntimeEnableModuleLoader");
4105
+ var _QTS_RuntimeDisableModuleLoader = Module["_QTS_RuntimeDisableModuleLoader"] = makeInvalidEarlyAccess("_QTS_RuntimeDisableModuleLoader");
4106
+ var _QTS_bjson_encode = Module["_QTS_bjson_encode"] = makeInvalidEarlyAccess("_QTS_bjson_encode");
4107
+ var _QTS_bjson_decode = Module["_QTS_bjson_decode"] = makeInvalidEarlyAccess("_QTS_bjson_decode");
4108
+ var _fflush = makeInvalidEarlyAccess("_fflush");
4109
+ var _strerror = makeInvalidEarlyAccess("_strerror");
4110
+ var ___funcs_on_exit = makeInvalidEarlyAccess("___funcs_on_exit");
4111
+ var _emscripten_builtin_memalign = makeInvalidEarlyAccess("_emscripten_builtin_memalign");
4112
+ var _emscripten_stack_init = makeInvalidEarlyAccess("_emscripten_stack_init");
4113
+ var _emscripten_stack_get_free = makeInvalidEarlyAccess("_emscripten_stack_get_free");
4114
+ var _emscripten_stack_get_base = makeInvalidEarlyAccess("_emscripten_stack_get_base");
4115
+ var _emscripten_stack_get_end = makeInvalidEarlyAccess("_emscripten_stack_get_end");
4116
+ var __emscripten_stack_restore = makeInvalidEarlyAccess("__emscripten_stack_restore");
4117
+ var __emscripten_stack_alloc = makeInvalidEarlyAccess("__emscripten_stack_alloc");
4118
+ var _emscripten_stack_get_current = makeInvalidEarlyAccess("_emscripten_stack_get_current");
4119
+ var ___lsan_disable = makeInvalidEarlyAccess("___lsan_disable");
4120
+ var ___lsan_enable = makeInvalidEarlyAccess("___lsan_enable");
4121
+ var __indirect_function_table = makeInvalidEarlyAccess("__indirect_function_table");
4122
+ function assignWasmExports(wasmExports2) {
4123
+ assert(typeof wasmExports2["malloc"] != "undefined", "missing Wasm export: malloc");
4124
+ assert(typeof wasmExports2["QTS_Throw"] != "undefined", "missing Wasm export: QTS_Throw");
4125
+ assert(typeof wasmExports2["QTS_NewError"] != "undefined", "missing Wasm export: QTS_NewError");
4126
+ assert(typeof wasmExports2["QTS_RuntimeSetMemoryLimit"] != "undefined", "missing Wasm export: QTS_RuntimeSetMemoryLimit");
4127
+ assert(typeof wasmExports2["QTS_RuntimeComputeMemoryUsage"] != "undefined", "missing Wasm export: QTS_RuntimeComputeMemoryUsage");
4128
+ assert(typeof wasmExports2["QTS_RuntimeDumpMemoryUsage"] != "undefined", "missing Wasm export: QTS_RuntimeDumpMemoryUsage");
4129
+ assert(typeof wasmExports2["QTS_RecoverableLeakCheck"] != "undefined", "missing Wasm export: QTS_RecoverableLeakCheck");
4130
+ assert(typeof wasmExports2["QTS_BuildIsSanitizeLeak"] != "undefined", "missing Wasm export: QTS_BuildIsSanitizeLeak");
4131
+ assert(typeof wasmExports2["QTS_RuntimeSetMaxStackSize"] != "undefined", "missing Wasm export: QTS_RuntimeSetMaxStackSize");
4132
+ assert(typeof wasmExports2["QTS_GetUndefined"] != "undefined", "missing Wasm export: QTS_GetUndefined");
4133
+ assert(typeof wasmExports2["QTS_GetNull"] != "undefined", "missing Wasm export: QTS_GetNull");
4134
+ assert(typeof wasmExports2["QTS_GetFalse"] != "undefined", "missing Wasm export: QTS_GetFalse");
4135
+ assert(typeof wasmExports2["QTS_GetTrue"] != "undefined", "missing Wasm export: QTS_GetTrue");
4136
+ assert(typeof wasmExports2["QTS_NewHostRef"] != "undefined", "missing Wasm export: QTS_NewHostRef");
4137
+ assert(typeof wasmExports2["QTS_GetHostRefId"] != "undefined", "missing Wasm export: QTS_GetHostRefId");
4138
+ assert(typeof wasmExports2["QTS_NewRuntime"] != "undefined", "missing Wasm export: QTS_NewRuntime");
4139
+ assert(typeof wasmExports2["QTS_FreeRuntime"] != "undefined", "missing Wasm export: QTS_FreeRuntime");
4140
+ assert(typeof wasmExports2["free"] != "undefined", "missing Wasm export: free");
4141
+ assert(typeof wasmExports2["QTS_NewContext"] != "undefined", "missing Wasm export: QTS_NewContext");
4142
+ assert(typeof wasmExports2["QTS_FreeContext"] != "undefined", "missing Wasm export: QTS_FreeContext");
4143
+ assert(typeof wasmExports2["QTS_FreeValuePointer"] != "undefined", "missing Wasm export: QTS_FreeValuePointer");
4144
+ assert(typeof wasmExports2["QTS_FreeValuePointerRuntime"] != "undefined", "missing Wasm export: QTS_FreeValuePointerRuntime");
4145
+ assert(typeof wasmExports2["QTS_FreeVoidPointer"] != "undefined", "missing Wasm export: QTS_FreeVoidPointer");
4146
+ assert(typeof wasmExports2["QTS_FreeCString"] != "undefined", "missing Wasm export: QTS_FreeCString");
4147
+ assert(typeof wasmExports2["QTS_DupValuePointer"] != "undefined", "missing Wasm export: QTS_DupValuePointer");
4148
+ assert(typeof wasmExports2["QTS_NewObject"] != "undefined", "missing Wasm export: QTS_NewObject");
4149
+ assert(typeof wasmExports2["QTS_NewObjectProto"] != "undefined", "missing Wasm export: QTS_NewObjectProto");
4150
+ assert(typeof wasmExports2["QTS_NewArray"] != "undefined", "missing Wasm export: QTS_NewArray");
4151
+ assert(typeof wasmExports2["QTS_NewArrayBuffer"] != "undefined", "missing Wasm export: QTS_NewArrayBuffer");
4152
+ assert(typeof wasmExports2["QTS_NewFloat64"] != "undefined", "missing Wasm export: QTS_NewFloat64");
4153
+ assert(typeof wasmExports2["QTS_GetFloat64"] != "undefined", "missing Wasm export: QTS_GetFloat64");
4154
+ assert(typeof wasmExports2["QTS_NewString"] != "undefined", "missing Wasm export: QTS_NewString");
4155
+ assert(typeof wasmExports2["QTS_GetString"] != "undefined", "missing Wasm export: QTS_GetString");
4156
+ assert(typeof wasmExports2["QTS_GetArrayBuffer"] != "undefined", "missing Wasm export: QTS_GetArrayBuffer");
4157
+ assert(typeof wasmExports2["QTS_GetArrayBufferLength"] != "undefined", "missing Wasm export: QTS_GetArrayBufferLength");
4158
+ assert(typeof wasmExports2["QTS_NewSymbol"] != "undefined", "missing Wasm export: QTS_NewSymbol");
4159
+ assert(typeof wasmExports2["QTS_GetSymbolDescriptionOrKey"] != "undefined", "missing Wasm export: QTS_GetSymbolDescriptionOrKey");
4160
+ assert(typeof wasmExports2["QTS_IsGlobalSymbol"] != "undefined", "missing Wasm export: QTS_IsGlobalSymbol");
4161
+ assert(typeof wasmExports2["QTS_IsJobPending"] != "undefined", "missing Wasm export: QTS_IsJobPending");
4162
+ assert(typeof wasmExports2["QTS_ExecutePendingJob"] != "undefined", "missing Wasm export: QTS_ExecutePendingJob");
4163
+ assert(typeof wasmExports2["QTS_GetProp"] != "undefined", "missing Wasm export: QTS_GetProp");
4164
+ assert(typeof wasmExports2["QTS_GetPropNumber"] != "undefined", "missing Wasm export: QTS_GetPropNumber");
4165
+ assert(typeof wasmExports2["QTS_SetProp"] != "undefined", "missing Wasm export: QTS_SetProp");
4166
+ assert(typeof wasmExports2["QTS_DefineProp"] != "undefined", "missing Wasm export: QTS_DefineProp");
4167
+ assert(typeof wasmExports2["QTS_GetOwnPropertyNames"] != "undefined", "missing Wasm export: QTS_GetOwnPropertyNames");
4168
+ assert(typeof wasmExports2["QTS_Call"] != "undefined", "missing Wasm export: QTS_Call");
4169
+ assert(typeof wasmExports2["QTS_ResolveException"] != "undefined", "missing Wasm export: QTS_ResolveException");
4170
+ assert(typeof wasmExports2["QTS_Dump"] != "undefined", "missing Wasm export: QTS_Dump");
4171
+ assert(typeof wasmExports2["QTS_Eval"] != "undefined", "missing Wasm export: QTS_Eval");
4172
+ assert(typeof wasmExports2["QTS_GetModuleNamespace"] != "undefined", "missing Wasm export: QTS_GetModuleNamespace");
4173
+ assert(typeof wasmExports2["QTS_Typeof"] != "undefined", "missing Wasm export: QTS_Typeof");
4174
+ assert(typeof wasmExports2["QTS_GetLength"] != "undefined", "missing Wasm export: QTS_GetLength");
4175
+ assert(typeof wasmExports2["QTS_IsEqual"] != "undefined", "missing Wasm export: QTS_IsEqual");
4176
+ assert(typeof wasmExports2["QTS_GetGlobalObject"] != "undefined", "missing Wasm export: QTS_GetGlobalObject");
4177
+ assert(typeof wasmExports2["QTS_NewPromiseCapability"] != "undefined", "missing Wasm export: QTS_NewPromiseCapability");
4178
+ assert(typeof wasmExports2["QTS_PromiseState"] != "undefined", "missing Wasm export: QTS_PromiseState");
4179
+ assert(typeof wasmExports2["QTS_PromiseResult"] != "undefined", "missing Wasm export: QTS_PromiseResult");
4180
+ assert(typeof wasmExports2["QTS_TestStringArg"] != "undefined", "missing Wasm export: QTS_TestStringArg");
4181
+ assert(typeof wasmExports2["QTS_GetDebugLogEnabled"] != "undefined", "missing Wasm export: QTS_GetDebugLogEnabled");
4182
+ assert(typeof wasmExports2["QTS_SetDebugLogEnabled"] != "undefined", "missing Wasm export: QTS_SetDebugLogEnabled");
4183
+ assert(typeof wasmExports2["QTS_BuildIsDebug"] != "undefined", "missing Wasm export: QTS_BuildIsDebug");
4184
+ assert(typeof wasmExports2["QTS_BuildIsAsyncify"] != "undefined", "missing Wasm export: QTS_BuildIsAsyncify");
4185
+ assert(typeof wasmExports2["QTS_NewFunction"] != "undefined", "missing Wasm export: QTS_NewFunction");
4186
+ assert(typeof wasmExports2["QTS_ArgvGetJSValueConstPointer"] != "undefined", "missing Wasm export: QTS_ArgvGetJSValueConstPointer");
4187
+ assert(typeof wasmExports2["QTS_RuntimeEnableInterruptHandler"] != "undefined", "missing Wasm export: QTS_RuntimeEnableInterruptHandler");
4188
+ assert(typeof wasmExports2["QTS_RuntimeDisableInterruptHandler"] != "undefined", "missing Wasm export: QTS_RuntimeDisableInterruptHandler");
4189
+ assert(typeof wasmExports2["QTS_RuntimeEnableModuleLoader"] != "undefined", "missing Wasm export: QTS_RuntimeEnableModuleLoader");
4190
+ assert(typeof wasmExports2["QTS_RuntimeDisableModuleLoader"] != "undefined", "missing Wasm export: QTS_RuntimeDisableModuleLoader");
4191
+ assert(typeof wasmExports2["QTS_bjson_encode"] != "undefined", "missing Wasm export: QTS_bjson_encode");
4192
+ assert(typeof wasmExports2["QTS_bjson_decode"] != "undefined", "missing Wasm export: QTS_bjson_decode");
4193
+ assert(typeof wasmExports2["fflush"] != "undefined", "missing Wasm export: fflush");
4194
+ assert(typeof wasmExports2["strerror"] != "undefined", "missing Wasm export: strerror");
4195
+ assert(typeof wasmExports2["__funcs_on_exit"] != "undefined", "missing Wasm export: __funcs_on_exit");
4196
+ assert(typeof wasmExports2["emscripten_builtin_memalign"] != "undefined", "missing Wasm export: emscripten_builtin_memalign");
4197
+ assert(typeof wasmExports2["emscripten_stack_init"] != "undefined", "missing Wasm export: emscripten_stack_init");
4198
+ assert(typeof wasmExports2["emscripten_stack_get_free"] != "undefined", "missing Wasm export: emscripten_stack_get_free");
4199
+ assert(typeof wasmExports2["emscripten_stack_get_base"] != "undefined", "missing Wasm export: emscripten_stack_get_base");
4200
+ assert(typeof wasmExports2["emscripten_stack_get_end"] != "undefined", "missing Wasm export: emscripten_stack_get_end");
4201
+ assert(typeof wasmExports2["_emscripten_stack_restore"] != "undefined", "missing Wasm export: _emscripten_stack_restore");
4202
+ assert(typeof wasmExports2["_emscripten_stack_alloc"] != "undefined", "missing Wasm export: _emscripten_stack_alloc");
4203
+ assert(typeof wasmExports2["emscripten_stack_get_current"] != "undefined", "missing Wasm export: emscripten_stack_get_current");
4204
+ assert(typeof wasmExports2["__lsan_disable"] != "undefined", "missing Wasm export: __lsan_disable");
4205
+ assert(typeof wasmExports2["__lsan_enable"] != "undefined", "missing Wasm export: __lsan_enable");
4206
+ assert(typeof wasmExports2["__indirect_function_table"] != "undefined", "missing Wasm export: __indirect_function_table");
4207
+ _malloc = Module["_malloc"] = createExportWrapper("malloc", 1);
4208
+ _QTS_Throw = Module["_QTS_Throw"] = createExportWrapper("QTS_Throw", 2);
4209
+ _QTS_NewError = Module["_QTS_NewError"] = createExportWrapper("QTS_NewError", 1);
4210
+ _QTS_RuntimeSetMemoryLimit = Module["_QTS_RuntimeSetMemoryLimit"] = createExportWrapper("QTS_RuntimeSetMemoryLimit", 2);
4211
+ _QTS_RuntimeComputeMemoryUsage = Module["_QTS_RuntimeComputeMemoryUsage"] = createExportWrapper("QTS_RuntimeComputeMemoryUsage", 2);
4212
+ _QTS_RuntimeDumpMemoryUsage = Module["_QTS_RuntimeDumpMemoryUsage"] = createExportWrapper("QTS_RuntimeDumpMemoryUsage", 1);
4213
+ _QTS_RecoverableLeakCheck = Module["_QTS_RecoverableLeakCheck"] = createExportWrapper("QTS_RecoverableLeakCheck", 0);
4214
+ _QTS_BuildIsSanitizeLeak = Module["_QTS_BuildIsSanitizeLeak"] = createExportWrapper("QTS_BuildIsSanitizeLeak", 0);
4215
+ _QTS_RuntimeSetMaxStackSize = Module["_QTS_RuntimeSetMaxStackSize"] = createExportWrapper("QTS_RuntimeSetMaxStackSize", 2);
4216
+ _QTS_GetUndefined = Module["_QTS_GetUndefined"] = createExportWrapper("QTS_GetUndefined", 0);
4217
+ _QTS_GetNull = Module["_QTS_GetNull"] = createExportWrapper("QTS_GetNull", 0);
4218
+ _QTS_GetFalse = Module["_QTS_GetFalse"] = createExportWrapper("QTS_GetFalse", 0);
4219
+ _QTS_GetTrue = Module["_QTS_GetTrue"] = createExportWrapper("QTS_GetTrue", 0);
4220
+ _QTS_NewHostRef = Module["_QTS_NewHostRef"] = createExportWrapper("QTS_NewHostRef", 2);
4221
+ _QTS_GetHostRefId = Module["_QTS_GetHostRefId"] = createExportWrapper("QTS_GetHostRefId", 1);
4222
+ _QTS_NewRuntime = Module["_QTS_NewRuntime"] = createExportWrapper("QTS_NewRuntime", 0);
4223
+ _QTS_FreeRuntime = Module["_QTS_FreeRuntime"] = createExportWrapper("QTS_FreeRuntime", 1);
4224
+ _free = Module["_free"] = createExportWrapper("free", 1);
4225
+ _QTS_NewContext = Module["_QTS_NewContext"] = createExportWrapper("QTS_NewContext", 2);
4226
+ _QTS_FreeContext = Module["_QTS_FreeContext"] = createExportWrapper("QTS_FreeContext", 1);
4227
+ _QTS_FreeValuePointer = Module["_QTS_FreeValuePointer"] = createExportWrapper("QTS_FreeValuePointer", 2);
4228
+ _QTS_FreeValuePointerRuntime = Module["_QTS_FreeValuePointerRuntime"] = createExportWrapper("QTS_FreeValuePointerRuntime", 2);
4229
+ _QTS_FreeVoidPointer = Module["_QTS_FreeVoidPointer"] = createExportWrapper("QTS_FreeVoidPointer", 2);
4230
+ _QTS_FreeCString = Module["_QTS_FreeCString"] = createExportWrapper("QTS_FreeCString", 2);
4231
+ _QTS_DupValuePointer = Module["_QTS_DupValuePointer"] = createExportWrapper("QTS_DupValuePointer", 2);
4232
+ _QTS_NewObject = Module["_QTS_NewObject"] = createExportWrapper("QTS_NewObject", 1);
4233
+ _QTS_NewObjectProto = Module["_QTS_NewObjectProto"] = createExportWrapper("QTS_NewObjectProto", 2);
4234
+ _QTS_NewArray = Module["_QTS_NewArray"] = createExportWrapper("QTS_NewArray", 1);
4235
+ _QTS_NewArrayBuffer = Module["_QTS_NewArrayBuffer"] = createExportWrapper("QTS_NewArrayBuffer", 3);
4236
+ _QTS_NewFloat64 = Module["_QTS_NewFloat64"] = createExportWrapper("QTS_NewFloat64", 2);
4237
+ _QTS_GetFloat64 = Module["_QTS_GetFloat64"] = createExportWrapper("QTS_GetFloat64", 2);
4238
+ _QTS_NewString = Module["_QTS_NewString"] = createExportWrapper("QTS_NewString", 2);
4239
+ _QTS_GetString = Module["_QTS_GetString"] = createExportWrapper("QTS_GetString", 2);
4240
+ _QTS_GetArrayBuffer = Module["_QTS_GetArrayBuffer"] = createExportWrapper("QTS_GetArrayBuffer", 2);
4241
+ _QTS_GetArrayBufferLength = Module["_QTS_GetArrayBufferLength"] = createExportWrapper("QTS_GetArrayBufferLength", 2);
4242
+ _QTS_NewSymbol = Module["_QTS_NewSymbol"] = createExportWrapper("QTS_NewSymbol", 3);
4243
+ _QTS_GetSymbolDescriptionOrKey = Module["_QTS_GetSymbolDescriptionOrKey"] = createExportWrapper("QTS_GetSymbolDescriptionOrKey", 2);
4244
+ _QTS_IsGlobalSymbol = Module["_QTS_IsGlobalSymbol"] = createExportWrapper("QTS_IsGlobalSymbol", 2);
4245
+ _QTS_IsJobPending = Module["_QTS_IsJobPending"] = createExportWrapper("QTS_IsJobPending", 1);
4246
+ _QTS_ExecutePendingJob = Module["_QTS_ExecutePendingJob"] = createExportWrapper("QTS_ExecutePendingJob", 3);
4247
+ _QTS_GetProp = Module["_QTS_GetProp"] = createExportWrapper("QTS_GetProp", 3);
4248
+ _QTS_GetPropNumber = Module["_QTS_GetPropNumber"] = createExportWrapper("QTS_GetPropNumber", 3);
4249
+ _QTS_SetProp = Module["_QTS_SetProp"] = createExportWrapper("QTS_SetProp", 4);
4250
+ _QTS_DefineProp = Module["_QTS_DefineProp"] = createExportWrapper("QTS_DefineProp", 9);
4251
+ _QTS_GetOwnPropertyNames = Module["_QTS_GetOwnPropertyNames"] = createExportWrapper("QTS_GetOwnPropertyNames", 5);
4252
+ _QTS_Call = Module["_QTS_Call"] = createExportWrapper("QTS_Call", 5);
4253
+ _QTS_ResolveException = Module["_QTS_ResolveException"] = createExportWrapper("QTS_ResolveException", 2);
4254
+ _QTS_Dump = Module["_QTS_Dump"] = createExportWrapper("QTS_Dump", 2);
4255
+ _QTS_Eval = Module["_QTS_Eval"] = createExportWrapper("QTS_Eval", 6);
4256
+ _QTS_GetModuleNamespace = Module["_QTS_GetModuleNamespace"] = createExportWrapper("QTS_GetModuleNamespace", 2);
4257
+ _QTS_Typeof = Module["_QTS_Typeof"] = createExportWrapper("QTS_Typeof", 2);
4258
+ _QTS_GetLength = Module["_QTS_GetLength"] = createExportWrapper("QTS_GetLength", 3);
4259
+ _QTS_IsEqual = Module["_QTS_IsEqual"] = createExportWrapper("QTS_IsEqual", 4);
4260
+ _QTS_GetGlobalObject = Module["_QTS_GetGlobalObject"] = createExportWrapper("QTS_GetGlobalObject", 1);
4261
+ _QTS_NewPromiseCapability = Module["_QTS_NewPromiseCapability"] = createExportWrapper("QTS_NewPromiseCapability", 2);
4262
+ _QTS_PromiseState = Module["_QTS_PromiseState"] = createExportWrapper("QTS_PromiseState", 2);
4263
+ _QTS_PromiseResult = Module["_QTS_PromiseResult"] = createExportWrapper("QTS_PromiseResult", 2);
4264
+ _QTS_TestStringArg = Module["_QTS_TestStringArg"] = createExportWrapper("QTS_TestStringArg", 1);
4265
+ _QTS_GetDebugLogEnabled = Module["_QTS_GetDebugLogEnabled"] = createExportWrapper("QTS_GetDebugLogEnabled", 1);
4266
+ _QTS_SetDebugLogEnabled = Module["_QTS_SetDebugLogEnabled"] = createExportWrapper("QTS_SetDebugLogEnabled", 2);
4267
+ _QTS_BuildIsDebug = Module["_QTS_BuildIsDebug"] = createExportWrapper("QTS_BuildIsDebug", 0);
4268
+ _QTS_BuildIsAsyncify = Module["_QTS_BuildIsAsyncify"] = createExportWrapper("QTS_BuildIsAsyncify", 0);
4269
+ _QTS_NewFunction = Module["_QTS_NewFunction"] = createExportWrapper("QTS_NewFunction", 5);
4270
+ _QTS_ArgvGetJSValueConstPointer = Module["_QTS_ArgvGetJSValueConstPointer"] = createExportWrapper("QTS_ArgvGetJSValueConstPointer", 2);
4271
+ _QTS_RuntimeEnableInterruptHandler = Module["_QTS_RuntimeEnableInterruptHandler"] = createExportWrapper("QTS_RuntimeEnableInterruptHandler", 1);
4272
+ _QTS_RuntimeDisableInterruptHandler = Module["_QTS_RuntimeDisableInterruptHandler"] = createExportWrapper("QTS_RuntimeDisableInterruptHandler", 1);
4273
+ _QTS_RuntimeEnableModuleLoader = Module["_QTS_RuntimeEnableModuleLoader"] = createExportWrapper("QTS_RuntimeEnableModuleLoader", 2);
4274
+ _QTS_RuntimeDisableModuleLoader = Module["_QTS_RuntimeDisableModuleLoader"] = createExportWrapper("QTS_RuntimeDisableModuleLoader", 1);
4275
+ _QTS_bjson_encode = Module["_QTS_bjson_encode"] = createExportWrapper("QTS_bjson_encode", 2);
4276
+ _QTS_bjson_decode = Module["_QTS_bjson_decode"] = createExportWrapper("QTS_bjson_decode", 2);
4277
+ _fflush = createExportWrapper("fflush", 1);
4278
+ _strerror = createExportWrapper("strerror", 1);
4279
+ ___funcs_on_exit = createExportWrapper("__funcs_on_exit", 0);
4280
+ _emscripten_builtin_memalign = createExportWrapper("emscripten_builtin_memalign", 2);
4281
+ _emscripten_stack_init = wasmExports2["emscripten_stack_init"];
4282
+ _emscripten_stack_get_free = wasmExports2["emscripten_stack_get_free"];
4283
+ _emscripten_stack_get_base = wasmExports2["emscripten_stack_get_base"];
4284
+ _emscripten_stack_get_end = wasmExports2["emscripten_stack_get_end"];
4285
+ __emscripten_stack_restore = wasmExports2["_emscripten_stack_restore"];
4286
+ __emscripten_stack_alloc = wasmExports2["_emscripten_stack_alloc"];
4287
+ _emscripten_stack_get_current = wasmExports2["emscripten_stack_get_current"];
4288
+ ___lsan_disable = wasmExports2["__lsan_disable"];
4289
+ ___lsan_enable = wasmExports2["__lsan_enable"];
4290
+ __indirect_function_table = wasmExports2["__indirect_function_table"];
4291
+ }
4292
+ var wasmImports = {
4293
+ /** @export */
4294
+ __assert_fail: ___assert_fail,
4295
+ /** @export */
4296
+ __syscall_dup: ___syscall_dup,
4297
+ /** @export */
4298
+ __syscall_fstat64: ___syscall_fstat64,
4299
+ /** @export */
4300
+ __syscall_lstat64: ___syscall_lstat64,
4301
+ /** @export */
4302
+ __syscall_mkdirat: ___syscall_mkdirat,
4303
+ /** @export */
4304
+ __syscall_newfstatat: ___syscall_newfstatat,
4305
+ /** @export */
4306
+ __syscall_openat: ___syscall_openat,
4307
+ /** @export */
4308
+ __syscall_stat64: ___syscall_stat64,
4309
+ /** @export */
4310
+ _abort_js: __abort_js,
4311
+ /** @export */
4312
+ _emscripten_get_progname: __emscripten_get_progname,
4313
+ /** @export */
4314
+ _emscripten_sanitizer_get_option: __emscripten_sanitizer_get_option,
4315
+ /** @export */
4316
+ _emscripten_sanitizer_use_colors: __emscripten_sanitizer_use_colors,
4317
+ /** @export */
4318
+ _localtime_js: __localtime_js,
4319
+ /** @export */
4320
+ _mmap_js: __mmap_js,
4321
+ /** @export */
4322
+ _munmap_js: __munmap_js,
4323
+ /** @export */
4324
+ _tzset_js: __tzset_js,
4325
+ /** @export */
4326
+ clock_time_get: _clock_time_get,
4327
+ /** @export */
4328
+ emscripten_date_now: _emscripten_date_now,
4329
+ /** @export */
4330
+ emscripten_get_heap_max: _emscripten_get_heap_max,
4331
+ /** @export */
4332
+ emscripten_get_now: _emscripten_get_now,
4333
+ /** @export */
4334
+ emscripten_pc_get_column: _emscripten_pc_get_column,
4335
+ /** @export */
4336
+ emscripten_pc_get_file: _emscripten_pc_get_file,
4337
+ /** @export */
4338
+ emscripten_pc_get_function: _emscripten_pc_get_function,
4339
+ /** @export */
4340
+ emscripten_pc_get_line: _emscripten_pc_get_line,
4341
+ /** @export */
4342
+ emscripten_resize_heap: _emscripten_resize_heap,
4343
+ /** @export */
4344
+ emscripten_stack_snapshot: _emscripten_stack_snapshot,
4345
+ /** @export */
4346
+ emscripten_stack_unwind_buffer: _emscripten_stack_unwind_buffer,
4347
+ /** @export */
4348
+ environ_get: _environ_get,
4349
+ /** @export */
4350
+ environ_sizes_get: _environ_sizes_get,
4351
+ /** @export */
4352
+ fd_close: _fd_close,
4353
+ /** @export */
4354
+ fd_read: _fd_read,
4355
+ /** @export */
4356
+ fd_seek: _fd_seek,
4357
+ /** @export */
4358
+ fd_write: _fd_write,
4359
+ /** @export */
4360
+ memory: wasmMemory,
4361
+ /** @export */
4362
+ proc_exit: _proc_exit,
4363
+ /** @export */
4364
+ qts_host_call_function,
4365
+ /** @export */
4366
+ qts_host_interrupt_handler,
4367
+ /** @export */
4368
+ qts_host_load_module_source,
4369
+ /** @export */
4370
+ qts_host_normalize_module,
4371
+ /** @export */
4372
+ qts_host_ref_free
4373
+ };
4374
+ class WasmSourceMap {
4375
+ mapping = {};
4376
+ offsets = [];
4377
+ constructor(sourceMap) {
4378
+ this.version = sourceMap.version;
4379
+ this.sources = sourceMap.sources;
4380
+ this.names = sourceMap.names;
4381
+ var vlqMap = {};
4382
+ "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".split("").forEach((c, i) => vlqMap[c] = i);
4383
+ function decodeVLQ(string) {
4384
+ var result = [];
4385
+ var shift = 0;
4386
+ var value = 0;
4387
+ for (var ch of string) {
4388
+ var integer = vlqMap[ch];
4389
+ if (integer === void 0) {
4390
+ throw new Error(`Invalid character (${ch})`);
4391
+ }
4392
+ value += (integer & 31) << shift;
4393
+ if (integer & 32) {
4394
+ shift += 5;
4395
+ } else {
4396
+ var negate = value & 1;
4397
+ value >>= 1;
4398
+ result.push(negate ? -value : value);
4399
+ value = shift = 0;
4400
+ }
4401
+ }
4402
+ return result;
4403
+ }
4404
+ var offset = 0, src = 0, line = 1, col = 1, name = 0;
4405
+ for (const [index, segment] of sourceMap.mappings.split(",").entries()) {
4406
+ if (!segment) continue;
4407
+ var data = decodeVLQ(segment);
4408
+ var info = {};
4409
+ offset += data[0];
4410
+ if (data.length >= 2) info.source = src += data[1];
4411
+ if (data.length >= 3) info.line = line += data[2];
4412
+ if (data.length >= 4) info.column = col += data[3];
4413
+ if (data.length >= 5) info.name = name += data[4];
4414
+ this.mapping[offset] = info;
4415
+ this.offsets.push(offset);
4416
+ }
4417
+ this.offsets.sort((a, b) => a - b);
4418
+ }
4419
+ lookup(offset) {
4420
+ var normalized = this.normalizeOffset(offset);
4421
+ var info = this.mapping[normalized];
4422
+ if (!info) {
4423
+ return null;
4424
+ }
4425
+ return {
4426
+ file: this.sources[info.source],
4427
+ line: info.line,
4428
+ column: info.column,
4429
+ name: this.names[info.name]
4430
+ };
4431
+ }
4432
+ normalizeOffset(offset) {
4433
+ var lo = 0;
4434
+ var hi = this.offsets.length;
4435
+ var mid;
4436
+ while (lo < hi) {
4437
+ mid = Math.floor((lo + hi) / 2);
4438
+ if (this.offsets[mid] > offset) {
4439
+ hi = mid;
4440
+ } else {
4441
+ lo = mid + 1;
4442
+ }
4443
+ }
4444
+ return this.offsets[lo - 1];
4445
+ }
4446
+ }
4447
+ var wasmSourceMap;
4448
+ var wasmSourceMapFile = locateFile("emscripten-module.wasm.map");
4449
+ function receiveSourceMapJSON(sourceMap) {
4450
+ wasmSourceMap = new WasmSourceMap(sourceMap);
4451
+ }
4452
+ function getSourceMap() {
4453
+ var buf = readBinary(wasmSourceMapFile);
4454
+ return JSON.parse(UTF8ArrayToString(buf));
4455
+ }
4456
+ async function getSourceMapAsync() {
4457
+ if (ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER) {
4458
+ try {
4459
+ var response = await fetch(wasmSourceMapFile, { credentials: "same-origin" });
4460
+ return response.json();
4461
+ } catch {
4462
+ }
4463
+ }
4464
+ return getSourceMap();
4465
+ }
4466
+ addRunDependency("source-map");
4467
+ getSourceMapAsync().then((json) => {
4468
+ receiveSourceMapJSON(json);
4469
+ removeRunDependency("source-map");
4470
+ });
4471
+ var calledRun;
4472
+ function stackCheckInit() {
4473
+ _emscripten_stack_init();
4474
+ writeStackCookie();
4475
+ }
4476
+ function run() {
4477
+ if (runDependencies > 0) {
4478
+ dependenciesFulfilled = run;
4479
+ return;
4480
+ }
4481
+ stackCheckInit();
4482
+ preRun();
4483
+ if (runDependencies > 0) {
4484
+ dependenciesFulfilled = run;
4485
+ return;
4486
+ }
4487
+ function doRun() {
4488
+ assert(!calledRun);
4489
+ calledRun = true;
4490
+ Module["calledRun"] = true;
4491
+ if (ABORT) return;
4492
+ initRuntime();
4493
+ readyPromiseResolve?.(Module);
4494
+ Module["onRuntimeInitialized"]?.();
4495
+ consumedModuleProp("onRuntimeInitialized");
4496
+ assert(!Module["_main"], 'compiled without a main, but one is present. if you added it from JS, use Module["onRuntimeInitialized"]');
4497
+ postRun();
4498
+ }
4499
+ if (Module["setStatus"]) {
4500
+ Module["setStatus"]("Running...");
4501
+ setTimeout(() => {
4502
+ setTimeout(() => Module["setStatus"](""), 1);
4503
+ doRun();
4504
+ }, 1);
4505
+ } else {
4506
+ doRun();
4507
+ }
4508
+ checkStackCookie();
4509
+ }
4510
+ var wasmExports;
4511
+ wasmExports = await createWasm();
4512
+ run();
4513
+ if (runtimeInitialized) {
4514
+ moduleRtn = Module;
4515
+ } else {
4516
+ moduleRtn = new Promise((resolve, reject) => {
4517
+ readyPromiseResolve = resolve;
4518
+ readyPromiseReject = reject;
4519
+ });
4520
+ }
4521
+ for (const prop of Object.keys(Module)) {
4522
+ if (!(prop in moduleArg)) {
4523
+ Object.defineProperty(moduleArg, prop, {
4524
+ configurable: true,
4525
+ get() {
4526
+ abort(`Access to module property ('${prop}') is no longer possible via the module constructor argument; Instead, use the result of the module constructor.`);
4527
+ }
4528
+ });
4529
+ }
4530
+ }
4531
+ return moduleRtn;
4532
+ }
4533
+ var emscripten_module_default = QuickJSRaw;
4534
+ export {
4535
+ emscripten_module_default as default
4536
+ };