"use strict";
var __assign = (this && this.__assign) || function () {
    __assign = Object.assign || function(t) {
        for (var s, i = 1, n = arguments.length; i < n; i++) {
            s = arguments[i];
            for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
                t[p] = s[p];
        }
        return t;
    };
    return __assign.apply(this, arguments);
};
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
    Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
    o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
    if (mod && mod.__esModule) return mod;
    var result = {};
    if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
    __setModuleDefault(result, mod);
    return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
var React = __importStar(require("react"));
var react_router_dom_1 = require("react-router-dom");
var free_solid_svg_icons_1 = require("@fortawesome/free-solid-svg-icons");
var react_fontawesome_1 = require("@fortawesome/react-fontawesome");
var HeaderDesktopMenuBar = function (props) {
    return (React.createElement("div", { className: "ds-header-bottom" },
        React.createElement("div", { className: "width-max" },
            React.createElement("div", { className: "ds-menu" }, props.menu.map(function (item) { return (React.createElement("span", { key: item.route },
                !item.subMenu && React.createElement(Menu, __assign({}, item)),
                !!item.subMenu && React.createElement(SubMenu, __assign({}, item)))); })))));
};
var Menu = function (props) {
    return (React.createElement(react_router_dom_1.NavLink, { className: "ds-menu-item", activeClassName: "ds-menu-item-active", to: { pathname: props.route }, exact: true }, props.title));
};
var SubMenu = function (props) {
    var isSubRoute = function (location, subMenu) {
        return !subMenu.every(function (item) { return item.route !== location.pathname; });
    };
    return (React.createElement("div", { className: "ds-menu-category " + (!props.opened || 'hover') },
        React.createElement(react_router_dom_1.NavLink, { key: props.route, className: "ds-menu-item " + (!props.opened || 'hover'), activeClassName: "ds-menu-item-active", to: {
                pathname: props.route,
            }, onClick: function (e) { return e.preventDefault(); }, isActive: function (match, location) { return isSubRoute(location, props.subMenu); } },
            props.title,
            " ",
            React.createElement(react_fontawesome_1.FontAwesomeIcon, { icon: free_solid_svg_icons_1.faChevronDown, flip: "horizontal" })),
        React.createElement("div", { className: "ds-menu-subcategory" }, props.subMenu.map(function (subItem, i) { return (React.createElement(react_router_dom_1.NavLink, { key: subItem.route, className: "ds-item", activeClassName: "active", to: {
                pathname: subItem.route,
            }, exact: true }, subItem.title)); }))));
};
exports.default = HeaderDesktopMenuBar;
//# sourceMappingURL=header--deskop-menu-bar.js.map