diff --git a/CHANGELOG.md b/CHANGELOG.md index 0418c019a..65772dfd6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ ### Bug Fixes (from 10.2.0) * Fix Choices does not accept an element from an iframe [#1057](https://github.com/Choices-js/Choices/issues/1057) +* Fix Choices was not disable in a `
` [#1132](https://github.com/Choices-js/Choices/issues/1132) ## [11.0.0-rc5] (2024-08-08) diff --git a/public/assets/scripts/choices.cjs b/public/assets/scripts/choices.cjs index 81ad670a7..705b32938 100644 --- a/public/assets/scripts/choices.cjs +++ b/public/assets/scripts/choices.cjs @@ -3812,8 +3812,12 @@ var Choices = /** @class */ (function () { this._store.subscribe(this._render); this._render(); this._addEventListeners(); - var shouldDisable = !this.config.addItems || - this.passedElement.element.hasAttribute('disabled'); + var shouldDisable = (this._isTextElement && !this.config.addItems) || + (this._isSelectElement && + !this.config.addChoices && + this._store.choices.length === 0) || + this.passedElement.element.hasAttribute('disabled') || + !!this.passedElement.element.closest('fieldset:disabled'); if (shouldDisable) { this.disable(); } diff --git a/public/assets/scripts/choices.js b/public/assets/scripts/choices.js index 1a993f8af..37236defd 100644 --- a/public/assets/scripts/choices.js +++ b/public/assets/scripts/choices.js @@ -3816,8 +3816,12 @@ this._store.subscribe(this._render); this._render(); this._addEventListeners(); - var shouldDisable = !this.config.addItems || - this.passedElement.element.hasAttribute('disabled'); + var shouldDisable = (this._isTextElement && !this.config.addItems) || + (this._isSelectElement && + !this.config.addChoices && + this._store.choices.length === 0) || + this.passedElement.element.hasAttribute('disabled') || + !!this.passedElement.element.closest('fieldset:disabled'); if (shouldDisable) { this.disable(); } diff --git a/public/assets/scripts/choices.min.cjs b/public/assets/scripts/choices.min.cjs index 0fdeff666..6d6d2f81a 100644 --- a/public/assets/scripts/choices.min.cjs +++ b/public/assets/scripts/choices.min.cjs @@ -1,2 +1,2 @@ /*! choices.js v11.0.0-rc5 | © 2024 Josh Johnson | https://github.com/jshjohnson/Choices#readme */ -"use strict";var e=function(t,i){return e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i])},e(t,i)};function t(t,i){if("function"!=typeof i&&null!==i)throw new TypeError("Class extends value "+String(i)+" is not a constructor or null");function n(){this.constructor=t}e(t,i),t.prototype=null===i?Object.create(i):(n.prototype=i.prototype,new n)}var i=function(){return i=Object.assign||function(e){for(var t,i=1,n=arguments.length;i`Missing ${e} property in key`,_=e=>`Property 'weight' in key '${e}' must be a positive integer`,y=Object.prototype.hasOwnProperty;class b{constructor(e){this._keys=[],this._keyMap={};let t=0;e.forEach((e=>{let i=E(e);this._keys.push(i),this._keyMap[i.id]=i,t+=i.weight})),this._keys.forEach((e=>{e.weight/=t}))}get(e){return this._keyMap[e]}keys(){return this._keys}toJSON(){return JSON.stringify(this._keys)}}function E(e){let t=null,i=null,n=null,s=1,o=null;if(l(e)||c(e))n=e,t=C(e),i=I(e);else{if(!y.call(e,"name"))throw new Error(v("name"));const r=e.name;if(n=r,y.call(e,"weight")&&(s=e.weight,s<=0))throw new Error(_(r));t=C(r),i=I(r),o=e.getFn}return{path:t,id:i,weight:s,src:n,getFn:o}}function C(e){return c(e)?e:e.split(".")}function I(e){return c(e)?e.join("."):e}const S={useExtendedSearch:!1,getFn:function(e,t){let i=[],n=!1;const s=(e,t,o)=>{if(f(e))if(t[o]){const r=e[t[o]];if(!f(r))return;if(o===t.length-1&&(l(r)||u(r)||d(r)))i.push(h(r));else if(c(r)){n=!0;for(let e=0,i=r.length;ee.score===t.score?e.idx{this._keysMap[e.id]=t}))}create(){!this.isCreated&&this.docs.length&&(this.isCreated=!0,l(this.docs[0])?this.docs.forEach(((e,t)=>{this._addString(e,t)})):this.docs.forEach(((e,t)=>{this._addObject(e,t)})),this.norm.clear())}add(e){const t=this.size();l(e)?this._addString(e,t):this._addObject(e,t)}removeAt(e){this.records.splice(e,1);for(let t=e,i=this.size();t{let s=t.getFn?t.getFn(e):this.getFn(e,t.path);if(f(s))if(c(s)){let e=[];const t=[{nestedArrIndex:-1,value:s}];for(;t.length;){const{nestedArrIndex:i,value:n}=t.pop();if(f(n))if(l(n)&&!m(n)){let t={v:n,i:i,n:this.norm.get(n)};e.push(t)}else c(n)&&n.forEach(((e,i)=>{t.push({nestedArrIndex:i,value:e})}))}i.$[n]=e}else if(l(s)&&!m(s)){let e={v:s,n:this.norm.get(s)};i.$[n]=e}})),this.records.push(i)}toJSON(){return{keys:this.keys,records:this.records}}}function A(e,t,{getFn:i=w.getFn,fieldNormWeight:n=w.fieldNormWeight}={}){const s=new L({getFn:i,fieldNormWeight:n});return s.setKeys(e.map(E)),s.setSources(t),s.create(),s}function x(e,{errors:t=0,currentLocation:i=0,expectedLocation:n=0,distance:s=w.distance,ignoreLocation:o=w.ignoreLocation}={}){const r=t/e.length;if(o)return r;const c=Math.abs(n-i);return s?r+c/s:c?1:r}const T=32;function M(e,t,i,{location:n=w.location,distance:s=w.distance,threshold:o=w.threshold,findAllMatches:r=w.findAllMatches,minMatchCharLength:c=w.minMatchCharLength,includeMatches:a=w.includeMatches,ignoreLocation:h=w.ignoreLocation}={}){if(t.length>T)throw new Error(`Pattern length exceeds max of ${T}.`);const l=t.length,u=e.length,d=Math.max(0,Math.min(n,u));let p=o,f=d;const m=c>1||a,g=m?Array(u):[];let v;for(;(v=e.indexOf(t,f))>-1;){let e=x(t,{currentLocation:v,expectedLocation:d,distance:s,ignoreLocation:h});if(p=Math.min(e,p),f=v+l,m){let e=0;for(;e=a;o-=1){let r=o-1,c=i[e.charAt(r)];if(m&&(g[r]=+!!c),C[o]=(C[o+1]<<1|1)&c,n&&(C[o]|=(_[o+1]|_[o])<<1|1|_[o+1]),C[o]&E&&(y=x(t,{errors:n,currentLocation:r,expectedLocation:d,distance:s,ignoreLocation:h}),y<=p)){if(p=y,f=r,f<=d)break;a=Math.max(1,2*d-f)}}if(x(t,{errors:n+1,currentLocation:d,expectedLocation:d,distance:s,ignoreLocation:h})>p)break;_=C}const C={isMatch:f>=0,score:Math.max(.001,y)};if(m){const e=function(e=[],t=w.minMatchCharLength){let i=[],n=-1,s=-1,o=0;for(let r=e.length;o=t&&i.push([n,s]),n=-1)}return e[o-1]&&o-n>=t&&i.push([n,o-1]),i}(g,c);e.length?a&&(C.indices=e):C.isMatch=!1}return C}function N(e){let t={};for(let i=0,n=e.length;i{this.chunks.push({pattern:e,alphabet:N(e),startIndex:t})},l=this.pattern.length;if(l>T){let e=0;const t=l%T,i=l-t;for(;e{const{isMatch:f,score:m,indices:g}=M(e,t,d,{location:n+p,distance:s,threshold:o,findAllMatches:r,minMatchCharLength:c,includeMatches:i,ignoreLocation:a});f&&(u=!0),l+=m,f&&g&&(h=[...h,...g])}));let d={isMatch:u,score:u?l/this.chunks.length:1};return u&&i&&(d.indices=h),d}}class F{constructor(e){this.pattern=e}static isMultiMatch(e){return j(e,this.multiRegex)}static isSingleMatch(e){return j(e,this.singleRegex)}search(){}}function j(e,t){const i=e.match(t);return i?i[1]:null}class P extends F{constructor(e,{location:t=w.location,threshold:i=w.threshold,distance:n=w.distance,includeMatches:s=w.includeMatches,findAllMatches:o=w.findAllMatches,minMatchCharLength:r=w.minMatchCharLength,isCaseSensitive:c=w.isCaseSensitive,ignoreLocation:a=w.ignoreLocation}={}){super(e),this._bitapSearch=new D(e,{location:t,threshold:i,distance:n,includeMatches:s,findAllMatches:o,minMatchCharLength:r,isCaseSensitive:c,ignoreLocation:a})}static get type(){return"fuzzy"}static get multiRegex(){return/^"(.*)"$/}static get singleRegex(){return/^(.*)$/}search(e){return this._bitapSearch.searchIn(e)}}class R extends F{constructor(e){super(e)}static get type(){return"include"}static get multiRegex(){return/^'"(.*)"$/}static get singleRegex(){return/^'(.*)$/}search(e){let t,i=0;const n=[],s=this.pattern.length;for(;(t=e.indexOf(this.pattern,i))>-1;)i=t+s,n.push([t,i-1]);const o=!!n.length;return{isMatch:o,score:o?0:1,indices:n}}}const k=[class extends F{constructor(e){super(e)}static get type(){return"exact"}static get multiRegex(){return/^="(.*)"$/}static get singleRegex(){return/^=(.*)$/}search(e){const t=e===this.pattern;return{isMatch:t,score:t?0:1,indices:[0,this.pattern.length-1]}}},R,class extends F{constructor(e){super(e)}static get type(){return"prefix-exact"}static get multiRegex(){return/^\^"(.*)"$/}static get singleRegex(){return/^\^(.*)$/}search(e){const t=e.startsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,this.pattern.length-1]}}},class extends F{constructor(e){super(e)}static get type(){return"inverse-prefix-exact"}static get multiRegex(){return/^!\^"(.*)"$/}static get singleRegex(){return/^!\^(.*)$/}search(e){const t=!e.startsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,e.length-1]}}},class extends F{constructor(e){super(e)}static get type(){return"inverse-suffix-exact"}static get multiRegex(){return/^!"(.*)"\$$/}static get singleRegex(){return/^!(.*)\$$/}search(e){const t=!e.endsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,e.length-1]}}},class extends F{constructor(e){super(e)}static get type(){return"suffix-exact"}static get multiRegex(){return/^"(.*)"\$$/}static get singleRegex(){return/^(.*)\$$/}search(e){const t=e.endsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[e.length-this.pattern.length,e.length-1]}}},class extends F{constructor(e){super(e)}static get type(){return"inverse-exact"}static get multiRegex(){return/^!"(.*)"$/}static get singleRegex(){return/^!(.*)$/}search(e){const t=-1===e.indexOf(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,e.length-1]}}},P],H=k.length,V=/ +(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/;const K=new Set([P.type,R.type]);class B{constructor(e,{isCaseSensitive:t=w.isCaseSensitive,includeMatches:i=w.includeMatches,minMatchCharLength:n=w.minMatchCharLength,ignoreLocation:s=w.ignoreLocation,findAllMatches:o=w.findAllMatches,location:r=w.location,threshold:c=w.threshold,distance:a=w.distance}={}){this.query=null,this.options={isCaseSensitive:t,includeMatches:i,minMatchCharLength:n,findAllMatches:o,ignoreLocation:s,location:r,threshold:c,distance:a},this.pattern=t?e:e.toLowerCase(),this.query=function(e,t={}){return e.split("|").map((e=>{let i=e.trim().split(V).filter((e=>e&&!!e.trim())),n=[];for(let e=0,s=i.length;e!(!e[q]&&!e[W]),J=e=>({[q]:Object.keys(e).map((t=>({[t]:e[t]})))});function Q(e,t,{auto:i=!0}={}){const n=e=>{let s=Object.keys(e);const o=(e=>!!e[G])(e);if(!o&&s.length>1&&!z(e))return n(J(e));if((e=>!c(e)&&p(e)&&!z(e))(e)){const n=o?e[G]:s[0],r=o?e[X]:e[n];if(!l(r))throw new Error((e=>`Invalid value for key ${e}`)(n));const c={keyId:I(n),pattern:r};return i&&(c.searcher=U(r,t)),c}let r={children:[],operator:s[0]};return s.forEach((t=>{const i=e[t];c(i)&&i.forEach((e=>{r.children.push(n(e))}))})),r};return z(e)||(e=J(e)),n(e)}function Y(e,t){const i=e.matches;t.matches=[],f(i)&&i.forEach((e=>{if(!f(e.indices)||!e.indices.length)return;const{indices:i,value:n}=e;let s={indices:i,value:n};e.key&&(s.key=e.key.src),e.idx>-1&&(s.refIndex=e.idx),t.matches.push(s)}))}function Z(e,t){t.score=e.score}class ee{constructor(e,t={},i){this.options=r(r({},w),t),this.options.useExtendedSearch,this._keyStore=new b(this.options.keys),this.setCollection(e,i)}setCollection(e,t){if(this._docs=e,t&&!(t instanceof L))throw new Error("Incorrect 'index' type");this._myIndex=t||A(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight})}add(e){f(e)&&(this._docs.push(e),this._myIndex.add(e))}remove(e=()=>!1){const t=[];for(let i=0,n=this._docs.length;i{let i=1;e.matches.forEach((({key:e,norm:n,score:s})=>{const o=e?e.weight:null;i*=Math.pow(0===s&&o?Number.EPSILON:s,(o||1)*(t?1:n))})),e.score=i}))}(c,{ignoreFieldNorm:r}),s&&c.sort(o),u(t)&&t>-1&&(c=c.slice(0,t)),function(e,t,{includeMatches:i=w.includeMatches,includeScore:n=w.includeScore}={}){const s=[];return i&&s.push(Y),n&&s.push(Z),e.map((e=>{const{idx:i}=e,n={item:t[i],refIndex:i};return s.length&&s.forEach((t=>{t(e,n)})),n}))}(c,this._docs,{includeMatches:i,includeScore:n})}_searchStringList(e){const t=U(e,this.options),{records:i}=this._myIndex,n=[];return i.forEach((({v:e,i:i,n:s})=>{if(!f(e))return;const{isMatch:o,score:r,indices:c}=t.searchIn(e);o&&n.push({item:e,idx:i,matches:[{score:r,value:e,norm:s,indices:c}]})})),n}_searchLogical(e){const t=Q(e,this.options),i=(e,t,n)=>{if(!e.children){const{keyId:i,searcher:s}=e,o=this._findMatches({key:this._keyStore.get(i),value:this._myIndex.getValueForItemAtKeyId(t,i),searcher:s});return o&&o.length?[{idx:n,item:t,matches:o}]:[]}const s=[];for(let o=0,r=e.children.length;o{if(f(e)){let r=i(t,e,n);r.length&&(s[n]||(s[n]={idx:n,item:e,matches:[]},o.push(s[n])),r.forEach((({matches:e})=>{s[n].matches.push(...e)})))}})),o}_searchObjectList(e){const t=U(e,this.options),{keys:i,records:n}=this._myIndex,s=[];return n.forEach((({$:e,i:n})=>{if(!f(e))return;let o=[];i.forEach(((i,n)=>{o.push(...this._findMatches({key:i,value:e[n],searcher:t}))})),o.length&&s.push({idx:n,item:e,matches:o})})),s}_findMatches({key:e,value:t,searcher:i}){if(!f(t))return[];let n=[];if(c(t))t.forEach((({v:t,i:s,n:o})=>{if(!f(t))return;const{isMatch:r,score:c,indices:a}=i.searchIn(t);r&&n.push({score:c,key:e,value:t,idx:s,norm:o,indices:a})}));else{const{v:s,n:o}=t,{isMatch:r,score:c,indices:a}=i.searchIn(s);r&&n.push({score:c,key:e,value:s,norm:o,indices:a})}return n}}ee.version="7.0.0",ee.createIndex=A,ee.parseIndex=function(e,{getFn:t=w.getFn,fieldNormWeight:i=w.fieldNormWeight}={}){const{keys:n,records:s}=e,o=new L({getFn:t,fieldNormWeight:i});return o.setKeys(n),o.setIndexRecords(s),o},ee.config=w,ee.parseQuery=Q,function(...e){$.push(...e)}(B);var te,ie=function(e,t,s){return new ee(t,i(i({},e.fuseOptions),{keys:n([],e.searchFields,!0),includeMatches:!0})).search(s)},ne=function(e,t){return{type:"HIGHLIGHT_ITEM",item:e,highlighted:t}},se=function(e){return{type:"SET_IS_LOADING",isLoading:e}},oe=function(e){return Array.from({length:e},(function(){return(e=0,t=36,Math.floor(Math.random()*(t-e)+e)).toString(36);var e,t})).join("")},re=function(e){if("string"!=typeof e){if(null==e)return"";if("object"==typeof e){if("raw"in e)return re(e.raw);if("trusted"in e)return e.trusted}return e}return e.replace(/&/g,"&").replace(/>/g,">").replace(/0?this.element.scrollTop+r-s:e.offsetTop;requestAnimationFrame((function(){i._animateScroll(c,t)}))}},e.prototype._scrollDown=function(e,t,i){var n=(i-e)/t,s=n>1?n:1;this.element.scrollTop=e+s},e.prototype._scrollUp=function(e,t,i){var n=(e-i)/t,s=n>1?n:1;this.element.scrollTop=e-s},e.prototype._animateScroll=function(e,t){var i=this,n=this.element.scrollTop,s=!1;t>0?(this._scrollDown(n,4,e),ne&&(s=!0)),s&&requestAnimationFrame((function(){i._animateScroll(e,t)}))},e}(),be=function(){function e(e){var t=e.element,i=e.classNames;this.element=t,this.classNames=i,this.isDisabled=!1}return Object.defineProperty(e.prototype,"isActive",{get:function(){return"active"===this.element.dataset.choice},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"dir",{get:function(){return this.element.dir},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"value",{get:function(){return this.element.value},set:function(e){this.element.setAttribute("value",e),this.element.value=e},enumerable:!1,configurable:!0}),e.prototype.conceal=function(){var e;(e=this.element.classList).add.apply(e,le(this.classNames.input)),this.element.hidden=!0,this.element.tabIndex=-1;var t=this.element.getAttribute("style");t&&this.element.setAttribute("data-choice-orig-style",t),this.element.setAttribute("data-choice","active")},e.prototype.reveal=function(){var e;(e=this.element.classList).remove.apply(e,le(this.classNames.input)),this.element.hidden=!1,this.element.removeAttribute("tabindex");var t=this.element.getAttribute("data-choice-orig-style");t?(this.element.removeAttribute("data-choice-orig-style"),this.element.setAttribute("style",t)):this.element.removeAttribute("style"),this.element.removeAttribute("data-choice"),this.element.value=this.element.value},e.prototype.enable=function(){this.element.removeAttribute("disabled"),this.element.disabled=!1,this.isDisabled=!1},e.prototype.disable=function(){this.element.setAttribute("disabled",""),this.element.disabled=!0,this.isDisabled=!0},e.prototype.triggerEvent=function(e,t){!function(e,t,i){void 0===i&&(i=null);var n=new CustomEvent(t,{detail:i,bubbles:!0,cancelable:!0});e.dispatchEvent(n)}(this.element,e,t)},e}(),Ee=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return t(i,e),i}(be),Ce=function(e,t){return void 0===t&&(t=!0),void 0===e?t:!!e},Ie=function(e){if("string"==typeof e&&(e=e.split(" ").filter((function(e){return 0!==e.length}))),Array.isArray(e)&&0!==e.length)return e},Se=function(e,t){if("string"==typeof e)return Se({value:e,label:e},!1);var i=e;if("choices"in i){if(!t)throw new TypeError("optGroup is not allowed");var n=i,s=n.choices.map((function(e){return Se(e,!1)}));return{id:0,label:ae(n.label)||n.value,active:0!==s.length,disabled:!!n.disabled,choices:s}}var o=i;return{id:0,groupId:0,score:0,value:o.value,label:o.label||o.value,active:Ce(o.active),selected:Ce(o.selected,!1),disabled:Ce(o.disabled,!1),placeholder:Ce(o.placeholder,!1),highlighted:!1,labelClass:Ie(o.labelClass),labelDescription:o.labelDescription,customProperties:o.customProperties}},we=function(e){function i(t){var i=t.element,n=t.classNames,s=t.template,o=t.extractPlaceholder,r=e.call(this,{element:i,classNames:n})||this;return r.template=s,r.extractPlaceholder=o,r}return t(i,e),Object.defineProperty(i.prototype,"placeholderOption",{get:function(){return this.element.querySelector('option[value=""]')||this.element.querySelector("option[placeholder]")},enumerable:!1,configurable:!0}),i.prototype.addOptions=function(e){var t=this;e.forEach((function(e){var i=e;if(!i.element){var n=t.template(i);t.element.appendChild(n),i.element=n}}))},i.prototype.optionsAsChoices=function(){var e=this,t=[];return this.element.querySelectorAll(":scope > option, :scope > optgroup").forEach((function(i){!function(e){return"OPTION"===e.tagName}(i)?function(e){return"OPTGROUP"===e.tagName}(i)&&t.push(e._optgroupToChoice(i)):t.push(e._optionToChoice(i))})),t},i.prototype._optionToChoice=function(e){return{id:0,groupId:0,score:0,value:e.value,label:e.innerHTML,element:e,active:!0,selected:this.extractPlaceholder?e.selected:e.hasAttribute("selected"),disabled:e.disabled,highlighted:!1,placeholder:this.extractPlaceholder&&(""===e.value||e.hasAttribute("placeholder")),labelClass:void 0!==e.dataset.labelClass?Ie(e.dataset.labelClass):void 0,labelDescription:void 0!==e.dataset.labelDescription?e.dataset.labelDescription:void 0,customProperties:de(e.dataset.customProperties)}},i.prototype._optgroupToChoice=function(e){var t=this,i=e.querySelectorAll("option"),n=Array.from(i).map((function(e){return t._optionToChoice(e)}));return{id:0,label:e.label||"",element:e,active:0!==n.length,disabled:e.disabled,choices:n}},i}(be),Oe={items:[],choices:[],silent:!1,renderChoiceLimit:-1,maxItemCount:-1,singleModeForMultiSelect:!1,addChoices:!1,addItems:!0,addItemFilter:function(e){return!!e&&""!==e},removeItems:!0,removeItemButton:!1,removeItemButtonAlignLeft:!1,editItems:!1,allowHTML:!1,allowHtmlUserInput:!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,sorter:function(e,t){var i=e.value,n=e.label,s=void 0===n?i:n,o=t.value,r=t.label,c=void 0===r?o:r;return ae(s).localeCompare(ae(c),[],{sensitivity:"base",ignorePunctuation:!0,numeric:!0})},shadowRoot:null,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 "'.concat(e,'"')},removeItemIconText:function(){return"Remove item"},removeItemLabelText:function(e){return"Remove item: ".concat(e)},maxItemText:function(e){return"Only ".concat(e," values can be added")},valueComparer:function(e,t){return e===t},fuseOptions:{includeScore:!0},labelId:"",callbackOnInit:null,callbackOnCreateTemplates:null,classNames:{containerOuter:["choices"],containerInner:["choices__inner"],input:["choices__input"],inputCloned:["choices__input--cloned"],list:["choices__list"],listItems:["choices__list--multiple"],listSingle:["choices__list--single"],listDropdown:["choices__list--dropdown"],item:["choices__item"],itemSelectable:["choices__item--selectable"],itemDisabled:["choices__item--disabled"],itemChoice:["choices__item--choice"],description:["choices__description"],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"],selectedState:["is-selected"],flippedState:["is-flipped"],loadingState:["is-loading"],addChoice:["choices__item","choices__item--selectable","add-choice"],noResults:["has-no-results"],noChoices:["has-no-choices"]},appendGroupInSearch:!1},Le=["fuseOptions","classNames"];function Ae(e){return"Minified Redux error #"+e+"; visit https://redux.js.org/Errors?code="+e+" for the full message or use the non-minified dev environment for full errors. "}var xe="function"==typeof Symbol&&Symbol.observable||"@@observable",Te=function(){return Math.random().toString(36).substring(7).split("").join(".")},Me={INIT:"@@redux/INIT"+Te(),REPLACE:"@@redux/REPLACE"+Te(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+Te()}};function Ne(e,t,i){var n;if("function"==typeof t&&"function"==typeof i||"function"==typeof i&&"function"==typeof arguments[3])throw new Error(Ae(0));if("function"==typeof t&&void 0===i&&(i=t,t=void 0),void 0!==i){if("function"!=typeof i)throw new Error(Ae(1));return i(Ne)(e,t)}if("function"!=typeof e)throw new Error(Ae(2));var s=e,o=t,r=[],c=r,a=!1;function h(){c===r&&(c=r.slice())}function l(){if(a)throw new Error(Ae(3));return o}function u(e){if("function"!=typeof e)throw new Error(Ae(4));if(a)throw new Error(Ae(5));var t=!0;return h(),c.push(e),function(){if(t){if(a)throw new Error(Ae(6));t=!1,h();var i=c.indexOf(e);c.splice(i,1),r=null}}}function d(e){if(!function(e){if("object"!=typeof e||null===e)return!1;for(var t=e;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}(e))throw new Error(Ae(7));if(void 0===e.type)throw new Error(Ae(8));if(a)throw new Error(Ae(9));try{a=!0,o=s(o,e)}finally{a=!1}for(var t=r=c,i=0;i0},e.prototype.getChoiceById=function(e){return this.activeChoices.find((function(t){return t.id===e}))},e.prototype.getGroupById=function(e){return this.groups.find((function(t){return t.id===e}))},e}(),Re=function(e,t){return e?function(e){if("string"==typeof e)return e;if("object"==typeof e){if("escaped"in e)return e.escaped;if("trusted"in e)return e.trusted}return""}(t):re(t)},ke=function(e,t){if(t){var i=e.dataset;"string"==typeof t?i.customProperties=t:"object"!=typeof t||function(e){for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0}(t)||(i.customProperties=JSON.stringify(t))}},He={containerOuter:function(e,t,i,n,s,o,r){var c=e.classNames.containerOuter,a=Object.assign(document.createElement("div"),{className:le(c).join(" ")});return a.dataset.type=o,t&&(a.dir=t),n&&(a.tabIndex=0),i&&(a.setAttribute("role",s?"combobox":"listbox"),s&&a.setAttribute("aria-autocomplete","list")),a.setAttribute("aria-haspopup","true"),a.setAttribute("aria-expanded","false"),r&&a.setAttribute("aria-labelledby",r),a},containerInner:function(e){var t=e.classNames.containerInner;return Object.assign(document.createElement("div"),{className:le(t).join(" ")})},itemList:function(e,t){var i=e.classNames,n=i.list,s=i.listSingle,o=i.listItems;return Object.assign(document.createElement("div"),{className:"".concat(le(n).join(" ")," ").concat(t?le(s).join(" "):le(o).join(" "))})},placeholder:function(e,t){var i=e.allowHTML,n=e.classNames.placeholder;return Object.assign(document.createElement("div"),{className:le(n).join(" "),innerHTML:Re(i,t)})},item:function(e,t,i){var n,s,o,r=e.allowHTML,c=e.removeItemButtonAlignLeft,a=e.classNames,h=a.item,l=a.button,u=a.highlightedState,d=a.itemSelectable,p=a.placeholder,f=t.id,m=t.value,g=t.label,v=t.labelClass,_=t.labelDescription,y=t.customProperties,b=t.active,E=t.disabled,C=t.highlighted,I=t.placeholder,S=Object.assign(document.createElement("div"),{className:le(h).join(" ")});if(v){var w=Object.assign(document.createElement("span"),{innerHTML:Re(r,g),className:le(v).join(" ")});S.appendChild(w)}else S.innerHTML=Re(r,g);if(Object.assign(S.dataset,{item:"",id:f,value:m}),v&&(S.dataset.labelClass=le(v).join(" ")),_&&(S.dataset.labelDescription=_),ke(S,y),b&&S.setAttribute("aria-selected","true"),E&&S.setAttribute("aria-disabled","true"),I&&((n=S.classList).add.apply(n,le(p)),S.dataset.placeholder=""),(s=S.classList).add.apply(s,le(C?u:d)),i){E&&(o=S.classList).remove.apply(o,le(d)),S.dataset.deletable="";var O="function"==typeof this.config.removeItemIconText?this.config.removeItemIconText(re(m),m):this.config.removeItemIconText,L="function"==typeof this.config.removeItemLabelText?this.config.removeItemLabelText(re(m),m):this.config.removeItemLabelText,A=Object.assign(document.createElement("button"),{type:"button",className:le(l).join(" "),innerHTML:O});A.setAttribute("aria-label",L),A.dataset.button="",c?S.insertAdjacentElement("afterbegin",A):S.appendChild(A)}return S},choiceList:function(e,t){var i=e.classNames.list,n=Object.assign(document.createElement("div"),{className:le(i).join(" ")});return t||n.setAttribute("aria-multiselectable","true"),n.setAttribute("role","listbox"),n},choiceGroup:function(e,t){var i=e.allowHTML,n=e.classNames,s=n.group,o=n.groupHeading,r=n.itemDisabled,c=t.id,a=t.label,h=t.disabled,l=Object.assign(document.createElement("div"),{className:"".concat(le(s).join(" ")," ").concat(h?le(r).join(" "):"")});return l.setAttribute("role","group"),Object.assign(l.dataset,{group:"",id:c,value:a}),h&&l.setAttribute("aria-disabled","true"),l.appendChild(Object.assign(document.createElement("div"),{className:le(o).join(" "),innerHTML:Re(i,a)})),l},choice:function(e,t,i){var n,s,o,r,c,a=e.allowHTML,h=e.classNames,l=h.item,u=h.itemChoice,d=h.itemSelectable,p=h.selectedState,f=h.itemDisabled,m=h.description,g=h.placeholder,v=t.id,_=t.value,y=t.label,b=t.groupId,E=t.elementId,C=t.labelClass,I=t.labelDescription,S=t.disabled,w=t.selected,O=t.placeholder,L=Object.assign(document.createElement("div"),{id:E,className:"".concat(le(l).join(" ")," ").concat(le(u).join(" "))}),A=L;if(C){var x=Object.assign(document.createElement("span"),{innerHTML:Re(a,y),className:le(C).join(" ")});A=x,L.appendChild(x)}else L.innerHTML=Re(a,y);if(I){var T="".concat(E,"-description");A.setAttribute("aria-describedby",T);var M=Object.assign(document.createElement("span"),{innerHTML:Re(a,I),id:T});(n=M.classList).add.apply(n,le(m)),L.appendChild(M)}return w&&(s=L.classList).add.apply(s,le(p)),O&&(o=L.classList).add.apply(o,le(g)),L.setAttribute("role",b&&b>0?"treeitem":"option"),Object.assign(L.dataset,{choice:"",id:v,value:_,selectText:i}),C&&(L.dataset.labelClass=le(C).join(" ")),I&&(L.dataset.labelDescription=I),S?((r=L.classList).add.apply(r,le(f)),L.dataset.choiceDisabled="",L.setAttribute("aria-disabled","true")):((c=L.classList).add.apply(c,le(d)),L.dataset.choiceSelectable=""),L},input:function(e,t){var i=e.classNames,n=i.input,s=i.inputCloned,o=Object.assign(document.createElement("input"),{type:"search",className:"".concat(le(n).join(" ")," ").concat(le(s).join(" ")),autocomplete:"off",autocapitalize:"off",spellcheck:!1});return o.setAttribute("role","textbox"),o.setAttribute("aria-autocomplete","list"),t&&o.setAttribute("aria-label",t),o},dropdown:function(e){var t,i,n=e.classNames,s=n.list,o=n.listDropdown,r=document.createElement("div");return(t=r.classList).add.apply(t,le(s)),(i=r.classList).add.apply(i,le(o)),r.setAttribute("aria-expanded","false"),r},notice:function(e,t,i){var s=e.allowHTML,o=e.classNames,r=o.item,c=o.itemChoice,a=o.addChoice,h=o.noResults,l=o.noChoices;void 0===i&&(i="");var u=n(n([],le(r),!0),le(c),!0);switch(i){case"add-choice":u.push.apply(u,le(a));break;case"no-results":u.push.apply(u,le(h));break;case"no-choices":u.push.apply(u,le(l))}var d=Object.assign(document.createElement("div"),{innerHTML:Re(s,t),className:u.join(" ")});return"add-choice"===i&&(d.dataset.choiceSelectable="",d.dataset.choice=""),d},option:function(e){var t=e.label,i=e.value,n=e.labelClass,s=e.labelDescription,o=e.customProperties,r=e.active,c=e.disabled,a=ae(t),h=new Option(a,i,!1,r);return n&&(h.dataset.labelClass=le(n).join(" ")),s&&(h.dataset.labelDescription=s),ke(h,o),h.disabled=c,h}},Ve="-ms-scroll-limit"in document.documentElement.style&&"-ms-ime-align"in document.documentElement.style,Ke={},Be=function(e){if(e){var t=e.dataset.id;return t?parseInt(t,10):void 0}},$e=function(){function e(t,n){void 0===t&&(t="[data-choice]"),void 0===n&&(n={});var s=this;this._hasNonChoicePlaceholder=!1,this._lastAddedChoiceId=0,this._lastAddedGroupId=0,this.config=i(i(i({},e.defaults.allOptions),e.defaults.options),n),Le.forEach((function(t){s.config[t]=i(i(i({},e.defaults.allOptions[t]),e.defaults.options[t]),n[t])}));var o,r,c,a,h=(o=this.config,r=Oe,c=Object.keys(o).sort(),a=Object.keys(r).sort(),c.filter((function(e){return a.indexOf(e)<0})));h.length&&console.warn("Unknown config option(s) passed",h.join(", ")),!this.config.silent&&this.config.allowHTML&&this.config.allowHtmlUserInput&&(this.config.addItems&&console.warn("Warning: allowHTML/allowHtmlUserInput/addItems all being true is strongly not recommended and may lead to XSS attacks"),this.config.addChoices&&console.warn("Warning: allowHTML/allowHtmlUserInput/addChoices all being true is strongly not recommended and may lead to XSS attacks"));var l=this.config.shadowRoot||document.documentElement,u="string"==typeof t?l.querySelector(t):t;if(!u||"object"!=typeof u||"INPUT"!==u.tagName&&!function(e){return"SELECT"===e.tagName}(u)){if(!u&&"string"==typeof t)throw TypeError("Selector ".concat(t," failed to find an element"));throw TypeError("Expected one of the following types text|select-one|select-multiple")}if(this._elementType=u.type,this._isTextElement=this._elementType===fe,(this._isTextElement||1!==this.config.maxItemCount)&&(this.config.singleModeForMultiSelect=!1),this.config.singleModeForMultiSelect&&(this._elementType=ge),this._isSelectOneElement=this._elementType===me,this._isSelectMultipleElement=this._elementType===ge,this._isSelectElement=this._isSelectOneElement||this._isSelectMultipleElement,this._canAddUserChoices=this._isTextElement&&this.config.addItems||this._isSelectElement&&this.config.addChoices,["auto","always"].includes("".concat(this.config.renderSelectedChoices))||(this.config.renderSelectedChoices="auto"),this.config.placeholder&&(this.config.placeholderValue?this._hasNonChoicePlaceholder=!0:u.dataset.placeholder&&(this._hasNonChoicePlaceholder=!0,this.config.placeholderValue=u.dataset.placeholder)),n.addItemFilter&&"function"!=typeof n.addItemFilter){var d=n.addItemFilter instanceof RegExp?n.addItemFilter:new RegExp(n.addItemFilter);this.config.addItemFilter=d.test.bind(d)}if(this._isTextElement)this.passedElement=new Ee({element:u,classNames:this.config.classNames});else{var p=u;this.passedElement=new we({element:p,classNames:this.config.classNames,template:function(e){return s._templates.option(e)},extractPlaceholder:this.config.placeholder&&!this._hasNonChoicePlaceholder})}if(this.initialised=!1,this._store=new Pe,this._initialState=De,this._currentState=De,this._prevState=De,this._currentValue="",this.config.searchEnabled=!this._isTextElement&&this.config.searchEnabled||this._elementType===ge,this._canSearch=this.config.searchEnabled,this._isScrollingOnIe=!1,this._highlightPosition=0,this._wasTap=!0,this._placeholderValue=this._generatePlaceholderValue(),this._baseId=function(e,t){var i=e.id||e.name&&"".concat(e.name,"-").concat(oe(2))||oe(4);return i=i.replace(/(:|\.|\[|\]|,)/g,""),"".concat(t,"-").concat(i)}(this.passedElement.element,"choices-"),this._searchFn=ie,this._direction=this.passedElement.dir,!this._direction){var f=window.getComputedStyle(this.passedElement.element).direction;f!==window.getComputedStyle(document.documentElement).direction&&(this._direction=f)}if(this._idNames={itemChoice:"item-choice"},this._render=this._render.bind(this),this._onFocus=this._onFocus.bind(this),this._onBlur=this._onBlur.bind(this),this._onKeyUp=this._onKeyUp.bind(this),this._onKeyDown=this._onKeyDown.bind(this),this._onInput=this._onInput.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._onSelectKey=this._onSelectKey.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),this.passedElement.isActive)return this.config.silent||console.warn("Trying to initialise Choices on element already initialised",{element:t}),void(this.initialised=!0);this.init(),this._initialItems=this._store.items.map((function(e){return e.value}))}return Object.defineProperty(e,"defaults",{get:function(){return Object.preventExtensions({get options(){return Ke},get allOptions(){return Oe},get templates(){return He}})},enumerable:!1,configurable:!0}),e.prototype.init=function(){if(!this.initialised){this._loadChoices(),this._createTemplates(),this._createElements(),this._createStructure(),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&&"function"==typeof e&&e.call(this)}},e.prototype.destroy=function(){this.initialised&&(this._removeEventListeners(),this.passedElement.reveal(),this.containerOuter.unwrap(this.passedElement.element),this.clearStore(),this._stopSearch(),this._templates=He,this.initialised=!1)},e.prototype.enable=function(){return this.passedElement.isDisabled&&this.passedElement.enable(),this.containerOuter.isDisabled&&(this._addEventListeners(),this.input.enable(),this.containerOuter.enable()),this},e.prototype.disable=function(){return this.passedElement.isDisabled||this.passedElement.disable(),this.containerOuter.isDisabled||(this._removeEventListeners(),this.input.disable(),this.containerOuter.disable()),this},e.prototype.highlightItem=function(e,t){if(void 0===t&&(t=!0),!e||!e.id)return this;var i=this._store.choices.find((function(t){return t.id===e.id}));return!i||i.highlighted||(this._store.dispatch(ne(i,!0)),t&&this.passedElement.triggerEvent("highlightItem",this._getChoiceForOutput(i))),this},e.prototype.unhighlightItem=function(e,t){if(void 0===t&&(t=!0),!e||!e.id)return this;var i=this._store.choices.find((function(t){return t.id===e.id}));return i&&i.highlighted?(this._store.dispatch(ne(i,!1)),t&&this.passedElement.triggerEvent("highlightItem",this._getChoiceForOutput(i)),this):this},e.prototype.highlightAll=function(){var e=this;return this._store.withDeferRendering((function(){e._store.items.forEach((function(t){return e.highlightItem(t)}))})),this},e.prototype.unhighlightAll=function(){var e=this;return this._store.withDeferRendering((function(){e._store.items.forEach((function(t){return e.unhighlightItem(t)}))})),this},e.prototype.removeActiveItemsByValue=function(e){var t=this;return this._store.withDeferRendering((function(){t._store.items.filter((function(t){return t.value===e})).forEach((function(e){return t._removeItem(e)}))})),this},e.prototype.removeActiveItems=function(e){var t=this;return this._store.withDeferRendering((function(){t._store.items.filter((function(t){return t.id!==e})).forEach((function(e){return t._removeItem(e)}))})),this},e.prototype.removeHighlightedItems=function(e){var t=this;return void 0===e&&(e=!1),this._store.withDeferRendering((function(){t._store.highlightedActiveItems.forEach((function(i){t._removeItem(i),e&&t._triggerChange(i.value)}))})),this},e.prototype.showDropdown=function(e){var t=this;return this.dropdown.isActive||requestAnimationFrame((function(){t.dropdown.show(),t.containerOuter.open(t.dropdown.distanceFromTopWindow),!e&&t._canSearch&&t.input.focus(),t.passedElement.triggerEvent("showDropdown",{})})),this},e.prototype.hideDropdown=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("hideDropdown",{})})),this):this},e.prototype.getValue=function(e){var t=this;void 0===e&&(e=!1);var i=this._store.items.reduce((function(i,n){var s=e?n.value:t._getChoiceForOutput(n);return i.push(s),i}),[]);return this._isSelectOneElement||this.config.singleModeForMultiSelect?i[0]:i},e.prototype.setValue=function(e){var t=this;return this.initialised?(this._store.withDeferRendering((function(){e.forEach((function(e){e&&t._addChoice(Se(e,!1))}))})),this):this},e.prototype.setChoiceByValue=function(e){var t=this;return!this.initialised||this._isTextElement||this._store.withDeferRendering((function(){(Array.isArray(e)?e:[e]).forEach((function(e){return t._findAndSelectChoiceByValue(e)}))})),this},e.prototype.setChoices=function(e,t,n,s){var o=this;if(void 0===e&&(e=[]),void 0===t&&(t="value"),void 0===n&&(n="label"),void 0===s&&(s=!1),!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("string"!=typeof t||!t)throw new TypeError("value parameter must be a name of 'value' field in passed objects");if(s&&this.clearChoices(),"function"==typeof e){var r=e(this);if("function"==typeof Promise&&r instanceof Promise)return new Promise((function(e){return requestAnimationFrame(e)})).then((function(){return o._handleLoadingState(!0)})).then((function(){return r})).then((function(e){return o.setChoices(e,t,n,s)})).catch((function(e){o.config.silent||console.error(e)})).then((function(){return o._handleLoadingState(!1)})).then((function(){return o}));if(!Array.isArray(r))throw new TypeError(".setChoices first argument function must return either array of choices or Promise, got: ".concat(typeof r));return this.setChoices(r,t,n,!1)}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");return this.containerOuter.removeLoadingState(),this._store.withDeferRendering((function(){var s="value"===t,r="label"===n;e.forEach((function(e){if("choices"in e){var c=e;r||(c=i(i({},c),{label:c[n]})),o._addGroup(Se(c,!0))}else{var a=e;r&&s||(a=i(i({},a),{value:a[t],label:a[n]})),o._addChoice(Se(a,!1))}}))})),this},e.prototype.refresh=function(e,t,i){var n=this;return void 0===e&&(e=!1),void 0===t&&(t=!1),void 0===i&&(i=!1),this._isSelectElement?(this._store.withDeferRendering((function(){var s=n.passedElement.optionsAsChoices(),o=n._store.items,r={};i||o.forEach((function(e){e.id&&e.active&&e.selected&&!e.disabled&&(r[e.value]=!0)})),s.forEach((function(e){if(!("choices"in e)){var t=e;i?t.selected=!1:r[t.value]&&(t.selected=!0)}})),n.clearStore(),n._addPredefinedChoices(s,t,e),n._isSearching&&n._searchChoices(n.input.value)})),this):(this.config.silent||console.warn("refresh method can only be used on choices backed by a element"),this)},e.prototype.removeChoice=function(e){var t=this._store.choices.find((function(t){return t.value===e}));return t?(this._store.dispatch(function(e){return{type:"REMOVE_CHOICE",choice:e}}(t)),t.selected&&this.passedElement.triggerEvent("removeItem",this._getChoiceForOutput(t)),this):this},e.prototype.clearChoices=function(){return this._store.dispatch({type:"CLEAR_CHOICES"}),this},e.prototype.clearStore=function(){return this._store.dispatch({type:"CLEAR_ALL"}),this._lastAddedChoiceId=0,this._lastAddedGroupId=0,this},e.prototype.clearInput=function(){var e=!this._isSelectOneElement;return this.input.clear(e),this._isSearching&&this._stopSearch(),this},e.prototype._render=function(){if(!this._store.isLoading()){this._currentState=this._store.state;var e=this._currentState.items!==this._prevState.items;(this._currentState.choices!==this._prevState.choices||this._currentState.groups!==this._prevState.groups||e)&&(this._isSelectElement&&this._renderChoices(),e&&this._renderItems(),this._prevState=this._currentState)}},e.prototype._renderChoices=function(){var e=this,t=this._store,i=t.activeGroups,n=t.activeChoices,s=document.createDocumentFragment();if(this.choiceList.clear(),this.config.resetScrollPosition&&requestAnimationFrame((function(){return e.choiceList.scrollToTop()})),i.length>=1&&!this._isSearching){var o=n.filter((function(e){return e.placeholder&&-1===e.groupId}));o.length>=1&&(s=this._createChoicesFragment(o,s)),s=this._createGroupsFragment(i,n,s)}else n.length>=1&&(s=this._createChoicesFragment(n,s));var r=this.input.value,c=this._canAddItem(this._store.items,r);if(s.childNodes&&s.childNodes.length>0){var a=!c.response;if(c.response&&(this.choiceList.append(s),this._highlightChoice(),this._canAddUserChoices&&r&&c.notice&&(a=!n.find((function(t){return e.config.valueComparer(t.value,r)})))),a){var h=this._templates.notice(this.config,c.notice,this._canAddUserChoices?"add-choice":"");this.choiceList.prepend(h)}}else{var l=void 0;if(c.response&&this._canAddUserChoices&&r)l=this._templates.notice(this.config,c.notice,"add-choice");else if(this._isSearching){h="function"==typeof this.config.noResultsText?this.config.noResultsText():this.config.noResultsText;l=this._templates.notice(this.config,h,"no-results")}else{h="function"==typeof this.config.noChoicesText?this.config.noChoicesText():this.config.noChoicesText;l=this._templates.notice(this.config,h,"no-choices")}this.choiceList.append(l)}},e.prototype._renderItems=function(){var e=this._store.items||[];this.itemList.clear();var t=this._createItemsFragment(e);t.childNodes&&this.itemList.append(t)},e.prototype._createGroupsFragment=function(e,t,i){var n=this;void 0===i&&(i=document.createDocumentFragment());this.config.shouldSort&&e.sort(this.config.sorter);var s=t.filter((function(e){return 0===e.groupId}));return s.length>0&&this._createChoicesFragment(s,i,!1),e.forEach((function(e){var s=function(e){return t.filter((function(t){return n._isSelectOneElement?t.groupId===e.id:t.groupId===e.id&&("always"===n.config.renderSelectedChoices||!t.selected)}))}(e);if(s.length>=1){var o=n._templates.choiceGroup(n.config,e);i.appendChild(o),n._createChoicesFragment(s,i,!0)}})),i},e.prototype._createChoicesFragment=function(e,t,i){var s=this;void 0===t&&(t=document.createDocumentFragment()),void 0===i&&(i=!1);var o=this.config,r=o.renderSelectedChoices,c=o.searchResultLimit,a=o.renderChoiceLimit,h=o.appendGroupInSearch,l=this._isSearching?he:this.config.sorter,u=function(e){if("auto"!==r||(s._isSelectOneElement||!e.selected)){var i=s._templates.choice(s.config,e,s.config.itemSelectText);if(h){var n="";s._store.groups.every((function(t){return t.id!==e.groupId||(n=t.label,!1)})),n&&s._isSearching&&(i.innerHTML+=" (".concat(n,")"))}t.appendChild(i)}},d=e;if("auto"!==r||this._isSelectOneElement||(d=e.filter((function(e){return!e.selected}))),this._isSelectElement){var p=e.filter((function(e){return!e.element}));0!==p.length&&this.passedElement.addOptions(p)}var f=d.reduce((function(e,t){return t.placeholder?e.placeholderChoices.push(t):e.normalChoices.push(t),e}),{placeholderChoices:[],normalChoices:[]}),m=f.placeholderChoices,g=f.normalChoices;(this.config.shouldSort||this._isSearching)&&g.sort(l);var v=d.length,_=this._isSelectOneElement?n(n([],m,!0),g,!0):g;this._isSearching?v=c:a&&a>0&&!i&&(v=a);for(var y=0;y0?this._store.getGroupById(e.groupId):null;return{id:e.id,highlighted:e.highlighted,labelClass:e.labelClass,labelDescription:e.labelDescription,customProperties:e.customProperties,disabled:e.disabled,active:e.active,label:e.label,placeholder:e.placeholder,value:e.value,groupValue:i&&i.label?i.label:void 0,element:e.element,keyCode:t}}},e.prototype._triggerChange=function(e){null!=e&&this.passedElement.triggerEvent("change",{value:e})},e.prototype._selectPlaceholderChoice=function(e){this._addItem(e),e.value&&this._triggerChange(e.value)},e.prototype._handleButtonAction=function(e,t){if(0!==e.length&&this.config.removeItems&&this.config.removeItemButton){var i=t&&Be(t.parentNode),n=i&&e.find((function(e){return e.id===i}));if(n&&(this._removeItem(n),this._triggerChange(n.value),this._isSelectOneElement&&!this._hasNonChoicePlaceholder)){var s=this._store.placeholderChoice;s&&this._selectPlaceholderChoice(s)}}},e.prototype._handleItemAction=function(e,t,i){var n=this;if(void 0===i&&(i=!1),0!==e.length&&this.config.removeItems&&!this._isSelectOneElement){var s=Be(t);s&&(e.forEach((function(e){e.id!==s||e.highlighted?!i&&e.highlighted&&n.unhighlightItem(e):n.highlightItem(e)})),this.input.focus())}},e.prototype._handleChoiceAction=function(e,t,i){var n=this,s=Be(t),o=s&&this._store.getChoiceById(s);if(!o)return!1;var r=this.dropdown.isActive,c=!1;return this._store.withDeferRendering((function(){if(!o.selected&&!o.disabled&&n._canAddItem(e,o.value).response){if(n.config.singleModeForMultiSelect&&0!==e.length){var t=e[e.length-1];n._removeItem(t)}n.passedElement.triggerEvent("choice",n._getChoiceForOutput(o,i)),n._addItem(o),n.clearInput(),c=!0}})),!!c&&(this._triggerChange(o.value),r&&(this.config.singleModeForMultiSelect||this._isSelectOneElement)&&(this.hideDropdown(!0),this.containerOuter.focus()),!0)},e.prototype._handleBackspace=function(e){if(this.config.removeItems&&0!==e.length){var t=e[e.length-1],i=e.some((function(e){return e.highlighted}));this.config.editItems&&!i&&t?(this.input.value=t.value,this.input.setWidth(),this._removeItem(t),this._triggerChange(t.value)):(i||this.highlightItem(t,!1),this.removeHighlightedItems(!0))}},e.prototype._loadChoices=function(){var e;if(this._isTextElement){this._presetItems=this.config.items.map((function(e){return Se(e,!1)}));var t=this.passedElement.value;if(t){var i=t.split(this.config.delimiter).map((function(e){return Se(e,!1)}));this._presetItems=this._presetItems.concat(i)}this._presetItems.forEach((function(e){e.selected=!0}))}else if(this._isSelectElement){this._presetChoices=this.config.choices.map((function(e){return Se(e,!0)}));var n=this.passedElement.optionsAsChoices();n&&(e=this._presetChoices).push.apply(e,n)}},e.prototype._startLoading=function(){this._store.startDeferRendering()},e.prototype._stopLoading=function(){this._store.stopDeferRendering()},e.prototype._handleLoadingState=function(e){void 0===e&&(e=!0);var t=this.itemList.element.querySelector(ue(this.config.classNames.placeholder));e?(this.disable(),this.containerOuter.addLoadingState(),this._isSelectOneElement?t?t.innerHTML=this.config.loadingText:(t=this._templates.placeholder(this.config,this.config.loadingText))&&this.itemList.append(t):this.input.placeholder=this.config.loadingText):(this.enable(),this.containerOuter.removeLoadingState(),this._isSelectOneElement?t&&(t.innerHTML=this._placeholderValue||""):this.input.placeholder=this._placeholderValue||"")},e.prototype._handleSearch=function(e){if(this.input.isFocussed){var t=this._store.choices,i=this.config,n=i.searchFloor,s=i.searchChoices,o=t.some((function(e){return!e.active}));if(null!=e&&e.length>=n){var r=s?this._searchChoices(e):0;null!==r&&this.passedElement.triggerEvent("search",{value:e,resultCount:r})}else o&&this._stopSearch()}},e.prototype._canAddItem=function(e,t){var i=this,n=!0,s="";(this.config.maxItemCount>0&&this.config.maxItemCount<=e.length&&(this.config.singleModeForMultiSelect||(n=!1,s="function"==typeof this.config.maxItemText?this.config.maxItemText(this.config.maxItemCount):this.config.maxItemText)),n&&this._canAddUserChoices&&""!==t&&"function"==typeof this.config.addItemFilter&&!this.config.addItemFilter(t)&&(n=!1,s="function"==typeof this.config.customAddItemText?this.config.customAddItemText(re(t),t):this.config.customAddItemText),!n||""===t||!this._isSelectElement&&this.config.duplicateItemsAllowed)||this._store.items.find((function(e){return i.config.valueComparer(e.value,t)}))&&(n=!1,s="function"==typeof this.config.uniqueItemText?this.config.uniqueItemText(re(t),t):this.config.uniqueItemText);return n&&(s="function"==typeof this.config.addItemText?this.config.addItemText(re(t),t):this.config.addItemText),{response:n,notice:{trusted:s}}},e.prototype._searchChoices=function(e){var t=e.trim().replace(/\s{2,}/," ");if(0===t.length||t===this._currentValue)return null;var i=this._store.searchableChoices,n=this._searchFn(this.config,i,t);return this._currentValue=t,this._highlightPosition=0,this._isSearching=!0,this._store.dispatch(function(e){return{type:"FILTER_CHOICES",results:e}}(n)),n.length},e.prototype._stopSearch=function(){var e=this._isSearching;this._currentValue="",this._isSearching=!1,e&&this._store.dispatch({type:"ACTIVATE_CHOICES",active:!0})},e.prototype._addEventListeners=function(){var e=this.config.shadowRoot||document.documentElement;e.addEventListener("touchend",this._onTouchEnd,!0),this.containerOuter.element.addEventListener("keydown",this._onKeyDown,!0),this.containerOuter.element.addEventListener("mousedown",this._onMouseDown,!0),e.addEventListener("click",this._onClick,{passive:!0}),e.addEventListener("touchmove",this._onTouchMove,{passive:!0}),this.dropdown.element.addEventListener("mouseover",this._onMouseOver,{passive:!0}),this._isSelectOneElement&&(this.containerOuter.element.addEventListener("focus",this._onFocus,{passive:!0}),this.containerOuter.element.addEventListener("blur",this._onBlur,{passive:!0})),this.input.element.addEventListener("keyup",this._onKeyUp,{passive:!0}),this.input.element.addEventListener("input",this._onInput,{passive:!0}),this.input.element.addEventListener("focus",this._onFocus,{passive:!0}),this.input.element.addEventListener("blur",this._onBlur,{passive:!0}),this.input.element.form&&this.input.element.form.addEventListener("reset",this._onFormReset,{passive:!0}),this.input.addEventListeners()},e.prototype._removeEventListeners=function(){var e=this.config.shadowRoot||document.documentElement;e.removeEventListener("touchend",this._onTouchEnd,!0),this.containerOuter.element.removeEventListener("keydown",this._onKeyDown,!0),this.containerOuter.element.removeEventListener("mousedown",this._onMouseDown,!0),e.removeEventListener("click",this._onClick),e.removeEventListener("touchmove",this._onTouchMove),this.dropdown.element.removeEventListener("mouseover",this._onMouseOver),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("input",this._onInput),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()},e.prototype._onKeyDown=function(e){var t=e.keyCode,i=this._store.items,n=this.input.isFocussed,s=this.dropdown.isActive,o=this.itemList.hasChildren(),r=1===e.key.length||2===e.key.length&&e.key.charCodeAt(0)>=55296||"Unidentified"===e.key;switch(this._isTextElement||s||(this.showDropdown(),!this.input.isFocussed&&r&&(this.input.value+=e.key)),t){case 65:return this._onSelectKey(e,o);case 13:return this._onEnterKey(e,i,s);case 27:return this._onEscapeKey(e,s);case 38:case 33:case 40:case 34:return this._onDirectionKey(e,s);case 8:case 46:return this._onDeleteKey(e,i,n)}},e.prototype._onKeyUp=function(){this._canSearch=this.config.searchEnabled},e.prototype._onInput=function(){var e=this.input.value;if(e){if(this._isTextElement){var t=this._canAddItem(this._store.items,e);t.notice&&(this._displayAddItemNotice(t),this.showDropdown(!0))}if(this._canSearch){this._handleSearch(e);var i=this._canAddItem(this._store.items,e);i.response||this._displayAddItemNotice(i),this._canAddUserChoices&&(this._highlightPosition=0,this._highlightChoice())}}else this._isTextElement?this.hideDropdown(!0):this._stopSearch()},e.prototype._displayAddItemNotice=function(e){var t=this._templates.notice(this.config,e.notice,"add-choice"),i="".concat(ue(this.config.classNames.addChoice),"[data-choice-selectable]"),n=this.choiceList.element.querySelector(i);n?n.outerHTML=t.outerHTML:this.choiceList.prepend(t)},e.prototype._onSelectKey=function(e,t){var i=e.ctrlKey,n=e.metaKey;(i||n)&&t&&(this._canSearch=!1,this.config.removeItems&&!this.input.value&&this.input.element===document.activeElement&&this.highlightAll())},e.prototype._onEnterKey=function(e,t,i){var n=this,s=this.input.value,o=e.target;if(o&&o.hasAttribute("data-button"))return e.preventDefault(),void this._handleButtonAction(t,o);if(!i&&this._isSelectOneElement)return e.preventDefault(),void this.showDropdown();if(i){var r=this.dropdown.element.querySelector(ue(this.config.classNames.highlightedState));if(r&&this._handleChoiceAction(t,r,13))return e.preventDefault(),void this.unhighlightAll();s||this.hideDropdown(!0)}o&&s&&this._canAddUserChoices&&(this._canAddItem(t,s).response&&(this._store.withDeferRendering((function(){if((n._isSelectOneElement||n.config.singleModeForMultiSelect)&&0!==t.length){var e=t[t.length-1];n._removeItem(e)}var i=!0;if(!n._isSelectElement&&n.config.duplicateItemsAllowed||(i=!n._findAndSelectChoiceByValue(s)),i){var o=re(s),r=n.config.allowHtmlUserInput||o===s?s:{escaped:o,raw:s};n._addChoice(Se({value:r,label:r,selected:!0},!1))}n.clearInput(),n.unhighlightAll(),n._triggerChange(s)})),(this._isTextElement||this._isSelectOneElement)&&this.hideDropdown(!0)))},e.prototype._onEscapeKey=function(e,t){t&&(e.stopPropagation(),this.hideDropdown(!0),this.containerOuter.focus())},e.prototype._onDirectionKey=function(e,t){var i,n,s,o=e.keyCode,r=e.metaKey;if(t||this._isSelectOneElement){this.showDropdown(),this._canSearch=!1;var c=40===o||34===o?1:-1,a="[data-choice-selectable]",h=void 0;if(r||34===o||33===o)h=c>0?this.dropdown.element.querySelector("".concat(a,":last-of-type")):this.dropdown.element.querySelector(a);else{var l=this.dropdown.element.querySelector(ue(this.config.classNames.highlightedState));h=l?function(e,t,i){void 0===i&&(i=1);for(var n="".concat(i>0?"next":"previous","ElementSibling"),s=e[n];s;){if(s.matches(t))return s;s=s[n]}return s}(l,a,c):this.dropdown.element.querySelector(a)}h&&(i=h,n=this.choiceList.element,void 0===(s=c)&&(s=1),i&&(s>0?n.scrollTop+n.offsetHeight>=i.offsetTop+i.offsetHeight:i.offsetTop>=n.scrollTop)||this.choiceList.scrollToChildElement(h,c),this._highlightChoice(h)),e.preventDefault()}},e.prototype._onDeleteKey=function(e,t,i){var n=e.target;this._isSelectOneElement||n.value||!i||(this._handleBackspace(t),e.preventDefault())},e.prototype._onTouchMove=function(){this._wasTap&&(this._wasTap=!1)},e.prototype._onTouchEnd=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},e.prototype._onMouseDown=function(e){var t=e.target;if(t instanceof HTMLElement){if(Ve&&this.choiceList.element.contains(t)){var i=this.choiceList.element.firstElementChild;this._isScrollingOnIe="ltr"===this._direction?e.offsetX>=i.offsetWidth:e.offsetX0&&this.unhighlightAll(),this.containerOuter.removeFocusState(),this.hideDropdown(!0))},e.prototype._onFocus=function(e){var t,i=this,n=e.target;n&&this.containerOuter.element.contains(n)&&((t={})[fe]=function(){n===i.input.element&&i.containerOuter.addFocusState()},t[me]=function(){i.containerOuter.addFocusState(),n===i.input.element&&i.showDropdown(!0)},t[ge]=function(){n===i.input.element&&(i.showDropdown(!0),i.containerOuter.addFocusState())},t)[this._elementType]()},e.prototype._onBlur=function(e){var t,i=this,n=e.target;if(n&&this.containerOuter.element.contains(n)&&!this._isScrollingOnIe){var s=this._store.activeChoices.some((function(e){return e.highlighted}));((t={})[fe]=function(){n===i.input.element&&(i.containerOuter.removeFocusState(),s&&i.unhighlightAll(),i.hideDropdown(!0))},t[me]=function(){i.containerOuter.removeFocusState(),(n===i.input.element||n===i.containerOuter.element&&!i._canSearch)&&i.hideDropdown(!0)},t[ge]=function(){n===i.input.element&&(i.containerOuter.removeFocusState(),i.hideDropdown(!0),s&&i.unhighlightAll())},t)[this._elementType]()}else this._isScrollingOnIe=!1,this.input.element.focus()},e.prototype._onFormReset=function(){var e=this;this._store.withDeferRendering((function(){e.clearInput(),e.hideDropdown(),e.refresh(!1,!1,!0),0!==e._initialItems.length&&e.setChoiceByValue(e._initialItems)}))},e.prototype._highlightChoice=function(e){var t,i=this;void 0===e&&(e=null);var n=Array.from(this.dropdown.element.querySelectorAll("[data-choice-selectable]"));if(n.length){var s=e;Array.from(this.dropdown.element.querySelectorAll(ue(this.config.classNames.highlightedState))).forEach((function(e){var t;(t=e.classList).remove.apply(t,le(i.config.classNames.highlightedState)),e.setAttribute("aria-selected","false")})),s?this._highlightPosition=n.indexOf(s):(s=n.length>this._highlightPosition?n[this._highlightPosition]:n[n.length-1])||(s=n[0]),(t=s.classList).add.apply(t,le(this.config.classNames.highlightedState)),s.setAttribute("aria-selected","true"),this.passedElement.triggerEvent("highlightChoice",{el:s}),this.dropdown.isActive&&(this.input.setActiveDescendant(s.id),this.containerOuter.setActiveDescendant(s.id))}},e.prototype._addItem=function(e,t){void 0===t&&(t=!0);var i=e.id;if(0===i)throw new TypeError("item.id must be set before _addItem is called for a choice/item");this._store.dispatch(function(e){return{type:"ADD_ITEM",item:e}}(e)),this._isSelectOneElement&&this.removeActiveItems(i),t&&this.passedElement.triggerEvent("addItem",this._getChoiceForOutput(e))},e.prototype._removeItem=function(e){e.id&&(this._store.dispatch(function(e){return{type:"REMOVE_ITEM",item:e}}(e)),this.passedElement.triggerEvent("removeItem",this._getChoiceForOutput(e)))},e.prototype._addChoice=function(e,t){if(void 0===t&&(t=!0),0!==e.id)throw new TypeError("Can not re-add a choice which has already been added");var i=e;this._lastAddedChoiceId++,i.id=this._lastAddedChoiceId,i.elementId="".concat(this._baseId,"-").concat(this._idNames.itemChoice,"-").concat(i.id),this.config.prependValue&&(i.value=this.config.prependValue+i.value),this.config.appendValue&&(i.value+=this.config.appendValue.toString()),(this.config.prependValue||this.config.appendValue)&&i.element&&(i.element.value=i.value),this._store.dispatch(function(e){return{type:"ADD_CHOICE",choice:e}}(e)),e.selected&&this._addItem(e,t)},e.prototype._addGroup=function(e,t){var i=this;if(void 0===t&&(t=!0),0!==e.id)throw new TypeError("Can not re-add a group which has already been added");if(this._store.dispatch(function(e){return{type:"ADD_GROUP",group:e}}(e)),e.choices){var n=e;this._lastAddedGroupId++,n.id=this._lastAddedGroupId;var s=e.id,o=e.choices;n.choices=[],o.forEach((function(n){var o=n;o.groupId=s,e.disabled&&(o.disabled=!0),i._addChoice(o,t)}))}},e.prototype._getTemplate=function(e){for(var t,i=[],s=1;s`Missing ${e} property in key`,_=e=>`Property 'weight' in key '${e}' must be a positive integer`,y=Object.prototype.hasOwnProperty;class b{constructor(e){this._keys=[],this._keyMap={};let t=0;e.forEach((e=>{let i=E(e);this._keys.push(i),this._keyMap[i.id]=i,t+=i.weight})),this._keys.forEach((e=>{e.weight/=t}))}get(e){return this._keyMap[e]}keys(){return this._keys}toJSON(){return JSON.stringify(this._keys)}}function E(e){let t=null,i=null,n=null,s=1,o=null;if(l(e)||c(e))n=e,t=C(e),i=I(e);else{if(!y.call(e,"name"))throw new Error(v("name"));const r=e.name;if(n=r,y.call(e,"weight")&&(s=e.weight,s<=0))throw new Error(_(r));t=C(r),i=I(r),o=e.getFn}return{path:t,id:i,weight:s,src:n,getFn:o}}function C(e){return c(e)?e:e.split(".")}function I(e){return c(e)?e.join("."):e}const S={useExtendedSearch:!1,getFn:function(e,t){let i=[],n=!1;const s=(e,t,o)=>{if(f(e))if(t[o]){const r=e[t[o]];if(!f(r))return;if(o===t.length-1&&(l(r)||u(r)||d(r)))i.push(h(r));else if(c(r)){n=!0;for(let e=0,i=r.length;ee.score===t.score?e.idx{this._keysMap[e.id]=t}))}create(){!this.isCreated&&this.docs.length&&(this.isCreated=!0,l(this.docs[0])?this.docs.forEach(((e,t)=>{this._addString(e,t)})):this.docs.forEach(((e,t)=>{this._addObject(e,t)})),this.norm.clear())}add(e){const t=this.size();l(e)?this._addString(e,t):this._addObject(e,t)}removeAt(e){this.records.splice(e,1);for(let t=e,i=this.size();t{let s=t.getFn?t.getFn(e):this.getFn(e,t.path);if(f(s))if(c(s)){let e=[];const t=[{nestedArrIndex:-1,value:s}];for(;t.length;){const{nestedArrIndex:i,value:n}=t.pop();if(f(n))if(l(n)&&!m(n)){let t={v:n,i:i,n:this.norm.get(n)};e.push(t)}else c(n)&&n.forEach(((e,i)=>{t.push({nestedArrIndex:i,value:e})}))}i.$[n]=e}else if(l(s)&&!m(s)){let e={v:s,n:this.norm.get(s)};i.$[n]=e}})),this.records.push(i)}toJSON(){return{keys:this.keys,records:this.records}}}function A(e,t,{getFn:i=w.getFn,fieldNormWeight:n=w.fieldNormWeight}={}){const s=new L({getFn:i,fieldNormWeight:n});return s.setKeys(e.map(E)),s.setSources(t),s.create(),s}function x(e,{errors:t=0,currentLocation:i=0,expectedLocation:n=0,distance:s=w.distance,ignoreLocation:o=w.ignoreLocation}={}){const r=t/e.length;if(o)return r;const c=Math.abs(n-i);return s?r+c/s:c?1:r}const T=32;function M(e,t,i,{location:n=w.location,distance:s=w.distance,threshold:o=w.threshold,findAllMatches:r=w.findAllMatches,minMatchCharLength:c=w.minMatchCharLength,includeMatches:a=w.includeMatches,ignoreLocation:h=w.ignoreLocation}={}){if(t.length>T)throw new Error(`Pattern length exceeds max of ${T}.`);const l=t.length,u=e.length,d=Math.max(0,Math.min(n,u));let p=o,f=d;const m=c>1||a,g=m?Array(u):[];let v;for(;(v=e.indexOf(t,f))>-1;){let e=x(t,{currentLocation:v,expectedLocation:d,distance:s,ignoreLocation:h});if(p=Math.min(e,p),f=v+l,m){let e=0;for(;e=a;o-=1){let r=o-1,c=i[e.charAt(r)];if(m&&(g[r]=+!!c),C[o]=(C[o+1]<<1|1)&c,n&&(C[o]|=(_[o+1]|_[o])<<1|1|_[o+1]),C[o]&E&&(y=x(t,{errors:n,currentLocation:r,expectedLocation:d,distance:s,ignoreLocation:h}),y<=p)){if(p=y,f=r,f<=d)break;a=Math.max(1,2*d-f)}}if(x(t,{errors:n+1,currentLocation:d,expectedLocation:d,distance:s,ignoreLocation:h})>p)break;_=C}const C={isMatch:f>=0,score:Math.max(.001,y)};if(m){const e=function(e=[],t=w.minMatchCharLength){let i=[],n=-1,s=-1,o=0;for(let r=e.length;o=t&&i.push([n,s]),n=-1)}return e[o-1]&&o-n>=t&&i.push([n,o-1]),i}(g,c);e.length?a&&(C.indices=e):C.isMatch=!1}return C}function N(e){let t={};for(let i=0,n=e.length;i{this.chunks.push({pattern:e,alphabet:N(e),startIndex:t})},l=this.pattern.length;if(l>T){let e=0;const t=l%T,i=l-t;for(;e{const{isMatch:f,score:m,indices:g}=M(e,t,d,{location:n+p,distance:s,threshold:o,findAllMatches:r,minMatchCharLength:c,includeMatches:i,ignoreLocation:a});f&&(u=!0),l+=m,f&&g&&(h=[...h,...g])}));let d={isMatch:u,score:u?l/this.chunks.length:1};return u&&i&&(d.indices=h),d}}class F{constructor(e){this.pattern=e}static isMultiMatch(e){return j(e,this.multiRegex)}static isSingleMatch(e){return j(e,this.singleRegex)}search(){}}function j(e,t){const i=e.match(t);return i?i[1]:null}class P extends F{constructor(e,{location:t=w.location,threshold:i=w.threshold,distance:n=w.distance,includeMatches:s=w.includeMatches,findAllMatches:o=w.findAllMatches,minMatchCharLength:r=w.minMatchCharLength,isCaseSensitive:c=w.isCaseSensitive,ignoreLocation:a=w.ignoreLocation}={}){super(e),this._bitapSearch=new D(e,{location:t,threshold:i,distance:n,includeMatches:s,findAllMatches:o,minMatchCharLength:r,isCaseSensitive:c,ignoreLocation:a})}static get type(){return"fuzzy"}static get multiRegex(){return/^"(.*)"$/}static get singleRegex(){return/^(.*)$/}search(e){return this._bitapSearch.searchIn(e)}}class R extends F{constructor(e){super(e)}static get type(){return"include"}static get multiRegex(){return/^'"(.*)"$/}static get singleRegex(){return/^'(.*)$/}search(e){let t,i=0;const n=[],s=this.pattern.length;for(;(t=e.indexOf(this.pattern,i))>-1;)i=t+s,n.push([t,i-1]);const o=!!n.length;return{isMatch:o,score:o?0:1,indices:n}}}const k=[class extends F{constructor(e){super(e)}static get type(){return"exact"}static get multiRegex(){return/^="(.*)"$/}static get singleRegex(){return/^=(.*)$/}search(e){const t=e===this.pattern;return{isMatch:t,score:t?0:1,indices:[0,this.pattern.length-1]}}},R,class extends F{constructor(e){super(e)}static get type(){return"prefix-exact"}static get multiRegex(){return/^\^"(.*)"$/}static get singleRegex(){return/^\^(.*)$/}search(e){const t=e.startsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,this.pattern.length-1]}}},class extends F{constructor(e){super(e)}static get type(){return"inverse-prefix-exact"}static get multiRegex(){return/^!\^"(.*)"$/}static get singleRegex(){return/^!\^(.*)$/}search(e){const t=!e.startsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,e.length-1]}}},class extends F{constructor(e){super(e)}static get type(){return"inverse-suffix-exact"}static get multiRegex(){return/^!"(.*)"\$$/}static get singleRegex(){return/^!(.*)\$$/}search(e){const t=!e.endsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,e.length-1]}}},class extends F{constructor(e){super(e)}static get type(){return"suffix-exact"}static get multiRegex(){return/^"(.*)"\$$/}static get singleRegex(){return/^(.*)\$$/}search(e){const t=e.endsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[e.length-this.pattern.length,e.length-1]}}},class extends F{constructor(e){super(e)}static get type(){return"inverse-exact"}static get multiRegex(){return/^!"(.*)"$/}static get singleRegex(){return/^!(.*)$/}search(e){const t=-1===e.indexOf(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,e.length-1]}}},P],H=k.length,V=/ +(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/;const K=new Set([P.type,R.type]);class B{constructor(e,{isCaseSensitive:t=w.isCaseSensitive,includeMatches:i=w.includeMatches,minMatchCharLength:n=w.minMatchCharLength,ignoreLocation:s=w.ignoreLocation,findAllMatches:o=w.findAllMatches,location:r=w.location,threshold:c=w.threshold,distance:a=w.distance}={}){this.query=null,this.options={isCaseSensitive:t,includeMatches:i,minMatchCharLength:n,findAllMatches:o,ignoreLocation:s,location:r,threshold:c,distance:a},this.pattern=t?e:e.toLowerCase(),this.query=function(e,t={}){return e.split("|").map((e=>{let i=e.trim().split(V).filter((e=>e&&!!e.trim())),n=[];for(let e=0,s=i.length;e!(!e[q]&&!e[W]),J=e=>({[q]:Object.keys(e).map((t=>({[t]:e[t]})))});function Q(e,t,{auto:i=!0}={}){const n=e=>{let s=Object.keys(e);const o=(e=>!!e[G])(e);if(!o&&s.length>1&&!z(e))return n(J(e));if((e=>!c(e)&&p(e)&&!z(e))(e)){const n=o?e[G]:s[0],r=o?e[X]:e[n];if(!l(r))throw new Error((e=>`Invalid value for key ${e}`)(n));const c={keyId:I(n),pattern:r};return i&&(c.searcher=U(r,t)),c}let r={children:[],operator:s[0]};return s.forEach((t=>{const i=e[t];c(i)&&i.forEach((e=>{r.children.push(n(e))}))})),r};return z(e)||(e=J(e)),n(e)}function Y(e,t){const i=e.matches;t.matches=[],f(i)&&i.forEach((e=>{if(!f(e.indices)||!e.indices.length)return;const{indices:i,value:n}=e;let s={indices:i,value:n};e.key&&(s.key=e.key.src),e.idx>-1&&(s.refIndex=e.idx),t.matches.push(s)}))}function Z(e,t){t.score=e.score}class ee{constructor(e,t={},i){this.options=r(r({},w),t),this.options.useExtendedSearch,this._keyStore=new b(this.options.keys),this.setCollection(e,i)}setCollection(e,t){if(this._docs=e,t&&!(t instanceof L))throw new Error("Incorrect 'index' type");this._myIndex=t||A(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight})}add(e){f(e)&&(this._docs.push(e),this._myIndex.add(e))}remove(e=()=>!1){const t=[];for(let i=0,n=this._docs.length;i{let i=1;e.matches.forEach((({key:e,norm:n,score:s})=>{const o=e?e.weight:null;i*=Math.pow(0===s&&o?Number.EPSILON:s,(o||1)*(t?1:n))})),e.score=i}))}(c,{ignoreFieldNorm:r}),s&&c.sort(o),u(t)&&t>-1&&(c=c.slice(0,t)),function(e,t,{includeMatches:i=w.includeMatches,includeScore:n=w.includeScore}={}){const s=[];return i&&s.push(Y),n&&s.push(Z),e.map((e=>{const{idx:i}=e,n={item:t[i],refIndex:i};return s.length&&s.forEach((t=>{t(e,n)})),n}))}(c,this._docs,{includeMatches:i,includeScore:n})}_searchStringList(e){const t=U(e,this.options),{records:i}=this._myIndex,n=[];return i.forEach((({v:e,i:i,n:s})=>{if(!f(e))return;const{isMatch:o,score:r,indices:c}=t.searchIn(e);o&&n.push({item:e,idx:i,matches:[{score:r,value:e,norm:s,indices:c}]})})),n}_searchLogical(e){const t=Q(e,this.options),i=(e,t,n)=>{if(!e.children){const{keyId:i,searcher:s}=e,o=this._findMatches({key:this._keyStore.get(i),value:this._myIndex.getValueForItemAtKeyId(t,i),searcher:s});return o&&o.length?[{idx:n,item:t,matches:o}]:[]}const s=[];for(let o=0,r=e.children.length;o{if(f(e)){let r=i(t,e,n);r.length&&(s[n]||(s[n]={idx:n,item:e,matches:[]},o.push(s[n])),r.forEach((({matches:e})=>{s[n].matches.push(...e)})))}})),o}_searchObjectList(e){const t=U(e,this.options),{keys:i,records:n}=this._myIndex,s=[];return n.forEach((({$:e,i:n})=>{if(!f(e))return;let o=[];i.forEach(((i,n)=>{o.push(...this._findMatches({key:i,value:e[n],searcher:t}))})),o.length&&s.push({idx:n,item:e,matches:o})})),s}_findMatches({key:e,value:t,searcher:i}){if(!f(t))return[];let n=[];if(c(t))t.forEach((({v:t,i:s,n:o})=>{if(!f(t))return;const{isMatch:r,score:c,indices:a}=i.searchIn(t);r&&n.push({score:c,key:e,value:t,idx:s,norm:o,indices:a})}));else{const{v:s,n:o}=t,{isMatch:r,score:c,indices:a}=i.searchIn(s);r&&n.push({score:c,key:e,value:s,norm:o,indices:a})}return n}}ee.version="7.0.0",ee.createIndex=A,ee.parseIndex=function(e,{getFn:t=w.getFn,fieldNormWeight:i=w.fieldNormWeight}={}){const{keys:n,records:s}=e,o=new L({getFn:t,fieldNormWeight:i});return o.setKeys(n),o.setIndexRecords(s),o},ee.config=w,ee.parseQuery=Q,function(...e){$.push(...e)}(B);var te,ie=function(e,t,s){return new ee(t,i(i({},e.fuseOptions),{keys:n([],e.searchFields,!0),includeMatches:!0})).search(s)},ne=function(e,t){return{type:"HIGHLIGHT_ITEM",item:e,highlighted:t}},se=function(e){return{type:"SET_IS_LOADING",isLoading:e}},oe=function(e){return Array.from({length:e},(function(){return(e=0,t=36,Math.floor(Math.random()*(t-e)+e)).toString(36);var e,t})).join("")},re=function(e){if("string"!=typeof e){if(null==e)return"";if("object"==typeof e){if("raw"in e)return re(e.raw);if("trusted"in e)return e.trusted}return e}return e.replace(/&/g,"&").replace(/>/g,">").replace(/0?this.element.scrollTop+r-s:e.offsetTop;requestAnimationFrame((function(){i._animateScroll(c,t)}))}},e.prototype._scrollDown=function(e,t,i){var n=(i-e)/t,s=n>1?n:1;this.element.scrollTop=e+s},e.prototype._scrollUp=function(e,t,i){var n=(e-i)/t,s=n>1?n:1;this.element.scrollTop=e-s},e.prototype._animateScroll=function(e,t){var i=this,n=this.element.scrollTop,s=!1;t>0?(this._scrollDown(n,4,e),ne&&(s=!0)),s&&requestAnimationFrame((function(){i._animateScroll(e,t)}))},e}(),be=function(){function e(e){var t=e.element,i=e.classNames;this.element=t,this.classNames=i,this.isDisabled=!1}return Object.defineProperty(e.prototype,"isActive",{get:function(){return"active"===this.element.dataset.choice},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"dir",{get:function(){return this.element.dir},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"value",{get:function(){return this.element.value},set:function(e){this.element.setAttribute("value",e),this.element.value=e},enumerable:!1,configurable:!0}),e.prototype.conceal=function(){var e;(e=this.element.classList).add.apply(e,le(this.classNames.input)),this.element.hidden=!0,this.element.tabIndex=-1;var t=this.element.getAttribute("style");t&&this.element.setAttribute("data-choice-orig-style",t),this.element.setAttribute("data-choice","active")},e.prototype.reveal=function(){var e;(e=this.element.classList).remove.apply(e,le(this.classNames.input)),this.element.hidden=!1,this.element.removeAttribute("tabindex");var t=this.element.getAttribute("data-choice-orig-style");t?(this.element.removeAttribute("data-choice-orig-style"),this.element.setAttribute("style",t)):this.element.removeAttribute("style"),this.element.removeAttribute("data-choice"),this.element.value=this.element.value},e.prototype.enable=function(){this.element.removeAttribute("disabled"),this.element.disabled=!1,this.isDisabled=!1},e.prototype.disable=function(){this.element.setAttribute("disabled",""),this.element.disabled=!0,this.isDisabled=!0},e.prototype.triggerEvent=function(e,t){!function(e,t,i){void 0===i&&(i=null);var n=new CustomEvent(t,{detail:i,bubbles:!0,cancelable:!0});e.dispatchEvent(n)}(this.element,e,t)},e}(),Ee=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return t(i,e),i}(be),Ce=function(e,t){return void 0===t&&(t=!0),void 0===e?t:!!e},Ie=function(e){if("string"==typeof e&&(e=e.split(" ").filter((function(e){return 0!==e.length}))),Array.isArray(e)&&0!==e.length)return e},Se=function(e,t){if("string"==typeof e)return Se({value:e,label:e},!1);var i=e;if("choices"in i){if(!t)throw new TypeError("optGroup is not allowed");var n=i,s=n.choices.map((function(e){return Se(e,!1)}));return{id:0,label:ae(n.label)||n.value,active:0!==s.length,disabled:!!n.disabled,choices:s}}var o=i;return{id:0,groupId:0,score:0,value:o.value,label:o.label||o.value,active:Ce(o.active),selected:Ce(o.selected,!1),disabled:Ce(o.disabled,!1),placeholder:Ce(o.placeholder,!1),highlighted:!1,labelClass:Ie(o.labelClass),labelDescription:o.labelDescription,customProperties:o.customProperties}},we=function(e){function i(t){var i=t.element,n=t.classNames,s=t.template,o=t.extractPlaceholder,r=e.call(this,{element:i,classNames:n})||this;return r.template=s,r.extractPlaceholder=o,r}return t(i,e),Object.defineProperty(i.prototype,"placeholderOption",{get:function(){return this.element.querySelector('option[value=""]')||this.element.querySelector("option[placeholder]")},enumerable:!1,configurable:!0}),i.prototype.addOptions=function(e){var t=this;e.forEach((function(e){var i=e;if(!i.element){var n=t.template(i);t.element.appendChild(n),i.element=n}}))},i.prototype.optionsAsChoices=function(){var e=this,t=[];return this.element.querySelectorAll(":scope > option, :scope > optgroup").forEach((function(i){!function(e){return"OPTION"===e.tagName}(i)?function(e){return"OPTGROUP"===e.tagName}(i)&&t.push(e._optgroupToChoice(i)):t.push(e._optionToChoice(i))})),t},i.prototype._optionToChoice=function(e){return{id:0,groupId:0,score:0,value:e.value,label:e.innerHTML,element:e,active:!0,selected:this.extractPlaceholder?e.selected:e.hasAttribute("selected"),disabled:e.disabled,highlighted:!1,placeholder:this.extractPlaceholder&&(""===e.value||e.hasAttribute("placeholder")),labelClass:void 0!==e.dataset.labelClass?Ie(e.dataset.labelClass):void 0,labelDescription:void 0!==e.dataset.labelDescription?e.dataset.labelDescription:void 0,customProperties:de(e.dataset.customProperties)}},i.prototype._optgroupToChoice=function(e){var t=this,i=e.querySelectorAll("option"),n=Array.from(i).map((function(e){return t._optionToChoice(e)}));return{id:0,label:e.label||"",element:e,active:0!==n.length,disabled:e.disabled,choices:n}},i}(be),Oe={items:[],choices:[],silent:!1,renderChoiceLimit:-1,maxItemCount:-1,singleModeForMultiSelect:!1,addChoices:!1,addItems:!0,addItemFilter:function(e){return!!e&&""!==e},removeItems:!0,removeItemButton:!1,removeItemButtonAlignLeft:!1,editItems:!1,allowHTML:!1,allowHtmlUserInput:!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,sorter:function(e,t){var i=e.value,n=e.label,s=void 0===n?i:n,o=t.value,r=t.label,c=void 0===r?o:r;return ae(s).localeCompare(ae(c),[],{sensitivity:"base",ignorePunctuation:!0,numeric:!0})},shadowRoot:null,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 "'.concat(e,'"')},removeItemIconText:function(){return"Remove item"},removeItemLabelText:function(e){return"Remove item: ".concat(e)},maxItemText:function(e){return"Only ".concat(e," values can be added")},valueComparer:function(e,t){return e===t},fuseOptions:{includeScore:!0},labelId:"",callbackOnInit:null,callbackOnCreateTemplates:null,classNames:{containerOuter:["choices"],containerInner:["choices__inner"],input:["choices__input"],inputCloned:["choices__input--cloned"],list:["choices__list"],listItems:["choices__list--multiple"],listSingle:["choices__list--single"],listDropdown:["choices__list--dropdown"],item:["choices__item"],itemSelectable:["choices__item--selectable"],itemDisabled:["choices__item--disabled"],itemChoice:["choices__item--choice"],description:["choices__description"],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"],selectedState:["is-selected"],flippedState:["is-flipped"],loadingState:["is-loading"],addChoice:["choices__item","choices__item--selectable","add-choice"],noResults:["has-no-results"],noChoices:["has-no-choices"]},appendGroupInSearch:!1},Le=["fuseOptions","classNames"];function Ae(e){return"Minified Redux error #"+e+"; visit https://redux.js.org/Errors?code="+e+" for the full message or use the non-minified dev environment for full errors. "}var xe="function"==typeof Symbol&&Symbol.observable||"@@observable",Te=function(){return Math.random().toString(36).substring(7).split("").join(".")},Me={INIT:"@@redux/INIT"+Te(),REPLACE:"@@redux/REPLACE"+Te(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+Te()}};function Ne(e,t,i){var n;if("function"==typeof t&&"function"==typeof i||"function"==typeof i&&"function"==typeof arguments[3])throw new Error(Ae(0));if("function"==typeof t&&void 0===i&&(i=t,t=void 0),void 0!==i){if("function"!=typeof i)throw new Error(Ae(1));return i(Ne)(e,t)}if("function"!=typeof e)throw new Error(Ae(2));var s=e,o=t,r=[],c=r,a=!1;function h(){c===r&&(c=r.slice())}function l(){if(a)throw new Error(Ae(3));return o}function u(e){if("function"!=typeof e)throw new Error(Ae(4));if(a)throw new Error(Ae(5));var t=!0;return h(),c.push(e),function(){if(t){if(a)throw new Error(Ae(6));t=!1,h();var i=c.indexOf(e);c.splice(i,1),r=null}}}function d(e){if(!function(e){if("object"!=typeof e||null===e)return!1;for(var t=e;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}(e))throw new Error(Ae(7));if(void 0===e.type)throw new Error(Ae(8));if(a)throw new Error(Ae(9));try{a=!0,o=s(o,e)}finally{a=!1}for(var t=r=c,i=0;i0},e.prototype.getChoiceById=function(e){return this.activeChoices.find((function(t){return t.id===e}))},e.prototype.getGroupById=function(e){return this.groups.find((function(t){return t.id===e}))},e}(),Re=function(e,t){return e?function(e){if("string"==typeof e)return e;if("object"==typeof e){if("escaped"in e)return e.escaped;if("trusted"in e)return e.trusted}return""}(t):re(t)},ke=function(e,t){if(t){var i=e.dataset;"string"==typeof t?i.customProperties=t:"object"!=typeof t||function(e){for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0}(t)||(i.customProperties=JSON.stringify(t))}},He={containerOuter:function(e,t,i,n,s,o,r){var c=e.classNames.containerOuter,a=Object.assign(document.createElement("div"),{className:le(c).join(" ")});return a.dataset.type=o,t&&(a.dir=t),n&&(a.tabIndex=0),i&&(a.setAttribute("role",s?"combobox":"listbox"),s&&a.setAttribute("aria-autocomplete","list")),a.setAttribute("aria-haspopup","true"),a.setAttribute("aria-expanded","false"),r&&a.setAttribute("aria-labelledby",r),a},containerInner:function(e){var t=e.classNames.containerInner;return Object.assign(document.createElement("div"),{className:le(t).join(" ")})},itemList:function(e,t){var i=e.classNames,n=i.list,s=i.listSingle,o=i.listItems;return Object.assign(document.createElement("div"),{className:"".concat(le(n).join(" ")," ").concat(t?le(s).join(" "):le(o).join(" "))})},placeholder:function(e,t){var i=e.allowHTML,n=e.classNames.placeholder;return Object.assign(document.createElement("div"),{className:le(n).join(" "),innerHTML:Re(i,t)})},item:function(e,t,i){var n,s,o,r=e.allowHTML,c=e.removeItemButtonAlignLeft,a=e.classNames,h=a.item,l=a.button,u=a.highlightedState,d=a.itemSelectable,p=a.placeholder,f=t.id,m=t.value,g=t.label,v=t.labelClass,_=t.labelDescription,y=t.customProperties,b=t.active,E=t.disabled,C=t.highlighted,I=t.placeholder,S=Object.assign(document.createElement("div"),{className:le(h).join(" ")});if(v){var w=Object.assign(document.createElement("span"),{innerHTML:Re(r,g),className:le(v).join(" ")});S.appendChild(w)}else S.innerHTML=Re(r,g);if(Object.assign(S.dataset,{item:"",id:f,value:m}),v&&(S.dataset.labelClass=le(v).join(" ")),_&&(S.dataset.labelDescription=_),ke(S,y),b&&S.setAttribute("aria-selected","true"),E&&S.setAttribute("aria-disabled","true"),I&&((n=S.classList).add.apply(n,le(p)),S.dataset.placeholder=""),(s=S.classList).add.apply(s,le(C?u:d)),i){E&&(o=S.classList).remove.apply(o,le(d)),S.dataset.deletable="";var O="function"==typeof this.config.removeItemIconText?this.config.removeItemIconText(re(m),m):this.config.removeItemIconText,L="function"==typeof this.config.removeItemLabelText?this.config.removeItemLabelText(re(m),m):this.config.removeItemLabelText,A=Object.assign(document.createElement("button"),{type:"button",className:le(l).join(" "),innerHTML:O});A.setAttribute("aria-label",L),A.dataset.button="",c?S.insertAdjacentElement("afterbegin",A):S.appendChild(A)}return S},choiceList:function(e,t){var i=e.classNames.list,n=Object.assign(document.createElement("div"),{className:le(i).join(" ")});return t||n.setAttribute("aria-multiselectable","true"),n.setAttribute("role","listbox"),n},choiceGroup:function(e,t){var i=e.allowHTML,n=e.classNames,s=n.group,o=n.groupHeading,r=n.itemDisabled,c=t.id,a=t.label,h=t.disabled,l=Object.assign(document.createElement("div"),{className:"".concat(le(s).join(" ")," ").concat(h?le(r).join(" "):"")});return l.setAttribute("role","group"),Object.assign(l.dataset,{group:"",id:c,value:a}),h&&l.setAttribute("aria-disabled","true"),l.appendChild(Object.assign(document.createElement("div"),{className:le(o).join(" "),innerHTML:Re(i,a)})),l},choice:function(e,t,i){var n,s,o,r,c,a=e.allowHTML,h=e.classNames,l=h.item,u=h.itemChoice,d=h.itemSelectable,p=h.selectedState,f=h.itemDisabled,m=h.description,g=h.placeholder,v=t.id,_=t.value,y=t.label,b=t.groupId,E=t.elementId,C=t.labelClass,I=t.labelDescription,S=t.disabled,w=t.selected,O=t.placeholder,L=Object.assign(document.createElement("div"),{id:E,className:"".concat(le(l).join(" ")," ").concat(le(u).join(" "))}),A=L;if(C){var x=Object.assign(document.createElement("span"),{innerHTML:Re(a,y),className:le(C).join(" ")});A=x,L.appendChild(x)}else L.innerHTML=Re(a,y);if(I){var T="".concat(E,"-description");A.setAttribute("aria-describedby",T);var M=Object.assign(document.createElement("span"),{innerHTML:Re(a,I),id:T});(n=M.classList).add.apply(n,le(m)),L.appendChild(M)}return w&&(s=L.classList).add.apply(s,le(p)),O&&(o=L.classList).add.apply(o,le(g)),L.setAttribute("role",b&&b>0?"treeitem":"option"),Object.assign(L.dataset,{choice:"",id:v,value:_,selectText:i}),C&&(L.dataset.labelClass=le(C).join(" ")),I&&(L.dataset.labelDescription=I),S?((r=L.classList).add.apply(r,le(f)),L.dataset.choiceDisabled="",L.setAttribute("aria-disabled","true")):((c=L.classList).add.apply(c,le(d)),L.dataset.choiceSelectable=""),L},input:function(e,t){var i=e.classNames,n=i.input,s=i.inputCloned,o=Object.assign(document.createElement("input"),{type:"search",className:"".concat(le(n).join(" ")," ").concat(le(s).join(" ")),autocomplete:"off",autocapitalize:"off",spellcheck:!1});return o.setAttribute("role","textbox"),o.setAttribute("aria-autocomplete","list"),t&&o.setAttribute("aria-label",t),o},dropdown:function(e){var t,i,n=e.classNames,s=n.list,o=n.listDropdown,r=document.createElement("div");return(t=r.classList).add.apply(t,le(s)),(i=r.classList).add.apply(i,le(o)),r.setAttribute("aria-expanded","false"),r},notice:function(e,t,i){var s=e.allowHTML,o=e.classNames,r=o.item,c=o.itemChoice,a=o.addChoice,h=o.noResults,l=o.noChoices;void 0===i&&(i="");var u=n(n([],le(r),!0),le(c),!0);switch(i){case"add-choice":u.push.apply(u,le(a));break;case"no-results":u.push.apply(u,le(h));break;case"no-choices":u.push.apply(u,le(l))}var d=Object.assign(document.createElement("div"),{innerHTML:Re(s,t),className:u.join(" ")});return"add-choice"===i&&(d.dataset.choiceSelectable="",d.dataset.choice=""),d},option:function(e){var t=e.label,i=e.value,n=e.labelClass,s=e.labelDescription,o=e.customProperties,r=e.active,c=e.disabled,a=ae(t),h=new Option(a,i,!1,r);return n&&(h.dataset.labelClass=le(n).join(" ")),s&&(h.dataset.labelDescription=s),ke(h,o),h.disabled=c,h}},Ve="-ms-scroll-limit"in document.documentElement.style&&"-ms-ime-align"in document.documentElement.style,Ke={},Be=function(e){if(e){var t=e.dataset.id;return t?parseInt(t,10):void 0}},$e=function(){function e(t,n){void 0===t&&(t="[data-choice]"),void 0===n&&(n={});var s=this;this._hasNonChoicePlaceholder=!1,this._lastAddedChoiceId=0,this._lastAddedGroupId=0,this.config=i(i(i({},e.defaults.allOptions),e.defaults.options),n),Le.forEach((function(t){s.config[t]=i(i(i({},e.defaults.allOptions[t]),e.defaults.options[t]),n[t])}));var o,r,c,a,h=(o=this.config,r=Oe,c=Object.keys(o).sort(),a=Object.keys(r).sort(),c.filter((function(e){return a.indexOf(e)<0})));h.length&&console.warn("Unknown config option(s) passed",h.join(", ")),!this.config.silent&&this.config.allowHTML&&this.config.allowHtmlUserInput&&(this.config.addItems&&console.warn("Warning: allowHTML/allowHtmlUserInput/addItems all being true is strongly not recommended and may lead to XSS attacks"),this.config.addChoices&&console.warn("Warning: allowHTML/allowHtmlUserInput/addChoices all being true is strongly not recommended and may lead to XSS attacks"));var l=this.config.shadowRoot||document.documentElement,u="string"==typeof t?l.querySelector(t):t;if(!u||"object"!=typeof u||"INPUT"!==u.tagName&&!function(e){return"SELECT"===e.tagName}(u)){if(!u&&"string"==typeof t)throw TypeError("Selector ".concat(t," failed to find an element"));throw TypeError("Expected one of the following types text|select-one|select-multiple")}if(this._elementType=u.type,this._isTextElement=this._elementType===fe,(this._isTextElement||1!==this.config.maxItemCount)&&(this.config.singleModeForMultiSelect=!1),this.config.singleModeForMultiSelect&&(this._elementType=ge),this._isSelectOneElement=this._elementType===me,this._isSelectMultipleElement=this._elementType===ge,this._isSelectElement=this._isSelectOneElement||this._isSelectMultipleElement,this._canAddUserChoices=this._isTextElement&&this.config.addItems||this._isSelectElement&&this.config.addChoices,["auto","always"].includes("".concat(this.config.renderSelectedChoices))||(this.config.renderSelectedChoices="auto"),this.config.placeholder&&(this.config.placeholderValue?this._hasNonChoicePlaceholder=!0:u.dataset.placeholder&&(this._hasNonChoicePlaceholder=!0,this.config.placeholderValue=u.dataset.placeholder)),n.addItemFilter&&"function"!=typeof n.addItemFilter){var d=n.addItemFilter instanceof RegExp?n.addItemFilter:new RegExp(n.addItemFilter);this.config.addItemFilter=d.test.bind(d)}if(this._isTextElement)this.passedElement=new Ee({element:u,classNames:this.config.classNames});else{var p=u;this.passedElement=new we({element:p,classNames:this.config.classNames,template:function(e){return s._templates.option(e)},extractPlaceholder:this.config.placeholder&&!this._hasNonChoicePlaceholder})}if(this.initialised=!1,this._store=new Pe,this._initialState=De,this._currentState=De,this._prevState=De,this._currentValue="",this.config.searchEnabled=!this._isTextElement&&this.config.searchEnabled||this._elementType===ge,this._canSearch=this.config.searchEnabled,this._isScrollingOnIe=!1,this._highlightPosition=0,this._wasTap=!0,this._placeholderValue=this._generatePlaceholderValue(),this._baseId=function(e,t){var i=e.id||e.name&&"".concat(e.name,"-").concat(oe(2))||oe(4);return i=i.replace(/(:|\.|\[|\]|,)/g,""),"".concat(t,"-").concat(i)}(this.passedElement.element,"choices-"),this._searchFn=ie,this._direction=this.passedElement.dir,!this._direction){var f=window.getComputedStyle(this.passedElement.element).direction;f!==window.getComputedStyle(document.documentElement).direction&&(this._direction=f)}if(this._idNames={itemChoice:"item-choice"},this._render=this._render.bind(this),this._onFocus=this._onFocus.bind(this),this._onBlur=this._onBlur.bind(this),this._onKeyUp=this._onKeyUp.bind(this),this._onKeyDown=this._onKeyDown.bind(this),this._onInput=this._onInput.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._onSelectKey=this._onSelectKey.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),this.passedElement.isActive)return this.config.silent||console.warn("Trying to initialise Choices on element already initialised",{element:t}),void(this.initialised=!0);this.init(),this._initialItems=this._store.items.map((function(e){return e.value}))}return Object.defineProperty(e,"defaults",{get:function(){return Object.preventExtensions({get options(){return Ke},get allOptions(){return Oe},get templates(){return He}})},enumerable:!1,configurable:!0}),e.prototype.init=function(){if(!this.initialised){this._loadChoices(),this._createTemplates(),this._createElements(),this._createStructure(),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&&"function"==typeof e&&e.call(this)}},e.prototype.destroy=function(){this.initialised&&(this._removeEventListeners(),this.passedElement.reveal(),this.containerOuter.unwrap(this.passedElement.element),this.clearStore(),this._stopSearch(),this._templates=He,this.initialised=!1)},e.prototype.enable=function(){return this.passedElement.isDisabled&&this.passedElement.enable(),this.containerOuter.isDisabled&&(this._addEventListeners(),this.input.enable(),this.containerOuter.enable()),this},e.prototype.disable=function(){return this.passedElement.isDisabled||this.passedElement.disable(),this.containerOuter.isDisabled||(this._removeEventListeners(),this.input.disable(),this.containerOuter.disable()),this},e.prototype.highlightItem=function(e,t){if(void 0===t&&(t=!0),!e||!e.id)return this;var i=this._store.choices.find((function(t){return t.id===e.id}));return!i||i.highlighted||(this._store.dispatch(ne(i,!0)),t&&this.passedElement.triggerEvent("highlightItem",this._getChoiceForOutput(i))),this},e.prototype.unhighlightItem=function(e,t){if(void 0===t&&(t=!0),!e||!e.id)return this;var i=this._store.choices.find((function(t){return t.id===e.id}));return i&&i.highlighted?(this._store.dispatch(ne(i,!1)),t&&this.passedElement.triggerEvent("highlightItem",this._getChoiceForOutput(i)),this):this},e.prototype.highlightAll=function(){var e=this;return this._store.withDeferRendering((function(){e._store.items.forEach((function(t){return e.highlightItem(t)}))})),this},e.prototype.unhighlightAll=function(){var e=this;return this._store.withDeferRendering((function(){e._store.items.forEach((function(t){return e.unhighlightItem(t)}))})),this},e.prototype.removeActiveItemsByValue=function(e){var t=this;return this._store.withDeferRendering((function(){t._store.items.filter((function(t){return t.value===e})).forEach((function(e){return t._removeItem(e)}))})),this},e.prototype.removeActiveItems=function(e){var t=this;return this._store.withDeferRendering((function(){t._store.items.filter((function(t){return t.id!==e})).forEach((function(e){return t._removeItem(e)}))})),this},e.prototype.removeHighlightedItems=function(e){var t=this;return void 0===e&&(e=!1),this._store.withDeferRendering((function(){t._store.highlightedActiveItems.forEach((function(i){t._removeItem(i),e&&t._triggerChange(i.value)}))})),this},e.prototype.showDropdown=function(e){var t=this;return this.dropdown.isActive||requestAnimationFrame((function(){t.dropdown.show(),t.containerOuter.open(t.dropdown.distanceFromTopWindow),!e&&t._canSearch&&t.input.focus(),t.passedElement.triggerEvent("showDropdown",{})})),this},e.prototype.hideDropdown=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("hideDropdown",{})})),this):this},e.prototype.getValue=function(e){var t=this;void 0===e&&(e=!1);var i=this._store.items.reduce((function(i,n){var s=e?n.value:t._getChoiceForOutput(n);return i.push(s),i}),[]);return this._isSelectOneElement||this.config.singleModeForMultiSelect?i[0]:i},e.prototype.setValue=function(e){var t=this;return this.initialised?(this._store.withDeferRendering((function(){e.forEach((function(e){e&&t._addChoice(Se(e,!1))}))})),this):this},e.prototype.setChoiceByValue=function(e){var t=this;return!this.initialised||this._isTextElement||this._store.withDeferRendering((function(){(Array.isArray(e)?e:[e]).forEach((function(e){return t._findAndSelectChoiceByValue(e)}))})),this},e.prototype.setChoices=function(e,t,n,s){var o=this;if(void 0===e&&(e=[]),void 0===t&&(t="value"),void 0===n&&(n="label"),void 0===s&&(s=!1),!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("string"!=typeof t||!t)throw new TypeError("value parameter must be a name of 'value' field in passed objects");if(s&&this.clearChoices(),"function"==typeof e){var r=e(this);if("function"==typeof Promise&&r instanceof Promise)return new Promise((function(e){return requestAnimationFrame(e)})).then((function(){return o._handleLoadingState(!0)})).then((function(){return r})).then((function(e){return o.setChoices(e,t,n,s)})).catch((function(e){o.config.silent||console.error(e)})).then((function(){return o._handleLoadingState(!1)})).then((function(){return o}));if(!Array.isArray(r))throw new TypeError(".setChoices first argument function must return either array of choices or Promise, got: ".concat(typeof r));return this.setChoices(r,t,n,!1)}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");return this.containerOuter.removeLoadingState(),this._store.withDeferRendering((function(){var s="value"===t,r="label"===n;e.forEach((function(e){if("choices"in e){var c=e;r||(c=i(i({},c),{label:c[n]})),o._addGroup(Se(c,!0))}else{var a=e;r&&s||(a=i(i({},a),{value:a[t],label:a[n]})),o._addChoice(Se(a,!1))}}))})),this},e.prototype.refresh=function(e,t,i){var n=this;return void 0===e&&(e=!1),void 0===t&&(t=!1),void 0===i&&(i=!1),this._isSelectElement?(this._store.withDeferRendering((function(){var s=n.passedElement.optionsAsChoices(),o=n._store.items,r={};i||o.forEach((function(e){e.id&&e.active&&e.selected&&!e.disabled&&(r[e.value]=!0)})),s.forEach((function(e){if(!("choices"in e)){var t=e;i?t.selected=!1:r[t.value]&&(t.selected=!0)}})),n.clearStore(),n._addPredefinedChoices(s,t,e),n._isSearching&&n._searchChoices(n.input.value)})),this):(this.config.silent||console.warn("refresh method can only be used on choices backed by a element"),this)},e.prototype.removeChoice=function(e){var t=this._store.choices.find((function(t){return t.value===e}));return t?(this._store.dispatch(function(e){return{type:"REMOVE_CHOICE",choice:e}}(t)),t.selected&&this.passedElement.triggerEvent("removeItem",this._getChoiceForOutput(t)),this):this},e.prototype.clearChoices=function(){return this._store.dispatch({type:"CLEAR_CHOICES"}),this},e.prototype.clearStore=function(){return this._store.dispatch({type:"CLEAR_ALL"}),this._lastAddedChoiceId=0,this._lastAddedGroupId=0,this},e.prototype.clearInput=function(){var e=!this._isSelectOneElement;return this.input.clear(e),this._isSearching&&this._stopSearch(),this},e.prototype._render=function(){if(!this._store.isLoading()){this._currentState=this._store.state;var e=this._currentState.items!==this._prevState.items;(this._currentState.choices!==this._prevState.choices||this._currentState.groups!==this._prevState.groups||e)&&(this._isSelectElement&&this._renderChoices(),e&&this._renderItems(),this._prevState=this._currentState)}},e.prototype._renderChoices=function(){var e=this,t=this._store,i=t.activeGroups,n=t.activeChoices,s=document.createDocumentFragment();if(this.choiceList.clear(),this.config.resetScrollPosition&&requestAnimationFrame((function(){return e.choiceList.scrollToTop()})),i.length>=1&&!this._isSearching){var o=n.filter((function(e){return e.placeholder&&-1===e.groupId}));o.length>=1&&(s=this._createChoicesFragment(o,s)),s=this._createGroupsFragment(i,n,s)}else n.length>=1&&(s=this._createChoicesFragment(n,s));var r=this.input.value,c=this._canAddItem(this._store.items,r);if(s.childNodes&&s.childNodes.length>0){var a=!c.response;if(c.response&&(this.choiceList.append(s),this._highlightChoice(),this._canAddUserChoices&&r&&c.notice&&(a=!n.find((function(t){return e.config.valueComparer(t.value,r)})))),a){var h=this._templates.notice(this.config,c.notice,this._canAddUserChoices?"add-choice":"");this.choiceList.prepend(h)}}else{var l=void 0;if(c.response&&this._canAddUserChoices&&r)l=this._templates.notice(this.config,c.notice,"add-choice");else if(this._isSearching){h="function"==typeof this.config.noResultsText?this.config.noResultsText():this.config.noResultsText;l=this._templates.notice(this.config,h,"no-results")}else{h="function"==typeof this.config.noChoicesText?this.config.noChoicesText():this.config.noChoicesText;l=this._templates.notice(this.config,h,"no-choices")}this.choiceList.append(l)}},e.prototype._renderItems=function(){var e=this._store.items||[];this.itemList.clear();var t=this._createItemsFragment(e);t.childNodes&&this.itemList.append(t)},e.prototype._createGroupsFragment=function(e,t,i){var n=this;void 0===i&&(i=document.createDocumentFragment());this.config.shouldSort&&e.sort(this.config.sorter);var s=t.filter((function(e){return 0===e.groupId}));return s.length>0&&this._createChoicesFragment(s,i,!1),e.forEach((function(e){var s=function(e){return t.filter((function(t){return n._isSelectOneElement?t.groupId===e.id:t.groupId===e.id&&("always"===n.config.renderSelectedChoices||!t.selected)}))}(e);if(s.length>=1){var o=n._templates.choiceGroup(n.config,e);i.appendChild(o),n._createChoicesFragment(s,i,!0)}})),i},e.prototype._createChoicesFragment=function(e,t,i){var s=this;void 0===t&&(t=document.createDocumentFragment()),void 0===i&&(i=!1);var o=this.config,r=o.renderSelectedChoices,c=o.searchResultLimit,a=o.renderChoiceLimit,h=o.appendGroupInSearch,l=this._isSearching?he:this.config.sorter,u=function(e){if("auto"!==r||(s._isSelectOneElement||!e.selected)){var i=s._templates.choice(s.config,e,s.config.itemSelectText);if(h){var n="";s._store.groups.every((function(t){return t.id!==e.groupId||(n=t.label,!1)})),n&&s._isSearching&&(i.innerHTML+=" (".concat(n,")"))}t.appendChild(i)}},d=e;if("auto"!==r||this._isSelectOneElement||(d=e.filter((function(e){return!e.selected}))),this._isSelectElement){var p=e.filter((function(e){return!e.element}));0!==p.length&&this.passedElement.addOptions(p)}var f=d.reduce((function(e,t){return t.placeholder?e.placeholderChoices.push(t):e.normalChoices.push(t),e}),{placeholderChoices:[],normalChoices:[]}),m=f.placeholderChoices,g=f.normalChoices;(this.config.shouldSort||this._isSearching)&&g.sort(l);var v=d.length,_=this._isSelectOneElement?n(n([],m,!0),g,!0):g;this._isSearching?v=c:a&&a>0&&!i&&(v=a);for(var y=0;y0?this._store.getGroupById(e.groupId):null;return{id:e.id,highlighted:e.highlighted,labelClass:e.labelClass,labelDescription:e.labelDescription,customProperties:e.customProperties,disabled:e.disabled,active:e.active,label:e.label,placeholder:e.placeholder,value:e.value,groupValue:i&&i.label?i.label:void 0,element:e.element,keyCode:t}}},e.prototype._triggerChange=function(e){null!=e&&this.passedElement.triggerEvent("change",{value:e})},e.prototype._selectPlaceholderChoice=function(e){this._addItem(e),e.value&&this._triggerChange(e.value)},e.prototype._handleButtonAction=function(e,t){if(0!==e.length&&this.config.removeItems&&this.config.removeItemButton){var i=t&&Be(t.parentNode),n=i&&e.find((function(e){return e.id===i}));if(n&&(this._removeItem(n),this._triggerChange(n.value),this._isSelectOneElement&&!this._hasNonChoicePlaceholder)){var s=this._store.placeholderChoice;s&&this._selectPlaceholderChoice(s)}}},e.prototype._handleItemAction=function(e,t,i){var n=this;if(void 0===i&&(i=!1),0!==e.length&&this.config.removeItems&&!this._isSelectOneElement){var s=Be(t);s&&(e.forEach((function(e){e.id!==s||e.highlighted?!i&&e.highlighted&&n.unhighlightItem(e):n.highlightItem(e)})),this.input.focus())}},e.prototype._handleChoiceAction=function(e,t,i){var n=this,s=Be(t),o=s&&this._store.getChoiceById(s);if(!o)return!1;var r=this.dropdown.isActive,c=!1;return this._store.withDeferRendering((function(){if(!o.selected&&!o.disabled&&n._canAddItem(e,o.value).response){if(n.config.singleModeForMultiSelect&&0!==e.length){var t=e[e.length-1];n._removeItem(t)}n.passedElement.triggerEvent("choice",n._getChoiceForOutput(o,i)),n._addItem(o),n.clearInput(),c=!0}})),!!c&&(this._triggerChange(o.value),r&&(this.config.singleModeForMultiSelect||this._isSelectOneElement)&&(this.hideDropdown(!0),this.containerOuter.focus()),!0)},e.prototype._handleBackspace=function(e){if(this.config.removeItems&&0!==e.length){var t=e[e.length-1],i=e.some((function(e){return e.highlighted}));this.config.editItems&&!i&&t?(this.input.value=t.value,this.input.setWidth(),this._removeItem(t),this._triggerChange(t.value)):(i||this.highlightItem(t,!1),this.removeHighlightedItems(!0))}},e.prototype._loadChoices=function(){var e;if(this._isTextElement){this._presetItems=this.config.items.map((function(e){return Se(e,!1)}));var t=this.passedElement.value;if(t){var i=t.split(this.config.delimiter).map((function(e){return Se(e,!1)}));this._presetItems=this._presetItems.concat(i)}this._presetItems.forEach((function(e){e.selected=!0}))}else if(this._isSelectElement){this._presetChoices=this.config.choices.map((function(e){return Se(e,!0)}));var n=this.passedElement.optionsAsChoices();n&&(e=this._presetChoices).push.apply(e,n)}},e.prototype._startLoading=function(){this._store.startDeferRendering()},e.prototype._stopLoading=function(){this._store.stopDeferRendering()},e.prototype._handleLoadingState=function(e){void 0===e&&(e=!0);var t=this.itemList.element.querySelector(ue(this.config.classNames.placeholder));e?(this.disable(),this.containerOuter.addLoadingState(),this._isSelectOneElement?t?t.innerHTML=this.config.loadingText:(t=this._templates.placeholder(this.config,this.config.loadingText))&&this.itemList.append(t):this.input.placeholder=this.config.loadingText):(this.enable(),this.containerOuter.removeLoadingState(),this._isSelectOneElement?t&&(t.innerHTML=this._placeholderValue||""):this.input.placeholder=this._placeholderValue||"")},e.prototype._handleSearch=function(e){if(this.input.isFocussed){var t=this._store.choices,i=this.config,n=i.searchFloor,s=i.searchChoices,o=t.some((function(e){return!e.active}));if(null!=e&&e.length>=n){var r=s?this._searchChoices(e):0;null!==r&&this.passedElement.triggerEvent("search",{value:e,resultCount:r})}else o&&this._stopSearch()}},e.prototype._canAddItem=function(e,t){var i=this,n=!0,s="";(this.config.maxItemCount>0&&this.config.maxItemCount<=e.length&&(this.config.singleModeForMultiSelect||(n=!1,s="function"==typeof this.config.maxItemText?this.config.maxItemText(this.config.maxItemCount):this.config.maxItemText)),n&&this._canAddUserChoices&&""!==t&&"function"==typeof this.config.addItemFilter&&!this.config.addItemFilter(t)&&(n=!1,s="function"==typeof this.config.customAddItemText?this.config.customAddItemText(re(t),t):this.config.customAddItemText),!n||""===t||!this._isSelectElement&&this.config.duplicateItemsAllowed)||this._store.items.find((function(e){return i.config.valueComparer(e.value,t)}))&&(n=!1,s="function"==typeof this.config.uniqueItemText?this.config.uniqueItemText(re(t),t):this.config.uniqueItemText);return n&&(s="function"==typeof this.config.addItemText?this.config.addItemText(re(t),t):this.config.addItemText),{response:n,notice:{trusted:s}}},e.prototype._searchChoices=function(e){var t=e.trim().replace(/\s{2,}/," ");if(0===t.length||t===this._currentValue)return null;var i=this._store.searchableChoices,n=this._searchFn(this.config,i,t);return this._currentValue=t,this._highlightPosition=0,this._isSearching=!0,this._store.dispatch(function(e){return{type:"FILTER_CHOICES",results:e}}(n)),n.length},e.prototype._stopSearch=function(){var e=this._isSearching;this._currentValue="",this._isSearching=!1,e&&this._store.dispatch({type:"ACTIVATE_CHOICES",active:!0})},e.prototype._addEventListeners=function(){var e=this.config.shadowRoot||document.documentElement;e.addEventListener("touchend",this._onTouchEnd,!0),this.containerOuter.element.addEventListener("keydown",this._onKeyDown,!0),this.containerOuter.element.addEventListener("mousedown",this._onMouseDown,!0),e.addEventListener("click",this._onClick,{passive:!0}),e.addEventListener("touchmove",this._onTouchMove,{passive:!0}),this.dropdown.element.addEventListener("mouseover",this._onMouseOver,{passive:!0}),this._isSelectOneElement&&(this.containerOuter.element.addEventListener("focus",this._onFocus,{passive:!0}),this.containerOuter.element.addEventListener("blur",this._onBlur,{passive:!0})),this.input.element.addEventListener("keyup",this._onKeyUp,{passive:!0}),this.input.element.addEventListener("input",this._onInput,{passive:!0}),this.input.element.addEventListener("focus",this._onFocus,{passive:!0}),this.input.element.addEventListener("blur",this._onBlur,{passive:!0}),this.input.element.form&&this.input.element.form.addEventListener("reset",this._onFormReset,{passive:!0}),this.input.addEventListeners()},e.prototype._removeEventListeners=function(){var e=this.config.shadowRoot||document.documentElement;e.removeEventListener("touchend",this._onTouchEnd,!0),this.containerOuter.element.removeEventListener("keydown",this._onKeyDown,!0),this.containerOuter.element.removeEventListener("mousedown",this._onMouseDown,!0),e.removeEventListener("click",this._onClick),e.removeEventListener("touchmove",this._onTouchMove),this.dropdown.element.removeEventListener("mouseover",this._onMouseOver),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("input",this._onInput),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()},e.prototype._onKeyDown=function(e){var t=e.keyCode,i=this._store.items,n=this.input.isFocussed,s=this.dropdown.isActive,o=this.itemList.hasChildren(),r=1===e.key.length||2===e.key.length&&e.key.charCodeAt(0)>=55296||"Unidentified"===e.key;switch(this._isTextElement||s||(this.showDropdown(),!this.input.isFocussed&&r&&(this.input.value+=e.key)),t){case 65:return this._onSelectKey(e,o);case 13:return this._onEnterKey(e,i,s);case 27:return this._onEscapeKey(e,s);case 38:case 33:case 40:case 34:return this._onDirectionKey(e,s);case 8:case 46:return this._onDeleteKey(e,i,n)}},e.prototype._onKeyUp=function(){this._canSearch=this.config.searchEnabled},e.prototype._onInput=function(){var e=this.input.value;if(e){if(this._isTextElement){var t=this._canAddItem(this._store.items,e);t.notice&&(this._displayAddItemNotice(t),this.showDropdown(!0))}if(this._canSearch){this._handleSearch(e);var i=this._canAddItem(this._store.items,e);i.response||this._displayAddItemNotice(i),this._canAddUserChoices&&(this._highlightPosition=0,this._highlightChoice())}}else this._isTextElement?this.hideDropdown(!0):this._stopSearch()},e.prototype._displayAddItemNotice=function(e){var t=this._templates.notice(this.config,e.notice,"add-choice"),i="".concat(ue(this.config.classNames.addChoice),"[data-choice-selectable]"),n=this.choiceList.element.querySelector(i);n?n.outerHTML=t.outerHTML:this.choiceList.prepend(t)},e.prototype._onSelectKey=function(e,t){var i=e.ctrlKey,n=e.metaKey;(i||n)&&t&&(this._canSearch=!1,this.config.removeItems&&!this.input.value&&this.input.element===document.activeElement&&this.highlightAll())},e.prototype._onEnterKey=function(e,t,i){var n=this,s=this.input.value,o=e.target;if(o&&o.hasAttribute("data-button"))return e.preventDefault(),void this._handleButtonAction(t,o);if(!i&&this._isSelectOneElement)return e.preventDefault(),void this.showDropdown();if(i){var r=this.dropdown.element.querySelector(ue(this.config.classNames.highlightedState));if(r&&this._handleChoiceAction(t,r,13))return e.preventDefault(),void this.unhighlightAll();s||this.hideDropdown(!0)}o&&s&&this._canAddUserChoices&&(this._canAddItem(t,s).response&&(this._store.withDeferRendering((function(){if((n._isSelectOneElement||n.config.singleModeForMultiSelect)&&0!==t.length){var e=t[t.length-1];n._removeItem(e)}var i=!0;if(!n._isSelectElement&&n.config.duplicateItemsAllowed||(i=!n._findAndSelectChoiceByValue(s)),i){var o=re(s),r=n.config.allowHtmlUserInput||o===s?s:{escaped:o,raw:s};n._addChoice(Se({value:r,label:r,selected:!0},!1))}n.clearInput(),n.unhighlightAll(),n._triggerChange(s)})),(this._isTextElement||this._isSelectOneElement)&&this.hideDropdown(!0)))},e.prototype._onEscapeKey=function(e,t){t&&(e.stopPropagation(),this.hideDropdown(!0),this.containerOuter.focus())},e.prototype._onDirectionKey=function(e,t){var i,n,s,o=e.keyCode,r=e.metaKey;if(t||this._isSelectOneElement){this.showDropdown(),this._canSearch=!1;var c=40===o||34===o?1:-1,a="[data-choice-selectable]",h=void 0;if(r||34===o||33===o)h=c>0?this.dropdown.element.querySelector("".concat(a,":last-of-type")):this.dropdown.element.querySelector(a);else{var l=this.dropdown.element.querySelector(ue(this.config.classNames.highlightedState));h=l?function(e,t,i){void 0===i&&(i=1);for(var n="".concat(i>0?"next":"previous","ElementSibling"),s=e[n];s;){if(s.matches(t))return s;s=s[n]}return s}(l,a,c):this.dropdown.element.querySelector(a)}h&&(i=h,n=this.choiceList.element,void 0===(s=c)&&(s=1),i&&(s>0?n.scrollTop+n.offsetHeight>=i.offsetTop+i.offsetHeight:i.offsetTop>=n.scrollTop)||this.choiceList.scrollToChildElement(h,c),this._highlightChoice(h)),e.preventDefault()}},e.prototype._onDeleteKey=function(e,t,i){var n=e.target;this._isSelectOneElement||n.value||!i||(this._handleBackspace(t),e.preventDefault())},e.prototype._onTouchMove=function(){this._wasTap&&(this._wasTap=!1)},e.prototype._onTouchEnd=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},e.prototype._onMouseDown=function(e){var t=e.target;if(t instanceof HTMLElement){if(Ve&&this.choiceList.element.contains(t)){var i=this.choiceList.element.firstElementChild;this._isScrollingOnIe="ltr"===this._direction?e.offsetX>=i.offsetWidth:e.offsetX0&&this.unhighlightAll(),this.containerOuter.removeFocusState(),this.hideDropdown(!0))},e.prototype._onFocus=function(e){var t,i=this,n=e.target;n&&this.containerOuter.element.contains(n)&&((t={})[fe]=function(){n===i.input.element&&i.containerOuter.addFocusState()},t[me]=function(){i.containerOuter.addFocusState(),n===i.input.element&&i.showDropdown(!0)},t[ge]=function(){n===i.input.element&&(i.showDropdown(!0),i.containerOuter.addFocusState())},t)[this._elementType]()},e.prototype._onBlur=function(e){var t,i=this,n=e.target;if(n&&this.containerOuter.element.contains(n)&&!this._isScrollingOnIe){var s=this._store.activeChoices.some((function(e){return e.highlighted}));((t={})[fe]=function(){n===i.input.element&&(i.containerOuter.removeFocusState(),s&&i.unhighlightAll(),i.hideDropdown(!0))},t[me]=function(){i.containerOuter.removeFocusState(),(n===i.input.element||n===i.containerOuter.element&&!i._canSearch)&&i.hideDropdown(!0)},t[ge]=function(){n===i.input.element&&(i.containerOuter.removeFocusState(),i.hideDropdown(!0),s&&i.unhighlightAll())},t)[this._elementType]()}else this._isScrollingOnIe=!1,this.input.element.focus()},e.prototype._onFormReset=function(){var e=this;this._store.withDeferRendering((function(){e.clearInput(),e.hideDropdown(),e.refresh(!1,!1,!0),0!==e._initialItems.length&&e.setChoiceByValue(e._initialItems)}))},e.prototype._highlightChoice=function(e){var t,i=this;void 0===e&&(e=null);var n=Array.from(this.dropdown.element.querySelectorAll("[data-choice-selectable]"));if(n.length){var s=e;Array.from(this.dropdown.element.querySelectorAll(ue(this.config.classNames.highlightedState))).forEach((function(e){var t;(t=e.classList).remove.apply(t,le(i.config.classNames.highlightedState)),e.setAttribute("aria-selected","false")})),s?this._highlightPosition=n.indexOf(s):(s=n.length>this._highlightPosition?n[this._highlightPosition]:n[n.length-1])||(s=n[0]),(t=s.classList).add.apply(t,le(this.config.classNames.highlightedState)),s.setAttribute("aria-selected","true"),this.passedElement.triggerEvent("highlightChoice",{el:s}),this.dropdown.isActive&&(this.input.setActiveDescendant(s.id),this.containerOuter.setActiveDescendant(s.id))}},e.prototype._addItem=function(e,t){void 0===t&&(t=!0);var i=e.id;if(0===i)throw new TypeError("item.id must be set before _addItem is called for a choice/item");this._store.dispatch(function(e){return{type:"ADD_ITEM",item:e}}(e)),this._isSelectOneElement&&this.removeActiveItems(i),t&&this.passedElement.triggerEvent("addItem",this._getChoiceForOutput(e))},e.prototype._removeItem=function(e){e.id&&(this._store.dispatch(function(e){return{type:"REMOVE_ITEM",item:e}}(e)),this.passedElement.triggerEvent("removeItem",this._getChoiceForOutput(e)))},e.prototype._addChoice=function(e,t){if(void 0===t&&(t=!0),0!==e.id)throw new TypeError("Can not re-add a choice which has already been added");var i=e;this._lastAddedChoiceId++,i.id=this._lastAddedChoiceId,i.elementId="".concat(this._baseId,"-").concat(this._idNames.itemChoice,"-").concat(i.id),this.config.prependValue&&(i.value=this.config.prependValue+i.value),this.config.appendValue&&(i.value+=this.config.appendValue.toString()),(this.config.prependValue||this.config.appendValue)&&i.element&&(i.element.value=i.value),this._store.dispatch(function(e){return{type:"ADD_CHOICE",choice:e}}(e)),e.selected&&this._addItem(e,t)},e.prototype._addGroup=function(e,t){var i=this;if(void 0===t&&(t=!0),0!==e.id)throw new TypeError("Can not re-add a group which has already been added");if(this._store.dispatch(function(e){return{type:"ADD_GROUP",group:e}}(e)),e.choices){var n=e;this._lastAddedGroupId++,n.id=this._lastAddedGroupId;var s=e.id,o=e.choices;n.choices=[],o.forEach((function(n){var o=n;o.groupId=s,e.disabled&&(o.disabled=!0),i._addChoice(o,t)}))}},e.prototype._getTemplate=function(e){for(var t,i=[],s=1;s`Missing ${e} property in key`,_=e=>`Property 'weight' in key '${e}' must be a positive integer`,y=Object.prototype.hasOwnProperty;class b{constructor(e){this._keys=[],this._keyMap={};let t=0;e.forEach((e=>{let i=E(e);this._keys.push(i),this._keyMap[i.id]=i,t+=i.weight})),this._keys.forEach((e=>{e.weight/=t}))}get(e){return this._keyMap[e]}keys(){return this._keys}toJSON(){return JSON.stringify(this._keys)}}function E(e){let t=null,i=null,n=null,s=1,o=null;if(l(e)||c(e))n=e,t=C(e),i=I(e);else{if(!y.call(e,"name"))throw new Error(v("name"));const r=e.name;if(n=r,y.call(e,"weight")&&(s=e.weight,s<=0))throw new Error(_(r));t=C(r),i=I(r),o=e.getFn}return{path:t,id:i,weight:s,src:n,getFn:o}}function C(e){return c(e)?e:e.split(".")}function I(e){return c(e)?e.join("."):e}const S={useExtendedSearch:!1,getFn:function(e,t){let i=[],n=!1;const s=(e,t,o)=>{if(f(e))if(t[o]){const r=e[t[o]];if(!f(r))return;if(o===t.length-1&&(l(r)||u(r)||d(r)))i.push(h(r));else if(c(r)){n=!0;for(let e=0,i=r.length;ee.score===t.score?e.idx{this._keysMap[e.id]=t}))}create(){!this.isCreated&&this.docs.length&&(this.isCreated=!0,l(this.docs[0])?this.docs.forEach(((e,t)=>{this._addString(e,t)})):this.docs.forEach(((e,t)=>{this._addObject(e,t)})),this.norm.clear())}add(e){const t=this.size();l(e)?this._addString(e,t):this._addObject(e,t)}removeAt(e){this.records.splice(e,1);for(let t=e,i=this.size();t{let s=t.getFn?t.getFn(e):this.getFn(e,t.path);if(f(s))if(c(s)){let e=[];const t=[{nestedArrIndex:-1,value:s}];for(;t.length;){const{nestedArrIndex:i,value:n}=t.pop();if(f(n))if(l(n)&&!m(n)){let t={v:n,i:i,n:this.norm.get(n)};e.push(t)}else c(n)&&n.forEach(((e,i)=>{t.push({nestedArrIndex:i,value:e})}))}i.$[n]=e}else if(l(s)&&!m(s)){let e={v:s,n:this.norm.get(s)};i.$[n]=e}})),this.records.push(i)}toJSON(){return{keys:this.keys,records:this.records}}}function A(e,t,{getFn:i=w.getFn,fieldNormWeight:n=w.fieldNormWeight}={}){const s=new L({getFn:i,fieldNormWeight:n});return s.setKeys(e.map(E)),s.setSources(t),s.create(),s}function x(e,{errors:t=0,currentLocation:i=0,expectedLocation:n=0,distance:s=w.distance,ignoreLocation:o=w.ignoreLocation}={}){const r=t/e.length;if(o)return r;const c=Math.abs(n-i);return s?r+c/s:c?1:r}const T=32;function M(e,t,i,{location:n=w.location,distance:s=w.distance,threshold:o=w.threshold,findAllMatches:r=w.findAllMatches,minMatchCharLength:c=w.minMatchCharLength,includeMatches:a=w.includeMatches,ignoreLocation:h=w.ignoreLocation}={}){if(t.length>T)throw new Error(`Pattern length exceeds max of ${T}.`);const l=t.length,u=e.length,d=Math.max(0,Math.min(n,u));let p=o,f=d;const m=c>1||a,g=m?Array(u):[];let v;for(;(v=e.indexOf(t,f))>-1;){let e=x(t,{currentLocation:v,expectedLocation:d,distance:s,ignoreLocation:h});if(p=Math.min(e,p),f=v+l,m){let e=0;for(;e=a;o-=1){let r=o-1,c=i[e.charAt(r)];if(m&&(g[r]=+!!c),C[o]=(C[o+1]<<1|1)&c,n&&(C[o]|=(_[o+1]|_[o])<<1|1|_[o+1]),C[o]&E&&(y=x(t,{errors:n,currentLocation:r,expectedLocation:d,distance:s,ignoreLocation:h}),y<=p)){if(p=y,f=r,f<=d)break;a=Math.max(1,2*d-f)}}if(x(t,{errors:n+1,currentLocation:d,expectedLocation:d,distance:s,ignoreLocation:h})>p)break;_=C}const C={isMatch:f>=0,score:Math.max(.001,y)};if(m){const e=function(e=[],t=w.minMatchCharLength){let i=[],n=-1,s=-1,o=0;for(let r=e.length;o=t&&i.push([n,s]),n=-1)}return e[o-1]&&o-n>=t&&i.push([n,o-1]),i}(g,c);e.length?a&&(C.indices=e):C.isMatch=!1}return C}function N(e){let t={};for(let i=0,n=e.length;i{this.chunks.push({pattern:e,alphabet:N(e),startIndex:t})},l=this.pattern.length;if(l>T){let e=0;const t=l%T,i=l-t;for(;e{const{isMatch:f,score:m,indices:g}=M(e,t,d,{location:n+p,distance:s,threshold:o,findAllMatches:r,minMatchCharLength:c,includeMatches:i,ignoreLocation:a});f&&(u=!0),l+=m,f&&g&&(h=[...h,...g])}));let d={isMatch:u,score:u?l/this.chunks.length:1};return u&&i&&(d.indices=h),d}}class F{constructor(e){this.pattern=e}static isMultiMatch(e){return j(e,this.multiRegex)}static isSingleMatch(e){return j(e,this.singleRegex)}search(){}}function j(e,t){const i=e.match(t);return i?i[1]:null}class P extends F{constructor(e,{location:t=w.location,threshold:i=w.threshold,distance:n=w.distance,includeMatches:s=w.includeMatches,findAllMatches:o=w.findAllMatches,minMatchCharLength:r=w.minMatchCharLength,isCaseSensitive:c=w.isCaseSensitive,ignoreLocation:a=w.ignoreLocation}={}){super(e),this._bitapSearch=new D(e,{location:t,threshold:i,distance:n,includeMatches:s,findAllMatches:o,minMatchCharLength:r,isCaseSensitive:c,ignoreLocation:a})}static get type(){return"fuzzy"}static get multiRegex(){return/^"(.*)"$/}static get singleRegex(){return/^(.*)$/}search(e){return this._bitapSearch.searchIn(e)}}class R extends F{constructor(e){super(e)}static get type(){return"include"}static get multiRegex(){return/^'"(.*)"$/}static get singleRegex(){return/^'(.*)$/}search(e){let t,i=0;const n=[],s=this.pattern.length;for(;(t=e.indexOf(this.pattern,i))>-1;)i=t+s,n.push([t,i-1]);const o=!!n.length;return{isMatch:o,score:o?0:1,indices:n}}}const k=[class extends F{constructor(e){super(e)}static get type(){return"exact"}static get multiRegex(){return/^="(.*)"$/}static get singleRegex(){return/^=(.*)$/}search(e){const t=e===this.pattern;return{isMatch:t,score:t?0:1,indices:[0,this.pattern.length-1]}}},R,class extends F{constructor(e){super(e)}static get type(){return"prefix-exact"}static get multiRegex(){return/^\^"(.*)"$/}static get singleRegex(){return/^\^(.*)$/}search(e){const t=e.startsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,this.pattern.length-1]}}},class extends F{constructor(e){super(e)}static get type(){return"inverse-prefix-exact"}static get multiRegex(){return/^!\^"(.*)"$/}static get singleRegex(){return/^!\^(.*)$/}search(e){const t=!e.startsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,e.length-1]}}},class extends F{constructor(e){super(e)}static get type(){return"inverse-suffix-exact"}static get multiRegex(){return/^!"(.*)"\$$/}static get singleRegex(){return/^!(.*)\$$/}search(e){const t=!e.endsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,e.length-1]}}},class extends F{constructor(e){super(e)}static get type(){return"suffix-exact"}static get multiRegex(){return/^"(.*)"\$$/}static get singleRegex(){return/^(.*)\$$/}search(e){const t=e.endsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[e.length-this.pattern.length,e.length-1]}}},class extends F{constructor(e){super(e)}static get type(){return"inverse-exact"}static get multiRegex(){return/^!"(.*)"$/}static get singleRegex(){return/^!(.*)$/}search(e){const t=-1===e.indexOf(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,e.length-1]}}},P],H=k.length,V=/ +(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/;const K=new Set([P.type,R.type]);class B{constructor(e,{isCaseSensitive:t=w.isCaseSensitive,includeMatches:i=w.includeMatches,minMatchCharLength:n=w.minMatchCharLength,ignoreLocation:s=w.ignoreLocation,findAllMatches:o=w.findAllMatches,location:r=w.location,threshold:c=w.threshold,distance:a=w.distance}={}){this.query=null,this.options={isCaseSensitive:t,includeMatches:i,minMatchCharLength:n,findAllMatches:o,ignoreLocation:s,location:r,threshold:c,distance:a},this.pattern=t?e:e.toLowerCase(),this.query=function(e,t={}){return e.split("|").map((e=>{let i=e.trim().split(V).filter((e=>e&&!!e.trim())),n=[];for(let e=0,s=i.length;e!(!e[q]&&!e[W]),J=e=>({[q]:Object.keys(e).map((t=>({[t]:e[t]})))});function Q(e,t,{auto:i=!0}={}){const n=e=>{let s=Object.keys(e);const o=(e=>!!e[G])(e);if(!o&&s.length>1&&!z(e))return n(J(e));if((e=>!c(e)&&p(e)&&!z(e))(e)){const n=o?e[G]:s[0],r=o?e[X]:e[n];if(!l(r))throw new Error((e=>`Invalid value for key ${e}`)(n));const c={keyId:I(n),pattern:r};return i&&(c.searcher=U(r,t)),c}let r={children:[],operator:s[0]};return s.forEach((t=>{const i=e[t];c(i)&&i.forEach((e=>{r.children.push(n(e))}))})),r};return z(e)||(e=J(e)),n(e)}function Y(e,t){const i=e.matches;t.matches=[],f(i)&&i.forEach((e=>{if(!f(e.indices)||!e.indices.length)return;const{indices:i,value:n}=e;let s={indices:i,value:n};e.key&&(s.key=e.key.src),e.idx>-1&&(s.refIndex=e.idx),t.matches.push(s)}))}function Z(e,t){t.score=e.score}class ee{constructor(e,t={},i){this.options=r(r({},w),t),this.options.useExtendedSearch,this._keyStore=new b(this.options.keys),this.setCollection(e,i)}setCollection(e,t){if(this._docs=e,t&&!(t instanceof L))throw new Error("Incorrect 'index' type");this._myIndex=t||A(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight})}add(e){f(e)&&(this._docs.push(e),this._myIndex.add(e))}remove(e=()=>!1){const t=[];for(let i=0,n=this._docs.length;i{let i=1;e.matches.forEach((({key:e,norm:n,score:s})=>{const o=e?e.weight:null;i*=Math.pow(0===s&&o?Number.EPSILON:s,(o||1)*(t?1:n))})),e.score=i}))}(c,{ignoreFieldNorm:r}),s&&c.sort(o),u(t)&&t>-1&&(c=c.slice(0,t)),function(e,t,{includeMatches:i=w.includeMatches,includeScore:n=w.includeScore}={}){const s=[];return i&&s.push(Y),n&&s.push(Z),e.map((e=>{const{idx:i}=e,n={item:t[i],refIndex:i};return s.length&&s.forEach((t=>{t(e,n)})),n}))}(c,this._docs,{includeMatches:i,includeScore:n})}_searchStringList(e){const t=U(e,this.options),{records:i}=this._myIndex,n=[];return i.forEach((({v:e,i:i,n:s})=>{if(!f(e))return;const{isMatch:o,score:r,indices:c}=t.searchIn(e);o&&n.push({item:e,idx:i,matches:[{score:r,value:e,norm:s,indices:c}]})})),n}_searchLogical(e){const t=Q(e,this.options),i=(e,t,n)=>{if(!e.children){const{keyId:i,searcher:s}=e,o=this._findMatches({key:this._keyStore.get(i),value:this._myIndex.getValueForItemAtKeyId(t,i),searcher:s});return o&&o.length?[{idx:n,item:t,matches:o}]:[]}const s=[];for(let o=0,r=e.children.length;o{if(f(e)){let r=i(t,e,n);r.length&&(s[n]||(s[n]={idx:n,item:e,matches:[]},o.push(s[n])),r.forEach((({matches:e})=>{s[n].matches.push(...e)})))}})),o}_searchObjectList(e){const t=U(e,this.options),{keys:i,records:n}=this._myIndex,s=[];return n.forEach((({$:e,i:n})=>{if(!f(e))return;let o=[];i.forEach(((i,n)=>{o.push(...this._findMatches({key:i,value:e[n],searcher:t}))})),o.length&&s.push({idx:n,item:e,matches:o})})),s}_findMatches({key:e,value:t,searcher:i}){if(!f(t))return[];let n=[];if(c(t))t.forEach((({v:t,i:s,n:o})=>{if(!f(t))return;const{isMatch:r,score:c,indices:a}=i.searchIn(t);r&&n.push({score:c,key:e,value:t,idx:s,norm:o,indices:a})}));else{const{v:s,n:o}=t,{isMatch:r,score:c,indices:a}=i.searchIn(s);r&&n.push({score:c,key:e,value:s,norm:o,indices:a})}return n}}ee.version="7.0.0",ee.createIndex=A,ee.parseIndex=function(e,{getFn:t=w.getFn,fieldNormWeight:i=w.fieldNormWeight}={}){const{keys:n,records:s}=e,o=new L({getFn:t,fieldNormWeight:i});return o.setKeys(n),o.setIndexRecords(s),o},ee.config=w,ee.parseQuery=Q,function(...e){$.push(...e)}(B);var te,ie=function(e,t,s){return new ee(t,i(i({},e.fuseOptions),{keys:n([],e.searchFields,!0),includeMatches:!0})).search(s)},ne=function(e,t){return{type:"HIGHLIGHT_ITEM",item:e,highlighted:t}},se=function(e){return{type:"SET_IS_LOADING",isLoading:e}},oe=function(e){return Array.from({length:e},(function(){return(e=0,t=36,Math.floor(Math.random()*(t-e)+e)).toString(36);var e,t})).join("")},re=function(e){if("string"!=typeof e){if(null==e)return"";if("object"==typeof e){if("raw"in e)return re(e.raw);if("trusted"in e)return e.trusted}return e}return e.replace(/&/g,"&").replace(/>/g,">").replace(/0?this.element.scrollTop+r-s:e.offsetTop;requestAnimationFrame((function(){i._animateScroll(c,t)}))}},e.prototype._scrollDown=function(e,t,i){var n=(i-e)/t,s=n>1?n:1;this.element.scrollTop=e+s},e.prototype._scrollUp=function(e,t,i){var n=(e-i)/t,s=n>1?n:1;this.element.scrollTop=e-s},e.prototype._animateScroll=function(e,t){var i=this,n=this.element.scrollTop,s=!1;t>0?(this._scrollDown(n,4,e),ne&&(s=!0)),s&&requestAnimationFrame((function(){i._animateScroll(e,t)}))},e}(),be=function(){function e(e){var t=e.element,i=e.classNames;this.element=t,this.classNames=i,this.isDisabled=!1}return Object.defineProperty(e.prototype,"isActive",{get:function(){return"active"===this.element.dataset.choice},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"dir",{get:function(){return this.element.dir},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"value",{get:function(){return this.element.value},set:function(e){this.element.setAttribute("value",e),this.element.value=e},enumerable:!1,configurable:!0}),e.prototype.conceal=function(){var e;(e=this.element.classList).add.apply(e,le(this.classNames.input)),this.element.hidden=!0,this.element.tabIndex=-1;var t=this.element.getAttribute("style");t&&this.element.setAttribute("data-choice-orig-style",t),this.element.setAttribute("data-choice","active")},e.prototype.reveal=function(){var e;(e=this.element.classList).remove.apply(e,le(this.classNames.input)),this.element.hidden=!1,this.element.removeAttribute("tabindex");var t=this.element.getAttribute("data-choice-orig-style");t?(this.element.removeAttribute("data-choice-orig-style"),this.element.setAttribute("style",t)):this.element.removeAttribute("style"),this.element.removeAttribute("data-choice"),this.element.value=this.element.value},e.prototype.enable=function(){this.element.removeAttribute("disabled"),this.element.disabled=!1,this.isDisabled=!1},e.prototype.disable=function(){this.element.setAttribute("disabled",""),this.element.disabled=!0,this.isDisabled=!0},e.prototype.triggerEvent=function(e,t){!function(e,t,i){void 0===i&&(i=null);var n=new CustomEvent(t,{detail:i,bubbles:!0,cancelable:!0});e.dispatchEvent(n)}(this.element,e,t)},e}(),Ee=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return t(i,e),i}(be),Ce=function(e,t){return void 0===t&&(t=!0),void 0===e?t:!!e},Ie=function(e){if("string"==typeof e&&(e=e.split(" ").filter((function(e){return 0!==e.length}))),Array.isArray(e)&&0!==e.length)return e},Se=function(e,t){if("string"==typeof e)return Se({value:e,label:e},!1);var i=e;if("choices"in i){if(!t)throw new TypeError("optGroup is not allowed");var n=i,s=n.choices.map((function(e){return Se(e,!1)}));return{id:0,label:ae(n.label)||n.value,active:0!==s.length,disabled:!!n.disabled,choices:s}}var o=i;return{id:0,groupId:0,score:0,value:o.value,label:o.label||o.value,active:Ce(o.active),selected:Ce(o.selected,!1),disabled:Ce(o.disabled,!1),placeholder:Ce(o.placeholder,!1),highlighted:!1,labelClass:Ie(o.labelClass),labelDescription:o.labelDescription,customProperties:o.customProperties}},we=function(e){function i(t){var i=t.element,n=t.classNames,s=t.template,o=t.extractPlaceholder,r=e.call(this,{element:i,classNames:n})||this;return r.template=s,r.extractPlaceholder=o,r}return t(i,e),Object.defineProperty(i.prototype,"placeholderOption",{get:function(){return this.element.querySelector('option[value=""]')||this.element.querySelector("option[placeholder]")},enumerable:!1,configurable:!0}),i.prototype.addOptions=function(e){var t=this;e.forEach((function(e){var i=e;if(!i.element){var n=t.template(i);t.element.appendChild(n),i.element=n}}))},i.prototype.optionsAsChoices=function(){var e=this,t=[];return this.element.querySelectorAll(":scope > option, :scope > optgroup").forEach((function(i){!function(e){return"OPTION"===e.tagName}(i)?function(e){return"OPTGROUP"===e.tagName}(i)&&t.push(e._optgroupToChoice(i)):t.push(e._optionToChoice(i))})),t},i.prototype._optionToChoice=function(e){return{id:0,groupId:0,score:0,value:e.value,label:e.innerHTML,element:e,active:!0,selected:this.extractPlaceholder?e.selected:e.hasAttribute("selected"),disabled:e.disabled,highlighted:!1,placeholder:this.extractPlaceholder&&(""===e.value||e.hasAttribute("placeholder")),labelClass:void 0!==e.dataset.labelClass?Ie(e.dataset.labelClass):void 0,labelDescription:void 0!==e.dataset.labelDescription?e.dataset.labelDescription:void 0,customProperties:de(e.dataset.customProperties)}},i.prototype._optgroupToChoice=function(e){var t=this,i=e.querySelectorAll("option"),n=Array.from(i).map((function(e){return t._optionToChoice(e)}));return{id:0,label:e.label||"",element:e,active:0!==n.length,disabled:e.disabled,choices:n}},i}(be),Oe={items:[],choices:[],silent:!1,renderChoiceLimit:-1,maxItemCount:-1,singleModeForMultiSelect:!1,addChoices:!1,addItems:!0,addItemFilter:function(e){return!!e&&""!==e},removeItems:!0,removeItemButton:!1,removeItemButtonAlignLeft:!1,editItems:!1,allowHTML:!1,allowHtmlUserInput:!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,sorter:function(e,t){var i=e.value,n=e.label,s=void 0===n?i:n,o=t.value,r=t.label,c=void 0===r?o:r;return ae(s).localeCompare(ae(c),[],{sensitivity:"base",ignorePunctuation:!0,numeric:!0})},shadowRoot:null,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 "'.concat(e,'"')},removeItemIconText:function(){return"Remove item"},removeItemLabelText:function(e){return"Remove item: ".concat(e)},maxItemText:function(e){return"Only ".concat(e," values can be added")},valueComparer:function(e,t){return e===t},fuseOptions:{includeScore:!0},labelId:"",callbackOnInit:null,callbackOnCreateTemplates:null,classNames:{containerOuter:["choices"],containerInner:["choices__inner"],input:["choices__input"],inputCloned:["choices__input--cloned"],list:["choices__list"],listItems:["choices__list--multiple"],listSingle:["choices__list--single"],listDropdown:["choices__list--dropdown"],item:["choices__item"],itemSelectable:["choices__item--selectable"],itemDisabled:["choices__item--disabled"],itemChoice:["choices__item--choice"],description:["choices__description"],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"],selectedState:["is-selected"],flippedState:["is-flipped"],loadingState:["is-loading"],addChoice:["choices__item","choices__item--selectable","add-choice"],noResults:["has-no-results"],noChoices:["has-no-choices"]},appendGroupInSearch:!1},Le=["fuseOptions","classNames"];function Ae(e){return"Minified Redux error #"+e+"; visit https://redux.js.org/Errors?code="+e+" for the full message or use the non-minified dev environment for full errors. "}var xe="function"==typeof Symbol&&Symbol.observable||"@@observable",Te=function(){return Math.random().toString(36).substring(7).split("").join(".")},Me={INIT:"@@redux/INIT"+Te(),REPLACE:"@@redux/REPLACE"+Te(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+Te()}};function Ne(e,t,i){var n;if("function"==typeof t&&"function"==typeof i||"function"==typeof i&&"function"==typeof arguments[3])throw new Error(Ae(0));if("function"==typeof t&&void 0===i&&(i=t,t=void 0),void 0!==i){if("function"!=typeof i)throw new Error(Ae(1));return i(Ne)(e,t)}if("function"!=typeof e)throw new Error(Ae(2));var s=e,o=t,r=[],c=r,a=!1;function h(){c===r&&(c=r.slice())}function l(){if(a)throw new Error(Ae(3));return o}function u(e){if("function"!=typeof e)throw new Error(Ae(4));if(a)throw new Error(Ae(5));var t=!0;return h(),c.push(e),function(){if(t){if(a)throw new Error(Ae(6));t=!1,h();var i=c.indexOf(e);c.splice(i,1),r=null}}}function d(e){if(!function(e){if("object"!=typeof e||null===e)return!1;for(var t=e;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}(e))throw new Error(Ae(7));if(void 0===e.type)throw new Error(Ae(8));if(a)throw new Error(Ae(9));try{a=!0,o=s(o,e)}finally{a=!1}for(var t=r=c,i=0;i0},e.prototype.getChoiceById=function(e){return this.activeChoices.find((function(t){return t.id===e}))},e.prototype.getGroupById=function(e){return this.groups.find((function(t){return t.id===e}))},e}(),Re=function(e,t){return e?function(e){if("string"==typeof e)return e;if("object"==typeof e){if("escaped"in e)return e.escaped;if("trusted"in e)return e.trusted}return""}(t):re(t)},ke=function(e,t){if(t){var i=e.dataset;"string"==typeof t?i.customProperties=t:"object"!=typeof t||function(e){for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0}(t)||(i.customProperties=JSON.stringify(t))}},He={containerOuter:function(e,t,i,n,s,o,r){var c=e.classNames.containerOuter,a=Object.assign(document.createElement("div"),{className:le(c).join(" ")});return a.dataset.type=o,t&&(a.dir=t),n&&(a.tabIndex=0),i&&(a.setAttribute("role",s?"combobox":"listbox"),s&&a.setAttribute("aria-autocomplete","list")),a.setAttribute("aria-haspopup","true"),a.setAttribute("aria-expanded","false"),r&&a.setAttribute("aria-labelledby",r),a},containerInner:function(e){var t=e.classNames.containerInner;return Object.assign(document.createElement("div"),{className:le(t).join(" ")})},itemList:function(e,t){var i=e.classNames,n=i.list,s=i.listSingle,o=i.listItems;return Object.assign(document.createElement("div"),{className:"".concat(le(n).join(" ")," ").concat(t?le(s).join(" "):le(o).join(" "))})},placeholder:function(e,t){var i=e.allowHTML,n=e.classNames.placeholder;return Object.assign(document.createElement("div"),{className:le(n).join(" "),innerHTML:Re(i,t)})},item:function(e,t,i){var n,s,o,r=e.allowHTML,c=e.removeItemButtonAlignLeft,a=e.classNames,h=a.item,l=a.button,u=a.highlightedState,d=a.itemSelectable,p=a.placeholder,f=t.id,m=t.value,g=t.label,v=t.labelClass,_=t.labelDescription,y=t.customProperties,b=t.active,E=t.disabled,C=t.highlighted,I=t.placeholder,S=Object.assign(document.createElement("div"),{className:le(h).join(" ")});if(v){var w=Object.assign(document.createElement("span"),{innerHTML:Re(r,g),className:le(v).join(" ")});S.appendChild(w)}else S.innerHTML=Re(r,g);if(Object.assign(S.dataset,{item:"",id:f,value:m}),v&&(S.dataset.labelClass=le(v).join(" ")),_&&(S.dataset.labelDescription=_),ke(S,y),b&&S.setAttribute("aria-selected","true"),E&&S.setAttribute("aria-disabled","true"),I&&((n=S.classList).add.apply(n,le(p)),S.dataset.placeholder=""),(s=S.classList).add.apply(s,le(C?u:d)),i){E&&(o=S.classList).remove.apply(o,le(d)),S.dataset.deletable="";var O="function"==typeof this.config.removeItemIconText?this.config.removeItemIconText(re(m),m):this.config.removeItemIconText,L="function"==typeof this.config.removeItemLabelText?this.config.removeItemLabelText(re(m),m):this.config.removeItemLabelText,A=Object.assign(document.createElement("button"),{type:"button",className:le(l).join(" "),innerHTML:O});A.setAttribute("aria-label",L),A.dataset.button="",c?S.insertAdjacentElement("afterbegin",A):S.appendChild(A)}return S},choiceList:function(e,t){var i=e.classNames.list,n=Object.assign(document.createElement("div"),{className:le(i).join(" ")});return t||n.setAttribute("aria-multiselectable","true"),n.setAttribute("role","listbox"),n},choiceGroup:function(e,t){var i=e.allowHTML,n=e.classNames,s=n.group,o=n.groupHeading,r=n.itemDisabled,c=t.id,a=t.label,h=t.disabled,l=Object.assign(document.createElement("div"),{className:"".concat(le(s).join(" ")," ").concat(h?le(r).join(" "):"")});return l.setAttribute("role","group"),Object.assign(l.dataset,{group:"",id:c,value:a}),h&&l.setAttribute("aria-disabled","true"),l.appendChild(Object.assign(document.createElement("div"),{className:le(o).join(" "),innerHTML:Re(i,a)})),l},choice:function(e,t,i){var n,s,o,r,c,a=e.allowHTML,h=e.classNames,l=h.item,u=h.itemChoice,d=h.itemSelectable,p=h.selectedState,f=h.itemDisabled,m=h.description,g=h.placeholder,v=t.id,_=t.value,y=t.label,b=t.groupId,E=t.elementId,C=t.labelClass,I=t.labelDescription,S=t.disabled,w=t.selected,O=t.placeholder,L=Object.assign(document.createElement("div"),{id:E,className:"".concat(le(l).join(" ")," ").concat(le(u).join(" "))}),A=L;if(C){var x=Object.assign(document.createElement("span"),{innerHTML:Re(a,y),className:le(C).join(" ")});A=x,L.appendChild(x)}else L.innerHTML=Re(a,y);if(I){var T="".concat(E,"-description");A.setAttribute("aria-describedby",T);var M=Object.assign(document.createElement("span"),{innerHTML:Re(a,I),id:T});(n=M.classList).add.apply(n,le(m)),L.appendChild(M)}return w&&(s=L.classList).add.apply(s,le(p)),O&&(o=L.classList).add.apply(o,le(g)),L.setAttribute("role",b&&b>0?"treeitem":"option"),Object.assign(L.dataset,{choice:"",id:v,value:_,selectText:i}),C&&(L.dataset.labelClass=le(C).join(" ")),I&&(L.dataset.labelDescription=I),S?((r=L.classList).add.apply(r,le(f)),L.dataset.choiceDisabled="",L.setAttribute("aria-disabled","true")):((c=L.classList).add.apply(c,le(d)),L.dataset.choiceSelectable=""),L},input:function(e,t){var i=e.classNames,n=i.input,s=i.inputCloned,o=Object.assign(document.createElement("input"),{type:"search",className:"".concat(le(n).join(" ")," ").concat(le(s).join(" ")),autocomplete:"off",autocapitalize:"off",spellcheck:!1});return o.setAttribute("role","textbox"),o.setAttribute("aria-autocomplete","list"),t&&o.setAttribute("aria-label",t),o},dropdown:function(e){var t,i,n=e.classNames,s=n.list,o=n.listDropdown,r=document.createElement("div");return(t=r.classList).add.apply(t,le(s)),(i=r.classList).add.apply(i,le(o)),r.setAttribute("aria-expanded","false"),r},notice:function(e,t,i){var s=e.allowHTML,o=e.classNames,r=o.item,c=o.itemChoice,a=o.addChoice,h=o.noResults,l=o.noChoices;void 0===i&&(i="");var u=n(n([],le(r),!0),le(c),!0);switch(i){case"add-choice":u.push.apply(u,le(a));break;case"no-results":u.push.apply(u,le(h));break;case"no-choices":u.push.apply(u,le(l))}var d=Object.assign(document.createElement("div"),{innerHTML:Re(s,t),className:u.join(" ")});return"add-choice"===i&&(d.dataset.choiceSelectable="",d.dataset.choice=""),d},option:function(e){var t=e.label,i=e.value,n=e.labelClass,s=e.labelDescription,o=e.customProperties,r=e.active,c=e.disabled,a=ae(t),h=new Option(a,i,!1,r);return n&&(h.dataset.labelClass=le(n).join(" ")),s&&(h.dataset.labelDescription=s),ke(h,o),h.disabled=c,h}},Ve="-ms-scroll-limit"in document.documentElement.style&&"-ms-ime-align"in document.documentElement.style,Ke={},Be=function(e){if(e){var t=e.dataset.id;return t?parseInt(t,10):void 0}},$e=function(){function e(t,n){void 0===t&&(t="[data-choice]"),void 0===n&&(n={});var s=this;this._hasNonChoicePlaceholder=!1,this._lastAddedChoiceId=0,this._lastAddedGroupId=0,this.config=i(i(i({},e.defaults.allOptions),e.defaults.options),n),Le.forEach((function(t){s.config[t]=i(i(i({},e.defaults.allOptions[t]),e.defaults.options[t]),n[t])}));var o,r,c,a,h=(o=this.config,r=Oe,c=Object.keys(o).sort(),a=Object.keys(r).sort(),c.filter((function(e){return a.indexOf(e)<0})));h.length&&console.warn("Unknown config option(s) passed",h.join(", ")),!this.config.silent&&this.config.allowHTML&&this.config.allowHtmlUserInput&&(this.config.addItems&&console.warn("Warning: allowHTML/allowHtmlUserInput/addItems all being true is strongly not recommended and may lead to XSS attacks"),this.config.addChoices&&console.warn("Warning: allowHTML/allowHtmlUserInput/addChoices all being true is strongly not recommended and may lead to XSS attacks"));var l=this.config.shadowRoot||document.documentElement,u="string"==typeof t?l.querySelector(t):t;if(!u||"object"!=typeof u||"INPUT"!==u.tagName&&!function(e){return"SELECT"===e.tagName}(u)){if(!u&&"string"==typeof t)throw TypeError("Selector ".concat(t," failed to find an element"));throw TypeError("Expected one of the following types text|select-one|select-multiple")}if(this._elementType=u.type,this._isTextElement=this._elementType===fe,(this._isTextElement||1!==this.config.maxItemCount)&&(this.config.singleModeForMultiSelect=!1),this.config.singleModeForMultiSelect&&(this._elementType=ge),this._isSelectOneElement=this._elementType===me,this._isSelectMultipleElement=this._elementType===ge,this._isSelectElement=this._isSelectOneElement||this._isSelectMultipleElement,this._canAddUserChoices=this._isTextElement&&this.config.addItems||this._isSelectElement&&this.config.addChoices,["auto","always"].includes("".concat(this.config.renderSelectedChoices))||(this.config.renderSelectedChoices="auto"),this.config.placeholder&&(this.config.placeholderValue?this._hasNonChoicePlaceholder=!0:u.dataset.placeholder&&(this._hasNonChoicePlaceholder=!0,this.config.placeholderValue=u.dataset.placeholder)),n.addItemFilter&&"function"!=typeof n.addItemFilter){var d=n.addItemFilter instanceof RegExp?n.addItemFilter:new RegExp(n.addItemFilter);this.config.addItemFilter=d.test.bind(d)}if(this._isTextElement)this.passedElement=new Ee({element:u,classNames:this.config.classNames});else{var p=u;this.passedElement=new we({element:p,classNames:this.config.classNames,template:function(e){return s._templates.option(e)},extractPlaceholder:this.config.placeholder&&!this._hasNonChoicePlaceholder})}if(this.initialised=!1,this._store=new Pe,this._initialState=De,this._currentState=De,this._prevState=De,this._currentValue="",this.config.searchEnabled=!this._isTextElement&&this.config.searchEnabled||this._elementType===ge,this._canSearch=this.config.searchEnabled,this._isScrollingOnIe=!1,this._highlightPosition=0,this._wasTap=!0,this._placeholderValue=this._generatePlaceholderValue(),this._baseId=function(e,t){var i=e.id||e.name&&"".concat(e.name,"-").concat(oe(2))||oe(4);return i=i.replace(/(:|\.|\[|\]|,)/g,""),"".concat(t,"-").concat(i)}(this.passedElement.element,"choices-"),this._searchFn=ie,this._direction=this.passedElement.dir,!this._direction){var f=window.getComputedStyle(this.passedElement.element).direction;f!==window.getComputedStyle(document.documentElement).direction&&(this._direction=f)}if(this._idNames={itemChoice:"item-choice"},this._render=this._render.bind(this),this._onFocus=this._onFocus.bind(this),this._onBlur=this._onBlur.bind(this),this._onKeyUp=this._onKeyUp.bind(this),this._onKeyDown=this._onKeyDown.bind(this),this._onInput=this._onInput.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._onSelectKey=this._onSelectKey.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),this.passedElement.isActive)return this.config.silent||console.warn("Trying to initialise Choices on element already initialised",{element:t}),void(this.initialised=!0);this.init(),this._initialItems=this._store.items.map((function(e){return e.value}))}return Object.defineProperty(e,"defaults",{get:function(){return Object.preventExtensions({get options(){return Ke},get allOptions(){return Oe},get templates(){return He}})},enumerable:!1,configurable:!0}),e.prototype.init=function(){if(!this.initialised){this._loadChoices(),this._createTemplates(),this._createElements(),this._createStructure(),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&&"function"==typeof e&&e.call(this)}},e.prototype.destroy=function(){this.initialised&&(this._removeEventListeners(),this.passedElement.reveal(),this.containerOuter.unwrap(this.passedElement.element),this.clearStore(),this._stopSearch(),this._templates=He,this.initialised=!1)},e.prototype.enable=function(){return this.passedElement.isDisabled&&this.passedElement.enable(),this.containerOuter.isDisabled&&(this._addEventListeners(),this.input.enable(),this.containerOuter.enable()),this},e.prototype.disable=function(){return this.passedElement.isDisabled||this.passedElement.disable(),this.containerOuter.isDisabled||(this._removeEventListeners(),this.input.disable(),this.containerOuter.disable()),this},e.prototype.highlightItem=function(e,t){if(void 0===t&&(t=!0),!e||!e.id)return this;var i=this._store.choices.find((function(t){return t.id===e.id}));return!i||i.highlighted||(this._store.dispatch(ne(i,!0)),t&&this.passedElement.triggerEvent("highlightItem",this._getChoiceForOutput(i))),this},e.prototype.unhighlightItem=function(e,t){if(void 0===t&&(t=!0),!e||!e.id)return this;var i=this._store.choices.find((function(t){return t.id===e.id}));return i&&i.highlighted?(this._store.dispatch(ne(i,!1)),t&&this.passedElement.triggerEvent("highlightItem",this._getChoiceForOutput(i)),this):this},e.prototype.highlightAll=function(){var e=this;return this._store.withDeferRendering((function(){e._store.items.forEach((function(t){return e.highlightItem(t)}))})),this},e.prototype.unhighlightAll=function(){var e=this;return this._store.withDeferRendering((function(){e._store.items.forEach((function(t){return e.unhighlightItem(t)}))})),this},e.prototype.removeActiveItemsByValue=function(e){var t=this;return this._store.withDeferRendering((function(){t._store.items.filter((function(t){return t.value===e})).forEach((function(e){return t._removeItem(e)}))})),this},e.prototype.removeActiveItems=function(e){var t=this;return this._store.withDeferRendering((function(){t._store.items.filter((function(t){return t.id!==e})).forEach((function(e){return t._removeItem(e)}))})),this},e.prototype.removeHighlightedItems=function(e){var t=this;return void 0===e&&(e=!1),this._store.withDeferRendering((function(){t._store.highlightedActiveItems.forEach((function(i){t._removeItem(i),e&&t._triggerChange(i.value)}))})),this},e.prototype.showDropdown=function(e){var t=this;return this.dropdown.isActive||requestAnimationFrame((function(){t.dropdown.show(),t.containerOuter.open(t.dropdown.distanceFromTopWindow),!e&&t._canSearch&&t.input.focus(),t.passedElement.triggerEvent("showDropdown",{})})),this},e.prototype.hideDropdown=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("hideDropdown",{})})),this):this},e.prototype.getValue=function(e){var t=this;void 0===e&&(e=!1);var i=this._store.items.reduce((function(i,n){var s=e?n.value:t._getChoiceForOutput(n);return i.push(s),i}),[]);return this._isSelectOneElement||this.config.singleModeForMultiSelect?i[0]:i},e.prototype.setValue=function(e){var t=this;return this.initialised?(this._store.withDeferRendering((function(){e.forEach((function(e){e&&t._addChoice(Se(e,!1))}))})),this):this},e.prototype.setChoiceByValue=function(e){var t=this;return!this.initialised||this._isTextElement||this._store.withDeferRendering((function(){(Array.isArray(e)?e:[e]).forEach((function(e){return t._findAndSelectChoiceByValue(e)}))})),this},e.prototype.setChoices=function(e,t,n,s){var o=this;if(void 0===e&&(e=[]),void 0===t&&(t="value"),void 0===n&&(n="label"),void 0===s&&(s=!1),!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("string"!=typeof t||!t)throw new TypeError("value parameter must be a name of 'value' field in passed objects");if(s&&this.clearChoices(),"function"==typeof e){var r=e(this);if("function"==typeof Promise&&r instanceof Promise)return new Promise((function(e){return requestAnimationFrame(e)})).then((function(){return o._handleLoadingState(!0)})).then((function(){return r})).then((function(e){return o.setChoices(e,t,n,s)})).catch((function(e){o.config.silent||console.error(e)})).then((function(){return o._handleLoadingState(!1)})).then((function(){return o}));if(!Array.isArray(r))throw new TypeError(".setChoices first argument function must return either array of choices or Promise, got: ".concat(typeof r));return this.setChoices(r,t,n,!1)}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");return this.containerOuter.removeLoadingState(),this._store.withDeferRendering((function(){var s="value"===t,r="label"===n;e.forEach((function(e){if("choices"in e){var c=e;r||(c=i(i({},c),{label:c[n]})),o._addGroup(Se(c,!0))}else{var a=e;r&&s||(a=i(i({},a),{value:a[t],label:a[n]})),o._addChoice(Se(a,!1))}}))})),this},e.prototype.refresh=function(e,t,i){var n=this;return void 0===e&&(e=!1),void 0===t&&(t=!1),void 0===i&&(i=!1),this._isSelectElement?(this._store.withDeferRendering((function(){var s=n.passedElement.optionsAsChoices(),o=n._store.items,r={};i||o.forEach((function(e){e.id&&e.active&&e.selected&&!e.disabled&&(r[e.value]=!0)})),s.forEach((function(e){if(!("choices"in e)){var t=e;i?t.selected=!1:r[t.value]&&(t.selected=!0)}})),n.clearStore(),n._addPredefinedChoices(s,t,e),n._isSearching&&n._searchChoices(n.input.value)})),this):(this.config.silent||console.warn("refresh method can only be used on choices backed by a element"),this)},e.prototype.removeChoice=function(e){var t=this._store.choices.find((function(t){return t.value===e}));return t?(this._store.dispatch(function(e){return{type:"REMOVE_CHOICE",choice:e}}(t)),t.selected&&this.passedElement.triggerEvent("removeItem",this._getChoiceForOutput(t)),this):this},e.prototype.clearChoices=function(){return this._store.dispatch({type:"CLEAR_CHOICES"}),this},e.prototype.clearStore=function(){return this._store.dispatch({type:"CLEAR_ALL"}),this._lastAddedChoiceId=0,this._lastAddedGroupId=0,this},e.prototype.clearInput=function(){var e=!this._isSelectOneElement;return this.input.clear(e),this._isSearching&&this._stopSearch(),this},e.prototype._render=function(){if(!this._store.isLoading()){this._currentState=this._store.state;var e=this._currentState.items!==this._prevState.items;(this._currentState.choices!==this._prevState.choices||this._currentState.groups!==this._prevState.groups||e)&&(this._isSelectElement&&this._renderChoices(),e&&this._renderItems(),this._prevState=this._currentState)}},e.prototype._renderChoices=function(){var e=this,t=this._store,i=t.activeGroups,n=t.activeChoices,s=document.createDocumentFragment();if(this.choiceList.clear(),this.config.resetScrollPosition&&requestAnimationFrame((function(){return e.choiceList.scrollToTop()})),i.length>=1&&!this._isSearching){var o=n.filter((function(e){return e.placeholder&&-1===e.groupId}));o.length>=1&&(s=this._createChoicesFragment(o,s)),s=this._createGroupsFragment(i,n,s)}else n.length>=1&&(s=this._createChoicesFragment(n,s));var r=this.input.value,c=this._canAddItem(this._store.items,r);if(s.childNodes&&s.childNodes.length>0){var a=!c.response;if(c.response&&(this.choiceList.append(s),this._highlightChoice(),this._canAddUserChoices&&r&&c.notice&&(a=!n.find((function(t){return e.config.valueComparer(t.value,r)})))),a){var h=this._templates.notice(this.config,c.notice,this._canAddUserChoices?"add-choice":"");this.choiceList.prepend(h)}}else{var l=void 0;if(c.response&&this._canAddUserChoices&&r)l=this._templates.notice(this.config,c.notice,"add-choice");else if(this._isSearching){h="function"==typeof this.config.noResultsText?this.config.noResultsText():this.config.noResultsText;l=this._templates.notice(this.config,h,"no-results")}else{h="function"==typeof this.config.noChoicesText?this.config.noChoicesText():this.config.noChoicesText;l=this._templates.notice(this.config,h,"no-choices")}this.choiceList.append(l)}},e.prototype._renderItems=function(){var e=this._store.items||[];this.itemList.clear();var t=this._createItemsFragment(e);t.childNodes&&this.itemList.append(t)},e.prototype._createGroupsFragment=function(e,t,i){var n=this;void 0===i&&(i=document.createDocumentFragment());this.config.shouldSort&&e.sort(this.config.sorter);var s=t.filter((function(e){return 0===e.groupId}));return s.length>0&&this._createChoicesFragment(s,i,!1),e.forEach((function(e){var s=function(e){return t.filter((function(t){return n._isSelectOneElement?t.groupId===e.id:t.groupId===e.id&&("always"===n.config.renderSelectedChoices||!t.selected)}))}(e);if(s.length>=1){var o=n._templates.choiceGroup(n.config,e);i.appendChild(o),n._createChoicesFragment(s,i,!0)}})),i},e.prototype._createChoicesFragment=function(e,t,i){var s=this;void 0===t&&(t=document.createDocumentFragment()),void 0===i&&(i=!1);var o=this.config,r=o.renderSelectedChoices,c=o.searchResultLimit,a=o.renderChoiceLimit,h=o.appendGroupInSearch,l=this._isSearching?he:this.config.sorter,u=function(e){if("auto"!==r||(s._isSelectOneElement||!e.selected)){var i=s._templates.choice(s.config,e,s.config.itemSelectText);if(h){var n="";s._store.groups.every((function(t){return t.id!==e.groupId||(n=t.label,!1)})),n&&s._isSearching&&(i.innerHTML+=" (".concat(n,")"))}t.appendChild(i)}},d=e;if("auto"!==r||this._isSelectOneElement||(d=e.filter((function(e){return!e.selected}))),this._isSelectElement){var p=e.filter((function(e){return!e.element}));0!==p.length&&this.passedElement.addOptions(p)}var f=d.reduce((function(e,t){return t.placeholder?e.placeholderChoices.push(t):e.normalChoices.push(t),e}),{placeholderChoices:[],normalChoices:[]}),m=f.placeholderChoices,g=f.normalChoices;(this.config.shouldSort||this._isSearching)&&g.sort(l);var v=d.length,_=this._isSelectOneElement?n(n([],m,!0),g,!0):g;this._isSearching?v=c:a&&a>0&&!i&&(v=a);for(var y=0;y0?this._store.getGroupById(e.groupId):null;return{id:e.id,highlighted:e.highlighted,labelClass:e.labelClass,labelDescription:e.labelDescription,customProperties:e.customProperties,disabled:e.disabled,active:e.active,label:e.label,placeholder:e.placeholder,value:e.value,groupValue:i&&i.label?i.label:void 0,element:e.element,keyCode:t}}},e.prototype._triggerChange=function(e){null!=e&&this.passedElement.triggerEvent("change",{value:e})},e.prototype._selectPlaceholderChoice=function(e){this._addItem(e),e.value&&this._triggerChange(e.value)},e.prototype._handleButtonAction=function(e,t){if(0!==e.length&&this.config.removeItems&&this.config.removeItemButton){var i=t&&Be(t.parentNode),n=i&&e.find((function(e){return e.id===i}));if(n&&(this._removeItem(n),this._triggerChange(n.value),this._isSelectOneElement&&!this._hasNonChoicePlaceholder)){var s=this._store.placeholderChoice;s&&this._selectPlaceholderChoice(s)}}},e.prototype._handleItemAction=function(e,t,i){var n=this;if(void 0===i&&(i=!1),0!==e.length&&this.config.removeItems&&!this._isSelectOneElement){var s=Be(t);s&&(e.forEach((function(e){e.id!==s||e.highlighted?!i&&e.highlighted&&n.unhighlightItem(e):n.highlightItem(e)})),this.input.focus())}},e.prototype._handleChoiceAction=function(e,t,i){var n=this,s=Be(t),o=s&&this._store.getChoiceById(s);if(!o)return!1;var r=this.dropdown.isActive,c=!1;return this._store.withDeferRendering((function(){if(!o.selected&&!o.disabled&&n._canAddItem(e,o.value).response){if(n.config.singleModeForMultiSelect&&0!==e.length){var t=e[e.length-1];n._removeItem(t)}n.passedElement.triggerEvent("choice",n._getChoiceForOutput(o,i)),n._addItem(o),n.clearInput(),c=!0}})),!!c&&(this._triggerChange(o.value),r&&(this.config.singleModeForMultiSelect||this._isSelectOneElement)&&(this.hideDropdown(!0),this.containerOuter.focus()),!0)},e.prototype._handleBackspace=function(e){if(this.config.removeItems&&0!==e.length){var t=e[e.length-1],i=e.some((function(e){return e.highlighted}));this.config.editItems&&!i&&t?(this.input.value=t.value,this.input.setWidth(),this._removeItem(t),this._triggerChange(t.value)):(i||this.highlightItem(t,!1),this.removeHighlightedItems(!0))}},e.prototype._loadChoices=function(){var e;if(this._isTextElement){this._presetItems=this.config.items.map((function(e){return Se(e,!1)}));var t=this.passedElement.value;if(t){var i=t.split(this.config.delimiter).map((function(e){return Se(e,!1)}));this._presetItems=this._presetItems.concat(i)}this._presetItems.forEach((function(e){e.selected=!0}))}else if(this._isSelectElement){this._presetChoices=this.config.choices.map((function(e){return Se(e,!0)}));var n=this.passedElement.optionsAsChoices();n&&(e=this._presetChoices).push.apply(e,n)}},e.prototype._startLoading=function(){this._store.startDeferRendering()},e.prototype._stopLoading=function(){this._store.stopDeferRendering()},e.prototype._handleLoadingState=function(e){void 0===e&&(e=!0);var t=this.itemList.element.querySelector(ue(this.config.classNames.placeholder));e?(this.disable(),this.containerOuter.addLoadingState(),this._isSelectOneElement?t?t.innerHTML=this.config.loadingText:(t=this._templates.placeholder(this.config,this.config.loadingText))&&this.itemList.append(t):this.input.placeholder=this.config.loadingText):(this.enable(),this.containerOuter.removeLoadingState(),this._isSelectOneElement?t&&(t.innerHTML=this._placeholderValue||""):this.input.placeholder=this._placeholderValue||"")},e.prototype._handleSearch=function(e){if(this.input.isFocussed){var t=this._store.choices,i=this.config,n=i.searchFloor,s=i.searchChoices,o=t.some((function(e){return!e.active}));if(null!=e&&e.length>=n){var r=s?this._searchChoices(e):0;null!==r&&this.passedElement.triggerEvent("search",{value:e,resultCount:r})}else o&&this._stopSearch()}},e.prototype._canAddItem=function(e,t){var i=this,n=!0,s="";(this.config.maxItemCount>0&&this.config.maxItemCount<=e.length&&(this.config.singleModeForMultiSelect||(n=!1,s="function"==typeof this.config.maxItemText?this.config.maxItemText(this.config.maxItemCount):this.config.maxItemText)),n&&this._canAddUserChoices&&""!==t&&"function"==typeof this.config.addItemFilter&&!this.config.addItemFilter(t)&&(n=!1,s="function"==typeof this.config.customAddItemText?this.config.customAddItemText(re(t),t):this.config.customAddItemText),!n||""===t||!this._isSelectElement&&this.config.duplicateItemsAllowed)||this._store.items.find((function(e){return i.config.valueComparer(e.value,t)}))&&(n=!1,s="function"==typeof this.config.uniqueItemText?this.config.uniqueItemText(re(t),t):this.config.uniqueItemText);return n&&(s="function"==typeof this.config.addItemText?this.config.addItemText(re(t),t):this.config.addItemText),{response:n,notice:{trusted:s}}},e.prototype._searchChoices=function(e){var t=e.trim().replace(/\s{2,}/," ");if(0===t.length||t===this._currentValue)return null;var i=this._store.searchableChoices,n=this._searchFn(this.config,i,t);return this._currentValue=t,this._highlightPosition=0,this._isSearching=!0,this._store.dispatch(function(e){return{type:"FILTER_CHOICES",results:e}}(n)),n.length},e.prototype._stopSearch=function(){var e=this._isSearching;this._currentValue="",this._isSearching=!1,e&&this._store.dispatch({type:"ACTIVATE_CHOICES",active:!0})},e.prototype._addEventListeners=function(){var e=this.config.shadowRoot||document.documentElement;e.addEventListener("touchend",this._onTouchEnd,!0),this.containerOuter.element.addEventListener("keydown",this._onKeyDown,!0),this.containerOuter.element.addEventListener("mousedown",this._onMouseDown,!0),e.addEventListener("click",this._onClick,{passive:!0}),e.addEventListener("touchmove",this._onTouchMove,{passive:!0}),this.dropdown.element.addEventListener("mouseover",this._onMouseOver,{passive:!0}),this._isSelectOneElement&&(this.containerOuter.element.addEventListener("focus",this._onFocus,{passive:!0}),this.containerOuter.element.addEventListener("blur",this._onBlur,{passive:!0})),this.input.element.addEventListener("keyup",this._onKeyUp,{passive:!0}),this.input.element.addEventListener("input",this._onInput,{passive:!0}),this.input.element.addEventListener("focus",this._onFocus,{passive:!0}),this.input.element.addEventListener("blur",this._onBlur,{passive:!0}),this.input.element.form&&this.input.element.form.addEventListener("reset",this._onFormReset,{passive:!0}),this.input.addEventListeners()},e.prototype._removeEventListeners=function(){var e=this.config.shadowRoot||document.documentElement;e.removeEventListener("touchend",this._onTouchEnd,!0),this.containerOuter.element.removeEventListener("keydown",this._onKeyDown,!0),this.containerOuter.element.removeEventListener("mousedown",this._onMouseDown,!0),e.removeEventListener("click",this._onClick),e.removeEventListener("touchmove",this._onTouchMove),this.dropdown.element.removeEventListener("mouseover",this._onMouseOver),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("input",this._onInput),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()},e.prototype._onKeyDown=function(e){var t=e.keyCode,i=this._store.items,n=this.input.isFocussed,s=this.dropdown.isActive,o=this.itemList.hasChildren(),r=1===e.key.length||2===e.key.length&&e.key.charCodeAt(0)>=55296||"Unidentified"===e.key;switch(this._isTextElement||s||(this.showDropdown(),!this.input.isFocussed&&r&&(this.input.value+=e.key)),t){case 65:return this._onSelectKey(e,o);case 13:return this._onEnterKey(e,i,s);case 27:return this._onEscapeKey(e,s);case 38:case 33:case 40:case 34:return this._onDirectionKey(e,s);case 8:case 46:return this._onDeleteKey(e,i,n)}},e.prototype._onKeyUp=function(){this._canSearch=this.config.searchEnabled},e.prototype._onInput=function(){var e=this.input.value;if(e){if(this._isTextElement){var t=this._canAddItem(this._store.items,e);t.notice&&(this._displayAddItemNotice(t),this.showDropdown(!0))}if(this._canSearch){this._handleSearch(e);var i=this._canAddItem(this._store.items,e);i.response||this._displayAddItemNotice(i),this._canAddUserChoices&&(this._highlightPosition=0,this._highlightChoice())}}else this._isTextElement?this.hideDropdown(!0):this._stopSearch()},e.prototype._displayAddItemNotice=function(e){var t=this._templates.notice(this.config,e.notice,"add-choice"),i="".concat(ue(this.config.classNames.addChoice),"[data-choice-selectable]"),n=this.choiceList.element.querySelector(i);n?n.outerHTML=t.outerHTML:this.choiceList.prepend(t)},e.prototype._onSelectKey=function(e,t){var i=e.ctrlKey,n=e.metaKey;(i||n)&&t&&(this._canSearch=!1,this.config.removeItems&&!this.input.value&&this.input.element===document.activeElement&&this.highlightAll())},e.prototype._onEnterKey=function(e,t,i){var n=this,s=this.input.value,o=e.target;if(o&&o.hasAttribute("data-button"))return e.preventDefault(),void this._handleButtonAction(t,o);if(!i&&this._isSelectOneElement)return e.preventDefault(),void this.showDropdown();if(i){var r=this.dropdown.element.querySelector(ue(this.config.classNames.highlightedState));if(r&&this._handleChoiceAction(t,r,13))return e.preventDefault(),void this.unhighlightAll();s||this.hideDropdown(!0)}o&&s&&this._canAddUserChoices&&(this._canAddItem(t,s).response&&(this._store.withDeferRendering((function(){if((n._isSelectOneElement||n.config.singleModeForMultiSelect)&&0!==t.length){var e=t[t.length-1];n._removeItem(e)}var i=!0;if(!n._isSelectElement&&n.config.duplicateItemsAllowed||(i=!n._findAndSelectChoiceByValue(s)),i){var o=re(s),r=n.config.allowHtmlUserInput||o===s?s:{escaped:o,raw:s};n._addChoice(Se({value:r,label:r,selected:!0},!1))}n.clearInput(),n.unhighlightAll(),n._triggerChange(s)})),(this._isTextElement||this._isSelectOneElement)&&this.hideDropdown(!0)))},e.prototype._onEscapeKey=function(e,t){t&&(e.stopPropagation(),this.hideDropdown(!0),this.containerOuter.focus())},e.prototype._onDirectionKey=function(e,t){var i,n,s,o=e.keyCode,r=e.metaKey;if(t||this._isSelectOneElement){this.showDropdown(),this._canSearch=!1;var c=40===o||34===o?1:-1,a="[data-choice-selectable]",h=void 0;if(r||34===o||33===o)h=c>0?this.dropdown.element.querySelector("".concat(a,":last-of-type")):this.dropdown.element.querySelector(a);else{var l=this.dropdown.element.querySelector(ue(this.config.classNames.highlightedState));h=l?function(e,t,i){void 0===i&&(i=1);for(var n="".concat(i>0?"next":"previous","ElementSibling"),s=e[n];s;){if(s.matches(t))return s;s=s[n]}return s}(l,a,c):this.dropdown.element.querySelector(a)}h&&(i=h,n=this.choiceList.element,void 0===(s=c)&&(s=1),i&&(s>0?n.scrollTop+n.offsetHeight>=i.offsetTop+i.offsetHeight:i.offsetTop>=n.scrollTop)||this.choiceList.scrollToChildElement(h,c),this._highlightChoice(h)),e.preventDefault()}},e.prototype._onDeleteKey=function(e,t,i){var n=e.target;this._isSelectOneElement||n.value||!i||(this._handleBackspace(t),e.preventDefault())},e.prototype._onTouchMove=function(){this._wasTap&&(this._wasTap=!1)},e.prototype._onTouchEnd=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},e.prototype._onMouseDown=function(e){var t=e.target;if(t instanceof HTMLElement){if(Ve&&this.choiceList.element.contains(t)){var i=this.choiceList.element.firstElementChild;this._isScrollingOnIe="ltr"===this._direction?e.offsetX>=i.offsetWidth:e.offsetX0&&this.unhighlightAll(),this.containerOuter.removeFocusState(),this.hideDropdown(!0))},e.prototype._onFocus=function(e){var t,i=this,n=e.target;n&&this.containerOuter.element.contains(n)&&((t={})[fe]=function(){n===i.input.element&&i.containerOuter.addFocusState()},t[me]=function(){i.containerOuter.addFocusState(),n===i.input.element&&i.showDropdown(!0)},t[ge]=function(){n===i.input.element&&(i.showDropdown(!0),i.containerOuter.addFocusState())},t)[this._elementType]()},e.prototype._onBlur=function(e){var t,i=this,n=e.target;if(n&&this.containerOuter.element.contains(n)&&!this._isScrollingOnIe){var s=this._store.activeChoices.some((function(e){return e.highlighted}));((t={})[fe]=function(){n===i.input.element&&(i.containerOuter.removeFocusState(),s&&i.unhighlightAll(),i.hideDropdown(!0))},t[me]=function(){i.containerOuter.removeFocusState(),(n===i.input.element||n===i.containerOuter.element&&!i._canSearch)&&i.hideDropdown(!0)},t[ge]=function(){n===i.input.element&&(i.containerOuter.removeFocusState(),i.hideDropdown(!0),s&&i.unhighlightAll())},t)[this._elementType]()}else this._isScrollingOnIe=!1,this.input.element.focus()},e.prototype._onFormReset=function(){var e=this;this._store.withDeferRendering((function(){e.clearInput(),e.hideDropdown(),e.refresh(!1,!1,!0),0!==e._initialItems.length&&e.setChoiceByValue(e._initialItems)}))},e.prototype._highlightChoice=function(e){var t,i=this;void 0===e&&(e=null);var n=Array.from(this.dropdown.element.querySelectorAll("[data-choice-selectable]"));if(n.length){var s=e;Array.from(this.dropdown.element.querySelectorAll(ue(this.config.classNames.highlightedState))).forEach((function(e){var t;(t=e.classList).remove.apply(t,le(i.config.classNames.highlightedState)),e.setAttribute("aria-selected","false")})),s?this._highlightPosition=n.indexOf(s):(s=n.length>this._highlightPosition?n[this._highlightPosition]:n[n.length-1])||(s=n[0]),(t=s.classList).add.apply(t,le(this.config.classNames.highlightedState)),s.setAttribute("aria-selected","true"),this.passedElement.triggerEvent("highlightChoice",{el:s}),this.dropdown.isActive&&(this.input.setActiveDescendant(s.id),this.containerOuter.setActiveDescendant(s.id))}},e.prototype._addItem=function(e,t){void 0===t&&(t=!0);var i=e.id;if(0===i)throw new TypeError("item.id must be set before _addItem is called for a choice/item");this._store.dispatch(function(e){return{type:"ADD_ITEM",item:e}}(e)),this._isSelectOneElement&&this.removeActiveItems(i),t&&this.passedElement.triggerEvent("addItem",this._getChoiceForOutput(e))},e.prototype._removeItem=function(e){e.id&&(this._store.dispatch(function(e){return{type:"REMOVE_ITEM",item:e}}(e)),this.passedElement.triggerEvent("removeItem",this._getChoiceForOutput(e)))},e.prototype._addChoice=function(e,t){if(void 0===t&&(t=!0),0!==e.id)throw new TypeError("Can not re-add a choice which has already been added");var i=e;this._lastAddedChoiceId++,i.id=this._lastAddedChoiceId,i.elementId="".concat(this._baseId,"-").concat(this._idNames.itemChoice,"-").concat(i.id),this.config.prependValue&&(i.value=this.config.prependValue+i.value),this.config.appendValue&&(i.value+=this.config.appendValue.toString()),(this.config.prependValue||this.config.appendValue)&&i.element&&(i.element.value=i.value),this._store.dispatch(function(e){return{type:"ADD_CHOICE",choice:e}}(e)),e.selected&&this._addItem(e,t)},e.prototype._addGroup=function(e,t){var i=this;if(void 0===t&&(t=!0),0!==e.id)throw new TypeError("Can not re-add a group which has already been added");if(this._store.dispatch(function(e){return{type:"ADD_GROUP",group:e}}(e)),e.choices){var n=e;this._lastAddedGroupId++,n.id=this._lastAddedGroupId;var s=e.id,o=e.choices;n.choices=[],o.forEach((function(n){var o=n;o.groupId=s,e.disabled&&(o.disabled=!0),i._addChoice(o,t)}))}},e.prototype._getTemplate=function(e){for(var t,i=[],s=1;s`Missing ${e} property in key`,_=e=>`Property 'weight' in key '${e}' must be a positive integer`,y=Object.prototype.hasOwnProperty;class b{constructor(e){this._keys=[],this._keyMap={};let t=0;e.forEach((e=>{let i=E(e);this._keys.push(i),this._keyMap[i.id]=i,t+=i.weight})),this._keys.forEach((e=>{e.weight/=t}))}get(e){return this._keyMap[e]}keys(){return this._keys}toJSON(){return JSON.stringify(this._keys)}}function E(e){let t=null,i=null,n=null,s=1,o=null;if(l(e)||c(e))n=e,t=w(e),i=I(e);else{if(!y.call(e,"name"))throw new Error(v("name"));const r=e.name;if(n=r,y.call(e,"weight")&&(s=e.weight,s<=0))throw new Error(_(r));t=w(r),i=I(r),o=e.getFn}return{path:t,id:i,weight:s,src:n,getFn:o}}function w(e){return c(e)?e:e.split(".")}function I(e){return c(e)?e.join("."):e}const C={useExtendedSearch:!1,getFn:function(e,t){let i=[],n=!1;const s=(e,t,o)=>{if(f(e))if(t[o]){const r=e[t[o]];if(!f(r))return;if(o===t.length-1&&(l(r)||u(r)||d(r)))i.push(h(r));else if(c(r)){n=!0;for(let e=0,i=r.length;ee.score===t.score?e.idx{this._keysMap[e.id]=t}))}create(){!this.isCreated&&this.docs.length&&(this.isCreated=!0,l(this.docs[0])?this.docs.forEach(((e,t)=>{this._addString(e,t)})):this.docs.forEach(((e,t)=>{this._addObject(e,t)})),this.norm.clear())}add(e){const t=this.size();l(e)?this._addString(e,t):this._addObject(e,t)}removeAt(e){this.records.splice(e,1);for(let t=e,i=this.size();t{let s=t.getFn?t.getFn(e):this.getFn(e,t.path);if(f(s))if(c(s)){let e=[];const t=[{nestedArrIndex:-1,value:s}];for(;t.length;){const{nestedArrIndex:i,value:n}=t.pop();if(f(n))if(l(n)&&!m(n)){let t={v:n,i:i,n:this.norm.get(n)};e.push(t)}else c(n)&&n.forEach(((e,i)=>{t.push({nestedArrIndex:i,value:e})}))}i.$[n]=e}else if(l(s)&&!m(s)){let e={v:s,n:this.norm.get(s)};i.$[n]=e}})),this.records.push(i)}toJSON(){return{keys:this.keys,records:this.records}}}function L(e,t,{getFn:i=S.getFn,fieldNormWeight:n=S.fieldNormWeight}={}){const s=new A({getFn:i,fieldNormWeight:n});return s.setKeys(e.map(E)),s.setSources(t),s.create(),s}function T(e,{errors:t=0,currentLocation:i=0,expectedLocation:n=0,distance:s=S.distance,ignoreLocation:o=S.ignoreLocation}={}){const r=t/e.length;if(o)return r;const c=Math.abs(n-i);return s?r+c/s:c?1:r}const x=32;function N(e,t,i,{location:n=S.location,distance:s=S.distance,threshold:o=S.threshold,findAllMatches:r=S.findAllMatches,minMatchCharLength:c=S.minMatchCharLength,includeMatches:a=S.includeMatches,ignoreLocation:h=S.ignoreLocation}={}){if(t.length>x)throw new Error(`Pattern length exceeds max of ${x}.`);const l=t.length,u=e.length,d=Math.max(0,Math.min(n,u));let p=o,f=d;const m=c>1||a,g=m?Array(u):[];let v;for(;(v=e.indexOf(t,f))>-1;){let e=T(t,{currentLocation:v,expectedLocation:d,distance:s,ignoreLocation:h});if(p=Math.min(e,p),f=v+l,m){let e=0;for(;e=a;o-=1){let r=o-1,c=i[e.charAt(r)];if(m&&(g[r]=+!!c),w[o]=(w[o+1]<<1|1)&c,n&&(w[o]|=(_[o+1]|_[o])<<1|1|_[o+1]),w[o]&E&&(y=T(t,{errors:n,currentLocation:r,expectedLocation:d,distance:s,ignoreLocation:h}),y<=p)){if(p=y,f=r,f<=d)break;a=Math.max(1,2*d-f)}}if(T(t,{errors:n+1,currentLocation:d,expectedLocation:d,distance:s,ignoreLocation:h})>p)break;_=w}const w={isMatch:f>=0,score:Math.max(.001,y)};if(m){const e=function(e=[],t=S.minMatchCharLength){let i=[],n=-1,s=-1,o=0;for(let r=e.length;o=t&&i.push([n,s]),n=-1)}return e[o-1]&&o-n>=t&&i.push([n,o-1]),i}(g,c);e.length?a&&(w.indices=e):w.isMatch=!1}return w}function M(e){let t={};for(let i=0,n=e.length;i{this.chunks.push({pattern:e,alphabet:M(e),startIndex:t})},l=this.pattern.length;if(l>x){let e=0;const t=l%x,i=l-t;for(;e{const{isMatch:f,score:m,indices:g}=N(e,t,d,{location:n+p,distance:s,threshold:o,findAllMatches:r,minMatchCharLength:c,includeMatches:i,ignoreLocation:a});f&&(u=!0),l+=m,f&&g&&(h=[...h,...g])}));let d={isMatch:u,score:u?l/this.chunks.length:1};return u&&i&&(d.indices=h),d}}const F=[];function j(e,t){for(let i=0,n=F.length;i!(!e[P]&&!e[k]),B=e=>({[P]:Object.keys(e).map((t=>({[t]:e[t]})))});function K(e,t){const i=e.matches;t.matches=[],f(i)&&i.forEach((e=>{if(!f(e.indices)||!e.indices.length)return;const{indices:i,value:n}=e;let s={indices:i,value:n};e.key&&(s.key=e.key.src),e.idx>-1&&(s.refIndex=e.idx),t.matches.push(s)}))}function U(e,t){t.score=e.score}class q{constructor(e,t={},i){if(this.options=r(r({},S),t),this.options.useExtendedSearch)throw new Error("Extended search is not available");this._keyStore=new b(this.options.keys),this.setCollection(e,i)}setCollection(e,t){if(this._docs=e,t&&!(t instanceof A))throw new Error("Incorrect 'index' type");this._myIndex=t||L(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight})}add(e){f(e)&&(this._docs.push(e),this._myIndex.add(e))}remove(e=()=>!1){const t=[];for(let i=0,n=this._docs.length;i{let i=1;e.matches.forEach((({key:e,norm:n,score:s})=>{const o=e?e.weight:null;i*=Math.pow(0===s&&o?Number.EPSILON:s,(o||1)*(t?1:n))})),e.score=i}))}(c,{ignoreFieldNorm:r}),s&&c.sort(o),u(t)&&t>-1&&(c=c.slice(0,t)),function(e,t,{includeMatches:i=S.includeMatches,includeScore:n=S.includeScore}={}){const s=[];return i&&s.push(K),n&&s.push(U),e.map((e=>{const{idx:i}=e,n={item:t[i],refIndex:i};return s.length&&s.forEach((t=>{t(e,n)})),n}))}(c,this._docs,{includeMatches:i,includeScore:n})}_searchStringList(e){const t=j(e,this.options),{records:i}=this._myIndex,n=[];return i.forEach((({v:e,i:i,n:s})=>{if(!f(e))return;const{isMatch:o,score:r,indices:c}=t.searchIn(e);o&&n.push({item:e,idx:i,matches:[{score:r,value:e,norm:s,indices:c}]})})),n}_searchLogical(e){throw new Error("Logical search is not available")}_searchObjectList(e){const t=j(e,this.options),{keys:i,records:n}=this._myIndex,s=[];return n.forEach((({$:e,i:n})=>{if(!f(e))return;let o=[];i.forEach(((i,n)=>{o.push(...this._findMatches({key:i,value:e[n],searcher:t}))})),o.length&&s.push({idx:n,item:e,matches:o})})),s}_findMatches({key:e,value:t,searcher:i}){if(!f(t))return[];let n=[];if(c(t))t.forEach((({v:t,i:s,n:o})=>{if(!f(t))return;const{isMatch:r,score:c,indices:a}=i.searchIn(t);r&&n.push({score:c,key:e,value:t,idx:s,norm:o,indices:a})}));else{const{v:s,n:o}=t,{isMatch:r,score:c,indices:a}=i.searchIn(s);r&&n.push({score:c,key:e,value:s,norm:o,indices:a})}return n}}q.version="7.0.0",q.createIndex=L,q.parseIndex=function(e,{getFn:t=S.getFn,fieldNormWeight:i=S.fieldNormWeight}={}){const{keys:n,records:s}=e,o=new A({getFn:t,fieldNormWeight:i});return o.setKeys(n),o.setIndexRecords(s),o},q.config=S,q.parseQuery=function(e,t,{auto:i=!0}={}){const n=e=>{let s=Object.keys(e);const o=(e=>!!e[R])(e);if(!o&&s.length>1&&!V(e))return n(B(e));if((e=>!c(e)&&p(e)&&!V(e))(e)){const n=o?e[R]:s[0],r=o?e[H]:e[n];if(!l(r))throw new Error((e=>`Invalid value for key ${e}`)(n));const c={keyId:I(n),pattern:r};return i&&(c.searcher=j(r,t)),c}let r={children:[],operator:s[0]};return s.forEach((t=>{const i=e[t];c(i)&&i.forEach((e=>{r.children.push(n(e))}))})),r};return V(e)||(e=B(e)),n(e)};var G,W=function(e,t,s){return new q(t,i(i({},e.fuseOptions),{keys:n([],e.searchFields,!0),includeMatches:!0})).search(s)},$=function(e,t){return{type:"HIGHLIGHT_ITEM",item:e,highlighted:t}},X=function(e){return{type:"SET_IS_LOADING",isLoading:e}},J=function(e){return Array.from({length:e},(function(){return(e=0,t=36,Math.floor(Math.random()*(t-e)+e)).toString(36);var e,t})).join("")},z=function(e){if("string"!=typeof e){if(null==e)return"";if("object"==typeof e){if("raw"in e)return z(e.raw);if("trusted"in e)return e.trusted}return e}return e.replace(/&/g,"&").replace(/>/g,">").replace(/0?this.element.scrollTop+r-s:e.offsetTop;requestAnimationFrame((function(){i._animateScroll(c,t)}))}},e.prototype._scrollDown=function(e,t,i){var n=(i-e)/t,s=n>1?n:1;this.element.scrollTop=e+s},e.prototype._scrollUp=function(e,t,i){var n=(e-i)/t,s=n>1?n:1;this.element.scrollTop=e-s},e.prototype._animateScroll=function(e,t){var i=this,n=this.element.scrollTop,s=!1;t>0?(this._scrollDown(n,4,e),ne&&(s=!0)),s&&requestAnimationFrame((function(){i._animateScroll(e,t)}))},e}(),le=function(){function e(e){var t=e.element,i=e.classNames;this.element=t,this.classNames=i,this.isDisabled=!1}return Object.defineProperty(e.prototype,"isActive",{get:function(){return"active"===this.element.dataset.choice},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"dir",{get:function(){return this.element.dir},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"value",{get:function(){return this.element.value},set:function(e){this.element.setAttribute("value",e),this.element.value=e},enumerable:!1,configurable:!0}),e.prototype.conceal=function(){var e;(e=this.element.classList).add.apply(e,ee(this.classNames.input)),this.element.hidden=!0,this.element.tabIndex=-1;var t=this.element.getAttribute("style");t&&this.element.setAttribute("data-choice-orig-style",t),this.element.setAttribute("data-choice","active")},e.prototype.reveal=function(){var e;(e=this.element.classList).remove.apply(e,ee(this.classNames.input)),this.element.hidden=!1,this.element.removeAttribute("tabindex");var t=this.element.getAttribute("data-choice-orig-style");t?(this.element.removeAttribute("data-choice-orig-style"),this.element.setAttribute("style",t)):this.element.removeAttribute("style"),this.element.removeAttribute("data-choice"),this.element.value=this.element.value},e.prototype.enable=function(){this.element.removeAttribute("disabled"),this.element.disabled=!1,this.isDisabled=!1},e.prototype.disable=function(){this.element.setAttribute("disabled",""),this.element.disabled=!0,this.isDisabled=!0},e.prototype.triggerEvent=function(e,t){!function(e,t,i){void 0===i&&(i=null);var n=new CustomEvent(t,{detail:i,bubbles:!0,cancelable:!0});e.dispatchEvent(n)}(this.element,e,t)},e}(),ue=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return t(i,e),i}(le),de=function(e,t){return void 0===t&&(t=!0),void 0===e?t:!!e},pe=function(e){if("string"==typeof e&&(e=e.split(" ").filter((function(e){return 0!==e.length}))),Array.isArray(e)&&0!==e.length)return e},fe=function(e,t){if("string"==typeof e)return fe({value:e,label:e},!1);var i=e;if("choices"in i){if(!t)throw new TypeError("optGroup is not allowed");var n=i,s=n.choices.map((function(e){return fe(e,!1)}));return{id:0,label:Y(n.label)||n.value,active:0!==s.length,disabled:!!n.disabled,choices:s}}var o=i;return{id:0,groupId:0,score:0,value:o.value,label:o.label||o.value,active:de(o.active),selected:de(o.selected,!1),disabled:de(o.disabled,!1),placeholder:de(o.placeholder,!1),highlighted:!1,labelClass:pe(o.labelClass),labelDescription:o.labelDescription,customProperties:o.customProperties}},me=function(e){function i(t){var i=t.element,n=t.classNames,s=t.template,o=t.extractPlaceholder,r=e.call(this,{element:i,classNames:n})||this;return r.template=s,r.extractPlaceholder=o,r}return t(i,e),Object.defineProperty(i.prototype,"placeholderOption",{get:function(){return this.element.querySelector('option[value=""]')||this.element.querySelector("option[placeholder]")},enumerable:!1,configurable:!0}),i.prototype.addOptions=function(e){var t=this;e.forEach((function(e){var i=e;if(!i.element){var n=t.template(i);t.element.appendChild(n),i.element=n}}))},i.prototype.optionsAsChoices=function(){var e=this,t=[];return this.element.querySelectorAll(":scope > option, :scope > optgroup").forEach((function(i){!function(e){return"OPTION"===e.tagName}(i)?function(e){return"OPTGROUP"===e.tagName}(i)&&t.push(e._optgroupToChoice(i)):t.push(e._optionToChoice(i))})),t},i.prototype._optionToChoice=function(e){return{id:0,groupId:0,score:0,value:e.value,label:e.innerHTML,element:e,active:!0,selected:this.extractPlaceholder?e.selected:e.hasAttribute("selected"),disabled:e.disabled,highlighted:!1,placeholder:this.extractPlaceholder&&(""===e.value||e.hasAttribute("placeholder")),labelClass:void 0!==e.dataset.labelClass?pe(e.dataset.labelClass):void 0,labelDescription:void 0!==e.dataset.labelDescription?e.dataset.labelDescription:void 0,customProperties:ie(e.dataset.customProperties)}},i.prototype._optgroupToChoice=function(e){var t=this,i=e.querySelectorAll("option"),n=Array.from(i).map((function(e){return t._optionToChoice(e)}));return{id:0,label:e.label||"",element:e,active:0!==n.length,disabled:e.disabled,choices:n}},i}(le),ge={items:[],choices:[],silent:!1,renderChoiceLimit:-1,maxItemCount:-1,singleModeForMultiSelect:!1,addChoices:!1,addItems:!0,addItemFilter:function(e){return!!e&&""!==e},removeItems:!0,removeItemButton:!1,removeItemButtonAlignLeft:!1,editItems:!1,allowHTML:!1,allowHtmlUserInput:!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,sorter:function(e,t){var i=e.value,n=e.label,s=void 0===n?i:n,o=t.value,r=t.label,c=void 0===r?o:r;return Y(s).localeCompare(Y(c),[],{sensitivity:"base",ignorePunctuation:!0,numeric:!0})},shadowRoot:null,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 "'.concat(e,'"')},removeItemIconText:function(){return"Remove item"},removeItemLabelText:function(e){return"Remove item: ".concat(e)},maxItemText:function(e){return"Only ".concat(e," values can be added")},valueComparer:function(e,t){return e===t},fuseOptions:{includeScore:!0},labelId:"",callbackOnInit:null,callbackOnCreateTemplates:null,classNames:{containerOuter:["choices"],containerInner:["choices__inner"],input:["choices__input"],inputCloned:["choices__input--cloned"],list:["choices__list"],listItems:["choices__list--multiple"],listSingle:["choices__list--single"],listDropdown:["choices__list--dropdown"],item:["choices__item"],itemSelectable:["choices__item--selectable"],itemDisabled:["choices__item--disabled"],itemChoice:["choices__item--choice"],description:["choices__description"],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"],selectedState:["is-selected"],flippedState:["is-flipped"],loadingState:["is-loading"],addChoice:["choices__item","choices__item--selectable","add-choice"],noResults:["has-no-results"],noChoices:["has-no-choices"]},appendGroupInSearch:!1},ve=["fuseOptions","classNames"];function _e(e){return"Minified Redux error #"+e+"; visit https://redux.js.org/Errors?code="+e+" for the full message or use the non-minified dev environment for full errors. "}var ye="function"==typeof Symbol&&Symbol.observable||"@@observable",be=function(){return Math.random().toString(36).substring(7).split("").join(".")},Ee={INIT:"@@redux/INIT"+be(),REPLACE:"@@redux/REPLACE"+be(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+be()}};function we(e,t,i){var n;if("function"==typeof t&&"function"==typeof i||"function"==typeof i&&"function"==typeof arguments[3])throw new Error(_e(0));if("function"==typeof t&&void 0===i&&(i=t,t=void 0),void 0!==i){if("function"!=typeof i)throw new Error(_e(1));return i(we)(e,t)}if("function"!=typeof e)throw new Error(_e(2));var s=e,o=t,r=[],c=r,a=!1;function h(){c===r&&(c=r.slice())}function l(){if(a)throw new Error(_e(3));return o}function u(e){if("function"!=typeof e)throw new Error(_e(4));if(a)throw new Error(_e(5));var t=!0;return h(),c.push(e),function(){if(t){if(a)throw new Error(_e(6));t=!1,h();var i=c.indexOf(e);c.splice(i,1),r=null}}}function d(e){if(!function(e){if("object"!=typeof e||null===e)return!1;for(var t=e;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}(e))throw new Error(_e(7));if(void 0===e.type)throw new Error(_e(8));if(a)throw new Error(_e(9));try{a=!0,o=s(o,e)}finally{a=!1}for(var t=r=c,i=0;i0},e.prototype.getChoiceById=function(e){return this.activeChoices.find((function(t){return t.id===e}))},e.prototype.getGroupById=function(e){return this.groups.find((function(t){return t.id===e}))},e}(),Ae=function(e,t){return e?function(e){if("string"==typeof e)return e;if("object"==typeof e){if("escaped"in e)return e.escaped;if("trusted"in e)return e.trusted}return""}(t):z(t)},Le=function(e,t){if(t){var i=e.dataset;"string"==typeof t?i.customProperties=t:"object"!=typeof t||function(e){for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0}(t)||(i.customProperties=JSON.stringify(t))}},Te={containerOuter:function(e,t,i,n,s,o,r){var c=e.classNames.containerOuter,a=Object.assign(document.createElement("div"),{className:ee(c).join(" ")});return a.dataset.type=o,t&&(a.dir=t),n&&(a.tabIndex=0),i&&(a.setAttribute("role",s?"combobox":"listbox"),s&&a.setAttribute("aria-autocomplete","list")),a.setAttribute("aria-haspopup","true"),a.setAttribute("aria-expanded","false"),r&&a.setAttribute("aria-labelledby",r),a},containerInner:function(e){var t=e.classNames.containerInner;return Object.assign(document.createElement("div"),{className:ee(t).join(" ")})},itemList:function(e,t){var i=e.classNames,n=i.list,s=i.listSingle,o=i.listItems;return Object.assign(document.createElement("div"),{className:"".concat(ee(n).join(" ")," ").concat(t?ee(s).join(" "):ee(o).join(" "))})},placeholder:function(e,t){var i=e.allowHTML,n=e.classNames.placeholder;return Object.assign(document.createElement("div"),{className:ee(n).join(" "),innerHTML:Ae(i,t)})},item:function(e,t,i){var n,s,o,r=e.allowHTML,c=e.removeItemButtonAlignLeft,a=e.classNames,h=a.item,l=a.button,u=a.highlightedState,d=a.itemSelectable,p=a.placeholder,f=t.id,m=t.value,g=t.label,v=t.labelClass,_=t.labelDescription,y=t.customProperties,b=t.active,E=t.disabled,w=t.highlighted,I=t.placeholder,C=Object.assign(document.createElement("div"),{className:ee(h).join(" ")});if(v){var S=Object.assign(document.createElement("span"),{innerHTML:Ae(r,g),className:ee(v).join(" ")});C.appendChild(S)}else C.innerHTML=Ae(r,g);if(Object.assign(C.dataset,{item:"",id:f,value:m}),v&&(C.dataset.labelClass=ee(v).join(" ")),_&&(C.dataset.labelDescription=_),Le(C,y),b&&C.setAttribute("aria-selected","true"),E&&C.setAttribute("aria-disabled","true"),I&&((n=C.classList).add.apply(n,ee(p)),C.dataset.placeholder=""),(s=C.classList).add.apply(s,ee(w?u:d)),i){E&&(o=C.classList).remove.apply(o,ee(d)),C.dataset.deletable="";var O="function"==typeof this.config.removeItemIconText?this.config.removeItemIconText(z(m),m):this.config.removeItemIconText,A="function"==typeof this.config.removeItemLabelText?this.config.removeItemLabelText(z(m),m):this.config.removeItemLabelText,L=Object.assign(document.createElement("button"),{type:"button",className:ee(l).join(" "),innerHTML:O});L.setAttribute("aria-label",A),L.dataset.button="",c?C.insertAdjacentElement("afterbegin",L):C.appendChild(L)}return C},choiceList:function(e,t){var i=e.classNames.list,n=Object.assign(document.createElement("div"),{className:ee(i).join(" ")});return t||n.setAttribute("aria-multiselectable","true"),n.setAttribute("role","listbox"),n},choiceGroup:function(e,t){var i=e.allowHTML,n=e.classNames,s=n.group,o=n.groupHeading,r=n.itemDisabled,c=t.id,a=t.label,h=t.disabled,l=Object.assign(document.createElement("div"),{className:"".concat(ee(s).join(" ")," ").concat(h?ee(r).join(" "):"")});return l.setAttribute("role","group"),Object.assign(l.dataset,{group:"",id:c,value:a}),h&&l.setAttribute("aria-disabled","true"),l.appendChild(Object.assign(document.createElement("div"),{className:ee(o).join(" "),innerHTML:Ae(i,a)})),l},choice:function(e,t,i){var n,s,o,r,c,a=e.allowHTML,h=e.classNames,l=h.item,u=h.itemChoice,d=h.itemSelectable,p=h.selectedState,f=h.itemDisabled,m=h.description,g=h.placeholder,v=t.id,_=t.value,y=t.label,b=t.groupId,E=t.elementId,w=t.labelClass,I=t.labelDescription,C=t.disabled,S=t.selected,O=t.placeholder,A=Object.assign(document.createElement("div"),{id:E,className:"".concat(ee(l).join(" ")," ").concat(ee(u).join(" "))}),L=A;if(w){var T=Object.assign(document.createElement("span"),{innerHTML:Ae(a,y),className:ee(w).join(" ")});L=T,A.appendChild(T)}else A.innerHTML=Ae(a,y);if(I){var x="".concat(E,"-description");L.setAttribute("aria-describedby",x);var N=Object.assign(document.createElement("span"),{innerHTML:Ae(a,I),id:x});(n=N.classList).add.apply(n,ee(m)),A.appendChild(N)}return S&&(s=A.classList).add.apply(s,ee(p)),O&&(o=A.classList).add.apply(o,ee(g)),A.setAttribute("role",b&&b>0?"treeitem":"option"),Object.assign(A.dataset,{choice:"",id:v,value:_,selectText:i}),w&&(A.dataset.labelClass=ee(w).join(" ")),I&&(A.dataset.labelDescription=I),C?((r=A.classList).add.apply(r,ee(f)),A.dataset.choiceDisabled="",A.setAttribute("aria-disabled","true")):((c=A.classList).add.apply(c,ee(d)),A.dataset.choiceSelectable=""),A},input:function(e,t){var i=e.classNames,n=i.input,s=i.inputCloned,o=Object.assign(document.createElement("input"),{type:"search",className:"".concat(ee(n).join(" ")," ").concat(ee(s).join(" ")),autocomplete:"off",autocapitalize:"off",spellcheck:!1});return o.setAttribute("role","textbox"),o.setAttribute("aria-autocomplete","list"),t&&o.setAttribute("aria-label",t),o},dropdown:function(e){var t,i,n=e.classNames,s=n.list,o=n.listDropdown,r=document.createElement("div");return(t=r.classList).add.apply(t,ee(s)),(i=r.classList).add.apply(i,ee(o)),r.setAttribute("aria-expanded","false"),r},notice:function(e,t,i){var s=e.allowHTML,o=e.classNames,r=o.item,c=o.itemChoice,a=o.addChoice,h=o.noResults,l=o.noChoices;void 0===i&&(i="");var u=n(n([],ee(r),!0),ee(c),!0);switch(i){case"add-choice":u.push.apply(u,ee(a));break;case"no-results":u.push.apply(u,ee(h));break;case"no-choices":u.push.apply(u,ee(l))}var d=Object.assign(document.createElement("div"),{innerHTML:Ae(s,t),className:u.join(" ")});return"add-choice"===i&&(d.dataset.choiceSelectable="",d.dataset.choice=""),d},option:function(e){var t=e.label,i=e.value,n=e.labelClass,s=e.labelDescription,o=e.customProperties,r=e.active,c=e.disabled,a=Y(t),h=new Option(a,i,!1,r);return n&&(h.dataset.labelClass=ee(n).join(" ")),s&&(h.dataset.labelDescription=s),Le(h,o),h.disabled=c,h}},xe="-ms-scroll-limit"in document.documentElement.style&&"-ms-ime-align"in document.documentElement.style,Ne={},Me=function(e){if(e){var t=e.dataset.id;return t?parseInt(t,10):void 0}},De=function(){function e(t,n){void 0===t&&(t="[data-choice]"),void 0===n&&(n={});var s=this;this._hasNonChoicePlaceholder=!1,this._lastAddedChoiceId=0,this._lastAddedGroupId=0,this.config=i(i(i({},e.defaults.allOptions),e.defaults.options),n),ve.forEach((function(t){s.config[t]=i(i(i({},e.defaults.allOptions[t]),e.defaults.options[t]),n[t])}));var o,r,c,a,h=(o=this.config,r=ge,c=Object.keys(o).sort(),a=Object.keys(r).sort(),c.filter((function(e){return a.indexOf(e)<0})));h.length&&console.warn("Unknown config option(s) passed",h.join(", ")),!this.config.silent&&this.config.allowHTML&&this.config.allowHtmlUserInput&&(this.config.addItems&&console.warn("Warning: allowHTML/allowHtmlUserInput/addItems all being true is strongly not recommended and may lead to XSS attacks"),this.config.addChoices&&console.warn("Warning: allowHTML/allowHtmlUserInput/addChoices all being true is strongly not recommended and may lead to XSS attacks"));var l=this.config.shadowRoot||document.documentElement,u="string"==typeof t?l.querySelector(t):t;if(!u||"object"!=typeof u||"INPUT"!==u.tagName&&!function(e){return"SELECT"===e.tagName}(u)){if(!u&&"string"==typeof t)throw TypeError("Selector ".concat(t," failed to find an element"));throw TypeError("Expected one of the following types text|select-one|select-multiple")}if(this._elementType=u.type,this._isTextElement=this._elementType===se,(this._isTextElement||1!==this.config.maxItemCount)&&(this.config.singleModeForMultiSelect=!1),this.config.singleModeForMultiSelect&&(this._elementType=re),this._isSelectOneElement=this._elementType===oe,this._isSelectMultipleElement=this._elementType===re,this._isSelectElement=this._isSelectOneElement||this._isSelectMultipleElement,this._canAddUserChoices=this._isTextElement&&this.config.addItems||this._isSelectElement&&this.config.addChoices,["auto","always"].includes("".concat(this.config.renderSelectedChoices))||(this.config.renderSelectedChoices="auto"),this.config.placeholder&&(this.config.placeholderValue?this._hasNonChoicePlaceholder=!0:u.dataset.placeholder&&(this._hasNonChoicePlaceholder=!0,this.config.placeholderValue=u.dataset.placeholder)),n.addItemFilter&&"function"!=typeof n.addItemFilter){var d=n.addItemFilter instanceof RegExp?n.addItemFilter:new RegExp(n.addItemFilter);this.config.addItemFilter=d.test.bind(d)}if(this._isTextElement)this.passedElement=new ue({element:u,classNames:this.config.classNames});else{var p=u;this.passedElement=new me({element:p,classNames:this.config.classNames,template:function(e){return s._templates.option(e)},extractPlaceholder:this.config.placeholder&&!this._hasNonChoicePlaceholder})}if(this.initialised=!1,this._store=new Oe,this._initialState=Ie,this._currentState=Ie,this._prevState=Ie,this._currentValue="",this.config.searchEnabled=!this._isTextElement&&this.config.searchEnabled||this._elementType===re,this._canSearch=this.config.searchEnabled,this._isScrollingOnIe=!1,this._highlightPosition=0,this._wasTap=!0,this._placeholderValue=this._generatePlaceholderValue(),this._baseId=function(e,t){var i=e.id||e.name&&"".concat(e.name,"-").concat(J(2))||J(4);return i=i.replace(/(:|\.|\[|\]|,)/g,""),"".concat(t,"-").concat(i)}(this.passedElement.element,"choices-"),this._searchFn=W,this._direction=this.passedElement.dir,!this._direction){var f=window.getComputedStyle(this.passedElement.element).direction;f!==window.getComputedStyle(document.documentElement).direction&&(this._direction=f)}if(this._idNames={itemChoice:"item-choice"},this._render=this._render.bind(this),this._onFocus=this._onFocus.bind(this),this._onBlur=this._onBlur.bind(this),this._onKeyUp=this._onKeyUp.bind(this),this._onKeyDown=this._onKeyDown.bind(this),this._onInput=this._onInput.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._onSelectKey=this._onSelectKey.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),this.passedElement.isActive)return this.config.silent||console.warn("Trying to initialise Choices on element already initialised",{element:t}),void(this.initialised=!0);this.init(),this._initialItems=this._store.items.map((function(e){return e.value}))}return Object.defineProperty(e,"defaults",{get:function(){return Object.preventExtensions({get options(){return Ne},get allOptions(){return ge},get templates(){return Te}})},enumerable:!1,configurable:!0}),e.prototype.init=function(){if(!this.initialised){this._loadChoices(),this._createTemplates(),this._createElements(),this._createStructure(),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&&"function"==typeof e&&e.call(this)}},e.prototype.destroy=function(){this.initialised&&(this._removeEventListeners(),this.passedElement.reveal(),this.containerOuter.unwrap(this.passedElement.element),this.clearStore(),this._stopSearch(),this._templates=Te,this.initialised=!1)},e.prototype.enable=function(){return this.passedElement.isDisabled&&this.passedElement.enable(),this.containerOuter.isDisabled&&(this._addEventListeners(),this.input.enable(),this.containerOuter.enable()),this},e.prototype.disable=function(){return this.passedElement.isDisabled||this.passedElement.disable(),this.containerOuter.isDisabled||(this._removeEventListeners(),this.input.disable(),this.containerOuter.disable()),this},e.prototype.highlightItem=function(e,t){if(void 0===t&&(t=!0),!e||!e.id)return this;var i=this._store.choices.find((function(t){return t.id===e.id}));return!i||i.highlighted||(this._store.dispatch($(i,!0)),t&&this.passedElement.triggerEvent("highlightItem",this._getChoiceForOutput(i))),this},e.prototype.unhighlightItem=function(e,t){if(void 0===t&&(t=!0),!e||!e.id)return this;var i=this._store.choices.find((function(t){return t.id===e.id}));return i&&i.highlighted?(this._store.dispatch($(i,!1)),t&&this.passedElement.triggerEvent("highlightItem",this._getChoiceForOutput(i)),this):this},e.prototype.highlightAll=function(){var e=this;return this._store.withDeferRendering((function(){e._store.items.forEach((function(t){return e.highlightItem(t)}))})),this},e.prototype.unhighlightAll=function(){var e=this;return this._store.withDeferRendering((function(){e._store.items.forEach((function(t){return e.unhighlightItem(t)}))})),this},e.prototype.removeActiveItemsByValue=function(e){var t=this;return this._store.withDeferRendering((function(){t._store.items.filter((function(t){return t.value===e})).forEach((function(e){return t._removeItem(e)}))})),this},e.prototype.removeActiveItems=function(e){var t=this;return this._store.withDeferRendering((function(){t._store.items.filter((function(t){return t.id!==e})).forEach((function(e){return t._removeItem(e)}))})),this},e.prototype.removeHighlightedItems=function(e){var t=this;return void 0===e&&(e=!1),this._store.withDeferRendering((function(){t._store.highlightedActiveItems.forEach((function(i){t._removeItem(i),e&&t._triggerChange(i.value)}))})),this},e.prototype.showDropdown=function(e){var t=this;return this.dropdown.isActive||requestAnimationFrame((function(){t.dropdown.show(),t.containerOuter.open(t.dropdown.distanceFromTopWindow),!e&&t._canSearch&&t.input.focus(),t.passedElement.triggerEvent("showDropdown",{})})),this},e.prototype.hideDropdown=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("hideDropdown",{})})),this):this},e.prototype.getValue=function(e){var t=this;void 0===e&&(e=!1);var i=this._store.items.reduce((function(i,n){var s=e?n.value:t._getChoiceForOutput(n);return i.push(s),i}),[]);return this._isSelectOneElement||this.config.singleModeForMultiSelect?i[0]:i},e.prototype.setValue=function(e){var t=this;return this.initialised?(this._store.withDeferRendering((function(){e.forEach((function(e){e&&t._addChoice(fe(e,!1))}))})),this):this},e.prototype.setChoiceByValue=function(e){var t=this;return!this.initialised||this._isTextElement||this._store.withDeferRendering((function(){(Array.isArray(e)?e:[e]).forEach((function(e){return t._findAndSelectChoiceByValue(e)}))})),this},e.prototype.setChoices=function(e,t,n,s){var o=this;if(void 0===e&&(e=[]),void 0===t&&(t="value"),void 0===n&&(n="label"),void 0===s&&(s=!1),!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("string"!=typeof t||!t)throw new TypeError("value parameter must be a name of 'value' field in passed objects");if(s&&this.clearChoices(),"function"==typeof e){var r=e(this);if("function"==typeof Promise&&r instanceof Promise)return new Promise((function(e){return requestAnimationFrame(e)})).then((function(){return o._handleLoadingState(!0)})).then((function(){return r})).then((function(e){return o.setChoices(e,t,n,s)})).catch((function(e){o.config.silent||console.error(e)})).then((function(){return o._handleLoadingState(!1)})).then((function(){return o}));if(!Array.isArray(r))throw new TypeError(".setChoices first argument function must return either array of choices or Promise, got: ".concat(typeof r));return this.setChoices(r,t,n,!1)}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");return this.containerOuter.removeLoadingState(),this._store.withDeferRendering((function(){var s="value"===t,r="label"===n;e.forEach((function(e){if("choices"in e){var c=e;r||(c=i(i({},c),{label:c[n]})),o._addGroup(fe(c,!0))}else{var a=e;r&&s||(a=i(i({},a),{value:a[t],label:a[n]})),o._addChoice(fe(a,!1))}}))})),this},e.prototype.refresh=function(e,t,i){var n=this;return void 0===e&&(e=!1),void 0===t&&(t=!1),void 0===i&&(i=!1),this._isSelectElement?(this._store.withDeferRendering((function(){var s=n.passedElement.optionsAsChoices(),o=n._store.items,r={};i||o.forEach((function(e){e.id&&e.active&&e.selected&&!e.disabled&&(r[e.value]=!0)})),s.forEach((function(e){if(!("choices"in e)){var t=e;i?t.selected=!1:r[t.value]&&(t.selected=!0)}})),n.clearStore(),n._addPredefinedChoices(s,t,e),n._isSearching&&n._searchChoices(n.input.value)})),this):(this.config.silent||console.warn("refresh method can only be used on choices backed by a element"),this)},e.prototype.removeChoice=function(e){var t=this._store.choices.find((function(t){return t.value===e}));return t?(this._store.dispatch(function(e){return{type:"REMOVE_CHOICE",choice:e}}(t)),t.selected&&this.passedElement.triggerEvent("removeItem",this._getChoiceForOutput(t)),this):this},e.prototype.clearChoices=function(){return this._store.dispatch({type:"CLEAR_CHOICES"}),this},e.prototype.clearStore=function(){return this._store.dispatch({type:"CLEAR_ALL"}),this._lastAddedChoiceId=0,this._lastAddedGroupId=0,this},e.prototype.clearInput=function(){var e=!this._isSelectOneElement;return this.input.clear(e),this._isSearching&&this._stopSearch(),this},e.prototype._render=function(){if(!this._store.isLoading()){this._currentState=this._store.state;var e=this._currentState.items!==this._prevState.items;(this._currentState.choices!==this._prevState.choices||this._currentState.groups!==this._prevState.groups||e)&&(this._isSelectElement&&this._renderChoices(),e&&this._renderItems(),this._prevState=this._currentState)}},e.prototype._renderChoices=function(){var e=this,t=this._store,i=t.activeGroups,n=t.activeChoices,s=document.createDocumentFragment();if(this.choiceList.clear(),this.config.resetScrollPosition&&requestAnimationFrame((function(){return e.choiceList.scrollToTop()})),i.length>=1&&!this._isSearching){var o=n.filter((function(e){return e.placeholder&&-1===e.groupId}));o.length>=1&&(s=this._createChoicesFragment(o,s)),s=this._createGroupsFragment(i,n,s)}else n.length>=1&&(s=this._createChoicesFragment(n,s));var r=this.input.value,c=this._canAddItem(this._store.items,r);if(s.childNodes&&s.childNodes.length>0){var a=!c.response;if(c.response&&(this.choiceList.append(s),this._highlightChoice(),this._canAddUserChoices&&r&&c.notice&&(a=!n.find((function(t){return e.config.valueComparer(t.value,r)})))),a){var h=this._templates.notice(this.config,c.notice,this._canAddUserChoices?"add-choice":"");this.choiceList.prepend(h)}}else{var l=void 0;if(c.response&&this._canAddUserChoices&&r)l=this._templates.notice(this.config,c.notice,"add-choice");else if(this._isSearching){h="function"==typeof this.config.noResultsText?this.config.noResultsText():this.config.noResultsText;l=this._templates.notice(this.config,h,"no-results")}else{h="function"==typeof this.config.noChoicesText?this.config.noChoicesText():this.config.noChoicesText;l=this._templates.notice(this.config,h,"no-choices")}this.choiceList.append(l)}},e.prototype._renderItems=function(){var e=this._store.items||[];this.itemList.clear();var t=this._createItemsFragment(e);t.childNodes&&this.itemList.append(t)},e.prototype._createGroupsFragment=function(e,t,i){var n=this;void 0===i&&(i=document.createDocumentFragment());this.config.shouldSort&&e.sort(this.config.sorter);var s=t.filter((function(e){return 0===e.groupId}));return s.length>0&&this._createChoicesFragment(s,i,!1),e.forEach((function(e){var s=function(e){return t.filter((function(t){return n._isSelectOneElement?t.groupId===e.id:t.groupId===e.id&&("always"===n.config.renderSelectedChoices||!t.selected)}))}(e);if(s.length>=1){var o=n._templates.choiceGroup(n.config,e);i.appendChild(o),n._createChoicesFragment(s,i,!0)}})),i},e.prototype._createChoicesFragment=function(e,t,i){var s=this;void 0===t&&(t=document.createDocumentFragment()),void 0===i&&(i=!1);var o=this.config,r=o.renderSelectedChoices,c=o.searchResultLimit,a=o.renderChoiceLimit,h=o.appendGroupInSearch,l=this._isSearching?Z:this.config.sorter,u=function(e){if("auto"!==r||(s._isSelectOneElement||!e.selected)){var i=s._templates.choice(s.config,e,s.config.itemSelectText);if(h){var n="";s._store.groups.every((function(t){return t.id!==e.groupId||(n=t.label,!1)})),n&&s._isSearching&&(i.innerHTML+=" (".concat(n,")"))}t.appendChild(i)}},d=e;if("auto"!==r||this._isSelectOneElement||(d=e.filter((function(e){return!e.selected}))),this._isSelectElement){var p=e.filter((function(e){return!e.element}));0!==p.length&&this.passedElement.addOptions(p)}var f=d.reduce((function(e,t){return t.placeholder?e.placeholderChoices.push(t):e.normalChoices.push(t),e}),{placeholderChoices:[],normalChoices:[]}),m=f.placeholderChoices,g=f.normalChoices;(this.config.shouldSort||this._isSearching)&&g.sort(l);var v=d.length,_=this._isSelectOneElement?n(n([],m,!0),g,!0):g;this._isSearching?v=c:a&&a>0&&!i&&(v=a);for(var y=0;y0?this._store.getGroupById(e.groupId):null;return{id:e.id,highlighted:e.highlighted,labelClass:e.labelClass,labelDescription:e.labelDescription,customProperties:e.customProperties,disabled:e.disabled,active:e.active,label:e.label,placeholder:e.placeholder,value:e.value,groupValue:i&&i.label?i.label:void 0,element:e.element,keyCode:t}}},e.prototype._triggerChange=function(e){null!=e&&this.passedElement.triggerEvent("change",{value:e})},e.prototype._selectPlaceholderChoice=function(e){this._addItem(e),e.value&&this._triggerChange(e.value)},e.prototype._handleButtonAction=function(e,t){if(0!==e.length&&this.config.removeItems&&this.config.removeItemButton){var i=t&&Me(t.parentNode),n=i&&e.find((function(e){return e.id===i}));if(n&&(this._removeItem(n),this._triggerChange(n.value),this._isSelectOneElement&&!this._hasNonChoicePlaceholder)){var s=this._store.placeholderChoice;s&&this._selectPlaceholderChoice(s)}}},e.prototype._handleItemAction=function(e,t,i){var n=this;if(void 0===i&&(i=!1),0!==e.length&&this.config.removeItems&&!this._isSelectOneElement){var s=Me(t);s&&(e.forEach((function(e){e.id!==s||e.highlighted?!i&&e.highlighted&&n.unhighlightItem(e):n.highlightItem(e)})),this.input.focus())}},e.prototype._handleChoiceAction=function(e,t,i){var n=this,s=Me(t),o=s&&this._store.getChoiceById(s);if(!o)return!1;var r=this.dropdown.isActive,c=!1;return this._store.withDeferRendering((function(){if(!o.selected&&!o.disabled&&n._canAddItem(e,o.value).response){if(n.config.singleModeForMultiSelect&&0!==e.length){var t=e[e.length-1];n._removeItem(t)}n.passedElement.triggerEvent("choice",n._getChoiceForOutput(o,i)),n._addItem(o),n.clearInput(),c=!0}})),!!c&&(this._triggerChange(o.value),r&&(this.config.singleModeForMultiSelect||this._isSelectOneElement)&&(this.hideDropdown(!0),this.containerOuter.focus()),!0)},e.prototype._handleBackspace=function(e){if(this.config.removeItems&&0!==e.length){var t=e[e.length-1],i=e.some((function(e){return e.highlighted}));this.config.editItems&&!i&&t?(this.input.value=t.value,this.input.setWidth(),this._removeItem(t),this._triggerChange(t.value)):(i||this.highlightItem(t,!1),this.removeHighlightedItems(!0))}},e.prototype._loadChoices=function(){var e;if(this._isTextElement){this._presetItems=this.config.items.map((function(e){return fe(e,!1)}));var t=this.passedElement.value;if(t){var i=t.split(this.config.delimiter).map((function(e){return fe(e,!1)}));this._presetItems=this._presetItems.concat(i)}this._presetItems.forEach((function(e){e.selected=!0}))}else if(this._isSelectElement){this._presetChoices=this.config.choices.map((function(e){return fe(e,!0)}));var n=this.passedElement.optionsAsChoices();n&&(e=this._presetChoices).push.apply(e,n)}},e.prototype._startLoading=function(){this._store.startDeferRendering()},e.prototype._stopLoading=function(){this._store.stopDeferRendering()},e.prototype._handleLoadingState=function(e){void 0===e&&(e=!0);var t=this.itemList.element.querySelector(te(this.config.classNames.placeholder));e?(this.disable(),this.containerOuter.addLoadingState(),this._isSelectOneElement?t?t.innerHTML=this.config.loadingText:(t=this._templates.placeholder(this.config,this.config.loadingText))&&this.itemList.append(t):this.input.placeholder=this.config.loadingText):(this.enable(),this.containerOuter.removeLoadingState(),this._isSelectOneElement?t&&(t.innerHTML=this._placeholderValue||""):this.input.placeholder=this._placeholderValue||"")},e.prototype._handleSearch=function(e){if(this.input.isFocussed){var t=this._store.choices,i=this.config,n=i.searchFloor,s=i.searchChoices,o=t.some((function(e){return!e.active}));if(null!=e&&e.length>=n){var r=s?this._searchChoices(e):0;null!==r&&this.passedElement.triggerEvent("search",{value:e,resultCount:r})}else o&&this._stopSearch()}},e.prototype._canAddItem=function(e,t){var i=this,n=!0,s="";(this.config.maxItemCount>0&&this.config.maxItemCount<=e.length&&(this.config.singleModeForMultiSelect||(n=!1,s="function"==typeof this.config.maxItemText?this.config.maxItemText(this.config.maxItemCount):this.config.maxItemText)),n&&this._canAddUserChoices&&""!==t&&"function"==typeof this.config.addItemFilter&&!this.config.addItemFilter(t)&&(n=!1,s="function"==typeof this.config.customAddItemText?this.config.customAddItemText(z(t),t):this.config.customAddItemText),!n||""===t||!this._isSelectElement&&this.config.duplicateItemsAllowed)||this._store.items.find((function(e){return i.config.valueComparer(e.value,t)}))&&(n=!1,s="function"==typeof this.config.uniqueItemText?this.config.uniqueItemText(z(t),t):this.config.uniqueItemText);return n&&(s="function"==typeof this.config.addItemText?this.config.addItemText(z(t),t):this.config.addItemText),{response:n,notice:{trusted:s}}},e.prototype._searchChoices=function(e){var t=e.trim().replace(/\s{2,}/," ");if(0===t.length||t===this._currentValue)return null;var i=this._store.searchableChoices,n=this._searchFn(this.config,i,t);return this._currentValue=t,this._highlightPosition=0,this._isSearching=!0,this._store.dispatch(function(e){return{type:"FILTER_CHOICES",results:e}}(n)),n.length},e.prototype._stopSearch=function(){var e=this._isSearching;this._currentValue="",this._isSearching=!1,e&&this._store.dispatch({type:"ACTIVATE_CHOICES",active:!0})},e.prototype._addEventListeners=function(){var e=this.config.shadowRoot||document.documentElement;e.addEventListener("touchend",this._onTouchEnd,!0),this.containerOuter.element.addEventListener("keydown",this._onKeyDown,!0),this.containerOuter.element.addEventListener("mousedown",this._onMouseDown,!0),e.addEventListener("click",this._onClick,{passive:!0}),e.addEventListener("touchmove",this._onTouchMove,{passive:!0}),this.dropdown.element.addEventListener("mouseover",this._onMouseOver,{passive:!0}),this._isSelectOneElement&&(this.containerOuter.element.addEventListener("focus",this._onFocus,{passive:!0}),this.containerOuter.element.addEventListener("blur",this._onBlur,{passive:!0})),this.input.element.addEventListener("keyup",this._onKeyUp,{passive:!0}),this.input.element.addEventListener("input",this._onInput,{passive:!0}),this.input.element.addEventListener("focus",this._onFocus,{passive:!0}),this.input.element.addEventListener("blur",this._onBlur,{passive:!0}),this.input.element.form&&this.input.element.form.addEventListener("reset",this._onFormReset,{passive:!0}),this.input.addEventListeners()},e.prototype._removeEventListeners=function(){var e=this.config.shadowRoot||document.documentElement;e.removeEventListener("touchend",this._onTouchEnd,!0),this.containerOuter.element.removeEventListener("keydown",this._onKeyDown,!0),this.containerOuter.element.removeEventListener("mousedown",this._onMouseDown,!0),e.removeEventListener("click",this._onClick),e.removeEventListener("touchmove",this._onTouchMove),this.dropdown.element.removeEventListener("mouseover",this._onMouseOver),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("input",this._onInput),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()},e.prototype._onKeyDown=function(e){var t=e.keyCode,i=this._store.items,n=this.input.isFocussed,s=this.dropdown.isActive,o=this.itemList.hasChildren(),r=1===e.key.length||2===e.key.length&&e.key.charCodeAt(0)>=55296||"Unidentified"===e.key;switch(this._isTextElement||s||(this.showDropdown(),!this.input.isFocussed&&r&&(this.input.value+=e.key)),t){case 65:return this._onSelectKey(e,o);case 13:return this._onEnterKey(e,i,s);case 27:return this._onEscapeKey(e,s);case 38:case 33:case 40:case 34:return this._onDirectionKey(e,s);case 8:case 46:return this._onDeleteKey(e,i,n)}},e.prototype._onKeyUp=function(){this._canSearch=this.config.searchEnabled},e.prototype._onInput=function(){var e=this.input.value;if(e){if(this._isTextElement){var t=this._canAddItem(this._store.items,e);t.notice&&(this._displayAddItemNotice(t),this.showDropdown(!0))}if(this._canSearch){this._handleSearch(e);var i=this._canAddItem(this._store.items,e);i.response||this._displayAddItemNotice(i),this._canAddUserChoices&&(this._highlightPosition=0,this._highlightChoice())}}else this._isTextElement?this.hideDropdown(!0):this._stopSearch()},e.prototype._displayAddItemNotice=function(e){var t=this._templates.notice(this.config,e.notice,"add-choice"),i="".concat(te(this.config.classNames.addChoice),"[data-choice-selectable]"),n=this.choiceList.element.querySelector(i);n?n.outerHTML=t.outerHTML:this.choiceList.prepend(t)},e.prototype._onSelectKey=function(e,t){var i=e.ctrlKey,n=e.metaKey;(i||n)&&t&&(this._canSearch=!1,this.config.removeItems&&!this.input.value&&this.input.element===document.activeElement&&this.highlightAll())},e.prototype._onEnterKey=function(e,t,i){var n=this,s=this.input.value,o=e.target;if(o&&o.hasAttribute("data-button"))return e.preventDefault(),void this._handleButtonAction(t,o);if(!i&&this._isSelectOneElement)return e.preventDefault(),void this.showDropdown();if(i){var r=this.dropdown.element.querySelector(te(this.config.classNames.highlightedState));if(r&&this._handleChoiceAction(t,r,13))return e.preventDefault(),void this.unhighlightAll();s||this.hideDropdown(!0)}o&&s&&this._canAddUserChoices&&(this._canAddItem(t,s).response&&(this._store.withDeferRendering((function(){if((n._isSelectOneElement||n.config.singleModeForMultiSelect)&&0!==t.length){var e=t[t.length-1];n._removeItem(e)}var i=!0;if(!n._isSelectElement&&n.config.duplicateItemsAllowed||(i=!n._findAndSelectChoiceByValue(s)),i){var o=z(s),r=n.config.allowHtmlUserInput||o===s?s:{escaped:o,raw:s};n._addChoice(fe({value:r,label:r,selected:!0},!1))}n.clearInput(),n.unhighlightAll(),n._triggerChange(s)})),(this._isTextElement||this._isSelectOneElement)&&this.hideDropdown(!0)))},e.prototype._onEscapeKey=function(e,t){t&&(e.stopPropagation(),this.hideDropdown(!0),this.containerOuter.focus())},e.prototype._onDirectionKey=function(e,t){var i,n,s,o=e.keyCode,r=e.metaKey;if(t||this._isSelectOneElement){this.showDropdown(),this._canSearch=!1;var c=40===o||34===o?1:-1,a="[data-choice-selectable]",h=void 0;if(r||34===o||33===o)h=c>0?this.dropdown.element.querySelector("".concat(a,":last-of-type")):this.dropdown.element.querySelector(a);else{var l=this.dropdown.element.querySelector(te(this.config.classNames.highlightedState));h=l?function(e,t,i){void 0===i&&(i=1);for(var n="".concat(i>0?"next":"previous","ElementSibling"),s=e[n];s;){if(s.matches(t))return s;s=s[n]}return s}(l,a,c):this.dropdown.element.querySelector(a)}h&&(i=h,n=this.choiceList.element,void 0===(s=c)&&(s=1),i&&(s>0?n.scrollTop+n.offsetHeight>=i.offsetTop+i.offsetHeight:i.offsetTop>=n.scrollTop)||this.choiceList.scrollToChildElement(h,c),this._highlightChoice(h)),e.preventDefault()}},e.prototype._onDeleteKey=function(e,t,i){var n=e.target;this._isSelectOneElement||n.value||!i||(this._handleBackspace(t),e.preventDefault())},e.prototype._onTouchMove=function(){this._wasTap&&(this._wasTap=!1)},e.prototype._onTouchEnd=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},e.prototype._onMouseDown=function(e){var t=e.target;if(t instanceof HTMLElement){if(xe&&this.choiceList.element.contains(t)){var i=this.choiceList.element.firstElementChild;this._isScrollingOnIe="ltr"===this._direction?e.offsetX>=i.offsetWidth:e.offsetX0&&this.unhighlightAll(),this.containerOuter.removeFocusState(),this.hideDropdown(!0))},e.prototype._onFocus=function(e){var t,i=this,n=e.target;n&&this.containerOuter.element.contains(n)&&((t={})[se]=function(){n===i.input.element&&i.containerOuter.addFocusState()},t[oe]=function(){i.containerOuter.addFocusState(),n===i.input.element&&i.showDropdown(!0)},t[re]=function(){n===i.input.element&&(i.showDropdown(!0),i.containerOuter.addFocusState())},t)[this._elementType]()},e.prototype._onBlur=function(e){var t,i=this,n=e.target;if(n&&this.containerOuter.element.contains(n)&&!this._isScrollingOnIe){var s=this._store.activeChoices.some((function(e){return e.highlighted}));((t={})[se]=function(){n===i.input.element&&(i.containerOuter.removeFocusState(),s&&i.unhighlightAll(),i.hideDropdown(!0))},t[oe]=function(){i.containerOuter.removeFocusState(),(n===i.input.element||n===i.containerOuter.element&&!i._canSearch)&&i.hideDropdown(!0)},t[re]=function(){n===i.input.element&&(i.containerOuter.removeFocusState(),i.hideDropdown(!0),s&&i.unhighlightAll())},t)[this._elementType]()}else this._isScrollingOnIe=!1,this.input.element.focus()},e.prototype._onFormReset=function(){var e=this;this._store.withDeferRendering((function(){e.clearInput(),e.hideDropdown(),e.refresh(!1,!1,!0),0!==e._initialItems.length&&e.setChoiceByValue(e._initialItems)}))},e.prototype._highlightChoice=function(e){var t,i=this;void 0===e&&(e=null);var n=Array.from(this.dropdown.element.querySelectorAll("[data-choice-selectable]"));if(n.length){var s=e;Array.from(this.dropdown.element.querySelectorAll(te(this.config.classNames.highlightedState))).forEach((function(e){var t;(t=e.classList).remove.apply(t,ee(i.config.classNames.highlightedState)),e.setAttribute("aria-selected","false")})),s?this._highlightPosition=n.indexOf(s):(s=n.length>this._highlightPosition?n[this._highlightPosition]:n[n.length-1])||(s=n[0]),(t=s.classList).add.apply(t,ee(this.config.classNames.highlightedState)),s.setAttribute("aria-selected","true"),this.passedElement.triggerEvent("highlightChoice",{el:s}),this.dropdown.isActive&&(this.input.setActiveDescendant(s.id),this.containerOuter.setActiveDescendant(s.id))}},e.prototype._addItem=function(e,t){void 0===t&&(t=!0);var i=e.id;if(0===i)throw new TypeError("item.id must be set before _addItem is called for a choice/item");this._store.dispatch(function(e){return{type:"ADD_ITEM",item:e}}(e)),this._isSelectOneElement&&this.removeActiveItems(i),t&&this.passedElement.triggerEvent("addItem",this._getChoiceForOutput(e))},e.prototype._removeItem=function(e){e.id&&(this._store.dispatch(function(e){return{type:"REMOVE_ITEM",item:e}}(e)),this.passedElement.triggerEvent("removeItem",this._getChoiceForOutput(e)))},e.prototype._addChoice=function(e,t){if(void 0===t&&(t=!0),0!==e.id)throw new TypeError("Can not re-add a choice which has already been added");var i=e;this._lastAddedChoiceId++,i.id=this._lastAddedChoiceId,i.elementId="".concat(this._baseId,"-").concat(this._idNames.itemChoice,"-").concat(i.id),this.config.prependValue&&(i.value=this.config.prependValue+i.value),this.config.appendValue&&(i.value+=this.config.appendValue.toString()),(this.config.prependValue||this.config.appendValue)&&i.element&&(i.element.value=i.value),this._store.dispatch(function(e){return{type:"ADD_CHOICE",choice:e}}(e)),e.selected&&this._addItem(e,t)},e.prototype._addGroup=function(e,t){var i=this;if(void 0===t&&(t=!0),0!==e.id)throw new TypeError("Can not re-add a group which has already been added");if(this._store.dispatch(function(e){return{type:"ADD_GROUP",group:e}}(e)),e.choices){var n=e;this._lastAddedGroupId++,n.id=this._lastAddedGroupId;var s=e.id,o=e.choices;n.choices=[],o.forEach((function(n){var o=n;o.groupId=s,e.disabled&&(o.disabled=!0),i._addChoice(o,t)}))}},e.prototype._getTemplate=function(e){for(var t,i=[],s=1;s`Missing ${e} property in key`,_=e=>`Property 'weight' in key '${e}' must be a positive integer`,y=Object.prototype.hasOwnProperty;class b{constructor(e){this._keys=[],this._keyMap={};let t=0;e.forEach((e=>{let i=E(e);this._keys.push(i),this._keyMap[i.id]=i,t+=i.weight})),this._keys.forEach((e=>{e.weight/=t}))}get(e){return this._keyMap[e]}keys(){return this._keys}toJSON(){return JSON.stringify(this._keys)}}function E(e){let t=null,i=null,n=null,s=1,o=null;if(l(e)||c(e))n=e,t=w(e),i=I(e);else{if(!y.call(e,"name"))throw new Error(v("name"));const r=e.name;if(n=r,y.call(e,"weight")&&(s=e.weight,s<=0))throw new Error(_(r));t=w(r),i=I(r),o=e.getFn}return{path:t,id:i,weight:s,src:n,getFn:o}}function w(e){return c(e)?e:e.split(".")}function I(e){return c(e)?e.join("."):e}const C={useExtendedSearch:!1,getFn:function(e,t){let i=[],n=!1;const s=(e,t,o)=>{if(f(e))if(t[o]){const r=e[t[o]];if(!f(r))return;if(o===t.length-1&&(l(r)||u(r)||d(r)))i.push(h(r));else if(c(r)){n=!0;for(let e=0,i=r.length;ee.score===t.score?e.idx{this._keysMap[e.id]=t}))}create(){!this.isCreated&&this.docs.length&&(this.isCreated=!0,l(this.docs[0])?this.docs.forEach(((e,t)=>{this._addString(e,t)})):this.docs.forEach(((e,t)=>{this._addObject(e,t)})),this.norm.clear())}add(e){const t=this.size();l(e)?this._addString(e,t):this._addObject(e,t)}removeAt(e){this.records.splice(e,1);for(let t=e,i=this.size();t{let s=t.getFn?t.getFn(e):this.getFn(e,t.path);if(f(s))if(c(s)){let e=[];const t=[{nestedArrIndex:-1,value:s}];for(;t.length;){const{nestedArrIndex:i,value:n}=t.pop();if(f(n))if(l(n)&&!m(n)){let t={v:n,i:i,n:this.norm.get(n)};e.push(t)}else c(n)&&n.forEach(((e,i)=>{t.push({nestedArrIndex:i,value:e})}))}i.$[n]=e}else if(l(s)&&!m(s)){let e={v:s,n:this.norm.get(s)};i.$[n]=e}})),this.records.push(i)}toJSON(){return{keys:this.keys,records:this.records}}}function L(e,t,{getFn:i=S.getFn,fieldNormWeight:n=S.fieldNormWeight}={}){const s=new A({getFn:i,fieldNormWeight:n});return s.setKeys(e.map(E)),s.setSources(t),s.create(),s}function T(e,{errors:t=0,currentLocation:i=0,expectedLocation:n=0,distance:s=S.distance,ignoreLocation:o=S.ignoreLocation}={}){const r=t/e.length;if(o)return r;const c=Math.abs(n-i);return s?r+c/s:c?1:r}const x=32;function N(e,t,i,{location:n=S.location,distance:s=S.distance,threshold:o=S.threshold,findAllMatches:r=S.findAllMatches,minMatchCharLength:c=S.minMatchCharLength,includeMatches:a=S.includeMatches,ignoreLocation:h=S.ignoreLocation}={}){if(t.length>x)throw new Error(`Pattern length exceeds max of ${x}.`);const l=t.length,u=e.length,d=Math.max(0,Math.min(n,u));let p=o,f=d;const m=c>1||a,g=m?Array(u):[];let v;for(;(v=e.indexOf(t,f))>-1;){let e=T(t,{currentLocation:v,expectedLocation:d,distance:s,ignoreLocation:h});if(p=Math.min(e,p),f=v+l,m){let e=0;for(;e=a;o-=1){let r=o-1,c=i[e.charAt(r)];if(m&&(g[r]=+!!c),w[o]=(w[o+1]<<1|1)&c,n&&(w[o]|=(_[o+1]|_[o])<<1|1|_[o+1]),w[o]&E&&(y=T(t,{errors:n,currentLocation:r,expectedLocation:d,distance:s,ignoreLocation:h}),y<=p)){if(p=y,f=r,f<=d)break;a=Math.max(1,2*d-f)}}if(T(t,{errors:n+1,currentLocation:d,expectedLocation:d,distance:s,ignoreLocation:h})>p)break;_=w}const w={isMatch:f>=0,score:Math.max(.001,y)};if(m){const e=function(e=[],t=S.minMatchCharLength){let i=[],n=-1,s=-1,o=0;for(let r=e.length;o=t&&i.push([n,s]),n=-1)}return e[o-1]&&o-n>=t&&i.push([n,o-1]),i}(g,c);e.length?a&&(w.indices=e):w.isMatch=!1}return w}function M(e){let t={};for(let i=0,n=e.length;i{this.chunks.push({pattern:e,alphabet:M(e),startIndex:t})},l=this.pattern.length;if(l>x){let e=0;const t=l%x,i=l-t;for(;e{const{isMatch:f,score:m,indices:g}=N(e,t,d,{location:n+p,distance:s,threshold:o,findAllMatches:r,minMatchCharLength:c,includeMatches:i,ignoreLocation:a});f&&(u=!0),l+=m,f&&g&&(h=[...h,...g])}));let d={isMatch:u,score:u?l/this.chunks.length:1};return u&&i&&(d.indices=h),d}}const F=[];function j(e,t){for(let i=0,n=F.length;i!(!e[P]&&!e[k]),B=e=>({[P]:Object.keys(e).map((t=>({[t]:e[t]})))});function K(e,t){const i=e.matches;t.matches=[],f(i)&&i.forEach((e=>{if(!f(e.indices)||!e.indices.length)return;const{indices:i,value:n}=e;let s={indices:i,value:n};e.key&&(s.key=e.key.src),e.idx>-1&&(s.refIndex=e.idx),t.matches.push(s)}))}function U(e,t){t.score=e.score}class q{constructor(e,t={},i){if(this.options=r(r({},S),t),this.options.useExtendedSearch)throw new Error("Extended search is not available");this._keyStore=new b(this.options.keys),this.setCollection(e,i)}setCollection(e,t){if(this._docs=e,t&&!(t instanceof A))throw new Error("Incorrect 'index' type");this._myIndex=t||L(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight})}add(e){f(e)&&(this._docs.push(e),this._myIndex.add(e))}remove(e=()=>!1){const t=[];for(let i=0,n=this._docs.length;i{let i=1;e.matches.forEach((({key:e,norm:n,score:s})=>{const o=e?e.weight:null;i*=Math.pow(0===s&&o?Number.EPSILON:s,(o||1)*(t?1:n))})),e.score=i}))}(c,{ignoreFieldNorm:r}),s&&c.sort(o),u(t)&&t>-1&&(c=c.slice(0,t)),function(e,t,{includeMatches:i=S.includeMatches,includeScore:n=S.includeScore}={}){const s=[];return i&&s.push(K),n&&s.push(U),e.map((e=>{const{idx:i}=e,n={item:t[i],refIndex:i};return s.length&&s.forEach((t=>{t(e,n)})),n}))}(c,this._docs,{includeMatches:i,includeScore:n})}_searchStringList(e){const t=j(e,this.options),{records:i}=this._myIndex,n=[];return i.forEach((({v:e,i:i,n:s})=>{if(!f(e))return;const{isMatch:o,score:r,indices:c}=t.searchIn(e);o&&n.push({item:e,idx:i,matches:[{score:r,value:e,norm:s,indices:c}]})})),n}_searchLogical(e){throw new Error("Logical search is not available")}_searchObjectList(e){const t=j(e,this.options),{keys:i,records:n}=this._myIndex,s=[];return n.forEach((({$:e,i:n})=>{if(!f(e))return;let o=[];i.forEach(((i,n)=>{o.push(...this._findMatches({key:i,value:e[n],searcher:t}))})),o.length&&s.push({idx:n,item:e,matches:o})})),s}_findMatches({key:e,value:t,searcher:i}){if(!f(t))return[];let n=[];if(c(t))t.forEach((({v:t,i:s,n:o})=>{if(!f(t))return;const{isMatch:r,score:c,indices:a}=i.searchIn(t);r&&n.push({score:c,key:e,value:t,idx:s,norm:o,indices:a})}));else{const{v:s,n:o}=t,{isMatch:r,score:c,indices:a}=i.searchIn(s);r&&n.push({score:c,key:e,value:s,norm:o,indices:a})}return n}}q.version="7.0.0",q.createIndex=L,q.parseIndex=function(e,{getFn:t=S.getFn,fieldNormWeight:i=S.fieldNormWeight}={}){const{keys:n,records:s}=e,o=new A({getFn:t,fieldNormWeight:i});return o.setKeys(n),o.setIndexRecords(s),o},q.config=S,q.parseQuery=function(e,t,{auto:i=!0}={}){const n=e=>{let s=Object.keys(e);const o=(e=>!!e[R])(e);if(!o&&s.length>1&&!V(e))return n(B(e));if((e=>!c(e)&&p(e)&&!V(e))(e)){const n=o?e[R]:s[0],r=o?e[H]:e[n];if(!l(r))throw new Error((e=>`Invalid value for key ${e}`)(n));const c={keyId:I(n),pattern:r};return i&&(c.searcher=j(r,t)),c}let r={children:[],operator:s[0]};return s.forEach((t=>{const i=e[t];c(i)&&i.forEach((e=>{r.children.push(n(e))}))})),r};return V(e)||(e=B(e)),n(e)};var G,W=function(e,t,s){return new q(t,i(i({},e.fuseOptions),{keys:n([],e.searchFields,!0),includeMatches:!0})).search(s)},$=function(e,t){return{type:"HIGHLIGHT_ITEM",item:e,highlighted:t}},X=function(e){return{type:"SET_IS_LOADING",isLoading:e}},J=function(e){return Array.from({length:e},(function(){return(e=0,t=36,Math.floor(Math.random()*(t-e)+e)).toString(36);var e,t})).join("")},z=function(e){if("string"!=typeof e){if(null==e)return"";if("object"==typeof e){if("raw"in e)return z(e.raw);if("trusted"in e)return e.trusted}return e}return e.replace(/&/g,"&").replace(/>/g,">").replace(/0?this.element.scrollTop+r-s:e.offsetTop;requestAnimationFrame((function(){i._animateScroll(c,t)}))}},e.prototype._scrollDown=function(e,t,i){var n=(i-e)/t,s=n>1?n:1;this.element.scrollTop=e+s},e.prototype._scrollUp=function(e,t,i){var n=(e-i)/t,s=n>1?n:1;this.element.scrollTop=e-s},e.prototype._animateScroll=function(e,t){var i=this,n=this.element.scrollTop,s=!1;t>0?(this._scrollDown(n,4,e),ne&&(s=!0)),s&&requestAnimationFrame((function(){i._animateScroll(e,t)}))},e}(),le=function(){function e(e){var t=e.element,i=e.classNames;this.element=t,this.classNames=i,this.isDisabled=!1}return Object.defineProperty(e.prototype,"isActive",{get:function(){return"active"===this.element.dataset.choice},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"dir",{get:function(){return this.element.dir},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"value",{get:function(){return this.element.value},set:function(e){this.element.setAttribute("value",e),this.element.value=e},enumerable:!1,configurable:!0}),e.prototype.conceal=function(){var e;(e=this.element.classList).add.apply(e,ee(this.classNames.input)),this.element.hidden=!0,this.element.tabIndex=-1;var t=this.element.getAttribute("style");t&&this.element.setAttribute("data-choice-orig-style",t),this.element.setAttribute("data-choice","active")},e.prototype.reveal=function(){var e;(e=this.element.classList).remove.apply(e,ee(this.classNames.input)),this.element.hidden=!1,this.element.removeAttribute("tabindex");var t=this.element.getAttribute("data-choice-orig-style");t?(this.element.removeAttribute("data-choice-orig-style"),this.element.setAttribute("style",t)):this.element.removeAttribute("style"),this.element.removeAttribute("data-choice"),this.element.value=this.element.value},e.prototype.enable=function(){this.element.removeAttribute("disabled"),this.element.disabled=!1,this.isDisabled=!1},e.prototype.disable=function(){this.element.setAttribute("disabled",""),this.element.disabled=!0,this.isDisabled=!0},e.prototype.triggerEvent=function(e,t){!function(e,t,i){void 0===i&&(i=null);var n=new CustomEvent(t,{detail:i,bubbles:!0,cancelable:!0});e.dispatchEvent(n)}(this.element,e,t)},e}(),ue=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return t(i,e),i}(le),de=function(e,t){return void 0===t&&(t=!0),void 0===e?t:!!e},pe=function(e){if("string"==typeof e&&(e=e.split(" ").filter((function(e){return 0!==e.length}))),Array.isArray(e)&&0!==e.length)return e},fe=function(e,t){if("string"==typeof e)return fe({value:e,label:e},!1);var i=e;if("choices"in i){if(!t)throw new TypeError("optGroup is not allowed");var n=i,s=n.choices.map((function(e){return fe(e,!1)}));return{id:0,label:Y(n.label)||n.value,active:0!==s.length,disabled:!!n.disabled,choices:s}}var o=i;return{id:0,groupId:0,score:0,value:o.value,label:o.label||o.value,active:de(o.active),selected:de(o.selected,!1),disabled:de(o.disabled,!1),placeholder:de(o.placeholder,!1),highlighted:!1,labelClass:pe(o.labelClass),labelDescription:o.labelDescription,customProperties:o.customProperties}},me=function(e){function i(t){var i=t.element,n=t.classNames,s=t.template,o=t.extractPlaceholder,r=e.call(this,{element:i,classNames:n})||this;return r.template=s,r.extractPlaceholder=o,r}return t(i,e),Object.defineProperty(i.prototype,"placeholderOption",{get:function(){return this.element.querySelector('option[value=""]')||this.element.querySelector("option[placeholder]")},enumerable:!1,configurable:!0}),i.prototype.addOptions=function(e){var t=this;e.forEach((function(e){var i=e;if(!i.element){var n=t.template(i);t.element.appendChild(n),i.element=n}}))},i.prototype.optionsAsChoices=function(){var e=this,t=[];return this.element.querySelectorAll(":scope > option, :scope > optgroup").forEach((function(i){!function(e){return"OPTION"===e.tagName}(i)?function(e){return"OPTGROUP"===e.tagName}(i)&&t.push(e._optgroupToChoice(i)):t.push(e._optionToChoice(i))})),t},i.prototype._optionToChoice=function(e){return{id:0,groupId:0,score:0,value:e.value,label:e.innerHTML,element:e,active:!0,selected:this.extractPlaceholder?e.selected:e.hasAttribute("selected"),disabled:e.disabled,highlighted:!1,placeholder:this.extractPlaceholder&&(""===e.value||e.hasAttribute("placeholder")),labelClass:void 0!==e.dataset.labelClass?pe(e.dataset.labelClass):void 0,labelDescription:void 0!==e.dataset.labelDescription?e.dataset.labelDescription:void 0,customProperties:ie(e.dataset.customProperties)}},i.prototype._optgroupToChoice=function(e){var t=this,i=e.querySelectorAll("option"),n=Array.from(i).map((function(e){return t._optionToChoice(e)}));return{id:0,label:e.label||"",element:e,active:0!==n.length,disabled:e.disabled,choices:n}},i}(le),ge={items:[],choices:[],silent:!1,renderChoiceLimit:-1,maxItemCount:-1,singleModeForMultiSelect:!1,addChoices:!1,addItems:!0,addItemFilter:function(e){return!!e&&""!==e},removeItems:!0,removeItemButton:!1,removeItemButtonAlignLeft:!1,editItems:!1,allowHTML:!1,allowHtmlUserInput:!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,sorter:function(e,t){var i=e.value,n=e.label,s=void 0===n?i:n,o=t.value,r=t.label,c=void 0===r?o:r;return Y(s).localeCompare(Y(c),[],{sensitivity:"base",ignorePunctuation:!0,numeric:!0})},shadowRoot:null,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 "'.concat(e,'"')},removeItemIconText:function(){return"Remove item"},removeItemLabelText:function(e){return"Remove item: ".concat(e)},maxItemText:function(e){return"Only ".concat(e," values can be added")},valueComparer:function(e,t){return e===t},fuseOptions:{includeScore:!0},labelId:"",callbackOnInit:null,callbackOnCreateTemplates:null,classNames:{containerOuter:["choices"],containerInner:["choices__inner"],input:["choices__input"],inputCloned:["choices__input--cloned"],list:["choices__list"],listItems:["choices__list--multiple"],listSingle:["choices__list--single"],listDropdown:["choices__list--dropdown"],item:["choices__item"],itemSelectable:["choices__item--selectable"],itemDisabled:["choices__item--disabled"],itemChoice:["choices__item--choice"],description:["choices__description"],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"],selectedState:["is-selected"],flippedState:["is-flipped"],loadingState:["is-loading"],addChoice:["choices__item","choices__item--selectable","add-choice"],noResults:["has-no-results"],noChoices:["has-no-choices"]},appendGroupInSearch:!1},ve=["fuseOptions","classNames"];function _e(e){return"Minified Redux error #"+e+"; visit https://redux.js.org/Errors?code="+e+" for the full message or use the non-minified dev environment for full errors. "}var ye="function"==typeof Symbol&&Symbol.observable||"@@observable",be=function(){return Math.random().toString(36).substring(7).split("").join(".")},Ee={INIT:"@@redux/INIT"+be(),REPLACE:"@@redux/REPLACE"+be(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+be()}};function we(e,t,i){var n;if("function"==typeof t&&"function"==typeof i||"function"==typeof i&&"function"==typeof arguments[3])throw new Error(_e(0));if("function"==typeof t&&void 0===i&&(i=t,t=void 0),void 0!==i){if("function"!=typeof i)throw new Error(_e(1));return i(we)(e,t)}if("function"!=typeof e)throw new Error(_e(2));var s=e,o=t,r=[],c=r,a=!1;function h(){c===r&&(c=r.slice())}function l(){if(a)throw new Error(_e(3));return o}function u(e){if("function"!=typeof e)throw new Error(_e(4));if(a)throw new Error(_e(5));var t=!0;return h(),c.push(e),function(){if(t){if(a)throw new Error(_e(6));t=!1,h();var i=c.indexOf(e);c.splice(i,1),r=null}}}function d(e){if(!function(e){if("object"!=typeof e||null===e)return!1;for(var t=e;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}(e))throw new Error(_e(7));if(void 0===e.type)throw new Error(_e(8));if(a)throw new Error(_e(9));try{a=!0,o=s(o,e)}finally{a=!1}for(var t=r=c,i=0;i0},e.prototype.getChoiceById=function(e){return this.activeChoices.find((function(t){return t.id===e}))},e.prototype.getGroupById=function(e){return this.groups.find((function(t){return t.id===e}))},e}(),Ae=function(e,t){return e?function(e){if("string"==typeof e)return e;if("object"==typeof e){if("escaped"in e)return e.escaped;if("trusted"in e)return e.trusted}return""}(t):z(t)},Le=function(e,t){if(t){var i=e.dataset;"string"==typeof t?i.customProperties=t:"object"!=typeof t||function(e){for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0}(t)||(i.customProperties=JSON.stringify(t))}},Te={containerOuter:function(e,t,i,n,s,o,r){var c=e.classNames.containerOuter,a=Object.assign(document.createElement("div"),{className:ee(c).join(" ")});return a.dataset.type=o,t&&(a.dir=t),n&&(a.tabIndex=0),i&&(a.setAttribute("role",s?"combobox":"listbox"),s&&a.setAttribute("aria-autocomplete","list")),a.setAttribute("aria-haspopup","true"),a.setAttribute("aria-expanded","false"),r&&a.setAttribute("aria-labelledby",r),a},containerInner:function(e){var t=e.classNames.containerInner;return Object.assign(document.createElement("div"),{className:ee(t).join(" ")})},itemList:function(e,t){var i=e.classNames,n=i.list,s=i.listSingle,o=i.listItems;return Object.assign(document.createElement("div"),{className:"".concat(ee(n).join(" ")," ").concat(t?ee(s).join(" "):ee(o).join(" "))})},placeholder:function(e,t){var i=e.allowHTML,n=e.classNames.placeholder;return Object.assign(document.createElement("div"),{className:ee(n).join(" "),innerHTML:Ae(i,t)})},item:function(e,t,i){var n,s,o,r=e.allowHTML,c=e.removeItemButtonAlignLeft,a=e.classNames,h=a.item,l=a.button,u=a.highlightedState,d=a.itemSelectable,p=a.placeholder,f=t.id,m=t.value,g=t.label,v=t.labelClass,_=t.labelDescription,y=t.customProperties,b=t.active,E=t.disabled,w=t.highlighted,I=t.placeholder,C=Object.assign(document.createElement("div"),{className:ee(h).join(" ")});if(v){var S=Object.assign(document.createElement("span"),{innerHTML:Ae(r,g),className:ee(v).join(" ")});C.appendChild(S)}else C.innerHTML=Ae(r,g);if(Object.assign(C.dataset,{item:"",id:f,value:m}),v&&(C.dataset.labelClass=ee(v).join(" ")),_&&(C.dataset.labelDescription=_),Le(C,y),b&&C.setAttribute("aria-selected","true"),E&&C.setAttribute("aria-disabled","true"),I&&((n=C.classList).add.apply(n,ee(p)),C.dataset.placeholder=""),(s=C.classList).add.apply(s,ee(w?u:d)),i){E&&(o=C.classList).remove.apply(o,ee(d)),C.dataset.deletable="";var O="function"==typeof this.config.removeItemIconText?this.config.removeItemIconText(z(m),m):this.config.removeItemIconText,A="function"==typeof this.config.removeItemLabelText?this.config.removeItemLabelText(z(m),m):this.config.removeItemLabelText,L=Object.assign(document.createElement("button"),{type:"button",className:ee(l).join(" "),innerHTML:O});L.setAttribute("aria-label",A),L.dataset.button="",c?C.insertAdjacentElement("afterbegin",L):C.appendChild(L)}return C},choiceList:function(e,t){var i=e.classNames.list,n=Object.assign(document.createElement("div"),{className:ee(i).join(" ")});return t||n.setAttribute("aria-multiselectable","true"),n.setAttribute("role","listbox"),n},choiceGroup:function(e,t){var i=e.allowHTML,n=e.classNames,s=n.group,o=n.groupHeading,r=n.itemDisabled,c=t.id,a=t.label,h=t.disabled,l=Object.assign(document.createElement("div"),{className:"".concat(ee(s).join(" ")," ").concat(h?ee(r).join(" "):"")});return l.setAttribute("role","group"),Object.assign(l.dataset,{group:"",id:c,value:a}),h&&l.setAttribute("aria-disabled","true"),l.appendChild(Object.assign(document.createElement("div"),{className:ee(o).join(" "),innerHTML:Ae(i,a)})),l},choice:function(e,t,i){var n,s,o,r,c,a=e.allowHTML,h=e.classNames,l=h.item,u=h.itemChoice,d=h.itemSelectable,p=h.selectedState,f=h.itemDisabled,m=h.description,g=h.placeholder,v=t.id,_=t.value,y=t.label,b=t.groupId,E=t.elementId,w=t.labelClass,I=t.labelDescription,C=t.disabled,S=t.selected,O=t.placeholder,A=Object.assign(document.createElement("div"),{id:E,className:"".concat(ee(l).join(" ")," ").concat(ee(u).join(" "))}),L=A;if(w){var T=Object.assign(document.createElement("span"),{innerHTML:Ae(a,y),className:ee(w).join(" ")});L=T,A.appendChild(T)}else A.innerHTML=Ae(a,y);if(I){var x="".concat(E,"-description");L.setAttribute("aria-describedby",x);var N=Object.assign(document.createElement("span"),{innerHTML:Ae(a,I),id:x});(n=N.classList).add.apply(n,ee(m)),A.appendChild(N)}return S&&(s=A.classList).add.apply(s,ee(p)),O&&(o=A.classList).add.apply(o,ee(g)),A.setAttribute("role",b&&b>0?"treeitem":"option"),Object.assign(A.dataset,{choice:"",id:v,value:_,selectText:i}),w&&(A.dataset.labelClass=ee(w).join(" ")),I&&(A.dataset.labelDescription=I),C?((r=A.classList).add.apply(r,ee(f)),A.dataset.choiceDisabled="",A.setAttribute("aria-disabled","true")):((c=A.classList).add.apply(c,ee(d)),A.dataset.choiceSelectable=""),A},input:function(e,t){var i=e.classNames,n=i.input,s=i.inputCloned,o=Object.assign(document.createElement("input"),{type:"search",className:"".concat(ee(n).join(" ")," ").concat(ee(s).join(" ")),autocomplete:"off",autocapitalize:"off",spellcheck:!1});return o.setAttribute("role","textbox"),o.setAttribute("aria-autocomplete","list"),t&&o.setAttribute("aria-label",t),o},dropdown:function(e){var t,i,n=e.classNames,s=n.list,o=n.listDropdown,r=document.createElement("div");return(t=r.classList).add.apply(t,ee(s)),(i=r.classList).add.apply(i,ee(o)),r.setAttribute("aria-expanded","false"),r},notice:function(e,t,i){var s=e.allowHTML,o=e.classNames,r=o.item,c=o.itemChoice,a=o.addChoice,h=o.noResults,l=o.noChoices;void 0===i&&(i="");var u=n(n([],ee(r),!0),ee(c),!0);switch(i){case"add-choice":u.push.apply(u,ee(a));break;case"no-results":u.push.apply(u,ee(h));break;case"no-choices":u.push.apply(u,ee(l))}var d=Object.assign(document.createElement("div"),{innerHTML:Ae(s,t),className:u.join(" ")});return"add-choice"===i&&(d.dataset.choiceSelectable="",d.dataset.choice=""),d},option:function(e){var t=e.label,i=e.value,n=e.labelClass,s=e.labelDescription,o=e.customProperties,r=e.active,c=e.disabled,a=Y(t),h=new Option(a,i,!1,r);return n&&(h.dataset.labelClass=ee(n).join(" ")),s&&(h.dataset.labelDescription=s),Le(h,o),h.disabled=c,h}},xe="-ms-scroll-limit"in document.documentElement.style&&"-ms-ime-align"in document.documentElement.style,Ne={},Me=function(e){if(e){var t=e.dataset.id;return t?parseInt(t,10):void 0}},De=function(){function e(t,n){void 0===t&&(t="[data-choice]"),void 0===n&&(n={});var s=this;this._hasNonChoicePlaceholder=!1,this._lastAddedChoiceId=0,this._lastAddedGroupId=0,this.config=i(i(i({},e.defaults.allOptions),e.defaults.options),n),ve.forEach((function(t){s.config[t]=i(i(i({},e.defaults.allOptions[t]),e.defaults.options[t]),n[t])}));var o,r,c,a,h=(o=this.config,r=ge,c=Object.keys(o).sort(),a=Object.keys(r).sort(),c.filter((function(e){return a.indexOf(e)<0})));h.length&&console.warn("Unknown config option(s) passed",h.join(", ")),!this.config.silent&&this.config.allowHTML&&this.config.allowHtmlUserInput&&(this.config.addItems&&console.warn("Warning: allowHTML/allowHtmlUserInput/addItems all being true is strongly not recommended and may lead to XSS attacks"),this.config.addChoices&&console.warn("Warning: allowHTML/allowHtmlUserInput/addChoices all being true is strongly not recommended and may lead to XSS attacks"));var l=this.config.shadowRoot||document.documentElement,u="string"==typeof t?l.querySelector(t):t;if(!u||"object"!=typeof u||"INPUT"!==u.tagName&&!function(e){return"SELECT"===e.tagName}(u)){if(!u&&"string"==typeof t)throw TypeError("Selector ".concat(t," failed to find an element"));throw TypeError("Expected one of the following types text|select-one|select-multiple")}if(this._elementType=u.type,this._isTextElement=this._elementType===se,(this._isTextElement||1!==this.config.maxItemCount)&&(this.config.singleModeForMultiSelect=!1),this.config.singleModeForMultiSelect&&(this._elementType=re),this._isSelectOneElement=this._elementType===oe,this._isSelectMultipleElement=this._elementType===re,this._isSelectElement=this._isSelectOneElement||this._isSelectMultipleElement,this._canAddUserChoices=this._isTextElement&&this.config.addItems||this._isSelectElement&&this.config.addChoices,["auto","always"].includes("".concat(this.config.renderSelectedChoices))||(this.config.renderSelectedChoices="auto"),this.config.placeholder&&(this.config.placeholderValue?this._hasNonChoicePlaceholder=!0:u.dataset.placeholder&&(this._hasNonChoicePlaceholder=!0,this.config.placeholderValue=u.dataset.placeholder)),n.addItemFilter&&"function"!=typeof n.addItemFilter){var d=n.addItemFilter instanceof RegExp?n.addItemFilter:new RegExp(n.addItemFilter);this.config.addItemFilter=d.test.bind(d)}if(this._isTextElement)this.passedElement=new ue({element:u,classNames:this.config.classNames});else{var p=u;this.passedElement=new me({element:p,classNames:this.config.classNames,template:function(e){return s._templates.option(e)},extractPlaceholder:this.config.placeholder&&!this._hasNonChoicePlaceholder})}if(this.initialised=!1,this._store=new Oe,this._initialState=Ie,this._currentState=Ie,this._prevState=Ie,this._currentValue="",this.config.searchEnabled=!this._isTextElement&&this.config.searchEnabled||this._elementType===re,this._canSearch=this.config.searchEnabled,this._isScrollingOnIe=!1,this._highlightPosition=0,this._wasTap=!0,this._placeholderValue=this._generatePlaceholderValue(),this._baseId=function(e,t){var i=e.id||e.name&&"".concat(e.name,"-").concat(J(2))||J(4);return i=i.replace(/(:|\.|\[|\]|,)/g,""),"".concat(t,"-").concat(i)}(this.passedElement.element,"choices-"),this._searchFn=W,this._direction=this.passedElement.dir,!this._direction){var f=window.getComputedStyle(this.passedElement.element).direction;f!==window.getComputedStyle(document.documentElement).direction&&(this._direction=f)}if(this._idNames={itemChoice:"item-choice"},this._render=this._render.bind(this),this._onFocus=this._onFocus.bind(this),this._onBlur=this._onBlur.bind(this),this._onKeyUp=this._onKeyUp.bind(this),this._onKeyDown=this._onKeyDown.bind(this),this._onInput=this._onInput.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._onSelectKey=this._onSelectKey.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),this.passedElement.isActive)return this.config.silent||console.warn("Trying to initialise Choices on element already initialised",{element:t}),void(this.initialised=!0);this.init(),this._initialItems=this._store.items.map((function(e){return e.value}))}return Object.defineProperty(e,"defaults",{get:function(){return Object.preventExtensions({get options(){return Ne},get allOptions(){return ge},get templates(){return Te}})},enumerable:!1,configurable:!0}),e.prototype.init=function(){if(!this.initialised){this._loadChoices(),this._createTemplates(),this._createElements(),this._createStructure(),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&&"function"==typeof e&&e.call(this)}},e.prototype.destroy=function(){this.initialised&&(this._removeEventListeners(),this.passedElement.reveal(),this.containerOuter.unwrap(this.passedElement.element),this.clearStore(),this._stopSearch(),this._templates=Te,this.initialised=!1)},e.prototype.enable=function(){return this.passedElement.isDisabled&&this.passedElement.enable(),this.containerOuter.isDisabled&&(this._addEventListeners(),this.input.enable(),this.containerOuter.enable()),this},e.prototype.disable=function(){return this.passedElement.isDisabled||this.passedElement.disable(),this.containerOuter.isDisabled||(this._removeEventListeners(),this.input.disable(),this.containerOuter.disable()),this},e.prototype.highlightItem=function(e,t){if(void 0===t&&(t=!0),!e||!e.id)return this;var i=this._store.choices.find((function(t){return t.id===e.id}));return!i||i.highlighted||(this._store.dispatch($(i,!0)),t&&this.passedElement.triggerEvent("highlightItem",this._getChoiceForOutput(i))),this},e.prototype.unhighlightItem=function(e,t){if(void 0===t&&(t=!0),!e||!e.id)return this;var i=this._store.choices.find((function(t){return t.id===e.id}));return i&&i.highlighted?(this._store.dispatch($(i,!1)),t&&this.passedElement.triggerEvent("highlightItem",this._getChoiceForOutput(i)),this):this},e.prototype.highlightAll=function(){var e=this;return this._store.withDeferRendering((function(){e._store.items.forEach((function(t){return e.highlightItem(t)}))})),this},e.prototype.unhighlightAll=function(){var e=this;return this._store.withDeferRendering((function(){e._store.items.forEach((function(t){return e.unhighlightItem(t)}))})),this},e.prototype.removeActiveItemsByValue=function(e){var t=this;return this._store.withDeferRendering((function(){t._store.items.filter((function(t){return t.value===e})).forEach((function(e){return t._removeItem(e)}))})),this},e.prototype.removeActiveItems=function(e){var t=this;return this._store.withDeferRendering((function(){t._store.items.filter((function(t){return t.id!==e})).forEach((function(e){return t._removeItem(e)}))})),this},e.prototype.removeHighlightedItems=function(e){var t=this;return void 0===e&&(e=!1),this._store.withDeferRendering((function(){t._store.highlightedActiveItems.forEach((function(i){t._removeItem(i),e&&t._triggerChange(i.value)}))})),this},e.prototype.showDropdown=function(e){var t=this;return this.dropdown.isActive||requestAnimationFrame((function(){t.dropdown.show(),t.containerOuter.open(t.dropdown.distanceFromTopWindow),!e&&t._canSearch&&t.input.focus(),t.passedElement.triggerEvent("showDropdown",{})})),this},e.prototype.hideDropdown=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("hideDropdown",{})})),this):this},e.prototype.getValue=function(e){var t=this;void 0===e&&(e=!1);var i=this._store.items.reduce((function(i,n){var s=e?n.value:t._getChoiceForOutput(n);return i.push(s),i}),[]);return this._isSelectOneElement||this.config.singleModeForMultiSelect?i[0]:i},e.prototype.setValue=function(e){var t=this;return this.initialised?(this._store.withDeferRendering((function(){e.forEach((function(e){e&&t._addChoice(fe(e,!1))}))})),this):this},e.prototype.setChoiceByValue=function(e){var t=this;return!this.initialised||this._isTextElement||this._store.withDeferRendering((function(){(Array.isArray(e)?e:[e]).forEach((function(e){return t._findAndSelectChoiceByValue(e)}))})),this},e.prototype.setChoices=function(e,t,n,s){var o=this;if(void 0===e&&(e=[]),void 0===t&&(t="value"),void 0===n&&(n="label"),void 0===s&&(s=!1),!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("string"!=typeof t||!t)throw new TypeError("value parameter must be a name of 'value' field in passed objects");if(s&&this.clearChoices(),"function"==typeof e){var r=e(this);if("function"==typeof Promise&&r instanceof Promise)return new Promise((function(e){return requestAnimationFrame(e)})).then((function(){return o._handleLoadingState(!0)})).then((function(){return r})).then((function(e){return o.setChoices(e,t,n,s)})).catch((function(e){o.config.silent||console.error(e)})).then((function(){return o._handleLoadingState(!1)})).then((function(){return o}));if(!Array.isArray(r))throw new TypeError(".setChoices first argument function must return either array of choices or Promise, got: ".concat(typeof r));return this.setChoices(r,t,n,!1)}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");return this.containerOuter.removeLoadingState(),this._store.withDeferRendering((function(){var s="value"===t,r="label"===n;e.forEach((function(e){if("choices"in e){var c=e;r||(c=i(i({},c),{label:c[n]})),o._addGroup(fe(c,!0))}else{var a=e;r&&s||(a=i(i({},a),{value:a[t],label:a[n]})),o._addChoice(fe(a,!1))}}))})),this},e.prototype.refresh=function(e,t,i){var n=this;return void 0===e&&(e=!1),void 0===t&&(t=!1),void 0===i&&(i=!1),this._isSelectElement?(this._store.withDeferRendering((function(){var s=n.passedElement.optionsAsChoices(),o=n._store.items,r={};i||o.forEach((function(e){e.id&&e.active&&e.selected&&!e.disabled&&(r[e.value]=!0)})),s.forEach((function(e){if(!("choices"in e)){var t=e;i?t.selected=!1:r[t.value]&&(t.selected=!0)}})),n.clearStore(),n._addPredefinedChoices(s,t,e),n._isSearching&&n._searchChoices(n.input.value)})),this):(this.config.silent||console.warn("refresh method can only be used on choices backed by a element"),this)},e.prototype.removeChoice=function(e){var t=this._store.choices.find((function(t){return t.value===e}));return t?(this._store.dispatch(function(e){return{type:"REMOVE_CHOICE",choice:e}}(t)),t.selected&&this.passedElement.triggerEvent("removeItem",this._getChoiceForOutput(t)),this):this},e.prototype.clearChoices=function(){return this._store.dispatch({type:"CLEAR_CHOICES"}),this},e.prototype.clearStore=function(){return this._store.dispatch({type:"CLEAR_ALL"}),this._lastAddedChoiceId=0,this._lastAddedGroupId=0,this},e.prototype.clearInput=function(){var e=!this._isSelectOneElement;return this.input.clear(e),this._isSearching&&this._stopSearch(),this},e.prototype._render=function(){if(!this._store.isLoading()){this._currentState=this._store.state;var e=this._currentState.items!==this._prevState.items;(this._currentState.choices!==this._prevState.choices||this._currentState.groups!==this._prevState.groups||e)&&(this._isSelectElement&&this._renderChoices(),e&&this._renderItems(),this._prevState=this._currentState)}},e.prototype._renderChoices=function(){var e=this,t=this._store,i=t.activeGroups,n=t.activeChoices,s=document.createDocumentFragment();if(this.choiceList.clear(),this.config.resetScrollPosition&&requestAnimationFrame((function(){return e.choiceList.scrollToTop()})),i.length>=1&&!this._isSearching){var o=n.filter((function(e){return e.placeholder&&-1===e.groupId}));o.length>=1&&(s=this._createChoicesFragment(o,s)),s=this._createGroupsFragment(i,n,s)}else n.length>=1&&(s=this._createChoicesFragment(n,s));var r=this.input.value,c=this._canAddItem(this._store.items,r);if(s.childNodes&&s.childNodes.length>0){var a=!c.response;if(c.response&&(this.choiceList.append(s),this._highlightChoice(),this._canAddUserChoices&&r&&c.notice&&(a=!n.find((function(t){return e.config.valueComparer(t.value,r)})))),a){var h=this._templates.notice(this.config,c.notice,this._canAddUserChoices?"add-choice":"");this.choiceList.prepend(h)}}else{var l=void 0;if(c.response&&this._canAddUserChoices&&r)l=this._templates.notice(this.config,c.notice,"add-choice");else if(this._isSearching){h="function"==typeof this.config.noResultsText?this.config.noResultsText():this.config.noResultsText;l=this._templates.notice(this.config,h,"no-results")}else{h="function"==typeof this.config.noChoicesText?this.config.noChoicesText():this.config.noChoicesText;l=this._templates.notice(this.config,h,"no-choices")}this.choiceList.append(l)}},e.prototype._renderItems=function(){var e=this._store.items||[];this.itemList.clear();var t=this._createItemsFragment(e);t.childNodes&&this.itemList.append(t)},e.prototype._createGroupsFragment=function(e,t,i){var n=this;void 0===i&&(i=document.createDocumentFragment());this.config.shouldSort&&e.sort(this.config.sorter);var s=t.filter((function(e){return 0===e.groupId}));return s.length>0&&this._createChoicesFragment(s,i,!1),e.forEach((function(e){var s=function(e){return t.filter((function(t){return n._isSelectOneElement?t.groupId===e.id:t.groupId===e.id&&("always"===n.config.renderSelectedChoices||!t.selected)}))}(e);if(s.length>=1){var o=n._templates.choiceGroup(n.config,e);i.appendChild(o),n._createChoicesFragment(s,i,!0)}})),i},e.prototype._createChoicesFragment=function(e,t,i){var s=this;void 0===t&&(t=document.createDocumentFragment()),void 0===i&&(i=!1);var o=this.config,r=o.renderSelectedChoices,c=o.searchResultLimit,a=o.renderChoiceLimit,h=o.appendGroupInSearch,l=this._isSearching?Z:this.config.sorter,u=function(e){if("auto"!==r||(s._isSelectOneElement||!e.selected)){var i=s._templates.choice(s.config,e,s.config.itemSelectText);if(h){var n="";s._store.groups.every((function(t){return t.id!==e.groupId||(n=t.label,!1)})),n&&s._isSearching&&(i.innerHTML+=" (".concat(n,")"))}t.appendChild(i)}},d=e;if("auto"!==r||this._isSelectOneElement||(d=e.filter((function(e){return!e.selected}))),this._isSelectElement){var p=e.filter((function(e){return!e.element}));0!==p.length&&this.passedElement.addOptions(p)}var f=d.reduce((function(e,t){return t.placeholder?e.placeholderChoices.push(t):e.normalChoices.push(t),e}),{placeholderChoices:[],normalChoices:[]}),m=f.placeholderChoices,g=f.normalChoices;(this.config.shouldSort||this._isSearching)&&g.sort(l);var v=d.length,_=this._isSelectOneElement?n(n([],m,!0),g,!0):g;this._isSearching?v=c:a&&a>0&&!i&&(v=a);for(var y=0;y0?this._store.getGroupById(e.groupId):null;return{id:e.id,highlighted:e.highlighted,labelClass:e.labelClass,labelDescription:e.labelDescription,customProperties:e.customProperties,disabled:e.disabled,active:e.active,label:e.label,placeholder:e.placeholder,value:e.value,groupValue:i&&i.label?i.label:void 0,element:e.element,keyCode:t}}},e.prototype._triggerChange=function(e){null!=e&&this.passedElement.triggerEvent("change",{value:e})},e.prototype._selectPlaceholderChoice=function(e){this._addItem(e),e.value&&this._triggerChange(e.value)},e.prototype._handleButtonAction=function(e,t){if(0!==e.length&&this.config.removeItems&&this.config.removeItemButton){var i=t&&Me(t.parentNode),n=i&&e.find((function(e){return e.id===i}));if(n&&(this._removeItem(n),this._triggerChange(n.value),this._isSelectOneElement&&!this._hasNonChoicePlaceholder)){var s=this._store.placeholderChoice;s&&this._selectPlaceholderChoice(s)}}},e.prototype._handleItemAction=function(e,t,i){var n=this;if(void 0===i&&(i=!1),0!==e.length&&this.config.removeItems&&!this._isSelectOneElement){var s=Me(t);s&&(e.forEach((function(e){e.id!==s||e.highlighted?!i&&e.highlighted&&n.unhighlightItem(e):n.highlightItem(e)})),this.input.focus())}},e.prototype._handleChoiceAction=function(e,t,i){var n=this,s=Me(t),o=s&&this._store.getChoiceById(s);if(!o)return!1;var r=this.dropdown.isActive,c=!1;return this._store.withDeferRendering((function(){if(!o.selected&&!o.disabled&&n._canAddItem(e,o.value).response){if(n.config.singleModeForMultiSelect&&0!==e.length){var t=e[e.length-1];n._removeItem(t)}n.passedElement.triggerEvent("choice",n._getChoiceForOutput(o,i)),n._addItem(o),n.clearInput(),c=!0}})),!!c&&(this._triggerChange(o.value),r&&(this.config.singleModeForMultiSelect||this._isSelectOneElement)&&(this.hideDropdown(!0),this.containerOuter.focus()),!0)},e.prototype._handleBackspace=function(e){if(this.config.removeItems&&0!==e.length){var t=e[e.length-1],i=e.some((function(e){return e.highlighted}));this.config.editItems&&!i&&t?(this.input.value=t.value,this.input.setWidth(),this._removeItem(t),this._triggerChange(t.value)):(i||this.highlightItem(t,!1),this.removeHighlightedItems(!0))}},e.prototype._loadChoices=function(){var e;if(this._isTextElement){this._presetItems=this.config.items.map((function(e){return fe(e,!1)}));var t=this.passedElement.value;if(t){var i=t.split(this.config.delimiter).map((function(e){return fe(e,!1)}));this._presetItems=this._presetItems.concat(i)}this._presetItems.forEach((function(e){e.selected=!0}))}else if(this._isSelectElement){this._presetChoices=this.config.choices.map((function(e){return fe(e,!0)}));var n=this.passedElement.optionsAsChoices();n&&(e=this._presetChoices).push.apply(e,n)}},e.prototype._startLoading=function(){this._store.startDeferRendering()},e.prototype._stopLoading=function(){this._store.stopDeferRendering()},e.prototype._handleLoadingState=function(e){void 0===e&&(e=!0);var t=this.itemList.element.querySelector(te(this.config.classNames.placeholder));e?(this.disable(),this.containerOuter.addLoadingState(),this._isSelectOneElement?t?t.innerHTML=this.config.loadingText:(t=this._templates.placeholder(this.config,this.config.loadingText))&&this.itemList.append(t):this.input.placeholder=this.config.loadingText):(this.enable(),this.containerOuter.removeLoadingState(),this._isSelectOneElement?t&&(t.innerHTML=this._placeholderValue||""):this.input.placeholder=this._placeholderValue||"")},e.prototype._handleSearch=function(e){if(this.input.isFocussed){var t=this._store.choices,i=this.config,n=i.searchFloor,s=i.searchChoices,o=t.some((function(e){return!e.active}));if(null!=e&&e.length>=n){var r=s?this._searchChoices(e):0;null!==r&&this.passedElement.triggerEvent("search",{value:e,resultCount:r})}else o&&this._stopSearch()}},e.prototype._canAddItem=function(e,t){var i=this,n=!0,s="";(this.config.maxItemCount>0&&this.config.maxItemCount<=e.length&&(this.config.singleModeForMultiSelect||(n=!1,s="function"==typeof this.config.maxItemText?this.config.maxItemText(this.config.maxItemCount):this.config.maxItemText)),n&&this._canAddUserChoices&&""!==t&&"function"==typeof this.config.addItemFilter&&!this.config.addItemFilter(t)&&(n=!1,s="function"==typeof this.config.customAddItemText?this.config.customAddItemText(z(t),t):this.config.customAddItemText),!n||""===t||!this._isSelectElement&&this.config.duplicateItemsAllowed)||this._store.items.find((function(e){return i.config.valueComparer(e.value,t)}))&&(n=!1,s="function"==typeof this.config.uniqueItemText?this.config.uniqueItemText(z(t),t):this.config.uniqueItemText);return n&&(s="function"==typeof this.config.addItemText?this.config.addItemText(z(t),t):this.config.addItemText),{response:n,notice:{trusted:s}}},e.prototype._searchChoices=function(e){var t=e.trim().replace(/\s{2,}/," ");if(0===t.length||t===this._currentValue)return null;var i=this._store.searchableChoices,n=this._searchFn(this.config,i,t);return this._currentValue=t,this._highlightPosition=0,this._isSearching=!0,this._store.dispatch(function(e){return{type:"FILTER_CHOICES",results:e}}(n)),n.length},e.prototype._stopSearch=function(){var e=this._isSearching;this._currentValue="",this._isSearching=!1,e&&this._store.dispatch({type:"ACTIVATE_CHOICES",active:!0})},e.prototype._addEventListeners=function(){var e=this.config.shadowRoot||document.documentElement;e.addEventListener("touchend",this._onTouchEnd,!0),this.containerOuter.element.addEventListener("keydown",this._onKeyDown,!0),this.containerOuter.element.addEventListener("mousedown",this._onMouseDown,!0),e.addEventListener("click",this._onClick,{passive:!0}),e.addEventListener("touchmove",this._onTouchMove,{passive:!0}),this.dropdown.element.addEventListener("mouseover",this._onMouseOver,{passive:!0}),this._isSelectOneElement&&(this.containerOuter.element.addEventListener("focus",this._onFocus,{passive:!0}),this.containerOuter.element.addEventListener("blur",this._onBlur,{passive:!0})),this.input.element.addEventListener("keyup",this._onKeyUp,{passive:!0}),this.input.element.addEventListener("input",this._onInput,{passive:!0}),this.input.element.addEventListener("focus",this._onFocus,{passive:!0}),this.input.element.addEventListener("blur",this._onBlur,{passive:!0}),this.input.element.form&&this.input.element.form.addEventListener("reset",this._onFormReset,{passive:!0}),this.input.addEventListeners()},e.prototype._removeEventListeners=function(){var e=this.config.shadowRoot||document.documentElement;e.removeEventListener("touchend",this._onTouchEnd,!0),this.containerOuter.element.removeEventListener("keydown",this._onKeyDown,!0),this.containerOuter.element.removeEventListener("mousedown",this._onMouseDown,!0),e.removeEventListener("click",this._onClick),e.removeEventListener("touchmove",this._onTouchMove),this.dropdown.element.removeEventListener("mouseover",this._onMouseOver),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("input",this._onInput),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()},e.prototype._onKeyDown=function(e){var t=e.keyCode,i=this._store.items,n=this.input.isFocussed,s=this.dropdown.isActive,o=this.itemList.hasChildren(),r=1===e.key.length||2===e.key.length&&e.key.charCodeAt(0)>=55296||"Unidentified"===e.key;switch(this._isTextElement||s||(this.showDropdown(),!this.input.isFocussed&&r&&(this.input.value+=e.key)),t){case 65:return this._onSelectKey(e,o);case 13:return this._onEnterKey(e,i,s);case 27:return this._onEscapeKey(e,s);case 38:case 33:case 40:case 34:return this._onDirectionKey(e,s);case 8:case 46:return this._onDeleteKey(e,i,n)}},e.prototype._onKeyUp=function(){this._canSearch=this.config.searchEnabled},e.prototype._onInput=function(){var e=this.input.value;if(e){if(this._isTextElement){var t=this._canAddItem(this._store.items,e);t.notice&&(this._displayAddItemNotice(t),this.showDropdown(!0))}if(this._canSearch){this._handleSearch(e);var i=this._canAddItem(this._store.items,e);i.response||this._displayAddItemNotice(i),this._canAddUserChoices&&(this._highlightPosition=0,this._highlightChoice())}}else this._isTextElement?this.hideDropdown(!0):this._stopSearch()},e.prototype._displayAddItemNotice=function(e){var t=this._templates.notice(this.config,e.notice,"add-choice"),i="".concat(te(this.config.classNames.addChoice),"[data-choice-selectable]"),n=this.choiceList.element.querySelector(i);n?n.outerHTML=t.outerHTML:this.choiceList.prepend(t)},e.prototype._onSelectKey=function(e,t){var i=e.ctrlKey,n=e.metaKey;(i||n)&&t&&(this._canSearch=!1,this.config.removeItems&&!this.input.value&&this.input.element===document.activeElement&&this.highlightAll())},e.prototype._onEnterKey=function(e,t,i){var n=this,s=this.input.value,o=e.target;if(o&&o.hasAttribute("data-button"))return e.preventDefault(),void this._handleButtonAction(t,o);if(!i&&this._isSelectOneElement)return e.preventDefault(),void this.showDropdown();if(i){var r=this.dropdown.element.querySelector(te(this.config.classNames.highlightedState));if(r&&this._handleChoiceAction(t,r,13))return e.preventDefault(),void this.unhighlightAll();s||this.hideDropdown(!0)}o&&s&&this._canAddUserChoices&&(this._canAddItem(t,s).response&&(this._store.withDeferRendering((function(){if((n._isSelectOneElement||n.config.singleModeForMultiSelect)&&0!==t.length){var e=t[t.length-1];n._removeItem(e)}var i=!0;if(!n._isSelectElement&&n.config.duplicateItemsAllowed||(i=!n._findAndSelectChoiceByValue(s)),i){var o=z(s),r=n.config.allowHtmlUserInput||o===s?s:{escaped:o,raw:s};n._addChoice(fe({value:r,label:r,selected:!0},!1))}n.clearInput(),n.unhighlightAll(),n._triggerChange(s)})),(this._isTextElement||this._isSelectOneElement)&&this.hideDropdown(!0)))},e.prototype._onEscapeKey=function(e,t){t&&(e.stopPropagation(),this.hideDropdown(!0),this.containerOuter.focus())},e.prototype._onDirectionKey=function(e,t){var i,n,s,o=e.keyCode,r=e.metaKey;if(t||this._isSelectOneElement){this.showDropdown(),this._canSearch=!1;var c=40===o||34===o?1:-1,a="[data-choice-selectable]",h=void 0;if(r||34===o||33===o)h=c>0?this.dropdown.element.querySelector("".concat(a,":last-of-type")):this.dropdown.element.querySelector(a);else{var l=this.dropdown.element.querySelector(te(this.config.classNames.highlightedState));h=l?function(e,t,i){void 0===i&&(i=1);for(var n="".concat(i>0?"next":"previous","ElementSibling"),s=e[n];s;){if(s.matches(t))return s;s=s[n]}return s}(l,a,c):this.dropdown.element.querySelector(a)}h&&(i=h,n=this.choiceList.element,void 0===(s=c)&&(s=1),i&&(s>0?n.scrollTop+n.offsetHeight>=i.offsetTop+i.offsetHeight:i.offsetTop>=n.scrollTop)||this.choiceList.scrollToChildElement(h,c),this._highlightChoice(h)),e.preventDefault()}},e.prototype._onDeleteKey=function(e,t,i){var n=e.target;this._isSelectOneElement||n.value||!i||(this._handleBackspace(t),e.preventDefault())},e.prototype._onTouchMove=function(){this._wasTap&&(this._wasTap=!1)},e.prototype._onTouchEnd=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},e.prototype._onMouseDown=function(e){var t=e.target;if(t instanceof HTMLElement){if(xe&&this.choiceList.element.contains(t)){var i=this.choiceList.element.firstElementChild;this._isScrollingOnIe="ltr"===this._direction?e.offsetX>=i.offsetWidth:e.offsetX0&&this.unhighlightAll(),this.containerOuter.removeFocusState(),this.hideDropdown(!0))},e.prototype._onFocus=function(e){var t,i=this,n=e.target;n&&this.containerOuter.element.contains(n)&&((t={})[se]=function(){n===i.input.element&&i.containerOuter.addFocusState()},t[oe]=function(){i.containerOuter.addFocusState(),n===i.input.element&&i.showDropdown(!0)},t[re]=function(){n===i.input.element&&(i.showDropdown(!0),i.containerOuter.addFocusState())},t)[this._elementType]()},e.prototype._onBlur=function(e){var t,i=this,n=e.target;if(n&&this.containerOuter.element.contains(n)&&!this._isScrollingOnIe){var s=this._store.activeChoices.some((function(e){return e.highlighted}));((t={})[se]=function(){n===i.input.element&&(i.containerOuter.removeFocusState(),s&&i.unhighlightAll(),i.hideDropdown(!0))},t[oe]=function(){i.containerOuter.removeFocusState(),(n===i.input.element||n===i.containerOuter.element&&!i._canSearch)&&i.hideDropdown(!0)},t[re]=function(){n===i.input.element&&(i.containerOuter.removeFocusState(),i.hideDropdown(!0),s&&i.unhighlightAll())},t)[this._elementType]()}else this._isScrollingOnIe=!1,this.input.element.focus()},e.prototype._onFormReset=function(){var e=this;this._store.withDeferRendering((function(){e.clearInput(),e.hideDropdown(),e.refresh(!1,!1,!0),0!==e._initialItems.length&&e.setChoiceByValue(e._initialItems)}))},e.prototype._highlightChoice=function(e){var t,i=this;void 0===e&&(e=null);var n=Array.from(this.dropdown.element.querySelectorAll("[data-choice-selectable]"));if(n.length){var s=e;Array.from(this.dropdown.element.querySelectorAll(te(this.config.classNames.highlightedState))).forEach((function(e){var t;(t=e.classList).remove.apply(t,ee(i.config.classNames.highlightedState)),e.setAttribute("aria-selected","false")})),s?this._highlightPosition=n.indexOf(s):(s=n.length>this._highlightPosition?n[this._highlightPosition]:n[n.length-1])||(s=n[0]),(t=s.classList).add.apply(t,ee(this.config.classNames.highlightedState)),s.setAttribute("aria-selected","true"),this.passedElement.triggerEvent("highlightChoice",{el:s}),this.dropdown.isActive&&(this.input.setActiveDescendant(s.id),this.containerOuter.setActiveDescendant(s.id))}},e.prototype._addItem=function(e,t){void 0===t&&(t=!0);var i=e.id;if(0===i)throw new TypeError("item.id must be set before _addItem is called for a choice/item");this._store.dispatch(function(e){return{type:"ADD_ITEM",item:e}}(e)),this._isSelectOneElement&&this.removeActiveItems(i),t&&this.passedElement.triggerEvent("addItem",this._getChoiceForOutput(e))},e.prototype._removeItem=function(e){e.id&&(this._store.dispatch(function(e){return{type:"REMOVE_ITEM",item:e}}(e)),this.passedElement.triggerEvent("removeItem",this._getChoiceForOutput(e)))},e.prototype._addChoice=function(e,t){if(void 0===t&&(t=!0),0!==e.id)throw new TypeError("Can not re-add a choice which has already been added");var i=e;this._lastAddedChoiceId++,i.id=this._lastAddedChoiceId,i.elementId="".concat(this._baseId,"-").concat(this._idNames.itemChoice,"-").concat(i.id),this.config.prependValue&&(i.value=this.config.prependValue+i.value),this.config.appendValue&&(i.value+=this.config.appendValue.toString()),(this.config.prependValue||this.config.appendValue)&&i.element&&(i.element.value=i.value),this._store.dispatch(function(e){return{type:"ADD_CHOICE",choice:e}}(e)),e.selected&&this._addItem(e,t)},e.prototype._addGroup=function(e,t){var i=this;if(void 0===t&&(t=!0),0!==e.id)throw new TypeError("Can not re-add a group which has already been added");if(this._store.dispatch(function(e){return{type:"ADD_GROUP",group:e}}(e)),e.choices){var n=e;this._lastAddedGroupId++,n.id=this._lastAddedGroupId;var s=e.id,o=e.choices;n.choices=[],o.forEach((function(n){var o=n;o.groupId=s,e.disabled&&(o.disabled=!0),i._addChoice(o,t)}))}},e.prototype._getTemplate=function(e){for(var t,i=[],s=1;s`Missing ${e} property in key`,_=e=>`Property 'weight' in key '${e}' must be a positive integer`,y=Object.prototype.hasOwnProperty;class b{constructor(e){this._keys=[],this._keyMap={};let t=0;e.forEach((e=>{let i=E(e);this._keys.push(i),this._keyMap[i.id]=i,t+=i.weight})),this._keys.forEach((e=>{e.weight/=t}))}get(e){return this._keyMap[e]}keys(){return this._keys}toJSON(){return JSON.stringify(this._keys)}}function E(e){let t=null,i=null,n=null,s=1,o=null;if(l(e)||c(e))n=e,t=w(e),i=I(e);else{if(!y.call(e,"name"))throw new Error(v("name"));const r=e.name;if(n=r,y.call(e,"weight")&&(s=e.weight,s<=0))throw new Error(_(r));t=w(r),i=I(r),o=e.getFn}return{path:t,id:i,weight:s,src:n,getFn:o}}function w(e){return c(e)?e:e.split(".")}function I(e){return c(e)?e.join("."):e}const C={useExtendedSearch:!1,getFn:function(e,t){let i=[],n=!1;const s=(e,t,o)=>{if(f(e))if(t[o]){const r=e[t[o]];if(!f(r))return;if(o===t.length-1&&(l(r)||u(r)||d(r)))i.push(h(r));else if(c(r)){n=!0;for(let e=0,i=r.length;ee.score===t.score?e.idx{this._keysMap[e.id]=t}))}create(){!this.isCreated&&this.docs.length&&(this.isCreated=!0,l(this.docs[0])?this.docs.forEach(((e,t)=>{this._addString(e,t)})):this.docs.forEach(((e,t)=>{this._addObject(e,t)})),this.norm.clear())}add(e){const t=this.size();l(e)?this._addString(e,t):this._addObject(e,t)}removeAt(e){this.records.splice(e,1);for(let t=e,i=this.size();t{let s=t.getFn?t.getFn(e):this.getFn(e,t.path);if(f(s))if(c(s)){let e=[];const t=[{nestedArrIndex:-1,value:s}];for(;t.length;){const{nestedArrIndex:i,value:n}=t.pop();if(f(n))if(l(n)&&!m(n)){let t={v:n,i:i,n:this.norm.get(n)};e.push(t)}else c(n)&&n.forEach(((e,i)=>{t.push({nestedArrIndex:i,value:e})}))}i.$[n]=e}else if(l(s)&&!m(s)){let e={v:s,n:this.norm.get(s)};i.$[n]=e}})),this.records.push(i)}toJSON(){return{keys:this.keys,records:this.records}}}function L(e,t,{getFn:i=S.getFn,fieldNormWeight:n=S.fieldNormWeight}={}){const s=new A({getFn:i,fieldNormWeight:n});return s.setKeys(e.map(E)),s.setSources(t),s.create(),s}function T(e,{errors:t=0,currentLocation:i=0,expectedLocation:n=0,distance:s=S.distance,ignoreLocation:o=S.ignoreLocation}={}){const r=t/e.length;if(o)return r;const c=Math.abs(n-i);return s?r+c/s:c?1:r}const x=32;function N(e,t,i,{location:n=S.location,distance:s=S.distance,threshold:o=S.threshold,findAllMatches:r=S.findAllMatches,minMatchCharLength:c=S.minMatchCharLength,includeMatches:a=S.includeMatches,ignoreLocation:h=S.ignoreLocation}={}){if(t.length>x)throw new Error(`Pattern length exceeds max of ${x}.`);const l=t.length,u=e.length,d=Math.max(0,Math.min(n,u));let p=o,f=d;const m=c>1||a,g=m?Array(u):[];let v;for(;(v=e.indexOf(t,f))>-1;){let e=T(t,{currentLocation:v,expectedLocation:d,distance:s,ignoreLocation:h});if(p=Math.min(e,p),f=v+l,m){let e=0;for(;e=a;o-=1){let r=o-1,c=i[e.charAt(r)];if(m&&(g[r]=+!!c),w[o]=(w[o+1]<<1|1)&c,n&&(w[o]|=(_[o+1]|_[o])<<1|1|_[o+1]),w[o]&E&&(y=T(t,{errors:n,currentLocation:r,expectedLocation:d,distance:s,ignoreLocation:h}),y<=p)){if(p=y,f=r,f<=d)break;a=Math.max(1,2*d-f)}}if(T(t,{errors:n+1,currentLocation:d,expectedLocation:d,distance:s,ignoreLocation:h})>p)break;_=w}const w={isMatch:f>=0,score:Math.max(.001,y)};if(m){const e=function(e=[],t=S.minMatchCharLength){let i=[],n=-1,s=-1,o=0;for(let r=e.length;o=t&&i.push([n,s]),n=-1)}return e[o-1]&&o-n>=t&&i.push([n,o-1]),i}(g,c);e.length?a&&(w.indices=e):w.isMatch=!1}return w}function M(e){let t={};for(let i=0,n=e.length;i{this.chunks.push({pattern:e,alphabet:M(e),startIndex:t})},l=this.pattern.length;if(l>x){let e=0;const t=l%x,i=l-t;for(;e{const{isMatch:f,score:m,indices:g}=N(e,t,d,{location:n+p,distance:s,threshold:o,findAllMatches:r,minMatchCharLength:c,includeMatches:i,ignoreLocation:a});f&&(u=!0),l+=m,f&&g&&(h=[...h,...g])}));let d={isMatch:u,score:u?l/this.chunks.length:1};return u&&i&&(d.indices=h),d}}const F=[];function j(e,t){for(let i=0,n=F.length;i!(!e[P]&&!e[k]),B=e=>({[P]:Object.keys(e).map((t=>({[t]:e[t]})))});function K(e,t){const i=e.matches;t.matches=[],f(i)&&i.forEach((e=>{if(!f(e.indices)||!e.indices.length)return;const{indices:i,value:n}=e;let s={indices:i,value:n};e.key&&(s.key=e.key.src),e.idx>-1&&(s.refIndex=e.idx),t.matches.push(s)}))}function U(e,t){t.score=e.score}class q{constructor(e,t={},i){if(this.options=r(r({},S),t),this.options.useExtendedSearch)throw new Error("Extended search is not available");this._keyStore=new b(this.options.keys),this.setCollection(e,i)}setCollection(e,t){if(this._docs=e,t&&!(t instanceof A))throw new Error("Incorrect 'index' type");this._myIndex=t||L(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight})}add(e){f(e)&&(this._docs.push(e),this._myIndex.add(e))}remove(e=()=>!1){const t=[];for(let i=0,n=this._docs.length;i{let i=1;e.matches.forEach((({key:e,norm:n,score:s})=>{const o=e?e.weight:null;i*=Math.pow(0===s&&o?Number.EPSILON:s,(o||1)*(t?1:n))})),e.score=i}))}(c,{ignoreFieldNorm:r}),s&&c.sort(o),u(t)&&t>-1&&(c=c.slice(0,t)),function(e,t,{includeMatches:i=S.includeMatches,includeScore:n=S.includeScore}={}){const s=[];return i&&s.push(K),n&&s.push(U),e.map((e=>{const{idx:i}=e,n={item:t[i],refIndex:i};return s.length&&s.forEach((t=>{t(e,n)})),n}))}(c,this._docs,{includeMatches:i,includeScore:n})}_searchStringList(e){const t=j(e,this.options),{records:i}=this._myIndex,n=[];return i.forEach((({v:e,i:i,n:s})=>{if(!f(e))return;const{isMatch:o,score:r,indices:c}=t.searchIn(e);o&&n.push({item:e,idx:i,matches:[{score:r,value:e,norm:s,indices:c}]})})),n}_searchLogical(e){throw new Error("Logical search is not available")}_searchObjectList(e){const t=j(e,this.options),{keys:i,records:n}=this._myIndex,s=[];return n.forEach((({$:e,i:n})=>{if(!f(e))return;let o=[];i.forEach(((i,n)=>{o.push(...this._findMatches({key:i,value:e[n],searcher:t}))})),o.length&&s.push({idx:n,item:e,matches:o})})),s}_findMatches({key:e,value:t,searcher:i}){if(!f(t))return[];let n=[];if(c(t))t.forEach((({v:t,i:s,n:o})=>{if(!f(t))return;const{isMatch:r,score:c,indices:a}=i.searchIn(t);r&&n.push({score:c,key:e,value:t,idx:s,norm:o,indices:a})}));else{const{v:s,n:o}=t,{isMatch:r,score:c,indices:a}=i.searchIn(s);r&&n.push({score:c,key:e,value:s,norm:o,indices:a})}return n}}q.version="7.0.0",q.createIndex=L,q.parseIndex=function(e,{getFn:t=S.getFn,fieldNormWeight:i=S.fieldNormWeight}={}){const{keys:n,records:s}=e,o=new A({getFn:t,fieldNormWeight:i});return o.setKeys(n),o.setIndexRecords(s),o},q.config=S,q.parseQuery=function(e,t,{auto:i=!0}={}){const n=e=>{let s=Object.keys(e);const o=(e=>!!e[R])(e);if(!o&&s.length>1&&!V(e))return n(B(e));if((e=>!c(e)&&p(e)&&!V(e))(e)){const n=o?e[R]:s[0],r=o?e[H]:e[n];if(!l(r))throw new Error((e=>`Invalid value for key ${e}`)(n));const c={keyId:I(n),pattern:r};return i&&(c.searcher=j(r,t)),c}let r={children:[],operator:s[0]};return s.forEach((t=>{const i=e[t];c(i)&&i.forEach((e=>{r.children.push(n(e))}))})),r};return V(e)||(e=B(e)),n(e)};var G,W=function(e,t,s){return new q(t,i(i({},e.fuseOptions),{keys:n([],e.searchFields,!0),includeMatches:!0})).search(s)},$=function(e,t){return{type:"HIGHLIGHT_ITEM",item:e,highlighted:t}},X=function(e){return{type:"SET_IS_LOADING",isLoading:e}},J=function(e){return Array.from({length:e},(function(){return(e=0,t=36,Math.floor(Math.random()*(t-e)+e)).toString(36);var e,t})).join("")},z=function(e){if("string"!=typeof e){if(null==e)return"";if("object"==typeof e){if("raw"in e)return z(e.raw);if("trusted"in e)return e.trusted}return e}return e.replace(/&/g,"&").replace(/>/g,">").replace(/0?this.element.scrollTop+r-s:e.offsetTop;requestAnimationFrame((function(){i._animateScroll(c,t)}))}},e.prototype._scrollDown=function(e,t,i){var n=(i-e)/t,s=n>1?n:1;this.element.scrollTop=e+s},e.prototype._scrollUp=function(e,t,i){var n=(e-i)/t,s=n>1?n:1;this.element.scrollTop=e-s},e.prototype._animateScroll=function(e,t){var i=this,n=this.element.scrollTop,s=!1;t>0?(this._scrollDown(n,4,e),ne&&(s=!0)),s&&requestAnimationFrame((function(){i._animateScroll(e,t)}))},e}(),le=function(){function e(e){var t=e.element,i=e.classNames;this.element=t,this.classNames=i,this.isDisabled=!1}return Object.defineProperty(e.prototype,"isActive",{get:function(){return"active"===this.element.dataset.choice},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"dir",{get:function(){return this.element.dir},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"value",{get:function(){return this.element.value},set:function(e){this.element.setAttribute("value",e),this.element.value=e},enumerable:!1,configurable:!0}),e.prototype.conceal=function(){var e;(e=this.element.classList).add.apply(e,ee(this.classNames.input)),this.element.hidden=!0,this.element.tabIndex=-1;var t=this.element.getAttribute("style");t&&this.element.setAttribute("data-choice-orig-style",t),this.element.setAttribute("data-choice","active")},e.prototype.reveal=function(){var e;(e=this.element.classList).remove.apply(e,ee(this.classNames.input)),this.element.hidden=!1,this.element.removeAttribute("tabindex");var t=this.element.getAttribute("data-choice-orig-style");t?(this.element.removeAttribute("data-choice-orig-style"),this.element.setAttribute("style",t)):this.element.removeAttribute("style"),this.element.removeAttribute("data-choice"),this.element.value=this.element.value},e.prototype.enable=function(){this.element.removeAttribute("disabled"),this.element.disabled=!1,this.isDisabled=!1},e.prototype.disable=function(){this.element.setAttribute("disabled",""),this.element.disabled=!0,this.isDisabled=!0},e.prototype.triggerEvent=function(e,t){!function(e,t,i){void 0===i&&(i=null);var n=new CustomEvent(t,{detail:i,bubbles:!0,cancelable:!0});e.dispatchEvent(n)}(this.element,e,t)},e}(),ue=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return t(i,e),i}(le),de=function(e,t){return void 0===t&&(t=!0),void 0===e?t:!!e},pe=function(e){if("string"==typeof e&&(e=e.split(" ").filter((function(e){return 0!==e.length}))),Array.isArray(e)&&0!==e.length)return e},fe=function(e,t){if("string"==typeof e)return fe({value:e,label:e},!1);var i=e;if("choices"in i){if(!t)throw new TypeError("optGroup is not allowed");var n=i,s=n.choices.map((function(e){return fe(e,!1)}));return{id:0,label:Y(n.label)||n.value,active:0!==s.length,disabled:!!n.disabled,choices:s}}var o=i;return{id:0,groupId:0,score:0,value:o.value,label:o.label||o.value,active:de(o.active),selected:de(o.selected,!1),disabled:de(o.disabled,!1),placeholder:de(o.placeholder,!1),highlighted:!1,labelClass:pe(o.labelClass),labelDescription:o.labelDescription,customProperties:o.customProperties}},me=function(e){function i(t){var i=t.element,n=t.classNames,s=t.template,o=t.extractPlaceholder,r=e.call(this,{element:i,classNames:n})||this;return r.template=s,r.extractPlaceholder=o,r}return t(i,e),Object.defineProperty(i.prototype,"placeholderOption",{get:function(){return this.element.querySelector('option[value=""]')||this.element.querySelector("option[placeholder]")},enumerable:!1,configurable:!0}),i.prototype.addOptions=function(e){var t=this;e.forEach((function(e){var i=e;if(!i.element){var n=t.template(i);t.element.appendChild(n),i.element=n}}))},i.prototype.optionsAsChoices=function(){var e=this,t=[];return this.element.querySelectorAll(":scope > option, :scope > optgroup").forEach((function(i){!function(e){return"OPTION"===e.tagName}(i)?function(e){return"OPTGROUP"===e.tagName}(i)&&t.push(e._optgroupToChoice(i)):t.push(e._optionToChoice(i))})),t},i.prototype._optionToChoice=function(e){return{id:0,groupId:0,score:0,value:e.value,label:e.innerHTML,element:e,active:!0,selected:this.extractPlaceholder?e.selected:e.hasAttribute("selected"),disabled:e.disabled,highlighted:!1,placeholder:this.extractPlaceholder&&(""===e.value||e.hasAttribute("placeholder")),labelClass:void 0!==e.dataset.labelClass?pe(e.dataset.labelClass):void 0,labelDescription:void 0!==e.dataset.labelDescription?e.dataset.labelDescription:void 0,customProperties:ie(e.dataset.customProperties)}},i.prototype._optgroupToChoice=function(e){var t=this,i=e.querySelectorAll("option"),n=Array.from(i).map((function(e){return t._optionToChoice(e)}));return{id:0,label:e.label||"",element:e,active:0!==n.length,disabled:e.disabled,choices:n}},i}(le),ge={items:[],choices:[],silent:!1,renderChoiceLimit:-1,maxItemCount:-1,singleModeForMultiSelect:!1,addChoices:!1,addItems:!0,addItemFilter:function(e){return!!e&&""!==e},removeItems:!0,removeItemButton:!1,removeItemButtonAlignLeft:!1,editItems:!1,allowHTML:!1,allowHtmlUserInput:!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,sorter:function(e,t){var i=e.value,n=e.label,s=void 0===n?i:n,o=t.value,r=t.label,c=void 0===r?o:r;return Y(s).localeCompare(Y(c),[],{sensitivity:"base",ignorePunctuation:!0,numeric:!0})},shadowRoot:null,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 "'.concat(e,'"')},removeItemIconText:function(){return"Remove item"},removeItemLabelText:function(e){return"Remove item: ".concat(e)},maxItemText:function(e){return"Only ".concat(e," values can be added")},valueComparer:function(e,t){return e===t},fuseOptions:{includeScore:!0},labelId:"",callbackOnInit:null,callbackOnCreateTemplates:null,classNames:{containerOuter:["choices"],containerInner:["choices__inner"],input:["choices__input"],inputCloned:["choices__input--cloned"],list:["choices__list"],listItems:["choices__list--multiple"],listSingle:["choices__list--single"],listDropdown:["choices__list--dropdown"],item:["choices__item"],itemSelectable:["choices__item--selectable"],itemDisabled:["choices__item--disabled"],itemChoice:["choices__item--choice"],description:["choices__description"],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"],selectedState:["is-selected"],flippedState:["is-flipped"],loadingState:["is-loading"],addChoice:["choices__item","choices__item--selectable","add-choice"],noResults:["has-no-results"],noChoices:["has-no-choices"]},appendGroupInSearch:!1},ve=["fuseOptions","classNames"];function _e(e){return"Minified Redux error #"+e+"; visit https://redux.js.org/Errors?code="+e+" for the full message or use the non-minified dev environment for full errors. "}var ye="function"==typeof Symbol&&Symbol.observable||"@@observable",be=function(){return Math.random().toString(36).substring(7).split("").join(".")},Ee={INIT:"@@redux/INIT"+be(),REPLACE:"@@redux/REPLACE"+be(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+be()}};function we(e,t,i){var n;if("function"==typeof t&&"function"==typeof i||"function"==typeof i&&"function"==typeof arguments[3])throw new Error(_e(0));if("function"==typeof t&&void 0===i&&(i=t,t=void 0),void 0!==i){if("function"!=typeof i)throw new Error(_e(1));return i(we)(e,t)}if("function"!=typeof e)throw new Error(_e(2));var s=e,o=t,r=[],c=r,a=!1;function h(){c===r&&(c=r.slice())}function l(){if(a)throw new Error(_e(3));return o}function u(e){if("function"!=typeof e)throw new Error(_e(4));if(a)throw new Error(_e(5));var t=!0;return h(),c.push(e),function(){if(t){if(a)throw new Error(_e(6));t=!1,h();var i=c.indexOf(e);c.splice(i,1),r=null}}}function d(e){if(!function(e){if("object"!=typeof e||null===e)return!1;for(var t=e;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}(e))throw new Error(_e(7));if(void 0===e.type)throw new Error(_e(8));if(a)throw new Error(_e(9));try{a=!0,o=s(o,e)}finally{a=!1}for(var t=r=c,i=0;i0},e.prototype.getChoiceById=function(e){return this.activeChoices.find((function(t){return t.id===e}))},e.prototype.getGroupById=function(e){return this.groups.find((function(t){return t.id===e}))},e}(),Ae=function(e,t){return e?function(e){if("string"==typeof e)return e;if("object"==typeof e){if("escaped"in e)return e.escaped;if("trusted"in e)return e.trusted}return""}(t):z(t)},Le=function(e,t){if(t){var i=e.dataset;"string"==typeof t?i.customProperties=t:"object"!=typeof t||function(e){for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0}(t)||(i.customProperties=JSON.stringify(t))}},Te={containerOuter:function(e,t,i,n,s,o,r){var c=e.classNames.containerOuter,a=Object.assign(document.createElement("div"),{className:ee(c).join(" ")});return a.dataset.type=o,t&&(a.dir=t),n&&(a.tabIndex=0),i&&(a.setAttribute("role",s?"combobox":"listbox"),s&&a.setAttribute("aria-autocomplete","list")),a.setAttribute("aria-haspopup","true"),a.setAttribute("aria-expanded","false"),r&&a.setAttribute("aria-labelledby",r),a},containerInner:function(e){var t=e.classNames.containerInner;return Object.assign(document.createElement("div"),{className:ee(t).join(" ")})},itemList:function(e,t){var i=e.classNames,n=i.list,s=i.listSingle,o=i.listItems;return Object.assign(document.createElement("div"),{className:"".concat(ee(n).join(" ")," ").concat(t?ee(s).join(" "):ee(o).join(" "))})},placeholder:function(e,t){var i=e.allowHTML,n=e.classNames.placeholder;return Object.assign(document.createElement("div"),{className:ee(n).join(" "),innerHTML:Ae(i,t)})},item:function(e,t,i){var n,s,o,r=e.allowHTML,c=e.removeItemButtonAlignLeft,a=e.classNames,h=a.item,l=a.button,u=a.highlightedState,d=a.itemSelectable,p=a.placeholder,f=t.id,m=t.value,g=t.label,v=t.labelClass,_=t.labelDescription,y=t.customProperties,b=t.active,E=t.disabled,w=t.highlighted,I=t.placeholder,C=Object.assign(document.createElement("div"),{className:ee(h).join(" ")});if(v){var S=Object.assign(document.createElement("span"),{innerHTML:Ae(r,g),className:ee(v).join(" ")});C.appendChild(S)}else C.innerHTML=Ae(r,g);if(Object.assign(C.dataset,{item:"",id:f,value:m}),v&&(C.dataset.labelClass=ee(v).join(" ")),_&&(C.dataset.labelDescription=_),Le(C,y),b&&C.setAttribute("aria-selected","true"),E&&C.setAttribute("aria-disabled","true"),I&&((n=C.classList).add.apply(n,ee(p)),C.dataset.placeholder=""),(s=C.classList).add.apply(s,ee(w?u:d)),i){E&&(o=C.classList).remove.apply(o,ee(d)),C.dataset.deletable="";var O="function"==typeof this.config.removeItemIconText?this.config.removeItemIconText(z(m),m):this.config.removeItemIconText,A="function"==typeof this.config.removeItemLabelText?this.config.removeItemLabelText(z(m),m):this.config.removeItemLabelText,L=Object.assign(document.createElement("button"),{type:"button",className:ee(l).join(" "),innerHTML:O});L.setAttribute("aria-label",A),L.dataset.button="",c?C.insertAdjacentElement("afterbegin",L):C.appendChild(L)}return C},choiceList:function(e,t){var i=e.classNames.list,n=Object.assign(document.createElement("div"),{className:ee(i).join(" ")});return t||n.setAttribute("aria-multiselectable","true"),n.setAttribute("role","listbox"),n},choiceGroup:function(e,t){var i=e.allowHTML,n=e.classNames,s=n.group,o=n.groupHeading,r=n.itemDisabled,c=t.id,a=t.label,h=t.disabled,l=Object.assign(document.createElement("div"),{className:"".concat(ee(s).join(" ")," ").concat(h?ee(r).join(" "):"")});return l.setAttribute("role","group"),Object.assign(l.dataset,{group:"",id:c,value:a}),h&&l.setAttribute("aria-disabled","true"),l.appendChild(Object.assign(document.createElement("div"),{className:ee(o).join(" "),innerHTML:Ae(i,a)})),l},choice:function(e,t,i){var n,s,o,r,c,a=e.allowHTML,h=e.classNames,l=h.item,u=h.itemChoice,d=h.itemSelectable,p=h.selectedState,f=h.itemDisabled,m=h.description,g=h.placeholder,v=t.id,_=t.value,y=t.label,b=t.groupId,E=t.elementId,w=t.labelClass,I=t.labelDescription,C=t.disabled,S=t.selected,O=t.placeholder,A=Object.assign(document.createElement("div"),{id:E,className:"".concat(ee(l).join(" ")," ").concat(ee(u).join(" "))}),L=A;if(w){var T=Object.assign(document.createElement("span"),{innerHTML:Ae(a,y),className:ee(w).join(" ")});L=T,A.appendChild(T)}else A.innerHTML=Ae(a,y);if(I){var x="".concat(E,"-description");L.setAttribute("aria-describedby",x);var N=Object.assign(document.createElement("span"),{innerHTML:Ae(a,I),id:x});(n=N.classList).add.apply(n,ee(m)),A.appendChild(N)}return S&&(s=A.classList).add.apply(s,ee(p)),O&&(o=A.classList).add.apply(o,ee(g)),A.setAttribute("role",b&&b>0?"treeitem":"option"),Object.assign(A.dataset,{choice:"",id:v,value:_,selectText:i}),w&&(A.dataset.labelClass=ee(w).join(" ")),I&&(A.dataset.labelDescription=I),C?((r=A.classList).add.apply(r,ee(f)),A.dataset.choiceDisabled="",A.setAttribute("aria-disabled","true")):((c=A.classList).add.apply(c,ee(d)),A.dataset.choiceSelectable=""),A},input:function(e,t){var i=e.classNames,n=i.input,s=i.inputCloned,o=Object.assign(document.createElement("input"),{type:"search",className:"".concat(ee(n).join(" ")," ").concat(ee(s).join(" ")),autocomplete:"off",autocapitalize:"off",spellcheck:!1});return o.setAttribute("role","textbox"),o.setAttribute("aria-autocomplete","list"),t&&o.setAttribute("aria-label",t),o},dropdown:function(e){var t,i,n=e.classNames,s=n.list,o=n.listDropdown,r=document.createElement("div");return(t=r.classList).add.apply(t,ee(s)),(i=r.classList).add.apply(i,ee(o)),r.setAttribute("aria-expanded","false"),r},notice:function(e,t,i){var s=e.allowHTML,o=e.classNames,r=o.item,c=o.itemChoice,a=o.addChoice,h=o.noResults,l=o.noChoices;void 0===i&&(i="");var u=n(n([],ee(r),!0),ee(c),!0);switch(i){case"add-choice":u.push.apply(u,ee(a));break;case"no-results":u.push.apply(u,ee(h));break;case"no-choices":u.push.apply(u,ee(l))}var d=Object.assign(document.createElement("div"),{innerHTML:Ae(s,t),className:u.join(" ")});return"add-choice"===i&&(d.dataset.choiceSelectable="",d.dataset.choice=""),d},option:function(e){var t=e.label,i=e.value,n=e.labelClass,s=e.labelDescription,o=e.customProperties,r=e.active,c=e.disabled,a=Y(t),h=new Option(a,i,!1,r);return n&&(h.dataset.labelClass=ee(n).join(" ")),s&&(h.dataset.labelDescription=s),Le(h,o),h.disabled=c,h}},xe="-ms-scroll-limit"in document.documentElement.style&&"-ms-ime-align"in document.documentElement.style,Ne={},Me=function(e){if(e){var t=e.dataset.id;return t?parseInt(t,10):void 0}},De=function(){function e(t,n){void 0===t&&(t="[data-choice]"),void 0===n&&(n={});var s=this;this._hasNonChoicePlaceholder=!1,this._lastAddedChoiceId=0,this._lastAddedGroupId=0,this.config=i(i(i({},e.defaults.allOptions),e.defaults.options),n),ve.forEach((function(t){s.config[t]=i(i(i({},e.defaults.allOptions[t]),e.defaults.options[t]),n[t])}));var o,r,c,a,h=(o=this.config,r=ge,c=Object.keys(o).sort(),a=Object.keys(r).sort(),c.filter((function(e){return a.indexOf(e)<0})));h.length&&console.warn("Unknown config option(s) passed",h.join(", ")),!this.config.silent&&this.config.allowHTML&&this.config.allowHtmlUserInput&&(this.config.addItems&&console.warn("Warning: allowHTML/allowHtmlUserInput/addItems all being true is strongly not recommended and may lead to XSS attacks"),this.config.addChoices&&console.warn("Warning: allowHTML/allowHtmlUserInput/addChoices all being true is strongly not recommended and may lead to XSS attacks"));var l=this.config.shadowRoot||document.documentElement,u="string"==typeof t?l.querySelector(t):t;if(!u||"object"!=typeof u||"INPUT"!==u.tagName&&!function(e){return"SELECT"===e.tagName}(u)){if(!u&&"string"==typeof t)throw TypeError("Selector ".concat(t," failed to find an element"));throw TypeError("Expected one of the following types text|select-one|select-multiple")}if(this._elementType=u.type,this._isTextElement=this._elementType===se,(this._isTextElement||1!==this.config.maxItemCount)&&(this.config.singleModeForMultiSelect=!1),this.config.singleModeForMultiSelect&&(this._elementType=re),this._isSelectOneElement=this._elementType===oe,this._isSelectMultipleElement=this._elementType===re,this._isSelectElement=this._isSelectOneElement||this._isSelectMultipleElement,this._canAddUserChoices=this._isTextElement&&this.config.addItems||this._isSelectElement&&this.config.addChoices,["auto","always"].includes("".concat(this.config.renderSelectedChoices))||(this.config.renderSelectedChoices="auto"),this.config.placeholder&&(this.config.placeholderValue?this._hasNonChoicePlaceholder=!0:u.dataset.placeholder&&(this._hasNonChoicePlaceholder=!0,this.config.placeholderValue=u.dataset.placeholder)),n.addItemFilter&&"function"!=typeof n.addItemFilter){var d=n.addItemFilter instanceof RegExp?n.addItemFilter:new RegExp(n.addItemFilter);this.config.addItemFilter=d.test.bind(d)}if(this._isTextElement)this.passedElement=new ue({element:u,classNames:this.config.classNames});else{var p=u;this.passedElement=new me({element:p,classNames:this.config.classNames,template:function(e){return s._templates.option(e)},extractPlaceholder:this.config.placeholder&&!this._hasNonChoicePlaceholder})}if(this.initialised=!1,this._store=new Oe,this._initialState=Ie,this._currentState=Ie,this._prevState=Ie,this._currentValue="",this.config.searchEnabled=!this._isTextElement&&this.config.searchEnabled||this._elementType===re,this._canSearch=this.config.searchEnabled,this._isScrollingOnIe=!1,this._highlightPosition=0,this._wasTap=!0,this._placeholderValue=this._generatePlaceholderValue(),this._baseId=function(e,t){var i=e.id||e.name&&"".concat(e.name,"-").concat(J(2))||J(4);return i=i.replace(/(:|\.|\[|\]|,)/g,""),"".concat(t,"-").concat(i)}(this.passedElement.element,"choices-"),this._searchFn=W,this._direction=this.passedElement.dir,!this._direction){var f=window.getComputedStyle(this.passedElement.element).direction;f!==window.getComputedStyle(document.documentElement).direction&&(this._direction=f)}if(this._idNames={itemChoice:"item-choice"},this._render=this._render.bind(this),this._onFocus=this._onFocus.bind(this),this._onBlur=this._onBlur.bind(this),this._onKeyUp=this._onKeyUp.bind(this),this._onKeyDown=this._onKeyDown.bind(this),this._onInput=this._onInput.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._onSelectKey=this._onSelectKey.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),this.passedElement.isActive)return this.config.silent||console.warn("Trying to initialise Choices on element already initialised",{element:t}),void(this.initialised=!0);this.init(),this._initialItems=this._store.items.map((function(e){return e.value}))}return Object.defineProperty(e,"defaults",{get:function(){return Object.preventExtensions({get options(){return Ne},get allOptions(){return ge},get templates(){return Te}})},enumerable:!1,configurable:!0}),e.prototype.init=function(){if(!this.initialised){this._loadChoices(),this._createTemplates(),this._createElements(),this._createStructure(),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&&"function"==typeof e&&e.call(this)}},e.prototype.destroy=function(){this.initialised&&(this._removeEventListeners(),this.passedElement.reveal(),this.containerOuter.unwrap(this.passedElement.element),this.clearStore(),this._stopSearch(),this._templates=Te,this.initialised=!1)},e.prototype.enable=function(){return this.passedElement.isDisabled&&this.passedElement.enable(),this.containerOuter.isDisabled&&(this._addEventListeners(),this.input.enable(),this.containerOuter.enable()),this},e.prototype.disable=function(){return this.passedElement.isDisabled||this.passedElement.disable(),this.containerOuter.isDisabled||(this._removeEventListeners(),this.input.disable(),this.containerOuter.disable()),this},e.prototype.highlightItem=function(e,t){if(void 0===t&&(t=!0),!e||!e.id)return this;var i=this._store.choices.find((function(t){return t.id===e.id}));return!i||i.highlighted||(this._store.dispatch($(i,!0)),t&&this.passedElement.triggerEvent("highlightItem",this._getChoiceForOutput(i))),this},e.prototype.unhighlightItem=function(e,t){if(void 0===t&&(t=!0),!e||!e.id)return this;var i=this._store.choices.find((function(t){return t.id===e.id}));return i&&i.highlighted?(this._store.dispatch($(i,!1)),t&&this.passedElement.triggerEvent("highlightItem",this._getChoiceForOutput(i)),this):this},e.prototype.highlightAll=function(){var e=this;return this._store.withDeferRendering((function(){e._store.items.forEach((function(t){return e.highlightItem(t)}))})),this},e.prototype.unhighlightAll=function(){var e=this;return this._store.withDeferRendering((function(){e._store.items.forEach((function(t){return e.unhighlightItem(t)}))})),this},e.prototype.removeActiveItemsByValue=function(e){var t=this;return this._store.withDeferRendering((function(){t._store.items.filter((function(t){return t.value===e})).forEach((function(e){return t._removeItem(e)}))})),this},e.prototype.removeActiveItems=function(e){var t=this;return this._store.withDeferRendering((function(){t._store.items.filter((function(t){return t.id!==e})).forEach((function(e){return t._removeItem(e)}))})),this},e.prototype.removeHighlightedItems=function(e){var t=this;return void 0===e&&(e=!1),this._store.withDeferRendering((function(){t._store.highlightedActiveItems.forEach((function(i){t._removeItem(i),e&&t._triggerChange(i.value)}))})),this},e.prototype.showDropdown=function(e){var t=this;return this.dropdown.isActive||requestAnimationFrame((function(){t.dropdown.show(),t.containerOuter.open(t.dropdown.distanceFromTopWindow),!e&&t._canSearch&&t.input.focus(),t.passedElement.triggerEvent("showDropdown",{})})),this},e.prototype.hideDropdown=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("hideDropdown",{})})),this):this},e.prototype.getValue=function(e){var t=this;void 0===e&&(e=!1);var i=this._store.items.reduce((function(i,n){var s=e?n.value:t._getChoiceForOutput(n);return i.push(s),i}),[]);return this._isSelectOneElement||this.config.singleModeForMultiSelect?i[0]:i},e.prototype.setValue=function(e){var t=this;return this.initialised?(this._store.withDeferRendering((function(){e.forEach((function(e){e&&t._addChoice(fe(e,!1))}))})),this):this},e.prototype.setChoiceByValue=function(e){var t=this;return!this.initialised||this._isTextElement||this._store.withDeferRendering((function(){(Array.isArray(e)?e:[e]).forEach((function(e){return t._findAndSelectChoiceByValue(e)}))})),this},e.prototype.setChoices=function(e,t,n,s){var o=this;if(void 0===e&&(e=[]),void 0===t&&(t="value"),void 0===n&&(n="label"),void 0===s&&(s=!1),!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("string"!=typeof t||!t)throw new TypeError("value parameter must be a name of 'value' field in passed objects");if(s&&this.clearChoices(),"function"==typeof e){var r=e(this);if("function"==typeof Promise&&r instanceof Promise)return new Promise((function(e){return requestAnimationFrame(e)})).then((function(){return o._handleLoadingState(!0)})).then((function(){return r})).then((function(e){return o.setChoices(e,t,n,s)})).catch((function(e){o.config.silent||console.error(e)})).then((function(){return o._handleLoadingState(!1)})).then((function(){return o}));if(!Array.isArray(r))throw new TypeError(".setChoices first argument function must return either array of choices or Promise, got: ".concat(typeof r));return this.setChoices(r,t,n,!1)}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");return this.containerOuter.removeLoadingState(),this._store.withDeferRendering((function(){var s="value"===t,r="label"===n;e.forEach((function(e){if("choices"in e){var c=e;r||(c=i(i({},c),{label:c[n]})),o._addGroup(fe(c,!0))}else{var a=e;r&&s||(a=i(i({},a),{value:a[t],label:a[n]})),o._addChoice(fe(a,!1))}}))})),this},e.prototype.refresh=function(e,t,i){var n=this;return void 0===e&&(e=!1),void 0===t&&(t=!1),void 0===i&&(i=!1),this._isSelectElement?(this._store.withDeferRendering((function(){var s=n.passedElement.optionsAsChoices(),o=n._store.items,r={};i||o.forEach((function(e){e.id&&e.active&&e.selected&&!e.disabled&&(r[e.value]=!0)})),s.forEach((function(e){if(!("choices"in e)){var t=e;i?t.selected=!1:r[t.value]&&(t.selected=!0)}})),n.clearStore(),n._addPredefinedChoices(s,t,e),n._isSearching&&n._searchChoices(n.input.value)})),this):(this.config.silent||console.warn("refresh method can only be used on choices backed by a element"),this)},e.prototype.removeChoice=function(e){var t=this._store.choices.find((function(t){return t.value===e}));return t?(this._store.dispatch(function(e){return{type:"REMOVE_CHOICE",choice:e}}(t)),t.selected&&this.passedElement.triggerEvent("removeItem",this._getChoiceForOutput(t)),this):this},e.prototype.clearChoices=function(){return this._store.dispatch({type:"CLEAR_CHOICES"}),this},e.prototype.clearStore=function(){return this._store.dispatch({type:"CLEAR_ALL"}),this._lastAddedChoiceId=0,this._lastAddedGroupId=0,this},e.prototype.clearInput=function(){var e=!this._isSelectOneElement;return this.input.clear(e),this._isSearching&&this._stopSearch(),this},e.prototype._render=function(){if(!this._store.isLoading()){this._currentState=this._store.state;var e=this._currentState.items!==this._prevState.items;(this._currentState.choices!==this._prevState.choices||this._currentState.groups!==this._prevState.groups||e)&&(this._isSelectElement&&this._renderChoices(),e&&this._renderItems(),this._prevState=this._currentState)}},e.prototype._renderChoices=function(){var e=this,t=this._store,i=t.activeGroups,n=t.activeChoices,s=document.createDocumentFragment();if(this.choiceList.clear(),this.config.resetScrollPosition&&requestAnimationFrame((function(){return e.choiceList.scrollToTop()})),i.length>=1&&!this._isSearching){var o=n.filter((function(e){return e.placeholder&&-1===e.groupId}));o.length>=1&&(s=this._createChoicesFragment(o,s)),s=this._createGroupsFragment(i,n,s)}else n.length>=1&&(s=this._createChoicesFragment(n,s));var r=this.input.value,c=this._canAddItem(this._store.items,r);if(s.childNodes&&s.childNodes.length>0){var a=!c.response;if(c.response&&(this.choiceList.append(s),this._highlightChoice(),this._canAddUserChoices&&r&&c.notice&&(a=!n.find((function(t){return e.config.valueComparer(t.value,r)})))),a){var h=this._templates.notice(this.config,c.notice,this._canAddUserChoices?"add-choice":"");this.choiceList.prepend(h)}}else{var l=void 0;if(c.response&&this._canAddUserChoices&&r)l=this._templates.notice(this.config,c.notice,"add-choice");else if(this._isSearching){h="function"==typeof this.config.noResultsText?this.config.noResultsText():this.config.noResultsText;l=this._templates.notice(this.config,h,"no-results")}else{h="function"==typeof this.config.noChoicesText?this.config.noChoicesText():this.config.noChoicesText;l=this._templates.notice(this.config,h,"no-choices")}this.choiceList.append(l)}},e.prototype._renderItems=function(){var e=this._store.items||[];this.itemList.clear();var t=this._createItemsFragment(e);t.childNodes&&this.itemList.append(t)},e.prototype._createGroupsFragment=function(e,t,i){var n=this;void 0===i&&(i=document.createDocumentFragment());this.config.shouldSort&&e.sort(this.config.sorter);var s=t.filter((function(e){return 0===e.groupId}));return s.length>0&&this._createChoicesFragment(s,i,!1),e.forEach((function(e){var s=function(e){return t.filter((function(t){return n._isSelectOneElement?t.groupId===e.id:t.groupId===e.id&&("always"===n.config.renderSelectedChoices||!t.selected)}))}(e);if(s.length>=1){var o=n._templates.choiceGroup(n.config,e);i.appendChild(o),n._createChoicesFragment(s,i,!0)}})),i},e.prototype._createChoicesFragment=function(e,t,i){var s=this;void 0===t&&(t=document.createDocumentFragment()),void 0===i&&(i=!1);var o=this.config,r=o.renderSelectedChoices,c=o.searchResultLimit,a=o.renderChoiceLimit,h=o.appendGroupInSearch,l=this._isSearching?Z:this.config.sorter,u=function(e){if("auto"!==r||(s._isSelectOneElement||!e.selected)){var i=s._templates.choice(s.config,e,s.config.itemSelectText);if(h){var n="";s._store.groups.every((function(t){return t.id!==e.groupId||(n=t.label,!1)})),n&&s._isSearching&&(i.innerHTML+=" (".concat(n,")"))}t.appendChild(i)}},d=e;if("auto"!==r||this._isSelectOneElement||(d=e.filter((function(e){return!e.selected}))),this._isSelectElement){var p=e.filter((function(e){return!e.element}));0!==p.length&&this.passedElement.addOptions(p)}var f=d.reduce((function(e,t){return t.placeholder?e.placeholderChoices.push(t):e.normalChoices.push(t),e}),{placeholderChoices:[],normalChoices:[]}),m=f.placeholderChoices,g=f.normalChoices;(this.config.shouldSort||this._isSearching)&&g.sort(l);var v=d.length,_=this._isSelectOneElement?n(n([],m,!0),g,!0):g;this._isSearching?v=c:a&&a>0&&!i&&(v=a);for(var y=0;y0?this._store.getGroupById(e.groupId):null;return{id:e.id,highlighted:e.highlighted,labelClass:e.labelClass,labelDescription:e.labelDescription,customProperties:e.customProperties,disabled:e.disabled,active:e.active,label:e.label,placeholder:e.placeholder,value:e.value,groupValue:i&&i.label?i.label:void 0,element:e.element,keyCode:t}}},e.prototype._triggerChange=function(e){null!=e&&this.passedElement.triggerEvent("change",{value:e})},e.prototype._selectPlaceholderChoice=function(e){this._addItem(e),e.value&&this._triggerChange(e.value)},e.prototype._handleButtonAction=function(e,t){if(0!==e.length&&this.config.removeItems&&this.config.removeItemButton){var i=t&&Me(t.parentNode),n=i&&e.find((function(e){return e.id===i}));if(n&&(this._removeItem(n),this._triggerChange(n.value),this._isSelectOneElement&&!this._hasNonChoicePlaceholder)){var s=this._store.placeholderChoice;s&&this._selectPlaceholderChoice(s)}}},e.prototype._handleItemAction=function(e,t,i){var n=this;if(void 0===i&&(i=!1),0!==e.length&&this.config.removeItems&&!this._isSelectOneElement){var s=Me(t);s&&(e.forEach((function(e){e.id!==s||e.highlighted?!i&&e.highlighted&&n.unhighlightItem(e):n.highlightItem(e)})),this.input.focus())}},e.prototype._handleChoiceAction=function(e,t,i){var n=this,s=Me(t),o=s&&this._store.getChoiceById(s);if(!o)return!1;var r=this.dropdown.isActive,c=!1;return this._store.withDeferRendering((function(){if(!o.selected&&!o.disabled&&n._canAddItem(e,o.value).response){if(n.config.singleModeForMultiSelect&&0!==e.length){var t=e[e.length-1];n._removeItem(t)}n.passedElement.triggerEvent("choice",n._getChoiceForOutput(o,i)),n._addItem(o),n.clearInput(),c=!0}})),!!c&&(this._triggerChange(o.value),r&&(this.config.singleModeForMultiSelect||this._isSelectOneElement)&&(this.hideDropdown(!0),this.containerOuter.focus()),!0)},e.prototype._handleBackspace=function(e){if(this.config.removeItems&&0!==e.length){var t=e[e.length-1],i=e.some((function(e){return e.highlighted}));this.config.editItems&&!i&&t?(this.input.value=t.value,this.input.setWidth(),this._removeItem(t),this._triggerChange(t.value)):(i||this.highlightItem(t,!1),this.removeHighlightedItems(!0))}},e.prototype._loadChoices=function(){var e;if(this._isTextElement){this._presetItems=this.config.items.map((function(e){return fe(e,!1)}));var t=this.passedElement.value;if(t){var i=t.split(this.config.delimiter).map((function(e){return fe(e,!1)}));this._presetItems=this._presetItems.concat(i)}this._presetItems.forEach((function(e){e.selected=!0}))}else if(this._isSelectElement){this._presetChoices=this.config.choices.map((function(e){return fe(e,!0)}));var n=this.passedElement.optionsAsChoices();n&&(e=this._presetChoices).push.apply(e,n)}},e.prototype._startLoading=function(){this._store.startDeferRendering()},e.prototype._stopLoading=function(){this._store.stopDeferRendering()},e.prototype._handleLoadingState=function(e){void 0===e&&(e=!0);var t=this.itemList.element.querySelector(te(this.config.classNames.placeholder));e?(this.disable(),this.containerOuter.addLoadingState(),this._isSelectOneElement?t?t.innerHTML=this.config.loadingText:(t=this._templates.placeholder(this.config,this.config.loadingText))&&this.itemList.append(t):this.input.placeholder=this.config.loadingText):(this.enable(),this.containerOuter.removeLoadingState(),this._isSelectOneElement?t&&(t.innerHTML=this._placeholderValue||""):this.input.placeholder=this._placeholderValue||"")},e.prototype._handleSearch=function(e){if(this.input.isFocussed){var t=this._store.choices,i=this.config,n=i.searchFloor,s=i.searchChoices,o=t.some((function(e){return!e.active}));if(null!=e&&e.length>=n){var r=s?this._searchChoices(e):0;null!==r&&this.passedElement.triggerEvent("search",{value:e,resultCount:r})}else o&&this._stopSearch()}},e.prototype._canAddItem=function(e,t){var i=this,n=!0,s="";(this.config.maxItemCount>0&&this.config.maxItemCount<=e.length&&(this.config.singleModeForMultiSelect||(n=!1,s="function"==typeof this.config.maxItemText?this.config.maxItemText(this.config.maxItemCount):this.config.maxItemText)),n&&this._canAddUserChoices&&""!==t&&"function"==typeof this.config.addItemFilter&&!this.config.addItemFilter(t)&&(n=!1,s="function"==typeof this.config.customAddItemText?this.config.customAddItemText(z(t),t):this.config.customAddItemText),!n||""===t||!this._isSelectElement&&this.config.duplicateItemsAllowed)||this._store.items.find((function(e){return i.config.valueComparer(e.value,t)}))&&(n=!1,s="function"==typeof this.config.uniqueItemText?this.config.uniqueItemText(z(t),t):this.config.uniqueItemText);return n&&(s="function"==typeof this.config.addItemText?this.config.addItemText(z(t),t):this.config.addItemText),{response:n,notice:{trusted:s}}},e.prototype._searchChoices=function(e){var t=e.trim().replace(/\s{2,}/," ");if(0===t.length||t===this._currentValue)return null;var i=this._store.searchableChoices,n=this._searchFn(this.config,i,t);return this._currentValue=t,this._highlightPosition=0,this._isSearching=!0,this._store.dispatch(function(e){return{type:"FILTER_CHOICES",results:e}}(n)),n.length},e.prototype._stopSearch=function(){var e=this._isSearching;this._currentValue="",this._isSearching=!1,e&&this._store.dispatch({type:"ACTIVATE_CHOICES",active:!0})},e.prototype._addEventListeners=function(){var e=this.config.shadowRoot||document.documentElement;e.addEventListener("touchend",this._onTouchEnd,!0),this.containerOuter.element.addEventListener("keydown",this._onKeyDown,!0),this.containerOuter.element.addEventListener("mousedown",this._onMouseDown,!0),e.addEventListener("click",this._onClick,{passive:!0}),e.addEventListener("touchmove",this._onTouchMove,{passive:!0}),this.dropdown.element.addEventListener("mouseover",this._onMouseOver,{passive:!0}),this._isSelectOneElement&&(this.containerOuter.element.addEventListener("focus",this._onFocus,{passive:!0}),this.containerOuter.element.addEventListener("blur",this._onBlur,{passive:!0})),this.input.element.addEventListener("keyup",this._onKeyUp,{passive:!0}),this.input.element.addEventListener("input",this._onInput,{passive:!0}),this.input.element.addEventListener("focus",this._onFocus,{passive:!0}),this.input.element.addEventListener("blur",this._onBlur,{passive:!0}),this.input.element.form&&this.input.element.form.addEventListener("reset",this._onFormReset,{passive:!0}),this.input.addEventListeners()},e.prototype._removeEventListeners=function(){var e=this.config.shadowRoot||document.documentElement;e.removeEventListener("touchend",this._onTouchEnd,!0),this.containerOuter.element.removeEventListener("keydown",this._onKeyDown,!0),this.containerOuter.element.removeEventListener("mousedown",this._onMouseDown,!0),e.removeEventListener("click",this._onClick),e.removeEventListener("touchmove",this._onTouchMove),this.dropdown.element.removeEventListener("mouseover",this._onMouseOver),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("input",this._onInput),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()},e.prototype._onKeyDown=function(e){var t=e.keyCode,i=this._store.items,n=this.input.isFocussed,s=this.dropdown.isActive,o=this.itemList.hasChildren(),r=1===e.key.length||2===e.key.length&&e.key.charCodeAt(0)>=55296||"Unidentified"===e.key;switch(this._isTextElement||s||(this.showDropdown(),!this.input.isFocussed&&r&&(this.input.value+=e.key)),t){case 65:return this._onSelectKey(e,o);case 13:return this._onEnterKey(e,i,s);case 27:return this._onEscapeKey(e,s);case 38:case 33:case 40:case 34:return this._onDirectionKey(e,s);case 8:case 46:return this._onDeleteKey(e,i,n)}},e.prototype._onKeyUp=function(){this._canSearch=this.config.searchEnabled},e.prototype._onInput=function(){var e=this.input.value;if(e){if(this._isTextElement){var t=this._canAddItem(this._store.items,e);t.notice&&(this._displayAddItemNotice(t),this.showDropdown(!0))}if(this._canSearch){this._handleSearch(e);var i=this._canAddItem(this._store.items,e);i.response||this._displayAddItemNotice(i),this._canAddUserChoices&&(this._highlightPosition=0,this._highlightChoice())}}else this._isTextElement?this.hideDropdown(!0):this._stopSearch()},e.prototype._displayAddItemNotice=function(e){var t=this._templates.notice(this.config,e.notice,"add-choice"),i="".concat(te(this.config.classNames.addChoice),"[data-choice-selectable]"),n=this.choiceList.element.querySelector(i);n?n.outerHTML=t.outerHTML:this.choiceList.prepend(t)},e.prototype._onSelectKey=function(e,t){var i=e.ctrlKey,n=e.metaKey;(i||n)&&t&&(this._canSearch=!1,this.config.removeItems&&!this.input.value&&this.input.element===document.activeElement&&this.highlightAll())},e.prototype._onEnterKey=function(e,t,i){var n=this,s=this.input.value,o=e.target;if(o&&o.hasAttribute("data-button"))return e.preventDefault(),void this._handleButtonAction(t,o);if(!i&&this._isSelectOneElement)return e.preventDefault(),void this.showDropdown();if(i){var r=this.dropdown.element.querySelector(te(this.config.classNames.highlightedState));if(r&&this._handleChoiceAction(t,r,13))return e.preventDefault(),void this.unhighlightAll();s||this.hideDropdown(!0)}o&&s&&this._canAddUserChoices&&(this._canAddItem(t,s).response&&(this._store.withDeferRendering((function(){if((n._isSelectOneElement||n.config.singleModeForMultiSelect)&&0!==t.length){var e=t[t.length-1];n._removeItem(e)}var i=!0;if(!n._isSelectElement&&n.config.duplicateItemsAllowed||(i=!n._findAndSelectChoiceByValue(s)),i){var o=z(s),r=n.config.allowHtmlUserInput||o===s?s:{escaped:o,raw:s};n._addChoice(fe({value:r,label:r,selected:!0},!1))}n.clearInput(),n.unhighlightAll(),n._triggerChange(s)})),(this._isTextElement||this._isSelectOneElement)&&this.hideDropdown(!0)))},e.prototype._onEscapeKey=function(e,t){t&&(e.stopPropagation(),this.hideDropdown(!0),this.containerOuter.focus())},e.prototype._onDirectionKey=function(e,t){var i,n,s,o=e.keyCode,r=e.metaKey;if(t||this._isSelectOneElement){this.showDropdown(),this._canSearch=!1;var c=40===o||34===o?1:-1,a="[data-choice-selectable]",h=void 0;if(r||34===o||33===o)h=c>0?this.dropdown.element.querySelector("".concat(a,":last-of-type")):this.dropdown.element.querySelector(a);else{var l=this.dropdown.element.querySelector(te(this.config.classNames.highlightedState));h=l?function(e,t,i){void 0===i&&(i=1);for(var n="".concat(i>0?"next":"previous","ElementSibling"),s=e[n];s;){if(s.matches(t))return s;s=s[n]}return s}(l,a,c):this.dropdown.element.querySelector(a)}h&&(i=h,n=this.choiceList.element,void 0===(s=c)&&(s=1),i&&(s>0?n.scrollTop+n.offsetHeight>=i.offsetTop+i.offsetHeight:i.offsetTop>=n.scrollTop)||this.choiceList.scrollToChildElement(h,c),this._highlightChoice(h)),e.preventDefault()}},e.prototype._onDeleteKey=function(e,t,i){var n=e.target;this._isSelectOneElement||n.value||!i||(this._handleBackspace(t),e.preventDefault())},e.prototype._onTouchMove=function(){this._wasTap&&(this._wasTap=!1)},e.prototype._onTouchEnd=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},e.prototype._onMouseDown=function(e){var t=e.target;if(t instanceof HTMLElement){if(xe&&this.choiceList.element.contains(t)){var i=this.choiceList.element.firstElementChild;this._isScrollingOnIe="ltr"===this._direction?e.offsetX>=i.offsetWidth:e.offsetX0&&this.unhighlightAll(),this.containerOuter.removeFocusState(),this.hideDropdown(!0))},e.prototype._onFocus=function(e){var t,i=this,n=e.target;n&&this.containerOuter.element.contains(n)&&((t={})[se]=function(){n===i.input.element&&i.containerOuter.addFocusState()},t[oe]=function(){i.containerOuter.addFocusState(),n===i.input.element&&i.showDropdown(!0)},t[re]=function(){n===i.input.element&&(i.showDropdown(!0),i.containerOuter.addFocusState())},t)[this._elementType]()},e.prototype._onBlur=function(e){var t,i=this,n=e.target;if(n&&this.containerOuter.element.contains(n)&&!this._isScrollingOnIe){var s=this._store.activeChoices.some((function(e){return e.highlighted}));((t={})[se]=function(){n===i.input.element&&(i.containerOuter.removeFocusState(),s&&i.unhighlightAll(),i.hideDropdown(!0))},t[oe]=function(){i.containerOuter.removeFocusState(),(n===i.input.element||n===i.containerOuter.element&&!i._canSearch)&&i.hideDropdown(!0)},t[re]=function(){n===i.input.element&&(i.containerOuter.removeFocusState(),i.hideDropdown(!0),s&&i.unhighlightAll())},t)[this._elementType]()}else this._isScrollingOnIe=!1,this.input.element.focus()},e.prototype._onFormReset=function(){var e=this;this._store.withDeferRendering((function(){e.clearInput(),e.hideDropdown(),e.refresh(!1,!1,!0),0!==e._initialItems.length&&e.setChoiceByValue(e._initialItems)}))},e.prototype._highlightChoice=function(e){var t,i=this;void 0===e&&(e=null);var n=Array.from(this.dropdown.element.querySelectorAll("[data-choice-selectable]"));if(n.length){var s=e;Array.from(this.dropdown.element.querySelectorAll(te(this.config.classNames.highlightedState))).forEach((function(e){var t;(t=e.classList).remove.apply(t,ee(i.config.classNames.highlightedState)),e.setAttribute("aria-selected","false")})),s?this._highlightPosition=n.indexOf(s):(s=n.length>this._highlightPosition?n[this._highlightPosition]:n[n.length-1])||(s=n[0]),(t=s.classList).add.apply(t,ee(this.config.classNames.highlightedState)),s.setAttribute("aria-selected","true"),this.passedElement.triggerEvent("highlightChoice",{el:s}),this.dropdown.isActive&&(this.input.setActiveDescendant(s.id),this.containerOuter.setActiveDescendant(s.id))}},e.prototype._addItem=function(e,t){void 0===t&&(t=!0);var i=e.id;if(0===i)throw new TypeError("item.id must be set before _addItem is called for a choice/item");this._store.dispatch(function(e){return{type:"ADD_ITEM",item:e}}(e)),this._isSelectOneElement&&this.removeActiveItems(i),t&&this.passedElement.triggerEvent("addItem",this._getChoiceForOutput(e))},e.prototype._removeItem=function(e){e.id&&(this._store.dispatch(function(e){return{type:"REMOVE_ITEM",item:e}}(e)),this.passedElement.triggerEvent("removeItem",this._getChoiceForOutput(e)))},e.prototype._addChoice=function(e,t){if(void 0===t&&(t=!0),0!==e.id)throw new TypeError("Can not re-add a choice which has already been added");var i=e;this._lastAddedChoiceId++,i.id=this._lastAddedChoiceId,i.elementId="".concat(this._baseId,"-").concat(this._idNames.itemChoice,"-").concat(i.id),this.config.prependValue&&(i.value=this.config.prependValue+i.value),this.config.appendValue&&(i.value+=this.config.appendValue.toString()),(this.config.prependValue||this.config.appendValue)&&i.element&&(i.element.value=i.value),this._store.dispatch(function(e){return{type:"ADD_CHOICE",choice:e}}(e)),e.selected&&this._addItem(e,t)},e.prototype._addGroup=function(e,t){var i=this;if(void 0===t&&(t=!0),0!==e.id)throw new TypeError("Can not re-add a group which has already been added");if(this._store.dispatch(function(e){return{type:"ADD_GROUP",group:e}}(e)),e.choices){var n=e;this._lastAddedGroupId++,n.id=this._lastAddedGroupId;var s=e.id,o=e.choices;n.choices=[],o.forEach((function(n){var o=n;o.groupId=s,e.disabled&&(o.disabled=!0),i._addChoice(o,t)}))}},e.prototype._getTemplate=function(e){for(var t,i=[],s=1;s/g,">").replace(/0?this.element.scrollTop+r-s:e.offsetTop;requestAnimationFrame((function(){i._animateScroll(a,t)}))}},e.prototype._scrollDown=function(e,t,i){var n=(i-e)/t,s=n>1?n:1;this.element.scrollTop=e+s},e.prototype._scrollUp=function(e,t,i){var n=(e-i)/t,s=n>1?n:1;this.element.scrollTop=e-s},e.prototype._animateScroll=function(e,t){var i=this,n=this.element.scrollTop,s=!1;t>0?(this._scrollDown(n,4,e),ne&&(s=!0)),s&&requestAnimationFrame((function(){i._animateScroll(e,t)}))},e}(),I=function(){function e(e){var t=e.element,i=e.classNames;this.element=t,this.classNames=i,this.isDisabled=!1}return Object.defineProperty(e.prototype,"isActive",{get:function(){return"active"===this.element.dataset.choice},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"dir",{get:function(){return this.element.dir},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"value",{get:function(){return this.element.value},set:function(e){this.element.setAttribute("value",e),this.element.value=e},enumerable:!1,configurable:!0}),e.prototype.conceal=function(){var e;(e=this.element.classList).add.apply(e,p(this.classNames.input)),this.element.hidden=!0,this.element.tabIndex=-1;var t=this.element.getAttribute("style");t&&this.element.setAttribute("data-choice-orig-style",t),this.element.setAttribute("data-choice","active")},e.prototype.reveal=function(){var e;(e=this.element.classList).remove.apply(e,p(this.classNames.input)),this.element.hidden=!1,this.element.removeAttribute("tabindex");var t=this.element.getAttribute("data-choice-orig-style");t?(this.element.removeAttribute("data-choice-orig-style"),this.element.setAttribute("style",t)):this.element.removeAttribute("style"),this.element.removeAttribute("data-choice"),this.element.value=this.element.value},e.prototype.enable=function(){this.element.removeAttribute("disabled"),this.element.disabled=!1,this.isDisabled=!1},e.prototype.disable=function(){this.element.setAttribute("disabled",""),this.element.disabled=!0,this.isDisabled=!0},e.prototype.triggerEvent=function(e,t){!function(e,t,i){void 0===i&&(i=null);var n=new CustomEvent(t,{detail:i,bubbles:!0,cancelable:!0});e.dispatchEvent(n)}(this.element,e,t)},e}(),w=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return t(i,e),i}(I),S=function(e,t){return void 0===t&&(t=!0),void 0===e?t:!!e},O=function(e){if("string"==typeof e&&(e=e.split(" ").filter((function(e){return 0!==e.length}))),Array.isArray(e)&&0!==e.length)return e},A=function(e,t){if("string"==typeof e)return A({value:e,label:e},!1);var i=e;if("choices"in i){if(!t)throw new TypeError("optGroup is not allowed");var n=i,s=n.choices.map((function(e){return A(e,!1)}));return{id:0,label:u(n.label)||n.value,active:0!==s.length,disabled:!!n.disabled,choices:s}}var o=i;return{id:0,groupId:0,score:0,value:o.value,label:o.label||o.value,active:S(o.active),selected:S(o.selected,!1),disabled:S(o.disabled,!1),placeholder:S(o.placeholder,!1),highlighted:!1,labelClass:O(o.labelClass),labelDescription:o.labelDescription,customProperties:o.customProperties}},T=function(e){function i(t){var i=t.element,n=t.classNames,s=t.template,o=t.extractPlaceholder,r=e.call(this,{element:i,classNames:n})||this;return r.template=s,r.extractPlaceholder=o,r}return t(i,e),Object.defineProperty(i.prototype,"placeholderOption",{get:function(){return this.element.querySelector('option[value=""]')||this.element.querySelector("option[placeholder]")},enumerable:!1,configurable:!0}),i.prototype.addOptions=function(e){var t=this;e.forEach((function(e){var i=e;if(!i.element){var n=t.template(i);t.element.appendChild(n),i.element=n}}))},i.prototype.optionsAsChoices=function(){var e=this,t=[];return this.element.querySelectorAll(":scope > option, :scope > optgroup").forEach((function(i){!function(e){return"OPTION"===e.tagName}(i)?function(e){return"OPTGROUP"===e.tagName}(i)&&t.push(e._optgroupToChoice(i)):t.push(e._optionToChoice(i))})),t},i.prototype._optionToChoice=function(e){return{id:0,groupId:0,score:0,value:e.value,label:e.innerHTML,element:e,active:!0,selected:this.extractPlaceholder?e.selected:e.hasAttribute("selected"),disabled:e.disabled,highlighted:!1,placeholder:this.extractPlaceholder&&(""===e.value||e.hasAttribute("placeholder")),labelClass:void 0!==e.dataset.labelClass?O(e.dataset.labelClass):void 0,labelDescription:void 0!==e.dataset.labelDescription?e.dataset.labelDescription:void 0,customProperties:f(e.dataset.customProperties)}},i.prototype._optgroupToChoice=function(e){var t=this,i=e.querySelectorAll("option"),n=Array.from(i).map((function(e){return t._optionToChoice(e)}));return{id:0,label:e.label||"",element:e,active:0!==n.length,disabled:e.disabled,choices:n}},i}(I),L={items:[],choices:[],silent:!1,renderChoiceLimit:-1,maxItemCount:-1,singleModeForMultiSelect:!1,addChoices:!1,addItems:!0,addItemFilter:function(e){return!!e&&""!==e},removeItems:!0,removeItemButton:!1,removeItemButtonAlignLeft:!1,editItems:!1,allowHTML:!1,allowHtmlUserInput:!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,sorter:function(e,t){var i=e.value,n=e.label,s=void 0===n?i:n,o=t.value,r=t.label,a=void 0===r?o:r;return u(s).localeCompare(u(a),[],{sensitivity:"base",ignorePunctuation:!0,numeric:!0})},shadowRoot:null,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 "'.concat(e,'"')},removeItemIconText:function(){return"Remove item"},removeItemLabelText:function(e){return"Remove item: ".concat(e)},maxItemText:function(e){return"Only ".concat(e," values can be added")},valueComparer:function(e,t){return e===t},fuseOptions:{includeScore:!0},labelId:"",callbackOnInit:null,callbackOnCreateTemplates:null,classNames:{containerOuter:["choices"],containerInner:["choices__inner"],input:["choices__input"],inputCloned:["choices__input--cloned"],list:["choices__list"],listItems:["choices__list--multiple"],listSingle:["choices__list--single"],listDropdown:["choices__list--dropdown"],item:["choices__item"],itemSelectable:["choices__item--selectable"],itemDisabled:["choices__item--disabled"],itemChoice:["choices__item--choice"],description:["choices__description"],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"],selectedState:["is-selected"],flippedState:["is-flipped"],loadingState:["is-loading"],addChoice:["choices__item","choices__item--selectable","add-choice"],noResults:["has-no-results"],noChoices:["has-no-choices"]},appendGroupInSearch:!1},D=["fuseOptions","classNames"];function N(e){return"Minified Redux error #"+e+"; visit https://redux.js.org/Errors?code="+e+" for the full message or use the non-minified dev environment for full errors. "}var x="function"==typeof Symbol&&Symbol.observable||"@@observable",P=function(){return Math.random().toString(36).substring(7).split("").join(".")},F={INIT:"@@redux/INIT"+P(),REPLACE:"@@redux/REPLACE"+P(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+P()}};function j(e,t,i){var n;if("function"==typeof t&&"function"==typeof i||"function"==typeof i&&"function"==typeof arguments[3])throw new Error(N(0));if("function"==typeof t&&void 0===i&&(i=t,t=void 0),void 0!==i){if("function"!=typeof i)throw new Error(N(1));return i(j)(e,t)}if("function"!=typeof e)throw new Error(N(2));var s=e,o=t,r=[],a=r,c=!1;function l(){a===r&&(a=r.slice())}function h(){if(c)throw new Error(N(3));return o}function u(e){if("function"!=typeof e)throw new Error(N(4));if(c)throw new Error(N(5));var t=!0;return l(),a.push(e),function(){if(t){if(c)throw new Error(N(6));t=!1,l();var i=a.indexOf(e);a.splice(i,1),r=null}}}function d(e){if(!function(e){if("object"!=typeof e||null===e)return!1;for(var t=e;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}(e))throw new Error(N(7));if(void 0===e.type)throw new Error(N(8));if(c)throw new Error(N(9));try{c=!0,o=s(o,e)}finally{c=!1}for(var t=r=a,i=0;i0},e.prototype.getChoiceById=function(e){return this.activeChoices.find((function(t){return t.id===e}))},e.prototype.getGroupById=function(e){return this.groups.find((function(t){return t.id===e}))},e}(),B=function(e,t){return e?function(e){if("string"==typeof e)return e;if("object"==typeof e){if("escaped"in e)return e.escaped;if("trusted"in e)return e.trusted}return""}(t):l(t)},k=function(e,t){if(t){var i=e.dataset;"string"==typeof t?i.customProperties=t:"object"!=typeof t||function(e){for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0}(t)||(i.customProperties=JSON.stringify(t))}},K={containerOuter:function(e,t,i,n,s,o,r){var a=e.classNames.containerOuter,c=Object.assign(document.createElement("div"),{className:p(a).join(" ")});return c.dataset.type=o,t&&(c.dir=t),n&&(c.tabIndex=0),i&&(c.setAttribute("role",s?"combobox":"listbox"),s&&c.setAttribute("aria-autocomplete","list")),c.setAttribute("aria-haspopup","true"),c.setAttribute("aria-expanded","false"),r&&c.setAttribute("aria-labelledby",r),c},containerInner:function(e){var t=e.classNames.containerInner;return Object.assign(document.createElement("div"),{className:p(t).join(" ")})},itemList:function(e,t){var i=e.classNames,n=i.list,s=i.listSingle,o=i.listItems;return Object.assign(document.createElement("div"),{className:"".concat(p(n).join(" ")," ").concat(t?p(s).join(" "):p(o).join(" "))})},placeholder:function(e,t){var i=e.allowHTML,n=e.classNames.placeholder;return Object.assign(document.createElement("div"),{className:p(n).join(" "),innerHTML:B(i,t)})},item:function(e,t,i){var n,s,o,r=e.allowHTML,a=e.removeItemButtonAlignLeft,c=e.classNames,h=c.item,u=c.button,d=c.highlightedState,m=c.itemSelectable,f=c.placeholder,v=t.id,g=t.value,_=t.label,y=t.labelClass,b=t.labelDescription,E=t.customProperties,C=t.active,I=t.disabled,w=t.highlighted,S=t.placeholder,O=Object.assign(document.createElement("div"),{className:p(h).join(" ")});if(y){var A=Object.assign(document.createElement("span"),{innerHTML:B(r,_),className:p(y).join(" ")});O.appendChild(A)}else O.innerHTML=B(r,_);if(Object.assign(O.dataset,{item:"",id:v,value:g}),y&&(O.dataset.labelClass=p(y).join(" ")),b&&(O.dataset.labelDescription=b),k(O,E),C&&O.setAttribute("aria-selected","true"),I&&O.setAttribute("aria-disabled","true"),S&&((n=O.classList).add.apply(n,p(f)),O.dataset.placeholder=""),(s=O.classList).add.apply(s,p(w?d:m)),i){I&&(o=O.classList).remove.apply(o,p(m)),O.dataset.deletable="";var T="function"==typeof this.config.removeItemIconText?this.config.removeItemIconText(l(g),g):this.config.removeItemIconText,L="function"==typeof this.config.removeItemLabelText?this.config.removeItemLabelText(l(g),g):this.config.removeItemLabelText,D=Object.assign(document.createElement("button"),{type:"button",className:p(u).join(" "),innerHTML:T});D.setAttribute("aria-label",L),D.dataset.button="",a?O.insertAdjacentElement("afterbegin",D):O.appendChild(D)}return O},choiceList:function(e,t){var i=e.classNames.list,n=Object.assign(document.createElement("div"),{className:p(i).join(" ")});return t||n.setAttribute("aria-multiselectable","true"),n.setAttribute("role","listbox"),n},choiceGroup:function(e,t){var i=e.allowHTML,n=e.classNames,s=n.group,o=n.groupHeading,r=n.itemDisabled,a=t.id,c=t.label,l=t.disabled,h=Object.assign(document.createElement("div"),{className:"".concat(p(s).join(" ")," ").concat(l?p(r).join(" "):"")});return h.setAttribute("role","group"),Object.assign(h.dataset,{group:"",id:a,value:c}),l&&h.setAttribute("aria-disabled","true"),h.appendChild(Object.assign(document.createElement("div"),{className:p(o).join(" "),innerHTML:B(i,c)})),h},choice:function(e,t,i){var n,s,o,r,a,c=e.allowHTML,l=e.classNames,h=l.item,u=l.itemChoice,d=l.itemSelectable,m=l.selectedState,f=l.itemDisabled,v=l.description,g=l.placeholder,_=t.id,y=t.value,b=t.label,E=t.groupId,C=t.elementId,I=t.labelClass,w=t.labelDescription,S=t.disabled,O=t.selected,A=t.placeholder,T=Object.assign(document.createElement("div"),{id:C,className:"".concat(p(h).join(" ")," ").concat(p(u).join(" "))}),L=T;if(I){var D=Object.assign(document.createElement("span"),{innerHTML:B(c,b),className:p(I).join(" ")});L=D,T.appendChild(D)}else T.innerHTML=B(c,b);if(w){var N="".concat(C,"-description");L.setAttribute("aria-describedby",N);var x=Object.assign(document.createElement("span"),{innerHTML:B(c,w),id:N});(n=x.classList).add.apply(n,p(v)),T.appendChild(x)}return O&&(s=T.classList).add.apply(s,p(m)),A&&(o=T.classList).add.apply(o,p(g)),T.setAttribute("role",E&&E>0?"treeitem":"option"),Object.assign(T.dataset,{choice:"",id:_,value:y,selectText:i}),I&&(T.dataset.labelClass=p(I).join(" ")),w&&(T.dataset.labelDescription=w),S?((r=T.classList).add.apply(r,p(f)),T.dataset.choiceDisabled="",T.setAttribute("aria-disabled","true")):((a=T.classList).add.apply(a,p(d)),T.dataset.choiceSelectable=""),T},input:function(e,t){var i=e.classNames,n=i.input,s=i.inputCloned,o=Object.assign(document.createElement("input"),{type:"search",className:"".concat(p(n).join(" ")," ").concat(p(s).join(" ")),autocomplete:"off",autocapitalize:"off",spellcheck:!1});return o.setAttribute("role","textbox"),o.setAttribute("aria-autocomplete","list"),t&&o.setAttribute("aria-label",t),o},dropdown:function(e){var t,i,n=e.classNames,s=n.list,o=n.listDropdown,r=document.createElement("div");return(t=r.classList).add.apply(t,p(s)),(i=r.classList).add.apply(i,p(o)),r.setAttribute("aria-expanded","false"),r},notice:function(e,t,i){var s=e.allowHTML,o=e.classNames,r=o.item,a=o.itemChoice,c=o.addChoice,l=o.noResults,h=o.noChoices;void 0===i&&(i="");var u=n(n([],p(r),!0),p(a),!0);switch(i){case"add-choice":u.push.apply(u,p(c));break;case"no-results":u.push.apply(u,p(l));break;case"no-choices":u.push.apply(u,p(h))}var d=Object.assign(document.createElement("div"),{innerHTML:B(s,t),className:u.join(" ")});return"add-choice"===i&&(d.dataset.choiceSelectable="",d.dataset.choice=""),d},option:function(e){var t=e.label,i=e.value,n=e.labelClass,s=e.labelDescription,o=e.customProperties,r=e.active,a=e.disabled,c=u(t),l=new Option(c,i,!1,r);return n&&(l.dataset.labelClass=p(n).join(" ")),s&&(l.dataset.labelDescription=s),k(l,o),l.disabled=a,l}},U="-ms-scroll-limit"in document.documentElement.style&&"-ms-ime-align"in document.documentElement.style,q={},G=function(e){if(e){var t=e.dataset.id;return t?parseInt(t,10):void 0}},W=function(){function e(t,n){void 0===t&&(t="[data-choice]"),void 0===n&&(n={});var s=this;this._hasNonChoicePlaceholder=!1,this._lastAddedChoiceId=0,this._lastAddedGroupId=0,this.config=i(i(i({},e.defaults.allOptions),e.defaults.options),n),D.forEach((function(t){s.config[t]=i(i(i({},e.defaults.allOptions[t]),e.defaults.options[t]),n[t])}));var r,a,l,h,u=(r=this.config,a=L,l=Object.keys(r).sort(),h=Object.keys(a).sort(),l.filter((function(e){return h.indexOf(e)<0})));u.length&&console.warn("Unknown config option(s) passed",u.join(", ")),!this.config.silent&&this.config.allowHTML&&this.config.allowHtmlUserInput&&(this.config.addItems&&console.warn("Warning: allowHTML/allowHtmlUserInput/addItems all being true is strongly not recommended and may lead to XSS attacks"),this.config.addChoices&&console.warn("Warning: allowHTML/allowHtmlUserInput/addChoices all being true is strongly not recommended and may lead to XSS attacks"));var d=this.config.shadowRoot||document.documentElement,p="string"==typeof t?d.querySelector(t):t;if(!p||"object"!=typeof p||"INPUT"!==p.tagName&&!function(e){return"SELECT"===e.tagName}(p)){if(!p&&"string"==typeof t)throw TypeError("Selector ".concat(t," failed to find an element"));throw TypeError("Expected one of the following types text|select-one|select-multiple")}if(this._elementType=p.type,this._isTextElement=this._elementType===g,(this._isTextElement||1!==this.config.maxItemCount)&&(this.config.singleModeForMultiSelect=!1),this.config.singleModeForMultiSelect&&(this._elementType=y),this._isSelectOneElement=this._elementType===_,this._isSelectMultipleElement=this._elementType===y,this._isSelectElement=this._isSelectOneElement||this._isSelectMultipleElement,this._canAddUserChoices=this._isTextElement&&this.config.addItems||this._isSelectElement&&this.config.addChoices,["auto","always"].includes("".concat(this.config.renderSelectedChoices))||(this.config.renderSelectedChoices="auto"),this.config.placeholder&&(this.config.placeholderValue?this._hasNonChoicePlaceholder=!0:p.dataset.placeholder&&(this._hasNonChoicePlaceholder=!0,this.config.placeholderValue=p.dataset.placeholder)),n.addItemFilter&&"function"!=typeof n.addItemFilter){var m=n.addItemFilter instanceof RegExp?n.addItemFilter:new RegExp(n.addItemFilter);this.config.addItemFilter=m.test.bind(m)}if(this._isTextElement)this.passedElement=new w({element:p,classNames:this.config.classNames});else{var f=p;this.passedElement=new T({element:f,classNames:this.config.classNames,template:function(e){return s._templates.option(e)},extractPlaceholder:this.config.placeholder&&!this._hasNonChoicePlaceholder})}if(this.initialised=!1,this._store=new V,this._initialState=M,this._currentState=M,this._prevState=M,this._currentValue="",this.config.searchEnabled=!this._isTextElement&&this.config.searchEnabled||this._elementType===y,this._canSearch=this.config.searchEnabled,this._isScrollingOnIe=!1,this._highlightPosition=0,this._wasTap=!0,this._placeholderValue=this._generatePlaceholderValue(),this._baseId=function(e,t){var i=e.id||e.name&&"".concat(e.name,"-").concat(c(2))||c(4);return i=i.replace(/(:|\.|\[|\]|,)/g,""),"".concat(t,"-").concat(i)}(this.passedElement.element,"choices-"),this._searchFn=o,this._direction=this.passedElement.dir,!this._direction){var v=window.getComputedStyle(this.passedElement.element).direction;v!==window.getComputedStyle(document.documentElement).direction&&(this._direction=v)}if(this._idNames={itemChoice:"item-choice"},this._render=this._render.bind(this),this._onFocus=this._onFocus.bind(this),this._onBlur=this._onBlur.bind(this),this._onKeyUp=this._onKeyUp.bind(this),this._onKeyDown=this._onKeyDown.bind(this),this._onInput=this._onInput.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._onSelectKey=this._onSelectKey.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),this.passedElement.isActive)return this.config.silent||console.warn("Trying to initialise Choices on element already initialised",{element:t}),void(this.initialised=!0);this.init(),this._initialItems=this._store.items.map((function(e){return e.value}))}return Object.defineProperty(e,"defaults",{get:function(){return Object.preventExtensions({get options(){return q},get allOptions(){return L},get templates(){return K}})},enumerable:!1,configurable:!0}),e.prototype.init=function(){if(!this.initialised){this._loadChoices(),this._createTemplates(),this._createElements(),this._createStructure(),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&&"function"==typeof e&&e.call(this)}},e.prototype.destroy=function(){this.initialised&&(this._removeEventListeners(),this.passedElement.reveal(),this.containerOuter.unwrap(this.passedElement.element),this.clearStore(),this._stopSearch(),this._templates=K,this.initialised=!1)},e.prototype.enable=function(){return this.passedElement.isDisabled&&this.passedElement.enable(),this.containerOuter.isDisabled&&(this._addEventListeners(),this.input.enable(),this.containerOuter.enable()),this},e.prototype.disable=function(){return this.passedElement.isDisabled||this.passedElement.disable(),this.containerOuter.isDisabled||(this._removeEventListeners(),this.input.disable(),this.containerOuter.disable()),this},e.prototype.highlightItem=function(e,t){if(void 0===t&&(t=!0),!e||!e.id)return this;var i=this._store.choices.find((function(t){return t.id===e.id}));return!i||i.highlighted||(this._store.dispatch(r(i,!0)),t&&this.passedElement.triggerEvent("highlightItem",this._getChoiceForOutput(i))),this},e.prototype.unhighlightItem=function(e,t){if(void 0===t&&(t=!0),!e||!e.id)return this;var i=this._store.choices.find((function(t){return t.id===e.id}));return i&&i.highlighted?(this._store.dispatch(r(i,!1)),t&&this.passedElement.triggerEvent("highlightItem",this._getChoiceForOutput(i)),this):this},e.prototype.highlightAll=function(){var e=this;return this._store.withDeferRendering((function(){e._store.items.forEach((function(t){return e.highlightItem(t)}))})),this},e.prototype.unhighlightAll=function(){var e=this;return this._store.withDeferRendering((function(){e._store.items.forEach((function(t){return e.unhighlightItem(t)}))})),this},e.prototype.removeActiveItemsByValue=function(e){var t=this;return this._store.withDeferRendering((function(){t._store.items.filter((function(t){return t.value===e})).forEach((function(e){return t._removeItem(e)}))})),this},e.prototype.removeActiveItems=function(e){var t=this;return this._store.withDeferRendering((function(){t._store.items.filter((function(t){return t.id!==e})).forEach((function(e){return t._removeItem(e)}))})),this},e.prototype.removeHighlightedItems=function(e){var t=this;return void 0===e&&(e=!1),this._store.withDeferRendering((function(){t._store.highlightedActiveItems.forEach((function(i){t._removeItem(i),e&&t._triggerChange(i.value)}))})),this},e.prototype.showDropdown=function(e){var t=this;return this.dropdown.isActive||requestAnimationFrame((function(){t.dropdown.show(),t.containerOuter.open(t.dropdown.distanceFromTopWindow),!e&&t._canSearch&&t.input.focus(),t.passedElement.triggerEvent("showDropdown",{})})),this},e.prototype.hideDropdown=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("hideDropdown",{})})),this):this},e.prototype.getValue=function(e){var t=this;void 0===e&&(e=!1);var i=this._store.items.reduce((function(i,n){var s=e?n.value:t._getChoiceForOutput(n);return i.push(s),i}),[]);return this._isSelectOneElement||this.config.singleModeForMultiSelect?i[0]:i},e.prototype.setValue=function(e){var t=this;return this.initialised?(this._store.withDeferRendering((function(){e.forEach((function(e){e&&t._addChoice(A(e,!1))}))})),this):this},e.prototype.setChoiceByValue=function(e){var t=this;return!this.initialised||this._isTextElement||this._store.withDeferRendering((function(){(Array.isArray(e)?e:[e]).forEach((function(e){return t._findAndSelectChoiceByValue(e)}))})),this},e.prototype.setChoices=function(e,t,n,s){var o=this;if(void 0===e&&(e=[]),void 0===t&&(t="value"),void 0===n&&(n="label"),void 0===s&&(s=!1),!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("string"!=typeof t||!t)throw new TypeError("value parameter must be a name of 'value' field in passed objects");if(s&&this.clearChoices(),"function"==typeof e){var r=e(this);if("function"==typeof Promise&&r instanceof Promise)return new Promise((function(e){return requestAnimationFrame(e)})).then((function(){return o._handleLoadingState(!0)})).then((function(){return r})).then((function(e){return o.setChoices(e,t,n,s)})).catch((function(e){o.config.silent||console.error(e)})).then((function(){return o._handleLoadingState(!1)})).then((function(){return o}));if(!Array.isArray(r))throw new TypeError(".setChoices first argument function must return either array of choices or Promise, got: ".concat(typeof r));return this.setChoices(r,t,n,!1)}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");return this.containerOuter.removeLoadingState(),this._store.withDeferRendering((function(){var s="value"===t,r="label"===n;e.forEach((function(e){if("choices"in e){var a=e;r||(a=i(i({},a),{label:a[n]})),o._addGroup(A(a,!0))}else{var c=e;r&&s||(c=i(i({},c),{value:c[t],label:c[n]})),o._addChoice(A(c,!1))}}))})),this},e.prototype.refresh=function(e,t,i){var n=this;return void 0===e&&(e=!1),void 0===t&&(t=!1),void 0===i&&(i=!1),this._isSelectElement?(this._store.withDeferRendering((function(){var s=n.passedElement.optionsAsChoices(),o=n._store.items,r={};i||o.forEach((function(e){e.id&&e.active&&e.selected&&!e.disabled&&(r[e.value]=!0)})),s.forEach((function(e){if(!("choices"in e)){var t=e;i?t.selected=!1:r[t.value]&&(t.selected=!0)}})),n.clearStore(),n._addPredefinedChoices(s,t,e),n._isSearching&&n._searchChoices(n.input.value)})),this):(this.config.silent||console.warn("refresh method can only be used on choices backed by a element"),this)},e.prototype.removeChoice=function(e){var t=this._store.choices.find((function(t){return t.value===e}));return t?(this._store.dispatch(function(e){return{type:"REMOVE_CHOICE",choice:e}}(t)),t.selected&&this.passedElement.triggerEvent("removeItem",this._getChoiceForOutput(t)),this):this},e.prototype.clearChoices=function(){return this._store.dispatch({type:"CLEAR_CHOICES"}),this},e.prototype.clearStore=function(){return this._store.dispatch({type:"CLEAR_ALL"}),this._lastAddedChoiceId=0,this._lastAddedGroupId=0,this},e.prototype.clearInput=function(){var e=!this._isSelectOneElement;return this.input.clear(e),this._isSearching&&this._stopSearch(),this},e.prototype._render=function(){if(!this._store.isLoading()){this._currentState=this._store.state;var e=this._currentState.items!==this._prevState.items;(this._currentState.choices!==this._prevState.choices||this._currentState.groups!==this._prevState.groups||e)&&(this._isSelectElement&&this._renderChoices(),e&&this._renderItems(),this._prevState=this._currentState)}},e.prototype._renderChoices=function(){var e=this,t=this._store,i=t.activeGroups,n=t.activeChoices,s=document.createDocumentFragment();if(this.choiceList.clear(),this.config.resetScrollPosition&&requestAnimationFrame((function(){return e.choiceList.scrollToTop()})),i.length>=1&&!this._isSearching){var o=n.filter((function(e){return e.placeholder&&-1===e.groupId}));o.length>=1&&(s=this._createChoicesFragment(o,s)),s=this._createGroupsFragment(i,n,s)}else n.length>=1&&(s=this._createChoicesFragment(n,s));var r=this.input.value,a=this._canAddItem(this._store.items,r);if(s.childNodes&&s.childNodes.length>0){var c=!a.response;if(a.response&&(this.choiceList.append(s),this._highlightChoice(),this._canAddUserChoices&&r&&a.notice&&(c=!n.find((function(t){return e.config.valueComparer(t.value,r)})))),c){var l=this._templates.notice(this.config,a.notice,this._canAddUserChoices?"add-choice":"");this.choiceList.prepend(l)}}else{var h=void 0;if(a.response&&this._canAddUserChoices&&r)h=this._templates.notice(this.config,a.notice,"add-choice");else if(this._isSearching){l="function"==typeof this.config.noResultsText?this.config.noResultsText():this.config.noResultsText;h=this._templates.notice(this.config,l,"no-results")}else{l="function"==typeof this.config.noChoicesText?this.config.noChoicesText():this.config.noChoicesText;h=this._templates.notice(this.config,l,"no-choices")}this.choiceList.append(h)}},e.prototype._renderItems=function(){var e=this._store.items||[];this.itemList.clear();var t=this._createItemsFragment(e);t.childNodes&&this.itemList.append(t)},e.prototype._createGroupsFragment=function(e,t,i){var n=this;void 0===i&&(i=document.createDocumentFragment());this.config.shouldSort&&e.sort(this.config.sorter);var s=t.filter((function(e){return 0===e.groupId}));return s.length>0&&this._createChoicesFragment(s,i,!1),e.forEach((function(e){var s=function(e){return t.filter((function(t){return n._isSelectOneElement?t.groupId===e.id:t.groupId===e.id&&("always"===n.config.renderSelectedChoices||!t.selected)}))}(e);if(s.length>=1){var o=n._templates.choiceGroup(n.config,e);i.appendChild(o),n._createChoicesFragment(s,i,!0)}})),i},e.prototype._createChoicesFragment=function(e,t,i){var s=this;void 0===t&&(t=document.createDocumentFragment()),void 0===i&&(i=!1);var o=this.config,r=o.renderSelectedChoices,a=o.searchResultLimit,c=o.renderChoiceLimit,l=o.appendGroupInSearch,h=this._isSearching?d:this.config.sorter,u=function(e){if("auto"!==r||(s._isSelectOneElement||!e.selected)){var i=s._templates.choice(s.config,e,s.config.itemSelectText);if(l){var n="";s._store.groups.every((function(t){return t.id!==e.groupId||(n=t.label,!1)})),n&&s._isSearching&&(i.innerHTML+=" (".concat(n,")"))}t.appendChild(i)}},p=e;if("auto"!==r||this._isSelectOneElement||(p=e.filter((function(e){return!e.selected}))),this._isSelectElement){var m=e.filter((function(e){return!e.element}));0!==m.length&&this.passedElement.addOptions(m)}var f=p.reduce((function(e,t){return t.placeholder?e.placeholderChoices.push(t):e.normalChoices.push(t),e}),{placeholderChoices:[],normalChoices:[]}),v=f.placeholderChoices,g=f.normalChoices;(this.config.shouldSort||this._isSearching)&&g.sort(h);var _=p.length,y=this._isSelectOneElement?n(n([],v,!0),g,!0):g;this._isSearching?_=a:c&&c>0&&!i&&(_=c);for(var b=0;b<_;b+=1)y[b]&&u(y[b]);return t},e.prototype._createItemsFragment=function(e,t){var i=this;void 0===t&&(t=document.createDocumentFragment());var n=this.config,s=n.shouldSortItems,o=n.sorter,r=n.removeItemButton;s&&!this._isSelectOneElement&&e.sort(o),this._isTextElement&&(this.passedElement.value=e.map((function(e){return e.value})).join(this.config.delimiter));var a=function(e){var n=i._templates.item(i.config,e,r);t.appendChild(n)};return e.forEach(a),this._isSelectOneElement&&this._hasNonChoicePlaceholder&&0===e.length&&a(A({selected:!0,value:"",label:this.config.placeholderValue||"",active:!0,placeholder:!0},!1)),t},e.prototype._getChoiceForOutput=function(e,t){if(e){var i=e.groupId>0?this._store.getGroupById(e.groupId):null;return{id:e.id,highlighted:e.highlighted,labelClass:e.labelClass,labelDescription:e.labelDescription,customProperties:e.customProperties,disabled:e.disabled,active:e.active,label:e.label,placeholder:e.placeholder,value:e.value,groupValue:i&&i.label?i.label:void 0,element:e.element,keyCode:t}}},e.prototype._triggerChange=function(e){null!=e&&this.passedElement.triggerEvent("change",{value:e})},e.prototype._selectPlaceholderChoice=function(e){this._addItem(e),e.value&&this._triggerChange(e.value)},e.prototype._handleButtonAction=function(e,t){if(0!==e.length&&this.config.removeItems&&this.config.removeItemButton){var i=t&&G(t.parentNode),n=i&&e.find((function(e){return e.id===i}));if(n&&(this._removeItem(n),this._triggerChange(n.value),this._isSelectOneElement&&!this._hasNonChoicePlaceholder)){var s=this._store.placeholderChoice;s&&this._selectPlaceholderChoice(s)}}},e.prototype._handleItemAction=function(e,t,i){var n=this;if(void 0===i&&(i=!1),0!==e.length&&this.config.removeItems&&!this._isSelectOneElement){var s=G(t);s&&(e.forEach((function(e){e.id!==s||e.highlighted?!i&&e.highlighted&&n.unhighlightItem(e):n.highlightItem(e)})),this.input.focus())}},e.prototype._handleChoiceAction=function(e,t,i){var n=this,s=G(t),o=s&&this._store.getChoiceById(s);if(!o)return!1;var r=this.dropdown.isActive,a=!1;return this._store.withDeferRendering((function(){if(!o.selected&&!o.disabled&&n._canAddItem(e,o.value).response){if(n.config.singleModeForMultiSelect&&0!==e.length){var t=e[e.length-1];n._removeItem(t)}n.passedElement.triggerEvent("choice",n._getChoiceForOutput(o,i)),n._addItem(o),n.clearInput(),a=!0}})),!!a&&(this._triggerChange(o.value),r&&(this.config.singleModeForMultiSelect||this._isSelectOneElement)&&(this.hideDropdown(!0),this.containerOuter.focus()),!0)},e.prototype._handleBackspace=function(e){if(this.config.removeItems&&0!==e.length){var t=e[e.length-1],i=e.some((function(e){return e.highlighted}));this.config.editItems&&!i&&t?(this.input.value=t.value,this.input.setWidth(),this._removeItem(t),this._triggerChange(t.value)):(i||this.highlightItem(t,!1),this.removeHighlightedItems(!0))}},e.prototype._loadChoices=function(){var e;if(this._isTextElement){this._presetItems=this.config.items.map((function(e){return A(e,!1)}));var t=this.passedElement.value;if(t){var i=t.split(this.config.delimiter).map((function(e){return A(e,!1)}));this._presetItems=this._presetItems.concat(i)}this._presetItems.forEach((function(e){e.selected=!0}))}else if(this._isSelectElement){this._presetChoices=this.config.choices.map((function(e){return A(e,!0)}));var n=this.passedElement.optionsAsChoices();n&&(e=this._presetChoices).push.apply(e,n)}},e.prototype._startLoading=function(){this._store.startDeferRendering()},e.prototype._stopLoading=function(){this._store.stopDeferRendering()},e.prototype._handleLoadingState=function(e){void 0===e&&(e=!0);var t=this.itemList.element.querySelector(m(this.config.classNames.placeholder));e?(this.disable(),this.containerOuter.addLoadingState(),this._isSelectOneElement?t?t.innerHTML=this.config.loadingText:(t=this._templates.placeholder(this.config,this.config.loadingText))&&this.itemList.append(t):this.input.placeholder=this.config.loadingText):(this.enable(),this.containerOuter.removeLoadingState(),this._isSelectOneElement?t&&(t.innerHTML=this._placeholderValue||""):this.input.placeholder=this._placeholderValue||"")},e.prototype._handleSearch=function(e){if(this.input.isFocussed){var t=this._store.choices,i=this.config,n=i.searchFloor,s=i.searchChoices,o=t.some((function(e){return!e.active}));if(null!=e&&e.length>=n){var r=s?this._searchChoices(e):0;null!==r&&this.passedElement.triggerEvent("search",{value:e,resultCount:r})}else o&&this._stopSearch()}},e.prototype._canAddItem=function(e,t){var i=this,n=!0,s="";(this.config.maxItemCount>0&&this.config.maxItemCount<=e.length&&(this.config.singleModeForMultiSelect||(n=!1,s="function"==typeof this.config.maxItemText?this.config.maxItemText(this.config.maxItemCount):this.config.maxItemText)),n&&this._canAddUserChoices&&""!==t&&"function"==typeof this.config.addItemFilter&&!this.config.addItemFilter(t)&&(n=!1,s="function"==typeof this.config.customAddItemText?this.config.customAddItemText(l(t),t):this.config.customAddItemText),!n||""===t||!this._isSelectElement&&this.config.duplicateItemsAllowed)||this._store.items.find((function(e){return i.config.valueComparer(e.value,t)}))&&(n=!1,s="function"==typeof this.config.uniqueItemText?this.config.uniqueItemText(l(t),t):this.config.uniqueItemText);return n&&(s="function"==typeof this.config.addItemText?this.config.addItemText(l(t),t):this.config.addItemText),{response:n,notice:{trusted:s}}},e.prototype._searchChoices=function(e){var t=e.trim().replace(/\s{2,}/," ");if(0===t.length||t===this._currentValue)return null;var i=this._store.searchableChoices,n=this._searchFn(this.config,i,t);return this._currentValue=t,this._highlightPosition=0,this._isSearching=!0,this._store.dispatch(function(e){return{type:"FILTER_CHOICES",results:e}}(n)),n.length},e.prototype._stopSearch=function(){var e=this._isSearching;this._currentValue="",this._isSearching=!1,e&&this._store.dispatch({type:"ACTIVATE_CHOICES",active:!0})},e.prototype._addEventListeners=function(){var e=this.config.shadowRoot||document.documentElement;e.addEventListener("touchend",this._onTouchEnd,!0),this.containerOuter.element.addEventListener("keydown",this._onKeyDown,!0),this.containerOuter.element.addEventListener("mousedown",this._onMouseDown,!0),e.addEventListener("click",this._onClick,{passive:!0}),e.addEventListener("touchmove",this._onTouchMove,{passive:!0}),this.dropdown.element.addEventListener("mouseover",this._onMouseOver,{passive:!0}),this._isSelectOneElement&&(this.containerOuter.element.addEventListener("focus",this._onFocus,{passive:!0}),this.containerOuter.element.addEventListener("blur",this._onBlur,{passive:!0})),this.input.element.addEventListener("keyup",this._onKeyUp,{passive:!0}),this.input.element.addEventListener("input",this._onInput,{passive:!0}),this.input.element.addEventListener("focus",this._onFocus,{passive:!0}),this.input.element.addEventListener("blur",this._onBlur,{passive:!0}),this.input.element.form&&this.input.element.form.addEventListener("reset",this._onFormReset,{passive:!0}),this.input.addEventListeners()},e.prototype._removeEventListeners=function(){var e=this.config.shadowRoot||document.documentElement;e.removeEventListener("touchend",this._onTouchEnd,!0),this.containerOuter.element.removeEventListener("keydown",this._onKeyDown,!0),this.containerOuter.element.removeEventListener("mousedown",this._onMouseDown,!0),e.removeEventListener("click",this._onClick),e.removeEventListener("touchmove",this._onTouchMove),this.dropdown.element.removeEventListener("mouseover",this._onMouseOver),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("input",this._onInput),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()},e.prototype._onKeyDown=function(e){var t=e.keyCode,i=this._store.items,n=this.input.isFocussed,s=this.dropdown.isActive,o=this.itemList.hasChildren(),r=1===e.key.length||2===e.key.length&&e.key.charCodeAt(0)>=55296||"Unidentified"===e.key;switch(this._isTextElement||s||(this.showDropdown(),!this.input.isFocussed&&r&&(this.input.value+=e.key)),t){case 65:return this._onSelectKey(e,o);case 13:return this._onEnterKey(e,i,s);case 27:return this._onEscapeKey(e,s);case 38:case 33:case 40:case 34:return this._onDirectionKey(e,s);case 8:case 46:return this._onDeleteKey(e,i,n)}},e.prototype._onKeyUp=function(){this._canSearch=this.config.searchEnabled},e.prototype._onInput=function(){var e=this.input.value;if(e){if(this._isTextElement){var t=this._canAddItem(this._store.items,e);t.notice&&(this._displayAddItemNotice(t),this.showDropdown(!0))}if(this._canSearch){this._handleSearch(e);var i=this._canAddItem(this._store.items,e);i.response||this._displayAddItemNotice(i),this._canAddUserChoices&&(this._highlightPosition=0,this._highlightChoice())}}else this._isTextElement?this.hideDropdown(!0):this._stopSearch()},e.prototype._displayAddItemNotice=function(e){var t=this._templates.notice(this.config,e.notice,"add-choice"),i="".concat(m(this.config.classNames.addChoice),"[data-choice-selectable]"),n=this.choiceList.element.querySelector(i);n?n.outerHTML=t.outerHTML:this.choiceList.prepend(t)},e.prototype._onSelectKey=function(e,t){var i=e.ctrlKey,n=e.metaKey;(i||n)&&t&&(this._canSearch=!1,this.config.removeItems&&!this.input.value&&this.input.element===document.activeElement&&this.highlightAll())},e.prototype._onEnterKey=function(e,t,i){var n=this,s=this.input.value,o=e.target;if(o&&o.hasAttribute("data-button"))return e.preventDefault(),void this._handleButtonAction(t,o);if(!i&&this._isSelectOneElement)return e.preventDefault(),void this.showDropdown();if(i){var r=this.dropdown.element.querySelector(m(this.config.classNames.highlightedState));if(r&&this._handleChoiceAction(t,r,13))return e.preventDefault(),void this.unhighlightAll();s||this.hideDropdown(!0)}o&&s&&this._canAddUserChoices&&(this._canAddItem(t,s).response&&(this._store.withDeferRendering((function(){if((n._isSelectOneElement||n.config.singleModeForMultiSelect)&&0!==t.length){var e=t[t.length-1];n._removeItem(e)}var i=!0;if(!n._isSelectElement&&n.config.duplicateItemsAllowed||(i=!n._findAndSelectChoiceByValue(s)),i){var o=l(s),r=n.config.allowHtmlUserInput||o===s?s:{escaped:o,raw:s};n._addChoice(A({value:r,label:r,selected:!0},!1))}n.clearInput(),n.unhighlightAll(),n._triggerChange(s)})),(this._isTextElement||this._isSelectOneElement)&&this.hideDropdown(!0)))},e.prototype._onEscapeKey=function(e,t){t&&(e.stopPropagation(),this.hideDropdown(!0),this.containerOuter.focus())},e.prototype._onDirectionKey=function(e,t){var i,n,s,o=e.keyCode,r=e.metaKey;if(t||this._isSelectOneElement){this.showDropdown(),this._canSearch=!1;var a=40===o||34===o?1:-1,c="[data-choice-selectable]",l=void 0;if(r||34===o||33===o)l=a>0?this.dropdown.element.querySelector("".concat(c,":last-of-type")):this.dropdown.element.querySelector(c);else{var h=this.dropdown.element.querySelector(m(this.config.classNames.highlightedState));l=h?function(e,t,i){void 0===i&&(i=1);for(var n="".concat(i>0?"next":"previous","ElementSibling"),s=e[n];s;){if(s.matches(t))return s;s=s[n]}return s}(h,c,a):this.dropdown.element.querySelector(c)}l&&(i=l,n=this.choiceList.element,void 0===(s=a)&&(s=1),i&&(s>0?n.scrollTop+n.offsetHeight>=i.offsetTop+i.offsetHeight:i.offsetTop>=n.scrollTop)||this.choiceList.scrollToChildElement(l,a),this._highlightChoice(l)),e.preventDefault()}},e.prototype._onDeleteKey=function(e,t,i){var n=e.target;this._isSelectOneElement||n.value||!i||(this._handleBackspace(t),e.preventDefault())},e.prototype._onTouchMove=function(){this._wasTap&&(this._wasTap=!1)},e.prototype._onTouchEnd=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},e.prototype._onMouseDown=function(e){var t=e.target;if(t instanceof HTMLElement){if(U&&this.choiceList.element.contains(t)){var i=this.choiceList.element.firstElementChild;this._isScrollingOnIe="ltr"===this._direction?e.offsetX>=i.offsetWidth:e.offsetX0&&this.unhighlightAll(),this.containerOuter.removeFocusState(),this.hideDropdown(!0))},e.prototype._onFocus=function(e){var t,i=this,n=e.target;n&&this.containerOuter.element.contains(n)&&((t={})[g]=function(){n===i.input.element&&i.containerOuter.addFocusState()},t[_]=function(){i.containerOuter.addFocusState(),n===i.input.element&&i.showDropdown(!0)},t[y]=function(){n===i.input.element&&(i.showDropdown(!0),i.containerOuter.addFocusState())},t)[this._elementType]()},e.prototype._onBlur=function(e){var t,i=this,n=e.target;if(n&&this.containerOuter.element.contains(n)&&!this._isScrollingOnIe){var s=this._store.activeChoices.some((function(e){return e.highlighted}));((t={})[g]=function(){n===i.input.element&&(i.containerOuter.removeFocusState(),s&&i.unhighlightAll(),i.hideDropdown(!0))},t[_]=function(){i.containerOuter.removeFocusState(),(n===i.input.element||n===i.containerOuter.element&&!i._canSearch)&&i.hideDropdown(!0)},t[y]=function(){n===i.input.element&&(i.containerOuter.removeFocusState(),i.hideDropdown(!0),s&&i.unhighlightAll())},t)[this._elementType]()}else this._isScrollingOnIe=!1,this.input.element.focus()},e.prototype._onFormReset=function(){var e=this;this._store.withDeferRendering((function(){e.clearInput(),e.hideDropdown(),e.refresh(!1,!1,!0),0!==e._initialItems.length&&e.setChoiceByValue(e._initialItems)}))},e.prototype._highlightChoice=function(e){var t,i=this;void 0===e&&(e=null);var n=Array.from(this.dropdown.element.querySelectorAll("[data-choice-selectable]"));if(n.length){var s=e;Array.from(this.dropdown.element.querySelectorAll(m(this.config.classNames.highlightedState))).forEach((function(e){var t;(t=e.classList).remove.apply(t,p(i.config.classNames.highlightedState)),e.setAttribute("aria-selected","false")})),s?this._highlightPosition=n.indexOf(s):(s=n.length>this._highlightPosition?n[this._highlightPosition]:n[n.length-1])||(s=n[0]),(t=s.classList).add.apply(t,p(this.config.classNames.highlightedState)),s.setAttribute("aria-selected","true"),this.passedElement.triggerEvent("highlightChoice",{el:s}),this.dropdown.isActive&&(this.input.setActiveDescendant(s.id),this.containerOuter.setActiveDescendant(s.id))}},e.prototype._addItem=function(e,t){void 0===t&&(t=!0);var i=e.id;if(0===i)throw new TypeError("item.id must be set before _addItem is called for a choice/item");this._store.dispatch(function(e){return{type:"ADD_ITEM",item:e}}(e)),this._isSelectOneElement&&this.removeActiveItems(i),t&&this.passedElement.triggerEvent("addItem",this._getChoiceForOutput(e))},e.prototype._removeItem=function(e){e.id&&(this._store.dispatch(function(e){return{type:"REMOVE_ITEM",item:e}}(e)),this.passedElement.triggerEvent("removeItem",this._getChoiceForOutput(e)))},e.prototype._addChoice=function(e,t){if(void 0===t&&(t=!0),0!==e.id)throw new TypeError("Can not re-add a choice which has already been added");var i=e;this._lastAddedChoiceId++,i.id=this._lastAddedChoiceId,i.elementId="".concat(this._baseId,"-").concat(this._idNames.itemChoice,"-").concat(i.id),this.config.prependValue&&(i.value=this.config.prependValue+i.value),this.config.appendValue&&(i.value+=this.config.appendValue.toString()),(this.config.prependValue||this.config.appendValue)&&i.element&&(i.element.value=i.value),this._store.dispatch(function(e){return{type:"ADD_CHOICE",choice:e}}(e)),e.selected&&this._addItem(e,t)},e.prototype._addGroup=function(e,t){var i=this;if(void 0===t&&(t=!0),0!==e.id)throw new TypeError("Can not re-add a group which has already been added");if(this._store.dispatch(function(e){return{type:"ADD_GROUP",group:e}}(e)),e.choices){var n=e;this._lastAddedGroupId++,n.id=this._lastAddedGroupId;var s=e.id,o=e.choices;n.choices=[],o.forEach((function(n){var o=n;o.groupId=s,e.disabled&&(o.disabled=!0),i._addChoice(o,t)}))}},e.prototype._getTemplate=function(e){for(var t,i=[],s=1;s/g,">").replace(/0?this.element.scrollTop+r-s:e.offsetTop;requestAnimationFrame((function(){i._animateScroll(a,t)}))}},e.prototype._scrollDown=function(e,t,i){var n=(i-e)/t,s=n>1?n:1;this.element.scrollTop=e+s},e.prototype._scrollUp=function(e,t,i){var n=(e-i)/t,s=n>1?n:1;this.element.scrollTop=e-s},e.prototype._animateScroll=function(e,t){var i=this,n=this.element.scrollTop,s=!1;t>0?(this._scrollDown(n,4,e),ne&&(s=!0)),s&&requestAnimationFrame((function(){i._animateScroll(e,t)}))},e}(),I=function(){function e(e){var t=e.element,i=e.classNames;this.element=t,this.classNames=i,this.isDisabled=!1}return Object.defineProperty(e.prototype,"isActive",{get:function(){return"active"===this.element.dataset.choice},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"dir",{get:function(){return this.element.dir},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"value",{get:function(){return this.element.value},set:function(e){this.element.setAttribute("value",e),this.element.value=e},enumerable:!1,configurable:!0}),e.prototype.conceal=function(){var e;(e=this.element.classList).add.apply(e,p(this.classNames.input)),this.element.hidden=!0,this.element.tabIndex=-1;var t=this.element.getAttribute("style");t&&this.element.setAttribute("data-choice-orig-style",t),this.element.setAttribute("data-choice","active")},e.prototype.reveal=function(){var e;(e=this.element.classList).remove.apply(e,p(this.classNames.input)),this.element.hidden=!1,this.element.removeAttribute("tabindex");var t=this.element.getAttribute("data-choice-orig-style");t?(this.element.removeAttribute("data-choice-orig-style"),this.element.setAttribute("style",t)):this.element.removeAttribute("style"),this.element.removeAttribute("data-choice"),this.element.value=this.element.value},e.prototype.enable=function(){this.element.removeAttribute("disabled"),this.element.disabled=!1,this.isDisabled=!1},e.prototype.disable=function(){this.element.setAttribute("disabled",""),this.element.disabled=!0,this.isDisabled=!0},e.prototype.triggerEvent=function(e,t){!function(e,t,i){void 0===i&&(i=null);var n=new CustomEvent(t,{detail:i,bubbles:!0,cancelable:!0});e.dispatchEvent(n)}(this.element,e,t)},e}(),w=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return t(i,e),i}(I),S=function(e,t){return void 0===t&&(t=!0),void 0===e?t:!!e},O=function(e){if("string"==typeof e&&(e=e.split(" ").filter((function(e){return 0!==e.length}))),Array.isArray(e)&&0!==e.length)return e},A=function(e,t){if("string"==typeof e)return A({value:e,label:e},!1);var i=e;if("choices"in i){if(!t)throw new TypeError("optGroup is not allowed");var n=i,s=n.choices.map((function(e){return A(e,!1)}));return{id:0,label:u(n.label)||n.value,active:0!==s.length,disabled:!!n.disabled,choices:s}}var o=i;return{id:0,groupId:0,score:0,value:o.value,label:o.label||o.value,active:S(o.active),selected:S(o.selected,!1),disabled:S(o.disabled,!1),placeholder:S(o.placeholder,!1),highlighted:!1,labelClass:O(o.labelClass),labelDescription:o.labelDescription,customProperties:o.customProperties}},T=function(e){function i(t){var i=t.element,n=t.classNames,s=t.template,o=t.extractPlaceholder,r=e.call(this,{element:i,classNames:n})||this;return r.template=s,r.extractPlaceholder=o,r}return t(i,e),Object.defineProperty(i.prototype,"placeholderOption",{get:function(){return this.element.querySelector('option[value=""]')||this.element.querySelector("option[placeholder]")},enumerable:!1,configurable:!0}),i.prototype.addOptions=function(e){var t=this;e.forEach((function(e){var i=e;if(!i.element){var n=t.template(i);t.element.appendChild(n),i.element=n}}))},i.prototype.optionsAsChoices=function(){var e=this,t=[];return this.element.querySelectorAll(":scope > option, :scope > optgroup").forEach((function(i){!function(e){return"OPTION"===e.tagName}(i)?function(e){return"OPTGROUP"===e.tagName}(i)&&t.push(e._optgroupToChoice(i)):t.push(e._optionToChoice(i))})),t},i.prototype._optionToChoice=function(e){return{id:0,groupId:0,score:0,value:e.value,label:e.innerHTML,element:e,active:!0,selected:this.extractPlaceholder?e.selected:e.hasAttribute("selected"),disabled:e.disabled,highlighted:!1,placeholder:this.extractPlaceholder&&(""===e.value||e.hasAttribute("placeholder")),labelClass:void 0!==e.dataset.labelClass?O(e.dataset.labelClass):void 0,labelDescription:void 0!==e.dataset.labelDescription?e.dataset.labelDescription:void 0,customProperties:m(e.dataset.customProperties)}},i.prototype._optgroupToChoice=function(e){var t=this,i=e.querySelectorAll("option"),n=Array.from(i).map((function(e){return t._optionToChoice(e)}));return{id:0,label:e.label||"",element:e,active:0!==n.length,disabled:e.disabled,choices:n}},i}(I),L={items:[],choices:[],silent:!1,renderChoiceLimit:-1,maxItemCount:-1,singleModeForMultiSelect:!1,addChoices:!1,addItems:!0,addItemFilter:function(e){return!!e&&""!==e},removeItems:!0,removeItemButton:!1,removeItemButtonAlignLeft:!1,editItems:!1,allowHTML:!1,allowHtmlUserInput:!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,sorter:function(e,t){var i=e.value,n=e.label,s=void 0===n?i:n,o=t.value,r=t.label,a=void 0===r?o:r;return u(s).localeCompare(u(a),[],{sensitivity:"base",ignorePunctuation:!0,numeric:!0})},shadowRoot:null,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 "'.concat(e,'"')},removeItemIconText:function(){return"Remove item"},removeItemLabelText:function(e){return"Remove item: ".concat(e)},maxItemText:function(e){return"Only ".concat(e," values can be added")},valueComparer:function(e,t){return e===t},fuseOptions:{includeScore:!0},labelId:"",callbackOnInit:null,callbackOnCreateTemplates:null,classNames:{containerOuter:["choices"],containerInner:["choices__inner"],input:["choices__input"],inputCloned:["choices__input--cloned"],list:["choices__list"],listItems:["choices__list--multiple"],listSingle:["choices__list--single"],listDropdown:["choices__list--dropdown"],item:["choices__item"],itemSelectable:["choices__item--selectable"],itemDisabled:["choices__item--disabled"],itemChoice:["choices__item--choice"],description:["choices__description"],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"],selectedState:["is-selected"],flippedState:["is-flipped"],loadingState:["is-loading"],addChoice:["choices__item","choices__item--selectable","add-choice"],noResults:["has-no-results"],noChoices:["has-no-choices"]},appendGroupInSearch:!1},D=["fuseOptions","classNames"];function N(e){return"Minified Redux error #"+e+"; visit https://redux.js.org/Errors?code="+e+" for the full message or use the non-minified dev environment for full errors. "}var x="function"==typeof Symbol&&Symbol.observable||"@@observable",P=function(){return Math.random().toString(36).substring(7).split("").join(".")},F={INIT:"@@redux/INIT"+P(),REPLACE:"@@redux/REPLACE"+P(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+P()}};function j(e,t,i){var n;if("function"==typeof t&&"function"==typeof i||"function"==typeof i&&"function"==typeof arguments[3])throw new Error(N(0));if("function"==typeof t&&void 0===i&&(i=t,t=void 0),void 0!==i){if("function"!=typeof i)throw new Error(N(1));return i(j)(e,t)}if("function"!=typeof e)throw new Error(N(2));var s=e,o=t,r=[],a=r,c=!1;function l(){a===r&&(a=r.slice())}function h(){if(c)throw new Error(N(3));return o}function u(e){if("function"!=typeof e)throw new Error(N(4));if(c)throw new Error(N(5));var t=!0;return l(),a.push(e),function(){if(t){if(c)throw new Error(N(6));t=!1,l();var i=a.indexOf(e);a.splice(i,1),r=null}}}function d(e){if(!function(e){if("object"!=typeof e||null===e)return!1;for(var t=e;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}(e))throw new Error(N(7));if(void 0===e.type)throw new Error(N(8));if(c)throw new Error(N(9));try{c=!0,o=s(o,e)}finally{c=!1}for(var t=r=a,i=0;i0},e.prototype.getChoiceById=function(e){return this.activeChoices.find((function(t){return t.id===e}))},e.prototype.getGroupById=function(e){return this.groups.find((function(t){return t.id===e}))},e}(),B=function(e,t){return e?function(e){if("string"==typeof e)return e;if("object"==typeof e){if("escaped"in e)return e.escaped;if("trusted"in e)return e.trusted}return""}(t):l(t)},k=function(e,t){if(t){var i=e.dataset;"string"==typeof t?i.customProperties=t:"object"!=typeof t||function(e){for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0}(t)||(i.customProperties=JSON.stringify(t))}},K={containerOuter:function(e,t,i,n,s,o,r){var a=e.classNames.containerOuter,c=Object.assign(document.createElement("div"),{className:p(a).join(" ")});return c.dataset.type=o,t&&(c.dir=t),n&&(c.tabIndex=0),i&&(c.setAttribute("role",s?"combobox":"listbox"),s&&c.setAttribute("aria-autocomplete","list")),c.setAttribute("aria-haspopup","true"),c.setAttribute("aria-expanded","false"),r&&c.setAttribute("aria-labelledby",r),c},containerInner:function(e){var t=e.classNames.containerInner;return Object.assign(document.createElement("div"),{className:p(t).join(" ")})},itemList:function(e,t){var i=e.classNames,n=i.list,s=i.listSingle,o=i.listItems;return Object.assign(document.createElement("div"),{className:"".concat(p(n).join(" ")," ").concat(t?p(s).join(" "):p(o).join(" "))})},placeholder:function(e,t){var i=e.allowHTML,n=e.classNames.placeholder;return Object.assign(document.createElement("div"),{className:p(n).join(" "),innerHTML:B(i,t)})},item:function(e,t,i){var n,s,o,r=e.allowHTML,a=e.removeItemButtonAlignLeft,c=e.classNames,h=c.item,u=c.button,d=c.highlightedState,f=c.itemSelectable,m=c.placeholder,v=t.id,g=t.value,_=t.label,y=t.labelClass,b=t.labelDescription,E=t.customProperties,C=t.active,I=t.disabled,w=t.highlighted,S=t.placeholder,O=Object.assign(document.createElement("div"),{className:p(h).join(" ")});if(y){var A=Object.assign(document.createElement("span"),{innerHTML:B(r,_),className:p(y).join(" ")});O.appendChild(A)}else O.innerHTML=B(r,_);if(Object.assign(O.dataset,{item:"",id:v,value:g}),y&&(O.dataset.labelClass=p(y).join(" ")),b&&(O.dataset.labelDescription=b),k(O,E),C&&O.setAttribute("aria-selected","true"),I&&O.setAttribute("aria-disabled","true"),S&&((n=O.classList).add.apply(n,p(m)),O.dataset.placeholder=""),(s=O.classList).add.apply(s,p(w?d:f)),i){I&&(o=O.classList).remove.apply(o,p(f)),O.dataset.deletable="";var T="function"==typeof this.config.removeItemIconText?this.config.removeItemIconText(l(g),g):this.config.removeItemIconText,L="function"==typeof this.config.removeItemLabelText?this.config.removeItemLabelText(l(g),g):this.config.removeItemLabelText,D=Object.assign(document.createElement("button"),{type:"button",className:p(u).join(" "),innerHTML:T});D.setAttribute("aria-label",L),D.dataset.button="",a?O.insertAdjacentElement("afterbegin",D):O.appendChild(D)}return O},choiceList:function(e,t){var i=e.classNames.list,n=Object.assign(document.createElement("div"),{className:p(i).join(" ")});return t||n.setAttribute("aria-multiselectable","true"),n.setAttribute("role","listbox"),n},choiceGroup:function(e,t){var i=e.allowHTML,n=e.classNames,s=n.group,o=n.groupHeading,r=n.itemDisabled,a=t.id,c=t.label,l=t.disabled,h=Object.assign(document.createElement("div"),{className:"".concat(p(s).join(" ")," ").concat(l?p(r).join(" "):"")});return h.setAttribute("role","group"),Object.assign(h.dataset,{group:"",id:a,value:c}),l&&h.setAttribute("aria-disabled","true"),h.appendChild(Object.assign(document.createElement("div"),{className:p(o).join(" "),innerHTML:B(i,c)})),h},choice:function(e,t,i){var n,s,o,r,a,c=e.allowHTML,l=e.classNames,h=l.item,u=l.itemChoice,d=l.itemSelectable,f=l.selectedState,m=l.itemDisabled,v=l.description,g=l.placeholder,_=t.id,y=t.value,b=t.label,E=t.groupId,C=t.elementId,I=t.labelClass,w=t.labelDescription,S=t.disabled,O=t.selected,A=t.placeholder,T=Object.assign(document.createElement("div"),{id:C,className:"".concat(p(h).join(" ")," ").concat(p(u).join(" "))}),L=T;if(I){var D=Object.assign(document.createElement("span"),{innerHTML:B(c,b),className:p(I).join(" ")});L=D,T.appendChild(D)}else T.innerHTML=B(c,b);if(w){var N="".concat(C,"-description");L.setAttribute("aria-describedby",N);var x=Object.assign(document.createElement("span"),{innerHTML:B(c,w),id:N});(n=x.classList).add.apply(n,p(v)),T.appendChild(x)}return O&&(s=T.classList).add.apply(s,p(f)),A&&(o=T.classList).add.apply(o,p(g)),T.setAttribute("role",E&&E>0?"treeitem":"option"),Object.assign(T.dataset,{choice:"",id:_,value:y,selectText:i}),I&&(T.dataset.labelClass=p(I).join(" ")),w&&(T.dataset.labelDescription=w),S?((r=T.classList).add.apply(r,p(m)),T.dataset.choiceDisabled="",T.setAttribute("aria-disabled","true")):((a=T.classList).add.apply(a,p(d)),T.dataset.choiceSelectable=""),T},input:function(e,t){var i=e.classNames,n=i.input,s=i.inputCloned,o=Object.assign(document.createElement("input"),{type:"search",className:"".concat(p(n).join(" ")," ").concat(p(s).join(" ")),autocomplete:"off",autocapitalize:"off",spellcheck:!1});return o.setAttribute("role","textbox"),o.setAttribute("aria-autocomplete","list"),t&&o.setAttribute("aria-label",t),o},dropdown:function(e){var t,i,n=e.classNames,s=n.list,o=n.listDropdown,r=document.createElement("div");return(t=r.classList).add.apply(t,p(s)),(i=r.classList).add.apply(i,p(o)),r.setAttribute("aria-expanded","false"),r},notice:function(e,t,i){var s=e.allowHTML,o=e.classNames,r=o.item,a=o.itemChoice,c=o.addChoice,l=o.noResults,h=o.noChoices;void 0===i&&(i="");var u=n(n([],p(r),!0),p(a),!0);switch(i){case"add-choice":u.push.apply(u,p(c));break;case"no-results":u.push.apply(u,p(l));break;case"no-choices":u.push.apply(u,p(h))}var d=Object.assign(document.createElement("div"),{innerHTML:B(s,t),className:u.join(" ")});return"add-choice"===i&&(d.dataset.choiceSelectable="",d.dataset.choice=""),d},option:function(e){var t=e.label,i=e.value,n=e.labelClass,s=e.labelDescription,o=e.customProperties,r=e.active,a=e.disabled,c=u(t),l=new Option(c,i,!1,r);return n&&(l.dataset.labelClass=p(n).join(" ")),s&&(l.dataset.labelDescription=s),k(l,o),l.disabled=a,l}},U="-ms-scroll-limit"in document.documentElement.style&&"-ms-ime-align"in document.documentElement.style,q={},G=function(e){if(e){var t=e.dataset.id;return t?parseInt(t,10):void 0}},W=function(){function e(t,n){void 0===t&&(t="[data-choice]"),void 0===n&&(n={});var s=this;this._hasNonChoicePlaceholder=!1,this._lastAddedChoiceId=0,this._lastAddedGroupId=0,this.config=i(i(i({},e.defaults.allOptions),e.defaults.options),n),D.forEach((function(t){s.config[t]=i(i(i({},e.defaults.allOptions[t]),e.defaults.options[t]),n[t])}));var r,a,l,h,u=(r=this.config,a=L,l=Object.keys(r).sort(),h=Object.keys(a).sort(),l.filter((function(e){return h.indexOf(e)<0})));u.length&&console.warn("Unknown config option(s) passed",u.join(", ")),!this.config.silent&&this.config.allowHTML&&this.config.allowHtmlUserInput&&(this.config.addItems&&console.warn("Warning: allowHTML/allowHtmlUserInput/addItems all being true is strongly not recommended and may lead to XSS attacks"),this.config.addChoices&&console.warn("Warning: allowHTML/allowHtmlUserInput/addChoices all being true is strongly not recommended and may lead to XSS attacks"));var d=this.config.shadowRoot||document.documentElement,p="string"==typeof t?d.querySelector(t):t;if(!p||"object"!=typeof p||"INPUT"!==p.tagName&&!function(e){return"SELECT"===e.tagName}(p)){if(!p&&"string"==typeof t)throw TypeError("Selector ".concat(t," failed to find an element"));throw TypeError("Expected one of the following types text|select-one|select-multiple")}if(this._elementType=p.type,this._isTextElement=this._elementType===g,(this._isTextElement||1!==this.config.maxItemCount)&&(this.config.singleModeForMultiSelect=!1),this.config.singleModeForMultiSelect&&(this._elementType=y),this._isSelectOneElement=this._elementType===_,this._isSelectMultipleElement=this._elementType===y,this._isSelectElement=this._isSelectOneElement||this._isSelectMultipleElement,this._canAddUserChoices=this._isTextElement&&this.config.addItems||this._isSelectElement&&this.config.addChoices,["auto","always"].includes("".concat(this.config.renderSelectedChoices))||(this.config.renderSelectedChoices="auto"),this.config.placeholder&&(this.config.placeholderValue?this._hasNonChoicePlaceholder=!0:p.dataset.placeholder&&(this._hasNonChoicePlaceholder=!0,this.config.placeholderValue=p.dataset.placeholder)),n.addItemFilter&&"function"!=typeof n.addItemFilter){var f=n.addItemFilter instanceof RegExp?n.addItemFilter:new RegExp(n.addItemFilter);this.config.addItemFilter=f.test.bind(f)}if(this._isTextElement)this.passedElement=new w({element:p,classNames:this.config.classNames});else{var m=p;this.passedElement=new T({element:m,classNames:this.config.classNames,template:function(e){return s._templates.option(e)},extractPlaceholder:this.config.placeholder&&!this._hasNonChoicePlaceholder})}if(this.initialised=!1,this._store=new V,this._initialState=M,this._currentState=M,this._prevState=M,this._currentValue="",this.config.searchEnabled=!this._isTextElement&&this.config.searchEnabled||this._elementType===y,this._canSearch=this.config.searchEnabled,this._isScrollingOnIe=!1,this._highlightPosition=0,this._wasTap=!0,this._placeholderValue=this._generatePlaceholderValue(),this._baseId=function(e,t){var i=e.id||e.name&&"".concat(e.name,"-").concat(c(2))||c(4);return i=i.replace(/(:|\.|\[|\]|,)/g,""),"".concat(t,"-").concat(i)}(this.passedElement.element,"choices-"),this._searchFn=o,this._direction=this.passedElement.dir,!this._direction){var v=window.getComputedStyle(this.passedElement.element).direction;v!==window.getComputedStyle(document.documentElement).direction&&(this._direction=v)}if(this._idNames={itemChoice:"item-choice"},this._render=this._render.bind(this),this._onFocus=this._onFocus.bind(this),this._onBlur=this._onBlur.bind(this),this._onKeyUp=this._onKeyUp.bind(this),this._onKeyDown=this._onKeyDown.bind(this),this._onInput=this._onInput.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._onSelectKey=this._onSelectKey.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),this.passedElement.isActive)return this.config.silent||console.warn("Trying to initialise Choices on element already initialised",{element:t}),void(this.initialised=!0);this.init(),this._initialItems=this._store.items.map((function(e){return e.value}))}return Object.defineProperty(e,"defaults",{get:function(){return Object.preventExtensions({get options(){return q},get allOptions(){return L},get templates(){return K}})},enumerable:!1,configurable:!0}),e.prototype.init=function(){if(!this.initialised){this._loadChoices(),this._createTemplates(),this._createElements(),this._createStructure(),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&&"function"==typeof e&&e.call(this)}},e.prototype.destroy=function(){this.initialised&&(this._removeEventListeners(),this.passedElement.reveal(),this.containerOuter.unwrap(this.passedElement.element),this.clearStore(),this._stopSearch(),this._templates=K,this.initialised=!1)},e.prototype.enable=function(){return this.passedElement.isDisabled&&this.passedElement.enable(),this.containerOuter.isDisabled&&(this._addEventListeners(),this.input.enable(),this.containerOuter.enable()),this},e.prototype.disable=function(){return this.passedElement.isDisabled||this.passedElement.disable(),this.containerOuter.isDisabled||(this._removeEventListeners(),this.input.disable(),this.containerOuter.disable()),this},e.prototype.highlightItem=function(e,t){if(void 0===t&&(t=!0),!e||!e.id)return this;var i=this._store.choices.find((function(t){return t.id===e.id}));return!i||i.highlighted||(this._store.dispatch(r(i,!0)),t&&this.passedElement.triggerEvent("highlightItem",this._getChoiceForOutput(i))),this},e.prototype.unhighlightItem=function(e,t){if(void 0===t&&(t=!0),!e||!e.id)return this;var i=this._store.choices.find((function(t){return t.id===e.id}));return i&&i.highlighted?(this._store.dispatch(r(i,!1)),t&&this.passedElement.triggerEvent("highlightItem",this._getChoiceForOutput(i)),this):this},e.prototype.highlightAll=function(){var e=this;return this._store.withDeferRendering((function(){e._store.items.forEach((function(t){return e.highlightItem(t)}))})),this},e.prototype.unhighlightAll=function(){var e=this;return this._store.withDeferRendering((function(){e._store.items.forEach((function(t){return e.unhighlightItem(t)}))})),this},e.prototype.removeActiveItemsByValue=function(e){var t=this;return this._store.withDeferRendering((function(){t._store.items.filter((function(t){return t.value===e})).forEach((function(e){return t._removeItem(e)}))})),this},e.prototype.removeActiveItems=function(e){var t=this;return this._store.withDeferRendering((function(){t._store.items.filter((function(t){return t.id!==e})).forEach((function(e){return t._removeItem(e)}))})),this},e.prototype.removeHighlightedItems=function(e){var t=this;return void 0===e&&(e=!1),this._store.withDeferRendering((function(){t._store.highlightedActiveItems.forEach((function(i){t._removeItem(i),e&&t._triggerChange(i.value)}))})),this},e.prototype.showDropdown=function(e){var t=this;return this.dropdown.isActive||requestAnimationFrame((function(){t.dropdown.show(),t.containerOuter.open(t.dropdown.distanceFromTopWindow),!e&&t._canSearch&&t.input.focus(),t.passedElement.triggerEvent("showDropdown",{})})),this},e.prototype.hideDropdown=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("hideDropdown",{})})),this):this},e.prototype.getValue=function(e){var t=this;void 0===e&&(e=!1);var i=this._store.items.reduce((function(i,n){var s=e?n.value:t._getChoiceForOutput(n);return i.push(s),i}),[]);return this._isSelectOneElement||this.config.singleModeForMultiSelect?i[0]:i},e.prototype.setValue=function(e){var t=this;return this.initialised?(this._store.withDeferRendering((function(){e.forEach((function(e){e&&t._addChoice(A(e,!1))}))})),this):this},e.prototype.setChoiceByValue=function(e){var t=this;return!this.initialised||this._isTextElement||this._store.withDeferRendering((function(){(Array.isArray(e)?e:[e]).forEach((function(e){return t._findAndSelectChoiceByValue(e)}))})),this},e.prototype.setChoices=function(e,t,n,s){var o=this;if(void 0===e&&(e=[]),void 0===t&&(t="value"),void 0===n&&(n="label"),void 0===s&&(s=!1),!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("string"!=typeof t||!t)throw new TypeError("value parameter must be a name of 'value' field in passed objects");if(s&&this.clearChoices(),"function"==typeof e){var r=e(this);if("function"==typeof Promise&&r instanceof Promise)return new Promise((function(e){return requestAnimationFrame(e)})).then((function(){return o._handleLoadingState(!0)})).then((function(){return r})).then((function(e){return o.setChoices(e,t,n,s)})).catch((function(e){o.config.silent||console.error(e)})).then((function(){return o._handleLoadingState(!1)})).then((function(){return o}));if(!Array.isArray(r))throw new TypeError(".setChoices first argument function must return either array of choices or Promise, got: ".concat(typeof r));return this.setChoices(r,t,n,!1)}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");return this.containerOuter.removeLoadingState(),this._store.withDeferRendering((function(){var s="value"===t,r="label"===n;e.forEach((function(e){if("choices"in e){var a=e;r||(a=i(i({},a),{label:a[n]})),o._addGroup(A(a,!0))}else{var c=e;r&&s||(c=i(i({},c),{value:c[t],label:c[n]})),o._addChoice(A(c,!1))}}))})),this},e.prototype.refresh=function(e,t,i){var n=this;return void 0===e&&(e=!1),void 0===t&&(t=!1),void 0===i&&(i=!1),this._isSelectElement?(this._store.withDeferRendering((function(){var s=n.passedElement.optionsAsChoices(),o=n._store.items,r={};i||o.forEach((function(e){e.id&&e.active&&e.selected&&!e.disabled&&(r[e.value]=!0)})),s.forEach((function(e){if(!("choices"in e)){var t=e;i?t.selected=!1:r[t.value]&&(t.selected=!0)}})),n.clearStore(),n._addPredefinedChoices(s,t,e),n._isSearching&&n._searchChoices(n.input.value)})),this):(this.config.silent||console.warn("refresh method can only be used on choices backed by a element"),this)},e.prototype.removeChoice=function(e){var t=this._store.choices.find((function(t){return t.value===e}));return t?(this._store.dispatch(function(e){return{type:"REMOVE_CHOICE",choice:e}}(t)),t.selected&&this.passedElement.triggerEvent("removeItem",this._getChoiceForOutput(t)),this):this},e.prototype.clearChoices=function(){return this._store.dispatch({type:"CLEAR_CHOICES"}),this},e.prototype.clearStore=function(){return this._store.dispatch({type:"CLEAR_ALL"}),this._lastAddedChoiceId=0,this._lastAddedGroupId=0,this},e.prototype.clearInput=function(){var e=!this._isSelectOneElement;return this.input.clear(e),this._isSearching&&this._stopSearch(),this},e.prototype._render=function(){if(!this._store.isLoading()){this._currentState=this._store.state;var e=this._currentState.items!==this._prevState.items;(this._currentState.choices!==this._prevState.choices||this._currentState.groups!==this._prevState.groups||e)&&(this._isSelectElement&&this._renderChoices(),e&&this._renderItems(),this._prevState=this._currentState)}},e.prototype._renderChoices=function(){var e=this,t=this._store,i=t.activeGroups,n=t.activeChoices,s=document.createDocumentFragment();if(this.choiceList.clear(),this.config.resetScrollPosition&&requestAnimationFrame((function(){return e.choiceList.scrollToTop()})),i.length>=1&&!this._isSearching){var o=n.filter((function(e){return e.placeholder&&-1===e.groupId}));o.length>=1&&(s=this._createChoicesFragment(o,s)),s=this._createGroupsFragment(i,n,s)}else n.length>=1&&(s=this._createChoicesFragment(n,s));var r=this.input.value,a=this._canAddItem(this._store.items,r);if(s.childNodes&&s.childNodes.length>0){var c=!a.response;if(a.response&&(this.choiceList.append(s),this._highlightChoice(),this._canAddUserChoices&&r&&a.notice&&(c=!n.find((function(t){return e.config.valueComparer(t.value,r)})))),c){var l=this._templates.notice(this.config,a.notice,this._canAddUserChoices?"add-choice":"");this.choiceList.prepend(l)}}else{var h=void 0;if(a.response&&this._canAddUserChoices&&r)h=this._templates.notice(this.config,a.notice,"add-choice");else if(this._isSearching){l="function"==typeof this.config.noResultsText?this.config.noResultsText():this.config.noResultsText;h=this._templates.notice(this.config,l,"no-results")}else{l="function"==typeof this.config.noChoicesText?this.config.noChoicesText():this.config.noChoicesText;h=this._templates.notice(this.config,l,"no-choices")}this.choiceList.append(h)}},e.prototype._renderItems=function(){var e=this._store.items||[];this.itemList.clear();var t=this._createItemsFragment(e);t.childNodes&&this.itemList.append(t)},e.prototype._createGroupsFragment=function(e,t,i){var n=this;void 0===i&&(i=document.createDocumentFragment());this.config.shouldSort&&e.sort(this.config.sorter);var s=t.filter((function(e){return 0===e.groupId}));return s.length>0&&this._createChoicesFragment(s,i,!1),e.forEach((function(e){var s=function(e){return t.filter((function(t){return n._isSelectOneElement?t.groupId===e.id:t.groupId===e.id&&("always"===n.config.renderSelectedChoices||!t.selected)}))}(e);if(s.length>=1){var o=n._templates.choiceGroup(n.config,e);i.appendChild(o),n._createChoicesFragment(s,i,!0)}})),i},e.prototype._createChoicesFragment=function(e,t,i){var s=this;void 0===t&&(t=document.createDocumentFragment()),void 0===i&&(i=!1);var o=this.config,r=o.renderSelectedChoices,a=o.searchResultLimit,c=o.renderChoiceLimit,l=o.appendGroupInSearch,h=this._isSearching?d:this.config.sorter,u=function(e){if("auto"!==r||(s._isSelectOneElement||!e.selected)){var i=s._templates.choice(s.config,e,s.config.itemSelectText);if(l){var n="";s._store.groups.every((function(t){return t.id!==e.groupId||(n=t.label,!1)})),n&&s._isSearching&&(i.innerHTML+=" (".concat(n,")"))}t.appendChild(i)}},p=e;if("auto"!==r||this._isSelectOneElement||(p=e.filter((function(e){return!e.selected}))),this._isSelectElement){var f=e.filter((function(e){return!e.element}));0!==f.length&&this.passedElement.addOptions(f)}var m=p.reduce((function(e,t){return t.placeholder?e.placeholderChoices.push(t):e.normalChoices.push(t),e}),{placeholderChoices:[],normalChoices:[]}),v=m.placeholderChoices,g=m.normalChoices;(this.config.shouldSort||this._isSearching)&&g.sort(h);var _=p.length,y=this._isSelectOneElement?n(n([],v,!0),g,!0):g;this._isSearching?_=a:c&&c>0&&!i&&(_=c);for(var b=0;b<_;b+=1)y[b]&&u(y[b]);return t},e.prototype._createItemsFragment=function(e,t){var i=this;void 0===t&&(t=document.createDocumentFragment());var n=this.config,s=n.shouldSortItems,o=n.sorter,r=n.removeItemButton;s&&!this._isSelectOneElement&&e.sort(o),this._isTextElement&&(this.passedElement.value=e.map((function(e){return e.value})).join(this.config.delimiter));var a=function(e){var n=i._templates.item(i.config,e,r);t.appendChild(n)};return e.forEach(a),this._isSelectOneElement&&this._hasNonChoicePlaceholder&&0===e.length&&a(A({selected:!0,value:"",label:this.config.placeholderValue||"",active:!0,placeholder:!0},!1)),t},e.prototype._getChoiceForOutput=function(e,t){if(e){var i=e.groupId>0?this._store.getGroupById(e.groupId):null;return{id:e.id,highlighted:e.highlighted,labelClass:e.labelClass,labelDescription:e.labelDescription,customProperties:e.customProperties,disabled:e.disabled,active:e.active,label:e.label,placeholder:e.placeholder,value:e.value,groupValue:i&&i.label?i.label:void 0,element:e.element,keyCode:t}}},e.prototype._triggerChange=function(e){null!=e&&this.passedElement.triggerEvent("change",{value:e})},e.prototype._selectPlaceholderChoice=function(e){this._addItem(e),e.value&&this._triggerChange(e.value)},e.prototype._handleButtonAction=function(e,t){if(0!==e.length&&this.config.removeItems&&this.config.removeItemButton){var i=t&&G(t.parentNode),n=i&&e.find((function(e){return e.id===i}));if(n&&(this._removeItem(n),this._triggerChange(n.value),this._isSelectOneElement&&!this._hasNonChoicePlaceholder)){var s=this._store.placeholderChoice;s&&this._selectPlaceholderChoice(s)}}},e.prototype._handleItemAction=function(e,t,i){var n=this;if(void 0===i&&(i=!1),0!==e.length&&this.config.removeItems&&!this._isSelectOneElement){var s=G(t);s&&(e.forEach((function(e){e.id!==s||e.highlighted?!i&&e.highlighted&&n.unhighlightItem(e):n.highlightItem(e)})),this.input.focus())}},e.prototype._handleChoiceAction=function(e,t,i){var n=this,s=G(t),o=s&&this._store.getChoiceById(s);if(!o)return!1;var r=this.dropdown.isActive,a=!1;return this._store.withDeferRendering((function(){if(!o.selected&&!o.disabled&&n._canAddItem(e,o.value).response){if(n.config.singleModeForMultiSelect&&0!==e.length){var t=e[e.length-1];n._removeItem(t)}n.passedElement.triggerEvent("choice",n._getChoiceForOutput(o,i)),n._addItem(o),n.clearInput(),a=!0}})),!!a&&(this._triggerChange(o.value),r&&(this.config.singleModeForMultiSelect||this._isSelectOneElement)&&(this.hideDropdown(!0),this.containerOuter.focus()),!0)},e.prototype._handleBackspace=function(e){if(this.config.removeItems&&0!==e.length){var t=e[e.length-1],i=e.some((function(e){return e.highlighted}));this.config.editItems&&!i&&t?(this.input.value=t.value,this.input.setWidth(),this._removeItem(t),this._triggerChange(t.value)):(i||this.highlightItem(t,!1),this.removeHighlightedItems(!0))}},e.prototype._loadChoices=function(){var e;if(this._isTextElement){this._presetItems=this.config.items.map((function(e){return A(e,!1)}));var t=this.passedElement.value;if(t){var i=t.split(this.config.delimiter).map((function(e){return A(e,!1)}));this._presetItems=this._presetItems.concat(i)}this._presetItems.forEach((function(e){e.selected=!0}))}else if(this._isSelectElement){this._presetChoices=this.config.choices.map((function(e){return A(e,!0)}));var n=this.passedElement.optionsAsChoices();n&&(e=this._presetChoices).push.apply(e,n)}},e.prototype._startLoading=function(){this._store.startDeferRendering()},e.prototype._stopLoading=function(){this._store.stopDeferRendering()},e.prototype._handleLoadingState=function(e){void 0===e&&(e=!0);var t=this.itemList.element.querySelector(f(this.config.classNames.placeholder));e?(this.disable(),this.containerOuter.addLoadingState(),this._isSelectOneElement?t?t.innerHTML=this.config.loadingText:(t=this._templates.placeholder(this.config,this.config.loadingText))&&this.itemList.append(t):this.input.placeholder=this.config.loadingText):(this.enable(),this.containerOuter.removeLoadingState(),this._isSelectOneElement?t&&(t.innerHTML=this._placeholderValue||""):this.input.placeholder=this._placeholderValue||"")},e.prototype._handleSearch=function(e){if(this.input.isFocussed){var t=this._store.choices,i=this.config,n=i.searchFloor,s=i.searchChoices,o=t.some((function(e){return!e.active}));if(null!=e&&e.length>=n){var r=s?this._searchChoices(e):0;null!==r&&this.passedElement.triggerEvent("search",{value:e,resultCount:r})}else o&&this._stopSearch()}},e.prototype._canAddItem=function(e,t){var i=this,n=!0,s="";(this.config.maxItemCount>0&&this.config.maxItemCount<=e.length&&(this.config.singleModeForMultiSelect||(n=!1,s="function"==typeof this.config.maxItemText?this.config.maxItemText(this.config.maxItemCount):this.config.maxItemText)),n&&this._canAddUserChoices&&""!==t&&"function"==typeof this.config.addItemFilter&&!this.config.addItemFilter(t)&&(n=!1,s="function"==typeof this.config.customAddItemText?this.config.customAddItemText(l(t),t):this.config.customAddItemText),!n||""===t||!this._isSelectElement&&this.config.duplicateItemsAllowed)||this._store.items.find((function(e){return i.config.valueComparer(e.value,t)}))&&(n=!1,s="function"==typeof this.config.uniqueItemText?this.config.uniqueItemText(l(t),t):this.config.uniqueItemText);return n&&(s="function"==typeof this.config.addItemText?this.config.addItemText(l(t),t):this.config.addItemText),{response:n,notice:{trusted:s}}},e.prototype._searchChoices=function(e){var t=e.trim().replace(/\s{2,}/," ");if(0===t.length||t===this._currentValue)return null;var i=this._store.searchableChoices,n=this._searchFn(this.config,i,t);return this._currentValue=t,this._highlightPosition=0,this._isSearching=!0,this._store.dispatch(function(e){return{type:"FILTER_CHOICES",results:e}}(n)),n.length},e.prototype._stopSearch=function(){var e=this._isSearching;this._currentValue="",this._isSearching=!1,e&&this._store.dispatch({type:"ACTIVATE_CHOICES",active:!0})},e.prototype._addEventListeners=function(){var e=this.config.shadowRoot||document.documentElement;e.addEventListener("touchend",this._onTouchEnd,!0),this.containerOuter.element.addEventListener("keydown",this._onKeyDown,!0),this.containerOuter.element.addEventListener("mousedown",this._onMouseDown,!0),e.addEventListener("click",this._onClick,{passive:!0}),e.addEventListener("touchmove",this._onTouchMove,{passive:!0}),this.dropdown.element.addEventListener("mouseover",this._onMouseOver,{passive:!0}),this._isSelectOneElement&&(this.containerOuter.element.addEventListener("focus",this._onFocus,{passive:!0}),this.containerOuter.element.addEventListener("blur",this._onBlur,{passive:!0})),this.input.element.addEventListener("keyup",this._onKeyUp,{passive:!0}),this.input.element.addEventListener("input",this._onInput,{passive:!0}),this.input.element.addEventListener("focus",this._onFocus,{passive:!0}),this.input.element.addEventListener("blur",this._onBlur,{passive:!0}),this.input.element.form&&this.input.element.form.addEventListener("reset",this._onFormReset,{passive:!0}),this.input.addEventListeners()},e.prototype._removeEventListeners=function(){var e=this.config.shadowRoot||document.documentElement;e.removeEventListener("touchend",this._onTouchEnd,!0),this.containerOuter.element.removeEventListener("keydown",this._onKeyDown,!0),this.containerOuter.element.removeEventListener("mousedown",this._onMouseDown,!0),e.removeEventListener("click",this._onClick),e.removeEventListener("touchmove",this._onTouchMove),this.dropdown.element.removeEventListener("mouseover",this._onMouseOver),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("input",this._onInput),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()},e.prototype._onKeyDown=function(e){var t=e.keyCode,i=this._store.items,n=this.input.isFocussed,s=this.dropdown.isActive,o=this.itemList.hasChildren(),r=1===e.key.length||2===e.key.length&&e.key.charCodeAt(0)>=55296||"Unidentified"===e.key;switch(this._isTextElement||s||(this.showDropdown(),!this.input.isFocussed&&r&&(this.input.value+=e.key)),t){case 65:return this._onSelectKey(e,o);case 13:return this._onEnterKey(e,i,s);case 27:return this._onEscapeKey(e,s);case 38:case 33:case 40:case 34:return this._onDirectionKey(e,s);case 8:case 46:return this._onDeleteKey(e,i,n)}},e.prototype._onKeyUp=function(){this._canSearch=this.config.searchEnabled},e.prototype._onInput=function(){var e=this.input.value;if(e){if(this._isTextElement){var t=this._canAddItem(this._store.items,e);t.notice&&(this._displayAddItemNotice(t),this.showDropdown(!0))}if(this._canSearch){this._handleSearch(e);var i=this._canAddItem(this._store.items,e);i.response||this._displayAddItemNotice(i),this._canAddUserChoices&&(this._highlightPosition=0,this._highlightChoice())}}else this._isTextElement?this.hideDropdown(!0):this._stopSearch()},e.prototype._displayAddItemNotice=function(e){var t=this._templates.notice(this.config,e.notice,"add-choice"),i="".concat(f(this.config.classNames.addChoice),"[data-choice-selectable]"),n=this.choiceList.element.querySelector(i);n?n.outerHTML=t.outerHTML:this.choiceList.prepend(t)},e.prototype._onSelectKey=function(e,t){var i=e.ctrlKey,n=e.metaKey;(i||n)&&t&&(this._canSearch=!1,this.config.removeItems&&!this.input.value&&this.input.element===document.activeElement&&this.highlightAll())},e.prototype._onEnterKey=function(e,t,i){var n=this,s=this.input.value,o=e.target;if(o&&o.hasAttribute("data-button"))return e.preventDefault(),void this._handleButtonAction(t,o);if(!i&&this._isSelectOneElement)return e.preventDefault(),void this.showDropdown();if(i){var r=this.dropdown.element.querySelector(f(this.config.classNames.highlightedState));if(r&&this._handleChoiceAction(t,r,13))return e.preventDefault(),void this.unhighlightAll();s||this.hideDropdown(!0)}o&&s&&this._canAddUserChoices&&(this._canAddItem(t,s).response&&(this._store.withDeferRendering((function(){if((n._isSelectOneElement||n.config.singleModeForMultiSelect)&&0!==t.length){var e=t[t.length-1];n._removeItem(e)}var i=!0;if(!n._isSelectElement&&n.config.duplicateItemsAllowed||(i=!n._findAndSelectChoiceByValue(s)),i){var o=l(s),r=n.config.allowHtmlUserInput||o===s?s:{escaped:o,raw:s};n._addChoice(A({value:r,label:r,selected:!0},!1))}n.clearInput(),n.unhighlightAll(),n._triggerChange(s)})),(this._isTextElement||this._isSelectOneElement)&&this.hideDropdown(!0)))},e.prototype._onEscapeKey=function(e,t){t&&(e.stopPropagation(),this.hideDropdown(!0),this.containerOuter.focus())},e.prototype._onDirectionKey=function(e,t){var i,n,s,o=e.keyCode,r=e.metaKey;if(t||this._isSelectOneElement){this.showDropdown(),this._canSearch=!1;var a=40===o||34===o?1:-1,c="[data-choice-selectable]",l=void 0;if(r||34===o||33===o)l=a>0?this.dropdown.element.querySelector("".concat(c,":last-of-type")):this.dropdown.element.querySelector(c);else{var h=this.dropdown.element.querySelector(f(this.config.classNames.highlightedState));l=h?function(e,t,i){void 0===i&&(i=1);for(var n="".concat(i>0?"next":"previous","ElementSibling"),s=e[n];s;){if(s.matches(t))return s;s=s[n]}return s}(h,c,a):this.dropdown.element.querySelector(c)}l&&(i=l,n=this.choiceList.element,void 0===(s=a)&&(s=1),i&&(s>0?n.scrollTop+n.offsetHeight>=i.offsetTop+i.offsetHeight:i.offsetTop>=n.scrollTop)||this.choiceList.scrollToChildElement(l,a),this._highlightChoice(l)),e.preventDefault()}},e.prototype._onDeleteKey=function(e,t,i){var n=e.target;this._isSelectOneElement||n.value||!i||(this._handleBackspace(t),e.preventDefault())},e.prototype._onTouchMove=function(){this._wasTap&&(this._wasTap=!1)},e.prototype._onTouchEnd=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},e.prototype._onMouseDown=function(e){var t=e.target;if(t instanceof HTMLElement){if(U&&this.choiceList.element.contains(t)){var i=this.choiceList.element.firstElementChild;this._isScrollingOnIe="ltr"===this._direction?e.offsetX>=i.offsetWidth:e.offsetX0&&this.unhighlightAll(),this.containerOuter.removeFocusState(),this.hideDropdown(!0))},e.prototype._onFocus=function(e){var t,i=this,n=e.target;n&&this.containerOuter.element.contains(n)&&((t={})[g]=function(){n===i.input.element&&i.containerOuter.addFocusState()},t[_]=function(){i.containerOuter.addFocusState(),n===i.input.element&&i.showDropdown(!0)},t[y]=function(){n===i.input.element&&(i.showDropdown(!0),i.containerOuter.addFocusState())},t)[this._elementType]()},e.prototype._onBlur=function(e){var t,i=this,n=e.target;if(n&&this.containerOuter.element.contains(n)&&!this._isScrollingOnIe){var s=this._store.activeChoices.some((function(e){return e.highlighted}));((t={})[g]=function(){n===i.input.element&&(i.containerOuter.removeFocusState(),s&&i.unhighlightAll(),i.hideDropdown(!0))},t[_]=function(){i.containerOuter.removeFocusState(),(n===i.input.element||n===i.containerOuter.element&&!i._canSearch)&&i.hideDropdown(!0)},t[y]=function(){n===i.input.element&&(i.containerOuter.removeFocusState(),i.hideDropdown(!0),s&&i.unhighlightAll())},t)[this._elementType]()}else this._isScrollingOnIe=!1,this.input.element.focus()},e.prototype._onFormReset=function(){var e=this;this._store.withDeferRendering((function(){e.clearInput(),e.hideDropdown(),e.refresh(!1,!1,!0),0!==e._initialItems.length&&e.setChoiceByValue(e._initialItems)}))},e.prototype._highlightChoice=function(e){var t,i=this;void 0===e&&(e=null);var n=Array.from(this.dropdown.element.querySelectorAll("[data-choice-selectable]"));if(n.length){var s=e;Array.from(this.dropdown.element.querySelectorAll(f(this.config.classNames.highlightedState))).forEach((function(e){var t;(t=e.classList).remove.apply(t,p(i.config.classNames.highlightedState)),e.setAttribute("aria-selected","false")})),s?this._highlightPosition=n.indexOf(s):(s=n.length>this._highlightPosition?n[this._highlightPosition]:n[n.length-1])||(s=n[0]),(t=s.classList).add.apply(t,p(this.config.classNames.highlightedState)),s.setAttribute("aria-selected","true"),this.passedElement.triggerEvent("highlightChoice",{el:s}),this.dropdown.isActive&&(this.input.setActiveDescendant(s.id),this.containerOuter.setActiveDescendant(s.id))}},e.prototype._addItem=function(e,t){void 0===t&&(t=!0);var i=e.id;if(0===i)throw new TypeError("item.id must be set before _addItem is called for a choice/item");this._store.dispatch(function(e){return{type:"ADD_ITEM",item:e}}(e)),this._isSelectOneElement&&this.removeActiveItems(i),t&&this.passedElement.triggerEvent("addItem",this._getChoiceForOutput(e))},e.prototype._removeItem=function(e){e.id&&(this._store.dispatch(function(e){return{type:"REMOVE_ITEM",item:e}}(e)),this.passedElement.triggerEvent("removeItem",this._getChoiceForOutput(e)))},e.prototype._addChoice=function(e,t){if(void 0===t&&(t=!0),0!==e.id)throw new TypeError("Can not re-add a choice which has already been added");var i=e;this._lastAddedChoiceId++,i.id=this._lastAddedChoiceId,i.elementId="".concat(this._baseId,"-").concat(this._idNames.itemChoice,"-").concat(i.id),this.config.prependValue&&(i.value=this.config.prependValue+i.value),this.config.appendValue&&(i.value+=this.config.appendValue.toString()),(this.config.prependValue||this.config.appendValue)&&i.element&&(i.element.value=i.value),this._store.dispatch(function(e){return{type:"ADD_CHOICE",choice:e}}(e)),e.selected&&this._addItem(e,t)},e.prototype._addGroup=function(e,t){var i=this;if(void 0===t&&(t=!0),0!==e.id)throw new TypeError("Can not re-add a group which has already been added");if(this._store.dispatch(function(e){return{type:"ADD_GROUP",group:e}}(e)),e.choices){var n=e;this._lastAddedGroupId++,n.id=this._lastAddedGroupId;var s=e.id,o=e.choices;n.choices=[],o.forEach((function(n){var o=n;o.groupId=s,e.disabled&&(o.disabled=!0),i._addChoice(o,t)}))}},e.prototype._getTemplate=function(e){for(var t,i=[],s=1;s/g,">").replace(/0?this.element.scrollTop+r-s:e.offsetTop;requestAnimationFrame((function(){i._animateScroll(a,t)}))}},e.prototype._scrollDown=function(e,t,i){var n=(i-e)/t,s=n>1?n:1;this.element.scrollTop=e+s},e.prototype._scrollUp=function(e,t,i){var n=(e-i)/t,s=n>1?n:1;this.element.scrollTop=e-s},e.prototype._animateScroll=function(e,t){var i=this,n=this.element.scrollTop,s=!1;t>0?(this._scrollDown(n,4,e),ne&&(s=!0)),s&&requestAnimationFrame((function(){i._animateScroll(e,t)}))},e}(),I=function(){function e(e){var t=e.element,i=e.classNames;this.element=t,this.classNames=i,this.isDisabled=!1}return Object.defineProperty(e.prototype,"isActive",{get:function(){return"active"===this.element.dataset.choice},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"dir",{get:function(){return this.element.dir},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"value",{get:function(){return this.element.value},set:function(e){this.element.setAttribute("value",e),this.element.value=e},enumerable:!1,configurable:!0}),e.prototype.conceal=function(){var e;(e=this.element.classList).add.apply(e,p(this.classNames.input)),this.element.hidden=!0,this.element.tabIndex=-1;var t=this.element.getAttribute("style");t&&this.element.setAttribute("data-choice-orig-style",t),this.element.setAttribute("data-choice","active")},e.prototype.reveal=function(){var e;(e=this.element.classList).remove.apply(e,p(this.classNames.input)),this.element.hidden=!1,this.element.removeAttribute("tabindex");var t=this.element.getAttribute("data-choice-orig-style");t?(this.element.removeAttribute("data-choice-orig-style"),this.element.setAttribute("style",t)):this.element.removeAttribute("style"),this.element.removeAttribute("data-choice"),this.element.value=this.element.value},e.prototype.enable=function(){this.element.removeAttribute("disabled"),this.element.disabled=!1,this.isDisabled=!1},e.prototype.disable=function(){this.element.setAttribute("disabled",""),this.element.disabled=!0,this.isDisabled=!0},e.prototype.triggerEvent=function(e,t){!function(e,t,i){void 0===i&&(i=null);var n=new CustomEvent(t,{detail:i,bubbles:!0,cancelable:!0});e.dispatchEvent(n)}(this.element,e,t)},e}(),w=function(e){function i(){return null!==e&&e.apply(this,arguments)||this}return t(i,e),i}(I),S=function(e,t){return void 0===t&&(t=!0),void 0===e?t:!!e},O=function(e){if("string"==typeof e&&(e=e.split(" ").filter((function(e){return 0!==e.length}))),Array.isArray(e)&&0!==e.length)return e},A=function(e,t){if("string"==typeof e)return A({value:e,label:e},!1);var i=e;if("choices"in i){if(!t)throw new TypeError("optGroup is not allowed");var n=i,s=n.choices.map((function(e){return A(e,!1)}));return{id:0,label:u(n.label)||n.value,active:0!==s.length,disabled:!!n.disabled,choices:s}}var o=i;return{id:0,groupId:0,score:0,value:o.value,label:o.label||o.value,active:S(o.active),selected:S(o.selected,!1),disabled:S(o.disabled,!1),placeholder:S(o.placeholder,!1),highlighted:!1,labelClass:O(o.labelClass),labelDescription:o.labelDescription,customProperties:o.customProperties}},T=function(e){function i(t){var i=t.element,n=t.classNames,s=t.template,o=t.extractPlaceholder,r=e.call(this,{element:i,classNames:n})||this;return r.template=s,r.extractPlaceholder=o,r}return t(i,e),Object.defineProperty(i.prototype,"placeholderOption",{get:function(){return this.element.querySelector('option[value=""]')||this.element.querySelector("option[placeholder]")},enumerable:!1,configurable:!0}),i.prototype.addOptions=function(e){var t=this;e.forEach((function(e){var i=e;if(!i.element){var n=t.template(i);t.element.appendChild(n),i.element=n}}))},i.prototype.optionsAsChoices=function(){var e=this,t=[];return this.element.querySelectorAll(":scope > option, :scope > optgroup").forEach((function(i){!function(e){return"OPTION"===e.tagName}(i)?function(e){return"OPTGROUP"===e.tagName}(i)&&t.push(e._optgroupToChoice(i)):t.push(e._optionToChoice(i))})),t},i.prototype._optionToChoice=function(e){return{id:0,groupId:0,score:0,value:e.value,label:e.innerHTML,element:e,active:!0,selected:this.extractPlaceholder?e.selected:e.hasAttribute("selected"),disabled:e.disabled,highlighted:!1,placeholder:this.extractPlaceholder&&(""===e.value||e.hasAttribute("placeholder")),labelClass:void 0!==e.dataset.labelClass?O(e.dataset.labelClass):void 0,labelDescription:void 0!==e.dataset.labelDescription?e.dataset.labelDescription:void 0,customProperties:f(e.dataset.customProperties)}},i.prototype._optgroupToChoice=function(e){var t=this,i=e.querySelectorAll("option"),n=Array.from(i).map((function(e){return t._optionToChoice(e)}));return{id:0,label:e.label||"",element:e,active:0!==n.length,disabled:e.disabled,choices:n}},i}(I),L={items:[],choices:[],silent:!1,renderChoiceLimit:-1,maxItemCount:-1,singleModeForMultiSelect:!1,addChoices:!1,addItems:!0,addItemFilter:function(e){return!!e&&""!==e},removeItems:!0,removeItemButton:!1,removeItemButtonAlignLeft:!1,editItems:!1,allowHTML:!1,allowHtmlUserInput:!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,sorter:function(e,t){var i=e.value,n=e.label,s=void 0===n?i:n,o=t.value,r=t.label,a=void 0===r?o:r;return u(s).localeCompare(u(a),[],{sensitivity:"base",ignorePunctuation:!0,numeric:!0})},shadowRoot:null,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 "'.concat(e,'"')},removeItemIconText:function(){return"Remove item"},removeItemLabelText:function(e){return"Remove item: ".concat(e)},maxItemText:function(e){return"Only ".concat(e," values can be added")},valueComparer:function(e,t){return e===t},fuseOptions:{includeScore:!0},labelId:"",callbackOnInit:null,callbackOnCreateTemplates:null,classNames:{containerOuter:["choices"],containerInner:["choices__inner"],input:["choices__input"],inputCloned:["choices__input--cloned"],list:["choices__list"],listItems:["choices__list--multiple"],listSingle:["choices__list--single"],listDropdown:["choices__list--dropdown"],item:["choices__item"],itemSelectable:["choices__item--selectable"],itemDisabled:["choices__item--disabled"],itemChoice:["choices__item--choice"],description:["choices__description"],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"],selectedState:["is-selected"],flippedState:["is-flipped"],loadingState:["is-loading"],addChoice:["choices__item","choices__item--selectable","add-choice"],noResults:["has-no-results"],noChoices:["has-no-choices"]},appendGroupInSearch:!1},D=["fuseOptions","classNames"];function N(e){return"Minified Redux error #"+e+"; visit https://redux.js.org/Errors?code="+e+" for the full message or use the non-minified dev environment for full errors. "}var x="function"==typeof Symbol&&Symbol.observable||"@@observable",P=function(){return Math.random().toString(36).substring(7).split("").join(".")},F={INIT:"@@redux/INIT"+P(),REPLACE:"@@redux/REPLACE"+P(),PROBE_UNKNOWN_ACTION:function(){return"@@redux/PROBE_UNKNOWN_ACTION"+P()}};function j(e,t,i){var n;if("function"==typeof t&&"function"==typeof i||"function"==typeof i&&"function"==typeof arguments[3])throw new Error(N(0));if("function"==typeof t&&void 0===i&&(i=t,t=void 0),void 0!==i){if("function"!=typeof i)throw new Error(N(1));return i(j)(e,t)}if("function"!=typeof e)throw new Error(N(2));var s=e,o=t,r=[],a=r,c=!1;function l(){a===r&&(a=r.slice())}function h(){if(c)throw new Error(N(3));return o}function u(e){if("function"!=typeof e)throw new Error(N(4));if(c)throw new Error(N(5));var t=!0;return l(),a.push(e),function(){if(t){if(c)throw new Error(N(6));t=!1,l();var i=a.indexOf(e);a.splice(i,1),r=null}}}function d(e){if(!function(e){if("object"!=typeof e||null===e)return!1;for(var t=e;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}(e))throw new Error(N(7));if(void 0===e.type)throw new Error(N(8));if(c)throw new Error(N(9));try{c=!0,o=s(o,e)}finally{c=!1}for(var t=r=a,i=0;i0},e.prototype.getChoiceById=function(e){return this.activeChoices.find((function(t){return t.id===e}))},e.prototype.getGroupById=function(e){return this.groups.find((function(t){return t.id===e}))},e}(),B=function(e,t){return e?function(e){if("string"==typeof e)return e;if("object"==typeof e){if("escaped"in e)return e.escaped;if("trusted"in e)return e.trusted}return""}(t):l(t)},k=function(e,t){if(t){var i=e.dataset;"string"==typeof t?i.customProperties=t:"object"!=typeof t||function(e){for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0}(t)||(i.customProperties=JSON.stringify(t))}},K={containerOuter:function(e,t,i,n,s,o,r){var a=e.classNames.containerOuter,c=Object.assign(document.createElement("div"),{className:p(a).join(" ")});return c.dataset.type=o,t&&(c.dir=t),n&&(c.tabIndex=0),i&&(c.setAttribute("role",s?"combobox":"listbox"),s&&c.setAttribute("aria-autocomplete","list")),c.setAttribute("aria-haspopup","true"),c.setAttribute("aria-expanded","false"),r&&c.setAttribute("aria-labelledby",r),c},containerInner:function(e){var t=e.classNames.containerInner;return Object.assign(document.createElement("div"),{className:p(t).join(" ")})},itemList:function(e,t){var i=e.classNames,n=i.list,s=i.listSingle,o=i.listItems;return Object.assign(document.createElement("div"),{className:"".concat(p(n).join(" ")," ").concat(t?p(s).join(" "):p(o).join(" "))})},placeholder:function(e,t){var i=e.allowHTML,n=e.classNames.placeholder;return Object.assign(document.createElement("div"),{className:p(n).join(" "),innerHTML:B(i,t)})},item:function(e,t,i){var n,s,o,r=e.allowHTML,a=e.removeItemButtonAlignLeft,c=e.classNames,h=c.item,u=c.button,d=c.highlightedState,m=c.itemSelectable,f=c.placeholder,v=t.id,g=t.value,_=t.label,y=t.labelClass,b=t.labelDescription,E=t.customProperties,C=t.active,I=t.disabled,w=t.highlighted,S=t.placeholder,O=Object.assign(document.createElement("div"),{className:p(h).join(" ")});if(y){var A=Object.assign(document.createElement("span"),{innerHTML:B(r,_),className:p(y).join(" ")});O.appendChild(A)}else O.innerHTML=B(r,_);if(Object.assign(O.dataset,{item:"",id:v,value:g}),y&&(O.dataset.labelClass=p(y).join(" ")),b&&(O.dataset.labelDescription=b),k(O,E),C&&O.setAttribute("aria-selected","true"),I&&O.setAttribute("aria-disabled","true"),S&&((n=O.classList).add.apply(n,p(f)),O.dataset.placeholder=""),(s=O.classList).add.apply(s,p(w?d:m)),i){I&&(o=O.classList).remove.apply(o,p(m)),O.dataset.deletable="";var T="function"==typeof this.config.removeItemIconText?this.config.removeItemIconText(l(g),g):this.config.removeItemIconText,L="function"==typeof this.config.removeItemLabelText?this.config.removeItemLabelText(l(g),g):this.config.removeItemLabelText,D=Object.assign(document.createElement("button"),{type:"button",className:p(u).join(" "),innerHTML:T});D.setAttribute("aria-label",L),D.dataset.button="",a?O.insertAdjacentElement("afterbegin",D):O.appendChild(D)}return O},choiceList:function(e,t){var i=e.classNames.list,n=Object.assign(document.createElement("div"),{className:p(i).join(" ")});return t||n.setAttribute("aria-multiselectable","true"),n.setAttribute("role","listbox"),n},choiceGroup:function(e,t){var i=e.allowHTML,n=e.classNames,s=n.group,o=n.groupHeading,r=n.itemDisabled,a=t.id,c=t.label,l=t.disabled,h=Object.assign(document.createElement("div"),{className:"".concat(p(s).join(" ")," ").concat(l?p(r).join(" "):"")});return h.setAttribute("role","group"),Object.assign(h.dataset,{group:"",id:a,value:c}),l&&h.setAttribute("aria-disabled","true"),h.appendChild(Object.assign(document.createElement("div"),{className:p(o).join(" "),innerHTML:B(i,c)})),h},choice:function(e,t,i){var n,s,o,r,a,c=e.allowHTML,l=e.classNames,h=l.item,u=l.itemChoice,d=l.itemSelectable,m=l.selectedState,f=l.itemDisabled,v=l.description,g=l.placeholder,_=t.id,y=t.value,b=t.label,E=t.groupId,C=t.elementId,I=t.labelClass,w=t.labelDescription,S=t.disabled,O=t.selected,A=t.placeholder,T=Object.assign(document.createElement("div"),{id:C,className:"".concat(p(h).join(" ")," ").concat(p(u).join(" "))}),L=T;if(I){var D=Object.assign(document.createElement("span"),{innerHTML:B(c,b),className:p(I).join(" ")});L=D,T.appendChild(D)}else T.innerHTML=B(c,b);if(w){var N="".concat(C,"-description");L.setAttribute("aria-describedby",N);var x=Object.assign(document.createElement("span"),{innerHTML:B(c,w),id:N});(n=x.classList).add.apply(n,p(v)),T.appendChild(x)}return O&&(s=T.classList).add.apply(s,p(m)),A&&(o=T.classList).add.apply(o,p(g)),T.setAttribute("role",E&&E>0?"treeitem":"option"),Object.assign(T.dataset,{choice:"",id:_,value:y,selectText:i}),I&&(T.dataset.labelClass=p(I).join(" ")),w&&(T.dataset.labelDescription=w),S?((r=T.classList).add.apply(r,p(f)),T.dataset.choiceDisabled="",T.setAttribute("aria-disabled","true")):((a=T.classList).add.apply(a,p(d)),T.dataset.choiceSelectable=""),T},input:function(e,t){var i=e.classNames,n=i.input,s=i.inputCloned,o=Object.assign(document.createElement("input"),{type:"search",className:"".concat(p(n).join(" ")," ").concat(p(s).join(" ")),autocomplete:"off",autocapitalize:"off",spellcheck:!1});return o.setAttribute("role","textbox"),o.setAttribute("aria-autocomplete","list"),t&&o.setAttribute("aria-label",t),o},dropdown:function(e){var t,i,n=e.classNames,s=n.list,o=n.listDropdown,r=document.createElement("div");return(t=r.classList).add.apply(t,p(s)),(i=r.classList).add.apply(i,p(o)),r.setAttribute("aria-expanded","false"),r},notice:function(e,t,i){var s=e.allowHTML,o=e.classNames,r=o.item,a=o.itemChoice,c=o.addChoice,l=o.noResults,h=o.noChoices;void 0===i&&(i="");var u=n(n([],p(r),!0),p(a),!0);switch(i){case"add-choice":u.push.apply(u,p(c));break;case"no-results":u.push.apply(u,p(l));break;case"no-choices":u.push.apply(u,p(h))}var d=Object.assign(document.createElement("div"),{innerHTML:B(s,t),className:u.join(" ")});return"add-choice"===i&&(d.dataset.choiceSelectable="",d.dataset.choice=""),d},option:function(e){var t=e.label,i=e.value,n=e.labelClass,s=e.labelDescription,o=e.customProperties,r=e.active,a=e.disabled,c=u(t),l=new Option(c,i,!1,r);return n&&(l.dataset.labelClass=p(n).join(" ")),s&&(l.dataset.labelDescription=s),k(l,o),l.disabled=a,l}},U="-ms-scroll-limit"in document.documentElement.style&&"-ms-ime-align"in document.documentElement.style,q={},G=function(e){if(e){var t=e.dataset.id;return t?parseInt(t,10):void 0}},W=function(){function e(t,n){void 0===t&&(t="[data-choice]"),void 0===n&&(n={});var s=this;this._hasNonChoicePlaceholder=!1,this._lastAddedChoiceId=0,this._lastAddedGroupId=0,this.config=i(i(i({},e.defaults.allOptions),e.defaults.options),n),D.forEach((function(t){s.config[t]=i(i(i({},e.defaults.allOptions[t]),e.defaults.options[t]),n[t])}));var r,a,l,h,u=(r=this.config,a=L,l=Object.keys(r).sort(),h=Object.keys(a).sort(),l.filter((function(e){return h.indexOf(e)<0})));u.length&&console.warn("Unknown config option(s) passed",u.join(", ")),!this.config.silent&&this.config.allowHTML&&this.config.allowHtmlUserInput&&(this.config.addItems&&console.warn("Warning: allowHTML/allowHtmlUserInput/addItems all being true is strongly not recommended and may lead to XSS attacks"),this.config.addChoices&&console.warn("Warning: allowHTML/allowHtmlUserInput/addChoices all being true is strongly not recommended and may lead to XSS attacks"));var d=this.config.shadowRoot||document.documentElement,p="string"==typeof t?d.querySelector(t):t;if(!p||"object"!=typeof p||"INPUT"!==p.tagName&&!function(e){return"SELECT"===e.tagName}(p)){if(!p&&"string"==typeof t)throw TypeError("Selector ".concat(t," failed to find an element"));throw TypeError("Expected one of the following types text|select-one|select-multiple")}if(this._elementType=p.type,this._isTextElement=this._elementType===g,(this._isTextElement||1!==this.config.maxItemCount)&&(this.config.singleModeForMultiSelect=!1),this.config.singleModeForMultiSelect&&(this._elementType=y),this._isSelectOneElement=this._elementType===_,this._isSelectMultipleElement=this._elementType===y,this._isSelectElement=this._isSelectOneElement||this._isSelectMultipleElement,this._canAddUserChoices=this._isTextElement&&this.config.addItems||this._isSelectElement&&this.config.addChoices,["auto","always"].includes("".concat(this.config.renderSelectedChoices))||(this.config.renderSelectedChoices="auto"),this.config.placeholder&&(this.config.placeholderValue?this._hasNonChoicePlaceholder=!0:p.dataset.placeholder&&(this._hasNonChoicePlaceholder=!0,this.config.placeholderValue=p.dataset.placeholder)),n.addItemFilter&&"function"!=typeof n.addItemFilter){var m=n.addItemFilter instanceof RegExp?n.addItemFilter:new RegExp(n.addItemFilter);this.config.addItemFilter=m.test.bind(m)}if(this._isTextElement)this.passedElement=new w({element:p,classNames:this.config.classNames});else{var f=p;this.passedElement=new T({element:f,classNames:this.config.classNames,template:function(e){return s._templates.option(e)},extractPlaceholder:this.config.placeholder&&!this._hasNonChoicePlaceholder})}if(this.initialised=!1,this._store=new V,this._initialState=M,this._currentState=M,this._prevState=M,this._currentValue="",this.config.searchEnabled=!this._isTextElement&&this.config.searchEnabled||this._elementType===y,this._canSearch=this.config.searchEnabled,this._isScrollingOnIe=!1,this._highlightPosition=0,this._wasTap=!0,this._placeholderValue=this._generatePlaceholderValue(),this._baseId=function(e,t){var i=e.id||e.name&&"".concat(e.name,"-").concat(c(2))||c(4);return i=i.replace(/(:|\.|\[|\]|,)/g,""),"".concat(t,"-").concat(i)}(this.passedElement.element,"choices-"),this._searchFn=o,this._direction=this.passedElement.dir,!this._direction){var v=window.getComputedStyle(this.passedElement.element).direction;v!==window.getComputedStyle(document.documentElement).direction&&(this._direction=v)}if(this._idNames={itemChoice:"item-choice"},this._render=this._render.bind(this),this._onFocus=this._onFocus.bind(this),this._onBlur=this._onBlur.bind(this),this._onKeyUp=this._onKeyUp.bind(this),this._onKeyDown=this._onKeyDown.bind(this),this._onInput=this._onInput.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._onSelectKey=this._onSelectKey.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),this.passedElement.isActive)return this.config.silent||console.warn("Trying to initialise Choices on element already initialised",{element:t}),void(this.initialised=!0);this.init(),this._initialItems=this._store.items.map((function(e){return e.value}))}return Object.defineProperty(e,"defaults",{get:function(){return Object.preventExtensions({get options(){return q},get allOptions(){return L},get templates(){return K}})},enumerable:!1,configurable:!0}),e.prototype.init=function(){if(!this.initialised){this._loadChoices(),this._createTemplates(),this._createElements(),this._createStructure(),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&&"function"==typeof e&&e.call(this)}},e.prototype.destroy=function(){this.initialised&&(this._removeEventListeners(),this.passedElement.reveal(),this.containerOuter.unwrap(this.passedElement.element),this.clearStore(),this._stopSearch(),this._templates=K,this.initialised=!1)},e.prototype.enable=function(){return this.passedElement.isDisabled&&this.passedElement.enable(),this.containerOuter.isDisabled&&(this._addEventListeners(),this.input.enable(),this.containerOuter.enable()),this},e.prototype.disable=function(){return this.passedElement.isDisabled||this.passedElement.disable(),this.containerOuter.isDisabled||(this._removeEventListeners(),this.input.disable(),this.containerOuter.disable()),this},e.prototype.highlightItem=function(e,t){if(void 0===t&&(t=!0),!e||!e.id)return this;var i=this._store.choices.find((function(t){return t.id===e.id}));return!i||i.highlighted||(this._store.dispatch(r(i,!0)),t&&this.passedElement.triggerEvent("highlightItem",this._getChoiceForOutput(i))),this},e.prototype.unhighlightItem=function(e,t){if(void 0===t&&(t=!0),!e||!e.id)return this;var i=this._store.choices.find((function(t){return t.id===e.id}));return i&&i.highlighted?(this._store.dispatch(r(i,!1)),t&&this.passedElement.triggerEvent("highlightItem",this._getChoiceForOutput(i)),this):this},e.prototype.highlightAll=function(){var e=this;return this._store.withDeferRendering((function(){e._store.items.forEach((function(t){return e.highlightItem(t)}))})),this},e.prototype.unhighlightAll=function(){var e=this;return this._store.withDeferRendering((function(){e._store.items.forEach((function(t){return e.unhighlightItem(t)}))})),this},e.prototype.removeActiveItemsByValue=function(e){var t=this;return this._store.withDeferRendering((function(){t._store.items.filter((function(t){return t.value===e})).forEach((function(e){return t._removeItem(e)}))})),this},e.prototype.removeActiveItems=function(e){var t=this;return this._store.withDeferRendering((function(){t._store.items.filter((function(t){return t.id!==e})).forEach((function(e){return t._removeItem(e)}))})),this},e.prototype.removeHighlightedItems=function(e){var t=this;return void 0===e&&(e=!1),this._store.withDeferRendering((function(){t._store.highlightedActiveItems.forEach((function(i){t._removeItem(i),e&&t._triggerChange(i.value)}))})),this},e.prototype.showDropdown=function(e){var t=this;return this.dropdown.isActive||requestAnimationFrame((function(){t.dropdown.show(),t.containerOuter.open(t.dropdown.distanceFromTopWindow),!e&&t._canSearch&&t.input.focus(),t.passedElement.triggerEvent("showDropdown",{})})),this},e.prototype.hideDropdown=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("hideDropdown",{})})),this):this},e.prototype.getValue=function(e){var t=this;void 0===e&&(e=!1);var i=this._store.items.reduce((function(i,n){var s=e?n.value:t._getChoiceForOutput(n);return i.push(s),i}),[]);return this._isSelectOneElement||this.config.singleModeForMultiSelect?i[0]:i},e.prototype.setValue=function(e){var t=this;return this.initialised?(this._store.withDeferRendering((function(){e.forEach((function(e){e&&t._addChoice(A(e,!1))}))})),this):this},e.prototype.setChoiceByValue=function(e){var t=this;return!this.initialised||this._isTextElement||this._store.withDeferRendering((function(){(Array.isArray(e)?e:[e]).forEach((function(e){return t._findAndSelectChoiceByValue(e)}))})),this},e.prototype.setChoices=function(e,t,n,s){var o=this;if(void 0===e&&(e=[]),void 0===t&&(t="value"),void 0===n&&(n="label"),void 0===s&&(s=!1),!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("string"!=typeof t||!t)throw new TypeError("value parameter must be a name of 'value' field in passed objects");if(s&&this.clearChoices(),"function"==typeof e){var r=e(this);if("function"==typeof Promise&&r instanceof Promise)return new Promise((function(e){return requestAnimationFrame(e)})).then((function(){return o._handleLoadingState(!0)})).then((function(){return r})).then((function(e){return o.setChoices(e,t,n,s)})).catch((function(e){o.config.silent||console.error(e)})).then((function(){return o._handleLoadingState(!1)})).then((function(){return o}));if(!Array.isArray(r))throw new TypeError(".setChoices first argument function must return either array of choices or Promise, got: ".concat(typeof r));return this.setChoices(r,t,n,!1)}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");return this.containerOuter.removeLoadingState(),this._store.withDeferRendering((function(){var s="value"===t,r="label"===n;e.forEach((function(e){if("choices"in e){var a=e;r||(a=i(i({},a),{label:a[n]})),o._addGroup(A(a,!0))}else{var c=e;r&&s||(c=i(i({},c),{value:c[t],label:c[n]})),o._addChoice(A(c,!1))}}))})),this},e.prototype.refresh=function(e,t,i){var n=this;return void 0===e&&(e=!1),void 0===t&&(t=!1),void 0===i&&(i=!1),this._isSelectElement?(this._store.withDeferRendering((function(){var s=n.passedElement.optionsAsChoices(),o=n._store.items,r={};i||o.forEach((function(e){e.id&&e.active&&e.selected&&!e.disabled&&(r[e.value]=!0)})),s.forEach((function(e){if(!("choices"in e)){var t=e;i?t.selected=!1:r[t.value]&&(t.selected=!0)}})),n.clearStore(),n._addPredefinedChoices(s,t,e),n._isSearching&&n._searchChoices(n.input.value)})),this):(this.config.silent||console.warn("refresh method can only be used on choices backed by a element"),this)},e.prototype.removeChoice=function(e){var t=this._store.choices.find((function(t){return t.value===e}));return t?(this._store.dispatch(function(e){return{type:"REMOVE_CHOICE",choice:e}}(t)),t.selected&&this.passedElement.triggerEvent("removeItem",this._getChoiceForOutput(t)),this):this},e.prototype.clearChoices=function(){return this._store.dispatch({type:"CLEAR_CHOICES"}),this},e.prototype.clearStore=function(){return this._store.dispatch({type:"CLEAR_ALL"}),this._lastAddedChoiceId=0,this._lastAddedGroupId=0,this},e.prototype.clearInput=function(){var e=!this._isSelectOneElement;return this.input.clear(e),this._isSearching&&this._stopSearch(),this},e.prototype._render=function(){if(!this._store.isLoading()){this._currentState=this._store.state;var e=this._currentState.items!==this._prevState.items;(this._currentState.choices!==this._prevState.choices||this._currentState.groups!==this._prevState.groups||e)&&(this._isSelectElement&&this._renderChoices(),e&&this._renderItems(),this._prevState=this._currentState)}},e.prototype._renderChoices=function(){var e=this,t=this._store,i=t.activeGroups,n=t.activeChoices,s=document.createDocumentFragment();if(this.choiceList.clear(),this.config.resetScrollPosition&&requestAnimationFrame((function(){return e.choiceList.scrollToTop()})),i.length>=1&&!this._isSearching){var o=n.filter((function(e){return e.placeholder&&-1===e.groupId}));o.length>=1&&(s=this._createChoicesFragment(o,s)),s=this._createGroupsFragment(i,n,s)}else n.length>=1&&(s=this._createChoicesFragment(n,s));var r=this.input.value,a=this._canAddItem(this._store.items,r);if(s.childNodes&&s.childNodes.length>0){var c=!a.response;if(a.response&&(this.choiceList.append(s),this._highlightChoice(),this._canAddUserChoices&&r&&a.notice&&(c=!n.find((function(t){return e.config.valueComparer(t.value,r)})))),c){var l=this._templates.notice(this.config,a.notice,this._canAddUserChoices?"add-choice":"");this.choiceList.prepend(l)}}else{var h=void 0;if(a.response&&this._canAddUserChoices&&r)h=this._templates.notice(this.config,a.notice,"add-choice");else if(this._isSearching){l="function"==typeof this.config.noResultsText?this.config.noResultsText():this.config.noResultsText;h=this._templates.notice(this.config,l,"no-results")}else{l="function"==typeof this.config.noChoicesText?this.config.noChoicesText():this.config.noChoicesText;h=this._templates.notice(this.config,l,"no-choices")}this.choiceList.append(h)}},e.prototype._renderItems=function(){var e=this._store.items||[];this.itemList.clear();var t=this._createItemsFragment(e);t.childNodes&&this.itemList.append(t)},e.prototype._createGroupsFragment=function(e,t,i){var n=this;void 0===i&&(i=document.createDocumentFragment());this.config.shouldSort&&e.sort(this.config.sorter);var s=t.filter((function(e){return 0===e.groupId}));return s.length>0&&this._createChoicesFragment(s,i,!1),e.forEach((function(e){var s=function(e){return t.filter((function(t){return n._isSelectOneElement?t.groupId===e.id:t.groupId===e.id&&("always"===n.config.renderSelectedChoices||!t.selected)}))}(e);if(s.length>=1){var o=n._templates.choiceGroup(n.config,e);i.appendChild(o),n._createChoicesFragment(s,i,!0)}})),i},e.prototype._createChoicesFragment=function(e,t,i){var s=this;void 0===t&&(t=document.createDocumentFragment()),void 0===i&&(i=!1);var o=this.config,r=o.renderSelectedChoices,a=o.searchResultLimit,c=o.renderChoiceLimit,l=o.appendGroupInSearch,h=this._isSearching?d:this.config.sorter,u=function(e){if("auto"!==r||(s._isSelectOneElement||!e.selected)){var i=s._templates.choice(s.config,e,s.config.itemSelectText);if(l){var n="";s._store.groups.every((function(t){return t.id!==e.groupId||(n=t.label,!1)})),n&&s._isSearching&&(i.innerHTML+=" (".concat(n,")"))}t.appendChild(i)}},p=e;if("auto"!==r||this._isSelectOneElement||(p=e.filter((function(e){return!e.selected}))),this._isSelectElement){var m=e.filter((function(e){return!e.element}));0!==m.length&&this.passedElement.addOptions(m)}var f=p.reduce((function(e,t){return t.placeholder?e.placeholderChoices.push(t):e.normalChoices.push(t),e}),{placeholderChoices:[],normalChoices:[]}),v=f.placeholderChoices,g=f.normalChoices;(this.config.shouldSort||this._isSearching)&&g.sort(h);var _=p.length,y=this._isSelectOneElement?n(n([],v,!0),g,!0):g;this._isSearching?_=a:c&&c>0&&!i&&(_=c);for(var b=0;b<_;b+=1)y[b]&&u(y[b]);return t},e.prototype._createItemsFragment=function(e,t){var i=this;void 0===t&&(t=document.createDocumentFragment());var n=this.config,s=n.shouldSortItems,o=n.sorter,r=n.removeItemButton;s&&!this._isSelectOneElement&&e.sort(o),this._isTextElement&&(this.passedElement.value=e.map((function(e){return e.value})).join(this.config.delimiter));var a=function(e){var n=i._templates.item(i.config,e,r);t.appendChild(n)};return e.forEach(a),this._isSelectOneElement&&this._hasNonChoicePlaceholder&&0===e.length&&a(A({selected:!0,value:"",label:this.config.placeholderValue||"",active:!0,placeholder:!0},!1)),t},e.prototype._getChoiceForOutput=function(e,t){if(e){var i=e.groupId>0?this._store.getGroupById(e.groupId):null;return{id:e.id,highlighted:e.highlighted,labelClass:e.labelClass,labelDescription:e.labelDescription,customProperties:e.customProperties,disabled:e.disabled,active:e.active,label:e.label,placeholder:e.placeholder,value:e.value,groupValue:i&&i.label?i.label:void 0,element:e.element,keyCode:t}}},e.prototype._triggerChange=function(e){null!=e&&this.passedElement.triggerEvent("change",{value:e})},e.prototype._selectPlaceholderChoice=function(e){this._addItem(e),e.value&&this._triggerChange(e.value)},e.prototype._handleButtonAction=function(e,t){if(0!==e.length&&this.config.removeItems&&this.config.removeItemButton){var i=t&&G(t.parentNode),n=i&&e.find((function(e){return e.id===i}));if(n&&(this._removeItem(n),this._triggerChange(n.value),this._isSelectOneElement&&!this._hasNonChoicePlaceholder)){var s=this._store.placeholderChoice;s&&this._selectPlaceholderChoice(s)}}},e.prototype._handleItemAction=function(e,t,i){var n=this;if(void 0===i&&(i=!1),0!==e.length&&this.config.removeItems&&!this._isSelectOneElement){var s=G(t);s&&(e.forEach((function(e){e.id!==s||e.highlighted?!i&&e.highlighted&&n.unhighlightItem(e):n.highlightItem(e)})),this.input.focus())}},e.prototype._handleChoiceAction=function(e,t,i){var n=this,s=G(t),o=s&&this._store.getChoiceById(s);if(!o)return!1;var r=this.dropdown.isActive,a=!1;return this._store.withDeferRendering((function(){if(!o.selected&&!o.disabled&&n._canAddItem(e,o.value).response){if(n.config.singleModeForMultiSelect&&0!==e.length){var t=e[e.length-1];n._removeItem(t)}n.passedElement.triggerEvent("choice",n._getChoiceForOutput(o,i)),n._addItem(o),n.clearInput(),a=!0}})),!!a&&(this._triggerChange(o.value),r&&(this.config.singleModeForMultiSelect||this._isSelectOneElement)&&(this.hideDropdown(!0),this.containerOuter.focus()),!0)},e.prototype._handleBackspace=function(e){if(this.config.removeItems&&0!==e.length){var t=e[e.length-1],i=e.some((function(e){return e.highlighted}));this.config.editItems&&!i&&t?(this.input.value=t.value,this.input.setWidth(),this._removeItem(t),this._triggerChange(t.value)):(i||this.highlightItem(t,!1),this.removeHighlightedItems(!0))}},e.prototype._loadChoices=function(){var e;if(this._isTextElement){this._presetItems=this.config.items.map((function(e){return A(e,!1)}));var t=this.passedElement.value;if(t){var i=t.split(this.config.delimiter).map((function(e){return A(e,!1)}));this._presetItems=this._presetItems.concat(i)}this._presetItems.forEach((function(e){e.selected=!0}))}else if(this._isSelectElement){this._presetChoices=this.config.choices.map((function(e){return A(e,!0)}));var n=this.passedElement.optionsAsChoices();n&&(e=this._presetChoices).push.apply(e,n)}},e.prototype._startLoading=function(){this._store.startDeferRendering()},e.prototype._stopLoading=function(){this._store.stopDeferRendering()},e.prototype._handleLoadingState=function(e){void 0===e&&(e=!0);var t=this.itemList.element.querySelector(m(this.config.classNames.placeholder));e?(this.disable(),this.containerOuter.addLoadingState(),this._isSelectOneElement?t?t.innerHTML=this.config.loadingText:(t=this._templates.placeholder(this.config,this.config.loadingText))&&this.itemList.append(t):this.input.placeholder=this.config.loadingText):(this.enable(),this.containerOuter.removeLoadingState(),this._isSelectOneElement?t&&(t.innerHTML=this._placeholderValue||""):this.input.placeholder=this._placeholderValue||"")},e.prototype._handleSearch=function(e){if(this.input.isFocussed){var t=this._store.choices,i=this.config,n=i.searchFloor,s=i.searchChoices,o=t.some((function(e){return!e.active}));if(null!=e&&e.length>=n){var r=s?this._searchChoices(e):0;null!==r&&this.passedElement.triggerEvent("search",{value:e,resultCount:r})}else o&&this._stopSearch()}},e.prototype._canAddItem=function(e,t){var i=this,n=!0,s="";(this.config.maxItemCount>0&&this.config.maxItemCount<=e.length&&(this.config.singleModeForMultiSelect||(n=!1,s="function"==typeof this.config.maxItemText?this.config.maxItemText(this.config.maxItemCount):this.config.maxItemText)),n&&this._canAddUserChoices&&""!==t&&"function"==typeof this.config.addItemFilter&&!this.config.addItemFilter(t)&&(n=!1,s="function"==typeof this.config.customAddItemText?this.config.customAddItemText(l(t),t):this.config.customAddItemText),!n||""===t||!this._isSelectElement&&this.config.duplicateItemsAllowed)||this._store.items.find((function(e){return i.config.valueComparer(e.value,t)}))&&(n=!1,s="function"==typeof this.config.uniqueItemText?this.config.uniqueItemText(l(t),t):this.config.uniqueItemText);return n&&(s="function"==typeof this.config.addItemText?this.config.addItemText(l(t),t):this.config.addItemText),{response:n,notice:{trusted:s}}},e.prototype._searchChoices=function(e){var t=e.trim().replace(/\s{2,}/," ");if(0===t.length||t===this._currentValue)return null;var i=this._store.searchableChoices,n=this._searchFn(this.config,i,t);return this._currentValue=t,this._highlightPosition=0,this._isSearching=!0,this._store.dispatch(function(e){return{type:"FILTER_CHOICES",results:e}}(n)),n.length},e.prototype._stopSearch=function(){var e=this._isSearching;this._currentValue="",this._isSearching=!1,e&&this._store.dispatch({type:"ACTIVATE_CHOICES",active:!0})},e.prototype._addEventListeners=function(){var e=this.config.shadowRoot||document.documentElement;e.addEventListener("touchend",this._onTouchEnd,!0),this.containerOuter.element.addEventListener("keydown",this._onKeyDown,!0),this.containerOuter.element.addEventListener("mousedown",this._onMouseDown,!0),e.addEventListener("click",this._onClick,{passive:!0}),e.addEventListener("touchmove",this._onTouchMove,{passive:!0}),this.dropdown.element.addEventListener("mouseover",this._onMouseOver,{passive:!0}),this._isSelectOneElement&&(this.containerOuter.element.addEventListener("focus",this._onFocus,{passive:!0}),this.containerOuter.element.addEventListener("blur",this._onBlur,{passive:!0})),this.input.element.addEventListener("keyup",this._onKeyUp,{passive:!0}),this.input.element.addEventListener("input",this._onInput,{passive:!0}),this.input.element.addEventListener("focus",this._onFocus,{passive:!0}),this.input.element.addEventListener("blur",this._onBlur,{passive:!0}),this.input.element.form&&this.input.element.form.addEventListener("reset",this._onFormReset,{passive:!0}),this.input.addEventListeners()},e.prototype._removeEventListeners=function(){var e=this.config.shadowRoot||document.documentElement;e.removeEventListener("touchend",this._onTouchEnd,!0),this.containerOuter.element.removeEventListener("keydown",this._onKeyDown,!0),this.containerOuter.element.removeEventListener("mousedown",this._onMouseDown,!0),e.removeEventListener("click",this._onClick),e.removeEventListener("touchmove",this._onTouchMove),this.dropdown.element.removeEventListener("mouseover",this._onMouseOver),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("input",this._onInput),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()},e.prototype._onKeyDown=function(e){var t=e.keyCode,i=this._store.items,n=this.input.isFocussed,s=this.dropdown.isActive,o=this.itemList.hasChildren(),r=1===e.key.length||2===e.key.length&&e.key.charCodeAt(0)>=55296||"Unidentified"===e.key;switch(this._isTextElement||s||(this.showDropdown(),!this.input.isFocussed&&r&&(this.input.value+=e.key)),t){case 65:return this._onSelectKey(e,o);case 13:return this._onEnterKey(e,i,s);case 27:return this._onEscapeKey(e,s);case 38:case 33:case 40:case 34:return this._onDirectionKey(e,s);case 8:case 46:return this._onDeleteKey(e,i,n)}},e.prototype._onKeyUp=function(){this._canSearch=this.config.searchEnabled},e.prototype._onInput=function(){var e=this.input.value;if(e){if(this._isTextElement){var t=this._canAddItem(this._store.items,e);t.notice&&(this._displayAddItemNotice(t),this.showDropdown(!0))}if(this._canSearch){this._handleSearch(e);var i=this._canAddItem(this._store.items,e);i.response||this._displayAddItemNotice(i),this._canAddUserChoices&&(this._highlightPosition=0,this._highlightChoice())}}else this._isTextElement?this.hideDropdown(!0):this._stopSearch()},e.prototype._displayAddItemNotice=function(e){var t=this._templates.notice(this.config,e.notice,"add-choice"),i="".concat(m(this.config.classNames.addChoice),"[data-choice-selectable]"),n=this.choiceList.element.querySelector(i);n?n.outerHTML=t.outerHTML:this.choiceList.prepend(t)},e.prototype._onSelectKey=function(e,t){var i=e.ctrlKey,n=e.metaKey;(i||n)&&t&&(this._canSearch=!1,this.config.removeItems&&!this.input.value&&this.input.element===document.activeElement&&this.highlightAll())},e.prototype._onEnterKey=function(e,t,i){var n=this,s=this.input.value,o=e.target;if(o&&o.hasAttribute("data-button"))return e.preventDefault(),void this._handleButtonAction(t,o);if(!i&&this._isSelectOneElement)return e.preventDefault(),void this.showDropdown();if(i){var r=this.dropdown.element.querySelector(m(this.config.classNames.highlightedState));if(r&&this._handleChoiceAction(t,r,13))return e.preventDefault(),void this.unhighlightAll();s||this.hideDropdown(!0)}o&&s&&this._canAddUserChoices&&(this._canAddItem(t,s).response&&(this._store.withDeferRendering((function(){if((n._isSelectOneElement||n.config.singleModeForMultiSelect)&&0!==t.length){var e=t[t.length-1];n._removeItem(e)}var i=!0;if(!n._isSelectElement&&n.config.duplicateItemsAllowed||(i=!n._findAndSelectChoiceByValue(s)),i){var o=l(s),r=n.config.allowHtmlUserInput||o===s?s:{escaped:o,raw:s};n._addChoice(A({value:r,label:r,selected:!0},!1))}n.clearInput(),n.unhighlightAll(),n._triggerChange(s)})),(this._isTextElement||this._isSelectOneElement)&&this.hideDropdown(!0)))},e.prototype._onEscapeKey=function(e,t){t&&(e.stopPropagation(),this.hideDropdown(!0),this.containerOuter.focus())},e.prototype._onDirectionKey=function(e,t){var i,n,s,o=e.keyCode,r=e.metaKey;if(t||this._isSelectOneElement){this.showDropdown(),this._canSearch=!1;var a=40===o||34===o?1:-1,c="[data-choice-selectable]",l=void 0;if(r||34===o||33===o)l=a>0?this.dropdown.element.querySelector("".concat(c,":last-of-type")):this.dropdown.element.querySelector(c);else{var h=this.dropdown.element.querySelector(m(this.config.classNames.highlightedState));l=h?function(e,t,i){void 0===i&&(i=1);for(var n="".concat(i>0?"next":"previous","ElementSibling"),s=e[n];s;){if(s.matches(t))return s;s=s[n]}return s}(h,c,a):this.dropdown.element.querySelector(c)}l&&(i=l,n=this.choiceList.element,void 0===(s=a)&&(s=1),i&&(s>0?n.scrollTop+n.offsetHeight>=i.offsetTop+i.offsetHeight:i.offsetTop>=n.scrollTop)||this.choiceList.scrollToChildElement(l,a),this._highlightChoice(l)),e.preventDefault()}},e.prototype._onDeleteKey=function(e,t,i){var n=e.target;this._isSelectOneElement||n.value||!i||(this._handleBackspace(t),e.preventDefault())},e.prototype._onTouchMove=function(){this._wasTap&&(this._wasTap=!1)},e.prototype._onTouchEnd=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},e.prototype._onMouseDown=function(e){var t=e.target;if(t instanceof HTMLElement){if(U&&this.choiceList.element.contains(t)){var i=this.choiceList.element.firstElementChild;this._isScrollingOnIe="ltr"===this._direction?e.offsetX>=i.offsetWidth:e.offsetX0&&this.unhighlightAll(),this.containerOuter.removeFocusState(),this.hideDropdown(!0))},e.prototype._onFocus=function(e){var t,i=this,n=e.target;n&&this.containerOuter.element.contains(n)&&((t={})[g]=function(){n===i.input.element&&i.containerOuter.addFocusState()},t[_]=function(){i.containerOuter.addFocusState(),n===i.input.element&&i.showDropdown(!0)},t[y]=function(){n===i.input.element&&(i.showDropdown(!0),i.containerOuter.addFocusState())},t)[this._elementType]()},e.prototype._onBlur=function(e){var t,i=this,n=e.target;if(n&&this.containerOuter.element.contains(n)&&!this._isScrollingOnIe){var s=this._store.activeChoices.some((function(e){return e.highlighted}));((t={})[g]=function(){n===i.input.element&&(i.containerOuter.removeFocusState(),s&&i.unhighlightAll(),i.hideDropdown(!0))},t[_]=function(){i.containerOuter.removeFocusState(),(n===i.input.element||n===i.containerOuter.element&&!i._canSearch)&&i.hideDropdown(!0)},t[y]=function(){n===i.input.element&&(i.containerOuter.removeFocusState(),i.hideDropdown(!0),s&&i.unhighlightAll())},t)[this._elementType]()}else this._isScrollingOnIe=!1,this.input.element.focus()},e.prototype._onFormReset=function(){var e=this;this._store.withDeferRendering((function(){e.clearInput(),e.hideDropdown(),e.refresh(!1,!1,!0),0!==e._initialItems.length&&e.setChoiceByValue(e._initialItems)}))},e.prototype._highlightChoice=function(e){var t,i=this;void 0===e&&(e=null);var n=Array.from(this.dropdown.element.querySelectorAll("[data-choice-selectable]"));if(n.length){var s=e;Array.from(this.dropdown.element.querySelectorAll(m(this.config.classNames.highlightedState))).forEach((function(e){var t;(t=e.classList).remove.apply(t,p(i.config.classNames.highlightedState)),e.setAttribute("aria-selected","false")})),s?this._highlightPosition=n.indexOf(s):(s=n.length>this._highlightPosition?n[this._highlightPosition]:n[n.length-1])||(s=n[0]),(t=s.classList).add.apply(t,p(this.config.classNames.highlightedState)),s.setAttribute("aria-selected","true"),this.passedElement.triggerEvent("highlightChoice",{el:s}),this.dropdown.isActive&&(this.input.setActiveDescendant(s.id),this.containerOuter.setActiveDescendant(s.id))}},e.prototype._addItem=function(e,t){void 0===t&&(t=!0);var i=e.id;if(0===i)throw new TypeError("item.id must be set before _addItem is called for a choice/item");this._store.dispatch(function(e){return{type:"ADD_ITEM",item:e}}(e)),this._isSelectOneElement&&this.removeActiveItems(i),t&&this.passedElement.triggerEvent("addItem",this._getChoiceForOutput(e))},e.prototype._removeItem=function(e){e.id&&(this._store.dispatch(function(e){return{type:"REMOVE_ITEM",item:e}}(e)),this.passedElement.triggerEvent("removeItem",this._getChoiceForOutput(e)))},e.prototype._addChoice=function(e,t){if(void 0===t&&(t=!0),0!==e.id)throw new TypeError("Can not re-add a choice which has already been added");var i=e;this._lastAddedChoiceId++,i.id=this._lastAddedChoiceId,i.elementId="".concat(this._baseId,"-").concat(this._idNames.itemChoice,"-").concat(i.id),this.config.prependValue&&(i.value=this.config.prependValue+i.value),this.config.appendValue&&(i.value+=this.config.appendValue.toString()),(this.config.prependValue||this.config.appendValue)&&i.element&&(i.element.value=i.value),this._store.dispatch(function(e){return{type:"ADD_CHOICE",choice:e}}(e)),e.selected&&this._addItem(e,t)},e.prototype._addGroup=function(e,t){var i=this;if(void 0===t&&(t=!0),0!==e.id)throw new TypeError("Can not re-add a group which has already been added");if(this._store.dispatch(function(e){return{type:"ADD_GROUP",group:e}}(e)),e.choices){var n=e;this._lastAddedGroupId++,n.id=this._lastAddedGroupId;var s=e.id,o=e.choices;n.choices=[],o.forEach((function(n){var o=n;o.groupId=s,e.disabled&&(o.disabled=!0),i._addChoice(o,t)}))}},e.prototype._getTemplate=function(e){for(var t,i=[],s=1;sSelect multiple inputs +
+
+ + +
+
+
+
+
+ + +
+
+
+
+ +
Text inputs addItems: false, }); + new Choices('#choices-disabled-via-fieldset', { + allowHTML: true, + }); + new Choices('#choices-disabled-via-attr', { allowHTML: true, }); diff --git a/src/scripts/choices.ts b/src/scripts/choices.ts index 115263bdd..649f1297c 100644 --- a/src/scripts/choices.ts +++ b/src/scripts/choices.ts @@ -388,8 +388,12 @@ class Choices implements ChoicesInterface { this._addEventListeners(); const shouldDisable = - !this.config.addItems || - this.passedElement.element.hasAttribute('disabled'); + (this._isTextElement && !this.config.addItems) || + (this._isSelectElement && + !this.config.addChoices && + this._store.choices.length === 0) || + this.passedElement.element.hasAttribute('disabled') || + !!this.passedElement.element.closest('fieldset:disabled'); if (shouldDisable) { this.disable();