/*! * Angular Material Design * https://github.com/angular/material * @license MIT * v0.9.8 */ !function(e,t,n){"use strict";function o(e,n,o,i,l,a,r,m,c){function s(){f(),l(function(){x(),g(),h()})}function p(){function e(){var e=z.ul.getBoundingClientRect(),n={};e.right>o.right-d&&(n.left=t.right-e.width+"px"),z.$.ul.css(n)}if(!z)return l(p,0,!1);var t=z.wrap.getBoundingClientRect(),n=z.snap.getBoundingClientRect(),o=z.root.getBoundingClientRect(),i=n.bottom-o.top,a=o.bottom-n.top,r=t.left-o.left,m=t.width,c={left:r+"px",minWidth:m+"px",maxWidth:Math.max(t.right-o.left,o.right-t.left)-d+"px"};i>a&&o.height-t.bottom-d0||(K.hidden=R(),K.hidden||j())}function L(e){switch(e.keyCode){case i.KEY_CODE.DOWN_ARROW:if(K.loading)return;e.preventDefault(),K.index=Math.min(K.index+1,K.matches.length-1),B(),W();break;case i.KEY_CODE.UP_ARROW:if(K.loading)return;e.preventDefault(),K.index=K.index<0?K.matches.length-1:Math.max(0,K.index-1),B(),W();break;case i.KEY_CODE.TAB:case i.KEY_CODE.ENTER:if(K.hidden||K.loading||K.index<0||K.matches.length<1)return;e.preventDefault(),U(K.index);break;case i.KEY_CODE.ESCAPE:K.matches=[],K.hidden=!0,K.index=O()}}function M(){return t.isNumber(e.minLength)?e.minLength:1}function D(t){return t&&e.itemText?e.itemText(k(t)):t}function k(e){if(e){var t={};return K.itemName&&(t[K.itemName]=e),t}}function O(){return e.autoselect?0:-1}function R(){return S()?void 0:!0}function N(){return D(K.matches[K.index])}function S(){return e.searchText&&e.searchText.length>=M()}function U(t){e.selectedItem=K.matches[t],K.hidden=!0,K.index=0,K.matches=[],l(function(){z.$.input.controller("ngModel").$setViewValue(D(e.selectedItem)||e.searchText),K.hidden=!0})}function H(){e.searchText="",U(-1);var t=document.createEvent("CustomEvent");t.initCustomEvent("input",!0,!0,{value:e.searchText}),z.input.dispatchEvent(t),z.input.focus()}function _(n){function o(t){F[l]=t,n===e.searchText&&(K.loading=!1,V=null,K.matches=t,K.hidden=R(),W(),p())}var i=e.$parent.$eval(Y),l=n.toLowerCase();t.isArray(i)?o(i):(K.loading=!0,i.success&&i.success(o),i.then&&i.then(o),i.error&&i.error(function(){K.loading=!1}))}function W(){K.messages=[q(),N()]}function q(){if(X===K.matches.length)return"";switch(X=K.matches.length,K.matches.length){case 0:return"There are no matches available.";case 1:return"There is 1 match available.";default:return"There are "+K.matches.length+" matches available."}}function B(){if(z.li[K.index]){var e=z.li[K.index],t=e.offsetTop,n=t+e.offsetHeight,o=z.ul.clientHeight;tz.ul.scrollTop+o&&(z.ul.scrollTop=n-o)}}function j(){var t=e.searchText,n=t.toLowerCase();V&&V.cancel&&(V.cancel(),V=null),!e.noCache&&F[n]?(K.matches=F[n],W()):_(t),Q&&(K.hidden=R())}var K=this,P=e.itemsExpr.split(/ in /i),Y=P[1],z=null,V=null,F={},G=!1,J=[],Q=!1,X=0;return K.scope=e,K.parent=e.$parent,K.itemName=P[0],K.matches=[],K.loading=!1,K.hidden=!0,K.index=null,K.messages=[],K.id=o.nextUid(),K.keydown=L,K.blur=y,K.focus=I,K.clear=H,K.select=U,K.getCurrentDisplayValue=N,K.registerSelectedItemWatcher=T,K.unregisterSelectedItemWatcher=w,K.listEnter=function(){G=!0},K.listLeave=function(){G=!1,Q||(K.hidden=!0)},K.mouseUp=function(){z.input.focus()},s()}function i(e,t){function n(n,o,i){i.$observe("disabled",function(e){n.isDisabled=e}),i.$observe("required",function(e){n.isRequired=null!==e}),t.initOptionalProperties(n,i,{searchText:null,selectedItem:null}),e(o)}return{controller:"MdAutocompleteCtrl",controllerAs:"$mdAutocompleteCtrl",link:n,scope:{inputName:"@mdInputName",inputMinlength:"@mdInputMinlength",inputMaxlength:"@mdInputMaxlength",searchText:"=?mdSearchText",selectedItem:"=?mdSelectedItem",itemsExpr:"@mdItems",itemText:"&mdItemText",placeholder:"@placeholder",noCache:"=?mdNoCache",itemChange:"&?mdSelectedItemChange",textChange:"&?mdSearchTextChange",minLength:"=?mdMinLength",delay:"=?mdDelay",autofocus:"=?mdAutofocus",floatingLabel:"@?mdFloatingLabel",autoselect:"=?mdAutoselect",menuClass:"@?mdMenuClass"},template:function(e,t){function n(){var t=e.find("md-item-template").remove(),n=t.length?t.html():e.html();return t.length||e.empty(),n}function o(){var t=e.find("md-not-found").remove(),n=t.length?t.html():"";return n?'
  • '+n+"
  • ":""}function i(){return t.mdFloatingLabel?'
    '+r+"
    ":' '}var l=o(),a=n(),r=e.html();return' '+i()+'

    {{message}}

    '}}}function l(e,n,o){function i(i){var l=o(n.html())(e),r=t.element("
    ").text(l).html(),m=n.attr("md-highlight-flags")||"",c=e.$watch(i,function(e){var t=a(e,m),o=r.replace(t,'$&');n.html(o)});n.on("$destroy",function(){c()})}function l(e){return e?e.replace(/[\\\^\$\*\+\?\.\(\)\|\{\}\[\]]/g,"\\$&"):e}function a(e,t){var n="";return t.indexOf("^")>=1&&(n+="^"),n+=e,t.indexOf("$")>=1&&(n+="$"),new RegExp(l(n),t.replace(/[\$\^]/g,""))}return this.init=i,i()}function a(){return{terminal:!0,scope:!1,controller:"MdHighlightCtrl",link:function(e,t,n,o){o.init(n.mdHighlightText)}}}function r(e,t){function n(n,o,i){var l=n.$parent.$mdAutocompleteCtrl,a=l.parent.$new(!1,l.parent),r=l.scope.$eval(i.mdAutocompleteListItem);a[r]=n.item,e(o.contents())(a),o.attr({role:"option",id:"item_"+t.nextUid()})}return{terminal:!0,link:n,scope:!1}}function m(e,t){function n(t,n,o){var i=t.$parent.$mdAutocompleteCtrl;e(n.contents())(i.parent),o.hasOwnProperty("mdAutocompleteReplace")&&(n.after(n.contents()),n.remove())}return{restrict:"A",terminal:!0,link:n,scope:!1}}t.module("material.components.autocomplete",["material.core","material.components.icon"]),t.module("material.components.autocomplete").controller("MdAutocompleteCtrl",o);var c=41,u=5.5*c,d=8;o.$inject=["$scope","$element","$mdUtil","$mdConstant","$timeout","$mdTheming","$window","$animate","$rootElement"],t.module("material.components.autocomplete").directive("mdAutocomplete",i),i.$inject=["$mdTheming","$mdUtil"],t.module("material.components.autocomplete").controller("MdHighlightCtrl",l),l.$inject=["$scope","$element","$interpolate"],t.module("material.components.autocomplete").directive("mdHighlightText",a),t.module("material.components.autocomplete").directive("mdAutocompleteListItem",r),r.$inject=["$compile","$mdUtil"],t.module("material.components.autocomplete").directive("mdAutocompleteParentScope",m),m.$inject=["$compile","$mdUtil"]}(window,window.angular);