(window["RCDLjsonFunction"]=window["RCDLjsonFunction"]||[]).push([[111],{842:function(e,t,i){ /*! choices.js v9.0.1 | © 2019 Josh Johnson | https://github.com/jshjohnson/Choices#readme */ (function webpackUniversalModuleDefinition(t,i){if(true)e.exports=i();else{}})(window,(function(){return function(e){var t={};function __webpack_require__(i){if(t[i]){return t[i].exports}var n=t[i]={i:i,l:false,exports:{}};e[i].call(n.exports,n,n.exports,__webpack_require__);n.l=true;return n.exports}__webpack_require__.m=e;__webpack_require__.c=t;__webpack_require__.d=function(e,t,i){if(!__webpack_require__.o(e,t)){Object.defineProperty(e,t,{enumerable:true,get:i})}};__webpack_require__.r=function(e){if(typeof Symbol!=="undefined"&&Symbol.toStringTag){Object.defineProperty(e,Symbol.toStringTag,{value:"Module"})}Object.defineProperty(e,"__esModule",{value:true})};__webpack_require__.t=function(e,t){if(t&1)e=__webpack_require__(e);if(t&8)return e;if(t&4&&typeof e==="object"&&e&&e.__esModule)return e;var i=Object.create(null);__webpack_require__.r(i);Object.defineProperty(i,"default",{enumerable:true,value:e});if(t&2&&typeof e!="string")for(var n in e)__webpack_require__.d(i,n,function(t){return e[t]}.bind(null,n));return i};__webpack_require__.n=function(e){var t=e&&e.__esModule?function getDefault(){return e["default"]}:function getModuleExports(){return e};__webpack_require__.d(t,"a",t);return t};__webpack_require__.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)};__webpack_require__.p="/public/assets/scripts/";return __webpack_require__(__webpack_require__.s=4)}([function(e,t,i){"use strict";var n=function isMergeableObject(e){return isNonNullObject(e)&&!isSpecial(e)};function isNonNullObject(e){return!!e&&typeof e==="object"}function isSpecial(e){var t=Object.prototype.toString.call(e);return t==="[object RegExp]"||t==="[object Date]"||isReactElement(e)}var r=typeof Symbol==="function"&&Symbol.for;var s=r?Symbol.for("react.element"):60103;function isReactElement(e){return e.$$typeof===s}function emptyTarget(e){return Array.isArray(e)?[]:{}}function cloneUnlessOtherwiseSpecified(e,t){return t.clone!==false&&t.isMergeableObject(e)?deepmerge(emptyTarget(e),e,t):e}function defaultArrayMerge(e,t,i){return e.concat(t).map((function(e){return cloneUnlessOtherwiseSpecified(e,i)}))}function getMergeFunction(e,t){if(!t.customMerge){return deepmerge}var i=t.customMerge(e);return typeof i==="function"?i:deepmerge}function getEnumerableOwnPropertySymbols(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter((function(t){return e.propertyIsEnumerable(t)})):[]}function getKeys(e){return Object.keys(e).concat(getEnumerableOwnPropertySymbols(e))}function propertyIsUnsafe(e,t){try{return t in e&&!(Object.hasOwnProperty.call(e,t)&&Object.propertyIsEnumerable.call(e,t))}catch(e){return false}}function mergeObject(e,t,i){var n={};if(i.isMergeableObject(e)){getKeys(e).forEach((function(t){n[t]=cloneUnlessOtherwiseSpecified(e[t],i)}))}getKeys(t).forEach((function(r){if(propertyIsUnsafe(e,r)){return}if(!i.isMergeableObject(t[r])||!e[r]){n[r]=cloneUnlessOtherwiseSpecified(t[r],i)}else{n[r]=getMergeFunction(r,i)(e[r],t[r],i)}}));return n}function deepmerge(e,t,i){i=i||{};i.arrayMerge=i.arrayMerge||defaultArrayMerge;i.isMergeableObject=i.isMergeableObject||n;i.cloneUnlessOtherwiseSpecified=cloneUnlessOtherwiseSpecified;var r=Array.isArray(t);var s=Array.isArray(e);var o=r===s;if(!o){return cloneUnlessOtherwiseSpecified(t,i)}else if(r){return i.arrayMerge(e,t,i)}else{return mergeObject(e,t,i)}}deepmerge.all=function deepmergeAll(e,t){if(!Array.isArray(e)){throw new Error("first argument should be an array")}return e.reduce((function(e,i){return deepmerge(e,i,t)}),{})};var o=deepmerge;e.exports=o},function(e,t,i){"use strict";(function(e,n){var r=i(3);var s;if(typeof self!=="undefined"){s=self}else if(typeof window!=="undefined"){s=window}else if(typeof e!=="undefined"){s=e}else if(true){s=n}else{}var o=Object(r["a"])(s);t["a"]=o}).call(this,i(5),i(6)(e))},function(e,t,i){ /*! * Fuse.js v3.4.5 - 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 */ !function(t,i){true?e.exports=i():undefined}(this,(function(){return function(e){var t={};function n(i){if(t[i])return t[i].exports;var r=t[i]={i:i,l:!1,exports:{}};return e[i].call(r.exports,r,r.exports,n),r.l=!0,r.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 r in e)n.d(i,r,function(t){return e[t]}.bind(null,r));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=1)}([function(e,t){e.exports=function(e){return Array.isArray?Array.isArray(e):"[object Array]"===Object.prototype.toString.call(e)}},function(t,i,n){function r(e){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(e,t){for(var i=0;i1&&void 0!==arguments[1]?arguments[1]:{limit:!1};this._log('---------\nSearch pattern: "'.concat(e,'"'));var i=this._prepareSearchers(e),n=i.tokenSearchers,r=i.fullSearcher,s=this._search(n,r),o=s.weights,a=s.results;return this._computeScore(o,a),this.options.shouldSort&&this._sort(a),t.limit&&"number"==typeof t.limit&&(a=a.slice(0,t.limit)),this._format(a)}},{key:"_prepareSearchers",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=[];if(this.options.tokenize)for(var i=e.split(this.options.tokenSeparator),n=0,r=i.length;n0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1?arguments[1]:void 0,i=this.list,n={},r=[];if("string"==typeof i[0]){for(var s=0,o=i.length;s1)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:n,results:r,tokenSearchers:e,fullSearcher:t})}return{weights:a,results:r}}},{key:"_analyze",value:function(e,t){var i=e.key,n=e.arrayIndex,r=void 0===n?-1:n,s=e.value,o=e.record,a=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,m=t.results,v=void 0===m?[]:m;if(null!=s){var g=!1,_=-1,b=0;if("string"==typeof s){this._log("\nKey: ".concat(""===i?"-":i));var y=d.search(s);if(this._log('Full text: "'.concat(s,'", score: ').concat(y.score)),this.options.tokenize){for(var E=s.split(this.options.tokenSeparator),w=[],I=0;I-1&&(D=(D+_)/2),this._log("Score average:",D);var k=!this.options.tokenize||!this.options.matchAllTokens||b>=u.length;if(this._log("\nCheck Matches: ".concat(k)),(g||y.isMatch)&&k){var M=p[a];M?M.output.push({key:i,arrayIndex:r,value:s,score:D,matchedIndices:y.matchedIndices}):(p[a]={item:o,output:[{key:i,arrayIndex:r,value:s,score:D,matchedIndices:y.matchedIndices}]},v.push(p[a]))}}else if(c(s))for(var N=0,j=s.length;N-1&&(o.arrayIndex=s.arrayIndex),t.matches.push(o)}}})),this.options.includeScore&&n.push((function(e,t){t.score=e.score}));for(var s=0,o=e.length;si)return s(e,this.pattern,n);var r=this.options,a=r.location,c=r.distance,l=r.threshold,u=r.findAllMatches,h=r.minMatchCharLength;return o(e,this.pattern,this.patternAlphabet,{location:a,distance:c,threshold:l,findAllMatches:u,minMatchCharLength:h})}}])&&r(t.prototype,i),n&&r(t,n),e}();t.exports=c},function(e,t){var i=/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g;e.exports=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:/ +/g,r=new RegExp(t.replace(i,"\\$&").replace(n,"|")),s=e.match(r),o=!!s,a=[];if(o)for(var c=0,l=s.length;c=D;N-=1){var j=N-1,F=i[e.charAt(j)];if(F&&(E[j]=1),M[N]=(M[N+1]<<1|1)&F,0!==T&&(M[N]|=(C[N+1]|C[N])<<1|1|C[N+1]),M[N]&L&&(O=n(t,{errors:T,currentLocation:j,expectedLocation:v,distance:l}))<=_){if(_=O,(b=j)<=v)break;D=Math.max(1,2*v-b)}}if(n(t,{errors:T+1,currentLocation:v,expectedLocation:v,distance:l})>_)break;C=M}return{isMatch:b>=0,score:0===O?.001:O,matchedIndices:r(E,m)}}},function(e,t){e.exports=function(e,t){var i=t.errors,n=void 0===i?0:i,r=t.currentLocation,s=void 0===r?0:r,o=t.expectedLocation,a=void 0===o?0:o,c=t.distance,l=void 0===c?100:c,u=n/e.length,h=Math.abs(a-s);return l?u+h/l:h?1:u}},function(e,t){e.exports=function(){for(var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,i=[],n=-1,r=-1,s=0,o=e.length;s=t&&i.push([n,r]),n=-1)}return e[s-1]&&s-n>=t&&i.push([n,s-1]),i}},function(e,t){e.exports=function(e){for(var t={},i=e.length,n=0;n0){return"Unexpected "+(o.length>1?"keys":"key")+" "+('"'+o.join('", "')+'" found in '+s+". ")+"Expected to find one of the known reducer keys instead: "+('"'+r.join('", "')+'". Unexpected keys will be ignored.')}}function assertReducerShape(e){Object.keys(e).forEach((function(t){var i=e[t];var n=i(undefined,{type:l.INIT});if(typeof n==="undefined"){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(typeof i(undefined,{type:l.PROBE_UNKNOWN_ACTION()})==="undefined"){throw new Error('Reducer "'+t+'" returned undefined when probed with a random type. '+("Don't try to handle "+l.INIT+' or other actions in "redux/*" ')+"namespace. They are considered private. Instead, you must return the "+"current state for any unknown actions, unless it is undefined, "+"in which case you must return the initial state, regardless of the "+"action type. The initial state may not be undefined, but can be null.")}}))}function combineReducers(e){var t=Object.keys(e);var i={};for(var n=0;n-1){return e.map((function(e){var i=e;if(i.id===parseInt(t.choiceId,10)){i.selected=true}return i}))}return e}case"REMOVE_ITEM":{if(t.choiceId>-1){return e.map((function(e){var i=e;if(i.id===parseInt(t.choiceId,10)){i.selected=false}return i}))}return e}case"FILTER_CHOICES":{return e.map((function(e){var i=e;i.active=t.results.some((function(e){var t=e.item,n=e.score;if(t.id===i.id){i.score=n;return true}return false}));return i}))}case"ACTIVATE_CHOICES":{return e.map((function(e){var i=e;i.active=t.active;return i}))}case"CLEAR_CHOICES":{return d}default:{return e}}}var f={loading:false};var p=function general(e,t){if(e===void 0){e=f}switch(t.type){case"SET_IS_LOADING":{return{loading:t.isLoading}}default:{return e}}};var m=p;var v=function getRandomNumber(e,t){return Math.floor(Math.random()*(t-e)+e)};var g=function generateChars(e){return Array.from({length:e},(function(){return v(0,36).toString(36)})).join("")};var _=function generateId(e,t){var i=e.id||e.name&&e.name+"-"+g(2)||g(4);i=i.replace(/(:|\.|\[|\]|,)/g,"");i=t+"-"+i;return i};var b=function getType(e){return Object.prototype.toString.call(e).slice(8,-1)};var y=function isType(e,t){return t!==undefined&&t!==null&&b(t)===e};var E=function wrap(e,t){if(t===void 0){t=document.createElement("div")}if(e.nextSibling){e.parentNode.insertBefore(t,e.nextSibling)}else{e.parentNode.appendChild(t)}return t.appendChild(e)};var w=function getAdjacentEl(e,t,i){if(i===void 0){i=1}if(!(e instanceof Element)||typeof t!=="string"){return undefined}var n=(i>0?"next":"previous")+"ElementSibling";var r=e[n];while(r){if(r.matches(t)){return r}r=r[n]}return r};var I=function isScrolledIntoView(e,t,i){if(i===void 0){i=1}if(!e){return false}var n;if(i>0){n=t.scrollTop+t.offsetHeight>=e.offsetTop+e.offsetHeight}else{n=e.offsetTop>=t.scrollTop}return n};var S=function sanitise(e){if(typeof e!=="string"){return e}return e.replace(/&/g,"&").replace(/>/g,"&rt;").replace(/"'+S(e)+'"'},maxItemText:function maxItemText(e){return"Only "+e+" values can be added"},valueComparer:function valueComparer(e,t){return e===t},fuseOptions:{includeScore:true},callbackOnInit:null,callbackOnCreateTemplates:null,classNames:F};var R={showDropdown:"showDropdown",hideDropdown:"hideDropdown",change:"change",choice:"choice",search:"search",addItem:"addItem",removeItem:"removeItem",highlightItem:"highlightItem",highlightChoice:"highlightChoice"};var H={ADD_CHOICE:"ADD_CHOICE",FILTER_CHOICES:"FILTER_CHOICES",ACTIVATE_CHOICES:"ACTIVATE_CHOICES",CLEAR_CHOICES:"CLEAR_CHOICES",ADD_GROUP:"ADD_GROUP",ADD_ITEM:"ADD_ITEM",REMOVE_ITEM:"REMOVE_ITEM",HIGHLIGHT_ITEM:"HIGHLIGHT_ITEM",CLEAR_ALL:"CLEAR_ALL"};var B={BACK_KEY:46,DELETE_KEY:8,ENTER_KEY:13,A_KEY:65,ESC_KEY:27,UP_KEY:38,DOWN_KEY:40,PAGE_UP_KEY:33,PAGE_DOWN_KEY:34};var G="text";var V="select-one";var U="select-multiple";var q=4;var W=function(){function Container(e){var t=e.element,i=e.type,n=e.classNames,r=e.position;this.element=t;this.classNames=n;this.type=i;this.position=r;this.isOpen=false;this.isFlipped=false;this.isFocussed=false;this.isDisabled=false;this.isLoading=false;this._onFocus=this._onFocus.bind(this);this._onBlur=this._onBlur.bind(this)}var e=Container.prototype;e.addEventListeners=function addEventListeners(){this.element.addEventListener("focus",this._onFocus);this.element.addEventListener("blur",this._onBlur)};e.removeEventListeners=function removeEventListeners(){this.element.removeEventListener("focus",this._onFocus);this.element.removeEventListener("blur",this._onBlur)};e.shouldFlip=function shouldFlip(e){if(typeof e!=="number"){return false}var shouldFlip=false;if(this.position==="auto"){shouldFlip=!window.matchMedia("(min-height: "+(e+1)+"px)").matches}else if(this.position==="top"){shouldFlip=true}return shouldFlip};e.setActiveDescendant=function setActiveDescendant(e){this.element.setAttribute("aria-activedescendant",e)};e.removeActiveDescendant=function removeActiveDescendant(){this.element.removeAttribute("aria-activedescendant")};e.open=function open(e){this.element.classList.add(this.classNames.openState);this.element.setAttribute("aria-expanded","true");this.isOpen=true;if(this.shouldFlip(e)){this.element.classList.add(this.classNames.flippedState);this.isFlipped=true}};e.close=function close(){this.element.classList.remove(this.classNames.openState);this.element.setAttribute("aria-expanded","false");this.removeActiveDescendant();this.isOpen=false;if(this.isFlipped){this.element.classList.remove(this.classNames.flippedState);this.isFlipped=false}};e.focus=function focus(){if(!this.isFocussed){this.element.focus()}};e.addFocusState=function addFocusState(){this.element.classList.add(this.classNames.focusState)};e.removeFocusState=function removeFocusState(){this.element.classList.remove(this.classNames.focusState)};e.enable=function enable(){this.element.classList.remove(this.classNames.disabledState);this.element.removeAttribute("aria-disabled");if(this.type===V){this.element.setAttribute("tabindex","0")}this.isDisabled=false};e.disable=function disable(){this.element.classList.add(this.classNames.disabledState);this.element.setAttribute("aria-disabled","true");if(this.type===V){this.element.setAttribute("tabindex","-1")}this.isDisabled=true};e.wrap=function wrap(e){E(e,this.element)};e.unwrap=function unwrap(e){this.element.parentNode.insertBefore(e,this.element);this.element.parentNode.removeChild(this.element)};e.addLoadingState=function addLoadingState(){this.element.classList.add(this.classNames.loadingState);this.element.setAttribute("aria-busy","true");this.isLoading=true};e.removeLoadingState=function removeLoadingState(){this.element.classList.remove(this.classNames.loadingState);this.element.removeAttribute("aria-busy");this.isLoading=false};e._onFocus=function _onFocus(){this.isFocussed=true};e._onBlur=function _onBlur(){this.isFocussed=false};return Container}();function input_defineProperties(e,t){for(var i=0;i0?this.element.scrollTop+o-r:e.offsetTop;requestAnimationFrame((function(){i._animateScroll(a,t)}))};e._scrollDown=function _scrollDown(e,t,i){var n=(i-e)/t;var r=n>1?n:1;this.element.scrollTop=e+r};e._scrollUp=function _scrollUp(e,t,i){var n=(e-i)/t;var r=n>1?n:1;this.element.scrollTop=e-r};e._animateScroll=function _animateScroll(e,t){var i=this;var n=q;var r=this.element.scrollTop;var s=false;if(t>0){this._scrollDown(r,n,e);if(re){s=true}}if(s){requestAnimationFrame((function(){i._animateScroll(e,t)}))}};return List}();function wrapped_element_defineProperties(e,t){for(var i=0;i0?"treeitem":"option");Object.assign(g.dataset,{choice:"",id:l,value:u,selectText:i});if(p){g.classList.add(a);g.dataset.choiceDisabled="";g.setAttribute("aria-disabled","true")}else{g.classList.add(s);g.dataset.choiceSelectable=""}return g},input:function input(e,t){var i=e.input,n=e.inputCloned;var r=Object.assign(document.createElement("input"),{type:"text",className:i+" "+n,autocomplete:"off",autocapitalize:"off",spellcheck:false});r.setAttribute("role","textbox");r.setAttribute("aria-autocomplete","list");r.setAttribute("aria-label",t);return r},dropdown:function dropdown(e){var t=e.list,i=e.listDropdown;var n=document.createElement("div");n.classList.add(t,i);n.setAttribute("aria-expanded","false");return n},notice:function notice(e,t,i){var n=e.item,r=e.itemChoice,s=e.noResults,o=e.noChoices;if(i===void 0){i=""}var a=[n,r];if(i==="no-choices"){a.push(o)}else if(i==="no-results"){a.push(s)}return Object.assign(document.createElement("div"),{innerHTML:t,className:a.join(" ")})},option:function option(e){var t=e.label,i=e.value,n=e.customProperties,r=e.active,s=e.disabled;var o=new Option(t,i,false,r);if(n){o.dataset.customProperties=n}o.disabled=s;return o}};var Q=Z;var ee=function addChoice(e){var t=e.value,i=e.label,n=e.id,r=e.groupId,s=e.disabled,o=e.elementId,a=e.customProperties,c=e.placeholder,l=e.keyCode;return{type:H.ADD_CHOICE,value:t,label:i,id:n,groupId:r,disabled:s,elementId:o,customProperties:a,placeholder:c,keyCode:l}};var te=function filterChoices(e){return{type:H.FILTER_CHOICES,results:e}};var ie=function activateChoices(e){if(e===void 0){e=true}return{type:H.ACTIVATE_CHOICES,active:e}};var ne=function clearChoices(){return{type:H.CLEAR_CHOICES}};var re=function addItem(e){var t=e.value,i=e.label,n=e.id,r=e.choiceId,s=e.groupId,o=e.customProperties,a=e.placeholder,c=e.keyCode;return{type:H.ADD_ITEM,value:t,label:i,id:n,choiceId:r,groupId:s,customProperties:o,placeholder:a,keyCode:c}};var se=function removeItem(e,t){return{type:H.REMOVE_ITEM,id:e,choiceId:t}};var oe=function highlightItem(e,t){return{type:H.HIGHLIGHT_ITEM,id:e,highlighted:t}};var ae=function addGroup(e){var t=e.value,i=e.id,n=e.active,r=e.disabled;return{type:H.ADD_GROUP,value:t,id:i,active:n,disabled:r}};var ce=function clearAll(){return{type:"CLEAR_ALL"}};var le=function resetTo(e){return{type:"RESET_TO",state:e}};var ue=function setIsLoading(e){return{type:"SET_IS_LOADING",isLoading:e}};function choices_defineProperties(e,t){for(var i=0;i=0?this._store.getGroupById(r):null;this._store.dispatch(oe(i,true));if(t){this.passedElement.triggerEvent(R.highlightItem,{id:i,value:o,label:c,groupValue:l&&l.value?l.value:null})}return this};e.unhighlightItem=function unhighlightItem(e){if(!e){return this}var t=e.id,i=e.groupId,n=i===void 0?-1:i,r=e.value,s=r===void 0?"":r,o=e.label,a=o===void 0?"":o;var c=n>=0?this._store.getGroupById(n):null;this._store.dispatch(oe(t,false));this.passedElement.triggerEvent(R.highlightItem,{id:t,value:s,label:a,groupValue:c&&c.value?c.value:null});return this};e.highlightAll=function highlightAll(){var e=this;this._store.items.forEach((function(t){return e.highlightItem(t)}));return this};e.unhighlightAll=function unhighlightAll(){var e=this;this._store.items.forEach((function(t){return e.unhighlightItem(t)}));return this};e.removeActiveItemsByValue=function removeActiveItemsByValue(e){var t=this;this._store.activeItems.filter((function(t){return t.value===e})).forEach((function(e){return t._removeItem(e)}));return this};e.removeActiveItems=function removeActiveItems(e){var t=this;this._store.activeItems.filter((function(t){var i=t.id;return i!==e})).forEach((function(e){return t._removeItem(e)}));return this};e.removeHighlightedItems=function removeHighlightedItems(e){var t=this;if(e===void 0){e=false}this._store.highlightedActiveItems.forEach((function(i){t._removeItem(i);if(e){t._triggerChange(i.value)}}));return this};e.showDropdown=function showDropdown(e){var t=this;if(this.dropdown.isActive){return this}requestAnimationFrame((function(){t.dropdown.show();t.containerOuter.open(t.dropdown.distanceFromTopWindow);if(!e&&t._canSearch){t.input.focus()}t.passedElement.triggerEvent(R.showDropdown,{})}));return this};e.hideDropdown=function hideDropdown(e){var t=this;if(!this.dropdown.isActive){return this}requestAnimationFrame((function(){t.dropdown.hide();t.containerOuter.close();if(!e&&t._canSearch){t.input.removeActiveDescendant();t.input.blur()}t.passedElement.triggerEvent(R.hideDropdown,{})}));return this};e.getValue=function getValue(e){if(e===void 0){e=false}var t=this._store.activeItems.reduce((function(t,i){var n=e?i.value:i;t.push(n);return t}),[]);return this._isSelectOneElement?t[0]:t};e.setValue=function setValue(e){var t=this;if(!this.initialised){return this}e.forEach((function(e){return t._setChoiceOrItem(e)}));return this};e.setChoiceByValue=function setChoiceByValue(e){var t=this;if(!this.initialised||this._isTextElement){return this}var i=Array.isArray(e)?e:[e];i.forEach((function(e){return t._findAndSelectChoiceByValue(e)}));return this};e.setChoices=function setChoices(e,t,i,n){var r=this;if(e===void 0){e=[]}if(t===void 0){t="value"}if(i===void 0){i="label"}if(n===void 0){n=false}if(!this.initialised){throw new ReferenceError("setChoices was called on a non-initialized instance of Choices")}if(!this._isSelectElement){throw new TypeError("setChoices can't be used with INPUT based Choices")}if(typeof t!=="string"||!t){throw new TypeError("value parameter must be a name of 'value' field in passed objects")}if(n){this.clearChoices()}if(typeof e==="function"){var s=e(this);if(typeof Promise==="function"&&s instanceof Promise){return new Promise((function(e){return requestAnimationFrame(e)})).then((function(){return r._handleLoadingState(true)})).then((function(){return s})).then((function(e){return r.setChoices(e,t,i,n)})).catch((function(e){if(!r.config.silent){console.error(e)}})).then((function(){return r._handleLoadingState(false)})).then((function(){return r}))}if(!Array.isArray(s)){throw new TypeError(".setChoices first argument function must return either array of choices or Promise, got: "+typeof s)}return this.setChoices(s,t,i,false)}if(!Array.isArray(e)){throw new TypeError(".setChoices must be called either with array of choices with a function resulting into Promise of array of choices")}this.containerOuter.removeLoadingState();this._startLoading();e.forEach((function(e){if(e.choices){r._addGroup({id:parseInt(e.id,10)||null,group:e,valueKey:t,labelKey:i})}else{r._addChoice({value:e[t],label:e[i],isSelected:e.selected,isDisabled:e.disabled,customProperties:e.customProperties,placeholder:e.placeholder})}}));this._stopLoading();return this};e.clearChoices=function clearChoices(){this._store.dispatch(ne());return this};e.clearStore=function clearStore(){this._store.dispatch(ce());return this};e.clearInput=function clearInput(){var e=!this._isSelectOneElement;this.input.clear(e);if(!this._isTextElement&&this._canSearch){this._isSearching=false;this._store.dispatch(ie(true))}return this};e._render=function _render(){if(this._store.isLoading()){return}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;var t=this._isSelectElement;var i=this._currentState.items!==this._prevState.items;if(!e){return}if(t){this._renderChoices()}if(i){this._renderItems()}this._prevState=this._currentState};e._renderChoices=function _renderChoices(){var e=this;var t=this._store,i=t.activeGroups,n=t.activeChoices;var r=document.createDocumentFragment();this.choiceList.clear();if(this.config.resetScrollPosition){requestAnimationFrame((function(){return e.choiceList.scrollToTop()}))}if(i.length>=1&&!this._isSearching){var s=n.filter((function(e){return e.placeholder===true&&e.groupId===-1}));if(s.length>=1){r=this._createChoicesFragment(s,r)}r=this._createGroupsFragment(i,n,r)}else if(n.length>=1){r=this._createChoicesFragment(n,r)}if(r.childNodes&&r.childNodes.length>0){var o=this._store.activeItems;var a=this._canAddItem(o,this.input.value);if(a.response){this.choiceList.append(r);this._highlightChoice()}else{this.choiceList.append(this._getTemplate("notice",a.notice))}}else{var c;var l;if(this._isSearching){l=typeof this.config.noResultsText==="function"?this.config.noResultsText():this.config.noResultsText;c=this._getTemplate("notice",l,"no-results")}else{l=typeof this.config.noChoicesText==="function"?this.config.noChoicesText():this.config.noChoicesText;c=this._getTemplate("notice",l,"no-choices")}this.choiceList.append(c)}};e._renderItems=function _renderItems(){var e=this._store.activeItems||[];this.itemList.clear();var t=this._createItemsFragment(e);if(t.childNodes){this.itemList.append(t)}};e._createGroupsFragment=function _createGroupsFragment(e,t,i){var n=this;if(i===void 0){i=document.createDocumentFragment()}var r=function getGroupChoices(e){return t.filter((function(t){if(n._isSelectOneElement){return t.groupId===e.id}return t.groupId===e.id&&(n.config.renderSelectedChoices==="always"||!t.selected)}))};if(this.config.shouldSort){e.sort(this.config.sorter)}e.forEach((function(e){var t=r(e);if(t.length>=1){var s=n._getTemplate("choiceGroup",e);i.appendChild(s);n._createChoicesFragment(t,i,true)}}));return i};e._createChoicesFragment=function _createChoicesFragment(e,t,i){var n=this;if(t===void 0){t=document.createDocumentFragment()}if(i===void 0){i=false}var r=this.config,s=r.renderSelectedChoices,o=r.searchResultLimit,a=r.renderChoiceLimit;var c=this._isSearching?A:this.config.sorter;var l=function appendChoice(e){var i=s==="auto"?n._isSelectOneElement||!e.selected:true;if(i){var r=n._getTemplate("choice",e,n.config.itemSelectText);t.appendChild(r)}};var u=e;if(s==="auto"&&!this._isSelectOneElement){u=e.filter((function(e){return!e.selected}))}var h=u.reduce((function(e,t){if(t.placeholder){e.placeholderChoices.push(t)}else{e.normalChoices.push(t)}return e}),{placeholderChoices:[],normalChoices:[]}),d=h.placeholderChoices,f=h.normalChoices;if(this.config.shouldSort||this._isSearching){f.sort(c)}var p=u.length;var m=this._isSelectOneElement?[].concat(d,f):f;if(this._isSearching){p=o}else if(a&&a>0&&!i){p=a}for(var v=0;v=n){var o=r?this._searchChoices(e):0;this.passedElement.triggerEvent(R.search,{value:e,resultCount:o})}else if(s){this._isSearching=false;this._store.dispatch(ie(true))}};e._canAddItem=function _canAddItem(e,t){var i=true;var n=typeof this.config.addItemText==="function"?this.config.addItemText(t):this.config.addItemText;if(!this._isSelectOneElement){var r=T(e,t);if(this.config.maxItemCount>0&&this.config.maxItemCount<=e.length){i=false;n=typeof this.config.maxItemText==="function"?this.config.maxItemText(this.config.maxItemCount):this.config.maxItemText}if(!this.config.duplicateItemsAllowed&&r&&i){i=false;n=typeof this.config.uniqueItemText==="function"?this.config.uniqueItemText(t):this.config.uniqueItemText}if(this._isTextElement&&this.config.addItems&&i&&typeof this.config.addItemFilter==="function"&&!this.config.addItemFilter(t)){i=false;n=typeof this.config.customAddItemText==="function"?this.config.customAddItemText(t):this.config.customAddItemText}}return{response:i,notice:n}};e._searchChoices=function _searchChoices(e){var t=typeof e==="string"?e.trim():e;var i=typeof this._currentValue==="string"?this._currentValue.trim():this._currentValue;if(t.length<1&&t===i+" "){return 0}var n=this._store.searchableChoices;var s=t;var o=[].concat(this.config.searchFields);var a=Object.assign(this.config.fuseOptions,{keys:o});var c=new r.a(n,a);var l=c.search(s);this._currentValue=t;this._highlightPosition=0;this._isSearching=true;this._store.dispatch(te(l));return l.length};e._addEventListeners=function _addEventListeners(){var e=document,t=e.documentElement;t.addEventListener("touchend",this._onTouchEnd,true);this.containerOuter.element.addEventListener("keydown",this._onKeyDown,true);this.containerOuter.element.addEventListener("mousedown",this._onMouseDown,true);t.addEventListener("click",this._onClick,{passive:true});t.addEventListener("touchmove",this._onTouchMove,{passive:true});this.dropdown.element.addEventListener("mouseover",this._onMouseOver,{passive:true});if(this._isSelectOneElement){this.containerOuter.element.addEventListener("focus",this._onFocus,{passive:true});this.containerOuter.element.addEventListener("blur",this._onBlur,{passive:true})}this.input.element.addEventListener("keyup",this._onKeyUp,{passive:true});this.input.element.addEventListener("focus",this._onFocus,{passive:true});this.input.element.addEventListener("blur",this._onBlur,{passive:true});if(this.input.element.form){this.input.element.form.addEventListener("reset",this._onFormReset,{passive:true})}this.input.addEventListeners()};e._removeEventListeners=function _removeEventListeners(){var e=document,t=e.documentElement;t.removeEventListener("touchend",this._onTouchEnd,true);this.containerOuter.element.removeEventListener("keydown",this._onKeyDown,true);this.containerOuter.element.removeEventListener("mousedown",this._onMouseDown,true);t.removeEventListener("click",this._onClick);t.removeEventListener("touchmove",this._onTouchMove);this.dropdown.element.removeEventListener("mouseover",this._onMouseOver);if(this._isSelectOneElement){this.containerOuter.element.removeEventListener("focus",this._onFocus);this.containerOuter.element.removeEventListener("blur",this._onBlur)}this.input.element.removeEventListener("keyup",this._onKeyUp);this.input.element.removeEventListener("focus",this._onFocus);this.input.element.removeEventListener("blur",this._onBlur);if(this.input.element.form){this.input.element.form.removeEventListener("reset",this._onFormReset)}this.input.removeEventListeners()};e._onKeyDown=function _onKeyDown(e){var t;var i=e.target,n=e.keyCode,r=e.ctrlKey,s=e.metaKey;var o=this._store.activeItems;var a=this.input.isFocussed;var c=this.dropdown.isActive;var l=this.itemList.hasChildren();var u=String.fromCharCode(n);var h=B.BACK_KEY,d=B.DELETE_KEY,f=B.ENTER_KEY,p=B.A_KEY,m=B.ESC_KEY,v=B.UP_KEY,g=B.DOWN_KEY,_=B.PAGE_UP_KEY,b=B.PAGE_DOWN_KEY;var y=r||s;if(!this._isTextElement&&/[a-zA-Z0-9-_ ]/.test(u)){this.showDropdown()}var E=(t={},t[p]=this._onAKey,t[f]=this._onEnterKey,t[m]=this._onEscapeKey,t[v]=this._onDirectionKey,t[_]=this._onDirectionKey,t[g]=this._onDirectionKey,t[b]=this._onDirectionKey,t[d]=this._onDeleteKey,t[h]=this._onDeleteKey,t);if(E[n]){E[n]({event:e,target:i,keyCode:n,metaKey:s,activeItems:o,hasFocusedInput:a,hasActiveDropdown:c,hasItems:l,hasCtrlDownKeyPressed:y})}};e._onKeyUp=function _onKeyUp(e){var t=e.target,i=e.keyCode;var n=this.input.value;var r=this._store.activeItems;var s=this._canAddItem(r,n);var o=B.BACK_KEY,a=B.DELETE_KEY;if(this._isTextElement){var c=s.notice&&n;if(c){var l=this._getTemplate("notice",s.notice);this.dropdown.element.innerHTML=l.outerHTML;this.showDropdown(true)}else{this.hideDropdown(true)}}else{var u=(i===o||i===a)&&!t.value;var h=!this._isTextElement&&this._isSearching;var d=this._canSearch&&s.response;if(u&&h){this._isSearching=false;this._store.dispatch(ie(true))}else if(d){this._handleSearch(this.input.value)}}this._canSearch=this.config.searchEnabled};e._onAKey=function _onAKey(e){var t=e.hasItems,i=e.hasCtrlDownKeyPressed;if(i&&t){this._canSearch=false;var n=this.config.removeItems&&!this.input.value&&this.input.element===document.activeElement;if(n){this.highlightAll()}}};e._onEnterKey=function _onEnterKey(e){var t=e.event,i=e.target,n=e.activeItems,r=e.hasActiveDropdown;var s=B.ENTER_KEY;var o=i.hasAttribute("data-button");if(this._isTextElement&&i.value){var a=this.input.value;var c=this._canAddItem(n,a);if(c.response){this.hideDropdown(true);this._addItem({value:a});this._triggerChange(a);this.clearInput()}}if(o){this._handleButtonAction(n,i);t.preventDefault()}if(r){var l=this.dropdown.getChild("."+this.config.classNames.highlightedState);if(l){if(n[0]){n[0].keyCode=s}this._handleChoiceAction(n,l)}t.preventDefault()}else if(this._isSelectOneElement){this.showDropdown();t.preventDefault()}};e._onEscapeKey=function _onEscapeKey(e){var t=e.hasActiveDropdown;if(t){this.hideDropdown(true);this.containerOuter.focus()}};e._onDirectionKey=function _onDirectionKey(e){var t=e.event,i=e.hasActiveDropdown,n=e.keyCode,r=e.metaKey;var s=B.DOWN_KEY,o=B.PAGE_UP_KEY,a=B.PAGE_DOWN_KEY;if(i||this._isSelectOneElement){this.showDropdown();this._canSearch=false;var c=n===s||n===a?1:-1;var l=r||n===a||n===o;var u="[data-choice-selectable]";var h;if(l){if(c>0){h=this.dropdown.element.querySelector(u+":last-of-type")}else{h=this.dropdown.element.querySelector(u)}}else{var d=this.dropdown.element.querySelector("."+this.config.classNames.highlightedState);if(d){h=w(d,u,c)}else{h=this.dropdown.element.querySelector(u)}}if(h){if(!I(h,this.choiceList.element,c)){this.choiceList.scrollToChildElement(h,c)}this._highlightChoice(h)}t.preventDefault()}};e._onDeleteKey=function _onDeleteKey(e){var t=e.event,i=e.target,n=e.hasFocusedInput,r=e.activeItems;if(n&&!i.value&&!this._isSelectOneElement){this._handleBackspace(r);t.preventDefault()}};e._onTouchMove=function _onTouchMove(){if(this._wasTap){this._wasTap=false}};e._onTouchEnd=function _onTouchEnd(e){var t=e||e.touches[0],i=t.target;var n=this._wasTap&&this.containerOuter.element.contains(i);if(n){var r=i===this.containerOuter.element||i===this.containerInner.element;if(r){if(this._isTextElement){this.input.focus()}else if(this._isSelectMultipleElement){this.showDropdown()}}e.stopPropagation()}this._wasTap=true};e._onMouseDown=function _onMouseDown(e){var t=e.target;if(!(t instanceof HTMLElement)){return}if(he&&this.choiceList.element.contains(t)){var i=this.choiceList.element.firstElementChild;var n=this._direction==="ltr"?e.offsetX>=i.offsetWidth:e.offsetX0;if(n){this.unhighlightAll()}this.containerOuter.removeFocusState();this.hideDropdown(true)}};e._onFocus=function _onFocus(e){var t=this,i;var n=e.target;var r=this.containerOuter.element.contains(n);if(!r){return}var s=(i={},i[G]=function(){if(n===t.input.element){t.containerOuter.addFocusState()}},i[V]=function(){t.containerOuter.addFocusState();if(n===t.input.element){t.showDropdown(true)}},i[U]=function(){if(n===t.input.element){t.showDropdown(true);t.containerOuter.addFocusState()}},i);s[this.passedElement.element.type]()};e._onBlur=function _onBlur(e){var t=this;var i=e.target;var n=this.containerOuter.element.contains(i);if(n&&!this._isScrollingOnIe){var r;var s=this._store.activeItems;var o=s.some((function(e){return e.highlighted}));var a=(r={},r[G]=function(){if(i===t.input.element){t.containerOuter.removeFocusState();if(o){t.unhighlightAll()}t.hideDropdown(true)}},r[V]=function(){t.containerOuter.removeFocusState();if(i===t.input.element||i===t.containerOuter.element&&!t._canSearch){t.hideDropdown(true)}},r[U]=function(){if(i===t.input.element){t.containerOuter.removeFocusState();t.hideDropdown(true);if(o){t.unhighlightAll()}}},r);a[this.passedElement.element.type]()}else{this._isScrollingOnIe=false;this.input.element.focus()}};e._onFormReset=function _onFormReset(){this._store.dispatch(le(this._initialState))};e._highlightChoice=function _highlightChoice(e){var t=this;if(e===void 0){e=null}var i=Array.from(this.dropdown.element.querySelectorAll("[data-choice-selectable]"));if(!i.length){return}var n=e;var r=Array.from(this.dropdown.element.querySelectorAll("."+this.config.classNames.highlightedState));r.forEach((function(e){e.classList.remove(t.config.classNames.highlightedState);e.setAttribute("aria-selected","false")}));if(n){this._highlightPosition=i.indexOf(n)}else{if(i.length>this._highlightPosition){n=i[this._highlightPosition]}else{n=i[i.length-1]}if(!n){n=i[0]}}n.classList.add(this.config.classNames.highlightedState);n.setAttribute("aria-selected","true");this.passedElement.triggerEvent(R.highlightChoice,{el:n});if(this.dropdown.isActive){this.input.setActiveDescendant(n.id);this.containerOuter.setActiveDescendant(n.id)}};e._addItem=function _addItem(e){var t=e.value,i=e.label,n=i===void 0?null:i,r=e.choiceId,s=r===void 0?-1:r,o=e.groupId,a=o===void 0?-1:o,c=e.customProperties,l=c===void 0?null:c,u=e.placeholder,h=u===void 0?false:u,d=e.keyCode,f=d===void 0?null:d;var p=typeof t==="string"?t.trim():t;var m=f;var v=l;var g=this._store.items;var _=n||p;var b=s||-1;var y=a>=0?this._store.getGroupById(a):null;var E=g?g.length+1:1;if(this.config.prependValue){p=this.config.prependValue+p.toString()}if(this.config.appendValue){p+=this.config.appendValue.toString()}this._store.dispatch(re({value:p,label:_,id:E,choiceId:b,groupId:a,customProperties:l,placeholder:h,keyCode:m}));if(this._isSelectOneElement){this.removeActiveItems(E)}this.passedElement.triggerEvent(R.addItem,{id:E,value:p,label:_,customProperties:v,groupValue:y&&y.value?y.value:undefined,keyCode:m});return this};e._removeItem=function _removeItem(e){if(!e||!y("Object",e)){return this}var t=e.id,i=e.value,n=e.label,r=e.choiceId,s=e.groupId;var o=s>=0?this._store.getGroupById(s):null;this._store.dispatch(se(t,r));if(o&&o.value){this.passedElement.triggerEvent(R.removeItem,{id:t,value:i,label:n,groupValue:o.value})}else{this.passedElement.triggerEvent(R.removeItem,{id:t,value:i,label:n})}return this};e._addChoice=function _addChoice(e){var t=e.value,i=e.label,n=i===void 0?null:i,r=e.isSelected,s=r===void 0?false:r,o=e.isDisabled,a=o===void 0?false:o,c=e.groupId,l=c===void 0?-1:c,u=e.customProperties,h=u===void 0?null:u,d=e.placeholder,f=d===void 0?false:d,p=e.keyCode,m=p===void 0?null:p;if(typeof t==="undefined"||t===null){return}var v=this._store.choices;var g=n||t;var _=v?v.length+1:1;var b=this._baseId+"-"+this._idNames.itemChoice+"-"+_;this._store.dispatch(ee({id:_,groupId:l,elementId:b,value:t,label:g,disabled:a,customProperties:h,placeholder:f,keyCode:m}));if(s){this._addItem({value:t,label:g,choiceId:_,customProperties:h,placeholder:f,keyCode:m})}};e._addGroup=function _addGroup(e){var t=this;var i=e.group,n=e.id,r=e.valueKey,s=r===void 0?"value":r,o=e.labelKey,a=o===void 0?"label":o;var c=y("Object",i)?i.choices:Array.from(i.getElementsByTagName("OPTION"));var l=n||Math.floor((new Date).valueOf()*Math.random());var u=i.disabled?i.disabled:false;if(c){this._store.dispatch(ae({value:i.label,id:l,active:true,disabled:u}));var h=function addGroupChoices(e){var i=e.disabled||e.parentNode&&e.parentNode.disabled;t._addChoice({value:e[s],label:y("Object",e)?e[a]:e.innerHTML,isSelected:e.selected,isDisabled:i,groupId:l,customProperties:e.customProperties,placeholder:e.placeholder})};c.forEach(h)}else{this._store.dispatch(ae({value:i.label,id:i.id,active:false,disabled:i.disabled}))}};e._getTemplate=function _getTemplate(e){var t;if(!e){return null}var i=this.config.classNames;for(var n=arguments.length,r=new Array(n>1?n-1:0),s=1;s