!function(e){"use strict";"function"==typeof define&&define.amd?define(["jquery"],e):"object"==typeof exports&&"function"==typeof require?e(require("jquery")):e(jQuery)}(function(d){"use strict";var n={escapeRegExChars:function(e){return e.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&")},createNode:function(e){var t=document.createElement("div");return t.className=e,t.style.position="absolute",t.style.display="none",t}},o=27,s=9,i=13,a=38,l=39,r=40;function u(e,t){function n(){}var o=this,s={ajaxSettings:{},autoSelectFirst:!1,appendTo:document.body,serviceUrl:null,lookup:null,onSelect:null,width:"auto",minChars:1,maxHeight:300,deferRequestBy:0,params:{},formatResult:u.formatResult,delimiter:null,zIndex:9999,type:"GET",noCache:!1,onSearchStart:n,onSearchComplete:n,onSearchError:n,preserveInput:!1,containerClass:"autocomplete-suggestions",tabDisabled:!1,dataType:"text",currentRequest:null,triggerSelectOnValidInput:!0,preventBadQueries:!0,lookupFilter:function(e,t,n){return-1!==e.value.toLowerCase().indexOf(n)},paramName:"query",transformResult:function(e){return"string"==typeof e?JSON.parse(e):e},showNoSuggestionNotice:!1,noSuggestionNotice:"No results",orientation:"bottom",forceFixPosition:!1};o.element=e,o.el=d(e),o.suggestions=[],o.badQueries=[],o.selectedIndex=-1,o.currentValue=o.element.value,o.intervalId=0,o.cachedResponse={},o.onChangeInterval=null,o.onChange=null,o.isLocal=!1,o.suggestionsContainer=null,o.noSuggestionsContainer=null,o.options=d.extend({},s,t),o.classes={selected:"autocomplete-selected",suggestion:"autocomplete-suggestion"},o.hint=null,o.hintValue="",o.selection=null,o.initialize(),o.setOptions(t)}u.utils=n,(d.Autocomplete=u).formatResult=function(e,t){t="("+n.escapeRegExChars(t)+")";return e.value.replace(new RegExp(t,"gi"),"$1").replace(/&/g,"&").replace(//g,">").replace(/"/g,""").replace(/<(\/?strong)>/g,"<$1>")},u.prototype={killerFn:null,initialize:function(){var e,t=this,n="."+t.classes.suggestion,o=t.classes.selected,s=t.options;t.element.setAttribute("autocomplete","off"),t.killerFn=function(e){0===d(e.target).closest("."+t.options.containerClass).length&&(t.killSuggestions(),t.disableKillerFn())},t.noSuggestionsContainer=d('
').html(this.options.noSuggestionNotice).get(0),t.suggestionsContainer=u.utils.createNode(s.containerClass),(e=d(t.suggestionsContainer)).appendTo(s.appendTo),"auto"!==s.width&&e.width(s.width),e.on("mouseover.autocomplete",n,function(){t.activate(d(this).data("index"))}),e.on("mouseout.autocomplete",function(){t.selectedIndex=-1,e.children("."+o).removeClass(o)}),e.on("click.autocomplete",n,function(){t.select(d(this).data("index"))}),t.fixPositionCapture=function(){t.visible&&t.fixPosition()},d(window).on("resize.autocomplete",t.fixPositionCapture),t.el.on("keydown.autocomplete",function(e){t.onKeyPress(e)}),t.el.on("keyup.autocomplete",function(e){t.onKeyUp(e)}),t.el.on("blur.autocomplete",function(){t.onBlur()}),t.el.on("focus.autocomplete",function(){t.onFocus()}),t.el.on("change.autocomplete",function(e){t.onKeyUp(e)}),t.el.on("input.autocomplete",function(e){t.onKeyUp(e)})},onFocus:function(){var e=this;e.fixPosition(),0===e.options.minChars&&0===e.el.val().length&&e.onValueChange()},onBlur:function(){this.enableKillerFn()},abortAjax:function(){var e=this;e.currentRequest&&(e.currentRequest.abort(),e.currentRequest=null)},setOptions:function(e){var t=this,n=t.options;d.extend(n,e),t.isLocal=Array.isArray(n.lookup),t.isLocal&&(n.lookup=t.verifySuggestionsFormat(n.lookup)),n.orientation=t.validateOrientation(n.orientation,"bottom"),d(t.suggestionsContainer).css({"max-height":n.maxHeight+"px",width:n.width+"px","z-index":n.zIndex})},clearCache:function(){this.cachedResponse={},this.badQueries=[]},clear:function(){this.clearCache(),this.currentValue="",this.suggestions=[]},disable:function(){var e=this;e.disabled=!0,clearInterval(e.onChangeInterval),e.abortAjax()},enable:function(){this.disabled=!1},fixPosition:function(){var e,t,n,o,s,i,a,l,r=this,u=d(r.suggestionsContainer),c=u.parent().get(0);c!==document.body&&!r.options.forceFixPosition||(i=r.options.orientation,e=u.outerHeight(),t=r.el.outerHeight(),n={top:(l=r.el.offset()).top,left:l.left},"auto"===i&&(a=d(window).height(),o=-(s=d(window).scrollTop())+l.top-e,s=s+a-(l.top+t+e),i=Math.max(o,s)===o?"top":"bottom"),n.top+="top"===i?-e:t,c!==document.body&&(a=u.css("opacity"),r.visible||u.css("opacity",0).show(),l=u.offsetParent().offset(),n.top-=l.top,n.left-=l.left,r.visible||u.css("opacity",a).hide()),"auto"===r.options.width&&(n.width=r.el.outerWidth()-2+"px"),u.css(n))},enableKillerFn:function(){d(document).on("click.autocomplete",this.killerFn)},disableKillerFn:function(){d(document).off("click.autocomplete",this.killerFn)},killSuggestions:function(){var e=this;e.stopKillSuggestions(),e.intervalId=window.setInterval(function(){e.visible&&(e.el.val(e.currentValue),e.hide()),e.stopKillSuggestions()},50)},stopKillSuggestions:function(){window.clearInterval(this.intervalId)},isCursorAtEnd:function(){var e=this.el.val().length,t=this.element.selectionStart;return"number"==typeof t?t===e:!document.selection||((t=document.selection.createRange()).moveStart("character",-e),e===t.text.length)},onKeyPress:function(e){var t=this;if(t.disabled||t.visible||e.which!==r||!t.currentValue){if(!t.disabled&&t.visible){switch(e.which){case o:t.el.val(t.currentValue),t.hide();break;case l:if(t.hint&&t.options.onHint&&t.isCursorAtEnd()){t.selectHint();break}return;case s:if(t.hint&&t.options.onHint)return void t.selectHint();if(-1===t.selectedIndex)return void t.hide();if(t.select(t.selectedIndex),!1===t.options.tabDisabled)return;break;case i:if(-1===t.selectedIndex)return void t.hide();t.select(t.selectedIndex);break;case a:t.moveUp();break;case r:t.moveDown();break;default:return}e.stopImmediatePropagation(),e.preventDefault()}}else t.suggest()},onKeyUp:function(e){var t=this;if(!t.disabled){switch(e.which){case a:case r:return}clearInterval(t.onChangeInterval),t.currentValue!==t.el.val()&&(t.findBestHint(),0