PluginProbe
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses / 4.4.9.1
LearnPress – WordPress LMS Plugin for Create and Sell Online Courses v4.4.9.1
4.4.9.1 4.4.9 4.4.8 4.4.7 4.4.6 4.4.5 4.4.4 4.4.3 4.4.2 4.4.1 4.4.0 4.3.9.1 4.3.9 4.3.8 4.3.7 4.1.6.9 4.1.6.9.1 4.1.6.9.2 4.1.6.9.3 4.1.6.9.4 4.1.7 4.1.7.1 4.1.7.2 4.1.7.3 4.1.7.3.1 All 141 releases
← All changes | assets/js/dist/admin/admin.js +215 -102 4.4.9 → 4.4.9.1 View file →
@@ -3621,8 +3621,9 @@
3621 3621 diacritics: true,
3622 3622 create: null,
3623 3623 createOnBlur: false,
3624 3624 createFilter: null,
3625 + clearAfterSelect: false,
3625 3626 highlight: true,
3626 3627 openOnFocus: true,
3627 3628 shouldOpen: null,
3628 3629 maxOptions: 50,
@@ -3820,11 +3821,12 @@
3820 3821 * Initialize from a <input type="text"> element.
3821 3822 *
3822 3823 */
3823 3824 var init_textbox = () => {
3825 + var _a, _b;
3824 3826 const data_raw = input.getAttribute(attr_data);
3825 3827 if (!data_raw) {
3826 - var value = input.value.trim() || '';
3828 + var value = (_b = (_a = input === null || input === void 0 ? void 0 : input.value) === null || _a === void 0 ? void 0 : _a.trim()) !== null && _b !== void 0 ? _b : '';
3827 3829 if (!settings.allowEmptyOption && !value.length)
3828 3830 return;
3829 3831 const values = value.split(settings.delimiter);
3830 3832 (0,_utils_js__WEBPACK_IMPORTED_MODULE_1__.iterate)(values, (value) => {
@@ -3866,9 +3868,9 @@
3866 3868 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
3867 3869 /* harmony export */ "default": () => (/* binding */ plugin)
3868 3870 /* harmony export */ });
3869 3871 /**
3870 -* Tom Select v2.4.3
3872 +* Tom Select v2.6.2
3871 3873 * Licensed under the Apache License, Version 2.0 (the "License");
3872 3874 */
3873 3875
3874 3876 /**
@@ -4044,9 +4046,9 @@
4044 4046 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
4045 4047 /* harmony export */ "default": () => (/* binding */ plugin)
4046 4048 /* harmony export */ });
4047 4049 /**
4048 -* Tom Select v2.4.3
4050 +* Tom Select v2.6.2
4049 4051 * Licensed under the Apache License, Version 2.0 (the "License");
4050 4052 */
4051 4053
4052 4054 /**
@@ -4110,9 +4112,9 @@
4110 4112 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
4111 4113 /* harmony export */ "default": () => (/* binding */ plugin)
4112 4114 /* harmony export */ });
4113 4115 /**
4114 -* Tom Select v2.4.3
4116 +* Tom Select v2.6.2
4115 4117 * Licensed under the Apache License, Version 2.0 (the "License");
4116 4118 */
4117 4119
4118 4120 /**
@@ -4304,9 +4306,9 @@
4304 4306 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
4305 4307 /* harmony export */ "default": () => (/* binding */ plugin)
4306 4308 /* harmony export */ });
4307 4309 /**
4308 -* Tom Select v2.4.3
4310 +* Tom Select v2.6.2
4309 4311 * Licensed under the Apache License, Version 2.0 (the "License");
4310 4312 */
4311 4313
4312 4314 /**
@@ -4355,10 +4357,12 @@
4355 4357 const self = this;
4356 4358 const options = Object.assign({
4357 4359 className: 'clear-button',
4358 4360 title: 'Clear All',
4361 + role: 'button',
4362 + tabindex: 0,
4359 4363 html: data => {
4360 - return `<div class="${data.className}" title="${data.title}">&#10799;</div>`;
4364 + return `<div class="${data.className}" title="${data.title}" role="${data.role}" tabindex="${data.tabindex}">&times;</div>`;
4361 4365 }
4362 4366 }, userOptions);
4363 4367 self.on('initialize', () => {
4364 4368 var button = getDom(options.html(options));
@@ -4367,8 +4371,9 @@
4367 4371 self.clear();
4368 4372 if (self.settings.mode === 'single' && self.settings.allowEmptyOption) {
4369 4373 self.addItem('');
4370 4374 }
4375 + self.refreshOptions(false);
4371 4376 evt.preventDefault();
4372 4377 evt.stopPropagation();
4373 4378 });
4374 4379 self.control.appendChild(button);
@@ -4392,9 +4397,9 @@
4392 4397 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
4393 4398 /* harmony export */ "default": () => (/* binding */ plugin)
4394 4399 /* harmony export */ });
4395 4400 /**
4396 -* Tom Select v2.4.3
4401 +* Tom Select v2.6.2
4397 4402 * Licensed under the Apache License, Version 2.0 (the "License");
4398 4403 */
4399 4404
4400 4405 /**
@@ -4627,9 +4632,9 @@
4627 4632 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
4628 4633 /* harmony export */ "default": () => (/* binding */ plugin)
4629 4634 /* harmony export */ });
4630 4635 /**
4631 -* Tom Select v2.4.3
4636 +* Tom Select v2.6.2
4632 4637 * Licensed under the Apache License, Version 2.0 (the "License");
4633 4638 */
4634 4639
4635 4640 /**
@@ -4744,9 +4749,9 @@
4744 4749 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
4745 4750 /* harmony export */ "default": () => (/* binding */ plugin)
4746 4751 /* harmony export */ });
4747 4752 /**
4748 -* Tom Select v2.4.3
4753 +* Tom Select v2.6.2
4749 4754 * Licensed under the Apache License, Version 2.0 (the "License");
4750 4755 */
4751 4756
4752 4757 const KEY_ESC = 27;
@@ -4899,8 +4904,9 @@
4899 4904 const self = this;
4900 4905 self.settings.shouldOpen = true; // make sure the input is shown even if there are no options to display in the dropdown
4901 4906
4902 4907 self.hook('before', 'setup', () => {
4908 + var _self$input;
4903 4909 self.focus_node = self.control;
4904 4910 addClasses(self.control_input, 'dropdown-input');
4905 4911 const div = getDom('<div class="dropdown-input-wrap">');
4906 4912 div.append(self.control_input);
@@ -4909,8 +4915,17 @@
4909 4915 // set a placeholder in the select control
4910 4916 const placeholder = getDom('<input class="items-placeholder" tabindex="-1" />');
4911 4917 placeholder.placeholder = self.settings.placeholder || '';
4912 4918 self.control.append(placeholder);
4919 + /**
4920 + * TomSelect renders a custom control with a focusable <input class="items-placeholder">.
4921 + * The source <select>'s aria-label is not automatically propagated to that input,
4922 + * which triggers "Missing form label" accessibility warnings.
4923 + * This helper copies the label from the <select> onto the generated input.
4924 + */
4925 + const label = (_self$input = self.input) == null ? void 0 : _self$input.getAttribute('aria-label');
4926 + if (!label) return;
4927 + placeholder.setAttribute('aria-label', label);
4913 4928 });
4914 4929 self.on('initialize', () => {
4915 4930 // set tabIndex on control to -1, otherwise [shift+tab] will put focus right back on control_input
4916 4931 self.control_input.addEventListener('keydown', evt => {
@@ -4973,9 +4988,9 @@
4973 4988 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
4974 4989 /* harmony export */ "default": () => (/* binding */ plugin)
4975 4990 /* harmony export */ });
4976 4991 /**
4977 -* Tom Select v2.4.3
4992 +* Tom Select v2.6.2
4978 4993 * Licensed under the Apache License, Version 2.0 (the "License");
4979 4994 */
4980 4995
4981 4996 /**
@@ -5062,9 +5077,9 @@
5062 5077 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
5063 5078 /* harmony export */ "default": () => (/* binding */ plugin)
5064 5079 /* harmony export */ });
5065 5080 /**
5066 -* Tom Select v2.4.3
5081 +* Tom Select v2.6.2
5067 5082 * Licensed under the Apache License, Version 2.0 (the "License");
5068 5083 */
5069 5084
5070 5085 /**
@@ -5103,9 +5118,9 @@
5103 5118 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
5104 5119 /* harmony export */ "default": () => (/* binding */ plugin)
5105 5120 /* harmony export */ });
5106 5121 /**
5107 -* Tom Select v2.4.3
5122 +* Tom Select v2.6.2
5108 5123 * Licensed under the Apache License, Version 2.0 (the "License");
5109 5124 */
5110 5125
5111 5126 /**
@@ -5150,9 +5165,9 @@
5150 5165 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
5151 5166 /* harmony export */ "default": () => (/* binding */ plugin)
5152 5167 /* harmony export */ });
5153 5168 /**
5154 -* Tom Select v2.4.3
5169 +* Tom Select v2.6.2
5155 5170 * Licensed under the Apache License, Version 2.0 (the "License");
5156 5171 */
5157 5172
5158 5173 const KEY_LEFT = 37;
@@ -5251,9 +5266,9 @@
5251 5266 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
5252 5267 /* harmony export */ "default": () => (/* binding */ plugin)
5253 5268 /* harmony export */ });
5254 5269 /**
5255 -* Tom Select v2.4.3
5270 +* Tom Select v2.6.2
5256 5271 * Licensed under the Apache License, Version 2.0 (the "License");
5257 5272 */
5258 5273
5259 5274 /**
@@ -5271,16 +5286,8 @@
5271 5286 *
5272 5287 */
5273 5288
5274 5289 /**
5275 - * Escapes a string for use within HTML.
5276 - *
5277 - */
5278 -const escape_html = str => {
5279 - return (str + '').replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;').replace(/"/g, '&quot;');
5280 -};
5281 -
5282 -/**
5283 5290 * Prevent default
5284 5291 *
5285 5292 */
5286 5293 const preventDefault = (evt, stop = false) => {
@@ -5342,28 +5349,31 @@
5342 5349 *
5343 5350 */
5344 5351
5345 5352 function plugin (userOptions) {
5353 + const self = this;
5346 5354 const options = Object.assign({
5347 - label: '&times;',
5355 + label: '×',
5348 5356 title: 'Remove',
5349 5357 className: 'remove',
5350 - append: true
5358 + tabindex: -1,
5359 + role: 'button',
5360 + html: data => {
5361 + var _data$tabindex;
5362 + const el = document.createElement('div');
5363 + el.className = data.className || '';
5364 + el.title = data.title || '';
5365 + el.setAttribute('role', data.role || 'button');
5366 + el.tabIndex = (_data$tabindex = data.tabindex) != null ? _data$tabindex : -1;
5367 + el.textContent = data.label || '';
5368 + return el;
5369 + }
5351 5370 }, userOptions);
5352 -
5353 - //options.className = 'remove-single';
5354 - var self = this;
5355 -
5356 - // override the render method to add remove button to each item
5357 - if (!options.append) {
5358 - return;
5359 - }
5360 - var html = '<a href="javascript:void(0)" class="' + options.className + '" tabindex="-1" title="' + escape_html(options.title) + '">' + options.label + '</a>';
5361 5371 self.hook('after', 'setupTemplates', () => {
5362 5372 var orig_render_item = self.settings.render.item;
5363 5373 self.settings.render.item = (data, escape) => {
5364 5374 var item = getDom(orig_render_item.call(self, data, escape));
5365 - var close_button = getDom(html);
5375 + var close_button = getDom(options.html(options));
5366 5376 item.appendChild(close_button);
5367 5377 addEvent(close_button, 'mousedown', evt => {
5368 5378 preventDefault(evt, true);
5369 5379 });
@@ -5400,9 +5410,9 @@
5400 5410 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
5401 5411 /* harmony export */ "default": () => (/* binding */ plugin)
5402 5412 /* harmony export */ });
5403 5413 /**
5404 -* Tom Select v2.4.3
5414 +* Tom Select v2.6.2
5405 5415 * Licensed under the Apache License, Version 2.0 (the "License");
5406 5416 */
5407 5417
5408 5418 /**
@@ -5457,9 +5467,9 @@
5457 5467 /* harmony export */ __webpack_require__.d(__webpack_exports__, {
5458 5468 /* harmony export */ "default": () => (/* binding */ plugin)
5459 5469 /* harmony export */ });
5460 5470 /**
5461 -* Tom Select v2.4.3
5471 +* Tom Select v2.6.2
5462 5472 * Licensed under the Apache License, Version 2.0 (the "License");
5463 5473 */
5464 5474
5465 5475 /**
@@ -5541,9 +5551,9 @@
5541 5551 return arg;
5542 5552 };
5543 5553
5544 5554 /**
5545 - * Plugin: "restore_on_backspace" (Tom Select)
5555 + * Plugin: "virtual_scroll" (Tom Select)
5546 5556 * Copyright (c) contributors
5547 5557 *
5548 5558 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
5549 5559 * file except in compliance with the License. You may obtain a copy of the License at:
@@ -5565,8 +5575,12 @@
5565 5575 var dropdown_content;
5566 5576 var loading_more = false;
5567 5577 var load_more_opt;
5568 5578 var default_values = [];
5579 + var default_values_loaded = false;
5580 + var default_pagination;
5581 + var default_options = [];
5582 + var html_values = [];
5569 5583 if (!self.settings.shouldLoadMore) {
5570 5584 // return true if additional results should be loaded
5571 5585 self.settings.shouldLoadMore = () => {
5572 5586 const scroll_percent = dropdown_content.clientHeight / (dropdown_content.scrollHeight - dropdown_content.scrollTop);
@@ -5596,9 +5610,9 @@
5596 5610 }];
5597 5611
5598 5612 // can we load more results for given query?
5599 5613 const canLoadMore = query => {
5600 - if (typeof self.settings.maxOptions === 'number' && dropdown_content.children.length >= self.settings.maxOptions) {
5614 + if (self.settings.maxOptions !== null && typeof self.settings.maxOptions === 'number' && dropdown_content.children.length >= self.settings.maxOptions) {
5601 5615 return false;
5602 5616 }
5603 5617 if (query in pagination && pagination[query]) {
5604 5618 return true;
@@ -5656,9 +5670,13 @@
5656 5670
5657 5671 // wrap the load
5658 5672 self.hook('instead', 'loadCallback', (options, optgroups) => {
5659 5673 if (!loading_more) {
5660 - self.clearOptions(clearFilter);
5674 + // When searching (non-empty query), keep selected items and HTML default options,
5675 + // but remove preloaded remote options so they don't bleed into search results.
5676 + // For empty query, use clearFilter (keeps default_values + items).
5677 + const activeFilter = self.lastValue !== '' ? (_option, value) => self.items.indexOf(value) >= 0 || html_values.indexOf(value) >= 0 : clearFilter;
5678 + self.clearOptions(activeFilter);
5661 5679 } else if (load_more_opt) {
5662 5680 const first_option = options[0];
5663 5681 if (first_option !== undefined) {
5664 5682 load_more_opt.dataset.value = first_option[self.settings.valueField];
@@ -5664,11 +5682,31 @@
5664 5682 load_more_opt.dataset.value = first_option[self.settings.valueField];
5665 5683 }
5666 5684 }
5667 5685 orig_loadCallback.call(self, options, optgroups);
5686 +
5687 + // After the initial preload (empty query), snapshot default_values and option objects
5688 + // so they can be restored when the user clears their search.
5689 + if (!loading_more && !default_values_loaded) {
5690 + default_values_loaded = true;
5691 + if (self.lastValue === '') {
5692 + default_values = Object.keys(self.options);
5693 + default_pagination = pagination[''];
5694 + default_options = Object.values(self.options);
5695 + }
5696 + }
5668 5697 loading_more = false;
5669 5698 });
5670 5699
5700 + // as the “loading_more” element will be removed from the dropdown,
5701 + // we activate the previous option if needed
5702 + // to avoid the dropdown being scrolled back to the first one
5703 + self.hook('before', 'refreshOptions', () => {
5704 + if (self.activeOption && "option" !== self.activeOption.getAttribute("role")) {
5705 + self.setActiveOption(self.activeOption.previousElementSibling);
5706 + }
5707 + });
5708 +
5671 5709 // add templates to dropdown
5672 5710 // loading_more if we have another url in the queue
5673 5711 // no_more_results if we don't have another url in the queue
5674 5712 self.hook('after', 'refreshOptions', () => {
@@ -5692,10 +5730,32 @@
5692 5730 dropdown_content.append(option);
5693 5731 }
5694 5732 });
5695 5733
5734 + // Restore preloaded options and pagination when clearing search
5735 + const restoreDefaults = () => {
5736 + if (!default_values_loaded) {
5737 + return;
5738 + }
5739 + // Re-add preloaded option objects (clearOptions can only remove, not restore)
5740 + self.addOptions(default_options);
5741 + // Remove any search results that are not part of the preloaded defaults
5742 + self.clearOptions(clearFilter);
5743 + if (default_pagination) {
5744 + pagination[''] = default_pagination;
5745 + }
5746 + };
5747 + self.on('type', query => {
5748 + if (query === '') {
5749 + restoreDefaults();
5750 + self.refreshOptions(false);
5751 + }
5752 + });
5753 + self.on('dropdown_close', restoreDefaults);
5754 +
5696 5755 // add scroll listener and default templates
5697 5756 self.on('initialize', () => {
5757 + html_values = Object.keys(self.options);
5698 5758 default_values = Object.keys(self.options);
5699 5759 dropdown_content = self.dropdown_content;
5700 5760
5701 5761 // default templates
@@ -5835,8 +5895,9 @@
5835 5895 this.isLocked = false;
5836 5896 this.isFocused = false;
5837 5897 this.isInputHidden = false;
5838 5898 this.isSetup = false;
5899 + this.isDropdownContentStale = true;
5839 5900 this.ignoreFocus = false;
5840 5901 this.ignoreHover = false;
5841 5902 this.hasOptions = false;
5842 5903 this.lastValue = '';
@@ -5911,9 +5972,9 @@
5911 5972 (0,_vanilla_js__WEBPACK_IMPORTED_MODULE_8__.addClasses)(dropdown, settings.dropdownClass, inputMode);
5912 5973 if (settings.copyClassesToDropdown) {
5913 5974 (0,_vanilla_js__WEBPACK_IMPORTED_MODULE_8__.addClasses)(dropdown, classes);
5914 5975 }
5915 - (0,_vanilla_js__WEBPACK_IMPORTED_MODULE_8__.addClasses)(dropdown_content, settings.dropdownContentClass);
5976 + ;(0,_vanilla_js__WEBPACK_IMPORTED_MODULE_8__.addClasses)(dropdown_content, settings.dropdownContentClass);
5916 5977 (0,_utils_js__WEBPACK_IMPORTED_MODULE_7__.append)(dropdown, dropdown_content);
5917 5978 (0,_vanilla_js__WEBPACK_IMPORTED_MODULE_8__.getDom)(settings.dropdownParent || wrapper).appendChild(dropdown);
5918 5979 // default controlInput
5919 5980 if ((0,_vanilla_js__WEBPACK_IMPORTED_MODULE_8__.isHtmlString)(settings.controlInput)) {
@@ -5918,9 +5979,9 @@
5918 5979 // default controlInput
5919 5980 if ((0,_vanilla_js__WEBPACK_IMPORTED_MODULE_8__.isHtmlString)(settings.controlInput)) {
5920 5981 control_input = (0,_vanilla_js__WEBPACK_IMPORTED_MODULE_8__.getDom)(settings.controlInput);
5921 5982 // set attributes
5922 - var attrs = ['autocorrect', 'autocapitalize', 'autocomplete', 'spellcheck'];
5983 + var attrs = ['autocorrect', 'autocapitalize', 'autocomplete', 'spellcheck', 'aria-label'];
5923 5984 (0,_utils_js__WEBPACK_IMPORTED_MODULE_7__.iterate)(attrs, (attr) => {
5924 5985 if (input.getAttribute(attr)) {
5925 5986 (0,_vanilla_js__WEBPACK_IMPORTED_MODULE_8__.setAttr)(control_input, { [attr]: input.getAttribute(attr) });
5926 5987 }
@@ -5981,8 +6042,10 @@
5981 6042 (0,_vanilla_js__WEBPACK_IMPORTED_MODULE_8__.setAttr)(focus_node, { 'aria-labelledby': label_id });
5982 6043 (0,_vanilla_js__WEBPACK_IMPORTED_MODULE_8__.setAttr)(dropdown_content, { 'aria-labelledby': label_id });
5983 6044 }
5984 6045 wrapper.style.width = input.style.width;
6046 + wrapper.style.minWidth = input.style.minWidth;
6047 + wrapper.style.maxWidth = input.style.maxWidth;
5985 6048 if (self.plugins.names.length) {
5986 6049 const classes_plugins = 'plugin-' + self.plugins.names.join(' plugin-');
5987 6050 (0,_vanilla_js__WEBPACK_IMPORTED_MODULE_8__.addClasses)([wrapper, dropdown], classes_plugins);
5988 6051 }
@@ -6000,9 +6063,9 @@
6000 6063 // after initializePlugins() so plugins can create/modify user defined loaders
6001 6064 if (settings.load && settings.loadThrottle) {
6002 6065 settings.load = (0,_utils_js__WEBPACK_IMPORTED_MODULE_7__.loadDebounce)(settings.load, settings.loadThrottle);
6003 6066 }
6004 - (0,_utils_js__WEBPACK_IMPORTED_MODULE_7__.addEvent)(dropdown, 'mousemove', () => {
6067 + ;(0,_utils_js__WEBPACK_IMPORTED_MODULE_7__.addEvent)(dropdown, 'mousemove', () => {
6005 6068 self.ignoreHover = false;
6006 6069 });
6007 6070 (0,_utils_js__WEBPACK_IMPORTED_MODULE_7__.addEvent)(dropdown, 'mouseenter', (e) => {
6008 6071 var target_match = (0,_vanilla_js__WEBPACK_IMPORTED_MODULE_8__.parentMatch)(e.target, '[data-selectable]', dropdown);
@@ -6065,12 +6128,21 @@
6065 6128 if (self.isOpen) {
6066 6129 self.positionDropdown();
6067 6130 }
6068 6131 };
6132 + const input_invalid = () => {
6133 + if (self.isValid) {
6134 + self.isValid = false;
6135 + self.isInvalid = true;
6136 + self.refreshState();
6137 + }
6138 + };
6139 + (0,_utils_js__WEBPACK_IMPORTED_MODULE_7__.addEvent)(input, 'invalid', input_invalid);
6069 6140 (0,_utils_js__WEBPACK_IMPORTED_MODULE_7__.addEvent)(document, 'mousedown', doc_mousedown);
6070 6141 (0,_utils_js__WEBPACK_IMPORTED_MODULE_7__.addEvent)(window, 'scroll', win_scroll, passive_event);
6071 6142 (0,_utils_js__WEBPACK_IMPORTED_MODULE_7__.addEvent)(window, 'resize', win_scroll, passive_event);
6072 6143 this._destroy = () => {
6144 + input.removeEventListener('invalid', input_invalid);
6073 6145 document.removeEventListener('mousedown', doc_mousedown);
6074 6146 window.removeEventListener('scroll', win_scroll);
6075 6147 window.removeEventListener('resize', win_scroll);
6076 6148 if (label)
@@ -6087,29 +6159,12 @@
6087 6159 self.sync(false);
6088 6160 settings.items = [];
6089 6161 delete settings.optgroups;
6090 6162 delete settings.options;
6091 - (0,_utils_js__WEBPACK_IMPORTED_MODULE_7__.addEvent)(input, 'invalid', () => {
6092 - if (self.isValid) {
6093 - self.isValid = false;
6094 - self.isInvalid = true;
6095 - self.refreshState();
6096 - }
6097 - });
6098 - self.updateOriginalInput();
6099 6163 self.refreshItems();
6100 6164 self.close(false);
6101 6165 self.inputState();
6102 6166 self.isSetup = true;
6103 - if (input.disabled) {
6104 - self.disable();
6105 - }
6106 - else if (input.readOnly) {
6107 - self.setReadOnly(true);
6108 - }
6109 - else {
6110 - self.enable(); //sets tabIndex
6111 - }
6112 6167 self.on('change', this.onChange);
6113 6168 (0,_vanilla_js__WEBPACK_IMPORTED_MODULE_8__.addClasses)(input, 'tomselected', 'ts-hidden-accessible');
6114 6169 self.trigger('initialize');
6115 6170 // preload options
@@ -6205,11 +6260,20 @@
6205 6260 *
6206 6261 */
6207 6262 sync(get_settings = true) {
6208 6263 const self = this;
6209 - const settings = get_settings ? (0,_getSettings_js__WEBPACK_IMPORTED_MODULE_6__["default"])(self.input, { delimiter: self.settings.delimiter }) : self.settings;
6264 + const settings = get_settings ? (0,_getSettings_js__WEBPACK_IMPORTED_MODULE_6__["default"])(self.input, { delimiter: self.settings.delimiter, allowEmptyOption: self.settings.allowEmptyOption }) : self.settings;
6210 6265 self.setupOptions(settings.options, settings.optgroups);
6211 6266 self.setValue(settings.items || [], true); // silent prevents recursion
6267 + if (self.input.disabled) {
6268 + self.disable();
6269 + }
6270 + else if (self.input.readOnly) {
6271 + self.setReadOnly(true);
6272 + }
6273 + else {
6274 + self.enable(); //sets tabIndex
6275 + }
6212 6276 self.lastQuery = null; // so updated options will be displayed in dropdown
6213 6277 }
6214 6278 /**
6215 6279 * Triggered when the main control element
@@ -6240,9 +6304,9 @@
6240 6304 * This should propagate the event to the original DOM
6241 6305 * input / select element.
6242 6306 */
6243 6307 onChange() {
6244 - (0,_vanilla_js__WEBPACK_IMPORTED_MODULE_8__.triggerEvent)(this.input, 'input');
6308 + ;(0,_vanilla_js__WEBPACK_IMPORTED_MODULE_8__.triggerEvent)(this.input, 'input');
6245 6309 (0,_vanilla_js__WEBPACK_IMPORTED_MODULE_8__.triggerEvent)(this.input, 'change');
6246 6310 }
6247 6311 /**
6248 6312 * Triggered on <input> paste.
@@ -6337,9 +6401,9 @@
6337 6401 let next = self.getAdjacent(self.activeOption, 1);
6338 6402 if (next)
6339 6403 self.setActiveOption(next);
6340 6404 }
6341 - (0,_utils_js__WEBPACK_IMPORTED_MODULE_7__.preventDefault)(e);
6405 + ;(0,_utils_js__WEBPACK_IMPORTED_MODULE_7__.preventDefault)(e);
6342 6406 return;
6343 6407 // up: move selection up
6344 6408 case _constants_js__WEBPACK_IMPORTED_MODULE_5__.KEY_UP:
6345 6409 if (self.activeOption) {
@@ -6346,9 +6410,9 @@
6346 6410 let prev = self.getAdjacent(self.activeOption, -1);
6347 6411 if (prev)
6348 6412 self.setActiveOption(prev);
6349 6413 }
6350 - (0,_utils_js__WEBPACK_IMPORTED_MODULE_7__.preventDefault)(e);
6414 + ;(0,_utils_js__WEBPACK_IMPORTED_MODULE_7__.preventDefault)(e);
6351 6415 return;
6352 6416 // return: select active option
6353 6417 case _constants_js__WEBPACK_IMPORTED_MODULE_5__.KEY_RETURN:
6354 6418 if (self.canSelect(self.activeOption)) {
@@ -6380,9 +6444,9 @@
6380 6444 // prevent default [tab] behaviour of jump to the next field
6381 6445 // if select isFull, then the dropdown won't be open and [tab] will work normally
6382 6446 (0,_utils_js__WEBPACK_IMPORTED_MODULE_7__.preventDefault)(e);
6383 6447 }
6384 - if (self.settings.create && self.createItem()) {
6448 + else if (self.settings.create && self.createItem()) {
6385 6449 (0,_utils_js__WEBPACK_IMPORTED_MODULE_7__.preventDefault)(e);
6386 6450 }
6387 6451 }
6388 6452 return;
@@ -6504,18 +6568,24 @@
6504 6568 self.createItem(null, () => {
6505 6569 if (self.settings.closeAfterSelect) {
6506 6570 self.close();
6507 6571 }
6572 + else if (self.settings.clearAfterSelect) {
6573 + self.setTextboxValue();
6574 + }
6508 6575 });
6509 6576 }
6510 6577 else {
6511 6578 value = option.dataset.value;
6512 6579 if (typeof value !== 'undefined') {
6513 - self.lastQuery = null;
6580 + self.isDropdownContentStale = self.settings.hideSelected;
6514 6581 self.addItem(value);
6515 6582 if (self.settings.closeAfterSelect) {
6516 6583 self.close();
6517 6584 }
6585 + else if (self.settings.clearAfterSelect) {
6586 + self.setTextboxValue();
6587 + }
6518 6588 if (!self.settings.hideSelected && evt.type && /click/.test(evt.type)) {
6519 6589 self.setActiveOption(option);
6520 6590 }
6521 6591 }
@@ -6587,9 +6657,9 @@
6587 6657 */
6588 6658 loadCallback(options, optgroups) {
6589 6659 const self = this;
6590 6660 self.loading = Math.max(self.loading - 1, 0);
6591 - self.lastQuery = null;
6661 + self.isDropdownContentStale = true;
6592 6662 self.clearActiveOption(); // when new results load, focus should be on first option
6593 6663 self.setupOptions(options, optgroups);
6594 6664 self.refreshOptions(self.isFocused && !self.isInputHidden);
6595 6665 if (!self.loading) {
@@ -6686,9 +6756,9 @@
6686 6756 if (self.activeItems.indexOf(item) === -1) {
6687 6757 self.setActiveItemClass(item);
6688 6758 }
6689 6759 }
6690 - (0,_utils_js__WEBPACK_IMPORTED_MODULE_7__.preventDefault)(e);
6760 + ;(0,_utils_js__WEBPACK_IMPORTED_MODULE_7__.preventDefault)(e);
6691 6761 }
6692 6762 else if ((eventName === 'click' && (0,_utils_js__WEBPACK_IMPORTED_MODULE_7__.isKeyDown)(_constants_js__WEBPACK_IMPORTED_MODULE_5__.KEY_SHORTCUT, e)) || (eventName === 'keydown' && (0,_utils_js__WEBPACK_IMPORTED_MODULE_7__.isKeyDown)('shiftKey', e))) {
6693 6763 if (item.classList.contains('active')) {
6694 6764 self.removeActiveItem(item);
@@ -6735,9 +6805,9 @@
6735 6805 * Clears all the active items
6736 6806 *
6737 6807 */
6738 6808 clearActiveItems() {
6739 - (0,_vanilla_js__WEBPACK_IMPORTED_MODULE_8__.removeClasses)(this.activeItems, 'active');
6809 + ;(0,_vanilla_js__WEBPACK_IMPORTED_MODULE_8__.removeClasses)(this.activeItems, 'active');
6740 6810 this.activeItems = [];
6741 6811 }
6742 6812 /**
6743 6813 * Sets the selected item in the dropdown menu
@@ -6852,17 +6922,21 @@
6852 6922 var self = this;
6853 6923 if (self.isDisabled || self.isReadOnly)
6854 6924 return;
6855 6925 self.ignoreFocus = true;
6856 - if (self.control_input.offsetWidth) {
6857 - self.control_input.focus();
6858 - }
6859 - else {
6860 - self.focus_node.focus();
6861 - }
6926 + const focusTarget = this.control_input.offsetWidth ? this.control_input : this.focus_node;
6927 + focusTarget.focus();
6862 6928 setTimeout(() => {
6863 6929 self.ignoreFocus = false;
6864 - self.onFocus();
6930 + // Fix https://github.com/orchidjs/tom-select/issues/806
6931 + // Only proceed if this instance's element is still the active element. If Edge autofill
6932 + // (or anything else) has moved focus to a different element in the interim, calling
6933 + // onFocus() here would steal focus back and restart the cascade loop.
6934 + const root = focusTarget.getRootNode();
6935 + if (root.activeElement !== focusTarget) {
6936 + return;
6937 + }
6938 + this.onFocus();
6865 6939 }, 0);
6866 6940 }
6867 6941 /**
6868 6942 * Forces the control out of focus.
@@ -6918,10 +6992,15 @@
6918 6992 throw new Error('Tom Select "score" setting must be a function that returns a function');
6919 6993 }
6920 6994 }
6921 6995 // perform search
6922 - if (query !== self.lastQuery) {
6996 + if (self.isDropdownContentStale || query !== self.lastQuery) {
6923 6997 self.lastQuery = query;
6998 + // temp fix for https://github.com/orchidjs/tom-select/issues/987
6999 + // UI crashed when more than 30 same chars in a row, prevent search and return empt result
7000 + if (/(.)\1{15,}/.test(query)) {
7001 + query = '';
7002 + }
6924 7003 result = self.sifter.search(query, Object.assign(options, { score: calculateScore }));
6925 7004 self.currentResults = result;
6926 7005 }
6927 7006 else {
@@ -6930,9 +7009,9 @@
6930 7009 // filter out selected items
6931 7010 if (self.settings.hideSelected) {
6932 7011 result.items = result.items.filter((item) => {
6933 7012 let hashed = (0,_utils_js__WEBPACK_IMPORTED_MODULE_7__.hash_key)(item.id);
6934 - return !(hashed && self.items.indexOf(hashed) !== -1);
7013 + return !(hashed !== null && self.items.indexOf(hashed) !== -1);
6935 7014 });
6936 7015 }
6937 7016 return result;
6938 7017 }
@@ -7002,8 +7081,15 @@
7002 7081 for (j = 0, k = optgroups && optgroups.length; j < k; j++) {
7003 7082 optgroup = optgroups[j];
7004 7083 let order = option.$order;
7005 7084 let self_optgroup = self.optgroups[optgroup];
7085 + if (self_optgroup === undefined && typeof self.settings.optionGroupRegister === 'function') {
7086 + var regGroup;
7087 + if (regGroup = self.settings.optionGroupRegister.apply(self, [optgroup])) {
7088 + self.registerOptionGroup(regGroup);
7089 + }
7090 + }
7091 + self_optgroup = self.optgroups[optgroup];
7006 7092 if (self_optgroup === undefined) {
7007 7093 optgroup = '';
7008 7094 }
7009 7095 else {
@@ -7056,8 +7142,9 @@
7056 7142 }
7057 7143 });
7058 7144 dropdown_content.innerHTML = '';
7059 7145 (0,_utils_js__WEBPACK_IMPORTED_MODULE_7__.append)(dropdown_content, html);
7146 + self.isDropdownContentStale = false;
7060 7147 // highlight matching terms inline
7061 7148 if (self.settings.highlight) {
7062 7149 (0,_contrib_highlight_js__WEBPACK_IMPORTED_MODULE_4__.removeHighlight)(dropdown_content);
7063 7150 if (results.query.length && results.tokens.length) {
@@ -7150,14 +7237,15 @@
7150 7237 return false;
7151 7238 }
7152 7239 const key = (0,_utils_js__WEBPACK_IMPORTED_MODULE_7__.hash_key)(data[self.settings.valueField]);
7153 7240 if (key === null || self.options.hasOwnProperty(key)) {
7241 + self.updateOption(data[self.settings.valueField], data);
7154 7242 return false;
7155 7243 }
7156 7244 data.$order = data.$order || ++self.order;
7157 7245 data.$id = self.inputId + '-opt-' + data.$order;
7158 7246 self.options[key] = data;
7159 - self.lastQuery = null;
7247 + self.isDropdownContentStale = true;
7160 7248 if (user_created) {
7161 7249 self.userOptions[key] = user_created;
7162 7250 self.trigger('option_add', key, data);
7163 7251 }
@@ -7167,9 +7255,9 @@
7167 7255 * Add multiple options
7168 7256 *
7169 7257 */
7170 7258 addOptions(data, user_created = false) {
7171 - (0,_utils_js__WEBPACK_IMPORTED_MODULE_7__.iterate)(data, (dat) => {
7259 + ;(0,_utils_js__WEBPACK_IMPORTED_MODULE_7__.iterate)(data, (dat) => {
7172 7260 this.addOption(dat, user_created);
7173 7261 });
7174 7262 }
7175 7263 /**
@@ -7271,10 +7359,10 @@
7271 7359 if (item.classList.contains('active'))
7272 7360 (0,_vanilla_js__WEBPACK_IMPORTED_MODULE_8__.addClasses)(item_new, 'active');
7273 7361 (0,_vanilla_js__WEBPACK_IMPORTED_MODULE_8__.replaceNode)(item, item_new);
7274 7362 }
7275 - // invalidate last query because we might have updated the sortField
7276 - self.lastQuery = null;
7363 + // we might have updated the sortField
7364 + self.isDropdownContentStale = true;
7277 7365 }
7278 7366 /**
7279 7367 * Removes a single option.
7280 7368 *
@@ -7284,9 +7372,9 @@
7284 7372 value = (0,_utils_js__WEBPACK_IMPORTED_MODULE_7__.get_hash)(value);
7285 7373 self.uncacheValue(value);
7286 7374 delete self.userOptions[value];
7287 7375 delete self.options[value];
7288 - self.lastQuery = null;
7376 + self.isDropdownContentStale = true;
7289 7377 self.trigger('option_remove', value);
7290 7378 self.removeItem(value, silent);
7291 7379 }
7292 7380 /**
@@ -7303,9 +7391,9 @@
7303 7391 selected[key] = option;
7304 7392 }
7305 7393 });
7306 7394 this.options = this.sifter.items = selected;
7307 - this.lastQuery = null;
7395 + this.isDropdownContentStale = true;
7308 7396 this.trigger('option_clear');
7309 7397 }
7310 7398 /**
7311 7399 * Used by clearOptions() to decide whether or not an option should be removed
@@ -7435,8 +7523,12 @@
7435 7523 if (next) {
7436 7524 self.setActiveOption(next);
7437 7525 }
7438 7526 }
7527 + //remove input value when enabled
7528 + if (self.settings.clearAfterSelect) {
7529 + self.setTextboxValue();
7530 + }
7439 7531 // refreshOptions after setActiveOption(),
7440 7532 // otherwise setActiveOption() will be called by refreshOptions() with the wrong value
7441 7533 if (!self.isPending && !self.settings.closeAfterSelect) {
7442 7534 self.refreshOptions(self.isFocused && inputMode !== 'single');
@@ -7478,9 +7570,9 @@
7478 7570 self.activeItems.splice(idx, 1);
7479 7571 (0,_vanilla_js__WEBPACK_IMPORTED_MODULE_8__.removeClasses)(item, 'active');
7480 7572 }
7481 7573 self.items.splice(i, 1);
7482 - self.lastQuery = null;
7574 + self.isDropdownContentStale = true;
7483 7575 if (!self.settings.persist && self.userOptions.hasOwnProperty(value)) {
7484 7576 self.removeOption(value, silent);
7485 7577 }
7486 7578 if (i < self.caretPos) {
@@ -7512,8 +7604,14 @@
7512 7604 var caret = self.caretPos;
7513 7605 var output;
7514 7606 input = input || self.inputValue();
7515 7607 if (!self.canCreate(input)) {
7608 + const hash = (0,_utils_js__WEBPACK_IMPORTED_MODULE_7__.hash_key)(input);
7609 + if (hash) {
7610 + if (this.options[input]) {
7611 + self.addItem(input);
7612 + }
7613 + }
7516 7614 callback();
7517 7615 return false;
7518 7616 }
7519 7617 self.lock();
@@ -7551,9 +7649,9 @@
7551 7649 * Re-renders the selected item lists.
7552 7650 */
7553 7651 refreshItems() {
7554 7652 var self = this;
7555 - self.lastQuery = null;
7653 + self.isDropdownContentStale = true;
7556 7654 if (self.isSetup) {
7557 7655 self.addItems(self.items);
7558 7656 }
7559 7657 self.updateOriginalInput();
@@ -7630,9 +7728,9 @@
7630 7728 }
7631 7729 selected.push(option_el);
7632 7730 // marking empty option as selected can break validation
7633 7731 // fixes https://github.com/orchidjs/tom-select/issues/303
7634 - if (option_el != empty_option || has_selected > 0) {
7732 + if (option_el != empty_option || has_selected > 0 || self.settings.mode == 'multi') {
7635 7733 option_el.selected = true;
7636 7734 }
7637 7735 return option_el;
7638 7736 }
@@ -7773,9 +7871,9 @@
7773 7871 caret = (0,_vanilla_js__WEBPACK_IMPORTED_MODULE_8__.nodeIndex)(tail);
7774 7872 if (direction > 0) {
7775 7873 caret++;
7776 7874 }
7777 - (0,_utils_js__WEBPACK_IMPORTED_MODULE_7__.iterate)(self.activeItems, (item) => rm_items.push(item));
7875 + ;(0,_utils_js__WEBPACK_IMPORTED_MODULE_7__.iterate)(self.activeItems, (item) => rm_items.push(item));
7778 7876 }
7779 7877 else if ((self.isFocused || self.settings.mode === 'single') && self.items.length) {
7780 7878 const items = self.controlChildren();
7781 7879 let rm_item;
@@ -7791,9 +7889,9 @@
7791 7889 }
7792 7890 if (!self.shouldDelete(rm_items, e)) {
7793 7891 return false;
7794 7892 }
7795 - (0,_utils_js__WEBPACK_IMPORTED_MODULE_7__.preventDefault)(e, true);
7893 + ;(0,_utils_js__WEBPACK_IMPORTED_MODULE_7__.preventDefault)(e, true);
7796 7894 // perform removal
7797 7895 if (typeof caret !== 'undefined') {
7798 7896 self.setCaret(caret);
7799 7897 }
@@ -7810,9 +7908,9 @@
7810 7908 */
7811 7909 shouldDelete(items, evt) {
7812 7910 const values = items.map(item => item.dataset.value);
7813 7911 // allow the callback to abort
7814 - if (!values.length || (typeof this.settings.onDelete === 'function' && this.settings.onDelete(values, evt) === false)) {
7912 + if (!values.length || (typeof this.settings.onDelete === 'function' && this.settings.onDelete.call(this, values, evt) === false)) {
7815 7913 return false;
7816 7914 }
7817 7915 return true;
7818 7916 }
@@ -8029,9 +8127,9 @@
8029 8127 * caches.
8030 8128 *
8031 8129 */
8032 8130 clearCache() {
8033 - (0,_utils_js__WEBPACK_IMPORTED_MODULE_7__.iterate)(this.options, (option) => {
8131 + ;(0,_utils_js__WEBPACK_IMPORTED_MODULE_7__.iterate)(this.options, (option) => {
8034 8132 if (option.$div) {
8035 8133 option.$div.remove();
8036 8134 delete option.$div;
8037 8135 }
@@ -8510,19 +8608,19 @@
8510 8608
8511 8609 /******/ });
8512 8610 /************************************************************************/
8513 8611 /******/ // The module cache
8514 -/******/ var __webpack_module_cache__ = {};
8612 +/******/ const __webpack_module_cache__ = {};
8515 8613 /******/
8516 8614 /******/ // The require function
8517 8615 /******/ function __webpack_require__(moduleId) {
8518 8616 /******/ // Check if module is in cache
8519 -/******/ var cachedModule = __webpack_module_cache__[moduleId];
8617 +/******/ const cachedModule = __webpack_module_cache__[moduleId];
8520 8618 /******/ if (cachedModule !== undefined) {
8521 8619 /******/ return cachedModule.exports;
8522 8620 /******/ }
8523 8621 /******/ // Create a new module (and put it into the cache)
8524 -/******/ var module = __webpack_module_cache__[moduleId] = {
8622 +/******/ const module = __webpack_module_cache__[moduleId] = {
8525 8623 /******/ id: moduleId,
8526 8624 /******/ // no module.loaded needed
8527 8625 /******/ exports: {}
8528 8626 /******/ };
@@ -8529,9 +8627,9 @@
8529 8627 /******/
8530 8628 /******/ // Execute the module function
8531 8629 /******/ if (!(moduleId in __webpack_modules__)) {
8532 8630 /******/ delete __webpack_module_cache__[moduleId];
8533 -/******/ var e = new Error("Cannot find module '" + moduleId + "'");
8631 +/******/ const e = new Error("Cannot find module '" + moduleId + "'");
8534 8632 /******/ e.code = 'MODULE_NOT_FOUND';
8535 8633 /******/ throw e;
8536 8634 /******/ }
8537 8635 /******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
@@ -8544,9 +8642,9 @@
8544 8642 /******/ /* webpack/runtime/compat get default export */
8545 8643 /******/ (() => {
8546 8644 /******/ // getDefaultExport function for compatibility with non-harmony modules
8547 8645 /******/ __webpack_require__.n = (module) => {
8548 -/******/ var getter = module && module.__esModule ?
8646 +/******/ const getter = module && module.__esModule ?
8549 8647 /******/ () => (module['default']) :
8550 8648 /******/ () => (module);
8551 8649 /******/ __webpack_require__.d(getter, { a: getter });
8552 8650 /******/ return getter;
@@ -8554,14 +8652,29 @@
8554 8652 /******/ })();
8555 8653 /******/
8556 8654 /******/ /* webpack/runtime/define property getters */
8557 8655 /******/ (() => {
8558 -/******/ // define getter functions for harmony exports
8656 +/******/ // define getter/value functions for harmony exports
8559 8657 /******/ __webpack_require__.d = (exports, definition) => {
8560 -/******/ for(var key in definition) {
8561 -/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
8562 -/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
8658 +/******/ if(Array.isArray(definition)) {
8659 +/******/ var i = 0;
8660 +/******/ while(i < definition.length) {
8661 +/******/ var key = definition[i++];
8662 +/******/ var binding = definition[i++];
8663 +/******/ if(!__webpack_require__.o(exports, key)) {
8664 +/******/ if(binding === 0) {
8665 +/******/ Object.defineProperty(exports, key, { enumerable: true, value: definition[i++] });
8666 +/******/ } else {
8667 +/******/ Object.defineProperty(exports, key, { enumerable: true, get: binding });
8668 +/******/ }
8669 +/******/ } else if(binding === 0) { i++; }
8563 8670 /******/ }
8671 +/******/ } else {
8672 +/******/ for(var key in definition) {
8673 +/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
8674 +/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
8675 +/******/ }
8676 +/******/ }
8564 8677 /******/ }
8565 8678 /******/ };
8566 8679 /******/ })();
8567 8680 /******/
@@ -8566,9 +8679,9 @@
8566 8679 /******/ })();
8567 8680 /******/
8568 8681 /******/ /* webpack/runtime/hasOwnProperty shorthand */
8569 8682 /******/ (() => {
8570 -/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
8683 +/******/ __webpack_require__.o = (obj, prop) => (Object.hasOwn(obj, prop))
8571 8684 /******/ })();
8572 8685 /******/
8573 8686 /******/ /* webpack/runtime/make namespace object */
8574 8687 /******/ (() => {
@@ -8573,9 +8686,9 @@
8573 8686 /******/ /* webpack/runtime/make namespace object */
8574 8687 /******/ (() => {
8575 8688 /******/ // define __esModule on exports
8576 8689 /******/ __webpack_require__.r = (exports) => {
8577 -/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
8690 +/******/ if(Symbol.toStringTag) {
8578 8691 /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
8579 8692 /******/ }
8580 8693 /******/ Object.defineProperty(exports, '__esModule', { value: true });
8581 8694 /******/ };
@@ -8586,9 +8699,9 @@
8586 8699 /******/ __webpack_require__.nc = undefined;
8587 8700 /******/ })();
8588 8701 /******/
8589 8702 /************************************************************************/
8590 -var __webpack_exports__ = {};
8703 +let __webpack_exports__ = {};
8591 8704 // This entry needs to be wrapped in an IIFE because it needs to be in strict mode.
8592 8705 (() => {
8593 8706 "use strict";
8594 8707 /*!**************************************!*\