import { IBounds, ILeafList, IUI, IFunction, IEventListenerId, ILeaf, IPointerEvent, ILeaferCanvas, IRenderOptions, IGroup, IObject, IGroupInputData, IEditSize, IPointData, IAlign, IAxis, IMatrix, IApp, IBox, IEditorDragStartData, IBoundsData, IEditorConfig as IEditorConfig$1, IBoxInputData, IKeyEvent, IRect, IRectInputData, IMatrixData, IDragEvent, IAround, ILayoutBoundsData } from '@leafer-ui/interface';
import { Group, UI, Direction9, Event, Box } from '@leafer-ui/draw';
import { PointerEvent, DragEvent, MoveEvent, ZoomEvent, RotateEvent, KeyEvent } from '@leafer-ui/core';
import { IEditSelect, IEditor, IStroker, ISelectArea, IEditorConfig, IEditPoint, ISimulateElement, IEditBox, IEditTool, IInnerEditor, IEditorScaleEvent, IEditorEvent, IEditPointType, IEditorMoveEvent, IEditorRotateEvent, IEditorSkewEvent, IEditorGroupEvent, IInnerEditorEvent, IUI as IUI$1, IDragEvent as IDragEvent$1, IPointData as IPointData$1, IPathCommandData, IFromToData, IAround as IAround$1 } from '@leafer-in/interface';

declare class EditSelect extends Group implements IEditSelect {
    editor: IEditor;
    get dragging(): boolean;
    get running(): boolean;
    get isMoveMode(): boolean;
    hoverStroker: IStroker;
    targetStroker: IStroker;
    bounds: IBounds;
    selectArea: ISelectArea;
    protected originList: ILeafList;
    protected needRemoveItem: IUI;
    protected waitSelect: IFunction;
    protected __eventIds: IEventListenerId[];
    constructor(editor: IEditor);
    protected onHover(): void;
    protected onSelect(): void;
    update(): void;
    protected onPointerMove(e: PointerEvent): void;
    protected onBeforeDown(e: PointerEvent): void;
    protected onTap(e: PointerEvent): void;
    protected checkAndSelect(e: PointerEvent): void;
    protected onDragStart(e: DragEvent): void;
    protected onDrag(e: DragEvent): void;
    protected onDragEnd(e: DragEvent): void;
    protected onAutoMove(e: MoveEvent): void;
    protected allow(target: ILeaf): boolean;
    protected allowDrag(e: DragEvent): boolean;
    protected allowSelect(e: IPointerEvent): boolean;
    findDeepOne(e: PointerEvent): IUI;
    findUI(e: PointerEvent): IUI;
    isMultipleSelect(e: IPointerEvent): boolean;
    protected __listenEvents(): void;
    protected __removeListenEvents(): void;
    destroy(): void;
}

declare class EditMask extends UI {
    editor: IEditor;
    constructor(editor: IEditor);
    __updateWorldBounds(): void;
    __draw(canvas: ILeaferCanvas, options: IRenderOptions): void;
    destroy(): void;
}

declare class Editor extends Group implements IEditor {
    config: IEditorConfig;
    readonly mergeConfig: IEditorConfig;
    readonly mergedConfig: IEditorConfig;
    hoverTarget?: IUI;
    target?: IUI | IUI[];
    leafList: ILeafList;
    get list(): IUI[];
    get dragHoverExclude(): IUI[];
    openedGroupList: ILeafList;
    get editing(): boolean;
    innerEditing: boolean;
    get groupOpening(): boolean;
    resizeDirection?: Direction9;
    get multiple(): boolean;
    get single(): boolean;
    get dragging(): boolean;
    get moving(): boolean;
    get dragPoint(): IEditPoint;
    get element(): ISimulateElement;
    simulateTarget: ISimulateElement;
    editBox: IEditBox;
    get buttons(): IGroup;
    editTool?: IEditTool;
    innerEditor?: IInnerEditor;
    editToolList: IObject;
    selector: EditSelect;
    editMask: EditMask;
    targetChanged: boolean;
    targetEventIds: IEventListenerId[];
    constructor(userConfig?: IEditorConfig, data?: IGroupInputData);
    select(target: IUI | IUI[]): void;
    cancel(): void;
    hasItem(item: IUI): boolean;
    addItem(item: IUI): void;
    removeItem(item: IUI): void;
    shiftItem(item: IUI): void;
    update(): void;
    updateEditBox(): void;
    updateEditTool(): void;
    getEditSize(_ui: IUI): IEditSize;
    onMove(e: DragEvent | MoveEvent): void;
    onScale(e: DragEvent | ZoomEvent): void;
    onRotate(e: DragEvent | RotateEvent): void;
    onSkew(e: DragEvent): void;
    move(x: number | IPointData, y?: number): void;
    scaleWithDrag(data: IEditorScaleEvent): void;
    scaleOf(origin: IPointData | IAlign, scaleX: number, scaleY?: number, _resize?: boolean): void;
    flip(axis: IAxis): void;
    rotateOf(origin: IPointData | IAlign, rotation: number): void;
    skewOf(origin: IPointData | IAlign, skewX: number, skewY?: number, _resize?: boolean): void;
    checkTransform(type: 'moveable' | 'resizeable' | 'rotateable' | 'skewable'): boolean;
    protected getWorldOrigin(origin: IPointData | IAlign): IPointData;
    protected getChangedTransform(func: IFunction): IMatrix;
    group(userGroup?: IGroup | IGroupInputData): IGroup;
    ungroup(): IUI[];
    openGroup(group: IGroup): void;
    closeGroup(group: IGroup): void;
    checkOpenedGroups(): void;
    checkDeepSelect(): void;
    emitGroupEvent(type: string, group?: IGroup): void;
    openInnerEditor(target?: IUI, select?: boolean): void;
    closeInnerEditor(): void;
    emitInnerEvent(type: string): void;
    lock(): void;
    unlock(): void;
    toTop(): void;
    toBottom(): void;
    protected onAppRenderStart(app: IApp): void;
    protected onRenderStart(): void;
    protected onKey(e: KeyEvent): void;
    listenTargetEvents(): void;
    removeTargetEvents(): void;
    destroy(): void;
}

