import { isMac } from '../../client.js';
import { extractCode } from './extractCode.js';
import { KeyboardEventCodes as Codes } from './KeyboardEventCodes.js';
export var isShortcutCopy = function (e) {
    return ((isMac ? e.metaKey : e.ctrlKey) && extractCode(e) === Codes.KeyC) ||
        (!isMac && e.ctrlKey && isKeyInsert(e)) ||
        e.key === 'Copy';
};
export var isShortcutPaste = function (e) {
    return ((isMac ? e.metaKey : e.ctrlKey) && extractCode(e) === Codes.KeyV) ||
        (!isMac && e.shiftKey && isKeyInsert(e)) ||
        e.key === 'Paste';
};
export var isShortcutCut = function (e) {
    return ((isMac ? e.metaKey : e.ctrlKey) && extractCode(e) === Codes.KeyX) ||
        (!isMac && e.shiftKey && isKeyDelete(e)) ||
        e.key === 'Cut';
};
export var isShortcutSelectAll = function (e) { return (isMac ? e.metaKey : e.ctrlKey) && extractCode(e) === Codes.KeyA; };
export var isShortcutJumpCaret = function (e) { return (isMac ? e.altKey : e.ctrlKey) && isKeyArrowHorizontal(e); };
export var isKeyEscape = function (e) { return e.key === 'Escape' || e.key === 'Esc'; };
export var isKeyHome = function (e) { return e.key === 'Home'; };
export var isKeyEnd = function (e) { return e.key === 'End'; };
export var isKeyMeta = function (e) { return e.key === 'Meta' || e.key === 'Win'; };
export var isKeyControl = function (e) { return e.key === 'Control'; };
export var isKeyShift = function (e) { return e.key === 'Shift'; };
export var isKeyAlt = function (e) { return e.key === 'Alt'; };
export var isKeyDelete = function (e) { return e.key === 'Delete' || e.key === 'Del'; };
export var isKeyBackspace = function (e) { return e.key === 'Backspace'; };
export var isKeyCapsLock = function (e) { return e.key === 'CapsLock'; };
export var isKeyInsert = function (e) { return e.key === 'Insert'; };
export var isKeyTab = function (e) { return e.key === 'Tab'; };
export var isKeyEnter = function (e) { return e.key === 'Enter'; };
export var isKeyArrowUp = function (e) { return e.key === 'ArrowUp' || e.key === 'Up'; };
export var isKeyArrowRight = function (e) { return e.key === 'ArrowRight' || e.key === 'Right'; };
export var isKeyArrowDown = function (e) { return e.key === 'ArrowDown' || e.key === 'Down'; };
export var isKeyArrowLeft = function (e) { return e.key === 'ArrowLeft' || e.key === 'Left'; };
export var isKeySpace = function (e) { return e.key === ' ' || e.key === 'Spacebar'; };
export var isKeyComma = function (e) { return e.key === ','; };
export var isCodeMinus = function (e) { return extractCode(e) === Codes.Minus; };
export var isCodeNumpadDecimal = function (e) { return extractCode(e) === Codes.NumpadDecimal; };
export var isCodeNumpadDivide = function (e) { return extractCode(e) === Codes.NumpadDivide; };
export var isCodeNumpadSubtract = function (e) { return extractCode(e) === Codes.NumpadSubtract; };
export var isCodeSlash = function (e) { return extractCode(e) === Codes.Slash; };
export var isCodeBackslash = function (e) { return extractCode(e) === Codes.Backslash; };
export var isCodeIntlBackslash = function (e) { return extractCode(e) === Codes.IntlBackslash; };
export var isCodeComma = function (e) { return extractCode(e) === Codes.Comma; };
export var isCodePeriod = function (e) { return extractCode(e) === Codes.Period; };
export var isKeyArrowHorizontal = function (e) { return isKeyArrowRight(e) || isKeyArrowLeft(e); };
export var isKeyArrowVertical = function (e) { return isKeyArrowUp(e) || isKeyArrowDown(e); };
export var isKeyArrow = function (e) { return isKeyArrowHorizontal(e) || isKeyArrowVertical(e); };
export var isKeyNumber = function (e) { return /^\d+$/.test(e.key); };
export var isKeyChar = function (e) { return e.key.trim().length === 1; };
export var isKeyFs = function (e) { return /^(?:F[1-9]|F1[0-2]|Soft[1-4])$/.test(e.key); };
export var isModified = function (is) { return function (e) {
    return (e.shiftKey || e.metaKey || e.ctrlKey || e.altKey) && (is ? is(e) : true);
}; };
export var isUnmodified = function (is) { return function (e) { return !isModified()(e) && (is ? is(e) : true); }; };
export var isModShift = function (is) { return function (e) { return e.shiftKey && (is ? is(e) : true); }; };
export var isModCtrl = function (is) { return function (e) { return e.ctrlKey && (is ? is(e) : true); }; };
export var isModAlt = function (is) { return function (e) { return e.altKey && (is ? is(e) : true); }; };
export var someKeys = function () {
    var iss = [];
    for (var _i = 0; _i < arguments.length; _i++) {
        iss[_i] = arguments[_i];
    }
    return function (e) {
        return iss.some(function (is) { return is(e); });
    };
};
//# sourceMappingURL=identifiers.js.map