import { Effect } from 'effect';
import type { CycleDetector } from '../../cycle-detection.js';
import type { EngineRuntimeState, U32 } from '../runtime-state.js';
import { EngineFormulaGraphError } from '../errors.js';
import type { Float64Arena, Uint32Arena } from '@bilig/formula';
import { type EngineCounters } from '../../perf/engine-counters.js';
export interface EngineFormulaGraphService {
    readonly rebuildTopoRanks: () => Effect.Effect<void, EngineFormulaGraphError>;
    readonly repairTopoRanks: (changedFormulaCells: readonly number[] | U32) => Effect.Effect<boolean, EngineFormulaGraphError>;
    readonly detectCycles: () => Effect.Effect<void, EngineFormulaGraphError>;
    readonly forEachFormulaDependencyCell: (cellIndex: number, fn: (dependencyCellIndex: number) => void) => Effect.Effect<void, EngineFormulaGraphError>;
    readonly scheduleWasmProgramSync: () => Effect.Effect<void, EngineFormulaGraphError>;
    readonly flushWasmProgramSync: () => Effect.Effect<void, EngineFormulaGraphError>;
    readonly rebuildTopoRanksNow: () => void;
    readonly repairTopoRanksNow: (changedFormulaCells: readonly number[] | U32) => boolean;
    readonly detectCyclesNow: () => void;
    readonly scheduleWasmProgramSyncNow: () => void;
    readonly flushWasmProgramSyncNow: () => void;
}
export declare function createEngineFormulaGraphService(args: {
    readonly state: Pick<EngineRuntimeState, 'workbook' | 'formulas' | 'ranges' | 'wasm'> & {
        counters?: EngineCounters;
    };
    readonly getCycleDetector: () => CycleDetector;
    readonly programArena: Uint32Arena;
    readonly constantArena: Float64Arena;
    readonly rangeListArena: Uint32Arena;
    readonly getTopoIndegree: () => U32;
    readonly setTopoIndegree: (next: U32) => void;
    readonly getTopoQueue: () => U32;
    readonly setTopoQueue: (next: U32) => void;
    readonly getWasmProgramTargets: () => U32;
    readonly setWasmProgramTargets: (next: U32) => void;
    readonly getWasmProgramOffsets: () => U32;
    readonly setWasmProgramOffsets: (next: U32) => void;
    readonly getWasmProgramLengths: () => U32;
    readonly setWasmProgramLengths: (next: U32) => void;
    readonly getWasmConstantOffsets: () => U32;
    readonly setWasmConstantOffsets: (next: U32) => void;
    readonly getWasmConstantLengths: () => U32;
    readonly setWasmConstantLengths: (next: U32) => void;
    readonly getWasmRangeOffsets: () => U32;
    readonly setWasmRangeOffsets: (next: U32) => void;
    readonly getWasmRangeLengths: () => U32;
    readonly setWasmRangeLengths: (next: U32) => void;
    readonly getWasmRangeRowCounts: () => U32;
    readonly setWasmRangeRowCounts: (next: U32) => void;
    readonly getWasmRangeColCounts: () => U32;
    readonly setWasmRangeColCounts: (next: U32) => void;
    readonly getBatchMutationDepth: () => number;
    readonly getWasmProgramSyncPending: () => boolean;
    readonly setWasmProgramSyncPending: (next: boolean) => void;
    readonly rebuildCalcChain: () => void;
    readonly notifyCellValueWritten: (cellIndex: number) => void;
    readonly forEachFormulaDependencyCell: (cellIndex: number, fn: (dependencyCellIndex: number) => void) => void;
    readonly collectFormulaDependents: (entityId: number) => Uint32Array;
}): EngineFormulaGraphService;
