docuvia 1.8.2 → 1.8.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.
@@ -1,3 +1,3 @@
1
1
  import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
- import{c,d as a,e as y,f as _,h as T}from"./chunk-S2YRTHLD.js";import{ca as P,d as L,fa as E}from"./chunk-H24ZJ4BD.js";import"./chunk-KVOCOCYJ.js";import{parentPort as N}from"worker_threads";import{Parser as w,Language as U}from"web-tree-sitter";import*as O from"path";import*as D from"fs";import{createHash as H}from"crypto";function h(e){return H(P).update(e.text).digest("hex")}var x=new L(e=>N?.postMessage(e));process.on("uncaughtException",e=>{x.error(a.WORKER_UNCAUGHT_EXCEPTION,{error:e instanceof Error?e.message:String(e)})});process.on("unhandledRejection",e=>{x.error(a.WORKER_UNHANDLED_REJECTION,{error:e instanceof Error?e.message:String(e)})});var S=!1,b=null;function G(){return b??=_(),b}var C=new Map;function K(e){let t=C.get(e);return t||(t=U.load(e),C.set(e,t)),t}function Y(e){let t=[],n=e.matchAll(/import\s+{([^}]+)}\s+from\s+['"]([^'"]+)['"]/g);for(let r of n)t.push({localName:r[1].trim(),originalName:r[1].trim(),modulePath:r[2]});return t}function F(e){return e.childForFieldName("name")?.text||e.descendantsOfType("identifier")[0]?.text||a.ANONYMOUS_NAME}function Q(e){let t=e.childForFieldName("declarator")?.childForFieldName("declarator");if(t)return t.type===c.QUALIFIED_IDENTIFIER?t.childForFieldName("name")?.text??a.ANONYMOUS_NAME:t.text}function V(e){let t=e.childForFieldName("name");if(t)return t.text;let n=Q(e);if(n)return n;let r=new Set([c.VARIABLE_DECLARATOR,c.ASSIGNMENT_EXPRESSION,c.PAIR,c.PUBLIC_FIELD_DEFINITION]),o=e.parent;for(;o&&o.type!==c.ARGUMENTS;){if(r.has(o.type)){let s=o.childForFieldName("name")||o.childForFieldName("key")||o.childForFieldName("left");if(s)return s.text}o=o.parent}return a.ANONYMOUS_NAME}function W(e){return e.childForFieldName("function")||e.childForFieldName("expression")||e.childForFieldName("type")||e.childForFieldName("name")||e.childForFieldName("method")||e}function J(e){let t=W(e),n=t.namedChildren,r=n[n.length-1],o=n.length>=2?n[n.length-2]:void 0;if(!r||!o)return{targetFunction:f(t.text),calleeName:t.text,calleeKind:"bare"};if(!j.has(r.type))return{targetFunction:f(t.text),calleeKind:"computed"};let s=r.text,i=o.text;return i.includes("(")?{targetFunction:f(t.text),calleeName:s,receiverText:i,calleeKind:"arg-chain"}:{targetFunction:f(t.text),calleeName:s,receiverText:i,calleeKind:i==="this"||i==="super"?"this":"member"}}function f(e){return e.replace(/\s+/g,"")}var j=new Set(["identifier","property_identifier","field_identifier","shorthand_property_identifier","attribute"]);function B(e){return((e.childForFieldName("property")||e.childForFieldName("field")||e.childForFieldName("attribute")||e.childForFieldName("name")||e.childForFieldName("method"))??e).startPosition}function g(e,t){let n=e.parent;for(;n;){if(t.has(n.id))return F(n);n=n.parent}return a.ANONYMOUS_NAME}function v(e){return e.type===c.TYPE_IDENTIFIER?e.text:e.descendantsOfType(c.TYPE_IDENTIFIER)[0]?.text}function X(e){let t=e.parent;for(;t;){if(t.type===c.IMPL_ITEM){let n=t.childForFieldName("type");return n?v(n):void 0}t=t.parent}}function z(e){let n=e.childForFieldName("receiver")?.namedChild(0)?.childForFieldName("type");return n?v(n):void 0}function Z(e){let n=e.childForFieldName("declarator")?.childForFieldName("declarator");if(n?.type!==c.QUALIFIED_IDENTIFIER)return;let r=n.childForFieldName("scope");if(r)return r.type===c.QUALIFIED_IDENTIFIER?r.childForFieldName("name")?.text:r.text}function $(e){return X(e)??z(e)??Z(e)}function q(e,t,n){let r=t.extractClasses(e.rootNode);for(let o of r)n.push({name:F(o),startLine:o.startPosition.row,endLine:o.endPosition.row,methods:[],contentHash:h(o)});return r}var ee=new Set(["arrow_function","function_expression"]);function te(e,t,n){let r=t.extractVariables?.(e.rootNode)??[];for(let o of r){let s=o.childForFieldName("value");s&&ee.has(s.type)||n.push({name:F(o),startLine:o.startPosition.row,endLine:o.endPosition.row,contentHash:h(o)})}return r}function ne(e,t,n,r){let o=new Set(r.map(i=>i.id)),s=t.extractFunctions(e.rootNode);for(let i of s){let d=g(i,o),l=d===a.ANONYMOUS_NAME?$(i):d;n.push({name:V(i),startLine:i.startPosition.row,endLine:i.endPosition.row,contentHash:h(i),containerName:l})}return s}function re(e,t,n,r){let o=new Set(n.map(i=>i.id)),s=t.extractCalls(e.rootNode);for(let i of s){if(r.length>=1e3)break;let d=B(i),l=J(i);r.push({sourceFunction:g(i,o),targetFunction:l.targetFunction,startLine:d.row,startColumn:d.column,calleeName:l.calleeName,receiverText:l.receiverText,calleeKind:l.calleeKind})}}function oe(e,t,n,r){if(!t.extractImplements)return;let o=new Set(n.map(s=>s.id));for(let s of t.extractImplements(e.rootNode))r.push({sourceClass:g(s,o),targetInterface:s.text})}function se(e,t,n,r){if(!t.extractExtends)return;let o=new Set(n.map(s=>s.id));for(let s of t.extractExtends(e.rootNode))r.push({sourceClass:g(s,o),targetClass:s.text})}var ie=new Set([E.TYPESCRIPT,E.JAVASCRIPT]),ae="Worker",ce="path",le="resolve",de="join",ue="__dirname";function me(e){if(e.type!=="call_expression")return!1;let t=e.childForFieldName("function");if(!t||t.type!=="member_expression")return!1;let n=t.childForFieldName("object")?.text,r=t.childForFieldName("property")?.text;return n===ce&&(r===le||r===de)}function ge(e){let t=e.childForFieldName("arguments");return!t||!t.namedChildren.some(o=>o?.type==="identifier"&&o.text===ue)?void 0:t.descendantsOfType("string")[0]?.text.replace(/['"]/g,"")}function pe(e,t){for(let n of e.rootNode.descendantsOfType(c.ASSIGNMENT_EXPRESSION)){if(!n)continue;let r=n.childForFieldName("left"),o=n.childForFieldName("right");if(r?.text!==t||!o||!me(o))continue;let s=ge(o);if(s)return s}}function fe(e,t){if(t.type==="string")return t.text.replace(/['"]/g,"");if(t.type==="identifier"||t.type==="member_expression")return pe(e,t.text)}function Ne(e,t,n,r){if(!ie.has(t))return;let o=new Set(n.map(s=>s.id));for(let s of e.rootNode.descendantsOfType("new_expression")){if(!s||s.childForFieldName("constructor")?.text!==ae)continue;let l=s.childForFieldName("arguments")?.namedChildren.find(p=>p!==null);if(!l)continue;let m=fe(e,l);m&&r.push({sourceFunction:g(s,o),targetPath:m})}}function Ee(e,t,n){let r=[],o=[],s=[],i=[],d=[],l=[],m=[],p=[],A=[],I=[];if(e){r.push(a.parsedViaTreeSitter(e.rootNode.childCount));try{let u=q(e,t,d),R=ne(e,t,i,u),M=t.extractImports(e.rootNode);o.push(...y(M)),te(e,t,l),re(e,t,R,m),oe(e,t,u,p),se(e,t,u,A),Ne(e,n,R,I),r.push(a.QUERIED_VIA_LANGUAGE_PROVIDER)}catch(u){r.push(a.providerQueryFailed(u instanceof Error?u.message:String(u)))}}return{imports:o,exports:s,functions:i,classes:d,variables:l,calls:m,implements:p,extends:A,workerSpawns:I,decisions:r}}function he(e,t){for(let n of e.drainQueryCompileFailures?.()??[])x.error(a.QUERY_COMPILE_FAILED,{language:t,kind:n.kind,pattern:n.pattern,message:n.message})}function xe(e,t,n,r){let o=new w;o.setLanguage(n),t.initQueries?.(n),he(t,r);let s=o.parse(e),i=Ee(s,t,r);return s&&s.delete(),o.delete(),i}async function Fe(e){S||(await w.init(),S=!0);let t=await G(),n=O.extname(e.filePath),r=t.getProviderForExtension(n);if(!r)return{taskId:e.taskId,success:!0,data:{imports:[],exports:[],functions:[],classes:[],calls:[],decisions:[a.noLanguageProviderForExtension(n)]}};let{wasmPath:o,attemptedPaths:s}=T(r.wasm_file);if(!D.existsSync(o))return{taskId:e.taskId,success:!0,data:{imports:Y(e.code),exports:[],functions:[],classes:[],calls:[],decisions:[a.wasmNotFound(e.language,s.join(", "))]}};let i=await K(o),d=xe(e.code,r,i,e.language);return{taskId:e.taskId,success:!0,data:d}}N?.on("message",async e=>{try{let t=await Fe(e);N?.postMessage(t)}catch(t){N?.postMessage({taskId:e.taskId,success:!1,error:t.stack||String(t)})}});export{Fe as buildParseResponse,ne as collectFunctionNodes,Ne as collectWorkerSpawns,J as getCalleeEvidence,he as reportQueryCompileFailures,V as resolveCallableName,T as resolveWasmPath};
2
+ import{c,d as a,e as y,f as _,h as T}from"./chunk-ZROS4Z3Z.js";import{ca as P,d as L,fa as E}from"./chunk-H24ZJ4BD.js";import"./chunk-KVOCOCYJ.js";import{parentPort as N}from"worker_threads";import{Parser as w,Language as U}from"web-tree-sitter";import*as O from"path";import*as D from"fs";import{createHash as H}from"crypto";function h(e){return H(P).update(e.text).digest("hex")}var x=new L(e=>N?.postMessage(e));process.on("uncaughtException",e=>{x.error(a.WORKER_UNCAUGHT_EXCEPTION,{error:e instanceof Error?e.message:String(e)})});process.on("unhandledRejection",e=>{x.error(a.WORKER_UNHANDLED_REJECTION,{error:e instanceof Error?e.message:String(e)})});var S=!1,b=null;function G(){return b??=_(),b}var C=new Map;function K(e){let t=C.get(e);return t||(t=U.load(e),C.set(e,t)),t}function Y(e){let t=[],n=e.matchAll(/import\s+{([^}]+)}\s+from\s+['"]([^'"]+)['"]/g);for(let r of n)t.push({localName:r[1].trim(),originalName:r[1].trim(),modulePath:r[2]});return t}function F(e){return e.childForFieldName("name")?.text||e.descendantsOfType("identifier")[0]?.text||a.ANONYMOUS_NAME}function Q(e){let t=e.childForFieldName("declarator")?.childForFieldName("declarator");if(t)return t.type===c.QUALIFIED_IDENTIFIER?t.childForFieldName("name")?.text??a.ANONYMOUS_NAME:t.text}function V(e){let t=e.childForFieldName("name");if(t)return t.text;let n=Q(e);if(n)return n;let r=new Set([c.VARIABLE_DECLARATOR,c.ASSIGNMENT_EXPRESSION,c.PAIR,c.PUBLIC_FIELD_DEFINITION]),o=e.parent;for(;o&&o.type!==c.ARGUMENTS;){if(r.has(o.type)){let s=o.childForFieldName("name")||o.childForFieldName("key")||o.childForFieldName("left");if(s)return s.text}o=o.parent}return a.ANONYMOUS_NAME}function W(e){return e.childForFieldName("function")||e.childForFieldName("expression")||e.childForFieldName("type")||e.childForFieldName("name")||e.childForFieldName("method")||e}function J(e){let t=W(e),n=t.namedChildren,r=n[n.length-1],o=n.length>=2?n[n.length-2]:void 0;if(!r||!o)return{targetFunction:f(t.text),calleeName:t.text,calleeKind:"bare"};if(!j.has(r.type))return{targetFunction:f(t.text),calleeKind:"computed"};let s=r.text,i=o.text;return i.includes("(")?{targetFunction:f(t.text),calleeName:s,receiverText:i,calleeKind:"arg-chain"}:{targetFunction:f(t.text),calleeName:s,receiverText:i,calleeKind:i==="this"||i==="super"?"this":"member"}}function f(e){return e.replace(/\s+/g,"")}var j=new Set(["identifier","property_identifier","field_identifier","shorthand_property_identifier","attribute"]);function B(e){return((e.childForFieldName("property")||e.childForFieldName("field")||e.childForFieldName("attribute")||e.childForFieldName("name")||e.childForFieldName("method"))??e).startPosition}function g(e,t){let n=e.parent;for(;n;){if(t.has(n.id))return F(n);n=n.parent}return a.ANONYMOUS_NAME}function v(e){return e.type===c.TYPE_IDENTIFIER?e.text:e.descendantsOfType(c.TYPE_IDENTIFIER)[0]?.text}function X(e){let t=e.parent;for(;t;){if(t.type===c.IMPL_ITEM){let n=t.childForFieldName("type");return n?v(n):void 0}t=t.parent}}function z(e){let n=e.childForFieldName("receiver")?.namedChild(0)?.childForFieldName("type");return n?v(n):void 0}function Z(e){let n=e.childForFieldName("declarator")?.childForFieldName("declarator");if(n?.type!==c.QUALIFIED_IDENTIFIER)return;let r=n.childForFieldName("scope");if(r)return r.type===c.QUALIFIED_IDENTIFIER?r.childForFieldName("name")?.text:r.text}function $(e){return X(e)??z(e)??Z(e)}function q(e,t,n){let r=t.extractClasses(e.rootNode);for(let o of r)n.push({name:F(o),startLine:o.startPosition.row,endLine:o.endPosition.row,methods:[],contentHash:h(o)});return r}var ee=new Set(["arrow_function","function_expression"]);function te(e,t,n){let r=t.extractVariables?.(e.rootNode)??[];for(let o of r){let s=o.childForFieldName("value");s&&ee.has(s.type)||n.push({name:F(o),startLine:o.startPosition.row,endLine:o.endPosition.row,contentHash:h(o)})}return r}function ne(e,t,n,r){let o=new Set(r.map(i=>i.id)),s=t.extractFunctions(e.rootNode);for(let i of s){let d=g(i,o),l=d===a.ANONYMOUS_NAME?$(i):d;n.push({name:V(i),startLine:i.startPosition.row,endLine:i.endPosition.row,contentHash:h(i),containerName:l})}return s}function re(e,t,n,r){let o=new Set(n.map(i=>i.id)),s=t.extractCalls(e.rootNode);for(let i of s){if(r.length>=1e3)break;let d=B(i),l=J(i);r.push({sourceFunction:g(i,o),targetFunction:l.targetFunction,startLine:d.row,startColumn:d.column,calleeName:l.calleeName,receiverText:l.receiverText,calleeKind:l.calleeKind})}}function oe(e,t,n,r){if(!t.extractImplements)return;let o=new Set(n.map(s=>s.id));for(let s of t.extractImplements(e.rootNode))r.push({sourceClass:g(s,o),targetInterface:s.text})}function se(e,t,n,r){if(!t.extractExtends)return;let o=new Set(n.map(s=>s.id));for(let s of t.extractExtends(e.rootNode))r.push({sourceClass:g(s,o),targetClass:s.text})}var ie=new Set([E.TYPESCRIPT,E.JAVASCRIPT]),ae="Worker",ce="path",le="resolve",de="join",ue="__dirname";function me(e){if(e.type!=="call_expression")return!1;let t=e.childForFieldName("function");if(!t||t.type!=="member_expression")return!1;let n=t.childForFieldName("object")?.text,r=t.childForFieldName("property")?.text;return n===ce&&(r===le||r===de)}function ge(e){let t=e.childForFieldName("arguments");return!t||!t.namedChildren.some(o=>o?.type==="identifier"&&o.text===ue)?void 0:t.descendantsOfType("string")[0]?.text.replace(/['"]/g,"")}function pe(e,t){for(let n of e.rootNode.descendantsOfType(c.ASSIGNMENT_EXPRESSION)){if(!n)continue;let r=n.childForFieldName("left"),o=n.childForFieldName("right");if(r?.text!==t||!o||!me(o))continue;let s=ge(o);if(s)return s}}function fe(e,t){if(t.type==="string")return t.text.replace(/['"]/g,"");if(t.type==="identifier"||t.type==="member_expression")return pe(e,t.text)}function Ne(e,t,n,r){if(!ie.has(t))return;let o=new Set(n.map(s=>s.id));for(let s of e.rootNode.descendantsOfType("new_expression")){if(!s||s.childForFieldName("constructor")?.text!==ae)continue;let l=s.childForFieldName("arguments")?.namedChildren.find(p=>p!==null);if(!l)continue;let m=fe(e,l);m&&r.push({sourceFunction:g(s,o),targetPath:m})}}function Ee(e,t,n){let r=[],o=[],s=[],i=[],d=[],l=[],m=[],p=[],A=[],I=[];if(e){r.push(a.parsedViaTreeSitter(e.rootNode.childCount));try{let u=q(e,t,d),R=ne(e,t,i,u),M=t.extractImports(e.rootNode);o.push(...y(M)),te(e,t,l),re(e,t,R,m),oe(e,t,u,p),se(e,t,u,A),Ne(e,n,R,I),r.push(a.QUERIED_VIA_LANGUAGE_PROVIDER)}catch(u){r.push(a.providerQueryFailed(u instanceof Error?u.message:String(u)))}}return{imports:o,exports:s,functions:i,classes:d,variables:l,calls:m,implements:p,extends:A,workerSpawns:I,decisions:r}}function he(e,t){for(let n of e.drainQueryCompileFailures?.()??[])x.error(a.QUERY_COMPILE_FAILED,{language:t,kind:n.kind,pattern:n.pattern,message:n.message})}function xe(e,t,n,r){let o=new w;o.setLanguage(n),t.initQueries?.(n),he(t,r);let s=o.parse(e),i=Ee(s,t,r);return s&&s.delete(),o.delete(),i}async function Fe(e){S||(await w.init(),S=!0);let t=await G(),n=O.extname(e.filePath),r=t.getProviderForExtension(n);if(!r)return{taskId:e.taskId,success:!0,data:{imports:[],exports:[],functions:[],classes:[],calls:[],decisions:[a.noLanguageProviderForExtension(n)]}};let{wasmPath:o,attemptedPaths:s}=T(r.wasm_file);if(!D.existsSync(o))return{taskId:e.taskId,success:!0,data:{imports:Y(e.code),exports:[],functions:[],classes:[],calls:[],decisions:[a.wasmNotFound(e.language,s.join(", "))]}};let i=await K(o),d=xe(e.code,r,i,e.language);return{taskId:e.taskId,success:!0,data:d}}N?.on("message",async e=>{try{let t=await Fe(e);N?.postMessage(t)}catch(t){N?.postMessage({taskId:e.taskId,success:!1,error:t.stack||String(t)})}});export{Fe as buildParseResponse,ne as collectFunctionNodes,Ne as collectWorkerSpawns,J as getCalleeEvidence,he as reportQueryCompileFailures,V as resolveCallableName,T as resolveWasmPath};
3
3
  //# sourceMappingURL=ast-worker.js.map
@@ -0,0 +1,62 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+ import{ba as F,fa as u,ga as X,ha as v,ia as k,ja as Y,ka as G,la as H,ma as B,na as Q,oa as V,pa as j,qa as W}from"./chunk-H24ZJ4BD.js";var q="anonymous";var Dt="AstWorkerCrashError",Pt={ARGUMENTS:"arguments",VARIABLE_DECLARATOR:"variable_declarator",ASSIGNMENT_EXPRESSION:"assignment_expression",PAIR:"pair",PUBLIC_FIELD_DEFINITION:"public_field_definition",IMPL_ITEM:"impl_item",TYPE_IDENTIFIER:"type_identifier",POINTER_TYPE:"pointer_type",QUALIFIED_IDENTIFIER:"qualified_identifier"},Ft={PARSE_FAILURE_NO_DETAIL:"parse returned success=false with no error detail",PARSE_FAILURE_RESULT:"AST parse returned failure result",PARSE_THREW:"AST parse threw (worker crash or rejection)",WORKER_UNCAUGHT_EXCEPTION:"AST worker uncaughtException",QUERY_COMPILE_FAILED:"AST language query failed to compile; using fallback",WORKER_UNHANDLED_REJECTION:"AST worker unhandledRejection",WORKER_EXITED_DURING_SHUTDOWN:"AST worker exited during pool shutdown (expected)",WORKER_CRASHED_EXITED:"AST worker crashed/exited",WORKER_EXITED_UNEXPECTEDLY:"Worker exited unexpectedly",POOL_TERMINATED:"AST worker pool terminated before task completion",UNKNOWN_FILE:"(unknown file)",PARSE_CACHE_HIT:"AST parse cache hit",CACHE_METRICS_AND_QUEUE_PERFORMANCE:"AST cache metrics and queue performance",TASK_TIMED_OUT_TERMINATING:"AST worker task timed out \u2014 terminating stuck worker",WORKER_TERMINATE_FAILED:"AST worker terminate() rejected \u2014 forced termination did not complete",QUERIED_VIA_LANGUAGE_PROVIDER:"Queried nodes using @workspace/ast-core LanguageProvider",ANONYMOUS_NAME:q,workerCrashWhileParsing:n=>`AST worker crashed while parsing ${n}: `,taskTimedOutAfterMs:(n,e)=>`AST worker task ${n} timed out after ${e}ms`,workerExitedWithCode:n=>`Worker exited with code ${n}`,noLanguageProviderForExtension:n=>`No language provider registered for extension ${n}`,wasmNotFound:(n,e)=>`WASM not found for ${n}, AST parsing skipped (Regex fallback used). Tried paths: ${e}`,parsedViaTreeSitter:n=>`Parsed via web-tree-sitter (nodes: ${n})`,providerQueryFailed:n=>`ast-core provider query failed: ${n}`};var p={FILE:"file",CLASS:"class",FUNCTION:"function",CALL:"call",METHOD_CALL:"method_call",IMPORT:"import",API_CONTRACT:"api_contract"};var N={IDENTIFIER:"identifier",SCOPED_IDENTIFIER:"scoped_identifier",QUALIFIED_IDENTIFIER:"qualified_identifier",DOTTED_NAME:"dotted_name",ALIASED_IMPORT:"aliased_import",USE_AS_CLAUSE:"use_as_clause",USE_WILDCARD:"use_wildcard",SCOPED_USE_LIST:"scoped_use_list",USE_LIST:"use_list",DOT:"dot",BLANK_IDENTIFIER:"blank_identifier",NAMESPACE_USE_DECLARATION:"namespace_use_declaration",INCLUDE_EXPRESSION:"include_expression",INCLUDE_ONCE_EXPRESSION:"include_once_expression",REQUIRE_EXPRESSION:"require_expression",REQUIRE_ONCE_EXPRESSION:"require_once_expression",IMPORT_STATEMENT:"import_statement",IMPORT_FROM_STATEMENT:"import_from_statement",USE_DECLARATION:"use_declaration",IMPORT_DECLARATION:"import_declaration",PREPROC_INCLUDE:"preproc_include",USING_DECLARATION:"using_declaration",CALL:"call",USING_DIRECTIVE:"using_directive",CALL_EXPRESSION:"call_expression",METHOD_INVOCATION:"method_invocation",EXPLICIT_CONSTRUCTOR_INVOCATION:"explicit_constructor_invocation",COMMAND_CALL:"command_call",FUNCTION_CALL_EXPRESSION:"function_call_expression",MEMBER_CALL_EXPRESSION:"member_call_expression",SCOPED_CALL_EXPRESSION:"scoped_call_expression",INVOCATION_EXPRESSION:"invocation_expression",OBJECT_CREATION_EXPRESSION:"object_creation_expression",MEMBER_EXPRESSION:"member_expression",ATTRIBUTE:"attribute",MEMBER_ACCESS_EXPRESSION:"member_access_expression",VARIABLE_DECLARATION:"variable_declaration",LEXICAL_DECLARATION:"lexical_declaration",VARIABLE_DECLARATOR:"variable_declarator",ARROW_FUNCTION:"arrow_function",FUNCTION_DECLARATION:"function_declaration",METHOD_DEFINITION:"method_definition",CLASS_DECLARATION:"class_declaration",INTERFACE_DECLARATION:"interface_declaration",TYPE_ALIAS_DECLARATION:"type_alias_declaration",EXPORT_STATEMENT:"export_statement"};var d="*",me=["require","require_relative","load"],J="this",_e="new";function yt(n){let e=[];for(let o of n){let r=o.type,i=Ae[r];if(i){i(o,e);continue}if(we(r)){ve(o,r,e);continue}Ye(o,e)}return e}var Ae={[N.IMPORT_STATEMENT]:pe,[N.EXPORT_STATEMENT]:Ce,[N.IMPORT_FROM_STATEMENT]:Oe,[N.USE_DECLARATION]:ge,[N.IMPORT_DECLARATION]:xe,[N.PREPROC_INCLUDE]:Ue,[N.USING_DECLARATION]:Me,[N.CALL]:ye,[N.USING_DIRECTIVE]:ke};function pe(n,e){let o=n.descendantsOfType("string").pop();if(!o)return;let r=o.text.replace(/['"]/g,""),i=n.descendantsOfType("namespace_import")[0];if(i){let l=i.descendantsOfType("identifier")[0];l&&e.push({localName:l.text,originalName:d,modulePath:r});return}let s=n.descendantsOfType("named_imports")[0];if(s){let l=s.descendantsOfType("import_specifier");for(let I of l){if(!I)continue;let E=I.childForFieldName("name"),f=I.childForFieldName("alias");if(E){let S=E.text,C=f?f.text:S;e.push({localName:C,originalName:S,modulePath:r})}}return}let c=n.descendantsOfType("identifier")[0];c&&e.push({localName:c.text,originalName:d,modulePath:r})}function Ce(n,e){let o=n.childForFieldName("source");if(!o)return;let r=o.text.replace(/['"]/g,""),i=n.descendantsOfType("export_clause")[0];if(i)for(let s of i.descendantsOfType("export_specifier")){if(!s)continue;let c=s.childForFieldName("name");if(!c)continue;let l=s.childForFieldName("alias");e.push({localName:l?l.text:c.text,originalName:c.text,modulePath:r,viaReexport:!0})}}function Oe(n,e){let o=n.childForFieldName("module_name");if(!o)return;let r=o.text;if(n.descendantsOfType("wildcard_import")[0])return;n.childForFieldName("name")&&Ge(n,r,e)}function Se(n,e){let o=n.childForFieldName("path"),r=n.childForFieldName("alias");o&&r&&e.push({localName:r.text,originalName:d,modulePath:o.text})}function Re(n,e,o){let r=n.childForFieldName("path"),i=n.childForFieldName("alias");r&&i&&o.push({localName:i.text,originalName:d,modulePath:`${e}::${r.text}`})}function Le(n,e,o){let r=n.descendantsOfType("identifier").pop();r&&o.push({localName:r.text,originalName:d,modulePath:`${e}::${n.text}`})}function he(n,e,o){if(n.type===N.USE_AS_CLAUSE){Re(n,e,o);return}if(n.type===N.IDENTIFIER){o.push({localName:n.text,originalName:d,modulePath:`${e}::${n.text}`});return}n.type===N.SCOPED_IDENTIFIER&&Le(n,e,o)}function De(n,e){let o=n.childForFieldName("path"),r=n.childForFieldName("list");if(!o||!r)return;let i=o.text;for(let s of r.namedChildren)s&&he(s,i,e)}function Pe(n,e){let o=n.descendantsOfType("identifier"),r=o[o.length-1];r&&e.push({localName:r.text,originalName:d,modulePath:n.text})}function Fe(n,e){for(let o of n.namedChildren)o&&o.type===N.IDENTIFIER&&e.push({localName:o.text,originalName:d,modulePath:o.text})}function ge(n,e){let o=n.childForFieldName("argument");if(o){if(o.type===N.USE_AS_CLAUSE){Se(o,e);return}if(o.type!==N.USE_WILDCARD){if(o.type===N.SCOPED_USE_LIST){De(o,e);return}if(o.type===N.SCOPED_IDENTIFIER||o.type===N.IDENTIFIER){Pe(o,e);return}o.type===N.USE_LIST&&Fe(o,e)}}}function $e(n,e){let o=n.childForFieldName("path");if(!o)return;let r=o.text.replace(/['"]/g,""),i=n.childForFieldName("name");if(i){if(i.type===N.DOT||i.type===N.BLANK_IDENTIFIER)return;e.push({localName:i.text,originalName:d,modulePath:r})}else{let s=r.split("/"),c=s[s.length-1];e.push({localName:c,originalName:d,modulePath:r})}}function xe(n,e){let o=n.descendantsOfType("import_spec_list")[0];if(!o)return;let r=o.descendantsOfType("import_spec");for(let i of r)i&&$e(i,e)}function Ue(n,e){let o=n.childForFieldName("path");if(o){let r=o.text.replace(/[<>"']/g,"");e.push({localName:r,originalName:d,modulePath:r})}}function Me(n,e){let o=n.namedChildren;for(let r of o)if(r)if(r.type===N.QUALIFIED_IDENTIFIER){let i=r.descendantsOfType("identifier"),s=i[i.length-1];s&&e.push({localName:s.text,originalName:d,modulePath:r.text})}else r.type===N.IDENTIFIER&&e.push({localName:r.text,originalName:d,modulePath:r.text})}function ye(n,e){let o=n.childForFieldName("method");if(!o)return;let r=o.text;if(!me.includes(r))return;let i=n.childForFieldName("arguments");if(!i)return;let s=i.descendantsOfType("string_content")[0]||i.descendantsOfType("string")[0];if(!s)return;let c=s.text.replace(/['"]/g,""),l=c.replace(/\.rb$/,"");e.push({localName:l,originalName:d,modulePath:c})}function we(n){return n===N.NAMESPACE_USE_DECLARATION||n===N.INCLUDE_EXPRESSION||n===N.INCLUDE_ONCE_EXPRESSION||n===N.REQUIRE_EXPRESSION||n===N.REQUIRE_ONCE_EXPRESSION}function be(n,e){let o=n.descendantsOfType("qualified_name")[0]||n.descendantsOfType("name")[0];if(o){let r=o.text,i=r.split("\\"),s=i[i.length-1];e.push({localName:s,originalName:d,modulePath:r})}}function Xe(n,e){let o=n.descendantsOfType("string")[0]||n.descendantsOfType("string_content")[0];if(o){let r=o.text.replace(/['"]/g,"");e.push({localName:r,originalName:d,modulePath:r})}}function ve(n,e,o){e===N.NAMESPACE_USE_DECLARATION?be(n,o):Xe(n,o)}function ke(n,e){let o=n.descendantsOfType("qualified_name")[0]||n.descendantsOfType("identifier")[0];if(o){let r=o.text,i=r.split("."),s=i[i.length-1];e.push({localName:s,originalName:d,modulePath:r})}}function Ye(n,e){let o=n.descendantsOfType("string").pop();if(!o)return;let r=o.text.replace(/['"]/g,""),i=n.descendantsOfType("identifier");for(let s of i)s&&(e.some(c=>c.localName===s.text)||e.push({localName:s.text,originalName:s.text,modulePath:r}))}function Ge(n,e,o){if(n.childForFieldName("name")){for(let i of n.namedChildren)if(i)if(i.type===N.ALIASED_IMPORT){let s=i.childForFieldName("name"),c=i.childForFieldName("alias");s&&c&&o.push({localName:c.text,originalName:s.text,modulePath:e})}else if(i.type===N.DOTTED_NAME){let s=i.descendantsOfType("identifier"),c=s[s.length-1];c&&o.push({localName:c.text,originalName:i.text,modulePath:e})}else i.type===N.IDENTIFIER&&o.push({localName:i.text,originalName:i.text,modulePath:e})}}function He(n){let e=n.childForFieldName("function");if(!e)return{isMethodCall:!1,methodName:""};if(e.type===N.MEMBER_EXPRESSION){let o=e.childForFieldName("property"),r=e.childForFieldName("object");if(o)return{isMethodCall:!0,methodName:o.text,objectName:r?.text}}return{isMethodCall:!1,methodName:e.text}}function Be(n){let e=n.childForFieldName("function");if(!e)return{isMethodCall:!1,methodName:""};if(e.type===N.ATTRIBUTE){let o=e.childForFieldName("attribute"),r=e.childForFieldName("object");if(o)return{isMethodCall:!0,methodName:o.text,objectName:r?.text}}return{isMethodCall:!1,methodName:e.text}}function Qe(n){let e=n.childForFieldName("name"),o=n.childForFieldName("object");if(e)return{isMethodCall:!0,methodName:e.text,objectName:o?.text}}function Ve(n){return{isMethodCall:!0,methodName:n.childForFieldName("constructor")?.text||J,objectName:J}}function je(n){let e=n.childForFieldName("method");if(!e)return;let o=n.childForFieldName("receiver");return o?{isMethodCall:!0,methodName:e.text,objectName:o.text}:{isMethodCall:!1,methodName:e.text}}function M(n){let e=n.type,r=n.childForFieldName("name")?.text||"";if(e===N.MEMBER_CALL_EXPRESSION){let i=n.childForFieldName("object");return{isMethodCall:!0,methodName:r,objectName:i?.text}}if(e===N.SCOPED_CALL_EXPRESSION){let i=n.childForFieldName("scope");return{isMethodCall:!0,methodName:r,objectName:i?.text}}return{isMethodCall:!1,methodName:r}}function We(n){let e=n.childForFieldName("function")||n.namedChildren[0];if(e&&e.type===N.MEMBER_ACCESS_EXPRESSION){let o=e.childForFieldName("name"),r=e.childForFieldName("expression");if(o)return{isMethodCall:!0,methodName:o.text,objectName:r?.text}}if(e)return{isMethodCall:!1,methodName:e.text}}function qe(n){let e=n.childForFieldName("type");return{isMethodCall:!0,methodName:_e,objectName:e?.text}}var wt={[N.CALL_EXPRESSION]:He,[N.CALL]:Be,[N.METHOD_INVOCATION]:Qe,[N.EXPLICIT_CONSTRUCTOR_INVOCATION]:Ve,[N.COMMAND_CALL]:je,[N.FUNCTION_CALL_EXPRESSION]:M,[N.MEMBER_CALL_EXPRESSION]:M,[N.SCOPED_CALL_EXPRESSION]:M,[N.INVOCATION_EXPRESSION]:We,[N.OBJECT_CREATION_EXPRESSION]:qe};var Je=/^(\d{4}-\d{2}-\d{2})?[T ]?(?:(\d{2}):\d{2}(?::\d{2}(?:\.\d+)?)?)?(Z|[-+]\d{2}:\d{2})?$/i,L=class n extends Date{#t=!1;#n=!1;#e=null;constructor(e){let o=!0,r=!0,i="Z";if(typeof e=="string"){let s=e.match(Je);s?(s[1]||(o=!1,e=`0000-01-01T${e}`),r=!!s[2],r&&e[10]===" "&&(e=e.replace(" ","T")),s[2]&&+s[2]>23?e="":(i=s[3]||null,e=e.toUpperCase(),!i&&r&&(e+="Z"))):e=""}super(e),isNaN(this.getTime())||(this.#t=o,this.#n=r,this.#e=i)}isDateTime(){return this.#t&&this.#n}isLocal(){return!this.#t||!this.#n||!this.#e}isDate(){return this.#t&&!this.#n}isTime(){return this.#n&&!this.#t}isValid(){return this.#t||this.#n}toISOString(){let e=super.toISOString();if(this.isDate())return e.slice(0,10);if(this.isTime())return e.slice(11,23);if(this.#e===null)return e.slice(0,-1);if(this.#e==="Z")return e;let o=+this.#e.slice(1,3)*60+ +this.#e.slice(4,6);return o=this.#e[0]==="-"?o:-o,new Date(this.getTime()-o*6e4).toISOString().slice(0,-1)+this.#e}static wrapAsOffsetDateTime(e,o="Z"){let r=new n(e);return r.#e=o,r}static wrapAsLocalDateTime(e){let o=new n(e);return o.#e=null,o}static wrapAsLocalDate(e){let o=new n(e);return o.#n=!1,o.#e=null,o}static wrapAsLocalTime(e){let o=new n(e);return o.#t=!1,o.#e=null,o}};function Ke(n,e){let o=n.slice(0,e).split(/\r\n|\n|\r/g);return[o.length,o.pop().length+1]}function ze(n,e,o){let r=n.split(/\r\n|\n|\r/g),i="",s=(Math.log10(e+1)|0)+1;for(let c=e-1;c<=e+1;c++){let l=r[c-1];l&&(i+=c.toString().padEnd(s," "),i+=": ",i+=l,i+=`
3
+ `,c===e&&(i+=" ".repeat(s+o+2),i+=`^
4
+ `))}return i}var T=class extends Error{line;column;codeblock;constructor(e,o){let[r,i]=Ke(o.toml,o.ptr),s=ze(o.toml,r,i);super(`Invalid TOML document: ${e}
5
+
6
+ ${s}`,o),this.line=r,this.column=i,this.codeblock=s}};var Ze=/^((0x[0-9a-fA-F](_?[0-9a-fA-F])*)|(([+-]|0[ob])?\d(_?\d)*))$/,et=/^[+-]?\d(_?\d)*(\.\d(_?\d)*)?([eE][+-]?\d(_?\d)*)?$/,tt=/^[+-]?0[0-9_]/;function g(n,e){let o=n[e++],r=o,i=o==="'",s=o===n[e]&&o===n[e+1];s&&(n[e+=2]===`
7
+ `?e++:n[e]==="\r"&&n[e+1]===`
8
+ `&&(e+=2));let c="",l=e,I=0;for(let E=e;E<n.length;E++)if(o=n[E],s&&(o===`
9
+ `||o==="\r"&&n[E+1]===`
10
+ `))I=I&&3;else{if(o<" "&&o!==" "||o==="\x7F")throw new T("control characters are not allowed in strings",{toml:n,ptr:E});if((!I||I===3)&&o===r&&(!s||n[E+1]===r&&n[E+2]===r))return s&&(n[E+3]===r&&E++,n[E+3]===r&&E++),[I?c:c+n.slice(l,E),E+(s?3:1)];if(!I)!i&&o==="\\"&&(c+=n.slice(l,l=E),I=1);else if(I===1)if(o==="x"||o==="u"||o==="U"){let f=0,S=o==="x"?2:o==="u"?4:8;for(let C=0;C<S;C++,E++){let m=n.charCodeAt(E+1),O=m>=48&&m<=57?m-48:m>=65&&m<=70?m-65+10:m>=97&&m<=102?m-97+10:-1;if(O<0)throw new T("invalid non-hex character in unicode escape",{toml:n,ptr:E+1});f=f<<4|O}if(f<0||f>1114111||f>=55296&&f<=57343)throw new T("invalid unicode escape",{toml:n,ptr:E});c+=String.fromCodePoint(f),l=E+1,I=0}else if(o===" "||o===" ")I=2;else{if(o==="b")c+="\b";else if(o==="t")c+=" ";else if(o==="n")c+=`
11
+ `;else if(o==="f")c+="\f";else if(o==="r")c+="\r";else if(o==="e")c+="\x1B";else if(o==='"')c+='"';else if(o==="\\")c+="\\";else throw new T("unrecognized escape sequence",{toml:n,ptr:E});l=E+1,I=0}else if(o!==" "&&o!==" "){if(I===2)throw new T("invalid escape: only line-ending whitespace may be escaped",{toml:n,ptr:l});I=!i&&o==="\\"?1:0,l=E}}throw new T("unfinished string",{toml:n,ptr:e})}function K(n,e,o,r){if(n==="true")return!0;if(n==="false")return!1;if(n==="-inf")return-1/0;if(n==="inf"||n==="+inf")return 1/0;if(n==="nan"||n==="+nan"||n==="-nan")return NaN;if(n==="-0")return r?0n:0;let i=Ze.test(n);if(i||et.test(n)){if(tt.test(n))throw new T("leading zeroes are not allowed",{toml:e,ptr:o});n=n.replace(/_/g,"");let c=+n;if(isNaN(c))throw new T("invalid number",{toml:e,ptr:o});if(i){if((i=!Number.isSafeInteger(c))&&!r)throw new T("integer value cannot be represented losslessly",{toml:e,ptr:o});(i||r===!0)&&(c=BigInt(n))}return c}let s=new L(n);if(!s.isValid())throw new T("invalid value",{toml:e,ptr:o});return s}function $(n,e=0,o=n.length){let r=n.indexOf(`
12
+ `,e);return n[r-1]==="\r"&&r--,r<=o?r:-1}function R(n,e){for(let o=e;o<n.length;o++){let r=n[o];if(r===`
13
+ `)return o;if(r==="\r"&&n[o+1]===`
14
+ `)return o+1;if(r<" "&&r!==" "||r==="\x7F")throw new T("control characters are not allowed in comments",{toml:n,ptr:e})}return n.length}function A(n,e,o,r){let i;for(;;){for(;(i=n[e])===" "||i===" "||!o&&(i===`
15
+ `||i==="\r"&&n[e+1]===`
16
+ `);)e++;if(r||i!=="#")break;e=R(n,e)}return e}function z(n,e,o,r,i=!1){if(!r)return e=$(n,e),e<0?n.length:e;for(let s=e;s<n.length;s++){let c=n[s];if(c==="#")s=$(n,s);else{if(c===o)return s+1;if(c===r||i&&(c===`
17
+ `||c==="\r"&&n[s+1]===`
18
+ `))return s}}throw new T("cannot find end of structure",{toml:n,ptr:e})}function nt(n,e,o){let r=n.slice(e,o),i=r.indexOf("#");return i>-1&&(R(n,i),r=r.slice(0,i)),[r.trimEnd(),i]}function h(n,e,o,r,i){if(r===0)throw new T("document contains excessively nested structures. aborting.",{toml:n,ptr:e});let s=n[e];if(s==="["||s==="{"){let[I,E]=s==="["?ee(n,e,r,i):Z(n,e,r,i);if(o){if(E=A(n,E),n[E]===",")E++;else if(n[E]!==o)throw new T("expected comma or end of structure",{toml:n,ptr:E})}return[I,E]}if(s==='"'||s==="'"){let[I,E]=g(n,e);if(o){if(E=A(n,E),n[E]&&n[E]!==","&&n[E]!==o&&n[E]!==`
19
+ `&&n[E]!=="\r")throw new T("unexpected character encountered",{toml:n,ptr:E});n[E]===","&&E++}return[I,E]}let c=z(n,e,",",o),l=nt(n,e,c-(n[c-1]===","?1:0));if(!l[0])throw new T("incomplete key-value declaration: no value specified",{toml:n,ptr:e});return o&&l[1]>-1&&(c=A(n,e+l[1]),n[c]===","&&c++),[K(l[0],n,e,i),c]}var ot=/^[a-zA-Z0-9-_]+[ \t]*$/;function x(n,e,o="="){let r=e-1,i=[],s=n.indexOf(o,e);if(s<0)throw new T("incomplete key-value: cannot find end of key",{toml:n,ptr:e});do{let c=n[e=++r];if(c!==" "&&c!==" ")if(c==='"'||c==="'"){if(c===n[e+1]&&c===n[e+2])throw new T("multiline strings are not allowed in keys",{toml:n,ptr:e});let[l,I]=g(n,e);r=n.indexOf(".",I);let E=n.slice(I,r<0||r>s?s:r),f=$(E);if(f>-1)throw new T("newlines are not allowed in keys",{toml:n,ptr:e+r+f});if(E.trimStart())throw new T("found extra tokens after the string part",{toml:n,ptr:I});if(s<I&&(s=n.indexOf(o,I),s<0))throw new T("incomplete key-value: cannot find end of key",{toml:n,ptr:e});i.push(l)}else{r=n.indexOf(".",e);let l=n.slice(e,r<0||r>s?s:r);if(!ot.test(l))throw new T("only letter, numbers, dashes and underscores are allowed in keys",{toml:n,ptr:e});i.push(l.trimEnd())}}while(r+1&&r<s);return[i,A(n,s+1,!0,!0)]}function Z(n,e,o,r){let i={},s=new Set,c;for(e++;(c=n[e++])!=="}"&&c;){if(c===",")throw new T("expected value, found comma",{toml:n,ptr:e-1});if(c==="#")e=R(n,e);else if(c!==" "&&c!==" "&&c!==`
20
+ `&&c!=="\r"){let l,I=i,E=!1,[f,S]=x(n,e-1);for(let O=0;O<f.length;O++){if(O&&(I=E?I[l]:I[l]={}),l=f[O],(E=Object.hasOwn(I,l))&&(typeof I[l]!="object"||s.has(I[l])))throw new T("trying to redefine an already defined value",{toml:n,ptr:e});!E&&l==="__proto__"&&Object.defineProperty(I,l,{enumerable:!0,configurable:!0,writable:!0})}if(E)throw new T("trying to redefine an already defined value",{toml:n,ptr:e});let[C,m]=h(n,S,"}",o-1,r);s.add(C),I[l]=C,e=m}}if(!c)throw new T("unfinished table encountered",{toml:n,ptr:e});return[i,e]}function ee(n,e,o,r){let i=[],s;for(e++;(s=n[e++])!=="]"&&s;){if(s===",")throw new T("expected value, found comma",{toml:n,ptr:e-1});if(s==="#")e=R(n,e);else if(s!==" "&&s!==" "&&s!==`
21
+ `&&s!=="\r"){let c=h(n,e-1,"]",o-1,r);i.push(c[0]),e=c[1]}}if(!s)throw new T("unfinished array encountered",{toml:n,ptr:e});return[i,e]}function te(n,e,o,r){let i=e,s=o,c,l=!1,I;for(let E=0;E<n.length;E++){if(E){if(i=l?i[c]:i[c]={},s=(I=s[c]).c,r===0&&(I.t===1||I.t===2))return null;if(I.t===2){let f=i.length-1;i=i[f],s=s[f].c}}if(c=n[E],(l=Object.hasOwn(i,c))&&s[c]?.t===0&&s[c]?.d)return null;l||(c==="__proto__"&&(Object.defineProperty(i,c,{enumerable:!0,configurable:!0,writable:!0}),Object.defineProperty(s,c,{enumerable:!0,configurable:!0,writable:!0})),s[c]={t:E<n.length-1&&r===2?3:r,d:!1,i:0,c:{}})}if(I=s[c],I.t!==r&&!(r===1&&I.t===3)||(r===2&&(I.d||(I.d=!0,i[c]=[]),i[c].push(i={}),I.c[I.i++]=I={t:1,d:!1,i:0,c:{}}),I.d))return null;if(I.d=!0,r===1)i=l?i[c]:i[c]={};else if(r===0&&l)return null;return[c,i,I.c]}function y(n,{maxDepth:e=1e3,integersAsBigInt:o}={}){let r={},i={},s=r,c=i;for(let l=A(n,0);l<n.length;){if(n[l]==="["){let I=n[++l]==="[",E=x(n,l+=+I,"]");if(I){if(n[E[1]-1]!=="]")throw new T("expected end of table declaration",{toml:n,ptr:E[1]-1});E[1]++}let f=te(E[0],r,i,I?2:1);if(!f)throw new T("trying to redefine an already defined table or value",{toml:n,ptr:l});c=f[2],s=f[1],l=E[1]}else{let I=x(n,l),E=te(I[0],s,c,0);if(!E)throw new T("trying to redefine an already defined table or value",{toml:n,ptr:l});let f=h(n,I[1],void 0,e,o);E[1][E[0]]=f[0],l=f[1]}if(l=A(n,l,!0),n[l]&&n[l]!==`
22
+ `&&n[l]!=="\r")throw new T("each key-value declaration must be followed by an end-of-line",{toml:n,ptr:l});l=A(n,l)}return r}import{Query as rt}from"web-tree-sitter";var a={CLASS:"class",FUNCTION:"function",VARIABLE:"variable",IMPORT:"import",CALL:"call",IMPLEMENTS:"implements",EXTENDS:"extends"};var D=class{buildScopeMap(e){return this.config.buildScopeMap?this.config.buildScopeMap(e):new Map}classifyCall(e){return this.config.classifyCall?this.config.classifyCall(e):{isMethodCall:!1,methodName:e.text}}wasm_file;config;compiledQueries=null;constructor(e){this.config=e,this.wasm_file=e.wasm_file}initQueries(e){if(this.compiledQueries||!this.config.queries)return;let o=this.config.queries;this.compiledQueries={classes:this.compileQuery(e,o.classes,"classes"),functions:this.compileQuery(e,o.functions,"functions"),variables:this.compileQuery(e,o.variables,"variables"),imports:this.compileQuery(e,o.imports,"imports"),calls:this.compileQuery(e,o.calls,"calls"),implements:this.compileQuery(e,o.implements,"implements"),extends:this.compileQuery(e,o.extends,"extends")}}queryCompileFailures=[];drainQueryCompileFailures(){return this.queryCompileFailures.splice(0)}compileQuery(e,o,r){if(o)try{return new rt(e,o)}catch(i){this.queryCompileFailures.push({kind:r,pattern:o,message:i instanceof Error?i.message:String(i)});return}}deleteQueries(){this.compiledQueries&&(this.compiledQueries.classes?.delete(),this.compiledQueries.functions?.delete(),this.compiledQueries.variables?.delete(),this.compiledQueries.imports?.delete(),this.compiledQueries.calls?.delete(),this.compiledQueries.implements?.delete(),this.compiledQueries.extends?.delete(),this.compiledQueries=null)}captureNodes(e,o,r){if(!r)return[];let i=r.captures(e),s=[];for(let c of i)(o.length===0||o.includes(c.name))&&s.push(c.node);return s}extractClasses(e){return this.extractNodes(e,this.compiledQueries?.classes,[p.CLASS],this.config.classes)}extractFunctions(e){return this.extractNodes(e,this.compiledQueries?.functions,[p.FUNCTION],this.config.functions)}extractVariables(e){return this.extractNodes(e,this.compiledQueries?.variables,[a.VARIABLE],[])}extractImports(e){return this.extractNodes(e,this.compiledQueries?.imports,[p.IMPORT],this.config.imports)}extractCalls(e){return this.extractNodes(e,this.compiledQueries?.calls,[p.CALL],this.config.calls)}extractImplements(e){return this.extractNodes(e,this.compiledQueries?.implements,[a.IMPLEMENTS],this.config.implements||[])}extractExtends(e){return this.extractNodes(e,this.compiledQueries?.extends,[a.EXTENDS],this.config.extends||[])}extractNodes(e,o,r,i){if(o)return this.captureNodes(e,r,o);let s=[];for(let c of i)s.push(...e.descendantsOfType(c).filter(Boolean));return s}};var ne="languages.toml";function oe(n){return Array.isArray(n)&&n.every(e=>typeof e=="string")}var it=["extensions","imports","classes","functions","calls"],st=["implements","extends"];function at(n){if(!n||typeof n!="object")return!1;let e=n;return typeof e.wasm_file!="string"?!1:it.every(o=>oe(e[o]))&&st.every(o=>{let r=e[o];return r==null||oe(r)})}function ct(n){if(!n||typeof n!="object")return!1;let e=n;return!(!e.languages||typeof e.languages!="object"||!Object.values(e.languages).every(at))}var U=class n{config;extToProviderMap;constructor(e){this.config=e||{languages:{}},this.extToProviderMap=new Map,this.buildCache()}buildCache(){this.extToProviderMap.clear();for(let[e,o]of Object.entries(this.config.languages)){let r=new D(o);for(let i of o.extensions)this.extToProviderMap.set(i,r)}}static loadFromString(e,o){let r=o||{languages:{}};if(!e)return new n(r);try{let i=y(e);if(ct(i)){let s={...r.languages,...i.languages};return new n({languages:s})}}catch{}return new n(r)}static async load(e,o){let r=o||{languages:{}};try{let i=n.getProcessLike();if(i&&i.versions&&i.versions.node&&i.cwd){let s=await import("fs/promises"),c=await import("path"),l=e?c.resolve(e,ne):c.resolve(i.cwd(),ne);try{await s.access(l);let I=await s.readFile(l,F);return n.loadFromString(I,r)}catch{}}}catch{}return new n(r)}static getProcessLike(){if(typeof globalThis>"u")return;let o=globalThis.process;if(!(!o||typeof o!="object"))return o}getProviderForExtension(e){return this.extToProviderMap.get(e)}registerProvider(e,o){for(let r of e)this.extToProviderMap.set(r,o)}getConfig(){return this.config}};var t={IDENTIFIER:"identifier",TYPE_IDENTIFIER:"type_identifier",CALL:"call",CALL_EXPRESSION:"call_expression",CLASS_DECLARATION:"class_declaration",ABSTRACT_CLASS_DECLARATION:"abstract_class_declaration",INTERFACE_DECLARATION:"interface_declaration",ENUM_DECLARATION:"enum_declaration",METHOD_DECLARATION:"method_declaration",METHOD_DEFINITION:"method_definition",FUNCTION_DECLARATION:"function_declaration",FUNCTION_DEFINITION:"function_definition",ARROW_FUNCTION:"arrow_function",MEMBER_EXPRESSION:"member_expression",IMPORT_STATEMENT:"import_statement",IMPORT_DECLARATION:"import_declaration",USE_DECLARATION:"use_declaration",ATTRIBUTE:"attribute",STRUCT_SPECIFIER:"struct_specifier",ENUM_SPECIFIER:"enum_specifier",UNION_SPECIFIER:"union_specifier",TYPE_DEFINITION:"type_definition",FUNCTION_DECLARATOR:"function_declarator",CLASS_SPECIFIER:"class_specifier",FIELD_EXPRESSION:"field_expression",PREPROC_INCLUDE:"preproc_include",USING_DECLARATION:"using_declaration",STRUCT_DECLARATION:"struct_declaration",RECORD_DECLARATION:"record_declaration",CONSTRUCTOR_DECLARATION:"constructor_declaration",DESTRUCTOR_DECLARATION:"destructor_declaration",CONVERSION_OPERATOR_DECLARATION:"conversion_operator_declaration",OPERATOR_DECLARATION:"operator_declaration",LOCAL_FUNCTION_STATEMENT:"local_function_statement",USING_DIRECTIVE:"using_directive",INVOCATION_EXPRESSION:"invocation_expression",OBJECT_CREATION_EXPRESSION:"object_creation_expression",BASE_LIST:"base_list",TYPE_DECLARATION:"type_declaration",TYPE_SPEC:"type_spec",FIELD_IDENTIFIER:"field_identifier",SELECTOR_EXPRESSION:"selector_expression",ANNOTATION_TYPE_DECLARATION:"annotation_type_declaration",COMPACT_CONSTRUCTOR_DECLARATION:"compact_constructor_declaration",METHOD_INVOCATION:"method_invocation",EXPLICIT_CONSTRUCTOR_INVOCATION:"explicit_constructor_invocation",SUPERCLASS:"superclass",SUPER_INTERFACES:"super_interfaces",TYPE_LIST:"type_list",GENERATOR_FUNCTION_DECLARATION:"generator_function_declaration",GENERATOR_FUNCTION:"generator_function",FUNCTION_EXPRESSION:"function_expression",PROPERTY_IDENTIFIER:"property_identifier",IMPLEMENTS_CLAUSE:"implements_clause",EXTENDS_CLAUSE:"extends_clause",TYPE_ALIAS_DECLARATION:"type_alias_declaration",CLASS_HERITAGE:"class_heritage",NAMESPACE_USE_DECLARATION:"namespace_use_declaration",INCLUDE_EXPRESSION:"include_expression",INCLUDE_ONCE_EXPRESSION:"include_once_expression",REQUIRE_EXPRESSION:"require_expression",REQUIRE_ONCE_EXPRESSION:"require_once_expression",TRAIT_DECLARATION:"trait_declaration",FUNCTION_CALL_EXPRESSION:"function_call_expression",MEMBER_CALL_EXPRESSION:"member_call_expression",SCOPED_CALL_EXPRESSION:"scoped_call_expression",NAME:"name",BASE_CLAUSE:"base_clause",CLASS_INTERFACE_CLAUSE:"class_interface_clause",IMPORT_FROM_STATEMENT:"import_from_statement",CLASS_DEFINITION:"class_definition",ARGUMENT_LIST:"argument_list",CLASS:"class",MODULE:"module",SINGLETON_CLASS:"singleton_class",METHOD:"method",SINGLETON_METHOD:"singleton_method",CONSTANT:"constant",SCOPE_RESOLUTION:"scope_resolution",BASE_CLASS_CLAUSE:"base_class_clause",QUALIFIED_IDENTIFIER:"qualified_identifier",STRUCT_ITEM:"struct_item",ENUM_ITEM:"enum_item",UNION_ITEM:"union_item",TRAIT_ITEM:"trait_item",FUNCTION_ITEM:"function_item"};var lt="tree-sitter-typescript.wasm",re={extensions:X,wasm_file:lt,imports:[t.IMPORT_STATEMENT,N.EXPORT_STATEMENT],classes:[t.CLASS_DECLARATION,t.ABSTRACT_CLASS_DECLARATION,t.INTERFACE_DECLARATION,t.ENUM_DECLARATION,t.TYPE_ALIAS_DECLARATION],functions:[t.FUNCTION_DECLARATION,t.METHOD_DEFINITION,t.ARROW_FUNCTION,t.FUNCTION_EXPRESSION,t.GENERATOR_FUNCTION_DECLARATION,t.GENERATOR_FUNCTION],calls:[t.CALL_EXPRESSION],implements:[t.IMPLEMENTS_CLAUSE],extends:[t.EXTENDS_CLAUSE],queries:{classes:`(${t.CLASS_DECLARATION} name: (${t.TYPE_IDENTIFIER})) @${a.CLASS} (${t.ABSTRACT_CLASS_DECLARATION} name: (${t.TYPE_IDENTIFIER})) @${a.CLASS} (${t.INTERFACE_DECLARATION} name: (${t.TYPE_IDENTIFIER})) @${a.CLASS} (${t.ENUM_DECLARATION} name: (${t.IDENTIFIER})) @${a.CLASS} (${t.TYPE_ALIAS_DECLARATION} name: (${t.TYPE_IDENTIFIER})) @${a.CLASS}`,functions:`(${t.FUNCTION_DECLARATION}) @${a.FUNCTION} (${t.METHOD_DEFINITION}) @${a.FUNCTION} (${t.ARROW_FUNCTION}) @${a.FUNCTION} (${t.FUNCTION_EXPRESSION}) @${a.FUNCTION} (${t.GENERATOR_FUNCTION_DECLARATION}) @${a.FUNCTION} (${t.GENERATOR_FUNCTION}) @${a.FUNCTION}`,imports:`(${t.IMPORT_STATEMENT}) @${a.IMPORT} (${N.EXPORT_STATEMENT} source: (string)) @${a.IMPORT}`,variables:`(export_statement declaration: (lexical_declaration (variable_declarator name: (${t.IDENTIFIER})) @${a.VARIABLE}))`,calls:`(${t.CALL_EXPRESSION} function: [(${t.IDENTIFIER}) (${t.MEMBER_EXPRESSION})] @${a.CALL})`,implements:`(${t.IMPLEMENTS_CLAUSE} (_) @${a.IMPLEMENTS})`,extends:`(${t.EXTENDS_CLAUSE} value: (_) @${a.EXTENDS})`}};var Et="tree-sitter-javascript.wasm",ie={extensions:v,wasm_file:Et,imports:[t.IMPORT_STATEMENT,N.EXPORT_STATEMENT],classes:[t.CLASS_DECLARATION],functions:[t.FUNCTION_DECLARATION,t.METHOD_DEFINITION,t.ARROW_FUNCTION,t.FUNCTION_EXPRESSION,t.GENERATOR_FUNCTION_DECLARATION,t.GENERATOR_FUNCTION],calls:[t.CALL_EXPRESSION],extends:[t.CLASS_HERITAGE],queries:{classes:`(${t.CLASS_DECLARATION} name: (${t.IDENTIFIER})) @${a.CLASS}`,functions:`(${t.FUNCTION_DECLARATION}) @${a.FUNCTION} (${t.METHOD_DEFINITION}) @${a.FUNCTION} (${t.ARROW_FUNCTION}) @${a.FUNCTION} (${t.FUNCTION_EXPRESSION}) @${a.FUNCTION} (${t.GENERATOR_FUNCTION_DECLARATION}) @${a.FUNCTION} (${t.GENERATOR_FUNCTION}) @${a.FUNCTION}`,imports:`(${t.IMPORT_STATEMENT}) @${a.IMPORT} (${N.EXPORT_STATEMENT} source: (string)) @${a.IMPORT}`,variables:`(export_statement declaration: (lexical_declaration (variable_declarator name: (${t.IDENTIFIER})) @${a.VARIABLE}))`,calls:`(${t.CALL_EXPRESSION} function: [(${t.IDENTIFIER}) (${t.MEMBER_EXPRESSION})] @${a.CALL})`,extends:`(${t.CLASS_HERITAGE} "extends" (_) @${a.EXTENDS})`}};var Nt="tree-sitter-python.wasm",se={extensions:k,wasm_file:Nt,imports:[t.IMPORT_STATEMENT,t.IMPORT_FROM_STATEMENT],classes:[t.CLASS_DEFINITION],functions:[t.FUNCTION_DEFINITION],calls:[t.CALL],extends:[t.CLASS_DEFINITION],queries:{classes:`(${t.CLASS_DEFINITION} name: (${t.IDENTIFIER})) @${a.CLASS}`,functions:`(${t.FUNCTION_DEFINITION} name: (${t.IDENTIFIER})) @${a.FUNCTION}`,imports:`(${t.IMPORT_STATEMENT}) @${a.IMPORT} (${t.IMPORT_FROM_STATEMENT}) @${a.IMPORT}`,calls:`(${t.CALL} function: [(${t.IDENTIFIER}) (${t.ATTRIBUTE})] @${a.CALL})`,extends:`(${t.CLASS_DEFINITION} (${t.ARGUMENT_LIST} [(${t.IDENTIFIER}) (${t.ATTRIBUTE})] @${a.EXTENDS}))`}};var It="tree-sitter-rust.wasm",ae={extensions:Y,wasm_file:It,imports:[t.USE_DECLARATION],classes:[t.STRUCT_ITEM,t.ENUM_ITEM,t.UNION_ITEM,t.TRAIT_ITEM],functions:[t.FUNCTION_ITEM],calls:[t.CALL_EXPRESSION],queries:{classes:`(${t.STRUCT_ITEM} name: (${t.TYPE_IDENTIFIER})) @${a.CLASS} (${t.ENUM_ITEM} name: (${t.TYPE_IDENTIFIER})) @${a.CLASS} (${t.UNION_ITEM} name: (${t.TYPE_IDENTIFIER})) @${a.CLASS} (${t.TRAIT_ITEM} name: (${t.TYPE_IDENTIFIER})) @${a.CLASS}`,functions:`(${t.FUNCTION_ITEM} name: (${t.IDENTIFIER})) @${a.FUNCTION}`,imports:`(${t.USE_DECLARATION}) @${a.IMPORT}`,calls:`(${t.CALL_EXPRESSION} function: [(${t.IDENTIFIER}) (${t.FIELD_EXPRESSION})] @${a.CALL})`}};var Tt="tree-sitter-go.wasm",ce={extensions:G,wasm_file:Tt,imports:[t.IMPORT_DECLARATION],classes:[t.TYPE_DECLARATION],functions:[t.FUNCTION_DECLARATION,t.METHOD_DECLARATION],calls:[t.CALL_EXPRESSION],queries:{classes:`(${t.TYPE_SPEC} name: (${t.TYPE_IDENTIFIER})) @${a.CLASS}`,functions:`(${t.FUNCTION_DECLARATION} name: (${t.IDENTIFIER})) @${a.FUNCTION} (${t.METHOD_DECLARATION} name: (${t.FIELD_IDENTIFIER})) @${a.FUNCTION}`,imports:`(${t.IMPORT_DECLARATION}) @${a.IMPORT}`,calls:`(${t.CALL_EXPRESSION} function: [(${t.IDENTIFIER}) (${t.SELECTOR_EXPRESSION})] @${a.CALL})`}};var ft="tree-sitter-java.wasm",le={extensions:H,wasm_file:ft,imports:[t.IMPORT_DECLARATION],classes:[t.CLASS_DECLARATION,t.INTERFACE_DECLARATION,t.ENUM_DECLARATION,t.ANNOTATION_TYPE_DECLARATION,t.RECORD_DECLARATION],functions:[t.METHOD_DECLARATION,t.CONSTRUCTOR_DECLARATION,t.COMPACT_CONSTRUCTOR_DECLARATION],calls:[t.METHOD_INVOCATION,t.EXPLICIT_CONSTRUCTOR_INVOCATION],extends:[t.SUPERCLASS],implements:[t.SUPER_INTERFACES],queries:{classes:`(${t.CLASS_DECLARATION} name: (${t.IDENTIFIER})) @${a.CLASS} (${t.INTERFACE_DECLARATION} name: (${t.IDENTIFIER})) @${a.CLASS} (${t.ENUM_DECLARATION} name: (${t.IDENTIFIER})) @${a.CLASS} (${t.ANNOTATION_TYPE_DECLARATION} name: (${t.IDENTIFIER})) @${a.CLASS} (${t.RECORD_DECLARATION} name: (${t.IDENTIFIER})) @${a.CLASS}`,functions:`(${t.METHOD_DECLARATION} name: (${t.IDENTIFIER})) @${a.FUNCTION} (${t.CONSTRUCTOR_DECLARATION} name: (${t.IDENTIFIER})) @${a.FUNCTION} (${t.COMPACT_CONSTRUCTOR_DECLARATION} name: (${t.IDENTIFIER})) @${a.FUNCTION}`,imports:`(${t.IMPORT_DECLARATION}) @${a.IMPORT}`,calls:`(${t.METHOD_INVOCATION} name: (${t.IDENTIFIER}) @${a.CALL}) (${t.EXPLICIT_CONSTRUCTOR_INVOCATION}) @${a.CALL}`,extends:`(${t.SUPERCLASS} (${t.TYPE_IDENTIFIER}) @${a.EXTENDS})`,implements:`(${t.SUPER_INTERFACES} (${t.TYPE_LIST} (${t.TYPE_IDENTIFIER}) @${a.IMPLEMENTS}))`}};var dt="tree-sitter-c.wasm",Ee={extensions:B,wasm_file:dt,imports:[t.PREPROC_INCLUDE],classes:[t.STRUCT_SPECIFIER,t.ENUM_SPECIFIER,t.UNION_SPECIFIER,t.TYPE_DEFINITION],functions:[t.FUNCTION_DEFINITION],calls:[t.CALL_EXPRESSION],queries:{classes:`(${t.STRUCT_SPECIFIER} name: (${t.TYPE_IDENTIFIER})) @${a.CLASS} (${t.ENUM_SPECIFIER} name: (${t.TYPE_IDENTIFIER})) @${a.CLASS} (${t.UNION_SPECIFIER} name: (${t.TYPE_IDENTIFIER})) @${a.CLASS} (${t.TYPE_DEFINITION} name: (${t.TYPE_IDENTIFIER})) @${a.CLASS}`,functions:`(${t.FUNCTION_DEFINITION} declarator: (${t.FUNCTION_DECLARATOR} declarator: (${t.IDENTIFIER}))) @${a.FUNCTION}`,imports:`(${t.PREPROC_INCLUDE}) @${a.IMPORT}`,calls:`(${t.CALL_EXPRESSION} function: (${t.IDENTIFIER}) @${a.CALL})`}};var ut="tree-sitter-cpp.wasm",Ne={extensions:Q,wasm_file:ut,imports:[t.PREPROC_INCLUDE,t.USING_DECLARATION],classes:[t.CLASS_SPECIFIER,t.STRUCT_SPECIFIER,t.ENUM_SPECIFIER,t.UNION_SPECIFIER,t.TYPE_DEFINITION],functions:[t.FUNCTION_DEFINITION],calls:[t.CALL_EXPRESSION],extends:[t.BASE_CLASS_CLAUSE],queries:{classes:`(${t.CLASS_SPECIFIER} name: (${t.TYPE_IDENTIFIER})) @${a.CLASS} (${t.STRUCT_SPECIFIER} name: (${t.TYPE_IDENTIFIER})) @${a.CLASS} (${t.ENUM_SPECIFIER} name: (${t.TYPE_IDENTIFIER})) @${a.CLASS} (${t.UNION_SPECIFIER} name: (${t.TYPE_IDENTIFIER})) @${a.CLASS} (${t.TYPE_DEFINITION} name: (${t.TYPE_IDENTIFIER})) @${a.CLASS}`,functions:`(${t.FUNCTION_DEFINITION} declarator: (${t.FUNCTION_DECLARATOR} declarator: [(${t.IDENTIFIER}) (${t.FIELD_IDENTIFIER}) (${t.QUALIFIED_IDENTIFIER})])) @${a.FUNCTION}`,imports:`(${t.PREPROC_INCLUDE}) @${a.IMPORT} (${t.USING_DECLARATION}) @${a.IMPORT}`,calls:`(${t.CALL_EXPRESSION} function: [(${t.IDENTIFIER}) (${t.FIELD_EXPRESSION})] @${a.CALL})`,extends:`(${t.BASE_CLASS_CLAUSE} (${t.TYPE_IDENTIFIER}) @${a.EXTENDS})`}};var mt="tree-sitter-ruby.wasm",Ie={extensions:V,wasm_file:mt,imports:[t.CALL],classes:[t.CLASS,t.MODULE,t.SINGLETON_CLASS],functions:[t.METHOD,t.SINGLETON_METHOD],calls:[t.CALL],extends:[t.SUPERCLASS],queries:{classes:`(${t.CLASS} name: [(${t.CONSTANT}) (${t.SCOPE_RESOLUTION})]) @${a.CLASS} (${t.MODULE} name: (${t.CONSTANT})) @${a.CLASS} (${t.SINGLETON_CLASS}) @${a.CLASS}`,functions:`(${t.METHOD} name: (${t.IDENTIFIER})) @${a.FUNCTION} (${t.SINGLETON_METHOD} name: (${t.IDENTIFIER})) @${a.FUNCTION}`,imports:`((${t.CALL} method: (${t.IDENTIFIER}) @_method) @${a.IMPORT} (#match? @_method "^(require|require_relative|load)$"))`,calls:`(${t.CALL} method: (${t.IDENTIFIER}) @${a.CALL})`,extends:`(${t.SUPERCLASS} (_) @${a.EXTENDS})`}};var _t="tree-sitter-php.wasm",Te={extensions:j,wasm_file:_t,imports:[t.NAMESPACE_USE_DECLARATION,t.INCLUDE_EXPRESSION,t.INCLUDE_ONCE_EXPRESSION,t.REQUIRE_EXPRESSION,t.REQUIRE_ONCE_EXPRESSION],classes:[t.CLASS_DECLARATION,t.INTERFACE_DECLARATION,t.TRAIT_DECLARATION,t.ENUM_DECLARATION],functions:[t.FUNCTION_DEFINITION,t.METHOD_DECLARATION],calls:[t.FUNCTION_CALL_EXPRESSION,t.MEMBER_CALL_EXPRESSION,t.SCOPED_CALL_EXPRESSION],extends:[t.BASE_CLAUSE],implements:[t.CLASS_INTERFACE_CLAUSE],queries:{classes:`(${t.CLASS_DECLARATION} name: (${t.NAME})) @${a.CLASS} (${t.INTERFACE_DECLARATION} name: (${t.NAME})) @${a.CLASS} (${t.TRAIT_DECLARATION} name: (${t.NAME})) @${a.CLASS} (${t.ENUM_DECLARATION} name: (${t.NAME})) @${a.CLASS}`,functions:`(${t.FUNCTION_DEFINITION} name: (${t.NAME})) @${a.FUNCTION} (${t.METHOD_DECLARATION} name: (${t.NAME})) @${a.FUNCTION}`,imports:`(${t.NAMESPACE_USE_DECLARATION}) @${a.IMPORT} (${t.INCLUDE_EXPRESSION}) @${a.IMPORT} (${t.INCLUDE_ONCE_EXPRESSION}) @${a.IMPORT} (${t.REQUIRE_EXPRESSION}) @${a.IMPORT} (${t.REQUIRE_ONCE_EXPRESSION}) @${a.IMPORT}`,calls:`(${t.FUNCTION_CALL_EXPRESSION} function: (${t.NAME}) @${a.CALL}) (${t.MEMBER_CALL_EXPRESSION} name: (${t.NAME}) @${a.CALL}) (${t.SCOPED_CALL_EXPRESSION} name: (${t.NAME}) @${a.CALL})`,extends:`(${t.BASE_CLAUSE} (${t.NAME}) @${a.EXTENDS})`,implements:`(${t.CLASS_INTERFACE_CLAUSE} (${t.NAME}) @${a.IMPLEMENTS})`}};var At="tree-sitter-c_sharp.wasm",fe={extensions:W,wasm_file:At,imports:[t.USING_DIRECTIVE],classes:[t.CLASS_DECLARATION,t.STRUCT_DECLARATION,t.INTERFACE_DECLARATION,t.ENUM_DECLARATION,t.RECORD_DECLARATION],functions:[t.METHOD_DECLARATION,t.CONSTRUCTOR_DECLARATION,t.DESTRUCTOR_DECLARATION,t.CONVERSION_OPERATOR_DECLARATION,t.OPERATOR_DECLARATION,t.LOCAL_FUNCTION_STATEMENT],calls:[t.INVOCATION_EXPRESSION,t.OBJECT_CREATION_EXPRESSION],extends:[t.BASE_LIST],queries:{classes:`(${t.CLASS_DECLARATION} name: (${t.IDENTIFIER})) @${a.CLASS} (${t.STRUCT_DECLARATION} name: (${t.IDENTIFIER})) @${a.CLASS} (${t.INTERFACE_DECLARATION} name: (${t.IDENTIFIER})) @${a.CLASS} (${t.ENUM_DECLARATION} name: (${t.IDENTIFIER})) @${a.CLASS} (${t.RECORD_DECLARATION} name: (${t.IDENTIFIER})) @${a.CLASS}`,functions:`(${t.METHOD_DECLARATION} name: (${t.IDENTIFIER})) @${a.FUNCTION} (${t.CONSTRUCTOR_DECLARATION} name: (${t.IDENTIFIER})) @${a.FUNCTION} (${t.DESTRUCTOR_DECLARATION}) @${a.FUNCTION} (${t.CONVERSION_OPERATOR_DECLARATION}) @${a.FUNCTION} (${t.OPERATOR_DECLARATION}) @${a.FUNCTION} (${t.LOCAL_FUNCTION_STATEMENT}) @${a.FUNCTION}`,imports:`(${t.USING_DIRECTIVE}) @${a.IMPORT}`,calls:`(${t.INVOCATION_EXPRESSION}) @${a.CALL} (${t.OBJECT_CREATION_EXPRESSION}) @${a.CALL}`,extends:`(${t.BASE_LIST} (_) @${a.EXTENDS})`}};var pt={languages:{[u.TYPESCRIPT]:re,[u.JAVASCRIPT]:ie,[u.PYTHON]:se,[u.RUST]:ae,[u.GO]:ce,[u.JAVA]:le,[u.C]:Ee,[u.CPP]:Ne,[u.RUBY]:Ie,[u.PHP]:Te,[u.CSHARP]:fe}};async function xo(n){return U.load(n,pt)}import{Parser as vo,Language as ko}from"web-tree-sitter";var P;(function(n){n[n.INTERNAL_LOGIC=0]="INTERNAL_LOGIC",n[n.CONTRACT_CHANGED=1]="CONTRACT_CHANGED"})(P||(P={}));var de=new Set([N.FUNCTION_DECLARATION,N.METHOD_DEFINITION,N.ARROW_FUNCTION,N.CLASS_DECLARATION,N.INTERFACE_DECLARATION,N.TYPE_ALIAS_DECLARATION,N.EXPORT_STATEMENT,N.LEXICAL_DECLARATION,N.VARIABLE_DECLARATION]),ue=class{parser;lang;constructor(e,o){this.parser=e,this.lang=o,this.parser.setLanguage(this.lang)}analyze(e,o,r){let i=this.parser.parse(e),s=this.parser.parse(o);if(!i||!s)return i&&i.delete(),s&&s.delete(),[];let c=[];try{let l=this.buildNodeIndex(i.rootNode),I=new Set;for(let E of r)c.push(...this.processChangedRange(E,s.rootNode,l,I))}finally{i&&i.delete(),s&&s.delete()}return c}processChangedRange(e,o,r,i){let s=this.getSmallestContainingNode(o,e);if(!s)return[];let c=this.findSemanticBoundary(s);if(!c)return this.resolveSpanningBoundaries(s,e,r,i);let l=this.buildModifiedNode(c,r,i);return l?[l]:[]}resolveSpanningBoundaries(e,o,r,i){let s=[];for(let c of e.children){if(!c||c.endPosition.row<o.startRow||c.startPosition.row>o.endRow)continue;let l={startRow:Math.max(o.startRow,c.startPosition.row),endRow:Math.min(o.endRow,c.endPosition.row)},I=this.getSmallestContainingNode(c,l);if(!I)continue;let E=this.findSemanticBoundary(I);if(!E)continue;let f=this.buildModifiedNode(E,r,i);f&&s.push(f)}return s}buildModifiedNode(e,o,r){if(r.has(e.id))return null;r.add(e.id);let i=this.getNodeName(e),s=i?o.get(`${e.type}::${i}`):void 0,c=this.resolvePruningLevel(s,e);return{nodeId:i||e.id.toString(),nodeType:e.type,pruningLevel:c,newRange:{startRow:e.startPosition.row,endRow:e.endPosition.row}}}resolvePruningLevel(e,o){if(!e)return P.CONTRACT_CHANGED;let r=this.getSignature(e),i=this.getSignature(o);return r===i?P.INTERNAL_LOGIC:P.CONTRACT_CHANGED}buildNodeIndex(e){let o=new Map,r=i=>{if(de.has(i.type)){let s=this.getNodeName(i),c=s?`${i.type}::${s}`:null;c&&!o.has(c)&&o.set(c,i)}for(let s of i.children)s&&r(s)};return r(e),o}getSmallestContainingNode(e,o){if(e.startPosition.row>o.endRow||e.endPosition.row<o.startRow)return null;if(e.startPosition.row<=o.startRow&&e.endPosition.row>=o.endRow){for(let r of e.children){if(!r)continue;let i=this.getSmallestContainingNode(r,o);if(i)return i}return e}return null}findSemanticBoundary(e){let o=e;for(;o;){if(de.has(o.type))return o;o=o.parent}return null}getNodeName(e){let o=e.childForFieldName("name");if(o)return o.text;if(e.type===N.VARIABLE_DECLARATION||e.type===N.LEXICAL_DECLARATION){let r=e.children.find(i=>i.type===N.VARIABLE_DECLARATOR);if(r){let i=r.childForFieldName("name");if(i)return i.text}}return null}getSignature(e){let o=e.childForFieldName("body")||e.childForFieldName("value");if(e.type===N.VARIABLE_DECLARATION||e.type===N.LEXICAL_DECLARATION){let r=e.children.find(i=>i.type===N.VARIABLE_DECLARATOR);if(r){let i=r.childForFieldName("value");if(i&&i.type===N.ARROW_FUNCTION){let s=i.childForFieldName("body");if(s)return this.getTextExcludingNode(e,s)}}}return o?this.getTextExcludingNode(e,o):e.text}getTextExcludingNode(e,o){let r=[],i=s=>{if(s.id!==o.id)if(s.childCount===0)r.push(s.text);else for(let c of s.children)c&&i(c)};return i(e),r.join(" ").trim().replace(/\s+/g," ")}};import*as _ from"path";import*as b from"fs";import{createRequire as Ct}from"module";import{fileURLToPath as Ot}from"url";var St=Ot(import.meta.url),w=_.dirname(St),Rt=Ct(import.meta.url);function Fr(n){let e=_.resolve(w,"../../../../"),o=[];try{let i=Rt.resolve("tree-sitter-wasms/package.json",{paths:[w,e]}),s=_.join(_.dirname(i),"out",n);if(o.push(s),b.existsSync(s))return{wasmPath:s,attemptedPaths:o}}catch{}let r=[_.resolve(e,`node_modules/tree-sitter-wasms/out/${n}`),_.resolve(w,`../../../node_modules/tree-sitter-wasms/out/${n}`),_.resolve(e,`node_modules/.pnpm/tree-sitter-wasms@0.1.13/node_modules/tree-sitter-wasms/out/${n}`),_.resolve(e,`artifacts/vscode-client/out/wasm/${n}`)];for(let i of r)if(o.push(i),b.existsSync(i))return{wasmPath:i,attemptedPaths:o};return{wasmPath:r[r.length-1],attemptedPaths:o}}export{q as a,Dt as b,Pt as c,Ft as d,yt as e,xo as f,ue as g,Fr as h};
23
+ /*! Bundled license information:
24
+
25
+ smol-toml/dist/date.js:
26
+ smol-toml/dist/error.js:
27
+ smol-toml/dist/primitive.js:
28
+ smol-toml/dist/util.js:
29
+ smol-toml/dist/extract.js:
30
+ smol-toml/dist/struct.js:
31
+ smol-toml/dist/parse.js:
32
+ smol-toml/dist/stringify.js:
33
+ smol-toml/dist/index.js:
34
+ (*!
35
+ * Copyright (c) Squirrel Chat et al., All rights reserved.
36
+ * SPDX-License-Identifier: BSD-3-Clause
37
+ *
38
+ * Redistribution and use in source and binary forms, with or without
39
+ * modification, are permitted provided that the following conditions are met:
40
+ *
41
+ * 1. Redistributions of source code must retain the above copyright notice, this
42
+ * list of conditions and the following disclaimer.
43
+ * 2. Redistributions in binary form must reproduce the above copyright notice,
44
+ * this list of conditions and the following disclaimer in the
45
+ * documentation and/or other materials provided with the distribution.
46
+ * 3. Neither the name of the copyright holder nor the names of its contributors
47
+ * may be used to endorse or promote products derived from this software without
48
+ * specific prior written permission.
49
+ *
50
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
51
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
52
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
53
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
54
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
55
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
56
+ * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
57
+ * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
58
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
59
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
60
+ *)
61
+ */
62
+ //# sourceMappingURL=chunk-ZROS4Z3Z.js.map