energy-state-analyzer 0.1.0
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/LICENSE +21 -0
- package/README.md +116 -0
- package/dist/cli.js +1 -0
- package/dist/cli.js.map +1 -0
- package/grammars/tree-sitter-fsharp.wasm +0 -0
- package/grammars/tree-sitter-python.wasm +0 -0
- package/grammars/tree-sitter-typescript.wasm +0 -0
- package/package.json +169 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Dag Brattli
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
# Energy State Analyzer
|
|
2
|
+
|
|
3
|
+
Visualizes "energy states" in Python, F#, and TypeScript code as you edit: parts of a file that are complex, deeply nested, or otherwise harder to understand and maintain get highlighted with colored gutter icons, inline decorations, and entries in the Problems panel.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **Real-time analysis** of the active Python, F#, or TypeScript file, re-run on every edit and on editor focus change.
|
|
8
|
+
- **Cyclomatic complexity** — flags functions with too many independent execution paths (`if`/`for`/`while`/`except`/boolean operators/ternaries all count equally, regardless of nesting).
|
|
9
|
+
- **Cognitive complexity** — flags functions that are hard to *read*, weighting each decision point by how deeply it's nested and not penalizing early-return guard clauses.
|
|
10
|
+
- **Excessive nesting** — flags `if`/`for`/`while`/`with` blocks nested more than 3 levels deep.
|
|
11
|
+
- **File coherence** — flags files with too many functions or imports (a sign of "utils/helpers sprawl"), and separately flags files with too many large functions (regardless of total function count, so languages like F# with many small functions per module aren't penalized).
|
|
12
|
+
- **Magic values** — flags suspicious numeric/string literals used outside of a constant definition.
|
|
13
|
+
- **Parameter explosion** — flags functions with more than 5 parameters.
|
|
14
|
+
- **Inversion opportunities** — flags large dominant `if` blocks and nested validation chains that could be rewritten as guard clauses with early returns.
|
|
15
|
+
- **Primitive obsession** — flags consecutive same-typed primitive parameters (e.g. `lat: float, lon: float`) that callers can silently swap, and variables compared against 3+ distinct string literals (a de facto enum encoded as strings). Runs on Python, F#, and TypeScript; Python additionally flags a variable checked against a literal tuple/list/set in one `in` expression, since F# and TypeScript have no direct equivalent construct.
|
|
16
|
+
- **Match opportunities** — flags an `if`/`elif`/`elif` chain (or TypeScript's nested `else if`) of 3 or more branches that all compare the same single variable to a literal, suggesting a `match`/`switch` statement instead. Runs on Python, F#, and TypeScript.
|
|
17
|
+
- **Logical operator as control flow** — flags a bare `condition && doSomething()` (or `condition || fallback()`) statement, an `if` hidden behind a boolean operator instead of written as one. Runs on Python and TypeScript; not on F#, which has no such statement-level idiom in its grammar.
|
|
18
|
+
|
|
19
|
+
Violations are shown three ways:
|
|
20
|
+
|
|
21
|
+
- A colored background + gutter lightning-bolt icon on the affected lines (orange = high severity, gold = medium, green = low; colors are configurable, see Extension Settings).
|
|
22
|
+
- A hover tooltip explaining the specific violation.
|
|
23
|
+
- An entry in the Problems panel, sourced as "Energy State Analyzer".
|
|
24
|
+
|
|
25
|
+
For functions flagged as too complex (cyclomatic or cognitive), a progressive red heatmap is also painted across the function body: each contributing line (an `if`, `for`, `and`, etc.) is shaded from light to dark red based on how much it drives up that function's complexity relative to its own worst line — so you can see exactly which branches to break apart first, instead of just knowing the function as a whole is complex.
|
|
26
|
+
|
|
27
|
+
## Energy and Entropy
|
|
28
|
+
|
|
29
|
+
The name is a deliberate analogy to thermodynamics, not just a metaphor for "bad code."
|
|
30
|
+
|
|
31
|
+
In physics, energy constrains which microstates a system can occupy, and entropy counts how many of those microstates are compatible with what we observe: `S(E) = k_B ln Ω(E)`. Adding energy usually increases entropy, because there are more ways to distribute it, but *how* it's distributed matters just as much as how much there is. A hot object next to a cold one has lower entropy than the same total energy spread evenly across both, which is why heat spontaneously flows from hot to cold: the system moves toward the macrostate with more compatible microstates.
|
|
32
|
+
|
|
33
|
+
Code behaves the same way. A function's "energy" here is its cyclomatic/cognitive complexity, nesting depth, parameter count, and so on: the raw amount of decision-making and structure packed into it. Its "entropy" is the number of ways a reader can misunderstand it, the number of code paths a change can silently break, and the number of mental states a maintainer has to hold at once to reason about it correctly. Just as in physics, higher energy tends to raise entropy: a function with more branches and deeper nesting generally has more ways to go wrong. But it's not purely amount, *how* that complexity is arranged matters too:
|
|
34
|
+
|
|
35
|
+
- A long function with 20 sequential, flat `if`s is high cyclomatic complexity but comparatively low entropy: each branch is independent and easy to reason about in isolation (the "evenly spread" case).
|
|
36
|
+
- The same 20 decision points nested five deep inside each other is high *cognitive* complexity: the reader must hold all five levels in mind simultaneously, which is a much higher-entropy (harder to predict, easier to break) arrangement of the same energy.
|
|
37
|
+
|
|
38
|
+
This is why the extension tracks cyclomatic and cognitive complexity as separate metrics rather than one score: they capture the *energy* and its *arrangement* respectively. Guard clauses, extracted functions, and early returns don't necessarily remove energy from a codebase; they redistribute it into a lower-entropy arrangement, the code equivalent of letting a hot and cold object equilibrate: same total energy, fewer surprising configurations, easier to hold a correct mental model of.
|
|
39
|
+
|
|
40
|
+
Entropy here also depends on the observer, not just the code. A function's energy is fixed by what's written, but its entropy, the number of arrangements consistent with what someone currently knows, can grow over time even if the code never changes: the original author forgets the reasoning, or a new developer inherits the file with no context. This detector only measures the static, code-side half of that (the energy and its arrangement); the knowledge-decay half is a reason to keep energy low in the first place, since low-entropy code is cheaper to relearn from scratch.
|
|
41
|
+
|
|
42
|
+
## Cyclomatic Complexity
|
|
43
|
+
|
|
44
|
+
Counts the number of independent paths through a function. Starting from a base of **1**, every decision point adds **+1**, regardless of how deeply it's nested:
|
|
45
|
+
|
|
46
|
+
- `if` / `elif` / `while` / `for` / `except`
|
|
47
|
+
- `and` / `or`
|
|
48
|
+
- ternary (`a if cond else b`)
|
|
49
|
+
|
|
50
|
+
Two functions with the same number of `if`s score the same, whether those `if`s are sequential or nested five deep — it measures *how many paths exist*, not how hard the code is to follow.
|
|
51
|
+
|
|
52
|
+
## Cognitive Complexity
|
|
53
|
+
|
|
54
|
+
Modeled on [SonarSource's metric](https://www.sonarsource.com/resources/cognitive-complexity/): it measures how hard a function is to *read*, so nesting is penalized and straight-line control flow isn't.
|
|
55
|
+
|
|
56
|
+
- Each decision point (`if`, `elif`, `for`, `while`, `except`, ternary, nested `def`/`lambda`) adds **1 + current nesting depth**.
|
|
57
|
+
- `else` adds a flat **+1** — no nesting penalty, since it doesn't add a new branch to reason about.
|
|
58
|
+
- Nesting depth only increases when descending into a block body, so an `if` inside two other `if`s scores higher than three sequential `if`s at the top level, even though both have the same cyclomatic complexity.
|
|
59
|
+
- Chained boolean operators of the same kind (`a and b and c`) count as a **single** increment rather than one per operator; mixing `and`/`or` starts a new increment.
|
|
60
|
+
|
|
61
|
+
This project's implementation is a simplified first pass on the SonarSource spec: `for`/`while` `else` clauses are scored like `if`/`else`, boolean-chain merging only looks at the immediate parent operator, and recursive calls aren't specially detected.
|
|
62
|
+
|
|
63
|
+
## Command-Line Usage
|
|
64
|
+
|
|
65
|
+
The same detectors also run headlessly, without VS Code — useful for CI or for an AI coding agent that wants to check the complexity of code it just generated and keep refactoring until it's clean. Published to npm, so no clone or install step is required:
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
npx energy-state-analyzer path/to/file.py # or .fs / .fsx / .ts
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Or install it as a project/global dependency and call it directly:
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
npm install --save-dev energy-state-analyzer
|
|
75
|
+
npx energy-state-analyzer path/to/file.py
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
It prints violations as JSON to stdout and exits `1` if any medium/high-severity violation was found (`0` otherwise), so it can gate a loop:
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
npx energy-state-analyzer path/to/file.py \
|
|
82
|
+
--medium-cyclomatic 8 --high-cyclomatic 12 \
|
|
83
|
+
--medium-cognitive 12 --high-cognitive 20
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
All threshold flags are optional: `--medium-nesting`, `--high-nesting`, `--medium-cyclomatic`, `--high-cyclomatic`, `--medium-cognitive`, `--high-cognitive`.
|
|
87
|
+
|
|
88
|
+
## Requirements
|
|
89
|
+
|
|
90
|
+
The extension activates automatically when you open a Python, F#, or TypeScript file; it bundles its own grammars for parsing (via `web-tree-sitter`), so no external tools are required. F# files only get a `fsharp` language ID (and so trigger analysis) if you have an F# language extension installed (e.g. [Ionide](https://ionide.io/)) — VS Code otherwise treats `.fs` files as plain text.
|
|
91
|
+
|
|
92
|
+
## Extension Settings
|
|
93
|
+
|
|
94
|
+
Detector thresholds are configurable under **Settings → Energy State Analyzer**:
|
|
95
|
+
|
|
96
|
+
- `energyStateAnalyzer.cyclomaticComplexity.mediumThreshold` / `.highThreshold`
|
|
97
|
+
- `energyStateAnalyzer.cognitiveComplexity.mediumThreshold` / `.highThreshold`
|
|
98
|
+
- `energyStateAnalyzer.coherence.largeFunctionLines` — line count above which a function counts as "large" (default `20`).
|
|
99
|
+
- `energyStateAnalyzer.coherence.maxLargeFunctions` — number of large functions a file can contain before it's flagged (default `5`).
|
|
100
|
+
- `energyStateAnalyzer.matchOpportunity.minBranches` — number of branches an if/elif chain must have, all keyed on the same variable, before it's flagged as a match/switch opportunity (default `3`).
|
|
101
|
+
- `energyStateAnalyzer.magicValues.enabled` — whether to flag magic numbers and message-shaped string literals (default `true`).
|
|
102
|
+
- `energyStateAnalyzer.colors.highEnergy` / `.mediumEnergy` / `.lowEnergy` — hex colors for the high/medium/low severity background tint and gutter icon (defaults `#fb8500` orange, `#ffb703` gold, `#99dd99` green).
|
|
103
|
+
- `energyStateAnalyzer.colors.backgroundOpacity` — opacity of the severity background tint (default `0.1`).
|
|
104
|
+
|
|
105
|
+
Changes take effect immediately on the active editor.
|
|
106
|
+
|
|
107
|
+
## Commands
|
|
108
|
+
|
|
109
|
+
- **Energy State Analyzer: Analyze Energy State** (`energy-state-analyzer.analyze`) — manually re-run analysis on the active editor.
|
|
110
|
+
|
|
111
|
+
## Known Issues
|
|
112
|
+
|
|
113
|
+
- Nesting depth and parameter count thresholds are not yet configurable — only cyclomatic complexity, cognitive complexity, the large-function coherence check, the match-opportunity branch count, and the magic-value detector's on/off switch are.
|
|
114
|
+
- The inversion-opportunities detector only fires for Python and TypeScript; F#'s grammar has no block-boundary node to anchor that heuristic on (see Architecture).
|
|
115
|
+
- TypeScript arrow functions aren't analyzed by complexity/parameter-count/coherence (same limitation Python already has for `lambda`) — only named `function` declarations and class methods are.
|
|
116
|
+
- The primitive-obsession detector's `in (a, b, c)`-style membership check only runs on Python; F#'s grammar has no direct equivalent, and TypeScript's idiom (`[...].includes(x)`) is a call expression rather than a comparison node.
|
package/dist/cli.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(()=>{"use strict";var __webpack_modules__={58:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.analyzeCognitiveComplexity=t.DEFAULT_COGNITIVE_THRESHOLDS=t.findCognitiveHotspots=t.calculateCognitiveComplexity=void 0;const s=r(613);function n(e,t,r){let s=0;const{nodeTypes:n}=t;function a(e,t){s+=t,r?.(e,t)}function _(e,r){for(const s of e.children)o(s,t.entersNestedScope(s)?r+1:r)}function o(e,r){const s=t.getBooleanOperator(e);if(s){t.getBooleanOperator(e.parent)!==s&&a(e,1);for(const t of e.children)o(t,r)}else{if(t.cognitiveNestedDecisionTypes.includes(e.type))return a(e,1+r),void _(e,r);if(e.type===n.elseClause)return a(e,1),void _(e,r);if(e.type!==n.conditionalExpression)if(t.isFunctionDefinition(e))a(e,1+r);else{if(e.type===n.lambda)return a(e,1+r),void _(e,r);for(const t of e.children||[])o(t,r)}else{a(e,1+r);for(const t of e.children)o(t,r+1)}}}for(const t of e.children)o(t,0);return s}function a(e,t,r){const s=[];return n(e,r,(e,r)=>{s.push({line:t.toPosition(e.startIndex).line,weight:r})}),s}t.calculateCognitiveComplexity=n,t.findCognitiveHotspots=a,t.DEFAULT_COGNITIVE_THRESHOLDS={mediumThreshold:15,highThreshold:25},t.analyzeCognitiveComplexity=function(e,r,_,o=t.DEFAULT_COGNITIVE_THRESHOLDS){const i=[];return function e(t){if(_.isFunctionDefinition(t)){const e=n(t,_);if(e>o.mediumThreshold){const n=r.toPosition(t.startIndex);i.push({line:n.line,column:n.column,type:s.VIOLATION_TYPE.COGNITIVE,severity:e>o.highThreshold?s.SEVERITY.HIGH:s.SEVERITY.MEDIUM,message:`High cognitive complexity: ${e}. This function is hard to read; consider flattening nesting or extracting functions.`,hotspots:a(t,r,_)})}}for(const r of t.children)e(r)}(e.rootNode),i}},78:(module,exports,__webpack_require__)=>{var __WEBPACK_AMD_DEFINE_ARRAY__,__WEBPACK_AMD_DEFINE_RESULT__,__create=Object.create,__defProp=Object.defineProperty,__getOwnPropDesc=Object.getOwnPropertyDescriptor,__getOwnPropNames=Object.getOwnPropertyNames,__getProtoOf=Object.getPrototypeOf,__hasOwnProp=Object.prototype.hasOwnProperty,__name=(e,t)=>__defProp(e,"name",{value:t,configurable:!0}),__commonJS=(e,t)=>function(){return t||(0,e[__getOwnPropNames(e)[0]])((t={exports:{}}).exports,t),t.exports},__export=(e,t)=>{for(var r in t)__defProp(e,r,{get:t[r],enumerable:!0})},__copyProps=(e,t,r,s)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let n of __getOwnPropNames(t))__hasOwnProp.call(e,n)||n===r||__defProp(e,n,{get:()=>t[n],enumerable:!(s=__getOwnPropDesc(t,n))||s.enumerable});return e},__toESM=(e,t,r)=>(r=null!=e?__create(__getProtoOf(e)):{},__copyProps(!t&&e&&e.__esModule?r:__defProp(r,"default",{value:e,enumerable:!0}),e)),__toCommonJS=e=>__copyProps(__defProp({},"__esModule",{value:!0}),e),require_tree_sitter=__commonJS({"lib/tree-sitter.cjs"(exports,module){var Module=(()=>{var _scriptName="undefined"!=typeof document?document.currentScript?.src:void 0;return _scriptName=_scriptName||__filename,async function(moduleArg={}){var moduleRtn,Module=moduleArg,readyPromiseResolve,readyPromiseReject,readyPromise=new Promise((e,t)=>{readyPromiseResolve=e,readyPromiseReject=t}),ENVIRONMENT_IS_WEB="object"==typeof window,ENVIRONMENT_IS_WORKER="undefined"!=typeof WorkerGlobalScope,ENVIRONMENT_IS_NODE="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node&&"renderer"!=process.type,ENVIRONMENT_IS_SHELL=!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_NODE&&!ENVIRONMENT_IS_WORKER;Module.currentQueryProgressCallback=null,Module.currentProgressCallback=null,Module.currentLogCallback=null,Module.currentParseCallback=null;var moduleOverrides=Object.assign({},Module),arguments_=[],thisProgram="./this.program",quit_=__name((e,t)=>{throw t},"quit_"),scriptDirectory="",readAsync,readBinary;function locateFile(e){return Module.locateFile?Module.locateFile(e,scriptDirectory):scriptDirectory+e}if(__name(locateFile,"locateFile"),ENVIRONMENT_IS_NODE){var fs=__webpack_require__(896),nodePath=__webpack_require__(928);scriptDirectory=__dirname+"/",readBinary=__name(e=>(e=isFileURI(e)?new URL(e):e,fs.readFileSync(e)),"readBinary"),readAsync=__name(async(e,t=!0)=>(e=isFileURI(e)?new URL(e):e,fs.readFileSync(e,t?void 0:"utf8")),"readAsync"),!Module.thisProgram&&process.argv.length>1&&(thisProgram=process.argv[1].replace(/\\/g,"/")),arguments_=process.argv.slice(2),quit_=__name((e,t)=>{throw process.exitCode=e,t},"quit_")}else(ENVIRONMENT_IS_WEB||ENVIRONMENT_IS_WORKER)&&(ENVIRONMENT_IS_WORKER?scriptDirectory=self.location.href:"undefined"!=typeof document&&document.currentScript&&(scriptDirectory=document.currentScript.src),_scriptName&&(scriptDirectory=_scriptName),scriptDirectory=scriptDirectory.startsWith("blob:")?"":scriptDirectory.slice(0,scriptDirectory.replace(/[?#].*/,"").lastIndexOf("/")+1),ENVIRONMENT_IS_WORKER&&(readBinary=__name(e=>{var t=new XMLHttpRequest;return t.open("GET",e,!1),t.responseType="arraybuffer",t.send(null),new Uint8Array(t.response)},"readBinary")),readAsync=__name(async e=>{if(isFileURI(e))return new Promise((t,r)=>{var s=new XMLHttpRequest;s.open("GET",e,!0),s.responseType="arraybuffer",s.onload=()=>{200==s.status||0==s.status&&s.response?t(s.response):r(s.status)},s.onerror=r,s.send(null)});var t=await fetch(e,{credentials:"same-origin"});if(t.ok)return t.arrayBuffer();throw new Error(t.status+" : "+t.url)},"readAsync"));var out=Module.print||console.log.bind(console),err=Module.printErr||console.error.bind(console);Object.assign(Module,moduleOverrides),moduleOverrides=null,Module.arguments&&(arguments_=Module.arguments),Module.thisProgram&&(thisProgram=Module.thisProgram);var dynamicLibraries=Module.dynamicLibraries||[],wasmBinary=Module.wasmBinary,wasmMemory,ABORT=!1,EXITSTATUS,HEAP,HEAP8,HEAPU8,HEAP16,HEAPU16,HEAP32,HEAPU32,HEAPF32,HEAP64,HEAPU64,HEAPF64,HEAP_DATA_VIEW;function assert(e,t){e||abort(t)}__name(assert,"assert");var runtimeInitialized=!1,isFileURI=__name(e=>e.startsWith("file://"),"isFileURI");function updateMemoryViews(){var e=wasmMemory.buffer;Module.HEAP_DATA_VIEW=HEAP_DATA_VIEW=new DataView(e),Module.HEAP8=HEAP8=new Int8Array(e),Module.HEAP16=HEAP16=new Int16Array(e),Module.HEAPU8=HEAPU8=new Uint8Array(e),Module.HEAPU16=HEAPU16=new Uint16Array(e),Module.HEAP32=HEAP32=new Int32Array(e),Module.HEAPU32=HEAPU32=new Uint32Array(e),Module.HEAPF32=HEAPF32=new Float32Array(e),Module.HEAPF64=HEAPF64=new Float64Array(e),Module.HEAP64=HEAP64=new BigInt64Array(e),Module.HEAPU64=HEAPU64=new BigUint64Array(e)}if(__name(updateMemoryViews,"updateMemoryViews"),Module.wasmMemory)wasmMemory=Module.wasmMemory;else{var INITIAL_MEMORY=Module.INITIAL_MEMORY||33554432;wasmMemory=new WebAssembly.Memory({initial:INITIAL_MEMORY/65536,maximum:32768})}updateMemoryViews();var __RELOC_FUNCS__=[];function preRun(){if(Module.preRun)for("function"==typeof Module.preRun&&(Module.preRun=[Module.preRun]);Module.preRun.length;)addOnPreRun(Module.preRun.shift());callRuntimeCallbacks(onPreRuns)}function initRuntime(){runtimeInitialized=!0,callRuntimeCallbacks(__RELOC_FUNCS__),wasmExports.__wasm_call_ctors(),callRuntimeCallbacks(onPostCtors)}function preMain(){}function postRun(){if(Module.postRun)for("function"==typeof Module.postRun&&(Module.postRun=[Module.postRun]);Module.postRun.length;)addOnPostRun(Module.postRun.shift());callRuntimeCallbacks(onPostRuns)}__name(preRun,"preRun"),__name(initRuntime,"initRuntime"),__name(preMain,"preMain"),__name(postRun,"postRun");var runDependencies=0,dependenciesFulfilled=null,wasmBinaryFile;function getUniqueRunDependency(e){return e}function addRunDependency(e){runDependencies++,Module.monitorRunDependencies?.(runDependencies)}function removeRunDependency(e){if(runDependencies--,Module.monitorRunDependencies?.(runDependencies),0==runDependencies&&dependenciesFulfilled){var t=dependenciesFulfilled;dependenciesFulfilled=null,t()}}function abort(e){Module.onAbort?.(e),err(e="Aborted("+e+")"),ABORT=!0,e+=". Build with -sASSERTIONS for more info.";var t=new WebAssembly.RuntimeError(e);throw readyPromiseReject(t),t}function findWasmBinary(){return locateFile("tree-sitter.wasm")}function getBinarySync(e){if(e==wasmBinaryFile&&wasmBinary)return new Uint8Array(wasmBinary);if(readBinary)return readBinary(e);throw"both async and sync fetching of the wasm failed"}async function getWasmBinary(e){if(!wasmBinary)try{var t=await readAsync(e);return new Uint8Array(t)}catch{}return getBinarySync(e)}async function instantiateArrayBuffer(e,t){try{var r=await getWasmBinary(e);return await WebAssembly.instantiate(r,t)}catch(e){err(`failed to asynchronously prepare wasm: ${e}`),abort(e)}}async function instantiateAsync(e,t,r){if(!e&&"function"==typeof WebAssembly.instantiateStreaming&&!isFileURI(t)&&!ENVIRONMENT_IS_NODE)try{var s=fetch(t,{credentials:"same-origin"});return await WebAssembly.instantiateStreaming(s,r)}catch(e){err(`wasm streaming compile failed: ${e}`),err("falling back to ArrayBuffer instantiation")}return instantiateArrayBuffer(t,r)}function getWasmImports(){return{env:wasmImports,wasi_snapshot_preview1:wasmImports,"GOT.mem":new Proxy(wasmImports,GOTHandler),"GOT.func":new Proxy(wasmImports,GOTHandler)}}async function createWasm(){function e(e,t){wasmExports=e.exports,wasmExports=relocateExports(wasmExports,1024);var r=getDylinkMetadata(t);return r.neededDynlibs&&(dynamicLibraries=r.neededDynlibs.concat(dynamicLibraries)),mergeLibSymbols(wasmExports,"main"),LDSO.init(),loadDylibs(),__RELOC_FUNCS__.push(wasmExports.__wasm_apply_data_relocs),removeRunDependency("wasm-instantiate"),wasmExports}function t(t){return e(t.instance,t.module)}__name(e,"receiveInstance"),addRunDependency("wasm-instantiate"),__name(t,"receiveInstantiationResult");var r=getWasmImports();if(Module.instantiateWasm)return new Promise((t,s)=>{Module.instantiateWasm(r,(r,s)=>{e(r,s),t(r.exports)})});wasmBinaryFile??=findWasmBinary();try{return t(await instantiateAsync(wasmBinary,wasmBinaryFile,r))}catch(e){return readyPromiseReject(e),Promise.reject(e)}}__name(getUniqueRunDependency,"getUniqueRunDependency"),__name(addRunDependency,"addRunDependency"),__name(removeRunDependency,"removeRunDependency"),__name(abort,"abort"),__name(findWasmBinary,"findWasmBinary"),__name(getBinarySync,"getBinarySync"),__name(getWasmBinary,"getWasmBinary"),__name(instantiateArrayBuffer,"instantiateArrayBuffer"),__name(instantiateAsync,"instantiateAsync"),__name(getWasmImports,"getWasmImports"),__name(createWasm,"createWasm");var ASM_CONSTS={};class ExitStatus{static{__name(this,"ExitStatus")}name="ExitStatus";constructor(e){this.message=`Program terminated with exit(${e})`,this.status=e}}var GOT={},currentModuleWeakSymbols=new Set([]),GOTHandler={get(e,t){var r=GOT[t];return r||(r=GOT[t]=new WebAssembly.Global({value:"i32",mutable:!0})),currentModuleWeakSymbols.has(t)||(r.required=!0),r}},LE_HEAP_LOAD_F32=__name(e=>HEAP_DATA_VIEW.getFloat32(e,!0),"LE_HEAP_LOAD_F32"),LE_HEAP_LOAD_F64=__name(e=>HEAP_DATA_VIEW.getFloat64(e,!0),"LE_HEAP_LOAD_F64"),LE_HEAP_LOAD_I16=__name(e=>HEAP_DATA_VIEW.getInt16(e,!0),"LE_HEAP_LOAD_I16"),LE_HEAP_LOAD_I32=__name(e=>HEAP_DATA_VIEW.getInt32(e,!0),"LE_HEAP_LOAD_I32"),LE_HEAP_LOAD_U16=__name(e=>HEAP_DATA_VIEW.getUint16(e,!0),"LE_HEAP_LOAD_U16"),LE_HEAP_LOAD_U32=__name(e=>HEAP_DATA_VIEW.getUint32(e,!0),"LE_HEAP_LOAD_U32"),LE_HEAP_STORE_F32=__name((e,t)=>HEAP_DATA_VIEW.setFloat32(e,t,!0),"LE_HEAP_STORE_F32"),LE_HEAP_STORE_F64=__name((e,t)=>HEAP_DATA_VIEW.setFloat64(e,t,!0),"LE_HEAP_STORE_F64"),LE_HEAP_STORE_I16=__name((e,t)=>HEAP_DATA_VIEW.setInt16(e,t,!0),"LE_HEAP_STORE_I16"),LE_HEAP_STORE_I32=__name((e,t)=>HEAP_DATA_VIEW.setInt32(e,t,!0),"LE_HEAP_STORE_I32"),LE_HEAP_STORE_U16=__name((e,t)=>HEAP_DATA_VIEW.setUint16(e,t,!0),"LE_HEAP_STORE_U16"),LE_HEAP_STORE_U32=__name((e,t)=>HEAP_DATA_VIEW.setUint32(e,t,!0),"LE_HEAP_STORE_U32"),callRuntimeCallbacks=__name(e=>{for(;e.length>0;)e.shift()(Module)},"callRuntimeCallbacks"),onPostRuns=[],addOnPostRun=__name(e=>onPostRuns.unshift(e),"addOnPostRun"),onPreRuns=[],addOnPreRun=__name(e=>onPreRuns.unshift(e),"addOnPreRun"),UTF8Decoder="undefined"!=typeof TextDecoder?new TextDecoder:void 0,UTF8ArrayToString=__name((e,t=0,r=NaN)=>{for(var s=t+r,n=t;e[n]&&!(n>=s);)++n;if(n-t>16&&e.buffer&&UTF8Decoder)return UTF8Decoder.decode(e.subarray(t,n));for(var a="";t<n;){var _=e[t++];if(128&_){var o=63&e[t++];if(192!=(224&_)){var i=63&e[t++];if((_=224==(240&_)?(15&_)<<12|o<<6|i:(7&_)<<18|o<<12|i<<6|63&e[t++])<65536)a+=String.fromCharCode(_);else{var l=_-65536;a+=String.fromCharCode(55296|l>>10,56320|1023&l)}}else a+=String.fromCharCode((31&_)<<6|o)}else a+=String.fromCharCode(_)}return a},"UTF8ArrayToString"),getDylinkMetadata=__name(e=>{var t=0,r=0;function s(){return e[t++]}function n(){for(var r=0,s=1;;){var n=e[t++];if(r+=(127&n)*s,s*=128,!(128&n))break}return r}function a(){var r=n();return UTF8ArrayToString(e,(t+=r)-r,r)}function _(e,t){if(e)throw new Error(t)}__name(s,"getU8"),__name(n,"getLEB"),__name(a,"getString"),__name(_,"failIf");var o="dylink.0";if(e instanceof WebAssembly.Module){var i=WebAssembly.Module.customSections(e,o);0===i.length&&(o="dylink",i=WebAssembly.Module.customSections(e,o)),_(0===i.length,"need dylink section"),r=(e=new Uint8Array(i[0])).length}else{var l=new Uint32Array(new Uint8Array(e.subarray(0,24)).buffer);_(!(1836278016==l[0]||6386541==l[0]),"need to see wasm magic number"),_(0!==e[8],"need the dylink section to be first"),t=9;var u=n();r=t+u,o=a()}var d={neededDynlibs:[],tlsExports:new Set,weakImports:new Set};if("dylink"==o){d.memorySize=n(),d.memoryAlign=n(),d.tableSize=n(),d.tableAlign=n();for(var c=n(),m=0;m<c;++m){var p=a();d.neededDynlibs.push(p)}}else for(_("dylink.0"!==o);t<r;){var h=s(),g=n();if(1===h)d.memorySize=n(),d.memoryAlign=n(),d.tableSize=n(),d.tableAlign=n();else if(2===h)for(c=n(),m=0;m<c;++m)p=a(),d.neededDynlibs.push(p);else if(3===h)for(var f=n();f--;){var E=a();256&n()&&d.tlsExports.add(E)}else if(4===h)for(f=n();f--;)a(),E=a(),1==(3&n())&&d.weakImports.add(E);else t+=g}return d},"getDylinkMetadata");function getValue(e,t="i8"){switch(t.endsWith("*")&&(t="*"),t){case"i1":case"i8":return HEAP8[e];case"i16":return LE_HEAP_LOAD_I16(2*(e>>1));case"i32":return LE_HEAP_LOAD_I32(4*(e>>2));case"i64":return HEAP64[e>>3];case"float":return LE_HEAP_LOAD_F32(4*(e>>2));case"double":return LE_HEAP_LOAD_F64(8*(e>>3));case"*":return LE_HEAP_LOAD_U32(4*(e>>2));default:abort(`invalid type for getValue: ${t}`)}}__name(getValue,"getValue");var newDSO=__name((e,t,r)=>{var s={refcount:1/0,name:e,exports:r,global:!0};return LDSO.loadedLibsByName[e]=s,null!=t&&(LDSO.loadedLibsByHandle[t]=s),s},"newDSO"),LDSO={loadedLibsByName:{},loadedLibsByHandle:{},init(){newDSO("__main__",0,wasmImports)}},___heap_base=78224,alignMemory=__name((e,t)=>Math.ceil(e/t)*t,"alignMemory"),getMemory=__name(e=>{if(runtimeInitialized)return _calloc(e,1);var t=___heap_base,r=t+alignMemory(e,16);return ___heap_base=r,GOT.__heap_base.value=r,t},"getMemory"),isInternalSym=__name(e=>["__cpp_exception","__c_longjmp","__wasm_apply_data_relocs","__dso_handle","__tls_size","__tls_align","__set_stack_limits","_emscripten_tls_init","__wasm_init_tls","__wasm_call_ctors","__start_em_asm","__stop_em_asm","__start_em_js","__stop_em_js"].includes(e)||e.startsWith("__em_js__"),"isInternalSym"),uleb128Encode=__name((e,t)=>{e<128?t.push(e):t.push(e%128|128,e>>7)},"uleb128Encode"),sigToWasmTypes=__name(e=>{for(var t={i:"i32",j:"i64",f:"f32",d:"f64",e:"externref",p:"i32"},r={parameters:[],results:"v"==e[0]?[]:[t[e[0]]]},s=1;s<e.length;++s)r.parameters.push(t[e[s]]);return r},"sigToWasmTypes"),generateFuncType=__name((e,t)=>{var r=e.slice(0,1),s=e.slice(1),n={i:127,p:127,j:126,f:125,d:124,e:111};t.push(96),uleb128Encode(s.length,t);for(var a=0;a<s.length;++a)t.push(n[s[a]]);"v"==r?t.push(0):t.push(1,n[r])},"generateFuncType"),convertJsFunctionToWasm=__name((e,t)=>{if("function"==typeof WebAssembly.Function)return new WebAssembly.Function(sigToWasmTypes(t),e);var r=[1];generateFuncType(t,r);var s=[0,97,115,109,1,0,0,0,1];uleb128Encode(r.length,s),s.push(...r),s.push(2,7,1,1,101,1,102,0,0,7,5,1,1,102,0,0);var n=new WebAssembly.Module(new Uint8Array(s));return new WebAssembly.Instance(n,{e:{f:e}}).exports.f},"convertJsFunctionToWasm"),wasmTableMirror=[],wasmTable=new WebAssembly.Table({initial:31,element:"anyfunc"}),getWasmTableEntry=__name(e=>{var t=wasmTableMirror[e];return t||(e>=wasmTableMirror.length&&(wasmTableMirror.length=e+1),wasmTableMirror[e]=t=wasmTable.get(e)),t},"getWasmTableEntry"),updateTableMap=__name((e,t)=>{if(functionsInTableMap)for(var r=e;r<e+t;r++){var s=getWasmTableEntry(r);s&&functionsInTableMap.set(s,r)}},"updateTableMap"),functionsInTableMap,getFunctionAddress=__name(e=>(functionsInTableMap||(functionsInTableMap=new WeakMap,updateTableMap(0,wasmTable.length)),functionsInTableMap.get(e)||0),"getFunctionAddress"),freeTableIndexes=[],getEmptyTableSlot=__name(()=>{if(freeTableIndexes.length)return freeTableIndexes.pop();try{wasmTable.grow(1)}catch(e){if(!(e instanceof RangeError))throw e;throw"Unable to grow wasm table. Set ALLOW_TABLE_GROWTH."}return wasmTable.length-1},"getEmptyTableSlot"),setWasmTableEntry=__name((e,t)=>{wasmTable.set(e,t),wasmTableMirror[e]=wasmTable.get(e)},"setWasmTableEntry"),addFunction=__name((e,t)=>{var r=getFunctionAddress(e);if(r)return r;var s=getEmptyTableSlot();try{setWasmTableEntry(s,e)}catch(r){if(!(r instanceof TypeError))throw r;var n=convertJsFunctionToWasm(e,t);setWasmTableEntry(s,n)}return functionsInTableMap.set(e,s),s},"addFunction"),updateGOT=__name((e,t)=>{for(var r in e)if(!isInternalSym(r)){var s=e[r];GOT[r]||=new WebAssembly.Global({value:"i32",mutable:!0}),(t||0==GOT[r].value)&&("function"==typeof s?GOT[r].value=addFunction(s):"number"==typeof s?GOT[r].value=s:err(`unhandled export type for '${r}': ${typeof s}`))}},"updateGOT"),relocateExports=__name((e,t,r)=>{var s={};for(var n in e){var a=e[n];"object"==typeof a&&(a=a.value),"number"==typeof a&&(a+=t),s[n]=a}return updateGOT(s,r),s},"relocateExports"),isSymbolDefined=__name(e=>{var t=wasmImports[e];return!(!t||t.stub)},"isSymbolDefined"),dynCall=__name((e,t,r=[])=>getWasmTableEntry(t)(...r),"dynCall"),stackSave=__name(()=>_emscripten_stack_get_current(),"stackSave"),stackRestore=__name(e=>__emscripten_stack_restore(e),"stackRestore"),createInvokeFunction=__name(e=>(t,...r)=>{var s=stackSave();try{return dynCall(e,t,r)}catch(t){if(stackRestore(s),t!==t+0)throw t;if(_setThrew(1,0),"j"==e[0])return 0n}},"createInvokeFunction"),resolveGlobalSymbol=__name((e,t=!1)=>{var r;return isSymbolDefined(e)?r=wasmImports[e]:e.startsWith("invoke_")&&(r=wasmImports[e]=createInvokeFunction(e.split("_")[1])),{sym:r,name:e}},"resolveGlobalSymbol"),onPostCtors=[],addOnPostCtor=__name(e=>onPostCtors.unshift(e),"addOnPostCtor"),UTF8ToString=__name((e,t)=>e?UTF8ArrayToString(HEAPU8,e,t):"","UTF8ToString"),loadWebAssemblyModule=__name((binary,flags,libName,localScope,handle)=>{var metadata=getDylinkMetadata(binary);function loadModule(){var memAlign=Math.pow(2,metadata.memoryAlign),memoryBase=metadata.memorySize?alignMemory(getMemory(metadata.memorySize+memAlign),memAlign):0,tableBase=metadata.tableSize?wasmTable.length:0,moduleExports;function resolveSymbol(e){var t=resolveGlobalSymbol(e).sym;return!t&&localScope&&(t=localScope[e]),t||(t=moduleExports[e]),t}handle&&(HEAP8[handle+8]=1,LE_HEAP_STORE_U32(4*(handle+12>>2),memoryBase),LE_HEAP_STORE_I32(4*(handle+16>>2),metadata.memorySize),LE_HEAP_STORE_U32(4*(handle+20>>2),tableBase),LE_HEAP_STORE_I32(4*(handle+24>>2),metadata.tableSize)),metadata.tableSize&&wasmTable.grow(metadata.tableSize),__name(resolveSymbol,"resolveSymbol");var proxyHandler={get(e,t){switch(t){case"__memory_base":return memoryBase;case"__table_base":return tableBase}var r;return t in wasmImports&&!wasmImports[t].stub?wasmImports[t]:(t in e||(e[t]=(...e)=>(r||=resolveSymbol(t),r(...e))),e[t])}},proxy=new Proxy({},proxyHandler),info={"GOT.mem":new Proxy({},GOTHandler),"GOT.func":new Proxy({},GOTHandler),env:proxy,wasi_snapshot_preview1:proxy};function postInstantiation(module,instance){function addEmAsm(addr,body){for(var args=[],arity=0;arity<16&&-1!=body.indexOf("$"+arity);arity++)args.push("$"+arity);args=args.join(",");var func=`(${args}) => { ${body} };`;ASM_CONSTS[start]=eval(func)}if(updateTableMap(tableBase,metadata.tableSize),moduleExports=relocateExports(instance.exports,memoryBase),flags.allowUndefined||reportUndefinedSymbols(),__name(addEmAsm,"addEmAsm"),"__start_em_asm"in moduleExports)for(var start=moduleExports.__start_em_asm,stop=moduleExports.__stop_em_asm;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),"void"!=cSig)for(var i in cSig=cSig.split(","),cSig){var jsArg=cSig[i].split(" ").pop();jsArgs.push(jsArg.replace("*",""))}var func=`(${jsArgs}) => ${body};`;moduleExports[name]=eval(func)}for(var name in __name(addEmJs,"addEmJs"),moduleExports)if(name.startsWith("__em_js__")){var start=moduleExports[name],jsString=UTF8ToString(start),parts=jsString.split("<::>");addEmJs(name.replace("__em_js__",""),parts[0],parts[1]),delete moduleExports[name]}var applyRelocs=moduleExports.__wasm_apply_data_relocs;applyRelocs&&(runtimeInitialized?applyRelocs():__RELOC_FUNCS__.push(applyRelocs));var init=moduleExports.__wasm_call_ctors;return init&&(runtimeInitialized?init():addOnPostCtor(init)),moduleExports}if(__name(postInstantiation,"postInstantiation"),flags.loadAsync){if(binary instanceof WebAssembly.Module){var instance=new WebAssembly.Instance(binary,info);return Promise.resolve(postInstantiation(binary,instance))}return WebAssembly.instantiate(binary,info).then(e=>postInstantiation(e.module,e.instance))}var module=binary instanceof WebAssembly.Module?binary:new WebAssembly.Module(binary),instance=new WebAssembly.Instance(module,info);return postInstantiation(module,instance)}return currentModuleWeakSymbols=metadata.weakImports,__name(loadModule,"loadModule"),flags.loadAsync?metadata.neededDynlibs.reduce((e,t)=>e.then(()=>loadDynamicLibrary(t,flags,localScope)),Promise.resolve()).then(loadModule):(metadata.neededDynlibs.forEach(e=>loadDynamicLibrary(e,flags,localScope)),loadModule())},"loadWebAssemblyModule"),mergeLibSymbols=__name((e,t)=>{for(var[r,s]of Object.entries(e)){const e=__name(e=>{isSymbolDefined(e)||(wasmImports[e]=s)},"setImport");e(r);const t="__main_argc_argv";"main"==r&&e(t),r==t&&e("main")}},"mergeLibSymbols"),asyncLoad=__name(async e=>{var t=await readAsync(e);return new Uint8Array(t)},"asyncLoad");function loadDynamicLibrary(e,t={global:!0,nodelete:!0},r,s){var n=LDSO.loadedLibsByName[e];if(n)return t.global?n.global||(n.global=!0,mergeLibSymbols(n.exports,e)):r&&Object.assign(r,n.exports),t.nodelete&&n.refcount!==1/0&&(n.refcount=1/0),n.refcount++,s&&(LDSO.loadedLibsByHandle[s]=n),!t.loadAsync||Promise.resolve(!0);function a(){if(s){var r=LE_HEAP_LOAD_U32(4*(s+28>>2)),n=LE_HEAP_LOAD_U32(4*(s+32>>2));if(r&&n){var a=HEAP8.slice(r,r+n);return t.loadAsync?Promise.resolve(a):a}}var _=locateFile(e);if(t.loadAsync)return asyncLoad(_);if(!readBinary)throw new Error(`${_}: file not found, and synchronous loading of external files is not available`);return readBinary(_)}function _(){return t.loadAsync?a().then(n=>loadWebAssemblyModule(n,t,e,r,s)):loadWebAssemblyModule(a(),t,e,r,s)}function o(t){n.global?mergeLibSymbols(t,e):r&&Object.assign(r,t),n.exports=t}return(n=newDSO(e,s,"loading")).refcount=t.nodelete?1/0:1,n.global=t.global,__name(a,"loadLibData"),__name(_,"getExports"),__name(o,"moduleLoaded"),t.loadAsync?_().then(e=>(o(e),!0)):(o(_()),!0)}__name(loadDynamicLibrary,"loadDynamicLibrary");var reportUndefinedSymbols=__name(()=>{for(var[e,t]of Object.entries(GOT))if(0==t.value){var r=resolveGlobalSymbol(e,!0).sym;if(!r&&!t.required)continue;if("function"==typeof r)t.value=addFunction(r,r.sig);else{if("number"!=typeof r)throw new Error(`bad export type for '${e}': ${typeof r}`);t.value=r}}},"reportUndefinedSymbols"),loadDylibs=__name(()=>{dynamicLibraries.length?(addRunDependency("loadDylibs"),dynamicLibraries.reduce((e,t)=>e.then(()=>loadDynamicLibrary(t,{loadAsync:!0,global:!0,nodelete:!0,allowUndefined:!0})),Promise.resolve()).then(()=>{reportUndefinedSymbols(),removeRunDependency("loadDylibs")})):reportUndefinedSymbols()},"loadDylibs"),noExitRuntime=Module.noExitRuntime||!0;function setValue(e,t,r="i8"){switch(r.endsWith("*")&&(r="*"),r){case"i1":case"i8":HEAP8[e]=t;break;case"i16":LE_HEAP_STORE_I16(2*(e>>1),t);break;case"i32":LE_HEAP_STORE_I32(4*(e>>2),t);break;case"i64":HEAP64[e>>3]=BigInt(t);break;case"float":LE_HEAP_STORE_F32(4*(e>>2),t);break;case"double":LE_HEAP_STORE_F64(8*(e>>3),t);break;case"*":LE_HEAP_STORE_U32(4*(e>>2),t);break;default:abort(`invalid type for setValue: ${r}`)}}__name(setValue,"setValue");var ___memory_base=new WebAssembly.Global({value:"i32",mutable:!1},1024),___stack_pointer=new WebAssembly.Global({value:"i32",mutable:!0},78224),___table_base=new WebAssembly.Global({value:"i32",mutable:!1},1),__abort_js=__name(()=>abort(""),"__abort_js");__abort_js.sig="v";var _emscripten_get_now=__name(()=>performance.now(),"_emscripten_get_now");_emscripten_get_now.sig="d";var _emscripten_date_now=__name(()=>Date.now(),"_emscripten_date_now");_emscripten_date_now.sig="d";var nowIsMonotonic=1,checkWasiClock=__name(e=>e>=0&&e<=3,"checkWasiClock"),INT53_MAX=9007199254740992,INT53_MIN=-9007199254740992,bigintToI53Checked=__name(e=>e<INT53_MIN||e>INT53_MAX?NaN:Number(e),"bigintToI53Checked");function _clock_time_get(e,t,r){if(t=bigintToI53Checked(t),!checkWasiClock(e))return 28;var s;if(0===e)s=_emscripten_date_now();else{if(!nowIsMonotonic)return 52;s=_emscripten_get_now()}var n=Math.round(1e3*s*1e3);return HEAP64[r>>3]=BigInt(n),0}__name(_clock_time_get,"_clock_time_get"),_clock_time_get.sig="iijp";var getHeapMax=__name(()=>2147483648,"getHeapMax"),growMemory=__name(e=>{var t=(e-wasmMemory.buffer.byteLength+65535)/65536|0;try{return wasmMemory.grow(t),updateMemoryViews(),1}catch(e){}},"growMemory"),_emscripten_resize_heap=__name(e=>{var t=HEAPU8.length;e>>>=0;var r=getHeapMax();if(e>r)return!1;for(var s=1;s<=4;s*=2){var n=t*(1+.2/s);n=Math.min(n,e+100663296);var a=Math.min(r,alignMemory(Math.max(e,n),65536));if(growMemory(a))return!0}return!1},"_emscripten_resize_heap");_emscripten_resize_heap.sig="ip";var _fd_close=__name(e=>52,"_fd_close");function _fd_seek(e,t,r,s){return t=bigintToI53Checked(t),70}_fd_close.sig="ii",__name(_fd_seek,"_fd_seek"),_fd_seek.sig="iijip";var printCharBuffers=[null,[],[]],printChar=__name((e,t)=>{var r=printCharBuffers[e];0===t||10===t?((1===e?out:err)(UTF8ArrayToString(r)),r.length=0):r.push(t)},"printChar"),flush_NO_FILESYSTEM=__name(()=>{printCharBuffers[1].length&&printChar(1,10),printCharBuffers[2].length&&printChar(2,10)},"flush_NO_FILESYSTEM"),SYSCALLS={varargs:void 0,getStr:e=>UTF8ToString(e)},_fd_write=__name((e,t,r,s)=>{for(var n=0,a=0;a<r;a++){var _=LE_HEAP_LOAD_U32(4*(t>>2)),o=LE_HEAP_LOAD_U32(4*(t+4>>2));t+=8;for(var i=0;i<o;i++)printChar(e,HEAPU8[_+i]);n+=o}return LE_HEAP_STORE_U32(4*(s>>2),n),0},"_fd_write");function _tree_sitter_log_callback(e,t){if(Module.currentLogCallback){const r=UTF8ToString(t);Module.currentLogCallback(r,0!==e)}}function _tree_sitter_parse_callback(e,t,r,s,n){const a=Module.currentParseCallback(t,{row:r,column:s});"string"==typeof a?(setValue(n,a.length,"i32"),stringToUTF16(a,e,10240)):setValue(n,0,"i32")}function _tree_sitter_progress_callback(e,t){return!!Module.currentProgressCallback&&Module.currentProgressCallback({currentOffset:e,hasError:t})}function _tree_sitter_query_progress_callback(e){return!!Module.currentQueryProgressCallback&&Module.currentQueryProgressCallback({currentOffset:e})}_fd_write.sig="iippp",__name(_tree_sitter_log_callback,"_tree_sitter_log_callback"),__name(_tree_sitter_parse_callback,"_tree_sitter_parse_callback"),__name(_tree_sitter_progress_callback,"_tree_sitter_progress_callback"),__name(_tree_sitter_query_progress_callback,"_tree_sitter_query_progress_callback");var runtimeKeepaliveCounter=0,keepRuntimeAlive=__name(()=>noExitRuntime||runtimeKeepaliveCounter>0,"keepRuntimeAlive"),_proc_exit=__name(e=>{EXITSTATUS=e,keepRuntimeAlive()||(Module.onExit?.(e),ABORT=!0),quit_(e,new ExitStatus(e))},"_proc_exit");_proc_exit.sig="vi";var exitJS=__name((e,t)=>{EXITSTATUS=e,_proc_exit(e)},"exitJS"),handleException=__name(e=>{if(e instanceof ExitStatus||"unwind"==e)return EXITSTATUS;quit_(1,e)},"handleException"),lengthBytesUTF8=__name(e=>{for(var t=0,r=0;r<e.length;++r){var s=e.charCodeAt(r);s<=127?t++:s<=2047?t+=2:s>=55296&&s<=57343?(t+=4,++r):t+=3}return t},"lengthBytesUTF8"),stringToUTF8Array=__name((e,t,r,s)=>{if(!(s>0))return 0;for(var n=r,a=r+s-1,_=0;_<e.length;++_){var o=e.charCodeAt(_);if(o>=55296&&o<=57343&&(o=65536+((1023&o)<<10)|1023&e.charCodeAt(++_)),o<=127){if(r>=a)break;t[r++]=o}else if(o<=2047){if(r+1>=a)break;t[r++]=192|o>>6,t[r++]=128|63&o}else if(o<=65535){if(r+2>=a)break;t[r++]=224|o>>12,t[r++]=128|o>>6&63,t[r++]=128|63&o}else{if(r+3>=a)break;t[r++]=240|o>>18,t[r++]=128|o>>12&63,t[r++]=128|o>>6&63,t[r++]=128|63&o}}return t[r]=0,r-n},"stringToUTF8Array"),stringToUTF8=__name((e,t,r)=>stringToUTF8Array(e,HEAPU8,t,r),"stringToUTF8"),stackAlloc=__name(e=>__emscripten_stack_alloc(e),"stackAlloc"),stringToUTF8OnStack=__name(e=>{var t=lengthBytesUTF8(e)+1,r=stackAlloc(t);return stringToUTF8(e,r,t),r},"stringToUTF8OnStack"),AsciiToString=__name(e=>{for(var t="";;){var r=HEAPU8[e++];if(!r)return t;t+=String.fromCharCode(r)}},"AsciiToString"),stringToUTF16=__name((e,t,r)=>{if(r??=2147483647,r<2)return 0;for(var s=t,n=(r-=2)<2*e.length?r/2:e.length,a=0;a<n;++a){var _=e.charCodeAt(a);LE_HEAP_STORE_I16(2*(t>>1),_),t+=2}return LE_HEAP_STORE_I16(2*(t>>1),0),t-s},"stringToUTF16"),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,clock_time_get:_clock_time_get,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,tree_sitter_progress_callback:_tree_sitter_progress_callback,tree_sitter_query_progress_callback:_tree_sitter_query_progress_callback},wasmExports=await createWasm(),___wasm_call_ctors=wasmExports.__wasm_call_ctors,_malloc=Module._malloc=wasmExports.malloc,_calloc=Module._calloc=wasmExports.calloc,_realloc=Module._realloc=wasmExports.realloc,_free=Module._free=wasmExports.free,_memcmp=Module._memcmp=wasmExports.memcmp,_ts_language_symbol_count=Module._ts_language_symbol_count=wasmExports.ts_language_symbol_count,_ts_language_state_count=Module._ts_language_state_count=wasmExports.ts_language_state_count,_ts_language_version=Module._ts_language_version=wasmExports.ts_language_version,_ts_language_abi_version=Module._ts_language_abi_version=wasmExports.ts_language_abi_version,_ts_language_metadata=Module._ts_language_metadata=wasmExports.ts_language_metadata,_ts_language_name=Module._ts_language_name=wasmExports.ts_language_name,_ts_language_field_count=Module._ts_language_field_count=wasmExports.ts_language_field_count,_ts_language_next_state=Module._ts_language_next_state=wasmExports.ts_language_next_state,_ts_language_symbol_name=Module._ts_language_symbol_name=wasmExports.ts_language_symbol_name,_ts_language_symbol_for_name=Module._ts_language_symbol_for_name=wasmExports.ts_language_symbol_for_name,_strncmp=Module._strncmp=wasmExports.strncmp,_ts_language_symbol_type=Module._ts_language_symbol_type=wasmExports.ts_language_symbol_type,_ts_language_field_name_for_id=Module._ts_language_field_name_for_id=wasmExports.ts_language_field_name_for_id,_ts_lookahead_iterator_new=Module._ts_lookahead_iterator_new=wasmExports.ts_lookahead_iterator_new,_ts_lookahead_iterator_delete=Module._ts_lookahead_iterator_delete=wasmExports.ts_lookahead_iterator_delete,_ts_lookahead_iterator_reset_state=Module._ts_lookahead_iterator_reset_state=wasmExports.ts_lookahead_iterator_reset_state,_ts_lookahead_iterator_reset=Module._ts_lookahead_iterator_reset=wasmExports.ts_lookahead_iterator_reset,_ts_lookahead_iterator_next=Module._ts_lookahead_iterator_next=wasmExports.ts_lookahead_iterator_next,_ts_lookahead_iterator_current_symbol=Module._ts_lookahead_iterator_current_symbol=wasmExports.ts_lookahead_iterator_current_symbol,_ts_parser_delete=Module._ts_parser_delete=wasmExports.ts_parser_delete,_ts_parser_reset=Module._ts_parser_reset=wasmExports.ts_parser_reset,_ts_parser_set_language=Module._ts_parser_set_language=wasmExports.ts_parser_set_language,_ts_parser_timeout_micros=Module._ts_parser_timeout_micros=wasmExports.ts_parser_timeout_micros,_ts_parser_set_timeout_micros=Module._ts_parser_set_timeout_micros=wasmExports.ts_parser_set_timeout_micros,_ts_parser_set_included_ranges=Module._ts_parser_set_included_ranges=wasmExports.ts_parser_set_included_ranges,_ts_query_new=Module._ts_query_new=wasmExports.ts_query_new,_ts_query_delete=Module._ts_query_delete=wasmExports.ts_query_delete,_iswspace=Module._iswspace=wasmExports.iswspace,_iswalnum=Module._iswalnum=wasmExports.iswalnum,_ts_query_pattern_count=Module._ts_query_pattern_count=wasmExports.ts_query_pattern_count,_ts_query_capture_count=Module._ts_query_capture_count=wasmExports.ts_query_capture_count,_ts_query_string_count=Module._ts_query_string_count=wasmExports.ts_query_string_count,_ts_query_capture_name_for_id=Module._ts_query_capture_name_for_id=wasmExports.ts_query_capture_name_for_id,_ts_query_capture_quantifier_for_id=Module._ts_query_capture_quantifier_for_id=wasmExports.ts_query_capture_quantifier_for_id,_ts_query_string_value_for_id=Module._ts_query_string_value_for_id=wasmExports.ts_query_string_value_for_id,_ts_query_predicates_for_pattern=Module._ts_query_predicates_for_pattern=wasmExports.ts_query_predicates_for_pattern,_ts_query_start_byte_for_pattern=Module._ts_query_start_byte_for_pattern=wasmExports.ts_query_start_byte_for_pattern,_ts_query_end_byte_for_pattern=Module._ts_query_end_byte_for_pattern=wasmExports.ts_query_end_byte_for_pattern,_ts_query_is_pattern_rooted=Module._ts_query_is_pattern_rooted=wasmExports.ts_query_is_pattern_rooted,_ts_query_is_pattern_non_local=Module._ts_query_is_pattern_non_local=wasmExports.ts_query_is_pattern_non_local,_ts_query_is_pattern_guaranteed_at_step=Module._ts_query_is_pattern_guaranteed_at_step=wasmExports.ts_query_is_pattern_guaranteed_at_step,_ts_query_disable_capture=Module._ts_query_disable_capture=wasmExports.ts_query_disable_capture,_ts_query_disable_pattern=Module._ts_query_disable_pattern=wasmExports.ts_query_disable_pattern,_ts_tree_copy=Module._ts_tree_copy=wasmExports.ts_tree_copy,_ts_tree_delete=Module._ts_tree_delete=wasmExports.ts_tree_delete,_ts_init=Module._ts_init=wasmExports.ts_init,_ts_parser_new_wasm=Module._ts_parser_new_wasm=wasmExports.ts_parser_new_wasm,_ts_parser_enable_logger_wasm=Module._ts_parser_enable_logger_wasm=wasmExports.ts_parser_enable_logger_wasm,_ts_parser_parse_wasm=Module._ts_parser_parse_wasm=wasmExports.ts_parser_parse_wasm,_ts_parser_included_ranges_wasm=Module._ts_parser_included_ranges_wasm=wasmExports.ts_parser_included_ranges_wasm,_ts_language_type_is_named_wasm=Module._ts_language_type_is_named_wasm=wasmExports.ts_language_type_is_named_wasm,_ts_language_type_is_visible_wasm=Module._ts_language_type_is_visible_wasm=wasmExports.ts_language_type_is_visible_wasm,_ts_language_supertypes_wasm=Module._ts_language_supertypes_wasm=wasmExports.ts_language_supertypes_wasm,_ts_language_subtypes_wasm=Module._ts_language_subtypes_wasm=wasmExports.ts_language_subtypes_wasm,_ts_tree_root_node_wasm=Module._ts_tree_root_node_wasm=wasmExports.ts_tree_root_node_wasm,_ts_tree_root_node_with_offset_wasm=Module._ts_tree_root_node_with_offset_wasm=wasmExports.ts_tree_root_node_with_offset_wasm,_ts_tree_edit_wasm=Module._ts_tree_edit_wasm=wasmExports.ts_tree_edit_wasm,_ts_tree_included_ranges_wasm=Module._ts_tree_included_ranges_wasm=wasmExports.ts_tree_included_ranges_wasm,_ts_tree_get_changed_ranges_wasm=Module._ts_tree_get_changed_ranges_wasm=wasmExports.ts_tree_get_changed_ranges_wasm,_ts_tree_cursor_new_wasm=Module._ts_tree_cursor_new_wasm=wasmExports.ts_tree_cursor_new_wasm,_ts_tree_cursor_copy_wasm=Module._ts_tree_cursor_copy_wasm=wasmExports.ts_tree_cursor_copy_wasm,_ts_tree_cursor_delete_wasm=Module._ts_tree_cursor_delete_wasm=wasmExports.ts_tree_cursor_delete_wasm,_ts_tree_cursor_reset_wasm=Module._ts_tree_cursor_reset_wasm=wasmExports.ts_tree_cursor_reset_wasm,_ts_tree_cursor_reset_to_wasm=Module._ts_tree_cursor_reset_to_wasm=wasmExports.ts_tree_cursor_reset_to_wasm,_ts_tree_cursor_goto_first_child_wasm=Module._ts_tree_cursor_goto_first_child_wasm=wasmExports.ts_tree_cursor_goto_first_child_wasm,_ts_tree_cursor_goto_last_child_wasm=Module._ts_tree_cursor_goto_last_child_wasm=wasmExports.ts_tree_cursor_goto_last_child_wasm,_ts_tree_cursor_goto_first_child_for_index_wasm=Module._ts_tree_cursor_goto_first_child_for_index_wasm=wasmExports.ts_tree_cursor_goto_first_child_for_index_wasm,_ts_tree_cursor_goto_first_child_for_position_wasm=Module._ts_tree_cursor_goto_first_child_for_position_wasm=wasmExports.ts_tree_cursor_goto_first_child_for_position_wasm,_ts_tree_cursor_goto_next_sibling_wasm=Module._ts_tree_cursor_goto_next_sibling_wasm=wasmExports.ts_tree_cursor_goto_next_sibling_wasm,_ts_tree_cursor_goto_previous_sibling_wasm=Module._ts_tree_cursor_goto_previous_sibling_wasm=wasmExports.ts_tree_cursor_goto_previous_sibling_wasm,_ts_tree_cursor_goto_descendant_wasm=Module._ts_tree_cursor_goto_descendant_wasm=wasmExports.ts_tree_cursor_goto_descendant_wasm,_ts_tree_cursor_goto_parent_wasm=Module._ts_tree_cursor_goto_parent_wasm=wasmExports.ts_tree_cursor_goto_parent_wasm,_ts_tree_cursor_current_node_type_id_wasm=Module._ts_tree_cursor_current_node_type_id_wasm=wasmExports.ts_tree_cursor_current_node_type_id_wasm,_ts_tree_cursor_current_node_state_id_wasm=Module._ts_tree_cursor_current_node_state_id_wasm=wasmExports.ts_tree_cursor_current_node_state_id_wasm,_ts_tree_cursor_current_node_is_named_wasm=Module._ts_tree_cursor_current_node_is_named_wasm=wasmExports.ts_tree_cursor_current_node_is_named_wasm,_ts_tree_cursor_current_node_is_missing_wasm=Module._ts_tree_cursor_current_node_is_missing_wasm=wasmExports.ts_tree_cursor_current_node_is_missing_wasm,_ts_tree_cursor_current_node_id_wasm=Module._ts_tree_cursor_current_node_id_wasm=wasmExports.ts_tree_cursor_current_node_id_wasm,_ts_tree_cursor_start_position_wasm=Module._ts_tree_cursor_start_position_wasm=wasmExports.ts_tree_cursor_start_position_wasm,_ts_tree_cursor_end_position_wasm=Module._ts_tree_cursor_end_position_wasm=wasmExports.ts_tree_cursor_end_position_wasm,_ts_tree_cursor_start_index_wasm=Module._ts_tree_cursor_start_index_wasm=wasmExports.ts_tree_cursor_start_index_wasm,_ts_tree_cursor_end_index_wasm=Module._ts_tree_cursor_end_index_wasm=wasmExports.ts_tree_cursor_end_index_wasm,_ts_tree_cursor_current_field_id_wasm=Module._ts_tree_cursor_current_field_id_wasm=wasmExports.ts_tree_cursor_current_field_id_wasm,_ts_tree_cursor_current_depth_wasm=Module._ts_tree_cursor_current_depth_wasm=wasmExports.ts_tree_cursor_current_depth_wasm,_ts_tree_cursor_current_descendant_index_wasm=Module._ts_tree_cursor_current_descendant_index_wasm=wasmExports.ts_tree_cursor_current_descendant_index_wasm,_ts_tree_cursor_current_node_wasm=Module._ts_tree_cursor_current_node_wasm=wasmExports.ts_tree_cursor_current_node_wasm,_ts_node_symbol_wasm=Module._ts_node_symbol_wasm=wasmExports.ts_node_symbol_wasm,_ts_node_field_name_for_child_wasm=Module._ts_node_field_name_for_child_wasm=wasmExports.ts_node_field_name_for_child_wasm,_ts_node_field_name_for_named_child_wasm=Module._ts_node_field_name_for_named_child_wasm=wasmExports.ts_node_field_name_for_named_child_wasm,_ts_node_children_by_field_id_wasm=Module._ts_node_children_by_field_id_wasm=wasmExports.ts_node_children_by_field_id_wasm,_ts_node_first_child_for_byte_wasm=Module._ts_node_first_child_for_byte_wasm=wasmExports.ts_node_first_child_for_byte_wasm,_ts_node_first_named_child_for_byte_wasm=Module._ts_node_first_named_child_for_byte_wasm=wasmExports.ts_node_first_named_child_for_byte_wasm,_ts_node_grammar_symbol_wasm=Module._ts_node_grammar_symbol_wasm=wasmExports.ts_node_grammar_symbol_wasm,_ts_node_child_count_wasm=Module._ts_node_child_count_wasm=wasmExports.ts_node_child_count_wasm,_ts_node_named_child_count_wasm=Module._ts_node_named_child_count_wasm=wasmExports.ts_node_named_child_count_wasm,_ts_node_child_wasm=Module._ts_node_child_wasm=wasmExports.ts_node_child_wasm,_ts_node_named_child_wasm=Module._ts_node_named_child_wasm=wasmExports.ts_node_named_child_wasm,_ts_node_child_by_field_id_wasm=Module._ts_node_child_by_field_id_wasm=wasmExports.ts_node_child_by_field_id_wasm,_ts_node_next_sibling_wasm=Module._ts_node_next_sibling_wasm=wasmExports.ts_node_next_sibling_wasm,_ts_node_prev_sibling_wasm=Module._ts_node_prev_sibling_wasm=wasmExports.ts_node_prev_sibling_wasm,_ts_node_next_named_sibling_wasm=Module._ts_node_next_named_sibling_wasm=wasmExports.ts_node_next_named_sibling_wasm,_ts_node_prev_named_sibling_wasm=Module._ts_node_prev_named_sibling_wasm=wasmExports.ts_node_prev_named_sibling_wasm,_ts_node_descendant_count_wasm=Module._ts_node_descendant_count_wasm=wasmExports.ts_node_descendant_count_wasm,_ts_node_parent_wasm=Module._ts_node_parent_wasm=wasmExports.ts_node_parent_wasm,_ts_node_child_with_descendant_wasm=Module._ts_node_child_with_descendant_wasm=wasmExports.ts_node_child_with_descendant_wasm,_ts_node_descendant_for_index_wasm=Module._ts_node_descendant_for_index_wasm=wasmExports.ts_node_descendant_for_index_wasm,_ts_node_named_descendant_for_index_wasm=Module._ts_node_named_descendant_for_index_wasm=wasmExports.ts_node_named_descendant_for_index_wasm,_ts_node_descendant_for_position_wasm=Module._ts_node_descendant_for_position_wasm=wasmExports.ts_node_descendant_for_position_wasm,_ts_node_named_descendant_for_position_wasm=Module._ts_node_named_descendant_for_position_wasm=wasmExports.ts_node_named_descendant_for_position_wasm,_ts_node_start_point_wasm=Module._ts_node_start_point_wasm=wasmExports.ts_node_start_point_wasm,_ts_node_end_point_wasm=Module._ts_node_end_point_wasm=wasmExports.ts_node_end_point_wasm,_ts_node_start_index_wasm=Module._ts_node_start_index_wasm=wasmExports.ts_node_start_index_wasm,_ts_node_end_index_wasm=Module._ts_node_end_index_wasm=wasmExports.ts_node_end_index_wasm,_ts_node_to_string_wasm=Module._ts_node_to_string_wasm=wasmExports.ts_node_to_string_wasm,_ts_node_children_wasm=Module._ts_node_children_wasm=wasmExports.ts_node_children_wasm,_ts_node_named_children_wasm=Module._ts_node_named_children_wasm=wasmExports.ts_node_named_children_wasm,_ts_node_descendants_of_type_wasm=Module._ts_node_descendants_of_type_wasm=wasmExports.ts_node_descendants_of_type_wasm,_ts_node_is_named_wasm=Module._ts_node_is_named_wasm=wasmExports.ts_node_is_named_wasm,_ts_node_has_changes_wasm=Module._ts_node_has_changes_wasm=wasmExports.ts_node_has_changes_wasm,_ts_node_has_error_wasm=Module._ts_node_has_error_wasm=wasmExports.ts_node_has_error_wasm,_ts_node_is_error_wasm=Module._ts_node_is_error_wasm=wasmExports.ts_node_is_error_wasm,_ts_node_is_missing_wasm=Module._ts_node_is_missing_wasm=wasmExports.ts_node_is_missing_wasm,_ts_node_is_extra_wasm=Module._ts_node_is_extra_wasm=wasmExports.ts_node_is_extra_wasm,_ts_node_parse_state_wasm=Module._ts_node_parse_state_wasm=wasmExports.ts_node_parse_state_wasm,_ts_node_next_parse_state_wasm=Module._ts_node_next_parse_state_wasm=wasmExports.ts_node_next_parse_state_wasm,_ts_query_matches_wasm=Module._ts_query_matches_wasm=wasmExports.ts_query_matches_wasm,_ts_query_captures_wasm=Module._ts_query_captures_wasm=wasmExports.ts_query_captures_wasm,_memset=Module._memset=wasmExports.memset,_memcpy=Module._memcpy=wasmExports.memcpy,_memmove=Module._memmove=wasmExports.memmove,_iswalpha=Module._iswalpha=wasmExports.iswalpha,_iswblank=Module._iswblank=wasmExports.iswblank,_iswdigit=Module._iswdigit=wasmExports.iswdigit,_iswlower=Module._iswlower=wasmExports.iswlower,_iswupper=Module._iswupper=wasmExports.iswupper,_iswxdigit=Module._iswxdigit=wasmExports.iswxdigit,_memchr=Module._memchr=wasmExports.memchr,_strlen=Module._strlen=wasmExports.strlen,_strcmp=Module._strcmp=wasmExports.strcmp,_strncat=Module._strncat=wasmExports.strncat,_strncpy=Module._strncpy=wasmExports.strncpy,_towlower=Module._towlower=wasmExports.towlower,_towupper=Module._towupper=wasmExports.towupper,_setThrew=wasmExports.setThrew,__emscripten_stack_restore=wasmExports._emscripten_stack_restore,__emscripten_stack_alloc=wasmExports._emscripten_stack_alloc,_emscripten_stack_get_current=wasmExports.emscripten_stack_get_current,___wasm_apply_data_relocs=wasmExports.__wasm_apply_data_relocs;function callMain(e=[]){var t=resolveGlobalSymbol("main").sym;if(t){e.unshift(thisProgram);var r=e.length,s=stackAlloc(4*(r+1)),n=s;e.forEach(e=>{LE_HEAP_STORE_U32(4*(n>>2),stringToUTF8OnStack(e)),n+=4}),LE_HEAP_STORE_U32(4*(n>>2),0);try{var a=t(r,s);return exitJS(a,!0),a}catch(e){return handleException(e)}}}function run(e=arguments_){function t(){Module.calledRun=!0,ABORT||(initRuntime(),preMain(),readyPromiseResolve(Module),Module.onRuntimeInitialized?.(),Module.noInitialRun||callMain(e),postRun())}runDependencies>0?dependenciesFulfilled=run:(preRun(),runDependencies>0?dependenciesFulfilled=run:(__name(t,"doRun"),Module.setStatus?(Module.setStatus("Running..."),setTimeout(()=>{setTimeout(()=>Module.setStatus(""),1),t()},1)):t()))}if(Module.setValue=setValue,Module.getValue=getValue,Module.UTF8ToString=UTF8ToString,Module.stringToUTF8=stringToUTF8,Module.lengthBytesUTF8=lengthBytesUTF8,Module.AsciiToString=AsciiToString,Module.stringToUTF16=stringToUTF16,Module.loadWebAssemblyModule=loadWebAssemblyModule,__name(callMain,"callMain"),__name(run,"run"),Module.preInit)for("function"==typeof Module.preInit&&(Module.preInit=[Module.preInit]);Module.preInit.length>0;)Module.preInit.pop()();return run(),moduleRtn=readyPromise,moduleRtn}})();"object"==typeof exports&&"object"==typeof module?(module.exports=Module,module.exports.default=Module):(__WEBPACK_AMD_DEFINE_ARRAY__=[],__WEBPACK_AMD_DEFINE_RESULT__=(()=>Module).apply(exports,__WEBPACK_AMD_DEFINE_ARRAY__),void 0===__WEBPACK_AMD_DEFINE_RESULT__||(module.exports=__WEBPACK_AMD_DEFINE_RESULT__))}}),index_exports={};__export(index_exports,{CaptureQuantifier:()=>CaptureQuantifier,LANGUAGE_VERSION:()=>LANGUAGE_VERSION,Language:()=>Language,LookaheadIterator:()=>LookaheadIterator,MIN_COMPATIBLE_VERSION:()=>MIN_COMPATIBLE_VERSION,Node:()=>Node,Parser:()=>Parser,Query:()=>Query,Tree:()=>Tree,TreeCursor:()=>TreeCursor}),module.exports=__toCommonJS(index_exports);var SIZE_OF_SHORT=2,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},INTERNAL=Symbol("INTERNAL"),C;function assertInternal(e){if(e!==INTERNAL)throw new Error("Illegal constructor")}function isPoint(e){return!!e&&"number"==typeof e.row&&"number"==typeof e.column}function setModule(e){C=e}__name(assertInternal,"assertInternal"),__name(isPoint,"isPoint"),__name(setModule,"setModule");var LookaheadIterator=class{static{__name(this,"LookaheadIterator")}0=0;language;constructor(e,t,r){assertInternal(e),this[0]=t,this.language=r}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}reset(e,t){return!!C._ts_lookahead_iterator_reset(this[0],e[0],t)&&(this.language=e,!0)}resetState(e){return Boolean(C._ts_lookahead_iterator_reset_state(this[0],e))}[Symbol.iterator](){return{next:__name(()=>C._ts_lookahead_iterator_next(this[0])?{done:!1,value:this.currentType}:{done:!0,value:""},"next")}}};function getText(e,t,r,s){const n=r-t;let a=e.textCallback(t,s);if(a){for(t+=a.length;t<r;){const r=e.textCallback(t,s);if(!(r&&r.length>0))break;t+=r.length,a+=r}t>r&&(a=a.slice(0,n))}return a??""}__name(getText,"getText");var Tree=class e{static{__name(this,"Tree")}0=0;textCallback;language;constructor(e,t,r,s){assertInternal(e),this[0]=t,this.language=r,this.textCallback=s}copy(){const t=C._ts_tree_copy(this[0]);return new e(INTERNAL,t,this.language,this.textCallback)}delete(){C._ts_tree_delete(this[0]),this[0]=0}get rootNode(){return C._ts_tree_root_node_wasm(this[0]),unmarshalNode(this)}rootNodeWithOffset(e,t){const r=TRANSFER_BUFFER+SIZE_OF_NODE;return C.setValue(r,e,"i32"),marshalPoint(r+SIZE_OF_INT,t),C._ts_tree_root_node_with_offset_wasm(this[0]),unmarshalNode(this)}edit(e){marshalEdit(e),C._ts_tree_edit_wasm(this[0])}walk(){return this.rootNode.walk()}getChangedRanges(t){if(!(t instanceof e))throw new TypeError("Argument must be a Tree");C._ts_tree_get_changed_ranges_wasm(this[0],t[0]);const r=C.getValue(TRANSFER_BUFFER,"i32"),s=C.getValue(TRANSFER_BUFFER+SIZE_OF_INT,"i32"),n=new Array(r);if(r>0){let e=s;for(let t=0;t<r;t++)n[t]=unmarshalRange(e),e+=SIZE_OF_RANGE;C._free(s)}return n}getIncludedRanges(){C._ts_tree_included_ranges_wasm(this[0]);const e=C.getValue(TRANSFER_BUFFER,"i32"),t=C.getValue(TRANSFER_BUFFER+SIZE_OF_INT,"i32"),r=new Array(e);if(e>0){let s=t;for(let t=0;t<e;t++)r[t]=unmarshalRange(s),s+=SIZE_OF_RANGE;C._free(t)}return r}},TreeCursor=class e{static{__name(this,"TreeCursor")}0=0;1=0;2=0;3=0;tree;constructor(e,t){assertInternal(e),this.tree=t,unmarshalTreeCursor(this)}copy(){const t=new e(INTERNAL,this.tree);return C._ts_tree_cursor_copy_wasm(this.tree[0]),unmarshalTreeCursor(t),t}delete(){marshalTreeCursor(this),C._ts_tree_cursor_delete_wasm(this.tree[0]),this[0]=this[1]=this[2]=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])}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),1===C._ts_tree_cursor_current_node_is_named_wasm(this.tree[0])}get nodeIsMissing(){return marshalTreeCursor(this),1===C._ts_tree_cursor_current_node_is_missing_wasm(this.tree[0])}get nodeText(){marshalTreeCursor(this);const e=C._ts_tree_cursor_start_index_wasm(this.tree[0]),t=C._ts_tree_cursor_end_index_wasm(this.tree[0]);C._ts_tree_cursor_start_position_wasm(this.tree[0]);const r=unmarshalPoint(TRANSFER_BUFFER);return getText(this.tree,e,t,r)}get startPosition(){return marshalTreeCursor(this),C._ts_tree_cursor_start_position_wasm(this.tree[0]),unmarshalPoint(TRANSFER_BUFFER)}get endPosition(){return marshalTreeCursor(this),C._ts_tree_cursor_end_position_wasm(this.tree[0]),unmarshalPoint(TRANSFER_BUFFER)}get startIndex(){return marshalTreeCursor(this),C._ts_tree_cursor_start_index_wasm(this.tree[0])}get endIndex(){return marshalTreeCursor(this),C._ts_tree_cursor_end_index_wasm(this.tree[0])}gotoFirstChild(){marshalTreeCursor(this);const e=C._ts_tree_cursor_goto_first_child_wasm(this.tree[0]);return unmarshalTreeCursor(this),1===e}gotoLastChild(){marshalTreeCursor(this);const e=C._ts_tree_cursor_goto_last_child_wasm(this.tree[0]);return unmarshalTreeCursor(this),1===e}gotoParent(){marshalTreeCursor(this);const e=C._ts_tree_cursor_goto_parent_wasm(this.tree[0]);return unmarshalTreeCursor(this),1===e}gotoNextSibling(){marshalTreeCursor(this);const e=C._ts_tree_cursor_goto_next_sibling_wasm(this.tree[0]);return unmarshalTreeCursor(this),1===e}gotoPreviousSibling(){marshalTreeCursor(this);const e=C._ts_tree_cursor_goto_previous_sibling_wasm(this.tree[0]);return unmarshalTreeCursor(this),1===e}gotoDescendant(e){marshalTreeCursor(this),C._ts_tree_cursor_goto_descendant_wasm(this.tree[0],e),unmarshalTreeCursor(this)}gotoFirstChildForIndex(e){marshalTreeCursor(this),C.setValue(TRANSFER_BUFFER+SIZE_OF_CURSOR,e,"i32");const t=C._ts_tree_cursor_goto_first_child_for_index_wasm(this.tree[0]);return unmarshalTreeCursor(this),1===t}gotoFirstChildForPosition(e){marshalTreeCursor(this),marshalPoint(TRANSFER_BUFFER+SIZE_OF_CURSOR,e);const t=C._ts_tree_cursor_goto_first_child_for_position_wasm(this.tree[0]);return unmarshalTreeCursor(this),1===t}reset(e){marshalNode(e),marshalTreeCursor(this,TRANSFER_BUFFER+SIZE_OF_NODE),C._ts_tree_cursor_reset_wasm(this.tree[0]),unmarshalTreeCursor(this)}resetTo(e){marshalTreeCursor(this,TRANSFER_BUFFER),marshalTreeCursor(e,TRANSFER_BUFFER+SIZE_OF_CURSOR),C._ts_tree_cursor_reset_to_wasm(this.tree[0],e.tree[0]),unmarshalTreeCursor(this)}},Node=class{static{__name(this,"Node")}0=0;_children;_namedChildren;constructor(e,{id:t,tree:r,startIndex:s,startPosition:n,other:a}){assertInternal(e),this[0]=a,this.id=t,this.tree=r,this.startIndex=s,this.startPosition=n}id;startIndex;startPosition;tree;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 isNamed(){return marshalNode(this),1===C._ts_node_is_named_wasm(this.tree[0])}get isExtra(){return marshalNode(this),1===C._ts_node_is_extra_wasm(this.tree[0])}get isError(){return marshalNode(this),1===C._ts_node_is_error_wasm(this.tree[0])}get isMissing(){return marshalNode(this),1===C._ts_node_is_missing_wasm(this.tree[0])}get hasChanges(){return marshalNode(this),1===C._ts_node_has_changes_wasm(this.tree[0])}get hasError(){return marshalNode(this),1===C._ts_node_has_error_wasm(this.tree[0])}get endIndex(){return marshalNode(this),C._ts_node_end_index_wasm(this.tree[0])}get endPosition(){return marshalNode(this),C._ts_node_end_point_wasm(this.tree[0]),unmarshalPoint(TRANSFER_BUFFER)}get text(){return getText(this.tree,this.startIndex,this.endIndex,this.startPosition)}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])}equals(e){return this.tree===e.tree&&this.id===e.id}child(e){return marshalNode(this),C._ts_node_child_wasm(this.tree[0],e),unmarshalNode(this.tree)}namedChild(e){return marshalNode(this),C._ts_node_named_child_wasm(this.tree[0],e),unmarshalNode(this.tree)}childForFieldId(e){return marshalNode(this),C._ts_node_child_by_field_id_wasm(this.tree[0],e),unmarshalNode(this.tree)}childForFieldName(e){const t=this.tree.language.fields.indexOf(e);return-1!==t?this.childForFieldId(t):null}fieldNameForChild(e){marshalNode(this);const t=C._ts_node_field_name_for_child_wasm(this.tree[0],e);return t?C.AsciiToString(t):null}fieldNameForNamedChild(e){marshalNode(this);const t=C._ts_node_field_name_for_named_child_wasm(this.tree[0],e);return t?C.AsciiToString(t):null}childrenForFieldName(e){const t=this.tree.language.fields.indexOf(e);return-1!==t&&0!==t?this.childrenForFieldId(t):[]}childrenForFieldId(e){marshalNode(this),C._ts_node_children_by_field_id_wasm(this.tree[0],e);const t=C.getValue(TRANSFER_BUFFER,"i32"),r=C.getValue(TRANSFER_BUFFER+SIZE_OF_INT,"i32"),s=new Array(t);if(t>0){let e=r;for(let r=0;r<t;r++)s[r]=unmarshalNode(this.tree,e),e+=SIZE_OF_NODE;C._free(r)}return s}firstChildForIndex(e){marshalNode(this);const t=TRANSFER_BUFFER+SIZE_OF_NODE;return C.setValue(t,e,"i32"),C._ts_node_first_child_for_byte_wasm(this.tree[0]),unmarshalNode(this.tree)}firstNamedChildForIndex(e){marshalNode(this);const t=TRANSFER_BUFFER+SIZE_OF_NODE;return C.setValue(t,e,"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]);const e=C.getValue(TRANSFER_BUFFER,"i32"),t=C.getValue(TRANSFER_BUFFER+SIZE_OF_INT,"i32");if(this._children=new Array(e),e>0){let r=t;for(let t=0;t<e;t++)this._children[t]=unmarshalNode(this.tree,r),r+=SIZE_OF_NODE;C._free(t)}}return this._children}get namedChildren(){if(!this._namedChildren){marshalNode(this),C._ts_node_named_children_wasm(this.tree[0]);const e=C.getValue(TRANSFER_BUFFER,"i32"),t=C.getValue(TRANSFER_BUFFER+SIZE_OF_INT,"i32");if(this._namedChildren=new Array(e),e>0){let r=t;for(let t=0;t<e;t++)this._namedChildren[t]=unmarshalNode(this.tree,r),r+=SIZE_OF_NODE;C._free(t)}}return this._namedChildren}descendantsOfType(e,t=ZERO_POINT,r=ZERO_POINT){Array.isArray(e)||(e=[e]);const s=[],n=this.tree.language.types;for(const t of e)"ERROR"==t&&s.push(65535);for(let t=0,r=n.length;t<r;t++)e.includes(n[t])&&s.push(t);const a=C._malloc(SIZE_OF_INT*s.length);for(let e=0,t=s.length;e<t;e++)C.setValue(a+e*SIZE_OF_INT,s[e],"i32");marshalNode(this),C._ts_node_descendants_of_type_wasm(this.tree[0],a,s.length,t.row,t.column,r.row,r.column);const _=C.getValue(TRANSFER_BUFFER,"i32"),o=C.getValue(TRANSFER_BUFFER+SIZE_OF_INT,"i32"),i=new Array(_);if(_>0){let e=o;for(let t=0;t<_;t++)i[t]=unmarshalNode(this.tree,e),e+=SIZE_OF_NODE}return C._free(o),C._free(a),i}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)}childWithDescendant(e){return marshalNode(this),marshalNode(e,1),C._ts_node_child_with_descendant_wasm(this.tree[0]),unmarshalNode(this.tree)}descendantForIndex(e,t=e){if("number"!=typeof e||"number"!=typeof t)throw new Error("Arguments must be numbers");marshalNode(this);const r=TRANSFER_BUFFER+SIZE_OF_NODE;return C.setValue(r,e,"i32"),C.setValue(r+SIZE_OF_INT,t,"i32"),C._ts_node_descendant_for_index_wasm(this.tree[0]),unmarshalNode(this.tree)}namedDescendantForIndex(e,t=e){if("number"!=typeof e||"number"!=typeof t)throw new Error("Arguments must be numbers");marshalNode(this);const r=TRANSFER_BUFFER+SIZE_OF_NODE;return C.setValue(r,e,"i32"),C.setValue(r+SIZE_OF_INT,t,"i32"),C._ts_node_named_descendant_for_index_wasm(this.tree[0]),unmarshalNode(this.tree)}descendantForPosition(e,t=e){if(!isPoint(e)||!isPoint(t))throw new Error("Arguments must be {row, column} objects");marshalNode(this);const r=TRANSFER_BUFFER+SIZE_OF_NODE;return marshalPoint(r,e),marshalPoint(r+SIZE_OF_POINT,t),C._ts_node_descendant_for_position_wasm(this.tree[0]),unmarshalNode(this.tree)}namedDescendantForPosition(e,t=e){if(!isPoint(e)||!isPoint(t))throw new Error("Arguments must be {row, column} objects");marshalNode(this);const r=TRANSFER_BUFFER+SIZE_OF_NODE;return marshalPoint(r,e),marshalPoint(r+SIZE_OF_POINT,t),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)}edit(e){if(this.startIndex>=e.oldEndIndex){let t,r;this.startIndex=e.newEndIndex+(this.startIndex-e.oldEndIndex),this.startPosition.row>e.oldEndPosition.row?(t=this.startPosition.row-e.oldEndPosition.row,r=this.startPosition.column):(t=0,r=this.startPosition.column,this.startPosition.column>=e.oldEndPosition.column&&(r=this.startPosition.column-e.oldEndPosition.column)),t>0?(this.startPosition.row+=t,this.startPosition.column=r):this.startPosition.column+=r}else this.startIndex>e.startIndex&&(this.startIndex=e.newEndIndex,this.startPosition.row=e.newEndPosition.row,this.startPosition.column=e.newEndPosition.column)}toString(){marshalNode(this);const e=C._ts_node_to_string_wasm(this.tree[0]),t=C.AsciiToString(e);return C._free(e),t}};function unmarshalCaptures(e,t,r,s,n){for(let a=0,_=n.length;a<_;a++){const _=C.getValue(r,"i32"),o=unmarshalNode(t,r+=SIZE_OF_INT);r+=SIZE_OF_NODE,n[a]={patternIndex:s,name:e.captureNames[_],node:o}}return r}function marshalNode(e,t=0){let r=TRANSFER_BUFFER+t*SIZE_OF_NODE;C.setValue(r,e.id,"i32"),r+=SIZE_OF_INT,C.setValue(r,e.startIndex,"i32"),r+=SIZE_OF_INT,C.setValue(r,e.startPosition.row,"i32"),r+=SIZE_OF_INT,C.setValue(r,e.startPosition.column,"i32"),r+=SIZE_OF_INT,C.setValue(r,e[0],"i32")}function unmarshalNode(e,t=TRANSFER_BUFFER){const r=C.getValue(t,"i32");if(t+=SIZE_OF_INT,0===r)return null;const s=C.getValue(t,"i32");t+=SIZE_OF_INT;const n=C.getValue(t,"i32");t+=SIZE_OF_INT;const a=C.getValue(t,"i32");t+=SIZE_OF_INT;const _=C.getValue(t,"i32");return new Node(INTERNAL,{id:r,tree:e,startIndex:s,startPosition:{row:n,column:a},other:_})}function marshalTreeCursor(e,t=TRANSFER_BUFFER){C.setValue(t+0*SIZE_OF_INT,e[0],"i32"),C.setValue(t+1*SIZE_OF_INT,e[1],"i32"),C.setValue(t+2*SIZE_OF_INT,e[2],"i32"),C.setValue(t+3*SIZE_OF_INT,e[3],"i32")}function unmarshalTreeCursor(e){e[0]=C.getValue(TRANSFER_BUFFER+0*SIZE_OF_INT,"i32"),e[1]=C.getValue(TRANSFER_BUFFER+1*SIZE_OF_INT,"i32"),e[2]=C.getValue(TRANSFER_BUFFER+2*SIZE_OF_INT,"i32"),e[3]=C.getValue(TRANSFER_BUFFER+3*SIZE_OF_INT,"i32")}function marshalPoint(e,t){C.setValue(e,t.row,"i32"),C.setValue(e+SIZE_OF_INT,t.column,"i32")}function unmarshalPoint(e){return{row:C.getValue(e,"i32")>>>0,column:C.getValue(e+SIZE_OF_INT,"i32")>>>0}}function marshalRange(e,t){marshalPoint(e,t.startPosition),marshalPoint(e+=SIZE_OF_POINT,t.endPosition),e+=SIZE_OF_POINT,C.setValue(e,t.startIndex,"i32"),e+=SIZE_OF_INT,C.setValue(e,t.endIndex,"i32"),e+=SIZE_OF_INT}function unmarshalRange(e){const t={};return t.startPosition=unmarshalPoint(e),e+=SIZE_OF_POINT,t.endPosition=unmarshalPoint(e),e+=SIZE_OF_POINT,t.startIndex=C.getValue(e,"i32")>>>0,e+=SIZE_OF_INT,t.endIndex=C.getValue(e,"i32")>>>0,t}function marshalEdit(e,t=TRANSFER_BUFFER){marshalPoint(t,e.startPosition),marshalPoint(t+=SIZE_OF_POINT,e.oldEndPosition),marshalPoint(t+=SIZE_OF_POINT,e.newEndPosition),t+=SIZE_OF_POINT,C.setValue(t,e.startIndex,"i32"),t+=SIZE_OF_INT,C.setValue(t,e.oldEndIndex,"i32"),t+=SIZE_OF_INT,C.setValue(t,e.newEndIndex,"i32"),t+=SIZE_OF_INT}function unmarshalLanguageMetadata(e){const t={};return t.major_version=C.getValue(e,"i32"),e+=SIZE_OF_INT,t.minor_version=C.getValue(e,"i32"),e+=SIZE_OF_INT,t.field_count=C.getValue(e,"i32"),t}__name(unmarshalCaptures,"unmarshalCaptures"),__name(marshalNode,"marshalNode"),__name(unmarshalNode,"unmarshalNode"),__name(marshalTreeCursor,"marshalTreeCursor"),__name(unmarshalTreeCursor,"unmarshalTreeCursor"),__name(marshalPoint,"marshalPoint"),__name(unmarshalPoint,"unmarshalPoint"),__name(marshalRange,"marshalRange"),__name(unmarshalRange,"unmarshalRange"),__name(marshalEdit,"marshalEdit"),__name(unmarshalLanguageMetadata,"unmarshalLanguageMetadata");var PREDICATE_STEP_TYPE_CAPTURE=1,PREDICATE_STEP_TYPE_STRING=2,QUERY_WORD_REGEX=/[\w-]+/g,CaptureQuantifier={Zero:0,ZeroOrOne:1,ZeroOrMore:2,One:3,OneOrMore:4},isCaptureStep=__name(e=>"capture"===e.type,"isCaptureStep"),isStringStep=__name(e=>"string"===e.type,"isStringStep"),QueryErrorKind={Syntax:1,NodeName:2,FieldName:3,CaptureName:4,PatternStructure:5},QueryError=class e extends Error{constructor(t,r,s,n){super(e.formatMessage(t,r)),this.kind=t,this.info=r,this.index=s,this.length=n,this.name="QueryError"}static{__name(this,"QueryError")}static formatMessage(e,t){switch(e){case QueryErrorKind.NodeName:return`Bad node name '${t.word}'`;case QueryErrorKind.FieldName:return`Bad field name '${t.word}'`;case QueryErrorKind.CaptureName:return`Bad capture name @${t.word}`;case QueryErrorKind.PatternStructure:return`Bad pattern structure at offset ${t.suffix}`;case QueryErrorKind.Syntax:return`Bad syntax at offset ${t.suffix}`}}};function parseAnyPredicate(e,t,r,s){if(3!==e.length)throw new Error(`Wrong number of arguments to \`#${r}\` predicate. Expected 2, got ${e.length-1}`);if(!isCaptureStep(e[1]))throw new Error(`First argument of \`#${r}\` predicate must be a capture. Got "${e[1].value}"`);const n="eq?"===r||"any-eq?"===r,a=!r.startsWith("any-");if(isCaptureStep(e[2])){const r=e[1].name,_=e[2].name;s[t].push(e=>{const t=[],s=[];for(const n of e)n.name===r&&t.push(n.node),n.name===_&&s.push(n.node);const o=__name((e,t,r)=>r?e.text===t.text:e.text!==t.text,"compare");return a?t.every(e=>s.some(t=>o(e,t,n))):t.some(e=>s.some(t=>o(e,t,n)))})}else{const r=e[1].name,_=e[2].value,o=__name(e=>e.text===_,"matches"),i=__name(e=>e.text!==_,"doesNotMatch");s[t].push(e=>{const t=[];for(const s of e)s.name===r&&t.push(s.node);const s=n?o:i;return a?t.every(s):t.some(s)})}}function parseMatchPredicate(e,t,r,s){if(3!==e.length)throw new Error(`Wrong number of arguments to \`#${r}\` predicate. Expected 2, got ${e.length-1}.`);if("capture"!==e[1].type)throw new Error(`First argument of \`#${r}\` predicate must be a capture. Got "${e[1].value}".`);if("string"!==e[2].type)throw new Error(`Second argument of \`#${r}\` predicate must be a string. Got @${e[2].name}.`);const n="match?"===r||"any-match?"===r,a=!r.startsWith("any-"),_=e[1].name,o=new RegExp(e[2].value);s[t].push(e=>{const t=[];for(const r of e)r.name===_&&t.push(r.node.text);const r=__name((e,t)=>t?o.test(e):!o.test(e),"test");return 0===t.length?!n:a?t.every(e=>r(e,n)):t.some(e=>r(e,n))})}function parseAnyOfPredicate(e,t,r,s){if(e.length<2)throw new Error(`Wrong number of arguments to \`#${r}\` predicate. Expected at least 1. Got ${e.length-1}.`);if("capture"!==e[1].type)throw new Error(`First argument of \`#${r}\` predicate must be a capture. Got "${e[1].value}".`);const n="any-of?"===r,a=e[1].name,_=e.slice(2);if(!_.every(isStringStep))throw new Error(`Arguments to \`#${r}\` predicate must be strings.".`);const o=_.map(e=>e.value);s[t].push(e=>{const t=[];for(const r of e)r.name===a&&t.push(r.node.text);return 0===t.length?!n:t.every(e=>o.includes(e))===n})}function parseIsPredicate(e,t,r,s,n){if(e.length<2||e.length>3)throw new Error(`Wrong number of arguments to \`#${r}\` predicate. Expected 1 or 2. Got ${e.length-1}.`);if(!e.every(isStringStep))throw new Error(`Arguments to \`#${r}\` predicate must be strings.".`);const a="is?"===r?s:n;a[t]||(a[t]={}),a[t][e[1].value]=e[2]?.value??null}function parseSetDirective(e,t,r){if(e.length<2||e.length>3)throw new Error(`Wrong number of arguments to \`#set!\` predicate. Expected 1 or 2. Got ${e.length-1}.`);if(!e.every(isStringStep))throw new Error('Arguments to `#set!` predicate must be strings.".');r[t]||(r[t]={}),r[t][e[1].value]=e[2]?.value??null}function parsePattern(e,t,r,s,n,a,_,o,i,l,u){if(t===PREDICATE_STEP_TYPE_CAPTURE){const e=s[r];a.push({type:"capture",name:e})}else if(t===PREDICATE_STEP_TYPE_STRING)a.push({type:"string",value:n[r]});else if(a.length>0){if("string"!==a[0].type)throw new Error("Predicates must begin with a literal value");const t=a[0].value;switch(t){case"any-not-eq?":case"not-eq?":case"any-eq?":case"eq?":parseAnyPredicate(a,e,t,_);break;case"any-not-match?":case"not-match?":case"any-match?":case"match?":parseMatchPredicate(a,e,t,_);break;case"not-any-of?":case"any-of?":parseAnyOfPredicate(a,e,t,_);break;case"is?":case"is-not?":parseIsPredicate(a,e,t,l,u);break;case"set!":parseSetDirective(a,e,i);break;default:o[e].push({operator:t,operands:a.slice(1)})}a.length=0}}__name(parseAnyPredicate,"parseAnyPredicate"),__name(parseMatchPredicate,"parseMatchPredicate"),__name(parseAnyOfPredicate,"parseAnyOfPredicate"),__name(parseIsPredicate,"parseIsPredicate"),__name(parseSetDirective,"parseSetDirective"),__name(parsePattern,"parsePattern");var Query=class{static{__name(this,"Query")}0=0;exceededMatchLimit;textPredicates;captureNames;captureQuantifiers;predicates;setProperties;assertedProperties;refutedProperties;matchLimit;constructor(e,t){const r=C.lengthBytesUTF8(t),s=C._malloc(r+1);C.stringToUTF8(t,s,r+1);const n=C._ts_query_new(e[0],s,r,TRANSFER_BUFFER,TRANSFER_BUFFER+SIZE_OF_INT);if(!n){const e=C.getValue(TRANSFER_BUFFER+SIZE_OF_INT,"i32"),r=C.getValue(TRANSFER_BUFFER,"i32"),n=C.UTF8ToString(s,r).length,a=t.slice(n,n+100).split("\n")[0],_=a.match(QUERY_WORD_REGEX)?.[0]??"";switch(C._free(s),e){case QueryErrorKind.Syntax:throw new QueryError(QueryErrorKind.Syntax,{suffix:`${n}: '${a}'...`},n,0);case QueryErrorKind.NodeName:case QueryErrorKind.FieldName:case QueryErrorKind.CaptureName:throw new QueryError(e,{word:_},n,_.length);case QueryErrorKind.PatternStructure:throw new QueryError(e,{suffix:`${n}: '${a}'...`},n,0)}}const a=C._ts_query_string_count(n),_=C._ts_query_capture_count(n),o=C._ts_query_pattern_count(n),i=new Array(_),l=new Array(o),u=new Array(a);for(let e=0;e<_;e++){const t=C._ts_query_capture_name_for_id(n,e,TRANSFER_BUFFER),r=C.getValue(TRANSFER_BUFFER,"i32");i[e]=C.UTF8ToString(t,r)}for(let e=0;e<o;e++){const t=new Array(_);for(let r=0;r<_;r++){const s=C._ts_query_capture_quantifier_for_id(n,e,r);t[r]=s}l[e]=t}for(let e=0;e<a;e++){const t=C._ts_query_string_value_for_id(n,e,TRANSFER_BUFFER),r=C.getValue(TRANSFER_BUFFER,"i32");u[e]=C.UTF8ToString(t,r)}const d=new Array(o),c=new Array(o),m=new Array(o),p=new Array(o),h=new Array(o);for(let e=0;e<o;e++){const t=C._ts_query_predicates_for_pattern(n,e,TRANSFER_BUFFER),r=C.getValue(TRANSFER_BUFFER,"i32");p[e]=[],h[e]=[];const s=new Array;let a=t;for(let t=0;t<r;t++){const t=C.getValue(a,"i32");a+=SIZE_OF_INT;const r=C.getValue(a,"i32");a+=SIZE_OF_INT,parsePattern(e,t,r,i,u,s,h,p,d,c,m)}Object.freeze(h[e]),Object.freeze(p[e]),Object.freeze(d[e]),Object.freeze(c[e]),Object.freeze(m[e])}C._free(s),this[0]=n,this.captureNames=i,this.captureQuantifiers=l,this.textPredicates=h,this.predicates=p,this.setProperties=d,this.assertedProperties=c,this.refutedProperties=m,this.exceededMatchLimit=!1}delete(){C._ts_query_delete(this[0]),this[0]=0}matches(e,t={}){const r=t.startPosition??ZERO_POINT,s=t.endPosition??ZERO_POINT,n=t.startIndex??0,a=t.endIndex??0,_=t.matchLimit??4294967295,o=t.maxStartDepth??4294967295,i=t.timeoutMicros??0,l=t.progressCallback;if("number"!=typeof _)throw new Error("Arguments must be numbers");if(this.matchLimit=_,0!==a&&n>a)throw new Error("`startIndex` cannot be greater than `endIndex`");if(s!==ZERO_POINT&&(r.row>s.row||r.row===s.row&&r.column>s.column))throw new Error("`startPosition` cannot be greater than `endPosition`");l&&(C.currentQueryProgressCallback=l),marshalNode(e),C._ts_query_matches_wasm(this[0],e.tree[0],r.row,r.column,s.row,s.column,n,a,_,o,i);const u=C.getValue(TRANSFER_BUFFER,"i32"),d=C.getValue(TRANSFER_BUFFER+SIZE_OF_INT,"i32"),c=C.getValue(TRANSFER_BUFFER+2*SIZE_OF_INT,"i32"),m=new Array(u);this.exceededMatchLimit=Boolean(c);let p=0,h=d;for(let t=0;t<u;t++){const t=C.getValue(h,"i32");h+=SIZE_OF_INT;const r=C.getValue(h,"i32");h+=SIZE_OF_INT;const s=new Array(r);if(h=unmarshalCaptures(this,e.tree,h,t,s),this.textPredicates[t].every(e=>e(s))){m[p]={pattern:t,patternIndex:t,captures:s};const e=this.setProperties[t];m[p].setProperties=e;const r=this.assertedProperties[t];m[p].assertedProperties=r;const n=this.refutedProperties[t];m[p].refutedProperties=n,p++}}return m.length=p,C._free(d),C.currentQueryProgressCallback=null,m}captures(e,t={}){const r=t.startPosition??ZERO_POINT,s=t.endPosition??ZERO_POINT,n=t.startIndex??0,a=t.endIndex??0,_=t.matchLimit??4294967295,o=t.maxStartDepth??4294967295,i=t.timeoutMicros??0,l=t.progressCallback;if("number"!=typeof _)throw new Error("Arguments must be numbers");if(this.matchLimit=_,0!==a&&n>a)throw new Error("`startIndex` cannot be greater than `endIndex`");if(s!==ZERO_POINT&&(r.row>s.row||r.row===s.row&&r.column>s.column))throw new Error("`startPosition` cannot be greater than `endPosition`");l&&(C.currentQueryProgressCallback=l),marshalNode(e),C._ts_query_captures_wasm(this[0],e.tree[0],r.row,r.column,s.row,s.column,n,a,_,o,i);const u=C.getValue(TRANSFER_BUFFER,"i32"),d=C.getValue(TRANSFER_BUFFER+SIZE_OF_INT,"i32"),c=C.getValue(TRANSFER_BUFFER+2*SIZE_OF_INT,"i32"),m=new Array;this.exceededMatchLimit=Boolean(c);const p=new Array;let h=d;for(let t=0;t<u;t++){const t=C.getValue(h,"i32");h+=SIZE_OF_INT;const r=C.getValue(h,"i32");h+=SIZE_OF_INT;const s=C.getValue(h,"i32");if(h+=SIZE_OF_INT,p.length=r,h=unmarshalCaptures(this,e.tree,h,t,p),this.textPredicates[t].every(e=>e(p))){const e=p[s],r=this.setProperties[t];e.setProperties=r;const n=this.assertedProperties[t];e.assertedProperties=n;const a=this.refutedProperties[t];e.refutedProperties=a,m.push(e)}}return C._free(d),C.currentQueryProgressCallback=null,m}predicatesForPattern(e){return this.predicates[e]}disableCapture(e){const t=C.lengthBytesUTF8(e),r=C._malloc(t+1);C.stringToUTF8(e,r,t+1),C._ts_query_disable_capture(this[0],r,t),C._free(r)}disablePattern(e){if(e>=this.predicates.length)throw new Error(`Pattern index is ${e} but the pattern count is ${this.predicates.length}`);C._ts_query_disable_pattern(this[0],e)}didExceedMatchLimit(){return this.exceededMatchLimit}startIndexForPattern(e){if(e>=this.predicates.length)throw new Error(`Pattern index is ${e} but the pattern count is ${this.predicates.length}`);return C._ts_query_start_byte_for_pattern(this[0],e)}endIndexForPattern(e){if(e>=this.predicates.length)throw new Error(`Pattern index is ${e} but the pattern count is ${this.predicates.length}`);return C._ts_query_end_byte_for_pattern(this[0],e)}patternCount(){return C._ts_query_pattern_count(this[0])}captureIndexForName(e){return this.captureNames.indexOf(e)}isPatternRooted(e){return 1===C._ts_query_is_pattern_rooted(this[0],e)}isPatternNonLocal(e){return 1===C._ts_query_is_pattern_non_local(this[0],e)}isPatternGuaranteedAtStep(e){return 1===C._ts_query_is_pattern_guaranteed_at_step(this[0],e)}},LANGUAGE_FUNCTION_REGEX=/^tree_sitter_\w+$/,Language=class e{static{__name(this,"Language")}0=0;types;fields;constructor(e,t){assertInternal(e),this[0]=t,this.types=new Array(C._ts_language_symbol_count(this[0]));for(let e=0,t=this.types.length;e<t;e++)C._ts_language_symbol_type(this[0],e)<2&&(this.types[e]=C.UTF8ToString(C._ts_language_symbol_name(this[0],e)));this.fields=new Array(C._ts_language_field_count(this[0])+1);for(let e=0,t=this.fields.length;e<t;e++){const t=C._ts_language_field_name_for_id(this[0],e);this.fields[e]=0!==t?C.UTF8ToString(t):null}}get name(){const e=C._ts_language_name(this[0]);return 0===e?null:C.UTF8ToString(e)}get version(){return C._ts_language_version(this[0])}get abiVersion(){return C._ts_language_abi_version(this[0])}get metadata(){C._ts_language_metadata(this[0]);const e=C.getValue(TRANSFER_BUFFER,"i32"),t=C.getValue(TRANSFER_BUFFER+SIZE_OF_INT,"i32");return 0===e?null:unmarshalLanguageMetadata(t)}get fieldCount(){return this.fields.length-1}get stateCount(){return C._ts_language_state_count(this[0])}fieldIdForName(e){const t=this.fields.indexOf(e);return-1!==t?t:null}fieldNameForId(e){return this.fields[e]??null}idForNodeType(e,t){const r=C.lengthBytesUTF8(e),s=C._malloc(r+1);C.stringToUTF8(e,s,r+1);const n=C._ts_language_symbol_for_name(this[0],s,r,t?1:0);return C._free(s),n||null}get nodeTypeCount(){return C._ts_language_symbol_count(this[0])}nodeTypeForId(e){const t=C._ts_language_symbol_name(this[0],e);return t?C.UTF8ToString(t):null}nodeTypeIsNamed(e){return!!C._ts_language_type_is_named_wasm(this[0],e)}nodeTypeIsVisible(e){return!!C._ts_language_type_is_visible_wasm(this[0],e)}get supertypes(){C._ts_language_supertypes_wasm(this[0]);const e=C.getValue(TRANSFER_BUFFER,"i32"),t=C.getValue(TRANSFER_BUFFER+SIZE_OF_INT,"i32"),r=new Array(e);if(e>0){let s=t;for(let t=0;t<e;t++)r[t]=C.getValue(s,"i16"),s+=SIZE_OF_SHORT}return r}subtypes(e){C._ts_language_subtypes_wasm(this[0],e);const t=C.getValue(TRANSFER_BUFFER,"i32"),r=C.getValue(TRANSFER_BUFFER+SIZE_OF_INT,"i32"),s=new Array(t);if(t>0){let e=r;for(let r=0;r<t;r++)s[r]=C.getValue(e,"i16"),e+=SIZE_OF_SHORT}return s}nextState(e,t){return C._ts_language_next_state(this[0],e,t)}lookaheadIterator(e){const t=C._ts_lookahead_iterator_new(this[0],e);return t?new LookaheadIterator(INTERNAL,t,this):null}query(e){return console.warn("Language.query is deprecated. Use new Query(language, source) instead."),new Query(this,e)}static async load(t){let r;r=t instanceof Uint8Array?Promise.resolve(t):globalThis.process?.versions.node?(await Promise.resolve().then(__webpack_require__.t.bind(__webpack_require__,943,23))).readFile(t):fetch(t).then(e=>e.arrayBuffer().then(t=>{if(e.ok)return new Uint8Array(t);{const r=new TextDecoder("utf-8").decode(t);throw new Error(`Language.load failed with status ${e.status}.\n\n${r}`)}}));const s=await C.loadWebAssemblyModule(await r,{loadAsync:!0}),n=Object.keys(s),a=n.find(e=>LANGUAGE_FUNCTION_REGEX.test(e)&&!e.includes("external_scanner_"));if(!a)throw console.log(`Couldn't find language function in WASM file. Symbols:\n${JSON.stringify(n,null,2)}`),new Error("Language.load failed: no language function found in WASM file");const _=s[a]();return new e(INTERNAL,_)}},import_tree_sitter=__toESM(require_tree_sitter(),1),Module2=null,TRANSFER_BUFFER,LANGUAGE_VERSION,MIN_COMPATIBLE_VERSION;async function initializeBinding(e){return Module2||(Module2=await(0,import_tree_sitter.default)(e)),Module2}function checkModule(){return!!Module2}__name(initializeBinding,"initializeBinding"),__name(checkModule,"checkModule");var Parser=class{static{__name(this,"Parser")}0=0;1=0;logCallback=null;language=null;static async init(e){setModule(await initializeBinding(e)),TRANSFER_BUFFER=C._ts_init(),LANGUAGE_VERSION=C.getValue(TRANSFER_BUFFER,"i32"),MIN_COMPATIBLE_VERSION=C.getValue(TRANSFER_BUFFER+SIZE_OF_INT,"i32")}constructor(){this.initialize()}initialize(){if(!checkModule())throw new Error("cannot construct a Parser before calling `init()`");C._ts_parser_new_wasm(),this[0]=C.getValue(TRANSFER_BUFFER,"i32"),this[1]=C.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(e){let t;if(e){if(e.constructor!==Language)throw new Error("Argument must be a Language");{t=e[0];const r=C._ts_language_version(t);if(r<MIN_COMPATIBLE_VERSION||LANGUAGE_VERSION<r)throw new Error(`Incompatible language version ${r}. Compatibility range ${MIN_COMPATIBLE_VERSION} through ${LANGUAGE_VERSION}.`);this.language=e}}else t=0,this.language=null;return C._ts_parser_set_language(this[0],t),this}parse(e,t,r){if("string"==typeof e)C.currentParseCallback=t=>e.slice(t);else{if("function"!=typeof e)throw new Error("Argument must be a string or a function");C.currentParseCallback=e}C.currentProgressCallback=r?.progressCallback?r.progressCallback:null,this.logCallback?(C.currentLogCallback=this.logCallback,C._ts_parser_enable_logger_wasm(this[0],1)):(C.currentLogCallback=null,C._ts_parser_enable_logger_wasm(this[0],0));let s=0,n=0;if(r?.includedRanges){s=r.includedRanges.length,n=C._calloc(s,SIZE_OF_RANGE);let e=n;for(let t=0;t<s;t++)marshalRange(e,r.includedRanges[t]),e+=SIZE_OF_RANGE}const a=C._ts_parser_parse_wasm(this[0],this[1],t?t[0]:0,n,s);if(!a)return C.currentParseCallback=null,C.currentLogCallback=null,C.currentProgressCallback=null,null;if(!this.language)throw new Error("Parser must have a language to parse");const _=new Tree(INTERNAL,a,this.language,C.currentParseCallback);return C.currentParseCallback=null,C.currentLogCallback=null,C.currentProgressCallback=null,_}reset(){C._ts_parser_reset(this[0])}getIncludedRanges(){C._ts_parser_included_ranges_wasm(this[0]);const e=C.getValue(TRANSFER_BUFFER,"i32"),t=C.getValue(TRANSFER_BUFFER+SIZE_OF_INT,"i32"),r=new Array(e);if(e>0){let s=t;for(let t=0;t<e;t++)r[t]=unmarshalRange(s),s+=SIZE_OF_RANGE;C._free(t)}return r}getTimeoutMicros(){return C._ts_parser_timeout_micros(this[0])}setTimeoutMicros(e){C._ts_parser_set_timeout_micros(this[0],0,e)}setLogger(e){if(e){if("function"!=typeof e)throw new Error("Logger callback must be a function");this.logCallback=e}else this.logCallback=null;return this}getLogger(){return this.logCallback}}},106:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.analyzeFunctionComplexity=t.DEFAULT_CYCLOMATIC_THRESHOLDS=t.findCyclomaticHotspots=t.calculateCyclomaticComplexity=void 0;const s=r(613);function n(e,t){let r=1;return function e(s,n){if((t.decisionNodeTypes.includes(s.type)||null!==t.getBooleanOperator(s)||t.isTryElseClause(s))&&r++,n||!t.isFunctionDefinition(s))for(const t of s.children)e(t,!1)}(e,!0),r}function a(e,t,r){const s=[];return function e(n,a,_){let o=a;if(r.decisionNodeTypes.includes(n.type)||null!==r.getBooleanOperator(n)||r.isTryElseClause(n)){const e=t.toPosition(n.startIndex).line;s.push({line:e,weight:1+a}),o=a+1}if(_||!r.isFunctionDefinition(n))for(const t of n.children)e(t,o,!1)}(e,0,!0),s}t.calculateCyclomaticComplexity=n,t.findCyclomaticHotspots=a,t.DEFAULT_CYCLOMATIC_THRESHOLDS={mediumThreshold:10,highThreshold:15},t.analyzeFunctionComplexity=function(e,r,_,o=t.DEFAULT_CYCLOMATIC_THRESHOLDS){const i=[];return function e(t){if(_.isFunctionDefinition(t)){const e=n(t,_);if(e>o.mediumThreshold){const n=r.toPosition(t.startIndex);i.push({line:n.line,column:n.column,type:s.VIOLATION_TYPE.COMPLEXITY,severity:e>o.highThreshold?s.SEVERITY.HIGH:s.SEVERITY.MEDIUM,message:`High cyclomatic complexity: ${e}. Consider breaking down this function.`,hotspots:a(t,r,_)})}}for(const r of t.children)e(r)}(e.rootNode),i}},164:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.analyzePrimitiveObsession=void 0;const s=r(613),n=r(622);function a(e){return e.slice(1,-1)}t.analyzePrimitiveObsession=function(e,t,r){const _=[];return function e(o){if(r.isFunctionDefinition(o)){const e=(0,n.findParametersNode)(o,r.nodeTypes.parameters);e&&_.push(...function(e,t,r){const n=[],a=e.children.map(e=>{const t=r.extractTypedParameter(e);return t?{...t,node:e}:null}).filter(e=>null!==e);for(let e=0;e<a.length-1;e++){const _=a[e],o=a[e+1];if(_.type===o.type&&r.primitiveTypeNames.has(_.type)){const e=t.toPosition(_.node.startIndex);n.push({line:e.line,column:e.column,type:s.VIOLATION_TYPE.PRIMITIVE_OBSESSION,severity:s.SEVERITY.MEDIUM,message:`Primitive obsession: consecutive parameters '${_.name}: ${_.type}' and '${o.name}: ${o.type}' share the same primitive type — a caller can swap them and nothing will complain. Consider distinct types (NewType, dataclass) so the type checker catches it.`})}}return n}(e,t,r)),_.push(...function(e,t,r){const{nodeTypes:n}=r,_=new Map,o=new Map;function i(e){return r.variableReferenceNodeTypes.includes(e.type)}function l(e,t){const r=e.text;_.has(r)||(_.set(r,new Set),o.set(r,e));const s=_.get(r);t.forEach(e=>s.add(e))}!function e(t){for(const{left:e,right:s}of r.getEqualityComparisons(t))i(e)&&s.type===n.stringLiteral?l(e,[a(s.text)]):i(s)&&e.type===n.stringLiteral&&l(s,[a(e.text)]);for(const{left:e,values:s}of r.getMembershipComparisons(t))i(e)&&s.length>0&&l(e,s);for(const r of t.children)e(r)}(e);const u=[];for(const[e,r]of _)if(r.size>=3){const n=o.get(e),a=t.toPosition(n.startIndex),_=Array.from(r).slice(0,4);u.push({line:a.line,column:a.column,type:s.VIOLATION_TYPE.PRIMITIVE_OBSESSION,severity:s.SEVERITY.LOW,message:`Stringly-typed control flow: '${e}' is compared against ${r.size} distinct string literals (${_.join(", ")}${r.size>_.length?", …":""}). Consider an Enum or Literal type to catch typos and get exhaustiveness checking.`})}return u}(o,t,r))}for(const t of o.children)e(t)}(e.rootNode),_}},186:function(e,t,r){var s=this&&this.__createBinding||(Object.create?function(e,t,r,s){void 0===s&&(s=r);var n=Object.getOwnPropertyDescriptor(t,r);n&&!("get"in n?!t.__esModule:n.writable||n.configurable)||(n={enumerable:!0,get:function(){return t[r]}}),Object.defineProperty(e,s,n)}:function(e,t,r,s){void 0===s&&(s=r),e[s]=t[r]}),n=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),a=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.prototype.hasOwnProperty.call(e,r)&&s(t,e,r);return n(t,e),t};Object.defineProperty(t,"__esModule",{value:!0});const _=a(r(896)),o=a(r(928)),{Parser:i,Language:l}=r(78),u=r(958),d=r(212),c=r(912),m=r(613);function p(){console.error("Usage: energy-state-cli <file.py|.fs|.fsx|.ts> [--medium-nesting N] [--high-nesting N] [--medium-cyclomatic N] [--high-cyclomatic N] [--medium-cognitive N] [--high-cognitive N]")}(async function(){const{filePath:e,nesting:t,cyclomatic:r,cognitive:s}=function(e){const t=t=>{const r=e.indexOf(`--${t}`);return-1!==r?Number(e[r+1]):void 0};return{filePath:e.find(e=>!e.startsWith("--")),nesting:{mediumThreshold:t("medium-nesting"),highThreshold:t("high-nesting")},cyclomatic:{mediumThreshold:t("medium-cyclomatic"),highThreshold:t("high-cyclomatic")},cognitive:{mediumThreshold:t("medium-cognitive"),highThreshold:t("high-cognitive")}}}(process.argv.slice(2));e||(p(),process.exit(2));const n=(0,c.resolveLanguageForFile)(e);n||(console.error(`Unsupported file type: ${e}`),p(),process.exit(2));const a=_.readFileSync(e,"utf8");await i.init();const h=new i,g=o.join(__dirname,"..",n.grammarPath),f=await l.load(g);h.setLanguage(f);const E=h.parse(a),y=(0,u.analyzeSource)(a,E,n,e,{nesting:void 0!==t.mediumThreshold||void 0!==t.highThreshold?{mediumThreshold:t.mediumThreshold??d.DEFAULT_NESTING_THRESHOLDS.mediumThreshold,highThreshold:t.highThreshold??d.DEFAULT_NESTING_THRESHOLDS.highThreshold}:void 0,cyclomatic:void 0!==r.mediumThreshold||void 0!==r.highThreshold?{mediumThreshold:r.mediumThreshold??10,highThreshold:r.highThreshold??15}:void 0,cognitive:void 0!==s.mediumThreshold||void 0!==s.highThreshold?{mediumThreshold:s.mediumThreshold??15,highThreshold:s.highThreshold??25}:void 0});console.log(JSON.stringify(y,null,2));const w=y.some(e=>e.severity===m.SEVERITY.HIGH||e.severity===m.SEVERITY.MEDIUM);process.exit(w?1:0)})().catch(e=>{console.error("energy-state-cli failed:",e),process.exit(1)})},212:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.analyzeNesting=t.DEFAULT_NESTING_THRESHOLDS=void 0;const s=r(613);t.DEFAULT_NESTING_THRESHOLDS={mediumThreshold:3,highThreshold:5},t.analyzeNesting=function(e,r,n,a=t.DEFAULT_NESTING_THRESHOLDS){const _=[];return function e(t,o=0){if(n.nestingControlTypes.includes(t.type)){if(o>a.mediumThreshold){const e=r.toPosition(t.startIndex);_.push({line:e.line,column:e.column,type:s.VIOLATION_TYPE.NESTING,severity:o>a.highThreshold?s.SEVERITY.HIGH:s.SEVERITY.MEDIUM,message:`Excessive nesting depth: ${o}. Consider extracting.`})}o++}for(const r of t.children)e(r,o)}(e.rootNode),_}},501:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TYPESCRIPT=void 0,t.TYPESCRIPT={id:"typescript",grammarPath:"grammars/tree-sitter-typescript.wasm",nodeTypes:{block:"statement_block",parameters:"formal_parameters",ifStatement:"if_statement",elseClause:"else_clause",forStatement:"for_statement",whileStatement:"while_statement",conditionalExpression:"ternary_expression",lambda:"arrow_function",importStatement:"import_statement",importFromStatement:null,expressionStatement:"expression_statement",assignment:"lexical_declaration",module:"program",exportStatement:"export_statement",comment:"comment",integerLiteral:"number",floatLiteral:null,stringLiteral:"string"},isFunctionDefinition:e=>"function_declaration"===e?.type||"method_definition"===e?.type,parameterChildTypes:["required_parameter","optional_parameter"],decisionNodeTypes:["if_statement","for_statement","for_in_statement","while_statement","catch_clause","ternary_expression"],cognitiveNestedDecisionTypes:["if_statement","for_statement","for_in_statement","while_statement","catch_clause"],nestingControlTypes:["if_statement","for_statement","for_in_statement","while_statement"],getBooleanOperator(e){if(!e||"binary_expression"!==e.type)return null;const t=e.children?.find(e=>"&&"===e.type||"||"===e.type);return t?"&&"===t.type?"and":"or":null},entersNestedScope:e=>"statement_block"===e?.type,isTryElseClause:()=>!1,variableReferenceNodeTypes:["identifier","member_expression"],extractTypedParameter(e){if("required_parameter"!==e?.type&&"optional_parameter"!==e?.type)return null;const t=e.children.find(e=>"identifier"===e.type),r=e.children.find(e=>"type_annotation"===e.type);if(!t||!r)return null;const s=r.children.find(e=>":"!==e.type);return s?{name:t.text,type:s.text}:null},primitiveTypeNames:new Set(["string","number","boolean"]),getEqualityComparisons(e){if("binary_expression"!==e?.type)return[];const t=e.children.find(e=>"==="===e.type||"=="===e.type);if(!t)return[];const r=e.children.filter(e=>e!==t);return 2!==r.length?[]:[{left:r[0],right:r[1]}]},getMembershipComparisons:()=>[],getElseIfBranches:()=>[]}},599:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createPositionLookup=void 0,t.createPositionLookup=function(e){const t=[0];for(let r=0;r<e.length;r++)"\n"===e[r]&&t.push(r+1);return{toPosition(e){let r=0,s=t.length-1;for(;r<s;){const n=Math.ceil((r+s)/2);t[n]<=e?r=n:s=n-1}return{line:r,column:e-t[r]}}}}},613:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.VIOLATION_TYPE=t.SEVERITY=void 0,t.SEVERITY={LOW:"low",MEDIUM:"medium",HIGH:"high"},t.VIOLATION_TYPE={NESTING:"nesting",COMPLEXITY:"complexity",COGNITIVE:"cognitive",NAMING:"naming",COHERENCE:"coherence",MAGIC:"magic",PARAMETERS:"parameters",INVERSION:"inversion",PRIMITIVE_OBSESSION:"primitive-obsession",MATCH_OPPORTUNITY:"match-opportunity",LOGICAL_CONTROL_FLOW:"logical-control-flow"}},622:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.analyzeParameterCount=t.findParametersNode=void 0;const s=r(613);function n(e,t){for(const r of e.children)if(r.type===t)return r;for(const r of e.children){const e=n(r,t);if(e)return e}}t.findParametersNode=n,t.analyzeParameterCount=function(e,t,r){const a=[];return function e(_){if(r.isFunctionDefinition(_)){const e=n(_,r.nodeTypes.parameters);if(e){const n=e.children.filter(e=>r.parameterChildTypes.includes(e.type)).length;if(n>5){const e=t.toPosition(_.startIndex);a.push({line:e.line,column:e.column,type:s.VIOLATION_TYPE.PARAMETERS,severity:n>8?s.SEVERITY.HIGH:s.SEVERITY.MEDIUM,message:`Parameter explosion: ${n} parameters. Consider using objects or builder pattern.`})}}}for(const t of _.children)e(t)}(e.rootNode),a}},632:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.analyzeLogicalControlFlow=void 0;const s=r(613);t.analyzeLogicalControlFlow=function(e,t,r){const n=[],{nodeTypes:a}=r;return function e(_){const o=r.getBooleanOperator(_);if(null!==o&&_.parent?.type===a.expressionStatement){const e=t.toPosition(_.startIndex);n.push({line:e.line,column:e.column,type:s.VIOLATION_TYPE.LOGICAL_CONTROL_FLOW,severity:s.SEVERITY.LOW,message:"and"===o?"If-statement disguised as '&&'. Consider an explicit if-statement instead.":"If-statement disguised as '||'. Consider an explicit if-statement instead."})}for(const t of _.children)e(t)}(e.rootNode),n}},764:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.analyzeFileCoherence=t.DEFAULT_COHERENCE_THRESHOLDS=void 0;const s=r(613);t.DEFAULT_COHERENCE_THRESHOLDS={largeFunctionLines:20,maxLargeFunctions:5},t.analyzeFileCoherence=function(e,r,n,a=t.DEFAULT_COHERENCE_THRESHOLDS){const _=[],o=[],i=[],{nodeTypes:l}=n;!function e(t){n.isFunctionDefinition(t)?o.push(t):t.type!==l.importStatement&&t.type!==l.importFromStatement||i.push(t.text||"");for(const r of t.children)e(r)}(e.rootNode);const u=o.filter(e=>{return(t=e).endPosition.row-t.startPosition.row+1>a.largeFunctionLines;var t});if(o.length>8){const e=r.split("/").pop()||"";(e.includes("util")||e.includes("helper")||e.includes("common")||o.length>12)&&_.push({line:0,column:0,type:s.VIOLATION_TYPE.COHERENCE,severity:o.length>15?s.SEVERITY.HIGH:s.SEVERITY.MEDIUM,message:`File coherence warning: ${o.length} functions in one file. Consider splitting by domain.`})}return u.length>a.maxLargeFunctions&&_.push({line:0,column:0,type:s.VIOLATION_TYPE.COHERENCE,severity:u.length>1.5*a.maxLargeFunctions?s.SEVERITY.HIGH:s.SEVERITY.MEDIUM,message:`${u.length} functions exceed ${a.largeFunctionLines} lines. Large functions carry more complexity than function count alone suggests.`}),i.length>10&&_.push({line:0,column:0,type:s.VIOLATION_TYPE.COHERENCE,severity:i.length>15?s.SEVERITY.HIGH:s.SEVERITY.MEDIUM,message:`Import sprawl: ${i.length} imports suggest this file does too much.`}),_}},774:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.analyzeMatchOpportunities=t.DEFAULT_MATCH_OPPORTUNITY_THRESHOLDS=void 0;const s=r(613);t.DEFAULT_MATCH_OPPORTUNITY_THRESHOLDS={minBranches:3},t.analyzeMatchOpportunities=function(e,r,n,a=t.DEFAULT_MATCH_OPPORTUNITY_THRESHOLDS){const _=[],{nodeTypes:o}=n,i=new Set;return function e(t){t.type!==o.ifStatement||i.has(t)||function(e){const t=function(e,t){const r=[e],s=t.getElseIfBranches(e);if(s.length>0)return r.push(...s),r;let n=e;for(;;){const e=n.children?.find(e=>e.type===t.nodeTypes.elseClause);if(!e)break;const s=e.children?.find(e=>e.type===t.nodeTypes.ifStatement);if(!s)break;r.push(s),n=s}return r}(e,n);if(t.slice(1).forEach(e=>i.add(e)),t.length<a.minBranches)return;const o=t.map(e=>function(e,t,r){const{nodeTypes:s}=r,n=[];function a(e){return r.variableReferenceNodeTypes.includes(e.type)}function _(e){return e.type===s.stringLiteral||e.type===s.integerLiteral||e.type===s.floatLiteral}function o(e){return e.type===s.stringLiteral?e.text.slice(1,-1):e.text}return function e(i){if(!t.has(i)&&i.type!==s.block&&i.type!==s.elseClause){for(const{left:e,right:t}of r.getEqualityComparisons(i))a(e)&&_(t)?n.push({variable:e.text,value:o(t)}):a(t)&&_(e)&&n.push({variable:t.text,value:o(e)});for(const{left:e,values:t}of r.getMembershipComparisons(i))a(e)&&t.forEach(t=>n.push({variable:e.text,value:t}));for(const t of i.children||[])e(t)}}(e),n}(e,new Set(t.filter(t=>t!==e)),n));if(o.some(e=>0===e.length))return;const l=o[0].map(e=>e.variable).find(e=>o.every(t=>t.some(t=>t.variable===e)));if(!l)return;const u=r.toPosition(e.startIndex);_.push({line:u.line,column:u.column,type:s.VIOLATION_TYPE.MATCH_OPPORTUNITY,severity:s.SEVERITY.LOW,message:`This ${t.length}-way if/elif chain all branch on '${l}'. Consider a match/switch statement for clearer, exhaustiveness-checked dispatch.`})}(t);for(const r of t.children||[])e(r)}(e.rootNode),_}},896:e=>{e.exports=require("fs")},907:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.analyzeInversionOpportunities=void 0;const s=r(613);t.analyzeInversionOpportunities=function(e,t,r){const n=[],{nodeTypes:a}=r;return function e(_){r.isFunctionDefinition(_)&&function(e){const r=e.children.find(e=>e.type===a.block);if(!r)return;const _=r.children.filter(e=>e.isNamed&&e.type!==a.comment&&e.text?.trim());if(_.length>=1){const r=_[0];if(r.type===a.ifStatement){const _=r.children.find(e=>e.type===a.block);if(_&&_.children.length>2){const a=e.endIndex-e.startIndex;if((_.endIndex-_.startIndex)/a>.5){const e=t.toPosition(r.startIndex);n.push({line:e.line,column:e.column,type:s.VIOLATION_TYPE.INVERSION,severity:s.SEVERITY.MEDIUM,message:"Consider inverting this condition and using early return for cleaner flow."})}}}}(function(e){let r=e,_=0;const o=[];for(;r&&_<4;){const e=r.children?.filter(e=>e.type===a.ifStatement||e.type===a.forStatement||e.type===a.whileStatement)||[];if(1!==e.length||e[0].type!==a.ifStatement)break;{const t=e[0];if(o.push(t),t.children.some(e=>e.type===a.elseClause))break;r=t.children.find(e=>e.type===a.block),_++}}if(o.length>=2){const e=o[0],r=t.toPosition(e.startIndex);n.push({line:r.line,column:r.column,type:s.VIOLATION_TYPE.INVERSION,severity:s.SEVERITY.MEDIUM,message:`Found ${o.length} nested validation checks. Consider using guard clauses with early returns.`})}})(r),function(e){let r=0,_=null;if(function e(t,s=0){t.type===a.ifStatement&&(s>r&&(r=s,_=t),s++);for(const r of t.children||[])e(r,s)}(e),r>=3&&_){const e=t.toPosition(_.startIndex);n.push({line:e.line,column:e.column,type:s.VIOLATION_TYPE.INVERSION,severity:s.SEVERITY.MEDIUM,message:`Deep if-nesting (${r} levels). Consider inverting conditions or extracting functions.`})}}(r)}(_);for(const t of _.children)e(t)}(e.rootNode),n}},912:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.resolveLanguageForFile=t.LANGUAGES=void 0;const s=r(996),n=r(964),a=r(501);t.LANGUAGES={python:s.PYTHON,fsharp:n.FSHARP,typescript:a.TYPESCRIPT};const _={".py":"python",".fs":"fsharp",".fsx":"fsharp",".fsi":"fsharp",".ts":"typescript"};t.resolveLanguageForFile=function(e){const r=e.lastIndexOf(".");if(-1===r)return;const s=e.slice(r).toLowerCase(),n=_[s];return n?t.LANGUAGES[n]:void 0}},928:e=>{e.exports=require("path")},943:e=>{e.exports=require("fs/promises")},955:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.analyzeMagicValues=t.DEFAULT_MAGIC_VALUES_OPTIONS=void 0;const s=r(613);t.DEFAULT_MAGIC_VALUES_OPTIONS={enabled:!0},t.analyzeMagicValues=function(e,r,n,a=t.DEFAULT_MAGIC_VALUES_OPTIONS){const _=[];if(!a.enabled)return _;const{nodeTypes:o}=n;return function e(t){if(t.type===o.integerLiteral||t.type===o.floatLiteral){const e=parseInt(t.text)||parseFloat(t.text);if(e>1&&100!==e&&1e3!==e&&!function(e){let t=e.parent;for(;t;){if(t.type===o.assignment){if(n.isFunctionDefinition(t))return!1;const e=t.parent;if(e?.type===o.module)return!0;if(o.exportStatement&&e?.type===o.exportStatement&&e.parent?.type===o.module)return!0}t=t.parent}return!1}(t)){const e=r.toPosition(t.startIndex);_.push({line:e.line,column:e.column,type:s.VIOLATION_TYPE.MAGIC,severity:s.SEVERITY.LOW,message:`Magic number: ${t.text}. Consider extracting to a named constant.`})}}if(t.type===o.stringLiteral&&t.text.length>15&&!function(e){return e.parent?.type===o.expressionStatement}(t)){const e=t.text.slice(1,-1);if(e.includes(" ")&&(e.includes("error")||e.includes("invalid")||e.includes("not found"))){const e=r.toPosition(t.startIndex);_.push({line:e.line,column:e.column,type:s.VIOLATION_TYPE.MAGIC,severity:s.SEVERITY.LOW,message:"Magic string: Consider extracting error messages to constants."})}}for(const r of t.children)e(r)}(e.rootNode),_}},958:(e,t,r)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.analyzeSource=void 0;const s=r(599),n=r(212),a=r(106),_=r(58),o=r(764),i=r(955),l=r(622),u=r(907),d=r(164),c=r(774),m=r(632);t.analyzeSource=function(e,t,r,p,h={}){const g=(0,s.createPositionLookup)(e),f=[];return f.push(...(0,n.analyzeNesting)(t,g,r,h.nesting??n.DEFAULT_NESTING_THRESHOLDS)),f.push(...(0,a.analyzeFunctionComplexity)(t,g,r,h.cyclomatic??a.DEFAULT_CYCLOMATIC_THRESHOLDS)),f.push(...(0,_.analyzeCognitiveComplexity)(t,g,r,h.cognitive??_.DEFAULT_COGNITIVE_THRESHOLDS)),f.push(...(0,o.analyzeFileCoherence)(t,p,r,h.coherence??o.DEFAULT_COHERENCE_THRESHOLDS)),f.push(...(0,i.analyzeMagicValues)(t,g,r,h.magicValues??i.DEFAULT_MAGIC_VALUES_OPTIONS)),f.push(...(0,l.analyzeParameterCount)(t,g,r)),f.push(...(0,u.analyzeInversionOpportunities)(t,g,r)),f.push(...(0,d.analyzePrimitiveObsession)(t,g,r)),f.push(...(0,c.analyzeMatchOpportunities)(t,g,r,h.matchOpportunity??c.DEFAULT_MATCH_OPPORTUNITY_THRESHOLDS)),f.push(...(0,m.analyzeLogicalControlFlow)(t,g,r)),f}},964:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.FSHARP=void 0,t.FSHARP={id:"fsharp",grammarPath:"grammars/tree-sitter-fsharp.wasm",nodeTypes:{block:null,parameters:"argument_patterns",ifStatement:"if_expression",elseClause:null,forStatement:"for_expression",whileStatement:"while_expression",conditionalExpression:null,lambda:"fun_expression",importStatement:"import_decl",importFromStatement:null,expressionStatement:null,assignment:"function_or_value_defn",module:"declaration_expression",exportStatement:null,comment:"line_comment",integerLiteral:"int",floatLiteral:"float",stringLiteral:"string"},isFunctionDefinition:e=>"function_or_value_defn"===e?.type&&e.children?.some(e=>"function_declaration_left"===e.type),parameterChildTypes:["long_identifier","typed_pattern"],decisionNodeTypes:["if_expression","elif_expression","for_expression","while_expression","try_expression","match_expression"],cognitiveNestedDecisionTypes:["if_expression","elif_expression","for_expression","while_expression","try_expression","match_expression"],nestingControlTypes:["if_expression","elif_expression","for_expression","while_expression","match_expression"],getBooleanOperator(e){if(!e||"infix_expression"!==e.type)return null;const t=e.children?.find(e=>"infix_op"===e.type);return"&&"===t?.text?"and":"||"===t?.text?"or":null},entersNestedScope:()=>!0,isTryElseClause:()=>!1,variableReferenceNodeTypes:["long_identifier_or_op"],extractTypedParameter(e){if("typed_pattern"!==e?.type)return null;const t=e.children.find(e=>"identifier_pattern"===e.type),r=e.children.find(e=>"simple_type"===e.type);return t&&r?{name:t.text,type:r.text}:null},primitiveTypeNames:new Set(["string","int","float","bool"]),getEqualityComparisons(e){if("infix_expression"!==e?.type)return[];const t=e.children.find(e=>"infix_op"===e.type);if(!t||"="!==t.text)return[];const r=e.children.filter(e=>"infix_op"!==e.type);if(2!==r.length)return[];const[s,n]=r;return[{left:s,right:"const"===n.type&&1===n.children?.length?n.children[0]:n}]},getMembershipComparisons:()=>[],getElseIfBranches:e=>e?.children?.filter(e=>"elif_expression"===e.type)??[]}},996:(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PYTHON=void 0,t.PYTHON={id:"python",grammarPath:"grammars/tree-sitter-python.wasm",nodeTypes:{block:"block",parameters:"parameters",ifStatement:"if_statement",elseClause:"else_clause",forStatement:"for_statement",whileStatement:"while_statement",conditionalExpression:"conditional_expression",lambda:"lambda",importStatement:"import_statement",importFromStatement:"import_from_statement",expressionStatement:"expression_statement",assignment:"assignment",module:"module",exportStatement:null,comment:"comment",integerLiteral:"integer",floatLiteral:"float",stringLiteral:"string"},isFunctionDefinition:e=>"function_definition"===e?.type,parameterChildTypes:["identifier","default_parameter"],decisionNodeTypes:["if_statement","elif_clause","while_statement","for_statement","except_clause","conditional_expression","match_statement"],cognitiveNestedDecisionTypes:["if_statement","elif_clause","for_statement","while_statement","except_clause","match_statement"],nestingControlTypes:["if_statement","for_statement","while_statement","with_statement","match_statement"],getBooleanOperator(e){if(!e||"boolean_operator"!==e.type)return null;const t=e.children?.find(e=>"and"===e.type||"or"===e.type);return t?t.type:null},entersNestedScope:e=>"block"===e?.type,isTryElseClause:e=>"else_clause"===e?.type&&"try_statement"===e?.parent?.type,variableReferenceNodeTypes:["identifier","attribute"],extractTypedParameter(e){if("typed_parameter"!==e?.type&&"typed_default_parameter"!==e?.type)return null;const t=e.children.find(e=>"identifier"===e.type),r=e.children.find(e=>"type"===e.type);return t&&r?{name:t.text,type:r.text}:null},primitiveTypeNames:new Set(["str","int","float","bool","bytes"]),getEqualityComparisons(e){if("comparison_operator"!==e?.type)return[];const t=[],r=e.children;for(let e=1;e<r.length-1;e++)"=="===r[e].type&&t.push({left:r[e-1],right:r[e+1]});return t},getMembershipComparisons(e){if("comparison_operator"!==e?.type)return[];const t=[],r=e.children;for(let e=1;e<r.length-1;e++){if("in"!==r[e].type)continue;const s=r[e-1],n=r[e+1];if("tuple"!==n.type&&"list"!==n.type&&"set"!==n.type)continue;const a=[];let _=!0;for(const e of n.children)if(e.isNamed){if("string"!==e.type){_=!1;break}a.push(e.text.slice(1,-1))}_&&a.length>0&&t.push({left:s,values:a})}return t},getElseIfBranches:e=>e?.children?.filter(e=>"elif_clause"===e.type)??[]}}},__webpack_module_cache__={},leafPrototypes,getProto;function __webpack_require__(e){var t=__webpack_module_cache__[e];if(void 0!==t)return t.exports;var r=__webpack_module_cache__[e]={exports:{}};return __webpack_modules__[e].call(r.exports,r,r.exports,__webpack_require__),r.exports}getProto=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,__webpack_require__.t=function(e,t){if(1&t&&(e=this(e)),8&t)return e;if("object"==typeof e&&e){if(4&t&&e.__esModule)return e;if(16&t&&"function"==typeof e.then)return e}var r=Object.create(null);__webpack_require__.r(r);var s={};leafPrototypes=leafPrototypes||[null,getProto({}),getProto([]),getProto(getProto)];for(var n=2&t&&e;("object"==typeof n||"function"==typeof n)&&!~leafPrototypes.indexOf(n);n=getProto(n))Object.getOwnPropertyNames(n).forEach(t=>s[t]=()=>e[t]);return s.default=()=>e,__webpack_require__.d(r,s),r},__webpack_require__.d=(e,t)=>{for(var r in t)__webpack_require__.o(t,r)&&!__webpack_require__.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},__webpack_require__.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),__webpack_require__.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var __webpack_exports__=__webpack_require__(186);module.exports=__webpack_exports__})();
|