/*! Select2 4.0.6-rc.0 | https://github.com/select2/select2/blob/master/LICENSE.md */
!function (a) {
"function" == typeof define && define.amd ? define(["jquery"], a) : "object" == typeof module && module.exports ? module.exports = function (b, c) {
return void 0 === c && (c = "undefined" != typeof window ? require("jquery") : require("jquery")(b)), a(c), c
} : a(jQuery)
}(function (a) {
var b = function () {
if (a && a.fn && a.fn.select2 && a.fn.select2.amd) var b = a.fn.select2.amd;
var b;
return function () {
if (!b || !b.requirejs) {
b ? c = b : b = {};
var a, c, d;
!function (b) {
function e(a, b) {
return v.call(a, b)
}
function f(a, b) {
var c, d, e, f, g, h, i, j, k, l, m, n, o = b && b.split("/"), p = t.map, q = p && p["*"] || {};
if (a) {
for (a = a.split("/"), g = a.length - 1, t.nodeIdCompat && x.test(a[g]) && (a[g] = a[g].replace(x, "")), "." === a[0].charAt(0) && o && (n = o.slice(0, o.length - 1), a = n.concat(a)), k = 0; k < a.length; k++) if ("." === (m = a[k])) a.splice(k, 1), k -= 1; else if (".." === m) {
if (0 === k || 1 === k && ".." === a[2] || ".." === a[k - 1]) continue;
k > 0 && (a.splice(k - 1, 2), k -= 2)
}
a = a.join("/")
}
if ((o || q) && p) {
for (c = a.split("/"), k = c.length; k > 0; k -= 1) {
if (d = c.slice(0, k).join("/"), o) for (l = o.length; l > 0; l -= 1) if ((e = p[o.slice(0, l).join("/")]) && (e = e[d])) {
f = e, h = k;
break
}
if (f) break;
!i && q && q[d] && (i = q[d], j = k)
}
!f && i && (f = i, h = j), f && (c.splice(0, h, f), a = c.join("/"))
}
return a
}
function g(a, c) {
return function () {
var d = w.call(arguments, 0);
return "string" != typeof d[0] && 1 === d.length && d.push(null), o.apply(b, d.concat([a, c]))
}
}
function h(a) {
return function (b) {
return f(b, a)
}
}
function i(a) {
return function (b) {
r[a] = b
}
}
function j(a) {
if (e(s, a)) {
var c = s[a];
delete s[a], u[a] = !0, n.apply(b, c)
}
if (!e(r, a) && !e(u, a)) throw new Error("No " + a);
return r[a]
}
function k(a) {
var b, c = a ? a.indexOf("!") : -1;
return c > -1 && (b = a.substring(0, c), a = a.substring(c + 1, a.length)), [b, a]
}
function l(a) {
return a ? k(a) : []
}
function m(a) {
return function () {
return t && t.config && t.config[a] || {}
}
}
var n, o, p, q, r = {}, s = {}, t = {}, u = {}, v = Object.prototype.hasOwnProperty, w = [].slice,
x = /\.js$/;
p = function (a, b) {
var c, d = k(a), e = d[0], g = b[1];
return a = d[1], e && (e = f(e, g), c = j(e)), e ? a = c && c.normalize ? c.normalize(a, h(g)) : f(a, g) : (a = f(a, g), d = k(a), e = d[0], a = d[1], e && (c = j(e))), {
f: e ? e + "!" + a : a,
n: a,
pr: e,
p: c
}
}, q = {
require: function (a) {
return g(a)
}, exports: function (a) {
var b = r[a];
return void 0 !== b ? b : r[a] = {}
}, module: function (a) {
return {id: a, uri: "", exports: r[a], config: m(a)}
}
}, n = function (a, c, d, f) {
var h, k, m, n, o, t, v, w = [], x = typeof d;
if (f = f || a, t = l(f), "undefined" === x || "function" === x) {
for (c = !c.length && d.length ? ["require", "exports", "module"] : c, o = 0; o < c.length; o += 1) if (n = p(c[o], t), "require" === (k = n.f)) w[o] = q.require(a); else if ("exports" === k) w[o] = q.exports(a), v = !0; else if ("module" === k) h = w[o] = q.module(a); else if (e(r, k) || e(s, k) || e(u, k)) w[o] = j(k); else {
if (!n.p) throw new Error(a + " missing " + k);
n.p.load(n.n, g(f, !0), i(k), {}), w[o] = r[k]
}
m = d ? d.apply(r[a], w) : void 0, a && (h && h.exports !== b && h.exports !== r[a] ? r[a] = h.exports : m === b && v || (r[a] = m))
} else a && (r[a] = d)
}, a = c = o = function (a, c, d, e, f) {
if ("string" == typeof a) return q[a] ? q[a](c) : j(p(a, l(c)).f);
if (!a.splice) {
if (t = a, t.deps && o(t.deps, t.callback), !c) return;
c.splice ? (a = c, c = d, d = null) : a = b
}
return c = c || function () {
}, "function" == typeof d && (d = e, e = f), e ? n(b, a, c, d) : setTimeout(function () {
n(b, a, c, d)
}, 4), o
}, o.config = function (a) {
return o(a)
}, a._defined = r, d = function (a, b, c) {
if ("string" != typeof a) throw new Error("See almond README: incorrect module build, no module name");
b.splice || (c = b, b = []), e(r, a) || e(s, a) || (s[a] = [a, b, c])
}, d.amd = {jQuery: !0}
}(), b.requirejs = a, b.require = c, b.define = d
}
}(), b.define("almond", function () {
}), b.define("jquery", [], function () {
var b = a || $;
return null == b && 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."), b
}), b.define("select2/utils", ["jquery"], function (a) {
function b(a) {
var b = a.prototype, c = [];
for (var d in b) {
"function" == typeof b[d] && ("constructor" !== d && c.push(d))
}
return c
}
var c = {};
c.Extend = function (a, b) {
function c() {
this.constructor = a
}
var d = {}.hasOwnProperty;
for (var e in b) d.call(b, e) && (a[e] = b[e]);
return c.prototype = b.prototype, a.prototype = new c, a.__super__ = b.prototype, a
}, c.Decorate = function (a, c) {
function d() {
var b = Array.prototype.unshift, d = c.prototype.constructor.length, e = a.prototype.constructor;
d > 0 && (b.call(arguments, a.prototype.constructor), e = c.prototype.constructor), e.apply(this, arguments)
}
function e() {
this.constructor = d
}
var f = b(c), g = b(a);
c.displayName = a.displayName, d.prototype = new e;
for (var h = 0; h < g.length; h++) {
var i = g[h];
d.prototype[i] = a.prototype[i]
}
for (var j = (function (a) {
var b = function () {
};
a in d.prototype && (b = d.prototype[a]);
var e = c.prototype[a];
return function () {
return Array.prototype.unshift.call(arguments, b), e.apply(this, arguments)
}
}), k = 0; k < f.length; k++) {
var l = f[k];
d.prototype[l] = j(l)
}
return d
};
var d = function () {
this.listeners = {}
};
d.prototype.on = function (a, b) {
this.listeners = this.listeners || {}, a in this.listeners ? this.listeners[a].push(b) : this.listeners[a] = [b]
}, d.prototype.trigger = function (a) {
var b = Array.prototype.slice, c = b.call(arguments, 1);
this.listeners = this.listeners || {}, null == c && (c = []), 0 === c.length && c.push({}), c[0]._type = a, a in this.listeners && this.invoke(this.listeners[a], b.call(arguments, 1)), "*" in this.listeners && this.invoke(this.listeners["*"], arguments)
}, d.prototype.invoke = function (a, b) {
for (var c = 0, d = a.length; c < d; c++) a[c].apply(this, b)
}, c.Observable = d, c.generateChars = function (a) {
for (var b = "", c = 0; c < a; c++) {
b += Math.floor(36 * Math.random()).toString(36)
}
return b
}, c.bind = function (a, b) {
return function () {
a.apply(b, arguments)
}
}, c._convertData = function (a) {
for (var b in a) {
var c = b.split("-"), d = a;
if (1 !== c.length) {
for (var e = 0; e < c.length; e++) {
var f = c[e];
f = f.substring(0, 1).toLowerCase() + f.substring(1), f in d || (d[f] = {}), e == c.length - 1 && (d[f] = a[b]), d = d[f]
}
delete a[b]
}
}
return a
}, c.hasScroll = function (b, c) {
var d = a(c), e = c.style.overflowX, f = c.style.overflowY;
return (e !== f || "hidden" !== f && "visible" !== f) && ("scroll" === e || "scroll" === f || (d.innerHeight() < c.scrollHeight || d.innerWidth() < c.scrollWidth))
}, c.escapeMarkup = function (a) {
var b = {
"\\": "\",
"&": "&",
"<": "<",
">": ">",
'"': """,
"'": "'",
"/": "/"
};
return "string" != typeof a ? a : String(a).replace(/[&<>"'\/\\]/g, function (a) {
return b[a]
})
}, c.appendMany = function (b, c) {
if ("1.7" === a.fn.jquery.substr(0, 3)) {
var d = a();
a.map(c, function (a) {
d = d.add(a)
}), c = d
}
b.append(c)
}, c.__cache = {};
var e = 0;
return c.GetUniqueElementId = function (a) {
var b = a.getAttribute("data-select2-id");
return null == b && (a.id ? (b = a.id, a.setAttribute("data-select2-id", b)) : (a.setAttribute("data-select2-id", ++e), b = e.toString())), b
}, c.StoreData = function (a, b, d) {
var e = c.GetUniqueElementId(a);
c.__cache[e] || (c.__cache[e] = {}), c.__cache[e][b] = d
}, c.GetData = function (b, d) {
var e = c.GetUniqueElementId(b);
return d ? c.__cache[e] && null != c.__cache[e][d] ? c.__cache[e][d] : a(b).data(d) : c.__cache[e]
}, c.RemoveData = function (a) {
var b = c.GetUniqueElementId(a);
null != c.__cache[b] && delete c.__cache[b]
}, c
}), b.define("select2/results", ["jquery", "./utils"], function (a, b) {
function c(a, b, d) {
this.$element = a, this.data = d, this.options = b, c.__super__.constructor.call(this)
}
return b.Extend(c, b.Observable), c.prototype.render = function () {
var b = a('
');
return this.options.get("multiple") && b.attr("aria-multiselectable", "true"), this.$results = b, b
}, c.prototype.clear = function () {
this.$results.empty()
}, c.prototype.displayMessage = function (b) {
var c = this.options.get("escapeMarkup");
this.clear(), this.hideLoading();
var d = a(''),
e = this.options.get("translations").get(b.message);
d.append(c(e(b.args))), d[0].className += " select2-results__message", this.$results.append(d)
}, c.prototype.hideMessages = function () {
this.$results.find(".select2-results__message").remove()
}, c.prototype.append = function (a) {
this.hideLoading();
var b = [];
if (null == a.results || 0 === a.results.length) return void (0 === this.$results.children().length && this.trigger("results:message", {message: "noResults"}));
a.results = this.sort(a.results);
for (var c = 0; c < a.results.length; c++) {
var d = a.results[c], e = this.option(d);
b.push(e)
}
this.$results.append(b)
}, c.prototype.position = function (a, b) {
b.find(".select2-results").append(a)
}, c.prototype.sort = function (a) {
return this.options.get("sorter")(a)
}, c.prototype.highlightFirstItem = function () {
var a = this.$results.find(".select2-results__option[aria-selected]"),
b = a.filter("[aria-selected=true]");
b.length > 0 ? b.first().trigger("mouseenter") : a.first().trigger("mouseenter"), this.ensureHighlightVisible()
}, c.prototype.setClasses = function () {
var c = this;
this.data.current(function (d) {
var e = a.map(d, function (a) {
return a.id.toString()
});
c.$results.find(".select2-results__option[aria-selected]").each(function () {
var c = a(this), d = b.GetData(this, "data"), f = "" + d.id;
null != d.element && d.element.selected || null == d.element && a.inArray(f, e) > -1 ? c.attr("aria-selected", "true") : c.attr("aria-selected", "false")
})
})
}, c.prototype.showLoading = function (a) {
this.hideLoading();
var b = this.options.get("translations").get("searching"), c = {disabled: !0, loading: !0, text: b(a)},
d = this.option(c);
d.className += " loading-results", this.$results.prepend(d)
}, c.prototype.hideLoading = function () {
this.$results.find(".loading-results").remove()
}, c.prototype.option = function (c) {
var d = document.createElement("li");
d.className = "select2-results__option";
var e = {role: "treeitem", "aria-selected": "false"};
c.disabled && (delete e["aria-selected"], e["aria-disabled"] = "true"), null == c.id && delete e["aria-selected"], null != c._resultId && (d.id = c._resultId), c.title && (d.title = c.title), c.children && (e.role = "group", e["aria-label"] = c.text, delete e["aria-selected"]);
for (var f in e) {
var g = e[f];
d.setAttribute(f, g)
}
if (c.children) {
var h = a(d), i = document.createElement("strong");
i.className = "select2-results__group";
a(i);
this.template(c, i);
for (var j = [], k = 0; k < c.children.length; k++) {
var l = c.children[k], m = this.option(l);
j.push(m)
}
var n = a("
", {class: "select2-results__options select2-results__options--nested"});
n.append(j), h.append(i), h.append(n)
} else this.template(c, d);
return b.StoreData(d, "data", c), d
}, c.prototype.bind = function (c, d) {
var e = this, f = c.id + "-results";
this.$results.attr("id", f), c.on("results:all", function (a) {
e.clear(), e.append(a.data), c.isOpen() && (e.setClasses(), e.highlightFirstItem())
}), c.on("results:append", function (a) {
e.append(a.data), c.isOpen() && e.setClasses()
}), c.on("query", function (a) {
e.hideMessages(), e.showLoading(a)
}), c.on("select", function () {
c.isOpen() && (e.setClasses(), e.highlightFirstItem())
}), c.on("unselect", function () {
c.isOpen() && (e.setClasses(), e.highlightFirstItem())
}), c.on("open", function () {
e.$results.attr("aria-expanded", "true"), e.$results.attr("aria-hidden", "false"), e.setClasses(), e.ensureHighlightVisible()
}), c.on("close", function () {
e.$results.attr("aria-expanded", "false"), e.$results.attr("aria-hidden", "true"), e.$results.removeAttr("aria-activedescendant")
}), c.on("results:toggle", function () {
var a = e.getHighlightedResults();
0 !== a.length && a.trigger("mouseup")
}), c.on("results:select", function () {
var a = e.getHighlightedResults();
if (0 !== a.length) {
var c = b.GetData(a[0], "data");
"true" == a.attr("aria-selected") ? e.trigger("close", {}) : e.trigger("select", {data: c})
}
}), c.on("results:previous", function () {
var a = e.getHighlightedResults(), b = e.$results.find("[aria-selected]"), c = b.index(a);
if (0 !== c) {
var d = c - 1;
0 === a.length && (d = 0);
var f = b.eq(d);
f.trigger("mouseenter");
var g = e.$results.offset().top, h = f.offset().top, i = e.$results.scrollTop() + (h - g);
0 === d ? e.$results.scrollTop(0) : h - g < 0 && e.$results.scrollTop(i)
}
}), c.on("results:next", function () {
var a = e.getHighlightedResults(), b = e.$results.find("[aria-selected]"), c = b.index(a),
d = c + 1;
if (!(d >= b.length)) {
var f = b.eq(d);
f.trigger("mouseenter");
var g = e.$results.offset().top + e.$results.outerHeight(!1),
h = f.offset().top + f.outerHeight(!1), i = e.$results.scrollTop() + h - g;
0 === d ? e.$results.scrollTop(0) : h > g && e.$results.scrollTop(i)
}
}), c.on("results:focus", function (a) {
a.element.addClass("select2-results__option--highlighted")
}), c.on("results:message", function (a) {
e.displayMessage(a)
}), a.fn.mousewheel && this.$results.on("mousewheel", function (a) {
var b = e.$results.scrollTop(), c = e.$results.get(0).scrollHeight - b + a.deltaY,
d = a.deltaY > 0 && b - a.deltaY <= 0, f = a.deltaY < 0 && c <= e.$results.height();
d ? (e.$results.scrollTop(0), a.preventDefault(), a.stopPropagation()) : f && (e.$results.scrollTop(e.$results.get(0).scrollHeight - e.$results.height()), a.preventDefault(), a.stopPropagation())
}), this.$results.on("mouseup", ".select2-results__option[aria-selected]", function (c) {
var d = a(this), f = b.GetData(this, "data");
if ("true" === d.attr("aria-selected")) return void (e.options.get("multiple") ? e.trigger("unselect", {
originalEvent: c,
data: f
}) : e.trigger("close", {}));
e.trigger("select", {originalEvent: c, data: f})
}), this.$results.on("mouseenter", ".select2-results__option[aria-selected]", function (c) {
var d = b.GetData(this, "data");
e.getHighlightedResults().removeClass("select2-results__option--highlighted"), e.trigger("results:focus", {
data: d,
element: a(this)
})
})
}, c.prototype.getHighlightedResults = function () {
return this.$results.find(".select2-results__option--highlighted")
}, c.prototype.destroy = function () {
this.$results.remove()
}, c.prototype.ensureHighlightVisible = function () {
var a = this.getHighlightedResults();
if (0 !== a.length) {
var b = this.$results.find("[aria-selected]"), c = b.index(a), d = this.$results.offset().top,
e = a.offset().top, f = this.$results.scrollTop() + (e - d), g = e - d;
f -= 2 * a.outerHeight(!1), c <= 2 ? this.$results.scrollTop(0) : (g > this.$results.outerHeight() || g < 0) && this.$results.scrollTop(f)
}
}, c.prototype.template = function (b, c) {
var d = this.options.get("templateResult"), e = this.options.get("escapeMarkup"), f = d(b, c);
null == f ? c.style.display = "none" : "string" == typeof f ? c.innerHTML = e(f) : a(c).append(f)
}, c
}), b.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
}
}), b.define("select2/selection/base", ["jquery", "../utils", "../keys"], function (a, b, c) {
function d(a, b) {
this.$element = a, this.options = b, d.__super__.constructor.call(this)
}
return b.Extend(d, b.Observable), d.prototype.render = function () {
var c = a('');
return this._tabindex = 0, null != b.GetData(this.$element[0], "old-tabindex") ? this._tabindex = b.GetData(this.$element[0], "old-tabindex") : null != this.$element.attr("tabindex") && (this._tabindex = this.$element.attr("tabindex")), c.attr("title", this.$element.attr("title")), c.attr("tabindex", this._tabindex), this.$selection = c, c
}, d.prototype.bind = function (a, b) {
var d = this, e = (a.id, a.id + "-results");
this.container = a, this.$selection.on("focus", function (a) {
d.trigger("focus", a)
}), this.$selection.on("blur", function (a) {
d._handleBlur(a)
}), this.$selection.on("keydown", function (a) {
d.trigger("keypress", a), a.which === c.SPACE && a.preventDefault()
}), a.on("results:focus", function (a) {
d.$selection.attr("aria-activedescendant", a.data._resultId)
}), a.on("selection:update", function (a) {
d.update(a.data)
}), a.on("open", function () {
d.$selection.attr("aria-expanded", "true"), d.$selection.attr("aria-owns", e), d._attachCloseHandler(a)
}), a.on("close", function () {
d.$selection.attr("aria-expanded", "false"), d.$selection.removeAttr("aria-activedescendant"), d.$selection.removeAttr("aria-owns"), d.$selection.focus(), d._detachCloseHandler(a)
}), a.on("enable", function () {
d.$selection.attr("tabindex", d._tabindex)
}), a.on("disable", function () {
d.$selection.attr("tabindex", "-1")
})
}, d.prototype._handleBlur = function (b) {
var c = this;
window.setTimeout(function () {
document.activeElement == c.$selection[0] || a.contains(c.$selection[0], document.activeElement) || c.trigger("blur", b)
}, 1)
}, d.prototype._attachCloseHandler = function (c) {
a(document.body).on("mousedown.select2." + c.id, function (c) {
var d = a(c.target), e = d.closest(".select2");
a(".select2.select2-container--open").each(function () {
a(this), this != e[0] && b.GetData(this, "element").select2("close")
})
})
}, d.prototype._detachCloseHandler = function (b) {
a(document.body).off("mousedown.select2." + b.id)
}, d.prototype.position = function (a, b) {
b.find(".selection").append(a)
}, d.prototype.destroy = function () {
this._detachCloseHandler(this.container)
}, d.prototype.update = function (a) {
throw new Error("The `update` method must be defined in child classes.")
}, d
}), b.define("select2/selection/single", ["jquery", "./base", "../utils", "../keys"], function (a, b, c, d) {
function e() {
e.__super__.constructor.apply(this, arguments)
}
return c.Extend(e, b), e.prototype.render = function () {
var a = e.__super__.render.call(this);
return a.addClass("select2-selection--single"), a.html(''), a
}, e.prototype.bind = function (a, b) {
var c = this;
e.__super__.bind.apply(this, arguments);
var d = a.id + "-container";
this.$selection.find(".select2-selection__rendered").attr("id", d).attr("role", "textbox").attr("aria-readonly", "true"), this.$selection.attr("aria-labelledby", d), this.$selection.on("mousedown", function (a) {
1 === a.which && c.trigger("toggle", {originalEvent: a})
}), this.$selection.on("focus", function (a) {
}), this.$selection.on("blur", function (a) {
}), a.on("focus", function (b) {
a.isOpen() || c.$selection.focus()
})
}, e.prototype.clear = function () {
var a = this.$selection.find(".select2-selection__rendered");
a.empty(), a.removeAttr("title")
}, e.prototype.display = function (a, b) {
var c = this.options.get("templateSelection");
return this.options.get("escapeMarkup")(c(a, b))
}, e.prototype.selectionContainer = function () {
return a("")
}, e.prototype.update = function (a) {
if (0 === a.length) return void this.clear();
var b = a[0], c = this.$selection.find(".select2-selection__rendered"), d = this.display(b, c);
c.empty().append(d), c.attr("title", b.title || b.text)
}, e
}), b.define("select2/selection/multiple", ["jquery", "./base", "../utils"], function (a, b, c) {
function d(a, b) {
d.__super__.constructor.apply(this, arguments)
}
return c.Extend(d, b), d.prototype.render = function () {
var a = d.__super__.render.call(this);
return a.addClass("select2-selection--multiple"), a.html('
'), a
}, d.prototype.bind = function (b, e) {
var f = this;
d.__super__.bind.apply(this, arguments), this.$selection.on("click", function (a) {
f.trigger("toggle", {originalEvent: a})
}), this.$selection.on("click", ".select2-selection__choice__remove", function (b) {
if (!f.options.get("disabled")) {
var d = a(this), e = d.parent(), g = c.GetData(e[0], "data");
f.trigger("unselect", {originalEvent: b, data: g})
}
})
}, d.prototype.clear = function () {
var a = this.$selection.find(".select2-selection__rendered");
a.empty(), a.removeAttr("title")
}, d.prototype.display = function (a, b) {
var c = this.options.get("templateSelection");
return this.options.get("escapeMarkup")(c(a, b))
}, d.prototype.selectionContainer = function () {
return a('