import { Plugin } from '../plugin';
import { StoreDeserializeHelpers } from '../plugin-state';
export declare enum ActionType {
    InitRoot = "InitRoot",
    Insert = "Insert",
    Remove = "Remove",
    Change = "Change",
    Focus = "Focus",
    FocusNext = "FocusNext",
    FocusPrevious = "FocusPrevious",
    Undo = "Undo",
    Redo = "Redo",
    Persist = "Persist",
    Reset = "Reset",
    CopyToClipboard = "CopyToClipboard",
    SwitchEditable = "SwitchEditable"
}
export declare enum ActionCommitType {
    ForceCommit = "ForceCommit",
    ForceCombine = "ForceCombine"
}
export declare const createInitialState: <K extends string>(plugins: Record<K, Plugin<import("../plugin-state").StateDescriptor<any, any, unknown>, any>>, defaultPlugin: K, editable: boolean) => State;
export declare function reducer(state: BaseState | State, action: Action): State;
export interface BaseState {
    defaultPlugin: PluginType;
    plugins: Record<PluginType, Plugin>;
    documents: Record<string, PluginState>;
    focus?: string;
}
export interface State extends BaseState {
    root?: string;
    history: {
        initialState: BaseState | State;
        actions: Undoable[][];
        redoStack: Undoable[][];
        pending: number;
    };
    clipboard: PluginState[];
    editable: boolean;
}
export declare function hasHistory(state: BaseState | State): state is State;
export declare type Undoable = (InsertAction | ChangeAction | RemoveAction) & {
    commit?: ActionCommitType;
};
export declare type Action = InitRootAction | Undoable | FocusAction | FocusNextAction | FocusPreviousAction | UndoAction | RedoAction | PersistAction | ResetAction | CopyAction | SwitchEditableAction;
declare type PluginType = string;
export interface InitRootAction {
    type: ActionType.InitRoot;
    payload: {
        plugin?: string;
        state?: unknown;
    };
}
export interface InsertAction {
    type: ActionType.Insert;
    payload: {
        id: string;
    } & Partial<PluginState>;
}
export interface ChangeAction<S = unknown> {
    type: ActionType.Change;
    payload: {
        id: string;
        state: (value: S, helpers: StoreDeserializeHelpers) => S;
    };
}
export interface RemoveAction {
    type: ActionType.Remove;
    payload: string;
}
export interface FocusAction {
    type: ActionType.Focus;
    payload: string;
}
export interface FocusNextAction {
    type: ActionType.FocusNext;
}
export interface FocusPreviousAction {
    type: ActionType.FocusPrevious;
}
export interface UndoAction {
    type: ActionType.Undo;
}
export interface RedoAction {
    type: ActionType.Redo;
}
export interface PersistAction {
    type: ActionType.Persist;
}
export interface ResetAction {
    type: ActionType.Reset;
}
export interface CopyAction {
    type: ActionType.CopyToClipboard;
    payload: string;
}
export interface SwitchEditableAction {
    type: ActionType.SwitchEditable;
    payload: boolean;
}
export interface PluginState {
    plugin: PluginType;
    state?: unknown;
}
/** Selectors */
export declare function getRoot(state: State): string | undefined;
export declare function getDocuments(state: State): Record<string, PluginState>;
export declare function getDocument(state: State, id: string): PluginState | null;
export declare function getPlugin(state: State, type: string): Plugin | null;
export declare function getClipboard(state: State): PluginState[];
export declare function getPluginOrDefault(state: State, type?: string): Plugin | null;
export declare function getDefaultPlugin(state: State): PluginType;
export declare function getPluginTypeOrDefault(state: State, type?: string): PluginType;
export declare function getPlugins<K extends string = string>(state: State): Record<K, Plugin>;
export declare function isFocused(state: State, id: string): boolean;
export declare function isEditable(state: State): boolean;
export declare function isEmpty(state: State, id: string): boolean;
export declare function hasPendingChanges(state: State): boolean;
export declare function pendingChanges(state: State): number;
export declare function serializePlugin(state: State, id: string): PluginState | null;
export declare function serializeDocument(state: State): PluginState | null;
export {};
//# sourceMappingURL=reducer.d.ts.map