"use strict";

exports.__esModule = true;
exports.default = exports.MenuToggle = exports.Logo = exports.EnhancedMenuItem = void 0;
var _react = _interopRequireDefault(require("react"));
var _reactRedux = require("react-redux");
var _styles = require("@material-ui/core/styles");
var _reactRouterDom = require("react-router-dom");
var _navigation = require("../../selectors/navigation");
var _MenuItem = _interopRequireDefault(require("./MenuItem"));
var _modules = require("../../selectors/modules");
var _excluded = ["id"];
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
(function () {
  var enterModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.enterModule : undefined;
  enterModule && enterModule(module);
})();
(function () {
  var enterModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.enterModule : undefined;
  enterModule && enterModule(module);
})();
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var s = Object.getOwnPropertySymbols(e); for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.includes(n)) continue; t[n] = r[n]; } return t; }
var __signature__ = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default.signature : function (a) {
  return a;
};
var __signature__ = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default.signature : function (a) {
  return a;
};
var useStyles = (0, _styles.makeStyles)(function (theme) {
  return {
    bar: {
      boxSizing: "border-box",
      paddingTop: "60px",
      height: "calc(100% - 40px)",
      width: "200px",
      display: "flex",
      flexDirection: "column",
      justifyContent: "flex-start",
      color: theme.palette.text.hint
    },
    logoSvg: {
      flex: "0 0 auto",
      margin: "auto 12.5px 7px",
      height: "25px",
      width: "25px",
      fillRule: "evenodd",
      clipRule: "evenodd",
      fill: "#666666"
    }
  };
});
var MenuToggle = exports.MenuToggle = function MenuToggle(_ref) {
  var open = _ref.open,
    toggle = _ref.toggle;
  return /*#__PURE__*/_react.default.createElement(_MenuItem.default, {
    id: "sidebarMenuToggle",
    menuToggle: true,
    open: open,
    icon: open ? "collapse" : "expand",
    onClick: toggle
  });
};
var useEnhancement = function useEnhancement(id) {
  var location = (0, _reactRouterDom.useLocation)();
  var prependHref = (0, _reactRedux.useSelector)(_navigation.selectPrependHrefConfig)(id);
  return {
    href: "".concat(prependHref).concat(id),
    active: location.pathname.startsWith("".concat(prependHref).concat(id)),
    id: id
  };
};
__signature__(useEnhancement, "useLocation{location}\nuseSelector{}", function () {
  return [_reactRouterDom.useLocation, _reactRedux.useSelector];
});
__signature__(useEnhancement, "useLocation{location}\nuseSelector{}", function () {
  return [_reactRouterDom.useLocation, _reactRedux.useSelector];
});
var EnhancedMenuItem = exports.EnhancedMenuItem = function EnhancedMenuItem(_ref2) {
  var id = _ref2.id,
    props = _objectWithoutProperties(_ref2, _excluded);
  var defaultModule = (0, _reactRedux.useSelector)(_modules.getScopeModuleInformationSelector);
  var isHidden = !defaultModule.visibleModules.includes(id);
  return /*#__PURE__*/_react.default.createElement(_MenuItem.default, _extends({}, props, useEnhancement(id), {
    isHidden: isHidden
  }));
};
__signature__(EnhancedMenuItem, "useSelector{defaultModule}\nuseEnhancement{}", function () {
  return [_reactRedux.useSelector, useEnhancement];
});
__signature__(EnhancedMenuItem, "useSelector{defaultModule}\nuseEnhancement{}", function () {
  return [_reactRedux.useSelector, useEnhancement];
});
var Logo = exports.Logo = function Logo() {
  var classes = useStyles();
  return /*#__PURE__*/_react.default.createElement("svg", {
    viewBox: "0 0 354 354",
    className: classes.logoSvg
  }, /*#__PURE__*/_react.default.createElement("g", null, /*#__PURE__*/_react.default.createElement("path", {
    d: "M0 241.41c0-65.49 50.53-111.98 119.66-111.98s119.25 46.49 119.25 111.98c0 65.49-50.13 111.97-119.25 111.97S0 306.9 0 241.41Zm175.04 0c0-37.6-23.85-60.23-55.38-60.23s-55.79 22.64-55.79 60.23c0 37.59 24.26 60.23 55.79 60.23 31.53 0 55.38-22.64 55.38-60.23Zm178.1-76.35h-77.48c0-48.29-39.29-87.58-87.58-87.58V0c91.02 0 165.07 74.05 165.07 165.06h-.01Z"
  })));
};
__signature__(Logo, "useStyles{classes}", function () {
  return [useStyles];
});
__signature__(Logo, "useStyles{classes}", function () {
  return [useStyles];
});
var Sidebar = function Sidebar(_ref3) {
  var open = _ref3.open,
    toggle = _ref3.toggle,
    _ref3$modules = _ref3.modules,
    modules = _ref3$modules === void 0 ? [] : _ref3$modules,
    _ref3$activeModules = _ref3.activeModules,
    activeModules = _ref3$activeModules === void 0 ? [] : _ref3$activeModules;
  var classes = useStyles();
  return /*#__PURE__*/_react.default.createElement("div", {
    open: open,
    className: classes.bar
  }, /*#__PURE__*/_react.default.createElement(MenuToggle, {
    open: open,
    toggle: toggle
  }), modules.map(function (item) {
    return /*#__PURE__*/_react.default.createElement(EnhancedMenuItem, _extends({
      key: item.id,
      title: item.label
    }, item, {
      open: open,
      alert: activeModules[item.id] || false
    }));
  }), /*#__PURE__*/_react.default.createElement(Logo, null));
};
__signature__(Sidebar, "useStyles{classes}", function () {
  return [useStyles];
});
__signature__(Sidebar, "useStyles{classes}", function () {
  return [useStyles];
});
var _default = Sidebar;
var _default2 = _default;
var _default3 = exports.default = _default2;
;
(function () {
  var reactHotLoader = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default : undefined;
  if (!reactHotLoader) {
    return;
  }
  reactHotLoader.register(useStyles, "useStyles", "/home/vsts/work/1/s/src/components/AppFrame/Sidebar.js");
  reactHotLoader.register(MenuToggle, "MenuToggle", "/home/vsts/work/1/s/src/components/AppFrame/Sidebar.js");
  reactHotLoader.register(useEnhancement, "useEnhancement", "/home/vsts/work/1/s/src/components/AppFrame/Sidebar.js");
  reactHotLoader.register(EnhancedMenuItem, "EnhancedMenuItem", "/home/vsts/work/1/s/src/components/AppFrame/Sidebar.js");
  reactHotLoader.register(Logo, "Logo", "/home/vsts/work/1/s/src/components/AppFrame/Sidebar.js");
  reactHotLoader.register(Sidebar, "Sidebar", "/home/vsts/work/1/s/src/components/AppFrame/Sidebar.js");
  reactHotLoader.register(_default, "default", "/home/vsts/work/1/s/src/components/AppFrame/Sidebar.js");
})();
;
(function () {
  var leaveModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.leaveModule : undefined;
  leaveModule && leaveModule(module);
})();
;
(function () {
  var reactHotLoader = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.default : undefined;
  if (!reactHotLoader) {
    return;
  }
  reactHotLoader.register(useStyles, "useStyles", "/home/vsts/work/1/s/src/components/AppFrame/Sidebar.js");
  reactHotLoader.register(MenuToggle, "MenuToggle", "/home/vsts/work/1/s/src/components/AppFrame/Sidebar.js");
  reactHotLoader.register(useEnhancement, "useEnhancement", "/home/vsts/work/1/s/src/components/AppFrame/Sidebar.js");
  reactHotLoader.register(EnhancedMenuItem, "EnhancedMenuItem", "/home/vsts/work/1/s/src/components/AppFrame/Sidebar.js");
  reactHotLoader.register(Logo, "Logo", "/home/vsts/work/1/s/src/components/AppFrame/Sidebar.js");
  reactHotLoader.register(Sidebar, "Sidebar", "/home/vsts/work/1/s/src/components/AppFrame/Sidebar.js");
  reactHotLoader.register(_default2, "default", "/home/vsts/work/1/s/src/components/AppFrame/Sidebar.js");
})();
;
(function () {
  var leaveModule = typeof reactHotLoaderGlobal !== 'undefined' ? reactHotLoaderGlobal.leaveModule : undefined;
  leaveModule && leaveModule(module);
})();