"use strict";

var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = ClassifyHotkeys;
var _react = _interopRequireDefault(require("react"));
var _common = require("../../utils/common");
function ClassifyHotkeys(_ref) {
  let {
    title,
    shortcutData,
    shortcutDataNames
  } = _ref;
  return /*#__PURE__*/_react.default.createElement("div", {
    className: "sf-editor-classify-hotkeys"
  }, /*#__PURE__*/_react.default.createElement("h5", {
    className: "hotkey-type"
  }, title), /*#__PURE__*/_react.default.createElement("ul", {
    className: "hotkey-list"
  }, Object.keys(shortcutData).map(key => {
    const shortcutName = shortcutDataNames[key];
    let hotkeys = shortcutData[key];
    if (hotkeys.length !== 0) {
      hotkeys = hotkeys.length > 1 && (0, _common.isMac)() ? hotkeys[1] : hotkeys[0];
    }
    return /*#__PURE__*/_react.default.createElement("li", {
      className: "hotkey-shortcuts",
      key: shortcutName
    }, /*#__PURE__*/_react.default.createElement("div", {
      className: "hotkey-shortcuts-left"
    }, shortcutName), /*#__PURE__*/_react.default.createElement("div", {
      className: "hotkey-shortcuts-right"
    }, hotkeys[0] && /*#__PURE__*/_react.default.createElement("div", {
      className: "key hotkey-first"
    }, hotkeys[0]), hotkeys[1] && /*#__PURE__*/_react.default.createElement("div", {
      className: "key hotkey-second"
    }, hotkeys[1])));
  })));
}