declare class IdentifierNode implements ASTNode {
    token: Token;
    nodeType: string;
    name: string;
    constructor(token: Token);
}
declare class ReassignNode implements ASTNode {
    identifier: IdentifierNode | IdentifierNode[];
    value: ASTNode;
    token?: Token | undefined;
    nodeType: string;
    constructor(identifier: IdentifierNode | IdentifierNode[], value: ASTNode, token?: Token | undefined);
    baseIdentifier(): IdentifierNode;
    isAttributeAssignment(): boolean;
    identifierToString(): string;
    attributesChain(): IdentifierNode[];
    attributesStringChain(): string[];
}

type SupportedMethods = Record<string, MethodDefinitionDef>;
interface MethodArgumentDef {
    name: string;
    type: any;
    optional?: boolean;
}
interface MethodDefinitionDef {
    name?: string;
    function: (...args: any[]) => ISymbolType | null | undefined;
    args: MethodArgumentDef[];
    returnType: any;
}
declare abstract class BaseSymbolType implements ISymbolType {
    abstract type: string;
    value: any | null;
    config?: Config;
    static _SUPPORTED_METHODS?: SupportedMethods;
    constructor(value: any, config?: Config);
    abstract validValue(value: any): boolean;
    /**
     * Forces creating a deepCopy of provided symbol no matter if it's immutable or not.
     */
    abstract deepCopy(): ISymbolType;
    /**
     * Returns a copy of the symbol if it's mutable, otherwise returns the same instance.
     *
     * This method is used to prevent reference sharing issues when storing symbols in
     * containers like lists and dictionaries. Immutable symbols (Number, String, Boolean,
     * NumberWithUnit, Null, hex ColorSymbol) can safely share references since they
     * cannot be modified after creation. Mutable symbols (List, Dictionary, dynamic
     * ColorSymbol) need to be deep copied to prevent unintended mutations.
     *
     * @returns For immutable symbols: returns `this` (same reference)
     *          For mutable symbols: returns `this.deepCopy()` (new instance)
     */
    abstract cloneIfMutable(): ISymbolType;
    /**
     * Converts the symbol to a plain JavaScript value.
     * This method is used to serialize symbols for external consumption.
     */
    abstract toJs(): JsValue;
    toString(): string;
    getTypeName(): string;
    typeEquals(other: ISymbolType): boolean;
    equals(other: ISymbolType): boolean;
    hasMethod?(methodName: string, args: ISymbolType[]): boolean;
    callMethod?(methodName: string, args: ISymbolType[]): ISymbolType | null | undefined;
    hasAttribute?(_attributeName: string): boolean;
    getAttribute?(attributeName: string): ISymbolType | null;
    setAttribute?(attributeName: string, _value: ISymbolType): void;
}
type numberValue = number | null;
declare class NumberSymbol extends BaseSymbolType {
    type: string;
    static readonly type = "Number";
    static _SUPPORTED_METHODS: {
        to_string: {
            name: string;
            function: (this: NumberSymbol, radix?: NumberSymbol) => StringSymbol;
            args: {
                name: string;
                type: string;
                optional: boolean;
            }[];
            returnType: string;
        };
    };
    value: numberValue;
    constructor(value: number | NumberSymbol | NumberWithUnitSymbol | null, config?: Config);
    validValue(val: any): boolean;
    expectSafeValue(val: any): asserts val is number;
    toString(): string;
    deepCopy(): NumberSymbol;
    cloneIfMutable(): NumberSymbol;
    static empty(): NumberSymbol;
    hasAttribute(attributeName: string): boolean;
    getAttribute(attributeName: string): ISymbolType | null;
    toStringSymbol(radix?: NumberSymbol): StringSymbol;
    toJs(): number | null;
}
declare class StringSymbol extends BaseSymbolType {
    type: string;
    static readonly type = "String";
    static _SUPPORTED_METHODS: {
        upper: {
            function: (this: StringSymbol) => StringSymbol;
            args: never[];
            returnType: string;
        };
        lower: {
            function: (this: StringSymbol) => StringSymbol;
            args: never[];
            returnType: string;
        };
        length: {
            function: (this: StringSymbol) => NumberSymbol;
            args: never[];
            returnType: string;
        };
        concat: {
            function: (this: StringSymbol, other: StringSymbol) => StringSymbol;
            args: {
                name: string;
                type: string;
            }[];
            returnType: string;
        };
        split: {
            function: (this: StringSymbol, delimiter?: StringSymbol) => ListSymbol;
            args: {
                name: string;
                type: string;
                optional: boolean;
            }[];
            returnType: string;
        };
    };
    value: string | null;
    constructor(value: string | StringSymbol | null, config?: Config);
    validValue(val: any): boolean;
    expectSafeValue(val: any): asserts val is string;
    upper(): StringSymbol;
    deepCopy(): StringSymbol;
    cloneIfMutable(): StringSymbol;
    static empty(): StringSymbol;
    lower(): StringSymbol;
    length(): NumberSymbol;
    concat(other: StringSymbol): StringSymbol;
    split(delimiter?: StringSymbol): ListSymbol;
    toJs(): string | null;
}
declare class ListSymbol extends BaseSymbolType {
    type: string;
    static readonly type = "List";
    static _SUPPORTED_METHODS: {
        append: {
            function: (this: ListSymbol, item: ISymbolType) => ListSymbol;
            args: {
                name: string;
                type: string;
            }[];
            returnType: string;
        };
        extend: {
            function: (this: ListSymbol, ...items: ISymbolType[]) => ListSymbol;
            args: never[];
            returnType: string;
        };
        insert: {
            function: (this: ListSymbol, index: NumberSymbol, item: ISymbolType) => ListSymbol;
            args: {
                name: string;
                type: string;
            }[];
            returnType: string;
        };
        delete: {
            function: (this: ListSymbol, index: NumberSymbol) => ListSymbol;
            args: {
                name: string;
                type: string;
            }[];
            returnType: string;
        };
        length: {
            function: (this: ListSymbol) => NumberSymbol;
            args: never[];
            returnType: string;
        };
        index: {
            function: (this: ListSymbol, item: ISymbolType) => NumberSymbol;
            args: {
                name: string;
                type: string;
            }[];
            returnType: string;
        };
        get: {
            function: (this: ListSymbol, index: NumberSymbol) => ISymbolType;
            args: {
                name: string;
                type: string;
            }[];
            returnType: string;
        };
        update: {
            function: (this: ListSymbol, index: NumberSymbol, item: ISymbolType) => ListSymbol;
            args: {
                name: string;
                type: string;
            }[];
            returnType: string;
        };
        join: {
            function: (this: ListSymbol, separator?: StringSymbol) => StringSymbol;
            args: {
                name: string;
                type: string;
                optional: boolean;
            }[];
            returnType: string;
        };
    };
    value: ISymbolType[];
    isImplicit: boolean;
    constructor(elements: ISymbolType[] | null, isImplicit?: boolean, config?: Config);
    validValue(val: any): boolean;
    toString(): string;
    append(item: ISymbolType): ListSymbol;
    extend(...items: ISymbolType[]): ListSymbol;
    insert(indexSymbol: NumberSymbol, item: ISymbolType): ListSymbol;
    delete(indexSymbol: NumberSymbol): ListSymbol;
    length(): NumberSymbol;
    index(item: ISymbolType): NumberSymbol;
    get(indexSymbol: NumberSymbol): ISymbolType;
    update(indexSymbol: NumberSymbol, item: ISymbolType): ListSymbol;
    join(separator?: StringSymbol): StringSymbol;
    deepCopy(): ListSymbol;
    cloneIfMutable(): ListSymbol;
    static empty(): ListSymbol;
    getTypeName(): string;
    toJs(): JsValue[];
}
declare class NumberWithUnitSymbol extends BaseSymbolType {
    type: string;
    static readonly type = "NumberWithUnit";
    static _SUPPORTED_METHODS: {
        to_string: {
            name: string;
            function: (this: NumberWithUnitSymbol) => StringSymbol;
            args: {
                name: string;
                type: string;
                optional: boolean;
            }[];
            returnType: string;
        };
        to_number: {
            function: (this: NumberWithUnitSymbol) => NumberSymbol;
            args: never[];
            returnType: string;
        };
    };
    value: number | null;
    unit: SupportedFormats;
    constructor(value: number | NumberSymbol | null, unit: SupportedFormats | string, config?: Config);
    validValue(val: any): boolean;
    static fromRecord(record: {
        value: number | string;
        unit: string;
        type?: string;
    }, config?: Config): NumberWithUnitSymbol | undefined;
    toString(): string;
    expectSafeValue(val: any): asserts val is number;
    toStringSymbol(): StringSymbol;
    to_number(): NumberSymbol;
    equals(other: ISymbolType): boolean;
    deepCopy(): NumberWithUnitSymbol;
    cloneIfMutable(): NumberWithUnitSymbol;
    static empty(): NumberWithUnitSymbol;
    hasAttribute(attributeName: string): boolean;
    getAttribute(attributeName: string): ISymbolType | null;
    getTypeName(): string;
    toJs(): string;
}
type dynamicColorValue = Record<string, ISymbolType>;
declare class ColorSymbol extends BaseSymbolType {
    type: string;
    static readonly type = "Color";
    static _SUPPORTED_METHODS: {
        to_string: {
            name: string;
            function: (this: ColorSymbol) => StringSymbol;
            args: never[];
            returnType: string;
        };
    };
    subType: string | null;
    value: string | dynamicColorValue | null;
    static empty(): ColorSymbol;
    constructor(value: string | dynamicColorValue | null, subType?: string, config?: Config);
    toStringSymbol(): StringSymbol;
    toString(): string;
    to(targetType: string): ColorSymbol;
    typeEquals(other: ISymbolType): boolean;
    isHex(): boolean;
    validValue(val: any): boolean;
    deepCopy(): ColorSymbol;
    cloneIfMutable(): ColorSymbol;
    hasAttribute(attributeName: string): boolean;
    getAttribute(attributeName: string): ISymbolType | null;
    hasMethod(methodName: string, args: ISymbolType[]): boolean;
    callMethod(methodName: string, args: ISymbolType[]): ISymbolType | null | undefined;
    getTypeName(): string;
    toJs(): string;
}
/**
 * Represents a JavaScript value that can be produced from a TokenScript symbol.
 * This includes primitives, arrays, and plain objects (recursively).
 */