declare class EditorEvent extends Event implements IEditorEvent {
    static BEFORE_SELECT: string;
    static SELECT: string;
    static BEFORE_HOVER: string;
    static HOVER: string;
    readonly target: IUI;
    readonly editor: IEditor;
    readonly value: IUI | IUI[];
    readonly oldValue: IUI | IUI[];
    get list(): IUI[];
    get oldList(): IUI[];
    readonly worldOrigin: IPointData;
    readonly origin: IPointData;
    constructor(type: string, data?: IEditorEvent);
}

declare class EditBox extends Group implements IEditBox {
    editor: IEditor;
    dragging: boolean;
    moving: boolean;
    view: IGroup;
    rect: IBox;
    circle: IEditPoint;
    buttons: IGroup;
    resizePoints: IEditPoint[];
    rotatePoints: IEditPoint[];
    resizeLines: IEditPoint[];
    enterPoint: IEditPoint;
    dragPoint: IEditPoint;
    dragStartData: IEditorDragStartData;
    get flipped(): boolean;
    get flippedX(): boolean;
    get flippedY(): boolean;
    get flippedOne(): boolean;
    protected __eventIds: IEventListenerId[];
    constructor(editor: IEditor);
    create(): void;
    load(): void;
    update(bounds: IBoundsData): void;
    protected layoutCircle(config: IEditorConfig$1): void;
    protected layoutButtons(config: IEditorConfig$1): void;
    protected setButtonPosition(buttons: IUI, direction: number, buttonsMargin: number, useMiddlePoint: boolean): void;
    unload(): void;
    getPointStyle(userStyle?: IBoxInputData): IBoxInputData;
    getPointsStyle(): IBoxInputData[];
    getMiddlePointsStyle(): IBoxInputData[];
    protected onSelect(e: EditorEvent): void;
    protected onDragStart(e: DragEvent): void;
    protected onDragEnd(e: DragEvent): void;
    protected onDrag(e: DragEvent): void;
    onArrow(e: IKeyEvent): void;
    protected onDoubleTap(e: PointerEvent): void;
    protected onLongPress(e: PointerEvent): void;
    protected openInner(e: PointerEvent): void;
    listenPointEvents(point: IEditPoint, type: IEditPointType, direction: Direction9): void;
    protected __listenEvents(): void;
    protected __removeListenEvents(): void;
    destroy(): void;
}

declare class EditPoint extends Box implements IEditPoint {
    direction: Direction9;
    pointType: IEditPointType;
}

declare class SelectArea extends Group implements ISelectArea {
    protected strokeArea: IRect;
    protected fillArea: IRect;
    constructor(data?: IGroupInputData);
    setStyle(style: IRectInputData, userStyle?: IRectInputData): void;
    setBounds(bounds: IBoundsData): void;
}

declare class Stroker extends UI implements IStroker {
    target: IUI | IUI[];
    list: IUI[];
    constructor();
    setTarget(target: IUI | IUI[], style: IRectInputData): void;
    update(): void;
    __draw(canvas: ILeaferCanvas, options: IRenderOptions): void;
    destroy(): void;
}

declare class EditorMoveEvent extends EditorEvent implements IEditorMoveEvent {
    static BEFORE_MOVE: string;
    static MOVE: string;
    readonly moveX: number;
    readonly moveY: number;
    constructor(type: string, data?: IEditorMoveEvent);
}

declare class EditorScaleEvent extends EditorEvent implements IEditorScaleEvent {
    static BEFORE_SCALE: string;
    static SCALE: string;
    readonly scaleX: number;
    readonly scaleY: number;
    readonly transform?: IMatrixData;
    readonly drag: IDragEvent;
    readonly direction: Direction9;
    readonly lockRatio: boolean;
    readonly around: IAround;
    constructor(type: string, data?: IEditorScaleEvent);
}

