(function (global, factory) {
    typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/core'), require('@angular/common'), require('@wm/components/base')) :
    typeof define === 'function' && define.amd ? define(['exports', '@angular/core', '@angular/common', '@wm/components/base'], factory) :
    (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.wm = global.wm || {}, global.wm.components = global.wm.components || {}, global.wm.components.navigation = global.wm.components.navigation || {}, global.wm.components.navigation.navbar = {}), global.ng.core, global.ng.common, global.wm.components.base));
})(this, (function (exports, i0, i1, i2) { 'use strict';

    function _interopNamespaceDefault(e) {
        var n = Object.create(null);
        if (e) {
            Object.keys(e).forEach(function (k) {
                if (k !== 'default') {
                    var d = Object.getOwnPropertyDescriptor(e, k);
                    Object.defineProperty(n, k, d.get ? d : {
                        enumerable: true,
                        get: function () { return e[k]; }
                    });
                }
            });
        }
        n.default = e;
        return Object.freeze(n);
    }

    var i0__namespace = /*#__PURE__*/_interopNamespaceDefault(i0);
    var i1__namespace = /*#__PURE__*/_interopNamespaceDefault(i1);
    var i2__namespace = /*#__PURE__*/_interopNamespaceDefault(i2);

    const registerProps = () => {
        i2.register('wm-navbar', new Map([
            ['class', { value: '', ...i2.PROP_STRING }],
            ['homelink', i2.PROP_STRING],
            ['imgsrc', i2.PROP_STRING],
            ['menuiconclass', { value: 'wi wi-more-vert', ...i2.PROP_STRING }],
            ['name', i2.PROP_STRING],
            ['show', { value: true, ...i2.PROP_BOOLEAN }],
            ['title', i2.PROP_STRING]
        ]));
    };

    const _c0 = ["navContent"];
    const _c1 = ["wmNavbar", ""];
    const _c2 = ["*"];
    function NavbarComponent_a_6_img_2_Template(rf, ctx) { if (rf & 1) {
        i0__namespace.ɵɵelement(0, "img", 11);
        i0__namespace.ɵɵpipe(1, "image");
    } if (rf & 2) {
        const ctx_r1 = i0__namespace.ɵɵnextContext(2);
        i0__namespace.ɵɵproperty("alt", ctx_r1.Brand)("src", i0__namespace.ɵɵpipeBind1(1, 2, ctx_r1.imgsrc), i0__namespace.ɵɵsanitizeUrl);
    } }
    function NavbarComponent_a_6_Template(rf, ctx) { if (rf & 1) {
        i0__namespace.ɵɵelementStart(0, "a", 8);
        i0__namespace.ɵɵpipe(1, "trustAs");
        i0__namespace.ɵɵtemplate(2, NavbarComponent_a_6_img_2_Template, 2, 4, "img", 9);
        i0__namespace.ɵɵelement(3, "span", 10);
        i0__namespace.ɵɵelementEnd();
    } if (rf & 2) {
        const ctx_r1 = i0__namespace.ɵɵnextContext();
        i0__namespace.ɵɵproperty("href", i0__namespace.ɵɵpipeBind2(1, 3, ctx_r1.homelink, "resource") || "#/", i0__namespace.ɵɵsanitizeUrl);
        i0__namespace.ɵɵadvance(2);
        i0__namespace.ɵɵproperty("ngIf", ctx_r1.imgsrc);
        i0__namespace.ɵɵadvance();
        i0__namespace.ɵɵproperty("textContent", ctx_r1.title);
    } }
    const DEFAULT_CLS = 'navbar navbar-default app-navbar';
    const WIDGET_CONFIG = { widgetType: 'wm-navbar', hostClass: DEFAULT_CLS };
    class NavbarComponent extends i2.StylableComponent {
        static { this.initializeProps = registerProps(); }
        constructor(inj, explicitContext) {
            super(inj, WIDGET_CONFIG, explicitContext);
            i2.styler(this.nativeElement, this, i2.APPLY_STYLES_TYPE.CONTAINER);
        }
        toggleCollapse() {
            const $navContent = $(this.navContent.nativeElement);
            $navContent.animate({ 'height': 'toggle' });
            if ($navContent.hasClass('in')) {
                setTimeout(() => this.toggleNavCollapse(), 500);
            }
            else {
                this.toggleNavCollapse();
            }
        }
        toggleNavCollapse() {
            this.navContent.nativeElement.classList.toggle('in');
        }
        static { this.ɵfac = function NavbarComponent_Factory(t) { return new (t || NavbarComponent)(i0__namespace.ɵɵdirectiveInject(i0__namespace.Injector), i0__namespace.ɵɵdirectiveInject('EXPLICIT_CONTEXT', 8)); }; }
        static { this.ɵcmp = /*@__PURE__*/ i0__namespace.ɵɵdefineComponent({ type: NavbarComponent, selectors: [["", "wmNavbar", ""]], viewQuery: function NavbarComponent_Query(rf, ctx) { if (rf & 1) {
                i0__namespace.ɵɵviewQuery(_c0, 7);
            } if (rf & 2) {
                let _t;
                i0__namespace.ɵɵqueryRefresh(_t = i0__namespace.ɵɵloadQuery()) && (ctx.navContent = _t.first);
            } }, features: [i0__namespace.ɵɵProvidersFeature([
                    i2.provideAsWidgetRef(NavbarComponent)
                ]), i0__namespace.ɵɵInheritDefinitionFeature], attrs: _c1, ngContentSelectors: _c2, decls: 10, vars: 2, consts: [["navContent", ""], [1, "container-fluid"], [1, "navbar-header"], ["type", "button", "data-toggle", "collapse", "aria-expanded", "false", 1, "btn-transparent", "navbar-toggle", "collapsed", 3, "click"], [1, "sr-only"], [3, "ngClass"], ["class", "navbar-brand", 3, "href", 4, "ngIf"], [1, "collapse", "navbar-collapse"], [1, "navbar-brand", 3, "href"], ["data-identifier", "img", "class", "brand-image", "height", "20", 3, "alt", "src", 4, "ngIf"], [1, "title", 3, "textContent"], ["data-identifier", "img", "height", "20", 1, "brand-image", 3, "alt", "src"]], template: function NavbarComponent_Template(rf, ctx) { if (rf & 1) {
                const _r1 = i0__namespace.ɵɵgetCurrentView();
                i0__namespace.ɵɵprojectionDef();
                i0__namespace.ɵɵelementStart(0, "div", 1)(1, "div", 2)(2, "button", 3);
                i0__namespace.ɵɵlistener("click", function NavbarComponent_Template_button_click_2_listener() { i0__namespace.ɵɵrestoreView(_r1); return i0__namespace.ɵɵresetView(ctx.toggleCollapse()); });
                i0__namespace.ɵɵelementStart(3, "span", 4);
                i0__namespace.ɵɵtext(4, "Toggle navigation");
                i0__namespace.ɵɵelementEnd();
                i0__namespace.ɵɵelement(5, "i", 5);
                i0__namespace.ɵɵelementEnd();
                i0__namespace.ɵɵtemplate(6, NavbarComponent_a_6_Template, 4, 6, "a", 6);
                i0__namespace.ɵɵelementEnd();
                i0__namespace.ɵɵelementStart(7, "div", 7, 0);
                i0__namespace.ɵɵprojection(9);
                i0__namespace.ɵɵelementEnd()();
            } if (rf & 2) {
                i0__namespace.ɵɵadvance(5);
                i0__namespace.ɵɵproperty("ngClass", ctx.menuiconclass);
                i0__namespace.ɵɵadvance();
                i0__namespace.ɵɵproperty("ngIf", ctx.title || ctx.imgsrc);
            } }, dependencies: [i1__namespace.NgClass, i1__namespace.NgIf, i2__namespace.TextContentDirective, i2__namespace.TrustAsPipe, i2__namespace.ImagePipe], encapsulation: 2 }); }
    }
    (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0__namespace.ɵsetClassMetadata(NavbarComponent, [{
            type: i0.Component,
            args: [{ selector: '[wmNavbar]', providers: [
                        i2.provideAsWidgetRef(NavbarComponent)
                    ], template: "<div class=\"container-fluid\">\n    <div class=\"navbar-header\">\n        <button type=\"button\" class=\"btn-transparent navbar-toggle collapsed\" data-toggle=\"collapse\" (click)=\"toggleCollapse()\" aria-expanded=\"false\">\n            <span class=\"sr-only\">Toggle navigation</span>\n            <i [ngClass]=\"menuiconclass\"></i>\n        </button>\n        <a class=\"navbar-brand\" [href]=\"(homelink | trustAs: 'resource') || '#/'\" *ngIf=\"title || imgsrc\">\n            <img data-identifier=\"img\" class=\"brand-image\" [alt]=\"Brand\" height=\"20\" *ngIf=\"imgsrc\" [src]=\"imgsrc | image\"/>\n            <span class=\"title\" [textContent]=\"title\"></span>\n        </a>\n    </div>\n    <div class=\"collapse navbar-collapse\" #navContent>\n        <ng-content></ng-content>\n    </div>\n</div>" }]
        }], () => [{ type: i0__namespace.Injector }, { type: undefined, decorators: [{
                    type: i0.Inject,
                    args: ['EXPLICIT_CONTEXT']
                }, {
                    type: i0.Optional
                }] }], { navContent: [{
                type: i0.ViewChild,
                args: ['navContent', { static: true }]
            }] }); })();
    (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0__namespace.ɵsetClassDebugInfo(NavbarComponent, { className: "NavbarComponent", filePath: "navbar.component.ts", lineNumber: 19 }); })();

    const components = [
        NavbarComponent
    ];
    class NavbarModule {
        static { this.ɵfac = function NavbarModule_Factory(t) { return new (t || NavbarModule)(); }; }
        static { this.ɵmod = /*@__PURE__*/ i0__namespace.ɵɵdefineNgModule({ type: NavbarModule }); }
        static { this.ɵinj = /*@__PURE__*/ i0__namespace.ɵɵdefineInjector({ imports: [i1.CommonModule,
                i2.WmComponentsModule] }); }
    }
    (() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0__namespace.ɵsetClassMetadata(NavbarModule, [{
            type: i0.NgModule,
            args: [{
                    imports: [
                        i1.CommonModule,
                        i2.WmComponentsModule
                    ],
                    declarations: [...components],
                    exports: [...components]
                }]
        }], null, null); })();
    (function () { (typeof ngJitMode === "undefined" || ngJitMode) && i0__namespace.ɵɵsetNgModuleScope(NavbarModule, { declarations: [NavbarComponent], imports: [i1.CommonModule,
            i2.WmComponentsModule], exports: [NavbarComponent] }); })();

    exports.NavbarComponent = NavbarComponent;
    exports.NavbarModule = NavbarModule;

}));
