\\n \\n ')},containerInner:function(e){return(0,s.strToEl)('\\n \\n ')},itemList:function(e,t){var n,r=(0,o.default)(e.list,(n={},i(n,e.listSingle,t),i(n,e.listItems,!t),n));return(0,s.strToEl)('\\n \\n ')},placeholder:function(e,t){return(0,s.strToEl)('\\n \\n '+t+\"\\n
\\n \")},item:function(e,t,n){var r,a=t.active?'aria-selected=\"true\"':\"\",c=t.disabled?'aria-disabled=\"true\"':\"\",l=(0,o.default)(e.item,(r={},i(r,e.highlightedState,t.highlighted),i(r,e.itemSelectable,!t.highlighted),i(r,e.placeholder,t.placeholder),r));if(n){var u;return l=(0,o.default)(e.item,(u={},i(u,e.highlightedState,t.highlighted),i(u,e.itemSelectable,!t.disabled),i(u,e.placeholder,t.placeholder),u)),(0,s.strToEl)('\\n \\n \"+t.label+'\\x3c!--\\n --\\x3e\\n
\\n \")}return(0,s.strToEl)('\\n \\n \"+t.label+\"\\n
\\n \")},choiceList:function(e,t){var n=t?\"\":'aria-multiselectable=\"true\"';return(0,s.strToEl)('\\n \\n
\\n \")},choiceGroup:function(e,t){var n=t.disabled?'aria-disabled=\"true\"':\"\",r=(0,o.default)(e.group,i({},e.itemDisabled,t.disabled));return(0,s.strToEl)('\\n \\n \")},choice:function(e,t,n){var r,a=t.groupId>0?'role=\"treeitem\"':'role=\"option\"',c=(0,o.default)(e.item,e.itemChoice,(r={},i(r,e.itemDisabled,t.disabled),i(r,e.itemSelectable,!t.disabled),i(r,e.placeholder,t.placeholder),r));return(0,s.strToEl)('\\n \\n \"+t.label+\"\\n
\\n \")},input:function(e){var t=(0,o.default)(e.input,e.inputCloned);return(0,s.strToEl)('\\n \\n ')},dropdown:function(e){var t=(0,o.default)(e.list,e.listDropdown);return(0,s.strToEl)('\\n \\n
\\n ')},notice:function(e,t){var n,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:\"\",a=(0,o.default)(e.item,e.itemChoice,(n={},i(n,e.noResults,\"no-results\"===r),i(n,e.noChoices,\"no-choices\"===r),n));return(0,s.strToEl)('\\n \\n '+t+\"\\n
\\n \")},option:function(e){return(0,s.strToEl)('\\n \\n \")}};t.default=a},function(e,t,n){e.exports=n(38)},function(e,t,n){\"use strict\";function i(e){return e&&e.__esModule?e:{default:e}}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}function o(e){if(Array.isArray(e)){for(var t=0,n=Array(e.length);t0&&void 0!==arguments[0]?arguments[0]:\"[data-choice]\",n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(s(this,e),(0,E.isType)(\"String\",t)){var i=Array.from(document.querySelectorAll(t));if(i.length>1)return this._generateInstances(i,n)}this.config=h.default.all([v.DEFAULT_CONFIG,e.userDefaults,n]),(0,E.doKeysMatch)(this.config,v.DEFAULT_CONFIG)||console.warn(\"Unknown config option(s) passed\"),[\"auto\",\"always\"].includes(this.config.renderSelectedChoices)||(this.config.renderSelectedChoices=\"auto\");var r=(0,E.isType)(\"String\",t)?document.querySelector(t):t;return r?(this._isTextElement=\"text\"===r.type,this._isSelectOneElement=\"select-one\"===r.type,this._isSelectMultipleElement=\"select-multiple\"===r.type,this._isSelectElement=this._isSelectOneElement||this._isSelectMultipleElement,this._isTextElement?this.passedElement=new p.WrappedInput({element:r,classNames:this.config.classNames,delimiter:this.config.delimiter}):this._isSelectElement&&(this.passedElement=new p.WrappedSelect({element:r,classNames:this.config.classNames})),r?(!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 f.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,E.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\")}return a(e,[{key:\"init\",value:function(){if(!this.initialised){this._createTemplates(),this._createElements(),this._createStructure(),this._initialState=(0,E.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,E.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,r=void 0===i?-1:i,o=e.value,s=void 0===o?\"\":o,a=e.label,c=void 0===a?\"\":a,l=r>=0?this._store.getGroupById(r):null;return this._store.dispatch((0,y.highlightItem)(n,!0)),t&&this.passedElement.triggerEvent(v.EVENTS.highlightItem,{id:n,value:s,label:c,groupValue:l&&l.value?l.value:null}),this}},{key:\"unhighlightItem\",value:function(e){if(!e)return this;var t=e.id,n=e.groupId,i=void 0===n?-1:n,r=e.value,o=void 0===r?\"\":r,s=e.label,a=void 0===s?\"\":s,c=i>=0?this._store.getGroupById(i):null;return this._store.dispatch((0,y.highlightItem)(t,!1)),this.passedElement.triggerEvent(v.EVENTS.highlightItem,{id:t,value:o,label:a,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(v.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(v.EVENTS.hideDropdown,{})}),this):this}},{key:\"toggleDropdown\",value:function(){return this.dropdown.isActive?this.hideDropdown():this.showDropdown(),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(o(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,E.isType)(\"Array\",e)?e:[e]).forEach(function(e){return t._findAndSelectChoiceByValue(e)}),this)}},{key:\"setChoices\",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:\"\",n=this,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:\"\",r=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(!this._isSelectElement||!e.length||!t)return this;r&&this._clearChoices(),this.containerOuter.removeLoadingState();var o=function(e){e.choices?n._addGroup({group:e,id:e.id||null,valueKey:t,labelKey:i}):n._addChoice({value:e[t],label:e[i],isSelected:e.selected,isDisabled:e.disabled,customProperties:e.customProperties,placeholder:e.placeholder})};return e.forEach(o),this}},{key:\"clearStore\",value:function(){return this._store.dispatch((0,b.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,g.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(){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,r=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&&(r=this._createChoicesFragment(o,r)),r=this._createGroupsFragment(n,i,r)}else i.length>=1&&(r=this._createChoicesFragment(i,r));if(r.childNodes&&r.childNodes.length>0){var s=this._store.activeItems,a=this._canAddItem(s,this.input.value);a.response?(this.choiceList.append(r),this._highlightChoice()):this.choiceList.append(this._getTemplate(\"notice\",a.notice))}else{var c=void 0,l=void 0;this._isSearching?(l=(0,E.isType)(\"Function\",this.config.noResultsText)?this.config.noResultsText():this.config.noResultsText,c=this._getTemplate(\"notice\",l,\"no-results\")):(l=(0,E.isType)(\"Function\",this.config.noChoicesText)?this.config.noChoicesText():this.config.noChoicesText,c=this._getTemplate(\"notice\",l,\"no-choices\")),this.choiceList.append(c)}}},{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,r=n||document.createDocumentFragment(),o=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(this.config.sortFn),e.forEach(function(e){var t=o(e);if(t.length>=1){var n=i._getTemplate(\"choiceGroup\",e);r.appendChild(n),i._createChoicesFragment(t,r,!0)}}),r}},{key:\"_createChoicesFragment\",value:function(e,t){var n=this,i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=t||document.createDocumentFragment(),s=this.config,a=s.renderSelectedChoices,c=s.searchResultLimit,l=s.renderChoiceLimit,u=this._isSearching?E.sortByScore:this.config.sortFn,h=e;\"auto\"!==a||this._isSelectOneElement||(h=e.filter(function(e){return!e.selected}));var d=h.reduce(function(e,t){return t.placeholder?e.placeholderChoices.push(t):e.normalChoices.push(t),e},{placeholderChoices:[],normalChoices:[]}),f=d.placeholderChoices,p=d.normalChoices;(this.config.shouldSort||this._isSearching)&&p.sort(u);var v=h.length,m=[].concat(o(f),o(p));this._isSearching?v=c:l>0&&!i&&(v=l);for(var g=0;g1&&void 0!==arguments[1]?arguments[1]:null,i=this.config,r=i.shouldSortItems,o=i.sortFn,s=i.removeItemButton,a=n||document.createDocumentFragment();r&&!this._isSelectOneElement&&e.sort(o),this._isTextElement?this.passedElement.value=e:this.passedElement.options=e;var c=function(e){var n=t._getTemplate(\"item\",e,s);a.appendChild(n)};return e.forEach(function(e){return c(e)}),a}},{key:\"_triggerChange\",value:function(e){void 0!==e&&null!==e&&this.passedElement.triggerEvent(v.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 r=t.getAttribute(\"data-id\");e.forEach(function(e){e.id!==parseInt(r,10)||e.highlighted?!i&&e.highlighted&&n.unhighlightItem(e):n.highlightItem(e)}),this.input.focus()}}},{key:\"_handleChoiceAction\",value:function(e,t){if(e&&t){var n=t.getAttribute(\"data-id\"),i=this._store.getChoiceById(n),r=e[0]&&e[0].keyCode?e[0].keyCode:null,o=this.dropdown.isActive;if(i.keyCode=r,this.passedElement.triggerEvent(v.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:\"_handleLoadingState\",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0],t=this.itemList.getChild(\".\"+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,r=n.searchChoices,o=t.some(function(e){return!e.active});if(e&&e.length>=i){var s=r?this._searchChoices(e):0;this.passedElement.triggerEvent(v.EVENTS.search,{value:e,resultCount:s})}else o&&(this._isSearching=!1,this._store.dispatch((0,g.activateChoices)(!0)))}}},{key:\"_canAddItem\",value:function(e,t){var n=!0,i=(0,E.isType)(\"Function\",this.config.addItemText)?this.config.addItemText(t):this.config.addItemText;if(!this._isSelectOneElement){var r=(0,E.existsInArray)(e,t);this.config.maxItemCount>0&&this.config.maxItemCount<=e.length&&(n=!1,i=(0,E.isType)(\"Function\",this.config.maxItemText)?this.config.maxItemText(this.config.maxItemCount):this.config.maxItemText),this.config.regexFilter&&this._isTextElement&&this.config.addItems&&n&&(n=(0,E.regexFilter)(t,this.config.regexFilter)),!this.config.duplicateItemsAllowed&&r&&n&&(n=!1,i=(0,E.isType)(\"Function\",this.config.uniqueItemText)?this.config.uniqueItemText(t):this.config.uniqueItemText)}return{response:n,notice:i}}},{key:\"_ajaxCallback\",value:function(){var e=this;return function(t,n,i){if(t&&n){var r=(0,E.isType)(\"Object\",t)?[t]:t;r&&(0,E.isType)(\"Array\",r)&&r.length?(e._handleLoadingState(!1),r.forEach(function(t){t.choices?e._addGroup({group:t,id:t.id||null,valueKey:n,labelKey:i}):e._addChoice({value:(0,E.fetchFromObject)(t,n),label:(0,E.fetchFromObject)(t,i),isSelected:t.selected,isDisabled:t.disabled,customProperties:t.customProperties,placeholder:t.placeholder})}),e._isSelectOneElement&&e._selectPlaceholderChoice()):e._handleLoadingState(!1)}}}},{key:\"_searchChoices\",value:function(e){var t=(0,E.isType)(\"String\",e)?e.trim():e,n=(0,E.isType)(\"String\",this._currentValue)?this._currentValue.trim():this._currentValue;if(t.length<1&&t===n+\" \")return 0;var i=this._store.searchableChoices,r=t,s=[].concat(o(this.config.searchFields)),a=Object.assign(this.config.fuseOptions,{keys:s}),c=new l.default(i,a),u=c.search(r);return this._currentValue=t,this._highlightPosition=0,this._isSearching=!0,this._store.dispatch((0,g.filterChoices)(u)),u.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,o=e.ctrlKey,s=e.metaKey;if(n===this.input.element||this.containerOuter.element.contains(n)){var a=this._store.activeItems,c=this.input.isFocussed,l=this.dropdown.isActive,u=this.itemList.hasChildren,h=String.fromCharCode(i),d=v.KEY_CODES.BACK_KEY,f=v.KEY_CODES.DELETE_KEY,p=v.KEY_CODES.ENTER_KEY,m=v.KEY_CODES.A_KEY,g=v.KEY_CODES.ESC_KEY,y=v.KEY_CODES.UP_KEY,_=v.KEY_CODES.DOWN_KEY,b=v.KEY_CODES.PAGE_UP_KEY,E=v.KEY_CODES.PAGE_DOWN_KEY,S=o||s;!this._isTextElement&&/[a-zA-Z0-9-_ ]/.test(h)&&this.showDropdown();var O=(t={},r(t,m,this._onAKey),r(t,p,this._onEnterKey),r(t,g,this._onEscapeKey),r(t,y,this._onDirectionKey),r(t,b,this._onDirectionKey),r(t,_,this._onDirectionKey),r(t,E,this._onDirectionKey),r(t,f,this._onDeleteKey),r(t,d,this._onDeleteKey),t);O[i]&&O[i]({event:e,target:n,keyCode:i,metaKey:s,activeItems:a,hasFocusedInput:c,hasActiveDropdown:l,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,r=this._store.activeItems,o=this._canAddItem(r,i);if(this._isTextElement)if(i){if(o.notice){var s=this._getTemplate(\"notice\",o.notice);this.dropdown.element.innerHTML=s.outerHTML}!0===o.response?this.showDropdown(!0):o.notice||this.hideDropdown(!0)}else this.hideDropdown(!0);else{var a=v.KEY_CODES.BACK_KEY,c=v.KEY_CODES.DELETE_KEY;n!==a&&n!==c||t.value?this._canSearch&&o.response&&this._handleSearch(this.input.value):!this._isTextElement&&this._isSearching&&(this._isSearching=!1,this._store.dispatch((0,g.activateChoices)(!0)))}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,r=e.hasActiveDropdown,o=v.KEY_CODES.ENTER_KEY;if(this._isTextElement&&n.value){var s=this.input.value;this._canAddItem(i,s).response&&(this.hideDropdown(!0),this._addItem({value:s}),this._triggerChange(s),this.clearInput())}if(n.hasAttribute(\"data-button\")&&(this._handleButtonAction(i,n),t.preventDefault()),r){var a=this.dropdown.getChild(\".\"+this.config.classNames.highlightedState);a&&(i[0]&&(i[0].keyCode=o),this._handleChoiceAction(i,a)),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,r=e.metaKey,o=v.KEY_CODES.DOWN_KEY,s=v.KEY_CODES.PAGE_UP_KEY,a=v.KEY_CODES.PAGE_DOWN_KEY;if(n||this._isSelectOneElement){this.showDropdown(),this._canSearch=!1;var c=i===o||i===a?1:-1,l=r||i===a||i===s,u=void 0;if(l)u=c>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(\".\"+this.config.classNames.highlightedState);u=h?(0,E.getAdjacentEl)(h,\"[data-choice-selectable]\",c):this.dropdown.element.querySelector(\"[data-choice-selectable]\")}u&&((0,E.isScrolledIntoView)(u,this.choiceList.element,c)||this.choiceList.scrollToChoice(u,c),this._highlightChoice(u)),t.preventDefault()}}},{key:\"_onDeleteKey\",value:function(e){var t=e.event,n=e.target,i=e.hasFocusedInput,r=e.activeItems;!i||n.value||this._isSelectOneElement||(this._handleBackspace(r),t.preventDefault())}},{key:\"_onTouchMove\",value:function(){!0===this._wasTap&&(this._wasTap=!1)}},{key:\"_onTouchEnd\",value:function(e){var t=e.target||e.touches[0].target;if(!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()),e.stopPropagation()}this._wasTap=!0}},{key:\"_onMouseDown\",value:function(e){var t=e.target,n=e.shiftKey;if(t===this.choiceList&&(0,E.isIE11)()&&(this._isScrollingOnIe=!0),this.containerOuter.element.contains(t)&&t!==this.input.element){var i=this._store.activeItems,r=n,o=(0,E.findAncestorByAttrName)(t,\"data-button\"),s=(0,E.findAncestorByAttrName)(t,\"data-item\"),a=(0,E.findAncestorByAttrName)(t,\"data-choice\");o?this._handleButtonAction(i,o):s?this._handleItemAction(i,s,r):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;if(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());else{this._store.highlightedActiveItems&&this.unhighlightAll(),this.containerOuter.removeFocusState(),this.hideDropdown(!0)}}},{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(!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,r=i.some(function(e){return e.highlighted});({text:function(){n===t.input.element&&(t.containerOuter.removeFocusState(),r&&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),r&&t.unhighlightAll())}})[this.passedElement.element.type]()}else this._isScrollingOnIe=!1,this.input.element.focus()}},{key:\"_onFormReset\",value:function(){this._store.dispatch((0,b.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(\".\"+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(v.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,r=e.choiceId,o=void 0===r?-1:r,s=e.groupId,a=void 0===s?-1:s,c=e.customProperties,l=void 0===c?null:c,u=e.placeholder,h=void 0!==u&&u,d=e.keyCode,f=void 0===d?null:d,p=(0,E.isType)(\"String\",t)?t.trim():t,m=f,g=l,_=this._store.items,b=i||p,S=parseInt(o,10)||-1,O=a>=0?this._store.getGroupById(a):null,I=_?_.length+1:1;return this.config.prependValue&&(p=this.config.prependValue+p.toString()),this.config.appendValue&&(p+=this.config.appendValue.toString()),this._store.dispatch((0,y.addItem)({value:p,label:b,id:I,choiceId:S,groupId:a,customProperties:l,placeholder:h,keyCode:m})),this._isSelectOneElement&&this.removeActiveItems(I),this.passedElement.triggerEvent(v.EVENTS.addItem,{id:I,value:p,label:b,customProperties:g,groupValue:O&&O.value?O.value:void 0,keyCode:m}),this}},{key:\"_removeItem\",value:function(e){if(!e||!(0,E.isType)(\"Object\",e))return this;var t=e.id,n=e.value,i=e.label,r=e.choiceId,o=e.groupId,s=o>=0?this._store.getGroupById(o):null;return this._store.dispatch((0,y.removeItem)(t,r)),s&&s.value?this.passedElement.triggerEvent(v.EVENTS.removeItem,{id:t,value:n,label:i,groupValue:s.value}):this.passedElement.triggerEvent(v.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,r=e.isSelected,o=void 0!==r&&r,s=e.isDisabled,a=void 0!==s&&s,c=e.groupId,l=void 0===c?-1:c,u=e.customProperties,h=void 0===u?null:u,d=e.placeholder,f=void 0!==d&&d,p=e.keyCode,v=void 0===p?null:p;if(void 0!==t&&null!==t){var m=this._store.choices,y=i||t,_=m?m.length+1:1,b=this._baseId+\"-\"+this._idNames.itemChoice+\"-\"+_;this._store.dispatch((0,g.addChoice)({value:t,label:y,id:_,groupId:l,disabled:a,elementId:b,customProperties:h,placeholder:f,keyCode:v})),o&&this._addItem({value:t,label:y,choiceId:_,customProperties:h,placeholder:f,keyCode:v})}}},{key:\"_clearChoices\",value:function(){this._store.dispatch((0,g.clearChoices)())}},{key:\"_addGroup\",value:function(e){var t=this,n=e.group,i=e.id,r=e.valueKey,o=void 0===r?\"value\":r,s=e.labelKey,a=void 0===s?\"label\":s,c=(0,E.isType)(\"Object\",n)?n.choices:Array.from(n.getElementsByTagName(\"OPTION\")),l=i||Math.floor((new Date).valueOf()*Math.random()),u=!!n.disabled&&n.disabled;if(c){this._store.dispatch((0,_.addGroup)(n.label,l,!0,u));var h=function(e){var n=e.disabled||e.parentNode&&e.parentNode.disabled;t._addChoice({value:e[o],label:(0,E.isType)(\"Object\",e)?e[a]:e.innerHTML,isSelected:e.selected,isDisabled:n,groupId:l,customProperties:e.customProperties,placeholder:e.placeholder})};c.forEach(h)}else this._store.dispatch((0,_.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,r=n.classNames,o=arguments.length,s=Array(o>1?o-1:0),a=1;an)return o(e,this.pattern,i);var r=this.options,a=r.location,c=r.distance,l=r.threshold,u=r.findAllMatches,h=r.minMatchCharLength;return s(e,this.pattern,this.patternAlphabet,{location:a,distance:c,threshold:l,findAllMatches:u,minMatchCharLength:h})}}]),e}();e.exports=c},function(e,t,n){\"use strict\";var i=n(0),r=function e(t,n,r){if(n){var o=n.indexOf(\".\"),s=n,a=null;-1!==o&&(s=n.slice(0,o),a=n.slice(o+1));var c=t[s];if(null!==c&&void 0!==c)if(a||\"string\"!=typeof c&&\"number\"!=typeof c)if(i(c))for(var l=0,u=c.length;l0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,n=[],i=-1,r=-1,o=0,s=e.length;o=t&&n.push([i,r]),i=-1)}return e[o-1]&&o-i>=t&&n.push([i,o-1]),n}},function(e,t,n){\"use strict\";e.exports=function(e){for(var t={},n=e.length,i=0;i2&&void 0!==arguments[2]?arguments[2]:/ +/g,r=new RegExp(t.replace(i,\"\\\\$&\").replace(n,\"|\")),o=e.match(r),s=!!o,a=[];if(s)for(var c=0,l=o.length;c=P;M-=1){var F=M-1,N=n[e.charAt(F)];if(N&&(E[F]=1),j[M]=(j[M+1]<<1|1)&N,0!==k&&(j[M]|=(C[M+1]|C[M])<<1|1|C[M+1]),j[M]&T&&(w=i(t,{errors:k,currentLocation:F,expectedLocation:m,distance:l}))<=y){if(y=w,(_=F)<=m)break;P=Math.max(1,2*m-_)}}if(i(t,{errors:k+1,currentLocation:m,expectedLocation:m,distance:l})>y)break;C=j}return{isMatch:_>=0,score:0===w?.001:w,matchedIndices:r(E,v)}}},function(e,t,n){\"use strict\";function i(e,t){if(!(e instanceof t))throw new TypeError(\"Cannot call a class as a function\")}var r=function(){function e(e,t){for(var n=0;n0&&void 0!==arguments[0]?arguments[0]:\"\",t=[];if(this.options.tokenize)for(var n=e.split(this.options.tokenSeparator),i=0,r=n.length;i0&&void 0!==arguments[0]?arguments[0]:[],t=arguments[1],n=this.list,i={},r=[];if(\"string\"==typeof n[0]){for(var o=0,s=n.length;o1)throw new Error(\"Key weight has to be > 0 and <= 1\");f=f.name}else a[f]={weight:1};this._analyze({key:f,value:this.options.getFn(u,f),record:u,index:c},{resultMap:i,results:r,tokenSearchers:e,fullSearcher:t})}return{weights:a,results:r}}},{key:\"_analyze\",value:function(e,t){var n=e.key,i=e.arrayIndex,r=void 0===i?-1:i,o=e.value,s=e.record,c=e.index,l=t.tokenSearchers,u=void 0===l?[]:l,h=t.fullSearcher,d=void 0===h?[]:h,f=t.resultMap,p=void 0===f?{}:f,v=t.results,m=void 0===v?[]:v;if(void 0!==o&&null!==o){var g=!1,y=-1,_=0;if(\"string\"==typeof o){this._log(\"\\nKey: \"+(\"\"===n?\"-\":n));var b=d.search(o);if(this._log('Full text: \"'+o+'\", score: '+b.score),this.options.tokenize){for(var E=o.split(this.options.tokenSeparator),S=[],O=0;O-1&&(P=(P+y)/2),this._log(\"Score average:\",P);var D=!this.options.tokenize||!this.options.matchAllTokens||_>=u.length;if(this._log(\"\\nCheck Matches: \"+D),(g||b.isMatch)&&D){var j=p[c];j?j.output.push({key:n,arrayIndex:r,value:o,score:P,matchedIndices:b.matchedIndices}):(p[c]={item:s,output:[{key:n,arrayIndex:r,value:o,score:P,matchedIndices:b.matchedIndices}]},m.push(p[c]))}}else if(a(o))for(var M=0,F=o.length;M-1&&(s.arrayIndex=o.arrayIndex),t.matches.push(s)}}}),this.options.includeScore&&n.push(function(e,t){t.score=e.score});for(var i=0,r=e.length;i1?arguments[1]:void 0)}}),n(28)(\"find\")},function(e,t,n){e.exports=!n(10)&&!n(22)(function(){return 7!=Object.defineProperty(n(23)(\"div\"),\"a\",{get:function(){return 7}}).a})},function(e,t,n){var i=n(9);e.exports=function(e,t){if(!i(e))return e;var n,r;if(t&&\"function\"==typeof(n=e.toString)&&!i(r=n.call(e)))return r;if(\"function\"==typeof(n=e.valueOf)&&!i(r=n.call(e)))return r;if(!t&&\"function\"==typeof(n=e.toString)&&!i(r=n.call(e)))return r;throw TypeError(\"Can't convert object to primitive value\")}},function(e,t){e.exports=function(e){if(\"function\"!=typeof e)throw TypeError(e+\" is not a function!\");return e}},function(e,t,n){var i=n(14),r=n(25),o=n(16),s=n(18),a=n(48);e.exports=function(e,t){var n=1==e,c=2==e,l=3==e,u=4==e,h=6==e,d=5==e||h,f=t||a;return function(t,a,p){for(var v,m,g=o(t),y=r(g),_=i(a,p,3),b=s(y.length),E=0,S=n?f(t,b):c?f(t,0):void 0;b>E;E++)if((d||E in y)&&(v=y[E],m=_(v,E,g),e))if(n)S[E]=m;else if(m)switch(e){case 3:return!0;case 5:return v;case 6:return E;case 2:S.push(v)}else if(u)return!1;return h?-1:l||u?u:S}}},function(e,t,n){var i=n(49);e.exports=function(e,t){return new(i(e))(t)}},function(e,t,n){var i=n(9),r=n(50),o=n(0)(\"species\");e.exports=function(e){var t;return r(e)&&(t=e.constructor,\"function\"!=typeof t||t!==Array&&!r(t.prototype)||(t=void 0),i(t)&&null===(t=t[o])&&(t=void 0)),void 0===t?Array:t}},function(e,t,n){var i=n(15);e.exports=Array.isArray||function(e){return\"Array\"==i(e)}},function(e,t,n){n(52),n(63),e.exports=n(2).Array.from},function(e,t,n){\"use strict\";var i=n(53)(!0);n(54)(String,\"String\",function(e){this._t=String(e),this._i=0},function(){var e,t=this._t,n=this._i;return n>=t.length?{value:void 0,done:!0}:(e=i(t,n),this._i+=e.length,{value:e,done:!1})})},function(e,t,n){var i=n(19),r=n(17);e.exports=function(e){return function(t,n){var o,s,a=String(r(t)),c=i(n),l=a.length;return c<0||c>=l?e?\"\":void 0:(o=a.charCodeAt(c),o<55296||o>56319||c+1===l||(s=a.charCodeAt(c+1))<56320||s>57343?e?a.charAt(c):o:e?a.slice(c,c+2):s-56320+(o-55296<<10)+65536)}}},function(e,t,n){\"use strict\";var i=n(27),r=n(6),o=n(24),s=n(4),a=n(20),c=n(55),l=n(32),u=n(62),h=n(0)(\"iterator\"),d=!([].keys&&\"next\"in[].keys()),f=function(){return this};e.exports=function(e,t,n,p,v,m,g){c(n,t,p);var y,_,b,E=function(e){if(!d&&e in C)return C[e];switch(e){case\"keys\":case\"values\":return function(){return new n(this,e)}}return function(){return new n(this,e)}},S=t+\" Iterator\",O=\"values\"==v,I=!1,C=e.prototype,w=C[h]||C[\"@@iterator\"]||v&&C[v],A=w||E(v),T=v?O?E(\"entries\"):A:void 0,k=\"Array\"==t?C.entries||w:w;if(k&&(b=u(k.call(new e)))!==Object.prototype&&b.next&&(l(b,S,!0),i||\"function\"==typeof b[h]||s(b,h,f)),O&&w&&\"values\"!==w.name&&(I=!0,A=function(){return w.call(this)}),i&&!g||!d&&!I&&C[h]||s(C,h,A),a[t]=A,a[S]=f,v)if(y={values:O?A:E(\"values\"),keys:m?A:E(\"keys\"),entries:T},g)for(_ in y)_ in C||o(C,_,y[_]);else r(r.P+r.F*(d||I),t,y);return y}},function(e,t,n){\"use strict\";var i=n(56),r=n(12),o=n(32),s={};n(4)(s,n(0)(\"iterator\"),function(){return this}),e.exports=function(e,t,n){e.prototype=i(s,{next:r(1,n)}),o(e,t+\" Iterator\")}},function(e,t,n){var i=n(8),r=n(57),o=n(31),s=n(21)(\"IE_PROTO\"),a=function(){},c=function(){var e,t=n(23)(\"iframe\"),i=o.length;for(t.style.display=\"none\",n(61).appendChild(t),t.src=\"javascript:\",e=t.contentWindow.document,e.open(),e.write(\"