/**
 * @fileoverview added by tsickle
 * Generated from: lib/routing/navigation/components/toolbar/toolbar.component.ts
 * @suppress {checkTypes,constantProperty,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
 */
import * as tslib_1 from "tslib";
import { Component, Input } from '@angular/core';
import { Storage } from '@ionic/storage';
import { PopoverController } from '@ionic/angular';
import { UserMenuComponent } from '../user-menu/user-menu.component';
var ToolbarComponent = /** @class */ (function () {
    function ToolbarComponent(storage, popoverCtrl) {
        this.storage = storage;
        this.popoverCtrl = popoverCtrl;
        this.defHref = '/';
        this.color = 'primary';
        this.pracName = '';
    }
    /**
     * @return {?}
     */
    ToolbarComponent.prototype.ngOnInit = /**
     * @return {?}
     */
    function () {
        return tslib_1.__awaiter(this, void 0, void 0, function () {
            var user;
            return tslib_1.__generator(this, function (_a) {
                switch (_a.label) {
                    case 0: return [4 /*yield*/, this.storage.get('user')];
                    case 1:
                        user = _a.sent();
                        this.pracName = user && user.displayName ? user.displayName : 'UNKNOWN_USER';
                        return [2 /*return*/];
                }
            });
        });
    };
    /**
     * @param {?} event
     * @return {?}
     */
    ToolbarComponent.prototype.openUserMenu = /**
     * @param {?} event
     * @return {?}
     */
    function (event) {
        return tslib_1.__awaiter(this, void 0, void 0, function () {
            var userMenu;
            return tslib_1.__generator(this, function (_a) {
                switch (_a.label) {
                    case 0: return [4 /*yield*/, this.popoverCtrl.create({
                            component: UserMenuComponent,
                            event: event
                        })];
                    case 1:
                        userMenu = _a.sent();
                        userMenu.present();
                        return [2 /*return*/];
                }
            });
        });
    };
    ToolbarComponent.decorators = [
        { type: Component, args: [{
                    selector: 'inc-toolbar',
                    template: "<ion-header>\r\n  <ion-toolbar [color]=\"color\">\r\n    <ion-buttons slot=\"start\">\r\n      <ion-menu-button *ngIf=\"withBack; else withSidenav\"></ion-menu-button>\r\n      <ng-template #withSidenav>\r\n        <ion-back-button id=\"back-button\" [defaultHref]=\"defHref\"></ion-back-button>\r\n      </ng-template>\r\n    </ion-buttons>\r\n    <ion-title *ngIf=\"title\">{{title | translate}}</ion-title>\r\n    <ion-buttons slot=\"end\" class=\"ion-margin-end\">\r\n      <ion-button id=\"user-detail\" (click)=\"openUserMenu($event)\">\r\n        <ion-label class=\"text-initial\">{{pracName | translate}}&nbsp;</ion-label>\r\n        <ion-icon name=\"arrow-dropdown\"></ion-icon>\r\n      </ion-button>\r\n    </ion-buttons>\r\n  </ion-toolbar>\r\n</ion-header>",
                    styles: [".text-initial{text-transform:initial}"]
                }] }
    ];
    /** @nocollapse */
    ToolbarComponent.ctorParameters = function () { return [
        { type: Storage },
        { type: PopoverController }
    ]; };
    ToolbarComponent.propDecorators = {
        withBack: [{ type: Input }],
        title: [{ type: Input }],
        defHref: [{ type: Input }],
        color: [{ type: Input }]
    };
    return ToolbarComponent;
}());
export { ToolbarComponent };
if (false) {
    /** @type {?} */
    ToolbarComponent.prototype.withBack;
    /** @type {?} */
    ToolbarComponent.prototype.title;
    /** @type {?} */
    ToolbarComponent.prototype.defHref;
    /** @type {?} */
    ToolbarComponent.prototype.color;
    /** @type {?} */
    ToolbarComponent.prototype.pracName;
    /**
     * @type {?}
     * @private
     */
    ToolbarComponent.prototype.storage;
    /**
     * @type {?}
     * @private
     */
    ToolbarComponent.prototype.popoverCtrl;
}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidG9vbGJhci5jb21wb25lbnQuanMiLCJzb3VyY2VSb290Ijoibmc6Ly9AaW5jbG91ZGVkL2lvbmljNC1pbmNsb3VkZWQtbGliLyIsInNvdXJjZXMiOlsibGliL3JvdXRpbmcvbmF2aWdhdGlvbi9jb21wb25lbnRzL3Rvb2xiYXIvdG9vbGJhci5jb21wb25lbnQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7O0FBQUEsT0FBTyxFQUFFLFNBQVMsRUFBRSxLQUFLLEVBQVUsTUFBTSxlQUFlLENBQUM7QUFDekQsT0FBTyxFQUFFLE9BQU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