\"),\n l = _this101._render(\"dropdown\"),\n c = E('
'),\n u = _this101.input.getAttribute(\"class\") || \"\",\n d = o.mode;\n\n var h;\n C(s, o.wrapperClass, u, d), C(a, o.controlClass), X(s, a), C(l, o.dropdownClass, d), o.copyClassesToDropdown && C(l, u), C(c, o.dropdownContentClass), X(l, c), E(o.dropdownParent || s).appendChild(l), _(o.controlInput) ? (h = E(o.controlInput), b([\"autocorrect\", \"autocapitalize\", \"autocomplete\"], function (e) {\n r.getAttribute(e) && A(h, _defineProperty({}, e, r.getAttribute(e)));\n }), h.tabIndex = -1, a.appendChild(h), _this101.focus_node = h) : o.controlInput ? (h = E(o.controlInput), _this101.focus_node = h) : (h = E(\"
\"), _this101.focus_node = a), _this101.wrapper = s, _this101.dropdown = l, _this101.dropdown_content = c, _this101.control = a, _this101.control_input = h, _this101.setup();\n return _this101;\n }\n\n _createClass(J, [{\n key: \"setup\",\n value: function setup() {\n var e = this,\n t = e.settings,\n n = e.control_input,\n r = e.dropdown,\n o = e.dropdown_content,\n i = e.wrapper,\n s = e.control,\n a = e.input,\n l = e.focus_node,\n c = {\n passive: !0\n },\n u = e.inputId + \"-ts-dropdown\";\n A(o, {\n id: u\n }), A(l, {\n role: \"combobox\",\n \"aria-haspopup\": \"listbox\",\n \"aria-expanded\": \"false\",\n \"aria-controls\": u\n });\n\n var d = W(l, e.inputId + \"-ts-control\"),\n h = \"label[for='\" + function (e) {\n return e.replace(/['\"\\\\]/g, \"\\\\$&\");\n }(e.inputId) + \"']\",\n f = document.querySelector(h),\n p = e.focus.bind(e);\n\n if (f) {\n q(f, \"click\", p), A(f, {\n for: d\n });\n\n var _t30 = W(f, e.inputId + \"-ts-label\");\n\n A(l, {\n \"aria-labelledby\": _t30\n }), A(o, {\n \"aria-labelledby\": _t30\n });\n }\n\n if (i.style.width = a.style.width, e.plugins.names.length) {\n var _t31 = \"plugin-\" + e.plugins.names.join(\" plugin-\");\n\n C([i, r], _t31);\n }\n\n (null === t.maxItems || t.maxItems > 1) && e.is_select_tag && A(a, {\n multiple: \"multiple\"\n }), t.placeholder && A(n, {\n placeholder: t.placeholder\n }), !t.splitOn && t.delimiter && (t.splitOn = new RegExp(\"\\\\s*\" + v(t.delimiter) + \"+\\\\s*\")), t.load && t.loadThrottle && (t.load = U(t.load, t.loadThrottle)), e.control_input.type = a.type, q(r, \"mouseenter\", function (t) {\n var n = T(t.target, \"[data-selectable]\", r);\n n && e.onOptionHover(t, n);\n }, {\n capture: !0\n }), q(r, \"click\", function (t) {\n var n = T(t.target, \"[data-selectable]\");\n n && (e.onOptionSelect(t, n), Y(t, !0));\n }), q(s, \"click\", function (t) {\n var r = T(t.target, \"[data-ts-item]\", s);\n r && e.onItemSelect(t, r) ? Y(t, !0) : \"\" == n.value && (e.onClick(), Y(t, !0));\n }), q(l, \"keydown\", function (t) {\n return e.onKeyDown(t);\n }), q(n, \"keypress\", function (t) {\n return e.onKeyPress(t);\n }), q(n, \"input\", function (t) {\n return e.onInput(t);\n }), q(l, \"resize\", function () {\n return e.positionDropdown();\n }, c), q(l, \"blur\", function (t) {\n return e.onBlur(t);\n }), q(l, \"focus\", function (t) {\n return e.onFocus(t);\n }), q(n, \"paste\", function (t) {\n return e.onPaste(t);\n });\n\n var g = function g(t) {\n var o = t.composedPath()[0];\n if (!i.contains(o) && !r.contains(o)) return e.isFocused && e.blur(), void e.inputState();\n o == n && e.isOpen ? t.stopPropagation() : Y(t, !0);\n },\n m = function m() {\n e.isOpen && e.positionDropdown();\n },\n y = function y() {\n e.ignoreHover = !1;\n };\n\n q(document, \"mousedown\", g), q(window, \"scroll\", m, c), q(window, \"resize\", m, c), q(window, \"mousemove\", y, c), this._destroy = function () {\n document.removeEventListener(\"mousedown\", g), window.removeEventListener(\"mousemove\", y), window.removeEventListener(\"scroll\", m), window.removeEventListener(\"resize\", m), f && f.removeEventListener(\"click\", p);\n }, this.revertSettings = {\n innerHTML: a.innerHTML,\n tabIndex: a.tabIndex\n }, a.tabIndex = -1, a.insertAdjacentElement(\"afterend\", e.wrapper), e.sync(!1), t.items = [], delete t.optgroups, delete t.options, q(a, \"invalid\", function (t) {\n e.isValid && (e.isValid = !1, e.isInvalid = !0, e.refreshState());\n }), e.updateOriginalInput(), e.refreshItems(), e.close(!1), e.inputState(), e.isSetup = !0, a.disabled ? e.disable() : e.enable(), e.on(\"change\", this.onChange), C(a, \"tomselected\", \"ts-hidden-accessible\"), e.trigger(\"initialize\"), !0 === t.preload && e.preload();\n }\n }, {\n key: \"setupOptions\",\n value: function setupOptions() {\n var _this102 = this;\n\n var e = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];\n var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];\n this.addOptions(e), b(t, function (e) {\n _this102.registerOptionGroup(e);\n });\n }\n }, {\n key: \"setupTemplates\",\n value: function setupTemplates() {\n var e = this,\n t = e.settings.labelField,\n n = e.settings.optgroupLabelField,\n r = {\n optgroup: function optgroup(e) {\n var t = document.createElement(\"div\");\n return t.className = \"optgroup\", t.appendChild(e.options), t;\n },\n optgroup_header: function optgroup_header(e, t) {\n return '\";\n },\n option: function option(e, n) {\n return \"
\" + n(e[t]) + \"
\";\n },\n item: function item(e, n) {\n return \"
\" + n(e[t]) + \"
\";\n },\n option_create: function option_create(e, t) {\n return '
Add ' + t(e.input) + \"…
\";\n },\n no_results: function no_results() {\n return '
No results found
';\n },\n loading: function loading() {\n return '
';\n },\n not_loading: function not_loading() {},\n dropdown: function dropdown() {\n return \"
\";\n }\n };\n e.settings.render = Object.assign({}, r, e.settings.render);\n }\n }, {\n key: \"setupCallbacks\",\n value: function setupCallbacks() {\n var e,\n t,\n n = {\n initialize: \"onInitialize\",\n change: \"onChange\",\n item_add: \"onItemAdd\",\n item_remove: \"onItemRemove\",\n item_select: \"onItemSelect\",\n clear: \"onClear\",\n option_add: \"onOptionAdd\",\n option_remove: \"onOptionRemove\",\n option_clear: \"onOptionClear\",\n optgroup_add: \"onOptionGroupAdd\",\n optgroup_remove: \"onOptionGroupRemove\",\n optgroup_clear: \"onOptionGroupClear\",\n dropdown_open: \"onDropdownOpen\",\n dropdown_close: \"onDropdownClose\",\n type: \"onType\",\n load: \"onLoad\",\n focus: \"onFocus\",\n blur: \"onBlur\"\n };\n\n for (e in n) {\n (t = this.settings[n[e]]) && this.on(e, t);\n }\n }\n }, {\n key: \"sync\",\n value: function sync() {\n var e = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : !0;\n var t = this,\n n = e ? Q(t.input, {\n delimiter: t.settings.delimiter\n }) : t.settings;\n t.setupOptions(n.options, n.optgroups), t.setValue(n.items || [], !0), t.lastQuery = null;\n }\n }, {\n key: \"onClick\",\n value: function onClick() {\n var e = this;\n if (e.activeItems.length > 0) return e.clearActiveItems(), void e.focus();\n e.isFocused && e.isOpen ? e.blur() : e.focus();\n }\n }, {\n key: \"onMouseDown\",\n value: function onMouseDown() {}\n }, {\n key: \"onChange\",\n value: function onChange() {\n S(this.input, \"input\"), S(this.input, \"change\");\n }\n }, {\n key: \"onPaste\",\n value: function onPaste(e) {\n var _this103 = this;\n\n var t = this;\n t.isInputHidden || t.isLocked ? Y(e) : t.settings.splitOn && setTimeout(function () {\n var e = t.inputValue();\n\n if (e.match(t.settings.splitOn)) {\n var n = e.trim().split(t.settings.splitOn);\n b(n, function (e) {\n e = N(e), _this103.options[e] ? t.addItem(e) : t.createItem(e);\n });\n }\n }, 0);\n }\n }, {\n key: \"onKeyPress\",\n value: function onKeyPress(e) {\n var t = this;\n\n if (!t.isLocked) {\n var n = String.fromCharCode(e.keyCode || e.which);\n return t.settings.create && \"multi\" === t.settings.mode && n === t.settings.delimiter ? (t.createItem(), void Y(e)) : void 0;\n }\n\n Y(e);\n }\n }, {\n key: \"onKeyDown\",\n value: function onKeyDown(e) {\n var t = this;\n if (t.ignoreHover = !0, t.isLocked) 9 !== e.keyCode && Y(e);else {\n switch (e.keyCode) {\n case 65:\n if (V(I, e) && \"\" == t.control_input.value) return Y(e), void t.selectAll();\n break;\n\n case 27:\n return t.isOpen && (Y(e, !0), t.close()), void t.clearActiveItems();\n\n case 40:\n if (!t.isOpen && t.hasOptions) t.open();else if (t.activeOption) {\n var _e33 = t.getAdjacent(t.activeOption, 1);\n\n _e33 && t.setActiveOption(_e33);\n }\n return void Y(e);\n\n case 38:\n if (t.activeOption) {\n var _e34 = t.getAdjacent(t.activeOption, -1);\n\n _e34 && t.setActiveOption(_e34);\n }\n\n return void Y(e);\n\n case 13:\n return void (t.canSelect(t.activeOption) ? (t.onOptionSelect(e, t.activeOption), Y(e)) : (t.settings.create && t.createItem() || document.activeElement == t.control_input && t.isOpen) && Y(e));\n\n case 37:\n return void t.advanceSelection(-1, e);\n\n case 39:\n return void t.advanceSelection(1, e);\n\n case 9:\n return void (t.settings.selectOnTab && (t.canSelect(t.activeOption) && (t.onOptionSelect(e, t.activeOption), Y(e)), t.settings.create && t.createItem() && Y(e)));\n\n case 8:\n case 46:\n return void t.deleteSelection(e);\n }\n\n t.isInputHidden && !V(I, e) && Y(e);\n }\n }\n }, {\n key: \"onInput\",\n value: function onInput(e) {\n var t = this;\n\n if (!t.isLocked) {\n var n = t.inputValue();\n t.lastValue !== n && (t.lastValue = n, t.settings.shouldLoad.call(t, n) && t.load(n), t.refreshOptions(), t.trigger(\"type\", n));\n }\n }\n }, {\n key: \"onOptionHover\",\n value: function onOptionHover(e, t) {\n this.ignoreHover || this.setActiveOption(t, !1);\n }\n }, {\n key: \"onFocus\",\n value: function onFocus(e) {\n var t = this,\n n = t.isFocused;\n if (t.isDisabled) return t.blur(), void Y(e);\n t.ignoreFocus || (t.isFocused = !0, \"focus\" === t.settings.preload && t.preload(), n || t.trigger(\"focus\"), t.activeItems.length || (t.showInput(), t.refreshOptions(!!t.settings.openOnFocus)), t.refreshState());\n }\n }, {\n key: \"onBlur\",\n value: function onBlur(e) {\n if (!1 !== document.hasFocus()) {\n var t = this;\n\n if (t.isFocused) {\n t.isFocused = !1, t.ignoreFocus = !1;\n\n var n = function n() {\n t.close(), t.setActiveItem(), t.setCaret(t.items.length), t.trigger(\"blur\");\n };\n\n t.settings.create && t.settings.createOnBlur ? t.createItem(null, !1, n) : n();\n }\n }\n }\n }, {\n key: \"onOptionSelect\",\n value: function onOptionSelect(e, t) {\n var n,\n r = this;\n t.parentElement && t.parentElement.matches(\"[data-disabled]\") || (t.classList.contains(\"create\") ? r.createItem(null, !0, function () {\n r.settings.closeAfterSelect && r.close();\n }) : void 0 !== (n = t.dataset.value) && (r.lastQuery = null, r.addItem(n), r.settings.closeAfterSelect && r.close(), !r.settings.hideSelected && e.type && /click/.test(e.type) && r.setActiveOption(t)));\n }\n }, {\n key: \"canSelect\",\n value: function canSelect(e) {\n return !!(this.isOpen && e && this.dropdown_content.contains(e));\n }\n }, {\n key: \"onItemSelect\",\n value: function onItemSelect(e, t) {\n var n = this;\n return !n.isLocked && \"multi\" === n.settings.mode && (Y(e), n.setActiveItem(t, e), !0);\n }\n }, {\n key: \"canLoad\",\n value: function canLoad(e) {\n return !!this.settings.load && !this.loadedSearches.hasOwnProperty(e);\n }\n }, {\n key: \"load\",\n value: function load(e) {\n var t = this;\n if (!t.canLoad(e)) return;\n C(t.wrapper, t.settings.loadingClass), t.loading++;\n var n = t.loadCallback.bind(t);\n t.settings.load.call(t, e, n);\n }\n }, {\n key: \"loadCallback\",\n value: function loadCallback(e, t) {\n var n = this;\n n.loading = Math.max(n.loading - 1, 0), n.lastQuery = null, n.clearActiveOption(), n.setupOptions(e, t), n.refreshOptions(n.isFocused && !n.isInputHidden), n.loading || k(n.wrapper, n.settings.loadingClass), n.trigger(\"load\", e, t);\n }\n }, {\n key: \"preload\",\n value: function preload() {\n var e = this.wrapper.classList;\n e.contains(\"preloaded\") || (e.add(\"preloaded\"), this.load(\"\"));\n }\n }, {\n key: \"setTextboxValue\",\n value: function setTextboxValue() {\n var e = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : \"\";\n var t = this.control_input;\n t.value !== e && (t.value = e, S(t, \"update\"), this.lastValue = e);\n }\n }, {\n key: \"getValue\",\n value: function getValue() {\n return this.is_select_tag && this.input.hasAttribute(\"multiple\") ? this.items : this.items.join(this.settings.delimiter);\n }\n }, {\n key: \"setValue\",\n value: function setValue(e, t) {\n var _this104 = this;\n\n z(this, t ? [] : [\"change\"], function () {\n _this104.clear(t), _this104.addItems(e, t);\n });\n }\n }, {\n key: \"setMaxItems\",\n value: function setMaxItems(e) {\n 0 === e && (e = null), this.settings.maxItems = e, this.refreshState();\n }\n }, {\n key: \"setActiveItem\",\n value: function setActiveItem(e, t) {\n var n,\n r,\n o,\n i,\n s,\n a,\n l = this;\n\n if (\"single\" !== l.settings.mode) {\n if (!e) return l.clearActiveItems(), void (l.isFocused && l.showInput());\n\n if (\"click\" === (n = t && t.type.toLowerCase()) && V(\"shiftKey\", t) && l.activeItems.length) {\n for (a = l.getLastActive(), (o = Array.prototype.indexOf.call(l.control.children, a)) > (i = Array.prototype.indexOf.call(l.control.children, e)) && (s = o, o = i, i = s), r = o; r <= i; r++) {\n e = l.control.children[r], -1 === l.activeItems.indexOf(e) && l.setActiveItemClass(e);\n }\n\n Y(t);\n } else \"click\" === n && V(I, t) || \"keydown\" === n && V(\"shiftKey\", t) ? e.classList.contains(\"active\") ? l.removeActiveItem(e) : l.setActiveItemClass(e) : (l.clearActiveItems(), l.setActiveItemClass(e));\n\n l.hideInput(), l.isFocused || l.focus();\n }\n }\n }, {\n key: \"setActiveItemClass\",\n value: function setActiveItemClass(e) {\n var t = this,\n n = t.control.querySelector(\".last-active\");\n n && k(n, \"last-active\"), C(e, \"active last-active\"), t.trigger(\"item_select\", e), -1 == t.activeItems.indexOf(e) && t.activeItems.push(e);\n }\n }, {\n key: \"removeActiveItem\",\n value: function removeActiveItem(e) {\n var t = this.activeItems.indexOf(e);\n this.activeItems.splice(t, 1), k(e, \"active\");\n }\n }, {\n key: \"clearActiveItems\",\n value: function clearActiveItems() {\n k(this.activeItems, \"active\"), this.activeItems = [];\n }\n }, {\n key: \"setActiveOption\",\n value: function setActiveOption(e) {\n var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !0;\n e !== this.activeOption && (this.clearActiveOption(), e && (this.activeOption = e, A(this.focus_node, {\n \"aria-activedescendant\": e.getAttribute(\"id\")\n }), A(e, {\n \"aria-selected\": \"true\"\n }), C(e, \"active\"), t && this.scrollToOption(e)));\n }\n }, {\n key: \"scrollToOption\",\n value: function scrollToOption(e, t) {\n if (!e) return;\n var n = this.dropdown_content,\n r = n.clientHeight,\n o = n.scrollTop || 0,\n i = e.offsetHeight,\n s = e.getBoundingClientRect().top - n.getBoundingClientRect().top + o;\n s + i > r + o ? this.scroll(s - r + i, t) : s < o && this.scroll(s, t);\n }\n }, {\n key: \"scroll\",\n value: function scroll(e, t) {\n var n = this.dropdown_content;\n t && (n.style.scrollBehavior = t), n.scrollTop = e, n.style.scrollBehavior = \"\";\n }\n }, {\n key: \"clearActiveOption\",\n value: function clearActiveOption() {\n this.activeOption && (k(this.activeOption, \"active\"), A(this.activeOption, {\n \"aria-selected\": null\n })), this.activeOption = null, A(this.focus_node, {\n \"aria-activedescendant\": null\n });\n }\n }, {\n key: \"selectAll\",\n value: function selectAll() {\n var e = this;\n if (\"single\" === e.settings.mode) return;\n var t = e.controlChildren();\n t.length && (e.hideInput(), e.close(), e.activeItems = t, b(t, function (t) {\n e.setActiveItemClass(t);\n }));\n }\n }, {\n key: \"inputState\",\n value: function inputState() {\n var e = this;\n e.control.contains(e.control_input) && (A(e.control_input, {\n placeholder: e.settings.placeholder\n }), e.activeItems.length > 0 || !e.isFocused && e.settings.hidePlaceholder && e.items.length > 0 ? (e.setTextboxValue(), e.isInputHidden = !0) : (e.settings.hidePlaceholder && e.items.length > 0 && A(e.control_input, {\n placeholder: \"\"\n }), e.isInputHidden = !1), e.wrapper.classList.toggle(\"input-hidden\", e.isInputHidden));\n }\n }, {\n key: \"hideInput\",\n value: function hideInput() {\n this.inputState();\n }\n }, {\n key: \"showInput\",\n value: function showInput() {\n this.inputState();\n }\n }, {\n key: \"inputValue\",\n value: function inputValue() {\n return this.control_input.value.trim();\n }\n }, {\n key: \"focus\",\n value: function focus() {\n var e = this;\n e.isDisabled || (e.ignoreFocus = !0, e.control_input.offsetWidth ? e.control_input.focus() : e.focus_node.focus(), setTimeout(function () {\n e.ignoreFocus = !1, e.onFocus();\n }, 0));\n }\n }, {\n key: \"blur\",\n value: function blur() {\n this.focus_node.blur(), this.onBlur();\n }\n }, {\n key: \"getScoreFunction\",\n value: function getScoreFunction(e) {\n return this.sifter.getScoreFunction(e, this.getSearchOptions());\n }\n }, {\n key: \"getSearchOptions\",\n value: function getSearchOptions() {\n var e = this.settings,\n t = e.sortField;\n return \"string\" == typeof e.sortField && (t = [{\n field: e.sortField\n }]), {\n fields: e.searchField,\n conjunction: e.searchConjunction,\n sort: t,\n nesting: e.nesting\n };\n }\n }, {\n key: \"search\",\n value: function search(e) {\n var t,\n n,\n r,\n o = this,\n i = this.getSearchOptions();\n if (o.settings.score && \"function\" != typeof (r = o.settings.score.call(o, e))) throw new Error('Tom Select \"score\" setting must be a function that returns a function');\n if (e !== o.lastQuery ? (o.lastQuery = e, n = o.sifter.search(e, Object.assign(i, {\n score: r\n })), o.currentResults = n) : n = Object.assign({}, o.currentResults), o.settings.hideSelected) for (t = n.items.length - 1; t >= 0; t--) {\n var _e35 = N(n.items[t].id);\n\n _e35 && -1 !== o.items.indexOf(_e35) && n.items.splice(t, 1);\n }\n return n;\n }\n }, {\n key: \"refreshOptions\",\n value: function refreshOptions() {\n var e = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : !0;\n var t, n, r, o, i, s, a, l, c, u, d;\n var h = {},\n f = [];\n var p,\n g = this,\n m = g.inputValue(),\n v = g.search(m),\n y = null,\n w = g.settings.shouldOpen || !1,\n O = g.dropdown_content;\n\n for (g.activeOption && (c = g.activeOption.dataset.value, u = g.activeOption.closest(\"[data-group]\")), o = v.items.length, \"number\" == typeof g.settings.maxOptions && (o = Math.min(o, g.settings.maxOptions)), o > 0 && (w = !0), t = 0; t < o; t++) {\n var _e36 = v.items[t].id,\n _o13 = g.options[_e36],\n _a2 = g.getOption(_e36, !0);\n\n for (g.settings.hideSelected || _a2.classList.toggle(\"selected\", g.items.includes(_e36)), i = _o13[g.settings.optgroupField] || \"\", n = 0, r = (s = Array.isArray(i) ? i : [i]) && s.length; n < r; n++) {\n i = s[n], g.optgroups.hasOwnProperty(i) || (i = \"\"), h.hasOwnProperty(i) || (h[i] = document.createDocumentFragment(), f.push(i)), n > 0 && (_a2 = _a2.cloneNode(!0), A(_a2, {\n id: _o13.$id + \"-clone-\" + n,\n \"aria-selected\": null\n }), _a2.classList.add(\"ts-cloned\"), k(_a2, \"active\")), y || c != _e36 || (u ? u.dataset.group === i && (y = _a2) : y = _a2), h[i].appendChild(_a2);\n }\n }\n\n this.settings.lockOptgroupOrder && f.sort(function (e, t) {\n return (g.optgroups[e] && g.optgroups[e].$order || 0) - (g.optgroups[t] && g.optgroups[t].$order || 0);\n }), a = document.createDocumentFragment(), b(f, function (e) {\n if (g.optgroups.hasOwnProperty(e) && h[e].children.length) {\n var _t32 = document.createDocumentFragment(),\n _n23 = g.render(\"optgroup_header\", g.optgroups[e]);\n\n X(_t32, _n23), X(_t32, h[e]);\n\n var _r25 = g.render(\"optgroup\", {\n group: g.optgroups[e],\n options: _t32\n });\n\n X(a, _r25);\n } else X(a, h[e]);\n }), O.innerHTML = \"\", X(O, a), g.settings.highlight && (p = O.querySelectorAll(\"span.highlight\"), Array.prototype.forEach.call(p, function (e) {\n var t = e.parentNode;\n t.replaceChild(e.firstChild, e), t.normalize();\n }), v.query.length && v.tokens.length && b(v.tokens, function (e) {\n L(O, e.regex);\n }));\n\n var E = function E(e) {\n var t = g.render(e, {\n input: m\n });\n return t && (w = !0, O.insertBefore(t, O.firstChild)), t;\n };\n\n if (g.loading ? E(\"loading\") : g.settings.shouldLoad.call(g, m) ? 0 === v.items.length && E(\"no_results\") : E(\"not_loading\"), (l = g.canCreate(m)) && (d = E(\"option_create\")), g.hasOptions = v.items.length > 0 || l, w) {\n if (v.items.length > 0) {\n if (!y && \"single\" === g.settings.mode && g.items.length && (y = g.getOption(g.items[0])), !O.contains(y)) {\n var _e37 = 0;\n d && !g.settings.addPrecedence && (_e37 = 1), y = g.selectable()[_e37];\n }\n } else d && (y = d);\n\n e && !g.isOpen && (g.open(), g.scrollToOption(y, \"auto\")), g.setActiveOption(y);\n } else g.clearActiveOption(), e && g.isOpen && g.close(!1);\n }\n }, {\n key: \"selectable\",\n value: function selectable() {\n return this.dropdown_content.querySelectorAll(\"[data-selectable]\");\n }\n }, {\n key: \"addOption\",\n value: function addOption(e) {\n var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !1;\n var n = this;\n if (Array.isArray(e)) return n.addOptions(e, t), !1;\n var r = N(e[n.settings.valueField]);\n return null !== r && !n.options.hasOwnProperty(r) && (e.$order = e.$order || ++n.order, e.$id = n.inputId + \"-opt-\" + e.$order, n.options[r] = e, n.lastQuery = null, t && (n.userOptions[r] = t, n.trigger(\"option_add\", r, e)), r);\n }\n }, {\n key: \"addOptions\",\n value: function addOptions(e) {\n var _this105 = this;\n\n var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !1;\n b(e, function (e) {\n _this105.addOption(e, t);\n });\n }\n }, {\n key: \"registerOption\",\n value: function registerOption(e) {\n return this.addOption(e);\n }\n }, {\n key: \"registerOptionGroup\",\n value: function registerOptionGroup(e) {\n var t = N(e[this.settings.optgroupValueField]);\n return null !== t && (e.$order = e.$order || ++this.order, this.optgroups[t] = e, t);\n }\n }, {\n key: \"addOptionGroup\",\n value: function addOptionGroup(e, t) {\n var n;\n t[this.settings.optgroupValueField] = e, (n = this.registerOptionGroup(t)) && this.trigger(\"optgroup_add\", n, t);\n }\n }, {\n key: \"removeOptionGroup\",\n value: function removeOptionGroup(e) {\n this.optgroups.hasOwnProperty(e) && (delete this.optgroups[e], this.clearCache(), this.trigger(\"optgroup_remove\", e));\n }\n }, {\n key: \"clearOptionGroups\",\n value: function clearOptionGroups() {\n this.optgroups = {}, this.clearCache(), this.trigger(\"optgroup_clear\");\n }\n }, {\n key: \"updateOption\",\n value: function updateOption(e, t) {\n var n = this;\n var r, o;\n var i = N(e),\n s = N(t[n.settings.valueField]);\n if (null === i) return;\n if (!n.options.hasOwnProperty(i)) return;\n if (\"string\" != typeof s) throw new Error(\"Value must be set in option data\");\n var a = n.getOption(i),\n l = n.getItem(i);\n\n if (t.$order = t.$order || n.options[i].$order, delete n.options[i], n.uncacheValue(s), n.options[s] = t, a) {\n if (n.dropdown_content.contains(a)) {\n var _e38 = n._render(\"option\", t);\n\n F(a, _e38), n.activeOption === a && n.setActiveOption(_e38);\n }\n\n a.remove();\n }\n\n l && (-1 !== (o = n.items.indexOf(i)) && n.items.splice(o, 1, s), r = n._render(\"item\", t), l.classList.contains(\"active\") && C(r, \"active\"), F(l, r)), n.lastQuery = null;\n }\n }, {\n key: \"removeOption\",\n value: function removeOption(e, t) {\n var n = this;\n e = B(e), n.uncacheValue(e), delete n.userOptions[e], delete n.options[e], n.lastQuery = null, n.trigger(\"option_remove\", e), n.removeItem(e, t);\n }\n }, {\n key: \"clearOptions\",\n value: function clearOptions(e) {\n var _this106 = this;\n\n var t = (e || this.clearFilter).bind(this);\n this.loadedSearches = {}, this.userOptions = {}, this.clearCache();\n var n = {};\n b(this.options, function (e, r) {\n t(e, r) && (n[r] = _this106.options[r]);\n }), this.options = this.sifter.items = n, this.lastQuery = null, this.trigger(\"option_clear\");\n }\n }, {\n key: \"clearFilter\",\n value: function clearFilter(e, t) {\n return this.items.indexOf(t) >= 0;\n }\n }, {\n key: \"getOption\",\n value: function getOption(e) {\n var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !1;\n var n = N(e);\n\n if (null !== n && this.options.hasOwnProperty(n)) {\n var _e39 = this.options[n];\n if (_e39.$div) return _e39.$div;\n if (t) return this._render(\"option\", _e39);\n }\n\n return null;\n }\n }, {\n key: \"getAdjacent\",\n value: function getAdjacent(e, t) {\n var n = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : \"option\";\n var r;\n if (!e) return null;\n r = \"item\" == n ? this.controlChildren() : this.dropdown_content.querySelectorAll(\"[data-selectable]\");\n\n for (var _n24 = 0; _n24 < r.length; _n24++) {\n if (r[_n24] == e) return t > 0 ? r[_n24 + 1] : r[_n24 - 1];\n }\n\n return null;\n }\n }, {\n key: \"getItem\",\n value: function getItem(e) {\n if (\"object\" == _typeof(e)) return e;\n var t = N(e);\n return null !== t ? this.control.querySelector(\"[data-value=\\\"\".concat(K(t), \"\\\"]\")) : null;\n }\n }, {\n key: \"addItems\",\n value: function addItems(e, t) {\n var n = this,\n r = Array.isArray(e) ? e : [e];\n\n for (var _e40 = 0, _o14 = (r = r.filter(function (e) {\n return -1 === n.items.indexOf(e);\n })).length; _e40 < _o14; _e40++) {\n n.isPending = _e40 < _o14 - 1, n.addItem(r[_e40], t);\n }\n }\n }, {\n key: \"addItem\",\n value: function addItem(e, t) {\n var _this107 = this;\n\n z(this, t ? [] : [\"change\", \"dropdown_close\"], function () {\n var n, r;\n var o = _this107,\n i = o.settings.mode,\n s = N(e);\n\n if ((!s || -1 === o.items.indexOf(s) || (\"single\" === i && o.close(), \"single\" !== i && o.settings.duplicates)) && null !== s && o.options.hasOwnProperty(s) && (\"single\" === i && o.clear(t), \"multi\" !== i || !o.isFull())) {\n if (n = o._render(\"item\", o.options[s]), o.control.contains(n) && (n = n.cloneNode(!0)), r = o.isFull(), o.items.splice(o.caretPos, 0, s), o.insertAtCaret(n), o.isSetup) {\n if (!o.isPending && o.settings.hideSelected) {\n var _e41 = o.getOption(s),\n _t33 = o.getAdjacent(_e41, 1);\n\n _t33 && o.setActiveOption(_t33);\n }\n\n o.isPending || o.settings.closeAfterSelect || o.refreshOptions(o.isFocused && \"single\" !== i), 0 != o.settings.closeAfterSelect && o.isFull() ? o.close() : o.isPending || o.positionDropdown(), o.trigger(\"item_add\", s, n), o.isPending || o.updateOriginalInput({\n silent: t\n });\n }\n\n (!o.isPending || !r && o.isFull()) && (o.inputState(), o.refreshState());\n }\n });\n }\n }, {\n key: \"removeItem\",\n value: function removeItem() {\n var e = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;\n var t = arguments.length > 1 ? arguments[1] : undefined;\n var n = this;\n if (!(e = n.getItem(e))) return;\n var r, o;\n var i = e.dataset.value;\n r = M(e), e.remove(), e.classList.contains(\"active\") && (o = n.activeItems.indexOf(e), n.activeItems.splice(o, 1), k(e, \"active\")), n.items.splice(r, 1), n.lastQuery = null, !n.settings.persist && n.userOptions.hasOwnProperty(i) && n.removeOption(i, t), r < n.caretPos && n.setCaret(n.caretPos - 1), n.updateOriginalInput({\n silent: t\n }), n.refreshState(), n.positionDropdown(), n.trigger(\"item_remove\", i, e);\n }\n }, {\n key: \"createItem\",\n value: function createItem() {\n var _ref44;\n\n var e = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;\n var t = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : !0;\n var n = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : function () {};\n var r,\n o = this,\n i = o.caretPos;\n if (e = e || o.inputValue(), !o.canCreate(e)) return n(), !1;\n o.lock();\n\n var s = !1,\n a = function a(e) {\n if (o.unlock(), !e || \"object\" != _typeof(e)) return n();\n var t = N(e[o.settings.valueField]);\n if (\"string\" != typeof t) return n();\n o.setTextboxValue(), o.addOption(e, !0), o.setCaret(i), o.addItem(t), n(e), s = !0;\n };\n\n return r = \"function\" == typeof o.settings.create ? o.settings.create.call(this, e, a) : (_ref44 = {}, _defineProperty(_ref44, o.settings.labelField, e), _defineProperty(_ref44, o.settings.valueField, e), _ref44), s || a(r), !0;\n }\n }, {\n key: \"refreshItems\",\n value: function refreshItems() {\n var e = this;\n e.lastQuery = null, e.isSetup && e.addItems(e.items), e.updateOriginalInput(), e.refreshState();\n }\n }, {\n key: \"refreshState\",\n value: function refreshState() {\n var e = this;\n e.refreshValidityState();\n var t = e.isFull(),\n n = e.isLocked;\n e.wrapper.classList.toggle(\"rtl\", e.rtl);\n var r = e.wrapper.classList;\n var o;\n r.toggle(\"focus\", e.isFocused), r.toggle(\"disabled\", e.isDisabled), r.toggle(\"required\", e.isRequired), r.toggle(\"invalid\", !e.isValid), r.toggle(\"locked\", n), r.toggle(\"full\", t), r.toggle(\"input-active\", e.isFocused && !e.isInputHidden), r.toggle(\"dropdown-active\", e.isOpen), r.toggle(\"has-options\", (o = e.options, 0 === Object.keys(o).length)), r.toggle(\"has-items\", e.items.length > 0);\n }\n }, {\n key: \"refreshValidityState\",\n value: function refreshValidityState() {\n var e = this;\n e.input.validity && (e.isValid = e.input.validity.valid, e.isInvalid = !e.isValid);\n }\n }, {\n key: \"isFull\",\n value: function isFull() {\n return null !== this.settings.maxItems && this.items.length >= this.settings.maxItems;\n }\n }, {\n key: \"updateOriginalInput\",\n value: function updateOriginalInput() {\n var e = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n var t = this;\n var n, r;\n var o = t.input.querySelector('option[value=\"\"]');\n\n if (t.is_select_tag) {\n var _i47 = [],\n _s4 = t.input.querySelectorAll(\"option:checked\").length;\n\n function _a3(e, n, r) {\n return e || (e = E('
\")), e != o && t.input.append(e), _i47.push(e), (e != o || _s4 > 0) && (e.selected = !0), e;\n }\n\n t.input.querySelectorAll(\"option:checked\").forEach(function (e) {\n e.selected = !1;\n }), 0 == t.items.length && \"single\" == t.settings.mode ? _a3(o, \"\", \"\") : t.items.forEach(function (e) {\n n = t.options[e], r = n[t.settings.labelField] || \"\", _i47.includes(n.$option) ? _a3(t.input.querySelector(\"option[value=\\\"\".concat(K(e), \"\\\"]:not(:checked)\")), e, r) : n.$option = _a3(n.$option, e, r);\n });\n } else t.input.value = t.getValue();\n\n t.isSetup && (e.silent || t.trigger(\"change\", t.getValue()));\n }\n }, {\n key: \"open\",\n value: function open() {\n var e = this;\n e.isLocked || e.isOpen || \"multi\" === e.settings.mode && e.isFull() || (e.isOpen = !0, A(e.focus_node, {\n \"aria-expanded\": \"true\"\n }), e.refreshState(), x(e.dropdown, {\n visibility: \"hidden\",\n display: \"block\"\n }), e.positionDropdown(), x(e.dropdown, {\n visibility: \"visible\",\n display: \"block\"\n }), e.focus(), e.trigger(\"dropdown_open\", e.dropdown));\n }\n }, {\n key: \"close\",\n value: function close() {\n var e = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : !0;\n var t = this,\n n = t.isOpen;\n e && (t.setTextboxValue(), \"single\" === t.settings.mode && t.items.length && t.hideInput()), t.isOpen = !1, A(t.focus_node, {\n \"aria-expanded\": \"false\"\n }), x(t.dropdown, {\n display: \"none\"\n }), t.settings.hideSelected && t.clearActiveOption(), t.refreshState(), n && t.trigger(\"dropdown_close\", t.dropdown);\n }\n }, {\n key: \"positionDropdown\",\n value: function positionDropdown() {\n if (\"body\" === this.settings.dropdownParent) {\n var e = this.control,\n t = e.getBoundingClientRect(),\n n = e.offsetHeight + t.top + window.scrollY,\n r = t.left + window.scrollX;\n x(this.dropdown, {\n width: t.width + \"px\",\n top: n + \"px\",\n left: r + \"px\"\n });\n }\n }\n }, {\n key: \"clear\",\n value: function clear(e) {\n var t = this;\n\n if (t.items.length) {\n var n = t.controlChildren();\n b(n, function (e) {\n t.removeItem(e, !0);\n }), t.showInput(), e || t.updateOriginalInput(), t.trigger(\"clear\");\n }\n }\n }, {\n key: \"insertAtCaret\",\n value: function insertAtCaret(e) {\n var t = this,\n n = t.caretPos,\n r = t.control;\n r.insertBefore(e, r.children[n]), t.setCaret(n + 1);\n }\n }, {\n key: \"deleteSelection\",\n value: function deleteSelection(e) {\n var t,\n n,\n r,\n o,\n i,\n s = this;\n t = e && 8 === e.keyCode ? -1 : 1, n = {\n start: (i = s.control_input).selectionStart || 0,\n length: (i.selectionEnd || 0) - (i.selectionStart || 0)\n };\n var a = [];\n if (s.activeItems.length) o = D(s.activeItems, t), r = M(o), t > 0 && r++, b(s.activeItems, function (e) {\n return a.push(e);\n });else if ((s.isFocused || \"single\" === s.settings.mode) && s.items.length) {\n var _e42 = s.controlChildren();\n\n t < 0 && 0 === n.start && 0 === n.length ? a.push(_e42[s.caretPos - 1]) : t > 0 && n.start === s.inputValue().length && a.push(_e42[s.caretPos]);\n }\n if (!s.shouldDelete(a, e)) return !1;\n\n for (Y(e, !0), void 0 !== r && s.setCaret(r); a.length;) {\n s.removeItem(a.pop());\n }\n\n return s.showInput(), s.positionDropdown(), s.refreshOptions(!1), !0;\n }\n }, {\n key: \"shouldDelete\",\n value: function shouldDelete(e, t) {\n var n = e.map(function (e) {\n return e.dataset.value;\n });\n return !(!n.length || \"function\" == typeof this.settings.onDelete && !1 === this.settings.onDelete(n, t));\n }\n }, {\n key: \"advanceSelection\",\n value: function advanceSelection(e, t) {\n var n,\n r,\n o = this;\n o.rtl && (e *= -1), o.inputValue().length || (V(I, t) || V(\"shiftKey\", t) ? (r = (n = o.getLastActive(e)) ? n.classList.contains(\"active\") ? o.getAdjacent(n, e, \"item\") : n : e > 0 ? o.control_input.nextElementSibling : o.control_input.previousElementSibling) && (r.classList.contains(\"active\") && o.removeActiveItem(n), o.setActiveItemClass(r)) : o.moveCaret(e));\n }\n }, {\n key: \"moveCaret\",\n value: function moveCaret(e) {}\n }, {\n key: \"getLastActive\",\n value: function getLastActive(e) {\n var t = this.control.querySelector(\".last-active\");\n if (t) return t;\n var n = this.control.querySelectorAll(\".active\");\n return n ? D(n, e) : void 0;\n }\n }, {\n key: \"setCaret\",\n value: function setCaret(e) {\n this.caretPos = this.items.length;\n }\n }, {\n key: \"controlChildren\",\n value: function controlChildren() {\n return Array.from(this.control.querySelectorAll(\"[data-ts-item]\"));\n }\n }, {\n key: \"lock\",\n value: function lock() {\n this.isLocked = !0, this.refreshState();\n }\n }, {\n key: \"unlock\",\n value: function unlock() {\n this.isLocked = !1, this.refreshState();\n }\n }, {\n key: \"disable\",\n value: function disable() {\n var e = this;\n e.input.disabled = !0, e.control_input.disabled = !0, e.focus_node.tabIndex = -1, e.isDisabled = !0, this.close(), e.lock();\n }\n }, {\n key: \"enable\",\n value: function enable() {\n var e = this;\n e.input.disabled = !1, e.control_input.disabled = !1, e.focus_node.tabIndex = e.tabIndex, e.isDisabled = !1, e.unlock();\n }\n }, {\n key: \"destroy\",\n value: function destroy() {\n var e = this,\n t = e.revertSettings;\n e.trigger(\"destroy\"), e.off(), e.wrapper.remove(), e.dropdown.remove(), e.input.innerHTML = t.innerHTML, e.input.tabIndex = t.tabIndex, k(e.input, \"tomselected\", \"ts-hidden-accessible\"), e._destroy(), delete e.input.tomselect;\n }\n }, {\n key: \"render\",\n value: function render(e, t) {\n return \"function\" != typeof this.settings.render[e] ? null : this._render(e, t);\n }\n }, {\n key: \"_render\",\n value: function _render(e, t) {\n var n,\n r,\n o = \"\";\n var i = this;\n return \"option\" !== e && \"item\" != e || (o = B(t[i.settings.valueField])), null == (r = i.settings.render[e].call(this, t, H)) || (r = E(r), \"option\" === e || \"option_create\" === e ? t[i.settings.disabledField] ? A(r, {\n \"aria-disabled\": \"true\"\n }) : A(r, {\n \"data-selectable\": \"\"\n }) : \"optgroup\" === e && (n = t.group[i.settings.optgroupValueField], A(r, {\n \"data-group\": n\n }), t.group[i.settings.disabledField] && A(r, {\n \"data-disabled\": \"\"\n })), \"option\" !== e && \"item\" !== e || (A(r, {\n \"data-value\": o\n }), \"item\" === e ? (C(r, i.settings.itemClass), A(r, {\n \"data-ts-item\": \"\"\n })) : (C(r, i.settings.optionClass), A(r, {\n role: \"option\",\n id: t.$id\n }), i.options[o].$div = r))), r;\n }\n }, {\n key: \"clearCache\",\n value: function clearCache() {\n b(this.options, function (e, t) {\n e.$div && (e.$div.remove(), delete e.$div);\n });\n }\n }, {\n key: \"uncacheValue\",\n value: function uncacheValue(e) {\n var t = this.getOption(e);\n t && t.remove();\n }\n }, {\n key: \"canCreate\",\n value: function canCreate(e) {\n return this.settings.create && e.length > 0 && this.settings.createFilter.call(this, e);\n }\n }, {\n key: \"hook\",\n value: function hook(e, t, n) {\n var r = this,\n o = r[t];\n\n r[t] = function () {\n var t, i;\n return \"after\" === e && (t = o.apply(r, arguments)), i = n.apply(r, arguments), \"instead\" === e ? i : (\"before\" === e && (t = o.apply(r, arguments)), t);\n };\n }\n }]);\n\n return J;\n }(function (e) {\n return e.plugins = {}, /*#__PURE__*/function (_e43) {\n _inherits(_class9, _e43);\n\n var _super66 = _createSuper(_class9);\n\n function _class9() {\n var _this108;\n\n _classCallCheck(this, _class9);\n\n for (var _len22 = arguments.length, e = new Array(_len22), _key22 = 0; _key22 < _len22; _key22++) {\n e[_key22] = arguments[_key22];\n }\n\n _this108 = _super66.call.apply(_super66, [this].concat(e)), _this108.plugins = {\n names: [],\n settings: {},\n requested: {},\n loaded: {}\n };\n return _this108;\n }\n\n _createClass(_class9, [{\n key: \"initializePlugins\",\n value: function initializePlugins(e) {\n var t, n;\n var r = this,\n o = [];\n if (Array.isArray(e)) e.forEach(function (e) {\n \"string\" == typeof e ? o.push(e) : (r.plugins.settings[e.name] = e.options, o.push(e.name));\n });else if (e) for (t in e) {\n e.hasOwnProperty(t) && (r.plugins.settings[t] = e[t], o.push(t));\n }\n\n for (; n = o.shift();) {\n r.require(n);\n }\n }\n }, {\n key: \"loadPlugin\",\n value: function loadPlugin(t) {\n var n = this,\n r = n.plugins,\n o = e.plugins[t];\n if (!e.plugins.hasOwnProperty(t)) throw new Error('Unable to find \"' + t + '\" plugin');\n r.requested[t] = !0, r.loaded[t] = o.fn.apply(n, [n.plugins.settings[t] || {}]), r.names.push(t);\n }\n }, {\n key: \"require\",\n value: function require(e) {\n var t = this,\n n = t.plugins;\n\n if (!t.plugins.loaded.hasOwnProperty(e)) {\n if (n.requested[e]) throw new Error('Plugin has circular dependency (\"' + e + '\")');\n t.loadPlugin(e);\n }\n\n return n.loaded[e];\n }\n }], [{\n key: \"define\",\n value: function define(t, n) {\n e.plugins[t] = {\n name: t,\n fn: n\n };\n }\n }]);\n\n return _class9;\n }(e);\n }(t));\n\n return J.define(\"change_listener\", function () {\n var _this109 = this;\n\n q(this.input, \"change\", function () {\n _this109.sync();\n });\n }), J.define(\"checkbox_options\", function () {\n var e = this,\n t = e.onOptionSelect;\n e.settings.hideSelected = !1;\n\n var n = function n(e) {\n setTimeout(function () {\n var t = e.querySelector(\"input\");\n t instanceof HTMLInputElement && (e.classList.contains(\"selected\") ? t.checked = !0 : t.checked = !1);\n }, 1);\n };\n\n e.hook(\"after\", \"setupTemplates\", function () {\n var t = e.settings.render.option;\n\n e.settings.render.option = function (n, r) {\n var o = E(t.call(e, n, r)),\n i = document.createElement(\"input\");\n i.addEventListener(\"click\", function (e) {\n Y(e);\n }), i.type = \"checkbox\";\n var s = N(n[e.settings.valueField]);\n return s && e.items.indexOf(s) > -1 && (i.checked = !0), o.prepend(i), o;\n };\n }), e.on(\"item_remove\", function (t) {\n var r = e.getOption(t);\n r && (r.classList.remove(\"selected\"), n(r));\n }), e.on(\"item_add\", function (t) {\n var r = e.getOption(t);\n r && n(r);\n }), e.hook(\"instead\", \"onOptionSelect\", function (r, o) {\n if (o.classList.contains(\"selected\")) return o.classList.remove(\"selected\"), e.removeItem(o.dataset.value), e.refreshOptions(), void Y(r, !0);\n t.call(e, r, o), n(o);\n });\n }), J.define(\"clear_button\", function (e) {\n var t = this,\n n = Object.assign({\n className: \"clear-button\",\n title: \"Clear All\",\n html: function html(e) {\n return \"
×
\");\n }\n }, e);\n t.on(\"initialize\", function () {\n var e = E(n.html(n));\n e.addEventListener(\"click\", function (e) {\n t.isDisabled || (t.clear(), \"single\" === t.settings.mode && t.settings.allowEmptyOption && t.addItem(\"\"), e.preventDefault(), e.stopPropagation());\n }), t.control.appendChild(e);\n });\n }), J.define(\"drag_drop\", function () {\n var e = this;\n if (!$.fn.sortable) throw new Error('The \"drag_drop\" plugin requires jQuery UI \"sortable\".');\n\n if (\"multi\" === e.settings.mode) {\n var t = e.lock,\n n = e.unlock;\n e.hook(\"instead\", \"lock\", function () {\n var n = $(e.control).data(\"sortable\");\n return n && n.disable(), t.call(e);\n }), e.hook(\"instead\", \"unlock\", function () {\n var t = $(e.control).data(\"sortable\");\n return t && t.enable(), n.call(e);\n }), e.on(\"initialize\", function () {\n var t = $(e.control).sortable({\n items: \"[data-value]\",\n forcePlaceholderSize: !0,\n disabled: e.isLocked,\n start: function start(e, n) {\n n.placeholder.css(\"width\", n.helper.css(\"width\")), t.css({\n overflow: \"visible\"\n });\n },\n stop: function stop() {\n t.css({\n overflow: \"hidden\"\n });\n var n = [];\n t.children(\"[data-value]\").each(function () {\n this.dataset.value && n.push(this.dataset.value);\n }), e.setValue(n);\n }\n });\n });\n }\n }), J.define(\"dropdown_header\", function (e) {\n var t = this,\n n = Object.assign({\n title: \"Untitled\",\n headerClass: \"dropdown-header\",\n titleRowClass: \"dropdown-header-title\",\n labelClass: \"dropdown-header-label\",\n closeClass: \"dropdown-header-close\",\n html: function html(e) {\n return '
';\n }\n }, e);\n t.on(\"initialize\", function () {\n var e = E(n.html(n)),\n r = e.querySelector(\".\" + n.closeClass);\n r && r.addEventListener(\"click\", function (e) {\n Y(e, !0), t.close();\n }), t.dropdown.insertBefore(e, t.dropdown.firstChild);\n });\n }), J.define(\"caret_position\", function () {\n var e = this;\n e.hook(\"instead\", \"setCaret\", function (t) {\n \"single\" !== e.settings.mode && e.control.contains(e.control_input) ? (t = Math.max(0, Math.min(e.items.length, t))) == e.caretPos || e.isPending || e.controlChildren().forEach(function (n, r) {\n r < t ? e.control_input.insertAdjacentElement(\"beforebegin\", n) : e.control.appendChild(n);\n }) : t = e.items.length, e.caretPos = t;\n }), e.hook(\"instead\", \"moveCaret\", function (t) {\n if (!e.isFocused) return;\n var n = e.getLastActive(t);\n\n if (n) {\n var _r26 = M(n);\n\n e.setCaret(t > 0 ? _r26 + 1 : _r26), e.setActiveItem(), k(n, \"last-active\");\n } else e.setCaret(e.caretPos + t);\n });\n }), J.define(\"dropdown_input\", function () {\n var e = this;\n e.settings.shouldOpen = !0, e.hook(\"before\", \"setup\", function () {\n e.focus_node = e.control, C(e.control_input, \"dropdown-input\");\n var t = E('
');\n t.append(e.control_input), e.dropdown.insertBefore(t, e.dropdown.firstChild);\n var n = E('
');\n n.placeholder = e.settings.placeholder || \"\", e.control.append(n);\n }), e.on(\"initialize\", function () {\n e.control_input.addEventListener(\"keydown\", function (t) {\n switch (t.keyCode) {\n case 27:\n return e.isOpen && (Y(t, !0), e.close()), void e.clearActiveItems();\n\n case 9:\n e.focus_node.tabIndex = -1;\n }\n\n return e.onKeyDown.call(e, t);\n }), e.on(\"blur\", function () {\n e.focus_node.tabIndex = e.isDisabled ? -1 : e.tabIndex;\n }), e.on(\"dropdown_open\", function () {\n e.control_input.focus();\n });\n var t = e.onBlur;\n e.hook(\"instead\", \"onBlur\", function (n) {\n if (!n || n.relatedTarget != e.control_input) return t.call(e);\n }), q(e.control_input, \"blur\", function () {\n return e.onBlur();\n }), e.hook(\"before\", \"close\", function () {\n e.isOpen && e.focus_node.focus({\n preventScroll: !0\n });\n });\n });\n }), J.define(\"input_autogrow\", function () {\n var e = this;\n e.on(\"initialize\", function () {\n var t = document.createElement(\"span\"),\n n = e.control_input;\n t.style.cssText = \"position:absolute; top:-99999px; left:-99999px; width:auto; padding:0; white-space:pre; \", e.wrapper.appendChild(t);\n\n for (var _i48 = 0, _arr4 = [\"letterSpacing\", \"fontSize\", \"fontFamily\", \"fontWeight\", \"textTransform\"]; _i48 < _arr4.length; _i48++) {\n var _e44 = _arr4[_i48];\n t.style[_e44] = n.style[_e44];\n }\n\n var r = function r() {\n t.textContent = n.value, n.style.width = t.clientWidth + \"px\";\n };\n\n r(), e.on(\"update item_add item_remove\", r), q(n, \"input\", r), q(n, \"keyup\", r), q(n, \"blur\", r), q(n, \"update\", r);\n });\n }), J.define(\"no_backspace_delete\", function () {\n var e = this,\n t = e.deleteSelection;\n this.hook(\"instead\", \"deleteSelection\", function (n) {\n return !!e.activeItems.length && t.call(e, n);\n });\n }), J.define(\"no_active_items\", function () {\n this.hook(\"instead\", \"setActiveItem\", function () {}), this.hook(\"instead\", \"selectAll\", function () {});\n }), J.define(\"optgroup_columns\", function () {\n var e = this,\n t = e.onKeyDown;\n e.hook(\"instead\", \"onKeyDown\", function (n) {\n var r, o, i, s;\n if (!e.isOpen || 37 !== n.keyCode && 39 !== n.keyCode) return t.call(e, n);\n e.ignoreHover = !0, s = T(e.activeOption, \"[data-group]\"), r = M(e.activeOption, \"[data-selectable]\"), s && (s = 37 === n.keyCode ? s.previousSibling : s.nextSibling) && (o = (i = s.querySelectorAll(\"[data-selectable]\"))[Math.min(i.length - 1, r)]) && e.setActiveOption(o);\n });\n }), J.define(\"remove_button\", function (e) {\n var t = Object.assign({\n label: \"×\",\n title: \"Remove\",\n className: \"remove\",\n append: !0\n }, e);\n var n = this;\n\n if (t.append) {\n var r = '
' + t.label + \"\";\n n.hook(\"after\", \"setupTemplates\", function () {\n var e = n.settings.render.item;\n\n n.settings.render.item = function (t, o) {\n var i = E(e.call(n, t, o)),\n s = E(r);\n return i.appendChild(s), q(s, \"mousedown\", function (e) {\n Y(e, !0);\n }), q(s, \"click\", function (e) {\n Y(e, !0), n.isLocked || n.shouldDelete([i], e) && (n.removeItem(i), n.refreshOptions(!1), n.inputState());\n }), i;\n };\n });\n }\n }), J.define(\"restore_on_backspace\", function (e) {\n var t = this,\n n = Object.assign({\n text: function text(e) {\n return e[t.settings.labelField];\n }\n }, e);\n t.on(\"item_remove\", function (e) {\n if (t.isFocused && \"\" === t.control_input.value.trim()) {\n var r = t.options[e];\n r && t.setTextboxValue(n.text.call(t, r));\n }\n });\n }), J.define(\"virtual_scroll\", function () {\n var e = this,\n t = e.canLoad,\n n = e.clearActiveOption,\n r = e.loadCallback;\n var o,\n i,\n s = {},\n a = !1,\n l = [];\n if (e.settings.shouldLoadMore || (e.settings.shouldLoadMore = function () {\n if (o.clientHeight / (o.scrollHeight - o.scrollTop) > .9) return !0;\n\n if (e.activeOption) {\n var t = e.selectable();\n if (_toConsumableArray(t).indexOf(e.activeOption) >= t.length - 2) return !0;\n }\n\n return !1;\n }), !e.settings.firstUrl) throw \"virtual_scroll plugin requires a firstUrl() method\";\n e.settings.sortField = [{\n field: \"$order\"\n }, {\n field: \"$score\"\n }];\n\n var c = function c(t) {\n return !(\"number\" == typeof e.settings.maxOptions && o.children.length >= e.settings.maxOptions || !(t in s) || !s[t]);\n },\n u = function u(t, n) {\n return e.items.indexOf(n) >= 0 || l.indexOf(n) >= 0;\n };\n\n e.setNextUrl = function (e, t) {\n s[e] = t;\n }, e.getUrl = function (t) {\n if (t in s) {\n var _e45 = s[t];\n return s[t] = !1, _e45;\n }\n\n return s = {}, e.settings.firstUrl.call(e, t);\n }, e.hook(\"instead\", \"clearActiveOption\", function () {\n if (!a) return n.call(e);\n }), e.hook(\"instead\", \"canLoad\", function (n) {\n return n in s ? c(n) : t.call(e, n);\n }), e.hook(\"instead\", \"loadCallback\", function (t, n) {\n a ? i && t.length > 0 && (i.dataset.value = t[0][e.settings.valueField]) : e.clearOptions(u), r.call(e, t, n), a = !1;\n }), e.hook(\"after\", \"refreshOptions\", function () {\n var t = e.lastValue;\n var n;\n c(t) ? (n = e.render(\"loading_more\", {\n query: t\n })) && (n.setAttribute(\"data-selectable\", \"\"), i = n) : t in s && !o.querySelector(\".no-results\") && (n = e.render(\"no_more_results\", {\n query: t\n })), n && (C(n, e.settings.optionClass), o.append(n));\n }), e.on(\"initialize\", function () {\n l = Object.keys(e.options), o = e.dropdown_content, e.settings.render = Object.assign({}, {\n loading_more: function loading_more() {\n return '
Loading more results ...
';\n },\n no_more_results: function no_more_results() {\n return '
No more results
';\n }\n }, e.settings.render), o.addEventListener(\"scroll\", function () {\n e.settings.shouldLoadMore.call(e) && c(e.lastValue) && (a || (a = !0, e.load.call(e, e.lastValue)));\n });\n });\n }), J;\n }();\n },\n 1196: function _(e) {\n \"use strict\";\n\n function t(e, t) {\n this.text = e = e || \"\", this.hasWild = ~e.indexOf(\"*\"), this.separator = t, this.parts = e.split(t);\n }\n\n t.prototype.match = function (e) {\n var t,\n n,\n r = !0,\n o = this.parts,\n i = o.length;\n if (\"string\" == typeof e || e instanceof String) {\n if (this.hasWild || this.text == e) {\n for (n = (e || \"\").split(this.separator), t = 0; r && t < i; t++) {\n \"*\" !== o[t] && (r = t < n.length && o[t] === n[t]);\n }\n\n r = r && n;\n } else r = !1;\n } else if (\"function\" == typeof e.splice) for (r = [], t = e.length; t--;) {\n this.match(e[t]) && (r[r.length] = e[t]);\n } else if (\"object\" == _typeof(e)) for (var s in r = {}, e) {\n this.match(s) && (r[s] = e[s]);\n }\n return r;\n }, e.exports = function (e, n, r) {\n var o = new t(e, r || /[\\/\\.]/);\n return void 0 !== n ? o.match(n) : o;\n };\n },\n 321: function _(e, t, n) {\n var r = {\n \"./apparatus/attachment_component_controller.js\": 9334,\n \"./apparatus/attachment_list_block/search_component_controller.js\": 1906,\n \"./apparatus/attachments/attachment_selector_component/attachments_component_controller.js\": 1261,\n \"./apparatus/attachments/attachment_selector_component/search_component_controller.js\": 8831,\n \"./apparatus/attachments/attachment_selector_component_controller.js\": 1795,\n \"./apparatus/blocks/editor_component_controller.js\": 7057,\n \"./apparatus/dialog_loader_controller.js\": 7823,\n \"./apparatus/draft_component_controller.js\": 2365,\n \"./apparatus/drafts/block_composer_component_controller.js\": 2359,\n \"./apparatus/infinite_scroll_controller.js\": 6963,\n \"./apparatus/pages/visibility_switch_component_controller.js\": 4929,\n \"./apparatus/roles/permissions_table_section_component_controller.js\": 7142,\n \"./apparatus/ui/dialog_component_controller.js\": 8307,\n \"./apparatus/ui/dropdown_component_controller.js\": 53,\n \"./apparatus/ui/flash_component_controller.js\": 5191,\n \"./apparatus/ui/page_tree_component/node_component_controller.js\": 2763,\n \"./apparatus/ui/search_field_component_controller.js\": 476,\n \"./apparatus/ui/warning_component_controller.js\": 5027,\n \"./attachment_list_block_controller.js\": 7504,\n \"./attachment_uploader/attachments_list_component_controller.js\": 9799,\n \"./attachment_uploader_component_controller.js\": 2595,\n \"./autogrow_input_controller.js\": 941,\n \"./autogrow_text_input_controller.js\": 623,\n \"./block/destroy_button_controller.js\": 2427,\n \"./block/edit_button_controller.js\": 3012,\n \"./block_type_select_input_controller.js\": 2207,\n \"./date_time_picker_controller.js\": 302,\n \"./filterable_select_input_controller.js\": 9980,\n \"./inputs/block_width_controller.js\": 8401,\n \"./inputs/column_width_controller.js\": 7686,\n \"./lazy_loading_controller.js\": 6179,\n \"./markdown_input_controller.js\": 5534,\n \"./page/visibility_toggle_controller.js\": 5386,\n \"./page_selector_input_controller.js\": 3142,\n \"./remote_controller.js\": 4083,\n \"./resource_block/crud_component_controller.js\": 5775,\n \"./simple_form_dependent_fields_controller.js\": 8013,\n \"./simple_form_nested_fields_controller.js\": 5428,\n \"./sortable_association_input_controller.js\": 593,\n \"./sortable_controller.js\": 4734,\n \"./toggle_controller.js\": 3708,\n \"./toolbar_block/page_path_component/locale_component_controller.js\": 3248,\n \"./toolbar_block/page_path_component/permalink_component_controller.js\": 8963,\n \"./toolbar_block_component_controller.js\": 1555,\n \"./toolbar_block_controller.js\": 9303\n };\n\n function o(e) {\n var t = i(e);\n return n(t);\n }\n\n function i(e) {\n if (!n.o(r, e)) {\n var t = new Error(\"Cannot find module '\" + e + \"'\");\n throw t.code = \"MODULE_NOT_FOUND\", t;\n }\n\n return r[e];\n }\n\n o.keys = function () {\n return Object.keys(r);\n }, o.resolve = i, e.exports = o, o.id = 321;\n },\n 3370: function _(e) {\n \"use strict\";\n\n var t = /*#__PURE__*/function (_Error) {\n _inherits(t, _Error);\n\n var _super67 = _createSuper(t);\n\n function t() {\n var _this110;\n\n _classCallCheck(this, t);\n\n _this110 = _super67.call(this, \"Authorization required\"), _this110.name = \"AuthError\", _this110.isAuthError = !0;\n return _this110;\n }\n\n return t;\n }( /*#__PURE__*/_wrapNativeSuper(Error));\n\n e.exports = t;\n },\n 4125: function _(e, t, n) {\n \"use strict\";\n\n var r = n(5421);\n var o = n(5189);\n\n e.exports = /*#__PURE__*/function (_o15) {\n _inherits(_class10, _o15);\n\n var _super68 = _createSuper(_class10);\n\n function _class10(e, t) {\n var _this111;\n\n _classCallCheck(this, _class10);\n\n _this111 = _super68.call(this, e, t), _this111.provider = t.provider, _this111.id = _this111.provider, _this111.name = _this111.opts.name || _this111.id.split(\"-\").map(function (e) {\n return e.charAt(0).toUpperCase() + e.slice(1);\n }).join(\" \"), _this111.pluginId = _this111.opts.pluginId, _this111.tokenKey = \"companion-\".concat(_this111.pluginId, \"-auth-token\"), _this111.companionKeysParams = _this111.opts.companionKeysParams, _this111.preAuthToken = null;\n return _this111;\n }\n\n _createClass(_class10, [{\n key: \"headers\",\n value: function headers() {\n var _this112 = this;\n\n return Promise.all([_get(_getPrototypeOf(_class10.prototype), \"headers\", this).call(this), this.getAuthToken()]).then(function (e) {\n var _e46 = _slicedToArray(e, 2),\n t = _e46[0],\n n = _e46[1];\n\n var r = {};\n return n && (r[\"uppy-auth-token\"] = n), _this112.companionKeysParams && (r[\"uppy-credentials-params\"] = btoa(JSON.stringify({\n params: _this112.companionKeysParams\n }))), _objectSpread(_objectSpread({}, t), r);\n });\n }\n }, {\n key: \"onReceiveResponse\",\n value: function onReceiveResponse(e) {\n e = _get(_getPrototypeOf(_class10.prototype), \"onReceiveResponse\", this).call(this, e);\n var t = this.uppy.getPlugin(this.pluginId),\n n = t.getPluginState().authenticated ? 401 !== e.status : e.status < 400;\n return t.setPluginState({\n authenticated: n\n }), e;\n }\n }, {\n key: \"setAuthToken\",\n value: function setAuthToken(e) {\n return this.uppy.getPlugin(this.pluginId).storage.setItem(this.tokenKey, e);\n }\n }, {\n key: \"getAuthToken\",\n value: function getAuthToken() {\n return this.uppy.getPlugin(this.pluginId).storage.getItem(this.tokenKey);\n }\n }, {\n key: \"ensurePreAuth\",\n value: function () {\n var _ensurePreAuth = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee8() {\n return _regeneratorRuntime.wrap(function _callee8$(_context8) {\n while (1) {\n switch (_context8.prev = _context8.next) {\n case 0:\n _context8.t0 = this.companionKeysParams && !this.preAuthToken;\n\n if (!_context8.t0) {\n _context8.next = 5;\n break;\n }\n\n _context8.next = 4;\n return this.fetchPreAuthToken();\n\n case 4:\n _context8.t0 = !this.preAuthToken;\n\n case 5:\n if (!_context8.t0) {\n _context8.next = 7;\n break;\n }\n\n throw new Error(\"Could not load authentication data required for third-party login. Please try again later.\");\n\n case 7:\n case \"end\":\n return _context8.stop();\n }\n }\n }, _callee8, this);\n }));\n\n function ensurePreAuth() {\n return _ensurePreAuth.apply(this, arguments);\n }\n\n return ensurePreAuth;\n }()\n }, {\n key: \"authUrl\",\n value: function authUrl(e) {\n void 0 === e && (e = {});\n var t = new URLSearchParams(e);\n return this.preAuthToken && t.set(\"uppyPreAuthToken\", this.preAuthToken), \"\".concat(this.hostname, \"/\").concat(this.id, \"/connect?\").concat(t);\n }\n }, {\n key: \"fileUrl\",\n value: function fileUrl(e) {\n return \"\".concat(this.hostname, \"/\").concat(this.id, \"/get/\").concat(e);\n }\n }, {\n key: \"fetchPreAuthToken\",\n value: function () {\n var _fetchPreAuthToken = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee9() {\n var _e47;\n\n return _regeneratorRuntime.wrap(function _callee9$(_context9) {\n while (1) {\n switch (_context9.prev = _context9.next) {\n case 0:\n if (!this.companionKeysParams) {\n _context9.next = 11;\n break;\n }\n\n _context9.prev = 1;\n _context9.next = 4;\n return this.post(\"\".concat(this.id, \"/preauth/\"), {\n params: this.companionKeysParams\n });\n\n case 4:\n _e47 = _context9.sent;\n this.preAuthToken = _e47.token;\n _context9.next = 11;\n break;\n\n case 8:\n _context9.prev = 8;\n _context9.t0 = _context9[\"catch\"](1);\n this.uppy.log(\"[CompanionClient] unable to fetch preAuthToken \".concat(_context9.t0), \"warning\");\n\n case 11:\n case \"end\":\n return _context9.stop();\n }\n }\n }, _callee9, this, [[1, 8]]);\n }));\n\n function fetchPreAuthToken() {\n return _fetchPreAuthToken.apply(this, arguments);\n }\n\n return fetchPreAuthToken;\n }()\n }, {\n key: \"list\",\n value: function list(e) {\n return this.get(\"\".concat(this.id, \"/list/\").concat(e || \"\"));\n }\n }, {\n key: \"logout\",\n value: function logout() {\n var _this113 = this;\n\n return this.get(\"\".concat(this.id, \"/logout\")).then(function (e) {\n return Promise.all([e, _this113.uppy.getPlugin(_this113.pluginId).storage.removeItem(_this113.tokenKey)]);\n }).then(function (e) {\n var _e48 = _slicedToArray(e, 1),\n t = _e48[0];\n\n return t;\n });\n }\n }], [{\n key: \"initPlugin\",\n value: function initPlugin(e, t, n) {\n if (e.type = \"acquirer\", e.files = [], n && (e.opts = _objectSpread(_objectSpread({}, n), t)), t.serverUrl || t.serverPattern) throw new Error(\"`serverUrl` and `serverPattern` have been renamed to `companionUrl` and `companionAllowedHosts` respectively in the 0.30.5 release. Please consult the docs (for example, https://uppy.io/docs/instagram/ for the Instagram plugin) and use the updated options.`\");\n\n if (t.companionAllowedHosts) {\n var _n25 = t.companionAllowedHosts;\n if (!(\"string\" == typeof _n25 || Array.isArray(_n25) || _n25 instanceof RegExp)) throw new TypeError(\"\".concat(e.id, \": the option \\\"companionAllowedHosts\\\" must be one of string, Array, RegExp\"));\n e.opts.companionAllowedHosts = _n25;\n } else /^(?!https?:\\/\\/).*$/i.test(t.companionUrl) ? e.opts.companionAllowedHosts = \"https://\".concat(t.companionUrl.replace(/^\\/\\//, \"\")) : e.opts.companionAllowedHosts = new URL(t.companionUrl).origin;\n\n e.storage = e.opts.storage || r;\n }\n }]);\n\n return _class10;\n }(o);\n },\n 5189: function _(e, t, n) {\n \"use strict\";\n\n var r;\n\n function o(e, t) {\n if (!Object.prototype.hasOwnProperty.call(e, t)) throw new TypeError(\"attempted to use private field on non-instance\");\n return e;\n }\n\n var i = 0;\n\n function s(e) {\n return \"__private_\" + i++ + \"_\" + e;\n }\n\n var a = n(104),\n l = n(8391),\n c = n(3370);\n\n function u(_x7) {\n return _u.apply(this, arguments);\n }\n\n function _u() {\n _u = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee10(e) {\n var t, _n26, _e50;\n\n return _regeneratorRuntime.wrap(function _callee10$(_context10) {\n while (1) {\n switch (_context10.prev = _context10.next) {\n case 0:\n if (!(401 === e.status)) {\n _context10.next = 2;\n break;\n }\n\n throw new c();\n\n case 2:\n t = e.json();\n\n if (!(e.status < 200 || e.status > 300)) {\n _context10.next = 13;\n break;\n }\n\n _n26 = \"Failed request with status: \".concat(e.status, \". \").concat(e.statusText);\n _context10.prev = 5;\n _context10.next = 8;\n return t;\n\n case 8:\n _e50 = _context10.sent;\n _n26 = _e50.message ? \"\".concat(_n26, \" message: \").concat(_e50.message) : _n26, _n26 = _e50.requestId ? \"\".concat(_n26, \" request-Id: \").concat(_e50.requestId) : _n26;\n\n case 10:\n _context10.prev = 10;\n throw new Error(_n26);\n\n case 13:\n return _context10.abrupt(\"return\", t);\n\n case 14:\n case \"end\":\n return _context10.stop();\n }\n }\n }, _callee10, null, [[5,, 10, 13]]);\n }));\n return _u.apply(this, arguments);\n }\n\n var d = s(\"companionHeaders\"),\n h = s(\"getPostResponseFunc\"),\n f = s(\"getUrl\"),\n p = s(\"errorHandler\");\n r = Symbol.for(\"uppy test: getCompanionHeaders\");\n\n var g = /*#__PURE__*/function (_r27) {\n function g(e, t) {\n var _this114 = this;\n\n _classCallCheck(this, g);\n\n Object.defineProperty(this, p, {\n value: v\n }), Object.defineProperty(this, f, {\n value: m\n }), Object.defineProperty(this, d, {\n writable: !0,\n value: void 0\n }), Object.defineProperty(this, h, {\n writable: !0,\n value: function value(e) {\n return function (t) {\n return e ? t : _this114.onReceiveResponse(t);\n };\n }\n }), this.uppy = e, this.opts = t, this.onReceiveResponse = this.onReceiveResponse.bind(this), this.allowedHeaders = [\"accept\", \"content-type\", \"uppy-auth-token\"], this.preflightDone = !1, o(this, d)[d] = null == t ? void 0 : t.companionHeaders;\n }\n\n _createClass(g, [{\n key: \"setCompanionHeaders\",\n value: function setCompanionHeaders(e) {\n o(this, d)[d] = e;\n }\n }, {\n key: _r27,\n value: function value() {\n return o(this, d)[d];\n }\n }, {\n key: \"hostname\",\n get: function get() {\n var _this$uppy$getState = this.uppy.getState(),\n e = _this$uppy$getState.companion,\n t = this.opts.companionUrl;\n\n return (e && e[t] ? e[t] : t).replace(/\\/$/, \"\");\n }\n }, {\n key: \"headers\",\n value: function headers() {\n return Promise.resolve(_objectSpread(_objectSpread({}, g.defaultHeaders), o(this, d)[d]));\n }\n }, {\n key: \"onReceiveResponse\",\n value: function onReceiveResponse(e) {\n var t = this.uppy.getState().companion || {},\n n = this.opts.companionUrl,\n r = e.headers;\n return r.has(\"i-am\") && r.get(\"i-am\") !== t[n] && this.uppy.setState({\n companion: _objectSpread(_objectSpread({}, t), {}, _defineProperty({}, n, r.get(\"i-am\")))\n }), e;\n }\n }, {\n key: \"preflight\",\n value: function preflight(e) {\n var _this115 = this;\n\n return this.preflightDone ? Promise.resolve(this.allowedHeaders.slice()) : fetch(o(this, f)[f](e), {\n method: \"OPTIONS\"\n }).then(function (e) {\n return e.headers.has(\"access-control-allow-headers\") && (_this115.allowedHeaders = e.headers.get(\"access-control-allow-headers\").split(\",\").map(function (e) {\n return e.trim().toLowerCase();\n })), _this115.preflightDone = !0, _this115.allowedHeaders.slice();\n }).catch(function (e) {\n return _this115.uppy.log(\"[CompanionClient] unable to make preflight request \".concat(e), \"warning\"), _this115.preflightDone = !0, _this115.allowedHeaders.slice();\n });\n }\n }, {\n key: \"preflightAndHeaders\",\n value: function preflightAndHeaders(e) {\n var _this116 = this;\n\n return Promise.all([this.preflight(e), this.headers()]).then(function (e) {\n var _e49 = _slicedToArray(e, 2),\n t = _e49[0],\n n = _e49[1];\n\n return Object.keys(n).forEach(function (e) {\n t.includes(e.toLowerCase()) || (_this116.uppy.log(\"[CompanionClient] excluding disallowed header \".concat(e)), delete n[e]);\n }), n;\n });\n }\n }, {\n key: \"get\",\n value: function get(e, t) {\n var _this117 = this;\n\n return this.preflightAndHeaders(e).then(function (t) {\n return a(o(_this117, f)[f](e), {\n method: \"get\",\n headers: t,\n credentials: _this117.opts.companionCookiesRule || \"same-origin\"\n });\n }).then(o(this, h)[h](t)).then(u).catch(o(this, p)[p](\"get\", e));\n }\n }, {\n key: \"post\",\n value: function post(e, t, n) {\n var _this118 = this;\n\n var r = \"post\";\n return this.preflightAndHeaders(e).then(function (n) {\n return a(o(_this118, f)[f](e), {\n method: r,\n headers: n,\n credentials: _this118.opts.companionCookiesRule || \"same-origin\",\n body: JSON.stringify(t)\n });\n }).then(o(this, h)[h](n)).then(u).catch(o(this, p)[p](r, e));\n }\n }, {\n key: \"delete\",\n value: function _delete(e, t, n) {\n var _this119 = this;\n\n var r = \"delete\";\n return this.preflightAndHeaders(e).then(function (n) {\n return a(\"\".concat(_this119.hostname, \"/\").concat(e), {\n method: r,\n headers: n,\n credentials: _this119.opts.companionCookiesRule || \"same-origin\",\n body: t ? JSON.stringify(t) : null\n });\n }).then(o(this, h)[h](n)).then(u).catch(o(this, p)[p](r, e));\n }\n }]);\n\n return g;\n }(r);\n\n function m(e) {\n return /^(https?:|)\\/\\//.test(e) ? e : \"\".concat(this.hostname, \"/\").concat(e);\n }\n\n function v(e, t) {\n var _this120 = this;\n\n return function (n) {\n var r;\n return null != (r = n) && r.isAuthError || (n = new l(\"Could not \".concat(e, \" \").concat(o(_this120, f)[f](t)), {\n cause: n\n })), Promise.reject(n);\n };\n }\n\n g.VERSION = \"2.2.1\", g.defaultHeaders = {\n Accept: \"application/json\",\n \"Content-Type\": \"application/json\",\n \"Uppy-Versions\": \"@uppy/companion-client=\".concat(g.VERSION)\n }, e.exports = g;\n },\n 1863: function _(e, t, n) {\n \"use strict\";\n\n var r = n(5189);\n\n e.exports = /*#__PURE__*/function (_r28) {\n _inherits(_class11, _r28);\n\n var _super69 = _createSuper(_class11);\n\n function _class11(e, t) {\n var _this121;\n\n _classCallCheck(this, _class11);\n\n _this121 = _super69.call(this, e, t), _this121.provider = t.provider, _this121.id = _this121.provider, _this121.name = _this121.opts.name || _this121.id.split(\"-\").map(function (e) {\n return e.charAt(0).toUpperCase() + e.slice(1);\n }).join(\" \"), _this121.pluginId = _this121.opts.pluginId;\n return _this121;\n }\n\n _createClass(_class11, [{\n key: \"fileUrl\",\n value: function fileUrl(e) {\n return \"\".concat(this.hostname, \"/search/\").concat(this.id, \"/get/\").concat(e);\n }\n }, {\n key: \"search\",\n value: function search(e, t) {\n return this.get(\"search/\".concat(this.id, \"/list?q=\").concat(encodeURIComponent(e)).concat(t ? \"&\".concat(t) : \"\"));\n }\n }]);\n\n return _class11;\n }(r);\n },\n 773: function _(e, t, n) {\n \"use strict\";\n\n var r, o;\n\n function i(e, t) {\n if (!Object.prototype.hasOwnProperty.call(e, t)) throw new TypeError(\"attempted to use private field on non-instance\");\n return e;\n }\n\n var s = 0;\n\n function a(e) {\n return \"__private_\" + s++ + \"_\" + e;\n }\n\n var l = n(4800);\n var c = a(\"queued\"),\n u = a(\"emitter\"),\n d = a(\"isOpen\"),\n h = a(\"socket\"),\n f = a(\"handleMessage\");\n r = Symbol.for(\"uppy test: getSocket\"), o = Symbol.for(\"uppy test: getQueued\"), e.exports = /*#__PURE__*/function (_r29, _o16) {\n function _class12(e) {\n var _this122 = this;\n\n _classCallCheck(this, _class12);\n\n Object.defineProperty(this, c, {\n writable: !0,\n value: []\n }), Object.defineProperty(this, u, {\n writable: !0,\n value: l()\n }), Object.defineProperty(this, d, {\n writable: !0,\n value: !1\n }), Object.defineProperty(this, h, {\n writable: !0,\n value: void 0\n }), Object.defineProperty(this, f, {\n writable: !0,\n value: function value(e) {\n try {\n var _t34 = JSON.parse(e.data);\n\n _this122.emit(_t34.action, _t34.payload);\n } catch (e) {\n console.log(e);\n }\n }\n }), this.opts = e, e && !1 === e.autoOpen || this.open();\n }\n\n _createClass(_class12, [{\n key: \"isOpen\",\n get: function get() {\n return i(this, d)[d];\n }\n }, {\n key: _r29,\n value: function value() {\n return i(this, h)[h];\n }\n }, {\n key: _o16,\n value: function value() {\n return i(this, c)[c];\n }\n }, {\n key: \"open\",\n value: function open() {\n var _this123 = this;\n\n i(this, h)[h] = new WebSocket(this.opts.target), i(this, h)[h].onopen = function () {\n for (i(_this123, d)[d] = !0; i(_this123, c)[c].length > 0 && i(_this123, d)[d];) {\n var _e51 = i(_this123, c)[c].shift();\n\n _this123.send(_e51.action, _e51.payload);\n }\n }, i(this, h)[h].onclose = function () {\n i(_this123, d)[d] = !1;\n }, i(this, h)[h].onmessage = i(this, f)[f];\n }\n }, {\n key: \"close\",\n value: function close() {\n var e;\n null == (e = i(this, h)[h]) || e.close();\n }\n }, {\n key: \"send\",\n value: function send(e, t) {\n i(this, d)[d] ? i(this, h)[h].send(JSON.stringify({\n action: e,\n payload: t\n })) : i(this, c)[c].push({\n action: e,\n payload: t\n });\n }\n }, {\n key: \"on\",\n value: function on(e, t) {\n i(this, u)[u].on(e, t);\n }\n }, {\n key: \"emit\",\n value: function emit(e, t) {\n i(this, u)[u].emit(e, t);\n }\n }, {\n key: \"once\",\n value: function once(e, t) {\n i(this, u)[u].once(e, t);\n }\n }]);\n\n return _class12;\n }(r, o);\n },\n 3145: function _(e, t, n) {\n \"use strict\";\n\n Object.defineProperty(t, \"__esModule\", {\n value: !0\n }), t.Socket = t.SearchProvider = t.RequestClient = t.Provider = void 0;\n var r = n(5189);\n t.RequestClient = r;\n var o = n(4125);\n t.Provider = o;\n var i = n(1863);\n t.SearchProvider = i;\n var s = n(773);\n t.Socket = s;\n },\n 5421: function _(e, t) {\n \"use strict\";\n\n Object.defineProperty(t, \"__esModule\", {\n value: !0\n }), t.getItem = function (e) {\n return Promise.resolve(localStorage.getItem(e));\n }, t.removeItem = function (e) {\n return new Promise(function (t) {\n localStorage.removeItem(e), t();\n });\n }, t.setItem = function (e, t) {\n return new Promise(function (n) {\n localStorage.setItem(e, t), n();\n });\n };\n },\n 3521: function _(e, t, n) {\n \"use strict\";\n\n var r = n(3149);\n\n e.exports = /*#__PURE__*/function () {\n function _class13(e, t) {\n _classCallCheck(this, _class13);\n\n void 0 === t && (t = {}), this.uppy = e, this.opts = t;\n }\n\n _createClass(_class13, [{\n key: \"getPluginState\",\n value: function getPluginState() {\n var _this$uppy$getState2 = this.uppy.getState(),\n e = _this$uppy$getState2.plugins;\n\n return e[this.id] || {};\n }\n }, {\n key: \"setPluginState\",\n value: function setPluginState(e) {\n var _this$uppy$getState3 = this.uppy.getState(),\n t = _this$uppy$getState3.plugins;\n\n this.uppy.setState({\n plugins: _objectSpread(_objectSpread({}, t), {}, _defineProperty({}, this.id, _objectSpread(_objectSpread({}, t[this.id]), e)))\n });\n }\n }, {\n key: \"setOptions\",\n value: function setOptions(e) {\n this.opts = _objectSpread(_objectSpread({}, this.opts), e), this.setPluginState(), this.i18nInit();\n }\n }, {\n key: \"i18nInit\",\n value: function i18nInit() {\n var e = new r([this.defaultLocale, this.uppy.locale, this.opts.locale]);\n this.i18n = e.translate.bind(e), this.i18nArray = e.translateArray.bind(e), this.setPluginState();\n }\n }, {\n key: \"addTarget\",\n value: function addTarget() {\n throw new Error(\"Extend the addTarget method to add your plugin to another plugin's target\");\n }\n }, {\n key: \"install\",\n value: function install() {}\n }, {\n key: \"uninstall\",\n value: function uninstall() {}\n }, {\n key: \"render\",\n value: function render() {\n throw new Error(\"Extend the render method to add your plugin to a DOM element\");\n }\n }, {\n key: \"update\",\n value: function update() {}\n }, {\n key: \"afterUpdate\",\n value: function afterUpdate() {}\n }]);\n\n return _class13;\n }();\n },\n 9001: function _(e, t, n) {\n \"use strict\";\n\n Object.defineProperty(t, \"__esModule\", {\n value: !0\n }), t.defaultOptions = t.RestrictionError = t.Restricter = void 0;\n var r = n(5158),\n o = n(4193);\n t.defaultOptions = {\n maxFileSize: null,\n minFileSize: null,\n maxTotalFileSize: null,\n maxNumberOfFiles: null,\n minNumberOfFiles: null,\n allowedFileTypes: null,\n requiredMetaFields: []\n };\n\n var i = /*#__PURE__*/function (_Error2) {\n _inherits(i, _Error2);\n\n var _super70 = _createSuper(i);\n\n function i() {\n var _this124;\n\n _classCallCheck(this, i);\n\n _this124 = _super70.apply(this, arguments), _this124.isRestriction = !0;\n return _this124;\n }\n\n return i;\n }( /*#__PURE__*/_wrapNativeSuper(Error));\n\n t.RestrictionError = i, \"undefined\" == typeof AggregateError && (globalThis.AggregateError = /*#__PURE__*/function (_Error3) {\n _inherits(_class14, _Error3);\n\n var _super71 = _createSuper(_class14);\n\n function _class14(e, t) {\n var _this125;\n\n _classCallCheck(this, _class14);\n\n _this125 = _super71.call(this, t), _this125.errors = e;\n return _this125;\n }\n\n return _class14;\n }( /*#__PURE__*/_wrapNativeSuper(Error))), t.Restricter = /*#__PURE__*/function () {\n function _class15(e, t) {\n _classCallCheck(this, _class15);\n\n this.i18n = t, this.getOpts = function () {\n var t = e();\n if (null != t.restrictions.allowedFileTypes && !Array.isArray(t.restrictions.allowedFileTypes)) throw new TypeError(\"`restrictions.allowedFileTypes` must be an array\");\n return t;\n };\n }\n\n _createClass(_class15, [{\n key: \"validate\",\n value: function validate(e, t) {\n var _this$getOpts$restric = this.getOpts().restrictions,\n n = _this$getOpts$restric.maxFileSize,\n s = _this$getOpts$restric.minFileSize,\n a = _this$getOpts$restric.maxTotalFileSize,\n l = _this$getOpts$restric.maxNumberOfFiles,\n c = _this$getOpts$restric.allowedFileTypes;\n if (l && t.length + 1 > l) throw new i(\"\".concat(this.i18n(\"youCanOnlyUploadX\", {\n smart_count: l\n })));\n\n if (c && !c.some(function (t) {\n return t.includes(\"/\") ? !!e.type && o(e.type.replace(/;.*?$/, \"\"), t) : !(\".\" !== t[0] || !e.extension) && e.extension.toLowerCase() === t.slice(1).toLowerCase();\n })) {\n var _e52 = c.join(\", \");\n\n throw new i(this.i18n(\"youCanOnlyUploadFileTypes\", {\n types: _e52\n }));\n }\n\n if (a && null != e.size && t.reduce(function (e, t) {\n return e + t.size;\n }, e.size) > a) throw new i(this.i18n(\"exceedsSize\", {\n size: r(a),\n file: e.name\n }));\n if (n && null != e.size && e.size > n) throw new i(this.i18n(\"exceedsSize\", {\n size: r(n),\n file: e.name\n }));\n if (s && null != e.size && e.size < s) throw new i(this.i18n(\"inferiorSize\", {\n size: r(s)\n }));\n }\n }, {\n key: \"validateMinNumberOfFiles\",\n value: function validateMinNumberOfFiles(e) {\n var t = this.getOpts().restrictions.minNumberOfFiles;\n if (Object.keys(e).length < t) throw new i(this.i18n(\"youHaveToAtLeastSelectX\", {\n smart_count: t\n }));\n }\n }, {\n key: \"getMissingRequiredMetaFields\",\n value: function getMissingRequiredMetaFields(e) {\n var t = new i(this.i18n(\"missingRequiredMetaFieldOnFile\", {\n fileName: e.name\n })),\n n = this.getOpts().restrictions.requiredMetaFields,\n r = Object.prototype.hasOwnProperty,\n o = [];\n\n var _iterator16 = _createForOfIteratorHelper(n),\n _step16;\n\n try {\n for (_iterator16.s(); !(_step16 = _iterator16.n()).done;) {\n var _t35 = _step16.value;\n r.call(e.meta, _t35) && \"\" !== e.meta[_t35] || o.push(_t35);\n }\n } catch (err) {\n _iterator16.e(err);\n } finally {\n _iterator16.f();\n }\n\n return {\n missingFields: o,\n error: t\n };\n }\n }]);\n\n return _class15;\n }();\n },\n 2693: function _(e, t, n) {\n \"use strict\";\n\n var r = n(6400);\n\n function o(e, t) {\n if (!Object.prototype.hasOwnProperty.call(e, t)) throw new TypeError(\"attempted to use private field on non-instance\");\n return e;\n }\n\n var i = 0;\n\n function s(e) {\n return \"__private_\" + i++ + \"_\" + e;\n }\n\n var a = n(4088),\n l = n(5589),\n c = n(3521);\n var u = s(\"updateUI\");\n\n var d = /*#__PURE__*/function (_c) {\n _inherits(d, _c);\n\n var _super72 = _createSuper(d);\n\n function d() {\n var _this126;\n\n _classCallCheck(this, d);\n\n _this126 = _super72.apply(this, arguments), Object.defineProperty(_assertThisInitialized(_this126), u, {\n writable: !0,\n value: void 0\n });\n return _this126;\n }\n\n _createClass(d, [{\n key: \"mount\",\n value: function mount(e, t) {\n var _this127 = this;\n\n var n = t.id,\n i = a(e);\n\n if (i) {\n this.isTargetDOMEl = !0;\n\n var _t36 = document.createElement(\"div\");\n\n return _t36.classList.add(\"uppy-Root\"), o(this, u)[u] = function (e) {\n var t = null,\n n = null;\n return function () {\n for (var r = arguments.length, o = new Array(r), i = 0; i < r; i++) {\n o[i] = arguments[i];\n }\n\n return n = o, t || (t = Promise.resolve().then(function () {\n return t = null, e.apply(void 0, _toConsumableArray(n));\n })), t;\n };\n }(function (e) {\n _this127.uppy.getPlugin(_this127.id) && ((0, r.render)(_this127.render(e), _t36), _this127.afterUpdate());\n }), this.uppy.log(\"Installing \".concat(n, \" to a DOM element '\").concat(e, \"'\")), this.opts.replaceTargetContent && (i.innerHTML = \"\"), (0, r.render)(this.render(this.uppy.getState()), _t36), this.el = _t36, i.appendChild(_t36), _t36.dir = this.opts.direction || l(_t36) || \"ltr\", this.onMount(), this.el;\n }\n\n var s;\n if (\"object\" == _typeof(e) && e instanceof d) s = e;else if (\"function\" == typeof e) {\n var _t37 = e;\n this.uppy.iteratePlugins(function (e) {\n e instanceof _t37 && (s = e);\n });\n }\n if (s) return this.uppy.log(\"Installing \".concat(n, \" to \").concat(s.id)), this.parent = s, this.el = s.addTarget(t), this.onMount(), this.el;\n this.uppy.log(\"Not installing \".concat(n));\n var c = \"Invalid target option given to \".concat(n, \".\");\n throw c += \"function\" == typeof e ? \" The given target is not a Plugin class. Please check that you're not specifying a React Component instead of a plugin. If you are using @uppy/* packages directly, make sure you have only 1 version of @uppy/core installed: run `npm ls @uppy/core` on the command line and verify that all the versions match and are deduped correctly.\" : \"If you meant to target an HTML element, please make sure that the element exists. Check that the