usfm-grammar-web 3.0.0-alpha.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,2518 @@
1
+
2
+ function $parcel$export(e, n, v, s) {
3
+ Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
4
+ }
5
+
6
+ function $parcel$interopDefault(a) {
7
+ return a && a.__esModule ? a.default : a;
8
+ }
9
+
10
+ var $parcel$global = globalThis;
11
+
12
+ var $parcel$modules = {};
13
+ var $parcel$inits = {};
14
+
15
+ var parcelRequire = $parcel$global["parcelRequire9afa"];
16
+
17
+ if (parcelRequire == null) {
18
+ parcelRequire = function(id) {
19
+ if (id in $parcel$modules) {
20
+ return $parcel$modules[id].exports;
21
+ }
22
+ if (id in $parcel$inits) {
23
+ var init = $parcel$inits[id];
24
+ delete $parcel$inits[id];
25
+ var module = {id: id, exports: {}};
26
+ $parcel$modules[id] = module;
27
+ init.call(module.exports, module, module.exports);
28
+ return module.exports;
29
+ }
30
+ var err = new Error("Cannot find module '" + id + "'");
31
+ err.code = 'MODULE_NOT_FOUND';
32
+ throw err;
33
+ };
34
+
35
+ parcelRequire.register = function register(id, init) {
36
+ $parcel$inits[id] = init;
37
+ };
38
+
39
+ $parcel$global["parcelRequire9afa"] = parcelRequire;
40
+ }
41
+
42
+ var parcelRegister = parcelRequire.register;
43
+ parcelRegister("5UXqS", function(module, exports) {
44
+
45
+ var $a1KGq = parcelRequire("a1KGq");
46
+ var __dirname = "src/web-tree-sitter";
47
+ var Module = void 0 !== Module ? Module : {};
48
+
49
+
50
+
51
+ var TreeSitter = function() {
52
+ var initPromise, document = "object" == typeof window ? {
53
+ currentScript: window.document.currentScript
54
+ } : null;
55
+ class Parser {
56
+ constructor(){
57
+ this.initialize();
58
+ }
59
+ initialize() {
60
+ throw new Error("cannot construct a Parser before calling `init()`");
61
+ }
62
+ static init(moduleOptions) {
63
+ return initPromise || (Module = Object.assign({}, Module, moduleOptions), initPromise = new Promise((resolveInitPromise)=>{
64
+ var moduleOverrides = Object.assign({}, Module), arguments_ = [], thisProgram = "./this.program", quit_ = (e, t)=>{
65
+ throw t;
66
+ }, ENVIRONMENT_IS_WEB = "object" == typeof window, ENVIRONMENT_IS_WORKER = "function" == typeof importScripts, ENVIRONMENT_IS_NODE = "object" == typeof $a1KGq && "object" == typeof $a1KGq.versions && "string" == typeof $a1KGq.versions.node, scriptDirectory = "", read_, readAsync, readBinary;
67
+ function locateFile(e) {
68
+ return Module.locateFile ? Module.locateFile(e, scriptDirectory) : scriptDirectory + e;
69
+ }
70
+ if (ENVIRONMENT_IS_NODE) {
71
+ var fs = (parcelRequire("a1KGq")), nodePath = (parcelRequire("a1KGq"));
72
+ 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)=>{
73
+ var t = read_(e, !0);
74
+ return t.buffer || (t = new Uint8Array(t)), t;
75
+ }, readAsync = (e, t, _, s = !0)=>{
76
+ e = isFileURI(e) ? new URL(e) : nodePath.normalize(e), fs.readFile(e, s ? void 0 : "utf8", (e, r)=>{
77
+ e ? _(e) : t(s ? r.buffer : r);
78
+ });
79
+ }, !Module.thisProgram && $a1KGq.argv.length > 1 && (thisProgram = $a1KGq.argv[1].replace(/\\/g, "/")), arguments_ = $a1KGq.argv.slice(2), module.exports = Module, quit_ = (e, t)=>{
80
+ throw $a1KGq.exitCode = e, t;
81
+ };
82
+ } 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)=>{
83
+ var t = new XMLHttpRequest;
84
+ return t.open("GET", e, !1), t.send(null), t.responseText;
85
+ }, ENVIRONMENT_IS_WORKER && (readBinary = (e)=>{
86
+ var t = new XMLHttpRequest;
87
+ return t.open("GET", e, !1), t.responseType = "arraybuffer", t.send(null), new Uint8Array(t.response);
88
+ }), readAsync = (e, t, _)=>{
89
+ var s = new XMLHttpRequest;
90
+ s.open("GET", e, !0), s.responseType = "arraybuffer", s.onload = ()=>{
91
+ 200 == s.status || 0 == s.status && s.response ? t(s.response) : _();
92
+ }, s.onerror = _, s.send(null);
93
+ });
94
+ var out = Module.print || console.log.bind(console), err = Module.printErr || console.error.bind(console);
95
+ Object.assign(Module, moduleOverrides), moduleOverrides = null, Module.arguments && (arguments_ = Module.arguments), Module.thisProgram && (thisProgram = Module.thisProgram), Module.quit && (quit_ = Module.quit);
96
+ var dynamicLibraries = Module.dynamicLibraries || [], wasmBinary, wasmMemory;
97
+ Module.wasmBinary && (wasmBinary = Module.wasmBinary), "object" != typeof WebAssembly && abort("no native wasm support detected");
98
+ var ABORT = !1, EXITSTATUS, HEAP8, HEAPU8, HEAP16, HEAPU16, HEAP32, HEAPU32, HEAPF32, HEAPF64;
99
+ function updateMemoryViews() {
100
+ var e = wasmMemory.buffer;
101
+ 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);
102
+ }
103
+ var INITIAL_MEMORY = Module.INITIAL_MEMORY || 33554432;
104
+ wasmMemory = Module.wasmMemory ? Module.wasmMemory : new WebAssembly.Memory({
105
+ initial: INITIAL_MEMORY / 65536,
106
+ maximum: 32768
107
+ }), updateMemoryViews(), INITIAL_MEMORY = wasmMemory.buffer.byteLength;
108
+ var __ATPRERUN__ = [], __ATINIT__ = [], __ATMAIN__ = [], __ATPOSTRUN__ = [], __RELOC_FUNCS__ = [], runtimeInitialized = !1;
109
+ function preRun() {
110
+ if (Module.preRun) for("function" == typeof Module.preRun && (Module.preRun = [
111
+ Module.preRun
112
+ ]); Module.preRun.length;)addOnPreRun(Module.preRun.shift());
113
+ callRuntimeCallbacks(__ATPRERUN__);
114
+ }
115
+ function initRuntime() {
116
+ runtimeInitialized = !0, callRuntimeCallbacks(__RELOC_FUNCS__), callRuntimeCallbacks(__ATINIT__);
117
+ }
118
+ function preMain() {
119
+ callRuntimeCallbacks(__ATMAIN__);
120
+ }
121
+ function postRun() {
122
+ if (Module.postRun) for("function" == typeof Module.postRun && (Module.postRun = [
123
+ Module.postRun
124
+ ]); Module.postRun.length;)addOnPostRun(Module.postRun.shift());
125
+ callRuntimeCallbacks(__ATPOSTRUN__);
126
+ }
127
+ function addOnPreRun(e) {
128
+ __ATPRERUN__.unshift(e);
129
+ }
130
+ function addOnInit(e) {
131
+ __ATINIT__.unshift(e);
132
+ }
133
+ function addOnPostRun(e) {
134
+ __ATPOSTRUN__.unshift(e);
135
+ }
136
+ var runDependencies = 0, runDependencyWatcher = null, dependenciesFulfilled = null;
137
+ function getUniqueRunDependency(e) {
138
+ return e;
139
+ }
140
+ function addRunDependency(e) {
141
+ runDependencies++, Module.monitorRunDependencies?.(runDependencies);
142
+ }
143
+ function removeRunDependency(e) {
144
+ if (runDependencies--, Module.monitorRunDependencies?.(runDependencies), 0 == runDependencies && (null !== runDependencyWatcher && (clearInterval(runDependencyWatcher), runDependencyWatcher = null), dependenciesFulfilled)) {
145
+ var t = dependenciesFulfilled;
146
+ dependenciesFulfilled = null, t();
147
+ }
148
+ }
149
+ function abort(e) {
150
+ throw Module.onAbort?.(e), err(e = "Aborted(" + e + ")"), ABORT = !0, EXITSTATUS = 1, e += ". Build with -sASSERTIONS for more info.", new WebAssembly.RuntimeError(e);
151
+ }
152
+ var dataURIPrefix = "data:application/octet-stream;base64,", isDataURI = (e)=>e.startsWith(dataURIPrefix), isFileURI = (e)=>e.startsWith("file://"), wasmBinaryFile;
153
+ function getBinarySync(e) {
154
+ if (e == wasmBinaryFile && wasmBinary) return new Uint8Array(wasmBinary);
155
+ if (readBinary) return readBinary(e);
156
+ throw "both async and sync fetching of the wasm failed";
157
+ }
158
+ function getBinaryPromise(e) {
159
+ if (!wasmBinary && (ENVIRONMENT_IS_WEB || ENVIRONMENT_IS_WORKER)) {
160
+ if ("function" == typeof fetch && !isFileURI(e)) return fetch(e, {
161
+ credentials: "same-origin"
162
+ }).then((t)=>{
163
+ if (!t.ok) throw `failed to load wasm binary file at '${e}'`;
164
+ return t.arrayBuffer();
165
+ }).catch(()=>getBinarySync(e));
166
+ if (readAsync) return new Promise((t, _)=>{
167
+ readAsync(e, (e)=>t(new Uint8Array(e)), _);
168
+ });
169
+ }
170
+ return Promise.resolve().then(()=>getBinarySync(e));
171
+ }
172
+ function instantiateArrayBuffer(e, t, _) {
173
+ return getBinaryPromise(e).then((e)=>WebAssembly.instantiate(e, t)).then(_, (e)=>{
174
+ err(`failed to asynchronously prepare wasm: ${e}`), abort(e);
175
+ });
176
+ }
177
+ function instantiateAsync(e, t, _, s) {
178
+ return e || "function" != typeof WebAssembly.instantiateStreaming || isDataURI(t) || isFileURI(t) || ENVIRONMENT_IS_NODE || "function" != typeof fetch ? instantiateArrayBuffer(t, _, s) : fetch(t, {
179
+ credentials: "same-origin"
180
+ }).then((e)=>WebAssembly.instantiateStreaming(e, _).then(s, function(e) {
181
+ return err(`wasm streaming compile failed: ${e}`), err("falling back to ArrayBuffer instantiation"), instantiateArrayBuffer(t, _, s);
182
+ }));
183
+ }
184
+ function createWasm() {
185
+ var e = {
186
+ env: wasmImports,
187
+ wasi_snapshot_preview1: wasmImports,
188
+ "GOT.mem": new Proxy(wasmImports, GOTHandler),
189
+ "GOT.func": new Proxy(wasmImports, GOTHandler)
190
+ };
191
+ function t(e, t) {
192
+ wasmExports = e.exports, wasmExports = relocateExports(wasmExports, 1024);
193
+ var _ = getDylinkMetadata(t);
194
+ 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;
195
+ }
196
+ if (addRunDependency("wasm-instantiate"), Module.instantiateWasm) try {
197
+ return Module.instantiateWasm(e, t);
198
+ } catch (e) {
199
+ return err(`Module.instantiateWasm callback failed with error: ${e}`), !1;
200
+ }
201
+ return instantiateAsync(wasmBinary, wasmBinaryFile, e, function(e) {
202
+ t(e.instance, e.module);
203
+ }), {};
204
+ }
205
+ wasmBinaryFile = "tree-sitter.wasm", isDataURI(wasmBinaryFile) || (wasmBinaryFile = locateFile(wasmBinaryFile));
206
+ var ASM_CONSTS = {};
207
+ function ExitStatus(e) {
208
+ this.name = "ExitStatus", this.message = `Program terminated with exit(${e})`, this.status = e;
209
+ }
210
+ var GOT = {}, currentModuleWeakSymbols = new Set([]), GOTHandler = {
211
+ get (e, t) {
212
+ var _ = GOT[t];
213
+ return _ || (_ = GOT[t] = new WebAssembly.Global({
214
+ value: "i32",
215
+ mutable: !0
216
+ })), currentModuleWeakSymbols.has(t) || (_.required = !0), _;
217
+ }
218
+ }, callRuntimeCallbacks = (e)=>{
219
+ for(; e.length > 0;)e.shift()(Module);
220
+ }, UTF8Decoder = "undefined" != typeof TextDecoder ? new TextDecoder("utf8") : void 0, UTF8ArrayToString = (e, t, _)=>{
221
+ for(var s = t + _, r = t; e[r] && !(r >= s);)++r;
222
+ if (r - t > 16 && e.buffer && UTF8Decoder) return UTF8Decoder.decode(e.subarray(t, r));
223
+ for(var a = ""; t < r;){
224
+ var o = e[t++];
225
+ if (128 & o) {
226
+ var n = 63 & e[t++];
227
+ if (192 != (224 & o)) {
228
+ var l = 63 & e[t++];
229
+ 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);
230
+ else {
231
+ var d = o - 65536;
232
+ a += String.fromCharCode(55296 | d >> 10, 56320 | 1023 & d);
233
+ }
234
+ } else a += String.fromCharCode((31 & o) << 6 | n);
235
+ } else a += String.fromCharCode(o);
236
+ }
237
+ return a;
238
+ }, getDylinkMetadata = (e)=>{
239
+ var t = 0, _ = 0;
240
+ function s() {
241
+ for(var _ = 0, s = 1;;){
242
+ var r = e[t++];
243
+ if (_ += (127 & r) * s, s *= 128, !(128 & r)) break;
244
+ }
245
+ return _;
246
+ }
247
+ function r() {
248
+ var _ = s();
249
+ return UTF8ArrayToString(e, (t += _) - _, _);
250
+ }
251
+ function a(e, t) {
252
+ if (e) throw new Error(t);
253
+ }
254
+ var o = "dylink.0";
255
+ if (e instanceof WebAssembly.Module) {
256
+ var n = WebAssembly.Module.customSections(e, o);
257
+ 0 === n.length && (o = "dylink", n = WebAssembly.Module.customSections(e, o)), a(0 === n.length, "need dylink section"), _ = (e = new Uint8Array(n[0])).length;
258
+ } else {
259
+ 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;
260
+ var l = s();
261
+ _ = t + l, o = r();
262
+ }
263
+ var d = {
264
+ neededDynlibs: [],
265
+ tlsExports: new Set,
266
+ weakImports: new Set
267
+ };
268
+ if ("dylink" == o) {
269
+ d.memorySize = s(), d.memoryAlign = s(), d.tableSize = s(), d.tableAlign = s();
270
+ for(var u = s(), m = 0; m < u; ++m){
271
+ var c = r();
272
+ d.neededDynlibs.push(c);
273
+ }
274
+ } else {
275
+ a("dylink.0" !== o);
276
+ for(; t < _;){
277
+ var w = e[t++], p = s();
278
+ if (1 === w) d.memorySize = s(), d.memoryAlign = s(), d.tableSize = s(), d.tableAlign = s();
279
+ else if (2 === w) for(u = s(), m = 0; m < u; ++m)c = r(), d.neededDynlibs.push(c);
280
+ else if (3 === w) for(var h = s(); h--;){
281
+ var g = r();
282
+ 256 & s() && d.tlsExports.add(g);
283
+ }
284
+ else if (4 === w) for(h = s(); h--;){
285
+ r(), g = r();
286
+ 1 == (3 & s()) && d.weakImports.add(g);
287
+ }
288
+ else t += p;
289
+ }
290
+ }
291
+ return d;
292
+ };
293
+ function getValue(e, t = "i8") {
294
+ switch(t.endsWith("*") && (t = "*"), t){
295
+ case "i1":
296
+ case "i8":
297
+ return HEAP8[e];
298
+ case "i16":
299
+ return HEAP16[e >> 1];
300
+ case "i32":
301
+ return HEAP32[e >> 2];
302
+ case "i64":
303
+ abort("to do getValue(i64) use WASM_BIGINT");
304
+ case "float":
305
+ return HEAPF32[e >> 2];
306
+ case "double":
307
+ return HEAPF64[e >> 3];
308
+ case "*":
309
+ return HEAPU32[e >> 2];
310
+ default:
311
+ abort(`invalid type for getValue: ${t}`);
312
+ }
313
+ }
314
+ var newDSO = (e, t, _)=>{
315
+ var s = {
316
+ refcount: 1 / 0,
317
+ name: e,
318
+ exports: _,
319
+ global: !0
320
+ };
321
+ return LDSO.loadedLibsByName[e] = s, null != t && (LDSO.loadedLibsByHandle[t] = s), s;
322
+ }, LDSO = {
323
+ loadedLibsByName: {},
324
+ loadedLibsByHandle: {},
325
+ init () {
326
+ newDSO("__main__", 0, wasmImports);
327
+ }
328
+ }, ___heap_base = 78096, zeroMemory = (e, t)=>(HEAPU8.fill(0, e, e + t), e), alignMemory = (e, t)=>Math.ceil(e / t) * t, getMemory = (e)=>{
329
+ if (runtimeInitialized) return zeroMemory(_malloc(e), e);
330
+ var t = ___heap_base, _ = t + alignMemory(e, 16);
331
+ return ___heap_base = _, GOT.__heap_base.value = _, t;
332
+ }, isInternalSym = (e)=>[
333
+ "__cpp_exception",
334
+ "__c_longjmp",
335
+ "__wasm_apply_data_relocs",
336
+ "__dso_handle",
337
+ "__tls_size",
338
+ "__tls_align",
339
+ "__set_stack_limits",
340
+ "_emscripten_tls_init",
341
+ "__wasm_init_tls",
342
+ "__wasm_call_ctors",
343
+ "__start_em_asm",
344
+ "__stop_em_asm",
345
+ "__start_em_js",
346
+ "__stop_em_js"
347
+ ].includes(e) || e.startsWith("__em_js__"), uleb128Encode = (e, t)=>{
348
+ e < 128 ? t.push(e) : t.push(e % 128 | 128, e >> 7);
349
+ }, sigToWasmTypes = (e)=>{
350
+ for(var t = {
351
+ i: "i32",
352
+ j: "i64",
353
+ f: "f32",
354
+ d: "f64",
355
+ e: "externref",
356
+ p: "i32"
357
+ }, _ = {
358
+ parameters: [],
359
+ results: "v" == e[0] ? [] : [
360
+ t[e[0]]
361
+ ]
362
+ }, s = 1; s < e.length; ++s)_.parameters.push(t[e[s]]);
363
+ return _;
364
+ }, generateFuncType = (e, t)=>{
365
+ var _ = e.slice(0, 1), s = e.slice(1), r = {
366
+ i: 127,
367
+ p: 127,
368
+ j: 126,
369
+ f: 125,
370
+ d: 124,
371
+ e: 111
372
+ };
373
+ t.push(96), uleb128Encode(s.length, t);
374
+ for(var a = 0; a < s.length; ++a)t.push(r[s[a]]);
375
+ "v" == _ ? t.push(0) : t.push(1, r[_]);
376
+ }, convertJsFunctionToWasm = (e, t)=>{
377
+ if ("function" == typeof WebAssembly.Function) return new WebAssembly.Function(sigToWasmTypes(t), e);
378
+ var _ = [
379
+ 1
380
+ ];
381
+ generateFuncType(t, _);
382
+ var s = [
383
+ 0,
384
+ 97,
385
+ 115,
386
+ 109,
387
+ 1,
388
+ 0,
389
+ 0,
390
+ 0,
391
+ 1
392
+ ];
393
+ uleb128Encode(_.length, s), s.push(..._), s.push(2, 7, 1, 1, 101, 1, 102, 0, 0, 7, 5, 1, 1, 102, 0, 0);
394
+ var r = new WebAssembly.Module(new Uint8Array(s));
395
+ return new WebAssembly.Instance(r, {
396
+ e: {
397
+ f: e
398
+ }
399
+ }).exports.f;
400
+ }, wasmTableMirror = [], wasmTable = new WebAssembly.Table({
401
+ initial: 27,
402
+ element: "anyfunc"
403
+ }), getWasmTableEntry = (e)=>{
404
+ var t = wasmTableMirror[e];
405
+ return t || (e >= wasmTableMirror.length && (wasmTableMirror.length = e + 1), wasmTableMirror[e] = t = wasmTable.get(e)), t;
406
+ }, updateTableMap = (e, t)=>{
407
+ if (functionsInTableMap) for(var _ = e; _ < e + t; _++){
408
+ var s = getWasmTableEntry(_);
409
+ s && functionsInTableMap.set(s, _);
410
+ }
411
+ }, functionsInTableMap, getFunctionAddress = (e)=>(functionsInTableMap || (functionsInTableMap = new WeakMap, updateTableMap(0, wasmTable.length)), functionsInTableMap.get(e) || 0), freeTableIndexes = [], getEmptyTableSlot = ()=>{
412
+ if (freeTableIndexes.length) return freeTableIndexes.pop();
413
+ try {
414
+ wasmTable.grow(1);
415
+ } catch (e) {
416
+ if (!(e instanceof RangeError)) throw e;
417
+ throw "Unable to grow wasm table. Set ALLOW_TABLE_GROWTH.";
418
+ }
419
+ return wasmTable.length - 1;
420
+ }, setWasmTableEntry = (e, t)=>{
421
+ wasmTable.set(e, t), wasmTableMirror[e] = wasmTable.get(e);
422
+ }, addFunction = (e, t)=>{
423
+ var _ = getFunctionAddress(e);
424
+ if (_) return _;
425
+ var s = getEmptyTableSlot();
426
+ try {
427
+ setWasmTableEntry(s, e);
428
+ } catch (_) {
429
+ if (!(_ instanceof TypeError)) throw _;
430
+ var r = convertJsFunctionToWasm(e, t);
431
+ setWasmTableEntry(s, r);
432
+ }
433
+ return functionsInTableMap.set(e, s), s;
434
+ }, updateGOT = (e, t)=>{
435
+ for(var _ in e)if (!isInternalSym(_)) {
436
+ var s = e[_];
437
+ _.startsWith("orig$") && (_ = _.split("$")[1], t = !0), GOT[_] ||= new WebAssembly.Global({
438
+ value: "i32",
439
+ mutable: !0
440
+ }), (t || 0 == GOT[_].value) && ("function" == typeof s ? GOT[_].value = addFunction(s) : "number" == typeof s ? GOT[_].value = s : err(`unhandled export type for '${_}': ${typeof s}`));
441
+ }
442
+ }, relocateExports = (e, t, _)=>{
443
+ var s = {};
444
+ for(var r in e){
445
+ var a = e[r];
446
+ "object" == typeof a && (a = a.value), "number" == typeof a && (a += t), s[r] = a;
447
+ }
448
+ return updateGOT(s, _), s;
449
+ }, isSymbolDefined = (e)=>{
450
+ var t = wasmImports[e];
451
+ return !(!t || t.stub);
452
+ }, dynCallLegacy = (e, t, _)=>(0, Module["dynCall_" + e])(t, ..._), dynCall = (e, t, _ = [])=>e.includes("j") ? dynCallLegacy(e, t, _) : getWasmTableEntry(t)(..._), createInvokeFunction = (e)=>function() {
453
+ var t = stackSave();
454
+ try {
455
+ return dynCall(e, arguments[0], Array.prototype.slice.call(arguments, 1));
456
+ } catch (e) {
457
+ if (stackRestore(t), e !== e + 0) throw e;
458
+ _setThrew(1, 0);
459
+ }
460
+ }, resolveGlobalSymbol = (e, t = !1)=>{
461
+ var _;
462
+ return t && "orig$" + e in wasmImports && (e = "orig$" + e), isSymbolDefined(e) ? _ = wasmImports[e] : e.startsWith("invoke_") && (_ = wasmImports[e] = createInvokeFunction(e.split("_")[1])), {
463
+ sym: _,
464
+ name: e
465
+ };
466
+ }, UTF8ToString = (e, t)=>e ? UTF8ArrayToString(HEAPU8, e, t) : "", loadWebAssemblyModule = (binary, flags, libName, localScope, handle)=>{
467
+ var metadata = getDylinkMetadata(binary);
468
+ function loadModule() {
469
+ var firstLoad = !handle || !HEAP8[handle + 8];
470
+ if (firstLoad) {
471
+ var memAlign = Math.pow(2, metadata.memoryAlign), memoryBase = metadata.memorySize ? alignMemory(getMemory(metadata.memorySize + memAlign), memAlign) : 0, tableBase = metadata.tableSize ? wasmTable.length : 0;
472
+ 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);
473
+ } else memoryBase = HEAPU32[handle + 12 >> 2], tableBase = HEAPU32[handle + 20 >> 2];
474
+ var tableGrowthNeeded = tableBase + metadata.tableSize - wasmTable.length, moduleExports;
475
+ function resolveSymbol(e) {
476
+ var t = resolveGlobalSymbol(e).sym;
477
+ return !t && localScope && (t = localScope[e]), t || (t = moduleExports[e]), t;
478
+ }
479
+ tableGrowthNeeded > 0 && wasmTable.grow(tableGrowthNeeded);
480
+ var proxyHandler = {
481
+ get (e, t) {
482
+ switch(t){
483
+ case "__memory_base":
484
+ return memoryBase;
485
+ case "__table_base":
486
+ return tableBase;
487
+ }
488
+ if (t in wasmImports && !wasmImports[t].stub) return wasmImports[t];
489
+ var _;
490
+ t in e || (e[t] = (...e)=>(_ ||= resolveSymbol(t), _(...e)));
491
+ return e[t];
492
+ }
493
+ }, proxy = new Proxy({}, proxyHandler), info = {
494
+ "GOT.mem": new Proxy({}, GOTHandler),
495
+ "GOT.func": new Proxy({}, GOTHandler),
496
+ env: proxy,
497
+ wasi_snapshot_preview1: proxy
498
+ };
499
+ function postInstantiation(module1, instance) {
500
+ function addEmAsm(addr, body) {
501
+ for(var args = [], arity = 0; arity < 16 && -1 != body.indexOf("$" + arity); arity++)args.push("$" + arity);
502
+ args = args.join(",");
503
+ var func = `(${args}) => { ${body} };`;
504
+ ASM_CONSTS[start] = eval(func);
505
+ }
506
+ 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;){
507
+ var jsString = UTF8ToString(start);
508
+ addEmAsm(start, jsString), start = HEAPU8.indexOf(0, start) + 1;
509
+ }
510
+ function addEmJs(name, cSig, body) {
511
+ var jsArgs = [];
512
+ if (cSig = cSig.slice(1, -1), "void" != cSig) for(var i in cSig = cSig.split(","), cSig){
513
+ var jsArg = cSig[i].split(" ").pop();
514
+ jsArgs.push(jsArg.replace("*", ""));
515
+ }
516
+ var func = `(${jsArgs}) => ${body};`;
517
+ moduleExports[name] = eval(func);
518
+ }
519
+ for(var name in moduleExports)if (name.startsWith("__em_js__")) {
520
+ var start = moduleExports[name], jsString = UTF8ToString(start), parts = jsString.split("<::>");
521
+ addEmJs(name.replace("__em_js__", ""), parts[0], parts[1]), delete moduleExports[name];
522
+ }
523
+ var applyRelocs = moduleExports.__wasm_apply_data_relocs;
524
+ applyRelocs && (runtimeInitialized ? applyRelocs() : __RELOC_FUNCS__.push(applyRelocs));
525
+ var init = moduleExports.__wasm_call_ctors;
526
+ return init && (runtimeInitialized ? init() : __ATINIT__.push(init)), moduleExports;
527
+ }
528
+ if (flags.loadAsync) {
529
+ if (binary instanceof WebAssembly.Module) {
530
+ var instance = new WebAssembly.Instance(binary, info);
531
+ return Promise.resolve(postInstantiation(binary, instance));
532
+ }
533
+ return WebAssembly.instantiate(binary, info).then((e)=>postInstantiation(e.module, e.instance));
534
+ }
535
+ var module1 = binary instanceof WebAssembly.Module ? binary : new WebAssembly.Module(binary), instance = new WebAssembly.Instance(module1, info);
536
+ return postInstantiation(module1, instance);
537
+ }
538
+ 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());
539
+ }, mergeLibSymbols = (e, t)=>{
540
+ for (var [_, s] of Object.entries(e)){
541
+ const e = (e)=>{
542
+ isSymbolDefined(e) || (wasmImports[e] = s);
543
+ };
544
+ e(_);
545
+ const t = "__main_argc_argv";
546
+ "main" == _ && e(t), _ == t && e("main"), _.startsWith("dynCall_") && !Module.hasOwnProperty(_) && (Module[_] = s);
547
+ }
548
+ }, asyncLoad = (e, t, _, s)=>{
549
+ var r = s ? "" : getUniqueRunDependency(`al ${e}`);
550
+ readAsync(e, (e)=>{
551
+ t(new Uint8Array(e)), r && removeRunDependency(r);
552
+ }, (t)=>{
553
+ if (!_) throw `Loading data file "${e}" failed.`;
554
+ _();
555
+ }), r && addRunDependency(r);
556
+ };
557
+ function loadDynamicLibrary(e, t = {
558
+ global: !0,
559
+ nodelete: !0
560
+ }, _, s) {
561
+ var r = LDSO.loadedLibsByName[e];
562
+ if (r) return t.global ? r.global || (r.global = !0, 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(!0);
563
+ function a() {
564
+ if (s) {
565
+ var _ = HEAPU32[s + 28 >> 2], r = HEAPU32[s + 32 >> 2];
566
+ if (_ && r) {
567
+ var a = HEAP8.slice(_, _ + r);
568
+ return t.loadAsync ? Promise.resolve(a) : a;
569
+ }
570
+ }
571
+ var o = locateFile(e);
572
+ if (t.loadAsync) return new Promise(function(e, t) {
573
+ asyncLoad(o, e, t);
574
+ });
575
+ if (!readBinary) throw new Error(`${o}: file not found, and synchronous loading of external files is not available`);
576
+ return readBinary(o);
577
+ }
578
+ function o() {
579
+ return t.loadAsync ? a().then((r)=>loadWebAssemblyModule(r, t, e, _, s)) : loadWebAssemblyModule(a(), t, e, _, s);
580
+ }
581
+ function n(t) {
582
+ r.global ? mergeLibSymbols(t, e) : _ && Object.assign(_, t), r.exports = t;
583
+ }
584
+ return (r = newDSO(e, s, "loading")).refcount = t.nodelete ? 1 / 0 : 1, r.global = t.global, t.loadAsync ? o().then((e)=>(n(e), !0)) : (n(o()), !0);
585
+ }
586
+ var reportUndefinedSymbols = ()=>{
587
+ for (var [e, t] of Object.entries(GOT))if (0 == t.value) {
588
+ var _ = resolveGlobalSymbol(e, !0).sym;
589
+ if (!_ && !t.required) continue;
590
+ if ("function" == typeof _) t.value = addFunction(_, _.sig);
591
+ else {
592
+ if ("number" != typeof _) throw new Error(`bad export type for '${e}': ${typeof _}`);
593
+ t.value = _;
594
+ }
595
+ }
596
+ }, loadDylibs = ()=>{
597
+ dynamicLibraries.length ? (addRunDependency("loadDylibs"), dynamicLibraries.reduce((e, t)=>e.then(()=>loadDynamicLibrary(t, {
598
+ loadAsync: !0,
599
+ global: !0,
600
+ nodelete: !0,
601
+ allowUndefined: !0
602
+ })), Promise.resolve()).then(()=>{
603
+ reportUndefinedSymbols(), removeRunDependency("loadDylibs");
604
+ })) : reportUndefinedSymbols();
605
+ }, noExitRuntime = Module.noExitRuntime || !0;
606
+ function setValue(e, t, _ = "i8") {
607
+ switch(_.endsWith("*") && (_ = "*"), _){
608
+ case "i1":
609
+ case "i8":
610
+ HEAP8[e] = t;
611
+ break;
612
+ case "i16":
613
+ HEAP16[e >> 1] = t;
614
+ break;
615
+ case "i32":
616
+ HEAP32[e >> 2] = t;
617
+ break;
618
+ case "i64":
619
+ abort("to do setValue(i64) use WASM_BIGINT");
620
+ case "float":
621
+ HEAPF32[e >> 2] = t;
622
+ break;
623
+ case "double":
624
+ HEAPF64[e >> 3] = t;
625
+ break;
626
+ case "*":
627
+ HEAPU32[e >> 2] = t;
628
+ break;
629
+ default:
630
+ abort(`invalid type for setValue: ${_}`);
631
+ }
632
+ }
633
+ var ___memory_base = new WebAssembly.Global({
634
+ value: "i32",
635
+ mutable: !1
636
+ }, 1024), ___stack_pointer = new WebAssembly.Global({
637
+ value: "i32",
638
+ mutable: !0
639
+ }, 78096), ___table_base = new WebAssembly.Global({
640
+ value: "i32",
641
+ mutable: !1
642
+ }, 1), nowIsMonotonic = 1, __emscripten_get_now_is_monotonic = ()=>nowIsMonotonic;
643
+ __emscripten_get_now_is_monotonic.sig = "i";
644
+ var _abort = ()=>{
645
+ abort("");
646
+ };
647
+ _abort.sig = "v";
648
+ var _emscripten_date_now = ()=>Date.now(), _emscripten_get_now;
649
+ _emscripten_date_now.sig = "d", _emscripten_get_now = ()=>performance.now(), _emscripten_get_now.sig = "d";
650
+ var _emscripten_memcpy_js = (e, t, _)=>HEAPU8.copyWithin(e, t, t + _);
651
+ _emscripten_memcpy_js.sig = "vppp";
652
+ var getHeapMax = ()=>2147483648, growMemory = (e)=>{
653
+ var t = (e - wasmMemory.buffer.byteLength + 65535) / 65536;
654
+ try {
655
+ return wasmMemory.grow(t), updateMemoryViews(), 1;
656
+ } catch (e) {}
657
+ }, _emscripten_resize_heap = (e)=>{
658
+ var t = HEAPU8.length;
659
+ e >>>= 0;
660
+ var _ = getHeapMax();
661
+ if (e > _) return !1;
662
+ for(var s, r, a = 1; a <= 4; a *= 2){
663
+ var o = t * (1 + .2 / a);
664
+ o = Math.min(o, e + 100663296);
665
+ var n = Math.min(_, (s = Math.max(e, o)) + ((r = 65536) - s % r) % r);
666
+ if (growMemory(n)) return !0;
667
+ }
668
+ return !1;
669
+ };
670
+ _emscripten_resize_heap.sig = "ip";
671
+ var _fd_close = (e)=>52;
672
+ _fd_close.sig = "ii";
673
+ var convertI32PairToI53Checked = (e, t)=>t + 2097152 >>> 0 < 4194305 - !!e ? (e >>> 0) + 4294967296 * t : NaN;
674
+ function _fd_seek(e, t, _, s, r) {
675
+ convertI32PairToI53Checked(t, _);
676
+ return 70;
677
+ }
678
+ _fd_seek.sig = "iiiiip";
679
+ var printCharBuffers = [
680
+ null,
681
+ [],
682
+ []
683
+ ], printChar = (e, t)=>{
684
+ var _ = printCharBuffers[e];
685
+ 0 === t || 10 === t ? ((1 === e ? out : err)(UTF8ArrayToString(_, 0)), _.length = 0) : _.push(t);
686
+ }, SYSCALLS = {
687
+ varargs: void 0,
688
+ get () {
689
+ var e = HEAP32[+SYSCALLS.varargs >> 2];
690
+ return SYSCALLS.varargs += 4, e;
691
+ },
692
+ getp: ()=>SYSCALLS.get(),
693
+ getStr: (e)=>UTF8ToString(e)
694
+ }, _fd_write = (e, t, _, s)=>{
695
+ for(var r = 0, a = 0; a < _; a++){
696
+ var o = HEAPU32[t >> 2], n = HEAPU32[t + 4 >> 2];
697
+ t += 8;
698
+ for(var l = 0; l < n; l++)printChar(e, HEAPU8[o + l]);
699
+ r += n;
700
+ }
701
+ return HEAPU32[s >> 2] = r, 0;
702
+ };
703
+ function _tree_sitter_log_callback(e, t) {
704
+ if (currentLogCallback) {
705
+ const _ = UTF8ToString(t);
706
+ currentLogCallback(_, 0 !== e);
707
+ }
708
+ }
709
+ function _tree_sitter_parse_callback(e, t, _, s, r) {
710
+ const a = currentParseCallback(t, {
711
+ row: _,
712
+ column: s
713
+ });
714
+ "string" == typeof a ? (setValue(r, a.length, "i32"), stringToUTF16(a, e, 10240)) : setValue(r, 0, "i32");
715
+ }
716
+ _fd_write.sig = "iippp";
717
+ var runtimeKeepaliveCounter = 0, keepRuntimeAlive = ()=>noExitRuntime || runtimeKeepaliveCounter > 0, _proc_exit = (e)=>{
718
+ EXITSTATUS = e, keepRuntimeAlive() || (Module.onExit?.(e), ABORT = !0), quit_(e, new ExitStatus(e));
719
+ };
720
+ _proc_exit.sig = "vi";
721
+ var exitJS = (e, t)=>{
722
+ EXITSTATUS = e, _proc_exit(e);
723
+ }, handleException = (e)=>{
724
+ if (e instanceof ExitStatus || "unwind" == e) return EXITSTATUS;
725
+ quit_(1, e);
726
+ }, lengthBytesUTF8 = (e)=>{
727
+ for(var t = 0, _ = 0; _ < e.length; ++_){
728
+ var s = e.charCodeAt(_);
729
+ s <= 127 ? t++ : s <= 2047 ? t += 2 : s >= 55296 && s <= 57343 ? (t += 4, ++_) : t += 3;
730
+ }
731
+ return t;
732
+ }, stringToUTF8Array = (e, t, _, s)=>{
733
+ if (!(s > 0)) return 0;
734
+ for(var r = _, a = _ + s - 1, o = 0; o < e.length; ++o){
735
+ var n = e.charCodeAt(o);
736
+ if (n >= 55296 && n <= 57343) n = 65536 + ((1023 & n) << 10) | 1023 & e.charCodeAt(++o);
737
+ if (n <= 127) {
738
+ if (_ >= a) break;
739
+ t[_++] = n;
740
+ } else if (n <= 2047) {
741
+ if (_ + 1 >= a) break;
742
+ t[_++] = 192 | n >> 6, t[_++] = 128 | 63 & n;
743
+ } else if (n <= 65535) {
744
+ if (_ + 2 >= a) break;
745
+ t[_++] = 224 | n >> 12, t[_++] = 128 | n >> 6 & 63, t[_++] = 128 | 63 & n;
746
+ } else {
747
+ if (_ + 3 >= a) break;
748
+ t[_++] = 240 | n >> 18, t[_++] = 128 | n >> 12 & 63, t[_++] = 128 | n >> 6 & 63, t[_++] = 128 | 63 & n;
749
+ }
750
+ }
751
+ return t[_] = 0, _ - r;
752
+ }, stringToUTF8 = (e, t, _)=>stringToUTF8Array(e, HEAPU8, t, _), stringToUTF8OnStack = (e)=>{
753
+ var t = lengthBytesUTF8(e) + 1, _ = stackAlloc(t);
754
+ return stringToUTF8(e, _, t), _;
755
+ }, stringToUTF16 = (e, t, _)=>{
756
+ if (_ ??= 2147483647, _ < 2) return 0;
757
+ for(var s = t, r = (_ -= 2) < 2 * e.length ? _ / 2 : e.length, a = 0; a < r; ++a){
758
+ var o = e.charCodeAt(a);
759
+ HEAP16[t >> 1] = o, t += 2;
760
+ }
761
+ return HEAP16[t >> 1] = 0, t - s;
762
+ }, AsciiToString = (e)=>{
763
+ for(var t = "";;){
764
+ var _ = HEAPU8[e++];
765
+ if (!_) return t;
766
+ t += String.fromCharCode(_);
767
+ }
768
+ }, wasmImports = {
769
+ __heap_base: ___heap_base,
770
+ __indirect_function_table: wasmTable,
771
+ __memory_base: ___memory_base,
772
+ __stack_pointer: ___stack_pointer,
773
+ __table_base: ___table_base,
774
+ _emscripten_get_now_is_monotonic: __emscripten_get_now_is_monotonic,
775
+ abort: _abort,
776
+ emscripten_get_now: _emscripten_get_now,
777
+ emscripten_memcpy_js: _emscripten_memcpy_js,
778
+ emscripten_resize_heap: _emscripten_resize_heap,
779
+ fd_close: _fd_close,
780
+ fd_seek: _fd_seek,
781
+ fd_write: _fd_write,
782
+ memory: wasmMemory,
783
+ tree_sitter_log_callback: _tree_sitter_log_callback,
784
+ tree_sitter_parse_callback: _tree_sitter_parse_callback
785
+ }, 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;
786
+ function callMain(e = []) {
787
+ var t = resolveGlobalSymbol("main").sym;
788
+ if (t) {
789
+ e.unshift(thisProgram);
790
+ var _ = e.length, s = stackAlloc(4 * (_ + 1)), r = s;
791
+ e.forEach((e)=>{
792
+ HEAPU32[r >> 2] = stringToUTF8OnStack(e), r += 4;
793
+ }), HEAPU32[r >> 2] = 0;
794
+ try {
795
+ var a = t(_, s);
796
+ return exitJS(a, !0), a;
797
+ } catch (e) {
798
+ return handleException(e);
799
+ }
800
+ }
801
+ }
802
+ function run(e = arguments_) {
803
+ function t() {
804
+ calledRun || (calledRun = !0, Module.calledRun = !0, ABORT || (initRuntime(), preMain(), Module.onRuntimeInitialized && Module.onRuntimeInitialized(), shouldRunNow && callMain(e), postRun()));
805
+ }
806
+ runDependencies > 0 || (preRun(), runDependencies > 0 || (Module.setStatus ? (Module.setStatus("Running..."), setTimeout(function() {
807
+ setTimeout(function() {
808
+ Module.setStatus("");
809
+ }, 1), t();
810
+ }, 1)) : t()));
811
+ }
812
+ if (Module.AsciiToString = AsciiToString, Module.stringToUTF16 = stringToUTF16, dependenciesFulfilled = function e() {
813
+ calledRun || run(), calledRun || (dependenciesFulfilled = e);
814
+ }, Module.preInit) for("function" == typeof Module.preInit && (Module.preInit = [
815
+ Module.preInit
816
+ ]); Module.preInit.length > 0;)Module.preInit.pop()();
817
+ var shouldRunNow = !0;
818
+ Module.noInitialRun && (shouldRunNow = !1), run();
819
+ 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 = {
820
+ row: 0,
821
+ column: 0
822
+ }, QUERY_WORD_REGEX = /[\w-.]*/g, PREDICATE_STEP_TYPE_CAPTURE = 1, PREDICATE_STEP_TYPE_STRING = 2, LANGUAGE_FUNCTION_REGEX = /^_?tree_sitter_\w+/;
823
+ let VERSION, MIN_COMPATIBLE_VERSION, TRANSFER_BUFFER, currentParseCallback, currentLogCallback;
824
+ class ParserImpl {
825
+ static init() {
826
+ TRANSFER_BUFFER = C._ts_init(), VERSION = getValue(TRANSFER_BUFFER, "i32"), MIN_COMPATIBLE_VERSION = getValue(TRANSFER_BUFFER + SIZE_OF_INT, "i32");
827
+ }
828
+ initialize() {
829
+ C._ts_parser_new_wasm(), this[0] = getValue(TRANSFER_BUFFER, "i32"), this[1] = getValue(TRANSFER_BUFFER + SIZE_OF_INT, "i32");
830
+ }
831
+ delete() {
832
+ C._ts_parser_delete(this[0]), C._free(this[1]), this[0] = 0, this[1] = 0;
833
+ }
834
+ setLanguage(e) {
835
+ let t;
836
+ if (e) {
837
+ if (e.constructor !== Language) throw new Error("Argument must be a Language");
838
+ {
839
+ t = e[0];
840
+ const _ = C._ts_language_version(t);
841
+ if (_ < MIN_COMPATIBLE_VERSION || VERSION < _) throw new Error(`Incompatible language version ${_}. Compatibility range ${MIN_COMPATIBLE_VERSION} through ${VERSION}.`);
842
+ }
843
+ } else t = 0, e = null;
844
+ return this.language = e, C._ts_parser_set_language(this[0], t), this;
845
+ }
846
+ getLanguage() {
847
+ return this.language;
848
+ }
849
+ parse(e, t, _) {
850
+ if ("string" == typeof e) currentParseCallback = (t, _)=>e.slice(t);
851
+ else {
852
+ if ("function" != typeof e) throw new Error("Argument must be a string or a function");
853
+ currentParseCallback = e;
854
+ }
855
+ 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));
856
+ let s = 0, r = 0;
857
+ if (_?.includedRanges) {
858
+ s = _.includedRanges.length, r = C._calloc(s, SIZE_OF_RANGE);
859
+ let e = r;
860
+ for(let t = 0; t < s; t++)marshalRange(e, _.includedRanges[t]), e += SIZE_OF_RANGE;
861
+ }
862
+ const a = C._ts_parser_parse_wasm(this[0], this[1], t ? t[0] : 0, r, s);
863
+ if (!a) throw currentParseCallback = null, currentLogCallback = null, new Error("Parsing failed");
864
+ const o = new Tree(INTERNAL, a, this.language, currentParseCallback);
865
+ return currentParseCallback = null, currentLogCallback = null, o;
866
+ }
867
+ reset() {
868
+ C._ts_parser_reset(this[0]);
869
+ }
870
+ getIncludedRanges() {
871
+ C._ts_parser_included_ranges_wasm(this[0]);
872
+ const e = getValue(TRANSFER_BUFFER, "i32"), t = getValue(TRANSFER_BUFFER + SIZE_OF_INT, "i32"), _ = new Array(e);
873
+ if (e > 0) {
874
+ let s = t;
875
+ for(let t = 0; t < e; t++)_[t] = unmarshalRange(s), s += SIZE_OF_RANGE;
876
+ C._free(t);
877
+ }
878
+ return _;
879
+ }
880
+ getTimeoutMicros() {
881
+ return C._ts_parser_timeout_micros(this[0]);
882
+ }
883
+ setTimeoutMicros(e) {
884
+ C._ts_parser_set_timeout_micros(this[0], e);
885
+ }
886
+ setLogger(e) {
887
+ if (e) {
888
+ if ("function" != typeof e) throw new Error("Logger callback must be a function");
889
+ } else e = null;
890
+ return this.logCallback = e, this;
891
+ }
892
+ getLogger() {
893
+ return this.logCallback;
894
+ }
895
+ }
896
+ class Tree {
897
+ constructor(e, t, _, s){
898
+ assertInternal(e), this[0] = t, this.language = _, this.textCallback = s;
899
+ }
900
+ copy() {
901
+ const e = C._ts_tree_copy(this[0]);
902
+ return new Tree(INTERNAL, e, this.language, this.textCallback);
903
+ }
904
+ delete() {
905
+ C._ts_tree_delete(this[0]), this[0] = 0;
906
+ }
907
+ edit(e) {
908
+ marshalEdit(e), C._ts_tree_edit_wasm(this[0]);
909
+ }
910
+ get rootNode() {
911
+ return C._ts_tree_root_node_wasm(this[0]), unmarshalNode(this);
912
+ }
913
+ rootNodeWithOffset(e, t) {
914
+ const _ = TRANSFER_BUFFER + SIZE_OF_NODE;
915
+ return setValue(_, e, "i32"), marshalPoint(_ + SIZE_OF_INT, t), C._ts_tree_root_node_with_offset_wasm(this[0]), unmarshalNode(this);
916
+ }
917
+ getLanguage() {
918
+ return this.language;
919
+ }
920
+ walk() {
921
+ return this.rootNode.walk();
922
+ }
923
+ getChangedRanges(e) {
924
+ if (e.constructor !== Tree) throw new TypeError("Argument must be a Tree");
925
+ C._ts_tree_get_changed_ranges_wasm(this[0], e[0]);
926
+ const t = getValue(TRANSFER_BUFFER, "i32"), _ = getValue(TRANSFER_BUFFER + SIZE_OF_INT, "i32"), s = new Array(t);
927
+ if (t > 0) {
928
+ let e = _;
929
+ for(let _ = 0; _ < t; _++)s[_] = unmarshalRange(e), e += SIZE_OF_RANGE;
930
+ C._free(_);
931
+ }
932
+ return s;
933
+ }
934
+ getIncludedRanges() {
935
+ C._ts_tree_included_ranges_wasm(this[0]);
936
+ const e = getValue(TRANSFER_BUFFER, "i32"), t = getValue(TRANSFER_BUFFER + SIZE_OF_INT, "i32"), _ = new Array(e);
937
+ if (e > 0) {
938
+ let s = t;
939
+ for(let t = 0; t < e; t++)_[t] = unmarshalRange(s), s += SIZE_OF_RANGE;
940
+ C._free(t);
941
+ }
942
+ return _;
943
+ }
944
+ }
945
+ class Node {
946
+ constructor(e, t){
947
+ assertInternal(e), this.tree = t;
948
+ }
949
+ get typeId() {
950
+ return marshalNode(this), C._ts_node_symbol_wasm(this.tree[0]);
951
+ }
952
+ get grammarId() {
953
+ return marshalNode(this), C._ts_node_grammar_symbol_wasm(this.tree[0]);
954
+ }
955
+ get type() {
956
+ return this.tree.language.types[this.typeId] || "ERROR";
957
+ }
958
+ get grammarType() {
959
+ return this.tree.language.types[this.grammarId] || "ERROR";
960
+ }
961
+ get endPosition() {
962
+ return marshalNode(this), C._ts_node_end_point_wasm(this.tree[0]), unmarshalPoint(TRANSFER_BUFFER);
963
+ }
964
+ get endIndex() {
965
+ return marshalNode(this), C._ts_node_end_index_wasm(this.tree[0]);
966
+ }
967
+ get text() {
968
+ return getText(this.tree, this.startIndex, this.endIndex);
969
+ }
970
+ get parseState() {
971
+ return marshalNode(this), C._ts_node_parse_state_wasm(this.tree[0]);
972
+ }
973
+ get nextParseState() {
974
+ return marshalNode(this), C._ts_node_next_parse_state_wasm(this.tree[0]);
975
+ }
976
+ get isNamed() {
977
+ return marshalNode(this), 1 === C._ts_node_is_named_wasm(this.tree[0]);
978
+ }
979
+ get hasError() {
980
+ return marshalNode(this), 1 === C._ts_node_has_error_wasm(this.tree[0]);
981
+ }
982
+ get hasChanges() {
983
+ return marshalNode(this), 1 === C._ts_node_has_changes_wasm(this.tree[0]);
984
+ }
985
+ get isError() {
986
+ return marshalNode(this), 1 === C._ts_node_is_error_wasm(this.tree[0]);
987
+ }
988
+ get isMissing() {
989
+ return marshalNode(this), 1 === C._ts_node_is_missing_wasm(this.tree[0]);
990
+ }
991
+ get isExtra() {
992
+ return marshalNode(this), 1 === C._ts_node_is_extra_wasm(this.tree[0]);
993
+ }
994
+ equals(e) {
995
+ return this.id === e.id;
996
+ }
997
+ child(e) {
998
+ return marshalNode(this), C._ts_node_child_wasm(this.tree[0], e), unmarshalNode(this.tree);
999
+ }
1000
+ namedChild(e) {
1001
+ return marshalNode(this), C._ts_node_named_child_wasm(this.tree[0], e), unmarshalNode(this.tree);
1002
+ }
1003
+ childForFieldId(e) {
1004
+ return marshalNode(this), C._ts_node_child_by_field_id_wasm(this.tree[0], e), unmarshalNode(this.tree);
1005
+ }
1006
+ childForFieldName(e) {
1007
+ const t = this.tree.language.fields.indexOf(e);
1008
+ return -1 !== t ? this.childForFieldId(t) : null;
1009
+ }
1010
+ fieldNameForChild(e) {
1011
+ marshalNode(this);
1012
+ const t = C._ts_node_field_name_for_child_wasm(this.tree[0], e);
1013
+ if (!t) return null;
1014
+ return AsciiToString(t);
1015
+ }
1016
+ childrenForFieldName(e) {
1017
+ const t = this.tree.language.fields.indexOf(e);
1018
+ return -1 !== t && 0 !== t ? this.childrenForFieldId(t) : [];
1019
+ }
1020
+ childrenForFieldId(e) {
1021
+ marshalNode(this), C._ts_node_children_by_field_id_wasm(this.tree[0], e);
1022
+ const t = getValue(TRANSFER_BUFFER, "i32"), _ = getValue(TRANSFER_BUFFER + SIZE_OF_INT, "i32"), s = new Array(t);
1023
+ if (t > 0) {
1024
+ let e = _;
1025
+ for(let _ = 0; _ < t; _++)s[_] = unmarshalNode(this.tree, e), e += SIZE_OF_NODE;
1026
+ C._free(_);
1027
+ }
1028
+ return s;
1029
+ }
1030
+ firstChildForIndex(e) {
1031
+ marshalNode(this);
1032
+ return setValue(TRANSFER_BUFFER + SIZE_OF_NODE, e, "i32"), C._ts_node_first_child_for_byte_wasm(this.tree[0]), unmarshalNode(this.tree);
1033
+ }
1034
+ firstNamedChildForIndex(e) {
1035
+ marshalNode(this);
1036
+ return setValue(TRANSFER_BUFFER + SIZE_OF_NODE, e, "i32"), C._ts_node_first_named_child_for_byte_wasm(this.tree[0]), unmarshalNode(this.tree);
1037
+ }
1038
+ get childCount() {
1039
+ return marshalNode(this), C._ts_node_child_count_wasm(this.tree[0]);
1040
+ }
1041
+ get namedChildCount() {
1042
+ return marshalNode(this), C._ts_node_named_child_count_wasm(this.tree[0]);
1043
+ }
1044
+ get firstChild() {
1045
+ return this.child(0);
1046
+ }
1047
+ get firstNamedChild() {
1048
+ return this.namedChild(0);
1049
+ }
1050
+ get lastChild() {
1051
+ return this.child(this.childCount - 1);
1052
+ }
1053
+ get lastNamedChild() {
1054
+ return this.namedChild(this.namedChildCount - 1);
1055
+ }
1056
+ get children() {
1057
+ if (!this._children) {
1058
+ marshalNode(this), C._ts_node_children_wasm(this.tree[0]);
1059
+ const e = getValue(TRANSFER_BUFFER, "i32"), t = getValue(TRANSFER_BUFFER + SIZE_OF_INT, "i32");
1060
+ if (this._children = new Array(e), e > 0) {
1061
+ let _ = t;
1062
+ for(let t = 0; t < e; t++)this._children[t] = unmarshalNode(this.tree, _), _ += SIZE_OF_NODE;
1063
+ C._free(t);
1064
+ }
1065
+ }
1066
+ return this._children;
1067
+ }
1068
+ get namedChildren() {
1069
+ if (!this._namedChildren) {
1070
+ marshalNode(this), C._ts_node_named_children_wasm(this.tree[0]);
1071
+ const e = getValue(TRANSFER_BUFFER, "i32"), t = getValue(TRANSFER_BUFFER + SIZE_OF_INT, "i32");
1072
+ if (this._namedChildren = new Array(e), e > 0) {
1073
+ let _ = t;
1074
+ for(let t = 0; t < e; t++)this._namedChildren[t] = unmarshalNode(this.tree, _), _ += SIZE_OF_NODE;
1075
+ C._free(t);
1076
+ }
1077
+ }
1078
+ return this._namedChildren;
1079
+ }
1080
+ descendantsOfType(e, t, _) {
1081
+ Array.isArray(e) || (e = [
1082
+ e
1083
+ ]), t || (t = ZERO_POINT), _ || (_ = ZERO_POINT);
1084
+ const s = [], r = this.tree.language.types;
1085
+ for(let t = 0, _ = r.length; t < _; t++)e.includes(r[t]) && s.push(t);
1086
+ const a = C._malloc(SIZE_OF_INT * s.length);
1087
+ for(let e = 0, t = s.length; e < t; e++)setValue(a + e * SIZE_OF_INT, s[e], "i32");
1088
+ marshalNode(this), C._ts_node_descendants_of_type_wasm(this.tree[0], a, s.length, t.row, t.column, _.row, _.column);
1089
+ const o = getValue(TRANSFER_BUFFER, "i32"), n = getValue(TRANSFER_BUFFER + SIZE_OF_INT, "i32"), l = new Array(o);
1090
+ if (o > 0) {
1091
+ let e = n;
1092
+ for(let t = 0; t < o; t++)l[t] = unmarshalNode(this.tree, e), e += SIZE_OF_NODE;
1093
+ }
1094
+ return C._free(n), C._free(a), l;
1095
+ }
1096
+ get nextSibling() {
1097
+ return marshalNode(this), C._ts_node_next_sibling_wasm(this.tree[0]), unmarshalNode(this.tree);
1098
+ }
1099
+ get previousSibling() {
1100
+ return marshalNode(this), C._ts_node_prev_sibling_wasm(this.tree[0]), unmarshalNode(this.tree);
1101
+ }
1102
+ get nextNamedSibling() {
1103
+ return marshalNode(this), C._ts_node_next_named_sibling_wasm(this.tree[0]), unmarshalNode(this.tree);
1104
+ }
1105
+ get previousNamedSibling() {
1106
+ return marshalNode(this), C._ts_node_prev_named_sibling_wasm(this.tree[0]), unmarshalNode(this.tree);
1107
+ }
1108
+ get descendantCount() {
1109
+ return marshalNode(this), C._ts_node_descendant_count_wasm(this.tree[0]);
1110
+ }
1111
+ get parent() {
1112
+ return marshalNode(this), C._ts_node_parent_wasm(this.tree[0]), unmarshalNode(this.tree);
1113
+ }
1114
+ descendantForIndex(e, t = e) {
1115
+ if ("number" != typeof e || "number" != typeof t) throw new Error("Arguments must be numbers");
1116
+ marshalNode(this);
1117
+ const _ = TRANSFER_BUFFER + SIZE_OF_NODE;
1118
+ return setValue(_, e, "i32"), setValue(_ + SIZE_OF_INT, t, "i32"), C._ts_node_descendant_for_index_wasm(this.tree[0]), unmarshalNode(this.tree);
1119
+ }
1120
+ namedDescendantForIndex(e, t = e) {
1121
+ if ("number" != typeof e || "number" != typeof t) throw new Error("Arguments must be numbers");
1122
+ marshalNode(this);
1123
+ const _ = TRANSFER_BUFFER + SIZE_OF_NODE;
1124
+ return setValue(_, e, "i32"), setValue(_ + SIZE_OF_INT, t, "i32"), C._ts_node_named_descendant_for_index_wasm(this.tree[0]), unmarshalNode(this.tree);
1125
+ }
1126
+ descendantForPosition(e, t = e) {
1127
+ if (!isPoint(e) || !isPoint(t)) throw new Error("Arguments must be {row, column} objects");
1128
+ marshalNode(this);
1129
+ const _ = TRANSFER_BUFFER + SIZE_OF_NODE;
1130
+ return marshalPoint(_, e), marshalPoint(_ + SIZE_OF_POINT, t), C._ts_node_descendant_for_position_wasm(this.tree[0]), unmarshalNode(this.tree);
1131
+ }
1132
+ namedDescendantForPosition(e, t = e) {
1133
+ if (!isPoint(e) || !isPoint(t)) throw new Error("Arguments must be {row, column} objects");
1134
+ marshalNode(this);
1135
+ const _ = TRANSFER_BUFFER + SIZE_OF_NODE;
1136
+ return marshalPoint(_, e), marshalPoint(_ + SIZE_OF_POINT, t), C._ts_node_named_descendant_for_position_wasm(this.tree[0]), unmarshalNode(this.tree);
1137
+ }
1138
+ walk() {
1139
+ return marshalNode(this), C._ts_tree_cursor_new_wasm(this.tree[0]), new TreeCursor(INTERNAL, this.tree);
1140
+ }
1141
+ toString() {
1142
+ marshalNode(this);
1143
+ const e = C._ts_node_to_string_wasm(this.tree[0]), t = AsciiToString(e);
1144
+ return C._free(e), t;
1145
+ }
1146
+ }
1147
+ class TreeCursor {
1148
+ constructor(e, t){
1149
+ assertInternal(e), this.tree = t, unmarshalTreeCursor(this);
1150
+ }
1151
+ delete() {
1152
+ marshalTreeCursor(this), C._ts_tree_cursor_delete_wasm(this.tree[0]), this[0] = this[1] = this[2] = 0;
1153
+ }
1154
+ reset(e) {
1155
+ marshalNode(e), marshalTreeCursor(this, TRANSFER_BUFFER + SIZE_OF_NODE), C._ts_tree_cursor_reset_wasm(this.tree[0]), unmarshalTreeCursor(this);
1156
+ }
1157
+ resetTo(e) {
1158
+ 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);
1159
+ }
1160
+ get nodeType() {
1161
+ return this.tree.language.types[this.nodeTypeId] || "ERROR";
1162
+ }
1163
+ get nodeTypeId() {
1164
+ return marshalTreeCursor(this), C._ts_tree_cursor_current_node_type_id_wasm(this.tree[0]);
1165
+ }
1166
+ get nodeStateId() {
1167
+ return marshalTreeCursor(this), C._ts_tree_cursor_current_node_state_id_wasm(this.tree[0]);
1168
+ }
1169
+ get nodeId() {
1170
+ return marshalTreeCursor(this), C._ts_tree_cursor_current_node_id_wasm(this.tree[0]);
1171
+ }
1172
+ get nodeIsNamed() {
1173
+ return marshalTreeCursor(this), 1 === C._ts_tree_cursor_current_node_is_named_wasm(this.tree[0]);
1174
+ }
1175
+ get nodeIsMissing() {
1176
+ return marshalTreeCursor(this), 1 === C._ts_tree_cursor_current_node_is_missing_wasm(this.tree[0]);
1177
+ }
1178
+ get nodeText() {
1179
+ marshalTreeCursor(this);
1180
+ const e = C._ts_tree_cursor_start_index_wasm(this.tree[0]), t = C._ts_tree_cursor_end_index_wasm(this.tree[0]);
1181
+ return getText(this.tree, e, t);
1182
+ }
1183
+ get startPosition() {
1184
+ return marshalTreeCursor(this), C._ts_tree_cursor_start_position_wasm(this.tree[0]), unmarshalPoint(TRANSFER_BUFFER);
1185
+ }
1186
+ get endPosition() {
1187
+ return marshalTreeCursor(this), C._ts_tree_cursor_end_position_wasm(this.tree[0]), unmarshalPoint(TRANSFER_BUFFER);
1188
+ }
1189
+ get startIndex() {
1190
+ return marshalTreeCursor(this), C._ts_tree_cursor_start_index_wasm(this.tree[0]);
1191
+ }
1192
+ get endIndex() {
1193
+ return marshalTreeCursor(this), C._ts_tree_cursor_end_index_wasm(this.tree[0]);
1194
+ }
1195
+ get currentNode() {
1196
+ return marshalTreeCursor(this), C._ts_tree_cursor_current_node_wasm(this.tree[0]), unmarshalNode(this.tree);
1197
+ }
1198
+ get currentFieldId() {
1199
+ return marshalTreeCursor(this), C._ts_tree_cursor_current_field_id_wasm(this.tree[0]);
1200
+ }
1201
+ get currentFieldName() {
1202
+ return this.tree.language.fields[this.currentFieldId];
1203
+ }
1204
+ get currentDepth() {
1205
+ return marshalTreeCursor(this), C._ts_tree_cursor_current_depth_wasm(this.tree[0]);
1206
+ }
1207
+ get currentDescendantIndex() {
1208
+ return marshalTreeCursor(this), C._ts_tree_cursor_current_descendant_index_wasm(this.tree[0]);
1209
+ }
1210
+ gotoFirstChild() {
1211
+ marshalTreeCursor(this);
1212
+ const e = C._ts_tree_cursor_goto_first_child_wasm(this.tree[0]);
1213
+ return unmarshalTreeCursor(this), 1 === e;
1214
+ }
1215
+ gotoLastChild() {
1216
+ marshalTreeCursor(this);
1217
+ const e = C._ts_tree_cursor_goto_last_child_wasm(this.tree[0]);
1218
+ return unmarshalTreeCursor(this), 1 === e;
1219
+ }
1220
+ gotoFirstChildForIndex(e) {
1221
+ marshalTreeCursor(this), setValue(TRANSFER_BUFFER + SIZE_OF_CURSOR, e, "i32");
1222
+ const t = C._ts_tree_cursor_goto_first_child_for_index_wasm(this.tree[0]);
1223
+ return unmarshalTreeCursor(this), 1 === t;
1224
+ }
1225
+ gotoFirstChildForPosition(e) {
1226
+ marshalTreeCursor(this), marshalPoint(TRANSFER_BUFFER + SIZE_OF_CURSOR, e);
1227
+ const t = C._ts_tree_cursor_goto_first_child_for_position_wasm(this.tree[0]);
1228
+ return unmarshalTreeCursor(this), 1 === t;
1229
+ }
1230
+ gotoNextSibling() {
1231
+ marshalTreeCursor(this);
1232
+ const e = C._ts_tree_cursor_goto_next_sibling_wasm(this.tree[0]);
1233
+ return unmarshalTreeCursor(this), 1 === e;
1234
+ }
1235
+ gotoPreviousSibling() {
1236
+ marshalTreeCursor(this);
1237
+ const e = C._ts_tree_cursor_goto_previous_sibling_wasm(this.tree[0]);
1238
+ return unmarshalTreeCursor(this), 1 === e;
1239
+ }
1240
+ gotoDescendant(e) {
1241
+ marshalTreeCursor(this), C._ts_tree_cursor_goto_descendant_wasm(this.tree[0], e), unmarshalTreeCursor(this);
1242
+ }
1243
+ gotoParent() {
1244
+ marshalTreeCursor(this);
1245
+ const e = C._ts_tree_cursor_goto_parent_wasm(this.tree[0]);
1246
+ return unmarshalTreeCursor(this), 1 === e;
1247
+ }
1248
+ }
1249
+ class Language {
1250
+ constructor(e, t){
1251
+ assertInternal(e), this[0] = t, this.types = new Array(C._ts_language_symbol_count(this[0]));
1252
+ for(let e = 0, t = this.types.length; e < t; e++)C._ts_language_symbol_type(this[0], e) < 2 && (this.types[e] = UTF8ToString(C._ts_language_symbol_name(this[0], e)));
1253
+ this.fields = new Array(C._ts_language_field_count(this[0]) + 1);
1254
+ for(let e = 0, t = this.fields.length; e < t; e++){
1255
+ const t = C._ts_language_field_name_for_id(this[0], e);
1256
+ this.fields[e] = 0 !== t ? UTF8ToString(t) : null;
1257
+ }
1258
+ }
1259
+ get version() {
1260
+ return C._ts_language_version(this[0]);
1261
+ }
1262
+ get fieldCount() {
1263
+ return this.fields.length - 1;
1264
+ }
1265
+ get stateCount() {
1266
+ return C._ts_language_state_count(this[0]);
1267
+ }
1268
+ fieldIdForName(e) {
1269
+ const t = this.fields.indexOf(e);
1270
+ return -1 !== t ? t : null;
1271
+ }
1272
+ fieldNameForId(e) {
1273
+ return this.fields[e] || null;
1274
+ }
1275
+ idForNodeType(e, t) {
1276
+ const _ = lengthBytesUTF8(e), s = C._malloc(_ + 1);
1277
+ stringToUTF8(e, s, _ + 1);
1278
+ const r = C._ts_language_symbol_for_name(this[0], s, _, t);
1279
+ return C._free(s), r || null;
1280
+ }
1281
+ get nodeTypeCount() {
1282
+ return C._ts_language_symbol_count(this[0]);
1283
+ }
1284
+ nodeTypeForId(e) {
1285
+ const t = C._ts_language_symbol_name(this[0], e);
1286
+ return t ? UTF8ToString(t) : null;
1287
+ }
1288
+ nodeTypeIsNamed(e) {
1289
+ return !!C._ts_language_type_is_named_wasm(this[0], e);
1290
+ }
1291
+ nodeTypeIsVisible(e) {
1292
+ return !!C._ts_language_type_is_visible_wasm(this[0], e);
1293
+ }
1294
+ nextState(e, t) {
1295
+ return C._ts_language_next_state(this[0], e, t);
1296
+ }
1297
+ lookaheadIterator(e) {
1298
+ const t = C._ts_lookahead_iterator_new(this[0], e);
1299
+ return t ? new LookaheadIterable(INTERNAL, t, this) : null;
1300
+ }
1301
+ query(e) {
1302
+ const t = lengthBytesUTF8(e), _ = C._malloc(t + 1);
1303
+ stringToUTF8(e, _, t + 1);
1304
+ const s = C._ts_query_new(this[0], _, t, TRANSFER_BUFFER, TRANSFER_BUFFER + SIZE_OF_INT);
1305
+ if (!s) {
1306
+ const t = getValue(TRANSFER_BUFFER + SIZE_OF_INT, "i32"), s = getValue(TRANSFER_BUFFER, "i32"), r = UTF8ToString(_, s).length, a = e.substr(r, 100).split("\n")[0];
1307
+ let o, n = a.match(QUERY_WORD_REGEX)[0];
1308
+ switch(t){
1309
+ case 2:
1310
+ o = new RangeError(`Bad node name '${n}'`);
1311
+ break;
1312
+ case 3:
1313
+ o = new RangeError(`Bad field name '${n}'`);
1314
+ break;
1315
+ case 4:
1316
+ o = new RangeError(`Bad capture name @${n}`);
1317
+ break;
1318
+ case 5:
1319
+ o = new TypeError(`Bad pattern structure at offset ${r}: '${a}'...`), n = "";
1320
+ break;
1321
+ default:
1322
+ o = new SyntaxError(`Bad syntax at offset ${r}: '${a}'...`), n = "";
1323
+ }
1324
+ throw o.index = r, o.length = n.length, C._free(_), o;
1325
+ }
1326
+ 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);
1327
+ for(let e = 0; e < a; e++){
1328
+ const t = C._ts_query_capture_name_for_id(s, e, TRANSFER_BUFFER), _ = getValue(TRANSFER_BUFFER, "i32");
1329
+ n[e] = UTF8ToString(t, _);
1330
+ }
1331
+ for(let e = 0; e < r; e++){
1332
+ const t = C._ts_query_string_value_for_id(s, e, TRANSFER_BUFFER), _ = getValue(TRANSFER_BUFFER, "i32");
1333
+ l[e] = UTF8ToString(t, _);
1334
+ }
1335
+ const d = new Array(o), u = new Array(o), m = new Array(o), c = new Array(o), w = new Array(o);
1336
+ for(let e = 0; e < o; e++){
1337
+ const t = C._ts_query_predicates_for_pattern(s, e, TRANSFER_BUFFER), _ = getValue(TRANSFER_BUFFER, "i32");
1338
+ c[e] = [], w[e] = [];
1339
+ const r = [];
1340
+ let a = t;
1341
+ for(let t = 0; t < _; t++){
1342
+ const t = getValue(a, "i32");
1343
+ a += SIZE_OF_INT;
1344
+ const _ = getValue(a, "i32");
1345
+ if (a += SIZE_OF_INT, t === PREDICATE_STEP_TYPE_CAPTURE) r.push({
1346
+ type: "capture",
1347
+ name: n[_]
1348
+ });
1349
+ else if (t === PREDICATE_STEP_TYPE_STRING) r.push({
1350
+ type: "string",
1351
+ value: l[_]
1352
+ });
1353
+ else if (r.length > 0) {
1354
+ if ("string" !== r[0].type) throw new Error("Predicates must begin with a literal value");
1355
+ const t = r[0].value;
1356
+ let _, s = !0, a = !0;
1357
+ switch(t){
1358
+ case "any-not-eq?":
1359
+ case "not-eq?":
1360
+ s = !1;
1361
+ case "any-eq?":
1362
+ case "eq?":
1363
+ if (3 !== r.length) throw new Error(`Wrong number of arguments to \`#${t}\` predicate. Expected 2, got ${r.length - 1}`);
1364
+ if ("capture" !== r[1].type) throw new Error(`First argument of \`#${t}\` predicate must be a capture. Got "${r[1].value}"`);
1365
+ if (a = !t.startsWith("any-"), "capture" === r[2].type) {
1366
+ const t = r[1].name, _ = r[2].name;
1367
+ w[e].push((e)=>{
1368
+ const r = [], o = [];
1369
+ for (const s of e)s.name === t && r.push(s.node), s.name === _ && o.push(s.node);
1370
+ const n = (e, t, _)=>_ ? e.text === t.text : e.text !== t.text;
1371
+ return a ? r.every((e)=>o.some((t)=>n(e, t, s))) : r.some((e)=>o.some((t)=>n(e, t, s)));
1372
+ });
1373
+ } else {
1374
+ _ = r[1].name;
1375
+ const t = r[2].value, o = (e)=>e.text === t, n = (e)=>e.text !== t;
1376
+ w[e].push((e)=>{
1377
+ const t = [];
1378
+ for (const s of e)s.name === _ && t.push(s.node);
1379
+ const r = s ? o : n;
1380
+ return a ? t.every(r) : t.some(r);
1381
+ });
1382
+ }
1383
+ break;
1384
+ case "any-not-match?":
1385
+ case "not-match?":
1386
+ s = !1;
1387
+ case "any-match?":
1388
+ case "match?":
1389
+ if (3 !== r.length) throw new Error(`Wrong number of arguments to \`#${t}\` predicate. Expected 2, got ${r.length - 1}.`);
1390
+ if ("capture" !== r[1].type) throw new Error(`First argument of \`#${t}\` predicate must be a capture. Got "${r[1].value}".`);
1391
+ if ("string" !== r[2].type) throw new Error(`Second argument of \`#${t}\` predicate must be a string. Got @${r[2].value}.`);
1392
+ _ = r[1].name;
1393
+ const o = new RegExp(r[2].value);
1394
+ a = !t.startsWith("any-"), w[e].push((e)=>{
1395
+ const t = [];
1396
+ for (const s of e)s.name === _ && t.push(s.node.text);
1397
+ const r = (e, t)=>t ? o.test(e) : !o.test(e);
1398
+ return 0 === t.length ? !s : a ? t.every((e)=>r(e, s)) : t.some((e)=>r(e, s));
1399
+ });
1400
+ break;
1401
+ case "set!":
1402
+ if (r.length < 2 || r.length > 3) throw new Error(`Wrong number of arguments to \`#set!\` predicate. Expected 1 or 2. Got ${r.length - 1}.`);
1403
+ if (r.some((e)=>"string" !== e.type)) throw new Error('Arguments to `#set!` predicate must be a strings.".');
1404
+ d[e] || (d[e] = {}), d[e][r[1].value] = r[2] ? r[2].value : null;
1405
+ break;
1406
+ case "is?":
1407
+ case "is-not?":
1408
+ if (r.length < 2 || r.length > 3) throw new Error(`Wrong number of arguments to \`#${t}\` predicate. Expected 1 or 2. Got ${r.length - 1}.`);
1409
+ if (r.some((e)=>"string" !== e.type)) throw new Error(`Arguments to \`#${t}\` predicate must be a strings.".`);
1410
+ const n = "is?" === t ? u : m;
1411
+ n[e] || (n[e] = {}), n[e][r[1].value] = r[2] ? r[2].value : null;
1412
+ break;
1413
+ case "not-any-of?":
1414
+ s = !1;
1415
+ case "any-of?":
1416
+ if (r.length < 2) throw new Error(`Wrong number of arguments to \`#${t}\` predicate. Expected at least 1. Got ${r.length - 1}.`);
1417
+ if ("capture" !== r[1].type) throw new Error(`First argument of \`#${t}\` predicate must be a capture. Got "${r[1].value}".`);
1418
+ for(let e = 2; e < r.length; e++)if ("string" !== r[e].type) throw new Error(`Arguments to \`#${t}\` predicate must be a strings.".`);
1419
+ _ = r[1].name;
1420
+ const l = r.slice(2).map((e)=>e.value);
1421
+ w[e].push((e)=>{
1422
+ const t = [];
1423
+ for (const s of e)s.name === _ && t.push(s.node.text);
1424
+ return 0 === t.length ? !s : t.every((e)=>l.includes(e)) === s;
1425
+ });
1426
+ break;
1427
+ default:
1428
+ c[e].push({
1429
+ operator: t,
1430
+ operands: r.slice(1)
1431
+ });
1432
+ }
1433
+ r.length = 0;
1434
+ }
1435
+ }
1436
+ Object.freeze(d[e]), Object.freeze(u[e]), Object.freeze(m[e]);
1437
+ }
1438
+ return C._free(_), new Query(INTERNAL, s, n, w, c, Object.freeze(d), Object.freeze(u), Object.freeze(m));
1439
+ }
1440
+ static load(e) {
1441
+ let t;
1442
+ if (e instanceof Uint8Array) t = Promise.resolve(e);
1443
+ else {
1444
+ const _ = e;
1445
+ if ("undefined" != typeof $a1KGq && $a1KGq.versions && $a1KGq.versions.node) {
1446
+ const e = (parcelRequire("a1KGq"));
1447
+ t = Promise.resolve(e.readFileSync(_));
1448
+ } else t = fetch(_).then((e)=>e.arrayBuffer().then((t)=>{
1449
+ if (e.ok) return new Uint8Array(t);
1450
+ {
1451
+ const _ = new TextDecoder("utf-8").decode(t);
1452
+ throw new Error(`Language.load failed with status ${e.status}.\n\n${_}`);
1453
+ }
1454
+ }));
1455
+ }
1456
+ return t.then((e)=>loadWebAssemblyModule(e, {
1457
+ loadAsync: !0
1458
+ })).then((e)=>{
1459
+ const t = Object.keys(e), _ = t.find((e)=>LANGUAGE_FUNCTION_REGEX.test(e) && !e.includes("external_scanner_"));
1460
+ _ || console.log(`Couldn't find language function in WASM file. Symbols:\n${JSON.stringify(t, null, 2)}`);
1461
+ const s = e[_]();
1462
+ return new Language(INTERNAL, s);
1463
+ });
1464
+ }
1465
+ }
1466
+ class LookaheadIterable {
1467
+ constructor(e, t, _){
1468
+ assertInternal(e), this[0] = t, this.language = _;
1469
+ }
1470
+ get currentTypeId() {
1471
+ return C._ts_lookahead_iterator_current_symbol(this[0]);
1472
+ }
1473
+ get currentType() {
1474
+ return this.language.types[this.currentTypeId] || "ERROR";
1475
+ }
1476
+ delete() {
1477
+ C._ts_lookahead_iterator_delete(this[0]), this[0] = 0;
1478
+ }
1479
+ resetState(e) {
1480
+ return C._ts_lookahead_iterator_reset_state(this[0], e);
1481
+ }
1482
+ reset(e, t) {
1483
+ return !!C._ts_lookahead_iterator_reset(this[0], e[0], t) && (this.language = e, !0);
1484
+ }
1485
+ [Symbol.iterator]() {
1486
+ const e = this;
1487
+ return {
1488
+ next: ()=>C._ts_lookahead_iterator_next(e[0]) ? {
1489
+ done: !1,
1490
+ value: e.currentType
1491
+ } : {
1492
+ done: !0,
1493
+ value: ""
1494
+ }
1495
+ };
1496
+ }
1497
+ }
1498
+ class Query {
1499
+ constructor(e, t, _, s, r, a, o, n){
1500
+ assertInternal(e), this[0] = t, this.captureNames = _, this.textPredicates = s, this.predicates = r, this.setProperties = a, this.assertedProperties = o, this.refutedProperties = n, this.exceededMatchLimit = !1;
1501
+ }
1502
+ delete() {
1503
+ C._ts_query_delete(this[0]), this[0] = 0;
1504
+ }
1505
+ matches(e, { startPosition: t = ZERO_POINT, endPosition: _ = ZERO_POINT, startIndex: s = 0, endIndex: r = 0, matchLimit: a = 4294967295, maxStartDepth: o = 4294967295 } = {}) {
1506
+ if ("number" != typeof a) throw new Error("Arguments must be numbers");
1507
+ marshalNode(e), C._ts_query_matches_wasm(this[0], e.tree[0], t.row, t.column, _.row, _.column, s, r, a, o);
1508
+ 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);
1509
+ this.exceededMatchLimit = Boolean(d);
1510
+ let m = 0, c = l;
1511
+ for(let t = 0; t < n; t++){
1512
+ const t = getValue(c, "i32");
1513
+ c += SIZE_OF_INT;
1514
+ const _ = getValue(c, "i32");
1515
+ c += SIZE_OF_INT;
1516
+ const s = new Array(_);
1517
+ if (c = unmarshalCaptures(this, e.tree, c, s), this.textPredicates[t].every((e)=>e(s))) {
1518
+ u[m] = {
1519
+ pattern: t,
1520
+ captures: s
1521
+ };
1522
+ const e = this.setProperties[t];
1523
+ e && (u[m].setProperties = e);
1524
+ const _ = this.assertedProperties[t];
1525
+ _ && (u[m].assertedProperties = _);
1526
+ const r = this.refutedProperties[t];
1527
+ r && (u[m].refutedProperties = r), m++;
1528
+ }
1529
+ }
1530
+ return u.length = m, C._free(l), u;
1531
+ }
1532
+ captures(e, { startPosition: t = ZERO_POINT, endPosition: _ = ZERO_POINT, startIndex: s = 0, endIndex: r = 0, matchLimit: a = 4294967295, maxStartDepth: o = 4294967295 } = {}) {
1533
+ if ("number" != typeof a) throw new Error("Arguments must be numbers");
1534
+ marshalNode(e), C._ts_query_captures_wasm(this[0], e.tree[0], t.row, t.column, _.row, _.column, s, r, a, o);
1535
+ const n = getValue(TRANSFER_BUFFER, "i32"), l = getValue(TRANSFER_BUFFER + SIZE_OF_INT, "i32"), d = getValue(TRANSFER_BUFFER + 2 * SIZE_OF_INT, "i32"), u = [];
1536
+ this.exceededMatchLimit = Boolean(d);
1537
+ const m = [];
1538
+ let c = l;
1539
+ for(let t = 0; t < n; t++){
1540
+ const t = getValue(c, "i32");
1541
+ c += SIZE_OF_INT;
1542
+ const _ = getValue(c, "i32");
1543
+ c += SIZE_OF_INT;
1544
+ const s = getValue(c, "i32");
1545
+ if (c += SIZE_OF_INT, m.length = _, c = unmarshalCaptures(this, e.tree, c, m), this.textPredicates[t].every((e)=>e(m))) {
1546
+ const e = m[s], _ = this.setProperties[t];
1547
+ _ && (e.setProperties = _);
1548
+ const r = this.assertedProperties[t];
1549
+ r && (e.assertedProperties = r);
1550
+ const a = this.refutedProperties[t];
1551
+ a && (e.refutedProperties = a), u.push(e);
1552
+ }
1553
+ }
1554
+ return C._free(l), u;
1555
+ }
1556
+ predicatesForPattern(e) {
1557
+ return this.predicates[e];
1558
+ }
1559
+ disableCapture(e) {
1560
+ const t = lengthBytesUTF8(e), _ = C._malloc(t + 1);
1561
+ stringToUTF8(e, _, t + 1), C._ts_query_disable_capture(this[0], _, t), C._free(_);
1562
+ }
1563
+ didExceedMatchLimit() {
1564
+ return this.exceededMatchLimit;
1565
+ }
1566
+ }
1567
+ function getText(e, t, _) {
1568
+ const s = _ - t;
1569
+ let r = e.textCallback(t, null, _);
1570
+ for(t += r.length; t < _;){
1571
+ const s = e.textCallback(t, null, _);
1572
+ if (!(s && s.length > 0)) break;
1573
+ t += s.length, r += s;
1574
+ }
1575
+ return t > _ && (r = r.slice(0, s)), r;
1576
+ }
1577
+ function unmarshalCaptures(e, t, _, s) {
1578
+ for(let r = 0, a = s.length; r < a; r++){
1579
+ const a = getValue(_, "i32"), o = unmarshalNode(t, _ += SIZE_OF_INT);
1580
+ _ += SIZE_OF_NODE, s[r] = {
1581
+ name: e.captureNames[a],
1582
+ node: o
1583
+ };
1584
+ }
1585
+ return _;
1586
+ }
1587
+ function assertInternal(e) {
1588
+ if (e !== INTERNAL) throw new Error("Illegal constructor");
1589
+ }
1590
+ function isPoint(e) {
1591
+ return e && "number" == typeof e.row && "number" == typeof e.column;
1592
+ }
1593
+ function marshalNode(e) {
1594
+ let t = TRANSFER_BUFFER;
1595
+ 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");
1596
+ }
1597
+ function unmarshalNode(e, t = TRANSFER_BUFFER) {
1598
+ const _ = getValue(t, "i32");
1599
+ if (0 === _) return null;
1600
+ 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);
1601
+ return n.id = _, n.startIndex = s, n.startPosition = {
1602
+ row: r,
1603
+ column: a
1604
+ }, n[0] = o, n;
1605
+ }
1606
+ function marshalTreeCursor(e, t = TRANSFER_BUFFER) {
1607
+ 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");
1608
+ }
1609
+ function unmarshalTreeCursor(e) {
1610
+ 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");
1611
+ }
1612
+ function marshalPoint(e, t) {
1613
+ setValue(e, t.row, "i32"), setValue(e + SIZE_OF_INT, t.column, "i32");
1614
+ }
1615
+ function unmarshalPoint(e) {
1616
+ return {
1617
+ row: getValue(e, "i32") >>> 0,
1618
+ column: getValue(e + SIZE_OF_INT, "i32") >>> 0
1619
+ };
1620
+ }
1621
+ function marshalRange(e, t) {
1622
+ 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;
1623
+ }
1624
+ function unmarshalRange(e) {
1625
+ const t = {};
1626
+ 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;
1627
+ }
1628
+ function marshalEdit(e) {
1629
+ let t = TRANSFER_BUFFER;
1630
+ 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;
1631
+ }
1632
+ for (const e of Object.getOwnPropertyNames(ParserImpl.prototype))Object.defineProperty(Parser.prototype, e, {
1633
+ value: ParserImpl.prototype[e],
1634
+ enumerable: !1,
1635
+ writable: !1
1636
+ });
1637
+ Parser.Language = Language, Module.onRuntimeInitialized = ()=>{
1638
+ ParserImpl.init(), resolveInitPromise();
1639
+ };
1640
+ }));
1641
+ }
1642
+ }
1643
+ return Parser;
1644
+ }();
1645
+ module.exports = TreeSitter;
1646
+
1647
+ });
1648
+ parcelRegister("a1KGq", function(module, exports) {
1649
+ "use strict";
1650
+
1651
+ });
1652
+
1653
+
1654
+
1655
+ $parcel$export(module.exports, "USFMParser", () => $be3194b3d68e926d$export$2e2bcd8739ae039);
1656
+
1657
+ var $5UXqS = parcelRequire("5UXqS");
1658
+ const $0783021dea42787b$export$b32929182cc4fefe = [
1659
+ "USJ",
1660
+ "table"
1661
+ ];
1662
+ const $0783021dea42787b$export$75b2f422ff60acaf = [
1663
+ "char",
1664
+ "note",
1665
+ "figure"
1666
+ ];
1667
+ const $0783021dea42787b$export$aa24f570494ce8d0 = [
1668
+ "type",
1669
+ "marker",
1670
+ "content",
1671
+ "number",
1672
+ "sid",
1673
+ "code",
1674
+ "caller",
1675
+ "align",
1676
+ "version",
1677
+ "altnumber",
1678
+ "pubnumber",
1679
+ "category"
1680
+ ];
1681
+ const $0783021dea42787b$export$c63c0b6e358f0774 = [
1682
+ "char",
1683
+ "note",
1684
+ "verse",
1685
+ "table:cell"
1686
+ ];
1687
+
1688
+
1689
+ class $b37353ce824c37f3$var$USFMGenerator {
1690
+ constructor(){
1691
+ this.usfmString = "";
1692
+ }
1693
+ usjToUsfm(usjObj, nested = false) {
1694
+ if (!(0, $0783021dea42787b$export$b32929182cc4fefe).includes(usjObj.type)) {
1695
+ this.usfmString += "\\";
1696
+ if (nested && usjObj.type === "char") this.usfmString += "+";
1697
+ this.usfmString += `${usjObj.marker} `;
1698
+ }
1699
+ [
1700
+ "code",
1701
+ "number",
1702
+ "caller"
1703
+ ].forEach((key)=>{
1704
+ if (usjObj[key]) this.usfmString += `${usjObj[key]} `;
1705
+ });
1706
+ if (usjObj.category) this.usfmString += `\\cat ${usjObj.category}\\cat*\n`;
1707
+ if (Array.isArray(usjObj.content)) usjObj.content.forEach((item)=>{
1708
+ if (typeof item === "string") this.usfmString += item;
1709
+ else this.usjToUsfm(item, usjObj.type === "char");
1710
+ });
1711
+ let attributes = [];
1712
+ Object.keys(usjObj).forEach((key)=>{
1713
+ if (!(0, $0783021dea42787b$export$aa24f570494ce8d0).includes(key)) attributes.push(`${key}="${usjObj[key]}"`);
1714
+ });
1715
+ if (attributes.length > 0) this.usfmString += `|${attributes.join(" ")}`;
1716
+ if ((0, $0783021dea42787b$export$75b2f422ff60acaf).includes(usjObj.type)) {
1717
+ this.usfmString += `\\`;
1718
+ if (nested && usjObj.type === "char") this.usfmString += "+";
1719
+ this.usfmString += `${usjObj.marker}* `;
1720
+ }
1721
+ if (!(0, $0783021dea42787b$export$c63c0b6e358f0774).includes(usjObj.type) && this.usfmString[this.usfmString.length - 1] !== "\n") this.usfmString += "\n";
1722
+ return this.usfmString;
1723
+ }
1724
+ }
1725
+ var $b37353ce824c37f3$export$2e2bcd8739ae039 = $b37353ce824c37f3$var$USFMGenerator;
1726
+
1727
+
1728
+ //Logics for syntax-tree to dict(USJ) conversions
1729
+ const $48a7bc78362df58a$export$3ea3efefd6f5792b = [
1730
+ "ide",
1731
+ "usfm",
1732
+ "h",
1733
+ "toc",
1734
+ "toca",
1735
+ "imt",
1736
+ "is",
1737
+ "ip",
1738
+ "ipi",
1739
+ "im",
1740
+ "imi",
1741
+ "ipq",
1742
+ "imq",
1743
+ "ipr",
1744
+ "iq",
1745
+ "ib",
1746
+ "ili",
1747
+ "iot",
1748
+ "io",
1749
+ "iex",
1750
+ "imte",
1751
+ "ie",
1752
+ "mt",
1753
+ "mte",
1754
+ "cl",
1755
+ "cd",
1756
+ "ms",
1757
+ "mr",
1758
+ "s",
1759
+ "sr",
1760
+ "r",
1761
+ "d",
1762
+ "sp",
1763
+ "sd",
1764
+ "q",
1765
+ "qr",
1766
+ "qc",
1767
+ "qa",
1768
+ "qm",
1769
+ "qd",
1770
+ "lh",
1771
+ "li",
1772
+ "lf",
1773
+ "lim",
1774
+ "litl",
1775
+ "sts",
1776
+ "rem",
1777
+ "lit",
1778
+ "restore"
1779
+ ];
1780
+ const $48a7bc78362df58a$export$bfe3d604e5046dbb = [
1781
+ "f",
1782
+ "fe",
1783
+ "ef",
1784
+ "efe",
1785
+ "x",
1786
+ "ex"
1787
+ ];
1788
+ const $48a7bc78362df58a$export$32d1909bfb943eb0 = [
1789
+ "add",
1790
+ "bk",
1791
+ "dc",
1792
+ "ior",
1793
+ "iqt",
1794
+ "k",
1795
+ "litl",
1796
+ "nd",
1797
+ "ord",
1798
+ "pn",
1799
+ "png",
1800
+ "qac",
1801
+ "qs",
1802
+ "qt",
1803
+ "rq",
1804
+ "sig",
1805
+ "sls",
1806
+ "tl",
1807
+ "wj",
1808
+ "em",
1809
+ "bd",
1810
+ "bdit",
1811
+ "it",
1812
+ "no",
1813
+ "sc",
1814
+ "sup",
1815
+ "rb",
1816
+ "pro",
1817
+ "w",
1818
+ "wh",
1819
+ "wa",
1820
+ "wg",
1821
+ "lik",
1822
+ "liv",
1823
+ "jmp",
1824
+ "fr",
1825
+ "ft",
1826
+ "fk",
1827
+ "fq",
1828
+ "fqa",
1829
+ "fl",
1830
+ "fw",
1831
+ "fp",
1832
+ "fv",
1833
+ "fdc",
1834
+ "xo",
1835
+ "xop",
1836
+ "xt",
1837
+ "xta",
1838
+ "xk",
1839
+ "xq",
1840
+ "xot",
1841
+ "xnt",
1842
+ "xdc"
1843
+ ];
1844
+ const $48a7bc78362df58a$export$ec3044778745fabd = $48a7bc78362df58a$export$32d1909bfb943eb0.map((item)=>item + "Nested");
1845
+ const $48a7bc78362df58a$export$38bc6f52843beb2a = {
1846
+ w: "lemma",
1847
+ rb: "gloss",
1848
+ xt: "link-href",
1849
+ fig: "alt",
1850
+ xt_standalone: "link-href"
1851
+ };
1852
+ const $48a7bc78362df58a$export$af42bd8f70df8555 = [
1853
+ "tc",
1854
+ "th",
1855
+ "tcr",
1856
+ "thr"
1857
+ ];
1858
+ const $48a7bc78362df58a$export$c4d2f24f22330b2a = [
1859
+ "fig",
1860
+ "cat",
1861
+ "esb",
1862
+ "b",
1863
+ "ph",
1864
+ "pi"
1865
+ ];
1866
+
1867
+
1868
+ class $bc15495701a08748$var$USJGenerator {
1869
+ constructor(treeSitterLanguageObj, usfmString, usjRootObj = null){
1870
+ this.usfmLanguage = treeSitterLanguageObj;
1871
+ this.usfm = usfmString;
1872
+ this.jsonRootObj = usjRootObj || {
1873
+ type: "USJ",
1874
+ version: "0.3.0",
1875
+ content: []
1876
+ };
1877
+ }
1878
+ findLastFromJson(jsonObj, typeValue) {
1879
+ let output = null;
1880
+ if (typeValue === jsonObj.type || jsonObj.marker && typeValue === jsonObj.marker) output = jsonObj;
1881
+ if (jsonObj.content) jsonObj.content.forEach((child)=>{
1882
+ if (typeof child === "string") return;
1883
+ const childOutput = this.findLastFromJson(child, typeValue);
1884
+ if (childOutput !== null) output = childOutput;
1885
+ });
1886
+ return output;
1887
+ }
1888
+ nodeToUSJId(node, parentJsonObj) {
1889
+ const idCaptures = this.usfmLanguage.query("(id (bookcode) @book-code (description)? @desc)").captures(node);
1890
+ let code = null;
1891
+ let desc = null;
1892
+ idCaptures.forEach((capture)=>{
1893
+ if (capture.name === "book-code") code = this.usfm.slice(capture.node.startIndex, capture.node.endIndex);
1894
+ else if (capture.name === "desc") desc = this.usfm.slice(capture.node.startIndex, capture.node.endIndex);
1895
+ });
1896
+ const bookJsonObj = {
1897
+ type: "book",
1898
+ marker: "id",
1899
+ code: code,
1900
+ content: []
1901
+ };
1902
+ if (desc && desc.trim() !== "") bookJsonObj.content.push(desc.trim());
1903
+ parentJsonObj.content.push(bookJsonObj);
1904
+ }
1905
+ // Similar conversion methods for other node types
1906
+ nodeToUSJC(node, parentJsonObj) {
1907
+ // Build c, the chapter milestone node in usj
1908
+ const chapCap = this.usfmLanguage.query(`(c (chapterNumber) @chap-num
1909
+ (ca (chapterNumber) @alt-num)?
1910
+ (cp (text) @pub-num)?)`).captures(node);
1911
+ const chapNum = this.usfm.slice(chapCap[0].node.startIndex, chapCap[0].node.endIndex);
1912
+ let chapRef = null;
1913
+ this.jsonRootObj.content.forEach((child)=>{
1914
+ if (child.type === "book") {
1915
+ chapRef = `${child.code} ${chapNum}`;
1916
+ return;
1917
+ }
1918
+ });
1919
+ const chapJsonObj = {
1920
+ type: "chapter",
1921
+ marker: "c",
1922
+ number: chapNum,
1923
+ sid: chapRef
1924
+ };
1925
+ chapCap.forEach((tuple)=>{
1926
+ if (tuple[1] === "alt-num") chapJsonObj.altnumber = this.usfm.substring(tuple[0].startIndex, tuple[0].endIndex).trim();
1927
+ if (tuple[1] === "pub-num") chapJsonObj.pubnumber = this.usfm.substring(tuple[0].startIndex, tuple[0].endIndex).trim();
1928
+ });
1929
+ parentJsonObj.content.push(chapJsonObj);
1930
+ node.children.forEach((child)=>{
1931
+ if ([
1932
+ "cl",
1933
+ "cd"
1934
+ ].includes(child.type)) this.nodeToUSJ(child, parentJsonObj);
1935
+ });
1936
+ }
1937
+ nodeToUSJChapter(node, parentJsonObj) {
1938
+ // Build chapter node in USJ
1939
+ node.children.forEach((child)=>{
1940
+ if (child.type === "c") this.nodeToUSJC(child, parentJsonObj);
1941
+ else this.nodeToUSJ(child, parentJsonObj);
1942
+ });
1943
+ }
1944
+ nodeToUSJVerse(node, parentJsonObj) {
1945
+ // Build verse node in USJ
1946
+ const verseNumCap = this.usfmLanguage.query(`
1947
+ (v
1948
+ (verseNumber) @vnum
1949
+ (va (verseNumber) @alt)?
1950
+ (vp (text) @vp)?
1951
+ )`).captures(node);
1952
+ const verseNum = this.usfm.substring(verseNumCap[0].node.startIndex, verseNumCap[0].node.endIndex);
1953
+ const vJsonObj = {
1954
+ type: "verse",
1955
+ marker: "v",
1956
+ number: verseNum.trim()
1957
+ };
1958
+ verseNumCap.forEach((capture)=>{
1959
+ if (capture.name === "alt") {
1960
+ const altNum = this.usfm.slice(capture.node.startIndex, capture.node.endIndex);
1961
+ vJsonObj.altnumber = altNum;
1962
+ } else if (capture.name === "vp") {
1963
+ const vpText = this.usfm.substring(capture.node.startIndex, capture.node.endIndex);
1964
+ vJsonObj.pubnumber = vpText;
1965
+ }
1966
+ });
1967
+ const ref = `${this.findLastFromJson(this.jsonRootObj, "chapter").sid}:${verseNum}`;
1968
+ vJsonObj.sid = ref.trim();
1969
+ parentJsonObj.content.push(vJsonObj);
1970
+ }
1971
+ nodeToUSJCaVa(node, parentJsonObj) {
1972
+ // Build elements for independent ca and va away from c and v
1973
+ const style = node.type;
1974
+ const charJsonObj = {
1975
+ type: "char",
1976
+ marker: style
1977
+ };
1978
+ const altNumMatch = this.usfmLanguage.query(`([
1979
+ (chapterNumber)
1980
+ (verseNumber)
1981
+ ] @alt-num)`).captures(node);
1982
+ const altNum = this.usfm.slice(altNumMatch[0].node.startIndex, altNumMatch[0].node.endIndex).trim();
1983
+ charJsonObj.altnumber = altNum;
1984
+ parentJsonObj.content.push(charJsonObj);
1985
+ }
1986
+ nodeToUSJPara(node, parentJsonObj) {
1987
+ // Build paragraph nodes in USJ
1988
+ if (node.children[0].type.endsWith("Block")) node.children[0].children.forEach((child)=>{
1989
+ this.nodeToUSJPara(child, parentJsonObj);
1990
+ });
1991
+ else if (node.type === "paragraph") {
1992
+ const paraTagCap = this.usfmLanguage.query("(paragraph (_) @para-marker)").captures(node)[0];
1993
+ const paraMarker = paraTagCap.node.type;
1994
+ if (paraMarker === "b") this.nodeToUSJSpecial(paraTagCap, parentJsonObj);
1995
+ else if (!paraMarker.endsWith("Block")) {
1996
+ const paraJsonObj = {
1997
+ type: "para",
1998
+ marker: paraMarker,
1999
+ content: []
2000
+ };
2001
+ paraTagCap.node.children.forEach((child)=>{
2002
+ this.nodeToUSJ(child, paraJsonObj);
2003
+ });
2004
+ parentJsonObj.content.push(paraJsonObj);
2005
+ }
2006
+ } else if ([
2007
+ "pi",
2008
+ "ph"
2009
+ ].includes(node.type)) {
2010
+ const paraMarker = this.usfm.substring(node.children[0].startIndex, node.children[0].endIndex).replace("\\", "").trim();
2011
+ const paraJsonObj = {
2012
+ type: "para",
2013
+ marker: paraMarker,
2014
+ content: []
2015
+ };
2016
+ node.children.slice(1).forEach((child)=>{
2017
+ this.nodeToUSJ(child, paraJsonObj);
2018
+ });
2019
+ parentJsonObj.content.push(paraJsonObj);
2020
+ }
2021
+ }
2022
+ nodeToUSJNotes(node, parentJsonObj) {
2023
+ // Build USJ nodes for footnotes and cross-references
2024
+ const tagNode = node.children[0];
2025
+ const callerNode = node.children[1];
2026
+ const style = this.usfm.substring(tagNode.startIndex, tagNode.endIndex).replace("\\", "").trim();
2027
+ const noteJsonObj = {
2028
+ type: "note",
2029
+ marker: style,
2030
+ content: []
2031
+ };
2032
+ noteJsonObj.caller = this.usfm.substring(callerNode.startIndex, callerNode.endIndex).trim();
2033
+ for(let i = 2; i < node.children.length - 1; i++)this.nodeToUSJ(node.children[i], noteJsonObj);
2034
+ parentJsonObj.content.push(noteJsonObj);
2035
+ }
2036
+ nodeToUSJChar(node, parentJsonObj) {
2037
+ // Build USJ nodes for character markups, both regular and nested
2038
+ const tagNode = node.children[0];
2039
+ let childrenRange = node.children.length;
2040
+ if (node.children[node.children.length - 1].type.startsWith("\\")) childrenRange -= 1; // Exclude the last node if it starts with '\', treating it as a closing node
2041
+ const style = this.usfm.substring(tagNode.startIndex, tagNode.endIndex).replace("\\", "").replace("+", "").trim();
2042
+ const charJsonObj = {
2043
+ type: "char",
2044
+ marker: style,
2045
+ content: []
2046
+ };
2047
+ // Assume a flag for closed markup, toggle this if your conditions and data structure require
2048
+ // charJsonObj.closed = node.children[node.children.length - 1].type.startsWith('\\');
2049
+ for(let i = 1; i < childrenRange; i++)this.nodeToUSJ(node.children[i], charJsonObj);
2050
+ parentJsonObj.content.push(charJsonObj);
2051
+ }
2052
+ nodeToUSJTable(node, parentJsonObj) {
2053
+ // Handle table related components and convert to USJ
2054
+ if (node.type === "table") {
2055
+ const tableJsonObj = {
2056
+ type: "table",
2057
+ content: []
2058
+ };
2059
+ node.children.forEach((child)=>{
2060
+ this.nodeToUSJ(child, tableJsonObj);
2061
+ });
2062
+ parentJsonObj.content.push(tableJsonObj);
2063
+ } else if (node.type === "tr") {
2064
+ const rowJsonObj = {
2065
+ type: "table:row",
2066
+ marker: "tr",
2067
+ content: []
2068
+ };
2069
+ node.children.slice(1).forEach((child)=>{
2070
+ this.nodeToUSJ(child, rowJsonObj);
2071
+ });
2072
+ parentJsonObj.content.push(rowJsonObj);
2073
+ } else if ((0, $48a7bc78362df58a$export$af42bd8f70df8555).includes(node.type)) {
2074
+ const tagNode = node.children[0];
2075
+ const style = this.usfm.substring(tagNode.startIndex, tagNode.endIndex).replace("\\", "").trim();
2076
+ const cellJsonObj = {
2077
+ type: "table:cell",
2078
+ marker: style,
2079
+ content: [],
2080
+ align: style.includes("r") ? "end" : "start"
2081
+ };
2082
+ node.children.slice(1).forEach((child)=>{
2083
+ this.nodeToUSJ(child, cellJsonObj);
2084
+ });
2085
+ parentJsonObj.content.push(cellJsonObj);
2086
+ }
2087
+ }
2088
+ nodeToUSJAttrib(node, parentJsonObj) {
2089
+ // Add attribute values to USJ elements
2090
+ const attribNameNode = node.children[0];
2091
+ let attribName = this.usfm.slice(attribNameNode.startIndex, attribNameNode.endIndex).trim();
2092
+ // Handling special cases for attribute names
2093
+ if (attribName === "|") attribName = (0, $48a7bc78362df58a$export$38bc6f52843beb2a)[node.parent.type];
2094
+ if (attribName === "src") // for \fig
2095
+ attribName = "file";
2096
+ const attribValCap = this.usfmLanguage.query("((attributeValue) @attrib-val)").captures(node);
2097
+ let attribValue = "";
2098
+ if (attribValCap.length > 0) attribValue = this.usfm.substring(attribValCap[0].node.startIndex, attribValCap[0].node.endIndex).trim();
2099
+ parentJsonObj[attribName] = attribValue;
2100
+ }
2101
+ nodeToUSJMilestone(node, parentJsonObj) {
2102
+ // Create ms node in USJ
2103
+ const msNameCap = this.usfmLanguage.query(`(
2104
+ [(milestoneTag)
2105
+ (milestoneStartTag)
2106
+ (milestoneEndTag)
2107
+ (zSpaceTag)
2108
+ ] @ms-name)`).captures(node)[0];
2109
+ const style = this.usfm.slice(msNameCap.node.startIndex, msNameCap.node.endIndex).replace("\\", "").trim();
2110
+ const msJsonObj = {
2111
+ type: "ms",
2112
+ marker: style,
2113
+ content: []
2114
+ };
2115
+ node.children.forEach((child)=>{
2116
+ if (child.type.endsWith("Attribute")) this.nodeToUSJ(child, msJsonObj);
2117
+ });
2118
+ // Though normally milestones don't have contents, custom z-namespaces could have them
2119
+ if (!msJsonObj.content.length) delete msJsonObj.content; // Remove empty content array if not used
2120
+ parentJsonObj.content.push(msJsonObj);
2121
+ }
2122
+ nodeToUSJSpecial(node, parentJsonObj) {
2123
+ // Build nodes for esb, cat, fig, optbreak in USJ
2124
+ if (node.type === "esb") {
2125
+ const sidebarJsonObj = {
2126
+ type: "sidebar",
2127
+ marker: "esb",
2128
+ content: []
2129
+ };
2130
+ node.children.slice(1, -1).forEach((child)=>{
2131
+ this.nodeToUSJ(child, sidebarJsonObj);
2132
+ });
2133
+ parentJsonObj.content.push(sidebarJsonObj);
2134
+ } else if (node.type === "cat") {
2135
+ const catCap = this.usfmLanguage.query("((category) @category)").captures(node)[0];
2136
+ const category = this.usfm.substring(catCap[0].startIndex, catCap[0].endIndex).trim();
2137
+ parentJsonObj.category = category;
2138
+ } else if (node.type === "fig") {
2139
+ const figJsonObj = {
2140
+ type: "figure",
2141
+ marker: "fig",
2142
+ content: []
2143
+ };
2144
+ node.children.slice(1, -1).forEach((child)=>{
2145
+ this.nodeToUSJ(child, figJsonObj);
2146
+ });
2147
+ parentJsonObj.content.push(figJsonObj);
2148
+ } else if (node.type === "b") {
2149
+ const bJsonObj = {
2150
+ type: "optbreak",
2151
+ marker: "b"
2152
+ };
2153
+ parentJsonObj.content.push(bJsonObj);
2154
+ } else if (node.type === "usfm") {
2155
+ const verJsonObj = {
2156
+ type: "para",
2157
+ marker: "usfm",
2158
+ content: []
2159
+ };
2160
+ const version = this.usfm.substring(node.startIndex, node.endIndex).replace("\\usfm", "").trim();
2161
+ verJsonObj.content.push(version);
2162
+ parentJsonObj.content.push(verJsonObj);
2163
+ }
2164
+ }
2165
+ nodeToUSJGeneric(node, parentJsonObj) {
2166
+ // Build nodes for para style markers in USJ
2167
+ const tagNode = node.children[0];
2168
+ let style = this.usfm.substring(tagNode.startIndex, tagNode.endIndex);
2169
+ if (style.startsWith("\\")) style = style.replace("\\", "").trim();
2170
+ else style = node.type;
2171
+ // console.log(node.children.length, node.children[0].type, node.children[1].type)
2172
+ let childrenRangeStart = 1;
2173
+ if (node.children.length > 1 && node.children[1].type.startsWith("numbered")) {
2174
+ const numNode = node.children[1];
2175
+ const num = this.usfm.substring(numNode.startIndex, numNode.endIndex);
2176
+ style += num;
2177
+ childrenRangeStart = 2;
2178
+ }
2179
+ const paraJsonObj = {
2180
+ type: "para",
2181
+ marker: style,
2182
+ content: []
2183
+ };
2184
+ parentJsonObj.content.push(paraJsonObj);
2185
+ for(let i = childrenRangeStart; i < node.children.length; i++){
2186
+ const child = node.children[i];
2187
+ if ((0, $48a7bc78362df58a$export$32d1909bfb943eb0).includes(child.type) || (0, $48a7bc78362df58a$export$ec3044778745fabd).includes(child.type) || [
2188
+ "text",
2189
+ "footnote",
2190
+ "crossref",
2191
+ "verseText",
2192
+ "v",
2193
+ "b",
2194
+ "milestone",
2195
+ "zNameSpace"
2196
+ ].includes(child.type)) // Only nest these types inside the upper para style node
2197
+ this.nodeToUSJ(child, paraJsonObj);
2198
+ else this.nodeToUSJ(child, parentJsonObj);
2199
+ }
2200
+ }
2201
+ nodeToUSJ(node, parentJsonObj) {
2202
+ // Check each node and based on the type convert to corresponding XML element
2203
+ switch(node.type){
2204
+ case "id":
2205
+ this.nodeToUSJId(node, parentJsonObj);
2206
+ break;
2207
+ case "chapter":
2208
+ this.nodeToUSJChapter(node, parentJsonObj);
2209
+ break;
2210
+ case "cl":
2211
+ case "cp":
2212
+ case "cd":
2213
+ case "vp":
2214
+ this.nodeToUSJGeneric(node, parentJsonObj);
2215
+ break;
2216
+ case "ca":
2217
+ case "va":
2218
+ this.nodeToUSJCaVa(node, parentJsonObj);
2219
+ break;
2220
+ case "v":
2221
+ this.nodeToUSJVerse(node, parentJsonObj);
2222
+ break;
2223
+ case "verseText":
2224
+ node.children.forEach((child)=>this.nodeToUSJ(child, parentJsonObj));
2225
+ break;
2226
+ case "paragraph":
2227
+ case "pi":
2228
+ case "ph":
2229
+ this.nodeToUSJPara(node, parentJsonObj);
2230
+ break;
2231
+ case "text":
2232
+ const textVal = this.usfm.substring(node.startIndex, node.endIndex).trim();
2233
+ if (textVal !== "") parentJsonObj.content.push(textVal);
2234
+ break;
2235
+ case "table":
2236
+ case "tr":
2237
+ this.nodeToUSJTable(node, parentJsonObj);
2238
+ break;
2239
+ case "milestone":
2240
+ case "zNameSpace":
2241
+ this.nodeToUSJMilestone(node, parentJsonObj);
2242
+ break;
2243
+ case "esb":
2244
+ case "cat":
2245
+ case "fig":
2246
+ case "usfm":
2247
+ this.nodeToUSJSpecial(node, parentJsonObj);
2248
+ break;
2249
+ default:
2250
+ if ((0, $48a7bc78362df58a$export$32d1909bfb943eb0).includes(node.type) || (0, $48a7bc78362df58a$export$ec3044778745fabd).includes(node.type) || [
2251
+ "xt_standalone"
2252
+ ].includes(node.type)) this.nodeToUSJChar(node, parentJsonObj);
2253
+ else if (node.type.endsWith("Attribute")) this.nodeToUSJAttrib(node, parentJsonObj);
2254
+ else if ((0, $48a7bc78362df58a$export$3ea3efefd6f5792b).includes(node.type) || (0, $48a7bc78362df58a$export$3ea3efefd6f5792b).includes(node.type.replace("\\", "").trim())) this.nodeToUSJGeneric(node, parentJsonObj);
2255
+ else if ([
2256
+ "",
2257
+ "|"
2258
+ ].includes(node.type.trim())) break;
2259
+ else if (node.children.length > 0) node.children.forEach((child)=>this.nodeToUSJ(child, parentJsonObj));
2260
+ break;
2261
+ }
2262
+ }
2263
+ }
2264
+ var $bc15495701a08748$export$2e2bcd8739ae039 = $bc15495701a08748$var$USJGenerator;
2265
+
2266
+
2267
+ const $c05a2421aa3e322c$var$MARKERS_WITH_DISCARDABLE_CONTENTS = [
2268
+ "ide",
2269
+ "usfm",
2270
+ "h",
2271
+ "toc",
2272
+ "toca",
2273
+ "imt",
2274
+ "is",
2275
+ "ip",
2276
+ "ipi",
2277
+ "im",
2278
+ "imi",
2279
+ "ipq",
2280
+ "imq",
2281
+ "ipr",
2282
+ "iq",
2283
+ "ib",
2284
+ "ili",
2285
+ "iot",
2286
+ "io",
2287
+ "iex",
2288
+ "imte",
2289
+ "ie",
2290
+ "mt",
2291
+ "mte",
2292
+ "cl",
2293
+ "cd",
2294
+ "ms",
2295
+ "mr",
2296
+ "s",
2297
+ "sr",
2298
+ "r",
2299
+ "d",
2300
+ "sp",
2301
+ "sd",
2302
+ "sts",
2303
+ "rem",
2304
+ "lit",
2305
+ "restore",
2306
+ "f",
2307
+ "fe",
2308
+ "ef",
2309
+ "efe",
2310
+ "x",
2311
+ "ex",
2312
+ "fr",
2313
+ "ft",
2314
+ "fk",
2315
+ "fq",
2316
+ "fqa",
2317
+ "fl",
2318
+ "fw",
2319
+ "fp",
2320
+ "fv",
2321
+ "fdc",
2322
+ "xo",
2323
+ "xop",
2324
+ "xt",
2325
+ "xta",
2326
+ "xk",
2327
+ "xq",
2328
+ "xot",
2329
+ "xnt",
2330
+ "xdc",
2331
+ "jmp",
2332
+ "fig",
2333
+ "cat",
2334
+ "esb",
2335
+ "b"
2336
+ ];
2337
+ const $c05a2421aa3e322c$var$trailingNumPattern = /\d+$/;
2338
+ const $c05a2421aa3e322c$var$punctPatternNoSpaceBefore = /^[,.\-—/;:!?@$%^)}\]>”»]/;
2339
+ const $c05a2421aa3e322c$var$punctPatternNoSpaceAfter = /[\-—/`@^&({[<“«]$/;
2340
+ function $c05a2421aa3e322c$var$combineConsecutiveTextContents(contentsList) {
2341
+ let textCombinedContents = [];
2342
+ let textContents = "";
2343
+ contentsList.forEach((item)=>{
2344
+ if (typeof item === "string") {
2345
+ if (!(textContents.endsWith(" ") || item.startsWith(" ") || textContents === "" || $c05a2421aa3e322c$var$punctPatternNoSpaceBefore.test(item) || $c05a2421aa3e322c$var$punctPatternNoSpaceAfter.test(textContents))) textContents += " ";
2346
+ textContents += item;
2347
+ } else {
2348
+ if (textContents !== "") {
2349
+ textCombinedContents.push(textContents);
2350
+ textContents = "";
2351
+ }
2352
+ textCombinedContents.push(item);
2353
+ }
2354
+ });
2355
+ if (textContents !== "") textCombinedContents.push(textContents);
2356
+ return textCombinedContents;
2357
+ }
2358
+ function $c05a2421aa3e322c$export$9539ba3a89be1c40(inputUsj, excludeMarkers, combineTexts = true, excludedParent = false) {
2359
+ if (typeof inputUsj === "string") {
2360
+ if (excludedParent && excludeMarkers.includes("text-in-excluded-parent")) return [];
2361
+ return [
2362
+ inputUsj
2363
+ ];
2364
+ }
2365
+ let cleanedKids = [];
2366
+ let cleanedMarkers = excludeMarkers.map((marker)=>marker.replace($c05a2421aa3e322c$var$trailingNumPattern, ""));
2367
+ let thisMarker = "marker" in inputUsj ? inputUsj.marker.replace($c05a2421aa3e322c$var$trailingNumPattern, "") : "";
2368
+ let thisMarkerNeeded = true;
2369
+ let innerContentNeeded = true;
2370
+ excludedParent = false;
2371
+ if (cleanedMarkers.includes(thisMarker)) {
2372
+ thisMarkerNeeded = false;
2373
+ excludedParent = true;
2374
+ if ($c05a2421aa3e322c$var$MARKERS_WITH_DISCARDABLE_CONTENTS.includes(thisMarker)) innerContentNeeded = false;
2375
+ }
2376
+ if ((thisMarkerNeeded || innerContentNeeded) && "content" in inputUsj) {
2377
+ inputUsj.content.forEach((item)=>{
2378
+ let cleaned = $c05a2421aa3e322c$export$9539ba3a89be1c40(item, excludeMarkers, combineTexts, excludedParent);
2379
+ if (Array.isArray(cleaned)) cleanedKids.push(...cleaned);
2380
+ else cleanedKids.push(cleaned);
2381
+ });
2382
+ if (combineTexts) cleanedKids = $c05a2421aa3e322c$var$combineConsecutiveTextContents(cleanedKids);
2383
+ }
2384
+ if (thisMarkerNeeded) {
2385
+ let cleanedUsj = {
2386
+ ...inputUsj,
2387
+ content: cleanedKids
2388
+ };
2389
+ return cleanedUsj;
2390
+ }
2391
+ return innerContentNeeded ? cleanedKids : [];
2392
+ }
2393
+ function $c05a2421aa3e322c$export$88c58c54200c5b2(inputUsj, includeMarkers, combineTexts = true, excludedParent = false) {
2394
+ if (typeof inputUsj === "string") return excludedParent ? [] : [
2395
+ inputUsj
2396
+ ];
2397
+ let cleanedKids = [];
2398
+ let cleanedMarkers = includeMarkers.map((marker)=>marker.replace($c05a2421aa3e322c$var$trailingNumPattern, ""));
2399
+ let thisMarker = "marker" in inputUsj ? inputUsj.marker.replace($c05a2421aa3e322c$var$trailingNumPattern, "") : "";
2400
+ let thisMarkerNeeded = cleanedMarkers.includes(thisMarker) || thisMarker === "";
2401
+ let innerContentNeeded = thisMarkerNeeded || $c05a2421aa3e322c$var$MARKERS_WITH_DISCARDABLE_CONTENTS.includes(thisMarker);
2402
+ if (innerContentNeeded && "content" in inputUsj) {
2403
+ inputUsj.content.forEach((item)=>{
2404
+ let cleaned = $c05a2421aa3e322c$export$88c58c54200c5b2(item, includeMarkers, combineTexts, !thisMarkerNeeded);
2405
+ if (Array.isArray(cleaned)) cleanedKids.push(...cleaned);
2406
+ else cleanedKids.push(cleaned);
2407
+ });
2408
+ if (combineTexts) cleanedKids = $c05a2421aa3e322c$var$combineConsecutiveTextContents(cleanedKids);
2409
+ }
2410
+ if (thisMarkerNeeded) {
2411
+ let cleanedUsj = {
2412
+ ...inputUsj,
2413
+ content: cleanedKids
2414
+ };
2415
+ return cleanedUsj;
2416
+ }
2417
+ return innerContentNeeded ? cleanedKids : [];
2418
+ }
2419
+
2420
+
2421
+ class $be3194b3d68e926d$var$USFMParser {
2422
+ static language = null;
2423
+ static async init(grammarPath = "node_modules/usfm-grammar/tree-sitter-usfm.wasm", parserPath = "node_modules/usfm-grammar/tree-sitter.wasm") {
2424
+ await (0, (/*@__PURE__*/$parcel$interopDefault($5UXqS))).init({
2425
+ locateFile () {
2426
+ return parserPath;
2427
+ }
2428
+ });
2429
+ $be3194b3d68e926d$var$USFMParser.language = await (0, (/*@__PURE__*/$parcel$interopDefault($5UXqS))).Language.load(grammarPath);
2430
+ }
2431
+ constructor(){
2432
+ this.parser = null;
2433
+ this.usfm = null;
2434
+ this.usj = null;
2435
+ this.syntaxTree = null;
2436
+ }
2437
+ initializeParser() {
2438
+ if (!$be3194b3d68e926d$var$USFMParser.language) throw new Error("USFMParser not initialized. Call USFMParser.init() before creating instances.");
2439
+ this.parser = new (0, (/*@__PURE__*/$parcel$interopDefault($5UXqS)))();
2440
+ this.parser.setLanguage($be3194b3d68e926d$var$USFMParser.language);
2441
+ }
2442
+ usfmToUsj(usfmString) {
2443
+ if (typeof usfmString !== "string" || usfmString === null) throw new Error("Invalid input for USFM. Expected a string.");
2444
+ if (!this.parser) this.initializeParser();
2445
+ this.usfm = usfmString;
2446
+ this.parseUSFM();
2447
+ this.usj = this.convertUSFMToUSJ();
2448
+ return this.usj;
2449
+ }
2450
+ usjToUsfm(usjObject) {
2451
+ if (typeof usjObject !== "object" || usjObject === null) throw new Error("Invalid input for USJ. Expected an object.");
2452
+ if (!this.parser) this.initializeParser();
2453
+ this.usj = usjObject;
2454
+ this.usfm = this.convertUSJToUSFM();
2455
+ return this.usfm;
2456
+ }
2457
+ parseUSFM() {
2458
+ let tree = null;
2459
+ try {
2460
+ tree = this.parser.parse(this.usfm);
2461
+ } catch (err) {
2462
+ console.log(err.toString());
2463
+ }
2464
+ const error = this.checkForErrors(tree);
2465
+ if (error) throw error;
2466
+ this.syntaxTree = tree.rootNode;
2467
+ }
2468
+ checkForErrors(tree) {
2469
+ const errorQuery = this.parser.getLanguage().query("(ERROR) @errors");
2470
+ const errors = errorQuery.captures(tree.rootNode);
2471
+ if (errors.length > 0) {
2472
+ this.errors = errors.map((err)=>`At ${err.node.startPosition.row}:${err.node.startPosition.column}, Error: ${this.usfm.substring(err.node.startIndex, err.node.endIndex)}`);
2473
+ return new Error(`Errors found in USFM: ${this.errors.join(", ")}`);
2474
+ }
2475
+ return null;
2476
+ }
2477
+ convertUSJToUSFM() {
2478
+ const outputUSFM = new (0, $b37353ce824c37f3$export$2e2bcd8739ae039)().usjToUsfm(this.usj); // Simulated conversion
2479
+ return outputUSFM;
2480
+ }
2481
+ convertUSFMToUSJ({ excludeMarkers: excludeMarkers = null, includeMarkers: includeMarkers = null, ignoreErrors: ignoreErrors = false, combineTexts: combineTexts = true } = {}) {
2482
+ if (!ignoreErrors && this.errors) {
2483
+ let errorString = this.errors.map((err)=>err.join(":")).join("\n ");
2484
+ throw new Error(`Errors present:\n\t${errorString}\nUse ignoreErrors = true to generate output despite errors.`);
2485
+ }
2486
+ let jsonRootObj = {
2487
+ type: "USJ",
2488
+ version: "0.2.0",
2489
+ content: []
2490
+ };
2491
+ let outputUSJ;
2492
+ try {
2493
+ let usjGenerator = new (0, $bc15495701a08748$export$2e2bcd8739ae039)($be3194b3d68e926d$var$USFMParser.language, this.usfm, jsonRootObj);
2494
+ usjGenerator.nodeToUSJ(this.syntaxTree, jsonRootObj);
2495
+ outputUSJ = usjGenerator.jsonRootObj;
2496
+ } catch (err) {
2497
+ let message = "Unable to do the conversion. ";
2498
+ if (this.errors) {
2499
+ let errorString = this.errors.map((err)=>err.join(":")).join("\n ");
2500
+ message += `Could be due to an error in the USFM\n\t${errorString}`;
2501
+ }
2502
+ return null;
2503
+ }
2504
+ if (includeMarkers) outputUSJ = (0, $c05a2421aa3e322c$export$88c58c54200c5b2)(outputUSJ, [
2505
+ ...includeMarkers,
2506
+ "USJ"
2507
+ ], combineTexts);
2508
+ if (excludeMarkers) outputUSJ = (0, $c05a2421aa3e322c$export$9539ba3a89be1c40)(outputUSJ, excludeMarkers, combineTexts);
2509
+ return outputUSJ;
2510
+ }
2511
+ }
2512
+ var $be3194b3d68e926d$export$2e2bcd8739ae039 = $be3194b3d68e926d$var$USFMParser;
2513
+
2514
+
2515
+ console.log("COmes in index.js");
2516
+
2517
+
2518
+ //# sourceMappingURL=index.cjs.map