select2.min.js
62.9 KB
/*
Select2
Copyright 2012 Igor Vaynberg
https://select2.github.io/
*/
(function(e){if(typeof e.fn.each2=="undefined"){e.extend(e.fn,{each2:function(t){var n=e([0]),r=-1,i=this.length;while(++r<i&&(n.context=n[0]=this[r])&&t.call(n[0],r,n)!==false);return this}})}})(jQuery);(function(e,t){"use strict";function p(t){var n=e(document.createTextNode(""));t.before(n);n.before(t);n.remove()}function d(e){function t(e){return h[e]||e}return e.replace(/[^\u0000-\u007E]/g,t)}function v(e,t){var n=0,r=t.length;for(;n<r;n=n+1){if(g(e,t[n]))return n}return-1}function m(){var t=e(c);t.appendTo(document.body);var n={width:t.width()-t[0].clientWidth,height:t.height()-t[0].clientHeight};t.remove();return n}function g(e,n){if(e===n)return true;if(e===t||n===t)return false;if(e===null||n===null)return false;if(e.constructor===String)return e+""===n+"";if(n.constructor===String)return n+""===e+"";return false}function y(e,t,n){var r,i,s;if(e===null||e.length<1)return[];r=e.split(t);for(i=0,s=r.length;i<s;i=i+1)r[i]=n(r[i]);return r}function b(e){return e.outerWidth(false)-e.width()}function w(n){var r="keyup-change-value";n.on("keydown",function(){if(e.data(n,r)===t){e.data(n,r,n.val())}});n.on("keyup",function(){var i=e.data(n,r);if(i!==t&&n.val()!==i){e.removeData(n,r);n.trigger("keyup-change")}})}function E(n){n.on("mousemove",function(n){var r=u;if(r===t||r.x!==n.pageX||r.y!==n.pageY){e(n.target).trigger("mousemove-filtered",n)}})}function S(e,n,r){r=r||t;var i;return function(){var t=arguments;window.clearTimeout(i);i=window.setTimeout(function(){n.apply(r,t)},e)}}function x(e,t){var n=S(e,function(e){t.trigger("scroll-debounced",e)});t.on("scroll",function(e){if(v(e.target,t.get())>=0)n(e)})}function T(e){if(e[0]===document.activeElement)return;window.setTimeout(function(){var t=e[0],n=e.val().length,r;e.focus();var i=t.offsetWidth>0||t.offsetHeight>0;if(i&&t===document.activeElement){if(t.setSelectionRange){t.setSelectionRange(n,n)}else if(t.createTextRange){r=t.createTextRange();r.collapse(false);r.select()}}},0)}function N(t){t=e(t)[0];var n=0;var r=0;if("selectionStart"in t){n=t.selectionStart;r=t.selectionEnd-n}else if("selection"in document){t.focus();var i=document.selection.createRange();r=document.selection.createRange().text.length;i.moveStart("character",-t.value.length);n=i.text.length-r}return{offset:n,length:r}}function C(e){e.preventDefault();e.stopPropagation()}function k(e){e.preventDefault();e.stopImmediatePropagation()}function L(t){if(!o){var n=t[0].currentStyle||window.getComputedStyle(t[0],null);o=e(document.createElement("div")).css({position:"absolute",left:"-10000px",top:"-10000px",display:"none",fontSize:n.fontSize,fontFamily:n.fontFamily,fontStyle:n.fontStyle,fontWeight:n.fontWeight,letterSpacing:n.letterSpacing,textTransform:n.textTransform,whiteSpace:"nowrap"});o.attr("class","select2-sizer");e(document.body).append(o)}o.text(t.val());return o.width()}function A(t,n,r){var i,s=[],o;i=e.trim(t.attr("class"));if(i){i=""+i;e(i.split(/\s+/)).each2(function(){if(this.indexOf("select2-")===0){s.push(this)}})}i=e.trim(n.attr("class"));if(i){i=""+i;e(i.split(/\s+/)).each2(function(){if(this.indexOf("select2-")!==0){o=r(this);if(o){s.push(o)}}})}t.attr("class",s.join(" "))}function O(e,t,n,r){var i=d(e.toUpperCase()).indexOf(d(t.toUpperCase())),s=t.length;if(i<0){n.push(r(e));return}n.push(r(e.substring(0,i)));n.push("<span class='select2-match'>");n.push(r(e.substring(i,i+s)));n.push("</span>");n.push(r(e.substring(i+s,e.length)))}function M(e){var t={"\\":"\","&":"&","<":"<",">":">",'"':""","'":"'","/":"/"};return String(e).replace(/[&<>"'\/\\]/g,function(e){return t[e]})}function _(n){var r,i=null,s=n.quietMillis||100,o=n.url,u=this;return function(a){window.clearTimeout(r);r=window.setTimeout(function(){var r=n.data,s=o,f=n.transport||e.fn.select2.ajaxDefaults.transport,l={type:n.type||"GET",cache:n.cache||false,jsonpCallback:n.jsonpCallback||t,dataType:n.dataType||"json"},c=e.extend({},e.fn.select2.ajaxDefaults.params,l);r=r?r.call(u,a.term,a.page,a.context):null;s=typeof s==="function"?s.call(u,a.term,a.page,a.context):s;if(i&&typeof i.abort==="function"){i.abort()}if(n.params){if(e.isFunction(n.params)){e.extend(c,n.params.call(u))}else{e.extend(c,n.params)}}e.extend(c,{url:s,dataType:n.dataType,data:r,success:function(e){var t=n.results(e,a.page,a);a.callback(t)},error:function(e,t,n){var r={hasError:true,jqXHR:e,textStatus:t,errorThrown:n};a.callback(r)}});i=f.call(u,c)},s)}}function D(t){var n=t,r,i,s=function(e){return""+e.text};if(e.isArray(n)){i=n;n={results:i}}if(e.isFunction(n)===false){i=n;n=function(){return i}}var o=n();if(o.text){s=o.text;if(!e.isFunction(s)){r=o.text;s=function(e){return e[r]}}}return function(t){var r=t.term,i={results:[]},o;if(r===""){t.callback(n());return}o=function(n,i){var u,a;n=n[0];if(n.children){u={};for(a in n){if(n.hasOwnProperty(a))u[a]=n[a]}u.children=[];e(n.children).each2(function(e,t){o(t,u.children)});if(u.children.length||t.matcher(r,s(u),n)){i.push(u)}}else{if(t.matcher(r,s(n),n)){i.push(n)}}};e(n().results).each2(function(e,t){o(t,i.results)});t.callback(i)}}function P(n){var r=e.isFunction(n);return function(i){var s=i.term,o={results:[]};var u=r?n(i):n;if(e.isArray(u)){e(u).each(function(){var e=this.text!==t,n=e?this.text:this;if(s===""||i.matcher(s,n)){o.results.push(e?this:{id:this,text:this})}});i.callback(o)}}}function H(t,n){if(e.isFunction(t))return true;if(!t)return false;if(typeof t==="string")return true;throw new Error(n+" must be a string, function, or falsy value")}function B(t,n){if(e.isFunction(t)){var r=Array.prototype.slice.call(arguments,2);return t.apply(n,r)}return t}function j(t){var n=0;e.each(t,function(e,t){if(t.children){n+=j(t.children)}else{n++}});return n}function F(e,n,r,i){var s=e,o=false,u,a,f,l,c;if(!i.createSearchChoice||!i.tokenSeparators||i.tokenSeparators.length<1)return t;while(true){a=-1;for(f=0,l=i.tokenSeparators.length;f<l;f++){c=i.tokenSeparators[f];a=e.indexOf(c);if(a>=0)break}if(a<0)break;u=e.substring(0,a);e=e.substring(a+c.length);if(u.length>0){u=i.createSearchChoice.call(this,u,n);if(u!==t&&u!==null&&i.id(u)!==t&&i.id(u)!==null){o=false;for(f=0,l=n.length;f<l;f++){if(g(i.id(u),i.id(n[f]))){o=true;break}}if(!o)r(u)}}}if(s!==e)return e}function I(){var t=this;e.each(arguments,function(e,n){t[n].remove();t[n]=null})}function q(t,n){var r=function(){};r.prototype=new t;r.prototype.constructor=r;r.prototype.parent=t.prototype;r.prototype=e.extend(r.prototype,n);return r}if(window.Select2!==t){return}var n,r,i,s,o,u={x:0,y:0},a,f,l={TAB:9,ENTER:13,ESC:27,SPACE:32,LEFT:37,UP:38,RIGHT:39,DOWN:40,SHIFT:16,CTRL:17,ALT:18,PAGE_UP:33,PAGE_DOWN:34,HOME:36,END:35,BACKSPACE:8,DELETE:46,isArrow:function(e){e=e.which?e.which:e;switch(e){case l.LEFT:case l.RIGHT:case l.UP:case l.DOWN:return true}return false},isControl:function(e){var t=e.which;switch(t){case l.SHIFT:case l.CTRL:case l.ALT:return true}if(e.metaKey)return true;return false},isFunctionKey:function(e){e=e.which?e.which:e;return e>=112&&e<=123}},c="<div class='select2-measure-scrollbar'></div>",h={"Ⓐ":"A","A":"A","À":"A","Á":"A","Â":"A","Ầ":"A","Ấ":"A","Ẫ":"A","Ẩ":"A","Ã":"A","Ā":"A","Ă":"A","Ằ":"A","Ắ":"A","Ẵ":"A","Ẳ":"A","Ȧ":"A","Ǡ":"A","Ä":"A","Ǟ":"A","Ả":"A","Å":"A","Ǻ":"A","Ǎ":"A","Ȁ":"A","Ȃ":"A","Ạ":"A","Ậ":"A","Ặ":"A","Ḁ":"A","Ą":"A","Ⱥ":"A","Ɐ":"A","Ꜳ":"AA","Æ":"AE","Ǽ":"AE","Ǣ":"AE","Ꜵ":"AO","Ꜷ":"AU","Ꜹ":"AV","Ꜻ":"AV","Ꜽ":"AY","Ⓑ":"B","B":"B","Ḃ":"B","Ḅ":"B","Ḇ":"B","Ƀ":"B","Ƃ":"B","Ɓ":"B","Ⓒ":"C","C":"C","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","Ç":"C","Ḉ":"C","Ƈ":"C","Ȼ":"C","Ꜿ":"C","Ⓓ":"D","D":"D","Ḋ":"D","Ď":"D","Ḍ":"D","Ḑ":"D","Ḓ":"D","Ḏ":"D","Đ":"D","Ƌ":"D","Ɗ":"D","Ɖ":"D","Ꝺ":"D","DZ":"DZ","DŽ":"DZ","Dz":"Dz","Dž":"Dz","Ⓔ":"E","E":"E","È":"E","É":"E","Ê":"E","Ề":"E","Ế":"E","Ễ":"E","Ể":"E","Ẽ":"E","Ē":"E","Ḕ":"E","Ḗ":"E","Ĕ":"E","Ė":"E","Ë":"E","Ẻ":"E","Ě":"E","Ȅ":"E","Ȇ":"E","Ẹ":"E","Ệ":"E","Ȩ":"E","Ḝ":"E","Ę":"E","Ḙ":"E","Ḛ":"E","Ɛ":"E","Ǝ":"E","Ⓕ":"F","F":"F","Ḟ":"F","Ƒ":"F","Ꝼ":"F","Ⓖ":"G","G":"G","Ǵ":"G","Ĝ":"G","Ḡ":"G","Ğ":"G","Ġ":"G","Ǧ":"G","Ģ":"G","Ǥ":"G","Ɠ":"G","Ꞡ":"G","Ᵹ":"G","Ꝿ":"G","Ⓗ":"H","H":"H","Ĥ":"H","Ḣ":"H","Ḧ":"H","Ȟ":"H","Ḥ":"H","Ḩ":"H","Ḫ":"H","Ħ":"H","Ⱨ":"H","Ⱶ":"H","Ɥ":"H","Ⓘ":"I","I":"I","Ì":"I","Í":"I","Î":"I","Ĩ":"I","Ī":"I","Ĭ":"I","İ":"I","Ï":"I","Ḯ":"I","Ỉ":"I","Ǐ":"I","Ȉ":"I","Ȋ":"I","Ị":"I","Į":"I","Ḭ":"I","Ɨ":"I","Ⓙ":"J","J":"J","Ĵ":"J","Ɉ":"J","Ⓚ":"K","K":"K","Ḱ":"K","Ǩ":"K","Ḳ":"K","Ķ":"K","Ḵ":"K","Ƙ":"K","Ⱪ":"K","Ꝁ":"K","Ꝃ":"K","Ꝅ":"K","Ꞣ":"K","Ⓛ":"L","L":"L","Ŀ":"L","Ĺ":"L","Ľ":"L","Ḷ":"L","Ḹ":"L","Ļ":"L","Ḽ":"L","Ḻ":"L","Ł":"L","Ƚ":"L","Ɫ":"L","Ⱡ":"L","Ꝉ":"L","Ꝇ":"L","Ꞁ":"L","LJ":"LJ","Lj":"Lj","Ⓜ":"M","M":"M","Ḿ":"M","Ṁ":"M","Ṃ":"M","Ɱ":"M","Ɯ":"M","Ⓝ":"N","N":"N","Ǹ":"N","Ń":"N","Ñ":"N","Ṅ":"N","Ň":"N","Ṇ":"N","Ņ":"N","Ṋ":"N","Ṉ":"N","Ƞ":"N","Ɲ":"N","Ꞑ":"N","Ꞥ":"N","NJ":"NJ","Nj":"Nj","Ⓞ":"O","O":"O","Ò":"O","Ó":"O","Ô":"O","Ồ":"O","Ố":"O","Ỗ":"O","Ổ":"O","Õ":"O","Ṍ":"O","Ȭ":"O","Ṏ":"O","Ō":"O","Ṑ":"O","Ṓ":"O","Ŏ":"O","Ȯ":"O","Ȱ":"O","Ö":"O","Ȫ":"O","Ỏ":"O","Ő":"O","Ǒ":"O","Ȍ":"O","Ȏ":"O","Ơ":"O","Ờ":"O","Ớ":"O","Ỡ":"O","Ở":"O","Ợ":"O","Ọ":"O","Ộ":"O","Ǫ":"O","Ǭ":"O","Ø":"O","Ǿ":"O","Ɔ":"O","Ɵ":"O","Ꝋ":"O","Ꝍ":"O","Ƣ":"OI","Ꝏ":"OO","Ȣ":"OU","Ⓟ":"P","P":"P","Ṕ":"P","Ṗ":"P","Ƥ":"P","Ᵽ":"P","Ꝑ":"P","Ꝓ":"P","Ꝕ":"P","Ⓠ":"Q","Q":"Q","Ꝗ":"Q","Ꝙ":"Q","Ɋ":"Q","Ⓡ":"R","R":"R","Ŕ":"R","Ṙ":"R","Ř":"R","Ȑ":"R","Ȓ":"R","Ṛ":"R","Ṝ":"R","Ŗ":"R","Ṟ":"R","Ɍ":"R","Ɽ":"R","Ꝛ":"R","Ꞧ":"R","Ꞃ":"R","Ⓢ":"S","S":"S","ẞ":"S","Ś":"S","Ṥ":"S","Ŝ":"S","Ṡ":"S","Š":"S","Ṧ":"S","Ṣ":"S","Ṩ":"S","Ș":"S","Ş":"S","Ȿ":"S","Ꞩ":"S","Ꞅ":"S","Ⓣ":"T","T":"T","Ṫ":"T","Ť":"T","Ṭ":"T","Ț":"T","Ţ":"T","Ṱ":"T","Ṯ":"T","Ŧ":"T","Ƭ":"T","Ʈ":"T","Ⱦ":"T","Ꞇ":"T","Ꜩ":"TZ","Ⓤ":"U","U":"U","Ù":"U","Ú":"U","Û":"U","Ũ":"U","Ṹ":"U","Ū":"U","Ṻ":"U","Ŭ":"U","Ü":"U","Ǜ":"U","Ǘ":"U","Ǖ":"U","Ǚ":"U","Ủ":"U","Ů":"U","Ű":"U","Ǔ":"U","Ȕ":"U","Ȗ":"U","Ư":"U","Ừ":"U","Ứ":"U","Ữ":"U","Ử":"U","Ự":"U","Ụ":"U","Ṳ":"U","Ų":"U","Ṷ":"U","Ṵ":"U","Ʉ":"U","Ⓥ":"V","V":"V","Ṽ":"V","Ṿ":"V","Ʋ":"V","Ꝟ":"V","Ʌ":"V","Ꝡ":"VY","Ⓦ":"W","W":"W","Ẁ":"W","Ẃ":"W","Ŵ":"W","Ẇ":"W","Ẅ":"W","Ẉ":"W","Ⱳ":"W","Ⓧ":"X","X":"X","Ẋ":"X","Ẍ":"X","Ⓨ":"Y","Y":"Y","Ỳ":"Y","Ý":"Y","Ŷ":"Y","Ỹ":"Y","Ȳ":"Y","Ẏ":"Y","Ÿ":"Y","Ỷ":"Y","Ỵ":"Y","Ƴ":"Y","Ɏ":"Y","Ỿ":"Y","Ⓩ":"Z","Z":"Z","Ź":"Z","Ẑ":"Z","Ż":"Z","Ž":"Z","Ẓ":"Z","Ẕ":"Z","Ƶ":"Z","Ȥ":"Z","Ɀ":"Z","Ⱬ":"Z","Ꝣ":"Z","ⓐ":"a","a":"a","ẚ":"a","à":"a","á":"a","â":"a","ầ":"a","ấ":"a","ẫ":"a","ẩ":"a","ã":"a","ā":"a","ă":"a","ằ":"a","ắ":"a","ẵ":"a","ẳ":"a","ȧ":"a","ǡ":"a","ä":"a","ǟ":"a","ả":"a","å":"a","ǻ":"a","ǎ":"a","ȁ":"a","ȃ":"a","ạ":"a","ậ":"a","ặ":"a","ḁ":"a","ą":"a","ⱥ":"a","ɐ":"a","ꜳ":"aa","æ":"ae","ǽ":"ae","ǣ":"ae","ꜵ":"ao","ꜷ":"au","ꜹ":"av","ꜻ":"av","ꜽ":"ay","ⓑ":"b","b":"b","ḃ":"b","ḅ":"b","ḇ":"b","ƀ":"b","ƃ":"b","ɓ":"b","ⓒ":"c","c":"c","ć":"c","ĉ":"c","ċ":"c","č":"c","ç":"c","ḉ":"c","ƈ":"c","ȼ":"c","ꜿ":"c","ↄ":"c","ⓓ":"d","d":"d","ḋ":"d","ď":"d","ḍ":"d","ḑ":"d","ḓ":"d","ḏ":"d","đ":"d","ƌ":"d","ɖ":"d","ɗ":"d","ꝺ":"d","dz":"dz","dž":"dz","ⓔ":"e","e":"e","è":"e","é":"e","ê":"e","ề":"e","ế":"e","ễ":"e","ể":"e","ẽ":"e","ē":"e","ḕ":"e","ḗ":"e","ĕ":"e","ė":"e","ë":"e","ẻ":"e","ě":"e","ȅ":"e","ȇ":"e","ẹ":"e","ệ":"e","ȩ":"e","ḝ":"e","ę":"e","ḙ":"e","ḛ":"e","ɇ":"e","ɛ":"e","ǝ":"e","ⓕ":"f","f":"f","ḟ":"f","ƒ":"f","ꝼ":"f","ⓖ":"g","g":"g","ǵ":"g","ĝ":"g","ḡ":"g","ğ":"g","ġ":"g","ǧ":"g","ģ":"g","ǥ":"g","ɠ":"g","ꞡ":"g","ᵹ":"g","ꝿ":"g","ⓗ":"h","h":"h","ĥ":"h","ḣ":"h","ḧ":"h","ȟ":"h","ḥ":"h","ḩ":"h","ḫ":"h","ẖ":"h","ħ":"h","ⱨ":"h","ⱶ":"h","ɥ":"h","ƕ":"hv","ⓘ":"i","i":"i","ì":"i","í":"i","î":"i","ĩ":"i","ī":"i","ĭ":"i","ï":"i","ḯ":"i","ỉ":"i","ǐ":"i","ȉ":"i","ȋ":"i","ị":"i","į":"i","ḭ":"i","ɨ":"i","ı":"i","ⓙ":"j","j":"j","ĵ":"j","ǰ":"j","ɉ":"j","ⓚ":"k","k":"k","ḱ":"k","ǩ":"k","ḳ":"k","ķ":"k","ḵ":"k","ƙ":"k","ⱪ":"k","ꝁ":"k","ꝃ":"k","ꝅ":"k","ꞣ":"k","ⓛ":"l","l":"l","ŀ":"l","ĺ":"l","ľ":"l","ḷ":"l","ḹ":"l","ļ":"l","ḽ":"l","ḻ":"l","ſ":"l","ł":"l","ƚ":"l","ɫ":"l","ⱡ":"l","ꝉ":"l","ꞁ":"l","ꝇ":"l","lj":"lj","ⓜ":"m","m":"m","ḿ":"m","ṁ":"m","ṃ":"m","ɱ":"m","ɯ":"m","ⓝ":"n","n":"n","ǹ":"n","ń":"n","ñ":"n","ṅ":"n","ň":"n","ṇ":"n","ņ":"n","ṋ":"n","ṉ":"n","ƞ":"n","ɲ":"n","ʼn":"n","ꞑ":"n","ꞥ":"n","nj":"nj","ⓞ":"o","o":"o","ò":"o","ó":"o","ô":"o","ồ":"o","ố":"o","ỗ":"o","ổ":"o","õ":"o","ṍ":"o","ȭ":"o","ṏ":"o","ō":"o","ṑ":"o","ṓ":"o","ŏ":"o","ȯ":"o","ȱ":"o","ö":"o","ȫ":"o","ỏ":"o","ő":"o","ǒ":"o","ȍ":"o","ȏ":"o","ơ":"o","ờ":"o","ớ":"o","ỡ":"o","ở":"o","ợ":"o","ọ":"o","ộ":"o","ǫ":"o","ǭ":"o","ø":"o","ǿ":"o","ɔ":"o","ꝋ":"o","ꝍ":"o","ɵ":"o","ƣ":"oi","ȣ":"ou","ꝏ":"oo","ⓟ":"p","p":"p","ṕ":"p","ṗ":"p","ƥ":"p","ᵽ":"p","ꝑ":"p","ꝓ":"p","ꝕ":"p","ⓠ":"q","q":"q","ɋ":"q","ꝗ":"q","ꝙ":"q","ⓡ":"r","r":"r","ŕ":"r","ṙ":"r","ř":"r","ȑ":"r","ȓ":"r","ṛ":"r","ṝ":"r","ŗ":"r","ṟ":"r","ɍ":"r","ɽ":"r","ꝛ":"r","ꞧ":"r","ꞃ":"r","ⓢ":"s","s":"s","ß":"s","ś":"s","ṥ":"s","ŝ":"s","ṡ":"s","š":"s","ṧ":"s","ṣ":"s","ṩ":"s","ș":"s","ş":"s","ȿ":"s","ꞩ":"s","ꞅ":"s","ẛ":"s","ⓣ":"t","t":"t","ṫ":"t","ẗ":"t","ť":"t","ṭ":"t","ț":"t","ţ":"t","ṱ":"t","ṯ":"t","ŧ":"t","ƭ":"t","ʈ":"t","ⱦ":"t","ꞇ":"t","ꜩ":"tz","ⓤ":"u","u":"u","ù":"u","ú":"u","û":"u","ũ":"u","ṹ":"u","ū":"u","ṻ":"u","ŭ":"u","ü":"u","ǜ":"u","ǘ":"u","ǖ":"u","ǚ":"u","ủ":"u","ů":"u","ű":"u","ǔ":"u","ȕ":"u","ȗ":"u","ư":"u","ừ":"u","ứ":"u","ữ":"u","ử":"u","ự":"u","ụ":"u","ṳ":"u","ų":"u","ṷ":"u","ṵ":"u","ʉ":"u","ⓥ":"v","v":"v","ṽ":"v","ṿ":"v","ʋ":"v","ꝟ":"v","ʌ":"v","ꝡ":"vy","ⓦ":"w","w":"w","ẁ":"w","ẃ":"w","ŵ":"w","ẇ":"w","ẅ":"w","ẘ":"w","ẉ":"w","ⱳ":"w","ⓧ":"x","x":"x","ẋ":"x","ẍ":"x","ⓨ":"y","y":"y","ỳ":"y","ý":"y","ŷ":"y","ỹ":"y","ȳ":"y","ẏ":"y","ÿ":"y","ỷ":"y","ẙ":"y","ỵ":"y","ƴ":"y","ɏ":"y","ỿ":"y","ⓩ":"z","z":"z","ź":"z","ẑ":"z","ż":"z","ž":"z","ẓ":"z","ẕ":"z","ƶ":"z","ȥ":"z","ɀ":"z","ⱬ":"z","ꝣ":"z","Ά":"Α","Έ":"Ε","Ή":"Η","Ί":"Ι","Ϊ":"Ι","Ό":"Ο","Ύ":"Υ","Ϋ":"Υ","Ώ":"Ω","ά":"α","έ":"ε","ή":"η","ί":"ι","ϊ":"ι","ΐ":"ι","ό":"ο","ύ":"υ","ϋ":"υ","ΰ":"υ","ω":"ω","ς":"σ"};a=e(document);s=function(){var e=1;return function(){return e++}}();n=q(Object,{bind:function(e){var t=this;return function(){e.apply(t,arguments)}},init:function(n){var r,i,o=".select2-results";this.opts=n=this.prepareOpts(n);this.id=n.id;if(n.element.data("select2")!==t&&n.element.data("select2")!==null){n.element.data("select2").destroy()}this.container=this.createContainer();this.liveRegion=e(".select2-hidden-accessible");if(this.liveRegion.length==0){this.liveRegion=e("<span>",{role:"status","aria-live":"polite"}).addClass("select2-hidden-accessible").appendTo(document.body)}this.containerId="s2id_"+(n.element.attr("id")||"autogen"+s());this.containerEventName=this.containerId.replace(/([.])/g,"_").replace(/([;&,\-\.\+\*\~':"\!\^#$%@\[\]\(\)=>\|])/g,"\\$1");this.container.attr("id",this.containerId);this.container.attr("title",n.element.attr("title"));this.body=e(document.body);A(this.container,this.opts.element,this.opts.adaptContainerCssClass);this.container.attr("style",n.element.attr("style"));this.container.css(B(n.containerCss,this.opts.element));this.container.addClass(B(n.containerCssClass,this.opts.element));this.elementTabIndex=this.opts.element.attr("tabindex");this.opts.element.data("select2",this).attr("tabindex","-1").before(this.container).on("click.select2",C);this.container.data("select2",this);this.dropdown=this.container.find(".select2-drop");A(this.dropdown,this.opts.element,this.opts.adaptDropdownCssClass);this.dropdown.addClass(B(n.dropdownCssClass,this.opts.element));this.dropdown.data("select2",this);this.dropdown.on("click",C);this.results=r=this.container.find(o);this.search=i=this.container.find("input.select2-input");this.queryCount=0;this.resultsPage=0;this.context=null;this.initContainer();this.container.on("click",C);E(this.results);this.dropdown.on("mousemove-filtered",o,this.bind(this.highlightUnderEvent));this.dropdown.on("touchstart touchmove touchend",o,this.bind(function(e){this._touchEvent=true;this.highlightUnderEvent(e)}));this.dropdown.on("touchmove",o,this.bind(this.touchMoved));this.dropdown.on("touchstart touchend",o,this.bind(this.clearTouchMoved));this.dropdown.on("click",this.bind(function(e){if(this._touchEvent){this._touchEvent=false;this.selectHighlighted()}}));x(80,this.results);this.dropdown.on("scroll-debounced",o,this.bind(this.loadMoreIfNeeded));e(this.container).on("change",".select2-input",function(e){e.stopPropagation()});e(this.dropdown).on("change",".select2-input",function(e){e.stopPropagation()});if(e.fn.mousewheel){r.mousewheel(function(e,t,n,i){var s=r.scrollTop();if(i>0&&s-i<=0){r.scrollTop(0);C(e)}else if(i<0&&r.get(0).scrollHeight-r.scrollTop()+i<=r.height()){r.scrollTop(r.get(0).scrollHeight-r.height());C(e)}})}w(i);i.on("keyup-change input paste",this.bind(this.updateResults));i.on("focus",function(){i.addClass("select2-focused")});i.on("blur",function(){i.removeClass("select2-focused")});this.dropdown.on("mouseup",o,this.bind(function(t){if(e(t.target).closest(".select2-result-selectable").length>0){this.highlightUnderEvent(t);this.selectHighlighted(t)}}));this.dropdown.on("click mouseup mousedown touchstart touchend focusin",function(e){e.stopPropagation()});this.lastSearchTerm=t;if(e.isFunction(this.opts.initSelection)){this.initSelection();this.monitorSource()}if(n.maximumInputLength!==null){this.search.attr("maxlength",n.maximumInputLength)}var u=n.element.prop("disabled");if(u===t)u=false;this.enable(!u);var a=n.element.prop("readonly");if(a===t)a=false;this.readonly(a);f=f||m();this.autofocus=n.element.prop("autofocus");n.element.prop("autofocus",false);if(this.autofocus)this.focus();this.search.attr("placeholder",n.searchInputPlaceholder)},destroy:function(){var e=this.opts.element,n=e.data("select2"),r=this;this.close();if(e.length&&e[0].detachEvent&&r._sync){e.each(function(){if(r._sync){this.detachEvent("onpropertychange",r._sync)}})}if(this.propertyObserver){this.propertyObserver.disconnect();this.propertyObserver=null}this._sync=null;if(n!==t){n.container.remove();n.liveRegion.remove();n.dropdown.remove();e.show().removeData("select2").off(".select2").prop("autofocus",this.autofocus||false);if(this.elementTabIndex){e.attr({tabindex:this.elementTabIndex})}else{e.removeAttr("tabindex")}e.show()}I.call(this,"container","liveRegion","dropdown","results","search")},optionToData:function(e){if(e.is("option")){return{id:e.prop("value"),text:e.text(),element:e.get(),css:e.attr("class"),disabled:e.prop("disabled"),locked:g(e.attr("locked"),"locked")||g(e.data("locked"),true)}}else if(e.is("optgroup")){return{text:e.attr("label"),children:[],element:e.get(),css:e.attr("class")}}},prepareOpts:function(n){var r,i,o,u,a=this;r=n.element;if(r.get(0).tagName.toLowerCase()==="select"){this.select=i=n.element}if(i){e.each(["id","multiple","ajax","query","createSearchChoice","initSelection","data","tags"],function(){if(this in n){throw new Error("Option '"+this+"' is not allowed for Select2 when attached to a <select> element.")}})}n=e.extend({},{populateResults:function(r,i,o){var u,f=this.opts.id,l=this.liveRegion;u=function(r,i,c){var h,p,d,v,m,g,y,b,w,E;r=n.sortResults(r,i,o);var S=[];for(h=0,p=r.length;h<p;h=h+1){d=r[h];m=d.disabled===true;v=!m&&f(d)!==t;g=d.children&&d.children.length>0;y=e("<li></li>");y.addClass("select2-results-dept-"+c);y.addClass("select2-result");y.addClass(v?"select2-result-selectable":"select2-result-unselectable");if(m){y.addClass("select2-disabled")}if(g){y.addClass("select2-result-with-children")}y.addClass(a.opts.formatResultCssClass(d));y.attr("role","presentation");b=e(document.createElement("div"));b.addClass("select2-result-label");b.attr("id","select2-result-label-"+s());b.attr("role","option");E=n.formatResult(d,b,o,a.opts.escapeMarkup);if(E!==t){b.html(E);y.append(b)}if(g){w=e("<ul></ul>");w.addClass("select2-result-sub");u(d.children,w,c+1);y.append(w)}y.data("select2-data",d);S.push(y[0])}i.append(S);l.text(n.formatMatches(r.length))};u(i,r,0)}},e.fn.select2.defaults,n);if(typeof n.id!=="function"){o=n.id;n.id=function(e){return e[o]}}if(e.isArray(n.element.data("select2Tags"))){if("tags"in n){throw"tags specified as both an attribute 'data-select2-tags' and in options of Select2 "+n.element.attr("id")}n.tags=n.element.data("select2Tags")}if(i){n.query=this.bind(function(e){var n={results:[],more:false},i=e.term,s,o,u;u=function(t,n){var r;if(t.is("option")){if(e.matcher(i,t.text(),t)){n.push(a.optionToData(t))}}else if(t.is("optgroup")){r=a.optionToData(t);t.children().each2(function(e,t){u(t,r.children)});if(r.children.length>0){n.push(r)}}};s=r.children();if(this.getPlaceholder()!==t&&s.length>0){o=this.getPlaceholderOption();if(o){s=s.not(o)}}s.each2(function(e,t){u(t,n.results)});e.callback(n)});n.id=function(e){return e.id}}else{if(!("query"in n)){if("ajax"in n){u=n.element.data("ajax-url");if(u&&u.length>0){n.ajax.url=u}n.query=_.call(n.element,n.ajax)}else if("data"in n){n.query=D(n.data)}else if("tags"in n){n.query=P(n.tags);if(n.createSearchChoice===t){n.createSearchChoice=function(t){return{id:e.trim(t),text:e.trim(t)}}}if(n.initSelection===t){n.initSelection=function(t,r){var i=[];e(y(t.val(),n.separator,n.transformVal)).each(function(){var t={id:this,text:this},r=n.tags;if(e.isFunction(r))r=r();e(r).each(function(){if(g(this.id,t.id)){t=this;return false}});i.push(t)});r(i)}}}}}if(typeof n.query!=="function"){throw"query function not defined for Select2 "+n.element.attr("id")}if(n.createSearchChoicePosition==="top"){n.createSearchChoicePosition=function(e,t){e.unshift(t)}}else if(n.createSearchChoicePosition==="bottom"){n.createSearchChoicePosition=function(e,t){e.push(t)}}else if(typeof n.createSearchChoicePosition!=="function"){throw"invalid createSearchChoicePosition option must be 'top', 'bottom' or a custom function"}return n},monitorSource:function(){var n=this.opts.element,r,i=this;n.on("change.select2",this.bind(function(e){if(this.opts.element.data("select2-change-triggered")!==true){this.initSelection()}}));this._sync=this.bind(function(){var e=n.prop("disabled");if(e===t)e=false;this.enable(!e);var r=n.prop("readonly");if(r===t)r=false;this.readonly(r);if(this.container){A(this.container,this.opts.element,this.opts.adaptContainerCssClass);this.container.addClass(B(this.opts.containerCssClass,this.opts.element))}if(this.dropdown){A(this.dropdown,this.opts.element,this.opts.adaptDropdownCssClass);this.dropdown.addClass(B(this.opts.dropdownCssClass,this.opts.element))}});if(n.length&&n[0].attachEvent){n.each(function(){this.attachEvent("onpropertychange",i._sync)})}r=window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver;if(r!==t){if(this.propertyObserver){delete this.propertyObserver;this.propertyObserver=null}this.propertyObserver=new r(function(t){e.each(t,i._sync)});this.propertyObserver.observe(n.get(0),{attributes:true,subtree:false})}},triggerSelect:function(t){var n=e.Event("select2-selecting",{val:this.id(t),object:t,choice:t});this.opts.element.trigger(n);return!n.isDefaultPrevented()},triggerChange:function(t){t=t||{};t=e.extend({},t,{type:"change",val:this.val()});this.opts.element.data("select2-change-triggered",true);this.opts.element.trigger(t);this.opts.element.data("select2-change-triggered",false);this.opts.element.click();if(this.opts.blurOnChange)this.opts.element.blur()},isInterfaceEnabled:function(){return this.enabledInterface===true},enableInterface:function(){var e=this._enabled&&!this._readonly,t=!e;if(e===this.enabledInterface)return false;this.container.toggleClass("select2-container-disabled",t);this.close();this.enabledInterface=e;return true},enable:function(e){if(e===t)e=true;if(this._enabled===e)return;this._enabled=e;this.opts.element.prop("disabled",!e);this.enableInterface()},disable:function(){this.enable(false)},readonly:function(e){if(e===t)e=false;if(this._readonly===e)return;this._readonly=e;this.opts.element.prop("readonly",e);this.enableInterface()},opened:function(){return this.container?this.container.hasClass("select2-dropdown-open"):false},positionDropdown:function(){var t=this.dropdown,n=this.container,r=n.offset(),i=n.outerHeight(false),s=n.outerWidth(false),o=t.outerHeight(false),u=e(window),a=u.width(),l=u.height(),c=u.scrollLeft()+a,h=u.scrollTop()+l,p=r.top+i,d=r.left,v=p+o<=h,m=r.top-o>=u.scrollTop(),g=t.outerWidth(false),y=function(){return d+g<=c},b=function(){return r.left+c+n.outerWidth(false)>g},w=t.hasClass("select2-drop-above"),E,S,x,T,N;if(w){S=true;if(!m&&v){x=true;S=false}}else{S=false;if(!v&&m){x=true;S=true}}if(x){t.hide();r=this.container.offset();i=this.container.outerHeight(false);s=this.container.outerWidth(false);o=t.outerHeight(false);c=u.scrollLeft()+a;h=u.scrollTop()+l;p=r.top+i;d=r.left;g=t.outerWidth(false);t.show();this.focusSearch()}if(this.opts.dropdownAutoWidth){N=e(".select2-results",t)[0];t.addClass("select2-drop-auto-width");t.css("width","");g=t.outerWidth(false)+(N.scrollHeight===N.clientHeight?0:f.width);g>s?s=g:g=s;o=t.outerHeight(false)}else{this.container.removeClass("select2-drop-auto-width")}if(this.body.css("position")!=="static"){E=this.body.offset();p-=E.top;d-=E.left}if(!y()&&b()){d=r.left+this.container.outerWidth(false)-g}T={left:d,width:s};if(S){this.container.addClass("select2-drop-above");t.addClass("select2-drop-above");o=t.outerHeight(false);T.top=r.top-o;T.bottom="auto"}else{T.top=p;T.bottom="auto";this.container.removeClass("select2-drop-above");t.removeClass("select2-drop-above")}T=e.extend(T,B(this.opts.dropdownCss,this.opts.element));t.css(T)},shouldOpen:function(){var t;if(this.opened())return false;if(this._enabled===false||this._readonly===true)return false;t=e.Event("select2-opening");this.opts.element.trigger(t);return!t.isDefaultPrevented()},clearDropdownAlignmentPreference:function(){this.container.removeClass("select2-drop-above");this.dropdown.removeClass("select2-drop-above")},open:function(){if(!this.shouldOpen())return false;this.opening();a.on("mousemove.select2Event",function(e){u.x=e.pageX;u.y=e.pageY});return true},opening:function(){var t=this.containerEventName,n="scroll."+t,r="resize."+t,i="orientationchange."+t,s;this.container.addClass("select2-dropdown-open").addClass("select2-container-active");this.clearDropdownAlignmentPreference();if(this.dropdown[0]!==this.body.children().last()[0]){this.dropdown.detach().appendTo(this.body)}s=e("#select2-drop-mask");if(s.length===0){s=e(document.createElement("div"));s.attr("id","select2-drop-mask").attr("class","select2-drop-mask");s.hide();s.appendTo(this.body);s.on("mousedown touchstart click",function(t){p(s);var n=e("#select2-drop"),r;if(n.length>0){r=n.data("select2");if(r.opts.selectOnBlur){r.selectHighlighted({noFocus:true})}r.close();t.preventDefault();t.stopPropagation()}})}if(this.dropdown.prev()[0]!==s[0]){this.dropdown.before(s)}e("#select2-drop").removeAttr("id");this.dropdown.attr("id","select2-drop");s.show();this.positionDropdown();this.dropdown.show();this.positionDropdown();this.dropdown.addClass("select2-drop-active");var o=this;this.container.parents().add(window).each(function(){e(this).on(r+" "+n+" "+i,function(e){if(o.opened())o.positionDropdown()})})},close:function(){if(!this.opened())return;var t=this.containerEventName,n="scroll."+t,r="resize."+t,i="orientationchange."+t;this.container.parents().add(window).each(function(){e(this).off(n).off(r).off(i)});this.clearDropdownAlignmentPreference();e("#select2-drop-mask").hide();this.dropdown.removeAttr("id");this.dropdown.hide();this.container.removeClass("select2-dropdown-open").removeClass("select2-container-active");this.results.empty();a.off("mousemove.select2Event");this.clearSearch();this.search.removeClass("select2-active");this.opts.element.trigger(e.Event("select2-close"))},externalSearch:function(e){this.open();this.search.val(e);this.updateResults(false)},clearSearch:function(){},prefillNextSearchTerm:function(){if(this.search.val()!==""){return false}var e=this.opts.nextSearchTerm(this.data(),this.lastSearchTerm);if(e!==t){this.search.val(e);this.search.select();return true}return false},getMaximumSelectionSize:function(){return B(this.opts.maximumSelectionSize,this.opts.element)},ensureHighlightVisible:function(){var t=this.results,n,r,i,s,o,u,a,f;r=this.highlight();if(r<0)return;if(r==0){t.scrollTop(0);return}n=this.findHighlightableChoices().find(".select2-result-label");i=e(n[r]);f=(i.offset()||{}).top||0;s=f+i.outerHeight(true);if(r===n.length-1){a=t.find("li.select2-more-results");if(a.length>0){s=a.offset().top+a.outerHeight(true)}}o=t.offset().top+t.outerHeight(false);if(s>o){t.scrollTop(t.scrollTop()+(s-o))}u=f-t.offset().top;if(u<0&&i.css("display")!="none"){t.scrollTop(t.scrollTop()+u)}},findHighlightableChoices:function(){return this.results.find(".select2-result-selectable:not(.select2-disabled):not(.select2-selected)")},moveHighlight:function(t){var n=this.findHighlightableChoices(),r=this.highlight();while(r>-1&&r<n.length){r+=t;var i=e(n[r]);if(i.hasClass("select2-result-selectable")&&!i.hasClass("select2-disabled")&&!i.hasClass("select2-selected")){this.highlight(r);break}}},highlight:function(t){var n=this.findHighlightableChoices(),r,i;if(arguments.length===0){return v(n.filter(".select2-highlighted")[0],n.get())}if(t>=n.length)t=n.length-1;if(t<0)t=0;this.removeHighlight();r=e(n[t]);r.addClass("select2-highlighted");this.search.attr("aria-activedescendant",r.find(".select2-result-label").attr("id"));this.ensureHighlightVisible();this.liveRegion.text(r.text());i=r.data("select2-data");if(i){this.opts.element.trigger({type:"select2-highlight",val:this.id(i),choice:i})}},removeHighlight:function(){this.results.find(".select2-highlighted").removeClass("select2-highlighted")},touchMoved:function(){this._touchMoved=true},clearTouchMoved:function(){this._touchMoved=false},countSelectableResults:function(){return this.findHighlightableChoices().length},highlightUnderEvent:function(t){var n=e(t.target).closest(".select2-result-selectable");if(n.length>0&&!n.is(".select2-highlighted")){var r=this.findHighlightableChoices();this.highlight(r.index(n))}else if(n.length==0){this.removeHighlight()}},loadMoreIfNeeded:function(){var e=this.results,t=e.find("li.select2-more-results"),n,r=this.resultsPage+1,i=this,s=this.search.val(),o=this.context;if(t.length===0)return;n=t.offset().top-e.offset().top-e.height();if(n<=this.opts.loadMorePadding){t.addClass("select2-active");this.opts.query({element:this.opts.element,term:s,page:r,context:o,matcher:this.opts.matcher,callback:this.bind(function(n){if(!i.opened())return;i.opts.populateResults.call(this,e,n.results,{term:s,page:r,context:o});i.postprocessResults(n,false,false);if(n.more===true){t.detach().appendTo(e).html(i.opts.escapeMarkup(B(i.opts.formatLoadMore,i.opts.element,r+1)));window.setTimeout(function(){i.loadMoreIfNeeded()},10)}else{t.remove()}i.positionDropdown();i.resultsPage=r;i.context=n.context;this.opts.element.trigger({type:"select2-loaded",items:n})})})}},tokenize:function(){},updateResults:function(n){function h(){r.removeClass("select2-active");u.positionDropdown();if(i.find(".select2-no-results,.select2-selection-limit,.select2-searching").length){u.liveRegion.text(i.text())}else{u.liveRegion.text(u.opts.formatMatches(i.find('.select2-result-selectable:not(".select2-selected")').length))}}function p(e){i.html(e);h()}var r=this.search,i=this.results,s=this.opts,o,u=this,a,f=r.val(),l=e.data(this.container,"select2-last-term"),c;if(n!==true&&l&&g(f,l))return;e.data(this.container,"select2-last-term",f);if(n!==true&&(this.showSearchInput===false||!this.opened())){return}c=++this.queryCount;var d=this.getMaximumSelectionSize();if(d>=1){o=this.data();if(e.isArray(o)&&o.length>=d&&H(s.formatSelectionTooBig,"formatSelectionTooBig")){p("<li class='select2-selection-limit'>"+B(s.formatSelectionTooBig,s.element,d)+"</li>");return}}if(r.val().length<s.minimumInputLength){if(H(s.formatInputTooShort,"formatInputTooShort")){p("<li class='select2-no-results'>"+B(s.formatInputTooShort,s.element,r.val(),s.minimumInputLength)+"</li>")}else{p("")}if(n&&this.showSearch)this.showSearch(true);return}if(s.maximumInputLength&&r.val().length>s.maximumInputLength){if(H(s.formatInputTooLong,"formatInputTooLong")){p("<li class='select2-no-results'>"+B(s.formatInputTooLong,s.element,r.val(),s.maximumInputLength)+"</li>")}else{p("")}return}if(s.formatSearching&&this.findHighlightableChoices().length===0){p("<li class='select2-searching'>"+B(s.formatSearching,s.element)+"</li>")}r.addClass("select2-active");this.removeHighlight();a=this.tokenize();if(a!=t&&a!=null){r.val(a)}this.resultsPage=1;s.query({element:s.element,term:r.val(),page:this.resultsPage,context:null,matcher:s.matcher,callback:this.bind(function(o){var a;if(c!=this.queryCount){return}if(!this.opened()){this.search.removeClass("select2-active");return}if(o.hasError!==t&&H(s.formatAjaxError,"formatAjaxError")){p("<li class='select2-ajax-error'>"+B(s.formatAjaxError,s.element,o.jqXHR,o.textStatus,o.errorThrown)+"</li>");return}this.context=o.context===t?null:o.context;if(this.opts.createSearchChoice&&r.val()!==""){a=this.opts.createSearchChoice.call(u,r.val(),o.results);if(a!==t&&a!==null&&u.id(a)!==t&&u.id(a)!==null){if(e(o.results).filter(function(){return g(u.id(this),u.id(a))}).length===0){this.opts.createSearchChoicePosition(o.results,a)}}}if(o.results.length===0&&H(s.formatNoMatches,"formatNoMatches")){p("<li class='select2-no-results'>"+B(s.formatNoMatches,s.element,r.val())+"</li>");this.showSearch(r.val());return}i.empty();u.opts.populateResults.call(this,i,o.results,{term:r.val(),page:this.resultsPage,context:null});if(o.more===true&&H(s.formatLoadMore,"formatLoadMore")){i.append("<li class='select2-more-results'>"+s.escapeMarkup(B(s.formatLoadMore,s.element,this.resultsPage))+"</li>");window.setTimeout(function(){u.loadMoreIfNeeded()},10)}this.postprocessResults(o,n);h();this.opts.element.trigger({type:"select2-loaded",items:o})})})},cancel:function(){this.close()},blur:function(){if(this.opts.selectOnBlur)this.selectHighlighted({noFocus:true});this.close();this.container.removeClass("select2-container-active");if(this.search[0]===document.activeElement){this.search.blur()}this.clearSearch();this.selection.find(".select2-search-choice-focus").removeClass("select2-search-choice-focus")},focusSearch:function(){T(this.search)},selectHighlighted:function(e){if(this._touchMoved){this.clearTouchMoved();return}var t=this.highlight(),n=this.results.find(".select2-highlighted"),r=n.closest(".select2-result").data("select2-data");if(r){this.highlight(t);this.onSelect(r,e)}else if(e&&e.noFocus){this.close()}},getPlaceholder:function(){var e;return this.opts.element.attr("placeholder")||this.opts.element.attr("data-placeholder")||this.opts.element.data("placeholder")||this.opts.placeholder||((e=this.getPlaceholderOption())!==t?e.text():t)},getPlaceholderOption:function(){if(this.select){var n=this.select.children("option").first();if(this.opts.placeholderOption!==t){return this.opts.placeholderOption==="first"&&n||typeof this.opts.placeholderOption==="function"&&this.opts.placeholderOption(this.select)}else if(e.trim(n.text())===""&&n.val()===""){return n}}},initContainerWidth:function(){function n(){var n,r,i,s,o,u;if(this.opts.width==="off"){return null}else if(this.opts.width==="element"){return this.opts.element.outerWidth(false)===0?"auto":this.opts.element.outerWidth(false)+"px"}else if(this.opts.width==="copy"||this.opts.width==="resolve"){n=this.opts.element.attr("style");if(n!==t){r=n.split(";");for(s=0,o=r.length;s<o;s=s+1){u=r[s].replace(/\s/g,"");i=u.match(/^width:(([-+]?([0-9]*\.)?[0-9]+)(px|em|ex|%|in|cm|mm|pt|pc))/i);if(i!==null&&i.length>=1)return i[1]}}if(this.opts.width==="resolve"){n=this.opts.element.css("width");if(n.indexOf("%")>0)return n;return this.opts.element.outerWidth(false)===0?"auto":this.opts.element.outerWidth(false)+"px"}return null}else if(e.isFunction(this.opts.width)){return this.opts.width()}else{return this.opts.width}}var r=n.call(this);if(r!==null){this.container.css("width",r)}}});r=q(n,{createContainer:function(){var t=e(document.createElement("div")).attr({"class":"select2-container"}).html(["<a href='javascript:void(0)' class='select2-choice' tabindex='-1'>"," <span class='select2-chosen'> </span><abbr class='select2-search-choice-close'></abbr>"," <span class='select2-arrow' role='presentation'><b role='presentation'></b></span>","</a>","<label for='' class='select2-offscreen'></label>","<input class='select2-focusser select2-offscreen' type='text' aria-haspopup='true' role='button' />","<div class='select2-drop select2-display-none'>"," <div class='select2-search'>"," <label for='' class='select2-offscreen'></label>"," <input type='text' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' class='select2-input' role='combobox' aria-expanded='true'"," aria-autocomplete='list' />"," </div>"," <ul class='select2-results' role='listbox'>"," </ul>","</div>"].join(""));return t},enableInterface:function(){if(this.parent.enableInterface.apply(this,arguments)){this.focusser.prop("disabled",!this.isInterfaceEnabled())}},opening:function(){var t,n,r;if(this.opts.minimumResultsForSearch>=0){this.showSearch(true)}this.parent.opening.apply(this,arguments);if(this.showSearchInput!==false){this.search.val(this.focusser.val())}if(this.opts.shouldFocusInput(this)){this.search.focus();t=this.search.get(0);if(t.createTextRange){n=t.createTextRange();n.collapse(false);n.select()}else if(t.setSelectionRange){r=this.search.val().length;t.setSelectionRange(r,r)}}this.prefillNextSearchTerm();this.focusser.prop("disabled",true).val("");this.updateResults(true);this.opts.element.trigger(e.Event("select2-open"))},close:function(){if(!this.opened())return;this.parent.close.apply(this,arguments);this.focusser.prop("disabled",false);if(this.opts.shouldFocusInput(this)){this.focusser.focus()}},focus:function(){if(this.opened()){this.close()}else{this.focusser.prop("disabled",false);if(this.opts.shouldFocusInput(this)){this.focusser.focus()}}},isFocused:function(){return this.container.hasClass("select2-container-active")},cancel:function(){this.parent.cancel.apply(this,arguments);this.focusser.prop("disabled",false);if(this.opts.shouldFocusInput(this)){this.focusser.focus()}},destroy:function(){e("label[for='"+this.focusser.attr("id")+"']").attr("for",this.opts.element.attr("id"));this.parent.destroy.apply(this,arguments);I.call(this,"selection","focusser")},initContainer:function(){var t,n=this.container,r=this.dropdown,i=s(),o;if(this.opts.minimumResultsForSearch<0){this.showSearch(false)}else{this.showSearch(true)}this.selection=t=n.find(".select2-choice");this.focusser=n.find(".select2-focusser");t.find(".select2-chosen").attr("id","select2-chosen-"+i);this.focusser.attr("aria-labelledby","select2-chosen-"+i);this.results.attr("id","select2-results-"+i);this.search.attr("aria-owns","select2-results-"+i);this.focusser.attr("id","s2id_autogen"+i);o=e("label[for='"+this.opts.element.attr("id")+"']");this.opts.element.focus(this.bind(function(){this.focus()}));this.focusser.prev().text(o.text()).attr("for",this.focusser.attr("id"));var u=this.opts.element.attr("title");this.opts.element.attr("title",u||o.text());this.focusser.attr("tabindex",this.elementTabIndex);this.search.attr("id",this.focusser.attr("id")+"_search");this.search.prev().text(e("label[for='"+this.focusser.attr("id")+"']").text()).attr("for",this.search.attr("id"));this.search.on("keydown",this.bind(function(e){if(!this.isInterfaceEnabled())return;if(229==e.keyCode)return;if(e.which===l.PAGE_UP||e.which===l.PAGE_DOWN){C(e);return}switch(e.which){case l.UP:case l.DOWN:this.moveHighlight(e.which===l.UP?-1:1);C(e);return;case l.ENTER:this.selectHighlighted();C(e);return;case l.TAB:this.selectHighlighted({noFocus:true});return;case l.ESC:this.cancel(e);C(e);return}}));this.search.on("blur",this.bind(function(e){if(document.activeElement===this.body.get(0)){window.setTimeout(this.bind(function(){if(this.opened()){this.search.focus()}}),0)}}));this.focusser.on("keydown",this.bind(function(e){if(!this.isInterfaceEnabled())return;if(e.which===l.TAB||l.isControl(e)||l.isFunctionKey(e)||e.which===l.ESC){return}if(this.opts.openOnEnter===false&&e.which===l.ENTER){C(e);return}if(e.which==l.DOWN||e.which==l.UP||e.which==l.ENTER&&this.opts.openOnEnter){if(e.altKey||e.ctrlKey||e.shiftKey||e.metaKey)return;this.open();C(e);return}if(e.which==l.DELETE||e.which==l.BACKSPACE){if(this.opts.allowClear){this.clear()}C(e);return}}));w(this.focusser);this.focusser.on("keyup-change input",this.bind(function(e){if(this.opts.minimumResultsForSearch>=0){e.stopPropagation();if(this.opened())return;this.open()}}));t.on("mousedown touchstart","abbr",this.bind(function(e){if(!this.isInterfaceEnabled()){return}this.clear();k(e);this.close();if(this.selection){this.selection.focus()}}));t.on("mousedown touchstart",this.bind(function(n){p(t);if(!this.container.hasClass("select2-container-active")){this.opts.element.trigger(e.Event("select2-focus"))}if(this.opened()){this.close()}else if(this.isInterfaceEnabled()){this.open()}C(n)}));r.on("mousedown touchstart",this.bind(function(){if(this.opts.shouldFocusInput(this)){this.search.focus()}}));t.on("focus",this.bind(function(e){C(e)}));this.focusser.on("focus",this.bind(function(){if(!this.container.hasClass("select2-container-active")){this.opts.element.trigger(e.Event("select2-focus"))}this.container.addClass("select2-container-active")})).on("blur",this.bind(function(){if(!this.opened()){this.container.removeClass("select2-container-active");this.opts.element.trigger(e.Event("select2-blur"))}}));this.search.on("focus",this.bind(function(){if(!this.container.hasClass("select2-container-active")){this.opts.element.trigger(e.Event("select2-focus"))}this.container.addClass("select2-container-active")}));this.initContainerWidth();this.opts.element.hide();this.setPlaceholder()},clear:function(t){var n=this.selection.data("select2-data");if(n){var r=e.Event("select2-clearing");this.opts.element.trigger(r);if(r.isDefaultPrevented()){return}var i=this.getPlaceholderOption();this.opts.element.val(i?i.val():"");this.selection.find(".select2-chosen").empty();this.selection.removeData("select2-data");this.setPlaceholder();if(t!==false){this.opts.element.trigger({type:"select2-removed",val:this.id(n),choice:n});this.triggerChange({removed:n})}}},initSelection:function(){var e;if(this.isPlaceholderOptionSelected()){this.updateSelection(null);this.close();this.setPlaceholder()}else{var n=this;this.opts.initSelection.call(null,this.opts.element,function(e){if(e!==t&&e!==null){n.updateSelection(e);n.close();n.setPlaceholder();n.lastSearchTerm=n.search.val()}})}},isPlaceholderOptionSelected:function(){var e;if(this.getPlaceholder()===t)return false;return(e=this.getPlaceholderOption())!==t&&e.prop("selected")||this.opts.element.val()===""||this.opts.element.val()===t||this.opts.element.val()===null},prepareOpts:function(){var t=this.parent.prepareOpts.apply(this,arguments),n=this;if(t.element.get(0).tagName.toLowerCase()==="select"){t.initSelection=function(e,t){var r=e.find("option").filter(function(){return this.selected&&!this.disabled});t(n.optionToData(r))}}else if("data"in t){t.initSelection=t.initSelection||function(n,r){var i=n.val();var s=null;t.query({matcher:function(e,n,r){var o=g(i,t.id(r));if(o){s=r}return o},callback:!e.isFunction(r)?e.noop:function(){r(s)}})}}return t},getPlaceholder:function(){if(this.select){if(this.getPlaceholderOption()===t){return t}}return this.parent.getPlaceholder.apply(this,arguments)},setPlaceholder:function(){var e=this.getPlaceholder();if(this.isPlaceholderOptionSelected()&&e!==t){if(this.select&&this.getPlaceholderOption()===t)return;this.selection.find(".select2-chosen").html(this.opts.escapeMarkup(e));this.selection.addClass("select2-default");this.container.removeClass("select2-allowclear")}},postprocessResults:function(e,t,n){var r=0,i=this,s=true;this.findHighlightableChoices().each2(function(e,t){if(g(i.id(t.data("select2-data")),i.opts.element.val())){r=e;return false}});if(n!==false){if(t===true&&r>=0){this.highlight(r)}else{this.highlight(0)}}if(t===true){var o=this.opts.minimumResultsForSearch;if(o>=0){this.showSearch(j(e.results)>=o)}}},showSearch:function(t){if(this.showSearchInput===t)return;this.showSearchInput=t;this.dropdown.find(".select2-search").toggleClass("select2-search-hidden",!t);this.dropdown.find(".select2-search").toggleClass("select2-offscreen",!t);e(this.dropdown,this.container).toggleClass("select2-with-searchbox",t)},onSelect:function(e,t){if(!this.triggerSelect(e)){return}var n=this.opts.element.val(),r=this.data();this.opts.element.val(this.id(e));this.updateSelection(e);this.opts.element.trigger({type:"select2-selected",val:this.id(e),choice:e});this.lastSearchTerm=this.search.val();this.close();if((!t||!t.noFocus)&&this.opts.shouldFocusInput(this)){this.focusser.focus()}if(!g(n,this.id(e))){this.triggerChange({added:e,removed:r})}},updateSelection:function(e){var n=this.selection.find(".select2-chosen"),r,i;this.selection.data("select2-data",e);n.empty();if(e!==null){r=this.opts.formatSelection(e,n,this.opts.escapeMarkup)}if(r!==t){n.append(r)}i=this.opts.formatSelectionCssClass(e,n);if(i!==t){n.addClass(i)}this.selection.removeClass("select2-default");if(this.opts.allowClear&&this.getPlaceholder()!==t){this.container.addClass("select2-allowclear")}},val:function(){var e,n=false,r=null,i=this,s=this.data();if(arguments.length===0){return this.opts.element.val()}e=arguments[0];if(arguments.length>1){n=arguments[1]}if(this.select){this.select.val(e).find("option").filter(function(){return this.selected}).each2(function(e,t){r=i.optionToData(t);return false});this.updateSelection(r);this.setPlaceholder();if(n){this.triggerChange({added:r,removed:s})}}else{if(!e&&e!==0){this.clear(n);return}if(this.opts.initSelection===t){throw new Error("cannot call val() if initSelection() is not defined")}this.opts.element.val(e);this.opts.initSelection(this.opts.element,function(e){i.opts.element.val(!e?"":i.id(e));i.updateSelection(e);i.setPlaceholder();if(n){i.triggerChange({added:e,removed:s})}})}},clearSearch:function(){this.search.val("");this.focusser.val("")},data:function(e){var n,r=false;if(arguments.length===0){n=this.selection.data("select2-data");if(n==t)n=null;return n}else{if(arguments.length>1){r=arguments[1]}if(!e){this.clear(r)}else{n=this.data();this.opts.element.val(!e?"":this.id(e));this.updateSelection(e);if(r){this.triggerChange({added:e,removed:n})}}}}});i=q(n,{createContainer:function(){var t=e(document.createElement("div")).attr({"class":"select2-container select2-container-multi"}).html(["<ul class='select2-choices'>"," <li class='select2-search-field'>"," <label for='' class='select2-offscreen'></label>"," <input type='text' autocomplete='off' autocorrect='off' autocapitalize='off' spellcheck='false' class='select2-input'>"," </li>","</ul>","<div class='select2-drop select2-drop-multi select2-display-none'>"," <ul class='select2-results'>"," </ul>","</div>"].join(""));return t},prepareOpts:function(){var t=this.parent.prepareOpts.apply(this,arguments),n=this;if(t.element.get(0).tagName.toLowerCase()==="select"){t.initSelection=function(e,t){var r=[];e.find("option").filter(function(){return this.selected&&!this.disabled}).each2(function(e,t){r.push(n.optionToData(t))});t(r)}}else if("data"in t){t.initSelection=t.initSelection||function(n,r){var i=y(n.val(),t.separator,t.transformVal);var s=[];t.query({matcher:function(n,r,o){var u=e.grep(i,function(e){return g(e,t.id(o))}).length;if(u){s.push(o)}return u},callback:!e.isFunction(r)?e.noop:function(){var e=[];for(var n=0;n<i.length;n++){var o=i[n];for(var u=0;u<s.length;u++){var a=s[u];if(g(o,t.id(a))){e.push(a);s.splice(u,1);break}}}r(e)}})}}return t},selectChoice:function(e){var t=this.container.find(".select2-search-choice-focus");if(t.length&&e&&e[0]==t[0]){}else{if(t.length){this.opts.element.trigger("choice-deselected",t)}t.removeClass("select2-search-choice-focus");if(e&&e.length){this.close();e.addClass("select2-search-choice-focus");this.opts.element.trigger("choice-selected",e)}}},destroy:function(){e("label[for='"+this.search.attr("id")+"']").attr("for",this.opts.element.attr("id"));this.parent.destroy.apply(this,arguments);I.call(this,"searchContainer","selection")},initContainer:function(){var t=".select2-choices",n;this.searchContainer=this.container.find(".select2-search-field");this.selection=n=this.container.find(t);var r=this;this.selection.on("click",".select2-container:not(.select2-container-disabled) .select2-search-choice:not(.select2-locked)",function(t){r.search[0].focus();r.selectChoice(e(this))});this.search.attr("id","s2id_autogen"+s());this.search.prev().text(e("label[for='"+this.opts.element.attr("id")+"']").text()).attr("for",this.search.attr("id"));this.opts.element.focus(this.bind(function(){this.focus()}));this.search.on("input paste",this.bind(function(){if(this.search.attr("placeholder")&&this.search.val().length==0)return;if(!this.isInterfaceEnabled())return;if(!this.opened()){this.open()}}));this.search.attr("tabindex",this.elementTabIndex);this.keydowns=0;this.search.on("keydown",this.bind(function(e){if(!this.isInterfaceEnabled())return;++this.keydowns;var t=n.find(".select2-search-choice-focus");var r=t.prev(".select2-search-choice:not(.select2-locked)");var i=t.next(".select2-search-choice:not(.select2-locked)");var s=N(this.search);if(t.length&&(e.which==l.LEFT||e.which==l.RIGHT||e.which==l.BACKSPACE||e.which==l.DELETE||e.which==l.ENTER)){var o=t;if(e.which==l.LEFT&&r.length){o=r}else if(e.which==l.RIGHT){o=i.length?i:null}else if(e.which===l.BACKSPACE){if(this.unselect(t.first())){this.search.width(10);o=r.length?r:i}}else if(e.which==l.DELETE){if(this.unselect(t.first())){this.search.width(10);o=i.length?i:null}}else if(e.which==l.ENTER){o=null}this.selectChoice(o);C(e);if(!o||!o.length){this.open()}return}else if((e.which===l.BACKSPACE&&this.keydowns==1||e.which==l.LEFT)&&s.offset==0&&!s.length){this.selectChoice(n.find(".select2-search-choice:not(.select2-locked)").last());C(e);return}else{this.selectChoice(null)}if(this.opened()){switch(e.which){case l.UP:case l.DOWN:this.moveHighlight(e.which===l.UP?-1:1);C(e);return;case l.ENTER:this.selectHighlighted();C(e);return;case l.TAB:this.selectHighlighted({noFocus:true});this.close();return;case l.ESC:this.cancel(e);C(e);return}}if(e.which===l.TAB||l.isControl(e)||l.isFunctionKey(e)||e.which===l.BACKSPACE||e.which===l.ESC){return}if(e.which===l.ENTER){if(this.opts.openOnEnter===false){return}else if(e.altKey||e.ctrlKey||e.shiftKey||e.metaKey){return}}this.open();if(e.which===l.PAGE_UP||e.which===l.PAGE_DOWN){C(e)}if(e.which===l.ENTER){C(e)}}));this.search.on("keyup",this.bind(function(e){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);if(!this.opened())this.clearSearch();t.stopImmediatePropagation();this.opts.element.trigger(e.Event("select2-blur"))}));this.container.on("click",t,this.bind(function(t){if(!this.isInterfaceEnabled())return;if(e(t.target).closest(".select2-search-choice").length>0){return}this.selectChoice(null);this.clearPlaceholder();if(!this.container.hasClass("select2-container-active")){this.opts.element.trigger(e.Event("select2-focus"))}this.open();this.focusSearch();t.preventDefault()}));this.container.on("focus",t,this.bind(function(){if(!this.isInterfaceEnabled())return;if(!this.container.hasClass("select2-container-active")){this.opts.element.trigger(e.Event("select2-focus"))}this.container.addClass("select2-container-active");this.dropdown.addClass("select2-drop-active");this.clearPlaceholder()}));this.initContainerWidth();this.opts.element.hide();this.clearSearch()},enableInterface:function(){if(this.parent.enableInterface.apply(this,arguments)){this.search.prop("disabled",!this.isInterfaceEnabled())}},initSelection:function(){var e;if(this.opts.element.val()===""&&this.opts.element.text()===""){this.updateSelection([]);this.close();this.clearSearch()}if(this.select||this.opts.element.val()!==""){var n=this;this.opts.initSelection.call(null,this.opts.element,function(e){if(e!==t&&e!==null){n.updateSelection(e);n.close();n.clearSearch()}})}},clearSearch:function(){var e=this.getPlaceholder(),n=this.getMaxSearchWidth();if(e!==t&&this.getVal().length===0&&this.search.hasClass("select2-focused")===false){this.search.val(e).addClass("select2-default");this.search.width(n>0?n:this.container.css("width"))}else{this.search.val("").width(10)}},clearPlaceholder:function(){if(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.prefillNextSearchTerm();this.updateResults(true);if(this.opts.shouldFocusInput(this)){this.search.focus()}this.opts.element.trigger(e.Event("select2-open"))},close:function(){if(!this.opened())return;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 n=[],r=[],i=this;e(t).each(function(){if(v(i.id(this),n)<0){n.push(i.id(this));r.push(this)}});t=r;this.selection.find(".select2-search-choice").remove();e(t).each(function(){i.addSelectedChoice(this)});i.postprocessResults()},tokenize:function(){var e=this.search.val();e=this.opts.tokenizer.call(this,e,this.data(),this.bind(this.onSelect),this.opts);if(e!=null&&e!=t){this.search.val(e);if(e.length>0){this.open()}}},onSelect:function(e,t){if(!this.triggerSelect(e)||e.text===""){return}this.addSelectedChoice(e);this.opts.element.trigger({type:"selected",val:this.id(e),choice:e});this.lastSearchTerm=this.search.val();this.clearSearch();this.updateResults();if(this.select||!this.opts.closeOnSelect)this.postprocessResults(e,false,this.opts.closeOnSelect===true);if(this.opts.closeOnSelect){this.close();this.search.width(10)}else{if(this.countSelectableResults()>0){this.search.width(10);this.resizeSearch();if(this.getMaximumSelectionSize()>0&&this.val().length>=this.getMaximumSelectionSize()){this.updateResults(true)}else{if(this.prefillNextSearchTerm()){this.updateResults()}}this.positionDropdown()}else{this.close();this.search.width(10)}}this.triggerChange({added:e});if(!t||!t.noFocus)this.focusSearch()},cancel:function(){this.close();this.focusSearch()},addSelectedChoice:function(n){var r=!n.locked,i=e("<li class='select2-search-choice'>"+" <div></div>"+" <a href='#' class='select2-search-choice-close' tabindex='-1'></a>"+"</li>"),s=e("<li class='select2-search-choice select2-locked'>"+"<div></div>"+"</li>");var o=r?i:s,u=this.id(n),a=this.getVal(),f,l;f=this.opts.formatSelection(n,o.find("div"),this.opts.escapeMarkup);if(f!=t){o.find("div").replaceWith(e("<div></div>").html(f))}l=this.opts.formatSelectionCssClass(n,o.find("div"));if(l!=t){o.addClass(l)}if(r){o.find(".select2-search-choice-close").on("mousedown",C).on("click dblclick",this.bind(function(t){if(!this.isInterfaceEnabled())return;this.unselect(e(t.target));this.selection.find(".select2-search-choice-focus").removeClass("select2-search-choice-focus");C(t);this.close();this.focusSearch()})).on("focus",this.bind(function(){if(!this.isInterfaceEnabled())return;this.container.addClass("select2-container-active");this.dropdown.addClass("select2-drop-active")}))}o.data("select2-data",n);o.insertBefore(this.searchContainer);a.push(u);this.setVal(a)},unselect:function(t){var n=this.getVal(),r,i;t=t.closest(".select2-search-choice");if(t.length===0){throw"Invalid argument: "+t+". Must be .select2-search-choice"}r=t.data("select2-data");if(!r){return}var s=e.Event("select2-removing");s.val=this.id(r);s.choice=r;this.opts.element.trigger(s);if(s.isDefaultPrevented()){return false}while((i=v(this.id(r),n))>=0){n.splice(i,1);this.setVal(n);if(this.select)this.postprocessResults()}t.remove();this.opts.element.trigger({type:"select2-removed",val:this.id(r),choice:r});this.triggerChange({removed:r});return true},postprocessResults:function(e,t,n){var r=this.getVal(),i=this.results.find(".select2-result"),s=this.results.find(".select2-result-with-children"),o=this;i.each2(function(e,t){var n=o.id(t.data("select2-data"));if(v(n,r)>=0){t.addClass("select2-selected");t.find(".select2-result-selectable").addClass("select2-selected")}});s.each2(function(e,t){if(!t.is(".select2-result-selectable")&&t.find(".select2-result-selectable:not(.select2-selected)").length===0){t.addClass("select2-selected")}});if(this.highlight()==-1&&n!==false&&this.opts.closeOnSelect===true){o.highlight(0)}if(!this.opts.createSearchChoice&&!i.filter(".select2-result:not(.select2-selected)").length>0){if(!e||e&&!e.more&&this.results.find(".select2-no-results").length===0){if(H(o.opts.formatNoMatches,"formatNoMatches")){this.results.append("<li class='select2-no-results'>"+B(o.opts.formatNoMatches,o.opts.element,o.search.val())+"</li>")}}}},getMaxSearchWidth:function(){return this.selection.width()-b(this.search)},resizeSearch:function(){var e,t,n,r,i,s=b(this.search);e=L(this.search)+10;t=this.search.offset().left;n=this.selection.width();r=this.selection.offset().left;i=n-(t-r)-s;if(i<e){i=n-s}if(i<40){i=n-s}if(i<=0){i=e}this.search.width(Math.floor(i))},getVal:function(){var e;if(this.select){e=this.select.val();return e===null?[]:e}else{e=this.opts.element.val();return y(e,this.opts.separator,this.opts.transformVal)}},setVal:function(t){var n;if(this.select){this.select.val(t)}else{n=[];e(t).each(function(){if(v(this,n)<0)n.push(this)});this.opts.element.val(n.length===0?"":n.join(this.opts.separator))}},buildChangeDetails:function(e,t){var t=t.slice(0),e=e.slice(0);for(var n=0;n<t.length;n++){for(var r=0;r<e.length;r++){if(g(this.opts.id(t[n]),this.opts.id(e[r]))){t.splice(n,1);if(n>0){n--}e.splice(r,1);r--}}}return{added:t,removed:e}},val:function(n,r){var i,s=this;if(arguments.length===0){return this.getVal()}i=this.data();if(!i.length)i=[];if(!n&&n!==0){this.opts.element.val("");this.updateSelection([]);this.clearSearch();if(r){this.triggerChange({added:this.data(),removed:i})}return}this.setVal(n);if(this.select){this.opts.initSelection(this.select,this.bind(this.updateSelection));if(r){this.triggerChange(this.buildChangeDetails(i,this.data()))}}else{if(this.opts.initSelection===t){throw new Error("val() cannot be called if initSelection() is not defined")}this.opts.initSelection(this.opts.element,function(t){var n=e.map(t,s.id);s.setVal(n);s.updateSelection(t);s.clearSearch();if(r){s.triggerChange(s.buildChangeDetails(i,s.data()))}})}this.clearSearch()},onSortStart:function(){if(this.select){throw new Error("Sorting of elements is not supported when attached to <select>. Attach to <input type='hidden'/> instead.")}this.search.width(0);this.searchContainer.hide()},onSortEnd:function(){var t=[],n=this;this.searchContainer.show();this.searchContainer.appendTo(this.searchContainer.parent());this.resizeSearch();this.selection.find(".select2-search-choice").each(function(){t.push(n.opts.id(e(this).data("select2-data")))});this.setVal(t);this.triggerChange()},data:function(t,n){var r=this,i,s;if(arguments.length===0){return this.selection.children(".select2-search-choice").map(function(){return e(this).data("select2-data")}).get()}else{s=this.data();if(!t){t=[]}i=e.map(t,function(e){return r.opts.id(e)});this.setVal(i);this.updateSelection(t);this.clearSearch();if(n){this.triggerChange(this.buildChangeDetails(s,this.data()))}}}});e.fn.select2=function(){var n=Array.prototype.slice.call(arguments,0),r,i,s,o,u,a=["val","destroy","opened","open","close","focus","isFocused","container","dropdown","onSortStart","onSortEnd","enable","disable","readonly","positionDropdown","data","search"],f=["opened","isFocused","container","dropdown"],l=["val","data"],c={search:"externalSearch"};this.each(function(){if(n.length===0||typeof n[0]==="object"){r=n.length===0?{}:e.extend({},n[0]);r.element=e(this);if(r.element.get(0).tagName.toLowerCase()==="select"){u=r.element.prop("multiple")}else{u=r.multiple||false;if("tags"in r){r.multiple=u=true}}i=u?new window.Select2["class"].multi:new window.Select2["class"].single;i.init(r)}else if(typeof n[0]==="string"){if(v(n[0],a)<0){throw"Unknown method: "+n[0]}o=t;i=e(this).data("select2");if(i===t)return;s=n[0];if(s==="container"){o=i.container}else if(s==="dropdown"){o=i.dropdown}else{if(c[s])s=c[s];o=i[s].apply(i,n.slice(1))}if(v(n[0],f)>=0||v(n[0],l)>=0&&n.length==1){return false}}else{throw"Invalid arguments to select2 plugin: "+n}});return o===t?this:o};e.fn.select2.defaults={width:"copy",loadMorePadding:0,closeOnSelect:true,openOnEnter:true,containerCss:{},dropdownCss:{},containerCssClass:"",dropdownCssClass:"",formatResult:function(e,t,n,r){var i=[];O(this.text(e),n.term,i,r);return i.join("")},transformVal:function(t){return e.trim(t)},formatSelection:function(e,n,r){return e?r(this.text(e)):t},sortResults:function(e,t,n){return e},formatResultCssClass:function(e){return e.css},formatSelectionCssClass:function(e,n){return t},minimumResultsForSearch:0,minimumInputLength:0,maximumInputLength:null,maximumSelectionSize:0,id:function(e){return e==t?null:e.id},text:function(t){if(t&&this.data&&this.data.text){if(e.isFunction(this.data.text)){return this.data.text(t)}else{return t[this.data.text]}}else{return t.text}},matcher:function(e,t){return d(""+t).toUpperCase().indexOf(d(""+e).toUpperCase())>=0},separator:",",tokenSeparators:[],tokenizer:F,escapeMarkup:M,blurOnChange:false,selectOnBlur:false,adaptContainerCssClass:function(e){return e},adaptDropdownCssClass:function(e){return null},nextSearchTerm:function(e,n){return t},searchInputPlaceholder:"",createSearchChoicePosition:"top",shouldFocusInput:function(e){var t="ontouchstart"in window||navigator.msMaxTouchPoints>0;if(!t){return true}if(e.opts.minimumResultsForSearch<0){return false}return true}};e.fn.select2.locales=[];e.fn.select2.locales["en"]={formatMatches:function(e){if(e===1){return"One result is available, press enter to select it."}return e+" results are available, use up and down arrow keys to navigate."},formatNoMatches:function(){return"No matches found"},formatAjaxError:function(e,t,n){return"Loading failed"},formatInputTooShort:function(e,t){var n=t-e.length;return"Please enter "+n+" or more character"+(n==1?"":"s")},formatInputTooLong:function(e,t){var n=e.length-t;return"Please delete "+n+" character"+(n==1?"":"s")},formatSelectionTooBig:function(e){return"You can only select "+e+" item"+(e==1?"":"s")},formatLoadMore:function(e){return"Loading more results…"},formatSearching:function(){return"Searching…"}};e.extend(e.fn.select2.defaults,e.fn.select2.locales["en"]);e.fn.select2.ajaxDefaults={transport:e.ajax,params:{type:"GET",cache:false,dataType:"json"}};window.Select2={query:{ajax:_,local:D,tags:P},util:{debounce:S,markMatch:O,escapeMarkup:M,stripDiacritics:d},"class":{"abstract":n,single:r,multi:i}}})(jQuery)