import { TemplateResult } from 'lit-html';
import { Direction } from '../events/RemoveEvent';
import ArenaSelection from '../helpers/ArenaSelection';
import { AnyArena, ArenaInlineInterface, ArenaMediatorInterface, ArenaRootInterface, ArenaTextInterface, ChildArena } from '../interfaces/Arena';
import { AnyArenaNode, ArenaNodeRoot, ArenaNodeText, ArenaNodeInline, ArenaNodeMediator, ChildArenaNode, ParentArenaNode } from '../interfaces/ArenaNode';
import ArenaCursorText from '../interfaces/ArenaCursorText';
import ArenaCursorAncestor from '../interfaces/ArenaCursorAncestor';
import ArenaFormating, { ArenaFormatings, TagAndAttributes } from '../interfaces/ArenaFormating';
import ArenaOptionsChild from '../interfaces/ArenaOptions';
import ArenaServiceManager from './ArenaServiceManager';
import NodeRegistry from '../helpers/NodeRegistry';
declare type ArenaMark = {
    attributes: string[];
    arena: AnyArena;
};
declare type FormatingMark = {
    attributes: string[];
    formating: ArenaFormating;
};
export default class ArenaModel {
    protected asm: ArenaServiceManager;
    readonly rootArenaName = "__ROOT__";
    constructor(asm: ArenaServiceManager);
    get model(): ArenaNodeRoot;
    getRegistry(): NodeRegistry;
    setRegistry(registry: NodeRegistry): void;
    setRoot(root: ArenaNodeRoot): void;
    setDefaultTextArena(arena: ArenaMediatorInterface | ArenaTextInterface): void;
    registerArena(arenaOptions: ArenaOptionsChild, markers?: TagAndAttributes[], parentArenas?: string[]): ChildArena | ArenaInlineInterface;
    registerFormating(formating: ArenaFormating, markers: TagAndAttributes[]): ArenaFormating;
    getArena(name: string): AnyArena | undefined;
    getArenas(): AnyArena[];
    getFormatings(): ArenaFormatings;
    getArenaMarks(tagName: string): ArenaMark[] | undefined;
    getFormatingMarks(tagName: string): FormatingMark[] | undefined;
    /** */
    applyMiddlewares(cursor: ArenaCursorText, text: string): [boolean, ArenaCursorText];
    getDataHtml(): string;
    getTemplate(): TemplateResult | string;
    getPublicHtml(): string;
    getPlainTextOfSelection(selection: ArenaSelection): string;
    getOutputHtmlOfSelection(selection: ArenaSelection): string;
    getJson(): string;
    /** */
    createChildNode(arena: ChildArena, isNew?: boolean): ChildArenaNode;
    /** */
    getTextCursor(node: AnyArenaNode, offset: number): ArenaCursorText;
    /**
     * TODO split in two methods: with creating and without
     * Find or create text node in children or ancestors.
     * @param node AnyArenaNode
     * @param offset number
     * @returns ArenaCursorText | undefined
     */
    getOrCreateNodeForText(node: AnyArenaNode, offset?: number, onlyChild?: boolean, forceCreate?: boolean): ArenaCursorText | undefined;
    /**
     * Try to create new node described by arena in given parent and offset.
     * @param arena ChildArena
     * @param parent ParentArenaNode
     * @param offset number
     * @returns ChildArenaNode | undefined
     */
    createAndInsertNode(arena: ChildArena, parent: AnyArenaNode, offset: number, before?: boolean, onlyChild?: boolean, isNew?: boolean): ChildArenaNode | undefined;
    /**
     * Find in model tree the text node with global id equal given id parameter.
     * @param id: string
     * @returns ArenaNodeText | undefined
     */
    getTextNodeById(id: string): ArenaNodeText | undefined;
    /**
     * Find in model tree the node with global id equal given id parameter.
     * @param id: string
     * @returns AnyArenaNode | undefined
     */
    getNodeById(id: string): AnyArenaNode | undefined;
    insertHtml(selection: ArenaSelection, html: string): ArenaSelection;
    insertTextToModel(selection: ArenaSelection, text: string, typing?: boolean): ArenaSelection;
    removeNodeById(id: string): ArenaCursorAncestor | undefined;
    /**
     * Remove selected text and all nodes between selections ends
     * @param selection
     * @param direction
     * @returns
     */
    removeSelection(selection: ArenaSelection, direction: Direction): ArenaSelection;
    /**
     * Remove selected nodes and split selected node in two nodes.
     * If current node is empty, try split uprotected parent in two
     * or get out of protected node, if cursor in the end of parent.
     * @param selection
     * @returns
     */
    breakSelection(selection: ArenaSelection): ArenaSelection;
    splitTextNode({ node, offset }: ArenaCursorText): ArenaCursorAncestor;
    /** */
    moveChild(selection: ArenaSelection, direction: 'up' | 'down'): ArenaSelection;
    /** */
    insertBeforeSelected(selection: ArenaSelection, arena: ChildArena): ArenaSelection;
    /**
     *
     * @param selection
     * @param arena
     * @returns
     */
    applyArenaToSelection(selection: ArenaSelection, arena: ArenaMediatorInterface | ArenaTextInterface): ArenaSelection;
    /**
     * Apply given formation to all selected nodes, including child nodes.
     * @param selection ArenaSelection
     * @param formating ArenaFormating
     * @returns ArenaSelection
     */
    applyFormationToSelection(selection: ArenaSelection, formating: ArenaFormating): ArenaSelection;
    clearFormationInSelection(selection: ArenaSelection): ArenaSelection;
    addInlineNode(selection: ArenaSelection, arena: ArenaInlineInterface): ArenaNodeInline | undefined;
    getInlineNode(selection: ArenaSelection, arena: ArenaInlineInterface): ArenaNodeInline | undefined;
    removeInlineNode(selection: ArenaSelection, node: ArenaNodeInline): void;
    updateInlineNode(selection: ArenaSelection, node: ArenaNodeInline): void;
    /**
     * Call callback function for all selected nodes without any child nodes.
     * @param selection ArenaSelection
     * @param callback (node: ChildArenaNode, start?: number, end?: number) => void
     * @returns Common ancestor with start and end indexes of selected nodes.
     */
    runNodesOfSelection(selection: ArenaSelection, callback?: (node: ChildArenaNode, start?: number, end?: number) => void): [ParentArenaNode, number, number] | undefined;
    protected registry: NodeRegistry;
    protected arenas: AnyArena[];
    protected arenasByName: {
        [name: string]: AnyArena;
    };
    protected formatings: ArenaFormating[];
    protected formatingsByName: ArenaFormatings;
    protected areanMarks: {
        [tag: string]: ArenaMark[];
    };
    protected formatingMarks: {
        [tag: string]: FormatingMark[];
    };
    protected rootArena: ArenaRootInterface | undefined;
    protected rootNode: ArenaNodeRoot | undefined;
    /** Split non protected node into two.
     * If offset in start or end of the givven node splitting is not necessary. */
    protected splitMediatorNode(node: ArenaNodeMediator, offset: number): undefined | ArenaNodeMediator;
    /**  */
    protected getOutFromMediator(node: ArenaNodeText, onlyGroup?: boolean): ArenaNodeText | undefined;
    /** */
    runOfChildren(node: AnyArenaNode, callback: (n: AnyArenaNode) => void): void;
    protected getCommonAncestor(nodeA: AnyArenaNode, nodeB: AnyArenaNode): [
        ParentArenaNode,
        number,
        number
    ] | undefined;
    protected getAncestors(node: AnyArenaNode): ArenaCursorAncestor[];
    protected applyTextArenaToSelection(selection: ArenaSelection, arena: ArenaTextInterface): ArenaSelection;
    protected transformNode(node: ChildArenaNode, arena: ArenaTextInterface): ArenaNodeText | undefined;
    protected getParentWhoCanCreateNode(node: AnyArenaNode, arena: ArenaTextInterface, after?: boolean): ArenaCursorAncestor | undefined;
    protected toggleGroupArenaForSelection(selection: ArenaSelection, arena: ArenaMediatorInterface): ArenaSelection;
    /**
     * Wrap selected nodes by protected Node described by given Arena.
     * All selected children will be took of and inserted in new Node, if it allow Arena.
     * Rest children will be back in them ancestor after new Node.
     * @param selection ArenaSelection
     * @param arena ArenaAncestor
     * @returns ArenaSelection
     */
    protected applyProtectedArenaToSelection(selection: ArenaSelection, arena: ArenaMediatorInterface): ArenaSelection;
    protected toggleSimpleMediatorArenaForSelection(selection: ArenaSelection, arena: ArenaMediatorInterface): ArenaSelection;
    protected tryToFindAncestor(node: AnyArenaNode, arena: ArenaMediatorInterface): ArenaNodeMediator | undefined;
    protected tryToFindAncestor2(node: ParentArenaNode, arena: ArenaMediatorInterface): ArenaNodeMediator | undefined;
    protected unwrapNode(node: ArenaNodeMediator): void;
}
export {};
//# sourceMappingURL=ArenaModel.d.ts.map