/* Tue Jun 01 2021 16:00:35 */ !function(a){"function"==typeof define&&define.amd?define("jquery-typeahead",["jquery"],function(b){return a(b)}):"object"==typeof module&&module.exports?module.exports=function(b,c){return void 0===b&&(b="undefined"!=typeof window?require("jquery"):require("jquery")(c)),a(b)}():a(jQuery)}(function(a){"use strict";window.Typeahead={version:"2.10.4"};var b={input:null,minLength:2,maxLength:!1,maxItem:8,dynamic:!1,delay:300,order:null,offset:!1,hint:!1,accent:!1,highlight:!0,multiselect:null,group:!1,groupOrder:null,maxItemPerGroup:null,dropdownFilter:!1,dynamicFilter:null,backdrop:!1,backdropOnFocus:!1,cache:!1,ttl:36e5,compression:!1,searchOnFocus:!1,blurOnTab:!0,resultContainer:null,generateOnLoad:null,mustSelectItem:!1,href:null,display:["display"],template:null,templateValue:null,groupTemplate:null,correlativeTemplate:!1,emptyTemplate:!1,cancelButton:!0,loadingAnimation:!0,filter:!0,matcher:null,source:null,callback:{onInit:null,onReady:null,onShowLayout:null,onHideLayout:null,onSearch:null,onResult:null,onLayoutBuiltBefore:null,onLayoutBuiltAfter:null,onNavigateBefore:null,onNavigateAfter:null,onEnter:null,onLeave:null,onClickBefore:null,onClickAfter:null,onDropdownFilter:null,onSendRequest:null,onReceiveRequest:null,onPopulateSource:null,onCacheSave:null,onSubmit:null,onCancel:null},selector:{container:"typeahead__container",result:"typeahead__result",list:"typeahead__list",group:"typeahead__group",item:"typeahead__item",empty:"typeahead__empty",display:"typeahead__display",query:"typeahead__query",filter:"typeahead__filter",filterButton:"typeahead__filter-button",dropdown:"typeahead__dropdown",dropdownItem:"typeahead__dropdown-item",labelContainer:"typeahead__label-container",label:"typeahead__label",button:"typeahead__button",backdrop:"typeahead__backdrop",hint:"typeahead__hint",cancelButton:"typeahead__cancel-button"},debug:!1},c=".typeahead",d={from:"ãàáäâẽèéëêìíïîõòóöôùúüûñç",to:"aaaaaeeeeeiiiiooooouuuunc"},e=~window.navigator.appVersion.indexOf("MSIE 9."),f=~window.navigator.appVersion.indexOf("MSIE 10"),g=!!~window.navigator.userAgent.indexOf("Trident")&&~window.navigator.userAgent.indexOf("rv:11"),h=function(a,b){this.rawQuery=a.val()||"",this.query=a.val()||"",this.selector=a[0].selector,this.deferred=null,this.tmpSource={},this.source={},this.dynamicGroups=[],this.hasDynamicGroups=!1,this.generatedGroupCount=0,this.groupBy="group",this.groups=[],this.searchGroups=[],this.generateGroups=[],this.requestGroups=[],this.result=[],this.tmpResult={},this.groupTemplate="",this.resultHtml=null,this.resultCount=0,this.resultCountPerGroup={},this.options=b,this.node=a,this.namespace="."+this.helper.slugify.call(this,this.selector)+c,this.isContentEditable=void 0!==this.node.attr("contenteditable")&&"false"!==this.node.attr("contenteditable"),this.container=null,this.resultContainer=null,this.item=null,this.items=null,this.comparedItems=null,this.xhr={},this.hintIndex=null,this.filters={dropdown:{},dynamic:{}},this.dropdownFilter={static:[],dynamic:[]},this.dropdownFilterAll=null,this.isDropdownEvent=!1,this.requests={},this.backdrop={},this.hint={},this.label={},this.hasDragged=!1,this.focusOnly=!1,this.__construct()};h.prototype={_validateCacheMethod:function(a){var b,c=["localStorage","sessionStorage"];if(!0===a)a="localStorage";else if("string"==typeof a&&!~c.indexOf(a))return this.options.debug&&(j.log({node:this.selector,function:"extendOptions()",message:'Invalid options.cache, possible options are "localStorage" or "sessionStorage"'}),j.print()),!1;b=void 0!==window[a];try{window[a].setItem("typeahead","typeahead"),window[a].removeItem("typeahead")}catch(d){b=!1}return b&&a||!1},extendOptions:function(){if(this.options.cache=this._validateCacheMethod(this.options.cache),this.options.compression&&("object"==typeof LZString&&this.options.cache||(this.options.debug&&(j.log({node:this.selector,function:"extendOptions()",message:"Missing LZString Library or options.cache, no compression will occur."}),j.print()),this.options.compression=!1)),this.options.maxLength&&!isNaN(this.options.maxLength)||(this.options.maxLength=1/0),void 0!==this.options.maxItem&&~[0,!1].indexOf(this.options.maxItem)&&(this.options.maxItem=1/0),this.options.maxItemPerGroup&&!/^\d+$/.test(this.options.maxItemPerGroup)&&(this.options.maxItemPerGroup=null),this.options.display&&!Array.isArray(this.options.display)&&(this.options.display=[this.options.display]),this.options.multiselect&&(this.items=[],this.comparedItems=[],"string"==typeof this.options.multiselect.matchOn&&(this.options.multiselect.matchOn=[this.options.multiselect.matchOn])),this.options.group&&(Array.isArray(this.options.group)?this.options.debug&&(j.log({node:this.selector,function:"extendOptions()",message:"options.group must be a boolean|string|object as of 2.5.0"}),j.print()):("string"==typeof this.options.group?this.options.group={key:this.options.group}:"boolean"==typeof this.options.group&&(this.options.group={key:"group"}),this.options.group.key=this.options.group.key||"group")),this.options.highlight&&!~["any",!0].indexOf(this.options.highlight)&&(this.options.highlight=!1),this.options.dropdownFilter&&this.options.dropdownFilter instanceof Object){Array.isArray(this.options.dropdownFilter)||(this.options.dropdownFilter=[this.options.dropdownFilter]);for(var c=0,e=this.options.dropdownFilter.length;cb.maxLength&&(b.minLength=b.maxLength),this.options.source[a]=b,this.options.source[a].dynamic&&this.dynamicGroups.push(a),b.cache=void 0!==b.cache?this._validateCacheMethod(b.cache):this.options.cache,b.compression&&("object"==typeof LZString&&b.cache||(this.options.debug&&(j.log({node:this.selector,function:"unifySourceFormat()",message:"Missing LZString Library or group.cache, no compression will occur on group: "+a}),j.print()),b.compression=!1))}return this.hasDynamicGroups=this.options.dynamic||!!this.dynamicGroups.length,!0},init:function(){this.helper.executeCallback.call(this,this.options.callback.onInit,[this.node]),this.container=this.node.closest("."+this.options.selector.container),this.options.debug&&(j.log({node:this.selector,function:"init()",message:"OK - Typeahead activated on "+this.selector}),j.print())},delegateEvents:function(){var b=this,c=["focus"+this.namespace,"input"+this.namespace,"propertychange"+this.namespace,"keydown"+this.namespace,"keyup"+this.namespace,"search"+this.namespace,"generate"+this.namespace];a("html").on("touchmove",function(){b.hasDragged=!0}).on("touchstart",function(){b.hasDragged=!1}),this.node.closest("form").on("submit",function(a){return b.options.mustSelectItem&&b.helper.isEmpty(b.item)?void a.preventDefault():(b.options.backdropOnFocus||b.hideLayout(),b.options.callback.onSubmit?b.helper.executeCallback.call(b,b.options.callback.onSubmit,[b.node,this,b.item||b.items,a]):void 0)}).on("reset",function(){setTimeout(function(){b.node.trigger("input"+b.namespace),b.hideLayout()})});var d=!1;if(this.node.attr("placeholder")&&(f||g)){var h=!0;this.node.on("focusin focusout",function(){h=!(this.value||!this.placeholder)}),this.node.on("input",function(a){h&&(a.stopImmediatePropagation(),h=!1)})}this.node.off(this.namespace).on(c.join(" "),function(c,f){switch(c.type){case"generate":b.generateSource(Object.keys(b.options.source));break;case"focus":if(b.focusOnly){b.focusOnly=!1;break}b.options.backdropOnFocus&&(b.buildBackdropLayout(),b.showLayout()),b.options.searchOnFocus&&!b.item&&(b.deferred=a.Deferred(),b.assignQuery(),b.generateSource());break;case"keydown":8===c.keyCode&&b.options.multiselect&&b.options.multiselect.cancelOnBackspace&&""===b.query&&b.items.length?b.cancelMultiselectItem(b.items.length-1,null,c):c.keyCode&&~[9,13,27,38,39,40].indexOf(c.keyCode)&&(d=!0,b.navigate(c));break;case"keyup":e&&b.node[0].value.replace(/^\s+/,"").toString().length=this.options.source[a].minLength&&this.query.length<=this.options.source[a].maxLength){if(this.searchGroups.push(a),!this.options.source[a].dynamic&&this.source[a])continue;this.generateGroups.push(a)}},generateSource:function(b){if(this.filterGenerateSource(),Array.isArray(b)&&b.length)this.generateGroups=b;else if(!this.generateGroups.length)return void this.node.trigger("search"+this.namespace);if(this.requestGroups=[],this.generatedGroupCount=0,this.options.loadingAnimation&&this.container.addClass("loading"),!this.helper.isEmpty(this.xhr)){for(var c in this.xhr)this.xhr.hasOwnProperty(c)&&this.xhr[c].abort();this.xhr={}}for(var d,e,f,g,h,i,k,l=this,c=0,m=this.generateGroups.length;c(new Date).getTime()?(this.populateSource(i.data,d),k=!0,this.options.debug&&(j.log({node:this.selector,function:"generateSource()",message:'Source for group "'+d+'" found in '+g}),j.print())):window[g].removeItem("TYPEAHEAD_"+this.selector+":"+d)}catch(n){}if(k)continue}!f.data||f.ajax?f.ajax&&(this.requests[d]||(this.requests[d]=this.generateRequestObject(d)),this.requestGroups.push(d)):"function"==typeof f.data?(e=f.data.call(this),Array.isArray(e)?l.populateSource(e,d):"function"==typeof e.promise&&function(b){a.when(e).then(function(a){a&&Array.isArray(a)&&l.populateSource(a,b)})}(d)):this.populateSource(a.extend(!0,[],f.data),d)}return this.requestGroups.length&&this.handleRequests(),!!this.generateGroups.length},generateRequestObject:function(a){var b=this,c=this.options.source[a],d={request:{url:c.ajax.url||null,dataType:"json",beforeSend:function(d,e){b.xhr[a]=d;var f=b.requests[a].callback.beforeSend||c.ajax.beforeSend;"function"==typeof f&&f.apply(null,arguments)}},callback:{beforeSend:null,done:null,fail:null,then:null,always:null},extra:{path:c.ajax.path||null,group:a},validForGroup:[a]};if("function"!=typeof c.ajax&&(c.ajax instanceof Object&&(d=this.extendXhrObject(d,c.ajax)),Object.keys(this.options.source).length>1))for(var e in this.requests)this.requests.hasOwnProperty(e)&&(this.requests[e].isDuplicated||d.request.url&&d.request.url===this.requests[e].request.url&&(this.requests[e].validForGroup.push(a),d.isDuplicated=!0,delete d.validForGroup));return d},extendXhrObject:function(b,c){return"object"==typeof c.callback&&(b.callback=c.callback,delete c.callback),"function"==typeof c.beforeSend&&(b.callback.beforeSend=c.beforeSend,delete c.beforeSend),b.request=a.extend(!0,b.request,c),"jsonp"!==b.request.dataType.toLowerCase()||b.request.jsonpCallback||(b.request.jsonpCallback="callback_"+b.extra.group),b},handleRequests:function(){var b,c=this,d=this.requestGroups.length;if(!1!==this.helper.executeCallback.call(this,this.options.callback.onSendRequest,[this.node,this.query]))for(var e=0,f=this.requestGroups.length;e/g," ").replace(/\s{2,}/," ").trim();for(var k=0,l=b.length;k").html(s.replace(/\{\{([\w\-\.]+)(?:\|(\w+))?}}/g,function(a,c){return e.helper.namespace.call(e,c,b[k],"get","")}).trim()).text();f.display?~f.display.indexOf("compiled")||f.display.unshift("compiled"):~this.options.display.indexOf("compiled")||this.options.display.unshift("compiled")}else this.options.debug&&(j.log({node:this.selector,function:"populateSource()",arguments:String(c),message:"WARNING - this.options.correlativeTemplate is enabled but no template was found."}),j.print())}this.options.callback.onPopulateSource&&(b=this.helper.executeCallback.call(this,this.options.callback.onPopulateSource,[this.node,b,c,d]),this.options.debug&&(b&&Array.isArray(b)||(j.log({node:this.selector,function:"callback.populateSource()",message:'callback.onPopulateSource must return the "data" parameter'}),j.print()))),this.tmpSource[c]=Array.isArray(b)&&b||[];var t=this.options.source[c].cache,u=this.options.source[c].compression,v=this.options.source[c].ttl||this.options.ttl;if(t&&!window[t].getItem("TYPEAHEAD_"+this.selector+":"+c)){this.options.callback.onCacheSave&&(b=this.helper.executeCallback.call(this,this.options.callback.onCacheSave,[this.node,b,c,d]),this.options.debug&&(b&&Array.isArray(b)||(j.log({node:this.selector,function:"callback.populateSource()",message:'callback.onCacheSave must return the "data" parameter'}),j.print())));var w=JSON.stringify({data:b,ttl:(new Date).getTime()+v});u&&(w=LZString.compressToUTF16(w)),window[t].setItem("TYPEAHEAD_"+this.selector+":"+c,w)}this.incrementGeneratedGroup()},incrementGeneratedGroup:function(){if(++this.generatedGroupCount===this.generateGroups.length){this.xhr={};for(var a=0,b=this.generateGroups.length;a0?"javascript:;"===c.find("a:first")[0].href?c.find("a:first").trigger("click",a):c.find("a:first")[0].click():this.node.closest("form").trigger("submit"));if(39===a.keyCode)return void(null!==d?b.eq(d).find("a:first")[0].click():this.options.hint&&""!==this.hint.container.val()&&this.helper.getCaret(this.node[0])>=this.query.length&&b.filter('[data-index="'+this.hintIndex+'"]').find("a:first")[0].click());9===a.keyCode?this.options.blurOnTab?this.hideLayout():c.length>0?d+10?d-1>=0&&(f=d-1,this.addActiveItem(b.eq(f))):b.length&&(f=b.length-1,this.addActiveItem(b.last()))):40===a.keyCode&&(a.preventDefault(),c.length>0?d+1=this.options.multiselect.limit||this.searchResultData(),this.helper.executeCallback.call(this,this.options.callback.onResult,[this.node,this.query,this.result,this.resultCount,this.resultCountPerGroup]),this.isDropdownEvent&&(this.helper.executeCallback.call(this,this.options.callback.onDropdownFilter,[this.node,this.query,this.filters.dropdown,this.result]),this.isDropdownEvent=!1))},searchResultData:function(){var b,c,d,e,f,g,h,i,k,l,m,n,o,p=this,q=this.groupBy,r=null,s=this.query.toLowerCase(),t=this.options.maxItem,u=this.options.maxItemPerGroup,v=this.filters.dynamic&&!this.helper.isEmpty(this.filters.dynamic),w={},x="function"==typeof this.options.matcher&&this.options.matcher;this.options.accent&&(s=this.helper.removeAccent.call(this,s));for(var y=0,z=this.searchGroups.length;y=t)||this.options.callback.onResult);A++)if((!v||this.dynamicFilter.validate.apply(this,[this.source[b][A]]))&&null!==(c=this.source[b][A])&&"boolean"!=typeof c&&(!this.options.multiselect||this.isMultiselectUniqueData(c))&&(!this.filters.dropdown||(c[this.filters.dropdown.key]||"").toLowerCase()===(this.filters.dropdown.value||"").toLowerCase())){if(r="group"===q?b:c[q]?c[q]:c.group,r&&!this.tmpResult[r]&&(this.tmpResult[r]=[],this.resultCountPerGroup[r]=0),u&&"group"===q&&this.tmpResult[r].length>=u&&!this.options.callback.onResult)break;f=this.options.source[b].display||this.options.display;for(var C=0,D=f.length;C=u)break;this.tmpResult[r].push(a.extend(!0,{matchedKey:f[C]},c)),this.resultItemCount++}break}if(!this.options.callback.onResult){if(this.resultItemCount>=t)break;if(u&&this.tmpResult[r].length>=u&&"group"===q)break}}}if(this.options.debug&&(this.helper.isEmpty(w)||(j.log({node:this.selector,function:"searchResult()",arguments:JSON.stringify(w),message:"Missing keys for display, make sure options.display is set properly."}),j.print())),this.options.order){var G,f=[];for(var b in this.tmpResult)if(this.tmpResult.hasOwnProperty(b)){for(var y=0,z=this.tmpResult[b].length;y",{class:this.options.selector.result}),this.container.append(this.resultContainer));var b;if(!this.result.length)if(this.options.multiselect&&this.options.multiselect.limit&&this.items.length>=this.options.multiselect.limit)b=this.options.multiselect.limitTemplate?"function"==typeof this.options.multiselect.limitTemplate?this.options.multiselect.limitTemplate.call(this,this.query):this.options.multiselect.limitTemplate.replace(/\{\{query}}/gi,a("
").text(this.helper.cleanStringFromScript(this.query)).html()):"Can't select more than "+this.items.length+" items.";else{if(!this.options.emptyTemplate||""===this.query)return;b="function"==typeof this.options.emptyTemplate?this.options.emptyTemplate.call(this,this.query):this.options.emptyTemplate.replace(/\{\{query}}/gi,a("
").text(this.helper.cleanStringFromScript(this.query)).html())}var c=this.query.toLowerCase();this.options.accent&&(c=this.helper.removeAccent.call(this,c));var d=this,e=this.groupTemplate||"
    ",f=!1;this.groupTemplate?e=a(e.replace(/<([^>]+)>\{\{(.+?)}}<\/[^>]+>/g,function(a,c,e,g,h){var i="",j="group"===e?d.groups:[e];if(!d.result.length)return!0===f?"":(f=!0,"<"+c+' class="'+d.options.selector.empty+'">'+b+"");for(var k=0,l=j.length;k
      ";return i})):(e=a(e),this.result.length||e.append(b instanceof a?b:'
    • '+b+"
    • ")),e.addClass(this.options.selector.list+(this.helper.isEmpty(this.result)?" empty":""));for(var g,h,i,j,k,l,m,n,o,p,q,r=this.groupTemplate&&this.result.length&&d.groups||[],s=0,t=this.result.length;s",{class:d.options.selector.group,html:a("",{href:"javascript:;",html:h||g,tabindex:-1}),"data-search-group":g}))),this.groupTemplate&&r.length&&~(q=r.indexOf(g||i.group))&&r.splice(q,1),k=a("
    • ",{class:d.options.selector.item+" "+d.options.selector.group+"-"+this.helper.slugify.call(this,g),disabled:!!i.disabled,"data-group":g,"data-index":s,html:a("",{href:j&&!i.disabled?function(a,b){ return b.href=d.generateHref.call(d,a,b)}(j,i):"javascript:;",html:function(){if(l=i.group&&d.options.source[i.group].template||d.options.template)"function"==typeof l&&(l=l.call(d,d.query,i)),m=l.replace(/\{\{([^\|}]+)(?:\|([^}]+))*}}/gi,function(a,b,e){var f=d.helper.cleanStringFromScript(String(d.helper.namespace.call(d,b,i,"get","")));return e=e&&e.split("|")||[],~e.indexOf("slugify")&&(f=d.helper.slugify.call(d,f)),~e.indexOf("raw")||!0===d.options.highlight&&c&&~o.indexOf(b)&&(f=d.helper.highlight.call(d,f,c.split(" "),d.options.accent)),f});else{for(var b=0,e=o.length;b'+d.helper.cleanStringFromScript(String(n.join(" ")))+""}(!0===d.options.highlight&&c&&!l||"any"===d.options.highlight)&&(m=d.helper.highlight.call(d,m,c.split(" "),d.options.accent)),a(this).append(m)}})}),function(b,c,e){e.on("click",function(b,e){if(c.disabled)return void b.preventDefault();if(e&&"object"==typeof e&&(b.originalEvent=e),d.options.mustSelectItem&&d.helper.isEmpty(c))return void b.preventDefault();if(d.options.multiselect?(d.items.push(c),d.comparedItems.push(d.getMultiselectComparedData(c))):d.item=c,!1!==d.helper.executeCallback.call(d,d.options.callback.onClickBefore,[d.node,a(this),c,b])&&!(b.originalEvent&&b.originalEvent.defaultPrevented||b.isDefaultPrevented())){var f=d.getTemplateValue.call(d,c);d.options.multiselect?(d.query=d.rawQuery="",d.addMultiselectItemLayout(f)):(d.focusOnly=!0,d.query=d.rawQuery=f,d.isContentEditable&&(d.node.text(d.query),d.helper.setCaretAtEnd(d.node[0]))),d.hideLayout(),d.node.val(d.query).focus(),d.helper.executeCallback.call(d,d.options.callback.onClickAfter,[d.node,a(this),c,b])}}),e.on("mouseenter",function(b){c.disabled||(d.clearActiveItem(),d.addActiveItem(a(this))),d.helper.executeCallback.call(d,d.options.callback.onEnter,[d.node,a(this),c,b])}),e.on("mouseleave",function(b){c.disabled||d.clearActiveItem(),d.helper.executeCallback.call(d,d.options.callback.onLeave,[d.node,a(this),c,b])})}(0,i,k),(this.groupTemplate?e.find('[data-group-template="'+g+'"] ul'):e).append(k);if(this.result.length&&r.length)for(var s=0,t=r.length;s",{class:this.options.selector.backdrop,css:this.backdrop.css}).insertAfter(this.container)),this.container.addClass("backdrop").css({"z-index":this.backdrop.css["z-index"]+1,position:"relative"}))},buildHintLayout:function(b){if(this.options.hint){if(this.node[0].scrollWidth>Math.ceil(this.node.innerWidth()))return void(this.hint.container&&this.hint.container.val(""));var c=this,d="",b=b||this.result,e=this.query.toLowerCase();if(this.options.accent&&(e=this.helper.removeAccent.call(this,e)),this.hintIndex=null,this.searchGroups.length){if(this.hint.container||(this.hint.css=a.extend({"border-color":"transparent",position:"absolute",top:0,display:"inline","z-index":-1,float:"none",color:"silver","box-shadow":"none",cursor:"default","-webkit-user-select":"none","-moz-user-select":"none","-ms-user-select":"none","user-select":"none"},this.options.hint),this.hint.container=a("<"+this.node[0].nodeName+"/>",{type:this.node.attr("type"),class:this.node.attr("class"),readonly:!0,unselectable:"on","aria-hidden":"true",tabindex:-1,click:function(){c.node.focus()}}).addClass(this.options.selector.hint).css(this.hint.css).insertAfter(this.node),this.node.parent().css({position:"relative"})),this.hint.container.css("color",this.hint.css.color),e)for(var f,g,h,i=0,j=b.length;i0&&this.rawQuery+d.substring(this.query.length)||"";this.hint.container.val(m),this.isContentEditable&&this.hint.container.text(m)}}},buildDropdownLayout:function(){if(this.options.dropdownFilter){var b=this;a("",{class:this.options.selector.filter,html:function(){a(this).append(a("