PageSourceSearch

https://www.gainrep.com/scripts/choices/choices.js

js gainrep.com collected 2026-10-06 21:16:22 UTC 170,442 bytes, 5,562 lines download raw bytes

vendor: 5,347 bytes, lines 1-147
1/*! choices.js v9.0.1 | © 2019 Josh Johnson | https://github.com/jshjohnson/Choices#readme */
2(function webpackUniversalModuleDefinition(root, factory) {
3	if(typeof exports === 'object' && typeof module === 'object')
4		module.exports = factory();
5	else if(typeof define === 'function' && define.amd)
6		define([], factory);
7	else if(typeof exports === 'object')
8		exports["Choices"] = factory();
9	else
10		root["Choices"] = factory();
11})(window, function() {
12return /******/ (function(modules) { // webpackBootstrap
13/******/ 	// The module cache
14/******/ 	var installedModules = {};
15/******/
16/******/ 	// The require function
17/******/ 	function __webpack_require__(moduleId) {
18/******/
19/******/ 		// Check if module is in cache
20/******/ 		if(installedModules[moduleId]) {
21/******/ 			return installedModules[moduleId].exports;
22/******/ 		}
23/******/ 		// Create a new module (and put it into the cache)
24/******/ 		var module = installedModules[moduleId] = {
25/******/ 			i: moduleId,
26/******/ 			l: false,
27/******/ 			exports: {}
28/******/ 		};
29/******/
30/******/ 		// Execute the module function
31/******/ 		modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
32/******/
33/******/ 		// Flag the module as loaded
34/******/ 		module.l = true;
35/******/
36/******/ 		// Return the exports of the module
37/******/ 		return module.exports;
38/******/ 	}
39/******/
40/******/
41/******/ 	// expose the modules object (__webpack_modules__)
42/******/ 	__webpack_require__.m = modules;
43/******/
44/******/ 	// expose the module cache
45/******/ 	__webpack_require__.c = installedModules;
46/******/
47/******/ 	// define getter function for harmony exports
48/******/ 	__webpack_require__.d = function(exports, name, getter) {
49/******/ 		if(!__webpack_require__.o(exports, name)) {
50/******/ 			Object.defineProperty(exports, name, { enumerable: true, get: getter });
51/******/ 		}
52/******/ 	};
53/******/
54/******/ 	// define __esModule on exports
55/******/ 	__webpack_require__.r = function(exports) {
56/******/ 		if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
57/******/ 			Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
58/******/ 		}
59/******/ 		Object.defineProperty(exports, '__esModule', { value: true });
60/******/ 	};
61/******/
62/******/ 	// create a fake namespace object
63/******/ 	// mode & 1: value is a module id, require it
64/******/ 	// mode & 2: merge all properties of value into the ns
65/******/ 	// mode & 4: return value when already ns object
66/******/ 	// mode & 8|1: behave like require
67/******/ 	__webpack_require__.t = function(value, mode) {
68/******/ 		if(mode & 1) value = __webpack_require__(value);
69/******/ 		if(mode & 8) return value;
70/******/ 		if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
71/******/ 		var ns = Object.create(null);
72/******/ 		__webpack_require__.r(ns);
73/******/ 		Object.defineProperty(ns, 'default', { enumerable: true, value: value });
74/******/ 		if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
75/******/ 		return ns;
76/******/ 	};
77/******/
78/******/ 	// getDefaultExport function for compatibility with non-harmony modules
79/******/ 	__webpack_require__.n = function(module) {
80/******/ 		var getter = module && module.__esModule ?
81/******/ 			function getDefault() { return module['default']; } :
82/******/ 			function getModuleExports() { return module; };
83/******/ 		__webpack_require__.d(getter, 'a', getter);
84/******/ 		return getter;
85/******/ 	};
86/******/
87/******/ 	// Object.prototype.hasOwnProperty.call
88/******/ 	__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
89/******/
90/******/ 	// __webpack_public_path__
91/******/ 	__webpack_require__.p = "/public/assets/scripts/";
92/******/
93/******/
94/******/ 	// Load entry module and return exports
95/******/ 	return __webpack_require__(__webpack_require__.s = 7);
96/******/ })
97/************************************************************************/
98/******/ ([
99/* 0 */
100/***/ (function(module, exports, __webpack_require__) {
101
102"use strict";
103
104
105Object.defineProperty(exports, "__esModule", {
106  value: true
107});
108
109var utils_1 = __webpack_require__(1);
110
111exports.DEFAULT_CLASSNAMES = {
112  containerOuter: 'choices',
113  containerInner: 'choices__inner',
114  input: 'choices__input',
115  inputCloned: 'choices__input--cloned',
116  list: 'choices__list',
117  listItems: 'choices__list--multiple',
118  listSingle: 'choices__list--single',
119  listDropdown: 'choices__list--dropdown',
120  item: 'choices__item',
121  itemSelectable: 'choices__item--selectable',
122  itemDisabled: 'choices__item--disabled',
123  itemChoice: 'choices__item--choice',
124  placeholder: 'choices__placeholder',
125  group: 'choices__group',
126  groupHeading: 'choices__heading',
127  button: 'choices__button',
128  activeState: 'is-active',
129  focusState: 'is-focused',
130  openState: 'is-open',
131  disabledState: 'is-disabled',
132  highlightedState: 'is-highlighted',
133  selectedState: 'is-selected',
134  flippedState: 'is-flipped',
135  loadingState: 'is-loading',
136  noResults: 'has-no-results',
137  noChoices: 'has-no-choices'
138};
139exports.DEFAULT_CONFIG = {
140  items: [],
141  choices: [],
142  silent: false,
143  renderChoiceLimit: -1,
144  maxItemCount: -1,
145  addItems: true,
146  addItemFilter: null,
147  removeItems: true,
148  removeItemButton: false,
149  editItems: false,
150  duplicateItemsAllowed: true,
151  delimiter: ',',
152  paste: true,
153  searchEnabled: true,
154  searchChoices: true,
155  searchFloor: 1,
156  searchResultLimit: 4,
157  searchFields: ['label', 'value'],
158  position: 'auto',
159  resetScrollPosition: true,
160  shouldSort: true,
161  shouldSortItems: false,
162  sorter: utils_1.sortByAlpha,
163  placeholder: true,
164  placeholderValue: null,
165  searchPlaceholderValue: null,
166  prependValue: null,
167  appendValue: null,
168  renderSelectedChoices: 'auto',
169  loadingText: 'Loading...',
170  noResultsText: 'No results found',
171  noChoicesText: 'No choices to choose from',
172  itemSelectText: 'Press to select',
173  itemAddText: 'Press Enter to add',
174  uniqueItemText: 'Only unique values can be added',
175  customAddItemText: 'Only values matching specific conditions can be added',
176  addItemText: function addItemText(value) {
177    return this.itemAddText + " <b>\"" + utils_1.sanitise(value) + "\"</b>";
178  },
179  maxItemText: function maxItemText(maxItemCount) {
180    return "Only " + maxItemCount + " values can be added";
181  },
182  valueComparer: function valueComparer(value1, value2) {
183    return value1 === value2;
184  },
185  fuseOptions: {
186    includeScore: true
187  },
188  callbackOnInit: null,
189  callbackOnCreateTemplates: null,
190  classNames: exports.DEFAULT_CLASSNAMES
191};
192exports.EVENTS = {
193  showDropdown: 'showDropdown',
194  hideDropdown: 'hideDropdown',
195  change: 'change',
196  choice: 'choice',
197  search: 'search',
198  addItem: 'addItem',
199  removeItem: 'removeItem',
200  highlightItem: 'highlightItem',
201  highlightChoice: 'highlightChoice',
202  unhighlightItem: 'unhighlightItem'
203};
204exports.ACTION_TYPES = {
205  ADD_CHOICE: 'ADD_CHOICE',
206  FILTER_CHOICES: 'FILTER_CHOICES',
207  ACTIVATE_CHOICES: 'ACTIVATE_CHOICES',
208  CLEAR_CHOICES: 'CLEAR_CHOICES',
209  ADD_GROUP: 'ADD_GROUP',
210  ADD_ITEM: 'ADD_ITEM',
211  REMOVE_ITEM: 'REMOVE_ITEM',
212  HIGHLIGHT_ITEM: 'HIGHLIGHT_ITEM',
213  CLEAR_ALL: 'CLEAR_ALL',
214  RESET_TO: 'RESET_TO',
215  SET_IS_LOADING: 'SET_IS_LOADING'
216};
217exports.KEY_CODES = {
218  BACK_KEY: 46,
219  DELETE_KEY: 8,
220  ENTER_KEY: 13,
221  A_KEY: 65,
222  ESC_KEY: 27,
223  UP_KEY: 38,
224  DOWN_KEY: 40,
225  PAGE_UP_KEY: 33,
226  PAGE_DOWN_KEY: 34
227};
228exports.TEXT_TYPE = 'text';
229exports.SELECT_ONE_TYPE = 'select-one';
230exports.SELECT_MULTIPLE_TYPE = 'select-multiple';
231exports.SCROLLING_SPEED = 4;
232
233/***/ }),
234/* 1 */
235/***/ (function(module, exports, __webpack_require__) {
236
237"use strict";
238
239
240Object.defineProperty(exports, "__esModule", {
241  value: true
242});
243/* eslint-disable @typescript-eslint/no-explicit-any */
244
245exports.getRandomNumber = function (min, max) {
246  return Math.floor(Math.random() * (max - min) + min);
247};
248
249exports.generateChars = function (length) {
250  return Array.from({
251    length: length
252  }, function () {
253    return exports.getRandomNumber(0, 36).toString(36);
254  }).join('');
255};
256
257exports.generateId = function (element, prefix) {
258  var id = element.id || element.name && element.name + "-" + exports.generateChars(2) || exports.generateChars(4);
259  id = id.replace(/(:|\.|\[|\]|,)/g, '');
260  id = prefix + "-" + id;
261  return id;
262};
263
264exports.getType = function (obj) {
265  return Object.prototype.toString.call(obj).slice(8, -1);
266};
267
268exports.isType = function (type, obj) {
269  return obj !== undefined && obj !== null && exports.getType(obj) === type;
270};
271
272exports.wrap = function (element, wrapper) {
273  if (wrapper === void 0) {
274    wrapper = document.createElement('div');
275  }
276
277  if (element.nextSibling) {
278    element.parentNode && element.parentNode.insertBefore(wrapper, element.nextSibling);
279  } else {
280    element.parentNode && element.parentNode.appendChild(wrapper);
281  }
282
283  return wrapper.appendChild(element);
284};
285
286exports.getAdjacentEl = function (startEl, selector, direction) {
287  if (direction === void 0) {
288    direction = 1;
289  }
290
291  var prop = (direction > 0 ? 'next' : 'previous') + "ElementSibling";
292  var sibling = startEl[prop];
293
294  while (sibling) {
295    if (sibling.matches(selector)) {
296      return sibling;
297    }
298
299    sibling = sibling[prop];
300  }
301
302  return sibling;
303};
304
305exports.isScrolledIntoView = function (element, parent, direction) {
306  if (direction === void 0) {
307    direction = 1;
308  }
309
310  if (!element) {
311    return false;
312  }
313
314  var isVisible;
315
316  if (direction > 0) {
317    // In view from bottom
318    isVisible = parent.scrollTop + parent.offsetHeight >= element.offsetTop + element.offsetHeight;
319  } else {
320    // In view from top
321    isVisible = element.offsetTop >= parent.scrollTop;
322  }
323
324  return isVisible;
325};
326
327exports.sanitise = function (value) {
328  if (typeof value !== 'string') {
329    return value;
330  }
331
332  return value.replace(/&/g, '&amp;').replace(/>/g, '&rt;').replace(/</g, '&lt;').replace(/"/g, '&quot;');
333};
334
335exports.strToEl = function () {
336  var tmpEl = document.createElement('div');
337  return function (str) {
338    var cleanedInput = str.trim();
339    tmpEl.innerHTML = cleanedInput;
340    var firldChild = tmpEl.children[0];
341
342    while (tmpEl.firstChild) {
343      tmpEl.removeChild(tmpEl.firstChild);
344    }
345
346    return firldChild;
347  };
348}();
349
350exports.sortByAlpha = function (_a, _b) {
351  var value = _a.value,
352      _c = _a.label,
353      label = _c === void 0 ? value : _c;
354  var value2 = _b.value,
355      _d = _b.label,
356      label2 = _d === void 0 ? value2 : _d;
357  return label.localeCompare(label2, [], {
358    sensitivity: 'base',
359    ignorePunctuation: true,
360    numeric: true
361  });
362};
363
364exports.sortByScore = function (a, b) {
365  var _a = a.score,
366      scoreA = _a === void 0 ? 0 : _a;
367  var _b = b.score,
368      scoreB = _b === void 0 ? 0 : _b;
369  return scoreA - scoreB;
370};
371
372exports.dispatchEvent = function (element, type, customArgs) {
373  if (customArgs === void 0) {
374    customArgs = null;
375  }
376
377  var event = new CustomEvent(type, {
378    detail: customArgs,
379    bubbles: true,
380    cancelable: true
381  });
382  return element.dispatchEvent(event);
383};
384
385exports.existsInArray = function (array, value, key) {
386  if (key === void 0) {
387    key = 'value';
388  }
389
390  return array.some(function (item) {
391    if (typeof value === 'string') {
392      return item[key] === value.trim();
393    }
394
395    return item[key] === value;
396  });
397};
398
399exports.cloneObject = function (obj) {
400  return JSON.parse(JSON.stringify(obj));
401};
402/**
403 * Returns an array of keys present on the first but missing on the second object
404 */
405
406
407exports.diff = function (a, b) {
408  var aKeys = Object.keys(a).sort();
409  var bKeys = Object.keys(b).sort();
410  return aKeys.filter(function (i) {
411    return bKeys.indexOf(i) < 0;
412  });
413};
414
415/***/ }),
416/* 2 */
417/***/ (function(module, __webpack_exports__, __webpack_require__) {
418
419"use strict";
420/* WEBPACK VAR INJECTION */(function(global, module) {/* harmony import */ var _ponyfill_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(6);
421/* global window */
422
423
424var root;
425
426if (typeof self !== 'undefined') {
427  root = self;
428} else if (typeof window !== 'undefined') {
429  root = window;
430} else if (typeof global !== 'undefined') {
431  root = global;
432} else if (true) {
433  root = module;
434} else {}
435
436var result = Object(_ponyfill_js__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(root);
437/* harmony default export */ __webpack_exports__["a"] = (result);
438
439/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(12), __webpack_require__(13)(module)))
440
441/***/ }),
442/* 3 */
443/***/ (function(module, __webpack_exports__, __webpack_require__) {
444
445"use strict";
446__webpack_require__.r(__webpack_exports__);
447/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__DO_NOT_USE__ActionTypes", function() { return ActionTypes; });
448/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "applyMiddleware", function() { return applyMiddleware; });
449/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "bindActionCreators", function() { return bindActionCreators; });
450/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "combineReducers", function() { return combineReducers; });
451/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "compose", function() { return compose; });
452/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createStore", function() { return createStore; });
453/* harmony import */ var symbol_observable__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2);
454
455
456/**
457 * These are private action types reserved by Redux.
458 * For any unknown actions, you must return the current state.
459 * If the current state is undefined, you must return the initial state.
460 * Do not reference these action types directly in your code.
461 */
462var randomString = function randomString() {
463  return Math.random().toString(36).substring(7).split('').join('.');
464};
465
466var ActionTypes = {
467  INIT: "@@redux/INIT" + randomString(),
468  REPLACE: "@@redux/REPLACE" + randomString(),
469  PROBE_UNKNOWN_ACTION: function PROBE_UNKNOWN_ACTION() {
470    return "@@redux/PROBE_UNKNOWN_ACTION" + randomString();
471  }
472};
473
474/**
475 * @param {any} obj The object to inspect.
476 * @returns {boolean} True if the argument appears to be a plain object.
477 */
478function isPlainObject(obj) {
479  if (typeof obj !== 'object' || obj === null) return false;
vendor: 9,902 bytes, lines 480-743
480  var proto = obj;
481
482  while (Object.getPrototypeOf(proto) !== null) {
483    proto = Object.getPrototypeOf(proto);
484  }
485
486  return Object.getPrototypeOf(obj) === proto;
487}
488
489/**
490 * Creates a Redux store that holds the state tree.
491 * The only way to change the data in the store is to call `dispatch()` on it.
492 *
493 * There should only be a single store in your app. To specify how different
494 * parts of the state tree respond to actions, you may combine several reducers
495 * into a single reducer function by using `combineReducers`.
496 *
497 * @param {Function} reducer A function that returns the next state tree, given
498 * the current state tree and the action to handle.
499 *
500 * @param {any} [preloadedState] The initial state. You may optionally specify it
501 * to hydrate the state from the server in universal apps, or to restore a
502 * previously serialized user session.
503 * If you use `combineReducers` to produce the root reducer function, this must be
504 * an object with the same shape as `combineReducers` keys.
505 *
506 * @param {Function} [enhancer] The store enhancer. You may optionally specify it
507 * to enhance the store with third-party capabilities such as middleware,
508 * time travel, persistence, etc. The only store enhancer that ships with Redux
509 * is `applyMiddleware()`.
510 *
511 * @returns {Store} A Redux store that lets you read the state, dispatch actions
512 * and subscribe to changes.
513 */
514
515function createStore(reducer, preloadedState, enhancer) {
516  var _ref2;
517
518  if (typeof preloadedState === 'function' && typeof enhancer === 'function' || typeof enhancer === 'function' && typeof arguments[3] === 'function') {
519    throw new Error('It looks like you are passing several store enhancers to ' + 'createStore(). This is not supported. Instead, compose them ' + 'together to a single function.');
520  }
521
522  if (typeof preloadedState === 'function' && typeof enhancer === 'undefined') {
523    enhancer = preloadedState;
524    preloadedState = undefined;
525  }
526
527  if (typeof enhancer !== 'undefined') {
528    if (typeof enhancer !== 'function') {
529      throw new Error('Expected the enhancer to be a function.');
530    }
531
532    return enhancer(createStore)(reducer, preloadedState);
533  }
534
535  if (typeof reducer !== 'function') {
536    throw new Error('Expected the reducer to be a function.');
537  }
538
539  var currentReducer = reducer;
540  var currentState = preloadedState;
541  var currentListeners = [];
542  var nextListeners = currentListeners;
543  var isDispatching = false;
544  /**
545   * This makes a shallow copy of currentListeners so we can use
546   * nextListeners as a temporary list while dispatching.
547   *
548   * This prevents any bugs around consumers calling
549   * subscribe/unsubscribe in the middle of a dispatch.
550   */
551
552  function ensureCanMutateNextListeners() {
553    if (nextListeners === currentListeners) {
554      nextListeners = currentListeners.slice();
555    }
556  }
557  /**
558   * Reads the state tree managed by the store.
559   *
560   * @returns {any} The current state tree of your application.
561   */
562
563
564  function getState() {
565    if (isDispatching) {
566      throw new Error('You may not call store.getState() while the reducer is executing. ' + 'The reducer has already received the state as an argument. ' + 'Pass it down from the top reducer instead of reading it from the store.');
567    }
568
569    return currentState;
570  }
571  /**
572   * Adds a change listener. It will be called any time an action is dispatched,
573   * and some part of the state tree may potentially have changed. You may then
574   * call `getState()` to read the current state tree inside the callback.
575   *
576   * You may call `dispatch()` from a change listener, with the following
577   * caveats:
578   *
579   * 1. The subscriptions are snapshotted just before every `dispatch()` call.
580   * If you subscribe or unsubscribe while the listeners are being invoked, this
581   * will not have any effect on the `dispatch()` that is currently in progress.
582   * However, the next `dispatch()` call, whether nested or not, will use a more
583   * recent snapshot of the subscription list.
584   *
585   * 2. The listener should not expect to see all state changes, as the state
586   * might have been updated multiple times during a nested `dispatch()` before
587   * the listener is called. It is, however, guaranteed that all subscribers
588   * registered before the `dispatch()` started will be called with the latest
589   * state by the time it exits.
590   *
591   * @param {Function} listener A callback to be invoked on every dispatch.
592   * @returns {Function} A function to remove this change listener.
593   */
594
595
596  function subscribe(listener) {
597    if (typeof listener !== 'function') {
598      throw new Error('Expected the listener to be a function.');
599    }
600
601    if (isDispatching) {
602      throw new Error('You may not call store.subscribe() while the reducer is executing. ' + 'If you would like to be notified after the store has been updated, subscribe from a ' + 'component and invoke store.getState() in the callback to access the latest state. ' + 'See https://redux.js.org/api-reference/store#subscribe(listener) for more details.');
603    }
604
605    var isSubscribed = true;
606    ensureCanMutateNextListeners();
607    nextListeners.push(listener);
608    return function unsubscribe() {
609      if (!isSubscribed) {
610        return;
611      }
612
613      if (isDispatching) {
614        throw new Error('You may not unsubscribe from a store listener while the reducer is executing. ' + 'See https://redux.js.org/api-reference/store#subscribe(listener) for more details.');
615      }
616
617      isSubscribed = false;
618      ensureCanMutateNextListeners();
619      var index = nextListeners.indexOf(listener);
620      nextListeners.splice(index, 1);
621    };
622  }
623  /**
624   * Dispatches an action. It is the only way to trigger a state change.
625   *
626   * The `reducer` function, used to create the store, will be called with the
627   * current state tree and the given `action`. Its return value will
628   * be considered the **next** state of the tree, and the change listeners
629   * will be notified.
630   *
631   * The base implementation only supports plain object actions. If you want to
632   * dispatch a Promise, an Observable, a thunk, or something else, you need to
633   * wrap your store creating function into the corresponding middleware. For
634   * example, see the documentation for the `redux-thunk` package. Even the
635   * middleware will eventually dispatch plain object actions using this method.
636   *
637   * @param {Object} action A plain object representing “what changed”. It is
638   * a good idea to keep actions serializable so you can record and replay user
639   * sessions, or use the time travelling `redux-devtools`. An action must have
640   * a `type` property which may not be `undefined`. It is a good idea to use
641   * string constants for action types.
642   *
643   * @returns {Object} For convenience, the same action object you dispatched.
644   *
645   * Note that, if you use a custom middleware, it may wrap `dispatch()` to
646   * return something else (for example, a Promise you can await).
647   */
648
649
650  function dispatch(action) {
651    if (!isPlainObject(action)) {
652      throw new Error('Actions must be plain objects. ' + 'Use custom middleware for async actions.');
653    }
654
655    if (typeof action.type === 'undefined') {
656      throw new Error('Actions may not have an undefined "type" property. ' + 'Have you misspelled a constant?');
657    }
658
659    if (isDispatching) {
660      throw new Error('Reducers may not dispatch actions.');
661    }
662
663    try {
664      isDispatching = true;
665      currentState = currentReducer(currentState, action);
666    } finally {
667      isDispatching = false;
668    }
669
670    var listeners = currentListeners = nextListeners;
671
672    for (var i = 0; i < listeners.length; i++) {
673      var listener = listeners[i];
674      listener();
675    }
676
677    return action;
678  }
679  /**
680   * Replaces the reducer currently used by the store to calculate the state.
681   *
682   * You might need this if your app implements code splitting and you want to
683   * load some of the reducers dynamically. You might also need this if you
684   * implement a hot reloading mechanism for Redux.
685   *
686   * @param {Function} nextReducer The reducer for the store to use instead.
687   * @returns {void}
688   */
689
690
691  function replaceReducer(nextReducer) {
692    if (typeof nextReducer !== 'function') {
693      throw new Error('Expected the nextReducer to be a function.');
694    }
695
696    currentReducer = nextReducer; // This action has a similiar effect to ActionTypes.INIT.
697    // Any reducers that existed in both the new and old rootReducer
698    // will receive the previous state. This effectively populates
699    // the new state tree with any relevant data from the old one.
700
701    dispatch({
702      type: ActionTypes.REPLACE
703    });
704  }
705  /**
706   * Interoperability point for observable/reactive libraries.
707   * @returns {observable} A minimal observable of state changes.
708   * For more information, see the observable proposal:
709   * https://github.com/tc39/proposal-observable
710   */
711
712
713  function observable() {
714    var _ref;
715
716    var outerSubscribe = subscribe;
717    return _ref = {
718      /**
719       * The minimal observable subscription method.
720       * @param {Object} observer Any object that can be used as an observer.
721       * The observer object should have a `next` method.
722       * @returns {subscription} An object with an `unsubscribe` method that can
723       * be used to unsubscribe the observable from the store, and prevent further
724       * emission of values from the observable.
725       */
726      subscribe: function subscribe(observer) {
727        if (typeof observer !== 'object' || observer === null) {
728          throw new TypeError('Expected the observer to be an object.');
729        }
730
731        function observeState() {
732          if (observer.next) {
733            observer.next(getState());
734          }
735        }
736
737        observeState();
738        var unsubscribe = outerSubscribe(observeState);
739        return {
740          unsubscribe: unsubscribe
741        };
742      }
743    }
743, _ref[symbol_observable__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"]] = function () {
744      return this;
745    }, _ref;
746  } // When a store is created, an "INIT" action is dispatched so that every
747  // reducer returns their initial state. This effectively populates
748  // the initial state tree.
749
750
751  dispatch({
752    type: ActionTypes.INIT
753  });
754  return _ref2 = {
755    dispatch: dispatch,
756    subscribe: subscribe,
757    getState: getState,
758    replaceReducer: replaceReducer
759  }, _ref2[symbol_observable__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"]] = observable, _ref2;
760}
761
762/**
763 * Prints a warning in the console if it exists.
764 *
765 * @param {String} message The warning message.
766 * @returns {void}
767 */
768function warning(message) {
769  /* eslint-disable no-console */
770  if (typeof console !== 'undefined' && typeof console.error === 'function') {
771    console.error(message);
772  }
773  /* eslint-enable no-console */
774
775
776  try {
777    // This error was thrown as a convenience so that if you enable
778    // "break on all exceptions" in your console,
779    // it would pause the execution at this line.
780    throw new Error(message);
781  } catch (e) {} // eslint-disable-line no-empty
782
783}
784
785function getUndefinedStateErrorMessage(key, action) {
786  var actionType = action && action.type;
787  var actionDescription = actionType && "action \"" + String(actionType) + "\"" || 'an action';
788  return "Given " + actionDescription + ", reducer \"" + key + "\" returned undefined. " + "To ignore an action, you must explicitly return the previous state. " + "If you want this reducer to hold no value, you can return null instead of undefined.";
789}
790
791function getUnexpectedStateShapeWarningMessage(inputState, reducers, action, unex
791pectedKeyCache) {
792  var reducerKeys = Object.keys(reducers);
793  var argumentName = action && action.type === ActionTypes.INIT ? 'preloadedState argument passed to createStore' : 'previous state received by the reducer';
794
795  if (reducerKeys.length === 0) {
796    return 'Store does not have a valid reducer. Make sure the argument passed ' + 'to combineReducers is an object whose values are reducers.';
797  }
798
799  if (!isPlainObject(inputState)) {
800    return "The " + argumentName + " has unexpected type of \"" + {}.toString.call(inputState).match(/\s([a-z|A-Z]+)/)[1] + "\". Expected argument to be an object with the following " + ("keys: \"" + reducerKeys.join('", "') + "\"");
801  }
802
803  var unexpectedKeys = Object.keys(inputState).filter(function (key) {
804    return !reducers.hasOwnProperty(key) && !unexpectedKeyCache[key];
805  });
806  unexpectedKeys.forEach(function (key) {
807    unexpectedKeyCache[key] = true;
808  });
809  if (action && action.type === ActionTypes.REPLACE) return;
810
811  if (unexpectedKeys.length > 0) {
812    return "Unexpected " + (unexpectedKeys.length > 1 ? 'keys' : 'key') + " " + ("\"" + unexpectedKeys.join('", "') + "\" found in " + argumentName + ". ") + "Expected to find one of the known reducer keys instead: " + ("\"" + reducerKeys.join('", "') + "\". Unexpected keys will be ignored.");
813  }
814}
815
816function assertReducerShape(reducers) {
817  Object.keys(reducers).forEach(function (key) {
818    var reducer = reducers[key];
819    var initialState = reducer(undefined, {
820      type: ActionTypes.INIT
821    });
822
823    if (typeof initialState === 'undefined') {
824      throw new Error("Reducer \"" + key + "\" returned undefined during initialization. " + "If the state passed to the reducer is undefined, you must " + "explicitly return the initial state. The initial state may " + "not be undefined. If you don't want to set a value for this reducer, " + "you can use null instead of undefined.");
825    }
826
827    if (typeof reducer(undefined, {
828      type: ActionTypes.PROBE_UNKNOWN_ACTION()
829    }) === 'undefined') {
830      throw new Error("Reducer \"" + key + "\" returned undefined when probed with a random type. " + ("Don't try to handle " + ActionTypes.INIT + " or other actions in \"redux/*\" ") + "namespace. They are considered private. Instead, you must return the " + "current state for any unknown actions, unless it is undefined, " + "in which case you must return the initial state, regardless of the " + "action type. The initial state may not be undefined, but can be null.");
831    }
832  });
833}
834/**
835 * Turns an object whose values are different reducer functions, into a single
836 * reducer function. It will call every child reducer, and gather their results
837 * into a single state object, whose keys correspond to the keys of the passed
838 * reducer functions.
839 *
840 * @param {Object} reducers An object whose values correspond to different
841 * reducer functions that need to be combined into one. One handy way to obtain
842 * it is to use ES6 `import * as reducers` syntax. The reducers may never return
843 * undefined for any action. Instead, they should return their initial state
844 * if the state passed to them was undefined, and the current state for any
845 * unrecognized action.
846 *
847 * @returns {Function} A reducer function that invokes every reducer inside the
848 * passed object, and builds a state object with the same shape.
849 */
850
851
852function combineReducers(reducers) {
853  var reducerKeys = Object.keys(reducers);
854  var finalReducers = {};
855
856  for (var i = 0; i < reducerKeys.length; i++) {
857    var key = reducerKeys[i];
858
859    if (false) {}
860
861    if (typeof reducers[key] === 'function') {
862      finalReducers[key] = reducers[key];
863    }
864  }
865
866  var finalReducerKeys = Object.keys(finalReducers); // This is used to make sure we don't warn about the same
867  // keys multiple times.
868
869  var unexpectedKeyCache;
870
871  if (false) {}
872
873  var shapeAssertionError;
874
875  try {
876    assertReducerShape(finalReducers);
877  } catch (e) {
878    shapeAssertionError = e;
879  }
880
881  return function combination(state, action) {
882    if (state === void 0) {
883      state = {};
884    }
885
886    if (shapeAssertionError) {
887      throw shapeAssertionError;
888    }
889
890    if (false) { var warningMessage; }
891
892    var hasChanged = false;
893    var nextState = {};
894
895    for (var _i = 0; _i < finalReducerKeys.length; _i++) {
896      var _key = finalReducerKeys[_i];
897      var reducer = finalReducers[_key];
898      var previousStateForKey = state[_key];
899      var nextStateForKey = reducer(previousStateForKey, action);
900
901      if (typeof nextStateForKey === 'undefined') {
902        var errorMessage = getUndefinedStateErrorMessage(_key, action);
903        throw new Error(errorMessage);
904      }
905
906      nextState[_key] = nextStateForKey;
907      hasChanged = hasChanged || nextStateForKey !== previousStateForKey;
908    }
909
910    return hasChanged ? nextState : state;
911  };
912}
913
914function bindActionCreator(actionCreator, dispatch) {
915  return function () {
916    return dispatch(actionCreator.apply(this, arguments));
917  };
918}
919/**
920 * Turns an object whose values are action creators, into an object with the
921 * same keys, but with every function wrapped into a `dispatch` call so they
922 * may be invoked directly. This is just a convenience method, as you can call
923 * `store.dispatch(MyActionCreators.doSomething())` yourself just fine.
924 *
925 * For convenience, you can also pass an action creator as the first argument,
926 * and get a dispatch wrapped function in return.
927 *
928 * @param {Function|Object} actionCreators An object whose values are action
929 * creator functions. One handy way to obtain it is to use ES6 `import * as`
930 * syntax. You may also pass a single function.
931 *
932 * @param {Function} dispatch The `dispatch` function available on your Redux
933 * store.
934 *
935 * @returns {Function|Object} The object mimicking the original object, but with
936 * every action creator wrapped into the `dispatch` call. If you passed a
937 * function as `actionCreators`, the return value will also be a single
938 * function.
939 */
940
941
942function bindActionCreators(actionCreators, dispatch) {
943  if (typeof actionCreators === 'function') {
944    return bindActionCreator(actionCreators, dispatch);
945  }
946
947  if (typeof actionCreators !== 'object' || actionCreators === null) {
948    throw new Error("bindActionCreators expected an object or a function, instead received " + (actionCreators === null ? 'null' : typeof actionCreators) + ". " + "Did you write \"import ActionCreators from\" instead of \"import * as ActionCreators from\"?");
949  }
950
951  var boundActionCreators = {};
952
953  for (var key in actionCreators) {
954    var actionCreator = actionCreators[key];
955
956    if (typeof actionCreator === 'function') {
957      boundActionCreators[key] = bindActionCreator(actionCreator, dispatch);
958    }
959  }
960
961  return boundActionCreators;
962}
963
964function _defineProperty(obj, key, value) {
965  if (key in obj) {
966    Object.defineProperty(obj, key, {
967      value: value,
968      enumerable: true,
969      configurable: true,
970      writable: true
971    });
972  } else {
973    obj[key] = value;
974  }
975
976  return obj;
977}
978
979function ownKeys(object, enumerableOnly) {
980  var keys = Object.keys(object);
981
982  if (Object.getOwnPropertySymbols) {
983    keys.push.apply(keys, Object.getOwnPropertySymbols(object));
984  }
985
986  if (enumerableOnly) keys = keys.filter(function (sym) {
987    return Object.getOwnPropertyDescriptor(object, sym).enumerable;
988  });
989  return keys;
990}
991
992function _objectSpread2(target) {
993  for (var i = 1; i < arguments.length; i++) {
994    var source = arguments[i] != null ? arguments[i] : {};
995
996    if (i % 2) {
997      ownKeys(source, true).forEach(function (key) {
998        _defineProperty(target, key, source[key]);
999      });
1000    } else if (Object.getOwnPropertyDescriptors) {
1001      Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
1002    } else {
1003      ownKeys(source).forEach(function (key) {
1004        Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
1005      });
1006    }
1007  }
1008
1009  return target;
1010}
1011
1012/**
1013 * Composes single-argument functions from right to left. The rightmost
1014 * function can take multiple arguments as it provides the signature for
1015 * the resulting composite function.
1016 *
1017 * @param {...Function} funcs The functions to compose.
1018 * @returns {Function} A function obtained by composing the argument functions
1019 * from right to left. For example, compose(f, g, h) is identical to doing
1020 * (...args) => f(g(h(...args))).
1021 */
1022function compose() {
1023  for (var _len = arguments.length, funcs = new Array(_len), _key = 0; _key < _len; _key++) {
1024    funcs[_key] = arguments[_key];
1025  }
1026
1027  if (funcs.length === 0) {
1028    return function (arg) {
1029      return arg;
1030    };
1031  }
1032
1033  if (funcs.length === 1) {
1034    return funcs[0];
1035  }
1036
1037  return funcs.reduce(function (a, b) {
1038    return function () {
1039      return a(b.apply(void 0, arguments));
1040    };
1041  });
1042}
1043
1044/**
1045 * Creates a store enhancer that applies middleware to the dispatch method
1046 * of the Redux store. This is handy for a variety of tasks, such as expressing
1047 * asynchronous actions in a concise manner, or logging every action payload.
1048 *
1049 * See `redux-thunk` package as an example of the Redux middleware.
1050 *
1051 * Because middleware is potentially asynchronous, this should be the first
1052 * store enhancer in the composition chain.
1053 *
1054 * Note that each middleware will be given the `dispatch` and `getState` functions
1055 * as named arguments.
1056 *
1057 * @param {...Function} middlewares The middleware chain to be applied.
1058 * @returns {Function} A store enhancer applying the middleware.
1059 */
1060
1061function applyMiddleware() {
1062  for (var _len = arguments.length, middlewares = new Array(_len), _key = 0; _key < _len; _key++) {
1063    middlewares[_key] = arguments[_key];
1064  }
1065
1066  return function (createStore) {
1067    return function () {
1068      var store = createStore.apply(void 0, arguments);
1069
1070      var _dispatch = function dispatch() {
1071        throw new Error('Dispatching while constructing your middleware is not allowed. ' + 'Other middleware would not be applied to this dispatch.');
1072      };
1073
1074      var middlewareAPI = {
1075        getState: store.getState,
1076        dispatch: function dispatch() {
1077          return _dispatch.apply(void 0, arguments);
1078        }
1079      };
1080      var chain = middlewares.map(function (middleware) {
1081        return middleware(middlewareAPI);
1082      });
1083      _dispatch = compose.apply(void 0, chain)(store.dispatch);
1084      return _objectSpread2({}, store, {
1085        dispatch: _dispatch
1086      });
1087    };
1088  };
1089}
1090
1091/*
1092 * This is a dummy function to check if the function name has been altered by minification.
1093 * If the function has been minified and NODE_ENV !== 'production', warn the user.
1094 */
1095
1096function isCrushed() {}
1097
1098if (false) {}
1099
1100
1101
1102
1103/***/ }),
1104/* 4 */
1105/***/ (function(module, exports, __webpack_require__) {
1106
1107"use strict";
1108
1109
1110var __importDefault = this && this.__importDefault || function (mod) {
1111  return mod && mod.__esModule ? mod : {
1112    "default": mod
1113  };
1114};
1115
1116Object.defineProperty(exports, "__esModule", {
1117  value: true
1118});
1119
1120var redux_1 = __webpack_require__(3);
1121
1122var items_1 = __importDefault(__webpack_require__(14));
1123
1124var groups_1 = __importDefault(__webpack_require__(15));
1125
1126var choices_1 = __importDefault(__webpack_require__(16));
1127
1128var loading_1 = __importDefault(__webpack_require__(17));
1129
1130var utils_1 = __webpack_require__(1);
1131
1132exports.defaultState = {
1133  groups: [],
1134  items: [],
1135  choices: [],
1136  loading: false
1137};
1138var appReducer = redux_1.combineReducers({
1139  items: items_1.default,
1140  groups: groups_1.default,
1141  choices: choices_1.default,
1142  loading: loading_1.default
1143});
1144
1145var rootReducer = function rootReducer(passedState, action) {
1146  var state = passedState; // If we are clearing all items, groups and options we reassign
1147  // state and then pass that state to our proper reducer. This isn't
1148  // mutating our actual state
1149  // See: http://stackoverflow.com/a/35641992
1150
1151  if (action.type === 'CLEAR_ALL') {
1152    state = exports.defaultState;
1153  } else if (action.type === 'RESET_TO') {
1154    return utils_1.cloneObject(action.state);
1155  }
1156
1157  return appReducer(state, action);
1158};
1159
1160exports.default = rootReducer;
1161
1162/***/ }),
1163/* 5 */
1164/***/ (function(module, exports, __webpack_require__) {
1165
1166"use strict";
1167
1168
1169Object.defineProperty(exports, "__esModule", {
1170  value: true
1171});
1172
1173var utils_1 = __webpack_require__(1);
1174
1175var WrappedElement =
1176/** @class */
1177function () {
1178  function WrappedElement(_a) {
1179    var element = _a.element,
1180        classNames = _a.classNames;
1181    this.element = element;
1182    this.classNames = classNames;
1183
1184    if (!(element instanceof HTMLInputElement) && !(element instanceof HTMLSelectElement)) {
1185      throw new TypeError('Invalid element passed');
1186    }
1187
1188    this.isDisabled = false;
1189  }
1190
1191  Object.defineProperty(WrappedElement.prototype, "isActive", {
1192    get: function get() {
1193      return this.element.dataset.choice === 'active';
1194    },
1195    enumerable: true,
1196    configurable: true
1197  });
1198  Object.defineProperty(WrappedElement.prototype, "dir", {
1199    get: function get() {
1200      return this.element.dir;
1201    },
1202    enumerable: true,
1203    configurable: true
1204  });
1205  Object.defineProperty(WrappedElement.prototype, "value", {
1206    get: function get() {
1207      return this.element.value;
1208    },
1209    set: function set(value) {
1210      // you must define setter here otherwise it will be readonly property
1211      this.element.value = value;
1212    },
1213    enumerable: true,
1214    configurable: true
1215  });
1216
1217  WrappedElement.prototype.conceal = function () {
1218    // Hide passed input
1219    this.element.classList.add(this.classNames.input);
1220    this.element.hidden = true; // Remove element from tab index
1221
1222    this.element.tabIndex = -1; // Backup original styles if any
1223
1224    var origStyle = this.element.getAttribute('style');
1225
1226    if (origStyle) {
1227      this.element.setAttribute('data-choice-orig-style', origStyle);
1228    }
1229
1230    this.element.setAttribute('data-choice', 'active');
1231  };
1232
1233  WrappedElement.prototype.reveal = function () {
1234    // Reinstate passed element
1235    this.element.classList.remove(this.classNames.input);
1236    this.element.hidden = false;
1237    this.element.removeAttribute('tabindex'); // Recover original styles if any
1238
1239    var origStyle = this.element.getAttribute('data-choice-orig-style');
1240
1241    if (origStyle) {
1242      this.element.removeAttribute('data-choice-orig-style');
1243      this.element.setAttribute('style', origStyle);
1244    } else {
1245      this.element.removeAttribute('style');
1246    }
1247
1248    this.element.removeAttribute('data-choice'); // Re-assign values - this is weird, I know
1249    // @todo Figure out why we need to do this
1250
1251    this.element.value = this.element.value; // eslint-disable-line no-self-assign
1252  };
1253
1254  WrappedElement.prototype.enable = function () {
1255    this.element.removeAttribute('disabled');
1256    this.element.disabled = false;
1257    this.isDisabled = false;
1258  };
1259
1260  WrappedElement.prototype.disable = function () {
1261    this.element.setAttribute('disabled', '');
1262    this.element.disabled = true;
1263    this.isDisabled = true;
1264  };
1265
1266  WrappedElement.prototype.triggerEvent = function (eventType, data) {
1267    utils_1.dispatchEvent(this.element, eventType, data);
1268  };
1269
1270  return WrappedElement;
1271}();
1272
1273exports.default = WrappedElement;
1274
1275/***/ }),
1276/* 6 */
1277/***/ (function(module, __webpack_exports__, __webpack_require__) {
1278
1279"use strict";
1280/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return symbolObservablePonyfill; });
1281function symbolObservablePonyfill(root) {
1282	var result;
1283	var Symbol = root.Symbol;
1284
1285	if (typeof Symbol === 'function') {
1286		if (Symbol.observable) {
1287			result = Symbol.observable;
1288		} else {
1289			result = Symbol('observable');
1290			Symbol.observable = result;
1291		}
1292	} else {
1293		result = '@@observable';
1294	}
1295
1296	return result;
1297};
1298
1299
1300/***/ }),
1301/* 7 */
1302/***/ (function(module, exports, __webpack_require__) {
1303
1304module.exports = __webpack_require__(8);
1305
1306
1307/***/ }),
1308/* 8 */
1309/***/ (function(module, exports, __webpack_require__) {
1310
1311"use strict";
1312
1313
1314var __spreadArrays = this && this.__spreadArrays || function () {
1315  for (var s = 0, i = 0, il = arguments.length; i < il; i++) {
1316    s += arguments[i].length;
1317  }
1318
1319  for (var r = Array(s), k = 0, i = 0; i < il; i++) {
1320    for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) {
1321      r[k] = a[j];
1322    }
1323  }
1324
1325  return r;
1326};
1327
1328var __importDefault = this && this.__importDefault || function (mod) {
1329  return mod && mod.__esModule ? mod : {
1330    "default": mod
1331  };
1332};
1333
1334Object.defineProperty(exports, "__esModule", {
1335  value: true
1336});
1337/* eslint-disable @typescript-eslint/no-explicit-any */
1338
1339var fuse_js_1 = __importDefault(__webpack_require__(9));
1340
1341var deepmerge_1 = __importDefault(__webpack_require__(10));
1342
1343var store_1 = __importDefault(__webpack_require__(11));
1344
1345var components_1 = __webpack_require__(18);
1346
1347var constants_1 = __webpack_require__(0);
1348
1349var templates_1 = __importDefault(__webpack_require__(25));
1350
1351var choices_1 = __webpack_require__(26);
1352
1353var items_1 = __webpack_require__(27);
1354
1355var groups_1 = __webpack_require__(28);
1356
1357var misc_1 = __webpack_require__(29);
1358
1359var utils_1 = __webpack_require__(1);
1360
1361var reducers_1 = __webpack_require__(4);
1362/** @see {@link http://browserhacks.com/#hack-acea075d0ac6954f275a70023906050c} */
1363
1364
1365var IS_IE11 = '-ms-scroll-limit' in document.documentElement.style && '-ms-ime-align' in document.documentElement.style;
1366var USER_DEFAULTS = {};
1367/**
1368 * Choices
1369 * @author Josh Johnson<[email protected]>
1370 */
1371
1372var Choices =
1373/** @class */
1374function () {
1375  function Choices(element, userConfig) {
1376    var _this = this;
1377
1378    if (element === void 0) {
1379      element = '[data-choice]';
1380    }
1381
1382    if (userConfig === void 0) {
1383      userConfig = {};
1384    }
1385
1386    this.config = deepmerge_1.default.all([constants_1.DEFAULT_CONFIG, Choices.defaults.options, userConfig], // When merging array configs, replace with a copy of the userConfig array,
1387    // instead of concatenating with the default array
1388    {
1389      arrayMerge: function arrayMerge(_, sourceArray) {
1390        return __spreadArrays(sourceArray);
1391      }
1392    });
1393    var invalidConfigOptions = utils_1.diff(this.config, constants_1.DEFAULT_CONFIG);
1394
1395    if (invalidConfigOptions.length) {
1396      console.warn('Unknown config option(s) passed', invalidConfigOptions.join(', '));
1397    }
1398
1399    var passedElement = typeof element === 'string' ? document.querySelector(element) : element;
1400
1401    if (!(passedElement instanceof HTMLInputElement || passedElement instanceof HTMLSelectElement)) {
1402      throw TypeError('Expected one of the following types text|select-one|select-multiple');
1403    }
1404
1405    this._isTextElement = passedElement.type === constants_1.TEXT_TYPE;
1406    this._isSelectOneElement = passedElement.type === constants_1.SELECT_ONE_TYPE;
1407    this._isSelectMultipleElement = passedElement.type === constants_1.SELECT_MULTIPLE_TYPE;
1408    this._isSelectElement = this._isSelectOneElement || this._isSelectMultipleElement;
1409    this.config.searchEnabled = this._isSelectMultipleElement || this.config.searchEnabled;
1410
1411    if (!['auto', 'always'].includes("" + this.config.renderSelectedChoices)) {
1412      this.config.renderSelectedChoices = 'auto';
1413    }
1414
1415    if (userConfig.addItemFilter && typeof userConfig.addItemFilter !== 'function') {
1416      var re = userConfig.addItemFilter instanceof RegExp ? userConfig.addItemFilter : new RegExp(userConfig.addItemFilter);
1417      this.config.addItemFilter = re.test.bind(re);
1418    }
1419
1420    if (this._isTextElement) {
1421      this.passedElement = new components_1.WrappedInput({
1422        element: passedElement,
1423        classNames: this.config.classNames,
1424        delimiter: this.config.delimiter
1425      });
1426    } else {
1427      this.passedElement = new components_1.WrappedSelect({
1428        element: passedElement,
1429        classNames: this.config.classNames,
1430        template: function template(data) {
1431          return _this._templates.option(data);
1432        }
1433      });
1434    }
1435
1436    this.initialised = false;
1437    this._store = new store_1.default();
1438    this._initialState = reducers_1.defaultState;
1439    this._currentState = reducers_1.defaultState;
1440    this._prevState = reducers_1.defaultState;
1441    this._currentValue = '';
1442    this._canSearch = !!this.config.searchEnabled;
1443    this._isScrollingOnIe = false;
vendor: 11,745 bytes, lines 1444-1884
1444    this._highlightPosition = 0;
1445    this._wasTap = true;
1446    this._placeholderValue = this._generatePlaceholderValue();
1447    this._baseId = utils_1.generateId(this.passedElement.element, 'choices-');
1448    /**
1449     * setting direction in cases where it's explicitly set on passedElement
1450     * or when calculated direction is different from the document
1451     */
1452
1453    this._direction = this.passedElement.dir;
1454
1455    if (!this._direction) {
1456      var elementDirection = window.getComputedStyle(this.passedElement.element).direction;
1457      var documentDirection = window.getComputedStyle(document.documentElement).direction;
1458
1459      if (elementDirection !== documentDirection) {
1460        this._direction = elementDirection;
1461      }
1462    }
1463
1464    this._idNames = {
1465      itemChoice: 'item-choice'
1466    };
1467
1468    if (this._isSelectElement) {
1469      // Assign preset groups from passed element
1470      this._presetGroups = this.passedElement.optionGroups; // Assign preset options from passed element
1471
1472      this._presetOptions = this.passedElement.options;
1473    } // Assign preset choices from passed object
1474
1475
1476    this._presetChoices = this.config.choices; // Assign preset items from passed object first
1477
1478    this._presetItems = this.config.items; // Add any values passed from attribute
1479
1480    if (this.passedElement.value && this._isTextElement) {
1481      var splitValues = this.passedElement.value.split(this.config.delimiter);
1482      this._presetItems = this._presetItems.concat(splitValues);
1483    } // Create array of choices from option elements
1484
1485
1486    if (this.passedElement.options) {
1487      this.passedElement.options.forEach(function (option) {
1488        _this._presetChoices.push({
1489          value: option.value,
1490          label: option.innerHTML,
1491          selected: !!option.selected,
1492          disabled: option.disabled || option.parentNode.disabled,
1493          placeholder: option.value === '' || option.hasAttribute('placeholder'),
1494          customProperties: option.dataset['custom-properties']
1495        });
1496      });
1497    }
1498
1499    this._render = this._render.bind(this);
1500    this._onFocus = this._onFocus.bind(this);
1501    this._onBlur = this._onBlur.bind(this);
1502    this._onKeyUp = this._onKeyUp.bind(this);
1503    this._onKeyDown = this._onKeyDown.bind(this);
1504    this._onClick = this._onClick.bind(this);
1505    this._onTouchMove = this._onTouchMove.bind(this);
1506    this._onTouchEnd = this._onTouchEnd.bind(this);
1507    this._onMouseDown = this._onMouseDown.bind(this);
1508    this._onMouseOver = this._onMouseOver.bind(this);
1509    this._onFormReset = this._onFormReset.bind(this);
1510    this._onSelectKey = this._onSelectKey.bind(this);
1511    this._onEnterKey = this._onEnterKey.bind(this);
1512    this._onEscapeKey = this._onEscapeKey.bind(this);
1513    this._onDirectionKey = this._onDirectionKey.bind(this);
1514    this._onDeleteKey = this._onDeleteKey.bind(this); // If element has already been initialised with Choices, fail silently
1515
1516    if (this.passedElement.isActive) {
1517      if (!this.config.silent) {
1518        console.warn('Trying to initialise Choices on element already initialised', {
1519          element: element
1520        });
1521      }
1522
1523      this.initialised = true;
1524      return;
1525    } // Let's go
1526
1527
1528    this.init();
1529  }
1530
1531  Object.defineProperty(Choices, "defaults", {
1532    get: function get() {
1533      return Object.preventExtensions({
1534        get options() {
1535          return USER_DEFAULTS;
1536        },
1537
1538        get templates() {
1539          return templates_1.default;
1540        }
1541
1542      });
1543    },
1544    enumerable: true,
1545    configurable: true
1546  });
1547
1548  Choices.prototype.init = function () {
1549    if (this.initialised) {
1550      return;
1551    }
1552
1553    this._createTemplates();
1554
1555    this._createElements();
1556
1557    this._createStructure();
1558
1559    this._store.subscribe(this._render);
1560
1561    this._render();
1562
1563    this._addEventListeners();
1564
1565    var shouldDisable = !this.config.addItems || this.passedElement.element.hasAttribute('disabled');
1566
1567    if (shouldDisable) {
1568      this.disable();
1569    }
1570
1571    this.initialised = true;
1572    var callbackOnInit = this.config.callbackOnInit; // Run callback if it is a function
1573
1574    if (callbackOnInit && typeof callbackOnInit === 'function') {
1575      callbackOnInit.call(this);
1576    }
1577  };
1578
1579  Choices.prototype.destroy = function () {
1580    if (!this.initialised) {
1581      return;
1582    }
1583
1584    this._removeEventListeners();
1585
1586    this.passedElement.reveal();
1587    this.containerOuter.unwrap(this.passedElement.element);
1588    this.clearStore();
1589
1590    if (this._isSelectElement) {
1591      this.passedElement.options = this._presetOptions;
1592    }
1593
1594    this._templates = templates_1.default;
1595    this.initialised = false;
1596  };
1597
1598  Choices.prototype.enable = function () {
1599    if (this.passedElement.isDisabled) {
1600      this.passedElement.enable();
1601    }
1602
1603    if (this.containerOuter.isDisabled) {
1604      this._addEventListeners();
1605
1606      this.input.enable();
1607      this.containerOuter.enable();
1608    }
1609
1610    return this;
1611  };
1612
1613  Choices.prototype.disable = function () {
1614    if (!this.passedElement.isDisabled) {
1615      this.passedElement.disable();
1616    }
1617
1618    if (!this.containerOuter.isDisabled) {
1619      this._removeEventListeners();
1620
1621      this.input.disable();
1622      this.containerOuter.disable();
1623    }
1624
1625    return this;
1626  };
1627
1628  Choices.prototype.highlightItem = function (item, runEvent) {
1629    if (runEvent === void 0) {
1630      runEvent = true;
1631    }
1632
1633    if (!item || !item.id) {
1634      return this;
1635    }
1636
1637    var id = item.id,
1638        _a = item.groupId,
1639        groupId = _a === void 0 ? -1 : _a,
1640        _b = item.value,
1641        value = _b === void 0 ? '' : _b,
1642        _c = item.label,
1643        label = _c === void 0 ? '' : _c;
1644    var group = groupId >= 0 ? this._store.getGroupById(groupId) : null;
1645
1646    this._store.dispatch(items_1.highlightItem(id, true));
1647
1648    if (runEvent) {
1649      this.passedElement.triggerEvent(constants_1.EVENTS.highlightItem, {
1650        id: id,
1651        value: value,
1652        label: label,
1653        groupValue: group && group.value ? group.value : null
1654      });
1655    }
1656
1657    return this;
1658  };
1659
1660  Choices.prototype.unhighlightItem = function (item) {
1661    if (!item || !item.id) {
1662      return this;
1663    }
1664
1665    var id = item.id,
1666        _a = item.groupId,
1667        groupId = _a === void 0 ? -1 : _a,
1668        _b = item.value,
1669        value = _b === void 0 ? '' : _b,
1670        _c = item.label,
1671        label = _c === void 0 ? '' : _c;
1672    var group = groupId >= 0 ? this._store.getGroupById(groupId) : null;
1673
1674    this._store.dispatch(items_1.highlightItem(id, false));
1675
1676    this.passedElement.triggerEvent(constants_1.EVENTS.highlightItem, {
1677      id: id,
1678      value: value,
1679      label: label,
1680      groupValue: group && group.value ? group.value : null
1681    });
1682    return this;
1683  };
1684
1685  Choices.prototype.highlightAll = function () {
1686    var _this = this;
1687
1688    this._store.items.forEach(function (item) {
1689      return _this.highlightItem(item);
1690    });
1691
1692    return this;
1693  };
1694
1695  Choices.prototype.unhighlightAll = function () {
1696    var _this = this;
1697
1698    this._store.items.forEach(function (item) {
1699      return _this.unhighlightItem(item);
1700    });
1701
1702    return this;
1703  };
1704
1705  Choices.prototype.removeActiveItemsByValue = function (value) {
1706    var _this = this;
1707
1708    this._store.activeItems.filter(function (item) {
1709      return item.value === value;
1710    }).forEach(function (item) {
1711      return _this._removeItem(item);
1712    });
1713
1714    return this;
1715  };
1716
1717  Choices.prototype.removeActiveItems = function (excludedId) {
1718    var _this = this;
1719
1720    this._store.activeItems.filter(function (_a) {
1721      var id = _a.id;
1722      return id !== excludedId;
1723    }).forEach(function (item) {
1724      return _this._removeItem(item);
1725    });
1726
1727    return this;
1728  };
1729
1730  Choices.prototype.removeHighlightedItems = function (runEvent) {
1731    var _this = this;
1732
1733    if (runEvent === void 0) {
1734      runEvent = false;
1735    }
1736
1737    this._store.highlightedActiveItems.forEach(function (item) {
1738      _this._removeItem(item); // If this action was performed by the user
1739      // trigger the event
1740
1741
1742      if (runEvent) {
1743        _this._triggerChange(item.value);
1744      }
1745    });
1746
1747    return this;
1748  };
1749
1750  Choices.prototype.showDropdown = function (preventInputFocus) {
1751    var _this = this;
1752
1753    if (this.dropdown.isActive) {
1754      return this;
1755    }
1756
1757    requestAnimationFrame(function () {
1758      _this.dropdown.show();
1759
1760      _this.containerOuter.open(_this.dropdown.distanceFromTopWindow);
1761
1762      if (!preventInputFocus && _this._canSearch) {
1763        _this.input.focus();
1764      }
1765
1766      _this.passedElement.triggerEvent(constants_1.EVENTS.showDropdown, {});
1767    });
1768    return this;
1769  };
1770
1771  Choices.prototype.hideDropdown = function (preventInputBlur) {
1772    var _this = this;
1773
1774    if (!this.dropdown.isActive) {
1775      return this;
1776    }
1777
1778    requestAnimationFrame(function () {
1779      _this.dropdown.hide();
1780
1781      _this.containerOuter.close();
1782
1783      if (!preventInputBlur && _this._canSearch) {
1784        _this.input.removeActiveDescendant();
1785
1786        _this.input.blur();
1787      }
1788
1789      _this.passedElement.triggerEvent(constants_1.EVENTS.hideDropdown, {});
1790    });
1791    return this;
1792  };
1793
1794  Choices.prototype.getValue = function (valueOnly) {
1795    if (valueOnly === void 0) {
1796      valueOnly = false;
1797    }
1798
1799    var values = this._store.activeItems.reduce(function (selectedItems, item) {
1800      var itemValue = valueOnly ? item.value : item;
1801      selectedItems.push(itemValue);
1802      return selectedItems;
1803    }, []);
1804
1805    return this._isSelectOneElement ? values[0] : values;
1806  };
1807
1808  Choices.prototype.setValue = function (items) {
1809    var _this = this;
1810
1811    if (!this.initialised) {
1812      return this;
1813    }
1814
1815    items.forEach(function (value) {
1816      return _this._setChoiceOrItem(value);
1817    });
1818    return this;
1819  };
1820
1821  Choices.prototype.setChoiceByValue = function (value) {
1822    var _this = this;
1823
1824    if (!this.initialised || this._isTextElement) {
1825      return this;
1826    } // If only one value has been passed, convert to array
1827
1828
1829    var choiceValue = Array.isArray(value) ? value : [value]; // Loop through each value and
1830
1831    choiceValue.forEach(function (val) {
1832      return _this._findAndSelectChoiceByValue(val);
1833    });
1834    return this;
1835  };
1836  /**
1837   * Set choices of select input via an array of objects (or function that returns array of object or promise of it),
1838   * a value field name and a label field name.
1839   * This behaves the same as passing items via the choices option but can be called after initialising Choices.
1840   * This can also be used to add groups of choices (see example 2); Optionally pass a true `replaceChoices` value to remove any existing choices.
1841   * Optionally pass a `customProperties` object to add additional data to your choices (useful when searching/filtering etc).
1842   *
1843   * **Input types affected:** select-one, select-multiple
1844   *
1845   * @example
1846   * ```js
1847   * const example = new Choices(element);
1848   *
1849   * example.setChoices([
1850   *   {value: 'One', label: 'Label One', disabled: true},
1851   *   {value: 'Two', label: 'Label Two', selected: true},
1852   *   {value: 'Three', label: 'Label Three'},
1853   * ], 'value', 'label', false);
1854   * ```
1855   *
1856   * @example
1857   * ```js
1858   * const example = new Choices(element);
1859   *
1860   * example.setChoices(async () => {
1861   *   try {
1862   *      const items = await fetch('/items');
1863   *      return items.json()
1864   *   } catch(err) {
1865   *      console.error(err)
1866   *   }
1867   * });
1868   * ```
1869   *
1870   * @example
1871   * ```js
1872   * const example = new Choices(element);
1873   *
1874   * example.setChoices([{
1875   *   label: 'Group one',
1876   *   id: 1,
1877   *   disabled: false,
1878   *   choices: [
1879   *     {value: 'Child One', label: 'Child One', selected: true},
1880   *     {value: 'Child Two', label: 'Child Two',  disabled: true},
1881   *     {value: 'Child Three', label: 'Child Three'},
1882   *   ]
1883   * },
1884   * {
1885   *   label: 'Group two',
1886   *   id: 2,
1887   *   disabled: false,
1888   *   choices: [
1889   *     {value: 'Child Four', label: 'Child Four', disabled: true},
1890   *     {value: 'Child Five', label: 'Child Five'},
1891   *     {value: 'Child Six', label: 'Child Six', customProperties: {
1892   *       description: 'Custom description about child six',
1893   *       random: 'Another random custom property'
1894   *     }},
1895   *   ]
1896   * }], 'value', 'label', false);
1897   * ```
1898   */
1899
1900
1901  Choices.prototype.setChoices = function (choicesArrayOrFetcher, value, label, replaceChoices) {
1902    var _this = this;
1903
1904    if (choicesArrayOrFetcher === void 0) {
1905      choicesArrayOrFetcher = [];
1906    }
1907
1908    if (value === void 0) {
1909      value = 'value';
1910    }
1911
1912    if (label === void 0) {
1913      label = 'label';
1914    }
1915
1916    if (replaceChoices === void 0) {
1917      replaceChoices = false;
1918    }
1919
1920    if (!this.initialised) {
1921      throw new ReferenceError("setChoices was called on a non-initialized instance of Choices");
1922    }
1923
1924    if (!this._isSelectElement) {
1925      throw new TypeError("setChoices can't be used with INPUT based Choices");
1926    }
1927
1928    if (typeof value !== 'string' || !value) {
1929      throw new TypeError("value parameter must be a name of 'value' field in passed objects");
1930    } // Clear choices if needed
1931
1932
1933    if (replaceChoices) {
1934      this.clearChoices();
1935    }
1936
1937    if (typeof choicesArrayOrFetcher === 'function') {
1938      // it's a choices fetcher function
1939      var fetcher_1 = choicesArrayOrFetcher(this);
1940
1941      if (typeof Promise === 'function' && fetcher_1 instanceof Promise) {
1942        // that's a promise
1943        // eslint-disable-next-line compat/compat
1944        return new Promise(function (resolve) {
1945          return requestAnimationFrame(resolve);
1946        }) // eslint-disable-line compat/compat
1947        .then(function () {
1948          return _this._handleLoadingState(true);
1949        }).then(function () {
1950          return fetcher_1;
1951        }).then(function (data) {
1952          return _this.setChoices(data, value, label, replaceChoices);
1953        }).catch(function (err) {
1954          if (!_this.config.silent) {
1955            console.error(err);
1956          }
1957        }).then(function () {
1958          return _this._handleLoadingState(false);
1959        }).then(function () {
1960          return _this;
1961        });
1962      } // function returned something else than promise, let's check if it's an array of choices
1963
1964
1965      if (!Array.isArray(fetcher_1)) {
1966        throw new TypeError(".setChoices first argument function must return either array of choices or Promise, got: " + typeof fetcher_1);
1967      } // recursion with results, it's sync and choices were cleared already
1968
1969
1970      return this.setChoices(fetcher_1, value, label, false);
1971    }
1972
1973    if (!Array.isArray(choicesArrayOrFetcher)) {
1974      throw new TypeError(".setChoices must be called either with array of choices with a function resulting into Promise of array of choices");
1975    }
1976
1977    this.containerOuter.removeLoadingState();
1978
1979    this._startLoading();
1980
1981    choicesArrayOrFetcher.forEach(function (groupOrChoice) {
1982      if (groupOrChoice.choices) {
1983        _this._addGroup({
1984          id: groupOrChoice.id ? parseInt("" + groupOrChoice.id, 10) : null,
1985          group: groupOrChoice,
1986          valueKey: value,
1987          labelKey: label
1988        });
1989      } else {
1990        var choice = groupOrChoice;
1991
1992        _this._addChoice({
1993          value: choice[value],
1994          label: choice[label],
1995          isSelected: !!choice.selected,
1996          isDisabled: !!choice.disabled,
1997          placeholder: !!choice.placeholder,
1998          customProperties: choice.customProperties
1999        });
2000      }
2001    });
2002
2003    this._stopLoading();
2004
2005    return this;
2006  };
2007
2008  Choices.prototype.clearChoices = function () {
2009    this._store.dispatch(choices_1.clearChoices());
2010
2011    return this;
2012  };
2013
2014  Choices.prototype.clearStore = function () {
2015    this._store.dispatch(misc_1.clearAll());
2016
2017    return this;
2018  };
2019
2020  Choices.prototype.clearInput = function () {
2021    var shouldSetInputWidth = !this._isSelectOneElement;
2022    this.input.clear(shouldSetInputWidth);
2023
2024    if (!this._isTextElement && this._canSearch) {
2025      this._isSearching = false;
vendor: 37,813 bytes, lines 2026-3210
2026
2027      this._store.dispatch(choices_1.activateChoices(true));
2028    }
2029
2030    return this;
2031  };
2032
2033  Choices.prototype._render = function () {
2034    if (this._store.isLoading()) {
2035      return;
2036    }
2037
2038    this._currentState = this._store.state;
2039    var stateChanged = this._currentState.choices !== this._prevState.choices || this._currentState.groups !== this._prevState.groups || this._currentState.items !== this._prevState.items;
2040    var shouldRenderChoices = this._isSelectElement;
2041    var shouldRenderItems = this._currentState.items !== this._prevState.items;
2042
2043    if (!stateChanged) {
2044      return;
2045    }
2046
2047    if (shouldRenderChoices) {
2048      this._renderChoices();
2049    }
2050
2051    if (shouldRenderItems) {
2052      this._renderItems();
2053    }
2054
2055    this._prevState = this._currentState;
2056  };
2057
2058  Choices.prototype._renderChoices = function () {
2059    var _this = this;
2060
2061    var _a = this._store,
2062        activeGroups = _a.activeGroups,
2063        activeChoices = _a.activeChoices;
2064    var choiceListFragment = document.createDocumentFragment();
2065    this.choiceList.clear();
2066
2067    if (this.config.resetScrollPosition) {
2068      requestAnimationFrame(function () {
2069        return _this.choiceList.scrollToTop();
2070      });
2071    } // If we have grouped options
2072
2073
2074    if (activeGroups.length >= 1 && !this._isSearching) {
2075      // If we have a placeholder choice along with groups
2076      var activePlaceholders = activeChoices.filter(function (activeChoice) {
2077        return activeChoice.placeholder === true && activeChoice.groupId === -1;
2078      });
2079
2080      if (activePlaceholders.length >= 1) {
2081        choiceListFragment = this._createChoicesFragment(activePlaceholders, choiceListFragment);
2082      }
2083
2084      choiceListFragment = this._createGroupsFragment(activeGroups, activeChoices, choiceListFragment);
2085    } else if (activeChoices.length >= 1) {
2086      choiceListFragment = this._createChoicesFragment(activeChoices, choiceListFragment);
2087    } // If we have choices to show
2088
2089
2090    if (choiceListFragment.childNodes && choiceListFragment.childNodes.length > 0) {
2091      var activeItems = this._store.activeItems;
2092
2093      var canAddItem = this._canAddItem(activeItems, this.input.value); // ...and we can select them
2094
2095
2096      if (canAddItem.response) {
2097        // ...append them and highlight the first choice
2098        this.choiceList.append(choiceListFragment);
2099
2100        this._highlightChoice();
2101      } else {
2102        var notice = this._getTemplate('notice', canAddItem.notice);
2103
2104        this.choiceList.append(notice);
2105      }
2106    } else {
2107      // Otherwise show a notice
2108      var dropdownItem = void 0;
2109      var notice = void 0;
2110
2111      if (this._isSearching) {
2112        notice = typeof this.config.noResultsText === 'function' ? this.config.noResultsText() : this.config.noResultsText;
2113        dropdownItem = this._getTemplate('notice', notice, 'no-results');
2114      } else {
2115        notice = typeof this.config.noChoicesText === 'function' ? this.config.noChoicesText() : this.config.noChoicesText;
2116        dropdownItem = this._getTemplate('notice', notice, 'no-choices');
2117      }
2118
2119      this.choiceList.append(dropdownItem);
2120    }
2121  };
2122
2123  Choices.prototype._renderItems = function () {
2124    var activeItems = this._store.activeItems || [];
2125    this.itemList.clear(); // Create a fragment to store our list items
2126    // (so we don't have to update the DOM for each item)
2127
2128    var itemListFragment = this._createItemsFragment(activeItems); // If we have items to add, append them
2129
2130
2131    if (itemListFragment.childNodes) {
2132      this.itemList.append(itemListFragment);
2133    }
2134  };
2135
2136  Choices.prototype._createGroupsFragment = function (groups, choices, fragment) {
2137    var _this = this;
2138
2139    if (fragment === void 0) {
2140      fragment = document.createDocumentFragment();
2141    }
2142
2143    var getGroupChoices = function getGroupChoices(group) {
2144      return choices.filter(function (choice) {
2145        if (_this._isSelectOneElement) {
2146          return choice.groupId === group.id;
2147        }
2148
2149        return choice.groupId === group.id && (_this.config.renderSelectedChoices === 'always' || !choice.selected);
2150      });
2151    }; // If sorting is enabled, filter groups
2152
2153
2154    if (this.config.shouldSort) {
2155      groups.sort(this.config.sorter);
2156    }
2157
2158    groups.forEach(function (group) {
2159      var groupChoices = getGroupChoices(group);
2160
2161      if (groupChoices.length >= 1) {
2162        var dropdownGroup = _this._getTemplate('choiceGroup', group);
2163
2164        fragment.appendChild(dropdownGroup);
2165
2166        _this._createChoicesFragment(groupChoices, fragment, true);
2167      }
2168    });
2169    return fragment;
2170  };
2171
2172  Choices.prototype._createChoicesFragment = function (choices, fragment, withinGroup) {
2173    var _this = this;
2174
2175    if (fragment === void 0) {
2176      fragment = document.createDocumentFragment();
2177    }
2178
2179    if (withinGroup === void 0) {
2180      withinGroup = false;
2181    } // Create a fragment to store our list items (so we don't have to update the DOM for each item)
2182
2183
2184    var _a = this.config,
2185        renderSelectedChoices = _a.renderSelectedChoices,
2186        searchResultLimit = _a.searchResultLimit,
2187        renderChoiceLimit = _a.renderChoiceLimit;
2188    var filter = this._isSearching ? utils_1.sortByScore : this.config.sorter;
2189
2190    var appendChoice = function appendChoice(choice) {
2191      var shouldRender = renderSelectedChoices === 'auto' ? _this._isSelectOneElement || !choice.selected : true;
2192
2193      if (shouldRender) {
2194        var dropdownItem = _this._getTemplate('choice', choice, _this.config.itemSelectText);
2195
2196        fragment.appendChild(dropdownItem);
2197      }
2198    };
2199
2200    var rendererableChoices = choices;
2201
2202    if (renderSelectedChoices === 'auto' && !this._isSelectOneElement) {
2203      rendererableChoices = choices.filter(function (choice) {
2204        return !choice.selected;
2205      });
2206    } // Split array into placeholders and "normal" choices
2207
2208
2209    var _b = rendererableChoices.reduce(function (acc, choice) {
2210      if (choice.placeholder) {
2211        acc.placeholderChoices.push(choice);
2212      } else {
2213        acc.normalChoices.push(choice);
2214      }
2215
2216      return acc;
2217    }, {
2218      placeholderChoices: [],
2219      normalChoices: []
2220    }),
2221        placeholderChoices = _b.placeholderChoices,
2222        normalChoices = _b.normalChoices; // If sorting is enabled or the user is searching, filter choices
2223
2224
2225    if (this.config.shouldSort || this._isSearching) {
2226      normalChoices.sort(filter);
2227    }
2228
2229    var choiceLimit = rendererableChoices.length; // Prepend placeholeder
2230
2231    var sortedChoices = this._isSelectOneElement ? __spreadArrays(placeholderChoices, normalChoices) : normalChoices;
2232
2233    if (this._isSearching) {
2234      choiceLimit = searchResultLimit;
2235    } else if (renderChoiceLimit && renderChoiceLimit > 0 && !withinGroup) {
2236      choiceLimit = renderChoiceLimit;
2237    } // Add each choice to dropdown within range
2238
2239
2240    for (var i = 0; i < choiceLimit; i += 1) {
2241      if (sortedChoices[i]) {
2242        appendChoice(sortedChoices[i]);
2243      }
2244    }
2245
2246    return fragment;
2247  };
2248
2249  Choices.prototype._createItemsFragment = function (items, fragment) {
2250    var _this = this;
2251
2252    if (fragment === void 0) {
2253      fragment = document.createDocumentFragment();
2254    } // Create fragment to add elements to
2255
2256
2257    var _a = this.config,
2258        shouldSortItems = _a.shouldSortItems,
2259        sorter = _a.sorter,
2260        removeItemButton = _a.removeItemButton; // If sorting is enabled, filter items
2261
2262    if (shouldSortItems && !this._isSelectOneElement) {
2263      items.sort(sorter);
2264    }
2265
2266    if (this._isTextElement) {
2267      // Update the value of the hidden input
2268      this.passedElement.value = items.map(function (_a) {
2269        var value = _a.value;
2270        return value;
2271      }).join(this.config.delimiter);
2272    } else {
2273      // Update the options of the hidden input
2274      this.passedElement.options = items;
2275    }
2276
2277    var addItemToFragment = function addItemToFragment(item) {
2278      // Create new list element
2279      var listItem = _this._getTemplate('item', item, removeItemButton); // Append it to list
2280
2281
2282      fragment.appendChild(listItem);
2283    }; // Add each list item to list
2284
2285
2286    items.forEach(addItemToFragment);
2287    return fragment;
2288  };
2289
2290  Choices.prototype._triggerChange = function (value) {
2291    if (value === undefined || value === null) {
2292      return;
2293    }
2294
2295    this.passedElement.triggerEvent(constants_1.EVENTS.change, {
2296      value: value
2297    });
2298  };
2299
2300  Choices.prototype._selectPlaceholderChoice = function (placeholderChoice) {
2301    this._addItem({
2302      value: placeholderChoice.value,
2303      label: placeholderChoice.label,
2304      choiceId: placeholderChoice.id,
2305      groupId: placeholderChoice.groupId,
2306      placeholder: placeholderChoice.placeholder
2307    });
2308
2309    this._triggerChange(placeholderChoice.value);
2310  };
2311
2312  Choices.prototype._handleButtonAction = function (activeItems, element) {
2313    if (!activeItems || !element || !this.config.removeItems || !this.config.removeItemButton) {
2314      return;
2315    }
2316
2317    var itemId = element.parentNode && element.parentNode.dataset.id;
2318    var itemToRemove = itemId && activeItems.find(function (item) {
2319      return item.id === parseInt(itemId, 10);
2320    });
2321
2322    if (!itemToRemove) {
2323      return;
2324    } // Remove item associated with button
2325
2326
2327    this._removeItem(itemToRemove);
2328
2329    this._triggerChange(itemToRemove.value);
2330
2331    if (this._isSelectOneElement && this._store.placeholderChoice) {
2332      this._selectPlaceholderChoice(this._store.placeholderChoice);
2333    }
2334  };
2335
2336  Choices.prototype._handleItemAction = function (activeItems, element, hasShiftKey) {
2337    var _this = this;
2338
2339    if (hasShiftKey === void 0) {
2340      hasShiftKey = false;
2341    }
2342
2343    if (!activeItems || !element || !this.config.removeItems || this._isSelectOneElement) {
2344      return;
2345    }
2346
2347    var passedId = element.dataset.id; // We only want to select one item with a click
2348    // so we deselect any items that aren't the target
2349    // unless shift is being pressed
2350
2351    activeItems.forEach(function (item) {
2352      if (item.id === parseInt("" + passedId, 10) && !item.highlighted) {
2353        _this.highlightItem(item);
2354      } else if (!hasShiftKey && item.highlighted) {
2355        _this.unhighlightItem(item);
2356      }
2357    }); // Focus input as without focus, a user cannot do anything with a
2358    // highlighted item
2359
2360    this.input.focus();
2361  };
2362
2363  Choices.prototype._handleChoiceAction = function (activeItems, element) {
2364    if (!activeItems || !element) {
2365      return;
2366    } // If we are clicking on an option
2367
2368
2369    var id = element.dataset.id;
2370
2371    var choice = id && this._store.getChoiceById(id);
2372
2373    if (!choice) {
2374      return;
2375    }
2376
2377    var passedKeyCode = activeItems[0] && activeItems[0].keyCode ? activeItems[0].keyCode : undefined;
2378    var hasActiveDropdown = this.dropdown.isActive; // Update choice keyCode
2379
2380    choice.keyCode = passedKeyCode;
2381    this.passedElement.triggerEvent(constants_1.EVENTS.choice, {
2382      choice: choice
2383    });
2384
2385    if (!choice.selected && !choice.disabled) {
2386      var canAddItem = this._canAddItem(activeItems, choice.value);
2387
2388      if (canAddItem.response) {
2389        this._addItem({
2390          value: choice.value,
2391          label: choice.label,
2392          choiceId: choice.id,
2393          groupId: choice.groupId,
2394          customProperties: choice.customProperties,
2395          placeholder: choice.placeholder,
2396          keyCode: choice.keyCode
2397        });
2398
2399        this._triggerChange(choice.value);
2400      }
2401    }
2402
2403    this.clearInput(); // We want to close the dropdown if we are dealing with a single select box
2404
2405    if (hasActiveDropdown && this._isSelectOneElement) {
2406      this.hideDropdown(true);
2407      this.containerOuter.focus();
2408    }
2409  };
2410
2411  Choices.prototype._handleBackspace = function (activeItems) {
2412    if (!this.config.removeItems || !activeItems) {
2413      return;
2414    }
2415
2416    var lastItem = activeItems[activeItems.length - 1];
2417    var hasHighlightedItems = activeItems.some(function (item) {
2418      return item.highlighted;
2419    }); // If editing the last item is allowed and there are not other selected items,
2420    // we can edit the item value. Otherwise if we can remove items, remove all selected items
2421
2422    if (this.config.editItems && !hasHighlightedItems && lastItem) {
2423      this.input.value = lastItem.value;
2424      this.input.setWidth();
2425
2426      this._removeItem(lastItem);
2427
2428      this._triggerChange(lastItem.value);
2429    } else {
2430      if (!hasHighlightedItems) {
2431        // Highlight last item if none already highlighted
2432        this.highlightItem(lastItem, false);
2433      }
2434
2435      this.removeHighlightedItems(true);
2436    }
2437  };
2438
2439  Choices.prototype._startLoading = function () {
2440    this._store.dispatch(misc_1.setIsLoading(true));
2441  };
2442
2443  Choices.prototype._stopLoading = function () {
2444    this._store.dispatch(misc_1.setIsLoading(false));
2445  };
2446
2447  Choices.prototype._handleLoadingState = function (setLoading) {
2448    if (setLoading === void 0) {
2449      setLoading = true;
2450    }
2451
2452    var placeholderItem = this.itemList.getChild("." + this.config.classNames.placeholder);
2453
2454    if (setLoading) {
2455      this.disable();
2456      this.containerOuter.addLoadingState();
2457
2458      if (this._isSelectOneElement) {
2459        if (!placeholderItem) {
2460          placeholderItem = this._getTemplate('placeholder', this.config.loadingText);
2461
2462          if (placeholderItem) {
2463            this.itemList.append(placeholderItem);
2464          }
2465        } else {
2466          placeholderItem.innerHTML = this.config.loadingText;
2467        }
2468      } else {
2469        this.input.placeholder = this.config.loadingText;
2470      }
2471    } else {
2472      this.enable();
2473      this.containerOuter.removeLoadingState();
2474
2475      if (this._isSelectOneElement) {
2476        if (placeholderItem) {
2477          placeholderItem.innerHTML = this._placeholderValue || '';
2478        }
2479      } else {
2480        this.input.placeholder = this._placeholderValue || '';
2481      }
2482    }
2483  };
2484
2485  Choices.prototype._handleSearch = function (value) {
2486    if (!value || !this.input.isFocussed) {
2487      return;
2488    }
2489
2490    var choices = this._store.choices;
2491    var _a = this.config,
2492        searchFloor = _a.searchFloor,
2493        searchChoices = _a.searchChoices;
2494    var hasUnactiveChoices = choices.some(function (option) {
2495      return !option.active;
2496    }); // Check that we have a value to search and the input was an alphanumeric character
2497
2498    if (value && value.length >= searchFloor) {
2499      var resultCount = searchChoices ? this._searchChoices(value) : 0; // Trigger search event
2500
2501      this.passedElement.triggerEvent(constants_1.EVENTS.search, {
2502        value: value,
2503        resultCount: resultCount
2504      });
2505    } else if (hasUnactiveChoices) {
2506      // Otherwise reset choices to active
2507      this._isSearching = false;
2508
2509      this._store.dispatch(choices_1.activateChoices(true));
2510    }
2511  };
2512
2513  Choices.prototype._canAddItem = function (activeItems, value) {
2514    var canAddItem = true;
2515    var notice = typeof this.config.addItemText === 'function' ? this.config.addItemText(value) : this.config.addItemText;
2516
2517    if (!this._isSelectOneElement) {
2518      var isDuplicateValue = utils_1.existsInArray(activeItems, value);
2519
2520      if (this.config.maxItemCount > 0 && this.config.maxItemCount <= activeItems.length) {
2521        // If there is a max entry limit and we have reached that limit
2522        // don't update
2523        canAddItem = false;
2524        notice = typeof this.config.maxItemText === 'function' ? this.config.maxItemText(this.config.maxItemCount) : this.config.maxItemText;
2525      }
2526
2527      if (!this.config.duplicateItemsAllowed && isDuplicateValue && canAddItem) {
2528        canAddItem = false;
2529        notice = typeof this.config.uniqueItemText === 'function' ? this.config.uniqueItemText(value) : this.config.uniqueItemText;
2530      }
2531
2532      if (this._isTextElement && this.config.addItems && canAddItem && typeof this.config.addItemFilter === 'function' && !this.config.addItemFilter(value)) {
2533        canAddItem = false;
2534        notice = typeof this.config.customAddItemText === 'function' ? this.config.customAddItemText(value) : this.config.customAddItemText;
2535      }
2536    }
2537
2538    return {
2539      response: canAddItem,
2540      notice: notice
2541    };
2542  };
2543
2544  Choices.prototype._searchChoices = function (value) {
2545    var newValue = typeof value === 'string' ? value.trim() : value;
2546    var currentValue = typeof this._currentValue === 'string' ? this._currentValue.trim() : this._currentValue;
2547
2548    if (newValue.length < 1 && newValue === currentValue + " ") {
2549      return 0;
2550    } // If new value matches the desired length and is not the same as the current value with a space
2551
2552
2553    var haystack = this._store.searchableChoices;
2554    var needle = newValue;
2555
2556    var keys = __spreadArrays(this.config.searchFields);
2557
2558    var options = Object.assign(this.config.fuseOptions, {
2559      keys: keys,
2560      includeMatches: true
2561    });
2562    var fuse = new fuse_js_1.default(haystack, options);
2563    var results = fuse.search(needle); // see https://github.com/krisk/Fuse/issues/303
2564
2565    this._currentValue = newValue;
2566    this._highlightPosition = 0;
2567    this._isSearching = true;
2568
2569    this._store.dispatch(choices_1.filterChoices(results));
2570
2571    return results.length;
2572  };
2573
2574  Choices.prototype._addEventListeners = function () {
2575    var documentElement = document.documentElement; // capture events - can cancel event processing or propagation
2576
2577    documentElement.addEventListener('touchend', this._onTouchEnd, true);
2578    this.containerOuter.element.addEventListener('keydown', this._onKeyDown, true);
2579    this.containerOuter.element.addEventListener('mousedown', this._onMouseDown, true); // passive events - doesn't call `preventDefault` or `stopPropagation`
2580
2581    documentElement.addEventListener('click', this._onClick, {
2582      passive: true
2583    });
2584    documentElement.addEventListener('touchmove', this._onTouchMove, {
2585      passive: true
2586    });
2587    this.dropdown.element.addEventListener('mouseover', this._onMouseOver, {
2588      passive: true
2589    });
2590
2591    if (this._isSelectOneElement) {
2592      this.containerOuter.element.addEventListener('focus', this._onFocus, {
2593        passive: true
2594      });
2595      this.containerOuter.element.addEventListener('blur', this._onBlur, {
2596        passive: true
2597      });
2598    }
2599
2600    this.input.element.addEventListener('keyup', this._onKeyUp, {
2601      passive: true
2602    });
2603    this.input.element.addEventListener('focus', this._onFocus, {
2604      passive: true
2605    });
2606    this.input.element.addEventListener('blur', this._onBlur, {
2607      passive: true
2608    });
2609
2610    if (this.input.element.form) {
2611      this.input.element.form.addEventListener('reset', this._onFormReset, {
2612        passive: true
2613      });
2614    }
2615
2616    this.input.addEventListeners();
2617  };
2618
2619  Choices.prototype._removeEventListeners = function () {
2620    var documentElement = document.documentElement;
2621    documentElement.removeEventListener('touchend', this._onTouchEnd, true);
2622    this.containerOuter.element.removeEventListener('keydown', this._onKeyDown, true);
2623    this.containerOuter.element.removeEventListener('mousedown', this._onMouseDown, true);
2624    documentElement.removeEventListener('click', this._onClick);
2625    documentElement.removeEventListener('touchmove', this._onTouchMove);
2626    this.dropdown.element.removeEventListener('mouseover', this._onMouseOver);
2627
2628    if (this._isSelectOneElement) {
2629      this.containerOuter.element.removeEventListener('focus', this._onFocus);
2630      this.containerOuter.element.removeEventListener('blur', this._onBlur);
2631    }
2632
2633    this.input.element.removeEventListener('keyup', this._onKeyUp);
2634    this.input.element.removeEventListener('focus', this._onFocus);
2635    this.input.element.removeEventListener('blur', this._onBlur);
2636
2637    if (this.input.element.form) {
2638      this.input.element.form.removeEventListener('reset', this._onFormReset);
2639    }
2640
2641    this.input.removeEventListeners();
2642  };
2643
2644  Choices.prototype._onKeyDown = function (event) {
2645    var keyCode = event.keyCode;
2646    var activeItems = this._store.activeItems;
2647    var hasFocusedInput = this.input.isFocussed;
2648    var hasActiveDropdown = this.dropdown.isActive;
2649    var hasItems = this.itemList.hasChildren();
2650    var keyString = String.fromCharCode(keyCode);
2651    var wasAlphaNumericChar = /[a-zA-Z0-9-_ ]/.test(keyString);
2652    var BACK_KEY = constants_1.KEY_CODES.BACK_KEY,
2653        DELETE_KEY = constants_1.KEY_CODES.DELETE_KEY,
2654        ENTER_KEY = constants_1.KEY_CODES.ENTER_KEY,
2655        A_KEY = constants_1.KEY_CODES.A_KEY,
2656        ESC_KEY = constants_1.KEY_CODES.ESC_KEY,
2657        UP_KEY = constants_1.KEY_CODES.UP_KEY,
2658        DOWN_KEY = constants_1.KEY_CODES.DOWN_KEY,
2659        PAGE_UP_KEY = constants_1.KEY_CODES.PAGE_UP_KEY,
2660        PAGE_DOWN_KEY = constants_1.KEY_CODES.PAGE_DOWN_KEY;
2661
2662    if (!this._isTextElement && !hasActiveDropdown && wasAlphaNumericChar) {
2663      this.showDropdown();
2664
2665      if (!this.input.isFocussed) {
2666        /*
2667          We update the input value with the pressed key as
2668          the input was not focussed at the time of key press
2669          therefore does not have the value of the key.
2670        */
2671        this.input.value += keyString.toLowerCase();
2672      }
2673    }
2674
2675    switch (keyCode) {
2676      case A_KEY:
2677        return this._onSelectKey(event, hasItems);
2678
2679      case ENTER_KEY:
2680        return this._onEnterKey(event, activeItems, hasActiveDropdown);
2681
2682      case ESC_KEY:
2683        return this._onEscapeKey(hasActiveDropdown);
2684
2685      case UP_KEY:
2686      case PAGE_UP_KEY:
2687      case DOWN_KEY:
2688      case PAGE_DOWN_KEY:
2689        return this._onDirectionKey(event, hasActiveDropdown);
2690
2691      case DELETE_KEY:
2692      case BACK_KEY:
2693        return this._onDeleteKey(event, activeItems, hasFocusedInput);
2694
2695      default:
2696    }
2697  };
2698
2699  Choices.prototype._onKeyUp = function (_a) {
2700    var target = _a.target,
2701        keyCode = _a.keyCode;
2702    var value = this.input.value;
2703    var activeItems = this._store.activeItems;
2704
2705    var canAddItem = this._canAddItem(activeItems, value);
2706
2707    var backKey = constants_1.KEY_CODES.BACK_KEY,
2708        deleteKey = constants_1.KEY_CODES.DELETE_KEY; // We are typing into a text input and have a value, we want to show a dropdown
2709    // notice. Otherwise hide the dropdown
2710
2711    if (this._isTextElement) {
2712      var canShowDropdownNotice = canAddItem.notice && value;
2713
2714      if (canShowDropdownNotice) {
2715        var dropdownItem = this._getTemplate('notice', canAddItem.notice);
2716
2717        this.dropdown.element.innerHTML = dropdownItem.outerHTML;
2718        this.showDropdown(true);
2719      } else {
2720        this.hideDropdown(true);
2721      }
2722    } else {
2723      var wasRemovalKeyCode = keyCode === backKey || keyCode === deleteKey;
2724      var userHasRemovedValue = wasRemovalKeyCode && target && !target.value;
2725      var canReactivateChoices = !this._isTextElement && this._isSearching;
2726      var canSearch = this._canSearch && canAddItem.response;
2727
2728      if (userHasRemovedValue && canReactivateChoices) {
2729        this._isSearching = false;
2730
2731        this._store.dispatch(choices_1.activateChoices(true));
2732      } else if (canSearch) {
2733        this._handleSearch(this.input.value);
2734      }
2735    }
2736
2737    this._canSearch = this.config.searchEnabled;
2738  };
2739
2740  Choices.prototype._onSelectKey = function (event, hasItems) {
2741    var ctrlKey = event.ctrlKey,
2742        metaKey = event.metaKey;
2743    var hasCtrlDownKeyPressed = ctrlKey || metaKey; // If CTRL + A or CMD + A have been pressed and there are items to select
2744
2745    if (hasCtrlDownKeyPressed && hasItems) {
2746      this._canSearch = false;
2747      var shouldHightlightAll = this.config.removeItems && !this.input.value && this.input.element === document.activeElement;
2748
2749      if (shouldHightlightAll) {
2750        this.highlightAll();
2751      }
2752    }
2753  };
2754
2755  Choices.prototype._onEnterKey = function (event, activeItems, hasActiveDropdown) {
2756    var target = event.target;
2757    var enterKey = constants_1.KEY_CODES.ENTER_KEY;
2758    var targetWasButton = target && target.hasAttribute('data-button');
2759
2760    if (this._isTextElement && target && target.value) {
2761      var value = this.input.value;
2762
2763      var canAddItem = this._canAddItem(activeItems, value);
2764
2765      if (canAddItem.response) {
2766        this.hideDropdown(true);
2767
2768        this._addItem({
2769          value: value
2770        });
2771
2772        this._triggerChange(value);
2773
2774        this.clearInput();
2775      }
2776    }
2777
2778    if (targetWasButton) {
2779      this._handleButtonAction(activeItems, target);
2780
2781      event.preventDefault();
2782    }
2783
2784    if (hasActiveDropdown) {
2785      var highlightedChoice = this.dropdown.getChild("." + this.config.classNames.highlightedState);
2786
2787      if (highlightedChoice) {
2788        // add enter keyCode value
2789        if (activeItems[0]) {
2790          activeItems[0].keyCode = enterKey; // eslint-disable-line no-param-reassign
2791        }
2792
2793        this._handleChoiceAction(activeItems, highlightedChoice);
2794      }
2795
2796      event.preventDefault();
2797    } else if (this._isSelectOneElement) {
2798      this.showDropdown();
2799      event.preventDefault();
2800    }
2801  };
2802
2803  Choices.prototype._onEscapeKey = function (hasActiveDropdown) {
2804    if (hasActiveDropdown) {
2805      this.hideDropdown(true);
2806      this.containerOuter.focus();
2807    }
2808  };
2809
2810  Choices.prototype._onDirectionKey = function (event, hasActiveDropdown) {
2811    var keyCode = event.keyCode,
2812        metaKey = event.metaKey;
2813    var downKey = constants_1.KEY_CODES.DOWN_KEY,
2814        pageUpKey = constants_1.KEY_CODES.PAGE_UP_KEY,
2815        pageDownKey = constants_1.KEY_CODES.PAGE_DOWN_KEY; // If up or down key is pressed, traverse through options
2816
2817    if (hasActiveDropdown || this._isSelectOneElement) {
2818      this.showDropdown();
2819      this._canSearch = false;
2820      var directionInt = keyCode === downKey || keyCode === pageDownKey ? 1 : -1;
2821      var skipKey = metaKey || keyCode === pageDownKey || keyCode === pageUpKey;
2822      var selectableChoiceIdentifier = '[data-choice-selectable]';
2823      var nextEl = void 0;
2824
2825      if (skipKey) {
2826        if (directionInt > 0) {
2827          nextEl = this.dropdown.element.querySelector(selectableChoiceIdentifier + ":last-of-type");
2828        } else {
2829          nextEl = this.dropdown.element.querySelector(selectableChoiceIdentifier);
2830        }
2831      } else {
2832        var currentEl = this.dropdown.element.querySelector("." + this.config.classNames.highlightedState);
2833
2834        if (currentEl) {
2835          nextEl = utils_1.getAdjacentEl(currentEl, selectableChoiceIdentifier, directionInt);
2836        } else {
2837          nextEl = this.dropdown.element.querySelector(selectableChoiceIdentifier);
2838        }
2839      }
2840
2841      if (nextEl) {
2842        // We prevent default to stop the cursor moving
2843        // when pressing the arrow
2844        if (!utils_1.isScrolledIntoView(nextEl, this.choiceList.element, directionInt)) {
2845          this.choiceList.scrollToChildElement(nextEl, directionInt);
2846        }
2847
2848        this._highlightChoice(nextEl);
2849      } // Prevent default to maintain cursor position whilst
2850      // traversing dropdown options
2851
2852
2853      event.preventDefault();
2854    }
2855  };
2856
2857  Choices.prototype._onDeleteKey = function (event, activeItems, hasFocusedInput) {
2858    var target = event.target; // If backspace or delete key is pressed and the input has no value
2859
2860    if (!this._isSelectOneElement && !target.value && hasFocusedInput) {
2861      this._handleBackspace(activeItems);
2862
2863      event.preventDefault();
2864    }
2865  };
2866
2867  Choices.prototype._onTouchMove = function () {
2868    if (this._wasTap) {
2869      this._wasTap = false;
2870    }
2871  };
2872
2873  Choices.prototype._onTouchEnd = function (event) {
2874    var target = (event || event.touches[0]).target;
2875    var touchWasWithinContainer = this._wasTap && this.containerOuter.element.contains(target);
2876
2877    if (touchWasWithinContainer) {
2878      var containerWasExactTarget = target === this.containerOuter.element || target === this.containerInner.element;
2879
2880      if (containerWasExactTarget) {
2881        if (this._isTextElement) {
2882          this.input.focus();
2883        } else if (this._isSelectMultipleElement) {
2884          this.showDropdown();
2885        }
2886      } // Prevents focus event firing
2887
2888
2889      event.stopPropagation();
2890    }
2891
2892    this._wasTap = true;
2893  };
2894  /**
2895   * Handles mousedown event in capture mode for containetOuter.element
2896   */
2897
2898
2899  Choices.prototype._onMouseDown = function (event) {
2900    var target = event.target;
2901
2902    if (!(target instanceof HTMLElement)) {
2903      return;
2904    } // If we have our mouse down on the scrollbar and are on IE11...
2905
2906
2907    if (IS_IE11 && this.choiceList.element.contains(target)) {
2908      // check if click was on a scrollbar area
2909      var firstChoice = this.choiceList.element.firstElementChild;
2910      var isOnScrollbar = this._direction === 'ltr' ? event.offsetX >= firstChoice.offsetWidth : event.offsetX < firstChoice.offsetLeft;
2911      this._isScrollingOnIe = isOnScrollbar;
2912    }
2913
2914    if (target === this.input.element) {
2915      return;
2916    }
2917
2918    var item = target.closest('[data-button],[data-item],[data-choice]');
2919
2920    if (item instanceof HTMLElement) {
2921      var hasShiftKey = event.shiftKey;
2922      var activeItems = this._store.activeItems;
2923      var dataset = item.dataset;
2924
2925      if ('button' in dataset) {
2926        this._handleButtonAction(activeItems, item);
2927      } else if ('item' in dataset) {
2928        this._handleItemAction(activeItems, item, hasShiftKey);
2929      } else if ('choice' in dataset) {
2930        this._handleChoiceAction(activeItems, item);
2931      }
2932    }
2933
2934    event.preventDefault();
2935  };
2936  /**
2937   * Handles mouseover event over this.dropdown
2938   * @param {MouseEvent} event
2939   */
2940
2941
2942  Choices.prototype._onMouseOver = function (_a) {
2943    var target = _a.target;
2944
2945    if (target instanceof HTMLElement && 'choice' in target.dataset) {
2946      this._highlightChoice(target);
2947    }
2948  };
2949
2950  Choices.prototype._onClick = function (_a) {
2951    var target = _a.target;
2952    var clickWasWithinContainer = this.containerOuter.element.contains(target);
2953
2954    if (clickWasWithinContainer) {
2955      if (!this.dropdown.isActive && !this.containerOuter.isDisabled) {
2956        if (this._isTextElement) {
2957          if (document.activeElement !== this.input.element) {
2958            this.input.focus();
2959          }
2960        } else {
2961          this.showDropdown();
2962          this.containerOuter.focus();
2963        }
2964      } else if (this._isSelectOneElement && target !== this.input.element && !this.dropdown.element.contains(target)) {
2965        this.hideDropdown();
2966      }
2967    } else {
2968      var hasHighlightedItems = this._store.highlightedActiveItems.length > 0;
2969
2970      if (hasHighlightedItems) {
2971        this.unhighlightAll();
2972      }
2973
2974      this.containerOuter.removeFocusState();
2975      this.hideDropdown(true);
2976    }
2977  };
2978
2979  Choices.prototype._onFocus = function (_a) {
2980    var _b;
2981
2982    var _this = this;
2983
2984    var target = _a.target;
2985    var focusWasWithinContainer = target && this.containerOuter.element.contains(target);
2986
2987    if (!focusWasWithinContainer) {
2988      return;
2989    }
2990
2991    var focusActions = (_b = {}, _b[constants_1.TEXT_TYPE] = function () {
2992      if (target === _this.input.element) {
2993        _this.containerOuter.addFocusState();
2994      }
2995    }, _b[constants_1.SELECT_ONE_TYPE] = function () {
2996      _this.containerOuter.addFocusState();
2997
2998      if (target === _this.input.element) {
2999        _this.showDropdown(true);
3000      }
3001    }, _b[constants_1.SELECT_MULTIPLE_TYPE] = function () {
3002      if (target === _this.input.element) {
3003        _this.showDropdown(true); // If element is a select box, the focused element is the container and the dropdown
3004        // isn't already open, focus and show dropdown
3005
3006
3007        _this.containerOuter.addFocusState();
3008      }
3009    }, _b);
3010    focusActions[this.passedElement.element.type]();
3011  };
3012
3013  Choices.prototype._onBlur = function (_a) {
3014    var _b;
3015
3016    var _this = this;
3017
3018    var target = _a.target;
3019    var blurWasWithinContainer = target && this.containerOuter.element.contains(target);
3020
3021    if (blurWasWithinContainer && !this._isScrollingOnIe) {
3022      var activeItems = this._store.activeItems;
3023      var hasHighlightedItems_1 = activeItems.some(function (item) {
3024        return item.highlighted;
3025      });
3026      var blurActions = (_b = {}, _b[constants_1.TEXT_TYPE] = function () {
3027        if (target === _this.input.element) {
3028          _this.containerOuter.removeFocusState();
3029
3030          if (hasHighlightedItems_1) {
3031            _this.unhighlightAll();
3032          }
3033
3034          _this.hideDropdown(true);
3035        }
3036      }, _b[constants_1.SELECT_ONE_TYPE] = function () {
3037        _this.containerOuter.removeFocusState();
3038
3039        if (target === _this.input.element || target === _this.containerOuter.element && !_this._canSearch) {
3040          _this.hideDropdown(true);
3041        }
3042      }, _b[constants_1.SELECT_MULTIPLE_TYPE] = function () {
3043        if (target === _this.input.element) {
3044          _this.containerOuter.removeFocusState();
3045
3046          _this.hideDropdown(true);
3047
3048          if (hasHighlightedItems_1) {
3049            _this.unhighlightAll();
3050          }
3051        }
3052      }, _b);
3053      blurActions[this.passedElement.element.type]();
3054    } else {
3055      // On IE11, clicking the scollbar blurs our input and thus
3056      // closes the dropdown. To stop this, we refocus our input
3057      // if we know we are on IE *and* are scrolling.
3058      this._isScrollingOnIe = false;
3059      this.input.element.focus();
3060    }
3061  };
3062
3063  Choices.prototype._onFormReset = function () {
3064    this._store.dispatch(misc_1.resetTo(this._initialState));
3065  };
3066
3067  Choices.prototype._highlightChoice = function (el) {
3068    var _this = this;
3069
3070    if (el === void 0) {
3071      el = null;
3072    }
3073
3074    var choices = Array.from(this.dropdown.element.querySelectorAll('[data-choice-selectable]'));
3075
3076    if (!choices.length) {
3077      return;
3078    }
3079
3080    var passedEl = el;
3081    var highlightedChoices = Array.from(this.dropdown.element.querySelectorAll("." + this.config.classNames.highlightedState)); // Remove any highlighted choices
3082
3083    highlightedChoices.forEach(function (choice) {
3084      choice.classList.remove(_this.config.classNames.highlightedState);
3085      choice.setAttribute('aria-selected', 'false');
3086    });
3087
3088    if (passedEl) {
3089      this._highlightPosition = choices.indexOf(passedEl);
3090    } else {
3091      // Highlight choice based on last known highlight location
3092      if (choices.length > this._highlightPosition) {
3093        // If we have an option to highlight
3094        passedEl = choices[this._highlightPosition];
3095      } else {
3096        // Otherwise highlight the option before
3097        passedEl = choices[choices.length - 1];
3098      }
3099
3100      if (!passedEl) {
3101        passedEl = choices[0];
3102      }
3103    }
3104
3105    passedEl.classList.add(this.config.classNames.highlightedState);
3106    passedEl.setAttribute('aria-selected', 'true');
3107    this.passedElement.triggerEvent(constants_1.EVENTS.highlightChoice, {
3108      el: passedEl
3109    });
3110
3111    if (this.dropdown.isActive) {
3112      // IE11 ignores aria-label and blocks virtual keyboard
3113      // if aria-activedescendant is set without a dropdown
3114      this.input.setActiveDescendant(passedEl.id);
3115      this.containerOuter.setActiveDescendant(passedEl.id);
3116    }
3117  };
3118
3119  Choices.prototype._addItem = function (_a) {
3120    var value = _a.value,
3121        _b = _a.label,
3122        label = _b === void 0 ? null : _b,
3123        _c = _a.choiceId,
3124        choiceId = _c === void 0 ? -1 : _c,
3125        _d = _a.groupId,
3126        groupId = _d === void 0 ? -1 : _d,
3127        _e = _a.customProperties,
3128        customProperties = _e === void 0 ? {} : _e,
3129        _f = _a.placeholder,
3130        placeholder = _f === void 0 ? false : _f,
3131        _g = _a.keyCode,
3132        keyCode = _g === void 0 ? -1 : _g;
3133    var passedValue = typeof value === 'string' ? value.trim() : value;
3134    var items = this._store.items;
3135    var passedLabel = label || passedValue;
3136    var passedOptionId = choiceId || -1;
3137    var group = groupId >= 0 ? this._store.getGroupById(groupId) : null;
3138    var id = items ? items.length + 1 : 1; // If a prepended value has been passed, prepend it
3139
3140    if (this.config.prependValue) {
3141      passedValue = this.config.prependValue + passedValue.toString();
3142    } // If an appended value has been passed, append it
3143
3144
3145    if (this.config.appendValue) {
3146      passedValue += this.config.appendValue.toString();
3147    }
3148
3149    this._store.dispatch(items_1.addItem({
3150      value: passedValue,
3151      label: passedLabel,
3152      id: id,
3153      choiceId: passedOptionId,
3154      groupId: groupId,
3155      customProperties: customProperties,
3156      placeholder: placeholder,
3157      keyCode: keyCode
3158    }));
3159
3160    if (this._isSelectOneElement) {
3161      this.removeActiveItems(id);
3162    } // Trigger change event
3163
3164
3165    this.passedElement.triggerEvent(constants_1.EVENTS.addItem, {
3166      id: id,
3167      value: passedValue,
3168      label: passedLabel,
3169      customProperties: customProperties,
3170      groupValue: group && group.value ? group.value : null,
3171      keyCode: keyCode
3172    });
3173  };
3174
3175  Choices.prototype._removeItem = function (item) {
3176    var id = item.id,
3177        value = item.value,
3178        label = item.label,
3179        customProperties = item.customProperties,
3180        choiceId = item.choiceId,
3181        groupId = item.groupId;
3182    var group = groupId && groupId >= 0 ? this._store.getGroupById(groupId) : null;
3183
3184    if (!id || !choiceId) {
3185      return;
3186    }
3187
3188    this._store.dispatch(items_1.removeItem(id, choiceId));
3189
3190    this.passedElement.triggerEvent(constants_1.EVENTS.removeItem, {
3191      id: id,
3192      value: value,
3193      label: label,
3194      customProperties: customProperties,
3195      groupValue: group && group.value ? group.value : null
3196    });
3197  };
3198
3199  Choices.prototype._addChoice = function (_a) {
3200    var value = _a.value,
3201        _b = _a.label,
3202        label = _b === void 0 ? null : _b,
3203        _c = _a.isSelected,
3204        isSelected = _c === void 0 ? false : _c,
3205        _d = _a.isDisabled,
3206        isDisabled = _d === void 0 ? false : _d,
3207        _e = _a.groupId,
3208        groupId = _e === void 0 ? -1 : _e,
3209        _f = _a.customProperties,
3210        customProperties = _f === void 0 ? {}
3210 : _f,
3211        _g = _a.placeholder,
3212        placeholder = _g === void 0 ? false : _g,
3213        _h = _a.keyCode,
3214        keyCode = _h === void 0 ? -1 : _h;
3215
3216    if (typeof value === 'undefined' || value === null) {
3217      return;
3218    } // Generate unique id
3219
3220
3221    var choices = this._store.choices;
3222    var choiceLabel = label || value;
3223    var choiceId = choices ? choices.length + 1 : 1;
3224    var choiceElementId = this._baseId + "-" + this._idNames.itemChoice + "-" + choiceId;
3225
3226    this._store.dispatch(choices_1.addChoice({
3227      id: choiceId,
3228      groupId: groupId,
3229      elementId: choiceElementId,
3230      value: value,
3231      label: choiceLabel,
3232      disabled: isDisabled,
3233      customProperties: customProperties,
3234      placeholder: placeholder,
3235      keyCode: keyCode
3236    }));
3237
3238    if (isSelected) {
3239      this._addItem({
3240        value: value,
3241        label: choiceLabel,
3242        choiceId: choiceId,
3243        customProperties: customProperties,
3244        placeholder: placeholder,
3245        keyCode: keyCode
3246      });
3247    }
3248  };
3249
3250  Choices.prototype._addGroup = function (_a) {
3251    var _this = this;
3252
3253    var group = _a.group,
3254        id = _a.id,
3255        _b = _a.valueKey,
3256        valueKey = _b === void 0 ? 'value' : _b,
3257        _c = _a.labelKey,
3258        labelKey = _c === void 0 ? 'label' : _c;
3259    var groupChoices = utils_1.isType('Object', group) ? group.choices : Array.from(group.getElementsByTagName('OPTION'));
3260    var groupId = id || Math.floor(new Date().valueOf() * Math.random());
3261    var isDisabled = group.disabled ? group.disabled : false;
3262
3263    if (groupChoices) {
3264      this._store.dispatch(groups_1.addGroup({
3265        value: group.label,
3266        id: groupId,
3267        active: true,
3268        disabled: isDisabled
3269      }));
3270
3271      var addGroupChoices = function addGroupChoices(choice) {
3272        var isOptDisabled = choice.disabled || choice.parentNode && choice.parentNode.disabled;
3273
3274        _this._addChoice({
3275          value: choice[valueKey],
3276          label: utils_1.isType('Object', choice) ? choice[labelKey] : choice.innerHTML,
3277          isSelected: choice.selected,
3278          isDisabled: isOptDisabled,
3279          groupId: groupId,
3280          customProperties: choice.customProperties,
3281          placeholder: choice.placeholder
3282        });
3283      };
3284
3285      groupChoices.forEach(addGroupChoices);
3286    } else {
3287      this._store.dispatch(groups_1.addGroup({
3288        value: group.label,
3289        id: group.id,
3290        active: false,
3291        disabled: group.disabled
3292      }));
3293    }
3294  };
3295
3296  Choices.prototype._getTemplate = function (template) {
3297    var _a;
3298
3299    var args = [];
3300
3301    for (var _i = 1; _i < arguments.length; _i++) {
3302      args[_i - 1] = arguments[_i];
3303    }
3304
3305    var classNames = this.config.classNames;
3306    return (_a = this._templates[template]).call.apply(_a, __spreadArrays([this, classNames], args));
3307  };
3308
3309  Choices.prototype._createTemplates = function () {
3310    var callbackOnCreateTemplates = this.config.callbackOnCreateTemplates;
3311    var userTemplates = {};
3312
3313    if (callbackOnCreateTemplates && typeof callbackOnCreateTemplates === 'function') {
3314      userTemplates = callbackOnCreateTemplates.call(this, utils_1.strToEl);
3315    }
3316
3317    this._templates = deepmerge_1.default(templates_1.default, userTemplates);
3318  };
3319
3320  Choices.prototype._createElements = function () {
3321    this.containerOuter = new components_1.Container({
3322      element: this._getTemplate('containerOuter', this._direction, this._isSelectElement, this._isSelectOneElement, this.config.searchEnabled, this.passedElement.element.type),
3323      classNames: this.config.classNames,
3324      type: this.passedElement.element.type,
3325      position: this.config.position
3326    });
3327    this.containerInner = new components_1.Container({
3328      element: this._getTemplate('containerInner'),
3329      classNames: this.config.classNames,
3330      type: this.passedElement.element.type,
3331      position: this.config.position
3332    });
3333    this.input = new components_1.Input({
3334      element: this._getTemplate('input', this._placeholderValue),
3335      classNames: this.config.classNames,
3336      type: this.passedElement.element.type,
3337      preventPaste: !this.config.paste
3338    });
3339    this.choiceList = new components_1.List({
3340      element: this._getTemplate('choiceList', this._isSelectOneElement)
3341    });
3342    this.itemList = new components_1.List({
3343      element: this._getTemplate('itemList', this._isSelectOneElement)
3344    });
3345    this.dropdown = new components_1.Dropdown({
3346      element: this._getTemplate('dropdown'),
3347      classNames: this.config.classNames,
3348      type: this.passedElement.element.type
3349    });
3350  };
3351
3352  Choices.prototype._createStructure = function () {
3353    // Hide original element
3354    this.passedElement.conceal(); // Wrap input in container preserving DOM ordering
3355
3356    this.containerInner.wrap(this.passedElement.element); // Wrapper inner container with outer container
3357
3358    this.containerOuter.wrap(this.containerInner.element);
3359
3360    if (this._isSelectOneElement) {
3361      this.input.placeholder = this.config.searchPlaceholderValue || '';
3362    } else if (this._placeholderValue) {
3363      this.input.placeholder = this._placeholderValue;
3364      this.input.setWidth();
3365    }
3366
3367    this.containerOuter.element.appendChild(this.containerInner.element);
3368    this.containerOuter.element.appendChild(this.dropdown.element);
3369    this.containerInner.element.appendChild(this.itemList.element);
3370
3371    if (!this._isTextElement) {
3372      this.dropdown.element.appendChild(this.choiceList.element);
3373    }
3374
3375    if (!this._isSelectOneElement) {
3376      this.containerInner.element.appendChild(this.input.element);
3377    } else if (this.config.searchEnabled) {
3378      this.dropdown.element.insertBefore(this.input.element, this.dropdown.element.firstChild);
3379    }
3380
3381    if (this._isSelectElement) {
3382      this._highlightPosition = 0;
3383      this._isSearching = false;
vendor: 4,583 bytes, lines 3384-3539
3384
3385      this._startLoading();
3386
3387      if (this._presetGroups.length) {
3388        this._addPredefinedGroups(this._presetGroups);
3389      } else {
3390        this._addPredefinedChoices(this._presetChoices);
3391      }
3392
3393      this._stopLoading();
3394    }
3395
3396    if (this._isTextElement) {
3397      this._addPredefinedItems(this._presetItems);
3398    }
3399  };
3400
3401  Choices.prototype._addPredefinedGroups = function (groups) {
3402    var _this = this; // If we have a placeholder option
3403
3404
3405    var placeholderChoice = this.passedElement.placeholderOption;
3406
3407    if (placeholderChoice && placeholderChoice.parentNode && placeholderChoice.parentNode.tagName === 'SELECT') {
3408      this._addChoice({
3409        value: placeholderChoice.value,
3410        label: placeholderChoice.innerHTML,
3411        isSelected: placeholderChoice.selected,
3412        isDisabled: placeholderChoice.disabled,
3413        placeholder: true
3414      });
3415    }
3416
3417    groups.forEach(function (group) {
3418      return _this._addGroup({
3419        group: group,
3420        id: group.id || null
3421      });
3422    });
3423  };
3424
3425  Choices.prototype._addPredefinedChoices = function (choices) {
3426    var _this = this; // If sorting is enabled or the user is searching, filter choices
3427
3428
3429    if (this.config.shouldSort) {
3430      choices.sort(this.config.sorter);
3431    }
3432
3433    var hasSelectedChoice = choices.some(function (choice) {
3434      return choice.selected;
3435    });
3436    var firstEnabledChoiceIndex = choices.findIndex(function (choice) {
3437      return choice.disabled === undefined || !choice.disabled;
3438    });
3439    choices.forEach(function (choice, index) {
3440      var _a = choice.value,
3441          value = _a === void 0 ? '' : _a,
3442          label = choice.label,
3443          customProperties = choice.customProperties,
3444          placeholder = choice.placeholder;
3445
3446      if (_this._isSelectElement) {
3447        // If the choice is actually a group
3448        if (choice.choices) {
3449          _this._addGroup({
3450            group: choice,
3451            id: choice.id || null
3452          });
3453        } else {
3454          /**
3455           * If there is a selected choice already or the choice is not the first in
3456           * the array, add each choice normally.
3457           *
3458           * Otherwise we pre-select the first enabled choice in the array ("select-one" only)
3459           */
3460          var shouldPreselect = _this._isSelectOneElement && !hasSelectedChoice && index === firstEnabledChoiceIndex;
3461          var isSelected = shouldPreselect ? true : choice.selected;
3462          var isDisabled = choice.disabled;
3463          console.log(isDisabled, choice);
3464
3465          _this._addChoice({
3466            value: value,
3467            label: label,
3468            isSelected: !!isSelected,
3469            isDisabled: !!isDisabled,
3470            placeholder: !!placeholder,
3471            customProperties: customProperties
3472          });
3473        }
3474      } else {
3475        _this._addChoice({
3476          value: value,
3477          label: label,
3478          isSelected: !!choice.selected,
3479          isDisabled: !!choice.disabled,
3480          placeholder: !!choice.placeholder,
3481          customProperties: customProperties
3482        });
3483      }
3484    });
3485  };
3486
3487  Choices.prototype._addPredefinedItems = function (items) {
3488    var _this = this;
3489
3490    items.forEach(function (item) {
3491      if (typeof item === 'object' && item.value) {
3492        _this._addItem({
3493          value: item.value,
3494          label: item.label,
3495          choiceId: item.id,
3496          customProperties: item.customProperties,
3497          placeholder: item.placeholder
3498        });
3499      }
3500
3501      if (typeof item === 'string') {
3502        _this._addItem({
3503          value: item
3504        });
3505      }
3506    });
3507  };
3508
3509  Choices.prototype._setChoiceOrItem = function (item) {
3510    var _this = this;
3511
3512    var itemType = utils_1.getType(item).toLowerCase();
3513    var handleType = {
3514      object: function object() {
3515        if (!item.value) {
3516          return;
3517        } // If we are dealing with a select input, we need to create an option first
3518        // that is then selected. For text inputs we can just add items normally.
3519
3520
3521        if (!_this._isTextElement) {
3522          _this._addChoice({
3523            value: item.value,
3524            label: item.label,
3525            isSelected: true,
3526            isDisabled: false,
3527            customProperties: item.customProperties,
3528            placeholder: item.placeholder
3529          });
3530        } else {
3531          _this._addItem({
3532            value: item.value,
3533            label: item.label,
3534            choiceId: item.id,
3535            customProperties: item.customProperties,
3536            placeholder: item.placeholder
3537          });
3538        }
3539      },
3540      string: function string() {
3541        if (!_this._isTextElement) {
3542          _this._addChoice({
3543            value: item,
3544            label: item,
3545            isSelected: true,
3546            isDisabled: false
3547          });
3548        } else {
3549          _this._addItem({
3550            value: item
3551          });
3552        }
3553      }
3554    };
3555    handleType[itemType]();
3556  };
3557
3558  Choices.prototype._findAndSelectChoiceByValue = function (value) {
3559    var _this = this;
3560
3561    var choices = this._store.choices; // Check 'value' property exists and the choice isn't already selected
3562
3563    var foundChoice = choices.find(function (choice) {
3564      return _this.config.valueComparer(choice.value, value);
3565    });
3566
3567    if (foundChoice && !foundChoice.selected) {
3568      this._addItem({
3569        value: foundChoice.value,
3570        label: foundChoice.label,
3571        choiceId: foundChoice.id,
3572        groupId: foundChoice.groupId,
3573        customProperties: foundChoice.customProperties,
3574        placeholder: foundChoice.placeholder,
3575        keyCode: foundChoice.keyCode
3576      });
3577    }
3578  };
3579
3580  Choices.prototype._generatePlaceholderValue = function () {
3581    if (this._isSelectElement) {
3582      var placeholderOption = this.passedElement.placeholderOption;
3583      return placeholderOption ? placeholderOption.text : null;
3584    }
3585
3586    var _a = this.config,
3587        placeholder = _a.placeholder,
3588        placeholderValue = _a.placeholderValue;
3589    var dataset = this.passedElement.element.dataset;
3590
3591    if (placeholder) {
3592      if (placeholderValue) {
3593        return placeholderValue;
3594      }
3595
3596      if (dataset.placeholder) {
3597        return dataset.placeholder;
3598      }
3599    }
3600
3601    return null;
3602  };
3603
3604  return Choices;
3605}();
3606
3607exports.default = Choices;
3608
3609/***/ }),
3610/* 9 */
3611/***/ (function(module, exports, __webpack_require__) {
3612
3613/*!
3614 * Fuse.js v3.4.6 - Lightweight fuzzy-search (http://fusejs.io)
3615 * 
3616 * Copyright (c) 2012-2017 Kirollos Risk (http://kiro.me)
3617 * All Rights Reserved. Apache Software License 2.0
3618 * 
3619 * http://www.apache.org/licenses/LICENSE-2.0
3620 */
3621!function(e,t){ true?module.exports=t():undefined}(this,function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=1)}([function(e,t){e.exports=function(e){return Array.isArray?Array.isArray(e):"[object Array]"===Object.prototype.toString.call(e)}},function(e,t,n){function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var i=n(2),a=n(8),s=n(0),c=function(){function e(t,n){var r=n.location,o=void 0===r?0:r,i=n.distance,s=void 0===i?100:i,c=n.threshold,h=void 0===c?.6:c,l=n.maxPatternLength,u=void 0===l?32:l,f=n.caseSensitive,d=void 0!==f&&f,v=n.tokenSeparator,p=void 0===v?/ +/g:v,g=n.findAllMatches,y=void 0!==g&&g,m=n.minMatchCharLength,k=void 0===m?1:m,S=n.id,x=void 0===S?null:S,b=n.keys,M=void 0===b?[]:b,_=n.shouldSort,L=void 0===_||_,w=n.getFn,A=void 0===w?a:w,C=n.sortFn,I=void 0===C?function(e,t){return e.score-t.score}:C,O=n.tokenize,j=void 0!==O&&O,P=n.matchAllTokens,F=void 0!==P&&P,T=n.includeMatches,z=void 0!==T&&T,E=n.includeScore,K=void 0!==E&&E,$=n.verbose,J=void 0!==$&&$;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.options={location:o,distance:s,threshold:h,maxPatternLength:u,isCaseSensitive:d,tokenSeparator:p,findAllMatches:y,minMatchCharLength:k,id:x,
vendor: 10,554 bytes, lines 3621-3691
3621keys:M,includeMatches:z,includeScore:K,shouldSort:L,getFn:A,sortFn:I,verbose:J,tokenize:j,matchAllTokens:F},this.setCollection(t)}var t,n,c;return t=e,(n=[{key:"setCollection",value:function(e){return this.list=e,e}},{key:"search",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{limit:!1};this._log('---------\nSearch pattern: "'.concat(e,'"'));var n=this._prepareSearchers(e),r=n.tokenSearchers,o=n.fullSearcher,i=this._search(r,o),a=i.weights,s=i.results;return this._computeScore(a,s),this.options.shouldSort&&this._sort(s),t.limit&&"number"==typeof t.limit&&(s=s.slice(0,t.limit)),this._format(s)}},{key:"_prepareSearchers",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=[];if(this.options.tokenize)for(var n=e.split(this.options.tokenSeparator),r=0,o=n.length;r<o;r+=1)t.push(new i(n[r],this.options));return{tokenSearchers:t,fullSearcher:new i(e,this.options)}}},{key:"_search",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0,n=this.list,r={},o=[];if("string"==typeof n[0]){for(var i=0,a=n.length;i<a;i+=1)this._analyze({key:"",value:n[i],record:i,index:i},{resultMap:r,results:o,tokenSearchers:e,fullSearcher:t});return{weights:null,results:o}}for(var s={},c=0,h=n.length;c<h;c+=1)for(var l=n[c],u=0,f=this.options.keys.length;u<f;u+=1){var d=this.options.keys[u];if("string"!=typeof d){if(s[d.name]={weight:1-d.weight||1},d.weight<=0||d.weight>1)throw new Error("Key weight has to be > 0 and <= 1");d=d.name}else s[d]={weight:1};this._analyze({key:d,value:this.options.getFn(l,d),record:l,index:c},{resultMap:r,results:o,tokenSearchers:e,fullSearcher:t})}return{weights:s,results:o}}},{key:"_analyze",value:function(e,t){var n=e.key,r=e.arrayIndex,o=void 0===r?-1:r,i=e.value,a=e.record,c=e.index,h=t.tokenSearchers,l=void 0===h?[]:h,u=t.fullSearcher,f=void 0===u?[]:u,d=t.resultMap,v=void 0===d?{}:d,p=t.results,g=void 0===p?[]:p;if(null!=i){var y=!1,m=-1,k=0;if("string"==typeof i){this._log("\nKey: ".concat(""===n?"-":n));var S=f.search(i);if(this._log('Full text: "'.concat(i,'", score: ').concat(S.score)),this.options.tokenize){for(var x=i.split(this.options.tokenSeparator),b=[],M=0;M<l.length;M+=1){var _=l[M];this._log('\nPattern: "'.concat(_.pattern,'"'));for(var L=!1,w=0;w<x.length;w+=1){var A=x[w],C=_.search(A),I={};C.isMatch?(I[A]=C.score,y=!0,L=!0,b.push(C.score)):(I[A]=1,this.options.matchAllTokens||b.push(1)),this._log('Token: "'.concat(A,'", score: ').concat(I[A]))}L&&(k+=1)}m=b[0];for(var O=b.length,j=1;j<O;j+=1)m+=b[j];m/=O,this._log("Token score average:",m)}var P=S.score;m>-1&&(P=(P+m)/2),this._log("Score average:",P);var F=!this.options.tokenize||!this.options.matchAllTokens||k>=l.length;if(this._log("\nCheck Matches: ".concat(F)),(y||S.isMatch)&&F){var T=v[c];T?T.output.push({key:n,arrayIndex:o,value:i,score:P,matchedIndices:S.matchedIndices}):(v[c]={item:a,output:[{key:n,arrayIndex:o,value:i,score:P,matchedIndices:S.matchedIndices}]},g.push(v[c]))}}else if(s(i))for(var z=0,E=i.length;z<E;z+=1)this._analyze({key:n,arrayIndex:z,value:i[z],record:a,index:c},{resultMap:v,results:g,tokenSearchers:l,fullSearcher:f})}}},{key:"_computeScore",value:function(e,t){this._log("\n\nComputing score:\n");for(var n=0,r=t.length;n<r;n+=1){for(var o=t[n].output,i=o.length,a=1,s=1,c=0;c<i;c+=1){var h=e?e[o[c].key].weight:1,l=(1===h?o[c].score:o[c].score||.001)*h;1!==h?s=Math.min(s,l):(o[c].nScore=l,a*=l)}t[n].score=1===s?a:s,this._log(t[n])}}},{key:"_sort",value:function(e){this._log("\n\nSorting...."),e.sort(this.options.sortFn)}},{key:"_format",value:function(e){var t=[];if(this.options.verbose){var n=[];this._log("\n\nOutput:\n\n",JSON.stringify(e,function(e,t){if("object"===r(t)&&null!==t){if(-1!==n.indexOf(t))return;n.push(t)}return t})),n=null}var o=[];this.options.includeMatches&&o.push(function(e,t){var n=e.output;t.matches=[];for(var r=0,o=n.length;r<o;r+=1){var i=n[r];if(0!==i.matchedIndices.length){var a={indices:i.matchedIndices,value:i.value};i.key&&(a.key=i.key),i.hasOwnProperty("arrayIndex")&&i.arrayIndex>-1&&(a.arrayIndex=i.arrayIndex),t.matches.push(a)}}}),this.options.includeScore&&o.push(function(e,t){t.score=e.score});for(var i=0,a=e.length;i<a;i+=1){var s=e[i];if(this.options.id&&(s.item=this.options.getFn(s.item,this.options.id)[0]),o.length){for(var c={item:s.item},h=0,l=o.length;h<l;h+=1)o[h](s,c);t.push(c)}else t.push(s.item)}return t}},{key:"_log",value:function(){var e;this.options.verbose&&(e=console).log.apply(e,arguments)}}])&&o(t.prototype,n),c&&o(t,c),e}();e.exports=c},function(e,t,n){function r(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,r.key,r)}}var o=n(3),i=n(4),a=n(7),s=function(){function e(t,n){var r=n.location,o=void 0===r?0:r,i=n.distance,s=void 0===i?100:i,c=n.threshold,h=void 0===c?.6:c,l=n.maxPatternLength,u=void 0===l?32:l,f=n.isCaseSensitive,d=void 0!==f&&f,v=n.tokenSeparator,p=void 0===v?/ +/g:v,g=n.findAllMatches,y=void 0!==g&&g,m=n.minMatchCharLength,k=void 0===m?1:m;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.options={location:o,distance:s,threshold:h,maxPatternLength:u,isCaseSensitive:d,tokenSeparator:p,findAllMatches:y,minMatchCharLength:k},this.pattern=this.options.isCaseSensitive?t:t.toLowerCase(),this.pattern.length<=u&&(this.patternAlphabet=a(this.pattern))}var t,n,s;return t=e,(n=[{key:"search",value:function(e){if(this.options.isCaseSensitive||(e=e.toLowerCase()),this.pattern===e)return{isMatch:!0,score:0,matchedIndices:[[0,e.length-1]]};var t=this.options,n=t.maxPatternLength,r=t.tokenSeparator;if(this.pattern.length>n)return o(e,this.pattern,r);var a=this.options,s=a.location,c=a.distance,h=a.threshold,l=a.findAllMatches,u=a.minMatchCharLength;return i(e,this.pattern,this.patternAlphabet,{location:s,distance:c,threshold:h,findAllMatches:l,minMatchCharLength:u})}}])&&r(t.prototype,n),s&&r(t,s),e}();e.exports=s},function(e,t){var n=/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g;e.exports=function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:/ +/g,o=new RegExp(t.replace(n,"\\$&").replace(r,"|")),i=e.match(o),a=!!i,s=[];if(a)for(var c=0,h=i.length;c<h;c+=1){var l=i[c];s.push([e.indexOf(l),l.length-1])}return{score:a?.5:1,isMatch:a,matchedIndices:s}}},function(e,t,n){var r=n(5),o=n(6);e.exports=function(e,t,n,i){for(var a=i.location,s=void 0===a?0:a,c=i.distance,h=void 0===c?100:c,l=i.threshold,u=void 0===l?.6:l,f=i.findAllMatches,d=void 0!==f&&f,v=i.minMatchCharLength,p=void 0===v?1:v,g=s,y=e.length,m=u,k=e.indexOf(t,g),S=t.length,x=[],b=0;b<y;b+=1)x[b]=0;if(-1!==k){var M=r(t,{errors:0,currentLocation:k,expectedLocation:g,distance:h});if(m=Math.min(M,m),-1!==(k=e.lastIndexOf(t,g+S))){var _=r(t,{errors:0,currentLocation:k,expectedLocation:g,distance:h});m=Math.min(_,m)}}k=-1;for(var L=[],w=1,A=S+y,C=1<<(S<=31?S-1:30),I=0;I<S;I+=1){for(var O=0,j=A;O<j;){r(t,{errors:I,currentLocation:g+j,expectedLocation:g,distance:h})<=m?O=j:A=j,j=Math.floor((A-O)/2+O)}A=j;var P=Math.max(1,g-j+1),F=d?y:Math.min(g+j,y)+S,T=Array(F+2);T[F+1]=(1<<I)-1;for(var z=F;z>=P;z-=1){var E=z-1,K=n[e.charAt(E)];if(K&&(x[E]=1),T[z]=(T[z+1]<<1|1)&K,0!==I&&(T[z]|=(L[z+1]|L[z])<<1|1|L[z+1]),T[z]&C&&(w=r(t,{errors:I,currentLocation:E,expectedLocation:g,distance:h}))<=m){if(m=w,(k=E)<=g)break;P=Math.max(1,2*g-k)}}if(r(t,{errors:I+1,currentLocation:g,expectedLocation:g,distance:h})>m)break;L=T}return{isMatch:k>=0,score:0===w?.001:w,matchedIndices:o(x,p)}}},function(e,t){e.exports=function(e,t){var n=t.errors,r=void 0===n?0:n,o=t.currentLocation,i=void 0===o?0:o,a=t.expectedLocation,s=void 0===a?0:a,c=t.distance,h=void 0===c?100:c,l=r/e.length,u=Math.abs(s-i);return h?l+u/h:u?1:l}},function(e,t){e.exports=function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=[],r=-1,o=-1,i=0,a=e.length;i<a;i+=1){var s=e[i];s&&-1===r?r=i:s||-1===r||((o=i-1)-r+1>=t&&n.push([r,o]),r=-1)}return e[i-1]&&i-r>=t&&n.push([r,i-1]),n}},function(e,t){e.exports=function(e){for(var t={},n=e.length,r=0;r<n;r+=1)t[e.charAt(r)]=0;for(var o=0;o<n;o+=1)t[e.charAt(o)]|=1<<n-o-1;return t}},function(e,t,n){var r=n(0);e.exports=function(e,t){return function e(t,n,o){if(n){var i=n.indexOf("."),a=n,s=null;-1!==i&&(a=n.slice(0,i),s=n.slice(i+1));var c=t[a];if(null!=c)if(s||"string"!=typeof c&&"number"!=typeof c)if(r(c))for(var h=0,l=c.length;h<l;h+=1)e(c[h],s,o);else s&&e(c,s,o);else o.push(c.toString())}else o.push(t);return o}(e,t,[])}}])});
3622
3623/***/ }),
3624/* 10 */
3625/***/ (function(module, exports, __webpack_require__) {
3626
3627"use strict";
3628
3629
3630var isMergeableObject = function isMergeableObject(value) {
3631	return isNonNullObject(value)
3632		&& !isSpecial(value)
3633};
3634
3635function isNonNullObject(value) {
3636	return !!value && typeof value === 'object'
3637}
3638
3639function isSpecial(value) {
3640	var stringValue = Object.prototype.toString.call(value);
3641
3642	return stringValue === '[object RegExp]'
3643		|| stringValue === '[object Date]'
3644		|| isReactElement(value)
3645}
3646
3647// see https://github.com/facebook/react/blob/b5ac963fb791d1298e7f396236383bc955f916c1/src/isomorphic/classic/element/ReactElement.js#L21-L25
3648var canUseSymbol = typeof Symbol === 'function' && Symbol.for;
3649var REACT_ELEMENT_TYPE = canUseSymbol ? Symbol.for('react.element') : 0xeac7;
3650
3651function isReactElement(value) {
3652	return value.$$typeof === REACT_ELEMENT_TYPE
3653}
3654
3655function emptyTarget(val) {
3656	return Array.isArray(val) ? [] : {}
3657}
3658
3659function cloneUnlessOtherwiseSpecified(value, options) {
3660	return (options.clone !== false && options.isMergeableObject(value))
3661		? deepmerge(emptyTarget(value), value, options)
3662		: value
3663}
3664
3665function defaultArrayMerge(target, source, options) {
3666	return target.concat(source).map(function(element) {
3667		return cloneUnlessOtherwiseSpecified(element, options)
3668	})
3669}
3670
3671function getMergeFunction(key, options) {
3672	if (!options.customMerge) {
3673		return deepmerge
3674	}
3675	var customMerge = options.customMerge(key);
3676	return typeof customMerge === 'function' ? customMerge : deepmerge
3677}
3678
3679function getEnumerableOwnPropertySymbols(target) {
3680	return Object.getOwnPropertySymbols
3681		? Object.getOwnPropertySymbols(target).filter(function(symbol) {
3682			return target.propertyIsEnumerable(symbol)
3683		})
3684		: []
3685}
3686
3687function getKeys(target) {
3688	return Object.keys(target).concat(getEnumerableOwnPropertySymbols(target))
3689}
3690
3691// Protects from prototype poisoning and unexpected merging up the prototype chain.
3692function propertyIsUnsafe(target, key) {
3693	try {
3694		return (key in target) // Properties are safe to merge if they don't exist in the target yet,
3695			&& !(Object.hasOwnProperty.call(target, key) // unsafe if they exist up the prototype chain,
3696				&& Object.propertyIsEnumerable.call(target, key)) // and also unsafe if they're nonenumerable.
3697	} catch (unused) {
3698		// Counterintuitively, it's safe to merge any property on a target that causes the `in` operator to throw.
3699		// This happens when trying to copy an object in the source over a plain string in the target.
3700		return false
3701	}
3702}
3703
3704function mergeObject(target, source, options) {
3705	var destination = {};
3706	if (options.isMergeableObject(target)) {
3707		getKeys(target).forEach(function(key) {
3708			destination[key] = cloneUnlessOtherwiseSpecified(target[key], options);
3709		});
3710	}
3711	getKeys(source).forEach(function(key) {
3712		if (propertyIsUnsafe(target, key)) {
3713			return
3714		}
3715
3716		if (!options.isMergeableObject(source[key]) || !target[key]) {
3717			destination[key] = cloneUnlessOtherwiseSpecified(source[key], options);
3718		} else {
3719			destination[key] = getMergeFunction(key, options)(target[key], source[key], options);
3720		}
3721	});
3722	return destination
3723}
3724
3725function deepmerge(target, source, options) {
3726	options = options || {};
3727	options.arrayMerge = options.arrayMerge || defaultArrayMerge;
3728	options.isMergeableObject = options.isMergeableObject || isMergeableObject;
3729	// cloneUnlessOtherwiseSpecified is added to `options` so that custom arrayMerge()
3730	// implementations can use it. The caller may not replace it.
3731	options.cloneUnlessOtherwiseSpecified = cloneUnlessOtherwiseSpecified;
3732
3733	var sourceIsArray = Array.isArray(source);
3734	var targetIsArray = Array.isArray(target);
3735	var sourceAndTargetTypesMatch = sourceIsArray === targetIsArray;
3736
3737	if (!sourceAndTargetTypesMatch) {
3738		return cloneUnlessOtherwiseSpecified(source, options)
3739	} else if (sourceIsArray) {
3740		return options.arrayMerge(target, source, options)
3741	} else {
3742		return mergeObject(target, source, options)
3743	}
3744}
3745
3746deepmerge.all = function deepmergeAll(array, options) {
3747	if (!Array.isArray(array)) {
3748		throw new Error('first argument should be an array')
3749	}
3750
3751	return array.reduce(function(prev, next) {
3752		return deepmerge(prev, next, options)
3753	}, {})
3754};
3755
3756var deepmerge_1 = deepmerge;
3757
3758module.exports = deepmerge_1;
3759
3760
3761/***/ }),
3762/* 11 */
3763/***/ (function(module, exports, __webpack_require__) {
3764
3765"use strict";
3766
3767
3768var __spreadArrays = this && this.__spreadArrays || function () {
3769  for (var s = 0, i = 0, il = arguments.length; i < il; i++) {
3770    s += arguments[i].length;
3771  }
3772
3773  for (var r = Array(s), k = 0, i = 0; i < il; i++) {
3774    for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) {
3775      r[k] = a[j];
3776    }
3777  }
3778
3779  return r;
3780};
3781
3782var __importDefault = this && this.__importDefault || function (mod) {
3783  return mod && mod.__esModule ? mod : {
3784    "default": mod
3785  };
3786};
3787
3788Object.defineProperty(exports, "__esModule", {
3789  value: true
3790});
3791/* eslint-disable @typescript-eslint/no-explicit-any */
3792
3793var redux_1 = __webpack_require__(3);
3794
3795var index_1 = __importDefault(__webpack_require__(4));
3796
3797var Store =
3798/** @class */
3799function () {
3800  function Store() {
3801    this._store = redux_1.createStore(index_1.default, window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__());
3802  }
3803  /**
3804   * Subscribe store to function call (wrapped Redux method)
3805   */
3806
3807
3808  Store.prototype.subscribe = function (onChange) {
3809    this._store.subscribe(onChange);
3810  };
3811  /**
3812   * Dispatch event to store (wrapped Redux method)
3813   */
3814
3815
3816  Store.prototype.dispatch = function (action) {
3817    this._store.dispatch(action);
3818  };
3819
3820  Object.defineProperty(Store.prototype, "state", {
3821    /**
3822     * Get store object (wrapping Redux method)
3823     */
3824    get: function get() {
3825      return this._store.getState();
3826    },
3827    enumerable: true,
3828    configurable: true
3829  });
3830  Object.defineProperty(Store.prototype, "items", {
3831    /**
3832     * Get items from store
3833     */
3834    get: function get() {
3835      return this.state.items;
3836    },
3837    enumerable: true,
3838    configurable: true
3839  });
3840  Object.defineProperty(Store.prototype, "activeItems", {
3841    /**
3842     * Get active items from store
3843     */
3844    get: function get() {
3845      return this.items.filter(function (item) {
3846        return item.active === true;
3847      });
3848    },
3849    enumerable: true,
3850    configurable: true
3851  });
3852  Object.defineProperty(Store.prototype, "highlightedActiveItems", {
3853    /**
3854     * Get highlighted items from store
3855     */
3856    get: function get() {
3857      return this.items.filter(function (item) {
3858        return item.active && item.highlighted;
3859      });
3860    },
3861    enumerable: true,
3862    configurable: true
3863  });
3864  Object.defineProperty(Store.prototype, "choices", {
3865    /**
3866     * Get choices from store
3867     */
3868    get: function get() {
3869      return this.state.choices;
3870    },
3871    enumerable: true,
3872    configurable: true
3873  });
3874  Object.defineProperty(Store.prototype, "activeChoices", {
3875    /**
3876     * Get active choices from store
3877     */
3878    get: function get() {
3879      return this.choices.filter(function (choice) {
3880        return choice.active === true;
3881      });
3882    },
3883    enumerable: true,
3884    configurable: true
3885  });
3886  Object.defineProperty(Store.prototype, "selectableChoices", {
3887    /**
3888     * Get selectable choices from store
3889     */
3890    get: function get() {
3891      return this.choices.filter(function (choice) {
3892        return choice.disabled !== true;
3893      });
3894    },
3895    enumerable: true,
3896    configurable: true
3897  });
3898  Object.defineProperty(Store.prototype, "searchableChoices", {
3899    /**
3900     * Get choices that can be searched (excluding placeholders)
3901     */
3902    get: function get() {
3903      return this.selectableChoices.filter(function (choice) {
3904        return choice.placeholder !== true;
3905      });
3906    },
3907    enumerable: true,
3908    configurable: true
3909  });
3910  Object.defineProperty(Store.prototype, "placeholderChoice", {
3911    /**
3912     * Get placeholder choice from store
3913     */
3914    get: function get() {
3915      return __spreadArrays(this.choices).reverse().find(function (choice) {
3916        return choice.placeholder === true;
3917      });
3918    },
3919    enumerable: true,
3920    configurable: true
3921  });
3922  Object.defineProperty(Store.prototype, "groups", {
3923    /**
3924     * Get groups from store
3925     */
3926    get: function get() {
3927      return this.state.groups;
3928    },
3929    enumerable: true,
3930    configurable: true
3931  });
3932  Object.defineProperty(Store.prototype, "activeGroups", {
3933    /**
3934     * Get active groups from store
3935     */
3936    get: function get() {
3937      var _a = this,
3938          groups = _a.groups,
3939          choices = _a.choices;
3940
3941      return groups.filter(function (group) {
3942        var isActive = group.active === true && group.disabled === false;
3943        var hasActiveOptions = choices.some(function (choice) {
3944          return choice.active === true && choice.disabled === false;
3945        });
3946        return isActive && hasActiveOptions;
3947      }, []);
3948    },
3949    enumerable: true,
3950    configurable: true
3951  });
3952  /**
3953   * Get loading state from store
3954   */
3955
3956  Store.prototype.isLoading = function () {
3957    return this.state.loading;
3958  };
3959  /**
3960   * Get single choice by it's ID
3961   */
3962
3963
3964  Store.prototype.getChoiceById = function (id) {
3965    return this.activeChoices.find(function (choice) {
3966      return choice.id === parseInt(id, 10);
3967    });
3968  };
3969  /**
3970   * Get group by group id
3971   */
3972
3973
3974  Store.prototype.getGroupById = function (id) {
3975    return this.groups.find(function (group) {
3976      return group.id === id;
3977    });
3978  };
3979
3980  return Store;
3981}();
3982
3983exports.default = Store;
3984
3985/***/ }),
3986/* 12 */
vendor: 1,232 bytes, lines 3987-4047
3987/***/ (function(module, exports) {
3988
3989var g;
3990
3991// This works in non-strict mode
3992g = (function() {
3993	return this;
3994})();
3995
3996try {
3997	// This works if eval is allowed (see CSP)
3998	g = g || new Function("return this")();
3999} catch (e) {
4000	// This works if the window reference is available
4001	if (typeof window === "object") g = window;
4002}
4003
4004// g can still be undefined, but nothing to do about it...
4005// We return undefined, instead of nothing here, so it's
4006// easier to handle this case. if(!global) { ...}
4007
4008module.exports = g;
4009
4010
4011/***/ }),
4012/* 13 */
4013/***/ (function(module, exports) {
4014
4015module.exports = function(originalModule) {
4016	if (!originalModule.webpackPolyfill) {
4017		var module = Object.create(originalModule);
4018		// module.parent = undefined by default
4019		if (!module.children) module.children = [];
4020		Object.defineProperty(module, "loaded", {
4021			enumerable: true,
4022			get: function() {
4023				return module.l;
4024			}
4025		});
4026		Object.defineProperty(module, "id", {
4027			enumerable: true,
4028			get: function() {
4029				return module.i;
4030			}
4031		});
4032		Object.defineProperty(module, "exports", {
4033			enumerable: true
4034		});
4035		module.webpackPolyfill = 1;
4036	}
4037	return module;
4038};
4039
4040
4041/***/ }),
4042/* 14 */
4043/***/ (function(module, exports, __webpack_require__) {
4044
4045"use strict";
4046
4047
4048var __spreadArrays = this && this.__spreadArrays || function () {
4049  for (var s = 0, i = 0, il = arguments.length; i < il; i++) {
4050    s += arguments[i].length;
4051  }
4052
4053  for (var r = Array(s), k = 0, i = 0; i < il; i++) {
4054    for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) {
4055      r[k] = a[j];
4056    }
4057  }
4058
4059  return r;
4060};
4061
4062Object.defineProperty(exports, "__esModule", {
4063  value: true
4064});
4065exports.defaultState = [];
4066
4067function items(state, action) {
4068  if (state === void 0) {
4069    state = exports.defaultState;
4070  }
4071
4072  switch (action.type) {
4073    case 'ADD_ITEM':
4074      {
4075        var addItemAction = action; // Add object to items array
4076
4077        var newState = __spreadArrays(state, [{
4078          id: addItemAction.id,
4079          choiceId: addItemAction.choiceId,
4080          groupId: addItemAction.groupId,
4081          value: addItemAction.value,
4082          label: addItemAction.label,
4083          active: true,
4084          highlighted: false,
4085          customProperties: addItemAction.customProperties,
4086          placeholder: addItemAction.placeholder || false,
4087          keyCode: null
4088        }]);
4089
4090        return newState.map(function (obj) {
4091          var item = obj;
4092          item.highlighted = false;
4093          return item;
4094        });
4095      }
4096
4097    case 'REMOVE_ITEM':
4098      {
4099        // Set item to inactive
4100        return state.map(function (obj) {
4101          var item = obj;
4102
4103          if (item.id === action.id) {
4104            item.active = false;
4105          }
4106
4107          return item;
4108        });
4109      }
4110
4111    case 'HIGHLIGHT_ITEM':
4112      {
4113        var highlightItemAction_1 = action;
4114        return state.map(function (obj) {
4115          var item = obj;
4116
4117          if (item.id === highlightItemAction_1.id) {
4118            item.highlighted = highlightItemAction_1.highlighted;
4119          }
4120
4121          return item;
4122        });
4123      }
4124
4125    default:
4126      {
4127        return state;
4128      }
4129  }
4130}
4131
4132exports.default = items;
4133
4134/***/ }),
4135/* 15 */
4136/***/ (function(module, exports, __webpack_require__) {
4137
4138"use strict";
4139
4140
4141var __spreadArrays = this && this.__spreadArrays || function () {
4142  for (var s = 0, i = 0, il = arguments.length; i < il; i++) {
4143    s += arguments[i].length;
4144  }
4145
4146  for (var r = Array(s), k = 0, i = 0; i < il; i++) {
4147    for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) {
4148      r[k] = a[j];
4149    }
4150  }
4151
4152  return r;
4153};
4154
4155Object.defineProperty(exports, "__esModule", {
4156  value: true
4157});
4158exports.defaultState = [];
4159
4160function groups(state, action) {
4161  if (state === void 0) {
4162    state = exports.defaultState;
4163  }
4164
4165  switch (action.type) {
4166    case 'ADD_GROUP':
4167      {
4168        var addGroupAction = action;
4169        return __spreadArrays(state, [{
4170          id: addGroupAction.id,
4171          value: addGroupAction.value,
4172          active: addGroupAction.active,
4173          disabled: addGroupAction.disabled
4174        }]);
4175      }
4176
4177    case 'CLEAR_CHOICES':
4178      {
4179        return [];
4180      }
4181
4182    default:
4183      {
4184        return state;
4185      }
4186  }
4187}
4188
4189exports.default = groups;
4190
4191/***/ }),
4192/* 16 */
4193/***/ (function(module, exports, __webpack_require__) {
4194
4195"use strict";
4196
4197
4198var __spreadArrays = this && this.__spreadArrays || function () {
4199  for (var s = 0, i = 0, il = arguments.length; i < il; i++) {
4200    s += arguments[i].length;
4201  }
4202
4203  for (var r = Array(s), k = 0, i = 0; i < il; i++) {
4204    for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++) {
4205      r[k] = a[j];
4206    }
4207  }
4208
4209  return r;
4210};
4211
4212Object.defineProperty(exports, "__esModule", {
4213  value: true
4214});
4215exports.defaultState = [];
4216
4217function choices(state, action) {
4218  if (state === void 0) {
4219    state = exports.defaultState;
4220  }
4221
4222  switch (action.type) {
4223    case 'ADD_CHOICE':
4224      {
4225        var addChoiceAction = action;
4226        var choice = {
4227          id: addChoiceAction.id,
4228          elementId: addChoiceAction.elementId,
4229          groupId: addChoiceAction.groupId,
4230          value: addChoiceAction.value,
4231          label: addChoiceAction.label || addChoiceAction.value,
4232          disabled: addChoiceAction.disabled || false,
4233          selected: false,
4234          active: true,
4235          score: 9999,
4236          customProperties: addChoiceAction.customProperties,
4237          placeholder: addChoiceAction.placeholder || false
4238        };
4239        /*
4240          A disabled choice appears in the choice dropdown but cannot be selected
4241          A selected choice has been added to the passed input's value (added as an item)
4242          An active choice appears within the choice dropdown
4243        */
4244
4245        return __spreadArrays(state, [choice]);
4246      }
4247
4248    case 'ADD_ITEM':
4249      {
4250        var addItemAction_1 = action; // When an item is added and it has an associated choice,
4251        // we want to disable it so it can't be chosen again
4252
4253        if (addItemAction_1.choiceId > -1) {
4254          return state.map(function (obj) {
4255            var choice = obj;
4256
4257            if (choice.id === parseInt("" + addItemAction_1.choiceId, 10)) {
4258              choice.selected = true;
4259            }
4260
4261            return choice;
4262          });
4263        }
4264
4265        return state;
4266      }
4267
4268    case 'REMOVE_ITEM':
4269      {
4270        var removeItemAction_1 = action; // When an item is removed and it has an associated choice,
4271        // we want to re-enable it so it can be chosen again
4272
4273        if (removeItemAction_1.choiceId && removeItemAction_1.choiceId > -1) {
4274          return state.map(function (obj) {
4275            var choice = obj;
4276
4277            if (choice.id === parseInt("" + removeItemAction_1.choiceId, 10)) {
4278              choice.selected = false;
4279            }
4280
4281            return choice;
4282          });
4283        }
4284
4285        return state;
4286      }
4287
4288    case 'FILTER_CHOICES':
4289      {
4290        var filterChoicesAction_1 = action;
4291        return state.map(function (obj) {
4292          var choice = obj; // Set active state based on whether choice is
4293          // within filtered results
4294
4295          choice.active = filterChoicesAction_1.results.some(function (_a) {
4296            var item = _a.item,
4297                score = _a.score;
4298
4299            if (item.id === choice.id) {
4300              choice.score = score;
4301              return true;
4302            }
4303
4304            return false;
4305          });
4306          return choice;
4307        });
4308      }
4309
4310    case 'ACTIVATE_CHOICES':
4311      {
4312        var activateChoicesAction_1 = action;
4313        return state.map(function (obj) {
4314          var choice = obj;
4315          choice.active = activateChoicesAction_1.active;
4316          return choice;
4317        });
4318      }
4319
4320    case 'CLEAR_CHOICES':
4321      {
4322        return exports.defaultState;
4323      }
4324
4325    default:
4326      {
4327        return state;
4328      }
4329  }
4330}
4331
4332exports.default = choices;
4333
4334/***/ }),
4335/* 17 */
4336/***/ (function(module, exports, __webpack_require__) {
4337
4338"use strict";
4339
4340
4341Object.defineProperty(exports, "__esModule", {
4342  value: true
4343});
4344exports.defaultState = false;
4345
4346var general = function general(state, action) {
4347  if (state === void 0) {
4348    state = exports.defaultState;
4349  }
4350
4351  switch (action.type) {
4352    case 'SET_IS_LOADING':
4353      {
4354        return action.isLoading;
4355      }
4356
4357    default:
4358      {
4359        return state;
4360      }
4361  }
4362};
4363
4364exports.default = general;
4365
4366/***/ }),
4367/* 18 */
4368/***/ (function(module, exports, __webpack_require__) {
4369
4370"use strict";
4371
4372
4373var __importDefault = this && this.__importDefault || function (mod) {
4374  return mod && mod.__esModule ? mod : {
4375    "default": mod
4376  };
4377};
4378
4379Object.defineProperty(exports, "__esModule", {
4380  value: true
4381});
4382
4383var dropdown_1 = __importDefault(__webpack_require__(19));
4384
4385exports.Dropdown = dropdown_1.default;
4386
4387var container_1 = __importDefault(__webpack_require__(20));
4388
4389exports.Container = container_1.default;
4390
4391var input_1 = __importDefault(__webpack_require__(21));
4392
4393exports.Input = input_1.default;
4394
4395var list_1 = __importDefault(__webpack_require__(22));
4396
4397exports.List = list_1.default;
4398
4399var wrapped_input_1 = __importDefault(__webpack_require__(23));
4400
4401exports.WrappedInput = wrapped_input_1.default;
4402
4403var wrapped_select_1 = __importDefault(__webpack_require__(24));
4404
4405exports.WrappedSelect = wrapped_select_1.default;
4406
4407/***/ }),
4408/* 19 */
4409/***/ (function(module, exports, __webpack_require__) {
4410
4411"use strict";
4412
4413
4414Object.defineProperty(exports, "__esModule", {
4415  value: true
4416});
4417
4418var Dropdown =
4419/** @class */
4420function () {
4421  function Dropdown(_a) {
4422    var element = _a.element,
4423        type = _a.type,
4424        classNames = _a.classNames;
4425    this.element = element;
4426    this.classNames = classNames;
4427    this.type = type;
4428    this.isActive = false;
vendor: 4,305 bytes, lines 4429-4590
4429  }
4430
4431  Object.defineProperty(Dropdown.prototype, "distanceFromTopWindow", {
4432    /**
4433     * Bottom position of dropdown in viewport coordinates
4434     */
4435    get: function get() {
4436      return this.element.getBoundingClientRect().bottom;
4437    },
4438    enumerable: true,
4439    configurable: true
4440  });
4441
4442  Dropdown.prototype.getChild = function (selector) {
4443    return this.element.querySelector(selector);
4444  };
4445  /**
4446   * Show dropdown to user by adding active state class
4447   */
4448
4449
4450  Dropdown.prototype.show = function () {
4451    this.element.classList.add(this.classNames.activeState);
4452    this.element.setAttribute('aria-expanded', 'true');
4453    this.isActive = true;
4454    return this;
4455  };
4456  /**
4457   * Hide dropdown from user
4458   */
4459
4460
4461  Dropdown.prototype.hide = function () {
4462    this.element.classList.remove(this.classNames.activeState);
4463    this.element.setAttribute('aria-expanded', 'false');
4464    this.isActive = false;
4465    return this;
4466  };
4467
4468  return Dropdown;
4469}();
4470
4471exports.default = Dropdown;
4472
4473/***/ }),
4474/* 20 */
4475/***/ (function(module, exports, __webpack_require__) {
4476
4477"use strict";
4478
4479
4480Object.defineProperty(exports, "__esModule", {
4481  value: true
4482});
4483
4484var utils_1 = __webpack_require__(1);
4485
4486var constants_1 = __webpack_require__(0);
4487
4488var Container =
4489/** @class */
4490function () {
4491  function Container(_a) {
4492    var element = _a.element,
4493        type = _a.type,
4494        classNames = _a.classNames,
4495        position = _a.position;
4496    this.element = element;
4497    this.classNames = classNames;
4498    this.type = type;
4499    this.position = position;
4500    this.isOpen = false;
4501    this.isFlipped = false;
4502    this.isFocussed = false;
4503    this.isDisabled = false;
4504    this.isLoading = false;
4505    this._onFocus = this._onFocus.bind(this);
4506    this._onBlur = this._onBlur.bind(this);
4507  }
4508
4509  Container.prototype.addEventListeners = function () {
4510    this.element.addEventListener('focus', this._onFocus);
4511    this.element.addEventListener('blur', this._onBlur);
4512  };
4513
4514  Container.prototype.removeEventListeners = function () {
4515    this.element.removeEventListener('focus', this._onFocus);
4516    this.element.removeEventListener('blur', this._onBlur);
4517  };
4518  /**
4519   * Determine whether container should be flipped based on passed
4520   * dropdown position
4521   */
4522
4523
4524  Container.prototype.shouldFlip = function (dropdownPos) {
4525    if (typeof dropdownPos !== 'number') {
4526      return false;
4527    } // If flip is enabled and the dropdown bottom position is
4528    // greater than the window height flip the dropdown.
4529
4530
4531    var shouldFlip = false;
4532
4533    if (this.position === 'auto') {
4534      shouldFlip = !window.matchMedia("(min-height: " + (dropdownPos + 1) + "px)").matches;
4535    } else if (this.position === 'top') {
4536      shouldFlip = true;
4537    }
4538
4539    return shouldFlip;
4540  };
4541
4542  Container.prototype.setActiveDescendant = function (activeDescendantID) {
4543    this.element.setAttribute('aria-activedescendant', activeDescendantID);
4544  };
4545
4546  Container.prototype.removeActiveDescendant = function () {
4547    this.element.removeAttribute('aria-activedescendant');
4548  };
4549
4550  Container.prototype.open = function (dropdownPos) {
4551    this.element.classList.add(this.classNames.openState);
4552    this.element.setAttribute('aria-expanded', 'true');
4553    this.isOpen = true;
4554
4555    if (this.shouldFlip(dropdownPos)) {
4556      this.element.classList.add(this.classNames.flippedState);
4557      this.isFlipped = true;
4558    }
4559  };
4560
4561  Container.prototype.close = function () {
4562    this.element.classList.remove(this.classNames.openState);
4563    this.element.setAttribute('aria-expanded', 'false');
4564    this.removeActiveDescendant();
4565    this.isOpen = false; // A dropdown flips if it does not have space within the page
4566
4567    if (this.isFlipped) {
4568      this.element.classList.remove(this.classNames.flippedState);
4569      this.isFlipped = false;
4570    }
4571  };
4572
4573  Container.prototype.focus = function () {
4574    if (!this.isFocussed) {
4575      this.element.focus();
4576    }
4577  };
4578
4579  Container.prototype.addFocusState = function () {
4580    this.element.classList.add(this.classNames.focusState);
4581  };
4582
4583  Container.prototype.removeFocusState = function () {
4584    this.element.classList.remove(this.classNames.focusState);
4585  };
4586
4587  Container.prototype.enable = function () {
4588    this.element.classList.remove(this.classNames.disabledState);
4589    this.element.removeAttribute('aria-disabled');
4590
4591    if (this.type === constants_1.SELECT_ONE_TYPE) {
4592      this.element.setAttribute('tabindex', '0');
4593    }
4594
4595    this.isDisabled = false;
4596  };
4597
4598  Container.prototype.disable = function () {
4599    this.element.classList.add(this.classNames.disabledState);
4600    this.element.setAttribute('aria-disabled', 'true');
4601
4602    if (this.type === constants_1.SELECT_ONE_TYPE) {
4603      this.element.setAttribute('tabindex', '-1');
4604    }
4605
4606    this.isDisabled = true;
4607  };
4608
4609  Container.prototype.wrap = function (element) {
4610    utils_1.wrap(element, this.element);
4611  };
4612
4613  Container.prototype.unwrap = function (element) {
4614    if (this.element.parentNode) {
4615      // Move passed element outside this element
4616      this.element.parentNode.insertBefore(element, this.element); // Remove this element
4617
4618      this.element.parentNode.removeChild(this.element);
4619    }
4620  };
4621
4622  Container.prototype.addLoadingState = function () {
4623    this.element.classList.add(this.classNames.loadingState);
4624    this.element.setAttribute('aria-busy', 'true');
4625    this.isLoading = true;
4626  };
4627
4628  Container.prototype.removeLoadingState = function () {
4629    this.element.classList.remove(this.classNames.loadingState);
4630    this.element.removeAttribute('aria-busy');
4631    this.isLoading = false;
4632  };
4633
4634  Container.prototype._onFocus = function () {
4635    this.isFocussed = true;
4636  };
4637
4638  Container.prototype._onBlur = function () {
4639    this.isFocussed = false;
4640  };
4641
4642  return Container;
4643}();
4644
4645exports.default = Container;
4646
4647/***/ }),
4648/* 21 */
4649/***/ (function(module, exports, __webpack_require__) {
4650
4651"use strict";
4652
4653
4654Object.defineProperty(exports, "__esModule", {
4655  value: true
4656});
4657
4658var utils_1 = __webpack_require__(1);
4659
4660var constants_1 = __webpack_require__(0);
4661
4662var Input =
4663/** @class */
4664function () {
4665  function Input(_a) {
4666    var element = _a.element,
4667        type = _a.type,
4668        classNames = _a.classNames,
4669        preventPaste = _a.preventPaste;
4670    this.element = element;
4671    this.type = type;
4672    this.classNames = classNames;
4673    this.preventPaste = preventPaste;
4674    this.isFocussed = this.element.isEqualNode(document.activeElement);
4675    this.isDisabled = element.disabled;
4676    this._onPaste = this._onPaste.bind(this);
4677    this._onInput = this._onInput.bind(this);
4678    this._onFocus = this._onFocus.bind(this);
4679    this._onBlur = this._onBlur.bind(this);
4680  }
4681
4682  Object.defineProperty(Input.prototype, "placeholder", {
4683    set: function set(placeholder) {
4684      this.element.placeholder = placeholder;
4685    },
4686    enumerable: true,
4687    configurable: true
4688  });
4689  Object.defineProperty(Input.prototype, "value", {
4690    get: function get() {
4691      return utils_1.sanitise(this.element.value);
4692    },
4693    set: function set(value) {
4694      this.element.value = value;
4695    },
4696    enumerable: true,
4697    configurable: true
4698  });
4699
4700  Input.prototype.addEventListeners = function () {
4701    this.element.addEventListener('paste', this._onPaste);
4702    this.element.addEventListener('input', this._onInput, {
4703      passive: true
4704    });
4705    this.element.addEventListener('focus', this._onFocus, {
4706      passive: true
4707    });
4708    this.element.addEventListener('blur', this._onBlur, {
4709      passive: true
4710    });
4711  };
4712
4713  Input.prototype.removeEventListeners = function () {
4714    this.element.removeEventListener('input', this._onInput);
4715    this.element.removeEventListener('paste', this._onPaste);
4716    this.element.removeEventListener('focus', this._onFocus);
4717    this.element.removeEventListener('blur', this._onBlur);
4718  };
4719
4720  Input.prototype.enable = function () {
4721    this.element.removeAttribute('disabled');
4722    this.isDisabled = false;
4723  };
4724
4725  Input.prototype.disable = function () {
4726    this.element.setAttribute('disabled', '');
4727    this.isDisabled = true;
4728  };
4729
4730  Input.prototype.focus = function () {
4731    if (!this.isFocussed) {
4732      this.element.focus();
4733    }
4734  };
4735
4736  Input.prototype.blur = function () {
4737    if (this.isFocussed) {
4738      this.element.blur();
4739    }
4740  };
4741
4742  Input.prototype.clear = function (setWidth) {
4743    if (setWidth === void 0) {
4744      setWidth = true;
4745    }
4746
4747    if (this.element.value) {
4748      this.element.value = '';
4749    }
4750
4751    if (setWidth) {
4752      this.setWidth();
4753    }
4754
4755    return this;
4756  };
4757  /**
4758   * Set the correct input width based on placeholder
4759   * value or input value
4760   */
4761
4762
4763  Input.prototype.setWidth = function () {
4764    // Resize input to contents or placeholder
4765    var _a = this.element,
4766        style = _a.style,
4767        value = _a.value,
4768        placeholder = _a.placeholder;
4769    style.minWidth = placeholder.length + 1 + "ch";
4770    style.width = value.length + 1 + "ch";
4771  };
4772
4773  Input.prototype.setActiveDescendant = function (activeDescendantID) {
4774    this.element.setAttribute('aria-activedescendant', activeDescendantID);
4775  };
4776
4777  Input.prototype.removeActiveDescendant = function () {
4778    this.element.removeAttribute('aria-activedescendant');
4779  };
4780
4781  Input.prototype._onInput = function () {
vendor: 10,221 bytes, lines 4782-5191
4782    if (this.type !== constants_1.SELECT_ONE_TYPE) {
4783      this.setWidth();
4784    }
4785  };
4786
4787  Input.prototype._onPaste = function (event) {
4788    if (this.preventPaste) {
4789      event.preventDefault();
4790    }
4791  };
4792
4793  Input.prototype._onFocus = function () {
4794    this.isFocussed = true;
4795  };
4796
4797  Input.prototype._onBlur = function () {
4798    this.isFocussed = false;
4799  };
4800
4801  return Input;
4802}();
4803
4804exports.default = Input;
4805
4806/***/ }),
4807/* 22 */
4808/***/ (function(module, exports, __webpack_require__) {
4809
4810"use strict";
4811
4812
4813Object.defineProperty(exports, "__esModule", {
4814  value: true
4815});
4816
4817var constants_1 = __webpack_require__(0);
4818
4819var List =
4820/** @class */
4821function () {
4822  function List(_a) {
4823    var element = _a.element;
4824    this.element = element;
4825    this.scrollPos = this.element.scrollTop;
4826    this.height = this.element.offsetHeight;
4827  }
4828
4829  List.prototype.clear = function () {
4830    this.element.innerHTML = '';
4831  };
4832
4833  List.prototype.append = function (node) {
4834    this.element.appendChild(node);
4835  };
4836
4837  List.prototype.getChild = function (selector) {
4838    return this.element.querySelector(selector);
4839  };
4840
4841  List.prototype.hasChildren = function () {
4842    return this.element.hasChildNodes();
4843  };
4844
4845  List.prototype.scrollToTop = function () {
4846    this.element.scrollTop = 0;
4847  };
4848
4849  List.prototype.scrollToChildElement = function (element, direction) {
4850    var _this = this;
4851
4852    if (!element) {
4853      return;
4854    }
4855
4856    var listHeight = this.element.offsetHeight; // Scroll position of dropdown
4857
4858    var listScrollPosition = this.element.scrollTop + listHeight;
4859    var elementHeight = element.offsetHeight; // Distance from bottom of element to top of parent
4860
4861    var elementPos = element.offsetTop + elementHeight; // Difference between the element and scroll position
4862
4863    var destination = direction > 0 ? this.element.scrollTop + elementPos - listScrollPosition : element.offsetTop;
4864    requestAnimationFrame(function () {
4865      _this._animateScroll(destination, direction);
4866    });
4867  };
4868
4869  List.prototype._scrollDown = function (scrollPos, strength, destination) {
4870    var easing = (destination - scrollPos) / strength;
4871    var distance = easing > 1 ? easing : 1;
4872    this.element.scrollTop = scrollPos + distance;
4873  };
4874
4875  List.prototype._scrollUp = function (scrollPos, strength, destination) {
4876    var easing = (scrollPos - destination) / strength;
4877    var distance = easing > 1 ? easing : 1;
4878    this.element.scrollTop = scrollPos - distance;
4879  };
4880
4881  List.prototype._animateScroll = function (destination, direction) {
4882    var _this = this;
4883
4884    var strength = constants_1.SCROLLING_SPEED;
4885    var choiceListScrollTop = this.element.scrollTop;
4886    var continueAnimation = false;
4887
4888    if (direction > 0) {
4889      this._scrollDown(choiceListScrollTop, strength, destination);
4890
4891      if (choiceListScrollTop < destination) {
4892        continueAnimation = true;
4893      }
4894    } else {
4895      this._scrollUp(choiceListScrollTop, strength, destination);
4896
4897      if (choiceListScrollTop > destination) {
4898        continueAnimation = true;
4899      }
4900    }
4901
4902    if (continueAnimation) {
4903      requestAnimationFrame(function () {
4904        _this._animateScroll(destination, direction);
4905      });
4906    }
4907  };
4908
4909  return List;
4910}();
4911
4912exports.default = List;
4913
4914/***/ }),
4915/* 23 */
4916/***/ (function(module, exports, __webpack_require__) {
4917
4918"use strict";
4919
4920
4921var __extends = this && this.__extends || function () {
4922  var _extendStatics = function extendStatics(d, b) {
4923    _extendStatics = Object.setPrototypeOf || {
4924      __proto__: []
4925    } instanceof Array && function (d, b) {
4926      d.__proto__ = b;
4927    } || function (d, b) {
4928      for (var p in b) {
4929        if (b.hasOwnProperty(p)) d[p] = b[p];
4930      }
4931    };
4932
4933    return _extendStatics(d, b);
4934  };
4935
4936  return function (d, b) {
4937    _extendStatics(d, b);
4938
4939    function __() {
4940      this.constructor = d;
4941    }
4942
4943    d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
4944  };
4945}();
4946
4947var __importDefault = this && this.__importDefault || function (mod) {
4948  return mod && mod.__esModule ? mod : {
4949    "default": mod
4950  };
4951};
4952
4953Object.defineProperty(exports, "__esModule", {
4954  value: true
4955});
4956
4957var wrapped_element_1 = __importDefault(__webpack_require__(5));
4958
4959var WrappedInput =
4960/** @class */
4961function (_super) {
4962  __extends(WrappedInput, _super);
4963
4964  function WrappedInput(_a) {
4965    var element = _a.element,
4966        classNames = _a.classNames,
4967        delimiter = _a.delimiter;
4968
4969    var _this = _super.call(this, {
4970      element: element,
4971      classNames: classNames
4972    }) || this;
4973
4974    _this.delimiter = delimiter;
4975    return _this;
4976  }
4977
4978  Object.defineProperty(WrappedInput.prototype, "value", {
4979    get: function get() {
4980      return this.element.value;
4981    },
4982    set: function set(value) {
4983      this.element.setAttribute('value', value);
4984      this.element.value = value;
4985    },
4986    enumerable: true,
4987    configurable: true
4988  });
4989  return WrappedInput;
4990}(wrapped_element_1.default);
4991
4992exports.default = WrappedInput;
4993
4994/***/ }),
4995/* 24 */
4996/***/ (function(module, exports, __webpack_require__) {
4997
4998"use strict";
4999
5000
5001var __extends = this && this.__extends || function () {
5002  var _extendStatics = function extendStatics(d, b) {
5003    _extendStatics = Object.setPrototypeOf || {
5004      __proto__: []
5005    } instanceof Array && function (d, b) {
5006      d.__proto__ = b;
5007    } || function (d, b) {
5008      for (var p in b) {
5009        if (b.hasOwnProperty(p)) d[p] = b[p];
5010      }
5011    };
5012
5013    return _extendStatics(d, b);
5014  };
5015
5016  return function (d, b) {
5017    _extendStatics(d, b);
5018
5019    function __() {
5020      this.constructor = d;
5021    }
5022
5023    d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
5024  };
5025}();
5026
5027var __importDefault = this && this.__importDefault || function (mod) {
5028  return mod && mod.__esModule ? mod : {
5029    "default": mod
5030  };
5031};
5032
5033Object.defineProperty(exports, "__esModule", {
5034  value: true
5035});
5036
5037var wrapped_element_1 = __importDefault(__webpack_require__(5));
5038
5039var WrappedSelect =
5040/** @class */
5041function (_super) {
5042  __extends(WrappedSelect, _super);
5043
5044  function WrappedSelect(_a) {
5045    var element = _a.element,
5046        classNames = _a.classNames,
5047        template = _a.template;
5048
5049    var _this = _super.call(this, {
5050      element: element,
5051      classNames: classNames
5052    }) || this;
5053
5054    _this.template = template;
5055    return _this;
5056  }
5057
5058  Object.defineProperty(WrappedSelect.prototype, "placeholderOption", {
5059    get: function get() {
5060      return this.element.querySelector('option[value=""]') || // Backward compatibility layer for the non-standard placeholder attribute supported in older versions.
5061      this.element.querySelector('option[placeholder]');
5062    },
5063    enumerable: true,
5064    configurable: true
5065  });
5066  Object.defineProperty(WrappedSelect.prototype, "optionGroups", {
5067    get: function get() {
5068      return Array.from(this.element.getElementsByTagName('OPTGROUP'));
5069    },
5070    enumerable: true,
5071    configurable: true
5072  });
5073  Object.defineProperty(WrappedSelect.prototype, "options", {
5074    get: function get() {
5075      return Array.from(this.element.options);
5076    },
5077    set: function set(options) {
5078      var _this = this;
5079
5080      var fragment = document.createDocumentFragment();
5081
5082      var addOptionToFragment = function addOptionToFragment(data) {
5083        // Create a standard select option
5084        var option = _this.template(data); // Append it to fragment
5085
5086
5087        fragment.appendChild(option);
5088      }; // Add each list item to list
5089
5090
5091      options.forEach(function (optionData) {
5092        return addOptionToFragment(optionData);
5093      });
5094      this.appendDocFragment(fragment);
5095    },
5096    enumerable: true,
5097    configurable: true
5098  });
5099
5100  WrappedSelect.prototype.appendDocFragment = function (fragment) {
5101    this.element.innerHTML = '';
5102    this.element.appendChild(fragment);
5103  };
5104
5105  return WrappedSelect;
5106}(wrapped_element_1.default);
5107
5108exports.default = WrappedSelect;
5109
5110/***/ }),
5111/* 25 */
5112/***/ (function(module, exports, __webpack_require__) {
5113
5114"use strict";
5115
5116
5117Object.defineProperty(exports, "__esModule", {
5118  value: true
5119});
5120/**
5121 * Helpers to create HTML elements used by Choices
5122 * Can be overridden by providing `callbackOnCreateTemplates` option
5123 */
5124
5125var templates = {
5126  containerOuter: function containerOuter(_a, dir, isSelectElement, isSelectOneElement, searchEnabled, passedElementType) {
5127    var containerOuter = _a.containerOuter;
5128    var div = Object.assign(document.createElement('div'), {
5129      className: containerOuter
5130    });
5131    div.dataset.type = passedElementType;
5132
5133    if (dir) {
5134      div.dir = dir;
5135    }
5136
5137    if (isSelectOneElement) {
5138      div.tabIndex = 0;
5139    }
5140
5141    if (isSelectElement) {
5142      div.setAttribute('role', searchEnabled ? 'combobox' : 'listbox');
5143
5144      if (searchEnabled) {
5145        div.setAttribute('aria-autocomplete', 'list');
5146      }
5147    }
5148
5149    div.setAttribute('aria-haspopup', 'true');
5150    div.setAttribute('aria-expanded', 'false');
5151    return div;
5152  },
5153  containerInner: function containerInner(_a) {
5154    var containerInner = _a.containerInner;
5155    return Object.assign(document.createElement('div'), {
5156      className: containerInner
5157    });
5158  },
5159  itemList: function itemList(_a, isSelectOneElement) {
5160    var list = _a.list,
5161        listSingle = _a.listSingle,
5162        listItems = _a.listItems;
5163    return Object.assign(document.createElement('div'), {
5164      className: list + " " + (isSelectOneElement ? listSingle : listItems)
5165    });
5166  },
5167  placeholder: function placeholder(_a, value) {
5168    var placeholder = _a.placeholder;
5169    return Object.assign(document.createElement('div'), {
5170      className: placeholder,
5171      innerHTML: value
5172    });
5173  },
5174  item: function item(_a, _b, removeItemButton) {
5175    var item = _a.item,
5176        button = _a.button,
5177        highlightedState = _a.highlightedState,
5178        itemSelectable = _a.itemSelectable,
5179        placeholder = _a.placeholder;
5180    var id = _b.id,
5181        value = _b.value,
5182        label = _b.label,
5183        customProperties = _b.customProperties,
5184        active = _b.active,
5185        disabled = _b.disabled,
5186        highlighted = _b.highlighted,
5187        isPlaceholder = _b.placeholder;
5188    var div = Object.assign(document.createElement('div'), {
5189      className: item,
5190      innerHTML: label
5191    });
5192    Object.assign(div.dataset, {
5193      item: '',
5194      id: id,
5195      value: value,
5196      customProperties: customProperties
5197    });
5198
5199    if (active) {
5200      div.setAttribute('aria-selected', 'true');
5201    }
5202
5203    if (disabled) {
5204      div.setAttribute('aria-disabled', 'true');
5205    }
5206
5207    if (isPlaceholder) {
5208      div.classList.add(placeholder);
5209    }
5210
5211    div.classList.add(highlighted ? highlightedState : itemSelectable);
5212
5213    if (removeItemButton) {
5214      if (disabled) {
5215        div.classList.remove(itemSelectable);
5216      }
5217
5218      div.dataset.deletable = '';
5219      /** @todo This MUST be localizable, not hardcoded! */
5220
5221      var REMOVE_ITEM_TEXT = 'Remove item';
5222      var removeButton = Object.assign(document.createElement('button'), {
5223        type: 'button',
5224        className: button,
5225        innerHTML: REMOVE_ITEM_TEXT
5226      });
5227      removeButton.setAttribute('aria-label', REMOVE_ITEM_TEXT + ": '" + value + "'");
5228      removeButton.dataset.button = '';
5229      div.appendChild(removeButton);
5230    }
5231
5232    return div;
5233  },
5234  choiceList: function choiceList(_a, isSelectOneElement) {
5235    var list = _a.list;
5236    var div = Object.assign(document.createElement('div'), {
5237      className: list
5238    });
5239
5240    if (!isSelectOneElement) {
5241      div.setAttribute('aria-multiselectable', 'true');
5242    }
5243
5244    div.setAttribute('role', 'listbox');
5245    return div;
5246  },
5247  choiceGroup: function choiceGroup(_a, _b) {
5248    var group = _a.group,
5249        groupHeading = _a.groupHeading,
5250        itemDisabled = _a.itemDisabled;
5251    var id = _b.id,
5252        value = _b.value,
5253        disabled = _b.disabled;
5254    var div = Object.assign(document.createElement('div'), {
5255      className: group + " " + (disabled ? itemDisabled : '')
5256    });
5257    div.setAttribute('role', 'group');
5258    Object.assign(div.dataset, {
5259      group: '',
5260      id: id,
5261      value: value
5262    });
5263
5264    if (disabled) {
5265      div.setAttribute('aria-disabled', 'true');
5266    }
5267
5268    div.appendChild(Object.assign(document.createElement('div'), {
5269      className: groupHeading,
5270      innerHTML: value
5271    }));
5272    return div;
5273  },
5274  choice: function choice(_a, _b, selectText) {
5275    var item = _a.item,
5276        itemChoice = _a.itemChoice,
5277        itemSelectable = _a.itemSelectable,
5278        selectedState = _a.selectedState,
5279        itemDisabled = _a.itemDisabled,
5280        placeholder = _a.placeholder;
5281    var id = _b.id,
5282        value = _b.value,
5283        label = _b.label,
5284        groupId = _b.groupId,
5285        elementId = _b.elementId,
5286        isDisabled = _b.disabled,
5287        isSelected = _b.selected,
5288        isPlaceholder = _b.placeholder;
5289    var div = Object.assign(document.createElement('div'), {
5290      id: elementId,
5291      innerHTML: label,
5292      className: item + " " + itemChoice
5293    });
5294
5295    if (isSelected) {
5296      div.classList.add(selectedState);
5297    }
5298
5299    if (isPlaceholder) {
5300      div.classList.add(placeholder);
5301    }
5302
5303    div.setAttribute('role', groupId && groupId > 0 ? 'treeitem' : 'option');
5304    Object.assign(div.dataset, {
5305      choice: '',
5306      id: id,
5307      value: value,
5308      selectText: selectText
5309    });
5310
5311    if (isDisabled) {
5312      div.classList.add(itemDisabled);
5313      div.dataset.choiceDisabled = '';
5314      div.setAttribute('aria-disabled', 'true');
5315    } else {
5316      div.classList.add(itemSelectable);
5317      div.dataset.choiceSelectable = '';
5318    }
5319
5320    return div;
5321  },
5322  input: function input(_a, placeholderValue) {
5323    var input = _a.input,
5324        inputCloned = _a.inputCloned;
5325    var inp = Object.assign(document.createElement('input'), {
5326      type: 'text',
5327      className: input + " " + inputCloned,
5328      autocomplete: 'off',
5329      autocapitalize: 'off',
5330      spellcheck: false
5331    });
5332
5333	inp.setAttribute('maxlength', '30');
5334    inp.setAttribute('role', 'textbox');
5335    inp.setAttribute('aria-autocomplete', 'list');
5336    inp.setAttribute('aria-label', placeholderValue);
5337    return inp;
5338  },
5339  dropdown: function dropdown(_a) {
5340    var list = _a.list,
5341        listDropdown = _a.listDropdown;
5342    var div = document.createElement('div');
5343    div.classList.add(list, listDropdown);
5344    div.setAttribute('aria-expanded', 'false');
5345    return div;
5346  },
5347  notice: function notice(_a, innerHTML, type) {
5348    var item = _a.item,
5349        itemChoice = _a.itemChoice,
5350        noResults = _a.noResults,
5351        noChoices = _a.noChoices;
5352
5353    if (type === void 0) {
5354      type = '';
5355    }
5356
5357    var classes = [item, itemChoice];
5358
5359    if (type === 'no-choices') {
5360      classes.push(noChoices);
5361    } else if (type === 'no-results') {
5362      classes.push(noResults);
5363    }
5364
5365    return Object.assign(document.createElement('div'), {
5366      innerHTML: innerHTML,
5367      className: classes.join(' ')
5368    });
5369  },
5370  option: function option(_a) {
5371    var label = _a.label,
5372        value = _a.value,
5373        customProperties = _a.customProperties,
5374        active = _a.active,
5375        disabled = _a.disabled;
5376    var opt = new Option(label, value, false, active);
5377
5378    if (customProperties) {
5379      opt.dataset.customProperties = "" + customProperties;
5380    }
5381
5382    opt.disabled = !!disabled;
5383    return opt;
5384  }
5385};
5386exports.default = templates;
5387
5388/***/ }),
5389/* 26 */
5390/***/ (function(module, exports, __webpack_require__) {
5391
5392"use strict";
5393
5394
5395Object.defineProperty(exports, "__esModule", {
5396  value: true
5397});
5398
5399var constants_1 = __webpack_require__(0);
5400
5401exports.addChoice = function (_a) {
5402  var value = _a.value,
5403      label = _a.label,
5404      id = _a.id,
5405      groupId = _a.groupId,
5406      disabled = _a.disabled,
5407      elementId = _a.elementId,
5408      customProperties = _a.customProperties,
5409      placeholder = _a.placeholder,
5410      keyCode = _a.keyCode;
5411  return {
5412    type: constants_1.ACTION_TYPES.ADD_CHOICE,
5413    value: value,
5414    label: label,
5415    id: id,
5416    groupId: groupId,
5417    disabled: disabled,
5418    elementId: elementId,
5419    customProperties: customProperties,
5420    placeholder: placeholder,
5421    keyCode: keyCode
5422  };
5423};
5424
5425exports.filterChoices = function (results) {
5426  return {
5427    type: constants_1.ACTION_TYPES.FILTER_CHOICES,
5428    results: results
5429  };
5430};
5431
5432exports.activateChoices = function (active) {
5433  if (active === void 0) {
5434    active = true;
5435  }
5436
5437  return {
5438    type: constants_1.ACTION_TYPES.ACTIVATE_CHOICES,
5439    active: active
5440  };
5441};
5442
5443exports.clearChoices = function () {
5444  return {
5445    type: constants_1.ACTION_TYPES.CLEAR_CHOICES
5446  };
5447};
5448
5449/***/ }),
5450/* 27 */
5451/***/ (function(module, exports, __webpack_require__) {
5452
5453"use strict";
5454
5455
5456Object.defineProperty(exports, "__esModule", {
5457  value: true
5458});
5459
5460var constants_1 = __webpack_require__(0);
5461
5462exports.addItem = function (_a) {
5463  var value = _a.value,
5464      label = _a.label,
5465      id = _a.id,
5466      choiceId = _a.choiceId,
5467      groupId = _a.groupId,
5468      customProperties = _a.customProperties,
5469      placeholder = _a.placeholder,
5470      keyCode = _a.keyCode;
5471  return {
5472    type: constants_1.ACTION_TYPES.ADD_ITEM,
5473    value: value,
5474    label: label,
5475    id: id,
5476    choiceId: choiceId,
5477    groupId: groupId,
5478    customProperties: customProperties,
5479    placeholder: placeholder,
5480    keyCode: keyCode
5481  };
5482};
5483
5484exports.removeItem = function (id, choiceId) {
5485  return {
5486    type: constants_1.ACTION_TYPES.REMOVE_ITEM,
5487    id: id,
5488    choiceId: choiceId
5489  };
5490};
5491
5492exports.highlightItem = function (id, highlighted) {
5493  return {
5494    type: constants_1.ACTION_TYPES.HIGHLIGHT_ITEM,
5495    id: id,
5496    highlighted: highlighted
5497  };
5498};
5499
5500/***/ }),
5501/* 28 */
5502/***/ (function(module, exports, __webpack_require__) {
5503
5504"use strict";
5505
5506
5507Object.defineProperty(exports, "__esModule", {
5508  value: true
5509});
5510
5511var constants_1 = __webpack_require__(0);
5512
5513exports.addGroup = function (_a) {
5514  var value = _a.value,
5515      id = _a.id,
5516      active = _a.active,
5517      disabled = _a.disabled;
5518  return {
5519    type: constants_1.ACTION_TYPES.ADD_GROUP,
5520    value: value,
5521    id: id,
5522    active: active,
5523    disabled: disabled
5524  };
5525};
5526
5527/***/ }),
5528/* 29 */
5529/***/ (function(module, exports, __webpack_require__) {
5530
5531"use strict";
5532
5533
5534Object.defineProperty(exports, "__esModule", {
5535  value: true
5536});
5537
5538var constants_1 = __webpack_require__(0);
5539
5540exports.clearAll = function () {
5541  return {
5542    type: constants_1.ACTION_TYPES.CLEAR_ALL
5543  };
5544};
5545
5546exports.resetTo = function (state) {
5547  return {
5548    type: constants_1.ACTION_TYPES.RESET_TO,
5549    state: state
5550  };
5551};
5552
5553exports.setIsLoading = function (isLoading) {
5554  return {
5555    type: constants_1.ACTION_TYPES.SET_IS_LOADING,
5556    isLoading: isLoading
5557  };
5558};
5559
5560/***/ })
5561/******/ ])["default"];
5562});

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.