"use strict";var Kt=Object.defineProperty;var Yt=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),Xt=(e,t)=>{for(var r in t)Kt(e,r,{get:t[r],enumerable:!0})};var Le=Yt((exports,module)=>{var Module=typeof Module<"u"?Module:{},ENVIRONMENT_IS_WEB=typeof window=="object",ENVIRONMENT_IS_WORKER=typeof importScripts=="function",ENVIRONMENT_IS_NODE=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string",TreeSitter=function(){var initPromise,document=typeof window=="object"?{currentScript:window.document.currentScript}:null;class Parser{constructor(){this.initialize()}initialize(){throw new Error("cannot construct a Parser before calling `init()`")}static init(moduleOptions){return initPromise||(Module=Object.assign({},Module,moduleOptions),initPromise=new Promise(resolveInitPromise=>{var moduleOverrides=Object.assign({},Module),arguments_=[],thisProgram="./this.program",quit_=(e,t)=>{throw t},scriptDirectory="";function locateFile(e){return Module.locateFile?Module.locateFile(e,scriptDirectory):scriptDirectory+e}var readAsync,readBinary;if(ENVIRONMENT_IS_NODE){var fs=require("fs"),nodePath=require("path");scriptDirectory=__dirname+"/",readBinary=e=>{e=isFileURI(e)?new URL(e):nodePath.normalize(e);var t=fs.readFileSync(e);return t},readAsync=(e,t=!0)=>(e=isFileURI(e)?new URL(e):nodePath.normalize(e),new Promise((r,n)=>{fs.readFile(e,t?void 0:"utf8",(s,o)=>{s?n(s):r(t?o.buffer:o)})})),!Module.thisProgram&&process.argv.length>1&&(thisProgram=process.argv[1].replace(/\\/g,"/")),arguments_=process.argv.slice(2),typeof module<"u"&&(module.exports=Module),quit_=(e,t)=>{throw process.exitCode=e,t}}else(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER)&&(ENVIRONMENT_IS_WORKER?scriptDirectory=self.location.href:typeof document<"u"&&document.currentScript&&(scriptDirectory=document.currentScript.src),scriptDirectory.startsWith("blob:")?scriptDirectory="":scriptDirectory=scriptDirectory.substr(0,scriptDirectory.replace(/[?#].*/,"").lastIndexOf("/")+1),ENVIRONMENT_IS_WORKER&&(readBinary=e=>{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.responseType="arraybuffer",t.send(null),new Uint8Array(t.response)}),readAsync=e=>isFileURI(e)?new Promise((t,r)=>{var n=new XMLHttpRequest;n.open("GET",e,!0),n.responseType="arraybuffer",n.onload=()=>{(n.status==200||n.status==0&&n.response)&&r(n.response),t(n.status)},n.onerror=t,n.send(null)}):fetch(e,{credentials:"same-origin"}).then(t=>t.ok?t.arrayBuffer():Promise.reject(new Error(t.status+" : "+t.url))));var out=Module.print||console.log.bind(console),err=Module.printErr||console.error.bind(console);Object.assign(Module,moduleOverrides),moduleOverrides=null,Module.arguments&&(arguments_=Module.arguments),Module.thisProgram&&(thisProgram=Module.thisProgram),Module.quit&&(quit_=Module.quit);var dynamicLibraries=Module.dynamicLibraries||[],wasmBinary;Module.wasmBinary&&(wasmBinary=Module.wasmBinary);var wasmMemory,ABORT=!1,EXITSTATUS,HEAP8,HEAPU8,HEAP16,HEAPU16,HEAP32,HEAPU32,HEAPF32,HEAPF64,HEAP_DATA_VIEW;function updateMemoryViews(){var e=wasmMemory.buffer;Module.HEAP_DATA_VIEW=HEAP_DATA_VIEW=new DataView(e),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)}if(Module.wasmMemory)wasmMemory=Module.wasmMemory;else{var INITIAL_MEMORY=Module.INITIAL_MEMORY||33554432;wasmMemory=new WebAssembly.Memory({initial:INITIAL_MEMORY/65536,maximum:2147483648/65536})}updateMemoryViews();var __ATPRERUN__=[],__ATINIT__=[],__ATMAIN__=[],__ATPOSTRUN__=[],__RELOC_FUNCS__=[],runtimeInitialized=!1;function preRun(){if(Module.preRun)for(typeof Module.preRun=="function"&&(Module.preRun=[Module.preRun]);Module.preRun.length;)addOnPreRun(Module.preRun.shift());callRuntimeCallbacks(__ATPRERUN__)}function initRuntime(){runtimeInitialized=!0,callRuntimeCallbacks(__RELOC_FUNCS__),callRuntimeCallbacks(__ATINIT__)}function preMain(){callRuntimeCallbacks(__ATMAIN__)}function postRun(){if(Module.postRun)for(typeof Module.postRun=="function"&&(Module.postRun=[Module.postRun]);Module.postRun.length;)addOnPostRun(Module.postRun.shift());callRuntimeCallbacks(__ATPOSTRUN__)}function addOnPreRun(e){__ATPRERUN__.unshift(e)}function addOnInit(e){__ATINIT__.unshift(e)}function addOnPostRun(e){__ATPOSTRUN__.unshift(e)}var runDependencies=0,runDependencyWatcher=null,dependenciesFulfilled=null;function getUniqueRunDependency(e){return e}function addRunDependency(e){runDependencies++,Module.monitorRunDependencies?.(runDependencies)}function removeRunDependency(e){if(runDependencies--,Module.monitorRunDependencies?.(runDependencies),runDependencies==0&&(runDependencyWatcher!==null&&(clearInterval(runDependencyWatcher),runDependencyWatcher=null),dependenciesFulfilled)){var t=dependenciesFulfilled;dependenciesFulfilled=null,t()}}function abort(e){Module.onAbort?.(e),e="Aborted("+e+")",err(e),ABORT=!0,EXITSTATUS=1,e+=". Build with -sASSERTIONS for more info.";var t=new WebAssembly.RuntimeError(e);throw t}var dataURIPrefix="data:application/octet-stream;base64,",isDataURI=e=>e.startsWith(dataURIPrefix),isFileURI=e=>e.startsWith("file://");function findWasmBinary(){var e="tree-sitter.wasm";return isDataURI(e)?e:locateFile(e)}var wasmBinaryFile;function getBinarySync(e){if(e==wasmBinaryFile&&wasmBinary)return new Uint8Array(wasmBinary);if(readBinary)return readBinary(e);throw"both async and sync fetching of the wasm failed"}function getBinaryPromise(e){return wasmBinary?Promise.resolve().then(()=>getBinarySync(e)):readAsync(e).then(t=>new Uint8Array(t),()=>getBinarySync(e))}function instantiateArrayBuffer(e,t,r){return getBinaryPromise(e).then(n=>WebAssembly.instantiate(n,t)).then(r,n=>{err(`failed to asynchronously prepare wasm: ${n}`),abort(n)})}function instantiateAsync(e,t,r,n){return!e&&typeof WebAssembly.instantiateStreaming=="function"&&!isDataURI(t)&&!isFileURI(t)&&!ENVIRONMENT_IS_NODE&&typeof fetch=="function"?fetch(t,{credentials:"same-origin"}).then(s=>{var o=WebAssembly.instantiateStreaming(s,r);return o.then(n,function(a){return err(`wasm streaming compile failed: ${a}`),err("falling back to ArrayBuffer instantiation"),instantiateArrayBuffer(t,r,n)})}):instantiateArrayBuffer(t,r,n)}function getWasmImports(){return{env:wasmImports,wasi_snapshot_preview1:wasmImports,"GOT.mem":new Proxy(wasmImports,GOTHandler),"GOT.func":new Proxy(wasmImports,GOTHandler)}}function createWasm(){var e=getWasmImports();function t(n,s){wasmExports=n.exports,wasmExports=relocateExports(wasmExports,1024);var o=getDylinkMetadata(s);return o.neededDynlibs&&(dynamicLibraries=o.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}addRunDependency("wasm-instantiate");function r(n){t(n.instance,n.module)}if(Module.instantiateWasm)try{return Module.instantiateWasm(e,t)}catch(n){return err(`Module.instantiateWasm callback failed with error: ${n}`),!1}return wasmBinaryFile||(wasmBinaryFile=findWasmBinary()),instantiateAsync(wasmBinary,wasmBinaryFile,e,r),{}}var ASM_CONSTS={};function ExitStatus(e){this.name="ExitStatus",this.message=`Program terminated with exit(${e})`,this.status=e}var GOT={},currentModuleWeakSymbols=new Set([]),GOTHandler={get(e,t){var r=GOT[t];return r||(r=GOT[t]=new WebAssembly.Global({value:"i32",mutable:!0})),currentModuleWeakSymbols.has(t)||(r.required=!0),r}},LE_HEAP_LOAD_F32=e=>HEAP_DATA_VIEW.getFloat32(e,!0),LE_HEAP_LOAD_F64=e=>HEAP_DATA_VIEW.getFloat64(e,!0),LE_HEAP_LOAD_I16=e=>HEAP_DATA_VIEW.getInt16(e,!0),LE_HEAP_LOAD_I32=e=>HEAP_DATA_VIEW.getInt32(e,!0),LE_HEAP_LOAD_U32=e=>HEAP_DATA_VIEW.getUint32(e,!0),LE_HEAP_STORE_F32=(e,t)=>HEAP_DATA_VIEW.setFloat32(e,t,!0),LE_HEAP_STORE_F64=(e,t)=>HEAP_DATA_VIEW.setFloat64(e,t,!0),LE_HEAP_STORE_I16=(e,t)=>HEAP_DATA_VIEW.setInt16(e,t,!0),LE_HEAP_STORE_I32=(e,t)=>HEAP_DATA_VIEW.setInt32(e,t,!0),LE_HEAP_STORE_U32=(e,t)=>HEAP_DATA_VIEW.setUint32(e,t,!0),callRuntimeCallbacks=e=>{for(;e.length>0;)e.shift()(Module)},UTF8Decoder=typeof TextDecoder<"u"?new TextDecoder:void 0,UTF8ArrayToString=(e,t,r)=>{for(var n=t+r,s=t;e[s]&&!(s>=n);)++s;if(s-t>16&&e.buffer&&UTF8Decoder)return UTF8Decoder.decode(e.subarray(t,s));for(var o="";t>10,56320|l&1023)}}return o},getDylinkMetadata=e=>{var t=0,r=0;function n(){return e[t++]}function s(){for(var Q=0,I=1;;){var k=e[t++];if(Q+=(k&127)*I,I*=128,!(k&128))break}return Q}function o(){var Q=s();return t+=Q,UTF8ArrayToString(e,t-Q,Q)}function a(Q,I){if(Q)throw new Error(I)}var _="dylink.0";if(e instanceof WebAssembly.Module){var d=WebAssembly.Module.customSections(e,_);d.length===0&&(_="dylink",d=WebAssembly.Module.customSections(e,_)),a(d.length===0,"need dylink section"),e=new Uint8Array(d[0]),r=e.length}else{var l=new Uint32Array(new Uint8Array(e.subarray(0,24)).buffer),u=l[0]==1836278016||l[0]==6386541;a(!u,"need to see wasm magic number"),a(e[8]!==0,"need the dylink section to be first"),t=9;var c=s();r=t+c,_=o()}var m={neededDynlibs:[],tlsExports:new Set,weakImports:new Set};if(_=="dylink"){m.memorySize=s(),m.memoryAlign=s(),m.tableSize=s(),m.tableAlign=s();for(var w=s(),x=0;x>1)*2);case"i32":return LE_HEAP_LOAD_I32((e>>2)*4);case"i64":abort("to do getValue(i64) use WASM_BIGINT");case"float":return LE_HEAP_LOAD_F32((e>>2)*4);case"double":return LE_HEAP_LOAD_F64((e>>3)*8);case"*":return LE_HEAP_LOAD_U32((e>>2)*4);default:abort(`invalid type for getValue: ${t}`)}}var newDSO=(e,t,r)=>{var n={refcount:1/0,name:e,exports:r,global:!0};return LDSO.loadedLibsByName[e]=n,t!=null&&(LDSO.loadedLibsByHandle[t]=n),n},LDSO={loadedLibsByName:{},loadedLibsByHandle:{},init(){newDSO("__main__",0,wasmImports)}},___heap_base=78112,zeroMemory=(e,t)=>(HEAPU8.fill(0,e,e+t),e),alignMemory=(e,t)=>Math.ceil(e/t)*t,getMemory=e=>{if(runtimeInitialized)return zeroMemory(_malloc(e),e);var t=___heap_base,r=t+alignMemory(e,16);return ___heap_base=r,GOT.__heap_base.value=r,t},isInternalSym=e=>["__cpp_exception","__c_longjmp","__wasm_apply_data_relocs","__dso_handle","__tls_size","__tls_align","__set_stack_limits","_emscripten_tls_init","__wasm_init_tls","__wasm_call_ctors","__start_em_asm","__stop_em_asm","__start_em_js","__stop_em_js"].includes(e)||e.startsWith("__em_js__"),uleb128Encode=(e,t)=>{e<128?t.push(e):t.push(e%128|128,e>>7)},sigToWasmTypes=e=>{for(var t={i:"i32",j:"i64",f:"f32",d:"f64",e:"externref",p:"i32"},r={parameters:[],results:e[0]=="v"?[]:[t[e[0]]]},n=1;n{var r=e.slice(0,1),n=e.slice(1),s={i:127,p:127,j:126,f:125,d:124,e:111};t.push(96),uleb128Encode(n.length,t);for(var o=0;o{if(typeof WebAssembly.Function=="function")return new WebAssembly.Function(sigToWasmTypes(t),e);var r=[1];generateFuncType(t,r);var n=[0,97,115,109,1,0,0,0,1];uleb128Encode(r.length,n),n.push(...r),n.push(2,7,1,1,101,1,102,0,0,7,5,1,1,102,0,0);var s=new WebAssembly.Module(new Uint8Array(n)),o=new WebAssembly.Instance(s,{e:{f:e}}),a=o.exports.f;return a},wasmTableMirror=[],wasmTable=new WebAssembly.Table({initial:28,element:"anyfunc"}),getWasmTableEntry=e=>{var t=wasmTableMirror[e];return t||(e>=wasmTableMirror.length&&(wasmTableMirror.length=e+1),wasmTableMirror[e]=t=wasmTable.get(e)),t},updateTableMap=(e,t)=>{if(functionsInTableMap)for(var r=e;r(functionsInTableMap||(functionsInTableMap=new WeakMap,updateTableMap(0,wasmTable.length)),functionsInTableMap.get(e)||0),freeTableIndexes=[],getEmptyTableSlot=()=>{if(freeTableIndexes.length)return freeTableIndexes.pop();try{wasmTable.grow(1)}catch(e){throw e instanceof RangeError?"Unable to grow wasm table. Set ALLOW_TABLE_GROWTH.":e}return wasmTable.length-1},setWasmTableEntry=(e,t)=>{wasmTable.set(e,t),wasmTableMirror[e]=wasmTable.get(e)},addFunction=(e,t)=>{var r=getFunctionAddress(e);if(r)return r;var n=getEmptyTableSlot();try{setWasmTableEntry(n,e)}catch(o){if(!(o instanceof TypeError))throw o;var s=convertJsFunctionToWasm(e,t);setWasmTableEntry(n,s)}return functionsInTableMap.set(e,n),n},updateGOT=(e,t)=>{for(var r in e)if(!isInternalSym(r)){var n=e[r];r.startsWith("orig$")&&(r=r.split("$")[1],t=!0),GOT[r]||=new WebAssembly.Global({value:"i32",mutable:!0}),(t||GOT[r].value==0)&&(typeof n=="function"?GOT[r].value=addFunction(n):typeof n=="number"?GOT[r].value=n:err(`unhandled export type for '${r}': ${typeof n}`))}},relocateExports=(e,t,r)=>{var n={};for(var s in e){var o=e[s];typeof o=="object"&&(o=o.value),typeof o=="number"&&(o+=t),n[s]=o}return updateGOT(n,r),n},isSymbolDefined=e=>{var t=wasmImports[e];return!(!t||t.stub)},dynCallLegacy=(e,t,r)=>{e=e.replace(/p/g,"i");var n=Module["dynCall_"+e];return n(t,...r)},dynCall=(e,t,r=[])=>{if(e.includes("j"))return dynCallLegacy(e,t,r);var n=getWasmTableEntry(t)(...r);return n},stackSave=()=>_emscripten_stack_get_current(),stackRestore=e=>__emscripten_stack_restore(e),createInvokeFunction=e=>(t,...r)=>{var n=stackSave();try{return dynCall(e,t,r)}catch(s){if(stackRestore(n),s!==s+0)throw s;_setThrew(1,0)}},resolveGlobalSymbol=(e,t=!1)=>{var r;return t&&"orig$"+e in wasmImports&&(e="orig$"+e),isSymbolDefined(e)?r=wasmImports[e]:e.startsWith("invoke_")&&(r=wasmImports[e]=createInvokeFunction(e.split("_")[1])),{sym:r,name:e}},UTF8ToString=(e,t)=>e?UTF8ArrayToString(HEAPU8,e,t):"",loadWebAssemblyModule=(binary,flags,libName,localScope,handle)=>{var metadata=getDylinkMetadata(binary);currentModuleWeakSymbols=metadata.weakImports;function loadModule(){var firstLoad=!handle||!HEAP8[handle+8];if(firstLoad){var memAlign=Math.pow(2,metadata.memoryAlign),memoryBase=metadata.memorySize?alignMemory(getMemory(metadata.memorySize+memAlign),memAlign):0,tableBase=metadata.tableSize?wasmTable.length:0;handle&&(HEAP8[handle+8]=1,LE_HEAP_STORE_U32((handle+12>>2)*4,memoryBase),LE_HEAP_STORE_I32((handle+16>>2)*4,metadata.memorySize),LE_HEAP_STORE_U32((handle+20>>2)*4,tableBase),LE_HEAP_STORE_I32((handle+24>>2)*4,metadata.tableSize))}else memoryBase=LE_HEAP_LOAD_U32((handle+12>>2)*4),tableBase=LE_HEAP_LOAD_U32((handle+20>>2)*4);var tableGrowthNeeded=tableBase+metadata.tableSize-wasmTable.length;tableGrowthNeeded>0&&wasmTable.grow(tableGrowthNeeded);var moduleExports;function resolveSymbol(e){var t=resolveGlobalSymbol(e).sym;return!t&&localScope&&(t=localScope[e]),t||(t=moduleExports[e]),t}var proxyHandler={get(e,t){switch(t){case"__memory_base":return memoryBase;case"__table_base":return tableBase}if(t in wasmImports&&!wasmImports[t].stub)return wasmImports[t];if(!(t in e)){var r;e[t]=(...n)=>(r||=resolveSymbol(t),r(...n))}return e[t]}},proxy=new Proxy({},proxyHandler),info={"GOT.mem":new Proxy({},GOTHandler),"GOT.func":new Proxy({},GOTHandler),env:proxy,wasi_snapshot_preview1:proxy};function postInstantiation(module,instance){updateTableMap(tableBase,metadata.tableSize),moduleExports=relocateExports(instance.exports,memoryBase),flags.allowUndefined||reportUndefinedSymbols();function addEmAsm(addr,body){for(var args=[],arity=0;arity<16&&body.indexOf("$"+arity)!=-1;arity++)args.push("$"+arity);args=args.join(",");var func=`(${args}) => { ${body} };`;ASM_CONSTS[start]=eval(func)}if("__start_em_asm"in moduleExports)for(var start=moduleExports.__start_em_asm,stop=moduleExports.__stop_em_asm;start ${body};`;moduleExports[name]=eval(func)}for(var name in moduleExports)if(name.startsWith("__em_js__")){var start=moduleExports[name],jsString=UTF8ToString(start),parts=jsString.split("<::>");addEmJs(name.replace("__em_js__",""),parts[0],parts[1]),delete moduleExports[name]}var applyRelocs=moduleExports.__wasm_apply_data_relocs;applyRelocs&&(runtimeInitialized?applyRelocs():__RELOC_FUNCS__.push(applyRelocs));var init=moduleExports.__wasm_call_ctors;return init&&(runtimeInitialized?init():__ATINIT__.push(init)),moduleExports}if(flags.loadAsync){if(binary instanceof WebAssembly.Module){var instance=new WebAssembly.Instance(binary,info);return Promise.resolve(postInstantiation(binary,instance))}return WebAssembly.instantiate(binary,info).then(e=>postInstantiation(e.module,e.instance))}var module=binary instanceof WebAssembly.Module?binary:new WebAssembly.Module(binary),instance=new WebAssembly.Instance(module,info);return postInstantiation(module,instance)}return flags.loadAsync?metadata.neededDynlibs.reduce((e,t)=>e.then(()=>loadDynamicLibrary(t,flags,localScope)),Promise.resolve()).then(loadModule):(metadata.neededDynlibs.forEach(e=>loadDynamicLibrary(e,flags,localScope)),loadModule())},mergeLibSymbols=(e,t)=>{for(var[r,n]of Object.entries(e)){let s=a=>{isSymbolDefined(a)||(wasmImports[a]=n)};s(r);let o="__main_argc_argv";r=="main"&&s(o),r==o&&s("main"),r.startsWith("dynCall_")&&!Module.hasOwnProperty(r)&&(Module[r]=n)}},asyncLoad=(e,t,r,n)=>{var s=n?"":`al ${e}`;readAsync(e).then(o=>{t(new Uint8Array(o)),s&&removeRunDependency(s)},o=>{if(r)r();else throw`Loading data file "${e}" failed.`}),s&&addRunDependency(s)};function loadDynamicLibrary(e,t={global:!0,nodelete:!0},r,n){var s=LDSO.loadedLibsByName[e];if(s)return t.global?s.global||(s.global=!0,mergeLibSymbols(s.exports,e)):r&&Object.assign(r,s.exports),t.nodelete&&s.refcount!==1/0&&(s.refcount=1/0),s.refcount++,n&&(LDSO.loadedLibsByHandle[n]=s),t.loadAsync?Promise.resolve(!0):!0;s=newDSO(e,n,"loading"),s.refcount=t.nodelete?1/0:1,s.global=t.global;function o(){if(n){var d=LE_HEAP_LOAD_U32((n+28>>2)*4),l=LE_HEAP_LOAD_U32((n+32>>2)*4);if(d&&l){var u=HEAP8.slice(d,d+l);return t.loadAsync?Promise.resolve(u):u}}var c=locateFile(e);if(t.loadAsync)return new Promise(function(m,w){asyncLoad(c,m,w)});if(!readBinary)throw new Error(`${c}: file not found, and synchronous loading of external files is not available`);return readBinary(c)}function a(){return t.loadAsync?o().then(d=>loadWebAssemblyModule(d,t,e,r,n)):loadWebAssemblyModule(o(),t,e,r,n)}function _(d){s.global?mergeLibSymbols(d,e):r&&Object.assign(r,d),s.exports=d}return t.loadAsync?a().then(d=>(_(d),!0)):(_(a()),!0)}var reportUndefinedSymbols=()=>{for(var[e,t]of Object.entries(GOT))if(t.value==0){var r=resolveGlobalSymbol(e,!0).sym;if(!r&&!t.required)continue;if(typeof r=="function")t.value=addFunction(r,r.sig);else if(typeof r=="number")t.value=r;else throw new Error(`bad export type for '${e}': ${typeof r}`)}},loadDylibs=()=>{if(!dynamicLibraries.length){reportUndefinedSymbols();return}addRunDependency("loadDylibs"),dynamicLibraries.reduce((e,t)=>e.then(()=>loadDynamicLibrary(t,{loadAsync:!0,global:!0,nodelete:!0,allowUndefined:!0})),Promise.resolve()).then(()=>{reportUndefinedSymbols(),removeRunDependency("loadDylibs")})},noExitRuntime=Module.noExitRuntime||!0;function setValue(e,t,r="i8"){switch(r.endsWith("*")&&(r="*"),r){case"i1":HEAP8[e]=t;break;case"i8":HEAP8[e]=t;break;case"i16":LE_HEAP_STORE_I16((e>>1)*2,t);break;case"i32":LE_HEAP_STORE_I32((e>>2)*4,t);break;case"i64":abort("to do setValue(i64) use WASM_BIGINT");case"float":LE_HEAP_STORE_F32((e>>2)*4,t);break;case"double":LE_HEAP_STORE_F64((e>>3)*8,t);break;case"*":LE_HEAP_STORE_U32((e>>2)*4,t);break;default:abort(`invalid type for setValue: ${r}`)}}var ___memory_base=new WebAssembly.Global({value:"i32",mutable:!1},1024),___stack_pointer=new WebAssembly.Global({value:"i32",mutable:!0},78112),___table_base=new WebAssembly.Global({value:"i32",mutable:!1},1),__abort_js=()=>{abort("")};__abort_js.sig="v";var nowIsMonotonic=1,__emscripten_get_now_is_monotonic=()=>nowIsMonotonic;__emscripten_get_now_is_monotonic.sig="i";var __emscripten_memcpy_js=(e,t,r)=>HEAPU8.copyWithin(e,t,t+r);__emscripten_memcpy_js.sig="vppp";var _emscripten_date_now=()=>Date.now();_emscripten_date_now.sig="d";var _emscripten_get_now;_emscripten_get_now=()=>performance.now(),_emscripten_get_now.sig="d";var getHeapMax=()=>2147483648,growMemory=e=>{var t=wasmMemory.buffer,r=(e-t.byteLength+65535)/65536;try{return wasmMemory.grow(r),updateMemoryViews(),1}catch{}},_emscripten_resize_heap=e=>{var t=HEAPU8.length;e>>>=0;var r=getHeapMax();if(e>r)return!1;for(var n=(d,l)=>d+(l-d%l)%l,s=1;s<=4;s*=2){var o=t*(1+.2/s);o=Math.min(o,e+100663296);var a=Math.min(r,n(Math.max(e,o),65536)),_=growMemory(a);if(_)return!0}return!1};_emscripten_resize_heap.sig="ip";var _fd_close=e=>52;_fd_close.sig="ii";var convertI32PairToI53Checked=(e,t)=>t+2097152>>>0<4194305-!!e?(e>>>0)+t*4294967296:NaN;function _fd_seek(e,t,r,n,s){var o=convertI32PairToI53Checked(t,r);return 70}_fd_seek.sig="iiiiip";var printCharBuffers=[null,[],[]],printChar=(e,t)=>{var r=printCharBuffers[e];t===0||t===10?((e===1?out:err)(UTF8ArrayToString(r,0)),r.length=0):r.push(t)},_fd_write=(e,t,r,n)=>{for(var s=0,o=0;o>2)*4),_=LE_HEAP_LOAD_U32((t+4>>2)*4);t+=8;for(var d=0;d<_;d++)printChar(e,HEAPU8[a+d]);s+=_}return LE_HEAP_STORE_U32((n>>2)*4,s),0};_fd_write.sig="iippp";function _tree_sitter_log_callback(e,t){if(currentLogCallback){let r=UTF8ToString(t);currentLogCallback(r,e!==0)}}function _tree_sitter_parse_callback(e,t,r,n,s){let a=currentParseCallback(t,{row:r,column:n});typeof a=="string"?(setValue(s,a.length,"i32"),stringToUTF16(a,e,10240)):setValue(s,0,"i32")}var runtimeKeepaliveCounter=0,keepRuntimeAlive=()=>noExitRuntime||runtimeKeepaliveCounter>0,_proc_exit=e=>{EXITSTATUS=e,keepRuntimeAlive()||(Module.onExit?.(e),ABORT=!0),quit_(e,new ExitStatus(e))};_proc_exit.sig="vi";var exitJS=(e,t)=>{EXITSTATUS=e,_proc_exit(e)},handleException=e=>{if(e instanceof ExitStatus||e=="unwind")return EXITSTATUS;quit_(1,e)},lengthBytesUTF8=e=>{for(var t=0,r=0;r=55296&&n<=57343?(t+=4,++r):t+=3}return t},stringToUTF8Array=(e,t,r,n)=>{if(!(n>0))return 0;for(var s=r,o=r+n-1,a=0;a=55296&&_<=57343){var d=e.charCodeAt(++a);_=65536+((_&1023)<<10)|d&1023}if(_<=127){if(r>=o)break;t[r++]=_}else if(_<=2047){if(r+1>=o)break;t[r++]=192|_>>6,t[r++]=128|_&63}else if(_<=65535){if(r+2>=o)break;t[r++]=224|_>>12,t[r++]=128|_>>6&63,t[r++]=128|_&63}else{if(r+3>=o)break;t[r++]=240|_>>18,t[r++]=128|_>>12&63,t[r++]=128|_>>6&63,t[r++]=128|_&63}}return t[r]=0,r-s},stringToUTF8=(e,t,r)=>stringToUTF8Array(e,HEAPU8,t,r),stackAlloc=e=>__emscripten_stack_alloc(e),stringToUTF8OnStack=e=>{var t=lengthBytesUTF8(e)+1,r=stackAlloc(t);return stringToUTF8(e,r,t),r},stringToUTF16=(e,t,r)=>{if(r??=2147483647,r<2)return 0;r-=2;for(var n=t,s=r>1)*2,a),t+=2}return LE_HEAP_STORE_I16((t>>1)*2,0),t-n},AsciiToString=e=>{for(var t="";;){var r=HEAPU8[e++];if(!r)return t;t+=String.fromCharCode(r)}},wasmImports={__heap_base:___heap_base,__indirect_function_table:wasmTable,__memory_base:___memory_base,__stack_pointer:___stack_pointer,__table_base:___table_base,_abort_js:__abort_js,_emscripten_get_now_is_monotonic:__emscripten_get_now_is_monotonic,_emscripten_memcpy_js:__emscripten_memcpy_js,emscripten_get_now:_emscripten_get_now,emscripten_resize_heap:_emscripten_resize_heap,fd_close:_fd_close,fd_seek:_fd_seek,fd_write:_fd_write,memory:wasmMemory,tree_sitter_log_callback:_tree_sitter_log_callback,tree_sitter_parse_callback:_tree_sitter_parse_callback},wasmExports=createWasm(),___wasm_call_ctors=()=>(___wasm_call_ctors=wasmExports.__wasm_call_ctors)(),___wasm_apply_data_relocs=()=>(___wasm_apply_data_relocs=wasmExports.__wasm_apply_data_relocs)(),_malloc=Module._malloc=e=>(_malloc=Module._malloc=wasmExports.malloc)(e),_calloc=Module._calloc=(e,t)=>(_calloc=Module._calloc=wasmExports.calloc)(e,t),_realloc=Module._realloc=(e,t)=>(_realloc=Module._realloc=wasmExports.realloc)(e,t),_free=Module._free=e=>(_free=Module._free=wasmExports.free)(e),_ts_language_symbol_count=Module._ts_language_symbol_count=e=>(_ts_language_symbol_count=Module._ts_language_symbol_count=wasmExports.ts_language_symbol_count)(e),_ts_language_state_count=Module._ts_language_state_count=e=>(_ts_language_state_count=Module._ts_language_state_count=wasmExports.ts_language_state_count)(e),_ts_language_version=Module._ts_language_version=e=>(_ts_language_version=Module._ts_language_version=wasmExports.ts_language_version)(e),_ts_language_field_count=Module._ts_language_field_count=e=>(_ts_language_field_count=Module._ts_language_field_count=wasmExports.ts_language_field_count)(e),_ts_language_next_state=Module._ts_language_next_state=(e,t,r)=>(_ts_language_next_state=Module._ts_language_next_state=wasmExports.ts_language_next_state)(e,t,r),_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,r,n)=>(_ts_language_symbol_for_name=Module._ts_language_symbol_for_name=wasmExports.ts_language_symbol_for_name)(e,t,r,n),_strncmp=Module._strncmp=(e,t,r)=>(_strncmp=Module._strncmp=wasmExports.strncmp)(e,t,r),_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,r)=>(_ts_lookahead_iterator_reset=Module._ts_lookahead_iterator_reset=wasmExports.ts_lookahead_iterator_reset)(e,t,r),_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,r)=>(_memset=Module._memset=wasmExports.memset)(e,t,r),_memcpy=Module._memcpy=(e,t,r)=>(_memcpy=Module._memcpy=wasmExports.memcpy)(e,t,r),_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,r)=>(_ts_parser_set_timeout_micros=Module._ts_parser_set_timeout_micros=wasmExports.ts_parser_set_timeout_micros)(e,t,r),_ts_parser_set_included_ranges=Module._ts_parser_set_included_ranges=(e,t,r)=>(_ts_parser_set_included_ranges=Module._ts_parser_set_included_ranges=wasmExports.ts_parser_set_included_ranges)(e,t,r),_memmove=Module._memmove=(e,t,r)=>(_memmove=Module._memmove=wasmExports.memmove)(e,t,r),_memcmp=Module._memcmp=(e,t,r)=>(_memcmp=Module._memcmp=wasmExports.memcmp)(e,t,r),_ts_query_new=Module._ts_query_new=(e,t,r,n,s)=>(_ts_query_new=Module._ts_query_new=wasmExports.ts_query_new)(e,t,r,n,s),_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,r)=>(_ts_query_capture_name_for_id=Module._ts_query_capture_name_for_id=wasmExports.ts_query_capture_name_for_id)(e,t,r),_ts_query_string_value_for_id=Module._ts_query_string_value_for_id=(e,t,r)=>(_ts_query_string_value_for_id=Module._ts_query_string_value_for_id=wasmExports.ts_query_string_value_for_id)(e,t,r),_ts_query_predicates_for_pattern=Module._ts_query_predicates_for_pattern=(e,t,r)=>(_ts_query_predicates_for_pattern=Module._ts_query_predicates_for_pattern=wasmExports.ts_query_predicates_for_pattern)(e,t,r),_ts_query_disable_capture=Module._ts_query_disable_capture=(e,t,r)=>(_ts_query_disable_capture=Module._ts_query_disable_capture=wasmExports.ts_query_disable_capture)(e,t,r),_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,r,n,s)=>(_ts_parser_parse_wasm=Module._ts_parser_parse_wasm=wasmExports.ts_parser_parse_wasm)(e,t,r,n,s),_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,r,n,s,o,a)=>(_ts_node_descendants_of_type_wasm=Module._ts_node_descendants_of_type_wasm=wasmExports.ts_node_descendants_of_type_wasm)(e,t,r,n,s,o,a),_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,r,n,s,o,a,_,d,l)=>(_ts_query_matches_wasm=Module._ts_query_matches_wasm=wasmExports.ts_query_matches_wasm)(e,t,r,n,s,o,a,_,d,l),_ts_query_captures_wasm=Module._ts_query_captures_wasm=(e,t,r,n,s,o,a,_,d,l)=>(_ts_query_captures_wasm=Module._ts_query_captures_wasm=wasmExports.ts_query_captures_wasm)(e,t,r,n,s,o,a,_,d,l),_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,r)=>(_memchr=Module._memchr=wasmExports.memchr)(e,t,r),_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,r)=>(_strncat=Module._strncat=wasmExports.strncat)(e,t,r),_strncpy=Module._strncpy=(e,t,r)=>(_strncpy=Module._strncpy=wasmExports.strncpy)(e,t,r),_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),__emscripten_stack_restore=e=>(__emscripten_stack_restore=wasmExports._emscripten_stack_restore)(e),__emscripten_stack_alloc=e=>(__emscripten_stack_alloc=wasmExports._emscripten_stack_alloc)(e),_emscripten_stack_get_current=()=>(_emscripten_stack_get_current=wasmExports.emscripten_stack_get_current)(),dynCall_jiji=Module.dynCall_jiji=(e,t,r,n,s)=>(dynCall_jiji=Module.dynCall_jiji=wasmExports.dynCall_jiji)(e,t,r,n,s),_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);Module.AsciiToString=AsciiToString,Module.stringToUTF16=stringToUTF16;var calledRun;dependenciesFulfilled=function e(){calledRun||run(),calledRun||(dependenciesFulfilled=e)};function callMain(e=[]){var t=resolveGlobalSymbol("main").sym;if(t){e.unshift(thisProgram);var r=e.length,n=stackAlloc((r+1)*4),s=n;e.forEach(a=>{LE_HEAP_STORE_U32((s>>2)*4,stringToUTF8OnStack(a)),s+=4}),LE_HEAP_STORE_U32((s>>2)*4,0);try{var o=t(r,n);return exitJS(o,!0),o}catch(a){return handleException(a)}}}function run(e=arguments_){if(runDependencies>0||(preRun(),runDependencies>0))return;function t(){calledRun||(calledRun=!0,Module.calledRun=!0,!ABORT&&(initRuntime(),preMain(),Module.onRuntimeInitialized?.(),shouldRunNow&&callMain(e),postRun()))}Module.setStatus?(Module.setStatus("Running..."),setTimeout(function(){setTimeout(function(){Module.setStatus("")},1),t()},1)):t()}if(Module.preInit)for(typeof Module.preInit=="function"&&(Module.preInit=[Module.preInit]);Module.preInit.length>0;)Module.preInit.pop()();var shouldRunNow=!0;Module.noInitialRun&&(shouldRunNow=!1),run();let C=Module,INTERNAL={},SIZE_OF_INT=4,SIZE_OF_CURSOR=4*SIZE_OF_INT,SIZE_OF_NODE=5*SIZE_OF_INT,SIZE_OF_POINT=2*SIZE_OF_INT,SIZE_OF_RANGE=2*SIZE_OF_INT+2*SIZE_OF_POINT,ZERO_POINT={row:0,column:0},QUERY_WORD_REGEX=/[\w-.]*/g,PREDICATE_STEP_TYPE_CAPTURE=1,PREDICATE_STEP_TYPE_STRING=2,LANGUAGE_FUNCTION_REGEX=/^_?tree_sitter_\w+/,VERSION,MIN_COMPATIBLE_VERSION,TRANSFER_BUFFER,currentParseCallback,currentLogCallback;class ParserImpl{static init(){TRANSFER_BUFFER=C._ts_init(),VERSION=getValue(TRANSFER_BUFFER,"i32"),MIN_COMPATIBLE_VERSION=getValue(TRANSFER_BUFFER+SIZE_OF_INT,"i32")}initialize(){C._ts_parser_new_wasm(),this[0]=getValue(TRANSFER_BUFFER,"i32"),this[1]=getValue(TRANSFER_BUFFER+SIZE_OF_INT,"i32")}delete(){C._ts_parser_delete(this[0]),C._free(this[1]),this[0]=0,this[1]=0}setLanguage(t){let r;if(!t)r=0,t=null;else if(t.constructor===Language){r=t[0];let n=C._ts_language_version(r);if(nt.slice(d);else if(typeof t=="function")currentParseCallback=t;else throw new Error("Argument must be a string or a function");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));let s=0,o=0;if(n?.includedRanges){s=n.includedRanges.length,o=C._calloc(s,SIZE_OF_RANGE);let d=o;for(let l=0;l0){let s=r;for(let o=0;o0){let o=n;for(let a=0;a0){let s=r;for(let o=0;o0){let o=n;for(let a=0;a0){let n=r;for(let s=0;s0){let n=r;for(let s=0;s0){let u=d;for(let c=0;c<_;c++)l[c]=unmarshalNode(this.tree,u),u+=SIZE_OF_NODE}return C._free(d),C._free(a),l}get nextSibling(){return marshalNode(this),C._ts_node_next_sibling_wasm(this.tree[0]),unmarshalNode(this.tree)}get previousSibling(){return marshalNode(this),C._ts_node_prev_sibling_wasm(this.tree[0]),unmarshalNode(this.tree)}get nextNamedSibling(){return marshalNode(this),C._ts_node_next_named_sibling_wasm(this.tree[0]),unmarshalNode(this.tree)}get previousNamedSibling(){return marshalNode(this),C._ts_node_prev_named_sibling_wasm(this.tree[0]),unmarshalNode(this.tree)}get descendantCount(){return marshalNode(this),C._ts_node_descendant_count_wasm(this.tree[0])}get parent(){return marshalNode(this),C._ts_node_parent_wasm(this.tree[0]),unmarshalNode(this.tree)}descendantForIndex(t,r=t){if(typeof t!="number"||typeof r!="number")throw new Error("Arguments must be numbers");marshalNode(this);let n=TRANSFER_BUFFER+SIZE_OF_NODE;return setValue(n,t,"i32"),setValue(n+SIZE_OF_INT,r,"i32"),C._ts_node_descendant_for_index_wasm(this.tree[0]),unmarshalNode(this.tree)}namedDescendantForIndex(t,r=t){if(typeof t!="number"||typeof r!="number")throw new Error("Arguments must be numbers");marshalNode(this);let n=TRANSFER_BUFFER+SIZE_OF_NODE;return setValue(n,t,"i32"),setValue(n+SIZE_OF_INT,r,"i32"),C._ts_node_named_descendant_for_index_wasm(this.tree[0]),unmarshalNode(this.tree)}descendantForPosition(t,r=t){if(!isPoint(t)||!isPoint(r))throw new Error("Arguments must be {row, column} objects");marshalNode(this);let n=TRANSFER_BUFFER+SIZE_OF_NODE;return marshalPoint(n,t),marshalPoint(n+SIZE_OF_POINT,r),C._ts_node_descendant_for_position_wasm(this.tree[0]),unmarshalNode(this.tree)}namedDescendantForPosition(t,r=t){if(!isPoint(t)||!isPoint(r))throw new Error("Arguments must be {row, column} objects");marshalNode(this);let n=TRANSFER_BUFFER+SIZE_OF_NODE;return marshalPoint(n,t),marshalPoint(n+SIZE_OF_POINT,r),C._ts_node_named_descendant_for_position_wasm(this.tree[0]),unmarshalNode(this.tree)}walk(){return marshalNode(this),C._ts_tree_cursor_new_wasm(this.tree[0]),new TreeCursor(INTERNAL,this.tree)}toString(){marshalNode(this);let t=C._ts_node_to_string_wasm(this.tree[0]),r=AsciiToString(t);return C._free(t),r}}class TreeCursor{constructor(t,r){assertInternal(t),this.tree=r,unmarshalTreeCursor(this)}delete(){marshalTreeCursor(this),C._ts_tree_cursor_delete_wasm(this.tree[0]),this[0]=this[1]=this[2]=0}reset(t){marshalNode(t),marshalTreeCursor(this,TRANSFER_BUFFER+SIZE_OF_NODE),C._ts_tree_cursor_reset_wasm(this.tree[0]),unmarshalTreeCursor(this)}resetTo(t){marshalTreeCursor(this,TRANSFER_BUFFER),marshalTreeCursor(t,TRANSFER_BUFFER+SIZE_OF_CURSOR),C._ts_tree_cursor_reset_to_wasm(this.tree[0],t.tree[0]),unmarshalTreeCursor(this)}get nodeType(){return this.tree.language.types[this.nodeTypeId]||"ERROR"}get nodeTypeId(){return marshalTreeCursor(this),C._ts_tree_cursor_current_node_type_id_wasm(this.tree[0])}get nodeStateId(){return marshalTreeCursor(this),C._ts_tree_cursor_current_node_state_id_wasm(this.tree[0])}get nodeId(){return marshalTreeCursor(this),C._ts_tree_cursor_current_node_id_wasm(this.tree[0])}get nodeIsNamed(){return marshalTreeCursor(this),C._ts_tree_cursor_current_node_is_named_wasm(this.tree[0])===1}get nodeIsMissing(){return marshalTreeCursor(this),C._ts_tree_cursor_current_node_is_missing_wasm(this.tree[0])===1}get nodeText(){marshalTreeCursor(this);let t=C._ts_tree_cursor_start_index_wasm(this.tree[0]),r=C._ts_tree_cursor_end_index_wasm(this.tree[0]);return getText(this.tree,t,r)}get startPosition(){return marshalTreeCursor(this),C._ts_tree_cursor_start_position_wasm(this.tree[0]),unmarshalPoint(TRANSFER_BUFFER)}get endPosition(){return marshalTreeCursor(this),C._ts_tree_cursor_end_position_wasm(this.tree[0]),unmarshalPoint(TRANSFER_BUFFER)}get startIndex(){return marshalTreeCursor(this),C._ts_tree_cursor_start_index_wasm(this.tree[0])}get endIndex(){return marshalTreeCursor(this),C._ts_tree_cursor_end_index_wasm(this.tree[0])}get currentNode(){return marshalTreeCursor(this),C._ts_tree_cursor_current_node_wasm(this.tree[0]),unmarshalNode(this.tree)}get currentFieldId(){return marshalTreeCursor(this),C._ts_tree_cursor_current_field_id_wasm(this.tree[0])}get currentFieldName(){return this.tree.language.fields[this.currentFieldId]}get currentDepth(){return marshalTreeCursor(this),C._ts_tree_cursor_current_depth_wasm(this.tree[0])}get currentDescendantIndex(){return marshalTreeCursor(this),C._ts_tree_cursor_current_descendant_index_wasm(this.tree[0])}gotoFirstChild(){marshalTreeCursor(this);let t=C._ts_tree_cursor_goto_first_child_wasm(this.tree[0]);return unmarshalTreeCursor(this),t===1}gotoLastChild(){marshalTreeCursor(this);let t=C._ts_tree_cursor_goto_last_child_wasm(this.tree[0]);return unmarshalTreeCursor(this),t===1}gotoFirstChildForIndex(t){marshalTreeCursor(this),setValue(TRANSFER_BUFFER+SIZE_OF_CURSOR,t,"i32");let r=C._ts_tree_cursor_goto_first_child_for_index_wasm(this.tree[0]);return unmarshalTreeCursor(this),r===1}gotoFirstChildForPosition(t){marshalTreeCursor(this),marshalPoint(TRANSFER_BUFFER+SIZE_OF_CURSOR,t);let r=C._ts_tree_cursor_goto_first_child_for_position_wasm(this.tree[0]);return unmarshalTreeCursor(this),r===1}gotoNextSibling(){marshalTreeCursor(this);let t=C._ts_tree_cursor_goto_next_sibling_wasm(this.tree[0]);return unmarshalTreeCursor(this),t===1}gotoPreviousSibling(){marshalTreeCursor(this);let t=C._ts_tree_cursor_goto_previous_sibling_wasm(this.tree[0]);return unmarshalTreeCursor(this),t===1}gotoDescendant(t){marshalTreeCursor(this),C._ts_tree_cursor_goto_descendant_wasm(this.tree[0],t),unmarshalTreeCursor(this)}gotoParent(){marshalTreeCursor(this);let t=C._ts_tree_cursor_goto_parent_wasm(this.tree[0]);return unmarshalTreeCursor(this),t===1}}class Language{constructor(t,r){assertInternal(t),this[0]=r,this.types=new Array(C._ts_language_symbol_count(this[0]));for(let n=0,s=this.types.length;n0){if(f[0].type!=="string")throw new Error("Predicates must begin with a literal value");let M=f[0].value,$=!0,Y=!0,Z;switch(M){case"any-not-eq?":case"not-eq?":$=!1;case"any-eq?":case"eq?":if(f.length!==3)throw new Error(`Wrong number of arguments to \`#${M}\` predicate. Expected 2, got ${f.length-1}`);if(f[1].type!=="capture")throw new Error(`First argument of \`#${M}\` predicate must be a capture. Got "${f[1].value}"`);if(Y=!M.startsWith("any-"),f[2].type==="capture"){let I=f[1].name,k=f[2].name;x[p].push(H=>{let N=[],X=[];for(let L of H)L.name===I&&N.push(L.node),L.name===k&&X.push(L.node);let pe=(L,ue,Jt)=>Jt?L.text===ue.text:L.text!==ue.text;return Y?N.every(L=>X.some(ue=>pe(L,ue,$))):N.some(L=>X.some(ue=>pe(L,ue,$)))})}else{Z=f[1].name;let I=f[2].value,k=N=>N.text===I,H=N=>N.text!==I;x[p].push(N=>{let X=[];for(let L of N)L.name===Z&&X.push(L.node);let pe=$?k:H;return Y?X.every(pe):X.some(pe)})}break;case"any-not-match?":case"not-match?":$=!1;case"any-match?":case"match?":if(f.length!==3)throw new Error(`Wrong number of arguments to \`#${M}\` predicate. Expected 2, got ${f.length-1}.`);if(f[1].type!=="capture")throw new Error(`First argument of \`#${M}\` predicate must be a capture. Got "${f[1].value}".`);if(f[2].type!=="string")throw new Error(`Second argument of \`#${M}\` predicate must be a string. Got @${f[2].value}.`);Z=f[1].name;let ce=new RegExp(f[2].value);Y=!M.startsWith("any-"),x[p].push(I=>{let k=[];for(let N of I)N.name===Z&&k.push(N.node.text);let H=(N,X)=>X?ce.test(N):!ce.test(N);return k.length===0?!$:Y?k.every(N=>H(N,$)):k.some(N=>H(N,$))});break;case"set!":if(f.length<2||f.length>3)throw new Error(`Wrong number of arguments to \`#set!\` predicate. Expected 1 or 2. Got ${f.length-1}.`);if(f.some(I=>I.type!=="string"))throw new Error('Arguments to `#set!` predicate must be a strings.".');u[p]||(u[p]={}),u[p][f[1].value]=f[2]?f[2].value:null;break;case"is?":case"is-not?":if(f.length<2||f.length>3)throw new Error(`Wrong number of arguments to \`#${M}\` predicate. Expected 1 or 2. Got ${f.length-1}.`);if(f.some(I=>I.type!=="string"))throw new Error(`Arguments to \`#${M}\` predicate must be a strings.".`);let Ie=M==="is?"?c:m;Ie[p]||(Ie[p]={}),Ie[p][f[1].value]=f[2]?f[2].value:null;break;case"not-any-of?":$=!1;case"any-of?":if(f.length<2)throw new Error(`Wrong number of arguments to \`#${M}\` predicate. Expected at least 1. Got ${f.length-1}.`);if(f[1].type!=="capture")throw new Error(`First argument of \`#${M}\` predicate must be a capture. Got "${f[1].value}".`);for(let I=2;II.value);x[p].push(I=>{let k=[];for(let H of I)H.name===Z&&k.push(H.node.text);return k.length===0?!$:k.every(H=>Q.includes(H))===$});break;default:w[p].push({operator:M,operands:f.slice(1)})}f.length=0}}Object.freeze(u[p]),Object.freeze(c[p]),Object.freeze(m[p])}return C._free(n),new Query(INTERNAL,s,d,x,w,Object.freeze(u),Object.freeze(c),Object.freeze(m))}static load(t){let r;if(t instanceof Uint8Array)r=Promise.resolve(t);else{let n=t;if(typeof process<"u"&&process.versions&&process.versions.node){let s=require("fs");r=Promise.resolve(s.readFileSync(n))}else r=fetch(n).then(s=>s.arrayBuffer().then(o=>{if(s.ok)return new Uint8Array(o);{let a=new TextDecoder("utf-8").decode(o);throw new Error(`Language.load failed with status ${s.status}. ${a}`)}}))}return r.then(n=>loadWebAssemblyModule(n,{loadAsync:!0})).then(n=>{let s=Object.keys(n),o=s.find(_=>LANGUAGE_FUNCTION_REGEX.test(_)&&!_.includes("external_scanner_"));o||console.log(`Couldn't find language function in WASM file. Symbols: ${JSON.stringify(s,null,2)}`);let a=n[o]();return new Language(INTERNAL,a)})}}class LookaheadIterable{constructor(t,r,n){assertInternal(t),this[0]=r,this.language=n}get currentTypeId(){return C._ts_lookahead_iterator_current_symbol(this[0])}get currentType(){return this.language.types[this.currentTypeId]||"ERROR"}delete(){C._ts_lookahead_iterator_delete(this[0]),this[0]=0}resetState(t){return C._ts_lookahead_iterator_reset_state(this[0],t)}reset(t,r){return C._ts_lookahead_iterator_reset(this[0],t[0],r)?(this.language=t,!0):!1}[Symbol.iterator](){let t=this;return{next(){return C._ts_lookahead_iterator_next(t[0])?{done:!1,value:t.currentType}:{done:!0,value:""}}}}}class Query{constructor(t,r,n,s,o,a,_,d){assertInternal(t),this[0]=r,this.captureNames=n,this.textPredicates=s,this.predicates=o,this.setProperties=a,this.assertedProperties=_,this.refutedProperties=d,this.exceededMatchLimit=!1}delete(){C._ts_query_delete(this[0]),this[0]=0}matches(t,{startPosition:r=ZERO_POINT,endPosition:n=ZERO_POINT,startIndex:s=0,endIndex:o=0,matchLimit:a=4294967295,maxStartDepth:_=4294967295}={}){if(typeof a!="number")throw new Error("Arguments must be numbers");marshalNode(t),C._ts_query_matches_wasm(this[0],t.tree[0],r.row,r.column,n.row,n.column,s,o,a,_);let d=getValue(TRANSFER_BUFFER,"i32"),l=getValue(TRANSFER_BUFFER+SIZE_OF_INT,"i32"),u=getValue(TRANSFER_BUFFER+2*SIZE_OF_INT,"i32"),c=new Array(d);this.exceededMatchLimit=!!u;let m=0,w=l;for(let x=0;xf(T))){c[m]={pattern:p,captures:T};let f=this.setProperties[p];f&&(c[m].setProperties=f);let g=this.assertedProperties[p];g&&(c[m].assertedProperties=g);let S=this.refutedProperties[p];S&&(c[m].refutedProperties=S),m++}}return c.length=m,C._free(l),c}captures(t,{startPosition:r=ZERO_POINT,endPosition:n=ZERO_POINT,startIndex:s=0,endIndex:o=0,matchLimit:a=4294967295,maxStartDepth:_=4294967295}={}){if(typeof a!="number")throw new Error("Arguments must be numbers");marshalNode(t),C._ts_query_captures_wasm(this[0],t.tree[0],r.row,r.column,n.row,n.column,s,o,a,_);let d=getValue(TRANSFER_BUFFER,"i32"),l=getValue(TRANSFER_BUFFER+SIZE_OF_INT,"i32"),u=getValue(TRANSFER_BUFFER+2*SIZE_OF_INT,"i32"),c=[];this.exceededMatchLimit=!!u;let m=[],w=l;for(let x=0;xf(m))){let f=m[T],g=this.setProperties[p];g&&(f.setProperties=g);let S=this.assertedProperties[p];S&&(f.assertedProperties=S);let G=this.refutedProperties[p];G&&(f.refutedProperties=G),c.push(f)}}return C._free(l),c}predicatesForPattern(t){return this.predicates[t]}disableCapture(t){let r=lengthBytesUTF8(t),n=C._malloc(r+1);stringToUTF8(t,n,r+1),C._ts_query_disable_capture(this[0],n,r),C._free(n)}didExceedMatchLimit(){return this.exceededMatchLimit}}function getText(e,t,r){let n=r-t,s=e.textCallback(t,null,r);for(t+=s.length;t0)t+=o.length,s+=o;else break}return t>r&&(s=s.slice(0,n)),s}function unmarshalCaptures(e,t,r,n){for(let s=0,o=n.length;s>>0,column:getValue(e+SIZE_OF_INT,"i32")>>>0}}function marshalRange(e,t){marshalPoint(e,t.startPosition),e+=SIZE_OF_POINT,marshalPoint(e,t.endPosition),e+=SIZE_OF_POINT,setValue(e,t.startIndex,"i32"),e+=SIZE_OF_INT,setValue(e,t.endIndex,"i32"),e+=SIZE_OF_INT}function unmarshalRange(e){let t={};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}function marshalEdit(e){let t=TRANSFER_BUFFER;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}for(let e of Object.getOwnPropertyNames(ParserImpl.prototype))Object.defineProperty(Parser.prototype,e,{value:ParserImpl.prototype[e],enumerable:!1,writable:!1});Parser.Language=Language,Module.onRuntimeInitialized=()=>{ParserImpl.init(),resolveInitPromise()}}))}}return Parser}();typeof exports=="object"&&(module.exports=TreeSitter)});var zt=require("worker_threads");var et={};Xt(et,{_dispose:()=>ft,_findLastTest:()=>Bt,_getCallExpressions:()=>Or,_getClassDeclarations:()=>Lr,_getClassReferences:()=>Br,_getCoarseParentScope:()=>Hr,_getDocumentableNodeIfOnIdentifier:()=>Lt,_getFineScopes:()=>Gr,_getFixSelectionOfInterest:()=>jr,_getFunctionBodies:()=>Vr,_getFunctionDefinitions:()=>kr,_getNodeMatchingSelection:()=>le,_getNodeToDocument:()=>kt,_getNodeToExplain:()=>Zr,_getParseErrorCount:()=>sn,_getSemanticChunkNames:()=>qr,_getSemanticChunkTree:()=>$r,_getStructure:()=>nn,_getSymbols:()=>Wr,_getTestableNode:()=>Dt,_getTestableNodes:()=>Ut,_getTypeDeclarations:()=>Dr,_getTypeReferences:()=>Ur,getBlockNameTree:()=>Zt});function tt(e,t,r){let n=0,s=e.length;for(;n>>1;r(e[o],t)?n=o+1:s=o}return n}function rt(e,t){if(e.length===0)return;let r=e[0];for(let n=1;n0&&(r=s)}return r}var Be=class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(t){setTimeout(()=>{throw t.stack?Ae.isErrorNoTelemetry(t)?new Ae(t.message+` `+t.stack):new Error(t.message+` `+t.stack):t},0)}}addListener(t){return this.listeners.push(t),()=>{this._removeListener(t)}}emit(t){this.listeners.forEach(r=>{r(t)})}_removeListener(t){this.listeners.splice(this.listeners.indexOf(t),1)}setUnexpectedErrorHandler(t){this.unexpectedErrorHandler=t}getUnexpectedErrorHandler(){return this.unexpectedErrorHandler}onUnexpectedError(t){this.unexpectedErrorHandler(t),this.emit(t)}onUnexpectedExternalError(t){this.unexpectedErrorHandler(t)}},dn=new Be;var nt=class e extends Error{static{this._name="PendingMigrationError"}static is(t){return t instanceof e||t instanceof Error&&t.name===e._name}constructor(t){super(t),this.name=e._name}};var Ae=class e extends Error{constructor(t){super(t),this.name="CodeExpectedError"}static fromError(t){if(t instanceof e)return t;let r=new e;return r.message=t.message,r.stack=t.stack,r}static isErrorNoTelemetry(t){return t.name==="CodeExpectedError"}},ae=class e extends Error{constructor(t){super(t||"An unexpected bug occurred."),Object.setPrototypeOf(this,e.prototype)}};var b={doesContain:(e,t)=>e.startIndex<=t.startIndex&&t.endIndex<=e.endIndex,ofSyntaxNode:e=>({startIndex:e.startIndex,endIndex:e.endIndex}),compare:(e,t)=>e.startIndex-t.startIndex||t.endIndex-e.endIndex,isEqual:(e,t)=>b.compare(e,t)===0,doIntersect:(e,t)=>{let r=Math.max(e.startIndex,t.startIndex),n=Math.min(e.endIndex,t.endIndex);return re.endIndex-e.startIndex,intersectionSize:(e,t)=>{let r=Math.max(e.startIndex,t.startIndex),n=Math.min(e.endIndex,t.endIndex);return Math.max(n-r,0)},isTreeSitterOffsetRange(e){return typeof e.startIndex=="number"&&typeof e.endIndex=="number"}},j={isEqual(e,t){return e.row===t.row&&e.column===t.column},isBefore(e,t){return e.row({row:e.row,column:e.column})},se={doesContain:(e,t)=>j.isBeforeOrEqual(e.startPosition,t.startPosition)&&j.isAfterOrEqual(e.endPosition,t.endPosition),equals:(e,t)=>j.equals(e.startPosition,t.startPosition)&&j.equals(e.endPosition,t.endPosition),ofSyntaxNode:e=>({startPosition:e.startPosition,endPosition:e.endPosition})},oe={ofSyntaxNode:e=>({type:e.type,startIndex:e.startIndex,endIndex:e.endIndex})},D={ofSyntaxNode:e=>({range:se.ofSyntaxNode(e),startIndex:e.startIndex,text:e.text,endIndex:e.endIndex})},ge=class{constructor(t,r,n,s){this.startIndex=t;this.endIndex=r;this.kind=n;this.children=s;if(t>r)throw new ae("startIndex must be less than endIndex");let o=t;for(let a of s){if(a.startIndexr)throw new ae("Invalid child endIndex");o=Math.max(a.endIndex,o)}}toString(){let t=[];function r(n,s=""){t.push(`${s}${n.kind} [${n.startIndex}, ${n.endIndex}]`),n.children.forEach(o=>r(o,s+" "))}return r(this),t.join(` `)}};var he=class{constructor(t,r){this.syntaxTreeRoot=r;this.roots=[];this.formTree(t)}formTree(t){t.sort((o,a)=>o.mainBlock.startIndex-a.mainBlock.startIndex||o.mainBlock.endIndex-a.mainBlock.endIndex);let r=[],n=()=>r[r.length-1],s=(o,a)=>o.mainBlock.startIndex===a.mainBlock.startIndex&&o.mainBlock.endIndex===a.mainBlock.endIndex;for(let o of t){let a={info:o,children:[]},_=n();if(!_){this.roots.push(a),r.push(a);continue}if(!s(_.info,o)){for(;_&&!b.doesContain(_.info.mainBlock,o.mainBlock);)r.pop(),_=n();_?_.children.push(a):this.roots.push(a),r.push(a)}}}};var ye=class{constructor(t,r){this.prev=null;this.next=null;this.key=t,this.value=r}},me=class{constructor(t=10){if(t<1)throw new Error("Cache size must be at least 1");this._capacity=t,this._cache=new Map,this._head=new ye("",null),this._tail=new ye("",null),this._head.next=this._tail,this._tail.prev=this._head}_addNode(t){t.prev=this._head,t.next=this._head.next,this._head.next.prev=t,this._head.next=t}_removeNode(t){let r=t.prev,n=t.next;r.next=n,n.prev=r}_moveToHead(t){this._removeNode(t),this._addNode(t)}_popTail(){let t=this._tail.prev;return this._removeNode(t),t}clear(){this._cache.clear(),this._head.next=this._tail,this._tail.prev=this._head}deleteKey(t){let r=this._cache.get(t);if(r)return this._removeNode(r),this._cache.delete(t),r.value}get(t){let r=this._cache.get(t);if(r)return this._moveToHead(r),r.value}keys(){let t=[],r=this._head.next;for(;r!==this._tail;)t.push(r.key),r=r.next;return t}getValues(){let t=[],r=this._head.next;for(;r!==this._tail;)t.push(r.value),r=r.next;return t}put(t,r){let n=this._cache.get(t);if(n)n.value=r,this._moveToHead(n);else if(n=new ye(t,r),this._cache.set(t,n),this._addNode(n),this._cache.size>this._capacity){let s=this._popTail();return this._cache.delete(s.key),[s.key,s.value]}}entries(){let t=[],r=this._head.next;for(;r!==this._tail;)t.push([r.key,r.value]),r=r.next;return t}},Me=class{constructor(t){this.actual=new me(t)}dispose(){this.clear()}clear(){let t=this.actual.getValues();for(let r of t)r.dispose();this.actual.clear()}deleteKey(t){let r=this.actual.deleteKey(t);r&&r.dispose()}get(t){return this.actual.get(t)}keys(){return this.actual.keys()}getValues(){return this.actual.getValues()}put(t,r){let n=this.actual.put(t,r);n&&n[1].dispose()}};function We(){return globalThis._VSCODE_NLS_LANGUAGE}var hn=We()==="pseudo"||typeof document<"u"&&document.location&&typeof document.location.hash=="string"&&document.location.hash.indexOf("pseudo=true")>=0;var fe="en",Pe=!1,Fe=!1,Ce=!1,tr=!1,rr=!1,ot=!1,nr=!1,sr=!1,or=!1,ir=!1,Re,Ne=fe,st=fe,ar,ee,te=globalThis,U;typeof te.vscode<"u"&&typeof te.vscode.process<"u"?U=te.vscode.process:typeof process<"u"&&typeof process?.versions?.node=="string"&&(U=process);var it=typeof U?.versions?.electron=="string",_r=it&&U?.type==="renderer";if(typeof U=="object"){Pe=U.platform==="win32",Fe=U.platform==="darwin",Ce=U.platform==="linux",tr=Ce&&!!U.env.SNAP&&!!U.env.SNAP_REVISION,nr=it,or=!!U.env.CI||!!U.env.BUILD_ARTIFACTSTAGINGDIRECTORY||!!U.env.GITHUB_WORKSPACE,Re=fe,Ne=fe;let e=U.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);Re=t.userLocale,st=t.osLocale,Ne=t.resolvedLanguage||fe,ar=t.languagePack?.translationsConfigFile}catch{}rr=!0}else typeof navigator=="object"&&!_r?(ee=navigator.userAgent,Pe=ee.indexOf("Windows")>=0,Fe=ee.indexOf("Macintosh")>=0,sr=(ee.indexOf("Macintosh")>=0||ee.indexOf("iPad")>=0||ee.indexOf("iPhone")>=0)&&!!navigator.maxTouchPoints&&navigator.maxTouchPoints>0,Ce=ee.indexOf("Linux")>=0,ir=ee?.indexOf("Mobi")>=0,ot=!0,Ne=We()||fe,Re=navigator.language.toLowerCase(),st=Re):console.error("Unable to resolve platform.");var $e=0;Fe?$e=1:Pe?$e=3:Ce&&($e=2);var at=Pe,_t=Fe;var dr=ot&&typeof te.importScripts=="function",yn=dr?te.origin:void 0;var z=ee,ie=Ne,lr;(n=>{function e(){return ie}n.value=e;function t(){return ie.length===2?ie==="en":ie.length>=3?ie[0]==="e"&&ie[1]==="n"&&ie[2]==="-":!1}n.isDefaultVariant=t;function r(){return ie==="en"}n.isDefault=r})(lr||={});var cr=typeof te.postMessage=="function"&&!te.importScripts,wn=(()=>{if(cr){let e=[];te.addEventListener("message",r=>{if(r.data&&r.data.vscodeScheduleAsyncWork)for(let n=0,s=e.length;n{let n=++t;e.push({id:n,callback:r}),te.postMessage({vscodeScheduleAsyncWork:n},"*")}}return e=>setTimeout(e)})();var ur=!!(z&&z.indexOf("Chrome")>=0),xn=!!(z&&z.indexOf("Firefox")>=0),Tn=!!(!ur&&z&&z.indexOf("Safari")>=0),bn=!!(z&&z.indexOf("Edg/")>=0),En=!!(z&&z.indexOf("Android")>=0);var _e,qe=globalThis.vscode;if(typeof qe<"u"&&typeof qe.process<"u"){let e=qe.process;_e={get platform(){return e.platform},get arch(){return e.arch},get env(){return e.env},cwd(){return e.cwd()}}}else typeof process<"u"&&typeof process?.versions?.node=="string"?_e={get platform(){return process.platform},get arch(){return process.arch},get env(){return process.env},cwd(){return process.env.VSCODE_CWD||process.cwd()}}:_e={get platform(){return at?"win32":_t?"darwin":"linux"},get arch(){},get env(){return{}},cwd(){return"/"}};var we=_e.cwd,dt=_e.env,lt=_e.platform,An=_e.arch;var fr=65,pr=97,gr=90,hr=122,de=46,F=47,B=92,re=58,yr=63,Oe=class extends Error{constructor(t,r,n){let s;typeof r=="string"&&r.indexOf("not ")===0?(s="must not be",r=r.replace(/^not /,"")):s="must be";let o=t.indexOf(".")!==-1?"property":"argument",a=`The "${t}" ${o} ${s} of type ${r}`;a+=`. Received type ${typeof n}`,super(a),this.code="ERR_INVALID_ARG_TYPE"}};function wr(e,t){if(e===null||typeof e!="object")throw new Oe(t,"Object",e)}function A(e,t){if(typeof e!="string")throw new Oe(t,"string",e)}var W=lt==="win32";function h(e){return e===F||e===B}function Ve(e){return e===F}function ne(e){return e>=fr&&e<=gr||e>=pr&&e<=hr}function ke(e,t,r,n){let s="",o=0,a=-1,_=0,d=0;for(let l=0;l<=e.length;++l){if(l2){let u=s.lastIndexOf(r);u===-1?(s="",o=0):(s=s.slice(0,u),o=s.length-1-s.lastIndexOf(r)),a=l,_=0;continue}else if(s.length!==0){s="",o=0,a=l,_=0;continue}}t&&(s+=s.length>0?`${r}..`:"..",o=2)}else s.length>0?s+=`${r}${e.slice(a+1,l)}`:s=e.slice(a+1,l),o=l-a-1;a=l,_=0}else d===de&&_!==-1?++_:_=-1}return s}function xr(e){return e?`${e[0]==="."?"":"."}${e}`:""}function ct(e,t){wr(t,"pathObject");let r=t.dir||t.root,n=t.base||`${t.name||""}${xr(t.ext)}`;return r?r===t.root?`${r}${n}`:`${r}${e}${n}`:n}var R={resolve(...e){let t="",r="",n=!1;for(let s=e.length-1;s>=-1;s--){let o;if(s>=0){if(o=e[s],A(o,`paths[${s}]`),o.length===0)continue}else t.length===0?o=we():(o=dt[`=${t}`]||we(),(o===void 0||o.slice(0,2).toLowerCase()!==t.toLowerCase()&&o.charCodeAt(2)===B)&&(o=`${t}\\`));let a=o.length,_=0,d="",l=!1,u=o.charCodeAt(0);if(a===1)h(u)&&(_=1,l=!0);else if(h(u))if(l=!0,h(o.charCodeAt(1))){let c=2,m=c;for(;c2&&h(o.charCodeAt(2))&&(l=!0,_=3));if(d.length>0)if(t.length>0){if(d.toLowerCase()!==t.toLowerCase())continue}else t=d;if(n){if(t.length>0)break}else if(r=`${o.slice(_)}\\${r}`,n=l,l&&t.length>0)break}return r=ke(r,!n,"\\",h),n?`${t}\\${r}`:`${t}${r}`||"."},normalize(e){A(e,"path");let t=e.length;if(t===0)return".";let r=0,n,s=!1,o=e.charCodeAt(0);if(t===1)return Ve(o)?"\\":e;if(h(o))if(s=!0,h(e.charCodeAt(1))){let _=2,d=_;for(;_2&&h(e.charCodeAt(2))&&(s=!0,r=3));let a=r0&&h(e.charCodeAt(t-1))&&(a+="\\"),!s&&n===void 0&&e.includes(":")){if(a.length>=2&&ne(a.charCodeAt(0))&&a.charCodeAt(1)===re)return`.\\${a}`;let _=e.indexOf(":");do if(_===t-1||h(e.charCodeAt(_+1)))return`.\\${a}`;while((_=e.indexOf(":",_+1))!==-1)}return n===void 0?s?`\\${a}`:a:s?`${n}\\${a}`:`${n}${a}`},isAbsolute(e){A(e,"path");let t=e.length;if(t===0)return!1;let r=e.charCodeAt(0);return h(r)||t>2&&ne(r)&&e.charCodeAt(1)===re&&h(e.charCodeAt(2))},join(...e){if(e.length===0)return".";let t,r;for(let o=0;o0&&(t===void 0?t=r=a:t+=`\\${a}`)}if(t===void 0)return".";let n=!0,s=0;if(typeof r=="string"&&h(r.charCodeAt(0))){++s;let o=r.length;o>1&&h(r.charCodeAt(1))&&(++s,o>2&&(h(r.charCodeAt(2))?++s:n=!1))}if(n){for(;s=2&&(t=`\\${t.slice(s)}`)}return R.normalize(t)},relative(e,t){if(A(e,"from"),A(t,"to"),e===t)return"";let r=R.resolve(e),n=R.resolve(t);if(r===n||(e=r.toLowerCase(),t=n.toLowerCase(),e===t))return"";if(r.length!==e.length||n.length!==t.length){let x=r.split("\\"),p=n.split("\\");x[x.length-1]===""&&x.pop(),p[p.length-1]===""&&p.pop();let v=x.length,T=p.length,f=vf?p.slice(g).join("\\"):v>f?"..\\".repeat(v-1-g)+"..":"":"..\\".repeat(v-g)+p.slice(g).join("\\")}let s=0;for(;ss&&e.charCodeAt(o-1)===B;)o--;let a=o-s,_=0;for(;__&&t.charCodeAt(d-1)===B;)d--;let l=d-_,u=au){if(t.charCodeAt(_+m)===B)return n.slice(_+m+1);if(m===2)return n.slice(_+m)}a>u&&(e.charCodeAt(s+m)===B?c=m:m===2&&(c=3)),c===-1&&(c=0)}let w="";for(m=s+c+1;m<=o;++m)(m===o||e.charCodeAt(m)===B)&&(w+=w.length===0?"..":"\\..");return _+=c,w.length>0?`${w}${n.slice(_,d)}`:(n.charCodeAt(_)===B&&++_,n.slice(_,d))},toNamespacedPath(e){if(typeof e!="string"||e.length===0)return e;let t=R.resolve(e);if(t.length<=2)return e;if(t.charCodeAt(0)===B){if(t.charCodeAt(1)===B){let r=t.charCodeAt(2);if(r!==yr&&r!==de)return`\\\\?\\UNC\\${t.slice(2)}`}}else if(ne(t.charCodeAt(0))&&t.charCodeAt(1)===re&&t.charCodeAt(2)===B)return`\\\\?\\${t}`;return t},dirname(e){A(e,"path");let t=e.length;if(t===0)return".";let r=-1,n=0,s=e.charCodeAt(0);if(t===1)return h(s)?e:".";if(h(s)){if(r=n=1,h(e.charCodeAt(1))){let _=2,d=_;for(;_2&&h(e.charCodeAt(2))?3:2,n=r);let o=-1,a=!0;for(let _=t-1;_>=n;--_)if(h(e.charCodeAt(_))){if(!a){o=_;break}}else a=!1;if(o===-1){if(r===-1)return".";o=r}return e.slice(0,o)},basename(e,t){t!==void 0&&A(t,"suffix"),A(e,"path");let r=0,n=-1,s=!0,o;if(e.length>=2&&ne(e.charCodeAt(0))&&e.charCodeAt(1)===re&&(r=2),t!==void 0&&t.length>0&&t.length<=e.length){if(t===e)return"";let a=t.length-1,_=-1;for(o=e.length-1;o>=r;--o){let d=e.charCodeAt(o);if(h(d)){if(!s){r=o+1;break}}else _===-1&&(s=!1,_=o+1),a>=0&&(d===t.charCodeAt(a)?--a===-1&&(n=o):(a=-1,n=_))}return r===n?n=_:n===-1&&(n=e.length),e.slice(r,n)}for(o=e.length-1;o>=r;--o)if(h(e.charCodeAt(o))){if(!s){r=o+1;break}}else n===-1&&(s=!1,n=o+1);return n===-1?"":e.slice(r,n)},extname(e){A(e,"path");let t=0,r=-1,n=0,s=-1,o=!0,a=0;e.length>=2&&e.charCodeAt(1)===re&&ne(e.charCodeAt(0))&&(t=n=2);for(let _=e.length-1;_>=t;--_){let d=e.charCodeAt(_);if(h(d)){if(!o){n=_+1;break}continue}s===-1&&(o=!1,s=_+1),d===de?r===-1?r=_:a!==1&&(a=1):r!==-1&&(a=-1)}return r===-1||s===-1||a===0||a===1&&r===s-1&&r===n+1?"":e.slice(r,s)},format:ct.bind(null,"\\"),parse(e){A(e,"path");let t={root:"",dir:"",base:"",ext:"",name:""};if(e.length===0)return t;let r=e.length,n=0,s=e.charCodeAt(0);if(r===1)return h(s)?(t.root=t.dir=e,t):(t.base=t.name=e,t);if(h(s)){if(n=1,h(e.charCodeAt(1))){let c=2,m=c;for(;c0&&(t.root=e.slice(0,n));let o=-1,a=n,_=-1,d=!0,l=e.length-1,u=0;for(;l>=n;--l){if(s=e.charCodeAt(l),h(s)){if(!d){a=l+1;break}continue}_===-1&&(d=!1,_=l+1),s===de?o===-1?o=l:u!==1&&(u=1):o!==-1&&(u=-1)}return _!==-1&&(o===-1||u===0||u===1&&o===_-1&&o===a+1?t.base=t.name=e.slice(a,_):(t.name=e.slice(a,o),t.base=e.slice(a,_),t.ext=e.slice(o,_))),a>0&&a!==n?t.dir=e.slice(0,a-1):t.dir=t.root,t},sep:"\\",delimiter:";",win32:null,posix:null},Tr=(()=>{if(W){let e=/\\/g;return()=>{let t=we().replace(e,"/");return t.slice(t.indexOf("/"))}}return()=>we()})(),P={resolve(...e){let t="",r=!1;for(let n=e.length-1;n>=0&&!r;n--){let s=e[n];A(s,`paths[${n}]`),s.length!==0&&(t=`${s}/${t}`,r=s.charCodeAt(0)===F)}if(!r){let n=Tr();t=`${n}/${t}`,r=n.charCodeAt(0)===F}return t=ke(t,!r,"/",Ve),r?`/${t}`:t.length>0?t:"."},normalize(e){if(A(e,"path"),e.length===0)return".";let t=e.charCodeAt(0)===F,r=e.charCodeAt(e.length-1)===F;return e=ke(e,!t,"/",Ve),e.length===0?t?"/":r?"./":".":(r&&(e+="/"),t?`/${e}`:e)},isAbsolute(e){return A(e,"path"),e.length>0&&e.charCodeAt(0)===F},join(...e){if(e.length===0)return".";let t=[];for(let r=0;r0&&t.push(n)}return t.length===0?".":P.normalize(t.join("/"))},relative(e,t){if(A(e,"from"),A(t,"to"),e===t||(e=P.resolve(e),t=P.resolve(t),e===t))return"";let r=1,n=e.length,s=n-r,o=1,a=t.length-o,_=s_){if(t.charCodeAt(o+l)===F)return t.slice(o+l+1);if(l===0)return t.slice(o+l)}else s>_&&(e.charCodeAt(r+l)===F?d=l:l===0&&(d=0));let u="";for(l=r+d+1;l<=n;++l)(l===n||e.charCodeAt(l)===F)&&(u+=u.length===0?"..":"/..");return`${u}${t.slice(o+d)}`},toNamespacedPath(e){return e},dirname(e){if(A(e,"path"),e.length===0)return".";let t=e.charCodeAt(0)===F,r=-1,n=!0;for(let s=e.length-1;s>=1;--s)if(e.charCodeAt(s)===F){if(!n){r=s;break}}else n=!1;return r===-1?t?"/":".":t&&r===1?"//":e.slice(0,r)},basename(e,t){t!==void 0&&A(t,"suffix"),A(e,"path");let r=0,n=-1,s=!0,o;if(t!==void 0&&t.length>0&&t.length<=e.length){if(t===e)return"";let a=t.length-1,_=-1;for(o=e.length-1;o>=0;--o){let d=e.charCodeAt(o);if(d===F){if(!s){r=o+1;break}}else _===-1&&(s=!1,_=o+1),a>=0&&(d===t.charCodeAt(a)?--a===-1&&(n=o):(a=-1,n=_))}return r===n?n=_:n===-1&&(n=e.length),e.slice(r,n)}for(o=e.length-1;o>=0;--o)if(e.charCodeAt(o)===F){if(!s){r=o+1;break}}else n===-1&&(s=!1,n=o+1);return n===-1?"":e.slice(r,n)},extname(e){A(e,"path");let t=-1,r=0,n=-1,s=!0,o=0;for(let a=e.length-1;a>=0;--a){let _=e[a];if(_==="/"){if(!s){r=a+1;break}continue}n===-1&&(s=!1,n=a+1),_==="."?t===-1?t=a:o!==1&&(o=1):t!==-1&&(o=-1)}return t===-1||n===-1||o===0||o===1&&t===n-1&&t===r+1?"":e.slice(t,n)},format:ct.bind(null,"/"),parse(e){A(e,"path");let t={root:"",dir:"",base:"",ext:"",name:""};if(e.length===0)return t;let r=e.charCodeAt(0)===F,n;r?(t.root="/",n=1):n=0;let s=-1,o=0,a=-1,_=!0,d=e.length-1,l=0;for(;d>=n;--d){let u=e.charCodeAt(d);if(u===F){if(!_){o=d+1;break}continue}a===-1&&(_=!1,a=d+1),u===de?s===-1?s=d:l!==1&&(l=1):s!==-1&&(l=-1)}if(a!==-1){let u=o===0&&r?1:o;s===-1||l===0||l===1&&s===a-1&&s===o+1?t.base=t.name=e.slice(u,a):(t.name=e.slice(u,s),t.base=e.slice(u,a),t.ext=e.slice(s,a))}return o>0?t.dir=e.slice(0,o-1):r&&(t.dir="/"),t},sep:"/",delimiter:":",win32:null,posix:null};P.win32=R.win32=R;P.posix=R.posix=P;var Mn=W?R.normalize:P.normalize,Rn=W?R.isAbsolute:P.isAbsolute,Cn=W?R.join:P.join,He=W?R.resolve:P.resolve,Nn=W?R.relative:P.relative,Pn=W?R.dirname:P.dirname,ut=W?R.basename:P.basename,Fn=W?R.extname:P.extname,On=W?R.format:P.format,kn=W?R.parse:P.parse,Ln=W?R.toNamespacedPath:P.toNamespacedPath,Dn=W?R.sep:P.sep,Un=W?R.delimiter:P.delimiter;var Er=Le(),De=class{constructor(){this.loadedLanguagesCache=new Map}loadLanguage(t){return this.loadedLanguagesCache.has(t)||this.loadedLanguagesCache.set(t,this._doLoadLanguage(t)),this.loadedLanguagesCache.get(t)}_doLoadLanguage(t){let n=`tree-sitter-${t==="csharp"?"c-sharp":t}.wasm`,s=ut(__dirname)==="dist"?He(__dirname,n):He(__dirname,"../../../../dist",n);return Er.Language.load(s)}};var mt=Le(),Ue=class e{static{this.INSTANCE=new e}static{this.CACHE_SIZE_PER_LANGUAGE=5}constructor(){this.caches=new Map,this.languageLoader=new De,this._parser=null}get parser(){return this._parser||(this._parser=new mt),this._parser}async parse(t,r){await mt.init();let n=this.getParseTreeCache(t),s=n.get(r);if(s)return s.createReference();let o=await this.languageLoader.loadLanguage(t);if(this.parser.setLanguage(o),s=n.get(r),s)return s.createReference();let a=this.parser.parse(r);return s=new je(a),n.put(r,s),s.createReference()}dispose(){this._parser&&(this.parser.delete(),this._parser=null);for(let t of this.caches.values())t.dispose()}getParseTreeCache(t){let r=this.caches.get(t);return r||(r=new Me(e.CACHE_SIZE_PER_LANGUAGE),this.caches.set(t,r)),r}},je=class{constructor(t){this._tree=new Ze(t)}dispose(){this._tree.deref()}createReference(){return new Ge(this._tree)}},Ge=class{constructor(t){this._parseTree=t;this._parseTree.ref()}get tree(){return this._parseTree.tree}dispose(){this._parseTree.deref()}},Ze=class{constructor(t){this._tree=t;this._refCount=1}get tree(){if(this._refCount===0)throw new Error("Cannot access disposed RefCountedParseTree");return this._tree}ref(){if(this._refCount===0)throw new Error("Cannot ref disposed RefCountedParseTree");this._refCount++}deref(){if(this._refCount===0)throw new Error("Cannot deref disposed RefCountedParseTree");this._refCount--,this._refCount===0&&this._tree.delete()}};function ft(){Ue.INSTANCE.dispose()}function E(e,t){return Ue.INSTANCE.parse(e,t)}function vr(e,t,r=0,n=e.length){let s=r,o=n;for(;s{let n=e(r);return t.has(n)?!1:(t.add(n),!0)}}function yt(e,t){for(let r of t)e.push(r)}var wt;(_=>{function e(d){return d<0}_.isLessThan=e;function t(d){return d<=0}_.isLessThanOrEqual=t;function r(d){return d>0}_.isGreaterThan=r;function n(d){return d===0}_.isNeitherLessOrGreaterThan=n,_.greaterThan=1,_.lessThan=-1,_.neitherLessOrGreaterThan=0})(wt||={});var gt=class e{constructor(t){this.iterate=t}static{this.empty=new e(t=>{})}forEach(t){this.iterate(r=>(t(r),!0))}toArray(){let t=[];return this.iterate(r=>(t.push(r),!0)),t}filter(t){return new e(r=>this.iterate(n=>t(n)?r(n):!0))}map(t){return new e(r=>this.iterate(n=>r(t(n))))}some(t){let r=!1;return this.iterate(n=>(r=t(n),!r)),r}findFirst(t){let r;return this.iterate(n=>t(n)?(r=n,!1):!0),r}findLast(t){let r;return this.iterate(n=>(t(n)&&(r=n),!0)),r}findLastMaxBy(t){let r,n=!0;return this.iterate(s=>((n||wt.isGreaterThan(t(s,r)))&&(n=!1,r=s),!0)),r}};var Qe=class{constructor(t){this.language=t;this.map=new Map}getQuery(t){return this.map.has(t)||this.map.set(t,this.language.query(t)),this.map.get(t)}},ze=class e{constructor(){this.map=new Map}static{this.INSTANCE=new e}getQuery(t,r){return this.map.has(t)||this.map.set(t,new Qe(t)),this.map.get(t).getQuery(r)}};function O(e,t){let r=[];for(let n of e){let o=ze.INSTANCE.getQuery(t.tree.getLanguage(),n).matches(t);yt(r,o)}return r}function xe(e,t){switch(t){case"python":case"csharp":return e.children.find(r=>r.type.match(/identifier/))?.text;case"go":{let r=e.children.find(s=>s.type.match(/identifier/));return r?r.text:e.children.find(s=>s.type.match(/spec/))?.children.find(s=>s.type.match(/identifier/))?.text}case"javascript":case"javascriptreact":case"typescript":case"typescriptreact":case"cpp":{let r=e.children.find(s=>s.type.match(/declarator/));return r?r.children.find(s=>s.type.match(/identifier/))?.text:e.children.find(s=>s.type.match(/identifier/))?.text}case"java":return e.children.find(n=>n.type==="identifier")?.text;case"ruby":return e.children.find(r=>r.type.match(/constant|identifier/))?.text;default:return e.children.find(r=>r.type.match(/identifier/))?.text}}function Te(e,t){switch(t){case"typescript":case"tsx":case"javascript":return e.type.match(/definition|declaration|declarator|export_statement/);case"go":return e.type.match(/definition|declaration|declarator|var_spec/);case"cpp":return e.type.match(/definition|declaration|class_specifier/);case"ruby":return e.type.match(/module|class|method|assignment/);default:return e.type.match(/definition|declaration|declarator/)}}function le(e,t,r,n=Te){let s=[e.rootNode],o=[];for(;;){let a=s.map(_=>[_,b.intersectionSize(_,t)]).filter(([_,d])=>d>0).sort(([_,d],[l,u])=>u-d);if(a.length===0)return o.length===0?void 0:rt(o,([_,d],[l,u])=>d-u)[0];{let _=a.map(([d,l])=>{let u=b.len(d),c=Math.abs(b.len(t)-l),w=(l-c)/u;return[d,w]});o.push(..._.filter(([d,l])=>n(d,r))),s=[],s.push(..._.flatMap(([d,l])=>d.children))}}}var y=(()=>{function e(t,...r){return t.length===1?t[0]:t.reduce((n,s,o)=>`${n}${s}${r[o]||""}`,"")}return{typescript:e,javascript:e,python:e,go:e,ruby:e,csharp:e,cpp:e,java:e,rust:e}})();function q(e,t){return Object.fromEntries(e.map(r=>[r,t]))}var Sr={javascript:[],typescript:[],tsx:[],python:[],csharp:[],go:[],java:[],ruby:[],cpp:[],rust:[]};function V(e){for(let t in e){let r=e[t];Sr[t].push(...r)}return e}var xt=V({...q(["javascript","typescript","tsx"],[`[ (call_expression function: (identifier) @identifier) (call_expression function: (member_expression (property_identifier) @identifier)) ] @call_expression`]),python:[`[ (call function: (identifier) @identifier) (call function: (attribute attribute: (identifier) @identifier)) ] @call_expression`],csharp:[`[ (invocation_expression function: (identifier) @identifier) (invocation_expression function: (member_access_expression name: (identifier) @identifier)) ] @call_expression`],go:[`[ (call_expression ((selector_expression (field_identifier) @identifier))) (call_expression (identifier) @identifier) ] @call_expression`],java:[`[ (method_invocation name: (identifier) @identifier) ] @call_expression`],ruby:[`[ (call (identifier) @identifier (#not-match? @identifier "new|send|public_send|method")) (call receiver: (identifier) method: (identifier) @method (#match? @method "^(send|public_send|method)") arguments: (argument_list (simple_symbol) @symbol)) ] @call_expression`],cpp:[`[ (function_declarator (identifier) @identifier) (function_declarator (field_identifier) @identifier) (call_expression (identifier) @identifier) (call_expression (field_expression field: (field_identifier) @identifier)) (call_expression (call_expression (primitive_type) (argument_list (pointer_expression (identifier) @identifier)))) ] @call_expression`],rust:[`[ (call_expression (identifier) @identifier) (call_expression (field_expression (identifier) (field_identifier) @identifier)) (call_expression (scoped_identifier (identifier) (identifier) @identifier (#not-match? @identifier "new"))) ] @call_expression`]}),Tt=V({...q(["javascript","typescript","tsx"],["(class_declaration) @class_declaration"]),java:["(class_declaration) @class_declaration"],csharp:["(class_declaration) @class_declaration"],python:["(class_definition) @class_declaration"],cpp:["(class_specifier) @class_declaration"],ruby:["(class) @class_declaration"],go:[`(type_declaration (type_spec (type_identifier) @type_identifier)) @class_declaration`],rust:["(impl_item (type_identifier) @type_identifier) @class_declaration"]}),bt=V({typescript:[`[ (interface_declaration) (type_alias_declaration) ] @type_declaration`],csharp:[`(interface_declaration (identifier) @type_identifier) @type_declaration`],cpp:[`[ (struct_specifier (type_identifier) @type_identifier) (union_specifier (type_identifier) @type_identifier) (enum_specifier (type_identifier) @type_identifier) ] @type_declaration`],java:[`(interface_declaration (identifier) @type_identifier) @type_declaration`],go:[`(type_declaration (type_spec (type_identifier) @type_identifier)) @type_declaration`],ruby:["((constant) @type_identifier) @type_declaration"],python:[`(class_definition (identifier) @type_identifier) @type_declaration`]}),Et=V({typescript:["(type_identifier) @type_identifier"],go:["(type_identifier) @type_identifier"],ruby:["(constant) @type_identifier"],csharp:[`[ (base_list (identifier) @type_identifier) (variable_declaration (identifier) @type_identifier) ]`],cpp:["(type_identifier) @type_identifier"],java:["(type_identifier) @type_identifier"],python:[`[ (type (identifier) @type_identifier) (argument_list (identifier) @type_identifier) ]`]}),vt=V({...q(["javascript","typescript","tsx"],[`(new_expression constructor: (identifier) @new_expression)`]),python:[`(call function: (identifier) @new_expression)`],csharp:[`(object_creation_expression (identifier) @new_expression)`],java:[`(object_creation_expression (type_identifier) @new_expression)`],cpp:[`[ (declaration (type_identifier) @new_expression) (class_specifier (type_identifier) @new_expression) ]`],go:["(composite_literal (type_identifier) @new_expression)"],ruby:[`((call receiver: ((constant) @new_expression) method: (identifier) @method) (#eq? @method "new"))`],rust:[`(call_expression (scoped_identifier (identifier) @new_expression (identifier) @identifier (#eq? @identifier "new")))`]}),St=V({python:[`[ (function_definition name: (identifier) @identifier body: (block (expression_statement (string))? @docstring) @body) (assignment left: (identifier) @identifier right: (lambda) @body) ] @function`,'(ERROR ("def" (identifier) (parameters))) @function'],...q(["javascript","typescript","tsx"],[`[ (function_expression name: (identifier)? @identifier body: (statement_block) @body) (function_declaration name: (identifier)? @identifier body: (statement_block) @body) (generator_function name: (identifier)? @identifier body: (statement_block) @body) (generator_function_declaration name: (identifier)? @identifier body: (statement_block) @body) (method_definition name: (property_identifier)? @identifier body: (statement_block) @body) (arrow_function body: (statement_block) @body) ] @function`]),go:[`[ (function_declaration name: (identifier) @identifier body: (block) @body) (method_declaration name: (field_identifier) @identifier body: (block) @body) ] @function`],ruby:[`[ (method name: (_) @identifier parameters: (method_parameters)? @params [(_)+ "end"] @body) (singleton_method name: (_) @identifier parameters: (method_parameters)? @params [(_)+ "end"] @body) ] @function`],csharp:[`[ (constructor_declaration (identifier) @identifier (block) @body) (destructor_declaration (identifier) @identifier (block) @body) (operator_declaration (block) @body) (method_declaration (identifier) @identifier (block) @body) (local_function_statement (identifier) @identifier (block) @body) ] @function`],cpp:[`[ (function_definition (_ (identifier) @identifier) (compound_statement) @body) (function_definition (function_declarator (qualified_identifier (identifier) @identifier)) (compound_statement) @body) ] @function`],java:[`[ (constructor_declaration name: (identifier) @identifier body: (constructor_body) @body) (method_declaration name: (_) @identifier body: (block) @body) (lambda_expression body: (block) @body) ] @function`],rust:[`[ (function_item (identifier) @identifier) (let_declaration (identifier) @identifier) ] @function`]}),os=V({javascript:[y.javascript`((comment) @comment (#match? @comment "^\\\\/\\\\*\\\\*")) @docComment`],...q(["typescript","tsx"],[y.typescript`((comment) @comment (#match? @comment "^\\\\/\\\\*\\\\*")) @docComment`]),java:[y.java`((block_comment) @block_comment (#match? @block_comment "^\\\\/\\\\*\\\\*")) @docComment`],cpp:[y.cpp`((comment) @comment (#match? @comment "^\\\\/\\\\*\\\\*")) @docComment`],csharp:[y.csharp`( ((comment) @c (#match? @c "^\\\\/\\\\/\\\\/"))+ ) @docComment`],rust:[y.rust`((line_comment) @comment (#match? @comment "^\/\/\/|^\/\/!"))+ @docComment`],go:[y.go`((comment)+) @docComment`],ruby:[y.ruby`((comment)+) @docComment`],python:[`(expression_statement (string) @docComment)`]}),Ke=V({javascript:[y.javascript`[ (function_declaration (identifier) @function.identifier ) @function (generator_function_declaration name: (identifier) @generator_function.identifier ) @generator_function (class_declaration name: (identifier) @class.identifier ;; note: (type_identifier) in typescript body: (class_body (method_definition name: (property_identifier) @method.identifier ) @method ) ) @class ]`],...q(["typescript","tsx"],[y.typescript`[ (function_declaration (identifier) @function.identifier ) @function (generator_function_declaration name: (identifier) @generator_function.identifier ) @generator_function (class_declaration name: (type_identifier) @class.identifier body: (class_body (method_definition (accessibility_modifier)? @method.accessibility_modifier name: (property_identifier) @method.identifier (#not-eq? @method.accessibility_modifier "private") ) @method ) ) @class ]`]),python:[y.python`[ (function_definition name: (identifier) @function.identifier ) @function ]`],go:[y.go`[ (function_declaration name: (identifier) @function.identifier ) @function (method_declaration name: (field_identifier) @method.identifier ) @method ]`],ruby:[y.ruby`[ (method name: (identifier) @method.identifier ) @method (singleton_method name: (_) @singleton_method.identifier ) @singleton_method ]`],csharp:[y.csharp`[ (constructor_declaration (identifier) @constructor.identifier ) @constructor (destructor_declaration (identifier) @destructor.identifier ) @destructor (method_declaration (identifier) @method.identifier ) @method (local_function_statement (identifier) @local_function.identifier ) @local_function ]`],cpp:[y.cpp`[ (function_definition (_ (identifier) @identifier) ) @function ]`],java:[y.java`(class_declaration name: (_) @class.identifier body: (_ [ (constructor_declaration (modifiers)? @constructor.modifiers (#not-eq? @constructor.modifiers "private") name: (identifier) @constructor.identifier ) @constructor (method_declaration (modifiers)? @method.modifiers (#not-eq? @method.modifiers "private") name: (identifier) @method.identifier ) @method ] ) ) @class`],rust:[y.rust`[ (function_item (identifier) @function.identifier ) @function ]`]}),It=V({javascript:[y.javascript`[ (identifier) @symbol (property_identifier) @symbol (private_property_identifier) @symbol ]`],...q(["typescript","tsx"],[y.typescript`[ (identifier) @symbol (type_identifier) @symbol (property_identifier) @symbol (private_property_identifier) @symbol ]`]),cpp:[y.cpp`[ (identifier) @symbol (type_identifier) @symbol ]`],csharp:[y.csharp`[ (identifier) @symbol ]`],go:[y.go`[ (identifier) @symbol ]`],java:[y.java`[ (identifier) @symbol ]`],python:[y.python`[ (identifier) @symbol ]`],ruby:[y.ruby`[ (identifier) @symbol ]`],rust:[y.rust`[ (identifier) @symbol ]`]}),At=V({typescript:[y.typescript` [ (comment) @comment ;; split into multiple comment kinds? (declaration) @declaration ;; class declaration related (public_field_definition) @public_field_definition (method_definition) @method_definition (class_declaration (_ (method_signature) @method_signature)) (abstract_method_signature) @abstract_method_signature ;; enum declaration related (enum_assignment) @enum_assignment ;; interface declaration related (interface_declaration (_ (method_signature) @method_signature)) (interface_declaration (_ (property_signature) @property_signature)) ;; statements (import_statement) @import_statement (export_statement) @export_statement (expression_statement) @expression_statement (for_in_statement) @for_in_statement ;; exclude any children found in the for loop condition (for_statement condition: (_) @for_statement.exclude_captures ) @for_statement (break_statement) @break_statement (continue_statement) @continue_statement (do_statement) @do_statement (if_statement) @if_statement (if_statement consequence: [ (expression_statement) (if_statement) ] @if_statement.exclude_captures) (else_clause [ (expression_statement) (if_statement) ; for if-else chains ] @else_clause.exclude_captures) (switch_statement) @switch_statement (switch_case) @switch_case (try_statement) @try_statement (throw_statement) @throw_statement (debugger_statement) @debugger_statement (return_statement) @return_statement ] `],tsx:[y.typescript` [ (comment) @comment ;; split into multiple comment kinds? (declaration) @declaration ;; class declaration related (public_field_definition) @public_field_definition (method_definition) @method_definition (class_declaration (_ (method_signature) @method_signature)) (abstract_method_signature) @abstract_method_signature ;; enum declaration related (enum_assignment) @enum_assignment ;; interface declaration related (interface_declaration (_ (method_signature) @method_signature)) (interface_declaration (_ (property_signature) @property_signature)) ;; statements (import_statement) @import_statement (export_statement) @export_statement (expression_statement) @expression_statement (for_in_statement) @for_in_statement ;; exclude any children found in the for loop condition (for_statement condition: (_) @for_statement.exclude_captures ) @for_statement (break_statement) @break_statement (continue_statement) @continue_statement (do_statement) @do_statement (if_statement) @if_statement (if_statement consequence: [ (expression_statement) (if_statement) ] @if_statement.exclude_captures) (else_clause [ (expression_statement) (if_statement) ; for if-else chains ] @else_clause.exclude_captures) (switch_statement) @switch_statement (switch_case) @switch_case (try_statement) @try_statement (throw_statement) @throw_statement (debugger_statement) @debugger_statement (return_statement) @return_statement ;; jsx (jsx_element) @jsx_element (jsx_element (_ (jsx_expression) @jsx_expression)) ] `],python:[y.python` [ (comment) @comment ;; simple statements (assert_statement) @assert_statement (break_statement) @break_statement (continue_statement) @continue_statement (delete_statement) @delete_statement (exec_statement) @exec_statement (expression_statement) @expression_statement (future_import_statement) @future_import_statement (global_statement) @global_statement (import_from_statement) @import_from_statement (import_statement) @import_statement (nonlocal_statement) @nonlocal_statement (pass_statement) @pass_statement (print_statement) @print_statement (raise_statement) @raise_statement (return_statement) @return_statement (type_alias_statement) @type_alias_statement ;; compound statements (class_definition) @class_definition (decorated_definition) @decorated_definition (for_statement) @for_statement (function_definition) @function_definition (if_statement) @if_statement (try_statement) @try_statement (while_statement) @while_statement (with_statement) @with_statement ;; expressions (expression_list) @expression_list (expression_statement) @expression_statement ] `],javascript:[y.javascript` [ (comment) @comment ;; split into multiple comment kinds? (declaration) @declaration ;; class declaration related (field_definition) @field_definition (method_definition) @method_definition ;; statements (import_statement) @import_statement (export_statement) @export_statement (expression_statement) @expression_statement (for_in_statement) @for_in_statement ;; exclude any children found in the for loop condition (for_statement condition: (_) @for_statement.exclude_captures ) @for_statement (break_statement) @break_statement (continue_statement) @continue_statement (do_statement) @do_statement (if_statement) @if_statement (switch_statement) @switch_statement (switch_case) @switch_case (try_statement) @try_statement (throw_statement) @throw_statement (debugger_statement) @debugger_statement (return_statement) @return_statement ]`],go:[y.go` [ (_statement) @statement (function_declaration) @function_declaration (import_declaration) @import_declaration (method_declaration) @method_declaration (package_clause) @package_clause (if_statement initializer: (_) @for_statement.exclude_captures) @for_statement (expression_case) @expression_case ;; e.g., case 0: ] `],ruby:[y.ruby` [ (comment) @comment (assignment) @assignment (if) @if (call) @call (case) @case (when) @when (while) @while (for) @for (method) @method (class) @class (module) @module (begin) @begin ] `],csharp:[y.csharp` [ (comment) @comment (class_declaration) @class_declaration (constructor_declaration) @constructor_declaration (method_declaration) @method_declaration (delegate_declaration) @delegate_declaration (enum_declaration) @enum_declaration (extern_alias_directive) @extern_alias_directive (file_scoped_namespace_declaration) @file_scoped_namespace_declaration (global_attribute) @global_attribute (global_statement) @global_statement (interface_declaration) @interface_declaration (namespace_declaration) @namespace_declaration (record_declaration) @record_declaration (struct_declaration) @struct_declaration (using_directive) @using_directive (local_declaration_statement) @local_declaration_statement (expression_statement) @expression_statement (for_statement) @for_statement (foreach_statement) @foreach_statement (continue_statement) @continue_statement (break_statement) @break_statement (throw_statement) @throw_statement (return_statement) @return_statement (try_statement) @try_statement ] `],cpp:[y.cpp` [ (preproc_ifdef) @preproc_ifdef (preproc_call) @preproc_call (preproc_def) @preproc_def (type_definition) @type_definition (type_definition type:(_) @type_definition.exclude_captures) @type_definition (declaration) @declaration (expression_statement) @expression_statement (comment) @comment (preproc_include) @preproc_include (namespace_definition) @namespace_definition (enum_specifier) @enum_specifier (struct_specifier) @struct_specifier (template_declaration) @template_declaration (function_definition) @function_definition (return_statement) @return_statement (class_specifier) @class_specifier (try_statement) @try_statement (throw_statement) @throw_statement (for_statement) @for_statement (for_statement initializer:(_) @for_statement.exclude_captures) @for_statement (for_range_loop) @for_range_loop (while_statement) @while_statement (do_statement) @do_statement (if_statement) @if_statement (labeled_statement) @labeled_statement (goto_statement) @goto_statement (break_statement) @break_statement ] `],java:[y.java` [ (statement) @statement ;; @ulugbekna: this includes (declaration); but somehow it can't capture inner classes (line_comment) @line_comment (block_comment) @block_comment (for_statement init: (_) @for_statement.exclude_captures) (block) @block.exclude_captures (class_declaration) @class_declaration (constructor_declaration) @constructor_declaration (field_declaration) @field_declaration (method_declaration) @method_declaration ] `],rust:[]}),Mt={...q(["typescript","tsx"],["program","interface_declaration","class_declaration","function_declaration","function_expression","type_alias_declaration","method_definition"]),javascript:["program","class_declaration","function_declaration","function_expression","method_definition"],java:["program","class_declaration","interface_declaration","method_declaration"],cpp:["translation_unit","class_specifier","function_definition"],csharp:["compilation_unit","class_declaration","interface_declaration","method_declaration"],python:["module","class_definition","function_definition"],go:["source_file","type_declaration","function_declaration","method_declaration"],ruby:["program","method","class","method"],rust:["source_file","function_item","impl_item","let_declaration"]},Rt=V({typescript:[J("typescript")],tsx:[J("tsx")],javascript:[J("javascript")],java:[J("java")],cpp:[J("cpp")],csharp:[J("csharp")],python:[J("python")],go:[J("go")],ruby:[J("ruby")],rust:[J("rust")]}),Ct={...q(["typescript","tsx","javascript"],["for_in_statement","for_statement","if_statement","while_statement","do_statement","try_statement","switch_statement"]),java:["for_statement","enhanced_for_statement","if_statement","while_statement","do_statement","try_statement","switch_expression"],cpp:["for_statement","for_range_loop","if_statement","while_statement","do_statement","try_statement","switch_statement"],csharp:["for_statement","for_each_statement","if_statement","while_statement","do_statement","try_statement","switch_expression"],python:["for_statement","if_statement","while_statement","try_statement"],go:["for_statement","if_statement","type_switch_statement"],ruby:["while","for","if","case"],rust:["for_statement","if_statement","while_statement","loop_statement","match_expression"]},Ir={...q(["typescript","tsx"],["lexical_declaration","expression_statement","public_field_definition"]),javascript:["call_expression","expression_statement","variable_declaration","public_field_definition"],java:["expression_statement","local_variable_declaration","field_declaration"],cpp:["field_declaration","expression_statement","declaration"],csharp:["field_declaration","expression_statement"],python:["expression_statement"],go:["short_var_declaration","call_expression"],ruby:["call","assignment"],rust:["expression_statement","let_declaration","use_declaration","assignment_expression","macro_definition","extern_crate_declaration"]},Ar={...q(["typescript","tsx"],["class_declaration","function_declaration","generator_function_declaration","interface_declaration","internal_module","method_definition","abstract_class_declaration","abstract_method_signature","enum_declaration"]),javascript:["class_declaration","function_declaration","generator_function_declaration","method_definition"],java:["class_declaration","constructor_declaration","enum_declaration","interface_declaration","method_declaration","module_declaration"],cpp:["class_specifier","function_definition","namespace_definition","struct_specifier"],csharp:["class_declaration","constructor_declaration","destructor_declaration","enum_declaration","interface_declaration","method_declaration","namespace_declaration","struct_declaration"],python:["function_definition","class_definition"],go:["function_declaration","method_declaration"],ruby:["class","method","module"],rust:["function_item","impl_item","mod_item","struct_item","trait_item","union_item"]},Nt=V({typescript:[K("typescript")],tsx:[K("tsx")],javascript:[K("javascript")],java:[K("java")],cpp:[K("cpp")],csharp:[K("csharp")],python:[K("python")],go:[K("go")],rust:[K("rust")],ruby:[K("ruby")]});function J(e){return Mt[e].map(t=>`(${t}) @scope`).join(` `)}function K(e){return`[ ${Ar[e].map(r=>`(${r})`).join(` `)} ] @definition`}function be(e,t){return Mt[e].includes(t.type)||Ct[e].includes(t.type)}function Pt(e,t){return Ct[e].includes(t.type)}function Ye(e,t){return Ir[e].includes(t.type)}var Ft={...q(["typescript","tsx"],[y.typescript`[ (expression_statement (call_expression function: (identifier) @fn (#any-of? @fn "test" "it") ) ) @test ]`]),javascript:[y.javascript`[ (call_expression function: (identifier) @fn (#any-of? @fn "test" "it") ) @test ]`],python:[y.python`[ (function_definition name: (identifier) @fn (#match? @fn "^test_") ) @test ]`],java:[y.java`[ (method_declaration name: (identifier) @fn (#match? @fn "^test") ) @test ]`],go:[y.go`[ (function_declaration name: (identifier) @fn (#match? @fn "^Test") ) @test ]`],ruby:[],csharp:[],cpp:[],rust:[]};var Xe=class{constructor(){this._cache=new me(5)}setCacheSize(t){this._cache=new me(t)}async getStructure(t,r){let n=`${t}:${r}`,s=this._cache.get(n);return s||(s=await this._getStructure(t,r),this._cache.put(n,s)),s}async _getStructure(t,r){let n=At[t];if(n.length===0)return;let s=await E(t,r);try{let o=O(n,s.tree.rootNode).flatMap(l=>l.captures).sort((l,u)=>b.compare(l.node,u.node)),a=[];for(let l of o)l.name.endsWith(".exclude_captures")&&a.push(b.ofSyntaxNode(l.node));let _=new ge(0,r.length,"root",[]),d=[_];for(let l=0;lb.isEqual(x,c)))continue;let m;do m=d.pop();while(m&&!b.doesContain(m,c));if(new Set(["export_statement","ambient_declaration"]).has(m.kind))m.kind=c.type,d.push(m);else{let x=c.type;(t==="typescript"||t==="tsx"||t==="javascript")&&x==="method_definition"&&c.namedChildren.some(g=>g.type==="property_identifier"&&g.text==="constructor")&&(x="constructor");let p=c.startIndex,v=c.previousSibling;if(v!==null){let S=r.substring(v.endIndex,c.startIndex).indexOf(` `);S===-1?p=v.endIndex:p=v.endIndex+S+1}let T=c.endIndex;if(c.nextSibling!==null){let g=c.nextSibling;if(t==="typescript"||t==="tsx"||t==="javascript"||t==="cpp")for(;g&&(g.type===";"||g.type===","||g.type==="comment"&&!r.substring(T,g.startIndex).includes(` `));)a.push(b.ofSyntaxNode(g)),T=g.endIndex,g=g.nextSibling;if(g!==null){let G=r.substring(T,g.startIndex).indexOf(` `);G!==-1&&(T=T+G+1)}}let f=new ge(p,T,x,[]);m.children.push(f),d.push(m,f)}}return _}catch(o){console.error(o instanceof Error?o:new Error(o))}finally{s.dispose()}}},Ot=new Xe;async function kt(e,t,r){let n=await E(e,t);try{let o=r.startIndex===r.endIndex?void 0:le(n.tree,r,e);if(o)return{nodeIdentifier:xe(o,e),nodeToDocument:oe.ofSyntaxNode(o),nodeSelectionBy:"matchingSelection"};let _=n.tree.rootNode.descendantForIndex(r.startIndex,r.endIndex),d=0;for(;!Te(_,e)&&_.parent!==null;)_=_.parent,++d;return{nodeIdentifier:xe(_,e),nodeToDocument:oe.ofSyntaxNode(_),nodeSelectionBy:"expanding"}}finally{n.dispose()}}async function Lt(e,t,r){let n=await E(e,t);try{let s=n.tree.rootNode.descendantForIndex(r.startIndex,r.endIndex);if(s.type.match(/identifier/)&&(s.parent===null||Te(s.parent,e))){let o=s.parent,a=o===null?void 0:{startIndex:o.startIndex,endIndex:o.endIndex};return{identifier:s.text,nodeRange:a}}}finally{n.dispose()}}function Ee(e,t){if(!e)throw new Error(t?`Unexpected type, expected '${t}'`:"Unexpected type")}async function Dt(e,t,r){let n=await E(e,t);try{let s=O(Ke[e],n.tree.rootNode).flatMap(({captures:_})=>_),o=new Map;for(let _ of s){let[d,l]=_.name.split(".");if(l!=="identifier")continue;let u=o.get(d)||[];u.push(_),o.set(d,u)}let a=null;for(let _ of s){let[d,l]=_.name.split(".");if(l!==void 0||!b.doesContain(_.node,r)||a!==null&&b.len(a.node)b.doesContain(_.node,m.node));Ee(c!==void 0,`must have seen identifier for symbol '${d}' (lang: ${e})`),a={identifier:{name:c.node.text,range:b.ofSyntaxNode(c.node)},node:oe.ofSyntaxNode(_.node)}}return a}catch(s){return console.error("getTestableNode: Unexpected error",s),null}finally{n.dispose()}}async function Ut(e,t){let r=await E(e,t);try{let n=O(Ke[e],r.tree.rootNode).flatMap(({captures:a})=>a).filter(ht(a=>[a.node.startIndex,a.node.endIndex].toString())),s=new Map;for(let a of n){let[_,d]=a.name.split(".");if(d!=="identifier")continue;let l=s.get(_)||[];l.push(a),s.set(_,l)}let o=[];for(let a of n){if(a.name.includes("."))continue;let _=a.name,d=s.get(_);Ee(d!==void 0,`must have seen identifier for symbol kind '${_}' (lang: ${e})`);let l=d.find(u=>b.doesContain(a.node,u.node));Ee(l!==void 0,`must have seen identifier for symbol '${_}' (lang: ${e})`),o.push({identifier:{name:l.node.text,range:b.ofSyntaxNode(l.node)},node:oe.ofSyntaxNode(a.node)})}return o}catch(n){return console.error("getTestableNodes: Unexpected error",n),null}finally{r.dispose()}}async function Bt(e,t){let r=await E(e,t);try{let s=O(Ft[e],r.tree.rootNode).flatMap(a=>a.captures).sort((a,_)=>a.node.endIndex-_.node.endIndex).filter(a=>a.name==="test");if(s.length===0)return null;let o=s[s.length-1].node;return{startIndex:o.startIndex,endIndex:o.endIndex}}finally{r.dispose()}}var Ks=Le();function Mr(e,t){let r=Rt[e];return O(r,t)}function qt(e,t){let r=St[e];return O(r,t)}function Rr(e,t){let r=xt[e];return r?O(r,t):[]}function Cr(e,t){let r=Tt[e];return r?O(r,t):[]}function Nr(e,t){let r=bt[e];return r?O(r,t):[]}function Pr(e,t){let r=Et[e];return r?O(r,t):[]}function Fr(e,t){let r=vt[e];return r?O(r,t):[]}function Vt(e,t){let r=Nt[e];return O(r,t)}async function Or(e,t,r){let n=await E(e,t);try{return Rr(e,n.tree.rootNode).reduce((a,_)=>{let d=_.captures.find(l=>l.name==="call_expression").node;if(b.doIntersect(r,d)){let l,u;e==="ruby"&&(u=_.captures.find(c=>c.name==="symbol")?.node,l=u?.text?.slice(1)),u??=_.captures.find(c=>c.name==="identifier")?.node,l??=u?.text,a.push({identifier:l??"",text:d.text,startIndex:(u??d).startIndex,endIndex:(u??d).endIndex})}return a},[])}finally{n.dispose()}}async function kr(e,t){let r=await E(e,t);try{return qt(e,r.tree.rootNode).map(o=>{let a=o.captures.find(d=>d.name==="function").node;return{identifier:o.captures.find(d=>d.name==="identifier")?.node.text??"",text:a.text,startIndex:a.startIndex,endIndex:a.endIndex}})}finally{r.dispose()}}async function Lr(e,t){let r=await E(e,t);try{return Cr(e,r.tree.rootNode).map(o=>{let a=o.captures.find(d=>d.name==="class_declaration").node;return{identifier:a?.children.find(d=>d.type==="type_identifier"||d.type==="identifier"||d.type==="constant")?.text??"",text:a.text,startIndex:a.startIndex,endIndex:a.endIndex}})}finally{r.dispose()}}async function Dr(e,t){let r=await E(e,t);try{return Nr(e,r.tree.rootNode).map(o=>{let a=o.captures.find(d=>d.name==="type_declaration").node,_=o.captures.find(d=>d.name==="type_identifier")?.node.text;return _||(_=a?.children.find(d=>d.type==="type_identifier")?.text),{identifier:_??"",text:a.text,startIndex:a.startIndex,endIndex:a.endIndex}})}finally{r.dispose()}}async function Ur(e,t,r){let n=await E(e,t);try{return Pr(e,n.tree.rootNode).reduce((a,_)=>{let d=_.captures.find(l=>l.name==="type_identifier").node;return b.doIntersect(r,d)&&a.push({identifier:d.text,text:d.text,startIndex:d.startIndex,endIndex:d.endIndex}),a},[])}finally{n.dispose()}}async function Br(e,t,r){let n=await E(e,t);try{return Fr(e,n.tree.rootNode).reduce((a,_)=>{let d=_.captures.find(l=>l.name==="new_expression").node;return b.doIntersect(r,d)&&a.push({identifier:d.text,text:d.text,startIndex:d.startIndex,endIndex:d.endIndex}),a},[])}finally{n.dispose()}}async function Wr(e,t,r){let n=await E(e,t);try{let s=It[e];return O(s,n.tree.rootNode).reduce((_,d)=>{let l=d.captures.find(u=>u.name==="symbol").node;return b.doIntersect(r,l)&&_.push({identifier:l.text,text:l.text,startIndex:l.startIndex,endIndex:l.endIndex}),_},[])}finally{n.dispose()}}async function $r(e,t){let r=await E(e,t);try{let n=Vt(e,r.tree.rootNode);return zr(e,n,r.tree.rootNode)}finally{r.dispose()}}async function qr(e,t){let r=await E(e,t);try{let n=Vt(e,r.tree.rootNode);return Zt(e,n,r.tree.rootNode)}finally{r.dispose()}}async function Vr(e,t){let r=await E(e,t);try{return qt(e,r.tree.rootNode).map(o=>{let a=o.captures.find(_=>_.name==="body").node;return{startIndex:a.startIndex,endIndex:a.endIndex}})}finally{r.dispose()}}async function Hr(e,t,r){let n=await E(e,t);try{let s=Mr(e,n.tree.rootNode),o;for(let a of s){let _=a.captures[0].node,d=se.ofSyntaxNode(_);if(se.doesContain(d,r)&&(o=_),j.isBefore(r.endPosition,d.startPosition))break}if(o)return se.ofSyntaxNode(o);throw new Error("No parent node found")}finally{n.dispose()}}async function jr(e,t,r,n){let s=await E(e,t);try{let o=s.tree.rootNode.descendantForPosition(r.startPosition,r.endPosition),a={startPosition:o.startPosition,endPosition:o.endPosition},_=jt(e,o,n,r,!0);return se.equals(a,_)?Ht(e,o):_}finally{s.dispose()}}function Ht(e,t){let r=t.parent,n={startPosition:t.startPosition,endPosition:t.endPosition};if(be(e,t)||!r)return n;let{filteredRanges:s,indexOfInterest:o}=Gt(e,r.children,n,!1);if(o-1>=0&&o+1<=s.length-1){let a=s[o-1],_=s[o+1];return{startPosition:a.startPosition,endPosition:_.endPosition}}return Ht(e,r)}function jt(e,t,r,n,s){let o=t.children;if(t.endPosition.row-t.startPosition.row+1<=r){let _=be(e,t)?{startPosition:t.startPosition,endPosition:t.endPosition}:$t(e,o,r,n,s),d=t.parent;return d?jt(e,d,r,_,!1):_}return $t(e,o,r,n,s)}function Wt(e,t){return t.endPosition.row-e.startPosition.row+1}function $t(e,t,r,n,s){if(t.length===0)return n;let{filteredRanges:o,indexOfInterest:a}=Gt(e,t,n,s),_=0,d=o.length-1,l=o[_],u=o[d];for(;Wt(l,u)>r&&_!==d;)a-_be(e,a)||Ye(e,a)),o=tt(s,r,(a,_)=>j.isBefore(a.startPosition,_.startPosition)),s.splice(o,0,r)):(s=t.filter(a=>se.doesContain(a,r)||be(e,a)||Ye(e,a)),o=s.findIndex(a=>se.doesContain(a,r))),o===-1)throw new Error("Valid index not found");return{filteredRanges:s,indexOfInterest:o}}async function Gr(e,t,r){let n=[],a=(await E(e,t)).tree.rootNode.descendantForIndex(r.startIndex,r.endIndex);for(;a!==null;)Pt(e,a)&&n.push({startIndex:a.startIndex,endIndex:a.endIndex}),a=a.parent;return n}async function Zr(e,t,r){let n=await E(e,t);try{let s=r.startIndex===r.endIndex;if(s)return;let o=s?void 0:le(n.tree,r,e),a=s?void 0:le(n.tree,r,e,Qr);if(a&&o)return{nodeIdentifier:xe(o,e),nodeToExplain:oe.ofSyntaxNode(a)}}finally{n.dispose()}}function Qr(e,t){return e.type.match(/definition/)}function Zt(e,t,r){let n=new Map;t.forEach(o=>{let _=o.captures.find(u=>u.name==="definition")?.node,d;e==="cpp"&&_?.type==="function_definition"?d=_?.childForFieldName("declarator")?.childForFieldName("declarator"):e==="rust"&&_?.type==="impl_item"?d=_?.childForFieldName("trait"):d=_?.childForFieldName("name");let l=_?.childForFieldName("body");if(_&&l){switch(e){case"typescript":case"javascript":{let{definition:c}=Qt(_);_=c;break}}n.get(_.id)||n.set(_.id,{mainBlock:D.ofSyntaxNode(_),detailBlocks:{body:D.ofSyntaxNode(l),name:d?.text}})}});let s=Array.from(n.values());return new he(s,D.ofSyntaxNode(r))}function zr(e,t,r){let n;switch(e){case"python":n=Xr(t);break;case"ruby":n=Yr(t);break;default:{n=Jr(t,e);break}}return new he(n,D.ofSyntaxNode(r))}function Jr(e,t){let r=new Map;return e.forEach(n=>{let o=n.captures.find(_=>_.name==="definition")?.node,a=o?.childForFieldName("body");if(o&&a){let _;switch(t){case"typescript":case"javascript":{let{definition:l,comments:u}=Qt(o);o=l,_=u;break}case"java":case"rust":_=en(o);break;default:{_=ve(o);break}}r.get(o.id)||r.set(o.id,{mainBlock:D.ofSyntaxNode(o),detailBlocks:{comments:_.map(l=>D.ofSyntaxNode(l)),body:D.ofSyntaxNode(a)}})}}),Array.from(r.values())}function Kr(e){if(!(e.length<2))for(let t=1;t{let s=r.captures.find(o=>o.name==="definition")?.node;if(s){let o=s.namedChildren,a=Kr(o);if(a){let _=o[o.length-1],d=s.text.substring(a.startIndex-s.startIndex,_.endIndex-s.startIndex),l=ve(s);t.get(s.id)||t.set(s.id,{mainBlock:D.ofSyntaxNode(s),detailBlocks:{comments:l.map(c=>D.ofSyntaxNode(c)),body:{range:{startPosition:{row:a.startPosition.row,column:a.startPosition.column},endPosition:{row:_.endPosition.row,column:_.endPosition.column}},startIndex:a.startIndex,text:d,endIndex:_.endIndex}}})}}}),Array.from(t.values())}function Xr(e){let t=new Map;return e.forEach(r=>{let s=r.captures.find(a=>a.name==="definition")?.node,o=s?.childForFieldName("body");if(s&&o){let a=rn(o),_=tn(s);t.set(s.id,{mainBlock:D.ofSyntaxNode(s),detailBlocks:{docstring:a?D.ofSyntaxNode(a):void 0,decorator:_?D.ofSyntaxNode(_):void 0,body:D.ofSyntaxNode(o)}});return}}),Array.from(t.values())}function ve(e,t=["comment"]){let r=[],n=e.previousNamedSibling;for(;n&&t.some(s=>s===n?.type);)r.push(n),n=n.previousNamedSibling;return r.reverse()}function Qt(e){let t=e.parent;return t?.type==="export_statement"?{definition:t,comments:ve(t)}:{definition:e,comments:ve(e)}}function en(e){return ve(e,["block_comment","line_comment"])}function tn(e){let t=e.previousNamedSibling;return t?.type==="decorator"?t:void 0}function rn(e){let t=e.firstChild;if(!t||t.type!=="expression_statement")return;let r=t.firstChild;return r?.type==="string"?r:void 0}function nn(e,t){return Ot.getStructure(e,t)}async function sn(e,t){let r=await E(e,t);try{let s=function(o){let a=o.type==="ERROR"?1:0;for(let _ of o.children)a+=s(_);return a};var n=s;return r.tree.rootNode.hasError?s(r.tree.rootNode):0}finally{r.dispose()}}function on(){let e=zt.parentPort;if(!e)throw new Error("This module should only be used in a worker thread.");e.on("message",async({id:t,fn:r,args:n})=>{try{let s=await et[r](...n);e.postMessage({id:t,res:s})}catch(s){e.postMessage({id:t,err:s})}})}on(); //!!! DO NOT modify, this file was COPIED from 'microsoft/vscode'