(function(n){n.fn.each2===void 0&&n.fn.extend({each2:function(t){for(var i=n([0]),r=-1,u=this.length;u>++r&&(i.context=i[0]=this[r])&&t.call(i[0],r,i)!==!1;);return this}})})(jQuery),function(n,t){"use strict";function f(n,t){for(var i=0,r=t.length;r>i;i+=1)if(u(n,t[i]))return i;return-1}function et(){var t=n(st),i;return t.appendTo("body"),i={width:t.width()-t[0].clientWidth,height:t.height()-t[0].clientHeight},t.remove(),i}function u(n,i){return n===i?!0:n===t||i===t?!1:null===n||null===i?!1:n.constructor===String?n+""==i+"":i.constructor===String?i+""==n+"":!1}function v(t,i){var u,r,f;if(null===t||1>t.length)return[];for(u=t.split(i),r=0,f=u.length;f>r;r+=1)u[r]=n.trim(u[r]);return u}function tt(n){return n.outerWidth(!1)-n.width()}function it(i){var r="keyup-change-value";i.on("keydown",function(){n.data(i,r)===t&&n.data(i,r,i.val())}),i.on("keyup",function(){var u=n.data(i,r);u!==t&&i.val()!==u&&(n.removeData(i,r),i.trigger("keyup-change"))})}function ot(i){i.on("mousemove",function(i){var r=k;(r===t||r.x!==i.pageX||r.y!==i.pageY)&&n(i.target).trigger("mousemove-filtered",i)})}function nt(n,i,r){r=r||t;var u;return function(){var t=arguments;window.clearTimeout(u),u=window.setTimeout(function(){i.apply(r,t)},n)}}function ht(n){var i,t=!1;return function(){return t===!1&&(i=n(),t=!0),i}}function vt(n,t){var i=nt(n,function(n){t.trigger("scroll-debounced",n)});t.on("scroll",function(n){f(n.target,t.get())>=0&&i(n)})}function yt(n){n[0]!==document.activeElement&&window.setTimeout(function(){var i,t=n[0],r=n.val().length;n.focus(),n.is(":visible")&&t===document.activeElement&&(t.setSelectionRange?t.setSelectionRange(r,r):t.createTextRange&&(i=t.createTextRange(),i.collapse(!1),i.select()))},0)}function pt(t){var r,i,u;return t=n(t)[0],r=0,i=0,"selectionStart"in t?(r=t.selectionStart,i=t.selectionEnd-r):"selection"in document&&(t.focus(),u=document.selection.createRange(),i=document.selection.createRange().text.length,u.moveStart("character",-t.value.length),r=u.text.length-i),{offset:r,length:i}}function r(n){n.preventDefault(),n.stopPropagation()}function ct(n){n.preventDefault(),n.stopImmediatePropagation()}function at(t){if(!o){var i=t[0].currentStyle||window.getComputedStyle(t[0],null);o=n(document.createElement("div")).css({position:"absolute",left:"-10000px",top:"-10000px",display:"none",fontSize:i.fontSize,fontFamily:i.fontFamily,fontStyle:i.fontStyle,fontWeight:i.fontWeight,letterSpacing:i.letterSpacing,textTransform:i.textTransform,whiteSpace:"nowrap"}),o.attr("class","select2-sizer"),n("body").append(o)}return o.text(t.val()),o.width()}function l(t,i,r){var u,e,f=[];u=t.attr("class"),u&&(u=""+u,n(u.split(" ")).each2(function(){0===this.indexOf("select2-")&&f.push(this)})),u=i.attr("class"),u&&(u=""+u,n(u.split(" ")).each2(function(){0!==this.indexOf("select2-")&&(e=r(this),e&&f.push(this))})),t.attr("class",f.join(" "))}function ut(n,i,r,u){var f=n.toUpperCase().indexOf(i.toUpperCase()),e=i.length;return 0>f?(r.push(u(n)),t):(r.push(u(n.substring(0,f))),r.push("<span class='select2-match'>"),r.push(u(n.substring(f,f+e))),r.push("</span>"),r.push(u(n.substring(f+e,n.length))),t)}function ft(i){var e,f=0,u=null,o=i.quietMillis||100,s=i.url,r=this;return function(h){window.clearTimeout(e),e=window.setTimeout(function(){f+=1;var l=f,c=i.data,e=s,v=i.transport||n.fn.select2.ajaxDefaults.transport,a={type:i.type||"GET",cache:i.cache||!1,jsonpCallback:i.jsonpCallback||t,dataType:i.dataType||"json"},o=n.extend({},n.fn.select2.ajaxDefaults.params,a);c=c?c.call(r,h.term,h.page,h.context):null,e="function"==typeof e?e.call(r,h.term,h.page,h.context):e,null!==u&&u.abort(),i.params&&(n.isFunction(i.params)?n.extend(o,i.params.call(r)):n.extend(o,i.params)),n.extend(o,{url:e,dataType:i.dataType,data:c,success:function(n){if(!(f>l)){var t=i.results(n,h.page);h.callback(t)}}}),u=v.call(r,o)},o)}}function rt(i){var o,e,r=i,u=function(n){return""+n.text},f;return n.isArray(r)&&(e=r,r={results:e}),n.isFunction(r)===!1&&(e=r,r=function(){return e}),f=r(),f.text&&(u=f.text,n.isFunction(u)||(o=f.text,u=function(n){return n[o]})),function(i){var e,f=i.term,o={results:[]};return""===f?(i.callback(r()),t):(e=function(t,r){var o,s;if(t=t[0],t.children){o={};for(s in t)t.hasOwnProperty(s)&&(o[s]=t[s]);o.children=[],n(t.children).each2(function(n,t){e(t,o.children)}),(o.children.length||i.matcher(f,u(o),t))&&r.push(o)}else i.matcher(f,u(t),t)&&r.push(t)},n(r().results).each2(function(n,t){e(t,o.results)}),i.callback(o),t)}}function b(i){var r=n.isFunction(i);return function(u){var e=u.term,f={results:[]};n(r?i():i).each(function(){var n=this.text!==t,i=n?this.text:this;(""===e||u.matcher(e,i))&&f.results.push(n?this:{id:this,text:this})}),u.callback(f)}}function s(t){if(n.isFunction(t))return!0;if(!t)return!1;throw Error("formatterName must be a function or a falsy value");}function e(t){return n.isFunction(t)?t():t}function d(t){var i=0;return n.each(t,function(n,t){t.children?i+=d(t.children):i++}),i}function lt(n,i,r,f){var e,s,o,h,l,a=n,c=!1;if(!f.createSearchChoice||!f.tokenSeparators||1>f.tokenSeparators.length)return t;for(;;){for(s=-1,o=0,h=f.tokenSeparators.length;h>o&&(l=f.tokenSeparators[o],s=n.indexOf(l),!(s>=0));o++);if(0>s)break;if(e=n.substring(0,s),n=n.substring(s+l.length),e.length>0&&(e=f.createSearchChoice(e,i),e!==t&&null!==e&&f.id(e)!==t&&null!==f.id(e))){for(c=!1,o=0,h=i.length;h>o;o++)if(u(f.id(e),f.id(i[o]))){c=!0;break}c||r(e)}}return a!==n?n:t}function a(t,i){var r=function(){};return r.prototype=new t,r.prototype.constructor=r,r.prototype.parent=t.prototype,r.prototype=n.extend(r.prototype,i),r}if(window.Select2===t){var c,p,w,h,o,k,g,y,i={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(n){switch(n=n.which?n.which:n){case i.LEFT:case i.RIGHT:case i.UP:case i.DOWN:return!0}return!1},isControl:function(n){var t=n.which;switch(t){case i.SHIFT:case i.CTRL:case i.ALT:return!0}return n.metaKey?!0:!1},isFunctionKey:function(n){return n=n.which?n.which:n,n>=112&&123>=n}},st="<div class='select2-measure-scrollbar'></div>";g=n(document),h=function(){var n=1;return function(){return n++}}(),g.on("mousemove",function(n){k={x:n.pageX,y:n.pageY}}),c=a(Object,{bind:function(n){var t=this;return function(){n.apply(t,arguments)}},init:function(i){var u,f,o=".select2-results",c,s;this.opts=i=this.prepareOpts(i),this.id=i.id,i.element.data("select2")!==t&&null!==i.element.data("select2")&&this.destroy(),this.container=this.createContainer(),this.containerId="s2id_"+(i.element.attr("id")||"autogen"+h()),this.containerSelector="#"+this.containerId.replace(/([;&,\.\+\*\~':"\!\^#$%@\[\]\(\)=>\|])/g,"\\$1"),this.container.attr("id",this.containerId),this.body=ht(function(){return i.element.closest("body")}),l(this.container,this.opts.element,this.opts.adaptContainerCssClass),this.container.css(e(i.containerCss)),this.container.addClass(e(i.containerCssClass)),this.elementTabIndex=this.opts.element.attr("tabindex"),this.opts.element.data("select2",this).attr("tabindex","-1").before(this.container),this.container.data("select2",this),this.dropdown=this.container.find(".select2-drop"),this.dropdown.addClass(e(i.dropdownCssClass)),this.dropdown.data("select2",this),this.results=u=this.container.find(o),this.search=f=this.container.find("input.select2-input"),this.resultsPage=0,this.context=null,this.initContainer(),ot(this.results),this.dropdown.on("mousemove-filtered touchstart touchmove touchend",o,this.bind(this.highlightUnderEvent)),vt(80,this.results),this.dropdown.on("scroll-debounced",o,this.bind(this.loadMoreIfNeeded)),n(this.container).on("change",".select2-input",function(n){n.stopPropagation()}),n(this.dropdown).on("change",".select2-input",function(n){n.stopPropagation()}),n.fn.mousewheel&&u.mousewheel(function(n,t,i,f){var e=u.scrollTop();f>0&&0>=e-f?(u.scrollTop(0),r(n)):0>f&&u.get(0).scrollHeight-u.scrollTop()+f<=u.height()&&(u.scrollTop(u.get(0).scrollHeight-u.height()),r(n))}),it(f),f.on("keyup-change input paste",this.bind(this.updateResults)),f.on("focus",function(){f.addClass("select2-focused")}),f.on("blur",function(){f.removeClass("select2-focused")}),this.dropdown.on("mouseup",o,this.bind(function(t){n(t.target).closest(".select2-result-selectable").length>0&&(this.highlightUnderEvent(t),this.selectHighlighted(t))})),this.dropdown.on("click mouseup mousedown",function(n){n.stopPropagation()}),n.isFunction(this.opts.initSelection)&&(this.initSelection(),this.monitorSource()),null!==i.maximumInputLength&&this.search.attr("maxlength",i.maximumInputLength),c=i.element.prop("disabled"),c===t&&(c=!1),this.enable(!c),s=i.element.prop("readonly"),s===t&&(s=!1),this.readonly(s),y=y||et(),this.autofocus=i.element.prop("autofocus"),i.element.prop("autofocus",!1),this.autofocus&&this.focus()},destroy:function(){var n=this.opts.element.data("select2");this.propertyObserver&&(delete this.propertyObserver,this.propertyObserver=null),n!==t&&(n.container.remove(),n.dropdown.remove(),n.opts.element.removeClass("select2-offscreen").removeData("select2").off(".select2").attr({tabindex:this.elementTabIndex}).prop("autofocus",this.autofocus||!1).show())},optionToData:function(n){return n.is("option")?{id:n.prop("value"),text:n.text(),element:n.get(),css:n.attr("class"),disabled:n.prop("disabled"),locked:u(n.attr("locked"),"locked")}:n.is("optgroup")?{text:n.attr("label"),children:[],element:n.get(),css:n.attr("class")}:t},prepareOpts:function(i){var o,e,s,r,f=this;if(o=i.element,"select"===o.get(0).tagName.toLowerCase()&&(this.select=e=i.element),e&&n.each(["id","multiple","ajax","query","createSearchChoice","initSelection","data","tags"],function(){if(this in i)throw Error("Option '"+this+"' is not allowed for Select2 when attached to a <select> element.");}),i=n.extend({},{populateResults:function(r,u,e){var o,s=this.opts.id;o=function(r,u,h){var v,d,l,k,b,p,c,a,y,w;for(r=i.sortResults(r,u,e),v=0,d=r.length;d>v;v+=1)l=r[v],b=l.disabled===!0,k=!b&&s(l)!==t,p=l.children&&l.children.length>0,c=n("<li></li>"),c.addClass("select2-results-dept-"+h),c.addClass("select2-result"),c.addClass(k?"select2-result-selectable":"select2-result-unselectable"),b&&c.addClass("select2-disabled"),p&&c.addClass("select2-result-with-children"),c.addClass(f.opts.formatResultCssClass(l)),a=n(document.createElement("div")),a.addClass("select2-result-label"),w=i.formatResult(l,a,e,f.opts.escapeMarkup),w!==t&&a.html(w),c.append(a),p&&(y=n("<ul></ul>"),y.addClass("select2-result-sub"),o(l.children,y,h+1),c.append(y)),c.data("select2-data",l),u.append(c)},o(u,r,0)}},n.fn.select2.defaults,i),"function"!=typeof i.id&&(s=i.id,i.id=function(n){return n[s]}),n.isArray(i.element.data("select2Tags"))){if("tags"in i)throw"tags specified as both an attribute 'data-select2-tags' and in options of Select2 "+i.element.attr("id");i.tags=i.element.data("select2Tags")}if(e?(i.query=this.bind(function(i){var r,e,u,s={results:[],more:!1},h=i.term;u=function(n,t){var r;n.is("option")?i.matcher(h,n.text(),n)&&t.push(f.optionToData(n)):n.is("optgroup")&&(r=f.optionToData(n),n.children().each2(function(n,t){u(t,r.children)}),r.children.length>0&&t.push(r))},r=o.children(),this.getPlaceholder()!==t&&r.length>0&&(e=r[0],""===n(e).text()&&(r=r.not(e))),r.each2(function(n,t){u(t,s.results)}),i.callback(s)}),i.id=function(n){return n.id},i.formatResultCssClass=function(n){return n.css}):"query"in i||("ajax"in i?(r=i.element.data("ajax-url"),r&&r.length>0&&(i.ajax.url=r),i.query=ft.call(i.element,i.ajax)):"data"in i?i.query=rt(i.data):"tags"in i&&(i.query=b(i.tags),i.createSearchChoice===t&&(i.createSearchChoice=function(n){return{id:n,text:n}}),i.initSelection===t&&(i.initSelection=function(r,f){var e=[];n(v(r.val(),i.separator)).each(function(){var f=this,o=this,r=i.tags;n.isFunction(r)&&(r=r()),n(r).each(function(){return u(this.id,f)?(o=this.text,!1):t}),e.push({id:f,text:o})}),f(e)}))),"function"!=typeof i.query)throw"query function not defined for Select2 "+i.element.attr("id");return i},monitorSource:function(){var i,n=this.opts.element;n.on("change.select2",this.bind(function(){this.opts.element.data("select2-change-triggered")!==!0&&this.initSelection()})),i=this.bind(function(){var r=n.prop("disabled"),i;r===t&&(r=!1),this.enable(!r),i=n.prop("readonly"),i===t&&(i=!1),this.readonly(i),l(this.container,this.opts.element,this.opts.adaptContainerCssClass),this.container.addClass(e(this.opts.containerCssClass)),l(this.dropdown,this.opts.element,this.opts.adaptDropdownCssClass),this.dropdown.addClass(e(this.opts.dropdownCssClass))}),n.on("propertychange.select2 DOMAttrModified.select2",i),this.mutationCallback===t&&(this.mutationCallback=function(n){n.forEach(i)}),"undefined"!=typeof WebKitMutationObserver&&(this.propertyObserver&&(delete this.propertyObserver,this.propertyObserver=null),this.propertyObserver=new WebKitMutationObserver(this.mutationCallback),this.propertyObserver.observe(n.get(0),{attributes:!0,subtree:!1}))},triggerSelect:function(t){var i=n.Event("select2-selecting",{val:this.id(t),object:t});return this.opts.element.trigger(i),!i.isDefaultPrevented()},triggerChange:function(t){t=t||{},t=n.extend({},t,{type:"change",val:this.val()}),this.opts.element.data("select2-change-triggered",!0),this.opts.element.trigger(t),this.opts.element.data("select2-change-triggered",!1),this.opts.element.click(),this.opts.blurOnChange&&this.opts.element.blur()},isInterfaceEnabled:function(){return this.enabledInterface===!0},enableInterface:function(){var n=this._enabled&&!this._readonly,t=!n;return n===this.enabledInterface?!1:(this.container.toggleClass("select2-container-disabled",t),this.close(),this.enabledInterface=n,!0)},enable:function(n){return n===t&&(n=!0),this._enabled===n?!1:(this._enabled=n,this.opts.element.prop("disabled",!n),this.enableInterface(),!0)},readonly:function(n){return n===t&&(n=!1),this._readonly===n?!1:(this._readonly=n,this.opts.element.prop("readonly",n),this.enableInterface(),!0)},opened:function(){return this.container.hasClass("select2-dropdown-open")},positionDropdown:function(){var c,f,v,l,t=this.dropdown,r=this.container.offset(),g=this.container.outerHeight(!1),u=this.container.outerWidth(!1),h=t.outerHeight(!1),w=n(window).scrollLeft()+n(window).width(),d=n(window).scrollTop()+n(window).height(),s=r.top+g,o=r.left,a=d>=s+h,p=r.top-h>=this.body().scrollTop(),i=t.outerWidth(!1),b=w>=o+i,k=t.hasClass("select2-drop-above");this.opts.dropdownAutoWidth?(l=n(".select2-results",t)[0],t.addClass("select2-drop-auto-width"),t.css("width",""),i=t.outerWidth(!1)+(l.scrollHeight===l.clientHeight?0:y.width),i>u?u=i:i=u,b=w>=o+i):this.container.removeClass("select2-drop-auto-width"),"static"!==this.body().css("position")&&(c=this.body().offset(),s-=c.top,o-=c.left),k?(f=!0,!p&&a&&(f=!1)):(f=!1,!a&&p&&(f=!0)),b||(o=r.left+u-i),f?(s=r.top-h,this.container.addClass("select2-drop-above"),t.addClass("select2-drop-above")):(this.container.removeClass("select2-drop-above"),t.removeClass("select2-drop-above")),v=n.extend({top:s,left:o,width:u},e(this.opts.dropdownCss)),t.css(v)},shouldOpen:function(){var t;return this.opened()?!1:this._enabled===!1||this._readonly===!0?!1:(t=n.Event("select2-opening"),this.opts.element.trigger(t),!t.isDefaultPrevented())},clearDropdownAlignmentPreference:function(){this.container.removeClass("select2-drop-above"),this.dropdown.removeClass("select2-drop-above")},open:function(){return this.shouldOpen()?(this.opening(),!0):!1},opening:function(){function u(){return{width:Math.max(document.documentElement.scrollWidth,n(window).width()),height:Math.max(document.documentElement.scrollHeight,n(window).height())}}var t,i=this.containerId,f="scroll."+i,o="resize."+i,e="orientationchange."+i,r;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()),t=n("#select2-drop-mask"),0==t.length&&(t=n(document.createElement("div")),t.attr("id","select2-drop-mask").attr("class","select2-drop-mask"),t.hide(),t.appendTo(this.body()),t.on("mousedown touchstart",function(t){var i,r=n("#select2-drop");r.length>0&&(i=r.data("select2"),i.opts.selectOnBlur&&i.selectHighlighted({noFocus:!0}),i.close(),t.preventDefault(),t.stopPropagation())})),this.dropdown.prev()[0]!==t[0]&&this.dropdown.before(t),n("#select2-drop").removeAttr("id"),this.dropdown.attr("id","select2-drop"),t.css(u()),t.show(),this.dropdown.show(),this.positionDropdown(),this.dropdown.addClass("select2-drop-active"),this.ensureHighlightVisible(),r=this,this.container.parents().add(window).each(function(){n(this).on(o+" "+f+" "+e,function(){n("#select2-drop-mask").css(u()),r.positionDropdown()})})},close:function(){if(this.opened()){var t=this.containerId,u="scroll."+t,r="resize."+t,i="orientationchange."+t;this.container.parents().add(window).each(function(){n(this).off(u).off(r).off(i)}),this.clearDropdownAlignmentPreference(),n("#select2-drop-mask").hide(),this.dropdown.removeAttr("id"),this.dropdown.hide(),this.container.removeClass("select2-dropdown-open"),this.results.empty(),this.clearSearch(),this.search.removeClass("select2-active"),this.opts.element.trigger(n.Event("select2-close"))}},clearSearch:function(){},getMaximumSelectionSize:function(){return e(this.opts.maximumSelectionSize)},ensureHighlightVisible:function(){var o,u,r,e,s,h,f,i=this.results;if(u=this.highlight(),!(0>u)){if(0==u)return i.scrollTop(0),t;o=this.findHighlightableChoices().find(".select2-result-label"),r=n(o[u]),e=r.offset().top+r.outerHeight(!0),u===o.length-1&&(f=i.find("li.select2-more-results"),f.length>0&&(e=f.offset().top+f.outerHeight(!0))),s=i.offset().top+i.outerHeight(!0),e>s&&i.scrollTop(i.scrollTop()+(e-s)),h=r.offset().top-i.offset().top,0>h&&"none"!=r.css("display")&&i.scrollTop(i.scrollTop()+h)}},findHighlightableChoices:function(){return this.results.find(".select2-result-selectable:not(.select2-selected):not(.select2-disabled)")},moveHighlight:function(t){for(var r,u=this.findHighlightableChoices(),i=this.highlight();i>-1&&u.length>i;)if(i+=t,r=n(u[i]),r.hasClass("select2-result-selectable")&&!r.hasClass("select2-disabled")&&!r.hasClass("select2-selected")){this.highlight(i);break}},highlight:function(i){var e,u,r=this.findHighlightableChoices();return 0===arguments.length?f(r.filter(".select2-highlighted")[0],r.get()):(i>=r.length&&(i=r.length-1),0>i&&(i=0),this.results.find(".select2-highlighted").removeClass("select2-highlighted"),e=n(r[i]),e.addClass("select2-highlighted"),this.ensureHighlightVisible(),u=e.data("select2-data"),u&&this.opts.element.trigger({type:"select2-highlight",val:this.id(u),choice:u}),t)},countSelectableResults:function(){return this.findHighlightableChoices().length},highlightUnderEvent:function(t){var i=n(t.target).closest(".select2-result-selectable"),r;i.length>0&&!i.is(".select2-highlighted")?(r=this.findHighlightableChoices(),this.highlight(r.index(i))):0==i.length&&this.results.find(".select2-highlighted").removeClass("select2-highlighted")},loadMoreIfNeeded:function(){var e,i=this.results,t=i.find("li.select2-more-results"),r=this.resultsPage+1,n=this,f=this.search.val(),u=this.context;0!==t.length&&(e=t.offset().top-i.offset().top-i.height(),this.opts.loadMorePadding>=e&&(t.addClass("select2-active"),this.opts.query({element:this.opts.element,term:f,page:r,context:u,matcher:this.opts.matcher,callback:this.bind(function(e){n.opened()&&(n.opts.populateResults.call(this,i,e.results,{term:f,page:r,context:u}),n.postprocessResults(e,!1,!1),e.more===!0?(t.detach().appendTo(i).text(n.opts.formatLoadMore(r+1)),window.setTimeout(function(){n.loadMoreIfNeeded()},10)):t.remove(),n.positionDropdown(),n.resultsPage=r,n.context=e.context)})})))},tokenize:function(){},updateResults:function(i){function v(){h.scrollTop(0),f.removeClass("select2-active"),e.positionDropdown()}function o(n){h.html(n),v()}var a,l,f=this.search,h=this.results,r=this.opts,e=this,p=f.val(),y=n.data(this.container,"select2-last-term"),c;if((i===!0||!y||!u(p,y))&&(n.data(this.container,"select2-last-term",p),i===!0||this.showSearchInput!==!1&&this.opened())){if(c=this.getMaximumSelectionSize(),c>=1&&(a=this.data(),n.isArray(a)&&a.length>=c&&s(r.formatSelectionTooBig,"formatSelectionTooBig")))return o("<li class='select2-selection-limit'>"+r.formatSelectionTooBig(c)+"</li>"),t;if(f.val().length<r.minimumInputLength)return s(r.formatInputTooShort,"formatInputTooShort")?o("<li class='select2-no-results'>"+r.formatInputTooShort(f.val(),r.minimumInputLength)+"</li>"):o(""),i&&this.showSearch(!0),t;if(r.maximumInputLength&&f.val().length>r.maximumInputLength)return s(r.formatInputTooLong,"formatInputTooLong")?o("<li class='select2-no-results'>"+r.formatInputTooLong(f.val(),r.maximumInputLength)+"</li>"):o(""),t;r.formatSearching&&0===this.findHighlightableChoices().length&&o("<li class='select2-searching'>"+r.formatSearching()+"</li>"),f.addClass("select2-active"),l=this.tokenize(),l!=t&&null!=l&&f.val(l),this.resultsPage=1,r.query({element:r.element,term:f.val(),page:this.resultsPage,context:null,matcher:r.matcher,callback:this.bind(function(c){var l;return this.opened()?(this.context=c.context===t?null:c.context,this.opts.createSearchChoice&&""!==f.val()&&(l=this.opts.createSearchChoice.call(null,f.val(),c.results),l!==t&&null!==l&&e.id(l)!==t&&null!==e.id(l)&&0===n(c.results).filter(function(){return u(e.id(this),e.id(l))}).length&&c.results.unshift(l)),0===c.results.length&&s(r.formatNoMatches,"formatNoMatches")?(o("<li class='select2-no-results'>"+r.formatNoMatches(f.val())+"</li>"),t):(h.empty(),e.opts.populateResults.call(this,h,c.results,{term:f.val(),page:this.resultsPage,context:null}),c.more===!0&&s(r.formatLoadMore,"formatLoadMore")&&(h.append("<li class='select2-more-results'>"+e.opts.escapeMarkup(r.formatLoadMore(this.resultsPage))+"</li>"),window.setTimeout(function(){e.loadMoreIfNeeded()},10)),this.postprocessResults(c,i),v(),this.opts.element.trigger({type:"select2-loaded",data:c}),t)):(this.search.removeClass("select2-active"),t)})})}},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(){yt(this.search)},selectHighlighted:function(n){var i=this.highlight(),r=this.results.find(".select2-highlighted"),t=r.closest(".select2-result").data("select2-data");t&&(this.highlight(i),this.onSelect(t,n))},getPlaceholder:function(){return this.opts.element.attr("placeholder")||this.opts.element.attr("data-placeholder")||this.opts.element.data("placeholder")||this.opts.placeholder},initContainerWidth:function(){function r(){var i,f,u,r,e;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(i=this.opts.element.attr("style"),i!==t)for(f=i.split(";"),r=0,e=f.length;e>r;r+=1)if(u=f[r].replace(/\s/g,"").match(/width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/i),null!==u&&u.length>=1)return u[1];return i=this.opts.element.css("width"),i&&i.length>0?i:"resolve"===this.opts.width?0===this.opts.element.outerWidth(!1)?"auto":this.opts.element.outerWidth(!1)+"px":null}return n.isFunction(this.opts.width)?this.opts.width():this.opts.width}var i=r.call(this);null!==i&&this.container.css("width",i)}}),p=a(c,{createContainer:function(){return n(document.createElement("div")).attr({"class":"select2-container"}).html(["<a href='javascript:void(0)' onclick='return false;' class='select2-choice' tabindex='-1'>","   <span>&nbsp;</span><abbr class='select2-search-choice-close'></abbr>","   <div><b></b></div>","</a>","<input class='select2-focusser select2-offscreen' type='text'/>","<div class='select2-drop select2-display-none'>","   <div class='select2-search'>","       <input type='text' autocomplete='off' autocorrect='off' autocapitilize='off' spellcheck='false' class='select2-input'/>","   </div>","   <ul class='select2-results'>","   </ul>","</div>"].join(""))},enableInterface:function(){this.parent.enableInterface.apply(this,arguments)&&this.focusser.prop("disabled",!this.isInterfaceEnabled())},opening:function(){var i,t;this.parent.opening.apply(this,arguments),this.showSearchInput!==!1&&this.search.val(this.focusser.val()),this.search.focus(),i=this.search.get(0),i.createTextRange&&(t=i.createTextRange(),t.collapse(!1),t.select()),this.focusser.prop("disabled",!0).val(""),this.updateResults(!0),this.opts.element.trigger(n.Event("select2-open"))},close:function(){this.opened()&&(this.parent.close.apply(this,arguments),this.focusser.removeAttr("disabled"),this.focusser.focus())},focus:function(){this.opened()?this.close():(this.focusser.removeAttr("disabled"),this.focusser.focus())},isFocused:function(){return this.container.hasClass("select2-container-active")},cancel:function(){this.parent.cancel.apply(this,arguments),this.focusser.removeAttr("disabled"),this.focusser.focus()},initContainer:function(){var u,f=this.container,e=this.dropdown;this.showSearch(!1),this.selection=u=f.find(".select2-choice"),this.focusser=f.find(".select2-focusser"),this.focusser.attr("id","s2id_autogen"+h()),n("label[for='"+this.opts.element.attr("id")+"']").attr("for",this.focusser.attr("id")),this.focusser.attr("tabindex",this.elementTabIndex),this.search.on("keydown",this.bind(function(n){if(this.isInterfaceEnabled()){if(n.which===i.PAGE_UP||n.which===i.PAGE_DOWN)return r(n),t;switch(n.which){case i.UP:case i.DOWN:return this.moveHighlight(n.which===i.UP?-1:1),r(n),t;case i.ENTER:return this.selectHighlighted(),r(n),t;case i.TAB:return this.selectHighlighted({noFocus:!0}),t;case i.ESC:return this.cancel(n),r(n),t}}})),this.search.on("blur",this.bind(function(){document.activeElement===this.body().get(0)&&window.setTimeout(this.bind(function(){this.search.focus()}),0)})),this.focusser.on("keydown",this.bind(function(n){return!this.isInterfaceEnabled()||n.which===i.TAB||i.isControl(n)||i.isFunctionKey(n)||n.which===i.ESC?t:this.opts.openOnEnter===!1&&n.which===i.ENTER?(r(n),t):n.which==i.DOWN||n.which==i.UP||n.which==i.ENTER&&this.opts.openOnEnter?(this.open(),r(n),t):n.which==i.DELETE||n.which==i.BACKSPACE?(this.opts.allowClear&&this.clear(),r(n),t):t})),it(this.focusser),this.focusser.on("keyup-change input",this.bind(function(n){n.stopPropagation(),this.opened()||this.open()})),u.on("mousedown","abbr",this.bind(function(n){this.isInterfaceEnabled()&&(this.clear(),ct(n),this.close(),this.selection.focus())})),u.on("mousedown",this.bind(function(t){this.container.hasClass("select2-container-active")||this.opts.element.trigger(n.Event("select2-focus")),this.opened()?this.close():this.isInterfaceEnabled()&&this.open(),r(t)})),e.on("mousedown",this.bind(function(){this.search.focus()})),u.on("focus",this.bind(function(n){r(n)})),this.focusser.on("focus",this.bind(function(){this.container.hasClass("select2-container-active")||this.opts.element.trigger(n.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(n.Event("select2-blur")))})),this.search.on("focus",this.bind(function(){this.container.hasClass("select2-container-active")||this.opts.element.trigger(n.Event("select2-focus")),this.container.addClass("select2-container-active")})),this.initContainerWidth(),this.opts.element.addClass("select2-offscreen"),this.setPlaceholder()},clear:function(n){var t=this.selection.data("select2-data");t&&(this.opts.element.val(""),this.selection.find("span").empty(),this.selection.removeData("select2-data"),this.setPlaceholder(),n!==!1&&(this.opts.element.trigger({type:"select2-removed",val:this.id(t),choice:t}),this.triggerChange({removed:t})))},initSelection:function(){if(""===this.opts.element.val()&&""===this.opts.element.text())this.updateSelection([]),this.close(),this.setPlaceholder();else{var n=this;this.opts.initSelection.call(null,this.opts.element,function(i){i!==t&&null!==i&&(n.updateSelection(i),n.close(),n.setPlaceholder())})}},prepareOpts:function(){var t=this.parent.prepareOpts.apply(this,arguments),i=this;return"select"===t.element.get(0).tagName.toLowerCase()?t.initSelection=function(n,t){var r=n.find(":selected");t(i.optionToData(r))}:"data"in t&&(t.initSelection=t.initSelection||function(i,r){var e=i.val(),f=null;t.query({matcher:function(n,i,r){var o=u(e,t.id(r));return o&&(f=r),o},callback:n.isFunction(r)?function(){r(f)}:n.noop})}),t},getPlaceholder:function(){return this.select&&""!==this.select.find("option").first().text()?t:this.parent.getPlaceholder.apply(this,arguments)},setPlaceholder:function(){var n=this.getPlaceholder();if(""===this.opts.element.val()&&n!==t){if(this.select&&""!==this.select.find("option:first").text())return;this.selection.find("span").html(this.opts.escapeMarkup(n)),this.selection.addClass("select2-default"),this.container.removeClass("select2-allowclear")}},postprocessResults:function(n,i,r){var e=0,o=this,f;(this.findHighlightableChoices().each2(function(n,i){return u(o.id(i.data("select2-data")),o.opts.element.val())?(e=n,!1):t}),r!==!1&&this.highlight(e),i===!0&&this.showSearchInput===!1)&&(f=this.opts.minimumResultsForSearch,f>=0&&this.showSearch(d(n.results)>=f))},showSearch:function(t){this.showSearchInput=t,this.dropdown.find(".select2-search").toggleClass("select2-search-hidden",!t),this.dropdown.find(".select2-search").toggleClass("select2-offscreen",!t),n(this.dropdown,this.container).toggleClass("select2-with-searchbox",t)},onSelect:function(n,t){if(this.triggerSelect(n)){var r=this.opts.element.val(),i=this.data();this.opts.element.val(this.id(n)),this.updateSelection(n),this.opts.element.trigger({type:"select2-selected",val:this.id(n),choice:n}),this.close(),t&&t.noFocus||this.selection.focus(),u(r,this.id(n))||this.triggerChange({added:n,removed:i})}},updateSelection:function(n){var r,i=this.selection.find("span");this.selection.data("select2-data",n),i.empty(),r=this.opts.formatSelection(n,i),r!==t&&i.append(this.opts.escapeMarkup(r)),this.selection.removeClass("select2-default"),this.opts.allowClear&&this.getPlaceholder()!==t&&this.container.addClass("select2-allowclear")},val:function(){var i,r=!1,u=null,n=this,f=this.data();if(0===arguments.length)return this.opts.element.val();if(i=arguments[0],arguments.length>1&&(r=arguments[1]),this.select)this.select.val(i).find(":selected").each2(function(t,i){return u=n.optionToData(i),!1}),this.updateSelection(u),this.setPlaceholder(),r&&this.triggerChange({added:u,removed:f});else{if(this.opts.initSelection===t)throw Error("cannot call val() if initSelection() is not defined");if(!i&&0!==i)return this.clear(r),t;this.opts.element.val(i),this.opts.initSelection(this.opts.element,function(t){n.opts.element.val(t?n.id(t):""),n.updateSelection(t),n.setPlaceholder(),r&&n.triggerChange({added:t,removed:f})})}},clearSearch:function(){this.search.val(""),this.focusser.val("")},data:function(n,i){var r;return 0===arguments.length?(r=this.selection.data("select2-data"),r==t&&(r=null),r):(n&&""!==n?(r=this.data(),this.opts.element.val(n?this.id(n):""),this.updateSelection(n),i&&this.triggerChange({added:n,removed:r})):this.clear(i),t)}}),w=a(c,{createContainer:function(){return n(document.createElement("div")).attr({"class":"select2-container select2-container-multi"}).html(["    <ul class='select2-choices'>","  <li class='select2-search-field'>","    <input type='text' autocomplete='off' autocorrect='off' autocapitilize='off' spellcheck='false' class='select2-input'>","  </li>","</ul>","<div class='select2-drop select2-drop-multi select2-display-none'>","   <ul class='select2-results'>","   </ul>","</div>"].join(""))},prepareOpts:function(){var t=this.parent.prepareOpts.apply(this,arguments),i=this;return"select"===t.element.get(0).tagName.toLowerCase()?t.initSelection=function(n,t){var r=[];n.find(":selected").each2(function(n,t){r.push(i.optionToData(t))}),t(r)}:"data"in t&&(t.initSelection=t.initSelection||function(i,r){var e=v(i.val(),t.separator),f=[];t.query({matcher:function(i,r,o){var s=n.grep(e,function(n){return u(n,t.id(o))}).length;return s&&f.push(o),s},callback:n.isFunction(r)?function(){for(var h,n,o,s=[],i=0;e.length>i;i++)for(h=e[i],n=0;f.length>n;n++)if(o=f[n],u(h,t.id(o))){s.push(o),f.splice(n,1);break}r(s)}:n.noop})}),t},selectChoice:function(n){var t=this.container.find(".select2-search-choice-focus");t.length&&n&&n[0]==t[0]||(t.length&&this.opts.element.trigger("choice-deselected",t),t.removeClass("select2-search-choice-focus"),n&&n.length&&(this.close(),n.addClass("select2-search-choice-focus"),this.opts.element.trigger("choice-selected",n)))},initContainer:function(){var e,f=".select2-choices",u;this.searchContainer=this.container.find(".select2-search-field"),this.selection=e=this.container.find(f),u=this,this.selection.on("mousedown",".select2-search-choice",function(){u.search[0].focus(),u.selectChoice(n(this))}),this.search.attr("id","s2id_autogen"+h()),n("label[for='"+this.opts.element.attr("id")+"']").attr("for",this.search.attr("id")),this.search.on("input paste",this.bind(function(){this.isInterfaceEnabled()&&(this.opened()||this.open())})),this.search.attr("tabindex",this.elementTabIndex),this.keydowns=0,this.search.on("keydown",this.bind(function(n){var u;if(this.isInterfaceEnabled()){++this.keydowns;var f=e.find(".select2-search-choice-focus"),s=f.prev(".select2-search-choice:not(.select2-locked)"),o=f.next(".select2-search-choice:not(.select2-locked)"),h=pt(this.search);if(f.length&&(n.which==i.LEFT||n.which==i.RIGHT||n.which==i.BACKSPACE||n.which==i.DELETE||n.which==i.ENTER))return u=f,n.which==i.LEFT&&s.length?u=s:n.which==i.RIGHT?u=o.length?o:null:n.which===i.BACKSPACE?(this.unselect(f.first()),this.search.width(10),u=s.length?s:o):n.which==i.DELETE?(this.unselect(f.first()),this.search.width(10),u=o.length?o:null):n.which==i.ENTER&&(u=null),this.selectChoice(u),r(n),u&&u.length||this.open(),t;if((n.which===i.BACKSPACE&&1==this.keydowns||n.which==i.LEFT)&&0==h.offset&&!h.length)return this.selectChoice(e.find(".select2-search-choice:not(.select2-locked)").last()),r(n),t;if(this.selectChoice(null),this.opened())switch(n.which){case i.UP:case i.DOWN:return this.moveHighlight(n.which===i.UP?-1:1),r(n),t;case i.ENTER:return this.selectHighlighted(),r(n),t;case i.TAB:return this.selectHighlighted({noFocus:!0}),t;case i.ESC:return this.cancel(n),r(n),t}if(n.which!==i.TAB&&!i.isControl(n)&&!i.isFunctionKey(n)&&n.which!==i.BACKSPACE&&n.which!==i.ESC){if(n.which===i.ENTER){if(this.opts.openOnEnter===!1)return;if(n.altKey||n.ctrlKey||n.shiftKey||n.metaKey)return}this.open(),(n.which===i.PAGE_UP||n.which===i.PAGE_DOWN)&&r(n),n.which===i.ENTER&&r(n)}}})),this.search.on("keyup",this.bind(function(){this.keydowns=0,this.resizeSearch()})),this.search.on("blur",this.bind(function(t){this.container.removeClass("select2-container-active"),this.search.removeClass("select2-focused"),this.selectChoice(null),this.opened()||this.clearSearch(),t.stopImmediatePropagation(),this.opts.element.trigger(n.Event("select2-blur"))})),this.container.on("mousedown",f,this.bind(function(t){this.isInterfaceEnabled()&&(n(t.target).closest(".select2-search-choice").length>0||(this.selectChoice(null),this.clearPlaceholder(),this.container.hasClass("select2-container-active")||this.opts.element.trigger(n.Event("select2-focus")),this.open(),this.focusSearch(),t.preventDefault()))})),this.container.on("focus",f,this.bind(function(){this.isInterfaceEnabled()&&(this.container.hasClass("select2-container-active")||this.opts.element.trigger(n.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 n=this;this.opts.initSelection.call(null,this.opts.element,function(i){i!==t&&null!==i&&(n.updateSelection(i),n.close(),n.clearSearch())})}},clearSearch:function(){var i=this.getPlaceholder(),n=this.getMaxSearchWidth();i!==t&&0===this.getVal().length&&this.search.hasClass("select2-focused")===!1?(this.search.val(i).addClass("select2-default"),this.search.width(n>0?n: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.updateResults(!0),this.search.focus(),this.opts.element.trigger(n.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(t){var r=[],u=[],i=this;n(t).each(function(){0>f(i.id(this),r)&&(r.push(i.id(this)),u.push(this))}),t=u,this.selection.find(".select2-search-choice").remove(),n(t).each(function(){i.addSelectedChoice(this)}),i.postprocessResults()},tokenize:function(){var n=this.search.val();n=this.opts.tokenizer(n,this.data(),this.bind(this.onSelect),this.opts),null!=n&&n!=t&&(this.search.val(n),n.length>0&&this.open())},onSelect:function(n,t){this.triggerSelect(n)&&(this.addSelectedChoice(n),this.opts.element.trigger({type:"selected",val:this.id(n),choice:n}),(this.select||!this.opts.closeOnSelect)&&this.postprocessResults(),this.opts.closeOnSelect?(this.close(),this.search.width(10)):this.countSelectableResults()>0?(this.search.width(10),this.resizeSearch(),this.getMaximumSelectionSize()>0&&this.val().length>=this.getMaximumSelectionSize()&&this.updateResults(!0),this.positionDropdown()):(this.close(),this.search.width(10)),this.triggerChange({added:n}),t&&t.noFocus||this.focusSearch())},cancel:function(){this.close(),this.focusSearch()},addSelectedChoice:function(i){var f,o=!i.locked,s=n("<li class='select2-search-choice'>    <div></div>    <a href='#' onclick='return false;' class='select2-search-choice-close' tabindex='-1'></a></li>"),c=n("<li class='select2-search-choice select2-locked'><div></div></li>"),u=o?s:c,h=this.id(i),e=this.getVal();f=this.opts.formatSelection(i,u.find("div")),f!=t&&u.find("div").replaceWith("<div title='"+this.opts.escapeMarkup(f)+"'>"+this.opts.escapeMarkup(f)+"</div>"),o&&u.find(".select2-search-choice-close").on("mousedown",r).on("click dblclick",this.bind(function(t){this.isInterfaceEnabled()&&(n(t.target).closest(".select2-search-choice").fadeOut("fast",this.bind(function(){this.unselect(n(t.target)),this.selection.find(".select2-search-choice-focus").removeClass("select2-search-choice-focus"),this.close(),this.focusSearch()})).dequeue(),r(t))})).on("focus",this.bind(function(){this.isInterfaceEnabled()&&(this.container.addClass("select2-container-active"),this.dropdown.addClass("select2-drop-active"))})),u.data("select2-data",i),u.insertBefore(this.searchContainer),e.push(h),this.setVal(e)},unselect:function(n){var t,r,i=this.getVal();if(n=n.closest(".select2-search-choice"),0===n.length)throw"Invalid argument: "+n+". Must be .select2-search-choice";t=n.data("select2-data"),t&&(r=f(this.id(t),i),r>=0&&(i.splice(r,1),this.setVal(i),this.select&&this.postprocessResults()),n.remove(),this.opts.element.trigger({type:"removed",val:this.id(t),choice:t}),this.triggerChange({removed:t}))},postprocessResults:function(n,t,i){var e=this.getVal(),u=this.results.find(".select2-result"),o=this.results.find(".select2-result-with-children"),r=this;u.each2(function(n,t){var i=r.id(t.data("select2-data"));f(i,e)>=0&&(t.addClass("select2-selected"),t.find(".select2-result-selectable").addClass("select2-selected"))}),o.each2(function(n,t){t.is(".select2-result-selectable")||0!==t.find(".select2-result-selectable:not(.select2-selected)").length||t.addClass("select2-selected")}),-1==this.highlight()&&i!==!1&&r.highlight(0),!this.opts.createSearchChoice&&!u.filter(".select2-result:not(.select2-selected)").length>0&&this.results.append("<li class='select2-no-results'>"+r.opts.formatNoMatches(r.search.val())+"</li>")},getMaxSearchWidth:function(){return this.selection.width()-tt(this.search)},resizeSearch:function(){var r,u,t,f,n,i=tt(this.search);r=at(this.search)+10,u=this.search.offset().left,t=this.selection.width(),f=this.selection.offset().left,n=t-(u-f)-i,r>n&&(n=t-i),40>n&&(n=t-i),0>=n&&(n=r),this.search.width(n)},getVal:function(){var n;return this.select?(n=this.select.val(),null===n?[]:n):(n=this.opts.element.val(),v(n,this.opts.separator))},setVal:function(t){var i;this.select?this.select.val(t):(i=[],n(t).each(function(){0>f(this,i)&&i.push(this)}),this.opts.element.val(0===i.length?"":i.join(this.opts.separator)))},buildChangeDetails:function(n,t){for(var i,t=t.slice(0),n=n.slice(0),r=0;t.length>r;r++)for(i=0;n.length>i;i++)u(this.opts.id(t[r]),this.opts.id(n[i]))&&(t.splice(r,1),r--,n.splice(i,1),i--);return{added:t,removed:n}},val:function(i,r){var u,f=this;if(0===arguments.length)return this.getVal();if(u=this.data(),u.length||(u=[]),!i&&0!==i)return this.opts.element.val(""),this.updateSelection([]),this.clearSearch(),r&&this.triggerChange({added:this.data(),removed:u}),t;if(this.setVal(i),this.select)this.opts.initSelection(this.select,this.bind(this.updateSelection)),r&&this.triggerChange(this.buildChangeDetails(u,this.data()));else{if(this.opts.initSelection===t)throw Error("val() cannot be called if initSelection() is not defined");this.opts.initSelection(this.opts.element,function(t){var i=n(t).map(f.id);f.setVal(i),f.updateSelection(t),f.clearSearch(),r&&f.triggerChange(this.buildChangeDetails(u,this.data()))})}this.clearSearch()},onSortStart:function(){if(this.select)throw 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 t=[],i=this;this.searchContainer.show(),this.searchContainer.appendTo(this.searchContainer.parent()),this.resizeSearch(),this.selection.find(".select2-search-choice").each(function(){t.push(i.opts.id(n(this).data("select2-data")))}),this.setVal(t),this.triggerChange()},data:function(i,r){var f,u,e=this;return 0===arguments.length?this.selection.find(".select2-search-choice").map(function(){return n(this).data("select2-data")}).get():(u=this.data(),i||(i=[]),f=n.map(i,function(n){return e.opts.id(n)}),this.setVal(f),this.updateSelection(i),this.clearSearch(),r&&this.triggerChange(this.buildChangeDetails(u,this.data())),t)}}),n.fn.select2=function(){var r,u,o,e,i=Array.prototype.slice.call(arguments,0),h=["val","destroy","opened","open","close","focus","isFocused","container","onSortStart","onSortEnd","enable","readonly","positionDropdown","data"],s=["val","opened","isFocused","container","data"];return this.each(function(){if(0===i.length||"object"==typeof i[0])r=0===i.length?{}:n.extend({},i[0]),r.element=n(this),"select"===r.element.get(0).tagName.toLowerCase()?e=r.element.prop("multiple"):(e=r.multiple||!1,"tags"in r&&(r.multiple=e=!0)),u=e?new w:new p,u.init(r);else{if("string"!=typeof i[0])throw"Invalid arguments to select2 plugin: "+i;if(0>f(i[0],h))throw"Unknown method: "+i[0];if(o=t,u=n(this).data("select2"),u===t)return;if(o="container"===i[0]?u.container:u[i[0]].apply(u,i.slice(1)),f(i[0],s)>=0)return!1}}),o===t?this:o},n.fn.select2.defaults={width:"copy",loadMorePadding:0,closeOnSelect:!0,openOnEnter:!0,containerCss:{},dropdownCss:{},containerCssClass:"",dropdownCssClass:"",formatResult:function(n,t,i,r){var u=[];return ut(n.text,i.term,u,r),u.join("")},formatSelection:function(n){return n?n.text:t},sortResults:function(n){return n},formatResultCssClass:function(){return t},formatNoMatches:function(){return"No matches found"},formatInputTooShort:function(n,t){var i=t-n.length;return"Please enter "+i+" more character"+(1==i?"":"s")},formatInputTooLong:function(n,t){var i=n.length-t;return"Please delete "+i+" character"+(1==i?"":"s")},formatSelectionTooBig:function(n){return"You can only select "+n+" item"+(1==n?"":"s")},formatLoadMore:function(){return"Loading more results..."},formatSearching:function(){return"Searching..."},minimumResultsForSearch:0,minimumInputLength:0,maximumInputLength:null,maximumSelectionSize:0,id:function(n){return n.id},matcher:function(n,t){return(""+t).toUpperCase().indexOf((""+n).toUpperCase())>=0},separator:",",tokenSeparators:[],tokenizer:lt,escapeMarkup:function(n){var t={"\\":"&#92;","&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;","/":"&#47;"};return(n+"").replace(/[&<>"'\/\\]/g,function(n){return t[n]})},blurOnChange:!1,selectOnBlur:!1,adaptContainerCssClass:function(n){return n},adaptDropdownCssClass:function(){return null}},n.fn.select2.ajaxDefaults={transport:n.ajax,params:{type:"GET",cache:!1,dataType:"json"}},window.Select2={query:{ajax:ft,local:rt,tags:b},util:{debounce:nt,markMatch:ut},"class":{abstract:c,single:p,multi:w}}}}(jQuery)