Choices/src/scripts/dist/choices.min.js
2017-11-13 19:13:37 +00:00

2 lines
77 KiB
JavaScript

/*! 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;n<t.length;n++){(0,t[n])()}return e}function a(e){if("function"!=typeof e)throw new Error("Expected the nextReducer to be a function.");h=e,s({type:ve.INIT})}function l(){var e,t=r;return e={subscribe:function(e){function n(){e.next&&e.next(o())}if("object"!=typeof e)throw new TypeError("Expected the observer to be an object.");return n(),{unsubscribe:t(n)}}},e[fe.a]=function(){return this},e}var u;if("function"==typeof t&&void 0===n&&(n=t,t=void 0),void 0!==n){if("function"!=typeof n)throw new Error("Expected the enhancer to be a function.");return n(c)(e,t)}if("function"!=typeof e)throw new Error("Expected the reducer to be a function.");var h=e,d=t,f=[],v=f,p=!1;return s({type:ve.INIT}),u={dispatch:s,subscribe:r,getState:o,replaceReducer:a},u[fe.a]=l,u}function u(e,t){var n=t&&t.type;return"Given action "+(n&&'"'+n.toString()+'"'||"an action")+', reducer "'+e+'" 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.'}function h(e){Object.keys(e).forEach(function(t){var n=e[t];if(void 0===n(void 0,{type:ve.INIT}))throw new Error('Reducer "'+t+"\" 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.");if(void 0===n(void 0,{type:"@@redux/PROBE_UNKNOWN_ACTION_"+Math.random().toString(36).substring(7).split("").join(".")}))throw new Error('Reducer "'+t+"\" returned undefined when probed with a random type. Don't try to handle "+ve.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.')})}function d(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}function f(){var e=arguments.length>0&&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);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}function p(){var e=arguments.length>0&&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);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}function g(){var e=arguments.length>0&&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);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}function b(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function E(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function _(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function I(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function S(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function w(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function O(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function k(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 C(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)}function A(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function T(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 L(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)}function x(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function P(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function D(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t<e.length;t++)n[t]=e[t];return n}return Array.from(e)}function F(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var j=n(3),M=n.n(j),N=n(4),B="object"==typeof self&&self&&self.Object===Object&&self,H=N.a||B||Function("return this")(),V=H,R=V.Symbol,K=R,G=Object.prototype,Y=G.hasOwnProperty,q=G.toString,W=K?K.toStringTag:void 0,U=i,z=Object.prototype,$=z.toString,J=o,Z="[object Null]",Q="[object Undefined]",X=K?K.toStringTag:void 0,ee=r,te=s,ne=te(Object.getPrototypeOf,Object),ie=ne,oe=a,re="[object Object]",se=Function.prototype,ae=Object.prototype,le=se.toString,ce=ae.hasOwnProperty,ue=le.call(Object),he=l,de=n(5),fe=n.n(de),ve={INIT:"@@redux/INIT"},pe=(Object.assign,[]),me=[],ge=[],ye=function(e){for(var t=Object.keys(e),n={},i=0;i<t.length;i++){var o=t[i];"function"==typeof e[o]&&(n[o]=e[o])}var r=Object.keys(n),s=void 0;try{h(n)}catch(e){s=e}return function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments[1];if(s)throw s;for(var i=!1,o={},a=0;a<r.length;a++){var l=r[a],c=n[l],h=e[l],d=c(h,t);if(void 0===d){var f=u(l,t);throw new Error(f)}o[l]=d,i=i||d!==h}return i?o:e}}({items:f,groups:p,choices:g}),be=function(e,t){var n=e;return"CLEAR_ALL"===t.type&&(n=void 0),ye(n,t)},Ee=be,_e=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),Ie=function(){function e(){b(this,e),this.store=c(Ee,window.devToolsExtension?window.devToolsExtension():void 0)}return _e(e,[{key:"subscribe",value:function(e){this.store.subscribe(e)}},{key:"dispatch",value:function(e){this.store.dispatch(e)}},{key:"getState",value:function(){return this.store.getState()}},{key:"getItems",value:function(){return this.store.getState().items}},{key:"getItemsFilteredByActive",value:function(){return this.getItems().filter(function(e){return!0===e.active},[])}},{key:"getItemsReducedToValues",value:function(){return(arguments.length>0&&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<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),Oe=function(){function e(t,n,i){E(this,e),this.parentInstance=t,this.element=n,this.classNames=i,this.dimensions=null,this.position=null,this.isActive=!1}return we(e,[{key:"getElement",value:function(){return this.element}},{key:"getVerticalPos",value:function(){return this.dimensions=this.element.getBoundingClientRect(),this.position=Math.ceil(this.dimensions.top+window.pageYOffset+this.element.offsetHeight),this.position}},{key:"getChild",value:function(e){return this.element.querySelector(e)}},{key:"show",value:function(){return this.element.classList.add(this.classNames.activeState),this.element.setAttribute("aria-expanded","true"),this.isActive=!0,this.parentInstance}},{key:"hide",value:function(){return this.element.classList.remove(this.classNames.activeState),this.element.setAttribute("aria-expanded","false"),this.isActive=!1,this.parentInstance}}]),e}(),ke=Oe,Ce=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),Ae=function(){function e(t,n,i){_(this,e),this.parentInstance=t,this.element=n,this.classNames=i,this.config=t.config,this.isOpen=!1,this.isFlipped=!1,this.isFocussed=!1,this.isDisabled=!1,this.isLoading=!1,this.onFocus=this.onFocus.bind(this),this.onBlur=this.onBlur.bind(this)}return Ce(e,[{key:"getElement",value:function(){return this.element}},{key:"addEventListeners",value:function(){this.element.addEventListener("focus",this.onFocus),this.element.addEventListener("blur",this.onBlur)}},{key:"removeEventListeners",value:function(){this.element.removeEventListener("focus",this.onFocus),this.element.removeEventListener("blur",this.onBlur)}},{key:"onFocus",value:function(){this.isFocussed=!0}},{key:"onBlur",value:function(){this.isFocussed=!1}},{key:"shouldFlip",value:function(e){if(void 0===e)return!1;var t=document.body,n=document.documentElement,i=Math.max(t.scrollHeight,t.offsetHeight,n.clientHeight,n.scrollHeight,n.offsetHeight),o=!1;return"auto"===this.config.position?o=e>=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;n<e;n++){t+=Re(0,36).toString(36)}return t},Pe=function(e,t){var n=e.id||e.name&&e.name+"-"+xe(2)||xe(4);return n=n.replace(/(:|\.|\[|\]|,)/g,""),n=t+n},De=function(e){return Object.prototype.toString.call(e).slice(8,-1)},Fe=function(e,t){var n=De(t);return void 0!==t&&null!==t&&n===e},je=function(e){return"object"===("undefined"==typeof HTMLElement?"undefined":Le(HTMLElement))?e instanceof HTMLElement:e&&"object"===(void 0===e?"undefined":Le(e))&&null!==e&&1===e.nodeType&&"string"==typeof e.nodeName},Me=function e(){for(var t={},n=arguments.length,i=0;i<n;i++){var o=arguments[i];Fe("Object",o)&&function(n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(Fe("Object",n[i])?t[i]=e(!0,t[i],n[i]):t[i]=n[i])}(o)}return t},Ne=function(e,t){return t=t||document.createElement("div"),e.nextSibling?e.parentNode.insertBefore(t,e.nextSibling):e.parentNode.appendChild(t),t.appendChild(e)},Be=function(e,t){for(var n=e;n;){if(n.hasAttribute(t))return n;n=n.parentElement}return null},He=function(e,t){var n=arguments.length>2&&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("<span>"+t+"</span>");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 n<i?-1:n>i?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;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),$e=function(){function e(t,n,i){I(this,e),this.parentInstance=t,this.element=n,this.classNames=i,this.isFocussed=this.element===document.activeElement,this.isDisabled=!1,this.onPaste=this.onPaste.bind(this),this.onInput=this.onInput.bind(this),this.onFocus=this.onFocus.bind(this),this.onBlur=this.onBlur.bind(this)}return ze(e,[{key:"getElement",value:function(){return this.element}},{key:"addEventListeners",value:function(){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(){this.element.removeEventListener("input",this.onInput),this.element.removeEventListener("paste",this.onPaste),this.element.removeEventListener("focus",this.onFocus),this.element.removeEventListener("blur",this.onBlur)}},{key:"onInput",value:function(){this.parentInstance.isSelectOneElement||this.setWidth()}},{key:"onPaste",value:function(e){e.target!==this.element||this.parentInstance.config.paste||e.preventDefault()}},{key:"onFocus",value:function(){this.isFocussed=!0}},{key:"onBlur",value:function(){this.isFocussed=!1}},{key:"activate",value:function(e){e&&this.parentInstance.canSearch&&document.activeElement!==this.element&&this.element.focus()}},{key:"deactivate",value:function(e){this.removeActiveDescendant(),e&&this.parentInstance.canSearch&&document.activeElement===this.element&&this.element.blur()}},{key:"enable",value:function(){this.element.removeAttribute("disabled"),this.isDisabled=!1}},{key:"disable",value:function(){this.element.setAttribute("disabled",""),this.isDisabled=!0}},{key:"focus",value:function(){this.isFocussed||this.element.focus()}},{key:"clear",value:function(){var e=!(arguments.length>0&&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;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),Qe=function(){function e(t,n,i){S(this,e),this.parentInstance=t,this.element=n,this.classNames=i,this.scrollPos=this.element.scrollTop,this.height=this.element.offsetHeight,this.hasChildren=!!this.element.children}return Ze(e,[{key:"getElement",value:function(){return this.element}},{key:"clear",value:function(){this.element.innerHTML=""}},{key:"scrollTo",value:function(){var e=arguments.length>0&&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<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),tt=function(){function e(t,n,i){w(this,e),this.parentInstance=t,this.element=n,this.classNames=i,this.isDisabled=!1}return et(e,[{key:"getElement",value:function(){return this.element}},{key:"getValue",value:function(){return this.element.value}},{key:"conceal",value:function(){this.element.classList.add(this.classNames.input,this.classNames.hiddenState),this.element.tabIndex="-1";var e=this.element.getAttribute("style");e&&this.element.setAttribute("data-choice-orig-style",e),this.element.setAttribute("style","display:none;"),this.element.setAttribute("aria-hidden","true"),this.element.setAttribute("data-choice","active")}},{key:"reveal",value:function(){this.element.classList.remove(this.classNames.input,this.classNames.hiddenState),this.element.removeAttribute("tabindex");var e=this.element.getAttribute("data-choice-orig-style");e?(this.element.removeAttribute("data-choice-orig-style"),this.element.setAttribute("style",e)):this.element.removeAttribute("style"),this.element.removeAttribute("aria-hidden"),this.element.removeAttribute("data-choice"),this.element.value=this.element.value}},{key:"enable",value:function(){this.element.removeAttribute("disabled"),this.element.disabled=!1,this.isDisabled=!1}},{key:"disable",value:function(){this.element.setAttribute("disabled",""),this.element.disabled=!0,this.isDisabled=!0}},{key:"triggerEvent",value:function(e,t){We(this.element,e,t)}}]),e}(),nt=tt,it=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),ot=function e(t,n,i){null===t&&(t=Function.prototype);var o=Object.getOwnPropertyDescriptor(t,n);if(void 0===o){var r=Object.getPrototypeOf(t);return null===r?void 0:e(r,n,i)}if("value"in o)return o.value;var s=o.get;if(void 0!==s)return s.call(i)},rt=function(e){function t(e,n,i){O(this,t);var o=k(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n,i));return o.parentInstance=e,o.element=n,o.classNames=i,o}return C(t,e),it(t,[{key:"getElement",value:function(){ot(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"getElement",this).call(this)}},{key:"conceal",value:function(){ot(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"conceal",this).call(this)}},{key:"reveal",value:function(){ot(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"reveal",this).call(this)}},{key:"enable",value:function(){ot(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"enable",this).call(this)}},{key:"disable",value:function(){ot(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"enable",this).call(this)}},{key:"setValue",value:function(e){this.element.setAttribute("value",e),this.element.value=e}}]),t}(nt),st=rt,at=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),lt=function e(t,n,i){null===t&&(t=Function.prototype);var o=Object.getOwnPropertyDescriptor(t,n);if(void 0===o){var r=Object.getPrototypeOf(t);return null===r?void 0:e(r,n,i)}if("value"in o)return o.value;var s=o.get;if(void 0!==s)return s.call(i)},ct=function(e){function t(e,n,i){A(this,t);var o=T(this,(t.__proto__||Object.getPrototypeOf(t)).call(this,e,n,i));return o.parentInstance=e,o.element=n,o.classNames=i,o}return L(t,e),at(t,[{key:"getElement",value:function(){lt(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"getElement",this).call(this)}},{key:"conceal",value:function(){lt(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"conceal",this).call(this)}},{key:"reveal",value:function(){lt(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"reveal",this).call(this)}},{key:"enable",value:function(){lt(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"enable",this).call(this)}},{key:"disable",value:function(){lt(t.prototype.__proto__||Object.getPrototypeOf(t.prototype),"enable",this).call(this)}},{key:"setOptions",value:function(e){this.element.innerHTML="",this.element.appendChild(e)}},{key:"getPlaceholderOption",value:function(){return this.element.querySelector("option[placeholder]")}},{key:"getOptions",value:function(){return Array.from(this.element.options)}},{key:"getOptionGroups",value:function(){return Array.from(this.element.getElementsByTagName("OPTGROUP"))}}]),t}(nt),ut=ct,ht={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"},dt={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 <b>"'+e+'"</b>'},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 <div\n class="'+e.containerOuter+'"\n data-type="'+r+'"\n '+a+"\n "+s+"\n "+l+'\n aria-haspopup="true"\n aria-expanded="false"\n dir="'+t+'"\n >\n </div>\n ')},containerInner:function(e){return Ke('\n <div class="'+e.containerInner+'"></div>\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 <div class="'+i+'"></div>\n ')},placeholder:function(e,t){return Ke('\n <div class="'+e.placeholder+'">\n '+t+"\n </div>\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 <div\n class="'+s+'"\n data-item\n data-id="'+t.id+'"\n data-value="'+t.value+'"\n data-deletable\n '+o+"\n "+r+"\n >\n "+t.label+'\x3c!--\n --\x3e<button\n type="button"\n class="'+e.button+'"\n data-button\n aria-label="Remove item: \''+t.value+"'\"\n >\n Remove item\n </button>\n </div>\n ")}return Ke('\n <div\n class="'+s+'"\n data-item\n data-id="'+t.id+'"\n data-value="'+t.value+'"\n '+o+"\n "+r+"\n >\n "+t.label+"\n </div>\n ")},choiceList:function(e,t){var n=t?"":'aria-multiselectable="true"';return Ke('\n <div\n class="'+e.list+'"\n dir="ltr"\n role="listbox"\n '+n+"\n >\n </div>\n ")},choiceGroup:function(e,t){var n=t.disabled?'aria-disabled="true"':"",i=gt()(e.group,x({},e.itemDisabled,t.disabled));return Ke('\n <div\n class="'+i+'"\n data-group\n data-id="'+t.id+'"\n data-value="'+t.value+'"\n role="group"\n '+n+'\n >\n <div class="'+e.groupHeading+'">'+t.value+"</div>\n </div>\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 <div\n class="'+r+'"\n data-select-text="'+n+'"\n data-choice\n data-id="'+t.id+'"\n data-value="'+t.value+'"\n '+(t.disabled?'data-choice-disabled aria-disabled="true"':"data-choice-selectable")+'\n id="'+t.elementId+'"\n '+o+"\n >\n "+t.label+"\n </div>\n ")},input:function(e){var t=gt()(e.input,e.inputCloned);return Ke('\n <input\n type="text"\n class="'+t+'"\n autocomplete="off"\n autocapitalize="off"\n spellcheck="false"\n role="textbox"\n aria-autocomplete="list"\n >\n ')},dropdown:function(e){var t=gt()(e.list,e.listDropdown);return Ke('\n <div\n class="'+t+'"\n aria-expanded="false"\n >\n </div>\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 <div class="'+o+'">\n '+t+"\n </div>\n ")},option:function(e,t){return Ke('\n <option value="'+t.value+'" selected>'+t.label+"</option>\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;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e}),Tt=function(){function e(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),Lt=function(){function e(){var t=arguments.length>0&&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<i.length;o+=1){var r=i[o];new e(r,n)}}var s=At({},dt,{items:[],choices:[],classNames:ht,sortFilter:Ye});this.config=Me(s,e.userDefaults,n),["auto","always"].includes(this.config.renderSelectedChoices)||(this.config.renderSelectedChoices="auto"),this.store=new Se(this.render),this.initialised=!1,this.currentState={},this.prevState={},this.currentValue="";var a=Fe("String",t)?document.querySelector(t):t;if(this.isTextElement="text"===a.type,this.isSelectOneElement="select-one"===a.type,this.isSelectMultipleElement="select-multiple"===a.type,this.isSelectElement=this.isSelectOneElement||this.isSelectMultipleElement,this.isValidElementType=this.isTextElement||this.isSelectElement,this.isTextElement?this.passedElement=new st(this,a,this.config.classNames):this.isSelectElement&&(this.passedElement=new ut(this,a,this.config.classNames)),!this.passedElement)return this.config.silent||console.error("Passed element not found"),!1;if(this.isIe11=!(!navigator.userAgent.match(/Trident/)||!navigator.userAgent.match(/rv[ :]11/)),this.isScrollingOnIe=!1,!0===this.config.shouldSortItems&&this.isSelectOneElement&&(this.config.silent||console.warn("shouldSortElements: Type of passed element is 'select-one', falling back to false.")),this.highlightPosition=0,this.canSearch=this.config.searchEnabled,this.placeholder=!1,this.isSelectOneElement||(this.placeholder=!!this.config.placeholder&&(this.config.placeholderValue||this.passedElement.element.getAttribute("placeholder"))),this.presetChoices=this.config.choices,this.presetItems=this.config.items,this.passedElement.getValue()&&(this.presetItems=this.presetItems.concat(this.passedElement.getValue().split(this.config.delimiter))),this.baseId=Pe(this.passedElement.element,"choices-"),this.idNames={itemChoice:"item-choice"},this.render=this.render.bind(this),this._onFocus=this._onFocus.bind(this),this._onBlur=this._onBlur.bind(this),this._onKeyUp=this._onKeyUp.bind(this),this._onKeyDown=this._onKeyDown.bind(this),this._onClick=this._onClick.bind(this),this._onTouchMove=this._onTouchMove.bind(this),this._onTouchEnd=this._onTouchEnd.bind(this),this._onMouseDown=this._onMouseDown.bind(this),this._onMouseOver=this._onMouseOver.bind(this),this.wasTap=!0,"classList"in document.documentElement||this.config.silent||console.error("Choices: Your browser doesn't support Choices"),je(this.passedElement.element)&&this.isValidElementType){if("active"===this.passedElement.element.getAttribute("data-choice"))return!1;this.init()}else this.config.silent||console.error("Incompatible input passed")}return Tt(e,[{key:"init",value:function(){if(!this.initialised){this.initialised=!0,this._createTemplates(),this._createStructure(),this.store.subscribe(this.render),this.render(),this._addEventListeners();var e=this.config.callbackOnInit;e&&Fe("Function",e)&&e.call(this)}}},{key:"destroy",value:function(){this.initialised&&(this._removeEventListeners(),this.passedElement.reveal(),this.containerOuter.revert(this.passedElement.element),this.clearStore(),this.config.templates=null,this.initialised=!1)}},{key:"enable",value:function(){return this.initialised?(this.passedElement.enable(),this.containerOuter.isDisabled&&(this._addEventListeners(),this.input.enable(),this.containerOuter.enable()),this):this}},{key:"disable",value:function(){return this.initialised?(this.passedElement.disable(),this.containerOuter.isDisabled||(this._removeEventListeners(),this.input.disable(),this.containerOuter.disable()),this):this}},{key:"renderGroups",value:function(e,t,n){var i=this,o=n||document.createDocumentFragment(),r=this.config.sortFilter,s=function(e){return t.filter(function(t){return i.isSelectOneElement?t.groupId===e.id:t.groupId===e.id&&("always"===i.config.renderSelectedChoices||!t.selected)})};return this.config.shouldSort&&e.sort(r),e.forEach(function(e){var t=s(e);if(t.length>=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;m<v;m+=1)p[m]&&function(e){if("auto"!==s||(n.isSelectOneElement||!e.selected)){var t=n._getTemplate("choice",e,n.config.itemSelectText);o.appendChild(t)}}(p[m]);return o}},{key:"renderItems",value:function(e){var t=this,n=arguments.length>1&&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),i<a&&(o=!0)):(r=(i-a)/4,s=r>1?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;s<o;s++)r[s-1]=arguments[s];return(t=n[e]).call.apply(t,[this,i].concat(r))}},{key:"_createTemplates",value:function(){var e=this.config.callbackOnCreateTemplates,t={};e&&Fe("Function",e)&&(t=e.call(this,Ke)),this.config.templates=Me(yt,t)}},{key:"_createStructure",value:function(){var e=this.passedElement.element.getAttribute("dir")||"ltr",t=this._getTemplate("containerOuter",e,this.isSelectElement,this.isSelectOneElement,this.config.searchEnabled,this.passedElement.element.type),n=this._getTemplate("containerInner"),i=this._getTemplate("itemList",this.isSelectOneElement),o=this._getTemplate("choiceList",this.isSelectOneElement),r=this._getTemplate("input"),s=this._getTemplate("dropdown");this.containerOuter=new Te(this,t,this.config.classNames),this.containerInner=new Te(this,n,this.config.classNames),this.input=new Je(this,r,this.config.classNames),this.choiceList=new Xe(this,o,this.config.classNames),this.itemList=new Xe(this,i,this.config.classNames),this.dropdown=new ke(this,s,this.config.classNames),this.passedElement.conceal(),Ne(this.passedElement.element,this.containerInner.element),Ne(this.containerInner.element,this.containerOuter.element),this.isSelectOneElement?this.input.setPlaceholder(this.config.searchPlaceholderValue||""):this.placeholder&&(this.input.setPlaceholder(this.placeholder),this.input.setWidth(!0)),this.config.addItems||this.disable(),this.containerOuter.element.appendChild(this.containerInner.element),this.containerOuter.element.appendChild(this.dropdown.element),this.containerInner.element.appendChild(i),this.isTextElement||s.appendChild(o),this.isSelectOneElement?this.canSearch&&s.insertBefore(r,s.firstChild):this.containerInner.element.appendChild(this.input.element),this.isSelectElement?this._addPredefinedChoices():this.isTextElement&&this._addPredefinedItems()}},{key:"_addPredefinedChoices",value:function(){var e=this,t=this.passedElement.getOptionGroups();if(this.highlightPosition=0,this.isSearching=!1,t&&t.length){var n=this.passedElement.getPlaceholderOption();n&&"SELECT"===n.parentNode.tagName&&this._addChoice(n.value,n.innerHTML,n.selected,n.disabled,void 0,void 0,!0),t.forEach(function(t){e._addGroup(t,t.id||null)})}else{var i=this.passedElement.getOptions(),o=this.config.sortFilter,r=this.presetChoices;i.forEach(function(e){r.push({value:e.value,label:e.innerHTML,selected:e.selected,disabled:e.disabled||e.parentNode.disabled,placeholder:e.hasAttribute("placeholder")})}),this.config.shouldSort&&r.sort(o);var s=r.some(function(e){return e.selected}),a=function(t,n){if(e.isSelectElement)if(t.choices)e._addGroup(t,t.id||null);else{var i=e.isSelectOneElement&&!s&&0===n,o=!!i||t.selected,r=!i&&t.disabled;e._addChoice(t.value,t.label,o,r,void 0,t.customProperties,t.placeholder)}else e._addChoice(t.value,t.label,t.selected,t.disabled,void 0,t.customProperties,t.placeholder)};r.forEach(function(e,t){return a(e,t)})}}},{key:"_addPredefinedItems",value:function(){var e=this,t=function(t){var n=De(t);if("Object"===n){if(!t.value)return;e._addItem(t.value,t.label,t.id,void 0,t.customProperties,t.placeholder)}else"String"===n&&e._addItem(t)};this.presetItems.forEach(function(e){return t(e)})}},{key:"_setChoiceOrItem",value:function(e){var t=this,n=De(e).toLowerCase();({object:function(){e.value&&(t.isTextElement?t._addItem(e.value,e.label,e.id,void 0,e.customProperties,e.placeholder):t._addChoice(e.value,e.label,!0,!1,-1,e.customProperties,e.placeholder))},string:function(){t.isTextElement?t._addItem(e):t._addChoice(e,e,!0,!1,-1,null)}})[n]()}},{key:"_findAndSelectChoiceByValue",value:function(e){var t=this.store.getChoices(),n=t.find(function(t){return t.value===e});n&&!n.selected&&this._addItem(n.value,n.label,n.id,n.groupId,n.customProperties,n.placeholder,n.keyCode)}}]),e}();t.default=Lt;Lt.userDefaults={}},function(e,t,n){!function(t,n){e.exports=n()}(0,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.i=function(e){return e},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="",t(t.s=8)}([function(e,t,n){"use strict";e.exports=function(e){return"[object Array]"===Object.prototype.toString.call(e)}},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;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),r=n(5),s=n(7),a=n(4),l=function(){function e(t,n){var o=n.location,r=void 0===o?0:o,s=n.distance,l=void 0===s?100:s,c=n.threshold,u=void 0===c?.6:c,h=n.maxPatternLength,d=void 0===h?32:h,f=n.isCaseSensitive,v=void 0!==f&&f,p=n.tokenSeparator,m=void 0===p?/ +/g:p,g=n.findAllMatches,y=void 0!==g&&g,b=n.minMatchCharLength,E=void 0===b?1:b;i(this,e),this.options={location:r,distance:l,threshold:u,maxPatternLength:d,isCaseSensitive:v,tokenSeparator:m,findAllMatches:y,minMatchCharLength:E},this.pattern=this.options.isCaseSensitive?t:t.toLowerCase(),this.pattern.length<=d&&(this.patternAlphabet=a(this.pattern))}return o(e,[{key:"search",value:function(e){if(this.options.isCaseSensitive||(e=e.toLowerCase()),this.pattern===e)return{isMatch:!0,score:0,matchedIndices:[[0,e.length-1]]};var t=this.options,n=t.maxPatternLength,i=t.tokenSeparator;if(this.pattern.length>n)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;c<u;c+=1)e(l[c],a,o);else a&&e(l,a,o);else o.push(l.toString())}else o.push(t);return o};e.exports=function(e,t){return o(e,t,[])}},function(e,t,n){"use strict";e.exports=function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=[],i=-1,o=-1,r=0,s=e.length;r<s;r+=1){var a=e[r];a&&-1===i?i=r:a||-1===i||(o=r-1,o-i+1>=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;i<n;i+=1)t[e.charAt(i)]=0;for(var o=0;o<n;o+=1)t[e.charAt(o)]|=1<<n-o-1;return t}},function(e,t,n){"use strict";var i=/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g;e.exports=function(e,t){var n=arguments.length>2&&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<c;l+=1){var u=r[l];a.push([e.indexOf(u),u.length-1])}return{score:s?.5:1,isMatch:s,matchedIndices:a}}},function(e,t,n){"use strict";e.exports=function(e,t){var n=t.errors,i=void 0===n?0:n,o=t.currentLocation,r=void 0===o?0:o,s=t.expectedLocation,a=void 0===s?0:s,l=t.distance,c=void 0===l?100:l,u=i/e.length,h=Math.abs(a-r);return c?u+h/c:h?1:u}},function(e,t,n){"use strict";var i=n(6),o=n(3);e.exports=function(e,t,n,r){for(var s=r.location,a=void 0===s?0:s,l=r.distance,c=void 0===l?100:l,u=r.threshold,h=void 0===u?.6:u,d=r.findAllMatches,f=void 0!==d&&d,v=r.minMatchCharLength,p=void 0===v?1:v,m=a,g=e.length,y=h,b=e.indexOf(t,m),E=t.length,_=[],I=0;I<g;I+=1)_[I]=0;if(-1!==b){var S=i(t,{errors:0,currentLocation:b,expectedLocation:m,distance:c});if(y=Math.min(S,y),-1!==(b=e.lastIndexOf(t,m+E))){var w=i(t,{errors:0,currentLocation:b,expectedLocation:m,distance:c});y=Math.min(w,y)}}b=-1;for(var O=[],k=1,C=E+g,A=1<<E-1,T=0;T<E;T+=1){for(var L=0,x=C;L<x;){i(t,{errors:T,currentLocation:m+x,expectedLocation:m,distance:c})<=y?L=x:C=x,x=Math.floor((C-L)/2+L)}C=x;var P=Math.max(1,m-x+1),D=f?g:Math.min(m+x,g)+E,F=Array(D+2);F[D+1]=(1<<T)-1;for(var j=D;j>=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;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,n,i){return n&&e(t.prototype,n),i&&e(t,i),t}}(),r=n(1),s=n(2),a=n(0),l=function(){function e(t,n){var o=n.location,r=void 0===o?0:o,a=n.distance,l=void 0===a?100:a,c=n.threshold,u=void 0===c?.6:c,h=n.maxPatternLength,d=void 0===h?32:h,f=n.caseSensitive,v=void 0!==f&&f,p=n.tokenSeparator,m=void 0===p?/ +/g:p,g=n.findAllMatches,y=void 0!==g&&g,b=n.minMatchCharLength,E=void 0===b?1:b,_=n.id,I=void 0===_?null:_,S=n.keys,w=void 0===S?[]:S,O=n.shouldSort,k=void 0===O||O,C=n.getFn,A=void 0===C?s:C,T=n.sortFn,L=void 0===T?function(e,t){return e.score-t.score}:T,x=n.tokenize,P=void 0!==x&&x,D=n.matchAllTokens,F=void 0!==D&&D,j=n.includeMatches,M=void 0!==j&&j,N=n.includeScore,B=void 0!==N&&N,H=n.verbose,V=void 0!==H&&H;i(this,e),this.options={location:r,distance:l,threshold:u,maxPatternLength:d,isCaseSensitive:v,tokenSeparator:m,findAllMatches:y,minMatchCharLength:E,id:I,keys:w,includeMatches:M,includeScore:B,shouldSort:k,getFn:A,sortFn:L,verbose:V,tokenize:P,matchAllTokens:F},this.setCollection(t)}return o(e,[{key:"setCollection",value:function(e){return this.list=e,e}},{key:"search",value:function(e){this._log('---------\nSearch pattern: "'+e+'"');var t=this._prepareSearchers(e),n=t.tokenSearchers,i=t.fullSearcher,o=this._search(n,i),r=o.weights,s=o.results;return this._computeScore(r,s),this.options.shouldSort&&this._sort(s),this._format(s)}},{key:"_prepareSearchers",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=[];if(this.options.tokenize)for(var n=e.split(this.options.tokenSeparator),i=0,o=n.length;i<o;i+=1)t.push(new r(n[i],this.options));return{tokenSearchers:t,fullSearcher:new r(e,this.options)}}},{key:"_search",value:function(){var e=arguments.length>0&&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;r<s;r+=1)this._analyze({key:"",value:n[r],record:r,index:r},{resultMap:i,results:o,tokenSearchers:e,fullSearcher:t});return{weights:null,results:o}}for(var a={},l=0,c=n.length;l<c;l+=1)for(var u=n[l],h=0,d=this.options.keys.length;h<d;h+=1){var f=this.options.keys[h];if("string"!=typeof f){if(a[f.name]={weight:1-f.weight||1},f.weight<=0||f.weight>1)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<u.length;S+=1){var w=u[S];this._log('\nPattern: "'+w.pattern+'"');for(var O=!1,k=0;k<_.length;k+=1){var C=_[k],A=w.search(C),T={};A.isMatch?(T[C]=A.score,g=!0,O=!0,I.push(A.score)):(T[C]=1,this.options.matchAllTokens||I.push(1)),this._log('Token: "'+C+'", score: '+T[C])}O&&(b+=1)}y=I[0];for(var L=I.length,x=1;x<L;x+=1)y+=I[x];y/=L,this._log("Token score average:",y)}var P=E.score;y>-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<M;j+=1)this._analyze({key:n,arrayIndex:j,value:r[j],record:s,index:l},{resultMap:v,results:m,tokenSearchers:u,fullSearcher:d})}}},{key:"_computeScore",value:function(e,t){this._log("\n\nComputing score:\n");for(var n=0,i=t.length;n<i;n+=1){for(var o=t[n].output,r=o.length,s=0,a=1,l=0;l<r;l+=1){var c=e?e[o[l].key].weight:1,u=1===c?o[l].score:o[l].score||.001,h=u*c;1!==c?a=Math.min(a,h):(o[l].nScore=h,s+=h)}t[n].score=1===a?s/r:a,this._log(t[n])}}},{key:"_sort",value:function(e){this._log("\n\nSorting...."),e.sort(this.options.sortFn)}},{key:"_format",value:function(e){var t=[];this._log("\n\nOutput:\n\n",JSON.stringify(e));var n=[];this.options.includeMatches&&n.push(function(e,t){var n=e.output;t.matches=[];for(var i=0,o=n.length;i<o;i+=1){var r=n[i];if(0!==r.matchedIndices.length){var s={indices:r.matchedIndices,value:r.value};r.key&&(s.key=r.key),r.hasOwnProperty("arrayIndex")&&r.arrayIndex>-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;i<o;i+=1){var r=e[i];if(this.options.id&&(r.item=this.options.getFn(r.item,this.options.id)[0]),n.length){for(var s={item:r.item},a=0,l=n.length;a<l;a+=1)n[a](r,s);t.push(s)}else t.push(r.item)}return t}},{key:"_log",value:function(){if(this.options.verbose){var e;(e=console).log.apply(e,arguments)}}}]),e}();e.exports=l}])})},function(e,t,n){"use strict";(function(e){var n="object"==typeof e&&e&&e.Object===Object&&e;t.a=n}).call(t,n(0))},function(e,t,n){e.exports=n(6)},function(e,t,n){"use strict";(function(e,i){Object.defineProperty(t,"__esModule",{value:!0});var o,r=n(8),s=function(e){return e&&e.__esModule?e:{default:e}}(r);o="undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==e?e:i;var a=(0,s.default)(o);t.default=a}).call(t,n(0),n(7)(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){var i,o;!function(){"use strict";function n(){for(var e=[],t=0;t<arguments.length;t++){var i=arguments[t];if(i){var o=typeof i;if("string"===o||"number"===o)e.push(i);else if(Array.isArray(i))e.push(n.apply(null,i));else if("object"===o)for(var s in i)r.call(i,s)&&i[s]&&e.push(s)}}return e.join(" ")}var r={}.hasOwnProperty;void 0!==e&&e.exports?e.exports=n:(i=[],void 0!==(o=function(){return n}.apply(t,i))&&(e.exports=o))}()},function(e,t){!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,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<a;)u=i[c],l[c]=r?void 0===s?r(u,c):r.call(s,u,c):u,c+=1;return l.length=a,l}}()),Array.prototype.find||(Array.prototype.find=function(e){"use strict";if(null==this)throw new TypeError("Array.prototype.find called on null or undefined");if("function"!=typeof e)throw new TypeError("predicate must be a function");for(var t=Object(this),n=t.length>>>0,i=arguments[1],o=void 0,r=0;r<n;r++)if(o=t[r],e.call(i,o,r,t))return o}),e.prototype=window.Event.prototype,window.CustomEvent=e}()}])});