/*! * Select2 4.0.6-rc.1 * https://select2.github.io * * With a fix by Elementor team at lines 4329, 5449. * Also deprecated jQuery features fixed at lines: 1477, 1479, 1617, 2111, 2113, 3244, 3548, 3573, 3632, 3708, 3801, * 4047, 4050, 4058, 4063, 4873, 4936, 5395, 5693, 5772, 5785, 5826, 5852, 5883, 5909, 5956, 6103, 6346, 6350. * * Released under the MIT license * https://github.com/select2/select2/blob/master/LICENSE.md */ ;(function (factory) { if (typeof define === 'function' && define.amd) { // AMD. Register as an anonymous module. define(['jquery'], factory); } else if (typeof module === 'object' && module.exports) { // Node/CommonJS module.exports = function (root, jQuery) { if (jQuery === undefined) { // require('jQuery') returns a factory that requires window to // build a jQuery instance, we normalize how we use modules // that require this pattern but the window provided is a noop // if it's defined (how jquery works) if (typeof window !== 'undefined') { jQuery = require('jquery'); } else { jQuery = require('jquery')(root); } } factory(jQuery); return jQuery; }; } else { // Browser globals factory(jQuery); } } (function (jQuery) { // This is needed so we can catch the AMD loader configuration and use it // The inner file should be wrapped (by `banner.start.js`) in a function that // returns the AMD loader references. var S2 =(function () { // Restore the Select2 AMD loader so it can be used // Needed mostly in the language files, where the loader is not inserted if (jQuery && jQuery.fn && jQuery.fn.select2 && jQuery.fn.select2.amd) { var S2 = jQuery.fn.select2.amd; } var S2;(function () { if (!S2 || !S2.requirejs) { if (!S2) { S2 = {}; } else { require = S2; } /** * @license almond 0.3.3 Copyright jQuery Foundation and other contributors. * Released under MIT license, http://github.com/requirejs/almond/LICENSE */ //Going sloppy to avoid 'use strict' string cost, but strict practices should //be followed. /*global setTimeout: false */var requirejs, require, define; (function (undef) { var main, req, makeMap, handlers, defined = {}, waiting = {}, config = {}, defining = {}, hasOwn = Object.prototype.hasOwnProperty, aps = [].slice, jsSuffixRegExp = /\.js$/;function hasProp(obj, prop) { return hasOwn.call(obj, prop); }/** * Given a relative module name, like ./something, normalize it to * a real name that can be mapped to a path. * @param {String} name the relative name * @param {String} baseName a real name that the name arg is relative * to. * @returns {String} normalized name */ function normalize(name, baseName) { var nameParts, nameSegment, mapValue, foundMap, lastIndex, foundI, foundStarMap, starI, i, j, part, normalizedBaseParts, baseParts = baseName && baseName.split("/"), map = config.map, starMap = (map && map['*']) || {};//Adjust any relative paths. if (name) { name = name.split('/'); lastIndex = name.length - 1;// If wanting node ID compatibility, strip .js from end // of IDs. Have to do this here, and not in nameToUrl // because node allows either .js or non .js to map // to same file. if (config.nodeIdCompat && jsSuffixRegExp.test(name[lastIndex])) { name[lastIndex] = name[lastIndex].replace(jsSuffixRegExp, ''); }// Starts with a '.' so need the baseName if (name[0].charAt(0) === '.' && baseParts) { //Convert baseName to array, and lop off the last part, //so that . matches that 'directory' and not name of the baseName's //module. For instance, baseName of 'one/two/three', maps to //'one/two/three.js', but we want the directory, 'one/two' for //this normalization. normalizedBaseParts = baseParts.slice(0, baseParts.length - 1); name = normalizedBaseParts.concat(name); }//start trimDots for (i = 0; i < name.length; i++) { part = name[i]; if (part === '.') { name.splice(i, 1); i -= 1; } else if (part === '..') { // If at the start, or previous value is still .., // keep them so that when converted to a path it may // still work when converted to a path, even though // as an ID it is less than ideal. In larger point // releases, may be better to just kick out an error. if (i === 0 || (i === 1 && name[2] === '..') || name[i - 1] === '..') { continue; } else if (i > 0) { name.splice(i - 1, 2); i -= 2; } } } //end trimDotsname = name.join('/'); }//Apply map config if available. if ((baseParts || starMap) && map) { nameParts = name.split('/');for (i = nameParts.length; i > 0; i -= 1) { nameSegment = nameParts.slice(0, i).join("/");if (baseParts) { //Find the longest baseName segment match in the config. //So, do joins on the biggest to smallest lengths of baseParts. for (j = baseParts.length; j > 0; j -= 1) { mapValue = map[baseParts.slice(0, j).join('/')];//baseName segment has config, find if it has one for //this name. if (mapValue) { mapValue = mapValue[nameSegment]; if (mapValue) { //Match, update name to the new value. foundMap = mapValue; foundI = i; break; } } } }if (foundMap) { break; }//Check for a star map match, but just hold on to it, //if there is a shorter segment match later in a matching //config, then favor over this star map. if (!foundStarMap && starMap && starMap[nameSegment]) { foundStarMap = starMap[nameSegment]; starI = i; } }if (!foundMap && foundStarMap) { foundMap = foundStarMap; foundI = starI; }if (foundMap) { nameParts.splice(0, foundI, foundMap); name = nameParts.join('/'); } }return name; }function makeRequire(relName, forceSync) { return function () { //A version of a require function that passes a moduleName //value for items that may need to //look up paths relative to the moduleName var args = aps.call(arguments, 0);//If first arg is not require('string'), and there is only //one arg, it is the array form without a callback. Insert //a null so that the following concat is correct. if (typeof args[0] !== 'string' && args.length === 1) { args.push(null); } return req.apply(undef, args.concat([relName, forceSync])); }; }function makeNormalize(relName) { return function (name) { return normalize(name, relName); }; }function makeLoad(depName) { return function (value) { defined[depName] = value; }; }function callDep(name) { if (hasProp(waiting, name)) { var args = waiting[name]; delete waiting[name]; defining[name] = true; main.apply(undef, args); }if (!hasProp(defined, name) && !hasProp(defining, name)) { throw new Error('No ' + name); } return defined[name]; }//Turns a plugin!resource to [plugin, resource] //with the plugin being undefined if the name //did not have a plugin prefix. function splitPrefix(name) { var prefix, index = name ? name.indexOf('!') : -1; if (index > -1) { prefix = name.substring(0, index); name = name.substring(index + 1, name.length); } return [prefix, name]; }//Creates a parts array for a relName where first part is plugin ID, //second part is resource ID. Assumes relName has already been normalized. function makeRelParts(relName) { return relName ? splitPrefix(relName) : []; }/** * Makes a name map, normalizing the name, and using a plugin * for normalization if necessary. Grabs a ref to plugin * too, as an optimization. */ makeMap = function (name, relParts) { var plugin, parts = splitPrefix(name), prefix = parts[0], relResourceName = relParts[1];name = parts[1];if (prefix) { prefix = normalize(prefix, relResourceName); plugin = callDep(prefix); }//Normalize according if (prefix) { if (plugin && plugin.normalize) { name = plugin.normalize(name, makeNormalize(relResourceName)); } else { name = normalize(name, relResourceName); } } else { name = normalize(name, relResourceName); parts = splitPrefix(name); prefix = parts[0]; name = parts[1]; if (prefix) { plugin = callDep(prefix); } }//Using ridiculous property names for space reasons return { f: prefix ? prefix + '!' + name : name, //fullName n: name, pr: prefix, p: plugin }; };function makeConfig(name) { return function () { return (config && config.config && config.config[name]) || {}; }; }handlers = { require: function (name) { return makeRequire(name); }, exports: function (name) { var e = defined[name]; if (typeof e !== 'undefined') { return e; } else { return (defined[name] = {}); } }, module: function (name) { return { id: name, uri: '', exports: defined[name], config: makeConfig(name) }; } };main = function (name, deps, callback, relName) { var cjsModule, depName, ret, map, i, relParts, args = [], callbackType = typeof callback, usingExports;//Use name if no relName relName = relName || name; relParts = makeRelParts(relName);//Call the callback to define the module, if necessary. if (callbackType === 'undefined' || callbackType === 'function') { //Pull out the defined dependencies and pass the ordered //values to the callback. //Default to [require, exports, module] if no deps deps = !deps.length && callback.length ? ['require', 'exports', 'module'] : deps; for (i = 0; i < deps.length; i += 1) { map = makeMap(deps[i], relParts); depName = map.f;//Fast path CommonJS standard dependencies. if (depName === "require") { args[i] = handlers.require(name); } else if (depName === "exports") { //CommonJS module spec 1.1 args[i] = handlers.exports(name); usingExports = true; } else if (depName === "module") { //CommonJS module spec 1.1 cjsModule = args[i] = handlers.module(name); } else if (hasProp(defined, depName) || hasProp(waiting, depName) || hasProp(defining, depName)) { args[i] = callDep(depName); } else if (map.p) { map.p.load(map.n, makeRequire(relName, true), makeLoad(depName), {}); args[i] = defined[depName]; } else { throw new Error(name + ' missing ' + depName); } }ret = callback ? callback.apply(defined[name], args) : undefined;if (name) { //If setting exports via "module" is in play, //favor that over return value and exports. After that, //favor a non-undefined return value over exports use. if (cjsModule && cjsModule.exports !== undef && cjsModule.exports !== defined[name]) { defined[name] = cjsModule.exports; } else if (ret !== undef || !usingExports) { //Use the return value from the function. defined[name] = ret; } } } else if (name) { //May just be an object definition for the module. Only //worry about defining if have a module name. defined[name] = callback; } };requirejs = require = req = function (deps, callback, relName, forceSync, alt) { if (typeof deps === "string") { if (handlers[deps]) { //callback in this case is really relName return handlers[deps](callback); } //Just return the module wanted. In this scenario, the //deps arg is the module name, and second arg (if passed) //is just the relName. //Normalize module name, if it contains . or .. return callDep(makeMap(deps, makeRelParts(callback)).f); } else if (!deps.splice) { //deps is a config object, not an array. config = deps; if (config.deps) { req(config.deps, config.callback); } if (!callback) { return; }if (callback.splice) { //callback is an array, which means it is a dependency list. //Adjust args if there are dependencies deps = callback; callback = relName; relName = null; } else { deps = undef; } }//Support require(['a']) callback = callback || function () {};//If relName is a function, it is an errback handler, //so remove it. if (typeof relName === 'function') { relName = forceSync; forceSync = alt; }//Simulate async callback; if (forceSync) { main(undef, deps, callback, relName); } else { //Using a non-zero value because of concern for what old browsers //do, and latest browsers "upgrade" to 4 if lower value is used: //http://www.whatwg.org/specs/web-apps/current-work/multipage/timers.html#dom-windowtimers-settimeout: //If want a value immediately, use require('id') instead -- something //that works in almond on the global level, but not guaranteed and //unlikely to work in other AMD implementations. setTimeout(function () { main(undef, deps, callback, relName); }, 4); }return req; };/** * Just drops the config on the floor, but returns req in case * the config return value is used. */ req.config = function (cfg) { return req(cfg); };/** * Expose module registry for debugging and tooling */ requirejs._defined = defined;define = function (name, deps, callback) { if (typeof name !== 'string') { throw new Error('See almond README: incorrect module build, no module name'); }//This module may not have dependencies if (!deps.splice) { //deps is not an array, so probably means //an object literal or factory function for //the value. Adjust args. callback = deps; deps = []; }if (!hasProp(defined, name) && !hasProp(waiting, name)) { waiting[name] = [name, deps, callback]; } };define.amd = { jQuery: true }; }());S2.requirejs = requirejs;S2.require = require;S2.define = define; } }()); S2.define("almond", function(){});/* global jQuery:false, $:false */ S2.define('jquery',[],function () { var _$ = jQuery || $;if (_$ == null && console && console.error) { console.error( 'Select2: An instance of jQuery or a jQuery-compatible library was not ' + 'found. Make sure that you are including jQuery before Select2 on your ' + 'web page.' ); }return _$; });S2.define('select2/utils',[ 'jquery' ], function ($) { var Utils = {};Utils.Extend = function (ChildClass, SuperClass) { var __hasProp = {}.hasOwnProperty;function BaseConstructor () { this.constructor = ChildClass; }for (var key in SuperClass) { if (__hasProp.call(SuperClass, key)) { ChildClass[key] = SuperClass[key]; } }BaseConstructor.prototype = SuperClass.prototype; ChildClass.prototype = new BaseConstructor(); ChildClass.__super__ = SuperClass.prototype;return ChildClass; };function getMethods (theClass) { var proto = theClass.prototype;var methods = [];for (var methodName in proto) { var m = proto[methodName];if (typeof m !== 'function') { continue; }if (methodName === 'constructor') { continue; }methods.push(methodName); }return methods; }Utils.Decorate = function (SuperClass, DecoratorClass) { var decoratedMethods = getMethods(DecoratorClass); var superMethods = getMethods(SuperClass);function DecoratedClass () { var unshift = Array.prototype.unshift;var argCount = DecoratorClass.prototype.constructor.length;var calledConstructor = SuperClass.prototype.constructor;if (argCount > 0) { unshift.call(arguments, SuperClass.prototype.constructor);calledConstructor = DecoratorClass.prototype.constructor; }calledConstructor.apply(this, arguments); }DecoratorClass.displayName = SuperClass.displayName;function ctr () { this.constructor = DecoratedClass; }DecoratedClass.prototype = new ctr();for (var m = 0; m < superMethods.length; m++) { var superMethod = superMethods[m];DecoratedClass.prototype[superMethod] = SuperClass.prototype[superMethod]; }var calledMethod = function (methodName) { // Stub out the original method if it's not decorating an actual method var originalMethod = function () {};if (methodName in DecoratedClass.prototype) { originalMethod = DecoratedClass.prototype[methodName]; }var decoratedMethod = DecoratorClass.prototype[methodName];return function () { var unshift = Array.prototype.unshift;unshift.call(arguments, originalMethod);return decoratedMethod.apply(this, arguments); }; };for (var d = 0; d < decoratedMethods.length; d++) { var decoratedMethod = decoratedMethods[d];DecoratedClass.prototype[decoratedMethod] = calledMethod(decoratedMethod); }return DecoratedClass; };var Observable = function () { this.listeners = {}; };Observable.prototype.on = function (event, callback) { this.listeners = this.listeners || {};if (event in this.listeners) { this.listeners[event].push(callback); } else { this.listeners[event] = [callback]; } };Observable.prototype.trigger = function (event) { var slice = Array.prototype.slice; var params = slice.call(arguments, 1);this.listeners = this.listeners || {};// Params should always come in as an array if (params == null) { params = []; }// If there are no arguments to the event, use a temporary object if (params.length === 0) { params.push({}); }// Set the `_type` of the first object to the event params[0]._type = event;if (event in this.listeners) { this.invoke(this.listeners[event], slice.call(arguments, 1)); }if ('*' in this.listeners) { this.invoke(this.listeners['*'], arguments); } };Observable.prototype.invoke = function (listeners, params) { for (var i = 0, len = listeners.length; i < len; i++) { listeners[i].apply(this, params); } };Utils.Observable = Observable;Utils.generateChars = function (length) { var chars = '';for (var i = 0; i < length; i++) { var randomChar = Math.floor(Math.random() * 36); chars += randomChar.toString(36); }return chars; };Utils.bind = function (func, context) { return function () { func.apply(context, arguments); }; };Utils._convertData = function (data) { for (var originalKey in data) { var keys = originalKey.split('-');var dataLevel = data;if (keys.length === 1) { continue; }for (var k = 0; k < keys.length; k++) { var key = keys[k];// Lowercase the first letter // By default, dash-separated becomes camelCase key = key.substring(0, 1).toLowerCase() + key.substring(1);if (!(key in dataLevel)) { dataLevel[key] = {}; }if (k == keys.length - 1) { dataLevel[key] = data[originalKey]; }dataLevel = dataLevel[key]; }delete data[originalKey]; }return data; };Utils.hasScroll = function (index, el) { // Adapted from the function created by @ShadowScripter // and adapted by @BillBarry on the Stack Exchange Code Review website. // The original code can be found at // http://codereview.stackexchange.com/q/13338 // and was designed to be used with the Sizzle selector engine.var $el = $(el); var overflowX = el.style.overflowX; var overflowY = el.style.overflowY;//Check both x and y declarations if (overflowX === overflowY && (overflowY === 'hidden' || overflowY === 'visible')) { return false; }if (overflowX === 'scroll' || overflowY === 'scroll') { return true; }return ($el.innerHeight() < el.scrollHeight || $el.innerWidth() < el.scrollWidth); };Utils.escapeMarkup = function (markup) { var replaceMap = { '\\': '\', '&': '&', '<': '<', '>': '>', '"': '"', '\'': ''', '/': '/' };// Do not try to escape the markup if it's not a string if (typeof markup !== 'string') { return markup; }return String(markup).replace(/[&<>"'\/\\]/g, function (match) { return replaceMap[match]; }); };// Append an array of jQuery nodes to a given element. Utils.appendMany = function ($element, $nodes) { // jQuery 1.7.x does not support $.fn.append() with an array // Fall back to a jQuery object collection using $.fn.add() if ($.fn.jquery.substr(0, 3) === '1.7') { var $jqNodes = $();$.map($nodes, function (node) { $jqNodes = $jqNodes.add(node); });$nodes = $jqNodes; }$element.append($nodes); };// Cache objects in Utils.__cache instead of $.data (see #4346) Utils.__cache = {};var id = 0; Utils.GetUniqueElementId = function (element) { // Get a unique element Id. If element has no id, // creates a new unique number, stores it in the id // attribute and returns the new id. // If an id already exists, it simply returns it.var select2Id = element.getAttribute('data-select2-id'); if (select2Id == null) { // If element has id, use it. if (element.id) { select2Id = element.id; element.setAttribute('data-select2-id', select2Id); } else { element.setAttribute('data-select2-id', ++id); select2Id = id.toString(); } } return select2Id; };Utils.StoreData = function (element, name, value) { // Stores an item in the cache for a specified element. // name is the cache key. var id = Utils.GetUniqueElementId(element); if (!Utils.__cache[id]) { Utils.__cache[id] = {}; }Utils.__cache[id][name] = value; };Utils.GetData = function (element, name) { // Retrieves a value from the cache by its key (name) // name is optional. If no name specified, return // all cache items for the specified element. // and for a specified element. var id = Utils.GetUniqueElementId(element); if (name) { if (Utils.__cache[id]) { return Utils.__cache[id][name] != null ? Utils.__cache[id][name]: $(element).data(name); // Fallback to HTML5 data attribs. } return $(element).data(name); // Fallback to HTML5 data attribs. } else { return Utils.__cache[id]; } };Utils.RemoveData = function (element) { // Removes all cached items for a specified element. var id = Utils.GetUniqueElementId(element); if (Utils.__cache[id] != null) { delete Utils.__cache[id]; } };return Utils; });S2.define('select2/results',[ 'jquery', './utils' ], function ($, Utils) { function Results ($element, options, dataAdapter) { this.$element = $element; this.data = dataAdapter; this.options = options;Results.__super__.constructor.call(this); }Utils.Extend(Results, Utils.Observable);Results.prototype.render = function () { var $results = $( '
' );if (this.options.get('multiple')) { $results.attr('aria-multiselectable', 'true'); }this.$results = $results;return $results; };Results.prototype.clear = function () { this.$results.empty(); };Results.prototype.displayMessage = function (params) { var escapeMarkup = this.options.get('escapeMarkup');this.clear(); this.hideLoading();var $message = $( '' );var message = this.options.get('translations').get(params.message);$message.append( escapeMarkup( message(params.args) ) );$message[0].className += ' select2-results__message';this.$results.append($message); };Results.prototype.hideMessages = function () { this.$results.find('.select2-results__message').remove(); };Results.prototype.append = function (data) { this.hideLoading();var $options = [];if (data.results == null || data.results.length === 0) { if (this.$results.children().length === 0) { this.trigger('results:message', { message: 'noResults' }); }return; }data.results = this.sort(data.results);for (var d = 0; d < data.results.length; d++) { var item = data.results[d];var $option = this.option(item);$options.push($option); }this.$results.append($options); };Results.prototype.position = function ($results, $dropdown) { var $resultsContainer = $dropdown.find('.select2-results'); $resultsContainer.append($results); };Results.prototype.sort = function (data) { var sorter = this.options.get('sorter');return sorter(data); };Results.prototype.highlightFirstItem = function () { var $options = this.$results .find('.select2-results__option[aria-selected]');var $selected = $options.filter('[aria-selected=true]');// Check if there are any selected options if ($selected.length > 0) { // If there are selected options, highlight the first $selected.first().trigger('mouseenter'); } else { // If there are no selected options, highlight the first option // in the dropdown $options.first().trigger('mouseenter'); }this.ensureHighlightVisible(); };Results.prototype.setClasses = function () { var self = this;this.data.current(function (selected) { var selectedIds = $.map(selected, function (s) { return s.id.toString(); });var $options = self.$results .find('.select2-results__option[aria-selected]');$options.each(function () { var $option = $(this);var item = Utils.GetData(this, 'data');// id needs to be converted to a string when comparing var id = '' + item.id;if ((item.element != null && item.element.selected) || (item.element == null && $.inArray(id, selectedIds) > -1)) { $option.attr('aria-selected', 'true'); } else { $option.attr('aria-selected', 'false'); } });}); };Results.prototype.showLoading = function (params) { this.hideLoading();var loadingMore = this.options.get('translations').get('searching');var loading = { disabled: true, loading: true, text: loadingMore(params) }; var $loading = this.option(loading); $loading.className += ' loading-results';this.$results.prepend($loading); };Results.prototype.hideLoading = function () { this.$results.find('.loading-results').remove(); };Results.prototype.option = function (data) { var option = document.createElement('li'); option.className = 'select2-results__option';var attrs = { 'role': 'treeitem', 'aria-selected': 'false' };if (data.disabled) { delete attrs['aria-selected']; attrs['aria-disabled'] = 'true'; }if (data.id == null) { delete attrs['aria-selected']; }if (data._resultId != null) { option.id = data._resultId; }if (data.title) { option.title = data.title; }if (data.children) { attrs.role = 'group'; attrs['aria-label'] = data.text; delete attrs['aria-selected']; }for (var attr in attrs) { var val = attrs[attr];option.setAttribute(attr, val); }if (data.children) { var $option = $(option);var label = document.createElement('strong'); label.className = 'select2-results__group';var $label = $(label); this.template(data, label);var $children = [];for (var c = 0; c < data.children.length; c++) { var child = data.children[c];var $child = this.option(child);$children.push($child); }var $childrenContainer = $('