nexus site path corrected
[portal.git] / ecomp-portal-FE / client / bower_components / angular-material / modules / js / autocomplete / autocomplete.min.js
1 /*!
2  * Angular Material Design
3  * https://github.com/angular/material
4  * @license MIT
5  * v0.9.8
6  */
7 !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-d<u?(c.top="auto",c.bottom=a+"px",c.maxHeight=Math.min(u,t.top-o.top-d)+"px"):(c.top=i+"px",c.bottom="auto",c.maxHeight=Math.min(u,o.bottom-t.bottom-d)+"px"),z.$.ul.css(c),l(e,0,!1)}function h(){z.$.root.length&&(a(z.$.ul),z.$.ul.detach(),z.$.root.append(z.$.ul),m.pin&&m.pin(z.$.ul,c))}function g(){e.autofocus&&z.input.focus()}function f(){var n=parseInt(e.delay,10)||0;e.$watch("searchText",n?o.debounce(E,n):E),T(A),e.$watch("selectedItem",b),e.$watch("$mdAutocompleteCtrl.hidden",function(e,t){!e&&t&&p()}),t.element(r).on("resize",p),e.$on("$destroy",$)}function $(){z.$.ul.remove()}function x(){z={main:n[0],ul:n.find("ul")[0],input:n.find("input")[0],wrap:n.find("md-autocomplete-wrap")[0],root:document.body},z.li=z.ul.getElementsByTagName("li"),z.snap=C(),z.$=v(z)}function C(){for(var e=n;e.length;e=e.parent())if(t.isDefined(e.attr("md-autocomplete-snap")))return e[0];return z.wrap}function v(e){var n={};for(var o in e)n[o]=t.element(e[o]);return n}function A(t,n){t&&(e.searchText=D(t)),e.itemChange&&t!==n&&e.itemChange(k(t))}function b(e,t){for(var n=0;n<J.length;++n)J[n](e,t)}function T(e){-1==J.indexOf(e)&&J.push(e)}function w(e){var t=J.indexOf(e);-1!=t&&J.splice(t,1)}function E(t,n){K.index=O(),t!==n&&t!==D(e.selectedItem)&&(e.selectedItem=null,e.textChange&&t!==n&&e.textChange(k(e.selectedItem)),S()?j():(K.loading=!1,K.matches=[],K.hidden=R(),W()))}function y(){Q=!1,G||(K.hidden=!0)}function I(){Q=!0,t.isString(e.searchText)||(e.searchText=""),e.minLength>0||(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;t<z.ul.scrollTop?z.ul.scrollTop=t:n>z.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?'<li ng-if="!$mdAutocompleteCtrl.matches.length && !$mdAutocompleteCtrl.loading                         && !$mdAutocompleteCtrl.hidden"                         ng-hide="$mdAutocompleteCtrl.hidden"                         md-autocomplete-parent-scope>'+n+"</li>":""}function i(){return t.mdFloatingLabel?'            <md-input-container flex ng-if="floatingLabel">              <label>{{floatingLabel}}</label>              <input type="search"                  id="fl-input-{{$mdAutocompleteCtrl.id}}"                  name="{{inputName}}"                  autocomplete="off"                  ng-required="isRequired"                  ng-minlength="inputMinlength"                  ng-maxlength="inputMaxlength"                  ng-disabled="isDisabled"                  ng-model="$mdAutocompleteCtrl.scope.searchText"                  ng-keydown="$mdAutocompleteCtrl.keydown($event)"                  ng-blur="$mdAutocompleteCtrl.blur()"                  ng-focus="$mdAutocompleteCtrl.focus()"                  aria-owns="ul-{{$mdAutocompleteCtrl.id}}"                  aria-label="{{floatingLabel}}"                  aria-autocomplete="list"                  aria-haspopup="true"                  aria-activedescendant=""                  aria-expanded="{{!$mdAutocompleteCtrl.hidden}}"/>              <div md-autocomplete-parent-scope md-autocomplete-replace>'+r+"</div>            </md-input-container>":'            <input flex type="search"                id="input-{{$mdAutocompleteCtrl.id}}"                name="{{inputName}}"                ng-if="!floatingLabel"                autocomplete="off"                ng-required="isRequired"                ng-disabled="isDisabled"                ng-model="$mdAutocompleteCtrl.scope.searchText"                ng-keydown="$mdAutocompleteCtrl.keydown($event)"                ng-blur="$mdAutocompleteCtrl.blur()"                ng-focus="$mdAutocompleteCtrl.focus()"                placeholder="{{placeholder}}"                aria-owns="ul-{{$mdAutocompleteCtrl.id}}"                aria-label="{{placeholder}}"                aria-autocomplete="list"                aria-haspopup="true"                aria-activedescendant=""                aria-expanded="{{!$mdAutocompleteCtrl.hidden}}"/>            <button                type="button"                tabindex="-1"                ng-if="$mdAutocompleteCtrl.scope.searchText && !isDisabled"                ng-click="$mdAutocompleteCtrl.clear()">              <md-icon md-svg-icon="md-close"></md-icon>              <span class="md-visually-hidden">Clear</span>            </button>                '}var l=o(),a=n(),r=e.html();return'        <md-autocomplete-wrap            layout="row"            ng-class="{ \'md-whiteframe-z1\': !floatingLabel }"            role="listbox">          '+i()+'          <md-progress-linear              ng-if="$mdAutocompleteCtrl.loading"              md-mode="indeterminate"></md-progress-linear>          <ul role="presentation"              class="md-autocomplete-suggestions md-whiteframe-z1 {{menuClass || \'\'}}"              id="ul-{{$mdAutocompleteCtrl.id}}"              ng-mouseenter="$mdAutocompleteCtrl.listEnter()"              ng-mouseleave="$mdAutocompleteCtrl.listLeave()"              ng-mouseup="$mdAutocompleteCtrl.mouseUp()">            <li ng-repeat="(index, item) in $mdAutocompleteCtrl.matches"                ng-class="{ selected: index === $mdAutocompleteCtrl.index }"                ng-hide="$mdAutocompleteCtrl.hidden"                ng-click="$mdAutocompleteCtrl.select(index)"                md-autocomplete-list-item="$mdAutocompleteCtrl.itemName">                '+a+"            </li>            "+l+'          </ul>        </md-autocomplete-wrap>        <aria-status            class="md-visually-hidden"            role="status"            aria-live="assertive">          <p ng-repeat="message in $mdAutocompleteCtrl.messages" ng-if="message">{{message}}</p>        </aria-status>'}}}function l(e,n,o){function i(i){var l=o(n.html())(e),r=t.element("<div>").text(l).html(),m=n.attr("md-highlight-flags")||"",c=e.$watch(i,function(e){var t=a(e,m),o=r.replace(t,'<span class="highlight">$&</span>');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);