/**
 * @fileoverview added by tsickle
 * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
 */
import { Component, Input } from '@angular/core';
import { Router } from '@angular/router';
var NavMenuComponent = /** @class */ (function () {
    function NavMenuComponent(router) {
        this.router = router;
    }
    /**
     * @param {?} item
     * @return {?}
     */
    NavMenuComponent.prototype.isTopVisible = /**
     * @param {?} item
     * @return {?}
     */
    function (item) {
        var _this = this;
        if (item.items === undefined) {
            return false;
        }
        /** @type {?} */
        var result = false;
        item.items.forEach((/**
         * @param {?} x
         * @return {?}
         */
        function (x) {
            if (x.route !== undefined && _this.router.url.indexOf(x.route[0]) > -1) {
                result = true;
                return;
            }
        }));
        if (result) {
            return true;
        }
        if (item.route === undefined) {
            return false;
        }
        return this.isItemActive(item);
    };
    /**
     * @param {?} item
     * @return {?}
     */
    NavMenuComponent.prototype.isItemActive = /**
     * @param {?} item
     * @return {?}
     */
    function (item) {
        if (item.route === undefined) {
            return false;
        }
        /** @type {?} */
        var urlWithoutQuery = this.router.url.split('?')[0];
        return item.highlightForChildren
            ? urlWithoutQuery.startsWith(item.route[0])
            : !item.items && urlWithoutQuery === item.route[0];
    };
    NavMenuComponent.decorators = [
        { type: Component, args: [{
                    selector: 'nav-menu',
                    template: "<ul>\n  <li *ngFor=\"let item of items\">\n    <!--  Top-level item: internal link    -->\n    <a *ngIf=\"item.route && !item.href\" [routerLink]=\"item.route\" class=\"nav-primary-section-link\">\n      <i class=\"ico {{ item.icon }}\"></i>\n      <span>{{ item.label }}</span>\n      <badge *ngIf=\"item.badge\" [tooltipText]=\"item.badge.tooltipText\" [type]=\"item.badge.type\" [className]=\"item.badge.className || 'ml-2'\">{{ item.badge.label }}</badge>\n    </a>\n    <!--  Top-level item: external link    -->\n    <a *ngIf=\"item.href\" href=\"{{ item.href }}\" class=\"nav-primary-section-link\">\n      <i class=\"ico {{ item.icon }}\"></i>\n      <span>{{ item.label }}</span>\n      <badge *ngIf=\"item.badge\" [tooltipText]=\"item.badge.tooltipText\" [type]=\"item.badge.type\" [className]=\"item.badge.className || 'ml-2'\">{{ item.badge.label }}</badge>\n    </a>\n    <!-- Secondary Items -->\n    <ul *ngIf=\"item.items\" class=\"nav-primary-subsection\"\n      [ngClass]=\"{'expanded':isTopVisible(item)}\">\n      <li *ngFor=\"let sub of item.items\" class=\"nav-primary-subsection-item\">\n        <!--    label only    -->\n        <span class=\"nav-primary-label\" *ngIf=\"!sub.route && !sub.href\">\n          {{ sub.label }}\n          <badge *ngIf=\"sub.badge\" [tooltipText]=\"sub.badge.tooltipText\" [type]=\"sub.badge.type\" [className]=\"sub.badge.className || 'ml-2'\">{{ sub.badge.label }}</badge>\n        </span>\n\n        <!--  secondary item: internal link    -->\n        <a *ngIf=\"sub.route && !sub.href\" [routerLink]=\"sub.route\" class=\"nav-primary-subsection-link\"\n          [ngClass]=\"{'active':isItemActive(sub), 'expanded':isTopVisible(sub), 'has-children':sub.items}\">\n          <span>{{ sub.label }}</span>\n          <badge *ngIf=\"sub.badge\" [tooltipText]=\"sub.badge.tooltipText\" [type]=\"sub.badge.type\" [className]=\"sub.badge.className || 'ml-2'\">{{ sub.badge.label }}</badge>\n        </a>\n\n        <!--  secondary item: external link    -->\n        <a *ngIf=\"sub.href\" href=\"{{ sub.href }}\" target=\"{{ sub.target }}\" class=\"nav-primary-subsection-link\"\n          [ngClass]=\"{'active':isItemActive(sub), 'expanded':isTopVisible(sub), 'has-children':sub.items}\">\n          <span>{{ sub.label }}</span>\n          <badge *ngIf=\"sub.badge\" [tooltipText]=\"sub.badge.tooltipText\" [type]=\"sub.badge.type\" [className]=\"sub.badge.className || 'ml-2'\">{{ sub.badge.label }}</badge>\n        </a>\n        <!-- Tertiary Items -->\n        <ul *ngIf=\"sub.items\" class=\"nav-primary-subsection nav-primary-tertiary\" [ngClass]=\"{'expanded':isTopVisible(sub)}\">\n          <li *ngFor=\"let subsub of sub.items\" class=\"nav-primary-tertiary-item\">\n          <!--      tertiary : label      -->\n          <span class=\"nav-primary-label\" *ngIf=\"!subsub.route && !subsub.href\">\n            {{ subsub.label }}\n            <badge *ngIf=\"subsub.badge\" [tooltipText]=\"subsub.badge.tooltipText\" [type]=\"subsub.badge.type\" [className]=\"subsub.badge.className || 'ml-2'\">{{ subsub.badge.label }}</badge>\n          </span>\n            <!--      tertiary : internal link      -->\n            <a *ngIf=\"subsub.route && !subsub.href\" [routerLink]=\"subsub.route\" class=\"nav-primary-tertiary-link\"\n              [ngClass]=\"{'active':isItemActive(subsub)}\">\n              <span>{{ subsub.label }}</span>\n              <badge *ngIf=\"subsub.badge\" [tooltipText]=\"subsub.badge.tooltipText\" [type]=\"subsub.badge.type\" [className]=\"subsub.badge.className || 'ml-2'\">{{ subsub.badge.label }}</badge>\n            </a>\n            <!--      tertiary : external link      -->\n            <a *ngIf=\"subsub.href\" href=\"{{ subsub.href }}\" target=\"{{ subsub.target }}\" class=\"nav-primary-tertiary-link\"\n              [ngClass]=\"{'active':isItemActive(subsub)}\">\n              <span>{{ subsub.label }}</span>\n              <badge *ngIf=\"subsub.badge\" [tooltipText]=\"subsub.badge.tooltipText\" [type]=\"subsub.badge.type\" [className]=\"subsub.badge.className || 'ml-2'\">{{ subsub.badge.label }}</badge>\n            </a>\n          </li>\n        </ul>\n      </li>\n    </ul>\n  </li>\n</ul>\n"
                }] }
    ];
    /** @nocollapse */
    NavMenuComponent.ctorParameters = function () { return [
        { type: Router }
    ]; };
    NavMenuComponent.propDecorators = {
        items: [{ type: Input }]
    };
    return NavMenuComponent;
}());
export { NavMenuComponent };
if (false) {
    /** @type {?} */
    NavMenuComponent.prototype.items;
    /**
     * @type {?}
     * @private
     */
    NavMenuComponent.prototype.router;
}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibmF2LW1lbnUuY29tcG9uZW50LmpzIiwic291cmNlUm9vdCI6Im5nOi8vQGFybW9yL2JyYW5ka2l0LyIsInNvdXJjZXMiOlsibGliL2NvbXBvb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