orion-super-agent-dev 0.1.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/out/worker.js ADDED
@@ -0,0 +1,1968 @@
1
+ import { createRequire as __orionCreateRequire } from "module";
2
+ import { fileURLToPath as __orionFileURLToPath } from "url";
3
+ import { dirname as __orionDirname } from "path";
4
+ const require = __orionCreateRequire(import.meta.url);
5
+ const __filename = __orionFileURLToPath(import.meta.url);
6
+ const __dirname = __orionDirname(__filename);
7
+ var __getOwnPropNames = Object.getOwnPropertyNames;
8
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
9
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
10
+ }) : x)(function(x) {
11
+ if (typeof require !== "undefined") return require.apply(this, arguments);
12
+ throw Error('Dynamic require of "' + x + '" is not supported');
13
+ });
14
+ var __commonJS = (cb, mod) => function __require2() {
15
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
16
+ };
17
+
18
+ // ../node_modules/web-tree-sitter/tree-sitter.js
19
+ var require_tree_sitter = __commonJS({
20
+ "../node_modules/web-tree-sitter/tree-sitter.js"(exports, module) {
21
+ var Module = void 0 !== Module ? Module : {};
22
+ var TreeSitter = function() {
23
+ var initPromise, document = "object" == typeof window ? { currentScript: window.document.currentScript } : null;
24
+ class Parser {
25
+ constructor() {
26
+ this.initialize();
27
+ }
28
+ initialize() {
29
+ throw new Error("cannot construct a Parser before calling `init()`");
30
+ }
31
+ static init(moduleOptions) {
32
+ return initPromise || (Module = Object.assign({}, Module, moduleOptions), initPromise = new Promise((resolveInitPromise) => {
33
+ var moduleOverrides = Object.assign({}, Module), arguments_ = [], thisProgram = "./this.program", quit_ = (e, t) => {
34
+ throw t;
35
+ }, ENVIRONMENT_IS_WEB = "object" == typeof window, ENVIRONMENT_IS_WORKER = "function" == typeof importScripts, ENVIRONMENT_IS_NODE = "object" == typeof process && "object" == typeof process.versions && "string" == typeof process.versions.node, scriptDirectory = "", read_, readAsync, readBinary;
36
+ function locateFile(e) {
37
+ return Module.locateFile ? Module.locateFile(e, scriptDirectory) : scriptDirectory + e;
38
+ }
39
+ if (ENVIRONMENT_IS_NODE) {
40
+ var fs = __require("fs"), nodePath = __require("path");
41
+ scriptDirectory = ENVIRONMENT_IS_WORKER ? nodePath.dirname(scriptDirectory) + "/" : __dirname + "/", read_ = (e, t) => (e = isFileURI(e) ? new URL(e) : nodePath.normalize(e), fs.readFileSync(e, t ? void 0 : "utf8")), readBinary = (e) => {
42
+ var t = read_(e, true);
43
+ return t.buffer || (t = new Uint8Array(t)), t;
44
+ }, readAsync = (e, t, _, s = true) => {
45
+ e = isFileURI(e) ? new URL(e) : nodePath.normalize(e), fs.readFile(e, s ? void 0 : "utf8", (e2, r) => {
46
+ e2 ? _(e2) : t(s ? r.buffer : r);
47
+ });
48
+ }, !Module.thisProgram && process.argv.length > 1 && (thisProgram = process.argv[1].replace(/\\/g, "/")), arguments_ = process.argv.slice(2), "undefined" != typeof module && (module.exports = Module), quit_ = (e, t) => {
49
+ throw process.exitCode = e, t;
50
+ };
51
+ } else (ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER) && (ENVIRONMENT_IS_WORKER ? scriptDirectory = self.location.href : void 0 !== document && document.currentScript && (scriptDirectory = document.currentScript.src), scriptDirectory = scriptDirectory.startsWith("blob:") ? "" : scriptDirectory.substr(0, scriptDirectory.replace(/[?#].*/, "").lastIndexOf("/") + 1), read_ = (e) => {
52
+ var t = new XMLHttpRequest();
53
+ return t.open("GET", e, false), t.send(null), t.responseText;
54
+ }, ENVIRONMENT_IS_WORKER && (readBinary = (e) => {
55
+ var t = new XMLHttpRequest();
56
+ return t.open("GET", e, false), t.responseType = "arraybuffer", t.send(null), new Uint8Array(t.response);
57
+ }), readAsync = (e, t, _) => {
58
+ var s = new XMLHttpRequest();
59
+ s.open("GET", e, true), s.responseType = "arraybuffer", s.onload = () => {
60
+ 200 == s.status || 0 == s.status && s.response ? t(s.response) : _();
61
+ }, s.onerror = _, s.send(null);
62
+ });
63
+ var out = Module.print || console.log.bind(console), err = Module.printErr || console.error.bind(console);
64
+ Object.assign(Module, moduleOverrides), moduleOverrides = null, Module.arguments && (arguments_ = Module.arguments), Module.thisProgram && (thisProgram = Module.thisProgram), Module.quit && (quit_ = Module.quit);
65
+ var dynamicLibraries = Module.dynamicLibraries || [], wasmBinary, wasmMemory;
66
+ Module.wasmBinary && (wasmBinary = Module.wasmBinary), "object" != typeof WebAssembly && abort("no native wasm support detected");
67
+ var ABORT = false, EXITSTATUS, HEAP8, HEAPU8, HEAP16, HEAPU16, HEAP32, HEAPU32, HEAPF32, HEAPF64;
68
+ function updateMemoryViews() {
69
+ var e = wasmMemory.buffer;
70
+ Module.HEAP8 = HEAP8 = new Int8Array(e), Module.HEAP16 = HEAP16 = new Int16Array(e), Module.HEAPU8 = HEAPU8 = new Uint8Array(e), Module.HEAPU16 = HEAPU16 = new Uint16Array(e), Module.HEAP32 = HEAP32 = new Int32Array(e), Module.HEAPU32 = HEAPU32 = new Uint32Array(e), Module.HEAPF32 = HEAPF32 = new Float32Array(e), Module.HEAPF64 = HEAPF64 = new Float64Array(e);
71
+ }
72
+ var INITIAL_MEMORY = Module.INITIAL_MEMORY || 33554432;
73
+ wasmMemory = Module.wasmMemory ? Module.wasmMemory : new WebAssembly.Memory({ initial: INITIAL_MEMORY / 65536, maximum: 32768 }), updateMemoryViews(), INITIAL_MEMORY = wasmMemory.buffer.byteLength;
74
+ var __ATPRERUN__ = [], __ATINIT__ = [], __ATMAIN__ = [], __ATPOSTRUN__ = [], __RELOC_FUNCS__ = [], runtimeInitialized = false;
75
+ function preRun() {
76
+ if (Module.preRun) for ("function" == typeof Module.preRun && (Module.preRun = [Module.preRun]); Module.preRun.length; ) addOnPreRun(Module.preRun.shift());
77
+ callRuntimeCallbacks(__ATPRERUN__);
78
+ }
79
+ function initRuntime() {
80
+ runtimeInitialized = true, callRuntimeCallbacks(__RELOC_FUNCS__), callRuntimeCallbacks(__ATINIT__);
81
+ }
82
+ function preMain() {
83
+ callRuntimeCallbacks(__ATMAIN__);
84
+ }
85
+ function postRun() {
86
+ if (Module.postRun) for ("function" == typeof Module.postRun && (Module.postRun = [Module.postRun]); Module.postRun.length; ) addOnPostRun(Module.postRun.shift());
87
+ callRuntimeCallbacks(__ATPOSTRUN__);
88
+ }
89
+ function addOnPreRun(e) {
90
+ __ATPRERUN__.unshift(e);
91
+ }
92
+ function addOnInit(e) {
93
+ __ATINIT__.unshift(e);
94
+ }
95
+ function addOnPostRun(e) {
96
+ __ATPOSTRUN__.unshift(e);
97
+ }
98
+ var runDependencies = 0, runDependencyWatcher = null, dependenciesFulfilled = null;
99
+ function getUniqueRunDependency(e) {
100
+ return e;
101
+ }
102
+ function addRunDependency(e) {
103
+ runDependencies++, Module.monitorRunDependencies?.(runDependencies);
104
+ }
105
+ function removeRunDependency(e) {
106
+ if (runDependencies--, Module.monitorRunDependencies?.(runDependencies), 0 == runDependencies && (null !== runDependencyWatcher && (clearInterval(runDependencyWatcher), runDependencyWatcher = null), dependenciesFulfilled)) {
107
+ var t = dependenciesFulfilled;
108
+ dependenciesFulfilled = null, t();
109
+ }
110
+ }
111
+ function abort(e) {
112
+ throw Module.onAbort?.(e), err(e = "Aborted(" + e + ")"), ABORT = true, EXITSTATUS = 1, e += ". Build with -sASSERTIONS for more info.", new WebAssembly.RuntimeError(e);
113
+ }
114
+ var dataURIPrefix = "data:application/octet-stream;base64,", isDataURI = (e) => e.startsWith(dataURIPrefix), isFileURI = (e) => e.startsWith("file://"), wasmBinaryFile;
115
+ function getBinarySync(e) {
116
+ if (e == wasmBinaryFile && wasmBinary) return new Uint8Array(wasmBinary);
117
+ if (readBinary) return readBinary(e);
118
+ throw "both async and sync fetching of the wasm failed";
119
+ }
120
+ function getBinaryPromise(e) {
121
+ if (!wasmBinary && (ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER)) {
122
+ if ("function" == typeof fetch && !isFileURI(e)) return fetch(e, { credentials: "same-origin" }).then((t) => {
123
+ if (!t.ok) throw `failed to load wasm binary file at '${e}'`;
124
+ return t.arrayBuffer();
125
+ }).catch(() => getBinarySync(e));
126
+ if (readAsync) return new Promise((t, _) => {
127
+ readAsync(e, (e2) => t(new Uint8Array(e2)), _);
128
+ });
129
+ }
130
+ return Promise.resolve().then(() => getBinarySync(e));
131
+ }
132
+ function instantiateArrayBuffer(e, t, _) {
133
+ return getBinaryPromise(e).then((e2) => WebAssembly.instantiate(e2, t)).then(_, (e2) => {
134
+ err(`failed to asynchronously prepare wasm: ${e2}`), abort(e2);
135
+ });
136
+ }
137
+ function instantiateAsync(e, t, _, s) {
138
+ return e || "function" != typeof WebAssembly.instantiateStreaming || isDataURI(t) || isFileURI(t) || ENVIRONMENT_IS_NODE || "function" != typeof fetch ? instantiateArrayBuffer(t, _, s) : fetch(t, { credentials: "same-origin" }).then((e2) => WebAssembly.instantiateStreaming(e2, _).then(s, function(e3) {
139
+ return err(`wasm streaming compile failed: ${e3}`), err("falling back to ArrayBuffer instantiation"), instantiateArrayBuffer(t, _, s);
140
+ }));
141
+ }
142
+ function createWasm() {
143
+ var e = { env: wasmImports, wasi_snapshot_preview1: wasmImports, "GOT.mem": new Proxy(wasmImports, GOTHandler), "GOT.func": new Proxy(wasmImports, GOTHandler) };
144
+ function t(e2, t2) {
145
+ wasmExports = e2.exports, wasmExports = relocateExports(wasmExports, 1024);
146
+ var _ = getDylinkMetadata(t2);
147
+ return _.neededDynlibs && (dynamicLibraries = _.neededDynlibs.concat(dynamicLibraries)), mergeLibSymbols(wasmExports, "main"), LDSO.init(), loadDylibs(), addOnInit(wasmExports.__wasm_call_ctors), __RELOC_FUNCS__.push(wasmExports.__wasm_apply_data_relocs), removeRunDependency("wasm-instantiate"), wasmExports;
148
+ }
149
+ if (addRunDependency("wasm-instantiate"), Module.instantiateWasm) try {
150
+ return Module.instantiateWasm(e, t);
151
+ } catch (e2) {
152
+ return err(`Module.instantiateWasm callback failed with error: ${e2}`), false;
153
+ }
154
+ return instantiateAsync(wasmBinary, wasmBinaryFile, e, function(e2) {
155
+ t(e2.instance, e2.module);
156
+ }), {};
157
+ }
158
+ wasmBinaryFile = "tree-sitter.wasm", isDataURI(wasmBinaryFile) || (wasmBinaryFile = locateFile(wasmBinaryFile));
159
+ var ASM_CONSTS = {};
160
+ function ExitStatus(e) {
161
+ this.name = "ExitStatus", this.message = `Program terminated with exit(${e})`, this.status = e;
162
+ }
163
+ var GOT = {}, currentModuleWeakSymbols = /* @__PURE__ */ new Set([]), GOTHandler = { get(e, t) {
164
+ var _ = GOT[t];
165
+ return _ || (_ = GOT[t] = new WebAssembly.Global({ value: "i32", mutable: true })), currentModuleWeakSymbols.has(t) || (_.required = true), _;
166
+ } }, callRuntimeCallbacks = (e) => {
167
+ for (; e.length > 0; ) e.shift()(Module);
168
+ }, UTF8Decoder = "undefined" != typeof TextDecoder ? new TextDecoder("utf8") : void 0, UTF8ArrayToString = (e, t, _) => {
169
+ for (var s = t + _, r = t; e[r] && !(r >= s); ) ++r;
170
+ if (r - t > 16 && e.buffer && UTF8Decoder) return UTF8Decoder.decode(e.subarray(t, r));
171
+ for (var a = ""; t < r; ) {
172
+ var o = e[t++];
173
+ if (128 & o) {
174
+ var n = 63 & e[t++];
175
+ if (192 != (224 & o)) {
176
+ var l = 63 & e[t++];
177
+ if ((o = 224 == (240 & o) ? (15 & o) << 12 | n << 6 | l : (7 & o) << 18 | n << 12 | l << 6 | 63 & e[t++]) < 65536) a += String.fromCharCode(o);
178
+ else {
179
+ var d = o - 65536;
180
+ a += String.fromCharCode(55296 | d >> 10, 56320 | 1023 & d);
181
+ }
182
+ } else a += String.fromCharCode((31 & o) << 6 | n);
183
+ } else a += String.fromCharCode(o);
184
+ }
185
+ return a;
186
+ }, getDylinkMetadata = (e) => {
187
+ var t = 0, _ = 0;
188
+ function s() {
189
+ for (var _2 = 0, s2 = 1; ; ) {
190
+ var r2 = e[t++];
191
+ if (_2 += (127 & r2) * s2, s2 *= 128, !(128 & r2)) break;
192
+ }
193
+ return _2;
194
+ }
195
+ function r() {
196
+ var _2 = s();
197
+ return UTF8ArrayToString(e, (t += _2) - _2, _2);
198
+ }
199
+ function a(e2, t2) {
200
+ if (e2) throw new Error(t2);
201
+ }
202
+ var o = "dylink.0";
203
+ if (e instanceof WebAssembly.Module) {
204
+ var n = WebAssembly.Module.customSections(e, o);
205
+ 0 === n.length && (o = "dylink", n = WebAssembly.Module.customSections(e, o)), a(0 === n.length, "need dylink section"), _ = (e = new Uint8Array(n[0])).length;
206
+ } else {
207
+ a(!(1836278016 == new Uint32Array(new Uint8Array(e.subarray(0, 24)).buffer)[0]), "need to see wasm magic number"), a(0 !== e[8], "need the dylink section to be first"), t = 9;
208
+ var l = s();
209
+ _ = t + l, o = r();
210
+ }
211
+ var d = { neededDynlibs: [], tlsExports: /* @__PURE__ */ new Set(), weakImports: /* @__PURE__ */ new Set() };
212
+ if ("dylink" == o) {
213
+ d.memorySize = s(), d.memoryAlign = s(), d.tableSize = s(), d.tableAlign = s();
214
+ for (var u = s(), m = 0; m < u; ++m) {
215
+ var c = r();
216
+ d.neededDynlibs.push(c);
217
+ }
218
+ } else {
219
+ a("dylink.0" !== o);
220
+ for (; t < _; ) {
221
+ var w = e[t++], p = s();
222
+ if (1 === w) d.memorySize = s(), d.memoryAlign = s(), d.tableSize = s(), d.tableAlign = s();
223
+ else if (2 === w) for (u = s(), m = 0; m < u; ++m) c = r(), d.neededDynlibs.push(c);
224
+ else if (3 === w) for (var h = s(); h--; ) {
225
+ var g = r();
226
+ 256 & s() && d.tlsExports.add(g);
227
+ }
228
+ else if (4 === w) for (h = s(); h--; ) {
229
+ r(), g = r();
230
+ 1 == (3 & s()) && d.weakImports.add(g);
231
+ }
232
+ else t += p;
233
+ }
234
+ }
235
+ return d;
236
+ };
237
+ function getValue(e, t = "i8") {
238
+ switch (t.endsWith("*") && (t = "*"), t) {
239
+ case "i1":
240
+ case "i8":
241
+ return HEAP8[e];
242
+ case "i16":
243
+ return HEAP16[e >> 1];
244
+ case "i32":
245
+ return HEAP32[e >> 2];
246
+ case "i64":
247
+ abort("to do getValue(i64) use WASM_BIGINT");
248
+ case "float":
249
+ return HEAPF32[e >> 2];
250
+ case "double":
251
+ return HEAPF64[e >> 3];
252
+ case "*":
253
+ return HEAPU32[e >> 2];
254
+ default:
255
+ abort(`invalid type for getValue: ${t}`);
256
+ }
257
+ }
258
+ var newDSO = (e, t, _) => {
259
+ var s = { refcount: 1 / 0, name: e, exports: _, global: true };
260
+ return LDSO.loadedLibsByName[e] = s, null != t && (LDSO.loadedLibsByHandle[t] = s), s;
261
+ }, LDSO = { loadedLibsByName: {}, loadedLibsByHandle: {}, init() {
262
+ newDSO("__main__", 0, wasmImports);
263
+ } }, ___heap_base = 78096, zeroMemory = (e, t) => (HEAPU8.fill(0, e, e + t), e), alignMemory = (e, t) => Math.ceil(e / t) * t, getMemory = (e) => {
264
+ if (runtimeInitialized) return zeroMemory(_malloc(e), e);
265
+ var t = ___heap_base, _ = t + alignMemory(e, 16);
266
+ return ___heap_base = _, GOT.__heap_base.value = _, t;
267
+ }, isInternalSym = (e) => ["__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(e) || e.startsWith("__em_js__"), uleb128Encode = (e, t) => {
268
+ e < 128 ? t.push(e) : t.push(e % 128 | 128, e >> 7);
269
+ }, sigToWasmTypes = (e) => {
270
+ for (var t = { i: "i32", j: "i64", f: "f32", d: "f64", e: "externref", p: "i32" }, _ = { parameters: [], results: "v" == e[0] ? [] : [t[e[0]]] }, s = 1; s < e.length; ++s) _.parameters.push(t[e[s]]);
271
+ return _;
272
+ }, generateFuncType = (e, t) => {
273
+ var _ = e.slice(0, 1), s = e.slice(1), r = { i: 127, p: 127, j: 126, f: 125, d: 124, e: 111 };
274
+ t.push(96), uleb128Encode(s.length, t);
275
+ for (var a = 0; a < s.length; ++a) t.push(r[s[a]]);
276
+ "v" == _ ? t.push(0) : t.push(1, r[_]);
277
+ }, convertJsFunctionToWasm = (e, t) => {
278
+ if ("function" == typeof WebAssembly.Function) return new WebAssembly.Function(sigToWasmTypes(t), e);
279
+ var _ = [1];
280
+ generateFuncType(t, _);
281
+ var s = [0, 97, 115, 109, 1, 0, 0, 0, 1];
282
+ uleb128Encode(_.length, s), s.push(..._), s.push(2, 7, 1, 1, 101, 1, 102, 0, 0, 7, 5, 1, 1, 102, 0, 0);
283
+ var r = new WebAssembly.Module(new Uint8Array(s));
284
+ return new WebAssembly.Instance(r, { e: { f: e } }).exports.f;
285
+ }, wasmTableMirror = [], wasmTable = new WebAssembly.Table({ initial: 27, element: "anyfunc" }), getWasmTableEntry = (e) => {
286
+ var t = wasmTableMirror[e];
287
+ return t || (e >= wasmTableMirror.length && (wasmTableMirror.length = e + 1), wasmTableMirror[e] = t = wasmTable.get(e)), t;
288
+ }, updateTableMap = (e, t) => {
289
+ if (functionsInTableMap) for (var _ = e; _ < e + t; _++) {
290
+ var s = getWasmTableEntry(_);
291
+ s && functionsInTableMap.set(s, _);
292
+ }
293
+ }, functionsInTableMap, getFunctionAddress = (e) => (functionsInTableMap || (functionsInTableMap = /* @__PURE__ */ new WeakMap(), updateTableMap(0, wasmTable.length)), functionsInTableMap.get(e) || 0), freeTableIndexes = [], getEmptyTableSlot = () => {
294
+ if (freeTableIndexes.length) return freeTableIndexes.pop();
295
+ try {
296
+ wasmTable.grow(1);
297
+ } catch (e) {
298
+ if (!(e instanceof RangeError)) throw e;
299
+ throw "Unable to grow wasm table. Set ALLOW_TABLE_GROWTH.";
300
+ }
301
+ return wasmTable.length - 1;
302
+ }, setWasmTableEntry = (e, t) => {
303
+ wasmTable.set(e, t), wasmTableMirror[e] = wasmTable.get(e);
304
+ }, addFunction = (e, t) => {
305
+ var _ = getFunctionAddress(e);
306
+ if (_) return _;
307
+ var s = getEmptyTableSlot();
308
+ try {
309
+ setWasmTableEntry(s, e);
310
+ } catch (_2) {
311
+ if (!(_2 instanceof TypeError)) throw _2;
312
+ var r = convertJsFunctionToWasm(e, t);
313
+ setWasmTableEntry(s, r);
314
+ }
315
+ return functionsInTableMap.set(e, s), s;
316
+ }, updateGOT = (e, t) => {
317
+ for (var _ in e) if (!isInternalSym(_)) {
318
+ var s = e[_];
319
+ _.startsWith("orig$") && (_ = _.split("$")[1], t = true), GOT[_] ||= new WebAssembly.Global({ value: "i32", mutable: true }), (t || 0 == GOT[_].value) && ("function" == typeof s ? GOT[_].value = addFunction(s) : "number" == typeof s ? GOT[_].value = s : err(`unhandled export type for '${_}': ${typeof s}`));
320
+ }
321
+ }, relocateExports = (e, t, _) => {
322
+ var s = {};
323
+ for (var r in e) {
324
+ var a = e[r];
325
+ "object" == typeof a && (a = a.value), "number" == typeof a && (a += t), s[r] = a;
326
+ }
327
+ return updateGOT(s, _), s;
328
+ }, isSymbolDefined = (e) => {
329
+ var t = wasmImports[e];
330
+ return !(!t || t.stub);
331
+ }, dynCallLegacy = (e, t, _) => (0, Module["dynCall_" + e])(t, ..._), dynCall = (e, t, _ = []) => e.includes("j") ? dynCallLegacy(e, t, _) : getWasmTableEntry(t)(..._), createInvokeFunction = (e) => function() {
332
+ var t = stackSave();
333
+ try {
334
+ return dynCall(e, arguments[0], Array.prototype.slice.call(arguments, 1));
335
+ } catch (e2) {
336
+ if (stackRestore(t), e2 !== e2 + 0) throw e2;
337
+ _setThrew(1, 0);
338
+ }
339
+ }, resolveGlobalSymbol = (e, t = false) => {
340
+ var _;
341
+ return t && "orig$" + e in wasmImports && (e = "orig$" + e), isSymbolDefined(e) ? _ = wasmImports[e] : e.startsWith("invoke_") && (_ = wasmImports[e] = createInvokeFunction(e.split("_")[1])), { sym: _, name: e };
342
+ }, UTF8ToString = (e, t) => e ? UTF8ArrayToString(HEAPU8, e, t) : "", loadWebAssemblyModule = (binary, flags, libName, localScope, handle) => {
343
+ var metadata = getDylinkMetadata(binary);
344
+ function loadModule() {
345
+ var firstLoad = !handle || !HEAP8[handle + 8];
346
+ if (firstLoad) {
347
+ var memAlign = Math.pow(2, metadata.memoryAlign), memoryBase = metadata.memorySize ? alignMemory(getMemory(metadata.memorySize + memAlign), memAlign) : 0, tableBase = metadata.tableSize ? wasmTable.length : 0;
348
+ handle && (HEAP8[handle + 8] = 1, HEAPU32[handle + 12 >> 2] = memoryBase, HEAP32[handle + 16 >> 2] = metadata.memorySize, HEAPU32[handle + 20 >> 2] = tableBase, HEAP32[handle + 24 >> 2] = metadata.tableSize);
349
+ } else memoryBase = HEAPU32[handle + 12 >> 2], tableBase = HEAPU32[handle + 20 >> 2];
350
+ var tableGrowthNeeded = tableBase + metadata.tableSize - wasmTable.length, moduleExports;
351
+ function resolveSymbol(e) {
352
+ var t = resolveGlobalSymbol(e).sym;
353
+ return !t && localScope && (t = localScope[e]), t || (t = moduleExports[e]), t;
354
+ }
355
+ tableGrowthNeeded > 0 && wasmTable.grow(tableGrowthNeeded);
356
+ var proxyHandler = { get(e, t) {
357
+ switch (t) {
358
+ case "__memory_base":
359
+ return memoryBase;
360
+ case "__table_base":
361
+ return tableBase;
362
+ }
363
+ if (t in wasmImports && !wasmImports[t].stub) return wasmImports[t];
364
+ var _;
365
+ t in e || (e[t] = (...e2) => (_ ||= resolveSymbol(t), _(...e2)));
366
+ return e[t];
367
+ } }, proxy = new Proxy({}, proxyHandler), info = { "GOT.mem": new Proxy({}, GOTHandler), "GOT.func": new Proxy({}, GOTHandler), env: proxy, wasi_snapshot_preview1: proxy };
368
+ function postInstantiation(module, instance) {
369
+ function addEmAsm(addr, body) {
370
+ for (var args = [], arity = 0; arity < 16 && -1 != body.indexOf("$" + arity); arity++) args.push("$" + arity);
371
+ args = args.join(",");
372
+ var func = `(${args}) => { ${body} };`;
373
+ ASM_CONSTS[start] = eval(func);
374
+ }
375
+ if (updateTableMap(tableBase, metadata.tableSize), moduleExports = relocateExports(instance.exports, memoryBase), flags.allowUndefined || reportUndefinedSymbols(), "__start_em_asm" in moduleExports) for (var start = moduleExports.__start_em_asm, stop = moduleExports.__stop_em_asm; start < stop; ) {
376
+ var jsString = UTF8ToString(start);
377
+ addEmAsm(start, jsString), start = HEAPU8.indexOf(0, start) + 1;
378
+ }
379
+ function addEmJs(name, cSig, body) {
380
+ var jsArgs = [];
381
+ if (cSig = cSig.slice(1, -1), "void" != cSig) for (var i in cSig = cSig.split(","), cSig) {
382
+ var jsArg = cSig[i].split(" ").pop();
383
+ jsArgs.push(jsArg.replace("*", ""));
384
+ }
385
+ var func = `(${jsArgs}) => ${body};`;
386
+ moduleExports[name] = eval(func);
387
+ }
388
+ for (var name in moduleExports) if (name.startsWith("__em_js__")) {
389
+ var start = moduleExports[name], jsString = UTF8ToString(start), parts = jsString.split("<::>");
390
+ addEmJs(name.replace("__em_js__", ""), parts[0], parts[1]), delete moduleExports[name];
391
+ }
392
+ var applyRelocs = moduleExports.__wasm_apply_data_relocs;
393
+ applyRelocs && (runtimeInitialized ? applyRelocs() : __RELOC_FUNCS__.push(applyRelocs));
394
+ var init = moduleExports.__wasm_call_ctors;
395
+ return init && (runtimeInitialized ? init() : __ATINIT__.push(init)), moduleExports;
396
+ }
397
+ if (flags.loadAsync) {
398
+ if (binary instanceof WebAssembly.Module) {
399
+ var instance = new WebAssembly.Instance(binary, info);
400
+ return Promise.resolve(postInstantiation(binary, instance));
401
+ }
402
+ return WebAssembly.instantiate(binary, info).then((e) => postInstantiation(e.module, e.instance));
403
+ }
404
+ var module = binary instanceof WebAssembly.Module ? binary : new WebAssembly.Module(binary), instance = new WebAssembly.Instance(module, info);
405
+ return postInstantiation(module, instance);
406
+ }
407
+ return currentModuleWeakSymbols = metadata.weakImports, flags.loadAsync ? metadata.neededDynlibs.reduce((e, t) => e.then(() => loadDynamicLibrary(t, flags)), Promise.resolve()).then(loadModule) : (metadata.neededDynlibs.forEach((e) => loadDynamicLibrary(e, flags, localScope)), loadModule());
408
+ }, mergeLibSymbols = (e, t) => {
409
+ for (var [_, s] of Object.entries(e)) {
410
+ const e2 = (e3) => {
411
+ isSymbolDefined(e3) || (wasmImports[e3] = s);
412
+ };
413
+ e2(_);
414
+ const t2 = "__main_argc_argv";
415
+ "main" == _ && e2(t2), _ == t2 && e2("main"), _.startsWith("dynCall_") && !Module.hasOwnProperty(_) && (Module[_] = s);
416
+ }
417
+ }, asyncLoad = (e, t, _, s) => {
418
+ var r = s ? "" : getUniqueRunDependency(`al ${e}`);
419
+ readAsync(e, (e2) => {
420
+ t(new Uint8Array(e2)), r && removeRunDependency(r);
421
+ }, (t2) => {
422
+ if (!_) throw `Loading data file "${e}" failed.`;
423
+ _();
424
+ }), r && addRunDependency(r);
425
+ };
426
+ function loadDynamicLibrary(e, t = { global: true, nodelete: true }, _, s) {
427
+ var r = LDSO.loadedLibsByName[e];
428
+ if (r) return t.global ? r.global || (r.global = true, mergeLibSymbols(r.exports, e)) : _ && Object.assign(_, r.exports), t.nodelete && r.refcount !== 1 / 0 && (r.refcount = 1 / 0), r.refcount++, s && (LDSO.loadedLibsByHandle[s] = r), !t.loadAsync || Promise.resolve(true);
429
+ function a() {
430
+ if (s) {
431
+ var _2 = HEAPU32[s + 28 >> 2], r2 = HEAPU32[s + 32 >> 2];
432
+ if (_2 && r2) {
433
+ var a2 = HEAP8.slice(_2, _2 + r2);
434
+ return t.loadAsync ? Promise.resolve(a2) : a2;
435
+ }
436
+ }
437
+ var o2 = locateFile(e);
438
+ if (t.loadAsync) return new Promise(function(e2, t2) {
439
+ asyncLoad(o2, e2, t2);
440
+ });
441
+ if (!readBinary) throw new Error(`${o2}: file not found, and synchronous loading of external files is not available`);
442
+ return readBinary(o2);
443
+ }
444
+ function o() {
445
+ return t.loadAsync ? a().then((r2) => loadWebAssemblyModule(r2, t, e, _, s)) : loadWebAssemblyModule(a(), t, e, _, s);
446
+ }
447
+ function n(t2) {
448
+ r.global ? mergeLibSymbols(t2, e) : _ && Object.assign(_, t2), r.exports = t2;
449
+ }
450
+ return (r = newDSO(e, s, "loading")).refcount = t.nodelete ? 1 / 0 : 1, r.global = t.global, t.loadAsync ? o().then((e2) => (n(e2), true)) : (n(o()), true);
451
+ }
452
+ var reportUndefinedSymbols = () => {
453
+ for (var [e, t] of Object.entries(GOT)) if (0 == t.value) {
454
+ var _ = resolveGlobalSymbol(e, true).sym;
455
+ if (!_ && !t.required) continue;
456
+ if ("function" == typeof _) t.value = addFunction(_, _.sig);
457
+ else {
458
+ if ("number" != typeof _) throw new Error(`bad export type for '${e}': ${typeof _}`);
459
+ t.value = _;
460
+ }
461
+ }
462
+ }, loadDylibs = () => {
463
+ dynamicLibraries.length ? (addRunDependency("loadDylibs"), dynamicLibraries.reduce((e, t) => e.then(() => loadDynamicLibrary(t, { loadAsync: true, global: true, nodelete: true, allowUndefined: true })), Promise.resolve()).then(() => {
464
+ reportUndefinedSymbols(), removeRunDependency("loadDylibs");
465
+ })) : reportUndefinedSymbols();
466
+ }, noExitRuntime = Module.noExitRuntime || true;
467
+ function setValue(e, t, _ = "i8") {
468
+ switch (_.endsWith("*") && (_ = "*"), _) {
469
+ case "i1":
470
+ case "i8":
471
+ HEAP8[e] = t;
472
+ break;
473
+ case "i16":
474
+ HEAP16[e >> 1] = t;
475
+ break;
476
+ case "i32":
477
+ HEAP32[e >> 2] = t;
478
+ break;
479
+ case "i64":
480
+ abort("to do setValue(i64) use WASM_BIGINT");
481
+ case "float":
482
+ HEAPF32[e >> 2] = t;
483
+ break;
484
+ case "double":
485
+ HEAPF64[e >> 3] = t;
486
+ break;
487
+ case "*":
488
+ HEAPU32[e >> 2] = t;
489
+ break;
490
+ default:
491
+ abort(`invalid type for setValue: ${_}`);
492
+ }
493
+ }
494
+ var ___memory_base = new WebAssembly.Global({ value: "i32", mutable: false }, 1024), ___stack_pointer = new WebAssembly.Global({ value: "i32", mutable: true }, 78096), ___table_base = new WebAssembly.Global({ value: "i32", mutable: false }, 1), nowIsMonotonic = 1, __emscripten_get_now_is_monotonic = () => nowIsMonotonic;
495
+ __emscripten_get_now_is_monotonic.sig = "i";
496
+ var _abort = () => {
497
+ abort("");
498
+ };
499
+ _abort.sig = "v";
500
+ var _emscripten_date_now = () => Date.now(), _emscripten_get_now;
501
+ _emscripten_date_now.sig = "d", _emscripten_get_now = () => performance.now(), _emscripten_get_now.sig = "d";
502
+ var _emscripten_memcpy_js = (e, t, _) => HEAPU8.copyWithin(e, t, t + _);
503
+ _emscripten_memcpy_js.sig = "vppp";
504
+ var getHeapMax = () => 2147483648, growMemory = (e) => {
505
+ var t = (e - wasmMemory.buffer.byteLength + 65535) / 65536;
506
+ try {
507
+ return wasmMemory.grow(t), updateMemoryViews(), 1;
508
+ } catch (e2) {
509
+ }
510
+ }, _emscripten_resize_heap = (e) => {
511
+ var t = HEAPU8.length;
512
+ e >>>= 0;
513
+ var _ = getHeapMax();
514
+ if (e > _) return false;
515
+ for (var s, r, a = 1; a <= 4; a *= 2) {
516
+ var o = t * (1 + 0.2 / a);
517
+ o = Math.min(o, e + 100663296);
518
+ var n = Math.min(_, (s = Math.max(e, o)) + ((r = 65536) - s % r) % r);
519
+ if (growMemory(n)) return true;
520
+ }
521
+ return false;
522
+ };
523
+ _emscripten_resize_heap.sig = "ip";
524
+ var _fd_close = (e) => 52;
525
+ _fd_close.sig = "ii";
526
+ var convertI32PairToI53Checked = (e, t) => t + 2097152 >>> 0 < 4194305 - !!e ? (e >>> 0) + 4294967296 * t : NaN;
527
+ function _fd_seek(e, t, _, s, r) {
528
+ convertI32PairToI53Checked(t, _);
529
+ return 70;
530
+ }
531
+ _fd_seek.sig = "iiiiip";
532
+ var printCharBuffers = [null, [], []], printChar = (e, t) => {
533
+ var _ = printCharBuffers[e];
534
+ 0 === t || 10 === t ? ((1 === e ? out : err)(UTF8ArrayToString(_, 0)), _.length = 0) : _.push(t);
535
+ }, SYSCALLS = { varargs: void 0, get() {
536
+ var e = HEAP32[+SYSCALLS.varargs >> 2];
537
+ return SYSCALLS.varargs += 4, e;
538
+ }, getp: () => SYSCALLS.get(), getStr: (e) => UTF8ToString(e) }, _fd_write = (e, t, _, s) => {
539
+ for (var r = 0, a = 0; a < _; a++) {
540
+ var o = HEAPU32[t >> 2], n = HEAPU32[t + 4 >> 2];
541
+ t += 8;
542
+ for (var l = 0; l < n; l++) printChar(e, HEAPU8[o + l]);
543
+ r += n;
544
+ }
545
+ return HEAPU32[s >> 2] = r, 0;
546
+ };
547
+ function _tree_sitter_log_callback(e, t) {
548
+ if (currentLogCallback) {
549
+ const _ = UTF8ToString(t);
550
+ currentLogCallback(_, 0 !== e);
551
+ }
552
+ }
553
+ function _tree_sitter_parse_callback(e, t, _, s, r) {
554
+ const a = currentParseCallback(t, { row: _, column: s });
555
+ "string" == typeof a ? (setValue(r, a.length, "i32"), stringToUTF16(a, e, 10240)) : setValue(r, 0, "i32");
556
+ }
557
+ _fd_write.sig = "iippp";
558
+ var runtimeKeepaliveCounter = 0, keepRuntimeAlive = () => noExitRuntime || runtimeKeepaliveCounter > 0, _proc_exit = (e) => {
559
+ EXITSTATUS = e, keepRuntimeAlive() || (Module.onExit?.(e), ABORT = true), quit_(e, new ExitStatus(e));
560
+ };
561
+ _proc_exit.sig = "vi";
562
+ var exitJS = (e, t) => {
563
+ EXITSTATUS = e, _proc_exit(e);
564
+ }, handleException = (e) => {
565
+ if (e instanceof ExitStatus || "unwind" == e) return EXITSTATUS;
566
+ quit_(1, e);
567
+ }, lengthBytesUTF8 = (e) => {
568
+ for (var t = 0, _ = 0; _ < e.length; ++_) {
569
+ var s = e.charCodeAt(_);
570
+ s <= 127 ? t++ : s <= 2047 ? t += 2 : s >= 55296 && s <= 57343 ? (t += 4, ++_) : t += 3;
571
+ }
572
+ return t;
573
+ }, stringToUTF8Array = (e, t, _, s) => {
574
+ if (!(s > 0)) return 0;
575
+ for (var r = _, a = _ + s - 1, o = 0; o < e.length; ++o) {
576
+ var n = e.charCodeAt(o);
577
+ if (n >= 55296 && n <= 57343) n = 65536 + ((1023 & n) << 10) | 1023 & e.charCodeAt(++o);
578
+ if (n <= 127) {
579
+ if (_ >= a) break;
580
+ t[_++] = n;
581
+ } else if (n <= 2047) {
582
+ if (_ + 1 >= a) break;
583
+ t[_++] = 192 | n >> 6, t[_++] = 128 | 63 & n;
584
+ } else if (n <= 65535) {
585
+ if (_ + 2 >= a) break;
586
+ t[_++] = 224 | n >> 12, t[_++] = 128 | n >> 6 & 63, t[_++] = 128 | 63 & n;
587
+ } else {
588
+ if (_ + 3 >= a) break;
589
+ t[_++] = 240 | n >> 18, t[_++] = 128 | n >> 12 & 63, t[_++] = 128 | n >> 6 & 63, t[_++] = 128 | 63 & n;
590
+ }
591
+ }
592
+ return t[_] = 0, _ - r;
593
+ }, stringToUTF8 = (e, t, _) => stringToUTF8Array(e, HEAPU8, t, _), stringToUTF8OnStack = (e) => {
594
+ var t = lengthBytesUTF8(e) + 1, _ = stackAlloc(t);
595
+ return stringToUTF8(e, _, t), _;
596
+ }, stringToUTF16 = (e, t, _) => {
597
+ if (_ ??= 2147483647, _ < 2) return 0;
598
+ for (var s = t, r = (_ -= 2) < 2 * e.length ? _ / 2 : e.length, a = 0; a < r; ++a) {
599
+ var o = e.charCodeAt(a);
600
+ HEAP16[t >> 1] = o, t += 2;
601
+ }
602
+ return HEAP16[t >> 1] = 0, t - s;
603
+ }, AsciiToString = (e) => {
604
+ for (var t = ""; ; ) {
605
+ var _ = HEAPU8[e++];
606
+ if (!_) return t;
607
+ t += String.fromCharCode(_);
608
+ }
609
+ }, wasmImports = { __heap_base: ___heap_base, __indirect_function_table: wasmTable, __memory_base: ___memory_base, __stack_pointer: ___stack_pointer, __table_base: ___table_base, _emscripten_get_now_is_monotonic: __emscripten_get_now_is_monotonic, abort: _abort, emscripten_get_now: _emscripten_get_now, emscripten_memcpy_js: _emscripten_memcpy_js, emscripten_resize_heap: _emscripten_resize_heap, fd_close: _fd_close, fd_seek: _fd_seek, fd_write: _fd_write, memory: wasmMemory, tree_sitter_log_callback: _tree_sitter_log_callback, tree_sitter_parse_callback: _tree_sitter_parse_callback }, wasmExports = createWasm(), ___wasm_call_ctors = () => (___wasm_call_ctors = wasmExports.__wasm_call_ctors)(), ___wasm_apply_data_relocs = () => (___wasm_apply_data_relocs = wasmExports.__wasm_apply_data_relocs)(), _malloc = Module._malloc = (e) => (_malloc = Module._malloc = wasmExports.malloc)(e), _calloc = Module._calloc = (e, t) => (_calloc = Module._calloc = wasmExports.calloc)(e, t), _realloc = Module._realloc = (e, t) => (_realloc = Module._realloc = wasmExports.realloc)(e, t), _free = Module._free = (e) => (_free = Module._free = wasmExports.free)(e), _ts_language_symbol_count = Module._ts_language_symbol_count = (e) => (_ts_language_symbol_count = Module._ts_language_symbol_count = wasmExports.ts_language_symbol_count)(e), _ts_language_state_count = Module._ts_language_state_count = (e) => (_ts_language_state_count = Module._ts_language_state_count = wasmExports.ts_language_state_count)(e), _ts_language_version = Module._ts_language_version = (e) => (_ts_language_version = Module._ts_language_version = wasmExports.ts_language_version)(e), _ts_language_field_count = Module._ts_language_field_count = (e) => (_ts_language_field_count = Module._ts_language_field_count = wasmExports.ts_language_field_count)(e), _ts_language_next_state = Module._ts_language_next_state = (e, t, _) => (_ts_language_next_state = Module._ts_language_next_state = wasmExports.ts_language_next_state)(e, t, _), _ts_language_symbol_name = Module._ts_language_symbol_name = (e, t) => (_ts_language_symbol_name = Module._ts_language_symbol_name = wasmExports.ts_language_symbol_name)(e, t), _ts_language_symbol_for_name = Module._ts_language_symbol_for_name = (e, t, _, s) => (_ts_language_symbol_for_name = Module._ts_language_symbol_for_name = wasmExports.ts_language_symbol_for_name)(e, t, _, s), _strncmp = Module._strncmp = (e, t, _) => (_strncmp = Module._strncmp = wasmExports.strncmp)(e, t, _), _ts_language_symbol_type = Module._ts_language_symbol_type = (e, t) => (_ts_language_symbol_type = Module._ts_language_symbol_type = wasmExports.ts_language_symbol_type)(e, t), _ts_language_field_name_for_id = Module._ts_language_field_name_for_id = (e, t) => (_ts_language_field_name_for_id = Module._ts_language_field_name_for_id = wasmExports.ts_language_field_name_for_id)(e, t), _ts_lookahead_iterator_new = Module._ts_lookahead_iterator_new = (e, t) => (_ts_lookahead_iterator_new = Module._ts_lookahead_iterator_new = wasmExports.ts_lookahead_iterator_new)(e, t), _ts_lookahead_iterator_delete = Module._ts_lookahead_iterator_delete = (e) => (_ts_lookahead_iterator_delete = Module._ts_lookahead_iterator_delete = wasmExports.ts_lookahead_iterator_delete)(e), _ts_lookahead_iterator_reset_state = Module._ts_lookahead_iterator_reset_state = (e, t) => (_ts_lookahead_iterator_reset_state = Module._ts_lookahead_iterator_reset_state = wasmExports.ts_lookahead_iterator_reset_state)(e, t), _ts_lookahead_iterator_reset = Module._ts_lookahead_iterator_reset = (e, t, _) => (_ts_lookahead_iterator_reset = Module._ts_lookahead_iterator_reset = wasmExports.ts_lookahead_iterator_reset)(e, t, _), _ts_lookahead_iterator_next = Module._ts_lookahead_iterator_next = (e) => (_ts_lookahead_iterator_next = Module._ts_lookahead_iterator_next = wasmExports.ts_lookahead_iterator_next)(e), _ts_lookahead_iterator_current_symbol = Module._ts_lookahead_iterator_current_symbol = (e) => (_ts_lookahead_iterator_current_symbol = Module._ts_lookahead_iterator_current_symbol = wasmExports.ts_lookahead_iterator_current_symbol)(e), _memset = Module._memset = (e, t, _) => (_memset = Module._memset = wasmExports.memset)(e, t, _), _memcpy = Module._memcpy = (e, t, _) => (_memcpy = Module._memcpy = wasmExports.memcpy)(e, t, _), _ts_parser_delete = Module._ts_parser_delete = (e) => (_ts_parser_delete = Module._ts_parser_delete = wasmExports.ts_parser_delete)(e), _ts_parser_reset = Module._ts_parser_reset = (e) => (_ts_parser_reset = Module._ts_parser_reset = wasmExports.ts_parser_reset)(e), _ts_parser_set_language = Module._ts_parser_set_language = (e, t) => (_ts_parser_set_language = Module._ts_parser_set_language = wasmExports.ts_parser_set_language)(e, t), _ts_parser_timeout_micros = Module._ts_parser_timeout_micros = (e) => (_ts_parser_timeout_micros = Module._ts_parser_timeout_micros = wasmExports.ts_parser_timeout_micros)(e), _ts_parser_set_timeout_micros = Module._ts_parser_set_timeout_micros = (e, t, _) => (_ts_parser_set_timeout_micros = Module._ts_parser_set_timeout_micros = wasmExports.ts_parser_set_timeout_micros)(e, t, _), _ts_parser_set_included_ranges = Module._ts_parser_set_included_ranges = (e, t, _) => (_ts_parser_set_included_ranges = Module._ts_parser_set_included_ranges = wasmExports.ts_parser_set_included_ranges)(e, t, _), _memmove = Module._memmove = (e, t, _) => (_memmove = Module._memmove = wasmExports.memmove)(e, t, _), _memcmp = Module._memcmp = (e, t, _) => (_memcmp = Module._memcmp = wasmExports.memcmp)(e, t, _), _ts_query_new = Module._ts_query_new = (e, t, _, s, r) => (_ts_query_new = Module._ts_query_new = wasmExports.ts_query_new)(e, t, _, s, r), _ts_query_delete = Module._ts_query_delete = (e) => (_ts_query_delete = Module._ts_query_delete = wasmExports.ts_query_delete)(e), _iswspace = Module._iswspace = (e) => (_iswspace = Module._iswspace = wasmExports.iswspace)(e), _iswalnum = Module._iswalnum = (e) => (_iswalnum = Module._iswalnum = wasmExports.iswalnum)(e), _ts_query_pattern_count = Module._ts_query_pattern_count = (e) => (_ts_query_pattern_count = Module._ts_query_pattern_count = wasmExports.ts_query_pattern_count)(e), _ts_query_capture_count = Module._ts_query_capture_count = (e) => (_ts_query_capture_count = Module._ts_query_capture_count = wasmExports.ts_query_capture_count)(e), _ts_query_string_count = Module._ts_query_string_count = (e) => (_ts_query_string_count = Module._ts_query_string_count = wasmExports.ts_query_string_count)(e), _ts_query_capture_name_for_id = Module._ts_query_capture_name_for_id = (e, t, _) => (_ts_query_capture_name_for_id = Module._ts_query_capture_name_for_id = wasmExports.ts_query_capture_name_for_id)(e, t, _), _ts_query_string_value_for_id = Module._ts_query_string_value_for_id = (e, t, _) => (_ts_query_string_value_for_id = Module._ts_query_string_value_for_id = wasmExports.ts_query_string_value_for_id)(e, t, _), _ts_query_predicates_for_pattern = Module._ts_query_predicates_for_pattern = (e, t, _) => (_ts_query_predicates_for_pattern = Module._ts_query_predicates_for_pattern = wasmExports.ts_query_predicates_for_pattern)(e, t, _), _ts_query_disable_capture = Module._ts_query_disable_capture = (e, t, _) => (_ts_query_disable_capture = Module._ts_query_disable_capture = wasmExports.ts_query_disable_capture)(e, t, _), _ts_tree_copy = Module._ts_tree_copy = (e) => (_ts_tree_copy = Module._ts_tree_copy = wasmExports.ts_tree_copy)(e), _ts_tree_delete = Module._ts_tree_delete = (e) => (_ts_tree_delete = Module._ts_tree_delete = wasmExports.ts_tree_delete)(e), _ts_init = Module._ts_init = () => (_ts_init = Module._ts_init = wasmExports.ts_init)(), _ts_parser_new_wasm = Module._ts_parser_new_wasm = () => (_ts_parser_new_wasm = Module._ts_parser_new_wasm = wasmExports.ts_parser_new_wasm)(), _ts_parser_enable_logger_wasm = Module._ts_parser_enable_logger_wasm = (e, t) => (_ts_parser_enable_logger_wasm = Module._ts_parser_enable_logger_wasm = wasmExports.ts_parser_enable_logger_wasm)(e, t), _ts_parser_parse_wasm = Module._ts_parser_parse_wasm = (e, t, _, s, r) => (_ts_parser_parse_wasm = Module._ts_parser_parse_wasm = wasmExports.ts_parser_parse_wasm)(e, t, _, s, r), _ts_parser_included_ranges_wasm = Module._ts_parser_included_ranges_wasm = (e) => (_ts_parser_included_ranges_wasm = Module._ts_parser_included_ranges_wasm = wasmExports.ts_parser_included_ranges_wasm)(e), _ts_language_type_is_named_wasm = Module._ts_language_type_is_named_wasm = (e, t) => (_ts_language_type_is_named_wasm = Module._ts_language_type_is_named_wasm = wasmExports.ts_language_type_is_named_wasm)(e, t), _ts_language_type_is_visible_wasm = Module._ts_language_type_is_visible_wasm = (e, t) => (_ts_language_type_is_visible_wasm = Module._ts_language_type_is_visible_wasm = wasmExports.ts_language_type_is_visible_wasm)(e, t), _ts_tree_root_node_wasm = Module._ts_tree_root_node_wasm = (e) => (_ts_tree_root_node_wasm = Module._ts_tree_root_node_wasm = wasmExports.ts_tree_root_node_wasm)(e), _ts_tree_root_node_with_offset_wasm = Module._ts_tree_root_node_with_offset_wasm = (e) => (_ts_tree_root_node_with_offset_wasm = Module._ts_tree_root_node_with_offset_wasm = wasmExports.ts_tree_root_node_with_offset_wasm)(e), _ts_tree_edit_wasm = Module._ts_tree_edit_wasm = (e) => (_ts_tree_edit_wasm = Module._ts_tree_edit_wasm = wasmExports.ts_tree_edit_wasm)(e), _ts_tree_included_ranges_wasm = Module._ts_tree_included_ranges_wasm = (e) => (_ts_tree_included_ranges_wasm = Module._ts_tree_included_ranges_wasm = wasmExports.ts_tree_included_ranges_wasm)(e), _ts_tree_get_changed_ranges_wasm = Module._ts_tree_get_changed_ranges_wasm = (e, t) => (_ts_tree_get_changed_ranges_wasm = Module._ts_tree_get_changed_ranges_wasm = wasmExports.ts_tree_get_changed_ranges_wasm)(e, t), _ts_tree_cursor_new_wasm = Module._ts_tree_cursor_new_wasm = (e) => (_ts_tree_cursor_new_wasm = Module._ts_tree_cursor_new_wasm = wasmExports.ts_tree_cursor_new_wasm)(e), _ts_tree_cursor_delete_wasm = Module._ts_tree_cursor_delete_wasm = (e) => (_ts_tree_cursor_delete_wasm = Module._ts_tree_cursor_delete_wasm = wasmExports.ts_tree_cursor_delete_wasm)(e), _ts_tree_cursor_reset_wasm = Module._ts_tree_cursor_reset_wasm = (e) => (_ts_tree_cursor_reset_wasm = Module._ts_tree_cursor_reset_wasm = wasmExports.ts_tree_cursor_reset_wasm)(e), _ts_tree_cursor_reset_to_wasm = Module._ts_tree_cursor_reset_to_wasm = (e, t) => (_ts_tree_cursor_reset_to_wasm = Module._ts_tree_cursor_reset_to_wasm = wasmExports.ts_tree_cursor_reset_to_wasm)(e, t), _ts_tree_cursor_goto_first_child_wasm = Module._ts_tree_cursor_goto_first_child_wasm = (e) => (_ts_tree_cursor_goto_first_child_wasm = Module._ts_tree_cursor_goto_first_child_wasm = wasmExports.ts_tree_cursor_goto_first_child_wasm)(e), _ts_tree_cursor_goto_last_child_wasm = Module._ts_tree_cursor_goto_last_child_wasm = (e) => (_ts_tree_cursor_goto_last_child_wasm = Module._ts_tree_cursor_goto_last_child_wasm = wasmExports.ts_tree_cursor_goto_last_child_wasm)(e), _ts_tree_cursor_goto_first_child_for_index_wasm = Module._ts_tree_cursor_goto_first_child_for_index_wasm = (e) => (_ts_tree_cursor_goto_first_child_for_index_wasm = Module._ts_tree_cursor_goto_first_child_for_index_wasm = wasmExports.ts_tree_cursor_goto_first_child_for_index_wasm)(e), _ts_tree_cursor_goto_first_child_for_position_wasm = Module._ts_tree_cursor_goto_first_child_for_position_wasm = (e) => (_ts_tree_cursor_goto_first_child_for_position_wasm = Module._ts_tree_cursor_goto_first_child_for_position_wasm = wasmExports.ts_tree_cursor_goto_first_child_for_position_wasm)(e), _ts_tree_cursor_goto_next_sibling_wasm = Module._ts_tree_cursor_goto_next_sibling_wasm = (e) => (_ts_tree_cursor_goto_next_sibling_wasm = Module._ts_tree_cursor_goto_next_sibling_wasm = wasmExports.ts_tree_cursor_goto_next_sibling_wasm)(e), _ts_tree_cursor_goto_previous_sibling_wasm = Module._ts_tree_cursor_goto_previous_sibling_wasm = (e) => (_ts_tree_cursor_goto_previous_sibling_wasm = Module._ts_tree_cursor_goto_previous_sibling_wasm = wasmExports.ts_tree_cursor_goto_previous_sibling_wasm)(e), _ts_tree_cursor_goto_descendant_wasm = Module._ts_tree_cursor_goto_descendant_wasm = (e, t) => (_ts_tree_cursor_goto_descendant_wasm = Module._ts_tree_cursor_goto_descendant_wasm = wasmExports.ts_tree_cursor_goto_descendant_wasm)(e, t), _ts_tree_cursor_goto_parent_wasm = Module._ts_tree_cursor_goto_parent_wasm = (e) => (_ts_tree_cursor_goto_parent_wasm = Module._ts_tree_cursor_goto_parent_wasm = wasmExports.ts_tree_cursor_goto_parent_wasm)(e), _ts_tree_cursor_current_node_type_id_wasm = Module._ts_tree_cursor_current_node_type_id_wasm = (e) => (_ts_tree_cursor_current_node_type_id_wasm = Module._ts_tree_cursor_current_node_type_id_wasm = wasmExports.ts_tree_cursor_current_node_type_id_wasm)(e), _ts_tree_cursor_current_node_state_id_wasm = Module._ts_tree_cursor_current_node_state_id_wasm = (e) => (_ts_tree_cursor_current_node_state_id_wasm = Module._ts_tree_cursor_current_node_state_id_wasm = wasmExports.ts_tree_cursor_current_node_state_id_wasm)(e), _ts_tree_cursor_current_node_is_named_wasm = Module._ts_tree_cursor_current_node_is_named_wasm = (e) => (_ts_tree_cursor_current_node_is_named_wasm = Module._ts_tree_cursor_current_node_is_named_wasm = wasmExports.ts_tree_cursor_current_node_is_named_wasm)(e), _ts_tree_cursor_current_node_is_missing_wasm = Module._ts_tree_cursor_current_node_is_missing_wasm = (e) => (_ts_tree_cursor_current_node_is_missing_wasm = Module._ts_tree_cursor_current_node_is_missing_wasm = wasmExports.ts_tree_cursor_current_node_is_missing_wasm)(e), _ts_tree_cursor_current_node_id_wasm = Module._ts_tree_cursor_current_node_id_wasm = (e) => (_ts_tree_cursor_current_node_id_wasm = Module._ts_tree_cursor_current_node_id_wasm = wasmExports.ts_tree_cursor_current_node_id_wasm)(e), _ts_tree_cursor_start_position_wasm = Module._ts_tree_cursor_start_position_wasm = (e) => (_ts_tree_cursor_start_position_wasm = Module._ts_tree_cursor_start_position_wasm = wasmExports.ts_tree_cursor_start_position_wasm)(e), _ts_tree_cursor_end_position_wasm = Module._ts_tree_cursor_end_position_wasm = (e) => (_ts_tree_cursor_end_position_wasm = Module._ts_tree_cursor_end_position_wasm = wasmExports.ts_tree_cursor_end_position_wasm)(e), _ts_tree_cursor_start_index_wasm = Module._ts_tree_cursor_start_index_wasm = (e) => (_ts_tree_cursor_start_index_wasm = Module._ts_tree_cursor_start_index_wasm = wasmExports.ts_tree_cursor_start_index_wasm)(e), _ts_tree_cursor_end_index_wasm = Module._ts_tree_cursor_end_index_wasm = (e) => (_ts_tree_cursor_end_index_wasm = Module._ts_tree_cursor_end_index_wasm = wasmExports.ts_tree_cursor_end_index_wasm)(e), _ts_tree_cursor_current_field_id_wasm = Module._ts_tree_cursor_current_field_id_wasm = (e) => (_ts_tree_cursor_current_field_id_wasm = Module._ts_tree_cursor_current_field_id_wasm = wasmExports.ts_tree_cursor_current_field_id_wasm)(e), _ts_tree_cursor_current_depth_wasm = Module._ts_tree_cursor_current_depth_wasm = (e) => (_ts_tree_cursor_current_depth_wasm = Module._ts_tree_cursor_current_depth_wasm = wasmExports.ts_tree_cursor_current_depth_wasm)(e), _ts_tree_cursor_current_descendant_index_wasm = Module._ts_tree_cursor_current_descendant_index_wasm = (e) => (_ts_tree_cursor_current_descendant_index_wasm = Module._ts_tree_cursor_current_descendant_index_wasm = wasmExports.ts_tree_cursor_current_descendant_index_wasm)(e), _ts_tree_cursor_current_node_wasm = Module._ts_tree_cursor_current_node_wasm = (e) => (_ts_tree_cursor_current_node_wasm = Module._ts_tree_cursor_current_node_wasm = wasmExports.ts_tree_cursor_current_node_wasm)(e), _ts_node_symbol_wasm = Module._ts_node_symbol_wasm = (e) => (_ts_node_symbol_wasm = Module._ts_node_symbol_wasm = wasmExports.ts_node_symbol_wasm)(e), _ts_node_field_name_for_child_wasm = Module._ts_node_field_name_for_child_wasm = (e, t) => (_ts_node_field_name_for_child_wasm = Module._ts_node_field_name_for_child_wasm = wasmExports.ts_node_field_name_for_child_wasm)(e, t), _ts_node_children_by_field_id_wasm = Module._ts_node_children_by_field_id_wasm = (e, t) => (_ts_node_children_by_field_id_wasm = Module._ts_node_children_by_field_id_wasm = wasmExports.ts_node_children_by_field_id_wasm)(e, t), _ts_node_first_child_for_byte_wasm = Module._ts_node_first_child_for_byte_wasm = (e) => (_ts_node_first_child_for_byte_wasm = Module._ts_node_first_child_for_byte_wasm = wasmExports.ts_node_first_child_for_byte_wasm)(e), _ts_node_first_named_child_for_byte_wasm = Module._ts_node_first_named_child_for_byte_wasm = (e) => (_ts_node_first_named_child_for_byte_wasm = Module._ts_node_first_named_child_for_byte_wasm = wasmExports.ts_node_first_named_child_for_byte_wasm)(e), _ts_node_grammar_symbol_wasm = Module._ts_node_grammar_symbol_wasm = (e) => (_ts_node_grammar_symbol_wasm = Module._ts_node_grammar_symbol_wasm = wasmExports.ts_node_grammar_symbol_wasm)(e), _ts_node_child_count_wasm = Module._ts_node_child_count_wasm = (e) => (_ts_node_child_count_wasm = Module._ts_node_child_count_wasm = wasmExports.ts_node_child_count_wasm)(e), _ts_node_named_child_count_wasm = Module._ts_node_named_child_count_wasm = (e) => (_ts_node_named_child_count_wasm = Module._ts_node_named_child_count_wasm = wasmExports.ts_node_named_child_count_wasm)(e), _ts_node_child_wasm = Module._ts_node_child_wasm = (e, t) => (_ts_node_child_wasm = Module._ts_node_child_wasm = wasmExports.ts_node_child_wasm)(e, t), _ts_node_named_child_wasm = Module._ts_node_named_child_wasm = (e, t) => (_ts_node_named_child_wasm = Module._ts_node_named_child_wasm = wasmExports.ts_node_named_child_wasm)(e, t), _ts_node_child_by_field_id_wasm = Module._ts_node_child_by_field_id_wasm = (e, t) => (_ts_node_child_by_field_id_wasm = Module._ts_node_child_by_field_id_wasm = wasmExports.ts_node_child_by_field_id_wasm)(e, t), _ts_node_next_sibling_wasm = Module._ts_node_next_sibling_wasm = (e) => (_ts_node_next_sibling_wasm = Module._ts_node_next_sibling_wasm = wasmExports.ts_node_next_sibling_wasm)(e), _ts_node_prev_sibling_wasm = Module._ts_node_prev_sibling_wasm = (e) => (_ts_node_prev_sibling_wasm = Module._ts_node_prev_sibling_wasm = wasmExports.ts_node_prev_sibling_wasm)(e), _ts_node_next_named_sibling_wasm = Module._ts_node_next_named_sibling_wasm = (e) => (_ts_node_next_named_sibling_wasm = Module._ts_node_next_named_sibling_wasm = wasmExports.ts_node_next_named_sibling_wasm)(e), _ts_node_prev_named_sibling_wasm = Module._ts_node_prev_named_sibling_wasm = (e) => (_ts_node_prev_named_sibling_wasm = Module._ts_node_prev_named_sibling_wasm = wasmExports.ts_node_prev_named_sibling_wasm)(e), _ts_node_descendant_count_wasm = Module._ts_node_descendant_count_wasm = (e) => (_ts_node_descendant_count_wasm = Module._ts_node_descendant_count_wasm = wasmExports.ts_node_descendant_count_wasm)(e), _ts_node_parent_wasm = Module._ts_node_parent_wasm = (e) => (_ts_node_parent_wasm = Module._ts_node_parent_wasm = wasmExports.ts_node_parent_wasm)(e), _ts_node_descendant_for_index_wasm = Module._ts_node_descendant_for_index_wasm = (e) => (_ts_node_descendant_for_index_wasm = Module._ts_node_descendant_for_index_wasm = wasmExports.ts_node_descendant_for_index_wasm)(e), _ts_node_named_descendant_for_index_wasm = Module._ts_node_named_descendant_for_index_wasm = (e) => (_ts_node_named_descendant_for_index_wasm = Module._ts_node_named_descendant_for_index_wasm = wasmExports.ts_node_named_descendant_for_index_wasm)(e), _ts_node_descendant_for_position_wasm = Module._ts_node_descendant_for_position_wasm = (e) => (_ts_node_descendant_for_position_wasm = Module._ts_node_descendant_for_position_wasm = wasmExports.ts_node_descendant_for_position_wasm)(e), _ts_node_named_descendant_for_position_wasm = Module._ts_node_named_descendant_for_position_wasm = (e) => (_ts_node_named_descendant_for_position_wasm = Module._ts_node_named_descendant_for_position_wasm = wasmExports.ts_node_named_descendant_for_position_wasm)(e), _ts_node_start_point_wasm = Module._ts_node_start_point_wasm = (e) => (_ts_node_start_point_wasm = Module._ts_node_start_point_wasm = wasmExports.ts_node_start_point_wasm)(e), _ts_node_end_point_wasm = Module._ts_node_end_point_wasm = (e) => (_ts_node_end_point_wasm = Module._ts_node_end_point_wasm = wasmExports.ts_node_end_point_wasm)(e), _ts_node_start_index_wasm = Module._ts_node_start_index_wasm = (e) => (_ts_node_start_index_wasm = Module._ts_node_start_index_wasm = wasmExports.ts_node_start_index_wasm)(e), _ts_node_end_index_wasm = Module._ts_node_end_index_wasm = (e) => (_ts_node_end_index_wasm = Module._ts_node_end_index_wasm = wasmExports.ts_node_end_index_wasm)(e), _ts_node_to_string_wasm = Module._ts_node_to_string_wasm = (e) => (_ts_node_to_string_wasm = Module._ts_node_to_string_wasm = wasmExports.ts_node_to_string_wasm)(e), _ts_node_children_wasm = Module._ts_node_children_wasm = (e) => (_ts_node_children_wasm = Module._ts_node_children_wasm = wasmExports.ts_node_children_wasm)(e), _ts_node_named_children_wasm = Module._ts_node_named_children_wasm = (e) => (_ts_node_named_children_wasm = Module._ts_node_named_children_wasm = wasmExports.ts_node_named_children_wasm)(e), _ts_node_descendants_of_type_wasm = Module._ts_node_descendants_of_type_wasm = (e, t, _, s, r, a, o) => (_ts_node_descendants_of_type_wasm = Module._ts_node_descendants_of_type_wasm = wasmExports.ts_node_descendants_of_type_wasm)(e, t, _, s, r, a, o), _ts_node_is_named_wasm = Module._ts_node_is_named_wasm = (e) => (_ts_node_is_named_wasm = Module._ts_node_is_named_wasm = wasmExports.ts_node_is_named_wasm)(e), _ts_node_has_changes_wasm = Module._ts_node_has_changes_wasm = (e) => (_ts_node_has_changes_wasm = Module._ts_node_has_changes_wasm = wasmExports.ts_node_has_changes_wasm)(e), _ts_node_has_error_wasm = Module._ts_node_has_error_wasm = (e) => (_ts_node_has_error_wasm = Module._ts_node_has_error_wasm = wasmExports.ts_node_has_error_wasm)(e), _ts_node_is_error_wasm = Module._ts_node_is_error_wasm = (e) => (_ts_node_is_error_wasm = Module._ts_node_is_error_wasm = wasmExports.ts_node_is_error_wasm)(e), _ts_node_is_missing_wasm = Module._ts_node_is_missing_wasm = (e) => (_ts_node_is_missing_wasm = Module._ts_node_is_missing_wasm = wasmExports.ts_node_is_missing_wasm)(e), _ts_node_is_extra_wasm = Module._ts_node_is_extra_wasm = (e) => (_ts_node_is_extra_wasm = Module._ts_node_is_extra_wasm = wasmExports.ts_node_is_extra_wasm)(e), _ts_node_parse_state_wasm = Module._ts_node_parse_state_wasm = (e) => (_ts_node_parse_state_wasm = Module._ts_node_parse_state_wasm = wasmExports.ts_node_parse_state_wasm)(e), _ts_node_next_parse_state_wasm = Module._ts_node_next_parse_state_wasm = (e) => (_ts_node_next_parse_state_wasm = Module._ts_node_next_parse_state_wasm = wasmExports.ts_node_next_parse_state_wasm)(e), _ts_query_matches_wasm = Module._ts_query_matches_wasm = (e, t, _, s, r, a, o, n, l, d) => (_ts_query_matches_wasm = Module._ts_query_matches_wasm = wasmExports.ts_query_matches_wasm)(e, t, _, s, r, a, o, n, l, d), _ts_query_captures_wasm = Module._ts_query_captures_wasm = (e, t, _, s, r, a, o, n, l, d) => (_ts_query_captures_wasm = Module._ts_query_captures_wasm = wasmExports.ts_query_captures_wasm)(e, t, _, s, r, a, o, n, l, d), _iswalpha = Module._iswalpha = (e) => (_iswalpha = Module._iswalpha = wasmExports.iswalpha)(e), _iswblank = Module._iswblank = (e) => (_iswblank = Module._iswblank = wasmExports.iswblank)(e), _iswdigit = Module._iswdigit = (e) => (_iswdigit = Module._iswdigit = wasmExports.iswdigit)(e), _iswlower = Module._iswlower = (e) => (_iswlower = Module._iswlower = wasmExports.iswlower)(e), _iswupper = Module._iswupper = (e) => (_iswupper = Module._iswupper = wasmExports.iswupper)(e), _iswxdigit = Module._iswxdigit = (e) => (_iswxdigit = Module._iswxdigit = wasmExports.iswxdigit)(e), _memchr = Module._memchr = (e, t, _) => (_memchr = Module._memchr = wasmExports.memchr)(e, t, _), _strlen = Module._strlen = (e) => (_strlen = Module._strlen = wasmExports.strlen)(e), _strcmp = Module._strcmp = (e, t) => (_strcmp = Module._strcmp = wasmExports.strcmp)(e, t), _strncat = Module._strncat = (e, t, _) => (_strncat = Module._strncat = wasmExports.strncat)(e, t, _), _strncpy = Module._strncpy = (e, t, _) => (_strncpy = Module._strncpy = wasmExports.strncpy)(e, t, _), _towlower = Module._towlower = (e) => (_towlower = Module._towlower = wasmExports.towlower)(e), _towupper = Module._towupper = (e) => (_towupper = Module._towupper = wasmExports.towupper)(e), _setThrew = (e, t) => (_setThrew = wasmExports.setThrew)(e, t), stackSave = () => (stackSave = wasmExports.stackSave)(), stackRestore = (e) => (stackRestore = wasmExports.stackRestore)(e), stackAlloc = (e) => (stackAlloc = wasmExports.stackAlloc)(e), dynCall_jiji = Module.dynCall_jiji = (e, t, _, s, r) => (dynCall_jiji = Module.dynCall_jiji = wasmExports.dynCall_jiji)(e, t, _, s, r), _orig$ts_parser_timeout_micros = Module._orig$ts_parser_timeout_micros = (e) => (_orig$ts_parser_timeout_micros = Module._orig$ts_parser_timeout_micros = wasmExports.orig$ts_parser_timeout_micros)(e), _orig$ts_parser_set_timeout_micros = Module._orig$ts_parser_set_timeout_micros = (e, t) => (_orig$ts_parser_set_timeout_micros = Module._orig$ts_parser_set_timeout_micros = wasmExports.orig$ts_parser_set_timeout_micros)(e, t), calledRun;
610
+ function callMain(e = []) {
611
+ var t = resolveGlobalSymbol("main").sym;
612
+ if (t) {
613
+ e.unshift(thisProgram);
614
+ var _ = e.length, s = stackAlloc(4 * (_ + 1)), r = s;
615
+ e.forEach((e2) => {
616
+ HEAPU32[r >> 2] = stringToUTF8OnStack(e2), r += 4;
617
+ }), HEAPU32[r >> 2] = 0;
618
+ try {
619
+ var a = t(_, s);
620
+ return exitJS(a, true), a;
621
+ } catch (e2) {
622
+ return handleException(e2);
623
+ }
624
+ }
625
+ }
626
+ function run(e = arguments_) {
627
+ function t() {
628
+ calledRun || (calledRun = true, Module.calledRun = true, ABORT || (initRuntime(), preMain(), Module.onRuntimeInitialized && Module.onRuntimeInitialized(), shouldRunNow && callMain(e), postRun()));
629
+ }
630
+ runDependencies > 0 || (preRun(), runDependencies > 0 || (Module.setStatus ? (Module.setStatus("Running..."), setTimeout(function() {
631
+ setTimeout(function() {
632
+ Module.setStatus("");
633
+ }, 1), t();
634
+ }, 1)) : t()));
635
+ }
636
+ if (Module.AsciiToString = AsciiToString, Module.stringToUTF16 = stringToUTF16, dependenciesFulfilled = function e() {
637
+ calledRun || run(), calledRun || (dependenciesFulfilled = e);
638
+ }, Module.preInit) for ("function" == typeof Module.preInit && (Module.preInit = [Module.preInit]); Module.preInit.length > 0; ) Module.preInit.pop()();
639
+ var shouldRunNow = true;
640
+ Module.noInitialRun && (shouldRunNow = false), run();
641
+ const C = Module, INTERNAL = {}, SIZE_OF_INT = 4, SIZE_OF_CURSOR = 4 * SIZE_OF_INT, SIZE_OF_NODE = 5 * SIZE_OF_INT, SIZE_OF_POINT = 2 * SIZE_OF_INT, SIZE_OF_RANGE = 2 * SIZE_OF_INT + 2 * SIZE_OF_POINT, ZERO_POINT = { row: 0, column: 0 }, QUERY_WORD_REGEX = /[\w-.]*/g, PREDICATE_STEP_TYPE_CAPTURE = 1, PREDICATE_STEP_TYPE_STRING = 2, LANGUAGE_FUNCTION_REGEX = /^_?tree_sitter_\w+/;
642
+ let VERSION, MIN_COMPATIBLE_VERSION, TRANSFER_BUFFER, currentParseCallback, currentLogCallback;
643
+ class ParserImpl {
644
+ static init() {
645
+ TRANSFER_BUFFER = C._ts_init(), VERSION = getValue(TRANSFER_BUFFER, "i32"), MIN_COMPATIBLE_VERSION = getValue(TRANSFER_BUFFER + SIZE_OF_INT, "i32");
646
+ }
647
+ initialize() {
648
+ C._ts_parser_new_wasm(), this[0] = getValue(TRANSFER_BUFFER, "i32"), this[1] = getValue(TRANSFER_BUFFER + SIZE_OF_INT, "i32");
649
+ }
650
+ delete() {
651
+ C._ts_parser_delete(this[0]), C._free(this[1]), this[0] = 0, this[1] = 0;
652
+ }
653
+ setLanguage(e) {
654
+ let t;
655
+ if (e) {
656
+ if (e.constructor !== Language) throw new Error("Argument must be a Language");
657
+ {
658
+ t = e[0];
659
+ const _ = C._ts_language_version(t);
660
+ if (_ < MIN_COMPATIBLE_VERSION || VERSION < _) throw new Error(`Incompatible language version ${_}. Compatibility range ${MIN_COMPATIBLE_VERSION} through ${VERSION}.`);
661
+ }
662
+ } else t = 0, e = null;
663
+ return this.language = e, C._ts_parser_set_language(this[0], t), this;
664
+ }
665
+ getLanguage() {
666
+ return this.language;
667
+ }
668
+ parse(e, t, _) {
669
+ if ("string" == typeof e) currentParseCallback = (t2, _2) => e.slice(t2);
670
+ else {
671
+ if ("function" != typeof e) throw new Error("Argument must be a string or a function");
672
+ currentParseCallback = e;
673
+ }
674
+ this.logCallback ? (currentLogCallback = this.logCallback, C._ts_parser_enable_logger_wasm(this[0], 1)) : (currentLogCallback = null, C._ts_parser_enable_logger_wasm(this[0], 0));
675
+ let s = 0, r = 0;
676
+ if (_?.includedRanges) {
677
+ s = _.includedRanges.length, r = C._calloc(s, SIZE_OF_RANGE);
678
+ let e2 = r;
679
+ for (let t2 = 0; t2 < s; t2++) marshalRange(e2, _.includedRanges[t2]), e2 += SIZE_OF_RANGE;
680
+ }
681
+ const a = C._ts_parser_parse_wasm(this[0], this[1], t ? t[0] : 0, r, s);
682
+ if (!a) throw currentParseCallback = null, currentLogCallback = null, new Error("Parsing failed");
683
+ const o = new Tree(INTERNAL, a, this.language, currentParseCallback);
684
+ return currentParseCallback = null, currentLogCallback = null, o;
685
+ }
686
+ reset() {
687
+ C._ts_parser_reset(this[0]);
688
+ }
689
+ getIncludedRanges() {
690
+ C._ts_parser_included_ranges_wasm(this[0]);
691
+ const e = getValue(TRANSFER_BUFFER, "i32"), t = getValue(TRANSFER_BUFFER + SIZE_OF_INT, "i32"), _ = new Array(e);
692
+ if (e > 0) {
693
+ let s = t;
694
+ for (let t2 = 0; t2 < e; t2++) _[t2] = unmarshalRange(s), s += SIZE_OF_RANGE;
695
+ C._free(t);
696
+ }
697
+ return _;
698
+ }
699
+ getTimeoutMicros() {
700
+ return C._ts_parser_timeout_micros(this[0]);
701
+ }
702
+ setTimeoutMicros(e) {
703
+ C._ts_parser_set_timeout_micros(this[0], e);
704
+ }
705
+ setLogger(e) {
706
+ if (e) {
707
+ if ("function" != typeof e) throw new Error("Logger callback must be a function");
708
+ } else e = null;
709
+ return this.logCallback = e, this;
710
+ }
711
+ getLogger() {
712
+ return this.logCallback;
713
+ }
714
+ }
715
+ class Tree {
716
+ constructor(e, t, _, s) {
717
+ assertInternal(e), this[0] = t, this.language = _, this.textCallback = s;
718
+ }
719
+ copy() {
720
+ const e = C._ts_tree_copy(this[0]);
721
+ return new Tree(INTERNAL, e, this.language, this.textCallback);
722
+ }
723
+ delete() {
724
+ C._ts_tree_delete(this[0]), this[0] = 0;
725
+ }
726
+ edit(e) {
727
+ marshalEdit(e), C._ts_tree_edit_wasm(this[0]);
728
+ }
729
+ get rootNode() {
730
+ return C._ts_tree_root_node_wasm(this[0]), unmarshalNode(this);
731
+ }
732
+ rootNodeWithOffset(e, t) {
733
+ const _ = TRANSFER_BUFFER + SIZE_OF_NODE;
734
+ return setValue(_, e, "i32"), marshalPoint(_ + SIZE_OF_INT, t), C._ts_tree_root_node_with_offset_wasm(this[0]), unmarshalNode(this);
735
+ }
736
+ getLanguage() {
737
+ return this.language;
738
+ }
739
+ walk() {
740
+ return this.rootNode.walk();
741
+ }
742
+ getChangedRanges(e) {
743
+ if (e.constructor !== Tree) throw new TypeError("Argument must be a Tree");
744
+ C._ts_tree_get_changed_ranges_wasm(this[0], e[0]);
745
+ const t = getValue(TRANSFER_BUFFER, "i32"), _ = getValue(TRANSFER_BUFFER + SIZE_OF_INT, "i32"), s = new Array(t);
746
+ if (t > 0) {
747
+ let e2 = _;
748
+ for (let _2 = 0; _2 < t; _2++) s[_2] = unmarshalRange(e2), e2 += SIZE_OF_RANGE;
749
+ C._free(_);
750
+ }
751
+ return s;
752
+ }
753
+ getIncludedRanges() {
754
+ C._ts_tree_included_ranges_wasm(this[0]);
755
+ const e = getValue(TRANSFER_BUFFER, "i32"), t = getValue(TRANSFER_BUFFER + SIZE_OF_INT, "i32"), _ = new Array(e);
756
+ if (e > 0) {
757
+ let s = t;
758
+ for (let t2 = 0; t2 < e; t2++) _[t2] = unmarshalRange(s), s += SIZE_OF_RANGE;
759
+ C._free(t);
760
+ }
761
+ return _;
762
+ }
763
+ }
764
+ class Node {
765
+ constructor(e, t) {
766
+ assertInternal(e), this.tree = t;
767
+ }
768
+ get typeId() {
769
+ return marshalNode(this), C._ts_node_symbol_wasm(this.tree[0]);
770
+ }
771
+ get grammarId() {
772
+ return marshalNode(this), C._ts_node_grammar_symbol_wasm(this.tree[0]);
773
+ }
774
+ get type() {
775
+ return this.tree.language.types[this.typeId] || "ERROR";
776
+ }
777
+ get grammarType() {
778
+ return this.tree.language.types[this.grammarId] || "ERROR";
779
+ }
780
+ get endPosition() {
781
+ return marshalNode(this), C._ts_node_end_point_wasm(this.tree[0]), unmarshalPoint(TRANSFER_BUFFER);
782
+ }
783
+ get endIndex() {
784
+ return marshalNode(this), C._ts_node_end_index_wasm(this.tree[0]);
785
+ }
786
+ get text() {
787
+ return getText(this.tree, this.startIndex, this.endIndex);
788
+ }
789
+ get parseState() {
790
+ return marshalNode(this), C._ts_node_parse_state_wasm(this.tree[0]);
791
+ }
792
+ get nextParseState() {
793
+ return marshalNode(this), C._ts_node_next_parse_state_wasm(this.tree[0]);
794
+ }
795
+ get isNamed() {
796
+ return marshalNode(this), 1 === C._ts_node_is_named_wasm(this.tree[0]);
797
+ }
798
+ get hasError() {
799
+ return marshalNode(this), 1 === C._ts_node_has_error_wasm(this.tree[0]);
800
+ }
801
+ get hasChanges() {
802
+ return marshalNode(this), 1 === C._ts_node_has_changes_wasm(this.tree[0]);
803
+ }
804
+ get isError() {
805
+ return marshalNode(this), 1 === C._ts_node_is_error_wasm(this.tree[0]);
806
+ }
807
+ get isMissing() {
808
+ return marshalNode(this), 1 === C._ts_node_is_missing_wasm(this.tree[0]);
809
+ }
810
+ get isExtra() {
811
+ return marshalNode(this), 1 === C._ts_node_is_extra_wasm(this.tree[0]);
812
+ }
813
+ equals(e) {
814
+ return this.id === e.id;
815
+ }
816
+ child(e) {
817
+ return marshalNode(this), C._ts_node_child_wasm(this.tree[0], e), unmarshalNode(this.tree);
818
+ }
819
+ namedChild(e) {
820
+ return marshalNode(this), C._ts_node_named_child_wasm(this.tree[0], e), unmarshalNode(this.tree);
821
+ }
822
+ childForFieldId(e) {
823
+ return marshalNode(this), C._ts_node_child_by_field_id_wasm(this.tree[0], e), unmarshalNode(this.tree);
824
+ }
825
+ childForFieldName(e) {
826
+ const t = this.tree.language.fields.indexOf(e);
827
+ return -1 !== t ? this.childForFieldId(t) : null;
828
+ }
829
+ fieldNameForChild(e) {
830
+ marshalNode(this);
831
+ const t = C._ts_node_field_name_for_child_wasm(this.tree[0], e);
832
+ if (!t) return null;
833
+ return AsciiToString(t);
834
+ }
835
+ childrenForFieldName(e) {
836
+ const t = this.tree.language.fields.indexOf(e);
837
+ return -1 !== t && 0 !== t ? this.childrenForFieldId(t) : [];
838
+ }
839
+ childrenForFieldId(e) {
840
+ marshalNode(this), C._ts_node_children_by_field_id_wasm(this.tree[0], e);
841
+ const t = getValue(TRANSFER_BUFFER, "i32"), _ = getValue(TRANSFER_BUFFER + SIZE_OF_INT, "i32"), s = new Array(t);
842
+ if (t > 0) {
843
+ let e2 = _;
844
+ for (let _2 = 0; _2 < t; _2++) s[_2] = unmarshalNode(this.tree, e2), e2 += SIZE_OF_NODE;
845
+ C._free(_);
846
+ }
847
+ return s;
848
+ }
849
+ firstChildForIndex(e) {
850
+ marshalNode(this);
851
+ return setValue(TRANSFER_BUFFER + SIZE_OF_NODE, e, "i32"), C._ts_node_first_child_for_byte_wasm(this.tree[0]), unmarshalNode(this.tree);
852
+ }
853
+ firstNamedChildForIndex(e) {
854
+ marshalNode(this);
855
+ return setValue(TRANSFER_BUFFER + SIZE_OF_NODE, e, "i32"), C._ts_node_first_named_child_for_byte_wasm(this.tree[0]), unmarshalNode(this.tree);
856
+ }
857
+ get childCount() {
858
+ return marshalNode(this), C._ts_node_child_count_wasm(this.tree[0]);
859
+ }
860
+ get namedChildCount() {
861
+ return marshalNode(this), C._ts_node_named_child_count_wasm(this.tree[0]);
862
+ }
863
+ get firstChild() {
864
+ return this.child(0);
865
+ }
866
+ get firstNamedChild() {
867
+ return this.namedChild(0);
868
+ }
869
+ get lastChild() {
870
+ return this.child(this.childCount - 1);
871
+ }
872
+ get lastNamedChild() {
873
+ return this.namedChild(this.namedChildCount - 1);
874
+ }
875
+ get children() {
876
+ if (!this._children) {
877
+ marshalNode(this), C._ts_node_children_wasm(this.tree[0]);
878
+ const e = getValue(TRANSFER_BUFFER, "i32"), t = getValue(TRANSFER_BUFFER + SIZE_OF_INT, "i32");
879
+ if (this._children = new Array(e), e > 0) {
880
+ let _ = t;
881
+ for (let t2 = 0; t2 < e; t2++) this._children[t2] = unmarshalNode(this.tree, _), _ += SIZE_OF_NODE;
882
+ C._free(t);
883
+ }
884
+ }
885
+ return this._children;
886
+ }
887
+ get namedChildren() {
888
+ if (!this._namedChildren) {
889
+ marshalNode(this), C._ts_node_named_children_wasm(this.tree[0]);
890
+ const e = getValue(TRANSFER_BUFFER, "i32"), t = getValue(TRANSFER_BUFFER + SIZE_OF_INT, "i32");
891
+ if (this._namedChildren = new Array(e), e > 0) {
892
+ let _ = t;
893
+ for (let t2 = 0; t2 < e; t2++) this._namedChildren[t2] = unmarshalNode(this.tree, _), _ += SIZE_OF_NODE;
894
+ C._free(t);
895
+ }
896
+ }
897
+ return this._namedChildren;
898
+ }
899
+ descendantsOfType(e, t, _) {
900
+ Array.isArray(e) || (e = [e]), t || (t = ZERO_POINT), _ || (_ = ZERO_POINT);
901
+ const s = [], r = this.tree.language.types;
902
+ for (let t2 = 0, _2 = r.length; t2 < _2; t2++) e.includes(r[t2]) && s.push(t2);
903
+ const a = C._malloc(SIZE_OF_INT * s.length);
904
+ for (let e2 = 0, t2 = s.length; e2 < t2; e2++) setValue(a + e2 * SIZE_OF_INT, s[e2], "i32");
905
+ marshalNode(this), C._ts_node_descendants_of_type_wasm(this.tree[0], a, s.length, t.row, t.column, _.row, _.column);
906
+ const o = getValue(TRANSFER_BUFFER, "i32"), n = getValue(TRANSFER_BUFFER + SIZE_OF_INT, "i32"), l = new Array(o);
907
+ if (o > 0) {
908
+ let e2 = n;
909
+ for (let t2 = 0; t2 < o; t2++) l[t2] = unmarshalNode(this.tree, e2), e2 += SIZE_OF_NODE;
910
+ }
911
+ return C._free(n), C._free(a), l;
912
+ }
913
+ get nextSibling() {
914
+ return marshalNode(this), C._ts_node_next_sibling_wasm(this.tree[0]), unmarshalNode(this.tree);
915
+ }
916
+ get previousSibling() {
917
+ return marshalNode(this), C._ts_node_prev_sibling_wasm(this.tree[0]), unmarshalNode(this.tree);
918
+ }
919
+ get nextNamedSibling() {
920
+ return marshalNode(this), C._ts_node_next_named_sibling_wasm(this.tree[0]), unmarshalNode(this.tree);
921
+ }
922
+ get previousNamedSibling() {
923
+ return marshalNode(this), C._ts_node_prev_named_sibling_wasm(this.tree[0]), unmarshalNode(this.tree);
924
+ }
925
+ get descendantCount() {
926
+ return marshalNode(this), C._ts_node_descendant_count_wasm(this.tree[0]);
927
+ }
928
+ get parent() {
929
+ return marshalNode(this), C._ts_node_parent_wasm(this.tree[0]), unmarshalNode(this.tree);
930
+ }
931
+ descendantForIndex(e, t = e) {
932
+ if ("number" != typeof e || "number" != typeof t) throw new Error("Arguments must be numbers");
933
+ marshalNode(this);
934
+ const _ = TRANSFER_BUFFER + SIZE_OF_NODE;
935
+ return setValue(_, e, "i32"), setValue(_ + SIZE_OF_INT, t, "i32"), C._ts_node_descendant_for_index_wasm(this.tree[0]), unmarshalNode(this.tree);
936
+ }
937
+ namedDescendantForIndex(e, t = e) {
938
+ if ("number" != typeof e || "number" != typeof t) throw new Error("Arguments must be numbers");
939
+ marshalNode(this);
940
+ const _ = TRANSFER_BUFFER + SIZE_OF_NODE;
941
+ return setValue(_, e, "i32"), setValue(_ + SIZE_OF_INT, t, "i32"), C._ts_node_named_descendant_for_index_wasm(this.tree[0]), unmarshalNode(this.tree);
942
+ }
943
+ descendantForPosition(e, t = e) {
944
+ if (!isPoint(e) || !isPoint(t)) throw new Error("Arguments must be {row, column} objects");
945
+ marshalNode(this);
946
+ const _ = TRANSFER_BUFFER + SIZE_OF_NODE;
947
+ return marshalPoint(_, e), marshalPoint(_ + SIZE_OF_POINT, t), C._ts_node_descendant_for_position_wasm(this.tree[0]), unmarshalNode(this.tree);
948
+ }
949
+ namedDescendantForPosition(e, t = e) {
950
+ if (!isPoint(e) || !isPoint(t)) throw new Error("Arguments must be {row, column} objects");
951
+ marshalNode(this);
952
+ const _ = TRANSFER_BUFFER + SIZE_OF_NODE;
953
+ return marshalPoint(_, e), marshalPoint(_ + SIZE_OF_POINT, t), C._ts_node_named_descendant_for_position_wasm(this.tree[0]), unmarshalNode(this.tree);
954
+ }
955
+ walk() {
956
+ return marshalNode(this), C._ts_tree_cursor_new_wasm(this.tree[0]), new TreeCursor(INTERNAL, this.tree);
957
+ }
958
+ toString() {
959
+ marshalNode(this);
960
+ const e = C._ts_node_to_string_wasm(this.tree[0]), t = AsciiToString(e);
961
+ return C._free(e), t;
962
+ }
963
+ }
964
+ class TreeCursor {
965
+ constructor(e, t) {
966
+ assertInternal(e), this.tree = t, unmarshalTreeCursor(this);
967
+ }
968
+ delete() {
969
+ marshalTreeCursor(this), C._ts_tree_cursor_delete_wasm(this.tree[0]), this[0] = this[1] = this[2] = 0;
970
+ }
971
+ reset(e) {
972
+ marshalNode(e), marshalTreeCursor(this, TRANSFER_BUFFER + SIZE_OF_NODE), C._ts_tree_cursor_reset_wasm(this.tree[0]), unmarshalTreeCursor(this);
973
+ }
974
+ resetTo(e) {
975
+ marshalTreeCursor(this, TRANSFER_BUFFER), marshalTreeCursor(e, TRANSFER_BUFFER + SIZE_OF_CURSOR), C._ts_tree_cursor_reset_to_wasm(this.tree[0], e.tree[0]), unmarshalTreeCursor(this);
976
+ }
977
+ get nodeType() {
978
+ return this.tree.language.types[this.nodeTypeId] || "ERROR";
979
+ }
980
+ get nodeTypeId() {
981
+ return marshalTreeCursor(this), C._ts_tree_cursor_current_node_type_id_wasm(this.tree[0]);
982
+ }
983
+ get nodeStateId() {
984
+ return marshalTreeCursor(this), C._ts_tree_cursor_current_node_state_id_wasm(this.tree[0]);
985
+ }
986
+ get nodeId() {
987
+ return marshalTreeCursor(this), C._ts_tree_cursor_current_node_id_wasm(this.tree[0]);
988
+ }
989
+ get nodeIsNamed() {
990
+ return marshalTreeCursor(this), 1 === C._ts_tree_cursor_current_node_is_named_wasm(this.tree[0]);
991
+ }
992
+ get nodeIsMissing() {
993
+ return marshalTreeCursor(this), 1 === C._ts_tree_cursor_current_node_is_missing_wasm(this.tree[0]);
994
+ }
995
+ get nodeText() {
996
+ marshalTreeCursor(this);
997
+ const e = C._ts_tree_cursor_start_index_wasm(this.tree[0]), t = C._ts_tree_cursor_end_index_wasm(this.tree[0]);
998
+ return getText(this.tree, e, t);
999
+ }
1000
+ get startPosition() {
1001
+ return marshalTreeCursor(this), C._ts_tree_cursor_start_position_wasm(this.tree[0]), unmarshalPoint(TRANSFER_BUFFER);
1002
+ }
1003
+ get endPosition() {
1004
+ return marshalTreeCursor(this), C._ts_tree_cursor_end_position_wasm(this.tree[0]), unmarshalPoint(TRANSFER_BUFFER);
1005
+ }
1006
+ get startIndex() {
1007
+ return marshalTreeCursor(this), C._ts_tree_cursor_start_index_wasm(this.tree[0]);
1008
+ }
1009
+ get endIndex() {
1010
+ return marshalTreeCursor(this), C._ts_tree_cursor_end_index_wasm(this.tree[0]);
1011
+ }
1012
+ get currentNode() {
1013
+ return marshalTreeCursor(this), C._ts_tree_cursor_current_node_wasm(this.tree[0]), unmarshalNode(this.tree);
1014
+ }
1015
+ get currentFieldId() {
1016
+ return marshalTreeCursor(this), C._ts_tree_cursor_current_field_id_wasm(this.tree[0]);
1017
+ }
1018
+ get currentFieldName() {
1019
+ return this.tree.language.fields[this.currentFieldId];
1020
+ }
1021
+ get currentDepth() {
1022
+ return marshalTreeCursor(this), C._ts_tree_cursor_current_depth_wasm(this.tree[0]);
1023
+ }
1024
+ get currentDescendantIndex() {
1025
+ return marshalTreeCursor(this), C._ts_tree_cursor_current_descendant_index_wasm(this.tree[0]);
1026
+ }
1027
+ gotoFirstChild() {
1028
+ marshalTreeCursor(this);
1029
+ const e = C._ts_tree_cursor_goto_first_child_wasm(this.tree[0]);
1030
+ return unmarshalTreeCursor(this), 1 === e;
1031
+ }
1032
+ gotoLastChild() {
1033
+ marshalTreeCursor(this);
1034
+ const e = C._ts_tree_cursor_goto_last_child_wasm(this.tree[0]);
1035
+ return unmarshalTreeCursor(this), 1 === e;
1036
+ }
1037
+ gotoFirstChildForIndex(e) {
1038
+ marshalTreeCursor(this), setValue(TRANSFER_BUFFER + SIZE_OF_CURSOR, e, "i32");
1039
+ const t = C._ts_tree_cursor_goto_first_child_for_index_wasm(this.tree[0]);
1040
+ return unmarshalTreeCursor(this), 1 === t;
1041
+ }
1042
+ gotoFirstChildForPosition(e) {
1043
+ marshalTreeCursor(this), marshalPoint(TRANSFER_BUFFER + SIZE_OF_CURSOR, e);
1044
+ const t = C._ts_tree_cursor_goto_first_child_for_position_wasm(this.tree[0]);
1045
+ return unmarshalTreeCursor(this), 1 === t;
1046
+ }
1047
+ gotoNextSibling() {
1048
+ marshalTreeCursor(this);
1049
+ const e = C._ts_tree_cursor_goto_next_sibling_wasm(this.tree[0]);
1050
+ return unmarshalTreeCursor(this), 1 === e;
1051
+ }
1052
+ gotoPreviousSibling() {
1053
+ marshalTreeCursor(this);
1054
+ const e = C._ts_tree_cursor_goto_previous_sibling_wasm(this.tree[0]);
1055
+ return unmarshalTreeCursor(this), 1 === e;
1056
+ }
1057
+ gotoDescendant(e) {
1058
+ marshalTreeCursor(this), C._ts_tree_cursor_goto_descendant_wasm(this.tree[0], e), unmarshalTreeCursor(this);
1059
+ }
1060
+ gotoParent() {
1061
+ marshalTreeCursor(this);
1062
+ const e = C._ts_tree_cursor_goto_parent_wasm(this.tree[0]);
1063
+ return unmarshalTreeCursor(this), 1 === e;
1064
+ }
1065
+ }
1066
+ class Language {
1067
+ constructor(e, t) {
1068
+ assertInternal(e), this[0] = t, this.types = new Array(C._ts_language_symbol_count(this[0]));
1069
+ for (let e2 = 0, t2 = this.types.length; e2 < t2; e2++) C._ts_language_symbol_type(this[0], e2) < 2 && (this.types[e2] = UTF8ToString(C._ts_language_symbol_name(this[0], e2)));
1070
+ this.fields = new Array(C._ts_language_field_count(this[0]) + 1);
1071
+ for (let e2 = 0, t2 = this.fields.length; e2 < t2; e2++) {
1072
+ const t3 = C._ts_language_field_name_for_id(this[0], e2);
1073
+ this.fields[e2] = 0 !== t3 ? UTF8ToString(t3) : null;
1074
+ }
1075
+ }
1076
+ get version() {
1077
+ return C._ts_language_version(this[0]);
1078
+ }
1079
+ get fieldCount() {
1080
+ return this.fields.length - 1;
1081
+ }
1082
+ get stateCount() {
1083
+ return C._ts_language_state_count(this[0]);
1084
+ }
1085
+ fieldIdForName(e) {
1086
+ const t = this.fields.indexOf(e);
1087
+ return -1 !== t ? t : null;
1088
+ }
1089
+ fieldNameForId(e) {
1090
+ return this.fields[e] || null;
1091
+ }
1092
+ idForNodeType(e, t) {
1093
+ const _ = lengthBytesUTF8(e), s = C._malloc(_ + 1);
1094
+ stringToUTF8(e, s, _ + 1);
1095
+ const r = C._ts_language_symbol_for_name(this[0], s, _, t);
1096
+ return C._free(s), r || null;
1097
+ }
1098
+ get nodeTypeCount() {
1099
+ return C._ts_language_symbol_count(this[0]);
1100
+ }
1101
+ nodeTypeForId(e) {
1102
+ const t = C._ts_language_symbol_name(this[0], e);
1103
+ return t ? UTF8ToString(t) : null;
1104
+ }
1105
+ nodeTypeIsNamed(e) {
1106
+ return !!C._ts_language_type_is_named_wasm(this[0], e);
1107
+ }
1108
+ nodeTypeIsVisible(e) {
1109
+ return !!C._ts_language_type_is_visible_wasm(this[0], e);
1110
+ }
1111
+ nextState(e, t) {
1112
+ return C._ts_language_next_state(this[0], e, t);
1113
+ }
1114
+ lookaheadIterator(e) {
1115
+ const t = C._ts_lookahead_iterator_new(this[0], e);
1116
+ return t ? new LookaheadIterable(INTERNAL, t, this) : null;
1117
+ }
1118
+ query(e) {
1119
+ const t = lengthBytesUTF8(e), _ = C._malloc(t + 1);
1120
+ stringToUTF8(e, _, t + 1);
1121
+ const s = C._ts_query_new(this[0], _, t, TRANSFER_BUFFER, TRANSFER_BUFFER + SIZE_OF_INT);
1122
+ if (!s) {
1123
+ const t2 = getValue(TRANSFER_BUFFER + SIZE_OF_INT, "i32"), s2 = getValue(TRANSFER_BUFFER, "i32"), r2 = UTF8ToString(_, s2).length, a2 = e.substr(r2, 100).split("\n")[0];
1124
+ let o2, n2 = a2.match(QUERY_WORD_REGEX)[0];
1125
+ switch (t2) {
1126
+ case 2:
1127
+ o2 = new RangeError(`Bad node name '${n2}'`);
1128
+ break;
1129
+ case 3:
1130
+ o2 = new RangeError(`Bad field name '${n2}'`);
1131
+ break;
1132
+ case 4:
1133
+ o2 = new RangeError(`Bad capture name @${n2}`);
1134
+ break;
1135
+ case 5:
1136
+ o2 = new TypeError(`Bad pattern structure at offset ${r2}: '${a2}'...`), n2 = "";
1137
+ break;
1138
+ default:
1139
+ o2 = new SyntaxError(`Bad syntax at offset ${r2}: '${a2}'...`), n2 = "";
1140
+ }
1141
+ throw o2.index = r2, o2.length = n2.length, C._free(_), o2;
1142
+ }
1143
+ const r = C._ts_query_string_count(s), a = C._ts_query_capture_count(s), o = C._ts_query_pattern_count(s), n = new Array(a), l = new Array(r);
1144
+ for (let e2 = 0; e2 < a; e2++) {
1145
+ const t2 = C._ts_query_capture_name_for_id(s, e2, TRANSFER_BUFFER), _2 = getValue(TRANSFER_BUFFER, "i32");
1146
+ n[e2] = UTF8ToString(t2, _2);
1147
+ }
1148
+ for (let e2 = 0; e2 < r; e2++) {
1149
+ const t2 = C._ts_query_string_value_for_id(s, e2, TRANSFER_BUFFER), _2 = getValue(TRANSFER_BUFFER, "i32");
1150
+ l[e2] = UTF8ToString(t2, _2);
1151
+ }
1152
+ const d = new Array(o), u = new Array(o), m = new Array(o), c = new Array(o), w = new Array(o);
1153
+ for (let e2 = 0; e2 < o; e2++) {
1154
+ const t2 = C._ts_query_predicates_for_pattern(s, e2, TRANSFER_BUFFER), _2 = getValue(TRANSFER_BUFFER, "i32");
1155
+ c[e2] = [], w[e2] = [];
1156
+ const r2 = [];
1157
+ let a2 = t2;
1158
+ for (let t3 = 0; t3 < _2; t3++) {
1159
+ const t4 = getValue(a2, "i32");
1160
+ a2 += SIZE_OF_INT;
1161
+ const _3 = getValue(a2, "i32");
1162
+ if (a2 += SIZE_OF_INT, t4 === PREDICATE_STEP_TYPE_CAPTURE) r2.push({ type: "capture", name: n[_3] });
1163
+ else if (t4 === PREDICATE_STEP_TYPE_STRING) r2.push({ type: "string", value: l[_3] });
1164
+ else if (r2.length > 0) {
1165
+ if ("string" !== r2[0].type) throw new Error("Predicates must begin with a literal value");
1166
+ const t5 = r2[0].value;
1167
+ let _4, s2 = true, a3 = true;
1168
+ switch (t5) {
1169
+ case "any-not-eq?":
1170
+ case "not-eq?":
1171
+ s2 = false;
1172
+ case "any-eq?":
1173
+ case "eq?":
1174
+ if (3 !== r2.length) throw new Error(`Wrong number of arguments to \`#${t5}\` predicate. Expected 2, got ${r2.length - 1}`);
1175
+ if ("capture" !== r2[1].type) throw new Error(`First argument of \`#${t5}\` predicate must be a capture. Got "${r2[1].value}"`);
1176
+ if (a3 = !t5.startsWith("any-"), "capture" === r2[2].type) {
1177
+ const t6 = r2[1].name, _5 = r2[2].name;
1178
+ w[e2].push((e3) => {
1179
+ const r3 = [], o3 = [];
1180
+ for (const s3 of e3) s3.name === t6 && r3.push(s3.node), s3.name === _5 && o3.push(s3.node);
1181
+ const n3 = (e4, t7, _6) => _6 ? e4.text === t7.text : e4.text !== t7.text;
1182
+ return a3 ? r3.every((e4) => o3.some((t7) => n3(e4, t7, s2))) : r3.some((e4) => o3.some((t7) => n3(e4, t7, s2)));
1183
+ });
1184
+ } else {
1185
+ _4 = r2[1].name;
1186
+ const t6 = r2[2].value, o3 = (e3) => e3.text === t6, n3 = (e3) => e3.text !== t6;
1187
+ w[e2].push((e3) => {
1188
+ const t7 = [];
1189
+ for (const s3 of e3) s3.name === _4 && t7.push(s3.node);
1190
+ const r3 = s2 ? o3 : n3;
1191
+ return a3 ? t7.every(r3) : t7.some(r3);
1192
+ });
1193
+ }
1194
+ break;
1195
+ case "any-not-match?":
1196
+ case "not-match?":
1197
+ s2 = false;
1198
+ case "any-match?":
1199
+ case "match?":
1200
+ if (3 !== r2.length) throw new Error(`Wrong number of arguments to \`#${t5}\` predicate. Expected 2, got ${r2.length - 1}.`);
1201
+ if ("capture" !== r2[1].type) throw new Error(`First argument of \`#${t5}\` predicate must be a capture. Got "${r2[1].value}".`);
1202
+ if ("string" !== r2[2].type) throw new Error(`Second argument of \`#${t5}\` predicate must be a string. Got @${r2[2].value}.`);
1203
+ _4 = r2[1].name;
1204
+ const o2 = new RegExp(r2[2].value);
1205
+ a3 = !t5.startsWith("any-"), w[e2].push((e3) => {
1206
+ const t6 = [];
1207
+ for (const s3 of e3) s3.name === _4 && t6.push(s3.node.text);
1208
+ const r3 = (e4, t7) => t7 ? o2.test(e4) : !o2.test(e4);
1209
+ return 0 === t6.length ? !s2 : a3 ? t6.every((e4) => r3(e4, s2)) : t6.some((e4) => r3(e4, s2));
1210
+ });
1211
+ break;
1212
+ case "set!":
1213
+ if (r2.length < 2 || r2.length > 3) throw new Error(`Wrong number of arguments to \`#set!\` predicate. Expected 1 or 2. Got ${r2.length - 1}.`);
1214
+ if (r2.some((e3) => "string" !== e3.type)) throw new Error('Arguments to `#set!` predicate must be a strings.".');
1215
+ d[e2] || (d[e2] = {}), d[e2][r2[1].value] = r2[2] ? r2[2].value : null;
1216
+ break;
1217
+ case "is?":
1218
+ case "is-not?":
1219
+ if (r2.length < 2 || r2.length > 3) throw new Error(`Wrong number of arguments to \`#${t5}\` predicate. Expected 1 or 2. Got ${r2.length - 1}.`);
1220
+ if (r2.some((e3) => "string" !== e3.type)) throw new Error(`Arguments to \`#${t5}\` predicate must be a strings.".`);
1221
+ const n2 = "is?" === t5 ? u : m;
1222
+ n2[e2] || (n2[e2] = {}), n2[e2][r2[1].value] = r2[2] ? r2[2].value : null;
1223
+ break;
1224
+ case "not-any-of?":
1225
+ s2 = false;
1226
+ case "any-of?":
1227
+ if (r2.length < 2) throw new Error(`Wrong number of arguments to \`#${t5}\` predicate. Expected at least 1. Got ${r2.length - 1}.`);
1228
+ if ("capture" !== r2[1].type) throw new Error(`First argument of \`#${t5}\` predicate must be a capture. Got "${r2[1].value}".`);
1229
+ for (let e3 = 2; e3 < r2.length; e3++) if ("string" !== r2[e3].type) throw new Error(`Arguments to \`#${t5}\` predicate must be a strings.".`);
1230
+ _4 = r2[1].name;
1231
+ const l2 = r2.slice(2).map((e3) => e3.value);
1232
+ w[e2].push((e3) => {
1233
+ const t6 = [];
1234
+ for (const s3 of e3) s3.name === _4 && t6.push(s3.node.text);
1235
+ return 0 === t6.length ? !s2 : t6.every((e4) => l2.includes(e4)) === s2;
1236
+ });
1237
+ break;
1238
+ default:
1239
+ c[e2].push({ operator: t5, operands: r2.slice(1) });
1240
+ }
1241
+ r2.length = 0;
1242
+ }
1243
+ }
1244
+ Object.freeze(d[e2]), Object.freeze(u[e2]), Object.freeze(m[e2]);
1245
+ }
1246
+ return C._free(_), new Query(INTERNAL, s, n, w, c, Object.freeze(d), Object.freeze(u), Object.freeze(m));
1247
+ }
1248
+ static load(e) {
1249
+ let t;
1250
+ if (e instanceof Uint8Array) t = Promise.resolve(e);
1251
+ else {
1252
+ const _ = e;
1253
+ if ("undefined" != typeof process && process.versions && process.versions.node) {
1254
+ const e2 = __require("fs");
1255
+ t = Promise.resolve(e2.readFileSync(_));
1256
+ } else t = fetch(_).then((e2) => e2.arrayBuffer().then((t2) => {
1257
+ if (e2.ok) return new Uint8Array(t2);
1258
+ {
1259
+ const _2 = new TextDecoder("utf-8").decode(t2);
1260
+ throw new Error(`Language.load failed with status ${e2.status}.
1261
+
1262
+ ${_2}`);
1263
+ }
1264
+ }));
1265
+ }
1266
+ return t.then((e2) => loadWebAssemblyModule(e2, { loadAsync: true })).then((e2) => {
1267
+ const t2 = Object.keys(e2), _ = t2.find((e3) => LANGUAGE_FUNCTION_REGEX.test(e3) && !e3.includes("external_scanner_"));
1268
+ _ || console.log(`Couldn't find language function in WASM file. Symbols:
1269
+ ${JSON.stringify(t2, null, 2)}`);
1270
+ const s = e2[_]();
1271
+ return new Language(INTERNAL, s);
1272
+ });
1273
+ }
1274
+ }
1275
+ class LookaheadIterable {
1276
+ constructor(e, t, _) {
1277
+ assertInternal(e), this[0] = t, this.language = _;
1278
+ }
1279
+ get currentTypeId() {
1280
+ return C._ts_lookahead_iterator_current_symbol(this[0]);
1281
+ }
1282
+ get currentType() {
1283
+ return this.language.types[this.currentTypeId] || "ERROR";
1284
+ }
1285
+ delete() {
1286
+ C._ts_lookahead_iterator_delete(this[0]), this[0] = 0;
1287
+ }
1288
+ resetState(e) {
1289
+ return C._ts_lookahead_iterator_reset_state(this[0], e);
1290
+ }
1291
+ reset(e, t) {
1292
+ return !!C._ts_lookahead_iterator_reset(this[0], e[0], t) && (this.language = e, true);
1293
+ }
1294
+ [Symbol.iterator]() {
1295
+ const e = this;
1296
+ return { next: () => C._ts_lookahead_iterator_next(e[0]) ? { done: false, value: e.currentType } : { done: true, value: "" } };
1297
+ }
1298
+ }
1299
+ class Query {
1300
+ constructor(e, t, _, s, r, a, o, n) {
1301
+ assertInternal(e), this[0] = t, this.captureNames = _, this.textPredicates = s, this.predicates = r, this.setProperties = a, this.assertedProperties = o, this.refutedProperties = n, this.exceededMatchLimit = false;
1302
+ }
1303
+ delete() {
1304
+ C._ts_query_delete(this[0]), this[0] = 0;
1305
+ }
1306
+ matches(e, { startPosition: t = ZERO_POINT, endPosition: _ = ZERO_POINT, startIndex: s = 0, endIndex: r = 0, matchLimit: a = 4294967295, maxStartDepth: o = 4294967295 } = {}) {
1307
+ if ("number" != typeof a) throw new Error("Arguments must be numbers");
1308
+ marshalNode(e), C._ts_query_matches_wasm(this[0], e.tree[0], t.row, t.column, _.row, _.column, s, r, a, o);
1309
+ const n = getValue(TRANSFER_BUFFER, "i32"), l = getValue(TRANSFER_BUFFER + SIZE_OF_INT, "i32"), d = getValue(TRANSFER_BUFFER + 2 * SIZE_OF_INT, "i32"), u = new Array(n);
1310
+ this.exceededMatchLimit = Boolean(d);
1311
+ let m = 0, c = l;
1312
+ for (let t2 = 0; t2 < n; t2++) {
1313
+ const t3 = getValue(c, "i32");
1314
+ c += SIZE_OF_INT;
1315
+ const _2 = getValue(c, "i32");
1316
+ c += SIZE_OF_INT;
1317
+ const s2 = new Array(_2);
1318
+ if (c = unmarshalCaptures(this, e.tree, c, s2), this.textPredicates[t3].every((e2) => e2(s2))) {
1319
+ u[m] = { pattern: t3, captures: s2 };
1320
+ const e2 = this.setProperties[t3];
1321
+ e2 && (u[m].setProperties = e2);
1322
+ const _3 = this.assertedProperties[t3];
1323
+ _3 && (u[m].assertedProperties = _3);
1324
+ const r2 = this.refutedProperties[t3];
1325
+ r2 && (u[m].refutedProperties = r2), m++;
1326
+ }
1327
+ }
1328
+ return u.length = m, C._free(l), u;
1329
+ }
1330
+ captures(e, { startPosition: t = ZERO_POINT, endPosition: _ = ZERO_POINT, startIndex: s = 0, endIndex: r = 0, matchLimit: a = 4294967295, maxStartDepth: o = 4294967295 } = {}) {
1331
+ if ("number" != typeof a) throw new Error("Arguments must be numbers");
1332
+ marshalNode(e), C._ts_query_captures_wasm(this[0], e.tree[0], t.row, t.column, _.row, _.column, s, r, a, o);
1333
+ const n = getValue(TRANSFER_BUFFER, "i32"), l = getValue(TRANSFER_BUFFER + SIZE_OF_INT, "i32"), d = getValue(TRANSFER_BUFFER + 2 * SIZE_OF_INT, "i32"), u = [];
1334
+ this.exceededMatchLimit = Boolean(d);
1335
+ const m = [];
1336
+ let c = l;
1337
+ for (let t2 = 0; t2 < n; t2++) {
1338
+ const t3 = getValue(c, "i32");
1339
+ c += SIZE_OF_INT;
1340
+ const _2 = getValue(c, "i32");
1341
+ c += SIZE_OF_INT;
1342
+ const s2 = getValue(c, "i32");
1343
+ if (c += SIZE_OF_INT, m.length = _2, c = unmarshalCaptures(this, e.tree, c, m), this.textPredicates[t3].every((e2) => e2(m))) {
1344
+ const e2 = m[s2], _3 = this.setProperties[t3];
1345
+ _3 && (e2.setProperties = _3);
1346
+ const r2 = this.assertedProperties[t3];
1347
+ r2 && (e2.assertedProperties = r2);
1348
+ const a2 = this.refutedProperties[t3];
1349
+ a2 && (e2.refutedProperties = a2), u.push(e2);
1350
+ }
1351
+ }
1352
+ return C._free(l), u;
1353
+ }
1354
+ predicatesForPattern(e) {
1355
+ return this.predicates[e];
1356
+ }
1357
+ disableCapture(e) {
1358
+ const t = lengthBytesUTF8(e), _ = C._malloc(t + 1);
1359
+ stringToUTF8(e, _, t + 1), C._ts_query_disable_capture(this[0], _, t), C._free(_);
1360
+ }
1361
+ didExceedMatchLimit() {
1362
+ return this.exceededMatchLimit;
1363
+ }
1364
+ }
1365
+ function getText(e, t, _) {
1366
+ const s = _ - t;
1367
+ let r = e.textCallback(t, null, _);
1368
+ for (t += r.length; t < _; ) {
1369
+ const s2 = e.textCallback(t, null, _);
1370
+ if (!(s2 && s2.length > 0)) break;
1371
+ t += s2.length, r += s2;
1372
+ }
1373
+ return t > _ && (r = r.slice(0, s)), r;
1374
+ }
1375
+ function unmarshalCaptures(e, t, _, s) {
1376
+ for (let r = 0, a = s.length; r < a; r++) {
1377
+ const a2 = getValue(_, "i32"), o = unmarshalNode(t, _ += SIZE_OF_INT);
1378
+ _ += SIZE_OF_NODE, s[r] = { name: e.captureNames[a2], node: o };
1379
+ }
1380
+ return _;
1381
+ }
1382
+ function assertInternal(e) {
1383
+ if (e !== INTERNAL) throw new Error("Illegal constructor");
1384
+ }
1385
+ function isPoint(e) {
1386
+ return e && "number" == typeof e.row && "number" == typeof e.column;
1387
+ }
1388
+ function marshalNode(e) {
1389
+ let t = TRANSFER_BUFFER;
1390
+ setValue(t, e.id, "i32"), t += SIZE_OF_INT, setValue(t, e.startIndex, "i32"), t += SIZE_OF_INT, setValue(t, e.startPosition.row, "i32"), t += SIZE_OF_INT, setValue(t, e.startPosition.column, "i32"), t += SIZE_OF_INT, setValue(t, e[0], "i32");
1391
+ }
1392
+ function unmarshalNode(e, t = TRANSFER_BUFFER) {
1393
+ const _ = getValue(t, "i32");
1394
+ if (0 === _) return null;
1395
+ const s = getValue(t += SIZE_OF_INT, "i32"), r = getValue(t += SIZE_OF_INT, "i32"), a = getValue(t += SIZE_OF_INT, "i32"), o = getValue(t += SIZE_OF_INT, "i32"), n = new Node(INTERNAL, e);
1396
+ return n.id = _, n.startIndex = s, n.startPosition = { row: r, column: a }, n[0] = o, n;
1397
+ }
1398
+ function marshalTreeCursor(e, t = TRANSFER_BUFFER) {
1399
+ setValue(t + 0 * SIZE_OF_INT, e[0], "i32"), setValue(t + 1 * SIZE_OF_INT, e[1], "i32"), setValue(t + 2 * SIZE_OF_INT, e[2], "i32"), setValue(t + 3 * SIZE_OF_INT, e[3], "i32");
1400
+ }
1401
+ function unmarshalTreeCursor(e) {
1402
+ e[0] = getValue(TRANSFER_BUFFER + 0 * SIZE_OF_INT, "i32"), e[1] = getValue(TRANSFER_BUFFER + 1 * SIZE_OF_INT, "i32"), e[2] = getValue(TRANSFER_BUFFER + 2 * SIZE_OF_INT, "i32"), e[3] = getValue(TRANSFER_BUFFER + 3 * SIZE_OF_INT, "i32");
1403
+ }
1404
+ function marshalPoint(e, t) {
1405
+ setValue(e, t.row, "i32"), setValue(e + SIZE_OF_INT, t.column, "i32");
1406
+ }
1407
+ function unmarshalPoint(e) {
1408
+ return { row: getValue(e, "i32") >>> 0, column: getValue(e + SIZE_OF_INT, "i32") >>> 0 };
1409
+ }
1410
+ function marshalRange(e, t) {
1411
+ marshalPoint(e, t.startPosition), marshalPoint(e += SIZE_OF_POINT, t.endPosition), setValue(e += SIZE_OF_POINT, t.startIndex, "i32"), setValue(e += SIZE_OF_INT, t.endIndex, "i32"), e += SIZE_OF_INT;
1412
+ }
1413
+ function unmarshalRange(e) {
1414
+ const t = {};
1415
+ return t.startPosition = unmarshalPoint(e), e += SIZE_OF_POINT, t.endPosition = unmarshalPoint(e), e += SIZE_OF_POINT, t.startIndex = getValue(e, "i32") >>> 0, e += SIZE_OF_INT, t.endIndex = getValue(e, "i32") >>> 0, t;
1416
+ }
1417
+ function marshalEdit(e) {
1418
+ let t = TRANSFER_BUFFER;
1419
+ marshalPoint(t, e.startPosition), t += SIZE_OF_POINT, marshalPoint(t, e.oldEndPosition), t += SIZE_OF_POINT, marshalPoint(t, e.newEndPosition), t += SIZE_OF_POINT, setValue(t, e.startIndex, "i32"), t += SIZE_OF_INT, setValue(t, e.oldEndIndex, "i32"), t += SIZE_OF_INT, setValue(t, e.newEndIndex, "i32"), t += SIZE_OF_INT;
1420
+ }
1421
+ for (const e of Object.getOwnPropertyNames(ParserImpl.prototype)) Object.defineProperty(Parser.prototype, e, { value: ParserImpl.prototype[e], enumerable: false, writable: false });
1422
+ Parser.Language = Language, Module.onRuntimeInitialized = () => {
1423
+ ParserImpl.init(), resolveInitPromise();
1424
+ };
1425
+ }));
1426
+ }
1427
+ }
1428
+ return Parser;
1429
+ }();
1430
+ "object" == typeof exports && (module.exports = TreeSitter);
1431
+ }
1432
+ });
1433
+
1434
+ // ../packages/orion-client-core/src/treesitter/worker.ts
1435
+ import { parentPort } from "node:worker_threads";
1436
+
1437
+ // ../packages/orion-client-core/src/treesitter/queries.ts
1438
+ var PYTHON_QUERY = `
1439
+ (function_definition
1440
+ name: (identifier) @symbol.function.name) @symbol.function.def
1441
+
1442
+ (class_definition
1443
+ name: (identifier) @symbol.class.name
1444
+ superclasses: (argument_list (identifier) @edge.extends.parent)?) @symbol.class.def
1445
+
1446
+ (import_statement
1447
+ name: (dotted_name) @edge.import.target)
1448
+
1449
+ (import_from_statement
1450
+ name: (dotted_name) @edge.import.target)
1451
+
1452
+ (call
1453
+ function: (identifier) @edge.call.target)
1454
+
1455
+ (call
1456
+ function: (attribute attribute: (identifier) @edge.call.target))
1457
+ `;
1458
+ var TYPESCRIPT_QUERY = `
1459
+ (function_declaration
1460
+ name: (identifier) @symbol.function.name) @symbol.function.def
1461
+
1462
+ (method_definition
1463
+ name: (property_identifier) @symbol.method.name) @symbol.method.def
1464
+
1465
+ (class_declaration
1466
+ name: (type_identifier) @symbol.class.name) @symbol.class.def
1467
+
1468
+ (interface_declaration
1469
+ name: (type_identifier) @symbol.interface.name) @symbol.interface.def
1470
+
1471
+ (type_alias_declaration
1472
+ name: (type_identifier) @symbol.type.name) @symbol.type.def
1473
+
1474
+ (enum_declaration
1475
+ name: (identifier) @symbol.enum.name) @symbol.enum.def
1476
+
1477
+ (import_statement
1478
+ source: (string) @edge.import.source)
1479
+
1480
+ (class_heritage
1481
+ (extends_clause value: (identifier) @edge.extends.parent))
1482
+
1483
+ (class_heritage
1484
+ (implements_clause (type_identifier) @edge.implements.parent))
1485
+
1486
+ (call_expression
1487
+ function: (identifier) @edge.call.target)
1488
+
1489
+ (call_expression
1490
+ function: (member_expression property: (property_identifier) @edge.call.target))
1491
+ `;
1492
+ var JAVASCRIPT_QUERY = `
1493
+ (function_declaration
1494
+ name: (identifier) @symbol.function.name) @symbol.function.def
1495
+
1496
+ (method_definition
1497
+ name: (property_identifier) @symbol.method.name) @symbol.method.def
1498
+
1499
+ (class_declaration
1500
+ name: (identifier) @symbol.class.name) @symbol.class.def
1501
+
1502
+ (import_statement
1503
+ source: (string) @edge.import.source)
1504
+
1505
+ (class_heritage
1506
+ (identifier) @edge.extends.parent)
1507
+
1508
+ (call_expression
1509
+ function: (identifier) @edge.call.target)
1510
+
1511
+ (call_expression
1512
+ function: (member_expression property: (property_identifier) @edge.call.target))
1513
+ `;
1514
+ var GO_QUERY = `
1515
+ (function_declaration
1516
+ name: (identifier) @symbol.function.name) @symbol.function.def
1517
+
1518
+ (method_declaration
1519
+ name: (field_identifier) @symbol.method.name) @symbol.method.def
1520
+
1521
+ (type_declaration
1522
+ (type_spec name: (type_identifier) @symbol.type.name)) @symbol.type.def
1523
+
1524
+ (import_spec path: (interpreted_string_literal) @edge.import.source)
1525
+
1526
+ (call_expression
1527
+ function: (identifier) @edge.call.target)
1528
+
1529
+ (call_expression
1530
+ function: (selector_expression field: (field_identifier) @edge.call.target))
1531
+ `;
1532
+ var RUST_QUERY = `
1533
+ (function_item
1534
+ name: (identifier) @symbol.function.name) @symbol.function.def
1535
+
1536
+ (struct_item
1537
+ name: (type_identifier) @symbol.class.name) @symbol.class.def
1538
+
1539
+ (enum_item
1540
+ name: (type_identifier) @symbol.enum.name) @symbol.enum.def
1541
+
1542
+ (trait_item
1543
+ name: (type_identifier) @symbol.interface.name) @symbol.interface.def
1544
+
1545
+ (type_item
1546
+ name: (type_identifier) @symbol.type.name) @symbol.type.def
1547
+
1548
+ (use_declaration
1549
+ argument: (scoped_identifier name: (identifier) @edge.import.target))
1550
+
1551
+ (use_declaration
1552
+ argument: (identifier) @edge.import.target)
1553
+
1554
+ (impl_item
1555
+ trait: (type_identifier) @edge.implements.parent)
1556
+
1557
+ (call_expression
1558
+ function: (identifier) @edge.call.target)
1559
+
1560
+ (call_expression
1561
+ function: (field_expression field: (field_identifier) @edge.call.target))
1562
+ `;
1563
+ var JAVA_QUERY = `
1564
+ (class_declaration
1565
+ name: (identifier) @symbol.class.name) @symbol.class.def
1566
+
1567
+ (interface_declaration
1568
+ name: (identifier) @symbol.interface.name) @symbol.interface.def
1569
+
1570
+ (enum_declaration
1571
+ name: (identifier) @symbol.enum.name) @symbol.enum.def
1572
+
1573
+ (method_declaration
1574
+ name: (identifier) @symbol.method.name) @symbol.method.def
1575
+
1576
+ (superclass (type_identifier) @edge.extends.parent)
1577
+
1578
+ (super_interfaces (type_list (type_identifier) @edge.implements.parent))
1579
+
1580
+ (import_declaration (scoped_identifier name: (identifier) @edge.import.target))
1581
+
1582
+ (method_invocation name: (identifier) @edge.call.target)
1583
+ `;
1584
+
1585
+ // ../packages/orion-client-core/src/treesitter/extractor.ts
1586
+ function queryFor(lang) {
1587
+ switch (lang) {
1588
+ case "python":
1589
+ return PYTHON_QUERY;
1590
+ case "typescript":
1591
+ case "tsx":
1592
+ return TYPESCRIPT_QUERY;
1593
+ case "javascript":
1594
+ return JAVASCRIPT_QUERY;
1595
+ case "go":
1596
+ return GO_QUERY;
1597
+ case "rust":
1598
+ return RUST_QUERY;
1599
+ case "java":
1600
+ return JAVA_QUERY;
1601
+ // Ruby intentionally falls back to regex: tree-sitter `(call method: …)`
1602
+ // can't distinguish `require "x"` (an import) from any other method
1603
+ // call without a `#match?` predicate, and a tree-sitter pass that
1604
+ // silently drops require edges would regress Ruby import precision
1605
+ // vs. the existing regex extractor. Revisit when predicate support
1606
+ // is verified across grammar versions.
1607
+ default:
1608
+ return null;
1609
+ }
1610
+ }
1611
+ function lineOf(node) {
1612
+ return node.startPosition.row + 1;
1613
+ }
1614
+ function signatureOf(node, allLines) {
1615
+ const row = node.startPosition.row;
1616
+ const line = (allLines[row] ?? "").trim();
1617
+ return line.length > 160 ? line.slice(0, 160) + "\u2026" : line;
1618
+ }
1619
+ function enclosingSymbolName(node) {
1620
+ let cur = node.parent;
1621
+ while (cur) {
1622
+ if (cur.type === "impl_item") {
1623
+ const t = cur.childForFieldName("type");
1624
+ if (t) return t.text;
1625
+ } else if (
1626
+ // Python
1627
+ cur.type === "function_definition" || cur.type === "class_definition" || // JS/TS
1628
+ cur.type === "method_definition" || cur.type === "function_declaration" || cur.type === "class_declaration" || // Go / Java
1629
+ cur.type === "method_declaration" || cur.type === "interface_declaration" || cur.type === "enum_declaration" || // Rust
1630
+ cur.type === "function_item"
1631
+ ) {
1632
+ const nameNode = cur.childForFieldName("name");
1633
+ if (nameNode) return nameNode.text;
1634
+ }
1635
+ cur = cur.parent;
1636
+ }
1637
+ return "";
1638
+ }
1639
+ function moduleNameFromSourceLiteral(literal) {
1640
+ const stripped = literal.replace(/^['"]|['"]$/g, "");
1641
+ const parts2 = stripped.split(/[\\/]/);
1642
+ const last = parts2[parts2.length - 1] || stripped;
1643
+ return last.replace(/\.(d\.)?ts$/, "").replace(/\.js$/, "");
1644
+ }
1645
+ function moduleSpecFromSourceLiteral(literal) {
1646
+ return literal.replace(/^['"]|['"]$/g, "");
1647
+ }
1648
+ function extractFromMatches(matches, path, allLines) {
1649
+ const symbols = [];
1650
+ const edges = [];
1651
+ for (const m of matches) {
1652
+ const byName = {};
1653
+ for (const c of m.captures) {
1654
+ (byName[c.name] = byName[c.name] || []).push(c.node);
1655
+ }
1656
+ if (byName["symbol.function.def"]?.length) {
1657
+ const def = byName["symbol.function.def"][0];
1658
+ const name2 = byName["symbol.function.name"]?.[0]?.text;
1659
+ if (name2) {
1660
+ symbols.push({
1661
+ path,
1662
+ name: name2,
1663
+ kind: "function",
1664
+ line: lineOf(def),
1665
+ signature: signatureOf(def, allLines)
1666
+ });
1667
+ }
1668
+ }
1669
+ if (byName["symbol.method.def"]?.length) {
1670
+ const def = byName["symbol.method.def"][0];
1671
+ const name2 = byName["symbol.method.name"]?.[0]?.text;
1672
+ if (name2) {
1673
+ symbols.push({
1674
+ path,
1675
+ name: name2,
1676
+ kind: "method",
1677
+ line: lineOf(def),
1678
+ signature: signatureOf(def, allLines)
1679
+ });
1680
+ }
1681
+ }
1682
+ if (byName["symbol.class.def"]?.length) {
1683
+ const def = byName["symbol.class.def"][0];
1684
+ const name2 = byName["symbol.class.name"]?.[0]?.text;
1685
+ if (name2) {
1686
+ symbols.push({
1687
+ path,
1688
+ name: name2,
1689
+ kind: "class",
1690
+ line: lineOf(def),
1691
+ signature: signatureOf(def, allLines)
1692
+ });
1693
+ for (const parent of byName["edge.extends.parent"] ?? []) {
1694
+ edges.push({
1695
+ kind: "extends",
1696
+ source_path: path,
1697
+ source_name: name2,
1698
+ target: parent.text.toLowerCase(),
1699
+ line: lineOf(parent)
1700
+ });
1701
+ }
1702
+ }
1703
+ }
1704
+ if (byName["symbol.interface.def"]?.length) {
1705
+ const def = byName["symbol.interface.def"][0];
1706
+ const name2 = byName["symbol.interface.name"]?.[0]?.text;
1707
+ if (name2) {
1708
+ symbols.push({
1709
+ path,
1710
+ name: name2,
1711
+ kind: "interface",
1712
+ line: lineOf(def),
1713
+ signature: signatureOf(def, allLines)
1714
+ });
1715
+ }
1716
+ }
1717
+ if (byName["symbol.type.def"]?.length) {
1718
+ const def = byName["symbol.type.def"][0];
1719
+ const name2 = byName["symbol.type.name"]?.[0]?.text;
1720
+ if (name2) {
1721
+ symbols.push({
1722
+ path,
1723
+ name: name2,
1724
+ kind: "type",
1725
+ line: lineOf(def),
1726
+ signature: signatureOf(def, allLines)
1727
+ });
1728
+ }
1729
+ }
1730
+ if (byName["symbol.enum.def"]?.length) {
1731
+ const def = byName["symbol.enum.def"][0];
1732
+ const name2 = byName["symbol.enum.name"]?.[0]?.text;
1733
+ if (name2) {
1734
+ symbols.push({
1735
+ path,
1736
+ name: name2,
1737
+ kind: "enum",
1738
+ line: lineOf(def),
1739
+ signature: signatureOf(def, allLines)
1740
+ });
1741
+ }
1742
+ }
1743
+ for (const targetNode of byName["edge.import.target"] ?? []) {
1744
+ const dotted = targetNode.text;
1745
+ const last = dotted.split(".").pop() ?? dotted;
1746
+ edges.push({
1747
+ kind: "imports",
1748
+ source_path: path,
1749
+ source_name: "",
1750
+ target: last.toLowerCase(),
1751
+ line: lineOf(targetNode)
1752
+ });
1753
+ }
1754
+ for (const sourceLit of byName["edge.import.source"] ?? []) {
1755
+ const modName = moduleNameFromSourceLiteral(sourceLit.text);
1756
+ if (modName) {
1757
+ edges.push({
1758
+ kind: "imports",
1759
+ source_path: path,
1760
+ source_name: "",
1761
+ target: modName.toLowerCase(),
1762
+ line: lineOf(sourceLit),
1763
+ context: moduleSpecFromSourceLiteral(sourceLit.text)
1764
+ });
1765
+ }
1766
+ }
1767
+ for (const callTarget of byName["edge.call.target"] ?? []) {
1768
+ const sourceName = enclosingSymbolName(callTarget);
1769
+ edges.push({
1770
+ kind: "calls",
1771
+ source_path: path,
1772
+ source_name: sourceName,
1773
+ target: callTarget.text.toLowerCase(),
1774
+ line: lineOf(callTarget)
1775
+ });
1776
+ }
1777
+ for (const parent of byName["edge.extends.parent"] ?? []) {
1778
+ if (byName["symbol.class.def"]?.length) continue;
1779
+ const childName = enclosingSymbolName(parent);
1780
+ if (childName) {
1781
+ edges.push({
1782
+ kind: "extends",
1783
+ source_path: path,
1784
+ source_name: childName,
1785
+ target: parent.text.toLowerCase(),
1786
+ line: lineOf(parent)
1787
+ });
1788
+ }
1789
+ }
1790
+ for (const parent of byName["edge.implements.parent"] ?? []) {
1791
+ const childName = enclosingSymbolName(parent);
1792
+ if (childName) {
1793
+ edges.push({
1794
+ kind: "implements",
1795
+ source_path: path,
1796
+ source_name: childName,
1797
+ target: parent.text.toLowerCase(),
1798
+ line: lineOf(parent)
1799
+ });
1800
+ }
1801
+ }
1802
+ }
1803
+ return { symbols, edges };
1804
+ }
1805
+ function extractWithTreeSitter(handle4, lang, path, content) {
1806
+ const querySource = queryFor(lang);
1807
+ if (!querySource) return null;
1808
+ const tree = handle4.parse(lang, content);
1809
+ if (!tree) return null;
1810
+ try {
1811
+ const query = handle4.query(lang, querySource);
1812
+ if (!query) return null;
1813
+ const matches = query.matches(tree.rootNode);
1814
+ const allLines = content.split("\n");
1815
+ return extractFromMatches(matches, path, allLines);
1816
+ } finally {
1817
+ try {
1818
+ tree.delete();
1819
+ } catch {
1820
+ }
1821
+ }
1822
+ }
1823
+
1824
+ // ../packages/orion-client-core/src/treesitter/loader.ts
1825
+ import * as fs2 from "fs";
1826
+ var GRAMMAR_FILE = {
1827
+ python: "tree-sitter-python.wasm",
1828
+ typescript: "tree-sitter-typescript.wasm",
1829
+ tsx: "tree-sitter-tsx.wasm",
1830
+ javascript: "tree-sitter-javascript.wasm",
1831
+ go: "tree-sitter-go.wasm",
1832
+ rust: "tree-sitter-rust.wasm",
1833
+ java: "tree-sitter-java.wasm",
1834
+ ruby: "tree-sitter-ruby.wasm"
1835
+ };
1836
+ var handle2 = null;
1837
+ var initAttempted = false;
1838
+ async function tryLoad(grammarDir) {
1839
+ if (handle2) return handle2;
1840
+ if (initAttempted) return null;
1841
+ initAttempted = true;
1842
+ const runtimeWasm = `${grammarDir}/tree-sitter.wasm`;
1843
+ if (!fs2.existsSync(runtimeWasm)) {
1844
+ return null;
1845
+ }
1846
+ let mod;
1847
+ try {
1848
+ mod = require_tree_sitter();
1849
+ } catch {
1850
+ return null;
1851
+ }
1852
+ const Parser2 = mod.Parser ?? mod.default ?? mod;
1853
+ try {
1854
+ await Parser2.init({
1855
+ locateFile: (name2) => `${grammarDir}/${name2}`
1856
+ });
1857
+ } catch {
1858
+ return null;
1859
+ }
1860
+ const grammarCache = /* @__PURE__ */ new Map();
1861
+ let sharedParser = null;
1862
+ const queryCache = /* @__PURE__ */ new Map();
1863
+ let grammarQueue = Promise.resolve();
1864
+ async function loadGrammar(lang) {
1865
+ if (grammarCache.has(lang)) return grammarCache.get(lang) ?? null;
1866
+ const next = grammarQueue.then(async () => {
1867
+ if (grammarCache.has(lang)) return grammarCache.get(lang) ?? null;
1868
+ const wasmPath = `${grammarDir}/${GRAMMAR_FILE[lang]}`;
1869
+ if (!fs2.existsSync(wasmPath)) {
1870
+ grammarCache.set(lang, null);
1871
+ return null;
1872
+ }
1873
+ try {
1874
+ const langObj = await Parser2.Language.load(wasmPath);
1875
+ grammarCache.set(lang, langObj);
1876
+ return langObj;
1877
+ } catch {
1878
+ grammarCache.set(lang, null);
1879
+ return null;
1880
+ }
1881
+ });
1882
+ grammarQueue = next.catch(() => void 0);
1883
+ return next;
1884
+ }
1885
+ handle2 = {
1886
+ parse(_lang, source) {
1887
+ const langObj = grammarCache.get(_lang);
1888
+ if (!langObj) return null;
1889
+ sharedParser ??= new Parser2();
1890
+ sharedParser.setLanguage(langObj);
1891
+ try {
1892
+ return sharedParser.parse(source);
1893
+ } catch {
1894
+ try {
1895
+ sharedParser.delete?.();
1896
+ } catch {
1897
+ }
1898
+ sharedParser = null;
1899
+ return null;
1900
+ }
1901
+ },
1902
+ query(lang, querySource) {
1903
+ if (queryCache.has(lang)) return queryCache.get(lang) ?? null;
1904
+ const langObj = grammarCache.get(lang);
1905
+ if (!langObj) {
1906
+ return null;
1907
+ }
1908
+ let compiled = null;
1909
+ try {
1910
+ compiled = langObj.query(querySource);
1911
+ } catch {
1912
+ compiled = null;
1913
+ }
1914
+ queryCache.set(lang, compiled);
1915
+ return compiled;
1916
+ }
1917
+ };
1918
+ await Promise.all([loadGrammar("python"), loadGrammar("typescript")]);
1919
+ handle2.ensureGrammar = loadGrammar;
1920
+ return handle2;
1921
+ }
1922
+ async function ensureGrammar(h, lang) {
1923
+ const dyn = h;
1924
+ if (!dyn.ensureGrammar) return true;
1925
+ const loaded = await dyn.ensureGrammar(lang);
1926
+ return loaded !== null;
1927
+ }
1928
+
1929
+ // ../packages/orion-client-core/src/treesitter/worker.ts
1930
+ var EAGER_LANGS = [
1931
+ "python",
1932
+ "typescript",
1933
+ "tsx",
1934
+ "javascript",
1935
+ "go",
1936
+ "rust",
1937
+ "java"
1938
+ ];
1939
+ var handle3 = null;
1940
+ var initPromise2 = null;
1941
+ async function ensureReady(grammarDir) {
1942
+ if (initPromise2) return initPromise2;
1943
+ initPromise2 = (async () => {
1944
+ handle3 = await tryLoad(grammarDir);
1945
+ if (!handle3) return false;
1946
+ await Promise.all(EAGER_LANGS.map((l) => ensureGrammar(handle3, l)));
1947
+ return true;
1948
+ })();
1949
+ return initPromise2;
1950
+ }
1951
+ parentPort?.on("message", async (msg) => {
1952
+ if (msg.type === "init") {
1953
+ void ensureReady(msg.grammarDir);
1954
+ return;
1955
+ }
1956
+ if (msg.type !== "extract") return;
1957
+ const ready = await ensureReady(msg.grammarDir);
1958
+ let result = null;
1959
+ if (ready && handle3) {
1960
+ try {
1961
+ result = extractWithTreeSitter(handle3, msg.lang, msg.path, msg.content);
1962
+ } catch {
1963
+ result = null;
1964
+ }
1965
+ }
1966
+ const reply = { id: msg.id, result };
1967
+ parentPort?.postMessage(reply);
1968
+ });