import type { Clock as WorkbookDomainClock, EngineOp, EngineOpBatch, OpId, ReplicaId } from '@bilig/workbook';
type Clock = WorkbookDomainClock;
export interface ReplicaState {
    replicaId: ReplicaId;
    clock: Clock;
    appliedBatchIds: Set<OpId>;
}
export interface OpOrder {
    counter: number;
    replicaId: ReplicaId;
    batchId: OpId;
    opIndex: number;
}
export interface ReplicaSnapshot {
    replicaId: ReplicaId;
    counter: number;
    appliedBatchIds: OpId[];
}
export interface ReplicaVersionSnapshot {
    entityKey: string;
    order: OpOrder;
}
export declare function createReplicaState(replicaId: ReplicaId): ReplicaState;
export declare function hydrateReplicaState(state: ReplicaState, snapshot: ReplicaSnapshot): void;
export declare function exportReplicaSnapshot(state: ReplicaState, limit?: number): ReplicaSnapshot;
export declare function importReplicaSnapshot(snapshot: ReplicaSnapshot): ReplicaState;
export declare function createBatch(state: ReplicaState, ops: EngineOp[]): EngineOpBatch;
export declare function createLocalOpOrder(state: ReplicaState, opIndex?: number): OpOrder;
export declare function markBatchApplied(state: ReplicaState, batch: EngineOpBatch): void;
export declare function shouldApplyBatch(state: ReplicaState, batch: EngineOpBatch): boolean;
export declare function batchOpOrder(batch: EngineOpBatch, opIndex: number): OpOrder;
export declare function compareOpOrder(left: OpOrder, right: OpOrder): number;
export declare function compactLog(batches: EngineOpBatch[]): EngineOpBatch[];
export declare function mergeBatches(batches: EngineOpBatch[]): EngineOpBatch[];
export {};
