@prosdevlab/dev-agent 0.8.5

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 (50) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +138 -0
  3. package/dist/cli.js +74721 -0
  4. package/dist/cli.js.map +1 -0
  5. package/dist/mcp.js +61445 -0
  6. package/dist/mcp.js.map +1 -0
  7. package/dist/vendor/web-tree-sitter/lib/alloc.c +48 -0
  8. package/dist/vendor/web-tree-sitter/lib/alloc.h +41 -0
  9. package/dist/vendor/web-tree-sitter/lib/array.h +291 -0
  10. package/dist/vendor/web-tree-sitter/lib/atomic.h +68 -0
  11. package/dist/vendor/web-tree-sitter/lib/clock.h +146 -0
  12. package/dist/vendor/web-tree-sitter/lib/error_costs.h +11 -0
  13. package/dist/vendor/web-tree-sitter/lib/get_changed_ranges.c +523 -0
  14. package/dist/vendor/web-tree-sitter/lib/get_changed_ranges.h +36 -0
  15. package/dist/vendor/web-tree-sitter/lib/host.h +21 -0
  16. package/dist/vendor/web-tree-sitter/lib/language.c +293 -0
  17. package/dist/vendor/web-tree-sitter/lib/language.h +293 -0
  18. package/dist/vendor/web-tree-sitter/lib/length.h +52 -0
  19. package/dist/vendor/web-tree-sitter/lib/lexer.c +483 -0
  20. package/dist/vendor/web-tree-sitter/lib/lexer.h +54 -0
  21. package/dist/vendor/web-tree-sitter/lib/lib.c +12 -0
  22. package/dist/vendor/web-tree-sitter/lib/node.c +875 -0
  23. package/dist/vendor/web-tree-sitter/lib/parser.c +2297 -0
  24. package/dist/vendor/web-tree-sitter/lib/parser.h +286 -0
  25. package/dist/vendor/web-tree-sitter/lib/point.h +48 -0
  26. package/dist/vendor/web-tree-sitter/lib/query.c +4347 -0
  27. package/dist/vendor/web-tree-sitter/lib/reduce_action.h +34 -0
  28. package/dist/vendor/web-tree-sitter/lib/reusable_node.h +95 -0
  29. package/dist/vendor/web-tree-sitter/lib/stack.c +912 -0
  30. package/dist/vendor/web-tree-sitter/lib/stack.h +133 -0
  31. package/dist/vendor/web-tree-sitter/lib/subtree.c +1034 -0
  32. package/dist/vendor/web-tree-sitter/lib/subtree.h +399 -0
  33. package/dist/vendor/web-tree-sitter/lib/tree-sitter.c +987 -0
  34. package/dist/vendor/web-tree-sitter/lib/tree-sitter.cjs +2988 -0
  35. package/dist/vendor/web-tree-sitter/lib/tree-sitter.wasm +0 -0
  36. package/dist/vendor/web-tree-sitter/lib/tree-sitter.wasm.map +1 -0
  37. package/dist/vendor/web-tree-sitter/lib/tree.c +170 -0
  38. package/dist/vendor/web-tree-sitter/lib/tree.h +31 -0
  39. package/dist/vendor/web-tree-sitter/lib/tree_cursor.c +716 -0
  40. package/dist/vendor/web-tree-sitter/lib/tree_cursor.h +48 -0
  41. package/dist/vendor/web-tree-sitter/lib/ts_assert.h +11 -0
  42. package/dist/vendor/web-tree-sitter/lib/unicode.h +75 -0
  43. package/dist/vendor/web-tree-sitter/lib/wasm_store.c +1937 -0
  44. package/dist/vendor/web-tree-sitter/lib/wasm_store.h +31 -0
  45. package/dist/vendor/web-tree-sitter/package.json +98 -0
  46. package/dist/vendor/web-tree-sitter/tree-sitter.cjs +4031 -0
  47. package/dist/vendor/web-tree-sitter/tree-sitter.wasm +0 -0
  48. package/dist/wasm/tree-sitter-go.wasm +0 -0
  49. package/dist/wasm/tree-sitter.wasm +0 -0
  50. package/package.json +65 -0
