From ffa6d2ad71176854e136ac76eff154a585aa5a55 Mon Sep 17 00:00:00 2001 From: Sarah Khazma Date: Mon, 3 Mar 2025 11:31:56 +0000 Subject: [PATCH 1/2] 41859 update select2 when there is a legend but no label --- dist/js/select2.full.js | 38 +++++++++++++++++++++----------- dist/js/select2.full.min.js | 2 +- dist/js/select2.js | 38 +++++++++++++++++++++----------- dist/js/select2.min.js | 2 +- src/js/select2/selection/base.js | 37 ++++++++++++++++++++----------- 5 files changed, 76 insertions(+), 41 deletions(-) diff --git a/dist/js/select2.full.js b/dist/js/select2.full.js index b4ecfe871..6bc3597e6 100644 --- a/dist/js/select2.full.js +++ b/dist/js/select2.full.js @@ -1504,29 +1504,41 @@ S2.define('select2/selection/base',[ container.on('selection:update', function (params) { self.update(params.data); self.$selection.attr('aria-label', params.data.resultsId); - var $label = $('label[for="' + this.$element.attr('id') + '"]').text(); - var $labeltext; + var label = $('label[for="' + this.$element.attr('id') + '"]').text(); + var labeltext; + var legendtext; + console.log(this.$element, $(container), this.$element); + if ($(this.$element).parents('.search-filter-group')){ + legendtext= $(this.$element).parents('.search-filter-group').find('.search-filter-title').text(); + console.log(legendtext); + } var $rendered = self.$selection.find('.select2-selection__rendered'); - var $title = $rendered.attr('title'); + var title = $rendered.attr('title'); // this is here to prevent the aria-label breaking // for the dropdown within the advanced search // which currently has to be left enabled // even if all other select2s are hidden - if ($title && $title == 'Click here to select criteria' ) - {$title = undefined; } - if ($label && $title) { - $labeltext = $label + 'The selected value is:' + $title; + if (title && title == 'Click here to select criteria' ) + {title = undefined; } + if (label && title) { + console.log('lbltitle', label); + labeltext = label + ' The selected value is:' + title; + } + else if (label && !title) { + labeltext = label + 'No value currently selected.'; } - else if ($label && !$title) { - $labeltext = $label + 'No value currently selected.'; + else if (legendtext) { + console.log('lgnd', legendtext); + labeltext = 'Show more for category ' + legendtext; } - else if ($title && !$label) { - $labeltext = 'The selected value is: ' + $title; + else if (title && !label) { + labeltext = 'The selected value is: ' + title; } else { - $labeltext = $label + 'No value currently selected.'; + labeltext = label + 'No value currently selected.'; } - self.$selection.attr('aria-label', $labeltext); + console.log('label text', labeltext, label); + self.$selection.attr('aria-label', labeltext); }); container.on('open', function () { diff --git a/dist/js/select2.full.min.js b/dist/js/select2.full.min.js index dd2c4df07..aefe9f646 100644 --- a/dist/js/select2.full.min.js +++ b/dist/js/select2.full.min.js @@ -1,2 +1,2 @@ /*! Select2 4.1.0-rc.0 | https://github.com/select2/select2/blob/master/LICENSE.md */ -!function(n){"function"==typeof define&&define.amd?define(["jquery"],n):"object"==typeof module&&module.exports?module.exports=function(e,t){return void 0===t&&(t="undefined"!=typeof window?require("jquery"):require("jquery")(e)),n(t),t}:n(jQuery)}(function(t){(u=t&&t.fn&&t.fn.select2&&t.fn.select2.amd?t.fn.select2.amd:u)&&u.requirejs||(u?e=u:u={},g={},m={},y={},v={},n=Object.prototype.hasOwnProperty,i=[].slice,_=/\.js$/,h=function(e,t){var n,i,s=c(e),o=s[0],t=t[1];return e=s[1],o&&(n=x(o=l(o,t))),o?e=n&&n.normalize?n.normalize(e,(i=t,function(e){return l(e,i)})):l(e,t):(o=(s=c(e=l(e,t)))[0],e=s[1],o&&(n=x(o))),{f:o?o+"!"+e:e,n:e,pr:o,p:n}},f={require:function(e){return w(e)},exports:function(e){var t=g[e];return void 0!==t?t:g[e]={}},module:function(e){return{id:e,uri:"",exports:g[e],config:(t=e,function(){return y&&y.config&&y.config[t]||{}})};var t}},o=function(e,t,n,i){var s,o,r,a,l,c=[],u=typeof n,d=A(i=i||e);if("undefined"==u||"function"==u){for(t=!t.length&&n.length?["require","exports","module"]:t,a=0;a":">",'"':""","'":"'","/":"/"};return"string"!=typeof e?e:String(e).replace(/[&<>"'\/\\]/g,function(e){return t[e]})},i.__cache={};var n=0;return i.GetUniqueElementId=function(e){var t=e.getAttribute("data-select2-id");return null==t&&(t=e.id?"select2-data-"+e.id:"select2-data-"+(++n).toString()+"-"+i.generateChars(4),e.setAttribute("data-select2-id",t)),t},i.StoreData=function(e,t,n){e=i.GetUniqueElementId(e);i.__cache[e]||(i.__cache[e]={}),i.__cache[e][t]=n},i.GetData=function(e,t){var n=i.GetUniqueElementId(e);return t?i.__cache[n]&&null!=i.__cache[n][t]?i.__cache[n][t]:o(e).data(t):i.__cache[n]},i.RemoveData=function(e){var t=i.GetUniqueElementId(e);null!=i.__cache[t]&&delete i.__cache[t],e.removeAttribute("data-select2-id")},i.copyNonInternalCssClasses=function(e,t){var n=(n=e.getAttribute("class").trim().split(/\s+/)).filter(function(e){return 0===e.indexOf("select2-")}),t=(t=t.getAttribute("class").trim().split(/\s+/)).filter(function(e){return 0!==e.indexOf("select2-")}),n=n.concat(t);e.setAttribute("class",n.join(" "))},i}),u.define("select2/results",["jquery","./utils"],function(u,d){function i(e,t,n){this.$element=e,this.data=n,this.options=t,i.__super__.constructor.call(this)}return d.Extend(i,d.Observable),i.prototype.render=function(){var t=u('');return t.on("mouseup",function(e){u.contains(t[0],u(e.target).closest("li")[0])||e.stopPropagation()}),this.options.get("multiple")&&t.attr("aria-multiselectable","true"),this.$results=t},i.prototype.clear=function(){this.$results.empty()},i.prototype.displayMessage=function(e){var t=this.options.get("escapeMarkup"),n=(this.clear(),this.hideLoading(),u('')),i=this.options.get("translations").get(e.message);n.append(t(i(e.args))),n[0].className+=" select2-results__message",this.$results.append(n)},i.prototype.hideMessages=function(){this.$results.find(".select2-results__message").remove()},i.prototype.append=function(e){this.hideLoading();var t=[];if(null==e.results||0===e.results.length)0===this.$results.children().length&&this.trigger("results:message",{message:"noResults"});else{e.results=this.sort(e.results);for(var n=0;n",{class:"select2-results__options select2-results__options--nested",role:"none"});c.append(r),s.append(o),s.append(c)}else this.template(e,n);return d.StoreData(n,"data",e),n},i.prototype.bind=function(t,e){var s=this,n=t.id+"-results";this.$results.attr("id",n),t.on("results:all",function(e){s.clear(),s.append(e.data),t.isOpen()&&(s.setClasses(),s.highlightFirstItem())}),t.on("results:append",function(e){s.append(e.data),t.isOpen()&&s.setClasses()}),t.on("query",function(e){s.hideMessages(),s.showLoading(e)}),t.on("select",function(){t.isOpen()&&(s.setClasses(),s.options.get("scrollAfterSelect"))&&s.highlightFirstItem()}),t.on("unselect",function(){t.isOpen()&&(s.setClasses(),s.options.get("scrollAfterSelect"))&&s.highlightFirstItem()}),t.on("open",function(){s.$results.attr("aria-expanded","true"),s.$results.attr("aria-hidden","false"),s.setClasses(),s.ensureHighlightVisible()}),t.on("close",function(){s.$results.attr("aria-expanded","false"),s.$results.attr("aria-hidden","true"),s.$results[0].removeAttribute("aria-activedescendant")}),t.on("results:toggle",function(){var e=s.getHighlightedResults();0!==e.length&&e.trigger("mouseup")}),t.on("results:select",function(){var e,t=s.getHighlightedResults();0!==t.length&&(e=d.GetData(t[0],"data"),t.hasClass("select2-results__option--selected")?s.trigger("close",{}):s.trigger("select",{data:e}))}),t.on("results:previous",function(){var e,t=s.getHighlightedResults(),n=s.$results.find(".select2-results__option--selectable"),i=n.index(t);i<=0||(i=i-1,0===t.length&&(i=0),(t=n.eq(i)).trigger("mouseenter"),n=s.$results.offset().top,t=t.offset().top,e=s.$results.scrollTop()+(t-n),0===i?s.$results.scrollTop(0):t-n<0&&s.$results.scrollTop(e))}),t.on("results:next",function(){var e,t,n=s.getHighlightedResults(),i=s.$results.find(".select2-results__option--selectable"),n=i.index(n)+1;n>=i.length||((i=i.eq(n)).trigger("mouseenter"),e=s.$results.offset().top+s.$results.outerHeight(!1),i=i.offset().top+i.outerHeight(!1),t=s.$results.scrollTop()+i-e,0===n?s.$results.scrollTop(0):ethis.$results.outerHeight()||i<0)&&this.$results.scrollTop(n))},i.prototype.template=function(e,t){var n=this.options.get("templateResult"),i=this.options.get("escapeMarkup"),n=n(e,t);null==n?t.style.display="none":"string"==typeof n?t.innerHTML=i(n):u(t).append(n)},i}),u.define("select2/keys",[],function(){return{BACKSPACE:8,TAB:9,ENTER:13,SHIFT:16,CTRL:17,ALT:18,ESC:27,SPACE:32,PAGE_UP:33,PAGE_DOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,DELETE:46}}),u.define("select2/selection/base",["jquery","../utils","../keys"],function(o,n,r){function i(e,t){this.$element=e,this.options=t,i.__super__.constructor.call(this)}return n.Extend(i,n.Observable),i.prototype.render=function(){var e=o('');return this._tabindex=0,null!=n.GetData(this.$element[0],"old-tabindex")?this._tabindex=n.GetData(this.$element[0],"old-tabindex"):null!=this.$element.attr("tabindex")&&(this._tabindex=this.$element.attr("tabindex")),e.attr("title",this.$element.attr("title")),e.attr("tabindex",this._tabindex),e.attr("aria-disabled","false"),this.$selection=e},i.prototype.bind=function(e,t){var n=this,i=o('This button opens a select. When results are available,use up and down arrows to navigate and enter to select '),i=(this.$selection.after(i),"sr-description"+e.id),s=(this.$selection.attr("aria-describedby",i),e.id+"-results");this.container=e,this.$selection.on("focus",function(e){n.trigger("focus",e)}),this.$selection.on("blur",function(e){n._handleBlur(e)}),this.$selection.on("keydown",function(e){n.trigger("keypress",e),e.which===r.SPACE&&e.preventDefault()}),e.on("results:focus",function(e){n.$selection.attr("aria-activedescendant",e.data._resultId)}),e.on("selection:update",function(e){n.update(e.data),n.$selection.attr("aria-label",e.data.resultsId);var e=o('label[for="'+this.$element.attr("id")+'"]').text(),t=n.$selection.find(".select2-selection__rendered").attr("title");t&&"Click here to select criteria"==t&&(t=void 0),n.$selection.attr("aria-label",e&&t?e+"The selected value is:"+t:(!e||t)&&t&&!e?"The selected value is: "+t:e+"No value currently selected.")}),e.on("open",function(){n.$selection.attr("aria-expanded","true"),n.$selection.attr("aria-owns",s),n._attachCloseHandler(e)}),e.on("close",function(){n.$selection.attr("aria-expanded","false"),n.$selection[0].removeAttribute("aria-activedescendant"),n.$selection[0].removeAttribute("aria-owns"),n.$selection.trigger("focus"),n._detachCloseHandler(e)}),e.on("enable",function(){n.$selection.attr("tabindex",n._tabindex),n.$selection.attr("aria-disabled","false")}),e.on("disable",function(){n.$selection.attr("tabindex","-1"),n.$selection.attr("aria-disabled","true")})},i.prototype._handleBlur=function(e){var t=this;window.setTimeout(function(){document.activeElement==t.$selection[0]||o.contains(t.$selection[0],document.activeElement)||t.trigger("blur",e)},1)},i.prototype._attachCloseHandler=function(e){o(document.body).on("mouseup.select2."+e.id,function(e){var t=o(e.target).closest(".select2");o(".select2.select2-container--open").each(function(){this!=t[0]&&n.GetData(this,"element").select2("close")})})},i.prototype._detachCloseHandler=function(e){o(document.body).off("mouseup.select2."+e.id)},i.prototype.position=function(e,t){t.find(".selection").append(e)},i.prototype.destroy=function(){this._detachCloseHandler(this.container)},i.prototype.update=function(e){throw new Error("The `update` method must be defined in child classes.")},i.prototype.isEnabled=function(){return!this.isDisabled()},i.prototype.isDisabled=function(){return this.options.get("disabled")},i}),u.define("select2/selection/single",["jquery","./base","../utils","../keys"],function(s,e,t,n){function o(){o.__super__.constructor.apply(this,arguments)}return t.Extend(o,e),o.prototype.render=function(){var e=o.__super__.render.call(this);return e[0].classList.add("select2-selection--single"),e.html(''),e},o.prototype.bind=function(t,e){var n=this,i=(o.__super__.bind.apply(this,arguments),t.id+"-container");this.$selection.find(".select2-selection__rendered").attr("id",i),this.$selection.attr("aria-controls",i),this.$selection.on("mouseup",function(e){1===e.which&&n.trigger("toggle",{originalEvent:e})}),this.$selection.on("focus",function(e){}),this.$selection.on("blur",function(e){}),t&&"1"==this.options.get("hideAccessibly")&&s(e).addClass("hide"),t.on("focus",function(e){t.isOpen()||n.$selection.trigger("focus")})},o.prototype.clear=function(){var e=this.$selection.find(".select2-selection__rendered");e.empty(),e[0].removeAttribute("title")},o.prototype.display=function(e,t){var n=this.options.get("templateSelection");return this.options.get("escapeMarkup")(n(e,t))},o.prototype.selectionContainer=function(){return s("")},o.prototype.update=function(e){var t,n;0===e.length?this.clear():(e=e[0],t=this.$selection.find(".select2-selection__rendered"),n=this.display(e,t),t.empty().append(n),(n=e.title||e.text)?t.attr("title",n):t[0].removeAttribute("title"))},o}),u.define("select2/selection/multiple",["jquery","./base","../utils"],function(s,e,p){function o(e,t){o.__super__.constructor.apply(this,arguments)}return p.Extend(o,e),o.prototype.render=function(){var e=o.__super__.render.call(this);return e[0].classList.add("select2-selection--multiple"),e.html('
    '),e},o.prototype.bind=function(e,t){var n=this,i=(o.__super__.bind.apply(this,arguments),e.id+"-container");this.$selection.attr("role","combobox"),this.$selection.siblings("#sr-description"+e.id).text("This is a multi-select.Press enter or begin typing to reveal results.Use arrow key to select resultsUse backspace from the text input to delete existing selected results."),this.$selection.find(".select2-selection__rendered").attr("id",i),this.$selection.on("click",function(e){n.trigger("toggle",{originalEvent:e})}),this.$selection.on("click",".select2-selection__choice__remove",function(e){var t;n.isDisabled()||(t=s(this).parent(),t=p.GetData(t[0],"data"),n.trigger("unselect",{originalEvent:e,data:t}))}),this.$selection.on("keydown",".select2-selection__choice__remove",function(e){n.isDisabled()||e.stopPropagation()})},o.prototype.clear=function(){var e=this.$selection.find(".select2-selection__rendered");e.empty(),e.removeAttr("title")},o.prototype.display=function(e,t){var n=this.options.get("templateSelection");return this.options.get("escapeMarkup")(n(e,t))},o.prototype.selectionContainer=function(){return s('
  • ')},o.prototype.update=function(e){if(this.clear(),0!==e.length){for(var t=[],n=[],i=this.$selection.find(".select2-selection__rendered").attr("id")+"-choice-",s=0;s')).attr("title",n()),i.attr("aria-label",n()),i.attr("aria-describedby",e),a.StoreData(i[0],"data",t),this.$selection.prepend(i),this.$selection[0].classList.add("select2-selection--clearable"))},e}),u.define("select2/selection/search",["jquery","../utils","../keys"],function(i,a,l){function e(e,t,n){e.call(this,t,n)}return e.prototype.render=function(e){var t=this.options.get("translations").get("search"),n=i(''),n=(this.$searchContainer=n,this.$search=n.find("textarea"),this.$search.prop("autocomplete",this.options.get("autocomplete")),this.$search.attr("aria-label",t()),e.call(this));return this._transferTabIndex(),n.append(this.$searchContainer),n},e.prototype.bind=function(e,t,n){var i=this,s=t.id+"-results",o=t.id+"-container",e=(e.call(this,t,n),i.$search.attr("aria-describedby",o),t.on("open",function(){i.$search.attr("aria-controls",s),i.$search.trigger("focus")}),t.on("close",function(){i.$search.val(""),i.resizeSearch(),i.$search[0].removeAttribute("aria-controls"),i.$search[0].removeAttribute("aria-activedescendant"),i.$search.trigger("focus")}),t.on("enable",function(){i.$search.prop("disabled",!1),i._transferTabIndex()}),t.on("disable",function(){i.$search.prop("disabled",!0)}),t.on("focus",function(e){i.$search.trigger("focus")}),t.on("results:focus",function(e){e.data._resultId?i.$search.attr("aria-activedescendant",e.data._resultId):i.$search[0].removeAttribute("aria-activedescendant")}),this.$selection.on("focusin",".select2-search--inline",function(e){i.trigger("focus",e)}),this.$selection.on("focusout",".select2-search--inline",function(e){i._handleBlur(e)}),this.$selection.on("keydown",".select2-search--inline",function(e){var t;e.stopPropagation(),i.trigger("keypress",e),i._keyUpPrevented=e.isDefaultPrevented(),e.which===l.BACKSPACE&&""===i.$search.val()&&0<(t=i.$selection.find(".select2-selection__choice").last()).length&&(t=a.GetData(t[0],"data"),i.searchRemoveChoice(t),e.preventDefault())}),this.$selection.on("click",".select2-search--inline",function(e){i.$search.val()&&e.stopPropagation()}),document.documentMode),r=e&&e<=11;this.$selection.on("input.searchcheck",".select2-search--inline",function(e){r?i.$selection.off("input.search input.searchcheck"):i.$selection.off("keyup.search")}),this.$selection.on("keyup.search input.search",".select2-search--inline",function(e){var t;r&&"input"===e.type?i.$selection.off("input.search input.searchcheck"):(t=e.which)!=l.SHIFT&&t!=l.CTRL&&t!=l.ALT&&t!=l.TAB&&i.handleSearch(e)})},e.prototype._transferTabIndex=function(e){this.$search.attr("tabindex",this.$selection.attr("tabindex")),this.$selection.attr("tabindex","-1")},e.prototype.createPlaceholder=function(e,t){this.$search.attr("placeholder",t.text)},e.prototype.update=function(e,t){var n=this.$search[0]==document.activeElement;this.$search.attr("placeholder",""),e.call(this,t),this.resizeSearch(),n&&this.$search.trigger("focus")},e.prototype.handleSearch=function(){var e;this.resizeSearch(),this._keyUpPrevented||(e=this.$search.val(),this.trigger("query",{term:e})),this._keyUpPrevented=!1},e.prototype.searchRemoveChoice=function(e,t){this.trigger("unselect",{data:t}),this.$search.val(t.text),this.handleSearch()},e.prototype.resizeSearch=function(){this.$search.css("width","25px");var e="100%";""===this.$search.attr("placeholder")&&(e=.75*(this.$search.val().length+1)+"em"),this.$search.css("width",e)},e}),u.define("select2/selection/selectionCss",["../utils"],function(n){function e(){}return e.prototype.render=function(e){var t=e.call(this),e=this.options.get("selectionCssClass")||"";return-1!==e.indexOf(":all:")&&(e=e.replace(":all:",""),n.copyNonInternalCssClasses(t[0],this.$element[0])),e.trim().split(" ").forEach(function(e){0this.maximumInputLength?this.trigger("results:message",{message:"inputTooLong",args:{maximum:this.maximumInputLength,input:t.term,params:t}}):e.call(this,t,n)},e}),u.define("select2/data/maximumSelectionLength",[],function(){function e(e,t,n){this.maximumSelectionLength=n.get("maximumSelectionLength"),e.call(this,t,n)}return e.prototype.bind=function(e,t,n){var i=this;e.call(this,t,n),t.on("select",function(){i._checkIfMaximumSelected()})},e.prototype.query=function(e,t,n){var i=this;this._checkIfMaximumSelected(function(){e.call(i,t,n)})},e.prototype._checkIfMaximumSelected=function(e,t){var n=this;this.current(function(e){e=null!=e?e.length:0;0=n.maximumSelectionLength?n.trigger("results:message",{message:"maximumSelected",args:{maximum:n.maximumSelectionLength}}):t&&t()})},e}),u.define("select2/dropdown",["jquery","./utils"],function(t,e){function n(e,t){this.$element=e,this.options=t,n.__super__.constructor.call(this)}return e.Extend(n,e.Observable),n.prototype.render=function(){var e=t('');return e.attr("dir",this.options.get("dir")),this.$dropdown=e},n.prototype.bind=function(){},n.prototype.position=function(e,t){},n.prototype.destroy=function(){this.$dropdown.remove()},n}),u.define("select2/dropdown/search",["jquery"],function(o){function e(){}return e.prototype.render=function(e){var e=e.call(this),t=this.options.get("translations").get("search"),n=o('');return this.$searchContainer=n,this.$search=n.find("input"),this.$search.prop("autocomplete",this.options.get("autocomplete")),this.$search.attr("aria-label",t()),e.prepend(n),e},e.prototype.bind=function(e,t,n){var i=this,s=t.id+"-results";e.call(this,t,n),this.$search.on("keydown",function(e){i.trigger("keypress",e),i._keyUpPrevented=e.isDefaultPrevented()}),this.$search.on("input",function(e){o(this).off("keyup")}),this.$search.on("keyup input",function(e){i.handleSearch(e)}),t.on("open",function(){i.$search.attr("tabindex",0),i.$search.attr("aria-controls",s),window.setTimeout(function(){i.$search.trigger("focus")},0)}),t.on("close",function(){i.$search.attr("tabindex",-1),i.$search[0].removeAttribute("aria-controls"),i.$search[0].removeAttribute("aria-activedescendant"),i.$search.val(""),i.$search.trigger("blur")}),t.on("results:all",function(e){null!=e.query.term&&""!==e.query.term||(i.showSearch(e)?i.$searchContainer[0].classList.remove("select2-search--hide"):i.$searchContainer[0].classList.add("select2-search--hide"))}),t.on("results:focus",function(e){e.data._resultId?i.$search.attr("aria-activedescendant",e.data._resultId):i.$search[0].removeAttribute("aria-activedescendant")})},e.prototype.handleSearch=function(e){var t;this._keyUpPrevented||(t=this.$search.val(),this.trigger("query",{term:t})),this._keyUpPrevented=!1},e.prototype.showSearch=function(e,t){return!0},e}),u.define("select2/dropdown/hidePlaceholder",[],function(){function e(e,t,n,i){this.placeholder=this.normalizePlaceholder(n.get("placeholder")),e.call(this,t,n,i)}return e.prototype.append=function(e,t){t.results=this.removePlaceholder(t.results),e.call(this,t)},e.prototype.normalizePlaceholder=function(e,t){return t="string"==typeof t?{id:"",text:t}:t},e.prototype.removePlaceholder=function(e,t){for(var n=t.slice(0),i=t.length-1;0<=i;i--){var s=t[i];this.placeholder.id===s.id&&n.splice(i,1)}return n},e}),u.define("select2/dropdown/infiniteScroll",["jquery"],function(n){function e(e,t,n,i){this.lastParams={},e.call(this,t,n,i),this.$loadingMore=this.createLoadingMore(),this.loading=!1}return e.prototype.append=function(e,t){this.$loadingMore.remove(),this.loading=!1,e.call(this,t),this.showLoadingMore(t)&&(this.$results.append(this.$loadingMore),this.loadMoreIfNeeded())},e.prototype.bind=function(e,t,n){var i=this;e.call(this,t,n),t.on("query",function(e){i.lastParams=e,i.loading=!0}),t.on("query:append",function(e){i.lastParams=e,i.loading=!0}),this.$results.on("scroll",this.loadMoreIfNeeded.bind(this))},e.prototype.loadMoreIfNeeded=function(){var e=n.contains(document.documentElement,this.$loadingMore[0]);!this.loading&&e&&(e=this.$results.offset().top+this.$results.outerHeight(!1),this.$loadingMore.offset().top+this.$loadingMore.outerHeight(!1)<=e+50)&&this.loadMore()},e.prototype.loadMore=function(){this.loading=!0;var e=n.extend({},{page:1},this.lastParams);e.page++,this.trigger("query:append",e)},e.prototype.showLoadingMore=function(e,t){return t.pagination&&t.pagination.more},e.prototype.createLoadingMore=function(){var e=n('
  • '),t=this.options.get("translations").get("loadingMore");return e.html(t(this.lastParams)),e},e}),u.define("select2/dropdown/attachBody",["jquery","../utils"],function(u,r){function e(e,t,n){this.$dropdownParent=u(n.get("dropdownParent")||document.body),e.call(this,t,n)}return e.prototype.bind=function(e,t,n){var i=this;e.call(this,t,n),t.on("open",function(){i._showDropdown(),i._attachPositioningHandler(t),i._bindContainerResultHandlers(t)}),t.on("close",function(){i._hideDropdown(),i._detachPositioningHandler(t)}),this.$dropdownContainer.on("mouseup",function(e){e.stopPropagation()})},e.prototype.destroy=function(e){e.call(this),this.$dropdownContainer.remove()},e.prototype.position=function(e,t,n){t.attr("class",n.attr("class")),t[0].classList.remove("select2"),t[0].classList.add("select2-container--open"),t.css({position:"absolute",top:-999999}),this.$container=n},e.prototype.render=function(e){var t=u(""),e=e.call(this);return t.append(e),this.$dropdownContainer=t},e.prototype._hideDropdown=function(e){this.$dropdownContainer.detach()},e.prototype._bindContainerResultHandlers=function(e,t){var n;this._containerResultsHandlersBound||(n=this,t.on("results:all",function(){n._positionDropdown(),n._resizeDropdown()}),t.on("results:append",function(){n._positionDropdown(),n._resizeDropdown()}),t.on("results:message",function(){n._positionDropdown(),n._resizeDropdown()}),t.on("select",function(){n._positionDropdown(),n._resizeDropdown()}),t.on("unselect",function(){n._positionDropdown(),n._resizeDropdown()}),this._containerResultsHandlersBound=!0)},e.prototype._attachPositioningHandler=function(e,t){var n=this,i="scroll.select2."+t.id,s="resize.select2."+t.id,t="orientationchange.select2."+t.id,o=this.$container.parents().filter(r.hasScroll);o.each(function(){r.StoreData(this,"select2-scroll-position",{x:u(this).scrollLeft(),y:u(this).scrollTop()})}),o.on(i,function(e){var t=r.GetData(this,"select2-scroll-position");u(this).scrollTop(t.y)}),u(window).on(i+" "+s+" "+t,function(e){n._positionDropdown(),n._resizeDropdown()})},e.prototype._detachPositioningHandler=function(e,t){var n="scroll.select2."+t.id,i="resize.select2."+t.id,t="orientationchange.select2."+t.id;this.$container.parents().filter(r.hasScroll).off(n),u(window).off(n+" "+i+" "+t)},e.prototype._positionDropdown=function(){var e=u(window),t=this.$dropdown[0].classList.contains("select2-dropdown--above"),n=this.$dropdown[0].classList.contains("select2-dropdown--below"),i=null,s=this.$container.offset(),o=(s.bottom=s.top+this.$container.outerHeight(!1),{height:this.$container.outerHeight(!1)});o.top=s.top,o.bottom=s.top+o.height;var r=this.$dropdown.outerHeight(!1),a=e.scrollTop(),e=e.scrollTop()+e.height(),a=as.bottom+r,s={left:s.left,top:o.bottom},l=this.$dropdownParent,c=("static"===l.css("position")&&(l=l.offsetParent()),{top:0,left:0});(u.contains(document.body,l[0])||l[0].isConnected)&&(c=l.offset()),s.top-=c.top,s.left-=c.left,t||n||(i="below"),e||!a||t?!a&&e&&t&&(i="below"):i="above",("above"==i||t&&"below"!==i)&&(s.top=o.top-c.top-r),null!=i&&(this.$dropdown[0].classList.remove("select2-dropdown--below"),this.$dropdown[0].classList.remove("select2-dropdown--above"),this.$dropdown[0].classList.add("select2-dropdown--"+i),this.$container[0].classList.remove("select2-container--below"),this.$container[0].classList.remove("select2-container--above"),this.$container[0].classList.add("select2-container--"+i)),this.$dropdownContainer.css(s)},e.prototype._resizeDropdown=function(){var e={width:this.$container.outerWidth(!1)+"px"};this.options.get("dropdownAutoWidth")&&(e.minWidth=e.width,e.position="relative",e.width="auto"),this.$dropdown.css(e)},e.prototype._showDropdown=function(e){this.$dropdownContainer.appendTo(this.$dropdownParent),this._positionDropdown(),this._resizeDropdown()},e}),u.define("select2/dropdown/minimumResultsForSearch",[],function(){function e(e,t,n,i){this.minimumResultsForSearch=n.get("minimumResultsForSearch"),this.minimumResultsForSearch<0&&(this.minimumResultsForSearch=1/0),e.call(this,t,n,i)}return e.prototype.showSearch=function(e,t){return!(function e(t){for(var n=0,i=0;i');return e.attr("dir",this.options.get("dir")),this.$container=e,this.$container[0].classList.add("select2-container--"+this.options.get("theme")),r.StoreData(e[0],"element",this.$element),e},a}),u.define("select2/dropdown/attachContainer",[],function(){function e(e,t,n){e.call(this,t,n)}return e.prototype.position=function(e,t,n){n.find(".dropdown-wrapper").append(t),t[0].classList.add("select2-dropdown--below"),n[0].classList.add("select2-container--below")},e}),u.define("select2/dropdown/stopPropagation",[],function(){function e(){}return e.prototype.bind=function(e,t,n){e.call(this,t,n);this.$dropdown.on(["blur","change","click","dblclick","focus","focusin","focusout","input","keydown","keyup","keypress","mouseup","mouseenter","mouseleave","mousemove","mouseover","mouseup","search","touchend","touchstart"].join(" "),function(e){e.stopPropagation()})},e}),u.define("select2/selection/stopPropagation",[],function(){function e(){}return e.prototype.bind=function(e,t,n){e.call(this,t,n);this.$selection.on(["blur","change","click","dblclick","focus","focusin","focusout","input","keydown","keyup","keypress","mousedown","mouseenter","mouseleave","mousemove","mouseover","mouseup","search","touchend","touchstart"].join(" "),function(e){e.stopPropagation()})},e}),s=function(c){var u,d,e=["wheel","mousewheel","DOMMouseScroll","MozMousePixelScroll"],t="onwheel"in document||9<=document.documentMode?["wheel"]:["mousewheel","DomMouseScroll","MozMousePixelScroll"],p=Array.prototype.slice;if(c.event.fixHooks)for(var n=e.length;n;)c.event.fixHooks[e[--n]]=c.event.mouseHooks;var h=c.event.special.mousewheel={version:"3.1.12",setup:function(){if(this.addEventListener)for(var e=t.length;e;)this.addEventListener(t[--e],i,!1);else this.onmousewheel=i;c.data(this,"mousewheel-line-height",h.getLineHeight(this)),c.data(this,"mousewheel-page-height",h.getPageHeight(this))},teardown:function(){if(this.removeEventListener)for(var e=t.length;e;)this.removeEventListener(t[--e],i,!1);else this.onmousewheel=null;c.removeData(this,"mousewheel-line-height"),c.removeData(this,"mousewheel-page-height")},getLineHeight:function(e){var e=c(e),t=e["offsetParent"in c.fn?"offsetParent":"parent"]();return t.length||(t=c("body")),parseInt(t.css("fontSize"),10)||parseInt(e.css("fontSize"),10)||16},getPageHeight:function(e){return c(e).height()},settings:{adjustOldDeltas:!0,normalizeOffset:!0}};function i(e){var t,n=e||window.event,i=p.call(arguments,1),s=0,o=0,r=0,a=0,l=0;if((e=c.event.fix(n)).type="mousewheel","detail"in n&&(r=-1*n.detail),"wheelDelta"in n&&(r=n.wheelDelta),"wheelDeltaY"in n&&(r=n.wheelDeltaY),"wheelDeltaX"in n&&(o=-1*n.wheelDeltaX),"axis"in n&&n.axis===n.HORIZONTAL_AXIS&&(o=-1*r,r=0),s=0===r?o:r,"deltaY"in n&&(s=r=-1*n.deltaY),"deltaX"in n&&(o=n.deltaX,0===r)&&(s=-1*o),0!==r||0!==o)return 1===n.deltaMode?(s*=t=c.data(this,"mousewheel-line-height"),r*=t,o*=t):2===n.deltaMode&&(s*=t=c.data(this,"mousewheel-page-height"),r*=t,o*=t),t=Math.max(Math.abs(r),Math.abs(o)),(!d||t":">",'"':""","'":"'","/":"/"};return"string"!=typeof e?e:String(e).replace(/[&<>"'\/\\]/g,function(e){return t[e]})},s.__cache={};var n=0;return s.GetUniqueElementId=function(e){var t=e.getAttribute("data-select2-id");return null==t&&(t=e.id?"select2-data-"+e.id:"select2-data-"+(++n).toString()+"-"+s.generateChars(4),e.setAttribute("data-select2-id",t)),t},s.StoreData=function(e,t,n){e=s.GetUniqueElementId(e);s.__cache[e]||(s.__cache[e]={}),s.__cache[e][t]=n},s.GetData=function(e,t){var n=s.GetUniqueElementId(e);return t?s.__cache[n]&&null!=s.__cache[n][t]?s.__cache[n][t]:o(e).data(t):s.__cache[n]},s.RemoveData=function(e){var t=s.GetUniqueElementId(e);null!=s.__cache[t]&&delete s.__cache[t],e.removeAttribute("data-select2-id")},s.copyNonInternalCssClasses=function(e,t){var n=(n=e.getAttribute("class").trim().split(/\s+/)).filter(function(e){return 0===e.indexOf("select2-")}),t=(t=t.getAttribute("class").trim().split(/\s+/)).filter(function(e){return 0!==e.indexOf("select2-")}),n=n.concat(t);e.setAttribute("class",n.join(" "))},s}),u.define("select2/results",["jquery","./utils"],function(u,d){function s(e,t,n){this.$element=e,this.data=n,this.options=t,s.__super__.constructor.call(this)}return d.Extend(s,d.Observable),s.prototype.render=function(){var t=u('
      ');return t.on("mouseup",function(e){u.contains(t[0],u(e.target).closest("li")[0])||e.stopPropagation()}),this.options.get("multiple")&&t.attr("aria-multiselectable","true"),this.$results=t},s.prototype.clear=function(){this.$results.empty()},s.prototype.displayMessage=function(e){var t=this.options.get("escapeMarkup"),n=(this.clear(),this.hideLoading(),u('')),s=this.options.get("translations").get(e.message);n.append(t(s(e.args))),n[0].className+=" select2-results__message",this.$results.append(n)},s.prototype.hideMessages=function(){this.$results.find(".select2-results__message").remove()},s.prototype.append=function(e){this.hideLoading();var t=[];if(null==e.results||0===e.results.length)0===this.$results.children().length&&this.trigger("results:message",{message:"noResults"});else{e.results=this.sort(e.results);for(var n=0;n",{class:"select2-results__options select2-results__options--nested",role:"none"});c.append(r),i.append(o),i.append(c)}else this.template(e,n);return d.StoreData(n,"data",e),n},s.prototype.bind=function(t,e){var i=this,n=t.id+"-results";this.$results.attr("id",n),t.on("results:all",function(e){i.clear(),i.append(e.data),t.isOpen()&&(i.setClasses(),i.highlightFirstItem())}),t.on("results:append",function(e){i.append(e.data),t.isOpen()&&i.setClasses()}),t.on("query",function(e){i.hideMessages(),i.showLoading(e)}),t.on("select",function(){t.isOpen()&&(i.setClasses(),i.options.get("scrollAfterSelect"))&&i.highlightFirstItem()}),t.on("unselect",function(){t.isOpen()&&(i.setClasses(),i.options.get("scrollAfterSelect"))&&i.highlightFirstItem()}),t.on("open",function(){i.$results.attr("aria-expanded","true"),i.$results.attr("aria-hidden","false"),i.setClasses(),i.ensureHighlightVisible()}),t.on("close",function(){i.$results.attr("aria-expanded","false"),i.$results.attr("aria-hidden","true"),i.$results[0].removeAttribute("aria-activedescendant")}),t.on("results:toggle",function(){var e=i.getHighlightedResults();0!==e.length&&e.trigger("mouseup")}),t.on("results:select",function(){var e,t=i.getHighlightedResults();0!==t.length&&(e=d.GetData(t[0],"data"),t.hasClass("select2-results__option--selected")?i.trigger("close",{}):i.trigger("select",{data:e}))}),t.on("results:previous",function(){var e,t=i.getHighlightedResults(),n=i.$results.find(".select2-results__option--selectable"),s=n.index(t);s<=0||(s=s-1,0===t.length&&(s=0),(t=n.eq(s)).trigger("mouseenter"),n=i.$results.offset().top,t=t.offset().top,e=i.$results.scrollTop()+(t-n),0===s?i.$results.scrollTop(0):t-n<0&&i.$results.scrollTop(e))}),t.on("results:next",function(){var e,t,n=i.getHighlightedResults(),s=i.$results.find(".select2-results__option--selectable"),n=s.index(n)+1;n>=s.length||((s=s.eq(n)).trigger("mouseenter"),e=i.$results.offset().top+i.$results.outerHeight(!1),s=s.offset().top+s.outerHeight(!1),t=i.$results.scrollTop()+s-e,0===n?i.$results.scrollTop(0):ethis.$results.outerHeight()||s<0)&&this.$results.scrollTop(n))},s.prototype.template=function(e,t){var n=this.options.get("templateResult"),s=this.options.get("escapeMarkup"),n=n(e,t);null==n?t.style.display="none":"string"==typeof n?t.innerHTML=s(n):u(t).append(n)},s}),u.define("select2/keys",[],function(){return{BACKSPACE:8,TAB:9,ENTER:13,SHIFT:16,CTRL:17,ALT:18,ESC:27,SPACE:32,PAGE_UP:33,PAGE_DOWN:34,END:35,HOME:36,LEFT:37,UP:38,RIGHT:39,DOWN:40,DELETE:46}}),u.define("select2/selection/base",["jquery","../utils","../keys"],function(o,n,r){function s(e,t){this.$element=e,this.options=t,s.__super__.constructor.call(this)}return n.Extend(s,n.Observable),s.prototype.render=function(){var e=o('');return this._tabindex=0,null!=n.GetData(this.$element[0],"old-tabindex")?this._tabindex=n.GetData(this.$element[0],"old-tabindex"):null!=this.$element.attr("tabindex")&&(this._tabindex=this.$element.attr("tabindex")),e.attr("title",this.$element.attr("title")),e.attr("tabindex",this._tabindex),e.attr("aria-disabled","false"),this.$selection=e},s.prototype.bind=function(s,e){var i=this,t=o('This button opens a select. When results are available,use up and down arrows to navigate and enter to select '),t=(this.$selection.after(t),"sr-description"+s.id),n=(this.$selection.attr("aria-describedby",t),s.id+"-results");this.container=s,this.$selection.on("focus",function(e){i.trigger("focus",e)}),this.$selection.on("blur",function(e){i._handleBlur(e)}),this.$selection.on("keydown",function(e){i.trigger("keypress",e),e.which===r.SPACE&&e.preventDefault()}),s.on("results:focus",function(e){i.$selection.attr("aria-activedescendant",e.data._resultId)}),s.on("selection:update",function(e){i.update(e.data),i.$selection.attr("aria-label",e.data.resultsId);var t,e=o('label[for="'+this.$element.attr("id")+'"]').text();console.log(this.$element,o(s),this.$element),o(this.$element).parents(".search-filter-group")&&(t=o(this.$element).parents(".search-filter-group").find(".search-filter-title").text(),console.log(t));var n=i.$selection.find(".select2-selection__rendered").attr("title");n&&"Click here to select criteria"==n&&(n=void 0),t=e&&n?(console.log("lbltitle",e),e+" The selected value is:"+n):e&&!n?e+"No value currently selected.":t?(console.log("lgnd",t),"Show more for category "+t):n&&!e?"The selected value is: "+n:e+"No value currently selected.",console.log("label text",t,e),i.$selection.attr("aria-label",t)}),s.on("open",function(){i.$selection.attr("aria-expanded","true"),i.$selection.attr("aria-owns",n),i._attachCloseHandler(s)}),s.on("close",function(){i.$selection.attr("aria-expanded","false"),i.$selection[0].removeAttribute("aria-activedescendant"),i.$selection[0].removeAttribute("aria-owns"),i.$selection.trigger("focus"),i._detachCloseHandler(s)}),s.on("enable",function(){i.$selection.attr("tabindex",i._tabindex),i.$selection.attr("aria-disabled","false")}),s.on("disable",function(){i.$selection.attr("tabindex","-1"),i.$selection.attr("aria-disabled","true")})},s.prototype._handleBlur=function(e){var t=this;window.setTimeout(function(){document.activeElement==t.$selection[0]||o.contains(t.$selection[0],document.activeElement)||t.trigger("blur",e)},1)},s.prototype._attachCloseHandler=function(e){o(document.body).on("mouseup.select2."+e.id,function(e){var t=o(e.target).closest(".select2");o(".select2.select2-container--open").each(function(){this!=t[0]&&n.GetData(this,"element").select2("close")})})},s.prototype._detachCloseHandler=function(e){o(document.body).off("mouseup.select2."+e.id)},s.prototype.position=function(e,t){t.find(".selection").append(e)},s.prototype.destroy=function(){this._detachCloseHandler(this.container)},s.prototype.update=function(e){throw new Error("The `update` method must be defined in child classes.")},s.prototype.isEnabled=function(){return!this.isDisabled()},s.prototype.isDisabled=function(){return this.options.get("disabled")},s}),u.define("select2/selection/single",["jquery","./base","../utils","../keys"],function(i,e,t,n){function o(){o.__super__.constructor.apply(this,arguments)}return t.Extend(o,e),o.prototype.render=function(){var e=o.__super__.render.call(this);return e[0].classList.add("select2-selection--single"),e.html(''),e},o.prototype.bind=function(t,e){var n=this,s=(o.__super__.bind.apply(this,arguments),t.id+"-container");this.$selection.find(".select2-selection__rendered").attr("id",s),this.$selection.attr("aria-controls",s),this.$selection.on("mousedown",function(e){1===e.which&&n.trigger("toggle",{originalEvent:e})}),this.$selection.on("focus",function(e){}),this.$selection.on("blur",function(e){}),t&&"1"==this.options.get("hideAccessibly")&&i(e).addClass("hide"),t.on("focus",function(e){t.isOpen()||n.$selection.trigger("focus")})},o.prototype.clear=function(){var e=this.$selection.find(".select2-selection__rendered");e.empty(),e[0].removeAttribute("title")},o.prototype.display=function(e,t){var n=this.options.get("templateSelection");return this.options.get("escapeMarkup")(n(e,t))},o.prototype.selectionContainer=function(){return i("")},o.prototype.update=function(e){var t,n;0===e.length?this.clear():(e=e[0],t=this.$selection.find(".select2-selection__rendered"),n=this.display(e,t),t.empty().append(n),(n=e.title||e.text)?t.attr("title",n):t[0].removeAttribute("title"))},o}),u.define("select2/selection/multiple",["jquery","./base","../utils"],function(i,e,p){function o(e,t){o.__super__.constructor.apply(this,arguments)}return p.Extend(o,e),o.prototype.render=function(){var e=o.__super__.render.call(this);return e[0].classList.add("select2-selection--multiple"),e.html('
        '),e},o.prototype.bind=function(e,t){var n=this,s=(o.__super__.bind.apply(this,arguments),e.id+"-container");this.$selection.attr("role","combobox"),this.$selection.siblings("#sr-description"+e.id).text("This is a multi-select.Press enter or begin typing to reveal results.Use arrow key to select resultsUse backspace from the text input to delete existing selected results."),this.$selection.find(".select2-selection__rendered").attr("id",s),this.$selection.on("click",function(e){n.trigger("toggle",{originalEvent:e})}),this.$selection.on("click",".select2-selection__choice__remove",function(e){var t;n.isDisabled()||(t=i(this).parent(),t=p.GetData(t[0],"data"),n.trigger("unselect",{originalEvent:e,data:t}))}),this.$selection.on("keydown",".select2-selection__choice__remove",function(e){n.isDisabled()||e.stopPropagation()})},o.prototype.clear=function(){var e=this.$selection.find(".select2-selection__rendered");e.empty(),e.removeAttr("title")},o.prototype.display=function(e,t){var n=this.options.get("templateSelection");return this.options.get("escapeMarkup")(n(e,t))},o.prototype.selectionContainer=function(){return i('
      • ')},o.prototype.update=function(e){if(this.clear(),0!==e.length){for(var t=[],n=[],s=this.$selection.find(".select2-selection__rendered").attr("id")+"-choice-",i=0;i')).attr("title",n()),s.attr("aria-label",n()),s.attr("aria-describedby",e),a.StoreData(s[0],"data",t),this.$selection.prepend(s),this.$selection[0].classList.add("select2-selection--clearable"))},e}),u.define("select2/selection/search",["jquery","../utils","../keys"],function(s,a,l){function e(e,t,n){e.call(this,t,n)}return e.prototype.render=function(e){var t=this.options.get("translations").get("search"),n=s(''),n=(this.$searchContainer=n,this.$search=n.find("textarea"),this.$search.prop("autocomplete",this.options.get("autocomplete")),this.$search.attr("aria-label",t()),e.call(this));return this._transferTabIndex(),n.append(this.$searchContainer),n},e.prototype.bind=function(e,t,n){var s=this,i=t.id+"-results",o=t.id+"-container",e=(e.call(this,t,n),s.$search.attr("aria-describedby",o),t.on("open",function(){s.$search.attr("aria-controls",i),s.$search.trigger("focus")}),t.on("close",function(){s.$search.val(""),s.resizeSearch(),s.$search[0].removeAttribute("aria-controls"),s.$search[0].removeAttribute("aria-activedescendant"),s.$search.trigger("focus")}),t.on("enable",function(){s.$search.prop("disabled",!1),s._transferTabIndex()}),t.on("disable",function(){s.$search.prop("disabled",!0)}),t.on("focus",function(e){s.$search.trigger("focus")}),t.on("results:focus",function(e){e.data._resultId?s.$search.attr("aria-activedescendant",e.data._resultId):s.$search[0].removeAttribute("aria-activedescendant")}),this.$selection.on("focusin",".select2-search--inline",function(e){s.trigger("focus",e)}),this.$selection.on("focusout",".select2-search--inline",function(e){s._handleBlur(e)}),this.$selection.on("keydown",".select2-search--inline",function(e){var t;e.stopPropagation(),s.trigger("keypress",e),s._keyUpPrevented=e.isDefaultPrevented(),e.which===l.BACKSPACE&&""===s.$search.val()&&0<(t=s.$selection.find(".select2-selection__choice").last()).length&&(t=a.GetData(t[0],"data"),s.searchRemoveChoice(t),e.preventDefault())}),this.$selection.on("click",".select2-search--inline",function(e){s.$search.val()&&e.stopPropagation()}),document.documentMode),r=e&&e<=11;this.$selection.on("input.searchcheck",".select2-search--inline",function(e){r?s.$selection.off("input.search input.searchcheck"):s.$selection.off("keyup.search")}),this.$selection.on("keyup.search input.search",".select2-search--inline",function(e){var t;r&&"input"===e.type?s.$selection.off("input.search input.searchcheck"):(t=e.which)!=l.SHIFT&&t!=l.CTRL&&t!=l.ALT&&t!=l.TAB&&s.handleSearch(e)})},e.prototype._transferTabIndex=function(e){this.$search.attr("tabindex",this.$selection.attr("tabindex")),this.$selection.attr("tabindex","-1")},e.prototype.createPlaceholder=function(e,t){this.$search.attr("placeholder",t.text)},e.prototype.update=function(e,t){var n=this.$search[0]==document.activeElement;this.$search.attr("placeholder",""),e.call(this,t),this.resizeSearch(),n&&this.$search.trigger("focus")},e.prototype.handleSearch=function(){var e;this.resizeSearch(),this._keyUpPrevented||(e=this.$search.val(),this.trigger("query",{term:e})),this._keyUpPrevented=!1},e.prototype.searchRemoveChoice=function(e,t){this.trigger("unselect",{data:t}),this.$search.val(t.text),this.handleSearch()},e.prototype.resizeSearch=function(){this.$search.css("width","25px");var e="100%";""===this.$search.attr("placeholder")&&(e=.75*(this.$search.val().length+1)+"em"),this.$search.css("width",e)},e}),u.define("select2/selection/selectionCss",["../utils"],function(n){function e(){}return e.prototype.render=function(e){var t=e.call(this),e=this.options.get("selectionCssClass")||"";return-1!==e.indexOf(":all:")&&(e=e.replace(":all:",""),n.copyNonInternalCssClasses(t[0],this.$element[0])),e.trim().split(" ").forEach(function(e){0this.maximumInputLength?this.trigger("results:message",{message:"inputTooLong",args:{maximum:this.maximumInputLength,input:t.term,params:t}}):e.call(this,t,n)},e}),u.define("select2/data/maximumSelectionLength",[],function(){function e(e,t,n){this.maximumSelectionLength=n.get("maximumSelectionLength"),e.call(this,t,n)}return e.prototype.bind=function(e,t,n){var s=this;e.call(this,t,n),t.on("select",function(){s._checkIfMaximumSelected()})},e.prototype.query=function(e,t,n){var s=this;this._checkIfMaximumSelected(function(){e.call(s,t,n)})},e.prototype._checkIfMaximumSelected=function(e,t){var n=this;this.current(function(e){e=null!=e?e.length:0;0=n.maximumSelectionLength?n.trigger("results:message",{message:"maximumSelected",args:{maximum:n.maximumSelectionLength}}):t&&t()})},e}),u.define("select2/dropdown",["jquery","./utils"],function(t,e){function n(e,t){this.$element=e,this.options=t,n.__super__.constructor.call(this)}return e.Extend(n,e.Observable),n.prototype.render=function(){var e=t('');return e.attr("dir",this.options.get("dir")),this.$dropdown=e},n.prototype.bind=function(){},n.prototype.position=function(e,t){},n.prototype.destroy=function(){this.$dropdown.remove()},n}),u.define("select2/dropdown/search",["jquery"],function(o){function e(){}return e.prototype.render=function(e){var e=e.call(this),t=this.options.get("translations").get("search"),n=o('');return this.$searchContainer=n,this.$search=n.find("input"),this.$search.prop("autocomplete",this.options.get("autocomplete")),this.$search.attr("aria-label",t()),e.prepend(n),e},e.prototype.bind=function(e,t,n){var s=this,i=t.id+"-results";e.call(this,t,n),this.$search.on("keydown",function(e){s.trigger("keypress",e),s._keyUpPrevented=e.isDefaultPrevented()}),this.$search.on("input",function(e){o(this).off("keyup")}),this.$search.on("keyup input",function(e){s.handleSearch(e)}),t.on("open",function(){s.$search.attr("tabindex",0),s.$search.attr("aria-controls",i),window.setTimeout(function(){s.$search.trigger("focus")},0)}),t.on("close",function(){s.$search.attr("tabindex",-1),s.$search[0].removeAttribute("aria-controls"),s.$search[0].removeAttribute("aria-activedescendant"),s.$search.val(""),s.$search.trigger("blur")}),t.on("results:all",function(e){null!=e.query.term&&""!==e.query.term||(s.showSearch(e)?s.$searchContainer[0].classList.remove("select2-search--hide"):s.$searchContainer[0].classList.add("select2-search--hide"))}),t.on("results:focus",function(e){e.data._resultId?s.$search.attr("aria-activedescendant",e.data._resultId):s.$search[0].removeAttribute("aria-activedescendant")})},e.prototype.handleSearch=function(e){var t;this._keyUpPrevented||(t=this.$search.val(),this.trigger("query",{term:t})),this._keyUpPrevented=!1},e.prototype.showSearch=function(e,t){return!0},e}),u.define("select2/dropdown/hidePlaceholder",[],function(){function e(e,t,n,s){this.placeholder=this.normalizePlaceholder(n.get("placeholder")),e.call(this,t,n,s)}return e.prototype.append=function(e,t){t.results=this.removePlaceholder(t.results),e.call(this,t)},e.prototype.normalizePlaceholder=function(e,t){return t="string"==typeof t?{id:"",text:t}:t},e.prototype.removePlaceholder=function(e,t){for(var n=t.slice(0),s=t.length-1;0<=s;s--){var i=t[s];this.placeholder.id===i.id&&n.splice(s,1)}return n},e}),u.define("select2/dropdown/infiniteScroll",["jquery"],function(n){function e(e,t,n,s){this.lastParams={},e.call(this,t,n,s),this.$loadingMore=this.createLoadingMore(),this.loading=!1}return e.prototype.append=function(e,t){this.$loadingMore.remove(),this.loading=!1,e.call(this,t),this.showLoadingMore(t)&&(this.$results.append(this.$loadingMore),this.loadMoreIfNeeded())},e.prototype.bind=function(e,t,n){var s=this;e.call(this,t,n),t.on("query",function(e){s.lastParams=e,s.loading=!0}),t.on("query:append",function(e){s.lastParams=e,s.loading=!0}),this.$results.on("scroll",this.loadMoreIfNeeded.bind(this))},e.prototype.loadMoreIfNeeded=function(){var e=n.contains(document.documentElement,this.$loadingMore[0]);!this.loading&&e&&(e=this.$results.offset().top+this.$results.outerHeight(!1),this.$loadingMore.offset().top+this.$loadingMore.outerHeight(!1)<=e+50)&&this.loadMore()},e.prototype.loadMore=function(){this.loading=!0;var e=n.extend({},{page:1},this.lastParams);e.page++,this.trigger("query:append",e)},e.prototype.showLoadingMore=function(e,t){return t.pagination&&t.pagination.more},e.prototype.createLoadingMore=function(){var e=n('
      • '),t=this.options.get("translations").get("loadingMore");return e.html(t(this.lastParams)),e},e}),u.define("select2/dropdown/attachBody",["jquery","../utils"],function(u,r){function e(e,t,n){this.$dropdownParent=u(n.get("dropdownParent")||document.body),e.call(this,t,n)}return e.prototype.bind=function(e,t,n){var s=this;e.call(this,t,n),t.on("open",function(){s._showDropdown(),s._attachPositioningHandler(t),s._bindContainerResultHandlers(t)}),t.on("close",function(){s._hideDropdown(),s._detachPositioningHandler(t)}),this.$dropdownContainer.on("mousedown",function(e){e.stopPropagation()})},e.prototype.destroy=function(e){e.call(this),this.$dropdownContainer.remove()},e.prototype.position=function(e,t,n){t.attr("class",n.attr("class")),t[0].classList.remove("select2"),t[0].classList.add("select2-container--open"),t.css({position:"absolute",top:-999999}),this.$container=n},e.prototype.render=function(e){var t=u(""),e=e.call(this);return t.append(e),this.$dropdownContainer=t},e.prototype._hideDropdown=function(e){this.$dropdownContainer.detach()},e.prototype._bindContainerResultHandlers=function(e,t){var n;this._containerResultsHandlersBound||(n=this,t.on("results:all",function(){n._positionDropdown(),n._resizeDropdown()}),t.on("results:append",function(){n._positionDropdown(),n._resizeDropdown()}),t.on("results:message",function(){n._positionDropdown(),n._resizeDropdown()}),t.on("select",function(){n._positionDropdown(),n._resizeDropdown()}),t.on("unselect",function(){n._positionDropdown(),n._resizeDropdown()}),this._containerResultsHandlersBound=!0)},e.prototype._attachPositioningHandler=function(e,t){var n=this,s="scroll.select2."+t.id,i="resize.select2."+t.id,t="orientationchange.select2."+t.id,o=this.$container.parents().filter(r.hasScroll);o.each(function(){r.StoreData(this,"select2-scroll-position",{x:u(this).scrollLeft(),y:u(this).scrollTop()})}),o.on(s,function(e){var t=r.GetData(this,"select2-scroll-position");u(this).scrollTop(t.y)}),u(window).on(s+" "+i+" "+t,function(e){n._positionDropdown(),n._resizeDropdown()})},e.prototype._detachPositioningHandler=function(e,t){var n="scroll.select2."+t.id,s="resize.select2."+t.id,t="orientationchange.select2."+t.id;this.$container.parents().filter(r.hasScroll).off(n),u(window).off(n+" "+s+" "+t)},e.prototype._positionDropdown=function(){var e=u(window),t=this.$dropdown[0].classList.contains("select2-dropdown--above"),n=this.$dropdown[0].classList.contains("select2-dropdown--below"),s=null,i=this.$container.offset(),o=(i.bottom=i.top+this.$container.outerHeight(!1),{height:this.$container.outerHeight(!1)});o.top=i.top,o.bottom=i.top+o.height;var r=this.$dropdown.outerHeight(!1),a=e.scrollTop(),e=e.scrollTop()+e.height(),a=ai.bottom+r,i={left:i.left,top:o.bottom},l=this.$dropdownParent,c=("static"===l.css("position")&&(l=l.offsetParent()),{top:0,left:0});(u.contains(document.body,l[0])||l[0].isConnected)&&(c=l.offset()),i.top-=c.top,i.left-=c.left,t||n||(s="below"),e||!a||t?!a&&e&&t&&(s="below"):s="above",("above"==s||t&&"below"!==s)&&(i.top=o.top-c.top-r),null!=s&&(this.$dropdown[0].classList.remove("select2-dropdown--below"),this.$dropdown[0].classList.remove("select2-dropdown--above"),this.$dropdown[0].classList.add("select2-dropdown--"+s),this.$container[0].classList.remove("select2-container--below"),this.$container[0].classList.remove("select2-container--above"),this.$container[0].classList.add("select2-container--"+s)),this.$dropdownContainer.css(i)},e.prototype._resizeDropdown=function(){var e={width:this.$container.outerWidth(!1)+"px"};this.options.get("dropdownAutoWidth")&&(e.minWidth=e.width,e.position="relative",e.width="auto"),this.$dropdown.css(e)},e.prototype._showDropdown=function(e){this.$dropdownContainer.appendTo(this.$dropdownParent),this._positionDropdown(),this._resizeDropdown()},e}),u.define("select2/dropdown/minimumResultsForSearch",[],function(){function e(e,t,n,s){this.minimumResultsForSearch=n.get("minimumResultsForSearch"),this.minimumResultsForSearch<0&&(this.minimumResultsForSearch=1/0),e.call(this,t,n,s)}return e.prototype.showSearch=function(e,t){return!(function e(t){for(var n=0,s=0;s');return e.attr("dir",this.options.get("dir")),this.$container=e,this.$container[0].classList.add("select2-container--"+this.options.get("theme")),r.StoreData(e[0],"element",this.$element),e},a}),u.define("select2/dropdown/attachContainer",[],function(){function e(e,t,n){e.call(this,t,n)}return e.prototype.position=function(e,t,n){n.find(".dropdown-wrapper").append(t),t[0].classList.add("select2-dropdown--below"),n[0].classList.add("select2-container--below")},e}),u.define("select2/dropdown/stopPropagation",[],function(){function e(){}return e.prototype.bind=function(e,t,n){e.call(this,t,n);this.$dropdown.on(["blur","change","click","dblclick","focus","focusin","focusout","input","keydown","keyup","keypress","mousedown","mouseenter","mouseleave","mousemove","mouseover","mouseup","search","touchend","touchstart"].join(" "),function(e){e.stopPropagation()})},e}),u.define("select2/selection/stopPropagation",[],function(){function e(){}return e.prototype.bind=function(e,t,n){e.call(this,t,n);this.$selection.on(["blur","change","click","dblclick","focus","focusin","focusout","input","keydown","keyup","keypress","mousedown","mouseenter","mouseleave","mousemove","mouseover","mouseup","search","touchend","touchstart"].join(" "),function(e){e.stopPropagation()})},e}),i=function(c){var u,d,e=["wheel","mousewheel","DOMMouseScroll","MozMousePixelScroll"],t="onwheel"in document||9<=document.documentMode?["wheel"]:["mousewheel","DomMouseScroll","MozMousePixelScroll"],p=Array.prototype.slice;if(c.event.fixHooks)for(var n=e.length;n;)c.event.fixHooks[e[--n]]=c.event.mouseHooks;var h=c.event.special.mousewheel={version:"3.1.12",setup:function(){if(this.addEventListener)for(var e=t.length;e;)this.addEventListener(t[--e],s,!1);else this.onmousewheel=s;c.data(this,"mousewheel-line-height",h.getLineHeight(this)),c.data(this,"mousewheel-page-height",h.getPageHeight(this))},teardown:function(){if(this.removeEventListener)for(var e=t.length;e;)this.removeEventListener(t[--e],s,!1);else this.onmousewheel=null;c.removeData(this,"mousewheel-line-height"),c.removeData(this,"mousewheel-page-height")},getLineHeight:function(e){var e=c(e),t=e["offsetParent"in c.fn?"offsetParent":"parent"]();return t.length||(t=c("body")),parseInt(t.css("fontSize"),10)||parseInt(e.css("fontSize"),10)||16},getPageHeight:function(e){return c(e).height()},settings:{adjustOldDeltas:!0,normalizeOffset:!0}};function s(e){var t,n=e||window.event,s=p.call(arguments,1),i=0,o=0,r=0,a=0,l=0;if((e=c.event.fix(n)).type="mousewheel","detail"in n&&(r=-1*n.detail),"wheelDelta"in n&&(r=n.wheelDelta),"wheelDeltaY"in n&&(r=n.wheelDeltaY),"wheelDeltaX"in n&&(o=-1*n.wheelDeltaX),"axis"in n&&n.axis===n.HORIZONTAL_AXIS&&(o=-1*r,r=0),i=0===r?o:r,"deltaY"in n&&(i=r=-1*n.deltaY),"deltaX"in n&&(o=n.deltaX,0===r)&&(i=-1*o),0!==r||0!==o)return 1===n.deltaMode?(i*=t=c.data(this,"mousewheel-line-height"),r*=t,o*=t):2===n.deltaMode&&(i*=t=c.data(this,"mousewheel-page-height"),r*=t,o*=t),t=Math.max(Math.abs(r),Math.abs(o)),(!d||t