web-tree-sitter
Version:
Tree-sitter bindings for the web
4 lines • 322 kB
Source Map (JSON)
{
"version": 3,
"sources": ["../lib/tree-sitter.cjs", "../src/index.ts", "../src/constants.ts", "../src/lookahead_iterator.ts", "../src/tree.ts", "../src/tree_cursor.ts", "../src/node.ts", "../src/marshal.ts", "../src/query.ts", "../src/language.ts", "../src/bindings.ts", "../src/parser.ts"],
"sourcesContent": ["var Module = (() => {\n var _scriptName = typeof document != 'undefined' ? document.currentScript?.src : undefined;\n if (typeof __filename != 'undefined') _scriptName = _scriptName || __filename;\n return (\nasync function(moduleArg = {}) {\n var moduleRtn;\n\n// include: shell.js\n// The Module object: Our interface to the outside world. We import\n// and export values on it. There are various ways Module can be used:\n// 1. Not defined. We create it here\n// 2. A function parameter, function(moduleArg) => Promise<Module>\n// 3. pre-run appended it, var Module = {}; ..generated code..\n// 4. External script tag defines var Module.\n// We need to check if Module already exists (e.g. case 3 above).\n// Substitution will be replaced with actual code on later stage of the build,\n// this way Closure Compiler will not mangle it (e.g. case 4. above).\n// Note that if you want to run closure, and also to use Module\n// after the generated code, you will need to define var Module = {};\n// before the code. Then that object will be used in the code, and you\n// can continue to use Module afterwards as well.\nvar Module = moduleArg;\n\n// Set up the promise that indicates the Module is initialized\nvar readyPromiseResolve, readyPromiseReject;\n\nvar readyPromise = new Promise((resolve, reject) => {\n readyPromiseResolve = resolve;\n readyPromiseReject = reject;\n});\n\n// Determine the runtime environment we are in. You can customize this by\n// setting the ENVIRONMENT setting at compile time (see settings.js).\n// Attempt to auto-detect the environment\nvar ENVIRONMENT_IS_WEB = typeof window == \"object\";\n\nvar ENVIRONMENT_IS_WORKER = typeof WorkerGlobalScope != \"undefined\";\n\n// N.b. Electron.js environment is simultaneously a NODE-environment, but\n// also a web environment.\nvar ENVIRONMENT_IS_NODE = typeof process == \"object\" && typeof process.versions == \"object\" && typeof process.versions.node == \"string\" && process.type != \"renderer\";\n\nvar ENVIRONMENT_IS_SHELL = !ENVIRONMENT_IS_WEB && !ENVIRONMENT_IS_NODE && !ENVIRONMENT_IS_WORKER;\n\nif (ENVIRONMENT_IS_NODE) {}\n\n// --pre-jses are emitted after the Module integration code, so that they can\n// refer to Module (if they choose; they can also define Module)\n// include: lib/binding_web/lib/prefix.js\nModule.currentQueryProgressCallback = null;\n\nModule.currentProgressCallback = null;\n\nModule.currentLogCallback = null;\n\nModule.currentParseCallback = null;\n\n// end include: lib/binding_web/lib/prefix.js\n// Sometimes an existing Module object exists with properties\n// meant to overwrite the default module functionality. Here\n// we collect those properties and reapply _after_ we configure\n// the current environment's defaults to avoid having to be so\n// defensive during initialization.\nvar moduleOverrides = Object.assign({}, Module);\n\nvar arguments_ = [];\n\nvar thisProgram = \"./this.program\";\n\nvar quit_ = (status, toThrow) => {\n throw toThrow;\n};\n\n// `/` should be present at the end if `scriptDirectory` is not empty\nvar scriptDirectory = \"\";\n\nfunction locateFile(path) {\n if (Module[\"locateFile\"]) {\n return Module[\"locateFile\"](path, scriptDirectory);\n }\n return scriptDirectory + path;\n}\n\n// Hooks that are implemented differently in different runtime environments.\nvar readAsync, readBinary;\n\nif (ENVIRONMENT_IS_NODE) {\n 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?)\");\n var nodeVersion = process.versions.node;\n var numericVersion = nodeVersion.split(\".\").slice(0, 3);\n numericVersion = (numericVersion[0] * 1e4) + (numericVersion[1] * 100) + (numericVersion[2].split(\"-\")[0] * 1);\n var minVersion = 16e4;\n if (numericVersion < 16e4) {\n throw new Error(\"This emscripten-generated code requires node v16.0.0 (detected v\" + nodeVersion + \")\");\n }\n // These modules will usually be used on Node.js. Load them eagerly to avoid\n // the complexity of lazy-loading.\n var fs = require(\"fs\");\n var nodePath = require(\"path\");\n scriptDirectory = __dirname + \"/\";\n // include: node_shell_read.js\n readBinary = filename => {\n // We need to re-wrap `file://` strings to URLs.\n filename = isFileURI(filename) ? new URL(filename) : filename;\n var ret = fs.readFileSync(filename);\n assert(Buffer.isBuffer(ret));\n return ret;\n };\n readAsync = async (filename, binary = true) => {\n // See the comment in the `readBinary` function.\n filename = isFileURI(filename) ? new URL(filename) : filename;\n var ret = fs.readFileSync(filename, binary ? undefined : \"utf8\");\n assert(binary ? Buffer.isBuffer(ret) : typeof ret == \"string\");\n return ret;\n };\n // end include: node_shell_read.js\n if (!Module[\"thisProgram\"] && process.argv.length > 1) {\n thisProgram = process.argv[1].replace(/\\\\/g, \"/\");\n }\n arguments_ = process.argv.slice(2);\n // MODULARIZE will export the module in the proper place outside, we don't need to export here\n quit_ = (status, toThrow) => {\n process.exitCode = status;\n throw toThrow;\n };\n} else if (ENVIRONMENT_IS_SHELL) {\n 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?)\");\n} else // Note that this includes Node.js workers when relevant (pthreads is enabled).\n// Node.js workers are detected as a combination of ENVIRONMENT_IS_WORKER and\n// ENVIRONMENT_IS_NODE.\nif (ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER) {\n if (ENVIRONMENT_IS_WORKER) {\n // Check worker, not web, since window could be polyfilled\n scriptDirectory = self.location.href;\n } else if (typeof document != \"undefined\" && document.currentScript) {\n // web\n scriptDirectory = document.currentScript.src;\n }\n // When MODULARIZE, this JS may be executed later, after document.currentScript\n // is gone, so we saved it, and we use it here instead of any other info.\n if (_scriptName) {\n scriptDirectory = _scriptName;\n }\n // blob urls look like blob:http://site.com/etc/etc and we cannot infer anything from them.\n // otherwise, slice off the final part of the url to find the script directory.\n // if scriptDirectory does not contain a slash, lastIndexOf will return -1,\n // and scriptDirectory will correctly be replaced with an empty string.\n // If scriptDirectory contains a query (starting with ?) or a fragment (starting with #),\n // they are removed because they could contain a slash.\n if (scriptDirectory.startsWith(\"blob:\")) {\n scriptDirectory = \"\";\n } else {\n scriptDirectory = scriptDirectory.slice(0, scriptDirectory.replace(/[?#].*/, \"\").lastIndexOf(\"/\") + 1);\n }\n 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?)\");\n {\n // include: web_or_worker_shell_read.js\n if (ENVIRONMENT_IS_WORKER) {\n readBinary = url => {\n var xhr = new XMLHttpRequest;\n xhr.open(\"GET\", url, false);\n xhr.responseType = \"arraybuffer\";\n xhr.send(null);\n return new Uint8Array(/** @type{!ArrayBuffer} */ (xhr.response));\n };\n }\n readAsync = async url => {\n // Fetch has some additional restrictions over XHR, like it can't be used on a file:// url.\n // See https://github.com/github/fetch/pull/92#issuecomment-140665932\n // Cordova or Electron apps are typically loaded from a file:// url.\n // So use XHR on webview if URL is a file URL.\n if (isFileURI(url)) {\n return new Promise((resolve, reject) => {\n var xhr = new XMLHttpRequest;\n xhr.open(\"GET\", url, true);\n xhr.responseType = \"arraybuffer\";\n xhr.onload = () => {\n if (xhr.status == 200 || (xhr.status == 0 && xhr.response)) {\n // file URLs can return 0\n resolve(xhr.response);\n return;\n }\n reject(xhr.status);\n };\n xhr.onerror = reject;\n xhr.send(null);\n });\n }\n var response = await fetch(url, {\n credentials: \"same-origin\"\n });\n if (response.ok) {\n return response.arrayBuffer();\n }\n throw new Error(response.status + \" : \" + response.url);\n };\n }\n} else {\n throw new Error(\"environment detection error\");\n}\n\nvar out = Module[\"print\"] || console.log.bind(console);\n\nvar err = Module[\"printErr\"] || console.error.bind(console);\n\n// Merge back in the overrides\nObject.assign(Module, moduleOverrides);\n\n// Free the object hierarchy contained in the overrides, this lets the GC\n// reclaim data used.\nmoduleOverrides = null;\n\ncheckIncomingModuleAPI();\n\n// Emit code to handle expected values on the Module object. This applies Module.x\n// to the proper local x. This has two benefits: first, we only emit it if it is\n// expected to arrive, and second, by using a local everywhere else that can be\n// minified.\nif (Module[\"arguments\"]) arguments_ = Module[\"arguments\"];\n\nlegacyModuleProp(\"arguments\", \"arguments_\");\n\nif (Module[\"thisProgram\"]) thisProgram = Module[\"thisProgram\"];\n\nlegacyModuleProp(\"thisProgram\", \"thisProgram\");\n\n// perform assertions in shell.js after we set up out() and err(), as otherwise if an assertion fails it cannot print the message\n// Assertions on removed incoming Module JS APIs.\nassert(typeof Module[\"memoryInitializerPrefixURL\"] == \"undefined\", \"Module.memoryInitializerPrefixURL option was removed, use Module.locateFile instead\");\n\nassert(typeof Module[\"pthreadMainPrefixURL\"] == \"undefined\", \"Module.pthreadMainPrefixURL option was removed, use Module.locateFile instead\");\n\nassert(typeof Module[\"cdInitializerPrefixURL\"] == \"undefined\", \"Module.cdInitializerPrefixURL option was removed, use Module.locateFile instead\");\n\nassert(typeof Module[\"filePackagePrefixURL\"] == \"undefined\", \"Module.filePackagePrefixURL option was removed, use Module.locateFile instead\");\n\nassert(typeof Module[\"read\"] == \"undefined\", \"Module.read option was removed\");\n\nassert(typeof Module[\"readAsync\"] == \"undefined\", \"Module.readAsync option was removed (modify readAsync in JS)\");\n\nassert(typeof Module[\"readBinary\"] == \"undefined\", \"Module.readBinary option was removed (modify readBinary in JS)\");\n\nassert(typeof Module[\"setWindowTitle\"] == \"undefined\", \"Module.setWindowTitle option was removed (modify emscripten_set_window_title in JS)\");\n\nassert(typeof Module[\"TOTAL_MEMORY\"] == \"undefined\", \"Module.TOTAL_MEMORY has been renamed Module.INITIAL_MEMORY\");\n\nlegacyModuleProp(\"asm\", \"wasmExports\");\n\nlegacyModuleProp(\"readAsync\", \"readAsync\");\n\nlegacyModuleProp(\"readBinary\", \"readBinary\");\n\nlegacyModuleProp(\"setWindowTitle\", \"setWindowTitle\");\n\nvar IDBFS = \"IDBFS is no longer included by default; build with -lidbfs.js\";\n\nvar PROXYFS = \"PROXYFS is no longer included by default; build with -lproxyfs.js\";\n\nvar WORKERFS = \"WORKERFS is no longer included by default; build with -lworkerfs.js\";\n\nvar FETCHFS = \"FETCHFS is no longer included by default; build with -lfetchfs.js\";\n\nvar ICASEFS = \"ICASEFS is no longer included by default; build with -licasefs.js\";\n\nvar JSFILEFS = \"JSFILEFS is no longer included by default; build with -ljsfilefs.js\";\n\nvar OPFS = \"OPFS is no longer included by default; build with -lopfs.js\";\n\nvar NODEFS = \"NODEFS is no longer included by default; build with -lnodefs.js\";\n\nassert(!ENVIRONMENT_IS_SHELL, \"shell environment detected but not enabled at build time. Add `shell` to `-sENVIRONMENT` to enable.\");\n\n// end include: shell.js\n// include: preamble.js\n// === Preamble library stuff ===\n// Documentation for the public APIs defined in this file must be updated in:\n// site/source/docs/api_reference/preamble.js.rst\n// A prebuilt local version of the documentation is available at:\n// site/build/text/docs/api_reference/preamble.js.txt\n// You can also build docs locally as HTML or other formats in site/\n// An online HTML version (which may be of a different version of Emscripten)\n// is up at http://kripken.github.io/emscripten-site/docs/api_reference/preamble.js.html\nvar dynamicLibraries = Module[\"dynamicLibraries\"] || [];\n\nvar wasmBinary = Module[\"wasmBinary\"];\n\nlegacyModuleProp(\"wasmBinary\", \"wasmBinary\");\n\nif (typeof WebAssembly != \"object\") {\n err(\"no native wasm support detected\");\n}\n\n// Wasm globals\nvar wasmMemory;\n\n//========================================\n// Runtime essentials\n//========================================\n// whether we are quitting the application. no code should run after this.\n// set in exit() and abort()\nvar ABORT = false;\n\n// set by exit() and abort(). Passed to 'onExit' handler.\n// NOTE: This is also used as the process return code code in shell environments\n// but only when noExitRuntime is false.\nvar EXITSTATUS;\n\n// In STRICT mode, we only define assert() when ASSERTIONS is set. i.e. we\n// don't define it at all in release modes. This matches the behaviour of\n// MINIMAL_RUNTIME.\n// TODO(sbc): Make this the default even without STRICT enabled.\n/** @type {function(*, string=)} */ function assert(condition, text) {\n if (!condition) {\n abort(\"Assertion failed\" + (text ? \": \" + text : \"\"));\n }\n}\n\n// We used to include malloc/free by default in the past. Show a helpful error in\n// builds with assertions.\n// Memory management\nvar 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\n/** not-@type {!BigInt64Array} */ HEAP64, /* BigUint64Array type is not correctly defined in closure\n/** not-t@type {!BigUint64Array} */ HEAPU64, /** @type {!Float64Array} */ HEAPF64;\n\nvar HEAP_DATA_VIEW;\n\nvar runtimeInitialized = false;\n\n/**\n * Indicates whether filename is delivered via file protocol (as opposed to http/https)\n * @noinline\n */ var isFileURI = filename => filename.startsWith(\"file://\");\n\n// include: runtime_shared.js\n// include: runtime_stack_check.js\n// Initializes the stack cookie. Called at the startup of main and at the startup of each thread in pthreads mode.\nfunction writeStackCookie() {\n var max = _emscripten_stack_get_end();\n assert((max & 3) == 0);\n // If the stack ends at address zero we write our cookies 4 bytes into the\n // stack. This prevents interference with SAFE_HEAP and ASAN which also\n // monitor writes to address zero.\n if (max == 0) {\n max += 4;\n }\n // The stack grow downwards towards _emscripten_stack_get_end.\n // We write cookies to the final two words in the stack and detect if they are\n // ever overwritten.\n LE_HEAP_STORE_U32(((max) >> 2) * 4, 34821223);\n LE_HEAP_STORE_U32((((max) + (4)) >> 2) * 4, 2310721022);\n}\n\nfunction checkStackCookie() {\n if (ABORT) return;\n var max = _emscripten_stack_get_end();\n // See writeStackCookie().\n if (max == 0) {\n max += 4;\n }\n var cookie1 = LE_HEAP_LOAD_U32(((max) >> 2) * 4);\n var cookie2 = LE_HEAP_LOAD_U32((((max) + (4)) >> 2) * 4);\n if (cookie1 != 34821223 || cookie2 != 2310721022) {\n abort(`Stack overflow! Stack cookie has been overwritten at ${ptrToString(max)}, expected hex dwords 0x89BACDFE and 0x2135467, but received ${ptrToString(cookie2)} ${ptrToString(cookie1)}`);\n }\n}\n\n// end include: runtime_stack_check.js\n// include: runtime_exceptions.js\n// end include: runtime_exceptions.js\n// include: runtime_debug.js\n// Endianness check\nif (Module[\"ENVIRONMENT\"]) {\n 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)\");\n}\n\nfunction legacyModuleProp(prop, newName, incoming = true) {\n if (!Object.getOwnPropertyDescriptor(Module, prop)) {\n Object.defineProperty(Module, prop, {\n configurable: true,\n get() {\n 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)\" : \"\";\n abort(`\\`Module.${prop}\\` has been replaced by \\`${newName}\\`` + extra);\n }\n });\n }\n}\n\nfunction consumedModuleProp(prop) {\n if (!Object.getOwnPropertyDescriptor(Module, prop)) {\n Object.defineProperty(Module, prop, {\n configurable: true,\n set() {\n 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'`);\n }\n });\n }\n}\n\nfunction ignoredModuleProp(prop) {\n if (Object.getOwnPropertyDescriptor(Module, prop)) {\n abort(`\\`Module.${prop}\\` was supplied but \\`${prop}\\` not included in INCOMING_MODULE_JS_API`);\n }\n}\n\n// forcing the filesystem exports a few things by default\nfunction isExportedByForceFilesystem(name) {\n return name === \"FS_createPath\" || name === \"FS_createDataFile\" || name === \"FS_createPreloadedFile\" || name === \"FS_unlink\" || name === \"addRunDependency\" || // The old FS has some functionality that WasmFS lacks.\n name === \"FS_createLazyFile\" || name === \"FS_createDevice\" || name === \"removeRunDependency\";\n}\n\n/**\n * Intercept access to a global symbol. This enables us to give informative\n * warnings/errors when folks attempt to use symbols they did not include in\n * their build, or no symbols that no longer exist.\n */ function hookGlobalSymbolAccess(sym, func) {}\n\nfunction missingGlobal(sym, msg) {\n hookGlobalSymbolAccess(sym, () => {\n warnOnce(`\\`${sym}\\` is not longer defined by emscripten. ${msg}`);\n });\n}\n\nmissingGlobal(\"buffer\", \"Please use HEAP8.buffer or wasmMemory.buffer\");\n\nmissingGlobal(\"asm\", \"Please use wasmExports instead\");\n\nfunction missingLibrarySymbol(sym) {\n hookGlobalSymbolAccess(sym, () => {\n // Can't `abort()` here because it would break code that does runtime\n // checks. e.g. `if (typeof SDL === 'undefined')`.\n 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`;\n // DEFAULT_LIBRARY_FUNCS_TO_INCLUDE requires the name as it appears in\n // library.js, which means $name for a JS name with no prefix, or name\n // for a JS name like _name.\n var librarySymbol = sym;\n if (!librarySymbol.startsWith(\"_\")) {\n librarySymbol = \"$\" + sym;\n }\n msg += ` (e.g. -sDEFAULT_LIBRARY_FUNCS_TO_INCLUDE='${librarySymbol}')`;\n if (isExportedByForceFilesystem(sym)) {\n msg += \". Alternatively, forcing filesystem support (-sFORCE_FILESYSTEM) can export this for you\";\n }\n warnOnce(msg);\n });\n // Any symbol that is not included from the JS library is also (by definition)\n // not exported on the Module object.\n unexportedRuntimeSymbol(sym);\n}\n\nfunction unexportedRuntimeSymbol(sym) {\n if (!Object.getOwnPropertyDescriptor(Module, sym)) {\n Object.defineProperty(Module, sym, {\n configurable: true,\n get() {\n var msg = `'${sym}' was not exported. add it to EXPORTED_RUNTIME_METHODS (see the Emscripten FAQ)`;\n if (isExportedByForceFilesystem(sym)) {\n msg += \". Alternatively, forcing filesystem support (-sFORCE_FILESYSTEM) can export this for you\";\n }\n abort(msg);\n }\n });\n }\n}\n\n// Used by XXXXX_DEBUG settings to output debug messages.\nfunction dbg(...args) {\n // TODO(sbc): Make this configurable somehow. Its not always convenient for\n // logging to show up as warnings.\n console.warn(...args);\n}\n\n// end include: runtime_debug.js\n// include: memoryprofiler.js\n// end include: memoryprofiler.js\n// include: runtime_safe_heap.js\n/** @param {number|boolean=} isFloat */ function getSafeHeapType(bytes, isFloat) {\n switch (bytes) {\n case 1:\n return \"i8\";\n\n case 2:\n return \"i16\";\n\n case 4:\n return isFloat ? \"float\" : \"i32\";\n\n case 8:\n return isFloat ? \"double\" : \"i64\";\n\n default:\n abort(`getSafeHeapType() invalid bytes=${bytes}`);\n }\n}\n\n/** @param {number|boolean=} isFloat */ function SAFE_HEAP_STORE(dest, value, bytes, isFloat) {\n if (dest <= 0) abort(`segmentation fault storing ${bytes} bytes to address ${dest}`);\n if (dest % bytes !== 0) abort(`alignment error storing to address ${dest}, which was expected to be aligned to a multiple of ${bytes}`);\n if (runtimeInitialized) {\n var brk = _sbrk(0);\n if (dest + bytes > brk) abort(`segmentation fault, exceeded the top of the available dynamic heap when storing ${bytes} bytes to address ${dest}. DYNAMICTOP=${brk}`);\n if (brk < _emscripten_stack_get_base()) abort(`brk >= _emscripten_stack_get_base() (brk=${brk}, _emscripten_stack_get_base()=${_emscripten_stack_get_base()})`);\n // sbrk-managed memory must be above the stack\n if (brk > wasmMemory.buffer.byteLength) abort(`brk <= wasmMemory.buffer.byteLength (brk=${brk}, wasmMemory.buffer.byteLength=${wasmMemory.buffer.byteLength})`);\n }\n setValue_safe(dest, value, getSafeHeapType(bytes, isFloat));\n return value;\n}\n\nfunction SAFE_HEAP_STORE_D(dest, value, bytes) {\n return SAFE_HEAP_STORE(dest, value, bytes, true);\n}\n\n/** @param {number|boolean=} isFloat */ function SAFE_HEAP_LOAD(dest, bytes, unsigned, isFloat) {\n if (dest <= 0) abort(`segmentation fault loading ${bytes} bytes from address ${dest}`);\n if (dest % bytes !== 0) abort(`alignment error loading from address ${dest}, which was expected to be aligned to a multiple of ${bytes}`);\n if (runtimeInitialized) {\n var brk = _sbrk(0);\n if (dest + bytes > brk) abort(`segmentation fault, exceeded the top of the available dynamic heap when loading ${bytes} bytes from address ${dest}. DYNAMICTOP=${brk}`);\n if (brk < _emscripten_stack_get_base()) abort(`brk >= _emscripten_stack_get_base() (brk=${brk}, _emscripten_stack_get_base()=${_emscripten_stack_get_base()})`);\n // sbrk-managed memory must be above the stack\n if (brk > wasmMemory.buffer.byteLength) abort(`brk <= wasmMemory.buffer.byteLength (brk=${brk}, wasmMemory.buffer.byteLength=${wasmMemory.buffer.byteLength})`);\n }\n var type = getSafeHeapType(bytes, isFloat);\n var ret = getValue_safe(dest, type);\n if (unsigned) ret = unSign(ret, parseInt(type.slice(1), 10));\n return ret;\n}\n\nfunction SAFE_HEAP_LOAD_D(dest, bytes, unsigned) {\n return SAFE_HEAP_LOAD(dest, bytes, unsigned, true);\n}\n\nfunction SAFE_FT_MASK(value, mask) {\n var ret = value & mask;\n if (ret !== value) {\n 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.`);\n }\n return ret;\n}\n\nfunction segfault() {\n abort(\"segmentation fault\");\n}\n\nfunction alignfault() {\n abort(\"alignment fault\");\n}\n\n// end include: runtime_safe_heap.js\nfunction updateMemoryViews() {\n var b = wasmMemory.buffer;\n Module[\"HEAP_DATA_VIEW\"] = HEAP_DATA_VIEW = new DataView(b);\n Module[\"HEAP8\"] = HEAP8 = new Int8Array(b);\n Module[\"HEAP16\"] = HEAP16 = new Int16Array(b);\n Module[\"HEAPU8\"] = HEAPU8 = new Uint8Array(b);\n Module[\"HEAPU16\"] = HEAPU16 = new Uint16Array(b);\n Module[\"HEAP32\"] = HEAP32 = new Int32Array(b);\n Module[\"HEAPU32\"] = HEAPU32 = new Uint32Array(b);\n Module[\"HEAPF32\"] = HEAPF32 = new Float32Array(b);\n Module[\"HEAPF64\"] = HEAPF64 = new Float64Array(b);\n Module[\"HEAP64\"] = HEAP64 = new BigInt64Array(b);\n Module[\"HEAPU64\"] = HEAPU64 = new BigUint64Array(b);\n}\n\n// end include: runtime_shared.js\nassert(!Module[\"STACK_SIZE\"], \"STACK_SIZE can no longer be set at runtime. Use -sSTACK_SIZE at link time\");\n\nassert(typeof Int32Array != \"undefined\" && typeof Float64Array !== \"undefined\" && Int32Array.prototype.subarray != undefined && Int32Array.prototype.set != undefined, \"JS engine does not provide full typed array support\");\n\n// In non-standalone/normal mode, we create the memory here.\n// include: runtime_init_memory.js\n// Create the wasm memory. (Note: this only applies if IMPORTED_MEMORY is defined)\n// check for full engine support (use string 'subarray' to avoid closure compiler confusion)\nif (Module[\"wasmMemory\"]) {\n wasmMemory = Module[\"wasmMemory\"];\n} else {\n var INITIAL_MEMORY = Module[\"INITIAL_MEMORY\"] || 33554432;\n legacyModuleProp(\"INITIAL_MEMORY\", \"INITIAL_MEMORY\");\n assert(INITIAL_MEMORY >= 65536, \"INITIAL_MEMORY should be larger than STACK_SIZE, was \" + INITIAL_MEMORY + \"! (STACK_SIZE=\" + 65536 + \")\");\n /** @suppress {checkTypes} */ wasmMemory = new WebAssembly.Memory({\n \"initial\": INITIAL_MEMORY / 65536,\n // In theory we should not need to emit the maximum if we want \"unlimited\"\n // or 4GB of memory, but VMs error on that atm, see\n // https://github.com/emscripten-core/emscripten/issues/14130\n // And in the pthreads case we definitely need to emit a maximum. So\n // always emit one.\n \"maximum\": 32768\n });\n}\n\nupdateMemoryViews();\n\n// end include: runtime_init_memory.js\nvar __RELOC_FUNCS__ = [];\n\nfunction preRun() {\n if (Module[\"preRun\"]) {\n if (typeof Module[\"preRun\"] == \"function\") Module[\"preRun\"] = [ Module[\"preRun\"] ];\n while (Module[\"preRun\"].length) {\n addOnPreRun(Module[\"preRun\"].shift());\n }\n }\n consumedModuleProp(\"preRun\");\n callRuntimeCallbacks(onPreRuns);\n}\n\nfunction initRuntime() {\n assert(!runtimeInitialized);\n runtimeInitialized = true;\n checkStackCookie();\n callRuntimeCallbacks(__RELOC_FUNCS__);\n wasmExports[\"__wasm_call_ctors\"]();\n callRuntimeCallbacks(onPostCtors);\n}\n\nfunction preMain() {\n checkStackCookie();\n}\n\nfunction postRun() {\n checkStackCookie();\n if (Module[\"postRun\"]) {\n if (typeof Module[\"postRun\"] == \"function\") Module[\"postRun\"] = [ Module[\"postRun\"] ];\n while (Module[\"postRun\"].length) {\n addOnPostRun(Module[\"postRun\"].shift());\n }\n }\n consumedModuleProp(\"postRun\");\n callRuntimeCallbacks(onPostRuns);\n}\n\n// A counter of dependencies for calling run(). If we need to\n// do asynchronous work before running, increment this and\n// decrement it. Incrementing must happen in a place like\n// Module.preRun (used by emcc to add file preloading).\n// Note that you can add dependencies in preRun, even though\n// it happens right before run - run will be postponed until\n// the dependencies are met.\nvar runDependencies = 0;\n\nvar dependenciesFulfilled = null;\n\n// overridden to take different actions when all run dependencies are fulfilled\nvar runDependencyTracking = {};\n\nvar runDependencyWatcher = null;\n\nfunction getUniqueRunDependency(id) {\n var orig = id;\n while (1) {\n if (!runDependencyTracking[id]) return id;\n id = orig + Math.random();\n }\n}\n\nfunction addRunDependency(id) {\n runDependencies++;\n Module[\"monitorRunDependencies\"]?.(runDependencies);\n if (id) {\n assert(!runDependencyTracking[id]);\n runDependencyTracking[id] = 1;\n if (runDependencyWatcher === null && typeof setInterval != \"undefined\") {\n // Check for missing dependencies every few seconds\n runDependencyWatcher = setInterval(() => {\n if (ABORT) {\n clearInterval(runDependencyWatcher);\n runDependencyWatcher = null;\n return;\n }\n var shown = false;\n for (var dep in runDependencyTracking) {\n if (!shown) {\n shown = true;\n err(\"still waiting on run dependencies:\");\n }\n err(`dependency: ${dep}`);\n }\n if (shown) {\n err(\"(end of list)\");\n }\n }, 1e4);\n }\n } else {\n err(\"warning: run dependency added without ID\");\n }\n}\n\nfunction removeRunDependency(id) {\n runDependencies--;\n Module[\"monitorRunDependencies\"]?.(runDependencies);\n if (id) {\n assert(runDependencyTracking[id]);\n delete runDependencyTracking[id];\n } else {\n err(\"warning: run dependency removed without ID\");\n }\n if (runDependencies == 0) {\n if (runDependencyWatcher !== null) {\n clearInterval(runDependencyWatcher);\n runDependencyWatcher = null;\n }\n if (dependenciesFulfilled) {\n var callback = dependenciesFulfilled;\n dependenciesFulfilled = null;\n callback();\n }\n }\n}\n\n/** @param {string|number=} what */ function abort(what) {\n Module[\"onAbort\"]?.(what);\n what = \"Aborted(\" + what + \")\";\n // TODO(sbc): Should we remove printing and leave it up to whoever\n // catches the exception?\n err(what);\n ABORT = true;\n // Use a wasm runtime error, because a JS error might be seen as a foreign\n // exception, which means we'd run destructors on it. We need the error to\n // simply make the program stop.\n // FIXME This approach does not work in Wasm EH because it currently does not assume\n // all RuntimeErrors are from traps; it decides whether a RuntimeError is from\n // a trap or not based on a hidden field within the object. So at the moment\n // we don't have a way of throwing a wasm trap from JS. TODO Make a JS API that\n // allows this in the wasm spec.\n // Suppress closure compiler warning here. Closure compiler's builtin extern\n // definition for WebAssembly.RuntimeError claims it takes no arguments even\n // though it can.\n // TODO(https://github.com/google/closure-compiler/pull/3913): Remove if/when upstream closure gets fixed.\n /** @suppress {checkTypes} */ var e = new WebAssembly.RuntimeError(what);\n readyPromiseReject(e);\n // Throw the error whether or not MODULARIZE is set because abort is used\n // in code paths apart from instantiation where an exception is expected\n // to be thrown when abort is called.\n throw e;\n}\n\n// show errors on likely calls to FS when it was not included\nvar FS = {\n error() {\n 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\");\n },\n init() {\n FS.error();\n },\n createDataFile() {\n FS.error();\n },\n createPreloadedFile() {\n FS.error();\n },\n createLazyFile() {\n FS.error();\n },\n open() {\n FS.error();\n },\n mkdev() {\n FS.error();\n },\n registerDevice() {\n FS.error();\n },\n analyzePath() {\n FS.error();\n },\n ErrnoError() {\n FS.error();\n }\n};\n\nModule[\"FS_createDataFile\"] = FS.createDataFile;\n\nModule[\"FS_createPreloadedFile\"] = FS.createPreloadedFile;\n\nfunction createExportWrapper(name, nargs) {\n return (...args) => {\n assert(runtimeInitialized, `native function \\`${name}\\` called before runtime initialization`);\n var f = wasmExports[name];\n assert(f, `exported native function \\`${name}\\` not found`);\n // Only assert for too many arguments. Too few can be valid since the missing arguments will be zero filled.\n assert(args.length <= nargs, `native function \\`${name}\\` called with ${args.length} args but expects ${nargs}`);\n return f(...args);\n };\n}\n\nvar wasmBinaryFile;\n\nfunction findWasmBinary() {\n return locateFile(\"tree-sitter.wasm\");\n}\n\nfunction getBinarySync(file) {\n if (file == wasmBinaryFile && wasmBinary) {\n return new Uint8Array(wasmBinary);\n }\n if (readBinary) {\n return readBinary(file);\n }\n throw \"both async and sync fetching of the wasm failed\";\n}\n\nasync function getWasmBinary(binaryFile) {\n // If we don't have the binary yet, load it asynchronously using readAsync.\n if (!wasmBinary) {\n // Fetch the binary using readAsync\n try {\n var response = await readAsync(binaryFile);\n return new Uint8Array(response);\n } catch {}\n }\n // Otherwise, getBinarySync should be able to get it synchronously\n return getBinarySync(binaryFile);\n}\n\nasync function instantiateArrayBuffer(binaryFile, imports) {\n try {\n var binary = await getWasmBinary(binaryFile);\n var instance = await WebAssembly.instantiate(binary, imports);\n return instance;\n } catch (reason) {\n err(`failed to asynchronously prepare wasm: ${reason}`);\n // Warn on some common problems.\n if (isFileURI(wasmBinaryFile)) {\n 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`);\n }\n abort(reason);\n }\n}\n\nasync function instantiateAsync(binary, binaryFile, imports) {\n if (!binary && typeof WebAssembly.instantiateStreaming == \"function\" && !isFileURI(binaryFile) && !ENVIRONMENT_IS_NODE) {\n try {\n var response = fetch(binaryFile, {\n credentials: \"same-origin\"\n });\n var instantiationResult = await WebAssembly.instantiateStreaming(response, imports);\n return instantiationResult;\n } catch (reason) {\n // We expect the most common failure cause to be a bad MIME type for the binary,\n // in which case falling back to ArrayBuffer instantiation should work.\n err(`wasm streaming compile failed: ${reason}`);\n err(\"falling back to ArrayBuffer instantiation\");\n }\n }\n return instantiateArrayBuffer(binaryFile, imports);\n}\n\nfunction getWasmImports() {\n // prepare imports\n return {\n \"env\": wasmImports,\n \"wasi_snapshot_preview1\": wasmImports,\n \"GOT.mem\": new Proxy(wasmImports, GOTHandler),\n \"GOT.func\": new Proxy(wasmImports, GOTHandler)\n };\n}\n\n// Create the wasm instance.\n// Receives the wasm imports, returns the exports.\nasync function createWasm() {\n // Load the wasm module and create an instance of using native support in the JS engine.\n // handle a generated wasm instance, receiving its exports and\n // performing other necessary setup\n /** @param {WebAssembly.Module=} module*/ function receiveInstance(instance, module) {\n wasmExports = instance.exports;\n wasmExports = relocateExports(wasmExports, 1024);\n var metadata = getDylinkMetadata(module);\n if (metadata.neededDynlibs) {\n dynamicLibraries = metadata.neededDynlibs.concat(dynamicLibraries);\n }\n mergeLibSymbols(wasmExports, \"main\");\n LDSO.init();\n loadDylibs();\n __RELOC_FUNCS__.push(wasmExports[\"__wasm_apply_data_relocs\"]);\n removeRunDependency(\"wasm-instantiate\");\n return wasmExports;\n }\n // wait for the pthread pool (if any)\n addRunDependency(\"wasm-instantiate\");\n // Prefer streaming instantiation if available.\n // Async compilation can be confusing when an error on the page overwrites Module\n // (for example, if the order of elements is wrong, and the one defining Module is\n // later), so we save Module and check it later.\n var trueModule = Module;\n function receiveInstantiationResult(result) {\n // 'result' is a ResultObject object which has both the module and instance.\n // receiveInstance() will swap in the exports (to Module.asm) so they can be called\n assert(Module === trueModule, \"the Module object should not be replaced during async compilation - perhaps the order of HTML elements is wrong?\");\n trueModule = null;\n return receiveInstance(result[\"instance\"], result[\"module\"]);\n }\n var info = getWasmImports();\n // User shell pages can write their own Module.instantiateWasm = function(imports, successCallback) callback\n // to manually instantiate the Wasm module themselves. This allows pages to\n // run the instantiation parallel to any other async startup actions they are\n // performing.\n // Also pthreads and wasm workers initialize the wasm instance through this\n // path.\n if (Module[\"instantiateWasm\"]) {\n return new Promise((resolve, reject) => {\n try {\n Module[\"instantiateWasm\"](info, (mod, inst) => {\n receiveInstance(mod, inst);\n resolve(mod.exports);\n });\n } catch (e) {\n err(`Module.instantiateWasm callback failed with error: ${e}`);\n reject(e);\n }\n });\n }\n wasmBinaryFile ??= findWasmBinary();\n try {\n var result = await instantiateAsync(wasmBinary, wasmBinaryFile, info);\n var exports = receiveInstantiationResult(result);\n return exports;\n } catch (e) {\n // If instantiation fails, reject the module ready promise.\n readyPromiseReject(e);\n return Promise.reject(e);\n }\n}\n\n// === Body ===\nvar ASM_CONSTS = {};\n\n// end include: preamble.js\nclass ExitStatus {\n name=\"ExitStatus\";\n constructor(status) {\n this.message = `Program terminated with exit(${status})`;\n this.status = status;\n }\n}\n\nvar GOT = {};\n\nvar currentModuleWeakSymbols = new Set([]);\n\nvar GOTHandler = {\n get(obj, symName) {\n var rtn = GOT[symName];\n if (!rtn) {\n rtn = GOT[symName] = new WebAssembly.Global({\n \"value\": \"i32\",\n \"mutable\": true\n });\n }\n if (!currentModuleWeakSymbols.has(symName)) {\n // Any non-weak reference to a symbol marks it as `required`, which\n // enabled `reportUndefinedSymbols` to report undefined symbol errors\n // correctly.\n rtn.required = true;\n }\n return rtn;\n }\n};\n\nvar LE_HEAP_LOAD_F32 = byteOffset => HEAP_DATA_VIEW.getFloat32(byteOffset, true);\n\nvar LE_HEAP_LOAD_F64 = byteOffset => HEAP_DATA_VIEW.getFloat64(byteOffset, true);\n\nvar LE_HEAP_LOAD_I16 = byteOffset => HEAP_DATA_VIEW.getInt16(byteOffset, true);\n\nvar LE_HEAP_LOAD_I32 = byteOffset => HEAP_DATA_VIEW.getInt32(byteOffset, true);\n\nvar LE_HEAP_LOAD_U16 = byteOffset => HEAP_DATA_VIEW.getUint16(byteOffset, true);\n\nvar LE_HEAP_LOAD_U32 = byteOffset => HEAP_DATA_VIEW.getUint32(byteOffset, true);\n\nvar LE_HEAP_STORE_F32 = (byteOffset, value) => HEAP_DATA_VIEW.setFloat32(byteOffset, value, true);\n\nvar LE_HEAP_STORE_F64 = (byteOffset, value) => HEAP_DATA_VIEW.setFloat64(byteOffset, value, true);\n\nvar LE_HEAP_STORE_I16 = (byteOffset, value) => HEAP_DATA_VIEW.setInt16(byteOffset, value, true);\n\nvar LE_HEAP_STORE_I32 = (byteOffset, value) => HEAP_DATA_VIEW.setInt32(byteOffset, value, true);\n\nvar LE_HEAP_STORE_U16 = (byteOffset, value) => HEAP_DATA_VIEW.setUint16(byteOffset, value, true);\n\nvar LE_HEAP_STORE_U32 = (byteOffset, value) => HEAP_DATA_VIEW.setUint32(byteOffset, value, true);\n\nvar callRuntimeCallbacks = callbacks => {\n while (callbacks.length > 0) {\n // Pass the module as the first argument.\n callbacks.shift()(Module);\n }\n};\n\nvar onPostRuns = [];\n\nvar addOnPostRun = cb => onPostRuns.unshift(cb);\n\nvar onPreRuns = [];\n\nvar addOnPreRun = cb => onPreRuns.unshift(cb);\n\nvar UTF8Decoder = typeof TextDecoder != \"undefined\" ? new TextDecoder : undefined;\n\n/**\n * Given a pointer 'idx' to a null-terminated UTF8-encoded string in the given\n * array that contains uint8 values, returns a copy of that string as a\n * Javascript String object.\n * heapOrArray is either a regular array, or a JavaScript typed array view.\n * @param {number=} idx\n * @param {number=} maxBytesToRead\n * @return {string}\n */ var UTF8ArrayToString = (heapOrArray, idx = 0, maxBytesToRead = NaN) => {\n var endIdx = idx + maxBytesToRead;\n var endPtr = idx;\n // TextDecoder needs to know the byte length in advance, it doesn't stop on\n // null terminator by itself. Also, use the length info to avoid running tiny\n // strings through TextDecoder, since .subarray() allocates garbage.\n // (As a tiny code save trick, compare endPtr against endIdx using a negation,\n // so that undefined/NaN means Infinity)\n while (heapOrArray[endPtr] && !(endPtr >= endIdx)) ++endPtr;\n if (endPtr - idx > 16 && heapOrArray.buffer && UTF8Decoder) {\n return UTF8Decoder.decode(heapOrArray.subarray(idx, endPtr));\n }\n var str = \"\";\n // If building with TextDecoder, we have already computed the string length\n // above, so test loop end condition against that\n while (idx < endPtr) {\n // For UTF8 byte structure, see:\n // http://en.wikipedia.org/wiki/UTF-8#Description\n // https://www.ietf.org/rfc/rfc2279.txt\n // https://tools.ietf.org/html/rfc3629\n var u0 = heapOrArray[idx++];\n if (!(u0 & 128)) {\n str += String.fromCharCode(u0);\n continue;\n }\n var u1 = heapOrArray[idx++] & 63;\n if ((u0 & 224) == 192) {\n str += String.fromCharCode(((u0 & 31) << 6) | u1);\n continue;\n }\n var u2 = heapOrArray[idx++] & 63;\n if ((u0 & 240) == 224) {\n u0 = ((u0 & 15) << 12) | (u1 << 6) | u2;\n } else {\n 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!\");\n u0 = ((u0 & 7) << 18) | (u1 << 12) | (u2 << 6) | (heapOrArray[idx++] & 63);\n }\n if (u0 < 65536) {\n str += String.fromCharCode(u0);\n } else {\n var ch = u0 - 65536;\n str += String.fromCharCode(55296 | (ch >> 10), 56320 | (ch & 1023));\n }\n }\n return str;\n};\n\nvar getDylinkMetadata = binary => {\n var offset = 0;\n var end = 0;\n function getU8() {\n return binary[offset++];\n }\n function getLEB() {\n var ret = 0;\n var mul = 1;\n while (1) {\n var byte = binary[offset++];\n ret += ((byte & 127) * mul);\n mul *= 128;\n if (!(byte & 128)) break;\n }\n return ret;\n }\n function getString() {\n var len = getLEB();\n offset += len;\n return UTF8ArrayToString(binary, offset - len, len);\n }\n /** @param {string=} message */ function failIf(condition, message) {\n if (condition) throw new Error(message);\n }\n var name = \"dylink.0\";\n if (binary instanceof WebAssembly.Module) {\n var dylinkSection = WebAssembly.Module.customSections(binary, name);\n if (dylinkSection.length === 0) {\n name = \"dylink\";\n dylinkSection = WebAssembly.Module.customSections(binary, name);\n }\n failIf(dylinkSection.length === 0, \"need dylink section\");\n binary = new Uint8Array(dylinkSection[0]);\n end = binary.length;\n } else {\n var int32View = new Uint32Array(new Uint8Array(binary.subarray(0, 24)).buffer);\n var magicNumberFound = int32View[0] == 1836278016 || int32View[0] == 6386541;\n failIf(!magicNumberFound, \"need to see wasm magic number\");\n // \\0asm\n // we should see the dylink custom section right after the magic number and wasm version\n failIf(binary[8] !== 0, \"need the dylink section to be first\");\n offset = 9;\n var section_size = getLEB();\n //section size\n end = offset + section_size;\n name = getString();\n }\n var customSection = {\n neededDynlibs: [],\n tlsExports: new Set,\n weakImports: new Set\n };\n if (name == \"dylink\") {\n customSection.memorySize = getLEB();\n customSection.memoryAlign = getLEB();\n customSection.tableSize = getLEB();\n customSection.tableAlign = getLEB();\n // shared libraries this module needs. We need to load them first, so that\n // current module could resolve its imports. (see tools/shared.py\n // WebAssembly.make_shared_library() for \"dylink\" section extension format)\n var neededDynlibsCount = getLEB();\n for (var i = 0; i < neededDynlibsCount; ++i) {\n var libname = getString();\n customSection.neededDynlibs.push(libname);\n }\n } else {\n failIf(name !== \"dylink.0\");\n var WASM_DYLINK_MEM_INFO = 1;\n var WASM_DYLINK_NEEDED = 2;\n var WASM_DYLINK_EXPORT_INFO = 3;\n var WASM_DYLINK_IMPORT_INFO = 4;\n var WASM_SYMBOL_TLS = 256;\n var WASM_SYMBOL_BINDING_MASK = 3;\n var WASM_SYMBOL_BINDING_WEAK = 1;\n while (offset < end) {\n var subsectionType = getU8();\n var subsectionSize = getLEB();\n if (subsectionType === WASM_DYLINK_MEM_INFO) {\n customSection.memorySize = getLEB();\n customSection.memoryAlign = getLEB();\n customSection.tableSize = getLEB();\n customSection.tableAlign = getLEB();\n } else if (subsectionType === WASM_DYLINK_NEEDED) {\n var neededDynlibsCount = getLEB();\n for (var i = 0; i < neededDynlibsCount; ++i) {\n libname = getString();\n customSection.neededDynlibs.push(libname);\n }\n } else if (subsectionType === WASM_DYLINK_EXPORT_INFO) {\n var count = getLEB();\n while (count--) {\n var symname = getString();\n var flags = getLEB();\n if (flags & WASM_SYMBOL_TLS) {\n customSection.tlsExports.add(symname);\n }\n }\n } else if (subsectionType === WASM_DYLINK_IMPORT_INFO) {\n var count = getLEB();\n while (count--) {\n var modname = getString();\n var symname = getString();\n var flags = getLEB();\n if ((flags & WASM_SYMBOL_BINDING_MASK) == WASM_SYMBOL_BINDING_WEAK) {\n customSection.weakImports.add(symname);\n }\n }\n } else {\n err(`unknown dylink.0 subsection: ${subsectionType}`);\n // unknown subsection\n offset += subsectionSize;\n }\n }\n }\n var tableAlign = Math.pow(2, customSection.tableAlign);\n assert(tableAlign === 1, `invalid tableAlign ${tableAlign}`);\n assert(offset == end);\n return customSection;\n};\n\n/**\n * @param {number} ptr\n * @param {string} type\n */ function getValue(ptr, type = \"i8\") {\n if (type.endsWith(\"*\")) type = \"*\";\n switch (type) {\n case \"i1\":\n return SAFE_HEAP_LOAD(ptr, 1, 0);\n\n case \"i8\":\n return SAFE_HEAP_LOAD(ptr, 1, 0);\n\n case \"i16\":\n return LE_HEAP_LOAD_I16(((ptr) >> 1) * 2);\n\n case \"i32\":\n return LE_HEAP_LOAD_I32(((ptr) >> 2) * 4);\n\n case \"i64\":\n return HEAP64[((ptr) >> 3)];\n\n case \"float\":\n return LE_HEAP_LOAD_F32(((ptr) >> 2) * 4);\n\n case \"double\":\n return LE_HEAP_LOAD_F64(((ptr) >> 3) * 8);\n\n case \"*\":\n return LE_HEAP_LOAD_U32(((ptr) >> 2) * 4);\n\n default:\n abort(`invalid type for getValue: ${type}`);\n }\n}\n\nfunction getValue_safe(ptr, type = \"i8\") {\n if (type.endsWith(\"*\")) type = \"*\";\n switch (type) {\n case \"i1\":\n return HEAP8[ptr];\n\n case \"i8\":\n return HEAP8[ptr];\n\n case \"i16\":\n return LE_HEAP_LOAD_I16(((ptr) >> 1) * 2);\n\n case \"i32\":\n return LE_HEAP_LOAD_I32(((ptr) >> 2) * 4);\n\n case \"i64\":\n return HEAP64[((ptr) >> 3)];\n\n case \"float\":\n return LE_HEAP_LOAD_F32(((ptr) >> 2) * 4);\n\n case \"double\":\n return LE_HEAP_LOAD_F64(((ptr) >> 3) * 8);\n\n case \"*\":\n return LE_HEAP_LOAD_U32(((ptr) >> 2) * 4);\n\n default:\n abort(`invalid type for getValue: ${type}`);\n }\n}\n\nvar newDSO = (name, handle, syms) => {\n var dso = {\n refcount: Infinity,\n name,\n exports: syms,\n global: true\n };\n LDSO.loadedLibsByName[name] = dso;\n if (handle != undefined) {\n LDSO.loadedLibsByHandle[handle] = dso;\n }\n return dso;\n};\n\nvar LDSO = {\n loadedLibsByName: {},\n loadedLibsByHandle: {},\n init() {\n // This function needs to run after the initial wasmImports object\n // as been created.\n assert(wasmImports);\n newDSO(\"__main__\", 0, wasmImports);\n }\n};\n\nvar ___heap_base = 78208;\n\nvar alignMemory = (size, alignment) => {\n assert(alignment, \"alignment argument is required\");\n return Math.ceil(size / alignment) * alignment;\n};\n\nvar getMemory = size => {\n // After the runtime is initialized, we must only use sbrk() normally.\n if (runtimeInitialized) {\n // Currently we don't support freeing of static data when modules are\n // unloaded via dlclose. This function is tagged as `noleakcheck` to\n // avoid having this reported as leak.\n return _calloc(size, 1);\n }\n var ret = ___heap_base;\n // Keep __heap_base stack aligned.\n var end = ret + alignMemory(size, 16);\n assert(end <= HEAP8.length, \"failure to getMemory - memory growth etc. is not supported there, call malloc/sbrk directly or increase INITIAL_MEMORY\");\n ___heap_base = end;\n GOT[\"__heap_base\"].value = end;\n return ret;\n};\n\nvar 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