diff --git a/server.js b/server.js
index a125696..f1e937d 100644
--- a/server.js
+++ b/server.js
@@ -1,13 +1,13 @@
-let webpack = require('webpack');
-let WebpackDevServer = require('webpack-dev-server');
-let config = require('./webpack.config.dev');
-let opn = require('opn');
+const webpack = require('webpack');
+const WebpackDevServer = require('webpack-dev-server');
+const config = require('./webpack.config.dev');
+const opn = require('opn');
new WebpackDevServer(webpack(config), {
publicPath: config.output.publicPath,
historyApiFallback: true,
quiet: true, // lets WebpackDashboard do its thing
-}).listen(3001, 'localhost', (err, result) => {
+}).listen(3001, 'localhost', (err) => {
if (err) console.log(err);
opn('http://localhost:3001');
console.log('Listening at localhost:3001');
diff --git a/src/scripts/dist/choices.js b/src/scripts/dist/choices.js
index 6d41e04..95d870c 100644
--- a/src/scripts/dist/choices.js
+++ b/src/scripts/dist/choices.js
@@ -1,11 +1,15 @@
/*! choices.js v3.0.2 | (c) 2017 Josh Johnson | https://github.com/jshjohnson/Choices#readme */
(function webpackUniversalModuleDefinition(root, factory) {
+ //CommonJS2
if(typeof exports === 'object' && typeof module === 'object')
module.exports = factory();
+ //AMD
else if(typeof define === 'function' && define.amd)
define([], factory);
+ //CommonJS
else if(typeof exports === 'object')
exports["Choices"] = factory();
+ //Window
else
root["Choices"] = factory();
})(this, function() {
@@ -71,43 +75,735 @@ return /******/ (function(modules) { // webpackBootstrap
/******/ __webpack_require__.p = "/src/scripts/dist/";
/******/
/******/ // Load entry module and return exports
-/******/ return __webpack_require__(__webpack_require__.s = 1);
+/******/ return __webpack_require__(__webpack_require__.s = 5);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
-/***/ (function(module, exports) {
+/***/ (function(module, exports, __webpack_require__) {
-var g;
+"use strict";
-// This works in non-strict mode
-g = (function() {
- return this;
-})();
-try {
- // This works if eval is allowed (see CSP)
- g = g || Function("return this")() || (1,eval)("this");
-} catch(e) {
- // This works if the window reference is available
- if(typeof window === "object")
- g = window;
-}
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
-// g can still be undefined, but nothing to do about it...
-// We return undefined, instead of nothing here, so it's
-// easier to handle this case. if(!global) { ...}
+var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
-module.exports = g;
+/* eslint-disable */
+/**
+ * Capitalises the first letter of each word in a string
+ * @param {String} str String to capitalise
+ * @return {String} Capitalised string
+ */
+var capitalise = exports.capitalise = function capitalise(str) {
+ return str.replace(/\w\S*/g, function (txt) {
+ return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();
+ });
+};
+
+/**
+ * Generates a string of random chars
+ * @param {Number} length Length of the string to generate
+ * @return {String} String of random chars
+ */
+var generateChars = exports.generateChars = function generateChars(length) {
+ var chars = '';
+
+ for (var i = 0; i < length; i++) {
+ var randomChar = getRandomNumber(0, 36);
+ chars += randomChar.toString(36);
+ }
+
+ return chars;
+};
+
+/**
+ * Generates a unique id based on an element
+ * @param {HTMLElement} element Element to generate the id from
+ * @param {String} Prefix for the Id
+ * @return {String} Unique Id
+ */
+var generateId = exports.generateId = function generateId(element, prefix) {
+ var id = element.id || element.name && element.name + '-' + generateChars(2) || generateChars(4);
+ id = id.replace(/(:|\.|\[|\]|,)/g, '');
+ id = prefix + id;
+
+ return id;
+};
+
+/**
+ * Tests the type of an object
+ * @param {String} type Type to test object against
+ * @param {Object} obj Object to be tested
+ * @return {Boolean}
+ */
+var getType = exports.getType = function getType(obj) {
+ return Object.prototype.toString.call(obj).slice(8, -1);
+};
+
+/**
+ * Tests the type of an object
+ * @param {String} type Type to test object against
+ * @param {Object} obj Object to be tested
+ * @return {Boolean}
+ */
+var isType = exports.isType = function isType(type, obj) {
+ var clas = getType(obj);
+ return obj !== undefined && obj !== null && clas === type;
+};
+
+/**
+ * Tests to see if a passed object is a node
+ * @param {Object} obj Object to be tested
+ * @return {Boolean}
+ */
+var isNode = exports.isNode = function isNode(o) {
+ return (typeof Node === 'undefined' ? 'undefined' : _typeof(Node)) === 'object' ? o instanceof Node : o && (typeof o === 'undefined' ? 'undefined' : _typeof(o)) === 'object' && typeof o.nodeType === 'number' && typeof o.nodeName === 'string';
+};
+
+/**
+ * Tests to see if a passed object is an element
+ * @param {Object} obj Object to be tested
+ * @return {Boolean}
+ */
+var isElement = exports.isElement = function isElement(o) {
+ return (typeof HTMLElement === 'undefined' ? 'undefined' : _typeof(HTMLElement)) === 'object' ? o instanceof HTMLElement : // DOM2
+ o && (typeof o === 'undefined' ? 'undefined' : _typeof(o)) === 'object' && o !== null && o.nodeType === 1 && typeof o.nodeName === 'string';
+};
+
+/**
+ * Merges unspecified amount of objects into new object
+ * @private
+ * @return {Object} Merged object of arguments
+ */
+var extend = exports.extend = function extend() {
+ var extended = {};
+ var length = arguments.length;
+
+ /**
+ * Merge one object into another
+ * @param {Object} obj Object to merge into extended object
+ */
+ var merge = function merge(obj) {
+ for (var prop in obj) {
+ if (Object.prototype.hasOwnProperty.call(obj, prop)) {
+ // If deep merge and property is an object, merge properties
+ if (isType('Object', obj[prop])) {
+ extended[prop] = extend(true, extended[prop], obj[prop]);
+ } else {
+ extended[prop] = obj[prop];
+ }
+ }
+ }
+ };
+
+ // Loop through each passed argument
+ for (var i = 0; i < length; i++) {
+ // store argument at position i
+ var obj = arguments[i];
+
+ // If we are in fact dealing with an object, merge it.
+ if (isType('Object', obj)) {
+ merge(obj);
+ }
+ }
+
+ return extended;
+};
+
+/**
+ * CSS transition end event listener
+ * @return
+ */
+var whichTransitionEvent = exports.whichTransitionEvent = function whichTransitionEvent() {
+ var t = void 0,
+ el = document.createElement('fakeelement');
+
+ var transitions = {
+ transition: 'transitionend',
+ OTransition: 'oTransitionEnd',
+ MozTransition: 'transitionend',
+ WebkitTransition: 'webkitTransitionEnd'
+ };
+
+ for (t in transitions) {
+ if (el.style[t] !== undefined) {
+ return transitions[t];
+ }
+ }
+};
+
+/**
+ * CSS animation end event listener
+ * @return
+ */
+var whichAnimationEvent = exports.whichAnimationEvent = function whichAnimationEvent() {
+ var t = void 0,
+ el = document.createElement('fakeelement');
+
+ var animations = {
+ animation: 'animationend',
+ OAnimation: 'oAnimationEnd',
+ MozAnimation: 'animationend',
+ WebkitAnimation: 'webkitAnimationEnd'
+ };
+
+ for (t in animations) {
+ if (el.style[t] !== undefined) {
+ return animations[t];
+ }
+ }
+};
+
+/**
+ * Get the ancestors of each element in the current set of matched elements,
+ * up to but not including the element matched by the selector
+ * @param {NodeElement} elem Element to begin search from
+ * @param {NodeElement} parent Parent to find
+ * @param {String} selector Class to find
+ * @return {Array} Array of parent elements
+ */
+var getParentsUntil = exports.getParentsUntil = function getParentsUntil(elem, parent, selector) {
+ var parents = [];
+ // Get matches
+ for (; elem && elem !== document; elem = elem.parentNode) {
+ // Check if parent has been reached
+ if (parent) {
+ var parentType = parent.charAt(0);
+
+ // If parent is a class
+ if (parentType === '.') {
+ if (elem.classList.contains(parent.substr(1))) {
+ break;
+ }
+ }
+
+ // If parent is an ID
+ if (parentType === '#') {
+ if (elem.id === parent.substr(1)) {
+ break;
+ }
+ }
+
+ // If parent is a data attribute
+ if (parentType === '[') {
+ if (elem.hasAttribute(parent.substr(1, parent.length - 1))) {
+ break;
+ }
+ }
+
+ // If parent is a tag
+ if (elem.tagName.toLowerCase() === parent) {
+ break;
+ }
+ }
+ if (selector) {
+ var selectorType = selector.charAt(0);
+
+ // If selector is a class
+ if (selectorType === '.') {
+ if (elem.classList.contains(selector.substr(1))) {
+ parents.push(elem);
+ }
+ }
+
+ // If selector is an ID
+ if (selectorType === '#') {
+ if (elem.id === selector.substr(1)) {
+ parents.push(elem);
+ }
+ }
+
+ // If selector is a data attribute
+ if (selectorType === '[') {
+ if (elem.hasAttribute(selector.substr(1, selector.length - 1))) {
+ parents.push(elem);
+ }
+ }
+
+ // If selector is a tag
+ if (elem.tagName.toLowerCase() === selector) {
+ parents.push(elem);
+ }
+ } else {
+ parents.push(elem);
+ }
+ }
+
+ // Return parents if any exist
+ if (parents.length === 0) {
+ return null;
+ }
+ return parents;
+};
+
+var wrap = exports.wrap = function wrap(element, wrapper) {
+ wrapper = wrapper || document.createElement('div');
+ if (element.nextSibling) {
+ element.parentNode.insertBefore(wrapper, element.nextSibling);
+ } else {
+ element.parentNode.appendChild(wrapper);
+ }
+ return wrapper.appendChild(element);
+};
+
+var getSiblings = exports.getSiblings = function getSiblings(elem) {
+ var siblings = [];
+ var sibling = elem.parentNode.firstChild;
+ for (; sibling; sibling = sibling.nextSibling) {
+ if (sibling.nodeType === 1 && sibling !== elem) {
+ siblings.push(sibling);
+ }
+ }
+ return siblings;
+};
+
+/**
+ * Find ancestor in DOM tree
+ * @param {NodeElement} el Element to start search from
+ * @param {[type]} cls Class of parent
+ * @return {NodeElement} Found parent element
+ */
+var findAncestor = exports.findAncestor = function findAncestor(el, cls) {
+ while ((el = el.parentElement) && !el.classList.contains(cls)) {}
+ return el;
+};
+
+/**
+ * Find ancestor in DOM tree by attribute name
+ * @param {NodeElement} el Element to start search from
+ * @param {string} attr Attribute name of parent
+ * @return {?NodeElement} Found parent element or null
+ */
+var findAncestorByAttrName = exports.findAncestorByAttrName = function findAncestorByAttrName(el, attr) {
+ var target = el;
+
+ while (target) {
+ if (target.hasAttribute(attr)) {
+ return target;
+ }
+
+ target = target.parentElement;
+ }
+
+ return null;
+};
+
+/**
+ * Debounce an event handler.
+ * @param {Function} func Function to run after wait
+ * @param {Number} wait The delay before the function is executed
+ * @param {Boolean} immediate If passed, trigger the function on the leading edge, instead of the trailing.
+ * @return {Function} A function will be called after it stops being called for a given delay
+ */
+var debounce = exports.debounce = function debounce(func, wait, immediate) {
+ var timeout = void 0;
+ return function () {
+ var context = this,
+ args = arguments;
+ var later = function later() {
+ timeout = null;
+ if (!immediate) func.apply(context, args);
+ };
+ var callNow = immediate && !timeout;
+ clearTimeout(timeout);
+ timeout = setTimeout(later, wait);
+ if (callNow) func.apply(context, args);
+ };
+};
+
+/**
+ * Get an element's distance from the top of the page
+ * @private
+ * @param {NodeElement} el Element to test for
+ * @return {Number} Elements Distance from top of page
+ */
+var getElemDistance = exports.getElemDistance = function getElemDistance(el) {
+ var location = 0;
+ if (el.offsetParent) {
+ do {
+ location += el.offsetTop;
+ el = el.offsetParent;
+ } while (el);
+ }
+ return location >= 0 ? location : 0;
+};
+
+/**
+ * Determine element height multiplied by any offsets
+ * @private
+ * @param {HTMLElement} el Element to test for
+ * @return {Number} Height of element
+ */
+var getElementOffset = exports.getElementOffset = function getElementOffset(el, offset) {
+ var elOffset = offset;
+ if (elOffset > 1) elOffset = 1;
+ if (elOffset > 0) elOffset = 0;
+
+ return Math.max(el.offsetHeight * elOffset);
+};
+
+/**
+ * Get the next or previous element from a given start point
+ * @param {HTMLElement} startEl Element to start position from
+ * @param {String} className The class we will look through
+ * @param {Number} direction Positive next element, negative previous element
+ * @return {[HTMLElement} Found element
+ */
+var getAdjacentEl = exports.getAdjacentEl = function getAdjacentEl(startEl, className) {
+ var direction = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
+
+ if (!startEl || !className) return;
+
+ var parent = startEl.parentNode.parentNode;
+ var children = Array.from(parent.querySelectorAll(className));
+
+ var startPos = children.indexOf(startEl);
+ var operatorDirection = direction > 0 ? 1 : -1;
+
+ return children[startPos + operatorDirection];
+};
+
+/**
+ * Get scroll position based on top/bottom position
+ * @private
+ * @return {String} Position of scroll
+ */
+var getScrollPosition = exports.getScrollPosition = function getScrollPosition(position) {
+ if (position === 'bottom') {
+ // Scroll position from the bottom of the viewport
+ return Math.max((window.scrollY || window.pageYOffset) + (window.innerHeight || document.documentElement.clientHeight));
+ }
+ // Scroll position from the top of the viewport
+ return window.scrollY || window.pageYOffset;
+};
+
+/**
+ * Determine whether an element is within the viewport
+ * @param {HTMLElement} el Element to test
+ * @return {String} Position of scroll
+ * @return {Boolean}
+ */
+var isInView = exports.isInView = function isInView(el, position, offset) {
+ // If the user has scrolled further than the distance from the element to the top of its parent
+ return this.getScrollPosition(position) > this.getElemDistance(el) + this.getElementOffset(el, offset);
+};
+
+/**
+ * Determine whether an element is within
+ * @param {HTMLElement} el Element to test
+ * @param {HTMLElement} parent Scrolling parent
+ * @param {Number} direction Whether element is visible from above or below
+ * @return {Boolean}
+ */
+var isScrolledIntoView = exports.isScrolledIntoView = function isScrolledIntoView(el, parent) {
+ var direction = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
+
+ if (!el) return;
+
+ var isVisible = void 0;
+
+ if (direction > 0) {
+ // In view from bottom
+ isVisible = parent.scrollTop + parent.offsetHeight >= el.offsetTop + el.offsetHeight;
+ } else {
+ // In view from top
+ isVisible = el.offsetTop >= parent.scrollTop;
+ }
+
+ return isVisible;
+};
+
+/**
+ * Remove html tags from a string
+ * @param {String} Initial string/html
+ * @return {String} Sanitised string
+ */
+var stripHTML = exports.stripHTML = function stripHTML(html) {
+ var el = document.createElement('DIV');
+ el.innerHTML = html;
+ return el.textContent || el.innerText || '';
+};
+
+/**
+ * Adds animation to an element and removes it upon animation completion
+ * @param {Element} el Element to add animation to
+ * @param {String} animation Animation class to add to element
+ * @return
+ */
+var addAnimation = exports.addAnimation = function addAnimation(el, animation) {
+ var animationEvent = whichAnimationEvent();
+
+ var removeAnimation = function removeAnimation() {
+ el.classList.remove(animation);
+ el.removeEventListener(animationEvent, removeAnimation, false);
+ };
+
+ el.classList.add(animation);
+ el.addEventListener(animationEvent, removeAnimation, false);
+};
+
+/**
+ * Get a random number between a range
+ * @param {Number} min Minimum range
+ * @param {Number} max Maximum range
+ * @return {Number} Random number
+ */
+var getRandomNumber = exports.getRandomNumber = function getRandomNumber(min, max) {
+ return Math.floor(Math.random() * (max - min) + min);
+};
+
+/**
+ * Turn a string into a node
+ * @param {String} String to convert
+ * @return {HTMLElement} Converted node element
+ */
+var strToEl = exports.strToEl = function () {
+ var tmpEl = document.createElement('div');
+ return function (str) {
+ var cleanedInput = str.trim();
+ var r = void 0;
+ tmpEl.innerHTML = cleanedInput;
+ r = tmpEl.children[0];
+
+ while (tmpEl.firstChild) {
+ tmpEl.removeChild(tmpEl.firstChild);
+ }
+
+ return r;
+ };
+}();
+
+/**
+ * Sets the width of a passed input based on its value
+ * @return {Number} Width of input
+ */
+var getWidthOfInput = exports.getWidthOfInput = function getWidthOfInput(input) {
+ var value = input.value || input.placeholder;
+ var width = input.offsetWidth;
+
+ if (value) {
+ var testEl = strToEl('' + value + ' ');
+ testEl.style.position = 'absolute';
+ testEl.style.padding = '0';
+ testEl.style.top = '-9999px';
+ testEl.style.left = '-9999px';
+ testEl.style.width = 'auto';
+ testEl.style.whiteSpace = 'pre';
+
+ if (document.body.contains(input) && window.getComputedStyle) {
+ var inputStyle = window.getComputedStyle(input);
+
+ if (inputStyle) {
+ testEl.style.fontSize = inputStyle.fontSize;
+ testEl.style.fontFamily = inputStyle.fontFamily;
+ testEl.style.fontWeight = inputStyle.fontWeight;
+ testEl.style.fontStyle = inputStyle.fontStyle;
+ testEl.style.letterSpacing = inputStyle.letterSpacing;
+ testEl.style.textTransform = inputStyle.textTransform;
+ testEl.style.padding = inputStyle.padding;
+ }
+ }
+
+ document.body.appendChild(testEl);
+
+ if (value && testEl.offsetWidth !== input.offsetWidth) {
+ width = testEl.offsetWidth + 4;
+ }
+
+ document.body.removeChild(testEl);
+ }
+
+ return width + 'px';
+};
+
+/**
+ * Sorting function for current and previous string
+ * @param {String} a Current value
+ * @param {String} b Next value
+ * @return {Number} -1 for after previous,
+ * 1 for before,
+ * 0 for same location
+ */
+var sortByAlpha = exports.sortByAlpha = function sortByAlpha(a, b) {
+ var labelA = (a.label || a.value).toLowerCase();
+ var labelB = (b.label || b.value).toLowerCase();
+
+ if (labelA < labelB) return -1;
+ if (labelA > labelB) return 1;
+ return 0;
+};
+
+/**
+ * Sort by numeric score
+ * @param {Object} a Current value
+ * @param {Object} b Next value
+ * @return {Number} -1 for after previous,
+ * 1 for before,
+ * 0 for same location
+ */
+var sortByScore = exports.sortByScore = function sortByScore(a, b) {
+ return a.score - b.score;
+};
+
+/**
+ * Dispatch native event
+ * @param {NodeElement} element Element to trigger event on
+ * @param {String} type Type of event to trigger
+ * @param {Object} customArgs Data to pass with event
+ * @return {Object} Triggered event
+ */
+var dispatchEvent = exports.dispatchEvent = function dispatchEvent(element, type) {
+ var customArgs = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
+
+ var event = new CustomEvent(type, {
+ detail: customArgs,
+ bubbles: true,
+ cancelable: true
+ });
+
+ return element.dispatchEvent(event);
+};
+
+/**
+ * Tests value against a regular expression
+ * @param {string} value Value to test
+ * @return {Boolean} Whether test passed/failed
+ * @private
+ */
+var regexFilter = exports.regexFilter = function regexFilter(value, regex) {
+ if (!value || !regex) {
+ return false;
+ }
+
+ var expression = new RegExp(regex.source, 'i');
+ return expression.test(value);
+};
/***/ }),
/* 1 */
/***/ (function(module, exports, __webpack_require__) {
-module.exports = __webpack_require__(2);
+"use strict";
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+var DEFAULT_CLASSNAMES = exports.DEFAULT_CLASSNAMES = {
+ containerOuter: 'choices',
+ containerInner: 'choices__inner',
+ input: 'choices__input',
+ inputCloned: 'choices__input--cloned',
+ list: 'choices__list',
+ listItems: 'choices__list--multiple',
+ listSingle: 'choices__list--single',
+ listDropdown: 'choices__list--dropdown',
+ item: 'choices__item',
+ itemSelectable: 'choices__item--selectable',
+ itemDisabled: 'choices__item--disabled',
+ itemChoice: 'choices__item--choice',
+ placeholder: 'choices__placeholder',
+ group: 'choices__group',
+ groupHeading: 'choices__heading',
+ button: 'choices__button',
+ activeState: 'is-active',
+ focusState: 'is-focused',
+ openState: 'is-open',
+ disabledState: 'is-disabled',
+ highlightedState: 'is-highlighted',
+ hiddenState: 'is-hidden',
+ flippedState: 'is-flipped',
+ loadingState: 'is-loading',
+ noResults: 'has-no-results',
+ noChoices: 'has-no-choices'
+};
+
+var DEFAULT_CONFIG = exports.DEFAULT_CONFIG = {
+ silent: false,
+ renderChoiceLimit: -1,
+ maxItemCount: -1,
+ addItems: true,
+ removeItems: true,
+ removeItemButton: false,
+ editItems: false,
+ duplicateItems: true,
+ delimiter: ',',
+ paste: true,
+ searchEnabled: true,
+ searchChoices: true,
+ searchFloor: 1,
+ searchResultLimit: 4,
+ searchFields: ['label', 'value'],
+ position: 'auto',
+ resetScrollPosition: true,
+ regexFilter: null,
+ shouldSort: true,
+ shouldSortItems: false,
+ placeholder: true,
+ placeholderValue: null,
+ searchPlaceholderValue: null,
+ prependValue: null,
+ appendValue: null,
+ renderSelectedChoices: 'auto',
+ loadingText: 'Loading...',
+ noResultsText: 'No results found',
+ noChoicesText: 'No choices to choose from',
+ itemSelectText: 'Press to select',
+ addItemText: function addItemText(value) {
+ return 'Press Enter to add "' + value + '" ';
+ },
+ maxItemText: function maxItemText(maxItemCount) {
+ return 'Only ' + maxItemCount + ' values can be added.';
+ },
+ uniqueItemText: 'Only unique values can be added.',
+ fuseOptions: {
+ includeScore: true
+ },
+ callbackOnInit: null,
+ callbackOnCreateTemplates: null
+};
+
+var EVENTS = exports.EVENTS = {
+ showDropdown: 'showDropdown',
+ hideDropdown: 'hideDropdown',
+ change: 'change',
+ choice: 'choice',
+ search: 'search',
+ addItem: 'addItem',
+ removeItem: 'removeItem',
+ highlightItem: 'highlightItem'
+};
+
+var ACTION_TYPES = exports.ACTION_TYPES = {
+ ADD_CHOICE: 'ADD_CHOICE',
+ FILTER_CHOICES: 'FILTER_CHOICES',
+ ACTIVATE_CHOICES: 'ACTIVATE_CHOICES',
+ CLEAR_CHOICES: 'CLEAR_CHOICES',
+ ADD_GROUP: 'ADD_GROUP',
+ ADD_ITEM: 'ADD_ITEM',
+ REMOVE_ITEM: 'REMOVE_ITEM',
+ HIGHLIGHT_ITEM: 'HIGHLIGHT_ITEM',
+ CLEAR_ALL: 'CLEAR_ALL'
+};
+
+var KEY_CODES = exports.KEY_CODES = {
+ BACK_KEY: 46,
+ DELETE_KEY: 8,
+ ENTER_KEY: 13,
+ A_KEY: 65,
+ ESC_KEY: 27,
+ UP_KEY: 38,
+ DOWN_KEY: 40,
+ PAGE_UP_KEY: 33,
+ PAGE_DOWN_KEY: 34
+};
+
+var SCROLLING_SPEED = exports.SCROLLING_SPEED = 4;
+
/***/ }),
/* 2 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
@@ -115,12 +811,8 @@ module.exports = __webpack_require__(2);
"use strict";
Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
-// EXTERNAL MODULE: ./node_modules/fuse.js/dist/fuse.js
-var dist_fuse = __webpack_require__(3);
-var fuse_default = /*#__PURE__*/__webpack_require__.n(dist_fuse);
-
// EXTERNAL MODULE: ./node_modules/redux/node_modules/lodash-es/_freeGlobal.js
-var _freeGlobal = __webpack_require__(4);
+var _freeGlobal = __webpack_require__(9);
// CONCATENATED MODULE: ./node_modules/redux/node_modules/lodash-es/_root.js
@@ -137,9 +829,9 @@ var root = _freeGlobal["a" /* default */] || freeSelf || Function('return this')
/** Built-in value references. */
-var _Symbol_Symbol = _root.Symbol;
+var Symbol = _root.Symbol;
-/* harmony default export */ var _Symbol = (_Symbol_Symbol);
+/* harmony default export */ var _Symbol = (Symbol);
// CONCATENATED MODULE: ./node_modules/redux/node_modules/lodash-es/_getRawTag.js
@@ -364,7 +1056,7 @@ function isPlainObject(value) {
/* harmony default export */ var lodash_es_isPlainObject = (isPlainObject);
// EXTERNAL MODULE: ./node_modules/redux/node_modules/symbol-observable/index.js
-var symbol_observable = __webpack_require__(5);
+var symbol_observable = __webpack_require__(10);
var symbol_observable_default = /*#__PURE__*/__webpack_require__.n(symbol_observable);
// CONCATENATED MODULE: ./node_modules/redux/es/createStore.js
@@ -900,6 +1592,11 @@ function applyMiddleware() {
};
}
// CONCATENATED MODULE: ./node_modules/redux/es/index.js
+/* concated harmony reexport */__webpack_require__.d(__webpack_exports__, "createStore", function() { return createStore_createStore; });
+/* concated harmony reexport */__webpack_require__.d(__webpack_exports__, "combineReducers", function() { return combineReducers; });
+/* concated harmony reexport */__webpack_require__.d(__webpack_exports__, "bindActionCreators", function() { return bindActionCreators; });
+/* concated harmony reexport */__webpack_require__.d(__webpack_exports__, "applyMiddleware", function() { return applyMiddleware; });
+/* concated harmony reexport */__webpack_require__.d(__webpack_exports__, "compose", function() { return compose; });
@@ -918,1691 +1615,54 @@ if (false) {
}
-// CONCATENATED MODULE: ./src/scripts/src/reducers/items.js
-function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
-var defaultState = [];
+/***/ }),
+/* 3 */
+/***/ (function(module, exports) {
-function items_items() {
- var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : defaultState;
- var action = arguments[1];
+var g;
- switch (action.type) {
- case 'ADD_ITEM':
- {
- // Add object to items array
- var newState = [].concat(_toConsumableArray(state), [{
- id: action.id,
- choiceId: action.choiceId,
- groupId: action.groupId,
- value: action.value,
- label: action.label,
- active: true,
- highlighted: false,
- customProperties: action.customProperties,
- placeholder: action.placeholder || false,
- keyCode: null
- }]);
+// This works in non-strict mode
+g = (function() {
+ return this;
+})();
- return newState.map(function (obj) {
- var item = obj;
- if (item.highlighted) {
- item.highlighted = false;
- }
- return item;
- });
- }
-
- case 'REMOVE_ITEM':
- {
- // Set item to inactive
- return state.map(function (obj) {
- var item = obj;
- if (item.id === action.id) {
- item.active = false;
- }
- return item;
- });
- }
-
- case 'HIGHLIGHT_ITEM':
- {
- return state.map(function (obj) {
- var item = obj;
- if (item.id === action.id) {
- item.highlighted = action.highlighted;
- }
- return item;
- });
- }
-
- default:
- {
- return state;
- }
- }
+try {
+ // This works if eval is allowed (see CSP)
+ g = g || Function("return this")() || (1,eval)("this");
+} catch(e) {
+ // This works if the window reference is available
+ if(typeof window === "object")
+ g = window;
}
-// CONCATENATED MODULE: ./src/scripts/src/reducers/groups.js
-function groups__toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
-var groups_defaultState = [];
+// g can still be undefined, but nothing to do about it...
+// We return undefined, instead of nothing here, so it's
+// easier to handle this case. if(!global) { ...}
-function groups() {
- var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : groups_defaultState;
- var action = arguments[1];
-
- switch (action.type) {
- case 'ADD_GROUP':
- {
- return [].concat(groups__toConsumableArray(state), [{
- id: action.id,
- value: action.value,
- active: action.active,
- disabled: action.disabled
- }]);
- }
-
- case 'CLEAR_CHOICES':
- {
- return [];
- }
-
- default:
- {
- return state;
- }
- }
-}
-// CONCATENATED MODULE: ./src/scripts/src/reducers/choices.js
-function choices__toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
-
-var choices_defaultState = [];
-
-function choices_choices() {
- var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : choices_defaultState;
- var action = arguments[1];
-
- switch (action.type) {
- case 'ADD_CHOICE':
- {
- /*
- A disabled choice appears in the choice dropdown but cannot be selected
- A selected choice has been added to the passed input's value (added as an item)
- An active choice appears within the choice dropdown
- */
- return [].concat(choices__toConsumableArray(state), [{
- id: action.id,
- elementId: action.elementId,
- groupId: action.groupId,
- value: action.value,
- label: action.label || action.value,
- disabled: action.disabled || false,
- selected: false,
- active: true,
- score: 9999,
- customProperties: action.customProperties,
- placeholder: action.placeholder || false,
- keyCode: null
- }]);
- }
-
- case 'ADD_ITEM':
- {
- // If all choices need to be activated
- if (action.activateOptions) {
- return state.map(function (obj) {
- var choice = obj;
- choice.active = action.active;
- return choice;
- });
- }
-
- // When an item is added and it has an associated choice,
- // we want to disable it so it can't be chosen again
- if (action.choiceId > -1) {
- return state.map(function (obj) {
- var choice = obj;
- if (choice.id === parseInt(action.choiceId, 10)) {
- choice.selected = true;
- }
- return choice;
- });
- }
-
- return state;
- }
-
- case 'REMOVE_ITEM':
- {
- // When an item is removed and it has an associated choice,
- // we want to re-enable it so it can be chosen again
- if (action.choiceId > -1) {
- return state.map(function (obj) {
- var choice = obj;
- if (choice.id === parseInt(action.choiceId, 10)) {
- choice.selected = false;
- }
- return choice;
- });
- }
-
- return state;
- }
-
- case 'FILTER_CHOICES':
- {
- return state.map(function (obj) {
- var choice = obj;
- // Set active state based on whether choice is
- // within filtered results
- choice.active = action.results.some(function (_ref) {
- var item = _ref.item,
- score = _ref.score;
-
- if (item.id === choice.id) {
- choice.score = score;
- return true;
- }
- return false;
- });
-
- return choice;
- });
- }
-
- case 'ACTIVATE_CHOICES':
- {
- return state.map(function (obj) {
- var choice = obj;
- choice.active = action.active;
- return choice;
- });
- }
-
- case 'CLEAR_CHOICES':
- {
- return choices_defaultState;
- }
-
- default:
- {
- return state;
- }
- }
-}
-// CONCATENATED MODULE: ./src/scripts/src/reducers/index.js
+module.exports = g;
+/***/ }),
+/* 4 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
-
-var appReducer = combineReducers({
- items: items_items,
- groups: groups,
- choices: choices_choices
+Object.defineProperty(exports, "__esModule", {
+ value: true
});
-var rootReducer = function rootReducer(passedState, action) {
- var state = passedState;
- // If we are clearing all items, groups and options we reassign
- // state and then pass that state to our proper reducer. This isn't
- // mutating our actual state
- // See: http://stackoverflow.com/a/35641992
- if (action.type === 'CLEAR_ALL') {
- state = undefined;
- }
-
- return appReducer(state, action);
-};
-
-/* harmony default export */ var src_reducers = (rootReducer);
-// CONCATENATED MODULE: ./src/scripts/src/store/store.js
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
-function store__toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
+var _utils = __webpack_require__(0);
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
-
-
-
-var store_Store = function () {
- function Store() {
- _classCallCheck(this, Store);
-
- this.store = createStore_createStore(src_reducers, window.devToolsExtension ? window.devToolsExtension() : undefined);
- }
-
- /**
- * Subscribe store to function call (wrapped Redux method)
- * @param {Function} onChange Function to trigger when state changes
- * @return
- */
-
-
- _createClass(Store, [{
- key: 'subscribe',
- value: function subscribe(onChange) {
- this.store.subscribe(onChange);
- }
-
- /**
- * Dispatch event to store (wrapped Redux method)
- * @param {Function} action Action function to trigger
- * @return
- */
-
- }, {
- key: 'dispatch',
- value: function dispatch(action) {
- this.store.dispatch(action);
- }
-
- /**
- * Get store object (wrapping Redux method)
- * @return {Object} State
- */
-
- }, {
- key: 'getState',
- value: function getState() {
- return this.store.getState();
- }
-
- /**
- * Get items from store
- * @return {Array} Item objects
- */
-
- }, {
- key: 'getItems',
- value: function getItems() {
- var state = this.store.getState();
- return state.items;
- }
-
- /**
- * Get active items from store
- * @return {Array} Item objects
- */
-
- }, {
- key: 'getItemsFilteredByActive',
- value: function getItemsFilteredByActive() {
- var items = this.getItems();
- var values = items.filter(function (item) {
- return item.active === true;
- }, []);
-
- return values;
- }
-
- /**
- * Get items from store reduced to just their values
- * @return {Array} Item objects
- */
-
- }, {
- key: 'getItemsReducedToValues',
- value: function getItemsReducedToValues() {
- var items = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.getItems();
-
- var values = items.reduce(function (prev, current) {
- prev.push(current.value);
- return prev;
- }, []);
-
- return values;
- }
-
- /**
- * Get choices from store
- * @return {Array} Option objects
- */
-
- }, {
- key: 'getChoices',
- value: function getChoices() {
- var state = this.store.getState();
- return state.choices;
- }
-
- /**
- * Get active choices from store
- * @return {Array} Option objects
- */
-
- }, {
- key: 'getChoicesFilteredByActive',
- value: function getChoicesFilteredByActive() {
- var choices = this.getChoices();
- var values = choices.filter(function (choice) {
- return choice.active === true;
- });
-
- return values;
- }
-
- /**
- * Get selectable choices from store
- * @return {Array} Option objects
- */
-
- }, {
- key: 'getChoicesFilteredBySelectable',
- value: function getChoicesFilteredBySelectable() {
- var choices = this.getChoices();
- var values = choices.filter(function (choice) {
- return choice.disabled !== true;
- });
-
- return values;
- }
-
- /**
- * Get choices that can be searched (excluding placeholders)
- * @return {Array} Option objects
- */
-
- }, {
- key: 'getSearchableChoices',
- value: function getSearchableChoices() {
- var filtered = this.getChoicesFilteredBySelectable();
- return filtered.filter(function (choice) {
- return choice.placeholder !== true;
- });
- }
-
- /**
- * Get single choice by it's ID
- * @return {Object} Found choice
- */
-
- }, {
- key: 'getChoiceById',
- value: function getChoiceById(id) {
- if (id) {
- var choices = this.getChoicesFilteredByActive();
- var foundChoice = choices.find(function (choice) {
- return choice.id === parseInt(id, 10);
- });
- return foundChoice;
- }
- return false;
- }
-
- /**
- * Get placeholder choice from store
- * @return {Object} Found placeholder
- */
-
- }, {
- key: 'getPlaceholderChoice',
- value: function getPlaceholderChoice() {
- var choices = this.getChoices();
- var placeholderChoice = [].concat(store__toConsumableArray(choices)).reverse().find(function (choice) {
- return choice.placeholder === true;
- });
-
- return placeholderChoice;
- }
-
- /**
- * Get groups from store
- * @return {Array} Group objects
- */
-
- }, {
- key: 'getGroups',
- value: function getGroups() {
- var state = this.store.getState();
- return state.groups;
- }
-
- /**
- * Get active groups from store
- * @return {Array} Group objects
- */
-
- }, {
- key: 'getGroupsFilteredByActive',
- value: function getGroupsFilteredByActive() {
- var groups = this.getGroups();
- var choices = this.getChoices();
-
- var values = groups.filter(function (group) {
- var isActive = group.active === true && group.disabled === false;
- var hasActiveOptions = choices.some(function (choice) {
- return choice.active === true && choice.disabled === false;
- });
- return isActive && hasActiveOptions;
- }, []);
-
- return values;
- }
-
- /**
- * Get group by group id
- * @param {Number} id Group ID
- * @return {Object} Group data
- */
-
- }, {
- key: 'getGroupById',
- value: function getGroupById(id) {
- var groups = this.getGroups();
- var foundGroup = groups.find(function (group) {
- return group.id === parseInt(id, 10);
- });
-
- return foundGroup;
- }
- }]);
-
- return Store;
-}();
-
-/* harmony default export */ var store_store = (store_Store);
-// CONCATENATED MODULE: ./src/scripts/src/components/dropdown.js
-var dropdown__createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
-
-function dropdown__classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
-
-var Dropdown = function () {
- function Dropdown(instance, element, classNames) {
- dropdown__classCallCheck(this, Dropdown);
-
- this.parentInstance = instance;
- this.element = element;
- this.classNames = classNames;
- this.dimensions = null;
- this.position = null;
- this.isActive = false;
- }
-
- dropdown__createClass(Dropdown, [{
- key: 'getElement',
- value: function getElement() {
- return this.element;
- }
-
- /**
- * Determine how far the top of our element is from
- * the top of the window
- * @return {Number} Vertical position
- */
-
- }, {
- key: 'getVerticalPos',
- value: function getVerticalPos() {
- this.dimensions = this.element.getBoundingClientRect();
- this.position = Math.ceil(this.dimensions.top + window.pageYOffset + this.element.offsetHeight);
- return this.position;
- }
-
- /**
- * Find element that matches passed selector
- * @return {HTMLElement}
- */
-
- }, {
- key: 'getChild',
- value: function getChild(selector) {
- return this.element.querySelector(selector);
- }
-
- /**
- * Show dropdown to user by adding active state class
- * @return {Object} Class instance
- * @public
- */
-
- }, {
- key: 'show',
- value: function show() {
- this.element.classList.add(this.classNames.activeState);
- this.element.setAttribute('aria-expanded', 'true');
- this.isActive = true;
- return this.parentInstance;
- }
-
- /**
- * Hide dropdown from user
- * @return {Object} Class instance
- * @public
- */
-
- }, {
- key: 'hide',
- value: function hide() {
- this.element.classList.remove(this.classNames.activeState);
- this.element.setAttribute('aria-expanded', 'false');
- this.isActive = false;
- return this.parentInstance;
- }
- }]);
-
- return Dropdown;
-}();
-
-/* harmony default export */ var components_dropdown = (Dropdown);
-// CONCATENATED MODULE: ./src/scripts/src/components/container.js
-var container__createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
-
-function container__classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
-
-var Container = function () {
- function Container(instance, element, classNames) {
- container__classCallCheck(this, Container);
-
- this.parentInstance = instance;
- this.element = element;
- this.classNames = classNames;
- this.config = instance.config;
- this.isOpen = false;
- this.isFlipped = false;
- this.isFocussed = false;
- this.isDisabled = false;
- this.isLoading = false;
- this.onFocus = this.onFocus.bind(this);
- this.onBlur = this.onBlur.bind(this);
- }
-
- container__createClass(Container, [{
- key: 'getElement',
- value: function getElement() {
- return this.element;
- }
-
- /**
- * Add event listeners
- */
-
- }, {
- key: 'addEventListeners',
- value: function addEventListeners() {
- this.element.addEventListener('focus', this.onFocus);
- this.element.addEventListener('blur', this.onBlur);
- }
-
- /**
- * Remove event listeners
- */
-
- /** */
-
- }, {
- key: 'removeEventListeners',
- value: function removeEventListeners() {
- this.element.removeEventListener('focus', this.onFocus);
- this.element.removeEventListener('blur', this.onBlur);
- }
-
- /**
- * Set focussed state
- */
-
- }, {
- key: 'onFocus',
- value: function onFocus() {
- this.isFocussed = true;
- }
-
- /**
- * Remove blurred state
- */
-
- }, {
- key: 'onBlur',
- value: function onBlur() {
- this.isFocussed = false;
- }
-
- /**
- * Determine whether container should be flipped
- * based on passed dropdown position
- * @param {Number} dropdownPos
- * @returns
- */
-
- }, {
- key: 'shouldFlip',
- value: function shouldFlip(dropdownPos) {
- if (dropdownPos === undefined) {
- return false;
- }
-
- var body = document.body;
- var html = document.documentElement;
- var winHeight = Math.max(body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight);
-
- // If flip is enabled and the dropdown bottom position is
- // greater than the window height flip the dropdown.
- var shouldFlip = false;
- if (this.config.position === 'auto') {
- shouldFlip = dropdownPos >= winHeight;
- } else if (this.config.position === 'top') {
- shouldFlip = true;
- }
-
- return shouldFlip;
- }
-
- /**
- * Set active descendant attribute
- * @param {Number} activeDescendant ID of active descendant
- */
-
- }, {
- key: 'setActiveDescendant',
- value: function setActiveDescendant(activeDescendantID) {
- this.element.setAttribute('aria-activedescendant', activeDescendantID);
- }
-
- /**
- * Remove active descendant attribute
- */
-
- }, {
- key: 'removeActiveDescendant',
- value: function removeActiveDescendant() {
- this.element.removeAttribute('aria-activedescendant');
- }
- }, {
- key: 'open',
- value: function open(dropdownPos) {
- this.element.classList.add(this.classNames.openState);
- this.element.setAttribute('aria-expanded', 'true');
- this.isOpen = true;
-
- if (this.shouldFlip(dropdownPos)) {
- this.element.classList.add(this.classNames.flippedState);
- this.isFlipped = true;
- }
- }
- }, {
- key: 'close',
- value: function close() {
- this.element.classList.remove(this.classNames.openState);
- this.element.setAttribute('aria-expanded', 'false');
- this.removeActiveDescendant();
- this.isOpen = false;
-
- // A dropdown flips if it does not have space within the page
- if (this.isFlipped) {
- this.element.classList.remove(this.classNames.flippedState);
- this.isFlipped = false;
- }
- }
- }, {
- key: 'focus',
- value: function focus() {
- if (!this.isFocussed) {
- this.element.focus();
- }
- }
- }, {
- key: 'addFocusState',
- value: function addFocusState() {
- this.element.classList.add(this.classNames.focusState);
- }
- }, {
- key: 'removeFocusState',
- value: function removeFocusState() {
- this.element.classList.remove(this.classNames.focusState);
- }
-
- /**
- * Remove disabled state
- */
-
- }, {
- key: 'enable',
- value: function enable() {
- this.element.classList.remove(this.config.classNames.disabledState);
- this.element.removeAttribute('aria-disabled');
- if (this.parentInstance.isSelectOneElement) {
- this.element.setAttribute('tabindex', '0');
- }
- this.isDisabled = false;
- }
-
- /**
- * Set disabled state
- */
-
- }, {
- key: 'disable',
- value: function disable() {
- this.element.classList.add(this.config.classNames.disabledState);
- this.element.setAttribute('aria-disabled', 'true');
- if (this.parentInstance.isSelectOneElement) {
- this.element.setAttribute('tabindex', '-1');
- }
- this.isDisabled = true;
- }
- }, {
- key: 'revert',
- value: function revert(originalElement) {
- // Move passed element back to original position
- this.element.parentNode.insertBefore(originalElement, this.element);
- // Remove container
- this.element.parentNode.removeChild(this.element);
- }
-
- /**
- * Add loading state to element
- */
-
- }, {
- key: 'addLoadingState',
- value: function addLoadingState() {
- this.element.classList.add(this.classNames.loadingState);
- this.element.setAttribute('aria-busy', 'true');
- this.isLoading = true;
- }
-
- /**
- * Remove loading state from element
- */
-
- }, {
- key: 'removeLoadingState',
- value: function removeLoadingState() {
- this.element.classList.remove(this.classNames.loadingState);
- this.element.removeAttribute('aria-busy');
- this.isLoading = false;
- }
- }]);
-
- return Container;
-}();
-
-/* harmony default export */ var container = (Container);
-// CONCATENATED MODULE: ./src/scripts/src/lib/utils.js
-var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
-
-/* eslint-disable */
-
-/**
- * Capitalises the first letter of each word in a string
- * @param {String} str String to capitalise
- * @return {String} Capitalised string
- */
-var capitalise = function capitalise(str) {
- return str.replace(/\w\S*/g, function (txt) {
- return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();
- });
-};
-
-/**
- * Generates a string of random chars
- * @param {Number} length Length of the string to generate
- * @return {String} String of random chars
- */
-var generateChars = function generateChars(length) {
- var chars = '';
-
- for (var i = 0; i < length; i++) {
- var randomChar = getRandomNumber(0, 36);
- chars += randomChar.toString(36);
- }
-
- return chars;
-};
-
-/**
- * Generates a unique id based on an element
- * @param {HTMLElement} element Element to generate the id from
- * @param {String} Prefix for the Id
- * @return {String} Unique Id
- */
-var generateId = function generateId(element, prefix) {
- var id = element.id || element.name && element.name + '-' + generateChars(2) || generateChars(4);
- id = id.replace(/(:|\.|\[|\]|,)/g, '');
- id = prefix + id;
-
- return id;
-};
-
-/**
- * Tests the type of an object
- * @param {String} type Type to test object against
- * @param {Object} obj Object to be tested
- * @return {Boolean}
- */
-var getType = function getType(obj) {
- return Object.prototype.toString.call(obj).slice(8, -1);
-};
-
-/**
- * Tests the type of an object
- * @param {String} type Type to test object against
- * @param {Object} obj Object to be tested
- * @return {Boolean}
- */
-var isType = function isType(type, obj) {
- var clas = getType(obj);
- return obj !== undefined && obj !== null && clas === type;
-};
-
-/**
- * Tests to see if a passed object is a node
- * @param {Object} obj Object to be tested
- * @return {Boolean}
- */
-var isNode = function isNode(o) {
- return (typeof Node === 'undefined' ? 'undefined' : _typeof(Node)) === 'object' ? o instanceof Node : o && (typeof o === 'undefined' ? 'undefined' : _typeof(o)) === 'object' && typeof o.nodeType === 'number' && typeof o.nodeName === 'string';
-};
-
-/**
- * Tests to see if a passed object is an element
- * @param {Object} obj Object to be tested
- * @return {Boolean}
- */
-var isElement = function isElement(o) {
- return (typeof HTMLElement === 'undefined' ? 'undefined' : _typeof(HTMLElement)) === 'object' ? o instanceof HTMLElement : // DOM2
- o && (typeof o === 'undefined' ? 'undefined' : _typeof(o)) === 'object' && o !== null && o.nodeType === 1 && typeof o.nodeName === 'string';
-};
-
-/**
- * Merges unspecified amount of objects into new object
- * @private
- * @return {Object} Merged object of arguments
- */
-var extend = function extend() {
- var extended = {};
- var length = arguments.length;
-
- /**
- * Merge one object into another
- * @param {Object} obj Object to merge into extended object
- */
- var merge = function merge(obj) {
- for (var prop in obj) {
- if (Object.prototype.hasOwnProperty.call(obj, prop)) {
- // If deep merge and property is an object, merge properties
- if (isType('Object', obj[prop])) {
- extended[prop] = extend(true, extended[prop], obj[prop]);
- } else {
- extended[prop] = obj[prop];
- }
- }
- }
- };
-
- // Loop through each passed argument
- for (var i = 0; i < length; i++) {
- // store argument at position i
- var obj = arguments[i];
-
- // If we are in fact dealing with an object, merge it.
- if (isType('Object', obj)) {
- merge(obj);
- }
- }
-
- return extended;
-};
-
-/**
- * CSS transition end event listener
- * @return
- */
-var whichTransitionEvent = function whichTransitionEvent() {
- var t = void 0,
- el = document.createElement('fakeelement');
-
- var transitions = {
- transition: 'transitionend',
- OTransition: 'oTransitionEnd',
- MozTransition: 'transitionend',
- WebkitTransition: 'webkitTransitionEnd'
- };
-
- for (t in transitions) {
- if (el.style[t] !== undefined) {
- return transitions[t];
- }
- }
-};
-
-/**
- * CSS animation end event listener
- * @return
- */
-var whichAnimationEvent = function whichAnimationEvent() {
- var t = void 0,
- el = document.createElement('fakeelement');
-
- var animations = {
- animation: 'animationend',
- OAnimation: 'oAnimationEnd',
- MozAnimation: 'animationend',
- WebkitAnimation: 'webkitAnimationEnd'
- };
-
- for (t in animations) {
- if (el.style[t] !== undefined) {
- return animations[t];
- }
- }
-};
-
-/**
- * Get the ancestors of each element in the current set of matched elements,
- * up to but not including the element matched by the selector
- * @param {NodeElement} elem Element to begin search from
- * @param {NodeElement} parent Parent to find
- * @param {String} selector Class to find
- * @return {Array} Array of parent elements
- */
-var getParentsUntil = function getParentsUntil(elem, parent, selector) {
- var parents = [];
- // Get matches
- for (; elem && elem !== document; elem = elem.parentNode) {
- // Check if parent has been reached
- if (parent) {
- var parentType = parent.charAt(0);
-
- // If parent is a class
- if (parentType === '.') {
- if (elem.classList.contains(parent.substr(1))) {
- break;
- }
- }
-
- // If parent is an ID
- if (parentType === '#') {
- if (elem.id === parent.substr(1)) {
- break;
- }
- }
-
- // If parent is a data attribute
- if (parentType === '[') {
- if (elem.hasAttribute(parent.substr(1, parent.length - 1))) {
- break;
- }
- }
-
- // If parent is a tag
- if (elem.tagName.toLowerCase() === parent) {
- break;
- }
- }
- if (selector) {
- var selectorType = selector.charAt(0);
-
- // If selector is a class
- if (selectorType === '.') {
- if (elem.classList.contains(selector.substr(1))) {
- parents.push(elem);
- }
- }
-
- // If selector is an ID
- if (selectorType === '#') {
- if (elem.id === selector.substr(1)) {
- parents.push(elem);
- }
- }
-
- // If selector is a data attribute
- if (selectorType === '[') {
- if (elem.hasAttribute(selector.substr(1, selector.length - 1))) {
- parents.push(elem);
- }
- }
-
- // If selector is a tag
- if (elem.tagName.toLowerCase() === selector) {
- parents.push(elem);
- }
- } else {
- parents.push(elem);
- }
- }
-
- // Return parents if any exist
- if (parents.length === 0) {
- return null;
- }
- return parents;
-};
-
-var wrap = function wrap(element, wrapper) {
- wrapper = wrapper || document.createElement('div');
- if (element.nextSibling) {
- element.parentNode.insertBefore(wrapper, element.nextSibling);
- } else {
- element.parentNode.appendChild(wrapper);
- }
- return wrapper.appendChild(element);
-};
-
-var getSiblings = function getSiblings(elem) {
- var siblings = [];
- var sibling = elem.parentNode.firstChild;
- for (; sibling; sibling = sibling.nextSibling) {
- if (sibling.nodeType === 1 && sibling !== elem) {
- siblings.push(sibling);
- }
- }
- return siblings;
-};
-
-/**
- * Find ancestor in DOM tree
- * @param {NodeElement} el Element to start search from
- * @param {[type]} cls Class of parent
- * @return {NodeElement} Found parent element
- */
-var findAncestor = function findAncestor(el, cls) {
- while ((el = el.parentElement) && !el.classList.contains(cls)) {}
- return el;
-};
-
-/**
- * Find ancestor in DOM tree by attribute name
- * @param {NodeElement} el Element to start search from
- * @param {string} attr Attribute name of parent
- * @return {?NodeElement} Found parent element or null
- */
-var findAncestorByAttrName = function findAncestorByAttrName(el, attr) {
- var target = el;
-
- while (target) {
- if (target.hasAttribute(attr)) {
- return target;
- }
-
- target = target.parentElement;
- }
-
- return null;
-};
-
-/**
- * Debounce an event handler.
- * @param {Function} func Function to run after wait
- * @param {Number} wait The delay before the function is executed
- * @param {Boolean} immediate If passed, trigger the function on the leading edge, instead of the trailing.
- * @return {Function} A function will be called after it stops being called for a given delay
- */
-var debounce = function debounce(func, wait, immediate) {
- var timeout = void 0;
- return function () {
- var context = this,
- args = arguments;
- var later = function later() {
- timeout = null;
- if (!immediate) func.apply(context, args);
- };
- var callNow = immediate && !timeout;
- clearTimeout(timeout);
- timeout = setTimeout(later, wait);
- if (callNow) func.apply(context, args);
- };
-};
-
-/**
- * Get an element's distance from the top of the page
- * @private
- * @param {NodeElement} el Element to test for
- * @return {Number} Elements Distance from top of page
- */
-var getElemDistance = function getElemDistance(el) {
- var location = 0;
- if (el.offsetParent) {
- do {
- location += el.offsetTop;
- el = el.offsetParent;
- } while (el);
- }
- return location >= 0 ? location : 0;
-};
-
-/**
- * Determine element height multiplied by any offsets
- * @private
- * @param {HTMLElement} el Element to test for
- * @return {Number} Height of element
- */
-var getElementOffset = function getElementOffset(el, offset) {
- var elOffset = offset;
- if (elOffset > 1) elOffset = 1;
- if (elOffset > 0) elOffset = 0;
-
- return Math.max(el.offsetHeight * elOffset);
-};
-
-/**
- * Get the next or previous element from a given start point
- * @param {HTMLElement} startEl Element to start position from
- * @param {String} className The class we will look through
- * @param {Number} direction Positive next element, negative previous element
- * @return {[HTMLElement} Found element
- */
-var getAdjacentEl = function getAdjacentEl(startEl, className) {
- var direction = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
-
- if (!startEl || !className) return;
-
- var parent = startEl.parentNode.parentNode;
- var children = Array.from(parent.querySelectorAll(className));
-
- var startPos = children.indexOf(startEl);
- var operatorDirection = direction > 0 ? 1 : -1;
-
- return children[startPos + operatorDirection];
-};
-
-/**
- * Get scroll position based on top/bottom position
- * @private
- * @return {String} Position of scroll
- */
-var getScrollPosition = function getScrollPosition(position) {
- if (position === 'bottom') {
- // Scroll position from the bottom of the viewport
- return Math.max((window.scrollY || window.pageYOffset) + (window.innerHeight || document.documentElement.clientHeight));
- }
- // Scroll position from the top of the viewport
- return window.scrollY || window.pageYOffset;
-};
-
-/**
- * Determine whether an element is within the viewport
- * @param {HTMLElement} el Element to test
- * @return {String} Position of scroll
- * @return {Boolean}
- */
-var isInView = function isInView(el, position, offset) {
- // If the user has scrolled further than the distance from the element to the top of its parent
- return this.getScrollPosition(position) > this.getElemDistance(el) + this.getElementOffset(el, offset);
-};
-
-/**
- * Determine whether an element is within
- * @param {HTMLElement} el Element to test
- * @param {HTMLElement} parent Scrolling parent
- * @param {Number} direction Whether element is visible from above or below
- * @return {Boolean}
- */
-var isScrolledIntoView = function isScrolledIntoView(el, parent) {
- var direction = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 1;
-
- if (!el) return;
-
- var isVisible = void 0;
-
- if (direction > 0) {
- // In view from bottom
- isVisible = parent.scrollTop + parent.offsetHeight >= el.offsetTop + el.offsetHeight;
- } else {
- // In view from top
- isVisible = el.offsetTop >= parent.scrollTop;
- }
-
- return isVisible;
-};
-
-/**
- * Remove html tags from a string
- * @param {String} Initial string/html
- * @return {String} Sanitised string
- */
-var stripHTML = function stripHTML(html) {
- var el = document.createElement('DIV');
- el.innerHTML = html;
- return el.textContent || el.innerText || '';
-};
-
-/**
- * Adds animation to an element and removes it upon animation completion
- * @param {Element} el Element to add animation to
- * @param {String} animation Animation class to add to element
- * @return
- */
-var addAnimation = function addAnimation(el, animation) {
- var animationEvent = whichAnimationEvent();
-
- var removeAnimation = function removeAnimation() {
- el.classList.remove(animation);
- el.removeEventListener(animationEvent, removeAnimation, false);
- };
-
- el.classList.add(animation);
- el.addEventListener(animationEvent, removeAnimation, false);
-};
-
-/**
- * Get a random number between a range
- * @param {Number} min Minimum range
- * @param {Number} max Maximum range
- * @return {Number} Random number
- */
-var getRandomNumber = function getRandomNumber(min, max) {
- return Math.floor(Math.random() * (max - min) + min);
-};
-
-/**
- * Turn a string into a node
- * @param {String} String to convert
- * @return {HTMLElement} Converted node element
- */
-var strToEl = function () {
- var tmpEl = document.createElement('div');
- return function (str) {
- var cleanedInput = str.trim();
- var r = void 0;
- tmpEl.innerHTML = cleanedInput;
- r = tmpEl.children[0];
-
- while (tmpEl.firstChild) {
- tmpEl.removeChild(tmpEl.firstChild);
- }
-
- return r;
- };
-}();
-
-/**
- * Sets the width of a passed input based on its value
- * @return {Number} Width of input
- */
-var getWidthOfInput = function getWidthOfInput(input) {
- var value = input.value || input.placeholder;
- var width = input.offsetWidth;
-
- if (value) {
- var testEl = strToEl('' + value + ' ');
- testEl.style.position = 'absolute';
- testEl.style.padding = '0';
- testEl.style.top = '-9999px';
- testEl.style.left = '-9999px';
- testEl.style.width = 'auto';
- testEl.style.whiteSpace = 'pre';
-
- if (document.body.contains(input) && window.getComputedStyle) {
- var inputStyle = window.getComputedStyle(input);
-
- if (inputStyle) {
- testEl.style.fontSize = inputStyle.fontSize;
- testEl.style.fontFamily = inputStyle.fontFamily;
- testEl.style.fontWeight = inputStyle.fontWeight;
- testEl.style.fontStyle = inputStyle.fontStyle;
- testEl.style.letterSpacing = inputStyle.letterSpacing;
- testEl.style.textTransform = inputStyle.textTransform;
- testEl.style.padding = inputStyle.padding;
- }
- }
-
- document.body.appendChild(testEl);
-
- if (value && testEl.offsetWidth !== input.offsetWidth) {
- width = testEl.offsetWidth + 4;
- }
-
- document.body.removeChild(testEl);
- }
-
- return width + 'px';
-};
-
-/**
- * Sorting function for current and previous string
- * @param {String} a Current value
- * @param {String} b Next value
- * @return {Number} -1 for after previous,
- * 1 for before,
- * 0 for same location
- */
-var sortByAlpha = function sortByAlpha(a, b) {
- var labelA = (a.label || a.value).toLowerCase();
- var labelB = (b.label || b.value).toLowerCase();
-
- if (labelA < labelB) return -1;
- if (labelA > labelB) return 1;
- return 0;
-};
-
-/**
- * Sort by numeric score
- * @param {Object} a Current value
- * @param {Object} b Next value
- * @return {Number} -1 for after previous,
- * 1 for before,
- * 0 for same location
- */
-var sortByScore = function sortByScore(a, b) {
- return a.score - b.score;
-};
-
-/**
- * Dispatch native event
- * @param {NodeElement} element Element to trigger event on
- * @param {String} type Type of event to trigger
- * @param {Object} customArgs Data to pass with event
- * @return {Object} Triggered event
- */
-var dispatchEvent = function dispatchEvent(element, type) {
- var customArgs = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
-
- var event = new CustomEvent(type, {
- detail: customArgs,
- bubbles: true,
- cancelable: true
- });
-
- return element.dispatchEvent(event);
-};
-
-/**
- * Tests value against a regular expression
- * @param {string} value Value to test
- * @return {Boolean} Whether test passed/failed
- * @private
- */
-var regexFilter = function regexFilter(value, regex) {
- if (!value || !regex) {
- return false;
- }
-
- var expression = new RegExp(regex.source, 'i');
- return expression.test(value);
-};
-// CONCATENATED MODULE: ./src/scripts/src/components/input.js
-var input__createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
-
-function input__classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
-
-
-
-var input_Input = function () {
- function Input(instance, element, classNames) {
- input__classCallCheck(this, Input);
-
- this.parentInstance = instance;
- this.element = element;
- this.classNames = classNames;
- this.isFocussed = this.element === document.activeElement;
- this.isDisabled = false;
-
- // Bind event listeners
- this.onPaste = this.onPaste.bind(this);
- this.onInput = this.onInput.bind(this);
- this.onFocus = this.onFocus.bind(this);
- this.onBlur = this.onBlur.bind(this);
- }
-
- input__createClass(Input, [{
- key: 'getElement',
- value: function getElement() {
- return this.element;
- }
- }, {
- key: 'addEventListeners',
- value: function addEventListeners() {
- this.element.addEventListener('input', this.onInput);
- this.element.addEventListener('paste', this.onPaste);
- this.element.addEventListener('focus', this.onFocus);
- this.element.addEventListener('blur', this.onBlur);
- }
- }, {
- key: 'removeEventListeners',
- value: function removeEventListeners() {
- this.element.removeEventListener('input', this.onInput);
- this.element.removeEventListener('paste', this.onPaste);
- this.element.removeEventListener('focus', this.onFocus);
- this.element.removeEventListener('blur', this.onBlur);
- }
-
- /**
- * Input event
- * @return
- * @private
- */
-
- }, {
- key: 'onInput',
- value: function onInput() {
- if (!this.parentInstance.isSelectOneElement) {
- this.setWidth();
- }
- }
-
- /**
- * Paste event
- * @param {Object} e Event
- * @return
- * @private
- */
-
- }, {
- key: 'onPaste',
- value: function onPaste(e) {
- // Disable pasting into the input if option has been set
- if (e.target === this.element && !this.parentInstance.config.paste) {
- e.preventDefault();
- }
- }
-
- /**
- * Set focussed state
- */
-
- }, {
- key: 'onFocus',
- value: function onFocus() {
- this.isFocussed = true;
- }
-
- /**
- * Remove focussed state
- */
-
- }, {
- key: 'onBlur',
- value: function onBlur() {
- this.isFocussed = false;
- }
- }, {
- key: 'activate',
- value: function activate(focusInput) {
- // Optionally focus the input if we have a search input
- if (focusInput && this.parentInstance.canSearch && document.activeElement !== this.element) {
- this.element.focus();
- }
- }
- }, {
- key: 'deactivate',
- value: function deactivate(blurInput) {
- this.removeActiveDescendant();
- // Optionally blur the input if we have a search input
- if (blurInput && this.parentInstance.canSearch && document.activeElement === this.element) {
- this.element.blur();
- }
- }
- }, {
- key: 'enable',
- value: function enable() {
- this.element.removeAttribute('disabled');
- this.isDisabled = false;
- }
- }, {
- key: 'disable',
- value: function disable() {
- this.element.setAttribute('disabled', '');
- this.isDisabled = true;
- }
- }, {
- key: 'focus',
- value: function focus() {
- if (!this.isFocussed) {
- this.element.focus();
- }
- }
-
- /**
- * Set value of input to blank
- * @return {Object} Class instance
- * @public
- */
-
- }, {
- key: 'clear',
- value: function clear() {
- var setWidth = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
-
- if (this.element.value) {
- this.element.value = '';
- }
-
- if (setWidth) {
- this.setWidth();
- }
-
- return this.parentInstance;
- }
-
- /**
- * Set the correct input width based on placeholder
- * value or input value
- * @return
- */
-
- }, {
- key: 'setWidth',
- value: function setWidth(enforceWidth) {
- if (this.parentInstance.placeholder) {
- // If there is a placeholder, we only want to set the width of the input when it is a greater
- // length than 75% of the placeholder. This stops the input jumping around.
- if (this.element.value && this.element.value.length >= this.parentInstance.placeholder.length / 1.25 || enforceWidth) {
- this.element.style.width = this.getWidth();
- }
- } else {
- // If there is no placeholder, resize input to contents
- this.element.style.width = this.getWidth();
- }
- }
- }, {
- key: 'getWidth',
- value: function getWidth() {
- return getWidthOfInput(this.element);
- }
- }, {
- key: 'setPlaceholder',
- value: function setPlaceholder(placeholder) {
- this.element.placeholder = placeholder;
- }
- }, {
- key: 'setValue',
- value: function setValue(value) {
- this.element.value = value;
- }
- }, {
- key: 'getValue',
- value: function getValue() {
- return this.element.value;
- }
- }, {
- key: 'setActiveDescendant',
- value: function setActiveDescendant(activeDescendantID) {
- this.element.setAttribute('aria-activedescendant', activeDescendantID);
- }
- }, {
- key: 'removeActiveDescendant',
- value: function removeActiveDescendant() {
- this.element.removeAttribute('aria-activedescendant');
- }
- }]);
-
- return Input;
-}();
-
-/* harmony default export */ var components_input = (input_Input);
-// CONCATENATED MODULE: ./src/scripts/src/components/list.js
-var list__createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
-
-function list__classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
-
-var List = function () {
- function List(instance, element, classNames) {
- list__classCallCheck(this, List);
-
- this.parentInstance = instance;
- this.element = element;
- this.classNames = classNames;
- this.scrollPos = this.element.scrollTop;
- this.height = this.element.offsetHeight;
- this.hasChildren = !!this.element.children;
- }
-
- list__createClass(List, [{
- key: 'getElement',
- value: function getElement() {
- return this.element;
- }
-
- /**
- * Clear List contents
- */
-
- }, {
- key: 'clear',
- value: function clear() {
- this.element.innerHTML = '';
- }
-
- /**
- * Scroll to passed position on Y axis
- */
-
- }, {
- key: 'scrollTo',
- value: function scrollTo() {
- var scrollPos = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
-
- this.element.scrollTop = scrollPos;
- }
- /**
- * Append node to element
- */
-
- }, {
- key: 'append',
- value: function append(node) {
- this.element.appendChild(node);
- }
-
- /**
- * Find element that matches passed selector
- * @return {HTMLElement}
- */
-
- }, {
- key: 'getChild',
- value: function getChild(selector) {
- return this.element.querySelector(selector);
- }
- }]);
-
- return List;
-}();
-
-/* harmony default export */ var list = (List);
-// CONCATENATED MODULE: ./src/scripts/src/components/wrapped-element.js
-var wrapped_element__createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
-
-function wrapped_element__classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
-
-
-
-var wrapped_element_WrappedElement = function () {
+var WrappedElement = function () {
function WrappedElement(instance, element, classNames) {
- wrapped_element__classCallCheck(this, WrappedElement);
+ _classCallCheck(this, WrappedElement);
this.parentInstance = instance;
this.element = element;
@@ -2610,7 +1670,7 @@ var wrapped_element_WrappedElement = function () {
this.isDisabled = false;
}
- wrapped_element__createClass(WrappedElement, [{
+ _createClass(WrappedElement, [{
key: 'getElement',
value: function getElement() {
return this.element;
@@ -2679,503 +1739,102 @@ var wrapped_element_WrappedElement = function () {
}, {
key: 'triggerEvent',
value: function triggerEvent(eventType, data) {
- dispatchEvent(this.element, eventType, data);
+ (0, _utils.dispatchEvent)(this.element, eventType, data);
}
}]);
return WrappedElement;
}();
-/* harmony default export */ var wrapped_element = (wrapped_element_WrappedElement);
-// CONCATENATED MODULE: ./src/scripts/src/components/wrapped-input.js
-var wrapped_input__createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
+exports.default = WrappedElement;
-var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
+/***/ }),
+/* 5 */
+/***/ (function(module, exports, __webpack_require__) {
-function wrapped_input__classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
-
-function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
-
-function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
+module.exports = __webpack_require__(6);
+/***/ }),
+/* 6 */
+/***/ (function(module, exports, __webpack_require__) {
-var WrappedInput = function (_WrappedElement) {
- _inherits(WrappedInput, _WrappedElement);
-
- function WrappedInput(instance, element, classNames) {
- wrapped_input__classCallCheck(this, WrappedInput);
-
- var _this = _possibleConstructorReturn(this, (WrappedInput.__proto__ || Object.getPrototypeOf(WrappedInput)).call(this, instance, element, classNames));
-
- _this.parentInstance = instance;
- _this.element = element;
- _this.classNames = classNames;
- return _this;
- }
-
- wrapped_input__createClass(WrappedInput, [{
- key: 'getElement',
- value: function getElement() {
- _get(WrappedInput.prototype.__proto__ || Object.getPrototypeOf(WrappedInput.prototype), 'getElement', this).call(this);
- }
- }, {
- key: 'conceal',
- value: function conceal() {
- _get(WrappedInput.prototype.__proto__ || Object.getPrototypeOf(WrappedInput.prototype), 'conceal', this).call(this);
- }
- }, {
- key: 'reveal',
- value: function reveal() {
- _get(WrappedInput.prototype.__proto__ || Object.getPrototypeOf(WrappedInput.prototype), 'reveal', this).call(this);
- }
- }, {
- key: 'enable',
- value: function enable() {
- _get(WrappedInput.prototype.__proto__ || Object.getPrototypeOf(WrappedInput.prototype), 'enable', this).call(this);
- }
- }, {
- key: 'disable',
- value: function disable() {
- _get(WrappedInput.prototype.__proto__ || Object.getPrototypeOf(WrappedInput.prototype), 'enable', this).call(this);
- }
- }, {
- key: 'setValue',
- value: function setValue(value) {
- this.element.setAttribute('value', value);
- this.element.value = value;
- }
- }]);
-
- return WrappedInput;
-}(wrapped_element);
-
-/* harmony default export */ var wrapped_input = (WrappedInput);
-// CONCATENATED MODULE: ./src/scripts/src/components/wrapped-select.js
-var wrapped_select__createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
-
-var wrapped_select__get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
-
-function wrapped_select__classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
-
-function wrapped_select__possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
-
-function wrapped_select__inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
+"use strict";
+var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
-var WrappedSelect = function (_WrappedElement) {
- wrapped_select__inherits(WrappedSelect, _WrappedElement);
+var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
- function WrappedSelect(instance, element, classNames) {
- wrapped_select__classCallCheck(this, WrappedSelect);
+var _fuse = __webpack_require__(7);
- var _this = wrapped_select__possibleConstructorReturn(this, (WrappedSelect.__proto__ || Object.getPrototypeOf(WrappedSelect)).call(this, instance, element, classNames));
+var _fuse2 = _interopRequireDefault(_fuse);
- _this.parentInstance = instance;
- _this.element = element;
- _this.classNames = classNames;
- return _this;
- }
+var _store = __webpack_require__(8);
- wrapped_select__createClass(WrappedSelect, [{
- key: 'getElement',
- value: function getElement() {
- wrapped_select__get(WrappedSelect.prototype.__proto__ || Object.getPrototypeOf(WrappedSelect.prototype), 'getElement', this).call(this);
- }
- }, {
- key: 'conceal',
- value: function conceal() {
- wrapped_select__get(WrappedSelect.prototype.__proto__ || Object.getPrototypeOf(WrappedSelect.prototype), 'conceal', this).call(this);
- }
- }, {
- key: 'reveal',
- value: function reveal() {
- wrapped_select__get(WrappedSelect.prototype.__proto__ || Object.getPrototypeOf(WrappedSelect.prototype), 'reveal', this).call(this);
- }
- }, {
- key: 'enable',
- value: function enable() {
- wrapped_select__get(WrappedSelect.prototype.__proto__ || Object.getPrototypeOf(WrappedSelect.prototype), 'enable', this).call(this);
- }
- }, {
- key: 'disable',
- value: function disable() {
- wrapped_select__get(WrappedSelect.prototype.__proto__ || Object.getPrototypeOf(WrappedSelect.prototype), 'enable', this).call(this);
- }
- }, {
- key: 'setOptions',
- value: function setOptions(options) {
- this.element.innerHTML = '';
- this.element.appendChild(options);
- }
- }, {
- key: 'getPlaceholderOption',
- value: function getPlaceholderOption() {
- return this.element.querySelector('option[placeholder]');
- }
- }, {
- key: 'getOptions',
- value: function getOptions() {
- return Array.from(this.element.options);
- }
- }, {
- key: 'getOptionGroups',
- value: function getOptionGroups() {
- return Array.from(this.element.getElementsByTagName('OPTGROUP'));
- }
- }]);
+var _store2 = _interopRequireDefault(_store);
- return WrappedSelect;
-}(wrapped_element);
+var _dropdown = __webpack_require__(18);
-/* harmony default export */ var wrapped_select = (WrappedSelect);
-// CONCATENATED MODULE: ./src/scripts/src/constants.js
+var _dropdown2 = _interopRequireDefault(_dropdown);
-var DEFAULT_CLASSNAMES = {
- containerOuter: 'choices',
- containerInner: 'choices__inner',
- input: 'choices__input',
- inputCloned: 'choices__input--cloned',
- list: 'choices__list',
- listItems: 'choices__list--multiple',
- listSingle: 'choices__list--single',
- listDropdown: 'choices__list--dropdown',
- item: 'choices__item',
- itemSelectable: 'choices__item--selectable',
- itemDisabled: 'choices__item--disabled',
- itemChoice: 'choices__item--choice',
- placeholder: 'choices__placeholder',
- group: 'choices__group',
- groupHeading: 'choices__heading',
- button: 'choices__button',
- activeState: 'is-active',
- focusState: 'is-focused',
- openState: 'is-open',
- disabledState: 'is-disabled',
- highlightedState: 'is-highlighted',
- hiddenState: 'is-hidden',
- flippedState: 'is-flipped',
- loadingState: 'is-loading',
- noResults: 'has-no-results',
- noChoices: 'has-no-choices'
-};
+var _container = __webpack_require__(19);
-var DEFAULT_CONFIG = {
- silent: false,
- renderChoiceLimit: -1,
- maxItemCount: -1,
- addItems: true,
- removeItems: true,
- removeItemButton: false,
- editItems: false,
- duplicateItems: true,
- delimiter: ',',
- paste: true,
- searchEnabled: true,
- searchChoices: true,
- searchFloor: 1,
- searchResultLimit: 4,
- searchFields: ['label', 'value'],
- position: 'auto',
- resetScrollPosition: true,
- regexFilter: null,
- shouldSort: true,
- shouldSortItems: false,
- placeholder: true,
- placeholderValue: null,
- searchPlaceholderValue: null,
- prependValue: null,
- appendValue: null,
- renderSelectedChoices: 'auto',
- loadingText: 'Loading...',
- noResultsText: 'No results found',
- noChoicesText: 'No choices to choose from',
- itemSelectText: 'Press to select',
- addItemText: function addItemText(value) {
- return 'Press Enter to add "' + value + '" ';
- },
- maxItemText: function maxItemText(maxItemCount) {
- return 'Only ' + maxItemCount + ' values can be added.';
- },
- uniqueItemText: 'Only unique values can be added.',
- fuseOptions: {
- includeScore: true
- },
- callbackOnInit: null,
- callbackOnCreateTemplates: null
-};
+var _container2 = _interopRequireDefault(_container);
-var EVENTS = {
- showDropdown: 'showDropdown',
- hideDropdown: 'hideDropdown',
- change: 'change',
- choice: 'choice',
- search: 'search',
- addItem: 'addItem',
- removeItem: 'removeItem',
- highlightItem: 'highlightItem'
-};
+var _input = __webpack_require__(20);
-var ACTION_TYPES = {
- ADD_CHOICE: 'ADD_CHOICE',
- FILTER_CHOICES: 'FILTER_CHOICES',
- ACTIVATE_CHOICES: 'ACTIVATE_CHOICES',
- CLEAR_CHOICES: 'CLEAR_CHOICES',
- ADD_GROUP: 'ADD_GROUP',
- ADD_ITEM: 'ADD_ITEM',
- REMOVE_ITEM: 'REMOVE_ITEM',
- HIGHLIGHT_ITEM: 'HIGHLIGHT_ITEM',
- CLEAR_ALL: 'CLEAR_ALL'
-};
+var _input2 = _interopRequireDefault(_input);
-var KEY_CODES = {
- BACK_KEY: 46,
- DELETE_KEY: 8,
- ENTER_KEY: 13,
- A_KEY: 65,
- ESC_KEY: 27,
- UP_KEY: 38,
- DOWN_KEY: 40,
- PAGE_UP_KEY: 33,
- PAGE_DOWN_KEY: 34
-};
+var _list = __webpack_require__(21);
-var SCROLLING_SPEED = 4;
-// EXTERNAL MODULE: ./node_modules/classnames/index.js
-var classnames = __webpack_require__(9);
-var classnames_default = /*#__PURE__*/__webpack_require__.n(classnames);
+var _list2 = _interopRequireDefault(_list);
+
+var _wrappedInput = __webpack_require__(22);
+
+var _wrappedInput2 = _interopRequireDefault(_wrappedInput);
+
+var _wrappedSelect = __webpack_require__(23);
+
+var _wrappedSelect2 = _interopRequireDefault(_wrappedSelect);
+
+var _constants = __webpack_require__(1);
+
+var _templates = __webpack_require__(24);
+
+var _choices = __webpack_require__(26);
+
+var _items = __webpack_require__(27);
+
+var _groups = __webpack_require__(28);
+
+var _misc = __webpack_require__(29);
+
+var _utils = __webpack_require__(0);
+
+__webpack_require__(30);
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
-// CONCATENATED MODULE: ./src/scripts/src/templates.js
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
+function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
-
-
-var TEMPLATES = {
- containerOuter: function containerOuter(globalClasses, direction, isSelectElement, isSelectOneElement, searchEnabled, passedElementType) {
- var tabIndex = isSelectOneElement ? 'tabindex="0"' : '';
- var role = isSelectElement ? 'role="listbox"' : '';
- var ariaAutoComplete = '';
-
- if (isSelectElement && searchEnabled) {
- role = 'role="combobox"';
- ariaAutoComplete = 'aria-autocomplete="list"';
- }
-
- return strToEl('\n
\n
\n ');
- },
- containerInner: function containerInner(globalClasses) {
- return strToEl('\n
\n ');
- },
- itemList: function itemList(globalClasses, isSelectOneElement) {
- var _classNames;
-
- var localClasses = classnames_default()(globalClasses.list, (_classNames = {}, _defineProperty(_classNames, globalClasses.listSingle, isSelectOneElement), _defineProperty(_classNames, globalClasses.listItems, !isSelectOneElement), _classNames));
-
- return strToEl('\n
\n ');
- },
- placeholder: function placeholder(globalClasses, value) {
- return strToEl('\n \n ' + value + '\n
\n ');
- },
- item: function item(globalClasses, data, removeItemButton) {
- var _classNames2;
-
- var ariaSelected = data.active ? 'aria-selected="true"' : '';
- var ariaDisabled = data.disabled ? 'aria-disabled="true"' : '';
-
- var localClasses = classnames_default()(globalClasses.item, (_classNames2 = {}, _defineProperty(_classNames2, globalClasses.highlightedState, data.highlighted), _defineProperty(_classNames2, globalClasses.itemSelectable, !data.highlighted), _defineProperty(_classNames2, globalClasses.placeholder, data.placeholder), _classNames2));
-
- if (removeItemButton) {
- var _classNames3;
-
- localClasses = classnames_default()(globalClasses.item, (_classNames3 = {}, _defineProperty(_classNames3, globalClasses.highlightedState, data.highlighted), _defineProperty(_classNames3, globalClasses.itemSelectable, !data.disabled), _defineProperty(_classNames3, globalClasses.placeholder, data.placeholder), _classNames3));
-
- return strToEl('\n \n ' + data.label + '\n Remove item\n \n
\n ');
- }
-
- return strToEl('\n \n ' + data.label + '\n
\n ');
- },
- choiceList: function choiceList(globalClasses, isSelectOneElement) {
- var ariaMultiSelectable = !isSelectOneElement ? 'aria-multiselectable="true"' : '';
-
- return strToEl('\n \n
\n ');
- },
- choiceGroup: function choiceGroup(globalClasses, data) {
- var ariaDisabled = data.disabled ? 'aria-disabled="true"' : '';
- var localClasses = classnames_default()(globalClasses.group, _defineProperty({}, globalClasses.itemDisabled, data.disabled));
-
- return strToEl('\n \n ');
- },
- choice: function choice(globalClasses, data, itemSelectText) {
- var _classNames5;
-
- var role = data.groupId > 0 ? 'role="treeitem"' : 'role="option"';
- var localClasses = classnames_default()(globalClasses.item, globalClasses.itemChoice, (_classNames5 = {}, _defineProperty(_classNames5, globalClasses.itemDisabled, data.disabled), _defineProperty(_classNames5, globalClasses.itemSelectable, !data.disabled), _defineProperty(_classNames5, globalClasses.placeholder, data.placeholder), _classNames5));
-
- return strToEl('\n \n ' + data.label + '\n
\n ');
- },
- input: function input(globalClasses) {
- var localClasses = classnames_default()(globalClasses.input, globalClasses.inputCloned);
-
- return strToEl('\n \n ');
- },
- dropdown: function dropdown(globalClasses) {
- var localClasses = classnames_default()(globalClasses.list, globalClasses.listDropdown);
-
- return strToEl('\n \n
\n ');
- },
- notice: function notice(globalClasses, label) {
- var _classNames6;
-
- var type = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
-
- var localClasses = classnames_default()(globalClasses.item, globalClasses.itemChoice, (_classNames6 = {}, _defineProperty(_classNames6, globalClasses.noResults, type === 'no-results'), _defineProperty(_classNames6, globalClasses.noChoices, type === 'no-choices'), _classNames6));
-
- return strToEl('\n \n ' + label + '\n
\n ');
- },
- option: function option(globalClasses, data) {
- return strToEl('\n ' + data.label + ' \n ');
- }
-};
-
-/* harmony default export */ var templates = (TEMPLATES);
-// CONCATENATED MODULE: ./src/scripts/src/actions/choices.js
-
-
-var choices_addChoice = function addChoice(value, label, id, groupId, disabled, elementId, customProperties, placeholder, keyCode) {
- return {
- type: ACTION_TYPES.ADD_CHOICE,
- value: value,
- label: label,
- id: id,
- groupId: groupId,
- disabled: disabled,
- elementId: elementId,
- customProperties: customProperties,
- placeholder: placeholder,
- keyCode: keyCode
- };
-};
-
-var choices_filterChoices = function filterChoices(results) {
- return {
- type: ACTION_TYPES.FILTER_CHOICES,
- results: results
- };
-};
-
-var choices_activateChoices = function activateChoices() {
- var active = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
- return {
- type: ACTION_TYPES.ACTIVATE_CHOICES,
- active: active
- };
-};
-
-var choices_clearChoices = function clearChoices() {
- return {
- type: ACTION_TYPES.CLEAR_CHOICES
- };
-};
-// CONCATENATED MODULE: ./src/scripts/src/actions/items.js
-
-
-var items_addItem = function addItem(value, label, id, choiceId, groupId, customProperties, placeholder, keyCode) {
- return {
- type: ACTION_TYPES.ADD_ITEM,
- value: value,
- label: label,
- id: id,
- choiceId: choiceId,
- groupId: groupId,
- customProperties: customProperties,
- placeholder: placeholder,
- keyCode: keyCode
- };
-};
-
-var items_removeItem = function removeItem(id, choiceId) {
- return {
- type: ACTION_TYPES.REMOVE_ITEM,
- id: id,
- choiceId: choiceId
- };
-};
-
-var items_highlightItem = function highlightItem(id, highlighted) {
- return {
- type: ACTION_TYPES.HIGHLIGHT_ITEM,
- id: id,
- highlighted: highlighted
- };
-};
-// CONCATENATED MODULE: ./src/scripts/src/actions/groups.js
-
-
-/* eslint-disable import/prefer-default-export */
-var groups_addGroup = function addGroup(value, id, active, disabled) {
- return {
- type: ACTION_TYPES.ADD_GROUP,
- value: value,
- id: id,
- active: active,
- disabled: disabled
- };
-};
-// CONCATENATED MODULE: ./src/scripts/src/actions/misc.js
-/* eslint-disable import/prefer-default-export */
-var clearAll = function clearAll() {
- return {
- type: 'CLEAR_ALL'
- };
-};
-// EXTERNAL MODULE: ./src/scripts/src/lib/polyfills.js
-var polyfills = __webpack_require__(10);
-var polyfills_default = /*#__PURE__*/__webpack_require__.n(polyfills);
-
-// CONCATENATED MODULE: ./src/scripts/src/choices.js
-var choices__extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
-
-var choices__createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
-
-function choices__defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
-
-function src_choices__toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
-
-function choices__classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
/**
* Choices
*/
-
-var choices_Choices = function () {
+var Choices = function () {
function Choices() {
var element = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '[data-choice]';
var userConfig = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
- choices__classCallCheck(this, Choices);
+ _classCallCheck(this, Choices);
// If there are multiple elements, create a new instance
// for each element besides the first one (as that already has an instance)
- if (isType('String', element)) {
+ if ((0, _utils.isType)('String', element)) {
var elements = document.querySelectorAll(element);
if (elements.length > 1) {
for (var i = 1; i < elements.length; i += 1) {
@@ -3186,22 +1845,22 @@ var choices_Choices = function () {
}
}
- var defaultConfig = choices__extends({}, DEFAULT_CONFIG, {
+ var defaultConfig = _extends({}, _constants.DEFAULT_CONFIG, {
items: [],
choices: [],
- classNames: DEFAULT_CLASSNAMES,
- sortFilter: sortByAlpha
+ classNames: _constants.DEFAULT_CLASSNAMES,
+ sortFilter: _utils.sortByAlpha
});
// Merge options with user options
- this.config = extend(defaultConfig, Choices.userDefaults, userConfig);
+ this.config = (0, _utils.extend)(defaultConfig, Choices.userDefaults, userConfig);
if (!['auto', 'always'].includes(this.config.renderSelectedChoices)) {
this.config.renderSelectedChoices = 'auto';
}
// Create data store
- this.store = new store_store(this.render);
+ this.store = new _store2.default(this.render);
// State tracking
this.initialised = false;
@@ -3210,7 +1869,7 @@ var choices_Choices = function () {
this.currentValue = '';
// Retrieve triggering element (i.e. element with 'data-choice' trigger)
- var passedElement = isType('String', element) ? document.querySelector(element) : element;
+ var passedElement = (0, _utils.isType)('String', element) ? document.querySelector(element) : element;
this.isTextElement = passedElement.type === 'text';
this.isSelectOneElement = passedElement.type === 'select-one';
@@ -3219,9 +1878,9 @@ var choices_Choices = function () {
this.isValidElementType = this.isTextElement || this.isSelectElement;
if (this.isTextElement) {
- this.passedElement = new wrapped_input(this, passedElement, this.config.classNames);
+ this.passedElement = new _wrappedInput2.default(this, passedElement, this.config.classNames);
} else if (this.isSelectElement) {
- this.passedElement = new wrapped_select(this, passedElement, this.config.classNames);
+ this.passedElement = new _wrappedSelect2.default(this, passedElement, this.config.classNames);
}
if (!this.passedElement) {
@@ -3259,7 +1918,7 @@ var choices_Choices = function () {
}
// Set unique base Id
- this.baseId = generateId(this.passedElement.element, 'choices-');
+ this.baseId = (0, _utils.generateId)(this.passedElement.element, 'choices-');
this.idNames = {
itemChoice: 'item-choice'
@@ -3288,7 +1947,7 @@ var choices_Choices = function () {
console.error('Choices: Your browser doesn\'t support Choices');
}
- var canInit = isElement(this.passedElement.element) && this.isValidElementType;
+ var canInit = (0, _utils.isElement)(this.passedElement.element) && this.isValidElementType;
if (canInit) {
// If element has already been initialised with Choices
@@ -3314,7 +1973,7 @@ var choices_Choices = function () {
*/
- choices__createClass(Choices, [{
+ _createClass(Choices, [{
key: 'init',
value: function init() {
if (this.initialised) {
@@ -3336,7 +1995,7 @@ var choices_Choices = function () {
var callback = this.config.callbackOnInit;
// Run callback if it is a function
- if (callback && isType('Function', callback)) {
+ if (callback && (0, _utils.isType)('Function', callback)) {
callback.call(this);
}
}
@@ -3481,7 +2140,7 @@ var choices_Choices = function () {
searchResultLimit = _config.searchResultLimit,
renderChoiceLimit = _config.renderChoiceLimit;
- var filter = this.isSearching ? sortByScore : this.config.sortFilter;
+ var filter = this.isSearching ? _utils.sortByScore : this.config.sortFilter;
var appendChoice = function appendChoice(choice) {
var shouldRender = renderSelectedChoices === 'auto' ? _this2.isSelectOneElement || !choice.selected : true;
if (shouldRender) {
@@ -3521,7 +2180,7 @@ var choices_Choices = function () {
var choiceLimit = rendererableChoices.length;
// Prepend placeholeder
- var sortedChoices = [].concat(src_choices__toConsumableArray(placeholderChoices), src_choices__toConsumableArray(normalChoices));
+ var sortedChoices = [].concat(_toConsumableArray(placeholderChoices), _toConsumableArray(normalChoices));
if (this.isSearching) {
choiceLimit = searchResultLimit;
@@ -3668,11 +2327,11 @@ var choices_Choices = function () {
var notice = void 0;
if (this.isSearching) {
- notice = isType('Function', this.config.noResultsText) ? this.config.noResultsText() : this.config.noResultsText;
+ notice = (0, _utils.isType)('Function', this.config.noResultsText) ? this.config.noResultsText() : this.config.noResultsText;
dropdownItem = this._getTemplate('notice', notice, 'no-results');
} else {
- notice = isType('Function', this.config.noChoicesText) ? this.config.noChoicesText() : this.config.noChoicesText;
+ notice = (0, _utils.isType)('Function', this.config.noChoicesText) ? this.config.noChoicesText() : this.config.noChoicesText;
dropdownItem = this._getTemplate('notice', notice, 'no-choices');
}
@@ -3730,10 +2389,10 @@ var choices_Choices = function () {
var group = groupId >= 0 ? this.store.getGroupById(groupId) : null;
- this.store.dispatch(items_highlightItem(id, true));
+ this.store.dispatch((0, _items.highlightItem)(id, true));
if (runEvent) {
- this.passedElement.triggerEvent(EVENTS.highlightItem, {
+ this.passedElement.triggerEvent(_constants.EVENTS.highlightItem, {
id: id,
value: value,
label: label,
@@ -3768,8 +2427,8 @@ var choices_Choices = function () {
var group = groupId >= 0 ? this.store.getGroupById(groupId) : null;
- this.store.dispatch(items_highlightItem(id, false));
- this.passedElement.triggerEvent(EVENTS.highlightItem, {
+ this.store.dispatch((0, _items.highlightItem)(id, false));
+ this.passedElement.triggerEvent(_constants.EVENTS.highlightItem, {
id: id,
value: value,
label: label,
@@ -3827,7 +2486,7 @@ var choices_Choices = function () {
value: function removeItemsByValue(value) {
var _this6 = this;
- if (!value || !isType('String', value)) {
+ if (!value || !(0, _utils.isType)('String', value)) {
return this;
}
@@ -3914,7 +2573,7 @@ var choices_Choices = function () {
this.containerOuter.open(this.dropdown.getVerticalPos());
this.dropdown.show();
this.input.activate(focusInput);
- this.passedElement.triggerEvent(EVENTS.showDropdown, {});
+ this.passedElement.triggerEvent(_constants.EVENTS.showDropdown, {});
return this;
}
@@ -3937,7 +2596,7 @@ var choices_Choices = function () {
this.containerOuter.close();
this.dropdown.hide();
this.input.deactivate(blurInput);
- this.passedElement.triggerEvent(EVENTS.hideDropdown, {});
+ this.passedElement.triggerEvent(_constants.EVENTS.hideDropdown, {});
return this;
}
@@ -4002,7 +2661,7 @@ var choices_Choices = function () {
}
// Convert args to an iterable array
- var values = [].concat(src_choices__toConsumableArray(args));
+ var values = [].concat(_toConsumableArray(args));
values.forEach(function (value) {
return _this9._setChoiceOrItem(value);
});
@@ -4027,7 +2686,7 @@ var choices_Choices = function () {
}
// If only one value has been passed, convert to array
- var choiceValue = isType('Array', value) ? value : [value];
+ var choiceValue = (0, _utils.isType)('Array', value) ? value : [value];
// Loop through each value and
choiceValue.forEach(function (val) {
@@ -4058,7 +2717,7 @@ var choices_Choices = function () {
var label = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
var replaceChoices = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
- if (!this.initialised || !this.isSelectElement || !isType('Array', choices) || !value) {
+ if (!this.initialised || !this.isSelectElement || !(0, _utils.isType)('Array', choices) || !value) {
return this;
}
@@ -4094,7 +2753,7 @@ var choices_Choices = function () {
}, {
key: 'clearStore',
value: function clearStore() {
- this.store.dispatch(clearAll());
+ this.store.dispatch((0, _misc.clearAll)());
return this;
}
@@ -4112,7 +2771,7 @@ var choices_Choices = function () {
if (!this.isTextElement && this.config.searchEnabled) {
this.isSearching = false;
- this.store.dispatch(choices_activateChoices(true));
+ this.store.dispatch((0, _choices.activateChoices)(true));
}
return this;
@@ -4162,7 +2821,7 @@ var choices_Choices = function () {
return;
}
- this.passedElement.triggerEvent(EVENTS.change, {
+ this.passedElement.triggerEvent(_constants.EVENTS.change, {
value: value
});
}
@@ -4272,7 +2931,7 @@ var choices_Choices = function () {
// Update choice keyCode
choice.keyCode = passedKeyCode;
- this.passedElement.triggerEvent(EVENTS.choice, {
+ this.passedElement.triggerEvent(_constants.EVENTS.choice, {
choice: choice
});
@@ -4377,14 +3036,14 @@ var choices_Choices = function () {
key: '_canAddItem',
value: function _canAddItem(activeItems, value) {
var canAddItem = true;
- var notice = isType('Function', this.config.addItemText) ? this.config.addItemText(value) : this.config.addItemText;
+ var notice = (0, _utils.isType)('Function', this.config.addItemText) ? this.config.addItemText(value) : this.config.addItemText;
if (this.isSelectMultipleElement || this.isTextElement) {
if (this.config.maxItemCount > 0 && this.config.maxItemCount <= activeItems.length) {
// If there is a max entry limit and we have reached that limit
// don't update
canAddItem = false;
- notice = isType('Function', this.config.maxItemText) ? this.config.maxItemText(this.config.maxItemCount) : this.config.maxItemText;
+ notice = (0, _utils.isType)('Function', this.config.maxItemText) ? this.config.maxItemText(this.config.maxItemCount) : this.config.maxItemText;
}
}
@@ -4392,13 +3051,13 @@ var choices_Choices = function () {
// If a user has supplied a regular expression filter
// determine whether we can update based on whether
// our regular expression passes
- canAddItem = regexFilter(value, this.config.regexFilter);
+ canAddItem = (0, _utils.regexFilter)(value, this.config.regexFilter);
}
// If no duplicates are allowed, and the value already exists
// in the array
var isUnique = !activeItems.some(function (item) {
- if (isType('String', value)) {
+ if ((0, _utils.isType)('String', value)) {
return item.value === value.trim();
}
@@ -4407,7 +3066,7 @@ var choices_Choices = function () {
if (!isUnique && !this.config.duplicateItems && !this.isSelectOneElement && canAddItem) {
canAddItem = false;
- notice = isType('Function', this.config.uniqueItemText) ? this.config.uniqueItemText(value) : this.config.uniqueItemText;
+ notice = (0, _utils.isType)('Function', this.config.uniqueItemText) ? this.config.uniqueItemText(value) : this.config.uniqueItemText;
}
return {
@@ -4432,9 +3091,9 @@ var choices_Choices = function () {
return;
}
- var parsedResults = isType('Object', results) ? [results] : results;
+ var parsedResults = (0, _utils.isType)('Object', results) ? [results] : results;
- if (parsedResults && isType('Array', parsedResults) && parsedResults.length) {
+ if (parsedResults && (0, _utils.isType)('Array', parsedResults) && parsedResults.length) {
// Remove loading states/text
_this14._handleLoadingState(false);
// Add each result as a choice
@@ -4467,8 +3126,8 @@ var choices_Choices = function () {
}, {
key: '_searchChoices',
value: function _searchChoices(value) {
- var newValue = isType('String', value) ? value.trim() : value;
- var currentValue = isType('String', this.currentValue) ? this.currentValue.trim() : this.currentValue;
+ var newValue = (0, _utils.isType)('String', value) ? value.trim() : value;
+ var currentValue = (0, _utils.isType)('String', this.currentValue) ? this.currentValue.trim() : this.currentValue;
if (newValue.length < 1 && newValue === currentValue + ' ') {
return 0;
@@ -4477,15 +3136,15 @@ var choices_Choices = function () {
// If new value matches the desired length and is not the same as the current value with a space
var haystack = this.store.getSearchableChoices();
var needle = newValue;
- var keys = isType('Array', this.config.searchFields) ? this.config.searchFields : [this.config.searchFields];
+ var keys = (0, _utils.isType)('Array', this.config.searchFields) ? this.config.searchFields : [this.config.searchFields];
var options = Object.assign(this.config.fuseOptions, { keys: keys });
- var fuse = new fuse_default.a(haystack, options);
+ var fuse = new _fuse2.default(haystack, options);
var results = fuse.search(needle);
this.currentValue = newValue;
this.highlightPosition = 0;
this.isSearching = true;
- this.store.dispatch(choices_filterChoices(results));
+ this.store.dispatch((0, _choices.filterChoices)(results));
return results.length;
}
@@ -4513,14 +3172,14 @@ var choices_Choices = function () {
if (value && value.length >= this.config.searchFloor) {
var resultCount = this.config.searchChoices ? this._searchChoices(value) : 0;
// Trigger search event
- this.passedElement.triggerEvent(EVENTS.search, {
+ this.passedElement.triggerEvent(_constants.EVENTS.search, {
value: value,
resultCount: resultCount
});
} else if (hasUnactiveChoices) {
// Otherwise reset choices to active
this.isSearching = false;
- this.store.dispatch(choices_activateChoices(true));
+ this.store.dispatch((0, _choices.activateChoices)(true));
}
}
@@ -4602,15 +3261,15 @@ var choices_Choices = function () {
var hasActiveDropdown = this.dropdown.isActive;
var hasItems = this.itemList.hasChildren;
var keyString = String.fromCharCode(e.keyCode);
- var backKey = KEY_CODES.BACK_KEY;
- var deleteKey = KEY_CODES.DELETE_KEY;
- var enterKey = KEY_CODES.ENTER_KEY;
- var aKey = KEY_CODES.A_KEY;
- var escapeKey = KEY_CODES.ESC_KEY;
- var upKey = KEY_CODES.UP_KEY;
- var downKey = KEY_CODES.DOWN_KEY;
- var pageUpKey = KEY_CODES.PAGE_UP_KEY;
- var pageDownKey = KEY_CODES.PAGE_DOWN_KEY;
+ var backKey = _constants.KEY_CODES.BACK_KEY;
+ var deleteKey = _constants.KEY_CODES.DELETE_KEY;
+ var enterKey = _constants.KEY_CODES.ENTER_KEY;
+ var aKey = _constants.KEY_CODES.A_KEY;
+ var escapeKey = _constants.KEY_CODES.ESC_KEY;
+ var upKey = _constants.KEY_CODES.UP_KEY;
+ var downKey = _constants.KEY_CODES.DOWN_KEY;
+ var pageUpKey = _constants.KEY_CODES.PAGE_UP_KEY;
+ var pageDownKey = _constants.KEY_CODES.PAGE_DOWN_KEY;
var ctrlDownKey = e.ctrlKey || e.metaKey;
// If a user is typing and the dropdown is not active
@@ -4698,7 +3357,7 @@ var choices_Choices = function () {
} else {
var currentEl = _this15.dropdown.element.querySelector('.' + _this15.config.classNames.highlightedState);
if (currentEl) {
- nextEl = getAdjacentEl(currentEl, '[data-choice-selectable]', directionInt);
+ nextEl = (0, _utils.getAdjacentEl)(currentEl, '[data-choice-selectable]', directionInt);
} else {
nextEl = _this15.dropdown.element.querySelector('[data-choice-selectable]');
}
@@ -4707,7 +3366,7 @@ var choices_Choices = function () {
if (nextEl) {
// We prevent default to stop the cursor moving
// when pressing the arrow
- if (!isScrolledIntoView(nextEl, _this15.choiceList, directionInt)) {
+ if (!(0, _utils.isScrolledIntoView)(nextEl, _this15.choiceList, directionInt)) {
_this15._scrollToChoice(nextEl, directionInt);
}
_this15._highlightChoice(nextEl);
@@ -4728,7 +3387,7 @@ var choices_Choices = function () {
};
// Map keys to key actions
- var keyDownActions = (_keyDownActions = {}, choices__defineProperty(_keyDownActions, aKey, onAKey), choices__defineProperty(_keyDownActions, enterKey, onEnterKey), choices__defineProperty(_keyDownActions, escapeKey, onEscapeKey), choices__defineProperty(_keyDownActions, upKey, onDirectionKey), choices__defineProperty(_keyDownActions, pageUpKey, onDirectionKey), choices__defineProperty(_keyDownActions, downKey, onDirectionKey), choices__defineProperty(_keyDownActions, pageDownKey, onDirectionKey), choices__defineProperty(_keyDownActions, deleteKey, onDeleteKey), choices__defineProperty(_keyDownActions, backKey, onDeleteKey), _keyDownActions);
+ var keyDownActions = (_keyDownActions = {}, _defineProperty(_keyDownActions, aKey, onAKey), _defineProperty(_keyDownActions, enterKey, onEnterKey), _defineProperty(_keyDownActions, escapeKey, onEscapeKey), _defineProperty(_keyDownActions, upKey, onDirectionKey), _defineProperty(_keyDownActions, pageUpKey, onDirectionKey), _defineProperty(_keyDownActions, downKey, onDirectionKey), _defineProperty(_keyDownActions, pageDownKey, onDirectionKey), _defineProperty(_keyDownActions, deleteKey, onDeleteKey), _defineProperty(_keyDownActions, backKey, onDeleteKey), _keyDownActions);
// If keycode has a function, run it
if (keyDownActions[e.keyCode]) {
@@ -4772,15 +3431,15 @@ var choices_Choices = function () {
this.hideDropdown();
}
} else {
- var backKey = KEY_CODES.BACK_KEY;
- var deleteKey = KEY_CODES.DELETE_KEY;
+ var backKey = _constants.KEY_CODES.BACK_KEY;
+ var deleteKey = _constants.KEY_CODES.DELETE_KEY;
// If user has removed value...
if ((e.keyCode === backKey || e.keyCode === deleteKey) && !e.target.value) {
// ...and it is a multiple select input, activate choices (if searching)
if (!this.isTextElement && this.isSearching) {
this.isSearching = false;
- this.store.dispatch(choices_activateChoices(true));
+ this.store.dispatch((0, _choices.activateChoices)(true));
}
} else if (this.canSearch && canAddItem.response) {
this._handleSearch(this.input.getValue());
@@ -4856,9 +3515,9 @@ var choices_Choices = function () {
var activeItems = this.store.getItemsFilteredByActive();
var hasShiftKey = e.shiftKey;
- var buttonTarget = findAncestorByAttrName(target, 'data-button');
- var itemTarget = findAncestorByAttrName(target, 'data-item');
- var choiceTarget = findAncestorByAttrName(target, 'data-choice');
+ var buttonTarget = (0, _utils.findAncestorByAttrName)(target, 'data-button');
+ var itemTarget = (0, _utils.findAncestorByAttrName)(target, 'data-item');
+ var choiceTarget = (0, _utils.findAncestorByAttrName)(target, 'data-choice');
if (buttonTarget) {
this._handleButtonAction(activeItems, buttonTarget);
@@ -5077,7 +3736,7 @@ var choices_Choices = function () {
var endPoint = direction > 0 ? this.choiceList.scrollPos + choicePos - containerScrollPos : choice.offsetTop;
var animateScroll = function animateScroll() {
- var strength = SCROLLING_SPEED;
+ var strength = _constants.SCROLLING_SPEED;
var choiceListScrollTop = _this18.choiceList.scrollPos;
var continueAnimation = false;
var easing = void 0;
@@ -5192,7 +3851,7 @@ var choices_Choices = function () {
var placeholder = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
var keyCode = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : null;
- var passedValue = isType('String', value) ? value.trim() : value;
+ var passedValue = (0, _utils.isType)('String', value) ? value.trim() : value;
var passedKeyCode = keyCode;
var items = this.store.getItems();
var passedLabel = label || passedValue;
@@ -5214,7 +3873,7 @@ var choices_Choices = function () {
passedValue += this.config.appendValue.toString();
}
- this.store.dispatch(items_addItem(passedValue, passedLabel, id, passedOptionId, groupId, customProperties, placeholder, passedKeyCode));
+ this.store.dispatch((0, _items.addItem)(passedValue, passedLabel, id, passedOptionId, groupId, customProperties, placeholder, passedKeyCode));
if (this.isSelectOneElement) {
this.removeActiveItems(id);
@@ -5222,7 +3881,7 @@ var choices_Choices = function () {
// Trigger change event
if (group && group.value) {
- this.passedElement.triggerEvent(EVENTS.addItem, {
+ this.passedElement.triggerEvent(_constants.EVENTS.addItem, {
id: id,
value: passedValue,
label: passedLabel,
@@ -5230,7 +3889,7 @@ var choices_Choices = function () {
keyCode: passedKeyCode
});
} else {
- this.passedElement.triggerEvent(EVENTS.addItem, {
+ this.passedElement.triggerEvent(_constants.EVENTS.addItem, {
id: id,
value: passedValue,
label: passedLabel,
@@ -5251,7 +3910,7 @@ var choices_Choices = function () {
}, {
key: '_removeItem',
value: function _removeItem(item) {
- if (!item || !isType('Object', item)) {
+ if (!item || !(0, _utils.isType)('Object', item)) {
return this;
}
@@ -5262,17 +3921,17 @@ var choices_Choices = function () {
var groupId = item.groupId;
var group = groupId >= 0 ? this.store.getGroupById(groupId) : null;
- this.store.dispatch(items_removeItem(id, choiceId));
+ this.store.dispatch((0, _items.removeItem)(id, choiceId));
if (group && group.value) {
- this.passedElement.triggerEvent(EVENTS.removeItem, {
+ this.passedElement.triggerEvent(_constants.EVENTS.removeItem, {
id: id,
value: value,
label: label,
groupValue: group.value
});
} else {
- this.passedElement.triggerEvent(EVENTS.removeItem, {
+ this.passedElement.triggerEvent(_constants.EVENTS.removeItem, {
id: id,
value: value,
label: label
@@ -5315,7 +3974,7 @@ var choices_Choices = function () {
var choiceId = choices ? choices.length + 1 : 1;
var choiceElementId = this.baseId + '-' + this.idNames.itemChoice + '-' + choiceId;
- this.store.dispatch(choices_addChoice(value, choiceLabel, choiceId, groupId, isDisabled, choiceElementId, customProperties, placeholder, keyCode));
+ this.store.dispatch((0, _choices.addChoice)(value, choiceLabel, choiceId, groupId, isDisabled, choiceElementId, customProperties, placeholder, keyCode));
if (isSelected) {
this._addItem(value, choiceLabel, choiceId, undefined, customProperties, placeholder, keyCode);
@@ -5331,7 +3990,7 @@ var choices_Choices = function () {
}, {
key: '_clearChoices',
value: function _clearChoices() {
- this.store.dispatch(choices_clearChoices());
+ this.store.dispatch((0, _choices.clearChoices)());
}
/**
@@ -5352,21 +4011,21 @@ var choices_Choices = function () {
var valueKey = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'value';
var labelKey = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'label';
- var groupChoices = isType('Object', group) ? group.choices : Array.from(group.getElementsByTagName('OPTION'));
+ var groupChoices = (0, _utils.isType)('Object', group) ? group.choices : Array.from(group.getElementsByTagName('OPTION'));
var groupId = id || Math.floor(new Date().valueOf() * Math.random());
var isDisabled = group.disabled ? group.disabled : false;
if (groupChoices) {
- this.store.dispatch(groups_addGroup(group.label, groupId, true, isDisabled));
+ this.store.dispatch((0, _groups.addGroup)(group.label, groupId, true, isDisabled));
var addGroupChoices = function addGroupChoices(choice) {
var isOptDisabled = choice.disabled || choice.parentNode && choice.parentNode.disabled;
- _this20._addChoice(choice[valueKey], isType('Object', choice) ? choice[labelKey] : choice.innerHTML, choice.selected, isOptDisabled, groupId, choice.customProperties, choice.placeholder);
+ _this20._addChoice(choice[valueKey], (0, _utils.isType)('Object', choice) ? choice[labelKey] : choice.innerHTML, choice.selected, isOptDisabled, groupId, choice.customProperties, choice.placeholder);
};
groupChoices.forEach(addGroupChoices);
} else {
- this.store.dispatch(groups_addGroup(group.label, group.id, false, group.disabled));
+ this.store.dispatch((0, _groups.addGroup)(group.label, group.id, false, group.disabled));
}
}
@@ -5408,11 +4067,11 @@ var choices_Choices = function () {
// User's custom templates
var callbackTemplate = this.config.callbackOnCreateTemplates;
var userTemplates = {};
- if (callbackTemplate && isType('Function', callbackTemplate)) {
- userTemplates = callbackTemplate.call(this, strToEl);
+ if (callbackTemplate && (0, _utils.isType)('Function', callbackTemplate)) {
+ userTemplates = callbackTemplate.call(this, _utils.strToEl);
}
- this.config.templates = extend(TEMPLATES, userTemplates);
+ this.config.templates = (0, _utils.extend)(_templates.TEMPLATES, userTemplates);
}
/**
@@ -5432,19 +4091,19 @@ var choices_Choices = function () {
var input = this._getTemplate('input');
var dropdown = this._getTemplate('dropdown');
- this.containerOuter = new container(this, containerOuter, this.config.classNames);
- this.containerInner = new container(this, containerInner, this.config.classNames);
- this.input = new components_input(this, input, this.config.classNames);
- this.choiceList = new list(this, choiceList, this.config.classNames);
- this.itemList = new list(this, itemList, this.config.classNames);
- this.dropdown = new components_dropdown(this, dropdown, this.config.classNames);
+ this.containerOuter = new _container2.default(this, containerOuter, this.config.classNames);
+ this.containerInner = new _container2.default(this, containerInner, this.config.classNames);
+ this.input = new _input2.default(this, input, this.config.classNames);
+ this.choiceList = new _list2.default(this, choiceList, this.config.classNames);
+ this.itemList = new _list2.default(this, itemList, this.config.classNames);
+ this.dropdown = new _dropdown2.default(this, dropdown, this.config.classNames);
this.passedElement.conceal();
// Wrap input in container preserving DOM ordering
- wrap(this.passedElement.element, this.containerInner.element);
+ (0, _utils.wrap)(this.passedElement.element, this.containerInner.element);
// Wrapper inner container with outer container
- wrap(this.containerInner.element, this.containerOuter.element);
+ (0, _utils.wrap)(this.containerInner.element, this.containerOuter.element);
if (this.isSelectOneElement) {
this.input.setPlaceholder(this.config.searchPlaceholderValue || '');
@@ -5555,7 +4214,7 @@ var choices_Choices = function () {
var _this22 = this;
var handlePresetItem = function handlePresetItem(item) {
- var itemType = getType(item);
+ var itemType = (0, _utils.getType)(item);
if (itemType === 'Object') {
if (!item.value) {
return;
@@ -5575,7 +4234,7 @@ var choices_Choices = function () {
value: function _setChoiceOrItem(item) {
var _this23 = this;
- var itemType = getType(item).toLowerCase();
+ var itemType = (0, _utils.getType)(item).toLowerCase();
var handleType = {
object: function object() {
if (!item.value) {
@@ -5622,13 +4281,11 @@ var choices_Choices = function () {
return Choices;
}();
-/* harmony default export */ var src_choices = __webpack_exports__["default"] = (choices_Choices);
-
-
-choices_Choices.userDefaults = {};
+Choices.userDefaults = {};
+module.exports = Choices;
/***/ }),
-/* 3 */
+/* 7 */
/***/ (function(module, exports, __webpack_require__) {
/*!
@@ -6629,7 +5286,270 @@ module.exports = Fuse;
//# sourceMappingURL=fuse.js.map
/***/ }),
-/* 4 */
+/* 8 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+
+var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
+
+var _redux = __webpack_require__(2);
+
+var _index = __webpack_require__(14);
+
+var _index2 = _interopRequireDefault(_index);
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
+
+function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
+
+var Store = function () {
+ function Store() {
+ _classCallCheck(this, Store);
+
+ this.store = (0, _redux.createStore)(_index2.default, window.devToolsExtension ? window.devToolsExtension() : undefined);
+ }
+
+ /**
+ * Subscribe store to function call (wrapped Redux method)
+ * @param {Function} onChange Function to trigger when state changes
+ * @return
+ */
+
+
+ _createClass(Store, [{
+ key: 'subscribe',
+ value: function subscribe(onChange) {
+ this.store.subscribe(onChange);
+ }
+
+ /**
+ * Dispatch event to store (wrapped Redux method)
+ * @param {Function} action Action function to trigger
+ * @return
+ */
+
+ }, {
+ key: 'dispatch',
+ value: function dispatch(action) {
+ this.store.dispatch(action);
+ }
+
+ /**
+ * Get store object (wrapping Redux method)
+ * @return {Object} State
+ */
+
+ }, {
+ key: 'getState',
+ value: function getState() {
+ return this.store.getState();
+ }
+
+ /**
+ * Get items from store
+ * @return {Array} Item objects
+ */
+
+ }, {
+ key: 'getItems',
+ value: function getItems() {
+ var state = this.store.getState();
+ return state.items;
+ }
+
+ /**
+ * Get active items from store
+ * @return {Array} Item objects
+ */
+
+ }, {
+ key: 'getItemsFilteredByActive',
+ value: function getItemsFilteredByActive() {
+ var items = this.getItems();
+ var values = items.filter(function (item) {
+ return item.active === true;
+ }, []);
+
+ return values;
+ }
+
+ /**
+ * Get items from store reduced to just their values
+ * @return {Array} Item objects
+ */
+
+ }, {
+ key: 'getItemsReducedToValues',
+ value: function getItemsReducedToValues() {
+ var items = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.getItems();
+
+ var values = items.reduce(function (prev, current) {
+ prev.push(current.value);
+ return prev;
+ }, []);
+
+ return values;
+ }
+
+ /**
+ * Get choices from store
+ * @return {Array} Option objects
+ */
+
+ }, {
+ key: 'getChoices',
+ value: function getChoices() {
+ var state = this.store.getState();
+ return state.choices;
+ }
+
+ /**
+ * Get active choices from store
+ * @return {Array} Option objects
+ */
+
+ }, {
+ key: 'getChoicesFilteredByActive',
+ value: function getChoicesFilteredByActive() {
+ var choices = this.getChoices();
+ var values = choices.filter(function (choice) {
+ return choice.active === true;
+ });
+
+ return values;
+ }
+
+ /**
+ * Get selectable choices from store
+ * @return {Array} Option objects
+ */
+
+ }, {
+ key: 'getChoicesFilteredBySelectable',
+ value: function getChoicesFilteredBySelectable() {
+ var choices = this.getChoices();
+ var values = choices.filter(function (choice) {
+ return choice.disabled !== true;
+ });
+
+ return values;
+ }
+
+ /**
+ * Get choices that can be searched (excluding placeholders)
+ * @return {Array} Option objects
+ */
+
+ }, {
+ key: 'getSearchableChoices',
+ value: function getSearchableChoices() {
+ var filtered = this.getChoicesFilteredBySelectable();
+ return filtered.filter(function (choice) {
+ return choice.placeholder !== true;
+ });
+ }
+
+ /**
+ * Get single choice by it's ID
+ * @return {Object} Found choice
+ */
+
+ }, {
+ key: 'getChoiceById',
+ value: function getChoiceById(id) {
+ if (id) {
+ var choices = this.getChoicesFilteredByActive();
+ var foundChoice = choices.find(function (choice) {
+ return choice.id === parseInt(id, 10);
+ });
+ return foundChoice;
+ }
+ return false;
+ }
+
+ /**
+ * Get placeholder choice from store
+ * @return {Object} Found placeholder
+ */
+
+ }, {
+ key: 'getPlaceholderChoice',
+ value: function getPlaceholderChoice() {
+ var choices = this.getChoices();
+ var placeholderChoice = [].concat(_toConsumableArray(choices)).reverse().find(function (choice) {
+ return choice.placeholder === true;
+ });
+
+ return placeholderChoice;
+ }
+
+ /**
+ * Get groups from store
+ * @return {Array} Group objects
+ */
+
+ }, {
+ key: 'getGroups',
+ value: function getGroups() {
+ var state = this.store.getState();
+ return state.groups;
+ }
+
+ /**
+ * Get active groups from store
+ * @return {Array} Group objects
+ */
+
+ }, {
+ key: 'getGroupsFilteredByActive',
+ value: function getGroupsFilteredByActive() {
+ var groups = this.getGroups();
+ var choices = this.getChoices();
+
+ var values = groups.filter(function (group) {
+ var isActive = group.active === true && group.disabled === false;
+ var hasActiveOptions = choices.some(function (choice) {
+ return choice.active === true && choice.disabled === false;
+ });
+ return isActive && hasActiveOptions;
+ }, []);
+
+ return values;
+ }
+
+ /**
+ * Get group by group id
+ * @param {Number} id Group ID
+ * @return {Object} Group data
+ */
+
+ }, {
+ key: 'getGroupById',
+ value: function getGroupById(id) {
+ var groups = this.getGroups();
+ var foundGroup = groups.find(function (group) {
+ return group.id === parseInt(id, 10);
+ });
+
+ return foundGroup;
+ }
+ }]);
+
+ return Store;
+}();
+
+exports.default = Store;
+
+/***/ }),
+/* 9 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
@@ -6638,17 +5558,17 @@ var freeGlobal = typeof global == 'object' && global && global.Object === Object
/* harmony default export */ __webpack_exports__["a"] = (freeGlobal);
-/* WEBPACK VAR INJECTION */}.call(__webpack_exports__, __webpack_require__(0)))
+/* WEBPACK VAR INJECTION */}.call(__webpack_exports__, __webpack_require__(3)))
/***/ }),
-/* 5 */
+/* 10 */
/***/ (function(module, exports, __webpack_require__) {
-module.exports = __webpack_require__(6);
+module.exports = __webpack_require__(11);
/***/ }),
-/* 6 */
+/* 11 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -6658,7 +5578,7 @@ Object.defineProperty(exports, "__esModule", {
value: true
});
-var _ponyfill = __webpack_require__(8);
+var _ponyfill = __webpack_require__(13);
var _ponyfill2 = _interopRequireDefault(_ponyfill);
@@ -6681,10 +5601,10 @@ if (typeof self !== 'undefined') {
var result = (0, _ponyfill2['default'])(root);
exports['default'] = result;
-/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0), __webpack_require__(7)(module)))
+/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(3), __webpack_require__(12)(module)))
/***/ }),
-/* 7 */
+/* 12 */
/***/ (function(module, exports) {
module.exports = function(module) {
@@ -6712,7 +5632,7 @@ module.exports = function(module) {
/***/ }),
-/* 8 */
+/* 13 */
/***/ (function(module, exports, __webpack_require__) {
"use strict";
@@ -6741,7 +5661,1227 @@ function symbolObservablePonyfill(root) {
};
/***/ }),
-/* 9 */
+/* 14 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+
+var _redux = __webpack_require__(2);
+
+var _items = __webpack_require__(15);
+
+var _items2 = _interopRequireDefault(_items);
+
+var _groups = __webpack_require__(16);
+
+var _groups2 = _interopRequireDefault(_groups);
+
+var _choices = __webpack_require__(17);
+
+var _choices2 = _interopRequireDefault(_choices);
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+var appReducer = (0, _redux.combineReducers)({
+ items: _items2.default,
+ groups: _groups2.default,
+ choices: _choices2.default
+});
+
+var rootReducer = function rootReducer(passedState, action) {
+ var state = passedState;
+ // If we are clearing all items, groups and options we reassign
+ // state and then pass that state to our proper reducer. This isn't
+ // mutating our actual state
+ // See: http://stackoverflow.com/a/35641992
+ if (action.type === 'CLEAR_ALL') {
+ state = undefined;
+ }
+
+ return appReducer(state, action);
+};
+
+exports.default = rootReducer;
+
+/***/ }),
+/* 15 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.default = items;
+
+function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
+
+var defaultState = exports.defaultState = [];
+
+function items() {
+ var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : defaultState;
+ var action = arguments[1];
+
+ switch (action.type) {
+ case 'ADD_ITEM':
+ {
+ // Add object to items array
+ var newState = [].concat(_toConsumableArray(state), [{
+ id: action.id,
+ choiceId: action.choiceId,
+ groupId: action.groupId,
+ value: action.value,
+ label: action.label,
+ active: true,
+ highlighted: false,
+ customProperties: action.customProperties,
+ placeholder: action.placeholder || false,
+ keyCode: null
+ }]);
+
+ return newState.map(function (obj) {
+ var item = obj;
+ if (item.highlighted) {
+ item.highlighted = false;
+ }
+ return item;
+ });
+ }
+
+ case 'REMOVE_ITEM':
+ {
+ // Set item to inactive
+ return state.map(function (obj) {
+ var item = obj;
+ if (item.id === action.id) {
+ item.active = false;
+ }
+ return item;
+ });
+ }
+
+ case 'HIGHLIGHT_ITEM':
+ {
+ return state.map(function (obj) {
+ var item = obj;
+ if (item.id === action.id) {
+ item.highlighted = action.highlighted;
+ }
+ return item;
+ });
+ }
+
+ default:
+ {
+ return state;
+ }
+ }
+}
+
+/***/ }),
+/* 16 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.default = groups;
+
+function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
+
+var defaultState = exports.defaultState = [];
+
+function groups() {
+ var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : defaultState;
+ var action = arguments[1];
+
+ switch (action.type) {
+ case 'ADD_GROUP':
+ {
+ return [].concat(_toConsumableArray(state), [{
+ id: action.id,
+ value: action.value,
+ active: action.active,
+ disabled: action.disabled
+ }]);
+ }
+
+ case 'CLEAR_CHOICES':
+ {
+ return [];
+ }
+
+ default:
+ {
+ return state;
+ }
+ }
+}
+
+/***/ }),
+/* 17 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.default = choices;
+
+function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
+
+var defaultState = exports.defaultState = [];
+
+function choices() {
+ var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : defaultState;
+ var action = arguments[1];
+
+ switch (action.type) {
+ case 'ADD_CHOICE':
+ {
+ /*
+ A disabled choice appears in the choice dropdown but cannot be selected
+ A selected choice has been added to the passed input's value (added as an item)
+ An active choice appears within the choice dropdown
+ */
+ return [].concat(_toConsumableArray(state), [{
+ id: action.id,
+ elementId: action.elementId,
+ groupId: action.groupId,
+ value: action.value,
+ label: action.label || action.value,
+ disabled: action.disabled || false,
+ selected: false,
+ active: true,
+ score: 9999,
+ customProperties: action.customProperties,
+ placeholder: action.placeholder || false,
+ keyCode: null
+ }]);
+ }
+
+ case 'ADD_ITEM':
+ {
+ // If all choices need to be activated
+ if (action.activateOptions) {
+ return state.map(function (obj) {
+ var choice = obj;
+ choice.active = action.active;
+ return choice;
+ });
+ }
+
+ // When an item is added and it has an associated choice,
+ // we want to disable it so it can't be chosen again
+ if (action.choiceId > -1) {
+ return state.map(function (obj) {
+ var choice = obj;
+ if (choice.id === parseInt(action.choiceId, 10)) {
+ choice.selected = true;
+ }
+ return choice;
+ });
+ }
+
+ return state;
+ }
+
+ case 'REMOVE_ITEM':
+ {
+ // When an item is removed and it has an associated choice,
+ // we want to re-enable it so it can be chosen again
+ if (action.choiceId > -1) {
+ return state.map(function (obj) {
+ var choice = obj;
+ if (choice.id === parseInt(action.choiceId, 10)) {
+ choice.selected = false;
+ }
+ return choice;
+ });
+ }
+
+ return state;
+ }
+
+ case 'FILTER_CHOICES':
+ {
+ return state.map(function (obj) {
+ var choice = obj;
+ // Set active state based on whether choice is
+ // within filtered results
+ choice.active = action.results.some(function (_ref) {
+ var item = _ref.item,
+ score = _ref.score;
+
+ if (item.id === choice.id) {
+ choice.score = score;
+ return true;
+ }
+ return false;
+ });
+
+ return choice;
+ });
+ }
+
+ case 'ACTIVATE_CHOICES':
+ {
+ return state.map(function (obj) {
+ var choice = obj;
+ choice.active = action.active;
+ return choice;
+ });
+ }
+
+ case 'CLEAR_CHOICES':
+ {
+ return defaultState;
+ }
+
+ default:
+ {
+ return state;
+ }
+ }
+}
+
+/***/ }),
+/* 18 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+
+var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
+
+function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
+
+var Dropdown = function () {
+ function Dropdown(instance, element, classNames) {
+ _classCallCheck(this, Dropdown);
+
+ this.parentInstance = instance;
+ this.element = element;
+ this.classNames = classNames;
+ this.dimensions = null;
+ this.position = null;
+ this.isActive = false;
+ }
+
+ _createClass(Dropdown, [{
+ key: 'getElement',
+ value: function getElement() {
+ return this.element;
+ }
+
+ /**
+ * Determine how far the top of our element is from
+ * the top of the window
+ * @return {Number} Vertical position
+ */
+
+ }, {
+ key: 'getVerticalPos',
+ value: function getVerticalPos() {
+ this.dimensions = this.element.getBoundingClientRect();
+ this.position = Math.ceil(this.dimensions.top + window.pageYOffset + this.element.offsetHeight);
+ return this.position;
+ }
+
+ /**
+ * Find element that matches passed selector
+ * @return {HTMLElement}
+ */
+
+ }, {
+ key: 'getChild',
+ value: function getChild(selector) {
+ return this.element.querySelector(selector);
+ }
+
+ /**
+ * Show dropdown to user by adding active state class
+ * @return {Object} Class instance
+ * @public
+ */
+
+ }, {
+ key: 'show',
+ value: function show() {
+ this.element.classList.add(this.classNames.activeState);
+ this.element.setAttribute('aria-expanded', 'true');
+ this.isActive = true;
+ return this.parentInstance;
+ }
+
+ /**
+ * Hide dropdown from user
+ * @return {Object} Class instance
+ * @public
+ */
+
+ }, {
+ key: 'hide',
+ value: function hide() {
+ this.element.classList.remove(this.classNames.activeState);
+ this.element.setAttribute('aria-expanded', 'false');
+ this.isActive = false;
+ return this.parentInstance;
+ }
+ }]);
+
+ return Dropdown;
+}();
+
+exports.default = Dropdown;
+
+/***/ }),
+/* 19 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+
+var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
+
+function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
+
+var Container = function () {
+ function Container(instance, element, classNames) {
+ _classCallCheck(this, Container);
+
+ this.parentInstance = instance;
+ this.element = element;
+ this.classNames = classNames;
+ this.config = instance.config;
+ this.isOpen = false;
+ this.isFlipped = false;
+ this.isFocussed = false;
+ this.isDisabled = false;
+ this.isLoading = false;
+ this.onFocus = this.onFocus.bind(this);
+ this.onBlur = this.onBlur.bind(this);
+ }
+
+ _createClass(Container, [{
+ key: 'getElement',
+ value: function getElement() {
+ return this.element;
+ }
+
+ /**
+ * Add event listeners
+ */
+
+ }, {
+ key: 'addEventListeners',
+ value: function addEventListeners() {
+ this.element.addEventListener('focus', this.onFocus);
+ this.element.addEventListener('blur', this.onBlur);
+ }
+
+ /**
+ * Remove event listeners
+ */
+
+ /** */
+
+ }, {
+ key: 'removeEventListeners',
+ value: function removeEventListeners() {
+ this.element.removeEventListener('focus', this.onFocus);
+ this.element.removeEventListener('blur', this.onBlur);
+ }
+
+ /**
+ * Set focussed state
+ */
+
+ }, {
+ key: 'onFocus',
+ value: function onFocus() {
+ this.isFocussed = true;
+ }
+
+ /**
+ * Remove blurred state
+ */
+
+ }, {
+ key: 'onBlur',
+ value: function onBlur() {
+ this.isFocussed = false;
+ }
+
+ /**
+ * Determine whether container should be flipped
+ * based on passed dropdown position
+ * @param {Number} dropdownPos
+ * @returns
+ */
+
+ }, {
+ key: 'shouldFlip',
+ value: function shouldFlip(dropdownPos) {
+ if (dropdownPos === undefined) {
+ return false;
+ }
+
+ var body = document.body;
+ var html = document.documentElement;
+ var winHeight = Math.max(body.scrollHeight, body.offsetHeight, html.clientHeight, html.scrollHeight, html.offsetHeight);
+
+ // If flip is enabled and the dropdown bottom position is
+ // greater than the window height flip the dropdown.
+ var shouldFlip = false;
+ if (this.config.position === 'auto') {
+ shouldFlip = dropdownPos >= winHeight;
+ } else if (this.config.position === 'top') {
+ shouldFlip = true;
+ }
+
+ return shouldFlip;
+ }
+
+ /**
+ * Set active descendant attribute
+ * @param {Number} activeDescendant ID of active descendant
+ */
+
+ }, {
+ key: 'setActiveDescendant',
+ value: function setActiveDescendant(activeDescendantID) {
+ this.element.setAttribute('aria-activedescendant', activeDescendantID);
+ }
+
+ /**
+ * Remove active descendant attribute
+ */
+
+ }, {
+ key: 'removeActiveDescendant',
+ value: function removeActiveDescendant() {
+ this.element.removeAttribute('aria-activedescendant');
+ }
+ }, {
+ key: 'open',
+ value: function open(dropdownPos) {
+ this.element.classList.add(this.classNames.openState);
+ this.element.setAttribute('aria-expanded', 'true');
+ this.isOpen = true;
+
+ if (this.shouldFlip(dropdownPos)) {
+ this.element.classList.add(this.classNames.flippedState);
+ this.isFlipped = true;
+ }
+ }
+ }, {
+ key: 'close',
+ value: function close() {
+ this.element.classList.remove(this.classNames.openState);
+ this.element.setAttribute('aria-expanded', 'false');
+ this.removeActiveDescendant();
+ this.isOpen = false;
+
+ // A dropdown flips if it does not have space within the page
+ if (this.isFlipped) {
+ this.element.classList.remove(this.classNames.flippedState);
+ this.isFlipped = false;
+ }
+ }
+ }, {
+ key: 'focus',
+ value: function focus() {
+ if (!this.isFocussed) {
+ this.element.focus();
+ }
+ }
+ }, {
+ key: 'addFocusState',
+ value: function addFocusState() {
+ this.element.classList.add(this.classNames.focusState);
+ }
+ }, {
+ key: 'removeFocusState',
+ value: function removeFocusState() {
+ this.element.classList.remove(this.classNames.focusState);
+ }
+
+ /**
+ * Remove disabled state
+ */
+
+ }, {
+ key: 'enable',
+ value: function enable() {
+ this.element.classList.remove(this.config.classNames.disabledState);
+ this.element.removeAttribute('aria-disabled');
+ if (this.parentInstance.isSelectOneElement) {
+ this.element.setAttribute('tabindex', '0');
+ }
+ this.isDisabled = false;
+ }
+
+ /**
+ * Set disabled state
+ */
+
+ }, {
+ key: 'disable',
+ value: function disable() {
+ this.element.classList.add(this.config.classNames.disabledState);
+ this.element.setAttribute('aria-disabled', 'true');
+ if (this.parentInstance.isSelectOneElement) {
+ this.element.setAttribute('tabindex', '-1');
+ }
+ this.isDisabled = true;
+ }
+ }, {
+ key: 'revert',
+ value: function revert(originalElement) {
+ // Move passed element back to original position
+ this.element.parentNode.insertBefore(originalElement, this.element);
+ // Remove container
+ this.element.parentNode.removeChild(this.element);
+ }
+
+ /**
+ * Add loading state to element
+ */
+
+ }, {
+ key: 'addLoadingState',
+ value: function addLoadingState() {
+ this.element.classList.add(this.classNames.loadingState);
+ this.element.setAttribute('aria-busy', 'true');
+ this.isLoading = true;
+ }
+
+ /**
+ * Remove loading state from element
+ */
+
+ }, {
+ key: 'removeLoadingState',
+ value: function removeLoadingState() {
+ this.element.classList.remove(this.classNames.loadingState);
+ this.element.removeAttribute('aria-busy');
+ this.isLoading = false;
+ }
+ }]);
+
+ return Container;
+}();
+
+exports.default = Container;
+
+/***/ }),
+/* 20 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+
+var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
+
+var _utils = __webpack_require__(0);
+
+function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
+
+var Input = function () {
+ function Input(instance, element, classNames) {
+ _classCallCheck(this, Input);
+
+ this.parentInstance = instance;
+ this.element = element;
+ this.classNames = classNames;
+ this.isFocussed = this.element === document.activeElement;
+ this.isDisabled = false;
+
+ // Bind event listeners
+ this.onPaste = this.onPaste.bind(this);
+ this.onInput = this.onInput.bind(this);
+ this.onFocus = this.onFocus.bind(this);
+ this.onBlur = this.onBlur.bind(this);
+ }
+
+ _createClass(Input, [{
+ key: 'getElement',
+ value: function getElement() {
+ return this.element;
+ }
+ }, {
+ key: 'addEventListeners',
+ value: function addEventListeners() {
+ this.element.addEventListener('input', this.onInput);
+ this.element.addEventListener('paste', this.onPaste);
+ this.element.addEventListener('focus', this.onFocus);
+ this.element.addEventListener('blur', this.onBlur);
+ }
+ }, {
+ key: 'removeEventListeners',
+ value: function removeEventListeners() {
+ this.element.removeEventListener('input', this.onInput);
+ this.element.removeEventListener('paste', this.onPaste);
+ this.element.removeEventListener('focus', this.onFocus);
+ this.element.removeEventListener('blur', this.onBlur);
+ }
+
+ /**
+ * Input event
+ * @return
+ * @private
+ */
+
+ }, {
+ key: 'onInput',
+ value: function onInput() {
+ if (!this.parentInstance.isSelectOneElement) {
+ this.setWidth();
+ }
+ }
+
+ /**
+ * Paste event
+ * @param {Object} e Event
+ * @return
+ * @private
+ */
+
+ }, {
+ key: 'onPaste',
+ value: function onPaste(e) {
+ // Disable pasting into the input if option has been set
+ if (e.target === this.element && !this.parentInstance.config.paste) {
+ e.preventDefault();
+ }
+ }
+
+ /**
+ * Set focussed state
+ */
+
+ }, {
+ key: 'onFocus',
+ value: function onFocus() {
+ this.isFocussed = true;
+ }
+
+ /**
+ * Remove focussed state
+ */
+
+ }, {
+ key: 'onBlur',
+ value: function onBlur() {
+ this.isFocussed = false;
+ }
+ }, {
+ key: 'activate',
+ value: function activate(focusInput) {
+ // Optionally focus the input if we have a search input
+ if (focusInput && this.parentInstance.canSearch && document.activeElement !== this.element) {
+ this.element.focus();
+ }
+ }
+ }, {
+ key: 'deactivate',
+ value: function deactivate(blurInput) {
+ this.removeActiveDescendant();
+ // Optionally blur the input if we have a search input
+ if (blurInput && this.parentInstance.canSearch && document.activeElement === this.element) {
+ this.element.blur();
+ }
+ }
+ }, {
+ key: 'enable',
+ value: function enable() {
+ this.element.removeAttribute('disabled');
+ this.isDisabled = false;
+ }
+ }, {
+ key: 'disable',
+ value: function disable() {
+ this.element.setAttribute('disabled', '');
+ this.isDisabled = true;
+ }
+ }, {
+ key: 'focus',
+ value: function focus() {
+ if (!this.isFocussed) {
+ this.element.focus();
+ }
+ }
+
+ /**
+ * Set value of input to blank
+ * @return {Object} Class instance
+ * @public
+ */
+
+ }, {
+ key: 'clear',
+ value: function clear() {
+ var setWidth = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
+
+ if (this.element.value) {
+ this.element.value = '';
+ }
+
+ if (setWidth) {
+ this.setWidth();
+ }
+
+ return this.parentInstance;
+ }
+
+ /**
+ * Set the correct input width based on placeholder
+ * value or input value
+ * @return
+ */
+
+ }, {
+ key: 'setWidth',
+ value: function setWidth(enforceWidth) {
+ if (this.parentInstance.placeholder) {
+ // If there is a placeholder, we only want to set the width of the input when it is a greater
+ // length than 75% of the placeholder. This stops the input jumping around.
+ if (this.element.value && this.element.value.length >= this.parentInstance.placeholder.length / 1.25 || enforceWidth) {
+ this.element.style.width = this.getWidth();
+ }
+ } else {
+ // If there is no placeholder, resize input to contents
+ this.element.style.width = this.getWidth();
+ }
+ }
+ }, {
+ key: 'getWidth',
+ value: function getWidth() {
+ return (0, _utils.getWidthOfInput)(this.element);
+ }
+ }, {
+ key: 'setPlaceholder',
+ value: function setPlaceholder(placeholder) {
+ this.element.placeholder = placeholder;
+ }
+ }, {
+ key: 'setValue',
+ value: function setValue(value) {
+ this.element.value = value;
+ }
+ }, {
+ key: 'getValue',
+ value: function getValue() {
+ return this.element.value;
+ }
+ }, {
+ key: 'setActiveDescendant',
+ value: function setActiveDescendant(activeDescendantID) {
+ this.element.setAttribute('aria-activedescendant', activeDescendantID);
+ }
+ }, {
+ key: 'removeActiveDescendant',
+ value: function removeActiveDescendant() {
+ this.element.removeAttribute('aria-activedescendant');
+ }
+ }]);
+
+ return Input;
+}();
+
+exports.default = Input;
+
+/***/ }),
+/* 21 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+
+var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
+
+function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
+
+var List = function () {
+ function List(instance, element, classNames) {
+ _classCallCheck(this, List);
+
+ this.parentInstance = instance;
+ this.element = element;
+ this.classNames = classNames;
+ this.scrollPos = this.element.scrollTop;
+ this.height = this.element.offsetHeight;
+ this.hasChildren = !!this.element.children;
+ }
+
+ _createClass(List, [{
+ key: 'getElement',
+ value: function getElement() {
+ return this.element;
+ }
+
+ /**
+ * Clear List contents
+ */
+
+ }, {
+ key: 'clear',
+ value: function clear() {
+ this.element.innerHTML = '';
+ }
+
+ /**
+ * Scroll to passed position on Y axis
+ */
+
+ }, {
+ key: 'scrollTo',
+ value: function scrollTo() {
+ var scrollPos = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;
+
+ this.element.scrollTop = scrollPos;
+ }
+ /**
+ * Append node to element
+ */
+
+ }, {
+ key: 'append',
+ value: function append(node) {
+ this.element.appendChild(node);
+ }
+
+ /**
+ * Find element that matches passed selector
+ * @return {HTMLElement}
+ */
+
+ }, {
+ key: 'getChild',
+ value: function getChild(selector) {
+ return this.element.querySelector(selector);
+ }
+ }]);
+
+ return List;
+}();
+
+exports.default = List;
+
+/***/ }),
+/* 22 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+
+var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
+
+var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
+
+var _wrappedElement = __webpack_require__(4);
+
+var _wrappedElement2 = _interopRequireDefault(_wrappedElement);
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
+
+function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
+
+function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
+
+var WrappedInput = function (_WrappedElement) {
+ _inherits(WrappedInput, _WrappedElement);
+
+ function WrappedInput(instance, element, classNames) {
+ _classCallCheck(this, WrappedInput);
+
+ var _this = _possibleConstructorReturn(this, (WrappedInput.__proto__ || Object.getPrototypeOf(WrappedInput)).call(this, instance, element, classNames));
+
+ _this.parentInstance = instance;
+ _this.element = element;
+ _this.classNames = classNames;
+ return _this;
+ }
+
+ _createClass(WrappedInput, [{
+ key: 'getElement',
+ value: function getElement() {
+ _get(WrappedInput.prototype.__proto__ || Object.getPrototypeOf(WrappedInput.prototype), 'getElement', this).call(this);
+ }
+ }, {
+ key: 'conceal',
+ value: function conceal() {
+ _get(WrappedInput.prototype.__proto__ || Object.getPrototypeOf(WrappedInput.prototype), 'conceal', this).call(this);
+ }
+ }, {
+ key: 'reveal',
+ value: function reveal() {
+ _get(WrappedInput.prototype.__proto__ || Object.getPrototypeOf(WrappedInput.prototype), 'reveal', this).call(this);
+ }
+ }, {
+ key: 'enable',
+ value: function enable() {
+ _get(WrappedInput.prototype.__proto__ || Object.getPrototypeOf(WrappedInput.prototype), 'enable', this).call(this);
+ }
+ }, {
+ key: 'disable',
+ value: function disable() {
+ _get(WrappedInput.prototype.__proto__ || Object.getPrototypeOf(WrappedInput.prototype), 'enable', this).call(this);
+ }
+ }, {
+ key: 'setValue',
+ value: function setValue(value) {
+ this.element.setAttribute('value', value);
+ this.element.value = value;
+ }
+ }]);
+
+ return WrappedInput;
+}(_wrappedElement2.default);
+
+exports.default = WrappedInput;
+
+/***/ }),
+/* 23 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+
+var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
+
+var _get = function get(object, property, receiver) { if (object === null) object = Function.prototype; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { return get(parent, property, receiver); } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } };
+
+var _wrappedElement = __webpack_require__(4);
+
+var _wrappedElement2 = _interopRequireDefault(_wrappedElement);
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
+
+function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
+
+function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
+
+var WrappedSelect = function (_WrappedElement) {
+ _inherits(WrappedSelect, _WrappedElement);
+
+ function WrappedSelect(instance, element, classNames) {
+ _classCallCheck(this, WrappedSelect);
+
+ var _this = _possibleConstructorReturn(this, (WrappedSelect.__proto__ || Object.getPrototypeOf(WrappedSelect)).call(this, instance, element, classNames));
+
+ _this.parentInstance = instance;
+ _this.element = element;
+ _this.classNames = classNames;
+ return _this;
+ }
+
+ _createClass(WrappedSelect, [{
+ key: 'getElement',
+ value: function getElement() {
+ _get(WrappedSelect.prototype.__proto__ || Object.getPrototypeOf(WrappedSelect.prototype), 'getElement', this).call(this);
+ }
+ }, {
+ key: 'conceal',
+ value: function conceal() {
+ _get(WrappedSelect.prototype.__proto__ || Object.getPrototypeOf(WrappedSelect.prototype), 'conceal', this).call(this);
+ }
+ }, {
+ key: 'reveal',
+ value: function reveal() {
+ _get(WrappedSelect.prototype.__proto__ || Object.getPrototypeOf(WrappedSelect.prototype), 'reveal', this).call(this);
+ }
+ }, {
+ key: 'enable',
+ value: function enable() {
+ _get(WrappedSelect.prototype.__proto__ || Object.getPrototypeOf(WrappedSelect.prototype), 'enable', this).call(this);
+ }
+ }, {
+ key: 'disable',
+ value: function disable() {
+ _get(WrappedSelect.prototype.__proto__ || Object.getPrototypeOf(WrappedSelect.prototype), 'enable', this).call(this);
+ }
+ }, {
+ key: 'setOptions',
+ value: function setOptions(options) {
+ this.element.innerHTML = '';
+ this.element.appendChild(options);
+ }
+ }, {
+ key: 'getPlaceholderOption',
+ value: function getPlaceholderOption() {
+ return this.element.querySelector('option[placeholder]');
+ }
+ }, {
+ key: 'getOptions',
+ value: function getOptions() {
+ return Array.from(this.element.options);
+ }
+ }, {
+ key: 'getOptionGroups',
+ value: function getOptionGroups() {
+ return Array.from(this.element.getElementsByTagName('OPTGROUP'));
+ }
+ }]);
+
+ return WrappedSelect;
+}(_wrappedElement2.default);
+
+exports.default = WrappedSelect;
+
+/***/ }),
+/* 24 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.TEMPLATES = undefined;
+
+var _classnames = __webpack_require__(25);
+
+var _classnames2 = _interopRequireDefault(_classnames);
+
+var _utils = __webpack_require__(0);
+
+function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
+
+function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
+
+var TEMPLATES = exports.TEMPLATES = {
+ containerOuter: function containerOuter(globalClasses, direction, isSelectElement, isSelectOneElement, searchEnabled, passedElementType) {
+ var tabIndex = isSelectOneElement ? 'tabindex="0"' : '';
+ var role = isSelectElement ? 'role="listbox"' : '';
+ var ariaAutoComplete = '';
+
+ if (isSelectElement && searchEnabled) {
+ role = 'role="combobox"';
+ ariaAutoComplete = 'aria-autocomplete="list"';
+ }
+
+ return (0, _utils.strToEl)('\n \n
\n ');
+ },
+ containerInner: function containerInner(globalClasses) {
+ return (0, _utils.strToEl)('\n
\n ');
+ },
+ itemList: function itemList(globalClasses, isSelectOneElement) {
+ var _classNames;
+
+ var localClasses = (0, _classnames2.default)(globalClasses.list, (_classNames = {}, _defineProperty(_classNames, globalClasses.listSingle, isSelectOneElement), _defineProperty(_classNames, globalClasses.listItems, !isSelectOneElement), _classNames));
+
+ return (0, _utils.strToEl)('\n
\n ');
+ },
+ placeholder: function placeholder(globalClasses, value) {
+ return (0, _utils.strToEl)('\n \n ' + value + '\n
\n ');
+ },
+ item: function item(globalClasses, data, removeItemButton) {
+ var _classNames2;
+
+ var ariaSelected = data.active ? 'aria-selected="true"' : '';
+ var ariaDisabled = data.disabled ? 'aria-disabled="true"' : '';
+
+ var localClasses = (0, _classnames2.default)(globalClasses.item, (_classNames2 = {}, _defineProperty(_classNames2, globalClasses.highlightedState, data.highlighted), _defineProperty(_classNames2, globalClasses.itemSelectable, !data.highlighted), _defineProperty(_classNames2, globalClasses.placeholder, data.placeholder), _classNames2));
+
+ if (removeItemButton) {
+ var _classNames3;
+
+ localClasses = (0, _classnames2.default)(globalClasses.item, (_classNames3 = {}, _defineProperty(_classNames3, globalClasses.highlightedState, data.highlighted), _defineProperty(_classNames3, globalClasses.itemSelectable, !data.disabled), _defineProperty(_classNames3, globalClasses.placeholder, data.placeholder), _classNames3));
+
+ return (0, _utils.strToEl)('\n \n ' + data.label + '\n Remove item\n \n
\n ');
+ }
+
+ return (0, _utils.strToEl)('\n \n ' + data.label + '\n
\n ');
+ },
+ choiceList: function choiceList(globalClasses, isSelectOneElement) {
+ var ariaMultiSelectable = !isSelectOneElement ? 'aria-multiselectable="true"' : '';
+
+ return (0, _utils.strToEl)('\n \n
\n ');
+ },
+ choiceGroup: function choiceGroup(globalClasses, data) {
+ var ariaDisabled = data.disabled ? 'aria-disabled="true"' : '';
+ var localClasses = (0, _classnames2.default)(globalClasses.group, _defineProperty({}, globalClasses.itemDisabled, data.disabled));
+
+ return (0, _utils.strToEl)('\n \n ');
+ },
+ choice: function choice(globalClasses, data, itemSelectText) {
+ var _classNames5;
+
+ var role = data.groupId > 0 ? 'role="treeitem"' : 'role="option"';
+ var localClasses = (0, _classnames2.default)(globalClasses.item, globalClasses.itemChoice, (_classNames5 = {}, _defineProperty(_classNames5, globalClasses.itemDisabled, data.disabled), _defineProperty(_classNames5, globalClasses.itemSelectable, !data.disabled), _defineProperty(_classNames5, globalClasses.placeholder, data.placeholder), _classNames5));
+
+ return (0, _utils.strToEl)('\n \n ' + data.label + '\n
\n ');
+ },
+ input: function input(globalClasses) {
+ var localClasses = (0, _classnames2.default)(globalClasses.input, globalClasses.inputCloned);
+
+ return (0, _utils.strToEl)('\n \n ');
+ },
+ dropdown: function dropdown(globalClasses) {
+ var localClasses = (0, _classnames2.default)(globalClasses.list, globalClasses.listDropdown);
+
+ return (0, _utils.strToEl)('\n \n
\n ');
+ },
+ notice: function notice(globalClasses, label) {
+ var _classNames6;
+
+ var type = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
+
+ var localClasses = (0, _classnames2.default)(globalClasses.item, globalClasses.itemChoice, (_classNames6 = {}, _defineProperty(_classNames6, globalClasses.noResults, type === 'no-results'), _defineProperty(_classNames6, globalClasses.noChoices, type === 'no-choices'), _classNames6));
+
+ return (0, _utils.strToEl)('\n \n ' + label + '\n
\n ');
+ },
+ option: function option(globalClasses, data) {
+ return (0, _utils.strToEl)('\n ' + data.label + ' \n ');
+ }
+};
+
+exports.default = TEMPLATES;
+
+/***/ }),
+/* 25 */
/***/ (function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
@@ -6796,8 +6936,147 @@ var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
/***/ }),
-/* 10 */
-/***/ (function(module, exports) {
+/* 26 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.clearChoices = exports.activateChoices = exports.filterChoices = exports.addChoice = undefined;
+
+var _constants = __webpack_require__(1);
+
+var addChoice = exports.addChoice = function addChoice(value, label, id, groupId, disabled, elementId, customProperties, placeholder, keyCode) {
+ return {
+ type: _constants.ACTION_TYPES.ADD_CHOICE,
+ value: value,
+ label: label,
+ id: id,
+ groupId: groupId,
+ disabled: disabled,
+ elementId: elementId,
+ customProperties: customProperties,
+ placeholder: placeholder,
+ keyCode: keyCode
+ };
+};
+
+var filterChoices = exports.filterChoices = function filterChoices(results) {
+ return {
+ type: _constants.ACTION_TYPES.FILTER_CHOICES,
+ results: results
+ };
+};
+
+var activateChoices = exports.activateChoices = function activateChoices() {
+ var active = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
+ return {
+ type: _constants.ACTION_TYPES.ACTIVATE_CHOICES,
+ active: active
+ };
+};
+
+var clearChoices = exports.clearChoices = function clearChoices() {
+ return {
+ type: _constants.ACTION_TYPES.CLEAR_CHOICES
+ };
+};
+
+/***/ }),
+/* 27 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.highlightItem = exports.removeItem = exports.addItem = undefined;
+
+var _constants = __webpack_require__(1);
+
+var addItem = exports.addItem = function addItem(value, label, id, choiceId, groupId, customProperties, placeholder, keyCode) {
+ return {
+ type: _constants.ACTION_TYPES.ADD_ITEM,
+ value: value,
+ label: label,
+ id: id,
+ choiceId: choiceId,
+ groupId: groupId,
+ customProperties: customProperties,
+ placeholder: placeholder,
+ keyCode: keyCode
+ };
+};
+
+var removeItem = exports.removeItem = function removeItem(id, choiceId) {
+ return {
+ type: _constants.ACTION_TYPES.REMOVE_ITEM,
+ id: id,
+ choiceId: choiceId
+ };
+};
+
+var highlightItem = exports.highlightItem = function highlightItem(id, highlighted) {
+ return {
+ type: _constants.ACTION_TYPES.HIGHLIGHT_ITEM,
+ id: id,
+ highlighted: highlighted
+ };
+};
+
+/***/ }),
+/* 28 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+exports.addGroup = undefined;
+
+var _constants = __webpack_require__(1);
+
+/* eslint-disable import/prefer-default-export */
+var addGroup = exports.addGroup = function addGroup(value, id, active, disabled) {
+ return {
+ type: _constants.ACTION_TYPES.ADD_GROUP,
+ value: value,
+ id: id,
+ active: active,
+ disabled: disabled
+ };
+};
+
+/***/ }),
+/* 29 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
+
+Object.defineProperty(exports, "__esModule", {
+ value: true
+});
+/* eslint-disable import/prefer-default-export */
+var clearAll = exports.clearAll = function clearAll() {
+ return {
+ type: 'CLEAR_ALL'
+ };
+};
+
+/***/ }),
+/* 30 */
+/***/ (function(module, exports, __webpack_require__) {
+
+"use strict";
+
/* eslint-disable */
(function () {
diff --git a/src/scripts/dist/choices.js.map b/src/scripts/dist/choices.js.map
index 9da9312..7405b8d 100644
--- a/src/scripts/dist/choices.js.map
+++ b/src/scripts/dist/choices.js.map
@@ -1 +1 @@
-{"version":3,"file":"choices.js","sources":["webpack:///webpack/universalModuleDefinition","webpack:///webpack/bootstrap 5817d10891658a7f3821","webpack:///(webpack)/buildin/global.js","webpack:///./node_modules/redux/node_modules/lodash-es/_root.js","webpack:///./node_modules/redux/node_modules/lodash-es/_Symbol.js","webpack:///./node_modules/redux/node_modules/lodash-es/_getRawTag.js","webpack:///./node_modules/redux/node_modules/lodash-es/_objectToString.js","webpack:///./node_modules/redux/node_modules/lodash-es/_baseGetTag.js","webpack:///./node_modules/redux/node_modules/lodash-es/_overArg.js","webpack:///./node_modules/redux/node_modules/lodash-es/_getPrototype.js","webpack:///./node_modules/redux/node_modules/lodash-es/isObjectLike.js","webpack:///./node_modules/redux/node_modules/lodash-es/isPlainObject.js","webpack:///./node_modules/redux/es/createStore.js","webpack:///./node_modules/redux/es/utils/warning.js","webpack:///./node_modules/redux/es/combineReducers.js","webpack:///./node_modules/redux/es/bindActionCreators.js","webpack:///./node_modules/redux/es/compose.js","webpack:///./node_modules/redux/es/applyMiddleware.js","webpack:///./node_modules/redux/es/index.js","webpack:///src/scripts/src/reducers/items.js","webpack:///src/scripts/src/reducers/groups.js","webpack:///src/scripts/src/reducers/choices.js","webpack:///src/scripts/src/reducers/index.js","webpack:///src/scripts/src/store/store.js","webpack:///src/scripts/src/components/dropdown.js","webpack:///src/scripts/src/components/container.js","webpack:///src/scripts/src/lib/utils.js","webpack:///src/scripts/src/components/input.js","webpack:///src/scripts/src/components/list.js","webpack:///src/scripts/src/components/wrapped-element.js","webpack:///src/scripts/src/components/wrapped-input.js","webpack:///src/scripts/src/components/wrapped-select.js","webpack:///src/scripts/src/constants.js","webpack:///src/scripts/src/templates.js","webpack:///src/scripts/src/actions/choices.js","webpack:///src/scripts/src/actions/items.js","webpack:///src/scripts/src/actions/groups.js","webpack:///src/scripts/src/actions/misc.js","webpack:///src/scripts/src/choices.js","webpack:///./node_modules/fuse.js/dist/fuse.js","webpack:///./node_modules/redux/node_modules/lodash-es/_freeGlobal.js","webpack:///./node_modules/redux/node_modules/symbol-observable/index.js","webpack:///./node_modules/redux/node_modules/symbol-observable/lib/index.js","webpack:///(webpack)/buildin/module.js","webpack:///./node_modules/redux/node_modules/symbol-observable/lib/ponyfill.js","webpack:///./node_modules/classnames/index.js","webpack:///src/scripts/src/lib/polyfills.js"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"Choices\"] = factory();\n\telse\n\t\troot[\"Choices\"] = factory();\n})(this, function() {\nreturn \n\n\n// WEBPACK FOOTER //\n// webpack/universalModuleDefinition"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"/src/scripts/dist/\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 1);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap 5817d10891658a7f3821","var g;\n\n// This works in non-strict mode\ng = (function() {\n\treturn this;\n})();\n\ntry {\n\t// This works if eval is allowed (see CSP)\n\tg = g || Function(\"return this\")() || (1,eval)(\"this\");\n} catch(e) {\n\t// This works if the window reference is available\n\tif(typeof window === \"object\")\n\t\tg = window;\n}\n\n// g can still be undefined, but nothing to do about it...\n// We return undefined, instead of nothing here, so it's\n// easier to handle this case. if(!global) { ...}\n\nmodule.exports = g;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// (webpack)/buildin/global.js\n// module id = 0\n// module chunks = 0","import freeGlobal from './_freeGlobal.js';\n\n/** Detect free variable `self`. */\nvar freeSelf = typeof self == 'object' && self && self.Object === Object && self;\n\n/** Used as a reference to the global object. */\nvar root = freeGlobal || freeSelf || Function('return this')();\n\nexport default root;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/redux/node_modules/lodash-es/_root.js\n// module id = null\n// module chunks = ","import root from './_root.js';\n\n/** Built-in value references. */\nvar Symbol = root.Symbol;\n\nexport default Symbol;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/redux/node_modules/lodash-es/_Symbol.js\n// module id = null\n// module chunks = ","import Symbol from './_Symbol.js';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar nativeObjectToString = objectProto.toString;\n\n/** Built-in value references. */\nvar symToStringTag = Symbol ? Symbol.toStringTag : undefined;\n\n/**\n * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the raw `toStringTag`.\n */\nfunction getRawTag(value) {\n var isOwn = hasOwnProperty.call(value, symToStringTag),\n tag = value[symToStringTag];\n\n try {\n value[symToStringTag] = undefined;\n var unmasked = true;\n } catch (e) {}\n\n var result = nativeObjectToString.call(value);\n if (unmasked) {\n if (isOwn) {\n value[symToStringTag] = tag;\n } else {\n delete value[symToStringTag];\n }\n }\n return result;\n}\n\nexport default getRawTag;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/redux/node_modules/lodash-es/_getRawTag.js\n// module id = null\n// module chunks = ","/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar nativeObjectToString = objectProto.toString;\n\n/**\n * Converts `value` to a string using `Object.prototype.toString`.\n *\n * @private\n * @param {*} value The value to convert.\n * @returns {string} Returns the converted string.\n */\nfunction objectToString(value) {\n return nativeObjectToString.call(value);\n}\n\nexport default objectToString;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/redux/node_modules/lodash-es/_objectToString.js\n// module id = null\n// module chunks = ","import Symbol from './_Symbol.js';\nimport getRawTag from './_getRawTag.js';\nimport objectToString from './_objectToString.js';\n\n/** `Object#toString` result references. */\nvar nullTag = '[object Null]',\n undefinedTag = '[object Undefined]';\n\n/** Built-in value references. */\nvar symToStringTag = Symbol ? Symbol.toStringTag : undefined;\n\n/**\n * The base implementation of `getTag` without fallbacks for buggy environments.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the `toStringTag`.\n */\nfunction baseGetTag(value) {\n if (value == null) {\n return value === undefined ? undefinedTag : nullTag;\n }\n return (symToStringTag && symToStringTag in Object(value))\n ? getRawTag(value)\n : objectToString(value);\n}\n\nexport default baseGetTag;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/redux/node_modules/lodash-es/_baseGetTag.js\n// module id = null\n// module chunks = ","/**\n * Creates a unary function that invokes `func` with its argument transformed.\n *\n * @private\n * @param {Function} func The function to wrap.\n * @param {Function} transform The argument transform.\n * @returns {Function} Returns the new function.\n */\nfunction overArg(func, transform) {\n return function(arg) {\n return func(transform(arg));\n };\n}\n\nexport default overArg;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/redux/node_modules/lodash-es/_overArg.js\n// module id = null\n// module chunks = ","import overArg from './_overArg.js';\n\n/** Built-in value references. */\nvar getPrototype = overArg(Object.getPrototypeOf, Object);\n\nexport default getPrototype;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/redux/node_modules/lodash-es/_getPrototype.js\n// module id = null\n// module chunks = ","/**\n * Checks if `value` is object-like. A value is object-like if it's not `null`\n * and has a `typeof` result of \"object\".\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n * @example\n *\n * _.isObjectLike({});\n * // => true\n *\n * _.isObjectLike([1, 2, 3]);\n * // => true\n *\n * _.isObjectLike(_.noop);\n * // => false\n *\n * _.isObjectLike(null);\n * // => false\n */\nfunction isObjectLike(value) {\n return value != null && typeof value == 'object';\n}\n\nexport default isObjectLike;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/redux/node_modules/lodash-es/isObjectLike.js\n// module id = null\n// module chunks = ","import baseGetTag from './_baseGetTag.js';\nimport getPrototype from './_getPrototype.js';\nimport isObjectLike from './isObjectLike.js';\n\n/** `Object#toString` result references. */\nvar objectTag = '[object Object]';\n\n/** Used for built-in method references. */\nvar funcProto = Function.prototype,\n objectProto = Object.prototype;\n\n/** Used to resolve the decompiled source of functions. */\nvar funcToString = funcProto.toString;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/** Used to infer the `Object` constructor. */\nvar objectCtorString = funcToString.call(Object);\n\n/**\n * Checks if `value` is a plain object, that is, an object created by the\n * `Object` constructor or one with a `[[Prototype]]` of `null`.\n *\n * @static\n * @memberOf _\n * @since 0.8.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * }\n *\n * _.isPlainObject(new Foo);\n * // => false\n *\n * _.isPlainObject([1, 2, 3]);\n * // => false\n *\n * _.isPlainObject({ 'x': 0, 'y': 0 });\n * // => true\n *\n * _.isPlainObject(Object.create(null));\n * // => true\n */\nfunction isPlainObject(value) {\n if (!isObjectLike(value) || baseGetTag(value) != objectTag) {\n return false;\n }\n var proto = getPrototype(value);\n if (proto === null) {\n return true;\n }\n var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;\n return typeof Ctor == 'function' && Ctor instanceof Ctor &&\n funcToString.call(Ctor) == objectCtorString;\n}\n\nexport default isPlainObject;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/redux/node_modules/lodash-es/isPlainObject.js\n// module id = null\n// module chunks = ","import isPlainObject from 'lodash-es/isPlainObject';\nimport $$observable from 'symbol-observable';\n\n/**\n * These are private action types reserved by Redux.\n * For any unknown actions, you must return the current state.\n * If the current state is undefined, you must return the initial state.\n * Do not reference these action types directly in your code.\n */\nexport var ActionTypes = {\n INIT: '@@redux/INIT'\n\n /**\n * Creates a Redux store that holds the state tree.\n * The only way to change the data in the store is to call `dispatch()` on it.\n *\n * There should only be a single store in your app. To specify how different\n * parts of the state tree respond to actions, you may combine several reducers\n * into a single reducer function by using `combineReducers`.\n *\n * @param {Function} reducer A function that returns the next state tree, given\n * the current state tree and the action to handle.\n *\n * @param {any} [preloadedState] The initial state. You may optionally specify it\n * to hydrate the state from the server in universal apps, or to restore a\n * previously serialized user session.\n * If you use `combineReducers` to produce the root reducer function, this must be\n * an object with the same shape as `combineReducers` keys.\n *\n * @param {Function} [enhancer] The store enhancer. You may optionally specify it\n * to enhance the store with third-party capabilities such as middleware,\n * time travel, persistence, etc. The only store enhancer that ships with Redux\n * is `applyMiddleware()`.\n *\n * @returns {Store} A Redux store that lets you read the state, dispatch actions\n * and subscribe to changes.\n */\n};export default function createStore(reducer, preloadedState, enhancer) {\n var _ref2;\n\n if (typeof preloadedState === 'function' && typeof enhancer === 'undefined') {\n enhancer = preloadedState;\n preloadedState = undefined;\n }\n\n if (typeof enhancer !== 'undefined') {\n if (typeof enhancer !== 'function') {\n throw new Error('Expected the enhancer to be a function.');\n }\n\n return enhancer(createStore)(reducer, preloadedState);\n }\n\n if (typeof reducer !== 'function') {\n throw new Error('Expected the reducer to be a function.');\n }\n\n var currentReducer = reducer;\n var currentState = preloadedState;\n var currentListeners = [];\n var nextListeners = currentListeners;\n var isDispatching = false;\n\n function ensureCanMutateNextListeners() {\n if (nextListeners === currentListeners) {\n nextListeners = currentListeners.slice();\n }\n }\n\n /**\n * Reads the state tree managed by the store.\n *\n * @returns {any} The current state tree of your application.\n */\n function getState() {\n return currentState;\n }\n\n /**\n * Adds a change listener. It will be called any time an action is dispatched,\n * and some part of the state tree may potentially have changed. You may then\n * call `getState()` to read the current state tree inside the callback.\n *\n * You may call `dispatch()` from a change listener, with the following\n * caveats:\n *\n * 1. The subscriptions are snapshotted just before every `dispatch()` call.\n * If you subscribe or unsubscribe while the listeners are being invoked, this\n * will not have any effect on the `dispatch()` that is currently in progress.\n * However, the next `dispatch()` call, whether nested or not, will use a more\n * recent snapshot of the subscription list.\n *\n * 2. The listener should not expect to see all state changes, as the state\n * might have been updated multiple times during a nested `dispatch()` before\n * the listener is called. It is, however, guaranteed that all subscribers\n * registered before the `dispatch()` started will be called with the latest\n * state by the time it exits.\n *\n * @param {Function} listener A callback to be invoked on every dispatch.\n * @returns {Function} A function to remove this change listener.\n */\n function subscribe(listener) {\n if (typeof listener !== 'function') {\n throw new Error('Expected listener to be a function.');\n }\n\n var isSubscribed = true;\n\n ensureCanMutateNextListeners();\n nextListeners.push(listener);\n\n return function unsubscribe() {\n if (!isSubscribed) {\n return;\n }\n\n isSubscribed = false;\n\n ensureCanMutateNextListeners();\n var index = nextListeners.indexOf(listener);\n nextListeners.splice(index, 1);\n };\n }\n\n /**\n * Dispatches an action. It is the only way to trigger a state change.\n *\n * The `reducer` function, used to create the store, will be called with the\n * current state tree and the given `action`. Its return value will\n * be considered the **next** state of the tree, and the change listeners\n * will be notified.\n *\n * The base implementation only supports plain object actions. If you want to\n * dispatch a Promise, an Observable, a thunk, or something else, you need to\n * wrap your store creating function into the corresponding middleware. For\n * example, see the documentation for the `redux-thunk` package. Even the\n * middleware will eventually dispatch plain object actions using this method.\n *\n * @param {Object} action A plain object representing “what changed”. It is\n * a good idea to keep actions serializable so you can record and replay user\n * sessions, or use the time travelling `redux-devtools`. An action must have\n * a `type` property which may not be `undefined`. It is a good idea to use\n * string constants for action types.\n *\n * @returns {Object} For convenience, the same action object you dispatched.\n *\n * Note that, if you use a custom middleware, it may wrap `dispatch()` to\n * return something else (for example, a Promise you can await).\n */\n function dispatch(action) {\n if (!isPlainObject(action)) {\n throw new Error('Actions must be plain objects. ' + 'Use custom middleware for async actions.');\n }\n\n if (typeof action.type === 'undefined') {\n throw new Error('Actions may not have an undefined \"type\" property. ' + 'Have you misspelled a constant?');\n }\n\n if (isDispatching) {\n throw new Error('Reducers may not dispatch actions.');\n }\n\n try {\n isDispatching = true;\n currentState = currentReducer(currentState, action);\n } finally {\n isDispatching = false;\n }\n\n var listeners = currentListeners = nextListeners;\n for (var i = 0; i < listeners.length; i++) {\n var listener = listeners[i];\n listener();\n }\n\n return action;\n }\n\n /**\n * Replaces the reducer currently used by the store to calculate the state.\n *\n * You might need this if your app implements code splitting and you want to\n * load some of the reducers dynamically. You might also need this if you\n * implement a hot reloading mechanism for Redux.\n *\n * @param {Function} nextReducer The reducer for the store to use instead.\n * @returns {void}\n */\n function replaceReducer(nextReducer) {\n if (typeof nextReducer !== 'function') {\n throw new Error('Expected the nextReducer to be a function.');\n }\n\n currentReducer = nextReducer;\n dispatch({ type: ActionTypes.INIT });\n }\n\n /**\n * Interoperability point for observable/reactive libraries.\n * @returns {observable} A minimal observable of state changes.\n * For more information, see the observable proposal:\n * https://github.com/tc39/proposal-observable\n */\n function observable() {\n var _ref;\n\n var outerSubscribe = subscribe;\n return _ref = {\n /**\n * The minimal observable subscription method.\n * @param {Object} observer Any object that can be used as an observer.\n * The observer object should have a `next` method.\n * @returns {subscription} An object with an `unsubscribe` method that can\n * be used to unsubscribe the observable from the store, and prevent further\n * emission of values from the observable.\n */\n subscribe: function subscribe(observer) {\n if (typeof observer !== 'object') {\n throw new TypeError('Expected the observer to be an object.');\n }\n\n function observeState() {\n if (observer.next) {\n observer.next(getState());\n }\n }\n\n observeState();\n var unsubscribe = outerSubscribe(observeState);\n return { unsubscribe: unsubscribe };\n }\n }, _ref[$$observable] = function () {\n return this;\n }, _ref;\n }\n\n // When a store is created, an \"INIT\" action is dispatched so that every\n // reducer returns their initial state. This effectively populates\n // the initial state tree.\n dispatch({ type: ActionTypes.INIT });\n\n return _ref2 = {\n dispatch: dispatch,\n subscribe: subscribe,\n getState: getState,\n replaceReducer: replaceReducer\n }, _ref2[$$observable] = observable, _ref2;\n}\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/redux/es/createStore.js\n// module id = null\n// module chunks = ","/**\n * Prints a warning in the console if it exists.\n *\n * @param {String} message The warning message.\n * @returns {void}\n */\nexport default function warning(message) {\n /* eslint-disable no-console */\n if (typeof console !== 'undefined' && typeof console.error === 'function') {\n console.error(message);\n }\n /* eslint-enable no-console */\n try {\n // This error was thrown as a convenience so that if you enable\n // \"break on all exceptions\" in your console,\n // it would pause the execution at this line.\n throw new Error(message);\n /* eslint-disable no-empty */\n } catch (e) {}\n /* eslint-enable no-empty */\n}\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/redux/es/utils/warning.js\n// module id = null\n// module chunks = ","import { ActionTypes } from './createStore';\nimport isPlainObject from 'lodash-es/isPlainObject';\nimport warning from './utils/warning';\n\nfunction getUndefinedStateErrorMessage(key, action) {\n var actionType = action && action.type;\n var actionName = actionType && '\"' + actionType.toString() + '\"' || 'an action';\n\n return 'Given action ' + actionName + ', 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.';\n}\n\nfunction getUnexpectedStateShapeWarningMessage(inputState, reducers, action, unexpectedKeyCache) {\n var reducerKeys = Object.keys(reducers);\n var argumentName = action && action.type === ActionTypes.INIT ? 'preloadedState argument passed to createStore' : 'previous state received by the reducer';\n\n if (reducerKeys.length === 0) {\n return 'Store does not have a valid reducer. Make sure the argument passed ' + 'to combineReducers is an object whose values are reducers.';\n }\n\n if (!isPlainObject(inputState)) {\n 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('\", \"') + '\"');\n }\n\n var unexpectedKeys = Object.keys(inputState).filter(function (key) {\n return !reducers.hasOwnProperty(key) && !unexpectedKeyCache[key];\n });\n\n unexpectedKeys.forEach(function (key) {\n unexpectedKeyCache[key] = true;\n });\n\n if (unexpectedKeys.length > 0) {\n 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.');\n }\n}\n\nfunction assertReducerShape(reducers) {\n Object.keys(reducers).forEach(function (key) {\n var reducer = reducers[key];\n var initialState = reducer(undefined, { type: ActionTypes.INIT });\n\n if (typeof initialState === 'undefined') {\n 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.');\n }\n\n var type = '@@redux/PROBE_UNKNOWN_ACTION_' + Math.random().toString(36).substring(7).split('').join('.');\n if (typeof reducer(undefined, { type: type }) === 'undefined') {\n 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.');\n }\n });\n}\n\n/**\n * Turns an object whose values are different reducer functions, into a single\n * reducer function. It will call every child reducer, and gather their results\n * into a single state object, whose keys correspond to the keys of the passed\n * reducer functions.\n *\n * @param {Object} reducers An object whose values correspond to different\n * reducer functions that need to be combined into one. One handy way to obtain\n * it is to use ES6 `import * as reducers` syntax. The reducers may never return\n * undefined for any action. Instead, they should return their initial state\n * if the state passed to them was undefined, and the current state for any\n * unrecognized action.\n *\n * @returns {Function} A reducer function that invokes every reducer inside the\n * passed object, and builds a state object with the same shape.\n */\nexport default function combineReducers(reducers) {\n var reducerKeys = Object.keys(reducers);\n var finalReducers = {};\n for (var i = 0; i < reducerKeys.length; i++) {\n var key = reducerKeys[i];\n\n if (process.env.NODE_ENV !== 'production') {\n if (typeof reducers[key] === 'undefined') {\n warning('No reducer provided for key \"' + key + '\"');\n }\n }\n\n if (typeof reducers[key] === 'function') {\n finalReducers[key] = reducers[key];\n }\n }\n var finalReducerKeys = Object.keys(finalReducers);\n\n var unexpectedKeyCache = void 0;\n if (process.env.NODE_ENV !== 'production') {\n unexpectedKeyCache = {};\n }\n\n var shapeAssertionError = void 0;\n try {\n assertReducerShape(finalReducers);\n } catch (e) {\n shapeAssertionError = e;\n }\n\n return function combination() {\n var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n var action = arguments[1];\n\n if (shapeAssertionError) {\n throw shapeAssertionError;\n }\n\n if (process.env.NODE_ENV !== 'production') {\n var warningMessage = getUnexpectedStateShapeWarningMessage(state, finalReducers, action, unexpectedKeyCache);\n if (warningMessage) {\n warning(warningMessage);\n }\n }\n\n var hasChanged = false;\n var nextState = {};\n for (var _i = 0; _i < finalReducerKeys.length; _i++) {\n var _key = finalReducerKeys[_i];\n var reducer = finalReducers[_key];\n var previousStateForKey = state[_key];\n var nextStateForKey = reducer(previousStateForKey, action);\n if (typeof nextStateForKey === 'undefined') {\n var errorMessage = getUndefinedStateErrorMessage(_key, action);\n throw new Error(errorMessage);\n }\n nextState[_key] = nextStateForKey;\n hasChanged = hasChanged || nextStateForKey !== previousStateForKey;\n }\n return hasChanged ? nextState : state;\n };\n}\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/redux/es/combineReducers.js\n// module id = null\n// module chunks = ","function bindActionCreator(actionCreator, dispatch) {\n return function () {\n return dispatch(actionCreator.apply(undefined, arguments));\n };\n}\n\n/**\n * Turns an object whose values are action creators, into an object with the\n * same keys, but with every function wrapped into a `dispatch` call so they\n * may be invoked directly. This is just a convenience method, as you can call\n * `store.dispatch(MyActionCreators.doSomething())` yourself just fine.\n *\n * For convenience, you can also pass a single function as the first argument,\n * and get a function in return.\n *\n * @param {Function|Object} actionCreators An object whose values are action\n * creator functions. One handy way to obtain it is to use ES6 `import * as`\n * syntax. You may also pass a single function.\n *\n * @param {Function} dispatch The `dispatch` function available on your Redux\n * store.\n *\n * @returns {Function|Object} The object mimicking the original object, but with\n * every action creator wrapped into the `dispatch` call. If you passed a\n * function as `actionCreators`, the return value will also be a single\n * function.\n */\nexport default function bindActionCreators(actionCreators, dispatch) {\n if (typeof actionCreators === 'function') {\n return bindActionCreator(actionCreators, dispatch);\n }\n\n if (typeof actionCreators !== 'object' || actionCreators === null) {\n 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\"?');\n }\n\n var keys = Object.keys(actionCreators);\n var boundActionCreators = {};\n for (var i = 0; i < keys.length; i++) {\n var key = keys[i];\n var actionCreator = actionCreators[key];\n if (typeof actionCreator === 'function') {\n boundActionCreators[key] = bindActionCreator(actionCreator, dispatch);\n }\n }\n return boundActionCreators;\n}\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/redux/es/bindActionCreators.js\n// module id = null\n// module chunks = ","/**\n * Composes single-argument functions from right to left. The rightmost\n * function can take multiple arguments as it provides the signature for\n * the resulting composite function.\n *\n * @param {...Function} funcs The functions to compose.\n * @returns {Function} A function obtained by composing the argument functions\n * from right to left. For example, compose(f, g, h) is identical to doing\n * (...args) => f(g(h(...args))).\n */\n\nexport default function compose() {\n for (var _len = arguments.length, funcs = Array(_len), _key = 0; _key < _len; _key++) {\n funcs[_key] = arguments[_key];\n }\n\n if (funcs.length === 0) {\n return function (arg) {\n return arg;\n };\n }\n\n if (funcs.length === 1) {\n return funcs[0];\n }\n\n return funcs.reduce(function (a, b) {\n return function () {\n return a(b.apply(undefined, arguments));\n };\n });\n}\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/redux/es/compose.js\n// module id = null\n// module chunks = ","var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };\n\nimport compose from './compose';\n\n/**\n * Creates a store enhancer that applies middleware to the dispatch method\n * of the Redux store. This is handy for a variety of tasks, such as expressing\n * asynchronous actions in a concise manner, or logging every action payload.\n *\n * See `redux-thunk` package as an example of the Redux middleware.\n *\n * Because middleware is potentially asynchronous, this should be the first\n * store enhancer in the composition chain.\n *\n * Note that each middleware will be given the `dispatch` and `getState` functions\n * as named arguments.\n *\n * @param {...Function} middlewares The middleware chain to be applied.\n * @returns {Function} A store enhancer applying the middleware.\n */\nexport default function applyMiddleware() {\n for (var _len = arguments.length, middlewares = Array(_len), _key = 0; _key < _len; _key++) {\n middlewares[_key] = arguments[_key];\n }\n\n return function (createStore) {\n return function (reducer, preloadedState, enhancer) {\n var store = createStore(reducer, preloadedState, enhancer);\n var _dispatch = store.dispatch;\n var chain = [];\n\n var middlewareAPI = {\n getState: store.getState,\n dispatch: function dispatch(action) {\n return _dispatch(action);\n }\n };\n chain = middlewares.map(function (middleware) {\n return middleware(middlewareAPI);\n });\n _dispatch = compose.apply(undefined, chain)(store.dispatch);\n\n return _extends({}, store, {\n dispatch: _dispatch\n });\n };\n };\n}\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/redux/es/applyMiddleware.js\n// module id = null\n// module chunks = ","import createStore from './createStore';\nimport combineReducers from './combineReducers';\nimport bindActionCreators from './bindActionCreators';\nimport applyMiddleware from './applyMiddleware';\nimport compose from './compose';\nimport warning from './utils/warning';\n\n/*\n* This is a dummy function to check if the function name has been altered by minification.\n* If the function has been minified and NODE_ENV !== 'production', warn the user.\n*/\nfunction isCrushed() {}\n\nif (process.env.NODE_ENV !== 'production' && typeof isCrushed.name === 'string' && isCrushed.name !== 'isCrushed') {\n warning('You are currently using minified code outside of NODE_ENV === \\'production\\'. ' + 'This means that you are running a slower development build of Redux. ' + 'You can use loose-envify (https://github.com/zertosh/loose-envify) for browserify ' + 'or DefinePlugin for webpack (http://stackoverflow.com/questions/30030031) ' + 'to ensure you have the correct code for your production build.');\n}\n\nexport { createStore, combineReducers, bindActionCreators, applyMiddleware, compose };\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/redux/es/index.js\n// module id = null\n// module chunks = ","export const defaultState = [];\n\nexport default function items(state = defaultState, action) {\n switch (action.type) {\n case 'ADD_ITEM': {\n // Add object to items array\n const newState = [...state, {\n id: action.id,\n choiceId: action.choiceId,\n groupId: action.groupId,\n value: action.value,\n label: action.label,\n active: true,\n highlighted: false,\n customProperties: action.customProperties,\n placeholder: (action.placeholder || false),\n keyCode: null,\n }];\n\n return newState.map((obj) => {\n const item = obj;\n if (item.highlighted) {\n item.highlighted = false;\n }\n return item;\n });\n }\n\n case 'REMOVE_ITEM': {\n // Set item to inactive\n return state.map((obj) => {\n const item = obj;\n if (item.id === action.id) {\n item.active = false;\n }\n return item;\n });\n }\n\n case 'HIGHLIGHT_ITEM': {\n return state.map((obj) => {\n const item = obj;\n if (item.id === action.id) {\n item.highlighted = action.highlighted;\n }\n return item;\n });\n }\n\n default: {\n return state;\n }\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// src/scripts/src/reducers/items.js","export const defaultState = [];\n\nexport default function groups(state = defaultState, action) {\n switch (action.type) {\n case 'ADD_GROUP': {\n return [...state, {\n id: action.id,\n value: action.value,\n active: action.active,\n disabled: action.disabled,\n }];\n }\n\n case 'CLEAR_CHOICES': {\n return [];\n }\n\n default: {\n return state;\n }\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// src/scripts/src/reducers/groups.js","export const defaultState = [];\n\nexport default function choices(state = defaultState, action) {\n switch (action.type) {\n case 'ADD_CHOICE': {\n /*\n A disabled choice appears in the choice dropdown but cannot be selected\n A selected choice has been added to the passed input's value (added as an item)\n An active choice appears within the choice dropdown\n */\n return [...state, {\n id: action.id,\n elementId: action.elementId,\n groupId: action.groupId,\n value: action.value,\n label: (action.label || action.value),\n disabled: (action.disabled || false),\n selected: false,\n active: true,\n score: 9999,\n customProperties: action.customProperties,\n placeholder: (action.placeholder || false),\n keyCode: null,\n }];\n }\n\n case 'ADD_ITEM': {\n // If all choices need to be activated\n if (action.activateOptions) {\n return state.map((obj) => {\n const choice = obj;\n choice.active = action.active;\n return choice;\n });\n }\n\n // When an item is added and it has an associated choice,\n // we want to disable it so it can't be chosen again\n if (action.choiceId > -1) {\n return state.map((obj) => {\n const choice = obj;\n if (choice.id === parseInt(action.choiceId, 10)) {\n choice.selected = true;\n }\n return choice;\n });\n }\n\n return state;\n }\n\n case 'REMOVE_ITEM': {\n // When an item is removed and it has an associated choice,\n // we want to re-enable it so it can be chosen again\n if (action.choiceId > -1) {\n return state.map((obj) => {\n const choice = obj;\n if (choice.id === parseInt(action.choiceId, 10)) {\n choice.selected = false;\n }\n return choice;\n });\n }\n\n return state;\n }\n\n case 'FILTER_CHOICES': {\n return state.map((obj) => {\n const choice = obj;\n // Set active state based on whether choice is\n // within filtered results\n choice.active = action.results.some(({ item, score }) => {\n if (item.id === choice.id) {\n choice.score = score;\n return true;\n }\n return false;\n });\n\n return choice;\n });\n }\n\n case 'ACTIVATE_CHOICES': {\n return state.map((obj) => {\n const choice = obj;\n choice.active = action.active;\n return choice;\n });\n }\n\n case 'CLEAR_CHOICES': {\n return defaultState;\n }\n\n default: {\n return state;\n }\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// src/scripts/src/reducers/choices.js","import { combineReducers } from 'redux';\nimport items from './items';\nimport groups from './groups';\nimport choices from './choices';\n\nconst appReducer = combineReducers({\n items,\n groups,\n choices,\n});\n\nconst rootReducer = (passedState, action) => {\n let state = passedState;\n // If we are clearing all items, groups and options we reassign\n // state and then pass that state to our proper reducer. This isn't\n // mutating our actual state\n // See: http://stackoverflow.com/a/35641992\n if (action.type === 'CLEAR_ALL') {\n state = undefined;\n }\n\n return appReducer(state, action);\n};\n\nexport default rootReducer;\n\n\n\n// WEBPACK FOOTER //\n// src/scripts/src/reducers/index.js","import { createStore } from 'redux';\nimport rootReducer from './../reducers/index';\n\nexport default class Store {\n constructor() {\n this.store = createStore(\n rootReducer,\n window.devToolsExtension ?\n window.devToolsExtension() :\n undefined,\n );\n }\n\n /**\n * Subscribe store to function call (wrapped Redux method)\n * @param {Function} onChange Function to trigger when state changes\n * @return\n */\n subscribe(onChange) {\n this.store.subscribe(onChange);\n }\n\n /**\n * Dispatch event to store (wrapped Redux method)\n * @param {Function} action Action function to trigger\n * @return\n */\n dispatch(action) {\n this.store.dispatch(action);\n }\n\n /**\n * Get store object (wrapping Redux method)\n * @return {Object} State\n */\n getState() {\n return this.store.getState();\n }\n\n /**\n * Get items from store\n * @return {Array} Item objects\n */\n getItems() {\n const state = this.store.getState();\n return state.items;\n }\n\n /**\n * Get active items from store\n * @return {Array} Item objects\n */\n getItemsFilteredByActive() {\n const items = this.getItems();\n const values = items.filter(item => item.active === true, []);\n\n return values;\n }\n\n /**\n * Get items from store reduced to just their values\n * @return {Array} Item objects\n */\n getItemsReducedToValues(items = this.getItems()) {\n const values = items.reduce((prev, current) => {\n prev.push(current.value);\n return prev;\n }, []);\n\n return values;\n }\n\n /**\n * Get choices from store\n * @return {Array} Option objects\n */\n getChoices() {\n const state = this.store.getState();\n return state.choices;\n }\n\n /**\n * Get active choices from store\n * @return {Array} Option objects\n */\n getChoicesFilteredByActive() {\n const choices = this.getChoices();\n const values = choices.filter(choice => choice.active === true);\n\n return values;\n }\n\n /**\n * Get selectable choices from store\n * @return {Array} Option objects\n */\n getChoicesFilteredBySelectable() {\n const choices = this.getChoices();\n const values = choices.filter(choice => choice.disabled !== true);\n\n return values;\n }\n\n /**\n * Get choices that can be searched (excluding placeholders)\n * @return {Array} Option objects\n */\n getSearchableChoices() {\n const filtered = this.getChoicesFilteredBySelectable();\n return filtered.filter(choice => choice.placeholder !== true);\n }\n\n /**\n * Get single choice by it's ID\n * @return {Object} Found choice\n */\n getChoiceById(id) {\n if (id) {\n const choices = this.getChoicesFilteredByActive();\n const foundChoice = choices.find(choice => choice.id === parseInt(id, 10));\n return foundChoice;\n }\n return false;\n }\n\n /**\n * Get placeholder choice from store\n * @return {Object} Found placeholder\n */\n getPlaceholderChoice() {\n const choices = this.getChoices();\n const placeholderChoice = [...choices]\n .reverse()\n .find(choice => choice.placeholder === true);\n\n return placeholderChoice;\n }\n\n /**\n * Get groups from store\n * @return {Array} Group objects\n */\n getGroups() {\n const state = this.store.getState();\n return state.groups;\n }\n\n /**\n * Get active groups from store\n * @return {Array} Group objects\n */\n getGroupsFilteredByActive() {\n const groups = this.getGroups();\n const choices = this.getChoices();\n\n const values = groups.filter((group) => {\n const isActive = group.active === true && group.disabled === false;\n const hasActiveOptions = choices.some(choice =>\n choice.active === true && choice.disabled === false,\n );\n return isActive && hasActiveOptions;\n }, []);\n\n return values;\n }\n\n /**\n * Get group by group id\n * @param {Number} id Group ID\n * @return {Object} Group data\n */\n getGroupById(id) {\n const groups = this.getGroups();\n const foundGroup = groups.find(group => group.id === parseInt(id, 10));\n\n return foundGroup;\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// src/scripts/src/store/store.js","export default class Dropdown {\n constructor(instance, element, classNames) {\n this.parentInstance = instance;\n this.element = element;\n this.classNames = classNames;\n this.dimensions = null;\n this.position = null;\n this.isActive = false;\n }\n\n getElement() {\n return this.element;\n }\n\n /**\n * Determine how far the top of our element is from\n * the top of the window\n * @return {Number} Vertical position\n */\n getVerticalPos() {\n this.dimensions = this.element.getBoundingClientRect();\n this.position = Math.ceil(this.dimensions.top + window.pageYOffset + this.element.offsetHeight);\n return this.position;\n }\n\n /**\n * Find element that matches passed selector\n * @return {HTMLElement}\n */\n getChild(selector) {\n return this.element.querySelector(selector);\n }\n\n /**\n * Show dropdown to user by adding active state class\n * @return {Object} Class instance\n * @public\n */\n show() {\n this.element.classList.add(this.classNames.activeState);\n this.element.setAttribute('aria-expanded', 'true');\n this.isActive = true;\n return this.parentInstance;\n }\n\n /**\n * Hide dropdown from user\n * @return {Object} Class instance\n * @public\n */\n hide() {\n this.element.classList.remove(this.classNames.activeState);\n this.element.setAttribute('aria-expanded', 'false');\n this.isActive = false;\n return this.parentInstance;\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// src/scripts/src/components/dropdown.js","export default class Container {\n constructor(instance, element, classNames) {\n this.parentInstance = instance;\n this.element = element;\n this.classNames = classNames;\n this.config = instance.config;\n this.isOpen = false;\n this.isFlipped = false;\n this.isFocussed = false;\n this.isDisabled = false;\n this.isLoading = false;\n this.onFocus = this.onFocus.bind(this);\n this.onBlur = this.onBlur.bind(this);\n }\n\n getElement() {\n return this.element;\n }\n\n /**\n * Add event listeners\n */\n addEventListeners() {\n this.element.addEventListener('focus', this.onFocus);\n this.element.addEventListener('blur', this.onBlur);\n }\n\n /**\n * Remove event listeners\n */\n\n /** */\n removeEventListeners() {\n this.element.removeEventListener('focus', this.onFocus);\n this.element.removeEventListener('blur', this.onBlur);\n }\n\n /**\n * Set focussed state\n */\n onFocus() {\n this.isFocussed = true;\n }\n\n /**\n * Remove blurred state\n */\n onBlur() {\n this.isFocussed = false;\n }\n\n /**\n * Determine whether container should be flipped\n * based on passed dropdown position\n * @param {Number} dropdownPos\n * @returns\n */\n shouldFlip(dropdownPos) {\n if (dropdownPos === undefined) {\n return false;\n }\n\n const body = document.body;\n const html = document.documentElement;\n const winHeight = Math.max(\n body.scrollHeight,\n body.offsetHeight,\n html.clientHeight,\n html.scrollHeight,\n html.offsetHeight,\n );\n\n // If flip is enabled and the dropdown bottom position is\n // greater than the window height flip the dropdown.\n let shouldFlip = false;\n if (this.config.position === 'auto') {\n shouldFlip = dropdownPos >= winHeight;\n } else if (this.config.position === 'top') {\n shouldFlip = true;\n }\n\n return shouldFlip;\n }\n\n /**\n * Set active descendant attribute\n * @param {Number} activeDescendant ID of active descendant\n */\n setActiveDescendant(activeDescendantID) {\n this.element.setAttribute('aria-activedescendant', activeDescendantID);\n }\n\n /**\n * Remove active descendant attribute\n */\n removeActiveDescendant() {\n this.element.removeAttribute('aria-activedescendant');\n }\n\n open(dropdownPos) {\n this.element.classList.add(this.classNames.openState);\n this.element.setAttribute('aria-expanded', 'true');\n this.isOpen = true;\n\n if (this.shouldFlip(dropdownPos)) {\n this.element.classList.add(this.classNames.flippedState);\n this.isFlipped = true;\n }\n }\n\n close() {\n this.element.classList.remove(this.classNames.openState);\n this.element.setAttribute('aria-expanded', 'false');\n this.removeActiveDescendant();\n this.isOpen = false;\n\n // A dropdown flips if it does not have space within the page\n if (this.isFlipped) {\n this.element.classList.remove(this.classNames.flippedState);\n this.isFlipped = false;\n }\n }\n\n focus() {\n if (!this.isFocussed) {\n this.element.focus();\n }\n }\n\n addFocusState() {\n this.element.classList.add(this.classNames.focusState);\n }\n\n removeFocusState() {\n this.element.classList.remove(this.classNames.focusState);\n }\n\n /**\n * Remove disabled state\n */\n enable() {\n this.element.classList.remove(this.config.classNames.disabledState);\n this.element.removeAttribute('aria-disabled');\n if (this.parentInstance.isSelectOneElement) {\n this.element.setAttribute('tabindex', '0');\n }\n this.isDisabled = false;\n }\n\n /**\n * Set disabled state\n */\n disable() {\n this.element.classList.add(this.config.classNames.disabledState);\n this.element.setAttribute('aria-disabled', 'true');\n if (this.parentInstance.isSelectOneElement) {\n this.element.setAttribute('tabindex', '-1');\n }\n this.isDisabled = true;\n }\n\n revert(originalElement) {\n // Move passed element back to original position\n this.element.parentNode.insertBefore(\n originalElement,\n this.element,\n );\n // Remove container\n this.element.parentNode.removeChild(this.element);\n }\n\n /**\n * Add loading state to element\n */\n addLoadingState() {\n this.element.classList.add(this.classNames.loadingState);\n this.element.setAttribute('aria-busy', 'true');\n this.isLoading = true;\n }\n\n /**\n * Remove loading state from element\n */\n removeLoadingState() {\n this.element.classList.remove(this.classNames.loadingState);\n this.element.removeAttribute('aria-busy');\n this.isLoading = false;\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// src/scripts/src/components/container.js","/* eslint-disable */\n\n/**\n * Capitalises the first letter of each word in a string\n * @param {String} str String to capitalise\n * @return {String} Capitalised string\n */\nexport const capitalise = function(str) {\n return str.replace(/\\w\\S*/g, txt => txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase());\n};\n\n/**\n * Generates a string of random chars\n * @param {Number} length Length of the string to generate\n * @return {String} String of random chars\n */\nexport const generateChars = function(length) {\n let chars = '';\n\n for (let i = 0; i < length; i++) {\n const randomChar = getRandomNumber(0, 36);\n chars += randomChar.toString(36);\n }\n\n return chars;\n};\n\n/**\n * Generates a unique id based on an element\n * @param {HTMLElement} element Element to generate the id from\n * @param {String} Prefix for the Id\n * @return {String} Unique Id\n */\nexport const generateId = function(element, prefix) {\n let id = element.id || (element.name && (`${element.name}-${generateChars(2)}`)) || generateChars(4);\n id = id.replace(/(:|\\.|\\[|\\]|,)/g, '');\n id = prefix + id;\n\n return id;\n};\n\n\n/**\n * Tests the type of an object\n * @param {String} type Type to test object against\n * @param {Object} obj Object to be tested\n * @return {Boolean}\n */\nexport const getType = function(obj) {\n return Object.prototype.toString.call(obj).slice(8, -1);\n};\n\n/**\n * Tests the type of an object\n * @param {String} type Type to test object against\n * @param {Object} obj Object to be tested\n * @return {Boolean}\n */\nexport const isType = function(type, obj) {\n const clas = getType(obj);\n return obj !== undefined && obj !== null && clas === type;\n};\n\n/**\n * Tests to see if a passed object is a node\n * @param {Object} obj Object to be tested\n * @return {Boolean}\n */\nexport const isNode = o => (\n typeof Node === 'object' ? o instanceof Node :\n o && typeof o === 'object' && typeof o.nodeType === 'number' && typeof o.nodeName === 'string'\n );\n\n/**\n * Tests to see if a passed object is an element\n * @param {Object} obj Object to be tested\n * @return {Boolean}\n */\nexport const isElement = o => (\n typeof HTMLElement === 'object' ? o instanceof HTMLElement : // DOM2\n o && typeof o === 'object' && o !== null && o.nodeType === 1 && typeof o.nodeName === 'string'\n );\n\n/**\n * Merges unspecified amount of objects into new object\n * @private\n * @return {Object} Merged object of arguments\n */\nexport const extend = function() {\n const extended = {};\n const length = arguments.length;\n\n /**\n * Merge one object into another\n * @param {Object} obj Object to merge into extended object\n */\n const merge = function(obj) {\n for (const prop in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, prop)) {\n // If deep merge and property is an object, merge properties\n if (isType('Object', obj[prop])) {\n extended[prop] = extend(true, extended[prop], obj[prop]);\n } else {\n extended[prop] = obj[prop];\n }\n }\n }\n };\n\n // Loop through each passed argument\n for (let i = 0; i < length; i++) {\n // store argument at position i\n const obj = arguments[i];\n\n // If we are in fact dealing with an object, merge it.\n if (isType('Object', obj)) {\n merge(obj);\n }\n }\n\n return extended;\n};\n\n/**\n * CSS transition end event listener\n * @return\n */\nexport const whichTransitionEvent = function() {\n let t,\n el = document.createElement('fakeelement');\n\n const transitions = {\n transition: 'transitionend',\n OTransition: 'oTransitionEnd',\n MozTransition: 'transitionend',\n WebkitTransition: 'webkitTransitionEnd',\n };\n\n for (t in transitions) {\n if (el.style[t] !== undefined) {\n return transitions[t];\n }\n }\n};\n\n/**\n * CSS animation end event listener\n * @return\n */\nexport const whichAnimationEvent = function() {\n let t,\n el = document.createElement('fakeelement');\n\n const animations = {\n animation: 'animationend',\n OAnimation: 'oAnimationEnd',\n MozAnimation: 'animationend',\n WebkitAnimation: 'webkitAnimationEnd',\n };\n\n for (t in animations) {\n if (el.style[t] !== undefined) {\n return animations[t];\n }\n }\n};\n\n/**\n * Get the ancestors of each element in the current set of matched elements,\n * up to but not including the element matched by the selector\n * @param {NodeElement} elem Element to begin search from\n * @param {NodeElement} parent Parent to find\n * @param {String} selector Class to find\n * @return {Array} Array of parent elements\n */\nexport const getParentsUntil = function(elem, parent, selector) {\n const parents = [];\n // Get matches\n for (; elem && elem !== document; elem = elem.parentNode) {\n // Check if parent has been reached\n if (parent) {\n const parentType = parent.charAt(0);\n\n // If parent is a class\n if (parentType === '.') {\n if (elem.classList.contains(parent.substr(1))) {\n break;\n }\n }\n\n // If parent is an ID\n if (parentType === '#') {\n if (elem.id === parent.substr(1)) {\n break;\n }\n }\n\n // If parent is a data attribute\n if (parentType === '[') {\n if (elem.hasAttribute(parent.substr(1, parent.length - 1))) {\n break;\n }\n }\n\n // If parent is a tag\n if (elem.tagName.toLowerCase() === parent) {\n break;\n }\n }\n if (selector) {\n const selectorType = selector.charAt(0);\n\n // If selector is a class\n if (selectorType === '.') {\n if (elem.classList.contains(selector.substr(1))) {\n parents.push(elem);\n }\n }\n\n // If selector is an ID\n if (selectorType === '#') {\n if (elem.id === selector.substr(1)) {\n parents.push(elem);\n }\n }\n\n // If selector is a data attribute\n if (selectorType === '[') {\n if (elem.hasAttribute(selector.substr(1, selector.length - 1))) {\n parents.push(elem);\n }\n }\n\n // If selector is a tag\n if (elem.tagName.toLowerCase() === selector) {\n parents.push(elem);\n }\n } else {\n parents.push(elem);\n }\n }\n\n // Return parents if any exist\n if (parents.length === 0) {\n return null;\n }\n return parents;\n};\n\nexport const wrap = function(element, wrapper) {\n wrapper = wrapper || document.createElement('div');\n if (element.nextSibling) {\n element.parentNode.insertBefore(wrapper, element.nextSibling);\n } else {\n element.parentNode.appendChild(wrapper);\n }\n return wrapper.appendChild(element);\n};\n\nexport const getSiblings = function(elem) {\n const siblings = [];\n let sibling = elem.parentNode.firstChild;\n for (; sibling; sibling = sibling.nextSibling) {\n if (sibling.nodeType === 1 && sibling !== elem) {\n siblings.push(sibling);\n }\n }\n return siblings;\n};\n\n/**\n * Find ancestor in DOM tree\n * @param {NodeElement} el Element to start search from\n * @param {[type]} cls Class of parent\n * @return {NodeElement} Found parent element\n */\nexport const findAncestor = function(el, cls) {\n while ((el = el.parentElement) && !el.classList.contains(cls));\n return el;\n};\n\n/**\n * Find ancestor in DOM tree by attribute name\n * @param {NodeElement} el Element to start search from\n * @param {string} attr Attribute name of parent\n * @return {?NodeElement} Found parent element or null\n */\nexport const findAncestorByAttrName = function(el, attr) {\n let target = el;\n\n while (target) {\n if (target.hasAttribute(attr)) {\n return target;\n }\n\n target = target.parentElement;\n }\n\n return null;\n};\n\n/**\n * Debounce an event handler.\n * @param {Function} func Function to run after wait\n * @param {Number} wait The delay before the function is executed\n * @param {Boolean} immediate If passed, trigger the function on the leading edge, instead of the trailing.\n * @return {Function} A function will be called after it stops being called for a given delay\n */\nexport const debounce = function(func, wait, immediate) {\n let timeout;\n return function() {\n let context = this,\n args = arguments;\n const later = function() {\n timeout = null;\n if (!immediate) func.apply(context, args);\n };\n const callNow = immediate && !timeout;\n clearTimeout(timeout);\n timeout = setTimeout(later, wait);\n if (callNow) func.apply(context, args);\n };\n};\n\n/**\n * Get an element's distance from the top of the page\n * @private\n * @param {NodeElement} el Element to test for\n * @return {Number} Elements Distance from top of page\n */\nexport const getElemDistance = function(el) {\n let location = 0;\n if (el.offsetParent) {\n do {\n location += el.offsetTop;\n el = el.offsetParent;\n } while (el);\n }\n return location >= 0 ? location : 0;\n};\n\n/**\n * Determine element height multiplied by any offsets\n * @private\n * @param {HTMLElement} el Element to test for\n * @return {Number} Height of element\n */\nexport const getElementOffset = function(el, offset) {\n let elOffset = offset;\n if (elOffset > 1) elOffset = 1;\n if (elOffset > 0) elOffset = 0;\n\n return Math.max(el.offsetHeight * elOffset);\n};\n\n/**\n * Get the next or previous element from a given start point\n * @param {HTMLElement} startEl Element to start position from\n * @param {String} className The class we will look through\n * @param {Number} direction Positive next element, negative previous element\n * @return {[HTMLElement} Found element\n */\nexport const getAdjacentEl = (startEl, className, direction = 1) => {\n if (!startEl || !className) return;\n\n const parent = startEl.parentNode.parentNode;\n const children = Array.from(parent.querySelectorAll(className));\n\n const startPos = children.indexOf(startEl);\n const operatorDirection = direction > 0 ? 1 : -1;\n\n return children[startPos + operatorDirection];\n};\n\n/**\n * Get scroll position based on top/bottom position\n * @private\n * @return {String} Position of scroll\n */\nexport const getScrollPosition = function(position) {\n if (position === 'bottom') {\n // Scroll position from the bottom of the viewport\n return Math.max((window.scrollY || window.pageYOffset) + (window.innerHeight || document.documentElement.clientHeight));\n }\n // Scroll position from the top of the viewport\n return (window.scrollY || window.pageYOffset);\n};\n\n/**\n * Determine whether an element is within the viewport\n * @param {HTMLElement} el Element to test\n * @return {String} Position of scroll\n * @return {Boolean}\n */\nexport const isInView = function(el, position, offset) {\n // If the user has scrolled further than the distance from the element to the top of its parent\n return this.getScrollPosition(position) > (this.getElemDistance(el) + this.getElementOffset(el, offset));\n};\n\n/**\n * Determine whether an element is within\n * @param {HTMLElement} el Element to test\n * @param {HTMLElement} parent Scrolling parent\n * @param {Number} direction Whether element is visible from above or below\n * @return {Boolean}\n */\nexport const isScrolledIntoView = (el, parent, direction = 1) => {\n if (!el) return;\n\n let isVisible;\n\n if (direction > 0) {\n // In view from bottom\n isVisible = (parent.scrollTop + parent.offsetHeight) >= (el.offsetTop + el.offsetHeight);\n } else {\n // In view from top\n isVisible = el.offsetTop >= parent.scrollTop;\n }\n\n return isVisible;\n};\n\n/**\n * Remove html tags from a string\n * @param {String} Initial string/html\n * @return {String} Sanitised string\n */\nexport const stripHTML = function(html) {\n const el = document.createElement('DIV');\n el.innerHTML = html;\n return el.textContent || el.innerText || '';\n};\n\n/**\n * Adds animation to an element and removes it upon animation completion\n * @param {Element} el Element to add animation to\n * @param {String} animation Animation class to add to element\n * @return\n */\nexport const addAnimation = (el, animation) => {\n const animationEvent = whichAnimationEvent();\n\n const removeAnimation = () => {\n el.classList.remove(animation);\n el.removeEventListener(animationEvent, removeAnimation, false);\n };\n\n el.classList.add(animation);\n el.addEventListener(animationEvent, removeAnimation, false);\n};\n\n\n/**\n * Get a random number between a range\n * @param {Number} min Minimum range\n * @param {Number} max Maximum range\n * @return {Number} Random number\n */\nexport const getRandomNumber = function(min, max) {\n return Math.floor(Math.random() * (max - min) + min);\n};\n\n/**\n * Turn a string into a node\n * @param {String} String to convert\n * @return {HTMLElement} Converted node element\n */\nexport const strToEl = (function() {\n const tmpEl = document.createElement('div');\n return function(str) {\n const cleanedInput = str.trim();\n let r;\n tmpEl.innerHTML = cleanedInput;\n r = tmpEl.children[0];\n\n while (tmpEl.firstChild) {\n tmpEl.removeChild(tmpEl.firstChild);\n }\n\n return r;\n };\n}());\n\n/**\n * Sets the width of a passed input based on its value\n * @return {Number} Width of input\n */\nexport const getWidthOfInput = (input) => {\n const value = input.value || input.placeholder;\n let width = input.offsetWidth;\n\n if (value) {\n const testEl = strToEl(`${value} `);\n testEl.style.position = 'absolute';\n testEl.style.padding = '0';\n testEl.style.top = '-9999px';\n testEl.style.left = '-9999px';\n testEl.style.width = 'auto';\n testEl.style.whiteSpace = 'pre';\n\n if (document.body.contains(input) && window.getComputedStyle) {\n const inputStyle = window.getComputedStyle(input);\n\n if (inputStyle) {\n testEl.style.fontSize = inputStyle.fontSize;\n testEl.style.fontFamily = inputStyle.fontFamily;\n testEl.style.fontWeight = inputStyle.fontWeight;\n testEl.style.fontStyle = inputStyle.fontStyle;\n testEl.style.letterSpacing = inputStyle.letterSpacing;\n testEl.style.textTransform = inputStyle.textTransform;\n testEl.style.padding = inputStyle.padding;\n }\n }\n\n document.body.appendChild(testEl);\n\n if (value && testEl.offsetWidth !== input.offsetWidth) {\n width = testEl.offsetWidth + 4;\n }\n\n document.body.removeChild(testEl);\n }\n\n return `${width}px`;\n};\n\n/**\n * Sorting function for current and previous string\n * @param {String} a Current value\n * @param {String} b Next value\n * @return {Number} -1 for after previous,\n * 1 for before,\n * 0 for same location\n */\nexport const sortByAlpha = (a, b) => {\n const labelA = (a.label || a.value).toLowerCase();\n const labelB = (b.label || b.value).toLowerCase();\n\n if (labelA < labelB) return -1;\n if (labelA > labelB) return 1;\n return 0;\n};\n\n/**\n * Sort by numeric score\n * @param {Object} a Current value\n * @param {Object} b Next value\n * @return {Number} -1 for after previous,\n * 1 for before,\n * 0 for same location\n */\nexport const sortByScore = (a, b) => a.score - b.score;\n\n/**\n * Dispatch native event\n * @param {NodeElement} element Element to trigger event on\n * @param {String} type Type of event to trigger\n * @param {Object} customArgs Data to pass with event\n * @return {Object} Triggered event\n */\nexport const dispatchEvent = (element, type, customArgs = null) => {\n const event = new CustomEvent(type, {\n detail: customArgs,\n bubbles: true,\n cancelable: true,\n });\n\n return element.dispatchEvent(event);\n};\n\n/**\n * Tests value against a regular expression\n * @param {string} value Value to test\n * @return {Boolean} Whether test passed/failed\n * @private\n */\nexport const regexFilter = (value, regex) => {\n if (!value || !regex) {\n return false;\n }\n\n const expression = new RegExp(regex.source, 'i');\n return expression.test(value);\n};\n\n\n\n// WEBPACK FOOTER //\n// src/scripts/src/lib/utils.js","import { getWidthOfInput } from '../lib/utils';\n\nexport default class Input {\n constructor(instance, element, classNames) {\n this.parentInstance = instance;\n this.element = element;\n this.classNames = classNames;\n this.isFocussed = this.element === document.activeElement;\n this.isDisabled = false;\n\n // Bind event listeners\n this.onPaste = this.onPaste.bind(this);\n this.onInput = this.onInput.bind(this);\n this.onFocus = this.onFocus.bind(this);\n this.onBlur = this.onBlur.bind(this);\n }\n\n getElement() {\n return this.element;\n }\n\n addEventListeners() {\n this.element.addEventListener('input', this.onInput);\n this.element.addEventListener('paste', this.onPaste);\n this.element.addEventListener('focus', this.onFocus);\n this.element.addEventListener('blur', this.onBlur);\n }\n\n removeEventListeners() {\n this.element.removeEventListener('input', this.onInput);\n this.element.removeEventListener('paste', this.onPaste);\n this.element.removeEventListener('focus', this.onFocus);\n this.element.removeEventListener('blur', this.onBlur);\n }\n\n /**\n * Input event\n * @return\n * @private\n */\n onInput() {\n if (!this.parentInstance.isSelectOneElement) {\n this.setWidth();\n }\n }\n\n /**\n * Paste event\n * @param {Object} e Event\n * @return\n * @private\n */\n onPaste(e) {\n // Disable pasting into the input if option has been set\n if (e.target === this.element && !this.parentInstance.config.paste) {\n e.preventDefault();\n }\n }\n\n /**\n * Set focussed state\n */\n onFocus() {\n this.isFocussed = true;\n }\n\n /**\n * Remove focussed state\n */\n onBlur() {\n this.isFocussed = false;\n }\n\n activate(focusInput) {\n // Optionally focus the input if we have a search input\n if (focusInput && this.parentInstance.canSearch && document.activeElement !== this.element) {\n this.element.focus();\n }\n }\n\n deactivate(blurInput) {\n this.removeActiveDescendant();\n // Optionally blur the input if we have a search input\n if (blurInput && this.parentInstance.canSearch && document.activeElement === this.element) {\n this.element.blur();\n }\n }\n\n enable() {\n this.element.removeAttribute('disabled');\n this.isDisabled = false;\n }\n\n disable() {\n this.element.setAttribute('disabled', '');\n this.isDisabled = true;\n }\n\n focus() {\n if (!this.isFocussed) {\n this.element.focus();\n }\n }\n\n /**\n * Set value of input to blank\n * @return {Object} Class instance\n * @public\n */\n clear(setWidth = true) {\n if (this.element.value) {\n this.element.value = '';\n }\n\n if (setWidth) {\n this.setWidth();\n }\n\n return this.parentInstance;\n }\n\n /**\n * Set the correct input width based on placeholder\n * value or input value\n * @return\n */\n setWidth(enforceWidth) {\n if (this.parentInstance.placeholder) {\n // If there is a placeholder, we only want to set the width of the input when it is a greater\n // length than 75% of the placeholder. This stops the input jumping around.\n if (\n (this.element.value &&\n this.element.value.length >= (this.parentInstance.placeholder.length / 1.25)) ||\n enforceWidth\n ) {\n this.element.style.width = this.getWidth();\n }\n } else {\n // If there is no placeholder, resize input to contents\n this.element.style.width = this.getWidth();\n }\n }\n\n getWidth() {\n return getWidthOfInput(this.element);\n }\n\n setPlaceholder(placeholder) {\n this.element.placeholder = placeholder;\n }\n\n setValue(value) {\n this.element.value = value;\n }\n\n getValue() {\n return this.element.value;\n }\n\n setActiveDescendant(activeDescendantID) {\n this.element.setAttribute('aria-activedescendant', activeDescendantID);\n }\n\n removeActiveDescendant() {\n this.element.removeAttribute('aria-activedescendant');\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// src/scripts/src/components/input.js","export default class List {\n constructor(instance, element, classNames) {\n this.parentInstance = instance;\n this.element = element;\n this.classNames = classNames;\n this.scrollPos = this.element.scrollTop;\n this.height = this.element.offsetHeight;\n this.hasChildren = !!this.element.children;\n }\n\n getElement() {\n return this.element;\n }\n\n /**\n * Clear List contents\n */\n clear() {\n this.element.innerHTML = '';\n }\n\n /**\n * Scroll to passed position on Y axis\n */\n scrollTo(scrollPos = 0) {\n this.element.scrollTop = scrollPos;\n }\n /**\n * Append node to element\n */\n append(node) {\n this.element.appendChild(node);\n }\n\n /**\n * Find element that matches passed selector\n * @return {HTMLElement}\n */\n getChild(selector) {\n return this.element.querySelector(selector);\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// src/scripts/src/components/list.js","import { dispatchEvent } from '../lib/utils';\n\nexport default class WrappedElement {\n constructor(instance, element, classNames) {\n this.parentInstance = instance;\n this.element = element;\n this.classNames = classNames;\n this.isDisabled = false;\n }\n\n getElement() {\n return this.element;\n }\n\n getValue() {\n return this.element.value;\n }\n\n conceal() {\n // Hide passed input\n this.element.classList.add(\n this.classNames.input,\n this.classNames.hiddenState,\n );\n\n // Remove element from tab index\n this.element.tabIndex = '-1';\n\n // Backup original styles if any\n const origStyle = this.element.getAttribute('style');\n\n if (origStyle) {\n this.element.setAttribute('data-choice-orig-style', origStyle);\n }\n\n this.element.setAttribute('style', 'display:none;');\n this.element.setAttribute('aria-hidden', 'true');\n this.element.setAttribute('data-choice', 'active');\n }\n\n reveal() {\n // Reinstate passed element\n this.element.classList.remove(\n this.classNames.input,\n this.classNames.hiddenState,\n );\n this.element.removeAttribute('tabindex');\n\n // Recover original styles if any\n const origStyle = this.element.getAttribute('data-choice-orig-style');\n\n if (origStyle) {\n this.element.removeAttribute('data-choice-orig-style');\n this.element.setAttribute('style', origStyle);\n } else {\n this.element.removeAttribute('style');\n }\n this.element.removeAttribute('aria-hidden');\n this.element.removeAttribute('data-choice');\n\n // Re-assign values - this is weird, I know\n this.element.value = this.element.value;\n }\n\n enable() {\n this.element.removeAttribute('disabled');\n this.element.disabled = false;\n this.isDisabled = false;\n }\n\n disable() {\n this.element.setAttribute('disabled', '');\n this.element.disabled = true;\n this.isDisabled = true;\n }\n\n triggerEvent(eventType, data) {\n dispatchEvent(this.element, eventType, data);\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// src/scripts/src/components/wrapped-element.js","import WrappedElement from './wrapped-element';\n\nexport default class WrappedInput extends WrappedElement {\n constructor(instance, element, classNames) {\n super(instance, element, classNames);\n this.parentInstance = instance;\n this.element = element;\n this.classNames = classNames;\n }\n\n getElement() {\n super.getElement();\n }\n\n conceal() {\n super.conceal();\n }\n\n reveal() {\n super.reveal();\n }\n\n enable() {\n super.enable();\n }\n\n disable() {\n super.enable();\n }\n\n setValue(value) {\n this.element.setAttribute('value', value);\n this.element.value = value;\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// src/scripts/src/components/wrapped-input.js","import WrappedElement from './wrapped-element';\n\nexport default class WrappedSelect extends WrappedElement {\n constructor(instance, element, classNames) {\n super(instance, element, classNames);\n this.parentInstance = instance;\n this.element = element;\n this.classNames = classNames;\n }\n\n getElement() {\n super.getElement();\n }\n\n conceal() {\n super.conceal();\n }\n\n reveal() {\n super.reveal();\n }\n\n enable() {\n super.enable();\n }\n\n disable() {\n super.enable();\n }\n\n setOptions(options) {\n this.element.innerHTML = '';\n this.element.appendChild(options);\n }\n\n getPlaceholderOption() {\n return this.element.querySelector('option[placeholder]');\n }\n\n getOptions() {\n return Array.from(this.element.options);\n }\n\n getOptionGroups() {\n return Array.from(this.element.getElementsByTagName('OPTGROUP'));\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// src/scripts/src/components/wrapped-select.js","\nexport const DEFAULT_CLASSNAMES = {\n containerOuter: 'choices',\n containerInner: 'choices__inner',\n input: 'choices__input',\n inputCloned: 'choices__input--cloned',\n list: 'choices__list',\n listItems: 'choices__list--multiple',\n listSingle: 'choices__list--single',\n listDropdown: 'choices__list--dropdown',\n item: 'choices__item',\n itemSelectable: 'choices__item--selectable',\n itemDisabled: 'choices__item--disabled',\n itemChoice: 'choices__item--choice',\n placeholder: 'choices__placeholder',\n group: 'choices__group',\n groupHeading: 'choices__heading',\n button: 'choices__button',\n activeState: 'is-active',\n focusState: 'is-focused',\n openState: 'is-open',\n disabledState: 'is-disabled',\n highlightedState: 'is-highlighted',\n hiddenState: 'is-hidden',\n flippedState: 'is-flipped',\n loadingState: 'is-loading',\n noResults: 'has-no-results',\n noChoices: 'has-no-choices',\n};\n\nexport const DEFAULT_CONFIG = {\n silent: false,\n renderChoiceLimit: -1,\n maxItemCount: -1,\n addItems: true,\n removeItems: true,\n removeItemButton: false,\n editItems: false,\n duplicateItems: true,\n delimiter: ',',\n paste: true,\n searchEnabled: true,\n searchChoices: true,\n searchFloor: 1,\n searchResultLimit: 4,\n searchFields: ['label', 'value'],\n position: 'auto',\n resetScrollPosition: true,\n regexFilter: null,\n shouldSort: true,\n shouldSortItems: false,\n placeholder: true,\n placeholderValue: null,\n searchPlaceholderValue: null,\n prependValue: null,\n appendValue: null,\n renderSelectedChoices: 'auto',\n loadingText: 'Loading...',\n noResultsText: 'No results found',\n noChoicesText: 'No choices to choose from',\n itemSelectText: 'Press to select',\n addItemText: value => `Press Enter to add \"${value}\" `,\n maxItemText: maxItemCount => `Only ${maxItemCount} values can be added.`,\n uniqueItemText: 'Only unique values can be added.',\n fuseOptions: {\n includeScore: true,\n },\n callbackOnInit: null,\n callbackOnCreateTemplates: null,\n};\n\nexport const EVENTS = {\n showDropdown: 'showDropdown',\n hideDropdown: 'hideDropdown',\n change: 'change',\n choice: 'choice',\n search: 'search',\n addItem: 'addItem',\n removeItem: 'removeItem',\n highlightItem: 'highlightItem',\n};\n\nexport const ACTION_TYPES = {\n ADD_CHOICE: 'ADD_CHOICE',\n FILTER_CHOICES: 'FILTER_CHOICES',\n ACTIVATE_CHOICES: 'ACTIVATE_CHOICES',\n CLEAR_CHOICES: 'CLEAR_CHOICES',\n ADD_GROUP: 'ADD_GROUP',\n ADD_ITEM: 'ADD_ITEM',\n REMOVE_ITEM: 'REMOVE_ITEM',\n HIGHLIGHT_ITEM: 'HIGHLIGHT_ITEM',\n CLEAR_ALL: 'CLEAR_ALL',\n};\n\nexport const KEY_CODES = {\n BACK_KEY: 46,\n DELETE_KEY: 8,\n ENTER_KEY: 13,\n A_KEY: 65,\n ESC_KEY: 27,\n UP_KEY: 38,\n DOWN_KEY: 40,\n PAGE_UP_KEY: 33,\n PAGE_DOWN_KEY: 34,\n};\n\nexport const SCROLLING_SPEED = 4;\n\n\n\n// WEBPACK FOOTER //\n// src/scripts/src/constants.js","import classNames from 'classnames';\nimport { strToEl } from './lib/utils';\n\nexport const TEMPLATES = {\n containerOuter(\n globalClasses,\n direction,\n isSelectElement,\n isSelectOneElement,\n searchEnabled,\n passedElementType,\n ) {\n const tabIndex = isSelectOneElement ? 'tabindex=\"0\"' : '';\n let role = isSelectElement ? 'role=\"listbox\"' : '';\n let ariaAutoComplete = '';\n\n if (isSelectElement && searchEnabled) {\n role = 'role=\"combobox\"';\n ariaAutoComplete = 'aria-autocomplete=\"list\"';\n }\n\n return strToEl(`\n \n
\n `);\n },\n containerInner(globalClasses) {\n return strToEl(`\n
\n `);\n },\n itemList(globalClasses, isSelectOneElement) {\n const localClasses = classNames(\n globalClasses.list, {\n [globalClasses.listSingle]: (isSelectOneElement),\n [globalClasses.listItems]: (!isSelectOneElement),\n },\n );\n\n return strToEl(`\n
\n `);\n },\n placeholder(globalClasses, value) {\n return strToEl(`\n \n ${value}\n
\n `);\n },\n item(globalClasses, data, removeItemButton) {\n const ariaSelected = data.active ? 'aria-selected=\"true\"' : '';\n const ariaDisabled = data.disabled ? 'aria-disabled=\"true\"' : '';\n\n let localClasses = classNames(\n globalClasses.item, {\n [globalClasses.highlightedState]: data.highlighted,\n [globalClasses.itemSelectable]: !data.highlighted,\n [globalClasses.placeholder]: data.placeholder,\n },\n );\n\n if (removeItemButton) {\n localClasses = classNames(\n globalClasses.item, {\n [globalClasses.highlightedState]: data.highlighted,\n [globalClasses.itemSelectable]: !data.disabled,\n [globalClasses.placeholder]: data.placeholder,\n },\n );\n\n return strToEl(`\n \n ${data.label}\n Remove item\n \n
\n `);\n }\n\n return strToEl(`\n \n ${data.label}\n
\n `);\n },\n choiceList(globalClasses, isSelectOneElement) {\n const ariaMultiSelectable = !isSelectOneElement ?\n 'aria-multiselectable=\"true\"' :\n '';\n\n return strToEl(`\n \n
\n `);\n },\n choiceGroup(globalClasses, data) {\n const ariaDisabled = data.disabled ? 'aria-disabled=\"true\"' : '';\n const localClasses = classNames(\n globalClasses.group, {\n [globalClasses.itemDisabled]: data.disabled,\n },\n );\n\n return strToEl(`\n \n `);\n },\n choice(globalClasses, data, itemSelectText) {\n const role = data.groupId > 0 ? 'role=\"treeitem\"' : 'role=\"option\"';\n const localClasses = classNames(\n globalClasses.item,\n globalClasses.itemChoice, {\n [globalClasses.itemDisabled]: data.disabled,\n [globalClasses.itemSelectable]: !data.disabled,\n [globalClasses.placeholder]: data.placeholder,\n },\n );\n\n return strToEl(`\n \n ${data.label}\n
\n `);\n },\n input(globalClasses) {\n const localClasses = classNames(\n globalClasses.input,\n globalClasses.inputCloned,\n );\n\n return strToEl(`\n \n `);\n },\n dropdown(globalClasses) {\n const localClasses = classNames(\n globalClasses.list,\n globalClasses.listDropdown,\n );\n\n return strToEl(`\n \n
\n `);\n },\n notice(globalClasses, label, type = '') {\n const localClasses = classNames(\n globalClasses.item,\n globalClasses.itemChoice, {\n [globalClasses.noResults]: (type === 'no-results'),\n [globalClasses.noChoices]: (type === 'no-choices'),\n },\n );\n\n return strToEl(`\n \n ${label}\n
\n `);\n },\n option(globalClasses, data) {\n return strToEl(`\n ${data.label} \n `);\n },\n};\n\nexport default TEMPLATES;\n\n\n\n// WEBPACK FOOTER //\n// src/scripts/src/templates.js","import { ACTION_TYPES } from './../constants';\n\nexport const addChoice = (\n value,\n label,\n id,\n groupId,\n disabled,\n elementId,\n customProperties,\n placeholder,\n keyCode,\n) => ({\n type: ACTION_TYPES.ADD_CHOICE,\n value,\n label,\n id,\n groupId,\n disabled,\n elementId,\n customProperties,\n placeholder,\n keyCode,\n});\n\nexport const filterChoices = results => ({\n type: ACTION_TYPES.FILTER_CHOICES,\n results,\n});\n\nexport const activateChoices = (active = true) => ({\n type: ACTION_TYPES.ACTIVATE_CHOICES,\n active,\n});\n\nexport const clearChoices = () => ({\n type: ACTION_TYPES.CLEAR_CHOICES,\n});\n\n\n\n// WEBPACK FOOTER //\n// src/scripts/src/actions/choices.js","import { ACTION_TYPES } from './../constants';\n\nexport const addItem = (\n value,\n label,\n id,\n choiceId,\n groupId,\n customProperties,\n placeholder,\n keyCode,\n) => ({\n type: ACTION_TYPES.ADD_ITEM,\n value,\n label,\n id,\n choiceId,\n groupId,\n customProperties,\n placeholder,\n keyCode,\n});\n\nexport const removeItem = (id, choiceId) => ({\n type: ACTION_TYPES.REMOVE_ITEM,\n id,\n choiceId,\n});\n\nexport const highlightItem = (id, highlighted) => ({\n type: ACTION_TYPES.HIGHLIGHT_ITEM,\n id,\n highlighted,\n});\n\n\n\n// WEBPACK FOOTER //\n// src/scripts/src/actions/items.js","import { ACTION_TYPES } from './../constants';\n\n/* eslint-disable import/prefer-default-export */\nexport const addGroup = (value, id, active, disabled) => ({\n type: ACTION_TYPES.ADD_GROUP,\n value,\n id,\n active,\n disabled,\n});\n\n\n\n// WEBPACK FOOTER //\n// src/scripts/src/actions/groups.js","/* eslint-disable import/prefer-default-export */\nexport const clearAll = () => ({\n type: 'CLEAR_ALL',\n});\n\n\n\n// WEBPACK FOOTER //\n// src/scripts/src/actions/misc.js","import Fuse from 'fuse.js';\nimport Store from './store/store';\nimport Dropdown from './components/dropdown';\nimport Container from './components/container';\nimport Input from './components/input';\nimport List from './components/list';\nimport WrappedInput from './components/wrapped-input';\nimport WrappedSelect from './components/wrapped-select';\nimport { DEFAULT_CONFIG, DEFAULT_CLASSNAMES, EVENTS, KEY_CODES, SCROLLING_SPEED } from './constants';\nimport { TEMPLATES } from './templates';\nimport { addChoice, filterChoices, activateChoices, clearChoices } from './actions/choices';\nimport { addItem, removeItem, highlightItem } from './actions/items';\nimport { addGroup } from './actions/groups';\nimport { clearAll } from './actions/misc';\nimport {\n isScrolledIntoView,\n getAdjacentEl,\n wrap,\n getType,\n isType,\n isElement,\n strToEl,\n extend,\n sortByAlpha,\n sortByScore,\n generateId,\n findAncestorByAttrName,\n regexFilter,\n} from './lib/utils';\nimport './lib/polyfills';\n\n/**\n * Choices\n */\nexport default class Choices {\n constructor(element = '[data-choice]', userConfig = {}) {\n // If there are multiple elements, create a new instance\n // for each element besides the first one (as that already has an instance)\n if (isType('String', element)) {\n const elements = document.querySelectorAll(element);\n if (elements.length > 1) {\n for (let i = 1; i < elements.length; i += 1) {\n const el = elements[i];\n /* eslint-disable no-new */\n new Choices(el, userConfig);\n }\n }\n }\n\n const defaultConfig = {\n ...DEFAULT_CONFIG,\n items: [],\n choices: [],\n classNames: DEFAULT_CLASSNAMES,\n sortFilter: sortByAlpha,\n };\n\n // Merge options with user options\n this.config = extend(defaultConfig, Choices.userDefaults, userConfig);\n\n if (!['auto', 'always'].includes(this.config.renderSelectedChoices)) {\n this.config.renderSelectedChoices = 'auto';\n }\n\n // Create data store\n this.store = new Store(this.render);\n\n // State tracking\n this.initialised = false;\n this.currentState = {};\n this.prevState = {};\n this.currentValue = '';\n\n // Retrieve triggering element (i.e. element with 'data-choice' trigger)\n const passedElement = isType('String', element) ? document.querySelector(element) : element;\n\n this.isTextElement = passedElement.type === 'text';\n this.isSelectOneElement = passedElement.type === 'select-one';\n this.isSelectMultipleElement = passedElement.type === 'select-multiple';\n this.isSelectElement = this.isSelectOneElement || this.isSelectMultipleElement;\n this.isValidElementType = this.isTextElement || this.isSelectElement;\n\n if (this.isTextElement) {\n this.passedElement = new WrappedInput(this, passedElement, this.config.classNames);\n } else if (this.isSelectElement) {\n this.passedElement = new WrappedSelect(this, passedElement, this.config.classNames);\n }\n\n if (!this.passedElement) {\n if (!this.config.silent) {\n console.error('Passed element not found');\n }\n return false;\n }\n\n this.isIe11 = !!(navigator.userAgent.match(/Trident/) && navigator.userAgent.match(/rv[ :]11/));\n this.isScrollingOnIe = false;\n\n if (this.config.shouldSortItems === true && this.isSelectOneElement) {\n if (!this.config.silent) {\n console.warn(\n 'shouldSortElements: Type of passed element is \\'select-one\\', falling back to false.',\n );\n }\n }\n\n this.highlightPosition = 0;\n this.canSearch = this.config.searchEnabled;\n\n this.placeholder = false;\n if (!this.isSelectOneElement) {\n this.placeholder = this.config.placeholder ?\n (this.config.placeholderValue || this.passedElement.element.getAttribute('placeholder')) :\n false;\n }\n\n // Assign preset choices from passed object\n this.presetChoices = this.config.choices;\n // Assign preset items from passed object first\n this.presetItems = this.config.items;\n\n // Then add any values passed from attribute\n if (this.passedElement.getValue()) {\n this.presetItems = this.presetItems.concat(\n this.passedElement.getValue().split(this.config.delimiter),\n );\n }\n\n // Set unique base Id\n this.baseId = generateId(this.passedElement.element, 'choices-');\n\n this.idNames = {\n itemChoice: 'item-choice',\n };\n\n // Bind methods\n this.render = this.render.bind(this);\n\n // Bind event handlers\n this._onFocus = this._onFocus.bind(this);\n this._onBlur = this._onBlur.bind(this);\n this._onKeyUp = this._onKeyUp.bind(this);\n this._onKeyDown = this._onKeyDown.bind(this);\n this._onClick = this._onClick.bind(this);\n this._onTouchMove = this._onTouchMove.bind(this);\n this._onTouchEnd = this._onTouchEnd.bind(this);\n this._onMouseDown = this._onMouseDown.bind(this);\n this._onMouseOver = this._onMouseOver.bind(this);\n\n // Monitor touch taps/scrolls\n this.wasTap = true;\n\n // Cutting the mustard\n const cuttingTheMustard = 'classList' in document.documentElement;\n if (!cuttingTheMustard && !this.config.silent) {\n console.error('Choices: Your browser doesn\\'t support Choices');\n }\n\n const canInit = isElement(this.passedElement.element) && this.isValidElementType;\n\n if (canInit) {\n // If element has already been initialised with Choices\n if (this.passedElement.element.getAttribute('data-choice') === 'active') {\n return false;\n }\n\n // Let's go\n this.init();\n } else if (!this.config.silent) {\n console.error('Incompatible input passed');\n }\n }\n\n /* ========================================\n = Public functions =\n ======================================== */\n\n /**\n * Initialise Choices\n * @return\n * @public\n */\n init() {\n if (this.initialised) {\n return;\n }\n\n // Set initialise flag\n this.initialised = true;\n // Create required elements\n this._createTemplates();\n // Generate input markup\n this._createStructure();\n // Subscribe store to render method\n this.store.subscribe(this.render);\n // Render any items\n this.render();\n // Trigger event listeners\n this._addEventListeners();\n\n const callback = this.config.callbackOnInit;\n // Run callback if it is a function\n if (callback && isType('Function', callback)) {\n callback.call(this);\n }\n }\n\n /**\n * Destroy Choices and nullify values\n * @return\n * @public\n */\n destroy() {\n if (!this.initialised) {\n return;\n }\n\n // Remove all event listeners\n this._removeEventListeners();\n this.passedElement.reveal();\n this.containerOuter.revert(this.passedElement.element);\n\n // Clear data store\n this.clearStore();\n\n // Nullify instance-specific data\n this.config.templates = null;\n\n // Uninitialise\n this.initialised = false;\n }\n\n /**\n * Enable interaction with Choices\n * @return {Object} Class instance\n */\n enable() {\n if (!this.initialised) {\n return this;\n }\n\n this.passedElement.enable();\n\n if (this.containerOuter.isDisabled) {\n this._addEventListeners();\n this.input.enable();\n this.containerOuter.enable();\n }\n\n return this;\n }\n\n /**\n * Disable interaction with Choices\n * @return {Object} Class instance\n * @public\n */\n disable() {\n if (!this.initialised) {\n return this;\n }\n\n this.passedElement.disable();\n\n if (!this.containerOuter.isDisabled) {\n this._removeEventListeners();\n this.input.disable();\n this.containerOuter.disable();\n }\n\n return this;\n }\n\n /**\n * Render group choices into a DOM fragment and append to choice list\n * @param {Array} groups Groups to add to list\n * @param {Array} choices Choices to add to groups\n * @param {DocumentFragment} fragment Fragment to add groups and options to (optional)\n * @return {DocumentFragment} Populated options fragment\n * @private\n */\n renderGroups(groups, choices, fragment) {\n const groupFragment = fragment || document.createDocumentFragment();\n const filter = this.config.sortFilter;\n const getGroupChoices = group => choices.filter((choice) => {\n if (this.isSelectOneElement) {\n return choice.groupId === group.id;\n }\n return choice.groupId === group.id && (this.config.renderSelectedChoices === 'always' || !choice.selected);\n });\n\n // If sorting is enabled, filter groups\n if (this.config.shouldSort) {\n groups.sort(filter);\n }\n\n groups.forEach((group) => {\n const groupChoices = getGroupChoices(group);\n\n if (groupChoices.length >= 1) {\n const dropdownGroup = this._getTemplate('choiceGroup', group);\n groupFragment.appendChild(dropdownGroup);\n this.renderChoices(groupChoices, groupFragment, true);\n }\n });\n\n return groupFragment;\n }\n\n /**\n * Render choices into a DOM fragment and append to choice list\n * @param {Array} choices Choices to add to list\n * @param {DocumentFragment} fragment Fragment to add choices to (optional)\n * @return {DocumentFragment} Populated choices fragment\n * @private\n */\n renderChoices(choices, fragment, withinGroup = false) {\n // Create a fragment to store our list items (so we don't have to update the DOM for each item)\n const choicesFragment = fragment || document.createDocumentFragment();\n const { renderSelectedChoices, searchResultLimit, renderChoiceLimit } = this.config;\n const filter = this.isSearching ? sortByScore : this.config.sortFilter;\n const appendChoice = (choice) => {\n const shouldRender = renderSelectedChoices === 'auto' ?\n (this.isSelectOneElement || !choice.selected) :\n true;\n if (shouldRender) {\n const dropdownItem = this._getTemplate('choice', choice, this.config.itemSelectText);\n choicesFragment.appendChild(dropdownItem);\n }\n };\n\n let rendererableChoices = choices;\n\n if (renderSelectedChoices === 'auto' && !this.isSelectOneElement) {\n rendererableChoices = choices.filter(choice => !choice.selected);\n }\n\n // Split array into placeholders and \"normal\" choices\n const { placeholderChoices, normalChoices } = rendererableChoices.reduce((acc, choice) => {\n if (choice.placeholder) {\n acc.placeholderChoices.push(choice);\n } else {\n acc.normalChoices.push(choice);\n }\n return acc;\n }, { placeholderChoices: [], normalChoices: [] });\n\n // If sorting is enabled or the user is searching, filter choices\n if (this.config.shouldSort || this.isSearching) {\n normalChoices.sort(filter);\n }\n\n let choiceLimit = rendererableChoices.length;\n\n // Prepend placeholeder\n const sortedChoices = [...placeholderChoices, ...normalChoices];\n\n if (this.isSearching) {\n choiceLimit = searchResultLimit;\n } else if (renderChoiceLimit > 0 && !withinGroup) {\n choiceLimit = renderChoiceLimit;\n }\n\n // Add each choice to dropdown within range\n for (let i = 0; i < choiceLimit; i += 1) {\n if (sortedChoices[i]) {\n appendChoice(sortedChoices[i]);\n }\n }\n\n return choicesFragment;\n }\n\n /**\n * Render items into a DOM fragment and append to items list\n * @param {Array} items Items to add to list\n * @param {DocumentFragment} [fragment] Fragment to add items to (optional)\n * @return\n * @private\n */\n renderItems(items, fragment = null) {\n // Create fragment to add elements to\n const itemListFragment = fragment || document.createDocumentFragment();\n\n // If sorting is enabled, filter items\n if (this.config.shouldSortItems && !this.isSelectOneElement) {\n items.sort(this.config.sortFilter);\n }\n\n if (this.isTextElement) {\n // Simplify store data to just values\n const itemsFiltered = this.store.getItemsReducedToValues(items);\n const itemsFilteredString = itemsFiltered.join(this.config.delimiter);\n\n // Update the value of the hidden input\n this.passedElement.setValue(itemsFilteredString);\n } else {\n const selectedOptionsFragment = document.createDocumentFragment();\n const addOptionToFragment = (item) => {\n // Create a standard select option\n const option = this._getTemplate('option', item);\n // Append it to fragment\n selectedOptionsFragment.appendChild(option);\n };\n\n // Add each list item to list\n items.forEach(item => addOptionToFragment(item));\n // Update the options of the hidden input\n this.passedElement.setOptions(selectedOptionsFragment);\n }\n\n const addItemToFragment = (item) => {\n // Create new list element\n const listItem = this._getTemplate('item', item, this.config.removeItemButton);\n // Append it to list\n itemListFragment.appendChild(listItem);\n };\n\n // Add each list item to list\n items.forEach(item => addItemToFragment(item));\n\n return itemListFragment;\n }\n\n /**\n * Render DOM with values\n * @return\n * @private\n */\n render() {\n this.currentState = this.store.getState();\n const stateChanged = (\n this.currentState.choices !== this.prevState.choices ||\n this.currentState.groups !== this.prevState.groups ||\n this.currentState.items !== this.prevState.items\n );\n\n if (!stateChanged) {\n return;\n }\n\n /* Choices */\n\n if (this.isSelectElement) {\n // Get active groups/choices\n const activeGroups = this.store.getGroupsFilteredByActive();\n const activeChoices = this.store.getChoicesFilteredByActive();\n\n let choiceListFragment = document.createDocumentFragment();\n\n // Clear choices\n this.choiceList.clear();\n\n // Scroll back to top of choices list\n if (this.config.resetScrollPosition) {\n this.choiceList.scrollTo(0);\n }\n\n // If we have grouped options\n if (activeGroups.length >= 1 && !this.isSearching) {\n // If we have a placeholder choice along with groups\n const activePlaceholders = activeChoices.filter(\n activeChoice => activeChoice.placeholder === true && activeChoice.groupId === -1,\n );\n if (activePlaceholders.length >= 1) {\n choiceListFragment = this.renderChoices(activePlaceholders, choiceListFragment);\n }\n choiceListFragment = this.renderGroups(activeGroups, activeChoices, choiceListFragment);\n } else if (activeChoices.length >= 1) {\n choiceListFragment = this.renderChoices(activeChoices, choiceListFragment);\n }\n\n const activeItems = this.store.getItemsFilteredByActive();\n const canAddItem = this._canAddItem(activeItems, this.input.getValue());\n\n // If we have choices to show\n if (choiceListFragment.childNodes && choiceListFragment.childNodes.length > 0) {\n // ...and we can select them\n if (canAddItem.response) {\n // ...append them and highlight the first choice\n this.choiceList.append(choiceListFragment);\n this._highlightChoice();\n } else {\n // ...otherwise show a notice\n this.choiceList.append(this._getTemplate('notice', canAddItem.notice));\n }\n } else {\n // Otherwise show a notice\n let dropdownItem;\n let notice;\n\n if (this.isSearching) {\n notice = isType('Function', this.config.noResultsText) ?\n this.config.noResultsText() :\n this.config.noResultsText;\n\n dropdownItem = this._getTemplate('notice', notice, 'no-results');\n } else {\n notice = isType('Function', this.config.noChoicesText) ?\n this.config.noChoicesText() :\n this.config.noChoicesText;\n\n dropdownItem = this._getTemplate('notice', notice, 'no-choices');\n }\n\n this.choiceList.append(dropdownItem);\n }\n }\n\n /* Items */\n\n // Get active items (items that can be selected)\n const activeItems = this.store.getItemsFilteredByActive() || [];\n // Clear list\n this.itemList.clear();\n\n if (activeItems.length) {\n // Create a fragment to store our list items\n // (so we don't have to update the DOM for each item)\n const itemListFragment = this.renderItems(activeItems);\n\n // If we have items to add\n if (itemListFragment.childNodes) {\n // Update list\n this.itemList.append(itemListFragment);\n }\n }\n\n this.prevState = this.currentState;\n }\n\n /**\n * Select item (a selected item can be deleted)\n * @param {Element} item Element to select\n * @param {Boolean} [runEvent=true] Whether to trigger 'highlightItem' event\n * @return {Object} Class instance\n * @public\n */\n highlightItem(item, runEvent = true) {\n if (!item) {\n return this;\n }\n\n const { id, groupId = -1, value = '', label = '' } = item;\n const group = groupId >= 0 ? this.store.getGroupById(groupId) : null;\n\n this.store.dispatch(highlightItem(id, true));\n\n if (runEvent) {\n this.passedElement.triggerEvent(EVENTS.highlightItem, {\n id,\n value,\n label,\n groupValue: group && group.value ? group.value : null,\n });\n }\n\n return this;\n }\n\n /**\n * Deselect item\n * @param {Element} item Element to de-select\n * @return {Object} Class instance\n * @public\n */\n unhighlightItem(item) {\n if (!item) {\n return this;\n }\n\n const { id, groupId = -1, value = '', label = '' } = item;\n const group = groupId >= 0 ? this.store.getGroupById(groupId) : null;\n\n this.store.dispatch(highlightItem(id, false));\n this.passedElement.triggerEvent(EVENTS.highlightItem, {\n id,\n value,\n label,\n groupValue: group && group.value ? group.value : null,\n });\n\n return this;\n }\n\n /**\n * Highlight items within store\n * @return {Object} Class instance\n * @public\n */\n highlightAll() {\n const items = this.store.getItems();\n items.forEach(item => this.highlightItem(item));\n return this;\n }\n\n /**\n * Deselect items within store\n * @return {Object} Class instance\n * @public\n */\n unhighlightAll() {\n const items = this.store.getItems();\n items.forEach(item => this.unhighlightItem(item));\n return this;\n }\n\n /**\n * Remove an item from the store by its value\n * @param {String} value Value to search for\n * @return {Object} Class instance\n * @public\n */\n removeItemsByValue(value) {\n if (!value || !isType('String', value)) {\n return this;\n }\n\n const items = this.store.getItemsFilteredByActive();\n\n items.forEach((item) => {\n if (item.value === value) {\n this._removeItem(item);\n }\n });\n\n return this;\n }\n\n /**\n * Remove all items from store array\n * @note Removed items are soft deleted\n * @param {Number} excludedId Optionally exclude item by ID\n * @return {Object} Class instance\n * @public\n */\n removeActiveItems(excludedId) {\n const items = this.store.getItemsFilteredByActive();\n\n items.forEach((item) => {\n if (item.active && excludedId !== item.id) {\n this._removeItem(item);\n }\n });\n\n return this;\n }\n\n /**\n * Remove all selected items from store\n * @note Removed items are soft deleted\n * @return {Object} Class instance\n * @public\n */\n removeHighlightedItems(runEvent = false) {\n const items = this.store.getItemsFilteredByActive();\n\n items.forEach((item) => {\n if (item.highlighted && item.active) {\n this._removeItem(item);\n // If this action was performed by the user\n // trigger the event\n if (runEvent) {\n this._triggerChange(item.value);\n }\n }\n });\n\n return this;\n }\n\n /**\n * Show dropdown to user by adding active state class\n * @return {Object} Class instance\n * @public\n */\n showDropdown(focusInput = false) {\n if (this.dropdown.isActive) {\n return this;\n }\n\n this.containerOuter.open(this.dropdown.getVerticalPos());\n this.dropdown.show();\n this.input.activate(focusInput);\n this.passedElement.triggerEvent(EVENTS.showDropdown, {});\n\n return this;\n }\n\n /**\n * Hide dropdown from user\n * @return {Object} Class instance\n * @public\n */\n hideDropdown(blurInput = false) {\n if (!this.dropdown.isActive) {\n return this;\n }\n\n this.containerOuter.close();\n this.dropdown.hide();\n this.input.deactivate(blurInput);\n this.passedElement.triggerEvent(EVENTS.hideDropdown, {});\n\n return this;\n }\n\n /**\n * Determine whether to hide or show dropdown based on its current state\n * @return {Object} Class instance\n * @public\n */\n toggleDropdown() {\n if (this.dropdown.isActive) {\n this.hideDropdown();\n } else {\n this.showDropdown(true);\n }\n\n return this;\n }\n\n /**\n * Get value(s) of input (i.e. inputted items (text) or selected choices (select))\n * @param {Boolean} valueOnly Get only values of selected items, otherwise return selected items\n * @return {Array/String} selected value (select-one) or\n * array of selected items (inputs & select-multiple)\n * @public\n */\n getValue(valueOnly = false) {\n const items = this.store.getItemsFilteredByActive();\n\n const values = items.reduce((selectedItems, item) => {\n const itemValue = valueOnly ? item.value : item;\n selectedItems.push(itemValue);\n return selectedItems;\n }, []);\n\n return this.isSelectOneElement ? values[0] : values;\n }\n\n /**\n * Set value of input. If the input is a select box, a choice will\n * be created and selected otherwise an item will created directly.\n * @param {Array} args Array of value objects or value strings\n * @return {Object} Class instance\n * @public\n */\n setValue(args) {\n if (!this.initialised) {\n return this;\n }\n\n // Convert args to an iterable array\n const values = [...args];\n values.forEach(value => this._setChoiceOrItem(value));\n\n return this;\n }\n\n /**\n * Select value of select box via the value of an existing choice\n * @param {Array/String} value An array of strings of a single string\n * @return {Object} Class instance\n * @public\n */\n setChoiceByValue(value) {\n if (this.isTextElement || !this.initialised) {\n return this;\n }\n\n // If only one value has been passed, convert to array\n const choiceValue = isType('Array', value) ? value : [value];\n\n // Loop through each value and\n choiceValue.forEach(val => this._findAndSelectChoiceByValue(val));\n\n return this;\n }\n\n /**\n * Direct populate choices\n * @param {Array} choices - Choices to insert\n * @param {String} value - Name of 'value' property\n * @param {String} label - Name of 'label' property\n * @param {Boolean} replaceChoices Whether existing choices should be removed\n * @return {Object} Class instance\n * @public\n */\n setChoices(choices = [], value = '', label = '', replaceChoices = false) {\n if (\n !this.initialised ||\n !this.isSelectElement ||\n !isType('Array', choices) ||\n !value\n ) {\n return this;\n }\n\n // Clear choices if needed\n if (replaceChoices) {\n this._clearChoices();\n }\n\n // Add choices if passed\n if (choices.length) {\n this.containerOuter.removeLoadingState();\n const addGroupsAndChoices = (groupOrChoice) => {\n if (groupOrChoice.choices) {\n this._addGroup(\n groupOrChoice,\n (groupOrChoice.id || null),\n value,\n label,\n );\n } else {\n this._addChoice(\n groupOrChoice[value],\n groupOrChoice[label],\n groupOrChoice.selected,\n groupOrChoice.disabled,\n undefined,\n groupOrChoice.customProperties,\n groupOrChoice.placeholder,\n );\n }\n };\n\n choices.forEach(addGroupsAndChoices);\n }\n\n return this;\n }\n\n /**\n * Clear items,choices and groups\n * @note Hard delete\n * @return {Object} Class instance\n * @public\n */\n clearStore() {\n this.store.dispatch(clearAll());\n return this;\n }\n\n /**\n * Set value of input to blank\n * @return {Object} Class instance\n * @public\n */\n clearInput() {\n const shouldSetInputWidth = !this.isSelectOneElement;\n this.input.clear(shouldSetInputWidth);\n\n if (!this.isTextElement && this.config.searchEnabled) {\n this.isSearching = false;\n this.store.dispatch(activateChoices(true));\n }\n\n return this;\n }\n\n /**\n * Populate options via ajax callback\n * @param {Function} fn Function that actually makes an AJAX request\n * @return {Object} Class instance\n * @public\n */\n ajax(fn) {\n if (!this.initialised || !this.isSelectElement || !fn) {\n return this;\n }\n\n requestAnimationFrame(() => this._handleLoadingState(true));\n fn(this._ajaxCallback());\n\n return this;\n }\n\n /* ===== End of Public functions ====== */\n\n /* =============================================\n = Private functions =\n ============================================= */\n\n /**\n * Call change callback\n * @param {String} value - last added/deleted/selected value\n * @return\n * @private\n */\n _triggerChange(value) {\n if (!value) {\n return;\n }\n\n this.passedElement.triggerEvent(EVENTS.change, {\n value,\n });\n }\n\n /**\n * Select placeholder choice\n */\n _selectPlaceholderChoice() {\n const placeholderChoice = this.store.getPlaceholderChoice();\n\n if (placeholderChoice) {\n this._addItem(\n placeholderChoice.value,\n placeholderChoice.label,\n placeholderChoice.id,\n placeholderChoice.groupId,\n null,\n placeholderChoice.placeholder,\n );\n this._triggerChange(placeholderChoice.value);\n }\n }\n\n\n /**\n * Process enter/click of an item button\n * @param {Array} activeItems The currently active items\n * @param {Element} element Button being interacted with\n * @return\n * @private\n */\n _handleButtonAction(activeItems, element) {\n if (\n !activeItems ||\n !element ||\n !this.config.removeItems ||\n !this.config.removeItemButton\n ) {\n return;\n }\n\n const itemId = element.parentNode.getAttribute('data-id');\n const itemToRemove = activeItems.find(item => item.id === parseInt(itemId, 10));\n\n // Remove item associated with button\n this._removeItem(itemToRemove);\n this._triggerChange(itemToRemove.value);\n\n if (this.isSelectOneElement) {\n this._selectPlaceholderChoice();\n }\n }\n\n /**\n * Process click of an item\n * @param {Array} activeItems The currently active items\n * @param {Element} element Item being interacted with\n * @param {Boolean} hasShiftKey Whether the user has the shift key active\n * @return\n * @private\n */\n _handleItemAction(activeItems, element, hasShiftKey = false) {\n if (\n !activeItems ||\n !element ||\n !this.config.removeItems ||\n this.isSelectOneElement\n ) {\n return;\n }\n\n const passedId = element.getAttribute('data-id');\n\n // We only want to select one item with a click\n // so we deselect any items that aren't the target\n // unless shift is being pressed\n activeItems.forEach((item) => {\n if (item.id === parseInt(passedId, 10) && !item.highlighted) {\n this.highlightItem(item);\n } else if (!hasShiftKey && item.highlighted) {\n this.unhighlightItem(item);\n }\n });\n\n // Focus input as without focus, a user cannot do anything with a\n // highlighted item\n this.input.focus();\n }\n\n /**\n * Process click of a choice\n * @param {Array} activeItems The currently active items\n * @param {Element} element Choice being interacted with\n * @return\n */\n _handleChoiceAction(activeItems, element) {\n if (!activeItems || !element) {\n return;\n }\n\n // If we are clicking on an option\n const id = element.getAttribute('data-id');\n const choice = this.store.getChoiceById(id);\n const passedKeyCode = activeItems[0] && activeItems[0].keyCode ? activeItems[0].keyCode : null;\n const hasActiveDropdown = this.dropdown.isActive;\n\n // Update choice keyCode\n choice.keyCode = passedKeyCode;\n\n this.passedElement.triggerEvent(EVENTS.choice, {\n choice,\n });\n\n if (choice && !choice.selected && !choice.disabled) {\n const canAddItem = this._canAddItem(activeItems, choice.value);\n\n if (canAddItem.response) {\n this._addItem(\n choice.value,\n choice.label,\n choice.id,\n choice.groupId,\n choice.customProperties,\n choice.placeholder,\n choice.keyCode,\n );\n this._triggerChange(choice.value);\n }\n }\n\n this.clearInput();\n\n // We wont to close the dropdown if we are dealing with a single select box\n if (hasActiveDropdown && this.isSelectOneElement) {\n this.hideDropdown();\n this.containerOuter.focus();\n }\n }\n\n /**\n * Process back space event\n * @param {Array} activeItems items\n * @return\n * @private\n */\n _handleBackspace(activeItems) {\n if (!this.config.removeItems || !activeItems) {\n return;\n }\n\n const lastItem = activeItems[activeItems.length - 1];\n const hasHighlightedItems = activeItems.some(item => item.highlighted);\n\n // If editing the last item is allowed and there are not other selected items,\n // we can edit the item value. Otherwise if we can remove items, remove all selected items\n if (this.config.editItems && !hasHighlightedItems && lastItem) {\n this.input.setValue(lastItem.value);\n this.input.setWidth();\n this._removeItem(lastItem);\n this._triggerChange(lastItem.value);\n } else {\n if (!hasHighlightedItems) {\n // Highlight last item if none already highlighted\n this.highlightItem(lastItem, false);\n }\n this.removeHighlightedItems(true);\n }\n }\n\n /**\n * Apply or remove a loading state to the component.\n * @param {Boolean} isLoading default value set to 'true'.\n * @return\n * @private\n */\n _handleLoadingState(isLoading = true) {\n let placeholderItem = this.itemList.getChild(`.${this.config.classNames.placeholder}`);\n if (isLoading) {\n this.containerOuter.addLoadingState();\n if (this.isSelectOneElement) {\n if (!placeholderItem) {\n placeholderItem = this._getTemplate('placeholder', this.config.loadingText);\n this.itemList.append(placeholderItem);\n } else {\n placeholderItem.innerHTML = this.config.loadingText;\n }\n } else {\n this.input.setPlaceholder(this.config.loadingText);\n }\n } else {\n this.containerOuter.removeLoadingState();\n\n if (this.isSelectOneElement) {\n placeholderItem.innerHTML = (this.placeholder || '');\n } else {\n this.input.setPlaceholder(this.placeholder || '');\n }\n }\n }\n\n\n /**\n * Validates whether an item can be added by a user\n * @param {Array} activeItems The currently active items\n * @param {String} value Value of item to add\n * @return {Object} Response: Whether user can add item\n * Notice: Notice show in dropdown\n */\n _canAddItem(activeItems, value) {\n let canAddItem = true;\n let notice = isType('Function', this.config.addItemText) ?\n this.config.addItemText(value) :\n this.config.addItemText;\n\n if (this.isSelectMultipleElement || this.isTextElement) {\n if (this.config.maxItemCount > 0 && this.config.maxItemCount <= activeItems.length) {\n // If there is a max entry limit and we have reached that limit\n // don't update\n canAddItem = false;\n notice = isType('Function', this.config.maxItemText) ?\n this.config.maxItemText(this.config.maxItemCount) :\n this.config.maxItemText;\n }\n }\n\n if (this.isTextElement && this.config.addItems && canAddItem && this.config.regexFilter) {\n // If a user has supplied a regular expression filter\n // determine whether we can update based on whether\n // our regular expression passes\n canAddItem = regexFilter(value, this.config.regexFilter);\n }\n\n // If no duplicates are allowed, and the value already exists\n // in the array\n const isUnique = !activeItems.some((item) => {\n if (isType('String', value)) {\n return item.value === value.trim();\n }\n\n return item.value === value;\n });\n\n if (!isUnique &&\n !this.config.duplicateItems &&\n !this.isSelectOneElement &&\n canAddItem\n ) {\n canAddItem = false;\n notice = isType('Function', this.config.uniqueItemText) ?\n this.config.uniqueItemText(value) :\n this.config.uniqueItemText;\n }\n\n return {\n response: canAddItem,\n notice,\n };\n }\n\n /**\n * Retrieve the callback used to populate component's choices in an async way.\n * @returns {Function} The callback as a function.\n * @private\n */\n _ajaxCallback() {\n return (results, value, label) => {\n if (!results || !value) {\n return;\n }\n\n const parsedResults = isType('Object', results) ? [results] : results;\n\n if (parsedResults && isType('Array', parsedResults) && parsedResults.length) {\n // Remove loading states/text\n this._handleLoadingState(false);\n // Add each result as a choice\n parsedResults.forEach((result) => {\n if (result.choices) {\n const groupId = (result.id || null);\n this._addGroup(\n result,\n groupId,\n value,\n label,\n );\n } else {\n this._addChoice(\n result[value],\n result[label],\n result.selected,\n result.disabled,\n undefined,\n result.customProperties,\n result.placeholder,\n );\n }\n });\n\n if (this.isSelectOneElement) {\n this._selectPlaceholderChoice();\n }\n } else {\n // No results, remove loading state\n this._handleLoadingState(false);\n }\n };\n }\n\n /**\n * Filter choices based on search value\n * @param {String} value Value to filter by\n * @return\n * @private\n */\n _searchChoices(value) {\n const newValue = isType('String', value) ? value.trim() : value;\n const currentValue = isType('String', this.currentValue) ?\n this.currentValue.trim() :\n this.currentValue;\n\n if (newValue.length < 1 && newValue === `${currentValue} `) {\n return 0;\n }\n\n // If new value matches the desired length and is not the same as the current value with a space\n const haystack = this.store.getSearchableChoices();\n const needle = newValue;\n const keys = isType('Array', this.config.searchFields) ?\n this.config.searchFields :\n [this.config.searchFields];\n const options = Object.assign(this.config.fuseOptions, { keys });\n const fuse = new Fuse(haystack, options);\n const results = fuse.search(needle);\n\n this.currentValue = newValue;\n this.highlightPosition = 0;\n this.isSearching = true;\n this.store.dispatch(filterChoices(results));\n\n return results.length;\n }\n\n /**\n * Determine the action when a user is searching\n * @param {String} value Value entered by user\n * @return\n * @private\n */\n _handleSearch(value) {\n if (!value || !this.input.isFocussed) {\n return;\n }\n\n const choices = this.store.getChoices();\n const hasUnactiveChoices = choices.some(option => !option.active);\n\n // Check that we have a value to search and the input was an alphanumeric character\n if (value && value.length >= this.config.searchFloor) {\n const resultCount = this.config.searchChoices ? this._searchChoices(value) : 0;\n // Trigger search event\n this.passedElement.triggerEvent(EVENTS.search, {\n value,\n resultCount,\n });\n } else if (hasUnactiveChoices) {\n // Otherwise reset choices to active\n this.isSearching = false;\n this.store.dispatch(activateChoices(true));\n }\n }\n\n /**\n * Trigger event listeners\n * @return\n * @private\n */\n _addEventListeners() {\n document.addEventListener('keyup', this._onKeyUp);\n document.addEventListener('keydown', this._onKeyDown);\n document.addEventListener('click', this._onClick);\n document.addEventListener('touchmove', this._onTouchMove);\n document.addEventListener('touchend', this._onTouchEnd);\n document.addEventListener('mousedown', this._onMouseDown);\n document.addEventListener('mouseover', this._onMouseOver);\n\n if (this.isSelectOneElement) {\n this.containerOuter.element.addEventListener('focus', this._onFocus);\n this.containerOuter.element.addEventListener('blur', this._onBlur);\n }\n\n this.input.element.addEventListener('focus', this._onFocus);\n this.input.element.addEventListener('blur', this._onBlur);\n\n this.input.addEventListeners();\n }\n\n /**\n * Remove event listeners\n * @return\n * @private\n */\n _removeEventListeners() {\n document.removeEventListener('keyup', this._onKeyUp);\n document.removeEventListener('keydown', this._onKeyDown);\n document.removeEventListener('click', this._onClick);\n document.removeEventListener('touchmove', this._onTouchMove);\n document.removeEventListener('touchend', this._onTouchEnd);\n document.removeEventListener('mousedown', this._onMouseDown);\n document.removeEventListener('mouseover', this._onMouseOver);\n\n if (this.isSelectOneElement) {\n this.containerOuter.element.removeEventListener('focus', this._onFocus);\n this.containerOuter.element.removeEventListener('blur', this._onBlur);\n }\n\n this.input.element.removeEventListener('focus', this._onFocus);\n this.input.element.removeEventListener('blur', this._onBlur);\n\n this.input.removeEventListeners();\n }\n\n /**\n * Key down event\n * @param {Object} e Event\n * @return\n */\n _onKeyDown(e) {\n if (e.target !== this.input.element && !this.containerOuter.element.contains(e.target)) {\n return;\n }\n\n const target = e.target;\n const activeItems = this.store.getItemsFilteredByActive();\n const hasFocusedInput = this.input.isFocussed;\n const hasActiveDropdown = this.dropdown.isActive;\n const hasItems = this.itemList.hasChildren;\n const keyString = String.fromCharCode(e.keyCode);\n const backKey = KEY_CODES.BACK_KEY;\n const deleteKey = KEY_CODES.DELETE_KEY;\n const enterKey = KEY_CODES.ENTER_KEY;\n const aKey = KEY_CODES.A_KEY;\n const escapeKey = KEY_CODES.ESC_KEY;\n const upKey = KEY_CODES.UP_KEY;\n const downKey = KEY_CODES.DOWN_KEY;\n const pageUpKey = KEY_CODES.PAGE_UP_KEY;\n const pageDownKey = KEY_CODES.PAGE_DOWN_KEY;\n const ctrlDownKey = (e.ctrlKey || e.metaKey);\n\n // If a user is typing and the dropdown is not active\n if (!this.isTextElement && /[a-zA-Z0-9-_ ]/.test(keyString)) {\n this.showDropdown(true);\n }\n\n this.canSearch = this.config.searchEnabled;\n\n const onAKey = () => {\n // If CTRL + A or CMD + A have been pressed and there are items to select\n if (ctrlDownKey && hasItems) {\n this.canSearch = false;\n if (\n this.config.removeItems &&\n !this.input.getValue() &&\n this.input.element === document.activeElement\n ) {\n // Highlight items\n this.highlightAll();\n }\n }\n };\n\n const onEnterKey = () => {\n // If enter key is pressed and the input has a value\n if (this.isTextElement && target.value) {\n const value = this.input.getValue();\n const canAddItem = this._canAddItem(activeItems, value);\n\n // All is good, add\n if (canAddItem.response) {\n this.hideDropdown();\n this._addItem(value);\n this._triggerChange(value);\n this.clearInput();\n }\n }\n\n if (target.hasAttribute('data-button')) {\n this._handleButtonAction(activeItems, target);\n e.preventDefault();\n }\n\n if (hasActiveDropdown) {\n e.preventDefault();\n const highlighted = this.dropdown.getChild(`.${this.config.classNames.highlightedState}`);\n\n // If we have a highlighted choice\n if (highlighted) {\n // add enter keyCode value\n if (activeItems[0]) {\n activeItems[0].keyCode = enterKey;\n }\n this._handleChoiceAction(activeItems, highlighted);\n }\n } else if (this.isSelectOneElement) {\n // Open single select dropdown if it's not active\n this.showDropdown(true);\n e.preventDefault();\n }\n };\n\n const onEscapeKey = () => {\n if (hasActiveDropdown) {\n this.hideDropdown();\n this.containerOuter.focus();\n }\n };\n\n const onDirectionKey = () => {\n // If up or down key is pressed, traverse through options\n if (hasActiveDropdown || this.isSelectOneElement) {\n // Show dropdown if focus\n this.showDropdown(true);\n\n this.canSearch = false;\n\n const directionInt = e.keyCode === downKey || e.keyCode === pageDownKey ? 1 : -1;\n const skipKey = e.metaKey || e.keyCode === pageDownKey || e.keyCode === pageUpKey;\n\n let nextEl;\n if (skipKey) {\n if (directionInt > 0) {\n nextEl = Array.from(\n this.dropdown.element.querySelectorAll('[data-choice-selectable]'),\n ).pop();\n } else {\n nextEl = this.dropdown.element.querySelector('[data-choice-selectable]');\n }\n } else {\n const currentEl = this.dropdown.element.querySelector(\n `.${this.config.classNames.highlightedState}`,\n );\n if (currentEl) {\n nextEl = getAdjacentEl(currentEl, '[data-choice-selectable]', directionInt);\n } else {\n nextEl = this.dropdown.element.querySelector('[data-choice-selectable]');\n }\n }\n\n if (nextEl) {\n // We prevent default to stop the cursor moving\n // when pressing the arrow\n if (!isScrolledIntoView(nextEl, this.choiceList, directionInt)) {\n this._scrollToChoice(nextEl, directionInt);\n }\n this._highlightChoice(nextEl);\n }\n\n // Prevent default to maintain cursor position whilst\n // traversing dropdown options\n e.preventDefault();\n }\n };\n\n const onDeleteKey = () => {\n // If backspace or delete key is pressed and the input has no value\n if (hasFocusedInput && !e.target.value && !this.isSelectOneElement) {\n this._handleBackspace(activeItems);\n e.preventDefault();\n }\n };\n\n // Map keys to key actions\n const keyDownActions = {\n [aKey]: onAKey,\n [enterKey]: onEnterKey,\n [escapeKey]: onEscapeKey,\n [upKey]: onDirectionKey,\n [pageUpKey]: onDirectionKey,\n [downKey]: onDirectionKey,\n [pageDownKey]: onDirectionKey,\n [deleteKey]: onDeleteKey,\n [backKey]: onDeleteKey,\n };\n\n // If keycode has a function, run it\n if (keyDownActions[e.keyCode]) {\n keyDownActions[e.keyCode]();\n }\n }\n\n /**\n * Key up event\n * @param {Object} e Event\n * @return\n * @private\n */\n _onKeyUp(e) {\n if (e.target !== this.input.element) {\n return;\n }\n\n const value = this.input.getValue();\n const activeItems = this.store.getItemsFilteredByActive();\n const canAddItem = this._canAddItem(activeItems, value);\n\n // We are typing into a text input and have a value, we want to show a dropdown\n // notice. Otherwise hide the dropdown\n if (this.isTextElement) {\n if (value) {\n if (canAddItem.notice) {\n const dropdownItem = this._getTemplate('notice', canAddItem.notice);\n this.dropdown.element.innerHTML = dropdownItem.outerHTML;\n }\n\n if (canAddItem.response === true) {\n this.showDropdown();\n } else if (!canAddItem.notice) {\n this.hideDropdown();\n }\n } else {\n this.hideDropdown();\n }\n } else {\n const backKey = KEY_CODES.BACK_KEY;\n const deleteKey = KEY_CODES.DELETE_KEY;\n\n // If user has removed value...\n if ((e.keyCode === backKey || e.keyCode === deleteKey) && !e.target.value) {\n // ...and it is a multiple select input, activate choices (if searching)\n if (!this.isTextElement && this.isSearching) {\n this.isSearching = false;\n this.store.dispatch(activateChoices(true));\n }\n } else if (this.canSearch && canAddItem.response) {\n this._handleSearch(this.input.getValue());\n }\n }\n // Re-establish canSearch value from changes in _onKeyDown\n this.canSearch = this.config.searchEnabled;\n }\n\n /**\n * Touch move event\n * @return\n * @private\n */\n _onTouchMove() {\n if (this.wasTap === true) {\n this.wasTap = false;\n }\n }\n\n /**\n * Touch end event\n * @param {Object} e Event\n * @return\n * @private\n */\n _onTouchEnd(e) {\n const target = (e.target || e.touches[0].target);\n\n // If a user tapped within our container...\n if (this.wasTap === true && this.containerOuter.element.contains(target)) {\n // ...and we aren't dealing with a single select box, show dropdown/focus input\n if (\n (target === this.containerOuter.element || target === this.containerInner.element) &&\n !this.isSelectOneElement\n ) {\n if (this.isTextElement) {\n // If text element, we only want to focus the input\n this.input.focus();\n } else {\n // If a select box, we want to show the dropdown\n this.showDropdown(true);\n }\n }\n // Prevents focus event firing\n e.stopPropagation();\n }\n\n this.wasTap = true;\n }\n\n /**\n * Mouse down event\n * @param {Object} e Event\n * @return\n * @private\n */\n _onMouseDown(e) {\n const target = e.target;\n\n // If we have our mouse down on the scrollbar and are on IE11...\n if (target === this.choiceList && this.isIe11) {\n this.isScrollingOnIe = true;\n }\n\n if (this.containerOuter.element.contains(target) && target !== this.input.element) {\n const activeItems = this.store.getItemsFilteredByActive();\n const hasShiftKey = e.shiftKey;\n\n const buttonTarget = findAncestorByAttrName(target, 'data-button');\n const itemTarget = findAncestorByAttrName(target, 'data-item');\n const choiceTarget = findAncestorByAttrName(target, 'data-choice');\n\n if (buttonTarget) {\n this._handleButtonAction(activeItems, buttonTarget);\n } else if (itemTarget) {\n this._handleItemAction(activeItems, itemTarget, hasShiftKey);\n } else if (choiceTarget) {\n this._handleChoiceAction(activeItems, choiceTarget);\n }\n\n e.preventDefault();\n }\n }\n\n /**\n * Mouse over (hover) event\n * @param {Object} e Event\n * @return\n * @private\n */\n _onMouseOver(e) {\n // If the dropdown is either the target or one of its children is the target\n const targetWithinDropdown = (\n e.target === this.dropdown || this.dropdown.element.contains(e.target)\n );\n const shouldHighlightChoice = targetWithinDropdown && e.target.hasAttribute('data-choice');\n\n if (shouldHighlightChoice) {\n this._highlightChoice(e.target);\n }\n }\n\n /**\n * Click event\n * @param {Object} e Event\n * @return\n * @private\n */\n _onClick(e) {\n const target = e.target;\n const hasActiveDropdown = this.dropdown.isActive;\n const activeItems = this.store.getItemsFilteredByActive();\n\n // If target is something that concerns us\n if (this.containerOuter.element.contains(target)) {\n if (!hasActiveDropdown) {\n if (this.isTextElement) {\n if (document.activeElement !== this.input.element) {\n this.input.focus();\n }\n } else if (this.canSearch) {\n this.showDropdown(true);\n } else {\n this.showDropdown();\n // code smell\n this.containerOuter.focus();\n }\n } else if (\n this.isSelectOneElement &&\n target !== this.input.element &&\n !this.dropdown.element.contains(target)\n ) {\n this.hideDropdown(true);\n }\n } else {\n const hasHighlightedItems = activeItems.some(item => item.highlighted);\n\n // De-select any highlighted items\n if (hasHighlightedItems) {\n this.unhighlightAll();\n }\n\n // Remove focus state\n this.containerOuter.removeFocusState();\n\n // Close all other dropdowns\n this.hideDropdown();\n }\n }\n\n /**\n * Focus event\n * @param {Object} e Event\n * @return\n * @private\n */\n _onFocus(e) {\n const target = e.target;\n if (!this.containerOuter.element.contains(target)) {\n return;\n }\n\n const focusActions = {\n text: () => {\n if (target === this.input.element) {\n this.containerOuter.addFocusState();\n }\n },\n 'select-one': () => {\n this.containerOuter.addFocusState();\n if (target === this.input.element) {\n // Show dropdown if it isn't already showing\n this.showDropdown();\n }\n },\n 'select-multiple': () => {\n if (target === this.input.element) {\n // If element is a select box, the focused element is the container and the dropdown\n // isn't already open, focus and show dropdown\n this.containerOuter.addFocusState();\n this.showDropdown(true);\n }\n },\n };\n\n focusActions[this.passedElement.element.type]();\n }\n\n /**\n * Blur event\n * @param {Object} e Event\n * @return\n * @private\n */\n _onBlur(e) {\n const target = e.target;\n // If target is something that concerns us\n if (this.containerOuter.element.contains(target) && !this.isScrollingOnIe) {\n const activeItems = this.store.getItemsFilteredByActive();\n const hasHighlightedItems = activeItems.some(item => item.highlighted);\n const blurActions = {\n text: () => {\n if (target === this.input.element) {\n // Remove the focus state\n this.containerOuter.removeFocusState();\n // De-select any highlighted items\n if (hasHighlightedItems) {\n this.unhighlightAll();\n }\n this.hideDropdown();\n }\n },\n 'select-one': () => {\n this.containerOuter.removeFocusState();\n if (target === this.containerOuter.element) {\n // Hide dropdown if it is showing\n if (!this.canSearch) {\n this.hideDropdown();\n }\n }\n if (target === this.input.element) {\n // Hide dropdown if it is showing\n this.hideDropdown();\n }\n },\n 'select-multiple': () => {\n if (target === this.input.element) {\n // Remove the focus state\n this.containerOuter.removeFocusState();\n this.hideDropdown();\n // De-select any highlighted items\n if (hasHighlightedItems) {\n this.unhighlightAll();\n }\n }\n },\n };\n\n blurActions[this.passedElement.element.type]();\n } else {\n // On IE11, clicking the scollbar blurs our input and thus\n // closes the dropdown. To stop this, we refocus our input\n // if we know we are on IE *and* are scrolling.\n this.isScrollingOnIe = false;\n this.input.element.focus();\n }\n }\n\n /**\n * Scroll to an option element\n * @param {HTMLElement} choice Option to scroll to\n * @param {Number} direction Whether option is above or below\n * @return\n * @private\n */\n _scrollToChoice(choice, direction) {\n if (!choice) {\n return;\n }\n\n const dropdownHeight = this.choiceList.height;\n const choiceHeight = choice.offsetHeight;\n // Distance from bottom of element to top of parent\n const choicePos = choice.offsetTop + choiceHeight;\n // Scroll position of dropdown\n const containerScrollPos = this.choiceList.scrollPos + dropdownHeight;\n // Difference between the choice and scroll position\n const endPoint = direction > 0 ? (\n (this.choiceList.scrollPos + choicePos) - containerScrollPos) :\n choice.offsetTop;\n\n const animateScroll = () => {\n const strength = SCROLLING_SPEED;\n const choiceListScrollTop = this.choiceList.scrollPos;\n let continueAnimation = false;\n let easing;\n let distance;\n\n if (direction > 0) {\n easing = (endPoint - choiceListScrollTop) / strength;\n distance = easing > 1 ? easing : 1;\n\n this.choiceList.scrollTo(choiceListScrollTop + distance);\n if (choiceListScrollTop < endPoint) {\n continueAnimation = true;\n }\n } else {\n easing = (choiceListScrollTop - endPoint) / strength;\n distance = easing > 1 ? easing : 1;\n\n this.choiceList.scrollTo(choiceListScrollTop - distance);\n if (choiceListScrollTop > endPoint) {\n continueAnimation = true;\n }\n }\n\n if (continueAnimation) {\n requestAnimationFrame((time) => {\n animateScroll(time, endPoint, direction);\n });\n }\n };\n\n requestAnimationFrame((time) => {\n animateScroll(time, endPoint, direction);\n });\n }\n\n /**\n * Highlight choice\n * @param {HTMLElement} [el] Element to highlight\n * @return\n * @private\n */\n _highlightChoice(el = null) {\n // Highlight first element in dropdown\n const choices = Array.from(this.dropdown.element.querySelectorAll('[data-choice-selectable]'));\n let passedEl = el;\n\n if (choices && choices.length) {\n const highlightedChoices = Array.from(\n this.dropdown.element.querySelectorAll(`.${this.config.classNames.highlightedState}`),\n );\n const hasActiveDropdown = this.dropdown.isActive;\n\n // Remove any highlighted choices\n highlightedChoices.forEach((choice) => {\n choice.classList.remove(this.config.classNames.highlightedState);\n choice.setAttribute('aria-selected', 'false');\n });\n\n if (passedEl) {\n this.highlightPosition = choices.indexOf(passedEl);\n } else {\n // Highlight choice based on last known highlight location\n if (choices.length > this.highlightPosition) {\n // If we have an option to highlight\n passedEl = choices[this.highlightPosition];\n } else {\n // Otherwise highlight the option before\n passedEl = choices[choices.length - 1];\n }\n\n if (!passedEl) {\n passedEl = choices[0];\n }\n }\n\n // Highlight given option, and set accessiblity attributes\n passedEl.classList.add(this.config.classNames.highlightedState);\n passedEl.setAttribute('aria-selected', 'true');\n\n if (hasActiveDropdown) {\n // IE11 ignores aria-label and blocks virtual keyboard\n // if aria-activedescendant is set without a dropdown\n this.input.setActiveDescendant(passedEl.id);\n this.containerOuter.setActiveDescendant(passedEl.id);\n }\n }\n }\n\n /**\n * Add item to store with correct value\n * @param {String} value Value to add to store\n * @param {String} [label] Label to add to store\n * @param {Number} [choiceId=-1] ID of the associated choice that was selected\n * @param {Number} [groupId=-1] ID of group choice is within. Negative number indicates no group\n * @param {Object} [customProperties] Object containing user defined properties\n * @return {Object} Class instance\n * @public\n */\n _addItem(\n value,\n label = null,\n choiceId = -1,\n groupId = -1,\n customProperties = null,\n placeholder = false,\n keyCode = null,\n ) {\n let passedValue = isType('String', value) ? value.trim() : value;\n const passedKeyCode = keyCode;\n const items = this.store.getItems();\n const passedLabel = label || passedValue;\n const passedOptionId = parseInt(choiceId, 10) || -1;\n\n // Get group if group ID passed\n const group = groupId >= 0 ? this.store.getGroupById(groupId) : null;\n\n // Generate unique id\n const id = items ? items.length + 1 : 1;\n\n // If a prepended value has been passed, prepend it\n if (this.config.prependValue) {\n passedValue = this.config.prependValue + passedValue.toString();\n }\n\n // If an appended value has been passed, append it\n if (this.config.appendValue) {\n passedValue += this.config.appendValue.toString();\n }\n\n this.store.dispatch(\n addItem(\n passedValue,\n passedLabel,\n id,\n passedOptionId,\n groupId,\n customProperties,\n placeholder,\n passedKeyCode,\n ),\n );\n\n if (this.isSelectOneElement) {\n this.removeActiveItems(id);\n }\n\n // Trigger change event\n if (group && group.value) {\n this.passedElement.triggerEvent(EVENTS.addItem, {\n id,\n value: passedValue,\n label: passedLabel,\n groupValue: group.value,\n keyCode: passedKeyCode,\n });\n } else {\n this.passedElement.triggerEvent(EVENTS.addItem, {\n id,\n value: passedValue,\n label: passedLabel,\n keyCode: passedKeyCode,\n });\n }\n\n return this;\n }\n\n /**\n * Remove item from store\n * @param {Object} item Item to remove\n * @return {Object} Class instance\n * @public\n */\n _removeItem(item) {\n if (!item || !isType('Object', item)) {\n return this;\n }\n\n const id = item.id;\n const value = item.value;\n const label = item.label;\n const choiceId = item.choiceId;\n const groupId = item.groupId;\n const group = groupId >= 0 ? this.store.getGroupById(groupId) : null;\n\n this.store.dispatch(removeItem(id, choiceId));\n\n if (group && group.value) {\n this.passedElement.triggerEvent(EVENTS.removeItem, {\n id,\n value,\n label,\n groupValue: group.value,\n });\n } else {\n this.passedElement.triggerEvent(EVENTS.removeItem, {\n id,\n value,\n label,\n });\n }\n\n return this;\n }\n\n /**\n * Add choice to dropdown\n * @param {String} value Value of choice\n * @param {String} [label] Label of choice\n * @param {Boolean} [isSelected=false] Whether choice is selected\n * @param {Boolean} [isDisabled=false] Whether choice is disabled\n * @param {Number} [groupId=-1] ID of group choice is within. Negative number indicates no group\n * @param {Object} [customProperties] Object containing user defined properties\n * @return\n * @private\n */\n _addChoice(\n value,\n label = null,\n isSelected = false,\n isDisabled = false,\n groupId = -1,\n customProperties = null,\n placeholder = false,\n keyCode = null,\n ) {\n if (typeof value === 'undefined' || value === null) {\n return;\n }\n\n // Generate unique id\n const choices = this.store.getChoices();\n const choiceLabel = label || value;\n const choiceId = choices ? choices.length + 1 : 1;\n const choiceElementId = `${this.baseId}-${this.idNames.itemChoice}-${choiceId}`;\n\n this.store.dispatch(\n addChoice(\n value,\n choiceLabel,\n choiceId,\n groupId,\n isDisabled,\n choiceElementId,\n customProperties,\n placeholder,\n keyCode,\n ),\n );\n\n if (isSelected) {\n this._addItem(\n value,\n choiceLabel,\n choiceId,\n undefined,\n customProperties,\n placeholder,\n keyCode,\n );\n }\n }\n\n /**\n * Clear all choices added to the store.\n * @return\n * @private\n */\n _clearChoices() {\n this.store.dispatch(\n clearChoices(),\n );\n }\n\n /**\n * Add group to dropdown\n * @param {Object} group Group to add\n * @param {Number} id Group ID\n * @param {String} [valueKey] name of the value property on the object\n * @param {String} [labelKey] name of the label property on the object\n * @return\n * @private\n */\n _addGroup(group, id, valueKey = 'value', labelKey = 'label') {\n const groupChoices = isType('Object', group) ?\n group.choices :\n Array.from(group.getElementsByTagName('OPTION'));\n const groupId = id || Math.floor(new Date().valueOf() * Math.random());\n const isDisabled = group.disabled ? group.disabled : false;\n\n if (groupChoices) {\n this.store.dispatch(\n addGroup(\n group.label,\n groupId,\n true,\n isDisabled,\n ),\n );\n\n const addGroupChoices = (choice) => {\n const isOptDisabled = choice.disabled || (choice.parentNode && choice.parentNode.disabled);\n this._addChoice(\n choice[valueKey],\n (isType('Object', choice)) ? choice[labelKey] : choice.innerHTML,\n choice.selected,\n isOptDisabled,\n groupId,\n choice.customProperties,\n choice.placeholder,\n );\n };\n\n groupChoices.forEach(addGroupChoices);\n } else {\n this.store.dispatch(\n addGroup(\n group.label,\n group.id,\n false,\n group.disabled,\n ),\n );\n }\n }\n\n /**\n * Get template from name\n * @param {String} template Name of template to get\n * @param {...} args Data to pass to template\n * @return {HTMLElement} Template\n * @private\n */\n _getTemplate(template, ...args) {\n if (!template) {\n return null;\n }\n const templates = this.config.templates;\n const globalClasses = this.config.classNames;\n return templates[template].call(this, globalClasses, ...args);\n }\n\n /**\n * Create HTML element based on type and arguments\n * @return\n * @private\n */\n _createTemplates() {\n // User's custom templates\n const callbackTemplate = this.config.callbackOnCreateTemplates;\n let userTemplates = {};\n if (callbackTemplate && isType('Function', callbackTemplate)) {\n userTemplates = callbackTemplate.call(this, strToEl);\n }\n\n this.config.templates = extend(TEMPLATES, userTemplates);\n }\n\n /**\n * Create DOM structure around passed select element\n * @return\n * @private\n */\n _createStructure() {\n const direction = this.passedElement.element.getAttribute('dir') || 'ltr';\n const containerOuter = this._getTemplate('containerOuter',\n direction,\n this.isSelectElement,\n this.isSelectOneElement,\n this.config.searchEnabled,\n this.passedElement.element.type,\n );\n const containerInner = this._getTemplate('containerInner');\n const itemList = this._getTemplate('itemList', this.isSelectOneElement);\n const choiceList = this._getTemplate('choiceList', this.isSelectOneElement);\n const input = this._getTemplate('input');\n const dropdown = this._getTemplate('dropdown');\n\n this.containerOuter = new Container(this, containerOuter, this.config.classNames);\n this.containerInner = new Container(this, containerInner, this.config.classNames);\n this.input = new Input(this, input, this.config.classNames);\n this.choiceList = new List(this, choiceList, this.config.classNames);\n this.itemList = new List(this, itemList, this.config.classNames);\n this.dropdown = new Dropdown(this, dropdown, this.config.classNames);\n\n this.passedElement.conceal();\n\n // Wrap input in container preserving DOM ordering\n wrap(this.passedElement.element, this.containerInner.element);\n // Wrapper inner container with outer container\n wrap(this.containerInner.element, this.containerOuter.element);\n\n if (this.isSelectOneElement) {\n this.input.setPlaceholder(this.config.searchPlaceholderValue || '');\n } else if (this.placeholder) {\n this.input.setPlaceholder(this.placeholder);\n this.input.setWidth(true);\n }\n\n if (!this.config.addItems) {\n this.disable();\n }\n\n this.containerOuter.element.appendChild(this.containerInner.element);\n this.containerOuter.element.appendChild(this.dropdown.element);\n this.containerInner.element.appendChild(itemList);\n\n if (!this.isTextElement) {\n dropdown.appendChild(choiceList);\n }\n\n if (!this.isSelectOneElement) {\n this.containerInner.element.appendChild(this.input.element);\n } else if (this.canSearch) {\n dropdown.insertBefore(input, dropdown.firstChild);\n }\n\n if (this.isSelectElement) {\n this._addPredefinedChoices();\n } else if (this.isTextElement) {\n this._addPredefinedItems();\n }\n }\n\n _addPredefinedChoices() {\n const passedGroups = this.passedElement.getOptionGroups();\n\n this.highlightPosition = 0;\n this.isSearching = false;\n\n if (passedGroups && passedGroups.length) {\n // If we have a placeholder option\n const placeholderChoice = this.passedElement.getPlaceholderOption();\n if (placeholderChoice && placeholderChoice.parentNode.tagName === 'SELECT') {\n this._addChoice(\n placeholderChoice.value,\n placeholderChoice.innerHTML,\n placeholderChoice.selected,\n placeholderChoice.disabled,\n undefined,\n undefined,\n /* placeholder */ true,\n );\n }\n\n passedGroups.forEach((group) => {\n this._addGroup(group, (group.id || null));\n });\n } else {\n const passedOptions = this.passedElement.getOptions();\n const filter = this.config.sortFilter;\n const allChoices = this.presetChoices;\n\n // Create array of options from option elements\n passedOptions.forEach((o) => {\n allChoices.push({\n value: o.value,\n label: o.innerHTML,\n selected: o.selected,\n disabled: o.disabled || o.parentNode.disabled,\n placeholder: o.hasAttribute('placeholder'),\n });\n });\n\n // If sorting is enabled or the user is searching, filter choices\n if (this.config.shouldSort) {\n allChoices.sort(filter);\n }\n\n // Determine whether there is a selected choice\n const hasSelectedChoice = allChoices.some(choice => choice.selected);\n const handleChoice = (choice, index) => {\n if (this.isSelectElement) {\n // If the choice is actually a group\n if (choice.choices) {\n this._addGroup(choice, choice.id || null);\n } else {\n // If there is a selected choice already or the choice is not\n // the first in the array, add each choice normally\n // Otherwise pre-select the first choice in the array if it's a single select\n const shouldPreselect = this.isSelectOneElement && !hasSelectedChoice && index === 0;\n const isSelected = shouldPreselect ? true : choice.selected;\n const isDisabled = shouldPreselect ? false : choice.disabled;\n\n this._addChoice(\n choice.value,\n choice.label,\n isSelected,\n isDisabled,\n undefined,\n choice.customProperties,\n choice.placeholder,\n );\n }\n } else {\n this._addChoice(\n choice.value,\n choice.label,\n choice.selected,\n choice.disabled,\n undefined,\n choice.customProperties,\n choice.placeholder,\n );\n }\n };\n\n // Add each choice\n allChoices.forEach((choice, index) => handleChoice(choice, index));\n }\n }\n\n _addPredefinedItems() {\n const handlePresetItem = (item) => {\n const itemType = getType(item);\n if (itemType === 'Object') {\n if (!item.value) {\n return;\n }\n this._addItem(\n item.value,\n item.label,\n item.id,\n undefined,\n item.customProperties,\n item.placeholder,\n );\n } else if (itemType === 'String') {\n this._addItem(item);\n }\n };\n\n this.presetItems.forEach(item => handlePresetItem(item));\n }\n\n _setChoiceOrItem(item) {\n const itemType = getType(item).toLowerCase();\n const handleType = {\n object: () => {\n if (!item.value) {\n return;\n }\n\n // If we are dealing with a select input, we need to create an option first\n // that is then selected. For text inputs we can just add items normally.\n if (!this.isTextElement) {\n this._addChoice(\n item.value,\n item.label,\n true,\n false, -1,\n item.customProperties,\n item.placeholder,\n );\n } else {\n this._addItem(\n item.value,\n item.label,\n item.id,\n undefined,\n item.customProperties,\n item.placeholder,\n );\n }\n },\n string: () => {\n if (!this.isTextElement) {\n this._addChoice(\n item,\n item,\n true,\n false, -1,\n null,\n );\n } else {\n this._addItem(item);\n }\n },\n };\n\n handleType[itemType]();\n }\n\n _findAndSelectChoiceByValue(val) {\n const choices = this.store.getChoices();\n // Check 'value' property exists and the choice isn't already selected\n const foundChoice = choices.find(choice => choice.value === val);\n\n if (foundChoice && !foundChoice.selected) {\n this._addItem(\n foundChoice.value,\n foundChoice.label,\n foundChoice.id,\n foundChoice.groupId,\n foundChoice.customProperties,\n foundChoice.placeholder,\n foundChoice.keyCode,\n );\n }\n }\n\n /* ===== End of Private functions ====== */\n}\n\nChoices.userDefaults = {};\n\n\n\n// WEBPACK FOOTER //\n// src/scripts/src/choices.js","/*!\n * Fuse.js v3.2.0 - Lightweight fuzzy-search (http://fusejs.io)\n * \n * Copyright (c) 2012-2017 Kirollos Risk (http://kiro.me)\n * All Rights Reserved. Apache Software License 2.0\n * \n * http://www.apache.org/licenses/LICENSE-2.0\n */\n(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"Fuse\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"Fuse\"] = factory();\n\telse\n\t\troot[\"Fuse\"] = factory();\n})(this, function() {\nreturn /******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId]) {\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\ti: moduleId,\n/******/ \t\t\tl: false,\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.l = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// identity function for calling harmony imports with the correct context\n/******/ \t__webpack_require__.i = function(value) { return value; };\n/******/\n/******/ \t// define getter function for harmony exports\n/******/ \t__webpack_require__.d = function(exports, name, getter) {\n/******/ \t\tif(!__webpack_require__.o(exports, name)) {\n/******/ \t\t\tObject.defineProperty(exports, name, {\n/******/ \t\t\t\tconfigurable: false,\n/******/ \t\t\t\tenumerable: true,\n/******/ \t\t\t\tget: getter\n/******/ \t\t\t});\n/******/ \t\t}\n/******/ \t};\n/******/\n/******/ \t// getDefaultExport function for compatibility with non-harmony modules\n/******/ \t__webpack_require__.n = function(module) {\n/******/ \t\tvar getter = module && module.__esModule ?\n/******/ \t\t\tfunction getDefault() { return module['default']; } :\n/******/ \t\t\tfunction getModuleExports() { return module; };\n/******/ \t\t__webpack_require__.d(getter, 'a', getter);\n/******/ \t\treturn getter;\n/******/ \t};\n/******/\n/******/ \t// Object.prototype.hasOwnProperty.call\n/******/ \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(__webpack_require__.s = 8);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nmodule.exports = function (obj) {\n return Object.prototype.toString.call(obj) === '[object Array]';\n};\n\n/***/ }),\n/* 1 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nvar bitapRegexSearch = __webpack_require__(5);\nvar bitapSearch = __webpack_require__(7);\nvar patternAlphabet = __webpack_require__(4);\n\nvar Bitap = function () {\n function Bitap(pattern, _ref) {\n var _ref$location = _ref.location,\n location = _ref$location === undefined ? 0 : _ref$location,\n _ref$distance = _ref.distance,\n distance = _ref$distance === undefined ? 100 : _ref$distance,\n _ref$threshold = _ref.threshold,\n threshold = _ref$threshold === undefined ? 0.6 : _ref$threshold,\n _ref$maxPatternLength = _ref.maxPatternLength,\n maxPatternLength = _ref$maxPatternLength === undefined ? 32 : _ref$maxPatternLength,\n _ref$isCaseSensitive = _ref.isCaseSensitive,\n isCaseSensitive = _ref$isCaseSensitive === undefined ? false : _ref$isCaseSensitive,\n _ref$tokenSeparator = _ref.tokenSeparator,\n tokenSeparator = _ref$tokenSeparator === undefined ? / +/g : _ref$tokenSeparator,\n _ref$findAllMatches = _ref.findAllMatches,\n findAllMatches = _ref$findAllMatches === undefined ? false : _ref$findAllMatches,\n _ref$minMatchCharLeng = _ref.minMatchCharLength,\n minMatchCharLength = _ref$minMatchCharLeng === undefined ? 1 : _ref$minMatchCharLeng;\n\n _classCallCheck(this, Bitap);\n\n this.options = {\n location: location,\n distance: distance,\n threshold: threshold,\n maxPatternLength: maxPatternLength,\n isCaseSensitive: isCaseSensitive,\n tokenSeparator: tokenSeparator,\n findAllMatches: findAllMatches,\n minMatchCharLength: minMatchCharLength\n };\n\n this.pattern = this.options.isCaseSensitive ? pattern : pattern.toLowerCase();\n\n if (this.pattern.length <= maxPatternLength) {\n this.patternAlphabet = patternAlphabet(this.pattern);\n }\n }\n\n _createClass(Bitap, [{\n key: 'search',\n value: function search(text) {\n if (!this.options.isCaseSensitive) {\n text = text.toLowerCase();\n }\n\n // Exact match\n if (this.pattern === text) {\n return {\n isMatch: true,\n score: 0,\n matchedIndices: [[0, text.length - 1]]\n };\n }\n\n // When pattern length is greater than the machine word length, just do a a regex comparison\n var _options = this.options,\n maxPatternLength = _options.maxPatternLength,\n tokenSeparator = _options.tokenSeparator;\n\n if (this.pattern.length > maxPatternLength) {\n return bitapRegexSearch(text, this.pattern, tokenSeparator);\n }\n\n // Otherwise, use Bitap algorithm\n var _options2 = this.options,\n location = _options2.location,\n distance = _options2.distance,\n threshold = _options2.threshold,\n findAllMatches = _options2.findAllMatches,\n minMatchCharLength = _options2.minMatchCharLength;\n\n return bitapSearch(text, this.pattern, this.patternAlphabet, {\n location: location,\n distance: distance,\n threshold: threshold,\n findAllMatches: findAllMatches,\n minMatchCharLength: minMatchCharLength\n });\n }\n }]);\n\n return Bitap;\n}();\n\n// let x = new Bitap(\"od mn war\", {})\n// let result = x.search(\"Old Man's War\")\n// console.log(result)\n\nmodule.exports = Bitap;\n\n/***/ }),\n/* 2 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar isArray = __webpack_require__(0);\n\nvar deepValue = function deepValue(obj, path, list) {\n if (!path) {\n // If there's no path left, we've gotten to the object we care about.\n list.push(obj);\n } else {\n var dotIndex = path.indexOf('.');\n var firstSegment = path;\n var remaining = null;\n\n if (dotIndex !== -1) {\n firstSegment = path.slice(0, dotIndex);\n remaining = path.slice(dotIndex + 1);\n }\n\n var value = obj[firstSegment];\n\n if (value !== null && value !== undefined) {\n if (!remaining && (typeof value === 'string' || typeof value === 'number')) {\n list.push(value.toString());\n } else if (isArray(value)) {\n // Search each item in the array.\n for (var i = 0, len = value.length; i < len; i += 1) {\n deepValue(value[i], remaining, list);\n }\n } else if (remaining) {\n // An object. Recurse further.\n deepValue(value, remaining, list);\n }\n }\n }\n\n return list;\n};\n\nmodule.exports = function (obj, path) {\n return deepValue(obj, path, []);\n};\n\n/***/ }),\n/* 3 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nmodule.exports = function () {\n var matchmask = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];\n var minMatchCharLength = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;\n\n var matchedIndices = [];\n var start = -1;\n var end = -1;\n var i = 0;\n\n for (var len = matchmask.length; i < len; i += 1) {\n var match = matchmask[i];\n if (match && start === -1) {\n start = i;\n } else if (!match && start !== -1) {\n end = i - 1;\n if (end - start + 1 >= minMatchCharLength) {\n matchedIndices.push([start, end]);\n }\n start = -1;\n }\n }\n\n // (i-1 - start) + 1 => i - start\n if (matchmask[i - 1] && i - start >= minMatchCharLength) {\n matchedIndices.push([start, i - 1]);\n }\n\n return matchedIndices;\n};\n\n/***/ }),\n/* 4 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nmodule.exports = function (pattern) {\n var mask = {};\n var len = pattern.length;\n\n for (var i = 0; i < len; i += 1) {\n mask[pattern.charAt(i)] = 0;\n }\n\n for (var _i = 0; _i < len; _i += 1) {\n mask[pattern.charAt(_i)] |= 1 << len - _i - 1;\n }\n\n return mask;\n};\n\n/***/ }),\n/* 5 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar SPECIAL_CHARS_REGEX = /[\\-\\[\\]\\/\\{\\}\\(\\)\\*\\+\\?\\.\\\\\\^\\$\\|]/g;\n\nmodule.exports = function (text, pattern) {\n var tokenSeparator = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : / +/g;\n\n var regex = new RegExp(pattern.replace(SPECIAL_CHARS_REGEX, '\\\\$&').replace(tokenSeparator, '|'));\n var matches = text.match(regex);\n var isMatch = !!matches;\n var matchedIndices = [];\n\n if (isMatch) {\n for (var i = 0, matchesLen = matches.length; i < matchesLen; i += 1) {\n var match = matches[i];\n matchedIndices.push([text.indexOf(match), match.length - 1]);\n }\n }\n\n return {\n // TODO: revisit this score\n score: isMatch ? 0.5 : 1,\n isMatch: isMatch,\n matchedIndices: matchedIndices\n };\n};\n\n/***/ }),\n/* 6 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nmodule.exports = function (pattern, _ref) {\n var _ref$errors = _ref.errors,\n errors = _ref$errors === undefined ? 0 : _ref$errors,\n _ref$currentLocation = _ref.currentLocation,\n currentLocation = _ref$currentLocation === undefined ? 0 : _ref$currentLocation,\n _ref$expectedLocation = _ref.expectedLocation,\n expectedLocation = _ref$expectedLocation === undefined ? 0 : _ref$expectedLocation,\n _ref$distance = _ref.distance,\n distance = _ref$distance === undefined ? 100 : _ref$distance;\n\n var accuracy = errors / pattern.length;\n var proximity = Math.abs(expectedLocation - currentLocation);\n\n if (!distance) {\n // Dodge divide by zero error.\n return proximity ? 1.0 : accuracy;\n }\n\n return accuracy + proximity / distance;\n};\n\n/***/ }),\n/* 7 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar bitapScore = __webpack_require__(6);\nvar matchedIndices = __webpack_require__(3);\n\nmodule.exports = function (text, pattern, patternAlphabet, _ref) {\n var _ref$location = _ref.location,\n location = _ref$location === undefined ? 0 : _ref$location,\n _ref$distance = _ref.distance,\n distance = _ref$distance === undefined ? 100 : _ref$distance,\n _ref$threshold = _ref.threshold,\n threshold = _ref$threshold === undefined ? 0.6 : _ref$threshold,\n _ref$findAllMatches = _ref.findAllMatches,\n findAllMatches = _ref$findAllMatches === undefined ? false : _ref$findAllMatches,\n _ref$minMatchCharLeng = _ref.minMatchCharLength,\n minMatchCharLength = _ref$minMatchCharLeng === undefined ? 1 : _ref$minMatchCharLeng;\n\n var expectedLocation = location;\n // Set starting location at beginning text and initialize the alphabet.\n var textLen = text.length;\n // Highest score beyond which we give up.\n var currentThreshold = threshold;\n // Is there a nearby exact match? (speedup)\n var bestLocation = text.indexOf(pattern, expectedLocation);\n\n var patternLen = pattern.length;\n\n // a mask of the matches\n var matchMask = [];\n for (var i = 0; i < textLen; i += 1) {\n matchMask[i] = 0;\n }\n\n if (bestLocation !== -1) {\n var score = bitapScore(pattern, {\n errors: 0,\n currentLocation: bestLocation,\n expectedLocation: expectedLocation,\n distance: distance\n });\n currentThreshold = Math.min(score, currentThreshold);\n\n // What about in the other direction? (speed up)\n bestLocation = text.lastIndexOf(pattern, expectedLocation + patternLen);\n\n if (bestLocation !== -1) {\n var _score = bitapScore(pattern, {\n errors: 0,\n currentLocation: bestLocation,\n expectedLocation: expectedLocation,\n distance: distance\n });\n currentThreshold = Math.min(_score, currentThreshold);\n }\n }\n\n // Reset the best location\n bestLocation = -1;\n\n var lastBitArr = [];\n var finalScore = 1;\n var binMax = patternLen + textLen;\n\n var mask = 1 << patternLen - 1;\n\n for (var _i = 0; _i < patternLen; _i += 1) {\n // Scan for the best match; each iteration allows for one more error.\n // Run a binary search to determine how far from the match location we can stray\n // at this error level.\n var binMin = 0;\n var binMid = binMax;\n\n while (binMin < binMid) {\n var _score3 = bitapScore(pattern, {\n errors: _i,\n currentLocation: expectedLocation + binMid,\n expectedLocation: expectedLocation,\n distance: distance\n });\n\n if (_score3 <= currentThreshold) {\n binMin = binMid;\n } else {\n binMax = binMid;\n }\n\n binMid = Math.floor((binMax - binMin) / 2 + binMin);\n }\n\n // Use the result from this iteration as the maximum for the next.\n binMax = binMid;\n\n var start = Math.max(1, expectedLocation - binMid + 1);\n var finish = findAllMatches ? textLen : Math.min(expectedLocation + binMid, textLen) + patternLen;\n\n // Initialize the bit array\n var bitArr = Array(finish + 2);\n\n bitArr[finish + 1] = (1 << _i) - 1;\n\n for (var j = finish; j >= start; j -= 1) {\n var currentLocation = j - 1;\n var charMatch = patternAlphabet[text.charAt(currentLocation)];\n\n if (charMatch) {\n matchMask[currentLocation] = 1;\n }\n\n // First pass: exact match\n bitArr[j] = (bitArr[j + 1] << 1 | 1) & charMatch;\n\n // Subsequent passes: fuzzy match\n if (_i !== 0) {\n bitArr[j] |= (lastBitArr[j + 1] | lastBitArr[j]) << 1 | 1 | lastBitArr[j + 1];\n }\n\n if (bitArr[j] & mask) {\n finalScore = bitapScore(pattern, {\n errors: _i,\n currentLocation: currentLocation,\n expectedLocation: expectedLocation,\n distance: distance\n });\n\n // This match will almost certainly be better than any existing match.\n // But check anyway.\n if (finalScore <= currentThreshold) {\n // Indeed it is\n currentThreshold = finalScore;\n bestLocation = currentLocation;\n\n // Already passed `loc`, downhill from here on in.\n if (bestLocation <= expectedLocation) {\n break;\n }\n\n // When passing `bestLocation`, don't exceed our current distance from `expectedLocation`.\n start = Math.max(1, 2 * expectedLocation - bestLocation);\n }\n }\n }\n\n // No hope for a (better) match at greater error levels.\n var _score2 = bitapScore(pattern, {\n errors: _i + 1,\n currentLocation: expectedLocation,\n expectedLocation: expectedLocation,\n distance: distance\n });\n\n if (_score2 > currentThreshold) {\n break;\n }\n\n lastBitArr = bitArr;\n }\n\n // Count exact matches (those with a score of 0) to be \"almost\" exact\n return {\n isMatch: bestLocation >= 0,\n score: finalScore === 0 ? 0.001 : finalScore,\n matchedIndices: matchedIndices(matchMask, minMatchCharLength)\n };\n};\n\n/***/ }),\n/* 8 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nvar Bitap = __webpack_require__(1);\nvar deepValue = __webpack_require__(2);\nvar isArray = __webpack_require__(0);\n\nvar Fuse = function () {\n function Fuse(list, _ref) {\n var _ref$location = _ref.location,\n location = _ref$location === undefined ? 0 : _ref$location,\n _ref$distance = _ref.distance,\n distance = _ref$distance === undefined ? 100 : _ref$distance,\n _ref$threshold = _ref.threshold,\n threshold = _ref$threshold === undefined ? 0.6 : _ref$threshold,\n _ref$maxPatternLength = _ref.maxPatternLength,\n maxPatternLength = _ref$maxPatternLength === undefined ? 32 : _ref$maxPatternLength,\n _ref$caseSensitive = _ref.caseSensitive,\n caseSensitive = _ref$caseSensitive === undefined ? false : _ref$caseSensitive,\n _ref$tokenSeparator = _ref.tokenSeparator,\n tokenSeparator = _ref$tokenSeparator === undefined ? / +/g : _ref$tokenSeparator,\n _ref$findAllMatches = _ref.findAllMatches,\n findAllMatches = _ref$findAllMatches === undefined ? false : _ref$findAllMatches,\n _ref$minMatchCharLeng = _ref.minMatchCharLength,\n minMatchCharLength = _ref$minMatchCharLeng === undefined ? 1 : _ref$minMatchCharLeng,\n _ref$id = _ref.id,\n id = _ref$id === undefined ? null : _ref$id,\n _ref$keys = _ref.keys,\n keys = _ref$keys === undefined ? [] : _ref$keys,\n _ref$shouldSort = _ref.shouldSort,\n shouldSort = _ref$shouldSort === undefined ? true : _ref$shouldSort,\n _ref$getFn = _ref.getFn,\n getFn = _ref$getFn === undefined ? deepValue : _ref$getFn,\n _ref$sortFn = _ref.sortFn,\n sortFn = _ref$sortFn === undefined ? function (a, b) {\n return a.score - b.score;\n } : _ref$sortFn,\n _ref$tokenize = _ref.tokenize,\n tokenize = _ref$tokenize === undefined ? false : _ref$tokenize,\n _ref$matchAllTokens = _ref.matchAllTokens,\n matchAllTokens = _ref$matchAllTokens === undefined ? false : _ref$matchAllTokens,\n _ref$includeMatches = _ref.includeMatches,\n includeMatches = _ref$includeMatches === undefined ? false : _ref$includeMatches,\n _ref$includeScore = _ref.includeScore,\n includeScore = _ref$includeScore === undefined ? false : _ref$includeScore,\n _ref$verbose = _ref.verbose,\n verbose = _ref$verbose === undefined ? false : _ref$verbose;\n\n _classCallCheck(this, Fuse);\n\n this.options = {\n location: location,\n distance: distance,\n threshold: threshold,\n maxPatternLength: maxPatternLength,\n isCaseSensitive: caseSensitive,\n tokenSeparator: tokenSeparator,\n findAllMatches: findAllMatches,\n minMatchCharLength: minMatchCharLength,\n id: id,\n keys: keys,\n includeMatches: includeMatches,\n includeScore: includeScore,\n shouldSort: shouldSort,\n getFn: getFn,\n sortFn: sortFn,\n verbose: verbose,\n tokenize: tokenize,\n matchAllTokens: matchAllTokens\n };\n\n this.setCollection(list);\n }\n\n _createClass(Fuse, [{\n key: 'setCollection',\n value: function setCollection(list) {\n this.list = list;\n return list;\n }\n }, {\n key: 'search',\n value: function search(pattern) {\n this._log('---------\\nSearch pattern: \"' + pattern + '\"');\n\n var _prepareSearchers2 = this._prepareSearchers(pattern),\n tokenSearchers = _prepareSearchers2.tokenSearchers,\n fullSearcher = _prepareSearchers2.fullSearcher;\n\n var _search2 = this._search(tokenSearchers, fullSearcher),\n weights = _search2.weights,\n results = _search2.results;\n\n this._computeScore(weights, results);\n\n if (this.options.shouldSort) {\n this._sort(results);\n }\n\n return this._format(results);\n }\n }, {\n key: '_prepareSearchers',\n value: function _prepareSearchers() {\n var pattern = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';\n\n var tokenSearchers = [];\n\n if (this.options.tokenize) {\n // Tokenize on the separator\n var tokens = pattern.split(this.options.tokenSeparator);\n for (var i = 0, len = tokens.length; i < len; i += 1) {\n tokenSearchers.push(new Bitap(tokens[i], this.options));\n }\n }\n\n var fullSearcher = new Bitap(pattern, this.options);\n\n return { tokenSearchers: tokenSearchers, fullSearcher: fullSearcher };\n }\n }, {\n key: '_search',\n value: function _search() {\n var tokenSearchers = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];\n var fullSearcher = arguments[1];\n\n var list = this.list;\n var resultMap = {};\n var results = [];\n\n // Check the first item in the list, if it's a string, then we assume\n // that every item in the list is also a string, and thus it's a flattened array.\n if (typeof list[0] === 'string') {\n // Iterate over every item\n for (var i = 0, len = list.length; i < len; i += 1) {\n this._analyze({\n key: '',\n value: list[i],\n record: i,\n index: i\n }, {\n resultMap: resultMap,\n results: results,\n tokenSearchers: tokenSearchers,\n fullSearcher: fullSearcher\n });\n }\n\n return { weights: null, results: results };\n }\n\n // Otherwise, the first item is an Object (hopefully), and thus the searching\n // is done on the values of the keys of each item.\n var weights = {};\n for (var _i = 0, _len = list.length; _i < _len; _i += 1) {\n var item = list[_i];\n // Iterate over every key\n for (var j = 0, keysLen = this.options.keys.length; j < keysLen; j += 1) {\n var key = this.options.keys[j];\n if (typeof key !== 'string') {\n weights[key.name] = {\n weight: 1 - key.weight || 1\n };\n if (key.weight <= 0 || key.weight > 1) {\n throw new Error('Key weight has to be > 0 and <= 1');\n }\n key = key.name;\n } else {\n weights[key] = {\n weight: 1\n };\n }\n\n this._analyze({\n key: key,\n value: this.options.getFn(item, key),\n record: item,\n index: _i\n }, {\n resultMap: resultMap,\n results: results,\n tokenSearchers: tokenSearchers,\n fullSearcher: fullSearcher\n });\n }\n }\n\n return { weights: weights, results: results };\n }\n }, {\n key: '_analyze',\n value: function _analyze(_ref2, _ref3) {\n var key = _ref2.key,\n _ref2$arrayIndex = _ref2.arrayIndex,\n arrayIndex = _ref2$arrayIndex === undefined ? -1 : _ref2$arrayIndex,\n value = _ref2.value,\n record = _ref2.record,\n index = _ref2.index;\n var _ref3$tokenSearchers = _ref3.tokenSearchers,\n tokenSearchers = _ref3$tokenSearchers === undefined ? [] : _ref3$tokenSearchers,\n _ref3$fullSearcher = _ref3.fullSearcher,\n fullSearcher = _ref3$fullSearcher === undefined ? [] : _ref3$fullSearcher,\n _ref3$resultMap = _ref3.resultMap,\n resultMap = _ref3$resultMap === undefined ? {} : _ref3$resultMap,\n _ref3$results = _ref3.results,\n results = _ref3$results === undefined ? [] : _ref3$results;\n\n // Check if the texvaluet can be searched\n if (value === undefined || value === null) {\n return;\n }\n\n var exists = false;\n var averageScore = -1;\n var numTextMatches = 0;\n\n if (typeof value === 'string') {\n this._log('\\nKey: ' + (key === '' ? '-' : key));\n\n var mainSearchResult = fullSearcher.search(value);\n this._log('Full text: \"' + value + '\", score: ' + mainSearchResult.score);\n\n if (this.options.tokenize) {\n var words = value.split(this.options.tokenSeparator);\n var scores = [];\n\n for (var i = 0; i < tokenSearchers.length; i += 1) {\n var tokenSearcher = tokenSearchers[i];\n\n this._log('\\nPattern: \"' + tokenSearcher.pattern + '\"');\n\n // let tokenScores = []\n var hasMatchInText = false;\n\n for (var j = 0; j < words.length; j += 1) {\n var word = words[j];\n var tokenSearchResult = tokenSearcher.search(word);\n var obj = {};\n if (tokenSearchResult.isMatch) {\n obj[word] = tokenSearchResult.score;\n exists = true;\n hasMatchInText = true;\n scores.push(tokenSearchResult.score);\n } else {\n obj[word] = 1;\n if (!this.options.matchAllTokens) {\n scores.push(1);\n }\n }\n this._log('Token: \"' + word + '\", score: ' + obj[word]);\n // tokenScores.push(obj)\n }\n\n if (hasMatchInText) {\n numTextMatches += 1;\n }\n }\n\n averageScore = scores[0];\n var scoresLen = scores.length;\n for (var _i2 = 1; _i2 < scoresLen; _i2 += 1) {\n averageScore += scores[_i2];\n }\n averageScore = averageScore / scoresLen;\n\n this._log('Token score average:', averageScore);\n }\n\n var finalScore = mainSearchResult.score;\n if (averageScore > -1) {\n finalScore = (finalScore + averageScore) / 2;\n }\n\n this._log('Score average:', finalScore);\n\n var checkTextMatches = this.options.tokenize && this.options.matchAllTokens ? numTextMatches >= tokenSearchers.length : true;\n\n this._log('\\nCheck Matches: ' + checkTextMatches);\n\n // If a match is found, add the item to , including its score\n if ((exists || mainSearchResult.isMatch) && checkTextMatches) {\n // Check if the item already exists in our results\n var existingResult = resultMap[index];\n if (existingResult) {\n // Use the lowest score\n // existingResult.score, bitapResult.score\n existingResult.output.push({\n key: key,\n arrayIndex: arrayIndex,\n value: value,\n score: finalScore,\n matchedIndices: mainSearchResult.matchedIndices\n });\n } else {\n // Add it to the raw result list\n resultMap[index] = {\n item: record,\n output: [{\n key: key,\n arrayIndex: arrayIndex,\n value: value,\n score: finalScore,\n matchedIndices: mainSearchResult.matchedIndices\n }]\n };\n\n results.push(resultMap[index]);\n }\n }\n } else if (isArray(value)) {\n for (var _i3 = 0, len = value.length; _i3 < len; _i3 += 1) {\n this._analyze({\n key: key,\n arrayIndex: _i3,\n value: value[_i3],\n record: record,\n index: index\n }, {\n resultMap: resultMap,\n results: results,\n tokenSearchers: tokenSearchers,\n fullSearcher: fullSearcher\n });\n }\n }\n }\n }, {\n key: '_computeScore',\n value: function _computeScore(weights, results) {\n this._log('\\n\\nComputing score:\\n');\n\n for (var i = 0, len = results.length; i < len; i += 1) {\n var output = results[i].output;\n var scoreLen = output.length;\n\n var totalScore = 0;\n var bestScore = 1;\n\n for (var j = 0; j < scoreLen; j += 1) {\n var weight = weights ? weights[output[j].key].weight : 1;\n var score = weight === 1 ? output[j].score : output[j].score || 0.001;\n var nScore = score * weight;\n\n if (weight !== 1) {\n bestScore = Math.min(bestScore, nScore);\n } else {\n output[j].nScore = nScore;\n totalScore += nScore;\n }\n }\n\n results[i].score = bestScore === 1 ? totalScore / scoreLen : bestScore;\n\n this._log(results[i]);\n }\n }\n }, {\n key: '_sort',\n value: function _sort(results) {\n this._log('\\n\\nSorting....');\n results.sort(this.options.sortFn);\n }\n }, {\n key: '_format',\n value: function _format(results) {\n var finalOutput = [];\n\n this._log('\\n\\nOutput:\\n\\n', JSON.stringify(results));\n\n var transformers = [];\n\n if (this.options.includeMatches) {\n transformers.push(function (result, data) {\n var output = result.output;\n data.matches = [];\n\n for (var i = 0, len = output.length; i < len; i += 1) {\n var item = output[i];\n\n if (item.matchedIndices.length === 0) {\n continue;\n }\n\n var obj = {\n indices: item.matchedIndices,\n value: item.value\n };\n if (item.key) {\n obj.key = item.key;\n }\n if (item.hasOwnProperty('arrayIndex') && item.arrayIndex > -1) {\n obj.arrayIndex = item.arrayIndex;\n }\n data.matches.push(obj);\n }\n });\n }\n\n if (this.options.includeScore) {\n transformers.push(function (result, data) {\n data.score = result.score;\n });\n }\n\n for (var i = 0, len = results.length; i < len; i += 1) {\n var result = results[i];\n\n if (this.options.id) {\n result.item = this.options.getFn(result.item, this.options.id)[0];\n }\n\n if (!transformers.length) {\n finalOutput.push(result.item);\n continue;\n }\n\n var data = {\n item: result.item\n };\n\n for (var j = 0, _len2 = transformers.length; j < _len2; j += 1) {\n transformers[j](result, data);\n }\n\n finalOutput.push(data);\n }\n\n return finalOutput;\n }\n }, {\n key: '_log',\n value: function _log() {\n if (this.options.verbose) {\n var _console;\n\n (_console = console).log.apply(_console, arguments);\n }\n }\n }]);\n\n return Fuse;\n}();\n\nmodule.exports = Fuse;\n\n/***/ })\n/******/ ]);\n});\n//# sourceMappingURL=fuse.js.map\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/fuse.js/dist/fuse.js\n// module id = 3\n// module chunks = 0","/** Detect free variable `global` from Node.js. */\nvar freeGlobal = typeof global == 'object' && global && global.Object === Object && global;\n\nexport default freeGlobal;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/redux/node_modules/lodash-es/_freeGlobal.js\n// module id = 4\n// module chunks = 0","module.exports = require('./lib/index');\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/redux/node_modules/symbol-observable/index.js\n// module id = 5\n// module chunks = 0","'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _ponyfill = require('./ponyfill');\n\nvar _ponyfill2 = _interopRequireDefault(_ponyfill);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\nvar root; /* global window */\n\n\nif (typeof self !== 'undefined') {\n root = self;\n} else if (typeof window !== 'undefined') {\n root = window;\n} else if (typeof global !== 'undefined') {\n root = global;\n} else if (typeof module !== 'undefined') {\n root = module;\n} else {\n root = Function('return this')();\n}\n\nvar result = (0, _ponyfill2['default'])(root);\nexports['default'] = result;\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/redux/node_modules/symbol-observable/lib/index.js\n// module id = 6\n// module chunks = 0","module.exports = function(module) {\n\tif(!module.webpackPolyfill) {\n\t\tmodule.deprecate = function() {};\n\t\tmodule.paths = [];\n\t\t// module.parent = undefined by default\n\t\tif(!module.children) module.children = [];\n\t\tObject.defineProperty(module, \"loaded\", {\n\t\t\tenumerable: true,\n\t\t\tget: function() {\n\t\t\t\treturn module.l;\n\t\t\t}\n\t\t});\n\t\tObject.defineProperty(module, \"id\", {\n\t\t\tenumerable: true,\n\t\t\tget: function() {\n\t\t\t\treturn module.i;\n\t\t\t}\n\t\t});\n\t\tmodule.webpackPolyfill = 1;\n\t}\n\treturn module;\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// (webpack)/buildin/module.js\n// module id = 7\n// module chunks = 0","'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n\tvalue: true\n});\nexports['default'] = symbolObservablePonyfill;\nfunction symbolObservablePonyfill(root) {\n\tvar result;\n\tvar _Symbol = root.Symbol;\n\n\tif (typeof _Symbol === 'function') {\n\t\tif (_Symbol.observable) {\n\t\t\tresult = _Symbol.observable;\n\t\t} else {\n\t\t\tresult = _Symbol('observable');\n\t\t\t_Symbol.observable = result;\n\t\t}\n\t} else {\n\t\tresult = '@@observable';\n\t}\n\n\treturn result;\n};\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/redux/node_modules/symbol-observable/lib/ponyfill.js\n// module id = 8\n// module chunks = 0","/*!\n Copyright (c) 2016 Jed Watson.\n Licensed under the MIT License (MIT), see\n http://jedwatson.github.io/classnames\n*/\n/* global define */\n\n(function () {\n\t'use strict';\n\n\tvar hasOwn = {}.hasOwnProperty;\n\n\tfunction classNames () {\n\t\tvar classes = [];\n\n\t\tfor (var i = 0; i < arguments.length; i++) {\n\t\t\tvar arg = arguments[i];\n\t\t\tif (!arg) continue;\n\n\t\t\tvar argType = typeof arg;\n\n\t\t\tif (argType === 'string' || argType === 'number') {\n\t\t\t\tclasses.push(arg);\n\t\t\t} else if (Array.isArray(arg)) {\n\t\t\t\tclasses.push(classNames.apply(null, arg));\n\t\t\t} else if (argType === 'object') {\n\t\t\t\tfor (var key in arg) {\n\t\t\t\t\tif (hasOwn.call(arg, key) && arg[key]) {\n\t\t\t\t\t\tclasses.push(key);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn classes.join(' ');\n\t}\n\n\tif (typeof module !== 'undefined' && module.exports) {\n\t\tmodule.exports = classNames;\n\t} else if (typeof define === 'function' && typeof define.amd === 'object' && define.amd) {\n\t\t// register as 'classnames', consistent with npm package name\n\t\tdefine('classnames', [], function () {\n\t\t\treturn classNames;\n\t\t});\n\t} else {\n\t\twindow.classNames = classNames;\n\t}\n}());\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/classnames/index.js\n// module id = 9\n// module chunks = 0","/* eslint-disable */\n(function () {\n // Production steps of ECMA-262, Edition 6, 22.1.2.1\n // Reference: https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.from\n if (!Array.from) {\n Array.from = (function() {\n let toStr = Object.prototype.toString;\n\n let isCallable = function(fn) {\n return typeof fn === 'function' || toStr.call(fn) === '[object Function]';\n };\n\n let toInteger = function(value) {\n let number = Number(value);\n if (isNaN(number)) {\n return 0;\n }\n if (number === 0 || !isFinite(number)) {\n return number;\n }\n return (number > 0 ? 1 : -1) * Math.floor(Math.abs(number));\n };\n\n let maxSafeInteger = Math.pow(2, 53) - 1;\n\n let toLength = function(value) {\n let len = toInteger(value);\n return Math.min(Math.max(len, 0), maxSafeInteger);\n };\n\n // The length property of the from method is 1.\n return function from(arrayLike /* , mapFn, thisArg */) {\n // 1. Let C be the this value.\n let C = this;\n\n // 2. Let items be ToObject(arrayLike).\n let items = Object(arrayLike);\n\n // 3. ReturnIfAbrupt(items).\n if (arrayLike == null) {\n throw new TypeError('Array.from requires an array-like object - not null or undefined');\n }\n\n // 4. If mapfn is undefined, then let mapping be false.\n let mapFn = arguments.length > 1 ? arguments[1] : void undefined;\n let T;\n if (typeof mapFn !== 'undefined') {\n // 5. else\n // 5. a If IsCallable(mapfn) is false, throw a TypeError exception.\n if (!isCallable(mapFn)) {\n throw new TypeError('Array.from: when provided, the second argument must be a function');\n }\n\n // 5. b. If thisArg was supplied, let T be thisArg; else let T be undefined.\n if (arguments.length > 2) {\n T = arguments[2];\n }\n }\n\n // 10. Let lenValue be Get(items, \"length\").\n // 11. Let len be ToLength(lenValue).\n let len = toLength(items.length);\n\n // 13. If IsConstructor(C) is true, then\n // 13. a. Let A be the result of calling the [[Construct]] internal method of C with an argument list containing the single item len.\n // 14. a. Else, Let A be ArrayCreate(len).\n let A = isCallable(C) ? Object(new C(len)) : new Array(len);\n\n // 16. Let k be 0.\n let k = 0;\n // 17. Repeat, while k < len… (also steps a - h)\n let kValue;\n while (k < len) {\n kValue = items[k];\n if (mapFn) {\n A[k] = typeof T === 'undefined' ? mapFn(kValue, k) : mapFn.call(T, kValue, k);\n } else {\n A[k] = kValue;\n }\n k += 1;\n }\n // 18. Let putStatus be Put(A, \"length\", len, true).\n A.length = len;\n // 20. Return A.\n return A;\n };\n }());\n }\n\n // Reference: https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Array/find\n if (!Array.prototype.find) {\n Array.prototype.find = function(predicate) {\n 'use strict';\n\n if (this == null) {\n throw new TypeError('Array.prototype.find called on null or undefined');\n }\n if (typeof predicate !== 'function') {\n throw new TypeError('predicate must be a function');\n }\n let list = Object(this);\n let length = list.length >>> 0;\n let thisArg = arguments[1];\n let value;\n\n for (let i = 0; i < length; i++) {\n value = list[i];\n if (predicate.call(thisArg, value, i, list)) {\n return value;\n }\n }\n return undefined;\n };\n }\n\n function CustomEvent (event, params) {\n params = params || {\n bubbles: false,\n cancelable: false,\n detail: undefined,\n };\n let evt = document.createEvent('CustomEvent');\n evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail);\n return evt;\n }\n\n CustomEvent.prototype = window.Event.prototype;\n\n window.CustomEvent = CustomEvent;\n}());\n\n\n\n// WEBPACK FOOTER //\n// src/scripts/src/lib/polyfills.js"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACVA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;A;;;;AC7DA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;;;;;;;;;;ACpBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;ACRA;AACA;AACA;AACA;AACA;AACA;;;ACLA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AC7CA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;ACrBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AC3BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;ACdA;AACA;AACA;AACA;AACA;AACA;;;ACLA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AC5BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;AC7DA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACvPA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACpBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACjIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC9CA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC/BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC/CA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;AChBA;AACA;AACA;AAAA;AAAA;AACA;AAAA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAVA;AACA;AAYA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AAhDA;AAkDA;;;;ACrDA;AACA;AACA;AAAA;AAAA;AACA;AAAA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AAJA;AAMA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AAhBA;AAkBA;;;;ACrBA;AACA;AACA;AAAA;AAAA;AACA;AAAA;AACA;AAAA;AACA;;;;;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAZA;AAcA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AA/FA;AAiGA;;ACpGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAHA;AACA;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;ACxBA;AACA;AACA;AACA;AACA;AAAA;AACA;AAAA;AAMA;AACA;AACA;;;;;;;;;AAKA;AACA;AACA;AACA;AACA;;;;;;;;AAKA;AACA;AACA;AACA;AACA;;;;;;;AAIA;AACA;AACA;AACA;AACA;;;;;;;AAIA;AACA;AACA;AACA;AACA;AACA;;;;;;;AAIA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;;;;;;;AAIA;AAAA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;AAIA;AACA;AACA;AACA;AACA;AACA;;;;;;;AAIA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;;;;;;;AAIA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;;;;;;;AAIA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;;;;;;;AAIA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;AAIA;AACA;AACA;AAEA;AAAA;AACA;AACA;AACA;AACA;AACA;;;;;;;AAIA;AACA;AACA;AACA;AACA;AACA;;;;;;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;AAKA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;;;;;;AA7KA;;;;;;ACHA;AACA;AAAA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA;AACA;AACA;AACA;AACA;;;;;;;;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;AAIA;AACA;AACA;AACA;AACA;;;;;;;;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;AAKA;AACA;AACA;AACA;AACA;AACA;;;;;;AAvDA;;;;;;ACAA;AACA;AAAA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA;AACA;AACA;AACA;AACA;;;;;;AAGA;AACA;AACA;AACA;AACA;AACA;;;;AAIA;AACA;;;AAAA;AACA;AACA;AACA;AACA;AACA;;;;;;AAGA;AACA;AACA;AACA;AACA;;;;;;AAGA;AACA;AACA;AACA;AACA;;;;;;;;;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;AAIA;AACA;AACA;AACA;AACA;;;;;;AAGA;AACA;AACA;;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAEA;AACA;AACA;AACA;AACA;;;AAEA;AACA;AACA;;;AAEA;AACA;AACA;AACA;AACA;;;;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAEA;AACA;AACA;AAIA;AACA;AACA;AACA;AACA;;;;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;AAGA;AACA;AACA;AACA;AACA;;;;;;AA3LA;;;;ACAA;AACA;AACA;;;;;AAKA;AACA;AAAA;AAAA;AACA;AACA;AACA;;;;;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;;;;;;AAMA;AACA;AACA;AACA;AACA;;;;;;AAMA;AACA;AACA;AACA;AACA;AACA;;;;;AAKA;AAAA;AAAA;AACA;AAIA;;;;;AAKA;AAAA;AAEA;AAFA;AACA;AAIA;;;;;AAKA;AACA;AACA;AACA;AACA;;;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;AAIA;AACA;AAAA;AACA;AAEA;AACA;AACA;AACA;AACA;AAJA;AACA;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;AAIA;AACA;AAAA;AACA;AAEA;AACA;AACA;AACA;AACA;AAJA;AACA;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;AAQA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;AAMA;AACA;AACA;AACA;AACA;AACA;;;;;;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;AAOA;AACA;AACA;AACA;AAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;AAOA;AAAA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;AAMA;AACA;AACA;AACA;AACA;AACA;;;;;;;AAOA;AAAA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;;;;;;AAMA;AACA;AACA;AACA;AACA;;;;;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;AAQA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;AAQA;AAAA;AAAA;AACA;AACA;;;;;;;AAOA;AAAA;AACA;AAAA;AACA;AACA;AACA;AAHA;AACA;AAKA;AACA;AACA;AACA;;;;;;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;ACvkBA;AACA;AACA;AACA;AAAA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA;AACA;AACA;;;AAEA;AACA;AACA;AACA;AACA;AACA;;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;AAGA;AACA;AACA;AACA;AACA;;;;;;AAGA;AACA;AACA;;;AAEA;AACA;AACA;AACA;AACA;AACA;;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAEA;AACA;AACA;AACA;;;AAEA;AACA;AACA;AACA;;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;AAKA;AAAA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;AAKA;AACA;AACA;AACA;AACA;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAEA;AACA;AACA;;;AAEA;AACA;AACA;;;AAEA;AACA;AACA;;;AAEA;AACA;AACA;;;AAEA;AACA;AACA;;;AAEA;AACA;AACA;;;;;;AAnKA;;;;;;ACFA;AACA;AAAA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA;AACA;AACA;AACA;AACA;;;;;;AAGA;AACA;AACA;AACA;AACA;;;;;;AAGA;AAAA;AACA;AAAA;AACA;AACA;;;;;;AAGA;AACA;AACA;AACA;AACA;;;;;;;AAIA;AACA;AACA;;;;;;AAxCA;;;;;;ACAA;AACA;AACA;AACA;AAAA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;;;AACA;AACA;AACA;;;AAEA;AACA;AACA;;;AAEA;AACA;AACA;AACA;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAEA;AACA;AACA;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAEA;AACA;AACA;AACA;AACA;;;AAEA;AACA;AACA;AACA;AACA;;;AAEA;AACA;AACA;;;;;;AA5EA;;;;;;;;;;;;ACFA;AACA;AACA;;;AACA;AAAA;AACA;AADA;AACA;AACA;AACA;AACA;AAJA;AAKA;AACA;;;AACA;AACA;AACA;;;AAEA;AACA;AACA;;;AAEA;AACA;AACA;;;AAEA;AACA;AACA;;;AAEA;AACA;AACA;;;AAEA;AACA;AACA;AACA;;;;AA/BA;AACA;AADA;;;;;;;;;;;;ACFA;AACA;AACA;;;AACA;AAAA;AACA;AADA;AACA;AACA;AACA;AACA;AAJA;AAKA;AACA;;;AACA;AACA;AACA;;;AAEA;AACA;AACA;;;AAEA;AACA;AACA;;;AAEA;AACA;AACA;;;AAEA;AACA;AACA;;;AAEA;AACA;AACA;AACA;;;AAEA;AACA;AACA;;;AAEA;AACA;AACA;;;AAEA;AACA;AACA;;;;AA3CA;AACA;AADA;;;ACDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA1BA;AACA;AA4BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AAAA;AAAA;AACA;AACA;AACA;AADA;AAGA;AACA;AAtCA;AACA;AAwCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AARA;AACA;AAUA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AATA;AACA;AAWA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AATA;AACA;AAWA;;;;;;;;AC1GA;AACA;AACA;AACA;AACA;AAQA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAaA;AACA;AACA;AAGA;AACA;AAAA;AACA;AAAA;AACA;AAMA;AAGA;AACA;AACA;AAKA;AACA;AAAA;AACA;AAAA;AACA;AACA;AACA;AACA;AAOA;AAAA;AACA;AAAA;AACA;AAOA;AAqBA;AACA;AACA;AAYA;AACA;AACA;AACA;AAGA;AASA;AACA;AACA;AACA;AACA;AAKA;AAYA;AACA;AAAA;AACA;AAAA;AACA;AACA;AAQA;AAiBA;AACA;AACA;AACA;AAIA;AAWA;AACA;AACA;AACA;AAIA;AAOA;AACA;AAAA;AACA;AADA;AACA;AAAA;AACA;AAOA;AAKA;AACA;AACA;AAGA;AArOA;AACA;AAuOA;;AC3OA;AACA;AACA;AAAA;AAWA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAVA;AAVA;AACA;AAsBA;AAAA;AACA;AACA;AAFA;AAAA;AACA;AAIA;AAAA;AAAA;AACA;AACA;AAFA;AAAA;AACA;AAIA;AAAA;AACA;AADA;AAAA;;ACnCA;AACA;AACA;AAAA;AAUA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AATA;AATA;AACA;AAoBA;AAAA;AACA;AACA;AACA;AAHA;AAAA;AACA;AAKA;AAAA;AACA;AACA;AACA;AAHA;AAAA;;AC7BA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AALA;AAAA;;ACHA;AACA;AAAA;AACA;AADA;AAAA;;;;;;;;;;;;;;;;ACDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAeA;AACA;AACA;;;;AAGA;AACA;AAAA;AAAA;AACA;AADA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AALA;AACA;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AADA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;AAIA;;;;;;;;;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;AAQA;AAAA;AACA;AAAA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AALA;AACA;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;AAOA;AAAA;AACA;AADA;AACA;AAAA;AACA;AAFA;AAAA;AAAA;AAAA;AACA;AAGA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AAtBA;AAuBA;AACA;AACA;AACA;AACA;AACA;AACA;AA7BA;AAAA;AACA;AA8BA;AACA;AACA;AADA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;AAOA;AAAA;AACA;AADA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;;;;;;;;AAKA;AACA;AACA;AACA;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AACA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;AAOA;AAAA;AACA;AAAA;AACA;AACA;AACA;AAJA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAJA;AAMA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;AAMA;AACA;AACA;AACA;AACA;AAJA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAJA;AACA;AAMA;AACA;AACA;AACA;;;;;;;;AAKA;AAAA;AACA;AAAA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;;;;;;;;AAKA;AAAA;AACA;AAAA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;;;;;;;;;AAMA;AAAA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;AAOA;AAAA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;AAMA;AAAA;AACA;AADA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;AAKA;AAAA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;AAKA;AAAA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;AAOA;AAAA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;AAOA;AAAA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;AAMA;AAAA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;AASA;AAAA;AAAA;AACA;AADA;AACA;AADA;AAAA;AACA;AAAA;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAMA;AACA;AASA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;AAMA;AACA;AACA;AACA;AACA;AACA;;;;;;;;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;AAMA;AAAA;AACA;AAAA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;AAIA;;;;;;;;;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AADA;AAGA;AACA;AACA;;;;;;AAGA;AACA;AACA;AACA;AACA;AAQA;AACA;AACA;AACA;AAEA;;;;;;;;;;AAOA;AACA;AAMA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;AAQA;AAAA;AACA;AADA;AACA;AAAA;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AADA;AACA;AAGA;AACA;AACA;AACA;AACA;AASA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;AAMA;AAAA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;;;;;;;;;;AAOA;AACA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAKA;AACA;AAGA;AACA;AACA;AACA;AACA;AAFA;AAIA;AACA;AACA;;;;;;;;AAKA;AAAA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAMA;AACA;AASA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;AAMA;AACA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAFA;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;AAKA;AAAA;AAAA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAWA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;AAMA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAKA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;AAMA;AAAA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AApBA;AACA;AAsBA;AACA;AACA;AACA;;;;;;;;;AAMA;AAAA;AACA;AAAA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAnCA;AACA;AAqCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;AAOA;AAAA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;AAMA;AAAA;AACA;AADA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;AAWA;AAOA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAYA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AALA;AAOA;AACA;AACA;AACA;AACA;AACA;AAJA;AAMA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAJA;AAMA;AACA;AACA;AACA;AACA;AAHA;AAKA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;AAYA;AAQA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAaA;AACA;AASA;AACA;AACA;AACA;;;;;;;;AAKA;AACA;AAGA;AACA;AACA;;;;;;;;;;;;AASA;AAAA;AACA;AADA;AAAA;AACA;AAAA;AAGA;AACA;AACA;AACA;AACA;AACA;AAQA;AACA;AACA;AASA;AACA;AACA;AACA;AACA;AAQA;AACA;AACA;AACA;;;;;;;;;;AAOA;AAAA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AANA;AAAA;AAAA;AACA;AAKA;AACA;AACA;AACA;;;;;;;;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;AAKA;AACA;AACA;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAEA;AAAA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAOA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AALA;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AASA;AACA;AACA;AASA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;;;AAEA;AAAA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AAQA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;;;AAEA;AAAA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAQA;AACA;AAQA;AACA;AACA;AACA;AACA;AAOA;AACA;AACA;AACA;AAxCA;AACA;AA0CA;AACA;;;AAEA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AASA;AACA;AACA;AACA;AACA;;;;;;AAl0EA;AACA;AACA;AAk0EA;;;;;;ACt2EA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;ACn+BA;AACA;AACA;AACA;;;;;;;;ACHA;;;;;;;;ACAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;AC5BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;ACrBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;ACtBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;;;;;;;AC/CA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAHA;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;A","sourceRoot":""}
\ No newline at end of file
+{"version":3,"file":"choices.js","sources":["webpack:///webpack/universalModuleDefinition","webpack:///webpack/bootstrap f3512a4742af79116cbf","webpack:///src/scripts/src/lib/utils.js","webpack:///src/scripts/src/constants.js","webpack:///./node_modules/redux/node_modules/lodash-es/_root.js","webpack:///./node_modules/redux/node_modules/lodash-es/_Symbol.js","webpack:///./node_modules/redux/node_modules/lodash-es/_getRawTag.js","webpack:///./node_modules/redux/node_modules/lodash-es/_objectToString.js","webpack:///./node_modules/redux/node_modules/lodash-es/_baseGetTag.js","webpack:///./node_modules/redux/node_modules/lodash-es/_overArg.js","webpack:///./node_modules/redux/node_modules/lodash-es/_getPrototype.js","webpack:///./node_modules/redux/node_modules/lodash-es/isObjectLike.js","webpack:///./node_modules/redux/node_modules/lodash-es/isPlainObject.js","webpack:///./node_modules/redux/es/createStore.js","webpack:///./node_modules/redux/es/utils/warning.js","webpack:///./node_modules/redux/es/combineReducers.js","webpack:///./node_modules/redux/es/bindActionCreators.js","webpack:///./node_modules/redux/es/compose.js","webpack:///./node_modules/redux/es/applyMiddleware.js","webpack:///./node_modules/redux/es/index.js","webpack:///(webpack)/buildin/global.js","webpack:///src/scripts/src/components/wrapped-element.js","webpack:///src/scripts/src/choices.js","webpack:///./node_modules/fuse.js/dist/fuse.js","webpack:///src/scripts/src/store/store.js","webpack:///./node_modules/redux/node_modules/lodash-es/_freeGlobal.js","webpack:///./node_modules/redux/node_modules/symbol-observable/index.js","webpack:///./node_modules/redux/node_modules/symbol-observable/lib/index.js","webpack:///(webpack)/buildin/module.js","webpack:///./node_modules/redux/node_modules/symbol-observable/lib/ponyfill.js","webpack:///src/scripts/src/reducers/index.js","webpack:///src/scripts/src/reducers/items.js","webpack:///src/scripts/src/reducers/groups.js","webpack:///src/scripts/src/reducers/choices.js","webpack:///src/scripts/src/components/dropdown.js","webpack:///src/scripts/src/components/container.js","webpack:///src/scripts/src/components/input.js","webpack:///src/scripts/src/components/list.js","webpack:///src/scripts/src/components/wrapped-input.js","webpack:///src/scripts/src/components/wrapped-select.js","webpack:///src/scripts/src/templates.js","webpack:///./node_modules/classnames/index.js","webpack:///src/scripts/src/actions/choices.js","webpack:///src/scripts/src/actions/items.js","webpack:///src/scripts/src/actions/groups.js","webpack:///src/scripts/src/actions/misc.js","webpack:///src/scripts/src/lib/polyfills.js"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n //CommonJS2\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n //AMD\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n //CommonJS\n\telse if(typeof exports === 'object')\n\t\texports[\"Choices\"] = factory();\n //Window\n\telse\n\t\troot[\"Choices\"] = factory();\n})(this, function() {\nreturn \n\n\n// WEBPACK FOOTER //\n// webpack/universalModuleDefinition"," \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, {\n \t\t\t\tconfigurable: false,\n \t\t\t\tenumerable: true,\n \t\t\t\tget: getter\n \t\t\t});\n \t\t}\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"/src/scripts/dist/\";\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 5);\n\n\n\n// WEBPACK FOOTER //\n// webpack/bootstrap f3512a4742af79116cbf","/* eslint-disable */\n\n/**\n * Capitalises the first letter of each word in a string\n * @param {String} str String to capitalise\n * @return {String} Capitalised string\n */\nexport const capitalise = function(str) {\n return str.replace(/\\w\\S*/g, txt => txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase());\n};\n\n/**\n * Generates a string of random chars\n * @param {Number} length Length of the string to generate\n * @return {String} String of random chars\n */\nexport const generateChars = function(length) {\n let chars = '';\n\n for (let i = 0; i < length; i++) {\n const randomChar = getRandomNumber(0, 36);\n chars += randomChar.toString(36);\n }\n\n return chars;\n};\n\n/**\n * Generates a unique id based on an element\n * @param {HTMLElement} element Element to generate the id from\n * @param {String} Prefix for the Id\n * @return {String} Unique Id\n */\nexport const generateId = function(element, prefix) {\n let id = element.id || (element.name && (`${element.name}-${generateChars(2)}`)) || generateChars(4);\n id = id.replace(/(:|\\.|\\[|\\]|,)/g, '');\n id = prefix + id;\n\n return id;\n};\n\n\n/**\n * Tests the type of an object\n * @param {String} type Type to test object against\n * @param {Object} obj Object to be tested\n * @return {Boolean}\n */\nexport const getType = function(obj) {\n return Object.prototype.toString.call(obj).slice(8, -1);\n};\n\n/**\n * Tests the type of an object\n * @param {String} type Type to test object against\n * @param {Object} obj Object to be tested\n * @return {Boolean}\n */\nexport const isType = function(type, obj) {\n const clas = getType(obj);\n return obj !== undefined && obj !== null && clas === type;\n};\n\n/**\n * Tests to see if a passed object is a node\n * @param {Object} obj Object to be tested\n * @return {Boolean}\n */\nexport const isNode = o => (\n typeof Node === 'object' ? o instanceof Node :\n o && typeof o === 'object' && typeof o.nodeType === 'number' && typeof o.nodeName === 'string'\n );\n\n/**\n * Tests to see if a passed object is an element\n * @param {Object} obj Object to be tested\n * @return {Boolean}\n */\nexport const isElement = o => (\n typeof HTMLElement === 'object' ? o instanceof HTMLElement : // DOM2\n o && typeof o === 'object' && o !== null && o.nodeType === 1 && typeof o.nodeName === 'string'\n );\n\n/**\n * Merges unspecified amount of objects into new object\n * @private\n * @return {Object} Merged object of arguments\n */\nexport const extend = function() {\n const extended = {};\n const length = arguments.length;\n\n /**\n * Merge one object into another\n * @param {Object} obj Object to merge into extended object\n */\n const merge = function(obj) {\n for (const prop in obj) {\n if (Object.prototype.hasOwnProperty.call(obj, prop)) {\n // If deep merge and property is an object, merge properties\n if (isType('Object', obj[prop])) {\n extended[prop] = extend(true, extended[prop], obj[prop]);\n } else {\n extended[prop] = obj[prop];\n }\n }\n }\n };\n\n // Loop through each passed argument\n for (let i = 0; i < length; i++) {\n // store argument at position i\n const obj = arguments[i];\n\n // If we are in fact dealing with an object, merge it.\n if (isType('Object', obj)) {\n merge(obj);\n }\n }\n\n return extended;\n};\n\n/**\n * CSS transition end event listener\n * @return\n */\nexport const whichTransitionEvent = function() {\n let t,\n el = document.createElement('fakeelement');\n\n const transitions = {\n transition: 'transitionend',\n OTransition: 'oTransitionEnd',\n MozTransition: 'transitionend',\n WebkitTransition: 'webkitTransitionEnd',\n };\n\n for (t in transitions) {\n if (el.style[t] !== undefined) {\n return transitions[t];\n }\n }\n};\n\n/**\n * CSS animation end event listener\n * @return\n */\nexport const whichAnimationEvent = function() {\n let t,\n el = document.createElement('fakeelement');\n\n const animations = {\n animation: 'animationend',\n OAnimation: 'oAnimationEnd',\n MozAnimation: 'animationend',\n WebkitAnimation: 'webkitAnimationEnd',\n };\n\n for (t in animations) {\n if (el.style[t] !== undefined) {\n return animations[t];\n }\n }\n};\n\n/**\n * Get the ancestors of each element in the current set of matched elements,\n * up to but not including the element matched by the selector\n * @param {NodeElement} elem Element to begin search from\n * @param {NodeElement} parent Parent to find\n * @param {String} selector Class to find\n * @return {Array} Array of parent elements\n */\nexport const getParentsUntil = function(elem, parent, selector) {\n const parents = [];\n // Get matches\n for (; elem && elem !== document; elem = elem.parentNode) {\n // Check if parent has been reached\n if (parent) {\n const parentType = parent.charAt(0);\n\n // If parent is a class\n if (parentType === '.') {\n if (elem.classList.contains(parent.substr(1))) {\n break;\n }\n }\n\n // If parent is an ID\n if (parentType === '#') {\n if (elem.id === parent.substr(1)) {\n break;\n }\n }\n\n // If parent is a data attribute\n if (parentType === '[') {\n if (elem.hasAttribute(parent.substr(1, parent.length - 1))) {\n break;\n }\n }\n\n // If parent is a tag\n if (elem.tagName.toLowerCase() === parent) {\n break;\n }\n }\n if (selector) {\n const selectorType = selector.charAt(0);\n\n // If selector is a class\n if (selectorType === '.') {\n if (elem.classList.contains(selector.substr(1))) {\n parents.push(elem);\n }\n }\n\n // If selector is an ID\n if (selectorType === '#') {\n if (elem.id === selector.substr(1)) {\n parents.push(elem);\n }\n }\n\n // If selector is a data attribute\n if (selectorType === '[') {\n if (elem.hasAttribute(selector.substr(1, selector.length - 1))) {\n parents.push(elem);\n }\n }\n\n // If selector is a tag\n if (elem.tagName.toLowerCase() === selector) {\n parents.push(elem);\n }\n } else {\n parents.push(elem);\n }\n }\n\n // Return parents if any exist\n if (parents.length === 0) {\n return null;\n }\n return parents;\n};\n\nexport const wrap = function(element, wrapper) {\n wrapper = wrapper || document.createElement('div');\n if (element.nextSibling) {\n element.parentNode.insertBefore(wrapper, element.nextSibling);\n } else {\n element.parentNode.appendChild(wrapper);\n }\n return wrapper.appendChild(element);\n};\n\nexport const getSiblings = function(elem) {\n const siblings = [];\n let sibling = elem.parentNode.firstChild;\n for (; sibling; sibling = sibling.nextSibling) {\n if (sibling.nodeType === 1 && sibling !== elem) {\n siblings.push(sibling);\n }\n }\n return siblings;\n};\n\n/**\n * Find ancestor in DOM tree\n * @param {NodeElement} el Element to start search from\n * @param {[type]} cls Class of parent\n * @return {NodeElement} Found parent element\n */\nexport const findAncestor = function(el, cls) {\n while ((el = el.parentElement) && !el.classList.contains(cls));\n return el;\n};\n\n/**\n * Find ancestor in DOM tree by attribute name\n * @param {NodeElement} el Element to start search from\n * @param {string} attr Attribute name of parent\n * @return {?NodeElement} Found parent element or null\n */\nexport const findAncestorByAttrName = function(el, attr) {\n let target = el;\n\n while (target) {\n if (target.hasAttribute(attr)) {\n return target;\n }\n\n target = target.parentElement;\n }\n\n return null;\n};\n\n/**\n * Debounce an event handler.\n * @param {Function} func Function to run after wait\n * @param {Number} wait The delay before the function is executed\n * @param {Boolean} immediate If passed, trigger the function on the leading edge, instead of the trailing.\n * @return {Function} A function will be called after it stops being called for a given delay\n */\nexport const debounce = function(func, wait, immediate) {\n let timeout;\n return function() {\n let context = this,\n args = arguments;\n const later = function() {\n timeout = null;\n if (!immediate) func.apply(context, args);\n };\n const callNow = immediate && !timeout;\n clearTimeout(timeout);\n timeout = setTimeout(later, wait);\n if (callNow) func.apply(context, args);\n };\n};\n\n/**\n * Get an element's distance from the top of the page\n * @private\n * @param {NodeElement} el Element to test for\n * @return {Number} Elements Distance from top of page\n */\nexport const getElemDistance = function(el) {\n let location = 0;\n if (el.offsetParent) {\n do {\n location += el.offsetTop;\n el = el.offsetParent;\n } while (el);\n }\n return location >= 0 ? location : 0;\n};\n\n/**\n * Determine element height multiplied by any offsets\n * @private\n * @param {HTMLElement} el Element to test for\n * @return {Number} Height of element\n */\nexport const getElementOffset = function(el, offset) {\n let elOffset = offset;\n if (elOffset > 1) elOffset = 1;\n if (elOffset > 0) elOffset = 0;\n\n return Math.max(el.offsetHeight * elOffset);\n};\n\n/**\n * Get the next or previous element from a given start point\n * @param {HTMLElement} startEl Element to start position from\n * @param {String} className The class we will look through\n * @param {Number} direction Positive next element, negative previous element\n * @return {[HTMLElement} Found element\n */\nexport const getAdjacentEl = (startEl, className, direction = 1) => {\n if (!startEl || !className) return;\n\n const parent = startEl.parentNode.parentNode;\n const children = Array.from(parent.querySelectorAll(className));\n\n const startPos = children.indexOf(startEl);\n const operatorDirection = direction > 0 ? 1 : -1;\n\n return children[startPos + operatorDirection];\n};\n\n/**\n * Get scroll position based on top/bottom position\n * @private\n * @return {String} Position of scroll\n */\nexport const getScrollPosition = function(position) {\n if (position === 'bottom') {\n // Scroll position from the bottom of the viewport\n return Math.max((window.scrollY || window.pageYOffset) + (window.innerHeight || document.documentElement.clientHeight));\n }\n // Scroll position from the top of the viewport\n return (window.scrollY || window.pageYOffset);\n};\n\n/**\n * Determine whether an element is within the viewport\n * @param {HTMLElement} el Element to test\n * @return {String} Position of scroll\n * @return {Boolean}\n */\nexport const isInView = function(el, position, offset) {\n // If the user has scrolled further than the distance from the element to the top of its parent\n return this.getScrollPosition(position) > (this.getElemDistance(el) + this.getElementOffset(el, offset));\n};\n\n/**\n * Determine whether an element is within\n * @param {HTMLElement} el Element to test\n * @param {HTMLElement} parent Scrolling parent\n * @param {Number} direction Whether element is visible from above or below\n * @return {Boolean}\n */\nexport const isScrolledIntoView = (el, parent, direction = 1) => {\n if (!el) return;\n\n let isVisible;\n\n if (direction > 0) {\n // In view from bottom\n isVisible = (parent.scrollTop + parent.offsetHeight) >= (el.offsetTop + el.offsetHeight);\n } else {\n // In view from top\n isVisible = el.offsetTop >= parent.scrollTop;\n }\n\n return isVisible;\n};\n\n/**\n * Remove html tags from a string\n * @param {String} Initial string/html\n * @return {String} Sanitised string\n */\nexport const stripHTML = function(html) {\n const el = document.createElement('DIV');\n el.innerHTML = html;\n return el.textContent || el.innerText || '';\n};\n\n/**\n * Adds animation to an element and removes it upon animation completion\n * @param {Element} el Element to add animation to\n * @param {String} animation Animation class to add to element\n * @return\n */\nexport const addAnimation = (el, animation) => {\n const animationEvent = whichAnimationEvent();\n\n const removeAnimation = () => {\n el.classList.remove(animation);\n el.removeEventListener(animationEvent, removeAnimation, false);\n };\n\n el.classList.add(animation);\n el.addEventListener(animationEvent, removeAnimation, false);\n};\n\n\n/**\n * Get a random number between a range\n * @param {Number} min Minimum range\n * @param {Number} max Maximum range\n * @return {Number} Random number\n */\nexport const getRandomNumber = function(min, max) {\n return Math.floor(Math.random() * (max - min) + min);\n};\n\n/**\n * Turn a string into a node\n * @param {String} String to convert\n * @return {HTMLElement} Converted node element\n */\nexport const strToEl = (function() {\n const tmpEl = document.createElement('div');\n return function(str) {\n const cleanedInput = str.trim();\n let r;\n tmpEl.innerHTML = cleanedInput;\n r = tmpEl.children[0];\n\n while (tmpEl.firstChild) {\n tmpEl.removeChild(tmpEl.firstChild);\n }\n\n return r;\n };\n}());\n\n/**\n * Sets the width of a passed input based on its value\n * @return {Number} Width of input\n */\nexport const getWidthOfInput = (input) => {\n const value = input.value || input.placeholder;\n let width = input.offsetWidth;\n\n if (value) {\n const testEl = strToEl(`${value} `);\n testEl.style.position = 'absolute';\n testEl.style.padding = '0';\n testEl.style.top = '-9999px';\n testEl.style.left = '-9999px';\n testEl.style.width = 'auto';\n testEl.style.whiteSpace = 'pre';\n\n if (document.body.contains(input) && window.getComputedStyle) {\n const inputStyle = window.getComputedStyle(input);\n\n if (inputStyle) {\n testEl.style.fontSize = inputStyle.fontSize;\n testEl.style.fontFamily = inputStyle.fontFamily;\n testEl.style.fontWeight = inputStyle.fontWeight;\n testEl.style.fontStyle = inputStyle.fontStyle;\n testEl.style.letterSpacing = inputStyle.letterSpacing;\n testEl.style.textTransform = inputStyle.textTransform;\n testEl.style.padding = inputStyle.padding;\n }\n }\n\n document.body.appendChild(testEl);\n\n if (value && testEl.offsetWidth !== input.offsetWidth) {\n width = testEl.offsetWidth + 4;\n }\n\n document.body.removeChild(testEl);\n }\n\n return `${width}px`;\n};\n\n/**\n * Sorting function for current and previous string\n * @param {String} a Current value\n * @param {String} b Next value\n * @return {Number} -1 for after previous,\n * 1 for before,\n * 0 for same location\n */\nexport const sortByAlpha = (a, b) => {\n const labelA = (a.label || a.value).toLowerCase();\n const labelB = (b.label || b.value).toLowerCase();\n\n if (labelA < labelB) return -1;\n if (labelA > labelB) return 1;\n return 0;\n};\n\n/**\n * Sort by numeric score\n * @param {Object} a Current value\n * @param {Object} b Next value\n * @return {Number} -1 for after previous,\n * 1 for before,\n * 0 for same location\n */\nexport const sortByScore = (a, b) => a.score - b.score;\n\n/**\n * Dispatch native event\n * @param {NodeElement} element Element to trigger event on\n * @param {String} type Type of event to trigger\n * @param {Object} customArgs Data to pass with event\n * @return {Object} Triggered event\n */\nexport const dispatchEvent = (element, type, customArgs = null) => {\n const event = new CustomEvent(type, {\n detail: customArgs,\n bubbles: true,\n cancelable: true,\n });\n\n return element.dispatchEvent(event);\n};\n\n/**\n * Tests value against a regular expression\n * @param {string} value Value to test\n * @return {Boolean} Whether test passed/failed\n * @private\n */\nexport const regexFilter = (value, regex) => {\n if (!value || !regex) {\n return false;\n }\n\n const expression = new RegExp(regex.source, 'i');\n return expression.test(value);\n};\n\n\n\n// WEBPACK FOOTER //\n// src/scripts/src/lib/utils.js","\nexport const DEFAULT_CLASSNAMES = {\n containerOuter: 'choices',\n containerInner: 'choices__inner',\n input: 'choices__input',\n inputCloned: 'choices__input--cloned',\n list: 'choices__list',\n listItems: 'choices__list--multiple',\n listSingle: 'choices__list--single',\n listDropdown: 'choices__list--dropdown',\n item: 'choices__item',\n itemSelectable: 'choices__item--selectable',\n itemDisabled: 'choices__item--disabled',\n itemChoice: 'choices__item--choice',\n placeholder: 'choices__placeholder',\n group: 'choices__group',\n groupHeading: 'choices__heading',\n button: 'choices__button',\n activeState: 'is-active',\n focusState: 'is-focused',\n openState: 'is-open',\n disabledState: 'is-disabled',\n highlightedState: 'is-highlighted',\n hiddenState: 'is-hidden',\n flippedState: 'is-flipped',\n loadingState: 'is-loading',\n noResults: 'has-no-results',\n noChoices: 'has-no-choices',\n};\n\nexport const DEFAULT_CONFIG = {\n silent: false,\n renderChoiceLimit: -1,\n maxItemCount: -1,\n addItems: true,\n removeItems: true,\n removeItemButton: false,\n editItems: false,\n duplicateItems: true,\n delimiter: ',',\n paste: true,\n searchEnabled: true,\n searchChoices: true,\n searchFloor: 1,\n searchResultLimit: 4,\n searchFields: ['label', 'value'],\n position: 'auto',\n resetScrollPosition: true,\n regexFilter: null,\n shouldSort: true,\n shouldSortItems: false,\n placeholder: true,\n placeholderValue: null,\n searchPlaceholderValue: null,\n prependValue: null,\n appendValue: null,\n renderSelectedChoices: 'auto',\n loadingText: 'Loading...',\n noResultsText: 'No results found',\n noChoicesText: 'No choices to choose from',\n itemSelectText: 'Press to select',\n addItemText: value => `Press Enter to add \"${value}\" `,\n maxItemText: maxItemCount => `Only ${maxItemCount} values can be added.`,\n uniqueItemText: 'Only unique values can be added.',\n fuseOptions: {\n includeScore: true,\n },\n callbackOnInit: null,\n callbackOnCreateTemplates: null,\n};\n\nexport const EVENTS = {\n showDropdown: 'showDropdown',\n hideDropdown: 'hideDropdown',\n change: 'change',\n choice: 'choice',\n search: 'search',\n addItem: 'addItem',\n removeItem: 'removeItem',\n highlightItem: 'highlightItem',\n};\n\nexport const ACTION_TYPES = {\n ADD_CHOICE: 'ADD_CHOICE',\n FILTER_CHOICES: 'FILTER_CHOICES',\n ACTIVATE_CHOICES: 'ACTIVATE_CHOICES',\n CLEAR_CHOICES: 'CLEAR_CHOICES',\n ADD_GROUP: 'ADD_GROUP',\n ADD_ITEM: 'ADD_ITEM',\n REMOVE_ITEM: 'REMOVE_ITEM',\n HIGHLIGHT_ITEM: 'HIGHLIGHT_ITEM',\n CLEAR_ALL: 'CLEAR_ALL',\n};\n\nexport const KEY_CODES = {\n BACK_KEY: 46,\n DELETE_KEY: 8,\n ENTER_KEY: 13,\n A_KEY: 65,\n ESC_KEY: 27,\n UP_KEY: 38,\n DOWN_KEY: 40,\n PAGE_UP_KEY: 33,\n PAGE_DOWN_KEY: 34,\n};\n\nexport const SCROLLING_SPEED = 4;\n\n\n\n// WEBPACK FOOTER //\n// src/scripts/src/constants.js","import freeGlobal from './_freeGlobal.js';\n\n/** Detect free variable `self`. */\nvar freeSelf = typeof self == 'object' && self && self.Object === Object && self;\n\n/** Used as a reference to the global object. */\nvar root = freeGlobal || freeSelf || Function('return this')();\n\nexport default root;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/redux/node_modules/lodash-es/_root.js\n// module id = null\n// module chunks = ","import root from './_root.js';\n\n/** Built-in value references. */\nvar Symbol = root.Symbol;\n\nexport default Symbol;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/redux/node_modules/lodash-es/_Symbol.js\n// module id = null\n// module chunks = ","import Symbol from './_Symbol.js';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar nativeObjectToString = objectProto.toString;\n\n/** Built-in value references. */\nvar symToStringTag = Symbol ? Symbol.toStringTag : undefined;\n\n/**\n * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the raw `toStringTag`.\n */\nfunction getRawTag(value) {\n var isOwn = hasOwnProperty.call(value, symToStringTag),\n tag = value[symToStringTag];\n\n try {\n value[symToStringTag] = undefined;\n var unmasked = true;\n } catch (e) {}\n\n var result = nativeObjectToString.call(value);\n if (unmasked) {\n if (isOwn) {\n value[symToStringTag] = tag;\n } else {\n delete value[symToStringTag];\n }\n }\n return result;\n}\n\nexport default getRawTag;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/redux/node_modules/lodash-es/_getRawTag.js\n// module id = null\n// module chunks = ","/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar nativeObjectToString = objectProto.toString;\n\n/**\n * Converts `value` to a string using `Object.prototype.toString`.\n *\n * @private\n * @param {*} value The value to convert.\n * @returns {string} Returns the converted string.\n */\nfunction objectToString(value) {\n return nativeObjectToString.call(value);\n}\n\nexport default objectToString;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/redux/node_modules/lodash-es/_objectToString.js\n// module id = null\n// module chunks = ","import Symbol from './_Symbol.js';\nimport getRawTag from './_getRawTag.js';\nimport objectToString from './_objectToString.js';\n\n/** `Object#toString` result references. */\nvar nullTag = '[object Null]',\n undefinedTag = '[object Undefined]';\n\n/** Built-in value references. */\nvar symToStringTag = Symbol ? Symbol.toStringTag : undefined;\n\n/**\n * The base implementation of `getTag` without fallbacks for buggy environments.\n *\n * @private\n * @param {*} value The value to query.\n * @returns {string} Returns the `toStringTag`.\n */\nfunction baseGetTag(value) {\n if (value == null) {\n return value === undefined ? undefinedTag : nullTag;\n }\n return (symToStringTag && symToStringTag in Object(value))\n ? getRawTag(value)\n : objectToString(value);\n}\n\nexport default baseGetTag;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/redux/node_modules/lodash-es/_baseGetTag.js\n// module id = null\n// module chunks = ","/**\n * Creates a unary function that invokes `func` with its argument transformed.\n *\n * @private\n * @param {Function} func The function to wrap.\n * @param {Function} transform The argument transform.\n * @returns {Function} Returns the new function.\n */\nfunction overArg(func, transform) {\n return function(arg) {\n return func(transform(arg));\n };\n}\n\nexport default overArg;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/redux/node_modules/lodash-es/_overArg.js\n// module id = null\n// module chunks = ","import overArg from './_overArg.js';\n\n/** Built-in value references. */\nvar getPrototype = overArg(Object.getPrototypeOf, Object);\n\nexport default getPrototype;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/redux/node_modules/lodash-es/_getPrototype.js\n// module id = null\n// module chunks = ","/**\n * Checks if `value` is object-like. A value is object-like if it's not `null`\n * and has a `typeof` result of \"object\".\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n * @example\n *\n * _.isObjectLike({});\n * // => true\n *\n * _.isObjectLike([1, 2, 3]);\n * // => true\n *\n * _.isObjectLike(_.noop);\n * // => false\n *\n * _.isObjectLike(null);\n * // => false\n */\nfunction isObjectLike(value) {\n return value != null && typeof value == 'object';\n}\n\nexport default isObjectLike;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/redux/node_modules/lodash-es/isObjectLike.js\n// module id = null\n// module chunks = ","import baseGetTag from './_baseGetTag.js';\nimport getPrototype from './_getPrototype.js';\nimport isObjectLike from './isObjectLike.js';\n\n/** `Object#toString` result references. */\nvar objectTag = '[object Object]';\n\n/** Used for built-in method references. */\nvar funcProto = Function.prototype,\n objectProto = Object.prototype;\n\n/** Used to resolve the decompiled source of functions. */\nvar funcToString = funcProto.toString;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/** Used to infer the `Object` constructor. */\nvar objectCtorString = funcToString.call(Object);\n\n/**\n * Checks if `value` is a plain object, that is, an object created by the\n * `Object` constructor or one with a `[[Prototype]]` of `null`.\n *\n * @static\n * @memberOf _\n * @since 0.8.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a plain object, else `false`.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * }\n *\n * _.isPlainObject(new Foo);\n * // => false\n *\n * _.isPlainObject([1, 2, 3]);\n * // => false\n *\n * _.isPlainObject({ 'x': 0, 'y': 0 });\n * // => true\n *\n * _.isPlainObject(Object.create(null));\n * // => true\n */\nfunction isPlainObject(value) {\n if (!isObjectLike(value) || baseGetTag(value) != objectTag) {\n return false;\n }\n var proto = getPrototype(value);\n if (proto === null) {\n return true;\n }\n var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor;\n return typeof Ctor == 'function' && Ctor instanceof Ctor &&\n funcToString.call(Ctor) == objectCtorString;\n}\n\nexport default isPlainObject;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/redux/node_modules/lodash-es/isPlainObject.js\n// module id = null\n// module chunks = ","import isPlainObject from 'lodash-es/isPlainObject';\nimport $$observable from 'symbol-observable';\n\n/**\n * These are private action types reserved by Redux.\n * For any unknown actions, you must return the current state.\n * If the current state is undefined, you must return the initial state.\n * Do not reference these action types directly in your code.\n */\nexport var ActionTypes = {\n INIT: '@@redux/INIT'\n\n /**\n * Creates a Redux store that holds the state tree.\n * The only way to change the data in the store is to call `dispatch()` on it.\n *\n * There should only be a single store in your app. To specify how different\n * parts of the state tree respond to actions, you may combine several reducers\n * into a single reducer function by using `combineReducers`.\n *\n * @param {Function} reducer A function that returns the next state tree, given\n * the current state tree and the action to handle.\n *\n * @param {any} [preloadedState] The initial state. You may optionally specify it\n * to hydrate the state from the server in universal apps, or to restore a\n * previously serialized user session.\n * If you use `combineReducers` to produce the root reducer function, this must be\n * an object with the same shape as `combineReducers` keys.\n *\n * @param {Function} [enhancer] The store enhancer. You may optionally specify it\n * to enhance the store with third-party capabilities such as middleware,\n * time travel, persistence, etc. The only store enhancer that ships with Redux\n * is `applyMiddleware()`.\n *\n * @returns {Store} A Redux store that lets you read the state, dispatch actions\n * and subscribe to changes.\n */\n};export default function createStore(reducer, preloadedState, enhancer) {\n var _ref2;\n\n if (typeof preloadedState === 'function' && typeof enhancer === 'undefined') {\n enhancer = preloadedState;\n preloadedState = undefined;\n }\n\n if (typeof enhancer !== 'undefined') {\n if (typeof enhancer !== 'function') {\n throw new Error('Expected the enhancer to be a function.');\n }\n\n return enhancer(createStore)(reducer, preloadedState);\n }\n\n if (typeof reducer !== 'function') {\n throw new Error('Expected the reducer to be a function.');\n }\n\n var currentReducer = reducer;\n var currentState = preloadedState;\n var currentListeners = [];\n var nextListeners = currentListeners;\n var isDispatching = false;\n\n function ensureCanMutateNextListeners() {\n if (nextListeners === currentListeners) {\n nextListeners = currentListeners.slice();\n }\n }\n\n /**\n * Reads the state tree managed by the store.\n *\n * @returns {any} The current state tree of your application.\n */\n function getState() {\n return currentState;\n }\n\n /**\n * Adds a change listener. It will be called any time an action is dispatched,\n * and some part of the state tree may potentially have changed. You may then\n * call `getState()` to read the current state tree inside the callback.\n *\n * You may call `dispatch()` from a change listener, with the following\n * caveats:\n *\n * 1. The subscriptions are snapshotted just before every `dispatch()` call.\n * If you subscribe or unsubscribe while the listeners are being invoked, this\n * will not have any effect on the `dispatch()` that is currently in progress.\n * However, the next `dispatch()` call, whether nested or not, will use a more\n * recent snapshot of the subscription list.\n *\n * 2. The listener should not expect to see all state changes, as the state\n * might have been updated multiple times during a nested `dispatch()` before\n * the listener is called. It is, however, guaranteed that all subscribers\n * registered before the `dispatch()` started will be called with the latest\n * state by the time it exits.\n *\n * @param {Function} listener A callback to be invoked on every dispatch.\n * @returns {Function} A function to remove this change listener.\n */\n function subscribe(listener) {\n if (typeof listener !== 'function') {\n throw new Error('Expected listener to be a function.');\n }\n\n var isSubscribed = true;\n\n ensureCanMutateNextListeners();\n nextListeners.push(listener);\n\n return function unsubscribe() {\n if (!isSubscribed) {\n return;\n }\n\n isSubscribed = false;\n\n ensureCanMutateNextListeners();\n var index = nextListeners.indexOf(listener);\n nextListeners.splice(index, 1);\n };\n }\n\n /**\n * Dispatches an action. It is the only way to trigger a state change.\n *\n * The `reducer` function, used to create the store, will be called with the\n * current state tree and the given `action`. Its return value will\n * be considered the **next** state of the tree, and the change listeners\n * will be notified.\n *\n * The base implementation only supports plain object actions. If you want to\n * dispatch a Promise, an Observable, a thunk, or something else, you need to\n * wrap your store creating function into the corresponding middleware. For\n * example, see the documentation for the `redux-thunk` package. Even the\n * middleware will eventually dispatch plain object actions using this method.\n *\n * @param {Object} action A plain object representing “what changed”. It is\n * a good idea to keep actions serializable so you can record and replay user\n * sessions, or use the time travelling `redux-devtools`. An action must have\n * a `type` property which may not be `undefined`. It is a good idea to use\n * string constants for action types.\n *\n * @returns {Object} For convenience, the same action object you dispatched.\n *\n * Note that, if you use a custom middleware, it may wrap `dispatch()` to\n * return something else (for example, a Promise you can await).\n */\n function dispatch(action) {\n if (!isPlainObject(action)) {\n throw new Error('Actions must be plain objects. ' + 'Use custom middleware for async actions.');\n }\n\n if (typeof action.type === 'undefined') {\n throw new Error('Actions may not have an undefined \"type\" property. ' + 'Have you misspelled a constant?');\n }\n\n if (isDispatching) {\n throw new Error('Reducers may not dispatch actions.');\n }\n\n try {\n isDispatching = true;\n currentState = currentReducer(currentState, action);\n } finally {\n isDispatching = false;\n }\n\n var listeners = currentListeners = nextListeners;\n for (var i = 0; i < listeners.length; i++) {\n var listener = listeners[i];\n listener();\n }\n\n return action;\n }\n\n /**\n * Replaces the reducer currently used by the store to calculate the state.\n *\n * You might need this if your app implements code splitting and you want to\n * load some of the reducers dynamically. You might also need this if you\n * implement a hot reloading mechanism for Redux.\n *\n * @param {Function} nextReducer The reducer for the store to use instead.\n * @returns {void}\n */\n function replaceReducer(nextReducer) {\n if (typeof nextReducer !== 'function') {\n throw new Error('Expected the nextReducer to be a function.');\n }\n\n currentReducer = nextReducer;\n dispatch({ type: ActionTypes.INIT });\n }\n\n /**\n * Interoperability point for observable/reactive libraries.\n * @returns {observable} A minimal observable of state changes.\n * For more information, see the observable proposal:\n * https://github.com/tc39/proposal-observable\n */\n function observable() {\n var _ref;\n\n var outerSubscribe = subscribe;\n return _ref = {\n /**\n * The minimal observable subscription method.\n * @param {Object} observer Any object that can be used as an observer.\n * The observer object should have a `next` method.\n * @returns {subscription} An object with an `unsubscribe` method that can\n * be used to unsubscribe the observable from the store, and prevent further\n * emission of values from the observable.\n */\n subscribe: function subscribe(observer) {\n if (typeof observer !== 'object') {\n throw new TypeError('Expected the observer to be an object.');\n }\n\n function observeState() {\n if (observer.next) {\n observer.next(getState());\n }\n }\n\n observeState();\n var unsubscribe = outerSubscribe(observeState);\n return { unsubscribe: unsubscribe };\n }\n }, _ref[$$observable] = function () {\n return this;\n }, _ref;\n }\n\n // When a store is created, an \"INIT\" action is dispatched so that every\n // reducer returns their initial state. This effectively populates\n // the initial state tree.\n dispatch({ type: ActionTypes.INIT });\n\n return _ref2 = {\n dispatch: dispatch,\n subscribe: subscribe,\n getState: getState,\n replaceReducer: replaceReducer\n }, _ref2[$$observable] = observable, _ref2;\n}\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/redux/es/createStore.js\n// module id = null\n// module chunks = ","/**\n * Prints a warning in the console if it exists.\n *\n * @param {String} message The warning message.\n * @returns {void}\n */\nexport default function warning(message) {\n /* eslint-disable no-console */\n if (typeof console !== 'undefined' && typeof console.error === 'function') {\n console.error(message);\n }\n /* eslint-enable no-console */\n try {\n // This error was thrown as a convenience so that if you enable\n // \"break on all exceptions\" in your console,\n // it would pause the execution at this line.\n throw new Error(message);\n /* eslint-disable no-empty */\n } catch (e) {}\n /* eslint-enable no-empty */\n}\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/redux/es/utils/warning.js\n// module id = null\n// module chunks = ","import { ActionTypes } from './createStore';\nimport isPlainObject from 'lodash-es/isPlainObject';\nimport warning from './utils/warning';\n\nfunction getUndefinedStateErrorMessage(key, action) {\n var actionType = action && action.type;\n var actionName = actionType && '\"' + actionType.toString() + '\"' || 'an action';\n\n return 'Given action ' + actionName + ', 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.';\n}\n\nfunction getUnexpectedStateShapeWarningMessage(inputState, reducers, action, unexpectedKeyCache) {\n var reducerKeys = Object.keys(reducers);\n var argumentName = action && action.type === ActionTypes.INIT ? 'preloadedState argument passed to createStore' : 'previous state received by the reducer';\n\n if (reducerKeys.length === 0) {\n return 'Store does not have a valid reducer. Make sure the argument passed ' + 'to combineReducers is an object whose values are reducers.';\n }\n\n if (!isPlainObject(inputState)) {\n 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('\", \"') + '\"');\n }\n\n var unexpectedKeys = Object.keys(inputState).filter(function (key) {\n return !reducers.hasOwnProperty(key) && !unexpectedKeyCache[key];\n });\n\n unexpectedKeys.forEach(function (key) {\n unexpectedKeyCache[key] = true;\n });\n\n if (unexpectedKeys.length > 0) {\n 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.');\n }\n}\n\nfunction assertReducerShape(reducers) {\n Object.keys(reducers).forEach(function (key) {\n var reducer = reducers[key];\n var initialState = reducer(undefined, { type: ActionTypes.INIT });\n\n if (typeof initialState === 'undefined') {\n 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.');\n }\n\n var type = '@@redux/PROBE_UNKNOWN_ACTION_' + Math.random().toString(36).substring(7).split('').join('.');\n if (typeof reducer(undefined, { type: type }) === 'undefined') {\n 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.');\n }\n });\n}\n\n/**\n * Turns an object whose values are different reducer functions, into a single\n * reducer function. It will call every child reducer, and gather their results\n * into a single state object, whose keys correspond to the keys of the passed\n * reducer functions.\n *\n * @param {Object} reducers An object whose values correspond to different\n * reducer functions that need to be combined into one. One handy way to obtain\n * it is to use ES6 `import * as reducers` syntax. The reducers may never return\n * undefined for any action. Instead, they should return their initial state\n * if the state passed to them was undefined, and the current state for any\n * unrecognized action.\n *\n * @returns {Function} A reducer function that invokes every reducer inside the\n * passed object, and builds a state object with the same shape.\n */\nexport default function combineReducers(reducers) {\n var reducerKeys = Object.keys(reducers);\n var finalReducers = {};\n for (var i = 0; i < reducerKeys.length; i++) {\n var key = reducerKeys[i];\n\n if (process.env.NODE_ENV !== 'production') {\n if (typeof reducers[key] === 'undefined') {\n warning('No reducer provided for key \"' + key + '\"');\n }\n }\n\n if (typeof reducers[key] === 'function') {\n finalReducers[key] = reducers[key];\n }\n }\n var finalReducerKeys = Object.keys(finalReducers);\n\n var unexpectedKeyCache = void 0;\n if (process.env.NODE_ENV !== 'production') {\n unexpectedKeyCache = {};\n }\n\n var shapeAssertionError = void 0;\n try {\n assertReducerShape(finalReducers);\n } catch (e) {\n shapeAssertionError = e;\n }\n\n return function combination() {\n var state = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n var action = arguments[1];\n\n if (shapeAssertionError) {\n throw shapeAssertionError;\n }\n\n if (process.env.NODE_ENV !== 'production') {\n var warningMessage = getUnexpectedStateShapeWarningMessage(state, finalReducers, action, unexpectedKeyCache);\n if (warningMessage) {\n warning(warningMessage);\n }\n }\n\n var hasChanged = false;\n var nextState = {};\n for (var _i = 0; _i < finalReducerKeys.length; _i++) {\n var _key = finalReducerKeys[_i];\n var reducer = finalReducers[_key];\n var previousStateForKey = state[_key];\n var nextStateForKey = reducer(previousStateForKey, action);\n if (typeof nextStateForKey === 'undefined') {\n var errorMessage = getUndefinedStateErrorMessage(_key, action);\n throw new Error(errorMessage);\n }\n nextState[_key] = nextStateForKey;\n hasChanged = hasChanged || nextStateForKey !== previousStateForKey;\n }\n return hasChanged ? nextState : state;\n };\n}\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/redux/es/combineReducers.js\n// module id = null\n// module chunks = ","function bindActionCreator(actionCreator, dispatch) {\n return function () {\n return dispatch(actionCreator.apply(undefined, arguments));\n };\n}\n\n/**\n * Turns an object whose values are action creators, into an object with the\n * same keys, but with every function wrapped into a `dispatch` call so they\n * may be invoked directly. This is just a convenience method, as you can call\n * `store.dispatch(MyActionCreators.doSomething())` yourself just fine.\n *\n * For convenience, you can also pass a single function as the first argument,\n * and get a function in return.\n *\n * @param {Function|Object} actionCreators An object whose values are action\n * creator functions. One handy way to obtain it is to use ES6 `import * as`\n * syntax. You may also pass a single function.\n *\n * @param {Function} dispatch The `dispatch` function available on your Redux\n * store.\n *\n * @returns {Function|Object} The object mimicking the original object, but with\n * every action creator wrapped into the `dispatch` call. If you passed a\n * function as `actionCreators`, the return value will also be a single\n * function.\n */\nexport default function bindActionCreators(actionCreators, dispatch) {\n if (typeof actionCreators === 'function') {\n return bindActionCreator(actionCreators, dispatch);\n }\n\n if (typeof actionCreators !== 'object' || actionCreators === null) {\n 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\"?');\n }\n\n var keys = Object.keys(actionCreators);\n var boundActionCreators = {};\n for (var i = 0; i < keys.length; i++) {\n var key = keys[i];\n var actionCreator = actionCreators[key];\n if (typeof actionCreator === 'function') {\n boundActionCreators[key] = bindActionCreator(actionCreator, dispatch);\n }\n }\n return boundActionCreators;\n}\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/redux/es/bindActionCreators.js\n// module id = null\n// module chunks = ","/**\n * Composes single-argument functions from right to left. The rightmost\n * function can take multiple arguments as it provides the signature for\n * the resulting composite function.\n *\n * @param {...Function} funcs The functions to compose.\n * @returns {Function} A function obtained by composing the argument functions\n * from right to left. For example, compose(f, g, h) is identical to doing\n * (...args) => f(g(h(...args))).\n */\n\nexport default function compose() {\n for (var _len = arguments.length, funcs = Array(_len), _key = 0; _key < _len; _key++) {\n funcs[_key] = arguments[_key];\n }\n\n if (funcs.length === 0) {\n return function (arg) {\n return arg;\n };\n }\n\n if (funcs.length === 1) {\n return funcs[0];\n }\n\n return funcs.reduce(function (a, b) {\n return function () {\n return a(b.apply(undefined, arguments));\n };\n });\n}\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/redux/es/compose.js\n// module id = null\n// module chunks = ","var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };\n\nimport compose from './compose';\n\n/**\n * Creates a store enhancer that applies middleware to the dispatch method\n * of the Redux store. This is handy for a variety of tasks, such as expressing\n * asynchronous actions in a concise manner, or logging every action payload.\n *\n * See `redux-thunk` package as an example of the Redux middleware.\n *\n * Because middleware is potentially asynchronous, this should be the first\n * store enhancer in the composition chain.\n *\n * Note that each middleware will be given the `dispatch` and `getState` functions\n * as named arguments.\n *\n * @param {...Function} middlewares The middleware chain to be applied.\n * @returns {Function} A store enhancer applying the middleware.\n */\nexport default function applyMiddleware() {\n for (var _len = arguments.length, middlewares = Array(_len), _key = 0; _key < _len; _key++) {\n middlewares[_key] = arguments[_key];\n }\n\n return function (createStore) {\n return function (reducer, preloadedState, enhancer) {\n var store = createStore(reducer, preloadedState, enhancer);\n var _dispatch = store.dispatch;\n var chain = [];\n\n var middlewareAPI = {\n getState: store.getState,\n dispatch: function dispatch(action) {\n return _dispatch(action);\n }\n };\n chain = middlewares.map(function (middleware) {\n return middleware(middlewareAPI);\n });\n _dispatch = compose.apply(undefined, chain)(store.dispatch);\n\n return _extends({}, store, {\n dispatch: _dispatch\n });\n };\n };\n}\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/redux/es/applyMiddleware.js\n// module id = null\n// module chunks = ","import createStore from './createStore';\nimport combineReducers from './combineReducers';\nimport bindActionCreators from './bindActionCreators';\nimport applyMiddleware from './applyMiddleware';\nimport compose from './compose';\nimport warning from './utils/warning';\n\n/*\n* This is a dummy function to check if the function name has been altered by minification.\n* If the function has been minified and NODE_ENV !== 'production', warn the user.\n*/\nfunction isCrushed() {}\n\nif (process.env.NODE_ENV !== 'production' && typeof isCrushed.name === 'string' && isCrushed.name !== 'isCrushed') {\n warning('You are currently using minified code outside of NODE_ENV === \\'production\\'. ' + 'This means that you are running a slower development build of Redux. ' + 'You can use loose-envify (https://github.com/zertosh/loose-envify) for browserify ' + 'or DefinePlugin for webpack (http://stackoverflow.com/questions/30030031) ' + 'to ensure you have the correct code for your production build.');\n}\n\nexport { createStore, combineReducers, bindActionCreators, applyMiddleware, compose };\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/redux/es/index.js\n// module id = null\n// module chunks = ","var g;\n\n// This works in non-strict mode\ng = (function() {\n\treturn this;\n})();\n\ntry {\n\t// This works if eval is allowed (see CSP)\n\tg = g || Function(\"return this\")() || (1,eval)(\"this\");\n} catch(e) {\n\t// This works if the window reference is available\n\tif(typeof window === \"object\")\n\t\tg = window;\n}\n\n// g can still be undefined, but nothing to do about it...\n// We return undefined, instead of nothing here, so it's\n// easier to handle this case. if(!global) { ...}\n\nmodule.exports = g;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// (webpack)/buildin/global.js\n// module id = 3\n// module chunks = 0","import { dispatchEvent } from '../lib/utils';\n\nexport default class WrappedElement {\n constructor(instance, element, classNames) {\n this.parentInstance = instance;\n this.element = element;\n this.classNames = classNames;\n this.isDisabled = false;\n }\n\n getElement() {\n return this.element;\n }\n\n getValue() {\n return this.element.value;\n }\n\n conceal() {\n // Hide passed input\n this.element.classList.add(\n this.classNames.input,\n this.classNames.hiddenState,\n );\n\n // Remove element from tab index\n this.element.tabIndex = '-1';\n\n // Backup original styles if any\n const origStyle = this.element.getAttribute('style');\n\n if (origStyle) {\n this.element.setAttribute('data-choice-orig-style', origStyle);\n }\n\n this.element.setAttribute('style', 'display:none;');\n this.element.setAttribute('aria-hidden', 'true');\n this.element.setAttribute('data-choice', 'active');\n }\n\n reveal() {\n // Reinstate passed element\n this.element.classList.remove(\n this.classNames.input,\n this.classNames.hiddenState,\n );\n this.element.removeAttribute('tabindex');\n\n // Recover original styles if any\n const origStyle = this.element.getAttribute('data-choice-orig-style');\n\n if (origStyle) {\n this.element.removeAttribute('data-choice-orig-style');\n this.element.setAttribute('style', origStyle);\n } else {\n this.element.removeAttribute('style');\n }\n this.element.removeAttribute('aria-hidden');\n this.element.removeAttribute('data-choice');\n\n // Re-assign values - this is weird, I know\n this.element.value = this.element.value;\n }\n\n enable() {\n this.element.removeAttribute('disabled');\n this.element.disabled = false;\n this.isDisabled = false;\n }\n\n disable() {\n this.element.setAttribute('disabled', '');\n this.element.disabled = true;\n this.isDisabled = true;\n }\n\n triggerEvent(eventType, data) {\n dispatchEvent(this.element, eventType, data);\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// src/scripts/src/components/wrapped-element.js","import Fuse from 'fuse.js';\nimport Store from './store/store';\nimport Dropdown from './components/dropdown';\nimport Container from './components/container';\nimport Input from './components/input';\nimport List from './components/list';\nimport WrappedInput from './components/wrapped-input';\nimport WrappedSelect from './components/wrapped-select';\nimport { DEFAULT_CONFIG, DEFAULT_CLASSNAMES, EVENTS, KEY_CODES, SCROLLING_SPEED } from './constants';\nimport { TEMPLATES } from './templates';\nimport { addChoice, filterChoices, activateChoices, clearChoices } from './actions/choices';\nimport { addItem, removeItem, highlightItem } from './actions/items';\nimport { addGroup } from './actions/groups';\nimport { clearAll } from './actions/misc';\nimport {\n isScrolledIntoView,\n getAdjacentEl,\n wrap,\n getType,\n isType,\n isElement,\n strToEl,\n extend,\n sortByAlpha,\n sortByScore,\n generateId,\n findAncestorByAttrName,\n regexFilter,\n} from './lib/utils';\nimport './lib/polyfills';\n\n/**\n * Choices\n */\nclass Choices {\n constructor(element = '[data-choice]', userConfig = {}) {\n // If there are multiple elements, create a new instance\n // for each element besides the first one (as that already has an instance)\n if (isType('String', element)) {\n const elements = document.querySelectorAll(element);\n if (elements.length > 1) {\n for (let i = 1; i < elements.length; i += 1) {\n const el = elements[i];\n /* eslint-disable no-new */\n new Choices(el, userConfig);\n }\n }\n }\n\n const defaultConfig = {\n ...DEFAULT_CONFIG,\n items: [],\n choices: [],\n classNames: DEFAULT_CLASSNAMES,\n sortFilter: sortByAlpha,\n };\n\n // Merge options with user options\n this.config = extend(defaultConfig, Choices.userDefaults, userConfig);\n\n if (!['auto', 'always'].includes(this.config.renderSelectedChoices)) {\n this.config.renderSelectedChoices = 'auto';\n }\n\n // Create data store\n this.store = new Store(this.render);\n\n // State tracking\n this.initialised = false;\n this.currentState = {};\n this.prevState = {};\n this.currentValue = '';\n\n // Retrieve triggering element (i.e. element with 'data-choice' trigger)\n const passedElement = isType('String', element) ? document.querySelector(element) : element;\n\n this.isTextElement = passedElement.type === 'text';\n this.isSelectOneElement = passedElement.type === 'select-one';\n this.isSelectMultipleElement = passedElement.type === 'select-multiple';\n this.isSelectElement = this.isSelectOneElement || this.isSelectMultipleElement;\n this.isValidElementType = this.isTextElement || this.isSelectElement;\n\n if (this.isTextElement) {\n this.passedElement = new WrappedInput(this, passedElement, this.config.classNames);\n } else if (this.isSelectElement) {\n this.passedElement = new WrappedSelect(this, passedElement, this.config.classNames);\n }\n\n if (!this.passedElement) {\n if (!this.config.silent) {\n console.error('Passed element not found');\n }\n return false;\n }\n\n this.isIe11 = !!(navigator.userAgent.match(/Trident/) && navigator.userAgent.match(/rv[ :]11/));\n this.isScrollingOnIe = false;\n\n if (this.config.shouldSortItems === true && this.isSelectOneElement) {\n if (!this.config.silent) {\n console.warn(\n 'shouldSortElements: Type of passed element is \\'select-one\\', falling back to false.',\n );\n }\n }\n\n this.highlightPosition = 0;\n this.canSearch = this.config.searchEnabled;\n\n this.placeholder = false;\n if (!this.isSelectOneElement) {\n this.placeholder = this.config.placeholder ?\n (this.config.placeholderValue || this.passedElement.element.getAttribute('placeholder')) :\n false;\n }\n\n // Assign preset choices from passed object\n this.presetChoices = this.config.choices;\n // Assign preset items from passed object first\n this.presetItems = this.config.items;\n\n // Then add any values passed from attribute\n if (this.passedElement.getValue()) {\n this.presetItems = this.presetItems.concat(\n this.passedElement.getValue().split(this.config.delimiter),\n );\n }\n\n // Set unique base Id\n this.baseId = generateId(this.passedElement.element, 'choices-');\n\n this.idNames = {\n itemChoice: 'item-choice',\n };\n\n // Bind methods\n this.render = this.render.bind(this);\n\n // Bind event handlers\n this._onFocus = this._onFocus.bind(this);\n this._onBlur = this._onBlur.bind(this);\n this._onKeyUp = this._onKeyUp.bind(this);\n this._onKeyDown = this._onKeyDown.bind(this);\n this._onClick = this._onClick.bind(this);\n this._onTouchMove = this._onTouchMove.bind(this);\n this._onTouchEnd = this._onTouchEnd.bind(this);\n this._onMouseDown = this._onMouseDown.bind(this);\n this._onMouseOver = this._onMouseOver.bind(this);\n\n // Monitor touch taps/scrolls\n this.wasTap = true;\n\n // Cutting the mustard\n const cuttingTheMustard = 'classList' in document.documentElement;\n if (!cuttingTheMustard && !this.config.silent) {\n console.error('Choices: Your browser doesn\\'t support Choices');\n }\n\n const canInit = isElement(this.passedElement.element) && this.isValidElementType;\n\n if (canInit) {\n // If element has already been initialised with Choices\n if (this.passedElement.element.getAttribute('data-choice') === 'active') {\n return false;\n }\n\n // Let's go\n this.init();\n } else if (!this.config.silent) {\n console.error('Incompatible input passed');\n }\n }\n\n /* ========================================\n = Public functions =\n ======================================== */\n\n /**\n * Initialise Choices\n * @return\n * @public\n */\n init() {\n if (this.initialised) {\n return;\n }\n\n // Set initialise flag\n this.initialised = true;\n // Create required elements\n this._createTemplates();\n // Generate input markup\n this._createStructure();\n // Subscribe store to render method\n this.store.subscribe(this.render);\n // Render any items\n this.render();\n // Trigger event listeners\n this._addEventListeners();\n\n const callback = this.config.callbackOnInit;\n // Run callback if it is a function\n if (callback && isType('Function', callback)) {\n callback.call(this);\n }\n }\n\n /**\n * Destroy Choices and nullify values\n * @return\n * @public\n */\n destroy() {\n if (!this.initialised) {\n return;\n }\n\n // Remove all event listeners\n this._removeEventListeners();\n this.passedElement.reveal();\n this.containerOuter.revert(this.passedElement.element);\n\n // Clear data store\n this.clearStore();\n\n // Nullify instance-specific data\n this.config.templates = null;\n\n // Uninitialise\n this.initialised = false;\n }\n\n /**\n * Enable interaction with Choices\n * @return {Object} Class instance\n */\n enable() {\n if (!this.initialised) {\n return this;\n }\n\n this.passedElement.enable();\n\n if (this.containerOuter.isDisabled) {\n this._addEventListeners();\n this.input.enable();\n this.containerOuter.enable();\n }\n\n return this;\n }\n\n /**\n * Disable interaction with Choices\n * @return {Object} Class instance\n * @public\n */\n disable() {\n if (!this.initialised) {\n return this;\n }\n\n this.passedElement.disable();\n\n if (!this.containerOuter.isDisabled) {\n this._removeEventListeners();\n this.input.disable();\n this.containerOuter.disable();\n }\n\n return this;\n }\n\n /**\n * Render group choices into a DOM fragment and append to choice list\n * @param {Array} groups Groups to add to list\n * @param {Array} choices Choices to add to groups\n * @param {DocumentFragment} fragment Fragment to add groups and options to (optional)\n * @return {DocumentFragment} Populated options fragment\n * @private\n */\n renderGroups(groups, choices, fragment) {\n const groupFragment = fragment || document.createDocumentFragment();\n const filter = this.config.sortFilter;\n const getGroupChoices = group => choices.filter((choice) => {\n if (this.isSelectOneElement) {\n return choice.groupId === group.id;\n }\n return choice.groupId === group.id && (this.config.renderSelectedChoices === 'always' || !choice.selected);\n });\n\n // If sorting is enabled, filter groups\n if (this.config.shouldSort) {\n groups.sort(filter);\n }\n\n groups.forEach((group) => {\n const groupChoices = getGroupChoices(group);\n\n if (groupChoices.length >= 1) {\n const dropdownGroup = this._getTemplate('choiceGroup', group);\n groupFragment.appendChild(dropdownGroup);\n this.renderChoices(groupChoices, groupFragment, true);\n }\n });\n\n return groupFragment;\n }\n\n /**\n * Render choices into a DOM fragment and append to choice list\n * @param {Array} choices Choices to add to list\n * @param {DocumentFragment} fragment Fragment to add choices to (optional)\n * @return {DocumentFragment} Populated choices fragment\n * @private\n */\n renderChoices(choices, fragment, withinGroup = false) {\n // Create a fragment to store our list items (so we don't have to update the DOM for each item)\n const choicesFragment = fragment || document.createDocumentFragment();\n const { renderSelectedChoices, searchResultLimit, renderChoiceLimit } = this.config;\n const filter = this.isSearching ? sortByScore : this.config.sortFilter;\n const appendChoice = (choice) => {\n const shouldRender = renderSelectedChoices === 'auto' ?\n (this.isSelectOneElement || !choice.selected) :\n true;\n if (shouldRender) {\n const dropdownItem = this._getTemplate('choice', choice, this.config.itemSelectText);\n choicesFragment.appendChild(dropdownItem);\n }\n };\n\n let rendererableChoices = choices;\n\n if (renderSelectedChoices === 'auto' && !this.isSelectOneElement) {\n rendererableChoices = choices.filter(choice => !choice.selected);\n }\n\n // Split array into placeholders and \"normal\" choices\n const { placeholderChoices, normalChoices } = rendererableChoices.reduce((acc, choice) => {\n if (choice.placeholder) {\n acc.placeholderChoices.push(choice);\n } else {\n acc.normalChoices.push(choice);\n }\n return acc;\n }, { placeholderChoices: [], normalChoices: [] });\n\n // If sorting is enabled or the user is searching, filter choices\n if (this.config.shouldSort || this.isSearching) {\n normalChoices.sort(filter);\n }\n\n let choiceLimit = rendererableChoices.length;\n\n // Prepend placeholeder\n const sortedChoices = [...placeholderChoices, ...normalChoices];\n\n if (this.isSearching) {\n choiceLimit = searchResultLimit;\n } else if (renderChoiceLimit > 0 && !withinGroup) {\n choiceLimit = renderChoiceLimit;\n }\n\n // Add each choice to dropdown within range\n for (let i = 0; i < choiceLimit; i += 1) {\n if (sortedChoices[i]) {\n appendChoice(sortedChoices[i]);\n }\n }\n\n return choicesFragment;\n }\n\n /**\n * Render items into a DOM fragment and append to items list\n * @param {Array} items Items to add to list\n * @param {DocumentFragment} [fragment] Fragment to add items to (optional)\n * @return\n * @private\n */\n renderItems(items, fragment = null) {\n // Create fragment to add elements to\n const itemListFragment = fragment || document.createDocumentFragment();\n\n // If sorting is enabled, filter items\n if (this.config.shouldSortItems && !this.isSelectOneElement) {\n items.sort(this.config.sortFilter);\n }\n\n if (this.isTextElement) {\n // Simplify store data to just values\n const itemsFiltered = this.store.getItemsReducedToValues(items);\n const itemsFilteredString = itemsFiltered.join(this.config.delimiter);\n\n // Update the value of the hidden input\n this.passedElement.setValue(itemsFilteredString);\n } else {\n const selectedOptionsFragment = document.createDocumentFragment();\n const addOptionToFragment = (item) => {\n // Create a standard select option\n const option = this._getTemplate('option', item);\n // Append it to fragment\n selectedOptionsFragment.appendChild(option);\n };\n\n // Add each list item to list\n items.forEach(item => addOptionToFragment(item));\n // Update the options of the hidden input\n this.passedElement.setOptions(selectedOptionsFragment);\n }\n\n const addItemToFragment = (item) => {\n // Create new list element\n const listItem = this._getTemplate('item', item, this.config.removeItemButton);\n // Append it to list\n itemListFragment.appendChild(listItem);\n };\n\n // Add each list item to list\n items.forEach(item => addItemToFragment(item));\n\n return itemListFragment;\n }\n\n /**\n * Render DOM with values\n * @return\n * @private\n */\n render() {\n this.currentState = this.store.getState();\n const stateChanged = (\n this.currentState.choices !== this.prevState.choices ||\n this.currentState.groups !== this.prevState.groups ||\n this.currentState.items !== this.prevState.items\n );\n\n if (!stateChanged) {\n return;\n }\n\n /* Choices */\n\n if (this.isSelectElement) {\n // Get active groups/choices\n const activeGroups = this.store.getGroupsFilteredByActive();\n const activeChoices = this.store.getChoicesFilteredByActive();\n\n let choiceListFragment = document.createDocumentFragment();\n\n // Clear choices\n this.choiceList.clear();\n\n // Scroll back to top of choices list\n if (this.config.resetScrollPosition) {\n this.choiceList.scrollTo(0);\n }\n\n // If we have grouped options\n if (activeGroups.length >= 1 && !this.isSearching) {\n // If we have a placeholder choice along with groups\n const activePlaceholders = activeChoices.filter(\n activeChoice => activeChoice.placeholder === true && activeChoice.groupId === -1,\n );\n if (activePlaceholders.length >= 1) {\n choiceListFragment = this.renderChoices(activePlaceholders, choiceListFragment);\n }\n choiceListFragment = this.renderGroups(activeGroups, activeChoices, choiceListFragment);\n } else if (activeChoices.length >= 1) {\n choiceListFragment = this.renderChoices(activeChoices, choiceListFragment);\n }\n\n const activeItems = this.store.getItemsFilteredByActive();\n const canAddItem = this._canAddItem(activeItems, this.input.getValue());\n\n // If we have choices to show\n if (choiceListFragment.childNodes && choiceListFragment.childNodes.length > 0) {\n // ...and we can select them\n if (canAddItem.response) {\n // ...append them and highlight the first choice\n this.choiceList.append(choiceListFragment);\n this._highlightChoice();\n } else {\n // ...otherwise show a notice\n this.choiceList.append(this._getTemplate('notice', canAddItem.notice));\n }\n } else {\n // Otherwise show a notice\n let dropdownItem;\n let notice;\n\n if (this.isSearching) {\n notice = isType('Function', this.config.noResultsText) ?\n this.config.noResultsText() :\n this.config.noResultsText;\n\n dropdownItem = this._getTemplate('notice', notice, 'no-results');\n } else {\n notice = isType('Function', this.config.noChoicesText) ?\n this.config.noChoicesText() :\n this.config.noChoicesText;\n\n dropdownItem = this._getTemplate('notice', notice, 'no-choices');\n }\n\n this.choiceList.append(dropdownItem);\n }\n }\n\n /* Items */\n\n // Get active items (items that can be selected)\n const activeItems = this.store.getItemsFilteredByActive() || [];\n // Clear list\n this.itemList.clear();\n\n if (activeItems.length) {\n // Create a fragment to store our list items\n // (so we don't have to update the DOM for each item)\n const itemListFragment = this.renderItems(activeItems);\n\n // If we have items to add\n if (itemListFragment.childNodes) {\n // Update list\n this.itemList.append(itemListFragment);\n }\n }\n\n this.prevState = this.currentState;\n }\n\n /**\n * Select item (a selected item can be deleted)\n * @param {Element} item Element to select\n * @param {Boolean} [runEvent=true] Whether to trigger 'highlightItem' event\n * @return {Object} Class instance\n * @public\n */\n highlightItem(item, runEvent = true) {\n if (!item) {\n return this;\n }\n\n const { id, groupId = -1, value = '', label = '' } = item;\n const group = groupId >= 0 ? this.store.getGroupById(groupId) : null;\n\n this.store.dispatch(highlightItem(id, true));\n\n if (runEvent) {\n this.passedElement.triggerEvent(EVENTS.highlightItem, {\n id,\n value,\n label,\n groupValue: group && group.value ? group.value : null,\n });\n }\n\n return this;\n }\n\n /**\n * Deselect item\n * @param {Element} item Element to de-select\n * @return {Object} Class instance\n * @public\n */\n unhighlightItem(item) {\n if (!item) {\n return this;\n }\n\n const { id, groupId = -1, value = '', label = '' } = item;\n const group = groupId >= 0 ? this.store.getGroupById(groupId) : null;\n\n this.store.dispatch(highlightItem(id, false));\n this.passedElement.triggerEvent(EVENTS.highlightItem, {\n id,\n value,\n label,\n groupValue: group && group.value ? group.value : null,\n });\n\n return this;\n }\n\n /**\n * Highlight items within store\n * @return {Object} Class instance\n * @public\n */\n highlightAll() {\n const items = this.store.getItems();\n items.forEach(item => this.highlightItem(item));\n return this;\n }\n\n /**\n * Deselect items within store\n * @return {Object} Class instance\n * @public\n */\n unhighlightAll() {\n const items = this.store.getItems();\n items.forEach(item => this.unhighlightItem(item));\n return this;\n }\n\n /**\n * Remove an item from the store by its value\n * @param {String} value Value to search for\n * @return {Object} Class instance\n * @public\n */\n removeItemsByValue(value) {\n if (!value || !isType('String', value)) {\n return this;\n }\n\n const items = this.store.getItemsFilteredByActive();\n\n items.forEach((item) => {\n if (item.value === value) {\n this._removeItem(item);\n }\n });\n\n return this;\n }\n\n /**\n * Remove all items from store array\n * @note Removed items are soft deleted\n * @param {Number} excludedId Optionally exclude item by ID\n * @return {Object} Class instance\n * @public\n */\n removeActiveItems(excludedId) {\n const items = this.store.getItemsFilteredByActive();\n\n items.forEach((item) => {\n if (item.active && excludedId !== item.id) {\n this._removeItem(item);\n }\n });\n\n return this;\n }\n\n /**\n * Remove all selected items from store\n * @note Removed items are soft deleted\n * @return {Object} Class instance\n * @public\n */\n removeHighlightedItems(runEvent = false) {\n const items = this.store.getItemsFilteredByActive();\n\n items.forEach((item) => {\n if (item.highlighted && item.active) {\n this._removeItem(item);\n // If this action was performed by the user\n // trigger the event\n if (runEvent) {\n this._triggerChange(item.value);\n }\n }\n });\n\n return this;\n }\n\n /**\n * Show dropdown to user by adding active state class\n * @return {Object} Class instance\n * @public\n */\n showDropdown(focusInput = false) {\n if (this.dropdown.isActive) {\n return this;\n }\n\n this.containerOuter.open(this.dropdown.getVerticalPos());\n this.dropdown.show();\n this.input.activate(focusInput);\n this.passedElement.triggerEvent(EVENTS.showDropdown, {});\n\n return this;\n }\n\n /**\n * Hide dropdown from user\n * @return {Object} Class instance\n * @public\n */\n hideDropdown(blurInput = false) {\n if (!this.dropdown.isActive) {\n return this;\n }\n\n this.containerOuter.close();\n this.dropdown.hide();\n this.input.deactivate(blurInput);\n this.passedElement.triggerEvent(EVENTS.hideDropdown, {});\n\n return this;\n }\n\n /**\n * Determine whether to hide or show dropdown based on its current state\n * @return {Object} Class instance\n * @public\n */\n toggleDropdown() {\n if (this.dropdown.isActive) {\n this.hideDropdown();\n } else {\n this.showDropdown(true);\n }\n\n return this;\n }\n\n /**\n * Get value(s) of input (i.e. inputted items (text) or selected choices (select))\n * @param {Boolean} valueOnly Get only values of selected items, otherwise return selected items\n * @return {Array/String} selected value (select-one) or\n * array of selected items (inputs & select-multiple)\n * @public\n */\n getValue(valueOnly = false) {\n const items = this.store.getItemsFilteredByActive();\n\n const values = items.reduce((selectedItems, item) => {\n const itemValue = valueOnly ? item.value : item;\n selectedItems.push(itemValue);\n return selectedItems;\n }, []);\n\n return this.isSelectOneElement ? values[0] : values;\n }\n\n /**\n * Set value of input. If the input is a select box, a choice will\n * be created and selected otherwise an item will created directly.\n * @param {Array} args Array of value objects or value strings\n * @return {Object} Class instance\n * @public\n */\n setValue(args) {\n if (!this.initialised) {\n return this;\n }\n\n // Convert args to an iterable array\n const values = [...args];\n values.forEach(value => this._setChoiceOrItem(value));\n\n return this;\n }\n\n /**\n * Select value of select box via the value of an existing choice\n * @param {Array/String} value An array of strings of a single string\n * @return {Object} Class instance\n * @public\n */\n setChoiceByValue(value) {\n if (this.isTextElement || !this.initialised) {\n return this;\n }\n\n // If only one value has been passed, convert to array\n const choiceValue = isType('Array', value) ? value : [value];\n\n // Loop through each value and\n choiceValue.forEach(val => this._findAndSelectChoiceByValue(val));\n\n return this;\n }\n\n /**\n * Direct populate choices\n * @param {Array} choices - Choices to insert\n * @param {String} value - Name of 'value' property\n * @param {String} label - Name of 'label' property\n * @param {Boolean} replaceChoices Whether existing choices should be removed\n * @return {Object} Class instance\n * @public\n */\n setChoices(choices = [], value = '', label = '', replaceChoices = false) {\n if (\n !this.initialised ||\n !this.isSelectElement ||\n !isType('Array', choices) ||\n !value\n ) {\n return this;\n }\n\n // Clear choices if needed\n if (replaceChoices) {\n this._clearChoices();\n }\n\n // Add choices if passed\n if (choices.length) {\n this.containerOuter.removeLoadingState();\n const addGroupsAndChoices = (groupOrChoice) => {\n if (groupOrChoice.choices) {\n this._addGroup(\n groupOrChoice,\n (groupOrChoice.id || null),\n value,\n label,\n );\n } else {\n this._addChoice(\n groupOrChoice[value],\n groupOrChoice[label],\n groupOrChoice.selected,\n groupOrChoice.disabled,\n undefined,\n groupOrChoice.customProperties,\n groupOrChoice.placeholder,\n );\n }\n };\n\n choices.forEach(addGroupsAndChoices);\n }\n\n return this;\n }\n\n /**\n * Clear items,choices and groups\n * @note Hard delete\n * @return {Object} Class instance\n * @public\n */\n clearStore() {\n this.store.dispatch(clearAll());\n return this;\n }\n\n /**\n * Set value of input to blank\n * @return {Object} Class instance\n * @public\n */\n clearInput() {\n const shouldSetInputWidth = !this.isSelectOneElement;\n this.input.clear(shouldSetInputWidth);\n\n if (!this.isTextElement && this.config.searchEnabled) {\n this.isSearching = false;\n this.store.dispatch(activateChoices(true));\n }\n\n return this;\n }\n\n /**\n * Populate options via ajax callback\n * @param {Function} fn Function that actually makes an AJAX request\n * @return {Object} Class instance\n * @public\n */\n ajax(fn) {\n if (!this.initialised || !this.isSelectElement || !fn) {\n return this;\n }\n\n requestAnimationFrame(() => this._handleLoadingState(true));\n fn(this._ajaxCallback());\n\n return this;\n }\n\n /* ===== End of Public functions ====== */\n\n /* =============================================\n = Private functions =\n ============================================= */\n\n /**\n * Call change callback\n * @param {String} value - last added/deleted/selected value\n * @return\n * @private\n */\n _triggerChange(value) {\n if (!value) {\n return;\n }\n\n this.passedElement.triggerEvent(EVENTS.change, {\n value,\n });\n }\n\n /**\n * Select placeholder choice\n */\n _selectPlaceholderChoice() {\n const placeholderChoice = this.store.getPlaceholderChoice();\n\n if (placeholderChoice) {\n this._addItem(\n placeholderChoice.value,\n placeholderChoice.label,\n placeholderChoice.id,\n placeholderChoice.groupId,\n null,\n placeholderChoice.placeholder,\n );\n this._triggerChange(placeholderChoice.value);\n }\n }\n\n\n /**\n * Process enter/click of an item button\n * @param {Array} activeItems The currently active items\n * @param {Element} element Button being interacted with\n * @return\n * @private\n */\n _handleButtonAction(activeItems, element) {\n if (\n !activeItems ||\n !element ||\n !this.config.removeItems ||\n !this.config.removeItemButton\n ) {\n return;\n }\n\n const itemId = element.parentNode.getAttribute('data-id');\n const itemToRemove = activeItems.find(item => item.id === parseInt(itemId, 10));\n\n // Remove item associated with button\n this._removeItem(itemToRemove);\n this._triggerChange(itemToRemove.value);\n\n if (this.isSelectOneElement) {\n this._selectPlaceholderChoice();\n }\n }\n\n /**\n * Process click of an item\n * @param {Array} activeItems The currently active items\n * @param {Element} element Item being interacted with\n * @param {Boolean} hasShiftKey Whether the user has the shift key active\n * @return\n * @private\n */\n _handleItemAction(activeItems, element, hasShiftKey = false) {\n if (\n !activeItems ||\n !element ||\n !this.config.removeItems ||\n this.isSelectOneElement\n ) {\n return;\n }\n\n const passedId = element.getAttribute('data-id');\n\n // We only want to select one item with a click\n // so we deselect any items that aren't the target\n // unless shift is being pressed\n activeItems.forEach((item) => {\n if (item.id === parseInt(passedId, 10) && !item.highlighted) {\n this.highlightItem(item);\n } else if (!hasShiftKey && item.highlighted) {\n this.unhighlightItem(item);\n }\n });\n\n // Focus input as without focus, a user cannot do anything with a\n // highlighted item\n this.input.focus();\n }\n\n /**\n * Process click of a choice\n * @param {Array} activeItems The currently active items\n * @param {Element} element Choice being interacted with\n * @return\n */\n _handleChoiceAction(activeItems, element) {\n if (!activeItems || !element) {\n return;\n }\n\n // If we are clicking on an option\n const id = element.getAttribute('data-id');\n const choice = this.store.getChoiceById(id);\n const passedKeyCode = activeItems[0] && activeItems[0].keyCode ? activeItems[0].keyCode : null;\n const hasActiveDropdown = this.dropdown.isActive;\n\n // Update choice keyCode\n choice.keyCode = passedKeyCode;\n\n this.passedElement.triggerEvent(EVENTS.choice, {\n choice,\n });\n\n if (choice && !choice.selected && !choice.disabled) {\n const canAddItem = this._canAddItem(activeItems, choice.value);\n\n if (canAddItem.response) {\n this._addItem(\n choice.value,\n choice.label,\n choice.id,\n choice.groupId,\n choice.customProperties,\n choice.placeholder,\n choice.keyCode,\n );\n this._triggerChange(choice.value);\n }\n }\n\n this.clearInput();\n\n // We wont to close the dropdown if we are dealing with a single select box\n if (hasActiveDropdown && this.isSelectOneElement) {\n this.hideDropdown();\n this.containerOuter.focus();\n }\n }\n\n /**\n * Process back space event\n * @param {Array} activeItems items\n * @return\n * @private\n */\n _handleBackspace(activeItems) {\n if (!this.config.removeItems || !activeItems) {\n return;\n }\n\n const lastItem = activeItems[activeItems.length - 1];\n const hasHighlightedItems = activeItems.some(item => item.highlighted);\n\n // If editing the last item is allowed and there are not other selected items,\n // we can edit the item value. Otherwise if we can remove items, remove all selected items\n if (this.config.editItems && !hasHighlightedItems && lastItem) {\n this.input.setValue(lastItem.value);\n this.input.setWidth();\n this._removeItem(lastItem);\n this._triggerChange(lastItem.value);\n } else {\n if (!hasHighlightedItems) {\n // Highlight last item if none already highlighted\n this.highlightItem(lastItem, false);\n }\n this.removeHighlightedItems(true);\n }\n }\n\n /**\n * Apply or remove a loading state to the component.\n * @param {Boolean} isLoading default value set to 'true'.\n * @return\n * @private\n */\n _handleLoadingState(isLoading = true) {\n let placeholderItem = this.itemList.getChild(`.${this.config.classNames.placeholder}`);\n if (isLoading) {\n this.containerOuter.addLoadingState();\n if (this.isSelectOneElement) {\n if (!placeholderItem) {\n placeholderItem = this._getTemplate('placeholder', this.config.loadingText);\n this.itemList.append(placeholderItem);\n } else {\n placeholderItem.innerHTML = this.config.loadingText;\n }\n } else {\n this.input.setPlaceholder(this.config.loadingText);\n }\n } else {\n this.containerOuter.removeLoadingState();\n\n if (this.isSelectOneElement) {\n placeholderItem.innerHTML = (this.placeholder || '');\n } else {\n this.input.setPlaceholder(this.placeholder || '');\n }\n }\n }\n\n\n /**\n * Validates whether an item can be added by a user\n * @param {Array} activeItems The currently active items\n * @param {String} value Value of item to add\n * @return {Object} Response: Whether user can add item\n * Notice: Notice show in dropdown\n */\n _canAddItem(activeItems, value) {\n let canAddItem = true;\n let notice = isType('Function', this.config.addItemText) ?\n this.config.addItemText(value) :\n this.config.addItemText;\n\n if (this.isSelectMultipleElement || this.isTextElement) {\n if (this.config.maxItemCount > 0 && this.config.maxItemCount <= activeItems.length) {\n // If there is a max entry limit and we have reached that limit\n // don't update\n canAddItem = false;\n notice = isType('Function', this.config.maxItemText) ?\n this.config.maxItemText(this.config.maxItemCount) :\n this.config.maxItemText;\n }\n }\n\n if (this.isTextElement && this.config.addItems && canAddItem && this.config.regexFilter) {\n // If a user has supplied a regular expression filter\n // determine whether we can update based on whether\n // our regular expression passes\n canAddItem = regexFilter(value, this.config.regexFilter);\n }\n\n // If no duplicates are allowed, and the value already exists\n // in the array\n const isUnique = !activeItems.some((item) => {\n if (isType('String', value)) {\n return item.value === value.trim();\n }\n\n return item.value === value;\n });\n\n if (!isUnique &&\n !this.config.duplicateItems &&\n !this.isSelectOneElement &&\n canAddItem\n ) {\n canAddItem = false;\n notice = isType('Function', this.config.uniqueItemText) ?\n this.config.uniqueItemText(value) :\n this.config.uniqueItemText;\n }\n\n return {\n response: canAddItem,\n notice,\n };\n }\n\n /**\n * Retrieve the callback used to populate component's choices in an async way.\n * @returns {Function} The callback as a function.\n * @private\n */\n _ajaxCallback() {\n return (results, value, label) => {\n if (!results || !value) {\n return;\n }\n\n const parsedResults = isType('Object', results) ? [results] : results;\n\n if (parsedResults && isType('Array', parsedResults) && parsedResults.length) {\n // Remove loading states/text\n this._handleLoadingState(false);\n // Add each result as a choice\n parsedResults.forEach((result) => {\n if (result.choices) {\n const groupId = (result.id || null);\n this._addGroup(\n result,\n groupId,\n value,\n label,\n );\n } else {\n this._addChoice(\n result[value],\n result[label],\n result.selected,\n result.disabled,\n undefined,\n result.customProperties,\n result.placeholder,\n );\n }\n });\n\n if (this.isSelectOneElement) {\n this._selectPlaceholderChoice();\n }\n } else {\n // No results, remove loading state\n this._handleLoadingState(false);\n }\n };\n }\n\n /**\n * Filter choices based on search value\n * @param {String} value Value to filter by\n * @return\n * @private\n */\n _searchChoices(value) {\n const newValue = isType('String', value) ? value.trim() : value;\n const currentValue = isType('String', this.currentValue) ?\n this.currentValue.trim() :\n this.currentValue;\n\n if (newValue.length < 1 && newValue === `${currentValue} `) {\n return 0;\n }\n\n // If new value matches the desired length and is not the same as the current value with a space\n const haystack = this.store.getSearchableChoices();\n const needle = newValue;\n const keys = isType('Array', this.config.searchFields) ?\n this.config.searchFields :\n [this.config.searchFields];\n const options = Object.assign(this.config.fuseOptions, { keys });\n const fuse = new Fuse(haystack, options);\n const results = fuse.search(needle);\n\n this.currentValue = newValue;\n this.highlightPosition = 0;\n this.isSearching = true;\n this.store.dispatch(filterChoices(results));\n\n return results.length;\n }\n\n /**\n * Determine the action when a user is searching\n * @param {String} value Value entered by user\n * @return\n * @private\n */\n _handleSearch(value) {\n if (!value || !this.input.isFocussed) {\n return;\n }\n\n const choices = this.store.getChoices();\n const hasUnactiveChoices = choices.some(option => !option.active);\n\n // Check that we have a value to search and the input was an alphanumeric character\n if (value && value.length >= this.config.searchFloor) {\n const resultCount = this.config.searchChoices ? this._searchChoices(value) : 0;\n // Trigger search event\n this.passedElement.triggerEvent(EVENTS.search, {\n value,\n resultCount,\n });\n } else if (hasUnactiveChoices) {\n // Otherwise reset choices to active\n this.isSearching = false;\n this.store.dispatch(activateChoices(true));\n }\n }\n\n /**\n * Trigger event listeners\n * @return\n * @private\n */\n _addEventListeners() {\n document.addEventListener('keyup', this._onKeyUp);\n document.addEventListener('keydown', this._onKeyDown);\n document.addEventListener('click', this._onClick);\n document.addEventListener('touchmove', this._onTouchMove);\n document.addEventListener('touchend', this._onTouchEnd);\n document.addEventListener('mousedown', this._onMouseDown);\n document.addEventListener('mouseover', this._onMouseOver);\n\n if (this.isSelectOneElement) {\n this.containerOuter.element.addEventListener('focus', this._onFocus);\n this.containerOuter.element.addEventListener('blur', this._onBlur);\n }\n\n this.input.element.addEventListener('focus', this._onFocus);\n this.input.element.addEventListener('blur', this._onBlur);\n\n this.input.addEventListeners();\n }\n\n /**\n * Remove event listeners\n * @return\n * @private\n */\n _removeEventListeners() {\n document.removeEventListener('keyup', this._onKeyUp);\n document.removeEventListener('keydown', this._onKeyDown);\n document.removeEventListener('click', this._onClick);\n document.removeEventListener('touchmove', this._onTouchMove);\n document.removeEventListener('touchend', this._onTouchEnd);\n document.removeEventListener('mousedown', this._onMouseDown);\n document.removeEventListener('mouseover', this._onMouseOver);\n\n if (this.isSelectOneElement) {\n this.containerOuter.element.removeEventListener('focus', this._onFocus);\n this.containerOuter.element.removeEventListener('blur', this._onBlur);\n }\n\n this.input.element.removeEventListener('focus', this._onFocus);\n this.input.element.removeEventListener('blur', this._onBlur);\n\n this.input.removeEventListeners();\n }\n\n /**\n * Key down event\n * @param {Object} e Event\n * @return\n */\n _onKeyDown(e) {\n if (e.target !== this.input.element && !this.containerOuter.element.contains(e.target)) {\n return;\n }\n\n const target = e.target;\n const activeItems = this.store.getItemsFilteredByActive();\n const hasFocusedInput = this.input.isFocussed;\n const hasActiveDropdown = this.dropdown.isActive;\n const hasItems = this.itemList.hasChildren;\n const keyString = String.fromCharCode(e.keyCode);\n const backKey = KEY_CODES.BACK_KEY;\n const deleteKey = KEY_CODES.DELETE_KEY;\n const enterKey = KEY_CODES.ENTER_KEY;\n const aKey = KEY_CODES.A_KEY;\n const escapeKey = KEY_CODES.ESC_KEY;\n const upKey = KEY_CODES.UP_KEY;\n const downKey = KEY_CODES.DOWN_KEY;\n const pageUpKey = KEY_CODES.PAGE_UP_KEY;\n const pageDownKey = KEY_CODES.PAGE_DOWN_KEY;\n const ctrlDownKey = (e.ctrlKey || e.metaKey);\n\n // If a user is typing and the dropdown is not active\n if (!this.isTextElement && /[a-zA-Z0-9-_ ]/.test(keyString)) {\n this.showDropdown(true);\n }\n\n this.canSearch = this.config.searchEnabled;\n\n const onAKey = () => {\n // If CTRL + A or CMD + A have been pressed and there are items to select\n if (ctrlDownKey && hasItems) {\n this.canSearch = false;\n if (\n this.config.removeItems &&\n !this.input.getValue() &&\n this.input.element === document.activeElement\n ) {\n // Highlight items\n this.highlightAll();\n }\n }\n };\n\n const onEnterKey = () => {\n // If enter key is pressed and the input has a value\n if (this.isTextElement && target.value) {\n const value = this.input.getValue();\n const canAddItem = this._canAddItem(activeItems, value);\n\n // All is good, add\n if (canAddItem.response) {\n this.hideDropdown();\n this._addItem(value);\n this._triggerChange(value);\n this.clearInput();\n }\n }\n\n if (target.hasAttribute('data-button')) {\n this._handleButtonAction(activeItems, target);\n e.preventDefault();\n }\n\n if (hasActiveDropdown) {\n e.preventDefault();\n const highlighted = this.dropdown.getChild(`.${this.config.classNames.highlightedState}`);\n\n // If we have a highlighted choice\n if (highlighted) {\n // add enter keyCode value\n if (activeItems[0]) {\n activeItems[0].keyCode = enterKey;\n }\n this._handleChoiceAction(activeItems, highlighted);\n }\n } else if (this.isSelectOneElement) {\n // Open single select dropdown if it's not active\n this.showDropdown(true);\n e.preventDefault();\n }\n };\n\n const onEscapeKey = () => {\n if (hasActiveDropdown) {\n this.hideDropdown();\n this.containerOuter.focus();\n }\n };\n\n const onDirectionKey = () => {\n // If up or down key is pressed, traverse through options\n if (hasActiveDropdown || this.isSelectOneElement) {\n // Show dropdown if focus\n this.showDropdown(true);\n\n this.canSearch = false;\n\n const directionInt = e.keyCode === downKey || e.keyCode === pageDownKey ? 1 : -1;\n const skipKey = e.metaKey || e.keyCode === pageDownKey || e.keyCode === pageUpKey;\n\n let nextEl;\n if (skipKey) {\n if (directionInt > 0) {\n nextEl = Array.from(\n this.dropdown.element.querySelectorAll('[data-choice-selectable]'),\n ).pop();\n } else {\n nextEl = this.dropdown.element.querySelector('[data-choice-selectable]');\n }\n } else {\n const currentEl = this.dropdown.element.querySelector(\n `.${this.config.classNames.highlightedState}`,\n );\n if (currentEl) {\n nextEl = getAdjacentEl(currentEl, '[data-choice-selectable]', directionInt);\n } else {\n nextEl = this.dropdown.element.querySelector('[data-choice-selectable]');\n }\n }\n\n if (nextEl) {\n // We prevent default to stop the cursor moving\n // when pressing the arrow\n if (!isScrolledIntoView(nextEl, this.choiceList, directionInt)) {\n this._scrollToChoice(nextEl, directionInt);\n }\n this._highlightChoice(nextEl);\n }\n\n // Prevent default to maintain cursor position whilst\n // traversing dropdown options\n e.preventDefault();\n }\n };\n\n const onDeleteKey = () => {\n // If backspace or delete key is pressed and the input has no value\n if (hasFocusedInput && !e.target.value && !this.isSelectOneElement) {\n this._handleBackspace(activeItems);\n e.preventDefault();\n }\n };\n\n // Map keys to key actions\n const keyDownActions = {\n [aKey]: onAKey,\n [enterKey]: onEnterKey,\n [escapeKey]: onEscapeKey,\n [upKey]: onDirectionKey,\n [pageUpKey]: onDirectionKey,\n [downKey]: onDirectionKey,\n [pageDownKey]: onDirectionKey,\n [deleteKey]: onDeleteKey,\n [backKey]: onDeleteKey,\n };\n\n // If keycode has a function, run it\n if (keyDownActions[e.keyCode]) {\n keyDownActions[e.keyCode]();\n }\n }\n\n /**\n * Key up event\n * @param {Object} e Event\n * @return\n * @private\n */\n _onKeyUp(e) {\n if (e.target !== this.input.element) {\n return;\n }\n\n const value = this.input.getValue();\n const activeItems = this.store.getItemsFilteredByActive();\n const canAddItem = this._canAddItem(activeItems, value);\n\n // We are typing into a text input and have a value, we want to show a dropdown\n // notice. Otherwise hide the dropdown\n if (this.isTextElement) {\n if (value) {\n if (canAddItem.notice) {\n const dropdownItem = this._getTemplate('notice', canAddItem.notice);\n this.dropdown.element.innerHTML = dropdownItem.outerHTML;\n }\n\n if (canAddItem.response === true) {\n this.showDropdown();\n } else if (!canAddItem.notice) {\n this.hideDropdown();\n }\n } else {\n this.hideDropdown();\n }\n } else {\n const backKey = KEY_CODES.BACK_KEY;\n const deleteKey = KEY_CODES.DELETE_KEY;\n\n // If user has removed value...\n if ((e.keyCode === backKey || e.keyCode === deleteKey) && !e.target.value) {\n // ...and it is a multiple select input, activate choices (if searching)\n if (!this.isTextElement && this.isSearching) {\n this.isSearching = false;\n this.store.dispatch(activateChoices(true));\n }\n } else if (this.canSearch && canAddItem.response) {\n this._handleSearch(this.input.getValue());\n }\n }\n // Re-establish canSearch value from changes in _onKeyDown\n this.canSearch = this.config.searchEnabled;\n }\n\n /**\n * Touch move event\n * @return\n * @private\n */\n _onTouchMove() {\n if (this.wasTap === true) {\n this.wasTap = false;\n }\n }\n\n /**\n * Touch end event\n * @param {Object} e Event\n * @return\n * @private\n */\n _onTouchEnd(e) {\n const target = (e.target || e.touches[0].target);\n\n // If a user tapped within our container...\n if (this.wasTap === true && this.containerOuter.element.contains(target)) {\n // ...and we aren't dealing with a single select box, show dropdown/focus input\n if (\n (target === this.containerOuter.element || target === this.containerInner.element) &&\n !this.isSelectOneElement\n ) {\n if (this.isTextElement) {\n // If text element, we only want to focus the input\n this.input.focus();\n } else {\n // If a select box, we want to show the dropdown\n this.showDropdown(true);\n }\n }\n // Prevents focus event firing\n e.stopPropagation();\n }\n\n this.wasTap = true;\n }\n\n /**\n * Mouse down event\n * @param {Object} e Event\n * @return\n * @private\n */\n _onMouseDown(e) {\n const target = e.target;\n\n // If we have our mouse down on the scrollbar and are on IE11...\n if (target === this.choiceList && this.isIe11) {\n this.isScrollingOnIe = true;\n }\n\n if (this.containerOuter.element.contains(target) && target !== this.input.element) {\n const activeItems = this.store.getItemsFilteredByActive();\n const hasShiftKey = e.shiftKey;\n\n const buttonTarget = findAncestorByAttrName(target, 'data-button');\n const itemTarget = findAncestorByAttrName(target, 'data-item');\n const choiceTarget = findAncestorByAttrName(target, 'data-choice');\n\n if (buttonTarget) {\n this._handleButtonAction(activeItems, buttonTarget);\n } else if (itemTarget) {\n this._handleItemAction(activeItems, itemTarget, hasShiftKey);\n } else if (choiceTarget) {\n this._handleChoiceAction(activeItems, choiceTarget);\n }\n\n e.preventDefault();\n }\n }\n\n /**\n * Mouse over (hover) event\n * @param {Object} e Event\n * @return\n * @private\n */\n _onMouseOver(e) {\n // If the dropdown is either the target or one of its children is the target\n const targetWithinDropdown = (\n e.target === this.dropdown || this.dropdown.element.contains(e.target)\n );\n const shouldHighlightChoice = targetWithinDropdown && e.target.hasAttribute('data-choice');\n\n if (shouldHighlightChoice) {\n this._highlightChoice(e.target);\n }\n }\n\n /**\n * Click event\n * @param {Object} e Event\n * @return\n * @private\n */\n _onClick(e) {\n const target = e.target;\n const hasActiveDropdown = this.dropdown.isActive;\n const activeItems = this.store.getItemsFilteredByActive();\n\n // If target is something that concerns us\n if (this.containerOuter.element.contains(target)) {\n if (!hasActiveDropdown) {\n if (this.isTextElement) {\n if (document.activeElement !== this.input.element) {\n this.input.focus();\n }\n } else if (this.canSearch) {\n this.showDropdown(true);\n } else {\n this.showDropdown();\n // code smell\n this.containerOuter.focus();\n }\n } else if (\n this.isSelectOneElement &&\n target !== this.input.element &&\n !this.dropdown.element.contains(target)\n ) {\n this.hideDropdown(true);\n }\n } else {\n const hasHighlightedItems = activeItems.some(item => item.highlighted);\n\n // De-select any highlighted items\n if (hasHighlightedItems) {\n this.unhighlightAll();\n }\n\n // Remove focus state\n this.containerOuter.removeFocusState();\n\n // Close all other dropdowns\n this.hideDropdown();\n }\n }\n\n /**\n * Focus event\n * @param {Object} e Event\n * @return\n * @private\n */\n _onFocus(e) {\n const target = e.target;\n if (!this.containerOuter.element.contains(target)) {\n return;\n }\n\n const focusActions = {\n text: () => {\n if (target === this.input.element) {\n this.containerOuter.addFocusState();\n }\n },\n 'select-one': () => {\n this.containerOuter.addFocusState();\n if (target === this.input.element) {\n // Show dropdown if it isn't already showing\n this.showDropdown();\n }\n },\n 'select-multiple': () => {\n if (target === this.input.element) {\n // If element is a select box, the focused element is the container and the dropdown\n // isn't already open, focus and show dropdown\n this.containerOuter.addFocusState();\n this.showDropdown(true);\n }\n },\n };\n\n focusActions[this.passedElement.element.type]();\n }\n\n /**\n * Blur event\n * @param {Object} e Event\n * @return\n * @private\n */\n _onBlur(e) {\n const target = e.target;\n // If target is something that concerns us\n if (this.containerOuter.element.contains(target) && !this.isScrollingOnIe) {\n const activeItems = this.store.getItemsFilteredByActive();\n const hasHighlightedItems = activeItems.some(item => item.highlighted);\n const blurActions = {\n text: () => {\n if (target === this.input.element) {\n // Remove the focus state\n this.containerOuter.removeFocusState();\n // De-select any highlighted items\n if (hasHighlightedItems) {\n this.unhighlightAll();\n }\n this.hideDropdown();\n }\n },\n 'select-one': () => {\n this.containerOuter.removeFocusState();\n if (target === this.containerOuter.element) {\n // Hide dropdown if it is showing\n if (!this.canSearch) {\n this.hideDropdown();\n }\n }\n if (target === this.input.element) {\n // Hide dropdown if it is showing\n this.hideDropdown();\n }\n },\n 'select-multiple': () => {\n if (target === this.input.element) {\n // Remove the focus state\n this.containerOuter.removeFocusState();\n this.hideDropdown();\n // De-select any highlighted items\n if (hasHighlightedItems) {\n this.unhighlightAll();\n }\n }\n },\n };\n\n blurActions[this.passedElement.element.type]();\n } else {\n // On IE11, clicking the scollbar blurs our input and thus\n // closes the dropdown. To stop this, we refocus our input\n // if we know we are on IE *and* are scrolling.\n this.isScrollingOnIe = false;\n this.input.element.focus();\n }\n }\n\n /**\n * Scroll to an option element\n * @param {HTMLElement} choice Option to scroll to\n * @param {Number} direction Whether option is above or below\n * @return\n * @private\n */\n _scrollToChoice(choice, direction) {\n if (!choice) {\n return;\n }\n\n const dropdownHeight = this.choiceList.height;\n const choiceHeight = choice.offsetHeight;\n // Distance from bottom of element to top of parent\n const choicePos = choice.offsetTop + choiceHeight;\n // Scroll position of dropdown\n const containerScrollPos = this.choiceList.scrollPos + dropdownHeight;\n // Difference between the choice and scroll position\n const endPoint = direction > 0 ? (\n (this.choiceList.scrollPos + choicePos) - containerScrollPos) :\n choice.offsetTop;\n\n const animateScroll = () => {\n const strength = SCROLLING_SPEED;\n const choiceListScrollTop = this.choiceList.scrollPos;\n let continueAnimation = false;\n let easing;\n let distance;\n\n if (direction > 0) {\n easing = (endPoint - choiceListScrollTop) / strength;\n distance = easing > 1 ? easing : 1;\n\n this.choiceList.scrollTo(choiceListScrollTop + distance);\n if (choiceListScrollTop < endPoint) {\n continueAnimation = true;\n }\n } else {\n easing = (choiceListScrollTop - endPoint) / strength;\n distance = easing > 1 ? easing : 1;\n\n this.choiceList.scrollTo(choiceListScrollTop - distance);\n if (choiceListScrollTop > endPoint) {\n continueAnimation = true;\n }\n }\n\n if (continueAnimation) {\n requestAnimationFrame((time) => {\n animateScroll(time, endPoint, direction);\n });\n }\n };\n\n requestAnimationFrame((time) => {\n animateScroll(time, endPoint, direction);\n });\n }\n\n /**\n * Highlight choice\n * @param {HTMLElement} [el] Element to highlight\n * @return\n * @private\n */\n _highlightChoice(el = null) {\n // Highlight first element in dropdown\n const choices = Array.from(this.dropdown.element.querySelectorAll('[data-choice-selectable]'));\n let passedEl = el;\n\n if (choices && choices.length) {\n const highlightedChoices = Array.from(\n this.dropdown.element.querySelectorAll(`.${this.config.classNames.highlightedState}`),\n );\n const hasActiveDropdown = this.dropdown.isActive;\n\n // Remove any highlighted choices\n highlightedChoices.forEach((choice) => {\n choice.classList.remove(this.config.classNames.highlightedState);\n choice.setAttribute('aria-selected', 'false');\n });\n\n if (passedEl) {\n this.highlightPosition = choices.indexOf(passedEl);\n } else {\n // Highlight choice based on last known highlight location\n if (choices.length > this.highlightPosition) {\n // If we have an option to highlight\n passedEl = choices[this.highlightPosition];\n } else {\n // Otherwise highlight the option before\n passedEl = choices[choices.length - 1];\n }\n\n if (!passedEl) {\n passedEl = choices[0];\n }\n }\n\n // Highlight given option, and set accessiblity attributes\n passedEl.classList.add(this.config.classNames.highlightedState);\n passedEl.setAttribute('aria-selected', 'true');\n\n if (hasActiveDropdown) {\n // IE11 ignores aria-label and blocks virtual keyboard\n // if aria-activedescendant is set without a dropdown\n this.input.setActiveDescendant(passedEl.id);\n this.containerOuter.setActiveDescendant(passedEl.id);\n }\n }\n }\n\n /**\n * Add item to store with correct value\n * @param {String} value Value to add to store\n * @param {String} [label] Label to add to store\n * @param {Number} [choiceId=-1] ID of the associated choice that was selected\n * @param {Number} [groupId=-1] ID of group choice is within. Negative number indicates no group\n * @param {Object} [customProperties] Object containing user defined properties\n * @return {Object} Class instance\n * @public\n */\n _addItem(\n value,\n label = null,\n choiceId = -1,\n groupId = -1,\n customProperties = null,\n placeholder = false,\n keyCode = null,\n ) {\n let passedValue = isType('String', value) ? value.trim() : value;\n const passedKeyCode = keyCode;\n const items = this.store.getItems();\n const passedLabel = label || passedValue;\n const passedOptionId = parseInt(choiceId, 10) || -1;\n\n // Get group if group ID passed\n const group = groupId >= 0 ? this.store.getGroupById(groupId) : null;\n\n // Generate unique id\n const id = items ? items.length + 1 : 1;\n\n // If a prepended value has been passed, prepend it\n if (this.config.prependValue) {\n passedValue = this.config.prependValue + passedValue.toString();\n }\n\n // If an appended value has been passed, append it\n if (this.config.appendValue) {\n passedValue += this.config.appendValue.toString();\n }\n\n this.store.dispatch(\n addItem(\n passedValue,\n passedLabel,\n id,\n passedOptionId,\n groupId,\n customProperties,\n placeholder,\n passedKeyCode,\n ),\n );\n\n if (this.isSelectOneElement) {\n this.removeActiveItems(id);\n }\n\n // Trigger change event\n if (group && group.value) {\n this.passedElement.triggerEvent(EVENTS.addItem, {\n id,\n value: passedValue,\n label: passedLabel,\n groupValue: group.value,\n keyCode: passedKeyCode,\n });\n } else {\n this.passedElement.triggerEvent(EVENTS.addItem, {\n id,\n value: passedValue,\n label: passedLabel,\n keyCode: passedKeyCode,\n });\n }\n\n return this;\n }\n\n /**\n * Remove item from store\n * @param {Object} item Item to remove\n * @return {Object} Class instance\n * @public\n */\n _removeItem(item) {\n if (!item || !isType('Object', item)) {\n return this;\n }\n\n const id = item.id;\n const value = item.value;\n const label = item.label;\n const choiceId = item.choiceId;\n const groupId = item.groupId;\n const group = groupId >= 0 ? this.store.getGroupById(groupId) : null;\n\n this.store.dispatch(removeItem(id, choiceId));\n\n if (group && group.value) {\n this.passedElement.triggerEvent(EVENTS.removeItem, {\n id,\n value,\n label,\n groupValue: group.value,\n });\n } else {\n this.passedElement.triggerEvent(EVENTS.removeItem, {\n id,\n value,\n label,\n });\n }\n\n return this;\n }\n\n /**\n * Add choice to dropdown\n * @param {String} value Value of choice\n * @param {String} [label] Label of choice\n * @param {Boolean} [isSelected=false] Whether choice is selected\n * @param {Boolean} [isDisabled=false] Whether choice is disabled\n * @param {Number} [groupId=-1] ID of group choice is within. Negative number indicates no group\n * @param {Object} [customProperties] Object containing user defined properties\n * @return\n * @private\n */\n _addChoice(\n value,\n label = null,\n isSelected = false,\n isDisabled = false,\n groupId = -1,\n customProperties = null,\n placeholder = false,\n keyCode = null,\n ) {\n if (typeof value === 'undefined' || value === null) {\n return;\n }\n\n // Generate unique id\n const choices = this.store.getChoices();\n const choiceLabel = label || value;\n const choiceId = choices ? choices.length + 1 : 1;\n const choiceElementId = `${this.baseId}-${this.idNames.itemChoice}-${choiceId}`;\n\n this.store.dispatch(\n addChoice(\n value,\n choiceLabel,\n choiceId,\n groupId,\n isDisabled,\n choiceElementId,\n customProperties,\n placeholder,\n keyCode,\n ),\n );\n\n if (isSelected) {\n this._addItem(\n value,\n choiceLabel,\n choiceId,\n undefined,\n customProperties,\n placeholder,\n keyCode,\n );\n }\n }\n\n /**\n * Clear all choices added to the store.\n * @return\n * @private\n */\n _clearChoices() {\n this.store.dispatch(\n clearChoices(),\n );\n }\n\n /**\n * Add group to dropdown\n * @param {Object} group Group to add\n * @param {Number} id Group ID\n * @param {String} [valueKey] name of the value property on the object\n * @param {String} [labelKey] name of the label property on the object\n * @return\n * @private\n */\n _addGroup(group, id, valueKey = 'value', labelKey = 'label') {\n const groupChoices = isType('Object', group) ?\n group.choices :\n Array.from(group.getElementsByTagName('OPTION'));\n const groupId = id || Math.floor(new Date().valueOf() * Math.random());\n const isDisabled = group.disabled ? group.disabled : false;\n\n if (groupChoices) {\n this.store.dispatch(\n addGroup(\n group.label,\n groupId,\n true,\n isDisabled,\n ),\n );\n\n const addGroupChoices = (choice) => {\n const isOptDisabled = choice.disabled || (choice.parentNode && choice.parentNode.disabled);\n this._addChoice(\n choice[valueKey],\n (isType('Object', choice)) ? choice[labelKey] : choice.innerHTML,\n choice.selected,\n isOptDisabled,\n groupId,\n choice.customProperties,\n choice.placeholder,\n );\n };\n\n groupChoices.forEach(addGroupChoices);\n } else {\n this.store.dispatch(\n addGroup(\n group.label,\n group.id,\n false,\n group.disabled,\n ),\n );\n }\n }\n\n /**\n * Get template from name\n * @param {String} template Name of template to get\n * @param {...} args Data to pass to template\n * @return {HTMLElement} Template\n * @private\n */\n _getTemplate(template, ...args) {\n if (!template) {\n return null;\n }\n const templates = this.config.templates;\n const globalClasses = this.config.classNames;\n return templates[template].call(this, globalClasses, ...args);\n }\n\n /**\n * Create HTML element based on type and arguments\n * @return\n * @private\n */\n _createTemplates() {\n // User's custom templates\n const callbackTemplate = this.config.callbackOnCreateTemplates;\n let userTemplates = {};\n if (callbackTemplate && isType('Function', callbackTemplate)) {\n userTemplates = callbackTemplate.call(this, strToEl);\n }\n\n this.config.templates = extend(TEMPLATES, userTemplates);\n }\n\n /**\n * Create DOM structure around passed select element\n * @return\n * @private\n */\n _createStructure() {\n const direction = this.passedElement.element.getAttribute('dir') || 'ltr';\n const containerOuter = this._getTemplate('containerOuter',\n direction,\n this.isSelectElement,\n this.isSelectOneElement,\n this.config.searchEnabled,\n this.passedElement.element.type,\n );\n const containerInner = this._getTemplate('containerInner');\n const itemList = this._getTemplate('itemList', this.isSelectOneElement);\n const choiceList = this._getTemplate('choiceList', this.isSelectOneElement);\n const input = this._getTemplate('input');\n const dropdown = this._getTemplate('dropdown');\n\n this.containerOuter = new Container(this, containerOuter, this.config.classNames);\n this.containerInner = new Container(this, containerInner, this.config.classNames);\n this.input = new Input(this, input, this.config.classNames);\n this.choiceList = new List(this, choiceList, this.config.classNames);\n this.itemList = new List(this, itemList, this.config.classNames);\n this.dropdown = new Dropdown(this, dropdown, this.config.classNames);\n\n this.passedElement.conceal();\n\n // Wrap input in container preserving DOM ordering\n wrap(this.passedElement.element, this.containerInner.element);\n // Wrapper inner container with outer container\n wrap(this.containerInner.element, this.containerOuter.element);\n\n if (this.isSelectOneElement) {\n this.input.setPlaceholder(this.config.searchPlaceholderValue || '');\n } else if (this.placeholder) {\n this.input.setPlaceholder(this.placeholder);\n this.input.setWidth(true);\n }\n\n if (!this.config.addItems) {\n this.disable();\n }\n\n this.containerOuter.element.appendChild(this.containerInner.element);\n this.containerOuter.element.appendChild(this.dropdown.element);\n this.containerInner.element.appendChild(itemList);\n\n if (!this.isTextElement) {\n dropdown.appendChild(choiceList);\n }\n\n if (!this.isSelectOneElement) {\n this.containerInner.element.appendChild(this.input.element);\n } else if (this.canSearch) {\n dropdown.insertBefore(input, dropdown.firstChild);\n }\n\n if (this.isSelectElement) {\n this._addPredefinedChoices();\n } else if (this.isTextElement) {\n this._addPredefinedItems();\n }\n }\n\n _addPredefinedChoices() {\n const passedGroups = this.passedElement.getOptionGroups();\n\n this.highlightPosition = 0;\n this.isSearching = false;\n\n if (passedGroups && passedGroups.length) {\n // If we have a placeholder option\n const placeholderChoice = this.passedElement.getPlaceholderOption();\n if (placeholderChoice && placeholderChoice.parentNode.tagName === 'SELECT') {\n this._addChoice(\n placeholderChoice.value,\n placeholderChoice.innerHTML,\n placeholderChoice.selected,\n placeholderChoice.disabled,\n undefined,\n undefined,\n /* placeholder */ true,\n );\n }\n\n passedGroups.forEach((group) => {\n this._addGroup(group, (group.id || null));\n });\n } else {\n const passedOptions = this.passedElement.getOptions();\n const filter = this.config.sortFilter;\n const allChoices = this.presetChoices;\n\n // Create array of options from option elements\n passedOptions.forEach((o) => {\n allChoices.push({\n value: o.value,\n label: o.innerHTML,\n selected: o.selected,\n disabled: o.disabled || o.parentNode.disabled,\n placeholder: o.hasAttribute('placeholder'),\n });\n });\n\n // If sorting is enabled or the user is searching, filter choices\n if (this.config.shouldSort) {\n allChoices.sort(filter);\n }\n\n // Determine whether there is a selected choice\n const hasSelectedChoice = allChoices.some(choice => choice.selected);\n const handleChoice = (choice, index) => {\n if (this.isSelectElement) {\n // If the choice is actually a group\n if (choice.choices) {\n this._addGroup(choice, choice.id || null);\n } else {\n // If there is a selected choice already or the choice is not\n // the first in the array, add each choice normally\n // Otherwise pre-select the first choice in the array if it's a single select\n const shouldPreselect = this.isSelectOneElement && !hasSelectedChoice && index === 0;\n const isSelected = shouldPreselect ? true : choice.selected;\n const isDisabled = shouldPreselect ? false : choice.disabled;\n\n this._addChoice(\n choice.value,\n choice.label,\n isSelected,\n isDisabled,\n undefined,\n choice.customProperties,\n choice.placeholder,\n );\n }\n } else {\n this._addChoice(\n choice.value,\n choice.label,\n choice.selected,\n choice.disabled,\n undefined,\n choice.customProperties,\n choice.placeholder,\n );\n }\n };\n\n // Add each choice\n allChoices.forEach((choice, index) => handleChoice(choice, index));\n }\n }\n\n _addPredefinedItems() {\n const handlePresetItem = (item) => {\n const itemType = getType(item);\n if (itemType === 'Object') {\n if (!item.value) {\n return;\n }\n this._addItem(\n item.value,\n item.label,\n item.id,\n undefined,\n item.customProperties,\n item.placeholder,\n );\n } else if (itemType === 'String') {\n this._addItem(item);\n }\n };\n\n this.presetItems.forEach(item => handlePresetItem(item));\n }\n\n _setChoiceOrItem(item) {\n const itemType = getType(item).toLowerCase();\n const handleType = {\n object: () => {\n if (!item.value) {\n return;\n }\n\n // If we are dealing with a select input, we need to create an option first\n // that is then selected. For text inputs we can just add items normally.\n if (!this.isTextElement) {\n this._addChoice(\n item.value,\n item.label,\n true,\n false, -1,\n item.customProperties,\n item.placeholder,\n );\n } else {\n this._addItem(\n item.value,\n item.label,\n item.id,\n undefined,\n item.customProperties,\n item.placeholder,\n );\n }\n },\n string: () => {\n if (!this.isTextElement) {\n this._addChoice(\n item,\n item,\n true,\n false, -1,\n null,\n );\n } else {\n this._addItem(item);\n }\n },\n };\n\n handleType[itemType]();\n }\n\n _findAndSelectChoiceByValue(val) {\n const choices = this.store.getChoices();\n // Check 'value' property exists and the choice isn't already selected\n const foundChoice = choices.find(choice => choice.value === val);\n\n if (foundChoice && !foundChoice.selected) {\n this._addItem(\n foundChoice.value,\n foundChoice.label,\n foundChoice.id,\n foundChoice.groupId,\n foundChoice.customProperties,\n foundChoice.placeholder,\n foundChoice.keyCode,\n );\n }\n }\n\n /* ===== End of Private functions ====== */\n}\n\nChoices.userDefaults = {};\nmodule.exports = Choices;\n\n\n\n// WEBPACK FOOTER //\n// src/scripts/src/choices.js","/*!\n * Fuse.js v3.2.0 - Lightweight fuzzy-search (http://fusejs.io)\n * \n * Copyright (c) 2012-2017 Kirollos Risk (http://kiro.me)\n * All Rights Reserved. Apache Software License 2.0\n * \n * http://www.apache.org/licenses/LICENSE-2.0\n */\n(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine(\"Fuse\", [], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"Fuse\"] = factory();\n\telse\n\t\troot[\"Fuse\"] = factory();\n})(this, function() {\nreturn /******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId]) {\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\ti: moduleId,\n/******/ \t\t\tl: false,\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.l = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// identity function for calling harmony imports with the correct context\n/******/ \t__webpack_require__.i = function(value) { return value; };\n/******/\n/******/ \t// define getter function for harmony exports\n/******/ \t__webpack_require__.d = function(exports, name, getter) {\n/******/ \t\tif(!__webpack_require__.o(exports, name)) {\n/******/ \t\t\tObject.defineProperty(exports, name, {\n/******/ \t\t\t\tconfigurable: false,\n/******/ \t\t\t\tenumerable: true,\n/******/ \t\t\t\tget: getter\n/******/ \t\t\t});\n/******/ \t\t}\n/******/ \t};\n/******/\n/******/ \t// getDefaultExport function for compatibility with non-harmony modules\n/******/ \t__webpack_require__.n = function(module) {\n/******/ \t\tvar getter = module && module.__esModule ?\n/******/ \t\t\tfunction getDefault() { return module['default']; } :\n/******/ \t\t\tfunction getModuleExports() { return module; };\n/******/ \t\t__webpack_require__.d(getter, 'a', getter);\n/******/ \t\treturn getter;\n/******/ \t};\n/******/\n/******/ \t// Object.prototype.hasOwnProperty.call\n/******/ \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(__webpack_require__.s = 8);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nmodule.exports = function (obj) {\n return Object.prototype.toString.call(obj) === '[object Array]';\n};\n\n/***/ }),\n/* 1 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nvar bitapRegexSearch = __webpack_require__(5);\nvar bitapSearch = __webpack_require__(7);\nvar patternAlphabet = __webpack_require__(4);\n\nvar Bitap = function () {\n function Bitap(pattern, _ref) {\n var _ref$location = _ref.location,\n location = _ref$location === undefined ? 0 : _ref$location,\n _ref$distance = _ref.distance,\n distance = _ref$distance === undefined ? 100 : _ref$distance,\n _ref$threshold = _ref.threshold,\n threshold = _ref$threshold === undefined ? 0.6 : _ref$threshold,\n _ref$maxPatternLength = _ref.maxPatternLength,\n maxPatternLength = _ref$maxPatternLength === undefined ? 32 : _ref$maxPatternLength,\n _ref$isCaseSensitive = _ref.isCaseSensitive,\n isCaseSensitive = _ref$isCaseSensitive === undefined ? false : _ref$isCaseSensitive,\n _ref$tokenSeparator = _ref.tokenSeparator,\n tokenSeparator = _ref$tokenSeparator === undefined ? / +/g : _ref$tokenSeparator,\n _ref$findAllMatches = _ref.findAllMatches,\n findAllMatches = _ref$findAllMatches === undefined ? false : _ref$findAllMatches,\n _ref$minMatchCharLeng = _ref.minMatchCharLength,\n minMatchCharLength = _ref$minMatchCharLeng === undefined ? 1 : _ref$minMatchCharLeng;\n\n _classCallCheck(this, Bitap);\n\n this.options = {\n location: location,\n distance: distance,\n threshold: threshold,\n maxPatternLength: maxPatternLength,\n isCaseSensitive: isCaseSensitive,\n tokenSeparator: tokenSeparator,\n findAllMatches: findAllMatches,\n minMatchCharLength: minMatchCharLength\n };\n\n this.pattern = this.options.isCaseSensitive ? pattern : pattern.toLowerCase();\n\n if (this.pattern.length <= maxPatternLength) {\n this.patternAlphabet = patternAlphabet(this.pattern);\n }\n }\n\n _createClass(Bitap, [{\n key: 'search',\n value: function search(text) {\n if (!this.options.isCaseSensitive) {\n text = text.toLowerCase();\n }\n\n // Exact match\n if (this.pattern === text) {\n return {\n isMatch: true,\n score: 0,\n matchedIndices: [[0, text.length - 1]]\n };\n }\n\n // When pattern length is greater than the machine word length, just do a a regex comparison\n var _options = this.options,\n maxPatternLength = _options.maxPatternLength,\n tokenSeparator = _options.tokenSeparator;\n\n if (this.pattern.length > maxPatternLength) {\n return bitapRegexSearch(text, this.pattern, tokenSeparator);\n }\n\n // Otherwise, use Bitap algorithm\n var _options2 = this.options,\n location = _options2.location,\n distance = _options2.distance,\n threshold = _options2.threshold,\n findAllMatches = _options2.findAllMatches,\n minMatchCharLength = _options2.minMatchCharLength;\n\n return bitapSearch(text, this.pattern, this.patternAlphabet, {\n location: location,\n distance: distance,\n threshold: threshold,\n findAllMatches: findAllMatches,\n minMatchCharLength: minMatchCharLength\n });\n }\n }]);\n\n return Bitap;\n}();\n\n// let x = new Bitap(\"od mn war\", {})\n// let result = x.search(\"Old Man's War\")\n// console.log(result)\n\nmodule.exports = Bitap;\n\n/***/ }),\n/* 2 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar isArray = __webpack_require__(0);\n\nvar deepValue = function deepValue(obj, path, list) {\n if (!path) {\n // If there's no path left, we've gotten to the object we care about.\n list.push(obj);\n } else {\n var dotIndex = path.indexOf('.');\n var firstSegment = path;\n var remaining = null;\n\n if (dotIndex !== -1) {\n firstSegment = path.slice(0, dotIndex);\n remaining = path.slice(dotIndex + 1);\n }\n\n var value = obj[firstSegment];\n\n if (value !== null && value !== undefined) {\n if (!remaining && (typeof value === 'string' || typeof value === 'number')) {\n list.push(value.toString());\n } else if (isArray(value)) {\n // Search each item in the array.\n for (var i = 0, len = value.length; i < len; i += 1) {\n deepValue(value[i], remaining, list);\n }\n } else if (remaining) {\n // An object. Recurse further.\n deepValue(value, remaining, list);\n }\n }\n }\n\n return list;\n};\n\nmodule.exports = function (obj, path) {\n return deepValue(obj, path, []);\n};\n\n/***/ }),\n/* 3 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nmodule.exports = function () {\n var matchmask = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];\n var minMatchCharLength = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;\n\n var matchedIndices = [];\n var start = -1;\n var end = -1;\n var i = 0;\n\n for (var len = matchmask.length; i < len; i += 1) {\n var match = matchmask[i];\n if (match && start === -1) {\n start = i;\n } else if (!match && start !== -1) {\n end = i - 1;\n if (end - start + 1 >= minMatchCharLength) {\n matchedIndices.push([start, end]);\n }\n start = -1;\n }\n }\n\n // (i-1 - start) + 1 => i - start\n if (matchmask[i - 1] && i - start >= minMatchCharLength) {\n matchedIndices.push([start, i - 1]);\n }\n\n return matchedIndices;\n};\n\n/***/ }),\n/* 4 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nmodule.exports = function (pattern) {\n var mask = {};\n var len = pattern.length;\n\n for (var i = 0; i < len; i += 1) {\n mask[pattern.charAt(i)] = 0;\n }\n\n for (var _i = 0; _i < len; _i += 1) {\n mask[pattern.charAt(_i)] |= 1 << len - _i - 1;\n }\n\n return mask;\n};\n\n/***/ }),\n/* 5 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar SPECIAL_CHARS_REGEX = /[\\-\\[\\]\\/\\{\\}\\(\\)\\*\\+\\?\\.\\\\\\^\\$\\|]/g;\n\nmodule.exports = function (text, pattern) {\n var tokenSeparator = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : / +/g;\n\n var regex = new RegExp(pattern.replace(SPECIAL_CHARS_REGEX, '\\\\$&').replace(tokenSeparator, '|'));\n var matches = text.match(regex);\n var isMatch = !!matches;\n var matchedIndices = [];\n\n if (isMatch) {\n for (var i = 0, matchesLen = matches.length; i < matchesLen; i += 1) {\n var match = matches[i];\n matchedIndices.push([text.indexOf(match), match.length - 1]);\n }\n }\n\n return {\n // TODO: revisit this score\n score: isMatch ? 0.5 : 1,\n isMatch: isMatch,\n matchedIndices: matchedIndices\n };\n};\n\n/***/ }),\n/* 6 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nmodule.exports = function (pattern, _ref) {\n var _ref$errors = _ref.errors,\n errors = _ref$errors === undefined ? 0 : _ref$errors,\n _ref$currentLocation = _ref.currentLocation,\n currentLocation = _ref$currentLocation === undefined ? 0 : _ref$currentLocation,\n _ref$expectedLocation = _ref.expectedLocation,\n expectedLocation = _ref$expectedLocation === undefined ? 0 : _ref$expectedLocation,\n _ref$distance = _ref.distance,\n distance = _ref$distance === undefined ? 100 : _ref$distance;\n\n var accuracy = errors / pattern.length;\n var proximity = Math.abs(expectedLocation - currentLocation);\n\n if (!distance) {\n // Dodge divide by zero error.\n return proximity ? 1.0 : accuracy;\n }\n\n return accuracy + proximity / distance;\n};\n\n/***/ }),\n/* 7 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar bitapScore = __webpack_require__(6);\nvar matchedIndices = __webpack_require__(3);\n\nmodule.exports = function (text, pattern, patternAlphabet, _ref) {\n var _ref$location = _ref.location,\n location = _ref$location === undefined ? 0 : _ref$location,\n _ref$distance = _ref.distance,\n distance = _ref$distance === undefined ? 100 : _ref$distance,\n _ref$threshold = _ref.threshold,\n threshold = _ref$threshold === undefined ? 0.6 : _ref$threshold,\n _ref$findAllMatches = _ref.findAllMatches,\n findAllMatches = _ref$findAllMatches === undefined ? false : _ref$findAllMatches,\n _ref$minMatchCharLeng = _ref.minMatchCharLength,\n minMatchCharLength = _ref$minMatchCharLeng === undefined ? 1 : _ref$minMatchCharLeng;\n\n var expectedLocation = location;\n // Set starting location at beginning text and initialize the alphabet.\n var textLen = text.length;\n // Highest score beyond which we give up.\n var currentThreshold = threshold;\n // Is there a nearby exact match? (speedup)\n var bestLocation = text.indexOf(pattern, expectedLocation);\n\n var patternLen = pattern.length;\n\n // a mask of the matches\n var matchMask = [];\n for (var i = 0; i < textLen; i += 1) {\n matchMask[i] = 0;\n }\n\n if (bestLocation !== -1) {\n var score = bitapScore(pattern, {\n errors: 0,\n currentLocation: bestLocation,\n expectedLocation: expectedLocation,\n distance: distance\n });\n currentThreshold = Math.min(score, currentThreshold);\n\n // What about in the other direction? (speed up)\n bestLocation = text.lastIndexOf(pattern, expectedLocation + patternLen);\n\n if (bestLocation !== -1) {\n var _score = bitapScore(pattern, {\n errors: 0,\n currentLocation: bestLocation,\n expectedLocation: expectedLocation,\n distance: distance\n });\n currentThreshold = Math.min(_score, currentThreshold);\n }\n }\n\n // Reset the best location\n bestLocation = -1;\n\n var lastBitArr = [];\n var finalScore = 1;\n var binMax = patternLen + textLen;\n\n var mask = 1 << patternLen - 1;\n\n for (var _i = 0; _i < patternLen; _i += 1) {\n // Scan for the best match; each iteration allows for one more error.\n // Run a binary search to determine how far from the match location we can stray\n // at this error level.\n var binMin = 0;\n var binMid = binMax;\n\n while (binMin < binMid) {\n var _score3 = bitapScore(pattern, {\n errors: _i,\n currentLocation: expectedLocation + binMid,\n expectedLocation: expectedLocation,\n distance: distance\n });\n\n if (_score3 <= currentThreshold) {\n binMin = binMid;\n } else {\n binMax = binMid;\n }\n\n binMid = Math.floor((binMax - binMin) / 2 + binMin);\n }\n\n // Use the result from this iteration as the maximum for the next.\n binMax = binMid;\n\n var start = Math.max(1, expectedLocation - binMid + 1);\n var finish = findAllMatches ? textLen : Math.min(expectedLocation + binMid, textLen) + patternLen;\n\n // Initialize the bit array\n var bitArr = Array(finish + 2);\n\n bitArr[finish + 1] = (1 << _i) - 1;\n\n for (var j = finish; j >= start; j -= 1) {\n var currentLocation = j - 1;\n var charMatch = patternAlphabet[text.charAt(currentLocation)];\n\n if (charMatch) {\n matchMask[currentLocation] = 1;\n }\n\n // First pass: exact match\n bitArr[j] = (bitArr[j + 1] << 1 | 1) & charMatch;\n\n // Subsequent passes: fuzzy match\n if (_i !== 0) {\n bitArr[j] |= (lastBitArr[j + 1] | lastBitArr[j]) << 1 | 1 | lastBitArr[j + 1];\n }\n\n if (bitArr[j] & mask) {\n finalScore = bitapScore(pattern, {\n errors: _i,\n currentLocation: currentLocation,\n expectedLocation: expectedLocation,\n distance: distance\n });\n\n // This match will almost certainly be better than any existing match.\n // But check anyway.\n if (finalScore <= currentThreshold) {\n // Indeed it is\n currentThreshold = finalScore;\n bestLocation = currentLocation;\n\n // Already passed `loc`, downhill from here on in.\n if (bestLocation <= expectedLocation) {\n break;\n }\n\n // When passing `bestLocation`, don't exceed our current distance from `expectedLocation`.\n start = Math.max(1, 2 * expectedLocation - bestLocation);\n }\n }\n }\n\n // No hope for a (better) match at greater error levels.\n var _score2 = bitapScore(pattern, {\n errors: _i + 1,\n currentLocation: expectedLocation,\n expectedLocation: expectedLocation,\n distance: distance\n });\n\n if (_score2 > currentThreshold) {\n break;\n }\n\n lastBitArr = bitArr;\n }\n\n // Count exact matches (those with a score of 0) to be \"almost\" exact\n return {\n isMatch: bestLocation >= 0,\n score: finalScore === 0 ? 0.001 : finalScore,\n matchedIndices: matchedIndices(matchMask, minMatchCharLength)\n };\n};\n\n/***/ }),\n/* 8 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nvar Bitap = __webpack_require__(1);\nvar deepValue = __webpack_require__(2);\nvar isArray = __webpack_require__(0);\n\nvar Fuse = function () {\n function Fuse(list, _ref) {\n var _ref$location = _ref.location,\n location = _ref$location === undefined ? 0 : _ref$location,\n _ref$distance = _ref.distance,\n distance = _ref$distance === undefined ? 100 : _ref$distance,\n _ref$threshold = _ref.threshold,\n threshold = _ref$threshold === undefined ? 0.6 : _ref$threshold,\n _ref$maxPatternLength = _ref.maxPatternLength,\n maxPatternLength = _ref$maxPatternLength === undefined ? 32 : _ref$maxPatternLength,\n _ref$caseSensitive = _ref.caseSensitive,\n caseSensitive = _ref$caseSensitive === undefined ? false : _ref$caseSensitive,\n _ref$tokenSeparator = _ref.tokenSeparator,\n tokenSeparator = _ref$tokenSeparator === undefined ? / +/g : _ref$tokenSeparator,\n _ref$findAllMatches = _ref.findAllMatches,\n findAllMatches = _ref$findAllMatches === undefined ? false : _ref$findAllMatches,\n _ref$minMatchCharLeng = _ref.minMatchCharLength,\n minMatchCharLength = _ref$minMatchCharLeng === undefined ? 1 : _ref$minMatchCharLeng,\n _ref$id = _ref.id,\n id = _ref$id === undefined ? null : _ref$id,\n _ref$keys = _ref.keys,\n keys = _ref$keys === undefined ? [] : _ref$keys,\n _ref$shouldSort = _ref.shouldSort,\n shouldSort = _ref$shouldSort === undefined ? true : _ref$shouldSort,\n _ref$getFn = _ref.getFn,\n getFn = _ref$getFn === undefined ? deepValue : _ref$getFn,\n _ref$sortFn = _ref.sortFn,\n sortFn = _ref$sortFn === undefined ? function (a, b) {\n return a.score - b.score;\n } : _ref$sortFn,\n _ref$tokenize = _ref.tokenize,\n tokenize = _ref$tokenize === undefined ? false : _ref$tokenize,\n _ref$matchAllTokens = _ref.matchAllTokens,\n matchAllTokens = _ref$matchAllTokens === undefined ? false : _ref$matchAllTokens,\n _ref$includeMatches = _ref.includeMatches,\n includeMatches = _ref$includeMatches === undefined ? false : _ref$includeMatches,\n _ref$includeScore = _ref.includeScore,\n includeScore = _ref$includeScore === undefined ? false : _ref$includeScore,\n _ref$verbose = _ref.verbose,\n verbose = _ref$verbose === undefined ? false : _ref$verbose;\n\n _classCallCheck(this, Fuse);\n\n this.options = {\n location: location,\n distance: distance,\n threshold: threshold,\n maxPatternLength: maxPatternLength,\n isCaseSensitive: caseSensitive,\n tokenSeparator: tokenSeparator,\n findAllMatches: findAllMatches,\n minMatchCharLength: minMatchCharLength,\n id: id,\n keys: keys,\n includeMatches: includeMatches,\n includeScore: includeScore,\n shouldSort: shouldSort,\n getFn: getFn,\n sortFn: sortFn,\n verbose: verbose,\n tokenize: tokenize,\n matchAllTokens: matchAllTokens\n };\n\n this.setCollection(list);\n }\n\n _createClass(Fuse, [{\n key: 'setCollection',\n value: function setCollection(list) {\n this.list = list;\n return list;\n }\n }, {\n key: 'search',\n value: function search(pattern) {\n this._log('---------\\nSearch pattern: \"' + pattern + '\"');\n\n var _prepareSearchers2 = this._prepareSearchers(pattern),\n tokenSearchers = _prepareSearchers2.tokenSearchers,\n fullSearcher = _prepareSearchers2.fullSearcher;\n\n var _search2 = this._search(tokenSearchers, fullSearcher),\n weights = _search2.weights,\n results = _search2.results;\n\n this._computeScore(weights, results);\n\n if (this.options.shouldSort) {\n this._sort(results);\n }\n\n return this._format(results);\n }\n }, {\n key: '_prepareSearchers',\n value: function _prepareSearchers() {\n var pattern = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';\n\n var tokenSearchers = [];\n\n if (this.options.tokenize) {\n // Tokenize on the separator\n var tokens = pattern.split(this.options.tokenSeparator);\n for (var i = 0, len = tokens.length; i < len; i += 1) {\n tokenSearchers.push(new Bitap(tokens[i], this.options));\n }\n }\n\n var fullSearcher = new Bitap(pattern, this.options);\n\n return { tokenSearchers: tokenSearchers, fullSearcher: fullSearcher };\n }\n }, {\n key: '_search',\n value: function _search() {\n var tokenSearchers = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];\n var fullSearcher = arguments[1];\n\n var list = this.list;\n var resultMap = {};\n var results = [];\n\n // Check the first item in the list, if it's a string, then we assume\n // that every item in the list is also a string, and thus it's a flattened array.\n if (typeof list[0] === 'string') {\n // Iterate over every item\n for (var i = 0, len = list.length; i < len; i += 1) {\n this._analyze({\n key: '',\n value: list[i],\n record: i,\n index: i\n }, {\n resultMap: resultMap,\n results: results,\n tokenSearchers: tokenSearchers,\n fullSearcher: fullSearcher\n });\n }\n\n return { weights: null, results: results };\n }\n\n // Otherwise, the first item is an Object (hopefully), and thus the searching\n // is done on the values of the keys of each item.\n var weights = {};\n for (var _i = 0, _len = list.length; _i < _len; _i += 1) {\n var item = list[_i];\n // Iterate over every key\n for (var j = 0, keysLen = this.options.keys.length; j < keysLen; j += 1) {\n var key = this.options.keys[j];\n if (typeof key !== 'string') {\n weights[key.name] = {\n weight: 1 - key.weight || 1\n };\n if (key.weight <= 0 || key.weight > 1) {\n throw new Error('Key weight has to be > 0 and <= 1');\n }\n key = key.name;\n } else {\n weights[key] = {\n weight: 1\n };\n }\n\n this._analyze({\n key: key,\n value: this.options.getFn(item, key),\n record: item,\n index: _i\n }, {\n resultMap: resultMap,\n results: results,\n tokenSearchers: tokenSearchers,\n fullSearcher: fullSearcher\n });\n }\n }\n\n return { weights: weights, results: results };\n }\n }, {\n key: '_analyze',\n value: function _analyze(_ref2, _ref3) {\n var key = _ref2.key,\n _ref2$arrayIndex = _ref2.arrayIndex,\n arrayIndex = _ref2$arrayIndex === undefined ? -1 : _ref2$arrayIndex,\n value = _ref2.value,\n record = _ref2.record,\n index = _ref2.index;\n var _ref3$tokenSearchers = _ref3.tokenSearchers,\n tokenSearchers = _ref3$tokenSearchers === undefined ? [] : _ref3$tokenSearchers,\n _ref3$fullSearcher = _ref3.fullSearcher,\n fullSearcher = _ref3$fullSearcher === undefined ? [] : _ref3$fullSearcher,\n _ref3$resultMap = _ref3.resultMap,\n resultMap = _ref3$resultMap === undefined ? {} : _ref3$resultMap,\n _ref3$results = _ref3.results,\n results = _ref3$results === undefined ? [] : _ref3$results;\n\n // Check if the texvaluet can be searched\n if (value === undefined || value === null) {\n return;\n }\n\n var exists = false;\n var averageScore = -1;\n var numTextMatches = 0;\n\n if (typeof value === 'string') {\n this._log('\\nKey: ' + (key === '' ? '-' : key));\n\n var mainSearchResult = fullSearcher.search(value);\n this._log('Full text: \"' + value + '\", score: ' + mainSearchResult.score);\n\n if (this.options.tokenize) {\n var words = value.split(this.options.tokenSeparator);\n var scores = [];\n\n for (var i = 0; i < tokenSearchers.length; i += 1) {\n var tokenSearcher = tokenSearchers[i];\n\n this._log('\\nPattern: \"' + tokenSearcher.pattern + '\"');\n\n // let tokenScores = []\n var hasMatchInText = false;\n\n for (var j = 0; j < words.length; j += 1) {\n var word = words[j];\n var tokenSearchResult = tokenSearcher.search(word);\n var obj = {};\n if (tokenSearchResult.isMatch) {\n obj[word] = tokenSearchResult.score;\n exists = true;\n hasMatchInText = true;\n scores.push(tokenSearchResult.score);\n } else {\n obj[word] = 1;\n if (!this.options.matchAllTokens) {\n scores.push(1);\n }\n }\n this._log('Token: \"' + word + '\", score: ' + obj[word]);\n // tokenScores.push(obj)\n }\n\n if (hasMatchInText) {\n numTextMatches += 1;\n }\n }\n\n averageScore = scores[0];\n var scoresLen = scores.length;\n for (var _i2 = 1; _i2 < scoresLen; _i2 += 1) {\n averageScore += scores[_i2];\n }\n averageScore = averageScore / scoresLen;\n\n this._log('Token score average:', averageScore);\n }\n\n var finalScore = mainSearchResult.score;\n if (averageScore > -1) {\n finalScore = (finalScore + averageScore) / 2;\n }\n\n this._log('Score average:', finalScore);\n\n var checkTextMatches = this.options.tokenize && this.options.matchAllTokens ? numTextMatches >= tokenSearchers.length : true;\n\n this._log('\\nCheck Matches: ' + checkTextMatches);\n\n // If a match is found, add the item to , including its score\n if ((exists || mainSearchResult.isMatch) && checkTextMatches) {\n // Check if the item already exists in our results\n var existingResult = resultMap[index];\n if (existingResult) {\n // Use the lowest score\n // existingResult.score, bitapResult.score\n existingResult.output.push({\n key: key,\n arrayIndex: arrayIndex,\n value: value,\n score: finalScore,\n matchedIndices: mainSearchResult.matchedIndices\n });\n } else {\n // Add it to the raw result list\n resultMap[index] = {\n item: record,\n output: [{\n key: key,\n arrayIndex: arrayIndex,\n value: value,\n score: finalScore,\n matchedIndices: mainSearchResult.matchedIndices\n }]\n };\n\n results.push(resultMap[index]);\n }\n }\n } else if (isArray(value)) {\n for (var _i3 = 0, len = value.length; _i3 < len; _i3 += 1) {\n this._analyze({\n key: key,\n arrayIndex: _i3,\n value: value[_i3],\n record: record,\n index: index\n }, {\n resultMap: resultMap,\n results: results,\n tokenSearchers: tokenSearchers,\n fullSearcher: fullSearcher\n });\n }\n }\n }\n }, {\n key: '_computeScore',\n value: function _computeScore(weights, results) {\n this._log('\\n\\nComputing score:\\n');\n\n for (var i = 0, len = results.length; i < len; i += 1) {\n var output = results[i].output;\n var scoreLen = output.length;\n\n var totalScore = 0;\n var bestScore = 1;\n\n for (var j = 0; j < scoreLen; j += 1) {\n var weight = weights ? weights[output[j].key].weight : 1;\n var score = weight === 1 ? output[j].score : output[j].score || 0.001;\n var nScore = score * weight;\n\n if (weight !== 1) {\n bestScore = Math.min(bestScore, nScore);\n } else {\n output[j].nScore = nScore;\n totalScore += nScore;\n }\n }\n\n results[i].score = bestScore === 1 ? totalScore / scoreLen : bestScore;\n\n this._log(results[i]);\n }\n }\n }, {\n key: '_sort',\n value: function _sort(results) {\n this._log('\\n\\nSorting....');\n results.sort(this.options.sortFn);\n }\n }, {\n key: '_format',\n value: function _format(results) {\n var finalOutput = [];\n\n this._log('\\n\\nOutput:\\n\\n', JSON.stringify(results));\n\n var transformers = [];\n\n if (this.options.includeMatches) {\n transformers.push(function (result, data) {\n var output = result.output;\n data.matches = [];\n\n for (var i = 0, len = output.length; i < len; i += 1) {\n var item = output[i];\n\n if (item.matchedIndices.length === 0) {\n continue;\n }\n\n var obj = {\n indices: item.matchedIndices,\n value: item.value\n };\n if (item.key) {\n obj.key = item.key;\n }\n if (item.hasOwnProperty('arrayIndex') && item.arrayIndex > -1) {\n obj.arrayIndex = item.arrayIndex;\n }\n data.matches.push(obj);\n }\n });\n }\n\n if (this.options.includeScore) {\n transformers.push(function (result, data) {\n data.score = result.score;\n });\n }\n\n for (var i = 0, len = results.length; i < len; i += 1) {\n var result = results[i];\n\n if (this.options.id) {\n result.item = this.options.getFn(result.item, this.options.id)[0];\n }\n\n if (!transformers.length) {\n finalOutput.push(result.item);\n continue;\n }\n\n var data = {\n item: result.item\n };\n\n for (var j = 0, _len2 = transformers.length; j < _len2; j += 1) {\n transformers[j](result, data);\n }\n\n finalOutput.push(data);\n }\n\n return finalOutput;\n }\n }, {\n key: '_log',\n value: function _log() {\n if (this.options.verbose) {\n var _console;\n\n (_console = console).log.apply(_console, arguments);\n }\n }\n }]);\n\n return Fuse;\n}();\n\nmodule.exports = Fuse;\n\n/***/ })\n/******/ ]);\n});\n//# sourceMappingURL=fuse.js.map\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/fuse.js/dist/fuse.js\n// module id = 7\n// module chunks = 0","import { createStore } from 'redux';\nimport rootReducer from './../reducers/index';\n\nexport default class Store {\n constructor() {\n this.store = createStore(\n rootReducer,\n window.devToolsExtension ?\n window.devToolsExtension() :\n undefined,\n );\n }\n\n /**\n * Subscribe store to function call (wrapped Redux method)\n * @param {Function} onChange Function to trigger when state changes\n * @return\n */\n subscribe(onChange) {\n this.store.subscribe(onChange);\n }\n\n /**\n * Dispatch event to store (wrapped Redux method)\n * @param {Function} action Action function to trigger\n * @return\n */\n dispatch(action) {\n this.store.dispatch(action);\n }\n\n /**\n * Get store object (wrapping Redux method)\n * @return {Object} State\n */\n getState() {\n return this.store.getState();\n }\n\n /**\n * Get items from store\n * @return {Array} Item objects\n */\n getItems() {\n const state = this.store.getState();\n return state.items;\n }\n\n /**\n * Get active items from store\n * @return {Array} Item objects\n */\n getItemsFilteredByActive() {\n const items = this.getItems();\n const values = items.filter(item => item.active === true, []);\n\n return values;\n }\n\n /**\n * Get items from store reduced to just their values\n * @return {Array} Item objects\n */\n getItemsReducedToValues(items = this.getItems()) {\n const values = items.reduce((prev, current) => {\n prev.push(current.value);\n return prev;\n }, []);\n\n return values;\n }\n\n /**\n * Get choices from store\n * @return {Array} Option objects\n */\n getChoices() {\n const state = this.store.getState();\n return state.choices;\n }\n\n /**\n * Get active choices from store\n * @return {Array} Option objects\n */\n getChoicesFilteredByActive() {\n const choices = this.getChoices();\n const values = choices.filter(choice => choice.active === true);\n\n return values;\n }\n\n /**\n * Get selectable choices from store\n * @return {Array} Option objects\n */\n getChoicesFilteredBySelectable() {\n const choices = this.getChoices();\n const values = choices.filter(choice => choice.disabled !== true);\n\n return values;\n }\n\n /**\n * Get choices that can be searched (excluding placeholders)\n * @return {Array} Option objects\n */\n getSearchableChoices() {\n const filtered = this.getChoicesFilteredBySelectable();\n return filtered.filter(choice => choice.placeholder !== true);\n }\n\n /**\n * Get single choice by it's ID\n * @return {Object} Found choice\n */\n getChoiceById(id) {\n if (id) {\n const choices = this.getChoicesFilteredByActive();\n const foundChoice = choices.find(choice => choice.id === parseInt(id, 10));\n return foundChoice;\n }\n return false;\n }\n\n /**\n * Get placeholder choice from store\n * @return {Object} Found placeholder\n */\n getPlaceholderChoice() {\n const choices = this.getChoices();\n const placeholderChoice = [...choices]\n .reverse()\n .find(choice => choice.placeholder === true);\n\n return placeholderChoice;\n }\n\n /**\n * Get groups from store\n * @return {Array} Group objects\n */\n getGroups() {\n const state = this.store.getState();\n return state.groups;\n }\n\n /**\n * Get active groups from store\n * @return {Array} Group objects\n */\n getGroupsFilteredByActive() {\n const groups = this.getGroups();\n const choices = this.getChoices();\n\n const values = groups.filter((group) => {\n const isActive = group.active === true && group.disabled === false;\n const hasActiveOptions = choices.some(choice =>\n choice.active === true && choice.disabled === false,\n );\n return isActive && hasActiveOptions;\n }, []);\n\n return values;\n }\n\n /**\n * Get group by group id\n * @param {Number} id Group ID\n * @return {Object} Group data\n */\n getGroupById(id) {\n const groups = this.getGroups();\n const foundGroup = groups.find(group => group.id === parseInt(id, 10));\n\n return foundGroup;\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// src/scripts/src/store/store.js","/** Detect free variable `global` from Node.js. */\nvar freeGlobal = typeof global == 'object' && global && global.Object === Object && global;\n\nexport default freeGlobal;\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/redux/node_modules/lodash-es/_freeGlobal.js\n// module id = 9\n// module chunks = 0","module.exports = require('./lib/index');\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/redux/node_modules/symbol-observable/index.js\n// module id = 10\n// module chunks = 0","'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _ponyfill = require('./ponyfill');\n\nvar _ponyfill2 = _interopRequireDefault(_ponyfill);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }\n\nvar root; /* global window */\n\n\nif (typeof self !== 'undefined') {\n root = self;\n} else if (typeof window !== 'undefined') {\n root = window;\n} else if (typeof global !== 'undefined') {\n root = global;\n} else if (typeof module !== 'undefined') {\n root = module;\n} else {\n root = Function('return this')();\n}\n\nvar result = (0, _ponyfill2['default'])(root);\nexports['default'] = result;\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/redux/node_modules/symbol-observable/lib/index.js\n// module id = 11\n// module chunks = 0","module.exports = function(module) {\n\tif(!module.webpackPolyfill) {\n\t\tmodule.deprecate = function() {};\n\t\tmodule.paths = [];\n\t\t// module.parent = undefined by default\n\t\tif(!module.children) module.children = [];\n\t\tObject.defineProperty(module, \"loaded\", {\n\t\t\tenumerable: true,\n\t\t\tget: function() {\n\t\t\t\treturn module.l;\n\t\t\t}\n\t\t});\n\t\tObject.defineProperty(module, \"id\", {\n\t\t\tenumerable: true,\n\t\t\tget: function() {\n\t\t\t\treturn module.i;\n\t\t\t}\n\t\t});\n\t\tmodule.webpackPolyfill = 1;\n\t}\n\treturn module;\n};\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// (webpack)/buildin/module.js\n// module id = 12\n// module chunks = 0","'use strict';\n\nObject.defineProperty(exports, \"__esModule\", {\n\tvalue: true\n});\nexports['default'] = symbolObservablePonyfill;\nfunction symbolObservablePonyfill(root) {\n\tvar result;\n\tvar _Symbol = root.Symbol;\n\n\tif (typeof _Symbol === 'function') {\n\t\tif (_Symbol.observable) {\n\t\t\tresult = _Symbol.observable;\n\t\t} else {\n\t\t\tresult = _Symbol('observable');\n\t\t\t_Symbol.observable = result;\n\t\t}\n\t} else {\n\t\tresult = '@@observable';\n\t}\n\n\treturn result;\n};\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/redux/node_modules/symbol-observable/lib/ponyfill.js\n// module id = 13\n// module chunks = 0","import { combineReducers } from 'redux';\nimport items from './items';\nimport groups from './groups';\nimport choices from './choices';\n\nconst appReducer = combineReducers({\n items,\n groups,\n choices,\n});\n\nconst rootReducer = (passedState, action) => {\n let state = passedState;\n // If we are clearing all items, groups and options we reassign\n // state and then pass that state to our proper reducer. This isn't\n // mutating our actual state\n // See: http://stackoverflow.com/a/35641992\n if (action.type === 'CLEAR_ALL') {\n state = undefined;\n }\n\n return appReducer(state, action);\n};\n\nexport default rootReducer;\n\n\n\n// WEBPACK FOOTER //\n// src/scripts/src/reducers/index.js","export const defaultState = [];\n\nexport default function items(state = defaultState, action) {\n switch (action.type) {\n case 'ADD_ITEM': {\n // Add object to items array\n const newState = [...state, {\n id: action.id,\n choiceId: action.choiceId,\n groupId: action.groupId,\n value: action.value,\n label: action.label,\n active: true,\n highlighted: false,\n customProperties: action.customProperties,\n placeholder: (action.placeholder || false),\n keyCode: null,\n }];\n\n return newState.map((obj) => {\n const item = obj;\n if (item.highlighted) {\n item.highlighted = false;\n }\n return item;\n });\n }\n\n case 'REMOVE_ITEM': {\n // Set item to inactive\n return state.map((obj) => {\n const item = obj;\n if (item.id === action.id) {\n item.active = false;\n }\n return item;\n });\n }\n\n case 'HIGHLIGHT_ITEM': {\n return state.map((obj) => {\n const item = obj;\n if (item.id === action.id) {\n item.highlighted = action.highlighted;\n }\n return item;\n });\n }\n\n default: {\n return state;\n }\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// src/scripts/src/reducers/items.js","export const defaultState = [];\n\nexport default function groups(state = defaultState, action) {\n switch (action.type) {\n case 'ADD_GROUP': {\n return [...state, {\n id: action.id,\n value: action.value,\n active: action.active,\n disabled: action.disabled,\n }];\n }\n\n case 'CLEAR_CHOICES': {\n return [];\n }\n\n default: {\n return state;\n }\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// src/scripts/src/reducers/groups.js","export const defaultState = [];\n\nexport default function choices(state = defaultState, action) {\n switch (action.type) {\n case 'ADD_CHOICE': {\n /*\n A disabled choice appears in the choice dropdown but cannot be selected\n A selected choice has been added to the passed input's value (added as an item)\n An active choice appears within the choice dropdown\n */\n return [...state, {\n id: action.id,\n elementId: action.elementId,\n groupId: action.groupId,\n value: action.value,\n label: (action.label || action.value),\n disabled: (action.disabled || false),\n selected: false,\n active: true,\n score: 9999,\n customProperties: action.customProperties,\n placeholder: (action.placeholder || false),\n keyCode: null,\n }];\n }\n\n case 'ADD_ITEM': {\n // If all choices need to be activated\n if (action.activateOptions) {\n return state.map((obj) => {\n const choice = obj;\n choice.active = action.active;\n return choice;\n });\n }\n\n // When an item is added and it has an associated choice,\n // we want to disable it so it can't be chosen again\n if (action.choiceId > -1) {\n return state.map((obj) => {\n const choice = obj;\n if (choice.id === parseInt(action.choiceId, 10)) {\n choice.selected = true;\n }\n return choice;\n });\n }\n\n return state;\n }\n\n case 'REMOVE_ITEM': {\n // When an item is removed and it has an associated choice,\n // we want to re-enable it so it can be chosen again\n if (action.choiceId > -1) {\n return state.map((obj) => {\n const choice = obj;\n if (choice.id === parseInt(action.choiceId, 10)) {\n choice.selected = false;\n }\n return choice;\n });\n }\n\n return state;\n }\n\n case 'FILTER_CHOICES': {\n return state.map((obj) => {\n const choice = obj;\n // Set active state based on whether choice is\n // within filtered results\n choice.active = action.results.some(({ item, score }) => {\n if (item.id === choice.id) {\n choice.score = score;\n return true;\n }\n return false;\n });\n\n return choice;\n });\n }\n\n case 'ACTIVATE_CHOICES': {\n return state.map((obj) => {\n const choice = obj;\n choice.active = action.active;\n return choice;\n });\n }\n\n case 'CLEAR_CHOICES': {\n return defaultState;\n }\n\n default: {\n return state;\n }\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// src/scripts/src/reducers/choices.js","export default class Dropdown {\n constructor(instance, element, classNames) {\n this.parentInstance = instance;\n this.element = element;\n this.classNames = classNames;\n this.dimensions = null;\n this.position = null;\n this.isActive = false;\n }\n\n getElement() {\n return this.element;\n }\n\n /**\n * Determine how far the top of our element is from\n * the top of the window\n * @return {Number} Vertical position\n */\n getVerticalPos() {\n this.dimensions = this.element.getBoundingClientRect();\n this.position = Math.ceil(this.dimensions.top + window.pageYOffset + this.element.offsetHeight);\n return this.position;\n }\n\n /**\n * Find element that matches passed selector\n * @return {HTMLElement}\n */\n getChild(selector) {\n return this.element.querySelector(selector);\n }\n\n /**\n * Show dropdown to user by adding active state class\n * @return {Object} Class instance\n * @public\n */\n show() {\n this.element.classList.add(this.classNames.activeState);\n this.element.setAttribute('aria-expanded', 'true');\n this.isActive = true;\n return this.parentInstance;\n }\n\n /**\n * Hide dropdown from user\n * @return {Object} Class instance\n * @public\n */\n hide() {\n this.element.classList.remove(this.classNames.activeState);\n this.element.setAttribute('aria-expanded', 'false');\n this.isActive = false;\n return this.parentInstance;\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// src/scripts/src/components/dropdown.js","export default class Container {\n constructor(instance, element, classNames) {\n this.parentInstance = instance;\n this.element = element;\n this.classNames = classNames;\n this.config = instance.config;\n this.isOpen = false;\n this.isFlipped = false;\n this.isFocussed = false;\n this.isDisabled = false;\n this.isLoading = false;\n this.onFocus = this.onFocus.bind(this);\n this.onBlur = this.onBlur.bind(this);\n }\n\n getElement() {\n return this.element;\n }\n\n /**\n * Add event listeners\n */\n addEventListeners() {\n this.element.addEventListener('focus', this.onFocus);\n this.element.addEventListener('blur', this.onBlur);\n }\n\n /**\n * Remove event listeners\n */\n\n /** */\n removeEventListeners() {\n this.element.removeEventListener('focus', this.onFocus);\n this.element.removeEventListener('blur', this.onBlur);\n }\n\n /**\n * Set focussed state\n */\n onFocus() {\n this.isFocussed = true;\n }\n\n /**\n * Remove blurred state\n */\n onBlur() {\n this.isFocussed = false;\n }\n\n /**\n * Determine whether container should be flipped\n * based on passed dropdown position\n * @param {Number} dropdownPos\n * @returns\n */\n shouldFlip(dropdownPos) {\n if (dropdownPos === undefined) {\n return false;\n }\n\n const body = document.body;\n const html = document.documentElement;\n const winHeight = Math.max(\n body.scrollHeight,\n body.offsetHeight,\n html.clientHeight,\n html.scrollHeight,\n html.offsetHeight,\n );\n\n // If flip is enabled and the dropdown bottom position is\n // greater than the window height flip the dropdown.\n let shouldFlip = false;\n if (this.config.position === 'auto') {\n shouldFlip = dropdownPos >= winHeight;\n } else if (this.config.position === 'top') {\n shouldFlip = true;\n }\n\n return shouldFlip;\n }\n\n /**\n * Set active descendant attribute\n * @param {Number} activeDescendant ID of active descendant\n */\n setActiveDescendant(activeDescendantID) {\n this.element.setAttribute('aria-activedescendant', activeDescendantID);\n }\n\n /**\n * Remove active descendant attribute\n */\n removeActiveDescendant() {\n this.element.removeAttribute('aria-activedescendant');\n }\n\n open(dropdownPos) {\n this.element.classList.add(this.classNames.openState);\n this.element.setAttribute('aria-expanded', 'true');\n this.isOpen = true;\n\n if (this.shouldFlip(dropdownPos)) {\n this.element.classList.add(this.classNames.flippedState);\n this.isFlipped = true;\n }\n }\n\n close() {\n this.element.classList.remove(this.classNames.openState);\n this.element.setAttribute('aria-expanded', 'false');\n this.removeActiveDescendant();\n this.isOpen = false;\n\n // A dropdown flips if it does not have space within the page\n if (this.isFlipped) {\n this.element.classList.remove(this.classNames.flippedState);\n this.isFlipped = false;\n }\n }\n\n focus() {\n if (!this.isFocussed) {\n this.element.focus();\n }\n }\n\n addFocusState() {\n this.element.classList.add(this.classNames.focusState);\n }\n\n removeFocusState() {\n this.element.classList.remove(this.classNames.focusState);\n }\n\n /**\n * Remove disabled state\n */\n enable() {\n this.element.classList.remove(this.config.classNames.disabledState);\n this.element.removeAttribute('aria-disabled');\n if (this.parentInstance.isSelectOneElement) {\n this.element.setAttribute('tabindex', '0');\n }\n this.isDisabled = false;\n }\n\n /**\n * Set disabled state\n */\n disable() {\n this.element.classList.add(this.config.classNames.disabledState);\n this.element.setAttribute('aria-disabled', 'true');\n if (this.parentInstance.isSelectOneElement) {\n this.element.setAttribute('tabindex', '-1');\n }\n this.isDisabled = true;\n }\n\n revert(originalElement) {\n // Move passed element back to original position\n this.element.parentNode.insertBefore(\n originalElement,\n this.element,\n );\n // Remove container\n this.element.parentNode.removeChild(this.element);\n }\n\n /**\n * Add loading state to element\n */\n addLoadingState() {\n this.element.classList.add(this.classNames.loadingState);\n this.element.setAttribute('aria-busy', 'true');\n this.isLoading = true;\n }\n\n /**\n * Remove loading state from element\n */\n removeLoadingState() {\n this.element.classList.remove(this.classNames.loadingState);\n this.element.removeAttribute('aria-busy');\n this.isLoading = false;\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// src/scripts/src/components/container.js","import { getWidthOfInput } from '../lib/utils';\n\nexport default class Input {\n constructor(instance, element, classNames) {\n this.parentInstance = instance;\n this.element = element;\n this.classNames = classNames;\n this.isFocussed = this.element === document.activeElement;\n this.isDisabled = false;\n\n // Bind event listeners\n this.onPaste = this.onPaste.bind(this);\n this.onInput = this.onInput.bind(this);\n this.onFocus = this.onFocus.bind(this);\n this.onBlur = this.onBlur.bind(this);\n }\n\n getElement() {\n return this.element;\n }\n\n addEventListeners() {\n this.element.addEventListener('input', this.onInput);\n this.element.addEventListener('paste', this.onPaste);\n this.element.addEventListener('focus', this.onFocus);\n this.element.addEventListener('blur', this.onBlur);\n }\n\n removeEventListeners() {\n this.element.removeEventListener('input', this.onInput);\n this.element.removeEventListener('paste', this.onPaste);\n this.element.removeEventListener('focus', this.onFocus);\n this.element.removeEventListener('blur', this.onBlur);\n }\n\n /**\n * Input event\n * @return\n * @private\n */\n onInput() {\n if (!this.parentInstance.isSelectOneElement) {\n this.setWidth();\n }\n }\n\n /**\n * Paste event\n * @param {Object} e Event\n * @return\n * @private\n */\n onPaste(e) {\n // Disable pasting into the input if option has been set\n if (e.target === this.element && !this.parentInstance.config.paste) {\n e.preventDefault();\n }\n }\n\n /**\n * Set focussed state\n */\n onFocus() {\n this.isFocussed = true;\n }\n\n /**\n * Remove focussed state\n */\n onBlur() {\n this.isFocussed = false;\n }\n\n activate(focusInput) {\n // Optionally focus the input if we have a search input\n if (focusInput && this.parentInstance.canSearch && document.activeElement !== this.element) {\n this.element.focus();\n }\n }\n\n deactivate(blurInput) {\n this.removeActiveDescendant();\n // Optionally blur the input if we have a search input\n if (blurInput && this.parentInstance.canSearch && document.activeElement === this.element) {\n this.element.blur();\n }\n }\n\n enable() {\n this.element.removeAttribute('disabled');\n this.isDisabled = false;\n }\n\n disable() {\n this.element.setAttribute('disabled', '');\n this.isDisabled = true;\n }\n\n focus() {\n if (!this.isFocussed) {\n this.element.focus();\n }\n }\n\n /**\n * Set value of input to blank\n * @return {Object} Class instance\n * @public\n */\n clear(setWidth = true) {\n if (this.element.value) {\n this.element.value = '';\n }\n\n if (setWidth) {\n this.setWidth();\n }\n\n return this.parentInstance;\n }\n\n /**\n * Set the correct input width based on placeholder\n * value or input value\n * @return\n */\n setWidth(enforceWidth) {\n if (this.parentInstance.placeholder) {\n // If there is a placeholder, we only want to set the width of the input when it is a greater\n // length than 75% of the placeholder. This stops the input jumping around.\n if (\n (this.element.value &&\n this.element.value.length >= (this.parentInstance.placeholder.length / 1.25)) ||\n enforceWidth\n ) {\n this.element.style.width = this.getWidth();\n }\n } else {\n // If there is no placeholder, resize input to contents\n this.element.style.width = this.getWidth();\n }\n }\n\n getWidth() {\n return getWidthOfInput(this.element);\n }\n\n setPlaceholder(placeholder) {\n this.element.placeholder = placeholder;\n }\n\n setValue(value) {\n this.element.value = value;\n }\n\n getValue() {\n return this.element.value;\n }\n\n setActiveDescendant(activeDescendantID) {\n this.element.setAttribute('aria-activedescendant', activeDescendantID);\n }\n\n removeActiveDescendant() {\n this.element.removeAttribute('aria-activedescendant');\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// src/scripts/src/components/input.js","export default class List {\n constructor(instance, element, classNames) {\n this.parentInstance = instance;\n this.element = element;\n this.classNames = classNames;\n this.scrollPos = this.element.scrollTop;\n this.height = this.element.offsetHeight;\n this.hasChildren = !!this.element.children;\n }\n\n getElement() {\n return this.element;\n }\n\n /**\n * Clear List contents\n */\n clear() {\n this.element.innerHTML = '';\n }\n\n /**\n * Scroll to passed position on Y axis\n */\n scrollTo(scrollPos = 0) {\n this.element.scrollTop = scrollPos;\n }\n /**\n * Append node to element\n */\n append(node) {\n this.element.appendChild(node);\n }\n\n /**\n * Find element that matches passed selector\n * @return {HTMLElement}\n */\n getChild(selector) {\n return this.element.querySelector(selector);\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// src/scripts/src/components/list.js","import WrappedElement from './wrapped-element';\n\nexport default class WrappedInput extends WrappedElement {\n constructor(instance, element, classNames) {\n super(instance, element, classNames);\n this.parentInstance = instance;\n this.element = element;\n this.classNames = classNames;\n }\n\n getElement() {\n super.getElement();\n }\n\n conceal() {\n super.conceal();\n }\n\n reveal() {\n super.reveal();\n }\n\n enable() {\n super.enable();\n }\n\n disable() {\n super.enable();\n }\n\n setValue(value) {\n this.element.setAttribute('value', value);\n this.element.value = value;\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// src/scripts/src/components/wrapped-input.js","import WrappedElement from './wrapped-element';\n\nexport default class WrappedSelect extends WrappedElement {\n constructor(instance, element, classNames) {\n super(instance, element, classNames);\n this.parentInstance = instance;\n this.element = element;\n this.classNames = classNames;\n }\n\n getElement() {\n super.getElement();\n }\n\n conceal() {\n super.conceal();\n }\n\n reveal() {\n super.reveal();\n }\n\n enable() {\n super.enable();\n }\n\n disable() {\n super.enable();\n }\n\n setOptions(options) {\n this.element.innerHTML = '';\n this.element.appendChild(options);\n }\n\n getPlaceholderOption() {\n return this.element.querySelector('option[placeholder]');\n }\n\n getOptions() {\n return Array.from(this.element.options);\n }\n\n getOptionGroups() {\n return Array.from(this.element.getElementsByTagName('OPTGROUP'));\n }\n}\n\n\n\n// WEBPACK FOOTER //\n// src/scripts/src/components/wrapped-select.js","import classNames from 'classnames';\nimport { strToEl } from './lib/utils';\n\nexport const TEMPLATES = {\n containerOuter(\n globalClasses,\n direction,\n isSelectElement,\n isSelectOneElement,\n searchEnabled,\n passedElementType,\n ) {\n const tabIndex = isSelectOneElement ? 'tabindex=\"0\"' : '';\n let role = isSelectElement ? 'role=\"listbox\"' : '';\n let ariaAutoComplete = '';\n\n if (isSelectElement && searchEnabled) {\n role = 'role=\"combobox\"';\n ariaAutoComplete = 'aria-autocomplete=\"list\"';\n }\n\n return strToEl(`\n \n
\n `);\n },\n containerInner(globalClasses) {\n return strToEl(`\n
\n `);\n },\n itemList(globalClasses, isSelectOneElement) {\n const localClasses = classNames(\n globalClasses.list, {\n [globalClasses.listSingle]: (isSelectOneElement),\n [globalClasses.listItems]: (!isSelectOneElement),\n },\n );\n\n return strToEl(`\n
\n `);\n },\n placeholder(globalClasses, value) {\n return strToEl(`\n \n ${value}\n
\n `);\n },\n item(globalClasses, data, removeItemButton) {\n const ariaSelected = data.active ? 'aria-selected=\"true\"' : '';\n const ariaDisabled = data.disabled ? 'aria-disabled=\"true\"' : '';\n\n let localClasses = classNames(\n globalClasses.item, {\n [globalClasses.highlightedState]: data.highlighted,\n [globalClasses.itemSelectable]: !data.highlighted,\n [globalClasses.placeholder]: data.placeholder,\n },\n );\n\n if (removeItemButton) {\n localClasses = classNames(\n globalClasses.item, {\n [globalClasses.highlightedState]: data.highlighted,\n [globalClasses.itemSelectable]: !data.disabled,\n [globalClasses.placeholder]: data.placeholder,\n },\n );\n\n return strToEl(`\n \n ${data.label}\n Remove item\n \n
\n `);\n }\n\n return strToEl(`\n \n ${data.label}\n
\n `);\n },\n choiceList(globalClasses, isSelectOneElement) {\n const ariaMultiSelectable = !isSelectOneElement ?\n 'aria-multiselectable=\"true\"' :\n '';\n\n return strToEl(`\n \n
\n `);\n },\n choiceGroup(globalClasses, data) {\n const ariaDisabled = data.disabled ? 'aria-disabled=\"true\"' : '';\n const localClasses = classNames(\n globalClasses.group, {\n [globalClasses.itemDisabled]: data.disabled,\n },\n );\n\n return strToEl(`\n \n `);\n },\n choice(globalClasses, data, itemSelectText) {\n const role = data.groupId > 0 ? 'role=\"treeitem\"' : 'role=\"option\"';\n const localClasses = classNames(\n globalClasses.item,\n globalClasses.itemChoice, {\n [globalClasses.itemDisabled]: data.disabled,\n [globalClasses.itemSelectable]: !data.disabled,\n [globalClasses.placeholder]: data.placeholder,\n },\n );\n\n return strToEl(`\n \n ${data.label}\n
\n `);\n },\n input(globalClasses) {\n const localClasses = classNames(\n globalClasses.input,\n globalClasses.inputCloned,\n );\n\n return strToEl(`\n \n `);\n },\n dropdown(globalClasses) {\n const localClasses = classNames(\n globalClasses.list,\n globalClasses.listDropdown,\n );\n\n return strToEl(`\n \n
\n `);\n },\n notice(globalClasses, label, type = '') {\n const localClasses = classNames(\n globalClasses.item,\n globalClasses.itemChoice, {\n [globalClasses.noResults]: (type === 'no-results'),\n [globalClasses.noChoices]: (type === 'no-choices'),\n },\n );\n\n return strToEl(`\n \n ${label}\n
\n `);\n },\n option(globalClasses, data) {\n return strToEl(`\n ${data.label} \n `);\n },\n};\n\nexport default TEMPLATES;\n\n\n\n// WEBPACK FOOTER //\n// src/scripts/src/templates.js","/*!\n Copyright (c) 2016 Jed Watson.\n Licensed under the MIT License (MIT), see\n http://jedwatson.github.io/classnames\n*/\n/* global define */\n\n(function () {\n\t'use strict';\n\n\tvar hasOwn = {}.hasOwnProperty;\n\n\tfunction classNames () {\n\t\tvar classes = [];\n\n\t\tfor (var i = 0; i < arguments.length; i++) {\n\t\t\tvar arg = arguments[i];\n\t\t\tif (!arg) continue;\n\n\t\t\tvar argType = typeof arg;\n\n\t\t\tif (argType === 'string' || argType === 'number') {\n\t\t\t\tclasses.push(arg);\n\t\t\t} else if (Array.isArray(arg)) {\n\t\t\t\tclasses.push(classNames.apply(null, arg));\n\t\t\t} else if (argType === 'object') {\n\t\t\t\tfor (var key in arg) {\n\t\t\t\t\tif (hasOwn.call(arg, key) && arg[key]) {\n\t\t\t\t\t\tclasses.push(key);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn classes.join(' ');\n\t}\n\n\tif (typeof module !== 'undefined' && module.exports) {\n\t\tmodule.exports = classNames;\n\t} else if (typeof define === 'function' && typeof define.amd === 'object' && define.amd) {\n\t\t// register as 'classnames', consistent with npm package name\n\t\tdefine('classnames', [], function () {\n\t\t\treturn classNames;\n\t\t});\n\t} else {\n\t\twindow.classNames = classNames;\n\t}\n}());\n\n\n\n//////////////////\n// WEBPACK FOOTER\n// ./node_modules/classnames/index.js\n// module id = 25\n// module chunks = 0","import { ACTION_TYPES } from './../constants';\n\nexport const addChoice = (\n value,\n label,\n id,\n groupId,\n disabled,\n elementId,\n customProperties,\n placeholder,\n keyCode,\n) => ({\n type: ACTION_TYPES.ADD_CHOICE,\n value,\n label,\n id,\n groupId,\n disabled,\n elementId,\n customProperties,\n placeholder,\n keyCode,\n});\n\nexport const filterChoices = results => ({\n type: ACTION_TYPES.FILTER_CHOICES,\n results,\n});\n\nexport const activateChoices = (active = true) => ({\n type: ACTION_TYPES.ACTIVATE_CHOICES,\n active,\n});\n\nexport const clearChoices = () => ({\n type: ACTION_TYPES.CLEAR_CHOICES,\n});\n\n\n\n// WEBPACK FOOTER //\n// src/scripts/src/actions/choices.js","import { ACTION_TYPES } from './../constants';\n\nexport const addItem = (\n value,\n label,\n id,\n choiceId,\n groupId,\n customProperties,\n placeholder,\n keyCode,\n) => ({\n type: ACTION_TYPES.ADD_ITEM,\n value,\n label,\n id,\n choiceId,\n groupId,\n customProperties,\n placeholder,\n keyCode,\n});\n\nexport const removeItem = (id, choiceId) => ({\n type: ACTION_TYPES.REMOVE_ITEM,\n id,\n choiceId,\n});\n\nexport const highlightItem = (id, highlighted) => ({\n type: ACTION_TYPES.HIGHLIGHT_ITEM,\n id,\n highlighted,\n});\n\n\n\n// WEBPACK FOOTER //\n// src/scripts/src/actions/items.js","import { ACTION_TYPES } from './../constants';\n\n/* eslint-disable import/prefer-default-export */\nexport const addGroup = (value, id, active, disabled) => ({\n type: ACTION_TYPES.ADD_GROUP,\n value,\n id,\n active,\n disabled,\n});\n\n\n\n// WEBPACK FOOTER //\n// src/scripts/src/actions/groups.js","/* eslint-disable import/prefer-default-export */\nexport const clearAll = () => ({\n type: 'CLEAR_ALL',\n});\n\n\n\n// WEBPACK FOOTER //\n// src/scripts/src/actions/misc.js","/* eslint-disable */\n(function () {\n // Production steps of ECMA-262, Edition 6, 22.1.2.1\n // Reference: https://people.mozilla.org/~jorendorff/es6-draft.html#sec-array.from\n if (!Array.from) {\n Array.from = (function() {\n let toStr = Object.prototype.toString;\n\n let isCallable = function(fn) {\n return typeof fn === 'function' || toStr.call(fn) === '[object Function]';\n };\n\n let toInteger = function(value) {\n let number = Number(value);\n if (isNaN(number)) {\n return 0;\n }\n if (number === 0 || !isFinite(number)) {\n return number;\n }\n return (number > 0 ? 1 : -1) * Math.floor(Math.abs(number));\n };\n\n let maxSafeInteger = Math.pow(2, 53) - 1;\n\n let toLength = function(value) {\n let len = toInteger(value);\n return Math.min(Math.max(len, 0), maxSafeInteger);\n };\n\n // The length property of the from method is 1.\n return function from(arrayLike /* , mapFn, thisArg */) {\n // 1. Let C be the this value.\n let C = this;\n\n // 2. Let items be ToObject(arrayLike).\n let items = Object(arrayLike);\n\n // 3. ReturnIfAbrupt(items).\n if (arrayLike == null) {\n throw new TypeError('Array.from requires an array-like object - not null or undefined');\n }\n\n // 4. If mapfn is undefined, then let mapping be false.\n let mapFn = arguments.length > 1 ? arguments[1] : void undefined;\n let T;\n if (typeof mapFn !== 'undefined') {\n // 5. else\n // 5. a If IsCallable(mapfn) is false, throw a TypeError exception.\n if (!isCallable(mapFn)) {\n throw new TypeError('Array.from: when provided, the second argument must be a function');\n }\n\n // 5. b. If thisArg was supplied, let T be thisArg; else let T be undefined.\n if (arguments.length > 2) {\n T = arguments[2];\n }\n }\n\n // 10. Let lenValue be Get(items, \"length\").\n // 11. Let len be ToLength(lenValue).\n let len = toLength(items.length);\n\n // 13. If IsConstructor(C) is true, then\n // 13. a. Let A be the result of calling the [[Construct]] internal method of C with an argument list containing the single item len.\n // 14. a. Else, Let A be ArrayCreate(len).\n let A = isCallable(C) ? Object(new C(len)) : new Array(len);\n\n // 16. Let k be 0.\n let k = 0;\n // 17. Repeat, while k < len… (also steps a - h)\n let kValue;\n while (k < len) {\n kValue = items[k];\n if (mapFn) {\n A[k] = typeof T === 'undefined' ? mapFn(kValue, k) : mapFn.call(T, kValue, k);\n } else {\n A[k] = kValue;\n }\n k += 1;\n }\n // 18. Let putStatus be Put(A, \"length\", len, true).\n A.length = len;\n // 20. Return A.\n return A;\n };\n }());\n }\n\n // Reference: https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Array/find\n if (!Array.prototype.find) {\n Array.prototype.find = function(predicate) {\n 'use strict';\n\n if (this == null) {\n throw new TypeError('Array.prototype.find called on null or undefined');\n }\n if (typeof predicate !== 'function') {\n throw new TypeError('predicate must be a function');\n }\n let list = Object(this);\n let length = list.length >>> 0;\n let thisArg = arguments[1];\n let value;\n\n for (let i = 0; i < length; i++) {\n value = list[i];\n if (predicate.call(thisArg, value, i, list)) {\n return value;\n }\n }\n return undefined;\n };\n }\n\n function CustomEvent (event, params) {\n params = params || {\n bubbles: false,\n cancelable: false,\n detail: undefined,\n };\n let evt = document.createEvent('CustomEvent');\n evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail);\n return evt;\n }\n\n CustomEvent.prototype = window.Event.prototype;\n\n window.CustomEvent = CustomEvent;\n}());\n\n\n\n// WEBPACK FOOTER //\n// src/scripts/src/lib/polyfills.js"],"mappings":";AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;ACdA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;A;;;;;;;;;;;;;AC7DA;AACA;AACA;;;;;AAKA;AACA;AAAA;AAAA;AACA;AACA;AACA;;;;;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;;;;;;AAMA;AACA;AACA;AACA;AACA;;;;;;AAMA;AACA;AACA;AACA;AACA;AACA;;;;;AAKA;AAAA;AAAA;AACA;AAIA;;;;;AAKA;AAAA;AAEA;AAFA;AACA;AAIA;;;;;AAKA;AACA;AACA;AACA;AACA;;;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;AAIA;AACA;AAAA;AACA;AAEA;AACA;AACA;AACA;AACA;AAJA;AACA;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;AAIA;AACA;AAAA;AACA;AAEA;AACA;AACA;AACA;AACA;AAJA;AACA;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;AAQA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;AAMA;AACA;AACA;AACA;AACA;AACA;;;;;;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;AAOA;AACA;AACA;AACA;AAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;AAOA;AAAA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;AAMA;AACA;AACA;AACA;AACA;AACA;;;;;;;AAOA;AAAA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;;;;;;AAMA;AACA;AACA;AACA;AACA;;;;;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;AAQA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;AAQA;AAAA;AAAA;AACA;AACA;;;;;;;AAOA;AAAA;AACA;AAAA;AACA;AACA;AACA;AAHA;AACA;AAKA;AACA;AACA;AACA;;;;;;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;ACtkBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AA1BA;AACA;AA4BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AAAA;AAAA;AACA;AACA;AACA;AADA;AAGA;AACA;AAtCA;AACA;AAwCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AARA;AACA;AAUA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AATA;AACA;AAWA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AATA;AACA;AAWA;;;;;;;;;;;;;AC1GA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;ACRA;AACA;AACA;AACA;AACA;AACA;;;ACLA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AC7CA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;ACrBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AC3BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;ACdA;AACA;AACA;AACA;AACA;AACA;;;ACLA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AC5BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;AC7DA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACvPA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACpBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;ACjIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC9CA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC/BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AC/CA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;AChBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;;ACpBA;AACA;;;AACA;AACA;AAAA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;;;AACA;AACA;AACA;;;AAEA;AACA;AACA;;;AAEA;AACA;AACA;AACA;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAEA;AACA;AACA;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAEA;AACA;AACA;AACA;AACA;;;AAEA;AACA;AACA;AACA;AACA;;;AAEA;AACA;AACA;;;;;;AA5EA;;;;;;;;;;;;;;;;;;;;ACFA;AACA;;;AAAA;AACA;;;AAAA;AACA;;;AAAA;AACA;;;AAAA;AACA;;;AAAA;AACA;;;AAAA;AACA;;;AAAA;AACA;;;AAAA;AACA;AAAA;AACA;AAAA;AACA;AAAA;AACA;AAAA;AACA;AAAA;AACA;AAAA;AACA;AAcA;AACA;;;;;;;;;AACA;;;AAGA;AACA;AAAA;AAAA;AACA;AADA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;AACA;AACA;AACA;AALA;AACA;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AADA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;AAIA;;;;;;;;;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;AAQA;AAAA;AACA;AAAA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AALA;AACA;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;AAOA;AAAA;AACA;AADA;AACA;AAAA;AACA;AAFA;AAAA;AAAA;AAAA;AACA;AAGA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AAtBA;AAuBA;AACA;AACA;AACA;AACA;AACA;AACA;AA7BA;AAAA;AACA;AA8BA;AACA;AACA;AADA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;AAOA;AAAA;AACA;AADA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;;;;;;;;AAKA;AACA;AACA;AACA;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AACA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;AAOA;AAAA;AACA;AAAA;AACA;AACA;AACA;AAJA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAJA;AAMA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;AAMA;AACA;AACA;AACA;AACA;AAJA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAJA;AACA;AAMA;AACA;AACA;AACA;;;;;;;;AAKA;AAAA;AACA;AAAA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;;;;;;;;AAKA;AAAA;AACA;AAAA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;;;;;;;;;AAMA;AAAA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;AAOA;AAAA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;AAMA;AAAA;AACA;AADA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;AAKA;AAAA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;AAKA;AAAA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;AAOA;AAAA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;AAOA;AAAA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;AAMA;AAAA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;AASA;AAAA;AAAA;AACA;AADA;AACA;AADA;AAAA;AACA;AAAA;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAMA;AACA;AASA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;AAMA;AACA;AACA;AACA;AACA;AACA;;;;;;;;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;AAMA;AAAA;AACA;AAAA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;AAIA;;;;;;;;;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AADA;AAGA;AACA;AACA;;;;;;AAGA;AACA;AACA;AACA;AACA;AAQA;AACA;AACA;AACA;AAEA;;;;;;;;;;AAOA;AACA;AAMA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;AAQA;AAAA;AACA;AADA;AACA;AAAA;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AADA;AACA;AAGA;AACA;AACA;AACA;AACA;AASA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;AAMA;AAAA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEA;;;;;;;;;;AAOA;AACA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAKA;AACA;AAGA;AACA;AACA;AACA;AACA;AAFA;AAIA;AACA;AACA;;;;;;;;AAKA;AAAA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAMA;AACA;AASA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;AAMA;AACA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAFA;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;AAKA;AAAA;AAAA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAWA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;AAMA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAKA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;AAMA;AAAA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AApBA;AACA;AAsBA;AACA;AACA;AACA;;;;;;;;;AAMA;AAAA;AACA;AAAA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAnCA;AACA;AAqCA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;AAOA;AAAA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;AAMA;AAAA;AACA;AADA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;AAWA;AAOA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAYA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AALA;AAOA;AACA;AACA;AACA;AACA;AACA;AAJA;AAMA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAJA;AAMA;AACA;AACA;AACA;AACA;AAHA;AAKA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;AAYA;AAQA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAaA;AACA;AASA;AACA;AACA;AACA;;;;;;;;AAKA;AACA;AAGA;AACA;AACA;;;;;;;;;;;;AASA;AAAA;AACA;AADA;AAAA;AACA;AAAA;AAGA;AACA;AACA;AACA;AACA;AACA;AAQA;AACA;AACA;AASA;AACA;AACA;AACA;AACA;AAQA;AACA;AACA;AACA;;;;;;;;;;AAOA;AAAA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AANA;AAAA;AAAA;AACA;AAKA;AACA;AACA;AACA;;;;;;;;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;AAKA;AACA;AACA;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAEA;AAAA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAOA;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AALA;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AASA;AACA;AACA;AASA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;;;AAEA;AAAA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AAQA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;;;AAEA;AAAA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAQA;AACA;AAQA;AACA;AACA;AACA;AACA;AAOA;AACA;AACA;AACA;AAxCA;AACA;AA0CA;AACA;;;AAEA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AASA;AACA;AACA;AACA;AACA;;;;;;AAEA;AACA;;;;;;ACv2EA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;ACn+BA;AACA;AAAA;AACA;;;;;;;;;AACA;AACA;AAAA;AACA;AAAA;AAMA;AACA;AACA;;;;;;;;;AAKA;AACA;AACA;AACA;AACA;;;;;;;;AAKA;AACA;AACA;AACA;AACA;;;;;;;AAIA;AACA;AACA;AACA;AACA;;;;;;;AAIA;AACA;AACA;AACA;AACA;AACA;;;;;;;AAIA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;;;;;;;AAIA;AAAA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;AAIA;AACA;AACA;AACA;AACA;AACA;;;;;;;AAIA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;;;;;;;AAIA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;;;;;;;AAIA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;;;;;;;AAIA;AACA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;AAIA;AACA;AACA;AAEA;AAAA;AACA;AACA;AACA;AACA;AACA;;;;;;;AAIA;AACA;AACA;AACA;AACA;AACA;;;;;;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;AAKA;AACA;AACA;AAAA;AAAA;AACA;AACA;AACA;;;;;;AA7KA;;;;;;;ACHA;AACA;AACA;AACA;;;;;;;;ACHA;;;;;;;;ACAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;AC5BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;ACrBA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;ACtBA;AACA;AAAA;AACA;;;AAAA;AACA;;;AAAA;AACA;;;;;AACA;AACA;AACA;AACA;AAHA;AACA;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;;;;ACtBA;AACA;;;AAHA;AACA;AACA;AAAA;AAAA;AACA;AAAA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAVA;AACA;AAYA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AAhDA;AAkDA;;;;;;;;;;;;ACnDA;AACA;;;AAHA;AACA;AACA;AAAA;AAAA;AACA;AAAA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AAJA;AAMA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AAhBA;AAkBA;;;;;;;;;;;;ACnBA;AACA;;;AAHA;AACA;AACA;AAAA;AAAA;AACA;AAAA;AACA;AAAA;AACA;;;;;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAZA;AAcA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AAAA;AAAA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AA/FA;AAiGA;;;;;;;;;;;;;;;;;ACpGA;AACA;AAAA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA;AACA;AACA;AACA;AACA;;;;;;;;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;AAIA;AACA;AACA;AACA;AACA;;;;;;;;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;AAKA;AACA;AACA;AACA;AACA;AACA;;;;;;AAvDA;;;;;;;;;;;;;;;;;ACAA;AACA;AAAA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA;AACA;AACA;AACA;AACA;;;;;;AAGA;AACA;AACA;AACA;AACA;AACA;;;;AAIA;AACA;;;AAAA;AACA;AACA;AACA;AACA;AACA;;;;;;AAGA;AACA;AACA;AACA;AACA;;;;;;AAGA;AACA;AACA;AACA;AACA;;;;;;;;;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAOA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;AAIA;AACA;AACA;AACA;AACA;;;;;;AAGA;AACA;AACA;;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAEA;AACA;AACA;AACA;AACA;;;AAEA;AACA;AACA;;;AAEA;AACA;AACA;AACA;AACA;;;;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAEA;AACA;AACA;AAIA;AACA;AACA;AACA;AACA;;;;;;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;AAGA;AACA;AACA;AACA;AACA;;;;;;AA3LA;;;;;;;;;;;;;;;ACAA;AACA;;;AACA;AACA;AAAA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA;AACA;AACA;;;AAEA;AACA;AACA;AACA;AACA;AACA;;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;;AAMA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;AAGA;AACA;AACA;AACA;AACA;;;;;;AAGA;AACA;AACA;;;AAEA;AACA;AACA;AACA;AACA;AACA;;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAEA;AACA;AACA;AACA;;;AAEA;AACA;AACA;AACA;;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;AAKA;AAAA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;AAKA;AACA;AACA;AACA;AACA;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;;;AAEA;AACA;AACA;;;AAEA;AACA;AACA;;;AAEA;AACA;AACA;;;AAEA;AACA;AACA;;;AAEA;AACA;AACA;;;AAEA;AACA;AACA;;;;;;AAnKA;;;;;;;;;;;;;;;;;ACFA;AACA;AAAA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACA;AACA;AACA;AACA;AACA;;;;;;AAGA;AACA;AACA;AACA;AACA;;;;;;AAGA;AAAA;AACA;AAAA;AACA;AACA;;;;;;AAGA;AACA;AACA;AACA;AACA;;;;;;;AAIA;AACA;AACA;;;;;;AAxCA;;;;;;;;;;;;;;;;;ACAA;AACA;;;;;;;;;;;AACA;;;AACA;AAAA;AACA;AADA;AACA;AACA;AACA;AACA;AAJA;AAKA;AACA;;;AACA;AACA;AACA;;;AAEA;AACA;AACA;;;AAEA;AACA;AACA;;;AAEA;AACA;AACA;;;AAEA;AACA;AACA;;;AAEA;AACA;AACA;AACA;;;;;;AA/BA;;;;;;;;;;;;;;;;;ACFA;AACA;;;;;;;;;;;AACA;;;AACA;AAAA;AACA;AADA;AACA;AACA;AACA;AACA;AAJA;AAKA;AACA;;;AACA;AACA;AACA;;;AAEA;AACA;AACA;;;AAEA;AACA;AACA;;;AAEA;AACA;AACA;;;AAEA;AACA;AACA;;;AAEA;AACA;AACA;AACA;;;AAEA;AACA;AACA;;;AAEA;AACA;AACA;;;AAEA;AACA;AACA;;;;;;AA3CA;;;;;;;;;;;;;;ACFA;AACA;;;AAAA;AACA;;;;;AACA;AACA;AAQA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAaA;AACA;AACA;AAGA;AACA;AAAA;AACA;AAAA;AACA;AAMA;AAGA;AACA;AACA;AAKA;AACA;AAAA;AACA;AAAA;AACA;AACA;AACA;AACA;AAOA;AAAA;AACA;AAAA;AACA;AAOA;AAqBA;AACA;AACA;AAYA;AACA;AACA;AACA;AAGA;AASA;AACA;AACA;AACA;AACA;AAKA;AAYA;AACA;AAAA;AACA;AAAA;AACA;AACA;AAQA;AAiBA;AACA;AACA;AACA;AAIA;AAWA;AACA;AACA;AACA;AAIA;AAOA;AACA;AAAA;AACA;AADA;AACA;AAAA;AACA;AAOA;AAKA;AACA;AACA;AAGA;AArOA;AACA;AAuOA;;;;;;AC3OA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;;;;;;;;;;;;;;;AC/CA;AACA;AACA;AAAA;AAWA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAVA;AAVA;AACA;AAsBA;AAAA;AACA;AACA;AAFA;AAAA;AACA;AAIA;AAAA;AAAA;AACA;AACA;AAFA;AAAA;AACA;AAIA;AAAA;AACA;AADA;AAAA;;;;;;;;;;;;;;ACnCA;AACA;AACA;AAAA;AAUA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AATA;AATA;AACA;AAoBA;AAAA;AACA;AACA;AACA;AAHA;AAAA;AACA;AAKA;AAAA;AACA;AACA;AACA;AAHA;AAAA;;;;;;;;;;;;;;AC7BA;AACA;AACA;AACA;AAAA;AACA;AACA;AACA;AACA;AACA;AALA;AAAA;;;;;;;;;;;;ACHA;AACA;AAAA;AACA;AADA;AAAA;;;;;;;;;ACDA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAHA;AAKA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;A","sourceRoot":""}
\ No newline at end of file
diff --git a/src/scripts/dist/choices.min.js b/src/scripts/dist/choices.min.js
index e20c3f6..03ca6cd 100644
--- a/src/scripts/dist/choices.min.js
+++ b/src/scripts/dist/choices.min.js
@@ -1,2 +1,2 @@
/*! choices.js v3.0.2 | (c) 2017 Josh Johnson | https://github.com/jshjohnson/Choices#readme */
-!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.Choices=t():e.Choices=t()}(this,function(){return function(e){function t(i){if(n[i])return n[i].exports;var o=n[i]={i:i,l:!1,exports:{}};return e[i].call(o.exports,o,o.exports,t),o.l=!0,o.exports}var n={};return t.m=e,t.c=n,t.d=function(e,n,i){t.o(e,n)||Object.defineProperty(e,n,{configurable:!1,enumerable:!0,get:i})},t.n=function(e){var n=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(n,"a",n),n},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="/src/scripts/dist/",t(t.s=1)}([function(e,t){var n;n=function(){return this}();try{n=n||Function("return this")()||(0,eval)("this")}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t,n){e.exports=n(2)},function(e,t,n){"use strict";function i(e){var t=Y.call(e,W),n=e[W];try{e[W]=void 0;var i=!0}catch(e){}var o=q.call(e);return i&&(t?e[W]=n:delete e[W]),o}function o(e){return $.call(e)}function r(e){return null==e?void 0===e?Q:Z:X&&X in Object(e)?U(e):J(e)}function s(e,t){return function(n){return e(t(n))}}function a(e){return null!=e&&"object"==typeof e}function l(e){if(!oe(e)||ee(e)!=re)return!1;var t=ie(e);if(null===t)return!0;var n=ce.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&le.call(n)==ue}function c(e,t,n){function i(){v===f&&(v=f.slice())}function o(){return d}function r(e){if("function"!=typeof e)throw new Error("Expected listener to be a function.");var t=!0;return i(),v.push(e),function(){if(t){t=!1,i();var n=v.indexOf(e);v.splice(n,1)}}}function s(e){if(!he(e))throw new Error("Actions must be plain objects. Use custom middleware for async actions.");if(void 0===e.type)throw new Error('Actions may not have an undefined "type" property. Have you misspelled a constant?');if(p)throw new Error("Reducers may not dispatch actions.");try{p=!0,d=h(d,e)}finally{p=!1}for(var t=f=v,n=0;n0&&void 0!==arguments[0]?arguments[0]:pe,t=arguments[1];switch(t.type){case"ADD_ITEM":return[].concat(d(e),[{id:t.id,choiceId:t.choiceId,groupId:t.groupId,value:t.value,label:t.label,active:!0,highlighted:!1,customProperties:t.customProperties,placeholder:t.placeholder||!1,keyCode:null}]).map(function(e){var t=e;return t.highlighted&&(t.highlighted=!1),t});case"REMOVE_ITEM":return e.map(function(e){var n=e;return n.id===t.id&&(n.active=!1),n});case"HIGHLIGHT_ITEM":return e.map(function(e){var n=e;return n.id===t.id&&(n.highlighted=t.highlighted),n});default:return e}}function v(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t0&&void 0!==arguments[0]?arguments[0]:me,t=arguments[1];switch(t.type){case"ADD_GROUP":return[].concat(v(e),[{id:t.id,value:t.value,active:t.active,disabled:t.disabled}]);case"CLEAR_CHOICES":return[];default:return e}}function m(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t0&&void 0!==arguments[0]?arguments[0]:ge,t=arguments[1];switch(t.type){case"ADD_CHOICE":return[].concat(m(e),[{id:t.id,elementId:t.elementId,groupId:t.groupId,value:t.value,label:t.label||t.value,disabled:t.disabled||!1,selected:!1,active:!0,score:9999,customProperties:t.customProperties,placeholder:t.placeholder||!1,keyCode:null}]);case"ADD_ITEM":return t.activateOptions?e.map(function(e){var n=e;return n.active=t.active,n}):t.choiceId>-1?e.map(function(e){var n=e;return n.id===parseInt(t.choiceId,10)&&(n.selected=!0),n}):e;case"REMOVE_ITEM":return t.choiceId>-1?e.map(function(e){var n=e;return n.id===parseInt(t.choiceId,10)&&(n.selected=!1),n}):e;case"FILTER_CHOICES":return e.map(function(e){var n=e;return n.active=t.results.some(function(e){var t=e.item,i=e.score;return t.id===n.id&&(n.score=i,!0)}),n});case"ACTIVATE_CHOICES":return e.map(function(e){var n=e;return n.active=t.active,n});case"CLEAR_CHOICES":return ge;default:return e}}function y(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t0&&void 0!==arguments[0]?arguments[0]:{},t=arguments[1];if(s)throw s;for(var i=!1,o={},a=0;a0&&void 0!==arguments[0]?arguments[0]:this.getItems()).reduce(function(e,t){return e.push(t.value),e},[])}},{key:"getChoices",value:function(){return this.store.getState().choices}},{key:"getChoicesFilteredByActive",value:function(){return this.getChoices().filter(function(e){return!0===e.active})}},{key:"getChoicesFilteredBySelectable",value:function(){return this.getChoices().filter(function(e){return!0!==e.disabled})}},{key:"getSearchableChoices",value:function(){return this.getChoicesFilteredBySelectable().filter(function(e){return!0!==e.placeholder})}},{key:"getChoiceById",value:function(e){if(e){return this.getChoicesFilteredByActive().find(function(t){return t.id===parseInt(e,10)})}return!1}},{key:"getPlaceholderChoice",value:function(){return[].concat(y(this.getChoices())).reverse().find(function(e){return!0===e.placeholder})}},{key:"getGroups",value:function(){return this.store.getState().groups}},{key:"getGroupsFilteredByActive",value:function(){var e=this.getGroups(),t=this.getChoices();return e.filter(function(e){var n=!0===e.active&&!1===e.disabled,i=t.some(function(e){return!0===e.active&&!1===e.disabled});return n&&i},[])}},{key:"getGroupById",value:function(e){return this.getGroups().find(function(t){return t.id===parseInt(e,10)})}}]),e}(),Se=Ie,we=function(){function e(e,t){for(var n=0;n=i:"top"===this.config.position&&(o=!0),o}},{key:"setActiveDescendant",value:function(e){this.element.setAttribute("aria-activedescendant",e)}},{key:"removeActiveDescendant",value:function(){this.element.removeAttribute("aria-activedescendant")}},{key:"open",value:function(e){this.element.classList.add(this.classNames.openState),this.element.setAttribute("aria-expanded","true"),this.isOpen=!0,this.shouldFlip(e)&&(this.element.classList.add(this.classNames.flippedState),this.isFlipped=!0)}},{key:"close",value:function(){this.element.classList.remove(this.classNames.openState),this.element.setAttribute("aria-expanded","false"),this.removeActiveDescendant(),this.isOpen=!1,this.isFlipped&&(this.element.classList.remove(this.classNames.flippedState),this.isFlipped=!1)}},{key:"focus",value:function(){this.isFocussed||this.element.focus()}},{key:"addFocusState",value:function(){this.element.classList.add(this.classNames.focusState)}},{key:"removeFocusState",value:function(){this.element.classList.remove(this.classNames.focusState)}},{key:"enable",value:function(){this.element.classList.remove(this.config.classNames.disabledState),this.element.removeAttribute("aria-disabled"),this.parentInstance.isSelectOneElement&&this.element.setAttribute("tabindex","0"),this.isDisabled=!1}},{key:"disable",value:function(){this.element.classList.add(this.config.classNames.disabledState),this.element.setAttribute("aria-disabled","true"),this.parentInstance.isSelectOneElement&&this.element.setAttribute("tabindex","-1"),this.isDisabled=!0}},{key:"revert",value:function(e){this.element.parentNode.insertBefore(e,this.element),this.element.parentNode.removeChild(this.element)}},{key:"addLoadingState",value:function(){this.element.classList.add(this.classNames.loadingState),this.element.setAttribute("aria-busy","true"),this.isLoading=!0}},{key:"removeLoadingState",value:function(){this.element.classList.remove(this.classNames.loadingState),this.element.removeAttribute("aria-busy"),this.isLoading=!1}}]),e}(),Te=Ae,Le="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},xe=function(e){for(var t="",n=0;n2&&void 0!==arguments[2]?arguments[2]:1;if(e&&t){var i=e.parentNode.parentNode,o=Array.from(i.querySelectorAll(t));return o[o.indexOf(e)+(n>0?1:-1)]}},Ve=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;if(e){return n>0?t.scrollTop+t.offsetHeight>=e.offsetTop+e.offsetHeight:e.offsetTop>=t.scrollTop}},Re=function(e,t){return Math.floor(Math.random()*(t-e)+e)},Ke=function(){var e=document.createElement("div");return function(t){var n=t.trim(),i=void 0;for(e.innerHTML=n,i=e.children[0];e.firstChild;)e.removeChild(e.firstChild);return i}}(),Ge=function(e){var t=e.value||e.placeholder,n=e.offsetWidth;if(t){var i=Ke(""+t+" ");if(i.style.position="absolute",i.style.padding="0",i.style.top="-9999px",i.style.left="-9999px",i.style.width="auto",i.style.whiteSpace="pre",document.body.contains(e)&&window.getComputedStyle){var o=window.getComputedStyle(e);o&&(i.style.fontSize=o.fontSize,i.style.fontFamily=o.fontFamily,i.style.fontWeight=o.fontWeight,i.style.fontStyle=o.fontStyle,i.style.letterSpacing=o.letterSpacing,i.style.textTransform=o.textTransform,i.style.padding=o.padding)}document.body.appendChild(i),t&&i.offsetWidth!==e.offsetWidth&&(n=i.offsetWidth+4),document.body.removeChild(i)}return n+"px"},Ye=function(e,t){var n=(e.label||e.value).toLowerCase(),i=(t.label||t.value).toLowerCase();return ni?1:0},qe=function(e,t){return e.score-t.score},We=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,i=new CustomEvent(t,{detail:n,bubbles:!0,cancelable:!0});return e.dispatchEvent(i)},Ue=function(e,t){return!(!e||!t)&&new RegExp(t.source,"i").test(e)},ze=function(){function e(e,t){for(var n=0;n0&&void 0!==arguments[0])||arguments[0];return this.element.value&&(this.element.value=""),e&&this.setWidth(),this.parentInstance}},{key:"setWidth",value:function(e){this.parentInstance.placeholder?(this.element.value&&this.element.value.length>=this.parentInstance.placeholder.length/1.25||e)&&(this.element.style.width=this.getWidth()):this.element.style.width=this.getWidth()}},{key:"getWidth",value:function(){return Ge(this.element)}},{key:"setPlaceholder",value:function(e){this.element.placeholder=e}},{key:"setValue",value:function(e){this.element.value=e}},{key:"getValue",value:function(){return this.element.value}},{key:"setActiveDescendant",value:function(e){this.element.setAttribute("aria-activedescendant",e)}},{key:"removeActiveDescendant",value:function(){this.element.removeAttribute("aria-activedescendant")}}]),e}(),Je=$e,Ze=function(){function e(e,t){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:0;this.element.scrollTop=e}},{key:"append",value:function(e){this.element.appendChild(e)}},{key:"getChild",value:function(e){return this.element.querySelector(e)}}]),e}(),Xe=Qe,et=function(){function e(e,t){for(var n=0;n"'+e+'"'},maxItemText:function(e){return"Only "+e+" values can be added."},uniqueItemText:"Only unique values can be added.",fuseOptions:{includeScore:!0},callbackOnInit:null,callbackOnCreateTemplates:null},ft={showDropdown:"showDropdown",hideDropdown:"hideDropdown",change:"change",choice:"choice",search:"search",addItem:"addItem",removeItem:"removeItem",highlightItem:"highlightItem"},vt={ADD_CHOICE:"ADD_CHOICE",FILTER_CHOICES:"FILTER_CHOICES",ACTIVATE_CHOICES:"ACTIVATE_CHOICES",CLEAR_CHOICES:"CLEAR_CHOICES",ADD_GROUP:"ADD_GROUP",ADD_ITEM:"ADD_ITEM",REMOVE_ITEM:"REMOVE_ITEM",HIGHLIGHT_ITEM:"HIGHLIGHT_ITEM",CLEAR_ALL:"CLEAR_ALL"},pt={BACK_KEY:46,DELETE_KEY:8,ENTER_KEY:13,A_KEY:65,ESC_KEY:27,UP_KEY:38,DOWN_KEY:40,PAGE_UP_KEY:33,PAGE_DOWN_KEY:34},mt=n(9),gt=n.n(mt),yt={containerOuter:function(e,t,n,i,o,r){var s=i?'tabindex="0"':"",a=n?'role="listbox"':"",l="";return n&&o&&(a='role="combobox"',l='aria-autocomplete="list"'),Ke('\n \n
\n ')},containerInner:function(e){return Ke('\n
\n ')},itemList:function(e,t){var n,i=gt()(e.list,(n={},x(n,e.listSingle,t),x(n,e.listItems,!t),n));return Ke('\n
\n ')},placeholder:function(e,t){return Ke('\n \n '+t+"\n
\n ")},item:function(e,t,n){var i,o=t.active?'aria-selected="true"':"",r=t.disabled?'aria-disabled="true"':"",s=gt()(e.item,(i={},x(i,e.highlightedState,t.highlighted),x(i,e.itemSelectable,!t.highlighted),x(i,e.placeholder,t.placeholder),i));if(n){var a;return s=gt()(e.item,(a={},x(a,e.highlightedState,t.highlighted),x(a,e.itemSelectable,!t.disabled),x(a,e.placeholder,t.placeholder),a)),Ke('\n \n "+t.label+'\x3c!--\n --\x3e\n Remove item\n \n
\n ")}return Ke('\n \n "+t.label+"\n
\n ")},choiceList:function(e,t){var n=t?"":'aria-multiselectable="true"';return Ke('\n \n
\n ")},choiceGroup:function(e,t){var n=t.disabled?'aria-disabled="true"':"",i=gt()(e.group,x({},e.itemDisabled,t.disabled));return Ke('\n \n ")},choice:function(e,t,n){var i,o=t.groupId>0?'role="treeitem"':'role="option"',r=gt()(e.item,e.itemChoice,(i={},x(i,e.itemDisabled,t.disabled),x(i,e.itemSelectable,!t.disabled),x(i,e.placeholder,t.placeholder),i));return Ke('\n \n "+t.label+"\n
\n ")},input:function(e){var t=gt()(e.input,e.inputCloned);return Ke('\n \n ')},dropdown:function(e){var t=gt()(e.list,e.listDropdown);return Ke('\n \n
\n ')},notice:function(e,t){var n,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",o=gt()(e.item,e.itemChoice,(n={},x(n,e.noResults,"no-results"===i),x(n,e.noChoices,"no-choices"===i),n));return Ke('\n \n '+t+"\n
\n ")},option:function(e,t){return Ke('\n '+t.label+" \n ")}},bt=function(e,t,n,i,o,r,s,a,l){return{type:vt.ADD_CHOICE,value:e,label:t,id:n,groupId:i,disabled:o,elementId:r,customProperties:s,placeholder:a,keyCode:l}},Et=function(e){return{type:vt.FILTER_CHOICES,results:e}},_t=function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];return{type:vt.ACTIVATE_CHOICES,active:e}},It=function(){return{type:vt.CLEAR_CHOICES}},St=function(e,t,n,i,o,r,s,a){return{type:vt.ADD_ITEM,value:e,label:t,id:n,choiceId:i,groupId:o,customProperties:r,placeholder:s,keyCode:a}},wt=function(e,t){return{type:vt.REMOVE_ITEM,id:e,choiceId:t}},Ot=function(e,t){return{type:vt.HIGHLIGHT_ITEM,id:e,highlighted:t}},kt=function(e,t,n,i){return{type:vt.ADD_GROUP,value:e,id:t,active:n,disabled:i}},Ct=function(){return{type:"CLEAR_ALL"}},At=(n(10),Object.assign||function(e){for(var t=1;t0&&void 0!==arguments[0]?arguments[0]:"[data-choice]",n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(F(this,e),Fe("String",t)){var i=document.querySelectorAll(t);if(i.length>1)for(var o=1;o=1){var n=i._getTemplate("choiceGroup",e);o.appendChild(n),i.renderChoices(t,o,!0)}}),o}},{key:"renderChoices",value:function(e,t){var n=this,i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],o=t||document.createDocumentFragment(),r=this.config,s=r.renderSelectedChoices,a=r.searchResultLimit,l=r.renderChoiceLimit,c=this.isSearching?qe:this.config.sortFilter,u=e;"auto"!==s||this.isSelectOneElement||(u=e.filter(function(e){return!e.selected}));var h=u.reduce(function(e,t){return t.placeholder?e.placeholderChoices.push(t):e.normalChoices.push(t),e},{placeholderChoices:[],normalChoices:[]}),d=h.placeholderChoices,f=h.normalChoices;(this.config.shouldSort||this.isSearching)&&f.sort(c);var v=u.length,p=[].concat(D(d),D(f));this.isSearching?v=a:l>0&&!i&&(v=l);for(var m=0;m1&&void 0!==arguments[1]?arguments[1]:null,i=n||document.createDocumentFragment();if(this.config.shouldSortItems&&!this.isSelectOneElement&&e.sort(this.config.sortFilter),this.isTextElement){var o=this.store.getItemsReducedToValues(e),r=o.join(this.config.delimiter);this.passedElement.setValue(r)}else{var s=document.createDocumentFragment(),a=function(e){var n=t._getTemplate("option",e);s.appendChild(n)};e.forEach(function(e){return a(e)}),this.passedElement.setOptions(s)}var l=function(e){var n=t._getTemplate("item",e,t.config.removeItemButton);i.appendChild(n)};return e.forEach(function(e){return l(e)}),i}},{key:"render",value:function(){if(this.currentState=this.store.getState(),this.currentState.choices!==this.prevState.choices||this.currentState.groups!==this.prevState.groups||this.currentState.items!==this.prevState.items){if(this.isSelectElement){var e=this.store.getGroupsFilteredByActive(),t=this.store.getChoicesFilteredByActive(),n=document.createDocumentFragment();if(this.choiceList.clear(),this.config.resetScrollPosition&&this.choiceList.scrollTo(0),e.length>=1&&!this.isSearching){var i=t.filter(function(e){return!0===e.placeholder&&-1===e.groupId});i.length>=1&&(n=this.renderChoices(i,n)),n=this.renderGroups(e,t,n)}else t.length>=1&&(n=this.renderChoices(t,n));var o=this.store.getItemsFilteredByActive(),r=this._canAddItem(o,this.input.getValue());if(n.childNodes&&n.childNodes.length>0)r.response?(this.choiceList.append(n),this._highlightChoice()):this.choiceList.append(this._getTemplate("notice",r.notice));else{var s=void 0,a=void 0;this.isSearching?(a=Fe("Function",this.config.noResultsText)?this.config.noResultsText():this.config.noResultsText,s=this._getTemplate("notice",a,"no-results")):(a=Fe("Function",this.config.noChoicesText)?this.config.noChoicesText():this.config.noChoicesText,s=this._getTemplate("notice",a,"no-choices")),this.choiceList.append(s)}}var l=this.store.getItemsFilteredByActive()||[];if(this.itemList.clear(),l.length){var c=this.renderItems(l);c.childNodes&&this.itemList.append(c)}this.prevState=this.currentState}}},{key:"highlightItem",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(!e)return this;var n=e.id,i=e.groupId,o=void 0===i?-1:i,r=e.value,s=void 0===r?"":r,a=e.label,l=void 0===a?"":a,c=o>=0?this.store.getGroupById(o):null;return this.store.dispatch(Ot(n,!0)),t&&this.passedElement.triggerEvent(ft.highlightItem,{id:n,value:s,label:l,groupValue:c&&c.value?c.value:null}),this}},{key:"unhighlightItem",value:function(e){if(!e)return this;var t=e.id,n=e.groupId,i=void 0===n?-1:n,o=e.value,r=void 0===o?"":o,s=e.label,a=void 0===s?"":s,l=i>=0?this.store.getGroupById(i):null;return this.store.dispatch(Ot(t,!1)),this.passedElement.triggerEvent(ft.highlightItem,{id:t,value:r,label:a,groupValue:l&&l.value?l.value:null}),this}},{key:"highlightAll",value:function(){var e=this;return this.store.getItems().forEach(function(t){return e.highlightItem(t)}),this}},{key:"unhighlightAll",value:function(){var e=this;return this.store.getItems().forEach(function(t){return e.unhighlightItem(t)}),this}},{key:"removeItemsByValue",value:function(e){var t=this;return e&&Fe("String",e)?(this.store.getItemsFilteredByActive().forEach(function(n){n.value===e&&t._removeItem(n)}),this):this}},{key:"removeActiveItems",value:function(e){var t=this;return this.store.getItemsFilteredByActive().forEach(function(n){n.active&&e!==n.id&&t._removeItem(n)}),this}},{key:"removeHighlightedItems",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this.store.getItemsFilteredByActive().forEach(function(n){n.highlighted&&n.active&&(e._removeItem(n),t&&e._triggerChange(n.value))}),this}},{key:"showDropdown",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this.dropdown.isActive?this:(this.containerOuter.open(this.dropdown.getVerticalPos()),this.dropdown.show(),this.input.activate(e),this.passedElement.triggerEvent(ft.showDropdown,{}),this)}},{key:"hideDropdown",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this.dropdown.isActive?(this.containerOuter.close(),this.dropdown.hide(),this.input.deactivate(e),this.passedElement.triggerEvent(ft.hideDropdown,{}),this):this}},{key:"toggleDropdown",value:function(){return this.dropdown.isActive?this.hideDropdown():this.showDropdown(!0),this}},{key:"getValue",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=this.store.getItemsFilteredByActive(),n=t.reduce(function(t,n){var i=e?n.value:n;return t.push(i),t},[]);return this.isSelectOneElement?n[0]:n}},{key:"setValue",value:function(e){var t=this;return this.initialised?([].concat(D(e)).forEach(function(e){return t._setChoiceOrItem(e)}),this):this}},{key:"setChoiceByValue",value:function(e){var t=this;return this.isTextElement||!this.initialised?this:((Fe("Array",e)?e:[e]).forEach(function(e){return t._findAndSelectChoiceByValue(e)}),this)}},{key:"setChoices",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=this,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",o=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(!(this.initialised&&this.isSelectElement&&Fe("Array",e)&&t))return this;if(o&&this._clearChoices(),e.length){this.containerOuter.removeLoadingState();var r=function(e){e.choices?n._addGroup(e,e.id||null,t,i):n._addChoice(e[t],e[i],e.selected,e.disabled,void 0,e.customProperties,e.placeholder)};e.forEach(r)}return this}},{key:"clearStore",value:function(){return this.store.dispatch(Ct()),this}},{key:"clearInput",value:function(){var e=!this.isSelectOneElement;return this.input.clear(e),!this.isTextElement&&this.config.searchEnabled&&(this.isSearching=!1,this.store.dispatch(_t(!0))),this}},{key:"ajax",value:function(e){var t=this;return this.initialised&&this.isSelectElement&&e?(requestAnimationFrame(function(){return t._handleLoadingState(!0)}),e(this._ajaxCallback()),this):this}},{key:"_triggerChange",value:function(e){e&&this.passedElement.triggerEvent(ft.change,{value:e})}},{key:"_selectPlaceholderChoice",value:function(){var e=this.store.getPlaceholderChoice();e&&(this._addItem(e.value,e.label,e.id,e.groupId,null,e.placeholder),this._triggerChange(e.value))}},{key:"_handleButtonAction",value:function(e,t){if(e&&t&&this.config.removeItems&&this.config.removeItemButton){var n=t.parentNode.getAttribute("data-id"),i=e.find(function(e){return e.id===parseInt(n,10)});this._removeItem(i),this._triggerChange(i.value),this.isSelectOneElement&&this._selectPlaceholderChoice()}}},{key:"_handleItemAction",value:function(e,t){var n=this,i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(e&&t&&this.config.removeItems&&!this.isSelectOneElement){var o=t.getAttribute("data-id");e.forEach(function(e){e.id!==parseInt(o,10)||e.highlighted?!i&&e.highlighted&&n.unhighlightItem(e):n.highlightItem(e)}),this.input.focus()}}},{key:"_handleChoiceAction",value:function(e,t){if(e&&t){var n=t.getAttribute("data-id"),i=this.store.getChoiceById(n),o=e[0]&&e[0].keyCode?e[0].keyCode:null,r=this.dropdown.isActive;if(i.keyCode=o,this.passedElement.triggerEvent(ft.choice,{choice:i}),i&&!i.selected&&!i.disabled){this._canAddItem(e,i.value).response&&(this._addItem(i.value,i.label,i.id,i.groupId,i.customProperties,i.placeholder,i.keyCode),this._triggerChange(i.value))}this.clearInput(),r&&this.isSelectOneElement&&(this.hideDropdown(),this.containerOuter.focus())}}},{key:"_handleBackspace",value:function(e){if(this.config.removeItems&&e){var t=e[e.length-1],n=e.some(function(e){return e.highlighted});this.config.editItems&&!n&&t?(this.input.setValue(t.value),this.input.setWidth(),this._removeItem(t),this._triggerChange(t.value)):(n||this.highlightItem(t,!1),this.removeHighlightedItems(!0))}}},{key:"_handleLoadingState",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=this.itemList.getChild("."+this.config.classNames.placeholder);e?(this.containerOuter.addLoadingState(),this.isSelectOneElement?t?t.innerHTML=this.config.loadingText:(t=this._getTemplate("placeholder",this.config.loadingText),this.itemList.append(t)):this.input.setPlaceholder(this.config.loadingText)):(this.containerOuter.removeLoadingState(),this.isSelectOneElement?t.innerHTML=this.placeholder||"":this.input.setPlaceholder(this.placeholder||""))}},{key:"_canAddItem",value:function(e,t){var n=!0,i=Fe("Function",this.config.addItemText)?this.config.addItemText(t):this.config.addItemText;return(this.isSelectMultipleElement||this.isTextElement)&&this.config.maxItemCount>0&&this.config.maxItemCount<=e.length&&(n=!1,i=Fe("Function",this.config.maxItemText)?this.config.maxItemText(this.config.maxItemCount):this.config.maxItemText),this.isTextElement&&this.config.addItems&&n&&this.config.regexFilter&&(n=Ue(t,this.config.regexFilter)),!e.some(function(e){return Fe("String",t)?e.value===t.trim():e.value===t})||this.config.duplicateItems||this.isSelectOneElement||!n||(n=!1,i=Fe("Function",this.config.uniqueItemText)?this.config.uniqueItemText(t):this.config.uniqueItemText),{response:n,notice:i}}},{key:"_ajaxCallback",value:function(){var e=this;return function(t,n,i){if(t&&n){var o=Fe("Object",t)?[t]:t;o&&Fe("Array",o)&&o.length?(e._handleLoadingState(!1),o.forEach(function(t){if(t.choices){var o=t.id||null;e._addGroup(t,o,n,i)}else e._addChoice(t[n],t[i],t.selected,t.disabled,void 0,t.customProperties,t.placeholder)}),e.isSelectOneElement&&e._selectPlaceholderChoice()):e._handleLoadingState(!1)}}}},{key:"_searchChoices",value:function(e){var t=Fe("String",e)?e.trim():e,n=Fe("String",this.currentValue)?this.currentValue.trim():this.currentValue;if(t.length<1&&t===n+" ")return 0;var i=this.store.getSearchableChoices(),o=t,r=Fe("Array",this.config.searchFields)?this.config.searchFields:[this.config.searchFields],s=Object.assign(this.config.fuseOptions,{keys:r}),a=new M.a(i,s),l=a.search(o);return this.currentValue=t,this.highlightPosition=0,this.isSearching=!0,this.store.dispatch(Et(l)),l.length}},{key:"_handleSearch",value:function(e){if(e&&this.input.isFocussed){var t=this.store.getChoices(),n=t.some(function(e){return!e.active});if(e&&e.length>=this.config.searchFloor){var i=this.config.searchChoices?this._searchChoices(e):0;this.passedElement.triggerEvent(ft.search,{value:e,resultCount:i})}else n&&(this.isSearching=!1,this.store.dispatch(_t(!0)))}}},{key:"_addEventListeners",value:function(){document.addEventListener("keyup",this._onKeyUp),document.addEventListener("keydown",this._onKeyDown),document.addEventListener("click",this._onClick),document.addEventListener("touchmove",this._onTouchMove),document.addEventListener("touchend",this._onTouchEnd),document.addEventListener("mousedown",this._onMouseDown),document.addEventListener("mouseover",this._onMouseOver),this.isSelectOneElement&&(this.containerOuter.element.addEventListener("focus",this._onFocus),this.containerOuter.element.addEventListener("blur",this._onBlur)),this.input.element.addEventListener("focus",this._onFocus),this.input.element.addEventListener("blur",this._onBlur),this.input.addEventListeners()}},{key:"_removeEventListeners",value:function(){document.removeEventListener("keyup",this._onKeyUp),document.removeEventListener("keydown",this._onKeyDown),document.removeEventListener("click",this._onClick),document.removeEventListener("touchmove",this._onTouchMove),document.removeEventListener("touchend",this._onTouchEnd),document.removeEventListener("mousedown",this._onMouseDown),document.removeEventListener("mouseover",this._onMouseOver),this.isSelectOneElement&&(this.containerOuter.element.removeEventListener("focus",this._onFocus),this.containerOuter.element.removeEventListener("blur",this._onBlur)),this.input.element.removeEventListener("focus",this._onFocus),this.input.element.removeEventListener("blur",this._onBlur),this.input.removeEventListeners()}},{key:"_onKeyDown",value:function(e){var t,n=this;if(e.target===this.input.element||this.containerOuter.element.contains(e.target)){var i=e.target,o=this.store.getItemsFilteredByActive(),r=this.input.isFocussed,s=this.dropdown.isActive,a=this.itemList.hasChildren,l=String.fromCharCode(e.keyCode),c=pt.BACK_KEY,u=pt.DELETE_KEY,h=pt.ENTER_KEY,d=pt.A_KEY,f=pt.ESC_KEY,v=pt.UP_KEY,p=pt.DOWN_KEY,m=pt.PAGE_UP_KEY,g=pt.PAGE_DOWN_KEY,y=e.ctrlKey||e.metaKey;!this.isTextElement&&/[a-zA-Z0-9-_ ]/.test(l)&&this.showDropdown(!0),this.canSearch=this.config.searchEnabled;var b=function(){y&&a&&(n.canSearch=!1,n.config.removeItems&&!n.input.getValue()&&n.input.element===document.activeElement&&n.highlightAll())},E=function(){if(n.isTextElement&&i.value){var t=n.input.getValue();n._canAddItem(o,t).response&&(n.hideDropdown(),n._addItem(t),n._triggerChange(t),n.clearInput())}if(i.hasAttribute("data-button")&&(n._handleButtonAction(o,i),e.preventDefault()),s){e.preventDefault();var r=n.dropdown.getChild("."+n.config.classNames.highlightedState);r&&(o[0]&&(o[0].keyCode=h),n._handleChoiceAction(o,r))}else n.isSelectOneElement&&(n.showDropdown(!0),e.preventDefault())},_=function(){s&&(n.hideDropdown(),n.containerOuter.focus())},I=function(){if(s||n.isSelectOneElement){n.showDropdown(!0),n.canSearch=!1;var t=e.keyCode===p||e.keyCode===g?1:-1,i=e.metaKey||e.keyCode===g||e.keyCode===m,o=void 0;if(i)o=t>0?Array.from(n.dropdown.element.querySelectorAll("[data-choice-selectable]")).pop():n.dropdown.element.querySelector("[data-choice-selectable]");else{var r=n.dropdown.element.querySelector("."+n.config.classNames.highlightedState);o=r?He(r,"[data-choice-selectable]",t):n.dropdown.element.querySelector("[data-choice-selectable]")}o&&(Ve(o,n.choiceList,t)||n._scrollToChoice(o,t),n._highlightChoice(o)),e.preventDefault()}},S=function(){!r||e.target.value||n.isSelectOneElement||(n._handleBackspace(o),e.preventDefault())},w=(t={},P(t,d,b),P(t,h,E),P(t,f,_),P(t,v,I),P(t,m,I),P(t,p,I),P(t,g,I),P(t,u,S),P(t,c,S),t);w[e.keyCode]&&w[e.keyCode]()}}},{key:"_onKeyUp",value:function(e){if(e.target===this.input.element){var t=this.input.getValue(),n=this.store.getItemsFilteredByActive(),i=this._canAddItem(n,t);if(this.isTextElement)if(t){if(i.notice){var o=this._getTemplate("notice",i.notice);this.dropdown.element.innerHTML=o.outerHTML}!0===i.response?this.showDropdown():i.notice||this.hideDropdown()}else this.hideDropdown();else{var r=pt.BACK_KEY,s=pt.DELETE_KEY;e.keyCode!==r&&e.keyCode!==s||e.target.value?this.canSearch&&i.response&&this._handleSearch(this.input.getValue()):!this.isTextElement&&this.isSearching&&(this.isSearching=!1,this.store.dispatch(_t(!0)))}this.canSearch=this.config.searchEnabled}}},{key:"_onTouchMove",value:function(){!0===this.wasTap&&(this.wasTap=!1)}},{key:"_onTouchEnd",value:function(e){var t=e.target||e.touches[0].target;!0===this.wasTap&&this.containerOuter.element.contains(t)&&(t!==this.containerOuter.element&&t!==this.containerInner.element||this.isSelectOneElement||(this.isTextElement?this.input.focus():this.showDropdown(!0)),e.stopPropagation()),this.wasTap=!0}},{key:"_onMouseDown",value:function(e){var t=e.target;if(t===this.choiceList&&this.isIe11&&(this.isScrollingOnIe=!0),this.containerOuter.element.contains(t)&&t!==this.input.element){var n=this.store.getItemsFilteredByActive(),i=e.shiftKey,o=Be(t,"data-button"),r=Be(t,"data-item"),s=Be(t,"data-choice");o?this._handleButtonAction(n,o):r?this._handleItemAction(n,r,i):s&&this._handleChoiceAction(n,s),e.preventDefault()}}},{key:"_onMouseOver",value:function(e){(e.target===this.dropdown||this.dropdown.element.contains(e.target))&&e.target.hasAttribute("data-choice")&&this._highlightChoice(e.target)}},{key:"_onClick",value:function(e){var t=e.target,n=this.dropdown.isActive,i=this.store.getItemsFilteredByActive();if(this.containerOuter.element.contains(t))n?this.isSelectOneElement&&t!==this.input.element&&!this.dropdown.element.contains(t)&&this.hideDropdown(!0):this.isTextElement?document.activeElement!==this.input.element&&this.input.focus():this.canSearch?this.showDropdown(!0):(this.showDropdown(),this.containerOuter.focus());else{i.some(function(e){return e.highlighted})&&this.unhighlightAll(),this.containerOuter.removeFocusState(),this.hideDropdown()}}},{key:"_onFocus",value:function(e){var t=this,n=e.target;if(this.containerOuter.element.contains(n)){({text:function(){n===t.input.element&&t.containerOuter.addFocusState()},"select-one":function(){t.containerOuter.addFocusState(),n===t.input.element&&t.showDropdown()},"select-multiple":function(){n===t.input.element&&(t.containerOuter.addFocusState(),t.showDropdown(!0))}})[this.passedElement.element.type]()}}},{key:"_onBlur",value:function(e){var t=this,n=e.target;if(this.containerOuter.element.contains(n)&&!this.isScrollingOnIe){var i=this.store.getItemsFilteredByActive(),o=i.some(function(e){return e.highlighted});({text:function(){n===t.input.element&&(t.containerOuter.removeFocusState(),o&&t.unhighlightAll(),t.hideDropdown())},"select-one":function(){t.containerOuter.removeFocusState(),n===t.containerOuter.element&&(t.canSearch||t.hideDropdown()),n===t.input.element&&t.hideDropdown()},"select-multiple":function(){n===t.input.element&&(t.containerOuter.removeFocusState(),t.hideDropdown(),o&&t.unhighlightAll())}})[this.passedElement.element.type]()}else this.isScrollingOnIe=!1,this.input.element.focus()}},{key:"_scrollToChoice",value:function(e,t){var n=this;if(e){var i=this.choiceList.height,o=e.offsetHeight,r=e.offsetTop+o,s=this.choiceList.scrollPos+i,a=t>0?this.choiceList.scrollPos+r-s:e.offsetTop,l=function e(){var i=n.choiceList.scrollPos,o=!1,r=void 0,s=void 0;t>0?(r=(a-i)/4,s=r>1?r:1,n.choiceList.scrollTo(i+s),i1?r:1,n.choiceList.scrollTo(i-s),i>a&&(o=!0)),o&&requestAnimationFrame(function(n){e(n,a,t)})};requestAnimationFrame(function(e){l()})}}},{key:"_highlightChoice",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,n=Array.from(this.dropdown.element.querySelectorAll("[data-choice-selectable]")),i=t;if(n&&n.length){var o=Array.from(this.dropdown.element.querySelectorAll("."+this.config.classNames.highlightedState)),r=this.dropdown.isActive;o.forEach(function(t){t.classList.remove(e.config.classNames.highlightedState),t.setAttribute("aria-selected","false")}),i?this.highlightPosition=n.indexOf(i):(i=n.length>this.highlightPosition?n[this.highlightPosition]:n[n.length-1])||(i=n[0]),i.classList.add(this.config.classNames.highlightedState),i.setAttribute("aria-selected","true"),r&&(this.input.setActiveDescendant(i.id),this.containerOuter.setActiveDescendant(i.id))}}},{key:"_addItem",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:-1,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,r=arguments.length>5&&void 0!==arguments[5]&&arguments[5],s=arguments.length>6&&void 0!==arguments[6]?arguments[6]:null,a=Fe("String",e)?e.trim():e,l=s,c=this.store.getItems(),u=t||a,h=parseInt(n,10)||-1,d=i>=0?this.store.getGroupById(i):null,f=c?c.length+1:1;return this.config.prependValue&&(a=this.config.prependValue+a.toString()),this.config.appendValue&&(a+=this.config.appendValue.toString()),this.store.dispatch(St(a,u,f,h,i,o,r,l)),this.isSelectOneElement&&this.removeActiveItems(f),d&&d.value?this.passedElement.triggerEvent(ft.addItem,{id:f,value:a,label:u,groupValue:d.value,keyCode:l}):this.passedElement.triggerEvent(ft.addItem,{id:f,value:a,label:u,keyCode:l}),this}},{key:"_removeItem",value:function(e){if(!e||!Fe("Object",e))return this;var t=e.id,n=e.value,i=e.label,o=e.choiceId,r=e.groupId,s=r>=0?this.store.getGroupById(r):null;return this.store.dispatch(wt(t,o)),s&&s.value?this.passedElement.triggerEvent(ft.removeItem,{id:t,value:n,label:i,groupValue:s.value}):this.passedElement.triggerEvent(ft.removeItem,{id:t,value:n,label:i}),this}},{key:"_addChoice",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=arguments.length>3&&void 0!==arguments[3]&&arguments[3],o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:-1,r=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null,s=arguments.length>6&&void 0!==arguments[6]&&arguments[6],a=arguments.length>7&&void 0!==arguments[7]?arguments[7]:null;if(void 0!==e&&null!==e){var l=this.store.getChoices(),c=t||e,u=l?l.length+1:1,h=this.baseId+"-"+this.idNames.itemChoice+"-"+u;this.store.dispatch(bt(e,c,u,o,i,h,r,s,a)),n&&this._addItem(e,c,u,void 0,r,s,a)}}},{key:"_clearChoices",value:function(){this.store.dispatch(It())}},{key:"_addGroup",value:function(e,t){var n=this,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"value",o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"label",r=Fe("Object",e)?e.choices:Array.from(e.getElementsByTagName("OPTION")),s=t||Math.floor((new Date).valueOf()*Math.random()),a=!!e.disabled&&e.disabled;if(r){this.store.dispatch(kt(e.label,s,!0,a));var l=function(e){var t=e.disabled||e.parentNode&&e.parentNode.disabled;n._addChoice(e[i],Fe("Object",e)?e[o]:e.innerHTML,e.selected,t,s,e.customProperties,e.placeholder)};r.forEach(l)}else this.store.dispatch(kt(e.label,e.id,!1,e.disabled))}},{key:"_getTemplate",value:function(e){var t;if(!e)return null;for(var n=this.config.templates,i=this.config.classNames,o=arguments.length,r=Array(o>1?o-1:0),s=1;sn)return r(e,this.pattern,i);var o=this.options,a=o.location,l=o.distance,c=o.threshold,u=o.findAllMatches,h=o.minMatchCharLength;return s(e,this.pattern,this.patternAlphabet,{location:a,distance:l,threshold:c,findAllMatches:u,minMatchCharLength:h})}}]),e}();e.exports=l},function(e,t,n){"use strict";var i=n(0),o=function e(t,n,o){if(n){var r=n.indexOf("."),s=n,a=null;-1!==r&&(s=n.slice(0,r),a=n.slice(r+1));var l=t[s];if(null!==l&&void 0!==l)if(a||"string"!=typeof l&&"number"!=typeof l)if(i(l))for(var c=0,u=l.length;c0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=[],i=-1,o=-1,r=0,s=e.length;r=t&&n.push([i,o]),i=-1)}return e[r-1]&&r-i>=t&&n.push([i,r-1]),n}},function(e,t,n){"use strict";e.exports=function(e){for(var t={},n=e.length,i=0;i2&&void 0!==arguments[2]?arguments[2]:/ +/g,o=new RegExp(t.replace(i,"\\$&").replace(n,"|")),r=e.match(o),s=!!r,a=[];if(s)for(var l=0,c=r.length;l=P;j-=1){var M=j-1,N=n[e.charAt(M)];if(N&&(_[M]=1),F[j]=(F[j+1]<<1|1)&N,0!==T&&(F[j]|=(O[j+1]|O[j])<<1|1|O[j+1]),F[j]&A&&(k=i(t,{errors:T,currentLocation:M,expectedLocation:m,distance:c}))<=y){if(y=k,(b=M)<=m)break;P=Math.max(1,2*m-b)}}if(i(t,{errors:T+1,currentLocation:m,expectedLocation:m,distance:c})>y)break;O=F}return{isMatch:b>=0,score:0===k?.001:k,matchedIndices:o(_,p)}}},function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var o=function(){function e(e,t){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:"",t=[];if(this.options.tokenize)for(var n=e.split(this.options.tokenSeparator),i=0,o=n.length;i0&&void 0!==arguments[0]?arguments[0]:[],t=arguments[1],n=this.list,i={},o=[];if("string"==typeof n[0]){for(var r=0,s=n.length;r1)throw new Error("Key weight has to be > 0 and <= 1");f=f.name}else a[f]={weight:1};this._analyze({key:f,value:this.options.getFn(u,f),record:u,index:l},{resultMap:i,results:o,tokenSearchers:e,fullSearcher:t})}return{weights:a,results:o}}},{key:"_analyze",value:function(e,t){var n=e.key,i=e.arrayIndex,o=void 0===i?-1:i,r=e.value,s=e.record,l=e.index,c=t.tokenSearchers,u=void 0===c?[]:c,h=t.fullSearcher,d=void 0===h?[]:h,f=t.resultMap,v=void 0===f?{}:f,p=t.results,m=void 0===p?[]:p;if(void 0!==r&&null!==r){var g=!1,y=-1,b=0;if("string"==typeof r){this._log("\nKey: "+(""===n?"-":n));var E=d.search(r);if(this._log('Full text: "'+r+'", score: '+E.score),this.options.tokenize){for(var _=r.split(this.options.tokenSeparator),I=[],S=0;S-1&&(P=(P+y)/2),this._log("Score average:",P);var D=!this.options.tokenize||!this.options.matchAllTokens||b>=u.length;if(this._log("\nCheck Matches: "+D),(g||E.isMatch)&&D){var F=v[l];F?F.output.push({key:n,arrayIndex:o,value:r,score:P,matchedIndices:E.matchedIndices}):(v[l]={item:s,output:[{key:n,arrayIndex:o,value:r,score:P,matchedIndices:E.matchedIndices}]},m.push(v[l]))}}else if(a(r))for(var j=0,M=r.length;j-1&&(s.arrayIndex=r.arrayIndex),t.matches.push(s)}}}),this.options.includeScore&&n.push(function(e,t){t.score=e.score});for(var i=0,o=e.length;i0?1:-1)*Math.floor(Math.abs(t)):t},i=Math.pow(2,53)-1,o=function(e){var t=n(e);return Math.min(Math.max(t,0),i)};return function(e){var n=this,i=Object(e);if(null==e)throw new TypeError("Array.from requires an array-like object - not null or undefined");var r=arguments.length>1?arguments[1]:void 0,s=void 0;if(void 0!==r){if(!t(r))throw new TypeError("Array.from: when provided, the second argument must be a function");arguments.length>2&&(s=arguments[2])}for(var a=o(i.length),l=t(n)?Object(new n(a)):new Array(a),c=0,u=void 0;c>>0,i=arguments[1],o=void 0,r=0;r=0?t:0},t.getElementOffset=function(e,t){var n=t;return n>1&&(n=1),n>0&&(n=0),Math.max(e.offsetHeight*n)},t.getAdjacentEl=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;if(e&&t){var i=e.parentNode.parentNode,r=Array.from(i.querySelectorAll(t));return r[r.indexOf(e)+(n>0?1:-1)]}},t.getScrollPosition=function(e){return"bottom"===e?Math.max((window.scrollY||window.pageYOffset)+(window.innerHeight||document.documentElement.clientHeight)):window.scrollY||window.pageYOffset},t.isInView=function(e,t,n){return this.getScrollPosition(t)>this.getElemDistance(e)+this.getElementOffset(e,n)},t.isScrolledIntoView=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1;if(e){return n>0?t.scrollTop+t.offsetHeight>=e.offsetTop+e.offsetHeight:e.offsetTop>=t.scrollTop}},t.stripHTML=function(e){var t=document.createElement("DIV");return t.innerHTML=e,t.textContent||t.innerText||""},t.addAnimation=function(e,t){var n=a(),i=function i(){e.classList.remove(t),e.removeEventListener(n,i,!1)};e.classList.add(t),e.addEventListener(n,i,!1)},t.getRandomNumber=function(e,t){return Math.floor(Math.random()*(t-e)+e)}),c=t.strToEl=function(){var e=document.createElement("div");return function(t){var n=t.trim(),i=void 0;for(e.innerHTML=n,i=e.children[0];e.firstChild;)e.removeChild(e.firstChild);return i}}();t.getWidthOfInput=function(e){var t=e.value||e.placeholder,n=e.offsetWidth;if(t){var i=c(""+t+" ");if(i.style.position="absolute",i.style.padding="0",i.style.top="-9999px",i.style.left="-9999px",i.style.width="auto",i.style.whiteSpace="pre",document.body.contains(e)&&window.getComputedStyle){var r=window.getComputedStyle(e);r&&(i.style.fontSize=r.fontSize,i.style.fontFamily=r.fontFamily,i.style.fontWeight=r.fontWeight,i.style.fontStyle=r.fontStyle,i.style.letterSpacing=r.letterSpacing,i.style.textTransform=r.textTransform,i.style.padding=r.padding)}document.body.appendChild(i),t&&i.offsetWidth!==e.offsetWidth&&(n=i.offsetWidth+4),document.body.removeChild(i)}return n+"px"},t.sortByAlpha=function(e,t){var n=(e.label||e.value).toLowerCase(),i=(t.label||t.value).toLowerCase();return ni?1:0},t.sortByScore=function(e,t){return e.score-t.score},t.dispatchEvent=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,i=new CustomEvent(t,{detail:n,bubbles:!0,cancelable:!0});return e.dispatchEvent(i)},t.regexFilter=function(e,t){return!(!e||!t)&&new RegExp(t.source,"i").test(e)}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.DEFAULT_CLASSNAMES={containerOuter:"choices",containerInner:"choices__inner",input:"choices__input",inputCloned:"choices__input--cloned",list:"choices__list",listItems:"choices__list--multiple",listSingle:"choices__list--single",listDropdown:"choices__list--dropdown",item:"choices__item",itemSelectable:"choices__item--selectable",itemDisabled:"choices__item--disabled",itemChoice:"choices__item--choice",placeholder:"choices__placeholder",group:"choices__group",groupHeading:"choices__heading",button:"choices__button",activeState:"is-active",focusState:"is-focused",openState:"is-open",disabledState:"is-disabled",highlightedState:"is-highlighted",hiddenState:"is-hidden",flippedState:"is-flipped",loadingState:"is-loading",noResults:"has-no-results",noChoices:"has-no-choices"},t.DEFAULT_CONFIG={silent:!1,renderChoiceLimit:-1,maxItemCount:-1,addItems:!0,removeItems:!0,removeItemButton:!1,editItems:!1,duplicateItems:!0,delimiter:",",paste:!0,searchEnabled:!0,searchChoices:!0,searchFloor:1,searchResultLimit:4,searchFields:["label","value"],position:"auto",resetScrollPosition:!0,regexFilter:null,shouldSort:!0,shouldSortItems:!1,placeholder:!0,placeholderValue:null,searchPlaceholderValue:null,prependValue:null,appendValue:null,renderSelectedChoices:"auto",loadingText:"Loading...",noResultsText:"No results found",noChoicesText:"No choices to choose from",itemSelectText:"Press to select",addItemText:function(e){return'Press Enter to add "'+e+'" '},maxItemText:function(e){return"Only "+e+" values can be added."},uniqueItemText:"Only unique values can be added.",fuseOptions:{includeScore:!0},callbackOnInit:null,callbackOnCreateTemplates:null},t.EVENTS={showDropdown:"showDropdown",hideDropdown:"hideDropdown",change:"change",choice:"choice",search:"search",addItem:"addItem",removeItem:"removeItem",highlightItem:"highlightItem"},t.ACTION_TYPES={ADD_CHOICE:"ADD_CHOICE",FILTER_CHOICES:"FILTER_CHOICES",ACTIVATE_CHOICES:"ACTIVATE_CHOICES",CLEAR_CHOICES:"CLEAR_CHOICES",ADD_GROUP:"ADD_GROUP",ADD_ITEM:"ADD_ITEM",REMOVE_ITEM:"REMOVE_ITEM",HIGHLIGHT_ITEM:"HIGHLIGHT_ITEM",CLEAR_ALL:"CLEAR_ALL"},t.KEY_CODES={BACK_KEY:46,DELETE_KEY:8,ENTER_KEY:13,A_KEY:65,ESC_KEY:27,UP_KEY:38,DOWN_KEY:40,PAGE_UP_KEY:33,PAGE_DOWN_KEY:34},t.SCROLLING_SPEED=4},function(e,t,n){"use strict";function i(e){var t=O.call(e,w),n=e[w];try{e[w]=void 0;var i=!0}catch(e){}var r=C.call(e);return i&&(t?e[w]=n:delete e[w]),r}function r(e){return k.call(e)}function o(e){return null==e?void 0===e?P:x:M&&M in Object(e)?T(e):L(e)}function s(e,t){return function(n){return e(t(n))}}function a(e){return null!=e&&"object"==typeof e}function l(e){if(!B(e)||D(e)!=V)return!1;var t=F(e);if(null===t)return!0;var n=G.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&K.call(n)==Y}function c(e,t,n){function i(){p===f&&(p=f.slice())}function r(){return d}function o(e){if("function"!=typeof e)throw new Error("Expected listener to be a function.");var t=!0;return i(),p.push(e),function(){if(t){t=!1,i();var n=p.indexOf(e);p.splice(n,1)}}}function s(e){if(!U(e))throw new Error("Actions must be plain objects. Use custom middleware for async actions.");if(void 0===e.type)throw new Error('Actions may not have an undefined "type" property. Have you misspelled a constant?');if(v)throw new Error("Reducers may not dispatch actions.");try{v=!0,d=h(d,e)}finally{v=!1}for(var t=f=p,n=0;n0&&void 0!==arguments[0]?arguments[0]:{},t=arguments[1];if(s)throw s;for(var i=!1,r={},a=0;a0&&void 0!==arguments[0]?arguments[0]:"[data-choice]",n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(s(this,e),(0,x.isType)("String",t)){var i=document.querySelectorAll(t);if(i.length>1)for(var r=1;r=1){var n=i._getTemplate("choiceGroup",e);r.appendChild(n),i.renderChoices(t,r,!0)}}),r}},{key:"renderChoices",value:function(e,t){var n=this,i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=t||document.createDocumentFragment(),s=this.config,a=s.renderSelectedChoices,l=s.searchResultLimit,c=s.renderChoiceLimit,u=this.isSearching?x.sortByScore:this.config.sortFilter,h=e;"auto"!==a||this.isSelectOneElement||(h=e.filter(function(e){return!e.selected}));var d=h.reduce(function(e,t){return t.placeholder?e.placeholderChoices.push(t):e.normalChoices.push(t),e},{placeholderChoices:[],normalChoices:[]}),f=d.placeholderChoices,p=d.normalChoices;(this.config.shouldSort||this.isSearching)&&p.sort(u);var v=h.length,m=[].concat(o(f),o(p));this.isSearching?v=l:c>0&&!i&&(v=c);for(var g=0;g1&&void 0!==arguments[1]?arguments[1]:null,i=n||document.createDocumentFragment();if(this.config.shouldSortItems&&!this.isSelectOneElement&&e.sort(this.config.sortFilter),this.isTextElement){var r=this.store.getItemsReducedToValues(e),o=r.join(this.config.delimiter);this.passedElement.setValue(o)}else{var s=document.createDocumentFragment(),a=function(e){var n=t._getTemplate("option",e);s.appendChild(n)};e.forEach(function(e){return a(e)}),this.passedElement.setOptions(s)}var l=function(e){var n=t._getTemplate("item",e,t.config.removeItemButton);i.appendChild(n)};return e.forEach(function(e){return l(e)}),i}},{key:"render",value:function(){if(this.currentState=this.store.getState(),this.currentState.choices!==this.prevState.choices||this.currentState.groups!==this.prevState.groups||this.currentState.items!==this.prevState.items){if(this.isSelectElement){var e=this.store.getGroupsFilteredByActive(),t=this.store.getChoicesFilteredByActive(),n=document.createDocumentFragment();if(this.choiceList.clear(),this.config.resetScrollPosition&&this.choiceList.scrollTo(0),e.length>=1&&!this.isSearching){var i=t.filter(function(e){return!0===e.placeholder&&-1===e.groupId});i.length>=1&&(n=this.renderChoices(i,n)),n=this.renderGroups(e,t,n)}else t.length>=1&&(n=this.renderChoices(t,n));var r=this.store.getItemsFilteredByActive(),o=this._canAddItem(r,this.input.getValue());if(n.childNodes&&n.childNodes.length>0)o.response?(this.choiceList.append(n),this._highlightChoice()):this.choiceList.append(this._getTemplate("notice",o.notice));else{var s=void 0,a=void 0;this.isSearching?(a=(0,x.isType)("Function",this.config.noResultsText)?this.config.noResultsText():this.config.noResultsText,s=this._getTemplate("notice",a,"no-results")):(a=(0,x.isType)("Function",this.config.noChoicesText)?this.config.noChoicesText():this.config.noChoicesText,s=this._getTemplate("notice",a,"no-choices")),this.choiceList.append(s)}}var l=this.store.getItemsFilteredByActive()||[];if(this.itemList.clear(),l.length){var c=this.renderItems(l);c.childNodes&&this.itemList.append(c)}this.prevState=this.currentState}}},{key:"highlightItem",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(!e)return this;var n=e.id,i=e.groupId,r=void 0===i?-1:i,o=e.value,s=void 0===o?"":o,a=e.label,l=void 0===a?"":a,c=r>=0?this.store.getGroupById(r):null;return this.store.dispatch((0,A.highlightItem)(n,!0)),t&&this.passedElement.triggerEvent(C.EVENTS.highlightItem,{id:n,value:s,label:l,groupValue:c&&c.value?c.value:null}),this}},{key:"unhighlightItem",value:function(e){if(!e)return this;var t=e.id,n=e.groupId,i=void 0===n?-1:n,r=e.value,o=void 0===r?"":r,s=e.label,a=void 0===s?"":s,l=i>=0?this.store.getGroupById(i):null;return this.store.dispatch((0,A.highlightItem)(t,!1)),this.passedElement.triggerEvent(C.EVENTS.highlightItem,{id:t,value:o,label:a,groupValue:l&&l.value?l.value:null}),this}},{key:"highlightAll",value:function(){var e=this;return this.store.getItems().forEach(function(t){return e.highlightItem(t)}),this}},{key:"unhighlightAll",value:function(){var e=this;return this.store.getItems().forEach(function(t){return e.unhighlightItem(t)}),this}},{key:"removeItemsByValue",value:function(e){var t=this;return e&&(0,x.isType)("String",e)?(this.store.getItemsFilteredByActive().forEach(function(n){n.value===e&&t._removeItem(n)}),this):this}},{key:"removeActiveItems",value:function(e){var t=this;return this.store.getItemsFilteredByActive().forEach(function(n){n.active&&e!==n.id&&t._removeItem(n)}),this}},{key:"removeHighlightedItems",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this.store.getItemsFilteredByActive().forEach(function(n){n.highlighted&&n.active&&(e._removeItem(n),t&&e._triggerChange(n.value))}),this}},{key:"showDropdown",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this.dropdown.isActive?this:(this.containerOuter.open(this.dropdown.getVerticalPos()),this.dropdown.show(),this.input.activate(e),this.passedElement.triggerEvent(C.EVENTS.showDropdown,{}),this)}},{key:"hideDropdown",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this.dropdown.isActive?(this.containerOuter.close(),this.dropdown.hide(),this.input.deactivate(e),this.passedElement.triggerEvent(C.EVENTS.hideDropdown,{}),this):this}},{key:"toggleDropdown",value:function(){return this.dropdown.isActive?this.hideDropdown():this.showDropdown(!0),this}},{key:"getValue",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=this.store.getItemsFilteredByActive(),n=t.reduce(function(t,n){var i=e?n.value:n;return t.push(i),t},[]);return this.isSelectOneElement?n[0]:n}},{key:"setValue",value:function(e){var t=this;return this.initialised?([].concat(o(e)).forEach(function(e){return t._setChoiceOrItem(e)}),this):this}},{key:"setChoiceByValue",value:function(e){var t=this;return this.isTextElement||!this.initialised?this:(((0,x.isType)("Array",e)?e:[e]).forEach(function(e){return t._findAndSelectChoiceByValue(e)}),this)}},{key:"setChoices",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",n=this,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(!(this.initialised&&this.isSelectElement&&(0,x.isType)("Array",e)&&t))return this;if(r&&this._clearChoices(),e.length){this.containerOuter.removeLoadingState();var o=function(e){e.choices?n._addGroup(e,e.id||null,t,i):n._addChoice(e[t],e[i],e.selected,e.disabled,void 0,e.customProperties,e.placeholder)};e.forEach(o)}return this}},{key:"clearStore",value:function(){return this.store.dispatch((0,L.clearAll)()),this}},{key:"clearInput",value:function(){var e=!this.isSelectOneElement;return this.input.clear(e),!this.isTextElement&&this.config.searchEnabled&&(this.isSearching=!1,this.store.dispatch((0,T.activateChoices)(!0))),this}},{key:"ajax",value:function(e){var t=this;return this.initialised&&this.isSelectElement&&e?(requestAnimationFrame(function(){return t._handleLoadingState(!0)}),e(this._ajaxCallback()),this):this}},{key:"_triggerChange",value:function(e){e&&this.passedElement.triggerEvent(C.EVENTS.change,{value:e})}},{key:"_selectPlaceholderChoice",value:function(){var e=this.store.getPlaceholderChoice();e&&(this._addItem(e.value,e.label,e.id,e.groupId,null,e.placeholder),this._triggerChange(e.value))}},{key:"_handleButtonAction",value:function(e,t){if(e&&t&&this.config.removeItems&&this.config.removeItemButton){var n=t.parentNode.getAttribute("data-id"),i=e.find(function(e){return e.id===parseInt(n,10)});this._removeItem(i),this._triggerChange(i.value),this.isSelectOneElement&&this._selectPlaceholderChoice()}}},{key:"_handleItemAction",value:function(e,t){var n=this,i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(e&&t&&this.config.removeItems&&!this.isSelectOneElement){var r=t.getAttribute("data-id");e.forEach(function(e){e.id!==parseInt(r,10)||e.highlighted?!i&&e.highlighted&&n.unhighlightItem(e):n.highlightItem(e)}),this.input.focus()}}},{key:"_handleChoiceAction",value:function(e,t){if(e&&t){var n=t.getAttribute("data-id"),i=this.store.getChoiceById(n),r=e[0]&&e[0].keyCode?e[0].keyCode:null,o=this.dropdown.isActive;if(i.keyCode=r,this.passedElement.triggerEvent(C.EVENTS.choice,{choice:i}),i&&!i.selected&&!i.disabled){this._canAddItem(e,i.value).response&&(this._addItem(i.value,i.label,i.id,i.groupId,i.customProperties,i.placeholder,i.keyCode),this._triggerChange(i.value))}this.clearInput(),o&&this.isSelectOneElement&&(this.hideDropdown(),this.containerOuter.focus())}}},{key:"_handleBackspace",value:function(e){if(this.config.removeItems&&e){var t=e[e.length-1],n=e.some(function(e){return e.highlighted});this.config.editItems&&!n&&t?(this.input.setValue(t.value),this.input.setWidth(),this._removeItem(t),this._triggerChange(t.value)):(n||this.highlightItem(t,!1),this.removeHighlightedItems(!0))}}},{key:"_handleLoadingState",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=this.itemList.getChild("."+this.config.classNames.placeholder);e?(this.containerOuter.addLoadingState(),this.isSelectOneElement?t?t.innerHTML=this.config.loadingText:(t=this._getTemplate("placeholder",this.config.loadingText),this.itemList.append(t)):this.input.setPlaceholder(this.config.loadingText)):(this.containerOuter.removeLoadingState(),this.isSelectOneElement?t.innerHTML=this.placeholder||"":this.input.setPlaceholder(this.placeholder||""))}},{key:"_canAddItem",value:function(e,t){var n=!0,i=(0,x.isType)("Function",this.config.addItemText)?this.config.addItemText(t):this.config.addItemText;return(this.isSelectMultipleElement||this.isTextElement)&&this.config.maxItemCount>0&&this.config.maxItemCount<=e.length&&(n=!1,i=(0,x.isType)("Function",this.config.maxItemText)?this.config.maxItemText(this.config.maxItemCount):this.config.maxItemText),this.isTextElement&&this.config.addItems&&n&&this.config.regexFilter&&(n=(0,x.regexFilter)(t,this.config.regexFilter)),!e.some(function(e){return(0,x.isType)("String",t)?e.value===t.trim():e.value===t})||this.config.duplicateItems||this.isSelectOneElement||!n||(n=!1,i=(0,x.isType)("Function",this.config.uniqueItemText)?this.config.uniqueItemText(t):this.config.uniqueItemText),{response:n,notice:i}}},{key:"_ajaxCallback",value:function(){var e=this;return function(t,n,i){if(t&&n){var r=(0,x.isType)("Object",t)?[t]:t;r&&(0,x.isType)("Array",r)&&r.length?(e._handleLoadingState(!1),r.forEach(function(t){if(t.choices){var r=t.id||null;e._addGroup(t,r,n,i)}else e._addChoice(t[n],t[i],t.selected,t.disabled,void 0,t.customProperties,t.placeholder)}),e.isSelectOneElement&&e._selectPlaceholderChoice()):e._handleLoadingState(!1)}}}},{key:"_searchChoices",value:function(e){var t=(0,x.isType)("String",e)?e.trim():e,n=(0,x.isType)("String",this.currentValue)?this.currentValue.trim():this.currentValue;if(t.length<1&&t===n+" ")return 0;var i=this.store.getSearchableChoices(),r=t,o=(0,x.isType)("Array",this.config.searchFields)?this.config.searchFields:[this.config.searchFields],s=Object.assign(this.config.fuseOptions,{keys:o}),a=new u.default(i,s),l=a.search(r);return this.currentValue=t,this.highlightPosition=0,this.isSearching=!0,this.store.dispatch((0,T.filterChoices)(l)),l.length}},{key:"_handleSearch",value:function(e){if(e&&this.input.isFocussed){var t=this.store.getChoices(),n=t.some(function(e){return!e.active});if(e&&e.length>=this.config.searchFloor){var i=this.config.searchChoices?this._searchChoices(e):0;this.passedElement.triggerEvent(C.EVENTS.search,{value:e,resultCount:i})}else n&&(this.isSearching=!1,this.store.dispatch((0,T.activateChoices)(!0)))}}},{key:"_addEventListeners",value:function(){document.addEventListener("keyup",this._onKeyUp),document.addEventListener("keydown",this._onKeyDown),document.addEventListener("click",this._onClick),document.addEventListener("touchmove",this._onTouchMove),document.addEventListener("touchend",this._onTouchEnd),document.addEventListener("mousedown",this._onMouseDown),document.addEventListener("mouseover",this._onMouseOver),this.isSelectOneElement&&(this.containerOuter.element.addEventListener("focus",this._onFocus),this.containerOuter.element.addEventListener("blur",this._onBlur)),this.input.element.addEventListener("focus",this._onFocus),this.input.element.addEventListener("blur",this._onBlur),this.input.addEventListeners()}},{key:"_removeEventListeners",value:function(){document.removeEventListener("keyup",this._onKeyUp),document.removeEventListener("keydown",this._onKeyDown),document.removeEventListener("click",this._onClick),document.removeEventListener("touchmove",this._onTouchMove),document.removeEventListener("touchend",this._onTouchEnd),document.removeEventListener("mousedown",this._onMouseDown),document.removeEventListener("mouseover",this._onMouseOver),this.isSelectOneElement&&(this.containerOuter.element.removeEventListener("focus",this._onFocus),this.containerOuter.element.removeEventListener("blur",this._onBlur)),this.input.element.removeEventListener("focus",this._onFocus),this.input.element.removeEventListener("blur",this._onBlur),this.input.removeEventListeners()}},{key:"_onKeyDown",value:function(e){var t,n=this;if(e.target===this.input.element||this.containerOuter.element.contains(e.target)){var i=e.target,o=this.store.getItemsFilteredByActive(),s=this.input.isFocussed,a=this.dropdown.isActive,l=this.itemList.hasChildren,c=String.fromCharCode(e.keyCode),u=C.KEY_CODES.BACK_KEY,h=C.KEY_CODES.DELETE_KEY,d=C.KEY_CODES.ENTER_KEY,f=C.KEY_CODES.A_KEY,p=C.KEY_CODES.ESC_KEY,v=C.KEY_CODES.UP_KEY,m=C.KEY_CODES.DOWN_KEY,g=C.KEY_CODES.PAGE_UP_KEY,y=C.KEY_CODES.PAGE_DOWN_KEY,b=e.ctrlKey||e.metaKey;!this.isTextElement&&/[a-zA-Z0-9-_ ]/.test(c)&&this.showDropdown(!0),this.canSearch=this.config.searchEnabled;var E=function(){b&&l&&(n.canSearch=!1,n.config.removeItems&&!n.input.getValue()&&n.input.element===document.activeElement&&n.highlightAll())},_=function(){if(n.isTextElement&&i.value){var t=n.input.getValue();n._canAddItem(o,t).response&&(n.hideDropdown(),n._addItem(t),n._triggerChange(t),n.clearInput())}if(i.hasAttribute("data-button")&&(n._handleButtonAction(o,i),e.preventDefault()),a){e.preventDefault();var r=n.dropdown.getChild("."+n.config.classNames.highlightedState);r&&(o[0]&&(o[0].keyCode=d),n._handleChoiceAction(o,r))}else n.isSelectOneElement&&(n.showDropdown(!0),e.preventDefault())},S=function(){a&&(n.hideDropdown(),n.containerOuter.focus())},I=function(){if(a||n.isSelectOneElement){n.showDropdown(!0),n.canSearch=!1;var t=e.keyCode===m||e.keyCode===y?1:-1,i=e.metaKey||e.keyCode===y||e.keyCode===g,r=void 0;if(i)r=t>0?Array.from(n.dropdown.element.querySelectorAll("[data-choice-selectable]")).pop():n.dropdown.element.querySelector("[data-choice-selectable]");else{var o=n.dropdown.element.querySelector("."+n.config.classNames.highlightedState);r=o?(0,x.getAdjacentEl)(o,"[data-choice-selectable]",t):n.dropdown.element.querySelector("[data-choice-selectable]")}r&&((0,x.isScrolledIntoView)(r,n.choiceList,t)||n._scrollToChoice(r,t),n._highlightChoice(r)),e.preventDefault()}},O=function(){!s||e.target.value||n.isSelectOneElement||(n._handleBackspace(o),e.preventDefault())},w=(t={},r(t,f,E),r(t,d,_),r(t,p,S),r(t,v,I),r(t,g,I),r(t,m,I),r(t,y,I),r(t,h,O),r(t,u,O),t);w[e.keyCode]&&w[e.keyCode]()}}},{key:"_onKeyUp",value:function(e){if(e.target===this.input.element){var t=this.input.getValue(),n=this.store.getItemsFilteredByActive(),i=this._canAddItem(n,t);if(this.isTextElement)if(t){if(i.notice){var r=this._getTemplate("notice",i.notice);this.dropdown.element.innerHTML=r.outerHTML}!0===i.response?this.showDropdown():i.notice||this.hideDropdown()}else this.hideDropdown();else{var o=C.KEY_CODES.BACK_KEY,s=C.KEY_CODES.DELETE_KEY;e.keyCode!==o&&e.keyCode!==s||e.target.value?this.canSearch&&i.response&&this._handleSearch(this.input.getValue()):!this.isTextElement&&this.isSearching&&(this.isSearching=!1,this.store.dispatch((0,T.activateChoices)(!0)))}this.canSearch=this.config.searchEnabled}}},{key:"_onTouchMove",value:function(){!0===this.wasTap&&(this.wasTap=!1)}},{key:"_onTouchEnd",value:function(e){var t=e.target||e.touches[0].target;!0===this.wasTap&&this.containerOuter.element.contains(t)&&(t!==this.containerOuter.element&&t!==this.containerInner.element||this.isSelectOneElement||(this.isTextElement?this.input.focus():this.showDropdown(!0)),e.stopPropagation()),this.wasTap=!0}},{key:"_onMouseDown",value:function(e){var t=e.target;if(t===this.choiceList&&this.isIe11&&(this.isScrollingOnIe=!0),this.containerOuter.element.contains(t)&&t!==this.input.element){var n=this.store.getItemsFilteredByActive(),i=e.shiftKey,r=(0,x.findAncestorByAttrName)(t,"data-button"),o=(0,x.findAncestorByAttrName)(t,"data-item"),s=(0,x.findAncestorByAttrName)(t,"data-choice");r?this._handleButtonAction(n,r):o?this._handleItemAction(n,o,i):s&&this._handleChoiceAction(n,s),e.preventDefault()}}},{key:"_onMouseOver",value:function(e){(e.target===this.dropdown||this.dropdown.element.contains(e.target))&&e.target.hasAttribute("data-choice")&&this._highlightChoice(e.target)}},{key:"_onClick",value:function(e){var t=e.target,n=this.dropdown.isActive,i=this.store.getItemsFilteredByActive();if(this.containerOuter.element.contains(t))n?this.isSelectOneElement&&t!==this.input.element&&!this.dropdown.element.contains(t)&&this.hideDropdown(!0):this.isTextElement?document.activeElement!==this.input.element&&this.input.focus():this.canSearch?this.showDropdown(!0):(this.showDropdown(),this.containerOuter.focus());else{i.some(function(e){return e.highlighted})&&this.unhighlightAll(),this.containerOuter.removeFocusState(),this.hideDropdown()}}},{key:"_onFocus",value:function(e){var t=this,n=e.target;if(this.containerOuter.element.contains(n)){({text:function(){n===t.input.element&&t.containerOuter.addFocusState()},"select-one":function(){t.containerOuter.addFocusState(),n===t.input.element&&t.showDropdown()},"select-multiple":function(){n===t.input.element&&(t.containerOuter.addFocusState(),t.showDropdown(!0))}})[this.passedElement.element.type]()}}},{key:"_onBlur",value:function(e){var t=this,n=e.target;if(this.containerOuter.element.contains(n)&&!this.isScrollingOnIe){var i=this.store.getItemsFilteredByActive(),r=i.some(function(e){return e.highlighted});({text:function(){n===t.input.element&&(t.containerOuter.removeFocusState(),r&&t.unhighlightAll(),t.hideDropdown())},"select-one":function(){t.containerOuter.removeFocusState(),n===t.containerOuter.element&&(t.canSearch||t.hideDropdown()),n===t.input.element&&t.hideDropdown()},"select-multiple":function(){n===t.input.element&&(t.containerOuter.removeFocusState(),t.hideDropdown(),r&&t.unhighlightAll())}})[this.passedElement.element.type]()}else this.isScrollingOnIe=!1,this.input.element.focus()}},{key:"_scrollToChoice",value:function(e,t){var n=this;if(e){var i=this.choiceList.height,r=e.offsetHeight,o=e.offsetTop+r,s=this.choiceList.scrollPos+i,a=t>0?this.choiceList.scrollPos+o-s:e.offsetTop,l=function e(){var i=C.SCROLLING_SPEED,r=n.choiceList.scrollPos,o=!1,s=void 0,l=void 0;t>0?(s=(a-r)/i,l=s>1?s:1,n.choiceList.scrollTo(r+l),r1?s:1,n.choiceList.scrollTo(r-l),r>a&&(o=!0)),o&&requestAnimationFrame(function(n){e(n,a,t)})};requestAnimationFrame(function(e){l()})}}},{key:"_highlightChoice",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,n=Array.from(this.dropdown.element.querySelectorAll("[data-choice-selectable]")),i=t;if(n&&n.length){var r=Array.from(this.dropdown.element.querySelectorAll("."+this.config.classNames.highlightedState)),o=this.dropdown.isActive;r.forEach(function(t){t.classList.remove(e.config.classNames.highlightedState),t.setAttribute("aria-selected","false")}),i?this.highlightPosition=n.indexOf(i):(i=n.length>this.highlightPosition?n[this.highlightPosition]:n[n.length-1])||(i=n[0]),i.classList.add(this.config.classNames.highlightedState),i.setAttribute("aria-selected","true"),o&&(this.input.setActiveDescendant(i.id),this.containerOuter.setActiveDescendant(i.id))}}},{key:"_addItem",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1,i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:-1,r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null,o=arguments.length>5&&void 0!==arguments[5]&&arguments[5],s=arguments.length>6&&void 0!==arguments[6]?arguments[6]:null,a=(0,x.isType)("String",e)?e.trim():e,l=s,c=this.store.getItems(),u=t||a,h=parseInt(n,10)||-1,d=i>=0?this.store.getGroupById(i):null,f=c?c.length+1:1;return this.config.prependValue&&(a=this.config.prependValue+a.toString()),this.config.appendValue&&(a+=this.config.appendValue.toString()),this.store.dispatch((0,A.addItem)(a,u,f,h,i,r,o,l)),this.isSelectOneElement&&this.removeActiveItems(f),d&&d.value?this.passedElement.triggerEvent(C.EVENTS.addItem,{id:f,value:a,label:u,groupValue:d.value,keyCode:l}):this.passedElement.triggerEvent(C.EVENTS.addItem,{id:f,value:a,label:u,keyCode:l}),this}},{key:"_removeItem",value:function(e){if(!e||!(0,x.isType)("Object",e))return this;var t=e.id,n=e.value,i=e.label,r=e.choiceId,o=e.groupId,s=o>=0?this.store.getGroupById(o):null;return this.store.dispatch((0,A.removeItem)(t,r)),s&&s.value?this.passedElement.triggerEvent(C.EVENTS.removeItem,{id:t,value:n,label:i,groupValue:s.value}):this.passedElement.triggerEvent(C.EVENTS.removeItem,{id:t,value:n,label:i}),this}},{key:"_addChoice",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],i=arguments.length>3&&void 0!==arguments[3]&&arguments[3],r=arguments.length>4&&void 0!==arguments[4]?arguments[4]:-1,o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:null,s=arguments.length>6&&void 0!==arguments[6]&&arguments[6],a=arguments.length>7&&void 0!==arguments[7]?arguments[7]:null;if(void 0!==e&&null!==e){var l=this.store.getChoices(),c=t||e,u=l?l.length+1:1,h=this.baseId+"-"+this.idNames.itemChoice+"-"+u;this.store.dispatch((0,T.addChoice)(e,c,u,r,i,h,o,s,a)),n&&this._addItem(e,c,u,void 0,o,s,a)}}},{key:"_clearChoices",value:function(){this.store.dispatch((0,T.clearChoices)())}},{key:"_addGroup",value:function(e,t){var n=this,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"value",r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"label",o=(0,x.isType)("Object",e)?e.choices:Array.from(e.getElementsByTagName("OPTION")),s=t||Math.floor((new Date).valueOf()*Math.random()),a=!!e.disabled&&e.disabled;if(o){this.store.dispatch((0,k.addGroup)(e.label,s,!0,a));var l=function(e){var t=e.disabled||e.parentNode&&e.parentNode.disabled;n._addChoice(e[i],(0,x.isType)("Object",e)?e[r]:e.innerHTML,e.selected,t,s,e.customProperties,e.placeholder)};o.forEach(l)}else this.store.dispatch((0,k.addGroup)(e.label,e.id,!1,e.disabled))}},{key:"_getTemplate",value:function(e){var t;if(!e)return null;for(var n=this.config.templates,i=this.config.classNames,r=arguments.length,o=Array(r>1?r-1:0),s=1;sn)return o(e,this.pattern,i);var r=this.options,a=r.location,l=r.distance,c=r.threshold,u=r.findAllMatches,h=r.minMatchCharLength;return s(e,this.pattern,this.patternAlphabet,{location:a,distance:l,threshold:c,findAllMatches:u,minMatchCharLength:h})}}]),e}();e.exports=l},function(e,t,n){"use strict";var i=n(0),r=function e(t,n,r){if(n){var o=n.indexOf("."),s=n,a=null;-1!==o&&(s=n.slice(0,o),a=n.slice(o+1));var l=t[s];if(null!==l&&void 0!==l)if(a||"string"!=typeof l&&"number"!=typeof l)if(i(l))for(var c=0,u=l.length;c0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=[],i=-1,r=-1,o=0,s=e.length;o=t&&n.push([i,r]),i=-1)}return e[o-1]&&o-i>=t&&n.push([i,o-1]),n}},function(e,t,n){"use strict";e.exports=function(e){for(var t={},n=e.length,i=0;i2&&void 0!==arguments[2]?arguments[2]:/ +/g,r=new RegExp(t.replace(i,"\\$&").replace(n,"|")),o=e.match(r),s=!!o,a=[];if(s)for(var l=0,c=o.length;l=P;j-=1){var N=j-1,F=n[e.charAt(N)];if(F&&(_[N]=1),D[j]=(D[j+1]<<1|1)&F,0!==k&&(D[j]|=(C[j+1]|C[j])<<1|1|C[j+1]),D[j]&A&&(w=i(t,{errors:k,currentLocation:N,expectedLocation:m,distance:c}))<=y){if(y=w,(b=N)<=m)break;P=Math.max(1,2*m-b)}}if(i(t,{errors:k+1,currentLocation:m,expectedLocation:m,distance:c})>y)break;C=D}return{isMatch:b>=0,score:0===w?.001:w,matchedIndices:r(_,v)}}},function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}var r=function(){function e(e,t){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:"",t=[];if(this.options.tokenize)for(var n=e.split(this.options.tokenSeparator),i=0,r=n.length;i0&&void 0!==arguments[0]?arguments[0]:[],t=arguments[1],n=this.list,i={},r=[];if("string"==typeof n[0]){for(var o=0,s=n.length;o1)throw new Error("Key weight has to be > 0 and <= 1");f=f.name}else a[f]={weight:1};this._analyze({key:f,value:this.options.getFn(u,f),record:u,index:l},{resultMap:i,results:r,tokenSearchers:e,fullSearcher:t})}return{weights:a,results:r}}},{key:"_analyze",value:function(e,t){var n=e.key,i=e.arrayIndex,r=void 0===i?-1:i,o=e.value,s=e.record,l=e.index,c=t.tokenSearchers,u=void 0===c?[]:c,h=t.fullSearcher,d=void 0===h?[]:h,f=t.resultMap,p=void 0===f?{}:f,v=t.results,m=void 0===v?[]:v;if(void 0!==o&&null!==o){var g=!1,y=-1,b=0;if("string"==typeof o){this._log("\nKey: "+(""===n?"-":n));var E=d.search(o);if(this._log('Full text: "'+o+'", score: '+E.score),this.options.tokenize){for(var _=o.split(this.options.tokenSeparator),S=[],I=0;I-1&&(P=(P+y)/2),this._log("Score average:",P);var M=!this.options.tokenize||!this.options.matchAllTokens||b>=u.length;if(this._log("\nCheck Matches: "+M),(g||E.isMatch)&&M){var D=p[l];D?D.output.push({key:n,arrayIndex:r,value:o,score:P,matchedIndices:E.matchedIndices}):(p[l]={item:s,output:[{key:n,arrayIndex:r,value:o,score:P,matchedIndices:E.matchedIndices}]},m.push(p[l]))}}else if(a(o))for(var j=0,N=o.length;j-1&&(s.arrayIndex=o.arrayIndex),t.matches.push(s)}}}),this.options.includeScore&&n.push(function(e,t){t.score=e.score});for(var i=0,r=e.length;i0&&void 0!==arguments[0]?arguments[0]:this.getItems()).reduce(function(e,t){return e.push(t.value),e},[])}},{key:"getChoices",value:function(){return this.store.getState().choices}},{key:"getChoicesFilteredByActive",value:function(){return this.getChoices().filter(function(e){return!0===e.active})}},{key:"getChoicesFilteredBySelectable",value:function(){return this.getChoices().filter(function(e){return!0!==e.disabled})}},{key:"getSearchableChoices",value:function(){return this.getChoicesFilteredBySelectable().filter(function(e){return!0!==e.placeholder})}},{key:"getChoiceById",value:function(e){if(e){return this.getChoicesFilteredByActive().find(function(t){return t.id===parseInt(e,10)})}return!1}},{key:"getPlaceholderChoice",value:function(){return[].concat(i(this.getChoices())).reverse().find(function(e){return!0===e.placeholder})}},{key:"getGroups",value:function(){return this.store.getState().groups}},{key:"getGroupsFilteredByActive",value:function(){var e=this.getGroups(),t=this.getChoices();return e.filter(function(e){var n=!0===e.active&&!1===e.disabled,i=t.some(function(e){return!0===e.active&&!1===e.disabled});return n&&i},[])}},{key:"getGroupById",value:function(e){return this.getGroups().find(function(t){return t.id===parseInt(e,10)})}}]),e}();t.default=c},function(e,t,n){"use strict";(function(e){var n="object"==typeof e&&e&&e.Object===Object&&e;t.a=n}).call(t,n(3))},function(e,t,n){e.exports=n(11)},function(e,t,n){"use strict";(function(e,i){Object.defineProperty(t,"__esModule",{value:!0});var r,o=n(13),s=function(e){return e&&e.__esModule?e:{default:e}}(o);r="undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==e?e:i;var a=(0,s.default)(r);t.default=a}).call(t,n(3),n(12)(e))},function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children||(e.children=[]),Object.defineProperty(e,"loaded",{enumerable:!0,get:function(){return e.l}}),Object.defineProperty(e,"id",{enumerable:!0,get:function(){return e.i}}),e.webpackPolyfill=1),e}},function(e,t,n){"use strict";function i(e){var t,n=e.Symbol;return"function"==typeof n?n.observable?t=n.observable:(t=n("observable"),n.observable=t):t="@@observable",t}Object.defineProperty(t,"__esModule",{value:!0}),t.default=i},function(e,t,n){"use strict";function i(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var r=n(2),o=n(15),s=i(o),a=n(16),l=i(a),c=n(17),u=i(c),h=(0,r.combineReducers)({items:s.default,groups:l.default,choices:u.default}),d=function(e,t){var n=e;return"CLEAR_ALL"===t.type&&(n=void 0),h(n,t)};t.default=d},function(e,t,n){"use strict";function i(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t0&&void 0!==arguments[0]?arguments[0]:o,t=arguments[1];switch(t.type){case"ADD_ITEM":return[].concat(i(e),[{id:t.id,choiceId:t.choiceId,groupId:t.groupId,value:t.value,label:t.label,active:!0,highlighted:!1,customProperties:t.customProperties,placeholder:t.placeholder||!1,keyCode:null}]).map(function(e){var t=e;return t.highlighted&&(t.highlighted=!1),t});case"REMOVE_ITEM":return e.map(function(e){var n=e;return n.id===t.id&&(n.active=!1),n});case"HIGHLIGHT_ITEM":return e.map(function(e){var n=e;return n.id===t.id&&(n.highlighted=t.highlighted),n});default:return e}}Object.defineProperty(t,"__esModule",{value:!0}),t.default=r;var o=t.defaultState=[]},function(e,t,n){"use strict";function i(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t0&&void 0!==arguments[0]?arguments[0]:o,t=arguments[1];switch(t.type){case"ADD_GROUP":return[].concat(i(e),[{id:t.id,value:t.value,active:t.active,disabled:t.disabled}]);case"CLEAR_CHOICES":return[];default:return e}}Object.defineProperty(t,"__esModule",{value:!0}),t.default=r;var o=t.defaultState=[]},function(e,t,n){"use strict";function i(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t0&&void 0!==arguments[0]?arguments[0]:o,t=arguments[1];switch(t.type){case"ADD_CHOICE":return[].concat(i(e),[{id:t.id,elementId:t.elementId,groupId:t.groupId,value:t.value,label:t.label||t.value,disabled:t.disabled||!1,selected:!1,active:!0,score:9999,customProperties:t.customProperties,placeholder:t.placeholder||!1,keyCode:null}]);case"ADD_ITEM":return t.activateOptions?e.map(function(e){var n=e;return n.active=t.active,n}):t.choiceId>-1?e.map(function(e){var n=e;return n.id===parseInt(t.choiceId,10)&&(n.selected=!0),n}):e;case"REMOVE_ITEM":return t.choiceId>-1?e.map(function(e){var n=e;return n.id===parseInt(t.choiceId,10)&&(n.selected=!1),n}):e;case"FILTER_CHOICES":return e.map(function(e){var n=e;return n.active=t.results.some(function(e){var t=e.item,i=e.score;return t.id===n.id&&(n.score=i,!0)}),n});case"ACTIVATE_CHOICES":return e.map(function(e){var n=e;return n.active=t.active,n});case"CLEAR_CHOICES":return o;default:return e}}Object.defineProperty(t,"__esModule",{value:!0}),t.default=r;var o=t.defaultState=[]},function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n=i:"top"===this.config.position&&(r=!0),r}},{key:"setActiveDescendant",value:function(e){this.element.setAttribute("aria-activedescendant",e)}},{key:"removeActiveDescendant",value:function(){this.element.removeAttribute("aria-activedescendant")}},{key:"open",value:function(e){this.element.classList.add(this.classNames.openState),this.element.setAttribute("aria-expanded","true"),this.isOpen=!0,this.shouldFlip(e)&&(this.element.classList.add(this.classNames.flippedState),this.isFlipped=!0)}},{key:"close",value:function(){this.element.classList.remove(this.classNames.openState),this.element.setAttribute("aria-expanded","false"),this.removeActiveDescendant(),this.isOpen=!1,this.isFlipped&&(this.element.classList.remove(this.classNames.flippedState),this.isFlipped=!1)}},{key:"focus",value:function(){this.isFocussed||this.element.focus()}},{key:"addFocusState",value:function(){this.element.classList.add(this.classNames.focusState)}},{key:"removeFocusState",value:function(){this.element.classList.remove(this.classNames.focusState)}},{key:"enable",value:function(){this.element.classList.remove(this.config.classNames.disabledState),this.element.removeAttribute("aria-disabled"),this.parentInstance.isSelectOneElement&&this.element.setAttribute("tabindex","0"),this.isDisabled=!1}},{key:"disable",value:function(){this.element.classList.add(this.config.classNames.disabledState),this.element.setAttribute("aria-disabled","true"),this.parentInstance.isSelectOneElement&&this.element.setAttribute("tabindex","-1"),this.isDisabled=!0}},{key:"revert",value:function(e){this.element.parentNode.insertBefore(e,this.element),this.element.parentNode.removeChild(this.element)}},{key:"addLoadingState",value:function(){this.element.classList.add(this.classNames.loadingState),this.element.setAttribute("aria-busy","true"),this.isLoading=!0}},{key:"removeLoadingState",value:function(){this.element.classList.remove(this.classNames.loadingState),this.element.removeAttribute("aria-busy"),this.isLoading=!1}}]),e}();t.default=o},function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n0&&void 0!==arguments[0])||arguments[0];return this.element.value&&(this.element.value=""),e&&this.setWidth(),this.parentInstance}},{key:"setWidth",value:function(e){this.parentInstance.placeholder?(this.element.value&&this.element.value.length>=this.parentInstance.placeholder.length/1.25||e)&&(this.element.style.width=this.getWidth()):this.element.style.width=this.getWidth()}},{key:"getWidth",value:function(){return(0,o.getWidthOfInput)(this.element)}},{key:"setPlaceholder",value:function(e){this.element.placeholder=e}},{key:"setValue",value:function(e){this.element.value=e}},{key:"getValue",value:function(){return this.element.value}},{key:"setActiveDescendant",value:function(e){this.element.setAttribute("aria-activedescendant",e)}},{key:"removeActiveDescendant",value:function(){this.element.removeAttribute("aria-activedescendant")}}]),e}();t.default=s},function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var r=function(){function e(e,t){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:0;this.element.scrollTop=e}},{key:"append",value:function(e){this.element.appendChild(e)}},{key:"getChild",value:function(e){return this.element.querySelector(e)}}]),e}();t.default=o},function(e,t,n){"use strict";function i(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e,t){if(!e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!t||"object"!=typeof t&&"function"!=typeof t?e:t}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function, not "+typeof t);e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}),t&&(Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t)}Object.defineProperty(t,"__esModule",{value:!0});var s=function(){function e(e,t){for(var n=0;n\n \n ')},containerInner:function(e){return(0,s.strToEl)('\n
\n ')},itemList:function(e,t){var n,r=(0,o.default)(e.list,(n={},i(n,e.listSingle,t),i(n,e.listItems,!t),n));return(0,s.strToEl)('\n
\n ')},placeholder:function(e,t){return(0,s.strToEl)('\n \n '+t+"\n
\n ")},item:function(e,t,n){var r,a=t.active?'aria-selected="true"':"",l=t.disabled?'aria-disabled="true"':"",c=(0,o.default)(e.item,(r={},i(r,e.highlightedState,t.highlighted),i(r,e.itemSelectable,!t.highlighted),i(r,e.placeholder,t.placeholder),r));if(n){var u;return c=(0,o.default)(e.item,(u={},i(u,e.highlightedState,t.highlighted),i(u,e.itemSelectable,!t.disabled),i(u,e.placeholder,t.placeholder),u)),(0,s.strToEl)('\n \n "+t.label+'\x3c!--\n --\x3e\n Remove item\n \n
\n ")}return(0,s.strToEl)('\n \n "+t.label+"\n
\n ")},choiceList:function(e,t){var n=t?"":'aria-multiselectable="true"';return(0,s.strToEl)('\n \n
\n ")},choiceGroup:function(e,t){var n=t.disabled?'aria-disabled="true"':"",r=(0,o.default)(e.group,i({},e.itemDisabled,t.disabled));return(0,s.strToEl)('\n \n ")},choice:function(e,t,n){var r,a=t.groupId>0?'role="treeitem"':'role="option"',l=(0,o.default)(e.item,e.itemChoice,(r={},i(r,e.itemDisabled,t.disabled),i(r,e.itemSelectable,!t.disabled),i(r,e.placeholder,t.placeholder),r));return(0,s.strToEl)('\n \n "+t.label+"\n
\n ")},input:function(e){var t=(0,o.default)(e.input,e.inputCloned);return(0,s.strToEl)('\n \n ')},dropdown:function(e){var t=(0,o.default)(e.list,e.listDropdown);return(0,s.strToEl)('\n \n
\n ')},notice:function(e,t){var n,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",a=(0,o.default)(e.item,e.itemChoice,(n={},i(n,e.noResults,"no-results"===r),i(n,e.noChoices,"no-choices"===r),n));return(0,s.strToEl)('\n \n '+t+"\n
\n ")},option:function(e,t){return(0,s.strToEl)('\n '+t.label+" \n ")}};t.default=a},function(e,t,n){var i,r;!function(){"use strict";function n(){for(var e=[],t=0;t0&&void 0!==arguments[0])||arguments[0];return{type:i.ACTION_TYPES.ACTIVATE_CHOICES,active:e}},t.clearChoices=function(){return{type:i.ACTION_TYPES.CLEAR_CHOICES}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.highlightItem=t.removeItem=t.addItem=void 0;var i=n(1);t.addItem=function(e,t,n,r,o,s,a,l){return{type:i.ACTION_TYPES.ADD_ITEM,value:e,label:t,id:n,choiceId:r,groupId:o,customProperties:s,placeholder:a,keyCode:l}},t.removeItem=function(e,t){return{type:i.ACTION_TYPES.REMOVE_ITEM,id:e,choiceId:t}},t.highlightItem=function(e,t){return{type:i.ACTION_TYPES.HIGHLIGHT_ITEM,id:e,highlighted:t}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.addGroup=void 0;var i=n(1);t.addGroup=function(e,t,n,r){return{type:i.ACTION_TYPES.ADD_GROUP,value:e,id:t,active:n,disabled:r}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});t.clearAll=function(){return{type:"CLEAR_ALL"}}},function(e,t,n){"use strict";!function(){function e(e,t){t=t||{bubbles:!1,cancelable:!1,detail:void 0};var n=document.createEvent("CustomEvent");return n.initCustomEvent(e,t.bubbles,t.cancelable,t.detail),n}Array.from||(Array.from=function(){var e=Object.prototype.toString,t=function(t){return"function"==typeof t||"[object Function]"===e.call(t)},n=function(e){var t=Number(e);return isNaN(t)?0:0!==t&&isFinite(t)?(t>0?1:-1)*Math.floor(Math.abs(t)):t},i=Math.pow(2,53)-1,r=function(e){var t=n(e);return Math.min(Math.max(t,0),i)};return function(e){var n=this,i=Object(e);if(null==e)throw new TypeError("Array.from requires an array-like object - not null or undefined");var o=arguments.length>1?arguments[1]:void 0,s=void 0;if(void 0!==o){if(!t(o))throw new TypeError("Array.from: when provided, the second argument must be a function");arguments.length>2&&(s=arguments[2])}for(var a=r(i.length),l=t(n)?Object(new n(a)):new Array(a),c=0,u=void 0;c>>0,i=arguments[1],r=void 0,o=0;o {
const minimize = !!(env && env.minimize);
@@ -10,7 +11,7 @@ module.exports = (env) => {
const config = {
devtool: minimize ? false : 'cheap-module-source-map',
entry: [
- './src/scripts/src/choices'
+ './src/scripts/src/choices',
],
output: {
path: path.join(__dirname, '/src/scripts/dist'),
@@ -18,30 +19,44 @@ module.exports = (env) => {
publicPath: '/src/scripts/dist/',
library: 'Choices',
libraryTarget: 'umd',
+ auxiliaryComment: {
+ root: 'Window',
+ commonjs: 'CommonJS',
+ commonjs2: 'CommonJS2',
+ amd: 'AMD',
+ },
},
plugins: [
new webpack.optimize.ModuleConcatenationPlugin(),
new webpack.DefinePlugin({
'process.env': {
// This has effect on the react lib size
- 'NODE_ENV': JSON.stringify('production'),
- }
+ NODE_ENV: JSON.stringify('production'),
+ },
}),
- new wrapperPlugin({
+ new WrapperPlugin({
header: banner,
}),
],
module: {
- rules: [{
- test: /\.js$/,
- exclude: /(node_modules|bower_components)/,
- loader: 'babel-loader',
- include: path.join(__dirname, 'src/scripts/src'),
- options: {
- babelrc: false,
- presets: [['es2015', { modules: false }], 'stage-2'],
+ rules: [
+ {
+ enforce: 'pre',
+ test: /\.js?$/,
+ include: path.join(__dirname, 'src/scripts/src'),
+ exclude: /(node_modules|bower_components)/,
+ loader: 'eslint-loader',
+ query: {
+ configFile: '.eslintrc',
+ },
},
- }],
+ {
+ test: /\.js?$/,
+ include: path.join(__dirname, 'src/scripts/src'),
+ exclude: /(node_modules|bower_components)/,
+ loader: 'babel-loader',
+ },
+ ],
},
};
@@ -50,12 +65,12 @@ module.exports = (env) => {
sourceMap: false,
mangle: true,
output: {
- comments: false
+ comments: false,
},
compress: {
warnings: false,
- screw_ie8: true
- }
+ screw_ie8: true,
+ },
}));
}