'use strict';angular.module('ui.alias',[]).config(['$compileProvider','uiAliasConfig',function($compileProvider,uiAliasConfig){uiAliasConfig=uiAliasConfig||{};angular.forEach(uiAliasConfig,function(config,alias){if(angular.isString(config)){config={replace:true,template:config};}
$compileProvider.directive(alias,function(){return config;});});}]);'use strict';angular.module('ui.event',[]).directive('uiEvent',['$parse',function($parse){return function($scope,elm,attrs){var events=$scope.$eval(attrs.uiEvent);angular.forEach(events,function(uiEvent,eventName){var fn=$parse(uiEvent);elm.bind(eventName,function(evt){var params=Array.prototype.slice.call(arguments);params=params.splice(1);fn($scope,{$event:evt,$params:params});if(!$scope.$$phase){$scope.$apply();}});});};}]);'use strict';angular.module('ui.format',[]).filter('format',function(){return function(value,replace){var target=value;if(angular.isString(target)&&replace!==undefined){if(!angular.isArray(replace)&&!angular.isObject(replace)){replace=[replace];}
if(angular.isArray(replace)){var rlen=replace.length;var rfx=function(str,i){i=parseInt(i,10);return(i>=0&&i<rlen)?replace[i]:str;};target=target.replace(/\$([0-9]+)/g,rfx);}
else{angular.forEach(replace,function(value,key){target=target.split(':'+key).join(value);});}}
return target;};});'use strict';angular.module('ui.highlight',[]).filter('highlight',function(){return function(text,search,caseSensitive){if(search||angular.isNumber(search)){text=text.toString();search=search.toString();if(caseSensitive){return text.split(search).join('<span class="ui-match">'+search+'</span>');}else{return text.replace(new RegExp(search,'gi'),'<span class="ui-match">$&</span>');}}else{return text;}};});'use strict';angular.module('ui.include',[]).directive('uiInclude',['$http','$templateCache','$anchorScroll','$compile',function($http,$templateCache,$anchorScroll,$compile){return{restrict:'ECA',terminal:true,compile:function(element,attr){var srcExp=attr.uiInclude||attr.src,fragExp=attr.fragment||'',onloadExp=attr.onload||'',autoScrollExp=attr.autoscroll;return function(scope,element){var changeCounter=0,childScope;var clearContent=function(){if(childScope){childScope.$destroy();childScope=null;}
element.html('');};function ngIncludeWatchAction(){var thisChangeId=++changeCounter;var src=scope.$eval(srcExp);var fragment=scope.$eval(fragExp);if(src){$http.get(src,{cache:$templateCache}).success(function(response){if(thisChangeId!==changeCounter){return;}
if(childScope){childScope.$destroy();}
childScope=scope.$new();var contents;if(fragment){contents=angular.element('<div/>').html(response).find(fragment);}
else{contents=angular.element('<div/>').html(response).contents();}
element.html(contents);$compile(contents)(childScope);if(angular.isDefined(autoScrollExp)&&(!autoScrollExp||scope.$eval(autoScrollExp))){$anchorScroll();}
childScope.$emit('$includeContentLoaded');scope.$eval(onloadExp);}).error(function(){if(thisChangeId===changeCounter){clearContent();}});}else{clearContent();}}
scope.$watch(fragExp,ngIncludeWatchAction);scope.$watch(srcExp,ngIncludeWatchAction);};}};}]);'use strict';angular.module('ui.indeterminate',[]).directive('uiIndeterminate',[function(){return{compile:function(tElm,tAttrs){if(!tAttrs.type||tAttrs.type.toLowerCase()!=='checkbox'){return angular.noop;}
return function($scope,elm,attrs){$scope.$watch(attrs.uiIndeterminate,function(newVal){elm[0].indeterminate=!!newVal;});};}};}]);'use strict';angular.module('ui.inflector',[]).filter('inflector',function(){function ucwords(text){return text.replace(/^([a-z])|\s+([a-z])/g,function($1){return $1.toUpperCase();});}
function breakup(text,separator){return text.replace(/[A-Z]/g,function(match){return separator+match;});}
var inflectors={humanize:function(value){return ucwords(breakup(value,' ').split('_').join(' '));},underscore:function(value){return value.substr(0,1).toLowerCase()+breakup(value.substr(1),'_').toLowerCase().split(' ').join('_');},variable:function(value){value=value.substr(0,1).toLowerCase()+ucwords(value.split('_').join(' ')).substr(1).split(' ').join('');return value;}};return function(text,inflector){if(inflector!==false&&angular.isString(text)){inflector=inflector||'humanize';return inflectors[inflector](text);}else{return text;}};});'use strict';angular.module('ui.jq',[]).value('uiJqConfig',{}).directive('uiJq',['uiJqConfig','$timeout',function uiJqInjectingFunction(uiJqConfig,$timeout){return{restrict:'A',compile:function uiJqCompilingFunction(tElm,tAttrs){if(!angular.isFunction(tElm[tAttrs.uiJq])){throw new Error('ui-jq: The "'+tAttrs.uiJq+'" function does not exist');}
var options=uiJqConfig&&uiJqConfig[tAttrs.uiJq];return function uiJqLinkingFunction(scope,elm,attrs){var linkOptions=[];if(attrs.uiOptions){linkOptions=scope.$eval('['+attrs.uiOptions+']');if(angular.isObject(options)&&angular.isObject(linkOptions[0])){linkOptions[0]=angular.extend({},options,linkOptions[0]);}}else if(options){linkOptions=[options];}
if(attrs.ngModel&&elm.is('select,input,textarea')){elm.bind('change',function(){elm.trigger('input');});}
function callPlugin(){$timeout(function(){elm[attrs.uiJq].apply(elm,linkOptions);},0,false);}
if(attrs.uiRefresh){scope.$watch(attrs.uiRefresh,function(){callPlugin();});}
callPlugin();};}};}]);'use strict';angular.module('ui.keypress',[]).factory('keypressHelper',['$parse',function keypress($parse){var keysByCode={8:'backspace',9:'tab',13:'enter',27:'esc',32:'space',33:'pageup',34:'pagedown',35:'end',36:'home',37:'left',38:'up',39:'right',40:'down',45:'insert',46:'delete'};var capitaliseFirstLetter=function(string){return string.charAt(0).toUpperCase()+string.slice(1);};return function(mode,scope,elm,attrs){var params,combinations=[];params=scope.$eval(attrs['ui'+capitaliseFirstLetter(mode)]);angular.forEach(params,function(v,k){var combination,expression;expression=$parse(v);angular.forEach(k.split(' '),function(variation){combination={expression:expression,keys:{}};angular.forEach(variation.split('-'),function(value){combination.keys[value]=true;});combinations.push(combination);});});elm.bind(mode,function(event){var metaPressed=!!(event.metaKey&&!event.ctrlKey);var altPressed=!!event.altKey;var ctrlPressed=!!event.ctrlKey;var shiftPressed=!!event.shiftKey;var keyCode=event.keyCode;if(mode==='keypress'&&!shiftPressed&&keyCode>=97&&keyCode<=122){keyCode=keyCode-32;}
angular.forEach(combinations,function(combination){var mainKeyPressed=combination.keys[keysByCode[keyCode]]||combination.keys[keyCode.toString()];var metaRequired=!!combination.keys.meta;var altRequired=!!combination.keys.alt;var ctrlRequired=!!combination.keys.ctrl;var shiftRequired=!!combination.keys.shift;if(mainKeyPressed&&(metaRequired===metaPressed)&&(altRequired===altPressed)&&(ctrlRequired===ctrlPressed)&&(shiftRequired===shiftPressed)){scope.$apply(function(){combination.expression(scope,{'$event':event});});}});});};}]);angular.module('ui.keypress').directive('uiKeydown',['keypressHelper',function(keypressHelper){return{link:function(scope,elm,attrs){keypressHelper('keydown',scope,elm,attrs);}};}]);angular.module('ui.keypress').directive('uiKeypress',['keypressHelper',function(keypressHelper){return{link:function(scope,elm,attrs){keypressHelper('keypress',scope,elm,attrs);}};}]);angular.module('ui.keypress').directive('uiKeyup',['keypressHelper',function(keypressHelper){return{link:function(scope,elm,attrs){keypressHelper('keyup',scope,elm,attrs);}};}]);'use strict';angular.module('ui.mask',[]).value('uiMaskConfig',{'maskDefinitions':{'9':/\d/,'A':/[a-zA-Z]/,'*':/[a-zA-Z0-9]/}}).directive('uiMask',['uiMaskConfig',function(maskConfig){return{priority:100,require:'ngModel',restrict:'A',compile:function uiMaskCompilingFunction(){var options=maskConfig;return function uiMaskLinkingFunction(scope,iElement,iAttrs,controller){var maskProcessed=false,eventsBound=false,maskCaretMap,maskPatterns,maskPlaceholder,maskComponents,minRequiredLength,value,valueMasked,isValid,originalPlaceholder=iAttrs.placeholder,originalMaxlength=iAttrs.maxlength,oldValue,oldValueUnmasked,oldCaretPosition,oldSelectionLength;function initialize(maskAttr){if(!angular.isDefined(maskAttr)){return uninitialize();}
processRawMask(maskAttr);if(!maskProcessed){return uninitialize();}
initializeElement();bindEventListeners();return true;}
function initPlaceholder(placeholderAttr){if(!angular.isDefined(placeholderAttr)){return;}
maskPlaceholder=placeholderAttr;if(maskProcessed){eventHandler();}}
function formatter(fromModelValue){if(!maskProcessed){return fromModelValue;}
value=unmaskValue(fromModelValue||'');isValid=validateValue(value);controller.$setValidity('mask',isValid);return isValid&&value.length?maskValue(value):undefined;}
function parser(fromViewValue){if(!maskProcessed){return fromViewValue;}
value=unmaskValue(fromViewValue||'');isValid=validateValue(value);controller.$viewValue=value.length?maskValue(value):'';controller.$setValidity('mask',isValid);if(value===''&&controller.$error.required!==undefined){controller.$setValidity('required',false);}
return isValid?value:undefined;}
var linkOptions={};if(iAttrs.uiOptions){linkOptions=scope.$eval('['+iAttrs.uiOptions+']');if(angular.isObject(linkOptions[0])){linkOptions=(function(original,current){for(var i in original){if(Object.prototype.hasOwnProperty.call(original,i)){if(!current[i]){current[i]=angular.copy(original[i]);}else{angular.extend(current[i],original[i]);}}}
return current;})(options,linkOptions[0]);}}else{linkOptions=options;}
iAttrs.$observe('uiMask',initialize);iAttrs.$observe('placeholder',initPlaceholder);controller.$formatters.push(formatter);controller.$parsers.push(parser);function uninitialize(){maskProcessed=false;unbindEventListeners();if(angular.isDefined(originalPlaceholder)){iElement.attr('placeholder',originalPlaceholder);}else{iElement.removeAttr('placeholder');}
if(angular.isDefined(originalMaxlength)){iElement.attr('maxlength',originalMaxlength);}else{iElement.removeAttr('maxlength');}
iElement.val(controller.$modelValue);controller.$viewValue=controller.$modelValue;return false;}
function initializeElement(){value=oldValueUnmasked=unmaskValue(controller.$modelValue||'');valueMasked=oldValue=maskValue(value);isValid=validateValue(value);var viewValue=isValid&&value.length?valueMasked:'';if(iAttrs.maxlength){iElement.attr('maxlength',maskCaretMap[maskCaretMap.length-1]*2);}
iElement.attr('placeholder',maskPlaceholder);iElement.val(viewValue);controller.$viewValue=viewValue;}
function bindEventListeners(){if(eventsBound){return;}
iElement.bind('blur',blurHandler);iElement.bind('mousedown mouseup',mouseDownUpHandler);iElement.bind('input keyup click focus',eventHandler);eventsBound=true;}
function unbindEventListeners(){if(!eventsBound){return;}
iElement.unbind('blur',blurHandler);iElement.unbind('mousedown',mouseDownUpHandler);iElement.unbind('mouseup',mouseDownUpHandler);iElement.unbind('input',eventHandler);iElement.unbind('keyup',eventHandler);iElement.unbind('click',eventHandler);iElement.unbind('focus',eventHandler);eventsBound=false;}
function validateValue(value){return value.length?value.length>=minRequiredLength:true;}
function unmaskValue(value){var valueUnmasked='',maskPatternsCopy=maskPatterns.slice();value=value.toString();angular.forEach(maskComponents,function(component){value=value.replace(component,'');});angular.forEach(value.split(''),function(chr){if(maskPatternsCopy.length&&maskPatternsCopy[0].test(chr)){valueUnmasked+=chr;maskPatternsCopy.shift();}});return valueUnmasked;}
function maskValue(unmaskedValue){var valueMasked='',maskCaretMapCopy=maskCaretMap.slice();angular.forEach(maskPlaceholder.split(''),function(chr,i){if(unmaskedValue.length&&i===maskCaretMapCopy[0]){valueMasked+=unmaskedValue.charAt(0)||'_';unmaskedValue=unmaskedValue.substr(1);maskCaretMapCopy.shift();}
else{valueMasked+=chr;}});return valueMasked;}
function getPlaceholderChar(i){var placeholder=iAttrs.placeholder;if(typeof placeholder!=='undefined'&&placeholder[i]){return placeholder[i];}else{return'_';}}
function getMaskComponents(){return maskPlaceholder.replace(/[_]+/g,'_').replace(/([^_]+)([a-zA-Z0-9])([^_])/g,'$1$2_$3').split('_');}
function processRawMask(mask){var characterCount=0;maskCaretMap=[];maskPatterns=[];maskPlaceholder='';if(typeof mask==='string'){minRequiredLength=0;var isOptional=false,splitMask=mask.split('');angular.forEach(splitMask,function(chr,i){if(linkOptions.maskDefinitions[chr]){maskCaretMap.push(characterCount);maskPlaceholder+=getPlaceholderChar(i);maskPatterns.push(linkOptions.maskDefinitions[chr]);characterCount++;if(!isOptional){minRequiredLength++;}}
else if(chr==='?'){isOptional=true;}
else{maskPlaceholder+=chr;characterCount++;}});}
maskCaretMap.push(maskCaretMap.slice().pop()+1);maskComponents=getMaskComponents();maskProcessed=maskCaretMap.length>1?true:false;}
function blurHandler(){oldCaretPosition=0;oldSelectionLength=0;if(!isValid||value.length===0){valueMasked='';iElement.val('');scope.$apply(function(){controller.$setViewValue('');});}}
function mouseDownUpHandler(e){if(e.type==='mousedown'){iElement.bind('mouseout',mouseoutHandler);}else{iElement.unbind('mouseout',mouseoutHandler);}}
iElement.bind('mousedown mouseup',mouseDownUpHandler);function mouseoutHandler(){oldSelectionLength=getSelectionLength(this);iElement.unbind('mouseout',mouseoutHandler);}
function eventHandler(e){e=e||{};var eventWhich=e.which,eventType=e.type;if(eventWhich===16||eventWhich===91){return;}
var val=iElement.val(),valOld=oldValue,valMasked,valUnmasked=unmaskValue(val),valUnmaskedOld=oldValueUnmasked,valAltered=false,caretPos=getCaretPosition(this)||0,caretPosOld=oldCaretPosition||0,caretPosDelta=caretPos-caretPosOld,caretPosMin=maskCaretMap[0],caretPosMax=maskCaretMap[valUnmasked.length]||maskCaretMap.slice().shift(),selectionLenOld=oldSelectionLength||0,isSelected=getSelectionLength(this)>0,wasSelected=selectionLenOld>0,isAddition=(val.length>valOld.length)||(selectionLenOld&&val.length>valOld.length-selectionLenOld),isDeletion=(val.length<valOld.length)||(selectionLenOld&&val.length===valOld.length-selectionLenOld),isSelection=(eventWhich>=37&&eventWhich<=40)&&e.shiftKey,isKeyLeftArrow=eventWhich===37,isKeyBackspace=eventWhich===8||(eventType!=='keyup'&&isDeletion&&(caretPosDelta===-1)),isKeyDelete=eventWhich===46||(eventType!=='keyup'&&isDeletion&&(caretPosDelta===0)&&!wasSelected),caretBumpBack=(isKeyLeftArrow||isKeyBackspace||eventType==='click')&&caretPos>caretPosMin;oldSelectionLength=getSelectionLength(this);if(isSelection||(isSelected&&(eventType==='click'||eventType==='keyup'))){return;}
if((eventType==='input')&&isDeletion&&!wasSelected&&valUnmasked===valUnmaskedOld){while(isKeyBackspace&&caretPos>caretPosMin&&!isValidCaretPosition(caretPos)){caretPos--;}
while(isKeyDelete&&caretPos<caretPosMax&&maskCaretMap.indexOf(caretPos)===-1){caretPos++;}
var charIndex=maskCaretMap.indexOf(caretPos);valUnmasked=valUnmasked.substring(0,charIndex)+valUnmasked.substring(charIndex+1);valAltered=true;}
valMasked=maskValue(valUnmasked);oldValue=valMasked;oldValueUnmasked=valUnmasked;iElement.val(valMasked);if(valAltered){scope.$apply(function(){controller.$setViewValue(valUnmasked);});}
if(isAddition&&(caretPos<=caretPosMin)){caretPos=caretPosMin+1;}
if(caretBumpBack){caretPos--;}
caretPos=caretPos>caretPosMax?caretPosMax:caretPos<caretPosMin?caretPosMin:caretPos;while(!isValidCaretPosition(caretPos)&&caretPos>caretPosMin&&caretPos<caretPosMax){caretPos+=caretBumpBack?-1:1;}
if((caretBumpBack&&caretPos<caretPosMax)||(isAddition&&!isValidCaretPosition(caretPosOld))){caretPos++;}
oldCaretPosition=caretPos;setCaretPosition(this,caretPos);}
function isValidCaretPosition(pos){return maskCaretMap.indexOf(pos)>-1;}
function getCaretPosition(input){if(!input)return 0;if(input.selectionStart!==undefined){return input.selectionStart;}else if(document.selection){input.focus();var selection=document.selection.createRange();selection.moveStart('character',-input.value.length);return selection.text.length;}
return 0;}
function setCaretPosition(input,pos){if(!input)return 0;if(input.offsetWidth===0||input.offsetHeight===0){return;}
if(input.setSelectionRange){input.focus();input.setSelectionRange(pos,pos);}
else if(input.createTextRange){var range=input.createTextRange();range.collapse(true);range.moveEnd('character',pos);range.moveStart('character',pos);range.select();}}
function getSelectionLength(input){if(!input)return 0;if(input.selectionStart!==undefined){return(input.selectionEnd-input.selectionStart);}
if(document.selection){return(document.selection.createRange().text.length);}
return 0;}
if(!Array.prototype.indexOf){Array.prototype.indexOf=function(searchElement){if(this===null){throw new TypeError();}
var t=Object(this);var len=t.length>>>0;if(len===0){return-1;}
var n=0;if(arguments.length>1){n=Number(arguments[1]);if(n!==n){n=0;}else if(n!==0&&n!==Infinity&&n!==-Infinity){n=(n>0||-1)*Math.floor(Math.abs(n));}}
if(n>=len){return-1;}
var k=n>=0?n:Math.max(len-Math.abs(n),0);for(;k<len;k++){if(k in t&&t[k]===searchElement){return k;}}
return-1;};}};}};}]);'use strict';angular.module('ui.reset',[]).value('uiResetConfig',null).directive('uiReset',['uiResetConfig',function(uiResetConfig){var resetValue=null;if(uiResetConfig!==undefined){resetValue=uiResetConfig;}
return{require:'ngModel',link:function(scope,elm,attrs,ctrl){var aElement;aElement=angular.element('<a class="ui-reset" />');elm.wrap('<span class="ui-resetwrap" />').after(aElement);aElement.bind('click',function(e){e.preventDefault();scope.$apply(function(){if(attrs.uiReset){ctrl.$setViewValue(scope.$eval(attrs.uiReset));}else{ctrl.$setViewValue(resetValue);}
ctrl.$render();});});}};}]);'use strict';angular.module('ui.route',[]).directive('uiRoute',['$location','$parse',function($location,$parse){return{restrict:'AC',scope:true,compile:function(tElement,tAttrs){var useProperty;if(tAttrs.uiRoute){useProperty='uiRoute';}else if(tAttrs.ngHref){useProperty='ngHref';}else if(tAttrs.href){useProperty='href';}else{throw new Error('uiRoute missing a route or href property on '+tElement[0]);}
return function($scope,elm,attrs){var modelSetter=$parse(attrs.ngModel||attrs.routeModel||'$uiRoute').assign;var watcher=angular.noop;function staticWatcher(newVal){var hash=newVal.indexOf('#');if(hash>-1){newVal=newVal.substr(hash+1);}
watcher=function watchHref(){modelSetter($scope,($location.path().indexOf(newVal)>-1));};watcher();}
function regexWatcher(newVal){var hash=newVal.indexOf('#');if(hash>-1){newVal=newVal.substr(hash+1);}
watcher=function watchRegex(){var regexp=new RegExp('^'+newVal+'$',['i']);modelSetter($scope,regexp.test($location.path()));};watcher();}
switch(useProperty){case'uiRoute':if(attrs.uiRoute){regexWatcher(attrs.uiRoute);}else{attrs.$observe('uiRoute',regexWatcher);}
break;case'ngHref':if(attrs.ngHref){staticWatcher(attrs.ngHref);}else{attrs.$observe('ngHref',staticWatcher);}
break;case'href':staticWatcher(attrs.href);}
$scope.$on('$routeChangeSuccess',function(){watcher();});$scope.$on('$stateChangeSuccess',function(){watcher();});};}};}]);'use strict';angular.module('ui.scroll.jqlite',['ui.scroll']).service('jqLiteExtras',['$log','$window',function(console,window){return{registerFor:function(element){var convertToPx,css,getMeasurements,getStyle,getWidthHeight,isWindow,scrollTo;css=angular.element.prototype.css;element.prototype.css=function(name,value){var elem,self;self=this;elem=self[0];if(!(!elem||elem.nodeType===3||elem.nodeType===8||!elem.style)){return css.call(self,name,value);}};isWindow=function(obj){return obj&&obj.document&&obj.location&&obj.alert&&obj.setInterval;};scrollTo=function(self,direction,value){var elem,method,preserve,prop,_ref;elem=self[0];_ref={top:['scrollTop','pageYOffset','scrollLeft'],left:['scrollLeft','pageXOffset','scrollTop']}[direction],method=_ref[0],prop=_ref[1],preserve=_ref[2];if(isWindow(elem)){if(angular.isDefined(value)){return elem.scrollTo(self[preserve].call(self),value);}else{if(prop in elem){return elem[prop];}else{return elem.document.documentElement[method];}}}else{if(angular.isDefined(value)){return elem[method]=value;}else{return elem[method];}}};if(window.getComputedStyle){getStyle=function(elem){return window.getComputedStyle(elem,null);};convertToPx=function(elem,value){return parseFloat(value);};}else{getStyle=function(elem){return elem.currentStyle;};convertToPx=function(elem,value){var core_pnum,left,result,rnumnonpx,rs,rsLeft,style;core_pnum=/[+-]?(?:\d*\.|)\d+(?:[eE][+-]?\d+|)/.source;rnumnonpx=new RegExp('^('+core_pnum+')(?!px)[a-z%]+$','i');if(!rnumnonpx.test(value)){return parseFloat(value);}else{style=elem.style;left=style.left;rs=elem.runtimeStyle;rsLeft=rs&&rs.left;if(rs){rs.left=style.left;}
style.left=value;result=style.pixelLeft;style.left=left;if(rsLeft){rs.left=rsLeft;}
return result;}};}
getMeasurements=function(elem,measure){var base,borderA,borderB,computedMarginA,computedMarginB,computedStyle,dirA,dirB,marginA,marginB,paddingA,paddingB,_ref;if(isWindow(elem)){base=document.documentElement[{height:'clientHeight',width:'clientWidth'}[measure]];return{base:base,padding:0,border:0,margin:0};}
_ref={width:[elem.offsetWidth,'Left','Right'],height:[elem.offsetHeight,'Top','Bottom']}[measure],base=_ref[0],dirA=_ref[1],dirB=_ref[2];computedStyle=getStyle(elem);paddingA=convertToPx(elem,computedStyle['padding'+dirA])||0;paddingB=convertToPx(elem,computedStyle['padding'+dirB])||0;borderA=convertToPx(elem,computedStyle['border'+dirA+'Width'])||0;borderB=convertToPx(elem,computedStyle['border'+dirB+'Width'])||0;computedMarginA=computedStyle['margin'+dirA];computedMarginB=computedStyle['margin'+dirB];marginA=convertToPx(elem,computedMarginA)||0;marginB=convertToPx(elem,computedMarginB)||0;return{base:base,padding:paddingA+paddingB,border:borderA+borderB,margin:marginA+marginB};};getWidthHeight=function(elem,direction,measure){var computedStyle,measurements,result;measurements=getMeasurements(elem,direction);if(measurements.base>0){return{base:measurements.base-measurements.padding-measurements.border,outer:measurements.base,outerfull:measurements.base+measurements.margin}[measure];}else{computedStyle=getStyle(elem);result=computedStyle[direction];if(result<0||result===null){result=elem.style[direction]||0;}
result=parseFloat(result)||0;return{base:result-measurements.padding-measurements.border,outer:result,outerfull:result+measurements.padding+measurements.border+measurements.margin}[measure];}};return angular.forEach({before:function(newElem){var children,elem,i,parent,self,_i,_ref;self=this;elem=self[0];parent=self.parent();children=parent.contents();if(children[0]===elem){return parent.prepend(newElem);}else{for(i=_i=1,_ref=children.length-1;1<=_ref?_i<=_ref:_i>=_ref;i=1<=_ref?++_i:--_i){if(children[i]===elem){angular.element(children[i-1]).after(newElem);return;}}
throw new Error('invalid DOM structure '+elem.outerHTML);}},height:function(value){var self;self=this;if(angular.isDefined(value)){if(angular.isNumber(value)){value=value+'px';}
return css.call(self,'height',value);}else{return getWidthHeight(this[0],'height','base');}},outerHeight:function(option){return getWidthHeight(this[0],'height',option?'outerfull':'outer');},offset:function(value){var box,doc,docElem,elem,self,win;self=this;if(arguments.length){if(value===void 0){return self;}else{return value;}}
box={top:0,left:0};elem=self[0];doc=elem&&elem.ownerDocument;if(!doc){return;}
docElem=doc.documentElement;if(elem.getBoundingClientRect){box=elem.getBoundingClientRect();}
win=doc.defaultView||doc.parentWindow;return{top:box.top+(win.pageYOffset||docElem.scrollTop)-(docElem.clientTop||0),left:box.left+(win.pageXOffset||docElem.scrollLeft)-(docElem.clientLeft||0)};},scrollTop:function(value){return scrollTo(this,'top',value);},scrollLeft:function(value){return scrollTo(this,'left',value);}},function(value,key){if(!element.prototype[key]){return element.prototype[key]=value;}});}};}]).run(['$log','$window','jqLiteExtras',function(console,window,jqLiteExtras){if(!window.jQuery){return jqLiteExtras.registerFor(angular.element);}}]);'use strict';'use strict';angular.module('ui.scroll',[]).directive('ngScrollViewport',['$log',function(){return{controller:['$scope','$element',function(scope,element){return element;}]};}]).directive('uiScrollViewport',['$log',function(){return{controller:['$scope','$element',function(scope,element){this.viewport=element;return this;}]};}]).directive('ngScroll',['$log','$injector','$rootScope','$timeout',function(console,$injector,$rootScope,$timeout){return{require:['?^ngScrollViewport'],transclude:'element',priority:1000,terminal:true,compile:function(element,attr,linker){return function($scope,$element,$attr,controllers){var adapter,adjustBuffer,adjustRowHeight,bof,bottomVisiblePos,buffer,bufferPadding,bufferSize,clipBottom,clipTop,datasource,datasourceName,enqueueFetch,eof,eventListener,fetch,finalize,first,insert,isDatasource,isLoading,itemName,loading,match,next,pending,reload,removeFromBuffer,resizeHandler,scrollHandler,scrollHeight,shouldLoadBottom,shouldLoadTop,tempScope,topVisiblePos,viewport;match=$attr.ngScroll.match(/^\s*(\w+)\s+in\s+(\w+)\s*$/);if(!match){throw new Error('Expected ngScroll in form of "item_ in _datasource_" but got "'+$attr.ngScroll+'"');}
itemName=match[1];datasourceName=match[2];isDatasource=function(datasource){return angular.isObject(datasource)&&datasource.get&&angular.isFunction(datasource.get);};datasource=$scope[datasourceName];if(!isDatasource(datasource)){datasource=$injector.get(datasourceName);if(!isDatasource(datasource)){throw new Error(datasourceName+' is not a valid datasource');}}
bufferSize=Math.max(3,+$attr.bufferSize||10);bufferPadding=function(){return viewport.height()*Math.max(0.1,+$attr.padding||0.1);};scrollHeight=function(elem){return elem[0].scrollHeight||elem[0].document.documentElement.scrollHeight;};adapter=null;linker(tempScope=$scope.$new(),function(template){var bottomPadding,createPadding,padding,repeaterType,topPadding,viewport;repeaterType=template[0].localName;if(repeaterType==='dl'){throw new Error('ng-scroll directive does not support <'+template[0].localName+'> as a repeating tag: '+template[0].outerHTML);}
if(repeaterType!=='li'&&repeaterType!=='tr'){repeaterType='div';}
viewport=controllers[0]||angular.element(window);viewport.css({'overflow-y':'auto','display':'block'});padding=function(repeaterType){var div,result,table;switch(repeaterType){case'tr':table=angular.element('<table><tr><td><div></div></td></tr></table>');div=table.find('div');result=table.find('tr');result.paddingHeight=function(){return div.height.apply(div,arguments);};return result;default:result=angular.element('<'+repeaterType+'></'+repeaterType+'>');result.paddingHeight=result.height;return result;}};createPadding=function(padding,element,direction){element[{top:'before',bottom:'after'}[direction]](padding);return{paddingHeight:function(){return padding.paddingHeight.apply(padding,arguments);},insert:function(element){return padding[{top:'after',bottom:'before'}[direction]](element);}};};topPadding=createPadding(padding(repeaterType),element,'top');bottomPadding=createPadding(padding(repeaterType),element,'bottom');tempScope.$destroy();return adapter={viewport:viewport,topPadding:topPadding.paddingHeight,bottomPadding:bottomPadding.paddingHeight,append:bottomPadding.insert,prepend:topPadding.insert,bottomDataPos:function(){return scrollHeight(viewport)-bottomPadding.paddingHeight();},topDataPos:function(){return topPadding.paddingHeight();}};});viewport=adapter.viewport;first=1;next=1;buffer=[];pending=[];eof=false;bof=false;loading=datasource.loading||function(){};isLoading=false;removeFromBuffer=function(start,stop){var i,_i;for(i=_i=start;start<=stop?_i<stop:_i>stop;i=start<=stop?++_i:--_i){buffer[i].scope.$destroy();buffer[i].element.remove();}
return buffer.splice(start,stop-start);};reload=function(){first=1;next=1;removeFromBuffer(0,buffer.length);adapter.topPadding(0);adapter.bottomPadding(0);pending=[];eof=false;bof=false;return adjustBuffer(false);};bottomVisiblePos=function(){return viewport.scrollTop()+viewport.height();};topVisiblePos=function(){return viewport.scrollTop();};shouldLoadBottom=function(){return!eof&&adapter.bottomDataPos()<bottomVisiblePos()+bufferPadding();};clipBottom=function(){var bottomHeight,i,itemHeight,overage,_i,_ref;bottomHeight=0;overage=0;for(i=_i=_ref=buffer.length-1;_ref<=0?_i<=0:_i>=0;i=_ref<=0?++_i:--_i){itemHeight=buffer[i].element.outerHeight(true);if(adapter.bottomDataPos()-bottomHeight-itemHeight>bottomVisiblePos()+bufferPadding()){bottomHeight+=itemHeight;overage++;eof=false;}else{break;}}
if(overage>0){adapter.bottomPadding(adapter.bottomPadding()+bottomHeight);removeFromBuffer(buffer.length-overage,buffer.length);next-=overage;return console.log('clipped off bottom '+overage+' bottom padding '+(adapter.bottomPadding()));}};shouldLoadTop=function(){return!bof&&(adapter.topDataPos()>topVisiblePos()-bufferPadding());};clipTop=function(){var item,itemHeight,overage,topHeight,_i,_len;topHeight=0;overage=0;for(_i=0,_len=buffer.length;_i<_len;_i++){item=buffer[_i];itemHeight=item.element.outerHeight(true);if(adapter.topDataPos()+topHeight+itemHeight<topVisiblePos()-bufferPadding()){topHeight+=itemHeight;overage++;bof=false;}else{break;}}
if(overage>0){adapter.topPadding(adapter.topPadding()+topHeight);removeFromBuffer(0,overage);first+=overage;return console.log('clipped off top '+overage+' top padding '+(adapter.topPadding()));}};enqueueFetch=function(direction,scrolling){if(!isLoading){isLoading=true;loading(true);}
if(pending.push(direction)===1){return fetch(scrolling);}};insert=function(index,item){var itemScope,toBeAppended,wrapper;itemScope=$scope.$new();itemScope[itemName]=item;toBeAppended=index>first;itemScope.$index=index;if(toBeAppended){itemScope.$index--;}
wrapper={scope:itemScope};linker(itemScope,function(clone){wrapper.element=clone;if(toBeAppended){if(index===next){adapter.append(clone);return buffer.push(wrapper);}else{buffer[index-first].element.after(clone);return buffer.splice(index-first+1,0,wrapper);}}else{adapter.prepend(clone);return buffer.unshift(wrapper);}});return{appended:toBeAppended,wrapper:wrapper};};adjustRowHeight=function(appended,wrapper){var newHeight;if(appended){return adapter.bottomPadding(Math.max(0,adapter.bottomPadding()-wrapper.element.outerHeight(true)));}else{newHeight=adapter.topPadding()-wrapper.element.outerHeight(true);if(newHeight>=0){return adapter.topPadding(newHeight);}else{return viewport.scrollTop(viewport.scrollTop()+wrapper.element.outerHeight(true));}}};adjustBuffer=function(scrolling,newItems,finalize){var doAdjustment;doAdjustment=function(){console.log('top {actual='+(adapter.topDataPos())+' visible from='+(topVisiblePos())+' bottom {visible through='+(bottomVisiblePos())+' actual='+(adapter.bottomDataPos())+'}');if(shouldLoadBottom()){enqueueFetch(true,scrolling);}else{if(shouldLoadTop()){enqueueFetch(false,scrolling);}}
if(finalize){return finalize();}};if(newItems){return $timeout(function(){var row,_i,_len;for(_i=0,_len=newItems.length;_i<_len;_i++){row=newItems[_i];adjustRowHeight(row.appended,row.wrapper);}
return doAdjustment();});}else{return doAdjustment();}};finalize=function(scrolling,newItems){return adjustBuffer(scrolling,newItems,function(){pending.shift();if(pending.length===0){isLoading=false;return loading(false);}else{return fetch(scrolling);}});};fetch=function(scrolling){var direction;direction=pending[0];if(direction){if(buffer.length&&!shouldLoadBottom()){return finalize(scrolling);}else{return datasource.get(next,bufferSize,function(result){var item,newItems,_i,_len;newItems=[];if(result.length===0){eof=true;adapter.bottomPadding(0);console.log('appended: requested '+bufferSize+' records starting from '+next+' recieved: eof');}else{clipTop();for(_i=0,_len=result.length;_i<_len;_i++){item=result[_i];newItems.push(insert(++next,item));}
console.log('appended: requested '+bufferSize+' received '+result.length+' buffer size '+buffer.length+' first '+first+' next '+next);}
return finalize(scrolling,newItems);});}}else{if(buffer.length&&!shouldLoadTop()){return finalize(scrolling);}else{return datasource.get(first-bufferSize,bufferSize,function(result){var i,newItems,_i,_ref;newItems=[];if(result.length===0){bof=true;adapter.topPadding(0);console.log('prepended: requested '+bufferSize+' records starting from '+(first-bufferSize)+' recieved: bof');}else{clipBottom();for(i=_i=_ref=result.length-1;_ref<=0?_i<=0:_i>=0;i=_ref<=0?++_i:--_i){newItems.unshift(insert(--first,result[i]));}
console.log('prepended: requested '+bufferSize+' received '+result.length+' buffer size '+buffer.length+' first '+first+' next '+next);}
return finalize(scrolling,newItems);});}}};resizeHandler=function(){if(!$rootScope.$$phase&&!isLoading){adjustBuffer(false);return $scope.$apply();}};viewport.bind('resize',resizeHandler);scrollHandler=function(){if(!$rootScope.$$phase&&!isLoading){adjustBuffer(true);return $scope.$apply();}};viewport.bind('scroll',scrollHandler);$scope.$watch(datasource.revision,function(){return reload();});if(datasource.scope){eventListener=datasource.scope.$new();}else{eventListener=$scope.$new();}
$scope.$on('$destroy',function(){eventListener.$destroy();viewport.unbind('resize',resizeHandler);return viewport.unbind('scroll',scrollHandler);});eventListener.$on('update.items',function(event,locator,newItem){var wrapper,_fn,_i,_len,_ref;if(angular.isFunction(locator)){_fn=function(wrapper){return locator(wrapper.scope);};for(_i=0,_len=buffer.length;_i<_len;_i++){wrapper=buffer[_i];_fn(wrapper);}}else{if((0<=(_ref=locator-first-1)&&_ref<buffer.length)){buffer[locator-first-1].scope[itemName]=newItem;}}
return null;});eventListener.$on('delete.items',function(event,locator){var i,item,temp,wrapper,_fn,_i,_j,_k,_len,_len1,_len2,_ref;if(angular.isFunction(locator)){temp=[];for(_i=0,_len=buffer.length;_i<_len;_i++){item=buffer[_i];temp.unshift(item);}
_fn=function(wrapper){if(locator(wrapper.scope)){removeFromBuffer(temp.length-1-i,temp.length-i);return next--;}};for(i=_j=0,_len1=temp.length;_j<_len1;i=++_j){wrapper=temp[i];_fn(wrapper);}}else{if((0<=(_ref=locator-first-1)&&_ref<buffer.length)){removeFromBuffer(locator-first-1,locator-first);next--;}}
for(i=_k=0,_len2=buffer.length;_k<_len2;i=++_k){item=buffer[i];item.scope.$index=first+i;}
return adjustBuffer(false);});return eventListener.$on('insert.item',function(event,locator,item){var i,inserted,temp,wrapper,_fn,_i,_j,_k,_len,_len1,_len2,_ref;inserted=[];if(angular.isFunction(locator)){temp=[];for(_i=0,_len=buffer.length;_i<_len;_i++){item=buffer[_i];temp.unshift(item);}
_fn=function(wrapper){var j,newItems,_k,_len2,_results;if(newItems=locator(wrapper.scope)){insert=function(index,newItem){insert(index,newItem);return next++;};if(angular.isArray(newItems)){_results=[];for(j=_k=0,_len2=newItems.length;_k<_len2;j=++_k){item=newItems[j];_results.push(inserted.push(insert(i+j,item)));}
return _results;}else{return inserted.push(insert(i,newItems));}}};for(i=_j=0,_len1=temp.length;_j<_len1;i=++_j){wrapper=temp[i];_fn(wrapper);}}else{if((0<=(_ref=locator-first-1)&&_ref<buffer.length)){inserted.push(insert(locator,item));next++;}}
for(i=_k=0,_len2=buffer.length;_k<_len2;i=++_k){item=buffer[i];item.scope.$index=first+i;}
return adjustBuffer(false,inserted);});};}};}]).directive('uiScroll',['$log','$injector','$rootScope','$timeout',function(console,$injector,$rootScope,$timeout){return{require:['?^uiScrollViewport'],transclude:'element',priority:1000,terminal:true,compile:function(elementTemplate,attr,linker){return function($scope,element,$attr,controllers){var adapter,adjustBuffer,adjustRowHeight,bof,bottomVisiblePos,buffer,bufferPadding,bufferSize,clipBottom,clipTop,datasource,datasourceName,doAdjustment,enqueueFetch,eof,eventListener,fetch,finalize,first,getValueChain,hideElementBeforeAppend,insert,isDatasource,isLoading,itemName,loading,log,match,next,pending,reload,removeFromBuffer,resizeHandler,ridActual,scrollHandler,scrollHeight,shouldLoadBottom,shouldLoadTop,showElementAfterRender,tempScope,topVisible,topVisibleElement,topVisibleItem,topVisiblePos,topVisibleScope,viewport,viewportScope,wheelHandler;log=console.debug||console.log;match=$attr.uiScroll.match(/^\s*(\w+)\s+in\s+([\w\.]+)\s*$/);if(!match){throw new Error('Expected uiScroll in form of \'_item_ in _datasource_\' but got \''+$attr.uiScroll+'\'');}
itemName=match[1];datasourceName=match[2];isDatasource=function(datasource){return angular.isObject(datasource)&&datasource.get&&angular.isFunction(datasource.get);};getValueChain=function(targetScope,target){var chain;if(!targetScope){return null;}
chain=target.match(/^([\w]+)\.(.+)$/);if(!chain||chain.length!==3){return targetScope[target];}
return getValueChain(targetScope[chain[1]],chain[2]);};datasource=getValueChain($scope,datasourceName);if(!isDatasource(datasource)){datasource=$injector.get(datasourceName);if(!isDatasource(datasource)){throw new Error(''+datasourceName+' is not a valid datasource');}}
bufferSize=Math.max(3,+$attr.bufferSize||10);bufferPadding=function(){return viewport.outerHeight()*Math.max(0.1,+$attr.padding||0.1);};scrollHeight=function(elem){var _ref;return(_ref=elem[0].scrollHeight)!=null?_ref:elem[0].document.documentElement.scrollHeight;};adapter=null;linker(tempScope=$scope.$new(),function(template){var bottomPadding,createPadding,padding,repeaterType,topPadding,viewport;repeaterType=template[0].localName;if(repeaterType==='dl'){throw new Error('ui-scroll directive does not support <'+template[0].localName+'> as a repeating tag: '+template[0].outerHTML);}
if(repeaterType!=='li'&&repeaterType!=='tr'){repeaterType='div';}
viewport=controllers[0]&&controllers[0].viewport?controllers[0].viewport:angular.element(window);viewport.css({'overflow-y':'auto','display':'block'});padding=function(repeaterType){var div,result,table;switch(repeaterType){case'tr':table=angular.element('<table><tr><td><div></div></td></tr></table>');div=table.find('div');result=table.find('tr');result.paddingHeight=function(){return div.height.apply(div,arguments);};return result;default:result=angular.element('<'+repeaterType+'></'+repeaterType+'>');result.paddingHeight=result.height;return result;}};createPadding=function(padding,element,direction){element[{top:'before',bottom:'after'}[direction]](padding);return{paddingHeight:function(){return padding.paddingHeight.apply(padding,arguments);},insert:function(element){return padding[{top:'after',bottom:'before'}[direction]](element);}};};topPadding=createPadding(padding(repeaterType),element,'top');bottomPadding=createPadding(padding(repeaterType),element,'bottom');tempScope.$destroy();return adapter={viewport:viewport,topPadding:topPadding.paddingHeight,bottomPadding:bottomPadding.paddingHeight,append:bottomPadding.insert,prepend:topPadding.insert,bottomDataPos:function(){return scrollHeight(viewport)-bottomPadding.paddingHeight();},topDataPos:function(){return topPadding.paddingHeight();}};});viewport=adapter.viewport;viewportScope=viewport.scope()||$rootScope;if(angular.isDefined($attr.topVisible)){topVisibleItem=function(item){return viewportScope[$attr.topVisible]=item;};}
if(angular.isDefined($attr.topVisibleElement)){topVisibleElement=function(element){return viewportScope[$attr.topVisibleElement]=element;};}
if(angular.isDefined($attr.topVisibleScope)){topVisibleScope=function(scope){return viewportScope[$attr.topVisibleScope]=scope;};}
topVisible=function(item){if(topVisibleItem){topVisibleItem(item.scope[itemName]);}
if(topVisibleElement){topVisibleElement(item.element);}
if(topVisibleScope){topVisibleScope(item.scope);}
if(datasource.topVisible){return datasource.topVisible(item);}};if(angular.isDefined($attr.isLoading)){loading=function(value){viewportScope[$attr.isLoading]=value;if(datasource.loading){return datasource.loading(value);}};}else{loading=function(value){if(datasource.loading){return datasource.loading(value);}};}
ridActual=0;first=1;next=1;buffer=[];pending=[];eof=false;bof=false;isLoading=false;removeFromBuffer=function(start,stop){var i,_i;for(i=_i=start;start<=stop?_i<stop:_i>stop;i=start<=stop?++_i:--_i){buffer[i].scope.$destroy();buffer[i].element.remove();}
return buffer.splice(start,stop-start);};reload=function(){ridActual++;first=1;next=1;removeFromBuffer(0,buffer.length);adapter.topPadding(0);adapter.bottomPadding(0);pending=[];eof=false;bof=false;return adjustBuffer(ridActual,false);};bottomVisiblePos=function(){return viewport.scrollTop()+viewport.outerHeight();};topVisiblePos=function(){return viewport.scrollTop();};shouldLoadBottom=function(){return!eof&&adapter.bottomDataPos()<bottomVisiblePos()+bufferPadding();};clipBottom=function(){var bottomHeight,i,item,itemHeight,itemTop,newRow,overage,rowTop,_i,_ref;bottomHeight=0;overage=0;for(i=_i=_ref=buffer.length-1;_ref<=0?_i<=0:_i>=0;i=_ref<=0?++_i:--_i){item=buffer[i];itemTop=item.element.offset().top;newRow=rowTop!==itemTop;rowTop=itemTop;if(newRow){itemHeight=item.element.outerHeight(true);}
if(adapter.bottomDataPos()-bottomHeight-itemHeight>bottomVisiblePos()+bufferPadding()){if(newRow){bottomHeight+=itemHeight;}
overage++;eof=false;}else{if(newRow){break;}
overage++;}}
if(overage>0){adapter.bottomPadding(adapter.bottomPadding()+bottomHeight);removeFromBuffer(buffer.length-overage,buffer.length);next-=overage;return log('clipped off bottom '+overage+' bottom padding '+(adapter.bottomPadding()));}};shouldLoadTop=function(){return!bof&&(adapter.topDataPos()>topVisiblePos()-bufferPadding());};clipTop=function(){var item,itemHeight,itemTop,newRow,overage,rowTop,topHeight,_i,_len;topHeight=0;overage=0;for(_i=0,_len=buffer.length;_i<_len;_i++){item=buffer[_i];itemTop=item.element.offset().top;newRow=rowTop!==itemTop;rowTop=itemTop;if(newRow){itemHeight=item.element.outerHeight(true);}
if(adapter.topDataPos()+topHeight+itemHeight<topVisiblePos()-bufferPadding()){if(newRow){topHeight+=itemHeight;}
overage++;bof=false;}else{if(newRow){break;}
overage++;}}
if(overage>0){adapter.topPadding(adapter.topPadding()+topHeight);removeFromBuffer(0,overage);first+=overage;return log('clipped off top '+overage+' top padding '+(adapter.topPadding()));}};enqueueFetch=function(rid,direction,scrolling){if(!isLoading){isLoading=true;loading(true);}
if(pending.push(direction)===1){return fetch(rid,scrolling);}};hideElementBeforeAppend=function(element){element.displayTemp=element.css('display');return element.css('display','none');};showElementAfterRender=function(element){if(element.hasOwnProperty('displayTemp')){return element.css('display',element.displayTemp);}};insert=function(index,item){var itemScope,toBeAppended,wrapper;itemScope=$scope.$new();itemScope[itemName]=item;toBeAppended=index>first;itemScope.$index=index;if(toBeAppended){itemScope.$index--;}
wrapper={scope:itemScope};linker(itemScope,function(clone){wrapper.element=clone;if(toBeAppended){if(index===next){hideElementBeforeAppend(clone);adapter.append(clone);return buffer.push(wrapper);}else{buffer[index-first].element.after(clone);return buffer.splice(index-first+1,0,wrapper);}}else{hideElementBeforeAppend(clone);adapter.prepend(clone);return buffer.unshift(wrapper);}});return{appended:toBeAppended,wrapper:wrapper};};adjustRowHeight=function(appended,wrapper){var newHeight;if(appended){return adapter.bottomPadding(Math.max(0,adapter.bottomPadding()-wrapper.element.outerHeight(true)));}else{newHeight=adapter.topPadding()-wrapper.element.outerHeight(true);if(newHeight>=0){return adapter.topPadding(newHeight);}else{return viewport.scrollTop(viewport.scrollTop()+wrapper.element.outerHeight(true));}}};doAdjustment=function(rid,scrolling,finalize){var item,itemHeight,itemTop,newRow,rowTop,topHeight,_i,_len,_results;log('top {actual='+(adapter.topDataPos())+' visible from='+(topVisiblePos())+' bottom {visible through='+(bottomVisiblePos())+' actual='+(adapter.bottomDataPos())+'}');if(shouldLoadBottom()){enqueueFetch(rid,true,scrolling);}else{if(shouldLoadTop()){enqueueFetch(rid,false,scrolling);}}
if(finalize){finalize(rid);}
if(pending.length===0){topHeight=0;_results=[];for(_i=0,_len=buffer.length;_i<_len;_i++){item=buffer[_i];itemTop=item.element.offset().top;newRow=rowTop!==itemTop;rowTop=itemTop;if(newRow){itemHeight=item.element.outerHeight(true);}
if(newRow&&(adapter.topDataPos()+topHeight+itemHeight<topVisiblePos())){_results.push(topHeight+=itemHeight);}else{if(newRow){topVisible(item);}
break;}}
return _results;}};adjustBuffer=function(rid,scrolling,newItems,finalize){if(newItems&&newItems.length){return $timeout(function(){var itemTop,row,rowTop,rows,_i,_j,_len,_len1;rows=[];for(_i=0,_len=newItems.length;_i<_len;_i++){row=newItems[_i];element=row.wrapper.element;showElementAfterRender(element);itemTop=element.offset().top;if(rowTop!==itemTop){rows.push(row);rowTop=itemTop;}}
for(_j=0,_len1=rows.length;_j<_len1;_j++){row=rows[_j];adjustRowHeight(row.appended,row.wrapper);}
return doAdjustment(rid,scrolling,finalize);});}else{return doAdjustment(rid,scrolling,finalize);}};finalize=function(rid,scrolling,newItems){return adjustBuffer(rid,scrolling,newItems,function(){pending.shift();if(pending.length===0){isLoading=false;return loading(false);}else{return fetch(rid,scrolling);}});};fetch=function(rid,scrolling){var direction;direction=pending[0];if(direction){if(buffer.length&&!shouldLoadBottom()){return finalize(rid,scrolling);}else{return datasource.get(next,bufferSize,function(result){var item,newItems,_i,_len;if(rid&&rid!==ridActual){return;}
newItems=[];if(result.length<bufferSize){eof=true;adapter.bottomPadding(0);}
if(result.length>0){clipTop();for(_i=0,_len=result.length;_i<_len;_i++){item=result[_i];newItems.push(insert(++next,item));}}
return finalize(rid,scrolling,newItems);});}}else{if(buffer.length&&!shouldLoadTop()){return finalize(rid,scrolling);}else{return datasource.get(first-bufferSize,bufferSize,function(result){var i,newItems,_i,_ref;if(rid&&rid!==ridActual){return;}
newItems=[];if(result.length<bufferSize){bof=true;adapter.topPadding(0);}
if(result.length>0){if(buffer.length){clipBottom();}
for(i=_i=_ref=result.length-1;_ref<=0?_i<=0:_i>=0;i=_ref<=0?++_i:--_i){newItems.unshift(insert(--first,result[i]));}}
return finalize(rid,scrolling,newItems);});}}};resizeHandler=function(){if(!$rootScope.$$phase&&!isLoading){adjustBuffer(null,false);return $scope.$apply();}};viewport.bind('resize',resizeHandler);scrollHandler=function(){if(!$rootScope.$$phase&&!isLoading){adjustBuffer(null,true);return $scope.$apply();}};viewport.bind('scroll',scrollHandler);wheelHandler=function(event){var scrollTop,yMax;scrollTop=viewport[0].scrollTop;yMax=viewport[0].scrollHeight-viewport[0].clientHeight;if((scrollTop===0&&!bof)||(scrollTop===yMax&&!eof)){return event.preventDefault();}};viewport.bind('mousewheel',wheelHandler);$scope.$watch(datasource.revision,function(){return reload();});if(datasource.scope){eventListener=datasource.scope.$new();}else{eventListener=$scope.$new();}
$scope.$on('$destroy',function(){eventListener.$destroy();viewport.unbind('resize',resizeHandler);viewport.unbind('scroll',scrollHandler);return viewport.unbind('mousewheel',wheelHandler);});eventListener.$on('update.items',function(event,locator,newItem){var wrapper,_fn,_i,_len,_ref;if(angular.isFunction(locator)){_fn=function(wrapper){return locator(wrapper.scope);};for(_i=0,_len=buffer.length;_i<_len;_i++){wrapper=buffer[_i];_fn(wrapper);}}else{if((0<=(_ref=locator-first-1)&&_ref<buffer.length)){buffer[locator-first-1].scope[itemName]=newItem;}}
return null;});eventListener.$on('delete.items',function(event,locator){var i,item,temp,wrapper,_fn,_i,_j,_k,_len,_len1,_len2,_ref;if(angular.isFunction(locator)){temp=[];for(_i=0,_len=buffer.length;_i<_len;_i++){item=buffer[_i];temp.unshift(item);}
_fn=function(wrapper){if(locator(wrapper.scope)){removeFromBuffer(temp.length-1-i,temp.length-i);return next--;}};for(i=_j=0,_len1=temp.length;_j<_len1;i=++_j){wrapper=temp[i];_fn(wrapper);}}else{if((0<=(_ref=locator-first-1)&&_ref<buffer.length)){removeFromBuffer(locator-first-1,locator-first);next--;}}
for(i=_k=0,_len2=buffer.length;_k<_len2;i=++_k){item=buffer[i];item.scope.$index=first+i;}
return adjustBuffer(null,false);});return eventListener.$on('insert.item',function(event,locator,item){var i,inserted,_i,_len,_ref;inserted=[];if(angular.isFunction(locator)){throw new Error('not implemented - Insert with locator function');}else{if((0<=(_ref=locator-first-1)&&_ref<buffer.length)){inserted.push(insert(locator,item));next++;}}
for(i=_i=0,_len=buffer.length;_i<_len;i=++_i){item=buffer[i];item.scope.$index=first+i;}
return adjustBuffer(null,false,inserted);});};}};}]);'use strict';angular.module('ui.scrollfix',[]).directive('uiScrollfix',['$window',function($window){return{require:'^?uiScrollfixTarget',link:function(scope,elm,attrs,uiScrollfixTarget){var top=elm[0].offsetTop,$target=uiScrollfixTarget&&uiScrollfixTarget.$element||angular.element($window);if(!attrs.uiScrollfix){attrs.uiScrollfix=top;}else if(typeof(attrs.uiScrollfix)==='string'){if(angular.isDefined(scope[attrs.uiScrollfix])){attrs.uiScrollfix=scope[attrs.uiScrollfix];attrs.isFunction=true;}else if(attrs.uiScrollfix.charAt(0)==='-'){attrs.uiScrollfix=top-parseFloat(attrs.uiScrollfix.substr(1));}else if(attrs.uiScrollfix.charAt(0)==='+'){attrs.uiScrollfix=top+parseFloat(attrs.uiScrollfix.substr(1));}}
function onScroll(e){var offset;if(angular.isDefined(jQuery(e.target).scrollTop())){offset=jQuery(e.target).scrollTop();}else if(angular.isDefined($target[0].scrollTop)){offset=$target[0].scrollTop;}else if(angular.isDefined($window.pageYOffset)){offset=$window.pageYOffset;}else{var iebody=(document.compatMode&&document.compatMode!=='BackCompat')?document.documentElement:document.body;offset=iebody.scrollTop;}
var fixFrom;if(attrs.isFunction){fixFrom=attrs.uiScrollfix();}else{fixFrom=attrs.uiScrollfix;}
if(!elm.hasClass('ui-scrollfix')&&offset>fixFrom){elm.addClass('ui-scrollfix');scope.$evalAsync(function(){angular.element($window).resize();});}else if(elm.hasClass('ui-scrollfix')&&offset<fixFrom){elm.removeClass('ui-scrollfix');}}
$target.on('scroll',onScroll);angular.element($window).on('scroll',onScroll);scope.$on('$destroy',function(){$target.off('scroll',onScroll);angular.element($window).off('scroll',onScroll);});}};}]).directive('uiScrollfixTarget',[function(){return{controller:['$element',function($element){this.$element=$element;}]};}]);'use strict';angular.module('ui.showhide',[]).directive('uiShow',[function(){return function(scope,elm,attrs){scope.$watch(attrs.uiShow,function(newVal){if(newVal){elm.addClass('ui-show');}else{elm.removeClass('ui-show');}});};}]).directive('uiHide',[function(){return function(scope,elm,attrs){scope.$watch(attrs.uiHide,function(newVal){if(newVal){elm.addClass('ui-hide');}else{elm.removeClass('ui-hide');}});};}]).directive('uiToggle',[function(){return function(scope,elm,attrs){scope.$watch(attrs.uiToggle,function(newVal){if(newVal){elm.removeClass('ui-hide').addClass('ui-show');}else{elm.removeClass('ui-show').addClass('ui-hide');}});};}]);'use strict';angular.module('ui.unique',[]).filter('unique',['$parse',function($parse){return function(items,filterOn){if(filterOn===false){return items;}
if((filterOn||angular.isUndefined(filterOn))&&angular.isArray(items)){var newItems=[],get=angular.isString(filterOn)?$parse(filterOn):function(item){return item;};var extractValueToCompare=function(item){return angular.isObject(item)?get(item):item;};angular.forEach(items,function(item){var isDuplicate=false;for(var i=0;i<newItems.length;i++){if(angular.equals(extractValueToCompare(newItems[i]),extractValueToCompare(item))){isDuplicate=true;break;}}
if(!isDuplicate){newItems.push(item);}});items=newItems;}
return items;};}]);'use strict';angular.module('ui.validate',[]).directive('uiValidate',function(){return{restrict:'A',require:'ngModel',link:function(scope,elm,attrs,ctrl){var validateFn,validators={},validateExpr=scope.$eval(attrs.uiValidate);if(!validateExpr){return;}
if(angular.isString(validateExpr)){validateExpr={validator:validateExpr};}
angular.forEach(validateExpr,function(exprssn,key){validateFn=function(valueToValidate){var expression=scope.$eval(exprssn,{'$value':valueToValidate});if(angular.isObject(expression)&&angular.isFunction(expression.then)){expression.then(function(){ctrl.$setValidity(key,true);},function(){ctrl.$setValidity(key,false);});return valueToValidate;}else if(expression){ctrl.$setValidity(key,true);return valueToValidate;}else{ctrl.$setValidity(key,false);return valueToValidate;}};validators[key]=validateFn;ctrl.$formatters.push(validateFn);ctrl.$parsers.push(validateFn);});function apply_watch(watch)
{if(angular.isString(watch))
{scope.$watch(watch,function(){angular.forEach(validators,function(validatorFn){validatorFn(ctrl.$modelValue);});});return;}
if(angular.isArray(watch))
{angular.forEach(watch,function(expression){scope.$watch(expression,function()
{angular.forEach(validators,function(validatorFn){validatorFn(ctrl.$modelValue);});});});return;}
if(angular.isObject(watch))
{angular.forEach(watch,function(expression,validatorKey)
{if(angular.isString(expression))
{scope.$watch(expression,function(){validators[validatorKey](ctrl.$modelValue);});}
if(angular.isArray(expression))
{angular.forEach(expression,function(intExpression)
{scope.$watch(intExpression,function(){validators[validatorKey](ctrl.$modelValue);});});}});}}
if(attrs.uiValidateWatch){apply_watch(scope.$eval(attrs.uiValidateWatch));}}};});angular.module('ui.utils',['ui.event','ui.format','ui.highlight','ui.include','ui.indeterminate','ui.inflector','ui.jq','ui.keypress','ui.mask','ui.reset','ui.route','ui.scrollfix','ui.scroll','ui.scroll.jqlite','ui.showhide','ui.unique','ui.validate']);;+function($){'use strict';function transitionEnd(){var el=document.createElement('bootstrap')
var transEndEventNames={WebkitTransition:'webkitTransitionEnd',MozTransition:'transitionend',OTransition:'oTransitionEnd otransitionend',transition:'transitionend'}
for(var name in transEndEventNames){if(el.style[name]!==undefined){return{end:transEndEventNames[name]}}}
return false}
$.fn.emulateTransitionEnd=function(duration){var called=false
var $el=this
$(this).one('bsTransitionEnd',function(){called=true})
var callback=function(){if(!called)$($el).trigger($.support.transition.end)}
setTimeout(callback,duration)
return this}
$(function(){$.support.transition=transitionEnd()
if(!$.support.transition)return
$.event.special.bsTransitionEnd={bindType:$.support.transition.end,delegateType:$.support.transition.end,handle:function(e){if($(e.target).is(this))return e.handleObj.handler.apply(this,arguments)}}})}(jQuery);;+function($){'use strict';var Affix=function(element,options){this.options=$.extend({},Affix.DEFAULTS,options)
this.$target=$(this.options.target).on('scroll.bs.affix.data-api',$.proxy(this.checkPosition,this)).on('click.bs.affix.data-api',$.proxy(this.checkPositionWithEventLoop,this))
this.$element=$(element)
this.affixed=this.unpin=this.pinnedOffset=null
this.checkPosition()}
Affix.VERSION='3.2.0'
Affix.RESET='affix affix-top affix-bottom'
Affix.DEFAULTS={offset:0,target:window}
Affix.prototype.getPinnedOffset=function(){if(this.pinnedOffset)return this.pinnedOffset
this.$element.removeClass(Affix.RESET).addClass('affix')
var scrollTop=this.$target.scrollTop()
var position=this.$element.offset()
return(this.pinnedOffset=position.top-scrollTop)}
Affix.prototype.checkPositionWithEventLoop=function(){setTimeout($.proxy(this.checkPosition,this),1)}
Affix.prototype.checkPosition=function(){if(!this.$element.is(':visible'))return
var scrollHeight=$(document).height()
var scrollTop=this.$target.scrollTop()
var position=this.$element.offset()
var offset=this.options.offset
var offsetTop=offset.top
var offsetBottom=offset.bottom
if(typeof offset!='object')offsetBottom=offsetTop=offset
if(typeof offsetTop=='function')offsetTop=offset.top(this.$element)
if(typeof offsetBottom=='function')offsetBottom=offset.bottom(this.$element)
var affix=this.unpin!=null&&(scrollTop+this.unpin<=position.top)?false:offsetBottom!=null&&(position.top+this.$element.height()>=scrollHeight-offsetBottom)?'bottom':offsetTop!=null&&(scrollTop<=offsetTop)?'top':false
if(this.affixed===affix)return
if(this.unpin!=null)this.$element.css('top','')
var affixType='affix'+(affix?'-'+affix:'')
var e=$.Event(affixType+'.bs.affix')
this.$element.trigger(e)
if(e.isDefaultPrevented())return
this.affixed=affix
this.unpin=affix=='bottom'?this.getPinnedOffset():null
this.$element.removeClass(Affix.RESET).addClass(affixType).trigger($.Event(affixType.replace('affix','affixed')))
if(affix=='bottom'){this.$element.offset({top:scrollHeight-this.$element.height()-offsetBottom})}}
function Plugin(option){return this.each(function(){var $this=$(this)
var data=$this.data('bs.affix')
var options=typeof option=='object'&&option
if(!data)$this.data('bs.affix',(data=new Affix(this,options)))
if(typeof option=='string')data[option]()})}
var old=$.fn.affix
$.fn.affix=Plugin
$.fn.affix.Constructor=Affix
$.fn.affix.noConflict=function(){$.fn.affix=old
return this}
$(window).on('load',function(){$('[data-spy="affix"]').each(function(){var $spy=$(this)
var data=$spy.data()
data.offset=data.offset||{}
if(data.offsetBottom)data.offset.bottom=data.offsetBottom
if(data.offsetTop)data.offset.top=data.offsetTop
Plugin.call($spy,data)})})}(jQuery);;+function($){'use strict';var Collapse=function(element,options){this.$element=$(element)
this.options=$.extend({},Collapse.DEFAULTS,options)
this.transitioning=null
if(this.options.parent)this.$parent=$(this.options.parent)
if(this.options.toggle)this.toggle()}
Collapse.VERSION='3.2.0'
Collapse.DEFAULTS={toggle:true}
Collapse.prototype.dimension=function(){var hasWidth=this.$element.hasClass('width')
return hasWidth?'width':'height'}
Collapse.prototype.show=function(){if(this.transitioning||this.$element.hasClass('in'))return
var startEvent=$.Event('show.bs.collapse')
this.$element.trigger(startEvent)
if(startEvent.isDefaultPrevented())return
var actives=this.$parent&&this.$parent.find('> .panel > .in')
if(actives&&actives.length){var hasData=actives.data('bs.collapse')
if(hasData&&hasData.transitioning)return
Plugin.call(actives,'hide')
hasData||actives.data('bs.collapse',null)}
var dimension=this.dimension()
this.$element.removeClass('collapse').addClass('collapsing')[dimension](0)
this.transitioning=1
var complete=function(){this.$element.removeClass('collapsing').addClass('collapse in')[dimension]('')
this.transitioning=0
this.$element.trigger('shown.bs.collapse')}
if(!$.support.transition)return complete.call(this)
var scrollSize=$.camelCase(['scroll',dimension].join('-'))
this.$element.one('bsTransitionEnd',$.proxy(complete,this)).emulateTransitionEnd(350)[dimension](this.$element[0][scrollSize])}
Collapse.prototype.hide=function(){if(this.transitioning||!this.$element.hasClass('in'))return
var startEvent=$.Event('hide.bs.collapse')
this.$element.trigger(startEvent)
if(startEvent.isDefaultPrevented())return
var dimension=this.dimension()
this.$element[dimension](this.$element[dimension]())[0].offsetHeight
this.$element.addClass('collapsing').removeClass('collapse').removeClass('in')
this.transitioning=1
var complete=function(){this.transitioning=0
this.$element.trigger('hidden.bs.collapse').removeClass('collapsing').addClass('collapse')}
if(!$.support.transition)return complete.call(this)
this.$element
[dimension](0).one('bsTransitionEnd',$.proxy(complete,this)).emulateTransitionEnd(350)}
Collapse.prototype.toggle=function(){this[this.$element.hasClass('in')?'hide':'show']()}
function Plugin(option){return this.each(function(){var $this=$(this)
var data=$this.data('bs.collapse')
var options=$.extend({},Collapse.DEFAULTS,$this.data(),typeof option=='object'&&option)
if(!data&&options.toggle&&option=='show')option=!option
if(!data)$this.data('bs.collapse',(data=new Collapse(this,options)))
if(typeof option=='string')data[option]()})}
var old=$.fn.collapse
$.fn.collapse=Plugin
$.fn.collapse.Constructor=Collapse
$.fn.collapse.noConflict=function(){$.fn.collapse=old
return this}
$(document).on('click.bs.collapse.data-api','[data-toggle="collapse"]',function(e){var href
var $this=$(this)
var target=$this.attr('data-target')||e.preventDefault()||(href=$this.attr('href'))&&href.replace(/.*(?=#[^\s]+$)/,'')
var $target=$(target)
var data=$target.data('bs.collapse')
var option=data?'toggle':$this.data()
var parent=$this.attr('data-parent')
var $parent=parent&&$(parent)
if(!data||!data.transitioning){if($parent)$parent.find('[data-toggle="collapse"][data-parent="'+parent+'"]').not($this).addClass('collapsed')
$this[$target.hasClass('in')?'addClass':'removeClass']('collapsed')}
Plugin.call($target,option)})}(jQuery);
;/*
Copyright 2014 Igor Vaynberg

Version: 3.5.1 Timestamp: Tue Jul 22 18:58:56 EDT 2014

This software is licensed under the Apache License, Version 2.0 (the "Apache License") or the GNU
General Public License version 2 (the "GPL License"). You may choose either license to govern your
use of this software only upon the condition that you accept all of the terms of either the Apache
License or the GPL License.

You may obtain a copy of the Apache License and the GPL License at:

http://www.apache.org/licenses/LICENSE-2.0
http://www.gnu.org/licenses/gpl-2.0.html

Unless required by applicable law or agreed to in writing, software distributed under the Apache License
or the GPL Licesnse is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
either express or implied. See the Apache License and the GPL License for the specific language governing
permissions and limitations under the Apache License and the GPL License.
*/
!function(n){void 0===n.fn.each2&&n.extend(n.fn,{each2:function(e){for(var t=n([0]),s=-1,i=this.length;++s<i&&(t.context=t[0]=this[s])&&!1!==e.call(t[0],s,t););return this}})}(jQuery),function(S,C){"use strict";if(window.Select2===C){var e,t,s,y,o,n,x,i,l={x:0,y:0},r={TAB:9,ENTER:13,ESC:27,SPACE:32,LEFT:37,UP:38,RIGHT:39,DOWN:40,SHIFT:16,CTRL:17,ALT:18,PAGE_UP:33,PAGE_DOWN:34,HOME:36,END:35,BACKSPACE:8,DELETE:46,isArrow:function(e){switch(e=e.which?e.which:e){case r.LEFT:case r.RIGHT:case r.UP:case r.DOWN:return!0}return!1},isControl:function(e){switch(e.which){case r.SHIFT:case r.CTRL:case r.ALT:return!0}return!!e.metaKey},isFunctionKey:function(e){return 112<=(e=e.which?e.which:e)&&e<=123}},a={"Ⓐ":"A","Ａ":"A","À":"A","Á":"A","Â":"A","Ầ":"A","Ấ":"A","Ẫ":"A","Ẩ":"A","Ã":"A","Ā":"A","Ă":"A","Ằ":"A","Ắ":"A","Ẵ":"A","Ẳ":"A","Ȧ":"A","Ǡ":"A","Ä":"A","Ǟ":"A","Ả":"A","Å":"A","Ǻ":"A","Ǎ":"A","Ȁ":"A","Ȃ":"A","Ạ":"A","Ậ":"A","Ặ":"A","Ḁ":"A","Ą":"A","Ⱥ":"A","Ɐ":"A","Ꜳ":"AA","Æ":"AE","Ǽ":"AE","Ǣ":"AE","Ꜵ":"AO","Ꜷ":"AU","Ꜹ":"AV","Ꜻ":"AV","Ꜽ":"AY","Ⓑ":"B","Ｂ":"B","Ḃ":"B","Ḅ":"B","Ḇ":"B","Ƀ":"B","Ƃ":"B","Ɓ":"B","Ⓒ":"C","Ｃ":"C","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","Ç":"C","Ḉ":"C","Ƈ":"C","Ȼ":"C","Ꜿ":"C","Ⓓ":"D","Ｄ":"D","Ḋ":"D","Ď":"D","Ḍ":"D","Ḑ":"D","Ḓ":"D","Ḏ":"D","Đ":"D","Ƌ":"D","Ɗ":"D","Ɖ":"D","Ꝺ":"D","Ǳ":"DZ","Ǆ":"DZ","ǲ":"Dz","ǅ":"Dz","Ⓔ":"E","Ｅ":"E","È":"E","É":"E","Ê":"E","Ề":"E","Ế":"E","Ễ":"E","Ể":"E","Ẽ":"E","Ē":"E","Ḕ":"E","Ḗ":"E","Ĕ":"E","Ė":"E","Ë":"E","Ẻ":"E","Ě":"E","Ȅ":"E","Ȇ":"E","Ẹ":"E","Ệ":"E","Ȩ":"E","Ḝ":"E","Ę":"E","Ḙ":"E","Ḛ":"E","Ɛ":"E","Ǝ":"E","Ⓕ":"F","Ｆ":"F","Ḟ":"F","Ƒ":"F","Ꝼ":"F","Ⓖ":"G","Ｇ":"G","Ǵ":"G","Ĝ":"G","Ḡ":"G","Ğ":"G","Ġ":"G","Ǧ":"G","Ģ":"G","Ǥ":"G","Ɠ":"G","Ꞡ":"G","Ᵹ":"G","Ꝿ":"G","Ⓗ":"H","Ｈ":"H","Ĥ":"H","Ḣ":"H","Ḧ":"H","Ȟ":"H","Ḥ":"H","Ḩ":"H","Ḫ":"H","Ħ":"H","Ⱨ":"H","Ⱶ":"H","Ɥ":"H","Ⓘ":"I","Ｉ":"I","Ì":"I","Í":"I","Î":"I","Ĩ":"I","Ī":"I","Ĭ":"I","İ":"I","Ï":"I","Ḯ":"I","Ỉ":"I","Ǐ":"I","Ȉ":"I","Ȋ":"I","Ị":"I","Į":"I","Ḭ":"I","Ɨ":"I","Ⓙ":"J","Ｊ":"J","Ĵ":"J","Ɉ":"J","Ⓚ":"K","Ｋ":"K","Ḱ":"K","Ǩ":"K","Ḳ":"K","Ķ":"K","Ḵ":"K","Ƙ":"K","Ⱪ":"K","Ꝁ":"K","Ꝃ":"K","Ꝅ":"K","Ꞣ":"K","Ⓛ":"L","Ｌ":"L","Ŀ":"L","Ĺ":"L","Ľ":"L","Ḷ":"L","Ḹ":"L","Ļ":"L","Ḽ":"L","Ḻ":"L","Ł":"L","Ƚ":"L","Ɫ":"L","Ⱡ":"L","Ꝉ":"L","Ꝇ":"L","Ꞁ":"L","Ǉ":"LJ","ǈ":"Lj","Ⓜ":"M","Ｍ":"M","Ḿ":"M","Ṁ":"M","Ṃ":"M","Ɱ":"M","Ɯ":"M","Ⓝ":"N","Ｎ":"N","Ǹ":"N","Ń":"N","Ñ":"N","Ṅ":"N","Ň":"N","Ṇ":"N","Ņ":"N","Ṋ":"N","Ṉ":"N","Ƞ":"N","Ɲ":"N","Ꞑ":"N","Ꞥ":"N","Ǌ":"NJ","ǋ":"Nj","Ⓞ":"O","Ｏ":"O","Ò":"O","Ó":"O","Ô":"O","Ồ":"O","Ố":"O","Ỗ":"O","Ổ":"O","Õ":"O","Ṍ":"O","Ȭ":"O","Ṏ":"O","Ō":"O","Ṑ":"O","Ṓ":"O","Ŏ":"O","Ȯ":"O","Ȱ":"O","Ö":"O","Ȫ":"O","Ỏ":"O","Ő":"O","Ǒ":"O","Ȍ":"O","Ȏ":"O","Ơ":"O","Ờ":"O","Ớ":"O","Ỡ":"O","Ở":"O","Ợ":"O","Ọ":"O","Ộ":"O","Ǫ":"O","Ǭ":"O","Ø":"O","Ǿ":"O","Ɔ":"O","Ɵ":"O","Ꝋ":"O","Ꝍ":"O","Ƣ":"OI","Ꝏ":"OO","Ȣ":"OU","Ⓟ":"P","Ｐ":"P","Ṕ":"P","Ṗ":"P","Ƥ":"P","Ᵽ":"P","Ꝑ":"P","Ꝓ":"P","Ꝕ":"P","Ⓠ":"Q","Ｑ":"Q","Ꝗ":"Q","Ꝙ":"Q","Ɋ":"Q","Ⓡ":"R","Ｒ":"R","Ŕ":"R","Ṙ":"R","Ř":"R","Ȑ":"R","Ȓ":"R","Ṛ":"R","Ṝ":"R","Ŗ":"R","Ṟ":"R","Ɍ":"R","Ɽ":"R","Ꝛ":"R","Ꞧ":"R","Ꞃ":"R","Ⓢ":"S","Ｓ":"S","ẞ":"S","Ś":"S","Ṥ":"S","Ŝ":"S","Ṡ":"S","Š":"S","Ṧ":"S","Ṣ":"S","Ṩ":"S","Ș":"S","Ş":"S","Ȿ":"S","Ꞩ":"S","Ꞅ":"S","Ⓣ":"T","Ｔ":"T","Ṫ":"T","Ť":"T","Ṭ":"T","Ț":"T","Ţ":"T","Ṱ":"T","Ṯ":"T","Ŧ":"T","Ƭ":"T","Ʈ":"T","Ⱦ":"T","Ꞇ":"T","Ꜩ":"TZ","Ⓤ":"U","Ｕ":"U","Ù":"U","Ú":"U","Û":"U","Ũ":"U","Ṹ":"U","Ū":"U","Ṻ":"U","Ŭ":"U","Ü":"U","Ǜ":"U","Ǘ":"U","Ǖ":"U","Ǚ":"U","Ủ":"U","Ů":"U","Ű":"U","Ǔ":"U","Ȕ":"U","Ȗ":"U","Ư":"U","Ừ":"U","Ứ":"U","Ữ":"U","Ử":"U","Ự":"U","Ụ":"U","Ṳ":"U","Ų":"U","Ṷ":"U","Ṵ":"U","Ʉ":"U","Ⓥ":"V","Ｖ":"V","Ṽ":"V","Ṿ":"V","Ʋ":"V","Ꝟ":"V","Ʌ":"V","Ꝡ":"VY","Ⓦ":"W","Ｗ":"W","Ẁ":"W","Ẃ":"W","Ŵ":"W","Ẇ":"W","Ẅ":"W","Ẉ":"W","Ⱳ":"W","Ⓧ":"X","Ｘ":"X","Ẋ":"X","Ẍ":"X","Ⓨ":"Y","Ｙ":"Y","Ỳ":"Y","Ý":"Y","Ŷ":"Y","Ỹ":"Y","Ȳ":"Y","Ẏ":"Y","Ÿ":"Y","Ỷ":"Y","Ỵ":"Y","Ƴ":"Y","Ɏ":"Y","Ỿ":"Y","Ⓩ":"Z","Ｚ":"Z","Ź":"Z","Ẑ":"Z","Ż":"Z","Ž":"Z","Ẓ":"Z","Ẕ":"Z","Ƶ":"Z","Ȥ":"Z","Ɀ":"Z","Ⱬ":"Z","Ꝣ":"Z","ⓐ":"a","ａ":"a","ẚ":"a","à":"a","á":"a","â":"a","ầ":"a","ấ":"a","ẫ":"a","ẩ":"a","ã":"a","ā":"a","ă":"a","ằ":"a","ắ":"a","ẵ":"a","ẳ":"a","ȧ":"a","ǡ":"a","ä":"a","ǟ":"a","ả":"a","å":"a","ǻ":"a","ǎ":"a","ȁ":"a","ȃ":"a","ạ":"a","ậ":"a","ặ":"a","ḁ":"a","ą":"a","ⱥ":"a","ɐ":"a","ꜳ":"aa","æ":"ae","ǽ":"ae","ǣ":"ae","ꜵ":"ao","ꜷ":"au","ꜹ":"av","ꜻ":"av","ꜽ":"ay","ⓑ":"b","ｂ":"b","ḃ":"b","ḅ":"b","ḇ":"b","ƀ":"b","ƃ":"b","ɓ":"b","ⓒ":"c","ｃ":"c","ć":"c","ĉ":"c","ċ":"c","č":"c","ç":"c","ḉ":"c","ƈ":"c","ȼ":"c","ꜿ":"c","ↄ":"c","ⓓ":"d","ｄ":"d","ḋ":"d","ď":"d","ḍ":"d","ḑ":"d","ḓ":"d","ḏ":"d","đ":"d","ƌ":"d","ɖ":"d","ɗ":"d","ꝺ":"d","ǳ":"dz","ǆ":"dz","ⓔ":"e","ｅ":"e","è":"e","é":"e","ê":"e","ề":"e","ế":"e","ễ":"e","ể":"e","ẽ":"e","ē":"e","ḕ":"e","ḗ":"e","ĕ":"e","ė":"e","ë":"e","ẻ":"e","ě":"e","ȅ":"e","ȇ":"e","ẹ":"e","ệ":"e","ȩ":"e","ḝ":"e","ę":"e","ḙ":"e","ḛ":"e","ɇ":"e","ɛ":"e","ǝ":"e","ⓕ":"f","ｆ":"f","ḟ":"f","ƒ":"f","ꝼ":"f","ⓖ":"g","ｇ":"g","ǵ":"g","ĝ":"g","ḡ":"g","ğ":"g","ġ":"g","ǧ":"g","ģ":"g","ǥ":"g","ɠ":"g","ꞡ":"g","ᵹ":"g","ꝿ":"g","ⓗ":"h","ｈ":"h","ĥ":"h","ḣ":"h","ḧ":"h","ȟ":"h","ḥ":"h","ḩ":"h","ḫ":"h","ẖ":"h","ħ":"h","ⱨ":"h","ⱶ":"h","ɥ":"h","ƕ":"hv","ⓘ":"i","ｉ":"i","ì":"i","í":"i","î":"i","ĩ":"i","ī":"i","ĭ":"i","ï":"i","ḯ":"i","ỉ":"i","ǐ":"i","ȉ":"i","ȋ":"i","ị":"i","į":"i","ḭ":"i","ɨ":"i","ı":"i","ⓙ":"j","ｊ":"j","ĵ":"j","ǰ":"j","ɉ":"j","ⓚ":"k","ｋ":"k","ḱ":"k","ǩ":"k","ḳ":"k","ķ":"k","ḵ":"k","ƙ":"k","ⱪ":"k","ꝁ":"k","ꝃ":"k","ꝅ":"k","ꞣ":"k","ⓛ":"l","ｌ":"l","ŀ":"l","ĺ":"l","ľ":"l","ḷ":"l","ḹ":"l","ļ":"l","ḽ":"l","ḻ":"l","ſ":"l","ł":"l","ƚ":"l","ɫ":"l","ⱡ":"l","ꝉ":"l","ꞁ":"l","ꝇ":"l","ǉ":"lj","ⓜ":"m","ｍ":"m","ḿ":"m","ṁ":"m","ṃ":"m","ɱ":"m","ɯ":"m","ⓝ":"n","ｎ":"n","ǹ":"n","ń":"n","ñ":"n","ṅ":"n","ň":"n","ṇ":"n","ņ":"n","ṋ":"n","ṉ":"n","ƞ":"n","ɲ":"n","ŉ":"n","ꞑ":"n","ꞥ":"n","ǌ":"nj","ⓞ":"o","ｏ":"o","ò":"o","ó":"o","ô":"o","ồ":"o","ố":"o","ỗ":"o","ổ":"o","õ":"o","ṍ":"o","ȭ":"o","ṏ":"o","ō":"o","ṑ":"o","ṓ":"o","ŏ":"o","ȯ":"o","ȱ":"o","ö":"o","ȫ":"o","ỏ":"o","ő":"o","ǒ":"o","ȍ":"o","ȏ":"o","ơ":"o","ờ":"o","ớ":"o","ỡ":"o","ở":"o","ợ":"o","ọ":"o","ộ":"o","ǫ":"o","ǭ":"o","ø":"o","ǿ":"o","ɔ":"o","ꝋ":"o","ꝍ":"o","ɵ":"o","ƣ":"oi","ȣ":"ou","ꝏ":"oo","ⓟ":"p","ｐ":"p","ṕ":"p","ṗ":"p","ƥ":"p","ᵽ":"p","ꝑ":"p","ꝓ":"p","ꝕ":"p","ⓠ":"q","ｑ":"q","ɋ":"q","ꝗ":"q","ꝙ":"q","ⓡ":"r","ｒ":"r","ŕ":"r","ṙ":"r","ř":"r","ȑ":"r","ȓ":"r","ṛ":"r","ṝ":"r","ŗ":"r","ṟ":"r","ɍ":"r","ɽ":"r","ꝛ":"r","ꞧ":"r","ꞃ":"r","ⓢ":"s","ｓ":"s","ß":"s","ś":"s","ṥ":"s","ŝ":"s","ṡ":"s","š":"s","ṧ":"s","ṣ":"s","ṩ":"s","ș":"s","ş":"s","ȿ":"s","ꞩ":"s","ꞅ":"s","ẛ":"s","ⓣ":"t","ｔ":"t","ṫ":"t","ẗ":"t","ť":"t","ṭ":"t","ț":"t","ţ":"t","ṱ":"t","ṯ":"t","ŧ":"t","ƭ":"t","ʈ":"t","ⱦ":"t","ꞇ":"t","ꜩ":"tz","ⓤ":"u","ｕ":"u","ù":"u","ú":"u","û":"u","ũ":"u","ṹ":"u","ū":"u","ṻ":"u","ŭ":"u","ü":"u","ǜ":"u","ǘ":"u","ǖ":"u","ǚ":"u","ủ":"u","ů":"u","ű":"u","ǔ":"u","ȕ":"u","ȗ":"u","ư":"u","ừ":"u","ứ":"u","ữ":"u","ử":"u","ự":"u","ụ":"u","ṳ":"u","ų":"u","ṷ":"u","ṵ":"u","ʉ":"u","ⓥ":"v","ｖ":"v","ṽ":"v","ṿ":"v","ʋ":"v","ꝟ":"v","ʌ":"v","ꝡ":"vy","ⓦ":"w","ｗ":"w","ẁ":"w","ẃ":"w","ŵ":"w","ẇ":"w","ẅ":"w","ẘ":"w","ẉ":"w","ⱳ":"w","ⓧ":"x","ｘ":"x","ẋ":"x","ẍ":"x","ⓨ":"y","ｙ":"y","ỳ":"y","ý":"y","ŷ":"y","ỹ":"y","ȳ":"y","ẏ":"y","ÿ":"y","ỷ":"y","ẙ":"y","ỵ":"y","ƴ":"y","ɏ":"y","ỿ":"y","ⓩ":"z","ｚ":"z","ź":"z","ẑ":"z","ż":"z","ž":"z","ẓ":"z","ẕ":"z","ƶ":"z","ȥ":"z","ɀ":"z","ⱬ":"z","ꝣ":"z","Ά":"Α","Έ":"Ε","Ή":"Η","Ί":"Ι","Ϊ":"Ι","Ό":"Ο","Ύ":"Υ","Ϋ":"Υ","Ώ":"Ω","ά":"α","έ":"ε","ή":"η","ί":"ι","ϊ":"ι","ΐ":"ι","ό":"ο","ύ":"υ","ϋ":"υ","ΰ":"υ","ω":"ω","ς":"σ"};n=S(document),i=1,y=function(){return i++},t=R(e=R(Object,{bind:function(e){var t=this;return function(){e.apply(t,arguments)}},init:function(e){var o,t,s,i,n,a=".select2-results";this.opts=e=this.prepareOpts(e),this.id=e.id,e.element.data("select2")!==C&&null!==e.element.data("select2")&&e.element.data("select2").destroy(),this.container=this.createContainer(),this.liveRegion=S("<span>",{role:"status","aria-live":"polite"}).addClass("select2-hidden-accessible").appendTo(document.body),this.containerId="s2id_"+(e.element.attr("id")||"autogen"+y()),this.containerEventName=this.containerId.replace(/([.])/g,"_").replace(/([;&,\-\.\+\*\~':"\!\^#$%@\[\]\(\)=>\|])/g,"\\$1"),this.container.attr("id",this.containerId),this.container.attr("title",e.element.attr("title")),this.body=S("body"),w(this.container,this.opts.element,this.opts.adaptContainerCssClass),this.container.attr("style",e.element.attr("style")),this.container.css(k(e.containerCss,this.opts.element)),this.container.addClass(k(e.containerCssClass,this.opts.element)),this.elementTabIndex=this.opts.element.attr("tabindex"),this.opts.element.data("select2",this).attr("tabindex","-1").before(this.container).on("click.select2",v),this.container.data("select2",this),this.dropdown=this.container.find(".select2-drop"),w(this.dropdown,this.opts.element,this.opts.adaptDropdownCssClass),this.dropdown.addClass(k(e.dropdownCssClass,this.opts.element)),this.dropdown.data("select2",this),this.dropdown.on("click",v),this.results=o=this.container.find(a),this.search=t=this.container.find("input.select2-input"),this.queryCount=0,this.resultsPage=0,this.context=null,this.initContainer(),this.container.on("click",v),this.results.on("mousemove",function(e){var t=l;t!==C&&t.x===e.pageX&&t.y===e.pageY||S(e.target).trigger("mousemove-filtered",e)}),this.dropdown.on("mousemove-filtered",a,this.bind(this.highlightUnderEvent)),this.dropdown.on("touchstart touchmove touchend",a,this.bind(function(e){this._touchEvent=!0,this.highlightUnderEvent(e)})),this.dropdown.on("touchmove",a,this.bind(this.touchMoved)),this.dropdown.on("touchstart touchend",a,this.bind(this.clearTouchMoved)),this.dropdown.on("click",this.bind(function(e){this._touchEvent&&(this._touchEvent=!1,this.selectHighlighted())})),s=80,i=this.results,n=m(s,function(e){i.trigger("scroll-debounced",e)}),i.on("scroll",function(e){0<=u(e.target,i.get())&&n(e)}),this.dropdown.on("scroll-debounced",a,this.bind(this.loadMoreIfNeeded)),S(this.container).on("change",".select2-input",function(e){e.stopPropagation()}),S(this.dropdown).on("change",".select2-input",function(e){e.stopPropagation()}),S.fn.mousewheel&&o.mousewheel(function(e,t,s,i){var n=o.scrollTop();0<i&&n-i<=0?(o.scrollTop(0),v(e)):i<0&&o.get(0).scrollHeight-o.scrollTop()+i<=o.height()&&(o.scrollTop(o.get(0).scrollHeight-o.height()),v(e))}),g(t),t.on("keyup-change input paste",this.bind(this.updateResults)),t.on("focus",function(){t.addClass("select2-focused")}),t.on("blur",function(){t.removeClass("select2-focused")}),this.dropdown.on("mouseup",a,this.bind(function(e){0<S(e.target).closest(".select2-result-selectable").length&&(this.highlightUnderEvent(e),this.selectHighlighted(e))})),this.dropdown.on("click mouseup mousedown touchstart touchend focusin",function(e){e.stopPropagation()}),this.nextSearchTerm=C,S.isFunction(this.opts.initSelection)&&(this.initSelection(),this.monitorSource()),null!==e.maximumInputLength&&this.search.attr("maxlength",e.maximumInputLength);var r=e.element.prop("disabled");r===C&&(r=!1),this.enable(!r);var c=e.element.prop("readonly");c===C&&(c=!1),this.readonly(c),x=x||function(){var e=S("<div class='select2-measure-scrollbar'></div>");e.appendTo("body");var t={width:e.width()-e[0].clientWidth,height:e.height()-e[0].clientHeight};return e.remove(),t}(),this.autofocus=e.element.prop("autofocus"),e.element.prop("autofocus",!1),this.autofocus&&this.focus(),this.search.attr("placeholder",e.searchInputPlaceholder)},destroy:function(){var e=this.opts.element,t=e.data("select2"),s=this;this.close(),e.length&&e[0].detachEvent&&e.each(function(){this.detachEvent("onpropertychange",s._sync)}),this.propertyObserver&&(this.propertyObserver.disconnect(),this.propertyObserver=null),this._sync=null,t!==C&&(t.container.remove(),t.liveRegion.remove(),t.dropdown.remove(),e.removeClass("select2-offscreen").removeData("select2").off(".select2").prop("autofocus",this.autofocus||!1),this.elementTabIndex?e.attr({tabindex:this.elementTabIndex}):e.removeAttr("tabindex"),e.show()),A.call(this,"container","liveRegion","dropdown","results","search")},optionToData:function(e){return e.is("option")?{id:e.prop("value"),text:e.text(),element:e.get(),css:e.attr("class"),disabled:e.prop("disabled"),locked:p(e.attr("locked"),"locked")||p(e.data("locked"),!0)}:e.is("optgroup")?{text:e.attr("label"),children:[],element:e.get(),css:e.attr("class")}:void 0},prepareOpts:function(w){var a,e,t,s,b=this;if("select"===(a=w.element).get(0).tagName.toLowerCase()&&(this.select=e=w.element),e&&S.each(["id","multiple","ajax","query","createSearchChoice","initSelection","data","tags"],function(){if(this in w)throw new Error("Option '"+this+"' is not allowed for Select2 when attached to a <select> element.")}),"function"!=typeof(w=S.extend({},{populateResults:function(e,t,f){var g,m=this.opts.id,v=this.liveRegion;(g=function(e,t,s){var i,n,o,a,r,c,l,h,u,d,p=[];for(i=0,n=(e=w.sortResults(e,t,f)).length;i<n;i+=1)a=!(r=!0===(o=e[i]).disabled)&&m(o)!==C,c=o.children&&0<o.children.length,(l=S("<li></li>")).addClass("select2-results-dept-"+s),l.addClass("select2-result"),l.addClass(a?"select2-result-selectable":"select2-result-unselectable"),r&&l.addClass("select2-disabled"),c&&l.addClass("select2-result-with-children"),l.addClass(b.opts.formatResultCssClass(o)),l.attr("role","presentation"),(h=S(document.createElement("div"))).addClass("select2-result-label"),h.attr("id","select2-result-label-"+y()),h.attr("role","option"),(d=w.formatResult(o,h,f,b.opts.escapeMarkup))!==C&&(h.html(d),l.append(h)),c&&((u=S("<ul></ul>")).addClass("select2-result-sub"),g(o.children,u,s+1),l.append(u)),l.data("select2-data",o),p.push(l[0]);t.append(p),v.text(w.formatMatches(e.length))})(t,e,0)}},S.fn.select2.defaults,w)).id&&(t=w.id,w.id=function(e){return e[t]}),S.isArray(w.element.data("select2Tags"))){if("tags"in w)throw"tags specified as both an attribute 'data-select2-tags' and in options of Select2 "+w.element.attr("id");w.tags=w.element.data("select2Tags")}if(e?(w.query=this.bind(function(i){var e,t,n,s={results:[],more:!1},o=i.term;n=function(e,t){var s;e.is("option")?i.matcher(o,e.text(),e)&&t.push(b.optionToData(e)):e.is("optgroup")&&(s=b.optionToData(e),e.children().each2(function(e,t){n(t,s.children)}),0<s.children.length&&t.push(s))},e=a.children(),this.getPlaceholder()!==C&&0<e.length&&(t=this.getPlaceholderOption())&&(e=e.not(t)),e.each2(function(e,t){n(t,s.results)}),i.callback(s)}),w.id=function(e){return e.id}):"query"in w||("ajax"in w?((s=w.element.data("ajax-url"))&&0<s.length&&(w.ajax.url=s),w.query=T.call(w.element,w.ajax)):"data"in w?w.query=O(w.data):"tags"in w&&(w.query=P(w.tags),w.createSearchChoice===C&&(w.createSearchChoice=function(e){return{id:S.trim(e),text:S.trim(e)}}),w.initSelection===C&&(w.initSelection=function(e,t){var s=[];S(d(e.val(),w.separator)).each(function(){var e={id:this,text:this},t=w.tags;S.isFunction(t)&&(t=t()),S(t).each(function(){if(p(this.id,e.id))return e=this,!1}),s.push(e)}),t(s)}))),"function"!=typeof w.query)throw"query function not defined for Select2 "+w.element.attr("id");if("top"===w.createSearchChoicePosition)w.createSearchChoicePosition=function(e,t){e.unshift(t)};else if("bottom"===w.createSearchChoicePosition)w.createSearchChoicePosition=function(e,t){e.push(t)};else if("function"!=typeof w.createSearchChoicePosition)throw"invalid createSearchChoicePosition option must be 'top', 'bottom' or a custom function";return w},monitorSource:function(){var e,s=this.opts.element,t=this;s.on("change.select2",this.bind(function(e){!0!==this.opts.element.data("select2-change-triggered")&&this.initSelection()})),this._sync=this.bind(function(){var e=s.prop("disabled");e===C&&(e=!1),this.enable(!e);var t=s.prop("readonly");t===C&&(t=!1),this.readonly(t),w(this.container,this.opts.element,this.opts.adaptContainerCssClass),this.container.addClass(k(this.opts.containerCssClass,this.opts.element)),w(this.dropdown,this.opts.element,this.opts.adaptDropdownCssClass),this.dropdown.addClass(k(this.opts.dropdownCssClass,this.opts.element))}),s.length&&s[0].attachEvent&&s.each(function(){this.attachEvent("onpropertychange",t._sync)}),(e=window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver)!==C&&(this.propertyObserver&&(delete this.propertyObserver,this.propertyObserver=null),this.propertyObserver=new e(function(e){S.each(e,t._sync)}),this.propertyObserver.observe(s.get(0),{attributes:!0,subtree:!1}))},triggerSelect:function(e){var t=S.Event("select2-selecting",{val:this.id(e),object:e,choice:e});return this.opts.element.trigger(t),!t.isDefaultPrevented()},triggerChange:function(e){e=e||{},e=S.extend({},e,{type:"change",val:this.val()}),this.opts.element.data("select2-change-triggered",!0),this.opts.element.trigger(e),this.opts.element.data("select2-change-triggered",!1),this.opts.element.click(),this.opts.blurOnChange&&this.opts.element.blur()},isInterfaceEnabled:function(){return!0===this.enabledInterface},enableInterface:function(){var e=this._enabled&&!this._readonly,t=!e;return e!==this.enabledInterface&&(this.container.toggleClass("select2-container-disabled",t),this.close(),this.enabledInterface=e,!0)},enable:function(e){e===C&&(e=!0),this._enabled!==e&&(this._enabled=e,this.opts.element.prop("disabled",!e),this.enableInterface())},disable:function(){this.enable(!1)},readonly:function(e){e===C&&(e=!1),this._readonly!==e&&(this._readonly=e,this.opts.element.prop("readonly",e),this.enableInterface())},opened:function(){return!!this.container&&this.container.hasClass("select2-dropdown-open")},positionDropdown:function(){var e,t,s,i,n,o=this.dropdown,a=this.container.offset(),r=this.container.outerHeight(!1),c=this.container.outerWidth(!1),l=o.outerHeight(!1),h=S(window),u=h.width(),d=h.height(),p=h.scrollLeft()+u,f=h.scrollTop()+d,g=a.top+r,m=a.left,v=g+l<=f,w=a.top-l>=h.scrollTop(),b=o.outerWidth(!1),C=m+b<=p;o.hasClass("select2-drop-above")?(t=!0,!w&&v&&(t=!(s=!0))):(t=!1,!v&&w&&(t=s=!0)),s&&(o.hide(),a=this.container.offset(),r=this.container.outerHeight(!1),c=this.container.outerWidth(!1),l=o.outerHeight(!1),p=h.scrollLeft()+u,f=h.scrollTop()+d,g=a.top+r,C=(m=a.left)+(b=o.outerWidth(!1))<=p,o.show(),this.focusSearch()),this.opts.dropdownAutoWidth?(n=S(".select2-results",o)[0],o.addClass("select2-drop-auto-width"),o.css("width",""),c<(b=o.outerWidth(!1)+(n.scrollHeight===n.clientHeight?0:x.width))?c=b:b=c,l=o.outerHeight(!1),C=m+b<=p):this.container.removeClass("select2-drop-auto-width"),"static"!==this.body.css("position")&&(g-=(e=this.body.offset()).top,m-=e.left),C||(m=a.left+this.container.outerWidth(!1)-b),i={left:m,width:c},t?(i.top=a.top-l,i.bottom="auto",this.container.addClass("select2-drop-above"),o.addClass("select2-drop-above")):(i.top=g,i.bottom="auto",this.container.removeClass("select2-drop-above"),o.removeClass("select2-drop-above")),i=S.extend(i,k(this.opts.dropdownCss,this.opts.element)),o.css(i)},shouldOpen:function(){var e;return!this.opened()&&(!1!==this._enabled&&!0!==this._readonly&&(e=S.Event("select2-opening"),this.opts.element.trigger(e),!e.isDefaultPrevented()))},clearDropdownAlignmentPreference:function(){this.container.removeClass("select2-drop-above"),this.dropdown.removeClass("select2-drop-above")},open:function(){return!!this.shouldOpen()&&(this.opening(),n.on("mousemove.select2Event",function(e){l.x=e.pageX,l.y=e.pageY}),!0)},opening:function(){var i,e=this.containerEventName,t="scroll."+e,s="resize."+e,n="orientationchange."+e;this.container.addClass("select2-dropdown-open").addClass("select2-container-active"),this.clearDropdownAlignmentPreference(),this.dropdown[0]!==this.body.children().last()[0]&&this.dropdown.detach().appendTo(this.body),0==(i=S("#select2-drop-mask")).length&&((i=S(document.createElement("div"))).attr("id","select2-drop-mask").attr("class","select2-drop-mask"),i.hide(),i.appendTo(this.body),i.on("mousedown touchstart click",function(e){c(i);var t,s=S("#select2-drop");0<s.length&&((t=s.data("select2")).opts.selectOnBlur&&t.selectHighlighted({noFocus:!0}),t.close(),e.preventDefault(),e.stopPropagation())})),this.dropdown.prev()[0]!==i[0]&&this.dropdown.before(i),S("#select2-drop").removeAttr("id"),this.dropdown.attr("id","select2-drop"),i.show(),this.positionDropdown(),this.dropdown.show(),this.positionDropdown(),this.dropdown.addClass("select2-drop-active");var o=this;this.container.parents().add(window).each(function(){S(this).on(s+" "+t+" "+n,function(e){o.opened()&&o.positionDropdown()})})},close:function(){if(this.opened()){var e=this.containerEventName,t="scroll."+e,s="resize."+e,i="orientationchange."+e;this.container.parents().add(window).each(function(){S(this).off(t).off(s).off(i)}),this.clearDropdownAlignmentPreference(),S("#select2-drop-mask").hide(),this.dropdown.removeAttr("id"),this.dropdown.hide(),this.container.removeClass("select2-dropdown-open").removeClass("select2-container-active"),this.results.empty(),n.off("mousemove.select2Event"),this.clearSearch(),this.nextSearchTerm="",this.search.removeClass("select2-active"),this.opts.element.trigger(S.Event("select2-close"))}},externalSearch:function(e){this.open(),this.search.val(e),this.updateResults(!1)},clearSearch:function(){},getMaximumSelectionSize:function(){return k(this.opts.maximumSelectionSize,this.opts.element)},ensureHighlightVisible:function(){var e,t,s,i,n,o,a,r,c=this.results;(t=this.highlight())<0||(0!=t?(e=this.findHighlightableChoices().find(".select2-result-label"),i=(r=((s=S(e[t])).offset()||{}).top||0)+s.outerHeight(!0),t===e.length-1&&0<(a=c.find("li.select2-more-results")).length&&(i=a.offset().top+a.outerHeight(!0)),(n=c.offset().top+c.outerHeight(!0))<i&&c.scrollTop(c.scrollTop()+(i-n)),(o=r-c.offset().top)<0&&"none"!=s.css("display")&&c.scrollTop(c.scrollTop()+o)):c.scrollTop(0))},findHighlightableChoices:function(){return this.results.find(".select2-result-selectable:not(.select2-disabled):not(.select2-selected)")},moveHighlight:function(e){for(var t=this.findHighlightableChoices(),s=this.highlight();-1<s&&s<t.length;){var i=S(t[s+=e]);if(i.hasClass("select2-result-selectable")&&!i.hasClass("select2-disabled")&&!i.hasClass("select2-selected")){this.highlight(s);break}}},highlight:function(e){var t,s,i=this.findHighlightableChoices();if(0===arguments.length)return u(i.filter(".select2-highlighted")[0],i.get());e>=i.length&&(e=i.length-1),e<0&&(e=0),this.removeHighlight(),(t=S(i[e])).addClass("select2-highlighted"),this.search.attr("aria-activedescendant",t.find(".select2-result-label").attr("id")),this.ensureHighlightVisible(),this.liveRegion.text(t.text()),(s=t.data("select2-data"))&&this.opts.element.trigger({type:"select2-highlight",val:this.id(s),choice:s})},removeHighlight:function(){this.results.find(".select2-highlighted").removeClass("select2-highlighted")},touchMoved:function(){this._touchMoved=!0},clearTouchMoved:function(){this._touchMoved=!1},countSelectableResults:function(){return this.findHighlightableChoices().length},highlightUnderEvent:function(e){var t=S(e.target).closest(".select2-result-selectable");if(0<t.length&&!t.is(".select2-highlighted")){var s=this.findHighlightableChoices();this.highlight(s.index(t))}else 0==t.length&&this.removeHighlight()},loadMoreIfNeeded:function(){var t=this.results,s=t.find("li.select2-more-results"),i=this.resultsPage+1,n=this,o=this.search.val(),a=this.context;0!==s.length&&s.offset().top-t.offset().top-t.height()<=this.opts.loadMorePadding&&(s.addClass("select2-active"),this.opts.query({element:this.opts.element,term:o,page:i,context:a,matcher:this.opts.matcher,callback:this.bind(function(e){n.opened()&&(n.opts.populateResults.call(this,t,e.results,{term:o,page:i,context:a}),n.postprocessResults(e,!1,!1),!0===e.more?(s.detach().appendTo(t).text(k(n.opts.formatLoadMore,n.opts.element,i+1)),window.setTimeout(function(){n.loadMoreIfNeeded()},10)):s.remove(),n.positionDropdown(),n.resultsPage=i,n.context=e.context,this.opts.element.trigger({type:"select2-loaded",items:e}))})}))},tokenize:function(){},updateResults:function(s){var e,t,i,n=this.search,o=this.results,a=this.opts,r=this,c=n.val(),l=S.data(this.container,"select2-last-term");if((!0===s||!l||!p(c,l))&&(S.data(this.container,"select2-last-term",c),!0===s||!1!==this.showSearchInput&&this.opened())){i=++this.queryCount;var h=this.getMaximumSelectionSize();if(!(1<=h&&(e=this.data(),S.isArray(e)&&e.length>=h&&I(a.formatSelectionTooBig,"formatSelectionTooBig"))))return n.val().length<a.minimumInputLength?(I(a.formatInputTooShort,"formatInputTooShort")?d("<li class='select2-no-results'>"+k(a.formatInputTooShort,a.element,n.val(),a.minimumInputLength)+"</li>"):d(""),void(s&&this.showSearch&&this.showSearch(!0))):void(a.maximumInputLength&&n.val().length>a.maximumInputLength?I(a.formatInputTooLong,"formatInputTooLong")?d("<li class='select2-no-results'>"+k(a.formatInputTooLong,a.element,n.val(),a.maximumInputLength)+"</li>"):d(""):(a.formatSearching&&0===this.findHighlightableChoices().length&&d("<li class='select2-searching'>"+k(a.formatSearching,a.element)+"</li>"),n.addClass("select2-active"),this.removeHighlight(),(t=this.tokenize())!=C&&null!=t&&n.val(t),this.resultsPage=1,a.query({element:a.element,term:n.val(),page:this.resultsPage,context:null,matcher:a.matcher,callback:this.bind(function(e){var t;i==this.queryCount&&(this.opened()?e.hasError!==C&&I(a.formatAjaxError,"formatAjaxError")?d("<li class='select2-ajax-error'>"+k(a.formatAjaxError,a.element,e.jqXHR,e.textStatus,e.errorThrown)+"</li>"):(this.context=e.context===C?null:e.context,this.opts.createSearchChoice&&""!==n.val()&&(t=this.opts.createSearchChoice.call(r,n.val(),e.results))!==C&&null!==t&&r.id(t)!==C&&null!==r.id(t)&&0===S(e.results).filter(function(){return p(r.id(this),r.id(t))}).length&&this.opts.createSearchChoicePosition(e.results,t),0===e.results.length&&I(a.formatNoMatches,"formatNoMatches")?d("<li class='select2-no-results'>"+k(a.formatNoMatches,a.element,n.val())+"</li>"):(o.empty(),r.opts.populateResults.call(this,o,e.results,{term:n.val(),page:this.resultsPage,context:null}),!0===e.more&&I(a.formatLoadMore,"formatLoadMore")&&(o.append("<li class='select2-more-results'>"+a.escapeMarkup(k(a.formatLoadMore,a.element,this.resultsPage))+"</li>"),window.setTimeout(function(){r.loadMoreIfNeeded()},10)),this.postprocessResults(e,s),u(),this.opts.element.trigger({type:"select2-loaded",items:e}))):this.search.removeClass("select2-active"))})})));d("<li class='select2-selection-limit'>"+k(a.formatSelectionTooBig,a.element,h)+"</li>")}function u(){n.removeClass("select2-active"),r.positionDropdown(),o.find(".select2-no-results,.select2-selection-limit,.select2-searching").length?r.liveRegion.text(o.text()):r.liveRegion.text(r.opts.formatMatches(o.find(".select2-result-selectable").length))}function d(e){o.html(e),u()}},cancel:function(){this.close()},blur:function(){this.opts.selectOnBlur&&this.selectHighlighted({noFocus:!0}),this.close(),this.container.removeClass("select2-container-active"),this.search[0]===document.activeElement&&this.search.blur(),this.clearSearch(),this.selection.find(".select2-search-choice-focus").removeClass("select2-search-choice-focus")},focusSearch:function(){var i;(i=this.search)[0]!==document.activeElement&&window.setTimeout(function(){var e,t=i[0],s=i.val().length;i.focus(),(0<t.offsetWidth||0<t.offsetHeight)&&t===document.activeElement&&(t.setSelectionRange?t.setSelectionRange(s,s):t.createTextRange&&((e=t.createTextRange()).collapse(!1),e.select()))},0)},selectHighlighted:function(e){if(this._touchMoved)this.clearTouchMoved();else{var t=this.highlight(),s=this.results.find(".select2-highlighted").closest(".select2-result").data("select2-data");s?(this.highlight(t),this.onSelect(s,e)):e&&e.noFocus&&this.close()}},getPlaceholder:function(){var e;return this.opts.element.attr("placeholder")||this.opts.element.attr("data-placeholder")||this.opts.element.data("placeholder")||this.opts.placeholder||((e=this.getPlaceholderOption())!==C?e.text():C)},getPlaceholderOption:function(){if(this.select){var e=this.select.children("option").first();if(this.opts.placeholderOption!==C)return"first"===this.opts.placeholderOption&&e||"function"==typeof this.opts.placeholderOption&&this.opts.placeholderOption(this.select);if(""===S.trim(e.text())&&""===e.val())return e}},initContainerWidth:function(){var e=function(){var e,t,s,i,n;if("off"===this.opts.width)return null;if("element"===this.opts.width)return 0===this.opts.element.outerWidth(!1)?"auto":this.opts.element.outerWidth(!1)+"px";if("copy"===this.opts.width||"resolve"===this.opts.width){if((e=this.opts.element.attr("style"))!==C)for(i=0,n=(t=e.split(";")).length;i<n;i+=1)if(null!==(s=t[i].replace(/\s/g,"").match(/^width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/i))&&1<=s.length)return s[1];return"resolve"===this.opts.width?0<(e=this.opts.element.css("width")).indexOf("%")?e:0===this.opts.element.outerWidth(!1)?"auto":this.opts.element.outerWidth(!1)+"px":null}return S.isFunction(this.opts.width)?this.opts.width():this.opts.width}.call(this);null!==e&&this.container.css("width",e)}}),{createContainer:function(){return S(document.createElement("div")).attr({class:"select2-container"}).html(["<a href='javascript:void(0)' class='select2-choice' tabindex='-1'>","   <span class='select2-chosen'>&#160;</span><abbr class='select2-search-choice-close'></abbr>","   <span class='select2-arrow' role='presentation'><b role='presentation'></b></span>","</a>","<label for='' class='select2-offscreen'></label>","<input class='select2-focusser select2-offscreen' type='text' aria-haspopup='true' role='button' />","<div class='select2-drop select2-display-none'>","   <div class='select2-search'>","       <label for='' class='select2-offscreen'></label>","       <input type='text' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' class='select2-input' role='combobox' aria-expanded='true' aria-autocomplete='list' />","       <span></span>","   </div>","   <ul class='select2-results' role='listbox'>","   </ul>","</div>"].join(""))},enableInterface:function(){this.parent.enableInterface.apply(this,arguments)&&this.focusser.prop("disabled",!this.isInterfaceEnabled())},opening:function(){var e,t,s;0<=this.opts.minimumResultsForSearch&&this.showSearch(!0),this.parent.opening.apply(this,arguments),!1!==this.showSearchInput&&this.search.val(this.focusser.val()),this.opts.shouldFocusInput(this)&&(this.search.focus(),(e=this.search.get(0)).createTextRange?((t=e.createTextRange()).collapse(!1),t.select()):e.setSelectionRange&&(s=this.search.val().length,e.setSelectionRange(s,s))),""===this.search.val()&&this.nextSearchTerm!=C&&(this.search.val(this.nextSearchTerm),this.search.select()),this.focusser.prop("disabled",!0).val(""),this.updateResults(!0),this.opts.element.trigger(S.Event("select2-open"))},close:function(){this.opened()&&(this.parent.close.apply(this,arguments),this.focusser.prop("disabled",!1),this.opts.shouldFocusInput(this)&&this.focusser.focus())},focus:function(){this.opened()?this.close():(this.focusser.prop("disabled",!1),this.opts.shouldFocusInput(this)&&this.focusser.focus())},isFocused:function(){return this.container.hasClass("select2-container-active")},cancel:function(){this.parent.cancel.apply(this,arguments),this.focusser.prop("disabled",!1),this.opts.shouldFocusInput(this)&&this.focusser.focus()},destroy:function(){S("label[for='"+this.focusser.attr("id")+"']").attr("for",this.opts.element.attr("id")),this.parent.destroy.apply(this,arguments),A.call(this,"selection","focusser")},initContainer:function(){var t,e,s=this.container,i=this.dropdown,n=y();this.opts.minimumResultsForSearch<0?this.showSearch(!1):this.showSearch(!0),this.selection=t=s.find(".select2-choice"),this.focusser=s.find(".select2-focusser"),t.find(".select2-chosen").attr("id","select2-chosen-"+n),this.focusser.attr("aria-labelledby","select2-chosen-"+n),this.results.attr("id","select2-results-"+n),this.search.attr("aria-owns","select2-results-"+n),this.focusser.attr("id","s2id_autogen"+n),e=S("label[for='"+this.opts.element.attr("id")+"']"),this.focusser.prev().text(e.text()).attr("for",this.focusser.attr("id"));var o=this.opts.element.attr("title");this.opts.element.attr("title",o||e.text()),this.focusser.attr("tabindex",this.elementTabIndex),this.search.attr("id",this.focusser.attr("id")+"_search"),this.search.prev().text(S("label[for='"+this.focusser.attr("id")+"']").text()).attr("for",this.search.attr("id")),this.search.on("keydown",this.bind(function(e){if(this.isInterfaceEnabled()&&229!=e.keyCode)if(e.which!==r.PAGE_UP&&e.which!==r.PAGE_DOWN)switch(e.which){case r.UP:case r.DOWN:return this.moveHighlight(e.which===r.UP?-1:1),void v(e);case r.ENTER:return this.selectHighlighted(),void v(e);case r.TAB:return void this.selectHighlighted({noFocus:!0});case r.ESC:return this.cancel(e),void v(e)}else v(e)})),this.search.on("blur",this.bind(function(e){document.activeElement===this.body.get(0)&&window.setTimeout(this.bind(function(){this.opened()&&this.search.focus()}),0)})),this.focusser.on("keydown",this.bind(function(e){if(this.isInterfaceEnabled()&&e.which!==r.TAB&&!r.isControl(e)&&!r.isFunctionKey(e)&&e.which!==r.ESC){if(!1!==this.opts.openOnEnter||e.which!==r.ENTER){if(e.which==r.DOWN||e.which==r.UP||e.which==r.ENTER&&this.opts.openOnEnter){if(e.altKey||e.ctrlKey||e.shiftKey||e.metaKey)return;return this.open(),void v(e)}return e.which==r.DELETE||e.which==r.BACKSPACE?(this.opts.allowClear&&this.clear(),void v(e)):void 0}v(e)}})),g(this.focusser),this.focusser.on("keyup-change input",this.bind(function(e){if(0<=this.opts.minimumResultsForSearch){if(e.stopPropagation(),this.opened())return;this.open()}})),t.on("mousedown touchstart","abbr",this.bind(function(e){var t;this.isInterfaceEnabled()&&(this.clear(),(t=e).preventDefault(),t.stopImmediatePropagation(),this.close(),this.selection.focus())})),t.on("mousedown touchstart",this.bind(function(e){c(t),this.container.hasClass("select2-container-active")||this.opts.element.trigger(S.Event("select2-focus")),this.opened()?this.close():this.isInterfaceEnabled()&&this.open(),v(e)})),i.on("mousedown touchstart",this.bind(function(){this.opts.shouldFocusInput(this)&&this.search.focus()})),t.on("focus",this.bind(function(e){v(e)})),this.focusser.on("focus",this.bind(function(){this.container.hasClass("select2-container-active")||this.opts.element.trigger(S.Event("select2-focus")),this.container.addClass("select2-container-active")})).on("blur",this.bind(function(){this.opened()||(this.container.removeClass("select2-container-active"),this.opts.element.trigger(S.Event("select2-blur")))})),this.search.on("focus",this.bind(function(){this.container.hasClass("select2-container-active")||this.opts.element.trigger(S.Event("select2-focus")),this.container.addClass("select2-container-active")})),this.initContainerWidth(),this.opts.element.addClass("select2-offscreen"),this.setPlaceholder()},clear:function(e){var t=this.selection.data("select2-data");if(t){var s=S.Event("select2-clearing");if(this.opts.element.trigger(s),s.isDefaultPrevented())return;var i=this.getPlaceholderOption();this.opts.element.val(i?i.val():""),this.selection.find(".select2-chosen").empty(),this.selection.removeData("select2-data"),this.setPlaceholder(),!1!==e&&(this.opts.element.trigger({type:"select2-removed",val:this.id(t),choice:t}),this.triggerChange({removed:t}))}},initSelection:function(){if(this.isPlaceholderOptionSelected())this.updateSelection(null),this.close(),this.setPlaceholder();else{var t=this;this.opts.initSelection.call(null,this.opts.element,function(e){e!==C&&null!==e&&(t.updateSelection(e),t.close(),t.setPlaceholder(),t.nextSearchTerm=t.opts.nextSearchTerm(e,t.search.val()))})}},isPlaceholderOptionSelected:function(){var e;return this.getPlaceholder()!==C&&((e=this.getPlaceholderOption())!==C&&e.prop("selected")||""===this.opts.element.val()||this.opts.element.val()===C||null===this.opts.element.val())},prepareOpts:function(){var a=this.parent.prepareOpts.apply(this,arguments),i=this;return"select"===a.element.get(0).tagName.toLowerCase()?a.initSelection=function(e,t){var s=e.find("option").filter(function(){return this.selected&&!this.disabled});t(i.optionToData(s))}:"data"in a&&(a.initSelection=a.initSelection||function(e,t){var n=e.val(),o=null;a.query({matcher:function(e,t,s){var i=p(n,a.id(s));return i&&(o=s),i},callback:S.isFunction(t)?function(){t(o)}:S.noop})}),a},getPlaceholder:function(){return this.select&&this.getPlaceholderOption()===C?C:this.parent.getPlaceholder.apply(this,arguments)},setPlaceholder:function(){var e=this.getPlaceholder();if(this.isPlaceholderOptionSelected()&&e!==C){if(this.select&&this.getPlaceholderOption()===C)return;this.selection.find(".select2-chosen").html(this.opts.escapeMarkup(e)),this.selection.addClass("select2-default"),this.container.removeClass("select2-allowclear")}},postprocessResults:function(e,t,s){var i=0,n=this;if(this.findHighlightableChoices().each2(function(e,t){if(p(n.id(t.data("select2-data")),n.opts.element.val()))return i=e,!1}),!1!==s&&(!0===t&&0<=i?this.highlight(i):this.highlight(0)),!0===t){var o=this.opts.minimumResultsForSearch;0<=o&&this.showSearch(function s(e){var i=0;return S.each(e,function(e,t){t.children?i+=s(t.children):i++}),i}(e.results)>=o)}},showSearch:function(e){this.showSearchInput!==e&&(this.showSearchInput=e,this.dropdown.find(".select2-search").toggleClass("select2-search-hidden",!e),this.dropdown.find(".select2-search").toggleClass("select2-offscreen",!e),S(this.dropdown,this.container).toggleClass("select2-with-searchbox",e))},onSelect:function(e,t){if(this.triggerSelect(e)){var s=this.opts.element.val(),i=this.data();this.opts.element.val(this.id(e)),this.updateSelection(e),this.opts.element.trigger({type:"select2-selected",val:this.id(e),choice:e}),this.nextSearchTerm=this.opts.nextSearchTerm(e,this.search.val()),this.close(),t&&t.noFocus||!this.opts.shouldFocusInput(this)||this.focusser.focus(),p(s,this.id(e))||this.triggerChange({added:e,removed:i})}},updateSelection:function(e){var t,s,i=this.selection.find(".select2-chosen");this.selection.data("select2-data",e),i.empty(),null!==e&&(t=this.opts.formatSelection(e,i,this.opts.escapeMarkup)),t!==C&&i.append(t),(s=this.opts.formatSelectionCssClass(e,i))!==C&&i.addClass(s),this.selection.removeClass("select2-default"),this.opts.allowClear&&this.getPlaceholder()!==C&&this.container.addClass("select2-allowclear")},val:function(){var e,t=!1,s=null,i=this,n=this.data();if(0===arguments.length)return this.opts.element.val();if(e=arguments[0],1<arguments.length&&(t=arguments[1]),this.select)this.select.val(e).find("option").filter(function(){return this.selected}).each2(function(e,t){return s=i.optionToData(t),!1}),this.updateSelection(s),this.setPlaceholder(),t&&this.triggerChange({added:s,removed:n});else{if(!e&&0!==e)return void this.clear(t);if(this.opts.initSelection===C)throw new Error("cannot call val() if initSelection() is not defined");this.opts.element.val(e),this.opts.initSelection(this.opts.element,function(e){i.opts.element.val(e?i.id(e):""),i.updateSelection(e),i.setPlaceholder(),t&&i.triggerChange({added:e,removed:n})})}},clearSearch:function(){this.search.val(""),this.focusser.val("")},data:function(e){var t,s=!1;if(0===arguments.length)return(t=this.selection.data("select2-data"))==C&&(t=null),t;1<arguments.length&&(s=arguments[1]),e?(t=this.data(),this.opts.element.val(e?this.id(e):""),this.updateSelection(e),s&&this.triggerChange({added:e,removed:t})):this.clear(s)}}),s=R(e,{createContainer:function(){return S(document.createElement("div")).attr({class:"select2-container select2-container-multi"}).html(["<ul class='select2-choices'>","  <li class='select2-search-field'>","    <label for='' class='select2-offscreen'></label>","    <input type='text' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' class='select2-input'>","    <span></span>","  </li>","</ul>","<div class='select2-drop select2-drop-multi select2-display-none'>","   <ul class='select2-results'>","   </ul>","</div>"].join(""))},prepareOpts:function(){var c=this.parent.prepareOpts.apply(this,arguments),i=this;return"select"===c.element.get(0).tagName.toLowerCase()?c.initSelection=function(e,t){var s=[];e.find("option").filter(function(){return this.selected&&!this.disabled}).each2(function(e,t){s.push(i.optionToData(t))}),t(s)}:"data"in c&&(c.initSelection=c.initSelection||function(e,o){var a=d(e.val(),c.separator),r=[];c.query({matcher:function(e,t,s){var i=S.grep(a,function(e){return p(e,c.id(s))}).length;return i&&r.push(s),i},callback:S.isFunction(o)?function(){for(var e=[],t=0;t<a.length;t++)for(var s=a[t],i=0;i<r.length;i++){var n=r[i];if(p(s,c.id(n))){e.push(n),r.splice(i,1);break}}o(e)}:S.noop})}),c},selectChoice:function(e){var t=this.container.find(".select2-search-choice-focus");t.length&&e&&e[0]==t[0]||(t.length&&this.opts.element.trigger("choice-deselected",t),t.removeClass("select2-search-choice-focus"),e&&e.length&&(this.close(),e.addClass("select2-search-choice-focus"),this.opts.element.trigger("choice-selected",e)))},destroy:function(){S("label[for='"+this.search.attr("id")+"']").attr("for",this.opts.element.attr("id")),this.parent.destroy.apply(this,arguments),A.call(this,"searchContainer","selection")},initContainer:function(){var a,e=".select2-choices";this.searchContainer=this.container.find(".select2-search-field"),this.selection=a=this.container.find(e);var t=this;this.selection.on("click",".select2-search-choice:not(.select2-locked)",function(e){t.search[0].focus(),t.selectChoice(S(this))}),this.search.attr("id","s2id_autogen"+y()),this.search.prev().text(S("label[for='"+this.opts.element.attr("id")+"']").text()).attr("for",this.search.attr("id")),this.search.on("input paste",this.bind(function(){this.search.attr("placeholder")&&0==this.search.val().length||this.isInterfaceEnabled()&&(this.opened()||this.open())})),this.search.attr("tabindex",this.elementTabIndex),this.keydowns=0,this.search.on("keydown",this.bind(function(e){if(this.isInterfaceEnabled()){++this.keydowns;var t=a.find(".select2-search-choice-focus"),s=t.prev(".select2-search-choice:not(.select2-locked)"),i=t.next(".select2-search-choice:not(.select2-locked)"),n=function(e){var t=0,s=0;if("selectionStart"in(e=S(e)[0]))t=e.selectionStart,s=e.selectionEnd-t;else if("selection"in document){e.focus();var i=document.selection.createRange();s=document.selection.createRange().text.length,i.moveStart("character",-e.value.length),t=i.text.length-s}return{offset:t,length:s}}(this.search);if(t.length&&(e.which==r.LEFT||e.which==r.RIGHT||e.which==r.BACKSPACE||e.which==r.DELETE||e.which==r.ENTER)){var o=t;return e.which==r.LEFT&&s.length?o=s:e.which==r.RIGHT?o=i.length?i:null:e.which===r.BACKSPACE?this.unselect(t.first())&&(this.search.width(10),o=s.length?s:i):e.which==r.DELETE?this.unselect(t.first())&&(this.search.width(10),o=i.length?i:null):e.which==r.ENTER&&(o=null),this.selectChoice(o),v(e),void(o&&o.length||this.open())}if((e.which===r.BACKSPACE&&1==this.keydowns||e.which==r.LEFT)&&0==n.offset&&!n.length)return this.selectChoice(a.find(".select2-search-choice:not(.select2-locked)").last()),void v(e);if(this.selectChoice(null),this.opened())switch(e.which){case r.UP:case r.DOWN:return this.moveHighlight(e.which===r.UP?-1:1),void v(e);case r.ENTER:return this.selectHighlighted(),void v(e);case r.TAB:return this.selectHighlighted({noFocus:!0}),void this.close();case r.ESC:return this.cancel(e),void v(e)}if(e.which!==r.TAB&&!r.isControl(e)&&!r.isFunctionKey(e)&&e.which!==r.BACKSPACE&&e.which!==r.ESC){if(e.which===r.ENTER){if(!1===this.opts.openOnEnter)return;if(e.altKey||e.ctrlKey||e.shiftKey||e.metaKey)return}this.open(),e.which!==r.PAGE_UP&&e.which!==r.PAGE_DOWN||v(e),e.which===r.ENTER&&v(e)}}})),this.search.on("keyup",this.bind(function(e){this.keydowns=0,this.resizeSearch()})),this.search.on("blur",this.bind(function(e){this.container.removeClass("select2-container-active"),this.search.removeClass("select2-focused"),this.selectChoice(null),this.opened()||this.clearSearch(),e.stopImmediatePropagation(),this.opts.element.trigger(S.Event("select2-blur"))})),this.container.on("click",e,this.bind(function(e){this.isInterfaceEnabled()&&(0<S(e.target).closest(".select2-search-choice").length||(this.selectChoice(null),this.clearPlaceholder(),this.container.hasClass("select2-container-active")||this.opts.element.trigger(S.Event("select2-focus")),this.open(),this.focusSearch(),e.preventDefault()))})),this.container.on("focus",e,this.bind(function(){this.isInterfaceEnabled()&&(this.container.hasClass("select2-container-active")||this.opts.element.trigger(S.Event("select2-focus")),this.container.addClass("select2-container-active"),this.dropdown.addClass("select2-drop-active"),this.clearPlaceholder())})),this.initContainerWidth(),this.opts.element.addClass("select2-offscreen"),this.clearSearch()},enableInterface:function(){this.parent.enableInterface.apply(this,arguments)&&this.search.prop("disabled",!this.isInterfaceEnabled())},initSelection:function(){if(""===this.opts.element.val()&&""===this.opts.element.text()&&(this.updateSelection([]),this.close(),this.clearSearch()),this.select||""!==this.opts.element.val()){var t=this;this.opts.initSelection.call(null,this.opts.element,function(e){e!==C&&null!==e&&(t.updateSelection(e),t.close(),t.clearSearch())})}},clearSearch:function(){var e=this.getPlaceholder(),t=this.getMaxSearchWidth();e!==C&&0===this.getVal().length&&!1===this.search.hasClass("select2-focused")?(this.search.val(e).addClass("select2-default"),this.search.width(0<t?t:this.container.css("width"))):this.search.val("").width(10)},clearPlaceholder:function(){this.search.hasClass("select2-default")&&this.search.val("").removeClass("select2-default")},opening:function(){this.clearPlaceholder(),this.resizeSearch(),this.parent.opening.apply(this,arguments),this.focusSearch(),""===this.search.val()&&this.nextSearchTerm!=C&&(this.search.val(this.nextSearchTerm),this.search.select()),this.updateResults(!0),this.opts.shouldFocusInput(this)&&this.search.focus(),this.opts.element.trigger(S.Event("select2-open"))},close:function(){this.opened()&&this.parent.close.apply(this,arguments)},focus:function(){this.close(),this.search.focus()},isFocused:function(){return this.search.hasClass("select2-focused")},updateSelection:function(e){var t=[],s=[],i=this;S(e).each(function(){u(i.id(this),t)<0&&(t.push(i.id(this)),s.push(this))}),e=s,this.selection.find(".select2-search-choice").remove(),S(e).each(function(){i.addSelectedChoice(this)}),i.postprocessResults()},tokenize:function(){var e=this.search.val();null!=(e=this.opts.tokenizer.call(this,e,this.data(),this.bind(this.onSelect),this.opts))&&e!=C&&(this.search.val(e),0<e.length&&this.open())},onSelect:function(e,t){this.triggerSelect(e)&&""!==e.text&&(this.addSelectedChoice(e),this.opts.element.trigger({type:"selected",val:this.id(e),choice:e}),this.nextSearchTerm=this.opts.nextSearchTerm(e,this.search.val()),this.clearSearch(),this.nextSearchTerm!=C&&this.search.val(this.nextSearchTerm),this.updateResults(),!this.select&&this.opts.closeOnSelect||this.postprocessResults(e,!1,!0===this.opts.closeOnSelect),this.opts.closeOnSelect?(this.close(),this.search.width(10)):0<this.countSelectableResults()?(this.search.width(10),this.resizeSearch(),0<this.getMaximumSelectionSize()&&this.val().length>=this.getMaximumSelectionSize()?this.updateResults(!0):this.nextSearchTerm!=C&&(this.search.val(this.nextSearchTerm),this.updateResults(),this.search.select()),this.positionDropdown()):(this.close(),this.search.width(10)),this.triggerChange({added:e}),t&&t.noFocus||this.focusSearch())},cancel:function(){this.close(),this.focusSearch()},addSelectedChoice:function(e){var t,s,i=!e.locked,n=S("<li class='select2-search-choice'>    <div></div>    <a href='#' class='select2-search-choice-close' tabindex='-1'></a></li>"),o=S("<li class='select2-search-choice select2-locked'><div></div></li>"),a=i?n:o,r=this.id(e),c=this.getVal();(t=this.opts.formatSelection(e,a.find("div"),this.opts.escapeMarkup))!=C&&a.find("div").replaceWith("<div>"+t+"</div>"),(s=this.opts.formatSelectionCssClass(e,a.find("div")))!=C&&a.addClass(s),i&&a.find(".select2-search-choice-close").on("mousedown",v).on("click dblclick",this.bind(function(e){this.isInterfaceEnabled()&&(this.unselect(S(e.target)),this.selection.find(".select2-search-choice-focus").removeClass("select2-search-choice-focus"),v(e),this.close(),this.focusSearch())})).on("focus",this.bind(function(){this.isInterfaceEnabled()&&(this.container.addClass("select2-container-active"),this.dropdown.addClass("select2-drop-active"))})),a.data("select2-data",e),a.insertBefore(this.searchContainer),c.push(r),this.setVal(c)},unselect:function(e){var t,s,i=this.getVal();if(0===(e=e.closest(".select2-search-choice")).length)throw"Invalid argument: "+e+". Must be .select2-search-choice";if(t=e.data("select2-data")){var n=S.Event("select2-removing");if(n.val=this.id(t),n.choice=t,this.opts.element.trigger(n),n.isDefaultPrevented())return!1;for(;0<=(s=u(this.id(t),i));)i.splice(s,1),this.setVal(i),this.select&&this.postprocessResults();return e.remove(),this.opts.element.trigger({type:"select2-removed",val:this.id(t),choice:t}),this.triggerChange({removed:t}),!0}},postprocessResults:function(e,t,s){var i=this.getVal(),n=this.results.find(".select2-result"),o=this.results.find(".select2-result-with-children"),a=this;n.each2(function(e,t){0<=u(a.id(t.data("select2-data")),i)&&(t.addClass("select2-selected"),t.find(".select2-result-selectable").addClass("select2-selected"))}),o.each2(function(e,t){t.is(".select2-result-selectable")||0!==t.find(".select2-result-selectable:not(.select2-selected)").length||t.addClass("select2-selected")}),-1==this.highlight()&&!1!==s&&a.highlight(0),!this.opts.createSearchChoice&&0<!n.filter(".select2-result:not(.select2-selected)").length&&(!e||e&&!e.more&&0===this.results.find(".select2-no-results").length)&&I(a.opts.formatNoMatches,"formatNoMatches")&&this.results.append("<li class='select2-no-results'>"+k(a.opts.formatNoMatches,a.opts.element,a.search.val())+"</li>")},getMaxSearchWidth:function(){return this.selection.width()-f(this.search)},resizeSearch:function(){var e,t,s,i,n=f(this.search);e=function(e){if(!o){var t=e[0].currentStyle||window.getComputedStyle(e[0],null);(o=S(document.createElement("div")).css({position:"absolute",left:"-10000px",top:"-10000px",display:"none",fontSize:t.fontSize,fontFamily:t.fontFamily,fontStyle:t.fontStyle,fontWeight:t.fontWeight,letterSpacing:t.letterSpacing,textTransform:t.textTransform,whiteSpace:"nowrap"})).attr("class","select2-sizer"),S("body").append(o)}return o.text(e.val()),o.width()}(this.search)+10,t=this.search.offset().left,(i=(s=this.selection.width())-(t-this.selection.offset().left)-n)<e&&(i=s-n),i<40&&(i=s-n),i<=0&&(i=e),this.search.width(Math.floor(i))},getVal:function(){var e;return this.select?null===(e=this.select.val())?[]:e:d(e=this.opts.element.val(),this.opts.separator)},setVal:function(e){var t;this.select?this.select.val(e):(t=[],S(e).each(function(){u(this,t)<0&&t.push(this)}),this.opts.element.val(0===t.length?"":t.join(this.opts.separator)))},buildChangeDetails:function(e,t){t=t.slice(0),e=e.slice(0);for(var s=0;s<t.length;s++)for(var i=0;i<e.length;i++)p(this.opts.id(t[s]),this.opts.id(e[i]))&&(t.splice(s,1),0<s&&s--,e.splice(i,1),i--);return{added:t,removed:e}},val:function(e,s){var i,n=this;if(0===arguments.length)return this.getVal();if((i=this.data()).length||(i=[]),!e&&0!==e)return this.opts.element.val(""),this.updateSelection([]),this.clearSearch(),void(s&&this.triggerChange({added:this.data(),removed:i}));if(this.setVal(e),this.select)this.opts.initSelection(this.select,this.bind(this.updateSelection)),s&&this.triggerChange(this.buildChangeDetails(i,this.data()));else{if(this.opts.initSelection===C)throw new Error("val() cannot be called if initSelection() is not defined");this.opts.initSelection(this.opts.element,function(e){var t=S.map(e,n.id);n.setVal(t),n.updateSelection(e),n.clearSearch(),s&&n.triggerChange(n.buildChangeDetails(i,n.data()))})}this.clearSearch()},onSortStart:function(){if(this.select)throw new Error("Sorting of elements is not supported when attached to <select>. Attach to <input type='hidden'/> instead.");this.search.width(0),this.searchContainer.hide()},onSortEnd:function(){var e=[],t=this;this.searchContainer.show(),this.searchContainer.appendTo(this.searchContainer.parent()),this.resizeSearch(),this.selection.find(".select2-search-choice").each(function(){e.push(t.opts.id(S(this).data("select2-data")))}),this.setVal(e),this.triggerChange()},data:function(e,t){var s,i,n=this;if(0===arguments.length)return this.selection.children(".select2-search-choice").map(function(){return S(this).data("select2-data")}).get();i=this.data(),e||(e=[]),0<(s=S.map(e,function(e){return n.opts.id(e)})).length&&(this.setVal(s),this.updateSelection(e),this.clearSearch(),this.nextSearchTerm!==C&&this.search.val(this.nextSearchTerm),t&&this.triggerChange(this.buildChangeDetails(i,this.data())))}}),S.fn.select2=function(){var e,t,s,i,n,o=Array.prototype.slice.call(arguments,0),a=["val","destroy","opened","open","close","focus","isFocused","container","dropdown","onSortStart","onSortEnd","enable","disable","readonly","positionDropdown","data","search"],r=["opened","isFocused","container","dropdown"],c=["val","data"],l={search:"externalSearch"};return this.each(function(){if(0===o.length||"object"==typeof o[0])(e=0===o.length?{}:S.extend({},o[0])).element=S(this),"select"===e.element.get(0).tagName.toLowerCase()?n=e.element.prop("multiple"):(n=e.multiple||!1,"tags"in e&&(e.multiple=n=!0)),(t=n?new window.Select2.class.multi:new window.Select2.class.single).init(e);else{if("string"!=typeof o[0])throw"Invalid arguments to select2 plugin: "+o;if(u(o[0],a)<0)throw"Unknown method: "+o[0];if(i=C,(t=S(this).data("select2"))===C)return;if("container"===(s=o[0])?i=t.container:"dropdown"===s?i=t.dropdown:(l[s]&&(s=l[s]),i=t[s].apply(t,o.slice(1))),0<=u(o[0],r)||0<=u(o[0],c)&&1==o.length)return!1}}),i===C?this:i},S.fn.select2.defaults={width:"copy",loadMorePadding:0,closeOnSelect:!0,openOnEnter:!0,containerCss:{},dropdownCss:{},containerCssClass:"",dropdownCssClass:"",formatResult:function(e,t,s,i){var n=[];return b(e.text,s.term,n,i),n.join("")},formatSelection:function(e,t,s){return e?s(e.text):C},sortResults:function(e,t,s){return e},formatResultCssClass:function(e){return e.css},formatSelectionCssClass:function(e,t){return C},minimumResultsForSearch:0,minimumInputLength:0,maximumInputLength:null,maximumSelectionSize:0,id:function(e){return e==C?null:e.id},matcher:function(e,t){return 0<=h(""+t).toUpperCase().indexOf(h(""+e).toUpperCase())},separator:",",tokenSeparators:[],tokenizer:function(e,t,s,i){var n,o,a,r,c,l=e,h=!1;if(!i.createSearchChoice||!i.tokenSeparators||i.tokenSeparators.length<1)return C;for(;;){for(o=-1,a=0,r=i.tokenSeparators.length;a<r&&(c=i.tokenSeparators[a],!(0<=(o=e.indexOf(c))));a++);if(o<0)break;if(n=e.substring(0,o),e=e.substring(o+c.length),0<n.length&&(n=i.createSearchChoice.call(this,n,t))!==C&&null!==n&&i.id(n)!==C&&null!==i.id(n)){for(h=!1,a=0,r=t.length;a<r;a++)if(p(i.id(n),i.id(t[a]))){h=!0;break}h||s(n)}}return l!==e?e:void 0},escapeMarkup:E,blurOnChange:!1,selectOnBlur:!1,adaptContainerCssClass:function(e){return e},adaptDropdownCssClass:function(e){return null},nextSearchTerm:function(e,t){return C},searchInputPlaceholder:"",createSearchChoicePosition:"top",shouldFocusInput:function(e){return!("ontouchstart"in window||0<navigator.msMaxTouchPoints)||!(e.opts.minimumResultsForSearch<0)}},S.fn.select2.locales=[],S.fn.select2.locales.en={formatMatches:function(e){return 1===e?"One result is available, press enter to select it.":e+" results are available, use up and down arrow keys to navigate."},formatNoMatches:function(){return"No matches found"},formatAjaxError:function(e,t,s){return"Loading failed"},formatInputTooShort:function(e,t){var s=t-e.length;return"Please enter "+s+" or more character"+(1==s?"":"s")},formatInputTooLong:function(e,t){var s=e.length-t;return"Please delete "+s+" character"+(1==s?"":"s")},formatSelectionTooBig:function(e){return"You can only select "+e+" item"+(1==e?"":"s")},formatLoadMore:function(e){return"Loading more results…"},formatSearching:function(){return"Searching…"}},S.extend(S.fn.select2.defaults,S.fn.select2.locales.en),S.fn.select2.ajaxDefaults={transport:S.ajax,params:{type:"GET",cache:!1,dataType:"json"}},window.Select2={query:{ajax:T,local:O,tags:P},util:{debounce:m,markMatch:b,escapeMarkup:E,stripDiacritics:h},class:{abstract:e,single:t,multi:s}}}function c(e){var t=S(document.createTextNode(""));e.before(t),t.before(e),t.remove()}function h(e){return e.replace(/[^\u0000-\u007E]/g,function(e){return a[e]||e})}function u(e,t){for(var s=0,i=t.length;s<i;s+=1)if(p(e,t[s]))return s;return-1}function p(e,t){return e===t||e!==C&&t!==C&&(null!==e&&null!==t&&(e.constructor===String?e+""==t+"":t.constructor===String&&t+""==e+""))}function d(e,t){var s,i,n;if(null===e||e.length<1)return[];for(i=0,n=(s=e.split(t)).length;i<n;i+=1)s[i]=S.trim(s[i]);return s}function f(e){return e.outerWidth(!1)-e.width()}function g(t){var s="keyup-change-value";t.on("keydown",function(){S.data(t,s)===C&&S.data(t,s,t.val())}),t.on("keyup",function(){var e=S.data(t,s);e!==C&&t.val()!==e&&(S.removeData(t,s),t.trigger("keyup-change"))})}function m(t,s,i){var n;return i=i||C,function(){var e=arguments;window.clearTimeout(n),n=window.setTimeout(function(){s.apply(i,e)},t)}}function v(e){e.preventDefault(),e.stopPropagation()}function w(e,t,s){var i,n,o=[];(i=S.trim(e.attr("class")))&&S((i=""+i).split(/\s+/)).each2(function(){0===this.indexOf("select2-")&&o.push(this)}),(i=S.trim(t.attr("class")))&&S((i=""+i).split(/\s+/)).each2(function(){0!==this.indexOf("select2-")&&(n=s(this))&&o.push(n)}),e.attr("class",o.join(" "))}function b(e,t,s,i){var n=h(e.toUpperCase()).indexOf(h(t.toUpperCase())),o=t.length;n<0?s.push(i(e)):(s.push(i(e.substring(0,n))),s.push("<span class='select2-match'>"),s.push(i(e.substring(n,n+o))),s.push("</span>"),s.push(i(e.substring(n+o,e.length))))}function E(e){var t={"\\":"&#92;","&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#47;"};return String(e).replace(/[&<>"'\/\\]/g,function(e){return t[e]})}function T(a){var e,r=null,t=a.quietMillis||100,c=a.url,l=this;return function(o){window.clearTimeout(e),e=window.setTimeout(function(){var e=a.data,t=c,s=a.transport||S.fn.select2.ajaxDefaults.transport,i={type:a.type||"GET",cache:a.cache||!1,jsonpCallback:a.jsonpCallback||C,dataType:a.dataType||"json"},n=S.extend({},S.fn.select2.ajaxDefaults.params,i);e=e?e.call(l,o.term,o.page,o.context):null,t="function"==typeof t?t.call(l,o.term,o.page,o.context):t,r&&"function"==typeof r.abort&&r.abort(),a.params&&(S.isFunction(a.params)?S.extend(n,a.params.call(l)):S.extend(n,a.params)),S.extend(n,{url:t,dataType:a.dataType,data:e,success:function(e){var t=a.results(e,o.page,o);o.callback(t)},error:function(e,t,s){var i={hasError:!0,jqXHR:e,textStatus:t,errorThrown:s};o.callback(i)}}),r=s.call(l,n)},t)}}function O(e){var t,s,i=e,r=function(e){return""+e.text};S.isArray(i)&&(i={results:s=i}),!1===S.isFunction(i)&&(s=i,i=function(){return s});var n=i();return n.text&&(r=n.text,S.isFunction(r)||(t=n.text,r=function(e){return e[t]})),function(n){var o,a=n.term,s={results:[]};""!==a?(o=function(e,t){var s,i;if((e=e[0]).children){for(i in s={},e)e.hasOwnProperty(i)&&(s[i]=e[i]);s.children=[],S(e.children).each2(function(e,t){o(t,s.children)}),(s.children.length||n.matcher(a,r(s),e))&&t.push(s)}else n.matcher(a,r(e),e)&&t.push(e)},S(i().results).each2(function(e,t){o(t,s.results)}),n.callback(s)):n.callback(i())}}function P(t){var o=S.isFunction(t);return function(s){var i=s.term,n={results:[]},e=o?t(s):t;S.isArray(e)&&(S(e).each(function(){var e=this.text!==C,t=e?this.text:this;(""===i||s.matcher(i,t))&&n.results.push(e?this:{id:this,text:this})}),s.callback(n))}}function I(e,t){if(S.isFunction(e))return!0;if(!e)return!1;if("string"==typeof e)return!0;throw new Error(t+" must be a string, function, or falsy value")}function k(e,t){if(S.isFunction(e)){var s=Array.prototype.slice.call(arguments,2);return e.apply(t,s)}return e}function A(){var s=this;S.each(arguments,function(e,t){s[t].remove(),s[t]=null})}function R(e,t){var s=function(){};return((s.prototype=new e).constructor=s).prototype.parent=e.prototype,s.prototype=S.extend(s.prototype,t),s}}(jQuery);
;/*!
 * ui-select
 * http://github.com/angular-ui/ui-select
 * Version: 0.19.7 - 2017-04-15T14:28:36.649Z
 * License: MIT
 */
(function(){"use strict";var KEY={TAB:9,ENTER:13,ESC:27,SPACE:32,LEFT:37,UP:38,RIGHT:39,DOWN:40,SHIFT:16,CTRL:17,ALT:18,PAGE_UP:33,PAGE_DOWN:34,HOME:36,END:35,BACKSPACE:8,DELETE:46,COMMAND:91,MAP:{91:"COMMAND",8:"BACKSPACE",9:"TAB",13:"ENTER",16:"SHIFT",17:"CTRL",18:"ALT",19:"PAUSEBREAK",20:"CAPSLOCK",27:"ESC",32:"SPACE",33:"PAGE_UP",34:"PAGE_DOWN",35:"END",36:"HOME",37:"LEFT",38:"UP",39:"RIGHT",40:"DOWN",43:"+",44:"PRINTSCREEN",45:"INSERT",46:"DELETE",48:"0",49:"1",50:"2",51:"3",52:"4",53:"5",54:"6",55:"7",56:"8",57:"9",59:";",61:"=",65:"A",66:"B",67:"C",68:"D",69:"E",70:"F",71:"G",72:"H",73:"I",74:"J",75:"K",76:"L",77:"M",78:"N",79:"O",80:"P",81:"Q",82:"R",83:"S",84:"T",85:"U",86:"V",87:"W",88:"X",89:"Y",90:"Z",96:"0",97:"1",98:"2",99:"3",100:"4",101:"5",102:"6",103:"7",104:"8",105:"9",106:"*",107:"+",109:"-",110:".",111:"/",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NUMLOCK",145:"SCROLLLOCK",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},isControl:function(e){var k=e.which;switch(k){case KEY.COMMAND:case KEY.SHIFT:case KEY.CTRL:case KEY.ALT:return true;}
if(e.metaKey||e.ctrlKey||e.altKey)return true;return false;},isFunctionKey:function(k){k=k.which?k.which:k;return k>=112&&k<=123;},isVerticalMovement:function(k){return~[KEY.UP,KEY.DOWN].indexOf(k);},isHorizontalMovement:function(k){return~[KEY.LEFT,KEY.RIGHT,KEY.BACKSPACE,KEY.DELETE].indexOf(k);},toSeparator:function(k){var sep={ENTER:"\n",TAB:"\t",SPACE:" "}[k];if(sep)return sep;return KEY[k]?undefined:k;}};function isNil(value){return angular.isUndefined(value)||value===null;}
if(angular.element.prototype.querySelectorAll===undefined){angular.element.prototype.querySelectorAll=function(selector){return angular.element(this[0].querySelectorAll(selector));};}
if(angular.element.prototype.closest===undefined){angular.element.prototype.closest=function(selector){var elem=this[0];var matchesSelector=elem.matches||elem.webkitMatchesSelector||elem.mozMatchesSelector||elem.msMatchesSelector;while(elem){if(matchesSelector.bind(elem)(selector)){return elem;}else{elem=elem.parentElement;}}
return false;};}
var latestId=0;var uis=angular.module('ui.select',[]).constant('uiSelectConfig',{theme:'bootstrap',searchEnabled:true,sortable:false,placeholder:'',refreshDelay:1000,closeOnSelect:true,skipFocusser:false,dropdownPosition:'auto',removeSelected:true,resetSearchInput:true,generateId:function(){return latestId++;},appendToBody:false,spinnerEnabled:false,spinnerClass:'glyphicon glyphicon-refresh ui-select-spin',backspaceReset:true}).service('uiSelectMinErr',function(){var minErr=angular.$$minErr('ui.select');return function(){var error=minErr.apply(this,arguments);var message=error.message.replace(new RegExp('\nhttp://errors.angularjs.org/.*'),'');return new Error(message);};}).directive('uisTranscludeAppend',function(){return{link:function(scope,element,attrs,ctrl,transclude){transclude(scope,function(clone){element.append(clone);});}};}).filter('highlight',function(){function escapeRegexp(queryToEscape){return(''+queryToEscape).replace(/([.?*+^$[\]\\(){}|-])/g,'\\$1');}
return function(matchItem,query){return query&&matchItem?(''+matchItem).replace(new RegExp(escapeRegexp(query),'gi'),'<span class="ui-select-highlight">$&</span>'):matchItem;};}).factory('uisOffset',['$document','$window',function($document,$window){return function(element){var boundingClientRect=element[0].getBoundingClientRect();return{width:boundingClientRect.width||element.prop('offsetWidth'),height:boundingClientRect.height||element.prop('offsetHeight'),top:boundingClientRect.top+($window.pageYOffset||$document[0].documentElement.scrollTop),left:boundingClientRect.left+($window.pageXOffset||$document[0].documentElement.scrollLeft)};};}]);uis.factory('$$uisDebounce',['$timeout',function($timeout){return function(callback,debounceTime){var timeoutPromise;return function(){var self=this;var args=Array.prototype.slice.call(arguments);if(timeoutPromise){$timeout.cancel(timeoutPromise);}
timeoutPromise=$timeout(function(){callback.apply(self,args);},debounceTime);};};}]);uis.directive('uiSelectChoices',['uiSelectConfig','uisRepeatParser','uiSelectMinErr','$compile','$window',function(uiSelectConfig,RepeatParser,uiSelectMinErr,$compile,$window){return{restrict:'EA',require:'^uiSelect',replace:true,transclude:true,templateUrl:function(tElement){tElement.addClass('ui-select-choices');var theme=tElement.parent().attr('theme')||uiSelectConfig.theme;return theme+'/choices.tpl.html';},compile:function(tElement,tAttrs){if(!tAttrs.repeat)throw uiSelectMinErr('repeat',"Expected 'repeat' expression.");var groupByExp=tAttrs.groupBy;var groupFilterExp=tAttrs.groupFilter;if(groupByExp){var groups=tElement.querySelectorAll('.ui-select-choices-group');if(groups.length!==1)throw uiSelectMinErr('rows',"Expected 1 .ui-select-choices-group but got '{0}'.",groups.length);groups.attr('ng-repeat',RepeatParser.getGroupNgRepeatExpression());}
var parserResult=RepeatParser.parse(tAttrs.repeat);var choices=tElement.querySelectorAll('.ui-select-choices-row');if(choices.length!==1){throw uiSelectMinErr('rows',"Expected 1 .ui-select-choices-row but got '{0}'.",choices.length);}
choices.attr('ng-repeat',parserResult.repeatExpression(groupByExp)).attr('ng-if','$select.open');var rowsInner=tElement.querySelectorAll('.ui-select-choices-row-inner');if(rowsInner.length!==1){throw uiSelectMinErr('rows',"Expected 1 .ui-select-choices-row-inner but got '{0}'.",rowsInner.length);}
rowsInner.attr('uis-transclude-append','');var clickTarget=$window.document.addEventListener?choices:rowsInner;clickTarget.attr('ng-click','$select.select('+parserResult.itemName+',$select.skipFocusser,$event)');return function link(scope,element,attrs,$select){$select.parseRepeatAttr(attrs.repeat,groupByExp,groupFilterExp);$select.disableChoiceExpression=attrs.uiDisableChoice;$select.onHighlightCallback=attrs.onHighlight;$select.minimumInputLength=parseInt(attrs.minimumInputLength)||0;$select.dropdownPosition=attrs.position?attrs.position.toLowerCase():uiSelectConfig.dropdownPosition;scope.$watch('$select.search',function(newValue){if(newValue&&!$select.open&&$select.multiple)$select.activate(false,true);$select.activeIndex=$select.tagging.isActivated?-1:0;if(!attrs.minimumInputLength||$select.search.length>=attrs.minimumInputLength){$select.refresh(attrs.refresh);}else{$select.items=[];}});attrs.$observe('refreshDelay',function(){var refreshDelay=scope.$eval(attrs.refreshDelay);$select.refreshDelay=refreshDelay!==undefined?refreshDelay:uiSelectConfig.refreshDelay;});scope.$watch('$select.open',function(open){if(open){tElement.attr('role','listbox');$select.refresh(attrs.refresh);}else{element.removeAttr('role');}});};}};}]);uis.controller('uiSelectCtrl',['$scope','$element','$timeout','$filter','$$uisDebounce','uisRepeatParser','uiSelectMinErr','uiSelectConfig','$parse','$injector','$window',function($scope,$element,$timeout,$filter,$$uisDebounce,RepeatParser,uiSelectMinErr,uiSelectConfig,$parse,$injector,$window){var ctrl=this;var EMPTY_SEARCH='';ctrl.placeholder=uiSelectConfig.placeholder;ctrl.searchEnabled=uiSelectConfig.searchEnabled;ctrl.sortable=uiSelectConfig.sortable;ctrl.refreshDelay=uiSelectConfig.refreshDelay;ctrl.paste=uiSelectConfig.paste;ctrl.resetSearchInput=uiSelectConfig.resetSearchInput;ctrl.refreshing=false;ctrl.spinnerEnabled=uiSelectConfig.spinnerEnabled;ctrl.spinnerClass=uiSelectConfig.spinnerClass;ctrl.removeSelected=uiSelectConfig.removeSelected;ctrl.closeOnSelect=true;ctrl.skipFocusser=false;ctrl.search=EMPTY_SEARCH;ctrl.activeIndex=0;ctrl.items=[];ctrl.open=false;ctrl.focus=false;ctrl.disabled=false;ctrl.selected=undefined;ctrl.dropdownPosition='auto';ctrl.focusser=undefined;ctrl.multiple=undefined;ctrl.disableChoiceExpression=undefined;ctrl.tagging={isActivated:false,fct:undefined};ctrl.taggingTokens={isActivated:false,tokens:undefined};ctrl.lockChoiceExpression=undefined;ctrl.clickTriggeredSelect=false;ctrl.$filter=$filter;ctrl.$element=$element;ctrl.$animate=(function(){try{return $injector.get('$animate');}catch(err){return null;}})();ctrl.searchInput=$element.querySelectorAll('input.ui-select-search');if(ctrl.searchInput.length!==1){throw uiSelectMinErr('searchInput',"Expected 1 input.ui-select-search but got '{0}'.",ctrl.searchInput.length);}
ctrl.isEmpty=function(){return isNil(ctrl.selected)||ctrl.selected===''||(ctrl.multiple&&ctrl.selected.length===0);};function _findIndex(collection,predicate,thisArg){if(collection.findIndex){return collection.findIndex(predicate,thisArg);}else{var list=Object(collection);var length=list.length>>>0;var value;for(var i=0;i<length;i++){value=list[i];if(predicate.call(thisArg,value,i,list)){return i;}}
return-1;}}
function _resetSearchInput(){if(ctrl.resetSearchInput){ctrl.search=EMPTY_SEARCH;if(ctrl.selected&&ctrl.items.length&&!ctrl.multiple){ctrl.activeIndex=_findIndex(ctrl.items,function(item){return angular.equals(this,item);},ctrl.selected);}}}
function _groupsFilter(groups,groupNames){var i,j,result=[];for(i=0;i<groupNames.length;i++){for(j=0;j<groups.length;j++){if(groups[j].name==[groupNames[i]]){result.push(groups[j]);}}}
return result;}
ctrl.activate=function(initSearchValue,avoidReset){if(!ctrl.disabled&&!ctrl.open){if(!avoidReset)_resetSearchInput();$scope.$broadcast('uis:activate');ctrl.open=true;ctrl.activeIndex=ctrl.activeIndex>=ctrl.items.length?0:ctrl.activeIndex;if(ctrl.activeIndex===-1&&ctrl.taggingLabel!==false){ctrl.activeIndex=0;}
var container=$element.querySelectorAll('.ui-select-choices-content');var searchInput=$element.querySelectorAll('.ui-select-search');if(ctrl.$animate&&ctrl.$animate.on&&ctrl.$animate.enabled(container[0])){var animateHandler=function(elem,phase){if(phase==='start'&&ctrl.items.length===0){ctrl.$animate.off('removeClass',searchInput[0],animateHandler);$timeout(function(){ctrl.focusSearchInput(initSearchValue);});}else if(phase==='close'){ctrl.$animate.off('enter',container[0],animateHandler);$timeout(function(){ctrl.focusSearchInput(initSearchValue);});}};if(ctrl.items.length>0){ctrl.$animate.on('enter',container[0],animateHandler);}else{ctrl.$animate.on('removeClass',searchInput[0],animateHandler);}}else{$timeout(function(){ctrl.focusSearchInput(initSearchValue);if(!ctrl.tagging.isActivated&&ctrl.items.length>1){_ensureHighlightVisible();}});}}
else if(ctrl.open&&!ctrl.searchEnabled){ctrl.close();}};ctrl.focusSearchInput=function(initSearchValue){ctrl.search=initSearchValue||ctrl.search;ctrl.searchInput[0].focus();};ctrl.findGroupByName=function(name){return ctrl.groups&&ctrl.groups.filter(function(group){return group.name===name;})[0];};ctrl.parseRepeatAttr=function(repeatAttr,groupByExp,groupFilterExp){function updateGroups(items){var groupFn=$scope.$eval(groupByExp);ctrl.groups=[];angular.forEach(items,function(item){var groupName=angular.isFunction(groupFn)?groupFn(item):item[groupFn];var group=ctrl.findGroupByName(groupName);if(group){group.items.push(item);}
else{ctrl.groups.push({name:groupName,items:[item]});}});if(groupFilterExp){var groupFilterFn=$scope.$eval(groupFilterExp);if(angular.isFunction(groupFilterFn)){ctrl.groups=groupFilterFn(ctrl.groups);}else if(angular.isArray(groupFilterFn)){ctrl.groups=_groupsFilter(ctrl.groups,groupFilterFn);}}
ctrl.items=[];ctrl.groups.forEach(function(group){ctrl.items=ctrl.items.concat(group.items);});}
function setPlainItems(items){ctrl.items=items||[];}
ctrl.setItemsFn=groupByExp?updateGroups:setPlainItems;ctrl.parserResult=RepeatParser.parse(repeatAttr);ctrl.isGrouped=!!groupByExp;ctrl.itemProperty=ctrl.parserResult.itemName;var originalSource=ctrl.parserResult.source;var createArrayFromObject=function(){var origSrc=originalSource($scope);$scope.$uisSource=Object.keys(origSrc).map(function(v){var result={};result[ctrl.parserResult.keyName]=v;result.value=origSrc[v];return result;});};if(ctrl.parserResult.keyName){createArrayFromObject();ctrl.parserResult.source=$parse('$uisSource'+ctrl.parserResult.filters);$scope.$watch(originalSource,function(newVal,oldVal){if(newVal!==oldVal)createArrayFromObject();},true);}
ctrl.refreshItems=function(data){data=data||ctrl.parserResult.source($scope);var selectedItems=ctrl.selected;if(ctrl.isEmpty()||(angular.isArray(selectedItems)&&!selectedItems.length)||!ctrl.multiple||!ctrl.removeSelected){ctrl.setItemsFn(data);}else{if(data!==undefined&&data!==null){var filteredItems=data.filter(function(i){return angular.isArray(selectedItems)?selectedItems.every(function(selectedItem){return!angular.equals(i,selectedItem);}):!angular.equals(i,selectedItems);});ctrl.setItemsFn(filteredItems);}}
if(ctrl.dropdownPosition==='auto'||ctrl.dropdownPosition==='up'){$scope.calculateDropdownPos();}
$scope.$broadcast('uis:refresh');};$scope.$watchCollection(ctrl.parserResult.source,function(items){if(items===undefined||items===null){ctrl.items=[];}else{if(!angular.isArray(items)){throw uiSelectMinErr('items',"Expected an array but got '{0}'.",items);}else{ctrl.refreshItems(items);if(angular.isDefined(ctrl.ngModel.$modelValue)){ctrl.ngModel.$modelValue=null;}}}});};var _refreshDelayPromise;ctrl.refresh=function(refreshAttr){if(refreshAttr!==undefined){if(_refreshDelayPromise){$timeout.cancel(_refreshDelayPromise);}
_refreshDelayPromise=$timeout(function(){if($scope.$select.search.length>=$scope.$select.minimumInputLength){var refreshPromise=$scope.$eval(refreshAttr);if(refreshPromise&&angular.isFunction(refreshPromise.then)&&!ctrl.refreshing){ctrl.refreshing=true;refreshPromise.finally(function(){ctrl.refreshing=false;});}}},ctrl.refreshDelay);}};ctrl.isActive=function(itemScope){if(!ctrl.open){return false;}
var itemIndex=ctrl.items.indexOf(itemScope[ctrl.itemProperty]);var isActive=itemIndex==ctrl.activeIndex;if(!isActive||itemIndex<0){return false;}
if(isActive&&!angular.isUndefined(ctrl.onHighlightCallback)){itemScope.$eval(ctrl.onHighlightCallback);}
return isActive;};var _isItemSelected=function(item){return(ctrl.selected&&angular.isArray(ctrl.selected)&&ctrl.selected.filter(function(selection){return angular.equals(selection,item);}).length>0);};var disabledItems=[];function _updateItemDisabled(item,isDisabled){var disabledItemIndex=disabledItems.indexOf(item);if(isDisabled&&disabledItemIndex===-1){disabledItems.push(item);}
if(!isDisabled&&disabledItemIndex>-1){disabledItems.splice(disabledItemIndex,1);}}
function _isItemDisabled(item){return disabledItems.indexOf(item)>-1;}
ctrl.isDisabled=function(itemScope){if(!ctrl.open)return;var item=itemScope[ctrl.itemProperty];var itemIndex=ctrl.items.indexOf(item);var isDisabled=false;if(itemIndex>=0&&(angular.isDefined(ctrl.disableChoiceExpression)||ctrl.multiple)){if(item.isTag)return false;if(ctrl.multiple){isDisabled=_isItemSelected(item);}
if(!isDisabled&&angular.isDefined(ctrl.disableChoiceExpression)){isDisabled=!!(itemScope.$eval(ctrl.disableChoiceExpression));}
_updateItemDisabled(item,isDisabled);}
return isDisabled;};ctrl.select=function(item,skipFocusser,$event){if(isNil(item)||!_isItemDisabled(item)){if(!ctrl.items&&!ctrl.search&&!ctrl.tagging.isActivated)return;if(!item||!_isItemDisabled(item)){ctrl.clickTriggeredSelect=false;if($event&&($event.type==='click'||$event.type==='touchend')&&item)
ctrl.clickTriggeredSelect=true;if(ctrl.tagging.isActivated&&ctrl.clickTriggeredSelect===false){if(ctrl.taggingLabel===false){if(ctrl.activeIndex<0){if(item===undefined){item=ctrl.tagging.fct!==undefined?ctrl.tagging.fct(ctrl.search):ctrl.search;}
if(!item||angular.equals(ctrl.items[0],item)){return;}}else{item=ctrl.items[ctrl.activeIndex];}}else{if(ctrl.activeIndex===0){if(item===undefined)return;if(ctrl.tagging.fct!==undefined&&typeof item==='string'){item=ctrl.tagging.fct(item);if(!item)return;}else if(typeof item==='string'){item=item.replace(ctrl.taggingLabel,'').trim();}}}
if(_isItemSelected(item)){ctrl.close(skipFocusser);return;}}
_resetSearchInput();$scope.$broadcast('uis:select',item);if(ctrl.closeOnSelect){ctrl.close(skipFocusser);}}}};ctrl.close=function(skipFocusser){if(!ctrl.open)return;if(ctrl.ngModel&&ctrl.ngModel.$setTouched)ctrl.ngModel.$setTouched();ctrl.open=false;_resetSearchInput();$scope.$broadcast('uis:close',skipFocusser);};ctrl.setFocus=function(){if(!ctrl.focus)ctrl.focusInput[0].focus();};ctrl.clear=function($event){ctrl.select(null);$event.stopPropagation();$timeout(function(){ctrl.focusser[0].focus();},0,false);};ctrl.toggle=function(e){if(ctrl.open){ctrl.close();e.preventDefault();e.stopPropagation();}else{ctrl.activate();}};ctrl.isLocked=function(){return false;};$scope.$watch(function(){return angular.isDefined(ctrl.lockChoiceExpression)&&ctrl.lockChoiceExpression!=="";},_initaliseLockedChoices);function _initaliseLockedChoices(doInitalise){if(!doInitalise)return;var lockedItems=[];function _updateItemLocked(item,isLocked){var lockedItemIndex=lockedItems.indexOf(item);if(isLocked&&lockedItemIndex===-1){lockedItems.push(item);}
if(!isLocked&&lockedItemIndex>-1){lockedItems.splice(lockedItemIndex,1);}}
function _isItemlocked(item){return lockedItems.indexOf(item)>-1;}
ctrl.isLocked=function(itemScope,itemIndex){var isLocked=false,item=ctrl.selected[itemIndex];if(item){if(itemScope){isLocked=!!(itemScope.$eval(ctrl.lockChoiceExpression));_updateItemLocked(item,isLocked);}else{isLocked=_isItemlocked(item);}}
return isLocked;};}
var sizeWatch=null;var updaterScheduled=false;ctrl.sizeSearchInput=function(){var input=ctrl.searchInput[0],container=ctrl.$element[0],calculateContainerWidth=function(){return container.clientWidth*!!input.offsetParent;},updateIfVisible=function(containerWidth){if(containerWidth===0){return false;}
var inputWidth=containerWidth-input.offsetLeft;if(inputWidth<50)inputWidth=containerWidth;ctrl.searchInput.css('width',inputWidth+'px');return true;};ctrl.searchInput.css('width','10px');$timeout(function(){if(sizeWatch===null&&!updateIfVisible(calculateContainerWidth())){sizeWatch=$scope.$watch(function(){if(!updaterScheduled){updaterScheduled=true;$scope.$$postDigest(function(){updaterScheduled=false;if(updateIfVisible(calculateContainerWidth())){sizeWatch();sizeWatch=null;}});}},angular.noop);}});};function _handleDropDownSelection(key){var processed=true;switch(key){case KEY.DOWN:if(!ctrl.open&&ctrl.multiple)ctrl.activate(false,true);else if(ctrl.activeIndex<ctrl.items.length-1){var idx=++ctrl.activeIndex;while(_isItemDisabled(ctrl.items[idx])&&idx<ctrl.items.length){ctrl.activeIndex=++idx;}}
break;case KEY.UP:var minActiveIndex=(ctrl.search.length===0&&ctrl.tagging.isActivated)?-1:0;if(!ctrl.open&&ctrl.multiple)ctrl.activate(false,true);else if(ctrl.activeIndex>minActiveIndex){var idxmin=--ctrl.activeIndex;while(_isItemDisabled(ctrl.items[idxmin])&&idxmin>minActiveIndex){ctrl.activeIndex=--idxmin;}}
break;case KEY.TAB:if(!ctrl.multiple||ctrl.open)ctrl.select(ctrl.items[ctrl.activeIndex],true);break;case KEY.ENTER:if(ctrl.open&&(ctrl.tagging.isActivated||ctrl.activeIndex>=0)){ctrl.select(ctrl.items[ctrl.activeIndex],ctrl.skipFocusser);}else{ctrl.activate(false,true);}
break;case KEY.ESC:ctrl.close();break;default:processed=false;}
return processed;}
ctrl.searchInput.on('keydown',function(e){var key=e.which;if(~[KEY.ENTER,KEY.ESC].indexOf(key)){e.preventDefault();e.stopPropagation();}
$scope.$apply(function(){var tagged=false;if(ctrl.items.length>0||ctrl.tagging.isActivated){if(!_handleDropDownSelection(key)&&!ctrl.searchEnabled){e.preventDefault();e.stopPropagation();}
if(ctrl.taggingTokens.isActivated){for(var i=0;i<ctrl.taggingTokens.tokens.length;i++){if(ctrl.taggingTokens.tokens[i]===KEY.MAP[e.keyCode]){if(ctrl.search.length>0){tagged=true;}}}
if(tagged){$timeout(function(){ctrl.searchInput.triggerHandler('tagged');var newItem=ctrl.search.replace(KEY.MAP[e.keyCode],'').trim();if(ctrl.tagging.fct){newItem=ctrl.tagging.fct(newItem);}
if(newItem)ctrl.select(newItem,true);});}}}});if(KEY.isVerticalMovement(key)&&ctrl.items.length>0){_ensureHighlightVisible();}
if(key===KEY.ENTER||key===KEY.ESC){e.preventDefault();e.stopPropagation();}});ctrl.searchInput.on('paste',function(e){var data;if(window.clipboardData&&window.clipboardData.getData){data=window.clipboardData.getData('Text');}else{data=(e.originalEvent||e).clipboardData.getData('text/plain');}
data=ctrl.search+data;if(data&&data.length>0){if(ctrl.taggingTokens.isActivated){var items=[];for(var i=0;i<ctrl.taggingTokens.tokens.length;i++){var separator=KEY.toSeparator(ctrl.taggingTokens.tokens[i])||ctrl.taggingTokens.tokens[i];if(data.indexOf(separator)>-1){items=data.split(separator);break;}}
if(items.length===0){items=[data];}
var oldsearch=ctrl.search;angular.forEach(items,function(item){var newItem=ctrl.tagging.fct?ctrl.tagging.fct(item):item;if(newItem){ctrl.select(newItem,true);}});ctrl.search=oldsearch||EMPTY_SEARCH;e.preventDefault();e.stopPropagation();}else if(ctrl.paste){ctrl.paste(data);ctrl.search=EMPTY_SEARCH;e.preventDefault();e.stopPropagation();}}});ctrl.searchInput.on('tagged',function(){$timeout(function(){_resetSearchInput();});});function _ensureHighlightVisible(){var container=$element.querySelectorAll('.ui-select-choices-content');var choices=container.querySelectorAll('.ui-select-choices-row');if(choices.length<1){throw uiSelectMinErr('choices',"Expected multiple .ui-select-choices-row but got '{0}'.",choices.length);}
if(ctrl.activeIndex<0){return;}
var highlighted=choices[ctrl.activeIndex];var posY=highlighted.offsetTop+highlighted.clientHeight-container[0].scrollTop;var height=container[0].offsetHeight;if(posY>height){container[0].scrollTop+=posY-height;}else if(posY<highlighted.clientHeight){if(ctrl.isGrouped&&ctrl.activeIndex===0)
container[0].scrollTop=0;else
container[0].scrollTop-=highlighted.clientHeight-posY;}}
var onResize=$$uisDebounce(function(){ctrl.sizeSearchInput();},50);angular.element($window).bind('resize',onResize);$scope.$on('$destroy',function(){ctrl.searchInput.off('keyup keydown tagged blur paste');angular.element($window).off('resize',onResize);});$scope.$watch('$select.activeIndex',function(activeIndex){if(activeIndex)
$element.find('input').attr('aria-activedescendant','ui-select-choices-row-'+ctrl.generatedId+'-'+activeIndex);});$scope.$watch('$select.open',function(open){if(!open)
$element.find('input').removeAttr('aria-activedescendant');});}]);uis.directive('uiSelect',['$document','uiSelectConfig','uiSelectMinErr','uisOffset','$compile','$parse','$timeout',function($document,uiSelectConfig,uiSelectMinErr,uisOffset,$compile,$parse,$timeout){return{restrict:'EA',templateUrl:function(tElement,tAttrs){var theme=tAttrs.theme||uiSelectConfig.theme;return theme+(angular.isDefined(tAttrs.multiple)?'/select-multiple.tpl.html':'/select.tpl.html');},replace:true,transclude:true,require:['uiSelect','^ngModel'],scope:true,controller:'uiSelectCtrl',controllerAs:'$select',compile:function(tElement,tAttrs){var match=/{(.*)}\s*{(.*)}/.exec(tAttrs.ngClass);if(match){var combined='{'+match[1]+', '+match[2]+'}';tAttrs.ngClass=combined;tElement.attr('ng-class',combined);}
if(angular.isDefined(tAttrs.multiple))
tElement.append('<ui-select-multiple/>').removeAttr('multiple');else
tElement.append('<ui-select-single/>');if(tAttrs.inputId)
tElement.querySelectorAll('input.ui-select-search')[0].id=tAttrs.inputId;return function(scope,element,attrs,ctrls,transcludeFn){var $select=ctrls[0];var ngModel=ctrls[1];$select.generatedId=uiSelectConfig.generateId();$select.baseTitle=attrs.title||'Select box';$select.focusserTitle=$select.baseTitle+' focus';$select.focusserId='focusser-'+$select.generatedId;$select.closeOnSelect=function(){if(angular.isDefined(attrs.closeOnSelect)){return $parse(attrs.closeOnSelect)();}else{return uiSelectConfig.closeOnSelect;}}();scope.$watch('skipFocusser',function(){var skipFocusser=scope.$eval(attrs.skipFocusser);$select.skipFocusser=skipFocusser!==undefined?skipFocusser:uiSelectConfig.skipFocusser;});$select.onSelectCallback=$parse(attrs.onSelect);$select.onRemoveCallback=$parse(attrs.onRemove);$select.ngModel=ngModel;$select.choiceGrouped=function(group){return $select.isGrouped&&group&&group.name;};if(attrs.tabindex){attrs.$observe('tabindex',function(value){$select.focusInput.attr('tabindex',value);element.removeAttr('tabindex');});}
scope.$watch(function(){return scope.$eval(attrs.searchEnabled);},function(newVal){$select.searchEnabled=newVal!==undefined?newVal:uiSelectConfig.searchEnabled;});scope.$watch('sortable',function(){var sortable=scope.$eval(attrs.sortable);$select.sortable=sortable!==undefined?sortable:uiSelectConfig.sortable;});attrs.$observe('backspaceReset',function(){var backspaceReset=scope.$eval(attrs.backspaceReset);$select.backspaceReset=backspaceReset!==undefined?backspaceReset:true;});attrs.$observe('limit',function(){$select.limit=(angular.isDefined(attrs.limit))?parseInt(attrs.limit,10):undefined;});scope.$watch('removeSelected',function(){var removeSelected=scope.$eval(attrs.removeSelected);$select.removeSelected=removeSelected!==undefined?removeSelected:uiSelectConfig.removeSelected;});attrs.$observe('disabled',function(){$select.disabled=attrs.disabled!==undefined?attrs.disabled:false;});attrs.$observe('resetSearchInput',function(){var resetSearchInput=scope.$eval(attrs.resetSearchInput);$select.resetSearchInput=resetSearchInput!==undefined?resetSearchInput:true;});attrs.$observe('paste',function(){$select.paste=scope.$eval(attrs.paste);});attrs.$observe('tagging',function(){if(attrs.tagging!==undefined)
{var taggingEval=scope.$eval(attrs.tagging);$select.tagging={isActivated:true,fct:taggingEval!==true?taggingEval:undefined};}
else
{$select.tagging={isActivated:false,fct:undefined};}});attrs.$observe('taggingLabel',function(){if(attrs.tagging!==undefined)
{if(attrs.taggingLabel==='false'){$select.taggingLabel=false;}
else
{$select.taggingLabel=attrs.taggingLabel!==undefined?attrs.taggingLabel:'(new)';}}});attrs.$observe('taggingTokens',function(){if(attrs.tagging!==undefined){var tokens=attrs.taggingTokens!==undefined?attrs.taggingTokens.split('|'):[',','ENTER'];$select.taggingTokens={isActivated:true,tokens:tokens};}});attrs.$observe('spinnerEnabled',function(){var spinnerEnabled=scope.$eval(attrs.spinnerEnabled);$select.spinnerEnabled=spinnerEnabled!==undefined?spinnerEnabled:uiSelectConfig.spinnerEnabled;});attrs.$observe('spinnerClass',function(){var spinnerClass=attrs.spinnerClass;$select.spinnerClass=spinnerClass!==undefined?attrs.spinnerClass:uiSelectConfig.spinnerClass;});if(angular.isDefined(attrs.autofocus)){$timeout(function(){$select.setFocus();});}
if(angular.isDefined(attrs.focusOn)){scope.$on(attrs.focusOn,function(){$timeout(function(){$select.setFocus();});});}
function onDocumentClick(e){if(!$select.open)return;var contains=false;if(window.jQuery){contains=window.jQuery.contains(element[0],e.target);}else{contains=element[0].contains(e.target);}
if(!contains&&!$select.clickTriggeredSelect){var skipFocusser;if(!$select.skipFocusser){var focusableControls=['input','button','textarea','select'];var targetController=angular.element(e.target).controller('uiSelect');skipFocusser=targetController&&targetController!==$select;if(!skipFocusser)skipFocusser=~focusableControls.indexOf(e.target.tagName.toLowerCase());}else{skipFocusser=true;}
$select.close(skipFocusser);scope.$digest();}
$select.clickTriggeredSelect=false;}
$document.on('click',onDocumentClick);scope.$on('$destroy',function(){$document.off('click',onDocumentClick);});transcludeFn(scope,function(clone){var transcluded=angular.element('<div>').append(clone);var transcludedMatch=transcluded.querySelectorAll('.ui-select-match');transcludedMatch.removeAttr('ui-select-match');transcludedMatch.removeAttr('data-ui-select-match');if(transcludedMatch.length!==1){throw uiSelectMinErr('transcluded',"Expected 1 .ui-select-match but got '{0}'.",transcludedMatch.length);}
element.querySelectorAll('.ui-select-match').replaceWith(transcludedMatch);var transcludedChoices=transcluded.querySelectorAll('.ui-select-choices');transcludedChoices.removeAttr('ui-select-choices');transcludedChoices.removeAttr('data-ui-select-choices');if(transcludedChoices.length!==1){throw uiSelectMinErr('transcluded',"Expected 1 .ui-select-choices but got '{0}'.",transcludedChoices.length);}
element.querySelectorAll('.ui-select-choices').replaceWith(transcludedChoices);var transcludedNoChoice=transcluded.querySelectorAll('.ui-select-no-choice');transcludedNoChoice.removeAttr('ui-select-no-choice');transcludedNoChoice.removeAttr('data-ui-select-no-choice');if(transcludedNoChoice.length==1){element.querySelectorAll('.ui-select-no-choice').replaceWith(transcludedNoChoice);}});var appendToBody=scope.$eval(attrs.appendToBody);if(appendToBody!==undefined?appendToBody:uiSelectConfig.appendToBody){scope.$watch('$select.open',function(isOpen){if(isOpen){positionDropdown();}else{resetDropdown();}});scope.$on('$destroy',function(){resetDropdown();});}
var placeholder=null,originalWidth='';function positionDropdown(){var offset=uisOffset(element);placeholder=angular.element('<div class="ui-select-placeholder"></div>');placeholder[0].style.width=offset.width+'px';placeholder[0].style.height=offset.height+'px';element.after(placeholder);originalWidth=element[0].style.width;$document.find('body').append(element);element[0].style.position='absolute';element[0].style.left=offset.left+'px';element[0].style.top=offset.top+'px';element[0].style.width=offset.width+'px';}
function resetDropdown(){if(placeholder===null){return;}
placeholder.replaceWith(element);placeholder=null;element[0].style.position='';element[0].style.left='';element[0].style.top='';element[0].style.width=originalWidth;$select.setFocus();}
var dropdown=null,directionUpClassName='direction-up';scope.$watch('$select.open',function(){if($select.dropdownPosition==='auto'||$select.dropdownPosition==='up'){scope.calculateDropdownPos();}});var setDropdownPosUp=function(offset,offsetDropdown){offset=offset||uisOffset(element);offsetDropdown=offsetDropdown||uisOffset(dropdown);dropdown[0].style.position='absolute';dropdown[0].style.top=(offsetDropdown.height*-1)+'px';element.addClass(directionUpClassName);};var setDropdownPosDown=function(offset,offsetDropdown){element.removeClass(directionUpClassName);offset=offset||uisOffset(element);offsetDropdown=offsetDropdown||uisOffset(dropdown);dropdown[0].style.position='';dropdown[0].style.top='';};var calculateDropdownPosAfterAnimation=function(){$timeout(function(){if($select.dropdownPosition==='up'){setDropdownPosUp();}else{element.removeClass(directionUpClassName);var offset=uisOffset(element);var offsetDropdown=uisOffset(dropdown);var scrollTop=$document[0].documentElement.scrollTop||$document[0].body.scrollTop;if(offset.top+offset.height+offsetDropdown.height>scrollTop+$document[0].documentElement.clientHeight){setDropdownPosUp(offset,offsetDropdown);}else{setDropdownPosDown(offset,offsetDropdown);}}
dropdown[0].style.opacity=1;});};var opened=false;scope.calculateDropdownPos=function(){if($select.open){dropdown=angular.element(element).querySelectorAll('.ui-select-dropdown');if(dropdown.length===0){return;}
if($select.search===''&&!opened){dropdown[0].style.opacity=0;opened=true;}
if(!uisOffset(dropdown).height&&$select.$animate&&$select.$animate.on&&$select.$animate.enabled(dropdown)){var needsCalculated=true;$select.$animate.on('enter',dropdown,function(elem,phase){if(phase==='close'&&needsCalculated){calculateDropdownPosAfterAnimation();needsCalculated=false;}});}else{calculateDropdownPosAfterAnimation();}}else{if(dropdown===null||dropdown.length===0){return;}
dropdown[0].style.opacity=0;dropdown[0].style.position='';dropdown[0].style.top='';element.removeClass(directionUpClassName);}};};}};}]);uis.directive('uiSelectMatch',['uiSelectConfig',function(uiSelectConfig){return{restrict:'EA',require:'^uiSelect',replace:true,transclude:true,templateUrl:function(tElement){tElement.addClass('ui-select-match');var parent=tElement.parent();var theme=getAttribute(parent,'theme')||uiSelectConfig.theme;var multi=angular.isDefined(getAttribute(parent,'multiple'));return theme+(multi?'/match-multiple.tpl.html':'/match.tpl.html');},link:function(scope,element,attrs,$select){$select.lockChoiceExpression=attrs.uiLockChoice;attrs.$observe('placeholder',function(placeholder){$select.placeholder=placeholder!==undefined?placeholder:uiSelectConfig.placeholder;});function setAllowClear(allow){$select.allowClear=(angular.isDefined(allow))?(allow==='')?true:(allow.toLowerCase()==='true'):false;}
attrs.$observe('allowClear',setAllowClear);setAllowClear(attrs.allowClear);if($select.multiple){$select.sizeSearchInput();}}};function getAttribute(elem,attribute){if(elem[0].hasAttribute(attribute))
return elem.attr(attribute);if(elem[0].hasAttribute('data-'+attribute))
return elem.attr('data-'+attribute);if(elem[0].hasAttribute('x-'+attribute))
return elem.attr('x-'+attribute);}}]);uis.directive('uiSelectMultiple',['uiSelectMinErr','$timeout',function(uiSelectMinErr,$timeout){return{restrict:'EA',require:['^uiSelect','^ngModel'],controller:['$scope','$timeout',function($scope,$timeout){var ctrl=this,$select=$scope.$select,ngModel;if(angular.isUndefined($select.selected))
$select.selected=[];$scope.$evalAsync(function(){ngModel=$scope.ngModel;});ctrl.activeMatchIndex=-1;ctrl.updateModel=function(){ngModel.$setViewValue(Date.now());ctrl.refreshComponent();};ctrl.refreshComponent=function(){if($select.refreshItems){$select.refreshItems();}
if($select.sizeSearchInput){$select.sizeSearchInput();}};ctrl.removeChoice=function(index){if($select.isLocked(null,index))return false;var removedChoice=$select.selected[index];var locals={};locals[$select.parserResult.itemName]=removedChoice;$select.selected.splice(index,1);ctrl.activeMatchIndex=-1;$select.sizeSearchInput();$timeout(function(){$select.onRemoveCallback($scope,{$item:removedChoice,$model:$select.parserResult.modelMapper($scope,locals)});});ctrl.updateModel();return true;};ctrl.getPlaceholder=function(){if($select.selected&&$select.selected.length)return;return $select.placeholder;};}],controllerAs:'$selectMultiple',link:function(scope,element,attrs,ctrls){var $select=ctrls[0];var ngModel=scope.ngModel=ctrls[1];var $selectMultiple=scope.$selectMultiple;$select.multiple=true;$select.focusInput=$select.searchInput;ngModel.$isEmpty=function(value){return!value||value.length===0;};ngModel.$parsers.unshift(function(){var locals={},result,resultMultiple=[];for(var j=$select.selected.length-1;j>=0;j--){locals={};locals[$select.parserResult.itemName]=$select.selected[j];result=$select.parserResult.modelMapper(scope,locals);resultMultiple.unshift(result);}
return resultMultiple;});ngModel.$formatters.unshift(function(inputValue){var data=$select.parserResult&&$select.parserResult.source(scope,{$select:{search:''}}),locals={},result;if(!data)return inputValue;var resultMultiple=[];var checkFnMultiple=function(list,value){if(!list||!list.length)return;for(var p=list.length-1;p>=0;p--){locals[$select.parserResult.itemName]=list[p];result=$select.parserResult.modelMapper(scope,locals);if($select.parserResult.trackByExp){var propsItemNameMatches=/(\w*)\./.exec($select.parserResult.trackByExp);var matches=/\.([^\s]+)/.exec($select.parserResult.trackByExp);if(propsItemNameMatches&&propsItemNameMatches.length>0&&propsItemNameMatches[1]==$select.parserResult.itemName){if(matches&&matches.length>0&&result[matches[1]]==value[matches[1]]){resultMultiple.unshift(list[p]);return true;}}}
if(angular.equals(result,value)){resultMultiple.unshift(list[p]);return true;}}
return false;};if(!inputValue)return resultMultiple;for(var k=inputValue.length-1;k>=0;k--){if(!checkFnMultiple($select.selected,inputValue[k])){if(!checkFnMultiple(data,inputValue[k])){resultMultiple.unshift(inputValue[k]);}}}
return resultMultiple;});scope.$watchCollection(function(){return ngModel.$modelValue;},function(newValue,oldValue){if(oldValue!=newValue){if(angular.isDefined(ngModel.$modelValue)){ngModel.$modelValue=null;}
$selectMultiple.refreshComponent();}});ngModel.$render=function(){if(!angular.isArray(ngModel.$viewValue)){if(isNil(ngModel.$viewValue)){ngModel.$viewValue=[];}else{throw uiSelectMinErr('multiarr',"Expected model value to be array but got '{0}'",ngModel.$viewValue);}}
$select.selected=ngModel.$viewValue;$selectMultiple.refreshComponent();scope.$evalAsync();};scope.$on('uis:select',function(event,item){if($select.selected.length>=$select.limit){return;}
$select.selected.push(item);var locals={};locals[$select.parserResult.itemName]=item;$timeout(function(){$select.onSelectCallback(scope,{$item:item,$model:$select.parserResult.modelMapper(scope,locals)});});$selectMultiple.updateModel();});scope.$on('uis:activate',function(){$selectMultiple.activeMatchIndex=-1;});scope.$watch('$select.disabled',function(newValue,oldValue){if(oldValue&&!newValue)$select.sizeSearchInput();});$select.searchInput.on('keydown',function(e){var key=e.which;scope.$apply(function(){var processed=false;if(KEY.isHorizontalMovement(key)){processed=_handleMatchSelection(key);}
if(processed&&key!=KEY.TAB){e.preventDefault();e.stopPropagation();}});});function _getCaretPosition(el){if(angular.isNumber(el.selectionStart))return el.selectionStart;else return el.value.length;}
function _handleMatchSelection(key){var caretPosition=_getCaretPosition($select.searchInput[0]),length=$select.selected.length,first=0,last=length-1,curr=$selectMultiple.activeMatchIndex,next=$selectMultiple.activeMatchIndex+1,prev=$selectMultiple.activeMatchIndex-1,newIndex=curr;if(caretPosition>0||($select.search.length&&key==KEY.RIGHT))return false;$select.close();function getNewActiveMatchIndex(){switch(key){case KEY.LEFT:if(~$selectMultiple.activeMatchIndex)return prev;else return last;break;case KEY.RIGHT:if(!~$selectMultiple.activeMatchIndex||curr===last){$select.activate();return false;}
else return next;break;case KEY.BACKSPACE:if(~$selectMultiple.activeMatchIndex){if($selectMultiple.removeChoice(curr)){return prev;}else{return curr;}}else{return last;}
break;case KEY.DELETE:if(~$selectMultiple.activeMatchIndex){$selectMultiple.removeChoice($selectMultiple.activeMatchIndex);return curr;}
else return false;}}
newIndex=getNewActiveMatchIndex();if(!$select.selected.length||newIndex===false)$selectMultiple.activeMatchIndex=-1;else $selectMultiple.activeMatchIndex=Math.min(last,Math.max(first,newIndex));return true;}
$select.searchInput.on('keyup',function(e){if(!KEY.isVerticalMovement(e.which)){scope.$evalAsync(function(){$select.activeIndex=$select.taggingLabel===false?-1:0;});}
if($select.tagging.isActivated&&$select.search.length>0){if(e.which===KEY.TAB||KEY.isControl(e)||KEY.isFunctionKey(e)||e.which===KEY.ESC||KEY.isVerticalMovement(e.which)){return;}
$select.activeIndex=$select.taggingLabel===false?-1:0;if($select.taggingLabel===false)return;var items=angular.copy($select.items);var stashArr=angular.copy($select.items);var newItem;var item;var hasTag=false;var dupeIndex=-1;var tagItems;var tagItem;if($select.tagging.fct!==undefined){tagItems=$select.$filter('filter')(items,{'isTag':true});if(tagItems.length>0){tagItem=tagItems[0];}
if(items.length>0&&tagItem){hasTag=true;items=items.slice(1,items.length);stashArr=stashArr.slice(1,stashArr.length);}
newItem=$select.tagging.fct($select.search);if(stashArr.some(function(origItem){return angular.equals(origItem,newItem);})||$select.selected.some(function(origItem){return angular.equals(origItem,newItem);})){scope.$evalAsync(function(){$select.activeIndex=0;$select.items=items;});return;}
if(newItem)newItem.isTag=true;}else{tagItems=$select.$filter('filter')(items,function(item){return item.match($select.taggingLabel);});if(tagItems.length>0){tagItem=tagItems[0];}
item=items[0];if(item!==undefined&&items.length>0&&tagItem){hasTag=true;items=items.slice(1,items.length);stashArr=stashArr.slice(1,stashArr.length);}
newItem=$select.search+' '+$select.taggingLabel;if(_findApproxDupe($select.selected,$select.search)>-1){return;}
if(_findCaseInsensitiveDupe(stashArr.concat($select.selected))){if(hasTag){items=stashArr;scope.$evalAsync(function(){$select.activeIndex=0;$select.items=items;});}
return;}
if(_findCaseInsensitiveDupe(stashArr)){if(hasTag){$select.items=stashArr.slice(1,stashArr.length);}
return;}}
if(hasTag)dupeIndex=_findApproxDupe($select.selected,newItem);if(dupeIndex>-1){items=items.slice(dupeIndex+1,items.length-1);}else{items=[];if(newItem)items.push(newItem);items=items.concat(stashArr);}
scope.$evalAsync(function(){$select.activeIndex=0;$select.items=items;if($select.isGrouped){var itemsWithoutTag=newItem?items.slice(1):items;$select.setItemsFn(itemsWithoutTag);if(newItem){$select.items.unshift(newItem);$select.groups.unshift({name:'',items:[newItem],tagging:true});}}});}});function _findCaseInsensitiveDupe(arr){if(arr===undefined||$select.search===undefined){return false;}
var hasDupe=arr.filter(function(origItem){if($select.search.toUpperCase()===undefined||origItem===undefined){return false;}
return origItem.toUpperCase()===$select.search.toUpperCase();}).length>0;return hasDupe;}
function _findApproxDupe(haystack,needle){var dupeIndex=-1;if(angular.isArray(haystack)){var tempArr=angular.copy(haystack);for(var i=0;i<tempArr.length;i++){if($select.tagging.fct===undefined){if(tempArr[i]+' '+$select.taggingLabel===needle){dupeIndex=i;}}else{var mockObj=tempArr[i];if(angular.isObject(mockObj)){mockObj.isTag=true;}
if(angular.equals(mockObj,needle)){dupeIndex=i;}}}}
return dupeIndex;}
$select.searchInput.on('blur',function(){$timeout(function(){$selectMultiple.activeMatchIndex=-1;});});}};}]);uis.directive('uiSelectNoChoice',['uiSelectConfig',function(uiSelectConfig){return{restrict:'EA',require:'^uiSelect',replace:true,transclude:true,templateUrl:function(tElement){tElement.addClass('ui-select-no-choice');var theme=tElement.parent().attr('theme')||uiSelectConfig.theme;return theme+'/no-choice.tpl.html';}};}]);uis.directive('uiSelectSingle',['$timeout','$compile',function($timeout,$compile){return{restrict:'EA',require:['^uiSelect','^ngModel'],link:function(scope,element,attrs,ctrls){var $select=ctrls[0];var ngModel=ctrls[1];ngModel.$parsers.unshift(function(inputValue){if(isNil(inputValue)){return inputValue;}
var locals={},result;locals[$select.parserResult.itemName]=inputValue;result=$select.parserResult.modelMapper(scope,locals);return result;});ngModel.$formatters.unshift(function(inputValue){if(isNil(inputValue)){return inputValue;}
var data=$select.parserResult&&$select.parserResult.source(scope,{$select:{search:''}}),locals={},result;if(data){var checkFnSingle=function(d){locals[$select.parserResult.itemName]=d;result=$select.parserResult.modelMapper(scope,locals);return result===inputValue;};if($select.selected&&checkFnSingle($select.selected)){return $select.selected;}
for(var i=data.length-1;i>=0;i--){if(checkFnSingle(data[i]))return data[i];}}
return inputValue;});scope.$watch('$select.selected',function(newValue){if(ngModel.$viewValue!==newValue){ngModel.$setViewValue(newValue);}});ngModel.$render=function(){$select.selected=ngModel.$viewValue;};scope.$on('uis:select',function(event,item){$select.selected=item;var locals={};locals[$select.parserResult.itemName]=item;$timeout(function(){$select.onSelectCallback(scope,{$item:item,$model:isNil(item)?item:$select.parserResult.modelMapper(scope,locals)});});});scope.$on('uis:close',function(event,skipFocusser){$timeout(function(){$select.focusser.prop('disabled',false);if(!skipFocusser)$select.focusser[0].focus();},0,false);});scope.$on('uis:activate',function(){focusser.prop('disabled',true);});var focusser=angular.element("<input ng-disabled='$select.disabled' class='ui-select-focusser ui-select-offscreen' type='text' id='{{ $select.focusserId }}' aria-label='{{ $select.focusserTitle }}' aria-haspopup='true' role='button' />");$compile(focusser)(scope);$select.focusser=focusser;$select.focusInput=focusser;element.parent().append(focusser);focusser.bind("focus",function(){scope.$evalAsync(function(){$select.focus=true;});});focusser.bind("blur",function(){scope.$evalAsync(function(){$select.focus=false;});});focusser.bind("keydown",function(e){if(e.which===KEY.BACKSPACE&&$select.backspaceReset!==false){e.preventDefault();e.stopPropagation();$select.select(undefined);scope.$apply();return;}
if(e.which===KEY.TAB||KEY.isControl(e)||KEY.isFunctionKey(e)||e.which===KEY.ESC){return;}
if(e.which==KEY.DOWN||e.which==KEY.UP||e.which==KEY.ENTER||e.which==KEY.SPACE){e.preventDefault();e.stopPropagation();$select.activate();}
scope.$digest();});focusser.bind("keyup input",function(e){if(e.which===KEY.TAB||KEY.isControl(e)||KEY.isFunctionKey(e)||e.which===KEY.ESC||e.which==KEY.ENTER||e.which===KEY.BACKSPACE){return;}
$select.activate(focusser.val());focusser.val('');scope.$digest();});}};}]);uis.directive('uiSelectSort',['$timeout','uiSelectConfig','uiSelectMinErr',function($timeout,uiSelectConfig,uiSelectMinErr){return{require:['^^uiSelect','^ngModel'],link:function(scope,element,attrs,ctrls){if(scope[attrs.uiSelectSort]===null){throw uiSelectMinErr('sort','Expected a list to sort');}
var $select=ctrls[0];var $ngModel=ctrls[1];var options=angular.extend({axis:'horizontal'},scope.$eval(attrs.uiSelectSortOptions));var axis=options.axis;var draggingClassName='dragging';var droppingClassName='dropping';var droppingBeforeClassName='dropping-before';var droppingAfterClassName='dropping-after';scope.$watch(function(){return $select.sortable;},function(newValue){if(newValue){element.attr('draggable',true);}else{element.removeAttr('draggable');}});element.on('dragstart',function(event){element.addClass(draggingClassName);(event.dataTransfer||event.originalEvent.dataTransfer).setData('text',scope.$index.toString());});element.on('dragend',function(){removeClass(draggingClassName);});var move=function(from,to){this.splice(to,0,this.splice(from,1)[0]);};var removeClass=function(className){angular.forEach($select.$element.querySelectorAll('.'+className),function(el){angular.element(el).removeClass(className);});};var dragOverHandler=function(event){event.preventDefault();var offset=axis==='vertical'?event.offsetY||event.layerY||(event.originalEvent?event.originalEvent.offsetY:0):event.offsetX||event.layerX||(event.originalEvent?event.originalEvent.offsetX:0);if(offset<(this[axis==='vertical'?'offsetHeight':'offsetWidth']/2)){removeClass(droppingAfterClassName);element.addClass(droppingBeforeClassName);}else{removeClass(droppingBeforeClassName);element.addClass(droppingAfterClassName);}};var dropTimeout;var dropHandler=function(event){event.preventDefault();var droppedItemIndex=parseInt((event.dataTransfer||event.originalEvent.dataTransfer).getData('text'),10);$timeout.cancel(dropTimeout);dropTimeout=$timeout(function(){_dropHandler(droppedItemIndex);},20);};var _dropHandler=function(droppedItemIndex){var theList=scope.$eval(attrs.uiSelectSort);var itemToMove=theList[droppedItemIndex];var newIndex=null;if(element.hasClass(droppingBeforeClassName)){if(droppedItemIndex<scope.$index){newIndex=scope.$index-1;}else{newIndex=scope.$index;}}else{if(droppedItemIndex<scope.$index){newIndex=scope.$index;}else{newIndex=scope.$index+1;}}
move.apply(theList,[droppedItemIndex,newIndex]);$ngModel.$setViewValue(Date.now());scope.$apply(function(){scope.$emit('uiSelectSort:change',{array:theList,item:itemToMove,from:droppedItemIndex,to:newIndex});});removeClass(droppingClassName);removeClass(droppingBeforeClassName);removeClass(droppingAfterClassName);element.off('drop',dropHandler);};element.on('dragenter',function(){if(element.hasClass(draggingClassName)){return;}
element.addClass(droppingClassName);element.on('dragover',dragOverHandler);element.on('drop',dropHandler);});element.on('dragleave',function(event){if(event.target!=element){return;}
removeClass(droppingClassName);removeClass(droppingBeforeClassName);removeClass(droppingAfterClassName);element.off('dragover',dragOverHandler);element.off('drop',dropHandler);});}};}]);uis.directive('uisOpenClose',['$parse','$timeout',function($parse,$timeout){return{restrict:'A',require:'uiSelect',link:function(scope,element,attrs,$select){$select.onOpenCloseCallback=$parse(attrs.uisOpenClose);scope.$watch('$select.open',function(isOpen,previousState){if(isOpen!==previousState){$timeout(function(){$select.onOpenCloseCallback(scope,{isOpen:isOpen});});}});}};}]);uis.service('uisRepeatParser',['uiSelectMinErr','$parse',function(uiSelectMinErr,$parse){var self=this;self.parse=function(expression){var match;match=expression.match(/^\s*(?:([\s\S]+?)\s+as\s+)?(?:([\$\w][\$\w]*)|(?:\(\s*([\$\w][\$\w]*)\s*,\s*([\$\w][\$\w]*)\s*\)))\s+in\s+(\s*[\s\S]+?)?(?:\s+track\s+by\s+([\s\S]+?))?\s*$/);if(!match){throw uiSelectMinErr('iexp',"Expected expression in form of '_item_ in _collection_[ track by _id_]' but got '{0}'.",expression);}
var source=match[5],filters='';if(match[3]){source=match[5].replace(/(^\()|(\)$)/g,'');var filterMatch=match[5].match(/^\s*(?:[\s\S]+?)(?:[^\|]|\|\|)+([\s\S]*)\s*$/);if(filterMatch&&filterMatch[1].trim()){filters=filterMatch[1];source=source.replace(filters,'');}}
return{itemName:match[4]||match[2],keyName:match[3],source:$parse(source),filters:filters,trackByExp:match[6],modelMapper:$parse(match[1]||match[4]||match[2]),repeatExpression:function(grouped){var expression=this.itemName+' in '+(grouped?'$group.items':'$select.items');if(this.trackByExp){expression+=' track by '+this.trackByExp;}
return expression;}};};self.getGroupNgRepeatExpression=function(){return'$group in $select.groups track by $group.name';};}]);}());angular.module("ui.select").run(["$templateCache",function($templateCache){$templateCache.put("bootstrap/choices.tpl.html","<ul class=\"ui-select-choices ui-select-choices-content ui-select-dropdown dropdown-menu\" ng-show=\"$select.open && $select.items.length > 0\"><li class=\"ui-select-choices-group\" id=\"ui-select-choices-{{ $select.generatedId }}\"><div class=\"divider\" ng-show=\"$select.isGrouped && $index > 0\"></div><div ng-show=\"$select.isGrouped\" class=\"ui-select-choices-group-label dropdown-header\" ng-bind=\"$group.name\"></div><div ng-attr-id=\"ui-select-choices-row-{{ $select.generatedId }}-{{$index}}\" class=\"ui-select-choices-row\" ng-class=\"{active: $select.isActive(this), disabled: $select.isDisabled(this)}\" role=\"option\"><span class=\"ui-select-choices-row-inner\"></span></div></li></ul>");$templateCache.put("bootstrap/match-multiple.tpl.html","<span class=\"ui-select-match\"><span ng-repeat=\"$item in $select.selected track by $index\"><span class=\"ui-select-match-item btn btn-default btn-xs\" tabindex=\"-1\" type=\"button\" ng-disabled=\"$select.disabled\" ng-click=\"$selectMultiple.activeMatchIndex = $index;\" ng-class=\"{\'btn-primary\':$selectMultiple.activeMatchIndex === $index, \'select-locked\':$select.isLocked(this, $index)}\" ui-select-sort=\"$select.selected\"><span class=\"close ui-select-match-close\" ng-hide=\"$select.disabled\" ng-click=\"$selectMultiple.removeChoice($index)\">&nbsp;&times;</span> <span uis-transclude-append=\"\"></span></span></span></span>");$templateCache.put("bootstrap/match.tpl.html","<div class=\"ui-select-match\" ng-hide=\"$select.open && $select.searchEnabled\" ng-disabled=\"$select.disabled\" ng-class=\"{\'btn-default-focus\':$select.focus}\"><span tabindex=\"-1\" class=\"btn btn-default form-control ui-select-toggle\" aria-label=\"{{ $select.baseTitle }} activate\" ng-disabled=\"$select.disabled\" ng-click=\"$select.activate()\" style=\"outline: 0;\"><span ng-show=\"$select.isEmpty()\" class=\"ui-select-placeholder text-muted\">{{$select.placeholder}}</span> <span ng-hide=\"$select.isEmpty()\" class=\"ui-select-match-text pull-left\" ng-class=\"{\'ui-select-allow-clear\': $select.allowClear && !$select.isEmpty()}\" ng-transclude=\"\"></span> <i class=\"caret pull-right\" ng-click=\"$select.toggle($event)\"></i> <a ng-show=\"$select.allowClear && !$select.isEmpty() && ($select.disabled !== true)\" aria-label=\"{{ $select.baseTitle }} clear\" style=\"margin-right: 10px\" ng-click=\"$select.clear($event)\" class=\"btn btn-xs btn-link pull-right\"><i class=\"glyphicon glyphicon-remove\" aria-hidden=\"true\"></i></a></span></div>");$templateCache.put("bootstrap/no-choice.tpl.html","<ul class=\"ui-select-no-choice dropdown-menu\" ng-show=\"$select.items.length == 0\"><li ng-transclude=\"\"></li></ul>");$templateCache.put("bootstrap/select-multiple.tpl.html","<div class=\"ui-select-container ui-select-multiple ui-select-bootstrap dropdown form-control\" ng-class=\"{open: $select.open}\"><div><div class=\"ui-select-match\"></div><input type=\"search\" autocomplete=\"off\" autocorrect=\"off\" autocapitalize=\"off\" spellcheck=\"false\" class=\"ui-select-search input-xs\" placeholder=\"{{$selectMultiple.getPlaceholder()}}\" ng-disabled=\"$select.disabled\" ng-click=\"$select.activate()\" ng-model=\"$select.search\" role=\"combobox\" aria-expanded=\"{{$select.open}}\" aria-label=\"{{$select.baseTitle}}\" ng-class=\"{\'spinner\': $select.refreshing}\" ondrop=\"return false;\"></div><div class=\"ui-select-choices\"></div><div class=\"ui-select-no-choice\"></div></div>");$templateCache.put("bootstrap/select.tpl.html","<div class=\"ui-select-container ui-select-bootstrap dropdown\" ng-class=\"{open: $select.open}\"><div class=\"ui-select-match\"></div><span ng-show=\"$select.open && $select.refreshing && $select.spinnerEnabled\" class=\"ui-select-refreshing {{$select.spinnerClass}}\"></span> <input type=\"search\" autocomplete=\"off\" tabindex=\"-1\" aria-expanded=\"true\" aria-label=\"{{ $select.baseTitle }}\" aria-owns=\"ui-select-choices-{{ $select.generatedId }}\" class=\"form-control ui-select-search\" ng-class=\"{ \'ui-select-search-hidden\' : !$select.searchEnabled }\" placeholder=\"{{$select.placeholder}}\" ng-model=\"$select.search\" ng-show=\"$select.open\"><div class=\"ui-select-choices\"></div><div class=\"ui-select-no-choice\"></div></div>");$templateCache.put("select2/choices.tpl.html","<ul tabindex=\"-1\" class=\"ui-select-choices ui-select-choices-content select2-results\"><li class=\"ui-select-choices-group\" ng-class=\"{\'select2-result-with-children\': $select.choiceGrouped($group) }\"><div ng-show=\"$select.choiceGrouped($group)\" class=\"ui-select-choices-group-label select2-result-label\" ng-bind=\"$group.name\"></div><ul id=\"ui-select-choices-{{ $select.generatedId }}\" ng-class=\"{\'select2-result-sub\': $select.choiceGrouped($group), \'select2-result-single\': !$select.choiceGrouped($group) }\"><li role=\"option\" ng-attr-id=\"ui-select-choices-row-{{ $select.generatedId }}-{{$index}}\" class=\"ui-select-choices-row\" ng-class=\"{\'select2-highlighted\': $select.isActive(this), \'select2-disabled\': $select.isDisabled(this)}\"><div class=\"select2-result-label ui-select-choices-row-inner\"></div></li></ul></li></ul>");$templateCache.put("select2/match-multiple.tpl.html","<span class=\"ui-select-match\"><li class=\"ui-select-match-item select2-search-choice\" ng-repeat=\"$item in $select.selected track by $index\" ng-class=\"{\'select2-search-choice-focus\':$selectMultiple.activeMatchIndex === $index, \'select2-locked\':$select.isLocked(this, $index)}\" ui-select-sort=\"$select.selected\"><span uis-transclude-append=\"\"></span> <a href=\"javascript:;\" class=\"ui-select-match-close select2-search-choice-close\" ng-click=\"$selectMultiple.removeChoice($index)\" tabindex=\"-1\"></a></li></span>");$templateCache.put("select2/match.tpl.html","<a class=\"select2-choice ui-select-match\" ng-class=\"{\'select2-default\': $select.isEmpty()}\" ng-click=\"$select.toggle($event)\" aria-label=\"{{ $select.baseTitle }} select\"><span ng-show=\"$select.isEmpty()\" class=\"select2-chosen\">{{$select.placeholder}}</span> <span ng-hide=\"$select.isEmpty()\" class=\"select2-chosen\" ng-transclude=\"\"></span> <abbr ng-if=\"$select.allowClear && !$select.isEmpty()\" class=\"select2-search-choice-close\" ng-click=\"$select.clear($event)\"></abbr> <span class=\"select2-arrow ui-select-toggle\"><b></b></span></a>");$templateCache.put("select2/no-choice.tpl.html","<div class=\"ui-select-no-choice dropdown\" ng-show=\"$select.items.length == 0\"><div class=\"dropdown-content\"><div data-selectable=\"\" ng-transclude=\"\"></div></div></div>");$templateCache.put("select2/select-multiple.tpl.html","<div class=\"ui-select-container ui-select-multiple select2 select2-container select2-container-multi\" ng-class=\"{\'select2-container-active select2-dropdown-open open\': $select.open, \'select2-container-disabled\': $select.disabled}\"><ul class=\"select2-choices\"><span class=\"ui-select-match\"></span><li class=\"select2-search-field\"><input type=\"search\" autocomplete=\"off\" autocorrect=\"off\" autocapitalize=\"off\" spellcheck=\"false\" role=\"combobox\" aria-expanded=\"true\" aria-owns=\"ui-select-choices-{{ $select.generatedId }}\" aria-label=\"{{ $select.baseTitle }}\" aria-activedescendant=\"ui-select-choices-row-{{ $select.generatedId }}-{{ $select.activeIndex }}\" class=\"select2-input ui-select-search\" placeholder=\"{{$selectMultiple.getPlaceholder()}}\" ng-disabled=\"$select.disabled\" ng-hide=\"$select.disabled\" ng-model=\"$select.search\" ng-click=\"$select.activate()\" style=\"width: 34px;\" ondrop=\"return false;\"></li></ul><div class=\"ui-select-dropdown select2-drop select2-with-searchbox select2-drop-active\" ng-class=\"{\'select2-display-none\': !$select.open || $select.items.length === 0}\"><div class=\"ui-select-choices\"></div></div></div>");$templateCache.put("select2/select.tpl.html","<div class=\"ui-select-container select2 select2-container\" ng-class=\"{\'select2-container-active select2-dropdown-open open\': $select.open, \'select2-container-disabled\': $select.disabled, \'select2-container-active\': $select.focus, \'select2-allowclear\': $select.allowClear && !$select.isEmpty()}\"><div class=\"ui-select-match\"></div><div class=\"ui-select-dropdown select2-drop select2-with-searchbox select2-drop-active\" ng-class=\"{\'select2-display-none\': !$select.open}\"><div class=\"search-container\" ng-class=\"{\'ui-select-search-hidden\':!$select.searchEnabled, \'select2-search\':$select.searchEnabled}\"><input type=\"search\" autocomplete=\"off\" autocorrect=\"off\" autocapitalize=\"off\" spellcheck=\"false\" ng-class=\"{\'select2-active\': $select.refreshing}\" role=\"combobox\" aria-expanded=\"true\" aria-owns=\"ui-select-choices-{{ $select.generatedId }}\" aria-label=\"{{ $select.baseTitle }}\" class=\"ui-select-search select2-input\" ng-model=\"$select.search\"></div><div class=\"ui-select-choices\"></div><div class=\"ui-select-no-choice\"></div></div></div>");$templateCache.put("selectize/choices.tpl.html","<div ng-show=\"$select.open\" class=\"ui-select-choices ui-select-dropdown selectize-dropdown\" ng-class=\"{\'single\': !$select.multiple, \'multi\': $select.multiple}\"><div class=\"ui-select-choices-content selectize-dropdown-content\"><div class=\"ui-select-choices-group optgroup\"><div ng-show=\"$select.isGrouped\" class=\"ui-select-choices-group-label optgroup-header\" ng-bind=\"$group.name\"></div><div role=\"option\" class=\"ui-select-choices-row\" ng-class=\"{active: $select.isActive(this), disabled: $select.isDisabled(this)}\"><div class=\"option ui-select-choices-row-inner\" data-selectable=\"\"></div></div></div></div></div>");$templateCache.put("selectize/match-multiple.tpl.html","<div class=\"ui-select-match\" data-value=\"\" ng-repeat=\"$item in $select.selected track by $index\" ng-click=\"$selectMultiple.activeMatchIndex = $index;\" ng-class=\"{\'active\':$selectMultiple.activeMatchIndex === $index}\" ui-select-sort=\"$select.selected\"><span class=\"ui-select-match-item\" ng-class=\"{\'select-locked\':$select.isLocked(this, $index)}\"><span uis-transclude-append=\"\"></span> <span class=\"remove ui-select-match-close\" ng-hide=\"$select.disabled\" ng-click=\"$selectMultiple.removeChoice($index)\">&times;</span></span></div>");$templateCache.put("selectize/match.tpl.html","<div ng-hide=\"$select.searchEnabled && ($select.open || $select.isEmpty())\" class=\"ui-select-match\"><span ng-show=\"!$select.searchEnabled && ($select.isEmpty() || $select.open)\" class=\"ui-select-placeholder text-muted\">{{$select.placeholder}}</span> <span ng-hide=\"$select.isEmpty() || $select.open\" ng-transclude=\"\"></span></div>");$templateCache.put("selectize/no-choice.tpl.html","<div class=\"ui-select-no-choice selectize-dropdown\" ng-show=\"$select.items.length == 0\"><div class=\"selectize-dropdown-content\"><div data-selectable=\"\" ng-transclude=\"\"></div></div></div>");$templateCache.put("selectize/select-multiple.tpl.html","<div class=\"ui-select-container selectize-control multi plugin-remove_button\" ng-class=\"{\'open\': $select.open}\"><div class=\"selectize-input\" ng-class=\"{\'focus\': $select.open, \'disabled\': $select.disabled, \'selectize-focus\' : $select.focus}\" ng-click=\"$select.open && !$select.searchEnabled ? $select.toggle($event) : $select.activate()\"><div class=\"ui-select-match\"></div><input type=\"search\" autocomplete=\"off\" tabindex=\"-1\" class=\"ui-select-search\" ng-class=\"{\'ui-select-search-hidden\':!$select.searchEnabled}\" placeholder=\"{{$selectMultiple.getPlaceholder()}}\" ng-model=\"$select.search\" ng-disabled=\"$select.disabled\" aria-expanded=\"{{$select.open}}\" aria-label=\"{{ $select.baseTitle }}\" ondrop=\"return false;\"></div><div class=\"ui-select-choices\"></div><div class=\"ui-select-no-choice\"></div></div>");$templateCache.put("selectize/select.tpl.html","<div class=\"ui-select-container selectize-control single\" ng-class=\"{\'open\': $select.open}\"><div class=\"selectize-input\" ng-class=\"{\'focus\': $select.open, \'disabled\': $select.disabled, \'selectize-focus\' : $select.focus}\" ng-click=\"$select.open && !$select.searchEnabled ? $select.toggle($event) : $select.activate()\"><div class=\"ui-select-match\"></div><input type=\"search\" autocomplete=\"off\" tabindex=\"-1\" class=\"ui-select-search ui-select-toggle\" ng-class=\"{\'ui-select-search-hidden\':!$select.searchEnabled}\" ng-click=\"$select.toggle($event)\" placeholder=\"{{$select.placeholder}}\" ng-model=\"$select.search\" ng-hide=\"!$select.isEmpty() && !$select.open\" ng-disabled=\"$select.disabled\" aria-label=\"{{ $select.baseTitle }}\"></div><div class=\"ui-select-choices\"></div><div class=\"ui-select-no-choice\"></div></div>");}]);;angular.module('ui-select2',[]).value('uiSelect2Config',{}).directive('uiSelect2',['uiSelect2Config','$timeout',function(uiSelect2Config,$timeout){var options={};if(uiSelect2Config){angular.extend(options,uiSelect2Config);}
return{require:'ngModel',priority:1,compile:function(tElm,tAttrs){var watch,repeatOption,repeatAttr,isSelect=tElm.is('select'),isMultiple=angular.isDefined(tAttrs.multiple);if(tElm.is('select')){repeatOption=tElm.find('optgroup[ng-repeat], optgroup[data-ng-repeat], option[ng-repeat], option[data-ng-repeat]');if(repeatOption.length){repeatAttr=repeatOption.attr('ng-repeat')||repeatOption.attr('data-ng-repeat');watch=jQuery.trim(repeatAttr.split('|')[0]).split(' ').pop();}}
return function(scope,elm,attrs,controller){var opts=angular.extend({},options,scope.$eval(attrs.uiSelect2));var convertToAngularModel=function(select2_data){var model;if(opts.simple_tags){model=[];angular.forEach(select2_data,function(value,index){model.push(value.id);});}else{model=select2_data;}
return model;};var convertToSelect2Model=function(angular_data){var model=[];if(!angular_data){return model;}
if(opts.simple_tags){model=[];angular.forEach(angular_data,function(value,index){model.push({'id':value,'text':value});});}else{model=angular_data;}
return model;};if(isSelect){delete opts.multiple;delete opts.initSelection;}else if(isMultiple){opts.multiple=true;}
if(controller){if(angular.isUndefined(opts.heavyLoad)||!opts.heavyLoad){scope.$watch(tAttrs.ngModel,function(current,old){if(!current){return;}
if(current===old){return;}
controller.$render();},true);}
controller.$render=function(){if(isSelect){elm.select2('val',controller.$viewValue);}else{if(opts.multiple){controller.$isEmpty=function(value){return!value||value.length===0;};var viewValue=controller.$viewValue;if(angular.isString(viewValue)){viewValue=viewValue.split(',');}
elm.select2('data',convertToSelect2Model(viewValue));if(opts.sortable){elm.select2("container").find("ul.select2-choices").sortable({containment:'parent',start:function(){elm.select2("onSortStart");},update:function(){elm.select2("onSortEnd");elm.trigger('change');}});}}else{if(angular.isObject(controller.$viewValue)){elm.select2('data',controller.$viewValue);}else if(!controller.$viewValue){elm.select2('data',null);}else{elm.select2('val',controller.$viewValue);}}}};if(watch){scope.$watch(watch,function(newVal,oldVal,scope){if(angular.equals(newVal,oldVal)){return;}
$timeout(function(){elm.select2('val',controller.$viewValue);controller.$render();if(newVal&&!oldVal&&controller.$setPristine){controller.$setPristine(true);}});});}
controller.$parsers.push(function(value){var div=elm.prev();div.toggleClass('ng-invalid',!controller.$valid).toggleClass('ng-valid',controller.$valid).toggleClass('ng-invalid-required',!controller.$valid).toggleClass('ng-valid-required',controller.$valid).toggleClass('ng-dirty',controller.$dirty).toggleClass('ng-pristine',controller.$pristine);return value;});if(!isSelect){elm.bind("change",function(e){e.stopImmediatePropagation();if(scope.$$phase||scope.$root.$$phase){return;}
scope.$evalAsync(function(){controller.$setViewValue(convertToAngularModel(elm.select2('data')));});});if(opts.initSelection){var initSelection=opts.initSelection;opts.initSelection=function(element,callback){initSelection(element,function(value){var isPristine=controller.$pristine;controller.$setViewValue(convertToAngularModel(value));callback(value);if(isPristine){controller.$setPristine();}
elm.prev().toggleClass('ng-pristine',controller.$pristine);});};}}}
elm.bind("$destroy",function(){elm.select2("destroy");});attrs.$observe('disabled',function(value){elm.select2('enable',!value);});attrs.$observe('readonly',function(value){elm.select2('readonly',!!value);});if(attrs.ngMultiple){scope.$watch(attrs.ngMultiple,function(newVal){attrs.$set('multiple',!!newVal);elm.select2(opts);});}
$timeout(function(){elm.select2(opts);elm.select2('data',controller.$modelValue);controller.$render();if(!opts.initSelection&&!isSelect){var isPristine=controller.$pristine;controller.$pristine=false;controller.$setViewValue(convertToAngularModel(elm.select2('data')));if(isPristine){controller.$setPristine();}
elm.prev().toggleClass('ng-pristine',controller.$pristine);}});};}};}]);;angular.module('ui.slider',[]).value('uiSliderConfig',{}).directive('uiSlider',['uiSliderConfig','$timeout',function(uiSliderConfig,$timeout){uiSliderConfig=uiSliderConfig||{};return{require:'ngModel',compile:function(){return function(scope,elm,attrs,ngModel){function parseNumber(n,decimals){return(decimals)?parseFloat(n):parseInt(n,10);}
var options=angular.extend(scope.$eval(attrs.uiSlider)||{},uiSliderConfig);var prevRangeValues={min:null,max:null};var properties=['min','max','step'];var useDecimals=(!angular.isUndefined(attrs.useDecimals))?true:false;var init=function(){if(angular.isArray(ngModel.$viewValue)&&options.range!==true){console.warn('Change your range option of ui-slider. When assigning ngModel an array of values then the range option should be set to true.');options.range=true;}
angular.forEach(properties,function(property){if(angular.isDefined(attrs[property])){options[property]=parseNumber(attrs[property],useDecimals);}});elm.slider(options);init=angular.noop;};angular.forEach(properties,function(property){attrs.$observe(property,function(newVal){if(!!newVal){init();options[property]=parseNumber(newVal,useDecimals);elm.slider('option',property,parseNumber(newVal,useDecimals));ngModel.$render();}});});attrs.$observe('disabled',function(newVal){init();elm.slider('option','disabled',!!newVal);});scope.$watch(attrs.uiSlider,function(newVal){init();if(newVal!==undefined){elm.slider('option',newVal);}},true);$timeout(init,0,true);elm.bind('slide',function(event,ui){ngModel.$setViewValue(ui.values||ui.value);scope.$apply();});ngModel.$render=function(){init();var method=options.range===true?'values':'value';if(!options.range&&isNaN(ngModel.$viewValue)&&!(ngModel.$viewValue instanceof Array)){ngModel.$viewValue=0;}
else if(options.range&&!angular.isDefined(ngModel.$viewValue)){ngModel.$viewValue=[0,0];}
if(options.range===true){if(angular.isDefined(options.min)&&options.min>ngModel.$viewValue[0]){ngModel.$viewValue[0]=options.min;}
if(angular.isDefined(options.max)&&options.max<ngModel.$viewValue[1]){ngModel.$viewValue[1]=options.max;}
if(ngModel.$viewValue[0]>ngModel.$viewValue[1]){if(prevRangeValues.min>=ngModel.$viewValue[1]){ngModel.$viewValue[0]=prevRangeValues.min;}
if(prevRangeValues.max<=ngModel.$viewValue[0]){ngModel.$viewValue[1]=prevRangeValues.max;}}
prevRangeValues.min=ngModel.$viewValue[0];prevRangeValues.max=ngModel.$viewValue[1];}
elm.slider(method,ngModel.$viewValue);};scope.$watch(attrs.ngModel,function(){if(options.range===true){ngModel.$render();}},true);function destroy(){elm.slider('destroy');}
elm.bind('$destroy',destroy);};}};}]);