import type { Effect, LinkedBundle, Metadata, RenderPostRequest, RenderPostResponse, UIDimensions, UIEvent } from '@devvit/protos';
import { BlockRenderEventType } from '@devvit/protos';
import type { Struct } from '@devvit/protos/types/google/protobuf/struct.js';
import type { ErrorCallback, LiteClient } from '@devvit/runtime-lite/client/BrowserLiteClient.js';
import type { LiteLoadResponse } from '@devvit/runtime-lite/client/ClientShared.js';
import type { PluginCallback } from '@devvit/runtime-lite/runtime/RuntimeLite.js';
import type { T3ID, TID } from '@devvit/shared-types/tid.js';
import type { UIApp } from './remote-app.js';
type AppState = {
    __postData?: {
        thingId: TID | undefined;
        config: Struct['fields'] | undefined;
    };
    [key: string]: unknown;
};
type EventData = {
    [key: string]: unknown;
};
type PausedEffect = {
    renderType: BlockRenderEventType;
    effects: readonly Effect[];
};
/**
 * App render and effect looping logic. Rendering and event processing is as
 * follows:
 *
 * 1. Try the local runtime, if available.
 * 2. If a local runtime or bundle is unavailable, or local execution fails
 *    (including CircuitBreak), try the remote.
 * 3. Report execution errors by callback only. In general, all errors are
 *    attempted to be tolerated.
 *
 * App / render state is always preserved even on error so a buggy app will try
 * not to show any issues. A bundle or runtime can be replaced on the fly with
 * losing state.
 */
export declare class Dispatcher {
    #private;
    onError?: ErrorCallback | undefined;
    onPluginCall?: PluginCallback | undefined;
    onRenderPost?: ((req: RenderPostRequest, rsp: RenderPostResponse) => void) | undefined;
    onUserAction?: ((fx: Effect) => void) | undefined;
    postConfig?: Struct['fields'] | undefined;
    postID?: T3ID | undefined;
    /** A client to the remote runtime. */
    remote?: UIApp | undefined;
    /** Dimensions that describe layout information for the custom post entry point */
    dimensions: UIDimensions;
    /**
     * A client to the local runtime.
     * @internal
     */
    _local?: LiteClient | undefined;
    /** Get the current app state with the current post state. */
    get appState(): AppState;
    /**
     * Load an app bundle into the local runtime, if available. The bundle is
     * assumed to implement a UIApp.
     */
    load(app: Readonly<LinkedBundle>): Promise<LiteLoadResponse | undefined>;
    set meta(meta: Readonly<Metadata> | undefined);
    queueEvent(ev: UIEvent): void;
    queueRenderPost(type: BlockRenderEventType, id: string | undefined, data: EventData): void;
    get rendered(): boolean;
    get pausedEffects(): readonly PausedEffect[];
    /**
     * Discard app and render state. This is used indirectly by devvit-preview
     * which frequently loads new bundles.
     */
    resetAppState(): void;
    set runtimeDebugLogging(on: boolean);
    /** Set the runtime source code. */
    setLocalSrc(src: Blob | undefined): void;
    /** Unload the app and reject any open requests. */
    unload(): void;
    /** Pause/unpause the app. */
    togglePause(paused: boolean): void;
}
export {};
//# sourceMappingURL=dispatcher.d.ts.map