0);t&&t.focus(),l.focusedNode=t}function d(){a("next")}function c(){a("prev")}function p(e){function t(){var t=!1;if(e&&e.currentTarget.children.length>0){var n=e.currentTarget.children[0],r=n.scrollHeight>n.clientHeight;if(r&&n.children.length>0){var i=e.pageX-e.currentTarget.getBoundingClientRect().left;i>n.querySelector("md-option").offsetWidth&&(t=!0)}}return t}if(!(e&&"click"==e.type&&e.currentTarget!=f[0]||t())){var n=u.getClosest(e.target,"md-option");n&&n.hasAttribute&&!n.hasAttribute("disabled")&&(e.preventDefault(),e.stopPropagation(),m.isMultiple||(l.restoreFocus=!0,u.nextTick(function(){r.hide(m.ngModel.$viewValue)},!0)))}}if(!l.isRemoved){var f=l.selectEl,m=f.controller("mdSelectMenu")||{};return o.addClass("md-clickable"),l.backdrop&&l.backdrop.on("click",e),f.on("keydown",t),f.on("click",p),function(){l.backdrop&&l.backdrop.off("click",e),f.off("keydown",t),f.off("click",p),o.removeClass("md-clickable"),l.isRemoved=!0}}}return S(),$(e,l),l.hideBackdrop=c(e,o,l),a(e,o,l).then(function(e){return o.attr("aria-hidden","false"),l.alreadyOpen=!0,l.cleanupInteraction=x(),l.cleanupResizing=y(),b(l.focusedNode),e},l.hideBackdrop)}function y(e){var t=e.selectCtrl;if(t){var n=e.selectEl.controller("mdSelectMenu");t.setLabelText(n?n.selectedLabels():""),t.triggerClose()}}function C(n,r,i){var s,f=r[0],m=i.target[0].children[0],h=v[0].body,g=i.selectEl[0],b=i.contentEl[0],$=h.getBoundingClientRect(),y=m.getBoundingClientRect(),C=!1,w={left:$.left+c,top:c,bottom:$.height-c,right:$.width-c-(u.floatingScrollbars()?16:0)},k={top:y.top-w.top,left:y.left-w.left,right:w.right-(y.left+y.width),bottom:w.bottom-(y.top+y.height)},M=$.width-2*c,S=g.querySelector("md-option[selected]"),x=g.getElementsByTagName("md-option"),A=g.getElementsByTagName("md-optgroup"),O=d(r,b),E=o(i.loadingAsync);s=E?b.firstElementChild||b:S?S:A.length?A[0]:x.length?x[0]:b.firstElementChild||b,b.offsetWidth>M?b.style["max-width"]=M+"px":b.style.maxWidth=null,C&&(b.style["min-width"]=y.width+"px"),O&&g.classList.add("md-overflow");var T=s;"MD-OPTGROUP"===(T.tagName||"").toUpperCase()&&(T=x[0]||b.firstElementChild||b,s=T),i.focusedNode=T,f.style.display="block";var D=g.getBoundingClientRect(),R=a(s);if(s){var V=p.getComputedStyle(s);R.paddingLeft=parseInt(V.paddingLeft,10)||0,R.paddingRight=parseInt(V.paddingRight,10)||0}if(O){var P=b.offsetHeight/2;b.scrollTop=R.top+R.height/2-P,k.topw.bottom&&(N=y.top-D.height,L="50% 100%")):(B=y.left+R.left-R.paddingLeft+2,N=Math.floor(y.top+y.height/2-R.height/2-R.top+b.scrollTop)+2,L=R.left+y.width/2+"px "+(R.top+R.height/2-b.scrollTop)+"px 0px",_=Math.min(y.width+R.paddingLeft+R.paddingRight,M),H=e.getComputedStyle(m)["font-size"]);var I=f.getBoundingClientRect(),j=Math.round(100*Math.min(y.width/D.width,1))/100,q=Math.round(100*Math.min(y.height/D.height,1))/100;return{container:{element:t.element(f),styles:{left:Math.floor(l(w.left,B,w.right-I.width)),top:Math.floor(l(w.top,N,w.bottom-I.height)),"min-width":_,"font-size":H}},dropDown:{element:t.element(g),styles:{transformOrigin:L,transform:i.alreadyOpen?"":u.supplant("scale({0},{1})",[j,q])}}}}var w="$mdSelect.show() expected a target element in options.target but got '{0}'!",k=u.dom.animator,M=i.KEY_CODE;return{parent:"body",themable:!0,onShow:$,onRemove:b,hasBackdrop:!0,disableParentScroll:!0}}function o(e){return e&&t.isFunction(e.then)}function l(e,t,n){return Math.max(e,Math.min(t,n))}function a(e){return e?{left:e.offsetLeft,top:e.offsetTop,width:e.offsetWidth,height:e.offsetHeight}:{left:0,top:0,width:0,height:0}}function d(e,t){var n=!1;try{var r=e[0].style.display;e[0].style.display="block",n=t.scrollHeight>t.offsetHeight,e[0].style.display=r}finally{}return n}return i.$inject=["$mdSelect","$mdConstant","$mdUtil","$window","$q","$$rAF","$animateCss","$animate","$document"],r("$mdSelect").setDefaults({methods:["target"],options:i})}function s(e,t){var n=String.fromCharCode(e.keyCode),r=e.keyCode<=31;return n&&n.length&&!r&&!t.isMetaKey(e)&&!t.isFnLockKey(e)&&!t.hasModifierKey(e)}r.$inject=["$mdSelect","$mdUtil","$mdConstant","$mdTheming","$mdAria","$parse","$sce","$injector"],i.$inject=["$parse","$mdUtil","$mdConstant","$mdTheming"],o.$inject=["$mdButtonInkRipple","$mdUtil","$mdTheming"],d.$inject=["$$interimElementProvider"];var c=8,u=0,p=t.element('
');t.module("material.components.select",["material.core","material.components.backdrop"]).directive("mdSelect",r).directive("mdSelectMenu",i).directive("mdOption",o).directive("mdOptgroup",l).directive("mdSelectHeader",a).provider("$mdSelect",d)}(window,window.angular);