Choices/public/assets/scripts/choices.min.js
2019-02-22 22:06:59 +00:00

58 lines
88 KiB
JavaScript

/*! choices.js v6.0.2 | (c) 2019 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()}(window,function(){return function(e){var t={};function n(i){if(t[i])return t[i].exports;var s=t[i]={i:i,l:!1,exports:{}};return e[i].call(s.exports,s,s.exports,n),s.l=!0,s.exports}return n.m=e,n.c=t,n.d=function(e,t,i){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var s in e)n.d(i,s,function(t){return e[t]}.bind(null,s));return i},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="/public/assets/scripts/",n(n.s=9)}([function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.diff=t.cloneObject=t.existsInArray=t.isIE11=t.fetchFromObject=t.getWindowHeight=t.dispatchEvent=t.sortByScore=t.sortByAlpha=t.calcWidthOfInput=t.strToEl=t.sanitise=t.isScrolledIntoView=t.getAdjacentEl=t.findAncestorByAttrName=t.wrap=t.isElement=t.isType=t.getType=t.generateId=t.generateChars=t.getRandomNumber=void 0;var i=function(e,t){return Math.floor(Math.random()*(t-e)+e)};t.getRandomNumber=i;var s=function(e){for(var t="",n=0;n<e;n++){t+=i(0,36).toString(36)}return t};t.generateChars=s;t.generateId=function(e,t){var n=e.id||e.name&&"".concat(e.name,"-").concat(s(2))||s(4);return n=n.replace(/(:|\.|\[|\]|,)/g,""),n="".concat(t,"-").concat(n)};var o=function(e){return Object.prototype.toString.call(e).slice(8,-1)};t.getType=o;var r=function(e,t){return null!=t&&o(t)===e};t.isType=r;t.isElement=function(e){return e instanceof Element};t.wrap=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:document.createElement("div");return e.nextSibling?e.parentNode.insertBefore(t,e.nextSibling):e.parentNode.appendChild(t),t.appendChild(e)};t.findAncestorByAttrName=function(e,t){for(var n=e;n;){if(n.hasAttribute(t))return n;n=n.parentElement}return null};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,s=Array.from(i.querySelectorAll(t)),o=s.indexOf(e);return s[o+(n>0?1:-1)]}};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};var a=function(e){return r("String",e)?e.replace(/&/g,"&amp;").replace(/>/g,"&rt;").replace(/</g,"&lt;").replace(/"/g,"&quot;"):e};t.sanitise=a;var l,c=(l=document.createElement("div"),function(e){var t=e.trim();l.innerHTML=t;for(var n=l.children[0];l.firstChild;)l.removeChild(l.firstChild);return n});t.strToEl=c;t.calcWidthOfInput=function(e,t){var n=e.value||e.placeholder,i=e.offsetWidth;if(n){var s=c("<span>".concat(a(n),"</span>"));if(s.style.position="absolute",s.style.padding="0",s.style.top="-9999px",s.style.left="-9999px",s.style.width="auto",s.style.whiteSpace="pre",document.body.contains(e)&&window.getComputedStyle){var o=window.getComputedStyle(e);o&&(s.style.fontSize=o.fontSize,s.style.fontFamily=o.fontFamily,s.style.fontWeight=o.fontWeight,s.style.fontStyle=o.fontStyle,s.style.letterSpacing=o.letterSpacing,s.style.textTransform=o.textTransform,s.style.padding=o.padding)}document.body.appendChild(s),requestAnimationFrame(function(){n&&s.offsetWidth!==e.offsetWidth&&(i=s.offsetWidth+4),document.body.removeChild(s),t.call(void 0,"".concat(i,"px"))})}else t.call(void 0,"".concat(i,"px"))};t.sortByAlpha=function(e,t){var n="".concat(e.label||e.value).toLowerCase(),i="".concat(t.label||t.value).toLowerCase();return n<i?-1:n>i?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.getWindowHeight=function(){var e=document.body,t=document.documentElement;return Math.max(e.scrollHeight,e.offsetHeight,t.clientHeight,t.scrollHeight,t.offsetHeight)};t.fetchFromObject=function e(t,n){var i=n.indexOf(".");return i>-1?e(t[n.substring(0,i)],n.substr(i+1)):t[n]};t.isIE11=function(){return!(!navigator.userAgent.match(/Trident/)||!navigator.userAgent.match(/rv[ :]11/))};t.existsInArray=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"value";return e.some(function(e){return r("String",t)?e[n]===t.trim():e[n]===t})};t.cloneObject=function(e){return JSON.parse(JSON.stringify(e))};t.diff=function(e,t){var n=Object.keys(e).sort(),i=Object.keys(t).sort();return n.filter(function(e){return i.indexOf(e)<0})}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SCROLLING_SPEED=t.KEY_CODES=t.ACTION_TYPES=t.EVENTS=t.DEFAULT_CONFIG=t.DEFAULT_CLASSNAMES=void 0;var i=n(0),s={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_CLASSNAMES=s;var o={items:[],choices:[],silent:!1,renderChoiceLimit:-1,maxItemCount:-1,addItems:!0,addItemFilterFn:null,removeItems:!0,removeItemButton:!1,editItems:!1,duplicateItemsAllowed:!0,delimiter:",",paste:!0,searchEnabled:!0,searchChoices:!0,searchFloor:1,searchResultLimit:4,searchFields:["label","value"],position:"auto",resetScrollPosition:!0,shouldSort:!0,shouldSortItems:!1,sortFn:i.sortByAlpha,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",uniqueItemText:"Only unique values can be added",customAddItemText:"Only values matching specific conditions can be added",addItemText:function(e){return'Press Enter to add <b>"'.concat((0,i.sanitise)(e),'"</b>')},maxItemText:function(e){return"Only ".concat(e," values can be added")},itemComparer:function(e,t){return e===t},fuseOptions:{includeScore:!0},callbackOnInit:null,callbackOnCreateTemplates:null,classNames:s};t.DEFAULT_CONFIG=o;t.EVENTS={showDropdown:"showDropdown",hideDropdown:"hideDropdown",change:"change",choice:"choice",search:"search",addItem:"addItem",removeItem:"removeItem",highlightItem:"highlightItem",highlightChoice:"highlightChoice"};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(e,i){var s,o=n(7);s="undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==e?e:i;var r=Object(o.a)(s);t.a=r}).call(this,n(3),n(16)(e))},function(e,t){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(e){"object"==typeof window&&(n=window)}e.exports=n},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=n(0);function s(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)}}var o=function(){function e(t){var n=t.element,s=t.classNames;if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Object.assign(this,{element:n,classNames:s}),!(0,i.isElement)(n))throw new TypeError("Invalid element passed");this.isDisabled=!1}var t,n,o;return t=e,(n=[{key:"conceal",value:function(){this.element.classList.add(this.classNames.input),this.element.classList.add(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("aria-hidden","true"),this.element.setAttribute("data-choice","active")}},{key:"reveal",value:function(){this.element.classList.remove(this.classNames.input),this.element.classList.remove(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){(0,i.dispatchEvent)(this.element,e,t)}},{key:"value",get:function(){return this.element.value}}])&&s(t.prototype,n),o&&s(t,o),e}();t.default=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.TEMPLATES=void 0;var i,s=(i=n(29))&&i.__esModule?i:{default:i},o=n(0);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var a={containerOuter:function(e,t,n,i,s,r){var a=i?'tabindex="0"':"",l=n?'role="listbox"':"",c="";return n&&s&&(l='role="combobox"',c='aria-autocomplete="list"'),(0,o.strToEl)('\n <div\n class="'.concat(e.containerOuter,'"\n data-type="').concat(r,'"\n ').concat(l,"\n ").concat(a,"\n ").concat(c,'\n aria-haspopup="true"\n aria-expanded="false"\n dir="').concat(t,'"\n >\n </div>\n '))},containerInner:function(e){return(0,o.strToEl)('\n <div class="'.concat(e.containerInner,'"></div>\n '))},itemList:function(e,t){var n,i=(0,s.default)(e.list,(r(n={},e.listSingle,t),r(n,e.listItems,!t),n));return(0,o.strToEl)('\n <div class="'.concat(i,'"></div>\n '))},placeholder:function(e,t){return(0,o.strToEl)('\n <div class="'.concat(e.placeholder,'">\n ').concat(t,"\n </div>\n "))},item:function(e,t,n){var i,a,l=t.active?'aria-selected="true"':"",c=t.disabled?'aria-disabled="true"':"",u=(0,s.default)(e.item,(r(i={},e.highlightedState,t.highlighted),r(i,e.itemSelectable,!t.highlighted),r(i,e.placeholder,t.placeholder),i));return n?(u=(0,s.default)(e.item,(r(a={},e.highlightedState,t.highlighted),r(a,e.itemSelectable,!t.disabled),r(a,e.placeholder,t.placeholder),a)),(0,o.strToEl)('\n <div\n class="'.concat(u,'"\n data-item\n data-id="').concat(t.id,'"\n data-value="').concat(t.value,"\"\n data-custom-properties='").concat(t.customProperties,"'\n data-deletable\n ").concat(l,"\n ").concat(c,"\n >\n ").concat(t.label,'\x3c!--\n --\x3e<button\n type="button"\n class="').concat(e.button,'"\n data-button\n aria-label="Remove item: \'').concat(t.value,"'\"\n >\n Remove item\n </button>\n </div>\n "))):(0,o.strToEl)('\n <div\n class="'.concat(u,'"\n data-item\n data-id="').concat(t.id,'"\n data-value="').concat(t.value,'"\n ').concat(l,"\n ").concat(c,"\n >\n ").concat(t.label,"\n </div>\n "))},choiceList:function(e,t){var n=t?"":'aria-multiselectable="true"';return(0,o.strToEl)('\n <div\n class="'.concat(e.list,'"\n dir="ltr"\n role="listbox"\n ').concat(n,"\n >\n </div>\n "))},choiceGroup:function(e,t){var n=t.disabled?'aria-disabled="true"':"",i=(0,s.default)(e.group,r({},e.itemDisabled,t.disabled));return(0,o.strToEl)('\n <div\n class="'.concat(i,'"\n data-group\n data-id="').concat(t.id,'"\n data-value="').concat(t.value,'"\n role="group"\n ').concat(n,'\n >\n <div class="').concat(e.groupHeading,'">').concat(t.value,"</div>\n </div>\n "))},choice:function(e,t,n){var i,a=t.groupId>0?'role="treeitem"':'role="option"',l=(0,s.default)(e.item,e.itemChoice,(r(i={},e.itemDisabled,t.disabled),r(i,e.itemSelectable,!t.disabled),r(i,e.placeholder,t.placeholder),i));return(0,o.strToEl)('\n <div\n class="'.concat(l,'"\n data-select-text="').concat(n,'"\n data-choice\n data-id="').concat(t.id,'"\n data-value="').concat(t.value,'"\n ').concat(t.disabled?'data-choice-disabled aria-disabled="true"':"data-choice-selectable",'\n id="').concat(t.elementId,'"\n ').concat(a,"\n >\n ").concat(t.label,"\n </div>\n "))},input:function(e){var t=(0,s.default)(e.input,e.inputCloned);return(0,o.strToEl)('\n <input\n type="text"\n class="'.concat(t,'"\n autocomplete="off"\n autocapitalize="off"\n spellcheck="false"\n role="textbox"\n aria-autocomplete="list"\n >\n '))},dropdown:function(e){var t=(0,s.default)(e.list,e.listDropdown);return(0,o.strToEl)('\n <div\n class="'.concat(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]:"",a=(0,s.default)(e.item,e.itemChoice,(r(n={},e.noResults,"no-results"===i),r(n,e.noChoices,"no-choices"===i),n));return(0,o.strToEl)('\n <div class="'.concat(a,'">\n ').concat(t,"\n </div>\n "))},option:function(e){return(0,o.strToEl)('\n <option value="'.concat(e.value,'" ').concat(e.active?"selected":""," ").concat(e.disabled?"disabled":""," ").concat(e.customProperties?"data-custom-properties=".concat(e.customProperties):"",">").concat(e.label,"</option>\n "))}};t.TEMPLATES=a;var l=a;t.default=l},function(e,t,n){"use strict";n.r(t);var i=n(8),s="object"==typeof self&&self&&self.Object===Object&&self,o=(i.a||s||Function("return this")()).Symbol,r=Object.prototype,a=r.hasOwnProperty,l=r.toString,c=o?o.toStringTag:void 0;var u=function(e){var t=a.call(e,c),n=e[c];try{e[c]=void 0;var i=!0}catch(e){}var s=l.call(e);return i&&(t?e[c]=n:delete e[c]),s},h=Object.prototype.toString;var d=function(e){return h.call(e)},f="[object Null]",p="[object Undefined]",m=o?o.toStringTag:void 0;var v=function(e){return null==e?void 0===e?p:f:m&&m in Object(e)?u(e):d(e)};var g=function(e,t){return function(n){return e(t(n))}}(Object.getPrototypeOf,Object);var _=function(e){return null!=e&&"object"==typeof e},y="[object Object]",b=Function.prototype,E=Object.prototype,S=b.toString,I=E.hasOwnProperty,O=S.call(Object);var C=function(e){if(!_(e)||v(e)!=y)return!1;var t=g(e);if(null===t)return!0;var n=I.call(t,"constructor")&&t.constructor;return"function"==typeof n&&n instanceof n&&S.call(n)==O},T=n(2),w={INIT:"@@redux/INIT"};function A(e,t,n){var i;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(A)(e,t)}if("function"!=typeof e)throw new Error("Expected the reducer to be a function.");var s=e,o=t,r=[],a=r,l=!1;function c(){a===r&&(a=r.slice())}function u(){return o}function h(e){if("function"!=typeof e)throw new Error("Expected listener to be a function.");var t=!0;return c(),a.push(e),function(){if(t){t=!1,c();var n=a.indexOf(e);a.splice(n,1)}}}function d(e){if(!C(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(l)throw new Error("Reducers may not dispatch actions.");try{l=!0,o=s(o,e)}finally{l=!1}for(var t=r=a,n=0;n<t.length;n++){(0,t[n])()}return e}return d({type:w.INIT}),(i={dispatch:d,subscribe:h,getState:u,replaceReducer:function(e){if("function"!=typeof e)throw new Error("Expected the nextReducer to be a function.");s=e,d({type:w.INIT})}})[T.a]=function(){var e,t=h;return(e={subscribe:function(e){if("object"!=typeof e)throw new TypeError("Expected the observer to be an object.");function n(){e.next&&e.next(u())}return n(),{unsubscribe:t(n)}}})[T.a]=function(){return this},e},i}function k(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 L(e){for(var t=Object.keys(e),n={},i=0;i<t.length;i++){var s=t[i];0,"function"==typeof e[s]&&(n[s]=e[s])}var o=Object.keys(n);var r=void 0;try{!function(e){Object.keys(e).forEach(function(t){var n=e[t];if(void 0===n(void 0,{type:w.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 "+w.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)}catch(e){r=e}return function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=arguments[1];if(r)throw r;for(var i=!1,s={},a=0;a<o.length;a++){var l=o[a],c=n[l],u=e[l],h=c(u,t);if(void 0===h){var d=k(l,t);throw new Error(d)}s[l]=h,i=i||h!==u}return i?s:e}}function x(e,t){return function(){return t(e.apply(void 0,arguments))}}function D(e,t){if("function"==typeof e)return x(e,t);if("object"!=typeof e||null===e)throw new Error("bindActionCreators expected an object or a function, instead received "+(null===e?"null":typeof e)+'. Did you write "import ActionCreators from" instead of "import * as ActionCreators from"?');for(var n=Object.keys(e),i={},s=0;s<n.length;s++){var o=n[s],r=e[o];"function"==typeof r&&(i[o]=x(r,t))}return i}function P(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return 0===t.length?function(e){return e}:1===t.length?t[0]:t.reduce(function(e,t){return function(){return e(t.apply(void 0,arguments))}})}var j=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};function M(){for(var e=arguments.length,t=Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e){return function(n,i,s){var o,r=e(n,i,s),a=r.dispatch,l={getState:r.getState,dispatch:function(e){return a(e)}};return o=t.map(function(e){return e(l)}),a=P.apply(void 0,o)(r.dispatch),j({},r,{dispatch:a})}}}n.d(t,"createStore",function(){return A}),n.d(t,"combineReducers",function(){return L}),n.d(t,"bindActionCreators",function(){return D}),n.d(t,"applyMiddleware",function(){return M}),n.d(t,"compose",function(){return P})},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}n.d(t,"a",function(){return i})},function(e,t,n){"use strict";(function(e){var n="object"==typeof e&&e&&e.Object===Object&&e;t.a=n}).call(this,n(3))},function(e,t,n){e.exports=n(10)},function(e,t,n){"use strict";var i=m(n(11)),s=m(n(12));n(13);var o=m(n(15)),r=n(22),a=n(1),l=n(5),c=n(30),u=n(31),h=n(32),d=n(33),f=n(34),p=n(0);function m(e){return e&&e.__esModule?e:{default:e}}function v(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function g(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)}}var _=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(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),(0,p.isType)("String",t)){var i=Array.from(document.querySelectorAll(t));if(i.length>1)return this._generateInstances(i,n)}this.config=s.default.all([a.DEFAULT_CONFIG,e.userDefaults,n],{arrayMerge:function(e,t){return[].concat(t)}});var l=(0,p.diff)(this.config,a.DEFAULT_CONFIG);l.length&&console.warn("Unknown config option(s) passed",l.join(", ")),["auto","always"].includes(this.config.renderSelectedChoices)||(this.config.renderSelectedChoices="auto");var c=(0,p.isType)("String",t)?document.querySelector(t):t;return c?(this._isTextElement="text"===c.type,this._isSelectOneElement="select-one"===c.type,this._isSelectMultipleElement="select-multiple"===c.type,this._isSelectElement=this._isSelectOneElement||this._isSelectMultipleElement,this._isTextElement?this.passedElement=new r.WrappedInput({element:c,classNames:this.config.classNames,delimiter:this.config.delimiter}):this._isSelectElement&&(this.passedElement=new r.WrappedSelect({element:c,classNames:this.config.classNames})),this.passedElement?(!0===this.config.shouldSortItems&&this._isSelectOneElement&&!this.config.silent&&console.warn("shouldSortElements: Type of passed element is 'select-one', falling back to false."),this.initialised=!1,this._store=new o.default(this.render),this._initialState={},this._currentState={},this._prevState={},this._currentValue="",this._canSearch=this.config.searchEnabled,this._isScrollingOnIe=!1,this._highlightPosition=0,this._wasTap=!0,this._placeholderValue=this._generatePlaceholderValue(),this._baseId=(0,p.generateId)(this.passedElement.element,"choices-"),this._direction=this.passedElement.element.getAttribute("dir")||"ltr",this._idNames={itemChoice:"item-choice"},this._presetChoices=this.config.choices,this._presetItems=this.config.items,this.passedElement.value&&(this._presetItems=this._presetItems.concat(this.passedElement.value.split(this.config.delimiter))),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._onFormReset=this._onFormReset.bind(this),this._onAKey=this._onAKey.bind(this),this._onEnterKey=this._onEnterKey.bind(this),this._onEscapeKey=this._onEscapeKey.bind(this),this._onDirectionKey=this._onDirectionKey.bind(this),this._onDeleteKey=this._onDeleteKey.bind(this),"active"===this.passedElement.element.getAttribute("data-choice")&&console.warn("Trying to initialise Choices on element already initialised"),void this.init()):console.error("Passed element was of an invalid type")):console.error("Could not find passed element or passed element was of an invalid type")}var t,n,m;return t=e,(n=[{key:"init",value:function(){if(!this.initialised){this._createTemplates(),this._createElements(),this._createStructure(),this._initialState=(0,p.cloneObject)(this._store.state),this._store.subscribe(this._render),this._render(),this._addEventListeners(),(!this.config.addItems||this.passedElement.element.hasAttribute("disabled"))&&this.disable(),this.initialised=!0;var e=this.config.callbackOnInit;e&&(0,p.isType)("Function",e)&&e.call(this)}}},{key:"destroy",value:function(){this.initialised&&(this._removeEventListeners(),this.passedElement.reveal(),this.containerOuter.unwrap(this.passedElement.element),this._isSelectElement&&(this.passedElement.options=this._presetChoices),this.clearStore(),this.config.templates=null,this.initialised=!1)}},{key:"enable",value:function(){return this.passedElement.isDisabled&&this.passedElement.enable(),this.containerOuter.isDisabled&&(this._addEventListeners(),this.input.enable(),this.containerOuter.enable()),this}},{key:"disable",value:function(){return this.passedElement.isDisabled||this.passedElement.disable(),this.containerOuter.isDisabled||(this._removeEventListeners(),this.input.disable(),this.containerOuter.disable()),this}},{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,s=void 0===i?-1:i,o=e.value,r=void 0===o?"":o,l=e.label,c=void 0===l?"":l,h=s>=0?this._store.getGroupById(s):null;return this._store.dispatch((0,u.highlightItem)(n,!0)),t&&this.passedElement.triggerEvent(a.EVENTS.highlightItem,{id:n,value:r,label:c,groupValue:h&&h.value?h.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,s=e.value,o=void 0===s?"":s,r=e.label,l=void 0===r?"":r,c=i>=0?this._store.getGroupById(i):null;return this._store.dispatch((0,u.highlightItem)(t,!1)),this.passedElement.triggerEvent(a.EVENTS.highlightItem,{id:t,value:o,label:l,groupValue:c&&c.value?c.value:null}),this}},{key:"highlightAll",value:function(){var e=this;return this._store.items.forEach(function(t){return e.highlightItem(t)}),this}},{key:"unhighlightAll",value:function(){var e=this;return this._store.items.forEach(function(t){return e.unhighlightItem(t)}),this}},{key:"removeActiveItemsByValue",value:function(e){var t=this;return this._store.activeItems.filter(function(t){return t.value===e}).forEach(function(e){return t._removeItem(e)}),this}},{key:"removeActiveItems",value:function(e){var t=this;return this._store.activeItems.filter(function(t){return t.id!==e}).forEach(function(e){return t._removeItem(e)}),this}},{key:"removeHighlightedItems",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];return this._store.highlightedActiveItems.forEach(function(n){e._removeItem(n),t&&e._triggerChange(n.value)}),this}},{key:"showDropdown",value:function(e){var t=this;return this.dropdown.isActive?this:(requestAnimationFrame(function(){t.dropdown.show(),t.containerOuter.open(t.dropdown.distanceFromTopWindow()),!e&&t._canSearch&&t.input.focus(),t.passedElement.triggerEvent(a.EVENTS.showDropdown,{})}),this)}},{key:"hideDropdown",value:function(e){var t=this;return this.dropdown.isActive?(requestAnimationFrame(function(){t.dropdown.hide(),t.containerOuter.close(),!e&&t._canSearch&&(t.input.removeActiveDescendant(),t.input.blur()),t.passedElement.triggerEvent(a.EVENTS.hideDropdown,{})}),this):this}},{key:"getValue",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=this._store.activeItems.reduce(function(t,n){var i=e?n.value:n;return t.push(i),t},[]);return this._isSelectOneElement?t[0]:t}},{key:"setValue",value:function(e){var t=this;return this.initialised?([].concat(e).forEach(function(e){return t._setChoiceOrItem(e)}),this):this}},{key:"setChoiceByValue",value:function(e){var t=this;return!this.initialised||this._isTextElement?this:(((0,p.isType)("Array",e)?e:[e]).forEach(function(e){return t._findAndSelectChoiceByValue(e)}),this)}},{key:"setChoices",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(!this._isSelectElement||!t.length||!n)return this;s&&this._clearChoices(),this.containerOuter.removeLoadingState();return this._setLoading(!0),t.forEach(function(t){t.choices?e._addGroup({group:t,id:t.id||null,valueKey:n,labelKey:i}):e._addChoice({value:t[n],label:t[i],isSelected:t.selected,isDisabled:t.disabled,customProperties:t.customProperties,placeholder:t.placeholder})}),this._setLoading(!1),this}},{key:"clearStore",value:function(){return this._store.dispatch((0,d.clearAll)()),this}},{key:"clearInput",value:function(){var e=!this._isSelectOneElement;return this.input.clear(e),!this._isTextElement&&this._canSearch&&(this._isSearching=!1,this._store.dispatch((0,c.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:"_render",value:function(){if(!this._store.isLoading()){this._currentState=this._store.state;var e=this._currentState.choices!==this._prevState.choices||this._currentState.groups!==this._prevState.groups||this._currentState.items!==this._prevState.items,t=this._isSelectElement,n=this._currentState.items!==this._prevState.items;e&&(t&&this._renderChoices(),n&&this._renderItems(),this._prevState=this._currentState)}}},{key:"_renderChoices",value:function(){var e=this,t=this._store,n=t.activeGroups,i=t.activeChoices,s=document.createDocumentFragment();if(this.choiceList.clear(),this.config.resetScrollPosition&&requestAnimationFrame(function(){return e.choiceList.scrollToTop()}),n.length>=1&&!this._isSearching){var o=i.filter(function(e){return!0===e.placeholder&&-1===e.groupId});o.length>=1&&(s=this._createChoicesFragment(o,s)),s=this._createGroupsFragment(n,i,s)}else i.length>=1&&(s=this._createChoicesFragment(i,s));if(s.childNodes&&s.childNodes.length>0){var r=this._store.activeItems,a=this._canAddItem(r,this.input.value);a.response?(this.choiceList.append(s),this._highlightChoice()):this.choiceList.append(this._getTemplate("notice",a.notice))}else{var l,c;this._isSearching?(c=(0,p.isType)("Function",this.config.noResultsText)?this.config.noResultsText():this.config.noResultsText,l=this._getTemplate("notice",c,"no-results")):(c=(0,p.isType)("Function",this.config.noChoicesText)?this.config.noChoicesText():this.config.noChoicesText,l=this._getTemplate("notice",c,"no-choices")),this.choiceList.append(l)}}},{key:"_renderItems",value:function(){var e=this._store.activeItems||[];this.itemList.clear();var t=this._createItemsFragment(e);t.childNodes&&this.itemList.append(t)}},{key:"_createGroupsFragment",value:function(e,t,n){var i=this,s=n||document.createDocumentFragment();return this.config.shouldSort&&e.sort(this.config.sortFn),e.forEach(function(e){var n=function(e){return t.filter(function(t){return i._isSelectOneElement?t.groupId===e.id:t.groupId===e.id&&("always"===i.config.renderSelectedChoices||!t.selected)})}(e);if(n.length>=1){var o=i._getTemplate("choiceGroup",e);s.appendChild(o),i._createChoicesFragment(n,s,!0)}}),s}},{key:"_createChoicesFragment",value:function(e,t){var n=this,i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],s=t||document.createDocumentFragment(),o=this.config,r=o.renderSelectedChoices,a=o.searchResultLimit,l=o.renderChoiceLimit,c=this._isSearching?p.sortByScore:this.config.sortFn,u=function(e){if("auto"!==r||(n._isSelectOneElement||!e.selected)){var t=n._getTemplate("choice",e,n.config.itemSelectText);s.appendChild(t)}},h=e;"auto"!==r||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,m=d.normalChoices;(this.config.shouldSort||this._isSearching)&&m.sort(c);var v=h.length,g=[].concat(f,m);this._isSearching?v=a:l>0&&!i&&(v=l);for(var _=0;_<v;_+=1)g[_]&&u(g[_]);return s}},{key:"_createItemsFragment",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,i=this.config,s=i.shouldSortItems,o=i.sortFn,r=i.removeItemButton,a=n||document.createDocumentFragment();s&&!this._isSelectOneElement&&e.sort(o),this._isTextElement?this.passedElement.value=e:this.passedElement.options=e;return e.forEach(function(e){return function(e){var n=t._getTemplate("item",e,r);a.appendChild(n)}(e)}),a}},{key:"_triggerChange",value:function(e){null!=e&&this.passedElement.triggerEvent(a.EVENTS.change,{value:e})}},{key:"_selectPlaceholderChoice",value:function(){var e=this._store.placeholderChoice;e&&(this._addItem({value:e.value,label:e.label,choiceId:e.id,groupId:e.groupId,placeholder: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 s=t.getAttribute("data-id");e.forEach(function(e){e.id!==parseInt(s,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),s=e[0]&&e[0].keyCode?e[0].keyCode:null,o=this.dropdown.isActive;if(i.keyCode=s,this.passedElement.triggerEvent(a.EVENTS.choice,{choice:i}),i&&!i.selected&&!i.disabled)this._canAddItem(e,i.value).response&&(this._addItem({value:i.value,label:i.label,choiceId:i.id,groupId:i.groupId,customProperties:i.customProperties,placeholder:i.placeholder,keyCode:i.keyCode}),this._triggerChange(i.value));this.clearInput(),o&&this._isSelectOneElement&&(this.hideDropdown(!0),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.value=t.value,this.input.setWidth(),this._removeItem(t),this._triggerChange(t.value)):(n||this.highlightItem(t,!1),this.removeHighlightedItems(!0))}}},{key:"_setLoading",value:function(e){this._store.dispatch((0,f.setIsLoading)(e))}},{key:"_handleLoadingState",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=this.itemList.getChild(".".concat(this.config.classNames.placeholder));e?(this.disable(),this.containerOuter.addLoadingState(),this._isSelectOneElement?t?t.innerHTML=this.config.loadingText:(t=this._getTemplate("placeholder",this.config.loadingText),this.itemList.append(t)):this.input.placeholder=this.config.loadingText):(this.enable(),this.containerOuter.removeLoadingState(),this._isSelectOneElement?t.innerHTML=this._placeholderValue||"":this.input.placeholder=this._placeholderValue||"")}},{key:"_handleSearch",value:function(e){if(e&&this.input.isFocussed){var t=this._store.choices,n=this.config,i=n.searchFloor,s=n.searchChoices,o=t.some(function(e){return!e.active});if(e&&e.length>=i){var r=s?this._searchChoices(e):0;this.passedElement.triggerEvent(a.EVENTS.search,{value:e,resultCount:r})}else o&&(this._isSearching=!1,this._store.dispatch((0,c.activateChoices)(!0)))}}},{key:"_canAddItem",value:function(e,t){var n=!0,i=(0,p.isType)("Function",this.config.addItemText)?this.config.addItemText(t):this.config.addItemText;if(!this._isSelectOneElement){var s=(0,p.existsInArray)(e,t);this.config.maxItemCount>0&&this.config.maxItemCount<=e.length&&(n=!1,i=(0,p.isType)("Function",this.config.maxItemText)?this.config.maxItemText(this.config.maxItemCount):this.config.maxItemText),!this.config.duplicateItemsAllowed&&s&&n&&(n=!1,i=(0,p.isType)("Function",this.config.uniqueItemText)?this.config.uniqueItemText(t):this.config.uniqueItemText),this._isTextElement&&this.config.addItems&&n&&(0,p.isType)("Function",this.config.addItemFilterFn)&&!this.config.addItemFilterFn(t)&&(n=!1,i=(0,p.isType)("Function",this.config.customAddItemText)?this.config.customAddItemText(t):this.config.customAddItemText)}return{response:n,notice:i}}},{key:"_ajaxCallback",value:function(){var e=this;return function(t,n,i){if(t&&n){var s=(0,p.isType)("Object",t)?[t]:t;s&&(0,p.isType)("Array",s)&&s.length?(e._handleLoadingState(!1),e._setLoading(!0),s.forEach(function(t){t.choices?e._addGroup({group:t,id:t.id||null,valueKey:n,labelKey:i}):e._addChoice({value:(0,p.fetchFromObject)(t,n),label:(0,p.fetchFromObject)(t,i),isSelected:t.selected,isDisabled:t.disabled,customProperties:t.customProperties,placeholder:t.placeholder})}),e._setLoading(!1),e._isSelectOneElement&&e._selectPlaceholderChoice()):e._handleLoadingState(!1)}}}},{key:"_searchChoices",value:function(e){var t=(0,p.isType)("String",e)?e.trim():e,n=(0,p.isType)("String",this._currentValue)?this._currentValue.trim():this._currentValue;if(t.length<1&&t==="".concat(n," "))return 0;var s=this._store.searchableChoices,o=t,r=[].concat(this.config.searchFields),a=Object.assign(this.config.fuseOptions,{keys:r}),l=new i.default(s,a).search(o);return this._currentValue=t,this._highlightPosition=0,this._isSearching=!0,this._store.dispatch((0,c.filterChoices)(l)),l.length}},{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.element.form&&this.input.element.form.addEventListener("reset",this._onFormReset),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.element.form&&this.input.element.form.removeEventListener("reset",this._onFormReset),this.input.removeEventListeners()}},{key:"_onKeyDown",value:function(e){var t,n=e.target,i=e.keyCode,s=e.ctrlKey,o=e.metaKey;if(n===this.input.element||this.containerOuter.element.contains(n)){var r=this._store.activeItems,l=this.input.isFocussed,c=this.dropdown.isActive,u=this.itemList.hasChildren,h=String.fromCharCode(i),d=a.KEY_CODES.BACK_KEY,f=a.KEY_CODES.DELETE_KEY,p=a.KEY_CODES.ENTER_KEY,m=a.KEY_CODES.A_KEY,g=a.KEY_CODES.ESC_KEY,_=a.KEY_CODES.UP_KEY,y=a.KEY_CODES.DOWN_KEY,b=a.KEY_CODES.PAGE_UP_KEY,E=a.KEY_CODES.PAGE_DOWN_KEY,S=s||o;!this._isTextElement&&/[a-zA-Z0-9-_ ]/.test(h)&&this.showDropdown();var I=(v(t={},m,this._onAKey),v(t,p,this._onEnterKey),v(t,g,this._onEscapeKey),v(t,_,this._onDirectionKey),v(t,b,this._onDirectionKey),v(t,y,this._onDirectionKey),v(t,E,this._onDirectionKey),v(t,f,this._onDeleteKey),v(t,d,this._onDeleteKey),t);I[i]&&I[i]({event:e,target:n,keyCode:i,metaKey:o,activeItems:r,hasFocusedInput:l,hasActiveDropdown:c,hasItems:u,hasCtrlDownKeyPressed:S})}}},{key:"_onKeyUp",value:function(e){var t=e.target,n=e.keyCode;if(t===this.input.element){var i=this.input.value,s=this._store.activeItems,o=this._canAddItem(s,i),r=a.KEY_CODES.BACK_KEY,l=a.KEY_CODES.DELETE_KEY;if(this._isTextElement){if(o.notice&&i){var u=this._getTemplate("notice",o.notice);this.dropdown.element.innerHTML=u.outerHTML,this.showDropdown(!0)}else this.hideDropdown(!0)}else{var h=(n===r||n===l)&&!t.value,d=!this._isTextElement&&this._isSearching,f=this._canSearch&&o.response;h&&d?(this._isSearching=!1,this._store.dispatch((0,c.activateChoices)(!0))):f&&this._handleSearch(this.input.value)}this._canSearch=this.config.searchEnabled}}},{key:"_onAKey",value:function(e){var t=e.hasItems;e.hasCtrlDownKeyPressed&&t&&(this._canSearch=!1,this.config.removeItems&&!this.input.value&&this.input.element===document.activeElement&&this.highlightAll())}},{key:"_onEnterKey",value:function(e){var t=e.event,n=e.target,i=e.activeItems,s=e.hasActiveDropdown,o=a.KEY_CODES.ENTER_KEY,r=n.hasAttribute("data-button");if(this._isTextElement&&n.value){var l=this.input.value;this._canAddItem(i,l).response&&(this.hideDropdown(!0),this._addItem({value:l}),this._triggerChange(l),this.clearInput())}if(r&&(this._handleButtonAction(i,n),t.preventDefault()),s){var c=this.dropdown.getChild(".".concat(this.config.classNames.highlightedState));c&&(i[0]&&(i[0].keyCode=o),this._handleChoiceAction(i,c)),t.preventDefault()}else this._isSelectOneElement&&(this.showDropdown(),t.preventDefault())}},{key:"_onEscapeKey",value:function(e){e.hasActiveDropdown&&(this.hideDropdown(!0),this.containerOuter.focus())}},{key:"_onDirectionKey",value:function(e){var t=e.event,n=e.hasActiveDropdown,i=e.keyCode,s=e.metaKey,o=a.KEY_CODES.DOWN_KEY,r=a.KEY_CODES.PAGE_UP_KEY,l=a.KEY_CODES.PAGE_DOWN_KEY;if(n||this._isSelectOneElement){this.showDropdown(),this._canSearch=!1;var c,u=i===o||i===l?1:-1;if(s||i===l||i===r)c=u>0?Array.from(this.dropdown.element.querySelectorAll("[data-choice-selectable]")).pop():this.dropdown.element.querySelector("[data-choice-selectable]");else{var h=this.dropdown.element.querySelector(".".concat(this.config.classNames.highlightedState));c=h?(0,p.getAdjacentEl)(h,"[data-choice-selectable]",u):this.dropdown.element.querySelector("[data-choice-selectable]")}c&&((0,p.isScrolledIntoView)(c,this.choiceList.element,u)||this.choiceList.scrollToChoice(c,u),this._highlightChoice(c)),t.preventDefault()}}},{key:"_onDeleteKey",value:function(e){var t=e.event,n=e.target,i=e.hasFocusedInput,s=e.activeItems;!i||n.value||this._isSelectOneElement||(this._handleBackspace(s),t.preventDefault())}},{key:"_onTouchMove",value:function(){this._wasTap&&(this._wasTap=!1)}},{key:"_onTouchEnd",value:function(e){var t=(e||e.touches[0]).target;this._wasTap&&this.containerOuter.element.contains(t)&&((t===this.containerOuter.element||t===this.containerInner.element)&&(this._isTextElement?this.input.focus():this._isSelectMultipleElement&&this.showDropdown()),e.stopPropagation());this._wasTap=!0}},{key:"_onMouseDown",value:function(e){var t=e.target,n=e.shiftKey;if(t===this.choiceList&&(0,p.isIE11)()&&(this._isScrollingOnIe=!0),this.containerOuter.element.contains(t)&&t!==this.input.element){var i=this._store.activeItems,s=n,o=(0,p.findAncestorByAttrName)(t,"data-button"),r=(0,p.findAncestorByAttrName)(t,"data-item"),a=(0,p.findAncestorByAttrName)(t,"data-choice");o?this._handleButtonAction(i,o):r?this._handleItemAction(i,r,s):a&&this._handleChoiceAction(i,a),e.preventDefault()}}},{key:"_onMouseOver",value:function(e){var t=e.target;(t===this.dropdown||this.dropdown.element.contains(t))&&t.hasAttribute("data-choice")&&this._highlightChoice(t)}},{key:"_onClick",value:function(e){var t=e.target;this.containerOuter.element.contains(t)?this.dropdown.isActive||this.containerOuter.isDisabled?this._isSelectOneElement&&t!==this.input.element&&!this.dropdown.element.contains(t)&&this.hideDropdown():this._isTextElement?document.activeElement!==this.input.element&&this.input.focus():(this.showDropdown(),this.containerOuter.focus()):(this._store.highlightedActiveItems&&this.unhighlightAll(),this.containerOuter.removeFocusState(),this.hideDropdown(!0))}},{key:"_onFocus",value:function(e){var t=this,n=e.target;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(!0)},"select-multiple":function(){n===t.input.element&&(t.showDropdown(!0),t.containerOuter.addFocusState())}}[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.activeItems.some(function(e){return e.highlighted});({text:function(){n===t.input.element&&(t.containerOuter.removeFocusState(),i&&t.unhighlightAll(),t.hideDropdown(!0))},"select-one":function(){t.containerOuter.removeFocusState(),(n===t.input.element||n===t.containerOuter.element&&!t._canSearch)&&t.hideDropdown(!0)},"select-multiple":function(){n===t.input.element&&(t.containerOuter.removeFocusState(),t.hideDropdown(!0),i&&t.unhighlightAll())}})[this.passedElement.element.type]()}else this._isScrollingOnIe=!1,this.input.element.focus()}},{key:"_onFormReset",value:function(){this._store.dispatch((0,d.resetTo)(this._initialState))}},{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]"));if(n.length){var i=t;Array.from(this.dropdown.element.querySelectorAll(".".concat(this.config.classNames.highlightedState))).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"),this.passedElement.triggerEvent(a.EVENTS.highlightChoice,{el:i}),this.dropdown.isActive&&(this.input.setActiveDescendant(i.id),this.containerOuter.setActiveDescendant(i.id))}}},{key:"_addItem",value:function(e){var t=e.value,n=e.label,i=void 0===n?null:n,s=e.choiceId,o=void 0===s?-1:s,r=e.groupId,l=void 0===r?-1:r,c=e.customProperties,h=void 0===c?null:c,d=e.placeholder,f=void 0!==d&&d,m=e.keyCode,v=void 0===m?null:m,g=(0,p.isType)("String",t)?t.trim():t,_=v,y=h,b=this._store.items,E=i||g,S=parseInt(o,10)||-1,I=l>=0?this._store.getGroupById(l):null,O=b?b.length+1:1;return this.config.prependValue&&(g=this.config.prependValue+g.toString()),this.config.appendValue&&(g+=this.config.appendValue.toString()),this._store.dispatch((0,u.addItem)({value:g,label:E,id:O,choiceId:S,groupId:l,customProperties:h,placeholder:f,keyCode:_})),this._isSelectOneElement&&this.removeActiveItems(O),this.passedElement.triggerEvent(a.EVENTS.addItem,{id:O,value:g,label:E,customProperties:y,groupValue:I&&I.value?I.value:void 0,keyCode:_}),this}},{key:"_removeItem",value:function(e){if(!e||!(0,p.isType)("Object",e))return this;var t=e.id,n=e.value,i=e.label,s=e.choiceId,o=e.groupId,r=o>=0?this._store.getGroupById(o):null;return this._store.dispatch((0,u.removeItem)(t,s)),r&&r.value?this.passedElement.triggerEvent(a.EVENTS.removeItem,{id:t,value:n,label:i,groupValue:r.value}):this.passedElement.triggerEvent(a.EVENTS.removeItem,{id:t,value:n,label:i}),this}},{key:"_addChoice",value:function(e){var t=e.value,n=e.label,i=void 0===n?null:n,s=e.isSelected,o=void 0!==s&&s,r=e.isDisabled,a=void 0!==r&&r,l=e.groupId,u=void 0===l?-1:l,h=e.customProperties,d=void 0===h?null:h,f=e.placeholder,p=void 0!==f&&f,m=e.keyCode,v=void 0===m?null:m;if(null!=t){var g=this._store.choices,_=i||t,y=g?g.length+1:1,b="".concat(this._baseId,"-").concat(this._idNames.itemChoice,"-").concat(y);this._store.dispatch((0,c.addChoice)({value:t,label:_,id:y,groupId:u,disabled:a,elementId:b,customProperties:d,placeholder:p,keyCode:v})),o&&this._addItem({value:t,label:_,choiceId:y,customProperties:d,placeholder:p,keyCode:v})}}},{key:"_clearChoices",value:function(){this._store.dispatch((0,c.clearChoices)())}},{key:"_addGroup",value:function(e){var t=this,n=e.group,i=e.id,s=e.valueKey,o=void 0===s?"value":s,r=e.labelKey,a=void 0===r?"label":r,l=(0,p.isType)("Object",n)?n.choices:Array.from(n.getElementsByTagName("OPTION")),c=i||Math.floor((new Date).valueOf()*Math.random()),u=!!n.disabled&&n.disabled;if(l){this._store.dispatch((0,h.addGroup)(n.label,c,!0,u));l.forEach(function(e){var n=e.disabled||e.parentNode&&e.parentNode.disabled;t._addChoice({value:e[o],label:(0,p.isType)("Object",e)?e[a]:e.innerHTML,isSelected:e.selected,isDisabled:n,groupId:c,customProperties:e.customProperties,placeholder:e.placeholder})})}else this._store.dispatch((0,h.addGroup)(n.label,n.id,!1,n.disabled))}},{key:"_getTemplate",value:function(e){var t;if(!e)return null;for(var n=this.config,i=n.templates,s=n.classNames,o=arguments.length,r=new Array(o>1?o-1:0),a=1;a<o;a++)r[a-1]=arguments[a];return(t=i[e]).call.apply(t,[this,s].concat(r))}},{key:"_createTemplates",value:function(){var e=this.config.callbackOnCreateTemplates,t={};e&&(0,p.isType)("Function",e)&&(t=e.call(this,p.strToEl)),this.config.templates=(0,s.default)(l.TEMPLATES,t)}},{key:"_createElements",value:function(){this.containerOuter=new r.Container({element:this._getTemplate("containerOuter",this._direction,this._isSelectElement,this._isSelectOneElement,this.config.searchEnabled,this.passedElement.element.type),classNames:this.config.classNames,type:this.passedElement.element.type,position:this.config.position}),this.containerInner=new r.Container({element:this._getTemplate("containerInner"),classNames:this.config.classNames,type:this.passedElement.element.type,position:this.config.position}),this.input=new r.Input({element:this._getTemplate("input"),classNames:this.config.classNames,type:this.passedElement.element.type}),this.choiceList=new r.List({element:this._getTemplate("choiceList",this._isSelectOneElement)}),this.itemList=new r.List({element:this._getTemplate("itemList",this._isSelectOneElement)}),this.dropdown=new r.Dropdown({element:this._getTemplate("dropdown"),classNames:this.config.classNames,type:this.passedElement.element.type})}},{key:"_createStructure",value:function(){this.passedElement.conceal(),this.containerInner.wrap(this.passedElement.element),this.containerOuter.wrap(this.containerInner.element),this._isSelectOneElement?this.input.placeholder=this.config.searchPlaceholderValue||"":this._placeholderValue&&(this.input.placeholder=this._placeholderValue,this.input.setWidth(!0)),this.containerOuter.element.appendChild(this.containerInner.element),this.containerOuter.element.appendChild(this.dropdown.element),this.containerInner.element.appendChild(this.itemList.element),this._isTextElement||this.dropdown.element.appendChild(this.choiceList.element),this._isSelectOneElement?this.config.searchEnabled&&this.dropdown.element.insertBefore(this.input.element,this.dropdown.element.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.optionGroups;if(this._highlightPosition=0,this._isSearching=!1,this._setLoading(!0),t&&t.length){var n=this.passedElement.placeholderOption;n&&"SELECT"===n.parentNode.tagName&&this._addChoice({value:n.value,label:n.innerHTML,isSelected:n.selected,isDisabled:n.disabled,placeholder:!0}),t.forEach(function(t){return e._addGroup({group:t,id:t.id||null})})}else{var i=this.passedElement.options,s=this.config.sortFn,o=this._presetChoices;i.forEach(function(e){o.push({value:e.value,label:e.innerHTML,selected:e.selected,disabled:e.disabled||e.parentNode.disabled,placeholder:e.hasAttribute("placeholder"),customProperties:e.getAttribute("data-custom-properties")})}),this.config.shouldSort&&o.sort(s);var r=o.some(function(e){return e.selected});o.forEach(function(t,n){return function(t,n){var i=t.value,s=t.label,o=t.customProperties,a=t.placeholder;if(e._isSelectElement)if(t.choices)e._addGroup({group:t,id:t.id||null});else{var l=e._isSelectOneElement&&!r&&0===n,c=!!l||t.selected,u=!l&&t.disabled;e._addChoice({value:i,label:s,isSelected:c,isDisabled:u,customProperties:o,placeholder:a})}else e._addChoice({value:i,label:s,isSelected:t.selected,isDisabled:t.disabled,customProperties:o,placeholder:a})}(t,n)})}this._setLoading(!1)}},{key:"_addPredefinedItems",value:function(){var e=this;this._presetItems.forEach(function(t){return function(t){var n=(0,p.getType)(t);"Object"===n&&t.value?e._addItem({value:t.value,label:t.label,choiceId:t.id,customProperties:t.customProperties,placeholder:t.placeholder}):"String"===n&&e._addItem({value:t})}(t)})}},{key:"_setChoiceOrItem",value:function(e){var t=this;({object:function(){e.value&&(t._isTextElement?t._addItem({value:e.value,label:e.label,choiceId:e.id,customProperties:e.customProperties,placeholder:e.placeholder}):t._addChoice({value:e.value,label:e.label,isSelected:!0,isDisabled:!1,customProperties:e.customProperties,placeholder:e.placeholder}))},string:function(){t._isTextElement?t._addItem({value:e}):t._addChoice({value:e,label:e,isSelected:!0,isDisabled:!1})}})[(0,p.getType)(e).toLowerCase()]()}},{key:"_findAndSelectChoiceByValue",value:function(e){var t=this,n=this._store.choices.find(function(n){return t.config.itemComparer(n.value,e)});n&&!n.selected&&this._addItem({value:n.value,label:n.label,choiceId:n.id,groupId:n.groupId,customProperties:n.customProperties,placeholder:n.placeholder,keyCode:n.keyCode})}},{key:"_generateInstances",value:function(t,n){return t.reduce(function(t,i){return t.push(new e(i,n)),t},[this])}},{key:"_generatePlaceholderValue",value:function(){return!this._isSelectOneElement&&(!!this.config.placeholder&&(this.config.placeholderValue||this.passedElement.element.getAttribute("placeholder")))}}])&&g(t.prototype,n),m&&g(t,m),e}();_.userDefaults={},e.exports=_},function(e,t,n){
/*!
* Fuse.js v3.4.1 - Lightweight fuzzy-search (http://fusejs.io)
*
* Copyright (c) 2012-2017 Kirollos Risk (http://kiro.me)
* All Rights Reserved. Apache Software License 2.0
*
* http://www.apache.org/licenses/LICENSE-2.0
*/
var i;i=function(){return function(e){var t={};function n(i){if(t[i])return t[i].exports;var s=t[i]={i:i,l:!1,exports:{}};return e[i].call(s.exports,s,s.exports,n),s.l=!0,s.exports}return n.m=e,n.c=t,n.d=function(e,t,i){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:i})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var i=Object.create(null);if(n.r(i),Object.defineProperty(i,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var s in e)n.d(i,s,function(t){return e[t]}.bind(null,s));return i},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s="./src/index.js")}({"./src/bitap/bitap_matched_indices.js":
/*!********************************************!*\
!*** ./src/bitap/bitap_matched_indices.js ***!
\********************************************/
/*! no static exports found */function(e,t){e.exports=((e=[],t=1)=>{let n=[],i=-1,s=-1,o=0;for(let r=e.length;o<r;o+=1){let r=e[o];r&&-1===i?i=o:r||-1===i||((s=o-1)-i+1>=t&&n.push([i,s]),i=-1)}return e[o-1]&&o-i>=t&&n.push([i,o-1]),n})},"./src/bitap/bitap_pattern_alphabet.js":
/*!*********************************************!*\
!*** ./src/bitap/bitap_pattern_alphabet.js ***!
\*********************************************/
/*! no static exports found */function(e,t){e.exports=(e=>{let t={},n=e.length;for(let i=0;i<n;i+=1)t[e.charAt(i)]=0;for(let i=0;i<n;i+=1)t[e.charAt(i)]|=1<<n-i-1;return t})},"./src/bitap/bitap_regex_search.js":
/*!*****************************************!*\
!*** ./src/bitap/bitap_regex_search.js ***!
\*****************************************/
/*! no static exports found */function(e,t){const n=/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g;e.exports=((e,t,i=/ +/g)=>{let s=new RegExp(t.replace(n,"\\$&").replace(i,"|")),o=e.match(s),r=!!o,a=[];if(r)for(let t=0,n=o.length;t<n;t+=1){let n=o[t];a.push([e.indexOf(n),n.length-1])}return{score:r?.5:1,isMatch:r,matchedIndices:a}})},"./src/bitap/bitap_score.js":
/*!**********************************!*\
!*** ./src/bitap/bitap_score.js ***!
\**********************************/
/*! no static exports found */function(e,t){e.exports=((e,{errors:t=0,currentLocation:n=0,expectedLocation:i=0,distance:s=100})=>{const o=t/e.length,r=Math.abs(i-n);return s?o+r/s:r?1:o})},"./src/bitap/bitap_search.js":
/*!***********************************!*\
!*** ./src/bitap/bitap_search.js ***!
\***********************************/
/*! no static exports found */function(e,t,n){const i=n(/*! ./bitap_score */"./src/bitap/bitap_score.js"),s=n(/*! ./bitap_matched_indices */"./src/bitap/bitap_matched_indices.js");e.exports=((e,t,n,{location:o=0,distance:r=100,threshold:a=.6,findAllMatches:l=!1,minMatchCharLength:c=1})=>{const u=o,h=e.length;let d=a,f=e.indexOf(t,u);const p=t.length,m=[];for(let e=0;e<h;e+=1)m[e]=0;if(-1!==f){let n=i(t,{errors:0,currentLocation:f,expectedLocation:u,distance:r});if(d=Math.min(n,d),-1!==(f=e.lastIndexOf(t,u+p))){let e=i(t,{errors:0,currentLocation:f,expectedLocation:u,distance:r});d=Math.min(e,d)}}f=-1;let v=[],g=1,_=p+h;const y=1<<p-1;for(let s=0;s<p;s+=1){let o=0,a=_;for(;o<a;){i(t,{errors:s,currentLocation:u+a,expectedLocation:u,distance:r})<=d?o=a:_=a,a=Math.floor((_-o)/2+o)}_=a;let c=Math.max(1,u-a+1),b=l?h:Math.min(u+a,h)+p,E=Array(b+2);E[b+1]=(1<<s)-1;for(let o=b;o>=c;o-=1){let a=o-1,l=n[e.charAt(a)];if(l&&(m[a]=1),E[o]=(E[o+1]<<1|1)&l,0!==s&&(E[o]|=(v[o+1]|v[o])<<1|1|v[o+1]),E[o]&y&&(g=i(t,{errors:s,currentLocation:a,expectedLocation:u,distance:r}))<=d){if(d=g,(f=a)<=u)break;c=Math.max(1,2*u-f)}}if(i(t,{errors:s+1,currentLocation:u,expectedLocation:u,distance:r})>d)break;v=E}return{isMatch:f>=0,score:0===g?.001:g,matchedIndices:s(m,c)}})},"./src/bitap/index.js":
/*!****************************!*\
!*** ./src/bitap/index.js ***!
\****************************/
/*! no static exports found */function(e,t,n){const i=n(/*! ./bitap_regex_search */"./src/bitap/bitap_regex_search.js"),s=n(/*! ./bitap_search */"./src/bitap/bitap_search.js"),o=n(/*! ./bitap_pattern_alphabet */"./src/bitap/bitap_pattern_alphabet.js");e.exports=class{constructor(e,{location:t=0,distance:n=100,threshold:i=.6,maxPatternLength:s=32,isCaseSensitive:r=!1,tokenSeparator:a=/ +/g,findAllMatches:l=!1,minMatchCharLength:c=1}){this.options={location:t,distance:n,threshold:i,maxPatternLength:s,isCaseSensitive:r,tokenSeparator:a,findAllMatches:l,minMatchCharLength:c},this.pattern=this.options.isCaseSensitive?e:e.toLowerCase(),this.pattern.length<=s&&(this.patternAlphabet=o(this.pattern))}search(e){if(this.options.isCaseSensitive||(e=e.toLowerCase()),this.pattern===e)return{isMatch:!0,score:0,matchedIndices:[[0,e.length-1]]};const{maxPatternLength:t,tokenSeparator:n}=this.options;if(this.pattern.length>t)return i(e,this.pattern,n);const{location:o,distance:r,threshold:a,findAllMatches:l,minMatchCharLength:c}=this.options;return s(e,this.pattern,this.patternAlphabet,{location:o,distance:r,threshold:a,findAllMatches:l,minMatchCharLength:c})}}},"./src/helpers/deep_value.js":
/*!***********************************!*\
!*** ./src/helpers/deep_value.js ***!
\***********************************/
/*! no static exports found */function(e,t,n){const i=n(/*! ./is_array */"./src/helpers/is_array.js"),s=(e,t,n)=>{if(t){const o=t.indexOf(".");let r=t,a=null;-1!==o&&(r=t.slice(0,o),a=t.slice(o+1));const l=e[r];if(null!=l)if(a||"string"!=typeof l&&"number"!=typeof l)if(i(l))for(let e=0,t=l.length;e<t;e+=1)s(l[e],a,n);else a&&s(l,a,n);else n.push(l.toString())}else n.push(e);return n};e.exports=((e,t)=>s(e,t,[]))},"./src/helpers/is_array.js":
/*!*********************************!*\
!*** ./src/helpers/is_array.js ***!
\*********************************/
/*! no static exports found */function(e,t){e.exports=(e=>Array.isArray?Array.isArray(e):"[object Array]"===Object.prototype.toString.call(e))},"./src/index.js":
/*!**********************!*\
!*** ./src/index.js ***!
\**********************/
/*! no static exports found */function(e,t,n){const i=n(/*! ./bitap */"./src/bitap/index.js"),s=n(/*! ./helpers/deep_value */"./src/helpers/deep_value.js"),o=n(/*! ./helpers/is_array */"./src/helpers/is_array.js");e.exports=class{constructor(e,{location:t=0,distance:n=100,threshold:i=.6,maxPatternLength:o=32,caseSensitive:r=!1,tokenSeparator:a=/ +/g,findAllMatches:l=!1,minMatchCharLength:c=1,id:u=null,keys:h=[],shouldSort:d=!0,getFn:f=s,sortFn:p=((e,t)=>e.score-t.score),tokenize:m=!1,matchAllTokens:v=!1,includeMatches:g=!1,includeScore:_=!1,verbose:y=!1}){this.options={location:t,distance:n,threshold:i,maxPatternLength:o,isCaseSensitive:r,tokenSeparator:a,findAllMatches:l,minMatchCharLength:c,id:u,keys:h,includeMatches:g,includeScore:_,shouldSort:d,getFn:f,sortFn:p,verbose:y,tokenize:m,matchAllTokens:v},this.setCollection(e)}setCollection(e){return this.list=e,e}search(e,t={limit:!1}){this._log(`---------\nSearch pattern: "${e}"`);const{tokenSearchers:n,fullSearcher:i}=this._prepareSearchers(e);let{weights:s,results:o}=this._search(n,i);return this._computeScore(s,o),this.options.shouldSort&&this._sort(o),t.limit&&"number"==typeof t.limit&&(o=o.slice(0,t.limit)),this._format(o)}_prepareSearchers(e=""){const t=[];if(this.options.tokenize){const n=e.split(this.options.tokenSeparator);for(let e=0,s=n.length;e<s;e+=1)t.push(new i(n[e],this.options))}return{tokenSearchers:t,fullSearcher:new i(e,this.options)}}_search(e=[],t){const n=this.list,i={},s=[];if("string"==typeof n[0]){for(let o=0,r=n.length;o<r;o+=1)this._analyze({key:"",value:n[o],record:o,index:o},{resultMap:i,results:s,tokenSearchers:e,fullSearcher:t});return{weights:null,results:s}}const o={};for(let r=0,a=n.length;r<a;r+=1){let a=n[r];for(let n=0,l=this.options.keys.length;n<l;n+=1){let l=this.options.keys[n];if("string"!=typeof l){if(o[l.name]={weight:1-l.weight||1},l.weight<=0||l.weight>1)throw new Error("Key weight has to be > 0 and <= 1");l=l.name}else o[l]={weight:1};this._analyze({key:l,value:this.options.getFn(a,l),record:a,index:r},{resultMap:i,results:s,tokenSearchers:e,fullSearcher:t})}}return{weights:o,results:s}}_analyze({key:e,arrayIndex:t=-1,value:n,record:i,index:s},{tokenSearchers:r=[],fullSearcher:a=[],resultMap:l={},results:c=[]}){if(null==n)return;let u=!1,h=-1,d=0;if("string"==typeof n){this._log(`\nKey: ${""===e?"-":e}`);let o=a.search(n);if(this._log(`Full text: "${n}", score: ${o.score}`),this.options.tokenize){let e=n.split(this.options.tokenSeparator),t=[];for(let n=0;n<r.length;n+=1){let i=r[n];this._log(`\nPattern: "${i.pattern}"`);let s=!1;for(let n=0;n<e.length;n+=1){let o=e[n],r=i.search(o),a={};r.isMatch?(a[o]=r.score,u=!0,s=!0,t.push(r.score)):(a[o]=1,this.options.matchAllTokens||t.push(1)),this._log(`Token: "${o}", score: ${a[o]}`)}s&&(d+=1)}h=t[0];let i=t.length;for(let e=1;e<i;e+=1)h+=t[e];h/=i,this._log("Token score average:",h)}let f=o.score;h>-1&&(f=(f+h)/2),this._log("Score average:",f);let p=!this.options.tokenize||!this.options.matchAllTokens||d>=r.length;if(this._log(`\nCheck Matches: ${p}`),(u||o.isMatch)&&p){let r=l[s];r?r.output.push({key:e,arrayIndex:t,value:n,score:f,matchedIndices:o.matchedIndices}):(l[s]={item:i,output:[{key:e,arrayIndex:t,value:n,score:f,matchedIndices:o.matchedIndices}]},c.push(l[s]))}}else if(o(n))for(let t=0,o=n.length;t<o;t+=1)this._analyze({key:e,arrayIndex:t,value:n[t],record:i,index:s},{resultMap:l,results:c,tokenSearchers:r,fullSearcher:a})}_computeScore(e,t){this._log("\n\nComputing score:\n");for(let n=0,i=t.length;n<i;n+=1){const i=t[n].output,s=i.length;let o=1,r=1;for(let t=0;t<s;t+=1){let n=e?e[i[t].key].weight:1,s=(1===n?i[t].score:i[t].score||.001)*n;1!==n?r=Math.min(r,s):(i[t].nScore=s,o*=s)}t[n].score=1===r?o:r,this._log(t[n])}}_sort(e){this._log("\n\nSorting...."),e.sort(this.options.sortFn)}_format(e){const t=[];if(this.options.verbose){let t=[];this._log("\n\nOutput:\n\n",JSON.stringify(e,function(e,n){if("object"==typeof n&&null!==n){if(-1!==t.indexOf(n))return;t.push(n)}return n})),t=null}let n=[];this.options.includeMatches&&n.push((e,t)=>{const n=e.output;t.matches=[];for(let e=0,i=n.length;e<i;e+=1){let i=n[e];if(0===i.matchedIndices.length)continue;let s={indices:i.matchedIndices,value:i.value};i.key&&(s.key=i.key),i.hasOwnProperty("arrayIndex")&&i.arrayIndex>-1&&(s.arrayIndex=i.arrayIndex),t.matches.push(s)}}),this.options.includeScore&&n.push((e,t)=>{t.score=e.score});for(let i=0,s=e.length;i<s;i+=1){const s=e[i];if(this.options.id&&(s.item=this.options.getFn(s.item,this.options.id)[0]),!n.length){t.push(s.item);continue}const o={item:s.item};for(let e=0,t=n.length;e<t;e+=1)n[e](s,o);t.push(o)}return t}_log(){this.options.verbose&&console.log(...arguments)}}}})},e.exports=i()},function(e,t,n){"use strict";n.r(t);var i=function(e){return function(e){return!!e&&"object"==typeof e}(e)&&!function(e){var t=Object.prototype.toString.call(e);return"[object RegExp]"===t||"[object Date]"===t||function(e){return e.$$typeof===s}(e)}(e)};var s="function"==typeof Symbol&&Symbol.for?Symbol.for("react.element"):60103;function o(e,t){return!1!==t.clone&&t.isMergeableObject(e)?a((n=e,Array.isArray(n)?[]:{}),e,t):e;var n}function r(e,t,n){return e.concat(t).map(function(e){return o(e,n)})}function a(e,t,n){(n=n||{}).arrayMerge=n.arrayMerge||r,n.isMergeableObject=n.isMergeableObject||i;var s=Array.isArray(t);return s===Array.isArray(e)?s?n.arrayMerge(e,t,n):function(e,t,n){var i={};return n.isMergeableObject(e)&&Object.keys(e).forEach(function(t){i[t]=o(e[t],n)}),Object.keys(t).forEach(function(s){n.isMergeableObject(t[s])&&e[s]?i[s]=a(e[s],t[s],n):i[s]=o(t[s],n)}),i}(e,t,n):o(t,n)}a.all=function(e,t){if(!Array.isArray(e))throw new Error("first argument should be an array");return e.reduce(function(e,n){return a(e,n,t)},{})};var l=a;t.default=l},function(e,t,n){"use strict";n(14)},function(e,t){try{var n=new window.CustomEvent("test");if(n.preventDefault(),!0!==n.defaultPrevented)throw new Error("Could not prevent default")}catch(e){var i=function(e,t){var n,i;return t=t||{bubbles:!1,cancelable:!1,detail:void 0},(n=document.createEvent("CustomEvent")).initCustomEvent(e,t.bubbles,t.cancelable,t.detail),i=n.preventDefault,n.preventDefault=function(){i.call(this);try{Object.defineProperty(this,"defaultPrevented",{get:function(){return!0}})}catch(e){this.defaultPrevented=!0}},n};i.prototype=window.Event.prototype,window.CustomEvent=i}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i,s=n(6),o=(i=n(17))&&i.__esModule?i:{default:i};function r(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)}}var a=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this._store=(0,s.createStore)(o.default,window.__REDUX_DEVTOOLS_EXTENSION__&&window.__REDUX_DEVTOOLS_EXTENSION__())}var t,n,i;return t=e,(n=[{key:"subscribe",value:function(e){this._store.subscribe(e)}},{key:"dispatch",value:function(e){this._store.dispatch(e)}},{key:"isLoading",value:function(){return this.state.general.loading}},{key:"getChoiceById",value:function(e){return!!e&&this.activeChoices.find(function(t){return t.id===parseInt(e,10)})}},{key:"getGroupById",value:function(e){return this.groups.find(function(t){return t.id===parseInt(e,10)})}},{key:"state",get:function(){return this._store.getState()}},{key:"items",get:function(){return this.state.items}},{key:"activeItems",get:function(){return this.items.filter(function(e){return!0===e.active})}},{key:"highlightedActiveItems",get:function(){return this.items.filter(function(e){return e.active&&e.highlighted})}},{key:"choices",get:function(){return this.state.choices}},{key:"activeChoices",get:function(){return this.choices.filter(function(e){return!0===e.active})}},{key:"selectableChoices",get:function(){return this.choices.filter(function(e){return!0!==e.disabled})}},{key:"searchableChoices",get:function(){return this.selectableChoices.filter(function(e){return!0!==e.placeholder})}},{key:"placeholderChoice",get:function(){return[].concat(this.choices).reverse().find(function(e){return!0===e.placeholder})}},{key:"groups",get:function(){return this.state.groups}},{key:"activeGroups",get:function(){var e=this.groups,t=this.choices;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},[])}}])&&r(t.prototype,n),i&&r(t,i),e}();t.default=a},function(e,t){e.exports=function(e){if(!e.webpackPolyfill){var t=Object.create(e);t.children||(t.children=[]),Object.defineProperty(t,"loaded",{enumerable:!0,get:function(){return t.l}}),Object.defineProperty(t,"id",{enumerable:!0,get:function(){return t.i}}),Object.defineProperty(t,"exports",{enumerable:!0}),t.webpackPolyfill=1}return t}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=n(6),s=c(n(18)),o=c(n(19)),r=c(n(20)),a=c(n(21)),l=n(0);function c(e){return e&&e.__esModule?e:{default:e}}var u=(0,i.combineReducers)({items:s.default,groups:o.default,choices:r.default,general:a.default}),h=function(e,t){var n=e;if("CLEAR_ALL"===t.type)n=void 0;else if("RESET_TO"===t.type)return(0,l.cloneObject)(t.state);return u(n,t)};t.default=h},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:i,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"ADD_ITEM":var n=[].concat(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}]);return n.map(function(e){var t=e;return 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}},t.defaultState=void 0;var i=[];t.defaultState=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:i,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"ADD_GROUP":return[].concat(e,[{id:t.id,value:t.value,active:t.active,disabled:t.disabled}]);case"CLEAR_CHOICES":return[];default:return e}},t.defaultState=void 0;var i=[];t.defaultState=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:i,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"ADD_CHOICE":return[].concat(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 i;default:return e}},t.defaultState=void 0;var i=[];t.defaultState=i},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=t.defaultState=void 0;var i={loading:!1};t.defaultState=i;var s=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:i,t=arguments.length>1?arguments[1]:void 0;switch(t.type){case"SET_IS_LOADING":return{loading:t.isLoading};default:return e}};t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"Dropdown",{enumerable:!0,get:function(){return i.default}}),Object.defineProperty(t,"Container",{enumerable:!0,get:function(){return s.default}}),Object.defineProperty(t,"Input",{enumerable:!0,get:function(){return o.default}}),Object.defineProperty(t,"List",{enumerable:!0,get:function(){return r.default}}),Object.defineProperty(t,"WrappedInput",{enumerable:!0,get:function(){return a.default}}),Object.defineProperty(t,"WrappedSelect",{enumerable:!0,get:function(){return l.default}});var i=c(n(23)),s=c(n(24)),o=c(n(25)),r=c(n(26)),a=c(n(27)),l=c(n(28));function c(e){return e&&e.__esModule?e:{default:e}}},function(e,t,n){"use strict";function i(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)}}Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var s=function(){function e(t){var n=t.element,i=t.type,s=t.classNames;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Object.assign(this,{element:n,type:i,classNames:s}),this.isActive=!1}var t,n,s;return t=e,(n=[{key:"distanceFromTopWindow",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}},{key:"hide",value:function(){return this.element.classList.remove(this.classNames.activeState),this.element.setAttribute("aria-expanded","false"),this.isActive=!1,this}}])&&i(t.prototype,n),s&&i(t,s),e}();t.default=s},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=n(0);function s(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)}}var o=function(){function e(t){var n=t.element,i=t.type,s=t.classNames,o=t.position;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Object.assign(this,{element:n,classNames:s,type:i,position:o}),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)}var t,n,o;return t=e,(n=[{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:"shouldFlip",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:(0,i.getWindowHeight)();if(void 0===e)return!1;var n=!1;return"auto"===this.position?n=e>=t:"top"===this.position&&(n=!0),n}},{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.classNames.disabledState),this.element.removeAttribute("aria-disabled"),"select-one"===this.type&&this.element.setAttribute("tabindex","0"),this.isDisabled=!1}},{key:"disable",value:function(){this.element.classList.add(this.classNames.disabledState),this.element.setAttribute("aria-disabled","true"),"select-one"===this.type&&this.element.setAttribute("tabindex","-1"),this.isDisabled=!0}},{key:"wrap",value:function(e){(0,i.wrap)(e,this.element)}},{key:"unwrap",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}},{key:"_onFocus",value:function(){this.isFocussed=!0}},{key:"_onBlur",value:function(){this.isFocussed=!1}}])&&s(t.prototype,n),o&&s(t,o),e}();t.default=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=n(0);function s(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)}}var o=function(){function e(t){var n=t.element,i=t.type,s=t.classNames,o=t.placeholderValue;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Object.assign(this,{element:n,type:i,classNames:s,placeholderValue:o}),this.element=n,this.classNames=s,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)}var t,n,o;return t=e,(n=[{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),this.element.form&&this.element.form.addEventListener("reset",this._onFormReset)}},{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),this.element.form&&this.element.form.removeEventListener("reset",this._onFormReset)}},{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:"blur",value:function(){this.isFocussed&&this.element.blur()}},{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}},{key:"setWidth",value:function(e){var t=this,n=function(e){t.element.style.width=e};if(this._placeholderValue){var i=this.element.value.length>=this._placeholderValue.length/1.25;(this.element.value&&i||e)&&this.calcWidth(n)}else this.calcWidth(n)}},{key:"calcWidth",value:function(e){return(0,i.calcWidthOfInput)(this.element,e)}},{key:"setActiveDescendant",value:function(e){this.element.setAttribute("aria-activedescendant",e)}},{key:"removeActiveDescendant",value:function(){this.element.removeAttribute("aria-activedescendant")}},{key:"_onInput",value:function(){"select-one"!==this.type&&this.setWidth()}},{key:"_onPaste",value:function(e){e.target===this.element&&this.preventPaste&&e.preventDefault()}},{key:"_onFocus",value:function(){this.isFocussed=!0}},{key:"_onBlur",value:function(){this.isFocussed=!1}},{key:"placeholder",set:function(e){this.element.placeholder=e}},{key:"value",set:function(e){this.element.value=e},get:function(){return(0,i.sanitise)(this.element.value)}}])&&s(t.prototype,n),o&&s(t,o),e}();t.default=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=n(1);function s(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)}}var o=function(){function e(t){var n=t.element;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),Object.assign(this,{element:n}),this.scrollPos=this.element.scrollTop,this.height=this.element.offsetHeight,this.hasChildren=!!this.element.children}var t,n,o;return t=e,(n=[{key:"clear",value:function(){this.element.innerHTML=""}},{key:"append",value:function(e){this.element.appendChild(e)}},{key:"getChild",value:function(e){return this.element.querySelector(e)}},{key:"scrollToTop",value:function(){this.element.scrollTop=0}},{key:"scrollToChoice",value:function(e,t){var n=this;if(e){var i=this.element.offsetHeight,s=e.offsetHeight,o=e.offsetTop+s,r=this.element.scrollTop+i,a=t>0?this.element.scrollTop+o-r:e.offsetTop;requestAnimationFrame(function(e){n._animateScroll(e,a,t)})}}},{key:"_scrollDown",value:function(e,t,n){var i=(n-e)/t,s=i>1?i:1;this.element.scrollTop=e+s}},{key:"_scrollUp",value:function(e,t,n){var i=(e-n)/t,s=i>1?i:1;this.element.scrollTop=e-s}},{key:"_animateScroll",value:function(e,t,n){var s=this,o=i.SCROLLING_SPEED,r=this.element.scrollTop,a=!1;n>0?(this._scrollDown(r,o,t),r<t&&(a=!0)):(this._scrollUp(r,o,t),r>t&&(a=!0)),a&&requestAnimationFrame(function(){s._animateScroll(e,t,n)})}}])&&s(t.prototype,n),o&&s(t,o),e}();t.default=o},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i,s=(i=n(4))&&i.__esModule?i:{default:i};function o(e){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function r(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)}}function a(e,t){return!t||"object"!==o(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function l(e,t,n){return(l="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(e,t,n){var i=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=c(e)););return e}(e,t);if(i){var s=Object.getOwnPropertyDescriptor(i,t);return s.get?s.get.call(n):s.value}})(e,t,n||e)}function c(e){return(c=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function u(e,t){return(u=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var h=function(e){function t(e){var n,i=e.element,s=e.classNames,o=e.delimiter;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(n=a(this,c(t).call(this,{element:i,classNames:s}))).delimiter=o,n}var n,i,o;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&u(e,t)}(t,s.default),n=t,(i=[{key:"value",set:function(e){var t=e.map(function(e){return e.value}).join(this.delimiter);this.element.setAttribute("value",t),this.element.value=t},get:function(){return l(c(t.prototype),"value",this)}}])&&r(n.prototype,i),o&&r(n,o),t}();t.default=h},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=o(n(4)),s=o(n(5));function o(e){return e&&e.__esModule?e:{default:e}}function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function a(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)}}function l(e,t){return!t||"object"!==r(t)&&"function"!=typeof t?function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e):t}function c(e){return(c=Object.setPrototypeOf?Object.getPrototypeOf:function(e){return e.__proto__||Object.getPrototypeOf(e)})(e)}function u(e,t){return(u=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e})(e,t)}var h=function(e){function t(e){var n=e.element,i=e.classNames;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),l(this,c(t).call(this,{element:n,classNames:i}))}var n,o,r;return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),t&&u(e,t)}(t,i.default),n=t,(o=[{key:"appendDocFragment",value:function(e){this.element.innerHTML="",this.element.appendChild(e)}},{key:"placeholderOption",get:function(){return this.element.querySelector("option[placeholder]")}},{key:"optionGroups",get:function(){return Array.from(this.element.getElementsByTagName("OPTGROUP"))}},{key:"options",get:function(){return Array.from(this.element.options)},set:function(e){var t=document.createDocumentFragment();e.forEach(function(e){return n=e,i=s.default.option(n),void t.appendChild(i);var n,i}),this.appendDocFragment(t)}}])&&a(n.prototype,o),r&&a(n,r),t}();t.default=h},function(e,t,n){var i;
/*!
Copyright (c) 2017 Jed Watson.
Licensed under the MIT License (MIT), see
http://jedwatson.github.io/classnames
*/
/*!
Copyright (c) 2017 Jed Watson.
Licensed under the MIT License (MIT), see
http://jedwatson.github.io/classnames
*/
!function(){"use strict";var n={}.hasOwnProperty;function s(){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)&&i.length){var r=s.apply(null,i);r&&e.push(r)}else if("object"===o)for(var a in i)n.call(i,a)&&i[a]&&e.push(a)}}return e.join(" ")}e.exports?(s.default=s,e.exports=s):void 0===(i=function(){return s}.apply(t,[]))||(e.exports=i)}()},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.clearChoices=t.activateChoices=t.filterChoices=t.addChoice=void 0;var i=n(1);t.addChoice=function(e){var t=e.value,n=e.label,s=e.id,o=e.groupId,r=e.disabled,a=e.elementId,l=e.customProperties,c=e.placeholder,u=e.keyCode;return{type:i.ACTION_TYPES.ADD_CHOICE,value:t,label:n,id:s,groupId:o,disabled:r,elementId:a,customProperties:l,placeholder:c,keyCode:u}};t.filterChoices=function(e){return{type:i.ACTION_TYPES.FILTER_CHOICES,results:e}};t.activateChoices=function(){var e=!(arguments.length>0&&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){var t=e.value,n=e.label,s=e.id,o=e.choiceId,r=e.groupId,a=e.customProperties,l=e.placeholder,c=e.keyCode;return{type:i.ACTION_TYPES.ADD_ITEM,value:t,label:n,id:s,choiceId:o,groupId:r,customProperties:a,placeholder:l,keyCode:c}};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,s){return{type:i.ACTION_TYPES.ADD_GROUP,value:e,id:t,active:n,disabled:s}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.resetTo=t.clearAll=void 0;t.clearAll=function(){return{type:"CLEAR_ALL"}};t.resetTo=function(e){return{type:"RESET_TO",state:e}}},function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.setIsLoading=void 0;t.setIsLoading=function(e){return{type:"SET_IS_LOADING",isLoading:e}}}])});