type JsValue = string | number | boolean | null | JsValue[] | {
    [key: string]: JsValue;
};

/**
 * Utilities for working with TokenScript schema URIs
 *
 * Handles URI construction, parsing, and manipulation for the TokenScript schema registry.
 */
type SemanticVersion = {
    major: number;
} | {
    major: number;
    minor: number;
} | {
    major: number;
    minor: number;
    patch: number;
};

type uri = string;
type specType = string;
/**
 * Base manager class that provides common functionality for managing specifications,
 * conversions, and BFS-based conversion path resolution.
 */
declare abstract class BaseManager<TSpec, TInput, TOutput> {
    protected specs: Map<uri, TSpec>;
    protected specTypes: Map<uri, specType>;
    protected conversions: Map<uri, Map<uri, (input: TInput) => TOutput>>;
    protected parentConfig?: Config;
    protected removeVersionFromUri(uri: uri): uri;
    /**
     * Check if two URIs point to the same schema (ignoring version)
     */
    protected isSameSchemaUri(uri1: uri, uri2: uri): boolean;
    /**
     * Parse semantic version from URI
     * Example: "/api/v1/schema/srgb-color/0.0.1/" -> { major: 0, minor: 0, patch: 1 }
     */
    protected parseSemverFromUri(uri: uri): SemanticVersion | null;
    /**
     * Get base URI without version
     * Example: "/api/v1/schema/srgb-color/0.0.1/" -> "/api/v1/schema/srgb-color/"
     */
    protected getBaseUri(uri: uri): uri;
    /**
     * Generate version resolution candidates from most specific to least specific
     * Example: "0.0.1" -> ["0.0.1", "0.0", "0", "latest"]
     */
    protected generateVersionCandidates(uri: uri): uri[];
    /**
     * Find the latest (highest) semantic version for a URI
     */
    protected findLatestVersion(uri: uri): uri | null;
    /**
     * Resolve URI by trying version candidates from most specific to least specific
     */
    protected resolveVersionUri(uri: uri): uri | null;
    /**
     * Find a conversion path from source to target format using BFS with version resolution
     */
    protected findConversionPath(sourceUri: uri, targetUri: uri): uri[];
    /**
     * Check if a conversion path exists between source and target URIs with version resolution
     */
    hasConversion(sourceUri: uri, targetUri: uri): boolean;
    /**
     * Get a specification by its URI with version resolution
     */
    getSpec(uri: uri): TSpec | undefined;
    /**
     * Convert input through a chain of conversions to reach the target URI with version resolution
     */
    protected convertThroughPath(input: TInput, sourceUri: uri, targetUri: uri): TOutput;
    /**
     * Register a conversion function between two URIs
     */
    protected registerConversionFunction(sourceUri: uri, targetUri: uri, conversionFn: (input: TInput) => TOutput): void;
    abstract register(uri: uri, spec: TSpec | specType): TSpec;
    protected abstract getSpecName(spec: TSpec): string;
    /**
     * Abstract method for creating a clone of the manager
     */
    abstract clone(): this;
    /**
     * Set the parent config reference
     */
    setParentConfig(config: Config): void;
    /**
     * Get the parent config reference
     */
    getParentConfig(): Config | undefined;
    /**
     * Creates interpreter configuration with full context for conversion functions and initializers.
     * Uses parent config if available to provide access to all managers and registrations.
     */
    protected createInterpreterConfig(references: Record<string, any>): {
        references: Record<string, any>;
        config?: Config;
    };
}

