import { ErrorCode, ValueTag, type CellValue } from '@bilig/protocol';
import type { EdgeArena, EdgeSlice } from '../../edge-arena.js';
import type { RuntimeDirectLookupDescriptor, RuntimeDirectScalarDescriptor } from '../runtime-state.js';
import type { DirectFormulaIndexCollection, DirectScalarCurrentOperand } from './direct-formula-index-collection.js';
import type { OperationDirectLookupCurrentService } from './operation-direct-lookup-current.js';
export interface OperationDirectPostRecalcFormula {
    readonly compiled: {
        readonly deps: readonly string[];
        readonly volatile: boolean;
        readonly producesSpill: boolean;
    };
    readonly directAggregate: object | undefined;
    readonly directCriteria: object | undefined;
    readonly directLookup: RuntimeDirectLookupDescriptor | undefined;
    readonly directScalar: RuntimeDirectScalarDescriptor | undefined;
}
export interface OperationDirectPostRecalcMarkerState {
    readonly workbook: {
        readonly cellStore: {
            readonly flags: ArrayLike<number | undefined>;
            readonly tags: ArrayLike<ValueTag | undefined>;
            readonly stringIds: ArrayLike<number | undefined>;
            readonly errors: ArrayLike<ErrorCode | undefined>;
            readonly getValue: (cellIndex: number, readString: (stringId: number) => string) => CellValue;
        };
    };
    readonly formulas: {
        readonly get: (cellIndex: number) => OperationDirectPostRecalcFormula | undefined;
    };
    readonly directScalarDeltaInputCellIndices?: ArrayLike<number | undefined>;
    readonly strings: {
        readonly get: (id: number) => string;
    };
}
export declare function initialDirectScalarLinearDeltaClosureCapacity(scalarDeltaClosureLimit: number): number;
export declare function createOperationDirectPostRecalcMarkers(args: {
    readonly state: OperationDirectPostRecalcMarkerState;
    readonly getSingleEntityDependent: (entityId: number) => number;
    readonly getEntityDependents: (entityId: number) => Uint32Array;
    readonly getSingleCellDependent?: (cellIndex: number) => number;
    readonly getCellDependents?: (cellIndex: number) => Uint32Array;
    readonly reverseCellEdges?: Array<EdgeSlice | undefined>;
    readonly edgeArena?: Pick<EdgeArena, 'empty' | 'singletonValue'>;
    readonly hasNoCellDependents: (cellIndex: number) => boolean;
    readonly canSkipAllDirectFormulaColumnVersions?: () => boolean;
    readonly canSkipDirectFormulaColumnVersion: (cellIndex: number) => boolean;
    readonly readDirectScalarCellNumber: (cellIndex: number) => number | undefined;
    readonly directScalarCellNumericValue: (cellIndex: number) => number | undefined;
    readonly directScalarCurrentResultMatchesCell: (formulaCellIndex: number, result: DirectScalarCurrentOperand) => boolean;
    readonly lookupCurrent: Pick<OperationDirectLookupCurrentService, 'tryDirectUniformLookupCurrentResult' | 'tryDirectUniformLookupCurrentResultFromNumeric' | 'canEvaluateDirectUniformLookupCurrentResultFromNumeric' | 'tryDirectExactLookupCurrentResult'>;
    readonly scalarDeltaClosureLimit: number;
}): {
    readonly canUseDirectFormulaPostRecalc: (formulaCellIndex: number) => boolean;
    readonly markDirectScalarDeltaClosure: (rootCellIndex: number, oldValue: CellValue, newValue: CellValue, postRecalcDirectFormulaIndices: DirectFormulaIndexCollection) => void;
    readonly markPostRecalcDirectFormulaDependents: (cellIndex: number, postRecalcDirectFormulaIndices: DirectFormulaIndexCollection, oldValue?: CellValue, newValue?: CellValue) => boolean;
    readonly markPostRecalcDirectLookupCurrentDependentsFromNumeric: (cellIndex: number, exactLookupValue: number | undefined, approximateLookupValue: number | undefined, postRecalcDirectFormulaIndices: DirectFormulaIndexCollection) => boolean;
    readonly markPostRecalcDirectScalarNumericDependents: (cellIndex: number, oldNumber: number, newNumber: number, postRecalcDirectFormulaIndices: DirectFormulaIndexCollection, exactLookupValue?: number, approximateLookupValue?: number) => boolean;
    readonly tryDirectScalarNumericDelta: (directScalar: RuntimeDirectScalarDescriptor, changedCellIndex: number, oldValue: CellValue, newValue: CellValue) => number | undefined;
    readonly tryDirectScalarNumericDeltaFromNumbers: (directScalar: RuntimeDirectScalarDescriptor, changedCellIndex: number, oldChangedNumber: number, newChangedNumber: number) => number | undefined;
    readonly tryMarkDirectScalarLinearDeltaClosure: (rootCellIndex: number, oldValue: CellValue, newValue: CellValue, postRecalcDirectFormulaIndices: DirectFormulaIndexCollection) => boolean;
};
