import { Directive, Input, HostListener, Optional } from '@angular/core';
import { Button } from '../button/button';
import { MenuController } from './menu-controller';
import { Navbar } from '../navbar/navbar';
import { ViewController } from '../../navigation/view-controller';
export var MenuToggle = (function () {
    function MenuToggle(_menu, _viewCtrl, _button, _navbar) {
        this._menu = _menu;
        this._viewCtrl = _viewCtrl;
        this._button = _button;
        this._navbar = _navbar;
        this._isButton = !!_button;
        this._inNavbar = !!_navbar;
    }
    MenuToggle.prototype.ngAfterContentInit = function () {
        if (this._isButton) {
            this._button._setClass('menutoggle', true);
        }
    };
    MenuToggle.prototype.toggle = function () {
        var menu = this._menu.get(this.menuToggle);
        menu && menu.toggle();
    };
    Object.defineProperty(MenuToggle.prototype, "isHidden", {
        get: function () {
            if (this._inNavbar && this._viewCtrl) {
                if (this._viewCtrl.isFirst()) {
                    return false;
                }
                var menu = this._menu.get(this.menuToggle);
                if (menu) {
                    return !menu.persistent;
                }
            }
            return false;
        },
        enumerable: true,
        configurable: true
    });
    MenuToggle.decorators = [
        { type: Directive, args: [{
                    selector: '[menuToggle]',
                    host: {
                        '[hidden]': 'isHidden'
                    }
                },] },
    ];
    MenuToggle.ctorParameters = [
        { type: MenuController, },
        { type: ViewController, decorators: [{ type: Optional },] },
        { type: Button, decorators: [{ type: Optional },] },
        { type: Navbar, decorators: [{ type: Optional },] },
    ];
    MenuToggle.propDecorators = {
        'menuToggle': [{ type: Input },],
        'toggle': [{ type: HostListener, args: ['click',] },],
    };
    return MenuToggle;
}());
//# sourceMappingURL=menu-toggle.js.map