import { Blot } from 'parchment';
import { Range } from 'quill';
import { DeltaStatic, Quill } from 'react-quill-new';
import { TIcons } from '../../AIcon/AIcon';
export type TImageResizerTool = 'left' | 'center' | 'right' | 'justify';
declare const HANDLE_PLACES: readonly ["tl", "tr", "br", "bl"];
declare module 'react-quill-new' {
    interface Quill {
        resizer?: QuillResize;
    }
}
interface SizeProps {
    height?: number | string;
    width?: number | string;
}
interface SizeLimit {
    maxHeight?: number;
    maxWidth?: number;
    minHeight?: number;
    minWidth?: number;
    ratio?: number;
    unit?: boolean;
}
type ContentOption = {
    attribute: string[];
    blotName: string;
    limit: SizeLimit;
};
export interface DefaultOptionsType {
    contentOptions: ContentOption[];
    embedTags: string[];
    modules: string[];
    tools: TImageResizerTool[];
}
declare class BaseModule {
    protected resizer: QuillResize;
    protected quill: Quill;
    protected overlay?: HTMLElement;
    protected activeEle?: HTMLElement;
    protected blot?: Blot;
    protected options: DefaultOptionsType;
    protected requestUpdate: () => void;
    constructor(resizer: QuillResize);
    onCreate(): void;
    onDestroy(): void;
    onUpdate(): void;
}
declare class DisplaySize extends BaseModule {
    display?: HTMLElement;
    onCreate(): void;
    onUpdate(): void;
    private positionDisplay;
}
declare class Resize extends BaseModule {
    boxes: HTMLElement[];
    dragBox: HTMLElement | null;
    dragStartX: number;
    dragStartY: number;
    contentOption?: ContentOption;
    preDragSize: {
        width: number;
        height: number;
    };
    naturalSize: number[];
    handleDragProxy: ((evt: MouseEvent) => void) | null;
    handleMouseupProxy: ((evt: MouseEvent) => void) | null;
    private dragAnimationFrame;
    private pendingDragEvent;
    onCreate(): void;
    onDestroy(): void;
    addBox(place: (typeof HANDLE_PLACES)[number]): void;
    handleMousedown: (evt: MouseEvent) => void;
    handleMouseup: (evt: MouseEvent) => void;
    removeEventListeners(): void;
    handleDrag: (evt: MouseEvent) => void;
    calcSize(evt: MouseEvent, limit?: {}): SizeProps;
    private constrainDimensionsWithRatio;
    applyConstraints(size: SizeProps, limit?: SizeLimit): SizeProps;
    applyLimit(value: number, min?: number, max?: number): number;
    getNaturalSize(): number[];
    setCursor(value: string): void;
    private cancelDragFrame;
    handleDoubleClick: (evt: MouseEvent) => void;
}
declare class Keyboard extends BaseModule {
    private readonly keyboardProxy;
    static readonly keys: {
        BACKSPACE: number;
        DELETE: number;
        LEFT: number;
        UP: number;
        RIGHT: number;
        DOWN: number;
    };
    private static readonly injectedQuills;
    static injectInit(quill: Quill): void;
    static makeArrowHandler(key: number): {
        [x: string]: number | boolean | RegExp | ((this: {
            quill: Quill;
        }, range: {
            index: number;
            length: number;
        }) => boolean) | null;
        key: number;
        shiftKey: boolean;
        altKey: null;
        handler(this: {
            quill: Quill;
        }, range: {
            index: number;
            length: number;
        }): boolean;
    };
    onCreate(): void;
    onDestroy(): void;
    keyboardHandle(evt: KeyboardEvent): void;
    handleDelete(): void;
    handleArrowKeys(code: number, index: number): [number, Blot | null];
    getOtherLineIndex(dir: number): number;
}
declare class Toolbar extends BaseModule {
    toolbar?: HTMLElement;
    protected blot?: Blot;
    private readonly tools;
    private readonly toolbarClickProxy;
    constructor(resizer: QuillResize);
    createStyleTool(icon: TIcons, style: string): {
        icon: "ArrowDown" | "ArrowUp" | "Chat" | "Check.Checked" | "Check.Indeterminate" | "Check.UnChecked" | "CircleCheck" | "FolderCheck" | "ClipBoard" | "Close" | "Check" | "Document" | "Menu" | "Person" | "PersonOutline" | "Reset" | "Search" | "Send" | "Spinner" | "Pend" | "Stop" | "TriangleAlert" | "TriangleAlert2" | "Sun" | "Moon" | "CCTV" | "Convert" | "KeyboardArrowUp" | "KeyboardArrowDown" | "Alert" | "SortUp" | "SortDown" | "SortBoth" | "RowSortUp" | "RowSortDown" | "RowSortBoth" | "Favorite" | "FavoriteDisabled" | "Main" | "Frame" | "FileDownload" | "FileUpload" | "File" | "File2" | "UnPlug" | "CloudSync" | "CalendarDay" | "DateRange" | "PlayArrow" | "Mail" | "MailOutline" | "Bell" | "Download" | "Folder" | "FolderPost" | "FolderOpen" | "FolderCopy" | "FolderAdd" | "FolderMove" | "FirstPage" | "LastPage" | "NavigateBefore" | "NavigateNext" | "ListAdd" | "ListRemove" | "Cancel" | "Article" | "Info" | "Type" | "PersonAdd" | "CheckNormal" | "Create" | "PersonRemove" | "Refresh" | "Undo" | "Return" | "Gear" | "TriangleUp" | "TriangleDown" | "CircleHelp" | "Cow" | "CircleAlertOutline" | "CircleAlert" | "Manager" | "ManagerOutline" | "Admin" | "Equalizer" | "ABC" | "Auth" | "AuthAdd" | "Switch" | "Add" | "Edit" | "EditOff" | "Delete" | "Save" | "Remove" | "Sync" | "X" | "MoreVertical" | "MoreHorizontal" | "Verified" | "NonVerified" | "Edit2" | "Trash" | "AddRowBelow" | "AddRowAbove" | "AddColRight" | "AddColLeft" | "RemoveCol" | "RemoveRow" | "Table" | "Minus" | "EditorArrow" | "Target" | "DividerExpand" | "DividerMiddle" | "AlignLeft" | "AlignCenter" | "AlignRight" | "AlignJustify" | "Maximize" | "Minimize";
        apply: (activeEle: HTMLElement) => void;
        isApplied: (activeEle: HTMLElement) => boolean;
    };
    private clearAlignmentStyles;
    static readonly Tools: Record<TImageResizerTool, {
        apply?: (activeEle: HTMLElement) => void;
        handler?: (this: Toolbar, evt: MouseEvent, button: HTMLElement, activeEle: HTMLElement) => boolean | void;
        icon: TIcons;
        isApplied?: (activeEle: HTMLElement) => boolean;
    }>;
    onCreate(): void;
    onDestroy(): void;
    private initializeTools;
    _addToolbarButtons(): void;
    private handleToolbarClick;
}
export default class QuillResize {
    static readonly Modules: {
        Base: typeof BaseModule;
        DisplaySize: typeof DisplaySize;
        Toolbar: typeof Toolbar;
        Resize: typeof Resize;
        Keyboard: typeof Keyboard;
    };
    isDestroyed: boolean;
    quill: Quill;
    options: DefaultOptionsType;
    moduleClasses: string[];
    modules: BaseModule[];
    blot?: Blot;
    selectedBlots: Blot[];
    embedClassName: string;
    activeEle?: HTMLElement;
    overlay?: HTMLElement;
    updateFromModule: boolean;
    hideProxy: ((evt: Event) => void) | null;
    updateOverlayPositionProxy: (() => void) | null;
    embedStyleElement: HTMLStyleElement | null;
    private updateAnimationFrame;
    private overlayScrollAnimationFrame;
    private pendingOverlayMarginTop;
    private scheduledFromModule;
    private previousBodyUserSelect;
    private previousRootUserSelect;
    private readonly handleClickProxy;
    private readonly handleChangeProxy;
    private readonly handleSelectionChangeProxy;
    constructor(quill: Quill, options?: Partial<DefaultOptionsType>);
    destroy(): void;
    initializeModules(): void;
    initializeEmbed(): void;
    scheduleUpdate(fromModule?: boolean): void;
    onUpdate(fromModule?: boolean): void;
    private resolveMediaTarget;
    handleClick(evt: MouseEvent): void;
    getEventTarget(evt: MouseEvent, target: HTMLElement): HTMLElement;
    judgeShow(blot: Blot, target?: HTMLElement | Node): boolean;
    handleChange(_delta: DeltaStatic, _oldDelta: DeltaStatic, source: string): void;
    showOverlay(): void;
    hideOverlay(): void;
    repositionElements(): void;
    addBlotsSelectedClass(range: Range): void;
    hide(): void;
    private scheduleOverlayMarginSync;
}
export {};
