// Code generated by _scripts/generate-encoder.ts. DO NOT EDIT.
import { getTokenPosOfNode, ModifierFlags, SyntaxKind, } from "../../ast/index.js";
import { modifierToFlag, NODE_CHILD_MASK, NODE_DATA_TYPE_MASK, NODE_EXTENDED_DATA_MASK, NODE_STRING_INDEX_MASK, popcount8, RemoteNodeBase, } from "./node.infrastructure.js";
import { childProperties, KIND_NODE_LIST, NODE_DATA_TYPE_CHILDREN, NODE_DATA_TYPE_EXTENDED, NODE_DATA_TYPE_STRING, NODE_LEN, NODE_OFFSET_DATA, NODE_OFFSET_END, NODE_OFFSET_FLAGS, NODE_OFFSET_KIND, NODE_OFFSET_NEXT, NODE_OFFSET_PARENT, NODE_OFFSET_POS, } from "./protocol.js";
export class RemoteNodeList extends Array {
    // Inherited Array methods like filter/map/slice use ArraySpeciesCreate, which would
    // otherwise call `new RemoteNodeList(length)` and fail. Produce a plain Array instead.
    static get [Symbol.species]() {
        return Array;
    }
    parent;
    _hasTrailingCommaMemo;
    transformFlags = 0;
    view;
    index;
    _byteIndex;
    // Cursor memoizing the last resolved (logical index -> node index) so that
    // sequential forward access (index loops and list[i], plus forEach/map/
    // reduce/filter) resumes instead of re-walking from the head, turning an
    // O(n) pass over the whole list from O(n^2) into O(n).
    _cursorIndex = 0;
    _cursorNodeIndex = 0;
    get pos() {
        return this.view.getUint32(this._byteIndex + NODE_OFFSET_POS, true);
    }
    get end() {
        return this.view.getUint32(this._byteIndex + NODE_OFFSET_END, true);
    }
    get next() {
        return this.view.getUint32(this._byteIndex + NODE_OFFSET_NEXT, true);
    }
    // The wire format doesn't carry hasTrailingComma, but the list range covers
    // the delimiter after the last element, so it can be recovered from source
    // text: the first non-trivia character in [lastElement.end, list.end) is
    // either "," or nothing. Consumers like the fork printer rely on it to
    // faithfully re-emit parse-tree lists (e.g. object literal defaults).
    get hasTrailingComma() {
        if (this._hasTrailingCommaMemo === undefined) {
            this._hasTrailingCommaMemo = this.computeHasTrailingComma();
        }
        return this._hasTrailingCommaMemo;
    }
    set hasTrailingComma(value) {
        this._hasTrailingCommaMemo = value;
    }
    computeHasTrailingComma() {
        const len = this.length;
        if (len === 0)
            return false;
        const last = this.at(len - 1);
        const start = last?.end;
        const end = this.end;
        if (typeof start !== "number" || start < 0 || end <= start)
            return false;
        let fullText;
        try {
            fullText = this.parent?.getSourceFile?.()?.text;
        }
        catch {
            return false;
        }
        if (typeof fullText !== "string" || end > fullText.length)
            return false;
        const text = fullText.substring(start, end);
        // Scan past trivia (whitespace + comments); the only token that can
        // appear before the close bracket is the trailing delimiter.
        for (let i = 0; i < text.length; i++) {
            const ch = text[i];
            if (ch === ",")
                return true;
            if (ch === " " || ch === "\t" || ch === "\r" || ch === "\n")
                continue;
            if (ch === "/" && text[i + 1] === "/") {
                const nl = text.indexOf("\n", i + 2);
                if (nl === -1)
                    return false;
                i = nl;
                continue;
            }
            if (ch === "/" && text[i + 1] === "*") {
                const close = text.indexOf("*/", i + 2);
                if (close === -1)
                    return false;
                i = close + 1;
                continue;
            }
            return false;
        }
        return false;
    }
    get data() {
        return this.view.getUint32(this._byteIndex + NODE_OFFSET_DATA, true);
    }
    sourceFile;
    constructor(view, index, parent, sourceFile, offsetNodes) {
        super();
        this.view = view;
        this.index = index;
        this.parent = parent;
        this.sourceFile = sourceFile;
        this._byteIndex = offsetNodes + index * NODE_LEN;
        this.length = this.data;
        this._cursorNodeIndex = index + 1;
        const length = this.length;
        for (let i = 16; i < length; i++) {
            Object.defineProperty(this, i, {
                get() {
                    return this.at(i);
                },
            });
        }
    }
    get 0() {
        return this.at(0);
    }
    get 1() {
        return this.at(1);
    }
    get 2() {
        return this.at(2);
    }
    get 3() {
        return this.at(3);
    }
    get 4() {
        return this.at(4);
    }
    get 5() {
        return this.at(5);
    }
    get 6() {
        return this.at(6);
    }
    get 7() {
        return this.at(7);
    }
    get 8() {
        return this.at(8);
    }
    get 9() {
        return this.at(9);
    }
    get 10() {
        return this.at(10);
    }
    get 11() {
        return this.at(11);
    }
    get 12() {
        return this.at(12);
    }
    get 13() {
        return this.at(13);
    }
    get 14() {
        return this.at(14);
    }
    get 15() {
        return this.at(15);
    }
    *[Symbol.iterator]() {
        if (!this.length)
            return;
        let next = this.index + 1;
        while (next) {
            const child = this.getOrCreateChildAtNodeIndex(next);
            next = child.next;
            yield child;
        }
    }
    forEachNode(visitNode) {
        if (!this.length)
            return;
        let next = this.index + 1;
        while (next) {
            const child = this.getOrCreateChildAtNodeIndex(next);
            next = child.next;
            const result = visitNode(child);
            if (result)
                return result;
        }
    }
    at(index) {
        if (!Number.isInteger(index)) {
            return undefined;
        }
        if (index >= this.data || (index < 0 && -index > this.data)) {
            return undefined;
        }
        if (index < 0) {
            index = this.length + index;
        }
        // Walk the raw buffer following each node's `next` pointer instead of
        // materializing every intermediate RemoteNode just to read it. Resume from
        // the memoized cursor when possible so sequential forward access is O(1)
        // amortized (a full in-order pass is O(n) rather than O(n^2)).
        const offsetNodes = this.sourceFile._offsetNodes;
        let i;
        let next;
        if (index >= this._cursorIndex) {
            i = this._cursorIndex;
            next = this._cursorNodeIndex;
        }
        else {
            i = 0;
            next = this.index + 1;
        }
        for (; i < index; i++) {
            next = this.view.getUint32(offsetNodes + next * NODE_LEN + NODE_OFFSET_NEXT, true);
        }
        this._cursorIndex = index;
        this._cursorNodeIndex = next;
        return this.getOrCreateChildAtNodeIndex(next);
    }
    getOrCreateChildAtNodeIndex(index) {
        let child = this.sourceFile.nodes[index];
        if (!child) {
            const kind = this.view.getUint32(this.sourceFile._offsetNodes + index * NODE_LEN + NODE_OFFSET_KIND, true);
            if (kind === KIND_NODE_LIST) {
                throw new Error("NodeList cannot directly contain another NodeList");
            }
            const sf = this.sourceFile;
            child = new RemoteNode(this.view, index, this.parent, sf, sf._offsetNodes);
            sf.nodes[index] = child;
            sf._timing?.recordMaterialization();
        }
        return child;
    }
    __print() {
        const result = [];
        result.push(`kind: NodeList`);
        result.push(`index: ${this.index}`);
        result.push(`byteIndex: ${this._byteIndex}`);
        result.push(`length: ${this.length}`);
        return result.join("\n");
    }
}
export class RemoteNode extends RemoteNodeBase {
    static NODE_LEN = NODE_LEN;
    get sourceFile() {
        return this._sourceFile;
    }
    _sourceFile;
    get id() {
        return `${this.index}.${this._rawKind}.${this.sourceFile.path}`;
    }
    constructor(view, index, parent, sourceFile, offsetNodes) {
        super(view, index, parent, offsetNodes + index * NODE_LEN);
        this._sourceFile = sourceFile;
    }
    forEachChild(visitNode, visitList) {
        if (this.hasChildren()) {
            let next = this.index + 1;
            do {
                const child = this.getOrCreateChildAtNodeIndex(next);
                if (child instanceof RemoteNodeList) {
                    if (visitList) {
                        const result = visitList(child);
                        if (result) {
                            return result;
                        }
                    }
                    else {
                        const result = child.forEachNode(visitNode);
                        if (result) {
                            return result;
                        }
                    }
                }
                else if (child._rawKind !== SyntaxKind.JSDoc) {
                    const result = visitNode(child);
                    if (result) {
                        return result;
                    }
                }
                next = child.next;
            } while (next);
        }
    }
    get jsDoc() {
        if (!this.hasChildren()) {
            return undefined;
        }
        let result;
        let next = this.index + 1;
        do {
            const child = this.getOrCreateChildAtNodeIndex(next);
            if (!(child instanceof RemoteNodeList) && child._rawKind === SyntaxKind.JSDoc) {
                (result ??= []).push(child);
            }
            next = child.next;
        } while (next);
        return result;
    }
    getSourceFile() {
        return this.sourceFile;
    }
    getStart(sourceFile, includeJsDocComment) {
        return getTokenPosOfNode(this, sourceFile ?? this.getSourceFile(), includeJsDocComment);
    }
    getFullStart() {
        return this.pos;
    }
    getEnd() {
        return this.end;
    }
    getWidth(sourceFile) {
        return this.getEnd() - this.getStart(sourceFile);
    }
    getFullWidth() {
        return this.end - this.pos;
    }
    getLeadingTriviaWidth(sourceFile) {
        return this.getStart(sourceFile) - this.pos;
    }
    getFullText(sourceFile) {
        return (sourceFile ?? this.getSourceFile()).text.substring(this.pos, this.end);
    }
    getText(sourceFile) {
        sourceFile ??= this.getSourceFile();
        return sourceFile.text.substring(this.getStart(sourceFile), this.end);
    }
    getString(index) {
        const offsetStringTableOffsets = this.sourceFile._offsetStringTableOffsets;
        const start = this.view.getUint32(offsetStringTableOffsets + index * 4, true);
        const end = this.view.getUint32(offsetStringTableOffsets + (index + 1) * 4, true);
        const offsetStringTable = this.sourceFile._offsetStringTable;
        const text = new Uint8Array(this.view.buffer, this.view.byteOffset + offsetStringTable + start, end - start);
        return this.sourceFile._decoder.decode(text);
    }
    getOrCreateChildAtNodeIndex(index) {
        let child = this.sourceFile.nodes[index];
        if (!child) {
            const sf = this.sourceFile;
            const offsetNodes = sf._offsetNodes;
            const kind = this.view.getUint32(offsetNodes + index * NODE_LEN + NODE_OFFSET_KIND, true);
            child = kind === KIND_NODE_LIST
                ? new RemoteNodeList(this.view, index, this, sf, offsetNodes)
                : new RemoteNode(this.view, index, this, sf, offsetNodes);
            sf.nodes[index] = child;
            sf._timing?.recordMaterialization();
        }
        return child;
    }
    hasChildren() {
        if (this._byteIndex >= this.view.byteLength - NODE_LEN) {
            return false;
        }
        const nextNodeParent = this.view.getUint32(this.sourceFile._offsetNodes + (this.index + 1) * NODE_LEN + NODE_OFFSET_PARENT, true);
        return nextNodeParent === this.index;
    }
    getNamedChild(propertyName) {
        // JSDocPropertyTag and JSDocParameterTag have runtime-dependent child order based on isNameFirst.
        // Handle them before the general childProperties lookup.
        const kind = this._rawKind;
        if (kind === SyntaxKind.JSDocPropertyTag) {
            let order;
            switch (propertyName) {
                case "name":
                    order = this.isNameFirst ? 0 : 1;
                    break;
                case "typeExpression":
                    order = this.isNameFirst ? 1 : 0;
                    break;
                default:
                    return undefined;
            }
            return this.getChildAtOrder(order);
        }
        else if (kind === SyntaxKind.JSDocParameterTag) {
            let order;
            switch (propertyName) {
                case "tagName":
                    order = 0;
                    break;
                case "name":
                    order = this.isNameFirst ? 1 : 2;
                    break;
                case "typeExpression":
                    order = this.isNameFirst ? 2 : 1;
                    break;
                case "comment":
                    order = 3;
                    break;
                default:
                    return undefined;
            }
            return this.getChildAtOrder(order);
        }
        const propertyNames = childProperties[kind];
        if (!propertyNames) {
            return undefined;
        }
        const order = propertyNames.indexOf(propertyName);
        if (order === -1) {
            return undefined;
        }
        return this.getChildAtOrder(order);
    }
    getChildAtOrder(order) {
        const mask = this.childMask;
        if (!(mask & (1 << order))) {
            // Property is not present
            return undefined;
        }
        // The property index is `order`, minus the number of zeros in the mask that are in bit positions less
        // than the `order`th bit. Example:
        //
        // This is a MethodDeclaration with mask 0b01110101. The possible properties are
        // ["modifiers", "asteriskToken", "name", "postfixToken", "typeParameters", "parameters", "type", "body"]
        // (it has modifiers, name, typeParameters, parameters, and type).
        //
        // | Bit   | 7    | 6    | 5          | 4              | 3            | 2    | 1             | 0         |
        // | ----- | ---- | ---- | ---------- | -------------- | ------------ | ---- | ------------- | --------- |
        // | Value | 0    | 1    | 1          | 1              | 0            | 1    | 0             | 1         |
        // | Name  | body | type | parameters | typeParameters | postfixToken | name | asteriskToken | modifiers |
        //
        // We are trying to get the index of "parameters" (bit = 5).
        // First, set all the more significant bits to 1:
        //
        // | Bit   | 7    | 6    | 5          | 4              | 3            | 2    | 1             | 0         |
        // | ----- | ---- | ---- | ---------- | -------------- | ------------ | ---- | ------------- | --------- |
        // | Value | 1    | 1    | 1          | 1              | 0            | 1    | 0             | 1         |
        //
        // Then, flip the bits:
        //
        // | Bit   | 7    | 6    | 5          | 4              | 3            | 2    | 1             | 0         |
        // | ----- | ---- | ---- | ---------- | -------------- | ------------ | ---- | ------------- | --------- |
        // | Value | 0    | 0    | 0          | 0              | 1            | 0    | 1             | 0         |
        //
        // Counting the 1s gives us the number of *missing properties* before the `order`th property. If every property
        // were present, we would have `parameters = children[5]`, but since `postfixToken` and `astersiskToken` are
        // missing, we have `parameters = children[5 - 2]`.
        const propertyIndex = order - popcount8[~(mask | ((0xff << order) & 0xff)) & 0xff];
        let childIndex = this.index + 1;
        for (let i = 0; i < propertyIndex; i++) {
            // Walk through children via their `next` pointer until we get to the right property index
            childIndex = this.view.getUint32(this.sourceFile._offsetNodes + childIndex * NODE_LEN + NODE_OFFSET_NEXT, true);
        }
        return this.getOrCreateChildAtNodeIndex(childIndex);
    }
    __print() {
        const result = [];
        result.push(`index: ${this.index}`);
        result.push(`byteIndex: ${this._byteIndex}`);
        result.push(`kind: ${SyntaxKind[this._rawKind]}`);
        result.push(`pos: ${this.pos}`);
        result.push(`end: ${this.end}`);
        result.push(`next: ${this.next}`);
        result.push(`parent: ${this.parentIndex}`);
        result.push(`data: ${this.data.toString(2).padStart(32, "0")}`);
        const dataType = this.dataType === NODE_DATA_TYPE_CHILDREN ? "children" :
            this.dataType === NODE_DATA_TYPE_STRING ? "string" :
                "extended";
        result.push(`dataType: ${dataType}`);
        if (this.dataType === NODE_DATA_TYPE_CHILDREN) {
            result.push(`childMask: ${this.childMask.toString(2).padStart(8, "0")}`);
            result.push(`childProperties: ${childProperties[this._rawKind]?.join(", ")}`);
        }
        return result.join("\n");
    }
    __printChildren() {
        const result = [];
        let next = this.index + 1;
        while (next) {
            const child = this.getOrCreateChildAtNodeIndex(next);
            next = child.next;
            result.push(child.__print());
        }
        return result.join("\n\n");
    }
    __printSubtree() {
        const result = [this.__print()];
        this.forEachChild(function visitNode(node) {
            result.push(node.__print());
            node.forEachChild(visitNode);
        }, visitList => {
            result.push(visitList.__print());
        });
        return result.join("\n\n");
    }
    // ═══ Generated boolean property getters ═══
    get containsOnlyTriviaWhiteSpaces() {
        return (this.data & (1 << 24)) !== 0;
    }
    get isArrayType() {
        return (this.data & (1 << 24)) !== 0;
    }
    get isBracketed() {
        return (this.data & (1 << 24)) !== 0;
    }
    get isExportEquals() {
        return (this.data & (1 << 24)) !== 0;
    }
    get isNameFirst() {
        return (this.data & (1 << 25)) !== 0;
    }
    get isTypeOf() {
        return (this.data & (1 << 24)) !== 0;
    }
    get isTypeOnly() {
        return (this.data & (1 << 24)) !== 0;
    }
    get multiLine() {
        return (this.data & (1 << 24)) !== 0;
    }
    // ═══ Generated SyntaxKind union property getters ═══
    get keyword() {
        switch (this._rawKind) {
            case SyntaxKind.ModuleDeclaration:
                return (this.data >> 24) & 0x1 ? SyntaxKind.NamespaceKeyword : SyntaxKind.ModuleKeyword;
        }
    }
    get keywordToken() {
        switch (this._rawKind) {
            case SyntaxKind.MetaProperty:
                return (this.data >> 24) & 0x1 ? SyntaxKind.NewKeyword : SyntaxKind.ImportKeyword;
        }
    }
    get operator() {
        switch (this._rawKind) {
            case SyntaxKind.PrefixUnaryExpression: {
                const idx = (this.data >> 24) & 0x7;
                if (idx === 1)
                    return SyntaxKind.MinusToken;
                if (idx === 2)
                    return SyntaxKind.TildeToken;
                if (idx === 3)
                    return SyntaxKind.ExclamationToken;
                if (idx === 4)
                    return SyntaxKind.PlusPlusToken;
                if (idx === 5)
                    return SyntaxKind.MinusMinusToken;
                return SyntaxKind.PlusToken;
            }
            case SyntaxKind.PostfixUnaryExpression:
                return (this.data >> 24) & 0x1 ? SyntaxKind.MinusMinusToken : SyntaxKind.PlusPlusToken;
            case SyntaxKind.TypeOperator: {
                const idx = (this.data >> 24) & 0x3;
                if (idx === 1)
                    return SyntaxKind.ReadonlyKeyword;
                if (idx === 2)
                    return SyntaxKind.UniqueKeyword;
                return SyntaxKind.KeyOfKeyword;
            }
        }
    }
    get phaseModifier() {
        switch (this._rawKind) {
            case SyntaxKind.ImportClause: {
                const idx = (this.data >> 24) & 0x3;
                if (idx === 0)
                    return undefined;
                return idx === 1 ? SyntaxKind.TypeKeyword : idx === 2 ? SyntaxKind.DeferKeyword : undefined;
            }
        }
    }
    get token() {
        switch (this._rawKind) {
            case SyntaxKind.HeritageClause:
                return (this.data >> 24) & 0x1 ? SyntaxKind.ImplementsKeyword : SyntaxKind.ExtendsKeyword;
            case SyntaxKind.ImportAttributes:
                return (this.data >> 25) & 0x1 ? SyntaxKind.AssertKeyword : SyntaxKind.WithKeyword;
        }
    }
    get templateFlags() {
        switch (this._rawKind) {
            case SyntaxKind.TemplateHead:
            case SyntaxKind.TemplateMiddle:
            case SyntaxKind.TemplateTail:
                const extendedDataOffset = this.sourceFile._offsetExtendedData + (this.data & NODE_EXTENDED_DATA_MASK);
                return this.view.getUint32(extendedDataOffset + 8, true);
        }
    }
    get tokenFlags() {
        switch (this._rawKind) {
            case SyntaxKind.StringLiteral:
            case SyntaxKind.NumericLiteral:
            case SyntaxKind.BigIntLiteral:
            case SyntaxKind.RegularExpressionLiteral:
                const extendedDataOffset = this.sourceFile._offsetExtendedData + (this.data & NODE_EXTENDED_DATA_MASK);
                return this.view.getUint32(extendedDataOffset + 4, true);
            default:
                return 0;
        }
    }
    // ═══ Generated child property getters ═══
    get argument() {
        return this.getNamedChild("argument");
    }
    get argumentExpression() {
        return this.getNamedChild("argumentExpression");
    }
    get arguments() {
        return this.getNamedChild("arguments");
    }
    get assertsModifier() {
        return this.getNamedChild("assertsModifier");
    }
    get asteriskToken() {
        return this.getNamedChild("asteriskToken");
    }
    get attributes() {
        return this.getNamedChild("attributes");
    }
    get awaitModifier() {
        return this.getNamedChild("awaitModifier");
    }
    get block() {
        return this.getNamedChild("block");
    }
    get body() {
        return this.getNamedChild("body");
    }
    get caseBlock() {
        return this.getNamedChild("caseBlock");
    }
    get catchClause() {
        return this.getNamedChild("catchClause");
    }
    get checkType() {
        return this.getNamedChild("checkType");
    }
    get children() {
        return this.getNamedChild("children");
    }
    get className() {
        return this.getNamedChild("className");
    }
    get clauses() {
        return this.getNamedChild("clauses");
    }
    get closingElement() {
        return this.getNamedChild("closingElement");
    }
    get closingFragment() {
        return this.getNamedChild("closingFragment");
    }
    get colonToken() {
        return this.getNamedChild("colonToken");
    }
    get comment() {
        return this.getNamedChild("comment");
    }
    get condition() {
        return this.getNamedChild("condition");
    }
    get constraint() {
        return this.getNamedChild("constraint");
    }
    get declarationList() {
        return this.getNamedChild("declarationList");
    }
    get declarations() {
        return this.getNamedChild("declarations");
    }
    get defaultType() {
        return this.getNamedChild("defaultType");
    }
    get dotDotDotToken() {
        return this.getNamedChild("dotDotDotToken");
    }
    get elements() {
        return this.getNamedChild("elements");
    }
    get elementType() {
        return this.getNamedChild("elementType");
    }
    get elseStatement() {
        return this.getNamedChild("elseStatement");
    }
    get endOfFileToken() {
        return this.getNamedChild("endOfFileToken");
    }
    get equalsGreaterThanToken() {
        return this.getNamedChild("equalsGreaterThanToken");
    }
    get equalsToken() {
        return this.getNamedChild("equalsToken");
    }
    get exclamationToken() {
        return this.getNamedChild("exclamationToken");
    }
    get exportClause() {
        return this.getNamedChild("exportClause");
    }
    get expression() {
        return this.getNamedChild("expression");
    }
    get exprName() {
        return this.getNamedChild("exprName");
    }
    get extendsType() {
        return this.getNamedChild("extendsType");
    }
    get falseType() {
        return this.getNamedChild("falseType");
    }
    get finallyBlock() {
        return this.getNamedChild("finallyBlock");
    }
    get head() {
        return this.getNamedChild("head");
    }
    get heritageClauses() {
        return this.getNamedChild("heritageClauses");
    }
    get importClause() {
        return this.getNamedChild("importClause");
    }
    get incrementor() {
        return this.getNamedChild("incrementor");
    }
    get indexType() {
        return this.getNamedChild("indexType");
    }
    get initializer() {
        return this.getNamedChild("initializer");
    }
    get jsdocPropertyTags() {
        return this.getNamedChild("jsdocPropertyTags");
    }
    get label() {
        return this.getNamedChild("label");
    }
    get left() {
        return this.getNamedChild("left");
    }
    get literal() {
        return this.getNamedChild("literal");
    }
    get members() {
        return this.getNamedChild("members");
    }
    get modifiers() {
        return this.getNamedChild("modifiers");
    }
    get moduleReference() {
        return this.getNamedChild("moduleReference");
    }
    get moduleSpecifier() {
        return this.getNamedChild("moduleSpecifier");
    }
    get name() {
        return this.getNamedChild("name");
    }
    get namedBindings() {
        return this.getNamedChild("namedBindings");
    }
    get nameExpression() {
        return this.getNamedChild("nameExpression");
    }
    get namespace() {
        return this.getNamedChild("namespace");
    }
    get nameType() {
        return this.getNamedChild("nameType");
    }
    get objectAssignmentInitializer() {
        return this.getNamedChild("objectAssignmentInitializer");
    }
    get objectType() {
        return this.getNamedChild("objectType");
    }
    get openingElement() {
        return this.getNamedChild("openingElement");
    }
    get openingFragment() {
        return this.getNamedChild("openingFragment");
    }
    get operand() {
        return this.getNamedChild("operand");
    }
    get operatorToken() {
        return this.getNamedChild("operatorToken");
    }
    get parameterName() {
        return this.getNamedChild("parameterName");
    }
    get parameters() {
        return this.getNamedChild("parameters");
    }
    get postfixToken() {
        return this.getNamedChild("postfixToken");
    }
    get properties() {
        return this.getNamedChild("properties");
    }
    get propertyName() {
        return this.getNamedChild("propertyName");
    }
    get qualifier() {
        return this.getNamedChild("qualifier");
    }
    get questionDotToken() {
        return this.getNamedChild("questionDotToken");
    }
    get questionToken() {
        return this.getNamedChild("questionToken");
    }
    get readonlyToken() {
        return this.getNamedChild("readonlyToken");
    }
    get right() {
        return this.getNamedChild("right");
    }
    get statement() {
        return this.getNamedChild("statement");
    }
    get statements() {
        return this.getNamedChild("statements");
    }
    get tag() {
        return this.getNamedChild("tag");
    }
    get tagName() {
        return this.getNamedChild("tagName");
    }
    get tags() {
        return this.getNamedChild("tags");
    }
    get template() {
        return this.getNamedChild("template");
    }
    get templateSpans() {
        return this.getNamedChild("templateSpans");
    }
    get thenStatement() {
        return this.getNamedChild("thenStatement");
    }
    get thisArg() {
        return this.getNamedChild("thisArg");
    }
    get trueType() {
        return this.getNamedChild("trueType");
    }
    get tryBlock() {
        return this.getNamedChild("tryBlock");
    }
    get tupleNameSource() {
        return this.getNamedChild("tupleNameSource");
    }
    get type() {
        return this.getNamedChild("type");
    }
    get typeArguments() {
        return this.getNamedChild("typeArguments");
    }
    get typeExpression() {
        return this.getNamedChild("typeExpression");
    }
    get typeName() {
        return this.getNamedChild("typeName");
    }
    get typeParameter() {
        return this.getNamedChild("typeParameter");
    }
    get typeParameters() {
        return this.getNamedChild("typeParameters");
    }
    get types() {
        return this.getNamedChild("types");
    }
    get value() {
        return this.getNamedChild("value");
    }
    get variableDeclaration() {
        return this.getNamedChild("variableDeclaration");
    }
    get whenFalse() {
        return this.getNamedChild("whenFalse");
    }
    get whenTrue() {
        return this.getNamedChild("whenTrue");
    }
    // ═══ Generated string property getters ═══
    get text() {
        switch (this._rawKind) {
            case SyntaxKind.Identifier:
            case SyntaxKind.PrivateIdentifier:
            case SyntaxKind.JsxText:
            case SyntaxKind.JSDocText:
            case SyntaxKind.JSDocLink:
            case SyntaxKind.JSDocLinkPlain:
            case SyntaxKind.JSDocLinkCode: {
                const stringIndex = this.data & NODE_STRING_INDEX_MASK;
                return this.getString(stringIndex);
            }
            case SyntaxKind.StringLiteral:
            case SyntaxKind.NumericLiteral:
            case SyntaxKind.BigIntLiteral:
            case SyntaxKind.RegularExpressionLiteral:
            case SyntaxKind.NoSubstitutionTemplateLiteral:
            case SyntaxKind.TemplateHead:
            case SyntaxKind.TemplateMiddle:
            case SyntaxKind.TemplateTail:
            case SyntaxKind.SourceFile: {
                const extendedDataOffset = this.sourceFile._offsetExtendedData + (this.data & NODE_EXTENDED_DATA_MASK);
                const stringIndex = this.view.getUint32(extendedDataOffset, true);
                return this.getString(stringIndex);
            }
        }
    }
    /**
     * Stock Identifier/PrivateIdentifier carry `escapedText` (leading "__"
     * escaped with an extra "_"); the JS printer's synthesized-node path
     * (`idText`) reads it. tsgo stores the unescaped text, so escape here.
     */
    get escapedText() {
        switch (this._rawKind) {
            case SyntaxKind.Identifier:
            case SyntaxKind.PrivateIdentifier: {
                const text = this.text;
                if (text === undefined)
                    return undefined;
                return text.length >= 2 && text.charCodeAt(0) === 0x5f && text.charCodeAt(1) === 0x5f
                    ? "_" + text
                    : text;
            }
        }
        return undefined;
    }
    get rawText() {
        switch (this._rawKind) {
            case SyntaxKind.TemplateHead:
            case SyntaxKind.TemplateMiddle:
            case SyntaxKind.TemplateTail:
                const extendedDataOffset = this.sourceFile._offsetExtendedData + (this.data & NODE_EXTENDED_DATA_MASK);
                const stringIndex = this.view.getUint32(extendedDataOffset + 4, true);
                return this.getString(stringIndex);
        }
    }
    // ═══ Generated extended data property getters ═══
    // ═══ Other property getters ═══
    get flags() {
        return this.view.getUint32(this._byteIndex + NODE_OFFSET_FLAGS, true);
    }
    /** Raw NodeFlags without fork remapping — used by tsgo internal dispatchers. */
    get _rawFlags() {
        return this.view.getUint32(this._byteIndex + NODE_OFFSET_FLAGS, true);
    }
    get modifierFlags() {
        const mods = this.modifiers;
        if (!mods)
            return ModifierFlags.None;
        let flags = ModifierFlags.None;
        for (const mod of mods) {
            // modifierToFlag switches on raw tsgo SyntaxKind; `mod.kind` is the
            // fork-remapped getter, so use `_rawKind` to keep the lookup aligned.
            flags |= modifierToFlag(mod._rawKind);
        }
        return flags;
    }
}
//# sourceMappingURL=node.generated.js.map