interface SpecProperty {
    type: "number" | "string" | "color";
}
interface SpecSchemaType {
    type: "object";
    properties: Record<string, SpecProperty>;
    required?: string[];
    order?: string[];
    additionalProperties?: boolean;
}
interface ColorSpecification {
    name: string;
    type: "color";
    description?: string;
    schema?: SpecSchemaType;
    initializers: Array<{
        title?: string;
        keyword: string;
        description?: string;
        script: {
            type: string;
            script: string;
        };
    }>;
    conversions: Array<{
        source: string;
        target: string;
        description?: string;
        lossless: boolean;
        script: {
            type: string;
            script: string;
        };
    }>;
}

type uriType$1 = string;
type Specs$1 = Map<uriType$1, ColorSpecification>;
interface FormatColorOptions {
    decimalPlaces?: number;
    removeTrailingZeros?: boolean;
}
declare class ColorManager extends BaseManager<ColorSpecification, ColorSymbol, ColorSymbol> {
    private initializers;
    constructor(defaultSpecs?: Specs$1);
    protected getSpecName(spec: ColorSpecification): string;
    /**
     * Creates a clone of this class to be passed down to initializers and conversion functions
     * Links properties to the parent config.
     */
    clone(): this;
    registerRootInitializers(_uri: uriType$1, spec: ColorSpecification): void;
    registerConversions(uri: uriType$1, spec: ColorSpecification): void;
    register(uri: uriType$1, spec: ColorSpecification | string): ColorSpecification;
    getSpecByType(type: string): ColorSpecification | undefined;
    getSpecFromColor(color: ColorSymbol): ColorSpecification | undefined;
    hasInitializer(keyword: string): boolean;
    executeInitializer(keyword: string, args: Array<ISymbolType>): ColorSymbol;
    hasConversionByType(sourceType: string, targetType: string): boolean;
    convertTo(color: ColorSymbol, targetUri: string): ColorSymbol;
    convertToByType(color: ColorSymbol, targetType: string): ColorSymbol;
    setAttribute(color: ColorSymbol, node: ReassignNode, attributeValue: ISymbolType): ColorSymbol;
    /**
     * Formats a number value, rounding to specified decimal places and optionally removing trailing zeros.
     *
     * @param value - The numeric value to format
     * @param decimalPlaces - Number of decimal places to round to
     * @param removeTrailingZeros - Whether to remove trailing zeros
     * @returns Formatted number string
     */
    private formatNumber;
    /**
     * Formats a ColorSymbol as a string representation using the appropriate schema-defined format.
     *
     * For hex colors (string values), returns the hex string as-is.
     * For dynamic colors (object values), uses the schema's `order` property to determine
     * parameter order and formats as a function call (e.g., "hsl(0, 100, 50.0)").
     *
     * @param color - The ColorSymbol to format
     * @param opts - Formatting options for numeric values
     * @returns Formatted string representation of the color, or empty string if formatting fails
     *
     * @example
     * ```typescript
     * // Hex color
     * const hexColor = new ColorSymbol("#ff0000", "Hex");
     * manager.formatColorMethod(hexColor); // "#ff0000"
     *
     * // HSL color with schema order ["h", "s", "l"]
     * const hslColor = new ColorSymbol({ h: 0, s: 100, l: 50.123456 }, "HSL");
     * manager.formatColorMethod(hslColor); // "hsl(0, 100, 50.12)"
     *
     * // RGB color with trailing zeros removed
     * const rgbColor = new ColorSymbol({ r: 0, g: 85.00000000000004, b: 255 }, "RGB");
     * manager.formatColorMethod(rgbColor); // "rgb(0, 85, 255)"
     * ```
     */
    formatColorMethod(color: ColorSymbol, opts?: FormatColorOptions): string;
}

