import * as i0 from '@angular/core';
import { Component, Inject, Optional, ViewChild, NgModule } from '@angular/core';
import * as i1 from '@angular/common';
import { CommonModule } from '@angular/common';
import * as i2 from '@wm/components/base';
import { PROP_STRING, PROP_BOOLEAN, register, StylableComponent, APPLY_STYLES_TYPE, styler, provideAsWidgetRef, WmComponentsModule } from '@wm/components/base';

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

const _c0 = ["navContent"];
const _c1 = ["wmNavbar", ""];
const _c2 = ["*"];
function NavbarComponent_a_6_img_2_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelement(0, "img", 11);
    i0.ɵɵpipe(1, "image");
} if (rf & 2) {
    const ctx_r1 = i0.ɵɵnextContext(2);
    i0.ɵɵproperty("alt", ctx_r1.Brand)("src", i0.ɵɵpipeBind1(1, 2, ctx_r1.imgsrc), i0.ɵɵsanitizeUrl);
} }
function NavbarComponent_a_6_Template(rf, ctx) { if (rf & 1) {
    i0.ɵɵelementStart(0, "a", 8);
    i0.ɵɵpipe(1, "trustAs");
    i0.ɵɵtemplate(2, NavbarComponent_a_6_img_2_Template, 2, 4, "img", 9);
    i0.ɵɵelement(3, "span", 10);
    i0.ɵɵelementEnd();
} if (rf & 2) {
    const ctx_r1 = i0.ɵɵnextContext();
    i0.ɵɵproperty("href", i0.ɵɵpipeBind2(1, 3, ctx_r1.homelink, "resource") || "#/", i0.ɵɵsanitizeUrl);
    i0.ɵɵadvance(2);
    i0.ɵɵproperty("ngIf", ctx_r1.imgsrc);
    i0.ɵɵadvance();
    i0.ɵɵ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 StylableComponent {
    static { this.initializeProps = registerProps(); }
    constructor(inj, explicitContext) {
        super(inj, WIDGET_CONFIG, explicitContext);
        styler(this.nativeElement, this, 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.ɵɵdirectiveInject(i0.Injector), i0.ɵɵdirectiveInject('EXPLICIT_CONTEXT', 8)); }; }
    static { this.ɵcmp = /*@__PURE__*/ i0.ɵɵdefineComponent({ type: NavbarComponent, selectors: [["", "wmNavbar", ""]], viewQuery: function NavbarComponent_Query(rf, ctx) { if (rf & 1) {
            i0.ɵɵviewQuery(_c0, 7);
        } if (rf & 2) {
            let _t;
            i0.ɵɵqueryRefresh(_t = i0.ɵɵloadQuery()) && (ctx.navContent = _t.first);
        } }, features: [i0.ɵɵProvidersFeature([
                provideAsWidgetRef(NavbarComponent)
            ]), i0.ɵɵ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.ɵɵgetCurrentView();
            i0.ɵɵprojectionDef();
            i0.ɵɵelementStart(0, "div", 1)(1, "div", 2)(2, "button", 3);
            i0.ɵɵlistener("click", function NavbarComponent_Template_button_click_2_listener() { i0.ɵɵrestoreView(_r1); return i0.ɵɵresetView(ctx.toggleCollapse()); });
            i0.ɵɵelementStart(3, "span", 4);
            i0.ɵɵtext(4, "Toggle navigation");
            i0.ɵɵelementEnd();
            i0.ɵɵelement(5, "i", 5);
            i0.ɵɵelementEnd();
            i0.ɵɵtemplate(6, NavbarComponent_a_6_Template, 4, 6, "a", 6);
            i0.ɵɵelementEnd();
            i0.ɵɵelementStart(7, "div", 7, 0);
            i0.ɵɵprojection(9);
            i0.ɵɵelementEnd()();
        } if (rf & 2) {
            i0.ɵɵadvance(5);
            i0.ɵɵproperty("ngClass", ctx.menuiconclass);
            i0.ɵɵadvance();
            i0.ɵɵproperty("ngIf", ctx.title || ctx.imgsrc);
        } }, dependencies: [i1.NgClass, i1.NgIf, i2.TextContentDirective, i2.TrustAsPipe, i2.ImagePipe], encapsulation: 2 }); }
}
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(NavbarComponent, [{
        type: Component,
        args: [{ selector: '[wmNavbar]', providers: [
                    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.Injector }, { type: undefined, decorators: [{
                type: Inject,
                args: ['EXPLICIT_CONTEXT']
            }, {
                type: Optional
            }] }], { navContent: [{
            type: ViewChild,
            args: ['navContent', { static: true }]
        }] }); })();
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵ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.ɵɵdefineNgModule({ type: NavbarModule }); }
    static { this.ɵinj = /*@__PURE__*/ i0.ɵɵdefineInjector({ imports: [CommonModule,
            WmComponentsModule] }); }
}
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(NavbarModule, [{
        type: NgModule,
        args: [{
                imports: [
                    CommonModule,
                    WmComponentsModule
                ],
                declarations: [...components],
                exports: [...components]
            }]
    }], null, null); })();
(function () { (typeof ngJitMode === "undefined" || ngJitMode) && i0.ɵɵsetNgModuleScope(NavbarModule, { declarations: [NavbarComponent], imports: [CommonModule,
        WmComponentsModule], exports: [NavbarComponent] }); })();

/**
 * Generated bundle index. Do not edit.
 */

export { NavbarComponent, NavbarModule };
//# sourceMappingURL=index.mjs.map
