import { ActionResponse, ActionsEnum, PublicDoenetMLCore, FlatDastRoot, DastError, FlatDastElement } from '../packages/doenetml-worker-rust/dist';
import { DastRoot } from '../packages/parser/dist';
import { CancelAnimationFrame, CopyToClipboard, PublicDoenetMLCore as PublicDoenetMLCoreJavascript, ReportScoreAndStateCallback, RequestAnimationFrame, RequestSolutionView, SendEvent, UpdateRenderersCallback } from '../packages/doenetml-worker-javascript/dist';
export type * from 'lib-doenetml-worker';
/**
 * The correct type of `FlatDastRoot`. **This should be used instead of
 * `FlatDastRoot`**
 */
export interface FlatDastRootWithErrors extends Omit<FlatDastRoot, "elements"> {
    elements: (DastError | FlatDastElement)[];
}
/**
 * Action type for use with typescript. There are errors with the type
 * exported by `lib-doenetml-worker`, so use this version instead.
 */
export type Action = ActionsEnum & {
    componentIdx: number;
};
type Flags = Record<string, unknown>;
export declare class CoreWorker {
    doenetCore?: PublicDoenetMLCore;
    javascriptCore?: PublicDoenetMLCoreJavascript;
    wasm_initialized: boolean;
    javascript_initialized: boolean;
    source_set: boolean;
    flags_set: boolean;
    core_type: "rust" | "javascript";
    isProcessingPromise: Promise<void>;
    setCoreType(core_type: "rust" | "javascript"): void;
    setSource(args: {
        source: string;
        dast: DastRoot;
    }): Promise<void>;
    setFlags(args: {
        flags: Flags;
    }): Promise<void>;
    initializeJavascriptCore({ activityId, docId, requestedVariantIndex, attemptNumber, }: {
        activityId: string;
        docId: string;
        requestedVariantIndex: number;
        attemptNumber: number;
    }): Promise<{
        success: true;
        allPossibleVariants: any;
        baseComponentCounts: any;
    }>;
    generateJavascriptDast(args: {
        coreId: string;
        userId?: string;
        cid: string | null;
        theme?: "dark" | "light";
        requestedVariant?: Record<string, any>;
        stateVariableChanges?: string;
        initializeCounters: Record<string, number>;
    }, updateRenderersCallback: UpdateRenderersCallback, reportScoreAndStateCallback: ReportScoreAndStateCallback, requestAnimationFrame: RequestAnimationFrame, cancelAnimationFrame: CancelAnimationFrame, copyToClipboard: CopyToClipboard, sendEvent: SendEvent, requestSolutionView: RequestSolutionView): Promise<{
        errorWarnings: {} | undefined;
        coreInfo: {
            generatedVariantString: string;
            allPossibleVariants: any;
            rendererTypesInDocument: any;
            documentToRender: any;
        };
        success: true;
        errMsg?: undefined;
        coreId?: undefined;
    } | {
        success: false;
        errMsg: string;
        coreId?: undefined;
    } | {
        success: false;
        coreId: string;
        errMsg: string;
    }>;
    returnDast(): Promise<FlatDastRootWithErrors>;
    /**
     * Transform the initial output of the JavaScript core into the flat data structure
     * produces by the rust core and expected by the `doenetml-prototype`
     */
    private returnFlatDastFromJS;
    /**
     * Dispatch the action `actionName` of `componentIdx` to the Javascript core,
     * which will execute that action and return the result.
     */
    dispatchActionJavascript(actionArgs: {
        actionName: string;
        componentIdx: number | undefined;
        args: Record<string, any>;
    }): Promise<any>;
    dispatchAction(action: Action): Promise<ActionResponse>;
    /**
     * Attempt to resolve `path` immediately by forcibly resolving any composite components required
     * to determine the ref resolution. If the path is resolved to a node index without any unresolved path left,
     * then return the node index. Otherwise return -1.
     *
     * By default, the search for the path begins at the document root, node 0. Specify a node index for `origin`
     * to change where the search begins.
     *
     * By default, the search begins by recursing to the parents of `origin` to match the first part of the path.
     * Specify `skip_parent_search` to bypass that stage and only search descendants of `origin`.
     *
     * At present, this function is implemented only for string indices within the path.
     * An error is thrown if the index of a path contains any references to other nodes.
     */
    resolvePathJavascript(name: string, origin?: number): Promise<number>;
    terminate(): Promise<void>;
    returnAllStateVariables(consoleLogComponents?: boolean): Promise<Record<string, {
        componentIdx: number;
        componentType: string;
        stateValues: Record<string, any>;
        activeChildren: any[];
        replacements?: any[];
        replacementsToWithhold?: number;
        replacementOf?: number;
        sharedParameters: any;
    }>>;
    handleVisibilityChange(documentIsVisible: boolean): void;
    /**
     * Call submitAnswer on all answers in the document
     */
    submitAllAnswers(): Promise<void>;
    /**
     * Immediately save all document state to the database,
     * ignoring any timeouts
     */
    saveImmediately(): Promise<void>;
    _getTests(): Promise<string[] | undefined>;
    _runTest(testName: string): Promise<void | undefined>;
}
declare const _default: void;
export default _default;
//# sourceMappingURL=CoreWorker.d.ts.map