interface FunctionSpecification {
    name: string;
    type: "function";
    input?: {
        type: "object";
        properties?: Record<string, unknown>;
    };
    script: {
        type: string;
        script: string;
    };
    keyword: string;
    description?: string;
    requirements?: string[];
}

type functionName = string;
type FunctionImpl = (...args: ISymbolType[]) => ISymbolType;
declare class FunctionsManager extends BaseManager<FunctionSpecification, ISymbolType[], ISymbolType> {
    private functionMap;
    constructor();
    protected getSpecName(spec: FunctionSpecification): string;
    clone(): this;
    register(name: functionName, spec: FunctionSpecification | string): FunctionSpecification;
    private setupBuiltinFunctions;
    private registerFunction;
    private registerDynamicFunction;
    getFunction(name: string): FunctionImpl | undefined;
    hasFunction(name: string): boolean;
    getFunctionNames(): string[];
}

interface ScriptBlock {
    type?: string;
    script: string;
}
interface Conversion {
    source: string;
    target: string;
    script: ScriptBlock;
    description?: string;
}
interface UnitSpecification {
    name: string;
    type: "absolute" | "relative";
    keyword: string;
    description?: string;
    conversions?: Conversion[];
    to_absolute?: ScriptBlock;
}

type uriType = string;
type unitKey = string;
type Specs = Map<uriType, UnitSpecification>;
declare class UnitManager extends BaseManager<UnitSpecification, NumberWithUnitSymbol, NumberWithUnitSymbol> {
    private unitKeywords;
    constructor(defaultSpecs?: Specs);
    protected getSpecName(spec: UnitSpecification): string;
    /**
     * Creates a clone of this class to be passed down to initializers and conversion functions
     * Links properties to the parent config.
     */
    clone(): this;
    registerConversions(uri: uriType, spec: UnitSpecification): void;
    register(uri: uriType, spec: UnitSpecification | string): UnitSpecification;
    getSpecByKeyword(keyword: unitKey): UnitSpecification | undefined;
    getUriByKeyword(keyword: unitKey): string | undefined;
    convertTo(unit: NumberWithUnitSymbol, targetUri: uriType): NumberWithUnitSymbol;
    private isOneNumberRelative;
    private convertRelative;
    convertToCommonFormat(inputs: Array<NumberSymbol | NumberWithUnitSymbol>): Array<NumberSymbol | NumberWithUnitSymbol>;
}

