import type { MutableRefObject } from "react";
import type { EditorMode } from "../client/editContext";
import type { BridgeItemDescriptor } from "../bridge/protocol";
import { type BridgeInlineEditRefreshEvent } from "./bridgeFieldPatch";
export type BridgeInlineEditIdentity = {
    elementKey: string;
    fieldId: string;
    item?: BridgeItemDescriptor;
    sessionId?: string;
};
export type BridgeInlineEditState = BridgeInlineEditIdentity & {
    modeAtStart: EditorMode;
    value?: string;
};
export type BridgeInlineEditBeginToken = {
    id: number;
    key: string;
    sessionId: string;
};
type BeginOperation = (context: {
    token: BridgeInlineEditBeginToken;
    sessionId: string;
    isCurrent: () => boolean;
}) => Promise<boolean>;
export type BridgeInlineEditSessionCoordinator = ReturnType<typeof createBridgeInlineEditSessionCoordinator>;
export declare function createBridgeInlineEditSessionCoordinator({ stateRef, onStateChange, }: {
    stateRef: MutableRefObject<BridgeInlineEditState | null>;
    onStateChange?: (state: BridgeInlineEditState | null) => void;
}): {
    beginSession: (identity: BridgeInlineEditIdentity & {
        modeAtStart: EditorMode;
    }, operation: BeginOperation) => Promise<boolean>;
    clear: () => void;
    completeBegin: (token: BridgeInlineEditBeginToken, authoritativeIdentity?: Partial<BridgeInlineEditIdentity>) => boolean;
    end: (identity: BridgeInlineEditIdentity) => {
        matched: boolean;
        endedState: BridgeInlineEditState | null;
    };
    failBegin: (token: BridgeInlineEditBeginToken) => boolean;
    getRecentlyClearedState: (identity: BridgeInlineEditIdentity) => BridgeInlineEditState | null;
    getState: () => BridgeInlineEditState | null;
    isCurrent: (token: BridgeInlineEditBeginToken) => boolean;
    matches: (identity: BridgeInlineEditIdentity) => boolean;
    reconcileForRefreshEvent: (event: BridgeInlineEditRefreshEvent) => BridgeInlineEditState | null;
    recordValue: (identity: BridgeInlineEditIdentity, value: string, modeAtStart?: EditorMode) => boolean;
    reject: (identity: BridgeInlineEditIdentity) => boolean;
};
export declare function inlineEditSessionMatches(active: BridgeInlineEditState | null | undefined, identity: BridgeInlineEditIdentity): boolean;
export {};