@@ -0,0 +1,2988 @@
1
+ var Module = (() => {
2
+ var _scriptName = typeof document != 'undefined' ? document.currentScript?.src : undefined;
3
+ if (typeof __filename != 'undefined') _scriptName = _scriptName || __filename;
4
+ return (
5
+ async function(moduleArg = {}) {
6
+ var moduleRtn;
7
+
8
+ // include: shell.js
9
+ // The Module object: Our interface to the outside world. We import
10
+ // and export values on it. There are various ways Module can be used:
11
+ // 1. Not defined. We create it here
12
+ // 2. A function parameter, function(moduleArg) => Promise<Module>
13
+ // 3. pre-run appended it, var Module = {}; ..generated code..
14
+ // 4. External script tag defines var Module.
15
+ // We need to check if Module already exists (e.g. case 3 above).
16
+ // Substitution will be replaced with actual code on later stage of the build,
17
+ // this way Closure Compiler will not mangle it (e.g. case 4. above).
18
+ // Note that if you want to run closure, and also to use Module
19
+ // after the generated code, you will need to define var Module = {};
20
+ // before the code. Then that object will be used in the code, and you
21
+ // can continue to use Module afterwards as well.
22
+ var Module = moduleArg;
23
+
24
+ // Set up the promise that indicates the Module is initialized
25
+ var readyPromiseResolve, readyPromiseReject;
26
+
27
+ var readyPromise = new Promise((resolve, reject) => {
28
+ readyPromiseResolve = resolve;
29
+ readyPromiseReject = reject;
30
+ });
31
+
32
+ // Determine the runtime environment we are in. You can customize this by
33
+ // setting the ENVIRONMENT setting at compile time (see settings.js).
34
+ // Attempt to auto-detect the environment
35
+ var ENVIRONMENT_IS_WEB = typeof window == "object";
36
+
37
+ var ENVIRONMENT_IS_WORKER = typeof WorkerGlobalScope != "undefined";
38
+
39
+ // N.b. Electron.js environment is simultaneously a NODE-environment, but
40
+ // also a web environment.
41
+ var ENVIRONMENT_IS_NODE = typeof process == "object" && typeof process.versions == "object" && typeof process.versions.node == "string" && process.type != "renderer";
42
+
43
+ var ENVIRONMENT_IS_SHELL = !ENVIRONMENT_IS_WEB && !ENVIRONMENT_IS_NODE && !ENVIRONMENT_IS_WORKER;
44
+
45
+ if (ENVIRONMENT_IS_NODE) {}
46
+
47
+ // --pre-jses are emitted after the Module integration code, so that they can
48
+ // refer to Module (if they choose; they can also define Module)
49
+ // include: lib/binding_web/lib/prefix.js
50
+ Module.currentQueryProgressCallback = null;
51
+
52
+ Module.currentProgressCallback = null;
53
+
54
+ Module.currentLogCallback = null;
55
+
56
+ Module.currentParseCallback = null;
57
+
58
+ // end include: lib/binding_web/lib/prefix.js
59
+ // Sometimes an existing Module object exists with properties
60
+ // meant to overwrite the default module functionality. Here
61
+ // we collect those properties and reapply _after_ we configure
62
+ // the current environment's defaults to avoid having to be so
63
+ // defensive during initialization.
64
+ var moduleOverrides = Object.assign({}, Module);
65
+
66
+ var arguments_ = [];
67
+
68
+ var thisProgram = "./this.program";
69
+
70
+ var quit_ = (status, toThrow) => {
71
+ throw toThrow;
72
+ };
73
+
74
+ // `/` should be present at the end if `scriptDirectory` is not empty
75
+ var scriptDirectory = "";
76
+
77
+ function locateFile(path) {
78
+ if (Module["locateFile"]) {
79
+ return Module["locateFile"](path, scriptDirectory);
80
+ }
81
+ return scriptDirectory + path;
82
+ }
83
+
84
+ // Hooks that are implemented differently in different runtime environments.
85
+ var readAsync, readBinary;
86
+
87
+ if (ENVIRONMENT_IS_NODE) {
88
+ if (typeof process == "undefined" || !process.release || process.release.name !== "node") 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?)");
89
+ var nodeVersion = process.versions.node;
90
+ var numericVersion = nodeVersion.split(".").slice(0, 3);
91
+ numericVersion = (numericVersion[0] * 1e4) + (numericVersion[1] * 100) + (numericVersion[2].split("-")[0] * 1);
92
+ var minVersion = 16e4;
93
+ if (numericVersion < 16e4) {
94
+ throw new Error("This emscripten-generated code requires node v16.0.0 (detected v" + nodeVersion + ")");
95
+ }
96
+ // These modules will usually be used on Node.js. Load them eagerly to avoid
97
+ // the complexity of lazy-loading.
98
+ var fs = require("fs");
99
+ var nodePath = require("path");
100
+ scriptDirectory = __dirname + "/";
101
+ // include: node_shell_read.js
102
+ readBinary = filename => {
103
+ // We need to re-wrap `file://` strings to URLs.
104
+ filename = isFileURI(filename) ? new URL(filename) : filename;
105
+ var ret = fs.readFileSync(filename);
106
+ assert(Buffer.isBuffer(ret));
107
+ return ret;
108
+ };
109
+ readAsync = async (filename, binary = true) => {
110
+ // See the comment in the `readBinary` function.
111
+ filename = isFileURI(filename) ? new URL(filename) : filename;
112
+ var ret = fs.readFileSync(filename, binary ? undefined : "utf8");
113
+ assert(binary ? Buffer.isBuffer(ret) : typeof ret == "string");
114
+ return ret;
115
+ };
116
+ // end include: node_shell_read.js
117
+ if (!Module["thisProgram"] && process.argv.length > 1) {
118
+ thisProgram = process.argv[1].replace(/\\/g, "/");
119
+ }
120
+ arguments_ = process.argv.slice(2);
121
+ // MODULARIZE will export the module in the proper place outside, we don't need to export here
122
+ quit_ = (status, toThrow) => {
123
+ process.exitCode = status;
124
+ throw toThrow;
125
+ };
126
+ } else if (ENVIRONMENT_IS_SHELL) {
127
+ if ((typeof process == "object" && typeof require === "function") || typeof window == "object" || typeof WorkerGlobalScope != "undefined") 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?)");
128
+ } else // Note that this includes Node.js workers when relevant (pthreads is enabled).
129
+ // Node.js workers are detected as a combination of ENVIRONMENT_IS_WORKER and
130
+ // ENVIRONMENT_IS_NODE.
131
+ if (ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER) {
132
+ if (ENVIRONMENT_IS_WORKER) {
133
+ // Check worker, not web, since window could be polyfilled
134
+ scriptDirectory = self.location.href;
135
+ } else if (typeof document != "undefined" && document.currentScript) {
136
+ // web
137
+ scriptDirectory = document.currentScript.src;
138
+ }
139
+ // When MODULARIZE, this JS may be executed later, after document.currentScript
140
+ // is gone, so we saved it, and we use it here instead of any other info.
141
+ if (_scriptName) {
142
+ scriptDirectory = _scriptName;
143
+ }
144
+ // blob urls look like blob:http://site.com/etc/etc and we cannot infer anything from them.
145
+ // otherwise, slice off the final part of the url to find the script directory.
146
+ // if scriptDirectory does not contain a slash, lastIndexOf will return -1,
147
+ // and scriptDirectory will correctly be replaced with an empty string.
148
+ // If scriptDirectory contains a query (starting with ?) or a fragment (starting with #),
149
+ // they are removed because they could contain a slash.
150
+ if (scriptDirectory.startsWith("blob:")) {
151
+ scriptDirectory = "";
152
+ } else {
153
+ scriptDirectory = scriptDirectory.slice(0, scriptDirectory.replace(/[?#].*/, "").lastIndexOf("/") + 1);
154
+ }
155
+ if (!(typeof window == "object" || typeof WorkerGlobalScope != "undefined")) 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?)");
156
+ {
157
+ // include: web_or_worker_shell_read.js
158
+ if (ENVIRONMENT_IS_WORKER) {
159
+ readBinary = url => {
160
+ var xhr = new XMLHttpRequest;
161
+ xhr.open("GET", url, false);
162
+ xhr.responseType = "arraybuffer";
163
+ xhr.send(null);
164
+ return new Uint8Array(/** @type{!ArrayBuffer} */ (xhr.response));
165
+ };
166
+ }
167
+ readAsync = async url => {
168
+ // Fetch has some additional restrictions over XHR, like it can't be used on a file:// url.
169
+ // See https://github.com/github/fetch/pull/92#issuecomment-140665932
170
+ // Cordova or Electron apps are typically loaded from a file:// url.
171
+ // So use XHR on webview if URL is a file URL.
172
+ if (isFileURI(url)) {
173
+ return new Promise((resolve, reject) => {
174
+ var xhr = new XMLHttpRequest;
175
+ xhr.open("GET", url, true);
176
+ xhr.responseType = "arraybuffer";
177
+ xhr.onload = () => {
178
+ if (xhr.status == 200 || (xhr.status == 0 && xhr.response)) {
179
+ // file URLs can return 0
180
+ resolve(xhr.response);
181
+ return;
182
+ }
183
+ reject(xhr.status);
184
+ };
185
+ xhr.onerror = reject;
186
+ xhr.send(null);
187
+ });
188
+ }
189
+ var response = await fetch(url, {
190
+ credentials: "same-origin"
191
+ });
192
+ if (response.ok) {
193
+ return response.arrayBuffer();
194
+ }
195
+ throw new Error(response.status + " : " + response.url);
196
+ };
197
+ }
198
+ } else {
199
+ throw new Error("environment detection error");
200
+ }
201
+
202
+ var out = Module["print"] || console.log.bind(console);
203
+
204
+ var err = Module["printErr"] || console.error.bind(console);
205
+
206
+ // Merge back in the overrides
207
+ Object.assign(Module, moduleOverrides);
208
+
209
+ // Free the object hierarchy contained in the overrides, this lets the GC
210
+ // reclaim data used.
211
+ moduleOverrides = null;
212
+
213
+ checkIncomingModuleAPI();
214
+
215
+ // Emit code to handle expected values on the Module object. This applies Module.x
216
+ // to the proper local x. This has two benefits: first, we only emit it if it is
217
+ // expected to arrive, and second, by using a local everywhere else that can be
218
+ // minified.
219
+ if (Module["arguments"]) arguments_ = Module["arguments"];
220
+
221
+ legacyModuleProp("arguments", "arguments_");
222
+
223
+ if (Module["thisProgram"]) thisProgram = Module["thisProgram"];
224
+
225
+ legacyModuleProp("thisProgram", "thisProgram");
226
+
227
+ // perform assertions in shell.js after we set up out() and err(), as otherwise if an assertion fails it cannot print the message
228
+ // Assertions on removed incoming Module JS APIs.
229
+ assert(typeof Module["memoryInitializerPrefixURL"] == "undefined", "Module.memoryInitializerPrefixURL option was removed, use Module.locateFile instead");
230
+
231
+ assert(typeof Module["pthreadMainPrefixURL"] == "undefined", "Module.pthreadMainPrefixURL option was removed, use Module.locateFile instead");
232
+
233
+ assert(typeof Module["cdInitializerPrefixURL"] == "undefined", "Module.cdInitializerPrefixURL option was removed, use Module.locateFile instead");
234
+
235
+ assert(typeof Module["filePackagePrefixURL"] == "undefined", "Module.filePackagePrefixURL option was removed, use Module.locateFile instead");
236
+
237
+ assert(typeof Module["read"] == "undefined", "Module.read option was removed");
238
+
239
+ assert(typeof Module["readAsync"] == "undefined", "Module.readAsync option was removed (modify readAsync in JS)");
240
+
241
+ assert(typeof Module["readBinary"] == "undefined", "Module.readBinary option was removed (modify readBinary in JS)");
242
+
243
+ assert(typeof Module["setWindowTitle"] == "undefined", "Module.setWindowTitle option was removed (modify emscripten_set_window_title in JS)");
244
+
245
+ assert(typeof Module["TOTAL_MEMORY"] == "undefined", "Module.TOTAL_MEMORY has been renamed Module.INITIAL_MEMORY");
246
+
247
+ legacyModuleProp("asm", "wasmExports");
248
+
249
+ legacyModuleProp("readAsync", "readAsync");
250
+
251
+ legacyModuleProp("readBinary", "readBinary");
252
+
253
+ legacyModuleProp("setWindowTitle", "setWindowTitle");
254
+
255
+ var IDBFS = "IDBFS is no longer included by default; build with -lidbfs.js";
256
+
257
+ var PROXYFS = "PROXYFS is no longer included by default; build with -lproxyfs.js";
258
+
259
+ var WORKERFS = "WORKERFS is no longer included by default; build with -lworkerfs.js";
260
+
261
+ var FETCHFS = "FETCHFS is no longer included by default; build with -lfetchfs.js";
262
+
263
+ var ICASEFS = "ICASEFS is no longer included by default; build with -licasefs.js";
264
+
265
+ var JSFILEFS = "JSFILEFS is no longer included by default; build with -ljsfilefs.js";
266
+
267
+ var OPFS = "OPFS is no longer included by default; build with -lopfs.js";
268
+
269
+ var NODEFS = "NODEFS is no longer included by default; build with -lnodefs.js";
270
+
271
+ assert(!ENVIRONMENT_IS_SHELL, "shell environment detected but not enabled at build time. Add `shell` to `-sENVIRONMENT` to enable.");
272
+
273
+ // end include: shell.js
274
+ // include: preamble.js
275
+ // === Preamble library stuff ===
276
+ // Documentation for the public APIs defined in this file must be updated in:
277
+ // site/source/docs/api_reference/preamble.js.rst
278
+ // A prebuilt local version of the documentation is available at:
279
+ // site/build/text/docs/api_reference/preamble.js.txt
280
+ // You can also build docs locally as HTML or other formats in site/
281
+ // An online HTML version (which may be of a different version of Emscripten)
282
+ // is up at http://kripken.github.io/emscripten-site/docs/api_reference/preamble.js.html
283
+ var dynamicLibraries = Module["dynamicLibraries"] || [];
284
+
285
+ var wasmBinary = Module["wasmBinary"];
286
+
287
+ legacyModuleProp("wasmBinary", "wasmBinary");
288
+
289
+ if (typeof WebAssembly != "object") {
290
+ err("no native wasm support detected");
291
+ }
292
+
293
+ // Wasm globals
294
+ var wasmMemory;
295
+
296
+ //========================================
297
+ // Runtime essentials
298
+ //========================================
299
+ // whether we are quitting the application. no code should run after this.
300
+ // set in exit() and abort()
301
+ var ABORT = false;
302
+
303
+ // set by exit() and abort(). Passed to 'onExit' handler.
304
+ // NOTE: This is also used as the process return code code in shell environments
305
+ // but only when noExitRuntime is false.
306
+ var EXITSTATUS;
307
+
308
+ // In STRICT mode, we only define assert() when ASSERTIONS is set. i.e. we
309
+ // don't define it at all in release modes. This matches the behaviour of
310
+ // MINIMAL_RUNTIME.
311
+ // TODO(sbc): Make this the default even without STRICT enabled.
312
+ /** @type {function(*, string=)} */ function assert(condition, text) {
313
+ if (!condition) {
314
+ abort("Assertion failed" + (text ? ": " + text : ""));
315
+ }
316
+ }
317
+
318
+ // We used to include malloc/free by default in the past. Show a helpful error in
319
+ // builds with assertions.
320
+ // Memory management
321
+ var HEAP, /** @type {!Int8Array} */ HEAP8, /** @type {!Uint8Array} */ HEAPU8, /** @type {!Int16Array} */ HEAP16, /** @type {!Uint16Array} */ HEAPU16, /** @type {!Int32Array} */ HEAP32, /** @type {!Uint32Array} */ HEAPU32, /** @type {!Float32Array} */ HEAPF32, /* BigInt64Array type is not correctly defined in closure
322
+ /** not-@type {!BigInt64Array} */ HEAP64, /* BigUint64Array type is not correctly defined in closure
323
+ /** not-t@type {!BigUint64Array} */ HEAPU64, /** @type {!Float64Array} */ HEAPF64;
324
+
325
+ var HEAP_DATA_VIEW;
326
+
327
+ var runtimeInitialized = false;
328
+
329
+ /**
330
+ * Indicates whether filename is delivered via file protocol (as opposed to http/https)
331
+ * @noinline
332
+ */ var isFileURI = filename => filename.startsWith("file://");
333
+
334
+ // include: runtime_shared.js
335
+ // include: runtime_stack_check.js
336
+ // Initializes the stack cookie. Called at the startup of main and at the startup of each thread in pthreads mode.
337
+ function writeStackCookie() {
338
+ var max = _emscripten_stack_get_end();
339
+ assert((max & 3) == 0);
340
+ // If the stack ends at address zero we write our cookies 4 bytes into the
341
+ // stack. This prevents interference with SAFE_HEAP and ASAN which also
342
+ // monitor writes to address zero.
343
+ if (max == 0) {
344
+ max += 4;
345
+ }
346
+ // The stack grow downwards towards _emscripten_stack_get_end.
347
+ // We write cookies to the final two words in the stack and detect if they are
348
+ // ever overwritten.
349
+ LE_HEAP_STORE_U32(((max) >> 2) * 4, 34821223);
350
+ LE_HEAP_STORE_U32((((max) + (4)) >> 2) * 4, 2310721022);
351
+ }
352
+
353
+ function checkStackCookie() {
354
+ if (ABORT) return;
355
+ var max = _emscripten_stack_get_end();
356
+ // See writeStackCookie().
357
+ if (max == 0) {
358
+ max += 4;
359
+ }
360
+ var cookie1 = LE_HEAP_LOAD_U32(((max) >> 2) * 4);
361
+ var cookie2 = LE_HEAP_LOAD_U32((((max) + (4)) >> 2) * 4);
362
+ if (cookie1 != 34821223 || cookie2 != 2310721022) {
363
+ abort(`Stack overflow! Stack cookie has been overwritten at ${ptrToString(max)}, expected hex dwords 0x89BACDFE and 0x2135467, but received ${ptrToString(cookie2)} ${ptrToString(cookie1)}`);
364
+ }
365
+ }
366
+
367
+ // end include: runtime_stack_check.js
368
+ // include: runtime_exceptions.js
369
+ // end include: runtime_exceptions.js
370
+ // include: runtime_debug.js
371
+ // Endianness check
372
+ if (Module["ENVIRONMENT"]) {
373
+ throw new Error("Module.ENVIRONMENT has been deprecated. To force the environment, use the ENVIRONMENT compile-time option (for example, -sENVIRONMENT=web or -sENVIRONMENT=node)");
374
+ }
375
+
376
+ function legacyModuleProp(prop, newName, incoming = true) {
377
+ if (!Object.getOwnPropertyDescriptor(Module, prop)) {
378
+ Object.defineProperty(Module, prop, {
379
+ configurable: true,
380
+ get() {
381
+ let extra = incoming ? " (the initial value can be provided on Module, but after startup the value is only looked for on a local variable of that name)" : "";
382
+ abort(`\`Module.${prop}\` has been replaced by \`${newName}\`` + extra);
383
+ }
384
+ });
385
+ }
386
+ }
387
+
388
+ function consumedModuleProp(prop) {
389
+ if (!Object.getOwnPropertyDescriptor(Module, prop)) {
390
+ Object.defineProperty(Module, prop, {
391
+ configurable: true,
392
+ set() {
393
+ 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'`);
394
+ }
395
+ });
396
+ }
397
+ }
398
+
399
+ function ignoredModuleProp(prop) {
400
+ if (Object.getOwnPropertyDescriptor(Module, prop)) {
401
+ abort(`\`Module.${prop}\` was supplied but \`${prop}\` not included in INCOMING_MODULE_JS_API`);
402
+ }
403
+ }
404
+
405
+ // forcing the filesystem exports a few things by default
406
+ function isExportedByForceFilesystem(name) {
407
+ return name === "FS_createPath" || name === "FS_createDataFile" || name === "FS_createPreloadedFile" || name === "FS_unlink" || name === "addRunDependency" || // The old FS has some functionality that WasmFS lacks.
408
+ name === "FS_createLazyFile" || name === "FS_createDevice" || name === "removeRunDependency";
409
+ }
410
+
411
+ /**
412
+ * Intercept access to a global symbol. This enables us to give informative
413
+ * warnings/errors when folks attempt to use symbols they did not include in
414
+ * their build, or no symbols that no longer exist.
415
+ */ function hookGlobalSymbolAccess(sym, func) {}
416
+
417
+ function missingGlobal(sym, msg) {
418
+ hookGlobalSymbolAccess(sym, () => {
419
+ warnOnce(`\`${sym}\` is not longer defined by emscripten. ${msg}`);
420
+ });
421
+ }
422
+
423
+ missingGlobal("buffer", "Please use HEAP8.buffer or wasmMemory.buffer");
424
+
425
+ missingGlobal("asm", "Please use wasmExports instead");
426
+
427
+ function missingLibrarySymbol(sym) {
428
+ hookGlobalSymbolAccess(sym, () => {
429
+ // Can't `abort()` here because it would break code that does runtime
430
+ // checks. e.g. `if (typeof SDL === 'undefined')`.
431
+ var msg = `\`${sym}\` is a library symbol and not included by default; add it to your library.js __deps or to DEFAULT_LIBRARY_FUNCS_TO_INCLUDE on the command line`;
432
+ // DEFAULT_LIBRARY_FUNCS_TO_INCLUDE requires the name as it appears in
433
+ // library.js, which means $name for a JS name with no prefix, or name
434
+ // for a JS name like _name.
435
+ var librarySymbol = sym;
436
+ if (!librarySymbol.startsWith("_")) {
437
+ librarySymbol = "$" + sym;
438
+ }
439
+ msg += ` (e.g. -sDEFAULT_LIBRARY_FUNCS_TO_INCLUDE='${librarySymbol}')`;
440
+ if (isExportedByForceFilesystem(sym)) {
441
+ msg += ". Alternatively, forcing filesystem support (-sFORCE_FILESYSTEM) can export this for you";
442
+ }
443
+ warnOnce(msg);
444
+ });
445
+ // Any symbol that is not included from the JS library is also (by definition)
446
+ // not exported on the Module object.
447
+ unexportedRuntimeSymbol(sym);
448
+ }
449
+
450
+ function unexportedRuntimeSymbol(sym) {
451
+ if (!Object.getOwnPropertyDescriptor(Module, sym)) {
452
+ Object.defineProperty(Module, sym, {
453
+ configurable: true,
454
+ get() {
455
+ var msg = `'${sym}' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the Emscripten FAQ)`;
456
+ if (isExportedByForceFilesystem(sym)) {
457
+ msg += ". Alternatively, forcing filesystem support (-sFORCE_FILESYSTEM) can export this for you";
458
+ }
459
+ abort(msg);
460
+ }
461
+ });
462
+ }
463
+ }
464
+
465
+ // Used by XXXXX_DEBUG settings to output debug messages.
466
+ function dbg(...args) {
467
+ // TODO(sbc): Make this configurable somehow. Its not always convenient for
468
+ // logging to show up as warnings.
469
+ console.warn(...args);
470
+ }
471
+
472
+ // end include: runtime_debug.js
473
+ // include: memoryprofiler.js
474
+ // end include: memoryprofiler.js
475
+ // include: runtime_safe_heap.js
476
+ /** @param {number|boolean=} isFloat */ function getSafeHeapType(bytes, isFloat) {
477
+ switch (bytes) {
478
+ case 1:
479
+ return "i8";
480
+
481
+ case 2:
482
+ return "i16";
483
+
484
+ case 4:
485
+ return isFloat ? "float" : "i32";
486
+
487
+ case 8:
488
+ return isFloat ? "double" : "i64";
489
+
490
+ default:
491
+ abort(`getSafeHeapType() invalid bytes=${bytes}`);
492
+ }
493
+ }
494
+
495
+ /** @param {number|boolean=} isFloat */ function SAFE_HEAP_STORE(dest, value, bytes, isFloat) {
496
+ if (dest <= 0) abort(`segmentation fault storing ${bytes} bytes to address ${dest}`);
497
+ if (dest % bytes !== 0) abort(`alignment error storing to address ${dest}, which was expected to be aligned to a multiple of ${bytes}`);
498
+ if (runtimeInitialized) {
499
+ var brk = _sbrk(0);
500
+ if (dest + bytes > brk) abort(`segmentation fault, exceeded the top of the available dynamic heap when storing ${bytes} bytes to address ${dest}. DYNAMICTOP=${brk}`);
501
+ if (brk < _emscripten_stack_get_base()) abort(`brk >= _emscripten_stack_get_base() (brk=${brk}, _emscripten_stack_get_base()=${_emscripten_stack_get_base()})`);
502
+ // sbrk-managed memory must be above the stack
503
+ if (brk > wasmMemory.buffer.byteLength) abort(`brk <= wasmMemory.buffer.byteLength (brk=${brk}, wasmMemory.buffer.byteLength=${wasmMemory.buffer.byteLength})`);
504
+ }
505
+ setValue_safe(dest, value, getSafeHeapType(bytes, isFloat));
506
+ return value;
507
+ }
508
+
509
+ function SAFE_HEAP_STORE_D(dest, value, bytes) {
510
+ return SAFE_HEAP_STORE(dest, value, bytes, true);
511
+ }
512
+
513
+ /** @param {number|boolean=} isFloat */ function SAFE_HEAP_LOAD(dest, bytes, unsigned, isFloat) {
514
+ if (dest <= 0) abort(`segmentation fault loading ${bytes} bytes from address ${dest}`);
515
+ if (dest % bytes !== 0) abort(`alignment error loading from address ${dest}, which was expected to be aligned to a multiple of ${bytes}`);
516
+ if (runtimeInitialized) {
517
+ var brk = _sbrk(0);
518
+ if (dest + bytes > brk) abort(`segmentation fault, exceeded the top of the available dynamic heap when loading ${bytes} bytes from address ${dest}. DYNAMICTOP=${brk}`);
519
+ if (brk < _emscripten_stack_get_base()) abort(`brk >= _emscripten_stack_get_base() (brk=${brk}, _emscripten_stack_get_base()=${_emscripten_stack_get_base()})`);
520
+ // sbrk-managed memory must be above the stack
521
+ if (brk > wasmMemory.buffer.byteLength) abort(`brk <= wasmMemory.buffer.byteLength (brk=${brk}, wasmMemory.buffer.byteLength=${wasmMemory.buffer.byteLength})`);
522
+ }
523
+ var type = getSafeHeapType(bytes, isFloat);
524
+ var ret = getValue_safe(dest, type);
525
+ if (unsigned) ret = unSign(ret, parseInt(type.slice(1), 10));
526
+ return ret;
527
+ }
528
+
529
+ function SAFE_HEAP_LOAD_D(dest, bytes, unsigned) {
530
+ return SAFE_HEAP_LOAD(dest, bytes, unsigned, true);
531
+ }
532
+
533
+ function SAFE_FT_MASK(value, mask) {
534
+ var ret = value & mask;
535
+ if (ret !== value) {
536
+ abort(`Function table mask error: function pointer is ${value} which is masked by ${mask}, the likely cause of this is that the function pointer is being called by the wrong type.`);
537
+ }
538
+ return ret;
539
+ }
540
+
541
+ function segfault() {
542
+ abort("segmentation fault");
543
+ }
544
+
545
+ function alignfault() {
546
+ abort("alignment fault");
547
+ }
548
+
549
+ // end include: runtime_safe_heap.js
550
+ function updateMemoryViews() {
551
+ var b = wasmMemory.buffer;
552
+ Module["HEAP_DATA_VIEW"] = HEAP_DATA_VIEW = new DataView(b);
553
+ Module["HEAP8"] = HEAP8 = new Int8Array(b);
554
+ Module["HEAP16"] = HEAP16 = new Int16Array(b);
555
+ Module["HEAPU8"] = HEAPU8 = new Uint8Array(b);
556
+ Module["HEAPU16"] = HEAPU16 = new Uint16Array(b);
557
+ Module["HEAP32"] = HEAP32 = new Int32Array(b);
558
+ Module["HEAPU32"] = HEAPU32 = new Uint32Array(b);
559
+ Module["HEAPF32"] = HEAPF32 = new Float32Array(b);
560
+ Module["HEAPF64"] = HEAPF64 = new Float64Array(b);
561
+ Module["HEAP64"] = HEAP64 = new BigInt64Array(b);
562
+ Module["HEAPU64"] = HEAPU64 = new BigUint64Array(b);
563
+ }
564
+
565
+ // end include: runtime_shared.js
566
+ assert(!Module["STACK_SIZE"], "STACK_SIZE can no longer be set at runtime. Use -sSTACK_SIZE at link time");
567
+
568
+ assert(typeof Int32Array != "undefined" && typeof Float64Array !== "undefined" && Int32Array.prototype.subarray != undefined && Int32Array.prototype.set != undefined, "JS engine does not provide full typed array support");
569
+
570
+ // In non-standalone/normal mode, we create the memory here.
571
+ // include: runtime_init_memory.js
572
+ // Create the wasm memory. (Note: this only applies if IMPORTED_MEMORY is defined)
573
+ // check for full engine support (use string 'subarray' to avoid closure compiler confusion)
574
+ if (Module["wasmMemory"]) {
575
+ wasmMemory = Module["wasmMemory"];
576
+ } else {
577
+ var INITIAL_MEMORY = Module["INITIAL_MEMORY"] || 33554432;
578
+ legacyModuleProp("INITIAL_MEMORY", "INITIAL_MEMORY");
579
+ assert(INITIAL_MEMORY >= 65536, "INITIAL_MEMORY should be larger than STACK_SIZE, was " + INITIAL_MEMORY + "! (STACK_SIZE=" + 65536 + ")");
580
+ /** @suppress {checkTypes} */ wasmMemory = new WebAssembly.Memory({
581
+ "initial": INITIAL_MEMORY / 65536,
582
+ // In theory we should not need to emit the maximum if we want "unlimited"
583
+ // or 4GB of memory, but VMs error on that atm, see
584
+ // https://github.com/emscripten-core/emscripten/issues/14130
585
+ // And in the pthreads case we definitely need to emit a maximum. So
586
+ // always emit one.
587
+ "maximum": 32768
588
+ });
589
+ }
590
+
591
+ updateMemoryViews();
592
+
593
+ // end include: runtime_init_memory.js
594
+ var __RELOC_FUNCS__ = [];
595
+
596
+ function preRun() {
597
+ if (Module["preRun"]) {
598
+ if (typeof Module["preRun"] == "function") Module["preRun"] = [ Module["preRun"] ];
599
+ while (Module["preRun"].length) {
600
+ addOnPreRun(Module["preRun"].shift());
601
+ }
602
+ }
603
+ consumedModuleProp("preRun");
604
+ callRuntimeCallbacks(onPreRuns);
605
+ }
606
+
607
+ function initRuntime() {
608
+ assert(!runtimeInitialized);
609
+ runtimeInitialized = true;
610
+ checkStackCookie();
611
+ callRuntimeCallbacks(__RELOC_FUNCS__);
612
+ wasmExports["__wasm_call_ctors"]();
613
+ callRuntimeCallbacks(onPostCtors);
614
+ }
615
+
616
+ function preMain() {
617
+ checkStackCookie();
618
+ }
619
+
620
+ function postRun() {
621
+ checkStackCookie();
622
+ if (Module["postRun"]) {
623
+ if (typeof Module["postRun"] == "function") Module["postRun"] = [ Module["postRun"] ];
624
+ while (Module["postRun"].length) {
625
+ addOnPostRun(Module["postRun"].shift());
626
+ }
627
+ }
628
+ consumedModuleProp("postRun");
629
+ callRuntimeCallbacks(onPostRuns);
630
+ }
631
+
632
+ // A counter of dependencies for calling run(). If we need to
633
+ // do asynchronous work before running, increment this and
634
+ // decrement it. Incrementing must happen in a place like
635
+ // Module.preRun (used by emcc to add file preloading).
636
+ // Note that you can add dependencies in preRun, even though
637
+ // it happens right before run - run will be postponed until
638
+ // the dependencies are met.
639
+ var runDependencies = 0;
640
+
641
+ var dependenciesFulfilled = null;
642
+
643
+ // overridden to take different actions when all run dependencies are fulfilled
644
+ var runDependencyTracking = {};
645
+
646
+ var runDependencyWatcher = null;
647
+
648
+ function getUniqueRunDependency(id) {
649
+ var orig = id;
650
+ while (1) {
651
+ if (!runDependencyTracking[id]) return id;
652
+ id = orig + Math.random();
653
+ }
654
+ }
655
+
656
+ function addRunDependency(id) {
657
+ runDependencies++;
658
+ Module["monitorRunDependencies"]?.(runDependencies);
659
+ if (id) {
660
+ assert(!runDependencyTracking[id]);
661
+ runDependencyTracking[id] = 1;
662
+ if (runDependencyWatcher === null && typeof setInterval != "undefined") {
663
+ // Check for missing dependencies every few seconds
664
+ runDependencyWatcher = setInterval(() => {
665
+ if (ABORT) {
666
+ clearInterval(runDependencyWatcher);
667
+ runDependencyWatcher = null;
668
+ return;
669
+ }
670
+ var shown = false;
671
+ for (var dep in runDependencyTracking) {
672
+ if (!shown) {
673
+ shown = true;
674
+ err("still waiting on run dependencies:");
675
+ }
676
+ err(`dependency: ${dep}`);
677
+ }
678
+ if (shown) {
679
+ err("(end of list)");
680
+ }
681
+ }, 1e4);
682
+ }
683
+ } else {
684
+ err("warning: run dependency added without ID");
685
+ }
686
+ }
687
+
688
+ function removeRunDependency(id) {
689
+ runDependencies--;
690
+ Module["monitorRunDependencies"]?.(runDependencies);
691
+ if (id) {
692
+ assert(runDependencyTracking[id]);
693
+ delete runDependencyTracking[id];
694
+ } else {
695
+ err("warning: run dependency removed without ID");
696
+ }
697
+ if (runDependencies == 0) {
698
+ if (runDependencyWatcher !== null) {
699
+ clearInterval(runDependencyWatcher);
700
+ runDependencyWatcher = null;
701
+ }
702
+ if (dependenciesFulfilled) {
703
+ var callback = dependenciesFulfilled;
704
+ dependenciesFulfilled = null;
705
+ callback();
706
+ }
707
+ }
708
+ }
709
+
710
+ /** @param {string|number=} what */ function abort(what) {
711
+ Module["onAbort"]?.(what);
712
+ what = "Aborted(" + what + ")";
713
+ // TODO(sbc): Should we remove printing and leave it up to whoever
714
+ // catches the exception?
715
+ err(what);
716
+ ABORT = true;
717
+ // Use a wasm runtime error, because a JS error might be seen as a foreign
718
+ // exception, which means we'd run destructors on it. We need the error to
719
+ // simply make the program stop.
720
+ // FIXME This approach does not work in Wasm EH because it currently does not assume
721
+ // all RuntimeErrors are from traps; it decides whether a RuntimeError is from
722
+ // a trap or not based on a hidden field within the object. So at the moment
723
+ // we don't have a way of throwing a wasm trap from JS. TODO Make a JS API that
724
+ // allows this in the wasm spec.
725
+ // Suppress closure compiler warning here. Closure compiler's builtin extern
726
+ // definition for WebAssembly.RuntimeError claims it takes no arguments even
727
+ // though it can.
728
+ // TODO(https://github.com/google/closure-compiler/pull/3913): Remove if/when upstream closure gets fixed.
729
+ /** @suppress {checkTypes} */ var e = new WebAssembly.RuntimeError(what);
730
+ readyPromiseReject(e);
731
+ // Throw the error whether or not MODULARIZE is set because abort is used
732
+ // in code paths apart from instantiation where an exception is expected
733
+ // to be thrown when abort is called.
734
+ throw e;
735
+ }
736
+
737
+ // show errors on likely calls to FS when it was not included
738
+ var FS = {
739
+ error() {
740
+ abort("Filesystem support (FS) was not included. The problem is that you are using files from JS, but files were not used from C/C++, so filesystem support was not auto-included. You can force-include filesystem support with -sFORCE_FILESYSTEM");
741
+ },
742
+ init() {
743
+ FS.error();
744
+ },
745
+ createDataFile() {
746
+ FS.error();
747
+ },
748
+ createPreloadedFile() {
749
+ FS.error();
750
+ },
751
+ createLazyFile() {
752
+ FS.error();
753
+ },
754
+ open() {
755
+ FS.error();
756
+ },
757
+ mkdev() {
758
+ FS.error();
759
+ },
760
+ registerDevice() {
761
+ FS.error();
762
+ },
763
+ analyzePath() {
764
+ FS.error();
765
+ },
766
+ ErrnoError() {
767
+ FS.error();
768
+ }
769
+ };
770
+
771
+ Module["FS_createDataFile"] = FS.createDataFile;
772
+
773
+ Module["FS_createPreloadedFile"] = FS.createPreloadedFile;
774
+
775
+ function createExportWrapper(name, nargs) {
776
+ return (...args) => {
777
+ assert(runtimeInitialized, `native function \`${name}\` called before runtime initialization`);
778
+ var f = wasmExports[name];
779
+ assert(f, `exported native function \`${name}\` not found`);
780
+ // Only assert for too many arguments. Too few can be valid since the missing arguments will be zero filled.
781
+ assert(args.length <= nargs, `native function \`${name}\` called with ${args.length} args but expects ${nargs}`);
782
+ return f(...args);
783
+ };
784
+ }
785
+
786
+ var wasmBinaryFile;
787
+
788
+ function findWasmBinary() {
789
+ return locateFile("tree-sitter.wasm");
790
+ }
791
+
792
+ function getBinarySync(file) {
793
+ if (file == wasmBinaryFile && wasmBinary) {
794
+ return new Uint8Array(wasmBinary);
795
+ }
796
+ if (readBinary) {
797
+ return readBinary(file);
798
+ }
799
+ throw "both async and sync fetching of the wasm failed";
800
+ }
801
+
802
+ async function getWasmBinary(binaryFile) {
803
+ // If we don't have the binary yet, load it asynchronously using readAsync.
804
+ if (!wasmBinary) {
805
+ // Fetch the binary using readAsync
806
+ try {
807
+ var response = await readAsync(binaryFile);
808
+ return new Uint8Array(response);
809
+ } catch {}
810
+ }
811
+ // Otherwise, getBinarySync should be able to get it synchronously
812
+ return getBinarySync(binaryFile);
813
+ }
814
+
815
+ async function instantiateArrayBuffer(binaryFile, imports) {
816
+ try {
817
+ var binary = await getWasmBinary(binaryFile);
818
+ var instance = await WebAssembly.instantiate(binary, imports);
819
+ return instance;
820
+ } catch (reason) {
821
+ err(`failed to asynchronously prepare wasm: ${reason}`);
822
+ // Warn on some common problems.
823
+ if (isFileURI(wasmBinaryFile)) {
824
+ err(`warning: Loading from a file URI (${wasmBinaryFile}) 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`);
825
+ }
826
+ abort(reason);
827
+ }
828
+ }
829
+
830
+ async function instantiateAsync(binary, binaryFile, imports) {
831
+ if (!binary && typeof WebAssembly.instantiateStreaming == "function" && !isFileURI(binaryFile) && !ENVIRONMENT_IS_NODE) {
832
+ try {
833
+ var response = fetch(binaryFile, {
834
+ credentials: "same-origin"
835
+ });
836
+ var instantiationResult = await WebAssembly.instantiateStreaming(response, imports);
837
+ return instantiationResult;
838
+ } catch (reason) {
839
+ // We expect the most common failure cause to be a bad MIME type for the binary,
840
+ // in which case falling back to ArrayBuffer instantiation should work.
841
+ err(`wasm streaming compile failed: ${reason}`);
842
+ err("falling back to ArrayBuffer instantiation");
843
+ }
844
+ }
845
+ return instantiateArrayBuffer(binaryFile, imports);
846
+ }
847
+
848
+ function getWasmImports() {
849
+ // prepare imports
850
+ return {
851
+ "env": wasmImports,
852
+ "wasi_snapshot_preview1": wasmImports,
853
+ "GOT.mem": new Proxy(wasmImports, GOTHandler),
854
+ "GOT.func": new Proxy(wasmImports, GOTHandler)
855
+ };
856
+ }
857
+
858
+ // Create the wasm instance.
859
+ // Receives the wasm imports, returns the exports.
860
+ async function createWasm() {
861
+ // Load the wasm module and create an instance of using native support in the JS engine.
862
+ // handle a generated wasm instance, receiving its exports and
863
+ // performing other necessary setup
864
+ /** @param {WebAssembly.Module=} module*/ function receiveInstance(instance, module) {
865
+ wasmExports = instance.exports;
866
+ wasmExports = relocateExports(wasmExports, 1024);
867
+ var metadata = getDylinkMetadata(module);
868
+ if (metadata.neededDynlibs) {
869
+ dynamicLibraries = metadata.neededDynlibs.concat(dynamicLibraries);
870
+ }
871
+ mergeLibSymbols(wasmExports, "main");
872
+ LDSO.init();
873
+ loadDylibs();
874
+ __RELOC_FUNCS__.push(wasmExports["__wasm_apply_data_relocs"]);
875
+ removeRunDependency("wasm-instantiate");
876
+ return wasmExports;
877
+ }
878
+ // wait for the pthread pool (if any)
879
+ addRunDependency("wasm-instantiate");
880
+ // Prefer streaming instantiation if available.
881
+ // Async compilation can be confusing when an error on the page overwrites Module
882
+ // (for example, if the order of elements is wrong, and the one defining Module is
883
+ // later), so we save Module and check it later.
884
+ var trueModule = Module;
885
+ function receiveInstantiationResult(result) {
886
+ // 'result' is a ResultObject object which has both the module and instance.
887
+ // receiveInstance() will swap in the exports (to Module.asm) so they can be called
888
+ assert(Module === trueModule, "the Module object should not be replaced during async compilation - perhaps the order of HTML elements is wrong?");
889
+ trueModule = null;
890
+ return receiveInstance(result["instance"], result["module"]);
891
+ }
892
+ var info = getWasmImports();
893
+ // User shell pages can write their own Module.instantiateWasm = function(imports, successCallback) callback
894
+ // to manually instantiate the Wasm module themselves. This allows pages to
895
+ // run the instantiation parallel to any other async startup actions they are
896
+ // performing.
897
+ // Also pthreads and wasm workers initialize the wasm instance through this
898
+ // path.
899
+ if (Module["instantiateWasm"]) {
900
+ return new Promise((resolve, reject) => {
901
+ try {
902
+ Module["instantiateWasm"](info, (mod, inst) => {
903
+ receiveInstance(mod, inst);
904
+ resolve(mod.exports);
905
+ });
906
+ } catch (e) {
907
+ err(`Module.instantiateWasm callback failed with error: ${e}`);
908
+ reject(e);
909
+ }
910
+ });
911
+ }
912
+ wasmBinaryFile ??= findWasmBinary();
913
+ try {
914
+ var result = await instantiateAsync(wasmBinary, wasmBinaryFile, info);
915
+ var exports = receiveInstantiationResult(result);
916
+ return exports;
917
+ } catch (e) {
918
+ // If instantiation fails, reject the module ready promise.
919
+ readyPromiseReject(e);
920
+ return Promise.reject(e);
921
+ }
922
+ }
923
+
924
+ // === Body ===
925
+ var ASM_CONSTS = {};
926
+
927
+ // end include: preamble.js
928
+ class ExitStatus {
929
+ name="ExitStatus";
930
+ constructor(status) {
931
+ this.message = `Program terminated with exit(${status})`;
932
+ this.status = status;
933
+ }
934
+ }
935
+
936
+ var GOT = {};
937
+
938
+ var currentModuleWeakSymbols = new Set([]);
939
+
940
+ var GOTHandler = {
941
+ get(obj, symName) {
942
+ var rtn = GOT[symName];
943
+ if (!rtn) {
944
+ rtn = GOT[symName] = new WebAssembly.Global({
945
+ "value": "i32",
946
+ "mutable": true
947
+ });
948
+ }
949
+ if (!currentModuleWeakSymbols.has(symName)) {
950
+ // Any non-weak reference to a symbol marks it as `required`, which
951
+ // enabled `reportUndefinedSymbols` to report undefined symbol errors
952
+ // correctly.
953
+ rtn.required = true;
954
+ }
955
+ return rtn;
956
+ }
957
+ };
958
+
959
+ var LE_HEAP_LOAD_F32 = byteOffset => HEAP_DATA_VIEW.getFloat32(byteOffset, true);
960
+
961
+ var LE_HEAP_LOAD_F64 = byteOffset => HEAP_DATA_VIEW.getFloat64(byteOffset, true);
962
+
963
+ var LE_HEAP_LOAD_I16 = byteOffset => HEAP_DATA_VIEW.getInt16(byteOffset, true);
964
+
965
+ var LE_HEAP_LOAD_I32 = byteOffset => HEAP_DATA_VIEW.getInt32(byteOffset, true);
966
+
967
+ var LE_HEAP_LOAD_U16 = byteOffset => HEAP_DATA_VIEW.getUint16(byteOffset, true);
968
+
969
+ var LE_HEAP_LOAD_U32 = byteOffset => HEAP_DATA_VIEW.getUint32(byteOffset, true);
970
+
971
+ var LE_HEAP_STORE_F32 = (byteOffset, value) => HEAP_DATA_VIEW.setFloat32(byteOffset, value, true);
972
+
973
+ var LE_HEAP_STORE_F64 = (byteOffset, value) => HEAP_DATA_VIEW.setFloat64(byteOffset, value, true);
974
+
975
+ var LE_HEAP_STORE_I16 = (byteOffset, value) => HEAP_DATA_VIEW.setInt16(byteOffset, value, true);
976
+
977
+ var LE_HEAP_STORE_I32 = (byteOffset, value) => HEAP_DATA_VIEW.setInt32(byteOffset, value, true);
978
+
979
+ var LE_HEAP_STORE_U16 = (byteOffset, value) => HEAP_DATA_VIEW.setUint16(byteOffset, value, true);
980
+
981
+ var LE_HEAP_STORE_U32 = (byteOffset, value) => HEAP_DATA_VIEW.setUint32(byteOffset, value, true);
982
+
983
+ var callRuntimeCallbacks = callbacks => {
984
+ while (callbacks.length > 0) {
985
+ // Pass the module as the first argument.
986
+ callbacks.shift()(Module);
987
+ }
988
+ };
989
+
990
+ var onPostRuns = [];
991
+
992
+ var addOnPostRun = cb => onPostRuns.unshift(cb);
993
+
994
+ var onPreRuns = [];
995
+
996
+ var addOnPreRun = cb => onPreRuns.unshift(cb);
997
+
998
+ var UTF8Decoder = typeof TextDecoder != "undefined" ? new TextDecoder : undefined;
999
+
1000
+ /**
1001
+ * Given a pointer 'idx' to a null-terminated UTF8-encoded string in the given
1002
+ * array that contains uint8 values, returns a copy of that string as a
1003
+ * Javascript String object.
1004
+ * heapOrArray is either a regular array, or a JavaScript typed array view.
1005
+ * @param {number=} idx
1006
+ * @param {number=} maxBytesToRead
1007
+ * @return {string}
1008
+ */ var UTF8ArrayToString = (heapOrArray, idx = 0, maxBytesToRead = NaN) => {
1009
+ var endIdx = idx + maxBytesToRead;
1010
+ var endPtr = idx;
1011
+ // TextDecoder needs to know the byte length in advance, it doesn't stop on
1012
+ // null terminator by itself. Also, use the length info to avoid running tiny
1013
+ // strings through TextDecoder, since .subarray() allocates garbage.
1014
+ // (As a tiny code save trick, compare endPtr against endIdx using a negation,
1015
+ // so that undefined/NaN means Infinity)
1016
+ while (heapOrArray[endPtr] && !(endPtr >= endIdx)) ++endPtr;
1017
+ if (endPtr - idx > 16 && heapOrArray.buffer && UTF8Decoder) {
1018
+ return UTF8Decoder.decode(heapOrArray.subarray(idx, endPtr));
1019
+ }
1020
+ var str = "";
1021
+ // If building with TextDecoder, we have already computed the string length
1022
+ // above, so test loop end condition against that
1023
+ while (idx < endPtr) {
1024
+ // For UTF8 byte structure, see:
1025
+ // http://en.wikipedia.org/wiki/UTF-8#Description
1026
+ // https://www.ietf.org/rfc/rfc2279.txt
1027
+ // https://tools.ietf.org/html/rfc3629
1028
+ var u0 = heapOrArray[idx++];
1029
+ if (!(u0 & 128)) {
1030
+ str += String.fromCharCode(u0);
1031
+ continue;
1032
+ }
1033
+ var u1 = heapOrArray[idx++] & 63;
1034
+ if ((u0 & 224) == 192) {
1035
+ str += String.fromCharCode(((u0 & 31) << 6) | u1);
1036
+ continue;
1037
+ }
1038
+ var u2 = heapOrArray[idx++] & 63;
1039
+ if ((u0 & 240) == 224) {
1040
+ u0 = ((u0 & 15) << 12) | (u1 << 6) | u2;
1041
+ } else {
1042
+ 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!");
1043
+ u0 = ((u0 & 7) << 18) | (u1 << 12) | (u2 << 6) | (heapOrArray[idx++] & 63);
1044
+ }
1045
+ if (u0 < 65536) {
1046
+ str += String.fromCharCode(u0);
1047
+ } else {
1048
+ var ch = u0 - 65536;
1049
+ str += String.fromCharCode(55296 | (ch >> 10), 56320 | (ch & 1023));
1050
+ }
1051
+ }
1052
+ return str;
1053
+ };
1054
+
1055
+ var getDylinkMetadata = binary => {
1056
+ var offset = 0;
1057
+ var end = 0;
1058
+ function getU8() {
1059
+ return binary[offset++];
1060
+ }
1061
+ function getLEB() {
1062
+ var ret = 0;
1063
+ var mul = 1;
1064
+ while (1) {
1065
+ var byte = binary[offset++];
1066
+ ret += ((byte & 127) * mul);
1067
+ mul *= 128;
1068
+ if (!(byte & 128)) break;
1069
+ }
1070
+ return ret;
1071
+ }
1072
+ function getString() {
1073
+ var len = getLEB();
1074
+ offset += len;
1075
+ return UTF8ArrayToString(binary, offset - len, len);
1076
+ }
1077
+ /** @param {string=} message */ function failIf(condition, message) {
1078
+ if (condition) throw new Error(message);
1079
+ }
1080
+ var name = "dylink.0";
1081
+ if (binary instanceof WebAssembly.Module) {
1082
+ var dylinkSection = WebAssembly.Module.customSections(binary, name);
1083
+ if (dylinkSection.length === 0) {
1084
+ name = "dylink";
1085
+ dylinkSection = WebAssembly.Module.customSections(binary, name);
1086
+ }
1087
+ failIf(dylinkSection.length === 0, "need dylink section");
1088
+ binary = new Uint8Array(dylinkSection[0]);
1089
+ end = binary.length;
1090
+ } else {
1091
+ var int32View = new Uint32Array(new Uint8Array(binary.subarray(0, 24)).buffer);
1092
+ var magicNumberFound = int32View[0] == 1836278016 || int32View[0] == 6386541;
1093
+ failIf(!magicNumberFound, "need to see wasm magic number");
1094
+ // \0asm
1095
+ // we should see the dylink custom section right after the magic number and wasm version
1096
+ failIf(binary[8] !== 0, "need the dylink section to be first");
1097
+ offset = 9;
1098
+ var section_size = getLEB();
1099
+ //section size
1100
+ end = offset + section_size;
1101
+ name = getString();
1102
+ }
1103
+ var customSection = {
1104
+ neededDynlibs: [],
1105
+ tlsExports: new Set,
1106
+ weakImports: new Set
1107
+ };
1108
+ if (name == "dylink") {
1109
+ customSection.memorySize = getLEB();
1110
+ customSection.memoryAlign = getLEB();
1111
+ customSection.tableSize = getLEB();
1112
+ customSection.tableAlign = getLEB();
1113
+ // shared libraries this module needs. We need to load them first, so that
1114
+ // current module could resolve its imports. (see tools/shared.py
1115
+ // WebAssembly.make_shared_library() for "dylink" section extension format)
1116
+ var neededDynlibsCount = getLEB();
1117
+ for (var i = 0; i < neededDynlibsCount; ++i) {
1118
+ var libname = getString();
1119
+ customSection.neededDynlibs.push(libname);
1120
+ }
1121
+ } else {
1122
+ failIf(name !== "dylink.0");
1123
+ var WASM_DYLINK_MEM_INFO = 1;
1124
+ var WASM_DYLINK_NEEDED = 2;
1125
+ var WASM_DYLINK_EXPORT_INFO = 3;
1126
+ var WASM_DYLINK_IMPORT_INFO = 4;
1127
+ var WASM_SYMBOL_TLS = 256;
1128
+ var WASM_SYMBOL_BINDING_MASK = 3;
1129
+ var WASM_SYMBOL_BINDING_WEAK = 1;
1130
+ while (offset < end) {
1131
+ var subsectionType = getU8();
1132
+ var subsectionSize = getLEB();
1133
+ if (subsectionType === WASM_DYLINK_MEM_INFO) {
1134
+ customSection.memorySize = getLEB();
1135
+ customSection.memoryAlign = getLEB();
1136
+ customSection.tableSize = getLEB();
1137
+ customSection.tableAlign = getLEB();
1138
+ } else if (subsectionType === WASM_DYLINK_NEEDED) {
1139
+ var neededDynlibsCount = getLEB();
1140
+ for (var i = 0; i < neededDynlibsCount; ++i) {
1141
+ libname = getString();
1142
+ customSection.neededDynlibs.push(libname);
1143
+ }
1144
+ } else if (subsectionType === WASM_DYLINK_EXPORT_INFO) {
1145
+ var count = getLEB();
1146
+ while (count--) {
1147
+ var symname = getString();
1148
+ var flags = getLEB();
1149
+ if (flags & WASM_SYMBOL_TLS) {
1150
+ customSection.tlsExports.add(symname);
1151
+ }
1152
+ }
1153
+ } else if (subsectionType === WASM_DYLINK_IMPORT_INFO) {
1154
+ var count = getLEB();
1155
+ while (count--) {
1156
+ var modname = getString();
1157
+ var symname = getString();
1158
+ var flags = getLEB();
1159
+ if ((flags & WASM_SYMBOL_BINDING_MASK) == WASM_SYMBOL_BINDING_WEAK) {
1160
+ customSection.weakImports.add(symname);
1161
+ }
1162
+ }
1163
+ } else {
1164
+ err(`unknown dylink.0 subsection: ${subsectionType}`);
1165
+ // unknown subsection
1166
+ offset += subsectionSize;
1167
+ }
1168
+ }
1169
+ }
1170
+ var tableAlign = Math.pow(2, customSection.tableAlign);
1171
+ assert(tableAlign === 1, `invalid tableAlign ${tableAlign}`);
1172
+ assert(offset == end);
1173
+ return customSection;
1174
+ };
1175
+
1176
+ /**
1177
+ * @param {number} ptr
1178
+ * @param {string} type
1179
+ */ function getValue(ptr, type = "i8") {
1180
+ if (type.endsWith("*")) type = "*";
1181
+ switch (type) {
1182
+ case "i1":
1183
+ return SAFE_HEAP_LOAD(ptr, 1, 0);
1184
+
1185
+ case "i8":
1186
+ return SAFE_HEAP_LOAD(ptr, 1, 0);
1187
+
1188
+ case "i16":
1189
+ return LE_HEAP_LOAD_I16(((ptr) >> 1) * 2);
1190
+
1191
+ case "i32":
1192
+ return LE_HEAP_LOAD_I32(((ptr) >> 2) * 4);
1193
+
1194
+ case "i64":
1195
+ return HEAP64[((ptr) >> 3)];
1196
+
1197
+ case "float":
1198
+ return LE_HEAP_LOAD_F32(((ptr) >> 2) * 4);
1199
+
1200
+ case "double":
1201
+ return LE_HEAP_LOAD_F64(((ptr) >> 3) * 8);
1202
+
1203
+ case "*":
1204
+ return LE_HEAP_LOAD_U32(((ptr) >> 2) * 4);
1205
+
1206
+ default:
1207
+ abort(`invalid type for getValue: ${type}`);
1208
+ }
1209
+ }
1210
+
1211
+ function getValue_safe(ptr, type = "i8") {
1212
+ if (type.endsWith("*")) type = "*";
1213
+ switch (type) {
1214
+ case "i1":
1215
+ return HEAP8[ptr];
1216
+
1217
+ case "i8":
1218
+ return HEAP8[ptr];
1219
+
1220
+ case "i16":
1221
+ return LE_HEAP_LOAD_I16(((ptr) >> 1) * 2);
1222
+
1223
+ case "i32":
1224
+ return LE_HEAP_LOAD_I32(((ptr) >> 2) * 4);
1225
+
1226
+ case "i64":
1227
+ return HEAP64[((ptr) >> 3)];
1228
+
1229
+ case "float":
1230
+ return LE_HEAP_LOAD_F32(((ptr) >> 2) * 4);
1231
+
1232
+ case "double":
1233
+ return LE_HEAP_LOAD_F64(((ptr) >> 3) * 8);
1234
+
1235
+ case "*":
1236
+ return LE_HEAP_LOAD_U32(((ptr) >> 2) * 4);
1237
+
1238
+ default:
1239
+ abort(`invalid type for getValue: ${type}`);
1240
+ }
1241
+ }
1242
+
1243
+ var newDSO = (name, handle, syms) => {
1244
+ var dso = {
1245
+ refcount: Infinity,
1246
+ name,
1247
+ exports: syms,
1248
+ global: true
1249
+ };
1250
+ LDSO.loadedLibsByName[name] = dso;
1251
+ if (handle != undefined) {
1252
+ LDSO.loadedLibsByHandle[handle] = dso;
1253
+ }
1254
+ return dso;
1255
+ };
1256
+
1257
+ var LDSO = {
1258
+ loadedLibsByName: {},
1259
+ loadedLibsByHandle: {},
1260
+ init() {
1261
+ // This function needs to run after the initial wasmImports object
1262
+ // as been created.
1263
+ assert(wasmImports);
1264
+ newDSO("__main__", 0, wasmImports);
1265
+ }
1266
+ };
1267
+
1268
+ var ___heap_base = 78208;
1269
+
1270
+ var alignMemory = (size, alignment) => {
1271
+ assert(alignment, "alignment argument is required");
1272
+ return Math.ceil(size / alignment) * alignment;
1273
+ };
1274
+
1275
+ var getMemory = size => {
1276
+ // After the runtime is initialized, we must only use sbrk() normally.
1277
+ if (runtimeInitialized) {
1278
+ // Currently we don't support freeing of static data when modules are
1279
+ // unloaded via dlclose. This function is tagged as `noleakcheck` to
1280
+ // avoid having this reported as leak.
1281
+ return _calloc(size, 1);
1282
+ }
1283
+ var ret = ___heap_base;
1284
+ // Keep __heap_base stack aligned.
1285
+ var end = ret + alignMemory(size, 16);
1286
+ assert(end <= HEAP8.length, "failure to getMemory - memory growth etc. is not supported there, call malloc/sbrk directly or increase INITIAL_MEMORY");
1287
+ ___heap_base = end;
1288
+ GOT["__heap_base"].value = end;
1289
+ return ret;
1290
+ };
1291
+
1292
+ var isInternalSym = symName => [ "__cpp_exception", "__c_longjmp", "__wasm_apply_data_relocs", "__dso_handle", "__tls_size", "__tls_align", "__set_stack_limits", "_emscripten_tls_init", "__wasm_init_tls", "__wasm_call_ctors", "__start_em_asm", "__stop_em_asm", "__start_em_js", "__stop_em_js" ].includes(symName) || symName.startsWith("__em_js__");
1293
+
1294
+ var uleb128Encode = (n, target) => {
1295
+ assert(n < 16384);
1296
+ if (n < 128) {
1297
+ target.push(n);
1298
+ } else {
1299
+ target.push((n % 128) | 128, n >> 7);
1300
+ }
1301
+ };
1302
+
1303
+ var sigToWasmTypes = sig => {
1304
+ var typeNames = {
1305
+ "i": "i32",
1306
+ "j": "i64",
1307
+ "f": "f32",
1308
+ "d": "f64",
1309
+ "e": "externref",
1310
+ "p": "i32"
1311
+ };
1312
+ var type = {
1313
+ parameters: [],
1314
+ results: sig[0] == "v" ? [] : [ typeNames[sig[0]] ]
1315
+ };
1316
+ for (var i = 1; i < sig.length; ++i) {
1317
+ assert(sig[i] in typeNames, "invalid signature char: " + sig[i]);
1318
+ type.parameters.push(typeNames[sig[i]]);
1319
+ }
1320
+ return type;
1321
+ };
1322
+
1323
+ var generateFuncType = (sig, target) => {
1324
+ var sigRet = sig.slice(0, 1);
1325
+ var sigParam = sig.slice(1);
1326
+ var typeCodes = {
1327
+ "i": 127,
1328
+ // i32
1329
+ "p": 127,
1330
+ // i32
1331
+ "j": 126,
1332
+ // i64
1333
+ "f": 125,
1334
+ // f32
1335
+ "d": 124,
1336
+ // f64
1337
+ "e": 111
1338
+ };
1339
+ // Parameters, length + signatures
1340
+ target.push(96);
1341
+ uleb128Encode(sigParam.length, target);
1342
+ for (var i = 0; i < sigParam.length; ++i) {
1343
+ assert(sigParam[i] in typeCodes, "invalid signature char: " + sigParam[i]);
1344
+ target.push(typeCodes[sigParam[i]]);
1345
+ }
1346
+ // Return values, length + signatures
1347
+ // With no multi-return in MVP, either 0 (void) or 1 (anything else)
1348
+ if (sigRet == "v") {
1349
+ target.push(0);
1350
+ } else {
1351
+ target.push(1, typeCodes[sigRet]);
1352
+ }
1353
+ };
1354
+
1355
+ var convertJsFunctionToWasm = (func, sig) => {
1356
+ // If the type reflection proposal is available, use the new
1357
+ // "WebAssembly.Function" constructor.
1358
+ // Otherwise, construct a minimal wasm module importing the JS function and
1359
+ // re-exporting it.
1360
+ if (typeof WebAssembly.Function == "function") {
1361
+ return new WebAssembly.Function(sigToWasmTypes(sig), func);
1362
+ }
1363
+ // The module is static, with the exception of the type section, which is
1364
+ // generated based on the signature passed in.
1365
+ var typeSectionBody = [ 1 ];
1366
+ generateFuncType(sig, typeSectionBody);
1367
+ // Rest of the module is static
1368
+ var bytes = [ 0, 97, 115, 109, // magic ("\0asm")
1369
+ 1, 0, 0, 0, // version: 1
1370
+ 1 ];
1371
+ // Write the overall length of the type section followed by the body
1372
+ uleb128Encode(typeSectionBody.length, bytes);
1373
+ bytes.push(...typeSectionBody);
1374
+ // The rest of the module is static
1375
+ bytes.push(2, 7, // import section
1376
+ // (import "e" "f" (func 0 (type 0)))
1377
+ 1, 1, 101, 1, 102, 0, 0, 7, 5, // export section
1378
+ // (export "f" (func 0 (type 0)))
1379
+ 1, 1, 102, 0, 0);
1380
+ // We can compile this wasm module synchronously because it is very small.
1381
+ // This accepts an import (at "e.f"), that it reroutes to an export (at "f")
1382
+ var module = new WebAssembly.Module(new Uint8Array(bytes));
1383
+ var instance = new WebAssembly.Instance(module, {
1384
+ "e": {
1385
+ "f": func
1386
+ }
1387
+ });
1388
+ var wrappedFunc = instance.exports["f"];
1389
+ return wrappedFunc;
1390
+ };
1391
+
1392
+ var wasmTableMirror = [];
1393
+
1394
+ /** @type {WebAssembly.Table} */ var wasmTable = new WebAssembly.Table({
1395
+ "initial": 31,
1396
+ "element": "anyfunc"
1397
+ });
1398
+
1399
+ var getWasmTableEntry = funcPtr => {
1400
+ var func = wasmTableMirror[funcPtr];
1401
+ if (!func) {
1402
+ if (funcPtr >= wasmTableMirror.length) wasmTableMirror.length = funcPtr + 1;
1403
+ /** @suppress {checkTypes} */ wasmTableMirror[funcPtr] = func = wasmTable.get(funcPtr);
1404
+ }
1405
+ /** @suppress {checkTypes} */ assert(wasmTable.get(funcPtr) == func, "JavaScript-side Wasm function table mirror is out of date!");
1406
+ return func;
1407
+ };
1408
+
1409
+ var updateTableMap = (offset, count) => {
1410
+ if (functionsInTableMap) {
1411
+ for (var i = offset; i < offset + count; i++) {
1412
+ var item = getWasmTableEntry(i);
1413
+ // Ignore null values.
1414
+ if (item) {
1415
+ functionsInTableMap.set(item, i);
1416
+ }
1417
+ }
1418
+ }
1419
+ };
1420
+
1421
+ var functionsInTableMap;
1422
+
1423
+ var getFunctionAddress = func => {
1424
+ // First, create the map if this is the first use.
1425
+ if (!functionsInTableMap) {
1426
+ functionsInTableMap = new WeakMap;
1427
+ updateTableMap(0, wasmTable.length);
1428
+ }
1429
+ return functionsInTableMap.get(func) || 0;
1430
+ };
1431
+
1432
+ var freeTableIndexes = [];
1433
+
1434
+ var getEmptyTableSlot = () => {
1435
+ // Reuse a free index if there is one, otherwise grow.
1436
+ if (freeTableIndexes.length) {
1437
+ return freeTableIndexes.pop();
1438
+ }
1439
+ // Grow the table
1440
+ try {
1441
+ /** @suppress {checkTypes} */ wasmTable.grow(1);
1442
+ } catch (err) {
1443
+ if (!(err instanceof RangeError)) {
1444
+ throw err;
1445
+ }
1446
+ throw "Unable to grow wasm table. Set ALLOW_TABLE_GROWTH.";
1447
+ }
1448
+ return wasmTable.length - 1;
1449
+ };
1450
+
1451
+ var setWasmTableEntry = (idx, func) => {
1452
+ /** @suppress {checkTypes} */ wasmTable.set(idx, func);
1453
+ // With ABORT_ON_WASM_EXCEPTIONS wasmTable.get is overridden to return wrapped
1454
+ // functions so we need to call it here to retrieve the potential wrapper correctly
1455
+ // instead of just storing 'func' directly into wasmTableMirror
1456
+ /** @suppress {checkTypes} */ wasmTableMirror[idx] = wasmTable.get(idx);
1457
+ };
1458
+
1459
+ /** @param {string=} sig */ var addFunction = (func, sig) => {
1460
+ assert(typeof func != "undefined");
1461
+ // Check if the function is already in the table, to ensure each function
1462
+ // gets a unique index.
1463
+ var rtn = getFunctionAddress(func);
1464
+ if (rtn) {
1465
+ return rtn;
1466
+ }
1467
+ // It's not in the table, add it now.
1468
+ var ret = getEmptyTableSlot();
1469
+ // Set the new value.
1470
+ try {
1471
+ // Attempting to call this with JS function will cause of table.set() to fail
1472
+ setWasmTableEntry(ret, func);
1473
+ } catch (err) {
1474
+ if (!(err instanceof TypeError)) {
1475
+ throw err;
1476
+ }
1477
+ assert(typeof sig != "undefined", "Missing signature argument to addFunction: " + func);
1478
+ var wrapped = convertJsFunctionToWasm(func, sig);
1479
+ setWasmTableEntry(ret, wrapped);
1480
+ }
1481
+ functionsInTableMap.set(func, ret);
1482
+ return ret;
1483
+ };
1484
+
1485
+ var updateGOT = (exports, replace) => {
1486
+ for (var symName in exports) {
1487
+ if (isInternalSym(symName)) {
1488
+ continue;
1489
+ }
1490
+ var value = exports[symName];
1491
+ GOT[symName] ||= new WebAssembly.Global({
1492
+ "value": "i32",
1493
+ "mutable": true
1494
+ });
1495
+ if (replace || GOT[symName].value == 0) {
1496
+ if (typeof value == "function") {
1497
+ GOT[symName].value = addFunction(value);
1498
+ } else if (typeof value == "number") {
1499
+ GOT[symName].value = value;
1500
+ } else {
1501
+ err(`unhandled export type for '${symName}': ${typeof value}`);
1502
+ }
1503
+ }
1504
+ }
1505
+ };
1506
+
1507
+ /** @param {boolean=} replace */ var relocateExports = (exports, memoryBase, replace) => {
1508
+ var relocated = {};
1509
+ for (var e in exports) {
1510
+ var value = exports[e];
1511
+ if (typeof value == "object") {
1512
+ // a breaking change in the wasm spec, globals are now objects
1513
+ // https://github.com/WebAssembly/mutable-global/issues/1
1514
+ value = value.value;
1515
+ }
1516
+ if (typeof value == "number") {
1517
+ value += memoryBase;
1518
+ }
1519
+ relocated[e] = value;
1520
+ }
1521
+ updateGOT(relocated, replace);
1522
+ return relocated;
1523
+ };
1524
+
1525
+ var isSymbolDefined = symName => {
1526
+ // Ignore 'stub' symbols that are auto-generated as part of the original
1527
+ // `wasmImports` used to instantiate the main module.
1528
+ var existing = wasmImports[symName];
1529
+ if (!existing || existing.stub) {
1530
+ return false;
1531
+ }
1532
+ return true;
1533
+ };
1534
+
1535
+ var dynCall = (sig, ptr, args = []) => {
1536
+ assert(getWasmTableEntry(ptr), `missing table entry in dynCall: ${ptr}`);
1537
+ var rtn = getWasmTableEntry(ptr)(...args);
1538
+ return rtn;
1539
+ };
1540
+
1541
+ var stackSave = () => _emscripten_stack_get_current();
1542
+
1543
+ var stackRestore = val => __emscripten_stack_restore(val);
1544
+
1545
+ var createInvokeFunction = sig => (ptr, ...args) => {
1546
+ var sp = stackSave();
1547
+ try {
1548
+ return dynCall(sig, ptr, args);
1549
+ } catch (e) {
1550
+ stackRestore(sp);
1551
+ // Create a try-catch guard that rethrows the Emscripten EH exception.
1552
+ // Exceptions thrown from C++ will be a pointer (number) and longjmp
1553
+ // will throw the number Infinity. Use the compact and fast "e !== e+0"
1554
+ // test to check if e was not a Number.
1555
+ if (e !== e + 0) throw e;
1556
+ _setThrew(1, 0);
1557
+ // In theory this if statement could be done on
1558
+ // creating the function, but I just added this to
1559
+ // save wasting code space as it only happens on exception.
1560
+ if (sig[0] == "j") return 0n;
1561
+ }
1562
+ };
1563
+
1564
+ var resolveGlobalSymbol = (symName, direct = false) => {
1565
+ var sym;
1566
+ if (isSymbolDefined(symName)) {
1567
+ sym = wasmImports[symName];
1568
+ } else if (symName.startsWith("invoke_")) {
1569
+ // Create (and cache) new invoke_ functions on demand.
1570
+ sym = wasmImports[symName] = createInvokeFunction(symName.split("_")[1]);
1571
+ }
1572
+ return {
1573
+ sym,
1574
+ name: symName
1575
+ };
1576
+ };
1577
+
1578
+ var onPostCtors = [];
1579
+
1580
+ var addOnPostCtor = cb => onPostCtors.unshift(cb);
1581
+
1582
+ /**
1583
+ * Given a pointer 'ptr' to a null-terminated UTF8-encoded string in the
1584
+ * emscripten HEAP, returns a copy of that string as a Javascript String object.
1585
+ *
1586
+ * @param {number} ptr
1587
+ * @param {number=} maxBytesToRead - An optional length that specifies the
1588
+ * maximum number of bytes to read. You can omit this parameter to scan the
1589
+ * string until the first 0 byte. If maxBytesToRead is passed, and the string
1590
+ * at [ptr, ptr+maxBytesToReadr[ contains a null byte in the middle, then the
1591
+ * string will cut short at that byte index (i.e. maxBytesToRead will not
1592
+ * produce a string of exact length [ptr, ptr+maxBytesToRead[) N.B. mixing
1593
+ * frequent uses of UTF8ToString() with and without maxBytesToRead may throw
1594
+ * JS JIT optimizations off, so it is worth to consider consistently using one
1595
+ * @return {string}
1596
+ */ var UTF8ToString = (ptr, maxBytesToRead) => {
1597
+ assert(typeof ptr == "number", `UTF8ToString expects a number (got ${typeof ptr})`);
1598
+ return ptr ? UTF8ArrayToString(HEAPU8, ptr, maxBytesToRead) : "";
1599
+ };
1600
+
1601
+ /**
1602
+ * @param {string=} libName
1603
+ * @param {Object=} localScope
1604
+ * @param {number=} handle
1605
+ */ var loadWebAssemblyModule = (binary, flags, libName, localScope, handle) => {
1606
+ var metadata = getDylinkMetadata(binary);
1607
+ currentModuleWeakSymbols = metadata.weakImports;
1608
+ var originalTable = wasmTable;
1609
+ // loadModule loads the wasm module after all its dependencies have been loaded.
1610
+ // can be called both sync/async.
1611
+ function loadModule() {
1612
+ // alignments are powers of 2
1613
+ var memAlign = Math.pow(2, metadata.memoryAlign);
1614
+ // prepare memory
1615
+ var memoryBase = metadata.memorySize ? alignMemory(getMemory(metadata.memorySize + memAlign), memAlign) : 0;
1616
+ // TODO: add to cleanups
1617
+ var tableBase = metadata.tableSize ? wasmTable.length : 0;
1618
+ if (handle) {
1619
+ SAFE_HEAP_STORE((handle) + (8), 1, 1);
1620
+ LE_HEAP_STORE_U32((((handle) + (12)) >> 2) * 4, memoryBase);
1621
+ LE_HEAP_STORE_I32((((handle) + (16)) >> 2) * 4, metadata.memorySize);
1622
+ LE_HEAP_STORE_U32((((handle) + (20)) >> 2) * 4, tableBase);
1623
+ LE_HEAP_STORE_I32((((handle) + (24)) >> 2) * 4, metadata.tableSize);
1624
+ }
1625
+ if (metadata.tableSize) {
1626
+ assert(wasmTable.length == tableBase, `unexpected table size while loading ${libName}: ${wasmTable.length}`);
1627
+ wasmTable.grow(metadata.tableSize);
1628
+ }
1629
+ // This is the export map that we ultimately return. We declare it here
1630
+ // so it can be used within resolveSymbol. We resolve symbols against
1631
+ // this local symbol map in the case there they are not present on the
1632
+ // global Module object. We need this fallback because Modules sometime
1633
+ // need to import their own symbols
1634
+ var moduleExports;
1635
+ function resolveSymbol(sym) {
1636
+ var resolved = resolveGlobalSymbol(sym).sym;
1637
+ if (!resolved && localScope) {
1638
+ resolved = localScope[sym];
1639
+ }
1640
+ if (!resolved) {
1641
+ resolved = moduleExports[sym];
1642
+ }
1643
+ assert(resolved, `undefined symbol '${sym}'. perhaps a side module was not linked in? if this global was expected to arrive from a system library, try to build the MAIN_MODULE with EMCC_FORCE_STDLIBS=1 in the environment`);
1644
+ return resolved;
1645
+ }
1646
+ // TODO kill ↓↓↓ (except "symbols local to this module", it will likely be
1647
+ // not needed if we require that if A wants symbols from B it has to link
1648
+ // to B explicitly: similarly to -Wl,--no-undefined)
1649
+ // wasm dynamic libraries are pure wasm, so they cannot assist in
1650
+ // their own loading. When side module A wants to import something
1651
+ // provided by a side module B that is loaded later, we need to
1652
+ // add a layer of indirection, but worse, we can't even tell what
1653
+ // to add the indirection for, without inspecting what A's imports
1654
+ // are. To do that here, we use a JS proxy (another option would
1655
+ // be to inspect the binary directly).
1656
+ var proxyHandler = {
1657
+ get(stubs, prop) {
1658
+ // symbols that should be local to this module
1659
+ switch (prop) {
1660
+ case "__memory_base":
1661
+ return memoryBase;
1662
+
1663
+ case "__table_base":
1664
+ return tableBase;
1665
+ }
1666
+ if (prop in wasmImports && !wasmImports[prop].stub) {
1667
+ // No stub needed, symbol already exists in symbol table
1668
+ var res = wasmImports[prop];
1669
+ return res;
1670
+ }
1671
+ // Return a stub function that will resolve the symbol
1672
+ // when first called.
1673
+ if (!(prop in stubs)) {
1674
+ var resolved;
1675
+ stubs[prop] = (...args) => {
1676
+ resolved ||= resolveSymbol(prop);
1677
+ return resolved(...args);
1678
+ };
1679
+ }
1680
+ return stubs[prop];
1681
+ }
1682
+ };
1683
+ var proxy = new Proxy({}, proxyHandler);
1684
+ var info = {
1685
+ "GOT.mem": new Proxy({}, GOTHandler),
1686
+ "GOT.func": new Proxy({}, GOTHandler),
1687
+ "env": proxy,
1688
+ "wasi_snapshot_preview1": proxy
1689
+ };
1690
+ function postInstantiation(module, instance) {
1691
+ // the table should be unchanged
1692
+ assert(wasmTable === originalTable);
1693
+ // add new entries to functionsInTableMap
1694
+ updateTableMap(tableBase, metadata.tableSize);
1695
+ moduleExports = relocateExports(instance.exports, memoryBase);
1696
+ if (!flags.allowUndefined) {
1697
+ reportUndefinedSymbols();
1698
+ }
1699
+ function addEmAsm(addr, body) {
1700
+ var args = [];
1701
+ var arity = 0;
1702
+ for (;arity < 16; arity++) {
1703
+ if (body.indexOf("$" + arity) != -1) {
1704
+ args.push("$" + arity);
1705
+ } else {
1706
+ break;
1707
+ }
1708
+ }
1709
+ args = args.join(",");
1710
+ var func = `(${args}) => { ${body} };`;
1711
+ ASM_CONSTS[start] = eval(func);
1712
+ }
1713
+ // Add any EM_ASM function that exist in the side module
1714
+ if ("__start_em_asm" in moduleExports) {
1715
+ var start = moduleExports["__start_em_asm"];
1716
+ var stop = moduleExports["__stop_em_asm"];
1717
+ while (start < stop) {
1718
+ var jsString = UTF8ToString(start);
1719
+ addEmAsm(start, jsString);
1720
+ start = HEAPU8.indexOf(0, start) + 1;
1721
+ }
1722
+ }
1723
+ function addEmJs(name, cSig, body) {
1724
+ // The signature here is a C signature (e.g. "(int foo, char* bar)").
1725
+ // See `create_em_js` in emcc.py` for the build-time version of this
1726
+ // code.
1727
+ var jsArgs = [];
1728
+ cSig = cSig.slice(1, -1);
1729
+ if (cSig != "void") {
1730
+ cSig = cSig.split(",");
1731
+ for (var i in cSig) {
1732
+ var jsArg = cSig[i].split(" ").pop();
1733
+ jsArgs.push(jsArg.replace("*", ""));
1734
+ }
1735
+ }
1736
+ var func = `(${jsArgs}) => ${body};`;
1737
+ moduleExports[name] = eval(func);
1738
+ }
1739
+ for (var name in moduleExports) {
1740
+ if (name.startsWith("__em_js__")) {
1741
+ var start = moduleExports[name];
1742
+ var jsString = UTF8ToString(start);
1743
+ // EM_JS strings are stored in the data section in the form
1744
+ // SIG<::>BODY.
1745
+ var parts = jsString.split("<::>");
1746
+ addEmJs(name.replace("__em_js__", ""), parts[0], parts[1]);
1747
+ delete moduleExports[name];
1748
+ }
1749
+ }
1750
+ // initialize the module
1751
+ var applyRelocs = moduleExports["__wasm_apply_data_relocs"];
1752
+ if (applyRelocs) {
1753
+ if (runtimeInitialized) {
1754
+ applyRelocs();
1755
+ } else {
1756
+ __RELOC_FUNCS__.push(applyRelocs);
1757
+ }
1758
+ }
1759
+ var init = moduleExports["__wasm_call_ctors"];
1760
+ if (init) {
1761
+ if (runtimeInitialized) {
1762
+ init();
1763
+ } else {
1764
+ // we aren't ready to run compiled code yet
1765
+ addOnPostCtor(init);
1766
+ }
1767
+ }
1768
+ return moduleExports;
1769
+ }
1770
+ if (flags.loadAsync) {
1771
+ if (binary instanceof WebAssembly.Module) {
1772
+ var instance = new WebAssembly.Instance(binary, info);
1773
+ return Promise.resolve(postInstantiation(binary, instance));
1774
+ }
1775
+ return WebAssembly.instantiate(binary, info).then(result => postInstantiation(result.module, result.instance));
1776
+ }
1777
+ var module = binary instanceof WebAssembly.Module ? binary : new WebAssembly.Module(binary);
1778
+ var instance = new WebAssembly.Instance(module, info);
1779
+ return postInstantiation(module, instance);
1780
+ }
1781
+ // now load needed libraries and the module itself.
1782
+ if (flags.loadAsync) {
1783
+ return metadata.neededDynlibs.reduce((chain, dynNeeded) => chain.then(() => loadDynamicLibrary(dynNeeded, flags, localScope)), Promise.resolve()).then(loadModule);
1784
+ }
1785
+ metadata.neededDynlibs.forEach(needed => loadDynamicLibrary(needed, flags, localScope));
1786
+ return loadModule();
1787
+ };
1788
+
1789
+ var mergeLibSymbols = (exports, libName) => {
1790
+ // add symbols into global namespace TODO: weak linking etc.
1791
+ for (var [sym, exp] of Object.entries(exports)) {
1792
+ // When RTLD_GLOBAL is enabled, the symbols defined by this shared object
1793
+ // will be made available for symbol resolution of subsequently loaded
1794
+ // shared objects.
1795
+ // We should copy the symbols (which include methods and variables) from
1796
+ // SIDE_MODULE to MAIN_MODULE.
1797
+ const setImport = target => {
1798
+ if (!isSymbolDefined(target)) {
1799
+ wasmImports[target] = exp;
1800
+ }
1801
+ };
1802
+ setImport(sym);
1803
+ // Special case for handling of main symbol: If a side module exports
1804
+ // `main` that also acts a definition for `__main_argc_argv` and vice
1805
+ // versa.
1806
+ const main_alias = "__main_argc_argv";
1807
+ if (sym == "main") {
1808
+ setImport(main_alias);
1809
+ }
1810
+ if (sym == main_alias) {
1811
+ setImport("main");
1812
+ }
1813
+ }
1814
+ };
1815
+
1816
+ var asyncLoad = async url => {
1817
+ var arrayBuffer = await readAsync(url);
1818
+ assert(arrayBuffer, `Loading data file "${url}" failed (no arrayBuffer).`);
1819
+ return new Uint8Array(arrayBuffer);
1820
+ };
1821
+
1822
+ /**
1823
+ * @param {number=} handle
1824
+ * @param {Object=} localScope
1825
+ */ function loadDynamicLibrary(libName, flags = {
1826
+ global: true,
1827
+ nodelete: true
1828
+ }, localScope, handle) {
1829
+ // when loadDynamicLibrary did not have flags, libraries were loaded
1830
+ // globally & permanently
1831
+ var dso = LDSO.loadedLibsByName[libName];
1832
+ if (dso) {
1833
+ // the library is being loaded or has been loaded already.
1834
+ assert(dso.exports !== "loading", `Attempt to load '${libName}' twice before the first load completed`);
1835
+ if (!flags.global) {
1836
+ if (localScope) {
1837
+ Object.assign(localScope, dso.exports);
1838
+ }
1839
+ } else if (!dso.global) {
1840
+ // The library was previously loaded only locally but not
1841
+ // we have a request with global=true.
1842
+ dso.global = true;
1843
+ mergeLibSymbols(dso.exports, libName);
1844
+ }
1845
+ // same for "nodelete"
1846
+ if (flags.nodelete && dso.refcount !== Infinity) {
1847
+ dso.refcount = Infinity;
1848
+ }
1849
+ dso.refcount++;
1850
+ if (handle) {
1851
+ LDSO.loadedLibsByHandle[handle] = dso;
1852
+ }
1853
+ return flags.loadAsync ? Promise.resolve(true) : true;
1854
+ }
1855
+ // allocate new DSO
1856
+ dso = newDSO(libName, handle, "loading");
1857
+ dso.refcount = flags.nodelete ? Infinity : 1;
1858
+ dso.global = flags.global;
1859
+ // libName -> libData
1860
+ function loadLibData() {
1861
+ // for wasm, we can use fetch for async, but for fs mode we can only imitate it
1862
+ if (handle) {
1863
+ var data = LE_HEAP_LOAD_U32((((handle) + (28)) >> 2) * 4);
1864
+ var dataSize = LE_HEAP_LOAD_U32((((handle) + (32)) >> 2) * 4);
1865
+ if (data && dataSize) {
1866
+ var libData = HEAP8.slice(data, data + dataSize);
1867
+ return flags.loadAsync ? Promise.resolve(libData) : libData;
1868
+ }
1869
+ }
1870
+ var libFile = locateFile(libName);
1871
+ if (flags.loadAsync) {
1872
+ return asyncLoad(libFile);
1873
+ }
1874
+ // load the binary synchronously
1875
+ if (!readBinary) {
1876
+ throw new Error(`${libFile}: file not found, and synchronous loading of external files is not available`);
1877
+ }
1878
+ return readBinary(libFile);
1879
+ }
1880
+ // libName -> exports
1881
+ function getExports() {
1882
+ // module not preloaded - load lib data and create new module from it
1883
+ if (flags.loadAsync) {
1884
+ return loadLibData().then(libData => loadWebAssemblyModule(libData, flags, libName, localScope, handle));
1885
+ }
1886
+ return loadWebAssemblyModule(loadLibData(), flags, libName, localScope, handle);
1887
+ }
1888
+ // module for lib is loaded - update the dso & global namespace
1889
+ function moduleLoaded(exports) {
1890
+ if (dso.global) {
1891
+ mergeLibSymbols(exports, libName);
1892
+ } else if (localScope) {
1893
+ Object.assign(localScope, exports);
1894
+ }
1895
+ dso.exports = exports;
1896
+ }
1897
+ if (flags.loadAsync) {
1898
+ return getExports().then(exports => {
1899
+ moduleLoaded(exports);
1900
+ return true;
1901
+ });
1902
+ }
1903
+ moduleLoaded(getExports());
1904
+ return true;
1905
+ }
1906
+
1907
+ var reportUndefinedSymbols = () => {
1908
+ for (var [symName, entry] of Object.entries(GOT)) {
1909
+ if (entry.value == 0) {
1910
+ var value = resolveGlobalSymbol(symName, true).sym;
1911
+ if (!value && !entry.required) {
1912
+ // Ignore undefined symbols that are imported as weak.
1913
+ continue;
1914
+ }
1915
+ assert(value, `undefined symbol '${symName}'. perhaps a side module was not linked in? if this global was expected to arrive from a system library, try to build the MAIN_MODULE with EMCC_FORCE_STDLIBS=1 in the environment`);
1916
+ if (typeof value == "function") {
1917
+ /** @suppress {checkTypes} */ entry.value = addFunction(value, value.sig);
1918
+ } else if (typeof value == "number") {
1919
+ entry.value = value;
1920
+ } else {
1921
+ throw new Error(`bad export type for '${symName}': ${typeof value}`);
1922
+ }
1923
+ }
1924
+ }
1925
+ };
1926
+
1927
+ var loadDylibs = () => {
1928
+ if (!dynamicLibraries.length) {
1929
+ reportUndefinedSymbols();
1930
+ return;
1931
+ }
1932
+ // Load binaries asynchronously
1933
+ addRunDependency("loadDylibs");
1934
+ dynamicLibraries.reduce((chain, lib) => chain.then(() => loadDynamicLibrary(lib, {
1935
+ loadAsync: true,
1936
+ global: true,
1937
+ nodelete: true,
1938
+ allowUndefined: true
1939
+ })), Promise.resolve()).then(() => {
1940
+ // we got them all, wonderful
1941
+ reportUndefinedSymbols();
1942
+ removeRunDependency("loadDylibs");
1943
+ });
1944
+ };
1945
+
1946
+ var noExitRuntime = Module["noExitRuntime"] || true;
1947
+
1948
+ var ptrToString = ptr => {
1949
+ assert(typeof ptr === "number");
1950
+ // With CAN_ADDRESS_2GB or MEMORY64, pointers are already unsigned.
1951
+ ptr >>>= 0;
1952
+ return "0x" + ptr.toString(16).padStart(8, "0");
1953
+ };
1954
+
1955
+ /**
1956
+ * @param {number} ptr
1957
+ * @param {number} value
1958
+ * @param {string} type
1959
+ */ function setValue(ptr, value, type = "i8") {
1960
+ if (type.endsWith("*")) type = "*";
1961
+ switch (type) {
1962
+ case "i1":
1963
+ SAFE_HEAP_STORE(ptr, value, 1);
1964
+ break;
1965
+
1966
+ case "i8":
1967
+ SAFE_HEAP_STORE(ptr, value, 1);
1968
+ break;
1969
+
1970
+ case "i16":
1971
+ LE_HEAP_STORE_I16(((ptr) >> 1) * 2, value);
1972
+ break;
1973
+
1974
+ case "i32":
1975
+ LE_HEAP_STORE_I32(((ptr) >> 2) * 4, value);
1976
+ break;
1977
+
1978
+ case "i64":
1979
+ HEAP64[((ptr) >> 3)] = BigInt(value);
1980
+ break;
1981
+
1982
+ case "float":
1983
+ LE_HEAP_STORE_F32(((ptr) >> 2) * 4, value);
1984
+ break;
1985
+
1986
+ case "double":
1987
+ LE_HEAP_STORE_F64(((ptr) >> 3) * 8, value);
1988
+ break;
1989
+
1990
+ case "*":
1991
+ LE_HEAP_STORE_U32(((ptr) >> 2) * 4, value);
1992
+ break;
1993
+
1994
+ default:
1995
+ abort(`invalid type for setValue: ${type}`);
1996
+ }
1997
+ }
1998
+
1999
+ function setValue_safe(ptr, value, type = "i8") {
2000
+ if (type.endsWith("*")) type = "*";
2001
+ switch (type) {
2002
+ case "i1":
2003
+ HEAP8[ptr] = value;
2004
+ break;
2005
+
2006
+ case "i8":
2007
+ HEAP8[ptr] = value;
2008
+ break;
2009
+
2010
+ case "i16":
2011
+ LE_HEAP_STORE_I16(((ptr) >> 1) * 2, value);
2012
+ break;
2013
+
2014
+ case "i32":
2015
+ LE_HEAP_STORE_I32(((ptr) >> 2) * 4, value);
2016
+ break;
2017
+
2018
+ case "i64":
2019
+ HEAP64[((ptr) >> 3)] = BigInt(value);
2020
+ break;
2021
+
2022
+ case "float":
2023
+ LE_HEAP_STORE_F32(((ptr) >> 2) * 4, value);
2024
+ break;
2025
+
2026
+ case "double":
2027
+ LE_HEAP_STORE_F64(((ptr) >> 3) * 8, value);
2028
+ break;
2029
+
2030
+ case "*":
2031
+ LE_HEAP_STORE_U32(((ptr) >> 2) * 4, value);
2032
+ break;
2033
+
2034
+ default:
2035
+ abort(`invalid type for setValue: ${type}`);
2036
+ }
2037
+ }
2038
+
2039
+ var unSign = (value, bits) => {
2040
+ if (value >= 0) {
2041
+ return value;
2042
+ }
2043
+ // Need some trickery, since if bits == 32, we are right at the limit of the
2044
+ // bits JS uses in bitshifts
2045
+ return bits <= 32 ? 2 * Math.abs(1 << (bits - 1)) + value : Math.pow(2, bits) + value;
2046
+ };
2047
+
2048
+ var warnOnce = text => {
2049
+ warnOnce.shown ||= {};
2050
+ if (!warnOnce.shown[text]) {
2051
+ warnOnce.shown[text] = 1;
2052
+ if (ENVIRONMENT_IS_NODE) text = "warning: " + text;
2053
+ err(text);
2054
+ }
2055
+ };
2056
+
2057
+ var ___memory_base = new WebAssembly.Global({
2058
+ "value": "i32",
2059
+ "mutable": false
2060
+ }, 1024);
2061
+
2062
+ var ___stack_high = 78208;
2063
+
2064
+ var ___stack_low = 12672;
2065
+
2066
+ var ___stack_pointer = new WebAssembly.Global({
2067
+ "value": "i32",
2068
+ "mutable": true
2069
+ }, 78208);
2070
+
2071
+ var ___table_base = new WebAssembly.Global({
2072
+ "value": "i32",
2073
+ "mutable": false
2074
+ }, 1);
2075
+
2076
+ var __abort_js = () => abort("native code called abort()");
2077
+
2078
+ __abort_js.sig = "v";
2079
+
2080
+ var _emscripten_get_now = () => performance.now();
2081
+
2082
+ _emscripten_get_now.sig = "d";
2083
+
2084
+ var _emscripten_date_now = () => Date.now();
2085
+
2086
+ _emscripten_date_now.sig = "d";
2087
+
2088
+ var nowIsMonotonic = 1;
2089
+
2090
+ var checkWasiClock = clock_id => clock_id >= 0 && clock_id <= 3;
2091
+
2092
+ var INT53_MAX = 9007199254740992;
2093
+
2094
+ var INT53_MIN = -9007199254740992;
2095
+
2096
+ var bigintToI53Checked = num => (num < INT53_MIN || num > INT53_MAX) ? NaN : Number(num);
2097
+
2098
+ function _clock_time_get(clk_id, ignored_precision, ptime) {
2099
+ ignored_precision = bigintToI53Checked(ignored_precision);
2100
+ if (!checkWasiClock(clk_id)) {
2101
+ return 28;
2102
+ }
2103
+ var now;
2104
+ // all wasi clocks but realtime are monotonic
2105
+ if (clk_id === 0) {
2106
+ now = _emscripten_date_now();
2107
+ } else if (nowIsMonotonic) {
2108
+ now = _emscripten_get_now();
2109
+ } else {
2110
+ return 52;
2111
+ }
2112
+ // "now" is in ms, and wasi times are in ns.
2113
+ var nsec = Math.round(now * 1e3 * 1e3);
2114
+ HEAP64[((ptime) >> 3)] = BigInt(nsec);
2115
+ return 0;
2116
+ }
2117
+
2118
+ _clock_time_get.sig = "iijp";
2119
+
2120
+ var getHeapMax = () => // Stay one Wasm page short of 4GB: while e.g. Chrome is able to allocate
2121
+ // full 4GB Wasm memories, the size will wrap back to 0 bytes in Wasm side
2122
+ // for any code that deals with heap sizes, which would require special
2123
+ // casing all heap size related code to treat 0 specially.
2124
+ 2147483648;
2125
+
2126
+ var growMemory = size => {
2127
+ var b = wasmMemory.buffer;
2128
+ var pages = ((size - b.byteLength + 65535) / 65536) | 0;
2129
+ try {
2130
+ // round size grow request up to wasm page size (fixed 64KB per spec)
2131
+ wasmMemory.grow(pages);
2132
+ // .grow() takes a delta compared to the previous size
2133
+ updateMemoryViews();
2134
+ return 1;
2135
+ } catch (e) {
2136
+ err(`growMemory: Attempted to grow heap from ${b.byteLength} bytes to ${size} bytes, but got error: ${e}`);
2137
+ }
2138
+ };
2139
+
2140
+ var _emscripten_resize_heap = requestedSize => {
2141
+ var oldSize = HEAPU8.length;
2142
+ // With CAN_ADDRESS_2GB or MEMORY64, pointers are already unsigned.
2143
+ requestedSize >>>= 0;
2144
+ // With multithreaded builds, races can happen (another thread might increase the size
2145
+ // in between), so return a failure, and let the caller retry.
2146
+ assert(requestedSize > oldSize);
2147
+ // Memory resize rules:
2148
+ // 1. Always increase heap size to at least the requested size, rounded up
2149
+ // to next page multiple.
2150
+ // 2a. If MEMORY_GROWTH_LINEAR_STEP == -1, excessively resize the heap
2151
+ // geometrically: increase the heap size according to
2152
+ // MEMORY_GROWTH_GEOMETRIC_STEP factor (default +20%), At most
2153
+ // overreserve by MEMORY_GROWTH_GEOMETRIC_CAP bytes (default 96MB).
2154
+ // 2b. If MEMORY_GROWTH_LINEAR_STEP != -1, excessively resize the heap
2155
+ // linearly: increase the heap size by at least
2156
+ // MEMORY_GROWTH_LINEAR_STEP bytes.
2157
+ // 3. Max size for the heap is capped at 2048MB-WASM_PAGE_SIZE, or by
2158
+ // MAXIMUM_MEMORY, or by ASAN limit, depending on which is smallest
2159
+ // 4. If we were unable to allocate as much memory, it may be due to
2160
+ // over-eager decision to excessively reserve due to (3) above.
2161
+ // Hence if an allocation fails, cut down on the amount of excess
2162
+ // growth, in an attempt to succeed to perform a smaller allocation.
2163
+ // A limit is set for how much we can grow. We should not exceed that
2164
+ // (the wasm binary specifies it, so if we tried, we'd fail anyhow).
2165
+ var maxHeapSize = getHeapMax();
2166
+ if (requestedSize > maxHeapSize) {
2167
+ err(`Cannot enlarge memory, requested ${requestedSize} bytes, but the limit is ${maxHeapSize} bytes!`);
2168
+ return false;
2169
+ }
2170
+ // Loop through potential heap size increases. If we attempt a too eager
2171
+ // reservation that fails, cut down on the attempted size and reserve a
2172
+ // smaller bump instead. (max 3 times, chosen somewhat arbitrarily)
2173
+ for (var cutDown = 1; cutDown <= 4; cutDown *= 2) {
2174
+ var overGrownHeapSize = oldSize * (1 + .2 / cutDown);
2175
+ // ensure geometric growth
2176
+ // but limit overreserving (default to capping at +96MB overgrowth at most)
2177
+ overGrownHeapSize = Math.min(overGrownHeapSize, requestedSize + 100663296);
2178
+ var newSize = Math.min(maxHeapSize, alignMemory(Math.max(requestedSize, overGrownHeapSize), 65536));
2179
+ var replacement = growMemory(newSize);
2180
+ if (replacement) {
2181
+ return true;
2182
+ }
2183
+ }
2184
+ err(`Failed to grow the heap from ${oldSize} bytes to ${newSize} bytes, not enough memory!`);
2185
+ return false;
2186
+ };
2187
+
2188
+ _emscripten_resize_heap.sig = "ip";
2189
+
2190
+ var SYSCALLS = {
2191
+ varargs: undefined,
2192
+ getStr(ptr) {
2193
+ var ret = UTF8ToString(ptr);
2194
+ return ret;
2195
+ }
2196
+ };
2197
+
2198
+ var _fd_close = fd => {
2199
+ abort("fd_close called without SYSCALLS_REQUIRE_FILESYSTEM");
2200
+ };
2201
+
2202
+ _fd_close.sig = "ii";
2203
+
2204
+ function _fd_seek(fd, offset, whence, newOffset) {
2205
+ offset = bigintToI53Checked(offset);
2206
+ return 70;
2207
+ }
2208
+
2209
+ _fd_seek.sig = "iijip";
2210
+
2211
+ var printCharBuffers = [ null, [], [] ];
2212
+
2213
+ var printChar = (stream, curr) => {
2214
+ var buffer = printCharBuffers[stream];
2215
+ assert(buffer);
2216
+ if (curr === 0 || curr === 10) {
2217
+ (stream === 1 ? out : err)(UTF8ArrayToString(buffer));
2218
+ buffer.length = 0;
2219
+ } else {
2220
+ buffer.push(curr);
2221
+ }
2222
+ };
2223
+
2224
+ var flush_NO_FILESYSTEM = () => {
2225
+ // flush anything remaining in the buffers during shutdown
2226
+ _fflush(0);
2227
+ if (printCharBuffers[1].length) printChar(1, 10);
2228
+ if (printCharBuffers[2].length) printChar(2, 10);
2229
+ };
2230
+
2231
+ var _fd_write = (fd, iov, iovcnt, pnum) => {
2232
+ // hack to support printf in SYSCALLS_REQUIRE_FILESYSTEM=0
2233
+ var num = 0;
2234
+ for (var i = 0; i < iovcnt; i++) {
2235
+ var ptr = LE_HEAP_LOAD_U32(((iov) >> 2) * 4);
2236
+ var len = LE_HEAP_LOAD_U32((((iov) + (4)) >> 2) * 4);
2237
+ iov += 8;
2238
+ for (var j = 0; j < len; j++) {
2239
+ printChar(fd, SAFE_HEAP_LOAD(ptr + j, 1, 1));
2240
+ }
2241
+ num += len;
2242
+ }
2243
+ LE_HEAP_STORE_U32(((pnum) >> 2) * 4, num);
2244
+ return 0;
2245
+ };
2246
+
2247
+ _fd_write.sig = "iippp";
2248
+
2249
+ function _tree_sitter_log_callback(isLexMessage, messageAddress) {
2250
+ if (Module.currentLogCallback) {
2251
+ const message = UTF8ToString(messageAddress);
2252
+ Module.currentLogCallback(message, isLexMessage !== 0);
2253
+ }
2254
+ }
2255
+
2256
+ function _tree_sitter_parse_callback(inputBufferAddress, index, row, column, lengthAddress) {
2257
+ const INPUT_BUFFER_SIZE = 10 * 1024;
2258
+ const string = Module.currentParseCallback(index, {
2259
+ row,
2260
+ column
2261
+ });
2262
+ if (typeof string === "string") {
2263
+ setValue(lengthAddress, string.length, "i32");
2264
+ stringToUTF16(string, inputBufferAddress, INPUT_BUFFER_SIZE);
2265
+ } else {
2266
+ setValue(lengthAddress, 0, "i32");
2267
+ }
2268
+ }
2269
+
2270
+ function _tree_sitter_progress_callback(currentOffset, hasError) {
2271
+ if (Module.currentProgressCallback) {
2272
+ return Module.currentProgressCallback({
2273
+ currentOffset,
2274
+ hasError
2275
+ });
2276
+ }
2277
+ return false;
2278
+ }
2279
+
2280
+ function _tree_sitter_query_progress_callback(currentOffset) {
2281
+ if (Module.currentQueryProgressCallback) {
2282
+ return Module.currentQueryProgressCallback({
2283
+ currentOffset
2284
+ });
2285
+ }
2286
+ return false;
2287
+ }
2288
+
2289
+ var runtimeKeepaliveCounter = 0;
2290
+
2291
+ var keepRuntimeAlive = () => noExitRuntime || runtimeKeepaliveCounter > 0;
2292
+
2293
+ var _proc_exit = code => {
2294
+ EXITSTATUS = code;
2295
+ if (!keepRuntimeAlive()) {
2296
+ Module["onExit"]?.(code);
2297
+ ABORT = true;
2298
+ }
2299
+ quit_(code, new ExitStatus(code));
2300
+ };
2301
+
2302
+ _proc_exit.sig = "vi";
2303
+
2304
+ /** @param {boolean|number=} implicit */ var exitJS = (status, implicit) => {
2305
+ EXITSTATUS = status;
2306
+ checkUnflushedContent();
2307
+ // if exit() was called explicitly, warn the user if the runtime isn't actually being shut down
2308
+ if (keepRuntimeAlive() && !implicit) {
2309
+ var msg = `program exited (with status: ${status}), but keepRuntimeAlive() is set (counter=${runtimeKeepaliveCounter}) due to an async operation, so halting execution but not exiting the runtime or preventing further async execution (you can use emscripten_force_exit, if you want to force a true shutdown)`;
2310
+ readyPromiseReject(msg);
2311
+ err(msg);
2312
+ }
2313
+ _proc_exit(status);
2314
+ };
2315
+
2316
+ var handleException = e => {
2317
+ // Certain exception types we do not treat as errors since they are used for
2318
+ // internal control flow.
2319
+ // 1. ExitStatus, which is thrown by exit()
2320
+ // 2. "unwind", which is thrown by emscripten_unwind_to_js_event_loop() and others
2321
+ // that wish to return to JS event loop.
2322
+ if (e instanceof ExitStatus || e == "unwind") {
2323
+ return EXITSTATUS;
2324
+ }
2325
+ checkStackCookie();
2326
+ if (e instanceof WebAssembly.RuntimeError) {
2327
+ if (_emscripten_stack_get_current() <= 0) {
2328
+ err("Stack overflow detected. You can try increasing -sSTACK_SIZE (currently set to 65536)");
2329
+ }
2330
+ }
2331
+ quit_(1, e);
2332
+ };
2333
+
2334
+ var lengthBytesUTF8 = str => {
2335
+ var len = 0;
2336
+ for (var i = 0; i < str.length; ++i) {
2337
+ // Gotcha: charCodeAt returns a 16-bit word that is a UTF-16 encoded code
2338
+ // unit, not a Unicode code point of the character! So decode
2339
+ // UTF16->UTF32->UTF8.
2340
+ // See http://unicode.org/faq/utf_bom.html#utf16-3
2341
+ var c = str.charCodeAt(i);
2342
+ // possibly a lead surrogate
2343
+ if (c <= 127) {
2344
+ len++;
2345
+ } else if (c <= 2047) {
2346
+ len += 2;
2347
+ } else if (c >= 55296 && c <= 57343) {
2348
+ len += 4;
2349
+ ++i;
2350
+ } else {
2351
+ len += 3;
2352
+ }
2353
+ }
2354
+ return len;
2355
+ };
2356
+
2357
+ var stringToUTF8Array = (str, heap, outIdx, maxBytesToWrite) => {
2358
+ assert(typeof str === "string", `stringToUTF8Array expects a string (got ${typeof str})`);
2359
+ // Parameter maxBytesToWrite is not optional. Negative values, 0, null,
2360
+ // undefined and false each don't write out any bytes.
2361
+ if (!(maxBytesToWrite > 0)) return 0;
2362
+ var startIdx = outIdx;
2363
+ var endIdx = outIdx + maxBytesToWrite - 1;
2364
+ // -1 for string null terminator.
2365
+ for (var i = 0; i < str.length; ++i) {
2366
+ // Gotcha: charCodeAt returns a 16-bit word that is a UTF-16 encoded code
2367
+ // unit, not a Unicode code point of the character! So decode
2368
+ // UTF16->UTF32->UTF8.
2369
+ // See http://unicode.org/faq/utf_bom.html#utf16-3
2370
+ // For UTF8 byte structure, see http://en.wikipedia.org/wiki/UTF-8#Description
2371
+ // and https://www.ietf.org/rfc/rfc2279.txt
2372
+ // and https://tools.ietf.org/html/rfc3629
2373
+ var u = str.charCodeAt(i);
2374
+ // possibly a lead surrogate
2375
+ if (u >= 55296 && u <= 57343) {
2376
+ var u1 = str.charCodeAt(++i);
2377
+ u = 65536 + ((u & 1023) << 10) | (u1 & 1023);
2378
+ }
2379
+ if (u <= 127) {
2380
+ if (outIdx >= endIdx) break;
2381
+ heap[outIdx++] = u;
2382
+ } else if (u <= 2047) {
2383
+ if (outIdx + 1 >= endIdx) break;
2384
+ heap[outIdx++] = 192 | (u >> 6);
2385
+ heap[outIdx++] = 128 | (u & 63);
2386
+ } else if (u <= 65535) {
2387
+ if (outIdx + 2 >= endIdx) break;
2388
+ heap[outIdx++] = 224 | (u >> 12);
2389
+ heap[outIdx++] = 128 | ((u >> 6) & 63);
2390
+ heap[outIdx++] = 128 | (u & 63);
2391
+ } else {
2392
+ if (outIdx + 3 >= endIdx) break;
2393
+ 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).");
2394
+ heap[outIdx++] = 240 | (u >> 18);
2395
+ heap[outIdx++] = 128 | ((u >> 12) & 63);
2396
+ heap[outIdx++] = 128 | ((u >> 6) & 63);
2397
+ heap[outIdx++] = 128 | (u & 63);
2398
+ }
2399
+ }
2400
+ // Null-terminate the pointer to the buffer.
2401
+ heap[outIdx] = 0;
2402
+ return outIdx - startIdx;
2403
+ };
2404
+
2405
+ var stringToUTF8 = (str, outPtr, maxBytesToWrite) => {
2406
+ assert(typeof maxBytesToWrite == "number", "stringToUTF8(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!");
2407
+ return stringToUTF8Array(str, HEAPU8, outPtr, maxBytesToWrite);
2408
+ };
2409
+
2410
+ var stackAlloc = sz => __emscripten_stack_alloc(sz);
2411
+
2412
+ var stringToUTF8OnStack = str => {
2413
+ var size = lengthBytesUTF8(str) + 1;
2414
+ var ret = stackAlloc(size);
2415
+ stringToUTF8(str, ret, size);
2416
+ return ret;
2417
+ };
2418
+
2419
+ var AsciiToString = ptr => {
2420
+ var str = "";
2421
+ while (1) {
2422
+ var ch = SAFE_HEAP_LOAD(ptr++, 1, 1);
2423
+ if (!ch) return str;
2424
+ str += String.fromCharCode(ch);
2425
+ }
2426
+ };
2427
+
2428
+ var stringToUTF16 = (str, outPtr, maxBytesToWrite) => {
2429
+ assert(outPtr % 2 == 0, "Pointer passed to stringToUTF16 must be aligned to two bytes!");
2430
+ assert(typeof maxBytesToWrite == "number", "stringToUTF16(str, outPtr, maxBytesToWrite) is missing the third parameter that specifies the length of the output buffer!");
2431
+ // Backwards compatibility: if max bytes is not specified, assume unsafe unbounded write is allowed.
2432
+ maxBytesToWrite ??= 2147483647;
2433
+ if (maxBytesToWrite < 2) return 0;
2434
+ maxBytesToWrite -= 2;
2435
+ // Null terminator.
2436
+ var startPtr = outPtr;
2437
+ var numCharsToWrite = (maxBytesToWrite < str.length * 2) ? (maxBytesToWrite / 2) : str.length;
2438
+ for (var i = 0; i < numCharsToWrite; ++i) {
2439
+ // charCodeAt returns a UTF-16 encoded code unit, so it can be directly written to the HEAP.
2440
+ var codeUnit = str.charCodeAt(i);
2441
+ // possibly a lead surrogate
2442
+ LE_HEAP_STORE_I16(((outPtr) >> 1) * 2, codeUnit);
2443
+ outPtr += 2;
2444
+ }
2445
+ // Null-terminate the pointer to the HEAP.
2446
+ LE_HEAP_STORE_I16(((outPtr) >> 1) * 2, 0);
2447
+ return outPtr - startPtr;
2448
+ };
2449
+
2450
+ function checkIncomingModuleAPI() {
2451
+ ignoredModuleProp("fetchSettings");
2452
+ }
2453
+
2454
+ var wasmImports = {
2455
+ /** @export */ __heap_base: ___heap_base,
2456
+ /** @export */ __indirect_function_table: wasmTable,
2457
+ /** @export */ __memory_base: ___memory_base,
2458
+ /** @export */ __stack_high: ___stack_high,
2459
+ /** @export */ __stack_low: ___stack_low,
2460
+ /** @export */ __stack_pointer: ___stack_pointer,
2461
+ /** @export */ __table_base: ___table_base,
2462
+ /** @export */ _abort_js: __abort_js,
2463
+ /** @export */ alignfault,
2464
+ /** @export */ clock_time_get: _clock_time_get,
2465
+ /** @export */ emscripten_resize_heap: _emscripten_resize_heap,
2466
+ /** @export */ fd_close: _fd_close,
2467
+ /** @export */ fd_seek: _fd_seek,
2468
+ /** @export */ fd_write: _fd_write,
2469
+ /** @export */ memory: wasmMemory,
2470
+ /** @export */ segfault,
2471
+ /** @export */ tree_sitter_log_callback: _tree_sitter_log_callback,
2472
+ /** @export */ tree_sitter_parse_callback: _tree_sitter_parse_callback,
2473
+ /** @export */ tree_sitter_progress_callback: _tree_sitter_progress_callback,
2474
+ /** @export */ tree_sitter_query_progress_callback: _tree_sitter_query_progress_callback
2475
+ };
2476
+
2477
+ var wasmExports = await createWasm();
2478
+
2479
+ var ___wasm_call_ctors = createExportWrapper("__wasm_call_ctors", 0);
2480
+
2481
+ var _malloc = Module["_malloc"] = createExportWrapper("malloc", 1);
2482
+
2483
+ var _calloc = Module["_calloc"] = createExportWrapper("calloc", 2);
2484
+
2485
+ var _realloc = Module["_realloc"] = createExportWrapper("realloc", 2);
2486
+
2487
+ var _free = Module["_free"] = createExportWrapper("free", 1);
2488
+
2489
+ var _ts_language_symbol_count = Module["_ts_language_symbol_count"] = createExportWrapper("ts_language_symbol_count", 1);
2490
+
2491
+ var _ts_language_state_count = Module["_ts_language_state_count"] = createExportWrapper("ts_language_state_count", 1);
2492
+
2493
+ var _ts_language_version = Module["_ts_language_version"] = createExportWrapper("ts_language_version", 1);
2494
+
2495
+ var _ts_language_abi_version = Module["_ts_language_abi_version"] = createExportWrapper("ts_language_abi_version", 1);
2496
+
2497
+ var _ts_language_metadata = Module["_ts_language_metadata"] = createExportWrapper("ts_language_metadata", 1);
2498
+
2499
+ var _ts_language_name = Module["_ts_language_name"] = createExportWrapper("ts_language_name", 1);
2500
+
2501
+ var _ts_language_field_count = Module["_ts_language_field_count"] = createExportWrapper("ts_language_field_count", 1);
2502
+
2503
+ var _ts_language_next_state = Module["_ts_language_next_state"] = createExportWrapper("ts_language_next_state", 3);
2504
+
2505
+ var _ts_language_symbol_name = Module["_ts_language_symbol_name"] = createExportWrapper("ts_language_symbol_name", 2);
2506
+
2507
+ var _ts_language_symbol_for_name = Module["_ts_language_symbol_for_name"] = createExportWrapper("ts_language_symbol_for_name", 4);
2508
+
2509
+ var _strncmp = Module["_strncmp"] = createExportWrapper("strncmp", 3);
2510
+
2511
+ var _ts_language_symbol_type = Module["_ts_language_symbol_type"] = createExportWrapper("ts_language_symbol_type", 2);
2512
+
2513
+ var _ts_language_field_name_for_id = Module["_ts_language_field_name_for_id"] = createExportWrapper("ts_language_field_name_for_id", 2);
2514
+
2515
+ var _ts_lookahead_iterator_new = Module["_ts_lookahead_iterator_new"] = createExportWrapper("ts_lookahead_iterator_new", 2);
2516
+
2517
+ var _ts_lookahead_iterator_delete = Module["_ts_lookahead_iterator_delete"] = createExportWrapper("ts_lookahead_iterator_delete", 1);
2518
+
2519
+ var _ts_lookahead_iterator_reset_state = Module["_ts_lookahead_iterator_reset_state"] = createExportWrapper("ts_lookahead_iterator_reset_state", 2);
2520
+
2521
+ var _ts_lookahead_iterator_reset = Module["_ts_lookahead_iterator_reset"] = createExportWrapper("ts_lookahead_iterator_reset", 3);
2522
+
2523
+ var _ts_lookahead_iterator_next = Module["_ts_lookahead_iterator_next"] = createExportWrapper("ts_lookahead_iterator_next", 1);
2524
+
2525
+ var _ts_lookahead_iterator_current_symbol = Module["_ts_lookahead_iterator_current_symbol"] = createExportWrapper("ts_lookahead_iterator_current_symbol", 1);
2526
+
2527
+ var _ts_parser_delete = Module["_ts_parser_delete"] = createExportWrapper("ts_parser_delete", 1);
2528
+
2529
+ var _ts_parser_set_language = Module["_ts_parser_set_language"] = createExportWrapper("ts_parser_set_language", 2);
2530
+
2531
+ var _ts_parser_reset = Module["_ts_parser_reset"] = createExportWrapper("ts_parser_reset", 1);
2532
+
2533
+ var _ts_parser_timeout_micros = Module["_ts_parser_timeout_micros"] = createExportWrapper("ts_parser_timeout_micros", 1);
2534
+
2535
+ var _ts_parser_set_timeout_micros = Module["_ts_parser_set_timeout_micros"] = createExportWrapper("ts_parser_set_timeout_micros", 2);
2536
+
2537
+ var _ts_parser_set_included_ranges = Module["_ts_parser_set_included_ranges"] = createExportWrapper("ts_parser_set_included_ranges", 3);
2538
+
2539
+ var _ts_query_new = Module["_ts_query_new"] = createExportWrapper("ts_query_new", 5);
2540
+
2541
+ var _ts_query_delete = Module["_ts_query_delete"] = createExportWrapper("ts_query_delete", 1);
2542
+
2543
+ var _iswspace = Module["_iswspace"] = createExportWrapper("iswspace", 1);
2544
+
2545
+ var _ts_query_pattern_count = Module["_ts_query_pattern_count"] = createExportWrapper("ts_query_pattern_count", 1);
2546
+
2547
+ var _ts_query_capture_count = Module["_ts_query_capture_count"] = createExportWrapper("ts_query_capture_count", 1);
2548
+
2549
+ var _ts_query_string_count = Module["_ts_query_string_count"] = createExportWrapper("ts_query_string_count", 1);
2550
+
2551
+ var _ts_query_capture_name_for_id = Module["_ts_query_capture_name_for_id"] = createExportWrapper("ts_query_capture_name_for_id", 3);
2552
+
2553
+ var _ts_query_capture_quantifier_for_id = Module["_ts_query_capture_quantifier_for_id"] = createExportWrapper("ts_query_capture_quantifier_for_id", 3);
2554
+
2555
+ var _ts_query_string_value_for_id = Module["_ts_query_string_value_for_id"] = createExportWrapper("ts_query_string_value_for_id", 3);
2556
+
2557
+ var _ts_query_predicates_for_pattern = Module["_ts_query_predicates_for_pattern"] = createExportWrapper("ts_query_predicates_for_pattern", 3);
2558
+
2559
+ var _ts_query_start_byte_for_pattern = Module["_ts_query_start_byte_for_pattern"] = createExportWrapper("ts_query_start_byte_for_pattern", 2);
2560
+
2561
+ var _ts_query_end_byte_for_pattern = Module["_ts_query_end_byte_for_pattern"] = createExportWrapper("ts_query_end_byte_for_pattern", 2);
2562
+
2563
+ var _ts_query_is_pattern_rooted = Module["_ts_query_is_pattern_rooted"] = createExportWrapper("ts_query_is_pattern_rooted", 2);
2564
+
2565
+ var _ts_query_is_pattern_non_local = Module["_ts_query_is_pattern_non_local"] = createExportWrapper("ts_query_is_pattern_non_local", 2);
2566
+
2567
+ var _ts_query_is_pattern_guaranteed_at_step = Module["_ts_query_is_pattern_guaranteed_at_step"] = createExportWrapper("ts_query_is_pattern_guaranteed_at_step", 2);
2568
+
2569
+ var _ts_query_disable_capture = Module["_ts_query_disable_capture"] = createExportWrapper("ts_query_disable_capture", 3);
2570
+
2571
+ var _ts_query_disable_pattern = Module["_ts_query_disable_pattern"] = createExportWrapper("ts_query_disable_pattern", 2);
2572
+
2573
+ var _memcmp = Module["_memcmp"] = createExportWrapper("memcmp", 3);
2574
+
2575
+ var _ts_tree_copy = Module["_ts_tree_copy"] = createExportWrapper("ts_tree_copy", 1);
2576
+
2577
+ var _ts_tree_delete = Module["_ts_tree_delete"] = createExportWrapper("ts_tree_delete", 1);
2578
+
2579
+ var _iswalnum = Module["_iswalnum"] = createExportWrapper("iswalnum", 1);
2580
+
2581
+ var _ts_init = Module["_ts_init"] = createExportWrapper("ts_init", 0);
2582
+
2583
+ var _ts_parser_new_wasm = Module["_ts_parser_new_wasm"] = createExportWrapper("ts_parser_new_wasm", 0);
2584
+
2585
+ var _ts_parser_enable_logger_wasm = Module["_ts_parser_enable_logger_wasm"] = createExportWrapper("ts_parser_enable_logger_wasm", 2);
2586
+
2587
+ var _ts_parser_parse_wasm = Module["_ts_parser_parse_wasm"] = createExportWrapper("ts_parser_parse_wasm", 5);
2588
+
2589
+ var _ts_parser_included_ranges_wasm = Module["_ts_parser_included_ranges_wasm"] = createExportWrapper("ts_parser_included_ranges_wasm", 1);
2590
+
2591
+ var _ts_language_type_is_named_wasm = Module["_ts_language_type_is_named_wasm"] = createExportWrapper("ts_language_type_is_named_wasm", 2);
2592
+
2593
+ var _ts_language_type_is_visible_wasm = Module["_ts_language_type_is_visible_wasm"] = createExportWrapper("ts_language_type_is_visible_wasm", 2);
2594
+
2595
+ var _ts_language_supertypes_wasm = Module["_ts_language_supertypes_wasm"] = createExportWrapper("ts_language_supertypes_wasm", 1);
2596
+
2597
+ var _ts_language_subtypes_wasm = Module["_ts_language_subtypes_wasm"] = createExportWrapper("ts_language_subtypes_wasm", 2);
2598
+
2599
+ var _ts_tree_root_node_wasm = Module["_ts_tree_root_node_wasm"] = createExportWrapper("ts_tree_root_node_wasm", 1);
2600
+
2601
+ var _ts_tree_root_node_with_offset_wasm = Module["_ts_tree_root_node_with_offset_wasm"] = createExportWrapper("ts_tree_root_node_with_offset_wasm", 1);
2602
+
2603
+ var _ts_tree_edit_wasm = Module["_ts_tree_edit_wasm"] = createExportWrapper("ts_tree_edit_wasm", 1);
2604
+
2605
+ var _ts_tree_included_ranges_wasm = Module["_ts_tree_included_ranges_wasm"] = createExportWrapper("ts_tree_included_ranges_wasm", 1);
2606
+
2607
+ var _ts_tree_get_changed_ranges_wasm = Module["_ts_tree_get_changed_ranges_wasm"] = createExportWrapper("ts_tree_get_changed_ranges_wasm", 2);
2608
+
2609
+ var _ts_tree_cursor_new_wasm = Module["_ts_tree_cursor_new_wasm"] = createExportWrapper("ts_tree_cursor_new_wasm", 1);
2610
+
2611
+ var _ts_tree_cursor_copy_wasm = Module["_ts_tree_cursor_copy_wasm"] = createExportWrapper("ts_tree_cursor_copy_wasm", 1);
2612
+
2613
+ var _ts_tree_cursor_delete_wasm = Module["_ts_tree_cursor_delete_wasm"] = createExportWrapper("ts_tree_cursor_delete_wasm", 1);
2614
+
2615
+ var _ts_tree_cursor_reset_wasm = Module["_ts_tree_cursor_reset_wasm"] = createExportWrapper("ts_tree_cursor_reset_wasm", 1);
2616
+
2617
+ var _ts_tree_cursor_reset_to_wasm = Module["_ts_tree_cursor_reset_to_wasm"] = createExportWrapper("ts_tree_cursor_reset_to_wasm", 2);
2618
+
2619
+ var _ts_tree_cursor_goto_first_child_wasm = Module["_ts_tree_cursor_goto_first_child_wasm"] = createExportWrapper("ts_tree_cursor_goto_first_child_wasm", 1);
2620
+
2621
+ var _ts_tree_cursor_goto_last_child_wasm = Module["_ts_tree_cursor_goto_last_child_wasm"] = createExportWrapper("ts_tree_cursor_goto_last_child_wasm", 1);
2622
+
2623
+ var _ts_tree_cursor_goto_first_child_for_index_wasm = Module["_ts_tree_cursor_goto_first_child_for_index_wasm"] = createExportWrapper("ts_tree_cursor_goto_first_child_for_index_wasm", 1);
2624
+
2625
+ var _ts_tree_cursor_goto_first_child_for_position_wasm = Module["_ts_tree_cursor_goto_first_child_for_position_wasm"] = createExportWrapper("ts_tree_cursor_goto_first_child_for_position_wasm", 1);
2626
+
2627
+ var _ts_tree_cursor_goto_next_sibling_wasm = Module["_ts_tree_cursor_goto_next_sibling_wasm"] = createExportWrapper("ts_tree_cursor_goto_next_sibling_wasm", 1);
2628
+
2629
+ var _ts_tree_cursor_goto_previous_sibling_wasm = Module["_ts_tree_cursor_goto_previous_sibling_wasm"] = createExportWrapper("ts_tree_cursor_goto_previous_sibling_wasm", 1);
2630
+
2631
+ var _ts_tree_cursor_goto_descendant_wasm = Module["_ts_tree_cursor_goto_descendant_wasm"] = createExportWrapper("ts_tree_cursor_goto_descendant_wasm", 2);
2632
+
2633
+ var _ts_tree_cursor_goto_parent_wasm = Module["_ts_tree_cursor_goto_parent_wasm"] = createExportWrapper("ts_tree_cursor_goto_parent_wasm", 1);
2634
+
2635
+ var _ts_tree_cursor_current_node_type_id_wasm = Module["_ts_tree_cursor_current_node_type_id_wasm"] = createExportWrapper("ts_tree_cursor_current_node_type_id_wasm", 1);
2636
+
2637
+ var _ts_tree_cursor_current_node_state_id_wasm = Module["_ts_tree_cursor_current_node_state_id_wasm"] = createExportWrapper("ts_tree_cursor_current_node_state_id_wasm", 1);
2638
+
2639
+ var _ts_tree_cursor_current_node_is_named_wasm = Module["_ts_tree_cursor_current_node_is_named_wasm"] = createExportWrapper("ts_tree_cursor_current_node_is_named_wasm", 1);
2640
+
2641
+ var _ts_tree_cursor_current_node_is_missing_wasm = Module["_ts_tree_cursor_current_node_is_missing_wasm"] = createExportWrapper("ts_tree_cursor_current_node_is_missing_wasm", 1);
2642
+
2643
+ var _ts_tree_cursor_current_node_id_wasm = Module["_ts_tree_cursor_current_node_id_wasm"] = createExportWrapper("ts_tree_cursor_current_node_id_wasm", 1);
2644
+
2645
+ var _ts_tree_cursor_start_position_wasm = Module["_ts_tree_cursor_start_position_wasm"] = createExportWrapper("ts_tree_cursor_start_position_wasm", 1);
2646
+
2647
+ var _ts_tree_cursor_end_position_wasm = Module["_ts_tree_cursor_end_position_wasm"] = createExportWrapper("ts_tree_cursor_end_position_wasm", 1);
2648
+
2649
+ var _ts_tree_cursor_start_index_wasm = Module["_ts_tree_cursor_start_index_wasm"] = createExportWrapper("ts_tree_cursor_start_index_wasm", 1);
2650
+
2651
+ var _ts_tree_cursor_end_index_wasm = Module["_ts_tree_cursor_end_index_wasm"] = createExportWrapper("ts_tree_cursor_end_index_wasm", 1);
2652
+
2653
+ var _ts_tree_cursor_current_field_id_wasm = Module["_ts_tree_cursor_current_field_id_wasm"] = createExportWrapper("ts_tree_cursor_current_field_id_wasm", 1);
2654
+
2655
+ var _ts_tree_cursor_current_depth_wasm = Module["_ts_tree_cursor_current_depth_wasm"] = createExportWrapper("ts_tree_cursor_current_depth_wasm", 1);
2656
+
2657
+ var _ts_tree_cursor_current_descendant_index_wasm = Module["_ts_tree_cursor_current_descendant_index_wasm"] = createExportWrapper("ts_tree_cursor_current_descendant_index_wasm", 1);
2658
+
2659
+ var _ts_tree_cursor_current_node_wasm = Module["_ts_tree_cursor_current_node_wasm"] = createExportWrapper("ts_tree_cursor_current_node_wasm", 1);
2660
+
2661
+ var _ts_node_symbol_wasm = Module["_ts_node_symbol_wasm"] = createExportWrapper("ts_node_symbol_wasm", 1);
2662
+
2663
+ var _ts_node_field_name_for_child_wasm = Module["_ts_node_field_name_for_child_wasm"] = createExportWrapper("ts_node_field_name_for_child_wasm", 2);
2664
+
2665
+ var _ts_node_field_name_for_named_child_wasm = Module["_ts_node_field_name_for_named_child_wasm"] = createExportWrapper("ts_node_field_name_for_named_child_wasm", 2);
2666
+
2667
+ var _ts_node_children_by_field_id_wasm = Module["_ts_node_children_by_field_id_wasm"] = createExportWrapper("ts_node_children_by_field_id_wasm", 2);
2668
+
2669
+ var _ts_node_first_child_for_byte_wasm = Module["_ts_node_first_child_for_byte_wasm"] = createExportWrapper("ts_node_first_child_for_byte_wasm", 1);
2670
+
2671
+ var _ts_node_first_named_child_for_byte_wasm = Module["_ts_node_first_named_child_for_byte_wasm"] = createExportWrapper("ts_node_first_named_child_for_byte_wasm", 1);
2672
+
2673
+ var _ts_node_grammar_symbol_wasm = Module["_ts_node_grammar_symbol_wasm"] = createExportWrapper("ts_node_grammar_symbol_wasm", 1);
2674
+
2675
+ var _ts_node_child_count_wasm = Module["_ts_node_child_count_wasm"] = createExportWrapper("ts_node_child_count_wasm", 1);
2676
+
2677
+ var _ts_node_named_child_count_wasm = Module["_ts_node_named_child_count_wasm"] = createExportWrapper("ts_node_named_child_count_wasm", 1);
2678
+
2679
+ var _ts_node_child_wasm = Module["_ts_node_child_wasm"] = createExportWrapper("ts_node_child_wasm", 2);
2680
+
2681
+ var _ts_node_named_child_wasm = Module["_ts_node_named_child_wasm"] = createExportWrapper("ts_node_named_child_wasm", 2);
2682
+
2683
+ var _ts_node_child_by_field_id_wasm = Module["_ts_node_child_by_field_id_wasm"] = createExportWrapper("ts_node_child_by_field_id_wasm", 2);
2684
+
2685
+ var _ts_node_next_sibling_wasm = Module["_ts_node_next_sibling_wasm"] = createExportWrapper("ts_node_next_sibling_wasm", 1);
2686
+
2687
+ var _ts_node_prev_sibling_wasm = Module["_ts_node_prev_sibling_wasm"] = createExportWrapper("ts_node_prev_sibling_wasm", 1);
2688
+
2689
+ var _ts_node_next_named_sibling_wasm = Module["_ts_node_next_named_sibling_wasm"] = createExportWrapper("ts_node_next_named_sibling_wasm", 1);
2690
+
2691
+ var _ts_node_prev_named_sibling_wasm = Module["_ts_node_prev_named_sibling_wasm"] = createExportWrapper("ts_node_prev_named_sibling_wasm", 1);
2692
+
2693
+ var _ts_node_descendant_count_wasm = Module["_ts_node_descendant_count_wasm"] = createExportWrapper("ts_node_descendant_count_wasm", 1);
2694
+
2695
+ var _ts_node_parent_wasm = Module["_ts_node_parent_wasm"] = createExportWrapper("ts_node_parent_wasm", 1);
2696
+
2697
+ var _ts_node_child_with_descendant_wasm = Module["_ts_node_child_with_descendant_wasm"] = createExportWrapper("ts_node_child_with_descendant_wasm", 1);
2698
+
2699
+ var _ts_node_descendant_for_index_wasm = Module["_ts_node_descendant_for_index_wasm"] = createExportWrapper("ts_node_descendant_for_index_wasm", 1);
2700
+
2701
+ var _ts_node_named_descendant_for_index_wasm = Module["_ts_node_named_descendant_for_index_wasm"] = createExportWrapper("ts_node_named_descendant_for_index_wasm", 1);
2702
+
2703
+ var _ts_node_descendant_for_position_wasm = Module["_ts_node_descendant_for_position_wasm"] = createExportWrapper("ts_node_descendant_for_position_wasm", 1);
2704
+
2705
+ var _ts_node_named_descendant_for_position_wasm = Module["_ts_node_named_descendant_for_position_wasm"] = createExportWrapper("ts_node_named_descendant_for_position_wasm", 1);
2706
+
2707
+ var _ts_node_start_point_wasm = Module["_ts_node_start_point_wasm"] = createExportWrapper("ts_node_start_point_wasm", 1);
2708
+
2709
+ var _ts_node_end_point_wasm = Module["_ts_node_end_point_wasm"] = createExportWrapper("ts_node_end_point_wasm", 1);
2710
+
2711
+ var _ts_node_start_index_wasm = Module["_ts_node_start_index_wasm"] = createExportWrapper("ts_node_start_index_wasm", 1);
2712
+
2713
+ var _ts_node_end_index_wasm = Module["_ts_node_end_index_wasm"] = createExportWrapper("ts_node_end_index_wasm", 1);
2714
+
2715
+ var _ts_node_to_string_wasm = Module["_ts_node_to_string_wasm"] = createExportWrapper("ts_node_to_string_wasm", 1);
2716
+
2717
+ var _ts_node_children_wasm = Module["_ts_node_children_wasm"] = createExportWrapper("ts_node_children_wasm", 1);
2718
+
2719
+ var _ts_node_named_children_wasm = Module["_ts_node_named_children_wasm"] = createExportWrapper("ts_node_named_children_wasm", 1);
2720
+
2721
+ var _ts_node_descendants_of_type_wasm = Module["_ts_node_descendants_of_type_wasm"] = createExportWrapper("ts_node_descendants_of_type_wasm", 7);
2722
+
2723
+ var _ts_node_is_named_wasm = Module["_ts_node_is_named_wasm"] = createExportWrapper("ts_node_is_named_wasm", 1);
2724
+
2725
+ var _ts_node_has_changes_wasm = Module["_ts_node_has_changes_wasm"] = createExportWrapper("ts_node_has_changes_wasm", 1);
2726
+
2727
+ var _ts_node_has_error_wasm = Module["_ts_node_has_error_wasm"] = createExportWrapper("ts_node_has_error_wasm", 1);
2728
+
2729
+ var _ts_node_is_error_wasm = Module["_ts_node_is_error_wasm"] = createExportWrapper("ts_node_is_error_wasm", 1);
2730
+
2731
+ var _ts_node_is_missing_wasm = Module["_ts_node_is_missing_wasm"] = createExportWrapper("ts_node_is_missing_wasm", 1);
2732
+
2733
+ var _ts_node_is_extra_wasm = Module["_ts_node_is_extra_wasm"] = createExportWrapper("ts_node_is_extra_wasm", 1);
2734
+
2735
+ var _ts_node_parse_state_wasm = Module["_ts_node_parse_state_wasm"] = createExportWrapper("ts_node_parse_state_wasm", 1);
2736
+
2737
+ var _ts_node_next_parse_state_wasm = Module["_ts_node_next_parse_state_wasm"] = createExportWrapper("ts_node_next_parse_state_wasm", 1);
2738
+
2739
+ var _ts_query_matches_wasm = Module["_ts_query_matches_wasm"] = createExportWrapper("ts_query_matches_wasm", 11);
2740
+
2741
+ var _ts_query_captures_wasm = Module["_ts_query_captures_wasm"] = createExportWrapper("ts_query_captures_wasm", 11);
2742
+
2743
+ var _memset = Module["_memset"] = createExportWrapper("memset", 3);
2744
+
2745
+ var _memcpy = Module["_memcpy"] = createExportWrapper("memcpy", 3);
2746
+
2747
+ var _memmove = Module["_memmove"] = createExportWrapper("memmove", 3);
2748
+
2749
+ var _fflush = createExportWrapper("fflush", 1);
2750
+
2751
+ var _strlen = Module["_strlen"] = createExportWrapper("strlen", 1);
2752
+
2753
+ var _iswalpha = Module["_iswalpha"] = createExportWrapper("iswalpha", 1);
2754
+
2755
+ var _iswblank = Module["_iswblank"] = createExportWrapper("iswblank", 1);
2756
+
2757
+ var _iswdigit = Module["_iswdigit"] = createExportWrapper("iswdigit", 1);
2758
+
2759
+ var _iswlower = Module["_iswlower"] = createExportWrapper("iswlower", 1);
2760
+
2761
+ var _iswupper = Module["_iswupper"] = createExportWrapper("iswupper", 1);
2762
+
2763
+ var _iswxdigit = Module["_iswxdigit"] = createExportWrapper("iswxdigit", 1);
2764
+
2765
+ var _memchr = Module["_memchr"] = createExportWrapper("memchr", 3);
2766
+
2767
+ var _strcmp = Module["_strcmp"] = createExportWrapper("strcmp", 2);
2768
+
2769
+ var _strncat = Module["_strncat"] = createExportWrapper("strncat", 3);
2770
+
2771
+ var _strncpy = Module["_strncpy"] = createExportWrapper("strncpy", 3);
2772
+
2773
+ var _towlower = Module["_towlower"] = createExportWrapper("towlower", 1);
2774
+
2775
+ var _towupper = Module["_towupper"] = createExportWrapper("towupper", 1);
2776
+
2777
+ var _sbrk = createExportWrapper("sbrk", 1);
2778
+
2779
+ var _emscripten_get_sbrk_ptr = createExportWrapper("emscripten_get_sbrk_ptr", 0);
2780
+
2781
+ var _setThrew = createExportWrapper("setThrew", 2);
2782
+
2783
+ var _emscripten_stack_set_limits = wasmExports["emscripten_stack_set_limits"];
2784
+
2785
+ var _emscripten_stack_get_free = wasmExports["emscripten_stack_get_free"];
2786
+
2787
+ var _emscripten_stack_get_base = wasmExports["emscripten_stack_get_base"];
2788
+
2789
+ var _emscripten_stack_get_end = wasmExports["emscripten_stack_get_end"];
2790
+
2791
+ var __emscripten_stack_restore = wasmExports["_emscripten_stack_restore"];
2792
+
2793
+ var __emscripten_stack_alloc = wasmExports["_emscripten_stack_alloc"];
2794
+
2795
+ var _emscripten_stack_get_current = wasmExports["emscripten_stack_get_current"];
2796
+
2797
+ var ___wasm_apply_data_relocs = createExportWrapper("__wasm_apply_data_relocs", 0);
2798
+
2799
+ // include: postamble.js
2800
+ // === Auto-generated postamble setup entry stuff ===
2801
+ Module["setValue"] = setValue;
2802
+
2803
+ Module["getValue"] = getValue;
2804
+
2805
+ Module["UTF8ToString"] = UTF8ToString;
2806
+
2807
+ Module["stringToUTF8"] = stringToUTF8;
2808
+
2809
+ Module["lengthBytesUTF8"] = lengthBytesUTF8;
2810
+
2811
+ Module["AsciiToString"] = AsciiToString;
2812
+
2813
+ Module["stringToUTF16"] = stringToUTF16;
2814
+
2815
+ Module["loadWebAssemblyModule"] = loadWebAssemblyModule;
2816
+
2817
+ var missingLibrarySymbols = [ "writeI53ToI64", "writeI53ToI64Clamped", "writeI53ToI64Signaling", "writeI53ToU64Clamped", "writeI53ToU64Signaling", "readI53FromI64", "readI53FromU64", "convertI32PairToI53", "convertI32PairToI53Checked", "convertU32PairToI53", "getTempRet0", "setTempRet0", "zeroMemory", "strError", "inetPton4", "inetNtop4", "inetPton6", "inetNtop6", "readSockaddr", "writeSockaddr", "emscriptenLog", "readEmAsmArgs", "runEmAsmFunction", "runMainThreadEmAsm", "jstoi_q", "getExecutableName", "listenOnce", "autoResumeAudioContext", "getDynCaller", "runtimeKeepalivePush", "runtimeKeepalivePop", "callUserCallback", "maybeExit", "asmjsMangle", "mmapAlloc", "HandleAllocator", "getNativeTypeSize", "addOnInit", "addOnPreMain", "addOnExit", "STACK_SIZE", "STACK_ALIGN", "POINTER_SIZE", "ASSERTIONS", "getCFunc", "ccall", "cwrap", "removeFunction", "reallyNegative", "strLen", "reSign", "formatString", "intArrayFromString", "intArrayToString", "stringToAscii", "UTF16ToString", "lengthBytesUTF16", "UTF32ToString", "stringToUTF32", "lengthBytesUTF32", "stringToNewUTF8", "writeArrayToMemory", "registerKeyEventCallback", "maybeCStringToJsString", "findEventTarget", "getBoundingClientRect", "fillMouseEventData", "registerMouseEventCallback", "registerWheelEventCallback", "registerUiEventCallback", "registerFocusEventCallback", "fillDeviceOrientationEventData", "registerDeviceOrientationEventCallback", "fillDeviceMotionEventData", "registerDeviceMotionEventCallback", "screenOrientation", "fillOrientationChangeEventData", "registerOrientationChangeEventCallback", "fillFullscreenChangeEventData", "registerFullscreenChangeEventCallback", "JSEvents_requestFullscreen", "JSEvents_resizeCanvasForFullscreen", "registerRestoreOldStyle", "hideEverythingExceptGivenElement", "restoreHiddenElements", "setLetterbox", "softFullscreenResizeWebGLRenderTarget", "doRequestFullscreen", "fillPointerlockChangeEventData", "registerPointerlockChangeEventCallback", "registerPointerlockErrorEventCallback", "requestPointerLock", "fillVisibilityChangeEventData", "registerVisibilityChangeEventCallback", "registerTouchEventCallback", "fillGamepadEventData", "registerGamepadEventCallback", "registerBeforeUnloadEventCallback", "fillBatteryEventData", "battery", "registerBatteryEventCallback", "setCanvasElementSize", "getCanvasElementSize", "jsStackTrace", "getCallstack", "convertPCtoSourceLocation", "getEnvStrings", "wasiRightsToMuslOFlags", "wasiOFlagsToMuslOFlags", "initRandomFill", "randomFill", "safeSetTimeout", "setImmediateWrapped", "safeRequestAnimationFrame", "clearImmediateWrapped", "registerPostMainLoop", "registerPreMainLoop", "getPromise", "makePromise", "idsToPromises", "makePromiseCallback", "Browser_asyncPrepareDataCounter", "isLeapYear", "ydayFromDate", "arraySum", "addDays", "getSocketFromFD", "getSocketAddress", "dlopenInternal", "heapObjectForWebGLType", "toTypedArrayIndex", "webgl_enable_ANGLE_instanced_arrays", "webgl_enable_OES_vertex_array_object", "webgl_enable_WEBGL_draw_buffers", "webgl_enable_WEBGL_multi_draw", "webgl_enable_EXT_polygon_offset_clamp", "webgl_enable_EXT_clip_control", "webgl_enable_WEBGL_polygon_mode", "emscriptenWebGLGet", "computeUnpackAlignedImageSize", "colorChannelsInGlTextureFormat", "emscriptenWebGLGetTexPixelData", "emscriptenWebGLGetUniform", "webglGetUniformLocation", "webglPrepareUniformLocationsBeforeFirstUse", "webglGetLeftBracePos", "emscriptenWebGLGetVertexAttrib", "__glGetActiveAttribOrUniform", "writeGLArray", "registerWebGlEventCallback", "runAndAbortIfError", "ALLOC_NORMAL", "ALLOC_STACK", "allocate", "writeStringToMemory", "writeAsciiToMemory", "setErrNo", "demangle", "stackTrace" ];
2818
+
2819
+ missingLibrarySymbols.forEach(missingLibrarySymbol);
2820
+
2821
+ var unexportedSymbols = [ "run", "addRunDependency", "removeRunDependency", "out", "err", "callMain", "abort", "wasmMemory", "wasmExports", "writeStackCookie", "checkStackCookie", "INT53_MAX", "INT53_MIN", "bigintToI53Checked", "stackSave", "stackRestore", "stackAlloc", "ptrToString", "exitJS", "getHeapMax", "growMemory", "ENV", "ERRNO_CODES", "DNS", "Protocols", "Sockets", "timers", "warnOnce", "readEmAsmArgsArray", "jstoi_s", "dynCall", "handleException", "keepRuntimeAlive", "asyncLoad", "alignMemory", "wasmTable", "noExitRuntime", "addOnPreRun", "addOnPostCtor", "addOnPostRun", "uleb128Encode", "sigToWasmTypes", "generateFuncType", "convertJsFunctionToWasm", "freeTableIndexes", "functionsInTableMap", "getEmptyTableSlot", "updateTableMap", "getFunctionAddress", "addFunction", "unSign", "PATH", "PATH_FS", "UTF8Decoder", "UTF8ArrayToString", "stringToUTF8Array", "UTF16Decoder", "stringToUTF8OnStack", "JSEvents", "specialHTMLTargets", "findCanvasEventTarget", "currentFullscreenStrategy", "restoreOldWindowedStyle", "UNWIND_CACHE", "ExitStatus", "checkWasiClock", "flush_NO_FILESYSTEM", "emSetImmediate", "emClearImmediate_deps", "emClearImmediate", "promiseMap", "Browser", "getPreloadedImageData__data", "wget", "MONTH_DAYS_REGULAR", "MONTH_DAYS_LEAP", "MONTH_DAYS_REGULAR_CUMULATIVE", "MONTH_DAYS_LEAP_CUMULATIVE", "SYSCALLS", "isSymbolDefined", "GOT", "currentModuleWeakSymbols", "LDSO", "getMemory", "mergeLibSymbols", "newDSO", "loadDynamicLibrary", "tempFixedLengthArray", "miniTempWebGLFloatBuffers", "miniTempWebGLIntBuffers", "GL", "AL", "GLUT", "EGL", "GLEW", "IDBStore", "SDL", "SDL_gfx", "allocateUTF8", "allocateUTF8OnStack", "print", "printErr", "LE_HEAP_STORE_U16", "LE_HEAP_STORE_I16", "LE_HEAP_STORE_U32", "LE_HEAP_STORE_I32", "LE_HEAP_STORE_F32", "LE_HEAP_STORE_F64", "LE_HEAP_LOAD_U16", "LE_HEAP_LOAD_I16", "LE_HEAP_LOAD_U32", "LE_HEAP_LOAD_I32", "LE_HEAP_LOAD_F32", "LE_HEAP_LOAD_F64" ];
2822
+
2823
+ unexportedSymbols.forEach(unexportedRuntimeSymbol);
2824
+
2825
+ var calledRun;
2826
+
2827
+ function callMain(args = []) {
2828
+ assert(runDependencies == 0, 'cannot call main when async dependencies remain! (listen on Module["onRuntimeInitialized"])');
2829
+ assert(typeof onPreRuns === "undefined" || onPreRuns.length == 0, "cannot call main when preRun functions remain to be called");
2830
+ var entryFunction = resolveGlobalSymbol("main").sym;
2831
+ // Main modules can't tell if they have main() at compile time, since it may
2832
+ // arrive from a dynamic library.
2833
+ if (!entryFunction) return;
2834
+ args.unshift(thisProgram);
2835
+ var argc = args.length;
2836
+ var argv = stackAlloc((argc + 1) * 4);
2837
+ var argv_ptr = argv;
2838
+ args.forEach(arg => {
2839
+ LE_HEAP_STORE_U32(((argv_ptr) >> 2) * 4, stringToUTF8OnStack(arg));
2840
+ argv_ptr += 4;
2841
+ });
2842
+ LE_HEAP_STORE_U32(((argv_ptr) >> 2) * 4, 0);
2843
+ try {
2844
+ var ret = entryFunction(argc, argv);
2845
+ // if we're not running an evented main loop, it's time to exit
2846
+ exitJS(ret, /* implicit = */ true);
2847
+ return ret;
2848
+ } catch (e) {
2849
+ return handleException(e);
2850
+ }
2851
+ }
2852
+
2853
+ function stackCheckInit() {
2854
+ // This is normally called automatically during __wasm_call_ctors but need to
2855
+ // get these values before even running any of the ctors so we call it redundantly
2856
+ // here.
2857
+ _emscripten_stack_set_limits(78208, 12672);
2858
+ // TODO(sbc): Move writeStackCookie to native to to avoid this.
2859
+ writeStackCookie();
2860
+ }
2861
+
2862
+ function run(args = arguments_) {
2863
+ if (runDependencies > 0) {
2864
+ dependenciesFulfilled = run;
2865
+ return;
2866
+ }
2867
+ stackCheckInit();
2868
+ preRun();
2869
+ // a preRun added a dependency, run will be called later
2870
+ if (runDependencies > 0) {
2871
+ dependenciesFulfilled = run;
2872
+ return;
2873
+ }
2874
+ function doRun() {
2875
+ // run may have just been called through dependencies being fulfilled just in this very frame,
2876
+ // or while the async setStatus time below was happening
2877
+ assert(!calledRun);
2878
+ calledRun = true;
2879
+ Module["calledRun"] = true;
2880
+ if (ABORT) return;
2881
+ initRuntime();
2882
+ preMain();
2883
+ readyPromiseResolve(Module);
2884
+ Module["onRuntimeInitialized"]?.();
2885
+ consumedModuleProp("onRuntimeInitialized");
2886
+ var noInitialRun = Module["noInitialRun"];
2887
+ legacyModuleProp("noInitialRun", "noInitialRun");
2888
+ if (!noInitialRun) callMain(args);
2889
+ postRun();
2890
+ }
2891
+ if (Module["setStatus"]) {
2892
+ Module["setStatus"]("Running...");
2893
+ setTimeout(() => {
2894
+ setTimeout(() => Module["setStatus"](""), 1);
2895
+ doRun();
2896
+ }, 1);
2897
+ } else {
2898
+ doRun();
2899
+ }
2900
+ checkStackCookie();
2901
+ }
2902
+
2903
+ function checkUnflushedContent() {
2904
+ // Compiler settings do not allow exiting the runtime, so flushing
2905
+ // the streams is not possible. but in ASSERTIONS mode we check
2906
+ // if there was something to flush, and if so tell the user they
2907
+ // should request that the runtime be exitable.
2908
+ // Normally we would not even include flush() at all, but in ASSERTIONS
2909
+ // builds we do so just for this check, and here we see if there is any
2910
+ // content to flush, that is, we check if there would have been
2911
+ // something a non-ASSERTIONS build would have not seen.
2912
+ // How we flush the streams depends on whether we are in SYSCALLS_REQUIRE_FILESYSTEM=0
2913
+ // mode (which has its own special function for this; otherwise, all
2914
+ // the code is inside libc)
2915
+ var oldOut = out;
2916
+ var oldErr = err;
2917
+ var has = false;
2918
+ out = err = x => {
2919
+ has = true;
2920
+ };
2921
+ try {
2922
+ // it doesn't matter if it fails
2923
+ flush_NO_FILESYSTEM();
2924
+ } catch (e) {}
2925
+ out = oldOut;
2926
+ err = oldErr;
2927
+ if (has) {
2928
+ warnOnce("stdio streams had content in them that was not flushed. you should set EXIT_RUNTIME to 1 (see the Emscripten FAQ), or make sure to emit a newline when you printf etc.");
2929
+ warnOnce("(this may also be due to not including full filesystem support - try building with -sFORCE_FILESYSTEM)");
2930
+ }
2931
+ }
2932
+
2933
+ if (Module["preInit"]) {
2934
+ if (typeof Module["preInit"] == "function") Module["preInit"] = [ Module["preInit"] ];
2935
+ while (Module["preInit"].length > 0) {
2936
+ Module["preInit"].pop()();
2937
+ }
2938
+ }
2939
+
2940
+ consumedModuleProp("preInit");
2941
+
2942
+ run();
2943
+
2944
+ // end include: postamble.js
2945
+ // include: postamble_modularize.js
2946
+ // In MODULARIZE mode we wrap the generated code in a factory function
2947
+ // and return either the Module itself, or a promise of the module.
2948
+ // We assign to the `moduleRtn` global here and configure closure to see
2949
+ // this as and extern so it won't get minified.
2950
+ moduleRtn = readyPromise;
2951
+
2952
+ // Assertion for attempting to access module properties on the incoming
2953
+ // moduleArg. In the past we used this object as the prototype of the module
2954
+ // and assigned properties to it, but now we return a distinct object. This
2955
+ // keeps the instance private until it is ready (i.e the promise has been
2956
+ // resolved).
2957
+ for (const prop of Object.keys(Module)) {
2958
+ if (!(prop in moduleArg)) {
2959
+ Object.defineProperty(moduleArg, prop, {
2960
+ configurable: true,
2961
+ get() {
2962
+ abort(`Access to module property ('${prop}') is no longer possible via the module constructor argument; Instead, use the result of the module constructor.`);
2963
+ }
2964
+ });
2965
+ }
2966
+ }
2967
+
2968
+
2969
+ return moduleRtn;
2970
+ }
2971
+ );
2972
+ })();
2973
+ (() => {
2974
+ // Create a small, never-async wrapper around Module which
2975
+ // checks for callers incorrectly using it with `new`.
2976
+ var real_Module = Module;
2977
+ Module = function(arg) {
2978
+ if (new.target) throw new Error("Module() should not be called with `new Module()`");
2979
+ return real_Module(arg);
2980
+ }
2981
+ })();
2982
+ if (typeof exports === 'object' && typeof module === 'object') {
2983
+ module.exports = Module;
2984
+ // This default export looks redundant, but it allows TS to import this
2985
+ // commonjs style module.
2986
+ module.exports.default = Module;
2987
+ } else if (typeof define === 'function' && define['amd'])
2988
+ define([], () => Module);