define(["exports", "core/ui", "core/l10n", "deps/hyperhtml"], function (exports, _ui, _l10n) {
  "use strict";

  Object.defineProperty(exports, "__esModule", {
    value: true
  });
  exports.show = undefined;

  var _templateObject = _taggedTemplateLiteral(["\n        <li>\n          <a href=\"", "\">\n            ", "\n          </a>\n        </li>\n      "], ["\n        <li>\n          <a href=\"", "\">\n            ", "\n          </a>\n        </li>\n      "]),
      _templateObject2 = _taggedTemplateLiteral(["", ""], ["", ""]);

  function _taggedTemplateLiteral(strings, raw) {
    return Object.freeze(Object.defineProperties(strings, {
      raw: {
        value: Object.freeze(raw)
      }
    }));
  }

  var _slicedToArray = function () {
    function sliceIterator(arr, i) {
      var _arr = [];
      var _n = true;
      var _d = false;
      var _e = undefined;

      try {
        for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
          _arr.push(_s.value);

          if (i && _arr.length === i) break;
        }
      } catch (err) {
        _d = true;
        _e = err;
      } finally {
        try {
          if (!_n && _i["return"]) _i["return"]();
        } finally {
          if (_d) throw _e;
        }
      }

      return _arr;
    }

    return function (arr, i) {
      if (Array.isArray(arr)) {
        return arr;
      } else if (Symbol.iterator in Object(arr)) {
        return sliceIterator(arr, i);
      } else {
        throw new TypeError("Invalid attempt to destructure non-iterable instance");
      }
    };
  }();

  var button = _ui.ui.addCommand(_l10n.l10n[_l10n.lang].definition_list, "ui/dfn-list", "Ctrl+Shift+Alt+D", "📔");

  var ul = document.createElement("ul");
  ul.classList.add("respec-dfn-list");
  var render = window.hyperHTML.bind(ul);

  ul.addEventListener("click", function (ev) {
    _ui.ui.closeModal();
    ev.stopPropagation();
  });

  function show() {
    var definitionLinks = Object.entries(respecConfig.definitionMap).sort(function (_ref, _ref2) {
      var _ref4 = _slicedToArray(_ref, 1),
          a = _ref4[0];

      var _ref3 = _slicedToArray(_ref2, 1),
          b = _ref3[0];

      return a.localeCompare(b);
    }).map(function (_ref5) {
      var _ref6 = _slicedToArray(_ref5, 2),
          key = _ref6[0],
          $dfn = _ref6[1];

      var dfn = $dfn[0];
      return window.hyperHTML.wire(dfn, ":li>a")(_templateObject, "#" + dfn.id, key);
    });
    render(_templateObject2, definitionLinks);
    _ui.ui.freshModal(_l10n.l10n[_l10n.lang].list_of_definitions, ul, button);
  }

  exports.show = show;
});
//# sourceMappingURL=dfn-list.js.map