import type { EngineOp } from '@bilig/workbook';
import type { CellValue } from '@bilig/protocol';
import type { OpOrder } from '../../replica-state.js';
import type { PreparedCellAddress } from '../runtime-state.js';
import type { DirectFormulaIndexCollection } from './direct-formula-index-collection.js';
import type { ExactLookupImpactCaches } from './operation-lookup-dirty-markers.js';
import type { OperationLookupPlanner } from './operation-lookup-planner.js';
import type { CreateEngineOperationServiceArgs, MutationSource } from './operation-service-types.js';
type BatchSetCellValueOp = Extract<EngineOp, {
    kind: 'setCellValue';
}>;
type BatchClearCellOp = Extract<EngineOp, {
    kind: 'clearCell';
}>;
interface OperationBatchPreparedCells {
    readonly getExistingCellIndex: (sheetName: string, address: string, preparedCellAddress: PreparedCellAddress | null) => number | undefined;
    readonly ensureCellTracked: (sheetName: string, address: string, preparedCellAddress: PreparedCellAddress | null) => number;
}
interface BatchCellValueMutationCounts {
    readonly changedInputCount: number;
    readonly formulaChangedCount: number;
    readonly explicitChangedCount: number;
    readonly topologyChanged: boolean;
    readonly refreshAllPivots: boolean;
}
interface BatchCellValueMutationBaseArgs extends BatchCellValueMutationCounts {
    readonly serviceArgs: CreateEngineOperationServiceArgs;
    readonly order: OpOrder;
    readonly source: MutationSource;
    readonly isRestore: boolean;
    readonly preparedCellAddress: PreparedCellAddress | null;
    readonly preparedCells: OperationBatchPreparedCells;
    readonly postRecalcDirectFormulaIndices: DirectFormulaIndexCollection;
    readonly exactLookupImpactCaches: ExactLookupImpactCaches;
    readonly setEntityVersionForOp: (op: EngineOp, order: OpOrder) => void;
    readonly hasTrackedExactLookupDependents: (sheetId: number, col: number) => boolean;
    readonly hasTrackedSortedLookupDependents: (sheetId: number, col: number) => boolean;
    readonly hasTrackedDirectRangeDependents: (sheetId: number, col: number) => boolean;
    readonly readCellValueForLookup: (cellIndex: number | undefined) => {
        readonly value: CellValue;
        readonly stringId: number | undefined;
    };
    readonly rebindValueSensitiveFormulaDependents: (cellIndex: number, counts: BatchCellValueMutationCounts) => BatchCellValueMutationCounts;
    readonly refreshDependentRangesAndRebindFormulaDependents: (cellIndex: number, formulaChangedCount: number) => number;
    readonly markPostRecalcDirectFormulaDependents: (cellIndex: number, postRecalcDirectFormulaIndices: DirectFormulaIndexCollection, oldValue?: CellValue, newValue?: CellValue) => boolean;
    readonly markDirectScalarDeltaClosure: (rootCellIndex: number, oldValue: CellValue, newValue: CellValue, postRecalcDirectFormulaIndices: DirectFormulaIndexCollection) => void;
    readonly noteExactLookupLiteralWriteWhenDirty: (request: {
        readonly sheetName: string;
        readonly row: number;
        readonly col: number;
        readonly oldValue: CellValue;
        readonly newValue: CellValue;
        readonly oldStringId?: number;
        readonly newStringId?: number;
        readonly inputCellIndex?: number;
    }, formulaChangedCount: number, caches: ExactLookupImpactCaches) => number;
    readonly noteSortedLookupLiteralWriteWhenDirty: (request: {
        readonly sheetName: string;
        readonly row: number;
        readonly col: number;
        readonly oldValue: CellValue;
        readonly newValue: CellValue;
        readonly oldStringId?: number;
        readonly newStringId?: number;
    }, formulaChangedCount: number) => number;
    readonly markAffectedDirectRangeDependents: (request: {
        readonly sheetName: string;
        readonly row: number;
        readonly col: number;
        readonly oldValue: CellValue;
        readonly newValue: CellValue;
        readonly oldStringId?: number;
        readonly newStringId?: number;
        readonly inputCellIndex?: number;
    }, formulaChangedCount: number, postRecalcDirectFormulaIndices: DirectFormulaIndexCollection) => number;
    readonly clearLookupImpactCaches: () => void;
    readonly pruneCellIfOrphaned: (cellIndex: number) => void;
}
interface ApplyBatchSetCellValueOpArgs extends BatchCellValueMutationBaseArgs {
    readonly op: BatchSetCellValueOp;
    readonly isNullLiteralWriteNoOp: (cellIndex: number) => boolean;
    readonly planExactLookupNumericColumnWrite: OperationLookupPlanner['planExactLookupNumericColumnWrite'];
    readonly planApproximateLookupNumericColumnWrite: OperationLookupPlanner['planApproximateLookupNumericColumnWrite'];
    readonly allowLookupTailPatch: boolean;
    readonly lookupHandledInputCellIndices: number[];
}
interface ApplyBatchClearCellOpArgs extends BatchCellValueMutationBaseArgs {
    readonly op: BatchClearCellOp;
    readonly isClearCellNoOp: (cellIndex: number) => boolean;
    readonly normalizeHistoryDependencyPlaceholder: (cellIndex: number, source: MutationSource) => void;
}
export declare function applyBatchSetCellValueOp(request: ApplyBatchSetCellValueOpArgs): BatchCellValueMutationCounts;
export declare function applyBatchClearCellOp(request: ApplyBatchClearCellOpArgs): BatchCellValueMutationCounts;
export {};
