"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var MetaKey;
(function (MetaKey) {
    MetaKey[MetaKey["None"] = 0] = "None";
    MetaKey[MetaKey["Ctrl"] = 1] = "Ctrl";
    MetaKey[MetaKey["Alt"] = 2] = "Alt";
    MetaKey[MetaKey["Shift"] = 3] = "Shift";
    MetaKey[MetaKey["CtrlAlt"] = 4] = "CtrlAlt";
    MetaKey[MetaKey["CtrlShift"] = 5] = "CtrlShift";
    MetaKey[MetaKey["AltShift"] = 6] = "AltShift";
    MetaKey[MetaKey["CtrlAltShift"] = 7] = "CtrlAltShift";
})(MetaKey = exports.MetaKey || (exports.MetaKey = {}));
function reactToKey(e) {
    return {
        meta: meta(e),
        keyCode: e.keyCode
    };
}
exports.reactToKey = reactToKey;
function meta(e) {
    if (!e.ctrlKey && !e.altKey && !e.shiftKey) {
        return MetaKey.None;
    }
    if (e.ctrlKey && e.altKey && e.shiftKey) {
        return MetaKey.CtrlAltShift;
    }
    if (e.ctrlKey && e.altKey) {
        return MetaKey.CtrlAlt;
    }
    if (e.ctrlKey && e.shiftKey) {
        return MetaKey.CtrlShift;
    }
    if (e.ctrlKey) {
        return MetaKey.Ctrl;
    }
    if (e.altKey && e.shiftKey) {
        return MetaKey.AltShift;
    }
    if (e.altKey) {
        return MetaKey.Alt;
    }
    if (e.shiftKey) {
        return MetaKey.Shift;
    }
    return MetaKey.None;
}
exports.meta = meta;
exports.BACKSPACE = 8;
exports.TAB = 9;
exports.ENTER = 13;
exports.CHARACTER_A = 65;
exports.SHIFT = 16;
exports.CONTROL = 17;
exports.ALT = 18;
exports.ESCAPE = 27;
exports.SPACEBAR = 32;
exports.ARROW_LEFT = 37;
exports.ARROW_UP = 38;
exports.ARROW_RIGHT = 39;
exports.ARROW_DOWN = 40;
exports.DELETE = 46;
function isNumeric(event) {
    const keyCode = event.keyCode;
    return !event.altKey && !event.shiftKey && !event.ctrlKey && ((keyCode >= 48 && keyCode <= 57) || (keyCode >= 96 && keyCode <= 105));
}
exports.isNumeric = isNumeric;
function isPrintable(event) {
    const keyCode = event.keyCode;
    return ((!event.altKey &&
        !event.ctrlKey &&
        ((keyCode >= 48 && keyCode <= 90) ||
            (keyCode >= 96 && keyCode <= 105) ||
            (keyCode >= 106 && keyCode <= 111) ||
            (keyCode >= 186 && keyCode <= 222))) ||
        keyCode === exports.SPACEBAR);
}
exports.isPrintable = isPrintable;
function isMetaKey(event) {
    return event.shiftKey || event.altKey || event.ctrlKey;
}
exports.isMetaKey = isMetaKey;
//# sourceMappingURL=Keys.js.map