/*! * Angular Material Design * https://github.com/angular/material * @license MIT * v1.1.0-master-2b98560 */ function MenuBarController(e,n,t,r,o,i,a,l){this.$element=t,this.$attrs=r,this.$mdConstant=o,this.$mdUtil=a,this.$document=i,this.$scope=e,this.$rootScope=n,this.$timeout=l;var u=this;angular.forEach(BOUND_MENU_METHODS,function(e){u[e]=angular.bind(u,u[e])})}function MenuBarDirective(e,n){return{restrict:"E",require:"mdMenuBar",controller:"MenuBarController",compile:function(t,r){return r.ariaRole||t[0].setAttribute("role","menubar"),angular.forEach(t[0].children,function(n){if("MD-MENU"==n.nodeName){n.hasAttribute("md-position-mode")||(n.setAttribute("md-position-mode","left bottom"),n.querySelector("button, a, md-button").setAttribute("role","menuitem"));var t=e.nodesToArray(n.querySelectorAll("md-menu-content"));angular.forEach(t,function(e){e.classList.add("md-menu-bar-menu"),e.classList.add("md-dense"),e.hasAttribute("width")||e.setAttribute("width",5)})}}),t.find("md-menu-item").addClass("md-in-menu-bar"),function(e,t,r,o){t.addClass("_md"),n(e,t),o.init()}}}}function MenuDividerDirective(){return{restrict:"E",compile:function(e,n){n.role||e[0].setAttribute("role","separator")}}}function MenuItemController(e,n,t){this.$element=n,this.$attrs=t,this.$scope=e}function MenuItemDirective(e,n){return{controller:"MenuItemController",require:["mdMenuItem","?ngModel"],priority:210,compile:function(t,r){function o(e,n,r){r=r||t,r instanceof angular.element&&(r=r[0]),r.hasAttribute(e)||r.setAttribute(e,n)}function i(n){var r=e.prefixer(n);angular.forEach(r,function(e){if(t[0].hasAttribute(e)){var n=t[0].getAttribute(e);s[0].setAttribute(e,n),t[0].removeAttribute(e)}})}var a=r.type,l="md-in-menu-bar";if("checkbox"!=a&&"radio"!=a||!t.hasClass(l))o("role","menuitem",t[0].querySelector("md-button, button, a"));else{var u=t[0].textContent,s=angular.element(''),c='';s.html(u),s.attr("tabindex","0"),t.html(""),t.append(angular.element(c)),t.append(s),t.addClass("md-indent").removeClass(l),o("role","checkbox"==a?"menuitemcheckbox":"menuitemradio",s),i("ng-disabled")}return function(e,n,t,r){var o=r[0],i=r[1];o.init(i)}}}}goog.provide("ngmaterial.components.menuBar"),goog.require("ngmaterial.components.icon"),goog.require("ngmaterial.components.menu"),goog.require("ngmaterial.core"),angular.module("material.components.menuBar",["material.core","material.components.icon","material.components.menu"]),MenuBarController.$inject=["$scope","$rootScope","$element","$attrs","$mdConstant","$document","$mdUtil","$timeout"],angular.module("material.components.menuBar").controller("MenuBarController",MenuBarController);var BOUND_MENU_METHODS=["handleKeyDown","handleMenuHover","scheduleOpenHoveredMenu","cancelScheduledOpen"];MenuBarController.prototype.init=function(){var e=this.$element,n=this.$mdUtil,t=this.$scope,r=this,o=[];e.on("keydown",this.handleKeyDown),this.parentToolbar=n.getClosest(e,"MD-TOOLBAR"),o.push(this.$rootScope.$on("$mdMenuOpen",function(n,t){r.getMenus().indexOf(t[0])!=-1&&(e[0].classList.add("md-open"),t[0].classList.add("md-open"),r.currentlyOpenMenu=t.controller("mdMenu"),r.currentlyOpenMenu.registerContainerProxy(r.handleKeyDown),r.enableOpenOnHover())})),o.push(this.$rootScope.$on("$mdMenuClose",function(t,o,i){var a=r.getMenus();if(a.indexOf(o[0])!=-1&&(e[0].classList.remove("md-open"),o[0].classList.remove("md-open")),e[0].contains(o[0])){for(var l=o[0];l&&a.indexOf(l)==-1;)l=n.getClosest(l,"MD-MENU",!0);l&&(i.skipFocus||l.querySelector("button:not([disabled])").focus(),r.currentlyOpenMenu=void 0,r.disableOpenOnHover(),r.setKeyboardMode(!0))}})),t.$on("$destroy",function(){for(r.disableOpenOnHover();o.length;)o.shift()()}),this.setKeyboardMode(!0)},MenuBarController.prototype.setKeyboardMode=function(e){e?this.$element[0].classList.add("md-keyboard-mode"):this.$element[0].classList.remove("md-keyboard-mode")},MenuBarController.prototype.enableOpenOnHover=function(){if(!this.openOnHoverEnabled){var e=this;e.openOnHoverEnabled=!0,e.parentToolbar&&(e.parentToolbar.classList.add("md-has-open-menu"),e.$mdUtil.nextTick(function(){angular.element(e.parentToolbar).on("click",e.handleParentClick)},!1)),angular.element(e.getMenus()).on("mouseenter",e.handleMenuHover)}},MenuBarController.prototype.handleMenuHover=function(e){this.setKeyboardMode(!1),this.openOnHoverEnabled&&this.scheduleOpenHoveredMenu(e)},MenuBarController.prototype.disableOpenOnHover=function(){this.openOnHoverEnabled&&(this.openOnHoverEnabled=!1,this.parentToolbar&&(this.parentToolbar.classList.remove("md-has-open-menu"),angular.element(this.parentToolbar).off("click",this.handleParentClick)),angular.element(this.getMenus()).off("mouseenter",this.handleMenuHover))},MenuBarController.prototype.scheduleOpenHoveredMenu=function(e){var n=angular.element(e.currentTarget),t=n.controller("mdMenu");this.setKeyboardMode(!1),this.scheduleOpenMenu(t)},MenuBarController.prototype.scheduleOpenMenu=function(e){var n=this,t=this.$timeout;e!=n.currentlyOpenMenu&&(t.cancel(n.pendingMenuOpen),n.pendingMenuOpen=t(function(){n.pendingMenuOpen=void 0,n.currentlyOpenMenu&&n.currentlyOpenMenu.close(!0,{closeAll:!0}),e.open()},200,!1))},MenuBarController.prototype.handleKeyDown=function(e){var n=this.$mdConstant.KEY_CODE,t=this.currentlyOpenMenu,r=t&&t.isOpen;this.setKeyboardMode(!0);var o,i,a;switch(e.keyCode){case n.DOWN_ARROW:t?t.focusMenuContainer():this.openFocusedMenu(),o=!0;break;case n.UP_ARROW:t&&t.close(),o=!0;break;case n.LEFT_ARROW:i=this.focusMenu(-1),r&&(a=angular.element(i).controller("mdMenu"),this.scheduleOpenMenu(a)),o=!0;break;case n.RIGHT_ARROW:i=this.focusMenu(1),r&&(a=angular.element(i).controller("mdMenu"),this.scheduleOpenMenu(a)),o=!0}o&&(e&&e.preventDefault&&e.preventDefault(),e&&e.stopImmediatePropagation&&e.stopImmediatePropagation())},MenuBarController.prototype.focusMenu=function(e){var n=this.getMenus(),t=this.getFocusedMenuIndex();t==-1&&(t=this.getOpenMenuIndex());var r=!1;if(t==-1?(t=0,r=!0):(e<0&&t>0||e>0&&t