New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

aria-autocomplete

Package Overview
Dependencies
Maintainers
1
Versions
23
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

aria-autocomplete - npm Package Compare versions

Comparing version 1.5.0 to 1.5.1

2

dist/aria-autocomplete.min.js

@@ -1,1 +0,1 @@

!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var i=e();for(var s in i)("object"==typeof exports?exports:t)[s]=i[s]}}(self,(function(){return function(){var t={342:function(t){window,t.exports=function(t){var e={};function i(s){if(e[s])return e[s].exports;var n=e[s]={i:s,l:!1,exports:{}};return t[s].call(n.exports,n,n.exports,i),n.l=!0,n.exports}return i.m=t,i.c=e,i.d=function(t,e,s){i.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:s})},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.t=function(t,e){if(1&e&&(t=i(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var s=Object.create(null);if(i.r(s),Object.defineProperty(s,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var n in t)i.d(s,n,function(e){return t[e]}.bind(null,n));return s},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="",i(i.s=0)}([function(t,e,i){"use strict";var s;function n(t,e){if(t)for(var i in e){var s="number"==typeof e[i]?e[i]+"px":e[i];t.style[i]=s+""}}i.r(e),i.d(e,"InputAutoWidth",(function(){return r}));var r=function(){function t(t,e){this.cache={},this.options=e,this.input=t,this.trigger(),this.eventHandler=this.trigger.bind(this),this.input.addEventListener("blur",this.eventHandler),this.input.addEventListener("input",this.eventHandler),this.input.addEventListener("keyup",this.eventHandler),this.input.addEventListener("keydown",this.eventHandler)}return t.prototype.measureString=function(t){return t?this.cache&&"number"==typeof this.cache[t]?this.cache[t]:(s||(n(s=document.createElement("span"),{position:"absolute",top:-99999,left:-99999,width:"auto",padding:0,whiteSpace:"pre"}),document.body.appendChild(s)),s.textContent=t,function(t,e,i){if(t&&e){var s=getComputedStyle(t),r={};if(i&&i.length)for(var o=0,l=i.length;o<l;o+=1)r[i[o]]=s[i[o]];else r=s;n(e,r)}}(this.input,s,["letterSpacing","fontSize","fontFamily","fontWeight","textTransform"]),s.offsetWidth||s.clientWidth):0},t.prototype.trigger=function(t){if(void 0===t&&(t={}),!t.metaKey&&!t.altKey){var e,i,s=this.input.value;if(t.type&&"keydown"===t.type.toLowerCase()){var n=t.keyCode,r=46===n,o=8===n;if(r||o){var l=function(t){var e={};if("selectionStart"in t)e.start=t.selectionStart,e.length=t.selectionEnd-e.start;else if(document.selection){t.focus();var i=document.selection.createRange(),s=i.text.length;i.moveStart("character",-t.value.length),e.start=i.text.length-s,e.length=s}return e}(this.input);l.length?s=s.substring(0,l.start)+s.substring(l.start+l.length):o&&l.start?s=s.substring(0,l.start-1)+s.substring(l.start+1):r&&void 0!==l.start&&(s=s.substring(0,l.start)+s.substring(l.start+1))}else if((e=n)>=48&&e<=57||e>=65&&e<=90||e>=96&&e<=111||e>=186&&e<=222||32===e||8===e||46===e){var a=String.fromCharCode(n);s+=a=t.shiftKey?a.toUpperCase():a.toLowerCase()}}!s&&(i=this.input.getAttribute("placeholder"))&&(s=i);var c=this.measureString(s)+4;this.options&&this.options.cache&&this.cache&&(this.cache[s]=c);var h=this.options&&this.options.minWidth;"number"==typeof h&&c<h&&(c=h);var u=this.options&&this.options.maxWidth;"number"==typeof u&&c>u&&(c=u),c!==this.currentWidth&&(this.currentWidth=c,this.input.style.width=c+"px")}},t.prototype.destroy=function(){this.input.removeEventListener("blur",this.eventHandler),this.input.removeEventListener("input",this.eventHandler),this.input.removeEventListener("keyup",this.eventHandler),this.input.removeEventListener("keydown",this.eventHandler),this.input=this.cache=null},t}();e.default=r}])},771:function(){var t=Element.prototype;t.matches||(t.matches=t.msMatchesSelector||t.webkitMatchesSelector),t.closest||(t.closest=function(t){var e=this;do{if(e.matches(t))return e;e=e.parentElement||e.parentNode}while(null!==e&&1===e.nodeType);return null})}},e={};function i(s){var n=e[s];if(void 0!==n)return n.exports;var r=e[s]={exports:{}};return t[s](r,r.exports,i),r.exports}i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,{a:e}),e},i.d=function(t,e){for(var s in e)i.o(e,s)&&!i.o(t,s)&&Object.defineProperty(t,s,{enumerable:!0,get:e[s]})},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var s={};return function(){"use strict";i.r(s),i.d(s,{AriaAutocomplete:function(){return F},default:function(){return D}});var t=i(342),e=i.n(t),n=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;function r(t,e){if(t&&1===t.nodeType&&"string"==typeof e)!function(t,e){for(var i=t.getAttribute&&t.getAttribute("class")||"",s=" "+i+" ",r=0,o=e.split(" "),l=o.length;r<l;r+=1)s=s.replace(" "+o[r]+" "," ");var a;i!==(s=null==(a=s)?"":(a+"").replace(n,""))&&t.setAttribute("class",s)}(t,e);else if(t&&"number"==typeof t.length)for(var i=0,s=t.length;i<s;i+=1)r(t[i],e)}var o=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;function l(t,e){if(t&&1===t.nodeType&&"string"==typeof e)!function(t,e){for(var i=t.getAttribute&&t.getAttribute("class")||"",s=" "+i+" ",n="",r=0,l=e.split(" "),a=l.length;r<a;r+=1)""!==l[r]&&-1===s.indexOf(" "+l[r]+" ")&&(n+=" "+l[r]);var c;i!==(n=null==(c=i+n)?"":(c+"").replace(o,""))&&t.setAttribute("class",n)}(t,e);else if(t&&"number"==typeof t.length)for(var i=0,s=t.length;i<s;i+=1)l(t[i],e)}var a=function(t){for(var e in void 0===t&&(t={}),this.sourceMapping={},this.alsoSearchIn=[],this.create=!1,this.delay=100,this.minLength=1,this.maxResults=9999,this.showAllControl=!1,this.confirmOnBlur=!0,this.multiple=!1,this.autoGrow=!1,this.maxItems=9999,this.multipleSeparator=",",this.deleteOnBackspace=!1,this.deleteAllControl=!1,this.deleteAllText="Delete all",this.asyncQueryParam="q",this.asyncMaxResultsParam="limit",this.noResultsText="No results",this.cssNameSpace="aria-autocomplete",this.srDelay=1400,this.srAutoClear=1e4,this.srDeleteText="delete",this.srDeletedText="deleted",this.srShowAllText="Show all",this.srSelectedText="selected",this.srListLabelText="Search suggestions",this.srAssistiveText="When results are available use up and down arrows to review and enter to select. Touch device users, explore by touch or with swipe gestures.",this.srAssistiveTextAutoClear=!0,this.srResultsText=function(t){return"".concat(t," ").concat(1===t?"result":"results"," available.")},t)t.hasOwnProperty(e)&&void 0!==t[e]&&(this[e]=t[e])},c="ariaAutocomplete",h="_ariaAutocompleteCleanedLabel",u="_ariaAutocompleteSelectedOption",p="_ariaAutocompleteLabelOriginallyFor",d=/[&<>"']/g,f={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},m=function(){function t(t){this.list=t.list,this.input=t.input,this.wrapper=t.wrapper,this.options=t.options,this.selected=t.selected,this.open=this.open.bind(t),this.close=this.close.bind(t),this.enable=this.enable.bind(t),this.disable=this.disable.bind(t),this.filter=this.filter.bind(t),this.destroy=this.destroy.bind(t),this.delete=this.delete.bind(t),this.deleteAll=this.deleteAll.bind(t),t.element[c]=this}return t.prototype.open=function(){this.show.call(this)},t.prototype.close=function(){this.hide.call(this)},t.prototype.enable=function(){this.enable.call(this)},t.prototype.disable=function(t){this.disable.call(this,t)},t.prototype.filter=function(t){this.filter.call(this,t)},t.prototype.destroy=function(){this.destroy.call(this)},t.prototype.delete=function(t){this.deleteEntry.call(this,this.multiple?t:null)},t.prototype.deleteAll=function(){this.multiple?this.deleteAllSelected.call(this):this.deleteEntry.call(this)},t}(),v=0,b=function(t,e,i){v+=1,this.ELEMENT=t;var s=i||t||"";this.PREFIX="".concat(s,"aria-autocomplete-").concat(v),this.LIST="".concat(this.PREFIX,"-list"),this.BUTTON="".concat(this.PREFIX,"-button"),this.OPTION="".concat(this.PREFIX,"-option"),this.WRAPPER="".concat(this.PREFIX,"-wrapper"),this.LABEL=e||"".concat(this.PREFIX,"-label"),this.INPUT=i||"".concat(this.PREFIX,"-input"),this.SR_ASSISTANCE="".concat(this.PREFIX,"-sr-assistance"),this.OPTION_SELECTED="".concat(this.PREFIX,"-option-selected"),this.SR_ANNOUNCEMENTS="".concat(this.PREFIX,"-sr-announcements")};function y(t){return null==t?"":(t+"").trim()}function g(t){return"string"==typeof t&&t?t.replace(d,(function(t){return f[t]})):""}i(771);var A=/&/g,S=/\s\s+/g,w=/[\u2018\u2019',:\u2013-]/g,E=/[\-\[\]{}()*+?.,\\\^$|#\s]/g;function x(t,e){return void 0===e&&(e=!1),t=y(t).toLowerCase().replace(w,"").replace(A,"and").replace(S," "),e&&(t=t.replace(E,"\\$&")),t}function T(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var i={};return t.forEach((function(t){for(var e in t)t.hasOwnProperty(e)&&void 0!==t[e]&&(i[e]=t[e])})),i}function O(t,e){if("createEvent"in document){var i=document.createEvent("HTMLEvents");i.initEvent(e,!0,!0),t.dispatchEvent(i)}else t.fireEvent("on"+e)}function C(t){return t&&t.children?Array.prototype.slice.call(t.children):[]}function I(t,e,i){e=!!e,t&&("INPUT"===t.nodeName&&"checked"in t&&t.checked!==e&&(t.checked=e,O(t,"change")),"OPTION"===t.nodeName&&"selected"in t&&t.selected!==e&&(t.selected=e,clearTimeout(i.elementChangeEventTimer),i.elementChangeEventTimer=setTimeout((function(){O(t.closest("select"),"change")}),1)))}function _(t,e){void 0===e&&(e={});var i={},s=e.value,n=e.label;return"string"==typeof t?i.value=i.label=t:((i=T(t)).value=(i[s]||i.value||i.label||"").toString(),i.label=(i[n]||i.label||i.value||"").toString()),i[h]=x(i.label),i}function L(t,e){return void 0===e&&(e={}),Array.isArray(t)?t.map((function(t){return _(t,e)})):t?[t]:[]}function N(t,e,i){if("string"==typeof t)return function(t,e,i){return i!==h&&(t=x(t,!1)),-1!==t.search(e)}(t,e,i);if(Array.isArray(t))for(var s=0,n=t.length;s<n;s+=1)if(N(t[s],e))return!0;return!1}var P=function(){function t(t,e){t&&this.init(t,e)}return t.prototype.triggerOptionCallback=function(t,e,i){if(void 0===e&&(e=[]),void 0===i&&(i=this.api),"function"==typeof this.options[t])return this.options[t].apply(i,e)},t.prototype.show=function(t){if(t)return r(t,"".concat(this.cssNameSpace,"--hide hide hidden")),t.removeAttribute("aria-hidden"),void t.removeAttribute("hidden");if(this.input.setAttribute("aria-expanded","true"),this.showAll){var e=(!!this.forceShowAll).toString();this.showAll.setAttribute("aria-expanded",e)}this.menuOpen||(this.show(this.list),this.menuOpen=!0,this.triggerOptionCallback("onOpen",[this.list]),this.documentClickBound||(this.documentClickBound=!0,document.addEventListener("click",this.documentClick)))},t.prototype.hide=function(t){if(t)return l(t,"".concat(this.cssNameSpace,"--hide hide hidden")),t.setAttribute("aria-hidden","true"),void t.setAttribute("hidden","hidden");this.currentSelectedIndex=-1,this.input.setAttribute("aria-expanded","false"),this.showAll&&this.showAll.setAttribute("aria-expanded","false"),this.menuOpen&&(this.hide(this.list),this.menuOpen=!1,this.triggerOptionCallback("onClose",[this.list]))},t.prototype.enable=function(){if(this.disabled){this.disabled=!1,this.input.disabled=!1;var t=this.cssNameSpace;r(this.input,"".concat(t,"__input--disabled disabled")),r(this.wrapper,"".concat(t,"__wrapper--disabled disabled")),this.showAll&&(this.showAll.setAttribute("tabindex","0"),r(this.showAll,"".concat(t,"__show-all--disabled disabled")))}this.enableDeletions()},t.prototype.disable=function(t){if(void 0===t&&(t=!1),!this.disabled){this.disabled=!0,this.input.disabled=!0;var e=this.cssNameSpace;l(this.input,"".concat(e,"__input--disabled disabled")),l(this.wrapper,"".concat(e,"__wrapper--disabled disabled")),this.showAll&&(this.showAll.setAttribute("tabindex","-1"),l(this.showAll,"".concat(e,"__show-all--disabled disabled")))}t&&this.disableDeletions()},t.prototype.enableDeletions=function(){if(this.deletionsDisabled){this.deletionsDisabled=!1;var t=this.cssNameSpace;r(this.wrapper,"".concat(t,"__wrapper--deletions-disabled")),this.getSelectedElems().forEach((function(e){r(e,"".concat(t,"__selected--disabled")),e.setAttribute("tabindex","0")})),this.deleteAll&&(r(this.deleteAll,"".concat(t,"__delete-all--disabled ").concat(t,"__selected--disabled")),this.deleteAll.setAttribute("tabindex","0"))}},t.prototype.disableDeletions=function(){if(!this.deletionsDisabled){this.deletionsDisabled=!0;var t=this.cssNameSpace;l(this.wrapper,"".concat(t,"__wrapper--deletions-disabled")),this.getSelectedElems().forEach((function(e){l(e,"".concat(t,"__selected--disabled")),e.setAttribute("tabindex","-1")})),this.deleteAll&&(l(this.deleteAll,"".concat(t,"__delete-all--disabled ").concat(t,"__selected--disabled")),this.deleteAll.setAttribute("tabindex","-1"))}},t.prototype.triggerAutoGrow=function(){this.autoGrow&&this.inputAutoWidth&&"function"==typeof this.inputAutoWidth.trigger&&this.inputAutoWidth.trigger()},t.prototype.setInputValue=function(t,e){void 0===e&&(e=!1),this.term=t,this.input&&(this.input.value=t),e&&(this.inputPollingValue=t),this.triggerAutoGrow()},t.prototype.setOriginalElementValue=function(t){var e=this.elementIsInput||this.sourceFromSelect,i=this.element;e&&i.value!==t&&(i.value=t,O(i,"change"))},t.prototype.indexOfValueIn=function(t,e,i){if(void 0===e&&(e=this.input.value),void 0===i&&(i="label"),t.length&&(e=y(e).toLowerCase()))for(var s=0,n=t.length;s<n;s+=1)if(y(t[s][i]).toLowerCase()===e)return s;return-1},t.prototype.clearAnnouncement=function(t){var e=this;clearTimeout(this.clearAnnouncementTimer),this.clearAnnouncementTimer=setTimeout((function(){e.srAnnouncements&&(e.srAnnouncements.textContent="")}),t)},t.prototype.announce=function(t,e){var i=this;if(void 0===e&&(e=this.options.srDelay),this.srAnnouncements&&t&&"string"==typeof t){var s=function(){i.srAnnouncements.textContent=t;var e=i.options.srAutoClear;(!0===e||"number"==typeof e&&e>-1)&&i.clearAnnouncement("number"==typeof e?e:1e4)};0!==e?(clearTimeout(this.announcementTimer),this.announcementTimer=setTimeout((function(){return s()}),e)):s()}},t.prototype.setInputDescription=function(){var t=this.input.getAttribute("aria-describedby"),e=y(t),i=e.replace(this.ids.SR_ASSISTANCE,"");this.input.value.length||(i="".concat(i," ").concat(this.ids.SR_ASSISTANCE)),(i=y(i))?i!==e&&this.input.setAttribute("aria-describedby",i):t&&this.input.removeAttribute("aria-describedby")},t.prototype.isSelectedElem=function(t){var e=t&&t[u];return!(!this.multiple||"object"!=typeof e)},t.prototype.getSelectedElems=function(){for(var t=[],e=0,i=this.wrapper.childNodes.length;e<i;e+=1){var s=this.wrapper.childNodes[e];1===s.nodeType&&this.isSelectedElem(s)&&t.push(s)}return t},t.prototype.deleteAllSelected=function(){if(!this.deletionsDisabled){for(var t=this.selected.length;t--;){var e=T(this.selected[t]);I(e.element,!1,this),this.triggerOptionCallback("onDelete",[e])}this.selected.splice(0),this.setSourceElementValues(),this.buildMultiSelected(),this.triggerAutoGrow(),this.announce(this.options.srDeletedText,0)}},t.prototype.removeEntryFromSelected=function(t,e){if(void 0===e&&(e=!1),!this.deletionsDisabled&&t){var i=this.selected.indexOf(t);if(-1===i)for(var s=0,n=this.selected.length;s<n;s+=1)if(this.selected[s].value===t.value){i=s;break}if(i>-1&&this.selected[i]){var r=T(this.selected[i]),o=r.label;I(r.element,!1,this),this.selected.splice(i,1),this.triggerOptionCallback("onDelete",[r]),this.setSourceElementValues(),this.buildMultiSelected(e?i:null),this.triggerAutoGrow(),this.announce("".concat(o," ").concat(this.options.srDeletedText),0)}}},t.prototype.deleteEntry=function(t){var e=null==t;e&&this.selected.length&&(t=this.selected[this.selected.length-1]),e||"object"==typeof t||(t={value:t}),this.removeEntryFromSelected(t),this.multiple||(this.setOriginalElementValue(""),this.setInputValue("",!0))},t.prototype.createSelectedElemFrom=function(t,e){var i=t.label,s=this.cssNameSpace,n="".concat(s,"__selected"),r=document.createElement("span"),o=e?"".concat(s,"__delete-all ").concat(n," ").concat(n,"--delete-all"):n;return r.setAttribute("aria-describedby",this.ids.LABEL),r.setAttribute("class",o),r.setAttribute("role","button"),r.setAttribute("tabindex","0"),r.textContent=i,e||(r.setAttribute("aria-label","".concat(this.options.srDeleteText," ").concat(i)),r[u]=t),r},t.prototype.buildMultiSelected=function(t){var e=this;if(this.multiple){this.multiple&&this.selected.length>=this.options.maxItems?this.disable():this.enable();var i=this.getSelectedElems();if(this.selected.length||i.length){var s=[];i.forEach((function(t){for(var i=t[u],n=0,r=e.selected.length;n<r;n+=1){var o=e.selected[n];if(o===i||o.value===i.value)return void s.push(t)}t.parentNode.removeChild(t)}));var n=document.createDocumentFragment();this.selected.forEach((function(t){for(var i=0,r=s.length;i<r;i+=1){var o=s[i][u];if(o===t||o.value===t.value)return}n.appendChild(e.createSelectedElemFrom(t))})),n.childNodes&&n.childNodes.length&&this.wrapper.insertBefore(n,this.srAssistance);var r=this.getSelectedElems(),o=r.map((function(t,i){var s="".concat(e.ids.OPTION_SELECTED,"-").concat(i);return t.setAttribute("id",s),s}));if(o.push(this.ids.LIST),this.input.setAttribute("aria-owns",o.join(" ")),this.autoGrow&&this.selected.length?this.input.removeAttribute("placeholder"):this.options.placeholder&&this.input.setAttribute("placeholder",this.options.placeholder),this.selected.length<=1?this.deleteAll&&(this.deleteAll.parentNode.removeChild(this.deleteAll),this.deleteAll=null):this.options.deleteAllControl&&!this.deleteAll&&r[0]&&(this.deleteAll=this.createSelectedElemFrom({label:this.options.deleteAllText},!0),r[0].parentNode.insertBefore(this.deleteAll,r[0])),"number"==typeof t){var l=r[t]||r[t-1]||r[0];l&&"function"==typeof l.focus&&l.focus()}}}},t.prototype.resetOptionAttributes=function(t){void 0===t&&(t=C(this.list));var e="".concat(this.cssNameSpace,"__option--focused focused focus");t.forEach((function(t){"true"!==t.getAttribute("aria-disabled")&&t.setAttribute("aria-selected","false"),r(t,e)}))},t.prototype.setOptionFocus=function(t,e,i){void 0===i&&(i=!0);var s=C(this.list);if(this.resetOptionAttributes(s),e<0||!s.length)return this.currentSelectedIndex=-1,void(t&&t.target!==this.input&&this.input.focus());if(e>=s.length)return this.currentSelectedIndex=s.length-1,void this.setOptionFocus(t,this.currentSelectedIndex);var n=s[e];if(n&&"string"==typeof n.getAttribute("tabindex"))return this.currentSelectedIndex=e,l(n,"".concat(this.cssNameSpace,"__option--focused focused focus")),"true"!==n.getAttribute("aria-disabled")&&n.setAttribute("aria-selected","true"),void(i&&n.focus());this.currentSelectedIndex=-1},t.prototype.setSourceElementValues=function(){for(var t=[],e=0,i=this.selected.length;e<i;e+=1){var s=this.selected[e];t.push(s.value),I(s.element,!0,this)}if(this.elementIsInput){var n=t.join(this.options.multipleSeparator);n!==this.element.value&&(this.element.value=n,O(this.element,"change"))}!this.selected.length&&this.sourceFromSelect&&(this.element.value=""),this.triggerOptionCallback("onChange",[this.selected])},t.prototype.handleOptionSelect=function(t,e,i){if(void 0===i&&(i=!0),!("number"!=typeof e||e<0||this.multiple&&this.selected.length>=this.options.maxItems)&&this.filteredSource.length&&this.filteredSource[e]){var s=T(this.filteredSource[e]);if(!(s.disabled||s.element&&s.element.disabled)){for(var n=!1,r=0,o=this.selected.length;r<o;r+=1)if(this.selected[r].value===s.value){n=!0;break}n||this.multiple||this.selected.splice(0),n||(this.addResultsEntryToDomAndSource(s),this.selected.push(s),this.setSourceElementValues(),this.buildMultiSelected()),this.setInputValue(this.multiple?"":s.label,!0),this.triggerOptionCallback("onConfirm",[s]),this.announce("".concat(s.label," ").concat(this.options.srSelectedText),0),!this.disabled&&!1!==i&&this.input&&this.input.focus(),this.hide()}}},t.prototype.removeSelectedFromResults=function(t){var e=this;if(!this.multiple||!this.selected.length)return t;var i=[];return t.forEach((function(t){for(var s=e.selected,n=0,r=s.length;n<r;n+=1)if(t.label===s[n].label&&t.value===s[n].value)return;i.push(t)})),i},t.prototype.addResultsEntryToDomAndSource=function(t){var e=this.options.create,i=this.sourceFromSelect,s=this.sourceFromCheckboxList;if(e&&t&&t.value&&Array.isArray(this.source)&&(i||s)){var n=t.label,r=t.value;if(!(this.indexOfValueIn(this.source,r,"value")>-1||this.indexOfValueIn(this.source,n,"label")>-1)){var o;if(i){var l=this.element.querySelector("option"),a=l.cloneNode(!0);a.textContent=n,a.value=r,o=a,l.parentNode.insertBefore(a,l)}else if(s){var c=this.element.querySelector('input[type="checkbox"]'),h=c.cloneNode(!0),u=c.closest("label"),p=document.createElement("label");p.textContent=n,h.value=r,o=h,p.appendChild(h);var d=u||c;d.parentNode.insertBefore(p,d)}o&&(t.element=o,o.removeAttribute("id")),this.source.unshift(t)}}},t.prototype.prependEntryInCreateMode=function(t,e){var i=this.options.create;if((!0===i||"function"==typeof i)&&x(t)){var s,n=y(t),r=this.options.sourceMapping;if(!0===i&&(s=_(n,r)),"function"==typeof i){var o=this.triggerOptionCallback("create",[n]),l=typeof o;o&&("string"===l||"object"===l&&!Array.isArray(o))&&(s=_(o,r))}!s||!s.label||!s.value||this.indexOfValueIn(e,s[h],h)>-1||this.indexOfValueIn(e,s.value,"value")>-1||e.unshift(s)}},t.prototype.setListOptions=function(t){var e=this.options.sourceMapping;this.prependEntryInCreateMode(this.term,t);var i=this.removeSelectedFromResults(t),s=this.triggerOptionCallback("onResponse",[i.slice()]);this.filteredSource=Array.isArray(s)?L(s,e):i;for(var n=this.ids.OPTION,o=this.cssNameSpace,a="".concat(o,"__option"),c=this.filteredSource.length,h="function"==typeof this.options.onItemRender,u=this.forceShowAll?9999:this.options.maxResults,p=u<c?u:c,d=[],f=0;f<p;f+=1){var m=this.filteredSource[f],v=h&&this.triggerOptionCallback("onItemRender",[m]),b="string"==typeof v?v:m.label,y=!!(m.disabled||m.element&&m.element.disabled),A=y?"":' aria-selected="false"';d.push('<li tabindex="-1"'.concat(A,' role="option" class="').concat(a,'" ')+'aria-disabled="'.concat(y,'" id="').concat(n,"--").concat(f,'" aria-posinset="').concat(f+1,'" ')+'aria-setsize="'.concat(p,'">').concat(g(b),"</li>"))}var S,w=!d.length;w?(r(this.list,"".concat(o,"__list--has-results")),l(this.list,"".concat(o,"__list--no-results"))):(l(this.list,"".concat(o,"__list--has-results")),r(this.list,"".concat(o,"__list--no-results")));var E=this.options.noResultsText;w&&"string"==typeof E&&E.length&&(S=E,d.push('<li class="'.concat(a," ").concat(a,'--no-results">').concat(g(E),"</li>"))),this.cancelFilterPrep(),S||(S=this.triggerOptionCallback("srResultsText",[p])),S&&this.announce(S);var x=d.join("");if(this.currentListHtml!==x?(this.currentListHtml=x,this.list.innerHTML=x):this.resetOptionAttributes(),!d.length)return this.hide(),void(this.forceShowAll=!1);this.show(),this.forceShowAll=!1},t.prototype.handleAsync=function(t,e){var i=this;void 0===e&&(e=!1),this.xhr&&"function"==typeof this.xhr.abort&&this.xhr.abort();var s=new XMLHttpRequest,n=this.forceShowAll,r=e?null:this.api,o=this.multiple?this.selected.length:0,l=n||e||9999===this.options.maxResults,a=this.source+(/\?/.test(this.source)?"&":"?")+"".concat(encodeURIComponent(this.options.asyncQueryParam),"=").concat(encodeURIComponent(t),"&")+"".concat(encodeURIComponent(this.options.asyncMaxResultsParam),"=")+"".concat(l?9999:o+this.options.maxResults),c=this.triggerOptionCallback("onAsyncPrep",[a,s,e],r);c&&"string"==typeof c&&(a=c),s.open("GET",a),s.onload=function(){if(s.readyState===s.DONE&&s.status>=200&&s.status<300){i.forceShowAll=n;var o=L(i.triggerOptionCallback("onAsyncSuccess",[t,s,e],r)||s.responseText,i.options.sourceMapping);e?(i.prepSelectedFromArray(o),i.setInputStartingStates(!1)):i.setListOptions(o),i.triggerOptionCallback("onAsyncComplete",[t,s,e],r)}},s.onerror=function(){i.triggerOptionCallback("onAsyncError",[t,s,e],r)},e||(this.xhr=s),this.triggerOptionCallback("onAsyncBeforeSend",[t,s,e],r),s.send()},t.prototype.filter=function(t){var e=this;if("string"==typeof t){var i=this.forceShowAll;if(!i){var s=this.triggerOptionCallback("onSearch",[t]);"string"==typeof s&&(t=s)}if(this.term=t,"string"==typeof this.source&&this.source.length)return this.handleAsync(t),void(this.forceShowAll=!1);if("function"!=typeof this.source){t||(i=!0);var n=[],r=this.source;if(r&&r.length){var o=[h];if(!i){t=x(t,!0);var l=this.options.alsoSearchIn;Array.isArray(l)&&l.length&&(o=function(t){var e=[];return t.forEach((function(t){if("string"==typeof t){for(var i=y(t),s="label"!==i,n=0,r=e.length;s&&n<r;n+=1)s=e[r]!==i;s&&e.push(i)}})),e}(o.concat(l)))}r.forEach((function(e){(i||function(t,e,i){for(var s in t)if(t.hasOwnProperty(s)){var n=t[s];if(("string"==typeof n||Array.isArray(n))&&i.indexOf(s)>-1&&N(n,e,s))return!0}return!1}(e,t,o))&&n.push(e)}))}this.setListOptions(n)}else{var a=function(t){var i=L(t,e.options.sourceMapping);e.setListOptions(i)},c=this.source.call(this.api,this.term,a,!1);c&&"function"==typeof c.then&&c.then((function(t){return a(t)}))}}else this.cancelFilterPrep()},t.prototype.cancelFilterPrep=function(){clearTimeout(this.filterTimer),r(this.wrapper,"".concat(this.cssNameSpace,"__wrapper--loading loading")),r(this.input,"".concat(this.cssNameSpace,"__input--loading loading")),this.filtering=!1},t.prototype.filterPrep=function(t,e,i){var s=this;void 0===e&&(e=!1),void 0===i&&(i=!1);var n=this.forceShowAll,r=n||i?0:this.options.delay;this.cancelFilterPrep(),this.filtering=!0,this.filterTimer=setTimeout((function(){var i=s.input.value;if(s.inputPollingValue=i,(n||""===i||e&&!s.multiple&&s.selected.length&&y(s.selected[0].label)===y(i))&&(i=""),t&&t.type&&s.options.srAssistiveTextAutoClear&&s.setInputDescription(),!n&&i.length<s.options.minLength)s.hide();else{var r;try{var o=t;r=t&&"keydown"===t.type&&(o.altKey||o.ctrlKey||o.metaKey)}catch(t){}var a=""!==i&&i===s.term;!a||a&&!s.menuOpen&&!r?(l(s.wrapper,"".concat(s.cssNameSpace,"__wrapper--loading loading")),l(s.input,"".concat(s.cssNameSpace,"__input--loading loading")),s.currentSelectedIndex=-1,s.filter(i)):s.cancelFilterPrep()}}),r)},t.prototype.filterPrepShowAll=function(t){var e=this;this.disabled||(clearTimeout(this.showAllPrepTimer),this.showAllPrepTimer=setTimeout((function(){e.componentBlurTimer&&clearTimeout(e.componentBlurTimer),t.preventDefault(),e.forceShowAll=!0,e.filterPrep(t,!1,!0)}),0))},t.prototype.handleComponentBlur=function(t,e){var i=this;void 0===e&&(e=!1),clearTimeout(this.componentBlurTimer);var s=e?0:100;this.componentBlurTimer=setTimeout((function(){var t=document.activeElement;if(e||!t||i.deleteAll&&i.deleteAll===t||i.isSelectedElem(t)||!i.wrapper.contains(t)){if(i.xhr&&"function"==typeof i.xhr.abort&&i.xhr.abort(),!e&&i.options.confirmOnBlur&&i.menuOpen){var s=i.currentSelectedIndex;if("number"!=typeof s||-1===s){var n=i.filteredSource.slice(),r=i.triggerOptionCallback("confirmOnBlur",[i.term,n]),o=x(r&&"string"==typeof r?r:i.term);s=i.indexOfValueIn.call(i,i.filteredSource,o,h)}i.handleOptionSelect({},s,!1)}i.cancelFilterPrep(),i.hide(),i.multiple||-1!==i.indexOfValueIn.call(i,i.selected)||i.deleteEntry(),i.multiple&&i.setInputValue("",!0),i.documentClickBound&&(i.documentClickBound=!1,document.removeEventListener("click",i.documentClick)),i.triggerOptionCallback("onBlur",[i.wrapper]),i.isFocused=!1}}),s)},t.prototype.handleUpKey=function(t){t.preventDefault(),!this.disabled&&this.menuOpen&&"number"==typeof this.currentSelectedIndex&&this.setOptionFocus(t,this.currentSelectedIndex-1)},t.prototype.handleDownKey=function(t){if(t.preventDefault(),!this.menuOpen){var e=this.options.minLength;this.forceShowAll=e<1,(this.forceShowAll||this.input.value.length>=e)&&this.filterPrep(t)}if(this.menuOpen&&!this.filtering){var i=this.currentSelectedIndex;"number"!=typeof i||i<0?this.setOptionFocus(t,0):this.setOptionFocus(t,i+1)}},t.prototype.handleEndKey=function(t){if(!this.disabled&&this.menuOpen&&t.target!==this.input){var e=C(this.list);e.length&&(t.preventDefault(),this.setOptionFocus(t,e.length-1))}},t.prototype.handleHomeKey=function(t){!this.disabled&&this.menuOpen&&t.target!==this.input&&(t.preventDefault(),this.setOptionFocus(t,0))},t.prototype.handlePageUpKey=function(t){if(!this.disabled&&this.menuOpen&&t.target!==this.input){t.preventDefault();var e=this.currentSelectedIndex,i=e>0&&e-10<0?0:0===e?-1:e-10;this.setOptionFocus(t,i)}},t.prototype.handlePageDownKey=function(t){if(!this.disabled&&this.menuOpen&&t.target!==this.input){t.preventDefault();var e=this.currentSelectedIndex;this.setOptionFocus(t,e<0?0:e+10)}},t.prototype.handleEnterKey=function(t){var e=t.target;this.isSelectedElem(e)?this.removeEntryFromSelected(e[u],!0):this.deleteAll&&e===this.deleteAll?this.deleteAllSelected():this.disabled||(this.showAll&&e===this.showAll?this.filterPrepShowAll(t):(this.menuOpen&&(t.preventDefault(),this.currentSelectedIndex>-1&&this.handleOptionSelect(t,this.currentSelectedIndex)),e===this.input&&this.filterPrep(t,!1,!0)))},t.prototype.handleKeyDownDefault=function(t){var e=t.keyCode,i=t.target===this.input;if(32===e&&!i||this.isSelectedElem(t.target)&&46===e)return t.preventDefault(),void this.handleEnterKey(t);if(!this.disabled){var s=this.selected&&this.selected.length;this.options.deleteOnBackspace&&8===e&&""===this.input.value&&s&&i&&this.multiple&&this.removeEntryFromSelected(this.selected[s-1]);var n=function(t){return t>=48&&t<=57||t>=65&&t<=90||t>=96&&t<=111||t>=186&&t<=222||32===t||8===t||46===t}(e),r=!i&&n;r&&this.input.focus(),(r||i&&n)&&this.filterPrep(t)}},t.prototype.prepKeyDown=function(t){switch(t.keyCode){case 38:this.handleUpKey(t);break;case 40:this.handleDownKey(t);break;case 35:this.handleEndKey(t);break;case 36:this.handleHomeKey(t);break;case 13:this.handleEnterKey(t);break;case 33:this.handlePageUpKey(t);break;case 34:this.handlePageDownKey(t);break;case 27:this.handleComponentBlur(t,!0);break;default:this.handleKeyDownDefault(t)}},t.prototype.cancelPolling=function(){clearTimeout(this.pollingTimer)},t.prototype.startPolling=function(){var t=this;this.filtering||this.input.value===this.inputPollingValue||this.filterPrep({}),this.pollingTimer=setTimeout((function(){t.startPolling()}),200)},t.prototype.bindEvents=function(){var t=this;this.wrapper.addEventListener("focusout",(function(e){t.handleComponentBlur(e,!1)})),this.wrapper.addEventListener("focusin",(function(e){t.list.contains(e.target)||(t.currentSelectedIndex=-1),t.isFocused||t.triggerOptionCallback("onFocus",[t.wrapper]),t.isFocused=!0})),this.wrapper.addEventListener("keydown",(function(e){t.prepKeyDown(e)})),this.wrapper.addEventListener("click",(function(e){e.target!==t.wrapper?(t.isSelectedElem(e.target)&&t.removeEntryFromSelected(e.target[u],!0),t.deleteAll&&e.target===t.deleteAll&&t.deleteAllSelected()):t.input.focus()}));var i="".concat(this.cssNameSpace,"__wrapper--focused focused focus"),s="".concat(this.cssNameSpace,"__input--focused focused focus");this.input.addEventListener("blur",(function(){r(t.wrapper,i),r(t.input,s),t.cancelPolling()})),this.input.addEventListener("input",(function(e){document.activeElement===t.input&&t.filterPrep(e)})),this.input.addEventListener("click",(function(e){!t.menuOpen&&t.input.value.length>=t.options.minLength&&t.filterPrep(e,!0)})),this.input.addEventListener("focusin",(function(e){l(t.wrapper,i),l(t.input,s),t.startPolling(),t.disabled||t.menuOpen||t.filterPrep(e,!0)})),this.showAll&&this.showAll.addEventListener("click",(function(e){t.filterPrepShowAll(e)})),this.list.addEventListener("mouseenter",(function(e){t.resetOptionAttributes()})),this.list.addEventListener("click",(function(e){if(e.target!==t.list){var i=C(t.list);if(i.length){var s=i.indexOf(e.target);t.handleOptionSelect(e,s)}}})),this.autoGrow&&(this.inputAutoWidth=new(e())(this.input))},t.prototype.prepListSourceCheckboxes=function(){this.multiple=!0,this.source=[];for(var t=this.element.querySelectorAll('input[type="checkbox"]'),e=0,i=t.length;e<i;e+=1){var s=t[e];if(s.value){var n={value:s.value},r=s.closest("label");!r&&s.id&&(r=document.querySelector('[for="'+s.id+'"]')),r&&(n.label=r.textContent);var o=_(n);o.element=s,this.source.push(o),s.checked&&this.selected.push(o)}}},t.prototype.prepListSourceDdl=function(){var t=this.element.multiple;t&&!this.multiple&&(this.multiple=!0),!t&&this.multiple&&this.options.maxItems>1&&(this.options.maxItems=1),this.source=[];for(var e=this.element.querySelectorAll("option"),i=0,s=e.length;i<s;i+=1){var n=e[i];if(n.value){var r=_({value:n.value,label:n.textContent});r.element=n,this.source.push(r),n.selected&&this.selected.push(r)}}},t.prototype.prepSelectedFromArray=function(t){var e=this,i=this.elementIsInput&&this.element.value;if(i&&Array.isArray(t)&&t.length){var s=this.options,n=s.multiple,r=s.multipleSeparator,o=n?i.split(r):[i],l=t.slice();o.forEach((function(t){if(-1===e.indexOfValueIn(e.selected,t,"value")){e.prependEntryInCreateMode(t,l);var i=e.indexOfValueIn(l,t,"value");i>-1&&e.selected.push(l[i])}}))}},t.prototype.prepListSourceArray=function(){this.source=L(this.source,this.options.sourceMapping),this.prepSelectedFromArray(this.source)},t.prototype.prepListSourceAsync=function(){var t=this.element;this.elementIsInput&&t.value&&this.handleAsync(t.value,!0)},t.prototype.prepListSourceFunction=function(){var t=this,e=this.element;if(this.elementIsInput&&e.value){var i=function(e){var i=L(e,t.options.sourceMapping);t.prepSelectedFromArray(i),t.setInputStartingStates(!1)},s=this.source.call(void 0,e.value,i,!0);s&&"function"==typeof s.then&&s.then((function(t){return i(t)}))}},t.prototype.prepListSource=function(){return"function"==typeof this.source?this.prepListSourceFunction():"string"==typeof this.source&&this.source.length?this.prepListSourceAsync():Array.isArray(this.source)&&this.source.length?this.prepListSourceArray():(this.sourceFromSelect="SELECT"===this.element.nodeName,this.sourceFromSelect?this.prepListSourceDdl():(this.sourceFromCheckboxList=!!this.element.querySelector('input[type="checkbox"]'),this.sourceFromCheckboxList?this.prepListSourceCheckboxes():void(this.source=[])))},t.prototype.setInputStartingStates=function(t){if(void 0===t&&(t=!0),t){this.label&&(this.label[p]=this.ids.ELEMENT,this.label.setAttribute("for",this.ids.INPUT));var e=this.element.getAttribute("aria-describedby");e&&this.input.setAttribute("aria-describedby",e);var i=this.element.getAttribute("aria-labelledby");i&&this.input.setAttribute("aria-labelledby",i)}this.selected.length&&(this.multiple?(this.buildMultiSelected(),this.triggerAutoGrow()):this.setInputValue(this.selected[0].label||"",!0)),this.element.disabled&&this.disable(!0)},t.prototype.setHtml=function(){var t=this.options,e=this.cssNameSpace,i=t.wrapperClassName?" ".concat(t.wrapperClassName):"",s=['<div id="'.concat(this.ids.WRAPPER,'" class="').concat(e,"__wrapper").concat(i,'">')];s.push('<p class="sr-only '.concat(e,"__sr-only ").concat(e,'__sr-announcements" ')+'id="'.concat(this.ids.SR_ANNOUNCEMENTS,'" aria-live="polite" aria-atomic="true"></p>'));var n=t.name?' name="'.concat(t.name,'"'):"",r=t.inputClassName?" ".concat(t.inputClassName):"",o=t.placeholder?' placeholder="'.concat(t.placeholder,'" aria-placeholder="').concat(t.placeholder,'"'):"";s.push('<input type="text" autocomplete="off" aria-expanded="false" '+'aria-autocomplete="list" aria-describedby="'.concat(this.ids.SR_ASSISTANCE,'" ')+'role="combobox" id="'.concat(this.ids.INPUT,'" aria-owns="').concat(this.ids.LIST,'" ')+'class="'.concat(e,"__input").concat(r,'"').concat(n).concat(o," />")),t.showAllControl&&s.push('<span role="button" tabindex="0" id="'.concat(this.ids.BUTTON,'" ')+'aria-label="'.concat(t.srShowAllText,'" class="').concat(e,'__show-all" ')+'aria-describedby="'.concat(this.ids.LABEL,'" aria-expanded="false"></span>'));var l=t.srListLabelText,a=t.listClassName?" ".concat(t.listClassName):"",c=l?' aria-label="'.concat(l,'"'):"";s.push('<ul id="'.concat(this.ids.LIST,'" class="').concat(e,"__list").concat(a,'" ')+'role="listbox" aria-describedby="'.concat(this.ids.LABEL,'" ')+'aria-hidden="true" hidden="hidden"'.concat(c,"></ul>")),s.push('<p id="'.concat(this.ids.SR_ASSISTANCE,'" style="display:none;">').concat(g(t.srAssistiveText),"</p>")),s.push("</div>"),this.element.insertAdjacentHTML("afterend",s.join(""))},t.prototype.destroy=function(){var t=this;this.label&&this.label[p]&&(this.label.setAttribute("for",this.label[p]),delete this.label[p]),this.documentClickBound&&document.removeEventListener("click",this.documentClick),this.autoGrow&&this.inputAutoWidth&&this.inputAutoWidth.destroy(),this.wrapper.parentNode.removeChild(this.wrapper),delete this.element[c],this.show(this.element),clearTimeout(this.filterTimer),clearTimeout(this.pollingTimer),clearTimeout(this.showAllPrepTimer),clearTimeout(this.announcementTimer),clearTimeout(this.componentBlurTimer),clearTimeout(this.clearAnnouncementTimer),clearTimeout(this.elementChangeEventTimer),["list","input","label","element","wrapper","showAll","deleteAll","srAssistance","srAnnouncements"].forEach((function(e){return t[e]=null}))},t.prototype.init=function(t,e){this.selected=[],this.element=t,this.label=document.querySelector('[for="'+this.element.id+'"]'),this.ids=new b(this.element.id,this.label?this.label.id:null,e.id),this.elementIsInput="INPUT"===t.nodeName,this.options=new a(e),this.label&&!this.label.id&&(this.label.id=this.ids.LABEL),this.source=this.options.source,this.multiple=this.options.multiple,this.autoGrow=this.options.autoGrow,this.cssNameSpace=this.options.cssNameSpace,this.documentClick=this.handleComponentBlur.bind(this),this.setHtml(),this.list=document.getElementById(this.ids.LIST),this.input=document.getElementById(this.ids.INPUT),this.wrapper=document.getElementById(this.ids.WRAPPER),this.showAll=document.getElementById(this.ids.BUTTON),this.srAssistance=document.getElementById(this.ids.SR_ASSISTANCE),this.srAnnouncements=document.getElementById(this.ids.SR_ANNOUNCEMENTS),this.prepListSource();var i=[];this.options.showAllControl&&i.push("".concat(this.cssNameSpace,"__wrapper--show-all")),this.autoGrow&&i.push("".concat(this.cssNameSpace,"__wrapper--autogrow")),this.multiple&&i.push("".concat(this.cssNameSpace,"__wrapper--multiple")),i.length&&l(this.wrapper,i.join(" ")),this.hide(this.list),this.hide(this.element),this.setInputStartingStates(),this.bindEvents(),this.api=new m(this),this.triggerOptionCallback("onReady",[this.wrapper])},t}(),k=P;function F(t,e){return t&&t[c]&&t[c].open?t[c]:new k(t,e).api}var D=F}(),s}()}));
!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var i=e();for(var s in i)("object"==typeof exports?exports:t)[s]=i[s]}}(self,(function(){return function(){var t={342:function(t){window,t.exports=function(t){var e={};function i(s){if(e[s])return e[s].exports;var n=e[s]={i:s,l:!1,exports:{}};return t[s].call(n.exports,n,n.exports,i),n.l=!0,n.exports}return i.m=t,i.c=e,i.d=function(t,e,s){i.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:s})},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.t=function(t,e){if(1&e&&(t=i(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var s=Object.create(null);if(i.r(s),Object.defineProperty(s,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var n in t)i.d(s,n,function(e){return t[e]}.bind(null,n));return s},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="",i(i.s=0)}([function(t,e,i){"use strict";var s;function n(t,e){if(t)for(var i in e){var s="number"==typeof e[i]?e[i]+"px":e[i];t.style[i]=s+""}}i.r(e),i.d(e,"InputAutoWidth",(function(){return r}));var r=function(){function t(t,e){this.cache={},this.options=e,this.input=t,this.trigger(),this.eventHandler=this.trigger.bind(this),this.input.addEventListener("blur",this.eventHandler),this.input.addEventListener("input",this.eventHandler),this.input.addEventListener("keyup",this.eventHandler),this.input.addEventListener("keydown",this.eventHandler)}return t.prototype.measureString=function(t){return t?this.cache&&"number"==typeof this.cache[t]?this.cache[t]:(s||(n(s=document.createElement("span"),{position:"absolute",top:-99999,left:-99999,width:"auto",padding:0,whiteSpace:"pre"}),document.body.appendChild(s)),s.textContent=t,function(t,e,i){if(t&&e){var s=getComputedStyle(t),r={};if(i&&i.length)for(var o=0,l=i.length;o<l;o+=1)r[i[o]]=s[i[o]];else r=s;n(e,r)}}(this.input,s,["letterSpacing","fontSize","fontFamily","fontWeight","textTransform"]),s.offsetWidth||s.clientWidth):0},t.prototype.trigger=function(t){if(void 0===t&&(t={}),!t.metaKey&&!t.altKey){var e,i,s=this.input.value;if(t.type&&"keydown"===t.type.toLowerCase()){var n=t.keyCode,r=46===n,o=8===n;if(r||o){var l=function(t){var e={};if("selectionStart"in t)e.start=t.selectionStart,e.length=t.selectionEnd-e.start;else if(document.selection){t.focus();var i=document.selection.createRange(),s=i.text.length;i.moveStart("character",-t.value.length),e.start=i.text.length-s,e.length=s}return e}(this.input);l.length?s=s.substring(0,l.start)+s.substring(l.start+l.length):o&&l.start?s=s.substring(0,l.start-1)+s.substring(l.start+1):r&&void 0!==l.start&&(s=s.substring(0,l.start)+s.substring(l.start+1))}else if((e=n)>=48&&e<=57||e>=65&&e<=90||e>=96&&e<=111||e>=186&&e<=222||32===e||8===e||46===e){var a=String.fromCharCode(n);s+=a=t.shiftKey?a.toUpperCase():a.toLowerCase()}}!s&&(i=this.input.getAttribute("placeholder"))&&(s=i);var c=this.measureString(s)+4;this.options&&this.options.cache&&this.cache&&(this.cache[s]=c);var h=this.options&&this.options.minWidth;"number"==typeof h&&c<h&&(c=h);var u=this.options&&this.options.maxWidth;"number"==typeof u&&c>u&&(c=u),c!==this.currentWidth&&(this.currentWidth=c,this.input.style.width=c+"px")}},t.prototype.destroy=function(){this.input.removeEventListener("blur",this.eventHandler),this.input.removeEventListener("input",this.eventHandler),this.input.removeEventListener("keyup",this.eventHandler),this.input.removeEventListener("keydown",this.eventHandler),this.input=this.cache=null},t}();e.default=r}])},771:function(){var t=Element.prototype;t.matches||(t.matches=t.msMatchesSelector||t.webkitMatchesSelector),t.closest||(t.closest=function(t){var e=this;do{if(e.matches(t))return e;e=e.parentElement||e.parentNode}while(null!==e&&1===e.nodeType);return null})}},e={};function i(s){var n=e[s];if(void 0!==n)return n.exports;var r=e[s]={exports:{}};return t[s](r,r.exports,i),r.exports}i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,{a:e}),e},i.d=function(t,e){for(var s in e)i.o(e,s)&&!i.o(t,s)&&Object.defineProperty(t,s,{enumerable:!0,get:e[s]})},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};var s={};return function(){"use strict";i.r(s),i.d(s,{AriaAutocomplete:function(){return F},default:function(){return D}});var t=i(342),e=i.n(t),n=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;function r(t,e){if(t&&1===t.nodeType&&"string"==typeof e)!function(t,e){for(var i=t.getAttribute&&t.getAttribute("class")||"",s=" "+i+" ",r=0,o=e.split(" "),l=o.length;r<l;r+=1)s=s.replace(" "+o[r]+" "," ");var a;i!==(s=null==(a=s)?"":(a+"").replace(n,""))&&t.setAttribute("class",s)}(t,e);else if(t&&"number"==typeof t.length)for(var i=0,s=t.length;i<s;i+=1)r(t[i],e)}var o=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;function l(t,e){if(t&&1===t.nodeType&&"string"==typeof e)!function(t,e){for(var i=t.getAttribute&&t.getAttribute("class")||"",s=" "+i+" ",n="",r=0,l=e.split(" "),a=l.length;r<a;r+=1)""!==l[r]&&-1===s.indexOf(" "+l[r]+" ")&&(n+=" "+l[r]);var c;i!==(n=null==(c=i+n)?"":(c+"").replace(o,""))&&t.setAttribute("class",n)}(t,e);else if(t&&"number"==typeof t.length)for(var i=0,s=t.length;i<s;i+=1)l(t[i],e)}var a=function(t){for(var e in void 0===t&&(t={}),this.sourceMapping={},this.alsoSearchIn=[],this.create=!1,this.delay=100,this.minLength=1,this.maxResults=9999,this.showAllControl=!1,this.confirmOnBlur=!0,this.multiple=!1,this.autoGrow=!1,this.maxItems=9999,this.multipleSeparator=",",this.deleteOnBackspace=!1,this.deleteAllControl=!1,this.deleteAllText="Delete all",this.asyncQueryParam="q",this.asyncMaxResultsParam="limit",this.noResultsText="No results",this.cssNameSpace="aria-autocomplete",this.srDelay=1400,this.srAutoClear=1e4,this.srDeleteText="delete",this.srDeletedText="deleted",this.srShowAllText="Show all",this.srSelectedText="selected",this.srListLabelText="Search suggestions",this.srAssistiveText="When results are available use up and down arrows to review and enter to select. Touch device users, explore by touch or with swipe gestures.",this.srAssistiveTextAutoClear=!0,this.srResultsText=function(t){return"".concat(t," ").concat(1===t?"result":"results"," available.")},t)t.hasOwnProperty(e)&&void 0!==t[e]&&(this[e]=t[e])},c="ariaAutocomplete",h="_ariaAutocompleteCleanedLabel",u="_ariaAutocompleteSelectedOption",p="_ariaAutocompleteLabelOriginallyFor",d=/[&<>"']/g,f={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},m=function(){function t(t){this.list=t.list,this.input=t.input,this.wrapper=t.wrapper,this.options=t.options,this.selected=t.selected,this.open=this.open.bind(t),this.close=this.close.bind(t),this.enable=this.enable.bind(t),this.disable=this.disable.bind(t),this.filter=this.filter.bind(t),this.setOption=this.setOption.bind(t),this.destroy=this.destroy.bind(t),this.delete=this.delete.bind(t),this.deleteAll=this.deleteAll.bind(t),t.element[c]=this}return t.prototype.open=function(){this.show.call(this)},t.prototype.close=function(){this.hide.call(this)},t.prototype.enable=function(){this.enable.call(this)},t.prototype.disable=function(t){this.disable.call(this,t)},t.prototype.filter=function(t){this.filter.call(this,t)},t.prototype.setOption=function(t,e){this.options[t]=e},t.prototype.destroy=function(){this.destroy.call(this)},t.prototype.delete=function(t){this.deleteEntry.call(this,this.multiple?t:null)},t.prototype.deleteAll=function(){this.multiple?this.deleteAllSelected.call(this):this.deleteEntry.call(this)},t}(),v=0,b=function(t,e,i){v+=1,this.ELEMENT=t;var s=i||t||"";this.PREFIX="".concat(s,"aria-autocomplete-").concat(v),this.LIST="".concat(this.PREFIX,"-list"),this.BUTTON="".concat(this.PREFIX,"-button"),this.OPTION="".concat(this.PREFIX,"-option"),this.WRAPPER="".concat(this.PREFIX,"-wrapper"),this.LABEL=e||"".concat(this.PREFIX,"-label"),this.INPUT=i||"".concat(this.PREFIX,"-input"),this.SR_ASSISTANCE="".concat(this.PREFIX,"-sr-assistance"),this.OPTION_SELECTED="".concat(this.PREFIX,"-option-selected"),this.SR_ANNOUNCEMENTS="".concat(this.PREFIX,"-sr-announcements")};function y(t){return null==t?"":(t+"").trim()}function g(t){return"string"==typeof t&&t?t.replace(d,(function(t){return f[t]})):""}i(771);var A=/&/g,S=/\s\s+/g,w=/[\u2018\u2019',:\u2013-]/g,E=/[\-\[\]{}()*+?.,\\\^$|#\s]/g;function x(t,e){return void 0===e&&(e=!1),t=y(t).toLowerCase().replace(w,"").replace(A,"and").replace(S," "),e&&(t=t.replace(E,"\\$&")),t}function T(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var i={};return t.forEach((function(t){for(var e in t)t.hasOwnProperty(e)&&void 0!==t[e]&&(i[e]=t[e])})),i}function O(t,e){if("createEvent"in document){var i=document.createEvent("HTMLEvents");i.initEvent(e,!0,!0),t.dispatchEvent(i)}else t.fireEvent("on"+e)}function C(t){return t&&t.children?Array.prototype.slice.call(t.children):[]}function I(t,e,i){e=!!e,t&&("INPUT"===t.nodeName&&"checked"in t&&t.checked!==e&&(t.checked=e,O(t,"change")),"OPTION"===t.nodeName&&"selected"in t&&t.selected!==e&&(t.selected=e,clearTimeout(i.elementChangeEventTimer),i.elementChangeEventTimer=setTimeout((function(){O(t.closest("select"),"change")}),1)))}function _(t,e){void 0===e&&(e={});var i={},s=e.value,n=e.label;return"string"==typeof t?i.value=i.label=t:((i=T(t)).value=(i[s]||i.value||i.label||"").toString(),i.label=(i[n]||i.label||i.value||"").toString()),i[h]=x(i.label),i}function L(t,e){return void 0===e&&(e={}),Array.isArray(t)?t.map((function(t){return _(t,e)})):t?[t]:[]}function N(t,e,i){if("string"==typeof t)return function(t,e,i){return i!==h&&(t=x(t,!1)),-1!==t.search(e)}(t,e,i);if(Array.isArray(t))for(var s=0,n=t.length;s<n;s+=1)if(N(t[s],e))return!0;return!1}var P=function(){function t(t,e){t&&this.init(t,e)}return t.prototype.triggerOptionCallback=function(t,e,i){if(void 0===e&&(e=[]),void 0===i&&(i=this.api),"function"==typeof this.options[t])return this.options[t].apply(i,e)},t.prototype.show=function(t){if(t)return r(t,"".concat(this.cssNameSpace,"--hide hide hidden")),t.removeAttribute("aria-hidden"),void t.removeAttribute("hidden");if(this.input.setAttribute("aria-expanded","true"),this.showAll){var e=(!!this.forceShowAll).toString();this.showAll.setAttribute("aria-expanded",e)}this.menuOpen||(this.show(this.list),this.menuOpen=!0,this.triggerOptionCallback("onOpen",[this.list]),this.documentClickBound||(this.documentClickBound=!0,document.addEventListener("click",this.documentClick)))},t.prototype.hide=function(t){if(t)return l(t,"".concat(this.cssNameSpace,"--hide hide hidden")),t.setAttribute("aria-hidden","true"),void t.setAttribute("hidden","hidden");this.currentSelectedIndex=-1,this.input.setAttribute("aria-expanded","false"),this.showAll&&this.showAll.setAttribute("aria-expanded","false"),this.menuOpen&&(this.hide(this.list),this.menuOpen=!1,this.triggerOptionCallback("onClose",[this.list]))},t.prototype.enable=function(){if(this.disabled){this.disabled=!1,this.input.disabled=!1;var t=this.cssNameSpace;r(this.input,"".concat(t,"__input--disabled disabled")),r(this.wrapper,"".concat(t,"__wrapper--disabled disabled")),this.showAll&&(this.showAll.setAttribute("tabindex","0"),r(this.showAll,"".concat(t,"__show-all--disabled disabled")))}this.enableDeletions()},t.prototype.disable=function(t){if(void 0===t&&(t=!1),!this.disabled){this.disabled=!0,this.input.disabled=!0;var e=this.cssNameSpace;l(this.input,"".concat(e,"__input--disabled disabled")),l(this.wrapper,"".concat(e,"__wrapper--disabled disabled")),this.showAll&&(this.showAll.setAttribute("tabindex","-1"),l(this.showAll,"".concat(e,"__show-all--disabled disabled")))}t&&this.disableDeletions()},t.prototype.enableDeletions=function(){if(this.deletionsDisabled){this.deletionsDisabled=!1;var t=this.cssNameSpace;r(this.wrapper,"".concat(t,"__wrapper--deletions-disabled")),this.getSelectedElems().forEach((function(e){r(e,"".concat(t,"__selected--disabled")),e.setAttribute("tabindex","0")})),this.deleteAll&&(r(this.deleteAll,"".concat(t,"__delete-all--disabled ").concat(t,"__selected--disabled")),this.deleteAll.setAttribute("tabindex","0"))}},t.prototype.disableDeletions=function(){if(!this.deletionsDisabled){this.deletionsDisabled=!0;var t=this.cssNameSpace;l(this.wrapper,"".concat(t,"__wrapper--deletions-disabled")),this.getSelectedElems().forEach((function(e){l(e,"".concat(t,"__selected--disabled")),e.setAttribute("tabindex","-1")})),this.deleteAll&&(l(this.deleteAll,"".concat(t,"__delete-all--disabled ").concat(t,"__selected--disabled")),this.deleteAll.setAttribute("tabindex","-1"))}},t.prototype.triggerAutoGrow=function(){this.autoGrow&&this.inputAutoWidth&&"function"==typeof this.inputAutoWidth.trigger&&this.inputAutoWidth.trigger()},t.prototype.setInputValue=function(t,e){void 0===e&&(e=!1),this.term=t,this.input&&(this.input.value=t),e&&(this.inputPollingValue=t),this.triggerAutoGrow()},t.prototype.setOriginalElementValue=function(t){var e=this.elementIsInput||this.sourceFromSelect,i=this.element;e&&i.value!==t&&(i.value=t,O(i,"change"))},t.prototype.indexOfValueIn=function(t,e,i){if(void 0===e&&(e=this.input.value),void 0===i&&(i="label"),t.length&&(e=y(e).toLowerCase()))for(var s=0,n=t.length;s<n;s+=1)if(y(t[s][i]).toLowerCase()===e)return s;return-1},t.prototype.clearAnnouncement=function(t){var e=this;clearTimeout(this.clearAnnouncementTimer),this.clearAnnouncementTimer=setTimeout((function(){e.srAnnouncements&&(e.srAnnouncements.textContent="")}),t)},t.prototype.announce=function(t,e){var i=this;if(void 0===e&&(e=this.options.srDelay),this.srAnnouncements&&t&&"string"==typeof t){var s=function(){i.srAnnouncements.textContent=t;var e=i.options.srAutoClear;(!0===e||"number"==typeof e&&e>-1)&&i.clearAnnouncement("number"==typeof e?e:1e4)};0!==e?(clearTimeout(this.announcementTimer),this.announcementTimer=setTimeout((function(){return s()}),e)):s()}},t.prototype.setInputDescription=function(){var t=this.input.getAttribute("aria-describedby"),e=y(t),i=e.replace(this.ids.SR_ASSISTANCE,"");this.input.value.length||(i="".concat(i," ").concat(this.ids.SR_ASSISTANCE)),(i=y(i))?i!==e&&this.input.setAttribute("aria-describedby",i):t&&this.input.removeAttribute("aria-describedby")},t.prototype.isSelectedElem=function(t){var e=t&&t[u];return!(!this.multiple||"object"!=typeof e)},t.prototype.getSelectedElems=function(){for(var t=[],e=0,i=this.wrapper.childNodes.length;e<i;e+=1){var s=this.wrapper.childNodes[e];1===s.nodeType&&this.isSelectedElem(s)&&t.push(s)}return t},t.prototype.deleteAllSelected=function(){if(!this.deletionsDisabled){for(var t=this.selected.length;t--;){var e=T(this.selected[t]);I(e.element,!1,this),this.triggerOptionCallback("onDelete",[e])}this.selected.splice(0),this.setSourceElementValues(),this.buildMultiSelected(),this.triggerAutoGrow(),this.announce(this.options.srDeletedText,0)}},t.prototype.removeEntryFromSelected=function(t,e){if(void 0===e&&(e=!1),!this.deletionsDisabled&&t){var i=this.selected.indexOf(t);if(-1===i)for(var s=0,n=this.selected.length;s<n;s+=1)if(this.selected[s].value===t.value){i=s;break}if(i>-1&&this.selected[i]){var r=T(this.selected[i]),o=r.label;I(r.element,!1,this),this.selected.splice(i,1),this.triggerOptionCallback("onDelete",[r]),this.setSourceElementValues(),this.buildMultiSelected(e?i:null),this.triggerAutoGrow(),this.announce("".concat(o," ").concat(this.options.srDeletedText),0)}}},t.prototype.deleteEntry=function(t){var e=null==t;e&&this.selected.length&&(t=this.selected[this.selected.length-1]),e||"object"==typeof t||(t={value:t}),this.removeEntryFromSelected(t),this.multiple||(this.setOriginalElementValue(""),this.setInputValue("",!0))},t.prototype.createSelectedElemFrom=function(t,e){var i=t.label,s=this.cssNameSpace,n="".concat(s,"__selected"),r=document.createElement("span"),o=e?"".concat(s,"__delete-all ").concat(n," ").concat(n,"--delete-all"):n;return r.setAttribute("aria-describedby",this.ids.LABEL),r.setAttribute("class",o),r.setAttribute("role","button"),r.setAttribute("tabindex","0"),r.textContent=i,e||(r.setAttribute("aria-label","".concat(this.options.srDeleteText," ").concat(i)),r[u]=t),r},t.prototype.buildMultiSelected=function(t){var e=this;if(this.multiple){this.multiple&&this.selected.length>=this.options.maxItems?this.disable():this.enable();var i=this.getSelectedElems();if(this.selected.length||i.length){var s=[];i.forEach((function(t){for(var i=t[u],n=0,r=e.selected.length;n<r;n+=1){var o=e.selected[n];if(o===i||o.value===i.value)return void s.push(t)}t.parentNode.removeChild(t)}));var n=document.createDocumentFragment();this.selected.forEach((function(t){for(var i=0,r=s.length;i<r;i+=1){var o=s[i][u];if(o===t||o.value===t.value)return}n.appendChild(e.createSelectedElemFrom(t))})),n.childNodes&&n.childNodes.length&&this.wrapper.insertBefore(n,this.srAssistance);var r=this.getSelectedElems(),o=r.map((function(t,i){var s="".concat(e.ids.OPTION_SELECTED,"-").concat(i);return t.setAttribute("id",s),s}));if(o.push(this.ids.LIST),this.input.setAttribute("aria-owns",o.join(" ")),this.autoGrow&&this.selected.length?this.input.removeAttribute("placeholder"):this.options.placeholder&&this.input.setAttribute("placeholder",this.options.placeholder),this.selected.length<=1?this.deleteAll&&(this.deleteAll.parentNode.removeChild(this.deleteAll),this.deleteAll=null):this.options.deleteAllControl&&!this.deleteAll&&r[0]&&(this.deleteAll=this.createSelectedElemFrom({label:this.options.deleteAllText},!0),r[0].parentNode.insertBefore(this.deleteAll,r[0])),"number"==typeof t){var l=r[t]||r[t-1]||r[0];l&&"function"==typeof l.focus&&l.focus()}}}},t.prototype.resetOptionAttributes=function(t){void 0===t&&(t=C(this.list));var e="".concat(this.cssNameSpace,"__option--focused focused focus");t.forEach((function(t){"true"!==t.getAttribute("aria-disabled")&&t.setAttribute("aria-selected","false"),r(t,e)}))},t.prototype.setOptionFocus=function(t,e,i){void 0===i&&(i=!0);var s=C(this.list);if(this.resetOptionAttributes(s),e<0||!s.length)return this.currentSelectedIndex=-1,void(t&&t.target!==this.input&&this.input.focus());if(e>=s.length)return this.currentSelectedIndex=s.length-1,void this.setOptionFocus(t,this.currentSelectedIndex);var n=s[e];if(n&&"string"==typeof n.getAttribute("tabindex"))return this.currentSelectedIndex=e,l(n,"".concat(this.cssNameSpace,"__option--focused focused focus")),"true"!==n.getAttribute("aria-disabled")&&n.setAttribute("aria-selected","true"),void(i&&n.focus());this.currentSelectedIndex=-1},t.prototype.setSourceElementValues=function(){for(var t=[],e=0,i=this.selected.length;e<i;e+=1){var s=this.selected[e];t.push(s.value),I(s.element,!0,this)}if(this.elementIsInput){var n=t.join(this.options.multipleSeparator);n!==this.element.value&&(this.element.value=n,O(this.element,"change"))}!this.selected.length&&this.sourceFromSelect&&(this.element.value=""),this.triggerOptionCallback("onChange",[this.selected])},t.prototype.handleOptionSelect=function(t,e,i){if(void 0===i&&(i=!0),!("number"!=typeof e||e<0||this.multiple&&this.selected.length>=this.options.maxItems)&&this.filteredSource.length&&this.filteredSource[e]){var s=T(this.filteredSource[e]);if(!(s.disabled||s.element&&s.element.disabled)){for(var n=!1,r=0,o=this.selected.length;r<o;r+=1)if(this.selected[r].value===s.value){n=!0;break}n||this.multiple||this.selected.splice(0),n||(this.addResultsEntryToDomAndSource(s),this.selected.push(s),this.setSourceElementValues(),this.buildMultiSelected()),this.setInputValue(this.multiple?"":s.label,!0),this.triggerOptionCallback("onConfirm",[s]),this.announce("".concat(s.label," ").concat(this.options.srSelectedText),0),!this.disabled&&!1!==i&&this.input&&this.input.focus(),this.hide()}}},t.prototype.removeSelectedFromResults=function(t){var e=this;if(!this.multiple||!this.selected.length)return t;var i=[];return t.forEach((function(t){for(var s=e.selected,n=0,r=s.length;n<r;n+=1)if(t.label===s[n].label&&t.value===s[n].value)return;i.push(t)})),i},t.prototype.addResultsEntryToDomAndSource=function(t){var e=this.options.create,i=this.sourceFromSelect,s=this.sourceFromCheckboxList;if(e&&t&&t.value&&Array.isArray(this.source)&&(i||s)){var n=t.label,r=t.value;if(!(this.indexOfValueIn(this.source,r,"value")>-1||this.indexOfValueIn(this.source,n,"label")>-1)){var o;if(i){var l=this.element.querySelector("option"),a=l.cloneNode(!0);a.textContent=n,a.value=r,o=a,l.parentNode.insertBefore(a,l)}else if(s){var c=this.element.querySelector('input[type="checkbox"]'),h=c.cloneNode(!0),u=c.closest("label"),p=document.createElement("label");p.textContent=n,h.value=r,o=h,p.appendChild(h);var d=u||c;d.parentNode.insertBefore(p,d)}o&&(t.element=o,o.removeAttribute("id")),this.source.unshift(t)}}},t.prototype.prependEntryInCreateMode=function(t,e){var i=this.options.create;if((!0===i||"function"==typeof i)&&x(t)){var s,n=y(t),r=this.options.sourceMapping;if(!0===i&&(s=_(n,r)),"function"==typeof i){var o=this.triggerOptionCallback("create",[n]),l=typeof o;o&&("string"===l||"object"===l&&!Array.isArray(o))&&(s=_(o,r))}!s||!s.label||!s.value||this.indexOfValueIn(e,s[h],h)>-1||this.indexOfValueIn(e,s.value,"value")>-1||e.unshift(s)}},t.prototype.setListOptions=function(t){var e=this.options.sourceMapping;this.prependEntryInCreateMode(this.term,t);var i=this.removeSelectedFromResults(t),s=this.triggerOptionCallback("onResponse",[i.slice()]);this.filteredSource=Array.isArray(s)?L(s,e):i;for(var n=this.ids.OPTION,o=this.cssNameSpace,a="".concat(o,"__option"),c=this.filteredSource.length,h="function"==typeof this.options.onItemRender,u=this.forceShowAll?9999:this.options.maxResults,p=u<c?u:c,d=[],f=0;f<p;f+=1){var m=this.filteredSource[f],v=h&&this.triggerOptionCallback("onItemRender",[m]),b="string"==typeof v?v:m.label,y=!!(m.disabled||m.element&&m.element.disabled),A=y?"":' aria-selected="false"';d.push('<li tabindex="-1"'.concat(A,' role="option" class="').concat(a,'" ')+'aria-disabled="'.concat(y,'" id="').concat(n,"--").concat(f,'" aria-posinset="').concat(f+1,'" ')+'aria-setsize="'.concat(p,'">').concat(g(b),"</li>"))}var S,w=!d.length;w?(r(this.list,"".concat(o,"__list--has-results")),l(this.list,"".concat(o,"__list--no-results"))):(l(this.list,"".concat(o,"__list--has-results")),r(this.list,"".concat(o,"__list--no-results")));var E=this.options.noResultsText;w&&"string"==typeof E&&E.length&&(S=E,d.push('<li class="'.concat(a," ").concat(a,'--no-results">').concat(g(E),"</li>"))),this.cancelFilterPrep(),S||(S=this.triggerOptionCallback("srResultsText",[p])),S&&this.announce(S);var x=d.join("");if(this.currentListHtml!==x?(this.currentListHtml=x,this.list.innerHTML=x):this.resetOptionAttributes(),!d.length)return this.hide(),void(this.forceShowAll=!1);this.show(),this.forceShowAll=!1},t.prototype.handleAsync=function(t,e){var i=this;void 0===e&&(e=!1),this.xhr&&"function"==typeof this.xhr.abort&&this.xhr.abort();var s=new XMLHttpRequest,n=this.forceShowAll,r=e?null:this.api,o=this.multiple?this.selected.length:0,l=n||e||9999===this.options.maxResults,a=this.source+(/\?/.test(this.source)?"&":"?")+"".concat(encodeURIComponent(this.options.asyncQueryParam),"=").concat(encodeURIComponent(t),"&")+"".concat(encodeURIComponent(this.options.asyncMaxResultsParam),"=")+"".concat(l?9999:o+this.options.maxResults),c=this.triggerOptionCallback("onAsyncPrep",[a,s,e],r);c&&"string"==typeof c&&(a=c),s.open("GET",a),s.onload=function(){if(s.readyState===s.DONE&&s.status>=200&&s.status<300){i.forceShowAll=n;var o=L(i.triggerOptionCallback("onAsyncSuccess",[t,s,e],r)||s.responseText,i.options.sourceMapping);e?(i.prepSelectedFromArray(o),i.setInputStartingStates(!1)):i.setListOptions(o),i.triggerOptionCallback("onAsyncComplete",[t,s,e],r)}},s.onerror=function(){i.triggerOptionCallback("onAsyncError",[t,s,e],r)},e||(this.xhr=s),this.triggerOptionCallback("onAsyncBeforeSend",[t,s,e],r),s.send()},t.prototype.filter=function(t){var e=this;if("string"==typeof t){var i=this.forceShowAll;if(!i){var s=this.triggerOptionCallback("onSearch",[t]);"string"==typeof s&&(t=s)}if(this.term=t,"string"==typeof this.source&&this.source.length)return this.handleAsync(t),void(this.forceShowAll=!1);if("function"!=typeof this.source){t||(i=!0);var n=[],r=this.source;if(r&&r.length){var o=[h];if(!i){t=x(t,!0);var l=this.options.alsoSearchIn;Array.isArray(l)&&l.length&&(o=function(t){var e=[];return t.forEach((function(t){if("string"==typeof t){for(var i=y(t),s="label"!==i,n=0,r=e.length;s&&n<r;n+=1)s=e[r]!==i;s&&e.push(i)}})),e}(o.concat(l)))}r.forEach((function(e){(i||function(t,e,i){for(var s in t)if(t.hasOwnProperty(s)){var n=t[s];if(("string"==typeof n||Array.isArray(n))&&i.indexOf(s)>-1&&N(n,e,s))return!0}return!1}(e,t,o))&&n.push(e)}))}this.setListOptions(n)}else{var a=function(t){var i=L(t,e.options.sourceMapping);e.setListOptions(i)},c=this.source.call(this.api,this.term,a,!1);c&&"function"==typeof c.then&&c.then((function(t){return a(t)}))}}else this.cancelFilterPrep()},t.prototype.cancelFilterPrep=function(){clearTimeout(this.filterTimer),r(this.wrapper,"".concat(this.cssNameSpace,"__wrapper--loading loading")),r(this.input,"".concat(this.cssNameSpace,"__input--loading loading")),this.filtering=!1},t.prototype.filterPrep=function(t,e,i){var s=this;void 0===e&&(e=!1),void 0===i&&(i=!1);var n=this.forceShowAll,r=n||i?0:this.options.delay;this.cancelFilterPrep(),this.filtering=!0,this.filterTimer=setTimeout((function(){var i=s.input.value;if(s.inputPollingValue=i,(n||""===i||e&&!s.multiple&&s.selected.length&&y(s.selected[0].label)===y(i))&&(i=""),t&&t.type&&s.options.srAssistiveTextAutoClear&&s.setInputDescription(),!n&&i.length<s.options.minLength)s.hide();else{var r;try{var o=t;r=t&&"keydown"===t.type&&(o.altKey||o.ctrlKey||o.metaKey)}catch(t){}var a=""!==i&&i===s.term;!a||a&&!s.menuOpen&&!r?(l(s.wrapper,"".concat(s.cssNameSpace,"__wrapper--loading loading")),l(s.input,"".concat(s.cssNameSpace,"__input--loading loading")),s.currentSelectedIndex=-1,s.filter(i)):s.cancelFilterPrep()}}),r)},t.prototype.filterPrepShowAll=function(t){var e=this;this.disabled||(clearTimeout(this.showAllPrepTimer),this.showAllPrepTimer=setTimeout((function(){e.componentBlurTimer&&clearTimeout(e.componentBlurTimer),t.preventDefault(),e.forceShowAll=!0,e.filterPrep(t,!1,!0)}),0))},t.prototype.handleComponentBlur=function(t,e){var i=this;void 0===e&&(e=!1),clearTimeout(this.componentBlurTimer);var s=e?0:100;this.componentBlurTimer=setTimeout((function(){var t=document.activeElement;if(e||!t||i.deleteAll&&i.deleteAll===t||i.isSelectedElem(t)||!i.wrapper.contains(t)){if(i.xhr&&"function"==typeof i.xhr.abort&&i.xhr.abort(),!e&&i.options.confirmOnBlur&&i.menuOpen){var s=i.currentSelectedIndex;if("number"!=typeof s||-1===s){var n=i.filteredSource.slice(),r=i.triggerOptionCallback("confirmOnBlur",[i.term,n]),o=x(r&&"string"==typeof r?r:i.term);s=i.indexOfValueIn.call(i,i.filteredSource,o,h)}i.handleOptionSelect({},s,!1)}i.cancelFilterPrep(),i.hide(),i.multiple||-1!==i.indexOfValueIn.call(i,i.selected)||i.deleteEntry(),i.multiple&&i.setInputValue("",!0),i.documentClickBound&&(i.documentClickBound=!1,document.removeEventListener("click",i.documentClick)),i.triggerOptionCallback("onBlur",[i.wrapper]),i.isFocused=!1}}),s)},t.prototype.handleUpKey=function(t){t.preventDefault(),!this.disabled&&this.menuOpen&&"number"==typeof this.currentSelectedIndex&&this.setOptionFocus(t,this.currentSelectedIndex-1)},t.prototype.handleDownKey=function(t){if(t.preventDefault(),!this.menuOpen){var e=this.options.minLength;this.forceShowAll=e<1,(this.forceShowAll||this.input.value.length>=e)&&this.filterPrep(t)}if(this.menuOpen&&!this.filtering){var i=this.currentSelectedIndex;"number"!=typeof i||i<0?this.setOptionFocus(t,0):this.setOptionFocus(t,i+1)}},t.prototype.handleEndKey=function(t){if(!this.disabled&&this.menuOpen&&t.target!==this.input){var e=C(this.list);e.length&&(t.preventDefault(),this.setOptionFocus(t,e.length-1))}},t.prototype.handleHomeKey=function(t){!this.disabled&&this.menuOpen&&t.target!==this.input&&(t.preventDefault(),this.setOptionFocus(t,0))},t.prototype.handlePageUpKey=function(t){if(!this.disabled&&this.menuOpen&&t.target!==this.input){t.preventDefault();var e=this.currentSelectedIndex,i=e>0&&e-10<0?0:0===e?-1:e-10;this.setOptionFocus(t,i)}},t.prototype.handlePageDownKey=function(t){if(!this.disabled&&this.menuOpen&&t.target!==this.input){t.preventDefault();var e=this.currentSelectedIndex;this.setOptionFocus(t,e<0?0:e+10)}},t.prototype.handleEnterKey=function(t){var e=t.target;this.isSelectedElem(e)?this.removeEntryFromSelected(e[u],!0):this.deleteAll&&e===this.deleteAll?this.deleteAllSelected():this.disabled||(this.showAll&&e===this.showAll?this.filterPrepShowAll(t):(this.menuOpen&&(t.preventDefault(),this.currentSelectedIndex>-1&&this.handleOptionSelect(t,this.currentSelectedIndex)),e===this.input&&this.filterPrep(t,!1,!0)))},t.prototype.handleKeyDownDefault=function(t){var e=t.keyCode,i=t.target===this.input;if(32===e&&!i||this.isSelectedElem(t.target)&&46===e)return t.preventDefault(),void this.handleEnterKey(t);if(!this.disabled){var s=this.selected&&this.selected.length;this.options.deleteOnBackspace&&8===e&&""===this.input.value&&s&&i&&this.multiple&&this.removeEntryFromSelected(this.selected[s-1]);var n=function(t){return t>=48&&t<=57||t>=65&&t<=90||t>=96&&t<=111||t>=186&&t<=222||32===t||8===t||46===t}(e),r=!i&&n;r&&this.input.focus(),(r||i&&n)&&this.filterPrep(t)}},t.prototype.prepKeyDown=function(t){switch(t.keyCode){case 38:this.handleUpKey(t);break;case 40:this.handleDownKey(t);break;case 35:this.handleEndKey(t);break;case 36:this.handleHomeKey(t);break;case 13:this.handleEnterKey(t);break;case 33:this.handlePageUpKey(t);break;case 34:this.handlePageDownKey(t);break;case 27:this.handleComponentBlur(t,!0);break;default:this.handleKeyDownDefault(t)}},t.prototype.cancelPolling=function(){clearTimeout(this.pollingTimer)},t.prototype.startPolling=function(){var t=this;this.filtering||this.input.value===this.inputPollingValue||this.filterPrep({}),this.pollingTimer=setTimeout((function(){t.startPolling()}),200)},t.prototype.bindEvents=function(){var t=this;this.wrapper.addEventListener("focusout",(function(e){t.handleComponentBlur(e,!1)})),this.wrapper.addEventListener("focusin",(function(e){t.list.contains(e.target)||(t.currentSelectedIndex=-1),t.isFocused||t.triggerOptionCallback("onFocus",[t.wrapper]),t.isFocused=!0})),this.wrapper.addEventListener("keydown",(function(e){t.prepKeyDown(e)})),this.wrapper.addEventListener("click",(function(e){e.target!==t.wrapper?(t.isSelectedElem(e.target)&&t.removeEntryFromSelected(e.target[u],!0),t.deleteAll&&e.target===t.deleteAll&&t.deleteAllSelected()):t.input.focus()}));var i="".concat(this.cssNameSpace,"__wrapper--focused focused focus"),s="".concat(this.cssNameSpace,"__input--focused focused focus");this.input.addEventListener("blur",(function(){r(t.wrapper,i),r(t.input,s),t.cancelPolling()})),this.input.addEventListener("input",(function(e){document.activeElement===t.input&&t.filterPrep(e)})),this.input.addEventListener("click",(function(e){!t.menuOpen&&t.input.value.length>=t.options.minLength&&t.filterPrep(e,!0)})),this.input.addEventListener("focusin",(function(e){l(t.wrapper,i),l(t.input,s),t.startPolling(),t.disabled||t.menuOpen||t.filterPrep(e,!0)})),this.showAll&&this.showAll.addEventListener("click",(function(e){t.filterPrepShowAll(e)})),this.list.addEventListener("mouseenter",(function(e){t.resetOptionAttributes()})),this.list.addEventListener("click",(function(e){if(e.target!==t.list){var i=C(t.list);if(i.length){var s=i.indexOf(e.target);t.handleOptionSelect(e,s)}}})),this.autoGrow&&(this.inputAutoWidth=new(e())(this.input))},t.prototype.prepListSourceCheckboxes=function(){this.multiple=!0,this.source=[];for(var t=this.element.querySelectorAll('input[type="checkbox"]'),e=0,i=t.length;e<i;e+=1){var s=t[e];if(s.value){var n={value:s.value},r=s.closest("label");!r&&s.id&&(r=document.querySelector('[for="'+s.id+'"]')),r&&(n.label=r.textContent);var o=_(n);o.element=s,this.source.push(o),s.checked&&this.selected.push(o)}}},t.prototype.prepListSourceDdl=function(){var t=this.element.multiple;t&&!this.multiple&&(this.multiple=!0),!t&&this.multiple&&this.options.maxItems>1&&(this.options.maxItems=1),this.source=[];for(var e=this.element.querySelectorAll("option"),i=0,s=e.length;i<s;i+=1){var n=e[i];if(n.value){var r=_({value:n.value,label:n.textContent});r.element=n,this.source.push(r),n.selected&&this.selected.push(r)}}},t.prototype.prepSelectedFromArray=function(t){var e=this,i=this.elementIsInput&&this.element.value;if(i&&Array.isArray(t)&&t.length){var s=this.options,n=s.multiple,r=s.multipleSeparator,o=n?i.split(r):[i],l=t.slice();o.forEach((function(t){if(-1===e.indexOfValueIn(e.selected,t,"value")){e.prependEntryInCreateMode(t,l);var i=e.indexOfValueIn(l,t,"value");i>-1&&e.selected.push(l[i])}}))}},t.prototype.prepListSourceArray=function(){this.source=L(this.source,this.options.sourceMapping),this.prepSelectedFromArray(this.source)},t.prototype.prepListSourceAsync=function(){var t=this.element;this.elementIsInput&&t.value&&this.handleAsync(t.value,!0)},t.prototype.prepListSourceFunction=function(){var t=this,e=this.element;if(this.elementIsInput&&e.value){var i=function(e){var i=L(e,t.options.sourceMapping);t.prepSelectedFromArray(i),t.setInputStartingStates(!1)},s=this.source.call(void 0,e.value,i,!0);s&&"function"==typeof s.then&&s.then((function(t){return i(t)}))}},t.prototype.prepListSource=function(){return"function"==typeof this.source?this.prepListSourceFunction():"string"==typeof this.source&&this.source.length?this.prepListSourceAsync():Array.isArray(this.source)&&this.source.length?this.prepListSourceArray():(this.sourceFromSelect="SELECT"===this.element.nodeName,this.sourceFromSelect?this.prepListSourceDdl():(this.sourceFromCheckboxList=!!this.element.querySelector('input[type="checkbox"]'),this.sourceFromCheckboxList?this.prepListSourceCheckboxes():void(this.source=[])))},t.prototype.setInputStartingStates=function(t){if(void 0===t&&(t=!0),t){this.label&&(this.label[p]=this.ids.ELEMENT,this.label.setAttribute("for",this.ids.INPUT));var e=this.element.getAttribute("aria-describedby");e&&this.input.setAttribute("aria-describedby",e);var i=this.element.getAttribute("aria-labelledby");i&&this.input.setAttribute("aria-labelledby",i)}this.selected.length&&(this.multiple?(this.buildMultiSelected(),this.triggerAutoGrow()):this.setInputValue(this.selected[0].label||"",!0)),this.element.disabled&&this.disable(!0)},t.prototype.setHtml=function(){var t=this.options,e=this.cssNameSpace,i=t.wrapperClassName?" ".concat(t.wrapperClassName):"",s=['<div id="'.concat(this.ids.WRAPPER,'" class="').concat(e,"__wrapper").concat(i,'">')];s.push('<p class="sr-only '.concat(e,"__sr-only ").concat(e,'__sr-announcements" ')+'id="'.concat(this.ids.SR_ANNOUNCEMENTS,'" aria-live="polite" aria-atomic="true"></p>'));var n=t.name?' name="'.concat(t.name,'"'):"",r=t.inputClassName?" ".concat(t.inputClassName):"",o=t.placeholder?' placeholder="'.concat(t.placeholder,'" aria-placeholder="').concat(t.placeholder,'"'):"";s.push('<input type="text" autocomplete="off" aria-expanded="false" '+'aria-autocomplete="list" aria-describedby="'.concat(this.ids.SR_ASSISTANCE,'" ')+'role="combobox" id="'.concat(this.ids.INPUT,'" aria-owns="').concat(this.ids.LIST,'" ')+'class="'.concat(e,"__input").concat(r,'"').concat(n).concat(o," />")),t.showAllControl&&s.push('<span role="button" tabindex="0" id="'.concat(this.ids.BUTTON,'" ')+'aria-label="'.concat(t.srShowAllText,'" class="').concat(e,'__show-all" ')+'aria-describedby="'.concat(this.ids.LABEL,'" aria-expanded="false"></span>'));var l=t.srListLabelText,a=t.listClassName?" ".concat(t.listClassName):"",c=l?' aria-label="'.concat(l,'"'):"";s.push('<ul id="'.concat(this.ids.LIST,'" class="').concat(e,"__list").concat(a,'" ')+'role="listbox" aria-describedby="'.concat(this.ids.LABEL,'" ')+'aria-hidden="true" hidden="hidden"'.concat(c,"></ul>")),s.push('<p id="'.concat(this.ids.SR_ASSISTANCE,'" style="display:none;">').concat(g(t.srAssistiveText),"</p>")),s.push("</div>"),this.element.insertAdjacentHTML("afterend",s.join(""))},t.prototype.destroy=function(){var t=this;this.label&&this.label[p]&&(this.label.setAttribute("for",this.label[p]),delete this.label[p]),this.documentClickBound&&document.removeEventListener("click",this.documentClick),this.autoGrow&&this.inputAutoWidth&&this.inputAutoWidth.destroy(),this.wrapper.parentNode.removeChild(this.wrapper),delete this.element[c],this.show(this.element),clearTimeout(this.filterTimer),clearTimeout(this.pollingTimer),clearTimeout(this.showAllPrepTimer),clearTimeout(this.announcementTimer),clearTimeout(this.componentBlurTimer),clearTimeout(this.clearAnnouncementTimer),clearTimeout(this.elementChangeEventTimer),["list","input","label","element","wrapper","showAll","deleteAll","srAssistance","srAnnouncements"].forEach((function(e){return t[e]=null}))},t.prototype.init=function(t,e){this.selected=[],this.element=t,this.label=document.querySelector('[for="'+this.element.id+'"]'),this.ids=new b(this.element.id,this.label?this.label.id:null,e.id),this.elementIsInput="INPUT"===t.nodeName,this.options=new a(e),this.label&&!this.label.id&&(this.label.id=this.ids.LABEL),this.source=this.options.source,this.multiple=this.options.multiple,this.autoGrow=this.options.autoGrow,this.cssNameSpace=this.options.cssNameSpace,this.documentClick=this.handleComponentBlur.bind(this),this.setHtml(),this.list=document.getElementById(this.ids.LIST),this.input=document.getElementById(this.ids.INPUT),this.wrapper=document.getElementById(this.ids.WRAPPER),this.showAll=document.getElementById(this.ids.BUTTON),this.srAssistance=document.getElementById(this.ids.SR_ASSISTANCE),this.srAnnouncements=document.getElementById(this.ids.SR_ANNOUNCEMENTS),this.prepListSource();var i=[];this.options.showAllControl&&i.push("".concat(this.cssNameSpace,"__wrapper--show-all")),this.autoGrow&&i.push("".concat(this.cssNameSpace,"__wrapper--autogrow")),this.multiple&&i.push("".concat(this.cssNameSpace,"__wrapper--multiple")),i.length&&l(this.wrapper,i.join(" ")),this.hide(this.list),this.hide(this.element),this.setInputStartingStates(),this.bindEvents(),this.api=new m(this),this.triggerOptionCallback("onReady",[this.wrapper])},t}(),k=P;function F(t,e){return t&&t[c]&&t[c].open?t[c]:new k(t,e).api}var D=F}(),s}()}));

@@ -67,2 +67,6 @@ export interface IAriaAutocompleteOptions {

filter(value: string): void;
setOption<K extends keyof IAriaAutocompleteOptions>(
option: K,
value: IAriaAutocompleteOptions[K]
): void;
delete(entry?: any): void;

@@ -69,0 +73,0 @@ deleteAll(): void;

{
"name": "aria-autocomplete",
"version": "1.5.0",
"version": "1.5.1",
"description": "Accessible, extensible, JavaScript autocomplete with multi-select",

@@ -55,7 +55,7 @@ "main": "dist/aria-autocomplete.min.js",

"devDependencies": {
"less": "^4.1.3",
"ts-loader": "^9.4.2",
"typescript": "^4.9.5",
"webpack": "^5.75.0",
"webpack-cli": "^5.0.1"
"less": "^4.2.0",
"ts-loader": "^9.5.1",
"typescript": "^5.3.3",
"webpack": "^5.89.0",
"webpack-cli": "^5.1.4"
},

@@ -62,0 +62,0 @@ "dependencies": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc