import { IHydratedController } from '@aurelia/runtime-html';
import { ICustomElementViewModel } from 'aurelia';

/** Disclaimer: inspired by https://github.com/koca/vue-prism-editor/ */

interface Record {
    value: string;
    selectionStart: number;
    selectionEnd: number;
}
interface History {
    stack: Array<Record & {
        timestamp: number;
    }>;
    offset: number;
}
/**
 * Prism Editor
 */
declare class PrismEditor implements ICustomElementViewModel {
    private readonly _element;
    private static readonly _KEY_ENTER;
    private static readonly _KEY_TAB;
    private static readonly _KEY_BACKSPACE;
    private static readonly _KEY_Y;
    private static readonly _KEY_Z;
    private static readonly _KEY_M;
    private static readonly _KEY_PARENS;
    private static readonly _KEY_BRACKETS;
    private static readonly _KEY_QUOTE;
    private static readonly _KEY_BACK_QUOTE;
    private static readonly _KEY_ESCAPE;
    private static readonly _HISTORY_LIMIT;
    private static readonly _HISTORY_TIME_GAP;
    preRef?: HTMLPreElement;
    textAreaRef?: HTMLTextAreaElement;
    measureRef?: HTMLPreElement;
    private _boundedKeydown?;
    private observer;
    constructor(_element: HTMLElement);
    lineNumbers: boolean;
    lineNumbersChanged(): void;
    lineIndexWraps: {
        idx: number;
        wrap: number;
    }[];
    readonly: boolean;
    code: string;
    highlight?: () => string;
    tabSize: number;
    insertSpaces: boolean;
    ignoreTabKey: boolean;
    placeholder: string;
    contentChanged(): void;
    get isEmpty(): boolean;
    generateContent(): string;
    get lineNumbersCount(): number;
    capture: boolean;
    history: History;
    lineNumbersHeight: string;
    bound(initiator: IHydratedController, parent: IHydratedController): void | Promise<void>;
    attached(initiator: IHydratedController): void | Promise<void>;
    detaching(initiator: IHydratedController, parent: IHydratedController): void | Promise<void>;
    setLineNumbersHeight(): void;
    setLineNumbersWrap(): void;
    private _getLines;
    private _applyEdits;
    private _recordChange;
    private _updateInput;
    codeChanged(newValue: string, oldValue: string): void;
    /** Undo */
    undo(): void;
    /** Redo */
    private redo;
    handleKeyDown(e: KeyboardEvent): boolean | void;
    $emit(evName: string, params: any): void;
}

/**
 * CodeMirror
 */
declare class PrismView implements ICustomElementViewModel {
    private readonly _element;
    codeArea?: HTMLElement;
    /** Code */
    code?: string;
    language: string;
    lineNumbers: boolean;
    constructor(_element: HTMLElement);
    attached(initiator: IHydratedController): void | Promise<void>;
    codeChanged(newValue: string, oldValue: string): void;
}

export { PrismEditor, PrismView };
