/*! * Angular Material Design * https://github.com/angular/material * @license MIT * v1.1.0-master-2b98560 */ !function(e,t,n){"use strict";function r(e,r,o,i,a,l,s,d){var u,c,m=a.prefixer(),f=this;this.nestLevel=parseInt(r.mdNestLevel,10)||0,this.init=function(n,r){r=r||{},u=n,c=o[0].querySelector(m.buildSelector(["ng-click","ng-mouseenter"])),c.setAttribute("aria-expanded","false"),this.isInMenuBar=r.isInMenuBar,this.nestedMenus=a.nodesToArray(u[0].querySelectorAll(".md-nested-menu")),u.on("$mdInterimElementRemove",function(){f.isOpen=!1,a.nextTick(function(){f.onIsOpenChanged(f.isOpen)})}),a.nextTick(function(){f.onIsOpenChanged(f.isOpen)});var l="menu_container_"+a.nextUid();u.attr("id",l),t.element(c).attr({"aria-owns":l,"aria-haspopup":"true"}),i.$on("$destroy",t.bind(this,function(){this.disableHoverListener(),e.destroy()})),u.on("$destroy",function(){e.destroy()})};var p,h,g=[];this.enableHoverListener=function(){g.push(s.$on("$mdMenuOpen",function(e,t){u[0].contains(t[0])&&(f.currentlyOpenMenu=t.controller("mdMenu"),f.isAlreadyOpening=!1,f.currentlyOpenMenu.registerContainerProxy(f.triggerContainerProxy.bind(f)))})),g.push(s.$on("$mdMenuClose",function(e,t){u[0].contains(t[0])&&(f.currentlyOpenMenu=n)})),h=t.element(a.nodesToArray(u[0].children[0].children)),h.on("mouseenter",f.handleMenuItemHover),h.on("mouseleave",f.handleMenuItemMouseLeave)},this.disableHoverListener=function(){for(;g.length;)g.shift()();h&&h.off("mouseenter",f.handleMenuItemHover),h&&h.off("mouseleave",f.handleMenuItemMouseLeave)},this.handleMenuItemHover=function(e){if(!f.isAlreadyOpening){var n=e.target.querySelector("md-menu")||a.getClosest(e.target,"MD-MENU");p=l(function(){if(n&&(n=t.element(n).controller("mdMenu")),f.currentlyOpenMenu&&f.currentlyOpenMenu!=n){var e=f.nestLevel+1;f.currentlyOpenMenu.close(!0,{closeTo:e}),f.isAlreadyOpening=!!n,n&&n.open()}else n&&!n.isOpen&&n.open&&(f.isAlreadyOpening=!!n,n&&n.open())},n?100:250);var r=e.currentTarget.querySelector(".md-button:not([disabled])");r&&r.focus()}},this.handleMenuItemMouseLeave=function(){p&&(l.cancel(p),p=n)},this.open=function(t){t&&t.stopPropagation(),t&&t.preventDefault(),f.isOpen||(f.enableHoverListener(),f.isOpen=!0,a.nextTick(function(){f.onIsOpenChanged(f.isOpen)}),c=c||(t?t.target:o[0]),c.setAttribute("aria-expanded","true"),i.$emit("$mdMenuOpen",o),e.show({scope:i,mdMenuCtrl:f,nestLevel:f.nestLevel,element:u,target:c,preserveElement:!0,parent:"body"})["finally"](function(){c.setAttribute("aria-expanded","false"),f.disableHoverListener()}))},i.$mdOpenMenu=this.open,this.onIsOpenChanged=function(e){e?(u.attr("aria-hidden","false"),o[0].classList.add("md-open"),t.forEach(f.nestedMenus,function(e){e.classList.remove("md-open")})):(u.attr("aria-hidden","true"),o[0].classList.remove("md-open")),i.$mdMenuIsOpen=f.isOpen},this.focusMenuContainer=function(){var e=u[0].querySelector(m.buildSelector(["md-menu-focus-target","md-autofocus"]));e||(e=u[0].querySelector(".md-button")),e.focus()},this.registerContainerProxy=function(e){this.containerProxy=e},this.triggerContainerProxy=function(e){this.containerProxy&&this.containerProxy(e)},this.destroy=function(){return f.isOpen?e.destroy():d.when(!1)},this.close=function(n,r){if(f.isOpen){f.isOpen=!1,a.nextTick(function(){f.onIsOpenChanged(f.isOpen)});var l=t.extend({},r,{skipFocus:n});if(i.$emit("$mdMenuClose",o,l),e.hide(null,r),!n){var s=f.restoreFocusTo||o.find("button")[0];s instanceof t.element&&(s=s[0]),s&&s.focus()}}},this.positionMode=function(){var e=(r.mdPositionMode||"target").split(" ");return 1==e.length&&e.push(e[0]),{left:e[0],top:e[1]}},this.offsets=function(){var e=(r.mdOffset||"0 0").split(" ").map(parseFloat);if(2==e.length)return{left:e[0],top:e[1]};if(1==e.length)return{top:e[0],left:e[0]};throw Error("Invalid offsets specified. Please follow format or ")}}function o(e){function r(n){n.addClass("md-menu");var r=n.children()[0],a=e.prefixer();if(a.hasAttribute(r,"ng-click")||(r=r.querySelector(a.buildSelector(["ng-click","ng-mouseenter"]))||r),!r||"MD-BUTTON"!=r.nodeName&&"BUTTON"!=r.nodeName||r.hasAttribute("type")||r.setAttribute("type","button"),2!=n.children().length)throw Error(i+"Expected two children elements.");r&&r.setAttribute("aria-haspopup","true");var l=n[0].querySelectorAll("md-menu"),s=parseInt(n[0].getAttribute("md-nest-level"),10)||0;return l&&t.forEach(e.nodesToArray(l),function(e){e.hasAttribute("md-position-mode")||e.setAttribute("md-position-mode","cascade"),e.classList.add("_md-nested-menu"),e.setAttribute("md-nest-level",s+1)}),o}function o(e,r,o,i){var a=i[0],l=i[1]!=n,s=t.element('
'),d=r.children()[1];r.addClass("_md"),d.hasAttribute("role")||d.setAttribute("role","menu"),s.append(d),r.on("$destroy",function(){s.remove()}),r.append(s),s[0].style.display="none",a.init(s,{isInMenuBar:l})}var i="Invalid HTML for md-menu: ";return{restrict:"E",require:["mdMenu","?^mdMenuBar"],controller:"mdMenuCtrl",scope:!0,compile:r}}function i(e){function r(e,r,a,l,s,d,u,c,m){function f(n,r,o){return o.nestLevel?t.noop:(o.disableParentScroll&&!e.getClosest(o.target,"MD-DIALOG")?o.restoreScroll=e.disableScrollAround(o.element,o.parent):o.disableParentScroll=!1,o.hasBackdrop&&(o.backdrop=e.createBackdrop(n,"md-menu-backdrop md-click-catcher"),m.enter(o.backdrop,l[0].body)),function(){o.backdrop&&o.backdrop.remove(),o.disableParentScroll&&o.restoreScroll()})}function p(e,t,n){function r(){return c(t,{addClass:"md-leave"}).start()}function o(){t.removeClass("md-active"),b(t,n),n.alreadyOpen=!1}return n.cleanupInteraction&&n.cleanupInteraction(),n.cleanupResizing(),n.hideBackdrop(),n.$destroy===!0?o():r().then(o)}function h(n,o,i){function l(){return i.parent.append(o),o[0].style.display="",d(function(e){var t=y(o,i);o.removeClass("md-leave"),c(o,{addClass:"md-active",from:C.toCss(t),to:C.toCss({transform:""})}).start().then(e)})}function m(){if(!i.target)throw Error("$mdMenu.show() expected a target to animate from in options.target");t.extend(i,{alreadyOpen:!1,isRemoved:!1,target:t.element(i.target),parent:t.element(i.parent),menuContentEl:t.element(o[0].querySelector("md-menu-content"))})}function p(){var e=function(e,t){return u.throttle(function(){if(!i.isRemoved){var n=y(e,t);e.css(C.toCss(n))}})}(o,i);return s.addEventListener("resize",e),s.addEventListener("orientationchange",e),function(){s.removeEventListener("resize",e),s.removeEventListener("orientationchange",e)}}function h(){function t(t){var n;switch(t.keyCode){case a.KEY_CODE.ESCAPE:i.mdMenuCtrl.close(!1,{closeAll:!0}),n=!0;break;case a.KEY_CODE.UP_ARROW:g(t,i.menuContentEl,i,-1)||i.nestLevel||i.mdMenuCtrl.triggerContainerProxy(t),n=!0;break;case a.KEY_CODE.DOWN_ARROW:g(t,i.menuContentEl,i,1)||i.nestLevel||i.mdMenuCtrl.triggerContainerProxy(t),n=!0;break;case a.KEY_CODE.LEFT_ARROW:i.nestLevel?i.mdMenuCtrl.close():i.mdMenuCtrl.triggerContainerProxy(t),n=!0;break;case a.KEY_CODE.RIGHT_ARROW:var r=e.getClosest(t.target,"MD-MENU");r&&r!=i.parent[0]?t.target.click():i.mdMenuCtrl.triggerContainerProxy(t),n=!0}n&&(t.preventDefault(),t.stopImmediatePropagation())}function r(e){e.preventDefault(),e.stopPropagation(),n.$apply(function(){i.mdMenuCtrl.close(!0,{closeAll:!0})})}function l(t){function r(){n.$apply(function(){i.mdMenuCtrl.close(!0,{closeAll:!0})})}function o(e,t){if(!e)return!1;for(var n,r=0;n=t[r];++r)if(M.hasAttribute(e,n))return!0;return!1}var a=t.target;do{if(a==i.menuContentEl[0])return;if((o(a,["ng-click","ng-href","ui-sref"])||"BUTTON"==a.nodeName||"MD-BUTTON"==a.nodeName)&&!o(a,["md-prevent-menu-close"])){var l=e.getClosest(a,"MD-MENU");a.hasAttribute("disabled")||l&&l!=i.parent[0]||r();break}}while(a=a.parentNode)}o.addClass("md-clickable"),i.backdrop&&i.backdrop.on("click",r),i.menuContentEl.on("keydown",t),i.menuContentEl[0].addEventListener("click",l,!0);var s=i.menuContentEl[0].querySelector(M.buildSelector(["md-menu-focus-target","md-autofocus"]));if(!s){var d=i.menuContentEl[0].firstElementChild;s=d&&(d.querySelector(".md-button:not([disabled])")||d.firstElementChild)}return s&&s.focus(),function(){o.removeClass("md-clickable"),i.backdrop&&i.backdrop.off("click",r),i.menuContentEl.off("keydown",t),i.menuContentEl[0].removeEventListener("click",l,!0)}}return m(i),r.inherit(i.menuContentEl,i.target),i.cleanupResizing=p(),i.hideBackdrop=f(n,o,i),l().then(function(e){return i.alreadyOpen=!0,i.cleanupInteraction=h(),e})}function g(t,n,r,o){for(var i,a=e.getClosest(t.target,"MD-MENU-ITEM"),l=e.nodesToArray(n[0].children),s=l.indexOf(a),d=s+o;d>=0&&d