import type { CellSnapshot, RecalcMetrics, SelectionState, SyncState, WorkbookSnapshot } from '@bilig/protocol';
import type { EngineOp, EngineOpBatch } from '@bilig/workbook';
import { type EdgeSlice } from '../edge-arena.js';
import { EngineEventBus } from '../events.js';
import { FormulaTable } from '../formula-table.js';
import { type EngineCounters } from '../perf/engine-counters.js';
import { RangeRegistry } from '../range-registry.js';
import { type OpOrder, type ReplicaState } from '../replica-state.js';
import { RecalcScheduler } from '../scheduler.js';
import { StringPool } from '../string-pool.js';
import { WasmKernelFacade } from '../wasm-facade.js';
import { WorkbookStore } from '../workbook-store.js';
import { type EngineRuntimeState, type EngineSyncClientConnection, type RuntimeFormula, type SpreadsheetEngineOptions, type TransactionLogEntry } from './runtime-state.js';
import { type EngineServiceRuntime } from './live.js';
import type { EngineSnapshotExportOptions } from './services/snapshot-service.js';
export declare abstract class SpreadsheetEngineRuntimeBase {
    protected readonly performanceCounters: EngineCounters;
    readonly workbook: WorkbookStore;
    readonly strings: StringPool;
    readonly events: EngineEventBus;
    protected readonly replicaState: ReplicaState;
    readonly ranges: RangeRegistry;
    readonly scheduler: RecalcScheduler;
    readonly wasm: WasmKernelFacade;
    protected readonly formulas: FormulaTable<RuntimeFormula>;
    private cycleDetector;
    private readonly edgeArena;
    private readonly programArena;
    private readonly constantArena;
    private readonly rangeListArena;
    protected reverseCellEdges: Array<EdgeSlice | undefined>;
    private reverseRangeEdges;
    private readonly reverseDefinedNameEdges;
    private readonly reverseTableEdges;
    protected readonly reverseSpillEdges: Map<string, Set<number>>;
    protected readonly reverseAggregateColumnEdges: Map<number, Set<number>>;
    protected readonly reverseExactLookupColumnEdges: Map<number, EdgeSlice>;
    protected readonly reverseSortedLookupColumnEdges: Map<number, EdgeSlice>;
    protected readonly pivotOutputOwners: Map<number, string>;
    protected readonly batchListeners: Set<(batch: EngineOpBatch) => void>;
    private readonly selectionListeners;
    protected readonly entityVersions: Map<string, OpOrder>;
    protected readonly sheetDeleteVersions: Map<string, OpOrder>;
    protected selection: SelectionState;
    protected syncState: SyncState;
    protected syncClientConnection: EngineSyncClientConnection | null;
    protected readonly undoStack: TransactionLogEntry[];
    protected readonly redoStack: TransactionLogEntry[];
    protected transactionReplayDepth: number;
    private useColumnIndexEnabled;
    private evaluationTimeoutMs;
    private evaluationBudgetActive;
    private evaluationBudgetDeadlineMs;
    private evaluationBudgetDepth;
    private evaluationBudgetStepCount;
    private dependencyBuildEpoch;
    private dependencyBuildSeen;
    private dependencyBuildCells;
    private dependencyBuildEntities;
    private dependencyBuildRanges;
    private dependencyBuildNewRanges;
    private symbolicRefBindings;
    private symbolicRangeBindings;
    private wasmProgramTargets;
    private wasmProgramOffsets;
    private wasmProgramLengths;
    private wasmConstantOffsets;
    private wasmConstantLengths;
    private wasmRangeOffsets;
    private wasmRangeLengths;
    private wasmRangeRowCounts;
    private wasmRangeColCounts;
    private topoIndegree;
    private topoQueue;
    private readonly directScalarDeltaInputCellIndices;
    private readonly directScalarDeltaOutputCellIndicesByInput;
    protected batchMutationDepth: number;
    private wasmProgramSyncPending;
    protected lastMetrics: RecalcMetrics;
    protected readonly state: EngineRuntimeState;
    protected readonly runtime: EngineServiceRuntime;
    constructor(options?: SpreadsheetEngineOptions);
    renameSheetMetadataOnly(oldName: string, newName: string): boolean;
    hasWorkbookMetadataForSheetRenameFastPath(): boolean;
    renameSheetMetadataOnlyById(sheetId: number, newName: string): boolean;
    renameSheetMetadataOnlyByIdPrevalidated(sheetId: number, oldName: string, trimmedName: string): boolean;
    renameSheetMetadataOnlyByIdTrustedPrevalidated(sheetId: number, oldName: string, trimmedName: string, assumeLocalRuntimeReady?: boolean, assumeNoWorkbookRenameMetadata?: boolean): boolean;
    renameSheetSimpleMetadataOnlyByIdTrustedPrevalidated(sheetId: number, oldName: string, trimmedName: string, assumeLocalRuntimeReady?: boolean, assumeNoWorkbookRenameMetadata?: boolean): boolean;
    private renameSheetNamesOnlyByIdTrustedPrevalidated;
    private recordSimpleMetadataOnlySheetRename;
    private recordSimpleMetadataOnlySheetRenameTrusted;
    private recordMetadataOnlySheetRename;
    setEvaluationTimeoutMs(timeoutMs: number | undefined): void;
    private beginEvaluationBudget;
    private endEvaluationBudget;
    private checkEvaluationBudget;
    abstract getSelectionState(): SelectionState;
    abstract setSelection(sheetName: string, address: string | null, options?: {
        anchorAddress?: string | null;
        range?: {
            startAddress: string;
            endAddress: string;
        } | null;
        editMode?: SelectionState['editMode'];
    }): void;
    abstract getCellByIndex(cellIndex: number): CellSnapshot;
    abstract exportSnapshot(options?: EngineSnapshotExportOptions): WorkbookSnapshot;
    abstract importSnapshot(snapshot: WorkbookSnapshot): void;
    protected executeLocalTransaction(ops: EngineOp[], potentialNewCells?: number, options?: {
        readonly emitTracked?: boolean;
    }): readonly EngineOp[] | null;
}
