"use strict";exports.__esModule = true;exports.extractCode = extractCode;

var _KeyboardEventCodes = require("./KeyboardEventCodes");

var _KeyboardMapKeys = require("./KeyboardMapKeys");

function extractCode(e) {
  var event = e.nativeEvent || e;
  if (event.code) {
    return event.code;
  }

  var keyCode = event.keyCode || event.which;
  var location = event.location;
  var mapped = Object.entries(_KeyboardMapKeys.KeyboardMapKeys).find(function (_ref) {var set = _ref[1];return (
      set.some(function (_ref2) {var _keyCode = _ref2[0],_location = _ref2[1];return _keyCode === keyCode && _location === location;}));}
  );

  return mapped ? mapped[0] : _KeyboardEventCodes.KeyboardEventCodes.Unidentified;
}