interface LanguageOptions {
    MAX_ITERATIONS: number;
}
interface ConfigOptions {
    languageOptions?: LanguageOptions;
    colorManager?: ColorManager;
    unitManager?: UnitManager;
    functionsManager?: FunctionsManager;
}
declare class Config {
    languageOptions: LanguageOptions;
    colorManager: ColorManager;
    unitManager: UnitManager;
    functionsManager: FunctionsManager;
    constructor(options?: ConfigOptions);
    getType(baseType: string, subType?: string): ISymbolType;
    isTypeDefined(baseType: string, subType?: string): boolean;
    clone(): Config;
    registerSchemas(schemas: Array<{
        uri: string;
        schema: ColorSpecification | FunctionSpecification;
    }>): Config;
}

declare enum Operations {
    SUBTRACT = "-",
    ADD = "+",
    MULTIPLY = "*",
    DIVIDE = "/",
    POWER = "^",
    LOGIC_AND = "&&",
    LOGIC_OR = "||",
    LOGIC_NOT = "!"
}
declare enum SupportedFormats {
    PX = "px",
    EM = "em",
    REM = "rem",
    VW = "vw",
    VH = "vh",
    PT = "pt",
    IN = "in",
    CM = "cm",
    MM = "mm",
    DEG = "deg",
    PERCENTAGE = "%"
}
declare enum ReservedKeyword {
    TRUE = "true",
    FALSE = "false",
    NULL = "null",
    UNDEFINED = "undefined",
    WHILE = "while",
    IF = "if",
    ELSE = "else",
    ELIF = "elif",
    RETURN = "return",
    VARIABLE = "variable"
}
declare enum TokenType {
    REFERENCE = "REFERENCE",
    NUMBER = "NUMBER",
    OPERATION = "OPERATION",
    FORMAT = "FORMAT",
    LPAREN = "LPAREN",
    RPAREN = "RPAREN",
    EOF = "EOF",
    COMMA = "COMMA",
    HEX_COLOR = "HEX_COLOR",
    STRING = "STRING",
    EXPLICIT_STRING = "EXPLICIT_STRING",
    ASSIGN = "ASSIGN",
    IS_EQ = "IS_EQ",
    IS_GT = "GT",
    IS_LT = "LT",
    IS_GT_EQ = "IS_GT_EQ",
    IS_LT_EQ = "IS_LT_EQ",
    IS_NOT_EQ = "IS_NOT_EQ",
    RESERVED_KEYWORD = "RESERVED_KEYWORD",
    SEMICOLON = "SEMICOLON",
    LOGIC_NOT = "LOGIC_NOT",
    COLON = "COLON",
    DOT = "DOT",
    LOGIC_AND = "LOGIC_AND",
    LOGIC_OR = "LOGIC_OR",
    LBLOCK = "LBLOCK",
    RBLOCK = "RBLOCK"
}
interface Token {
    type: TokenType;
    value: any;
    line: number;
    pos: number;
    endPos: number;
}
interface ASTNode {
    token?: Token;
    nodeType: string;
}
interface ISymbolType {
    type: string;
    value: any;
    cloneIfMutable(): ISymbolType;
    deepCopy(): ISymbolType;
    typeEquals(other: ISymbolType): boolean;
    equals(other: ISymbolType): boolean;
    validValue(value: any): boolean;
    toJSON?(): any;
    toString(): string;
    getTypeName(): string;
    hasMethod?(methodName: string, args: ISymbolType[]): boolean;
    callMethod?(methodName: string, args: ISymbolType[]): ISymbolType | null | undefined;
    hasAttribute?(attributeName: string): boolean;
    getAttribute?(attributeName: string): ISymbolType | null;
    setAttribute?(attributeName: string, value: ISymbolType, config?: Config): void;
}
declare const UNINTERPRETED_KEYWORDS: string[];
type ReferenceRecordValue = string | number | ISymbolType;
type ReferenceRecord = Record<string, ReferenceRecordValue | Array<ReferenceRecordValue>>;

export { type ASTNode as A, Config as C, type ISymbolType as I, Operations as O, ReservedKeyword as R, SupportedFormats as S, TokenType as T, UNINTERPRETED_KEYWORDS as U, type Token as a, type ReferenceRecordValue as b, type ReferenceRecord as c };
