var fe=function(i,e){return fe=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,s){t.__proto__=s}||function(t,s){for(var n in s)Object.prototype.hasOwnProperty.call(s,n)&&(t[n]=s[n])},fe(i,e)};function Ye(i,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");fe(i,e);function t(){this.constructor=i}i.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var D=function(){return D=Object.assign||function(e){for(var t,s=1,n=arguments.length;s0?"next":"previous","ElementSibling"),n=i[s];n;){if(n.matches(e))return n;n=n[s]}return null},pt=function(i,e,t){t===void 0&&(t=1);var s;return t>0?s=e.scrollTop+e.offsetHeight>=i.offsetTop+i.offsetHeight:s=i.offsetTop>=e.scrollTop,s},ae=function(i){if(typeof i!="string"){if(i==null)return"";if(typeof i=="object"){if("raw"in i)return ae(i.raw);if("trusted"in i)return i.trusted}return i}return i.replace(/&/g,"&").replace(/>/g,">").replace(/=0&&!window.matchMedia("(min-height: ".concat(e+1,"px)")).matches:this.position==="top"&&(s=!0),s},i.prototype.setActiveDescendant=function(e){this.element.setAttribute("aria-activedescendant",e)},i.prototype.removeActiveDescendant=function(){this.element.removeAttribute("aria-activedescendant")},i.prototype.open=function(e,t){_(this.element,this.classNames.openState),this.element.setAttribute("aria-expanded","true"),this.isOpen=!0,this.shouldFlip(e,t)&&(_(this.element,this.classNames.flippedState),this.isFlipped=!0)},i.prototype.close=function(){k(this.element,this.classNames.openState),this.element.setAttribute("aria-expanded","false"),this.removeActiveDescendant(),this.isOpen=!1,this.isFlipped&&(k(this.element,this.classNames.flippedState),this.isFlipped=!1)},i.prototype.addFocusState=function(){_(this.element,this.classNames.focusState)},i.prototype.removeFocusState=function(){k(this.element,this.classNames.focusState)},i.prototype.enable=function(){k(this.element,this.classNames.disabledState),this.element.removeAttribute("aria-disabled"),this.type===G.SelectOne&&this.element.setAttribute("tabindex","0"),this.isDisabled=!1},i.prototype.disable=function(){_(this.element,this.classNames.disabledState),this.element.setAttribute("aria-disabled","true"),this.type===G.SelectOne&&this.element.setAttribute("tabindex","-1"),this.isDisabled=!0},i.prototype.wrap=function(e){var t=this.element,s=e.parentNode;s&&(e.nextSibling?s.insertBefore(t,e.nextSibling):s.appendChild(t)),t.appendChild(e)},i.prototype.unwrap=function(e){var t=this.element,s=t.parentNode;s&&(s.insertBefore(e,t),s.removeChild(t))},i.prototype.addLoadingState=function(){_(this.element,this.classNames.loadingState),this.element.setAttribute("aria-busy","true"),this.isLoading=!0},i.prototype.removeLoadingState=function(){k(this.element,this.classNames.loadingState),this.element.removeAttribute("aria-busy"),this.isLoading=!1},i}(),St=function(){function i(e){var t=e.element,s=e.type,n=e.classNames,r=e.preventPaste;this.element=t,this.type=s,this.classNames=n,this.preventPaste=r,this.isFocussed=this.element.isEqualNode(document.activeElement),this.isDisabled=t.disabled,this._onPaste=this._onPaste.bind(this),this._onInput=this._onInput.bind(this),this._onFocus=this._onFocus.bind(this),this._onBlur=this._onBlur.bind(this)}return Object.defineProperty(i.prototype,"placeholder",{set:function(e){this.element.placeholder=e},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"value",{get:function(){return this.element.value},set:function(e){this.element.value=e},enumerable:!1,configurable:!0}),i.prototype.addEventListeners=function(){var e=this.element;e.addEventListener("paste",this._onPaste),e.addEventListener("input",this._onInput,{passive:!0}),e.addEventListener("focus",this._onFocus,{passive:!0}),e.addEventListener("blur",this._onBlur,{passive:!0})},i.prototype.removeEventListeners=function(){var e=this.element;e.removeEventListener("input",this._onInput),e.removeEventListener("paste",this._onPaste),e.removeEventListener("focus",this._onFocus),e.removeEventListener("blur",this._onBlur)},i.prototype.enable=function(){var e=this.element;e.removeAttribute("disabled"),this.isDisabled=!1},i.prototype.disable=function(){var e=this.element;e.setAttribute("disabled",""),this.isDisabled=!0},i.prototype.focus=function(){this.isFocussed||this.element.focus()},i.prototype.blur=function(){this.isFocussed&&this.element.blur()},i.prototype.clear=function(e){return e===void 0&&(e=!0),this.element.value="",e&&this.setWidth(),this},i.prototype.setWidth=function(){var e=this.element;e.style.minWidth="".concat(e.placeholder.length+1,"ch"),e.style.width="".concat(e.value.length+1,"ch")},i.prototype.setActiveDescendant=function(e){this.element.setAttribute("aria-activedescendant",e)},i.prototype.removeActiveDescendant=function(){this.element.removeAttribute("aria-activedescendant")},i.prototype._onInput=function(){this.type!==G.SelectOne&&this.setWidth()},i.prototype._onPaste=function(e){this.preventPaste&&e.preventDefault()},i.prototype._onFocus=function(){this.isFocussed=!0},i.prototype._onBlur=function(){this.isFocussed=!1},i}(),It=4,Re=function(){function i(e){var t=e.element;this.element=t,this.scrollPos=this.element.scrollTop,this.height=this.element.offsetHeight}return i.prototype.prepend=function(e){var t=this.element.firstElementChild;t?this.element.insertBefore(e,t):this.element.append(e)},i.prototype.scrollToTop=function(){this.element.scrollTop=0},i.prototype.scrollToChildElement=function(e,t){var s=this;if(e){var n=this.element.offsetHeight,r=this.element.scrollTop+n,o=e.offsetHeight,a=e.offsetTop+o,l=t>0?this.element.scrollTop+a-r:e.offsetTop;requestAnimationFrame(function(){s._animateScroll(l,t)})}},i.prototype._scrollDown=function(e,t,s){var n=(s-e)/t,r=n>1?n:1;this.element.scrollTop=e+r},i.prototype._scrollUp=function(e,t,s){var n=(e-s)/t,r=n>1?n:1;this.element.scrollTop=e-r},i.prototype._animateScroll=function(e,t){var s=this,n=It,r=this.element.scrollTop,o=!1;t>0?(this._scrollDown(r,n,e),re&&(o=!0)),o&&requestAnimationFrame(function(){s._animateScroll(e,t)})},i}(),Xe=function(){function i(e){var t=e.element,s=e.classNames;this.element=t,this.classNames=s,this.isDisabled=!1}return Object.defineProperty(i.prototype,"isActive",{get:function(){return this.element.dataset.choice==="active"},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"dir",{get:function(){return this.element.dir},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"value",{get:function(){return this.element.value},set:function(e){this.element.setAttribute("value",e),this.element.value=e},enumerable:!1,configurable:!0}),i.prototype.conceal=function(){var e=this.element;_(e,this.classNames.input),e.hidden=!0,e.tabIndex=-1;var t=e.getAttribute("style");t&&e.setAttribute("data-choice-orig-style",t),e.setAttribute("data-choice","active")},i.prototype.reveal=function(){var e=this.element;k(e,this.classNames.input),e.hidden=!1,e.removeAttribute("tabindex");var t=e.getAttribute("data-choice-orig-style");t?(e.removeAttribute("data-choice-orig-style"),e.setAttribute("style",t)):e.removeAttribute("style"),e.removeAttribute("data-choice")},i.prototype.enable=function(){this.element.removeAttribute("disabled"),this.element.disabled=!1,this.isDisabled=!1},i.prototype.disable=function(){this.element.setAttribute("disabled",""),this.element.disabled=!0,this.isDisabled=!0},i.prototype.triggerEvent=function(e,t){gt(this.element,e,t||{})},i}(),wt=function(i){Ye(e,i);function e(){return i!==null&&i.apply(this,arguments)||this}return e}(Xe),J=function(i,e){return e===void 0&&(e=!0),typeof i>"u"?e:!!i},ze=function(i){if(typeof i=="string"&&(i=i.split(" ").filter(function(e){return e.length})),Array.isArray(i)&&i.length)return i},R=function(i,e,t){if(t===void 0&&(t=!0),typeof i=="string"){var s=ae(i),n=t||s===i?i:{escaped:s,raw:i},r=R({value:i,label:n,selected:!0},!1);return r}var o=i;if("choices"in o){if(!e)throw new TypeError("optGroup is not allowed");var a=o,l=a.choices.map(function(f){return R(f,!1)}),h={id:0,label:W(a.label)||a.value,active:!!l.length,disabled:!!a.disabled,choices:l};return h}var c=o,u={id:0,group:null,score:0,rank:0,value:c.value,label:c.label||c.value,active:J(c.active),selected:J(c.selected,!1),disabled:J(c.disabled,!1),placeholder:J(c.placeholder,!1),highlighted:!1,labelClass:ze(c.labelClass),labelDescription:c.labelDescription,customProperties:c.customProperties};return u},At=function(i){return i.tagName==="INPUT"},Je=function(i){return i.tagName==="SELECT"},Ot=function(i){return i.tagName==="OPTION"},Tt=function(i){return i.tagName==="OPTGROUP"},Lt=function(i){Ye(e,i);function e(t){var s=t.element,n=t.classNames,r=t.template,o=t.extractPlaceholder,a=i.call(this,{element:s,classNames:n})||this;return a.template=r,a.extractPlaceholder=o,a}return Object.defineProperty(e.prototype,"placeholderOption",{get:function(){return this.element.querySelector('option[value=""]')||this.element.querySelector("option[placeholder]")},enumerable:!1,configurable:!0}),e.prototype.addOptions=function(t){var s=this,n=document.createDocumentFragment();t.forEach(function(r){var o=r;if(!o.element){var a=s.template(o);n.appendChild(a),o.element=a}}),this.element.appendChild(n)},e.prototype.optionsAsChoices=function(){var t=this,s=[];return this.element.querySelectorAll(":scope > option, :scope > optgroup").forEach(function(n){Ot(n)?s.push(t._optionToChoice(n)):Tt(n)&&s.push(t._optgroupToChoice(n))}),s},e.prototype._optionToChoice=function(t){return!t.hasAttribute("value")&&t.hasAttribute("placeholder")&&(t.setAttribute("value",""),t.value=""),{id:0,group:null,score:0,rank:0,value:t.value,label:t.label,element:t,active:!0,selected:this.extractPlaceholder?t.selected:t.hasAttribute("selected"),disabled:t.disabled,highlighted:!1,placeholder:this.extractPlaceholder&&(!t.value||t.hasAttribute("placeholder")),labelClass:typeof t.dataset.labelClass<"u"?ze(t.dataset.labelClass):void 0,labelDescription:typeof t.dataset.labelDescription<"u"?t.dataset.labelDescription:void 0,customProperties:bt(t.dataset.customProperties)}},e.prototype._optgroupToChoice=function(t){var s=this,n=t.querySelectorAll("option"),r=Array.from(n).map(function(o){return s._optionToChoice(o)});return{id:0,label:t.label||"",element:t,active:!!r.length,disabled:t.disabled,choices:r}},e}(Xe),xt={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"],notice:["choices__notice"],addChoice:["choices__item--selectable","add-choice"],noResults:["has-no-results"],noChoices:["has-no-choices"]},ke={items:[],choices:[],silent:!1,renderChoiceLimit:-1,maxItemCount:-1,closeDropdownOnSelect:"auto",singleModeForMultiSelect:!1,addChoices:!1,addItems:!0,addItemFilter:function(i){return!!i&&i!==""},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:vt,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(i){return'Press Enter to add "'.concat(i,'"')},removeItemIconText:function(){return"Remove item"},removeItemLabelText:function(i){return"Remove item: ".concat(i)},maxItemText:function(i){return"Only ".concat(i," values can be added")},valueComparer:function(i,e){return i===e},fuseOptions:{includeScore:!0},labelId:"",callbackOnInit:null,callbackOnCreateTemplates:null,classNames:xt,appendGroupInSearch:!1},He=function(i){var e=i.itemEl;e&&(e.remove(),i.itemEl=void 0)};function Nt(i,e,t){var s=i,n=!0;switch(e.type){case C.ADD_ITEM:{e.item.selected=!0;var r=e.item.element;r&&(r.selected=!0,r.setAttribute("selected","")),s.push(e.item);break}case C.REMOVE_ITEM:{e.item.selected=!1;var r=e.item.element;if(r){r.selected=!1,r.removeAttribute("selected");var o=r.parentElement;o&&Je(o)&&o.type===G.SelectOne&&(o.value="")}He(e.item),s=s.filter(function(c){return c.id!==e.item.id});break}case C.REMOVE_CHOICE:{He(e.choice),s=s.filter(function(h){return h.id!==e.choice.id});break}case C.HIGHLIGHT_ITEM:{var a=e.highlighted,l=s.find(function(h){return h.id===e.item.id});l&&l.highlighted!==a&&(l.highlighted=a,t&&Et(l,a?t.classNames.highlightedState:t.classNames.selectedState,a?t.classNames.selectedState:t.classNames.highlightedState));break}default:{n=!1;break}}return{state:s,update:n}}function Dt(i,e){var t=i,s=!0;switch(e.type){case C.ADD_GROUP:{t.push(e.group);break}case C.CLEAR_CHOICES:{t=[];break}default:{s=!1;break}}return{state:t,update:s}}function Mt(i,e,t){var s=i,n=!0;switch(e.type){case C.ADD_CHOICE:{s.push(e.choice);break}case C.REMOVE_CHOICE:{e.choice.choiceEl=void 0,e.choice.group&&(e.choice.group.choices=e.choice.group.choices.filter(function(o){return o.id!==e.choice.id})),s=s.filter(function(o){return o.id!==e.choice.id});break}case C.ADD_ITEM:case C.REMOVE_ITEM:{e.item.choiceEl=void 0;break}case C.FILTER_CHOICES:{var r=[];e.results.forEach(function(o){r[o.item.id]=o}),s.forEach(function(o){var a=r[o.id];a!==void 0?(o.score=a.score,o.rank=a.rank,o.active=!0):(o.score=0,o.rank=0,o.active=!1),t&&t.appendGroupInSearch&&(o.choiceEl=void 0)});break}case C.ACTIVATE_CHOICES:{s.forEach(function(o){o.active=e.active,t&&t.appendGroupInSearch&&(o.choiceEl=void 0)});break}case C.CLEAR_CHOICES:{s=[];break}default:{n=!1;break}}return{state:s,update:n}}var Ke={groups:Dt,items:Nt,choices:Mt},Pt=function(){function i(e){this._state=this.defaultState,this._listeners=[],this._txn=0,this._context=e}return Object.defineProperty(i.prototype,"defaultState",{get:function(){return{groups:[],items:[],choices:[]}},enumerable:!1,configurable:!0}),i.prototype.changeSet=function(e){return{groups:e,items:e,choices:e}},i.prototype.reset=function(){this._state=this.defaultState;var e=this.changeSet(!0);this._txn?this._changeSet=e:this._listeners.forEach(function(t){return t(e)})},i.prototype.subscribe=function(e){return this._listeners.push(e),this},i.prototype.dispatch=function(e){var t=this,s=this._state,n=!1,r=this._changeSet||this.changeSet(!1);Object.keys(Ke).forEach(function(o){var a=Ke[o](s[o],e,t._context);a.update&&(n=!0,r[o]=!0,s[o]=a.state)}),n&&(this._txn?this._changeSet=r:this._listeners.forEach(function(o){return o(r)}))},i.prototype.withTxn=function(e){this._txn++;try{e()}finally{if(this._txn=Math.max(0,this._txn-1),!this._txn){var t=this._changeSet;t&&(this._changeSet=void 0,this._listeners.forEach(function(s){return s(t)}))}}},Object.defineProperty(i.prototype,"state",{get:function(){return this._state},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"items",{get:function(){return this.state.items},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"highlightedActiveItems",{get:function(){return this.items.filter(function(e){return e.active&&e.highlighted})},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"choices",{get:function(){return this.state.choices},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"activeChoices",{get:function(){return this.choices.filter(function(e){return e.active})},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"searchableChoices",{get:function(){return this.choices.filter(function(e){return!e.disabled&&!e.placeholder})},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"groups",{get:function(){return this.state.groups},enumerable:!1,configurable:!0}),Object.defineProperty(i.prototype,"activeGroups",{get:function(){var e=this;return this.state.groups.filter(function(t){var s=t.active&&!t.disabled,n=e.state.choices.some(function(r){return r.active&&!r.disabled});return s&&n},[])},enumerable:!1,configurable:!0}),i.prototype.inTxn=function(){return this._txn>0},i.prototype.getChoiceById=function(e){return this.activeChoices.find(function(t){return t.id===e})},i.prototype.getGroupById=function(e){return this.groups.find(function(t){return t.id===e})},i}(),O={noChoices:"no-choices",noResults:"no-results",addChoice:"add-choice",generic:""};function Ft(i,e,t){return(e=kt(e))in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function je(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var s=Object.getOwnPropertySymbols(i);e&&(s=s.filter(function(n){return Object.getOwnPropertyDescriptor(i,n).enumerable})),t.push.apply(t,s)}return t}function q(i){for(var e=1;e`Invalid value for key ${i}`,$t=i=>`Pattern length exceeds max of ${i}.`,Wt=i=>`Missing ${i} property in key`,Yt=i=>`Property 'weight' in key '${i}' must be a positive integer`,Ve=Object.prototype.hasOwnProperty,pe=class{constructor(e){this._keys=[],this._keyMap={};let t=0;e.forEach(s=>{let n=tt(s);this._keys.push(n),this._keyMap[n.id]=n,t+=n.weight}),this._keys.forEach(s=>{s.weight/=t})}get(e){return this._keyMap[e]}keys(){return this._keys}toJSON(){return JSON.stringify(this._keys)}};function tt(i){let e=null,t=null,s=null,n=1,r=null;if(H(i)||B(i))s=i,e=Be(i),t=me(i);else{if(!Ve.call(i,"name"))throw new Error(Wt("name"));let o=i.name;if(s=o,Ve.call(i,"weight")&&(n=i.weight,n<=0))throw new Error(Yt(o));e=Be(o),t=me(o),r=i.getFn}return{path:e,id:t,weight:n,src:s,getFn:r}}function Be(i){return B(i)?i:i.split(".")}function me(i){return B(i)?i.join("."):i}function qt(i,e){let t=[],s=!1,n=(r,o,a)=>{if(M(r))if(!o[a])t.push(r);else{let l=o[a],h=r[l];if(!M(h))return;if(a===o.length-1&&(H(h)||Qe(h)||Vt(h)))t.push(jt(h));else if(B(h)){s=!0;for(let c=0,u=h.length;ci.score===e.score?i.idx{this._keysMap[t.id]=s})}create(){this.isCreated||!this.docs.length||(this.isCreated=!0,H(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){let t=this.size();H(e)?this._addString(e,t):this._addObject(e,t)}removeAt(e){this.records.splice(e,1);for(let t=e,s=this.size();t{let o=n.getFn?n.getFn(e):this.getFn(e,n.path);if(M(o)){if(B(o)){let a=[],l=[{nestedArrIndex:-1,value:o}];for(;l.length;){let{nestedArrIndex:h,value:c}=l.pop();if(M(c))if(H(c)&&!he(c)){let u={v:c,i:h,n:this.norm.get(c)};a.push(u)}else B(c)&&c.forEach((u,f)=>{l.push({nestedArrIndex:f,value:u})})}s.$[r]=a}else if(H(o)&&!he(o)){let a={v:o,n:this.norm.get(o)};s.$[r]=a}}}),this.records.push(s)}toJSON(){return{keys:this.keys,records:this.records}}};function it(i,e,{getFn:t=v.getFn,fieldNormWeight:s=v.fieldNormWeight}={}){let n=new Z({getFn:t,fieldNormWeight:s});return n.setKeys(i.map(tt)),n.setSources(e),n.create(),n}function ti(i,{getFn:e=v.getFn,fieldNormWeight:t=v.fieldNormWeight}={}){let{keys:s,records:n}=i,r=new Z({getFn:e,fieldNormWeight:t});return r.setKeys(s),r.setIndexRecords(n),r}function ie(i,{errors:e=0,currentLocation:t=0,expectedLocation:s=0,distance:n=v.distance,ignoreLocation:r=v.ignoreLocation}={}){let o=e/i.length;if(r)return o;let a=Math.abs(s-t);return n?o+a/n:a?1:o}function ii(i=[],e=v.minMatchCharLength){let t=[],s=-1,n=-1,r=0;for(let o=i.length;r=e&&t.push([s,n]),s=-1)}return i[r-1]&&r-s>=e&&t.push([s,r-1]),t}var $=32;function si(i,e,t,{location:s=v.location,distance:n=v.distance,threshold:r=v.threshold,findAllMatches:o=v.findAllMatches,minMatchCharLength:a=v.minMatchCharLength,includeMatches:l=v.includeMatches,ignoreLocation:h=v.ignoreLocation}={}){if(e.length>$)throw new Error($t($));let c=e.length,u=i.length,f=Math.max(0,Math.min(s,u)),m=r,d=f,p=a>1||l,y=p?Array(u):[],g;for(;(g=i.indexOf(e,d))>-1;){let x=ie(e,{currentLocation:g,expectedLocation:f,distance:n,ignoreLocation:h});if(m=Math.min(x,m),d=g+c,p){let P=0;for(;P=b;I-=1){let ee=I-1,Le=t[i.charAt(ee)];if(p&&(y[ee]=+!!Le),A[I]=(A[I+1]<<1|1)&Le,x&&(A[I]|=(w[I+1]|w[I])<<1|1|w[I+1]),A[I]&ce&&(T=ie(e,{errors:x,currentLocation:ee,expectedLocation:f,distance:n,ignoreLocation:h}),T<=m)){if(m=T,d=ee,d<=f)break;b=Math.max(1,2*f-d)}}if(ie(e,{errors:x+1,currentLocation:f,expectedLocation:f,distance:n,ignoreLocation:h})>m)break;w=A}let Y={isMatch:d>=0,score:Math.max(.001,T)};if(p){let x=ii(y,a);x.length?l&&(Y.indices=x):Y.isMatch=!1}return Y}function ni(i){let e={};for(let t=0,s=i.length;t{this.chunks.push({pattern:f,alphabet:ni(f),startIndex:m})},u=this.pattern.length;if(u>$){let f=0,m=u%$,d=u-m;for(;f{let{isMatch:g,score:w,indices:T}=si(e,d,p,{location:n+y,distance:r,threshold:o,findAllMatches:a,minMatchCharLength:l,includeMatches:s,ignoreLocation:h});g&&(f=!0),u+=w,g&&T&&(c=[...c,...T])});let m={isMatch:f,score:f?u/this.chunks.length:1};return f&&s&&(m.indices=c),m}},K=class{constructor(e){this.pattern=e}static isMultiMatch(e){return Ge(e,this.multiRegex)}static isSingleMatch(e){return Ge(e,this.singleRegex)}search(){}};function Ge(i,e){let t=i.match(e);return t?t[1]:null}var ve=class extends K{constructor(e){super(e)}static get type(){return"exact"}static get multiRegex(){return/^="(.*)"$/}static get singleRegex(){return/^=(.*)$/}search(e){let t=e===this.pattern;return{isMatch:t,score:t?0:1,indices:[0,this.pattern.length-1]}}},_e=class extends K{constructor(e){super(e)}static get type(){return"inverse-exact"}static get multiRegex(){return/^!"(.*)"$/}static get singleRegex(){return/^!(.*)$/}search(e){let s=e.indexOf(this.pattern)===-1;return{isMatch:s,score:s?0:1,indices:[0,e.length-1]}}},ge=class extends K{constructor(e){super(e)}static get type(){return"prefix-exact"}static get multiRegex(){return/^\^"(.*)"$/}static get singleRegex(){return/^\^(.*)$/}search(e){let t=e.startsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,this.pattern.length-1]}}},ye=class extends K{constructor(e){super(e)}static get type(){return"inverse-prefix-exact"}static get multiRegex(){return/^!\^"(.*)"$/}static get singleRegex(){return/^!\^(.*)$/}search(e){let t=!e.startsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,e.length-1]}}},be=class extends K{constructor(e){super(e)}static get type(){return"suffix-exact"}static get multiRegex(){return/^"(.*)"\$$/}static get singleRegex(){return/^(.*)\$$/}search(e){let t=e.endsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[e.length-this.pattern.length,e.length-1]}}},Ee=class extends K{constructor(e){super(e)}static get type(){return"inverse-suffix-exact"}static get multiRegex(){return/^!"(.*)"\$$/}static get singleRegex(){return/^!(.*)\$$/}search(e){let t=!e.endsWith(this.pattern);return{isMatch:t,score:t?0:1,indices:[0,e.length-1]}}},ne=class extends K{constructor(e,{location:t=v.location,threshold:s=v.threshold,distance:n=v.distance,includeMatches:r=v.includeMatches,findAllMatches:o=v.findAllMatches,minMatchCharLength:a=v.minMatchCharLength,isCaseSensitive:l=v.isCaseSensitive,ignoreLocation:h=v.ignoreLocation}={}){super(e),this._bitapSearch=new se(e,{location:t,threshold:s,distance:n,includeMatches:r,findAllMatches:o,minMatchCharLength:a,isCaseSensitive:l,ignoreLocation:h})}static get type(){return"fuzzy"}static get multiRegex(){return/^"(.*)"$/}static get singleRegex(){return/^(.*)$/}search(e){return this._bitapSearch.searchIn(e)}},re=class extends K{constructor(e){super(e)}static get type(){return"include"}static get multiRegex(){return/^'"(.*)"$/}static get singleRegex(){return/^'(.*)$/}search(e){let t=0,s,n=[],r=this.pattern.length;for(;(s=e.indexOf(this.pattern,t))>-1;)t=s+r,n.push([s,t-1]);let o=!!n.length;return{isMatch:o,score:o?0:1,indices:n}}},Ce=[ve,re,ge,ye,Ee,be,_e,ne],Ue=Ce.length,ri=/ +(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/,oi="|";function ai(i,e={}){return i.split(oi).map(t=>{let s=t.trim().split(ri).filter(r=>r&&!!r.trim()),n=[];for(let r=0,o=s.length;r!!(i[oe.AND]||i[oe.OR]),hi=i=>!!i[Ae.PATH],ui=i=>!B(i)&&Ze(i)&&!Oe(i),$e=i=>({[oe.AND]:Object.keys(i).map(e=>({[e]:i[e]}))});function st(i,e,{auto:t=!0}={}){let s=n=>{let r=Object.keys(n),o=hi(n);if(!o&&r.length>1&&!Oe(n))return s($e(n));if(ui(n)){let l=o?n[Ae.PATH]:r[0],h=o?n[Ae.PATTERN]:n[l];if(!H(h))throw new Error(Ut(l));let c={keyId:me(l),pattern:h};return t&&(c.searcher=we(h,e)),c}let a={children:[],operator:r[0]};return r.forEach(l=>{let h=n[l];B(h)&&h.forEach(c=>{a.children.push(s(c))})}),a};return Oe(i)||(i=$e(i)),s(i)}function di(i,{ignoreFieldNorm:e=v.ignoreFieldNorm}){i.forEach(t=>{let s=1;t.matches.forEach(({key:n,norm:r,score:o})=>{let a=n?n.weight:null;s*=Math.pow(o===0&&a?Number.EPSILON:o,(a||1)*(e?1:r))}),t.score=s})}function fi(i,e){let t=i.matches;e.matches=[],M(t)&&t.forEach(s=>{if(!M(s.indices)||!s.indices.length)return;let{indices:n,value:r}=s,o={indices:n,value:r};s.key&&(o.key=s.key.src),s.idx>-1&&(o.refIndex=s.idx),e.matches.push(o)})}function pi(i,e){e.score=i.score}function mi(i,e,{includeMatches:t=v.includeMatches,includeScore:s=v.includeScore}={}){let n=[];return t&&n.push(fi),s&&n.push(pi),i.map(r=>{let{idx:o}=r,a={item:e[o],refIndex:o};return n.length&&n.forEach(l=>{l(r,a)}),a})}var U=class{constructor(e,t={},s){this.options=q(q({},v),t),this.options.useExtendedSearch,this._keyStore=new pe(this.options.keys),this.setCollection(e,s)}setCollection(e,t){if(this._docs=e,t&&!(t instanceof Z))throw new Error(Gt);this._myIndex=t||it(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight})}add(e){M(e)&&(this._docs.push(e),this._myIndex.add(e))}remove(e=()=>!1){let t=[];for(let s=0,n=this._docs.length;s-1&&(l=l.slice(0,t)),mi(l,this._docs,{includeMatches:s,includeScore:n})}_searchStringList(e){let t=we(e,this.options),{records:s}=this._myIndex,n=[];return s.forEach(({v:r,i:o,n:a})=>{if(!M(r))return;let{isMatch:l,score:h,indices:c}=t.searchIn(r);l&&n.push({item:r,idx:o,matches:[{score:h,value:r,norm:a,indices:c}]})}),n}_searchLogical(e){let t=st(e,this.options),s=(a,l,h)=>{if(!a.children){let{keyId:u,searcher:f}=a,m=this._findMatches({key:this._keyStore.get(u),value:this._myIndex.getValueForItemAtKeyId(l,u),searcher:f});return m&&m.length?[{idx:h,item:l,matches:m}]:[]}let c=[];for(let u=0,f=a.children.length;u{if(M(a)){let h=s(t,a,l);h.length&&(r[l]||(r[l]={idx:l,item:a,matches:[]},o.push(r[l])),h.forEach(({matches:c})=>{r[l].matches.push(...c)}))}}),o}_searchObjectList(e){let t=we(e,this.options),{keys:s,records:n}=this._myIndex,r=[];return n.forEach(({$:o,i:a})=>{if(!M(o))return;let l=[];s.forEach((h,c)=>{l.push(...this._findMatches({key:h,value:o[c],searcher:t}))}),l.length&&r.push({idx:a,item:o,matches:l})}),r}_findMatches({key:e,value:t,searcher:s}){if(!M(t))return[];let n=[];if(B(t))t.forEach(({v:r,i:o,n:a})=>{if(!M(r))return;let{isMatch:l,score:h,indices:c}=s.searchIn(r);l&&n.push({score:h,key:e,value:r,idx:o,norm:a,indices:c})});else{let{v:r,n:o}=t,{isMatch:a,score:l,indices:h}=s.searchIn(r);a&&n.push({score:l,key:e,value:r,norm:o,indices:h})}return n}};U.version="7.0.0";U.createIndex=it;U.parseIndex=ti;U.config=v;U.parseQuery=st;ci(Se);var vi=function(){function i(e){this._haystack=[],this._fuseOptions=D(D({},e.fuseOptions),{keys:rt([],e.searchFields,!0),includeMatches:!0})}return i.prototype.index=function(e){this._haystack=e,this._fuse&&this._fuse.setCollection(e)},i.prototype.reset=function(){this._haystack=[],this._fuse=void 0},i.prototype.isEmptyIndex=function(){return!this._haystack.length},i.prototype.search=function(e){this._fuse||(this._fuse=new U(this._haystack,this._fuseOptions));var t=this._fuse.search(e);return t.map(function(s,n){return{item:s.item,score:s.score||0,rank:n+1}})},i}();function _i(i){return new vi(i)}var gi=function(i){for(var e in i)if(Object.prototype.hasOwnProperty.call(i,e))return!1;return!0},ue=function(i,e,t){var s=i.dataset,n=e.customProperties,r=e.labelClass,o=e.labelDescription;r&&(s.labelClass=le(r).join(" ")),o&&(s.labelDescription=o),t&&n&&(typeof n=="string"?s.customProperties=n:typeof n=="object"&&!gi(n)&&(s.customProperties=JSON.stringify(n)))},We=function(i,e,t){var s=e&&i.querySelector("label[for='".concat(e,"']")),n=s&&s.innerText;n&&t.setAttribute("aria-label",n)},yi={containerOuter:function(i,e,t,s,n,r,o){var a=i.classNames.containerOuter,l=document.createElement("div");return _(l,a),l.dataset.type=r,e&&(l.dir=e),s&&(l.tabIndex=0),t&&(l.setAttribute("role",n?"combobox":"listbox"),n?l.setAttribute("aria-autocomplete","list"):o||We(this._docRoot,this.passedElement.element.id,l),l.setAttribute("aria-haspopup","true"),l.setAttribute("aria-expanded","false")),o&&l.setAttribute("aria-labelledby",o),l},containerInner:function(i){var e=i.classNames.containerInner,t=document.createElement("div");return _(t,e),t},itemList:function(i,e){var t=i.searchEnabled,s=i.classNames,n=s.list,r=s.listSingle,o=s.listItems,a=document.createElement("div");return _(a,n),_(a,e?r:o),this._isSelectElement&&t&&a.setAttribute("role","listbox"),a},placeholder:function(i,e){var t=i.allowHTML,s=i.classNames.placeholder,n=document.createElement("div");return _(n,s),V(n,t,e),n},item:function(i,e,t){var s=i.allowHTML,n=i.removeItemButtonAlignLeft,r=i.removeItemIconText,o=i.removeItemLabelText,a=i.classNames,l=a.item,h=a.button,c=a.highlightedState,u=a.itemSelectable,f=a.placeholder,m=W(e.value),d=document.createElement("div");if(_(d,l),e.labelClass){var p=document.createElement("span");V(p,s,e.label),_(p,e.labelClass),d.appendChild(p)}else V(d,s,e.label);if(d.dataset.item="",d.dataset.id=e.id,d.dataset.value=m,ue(d,e,!0),(e.disabled||this.containerOuter.isDisabled)&&d.setAttribute("aria-disabled","true"),this._isSelectElement&&(d.setAttribute("aria-selected","true"),d.setAttribute("role","option")),e.placeholder&&(_(d,f),d.dataset.placeholder=""),_(d,e.highlighted?c:u),t){e.disabled&&k(d,u),d.dataset.deletable="";var y=document.createElement("button");y.type="button",_(y,h),V(y,!0,Q(r,e.value));var g=Q(o,e.value);g&&y.setAttribute("aria-label",g),y.dataset.button="",n?d.insertAdjacentElement("afterbegin",y):d.appendChild(y)}return d},choiceList:function(i,e){var t=i.classNames.list,s=document.createElement("div");return _(s,t),e||s.setAttribute("aria-multiselectable","true"),s.setAttribute("role","listbox"),s},choiceGroup:function(i,e){var t=i.allowHTML,s=i.classNames,n=s.group,r=s.groupHeading,o=s.itemDisabled,a=e.id,l=e.label,h=e.disabled,c=W(l),u=document.createElement("div");_(u,n),h&&_(u,o),u.setAttribute("role","group"),u.dataset.group="",u.dataset.id=a,u.dataset.value=c,h&&u.setAttribute("aria-disabled","true");var f=document.createElement("div");return _(f,r),V(f,t,l||""),u.appendChild(f),u},choice:function(i,e,t,s){var n=i.allowHTML,r=i.classNames,o=r.item,a=r.itemChoice,l=r.itemSelectable,h=r.selectedState,c=r.itemDisabled,u=r.description,f=r.placeholder,m=e.label,d=W(e.value),p=document.createElement("div");p.id=e.elementId,_(p,o),_(p,a),s&&typeof m=="string"&&(m=Te(n,m),m+=" (".concat(s,")"),m={trusted:m});var y=p;if(e.labelClass){var g=document.createElement("span");V(g,n,m),_(g,e.labelClass),y=g,p.appendChild(g)}else V(p,n,m);if(e.labelDescription){var w="".concat(e.elementId,"-description");y.setAttribute("aria-describedby",w);var T=document.createElement("span");V(T,n,e.labelDescription),T.id=w,_(T,u),p.appendChild(T)}return e.selected&&_(p,h),e.placeholder&&_(p,f),p.setAttribute("role",e.group?"treeitem":"option"),p.dataset.choice="",p.dataset.id=e.id,p.dataset.value=d,t&&(p.dataset.selectText=t),e.group&&(p.dataset.groupId="".concat(e.group.id)),ue(p,e,!1),e.disabled?(_(p,c),p.dataset.choiceDisabled="",p.setAttribute("aria-disabled","true")):(_(p,l),p.dataset.choiceSelectable=""),p},input:function(i,e){var t=i.classNames,s=t.input,n=t.inputCloned,r=i.labelId,o=document.createElement("input");return o.type="search",_(o,s),_(o,n),o.autocomplete="off",o.autocapitalize="off",o.spellcheck=!1,o.setAttribute("aria-autocomplete","list"),e?o.setAttribute("aria-label",e):r||We(this._docRoot,this.passedElement.element.id,o),o},dropdown:function(i){var e=i.classNames,t=e.list,s=e.listDropdown,n=document.createElement("div");return _(n,t),_(n,s),n.setAttribute("aria-expanded","false"),n},notice:function(i,e,t){var s=i.classNames,n=s.item,r=s.itemChoice,o=s.addChoice,a=s.noResults,l=s.noChoices,h=s.notice;t===void 0&&(t=O.generic);var c=document.createElement("div");switch(V(c,!0,e),_(c,n),_(c,r),_(c,h),t){case O.addChoice:_(c,o);break;case O.noResults:_(c,a);break;case O.noChoices:_(c,l);break}return t===O.addChoice&&(c.dataset.choiceSelectable="",c.dataset.choice=""),c},option:function(i){var e=W(i.label),t=new Option(e,i.value,!1,i.selected);return ue(t,i,!0),t.disabled=i.disabled,i.selected&&t.setAttribute("selected",""),t}},bi="-ms-scroll-limit"in document.documentElement.style&&"-ms-ime-align"in document.documentElement.style,Ei={},de=function(i){if(i)return i.dataset.id?parseInt(i.dataset.id,10):void 0},z="[data-choice-selectable]",nt=function(){function i(e,t){e===void 0&&(e="[data-choice]"),t===void 0&&(t={});var s=this;this.initialisedOK=void 0,this._hasNonChoicePlaceholder=!1,this._lastAddedChoiceId=0,this._lastAddedGroupId=0;var n=i.defaults;this.config=D(D(D({},n.allOptions),n.options),t),ot.forEach(function(g){s.config[g]=D(D(D({},n.allOptions[g]),n.options[g]),t[g])});var r=this.config;r.silent||this._validateConfig();var o=r.shadowRoot||document.documentElement;this._docRoot=o;var a=typeof e=="string"?o.querySelector(e):e;if(!a||typeof a!="object"||!(At(a)||Je(a)))throw TypeError(!a&&typeof e=="string"?"Selector ".concat(e," failed to find an element"):"Expected one of the following types text|select-one|select-multiple");var l=a.type,h=l===G.Text;(h||r.maxItemCount!==1)&&(r.singleModeForMultiSelect=!1),r.singleModeForMultiSelect&&(l=G.SelectMultiple);var c=l===G.SelectOne,u=l===G.SelectMultiple,f=c||u;if(this._elementType=l,this._isTextElement=h,this._isSelectOneElement=c,this._isSelectMultipleElement=u,this._isSelectElement=c||u,this._canAddUserChoices=h&&r.addItems||f&&r.addChoices,typeof r.renderSelectedChoices!="boolean"&&(r.renderSelectedChoices=r.renderSelectedChoices==="always"||c),r.closeDropdownOnSelect==="auto"?r.closeDropdownOnSelect=h||c||r.singleModeForMultiSelect:r.closeDropdownOnSelect=J(r.closeDropdownOnSelect),r.placeholder&&(r.placeholderValue?this._hasNonChoicePlaceholder=!0:a.dataset.placeholder&&(this._hasNonChoicePlaceholder=!0,r.placeholderValue=a.dataset.placeholder)),t.addItemFilter&&typeof t.addItemFilter!="function"){var m=t.addItemFilter instanceof RegExp?t.addItemFilter:new RegExp(t.addItemFilter);r.addItemFilter=m.test.bind(m)}if(this._isTextElement)this.passedElement=new wt({element:a,classNames:r.classNames});else{var d=a;this.passedElement=new Lt({element:d,classNames:r.classNames,template:function(g){return s._templates.option(g)},extractPlaceholder:r.placeholder&&!this._hasNonChoicePlaceholder})}if(this.initialised=!1,this._store=new Pt(r),this._currentValue="",r.searchEnabled=!h&&r.searchEnabled||u,this._canSearch=r.searchEnabled,this._isScrollingOnIe=!1,this._highlightPosition=0,this._wasTap=!0,this._placeholderValue=this._generatePlaceholderValue(),this._baseId=dt(a,"choices-"),this._direction=a.dir,!this._direction){var p=window.getComputedStyle(a).direction,y=window.getComputedStyle(document.documentElement).direction;p!==y&&(this._direction=p)}if(this._idNames={itemChoice:"item-choice"},this._templates=n.templates,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){r.silent||console.warn("Trying to initialise Choices on element already initialised",{element:e}),this.initialised=!0,this.initialisedOK=!1;return}this.init(),this._initialItems=this._store.items.map(function(g){return g.value})}return Object.defineProperty(i,"defaults",{get:function(){return Object.preventExtensions({get options(){return Ei},get allOptions(){return ke},get templates(){return yi}})},enumerable:!1,configurable:!0}),i.prototype.init=function(){if(!(this.initialised||this.initialisedOK!==void 0)){this._searcher=_i(this.config),this._loadChoices(),this._createTemplates(),this._createElements(),this._createStructure(),this._isTextElement&&!this.config.addItems||this.passedElement.element.hasAttribute("disabled")||this.passedElement.element.closest("fieldset:disabled")?this.disable():(this.enable(),this._addEventListeners()),this._initStore(),this.initialised=!0,this.initialisedOK=!0;var e=this.config.callbackOnInit;typeof e=="function"&&e.call(this)}},i.prototype.destroy=function(){this.initialised&&(this._removeEventListeners(),this.passedElement.reveal(),this.containerOuter.unwrap(this.passedElement.element),this._store._listeners=[],this.clearStore(!1),this._stopSearch(),this._templates=i.defaults.templates,this.initialised=!1,this.initialisedOK=void 0)},i.prototype.enable=function(){return this.passedElement.isDisabled&&this.passedElement.enable(),this.containerOuter.isDisabled&&(this._addEventListeners(),this.input.enable(),this.containerOuter.enable()),this},i.prototype.disable=function(){return this.passedElement.isDisabled||this.passedElement.disable(),this.containerOuter.isDisabled||(this._removeEventListeners(),this.input.disable(),this.containerOuter.disable()),this},i.prototype.highlightItem=function(e,t){if(t===void 0&&(t=!0),!e||!e.id)return this;var s=this._store.items.find(function(n){return n.id===e.id});return!s||s.highlighted?this:(this._store.dispatch(te(s,!0)),t&&this.passedElement.triggerEvent(N.highlightItem,this._getChoiceForOutput(s)),this)},i.prototype.unhighlightItem=function(e,t){if(t===void 0&&(t=!0),!e||!e.id)return this;var s=this._store.items.find(function(n){return n.id===e.id});return!s||!s.highlighted?this:(this._store.dispatch(te(s,!1)),t&&this.passedElement.triggerEvent(N.unhighlightItem,this._getChoiceForOutput(s)),this)},i.prototype.highlightAll=function(){var e=this;return this._store.withTxn(function(){e._store.items.forEach(function(t){t.highlighted||(e._store.dispatch(te(t,!0)),e.passedElement.triggerEvent(N.highlightItem,e._getChoiceForOutput(t)))})}),this},i.prototype.unhighlightAll=function(){var e=this;return this._store.withTxn(function(){e._store.items.forEach(function(t){t.highlighted&&(e._store.dispatch(te(t,!1)),e.passedElement.triggerEvent(N.highlightItem,e._getChoiceForOutput(t)))})}),this},i.prototype.removeActiveItemsByValue=function(e){var t=this;return this._store.withTxn(function(){t._store.items.filter(function(s){return s.value===e}).forEach(function(s){return t._removeItem(s)})}),this},i.prototype.removeActiveItems=function(e){var t=this;return this._store.withTxn(function(){t._store.items.filter(function(s){var n=s.id;return n!==e}).forEach(function(s){return t._removeItem(s)})}),this},i.prototype.removeHighlightedItems=function(e){var t=this;return e===void 0&&(e=!1),this._store.withTxn(function(){t._store.highlightedActiveItems.forEach(function(s){t._removeItem(s),e&&t._triggerChange(s.value)})}),this},i.prototype.showDropdown=function(e){var t=this;return this.dropdown.isActive?this:(e===void 0&&(e=!this._canSearch),requestAnimationFrame(function(){t.dropdown.show();var s=t.dropdown.element.getBoundingClientRect();t.containerOuter.open(s.bottom,s.height),e||t.input.focus(),t.passedElement.triggerEvent(N.showDropdown)}),this)},i.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(N.hideDropdown)}),this):this},i.prototype.getValue=function(e){var t=this,s=this._store.items.map(function(n){return e?n.value:t._getChoiceForOutput(n)});return this._isSelectOneElement||this.config.singleModeForMultiSelect?s[0]:s},i.prototype.setValue=function(e){var t=this;return this.initialisedOK?(this._store.withTxn(function(){e.forEach(function(s){s&&t._addChoice(R(s,!1))})}),this._searcher.reset(),this):(this._warnChoicesInitFailed("setValue"),this)},i.prototype.setChoiceByValue=function(e){var t=this;return this.initialisedOK?this._isTextElement?this:(this._store.withTxn(function(){var s=Array.isArray(e)?e:[e];s.forEach(function(n){return t._findAndSelectChoiceByValue(n)}),t.unhighlightAll()}),this._searcher.reset(),this):(this._warnChoicesInitFailed("setChoiceByValue"),this)},i.prototype.setChoices=function(e,t,s,n,r,o){var a=this;if(e===void 0&&(e=[]),t===void 0&&(t="value"),s===void 0&&(s="label"),n===void 0&&(n=!1),r===void 0&&(r=!0),o===void 0&&(o=!1),!this.initialisedOK)return this._warnChoicesInitFailed("setChoices"),this;if(!this._isSelectElement)throw new TypeError("setChoices can't be used with INPUT based Choices");if(typeof t!="string"||!t)throw new TypeError("value parameter must be a name of 'value' field in passed objects");if(typeof e=="function"){var l=e(this);if(typeof Promise=="function"&&l instanceof Promise)return new Promise(function(h){return requestAnimationFrame(h)}).then(function(){return a._handleLoadingState(!0)}).then(function(){return l}).then(function(h){return a.setChoices(h,t,s,n,r,o)}).catch(function(h){a.config.silent||console.error(h)}).then(function(){return a._handleLoadingState(!1)}).then(function(){return a});if(!Array.isArray(l))throw new TypeError(".setChoices first argument function must return either array of choices or Promise, got: ".concat(typeof l));return this.setChoices(l,t,s,!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.withTxn(function(){r&&(a._isSearching=!1),n&&a.clearChoices(!0,o);var h=t==="value",c=s==="label";e.forEach(function(u){if("choices"in u){var f=u;c||(f=D(D({},f),{label:f[s]})),a._addGroup(R(f,!0))}else{var m=u;(!c||!h)&&(m=D(D({},m),{value:m[t],label:m[s]}));var d=R(m,!1);a._addChoice(d),d.placeholder&&!a._hasNonChoicePlaceholder&&(a._placeholderValue=qe(d.label))}}),a.unhighlightAll()}),this._searcher.reset(),this},i.prototype.refresh=function(e,t,s){var n=this;return e===void 0&&(e=!1),t===void 0&&(t=!1),s===void 0&&(s=!1),this._isSelectElement?(this._store.withTxn(function(){var r=n.passedElement.optionsAsChoices(),o={};s||n._store.items.forEach(function(l){l.id&&l.active&&l.selected&&(o[l.value]=!0)}),n.clearStore(!1);var a=function(l){s?n._store.dispatch(De(l)):o[l.value]&&(l.selected=!0)};r.forEach(function(l){if("choices"in l){l.choices.forEach(a);return}a(l)}),n._addPredefinedChoices(r,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