trueline-mcp 2.10.3 → 2.10.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
@@ -1,86 +1,86 @@
1
- import{createRequire as E$}from"node:module";var H$=Object.create;var{getPrototypeOf:j$,defineProperty:VQ,getOwnPropertyNames:T$}=Object;var F$=Object.prototype.hasOwnProperty;function A$(J){return this[J]}var O$,D$,k$=(J,Q,$)=>{var Z=J!=null&&typeof J==="object";if(Z){var X=Q?O$??=new WeakMap:D$??=new WeakMap,K=X.get(J);if(K)return K}$=J!=null?H$(j$(J)):{};let G=Q||!J||!J.__esModule?VQ($,"default",{value:J,enumerable:!0}):$;for(let z of T$(J))if(!F$.call(G,z))VQ(G,z,{get:A$.bind(J,z),enumerable:!0});if(Z)X.set(J,G);return G};var _$=(J,Q)=>()=>(Q||J((Q={exports:{}}).exports,Q),Q.exports);var mJ=E$(import.meta.url);var cQ=_$((LJ,AJ)=>{var __dirname="/home/runner/work/trueline-mcp/trueline-mcp/node_modules/web-tree-sitter",Y=typeof Y<"u"?Y:{},E0=typeof window=="object",tJ=typeof importScripts=="function",pQ=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string",C0=function(){var initPromise,document=typeof window=="object"?{currentScript:window.document.currentScript}:null;class Parser{constructor(){this.initialize()}initialize(){throw Error("cannot construct a Parser before calling `init()`")}static init(moduleOptions){if(initPromise)return initPromise;return Y=Object.assign({},Y,moduleOptions),initPromise=new Promise((resolveInitPromise)=>{var moduleOverrides=Object.assign({},Y),arguments_=[],thisProgram="./this.program",quit_=(J,Q)=>{throw Q},scriptDirectory="";function locateFile(J){if(Y.locateFile)return Y.locateFile(J,scriptDirectory);return scriptDirectory+J}var readAsync,readBinary;if(pQ){var fs=mJ("fs"),nodePath=mJ("path");if(scriptDirectory=__dirname+"/",readBinary=(J)=>{J=isFileURI(J)?new URL(J):nodePath.normalize(J);var Q=fs.readFileSync(J);return Q},readAsync=(J,Q=!0)=>{return J=isFileURI(J)?new URL(J):nodePath.normalize(J),new Promise(($,Z)=>{fs.readFile(J,Q?void 0:"utf8",(X,K)=>{if(X)Z(X);else $(Q?K.buffer:K)})})},!Y.thisProgram&&process.argv.length>1)thisProgram=process.argv[1].replace(/\\/g,"/");if(arguments_=process.argv.slice(2),typeof AJ<"u")AJ.exports=Y;quit_=(J,Q)=>{throw process.exitCode=J,Q}}else if(E0||tJ){if(tJ)scriptDirectory=self.location.href;else if(typeof document<"u"&&document.currentScript)scriptDirectory=document.currentScript.src;if(scriptDirectory.startsWith("blob:"))scriptDirectory="";else scriptDirectory=scriptDirectory.substr(0,scriptDirectory.replace(/[?#].*/,"").lastIndexOf("/")+1);{if(tJ)readBinary=(J)=>{var Q=new XMLHttpRequest;return Q.open("GET",J,!1),Q.responseType="arraybuffer",Q.send(null),new Uint8Array(Q.response)};readAsync=(J)=>{if(isFileURI(J))return new Promise((Q,$)=>{var Z=new XMLHttpRequest;Z.open("GET",J,!0),Z.responseType="arraybuffer",Z.onload=()=>{if(Z.status==200||Z.status==0&&Z.response)$(Z.response);Q(Z.status)},Z.onerror=Q,Z.send(null)});return fetch(J,{credentials:"same-origin"}).then((Q)=>{if(Q.ok)return Q.arrayBuffer();return Promise.reject(Error(Q.status+" : "+Q.url))})}}}var out=Y.print||console.log.bind(console),err=Y.printErr||console.error.bind(console);if(Object.assign(Y,moduleOverrides),moduleOverrides=null,Y.arguments)arguments_=Y.arguments;if(Y.thisProgram)thisProgram=Y.thisProgram;if(Y.quit)quit_=Y.quit;var dynamicLibraries=Y.dynamicLibraries||[],wasmBinary;if(Y.wasmBinary)wasmBinary=Y.wasmBinary;var wasmMemory,ABORT=!1,EXITSTATUS,HEAP8,HEAPU8,HEAP16,HEAPU16,HEAP32,HEAPU32,HEAPF32,HEAPF64,HEAP_DATA_VIEW;function updateMemoryViews(){var J=wasmMemory.buffer;Y.HEAP_DATA_VIEW=HEAP_DATA_VIEW=new DataView(J),Y.HEAP8=HEAP8=new Int8Array(J),Y.HEAP16=HEAP16=new Int16Array(J),Y.HEAPU8=HEAPU8=new Uint8Array(J),Y.HEAPU16=HEAPU16=new Uint16Array(J),Y.HEAP32=HEAP32=new Int32Array(J),Y.HEAPU32=HEAPU32=new Uint32Array(J),Y.HEAPF32=HEAPF32=new Float32Array(J),Y.HEAPF64=HEAPF64=new Float64Array(J)}if(Y.wasmMemory)wasmMemory=Y.wasmMemory;else{var INITIAL_MEMORY=Y.INITIAL_MEMORY||33554432;wasmMemory=new WebAssembly.Memory({initial:INITIAL_MEMORY/65536,maximum:32768})}updateMemoryViews();var __ATPRERUN__=[],__ATINIT__=[],__ATMAIN__=[],__ATPOSTRUN__=[],__RELOC_FUNCS__=[],runtimeInitialized=!1;function preRun(){if(Y.preRun){if(typeof Y.preRun=="function")Y.preRun=[Y.preRun];while(Y.preRun.length)addOnPreRun(Y.preRun.shift())}callRuntimeCallbacks(__ATPRERUN__)}function initRuntime(){runtimeInitialized=!0,callRuntimeCallbacks(__RELOC_FUNCS__),callRuntimeCallbacks(__ATINIT__)}function preMain(){callRuntimeCallbacks(__ATMAIN__)}function postRun(){if(Y.postRun){if(typeof Y.postRun=="function")Y.postRun=[Y.postRun];while(Y.postRun.length)addOnPostRun(Y.postRun.shift())}callRuntimeCallbacks(__ATPOSTRUN__)}function addOnPreRun(J){__ATPRERUN__.unshift(J)}function addOnInit(J){__ATINIT__.unshift(J)}function addOnPostRun(J){__ATPOSTRUN__.unshift(J)}var runDependencies=0,runDependencyWatcher=null,dependenciesFulfilled=null;function getUniqueRunDependency(J){return J}function addRunDependency(J){runDependencies++,Y.monitorRunDependencies?.(runDependencies)}function removeRunDependency(J){if(runDependencies--,Y.monitorRunDependencies?.(runDependencies),runDependencies==0){if(runDependencyWatcher!==null)clearInterval(runDependencyWatcher),runDependencyWatcher=null;if(dependenciesFulfilled){var Q=dependenciesFulfilled;dependenciesFulfilled=null,Q()}}}function abort(J){Y.onAbort?.(J),J="Aborted("+J+")",err(J),ABORT=!0,EXITSTATUS=1,J+=". Build with -sASSERTIONS for more info.";var Q=new WebAssembly.RuntimeError(J);throw Q}var dataURIPrefix="data:application/octet-stream;base64,",isDataURI=(J)=>J.startsWith(dataURIPrefix),isFileURI=(J)=>J.startsWith("file://");function findWasmBinary(){var J="tree-sitter.wasm";if(!isDataURI(J))return locateFile(J);return J}var wasmBinaryFile;function getBinarySync(J){if(J==wasmBinaryFile&&wasmBinary)return new Uint8Array(wasmBinary);if(readBinary)return readBinary(J);throw"both async and sync fetching of the wasm failed"}function getBinaryPromise(J){if(!wasmBinary)return readAsync(J).then((Q)=>new Uint8Array(Q),()=>getBinarySync(J));return Promise.resolve().then(()=>getBinarySync(J))}function instantiateArrayBuffer(J,Q,$){return getBinaryPromise(J).then((Z)=>WebAssembly.instantiate(Z,Q)).then($,(Z)=>{err(`failed to asynchronously prepare wasm: ${Z}`),abort(Z)})}function instantiateAsync(J,Q,$,Z){if(!J&&typeof WebAssembly.instantiateStreaming=="function"&&!isDataURI(Q)&&!isFileURI(Q)&&!pQ&&typeof fetch=="function")return fetch(Q,{credentials:"same-origin"}).then((X)=>{var K=WebAssembly.instantiateStreaming(X,$);return K.then(Z,function(G){return err(`wasm streaming compile failed: ${G}`),err("falling back to ArrayBuffer instantiation"),instantiateArrayBuffer(Q,$,Z)})});return instantiateArrayBuffer(Q,$,Z)}function getWasmImports(){return{env:wasmImports,wasi_snapshot_preview1:wasmImports,"GOT.mem":new Proxy(wasmImports,GOTHandler),"GOT.func":new Proxy(wasmImports,GOTHandler)}}function createWasm(){var J=getWasmImports();function Q(Z,X){wasmExports=Z.exports,wasmExports=relocateExports(wasmExports,1024);var K=getDylinkMetadata(X);if(K.neededDynlibs)dynamicLibraries=K.neededDynlibs.concat(dynamicLibraries);return 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 $(Z){Q(Z.instance,Z.module)}if(Y.instantiateWasm)try{return Y.instantiateWasm(J,Q)}catch(Z){return err(`Module.instantiateWasm callback failed with error: ${Z}`),!1}if(!wasmBinaryFile)wasmBinaryFile=findWasmBinary();return instantiateAsync(wasmBinary,wasmBinaryFile,J,$),{}}var ASM_CONSTS={};function ExitStatus(J){this.name="ExitStatus",this.message=`Program terminated with exit(${J})`,this.status=J}var GOT={},currentModuleWeakSymbols=new Set([]),GOTHandler={get(J,Q){var $=GOT[Q];if(!$)$=GOT[Q]=new WebAssembly.Global({value:"i32",mutable:!0});if(!currentModuleWeakSymbols.has(Q))$.required=!0;return $}},LE_HEAP_LOAD_F32=(J)=>HEAP_DATA_VIEW.getFloat32(J,!0),LE_HEAP_LOAD_F64=(J)=>HEAP_DATA_VIEW.getFloat64(J,!0),LE_HEAP_LOAD_I16=(J)=>HEAP_DATA_VIEW.getInt16(J,!0),LE_HEAP_LOAD_I32=(J)=>HEAP_DATA_VIEW.getInt32(J,!0),LE_HEAP_LOAD_U32=(J)=>HEAP_DATA_VIEW.getUint32(J,!0),LE_HEAP_STORE_F32=(J,Q)=>HEAP_DATA_VIEW.setFloat32(J,Q,!0),LE_HEAP_STORE_F64=(J,Q)=>HEAP_DATA_VIEW.setFloat64(J,Q,!0),LE_HEAP_STORE_I16=(J,Q)=>HEAP_DATA_VIEW.setInt16(J,Q,!0),LE_HEAP_STORE_I32=(J,Q)=>HEAP_DATA_VIEW.setInt32(J,Q,!0),LE_HEAP_STORE_U32=(J,Q)=>HEAP_DATA_VIEW.setUint32(J,Q,!0),callRuntimeCallbacks=(J)=>{while(J.length>0)J.shift()(Y)},UTF8Decoder=typeof TextDecoder<"u"?new TextDecoder:void 0,UTF8ArrayToString=(J,Q,$)=>{var Z=Q+$,X=Q;while(J[X]&&!(X>=Z))++X;if(X-Q>16&&J.buffer&&UTF8Decoder)return UTF8Decoder.decode(J.subarray(Q,X));var K="";while(Q<X){var G=J[Q++];if(!(G&128)){K+=String.fromCharCode(G);continue}var z=J[Q++]&63;if((G&224)==192){K+=String.fromCharCode((G&31)<<6|z);continue}var V=J[Q++]&63;if((G&240)==224)G=(G&15)<<12|z<<6|V;else G=(G&7)<<18|z<<12|V<<6|J[Q++]&63;if(G<65536)K+=String.fromCharCode(G);else{var H=G-65536;K+=String.fromCharCode(55296|H>>10,56320|H&1023)}}return K},getDylinkMetadata=(J)=>{var Q=0,$=0;function Z(){return J[Q++]}function X(){var P=0,k=1;while(!0){var B=J[Q++];if(P+=(B&127)*k,k*=128,!(B&128))break}return P}function K(){var P=X();return Q+=P,UTF8ArrayToString(J,Q-P,P)}function G(P,k){if(P)throw Error(k)}var z="dylink.0";if(J instanceof WebAssembly.Module){var V=WebAssembly.Module.customSections(J,z);if(V.length===0)z="dylink",V=WebAssembly.Module.customSections(J,z);G(V.length===0,"need dylink section"),J=new Uint8Array(V[0]),$=J.length}else{var H=new Uint32Array(new Uint8Array(J.subarray(0,24)).buffer),U=H[0]==1836278016||H[0]==6386541;G(!U,"need to see wasm magic number"),G(J[8]!==0,"need the dylink section to be first"),Q=9;var q=X();$=Q+q,z=K()}var W={neededDynlibs:[],tlsExports:new Set,weakImports:new Set};if(z=="dylink"){W.memorySize=X(),W.memoryAlign=X(),W.tableSize=X(),W.tableAlign=X();var F=X();for(var T=0;T<F;++T){var A=K();W.neededDynlibs.push(A)}}else{G(z!=="dylink.0");var O=1,j=2,D=3,E=4,w=256,R=3,I=1;while(Q<$){var L=Z(),h=X();if(L===O)W.memorySize=X(),W.memoryAlign=X(),W.tableSize=X(),W.tableAlign=X();else if(L===j){var F=X();for(var T=0;T<F;++T)A=K(),W.neededDynlibs.push(A)}else if(L===D){var f=X();while(f--){var M=K(),m=X();if(m&w)W.tlsExports.add(M)}}else if(L===E){var f=X();while(f--){var o=K(),M=K(),m=X();if((m&R)==I)W.weakImports.add(M)}}else Q+=h}}return W};function getValue(J,Q="i8"){if(Q.endsWith("*"))Q="*";switch(Q){case"i1":return HEAP8[J];case"i8":return HEAP8[J];case"i16":return LE_HEAP_LOAD_I16((J>>1)*2);case"i32":return LE_HEAP_LOAD_I32((J>>2)*4);case"i64":abort("to do getValue(i64) use WASM_BIGINT");case"float":return LE_HEAP_LOAD_F32((J>>2)*4);case"double":return LE_HEAP_LOAD_F64((J>>3)*8);case"*":return LE_HEAP_LOAD_U32((J>>2)*4);default:abort(`invalid type for getValue: ${Q}`)}}var newDSO=(J,Q,$)=>{var Z={refcount:1/0,name:J,exports:$,global:!0};if(LDSO.loadedLibsByName[J]=Z,Q!=null)LDSO.loadedLibsByHandle[Q]=Z;return Z},LDSO={loadedLibsByName:{},loadedLibsByHandle:{},init(){newDSO("__main__",0,wasmImports)}},___heap_base=78112,zeroMemory=(J,Q)=>{return HEAPU8.fill(0,J,J+Q),J},alignMemory=(J,Q)=>Math.ceil(J/Q)*Q,getMemory=(J)=>{if(runtimeInitialized)return zeroMemory(_malloc(J),J);var Q=___heap_base,$=Q+alignMemory(J,16);return ___heap_base=$,GOT.__heap_base.value=$,Q},isInternalSym=(J)=>["__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(J)||J.startsWith("__em_js__"),uleb128Encode=(J,Q)=>{if(J<128)Q.push(J);else Q.push(J%128|128,J>>7)},sigToWasmTypes=(J)=>{var Q={i:"i32",j:"i64",f:"f32",d:"f64",e:"externref",p:"i32"},$={parameters:[],results:J[0]=="v"?[]:[Q[J[0]]]};for(var Z=1;Z<J.length;++Z)$.parameters.push(Q[J[Z]]);return $},generateFuncType=(J,Q)=>{var $=J.slice(0,1),Z=J.slice(1),X={i:127,p:127,j:126,f:125,d:124,e:111};Q.push(96),uleb128Encode(Z.length,Q);for(var K=0;K<Z.length;++K)Q.push(X[Z[K]]);if($=="v")Q.push(0);else Q.push(1,X[$])},convertJsFunctionToWasm=(J,Q)=>{if(typeof WebAssembly.Function=="function")return new WebAssembly.Function(sigToWasmTypes(Q),J);var $=[1];generateFuncType(Q,$);var Z=[0,97,115,109,1,0,0,0,1];uleb128Encode($.length,Z),Z.push(...$),Z.push(2,7,1,1,101,1,102,0,0,7,5,1,1,102,0,0);var X=new WebAssembly.Module(new Uint8Array(Z)),K=new WebAssembly.Instance(X,{e:{f:J}}),G=K.exports.f;return G},wasmTableMirror=[],wasmTable=new WebAssembly.Table({initial:28,element:"anyfunc"}),getWasmTableEntry=(J)=>{var Q=wasmTableMirror[J];if(!Q){if(J>=wasmTableMirror.length)wasmTableMirror.length=J+1;wasmTableMirror[J]=Q=wasmTable.get(J)}return Q},updateTableMap=(J,Q)=>{if(functionsInTableMap)for(var $=J;$<J+Q;$++){var Z=getWasmTableEntry($);if(Z)functionsInTableMap.set(Z,$)}},functionsInTableMap,getFunctionAddress=(J)=>{if(!functionsInTableMap)functionsInTableMap=new WeakMap,updateTableMap(0,wasmTable.length);return functionsInTableMap.get(J)||0},freeTableIndexes=[],getEmptyTableSlot=()=>{if(freeTableIndexes.length)return freeTableIndexes.pop();try{wasmTable.grow(1)}catch(J){if(!(J instanceof RangeError))throw J;throw"Unable to grow wasm table. Set ALLOW_TABLE_GROWTH."}return wasmTable.length-1},setWasmTableEntry=(J,Q)=>{wasmTable.set(J,Q),wasmTableMirror[J]=wasmTable.get(J)},addFunction=(J,Q)=>{var $=getFunctionAddress(J);if($)return $;var Z=getEmptyTableSlot();try{setWasmTableEntry(Z,J)}catch(K){if(!(K instanceof TypeError))throw K;var X=convertJsFunctionToWasm(J,Q);setWasmTableEntry(Z,X)}return functionsInTableMap.set(J,Z),Z},updateGOT=(J,Q)=>{for(var $ in J){if(isInternalSym($))continue;var Z=J[$];if($.startsWith("orig$"))$=$.split("$")[1],Q=!0;if(GOT[$]||=new WebAssembly.Global({value:"i32",mutable:!0}),Q||GOT[$].value==0)if(typeof Z=="function")GOT[$].value=addFunction(Z);else if(typeof Z=="number")GOT[$].value=Z;else err(`unhandled export type for '${$}': ${typeof Z}`)}},relocateExports=(J,Q,$)=>{var Z={};for(var X in J){var K=J[X];if(typeof K=="object")K=K.value;if(typeof K=="number")K+=Q;Z[X]=K}return updateGOT(Z,$),Z},isSymbolDefined=(J)=>{var Q=wasmImports[J];if(!Q||Q.stub)return!1;return!0},dynCallLegacy=(J,Q,$)=>{J=J.replace(/p/g,"i");var Z=Y["dynCall_"+J];return Z(Q,...$)},dynCall=(J,Q,$=[])=>{if(J.includes("j"))return dynCallLegacy(J,Q,$);var Z=getWasmTableEntry(Q)(...$);return Z},stackSave=()=>_emscripten_stack_get_current(),stackRestore=(J)=>__emscripten_stack_restore(J),createInvokeFunction=(J)=>(Q,...$)=>{var Z=stackSave();try{return dynCall(J,Q,$)}catch(X){if(stackRestore(Z),X!==X+0)throw X;_setThrew(1,0)}},resolveGlobalSymbol=(J,Q=!1)=>{var $;if(Q&&"orig$"+J in wasmImports)J="orig$"+J;if(isSymbolDefined(J))$=wasmImports[J];else if(J.startsWith("invoke_"))$=wasmImports[J]=createInvokeFunction(J.split("_")[1]);return{sym:$,name:J}},UTF8ToString=(J,Q)=>J?UTF8ArrayToString(HEAPU8,J,Q):"",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;if(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;if(tableGrowthNeeded>0)wasmTable.grow(tableGrowthNeeded);var moduleExports;function resolveSymbol(J){var Q=resolveGlobalSymbol(J).sym;if(!Q&&localScope)Q=localScope[J];if(!Q)Q=moduleExports[J];return Q}var proxyHandler={get(J,Q){switch(Q){case"__memory_base":return memoryBase;case"__table_base":return tableBase}if(Q in wasmImports&&!wasmImports[Q].stub)return wasmImports[Q];if(!(Q in J)){var $;J[Q]=(...Z)=>{return $||=resolveSymbol(Q),$(...Z)}}return J[Q]}},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){if(updateTableMap(tableBase,metadata.tableSize),moduleExports=relocateExports(instance.exports,memoryBase),!flags.allowUndefined)reportUndefinedSymbols();function addEmAsm(addr,body){var args=[],arity=0;for(;arity<16;arity++)if(body.indexOf("$"+arity)!=-1)args.push("$"+arity);else break;args=args.join(",");var func=`(${args}) => { ${body} };`;ASM_CONSTS[start]=eval(func)}if("__start_em_asm"in moduleExports){var{__start_em_asm:start,__stop_em_asm:stop}=moduleExports;while(start<stop){var jsString=UTF8ToString(start);addEmAsm(start,jsString),start=HEAPU8.indexOf(0,start)+1}}function addEmJs(name,cSig,body){var jsArgs=[];if(cSig=cSig.slice(1,-1),cSig!="void"){cSig=cSig.split(",");for(var i in cSig){var jsArg=cSig[i].split(" ").pop();jsArgs.push(jsArg.replace("*",""))}}var func=`(${jsArgs}) => ${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;if(applyRelocs)if(runtimeInitialized)applyRelocs();else __RELOC_FUNCS__.push(applyRelocs);var init=moduleExports.__wasm_call_ctors;if(init)if(runtimeInitialized)init();else __ATINIT__.push(init);return 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((J)=>postInstantiation(J.module,J.instance))}var module=binary instanceof WebAssembly.Module?binary:new WebAssembly.Module(binary),instance=new WebAssembly.Instance(module,info);return postInstantiation(module,instance)}if(flags.loadAsync)return metadata.neededDynlibs.reduce((J,Q)=>J.then(()=>loadDynamicLibrary(Q,flags,localScope)),Promise.resolve()).then(loadModule);return metadata.neededDynlibs.forEach((J)=>loadDynamicLibrary(J,flags,localScope)),loadModule()},mergeLibSymbols=(J,Q)=>{for(var[$,Z]of Object.entries(J)){let X=(G)=>{if(!isSymbolDefined(G))wasmImports[G]=Z};X($);let K="__main_argc_argv";if($=="main")X(K);if($==K)X("main");if($.startsWith("dynCall_")&&!Y.hasOwnProperty($))Y[$]=Z}},asyncLoad=(J,Q,$,Z)=>{var X=!Z?getUniqueRunDependency(`al ${J}`):"";if(readAsync(J).then((K)=>{if(Q(new Uint8Array(K)),X)removeRunDependency(X)},(K)=>{if($)$();else throw`Loading data file "${J}" failed.`}),X)addRunDependency(X)};function loadDynamicLibrary(J,Q={global:!0,nodelete:!0},$,Z){var X=LDSO.loadedLibsByName[J];if(X){if(!Q.global){if($)Object.assign($,X.exports)}else if(!X.global)X.global=!0,mergeLibSymbols(X.exports,J);if(Q.nodelete&&X.refcount!==1/0)X.refcount=1/0;if(X.refcount++,Z)LDSO.loadedLibsByHandle[Z]=X;return Q.loadAsync?Promise.resolve(!0):!0}X=newDSO(J,Z,"loading"),X.refcount=Q.nodelete?1/0:1,X.global=Q.global;function K(){if(Z){var V=LE_HEAP_LOAD_U32((Z+28>>2)*4),H=LE_HEAP_LOAD_U32((Z+32>>2)*4);if(V&&H){var U=HEAP8.slice(V,V+H);return Q.loadAsync?Promise.resolve(U):U}}var q=locateFile(J);if(Q.loadAsync)return new Promise(function(W,F){asyncLoad(q,W,F)});if(!readBinary)throw Error(`${q}: file not found, and synchronous loading of external files is not available`);return readBinary(q)}function G(){if(Q.loadAsync)return K().then((V)=>loadWebAssemblyModule(V,Q,J,$,Z));return loadWebAssemblyModule(K(),Q,J,$,Z)}function z(V){if(X.global)mergeLibSymbols(V,J);else if($)Object.assign($,V);X.exports=V}if(Q.loadAsync)return G().then((V)=>{return z(V),!0});return z(G()),!0}var reportUndefinedSymbols=()=>{for(var[J,Q]of Object.entries(GOT))if(Q.value==0){var $=resolveGlobalSymbol(J,!0).sym;if(!$&&!Q.required)continue;if(typeof $=="function")Q.value=addFunction($,$.sig);else if(typeof $=="number")Q.value=$;else throw Error(`bad export type for '${J}': ${typeof $}`)}},loadDylibs=()=>{if(!dynamicLibraries.length){reportUndefinedSymbols();return}addRunDependency("loadDylibs"),dynamicLibraries.reduce((J,Q)=>J.then(()=>loadDynamicLibrary(Q,{loadAsync:!0,global:!0,nodelete:!0,allowUndefined:!0})),Promise.resolve()).then(()=>{reportUndefinedSymbols(),removeRunDependency("loadDylibs")})},noExitRuntime=Y.noExitRuntime||!0;function setValue(J,Q,$="i8"){if($.endsWith("*"))$="*";switch($){case"i1":HEAP8[J]=Q;break;case"i8":HEAP8[J]=Q;break;case"i16":LE_HEAP_STORE_I16((J>>1)*2,Q);break;case"i32":LE_HEAP_STORE_I32((J>>2)*4,Q);break;case"i64":abort("to do setValue(i64) use WASM_BIGINT");case"float":LE_HEAP_STORE_F32((J>>2)*4,Q);break;case"double":LE_HEAP_STORE_F64((J>>3)*8,Q);break;case"*":LE_HEAP_STORE_U32((J>>2)*4,Q);break;default:abort(`invalid type for setValue: ${$}`)}}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=(J,Q,$)=>HEAPU8.copyWithin(J,Q,Q+$);__emscripten_memcpy_js.sig="vppp";var _emscripten_date_now=()=>Date.now();_emscripten_date_now.sig="d";var _emscripten_get_now=()=>performance.now();_emscripten_get_now.sig="d";var getHeapMax=()=>2147483648,growMemory=(J)=>{var Q=wasmMemory.buffer,$=(J-Q.byteLength+65535)/65536;try{return wasmMemory.grow($),updateMemoryViews(),1}catch(Z){}},_emscripten_resize_heap=(J)=>{var Q=HEAPU8.length;J>>>=0;var $=getHeapMax();if(J>$)return!1;var Z=(V,H)=>V+(H-V%H)%H;for(var X=1;X<=4;X*=2){var K=Q*(1+0.2/X);K=Math.min(K,J+100663296);var G=Math.min($,Z(Math.max(J,K),65536)),z=growMemory(G);if(z)return!0}return!1};_emscripten_resize_heap.sig="ip";var _fd_close=(J)=>52;_fd_close.sig="ii";var convertI32PairToI53Checked=(J,Q)=>Q+2097152>>>0<4194305-!!J?(J>>>0)+Q*4294967296:NaN;function _fd_seek(J,Q,$,Z,X){var K=convertI32PairToI53Checked(Q,$);return 70}_fd_seek.sig="iiiiip";var printCharBuffers=[null,[],[]],printChar=(J,Q)=>{var $=printCharBuffers[J];if(Q===0||Q===10)(J===1?out:err)(UTF8ArrayToString($,0)),$.length=0;else $.push(Q)},_fd_write=(J,Q,$,Z)=>{var X=0;for(var K=0;K<$;K++){var G=LE_HEAP_LOAD_U32((Q>>2)*4),z=LE_HEAP_LOAD_U32((Q+4>>2)*4);Q+=8;for(var V=0;V<z;V++)printChar(J,HEAPU8[G+V]);X+=z}return LE_HEAP_STORE_U32((Z>>2)*4,X),0};_fd_write.sig="iippp";function _tree_sitter_log_callback(J,Q){if(currentLogCallback){let $=UTF8ToString(Q);currentLogCallback($,J!==0)}}function _tree_sitter_parse_callback(J,Q,$,Z,X){let G=currentParseCallback(Q,{row:$,column:Z});if(typeof G==="string")setValue(X,G.length,"i32"),stringToUTF16(G,J,10240);else setValue(X,0,"i32")}var runtimeKeepaliveCounter=0,keepRuntimeAlive=()=>noExitRuntime||runtimeKeepaliveCounter>0,_proc_exit=(J)=>{if(EXITSTATUS=J,!keepRuntimeAlive())Y.onExit?.(J),ABORT=!0;quit_(J,new ExitStatus(J))};_proc_exit.sig="vi";var exitJS=(J,Q)=>{EXITSTATUS=J,_proc_exit(J)},handleException=(J)=>{if(J instanceof ExitStatus||J=="unwind")return EXITSTATUS;quit_(1,J)},lengthBytesUTF8=(J)=>{var Q=0;for(var $=0;$<J.length;++$){var Z=J.charCodeAt($);if(Z<=127)Q++;else if(Z<=2047)Q+=2;else if(Z>=55296&&Z<=57343)Q+=4,++$;else Q+=3}return Q},stringToUTF8Array=(J,Q,$,Z)=>{if(!(Z>0))return 0;var X=$,K=$+Z-1;for(var G=0;G<J.length;++G){var z=J.charCodeAt(G);if(z>=55296&&z<=57343){var V=J.charCodeAt(++G);z=65536+((z&1023)<<10)|V&1023}if(z<=127){if($>=K)break;Q[$++]=z}else if(z<=2047){if($+1>=K)break;Q[$++]=192|z>>6,Q[$++]=128|z&63}else if(z<=65535){if($+2>=K)break;Q[$++]=224|z>>12,Q[$++]=128|z>>6&63,Q[$++]=128|z&63}else{if($+3>=K)break;Q[$++]=240|z>>18,Q[$++]=128|z>>12&63,Q[$++]=128|z>>6&63,Q[$++]=128|z&63}}return Q[$]=0,$-X},stringToUTF8=(J,Q,$)=>stringToUTF8Array(J,HEAPU8,Q,$),stackAlloc=(J)=>__emscripten_stack_alloc(J),stringToUTF8OnStack=(J)=>{var Q=lengthBytesUTF8(J)+1,$=stackAlloc(Q);return stringToUTF8(J,$,Q),$},stringToUTF16=(J,Q,$)=>{if($??=2147483647,$<2)return 0;$-=2;var Z=Q,X=$<J.length*2?$/2:J.length;for(var K=0;K<X;++K){var G=J.charCodeAt(K);LE_HEAP_STORE_I16((Q>>1)*2,G),Q+=2}return LE_HEAP_STORE_I16((Q>>1)*2,0),Q-Z},AsciiToString=(J)=>{var Q="";while(!0){var $=HEAPU8[J++];if(!$)return Q;Q+=String.fromCharCode($)}},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=Y._malloc=(J)=>(_malloc=Y._malloc=wasmExports.malloc)(J),_calloc=Y._calloc=(J,Q)=>(_calloc=Y._calloc=wasmExports.calloc)(J,Q),_realloc=Y._realloc=(J,Q)=>(_realloc=Y._realloc=wasmExports.realloc)(J,Q),_free=Y._free=(J)=>(_free=Y._free=wasmExports.free)(J),_ts_language_symbol_count=Y._ts_language_symbol_count=(J)=>(_ts_language_symbol_count=Y._ts_language_symbol_count=wasmExports.ts_language_symbol_count)(J),_ts_language_state_count=Y._ts_language_state_count=(J)=>(_ts_language_state_count=Y._ts_language_state_count=wasmExports.ts_language_state_count)(J),_ts_language_version=Y._ts_language_version=(J)=>(_ts_language_version=Y._ts_language_version=wasmExports.ts_language_version)(J),_ts_language_field_count=Y._ts_language_field_count=(J)=>(_ts_language_field_count=Y._ts_language_field_count=wasmExports.ts_language_field_count)(J),_ts_language_next_state=Y._ts_language_next_state=(J,Q,$)=>(_ts_language_next_state=Y._ts_language_next_state=wasmExports.ts_language_next_state)(J,Q,$),_ts_language_symbol_name=Y._ts_language_symbol_name=(J,Q)=>(_ts_language_symbol_name=Y._ts_language_symbol_name=wasmExports.ts_language_symbol_name)(J,Q),_ts_language_symbol_for_name=Y._ts_language_symbol_for_name=(J,Q,$,Z)=>(_ts_language_symbol_for_name=Y._ts_language_symbol_for_name=wasmExports.ts_language_symbol_for_name)(J,Q,$,Z),_strncmp=Y._strncmp=(J,Q,$)=>(_strncmp=Y._strncmp=wasmExports.strncmp)(J,Q,$),_ts_language_symbol_type=Y._ts_language_symbol_type=(J,Q)=>(_ts_language_symbol_type=Y._ts_language_symbol_type=wasmExports.ts_language_symbol_type)(J,Q),_ts_language_field_name_for_id=Y._ts_language_field_name_for_id=(J,Q)=>(_ts_language_field_name_for_id=Y._ts_language_field_name_for_id=wasmExports.ts_language_field_name_for_id)(J,Q),_ts_lookahead_iterator_new=Y._ts_lookahead_iterator_new=(J,Q)=>(_ts_lookahead_iterator_new=Y._ts_lookahead_iterator_new=wasmExports.ts_lookahead_iterator_new)(J,Q),_ts_lookahead_iterator_delete=Y._ts_lookahead_iterator_delete=(J)=>(_ts_lookahead_iterator_delete=Y._ts_lookahead_iterator_delete=wasmExports.ts_lookahead_iterator_delete)(J),_ts_lookahead_iterator_reset_state=Y._ts_lookahead_iterator_reset_state=(J,Q)=>(_ts_lookahead_iterator_reset_state=Y._ts_lookahead_iterator_reset_state=wasmExports.ts_lookahead_iterator_reset_state)(J,Q),_ts_lookahead_iterator_reset=Y._ts_lookahead_iterator_reset=(J,Q,$)=>(_ts_lookahead_iterator_reset=Y._ts_lookahead_iterator_reset=wasmExports.ts_lookahead_iterator_reset)(J,Q,$),_ts_lookahead_iterator_next=Y._ts_lookahead_iterator_next=(J)=>(_ts_lookahead_iterator_next=Y._ts_lookahead_iterator_next=wasmExports.ts_lookahead_iterator_next)(J),_ts_lookahead_iterator_current_symbol=Y._ts_lookahead_iterator_current_symbol=(J)=>(_ts_lookahead_iterator_current_symbol=Y._ts_lookahead_iterator_current_symbol=wasmExports.ts_lookahead_iterator_current_symbol)(J),_memset=Y._memset=(J,Q,$)=>(_memset=Y._memset=wasmExports.memset)(J,Q,$),_memcpy=Y._memcpy=(J,Q,$)=>(_memcpy=Y._memcpy=wasmExports.memcpy)(J,Q,$),_ts_parser_delete=Y._ts_parser_delete=(J)=>(_ts_parser_delete=Y._ts_parser_delete=wasmExports.ts_parser_delete)(J),_ts_parser_reset=Y._ts_parser_reset=(J)=>(_ts_parser_reset=Y._ts_parser_reset=wasmExports.ts_parser_reset)(J),_ts_parser_set_language=Y._ts_parser_set_language=(J,Q)=>(_ts_parser_set_language=Y._ts_parser_set_language=wasmExports.ts_parser_set_language)(J,Q),_ts_parser_timeout_micros=Y._ts_parser_timeout_micros=(J)=>(_ts_parser_timeout_micros=Y._ts_parser_timeout_micros=wasmExports.ts_parser_timeout_micros)(J),_ts_parser_set_timeout_micros=Y._ts_parser_set_timeout_micros=(J,Q,$)=>(_ts_parser_set_timeout_micros=Y._ts_parser_set_timeout_micros=wasmExports.ts_parser_set_timeout_micros)(J,Q,$),_ts_parser_set_included_ranges=Y._ts_parser_set_included_ranges=(J,Q,$)=>(_ts_parser_set_included_ranges=Y._ts_parser_set_included_ranges=wasmExports.ts_parser_set_included_ranges)(J,Q,$),_memmove=Y._memmove=(J,Q,$)=>(_memmove=Y._memmove=wasmExports.memmove)(J,Q,$),_memcmp=Y._memcmp=(J,Q,$)=>(_memcmp=Y._memcmp=wasmExports.memcmp)(J,Q,$),_ts_query_new=Y._ts_query_new=(J,Q,$,Z,X)=>(_ts_query_new=Y._ts_query_new=wasmExports.ts_query_new)(J,Q,$,Z,X),_ts_query_delete=Y._ts_query_delete=(J)=>(_ts_query_delete=Y._ts_query_delete=wasmExports.ts_query_delete)(J),_iswspace=Y._iswspace=(J)=>(_iswspace=Y._iswspace=wasmExports.iswspace)(J),_iswalnum=Y._iswalnum=(J)=>(_iswalnum=Y._iswalnum=wasmExports.iswalnum)(J),_ts_query_pattern_count=Y._ts_query_pattern_count=(J)=>(_ts_query_pattern_count=Y._ts_query_pattern_count=wasmExports.ts_query_pattern_count)(J),_ts_query_capture_count=Y._ts_query_capture_count=(J)=>(_ts_query_capture_count=Y._ts_query_capture_count=wasmExports.ts_query_capture_count)(J),_ts_query_string_count=Y._ts_query_string_count=(J)=>(_ts_query_string_count=Y._ts_query_string_count=wasmExports.ts_query_string_count)(J),_ts_query_capture_name_for_id=Y._ts_query_capture_name_for_id=(J,Q,$)=>(_ts_query_capture_name_for_id=Y._ts_query_capture_name_for_id=wasmExports.ts_query_capture_name_for_id)(J,Q,$),_ts_query_string_value_for_id=Y._ts_query_string_value_for_id=(J,Q,$)=>(_ts_query_string_value_for_id=Y._ts_query_string_value_for_id=wasmExports.ts_query_string_value_for_id)(J,Q,$),_ts_query_predicates_for_pattern=Y._ts_query_predicates_for_pattern=(J,Q,$)=>(_ts_query_predicates_for_pattern=Y._ts_query_predicates_for_pattern=wasmExports.ts_query_predicates_for_pattern)(J,Q,$),_ts_query_disable_capture=Y._ts_query_disable_capture=(J,Q,$)=>(_ts_query_disable_capture=Y._ts_query_disable_capture=wasmExports.ts_query_disable_capture)(J,Q,$),_ts_tree_copy=Y._ts_tree_copy=(J)=>(_ts_tree_copy=Y._ts_tree_copy=wasmExports.ts_tree_copy)(J),_ts_tree_delete=Y._ts_tree_delete=(J)=>(_ts_tree_delete=Y._ts_tree_delete=wasmExports.ts_tree_delete)(J),_ts_init=Y._ts_init=()=>(_ts_init=Y._ts_init=wasmExports.ts_init)(),_ts_parser_new_wasm=Y._ts_parser_new_wasm=()=>(_ts_parser_new_wasm=Y._ts_parser_new_wasm=wasmExports.ts_parser_new_wasm)(),_ts_parser_enable_logger_wasm=Y._ts_parser_enable_logger_wasm=(J,Q)=>(_ts_parser_enable_logger_wasm=Y._ts_parser_enable_logger_wasm=wasmExports.ts_parser_enable_logger_wasm)(J,Q),_ts_parser_parse_wasm=Y._ts_parser_parse_wasm=(J,Q,$,Z,X)=>(_ts_parser_parse_wasm=Y._ts_parser_parse_wasm=wasmExports.ts_parser_parse_wasm)(J,Q,$,Z,X),_ts_parser_included_ranges_wasm=Y._ts_parser_included_ranges_wasm=(J)=>(_ts_parser_included_ranges_wasm=Y._ts_parser_included_ranges_wasm=wasmExports.ts_parser_included_ranges_wasm)(J),_ts_language_type_is_named_wasm=Y._ts_language_type_is_named_wasm=(J,Q)=>(_ts_language_type_is_named_wasm=Y._ts_language_type_is_named_wasm=wasmExports.ts_language_type_is_named_wasm)(J,Q),_ts_language_type_is_visible_wasm=Y._ts_language_type_is_visible_wasm=(J,Q)=>(_ts_language_type_is_visible_wasm=Y._ts_language_type_is_visible_wasm=wasmExports.ts_language_type_is_visible_wasm)(J,Q),_ts_tree_root_node_wasm=Y._ts_tree_root_node_wasm=(J)=>(_ts_tree_root_node_wasm=Y._ts_tree_root_node_wasm=wasmExports.ts_tree_root_node_wasm)(J),_ts_tree_root_node_with_offset_wasm=Y._ts_tree_root_node_with_offset_wasm=(J)=>(_ts_tree_root_node_with_offset_wasm=Y._ts_tree_root_node_with_offset_wasm=wasmExports.ts_tree_root_node_with_offset_wasm)(J),_ts_tree_edit_wasm=Y._ts_tree_edit_wasm=(J)=>(_ts_tree_edit_wasm=Y._ts_tree_edit_wasm=wasmExports.ts_tree_edit_wasm)(J),_ts_tree_included_ranges_wasm=Y._ts_tree_included_ranges_wasm=(J)=>(_ts_tree_included_ranges_wasm=Y._ts_tree_included_ranges_wasm=wasmExports.ts_tree_included_ranges_wasm)(J),_ts_tree_get_changed_ranges_wasm=Y._ts_tree_get_changed_ranges_wasm=(J,Q)=>(_ts_tree_get_changed_ranges_wasm=Y._ts_tree_get_changed_ranges_wasm=wasmExports.ts_tree_get_changed_ranges_wasm)(J,Q),_ts_tree_cursor_new_wasm=Y._ts_tree_cursor_new_wasm=(J)=>(_ts_tree_cursor_new_wasm=Y._ts_tree_cursor_new_wasm=wasmExports.ts_tree_cursor_new_wasm)(J),_ts_tree_cursor_delete_wasm=Y._ts_tree_cursor_delete_wasm=(J)=>(_ts_tree_cursor_delete_wasm=Y._ts_tree_cursor_delete_wasm=wasmExports.ts_tree_cursor_delete_wasm)(J),_ts_tree_cursor_reset_wasm=Y._ts_tree_cursor_reset_wasm=(J)=>(_ts_tree_cursor_reset_wasm=Y._ts_tree_cursor_reset_wasm=wasmExports.ts_tree_cursor_reset_wasm)(J),_ts_tree_cursor_reset_to_wasm=Y._ts_tree_cursor_reset_to_wasm=(J,Q)=>(_ts_tree_cursor_reset_to_wasm=Y._ts_tree_cursor_reset_to_wasm=wasmExports.ts_tree_cursor_reset_to_wasm)(J,Q),_ts_tree_cursor_goto_first_child_wasm=Y._ts_tree_cursor_goto_first_child_wasm=(J)=>(_ts_tree_cursor_goto_first_child_wasm=Y._ts_tree_cursor_goto_first_child_wasm=wasmExports.ts_tree_cursor_goto_first_child_wasm)(J),_ts_tree_cursor_goto_last_child_wasm=Y._ts_tree_cursor_goto_last_child_wasm=(J)=>(_ts_tree_cursor_goto_last_child_wasm=Y._ts_tree_cursor_goto_last_child_wasm=wasmExports.ts_tree_cursor_goto_last_child_wasm)(J),_ts_tree_cursor_goto_first_child_for_index_wasm=Y._ts_tree_cursor_goto_first_child_for_index_wasm=(J)=>(_ts_tree_cursor_goto_first_child_for_index_wasm=Y._ts_tree_cursor_goto_first_child_for_index_wasm=wasmExports.ts_tree_cursor_goto_first_child_for_index_wasm)(J),_ts_tree_cursor_goto_first_child_for_position_wasm=Y._ts_tree_cursor_goto_first_child_for_position_wasm=(J)=>(_ts_tree_cursor_goto_first_child_for_position_wasm=Y._ts_tree_cursor_goto_first_child_for_position_wasm=wasmExports.ts_tree_cursor_goto_first_child_for_position_wasm)(J),_ts_tree_cursor_goto_next_sibling_wasm=Y._ts_tree_cursor_goto_next_sibling_wasm=(J)=>(_ts_tree_cursor_goto_next_sibling_wasm=Y._ts_tree_cursor_goto_next_sibling_wasm=wasmExports.ts_tree_cursor_goto_next_sibling_wasm)(J),_ts_tree_cursor_goto_previous_sibling_wasm=Y._ts_tree_cursor_goto_previous_sibling_wasm=(J)=>(_ts_tree_cursor_goto_previous_sibling_wasm=Y._ts_tree_cursor_goto_previous_sibling_wasm=wasmExports.ts_tree_cursor_goto_previous_sibling_wasm)(J),_ts_tree_cursor_goto_descendant_wasm=Y._ts_tree_cursor_goto_descendant_wasm=(J,Q)=>(_ts_tree_cursor_goto_descendant_wasm=Y._ts_tree_cursor_goto_descendant_wasm=wasmExports.ts_tree_cursor_goto_descendant_wasm)(J,Q),_ts_tree_cursor_goto_parent_wasm=Y._ts_tree_cursor_goto_parent_wasm=(J)=>(_ts_tree_cursor_goto_parent_wasm=Y._ts_tree_cursor_goto_parent_wasm=wasmExports.ts_tree_cursor_goto_parent_wasm)(J),_ts_tree_cursor_current_node_type_id_wasm=Y._ts_tree_cursor_current_node_type_id_wasm=(J)=>(_ts_tree_cursor_current_node_type_id_wasm=Y._ts_tree_cursor_current_node_type_id_wasm=wasmExports.ts_tree_cursor_current_node_type_id_wasm)(J),_ts_tree_cursor_current_node_state_id_wasm=Y._ts_tree_cursor_current_node_state_id_wasm=(J)=>(_ts_tree_cursor_current_node_state_id_wasm=Y._ts_tree_cursor_current_node_state_id_wasm=wasmExports.ts_tree_cursor_current_node_state_id_wasm)(J),_ts_tree_cursor_current_node_is_named_wasm=Y._ts_tree_cursor_current_node_is_named_wasm=(J)=>(_ts_tree_cursor_current_node_is_named_wasm=Y._ts_tree_cursor_current_node_is_named_wasm=wasmExports.ts_tree_cursor_current_node_is_named_wasm)(J),_ts_tree_cursor_current_node_is_missing_wasm=Y._ts_tree_cursor_current_node_is_missing_wasm=(J)=>(_ts_tree_cursor_current_node_is_missing_wasm=Y._ts_tree_cursor_current_node_is_missing_wasm=wasmExports.ts_tree_cursor_current_node_is_missing_wasm)(J),_ts_tree_cursor_current_node_id_wasm=Y._ts_tree_cursor_current_node_id_wasm=(J)=>(_ts_tree_cursor_current_node_id_wasm=Y._ts_tree_cursor_current_node_id_wasm=wasmExports.ts_tree_cursor_current_node_id_wasm)(J),_ts_tree_cursor_start_position_wasm=Y._ts_tree_cursor_start_position_wasm=(J)=>(_ts_tree_cursor_start_position_wasm=Y._ts_tree_cursor_start_position_wasm=wasmExports.ts_tree_cursor_start_position_wasm)(J),_ts_tree_cursor_end_position_wasm=Y._ts_tree_cursor_end_position_wasm=(J)=>(_ts_tree_cursor_end_position_wasm=Y._ts_tree_cursor_end_position_wasm=wasmExports.ts_tree_cursor_end_position_wasm)(J),_ts_tree_cursor_start_index_wasm=Y._ts_tree_cursor_start_index_wasm=(J)=>(_ts_tree_cursor_start_index_wasm=Y._ts_tree_cursor_start_index_wasm=wasmExports.ts_tree_cursor_start_index_wasm)(J),_ts_tree_cursor_end_index_wasm=Y._ts_tree_cursor_end_index_wasm=(J)=>(_ts_tree_cursor_end_index_wasm=Y._ts_tree_cursor_end_index_wasm=wasmExports.ts_tree_cursor_end_index_wasm)(J),_ts_tree_cursor_current_field_id_wasm=Y._ts_tree_cursor_current_field_id_wasm=(J)=>(_ts_tree_cursor_current_field_id_wasm=Y._ts_tree_cursor_current_field_id_wasm=wasmExports.ts_tree_cursor_current_field_id_wasm)(J),_ts_tree_cursor_current_depth_wasm=Y._ts_tree_cursor_current_depth_wasm=(J)=>(_ts_tree_cursor_current_depth_wasm=Y._ts_tree_cursor_current_depth_wasm=wasmExports.ts_tree_cursor_current_depth_wasm)(J),_ts_tree_cursor_current_descendant_index_wasm=Y._ts_tree_cursor_current_descendant_index_wasm=(J)=>(_ts_tree_cursor_current_descendant_index_wasm=Y._ts_tree_cursor_current_descendant_index_wasm=wasmExports.ts_tree_cursor_current_descendant_index_wasm)(J),_ts_tree_cursor_current_node_wasm=Y._ts_tree_cursor_current_node_wasm=(J)=>(_ts_tree_cursor_current_node_wasm=Y._ts_tree_cursor_current_node_wasm=wasmExports.ts_tree_cursor_current_node_wasm)(J),_ts_node_symbol_wasm=Y._ts_node_symbol_wasm=(J)=>(_ts_node_symbol_wasm=Y._ts_node_symbol_wasm=wasmExports.ts_node_symbol_wasm)(J),_ts_node_field_name_for_child_wasm=Y._ts_node_field_name_for_child_wasm=(J,Q)=>(_ts_node_field_name_for_child_wasm=Y._ts_node_field_name_for_child_wasm=wasmExports.ts_node_field_name_for_child_wasm)(J,Q),_ts_node_children_by_field_id_wasm=Y._ts_node_children_by_field_id_wasm=(J,Q)=>(_ts_node_children_by_field_id_wasm=Y._ts_node_children_by_field_id_wasm=wasmExports.ts_node_children_by_field_id_wasm)(J,Q),_ts_node_first_child_for_byte_wasm=Y._ts_node_first_child_for_byte_wasm=(J)=>(_ts_node_first_child_for_byte_wasm=Y._ts_node_first_child_for_byte_wasm=wasmExports.ts_node_first_child_for_byte_wasm)(J),_ts_node_first_named_child_for_byte_wasm=Y._ts_node_first_named_child_for_byte_wasm=(J)=>(_ts_node_first_named_child_for_byte_wasm=Y._ts_node_first_named_child_for_byte_wasm=wasmExports.ts_node_first_named_child_for_byte_wasm)(J),_ts_node_grammar_symbol_wasm=Y._ts_node_grammar_symbol_wasm=(J)=>(_ts_node_grammar_symbol_wasm=Y._ts_node_grammar_symbol_wasm=wasmExports.ts_node_grammar_symbol_wasm)(J),_ts_node_child_count_wasm=Y._ts_node_child_count_wasm=(J)=>(_ts_node_child_count_wasm=Y._ts_node_child_count_wasm=wasmExports.ts_node_child_count_wasm)(J),_ts_node_named_child_count_wasm=Y._ts_node_named_child_count_wasm=(J)=>(_ts_node_named_child_count_wasm=Y._ts_node_named_child_count_wasm=wasmExports.ts_node_named_child_count_wasm)(J),_ts_node_child_wasm=Y._ts_node_child_wasm=(J,Q)=>(_ts_node_child_wasm=Y._ts_node_child_wasm=wasmExports.ts_node_child_wasm)(J,Q),_ts_node_named_child_wasm=Y._ts_node_named_child_wasm=(J,Q)=>(_ts_node_named_child_wasm=Y._ts_node_named_child_wasm=wasmExports.ts_node_named_child_wasm)(J,Q),_ts_node_child_by_field_id_wasm=Y._ts_node_child_by_field_id_wasm=(J,Q)=>(_ts_node_child_by_field_id_wasm=Y._ts_node_child_by_field_id_wasm=wasmExports.ts_node_child_by_field_id_wasm)(J,Q),_ts_node_next_sibling_wasm=Y._ts_node_next_sibling_wasm=(J)=>(_ts_node_next_sibling_wasm=Y._ts_node_next_sibling_wasm=wasmExports.ts_node_next_sibling_wasm)(J),_ts_node_prev_sibling_wasm=Y._ts_node_prev_sibling_wasm=(J)=>(_ts_node_prev_sibling_wasm=Y._ts_node_prev_sibling_wasm=wasmExports.ts_node_prev_sibling_wasm)(J),_ts_node_next_named_sibling_wasm=Y._ts_node_next_named_sibling_wasm=(J)=>(_ts_node_next_named_sibling_wasm=Y._ts_node_next_named_sibling_wasm=wasmExports.ts_node_next_named_sibling_wasm)(J),_ts_node_prev_named_sibling_wasm=Y._ts_node_prev_named_sibling_wasm=(J)=>(_ts_node_prev_named_sibling_wasm=Y._ts_node_prev_named_sibling_wasm=wasmExports.ts_node_prev_named_sibling_wasm)(J),_ts_node_descendant_count_wasm=Y._ts_node_descendant_count_wasm=(J)=>(_ts_node_descendant_count_wasm=Y._ts_node_descendant_count_wasm=wasmExports.ts_node_descendant_count_wasm)(J),_ts_node_parent_wasm=Y._ts_node_parent_wasm=(J)=>(_ts_node_parent_wasm=Y._ts_node_parent_wasm=wasmExports.ts_node_parent_wasm)(J),_ts_node_descendant_for_index_wasm=Y._ts_node_descendant_for_index_wasm=(J)=>(_ts_node_descendant_for_index_wasm=Y._ts_node_descendant_for_index_wasm=wasmExports.ts_node_descendant_for_index_wasm)(J),_ts_node_named_descendant_for_index_wasm=Y._ts_node_named_descendant_for_index_wasm=(J)=>(_ts_node_named_descendant_for_index_wasm=Y._ts_node_named_descendant_for_index_wasm=wasmExports.ts_node_named_descendant_for_index_wasm)(J),_ts_node_descendant_for_position_wasm=Y._ts_node_descendant_for_position_wasm=(J)=>(_ts_node_descendant_for_position_wasm=Y._ts_node_descendant_for_position_wasm=wasmExports.ts_node_descendant_for_position_wasm)(J),_ts_node_named_descendant_for_position_wasm=Y._ts_node_named_descendant_for_position_wasm=(J)=>(_ts_node_named_descendant_for_position_wasm=Y._ts_node_named_descendant_for_position_wasm=wasmExports.ts_node_named_descendant_for_position_wasm)(J),_ts_node_start_point_wasm=Y._ts_node_start_point_wasm=(J)=>(_ts_node_start_point_wasm=Y._ts_node_start_point_wasm=wasmExports.ts_node_start_point_wasm)(J),_ts_node_end_point_wasm=Y._ts_node_end_point_wasm=(J)=>(_ts_node_end_point_wasm=Y._ts_node_end_point_wasm=wasmExports.ts_node_end_point_wasm)(J),_ts_node_start_index_wasm=Y._ts_node_start_index_wasm=(J)=>(_ts_node_start_index_wasm=Y._ts_node_start_index_wasm=wasmExports.ts_node_start_index_wasm)(J),_ts_node_end_index_wasm=Y._ts_node_end_index_wasm=(J)=>(_ts_node_end_index_wasm=Y._ts_node_end_index_wasm=wasmExports.ts_node_end_index_wasm)(J),_ts_node_to_string_wasm=Y._ts_node_to_string_wasm=(J)=>(_ts_node_to_string_wasm=Y._ts_node_to_string_wasm=wasmExports.ts_node_to_string_wasm)(J),_ts_node_children_wasm=Y._ts_node_children_wasm=(J)=>(_ts_node_children_wasm=Y._ts_node_children_wasm=wasmExports.ts_node_children_wasm)(J),_ts_node_named_children_wasm=Y._ts_node_named_children_wasm=(J)=>(_ts_node_named_children_wasm=Y._ts_node_named_children_wasm=wasmExports.ts_node_named_children_wasm)(J),_ts_node_descendants_of_type_wasm=Y._ts_node_descendants_of_type_wasm=(J,Q,$,Z,X,K,G)=>(_ts_node_descendants_of_type_wasm=Y._ts_node_descendants_of_type_wasm=wasmExports.ts_node_descendants_of_type_wasm)(J,Q,$,Z,X,K,G),_ts_node_is_named_wasm=Y._ts_node_is_named_wasm=(J)=>(_ts_node_is_named_wasm=Y._ts_node_is_named_wasm=wasmExports.ts_node_is_named_wasm)(J),_ts_node_has_changes_wasm=Y._ts_node_has_changes_wasm=(J)=>(_ts_node_has_changes_wasm=Y._ts_node_has_changes_wasm=wasmExports.ts_node_has_changes_wasm)(J),_ts_node_has_error_wasm=Y._ts_node_has_error_wasm=(J)=>(_ts_node_has_error_wasm=Y._ts_node_has_error_wasm=wasmExports.ts_node_has_error_wasm)(J),_ts_node_is_error_wasm=Y._ts_node_is_error_wasm=(J)=>(_ts_node_is_error_wasm=Y._ts_node_is_error_wasm=wasmExports.ts_node_is_error_wasm)(J),_ts_node_is_missing_wasm=Y._ts_node_is_missing_wasm=(J)=>(_ts_node_is_missing_wasm=Y._ts_node_is_missing_wasm=wasmExports.ts_node_is_missing_wasm)(J),_ts_node_is_extra_wasm=Y._ts_node_is_extra_wasm=(J)=>(_ts_node_is_extra_wasm=Y._ts_node_is_extra_wasm=wasmExports.ts_node_is_extra_wasm)(J),_ts_node_parse_state_wasm=Y._ts_node_parse_state_wasm=(J)=>(_ts_node_parse_state_wasm=Y._ts_node_parse_state_wasm=wasmExports.ts_node_parse_state_wasm)(J),_ts_node_next_parse_state_wasm=Y._ts_node_next_parse_state_wasm=(J)=>(_ts_node_next_parse_state_wasm=Y._ts_node_next_parse_state_wasm=wasmExports.ts_node_next_parse_state_wasm)(J),_ts_query_matches_wasm=Y._ts_query_matches_wasm=(J,Q,$,Z,X,K,G,z,V,H,U)=>(_ts_query_matches_wasm=Y._ts_query_matches_wasm=wasmExports.ts_query_matches_wasm)(J,Q,$,Z,X,K,G,z,V,H,U),_ts_query_captures_wasm=Y._ts_query_captures_wasm=(J,Q,$,Z,X,K,G,z,V,H,U)=>(_ts_query_captures_wasm=Y._ts_query_captures_wasm=wasmExports.ts_query_captures_wasm)(J,Q,$,Z,X,K,G,z,V,H,U),_iswalpha=Y._iswalpha=(J)=>(_iswalpha=Y._iswalpha=wasmExports.iswalpha)(J),_iswblank=Y._iswblank=(J)=>(_iswblank=Y._iswblank=wasmExports.iswblank)(J),_iswdigit=Y._iswdigit=(J)=>(_iswdigit=Y._iswdigit=wasmExports.iswdigit)(J),_iswlower=Y._iswlower=(J)=>(_iswlower=Y._iswlower=wasmExports.iswlower)(J),_iswupper=Y._iswupper=(J)=>(_iswupper=Y._iswupper=wasmExports.iswupper)(J),_iswxdigit=Y._iswxdigit=(J)=>(_iswxdigit=Y._iswxdigit=wasmExports.iswxdigit)(J),_memchr=Y._memchr=(J,Q,$)=>(_memchr=Y._memchr=wasmExports.memchr)(J,Q,$),_strlen=Y._strlen=(J)=>(_strlen=Y._strlen=wasmExports.strlen)(J),_strcmp=Y._strcmp=(J,Q)=>(_strcmp=Y._strcmp=wasmExports.strcmp)(J,Q),_strncat=Y._strncat=(J,Q,$)=>(_strncat=Y._strncat=wasmExports.strncat)(J,Q,$),_strncpy=Y._strncpy=(J,Q,$)=>(_strncpy=Y._strncpy=wasmExports.strncpy)(J,Q,$),_towlower=Y._towlower=(J)=>(_towlower=Y._towlower=wasmExports.towlower)(J),_towupper=Y._towupper=(J)=>(_towupper=Y._towupper=wasmExports.towupper)(J),_setThrew=(J,Q)=>(_setThrew=wasmExports.setThrew)(J,Q),__emscripten_stack_restore=(J)=>(__emscripten_stack_restore=wasmExports._emscripten_stack_restore)(J),__emscripten_stack_alloc=(J)=>(__emscripten_stack_alloc=wasmExports._emscripten_stack_alloc)(J),_emscripten_stack_get_current=()=>(_emscripten_stack_get_current=wasmExports.emscripten_stack_get_current)(),dynCall_jiji=Y.dynCall_jiji=(J,Q,$,Z,X)=>(dynCall_jiji=Y.dynCall_jiji=wasmExports.dynCall_jiji)(J,Q,$,Z,X),_orig$ts_parser_timeout_micros=Y._orig$ts_parser_timeout_micros=(J)=>(_orig$ts_parser_timeout_micros=Y._orig$ts_parser_timeout_micros=wasmExports.orig$ts_parser_timeout_micros)(J),_orig$ts_parser_set_timeout_micros=Y._orig$ts_parser_set_timeout_micros=(J,Q)=>(_orig$ts_parser_set_timeout_micros=Y._orig$ts_parser_set_timeout_micros=wasmExports.orig$ts_parser_set_timeout_micros)(J,Q);Y.AsciiToString=AsciiToString,Y.stringToUTF16=stringToUTF16;var calledRun;dependenciesFulfilled=function J(){if(!calledRun)run();if(!calledRun)dependenciesFulfilled=J};function callMain(J=[]){var Q=resolveGlobalSymbol("main").sym;if(!Q)return;J.unshift(thisProgram);var $=J.length,Z=stackAlloc(($+1)*4),X=Z;J.forEach((G)=>{LE_HEAP_STORE_U32((X>>2)*4,stringToUTF8OnStack(G)),X+=4}),LE_HEAP_STORE_U32((X>>2)*4,0);try{var K=Q($,Z);return exitJS(K,!0),K}catch(G){return handleException(G)}}function run(J=arguments_){if(runDependencies>0)return;if(preRun(),runDependencies>0)return;function Q(){if(calledRun)return;if(calledRun=!0,Y.calledRun=!0,ABORT)return;if(initRuntime(),preMain(),Y.onRuntimeInitialized?.(),shouldRunNow)callMain(J);postRun()}if(Y.setStatus)Y.setStatus("Running..."),setTimeout(function(){setTimeout(function(){Y.setStatus("")},1),Q()},1);else Q()}if(Y.preInit){if(typeof Y.preInit=="function")Y.preInit=[Y.preInit];while(Y.preInit.length>0)Y.preInit.pop()()}var shouldRunNow=!0;if(Y.noInitialRun)shouldRunNow=!1;run();let C=Y,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(J){let Q;if(!J)Q=0,J=null;else if(J.constructor===Language){Q=J[0];let $=C._ts_language_version(Q);if($<MIN_COMPATIBLE_VERSION||VERSION<$)throw Error(`Incompatible language version ${$}. Compatibility range ${MIN_COMPATIBLE_VERSION} through ${VERSION}.`)}else throw Error("Argument must be a Language");return this.language=J,C._ts_parser_set_language(this[0],Q),this}getLanguage(){return this.language}parse(J,Q,$){if(typeof J==="string")currentParseCallback=(z,V)=>J.slice(z);else if(typeof J==="function")currentParseCallback=J;else throw Error("Argument must be a string or a function");if(this.logCallback)currentLogCallback=this.logCallback,C._ts_parser_enable_logger_wasm(this[0],1);else currentLogCallback=null,C._ts_parser_enable_logger_wasm(this[0],0);let Z=0,X=0;if($?.includedRanges){Z=$.includedRanges.length,X=C._calloc(Z,SIZE_OF_RANGE);let z=X;for(let V=0;V<Z;V++)marshalRange(z,$.includedRanges[V]),z+=SIZE_OF_RANGE}let K=C._ts_parser_parse_wasm(this[0],this[1],Q?Q[0]:0,X,Z);if(!K)throw currentParseCallback=null,currentLogCallback=null,Error("Parsing failed");let G=new Tree(INTERNAL,K,this.language,currentParseCallback);return currentParseCallback=null,currentLogCallback=null,G}reset(){C._ts_parser_reset(this[0])}getIncludedRanges(){C._ts_parser_included_ranges_wasm(this[0]);let J=getValue(TRANSFER_BUFFER,"i32"),Q=getValue(TRANSFER_BUFFER+SIZE_OF_INT,"i32"),$=Array(J);if(J>0){let Z=Q;for(let X=0;X<J;X++)$[X]=unmarshalRange(Z),Z+=SIZE_OF_RANGE;C._free(Q)}return $}getTimeoutMicros(){return C._ts_parser_timeout_micros(this[0])}setTimeoutMicros(J){C._ts_parser_set_timeout_micros(this[0],J)}setLogger(J){if(!J)J=null;else if(typeof J!=="function")throw Error("Logger callback must be a function");return this.logCallback=J,this}getLogger(){return this.logCallback}}class Tree{constructor(J,Q,$,Z){assertInternal(J),this[0]=Q,this.language=$,this.textCallback=Z}copy(){let J=C._ts_tree_copy(this[0]);return new Tree(INTERNAL,J,this.language,this.textCallback)}delete(){C._ts_tree_delete(this[0]),this[0]=0}edit(J){marshalEdit(J),C._ts_tree_edit_wasm(this[0])}get rootNode(){return C._ts_tree_root_node_wasm(this[0]),unmarshalNode(this)}rootNodeWithOffset(J,Q){let $=TRANSFER_BUFFER+SIZE_OF_NODE;return setValue($,J,"i32"),marshalPoint($+SIZE_OF_INT,Q),C._ts_tree_root_node_with_offset_wasm(this[0]),unmarshalNode(this)}getLanguage(){return this.language}walk(){return this.rootNode.walk()}getChangedRanges(J){if(J.constructor!==Tree)throw TypeError("Argument must be a Tree");C._ts_tree_get_changed_ranges_wasm(this[0],J[0]);let Q=getValue(TRANSFER_BUFFER,"i32"),$=getValue(TRANSFER_BUFFER+SIZE_OF_INT,"i32"),Z=Array(Q);if(Q>0){let X=$;for(let K=0;K<Q;K++)Z[K]=unmarshalRange(X),X+=SIZE_OF_RANGE;C._free($)}return Z}getIncludedRanges(){C._ts_tree_included_ranges_wasm(this[0]);let J=getValue(TRANSFER_BUFFER,"i32"),Q=getValue(TRANSFER_BUFFER+SIZE_OF_INT,"i32"),$=Array(J);if(J>0){let Z=Q;for(let X=0;X<J;X++)$[X]=unmarshalRange(Z),Z+=SIZE_OF_RANGE;C._free(Q)}return $}}class Node{constructor(J,Q){assertInternal(J),this.tree=Q}get typeId(){return marshalNode(this),C._ts_node_symbol_wasm(this.tree[0])}get grammarId(){return marshalNode(this),C._ts_node_grammar_symbol_wasm(this.tree[0])}get type(){return this.tree.language.types[this.typeId]||"ERROR"}get grammarType(){return this.tree.language.types[this.grammarId]||"ERROR"}get endPosition(){return marshalNode(this),C._ts_node_end_point_wasm(this.tree[0]),unmarshalPoint(TRANSFER_BUFFER)}get endIndex(){return marshalNode(this),C._ts_node_end_index_wasm(this.tree[0])}get text(){return getText(this.tree,this.startIndex,this.endIndex)}get parseState(){return marshalNode(this),C._ts_node_parse_state_wasm(this.tree[0])}get nextParseState(){return marshalNode(this),C._ts_node_next_parse_state_wasm(this.tree[0])}get isNamed(){return marshalNode(this),C._ts_node_is_named_wasm(this.tree[0])===1}get hasError(){return marshalNode(this),C._ts_node_has_error_wasm(this.tree[0])===1}get hasChanges(){return marshalNode(this),C._ts_node_has_changes_wasm(this.tree[0])===1}get isError(){return marshalNode(this),C._ts_node_is_error_wasm(this.tree[0])===1}get isMissing(){return marshalNode(this),C._ts_node_is_missing_wasm(this.tree[0])===1}get isExtra(){return marshalNode(this),C._ts_node_is_extra_wasm(this.tree[0])===1}equals(J){return this.id===J.id}child(J){return marshalNode(this),C._ts_node_child_wasm(this.tree[0],J),unmarshalNode(this.tree)}namedChild(J){return marshalNode(this),C._ts_node_named_child_wasm(this.tree[0],J),unmarshalNode(this.tree)}childForFieldId(J){return marshalNode(this),C._ts_node_child_by_field_id_wasm(this.tree[0],J),unmarshalNode(this.tree)}childForFieldName(J){let Q=this.tree.language.fields.indexOf(J);if(Q!==-1)return this.childForFieldId(Q);return null}fieldNameForChild(J){marshalNode(this);let Q=C._ts_node_field_name_for_child_wasm(this.tree[0],J);if(!Q)return null;return AsciiToString(Q)}childrenForFieldName(J){let Q=this.tree.language.fields.indexOf(J);if(Q!==-1&&Q!==0)return this.childrenForFieldId(Q);return[]}childrenForFieldId(J){marshalNode(this),C._ts_node_children_by_field_id_wasm(this.tree[0],J);let Q=getValue(TRANSFER_BUFFER,"i32"),$=getValue(TRANSFER_BUFFER+SIZE_OF_INT,"i32"),Z=Array(Q);if(Q>0){let X=$;for(let K=0;K<Q;K++)Z[K]=unmarshalNode(this.tree,X),X+=SIZE_OF_NODE;C._free($)}return Z}firstChildForIndex(J){marshalNode(this);let Q=TRANSFER_BUFFER+SIZE_OF_NODE;return setValue(Q,J,"i32"),C._ts_node_first_child_for_byte_wasm(this.tree[0]),unmarshalNode(this.tree)}firstNamedChildForIndex(J){marshalNode(this);let Q=TRANSFER_BUFFER+SIZE_OF_NODE;return setValue(Q,J,"i32"),C._ts_node_first_named_child_for_byte_wasm(this.tree[0]),unmarshalNode(this.tree)}get childCount(){return marshalNode(this),C._ts_node_child_count_wasm(this.tree[0])}get namedChildCount(){return marshalNode(this),C._ts_node_named_child_count_wasm(this.tree[0])}get firstChild(){return this.child(0)}get firstNamedChild(){return this.namedChild(0)}get lastChild(){return this.child(this.childCount-1)}get lastNamedChild(){return this.namedChild(this.namedChildCount-1)}get children(){if(!this._children){marshalNode(this),C._ts_node_children_wasm(this.tree[0]);let J=getValue(TRANSFER_BUFFER,"i32"),Q=getValue(TRANSFER_BUFFER+SIZE_OF_INT,"i32");if(this._children=Array(J),J>0){let $=Q;for(let Z=0;Z<J;Z++)this._children[Z]=unmarshalNode(this.tree,$),$+=SIZE_OF_NODE;C._free(Q)}}return this._children}get namedChildren(){if(!this._namedChildren){marshalNode(this),C._ts_node_named_children_wasm(this.tree[0]);let J=getValue(TRANSFER_BUFFER,"i32"),Q=getValue(TRANSFER_BUFFER+SIZE_OF_INT,"i32");if(this._namedChildren=Array(J),J>0){let $=Q;for(let Z=0;Z<J;Z++)this._namedChildren[Z]=unmarshalNode(this.tree,$),$+=SIZE_OF_NODE;C._free(Q)}}return this._namedChildren}descendantsOfType(J,Q,$){if(!Array.isArray(J))J=[J];if(!Q)Q=ZERO_POINT;if(!$)$=ZERO_POINT;let Z=[],X=this.tree.language.types;for(let H=0,U=X.length;H<U;H++)if(J.includes(X[H]))Z.push(H);let K=C._malloc(SIZE_OF_INT*Z.length);for(let H=0,U=Z.length;H<U;H++)setValue(K+H*SIZE_OF_INT,Z[H],"i32");marshalNode(this),C._ts_node_descendants_of_type_wasm(this.tree[0],K,Z.length,Q.row,Q.column,$.row,$.column);let G=getValue(TRANSFER_BUFFER,"i32"),z=getValue(TRANSFER_BUFFER+SIZE_OF_INT,"i32"),V=Array(G);if(G>0){let H=z;for(let U=0;U<G;U++)V[U]=unmarshalNode(this.tree,H),H+=SIZE_OF_NODE}return C._free(z),C._free(K),V}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(J,Q=J){if(typeof J!=="number"||typeof Q!=="number")throw Error("Arguments must be numbers");marshalNode(this);let $=TRANSFER_BUFFER+SIZE_OF_NODE;return setValue($,J,"i32"),setValue($+SIZE_OF_INT,Q,"i32"),C._ts_node_descendant_for_index_wasm(this.tree[0]),unmarshalNode(this.tree)}namedDescendantForIndex(J,Q=J){if(typeof J!=="number"||typeof Q!=="number")throw Error("Arguments must be numbers");marshalNode(this);let $=TRANSFER_BUFFER+SIZE_OF_NODE;return setValue($,J,"i32"),setValue($+SIZE_OF_INT,Q,"i32"),C._ts_node_named_descendant_for_index_wasm(this.tree[0]),unmarshalNode(this.tree)}descendantForPosition(J,Q=J){if(!isPoint(J)||!isPoint(Q))throw Error("Arguments must be {row, column} objects");marshalNode(this);let $=TRANSFER_BUFFER+SIZE_OF_NODE;return marshalPoint($,J),marshalPoint($+SIZE_OF_POINT,Q),C._ts_node_descendant_for_position_wasm(this.tree[0]),unmarshalNode(this.tree)}namedDescendantForPosition(J,Q=J){if(!isPoint(J)||!isPoint(Q))throw Error("Arguments must be {row, column} objects");marshalNode(this);let $=TRANSFER_BUFFER+SIZE_OF_NODE;return marshalPoint($,J),marshalPoint($+SIZE_OF_POINT,Q),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 J=C._ts_node_to_string_wasm(this.tree[0]),Q=AsciiToString(J);return C._free(J),Q}}class TreeCursor{constructor(J,Q){assertInternal(J),this.tree=Q,unmarshalTreeCursor(this)}delete(){marshalTreeCursor(this),C._ts_tree_cursor_delete_wasm(this.tree[0]),this[0]=this[1]=this[2]=0}reset(J){marshalNode(J),marshalTreeCursor(this,TRANSFER_BUFFER+SIZE_OF_NODE),C._ts_tree_cursor_reset_wasm(this.tree[0]),unmarshalTreeCursor(this)}resetTo(J){marshalTreeCursor(this,TRANSFER_BUFFER),marshalTreeCursor(J,TRANSFER_BUFFER+SIZE_OF_CURSOR),C._ts_tree_cursor_reset_to_wasm(this.tree[0],J.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 J=C._ts_tree_cursor_start_index_wasm(this.tree[0]),Q=C._ts_tree_cursor_end_index_wasm(this.tree[0]);return getText(this.tree,J,Q)}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 J=C._ts_tree_cursor_goto_first_child_wasm(this.tree[0]);return unmarshalTreeCursor(this),J===1}gotoLastChild(){marshalTreeCursor(this);let J=C._ts_tree_cursor_goto_last_child_wasm(this.tree[0]);return unmarshalTreeCursor(this),J===1}gotoFirstChildForIndex(J){marshalTreeCursor(this),setValue(TRANSFER_BUFFER+SIZE_OF_CURSOR,J,"i32");let Q=C._ts_tree_cursor_goto_first_child_for_index_wasm(this.tree[0]);return unmarshalTreeCursor(this),Q===1}gotoFirstChildForPosition(J){marshalTreeCursor(this),marshalPoint(TRANSFER_BUFFER+SIZE_OF_CURSOR,J);let Q=C._ts_tree_cursor_goto_first_child_for_position_wasm(this.tree[0]);return unmarshalTreeCursor(this),Q===1}gotoNextSibling(){marshalTreeCursor(this);let J=C._ts_tree_cursor_goto_next_sibling_wasm(this.tree[0]);return unmarshalTreeCursor(this),J===1}gotoPreviousSibling(){marshalTreeCursor(this);let J=C._ts_tree_cursor_goto_previous_sibling_wasm(this.tree[0]);return unmarshalTreeCursor(this),J===1}gotoDescendant(J){marshalTreeCursor(this),C._ts_tree_cursor_goto_descendant_wasm(this.tree[0],J),unmarshalTreeCursor(this)}gotoParent(){marshalTreeCursor(this);let J=C._ts_tree_cursor_goto_parent_wasm(this.tree[0]);return unmarshalTreeCursor(this),J===1}}class Language{constructor(J,Q){assertInternal(J),this[0]=Q,this.types=Array(C._ts_language_symbol_count(this[0]));for(let $=0,Z=this.types.length;$<Z;$++)if(C._ts_language_symbol_type(this[0],$)<2)this.types[$]=UTF8ToString(C._ts_language_symbol_name(this[0],$));this.fields=Array(C._ts_language_field_count(this[0])+1);for(let $=0,Z=this.fields.length;$<Z;$++){let X=C._ts_language_field_name_for_id(this[0],$);if(X!==0)this.fields[$]=UTF8ToString(X);else this.fields[$]=null}}get version(){return C._ts_language_version(this[0])}get fieldCount(){return this.fields.length-1}get stateCount(){return C._ts_language_state_count(this[0])}fieldIdForName(J){let Q=this.fields.indexOf(J);if(Q!==-1)return Q;else return null}fieldNameForId(J){return this.fields[J]||null}idForNodeType(J,Q){let $=lengthBytesUTF8(J),Z=C._malloc($+1);stringToUTF8(J,Z,$+1);let X=C._ts_language_symbol_for_name(this[0],Z,$,Q);return C._free(Z),X||null}get nodeTypeCount(){return C._ts_language_symbol_count(this[0])}nodeTypeForId(J){let Q=C._ts_language_symbol_name(this[0],J);return Q?UTF8ToString(Q):null}nodeTypeIsNamed(J){return C._ts_language_type_is_named_wasm(this[0],J)?!0:!1}nodeTypeIsVisible(J){return C._ts_language_type_is_visible_wasm(this[0],J)?!0:!1}nextState(J,Q){return C._ts_language_next_state(this[0],J,Q)}lookaheadIterator(J){let Q=C._ts_lookahead_iterator_new(this[0],J);if(Q)return new LookaheadIterable(INTERNAL,Q,this);return null}query(J){let Q=lengthBytesUTF8(J),$=C._malloc(Q+1);stringToUTF8(J,$,Q+1);let Z=C._ts_query_new(this[0],$,Q,TRANSFER_BUFFER,TRANSFER_BUFFER+SIZE_OF_INT);if(!Z){let T=getValue(TRANSFER_BUFFER+SIZE_OF_INT,"i32"),A=getValue(TRANSFER_BUFFER,"i32"),O=UTF8ToString($,A).length,j=J.substr(O,100).split(`
2
- `)[0],D=j.match(QUERY_WORD_REGEX)[0],E;switch(T){case 2:E=RangeError(`Bad node name '${D}'`);break;case 3:E=RangeError(`Bad field name '${D}'`);break;case 4:E=RangeError(`Bad capture name @${D}`);break;case 5:E=TypeError(`Bad pattern structure at offset ${O}: '${j}'...`),D="";break;default:E=SyntaxError(`Bad syntax at offset ${O}: '${j}'...`),D="";break}throw E.index=O,E.length=D.length,C._free($),E}let X=C._ts_query_string_count(Z),K=C._ts_query_capture_count(Z),G=C._ts_query_pattern_count(Z),z=Array(K),V=Array(X);for(let T=0;T<K;T++){let A=C._ts_query_capture_name_for_id(Z,T,TRANSFER_BUFFER),O=getValue(TRANSFER_BUFFER,"i32");z[T]=UTF8ToString(A,O)}for(let T=0;T<X;T++){let A=C._ts_query_string_value_for_id(Z,T,TRANSFER_BUFFER),O=getValue(TRANSFER_BUFFER,"i32");V[T]=UTF8ToString(A,O)}let H=Array(G),U=Array(G),q=Array(G),W=Array(G),F=Array(G);for(let T=0;T<G;T++){let A=C._ts_query_predicates_for_pattern(Z,T,TRANSFER_BUFFER),O=getValue(TRANSFER_BUFFER,"i32");W[T]=[],F[T]=[];let j=[],D=A;for(let E=0;E<O;E++){let w=getValue(D,"i32");D+=SIZE_OF_INT;let R=getValue(D,"i32");if(D+=SIZE_OF_INT,w===PREDICATE_STEP_TYPE_CAPTURE)j.push({type:"capture",name:z[R]});else if(w===PREDICATE_STEP_TYPE_STRING)j.push({type:"string",value:V[R]});else if(j.length>0){if(j[0].type!=="string")throw Error("Predicates must begin with a literal value");let I=j[0].value,L=!0,h=!0,f;switch(I){case"any-not-eq?":case"not-eq?":L=!1;case"any-eq?":case"eq?":if(j.length!==3)throw Error(`Wrong number of arguments to \`#${I}\` predicate. Expected 2, got ${j.length-1}`);if(j[1].type!=="capture")throw Error(`First argument of \`#${I}\` predicate must be a capture. Got "${j[1].value}"`);if(h=!I.startsWith("any-"),j[2].type==="capture"){let P=j[1].name,k=j[2].name;F[T].push((B)=>{let N=[],y=[];for(let b of B){if(b.name===P)N.push(b.node);if(b.name===k)y.push(b.node)}let p=(b,u,t)=>t?b.text===u.text:b.text!==u.text;return h?N.every((b)=>y.some((u)=>p(b,u,L))):N.some((b)=>y.some((u)=>p(b,u,L)))})}else{f=j[1].name;let P=j[2].value,k=(N)=>N.text===P,B=(N)=>N.text!==P;F[T].push((N)=>{let y=[];for(let b of N)if(b.name===f)y.push(b.node);let p=L?k:B;return h?y.every(p):y.some(p)})}break;case"any-not-match?":case"not-match?":L=!1;case"any-match?":case"match?":if(j.length!==3)throw Error(`Wrong number of arguments to \`#${I}\` predicate. Expected 2, got ${j.length-1}.`);if(j[1].type!=="capture")throw Error(`First argument of \`#${I}\` predicate must be a capture. Got "${j[1].value}".`);if(j[2].type!=="string")throw Error(`Second argument of \`#${I}\` predicate must be a string. Got @${j[2].value}.`);f=j[1].name;let M=new RegExp(j[2].value);h=!I.startsWith("any-"),F[T].push((P)=>{let k=[];for(let N of P)if(N.name===f)k.push(N.node.text);let B=(N,y)=>y?M.test(N):!M.test(N);if(k.length===0)return!L;return h?k.every((N)=>B(N,L)):k.some((N)=>B(N,L))});break;case"set!":if(j.length<2||j.length>3)throw Error(`Wrong number of arguments to \`#set!\` predicate. Expected 1 or 2. Got ${j.length-1}.`);if(j.some((P)=>P.type!=="string"))throw Error('Arguments to `#set!` predicate must be a strings.".');if(!H[T])H[T]={};H[T][j[1].value]=j[2]?j[2].value:null;break;case"is?":case"is-not?":if(j.length<2||j.length>3)throw Error(`Wrong number of arguments to \`#${I}\` predicate. Expected 1 or 2. Got ${j.length-1}.`);if(j.some((P)=>P.type!=="string"))throw Error(`Arguments to \`#${I}\` predicate must be a strings.".`);let m=I==="is?"?U:q;if(!m[T])m[T]={};m[T][j[1].value]=j[2]?j[2].value:null;break;case"not-any-of?":L=!1;case"any-of?":if(j.length<2)throw Error(`Wrong number of arguments to \`#${I}\` predicate. Expected at least 1. Got ${j.length-1}.`);if(j[1].type!=="capture")throw Error(`First argument of \`#${I}\` predicate must be a capture. Got "${j[1].value}".`);for(let P=2;P<j.length;P++)if(j[P].type!=="string")throw Error(`Arguments to \`#${I}\` predicate must be a strings.".`);f=j[1].name;let o=j.slice(2).map((P)=>P.value);F[T].push((P)=>{let k=[];for(let B of P)if(B.name===f)k.push(B.node.text);if(k.length===0)return!L;return k.every((B)=>o.includes(B))===L});break;default:W[T].push({operator:I,operands:j.slice(1)})}j.length=0}}Object.freeze(H[T]),Object.freeze(U[T]),Object.freeze(q[T])}return C._free($),new Query(INTERNAL,Z,z,F,W,Object.freeze(H),Object.freeze(U),Object.freeze(q))}static load(J){let Q;if(J instanceof Uint8Array)Q=Promise.resolve(J);else{let $=J;if(typeof process<"u"&&process.versions&&process.versions.node){let Z=mJ("fs");Q=Promise.resolve(Z.readFileSync($))}else Q=fetch($).then((Z)=>Z.arrayBuffer().then((X)=>{if(Z.ok)return new Uint8Array(X);else{let K=new TextDecoder("utf-8").decode(X);throw Error(`Language.load failed with status ${Z.status}.
1
+ import{createRequire as C$}from"node:module";var j$=Object.create;var{getPrototypeOf:T$,defineProperty:qQ,getOwnPropertyNames:F$}=Object;var A$=Object.prototype.hasOwnProperty;function O$(J){return this[J]}var k$,D$,_$=(J,Q,$)=>{var Z=J!=null&&typeof J==="object";if(Z){var X=Q?k$??=new WeakMap:D$??=new WeakMap,K=X.get(J);if(K)return K}$=J!=null?j$(T$(J)):{};let G=Q||!J||!J.__esModule?qQ($,"default",{value:J,enumerable:!0}):$;for(let U of F$(J))if(!A$.call(G,U))qQ(G,U,{get:O$.bind(J,U),enumerable:!0});if(Z)X.set(J,G);return G};var E$=(J,Q)=>()=>(Q||J((Q={exports:{}}).exports,Q),Q.exports);var pJ=C$(import.meta.url);var uQ=E$((MJ,OJ)=>{var __dirname="/home/runner/work/trueline-mcp/trueline-mcp/node_modules/web-tree-sitter",Y=typeof Y<"u"?Y:{},C0=typeof window=="object",eJ=typeof importScripts=="function",cQ=typeof process=="object"&&typeof process.versions=="object"&&typeof process.versions.node=="string",w0=function(){var initPromise,document=typeof window=="object"?{currentScript:window.document.currentScript}:null;class Parser{constructor(){this.initialize()}initialize(){throw Error("cannot construct a Parser before calling `init()`")}static init(moduleOptions){if(initPromise)return initPromise;return Y=Object.assign({},Y,moduleOptions),initPromise=new Promise((resolveInitPromise)=>{var moduleOverrides=Object.assign({},Y),arguments_=[],thisProgram="./this.program",quit_=(J,Q)=>{throw Q},scriptDirectory="";function locateFile(J){if(Y.locateFile)return Y.locateFile(J,scriptDirectory);return scriptDirectory+J}var readAsync,readBinary;if(cQ){var fs=pJ("fs"),nodePath=pJ("path");if(scriptDirectory=__dirname+"/",readBinary=(J)=>{J=isFileURI(J)?new URL(J):nodePath.normalize(J);var Q=fs.readFileSync(J);return Q},readAsync=(J,Q=!0)=>{return J=isFileURI(J)?new URL(J):nodePath.normalize(J),new Promise(($,Z)=>{fs.readFile(J,Q?void 0:"utf8",(X,K)=>{if(X)Z(X);else $(Q?K.buffer:K)})})},!Y.thisProgram&&process.argv.length>1)thisProgram=process.argv[1].replace(/\\/g,"/");if(arguments_=process.argv.slice(2),typeof OJ<"u")OJ.exports=Y;quit_=(J,Q)=>{throw process.exitCode=J,Q}}else if(C0||eJ){if(eJ)scriptDirectory=self.location.href;else if(typeof document<"u"&&document.currentScript)scriptDirectory=document.currentScript.src;if(scriptDirectory.startsWith("blob:"))scriptDirectory="";else scriptDirectory=scriptDirectory.substr(0,scriptDirectory.replace(/[?#].*/,"").lastIndexOf("/")+1);{if(eJ)readBinary=(J)=>{var Q=new XMLHttpRequest;return Q.open("GET",J,!1),Q.responseType="arraybuffer",Q.send(null),new Uint8Array(Q.response)};readAsync=(J)=>{if(isFileURI(J))return new Promise((Q,$)=>{var Z=new XMLHttpRequest;Z.open("GET",J,!0),Z.responseType="arraybuffer",Z.onload=()=>{if(Z.status==200||Z.status==0&&Z.response)$(Z.response);Q(Z.status)},Z.onerror=Q,Z.send(null)});return fetch(J,{credentials:"same-origin"}).then((Q)=>{if(Q.ok)return Q.arrayBuffer();return Promise.reject(Error(Q.status+" : "+Q.url))})}}}var out=Y.print||console.log.bind(console),err=Y.printErr||console.error.bind(console);if(Object.assign(Y,moduleOverrides),moduleOverrides=null,Y.arguments)arguments_=Y.arguments;if(Y.thisProgram)thisProgram=Y.thisProgram;if(Y.quit)quit_=Y.quit;var dynamicLibraries=Y.dynamicLibraries||[],wasmBinary;if(Y.wasmBinary)wasmBinary=Y.wasmBinary;var wasmMemory,ABORT=!1,EXITSTATUS,HEAP8,HEAPU8,HEAP16,HEAPU16,HEAP32,HEAPU32,HEAPF32,HEAPF64,HEAP_DATA_VIEW;function updateMemoryViews(){var J=wasmMemory.buffer;Y.HEAP_DATA_VIEW=HEAP_DATA_VIEW=new DataView(J),Y.HEAP8=HEAP8=new Int8Array(J),Y.HEAP16=HEAP16=new Int16Array(J),Y.HEAPU8=HEAPU8=new Uint8Array(J),Y.HEAPU16=HEAPU16=new Uint16Array(J),Y.HEAP32=HEAP32=new Int32Array(J),Y.HEAPU32=HEAPU32=new Uint32Array(J),Y.HEAPF32=HEAPF32=new Float32Array(J),Y.HEAPF64=HEAPF64=new Float64Array(J)}if(Y.wasmMemory)wasmMemory=Y.wasmMemory;else{var INITIAL_MEMORY=Y.INITIAL_MEMORY||33554432;wasmMemory=new WebAssembly.Memory({initial:INITIAL_MEMORY/65536,maximum:32768})}updateMemoryViews();var __ATPRERUN__=[],__ATINIT__=[],__ATMAIN__=[],__ATPOSTRUN__=[],__RELOC_FUNCS__=[],runtimeInitialized=!1;function preRun(){if(Y.preRun){if(typeof Y.preRun=="function")Y.preRun=[Y.preRun];while(Y.preRun.length)addOnPreRun(Y.preRun.shift())}callRuntimeCallbacks(__ATPRERUN__)}function initRuntime(){runtimeInitialized=!0,callRuntimeCallbacks(__RELOC_FUNCS__),callRuntimeCallbacks(__ATINIT__)}function preMain(){callRuntimeCallbacks(__ATMAIN__)}function postRun(){if(Y.postRun){if(typeof Y.postRun=="function")Y.postRun=[Y.postRun];while(Y.postRun.length)addOnPostRun(Y.postRun.shift())}callRuntimeCallbacks(__ATPOSTRUN__)}function addOnPreRun(J){__ATPRERUN__.unshift(J)}function addOnInit(J){__ATINIT__.unshift(J)}function addOnPostRun(J){__ATPOSTRUN__.unshift(J)}var runDependencies=0,runDependencyWatcher=null,dependenciesFulfilled=null;function getUniqueRunDependency(J){return J}function addRunDependency(J){runDependencies++,Y.monitorRunDependencies?.(runDependencies)}function removeRunDependency(J){if(runDependencies--,Y.monitorRunDependencies?.(runDependencies),runDependencies==0){if(runDependencyWatcher!==null)clearInterval(runDependencyWatcher),runDependencyWatcher=null;if(dependenciesFulfilled){var Q=dependenciesFulfilled;dependenciesFulfilled=null,Q()}}}function abort(J){Y.onAbort?.(J),J="Aborted("+J+")",err(J),ABORT=!0,EXITSTATUS=1,J+=". Build with -sASSERTIONS for more info.";var Q=new WebAssembly.RuntimeError(J);throw Q}var dataURIPrefix="data:application/octet-stream;base64,",isDataURI=(J)=>J.startsWith(dataURIPrefix),isFileURI=(J)=>J.startsWith("file://");function findWasmBinary(){var J="tree-sitter.wasm";if(!isDataURI(J))return locateFile(J);return J}var wasmBinaryFile;function getBinarySync(J){if(J==wasmBinaryFile&&wasmBinary)return new Uint8Array(wasmBinary);if(readBinary)return readBinary(J);throw"both async and sync fetching of the wasm failed"}function getBinaryPromise(J){if(!wasmBinary)return readAsync(J).then((Q)=>new Uint8Array(Q),()=>getBinarySync(J));return Promise.resolve().then(()=>getBinarySync(J))}function instantiateArrayBuffer(J,Q,$){return getBinaryPromise(J).then((Z)=>WebAssembly.instantiate(Z,Q)).then($,(Z)=>{err(`failed to asynchronously prepare wasm: ${Z}`),abort(Z)})}function instantiateAsync(J,Q,$,Z){if(!J&&typeof WebAssembly.instantiateStreaming=="function"&&!isDataURI(Q)&&!isFileURI(Q)&&!cQ&&typeof fetch=="function")return fetch(Q,{credentials:"same-origin"}).then((X)=>{var K=WebAssembly.instantiateStreaming(X,$);return K.then(Z,function(G){return err(`wasm streaming compile failed: ${G}`),err("falling back to ArrayBuffer instantiation"),instantiateArrayBuffer(Q,$,Z)})});return instantiateArrayBuffer(Q,$,Z)}function getWasmImports(){return{env:wasmImports,wasi_snapshot_preview1:wasmImports,"GOT.mem":new Proxy(wasmImports,GOTHandler),"GOT.func":new Proxy(wasmImports,GOTHandler)}}function createWasm(){var J=getWasmImports();function Q(Z,X){wasmExports=Z.exports,wasmExports=relocateExports(wasmExports,1024);var K=getDylinkMetadata(X);if(K.neededDynlibs)dynamicLibraries=K.neededDynlibs.concat(dynamicLibraries);return 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 $(Z){Q(Z.instance,Z.module)}if(Y.instantiateWasm)try{return Y.instantiateWasm(J,Q)}catch(Z){return err(`Module.instantiateWasm callback failed with error: ${Z}`),!1}if(!wasmBinaryFile)wasmBinaryFile=findWasmBinary();return instantiateAsync(wasmBinary,wasmBinaryFile,J,$),{}}var ASM_CONSTS={};function ExitStatus(J){this.name="ExitStatus",this.message=`Program terminated with exit(${J})`,this.status=J}var GOT={},currentModuleWeakSymbols=new Set([]),GOTHandler={get(J,Q){var $=GOT[Q];if(!$)$=GOT[Q]=new WebAssembly.Global({value:"i32",mutable:!0});if(!currentModuleWeakSymbols.has(Q))$.required=!0;return $}},LE_HEAP_LOAD_F32=(J)=>HEAP_DATA_VIEW.getFloat32(J,!0),LE_HEAP_LOAD_F64=(J)=>HEAP_DATA_VIEW.getFloat64(J,!0),LE_HEAP_LOAD_I16=(J)=>HEAP_DATA_VIEW.getInt16(J,!0),LE_HEAP_LOAD_I32=(J)=>HEAP_DATA_VIEW.getInt32(J,!0),LE_HEAP_LOAD_U32=(J)=>HEAP_DATA_VIEW.getUint32(J,!0),LE_HEAP_STORE_F32=(J,Q)=>HEAP_DATA_VIEW.setFloat32(J,Q,!0),LE_HEAP_STORE_F64=(J,Q)=>HEAP_DATA_VIEW.setFloat64(J,Q,!0),LE_HEAP_STORE_I16=(J,Q)=>HEAP_DATA_VIEW.setInt16(J,Q,!0),LE_HEAP_STORE_I32=(J,Q)=>HEAP_DATA_VIEW.setInt32(J,Q,!0),LE_HEAP_STORE_U32=(J,Q)=>HEAP_DATA_VIEW.setUint32(J,Q,!0),callRuntimeCallbacks=(J)=>{while(J.length>0)J.shift()(Y)},UTF8Decoder=typeof TextDecoder<"u"?new TextDecoder:void 0,UTF8ArrayToString=(J,Q,$)=>{var Z=Q+$,X=Q;while(J[X]&&!(X>=Z))++X;if(X-Q>16&&J.buffer&&UTF8Decoder)return UTF8Decoder.decode(J.subarray(Q,X));var K="";while(Q<X){var G=J[Q++];if(!(G&128)){K+=String.fromCharCode(G);continue}var U=J[Q++]&63;if((G&224)==192){K+=String.fromCharCode((G&31)<<6|U);continue}var q=J[Q++]&63;if((G&240)==224)G=(G&15)<<12|U<<6|q;else G=(G&7)<<18|U<<12|q<<6|J[Q++]&63;if(G<65536)K+=String.fromCharCode(G);else{var W=G-65536;K+=String.fromCharCode(55296|W>>10,56320|W&1023)}}return K},getDylinkMetadata=(J)=>{var Q=0,$=0;function Z(){return J[Q++]}function X(){var P=0,D=1;while(!0){var B=J[Q++];if(P+=(B&127)*D,D*=128,!(B&128))break}return P}function K(){var P=X();return Q+=P,UTF8ArrayToString(J,Q-P,P)}function G(P,D){if(P)throw Error(D)}var U="dylink.0";if(J instanceof WebAssembly.Module){var q=WebAssembly.Module.customSections(J,U);if(q.length===0)U="dylink",q=WebAssembly.Module.customSections(J,U);G(q.length===0,"need dylink section"),J=new Uint8Array(q[0]),$=J.length}else{var W=new Uint32Array(new Uint8Array(J.subarray(0,24)).buffer),z=W[0]==1836278016||W[0]==6386541;G(!z,"need to see wasm magic number"),G(J[8]!==0,"need the dylink section to be first"),Q=9;var V=X();$=Q+V,U=K()}var H={neededDynlibs:[],tlsExports:new Set,weakImports:new Set};if(U=="dylink"){H.memorySize=X(),H.memoryAlign=X(),H.tableSize=X(),H.tableAlign=X();var A=X();for(var T=0;T<A;++T){var F=K();H.neededDynlibs.push(F)}}else{G(U!=="dylink.0");var O=1,j=2,k=3,E=4,w=256,R=3,v=1;while(Q<$){var L=Z(),h=X();if(L===O)H.memorySize=X(),H.memoryAlign=X(),H.tableSize=X(),H.tableAlign=X();else if(L===j){var A=X();for(var T=0;T<A;++T)F=K(),H.neededDynlibs.push(F)}else if(L===k){var f=X();while(f--){var M=K(),m=X();if(m&w)H.tlsExports.add(M)}}else if(L===E){var f=X();while(f--){var o=K(),M=K(),m=X();if((m&R)==v)H.weakImports.add(M)}}else Q+=h}}return H};function getValue(J,Q="i8"){if(Q.endsWith("*"))Q="*";switch(Q){case"i1":return HEAP8[J];case"i8":return HEAP8[J];case"i16":return LE_HEAP_LOAD_I16((J>>1)*2);case"i32":return LE_HEAP_LOAD_I32((J>>2)*4);case"i64":abort("to do getValue(i64) use WASM_BIGINT");case"float":return LE_HEAP_LOAD_F32((J>>2)*4);case"double":return LE_HEAP_LOAD_F64((J>>3)*8);case"*":return LE_HEAP_LOAD_U32((J>>2)*4);default:abort(`invalid type for getValue: ${Q}`)}}var newDSO=(J,Q,$)=>{var Z={refcount:1/0,name:J,exports:$,global:!0};if(LDSO.loadedLibsByName[J]=Z,Q!=null)LDSO.loadedLibsByHandle[Q]=Z;return Z},LDSO={loadedLibsByName:{},loadedLibsByHandle:{},init(){newDSO("__main__",0,wasmImports)}},___heap_base=78112,zeroMemory=(J,Q)=>{return HEAPU8.fill(0,J,J+Q),J},alignMemory=(J,Q)=>Math.ceil(J/Q)*Q,getMemory=(J)=>{if(runtimeInitialized)return zeroMemory(_malloc(J),J);var Q=___heap_base,$=Q+alignMemory(J,16);return ___heap_base=$,GOT.__heap_base.value=$,Q},isInternalSym=(J)=>["__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(J)||J.startsWith("__em_js__"),uleb128Encode=(J,Q)=>{if(J<128)Q.push(J);else Q.push(J%128|128,J>>7)},sigToWasmTypes=(J)=>{var Q={i:"i32",j:"i64",f:"f32",d:"f64",e:"externref",p:"i32"},$={parameters:[],results:J[0]=="v"?[]:[Q[J[0]]]};for(var Z=1;Z<J.length;++Z)$.parameters.push(Q[J[Z]]);return $},generateFuncType=(J,Q)=>{var $=J.slice(0,1),Z=J.slice(1),X={i:127,p:127,j:126,f:125,d:124,e:111};Q.push(96),uleb128Encode(Z.length,Q);for(var K=0;K<Z.length;++K)Q.push(X[Z[K]]);if($=="v")Q.push(0);else Q.push(1,X[$])},convertJsFunctionToWasm=(J,Q)=>{if(typeof WebAssembly.Function=="function")return new WebAssembly.Function(sigToWasmTypes(Q),J);var $=[1];generateFuncType(Q,$);var Z=[0,97,115,109,1,0,0,0,1];uleb128Encode($.length,Z),Z.push(...$),Z.push(2,7,1,1,101,1,102,0,0,7,5,1,1,102,0,0);var X=new WebAssembly.Module(new Uint8Array(Z)),K=new WebAssembly.Instance(X,{e:{f:J}}),G=K.exports.f;return G},wasmTableMirror=[],wasmTable=new WebAssembly.Table({initial:28,element:"anyfunc"}),getWasmTableEntry=(J)=>{var Q=wasmTableMirror[J];if(!Q){if(J>=wasmTableMirror.length)wasmTableMirror.length=J+1;wasmTableMirror[J]=Q=wasmTable.get(J)}return Q},updateTableMap=(J,Q)=>{if(functionsInTableMap)for(var $=J;$<J+Q;$++){var Z=getWasmTableEntry($);if(Z)functionsInTableMap.set(Z,$)}},functionsInTableMap,getFunctionAddress=(J)=>{if(!functionsInTableMap)functionsInTableMap=new WeakMap,updateTableMap(0,wasmTable.length);return functionsInTableMap.get(J)||0},freeTableIndexes=[],getEmptyTableSlot=()=>{if(freeTableIndexes.length)return freeTableIndexes.pop();try{wasmTable.grow(1)}catch(J){if(!(J instanceof RangeError))throw J;throw"Unable to grow wasm table. Set ALLOW_TABLE_GROWTH."}return wasmTable.length-1},setWasmTableEntry=(J,Q)=>{wasmTable.set(J,Q),wasmTableMirror[J]=wasmTable.get(J)},addFunction=(J,Q)=>{var $=getFunctionAddress(J);if($)return $;var Z=getEmptyTableSlot();try{setWasmTableEntry(Z,J)}catch(K){if(!(K instanceof TypeError))throw K;var X=convertJsFunctionToWasm(J,Q);setWasmTableEntry(Z,X)}return functionsInTableMap.set(J,Z),Z},updateGOT=(J,Q)=>{for(var $ in J){if(isInternalSym($))continue;var Z=J[$];if($.startsWith("orig$"))$=$.split("$")[1],Q=!0;if(GOT[$]||=new WebAssembly.Global({value:"i32",mutable:!0}),Q||GOT[$].value==0)if(typeof Z=="function")GOT[$].value=addFunction(Z);else if(typeof Z=="number")GOT[$].value=Z;else err(`unhandled export type for '${$}': ${typeof Z}`)}},relocateExports=(J,Q,$)=>{var Z={};for(var X in J){var K=J[X];if(typeof K=="object")K=K.value;if(typeof K=="number")K+=Q;Z[X]=K}return updateGOT(Z,$),Z},isSymbolDefined=(J)=>{var Q=wasmImports[J];if(!Q||Q.stub)return!1;return!0},dynCallLegacy=(J,Q,$)=>{J=J.replace(/p/g,"i");var Z=Y["dynCall_"+J];return Z(Q,...$)},dynCall=(J,Q,$=[])=>{if(J.includes("j"))return dynCallLegacy(J,Q,$);var Z=getWasmTableEntry(Q)(...$);return Z},stackSave=()=>_emscripten_stack_get_current(),stackRestore=(J)=>__emscripten_stack_restore(J),createInvokeFunction=(J)=>(Q,...$)=>{var Z=stackSave();try{return dynCall(J,Q,$)}catch(X){if(stackRestore(Z),X!==X+0)throw X;_setThrew(1,0)}},resolveGlobalSymbol=(J,Q=!1)=>{var $;if(Q&&"orig$"+J in wasmImports)J="orig$"+J;if(isSymbolDefined(J))$=wasmImports[J];else if(J.startsWith("invoke_"))$=wasmImports[J]=createInvokeFunction(J.split("_")[1]);return{sym:$,name:J}},UTF8ToString=(J,Q)=>J?UTF8ArrayToString(HEAPU8,J,Q):"",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;if(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;if(tableGrowthNeeded>0)wasmTable.grow(tableGrowthNeeded);var moduleExports;function resolveSymbol(J){var Q=resolveGlobalSymbol(J).sym;if(!Q&&localScope)Q=localScope[J];if(!Q)Q=moduleExports[J];return Q}var proxyHandler={get(J,Q){switch(Q){case"__memory_base":return memoryBase;case"__table_base":return tableBase}if(Q in wasmImports&&!wasmImports[Q].stub)return wasmImports[Q];if(!(Q in J)){var $;J[Q]=(...Z)=>{return $||=resolveSymbol(Q),$(...Z)}}return J[Q]}},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){if(updateTableMap(tableBase,metadata.tableSize),moduleExports=relocateExports(instance.exports,memoryBase),!flags.allowUndefined)reportUndefinedSymbols();function addEmAsm(addr,body){var args=[],arity=0;for(;arity<16;arity++)if(body.indexOf("$"+arity)!=-1)args.push("$"+arity);else break;args=args.join(",");var func=`(${args}) => { ${body} };`;ASM_CONSTS[start]=eval(func)}if("__start_em_asm"in moduleExports){var{__start_em_asm:start,__stop_em_asm:stop}=moduleExports;while(start<stop){var jsString=UTF8ToString(start);addEmAsm(start,jsString),start=HEAPU8.indexOf(0,start)+1}}function addEmJs(name,cSig,body){var jsArgs=[];if(cSig=cSig.slice(1,-1),cSig!="void"){cSig=cSig.split(",");for(var i in cSig){var jsArg=cSig[i].split(" ").pop();jsArgs.push(jsArg.replace("*",""))}}var func=`(${jsArgs}) => ${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;if(applyRelocs)if(runtimeInitialized)applyRelocs();else __RELOC_FUNCS__.push(applyRelocs);var init=moduleExports.__wasm_call_ctors;if(init)if(runtimeInitialized)init();else __ATINIT__.push(init);return 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((J)=>postInstantiation(J.module,J.instance))}var module=binary instanceof WebAssembly.Module?binary:new WebAssembly.Module(binary),instance=new WebAssembly.Instance(module,info);return postInstantiation(module,instance)}if(flags.loadAsync)return metadata.neededDynlibs.reduce((J,Q)=>J.then(()=>loadDynamicLibrary(Q,flags,localScope)),Promise.resolve()).then(loadModule);return metadata.neededDynlibs.forEach((J)=>loadDynamicLibrary(J,flags,localScope)),loadModule()},mergeLibSymbols=(J,Q)=>{for(var[$,Z]of Object.entries(J)){let X=(G)=>{if(!isSymbolDefined(G))wasmImports[G]=Z};X($);let K="__main_argc_argv";if($=="main")X(K);if($==K)X("main");if($.startsWith("dynCall_")&&!Y.hasOwnProperty($))Y[$]=Z}},asyncLoad=(J,Q,$,Z)=>{var X=!Z?getUniqueRunDependency(`al ${J}`):"";if(readAsync(J).then((K)=>{if(Q(new Uint8Array(K)),X)removeRunDependency(X)},(K)=>{if($)$();else throw`Loading data file "${J}" failed.`}),X)addRunDependency(X)};function loadDynamicLibrary(J,Q={global:!0,nodelete:!0},$,Z){var X=LDSO.loadedLibsByName[J];if(X){if(!Q.global){if($)Object.assign($,X.exports)}else if(!X.global)X.global=!0,mergeLibSymbols(X.exports,J);if(Q.nodelete&&X.refcount!==1/0)X.refcount=1/0;if(X.refcount++,Z)LDSO.loadedLibsByHandle[Z]=X;return Q.loadAsync?Promise.resolve(!0):!0}X=newDSO(J,Z,"loading"),X.refcount=Q.nodelete?1/0:1,X.global=Q.global;function K(){if(Z){var q=LE_HEAP_LOAD_U32((Z+28>>2)*4),W=LE_HEAP_LOAD_U32((Z+32>>2)*4);if(q&&W){var z=HEAP8.slice(q,q+W);return Q.loadAsync?Promise.resolve(z):z}}var V=locateFile(J);if(Q.loadAsync)return new Promise(function(H,A){asyncLoad(V,H,A)});if(!readBinary)throw Error(`${V}: file not found, and synchronous loading of external files is not available`);return readBinary(V)}function G(){if(Q.loadAsync)return K().then((q)=>loadWebAssemblyModule(q,Q,J,$,Z));return loadWebAssemblyModule(K(),Q,J,$,Z)}function U(q){if(X.global)mergeLibSymbols(q,J);else if($)Object.assign($,q);X.exports=q}if(Q.loadAsync)return G().then((q)=>{return U(q),!0});return U(G()),!0}var reportUndefinedSymbols=()=>{for(var[J,Q]of Object.entries(GOT))if(Q.value==0){var $=resolveGlobalSymbol(J,!0).sym;if(!$&&!Q.required)continue;if(typeof $=="function")Q.value=addFunction($,$.sig);else if(typeof $=="number")Q.value=$;else throw Error(`bad export type for '${J}': ${typeof $}`)}},loadDylibs=()=>{if(!dynamicLibraries.length){reportUndefinedSymbols();return}addRunDependency("loadDylibs"),dynamicLibraries.reduce((J,Q)=>J.then(()=>loadDynamicLibrary(Q,{loadAsync:!0,global:!0,nodelete:!0,allowUndefined:!0})),Promise.resolve()).then(()=>{reportUndefinedSymbols(),removeRunDependency("loadDylibs")})},noExitRuntime=Y.noExitRuntime||!0;function setValue(J,Q,$="i8"){if($.endsWith("*"))$="*";switch($){case"i1":HEAP8[J]=Q;break;case"i8":HEAP8[J]=Q;break;case"i16":LE_HEAP_STORE_I16((J>>1)*2,Q);break;case"i32":LE_HEAP_STORE_I32((J>>2)*4,Q);break;case"i64":abort("to do setValue(i64) use WASM_BIGINT");case"float":LE_HEAP_STORE_F32((J>>2)*4,Q);break;case"double":LE_HEAP_STORE_F64((J>>3)*8,Q);break;case"*":LE_HEAP_STORE_U32((J>>2)*4,Q);break;default:abort(`invalid type for setValue: ${$}`)}}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=(J,Q,$)=>HEAPU8.copyWithin(J,Q,Q+$);__emscripten_memcpy_js.sig="vppp";var _emscripten_date_now=()=>Date.now();_emscripten_date_now.sig="d";var _emscripten_get_now=()=>performance.now();_emscripten_get_now.sig="d";var getHeapMax=()=>2147483648,growMemory=(J)=>{var Q=wasmMemory.buffer,$=(J-Q.byteLength+65535)/65536;try{return wasmMemory.grow($),updateMemoryViews(),1}catch(Z){}},_emscripten_resize_heap=(J)=>{var Q=HEAPU8.length;J>>>=0;var $=getHeapMax();if(J>$)return!1;var Z=(q,W)=>q+(W-q%W)%W;for(var X=1;X<=4;X*=2){var K=Q*(1+0.2/X);K=Math.min(K,J+100663296);var G=Math.min($,Z(Math.max(J,K),65536)),U=growMemory(G);if(U)return!0}return!1};_emscripten_resize_heap.sig="ip";var _fd_close=(J)=>52;_fd_close.sig="ii";var convertI32PairToI53Checked=(J,Q)=>Q+2097152>>>0<4194305-!!J?(J>>>0)+Q*4294967296:NaN;function _fd_seek(J,Q,$,Z,X){var K=convertI32PairToI53Checked(Q,$);return 70}_fd_seek.sig="iiiiip";var printCharBuffers=[null,[],[]],printChar=(J,Q)=>{var $=printCharBuffers[J];if(Q===0||Q===10)(J===1?out:err)(UTF8ArrayToString($,0)),$.length=0;else $.push(Q)},_fd_write=(J,Q,$,Z)=>{var X=0;for(var K=0;K<$;K++){var G=LE_HEAP_LOAD_U32((Q>>2)*4),U=LE_HEAP_LOAD_U32((Q+4>>2)*4);Q+=8;for(var q=0;q<U;q++)printChar(J,HEAPU8[G+q]);X+=U}return LE_HEAP_STORE_U32((Z>>2)*4,X),0};_fd_write.sig="iippp";function _tree_sitter_log_callback(J,Q){if(currentLogCallback){let $=UTF8ToString(Q);currentLogCallback($,J!==0)}}function _tree_sitter_parse_callback(J,Q,$,Z,X){let G=currentParseCallback(Q,{row:$,column:Z});if(typeof G==="string")setValue(X,G.length,"i32"),stringToUTF16(G,J,10240);else setValue(X,0,"i32")}var runtimeKeepaliveCounter=0,keepRuntimeAlive=()=>noExitRuntime||runtimeKeepaliveCounter>0,_proc_exit=(J)=>{if(EXITSTATUS=J,!keepRuntimeAlive())Y.onExit?.(J),ABORT=!0;quit_(J,new ExitStatus(J))};_proc_exit.sig="vi";var exitJS=(J,Q)=>{EXITSTATUS=J,_proc_exit(J)},handleException=(J)=>{if(J instanceof ExitStatus||J=="unwind")return EXITSTATUS;quit_(1,J)},lengthBytesUTF8=(J)=>{var Q=0;for(var $=0;$<J.length;++$){var Z=J.charCodeAt($);if(Z<=127)Q++;else if(Z<=2047)Q+=2;else if(Z>=55296&&Z<=57343)Q+=4,++$;else Q+=3}return Q},stringToUTF8Array=(J,Q,$,Z)=>{if(!(Z>0))return 0;var X=$,K=$+Z-1;for(var G=0;G<J.length;++G){var U=J.charCodeAt(G);if(U>=55296&&U<=57343){var q=J.charCodeAt(++G);U=65536+((U&1023)<<10)|q&1023}if(U<=127){if($>=K)break;Q[$++]=U}else if(U<=2047){if($+1>=K)break;Q[$++]=192|U>>6,Q[$++]=128|U&63}else if(U<=65535){if($+2>=K)break;Q[$++]=224|U>>12,Q[$++]=128|U>>6&63,Q[$++]=128|U&63}else{if($+3>=K)break;Q[$++]=240|U>>18,Q[$++]=128|U>>12&63,Q[$++]=128|U>>6&63,Q[$++]=128|U&63}}return Q[$]=0,$-X},stringToUTF8=(J,Q,$)=>stringToUTF8Array(J,HEAPU8,Q,$),stackAlloc=(J)=>__emscripten_stack_alloc(J),stringToUTF8OnStack=(J)=>{var Q=lengthBytesUTF8(J)+1,$=stackAlloc(Q);return stringToUTF8(J,$,Q),$},stringToUTF16=(J,Q,$)=>{if($??=2147483647,$<2)return 0;$-=2;var Z=Q,X=$<J.length*2?$/2:J.length;for(var K=0;K<X;++K){var G=J.charCodeAt(K);LE_HEAP_STORE_I16((Q>>1)*2,G),Q+=2}return LE_HEAP_STORE_I16((Q>>1)*2,0),Q-Z},AsciiToString=(J)=>{var Q="";while(!0){var $=HEAPU8[J++];if(!$)return Q;Q+=String.fromCharCode($)}},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=Y._malloc=(J)=>(_malloc=Y._malloc=wasmExports.malloc)(J),_calloc=Y._calloc=(J,Q)=>(_calloc=Y._calloc=wasmExports.calloc)(J,Q),_realloc=Y._realloc=(J,Q)=>(_realloc=Y._realloc=wasmExports.realloc)(J,Q),_free=Y._free=(J)=>(_free=Y._free=wasmExports.free)(J),_ts_language_symbol_count=Y._ts_language_symbol_count=(J)=>(_ts_language_symbol_count=Y._ts_language_symbol_count=wasmExports.ts_language_symbol_count)(J),_ts_language_state_count=Y._ts_language_state_count=(J)=>(_ts_language_state_count=Y._ts_language_state_count=wasmExports.ts_language_state_count)(J),_ts_language_version=Y._ts_language_version=(J)=>(_ts_language_version=Y._ts_language_version=wasmExports.ts_language_version)(J),_ts_language_field_count=Y._ts_language_field_count=(J)=>(_ts_language_field_count=Y._ts_language_field_count=wasmExports.ts_language_field_count)(J),_ts_language_next_state=Y._ts_language_next_state=(J,Q,$)=>(_ts_language_next_state=Y._ts_language_next_state=wasmExports.ts_language_next_state)(J,Q,$),_ts_language_symbol_name=Y._ts_language_symbol_name=(J,Q)=>(_ts_language_symbol_name=Y._ts_language_symbol_name=wasmExports.ts_language_symbol_name)(J,Q),_ts_language_symbol_for_name=Y._ts_language_symbol_for_name=(J,Q,$,Z)=>(_ts_language_symbol_for_name=Y._ts_language_symbol_for_name=wasmExports.ts_language_symbol_for_name)(J,Q,$,Z),_strncmp=Y._strncmp=(J,Q,$)=>(_strncmp=Y._strncmp=wasmExports.strncmp)(J,Q,$),_ts_language_symbol_type=Y._ts_language_symbol_type=(J,Q)=>(_ts_language_symbol_type=Y._ts_language_symbol_type=wasmExports.ts_language_symbol_type)(J,Q),_ts_language_field_name_for_id=Y._ts_language_field_name_for_id=(J,Q)=>(_ts_language_field_name_for_id=Y._ts_language_field_name_for_id=wasmExports.ts_language_field_name_for_id)(J,Q),_ts_lookahead_iterator_new=Y._ts_lookahead_iterator_new=(J,Q)=>(_ts_lookahead_iterator_new=Y._ts_lookahead_iterator_new=wasmExports.ts_lookahead_iterator_new)(J,Q),_ts_lookahead_iterator_delete=Y._ts_lookahead_iterator_delete=(J)=>(_ts_lookahead_iterator_delete=Y._ts_lookahead_iterator_delete=wasmExports.ts_lookahead_iterator_delete)(J),_ts_lookahead_iterator_reset_state=Y._ts_lookahead_iterator_reset_state=(J,Q)=>(_ts_lookahead_iterator_reset_state=Y._ts_lookahead_iterator_reset_state=wasmExports.ts_lookahead_iterator_reset_state)(J,Q),_ts_lookahead_iterator_reset=Y._ts_lookahead_iterator_reset=(J,Q,$)=>(_ts_lookahead_iterator_reset=Y._ts_lookahead_iterator_reset=wasmExports.ts_lookahead_iterator_reset)(J,Q,$),_ts_lookahead_iterator_next=Y._ts_lookahead_iterator_next=(J)=>(_ts_lookahead_iterator_next=Y._ts_lookahead_iterator_next=wasmExports.ts_lookahead_iterator_next)(J),_ts_lookahead_iterator_current_symbol=Y._ts_lookahead_iterator_current_symbol=(J)=>(_ts_lookahead_iterator_current_symbol=Y._ts_lookahead_iterator_current_symbol=wasmExports.ts_lookahead_iterator_current_symbol)(J),_memset=Y._memset=(J,Q,$)=>(_memset=Y._memset=wasmExports.memset)(J,Q,$),_memcpy=Y._memcpy=(J,Q,$)=>(_memcpy=Y._memcpy=wasmExports.memcpy)(J,Q,$),_ts_parser_delete=Y._ts_parser_delete=(J)=>(_ts_parser_delete=Y._ts_parser_delete=wasmExports.ts_parser_delete)(J),_ts_parser_reset=Y._ts_parser_reset=(J)=>(_ts_parser_reset=Y._ts_parser_reset=wasmExports.ts_parser_reset)(J),_ts_parser_set_language=Y._ts_parser_set_language=(J,Q)=>(_ts_parser_set_language=Y._ts_parser_set_language=wasmExports.ts_parser_set_language)(J,Q),_ts_parser_timeout_micros=Y._ts_parser_timeout_micros=(J)=>(_ts_parser_timeout_micros=Y._ts_parser_timeout_micros=wasmExports.ts_parser_timeout_micros)(J),_ts_parser_set_timeout_micros=Y._ts_parser_set_timeout_micros=(J,Q,$)=>(_ts_parser_set_timeout_micros=Y._ts_parser_set_timeout_micros=wasmExports.ts_parser_set_timeout_micros)(J,Q,$),_ts_parser_set_included_ranges=Y._ts_parser_set_included_ranges=(J,Q,$)=>(_ts_parser_set_included_ranges=Y._ts_parser_set_included_ranges=wasmExports.ts_parser_set_included_ranges)(J,Q,$),_memmove=Y._memmove=(J,Q,$)=>(_memmove=Y._memmove=wasmExports.memmove)(J,Q,$),_memcmp=Y._memcmp=(J,Q,$)=>(_memcmp=Y._memcmp=wasmExports.memcmp)(J,Q,$),_ts_query_new=Y._ts_query_new=(J,Q,$,Z,X)=>(_ts_query_new=Y._ts_query_new=wasmExports.ts_query_new)(J,Q,$,Z,X),_ts_query_delete=Y._ts_query_delete=(J)=>(_ts_query_delete=Y._ts_query_delete=wasmExports.ts_query_delete)(J),_iswspace=Y._iswspace=(J)=>(_iswspace=Y._iswspace=wasmExports.iswspace)(J),_iswalnum=Y._iswalnum=(J)=>(_iswalnum=Y._iswalnum=wasmExports.iswalnum)(J),_ts_query_pattern_count=Y._ts_query_pattern_count=(J)=>(_ts_query_pattern_count=Y._ts_query_pattern_count=wasmExports.ts_query_pattern_count)(J),_ts_query_capture_count=Y._ts_query_capture_count=(J)=>(_ts_query_capture_count=Y._ts_query_capture_count=wasmExports.ts_query_capture_count)(J),_ts_query_string_count=Y._ts_query_string_count=(J)=>(_ts_query_string_count=Y._ts_query_string_count=wasmExports.ts_query_string_count)(J),_ts_query_capture_name_for_id=Y._ts_query_capture_name_for_id=(J,Q,$)=>(_ts_query_capture_name_for_id=Y._ts_query_capture_name_for_id=wasmExports.ts_query_capture_name_for_id)(J,Q,$),_ts_query_string_value_for_id=Y._ts_query_string_value_for_id=(J,Q,$)=>(_ts_query_string_value_for_id=Y._ts_query_string_value_for_id=wasmExports.ts_query_string_value_for_id)(J,Q,$),_ts_query_predicates_for_pattern=Y._ts_query_predicates_for_pattern=(J,Q,$)=>(_ts_query_predicates_for_pattern=Y._ts_query_predicates_for_pattern=wasmExports.ts_query_predicates_for_pattern)(J,Q,$),_ts_query_disable_capture=Y._ts_query_disable_capture=(J,Q,$)=>(_ts_query_disable_capture=Y._ts_query_disable_capture=wasmExports.ts_query_disable_capture)(J,Q,$),_ts_tree_copy=Y._ts_tree_copy=(J)=>(_ts_tree_copy=Y._ts_tree_copy=wasmExports.ts_tree_copy)(J),_ts_tree_delete=Y._ts_tree_delete=(J)=>(_ts_tree_delete=Y._ts_tree_delete=wasmExports.ts_tree_delete)(J),_ts_init=Y._ts_init=()=>(_ts_init=Y._ts_init=wasmExports.ts_init)(),_ts_parser_new_wasm=Y._ts_parser_new_wasm=()=>(_ts_parser_new_wasm=Y._ts_parser_new_wasm=wasmExports.ts_parser_new_wasm)(),_ts_parser_enable_logger_wasm=Y._ts_parser_enable_logger_wasm=(J,Q)=>(_ts_parser_enable_logger_wasm=Y._ts_parser_enable_logger_wasm=wasmExports.ts_parser_enable_logger_wasm)(J,Q),_ts_parser_parse_wasm=Y._ts_parser_parse_wasm=(J,Q,$,Z,X)=>(_ts_parser_parse_wasm=Y._ts_parser_parse_wasm=wasmExports.ts_parser_parse_wasm)(J,Q,$,Z,X),_ts_parser_included_ranges_wasm=Y._ts_parser_included_ranges_wasm=(J)=>(_ts_parser_included_ranges_wasm=Y._ts_parser_included_ranges_wasm=wasmExports.ts_parser_included_ranges_wasm)(J),_ts_language_type_is_named_wasm=Y._ts_language_type_is_named_wasm=(J,Q)=>(_ts_language_type_is_named_wasm=Y._ts_language_type_is_named_wasm=wasmExports.ts_language_type_is_named_wasm)(J,Q),_ts_language_type_is_visible_wasm=Y._ts_language_type_is_visible_wasm=(J,Q)=>(_ts_language_type_is_visible_wasm=Y._ts_language_type_is_visible_wasm=wasmExports.ts_language_type_is_visible_wasm)(J,Q),_ts_tree_root_node_wasm=Y._ts_tree_root_node_wasm=(J)=>(_ts_tree_root_node_wasm=Y._ts_tree_root_node_wasm=wasmExports.ts_tree_root_node_wasm)(J),_ts_tree_root_node_with_offset_wasm=Y._ts_tree_root_node_with_offset_wasm=(J)=>(_ts_tree_root_node_with_offset_wasm=Y._ts_tree_root_node_with_offset_wasm=wasmExports.ts_tree_root_node_with_offset_wasm)(J),_ts_tree_edit_wasm=Y._ts_tree_edit_wasm=(J)=>(_ts_tree_edit_wasm=Y._ts_tree_edit_wasm=wasmExports.ts_tree_edit_wasm)(J),_ts_tree_included_ranges_wasm=Y._ts_tree_included_ranges_wasm=(J)=>(_ts_tree_included_ranges_wasm=Y._ts_tree_included_ranges_wasm=wasmExports.ts_tree_included_ranges_wasm)(J),_ts_tree_get_changed_ranges_wasm=Y._ts_tree_get_changed_ranges_wasm=(J,Q)=>(_ts_tree_get_changed_ranges_wasm=Y._ts_tree_get_changed_ranges_wasm=wasmExports.ts_tree_get_changed_ranges_wasm)(J,Q),_ts_tree_cursor_new_wasm=Y._ts_tree_cursor_new_wasm=(J)=>(_ts_tree_cursor_new_wasm=Y._ts_tree_cursor_new_wasm=wasmExports.ts_tree_cursor_new_wasm)(J),_ts_tree_cursor_delete_wasm=Y._ts_tree_cursor_delete_wasm=(J)=>(_ts_tree_cursor_delete_wasm=Y._ts_tree_cursor_delete_wasm=wasmExports.ts_tree_cursor_delete_wasm)(J),_ts_tree_cursor_reset_wasm=Y._ts_tree_cursor_reset_wasm=(J)=>(_ts_tree_cursor_reset_wasm=Y._ts_tree_cursor_reset_wasm=wasmExports.ts_tree_cursor_reset_wasm)(J),_ts_tree_cursor_reset_to_wasm=Y._ts_tree_cursor_reset_to_wasm=(J,Q)=>(_ts_tree_cursor_reset_to_wasm=Y._ts_tree_cursor_reset_to_wasm=wasmExports.ts_tree_cursor_reset_to_wasm)(J,Q),_ts_tree_cursor_goto_first_child_wasm=Y._ts_tree_cursor_goto_first_child_wasm=(J)=>(_ts_tree_cursor_goto_first_child_wasm=Y._ts_tree_cursor_goto_first_child_wasm=wasmExports.ts_tree_cursor_goto_first_child_wasm)(J),_ts_tree_cursor_goto_last_child_wasm=Y._ts_tree_cursor_goto_last_child_wasm=(J)=>(_ts_tree_cursor_goto_last_child_wasm=Y._ts_tree_cursor_goto_last_child_wasm=wasmExports.ts_tree_cursor_goto_last_child_wasm)(J),_ts_tree_cursor_goto_first_child_for_index_wasm=Y._ts_tree_cursor_goto_first_child_for_index_wasm=(J)=>(_ts_tree_cursor_goto_first_child_for_index_wasm=Y._ts_tree_cursor_goto_first_child_for_index_wasm=wasmExports.ts_tree_cursor_goto_first_child_for_index_wasm)(J),_ts_tree_cursor_goto_first_child_for_position_wasm=Y._ts_tree_cursor_goto_first_child_for_position_wasm=(J)=>(_ts_tree_cursor_goto_first_child_for_position_wasm=Y._ts_tree_cursor_goto_first_child_for_position_wasm=wasmExports.ts_tree_cursor_goto_first_child_for_position_wasm)(J),_ts_tree_cursor_goto_next_sibling_wasm=Y._ts_tree_cursor_goto_next_sibling_wasm=(J)=>(_ts_tree_cursor_goto_next_sibling_wasm=Y._ts_tree_cursor_goto_next_sibling_wasm=wasmExports.ts_tree_cursor_goto_next_sibling_wasm)(J),_ts_tree_cursor_goto_previous_sibling_wasm=Y._ts_tree_cursor_goto_previous_sibling_wasm=(J)=>(_ts_tree_cursor_goto_previous_sibling_wasm=Y._ts_tree_cursor_goto_previous_sibling_wasm=wasmExports.ts_tree_cursor_goto_previous_sibling_wasm)(J),_ts_tree_cursor_goto_descendant_wasm=Y._ts_tree_cursor_goto_descendant_wasm=(J,Q)=>(_ts_tree_cursor_goto_descendant_wasm=Y._ts_tree_cursor_goto_descendant_wasm=wasmExports.ts_tree_cursor_goto_descendant_wasm)(J,Q),_ts_tree_cursor_goto_parent_wasm=Y._ts_tree_cursor_goto_parent_wasm=(J)=>(_ts_tree_cursor_goto_parent_wasm=Y._ts_tree_cursor_goto_parent_wasm=wasmExports.ts_tree_cursor_goto_parent_wasm)(J),_ts_tree_cursor_current_node_type_id_wasm=Y._ts_tree_cursor_current_node_type_id_wasm=(J)=>(_ts_tree_cursor_current_node_type_id_wasm=Y._ts_tree_cursor_current_node_type_id_wasm=wasmExports.ts_tree_cursor_current_node_type_id_wasm)(J),_ts_tree_cursor_current_node_state_id_wasm=Y._ts_tree_cursor_current_node_state_id_wasm=(J)=>(_ts_tree_cursor_current_node_state_id_wasm=Y._ts_tree_cursor_current_node_state_id_wasm=wasmExports.ts_tree_cursor_current_node_state_id_wasm)(J),_ts_tree_cursor_current_node_is_named_wasm=Y._ts_tree_cursor_current_node_is_named_wasm=(J)=>(_ts_tree_cursor_current_node_is_named_wasm=Y._ts_tree_cursor_current_node_is_named_wasm=wasmExports.ts_tree_cursor_current_node_is_named_wasm)(J),_ts_tree_cursor_current_node_is_missing_wasm=Y._ts_tree_cursor_current_node_is_missing_wasm=(J)=>(_ts_tree_cursor_current_node_is_missing_wasm=Y._ts_tree_cursor_current_node_is_missing_wasm=wasmExports.ts_tree_cursor_current_node_is_missing_wasm)(J),_ts_tree_cursor_current_node_id_wasm=Y._ts_tree_cursor_current_node_id_wasm=(J)=>(_ts_tree_cursor_current_node_id_wasm=Y._ts_tree_cursor_current_node_id_wasm=wasmExports.ts_tree_cursor_current_node_id_wasm)(J),_ts_tree_cursor_start_position_wasm=Y._ts_tree_cursor_start_position_wasm=(J)=>(_ts_tree_cursor_start_position_wasm=Y._ts_tree_cursor_start_position_wasm=wasmExports.ts_tree_cursor_start_position_wasm)(J),_ts_tree_cursor_end_position_wasm=Y._ts_tree_cursor_end_position_wasm=(J)=>(_ts_tree_cursor_end_position_wasm=Y._ts_tree_cursor_end_position_wasm=wasmExports.ts_tree_cursor_end_position_wasm)(J),_ts_tree_cursor_start_index_wasm=Y._ts_tree_cursor_start_index_wasm=(J)=>(_ts_tree_cursor_start_index_wasm=Y._ts_tree_cursor_start_index_wasm=wasmExports.ts_tree_cursor_start_index_wasm)(J),_ts_tree_cursor_end_index_wasm=Y._ts_tree_cursor_end_index_wasm=(J)=>(_ts_tree_cursor_end_index_wasm=Y._ts_tree_cursor_end_index_wasm=wasmExports.ts_tree_cursor_end_index_wasm)(J),_ts_tree_cursor_current_field_id_wasm=Y._ts_tree_cursor_current_field_id_wasm=(J)=>(_ts_tree_cursor_current_field_id_wasm=Y._ts_tree_cursor_current_field_id_wasm=wasmExports.ts_tree_cursor_current_field_id_wasm)(J),_ts_tree_cursor_current_depth_wasm=Y._ts_tree_cursor_current_depth_wasm=(J)=>(_ts_tree_cursor_current_depth_wasm=Y._ts_tree_cursor_current_depth_wasm=wasmExports.ts_tree_cursor_current_depth_wasm)(J),_ts_tree_cursor_current_descendant_index_wasm=Y._ts_tree_cursor_current_descendant_index_wasm=(J)=>(_ts_tree_cursor_current_descendant_index_wasm=Y._ts_tree_cursor_current_descendant_index_wasm=wasmExports.ts_tree_cursor_current_descendant_index_wasm)(J),_ts_tree_cursor_current_node_wasm=Y._ts_tree_cursor_current_node_wasm=(J)=>(_ts_tree_cursor_current_node_wasm=Y._ts_tree_cursor_current_node_wasm=wasmExports.ts_tree_cursor_current_node_wasm)(J),_ts_node_symbol_wasm=Y._ts_node_symbol_wasm=(J)=>(_ts_node_symbol_wasm=Y._ts_node_symbol_wasm=wasmExports.ts_node_symbol_wasm)(J),_ts_node_field_name_for_child_wasm=Y._ts_node_field_name_for_child_wasm=(J,Q)=>(_ts_node_field_name_for_child_wasm=Y._ts_node_field_name_for_child_wasm=wasmExports.ts_node_field_name_for_child_wasm)(J,Q),_ts_node_children_by_field_id_wasm=Y._ts_node_children_by_field_id_wasm=(J,Q)=>(_ts_node_children_by_field_id_wasm=Y._ts_node_children_by_field_id_wasm=wasmExports.ts_node_children_by_field_id_wasm)(J,Q),_ts_node_first_child_for_byte_wasm=Y._ts_node_first_child_for_byte_wasm=(J)=>(_ts_node_first_child_for_byte_wasm=Y._ts_node_first_child_for_byte_wasm=wasmExports.ts_node_first_child_for_byte_wasm)(J),_ts_node_first_named_child_for_byte_wasm=Y._ts_node_first_named_child_for_byte_wasm=(J)=>(_ts_node_first_named_child_for_byte_wasm=Y._ts_node_first_named_child_for_byte_wasm=wasmExports.ts_node_first_named_child_for_byte_wasm)(J),_ts_node_grammar_symbol_wasm=Y._ts_node_grammar_symbol_wasm=(J)=>(_ts_node_grammar_symbol_wasm=Y._ts_node_grammar_symbol_wasm=wasmExports.ts_node_grammar_symbol_wasm)(J),_ts_node_child_count_wasm=Y._ts_node_child_count_wasm=(J)=>(_ts_node_child_count_wasm=Y._ts_node_child_count_wasm=wasmExports.ts_node_child_count_wasm)(J),_ts_node_named_child_count_wasm=Y._ts_node_named_child_count_wasm=(J)=>(_ts_node_named_child_count_wasm=Y._ts_node_named_child_count_wasm=wasmExports.ts_node_named_child_count_wasm)(J),_ts_node_child_wasm=Y._ts_node_child_wasm=(J,Q)=>(_ts_node_child_wasm=Y._ts_node_child_wasm=wasmExports.ts_node_child_wasm)(J,Q),_ts_node_named_child_wasm=Y._ts_node_named_child_wasm=(J,Q)=>(_ts_node_named_child_wasm=Y._ts_node_named_child_wasm=wasmExports.ts_node_named_child_wasm)(J,Q),_ts_node_child_by_field_id_wasm=Y._ts_node_child_by_field_id_wasm=(J,Q)=>(_ts_node_child_by_field_id_wasm=Y._ts_node_child_by_field_id_wasm=wasmExports.ts_node_child_by_field_id_wasm)(J,Q),_ts_node_next_sibling_wasm=Y._ts_node_next_sibling_wasm=(J)=>(_ts_node_next_sibling_wasm=Y._ts_node_next_sibling_wasm=wasmExports.ts_node_next_sibling_wasm)(J),_ts_node_prev_sibling_wasm=Y._ts_node_prev_sibling_wasm=(J)=>(_ts_node_prev_sibling_wasm=Y._ts_node_prev_sibling_wasm=wasmExports.ts_node_prev_sibling_wasm)(J),_ts_node_next_named_sibling_wasm=Y._ts_node_next_named_sibling_wasm=(J)=>(_ts_node_next_named_sibling_wasm=Y._ts_node_next_named_sibling_wasm=wasmExports.ts_node_next_named_sibling_wasm)(J),_ts_node_prev_named_sibling_wasm=Y._ts_node_prev_named_sibling_wasm=(J)=>(_ts_node_prev_named_sibling_wasm=Y._ts_node_prev_named_sibling_wasm=wasmExports.ts_node_prev_named_sibling_wasm)(J),_ts_node_descendant_count_wasm=Y._ts_node_descendant_count_wasm=(J)=>(_ts_node_descendant_count_wasm=Y._ts_node_descendant_count_wasm=wasmExports.ts_node_descendant_count_wasm)(J),_ts_node_parent_wasm=Y._ts_node_parent_wasm=(J)=>(_ts_node_parent_wasm=Y._ts_node_parent_wasm=wasmExports.ts_node_parent_wasm)(J),_ts_node_descendant_for_index_wasm=Y._ts_node_descendant_for_index_wasm=(J)=>(_ts_node_descendant_for_index_wasm=Y._ts_node_descendant_for_index_wasm=wasmExports.ts_node_descendant_for_index_wasm)(J),_ts_node_named_descendant_for_index_wasm=Y._ts_node_named_descendant_for_index_wasm=(J)=>(_ts_node_named_descendant_for_index_wasm=Y._ts_node_named_descendant_for_index_wasm=wasmExports.ts_node_named_descendant_for_index_wasm)(J),_ts_node_descendant_for_position_wasm=Y._ts_node_descendant_for_position_wasm=(J)=>(_ts_node_descendant_for_position_wasm=Y._ts_node_descendant_for_position_wasm=wasmExports.ts_node_descendant_for_position_wasm)(J),_ts_node_named_descendant_for_position_wasm=Y._ts_node_named_descendant_for_position_wasm=(J)=>(_ts_node_named_descendant_for_position_wasm=Y._ts_node_named_descendant_for_position_wasm=wasmExports.ts_node_named_descendant_for_position_wasm)(J),_ts_node_start_point_wasm=Y._ts_node_start_point_wasm=(J)=>(_ts_node_start_point_wasm=Y._ts_node_start_point_wasm=wasmExports.ts_node_start_point_wasm)(J),_ts_node_end_point_wasm=Y._ts_node_end_point_wasm=(J)=>(_ts_node_end_point_wasm=Y._ts_node_end_point_wasm=wasmExports.ts_node_end_point_wasm)(J),_ts_node_start_index_wasm=Y._ts_node_start_index_wasm=(J)=>(_ts_node_start_index_wasm=Y._ts_node_start_index_wasm=wasmExports.ts_node_start_index_wasm)(J),_ts_node_end_index_wasm=Y._ts_node_end_index_wasm=(J)=>(_ts_node_end_index_wasm=Y._ts_node_end_index_wasm=wasmExports.ts_node_end_index_wasm)(J),_ts_node_to_string_wasm=Y._ts_node_to_string_wasm=(J)=>(_ts_node_to_string_wasm=Y._ts_node_to_string_wasm=wasmExports.ts_node_to_string_wasm)(J),_ts_node_children_wasm=Y._ts_node_children_wasm=(J)=>(_ts_node_children_wasm=Y._ts_node_children_wasm=wasmExports.ts_node_children_wasm)(J),_ts_node_named_children_wasm=Y._ts_node_named_children_wasm=(J)=>(_ts_node_named_children_wasm=Y._ts_node_named_children_wasm=wasmExports.ts_node_named_children_wasm)(J),_ts_node_descendants_of_type_wasm=Y._ts_node_descendants_of_type_wasm=(J,Q,$,Z,X,K,G)=>(_ts_node_descendants_of_type_wasm=Y._ts_node_descendants_of_type_wasm=wasmExports.ts_node_descendants_of_type_wasm)(J,Q,$,Z,X,K,G),_ts_node_is_named_wasm=Y._ts_node_is_named_wasm=(J)=>(_ts_node_is_named_wasm=Y._ts_node_is_named_wasm=wasmExports.ts_node_is_named_wasm)(J),_ts_node_has_changes_wasm=Y._ts_node_has_changes_wasm=(J)=>(_ts_node_has_changes_wasm=Y._ts_node_has_changes_wasm=wasmExports.ts_node_has_changes_wasm)(J),_ts_node_has_error_wasm=Y._ts_node_has_error_wasm=(J)=>(_ts_node_has_error_wasm=Y._ts_node_has_error_wasm=wasmExports.ts_node_has_error_wasm)(J),_ts_node_is_error_wasm=Y._ts_node_is_error_wasm=(J)=>(_ts_node_is_error_wasm=Y._ts_node_is_error_wasm=wasmExports.ts_node_is_error_wasm)(J),_ts_node_is_missing_wasm=Y._ts_node_is_missing_wasm=(J)=>(_ts_node_is_missing_wasm=Y._ts_node_is_missing_wasm=wasmExports.ts_node_is_missing_wasm)(J),_ts_node_is_extra_wasm=Y._ts_node_is_extra_wasm=(J)=>(_ts_node_is_extra_wasm=Y._ts_node_is_extra_wasm=wasmExports.ts_node_is_extra_wasm)(J),_ts_node_parse_state_wasm=Y._ts_node_parse_state_wasm=(J)=>(_ts_node_parse_state_wasm=Y._ts_node_parse_state_wasm=wasmExports.ts_node_parse_state_wasm)(J),_ts_node_next_parse_state_wasm=Y._ts_node_next_parse_state_wasm=(J)=>(_ts_node_next_parse_state_wasm=Y._ts_node_next_parse_state_wasm=wasmExports.ts_node_next_parse_state_wasm)(J),_ts_query_matches_wasm=Y._ts_query_matches_wasm=(J,Q,$,Z,X,K,G,U,q,W,z)=>(_ts_query_matches_wasm=Y._ts_query_matches_wasm=wasmExports.ts_query_matches_wasm)(J,Q,$,Z,X,K,G,U,q,W,z),_ts_query_captures_wasm=Y._ts_query_captures_wasm=(J,Q,$,Z,X,K,G,U,q,W,z)=>(_ts_query_captures_wasm=Y._ts_query_captures_wasm=wasmExports.ts_query_captures_wasm)(J,Q,$,Z,X,K,G,U,q,W,z),_iswalpha=Y._iswalpha=(J)=>(_iswalpha=Y._iswalpha=wasmExports.iswalpha)(J),_iswblank=Y._iswblank=(J)=>(_iswblank=Y._iswblank=wasmExports.iswblank)(J),_iswdigit=Y._iswdigit=(J)=>(_iswdigit=Y._iswdigit=wasmExports.iswdigit)(J),_iswlower=Y._iswlower=(J)=>(_iswlower=Y._iswlower=wasmExports.iswlower)(J),_iswupper=Y._iswupper=(J)=>(_iswupper=Y._iswupper=wasmExports.iswupper)(J),_iswxdigit=Y._iswxdigit=(J)=>(_iswxdigit=Y._iswxdigit=wasmExports.iswxdigit)(J),_memchr=Y._memchr=(J,Q,$)=>(_memchr=Y._memchr=wasmExports.memchr)(J,Q,$),_strlen=Y._strlen=(J)=>(_strlen=Y._strlen=wasmExports.strlen)(J),_strcmp=Y._strcmp=(J,Q)=>(_strcmp=Y._strcmp=wasmExports.strcmp)(J,Q),_strncat=Y._strncat=(J,Q,$)=>(_strncat=Y._strncat=wasmExports.strncat)(J,Q,$),_strncpy=Y._strncpy=(J,Q,$)=>(_strncpy=Y._strncpy=wasmExports.strncpy)(J,Q,$),_towlower=Y._towlower=(J)=>(_towlower=Y._towlower=wasmExports.towlower)(J),_towupper=Y._towupper=(J)=>(_towupper=Y._towupper=wasmExports.towupper)(J),_setThrew=(J,Q)=>(_setThrew=wasmExports.setThrew)(J,Q),__emscripten_stack_restore=(J)=>(__emscripten_stack_restore=wasmExports._emscripten_stack_restore)(J),__emscripten_stack_alloc=(J)=>(__emscripten_stack_alloc=wasmExports._emscripten_stack_alloc)(J),_emscripten_stack_get_current=()=>(_emscripten_stack_get_current=wasmExports.emscripten_stack_get_current)(),dynCall_jiji=Y.dynCall_jiji=(J,Q,$,Z,X)=>(dynCall_jiji=Y.dynCall_jiji=wasmExports.dynCall_jiji)(J,Q,$,Z,X),_orig$ts_parser_timeout_micros=Y._orig$ts_parser_timeout_micros=(J)=>(_orig$ts_parser_timeout_micros=Y._orig$ts_parser_timeout_micros=wasmExports.orig$ts_parser_timeout_micros)(J),_orig$ts_parser_set_timeout_micros=Y._orig$ts_parser_set_timeout_micros=(J,Q)=>(_orig$ts_parser_set_timeout_micros=Y._orig$ts_parser_set_timeout_micros=wasmExports.orig$ts_parser_set_timeout_micros)(J,Q);Y.AsciiToString=AsciiToString,Y.stringToUTF16=stringToUTF16;var calledRun;dependenciesFulfilled=function J(){if(!calledRun)run();if(!calledRun)dependenciesFulfilled=J};function callMain(J=[]){var Q=resolveGlobalSymbol("main").sym;if(!Q)return;J.unshift(thisProgram);var $=J.length,Z=stackAlloc(($+1)*4),X=Z;J.forEach((G)=>{LE_HEAP_STORE_U32((X>>2)*4,stringToUTF8OnStack(G)),X+=4}),LE_HEAP_STORE_U32((X>>2)*4,0);try{var K=Q($,Z);return exitJS(K,!0),K}catch(G){return handleException(G)}}function run(J=arguments_){if(runDependencies>0)return;if(preRun(),runDependencies>0)return;function Q(){if(calledRun)return;if(calledRun=!0,Y.calledRun=!0,ABORT)return;if(initRuntime(),preMain(),Y.onRuntimeInitialized?.(),shouldRunNow)callMain(J);postRun()}if(Y.setStatus)Y.setStatus("Running..."),setTimeout(function(){setTimeout(function(){Y.setStatus("")},1),Q()},1);else Q()}if(Y.preInit){if(typeof Y.preInit=="function")Y.preInit=[Y.preInit];while(Y.preInit.length>0)Y.preInit.pop()()}var shouldRunNow=!0;if(Y.noInitialRun)shouldRunNow=!1;run();let C=Y,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(J){let Q;if(!J)Q=0,J=null;else if(J.constructor===Language){Q=J[0];let $=C._ts_language_version(Q);if($<MIN_COMPATIBLE_VERSION||VERSION<$)throw Error(`Incompatible language version ${$}. Compatibility range ${MIN_COMPATIBLE_VERSION} through ${VERSION}.`)}else throw Error("Argument must be a Language");return this.language=J,C._ts_parser_set_language(this[0],Q),this}getLanguage(){return this.language}parse(J,Q,$){if(typeof J==="string")currentParseCallback=(U,q)=>J.slice(U);else if(typeof J==="function")currentParseCallback=J;else throw Error("Argument must be a string or a function");if(this.logCallback)currentLogCallback=this.logCallback,C._ts_parser_enable_logger_wasm(this[0],1);else currentLogCallback=null,C._ts_parser_enable_logger_wasm(this[0],0);let Z=0,X=0;if($?.includedRanges){Z=$.includedRanges.length,X=C._calloc(Z,SIZE_OF_RANGE);let U=X;for(let q=0;q<Z;q++)marshalRange(U,$.includedRanges[q]),U+=SIZE_OF_RANGE}let K=C._ts_parser_parse_wasm(this[0],this[1],Q?Q[0]:0,X,Z);if(!K)throw currentParseCallback=null,currentLogCallback=null,Error("Parsing failed");let G=new Tree(INTERNAL,K,this.language,currentParseCallback);return currentParseCallback=null,currentLogCallback=null,G}reset(){C._ts_parser_reset(this[0])}getIncludedRanges(){C._ts_parser_included_ranges_wasm(this[0]);let J=getValue(TRANSFER_BUFFER,"i32"),Q=getValue(TRANSFER_BUFFER+SIZE_OF_INT,"i32"),$=Array(J);if(J>0){let Z=Q;for(let X=0;X<J;X++)$[X]=unmarshalRange(Z),Z+=SIZE_OF_RANGE;C._free(Q)}return $}getTimeoutMicros(){return C._ts_parser_timeout_micros(this[0])}setTimeoutMicros(J){C._ts_parser_set_timeout_micros(this[0],J)}setLogger(J){if(!J)J=null;else if(typeof J!=="function")throw Error("Logger callback must be a function");return this.logCallback=J,this}getLogger(){return this.logCallback}}class Tree{constructor(J,Q,$,Z){assertInternal(J),this[0]=Q,this.language=$,this.textCallback=Z}copy(){let J=C._ts_tree_copy(this[0]);return new Tree(INTERNAL,J,this.language,this.textCallback)}delete(){C._ts_tree_delete(this[0]),this[0]=0}edit(J){marshalEdit(J),C._ts_tree_edit_wasm(this[0])}get rootNode(){return C._ts_tree_root_node_wasm(this[0]),unmarshalNode(this)}rootNodeWithOffset(J,Q){let $=TRANSFER_BUFFER+SIZE_OF_NODE;return setValue($,J,"i32"),marshalPoint($+SIZE_OF_INT,Q),C._ts_tree_root_node_with_offset_wasm(this[0]),unmarshalNode(this)}getLanguage(){return this.language}walk(){return this.rootNode.walk()}getChangedRanges(J){if(J.constructor!==Tree)throw TypeError("Argument must be a Tree");C._ts_tree_get_changed_ranges_wasm(this[0],J[0]);let Q=getValue(TRANSFER_BUFFER,"i32"),$=getValue(TRANSFER_BUFFER+SIZE_OF_INT,"i32"),Z=Array(Q);if(Q>0){let X=$;for(let K=0;K<Q;K++)Z[K]=unmarshalRange(X),X+=SIZE_OF_RANGE;C._free($)}return Z}getIncludedRanges(){C._ts_tree_included_ranges_wasm(this[0]);let J=getValue(TRANSFER_BUFFER,"i32"),Q=getValue(TRANSFER_BUFFER+SIZE_OF_INT,"i32"),$=Array(J);if(J>0){let Z=Q;for(let X=0;X<J;X++)$[X]=unmarshalRange(Z),Z+=SIZE_OF_RANGE;C._free(Q)}return $}}class Node{constructor(J,Q){assertInternal(J),this.tree=Q}get typeId(){return marshalNode(this),C._ts_node_symbol_wasm(this.tree[0])}get grammarId(){return marshalNode(this),C._ts_node_grammar_symbol_wasm(this.tree[0])}get type(){return this.tree.language.types[this.typeId]||"ERROR"}get grammarType(){return this.tree.language.types[this.grammarId]||"ERROR"}get endPosition(){return marshalNode(this),C._ts_node_end_point_wasm(this.tree[0]),unmarshalPoint(TRANSFER_BUFFER)}get endIndex(){return marshalNode(this),C._ts_node_end_index_wasm(this.tree[0])}get text(){return getText(this.tree,this.startIndex,this.endIndex)}get parseState(){return marshalNode(this),C._ts_node_parse_state_wasm(this.tree[0])}get nextParseState(){return marshalNode(this),C._ts_node_next_parse_state_wasm(this.tree[0])}get isNamed(){return marshalNode(this),C._ts_node_is_named_wasm(this.tree[0])===1}get hasError(){return marshalNode(this),C._ts_node_has_error_wasm(this.tree[0])===1}get hasChanges(){return marshalNode(this),C._ts_node_has_changes_wasm(this.tree[0])===1}get isError(){return marshalNode(this),C._ts_node_is_error_wasm(this.tree[0])===1}get isMissing(){return marshalNode(this),C._ts_node_is_missing_wasm(this.tree[0])===1}get isExtra(){return marshalNode(this),C._ts_node_is_extra_wasm(this.tree[0])===1}equals(J){return this.id===J.id}child(J){return marshalNode(this),C._ts_node_child_wasm(this.tree[0],J),unmarshalNode(this.tree)}namedChild(J){return marshalNode(this),C._ts_node_named_child_wasm(this.tree[0],J),unmarshalNode(this.tree)}childForFieldId(J){return marshalNode(this),C._ts_node_child_by_field_id_wasm(this.tree[0],J),unmarshalNode(this.tree)}childForFieldName(J){let Q=this.tree.language.fields.indexOf(J);if(Q!==-1)return this.childForFieldId(Q);return null}fieldNameForChild(J){marshalNode(this);let Q=C._ts_node_field_name_for_child_wasm(this.tree[0],J);if(!Q)return null;return AsciiToString(Q)}childrenForFieldName(J){let Q=this.tree.language.fields.indexOf(J);if(Q!==-1&&Q!==0)return this.childrenForFieldId(Q);return[]}childrenForFieldId(J){marshalNode(this),C._ts_node_children_by_field_id_wasm(this.tree[0],J);let Q=getValue(TRANSFER_BUFFER,"i32"),$=getValue(TRANSFER_BUFFER+SIZE_OF_INT,"i32"),Z=Array(Q);if(Q>0){let X=$;for(let K=0;K<Q;K++)Z[K]=unmarshalNode(this.tree,X),X+=SIZE_OF_NODE;C._free($)}return Z}firstChildForIndex(J){marshalNode(this);let Q=TRANSFER_BUFFER+SIZE_OF_NODE;return setValue(Q,J,"i32"),C._ts_node_first_child_for_byte_wasm(this.tree[0]),unmarshalNode(this.tree)}firstNamedChildForIndex(J){marshalNode(this);let Q=TRANSFER_BUFFER+SIZE_OF_NODE;return setValue(Q,J,"i32"),C._ts_node_first_named_child_for_byte_wasm(this.tree[0]),unmarshalNode(this.tree)}get childCount(){return marshalNode(this),C._ts_node_child_count_wasm(this.tree[0])}get namedChildCount(){return marshalNode(this),C._ts_node_named_child_count_wasm(this.tree[0])}get firstChild(){return this.child(0)}get firstNamedChild(){return this.namedChild(0)}get lastChild(){return this.child(this.childCount-1)}get lastNamedChild(){return this.namedChild(this.namedChildCount-1)}get children(){if(!this._children){marshalNode(this),C._ts_node_children_wasm(this.tree[0]);let J=getValue(TRANSFER_BUFFER,"i32"),Q=getValue(TRANSFER_BUFFER+SIZE_OF_INT,"i32");if(this._children=Array(J),J>0){let $=Q;for(let Z=0;Z<J;Z++)this._children[Z]=unmarshalNode(this.tree,$),$+=SIZE_OF_NODE;C._free(Q)}}return this._children}get namedChildren(){if(!this._namedChildren){marshalNode(this),C._ts_node_named_children_wasm(this.tree[0]);let J=getValue(TRANSFER_BUFFER,"i32"),Q=getValue(TRANSFER_BUFFER+SIZE_OF_INT,"i32");if(this._namedChildren=Array(J),J>0){let $=Q;for(let Z=0;Z<J;Z++)this._namedChildren[Z]=unmarshalNode(this.tree,$),$+=SIZE_OF_NODE;C._free(Q)}}return this._namedChildren}descendantsOfType(J,Q,$){if(!Array.isArray(J))J=[J];if(!Q)Q=ZERO_POINT;if(!$)$=ZERO_POINT;let Z=[],X=this.tree.language.types;for(let W=0,z=X.length;W<z;W++)if(J.includes(X[W]))Z.push(W);let K=C._malloc(SIZE_OF_INT*Z.length);for(let W=0,z=Z.length;W<z;W++)setValue(K+W*SIZE_OF_INT,Z[W],"i32");marshalNode(this),C._ts_node_descendants_of_type_wasm(this.tree[0],K,Z.length,Q.row,Q.column,$.row,$.column);let G=getValue(TRANSFER_BUFFER,"i32"),U=getValue(TRANSFER_BUFFER+SIZE_OF_INT,"i32"),q=Array(G);if(G>0){let W=U;for(let z=0;z<G;z++)q[z]=unmarshalNode(this.tree,W),W+=SIZE_OF_NODE}return C._free(U),C._free(K),q}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(J,Q=J){if(typeof J!=="number"||typeof Q!=="number")throw Error("Arguments must be numbers");marshalNode(this);let $=TRANSFER_BUFFER+SIZE_OF_NODE;return setValue($,J,"i32"),setValue($+SIZE_OF_INT,Q,"i32"),C._ts_node_descendant_for_index_wasm(this.tree[0]),unmarshalNode(this.tree)}namedDescendantForIndex(J,Q=J){if(typeof J!=="number"||typeof Q!=="number")throw Error("Arguments must be numbers");marshalNode(this);let $=TRANSFER_BUFFER+SIZE_OF_NODE;return setValue($,J,"i32"),setValue($+SIZE_OF_INT,Q,"i32"),C._ts_node_named_descendant_for_index_wasm(this.tree[0]),unmarshalNode(this.tree)}descendantForPosition(J,Q=J){if(!isPoint(J)||!isPoint(Q))throw Error("Arguments must be {row, column} objects");marshalNode(this);let $=TRANSFER_BUFFER+SIZE_OF_NODE;return marshalPoint($,J),marshalPoint($+SIZE_OF_POINT,Q),C._ts_node_descendant_for_position_wasm(this.tree[0]),unmarshalNode(this.tree)}namedDescendantForPosition(J,Q=J){if(!isPoint(J)||!isPoint(Q))throw Error("Arguments must be {row, column} objects");marshalNode(this);let $=TRANSFER_BUFFER+SIZE_OF_NODE;return marshalPoint($,J),marshalPoint($+SIZE_OF_POINT,Q),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 J=C._ts_node_to_string_wasm(this.tree[0]),Q=AsciiToString(J);return C._free(J),Q}}class TreeCursor{constructor(J,Q){assertInternal(J),this.tree=Q,unmarshalTreeCursor(this)}delete(){marshalTreeCursor(this),C._ts_tree_cursor_delete_wasm(this.tree[0]),this[0]=this[1]=this[2]=0}reset(J){marshalNode(J),marshalTreeCursor(this,TRANSFER_BUFFER+SIZE_OF_NODE),C._ts_tree_cursor_reset_wasm(this.tree[0]),unmarshalTreeCursor(this)}resetTo(J){marshalTreeCursor(this,TRANSFER_BUFFER),marshalTreeCursor(J,TRANSFER_BUFFER+SIZE_OF_CURSOR),C._ts_tree_cursor_reset_to_wasm(this.tree[0],J.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 J=C._ts_tree_cursor_start_index_wasm(this.tree[0]),Q=C._ts_tree_cursor_end_index_wasm(this.tree[0]);return getText(this.tree,J,Q)}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 J=C._ts_tree_cursor_goto_first_child_wasm(this.tree[0]);return unmarshalTreeCursor(this),J===1}gotoLastChild(){marshalTreeCursor(this);let J=C._ts_tree_cursor_goto_last_child_wasm(this.tree[0]);return unmarshalTreeCursor(this),J===1}gotoFirstChildForIndex(J){marshalTreeCursor(this),setValue(TRANSFER_BUFFER+SIZE_OF_CURSOR,J,"i32");let Q=C._ts_tree_cursor_goto_first_child_for_index_wasm(this.tree[0]);return unmarshalTreeCursor(this),Q===1}gotoFirstChildForPosition(J){marshalTreeCursor(this),marshalPoint(TRANSFER_BUFFER+SIZE_OF_CURSOR,J);let Q=C._ts_tree_cursor_goto_first_child_for_position_wasm(this.tree[0]);return unmarshalTreeCursor(this),Q===1}gotoNextSibling(){marshalTreeCursor(this);let J=C._ts_tree_cursor_goto_next_sibling_wasm(this.tree[0]);return unmarshalTreeCursor(this),J===1}gotoPreviousSibling(){marshalTreeCursor(this);let J=C._ts_tree_cursor_goto_previous_sibling_wasm(this.tree[0]);return unmarshalTreeCursor(this),J===1}gotoDescendant(J){marshalTreeCursor(this),C._ts_tree_cursor_goto_descendant_wasm(this.tree[0],J),unmarshalTreeCursor(this)}gotoParent(){marshalTreeCursor(this);let J=C._ts_tree_cursor_goto_parent_wasm(this.tree[0]);return unmarshalTreeCursor(this),J===1}}class Language{constructor(J,Q){assertInternal(J),this[0]=Q,this.types=Array(C._ts_language_symbol_count(this[0]));for(let $=0,Z=this.types.length;$<Z;$++)if(C._ts_language_symbol_type(this[0],$)<2)this.types[$]=UTF8ToString(C._ts_language_symbol_name(this[0],$));this.fields=Array(C._ts_language_field_count(this[0])+1);for(let $=0,Z=this.fields.length;$<Z;$++){let X=C._ts_language_field_name_for_id(this[0],$);if(X!==0)this.fields[$]=UTF8ToString(X);else this.fields[$]=null}}get version(){return C._ts_language_version(this[0])}get fieldCount(){return this.fields.length-1}get stateCount(){return C._ts_language_state_count(this[0])}fieldIdForName(J){let Q=this.fields.indexOf(J);if(Q!==-1)return Q;else return null}fieldNameForId(J){return this.fields[J]||null}idForNodeType(J,Q){let $=lengthBytesUTF8(J),Z=C._malloc($+1);stringToUTF8(J,Z,$+1);let X=C._ts_language_symbol_for_name(this[0],Z,$,Q);return C._free(Z),X||null}get nodeTypeCount(){return C._ts_language_symbol_count(this[0])}nodeTypeForId(J){let Q=C._ts_language_symbol_name(this[0],J);return Q?UTF8ToString(Q):null}nodeTypeIsNamed(J){return C._ts_language_type_is_named_wasm(this[0],J)?!0:!1}nodeTypeIsVisible(J){return C._ts_language_type_is_visible_wasm(this[0],J)?!0:!1}nextState(J,Q){return C._ts_language_next_state(this[0],J,Q)}lookaheadIterator(J){let Q=C._ts_lookahead_iterator_new(this[0],J);if(Q)return new LookaheadIterable(INTERNAL,Q,this);return null}query(J){let Q=lengthBytesUTF8(J),$=C._malloc(Q+1);stringToUTF8(J,$,Q+1);let Z=C._ts_query_new(this[0],$,Q,TRANSFER_BUFFER,TRANSFER_BUFFER+SIZE_OF_INT);if(!Z){let T=getValue(TRANSFER_BUFFER+SIZE_OF_INT,"i32"),F=getValue(TRANSFER_BUFFER,"i32"),O=UTF8ToString($,F).length,j=J.substr(O,100).split(`
2
+ `)[0],k=j.match(QUERY_WORD_REGEX)[0],E;switch(T){case 2:E=RangeError(`Bad node name '${k}'`);break;case 3:E=RangeError(`Bad field name '${k}'`);break;case 4:E=RangeError(`Bad capture name @${k}`);break;case 5:E=TypeError(`Bad pattern structure at offset ${O}: '${j}'...`),k="";break;default:E=SyntaxError(`Bad syntax at offset ${O}: '${j}'...`),k="";break}throw E.index=O,E.length=k.length,C._free($),E}let X=C._ts_query_string_count(Z),K=C._ts_query_capture_count(Z),G=C._ts_query_pattern_count(Z),U=Array(K),q=Array(X);for(let T=0;T<K;T++){let F=C._ts_query_capture_name_for_id(Z,T,TRANSFER_BUFFER),O=getValue(TRANSFER_BUFFER,"i32");U[T]=UTF8ToString(F,O)}for(let T=0;T<X;T++){let F=C._ts_query_string_value_for_id(Z,T,TRANSFER_BUFFER),O=getValue(TRANSFER_BUFFER,"i32");q[T]=UTF8ToString(F,O)}let W=Array(G),z=Array(G),V=Array(G),H=Array(G),A=Array(G);for(let T=0;T<G;T++){let F=C._ts_query_predicates_for_pattern(Z,T,TRANSFER_BUFFER),O=getValue(TRANSFER_BUFFER,"i32");H[T]=[],A[T]=[];let j=[],k=F;for(let E=0;E<O;E++){let w=getValue(k,"i32");k+=SIZE_OF_INT;let R=getValue(k,"i32");if(k+=SIZE_OF_INT,w===PREDICATE_STEP_TYPE_CAPTURE)j.push({type:"capture",name:U[R]});else if(w===PREDICATE_STEP_TYPE_STRING)j.push({type:"string",value:q[R]});else if(j.length>0){if(j[0].type!=="string")throw Error("Predicates must begin with a literal value");let v=j[0].value,L=!0,h=!0,f;switch(v){case"any-not-eq?":case"not-eq?":L=!1;case"any-eq?":case"eq?":if(j.length!==3)throw Error(`Wrong number of arguments to \`#${v}\` predicate. Expected 2, got ${j.length-1}`);if(j[1].type!=="capture")throw Error(`First argument of \`#${v}\` predicate must be a capture. Got "${j[1].value}"`);if(h=!v.startsWith("any-"),j[2].type==="capture"){let P=j[1].name,D=j[2].name;A[T].push((B)=>{let N=[],y=[];for(let b of B){if(b.name===P)N.push(b.node);if(b.name===D)y.push(b.node)}let p=(b,u,t)=>t?b.text===u.text:b.text!==u.text;return h?N.every((b)=>y.some((u)=>p(b,u,L))):N.some((b)=>y.some((u)=>p(b,u,L)))})}else{f=j[1].name;let P=j[2].value,D=(N)=>N.text===P,B=(N)=>N.text!==P;A[T].push((N)=>{let y=[];for(let b of N)if(b.name===f)y.push(b.node);let p=L?D:B;return h?y.every(p):y.some(p)})}break;case"any-not-match?":case"not-match?":L=!1;case"any-match?":case"match?":if(j.length!==3)throw Error(`Wrong number of arguments to \`#${v}\` predicate. Expected 2, got ${j.length-1}.`);if(j[1].type!=="capture")throw Error(`First argument of \`#${v}\` predicate must be a capture. Got "${j[1].value}".`);if(j[2].type!=="string")throw Error(`Second argument of \`#${v}\` predicate must be a string. Got @${j[2].value}.`);f=j[1].name;let M=new RegExp(j[2].value);h=!v.startsWith("any-"),A[T].push((P)=>{let D=[];for(let N of P)if(N.name===f)D.push(N.node.text);let B=(N,y)=>y?M.test(N):!M.test(N);if(D.length===0)return!L;return h?D.every((N)=>B(N,L)):D.some((N)=>B(N,L))});break;case"set!":if(j.length<2||j.length>3)throw Error(`Wrong number of arguments to \`#set!\` predicate. Expected 1 or 2. Got ${j.length-1}.`);if(j.some((P)=>P.type!=="string"))throw Error('Arguments to `#set!` predicate must be a strings.".');if(!W[T])W[T]={};W[T][j[1].value]=j[2]?j[2].value:null;break;case"is?":case"is-not?":if(j.length<2||j.length>3)throw Error(`Wrong number of arguments to \`#${v}\` predicate. Expected 1 or 2. Got ${j.length-1}.`);if(j.some((P)=>P.type!=="string"))throw Error(`Arguments to \`#${v}\` predicate must be a strings.".`);let m=v==="is?"?z:V;if(!m[T])m[T]={};m[T][j[1].value]=j[2]?j[2].value:null;break;case"not-any-of?":L=!1;case"any-of?":if(j.length<2)throw Error(`Wrong number of arguments to \`#${v}\` predicate. Expected at least 1. Got ${j.length-1}.`);if(j[1].type!=="capture")throw Error(`First argument of \`#${v}\` predicate must be a capture. Got "${j[1].value}".`);for(let P=2;P<j.length;P++)if(j[P].type!=="string")throw Error(`Arguments to \`#${v}\` predicate must be a strings.".`);f=j[1].name;let o=j.slice(2).map((P)=>P.value);A[T].push((P)=>{let D=[];for(let B of P)if(B.name===f)D.push(B.node.text);if(D.length===0)return!L;return D.every((B)=>o.includes(B))===L});break;default:H[T].push({operator:v,operands:j.slice(1)})}j.length=0}}Object.freeze(W[T]),Object.freeze(z[T]),Object.freeze(V[T])}return C._free($),new Query(INTERNAL,Z,U,A,H,Object.freeze(W),Object.freeze(z),Object.freeze(V))}static load(J){let Q;if(J instanceof Uint8Array)Q=Promise.resolve(J);else{let $=J;if(typeof process<"u"&&process.versions&&process.versions.node){let Z=pJ("fs");Q=Promise.resolve(Z.readFileSync($))}else Q=fetch($).then((Z)=>Z.arrayBuffer().then((X)=>{if(Z.ok)return new Uint8Array(X);else{let K=new TextDecoder("utf-8").decode(X);throw Error(`Language.load failed with status ${Z.status}.
3
3
 
4
4
  ${K}`)}}))}return Q.then(($)=>loadWebAssemblyModule($,{loadAsync:!0})).then(($)=>{let Z=Object.keys($),X=Z.find((G)=>LANGUAGE_FUNCTION_REGEX.test(G)&&!G.includes("external_scanner_"));if(!X)console.log(`Couldn't find language function in WASM file. Symbols:
5
- ${JSON.stringify(Z,null,2)}`);let K=$[X]();return new Language(INTERNAL,K)})}}class LookaheadIterable{constructor(J,Q,$){assertInternal(J),this[0]=Q,this.language=$}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(J){return C._ts_lookahead_iterator_reset_state(this[0],J)}reset(J,Q){if(C._ts_lookahead_iterator_reset(this[0],J[0],Q))return this.language=J,!0;return!1}[Symbol.iterator](){let J=this;return{next(){if(C._ts_lookahead_iterator_next(J[0]))return{done:!1,value:J.currentType};return{done:!0,value:""}}}}}class Query{constructor(J,Q,$,Z,X,K,G,z){assertInternal(J),this[0]=Q,this.captureNames=$,this.textPredicates=Z,this.predicates=X,this.setProperties=K,this.assertedProperties=G,this.refutedProperties=z,this.exceededMatchLimit=!1}delete(){C._ts_query_delete(this[0]),this[0]=0}matches(J,{startPosition:Q=ZERO_POINT,endPosition:$=ZERO_POINT,startIndex:Z=0,endIndex:X=0,matchLimit:K=4294967295,maxStartDepth:G=4294967295,timeoutMicros:z=0}={}){if(typeof K!=="number")throw Error("Arguments must be numbers");marshalNode(J),C._ts_query_matches_wasm(this[0],J.tree[0],Q.row,Q.column,$.row,$.column,Z,X,K,G,z);let V=getValue(TRANSFER_BUFFER,"i32"),H=getValue(TRANSFER_BUFFER+SIZE_OF_INT,"i32"),U=getValue(TRANSFER_BUFFER+2*SIZE_OF_INT,"i32"),q=Array(V);this.exceededMatchLimit=Boolean(U);let W=0,F=H;for(let T=0;T<V;T++){let A=getValue(F,"i32");F+=SIZE_OF_INT;let O=getValue(F,"i32");F+=SIZE_OF_INT;let j=Array(O);if(F=unmarshalCaptures(this,J.tree,F,j),this.textPredicates[A].every((D)=>D(j))){q[W]={pattern:A,captures:j};let D=this.setProperties[A];if(D)q[W].setProperties=D;let E=this.assertedProperties[A];if(E)q[W].assertedProperties=E;let w=this.refutedProperties[A];if(w)q[W].refutedProperties=w;W++}}return q.length=W,C._free(H),q}captures(J,{startPosition:Q=ZERO_POINT,endPosition:$=ZERO_POINT,startIndex:Z=0,endIndex:X=0,matchLimit:K=4294967295,maxStartDepth:G=4294967295,timeoutMicros:z=0}={}){if(typeof K!=="number")throw Error("Arguments must be numbers");marshalNode(J),C._ts_query_captures_wasm(this[0],J.tree[0],Q.row,Q.column,$.row,$.column,Z,X,K,G,z);let V=getValue(TRANSFER_BUFFER,"i32"),H=getValue(TRANSFER_BUFFER+SIZE_OF_INT,"i32"),U=getValue(TRANSFER_BUFFER+2*SIZE_OF_INT,"i32"),q=[];this.exceededMatchLimit=Boolean(U);let W=[],F=H;for(let T=0;T<V;T++){let A=getValue(F,"i32");F+=SIZE_OF_INT;let O=getValue(F,"i32");F+=SIZE_OF_INT;let j=getValue(F,"i32");if(F+=SIZE_OF_INT,W.length=O,F=unmarshalCaptures(this,J.tree,F,W),this.textPredicates[A].every((D)=>D(W))){let D=W[j],E=this.setProperties[A];if(E)D.setProperties=E;let w=this.assertedProperties[A];if(w)D.assertedProperties=w;let R=this.refutedProperties[A];if(R)D.refutedProperties=R;q.push(D)}}return C._free(H),q}predicatesForPattern(J){return this.predicates[J]}disableCapture(J){let Q=lengthBytesUTF8(J),$=C._malloc(Q+1);stringToUTF8(J,$,Q+1),C._ts_query_disable_capture(this[0],$,Q),C._free($)}didExceedMatchLimit(){return this.exceededMatchLimit}}function getText(J,Q,$){let Z=$-Q,X=J.textCallback(Q,null,$);Q+=X.length;while(Q<$){let K=J.textCallback(Q,null,$);if(K&&K.length>0)Q+=K.length,X+=K;else break}if(Q>$)X=X.slice(0,Z);return X}function unmarshalCaptures(J,Q,$,Z){for(let X=0,K=Z.length;X<K;X++){let G=getValue($,"i32");$+=SIZE_OF_INT;let z=unmarshalNode(Q,$);$+=SIZE_OF_NODE,Z[X]={name:J.captureNames[G],node:z}}return $}function assertInternal(J){if(J!==INTERNAL)throw Error("Illegal constructor")}function isPoint(J){return J&&typeof J.row==="number"&&typeof J.column==="number"}function marshalNode(J){let Q=TRANSFER_BUFFER;setValue(Q,J.id,"i32"),Q+=SIZE_OF_INT,setValue(Q,J.startIndex,"i32"),Q+=SIZE_OF_INT,setValue(Q,J.startPosition.row,"i32"),Q+=SIZE_OF_INT,setValue(Q,J.startPosition.column,"i32"),Q+=SIZE_OF_INT,setValue(Q,J[0],"i32")}function unmarshalNode(J,Q=TRANSFER_BUFFER){let $=getValue(Q,"i32");if(Q+=SIZE_OF_INT,$===0)return null;let Z=getValue(Q,"i32");Q+=SIZE_OF_INT;let X=getValue(Q,"i32");Q+=SIZE_OF_INT;let K=getValue(Q,"i32");Q+=SIZE_OF_INT;let G=getValue(Q,"i32"),z=new Node(INTERNAL,J);return z.id=$,z.startIndex=Z,z.startPosition={row:X,column:K},z[0]=G,z}function marshalTreeCursor(J,Q=TRANSFER_BUFFER){setValue(Q+0*SIZE_OF_INT,J[0],"i32"),setValue(Q+1*SIZE_OF_INT,J[1],"i32"),setValue(Q+2*SIZE_OF_INT,J[2],"i32"),setValue(Q+3*SIZE_OF_INT,J[3],"i32")}function unmarshalTreeCursor(J){J[0]=getValue(TRANSFER_BUFFER+0*SIZE_OF_INT,"i32"),J[1]=getValue(TRANSFER_BUFFER+1*SIZE_OF_INT,"i32"),J[2]=getValue(TRANSFER_BUFFER+2*SIZE_OF_INT,"i32"),J[3]=getValue(TRANSFER_BUFFER+3*SIZE_OF_INT,"i32")}function marshalPoint(J,Q){setValue(J,Q.row,"i32"),setValue(J+SIZE_OF_INT,Q.column,"i32")}function unmarshalPoint(J){return{row:getValue(J,"i32")>>>0,column:getValue(J+SIZE_OF_INT,"i32")>>>0}}function marshalRange(J,Q){marshalPoint(J,Q.startPosition),J+=SIZE_OF_POINT,marshalPoint(J,Q.endPosition),J+=SIZE_OF_POINT,setValue(J,Q.startIndex,"i32"),J+=SIZE_OF_INT,setValue(J,Q.endIndex,"i32"),J+=SIZE_OF_INT}function unmarshalRange(J){let Q={};return Q.startPosition=unmarshalPoint(J),J+=SIZE_OF_POINT,Q.endPosition=unmarshalPoint(J),J+=SIZE_OF_POINT,Q.startIndex=getValue(J,"i32")>>>0,J+=SIZE_OF_INT,Q.endIndex=getValue(J,"i32")>>>0,Q}function marshalEdit(J){let Q=TRANSFER_BUFFER;marshalPoint(Q,J.startPosition),Q+=SIZE_OF_POINT,marshalPoint(Q,J.oldEndPosition),Q+=SIZE_OF_POINT,marshalPoint(Q,J.newEndPosition),Q+=SIZE_OF_POINT,setValue(Q,J.startIndex,"i32"),Q+=SIZE_OF_INT,setValue(Q,J.oldEndIndex,"i32"),Q+=SIZE_OF_INT,setValue(Q,J.newEndIndex,"i32"),Q+=SIZE_OF_INT}for(let J of Object.getOwnPropertyNames(ParserImpl.prototype))Object.defineProperty(Parser.prototype,J,{value:ParserImpl.prototype[J],enumerable:!1,writable:!1});Parser.Language=Language,Y.onRuntimeInitialized=()=>{ParserImpl.init(),resolveInitPromise()}})}}return Parser}();if(typeof LJ==="object")AJ.exports=C0});import{realpath as U$}from"node:fs/promises";import{delimiter as Y8}from"node:path";import{open as C$}from"node:fs/promises";var HJ=Buffer.from(`
6
- `),pJ=Buffer.from(`\r
7
- `),cJ=Buffer.from("\r"),wJ=Buffer.alloc(0);async function*BJ(J,Q){let $=Q?.detectBinary??!1,Z=[],X=0,K=0,G=!1;function z(V){if(V&&V.length>0)Z.push(V),X+=V.length;if(X===0)return wJ;let H=Z.length===1?Z[0]:Buffer.concat(Z,X);return Z=[],X=0,H}for await(let V of J){if(V.length===0)continue;let H=0;if(G){G=!1;let U=V[0]===10?pJ:cJ;if(U===pJ)H=1;yield{lineBytes:z(),eolBytes:U,lineNumber:++K}}for(let U=H;U<V.length;U++){let q=V[U];if($&&q===0)throw Error("File appears to be binary (contains null bytes)");if(q!==13&&q!==10)continue;let W=V.subarray(H,U),F;if(q===13)if(U+1<V.length)if(V[U+1]===10)F=pJ,U++;else F=cJ;else{Z.push(Buffer.from(W)),X+=W.length,G=!0,H=U+1;continue}else F=HJ;yield{lineBytes:z(W),eolBytes:F,lineNumber:++K},H=U+1}if(H<V.length){let U=Buffer.from(V.subarray(H,V.length));Z.push(U),X+=U.length}}if(G||X>0)yield{lineBytes:z(),eolBytes:G?cJ:wJ,lineNumber:++K}}var qQ=65536;async function*VJ(J,Q){async function*$(){let Z=await C$(J,"r"),X=Buffer.allocUnsafe(qQ);try{let K;do{if({bytesRead:K}=await Z.read(X,0,qQ),K===0)break;yield Buffer.from(X.subarray(0,K))}while(K>0)}finally{await Z.close()}}yield*BJ($(),Q)}import{open as w$}from"node:fs/promises";var B$=Buffer.from([239,187,191]),N$=Buffer.from([255,254]),S$=Buffer.from([254,255]);function uJ(J){if(J.length>=3&&J[0]===239&&J[1]===187&&J[2]===191)return{encoding:"utf-8",bomLength:3,hasBOM:!0};if(J.length>=2&&J[0]===255&&J[1]===254)return{encoding:"utf-16le",bomLength:2,hasBOM:!0};if(J.length>=2&&J[0]===254&&J[1]===255)return{encoding:"utf-16be",bomLength:2,hasBOM:!0};return{encoding:"utf-8",bomLength:0,hasBOM:!1}}var NJ=65536;async function qJ(J,Q){let $=await w$(J,"r"),Z=Buffer.allocUnsafe(NJ),{bytesRead:X}=await $.read(Z,0,NJ);if(X===0){await $.close();async function*V(){}return{lines:V(),bomInfo:{encoding:"utf-8",bomLength:0,hasBOM:!1}}}let K=Buffer.from(Z.subarray(0,X)),G=uJ(K);if(G.encoding==="utf-16le"||G.encoding==="utf-16be"){let V={...Q,detectBinary:!1};async function*H(){let U=new TextDecoder(G.encoding),q=K.subarray(G.bomLength);if(q.length>0){let W=U.decode(q,{stream:!0});if(W.length>0)yield Buffer.from(W,"utf-8")}try{let W;do{if({bytesRead:W}=await $.read(Z,0,NJ),W===0)break;let T=Buffer.from(Z.subarray(0,W)),A=U.decode(T,{stream:!0});if(A.length>0)yield Buffer.from(A,"utf-8")}while(W>0);let F=U.decode(new Uint8Array(0),{stream:!1});if(F.length>0)yield Buffer.from(F,"utf-8")}finally{await $.close()}}return{lines:BJ(H(),V),bomInfo:G}}async function*z(){let V=G.hasBOM?K.subarray(G.bomLength):K;if(V.length>0)yield V;try{let H;do{if({bytesRead:H}=await $.read(Z,0,NJ),H===0)break;yield Buffer.from(Z.subarray(0,H))}while(H>0)}finally{await $.close()}}return{lines:BJ(z(),Q),bomInfo:G}}function UQ(J){if(!J.hasBOM)return Buffer.alloc(0);switch(J.encoding){case"utf-8":return B$;case"utf-16le":return N$;case"utf-16be":return S$}}function dJ(J,Q){if(Q==="utf-8")return Buffer.from(J,"utf-8");if(Q==="utf-16le")return Buffer.from(J,"utf16le");let $=Buffer.from(J,"utf16le");for(let Z=0;Z<$.length-1;Z+=2){let X=$[Z];$[Z]=$[Z+1],$[Z+1]=X}return $}function zQ(J,Q){if(Q==="utf-8")return J;return dJ(J.toString("utf-8"),Q)}var e=2166136261;var HQ="0-0:00000000";function SJ(J){let Q=2166136261;for(let $=0;$<J.length;$++){let Z=J.charCodeAt($);if(Z>=55296&&Z<=56319)if($+1<J.length){let X=J.charCodeAt($+1);if(X>=56320&&X<=57343)Z=(Z-55296<<10)+(X-56320)+65536,$++;else Z=65533}else Z=65533;else if(Z>=56320&&Z<=57343)Z=65533;if(Z<128)Q=Math.imul(Q^Z,16777619)>>>0;else if(Z<2048)Q=Math.imul(Q^(192|Z>>6),16777619)>>>0,Q=Math.imul(Q^(128|Z&63),16777619)>>>0;else if(Z<65536)Q=Math.imul(Q^(224|Z>>12),16777619)>>>0,Q=Math.imul(Q^(128|Z>>6&63),16777619)>>>0,Q=Math.imul(Q^(128|Z&63),16777619)>>>0;else Q=Math.imul(Q^(240|Z>>18),16777619)>>>0,Q=Math.imul(Q^(128|Z>>12&63),16777619)>>>0,Q=Math.imul(Q^(128|Z>>6&63),16777619)>>>0,Q=Math.imul(Q^(128|Z&63),16777619)>>>0}return Q>>>0}function s(J,Q,$){let Z=2166136261;for(let X=Q;X<$;X++)Z=Math.imul(Z^J[X],16777619)>>>0;return Z}function $J(J,Q){return J=Math.imul(J^Q&255,16777619)>>>0,J=Math.imul(J^Q>>>8&255,16777619)>>>0,J=Math.imul(J^Q>>>16&255,16777619)>>>0,J=Math.imul(J^Q>>>24&255,16777619)>>>0,J}function jQ(J,Q,$,Z,X){let K=$.toString(16).padStart(8,"0");if(Z&&X)return`${Z}.${J}-${X}.${Q}:${K}`;return`${J}-${Q}:${K}`}var WQ="abcdefghijklmnopqrstuvwxyz",R$=(()=>{let J=Array(676);for(let Q=0;Q<26;Q++)for(let $=0;$<26;$++)J[Q*26+$]=WQ[Q]+WQ[$];return J})();function XJ(J){let Q=(J>>>16^J&65535)>>>0;return R$[Q%26*26+(Q>>>8>>>0)%26]}var TQ=/^\d+$/,FQ="??";function lJ(J){let Q=J.indexOf(".");if(Q===-1){if(!TQ.test(J))throw Error(`Invalid hash.line reference "${J}" — expected format "hash.line" (e.g. "ab.12"). `+"Copy the 2-letter prefix and line number from trueline_read/trueline_search output.");let K=Number(J);if(K!==0)return{line:K,hash:"??"};return{line:0,hash:""}}let $=J.slice(0,Q),Z=J.slice(Q+1);if(!TQ.test(Z))throw Error(`Invalid line number in "${J}" — must be a non-negative integer`);let X=Number(Z);if(X===0)throw Error(`Invalid hash.line reference "${J}" — line 0 must use bare "0" with no hash`);if(!/^[a-z]{2}$/.test($)){if($.length>0)return{line:X,hash:"??"};throw Error(`Invalid hash.line reference "${J}" — expected format "hash.line" (e.g. "ab.${X}"). Copy the 2-letter prefix and line number from trueline_read/trueline_search output.`)}return{line:X,hash:$}}function AQ(J){let Q=!1,$=J;if($.startsWith("+"))Q=!0,$=$.slice(1);let Z=$.indexOf("-");if(Q&&Z!==-1)throw Error(`Invalid range "${J}" — insert-after (+) cannot be used with a multi-line range`);if(Z===-1){let G=lJ($);return{start:G,end:{...G},insertAfter:Q}}let X=lJ($.slice(0,Z)),K=lJ($.slice(Z+1));if(X.line>K.line)throw Error(`Invalid range "${J}" — start line ${X.line} must be ≤ end line ${K.line}`);return{start:X,end:K,insertAfter:Q}}function OQ(J){if(!J||J.length===0)return[{start:1,end:1/0}];let Q=J.map(($)=>{let Z=$.indexOf("-"),X,K;if(Z===-1)X=Number($),K=X;else if(Z===0)X=1,K=Number($.slice(1));else if(Z===$.length-1)X=Number($.slice(0,-1)),K=1/0;else X=Number($.slice(0,Z)),K=Number($.slice(Z+1));if(!Number.isInteger(X)||X<1)throw Error(`Invalid range "${$}": start must be a positive integer`);if(K!==1/0&&(!Number.isInteger(K)||K<1))throw Error(`Invalid range "${$}": end must be a positive integer`);if(X>K)throw Error(`Invalid range "${$}": start ${X} must be <= end ${K}`);return{start:X,end:K}});Q.sort(($,Z)=>$.start-Z.start);for(let $=1;$<Q.length;$++){let Z=Q[$-1],X=Q[$];if(Z.end===1/0||X.start<=Z.end+1)Z.end=Math.max(Z.end,X.end),Q.splice($,1),$--}return Q}var JJ=new Map,P$=1;function v$(){if(JJ.size<=500)return;let J=JJ.size-500,Q=0;for(let $ of JJ.keys()){if(Q>=J)break;JJ.delete($),Q++}}function YJ(J,Q,$,Z){let X=`R${P$++}`;return JJ.set(X,{filePath:J,startLine:Q,endLine:$,hash:Z}),v$(),X}function RJ(J){let Q=JJ.get(J);if(!Q)throw Error(`Unknown ref "${J}" — this ref was never issued or has expired. `+"Use a ref from a recent trueline_read or trueline_search output.");return JJ.delete(J),JJ.set(J,Q),Q}function DQ(J){return JJ.has(J)}function kQ(J){return{startLine:J.startLine,endLine:J.endLine,hash:J.hash}}function _Q(J,Q){let $=[...Q].sort((Z,X)=>Z.startLine-X.startLine);for(let[Z,X]of JJ){if(X.filePath!==J)continue;let K=!1,G=0;for(let z of $)if(z.insertAfter){let V=z.startLine;if(X.startLine<=V&&X.endLine>V){K=!0;break}if(X.startLine>V)G+=z.newLineCount}else{let{startLine:V,endLine:H}=z,U=H-V+1,q=z.newLineCount-U;if(X.startLine<=H&&X.endLine>=V){K=!0;break}if(X.startLine>H)G+=q}if(K)JJ.delete(Z);else if(G!==0)X.startLine+=G,X.endLine+=G}}function EQ(J,Q){let $=[];for(let[Z,X]of JJ)if(X.filePath===J&&Z!==Q)$.push(Z);return $}import{realpath as iJ,stat as b$}from"node:fs/promises";import{statSync as SQ}from"node:fs";import{resolve as y$,sep as RQ}from"node:path";import{readFile as I$,stat as L$}from"node:fs/promises";import{homedir as M$}from"node:os";import{resolve as oJ}from"node:path";var nJ=new Map,CQ=new Map;function x$(J){let Q=J.match(/^(\w+)\((.+)\)$/);return Q?{tool:Q[1],glob:Q[2]}:null}function wQ(J,Q=!1){let $=`${J}:${Q}`,Z=CQ.get($);if(Z)return Z;J=J.replace(/(\*\*\/)+/g,"**/");let X=J.replace(/\*\*\/|\*\*|\*|\?|[^*?]+/g,(G,z)=>{let V=z===0||J[z-1]==="/";switch(G){case"**/":return V?"(.*/)?":"[^/]*/";case"**":return V?".*":"[^/]*";case"*":return"[^/]*";case"?":return"[^/]";default:return G.replace(/[.+^${}()|[\]\\/-]/g,"\\$&")}}),K=new RegExp(`^${X}$`,Q?"i":"");return CQ.set($,K),K}async function BQ(J,Q,$){let Z=async(G)=>{let z=`${G}:${J}`,V;try{V=(await L$(G)).mtimeMs}catch{return null}let H=nJ.get(z);if(H&&H.mtime===V)return H.globs;let U;try{U=JSON.parse(await I$(G,"utf-8"))}catch{return nJ.set(z,{mtime:V,globs:null}),null}let q=typeof U==="object"&&U!==null?U:void 0,F=(typeof q?.permissions==="object"&&q.permissions!==null?q.permissions:void 0)?.deny,T=[];if(Array.isArray(F))for(let A of F){if(typeof A!=="string")continue;let O=x$(A);if(O?.tool===J)T.push(O.glob)}return nJ.set(z,{mtime:V,globs:T}),T},X=[];if(Q)X.push(oJ(Q,".claude","settings.local.json")),X.push(oJ(Q,".claude","settings.json"));return X.push($??oJ(M$(),".claude","settings.json")),(await Promise.all(X.map(Z))).filter((G)=>G!==null)}function NQ(J,Q,$=process.platform==="win32"){let Z=J.replace(/\\/g,"/"),X=Z.split("/").pop()??Z,K=(z)=>{let V=wQ(z,$);if(V.test(Z))return!0;if(!z.includes("/"))return V.test(X);if(!z.startsWith("/")&&!z.startsWith("*"))return wQ(`**/${z}`,$).test(Z);return!1},G=Q.flat().find(K);return G?{denied:!0,matchedPattern:G}:{denied:!1}}function g(J){return{content:[{type:"text",text:J}]}}function v(J){return{content:[{type:"text",text:J}],isError:!0}}import{glob as PQ}from"node:fs/promises";import{execFile as f$}from"node:child_process";import{matchesGlob as m$}from"node:path";async function a(J,Q,$,Z=[]){if(J==="*")return{ok:!1,error:v('Wildcard "*" is only supported by trueline_changes. Pass an explicit file path.')};let X=J.startsWith("/")?J:y$($??process.cwd(),J),K;try{K=await iJ(X)}catch{return{ok:!1,error:v(`Error reading file: "${J}" not found`)}}let G=await b$(K);if(!G.isFile())return{ok:!1,error:v(`"${J}" is not a regular file`)};let z;try{z=await iJ($?$:process.cwd())}catch{return{ok:!1,error:v("Project directory not found or inaccessible")}}let V=await Promise.all(Z.map(async(A)=>{try{return await iJ(A)}catch{return A}})),H=[z,...V];if(!(process.platform==="win32"?H.some((A)=>{let O=K.toLowerCase(),j=A.toLowerCase();return O===j||O.startsWith(j+RQ)}):H.some((A)=>K===A||K.startsWith(A+RQ))))return{ok:!1,error:v(`Access denied: "${J}" is outside the project directory`)};let q=await BQ(Q,$),{denied:W,matchedPattern:F}=NQ(K,q);if(W)return{ok:!1,error:v(`Access denied: "${J}" matched deny pattern "${F}"`)};let T=10485760;if(G.size>T)return{ok:!1,error:v(`"${J}" exceeds the 10 MB size limit (${(G.size/1024/1024).toFixed(1)} MB)`)};return{ok:!0,resolvedPath:K,size:G.size,mtimeMs:G.mtimeMs}}function UJ(J){return J instanceof Error&&J.message.includes("binary")}function PJ(J){return v(`"${J}" appears to be a binary file`)}function g$(J,Q){if(process.platform!=="win32")return!1;try{let $=SQ(J),Z=SQ(Q);return $.dev===Z.dev&&$.ino===Z.ino&&$.ino!==0}catch{return!1}}function vQ(J,Q){let $=[],Z=new Map,X=[];for(let V of J){let H;try{H=RJ(V.ref)}catch(W){return{ok:!1,error:v(W.message)}}let U=kQ(H);if(Z.set(V.ref,U),Q&&H.filePath!==Q&&!g$(H.filePath,Q))return{ok:!1,error:v(`Ref ${V.ref} was issued for a different file (${H.filePath}), not the file being edited (${Q}). Use a ref from trueline_read or trueline_search on the target file.`)};let q;try{q=AQ(V.range)}catch(W){let F=W instanceof Error?W.message:String(W),T=` Your ref ${V.ref} covers lines ${U.startLine}–${U.endLine}.`;return{ok:!1,error:v(F+T)}}if(V.action==="insert_after"){if(q.start.line!==q.end.line)return{ok:!1,error:v('action "insert_after" requires a single-line range, not a multi-line range')};q.insertAfter=!0}else if(V.action==="replace")q.insertAfter=!1;if(q.start.line===0&&!q.insertAfter)return{ok:!1,error:v('range starting at line 0 requires insert-after (use action: "insert_after" or +0 prefix)')};if(q.insertAfter&&V.content==="")return{ok:!1,error:v("insert_after with empty content would insert zero lines (no-op). To insert a blank line, use content: ' ' or include the actual content to insert.")};if(q.start.line>0){if(U.startLine>q.start.line||U.endLine<q.end.line)return{ok:!1,error:v(`Ref ${V.ref} covers lines ${U.startLine}-${U.endLine}, which does not cover edit range ${q.start.line}-${q.end.line}. Re-read with trueline_read to get a ref covering the target lines.`)}}if(V.content!==""){let W=/^[a-z]{2}\.\d+$/,T=V.content.split(`
8
- `).filter((A)=>W.test(A.trim()));if(T.length>0)X.push(`WARNING: content contains what looks like hash.line identifiers from trueline_read output: ${T.map((A)=>`"${A.trim()}"`).join(", ")}. These are addressing tags, not file content. If this was unintentional, undo the edit and retry with only the actual text.`)}$.push({startLine:q.start.line,endLine:q.end.line,content:V.content===""?[]:V.content.split(`
9
- `),insertAfter:q.insertAfter,startHash:q.start.hash,endHash:q.end.hash})}let K=[...Z.values()];K.sort((V,H)=>V.startLine-H.startLine);let G=$.filter((V)=>!V.insertAfter);G.sort((V,H)=>V.startLine-H.startLine);for(let V=1;V<G.length;V++)if(G[V].startLine<=G[V-1].endLine)return{ok:!1,error:v(`Overlapping ranges: line ${G[V].startLine} targeted by multiple edits`)};let z=$.filter((V)=>V.insertAfter);for(let V of z)for(let H of G)if(V.startLine>=H.startLine&&V.startLine<H.endLine)return{ok:!1,error:v(`Insert-after at line ${V.startLine} conflicts with replace range ${H.startLine}–${H.endLine}. Insert after the last line of the replace instead.`)};return{ok:!0,ops:$,checksumRefs:K,warnings:X}}var h$={"utf-8":"utf-8",utf8:"utf-8",ascii:"ascii",latin1:"latin1"};function vJ(J){if(J===void 0)return"utf-8";let Q=h$[J.toLowerCase()];if(Q===void 0)throw Error(`Unsupported encoding "${J}". Supported: utf-8, ascii, latin1`);return Q}var p$=/[*?{[]/,c$=/\*\*/,u$=new Set(["node_modules",".git","dist","build",".next","__pycache__",".venv","vendor","target"]);async function DJ(J,Q){let $=Q??process.cwd(),Z=[],X=new Set;function K(G){let z=G.replaceAll("\\","/");if(!X.has(z))X.add(z),Z.push(z)}for(let G of J){if(!p$.test(G)){K(G);continue}if(c$.test(G)){let z=await d$($);if(z){for(let V of z)if(m$(V,G))K(V)}else for await(let V of PQ(G,{cwd:$,exclude:(H)=>u$.has(H)}))K(V)}else for await(let z of PQ(G,{cwd:$}))K(z)}return Z.sort(),Z}var rJ=new Map;async function d$(J){let Q=rJ.get(J);if(Q!==void 0)return Q;try{let $=await new Promise((Z,X)=>{f$("git",["ls-files","--cached","--others","--exclude-standard","-z"],{cwd:J,maxBuffer:10485760},(K,G)=>{if(K)return X(K);Z(G.split("\x00").filter(Boolean))})});return rJ.set(J,$),$}catch{return rJ.set(J,null),null}}var l$=500,jJ=new Map;function o$(J){return J.map((Q)=>`${Q.start}-${Q.end}`).join(",")}function n$(J){let Q=J.map(($)=>({start:$.start>1&&$.end!==1/0?$.start-1:$.start,end:$.end!==1/0?$.end+1:$.end}));for(let $=1;$<Q.length;$++){let Z=Q[$-1],X=Q[$];if(Z.end===1/0||X.start<=Z.end+1)Z.end=Math.max(Z.end,X.end),Q.splice($,1),$--}return Q}function i$(J){let Q=[`unchanged ${J.refs.map(($)=>`ref:${$}`).join(" ")}`];if(J.encodingLine)Q.push(J.encodingLine);return Q.join(`
10
- `)}function IQ(){if(jJ.size<l$)return;let J=jJ.keys().next().value;if(J!==void 0)jJ.delete(J)}async function LQ(J){let{file_path:Q,projectDir:$,allowedDirs:Z}=J,X=await a(Q,"Read",$,Z);if(!X.ok)return X.error;let K;try{K=vJ(J.encoding)}catch(k){return v(k.message)}let{resolvedPath:G,mtimeMs:z}=X,V;try{V=OQ(J.ranges)}catch(k){return v(k.message)}let H=V;V=n$(V);let U=o$(H),q=jJ.get(G);if(q&&q.mtimeMs===z&&q.rangesKey===U&&q.refs.every(DQ))return g(i$(q));let W=2000,F=20971520,T=[],A=0,O=0,j=V[0],D=e,E=0,w=0,R=0,I=0,L=!1,h=[],f=await qJ(G,{detectBinary:!0}),{bomInfo:M}=f;try{for await(let{lineBytes:k,lineNumber:B}of f.lines){if(R=B,O>=V.length)break;if(j=V[O],B<j.start)continue;if(B>j.end){let u=D.toString(16).padStart(8,"0"),t=YJ(G,E,w,u);h.push(t);let hJ=`
5
+ ${JSON.stringify(Z,null,2)}`);let K=$[X]();return new Language(INTERNAL,K)})}}class LookaheadIterable{constructor(J,Q,$){assertInternal(J),this[0]=Q,this.language=$}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(J){return C._ts_lookahead_iterator_reset_state(this[0],J)}reset(J,Q){if(C._ts_lookahead_iterator_reset(this[0],J[0],Q))return this.language=J,!0;return!1}[Symbol.iterator](){let J=this;return{next(){if(C._ts_lookahead_iterator_next(J[0]))return{done:!1,value:J.currentType};return{done:!0,value:""}}}}}class Query{constructor(J,Q,$,Z,X,K,G,U){assertInternal(J),this[0]=Q,this.captureNames=$,this.textPredicates=Z,this.predicates=X,this.setProperties=K,this.assertedProperties=G,this.refutedProperties=U,this.exceededMatchLimit=!1}delete(){C._ts_query_delete(this[0]),this[0]=0}matches(J,{startPosition:Q=ZERO_POINT,endPosition:$=ZERO_POINT,startIndex:Z=0,endIndex:X=0,matchLimit:K=4294967295,maxStartDepth:G=4294967295,timeoutMicros:U=0}={}){if(typeof K!=="number")throw Error("Arguments must be numbers");marshalNode(J),C._ts_query_matches_wasm(this[0],J.tree[0],Q.row,Q.column,$.row,$.column,Z,X,K,G,U);let q=getValue(TRANSFER_BUFFER,"i32"),W=getValue(TRANSFER_BUFFER+SIZE_OF_INT,"i32"),z=getValue(TRANSFER_BUFFER+2*SIZE_OF_INT,"i32"),V=Array(q);this.exceededMatchLimit=Boolean(z);let H=0,A=W;for(let T=0;T<q;T++){let F=getValue(A,"i32");A+=SIZE_OF_INT;let O=getValue(A,"i32");A+=SIZE_OF_INT;let j=Array(O);if(A=unmarshalCaptures(this,J.tree,A,j),this.textPredicates[F].every((k)=>k(j))){V[H]={pattern:F,captures:j};let k=this.setProperties[F];if(k)V[H].setProperties=k;let E=this.assertedProperties[F];if(E)V[H].assertedProperties=E;let w=this.refutedProperties[F];if(w)V[H].refutedProperties=w;H++}}return V.length=H,C._free(W),V}captures(J,{startPosition:Q=ZERO_POINT,endPosition:$=ZERO_POINT,startIndex:Z=0,endIndex:X=0,matchLimit:K=4294967295,maxStartDepth:G=4294967295,timeoutMicros:U=0}={}){if(typeof K!=="number")throw Error("Arguments must be numbers");marshalNode(J),C._ts_query_captures_wasm(this[0],J.tree[0],Q.row,Q.column,$.row,$.column,Z,X,K,G,U);let q=getValue(TRANSFER_BUFFER,"i32"),W=getValue(TRANSFER_BUFFER+SIZE_OF_INT,"i32"),z=getValue(TRANSFER_BUFFER+2*SIZE_OF_INT,"i32"),V=[];this.exceededMatchLimit=Boolean(z);let H=[],A=W;for(let T=0;T<q;T++){let F=getValue(A,"i32");A+=SIZE_OF_INT;let O=getValue(A,"i32");A+=SIZE_OF_INT;let j=getValue(A,"i32");if(A+=SIZE_OF_INT,H.length=O,A=unmarshalCaptures(this,J.tree,A,H),this.textPredicates[F].every((k)=>k(H))){let k=H[j],E=this.setProperties[F];if(E)k.setProperties=E;let w=this.assertedProperties[F];if(w)k.assertedProperties=w;let R=this.refutedProperties[F];if(R)k.refutedProperties=R;V.push(k)}}return C._free(W),V}predicatesForPattern(J){return this.predicates[J]}disableCapture(J){let Q=lengthBytesUTF8(J),$=C._malloc(Q+1);stringToUTF8(J,$,Q+1),C._ts_query_disable_capture(this[0],$,Q),C._free($)}didExceedMatchLimit(){return this.exceededMatchLimit}}function getText(J,Q,$){let Z=$-Q,X=J.textCallback(Q,null,$);Q+=X.length;while(Q<$){let K=J.textCallback(Q,null,$);if(K&&K.length>0)Q+=K.length,X+=K;else break}if(Q>$)X=X.slice(0,Z);return X}function unmarshalCaptures(J,Q,$,Z){for(let X=0,K=Z.length;X<K;X++){let G=getValue($,"i32");$+=SIZE_OF_INT;let U=unmarshalNode(Q,$);$+=SIZE_OF_NODE,Z[X]={name:J.captureNames[G],node:U}}return $}function assertInternal(J){if(J!==INTERNAL)throw Error("Illegal constructor")}function isPoint(J){return J&&typeof J.row==="number"&&typeof J.column==="number"}function marshalNode(J){let Q=TRANSFER_BUFFER;setValue(Q,J.id,"i32"),Q+=SIZE_OF_INT,setValue(Q,J.startIndex,"i32"),Q+=SIZE_OF_INT,setValue(Q,J.startPosition.row,"i32"),Q+=SIZE_OF_INT,setValue(Q,J.startPosition.column,"i32"),Q+=SIZE_OF_INT,setValue(Q,J[0],"i32")}function unmarshalNode(J,Q=TRANSFER_BUFFER){let $=getValue(Q,"i32");if(Q+=SIZE_OF_INT,$===0)return null;let Z=getValue(Q,"i32");Q+=SIZE_OF_INT;let X=getValue(Q,"i32");Q+=SIZE_OF_INT;let K=getValue(Q,"i32");Q+=SIZE_OF_INT;let G=getValue(Q,"i32"),U=new Node(INTERNAL,J);return U.id=$,U.startIndex=Z,U.startPosition={row:X,column:K},U[0]=G,U}function marshalTreeCursor(J,Q=TRANSFER_BUFFER){setValue(Q+0*SIZE_OF_INT,J[0],"i32"),setValue(Q+1*SIZE_OF_INT,J[1],"i32"),setValue(Q+2*SIZE_OF_INT,J[2],"i32"),setValue(Q+3*SIZE_OF_INT,J[3],"i32")}function unmarshalTreeCursor(J){J[0]=getValue(TRANSFER_BUFFER+0*SIZE_OF_INT,"i32"),J[1]=getValue(TRANSFER_BUFFER+1*SIZE_OF_INT,"i32"),J[2]=getValue(TRANSFER_BUFFER+2*SIZE_OF_INT,"i32"),J[3]=getValue(TRANSFER_BUFFER+3*SIZE_OF_INT,"i32")}function marshalPoint(J,Q){setValue(J,Q.row,"i32"),setValue(J+SIZE_OF_INT,Q.column,"i32")}function unmarshalPoint(J){return{row:getValue(J,"i32")>>>0,column:getValue(J+SIZE_OF_INT,"i32")>>>0}}function marshalRange(J,Q){marshalPoint(J,Q.startPosition),J+=SIZE_OF_POINT,marshalPoint(J,Q.endPosition),J+=SIZE_OF_POINT,setValue(J,Q.startIndex,"i32"),J+=SIZE_OF_INT,setValue(J,Q.endIndex,"i32"),J+=SIZE_OF_INT}function unmarshalRange(J){let Q={};return Q.startPosition=unmarshalPoint(J),J+=SIZE_OF_POINT,Q.endPosition=unmarshalPoint(J),J+=SIZE_OF_POINT,Q.startIndex=getValue(J,"i32")>>>0,J+=SIZE_OF_INT,Q.endIndex=getValue(J,"i32")>>>0,Q}function marshalEdit(J){let Q=TRANSFER_BUFFER;marshalPoint(Q,J.startPosition),Q+=SIZE_OF_POINT,marshalPoint(Q,J.oldEndPosition),Q+=SIZE_OF_POINT,marshalPoint(Q,J.newEndPosition),Q+=SIZE_OF_POINT,setValue(Q,J.startIndex,"i32"),Q+=SIZE_OF_INT,setValue(Q,J.oldEndIndex,"i32"),Q+=SIZE_OF_INT,setValue(Q,J.newEndIndex,"i32"),Q+=SIZE_OF_INT}for(let J of Object.getOwnPropertyNames(ParserImpl.prototype))Object.defineProperty(Parser.prototype,J,{value:ParserImpl.prototype[J],enumerable:!1,writable:!1});Parser.Language=Language,Y.onRuntimeInitialized=()=>{ParserImpl.init(),resolveInitPromise()}})}}return Parser}();if(typeof MJ==="object")OJ.exports=w0});import{realpath as z$}from"node:fs/promises";import{delimiter as K8}from"node:path";import{open as w$}from"node:fs/promises";var jJ=Buffer.from(`
6
+ `),cJ=Buffer.from(`\r
7
+ `),uJ=Buffer.from("\r"),BJ=Buffer.alloc(0);async function*NJ(J,Q){let $=Q?.detectBinary??!1,Z=[],X=0,K=0,G=!1;function U(q){if(q&&q.length>0)Z.push(q),X+=q.length;if(X===0)return BJ;let W=Z.length===1?Z[0]:Buffer.concat(Z,X);return Z=[],X=0,W}for await(let q of J){if(q.length===0)continue;let W=0;if(G){G=!1;let z=q[0]===10?cJ:uJ;if(z===cJ)W=1;yield{lineBytes:U(),eolBytes:z,lineNumber:++K}}for(let z=W;z<q.length;z++){let V=q[z];if($&&V===0)throw Error("File appears to be binary (contains null bytes)");if(V!==13&&V!==10)continue;let H=q.subarray(W,z),A;if(V===13)if(z+1<q.length)if(q[z+1]===10)A=cJ,z++;else A=uJ;else{Z.push(Buffer.from(H)),X+=H.length,G=!0,W=z+1;continue}else A=jJ;yield{lineBytes:U(H),eolBytes:A,lineNumber:++K},W=z+1}if(W<q.length){let z=Buffer.from(q.subarray(W,q.length));Z.push(z),X+=z.length}}if(G||X>0)yield{lineBytes:U(),eolBytes:G?uJ:BJ,lineNumber:++K}}var UQ=65536;async function*VJ(J,Q){async function*$(){let Z=await w$(J,"r"),X=Buffer.allocUnsafe(UQ);try{let K;do{if({bytesRead:K}=await Z.read(X,0,UQ),K===0)break;yield Buffer.from(X.subarray(0,K))}while(K>0)}finally{await Z.close()}}yield*NJ($(),Q)}import{open as B$}from"node:fs/promises";var N$=Buffer.from([239,187,191]),S$=Buffer.from([255,254]),R$=Buffer.from([254,255]);function dJ(J){if(J.length>=3&&J[0]===239&&J[1]===187&&J[2]===191)return{encoding:"utf-8",bomLength:3,hasBOM:!0};if(J.length>=2&&J[0]===255&&J[1]===254)return{encoding:"utf-16le",bomLength:2,hasBOM:!0};if(J.length>=2&&J[0]===254&&J[1]===255)return{encoding:"utf-16be",bomLength:2,hasBOM:!0};return{encoding:"utf-8",bomLength:0,hasBOM:!1}}var SJ=65536;async function qJ(J,Q){let $=await B$(J,"r"),Z=Buffer.allocUnsafe(SJ),{bytesRead:X}=await $.read(Z,0,SJ);if(X===0){await $.close();async function*q(){}return{lines:q(),bomInfo:{encoding:"utf-8",bomLength:0,hasBOM:!1}}}let K=Buffer.from(Z.subarray(0,X)),G=dJ(K);if(G.encoding==="utf-16le"||G.encoding==="utf-16be"){let q={...Q,detectBinary:!1};async function*W(){let z=new TextDecoder(G.encoding),V=K.subarray(G.bomLength);if(V.length>0){let H=z.decode(V,{stream:!0});if(H.length>0)yield Buffer.from(H,"utf-8")}try{let H;do{if({bytesRead:H}=await $.read(Z,0,SJ),H===0)break;let T=Buffer.from(Z.subarray(0,H)),F=z.decode(T,{stream:!0});if(F.length>0)yield Buffer.from(F,"utf-8")}while(H>0);let A=z.decode(new Uint8Array(0),{stream:!1});if(A.length>0)yield Buffer.from(A,"utf-8")}finally{await $.close()}}return{lines:NJ(W(),q),bomInfo:G}}async function*U(){let q=G.hasBOM?K.subarray(G.bomLength):K;if(q.length>0)yield q;try{let W;do{if({bytesRead:W}=await $.read(Z,0,SJ),W===0)break;yield Buffer.from(Z.subarray(0,W))}while(W>0)}finally{await $.close()}}return{lines:NJ(U(),Q),bomInfo:G}}function zQ(J){if(!J.hasBOM)return Buffer.alloc(0);switch(J.encoding){case"utf-8":return N$;case"utf-16le":return S$;case"utf-16be":return R$}}function lJ(J,Q){if(Q==="utf-8")return Buffer.from(J,"utf-8");if(Q==="utf-16le")return Buffer.from(J,"utf16le");let $=Buffer.from(J,"utf16le");for(let Z=0;Z<$.length-1;Z+=2){let X=$[Z];$[Z]=$[Z+1],$[Z+1]=X}return $}function WQ(J,Q){if(Q==="utf-8")return J;return lJ(J.toString("utf-8"),Q)}var e=2166136261;var jQ="0-0:00000000";function RJ(J){let Q=2166136261;for(let $=0;$<J.length;$++){let Z=J.charCodeAt($);if(Z>=55296&&Z<=56319)if($+1<J.length){let X=J.charCodeAt($+1);if(X>=56320&&X<=57343)Z=(Z-55296<<10)+(X-56320)+65536,$++;else Z=65533}else Z=65533;else if(Z>=56320&&Z<=57343)Z=65533;if(Z<128)Q=Math.imul(Q^Z,16777619)>>>0;else if(Z<2048)Q=Math.imul(Q^(192|Z>>6),16777619)>>>0,Q=Math.imul(Q^(128|Z&63),16777619)>>>0;else if(Z<65536)Q=Math.imul(Q^(224|Z>>12),16777619)>>>0,Q=Math.imul(Q^(128|Z>>6&63),16777619)>>>0,Q=Math.imul(Q^(128|Z&63),16777619)>>>0;else Q=Math.imul(Q^(240|Z>>18),16777619)>>>0,Q=Math.imul(Q^(128|Z>>12&63),16777619)>>>0,Q=Math.imul(Q^(128|Z>>6&63),16777619)>>>0,Q=Math.imul(Q^(128|Z&63),16777619)>>>0}return Q>>>0}function s(J,Q,$){let Z=2166136261;for(let X=Q;X<$;X++)Z=Math.imul(Z^J[X],16777619)>>>0;return Z}function $J(J,Q){return J=Math.imul(J^Q&255,16777619)>>>0,J=Math.imul(J^Q>>>8&255,16777619)>>>0,J=Math.imul(J^Q>>>16&255,16777619)>>>0,J=Math.imul(J^Q>>>24&255,16777619)>>>0,J}function TQ(J,Q,$,Z,X){let K=$.toString(16).padStart(8,"0");if(Z&&X)return`${Z}.${J}-${X}.${Q}:${K}`;return`${J}-${Q}:${K}`}var HQ="abcdefghijklmnopqrstuvwxyz",P$=(()=>{let J=Array(676);for(let Q=0;Q<26;Q++)for(let $=0;$<26;$++)J[Q*26+$]=HQ[Q]+HQ[$];return J})();function XJ(J){let Q=(J>>>16^J&65535)>>>0;return P$[Q%26*26+(Q>>>8>>>0)%26]}var FQ=/^\d+$/,AQ="??";function oJ(J){let Q=J.indexOf(".");if(Q===-1){if(!FQ.test(J))throw Error(`Invalid hash.line reference "${J}" — expected format "hash.line" (e.g. "ab.12"). `+"Copy the 2-letter prefix and line number from trueline_read/trueline_search output.");let K=Number(J);if(K!==0)return{line:K,hash:"??"};return{line:0,hash:""}}let $=J.slice(0,Q),Z=J.slice(Q+1);if(!FQ.test(Z))throw Error(`Invalid line number in "${J}" — must be a non-negative integer`);let X=Number(Z);if(X===0)throw Error(`Invalid hash.line reference "${J}" — line 0 must use bare "0" with no hash`);if(!/^[a-z]{2}$/.test($)){if($.length>0)return{line:X,hash:"??"};throw Error(`Invalid hash.line reference "${J}" — expected format "hash.line" (e.g. "ab.${X}"). Copy the 2-letter prefix and line number from trueline_read/trueline_search output.`)}return{line:X,hash:$}}function OQ(J){let Q=!1,$=J;if($.startsWith("+"))Q=!0,$=$.slice(1);let Z=$.indexOf("-");if(Q&&Z!==-1)throw Error(`Invalid range "${J}" — insert-after (+) requires a single-line target, not a range. Use "+ab.10" to insert after line 10.`);if(Z===-1){let G=oJ($);return{start:G,end:{...G},insertAfter:Q}}let X=oJ($.slice(0,Z)),K=oJ($.slice(Z+1));if(X.line>K.line)throw Error(`Invalid range "${J}" — start line ${X.line} must be ≤ end line ${K.line}. Did you swap start and end?`);return{start:X,end:K,insertAfter:Q}}function kQ(J){if(!J||J.length===0)return[{start:1,end:1/0}];let Q=J.map(($)=>{let Z=$.indexOf("-"),X,K;if(Z===-1)X=Number($),K=X;else if(Z===0)X=1,K=Number($.slice(1));else if(Z===$.length-1)X=Number($.slice(0,-1)),K=1/0;else X=Number($.slice(0,Z)),K=Number($.slice(Z+1));if(!Number.isInteger(X)||X<1)throw Error(`Invalid range "${$}": start must be a positive integer`);if(K!==1/0&&(!Number.isInteger(K)||K<1))throw Error(`Invalid range "${$}": end must be a positive integer`);if(X>K)throw Error(`Invalid range "${$}": start ${X} must be <= end ${K}`);return{start:X,end:K}});Q.sort(($,Z)=>$.start-Z.start);for(let $=1;$<Q.length;$++){let Z=Q[$-1],X=Q[$];if(Z.end===1/0||X.start<=Z.end+1)Z.end=Math.max(Z.end,X.end),Q.splice($,1),$--}return Q}var JJ=new Map,I$=1;function v$(){if(JJ.size<=500)return;let J=JJ.size-500,Q=0;for(let $ of JJ.keys()){if(Q>=J)break;JJ.delete($),Q++}}function YJ(J,Q,$,Z){let X=`R${I$++}`;return JJ.set(X,{filePath:J,startLine:Q,endLine:$,hash:Z}),v$(),X}function PJ(J){let Q=JJ.get(J);if(!Q)throw Error(`Unknown ref "${J}" — this ref was never issued or has expired. `+"Use a ref from a recent trueline_read or trueline_search output.");return JJ.delete(J),JJ.set(J,Q),Q}function DQ(J){return JJ.has(J)}function _Q(J){return{startLine:J.startLine,endLine:J.endLine,hash:J.hash}}function EQ(J,Q){let $=[...Q].sort((Z,X)=>Z.startLine-X.startLine);for(let[Z,X]of JJ){if(X.filePath!==J)continue;let K=!1,G=0;for(let U of $)if(U.insertAfter){let q=U.startLine;if(X.startLine<=q&&X.endLine>q){K=!0;break}if(X.startLine>q)G+=U.newLineCount}else{let{startLine:q,endLine:W}=U,z=W-q+1,V=U.newLineCount-z;if(X.startLine<=W&&X.endLine>=q){K=!0;break}if(X.startLine>W)G+=V}if(K)JJ.delete(Z);else if(G!==0)X.startLine+=G,X.endLine+=G}}function CQ(J,Q){let $=[];for(let[Z,X]of JJ)if(X.filePath===J&&Z!==Q)$.push(Z);return $}import{realpath as rJ,stat as y$}from"node:fs/promises";import{statSync as RQ}from"node:fs";import{resolve as g$,sep as PQ}from"node:path";import{readFile as L$,stat as M$}from"node:fs/promises";import{homedir as x$}from"node:os";import{resolve as nJ}from"node:path";var iJ=new Map,wQ=new Map;function b$(J){let Q=J.match(/^(\w+)\((.+)\)$/);return Q?{tool:Q[1],glob:Q[2]}:null}function BQ(J,Q=!1){let $=`${J}:${Q}`,Z=wQ.get($);if(Z)return Z;J=J.replace(/(\*\*\/)+/g,"**/");let X=J.replace(/\*\*\/|\*\*|\*|\?|[^*?]+/g,(G,U)=>{let q=U===0||J[U-1]==="/";switch(G){case"**/":return q?"(.*/)?":"[^/]*/";case"**":return q?".*":"[^/]*";case"*":return"[^/]*";case"?":return"[^/]";default:return G.replace(/[.+^${}()|[\]\\/-]/g,"\\$&")}}),K=new RegExp(`^${X}$`,Q?"i":"");return wQ.set($,K),K}async function NQ(J,Q,$){let Z=async(G)=>{let U=`${G}:${J}`,q;try{q=(await M$(G)).mtimeMs}catch{return null}let W=iJ.get(U);if(W&&W.mtime===q)return W.globs;let z;try{z=JSON.parse(await L$(G,"utf-8"))}catch{return iJ.set(U,{mtime:q,globs:null}),null}let V=typeof z==="object"&&z!==null?z:void 0,A=(typeof V?.permissions==="object"&&V.permissions!==null?V.permissions:void 0)?.deny,T=[];if(Array.isArray(A))for(let F of A){if(typeof F!=="string")continue;let O=b$(F);if(O?.tool===J)T.push(O.glob)}return iJ.set(U,{mtime:q,globs:T}),T},X=[];if(Q)X.push(nJ(Q,".claude","settings.local.json")),X.push(nJ(Q,".claude","settings.json"));return X.push($??nJ(x$(),".claude","settings.json")),(await Promise.all(X.map(Z))).filter((G)=>G!==null)}function SQ(J,Q,$=process.platform==="win32"){let Z=J.replace(/\\/g,"/"),X=Z.split("/").pop()??Z,K=(U)=>{let q=BQ(U,$);if(q.test(Z))return!0;if(!U.includes("/"))return q.test(X);if(!U.startsWith("/")&&!U.startsWith("*"))return BQ(`**/${U}`,$).test(Z);return!1},G=Q.flat().find(K);return G?{denied:!0,matchedPattern:G}:{denied:!1}}function g(J){return{content:[{type:"text",text:J}]}}function I(J){return{content:[{type:"text",text:J}],isError:!0}}import{glob as IQ}from"node:fs/promises";import{execFile as m$}from"node:child_process";import{matchesGlob as p$}from"node:path";async function a(J,Q,$,Z=[]){if(J==="*")return{ok:!1,error:I('Wildcard "*" is only supported by trueline_changes. Pass an explicit file path.')};let X=J.startsWith("/")?J:g$($??process.cwd(),J),K;try{K=await rJ(X)}catch{return{ok:!1,error:I(`Error reading file: "${J}" not found`)}}let G=await y$(K);if(!G.isFile())return{ok:!1,error:I(`"${J}" is not a regular file`)};let U;try{U=await rJ($?$:process.cwd())}catch{return{ok:!1,error:I("Project directory not found or inaccessible")}}let q=await Promise.all(Z.map(async(F)=>{try{return await rJ(F)}catch{return F}})),W=[U,...q];if(!(process.platform==="win32"?W.some((F)=>{let O=K.toLowerCase(),j=F.toLowerCase();return O===j||O.startsWith(j+PQ)}):W.some((F)=>K===F||K.startsWith(F+PQ))))return{ok:!1,error:I(`Access denied: "${J}" is outside the project directory`)};let V=await NQ(Q,$),{denied:H,matchedPattern:A}=SQ(K,V);if(H)return{ok:!1,error:I(`Access denied: "${J}" matched deny pattern "${A}"`)};let T=10485760;if(G.size>T)return{ok:!1,error:I(`"${J}" exceeds the 10 MB size limit (${(G.size/1024/1024).toFixed(1)} MB)`)};return{ok:!0,resolvedPath:K,size:G.size,mtimeMs:G.mtimeMs}}function UJ(J){return J instanceof Error&&J.message.includes("binary")}function IJ(J){return I(`"${J}" appears to be a binary file`)}function h$(J,Q){if(process.platform!=="win32")return!1;try{let $=RQ(J),Z=RQ(Q);return $.dev===Z.dev&&$.ino===Z.ino&&$.ino!==0}catch{return!1}}function vQ(J,Q){let $=[],Z=new Map,X=[];for(let q of J){let W;try{W=PJ(q.ref)}catch(H){return{ok:!1,error:I(H.message)}}let z=_Q(W);if(Z.set(q.ref,z),Q&&W.filePath!==Q&&!h$(W.filePath,Q))return{ok:!1,error:I(`Ref ${q.ref} was issued for a different file (${W.filePath}), not the file being edited (${Q}). Use a ref from trueline_read or trueline_search on the target file.`)};let V;try{V=OQ(q.range)}catch(H){let A=H instanceof Error?H.message:String(H),T=` Your ref ${q.ref} covers lines ${z.startLine}–${z.endLine}.`;return{ok:!1,error:I(A+T)}}if(q.action==="insert_after"){if(V.start.line!==V.end.line)return{ok:!1,error:I('action "insert_after" requires a single-line range (e.g. "ab.10"), not a multi-line range. To insert new lines after line 10, use range "ab.10" with action "insert_after".')};V.insertAfter=!0}else if(q.action==="replace")V.insertAfter=!1;if(V.start.line===0&&!V.insertAfter)return{ok:!1,error:I('range starting at line 0 requires insert-after (use action: "insert_after" or +0 prefix)')};if(V.insertAfter&&q.content==="")return{ok:!1,error:I("insert_after with empty content would insert zero lines (no-op). To insert a blank line, use content: ' ' or include the actual content to insert.")};if(V.start.line>0){if(z.startLine>V.start.line||z.endLine<V.end.line)return{ok:!1,error:I(`Ref ${q.ref} covers lines ${z.startLine}-${z.endLine}, which does not cover edit range ${V.start.line}-${V.end.line}. Re-read with trueline_read to get a ref covering the target lines.`)}}if(q.content!==""){let H=/^[a-z]{2}\.\d+$/,T=q.content.split(`
8
+ `).filter((F)=>H.test(F.trim()));if(T.length>0)X.push(`WARNING: content contains what looks like hash.line identifiers from trueline_read output: ${T.map((F)=>`"${F.trim()}"`).join(", ")}. These are addressing tags, not file content. If this was unintentional, undo the edit and retry with only the actual text.`)}$.push({startLine:V.start.line,endLine:V.end.line,content:q.content===""?[]:q.content.split(`
9
+ `),insertAfter:V.insertAfter,startHash:V.start.hash,endHash:V.end.hash})}let K=[...Z.values()];K.sort((q,W)=>q.startLine-W.startLine);let G=$.filter((q)=>!q.insertAfter);G.sort((q,W)=>q.startLine-W.startLine);for(let q=1;q<G.length;q++)if(G[q].startLine<=G[q-1].endLine)return{ok:!1,error:I(`Overlapping ranges: line ${G[q].startLine} targeted by multiple edits`)};let U=$.filter((q)=>q.insertAfter);for(let q of U)for(let W of G)if(q.startLine>=W.startLine&&q.startLine<W.endLine)return{ok:!1,error:I(`Insert-after at line ${q.startLine} conflicts with replace range ${W.startLine}–${W.endLine}. Insert after the last line of the replace instead.`)};return{ok:!0,ops:$,checksumRefs:K,warnings:X}}var f$={"utf-8":"utf-8",utf8:"utf-8",ascii:"ascii",latin1:"latin1"};function vJ(J){if(J===void 0)return"utf-8";let Q=f$[J.toLowerCase()];if(Q===void 0)throw Error(`Unsupported encoding "${J}". Supported: utf-8, ascii, latin1`);return Q}var c$=/[*?{[]/,u$=/\*\*/,d$=new Set(["node_modules",".git","dist","build",".next","__pycache__",".venv","vendor","target"]);async function DJ(J,Q){let $=Q??process.cwd(),Z=[],X=new Set;function K(G){let U=G.replaceAll("\\","/");if(!X.has(U))X.add(U),Z.push(U)}for(let G of J){if(!c$.test(G)){K(G);continue}if(u$.test(G)){let U=await l$($);if(U){for(let q of U)if(p$(q,G))K(q)}else for await(let q of IQ(G,{cwd:$,exclude:(W)=>d$.has(W)}))K(q)}else for await(let U of IQ(G,{cwd:$}))K(U)}return Z.sort(),Z}var sJ=new Map;async function l$(J){let Q=sJ.get(J);if(Q!==void 0)return Q;try{let $=await new Promise((Z,X)=>{m$("git",["ls-files","--cached","--others","--exclude-standard","-z"],{cwd:J,maxBuffer:10485760},(K,G)=>{if(K)return X(K);Z(G.split("\x00").filter(Boolean))})});return sJ.set(J,$),$}catch{return sJ.set(J,null),null}}function WJ(J,Q){let $=J.replaceAll("\\","/"),Z=Q?.replaceAll("\\","/");if(Z&&$.startsWith(`${Z}/`))return $.slice(Z.length+1);return $}var o$=500,TJ=new Map;function n$(J){return J.map((Q)=>`${Q.start}-${Q.end}`).join(",")}function i$(J){let Q=J.map(($)=>({start:$.start>1&&$.end!==1/0?$.start-1:$.start,end:$.end!==1/0?$.end+1:$.end}));for(let $=1;$<Q.length;$++){let Z=Q[$-1],X=Q[$];if(Z.end===1/0||X.start<=Z.end+1)Z.end=Math.max(Z.end,X.end),Q.splice($,1),$--}return Q}function r$(J){let Q=[`unchanged ${J.refs.map(($)=>`ref:${$}`).join(" ")}`];if(J.encodingLine)Q.push(J.encodingLine);return Q.join(`
10
+ `)}function LQ(){if(TJ.size<o$)return;let J=TJ.keys().next().value;if(J!==void 0)TJ.delete(J)}async function MQ(J){let{file_path:Q,projectDir:$,allowedDirs:Z}=J,X=await a(Q,"Read",$,Z);if(!X.ok)return X.error;let K;try{K=vJ(J.encoding)}catch(D){return I(D.message)}let{resolvedPath:G,mtimeMs:U}=X,q;try{q=kQ(J.ranges)}catch(D){return I(D.message)}let W=q;q=i$(q);let z=n$(W),V=TJ.get(G);if(V&&V.mtimeMs===U&&V.rangesKey===z&&V.refs.every(DQ))return g(r$(V));let H=2000,A=20971520,T=[],F=0,O=0,j=q[0],k=e,E=0,w=0,R=0,v=0,L=!1,h=[],f=await qJ(G,{detectBinary:!0}),{bomInfo:M}=f;try{for await(let{lineBytes:D,lineNumber:B}of f.lines){if(R=B,O>=q.length)break;if(j=q[O],B<j.start)continue;if(B>j.end){let u=k.toString(16).padStart(8,"0"),t=YJ(G,E,w,u);h.push(t);let fJ=`
11
11
  ref:${t}
12
- `,KJ=Buffer.from(hJ);if(T.push(KJ),A+=KJ.length,O++,D=e,E=0,w=0,O>=V.length)break;if(j=V[O],B<j.start)continue}let N=s(k,0,k.length),y=XJ(N);if(E===0)E=B;let p=Buffer.from(`${y}.${B} `),b=p.length+k.length+1;if(I++,I>W||A+b>F){L=!0;break}w=B,D=$J(D,N),T.push(p,k,HJ),A+=b}}catch(k){if(UJ(k))return PJ(Q);throw k}if(R===0&&!L){let k=YJ(G,0,0,"00000000");return IQ(),jJ.set(G,{mtimeMs:z,rangesKey:U,refs:[k],encodingLine:""}),g(`(empty file)
12
+ `,KJ=Buffer.from(fJ);if(T.push(KJ),F+=KJ.length,O++,k=e,E=0,w=0,O>=q.length)break;if(j=q[O],B<j.start)continue}let N=s(D,0,D.length),y=XJ(N);if(E===0)E=B;let p=Buffer.from(`${y}.${B} `),b=p.length+D.length+1;if(v++,v>H||F+b>A){L=!0;break}w=B,k=$J(k,N),T.push(p,D,jJ),F+=b}}catch(D){if(UJ(D))return IJ(Q);throw D}if(R===0&&!L){let D=YJ(G,0,0,"00000000");return LQ(),TJ.set(G,{mtimeMs:U,rangesKey:z,refs:[D],encodingLine:""}),g(`(empty file)
13
13
 
14
- ref:${k}`)}if(E===0&&V[0].start>R)return v(`start_line ${V[0].start} out of range (file has ${R} lines)`);if(E>0&&w>0){let k=D.toString(16).padStart(8,"0"),B=YJ(G,E,w,k);h.push(B);let N=`
15
- ref:${B}`,y=Buffer.from(N);T.push(y),A+=y.length}if(L){let B=`
14
+ ref:${D}`)}if(E===0&&q[0].start>R)return I(`start_line ${q[0].start} out of range (file has ${R} lines)`);if(E>0&&w>0){let D=k.toString(16).padStart(8,"0"),B=YJ(G,E,w,D);h.push(B);let N=`
15
+ ref:${B}`,y=Buffer.from(N);T.push(y),F+=y.length}if(L){let B=`
16
16
 
17
- (truncated at ${I>W?`${W} line`:"20 MB output"} limit — use ranges for specific sections)`,N=Buffer.from(B);T.push(N),A+=N.length}let m=150,o=H.length===1&&H[0].end===1/0;if(!L&&o&&I>m){let k=Buffer.from(`
17
+ (truncated at ${v>H?`${H} line`:"20 MB output"} limit — use ranges for specific sections)`,N=Buffer.from(B);T.push(N),F+=N.length}let m=150,o=W.length===1&&W[0].end===1/0;if(!L&&o&&v>m){let D=Buffer.from(`
18
18
 
19
- (${I} lines — consider ranges for targeted reads)`);T.push(k),A+=k.length}if(M.hasBOM){let k=M.encoding==="utf-8"?"utf-8-bom":M.encoding,B=Buffer.from(`
20
- encoding: ${k}`);T.push(B),A+=B.length}if(!L&&h.length>0){let k=M.hasBOM?`encoding: ${M.encoding==="utf-8"?"utf-8-bom":M.encoding}`:"";IQ(),jJ.set(G,{mtimeMs:z,rangesKey:U,refs:h,encodingLine:k})}let P=M.encoding==="utf-8"?K:"utf-8";return g(Buffer.concat(T,A).toString(P))}import{open as X0}from"node:fs/promises";import{unlink as Y0}from"node:fs/promises";import{relative as K0}from"node:path";class sJ{entries=[];context(J){this.entries.push({type:"ctx",text:J})}delete(J){this.entries.push({type:"del",text:J})}insert(J){this.entries.push({type:"ins",text:J})}format(J,Q,$=3){let Z=this.entries;if(Z.length===0)return"";let X=[];for(let H=0;H<Z.length;H++)if(Z[H].type!=="ctx")X.push(H);if(X.length===0)return"";let K=[],G=X[0],z=X[0];for(let H=1;H<X.length;H++)if(X[H]-z-1<=2*$)z=X[H];else K.push([G,z]),G=X[H],z=X[H];K.push([G,z]);let V=[`--- ${J}`,`+++ ${Q}`];for(let[H,U]of K){let q=Math.max(0,H-$),W=Math.min(Z.length-1,U+$),F=1,T=1;for(let w=0;w<q;w++){if(Z[w].type!=="ins")F++;if(Z[w].type!=="del")T++}let A=0,O=0,j=[];for(let w=q;w<=W;w++){let R=Z[w];switch(R.type){case"ctx":j.push(` ${R.text}`),A++,O++;break;case"del":j.push(`-${R.text}`),A++;break;case"ins":j.push(`+${R.text}`),O++;break}}let D=A===1?`${F}`:`${F},${A}`,E=O===1?`${T}`:`${T},${O}`;V.push(`@@ -${D} +${E} @@`),V.push(...j)}return`${V.join(`
19
+ (${v} lines — consider ranges for targeted reads)`);T.push(D),F+=D.length}if(M.hasBOM){let D=M.encoding==="utf-8"?"utf-8-bom":M.encoding,B=Buffer.from(`
20
+ encoding: ${D}`);T.push(B),F+=B.length}if(!L&&h.length>0){let D=M.hasBOM?`encoding: ${M.encoding==="utf-8"?"utf-8-bom":M.encoding}`:"";LQ(),TJ.set(G,{mtimeMs:U,rangesKey:z,refs:h,encodingLine:D})}let P=M.encoding==="utf-8"?K:"utf-8";return g(Buffer.concat(T,F).toString(P))}import{open as Y0}from"node:fs/promises";import{unlink as K0}from"node:fs/promises";import{relative as G0}from"node:path";class aJ{entries=[];context(J){this.entries.push({type:"ctx",text:J})}delete(J){this.entries.push({type:"del",text:J})}insert(J){this.entries.push({type:"ins",text:J})}format(J,Q,$=3){let Z=this.entries;if(Z.length===0)return"";let X=[];for(let W=0;W<Z.length;W++)if(Z[W].type!=="ctx")X.push(W);if(X.length===0)return"";let K=[],G=X[0],U=X[0];for(let W=1;W<X.length;W++)if(X[W]-U-1<=2*$)U=X[W];else K.push([G,U]),G=X[W],U=X[W];K.push([G,U]);let q=[`--- ${J}`,`+++ ${Q}`];for(let[W,z]of K){let V=Math.max(0,W-$),H=Math.min(Z.length-1,z+$),A=1,T=1;for(let w=0;w<V;w++){if(Z[w].type!=="ins")A++;if(Z[w].type!=="del")T++}let F=0,O=0,j=[];for(let w=V;w<=H;w++){let R=Z[w];switch(R.type){case"ctx":j.push(` ${R.text}`),F++,O++;break;case"del":j.push(`-${R.text}`),F++;break;case"ins":j.push(`+${R.text}`),O++;break}}let k=F===1?`${A}`:`${A},${F}`,E=O===1?`${T}`:`${T},${O}`;q.push(`@@ -${k} +${E} @@`),q.push(...j)}return`${q.join(`
21
21
  `)}
22
- `}}import{randomBytes as r$}from"node:crypto";import{chmod as s$,open as a$,rename as t$,stat as e$,unlink as J0}from"node:fs/promises";import{dirname as Q0,resolve as $0}from"node:path";function Z0(J,Q){if(J.length!==Q.length)return!1;for(let $=0;$<J.length;$++)if(!J[$].equals(Q[$]))return!1;return!0}async function aJ(J,Q,$,Z,X=!1,K="utf-8",G,z){let V=Q.map((_,S)=>({op:_,i:S}));V.sort((_,S)=>{if(_.op.startLine!==S.op.startLine)return _.op.startLine-S.op.startLine;if(_.op.insertAfter!==S.op.insertAfter)return _.op.insertAfter?1:-1;return _.i-S.i});let H=V.map((_)=>_.op),U=new Map;for(let _ of H){let S=U.get(_.startLine)??[];S.push(_),U.set(_.startLine,S)}let q=$.map((_)=>({ref:_,hash:e,verified:!1})),W=0,F=z?.encoding==="utf-16le"||z?.encoding==="utf-16be",T=z?.encoding??"utf-8";function A(_){return F?zQ(_,T):_}function O(_){return F?dJ(_.toString("utf-8"),T):_}let j=Q0(J),D=`.trueline-tmp-${r$(6).toString("hex")}`,E=$0(j,D),w=await a$(E,"w"),R=65536,I=Buffer.allocUnsafe(R),L=0;if(z?.hasBOM){let _=UQ(z);if(_.length>0)await w.write(_,0,_.length)}async function h(){if(L>0)await w.write(I,0,L),L=0}async function f(_){if(L+_.length>R){if(await h(),_.length>R){await w.write(_,0,_.length);return}}_.copy(I,L),L+=_.length}let M=HJ,m=!1,o=!1,P=0,k=null,B=HJ,N=wJ,y=0,p=e,b=null,u=[],t=[];async function hJ(){if(k!==null)await f(A(k)),await f(O(B)),k=null}async function KJ(_,S,c){await hJ(),k=_,B=c??M;let ZJ=S??s(_,0,_.length);p=$J(p,ZJ),y++}async function ZQ(_){await KJ(Buffer.from(_,K))}async function GJ(){try{await w.close()}catch{}try{await J0(E)}catch{}}async function zJ(_){return await GJ(),{ok:!1,error:`${J}: ${_}`}}async function CJ(_){for(let S of _)await ZQ(S)}async function XQ(_,S,c){if(_.content.length!==S.length){if(o=!0,_.content.length===0)_.deletedContent=S.map((x)=>x.toString(K));for(let x of _.content)await ZQ(x);if(G){for(let x of S)G.delete(x.toString(K));for(let x of _.content)G.insert(x)}return}let ZJ=_.content.map((x)=>Buffer.from(x,K));if(Z0(ZJ,S)){for(let x=0;x<S.length;x++){let QJ=c?.[x];await KJ(S[x],void 0,QJ&&QJ.length>0?QJ:void 0)}if(G)for(let x of S)G.context(x.toString(K))}else{o=!0;for(let x of ZJ)await KJ(x);if(G){for(let x of S)G.delete(x.toString(K));for(let x of _.content)G.insert(x)}}}function YQ(){return y>0?jQ(1,y,p):HQ}function KQ(){return p.toString(16).padStart(8,"0")}function fJ(_,S,c){if(S===FQ)return`wrong hash prefix for line ${_}. Re-read the file to get current hash.line references before retrying.`;return`hash mismatch at line ${_}: expected ${S}, got ${c}. The file content at this line is different from what you expect. Re-read the file to see what is actually there before retrying.`}let GQ=U.get(0);if(GQ){for(let _ of GQ)if(await CJ(_.content),G)for(let S of _.content)G.insert(S);o=!0,U.delete(0)}let W$=await qJ(J,{detectBinary:!F});try{for await(let{lineBytes:_,eolBytes:S,lineNumber:c}of W$.lines){if(P=c,N=S,!m&&S.length>0)M=S,m=!0,B=M;let ZJ=s(_,0,_.length),x=XJ(ZJ);while(W<q.length&&q[W].ref.endLine<c)q[W].verified=!0,W++;for(let l=W;l<q.length;l++){let r=q[l];if(c<r.ref.startLine)break;if(c>r.ref.endLine)continue;r.hash=$J(r.hash,ZJ)}if(b&&c<=b.endLine){if(c===b.endLine&&b.endHash!==""){if(x!==b.endHash)return await zJ(fJ(c,b.endHash,x))}if(u.push(_),t.push(S),c===b.endLine){let l=b;b=null,await XQ(l,u,t),u=[],t=[];let r=U.get(c);if(r){for(let n of r)if(n.insertAfter){if(o=!0,await CJ(n.content),G)for(let OJ of n.content)G.insert(OJ)}}}continue}let QJ=U.get(c);if(QJ){let l=null,r=[];for(let n of QJ)if(n.insertAfter)r.push(n);else l=n;if(l){if(l.startHash!==""&&x!==l.startHash)return await zJ(fJ(c,l.startHash,x));if(l.startLine===l.endLine){await XQ(l,[_],[S]);for(let n of r)if(o=!0,await CJ(n.content),G)for(let OJ of n.content)G.insert(OJ)}else b=l,u=[_],t=[S]}else{for(let n of r)if(n.startHash!==""&&x!==n.startHash)return await zJ(fJ(c,n.startHash,x));if(await KJ(_,ZJ,S.length>0?S:void 0),G)G.context(_.toString(K));for(let n of r)if(o=!0,await CJ(n.content),G)for(let OJ of n.content)G.insert(OJ)}}else if(await KJ(_,ZJ,S.length>0?S:void 0),G)G.context(_.toString(K))}}catch(_){if(_ instanceof Error&&_.message.includes("binary"))return await zJ(_.message);throw await GJ(),_}try{if(k!==null){if(await f(A(k)),N.length>0)await f(O(M))}}catch(_){throw await GJ(),_}try{await h(),await w.close()}catch(_){throw await GJ(),_}for(let _ of q){let S=_.ref;if(S.startLine===0&&S.endLine===0){if(P!==0)return await zJ(`Checksum mismatch: expected empty file but file has ${P} lines`);continue}if(S.endLine>P)return await zJ(`Checksum range ${S.startLine}-${S.endLine} exceeds file length (${P} lines)`);let c=S.hash;if(_.hash.toString(16).padStart(8,"0")!==c){await GJ();let x=1/0,QJ=-1/0;for(let r of H)if(r.startLine>0)x=Math.min(x,r.startLine),QJ=Math.max(QJ,r.endLine);let l=`${J}: checksum mismatch for lines ${S.startLine}–${S.endLine}. File changed since last read.`+`
22
+ `}}import{randomBytes as s$}from"node:crypto";import{chmod as a$,open as t$,rename as e$,stat as J0,unlink as Q0}from"node:fs/promises";import{dirname as $0,resolve as Z0}from"node:path";function X0(J,Q){if(J.length!==Q.length)return!1;for(let $=0;$<J.length;$++)if(!J[$].equals(Q[$]))return!1;return!0}async function tJ(J,Q,$,Z,X=!1,K="utf-8",G,U){let q=Q.map((_,S)=>({op:_,i:S}));q.sort((_,S)=>{if(_.op.startLine!==S.op.startLine)return _.op.startLine-S.op.startLine;if(_.op.insertAfter!==S.op.insertAfter)return _.op.insertAfter?1:-1;return _.i-S.i});let W=q.map((_)=>_.op),z=new Map;for(let _ of W){let S=z.get(_.startLine)??[];S.push(_),z.set(_.startLine,S)}let V=$.map((_)=>({ref:_,hash:e,verified:!1})),H=0,A=U?.encoding==="utf-16le"||U?.encoding==="utf-16be",T=U?.encoding??"utf-8";function F(_){return A?WQ(_,T):_}function O(_){return A?lJ(_.toString("utf-8"),T):_}let j=$0(J),k=`.trueline-tmp-${s$(6).toString("hex")}`,E=Z0(j,k),w=await t$(E,"w"),R=65536,v=Buffer.allocUnsafe(R),L=0;if(U?.hasBOM){let _=zQ(U);if(_.length>0)await w.write(_,0,_.length)}async function h(){if(L>0)await w.write(v,0,L),L=0}async function f(_){if(L+_.length>R){if(await h(),_.length>R){await w.write(_,0,_.length);return}}_.copy(v,L),L+=_.length}let M=jJ,m=!1,o=!1,P=0,D=null,B=jJ,N=BJ,y=0,p=e,b=null,u=[],t=[];async function fJ(){if(D!==null)await f(F(D)),await f(O(B)),D=null}async function KJ(_,S,c){await fJ(),D=_,B=c??M;let ZJ=S??s(_,0,_.length);p=$J(p,ZJ),y++}async function XQ(_){await KJ(Buffer.from(_,K))}async function GJ(){try{await w.close()}catch{}try{await Q0(E)}catch{}}async function zJ(_){return await GJ(),{ok:!1,error:`${J}: ${_}`}}async function wJ(_){for(let S of _)await XQ(S)}async function YQ(_,S,c){if(_.content.length!==S.length){if(o=!0,_.content.length===0)_.deletedContent=S.map((x)=>x.toString(K));for(let x of _.content)await XQ(x);if(G){for(let x of S)G.delete(x.toString(K));for(let x of _.content)G.insert(x)}return}let ZJ=_.content.map((x)=>Buffer.from(x,K));if(X0(ZJ,S)){for(let x=0;x<S.length;x++){let QJ=c?.[x];await KJ(S[x],void 0,QJ&&QJ.length>0?QJ:void 0)}if(G)for(let x of S)G.context(x.toString(K))}else{o=!0;for(let x of ZJ)await KJ(x);if(G){for(let x of S)G.delete(x.toString(K));for(let x of _.content)G.insert(x)}}}function KQ(){return y>0?TQ(1,y,p):jQ}function GQ(){return p.toString(16).padStart(8,"0")}function mJ(_,S,c){if(S===AQ)return`wrong hash prefix for line ${_}. Re-read the file to get current hash.line references before retrying.`;return`hash mismatch at line ${_}: file has "${c}", edit specified "${S}". The file content at this line changed since your last read. Re-read the file with trueline_read to get current hashes before retrying.`}let VQ=z.get(0);if(VQ){for(let _ of VQ)if(await wJ(_.content),G)for(let S of _.content)G.insert(S);o=!0,z.delete(0)}let H$=await qJ(J,{detectBinary:!A});try{for await(let{lineBytes:_,eolBytes:S,lineNumber:c}of H$.lines){if(P=c,N=S,!m&&S.length>0)M=S,m=!0,B=M;let ZJ=s(_,0,_.length),x=XJ(ZJ);while(H<V.length&&V[H].ref.endLine<c)V[H].verified=!0,H++;for(let l=H;l<V.length;l++){let r=V[l];if(c<r.ref.startLine)break;if(c>r.ref.endLine)continue;r.hash=$J(r.hash,ZJ)}if(b&&c<=b.endLine){if(c===b.endLine&&b.endHash!==""){if(x!==b.endHash)return await zJ(mJ(c,b.endHash,x))}if(u.push(_),t.push(S),c===b.endLine){let l=b;b=null,await YQ(l,u,t),u=[],t=[];let r=z.get(c);if(r){for(let n of r)if(n.insertAfter){if(o=!0,await wJ(n.content),G)for(let kJ of n.content)G.insert(kJ)}}}continue}let QJ=z.get(c);if(QJ){let l=null,r=[];for(let n of QJ)if(n.insertAfter)r.push(n);else l=n;if(l){if(l.startHash!==""&&x!==l.startHash)return await zJ(mJ(c,l.startHash,x));if(l.startLine===l.endLine){await YQ(l,[_],[S]);for(let n of r)if(o=!0,await wJ(n.content),G)for(let kJ of n.content)G.insert(kJ)}else b=l,u=[_],t=[S]}else{for(let n of r)if(n.startHash!==""&&x!==n.startHash)return await zJ(mJ(c,n.startHash,x));if(await KJ(_,ZJ,S.length>0?S:void 0),G)G.context(_.toString(K));for(let n of r)if(o=!0,await wJ(n.content),G)for(let kJ of n.content)G.insert(kJ)}}else if(await KJ(_,ZJ,S.length>0?S:void 0),G)G.context(_.toString(K))}}catch(_){if(_ instanceof Error&&_.message.includes("binary"))return await zJ(_.message);throw await GJ(),_}try{if(D!==null){if(await f(F(D)),N.length>0)await f(O(M))}}catch(_){throw await GJ(),_}try{await h(),await w.close()}catch(_){throw await GJ(),_}for(let _ of V){let S=_.ref;if(S.startLine===0&&S.endLine===0){if(P!==0)return await zJ(`Checksum mismatch: ref indicates an empty file but the file has ${P} lines. Re-read with trueline_read.`);continue}if(S.endLine>P)return await zJ(`Edit range ${S.startLine}–${S.endLine} exceeds file length (${P} lines). The file may have been truncated since your last read. Re-read with trueline_read.`);let c=S.hash;if(_.hash.toString(16).padStart(8,"0")!==c){await GJ();let x=1/0,QJ=-1/0;for(let r of W)if(r.startLine>0)x=Math.min(x,r.startLine),QJ=Math.max(QJ,r.endLine);let l=`${J}: checksum mismatch for lines ${S.startLine}–${S.endLine}. File changed since last read.`+`
23
23
 
24
24
  Your ref is stale — the file was modified after the ref was issued. `+"Re-read with trueline_read to get a fresh ref. A wider ref from a prior read (covering more lines) is valid for editing any sub-range within it.";if(x!==1/0)return{ok:!1,error:l+`
25
25
 
26
- However, lines ${x}–${QJ} appear unchanged. Re-read with trueline_read(ranges=[{start: ${x}, end: ${QJ}}]) to get a narrow checksum, then retry the edit.`};return{ok:!1,error:l}}}if(!o)return await GJ(),{ok:!0,newChecksum:YQ(),newLineCount:y,newHash:KQ(),changed:!1};if(!X){let _;try{let S=await e$(J);if(_=S.mode,S.mtimeMs!==Z)return await zJ("File was modified by another process. Re-read with trueline_read.")}catch(S){if(S.code!=="ENOENT")throw await GJ(),S}try{if(_!==void 0)await s$(E,_);await t$(E,J)}catch(S){throw await GJ(),S}}return{ok:!0,newChecksum:YQ(),newLineCount:y,newHash:KQ(),changed:!0,...X?{tmpPath:E}:{}}}async function MQ(J){let Q=performance.now(),{file_path:$,edits:Z,dry_run:X,context_lines:K,projectDir:G,allowedDirs:z}=J,H=await a($,X?"Read":"Edit",G,z);if(!H.ok)return H.error;let U;try{U=vJ(J.encoding)}catch(M){return v(M.message)}let{resolvedPath:q,mtimeMs:W}=H,F=vQ(Z,q);if(!F.ok)return F.error;let T=await X0(q,"r"),A=Buffer.alloc(4);try{await T.read(A,0,4)}finally{await T.close()}let O=uJ(A);if(X){let M=new sJ,m=await aJ(q,F.ops,F.checksumRefs,W,!0,U,M,O);if(!m.ok)return v(m.error);if(!m.changed)return g("(no changes)");let o=$.startsWith("/")?K0(G??process.cwd(),q):$,P=M.format(`a/${o}`,`b/${o}`);if(m.tmpPath)try{await Y0(m.tmpPath)}catch{}return g(P)}let j=await aJ(q,F.ops,F.checksumRefs,W,!1,U,void 0,O);if(!j.ok)return v(j.error);let D=F.ops.map((M)=>({startLine:M.startLine,endLine:M.endLine,insertAfter:M.insertAfter,newLineCount:M.content.length}));_Q(q,D);let E=j.newLineCount>0?YJ(q,1,j.newLineCount,j.newHash):YJ(q,0,0,"00000000"),w=G0(F.ops),R=F.warnings.length>0?`
26
+ However, lines ${x}–${QJ} appear unchanged. Re-read with trueline_read(ranges=[{start: ${x}, end: ${QJ}}]) to get a narrow checksum, then retry the edit.`};return{ok:!1,error:l}}}if(!o)return await GJ(),{ok:!0,newChecksum:KQ(),newLineCount:y,newHash:GQ(),changed:!1};if(!X){let _;try{let S=await J0(J);if(_=S.mode,S.mtimeMs!==Z)return await zJ("File was modified by another process during the edit. Your ref is stale. Re-read with trueline_read to get a fresh ref.")}catch(S){if(S.code!=="ENOENT")throw await GJ(),S}try{if(_!==void 0)await a$(E,_);await e$(E,J)}catch(S){throw await GJ(),S}}return{ok:!0,newChecksum:KQ(),newLineCount:y,newHash:GQ(),changed:!0,...X?{tmpPath:E}:{}}}async function xQ(J){let Q=performance.now(),{file_path:$,edits:Z,dry_run:X,context_lines:K,projectDir:G,allowedDirs:U}=J,W=await a($,X?"Read":"Edit",G,U);if(!W.ok)return W.error;let z;try{z=vJ(J.encoding)}catch(M){return I(M.message)}let{resolvedPath:V,mtimeMs:H}=W,A=vQ(Z,V);if(!A.ok)return A.error;let T=await Y0(V,"r"),F=Buffer.alloc(4);try{await T.read(F,0,4)}finally{await T.close()}let O=dJ(F);if(X){let M=new aJ,m=await tJ(V,A.ops,A.checksumRefs,H,!0,z,M,O);if(!m.ok)return I(m.error);if(!m.changed)return g("(no changes)");let o=$.startsWith("/")?G0(G??process.cwd(),V):$,P=M.format(`a/${o}`,`b/${o}`);if(m.tmpPath)try{await K0(m.tmpPath)}catch{}return g(P)}let j=await tJ(V,A.ops,A.checksumRefs,H,!1,z,void 0,O);if(!j.ok)return I(j.error);let k=A.ops.map((M)=>({startLine:M.startLine,endLine:M.endLine,insertAfter:M.insertAfter,newLineCount:M.content.length}));EQ(V,k);let E=j.newLineCount>0?YJ(V,1,j.newLineCount,j.newHash):YJ(V,0,0,"00000000"),w=V0(A.ops),R=A.warnings.length>0?`
27
27
 
28
- ${F.warnings.join(`
29
- `)}`:"",I="",L=K??(F.ops.length>=2?2:0);if(L>0&&j.newLineCount>0){let M=await q0(q,F.ops,L,U);if(M)I=`
28
+ ${A.warnings.join(`
29
+ `)}`:"",v="",L=K??(A.ops.length>=2?2:0);if(L>0&&j.newLineCount>0){let M=await U0(V,A.ops,L,z);if(M)v=`
30
30
 
31
- ${M}`}let h="",f=EQ(q,E);if(f.length>0){let M=f.slice(0,5).join(", "),m=f.length>5?` +${f.length-5} more`:"";h=`
31
+ ${M}`}let h="",f=CQ(V,E);if(f.length>0){let M=f.slice(0,5).join(", "),m=f.length>5?` +${f.length-5} more`:"";h=`
32
32
  (${M}${m} may be stale — trueline_verify to check)`}if(!j.changed)return g(`Edit produced no changes — file not written.
33
33
 
34
34
  ${w}
35
- ref:${E}${h}${R}${I}`);return g(`Edit applied. (${(performance.now()-Q).toFixed(0)}ms)
35
+ ref:${E}${h}${R}${v}`);return g(`Edit applied. (${(performance.now()-Q).toFixed(0)}ms)
36
36
 
37
37
  ${w}
38
- ref:${E}${h}${R}${I}`)}function G0(J){let Q=0;return J.map(($)=>{let Z=$.content.length;if($.insertAfter){let H=$.startLine===0?"at start of file":`after line ${$.startLine}`;if(Z===0)return`inserted 0 lines ${H}`;let U=$.startLine+1+Q,q=$.startLine+Z+Q,W=Z===1?TJ($.content[0],U):`${TJ($.content[0],U)}–${TJ($.content[Z-1],q)}`;return Q+=Z,`inserted ${Z} ${H} → ${W}`}let X=$.endLine-$.startLine+1,K=$.startLine===$.endLine?`${$.startLine}`:`${$.startLine}–${$.endLine}`;if(Z===0){Q-=X;let H=$.deletedContent?`: ${V0($.deletedContent)}`:"";return`deleted ${K} (${X})${H}`}let G=$.startLine+Q,z=$.startLine+Z-1+Q,V=Z===1?TJ($.content[0],G):`${TJ($.content[0],G)}–${TJ($.content[Z-1],z)}`;return Q+=Z-X,`replaced ${K} → ${V} (${X}→${Z})`}).join(`
39
- `)}function TJ(J,Q){return`${XJ(SJ(J))}.${Q}`}function V0(J){let $="";for(let Z=0;Z<J.length;Z++){if(Z>0)$+="\\n";let X=80-$.length;if(X<=0)return`"${$}…"`;$+=J[Z].length<=X?J[Z]:J[Z].slice(0,X)}return $.length>80?`"${$.slice(0,80)}…"`:`"${$}"`}async function q0(J,Q,$,Z){let X=[],K=0;for(let U of Q)if(U.insertAfter){let q=U.startLine+1+K,W=U.startLine+U.content.length+K;X.push({newStart:q,newEnd:W,lineCount:U.content.length}),K+=U.content.length}else{let q=U.endLine-U.startLine+1,W=U.startLine+K,F=U.startLine+U.content.length-1+K;X.push({newStart:W,newEnd:F,lineCount:U.content.length}),K+=U.content.length-q}let G=X.map((U)=>({from:Math.max(1,U.newStart-$),to:U.newEnd+$})),z=new Map,V=Math.max(...G.map((U)=>U.to));for await(let{lineBytes:U,lineNumber:q}of VJ(J,{detectBinary:!1})){if(q>V)break;for(let W of G)if(q>=W.from&&q<=W.to){let F=s(U,0,U.length),T=XJ(F);z.set(q,{letters:T,content:U.toString(Z)});break}}let H=[];for(let U=0;U<X.length;U++){let q=X[U],W=G[U],F=q.lineCount>2*$,A=[`context near ${q.lineCount<=1||q.newStart===q.newEnd?`line ${q.newStart}`:`lines ${q.newStart}-${q.newEnd}`}:`];for(let j=W.from;j<q.newStart;j++){let D=z.get(j);if(D)A.push(`${D.letters}.${j} ${D.content}`)}if(F){for(let D=q.newStart;D<q.newStart+$&&D<=q.newEnd;D++){let E=z.get(D);if(E)A.push(`${E.letters}.${D} ${E.content}`)}let j=q.lineCount-2*$;A.push(` ── ${j} lines ──`);for(let D=q.newEnd-$+1;D<=q.newEnd;D++){let E=z.get(D);if(E)A.push(`${E.letters}.${D} ${E.content}`)}}else for(let j=q.newStart;j<=q.newEnd;j++){let D=z.get(j);if(D)A.push(`${D.letters}.${j} ${D.content}`)}let O=q.lineCount>0?q.newEnd+1:q.newStart;for(let j=O;j<=W.to;j++){let D=z.get(j);if(D)A.push(`${D.letters}.${j} ${D.content}`)}H.push(A.join(`
40
- `))}return H.join(`
38
+ ref:${E}${h}${R}${v}`)}function V0(J){let Q=0;return J.map(($)=>{let Z=$.content.length;if($.insertAfter){let W=$.startLine===0?"at start of file":`after line ${$.startLine}`;if(Z===0)return`inserted 0 lines ${W}`;let z=$.startLine+1+Q,V=$.startLine+Z+Q,H=Z===1?FJ($.content[0],z):`${FJ($.content[0],z)}–${FJ($.content[Z-1],V)}`;return Q+=Z,`inserted ${Z} ${W} → ${H}`}let X=$.endLine-$.startLine+1,K=$.startLine===$.endLine?`${$.startLine}`:`${$.startLine}–${$.endLine}`;if(Z===0){Q-=X;let W=$.deletedContent?`: ${q0($.deletedContent)}`:"";return`deleted ${K} (${X})${W}`}let G=$.startLine+Q,U=$.startLine+Z-1+Q,q=Z===1?FJ($.content[0],G):`${FJ($.content[0],G)}–${FJ($.content[Z-1],U)}`;return Q+=Z-X,`replaced ${K} → ${q} (${X}→${Z})`}).join(`
39
+ `)}function FJ(J,Q){return`${XJ(RJ(J))}.${Q}`}function q0(J){let $="";for(let Z=0;Z<J.length;Z++){if(Z>0)$+="\\n";let X=80-$.length;if(X<=0)return`"${$}…"`;$+=J[Z].length<=X?J[Z]:J[Z].slice(0,X)}return $.length>80?`"${$.slice(0,80)}…"`:`"${$}"`}async function U0(J,Q,$,Z){let X=[],K=0;for(let z of Q)if(z.insertAfter){let V=z.startLine+1+K,H=z.startLine+z.content.length+K;X.push({newStart:V,newEnd:H,lineCount:z.content.length}),K+=z.content.length}else{let V=z.endLine-z.startLine+1,H=z.startLine+K,A=z.startLine+z.content.length-1+K;X.push({newStart:H,newEnd:A,lineCount:z.content.length}),K+=z.content.length-V}let G=X.map((z)=>({from:Math.max(1,z.newStart-$),to:z.newEnd+$})),U=new Map,q=Math.max(...G.map((z)=>z.to));for await(let{lineBytes:z,lineNumber:V}of VJ(J,{detectBinary:!1})){if(V>q)break;for(let H of G)if(V>=H.from&&V<=H.to){let A=s(z,0,z.length),T=XJ(A);U.set(V,{letters:T,content:z.toString(Z)});break}}let W=[];for(let z=0;z<X.length;z++){let V=X[z],H=G[z],A=V.lineCount>2*$,F=[`context near ${V.lineCount<=1||V.newStart===V.newEnd?`line ${V.newStart}`:`lines ${V.newStart}-${V.newEnd}`}:`];for(let j=H.from;j<V.newStart;j++){let k=U.get(j);if(k)F.push(`${k.letters}.${j} ${k.content}`)}if(A){for(let k=V.newStart;k<V.newStart+$&&k<=V.newEnd;k++){let E=U.get(k);if(E)F.push(`${E.letters}.${k} ${E.content}`)}let j=V.lineCount-2*$;F.push(` ── ${j} lines ──`);for(let k=V.newEnd-$+1;k<=V.newEnd;k++){let E=U.get(k);if(E)F.push(`${E.letters}.${k} ${E.content}`)}}else for(let j=V.newStart;j<=V.newEnd;j++){let k=U.get(j);if(k)F.push(`${k.letters}.${j} ${k.content}`)}let O=V.lineCount>0?V.newEnd+1:V.newStart;for(let j=O;j<=H.to;j++){let k=U.get(j);if(k)F.push(`${k.letters}.${j} ${k.content}`)}W.push(F.join(`
40
+ `))}return W.join(`
41
41
 
42
- `)}import{execFile as I0}from"node:child_process";import{promisify as L0}from"node:util";import{readFile as M0}from"node:fs/promises";import{extname as x0,relative as aQ,resolve as b0}from"node:path";var mQ={grammar:"typescript",outline:new Set(["function_declaration","class_declaration","interface_declaration","type_alias_declaration","enum_declaration","lexical_declaration","variable_declaration","export_statement","method_definition","public_field_definition"]),skip:new Set(["import_statement"]),recurse:new Set(["class_body"]),topLevelOnly:new Set(["expression_statement"])},U0={...mQ,grammar:"tsx"},IJ={grammar:"javascript",outline:new Set(["function_declaration","class_declaration","lexical_declaration","variable_declaration","export_statement","expression_statement","method_definition","field_definition"]),skip:new Set(["import_statement"]),recurse:new Set(["class_body"])},xQ={grammar:"python",outline:new Set(["function_definition","class_definition","decorated_definition","expression_statement"]),skip:new Set(["import_statement","import_from_statement"]),recurse:new Set(["block"]),whitespaceMode:"preserve-indent"},z0={grammar:"go",outline:new Set(["function_declaration","method_declaration","type_declaration","const_declaration","var_declaration"]),skip:new Set(["package_clause","import_declaration"]),recurse:new Set([])},W0={grammar:"rust",outline:new Set(["function_item","struct_item","enum_item","trait_item","impl_item","const_item","static_item","mod_item","type_item","macro_definition"]),skip:new Set(["use_declaration"]),recurse:new Set(["declaration_list"])},H0={grammar:"java",outline:new Set(["class_declaration","interface_declaration","enum_declaration","method_declaration","constructor_declaration","field_declaration"]),skip:new Set(["package_declaration","import_declaration"]),recurse:new Set(["class_body"])},j0={grammar:"ruby",outline:new Set(["method","class","module","assignment","call"]),skip:new Set([]),recurse:new Set(["body_statement"])},kJ={grammar:"cpp",outline:new Set(["function_definition","class_specifier","struct_specifier","enum_specifier","namespace_definition","declaration","template_declaration"]),skip:new Set(["preproc_include"]),recurse:new Set(["declaration_list","field_declaration_list"])},bQ={grammar:"c",outline:new Set(["function_definition","struct_specifier","enum_specifier","declaration","type_definition"]),skip:new Set(["preproc_include"]),recurse:new Set([])},T0={grammar:"c_sharp",outline:new Set(["class_declaration","interface_declaration","struct_declaration","enum_declaration","method_declaration","constructor_declaration","property_declaration","namespace_declaration"]),skip:new Set(["using_directive"]),recurse:new Set(["declaration_list"])},yQ={grammar:"kotlin",outline:new Set(["function_declaration","class_declaration","object_declaration","property_declaration"]),skip:new Set(["import_list","package_header"]),recurse:new Set(["class_body"])},F0={grammar:"swift",outline:new Set(["function_declaration","class_declaration","struct_declaration","enum_declaration","protocol_declaration","extension_declaration","property_declaration"]),skip:new Set(["import_declaration"]),recurse:new Set(["class_body"])},A0={grammar:"php",outline:new Set(["function_definition","class_declaration","interface_declaration","trait_declaration","method_declaration","property_declaration"]),skip:new Set(["namespace_use_declaration"]),recurse:new Set(["declaration_list"])},gQ={grammar:"scala",outline:new Set(["function_definition","class_definition","object_definition","trait_definition","val_definition","var_definition","type_definition"]),skip:new Set(["import_declaration"]),recurse:new Set(["template_body"])},hQ={grammar:"elixir",outline:new Set(["call"]),skip:new Set([]),recurse:new Set([])},O0={grammar:"lua",outline:new Set(["function_declaration","local_function","variable_declaration","local_variable_declaration","assignment_statement"]),skip:new Set([]),recurse:new Set([])},D0={grammar:"dart",outline:new Set(["function_signature","class_definition","enum_declaration","mixin_declaration","extension_declaration","type_alias"]),skip:new Set(["import_or_export"]),recurse:new Set(["class_body"])},k0={grammar:"zig",outline:new Set(["TopLevelDecl","VarDecl","FnProto"]),skip:new Set([]),recurse:new Set([])},fQ={grammar:"bash",outline:new Set(["function_definition","variable_assignment"]),skip:new Set([]),recurse:new Set([])},_0={".ts":mQ,".tsx":U0,".js":IJ,".jsx":IJ,".mjs":IJ,".cjs":IJ,".py":xQ,".pyi":xQ,".go":z0,".rs":W0,".java":H0,".c":bQ,".h":bQ,".cpp":kJ,".cc":kJ,".cxx":kJ,".hpp":kJ,".hh":kJ,".cs":T0,".rb":j0,".php":A0,".kt":yQ,".kts":yQ,".swift":F0,".scala":gQ,".sc":gQ,".ex":hQ,".exs":hQ,".lua":O0,".dart":D0,".zig":k0,".sh":fQ,".bash":fQ};function FJ(J){return _0[J]}var MJ=k$(cQ(),1);import{createRequire as w0}from"node:module";import{resolve as lQ,dirname as oQ}from"node:path";var nQ=w0(import.meta.url),uQ=!1,dQ=new Map;function B0(){let J=nQ.resolve("web-tree-sitter/package.json");return lQ(oQ(J),"tree-sitter.wasm")}async function iQ(){if(uQ)return;let J=new Promise((Q,$)=>setTimeout(()=>$(Error("tree-sitter WASM init timed out after 10 s")),1e4));await Promise.race([MJ.default.init({locateFile:()=>B0()}),J]),uQ=!0}function N0(J){let Q=nQ.resolve("tree-sitter-wasms/package.json");return lQ(oQ(Q),"out",`tree-sitter-${J}.wasm`)}async function S0(J){let Q=dQ.get(J);if(Q)return Q;await iQ();let $=await MJ.default.Language.load(N0(J));return dQ.set(J,$),$}async function rQ(J){await iQ();let Q=new MJ.default,$=await S0(J);return Q.setLanguage($),Q}async function xJ(J,Q,$=1/0){let X=(await rQ(Q.grammar)).parse(J),K=J.split(`
43
- `),G=[];function z(A){let O=A.startPosition.row,j=A.endPosition.row,D=K[O]?.trimEnd()??"";if(O===j||D.includes("{"))return D.length>200?`${D.slice(0,197)}...`:D;let E=[D.trimEnd()];for(let R=O+1;R<=Math.min(j,O+20);R++){let I=(K[R]??"").trimEnd();if(E.push(I.trim()),I.includes("{"))break}let w=E.join(" ").replace(/\s+/g," ").replace(/\(\s+/g,"(").replace(/,\s*\)/g,")").replace(/\s*\{\s*$/,"");if(w.length>200)w=`${w.slice(0,197)}...`;return w}let V=-1,H=-1,U=0,q="";function W(){if(U===0)return;let A=U===1?`1 ${q}`:`${U} ${q}s`;G.push({startLine:V,endLine:H,depth:0,nodeType:"_skipped",text:`(${A})`}),V=-1,H=-1,U=0,q=""}function F(A){let O=A.startPosition.row+1,j=A.endPosition.row+1,D=A.type.replace(/_/g," ").replace(/ statement$/,"").replace(/ declaration$/,"");if(U===0||D===q){if(U===0)V=O,q=D;H=j,U++}else W(),V=O,H=j,U=1,q=D}function T(A,O,j){if(j&&Q.skip.has(A.type)){F(A);return}if(Q.skip.has(A.type))return;let D=Q.outline.has(A.type),E=Q.topLevelOnly?.has(A.type)??!1;if(E&&!j)return;if(D||E&&j){if(j)W();if(G.push({startLine:A.startPosition.row+1,endLine:A.endPosition.row+1,depth:O,nodeType:A.type,text:z(A)}),O+1<=$)for(let w of A.children){if(!w.isNamed)continue;if(Q.recurse.has(w.type))for(let R of w.children){if(!R.isNamed)continue;T(R,O+1,!1)}}return}}for(let A of X.rootNode.children)T(A,0,!0);return W(),G}function bJ(J,Q){let $=[];for(let Z of J){let X=" ".repeat(Z.depth);$.push(`${X}${Z.startLine}-${Z.endLine}: ${Z.text}`)}return $.push(""),$.push(`(${J.length} symbols, ${Q} source lines)`),$.join(`
44
- `)}function R0(J,Q="collapse"){let $=J.split(`
42
+ `)}import{execFile as L0}from"node:child_process";import{promisify as M0}from"node:util";import{readFile as x0}from"node:fs/promises";import{extname as b0,relative as tQ,resolve as y0}from"node:path";var pQ={grammar:"typescript",outline:new Set(["function_declaration","class_declaration","interface_declaration","type_alias_declaration","enum_declaration","lexical_declaration","variable_declaration","export_statement","method_definition","public_field_definition"]),skip:new Set(["import_statement"]),recurse:new Set(["class_body"]),topLevelOnly:new Set(["expression_statement"])},z0={...pQ,grammar:"tsx"},LJ={grammar:"javascript",outline:new Set(["function_declaration","class_declaration","lexical_declaration","variable_declaration","export_statement","expression_statement","method_definition","field_definition"]),skip:new Set(["import_statement"]),recurse:new Set(["class_body"])},bQ={grammar:"python",outline:new Set(["function_definition","class_definition","decorated_definition","expression_statement"]),skip:new Set(["import_statement","import_from_statement"]),recurse:new Set(["block"]),whitespaceMode:"preserve-indent"},W0={grammar:"go",outline:new Set(["function_declaration","method_declaration","type_declaration","const_declaration","var_declaration"]),skip:new Set(["package_clause","import_declaration"]),recurse:new Set([])},H0={grammar:"rust",outline:new Set(["function_item","struct_item","enum_item","trait_item","impl_item","const_item","static_item","mod_item","type_item","macro_definition"]),skip:new Set(["use_declaration"]),recurse:new Set(["declaration_list"])},j0={grammar:"java",outline:new Set(["class_declaration","interface_declaration","enum_declaration","method_declaration","constructor_declaration","field_declaration"]),skip:new Set(["package_declaration","import_declaration"]),recurse:new Set(["class_body"])},T0={grammar:"ruby",outline:new Set(["method","class","module","assignment","call"]),skip:new Set([]),recurse:new Set(["body_statement"])},_J={grammar:"cpp",outline:new Set(["function_definition","class_specifier","struct_specifier","enum_specifier","namespace_definition","declaration","template_declaration"]),skip:new Set(["preproc_include"]),recurse:new Set(["declaration_list","field_declaration_list"])},yQ={grammar:"c",outline:new Set(["function_definition","struct_specifier","enum_specifier","declaration","type_definition"]),skip:new Set(["preproc_include"]),recurse:new Set([])},F0={grammar:"c_sharp",outline:new Set(["class_declaration","interface_declaration","struct_declaration","enum_declaration","method_declaration","constructor_declaration","property_declaration","namespace_declaration"]),skip:new Set(["using_directive"]),recurse:new Set(["declaration_list"])},gQ={grammar:"kotlin",outline:new Set(["function_declaration","class_declaration","object_declaration","property_declaration"]),skip:new Set(["import_list","package_header"]),recurse:new Set(["class_body"])},A0={grammar:"swift",outline:new Set(["function_declaration","class_declaration","struct_declaration","enum_declaration","protocol_declaration","extension_declaration","property_declaration"]),skip:new Set(["import_declaration"]),recurse:new Set(["class_body"])},O0={grammar:"php",outline:new Set(["function_definition","class_declaration","interface_declaration","trait_declaration","method_declaration","property_declaration"]),skip:new Set(["namespace_use_declaration"]),recurse:new Set(["declaration_list"])},hQ={grammar:"scala",outline:new Set(["function_definition","class_definition","object_definition","trait_definition","val_definition","var_definition","type_definition"]),skip:new Set(["import_declaration"]),recurse:new Set(["template_body"])},fQ={grammar:"elixir",outline:new Set(["call"]),skip:new Set([]),recurse:new Set([])},k0={grammar:"lua",outline:new Set(["function_declaration","local_function","variable_declaration","local_variable_declaration","assignment_statement"]),skip:new Set([]),recurse:new Set([])},D0={grammar:"dart",outline:new Set(["function_signature","class_definition","enum_declaration","mixin_declaration","extension_declaration","type_alias"]),skip:new Set(["import_or_export"]),recurse:new Set(["class_body"])},_0={grammar:"zig",outline:new Set(["TopLevelDecl","VarDecl","FnProto"]),skip:new Set([]),recurse:new Set([])},mQ={grammar:"bash",outline:new Set(["function_definition","variable_assignment"]),skip:new Set([]),recurse:new Set([])},E0={".ts":pQ,".tsx":z0,".js":LJ,".jsx":LJ,".mjs":LJ,".cjs":LJ,".py":bQ,".pyi":bQ,".go":W0,".rs":H0,".java":j0,".c":yQ,".h":yQ,".cpp":_J,".cc":_J,".cxx":_J,".hpp":_J,".hh":_J,".cs":F0,".rb":T0,".php":O0,".kt":gQ,".kts":gQ,".swift":A0,".scala":hQ,".sc":hQ,".ex":fQ,".exs":fQ,".lua":k0,".dart":D0,".zig":_0,".sh":mQ,".bash":mQ};function AJ(J){return E0[J]}var xJ=_$(uQ(),1);import{createRequire as B0}from"node:module";import{resolve as oQ,dirname as nQ}from"node:path";var iQ=B0(import.meta.url),dQ=!1,lQ=new Map;function N0(){let J=iQ.resolve("web-tree-sitter/package.json");return oQ(nQ(J),"tree-sitter.wasm")}async function rQ(){if(dQ)return;let J=new Promise((Q,$)=>setTimeout(()=>$(Error("tree-sitter WASM init timed out after 10 s")),1e4));await Promise.race([xJ.default.init({locateFile:()=>N0()}),J]),dQ=!0}function S0(J){let Q=iQ.resolve("tree-sitter-wasms/package.json");return oQ(nQ(Q),"out",`tree-sitter-${J}.wasm`)}async function R0(J){let Q=lQ.get(J);if(Q)return Q;await rQ();let $=await xJ.default.Language.load(S0(J));return lQ.set(J,$),$}async function sQ(J){await rQ();let Q=new xJ.default,$=await R0(J);return Q.setLanguage($),Q}async function bJ(J,Q,$=1/0){let X=(await sQ(Q.grammar)).parse(J),K=J.split(`
43
+ `),G=[];function U(F){let O=F.startPosition.row,j=F.endPosition.row,k=K[O]?.trimEnd()??"";if(O===j||k.includes("{"))return k.length>200?`${k.slice(0,197)}...`:k;let E=[k.trimEnd()];for(let R=O+1;R<=Math.min(j,O+20);R++){let v=(K[R]??"").trimEnd();if(E.push(v.trim()),v.includes("{"))break}let w=E.join(" ").replace(/\s+/g," ").replace(/\(\s+/g,"(").replace(/,\s*\)/g,")").replace(/\s*\{\s*$/,"");if(w.length>200)w=`${w.slice(0,197)}...`;return w}let q=-1,W=-1,z=0,V="";function H(){if(z===0)return;let F=z===1?`1 ${V}`:`${z} ${V}s`;G.push({startLine:q,endLine:W,depth:0,nodeType:"_skipped",text:`(${F})`}),q=-1,W=-1,z=0,V=""}function A(F){let O=F.startPosition.row+1,j=F.endPosition.row+1,k=F.type.replace(/_/g," ").replace(/ statement$/,"").replace(/ declaration$/,"");if(z===0||k===V){if(z===0)q=O,V=k;W=j,z++}else H(),q=O,W=j,z=1,V=k}function T(F,O,j){if(j&&Q.skip.has(F.type)){A(F);return}if(Q.skip.has(F.type))return;let k=Q.outline.has(F.type),E=Q.topLevelOnly?.has(F.type)??!1;if(E&&!j)return;if(k||E&&j){if(j)H();if(G.push({startLine:F.startPosition.row+1,endLine:F.endPosition.row+1,depth:O,nodeType:F.type,text:U(F)}),O+1<=$)for(let w of F.children){if(!w.isNamed)continue;if(Q.recurse.has(w.type))for(let R of w.children){if(!R.isNamed)continue;T(R,O+1,!1)}}return}}for(let F of X.rootNode.children)T(F,0,!0);return H(),G}function yJ(J,Q){let $=[];for(let Z of J){let X=" ".repeat(Z.depth);$.push(`${X}${Z.startLine}-${Z.endLine}: ${Z.text}`)}return $.push(""),$.push(`(${J.length} symbols, ${Q} source lines)`),$.join(`
44
+ `)}function P0(J,Q="collapse"){let $=J.split(`
45
45
  `);if(Q==="preserve-indent")return $.map((Z)=>Z.replace(/\s+$/,"").replace(/(\S)\s{2,}(\S)/g,"$1 $2")).join(`
46
46
  `);return $.map((Z)=>Z.trim().replace(/\s+/g," ")).join(`
47
- `)}function P0(J){let Q=e;for(let $ of J.split(`
48
- `))Q=$J(Q,SJ($));return Q}async function eJ(J,Q){let $=FJ(Q.startsWith(".")?Q:`.${Q}`);if(!$)return[];let Z=await xJ(J,$),X=J.split(`
49
- `),K=$.whitespaceMode??"collapse";return Z.filter((G)=>G.nodeType!=="_skipped").map((G)=>{let z=X.slice(G.startLine-1,G.endLine),V=z.join(`
50
- `),H=z.length>1?z.slice(1):z,U=R0(H.join(`
51
- `),K);return{name:v0(G.text,G.nodeType),signature:G.text,bodyHash:P0(U),nodeType:G.nodeType,bodyText:V}})}function v0(J,Q){let $=J.match(/(?:function|class|interface|type|enum|const|let|var|def|fn|func|fun|pub\s+fn|async\s+function)\s+(\w+)/);if($)return $[1];let Z=J.match(/^\s*(?:(?:public|private|protected|static|async|export|abstract)\s+)*(\w+)\s*[(<]/);if(Z)return Z[1];let X=J.match(/(\w+)/);return X?X[1]:J.slice(0,40)}function sQ(J,Q){let $={added:[],removed:[],renamed:[],signatureChanged:[],logicChanged:[]},Z=new Map(J.map((q)=>[q.name,q])),X=new Map(Q.map((q)=>[q.name,q])),K=[],G=[],z=[];for(let q of J){let W=X.get(q.name);if(W)K.push({old:q,new:W});else G.push(q)}for(let q of Q)if(!Z.has(q.name))z.push(q);let V=new Map;for(let q of G){let W=V.get(q.bodyHash)??[];W.push(q),V.set(q.bodyHash,W)}let H=new Set,U=new Set;for(let q of z){let W=V.get(q.bodyHash);if(W&&W.length>0){let F=W.shift();$.renamed.push({oldName:F.name,newName:q.name,signature:q.signature}),H.add(F.name),U.add(q.name)}}for(let q of G)if(!H.has(q.name))$.removed.push(q);for(let q of z)if(!U.has(q.name))$.added.push(q);for(let{old:q,new:W}of K)if(q.signature!==W.signature&&q.bodyHash!==W.bodyHash)$.signatureChanged.push({name:q.name,oldSig:q.signature,newSig:W.signature}),$.logicChanged.push({name:q.name,signature:W.signature,oldBody:q.bodyText,newBody:W.bodyText});else if(q.signature!==W.signature)$.signatureChanged.push({name:q.name,oldSig:q.signature,newSig:W.signature});else if(q.bodyHash!==W.bodyHash)$.logicChanged.push({name:q.name,signature:W.signature,oldBody:q.bodyText,newBody:W.bodyText});return $}async function tQ(J){let{compare_against:Q="HEAD",projectDir:$,allowedDirs:Z}=J,X=J.file_paths;if(X.length===1&&X[0]==="*"){if(X=await f0($??process.cwd(),Q),X.length===0)return g("No changed files found.")}let K=[];for(let G of X){let z=await a(G,"Read",$,Z);if(!z.ok){K.push(`## ${G}
47
+ `)}function I0(J){let Q=e;for(let $ of J.split(`
48
+ `))Q=$J(Q,RJ($));return Q}async function JQ(J,Q){let $=AJ(Q.startsWith(".")?Q:`.${Q}`);if(!$)return[];let Z=await bJ(J,$),X=J.split(`
49
+ `),K=$.whitespaceMode??"collapse";return Z.filter((G)=>G.nodeType!=="_skipped").map((G)=>{let U=X.slice(G.startLine-1,G.endLine),q=U.join(`
50
+ `),W=U.length>1?U.slice(1):U,z=P0(W.join(`
51
+ `),K);return{name:v0(G.text,G.nodeType),signature:G.text,bodyHash:I0(z),nodeType:G.nodeType,bodyText:q}})}function v0(J,Q){let $=J.match(/(?:function|class|interface|type|enum|const|let|var|def|fn|func|fun|pub\s+fn|async\s+function)\s+(\w+)/);if($)return $[1];let Z=J.match(/^\s*(?:(?:public|private|protected|static|async|export|abstract)\s+)*(\w+)\s*[(<]/);if(Z)return Z[1];let X=J.match(/(\w+)/);return X?X[1]:J.slice(0,40)}function aQ(J,Q){let $={added:[],removed:[],renamed:[],signatureChanged:[],logicChanged:[]},Z=new Map(J.map((V)=>[V.name,V])),X=new Map(Q.map((V)=>[V.name,V])),K=[],G=[],U=[];for(let V of J){let H=X.get(V.name);if(H)K.push({old:V,new:H});else G.push(V)}for(let V of Q)if(!Z.has(V.name))U.push(V);let q=new Map;for(let V of G){let H=q.get(V.bodyHash)??[];H.push(V),q.set(V.bodyHash,H)}let W=new Set,z=new Set;for(let V of U){let H=q.get(V.bodyHash);if(H&&H.length>0){let A=H.shift();$.renamed.push({oldName:A.name,newName:V.name,signature:V.signature}),W.add(A.name),z.add(V.name)}}for(let V of G)if(!W.has(V.name))$.removed.push(V);for(let V of U)if(!z.has(V.name))$.added.push(V);for(let{old:V,new:H}of K)if(V.signature!==H.signature&&V.bodyHash!==H.bodyHash)$.signatureChanged.push({name:V.name,oldSig:V.signature,newSig:H.signature}),$.logicChanged.push({name:V.name,signature:H.signature,oldBody:V.bodyText,newBody:H.bodyText});else if(V.signature!==H.signature)$.signatureChanged.push({name:V.name,oldSig:V.signature,newSig:H.signature});else if(V.bodyHash!==H.bodyHash)$.logicChanged.push({name:V.name,signature:H.signature,oldBody:V.bodyText,newBody:H.bodyText});return $}async function eQ(J){let{compare_against:Q="HEAD",projectDir:$,allowedDirs:Z}=J,X=J.file_paths;if(X.length===1&&X[0]==="*"){if(X=await m0($??process.cwd(),Q),X.length===0)return g("No changed files found.")}let K=[];for(let G of X){let U=await a(G,"Read",$,Z);if(!U.ok){K.push(`## ${G}
52
52
 
53
- Access denied.`);continue}let{resolvedPath:V}=z,H=x0(V).replace(/^\./,""),U=G.startsWith("/")?aQ($??process.cwd(),V):G,q;try{let j=await M0(V);if(j.includes(0))return v(`"${G}" appears to be a binary file`);q=j.toString("utf-8")}catch{K.push(`## ${U}
53
+ Access denied.`);continue}let{resolvedPath:q}=U,W=b0(q).replace(/^\./,""),z=G.startsWith("/")?tQ($??process.cwd(),q):G,V;try{let j=await x0(q);if(j.includes(0))return I(`"${G}" appears to be a binary file`);V=j.toString("utf-8")}catch{K.push(`## ${z}
54
54
 
55
- File not readable.`);continue}let W=await h0(V,Q,$??process.cwd()),[F,T]=await Promise.all([eJ(W,H),eJ(q,H)]);if(!FJ(`.${H}`)){K.push(`## ${U}
55
+ File not readable.`);continue}let H=await f0(q,Q,$??process.cwd()),[A,T]=await Promise.all([JQ(H,W),JQ(V,W)]);if(!AJ(`.${W}`)){K.push(`## ${z}
56
56
 
57
- File type not supported for semantic diffing.`);continue}let A=sQ(F,T),O=p0(U,A,Q);if(O)K.push(O)}if(K.length===0)return g("No structural changes detected.");return g(K.join(`
57
+ File type not supported for semantic diffing.`);continue}let F=aQ(A,T),O=c0(z,F,Q);if(O)K.push(O)}if(K.length===0)return g("No structural changes detected.");return g(K.join(`
58
58
 
59
- `))}var y0=Object.fromEntries(Object.entries(process.env).filter(([J])=>!J.startsWith("GIT_"))),g0=L0(I0);async function yJ(J,Q){let{stdout:$}=await g0("git",J,{cwd:Q,env:y0,maxBuffer:10485760});return $}async function h0(J,Q,$){try{let Z=(await yJ(["rev-parse","--show-toplevel"],$)).trim(),X=aQ(Z,J).replace(/\\/g,"/");return await yJ(["show",`${Q}:${X}`],$)}catch{return""}}async function f0(J,Q){try{let $=await yJ(["diff","--name-only",Q],J),Z=await yJ(["ls-files","--others","--exclude-standard"],J),X=[...$.trim().split(`
59
+ `))}var g0=Object.fromEntries(Object.entries(process.env).filter(([J])=>!J.startsWith("GIT_"))),h0=M0(L0);async function gJ(J,Q){let{stdout:$}=await h0("git",J,{cwd:Q,env:g0,maxBuffer:10485760});return $}async function f0(J,Q,$){try{let Z=(await gJ(["rev-parse","--show-toplevel"],$)).trim(),X=tQ(Z,J).replace(/\\/g,"/");return await gJ(["show",`${Q}:${X}`],$)}catch{return""}}async function m0(J,Q){try{let $=await gJ(["diff","--name-only",Q],J),Z=await gJ(["ls-files","--others","--exclude-standard"],J),X=[...$.trim().split(`
60
60
  `),...Z.trim().split(`
61
- `)].filter(Boolean).map((K)=>b0(J,K));return[...new Set(X)]}catch{return[]}}var m0=5;function p0(J,Q,$){if(!(Q.added.length+Q.removed.length+Q.renamed.length+Q.signatureChanged.length+Q.logicChanged.length>0))return`## ${J}
61
+ `)].filter(Boolean).map((K)=>y0(J,K));return[...new Set(X)]}catch{return[]}}var p0=5;function c0(J,Q,$){if(!(Q.added.length+Q.removed.length+Q.renamed.length+Q.signatureChanged.length+Q.logicChanged.length>0))return`## ${J}
62
62
 
63
63
  No structural changes.`;let X=[];if(X.push(`## ${J} (vs ${$})`),Q.added.length>0){X.push(`
64
64
  **Added:**`);for(let K of Q.added)X.push(`- \`${K.signature}\``)}if(Q.removed.length>0){X.push(`
65
65
  **Removed:**`);for(let K of Q.removed)X.push(`- \`${K.signature}\``)}if(Q.renamed.length>0){X.push(`
66
66
  **Renamed:**`);for(let K of Q.renamed)X.push(`- \`${K.oldName}\` → \`${K.newName}\``)}if(Q.signatureChanged.length>0){X.push(`
67
67
  **Signature changed:**`);for(let K of Q.signatureChanged)X.push(`- \`${K.name}\`: \`${K.oldSig}\` → \`${K.newSig}\``)}if(Q.logicChanged.length>0){X.push(`
68
- **Logic modified:**`);for(let K of Q.logicChanged){let G=c0(K.oldBody,K.newBody);if(G)X.push(`- \`${K.name}\`:
68
+ **Logic modified:**`);for(let K of Q.logicChanged){let G=u0(K.oldBody,K.newBody);if(G)X.push(`- \`${K.name}\`:
69
69
  ${G}`);else X.push(`- \`${K.name}\``)}}return X.join(`
70
- `)}function c0(J,Q){if(!J||!Q)return null;let $=J.split(`
70
+ `)}function u0(J,Q){if(!J||!Q)return null;let $=J.split(`
71
71
  `),Z=Q.split(`
72
- `),X=$.length,K=Z.length,G=0;while(G<X&&G<K&&$[G]===Z[G])G++;let z=0;while(z<X-G&&z<K-G&&$[X-1-z]===Z[K-1-z])z++;let V=$.slice(G,X-z),H=Z.slice(G,K-z),U=V.length,q=H.length,W=1e6;if(U*q>W)return null;let F=Array.from({length:U+1},()=>Array(q+1).fill(0));for(let w=1;w<=U;w++)for(let R=1;R<=q;R++)if(V[w-1]===H[R-1])F[w][R]=F[w-1][R-1]+1;else F[w][R]=Math.max(F[w-1][R],F[w][R-1]);let T=[],A=[],O=U,j=q;while(O>0||j>0)if(O>0&&j>0&&V[O-1]===H[j-1])O--,j--;else if(j>0&&(O===0||F[O][j-1]>=F[O-1][j]))A.push(H[j-1]),j--;else T.push(V[O-1]),O--;let D=T.length+A.length;if(D===0||D>m0)return null;T.reverse(),A.reverse();let E=[];for(let w of T)E.push(` - ${w.trim()}`);for(let w of A)E.push(` + ${w.trim()}`);return E.join(`
73
- `)}import{readFile as r0}from"node:fs/promises";import{extname as s0}from"node:path";var u0=/^(#{1,6})\s+(.+)$/,d0=/^(`{3,}|~{3,})(\s*(\S+))?/,JQ=/^\|(.+\|)+\s*$/,l0=/^\|[\s:.-]*-+[\s:.-]*(\|[\s:.-]*-+[\s:.-]*)+\|?\s*$/;async function eQ(J){let Q=[],$=0,Z=0,X=-1,K=-1,G=0,z="",V=0,H=0,U="",q=0,W="",F=0,T=0,A=0,O=0,j="",D=null,E=0;function w(){return X>=0?X+1:0}function R(k){if(K>=0)Q[K].endLine=k-1}function I(k,B,N){R(N),X=k-1,K=Q.length,Q.push({startLine:N,endLine:$,depth:k-1,nodeType:`h${k}`,text:`${"#".repeat(k)} ${B}`})}function L(k){let B=k-G+1;Q.push({startLine:G,endLine:k,depth:0,nodeType:"frontmatter",text:`--- (frontmatter, ${B} lines)`})}function h(k){let B=k-H+1,N=z.repeat(3);Q.push({startLine:H,endLine:k,depth:w(),nodeType:"fenced_code",text:U?`${N}${U} (${B} lines)`:`${N} (${B} lines)`})}function f(k){Q.push({startLine:q,endLine:k,depth:w(),nodeType:"table",text:`${J$(W,80)} (${T} rows, ${F} cols)`})}function M(k){let B=k-A+1;if(B<3)return;Q.push({startLine:A,endLine:k,depth:w(),nodeType:"html_comment",text:`<!-- ... --> (${B} lines)`})}function m(k){let B=k-O+1;if(B<3)return;let N=/^>\s*\[!(\w+)]/.exec(j),y=N?`> [!${N[1]}]`:`> ${o0(j,60)}`;Q.push({startLine:O,endLine:k,depth:w(),nodeType:"blockquote",text:`${y} (${B} lines)`})}function o(k,B){if(k===2)h(B);else if(k===3)f(B);else if(k===4)M(B);else if(k===5)m(B)}function P(k,B){switch(Z){case 1:{if(k==="---"||k==="...")L(B),Z=0;return!0}case 2:{let N=k.trimEnd();if(N.length>=V){let y=!0;for(let p=0;p<N.length;p++)if(N[p]!==z){y=!1;break}if(y)h(B),Z=0}return!0}case 3:{if(JQ.test(k))return T++,!0;return f(B-1),Z=0,!1}case 4:{if(k.includes("-->"))M(B),Z=0;return!0}case 5:{if(k.startsWith("> ")||k===">")return!0;return m(B-1),Z=0,!1}case 0:{if(B===1&&k==="---")return Z=1,G=1,!0;let N=d0.exec(k);if(N)return Z=2,z=N[1][0],V=N[1].length,H=B,U=N[3]||"",!0;if(k.includes("<!--")&&!k.includes("-->"))return Z=4,A=B,!0;if(k.startsWith("> ")||k===">")return Z=5,O=B,j=k,!0;let y=u0.exec(k);if(y)return I(y[1].length,y[2].trimEnd(),B),!0;return!0}}}for await(let{lineBytes:k,lineNumber:B}of VJ(J)){$=B;let N=k.toString("utf-8");if(Z!==0){if(D!==null){let b=D,u=E;D=null;let t=P(b,u);while(!t)t=P(b,u)}let p=P(N,B);while(!p)p=P(N,B);continue}if(D!==null){if(JQ.test(D)&&l0.test(N)){Z=3,q=E,W=D.trim(),F=(N.match(/\|/g)||[]).length-1,T=2,D=null;continue}let p=D,b=E;D=null;let u=P(p,b);while(!u)u=P(p,b)}if(Z===0&&JQ.test(N)){D=N,E=B;continue}let y=P(N,B);while(!y)y=P(N,B)}if(D!==null){let k=P(D,E);while(!k)k=P(D,E)}if(o(Z,$),K>=0)Q[K].endLine=$;return{entries:Q,totalLines:$}}function J$(J,Q){return J.length<=Q?J:`${J.slice(0,Q-1)}…`}function o0(J,Q){let $=J.startsWith("> ")?J.slice(2):J.startsWith(">")?J.slice(1):J;return J$($.trimEnd(),Q)}var d={Text:0,TagOpen:1,Comment:2,CData:3,PI:4,DocType:5};async function Q$(J,Q=1/0){let $=[],Z=[],X=0,K=d.Text,G="",z=0;function V(){return Z.length}function H(q,W){if(q.endsWith("/")){let A=q.slice(0,-1).trim(),O=QQ(A),j=V();if(j<=Q)$.push({startLine:z,endLine:W,depth:j,nodeType:"element",text:i0(O,A)});return}if(q.startsWith("/")){let A=QQ(q.slice(1));for(let O=Z.length-1;O>=0;O--)if(Z[O].tagName===A){let j=Z[O];if(Z.length=O,j.depth<=Q)$.push({startLine:j.startLine,endLine:W,depth:j.depth,nodeType:"element",text:j.signature});return}return}let F=QQ(q),T=V();Z.push({tagName:F,depth:T,startLine:z,signature:n0(F,q)})}function U(q,W){if(V()>0)return;let F=q.trim(),T=F.length>200?`${F.slice(0,197)}...`:F;$.push({startLine:z,endLine:W,depth:0,nodeType:"processing_instruction",text:`<?${T}?>`})}for await(let{lineBytes:q,lineNumber:W}of VJ(J,{detectBinary:!0})){X=W;let F=q.toString("utf-8");for(let T=0;T<F.length;T++){let A=F[T];switch(K){case d.Text:if(A==="<"){let O=F.slice(T+1);if(O.startsWith("!--"))K=d.Comment,G="",T+=3;else if(O.startsWith("![CDATA["))K=d.CData,G="",T+=8;else if(O.startsWith("!DOCTYPE")||O.startsWith("!doctype"))K=d.DocType,G="",T+=8;else if(O.startsWith("?"))K=d.PI,G="",z=W,T+=1;else K=d.TagOpen,G="",z=W}break;case d.TagOpen:if(A===">")H(G.trim(),W),K=d.Text,G="";else G+=A;break;case d.PI:if(A==="?"&&T+1<F.length&&F[T+1]===">")U(G,W),K=d.Text,G="",T++;else G+=A;break;case d.Comment:if(A==="-"&&F.slice(T,T+3)==="-->")K=d.Text,G="",T+=2;break;case d.CData:if(A==="]"&&F.slice(T,T+3)==="]]>")K=d.Text,G="",T+=2;break;case d.DocType:{if(A===">")K=d.Text,G="";else if(A==="[")G+=A;break}}}if(K===d.TagOpen||K===d.PI)G+=" "}while(Z.length>0){let q=Z.pop();if(q.depth<=Q)$.push({startLine:q.startLine,endLine:X,depth:q.depth,nodeType:"element",text:q.signature})}return $.sort((q,W)=>q.startLine-W.startLine||q.depth-W.depth),{entries:$,totalLines:X}}function QQ(J){let Q=J.trim(),$=Q.search(/[\s/]/);return $===-1?Q:Q.slice(0,$)}function n0(J,Q){let Z=`<${Q.trim().replace(/\s+/g," ")}>`;return Z.length>200?`<${J} ...>`:Z}function i0(J,Q){let Z=`<${Q.trim().replace(/\s+/g," ")} />`;return Z.length>200?`<${J} ... />`:Z}var a0=new Set([".md",".markdown"]),t0=new Set([".xml",".xsl",".xslt",".xhtml",".svg",".pom",".csproj",".props",".targets",".fxml",".xaml"]),e0=500,_J=new Map;function J8(){if(_J.size<e0)return;let J=_J.keys().next().value;_J.delete(J)}function $Q(J,Q,$,Z){J8(),_J.set(J,{mtimeMs:Q,depth:$,text:Z})}async function Z$(J){let{projectDir:Q,allowedDirs:$}=J,Z=await DJ(J.file_paths,Q);if(Z.length===0)return v("Provide at least one file path in file_paths.");if(Z.length===1)return $$(Z[0],J.depth,Q,$);let X=[],K=0,G=0;for(let H of Z){let U=await $$(H,J.depth,Q,$),q=U.content[0].type==="text"?U.content[0].text:"",W=q.match(/\((\d+) symbols?, (\d+) source lines?\)/);if(W)K+=Number(W[1]),G+=Number(W[2]);let F=Q?.replaceAll("\\","/"),T=F&&H.startsWith(F)?H.slice(F.length+1):H;X.push(`--- ${T.replaceAll("\\","/")} ---
74
- ${q}`)}let z=X.join(`
72
+ `),X=$.length,K=Z.length,G=0;while(G<X&&G<K&&$[G]===Z[G])G++;let U=0;while(U<X-G&&U<K-G&&$[X-1-U]===Z[K-1-U])U++;let q=$.slice(G,X-U),W=Z.slice(G,K-U),z=q.length,V=W.length,H=1e6;if(z*V>H)return null;let A=Array.from({length:z+1},()=>Array(V+1).fill(0));for(let w=1;w<=z;w++)for(let R=1;R<=V;R++)if(q[w-1]===W[R-1])A[w][R]=A[w-1][R-1]+1;else A[w][R]=Math.max(A[w-1][R],A[w][R-1]);let T=[],F=[],O=z,j=V;while(O>0||j>0)if(O>0&&j>0&&q[O-1]===W[j-1])O--,j--;else if(j>0&&(O===0||A[O][j-1]>=A[O-1][j]))F.push(W[j-1]),j--;else T.push(q[O-1]),O--;let k=T.length+F.length;if(k===0||k>p0)return null;T.reverse(),F.reverse();let E=[];for(let w of T)E.push(` - ${w.trim()}`);for(let w of F)E.push(` + ${w.trim()}`);return E.join(`
73
+ `)}import{readFile as s0}from"node:fs/promises";import{extname as a0}from"node:path";var d0=/^(#{1,6})\s+(.+)$/,l0=/^(`{3,}|~{3,})(\s*(\S+))?/,QQ=/^\|(.+\|)+\s*$/,o0=/^\|[\s:.-]*-+[\s:.-]*(\|[\s:.-]*-+[\s:.-]*)+\|?\s*$/;async function J$(J){let Q=[],$=0,Z=0,X=-1,K=-1,G=0,U="",q=0,W=0,z="",V=0,H="",A=0,T=0,F=0,O=0,j="",k=null,E=0;function w(){return X>=0?X+1:0}function R(D){if(K>=0)Q[K].endLine=D-1}function v(D,B,N){R(N),X=D-1,K=Q.length,Q.push({startLine:N,endLine:$,depth:D-1,nodeType:`h${D}`,text:`${"#".repeat(D)} ${B}`})}function L(D){let B=D-G+1;Q.push({startLine:G,endLine:D,depth:0,nodeType:"frontmatter",text:`--- (frontmatter, ${B} lines)`})}function h(D){let B=D-W+1,N=U.repeat(3);Q.push({startLine:W,endLine:D,depth:w(),nodeType:"fenced_code",text:z?`${N}${z} (${B} lines)`:`${N} (${B} lines)`})}function f(D){Q.push({startLine:V,endLine:D,depth:w(),nodeType:"table",text:`${Q$(H,80)} (${T} rows, ${A} cols)`})}function M(D){let B=D-F+1;if(B<3)return;Q.push({startLine:F,endLine:D,depth:w(),nodeType:"html_comment",text:`<!-- ... --> (${B} lines)`})}function m(D){let B=D-O+1;if(B<3)return;let N=/^>\s*\[!(\w+)]/.exec(j),y=N?`> [!${N[1]}]`:`> ${n0(j,60)}`;Q.push({startLine:O,endLine:D,depth:w(),nodeType:"blockquote",text:`${y} (${B} lines)`})}function o(D,B){if(D===2)h(B);else if(D===3)f(B);else if(D===4)M(B);else if(D===5)m(B)}function P(D,B){switch(Z){case 1:{if(D==="---"||D==="...")L(B),Z=0;return!0}case 2:{let N=D.trimEnd();if(N.length>=q){let y=!0;for(let p=0;p<N.length;p++)if(N[p]!==U){y=!1;break}if(y)h(B),Z=0}return!0}case 3:{if(QQ.test(D))return T++,!0;return f(B-1),Z=0,!1}case 4:{if(D.includes("-->"))M(B),Z=0;return!0}case 5:{if(D.startsWith("> ")||D===">")return!0;return m(B-1),Z=0,!1}case 0:{if(B===1&&D==="---")return Z=1,G=1,!0;let N=l0.exec(D);if(N)return Z=2,U=N[1][0],q=N[1].length,W=B,z=N[3]||"",!0;if(D.includes("<!--")&&!D.includes("-->"))return Z=4,F=B,!0;if(D.startsWith("> ")||D===">")return Z=5,O=B,j=D,!0;let y=d0.exec(D);if(y)return v(y[1].length,y[2].trimEnd(),B),!0;return!0}}}for await(let{lineBytes:D,lineNumber:B}of VJ(J)){$=B;let N=D.toString("utf-8");if(Z!==0){if(k!==null){let b=k,u=E;k=null;let t=P(b,u);while(!t)t=P(b,u)}let p=P(N,B);while(!p)p=P(N,B);continue}if(k!==null){if(QQ.test(k)&&o0.test(N)){Z=3,V=E,H=k.trim(),A=(N.match(/\|/g)||[]).length-1,T=2,k=null;continue}let p=k,b=E;k=null;let u=P(p,b);while(!u)u=P(p,b)}if(Z===0&&QQ.test(N)){k=N,E=B;continue}let y=P(N,B);while(!y)y=P(N,B)}if(k!==null){let D=P(k,E);while(!D)D=P(k,E)}if(o(Z,$),K>=0)Q[K].endLine=$;return{entries:Q,totalLines:$}}function Q$(J,Q){return J.length<=Q?J:`${J.slice(0,Q-1)}…`}function n0(J,Q){let $=J.startsWith("> ")?J.slice(2):J.startsWith(">")?J.slice(1):J;return Q$($.trimEnd(),Q)}var d={Text:0,TagOpen:1,Comment:2,CData:3,PI:4,DocType:5};async function $$(J,Q=1/0){let $=[],Z=[],X=0,K=d.Text,G="",U=0;function q(){return Z.length}function W(V,H){if(V.endsWith("/")){let F=V.slice(0,-1).trim(),O=$Q(F),j=q();if(j<=Q)$.push({startLine:U,endLine:H,depth:j,nodeType:"element",text:r0(O,F)});return}if(V.startsWith("/")){let F=$Q(V.slice(1));for(let O=Z.length-1;O>=0;O--)if(Z[O].tagName===F){let j=Z[O];if(Z.length=O,j.depth<=Q)$.push({startLine:j.startLine,endLine:H,depth:j.depth,nodeType:"element",text:j.signature});return}return}let A=$Q(V),T=q();Z.push({tagName:A,depth:T,startLine:U,signature:i0(A,V)})}function z(V,H){if(q()>0)return;let A=V.trim(),T=A.length>200?`${A.slice(0,197)}...`:A;$.push({startLine:U,endLine:H,depth:0,nodeType:"processing_instruction",text:`<?${T}?>`})}for await(let{lineBytes:V,lineNumber:H}of VJ(J,{detectBinary:!0})){X=H;let A=V.toString("utf-8");for(let T=0;T<A.length;T++){let F=A[T];switch(K){case d.Text:if(F==="<"){let O=A.slice(T+1);if(O.startsWith("!--"))K=d.Comment,G="",T+=3;else if(O.startsWith("![CDATA["))K=d.CData,G="",T+=8;else if(O.startsWith("!DOCTYPE")||O.startsWith("!doctype"))K=d.DocType,G="",T+=8;else if(O.startsWith("?"))K=d.PI,G="",U=H,T+=1;else K=d.TagOpen,G="",U=H}break;case d.TagOpen:if(F===">")W(G.trim(),H),K=d.Text,G="";else G+=F;break;case d.PI:if(F==="?"&&T+1<A.length&&A[T+1]===">")z(G,H),K=d.Text,G="",T++;else G+=F;break;case d.Comment:if(F==="-"&&A.slice(T,T+3)==="-->")K=d.Text,G="",T+=2;break;case d.CData:if(F==="]"&&A.slice(T,T+3)==="]]>")K=d.Text,G="",T+=2;break;case d.DocType:{if(F===">")K=d.Text,G="";else if(F==="[")G+=F;break}}}if(K===d.TagOpen||K===d.PI)G+=" "}while(Z.length>0){let V=Z.pop();if(V.depth<=Q)$.push({startLine:V.startLine,endLine:X,depth:V.depth,nodeType:"element",text:V.signature})}return $.sort((V,H)=>V.startLine-H.startLine||V.depth-H.depth),{entries:$,totalLines:X}}function $Q(J){let Q=J.trim(),$=Q.search(/[\s/]/);return $===-1?Q:Q.slice(0,$)}function i0(J,Q){let Z=`<${Q.trim().replace(/\s+/g," ")}>`;return Z.length>200?`<${J} ...>`:Z}function r0(J,Q){let Z=`<${Q.trim().replace(/\s+/g," ")} />`;return Z.length>200?`<${J} ... />`:Z}var t0=new Set([".md",".markdown"]),e0=new Set([".xml",".xsl",".xslt",".xhtml",".svg",".pom",".csproj",".props",".targets",".fxml",".xaml"]),J8=500,EJ=new Map;function Q8(){if(EJ.size<J8)return;let J=EJ.keys().next().value;EJ.delete(J)}function ZQ(J,Q,$,Z){Q8(),EJ.set(J,{mtimeMs:Q,depth:$,text:Z})}async function X$(J){let{projectDir:Q,allowedDirs:$}=J,Z=await DJ(J.file_paths,Q);if(Z.length===0)return I("Provide at least one file path in file_paths.");if(Z.length===1)return Z$(Z[0],J.depth,Q,$);let X=[],K=0,G=0;for(let W of Z){let z=await Z$(W,J.depth,Q,$),V=z.content[0].type==="text"?z.content[0].text:"",H=V.match(/\((\d+) symbols?, (\d+) source lines?\)/);if(H)K+=Number(H[1]),G+=Number(H[2]);X.push(`--- ${WJ(W,Q)} ---
74
+ ${V}`)}let U=X.join(`
75
75
 
76
- `),V=`
77
- (${K} symbols, ${G} source lines across ${Z.length} files)`;return g(z+V)}async function $$(J,Q,$,Z){let X=await a(J,"Read",$,Z);if(!X.ok)return X.error;let{resolvedPath:K,mtimeMs:G}=X,z=_J.get(K);if(z&&z.mtimeMs===G&&z.depth===Q)return g("(outline unchanged)");let V=s0(K).toLowerCase();if(a0.has(V))try{let{entries:W,totalLines:F}=await eQ(K);if(W.length===0)return g(`(no outline entries found in ${F}-line file)`);let T=bJ(W,F);return $Q(K,G,Q,T),g(T)}catch(W){return v(`Markdown outline extraction failed: ${W.message}`)}if(t0.has(V))try{let{entries:W,totalLines:F}=await Q$(K,Q);if(W.length===0)return g(`(no outline entries found in ${F}-line file)`);let T=bJ(W,F);return $Q(K,G,Q,T),g(T)}catch(W){return v(`XML outline extraction failed: ${W.message}`)}let H;try{let W=await r0(K);if(W.includes(0))return v(`"${J}" appears to be a binary file`);H=W.toString("utf-8")}catch(W){return v(`Error reading file: ${W.message}`)}let U=1;for(let W=0;W<H.length;W++)if(H.charCodeAt(W)===10)U++;let q=FJ(V);if(!q)return g(`No outline support for "${V}" files — use trueline_read to read this file directly.`);try{let W=await xJ(H,q,Q);if(W.length===0)return g(`(no outline entries found in ${U}-line file)`);let F=bJ(W,U);return $Q(K,G,Q,F),g(F)}catch(W){return v(`Outline extraction failed: ${W.message}`)}}var Q8=1000;async function X$(J){let{resolvedPath:Q,matchLine:$,contextLines:Z,maxMatches:X}=J,K=[],G=0,z=0,V=Array(Z>0?Z:0),H=0,U=0,q=0,W=null,F=!1,T=0,A=!1;try{let O=await qJ(Q,{detectBinary:!0});for await(let{lineBytes:j,lineNumber:D}of O.lines){if(F){if(T++,T>Q8){A=!0;break}let L=j.toString("utf-8");if($(L))G++;continue}let E=s(j,0,j.length),w=j.toString("utf-8"),R=$(w),I={lineNumber:D,text:w,hash:E,isMatch:R};if(R)G++;if(R&&z<X){if(z++,W===null){if(W=[],H>0){let L=Math.min(H,V.length);for(let h=0;h<L;h++)W.push(V[(U+h)%V.length])}}if(W.push(I),q=Z,z>=X&&q===0)EJ(K,W),W=null,F=!0}else if(q>0&&W!==null){if(W.push(I),q--,q===0&&z>=X)EJ(K,W),W=null,F=!0;else if(q===0)EJ(K,W),W=null,H=0,U=0}else{if(W!==null)EJ(K,W),W=null;if(Z>0)if(H<V.length)V[(U+H)%V.length]=I,H++;else V[U]=I,U=(U+1)%V.length}}}catch(O){if(UJ(O))return{filePath:Q,resolvedPath:Q,matches:[],totalMatches:0,capped:!1,error:"binary file"};throw O}if(W!==null)EJ(K,W);return{filePath:Q,resolvedPath:Q,matches:K,totalMatches:G,capped:A}}function EJ(J,Q){J.push({lines:[...Q],firstLine:Q[0].lineNumber,lastLine:Q[Q.length-1].lineNumber})}async function K$(J){let{resolvedPath:Q,regex:$,contextLines:Z,maxMatches:X,maxMatchLines:K}=J,G=[];try{let O=await qJ(Q,{detectBinary:!0});for await(let{lineBytes:j,lineNumber:D}of O.lines)G.push({lineNumber:D,text:j.toString("utf-8"),bytes:j})}catch(O){if(UJ(O))return{filePath:Q,resolvedPath:Q,matches:[],totalMatches:0,capped:!1,error:"binary file"};throw O}if(G.length===0)return{filePath:Q,resolvedPath:Q,matches:[],totalMatches:0,capped:!1};let z=G.map((O)=>O.text),V=z.join(`
78
- `),H=[],U=0;for(let O of z)H.push(U),U+=O.length+1;let q=[],W=$.flags.includes("g")?$.flags:`${$.flags}g`,F=new RegExp($.source,W);for(;;){let O=F.exec(V);if(O===null)break;if(O[0].length===0){F.lastIndex++;continue}let j=O.index,D=j+O[0].length,E=Y$(H,j),w=Y$(H,D-1);if(w-E+1>K)continue;q.push({startIdx:E,endIdx:w})}let T=q.length,A=[];for(let{startIdx:O,endIdx:j}of q){if(A.length>=X)break;let D=Math.max(0,O-Z),E=Math.min(G.length-1,j+Z),w=[];for(let R=D;R<=E;R++){let I=G[R],L=s(I.bytes,0,I.bytes.length);w.push({lineNumber:I.lineNumber,text:I.text,hash:L,isMatch:R>=O&&R<=j})}A.push({lines:w,firstLine:G[D].lineNumber,lastLine:G[E].lineNumber})}return{filePath:Q,resolvedPath:Q,matches:A,totalMatches:T,capped:!1}}function Y$(J,Q){let $=0,Z=J.length-1;while($<Z){let X=$+Z+1>>>1;if(J[X]<=Q)$=X;else Z=X-1}return $}async function G$(J){let{pattern:Q,projectDir:$,allowedDirs:Z}=J,X=J.context_lines??2,K=J.max_matches??10,G=1e5;if(X<0||X>1e5||!Number.isFinite(X))return v("context_lines must be between 0 and 100000");let z=$8(J),V=await DJ(z,$);if(V.length===0)return v("file_paths must be a non-empty array");let H=K,U=[],q=V.length>1;if(J.multiline){let W=J.max_match_lines??50;if(Q==="")return v("Pattern must not be empty for multiline search");let F;try{F=new RegExp(Q,`s${J.case_insensitive?"i":""}`)}catch{return v(`Invalid regex pattern: "${Q}"`)}for(let T of V){let A=await a(T,"Read",$,Z);if(!A.ok){U.push({filePath:T,resolvedPath:T,matches:[],totalMatches:0,capped:!1,error:A.error.content[0].text});continue}let O=await K$({resolvedPath:A.resolvedPath,regex:F,contextLines:X,maxMatches:H,maxMatchLines:W});O.filePath=T,O.resolvedPath=A.resolvedPath,U.push(O),H=Math.max(0,H-O.matches.length)}}else{if(Q.includes(`
79
- `)||Q.includes("\r"))return v("Pattern contains newlines. trueline_search matches line-by-line, so multiline patterns cannot match. Set multiline=true for patterns spanning multiple lines, or search for a single-line substring instead.");let W=Z8(Q,J.regex||!1,J.case_insensitive||!1);if(!W.ok)return W.error;let F=W.matcher;for(let T of V){let A=await a(T,"Read",$,Z);if(!A.ok){U.push({filePath:T,resolvedPath:T,matches:[],totalMatches:0,capped:!1,error:A.error.content[0].text});continue}let O=await X$({resolvedPath:A.resolvedPath,matchLine:F,contextLines:X,maxMatches:H});O.filePath=T,O.resolvedPath=A.resolvedPath,U.push(O);let j=O.matches.reduce((D,E)=>D+E.lines.filter((w)=>w.isMatch).length,0);H=Math.max(0,H-j)}}return X8(U,V,Q,K,q,J.regex||J.multiline)}function $8(J){if(J.file_paths&&J.file_paths.length>0)return J.file_paths;if(J.file_path)return[J.file_path];return[]}function Z8(J,Q,$){if(Q)try{let Z=new RegExp(J,$?"i":void 0);return{ok:!0,matcher:(X)=>Z.test(X)}}catch{return{ok:!1,error:v(`Invalid regex pattern: "${J}"`)}}if($){let Z=J.toLowerCase();return{ok:!0,matcher:(X)=>X.toLowerCase().includes(Z)}}return{ok:!0,matcher:(Z)=>Z.includes(J)}}function X8(J,Q,$,Z,X,K){let G=J.reduce((U,q)=>U+q.totalMatches,0),z=J.some((U)=>U.capped);if(!X&&J.length===1&&J[0].error)return v(J[0].error);if(G===0){let U=X?`No matches for pattern "${$}" across ${Q.length} files`:`No matches for pattern "${$}" in ${Q[0]}`;if(!K&&/[.*+?^${}()|[\]\\]/.test($))U+=`
76
+ `),q=`
77
+ (${K} symbols, ${G} source lines across ${Z.length} files)`;return g(U+q)}async function Z$(J,Q,$,Z){let X=await a(J,"Read",$,Z);if(!X.ok)return X.error;let{resolvedPath:K,mtimeMs:G}=X,U=EJ.get(K);if(U&&U.mtimeMs===G&&U.depth===Q)return g("(outline unchanged)");let q=a0(K).toLowerCase();if(t0.has(q))try{let{entries:H,totalLines:A}=await J$(K);if(H.length===0)return g(`(no outline entries found in ${A}-line file)`);let T=yJ(H,A);return ZQ(K,G,Q,T),g(T)}catch(H){return I(`Markdown outline extraction failed: ${H.message}`)}if(e0.has(q))try{let{entries:H,totalLines:A}=await $$(K,Q);if(H.length===0)return g(`(no outline entries found in ${A}-line file)`);let T=yJ(H,A);return ZQ(K,G,Q,T),g(T)}catch(H){return I(`XML outline extraction failed: ${H.message}`)}let W;try{let H=await s0(K);if(H.includes(0))return I(`"${J}" appears to be a binary file`);W=H.toString("utf-8")}catch(H){return I(`Error reading file: ${H.message}`)}let z=1;for(let H=0;H<W.length;H++)if(W.charCodeAt(H)===10)z++;let V=AJ(q);if(!V)return g(`No outline support for "${q}" files — use trueline_read to read this file directly.`);try{let H=await bJ(W,V,Q);if(H.length===0)return g(`(no outline entries found in ${z}-line file)`);let A=yJ(H,z);return ZQ(K,G,Q,A),g(A)}catch(H){return I(`Outline extraction failed: ${H.message}`)}}var $8=1000;async function Y$(J){let{resolvedPath:Q,matchLine:$,contextLines:Z,maxMatches:X}=J,K=[],G=0,U=0,q=Array(Z>0?Z:0),W=0,z=0,V=0,H=null,A=!1,T=0,F=!1;try{let O=await qJ(Q,{detectBinary:!0});for await(let{lineBytes:j,lineNumber:k}of O.lines){if(A){if(T++,T>$8){F=!0;break}let L=j.toString("utf-8");if($(L))G++;continue}let E=s(j,0,j.length),w=j.toString("utf-8"),R=$(w),v={lineNumber:k,text:w,hash:E,isMatch:R};if(R)G++;if(R&&U<X){if(U++,H===null){if(H=[],W>0){let L=Math.min(W,q.length);for(let h=0;h<L;h++)H.push(q[(z+h)%q.length])}}if(H.push(v),V=Z,U>=X&&V===0)CJ(K,H),H=null,A=!0}else if(V>0&&H!==null){if(H.push(v),V--,V===0&&U>=X)CJ(K,H),H=null,A=!0;else if(V===0)CJ(K,H),H=null,W=0,z=0}else{if(H!==null)CJ(K,H),H=null;if(Z>0)if(W<q.length)q[(z+W)%q.length]=v,W++;else q[z]=v,z=(z+1)%q.length}}}catch(O){if(UJ(O))return{filePath:Q,resolvedPath:Q,matches:[],totalMatches:0,capped:!1,error:"binary file"};throw O}if(H!==null)CJ(K,H);return{filePath:Q,resolvedPath:Q,matches:K,totalMatches:G,capped:F}}function CJ(J,Q){J.push({lines:[...Q],firstLine:Q[0].lineNumber,lastLine:Q[Q.length-1].lineNumber})}async function G$(J){let{resolvedPath:Q,regex:$,contextLines:Z,maxMatches:X,maxMatchLines:K}=J,G=[];try{let O=await qJ(Q,{detectBinary:!0});for await(let{lineBytes:j,lineNumber:k}of O.lines)G.push({lineNumber:k,text:j.toString("utf-8"),bytes:j})}catch(O){if(UJ(O))return{filePath:Q,resolvedPath:Q,matches:[],totalMatches:0,capped:!1,error:"binary file"};throw O}if(G.length===0)return{filePath:Q,resolvedPath:Q,matches:[],totalMatches:0,capped:!1};let U=G.map((O)=>O.text),q=U.join(`
78
+ `),W=[],z=0;for(let O of U)W.push(z),z+=O.length+1;let V=[],H=$.flags.includes("g")?$.flags:`${$.flags}g`,A=new RegExp($.source,H);for(;;){let O=A.exec(q);if(O===null)break;if(O[0].length===0){A.lastIndex++;continue}let j=O.index,k=j+O[0].length,E=K$(W,j),w=K$(W,k-1);if(w-E+1>K)continue;V.push({startIdx:E,endIdx:w})}let T=V.length,F=[];for(let{startIdx:O,endIdx:j}of V){if(F.length>=X)break;let k=Math.max(0,O-Z),E=Math.min(G.length-1,j+Z),w=[];for(let R=k;R<=E;R++){let v=G[R],L=s(v.bytes,0,v.bytes.length);w.push({lineNumber:v.lineNumber,text:v.text,hash:L,isMatch:R>=O&&R<=j})}F.push({lines:w,firstLine:G[k].lineNumber,lastLine:G[E].lineNumber})}return{filePath:Q,resolvedPath:Q,matches:F,totalMatches:T,capped:!1}}function K$(J,Q){let $=0,Z=J.length-1;while($<Z){let X=$+Z+1>>>1;if(J[X]<=Q)$=X;else Z=X-1}return $}async function V$(J){let{pattern:Q,projectDir:$,allowedDirs:Z}=J,X=J.context_lines??2,K=J.max_matches??10,G=1e5;if(X<0||X>1e5||!Number.isFinite(X))return I("context_lines must be between 0 and 100000");let U=Z8(J),q=await DJ(U,$);if(q.length===0)return I("file_paths must be a non-empty array");let W=K,z=[],V=q.length>1;if(J.multiline){let H=J.max_match_lines??50;if(Q==="")return I("Pattern must not be empty for multiline search");let A;try{A=new RegExp(Q,`s${J.case_insensitive?"i":""}`)}catch{return I(`Invalid regex pattern: "${Q}"`)}for(let T of q){let F=await a(T,"Read",$,Z);if(!F.ok){z.push({filePath:T,resolvedPath:T,matches:[],totalMatches:0,capped:!1,error:F.error.content[0].text});continue}let O=await G$({resolvedPath:F.resolvedPath,regex:A,contextLines:X,maxMatches:W,maxMatchLines:H});O.filePath=T,O.resolvedPath=F.resolvedPath,z.push(O),W=Math.max(0,W-O.matches.length)}}else{if(Q.includes(`
79
+ `)||Q.includes("\r"))return I("Pattern contains newlines. trueline_search matches line-by-line, so multiline patterns cannot match. Set multiline=true for patterns spanning multiple lines, or search for a single-line substring instead.");let H=X8(Q,J.regex||!1,J.case_insensitive||!1);if(!H.ok)return H.error;let A=H.matcher;for(let T of q){let F=await a(T,"Read",$,Z);if(!F.ok){z.push({filePath:T,resolvedPath:T,matches:[],totalMatches:0,capped:!1,error:F.error.content[0].text});continue}let O=await Y$({resolvedPath:F.resolvedPath,matchLine:A,contextLines:X,maxMatches:W});O.filePath=T,O.resolvedPath=F.resolvedPath,z.push(O);let j=O.matches.reduce((k,E)=>k+E.lines.filter((w)=>w.isMatch).length,0);W=Math.max(0,W-j)}}return Y8(z,q,Q,K,V,$,J.regex||J.multiline)}function Z8(J){if(J.file_paths&&J.file_paths.length>0)return J.file_paths;if(J.file_path)return[J.file_path];return[]}function X8(J,Q,$){if(Q)try{let Z=new RegExp(J,$?"i":void 0);return{ok:!0,matcher:(X)=>Z.test(X)}}catch{return{ok:!1,error:I(`Invalid regex pattern: "${J}"`)}}if($){let Z=J.toLowerCase();return{ok:!0,matcher:(X)=>X.toLowerCase().includes(Z)}}return{ok:!0,matcher:(Z)=>Z.includes(J)}}function Y8(J,Q,$,Z,X,K,G){let U=J.reduce((V,H)=>V+H.totalMatches,0),q=J.some((V)=>V.capped);if(!X&&J.length===1&&J[0].error)return I(J[0].error);if(U===0){let V=X?`No matches for pattern "${$}" across ${Q.length} files`:`No matches for pattern "${$}" in ${WJ(Q[0],K)}`;if(!G&&/[.*+?^${}()|[\]\\]/.test($))V+=`
80
80
 
81
- (hint: pattern contains regex metacharacters but was searched literally — add regex=true for regex matching)`;return g(U)}let V=[],H=0;for(let U of J){if(U.error){if(X)V.push(`--- ${U.filePath.replaceAll("\\","/")} ---`),V.push(`error: ${U.error}`),V.push("");continue}if(U.matches.length===0)continue;if(X){if(V.length>0)V.push("");V.push(`--- ${U.filePath.replaceAll("\\","/")} ---`)}for(let q=0;q<U.matches.length;q++){let W=U.matches[q],F=e;if(!X&&q>0)V.push("");for(let O of W.lines){let j=XJ(O.hash);F=$J(F,O.hash);let D=O.isMatch&&H<Z?" ← match":"";if(O.isMatch&&D!=="")H++;V.push(`${j}.${O.lineNumber} ${O.text}${D}`)}let T=F.toString(16).padStart(8,"0"),A=YJ(U.resolvedPath,W.firstLine,W.lastLine,T);V.push(""),V.push(`ref:${A}`)}}if(G>Z){V.push("");let U=z?`${G}+`:`${G}`,q=X?` across ${Q.length} files`:"";V.push(`(showing ${Z} of ${U} matches${q} — increase max_matches to see more)`)}return g(V.join(`
82
- `))}async function V$(J){let{refs:Q,projectDir:$,allowedDirs:Z}=J;if(!Q||Q.length===0)return v("No refs provided");let X=new Map;for(let z of Q){let V;try{V=RJ(z)}catch(W){return v(W.message)}let H=await a(V.filePath,"Read",$,Z);if(!H.ok)return H.error;let U={refId:z,filePath:H.resolvedPath,startLine:V.startLine,endLine:V.endLine,expected:V.hash,hash:e},q=X.get(H.resolvedPath);if(q)q.push(U);else X.set(H.resolvedPath,[U])}let K=[],G=!0;for(let[z,V]of X){V.sort((U,q)=>U.startLine-q.startLine);let H=0;try{let U=0;for await(let{lineBytes:q,lineNumber:W}of VJ(z,{detectBinary:!0})){H=W;while(U<V.length&&V[U].startLine===0)U++;if(U>=V.length)break;if(W<V[U].startLine)continue;while(U<V.length&&V[U].startLine>0&&W>V[U].endLine)U++;if(U>=V.length)break;if(V[U].startLine>0&&W<V[U].startLine)continue;let F=s(q,0,q.length);for(let T=U;T<V.length&&V[T].startLine<=W;T++)if(V[T].startLine>0&&W<=V[T].endLine)V[T].hash=$J(V[T].hash,F)}}catch(U){if(UJ(U))return PJ(V[0].filePath);throw U}for(let U of V){if(U.startLine===0&&U.endLine===0){if(H===0&&U.expected==="00000000")K.push(`valid: ${U.refId}`);else G=!1,K.push(`stale: ${U.refId} (file now has ${H} lines)`);continue}if(U.startLine>H||U.endLine>H){G=!1,K.push(`stale: ${U.refId} (range past EOF, file has ${H} lines)`);continue}if(U.hash.toString(16).padStart(8,"0")===U.expected)K.push(`valid: ${U.refId}`);else G=!1,K.push(`stale: ${U.refId} (lines ${U.startLine}-${U.endLine} changed)`)}}if(G)return g("all refs valid");return g(K.join(`
83
- `))}var q$=new Set(["read","edit","outline","search","diff","verify"]);class gJ{text;constructor(J){this.text=J}}var K8=`trueline <command> [options]
81
+ (hint: pattern contains regex metacharacters but was searched literally — add regex=true for regex matching)`;return g(V)}let W=[],z=0;for(let V of J){if(V.error){if(X)W.push(`--- ${WJ(V.filePath,K)} ---`),W.push(`error: ${V.error}`),W.push("");continue}if(V.matches.length===0)continue;if(X){if(W.length>0)W.push("");W.push(`--- ${WJ(V.filePath,K)} ---`)}for(let H=0;H<V.matches.length;H++){let A=V.matches[H],T=e;if(!X&&H>0)W.push("");for(let j of A.lines){let k=XJ(j.hash);T=$J(T,j.hash);let E=j.isMatch&&z<Z?" ← match":"";if(j.isMatch&&E!=="")z++;W.push(`${k}.${j.lineNumber} ${j.text}${E}`)}let F=T.toString(16).padStart(8,"0"),O=YJ(V.resolvedPath,A.firstLine,A.lastLine,F);W.push(""),W.push(`ref:${O}`)}}if(U>Z){W.push("");let V=q?`${U}+`:`${U}`,H=X?` across ${Q.length} files`:"";W.push(`(showing ${Z} of ${V} matches${H} — increase max_matches to see more)`)}return g(W.join(`
82
+ `))}async function q$(J){let{refs:Q,projectDir:$,allowedDirs:Z}=J;if(!Q||Q.length===0)return I("No refs provided");let X=new Map;for(let U of Q){let q;try{q=PJ(U)}catch(H){return I(H.message)}let W=await a(q.filePath,"Read",$,Z);if(!W.ok)return W.error;let z={refId:U,filePath:W.resolvedPath,startLine:q.startLine,endLine:q.endLine,expected:q.hash,hash:e},V=X.get(W.resolvedPath);if(V)V.push(z);else X.set(W.resolvedPath,[z])}let K=[],G=!0;for(let[U,q]of X){q.sort((z,V)=>z.startLine-V.startLine);let W=0;try{let z=0;for await(let{lineBytes:V,lineNumber:H}of VJ(U,{detectBinary:!0})){W=H;while(z<q.length&&q[z].startLine===0)z++;if(z>=q.length)break;if(H<q[z].startLine)continue;while(z<q.length&&q[z].startLine>0&&H>q[z].endLine)z++;if(z>=q.length)break;if(q[z].startLine>0&&H<q[z].startLine)continue;let A=s(V,0,V.length);for(let T=z;T<q.length&&q[T].startLine<=H;T++)if(q[T].startLine>0&&H<=q[T].endLine)q[T].hash=$J(q[T].hash,A)}}catch(z){if(UJ(z))return IJ(q[0].filePath);throw z}for(let z of q){if(z.startLine===0&&z.endLine===0){if(W===0&&z.expected==="00000000")K.push(`valid: ${z.refId}`);else G=!1,K.push(`stale: ${z.refId} (file now has ${W} lines)`);continue}if(z.startLine>W||z.endLine>W){G=!1,K.push(`stale: ${z.refId} (range past EOF, file has ${W} lines)`);continue}if(z.hash.toString(16).padStart(8,"0")===z.expected)K.push(`valid: ${z.refId}`);else G=!1,K.push(`stale: ${z.refId} (lines ${z.startLine}-${z.endLine} changed)`)}}if(G)return g("all refs valid");return g(K.join(`
83
+ `))}var U$=new Set(["read","edit","outline","search","diff","verify"]);class hJ{text;constructor(J){this.text=J}}var G8=`trueline <command> [options]
84
84
 
85
85
  Hash-verified file operations for AI coding agents.
86
86
 
@@ -92,7 +92,7 @@ Commands:
92
92
  diff Semantic AST-based diff vs a git ref
93
93
  verify Check if held refs are still valid
94
94
 
95
- Run trueline <command> --help for command-specific usage.`,G8={read:`trueline read <file> [options]
95
+ Run trueline <command> --help for command-specific usage.`,V8={read:`trueline read <file> [options]
96
96
 
97
97
  Read a file with per-line hashes and refs.
98
98
 
@@ -139,9 +139,9 @@ Check if held refs are still valid.
139
139
 
140
140
  Options:
141
141
  --refs <ref...> Refs to verify (required)
142
- Also accepts --checksums for backwards compatibility`};function V8(J){let[Q,...$]=J;if(!Q||Q==="--help"||Q==="-h")return new gJ(K8);if(!q$.has(Q))throw Error(`Unknown command: ${Q}. Available: ${[...q$].join(", ")}`);if($.includes("--help")||$.includes("-h"))return new gJ(G8[Q]);switch(Q){case"read":return{command:Q,params:q8($)};case"edit":return{command:Q,params:U8($)};case"outline":return{command:Q,params:z8($)};case"search":return{command:Q,params:W8($)};case"diff":return{command:Q,params:H8($)};case"verify":return{command:Q,params:j8($)};default:throw Error(`Unknown command: ${Q}`)}}function WJ(J,Q,$){if(Q>=J.length)throw Error(`Missing value for ${$}`);return J[Q]}function z$(J,Q){let $=[],Z=Q;while(Z<J.length&&!J[Z].startsWith("--"))$.push(J[Z]),Z++;return{values:$,nextIndex:Z}}function q8(J){if(J.length===0||J[0].startsWith("--"))throw Error("read requires a file path");let Q={file_path:J[0]},$=1;while($<J.length)switch(J[$]){case"--ranges":{$++;let{values:Z,nextIndex:X}=z$(J,$);if(Z.length===0)throw Error("--ranges requires at least one value");Q.ranges=Z,$=X;break}case"--encoding":$++,Q.encoding=WJ(J,$,"--encoding"),$++;break;case"--no-hashes":Q.hashes=!1,$++;break;default:throw Error(`Unknown flag for read: ${J[$]}`)}return Q}function U8(J){if(J.length===0||J[0].startsWith("--"))throw Error("edit requires a file path");let Q={file_path:J[0]},$=1;while($<J.length)switch(J[$]){case"--edits":$++,Q.edits=JSON.parse(WJ(J,$,"--edits")),$++;break;case"--encoding":$++,Q.encoding=WJ(J,$,"--encoding"),$++;break;case"--dry-run":Q.dry_run=!0,$++;break;default:throw Error(`Unknown flag for edit: ${J[$]}`)}if(!Q.edits)throw Error("edit requires --edits '<json array>'");return Q}function z8(J){let Q=[],$={},Z=0;while(Z<J.length&&!J[Z].startsWith("--"))Q.push(J[Z]),Z++;if(Q.length===0)throw Error("outline requires at least one file path");$.file_paths=Q;while(Z<J.length)switch(J[Z]){case"--depth":Z++,$.depth=Number.parseInt(WJ(J,Z,"--depth"),10),Z++;break;default:throw Error(`Unknown flag for outline: ${J[Z]}`)}return $}function W8(J){if(J.length===0||J[0].startsWith("--"))throw Error("search requires a file path");if(J.length<2||J[1].startsWith("--"))throw Error("search requires a pattern");let Q={file_path:J[0],pattern:J[1]},$=2;while($<J.length)switch(J[$]){case"--context":$++,Q.context_lines=Number.parseInt(WJ(J,$,"--context"),10),$++;break;case"--max-matches":$++,Q.max_matches=Number.parseInt(WJ(J,$,"--max-matches"),10),$++;break;case"--case-insensitive":Q.case_insensitive=!0,$++;break;case"--regex":Q.regex=!0,$++;break;default:throw Error(`Unknown flag for search: ${J[$]}`)}return Q}function H8(J){let Q=[],$={},Z=0;while(Z<J.length&&!J[Z].startsWith("--"))Q.push(J[Z]),Z++;$.file_paths=Q.length>0?Q:["*"];while(Z<J.length)switch(J[Z]){case"--ref":Z++,$.compare_against=WJ(J,Z,"--ref"),Z++;break;default:throw Error(`Unknown flag for diff: ${J[Z]}`)}return $}function j8(J){if(J.length===0||J[0].startsWith("--"))throw Error("verify requires a file path");let Q={file_path:J[0]},$=1;while($<J.length)switch(J[$]){case"--checksums":case"--refs":{$++;let{values:Z,nextIndex:X}=z$(J,$);if(Z.length===0)throw Error("--refs requires at least one value");Q.refs=Z,$=X;break}default:throw Error(`Unknown flag for verify: ${J[$]}`)}if(!Q.refs)throw Error("verify requires --refs");return Q}function T8(J,Q){return{read:($)=>LQ({...$,projectDir:J,allowedDirs:Q}),edit:($)=>MQ({...$,projectDir:J,allowedDirs:Q}),diff:($)=>tQ({...$,projectDir:J,allowedDirs:Q}),outline:($)=>Z$({...$,projectDir:J,allowedDirs:Q}),search:($)=>G$({...$,projectDir:J,allowedDirs:Q}),verify:($)=>V$({...$,projectDir:J,allowedDirs:Q})}}async function F8(J){let Q=[J],$=process.env.TRUELINE_ALLOWED_DIRS;if($)for(let Z of $.split(Y8).filter(Boolean)){let X=Z.trim();if(X)Q.push(await U$(X).catch(()=>X))}return Q}async function A8(J=process.argv.slice(2)){let Q=V8(J);if(Q instanceof gJ){process.stdout.write(Q.text),process.stdout.write(`
143
- `);return}let $=process.env.CLAUDE_PROJECT_DIR??process.cwd(),Z=await U$($).catch(()=>$),X=await F8(Z),G=T8(Z,X)[Q.command],z=await G(Q.params);if(z.isError)process.stderr.write(typeof z.content==="string"?z.content:JSON.stringify(z.content)),process.stderr.write(`
144
- `),process.exitCode=1;else{let V=typeof z.content==="string"?z.content:Array.isArray(z.content)?z.content.map((H)=>H.text??"").join(""):JSON.stringify(z.content);if(process.stdout.write(V),!V.endsWith(`
142
+ Also accepts --checksums for backwards compatibility`};function q8(J){let[Q,...$]=J;if(!Q||Q==="--help"||Q==="-h")return new hJ(G8);if(!U$.has(Q))throw Error(`Unknown command: ${Q}. Available: ${[...U$].join(", ")}`);if($.includes("--help")||$.includes("-h"))return new hJ(V8[Q]);switch(Q){case"read":return{command:Q,params:U8($)};case"edit":return{command:Q,params:z8($)};case"outline":return{command:Q,params:W8($)};case"search":return{command:Q,params:H8($)};case"diff":return{command:Q,params:j8($)};case"verify":return{command:Q,params:T8($)};default:throw Error(`Unknown command: ${Q}`)}}function HJ(J,Q,$){if(Q>=J.length)throw Error(`Missing value for ${$}`);return J[Q]}function W$(J,Q){let $=[],Z=Q;while(Z<J.length&&!J[Z].startsWith("--"))$.push(J[Z]),Z++;return{values:$,nextIndex:Z}}function U8(J){if(J.length===0||J[0].startsWith("--"))throw Error("read requires a file path");let Q={file_path:J[0]},$=1;while($<J.length)switch(J[$]){case"--ranges":{$++;let{values:Z,nextIndex:X}=W$(J,$);if(Z.length===0)throw Error("--ranges requires at least one value");Q.ranges=Z,$=X;break}case"--encoding":$++,Q.encoding=HJ(J,$,"--encoding"),$++;break;case"--no-hashes":Q.hashes=!1,$++;break;default:throw Error(`Unknown flag for read: ${J[$]}`)}return Q}function z8(J){if(J.length===0||J[0].startsWith("--"))throw Error("edit requires a file path");let Q={file_path:J[0]},$=1;while($<J.length)switch(J[$]){case"--edits":$++,Q.edits=JSON.parse(HJ(J,$,"--edits")),$++;break;case"--encoding":$++,Q.encoding=HJ(J,$,"--encoding"),$++;break;case"--dry-run":Q.dry_run=!0,$++;break;default:throw Error(`Unknown flag for edit: ${J[$]}`)}if(!Q.edits)throw Error("edit requires --edits '<json array>'");return Q}function W8(J){let Q=[],$={},Z=0;while(Z<J.length&&!J[Z].startsWith("--"))Q.push(J[Z]),Z++;if(Q.length===0)throw Error("outline requires at least one file path");$.file_paths=Q;while(Z<J.length)switch(J[Z]){case"--depth":Z++,$.depth=Number.parseInt(HJ(J,Z,"--depth"),10),Z++;break;default:throw Error(`Unknown flag for outline: ${J[Z]}`)}return $}function H8(J){if(J.length===0||J[0].startsWith("--"))throw Error("search requires a file path");if(J.length<2||J[1].startsWith("--"))throw Error("search requires a pattern");let Q={file_path:J[0],pattern:J[1]},$=2;while($<J.length)switch(J[$]){case"--context":$++,Q.context_lines=Number.parseInt(HJ(J,$,"--context"),10),$++;break;case"--max-matches":$++,Q.max_matches=Number.parseInt(HJ(J,$,"--max-matches"),10),$++;break;case"--case-insensitive":Q.case_insensitive=!0,$++;break;case"--regex":Q.regex=!0,$++;break;default:throw Error(`Unknown flag for search: ${J[$]}`)}return Q}function j8(J){let Q=[],$={},Z=0;while(Z<J.length&&!J[Z].startsWith("--"))Q.push(J[Z]),Z++;$.file_paths=Q.length>0?Q:["*"];while(Z<J.length)switch(J[Z]){case"--ref":Z++,$.compare_against=HJ(J,Z,"--ref"),Z++;break;default:throw Error(`Unknown flag for diff: ${J[Z]}`)}return $}function T8(J){if(J.length===0||J[0].startsWith("--"))throw Error("verify requires a file path");let Q={file_path:J[0]},$=1;while($<J.length)switch(J[$]){case"--checksums":case"--refs":{$++;let{values:Z,nextIndex:X}=W$(J,$);if(Z.length===0)throw Error("--refs requires at least one value");Q.refs=Z,$=X;break}default:throw Error(`Unknown flag for verify: ${J[$]}`)}if(!Q.refs)throw Error("verify requires --refs");return Q}function F8(J,Q){return{read:($)=>MQ({...$,projectDir:J,allowedDirs:Q}),edit:($)=>xQ({...$,projectDir:J,allowedDirs:Q}),diff:($)=>eQ({...$,projectDir:J,allowedDirs:Q}),outline:($)=>X$({...$,projectDir:J,allowedDirs:Q}),search:($)=>V$({...$,projectDir:J,allowedDirs:Q}),verify:($)=>q$({...$,projectDir:J,allowedDirs:Q})}}async function A8(J){let Q=[J],$=process.env.TRUELINE_ALLOWED_DIRS;if($)for(let Z of $.split(K8).filter(Boolean)){let X=Z.trim();if(X)Q.push(await z$(X).catch(()=>X))}return Q}async function O8(J=process.argv.slice(2)){let Q=q8(J);if(Q instanceof hJ){process.stdout.write(Q.text),process.stdout.write(`
143
+ `);return}let $=process.env.CLAUDE_PROJECT_DIR??process.cwd(),Z=await z$($).catch(()=>$),X=await A8(Z),G=F8(Z,X)[Q.command],U=await G(Q.params);if(U.isError)process.stderr.write(typeof U.content==="string"?U.content:JSON.stringify(U.content)),process.stderr.write(`
144
+ `),process.exitCode=1;else{let q=typeof U.content==="string"?U.content:Array.isArray(U.content)?U.content.map((W)=>W.text??"").join(""):JSON.stringify(U.content);if(process.stdout.write(q),!q.endsWith(`
145
145
  `))process.stdout.write(`
146
- `)}}var O8=process.argv[1]?.endsWith("cli.ts")||process.argv[1]?.endsWith("cli.js");if(O8)A8().catch((J)=>{process.stderr.write(`trueline: ${J.message}
147
- `),process.exitCode=1});export{V8 as parseArgs,A8 as main,gJ as HelpRequested};
146
+ `)}}var k8=process.argv[1]?.endsWith("cli.ts")||process.argv[1]?.endsWith("cli.js");if(k8)O8().catch((J)=>{process.stderr.write(`trueline: ${J.message}
147
+ `),process.exitCode=1});export{q8 as parseArgs,O8 as main,hJ as HelpRequested};