/**
 * @license
 * Copyright 2026 Google LLC
 * SPDX-License-Identifier: Apache-2.0
 */
import { type RegionNode, type RegionUpdate } from '../output.js';
import { type InkOptions } from '../components/AppContext.js';
import { type ReplayFrame } from '../replay.js';
import { type RenderLine } from './terminal-writer.js';
import { SceneManager } from './scene-manager.js';
export declare const debugWorker = false;
/**
 * Core renderer that composes together scrollable blocks of styled content.
 */
export declare class TerminalBufferWorker {
    columns: number;
    rows: number;
    frameIndex: number;
    debugRainbowEnabled: boolean;
    isAlternateBufferEnabled: boolean;
    stickyHeadersInBackbuffer: boolean;
    animatedScroll: boolean;
    animationInterval: number;
    backbufferUpdateDelay: number;
    maxScrollbackLength: number;
    forceScrollToBottomOnBackbufferRefresh: boolean;
    resized: boolean;
    cursorPosition?: {
        row: number;
        col: number;
    };
    forceNextRender: boolean;
    isRecording: boolean;
    recordingFilename: string;
    recordedFrames: ReplayFrame[];
    recordingStartTime: number;
    screen: RenderLine[];
    backbuffer: RenderLine[];
    private renderPromise?;
    private readonly sceneManager;
    private readonly animationController;
    private readonly scrollOptimizer;
    private readonly primaryTerminalWriter;
    private readonly alternateTerminalWriter;
    private get terminalWriter();
    get backbufferDirty(): boolean;
    set backbufferDirty(value: boolean);
    get backbufferDirtyCurrentFrame(): boolean;
    set backbufferDirtyCurrentFrame(value: boolean);
    constructor(columns: number, rows: number, options?: {
        debugRainbowEnabled?: boolean;
        stdout?: NodeJS.WriteStream;
        isAlternateBufferEnabled?: boolean;
        stickyHeadersInBackbuffer?: boolean;
        animatedScroll?: boolean;
        animationInterval?: number;
        backbufferUpdateDelay?: number;
        maxScrollbackLength?: number;
        forceScrollToBottomOnBackbufferRefresh?: boolean;
    });
    waitForIdle(): Promise<void>;
    getExpectedState(): {
        backbuffer: RenderLine[];
        screen: RenderLine[];
        cursorX: number;
        cursorY: number;
    };
    getSceneManager(): SceneManager;
    startRecording(filename: string): void;
    stopRecording(): void;
    dumpCurrentFrame(filename: string): void;
    updateOptions(options: InkOptions): void;
    update(tree: RegionNode, updates: RegionUpdate[], cursorPosition?: {
        row: number;
        col: number;
    }): boolean;
    resize(columns: number, rows: number): void;
    fullRender(): Promise<void>;
    render(): Promise<void>;
    flushPendingRender(): Promise<void>;
    done(): void;
    getLinesUpdated(): number;
    resetLinesUpdated(): void;
    clear(): void;
    private serializeCurrentRegions;
    private _render;
    private tickAnimation;
    private composeScene;
    /**
     * Recursively composites a region and its children onto the provided canvas.
     *
     * @param node The hierarchical node to compose.
     * @param canvas The target canvas to draw upon.
     * @param layout Layout and clipping options for the current composition pass.
     * @param layout.clip Optional bounding box to clip rendering.
     * @param layout.offsetY The cumulative Y offset (used for scrolling/camera adjustments).
     * @param layout.offsetX The cumulative X offset (used for scrolling/camera adjustments).
     * @param layout.overrideHeight Optional height to force for the current region, typically used when composing to the backbuffer to capture content that has scrolled out of view.
     * @param layout.isExpanded If true, forces the region to render at its full scroll height rather than its constrained layout height. When composing the backbuffer, this flag is passed down to the specific scrollable descendant that has `overflowToBackbuffer` enabled (typically only one such region should exist), allowing its complete content to be captured instead of just the visible viewport.
     * @param options Additional composition flags.
     * @param options.skipStickyHeaders If true, sticky headers will not be drawn.
     * @param options.skipScrollbars If true, scrollbars will not be drawn.
     */
    private composeNode;
    private createCompositor;
    private getCameraY;
    private syncCursor;
    private appendToBackbuffer;
    private updateTrackingMaps;
    private findNodeForRegion;
    private logScene;
}