declare class EditorRotateEvent extends EditorEvent implements IEditorRotateEvent {
    static BEFORE_ROTATE: string;
    static ROTATE: string;
    readonly rotation: number;
    constructor(type: string, data?: IEditorRotateEvent);
}

declare class EditorSkewEvent extends EditorEvent implements IEditorSkewEvent {
    static BEFORE_SKEW: string;
    static SKEW: string;
    readonly skewX: number;
    readonly skewY: number;
    constructor(type: string, data?: IEditorSkewEvent);
}

declare class EditorGroupEvent extends EditorEvent implements IEditorGroupEvent {
    static BEFORE_GROUP: string;
    static GROUP: string;
    static BEFORE_UNGROUP: string;
    static UNGROUP: string;
    static BEFORE_OPEN: string;
    static OPEN: string;
    static BEFORE_CLOSE: string;
    static CLOSE: string;
    readonly editTarget: IGroup;
    constructor(type: string, data?: IEditorGroupEvent);
}

declare class InnerEditorEvent extends EditorEvent implements IInnerEditorEvent {
    static BEFORE_OPEN: string;
    static OPEN: string;
    static BEFORE_CLOSE: string;
    static CLOSE: string;
    readonly editTarget: IUI;
    readonly innerEditor: IInnerEditor;
    constructor(type: string, data?: IInnerEditorEvent);
}

declare function registerEditTool(): (target: IObject) => void;
declare const registerInnerEditor: typeof registerEditTool;
declare const EditToolCreator: {
    list: IObject;
    register(EditTool: IObject): void;
    get(tag: string, editor: IEditor): IEditTool;
};

declare class InnerEditor implements IInnerEditor {
    static registerInnerEditor(): void;
    get tag(): string;
    editTarget: IUI;
    config: IObject;
    editor: IEditor;
    get editBox(): IEditBox;
    view: IGroup;
    eventIds: IEventListenerId[];
    constructor(editor: IEditor);
    onCreate(): void;
    create(): void;
    onLoad(): void;
    load(): void;
    onUpdate(): void;
    update(): void;
    onUnload(): void;
    unload(): void;
    onDestroy(): void;
    destroy(): void;
}

declare class EditTool extends InnerEditor implements IEditTool {
    static registerEditTool(): void;
    get tag(): string;
    onMove(e: IEditorMoveEvent): void;
    onScale(e: IEditorScaleEvent): void;
    onRotate(e: IEditorRotateEvent): void;
    onSkew(e: IEditorSkewEvent): void;
    load(): void;
    update(): void;
    unload(): void;
}

declare class LineEditTool extends EditTool {
    get tag(): string;
    scaleOfEvent: boolean;
    onScaleWithDrag(e: IEditorScaleEvent): void;
    getInnerMove(ui: IUI$1, event: IDragEvent$1, lockRatio: boolean | 'corner'): IPointData$1;
    getFromToByPath(path: IPathCommandData): IFromToData;
    getFromToByPoints(originPoints: number[] | IPointData$1[]): IFromToData;
    dragPoint(fromPoint: IPointData$1, toPoint: IPointData$1, isDragFrom: boolean, around: IAround$1, movePoint: IPointData$1): void;
    onSkew(_e: IEditorSkewEvent): void;
    onUpdate(): void;
}

declare const EditorHelper: {
    group(list: IUI[], element?: IUI, userGroup?: IGroup | IGroupInputData): IGroup;
    ungroup(list: IUI[]): IUI[];
    toTop(list: IUI[]): void;
    toBottom(list: IUI[]): void;
};

declare const EditDataHelper: {
    getScaleData(element: IUI, startBounds: ILayoutBoundsData, direction: Direction9, totalMove: IPointData, lockRatio: boolean | "corner", around: IAround, flipable: boolean, scaleMode: boolean): IEditorScaleEvent;
    getRotateData(bounds: IBoundsData, direction: Direction9, current: IPointData, last: IPointData, around: IAround): IEditorRotateEvent;
    getSkewData(bounds: IBoundsData, direction: Direction9, move: IPointData, around: IAround): IEditorSkewEvent;
    getAround(around: IAround, altKey: boolean): IAround;
    getRotateDirection(direction: number, rotation: number, totalDirection?: number): number;
    getFlipDirection(direction: Direction9, flipedX: boolean, flipedY: boolean): Direction9;
};

declare const EditSelectHelper: {
    findOne(path: ILeafList): IUI;
    findByBounds(branch: IUI, bounds: IBounds): IUI[];
};

export { EditBox, EditDataHelper, EditPoint, EditSelect, EditSelectHelper, EditTool, EditToolCreator, Editor, EditorEvent, EditorGroupEvent, EditorHelper, EditorMoveEvent, EditorRotateEvent, EditorScaleEvent, EditorSkewEvent, InnerEditor, InnerEditorEvent, LineEditTool, SelectArea, Stroker, registerEditTool, registerInnerEditor };
