import { MaskContext } from "./mask-context";
export class MaskKeyboardContext extends MaskContext {
    get key() {
        return this._options.event.key;
    }
    get isCtrlOrCommandKey() {
        return this._options.event.metaKey || this._options.event.ctrlKey;
    }
    get isBackspaceKey() {
        return this._options.event.key === 'Backspace';
    }
    get isTabKey() {
        return this._options.event.key === 'Tab';
    }
    get isWhiteSpaceKey() {
        return this._options.event.key === ' ';
    }
    get isDeleteKey() {
        return this._options.event.key === 'Delete' || this._options.event.key === 'Del';
    }
    get isNumberKey() {
        return MaskKeyboardContext.NUMBER_KEYS.includes(this._options.event.key);
    }
    get isNavigationKey() {
        return MaskKeyboardContext.NAVIGATION_KEYS.includes(this._options.event.key);
    }
    get isSelectAllCommand() {
        return (this._options.event.ctrlKey || this._options.event.metaKey) && this.key === 'a';
    }
    get isCopyCommand() {
        return (this._options.event.ctrlKey || this._options.event.metaKey) && this.key === 'c';
    }
    get isPasteCommand() {
        return (this._options.event.ctrlKey || this._options.event.metaKey) && this.key === 'v';
    }
    getCharAt(position = this.position.value) {
        return this.value.charAt(position);
    }
    getCharAtBackspacePosition() {
        return this.getCharAt(this.position.value - 1);
    }
    setChar(char = this._options.event.key, position = this.position.value) {
        this.value = this.value.substring(0, position) + char + this.value.substring(position + 1);
    }
}
MaskKeyboardContext.NUMBER_KEYS = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'];
MaskKeyboardContext.NAVIGATION_KEYS = [
    'Home',
    'End',
    'ArrowLeft',
    'Left',
    'ArrowRight',
    'Right',
    'Tab',
    'Enter',
    'Esc',
    'Escape',
];
