import type { IASTNode, IEvaluatorBase, IRegistryBase, IObjectTypeEntry, IOperatorMatch, IFunctionMatch } from './types.js.js';
export declare class Type {
    #private;
    constructor(name: string);
    get name(): string;
    get [Symbol.toStringTag](): string;
    toString(): string;
}
export declare const TYPES: Record<string, Type>;
export declare class TypeDeclaration {
    #private;
    kind: string;
    type: string;
    name: string;
    keyType: TypeDeclaration | undefined;
    valueType: TypeDeclaration | undefined;
    unwrappedType: TypeDeclaration;
    wrappedType: TypeDeclaration;
    hasDynType: boolean;
    hasPlaceholderType: boolean;
    matchesValueType: ((v: unknown, ev: IEvaluatorBase) => boolean) | undefined;
    fieldLazy: (obj: unknown, key: unknown, ast: IASTNode, ev: IEvaluatorBase) => unknown;
    constructor({ kind, type, name, keyType, valueType }: {
        kind: string;
        type: string;
        name: string;
        keyType?: TypeDeclaration;
        valueType?: TypeDeclaration;
    });
    isDynOrBool(): boolean;
    isEmpty(): boolean;
    unify(r: IRegistryBase, t2: TypeDeclaration): TypeDeclaration | null;
    templated(r: IRegistryBase, bind: Map<string, TypeDeclaration> | null | undefined): TypeDeclaration;
    toString(): string;
    field(obj: unknown, key: unknown, ast: IASTNode, ev: IEvaluatorBase): unknown;
    matchesBoth(other: TypeDeclaration): boolean;
    matches(o: TypeDeclaration): boolean;
}
export declare class VariableDeclaration {
    name: string;
    type: TypeDeclaration;
    description: string | null;
    label: string | null;
    constant: boolean;
    value: unknown;
    constructor(name: string, type: TypeDeclaration, description?: string | null, value?: unknown, label?: string | null);
}
export declare class FunctionDeclaration {
    name: string;
    async: boolean;
    receiverType: TypeDeclaration | null;
    returnType: TypeDeclaration;
    description: string | null;
    params: Array<{
        name: string;
        type: TypeDeclaration;
        description: string | null;
    }>;
    argTypes: TypeDeclaration[];
    macro: boolean | TypeDeclaration;
    signature: string;
    handler: (...args: unknown[]) => unknown;
    partitionKey: string;
    hasPlaceholderType: boolean;
    constructor({ name, receiverType, returnType, handler, description, params, async: isAsync_ }: {
        name: string;
        receiverType?: TypeDeclaration | null;
        returnType: TypeDeclaration;
        handler?: (...args: unknown[]) => unknown;
        description?: string | null;
        params: Array<{
            name?: string;
            type?: string | TypeDeclaration;
            description?: string | null;
        }>;
        async?: boolean;
    });
    matchesArgs(argTypes: TypeDeclaration[]): FunctionDeclaration | null;
}
export declare class OperatorDeclaration {
    operator: string;
    leftType: TypeDeclaration;
    rightType: TypeDeclaration | null;
    handler: (...args: unknown[]) => unknown;
    async: boolean;
    returnType: TypeDeclaration;
    signature: string;
    hasPlaceholderType: boolean;
    constructor({ op, leftType, rightType, handler, returnType, async: isAsync_ }: {
        op: string;
        leftType: TypeDeclaration;
        rightType?: TypeDeclaration;
        handler: (...args: unknown[]) => unknown;
        returnType: TypeDeclaration;
        async?: boolean;
    });
    equals(other: OperatorDeclaration): boolean;
}
export declare const celTypes: Record<string, TypeDeclaration>;
declare class Candidates {
    #private;
    returnType: TypeDeclaration | null;
    async: boolean;
    macro: FunctionDeclaration | false;
    declarations: (FunctionDeclaration | OperatorDeclaration)[];
    registry: Registry;
    constructor(registry: Registry);
    [Symbol.iterator](): Iterator<FunctionDeclaration | OperatorDeclaration>;
    add(decl: FunctionDeclaration | OperatorDeclaration): void;
    findFunction(argTypes: TypeDeclaration[], receiverType?: TypeDeclaration | null): FunctionDeclaration | IFunctionMatch | null;
    findUnaryOverload(left: TypeDeclaration): OperatorDeclaration | false;
    findBinaryOverload(left: TypeDeclaration, right: TypeDeclaration): OperatorDeclaration | IOperatorMatch | false;
    checkBinaryOverload(left: TypeDeclaration, right: TypeDeclaration): TypeDeclaration | false;
}
export declare class Registry {
    #private;
    objectTypes: Map<string, IObjectTypeEntry>;
    objectTypesByConstructor: Map<object, IObjectTypeEntry>;
    variables: Map<string, VariableDeclaration | undefined> & {
        dyn?: boolean;
    };
    unlistedVariablesAreDyn: boolean;
    constructor(opts?: {
        unlistedVariablesAreDyn?: boolean;
        parent?: Registry;
    });
    deleteVariable(name: string): void;
    operatorCandidates(op: string): Candidates;
    functionCandidates(rec: boolean, name: string, argLen: number): Candidates;
    registerVariable(name: string | Record<string, unknown>, type?: string | TypeDeclaration | Record<string, unknown>, opts?: {
        description?: string;
        label?: string;
        value?: unknown;
    }): this;
    registerConstant(name: string | Record<string, unknown>, type?: string, value?: unknown): this;
    getType(typename: string): TypeDeclaration;
    getListType(type: TypeDeclaration): TypeDeclaration;
    getMapType(a: TypeDeclaration, b: TypeDeclaration): TypeDeclaration;
    getOptionalType(type: TypeDeclaration): TypeDeclaration;
    assertType(typename: string, type: string, signature: string): TypeDeclaration;
    /**
     * Declare a type name for compile-time type checking only.
     * Creates a TypeDeclaration so the type can be used in function signatures
     * and variable declarations, without requiring a constructor (no objectType entry).
     * Call `registerType(name, ctor)` later to provide the full runtime definition.
     */
    declareType(name: string): TypeDeclaration;
    getFunctionType(typename: string): TypeDeclaration;
    registerType(name: string | Record<string, unknown>, _d?: unknown): IObjectTypeEntry;
    findMacro(name: string, hasReceiver: boolean, argLen: number): FunctionDeclaration | false;
    findUnaryOverload(op: string, left: TypeDeclaration): OperatorDeclaration | false;
    findBinaryOverload(op: string, left: TypeDeclaration, right: TypeDeclaration): OperatorDeclaration | IOperatorMatch | false;
    clone(opts: {
        unlistedVariablesAreDyn: boolean;
    }): Registry;
    getDefinitions(): {
        variables: {
            name: string;
            description: string | null;
            label: string | null;
            type: string;
        }[];
        functions: {
            signature: string;
            name: string;
            description: string | null;
            receiverType: string | null;
            returnType: string;
            params: {
                name: string;
                type: string;
                description: string | null;
            }[];
        }[];
    };
    registerFunctionOverload(s: string | Record<string, unknown>, handler?: ((...args: unknown[]) => unknown) | Record<string, unknown>, opts?: Record<string, unknown>): void;
    registerOperatorOverload(string: string, handler: (...args: unknown[]) => unknown, opts?: {
        async?: boolean;
    }): void;
    unaryOverload(op: string, typeStr: string, handler: (...args: unknown[]) => unknown, returnTypeStr?: string, async_?: boolean): void;
    binaryOverload(leftTypeStr: string, op: string, rightTypeStr: string, handler: (...args: unknown[]) => unknown, returnTypeStr?: string, async_?: boolean): void;
}
export declare function createRegistry(opts?: {
    unlistedVariablesAreDyn?: boolean;
}): Registry;
export declare class RootContext {
    #private;
    constructor(registry: Registry, context?: unknown);
    getValue(key: string): unknown;
    getVariable(name: string): VariableDeclaration | undefined;
    getCheckedValue(ev: IEvaluatorBase, ast: IASTNode): unknown;
    forkWithVariable(iterVar: string, iterType: TypeDeclaration): OverlayContext;
}
export declare class OverlayContext {
    #private;
    accuType: TypeDeclaration | undefined;
    accuValue: unknown;
    iterValue: unknown;
    iterVar: string;
    iterType: TypeDeclaration;
    async?: boolean;
    constructor(parent: RootContext | OverlayContext, iterVar: string, iterType: TypeDeclaration);
    forkWithVariable(iterVar: string, iterType: TypeDeclaration): OverlayContext;
    reuse(parent: RootContext | OverlayContext): OverlayContext;
    setIterValue(v: unknown, ev: IEvaluatorBase): this;
    setAccuType(type: TypeDeclaration): this;
    setAccuValue(v: unknown): this;
    getValue(key: string): unknown;
    getCheckedValue(ev: IEvaluatorBase, ast: IASTNode): unknown;
    getVariable(name: string): VariableDeclaration | undefined;
}
export {};
