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.0.0 to 1.1.0

CHANGELOG.md

15

dist/aria-autocomplete.min.js

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

parcelRequire=function(e,r,t,n){var i,o="function"==typeof parcelRequire&&parcelRequire,u="function"==typeof require&&require;function f(t,n){if(!r[t]){if(!e[t]){var i="function"==typeof parcelRequire&&parcelRequire;if(!n&&i)return i(t,!0);if(o)return o(t,!0);if(u&&"string"==typeof t)return u(t);var c=new Error("Cannot find module '"+t+"'");throw c.code="MODULE_NOT_FOUND",c}p.resolve=function(r){return e[t][1][r]||r},p.cache={};var l=r[t]=new f.Module(t);e[t][0].call(l.exports,p,l,l.exports,this)}return r[t].exports;function p(e){return f(p.resolve(e))}}f.isParcelRequire=!0,f.Module=function(e){this.id=e,this.bundle=f,this.exports={}},f.modules=e,f.cache=r,f.parent=o,f.register=function(r,t){e[r]=[function(e,r){r.exports=t},{}]};for(var c=0;c<t.length;c++)try{f(t[c])}catch(e){i||(i=e)}if(t.length){var l=f(t[t.length-1]);"object"==typeof exports&&"undefined"!=typeof module?module.exports=l:"function"==typeof define&&define.amd?define(function(){return l}):n&&(this[n]=l)}if(parcelRequire=f,i)throw i;return f}({"diFG":[function(require,module,exports) {
"use strict";function e(e){return e>=48&&e<=57||e>=65&&e<=90||e>=96&&e<=111||e>=186&&e<=222||32===e||8===e||46===e}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=e;
},{}],"AEQi":[function(require,module,exports) {
var define;
var t;parcelRequire=function(e,n,i,r){var o,s="function"==typeof parcelRequire&&parcelRequire,a="function"==typeof require&&require;function u(t,i){if(!n[t]){if(!e[t]){var r="function"==typeof parcelRequire&&parcelRequire;if(!i&&r)return r(t,!0);if(s)return s(t,!0);if(a&&"string"==typeof t)return a(t);var o=new Error("Cannot find module '"+t+"'");throw o.code="MODULE_NOT_FOUND",o}h.resolve=function(n){return e[t][1][n]||n},h.cache={};var c=n[t]=new u.Module(t);e[t][0].call(c.exports,h,c,c.exports,this)}return n[t].exports;function h(t){return u(h.resolve(t))}}u.isParcelRequire=!0,u.Module=function(t){this.id=t,this.bundle=u,this.exports={}},u.modules=e,u.cache=n,u.parent=s,u.register=function(t,n){e[t]=[function(t,e){e.exports=n},{}]};for(var c=0;c<i.length;c++)try{u(i[c])}catch(e){o||(o=e)}if(i.length){var h=u(i[i.length-1]);"object"==typeof exports&&"undefined"!=typeof module?module.exports=h:"function"==typeof t&&t.amd&&t(function(){return h})}if(parcelRequire=u,o)throw o;return u}({vL70:[function(t,e,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.default=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}},{}],Focm:[function(t,e,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var i,r=function(t){return t&&t.__esModule?t:{default:t}}(t("is-printable-keycode"));function o(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}function s(t,e){if(t)for(var n in e){var i="number"==typeof e[n]?e[n]+"px":e[n];t.style[n]=i+""}}var a=function(){function t(e,n){(function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")})(this,t),this.options=n,this.input=e,this.eventHandler,this.currentWidth,this.cache={},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 function(t,e,n){e&&o(t.prototype,e),n&&o(t,n)}(t,[{key:"measureString",value:function(t){return t?this.cache&&"number"==typeof this.cache[t]?this.cache[t]:(i||(s(i=document.createElement("span"),{position:"absolute",top:-99999,left:-99999,width:"auto",padding:0,whiteSpace:"pre"}),document.body.appendChild(i)),i.textContent=t,function(t,e,n){if(t&&e){var i=getComputedStyle(t),r={};if(n&&n.length)for(var o=0,a=n.length;o<a;o+=1)r[n[o]]=i[n[o]];else r=i;s(e,r)}}(this.input,i,["letterSpacing","fontSize","fontFamily","fontWeight","textTransform"]),i.offsetWidth||i.clientWidth):0}},{key:"trigger",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!t.metaKey&&!t.altKey){var e,n=this.input.value;if(t.type&&"keydown"===t.type.toLowerCase()){var i=t.keyCode,o=46===i,s=8===i;if(o||s){var a=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 n=document.selection.createRange(),i=n.text.length;n.moveStart("character",-t.value.length),e.start=n.text.length-i,e.length=i}return e}(this.input);a.length?n=n.substring(0,a.start)+n.substring(a.start+a.length):s&&a.start?n=n.substring(0,a.start-1)+n.substring(a.start+1):o&&void 0!==a.start&&(n=n.substring(0,a.start)+n.substring(a.start+1))}else if((0,r.default)(i)){var u=String.fromCharCode(i);n+=u=t.shiftKey?u.toUpperCase():u.toLowerCase()}}!n&&(e=this.input.getAttribute("placeholder"))&&(n=e);var c=this.measureString(n)+4;this.options&&this.options.cache&&this.cache&&(this.cache[n]=c);var h=this.options&&this.options.minWidth;"number"==typeof h&&c<h&&(c=h);var l=this.options&&this.options.maxWidth;"number"==typeof l&&c>l&&(c=l),c!==this.currentWidth&&(this.currentWidth=c,this.input.style.width="".concat(c,"px"))}}},{key:"destroy",value: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}();n.default=a},{"is-printable-keycode":"vL70"}]},{},["Focm"]);
},{}],"MBeS":[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.trimString=r,exports.hasClass=a,exports.addClass=o,exports.removeClass=i,exports.cleanString=v,exports.mergeObjects=f,exports.dispatchEvent=p,exports.setElementState=g,exports.processSourceArray=h,exports.searchVarPropsFor=E,exports.removeDuplicatesAndLabel=m,exports.SELECTED_OPTION_PROP=exports.CLEANED_LABEL_PROP=void 0;var e="_ariaAutocompleteCleanedLabel";exports.CLEANED_LABEL_PROP=e;var t="_ariaAutocompleteSelectedOption";function r(e){return null==e?"":(e+"").trim()}exports.SELECTED_OPTION_PROP=t;var n=function(e){return e.getAttribute&&e.getAttribute("class")||""};function a(e,t){return" ".concat(n(e)," ").indexOf(" ".concat(t," "))>-1}function o(e,t){for(var r=n(e),a=" ".concat(r," "),o="",i=0,l=t.split(" "),s=l.length;i<s;i+=1)""!==l[i]&&-1===a.indexOf(" ".concat(l[i]," "))&&(o+=" "+l[i]);r!==(o=(r+o).trim())&&e.setAttribute("class",o)}function i(e,t){for(var r=n(e),a=" ".concat(r," "),o=0,i=t.split(" "),l=i.length;o<l;o+=1)a=a.replace(" ".concat(i[o]," ")," ");r!==(a=a.trim())&&e.setAttribute("class",a)}var l=/&/g,s=/\s\s+/g,c=/[\u2018\u2019',:\u2013-]/g,u=/[\-\[\]{}()*+?.,\\\^$|#\s]/g;function v(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return e=r(e).toLowerCase().replace(c,"").replace(l,"and").replace(s," "),t&&(e=e.replace(u,"\\$&")),e}function f(){for(var e={},t=0,r=arguments.length;t<r;t+=1){var n=t<0||arguments.length<=t?void 0:arguments[t];for(var a in n)n.hasOwnProperty(a)&&void 0!==n[a]&&(e[a]=n[a])}return e}function p(e,t){if("createEvent"in document){var r=document.createEvent("HTMLEvents");r.initEvent(t,!0,!0),e.dispatchEvent(r)}else e.fireEvent("on"+t)}function g(e,t,r){t=!!t,e&&("INPUT"===e.nodeName&&"boolean"==typeof e.checked&&e.checked!==t&&(e.checked=t,p(e,"change")),"OPTION"===e.nodeName&&e.selected!==t&&(e.selected=t,r.elementChangeEventTimer&&clearTimeout(r.elementChangeEventTimer),r.elementChangeEventTimer=setTimeout(function(){p(e.closest("select"),"change")},1)))}function h(t){for(var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=arguments.length>2?arguments[2]:void 0,a=[],o=r.value,i=r.label,l=0,s=t.length;l<s;l+=1){var c={},u=t[l];if("string"==typeof u)c.value=c.label=u;else{var p=(c=f(u))[o]||c.value||c.label,g=c[i]||c.label||c.value;c.value=(p||"").toString(),c.label=(g||"").toString()}!1!==n&&(c[e]=v(c.label)),a.push(c)}return a}var d=function t(r,n,a){if("string"==typeof r)return a!==e&&(r=v(r,!1)),-1!==r.search(n);if(Array.isArray(r))for(var o=0,i=r.length;o<i;o+=1)if(t(r[o],n))return!0;return!1};function E(e,t,r){var n=arguments.length>3&&void 0!==arguments[3]&&arguments[3];for(var a in n&&(r=v(r,!0)),e)if(e.hasOwnProperty(a)){var o=!1;if("string"==typeof e[a]){for(var i=t.length;i--;)if(t[i]===a){o=!0;break}}else o=Array.isArray(e[a]);if(o&&d(e[a],r,a))return!0}return!1}function m(e){for(var t=[],n=0,a=e.length;n<a;n+=1)if("string"==typeof e[n]){for(var o=r(e[n]),i="label"!==o,l=t.length;i&&l--;)t[l]===o&&(i=!1);i&&t.push(o)}return t}
},{}],"vPu2":[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e={name:"",source:"",sourceMapping:{},alsoSearchIn:[],delay:100,minLength:1,maxResults:9999,showAllControl:!1,confirmOnBlur:!0,multiple:!1,autoGrow:!1,maxItems:9999,multipleSeparator:",",deleteOnBackspace:!1,asyncQueryParam:"q",asyncMaxResultsParam:"limit",placeholder:"",noResultsText:"No results",cssNameSpace:"aria-autocomplete",listClassName:"",inputClassName:"",wrapperClassName:"",srDeleteText:"delete",srDeletedText:"deleted",srShowAllText:"Show all",srSelectedText:"selected",srListLabelText:"Search suggestions",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.",srResultsText:function(e){return"".concat(e," ").concat(1===e?"result":"results"," available.")},onSearch:void 0,onAsyncPrep:void 0,onAsyncSuccess:void 0,onResponse:void 0,onItemRender:void 0,onConfirm:void 0,onDelete:void 0,onReady:void 0,onClose:void 0,onOpen:void 0};exports.default=e;
},{}],"GbHv":[function(require,module,exports) {
"use strict";function e(e){var t=e.Element.prototype;"function"!=typeof t.matches&&(t.matches=t.msMatchesSelector||t.mozMatchesSelector||t.webkitMatchesSelector||function(e){for(var t=(this.document||this.ownerDocument).querySelectorAll(e),o=0;t[o]&&t[o]!==this;)++o;return Boolean(t[o])}),"function"!=typeof t.closest&&(t.closest=function(e){for(var t=this;t&&1===t.nodeType;){if(t.matches(e))return t;t=t.parentNode}return null})}Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var t=e;exports.default=t;
},{}],"c8cM":[function(require,module,exports) {
"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.default=void 0;var e=l(require("is-printable-keycode")),t=l(require("input-autowidth")),i=require("./autocomplete-helpers"),s=l(require("./default-options")),n=l(require("element-closest"));function l(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t){for(var i=0;i<t.length;i++){var s=t[i];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,s.key,s)}}function o(e,t,i){return t&&a(e.prototype,t),i&&a(e,i),e}(0,n.default)(window);var c=0,h=function(){function n(e,t){if(r(this,n),e){if(e.ariaAutocomplete&&e.ariaAutocomplete.open)return{api:e.ariaAutocomplete};this.list,this.input,this.wrapper,this.showAll,this.srAnnouncements,this.ids,this.xhr,this.term,this.source,this.menuOpen,this.multiple,this.selected,this.disabled,this.autoGrow,this.filtering,this.cssNameSpace,this.forceShowAll,this.filteredSource,this.currentListHtml,this.inputPollingValue,this.currentSelectedIndex,this.documentClick,this.documentClickBound,this.filterTimer,this.pollingTimer,this.announcementTimer,this.componentBlurTimer,this.elementChangeEventTimer,this.inputAutoWidth,this.init(e,t)}}return o(n,[{key:"triggerOptionCallback",value:function(e,t,i){if(i=void 0===i?this.api:i,"function"==typeof this.options[e])return this.options[e].apply(i,t)}},{key:"show",value:function(e){if(void 0!==e){var t="".concat(this.cssNameSpace,"--hide hide hidden");return(0,i.removeClass)(e,t),e.removeAttribute("hidden")}if(this.input.setAttribute("aria-expanded","true"),this.showAll){var s=(!!this.forceShowAll).toString();this.showAll.setAttribute("aria-expanded",s)}this.menuOpen||(this.show(this.list),this.menuOpen=!0,this.triggerOptionCallback("onOpen",[this.list]),this.documentClickBound||(this.documentClickBound=!0,document.addEventListener("click",this.documentClick)))}},{key:"hide",value:function(e){if(void 0!==e)return(0,i.addClass)(e,"".concat(this.cssNameSpace,"--hide hide hidden")),e.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]))}},{key:"enable",value:function(){if(this.disabled){this.disabled=!1,this.input.disabled=!1;var e=this.cssNameSpace;(0,i.removeClass)(this.input,"".concat(e,"__input--disabled disabled")),(0,i.removeClass)(this.wrapper,"".concat(e,"__wrapper--disabled disabled")),this.showAll&&(this.showAll.setAttribute("tabindex","0"),(0,i.removeClass)(this.showAll,"".concat(e,"__show-all--disabled disabled")))}}},{key:"disable",value:function(){if(!this.disabled){this.disabled=!0,this.input.disabled=!0;var e=this.cssNameSpace;(0,i.addClass)(this.input,"".concat(e,"__input--disabled disabled")),(0,i.addClass)(this.wrapper,"".concat(e,"__wrapper--disabled disabled")),this.showAll&&(this.showAll.setAttribute("tabindex","-1"),(0,i.addClass)(this.showAll,"".concat(e,"__show-all--disabled disabled")))}}},{key:"setInputValue",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.input.value=this.term=e,t&&(this.inputPollingValue=e),this.autoGrow&&this.inputAutoWidth&&this.inputAutoWidth.trigger()}},{key:"indexOfQueryIn",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.input.value,s=arguments.length>2?arguments[2]:void 0;if(t=(0,i.trimString)(t).toLowerCase()){s=s||"label";for(var n=0,l=e.length;n<l;n+=1)if((0,i.trimString)(e[n][s]).toLowerCase()===t)return n}return-1}},{key:"announce",value:function(e,t){var i=this;if(e&&this.srAnnouncements){if(0===t)return this.srAnnouncements.textContent=e;t="number"==typeof t?t:400,this.announcementTimer&&clearTimeout(this.announcementTimer),this.announcementTimer=setTimeout(function(){i.srAnnouncements.textContent=e},t)}}},{key:"isSelectedElem",value:function(e){return this.multiple&&e[i.SELECTED_OPTION_PROP]&&(0,i.hasClass)(e,"".concat(this.cssNameSpace,"__selected"))}},{key:"getSelectedElems",value:function(){for(var e=this.wrapper.childNodes,t=[],i=0,s=e.length;i<s;i+=1)this.isSelectedElem(e[i])&&t.push(e[i]);return t}},{key:"removeEntryFromSelected",value:function(e){var t=this.selected.indexOf(e);if(-1===t)for(var s=0,n=this.selected.length;s<n;s+=1)if(this.selected[s].value===e.value){t=s;break}if(t>-1&&this.selected[t]){var l=(0,i.mergeObjects)(this.selected[t]),r=l.label;(0,i.setElementState)(l.element,!1,this),this.selected.splice(t,1),this.triggerOptionCallback("onDelete",[l]),this.setSourceElementValues(),this.buildMultiSelected(),this.announce("".concat(r," ").concat(this.options.srDeletedText),0)}}},{key:"buildMultiSelected",value:function(){if(this.multiple){this.multiple&&this.selected.length>=this.options.maxItems?this.disable():this.enable();var e=this.getSelectedElems();if(this.selected.length||e.length){for(var t=[],s=e.length;s--;){for(var n=e[s][i.SELECTED_OPTION_PROP],l=this.selected.length,r=!1;l--;){var a=this.selected[l];if(a===n||a.value===n.value){r=!0;break}}r?t.push(e[s]):this.wrapper.removeChild(e[s])}for(var o=this.options.srDeleteText,c=document.createDocumentFragment(),h="".concat(this.cssNameSpace,"__selected"),u=0,d=this.selected.length;u<d;u+=1){for(var p=this.selected[u],m=t.length,f=!1;m--;){var v=t[m][i.SELECTED_OPTION_PROP];if(v===p||v.value===p.value){f=!0;break}}if(!f){var g=p.label,S=document.createElement("span");S.setAttribute("tabindex","0"),S.setAttribute("role","button"),S.setAttribute("class",h),S.setAttribute("aria-label",o+" "+g),S[i.SELECTED_OPTION_PROP]=p,S.textContent=g,c.appendChild(S)}}c.childNodes&&c.childNodes.length&&this.wrapper.insertBefore(c,this.list);for(var b=[],y=this.getSelectedElems(),A=0,w=y.length;A<w;A+=1){var E="".concat(this.ids.OPTION_SELECTED,"-").concat(A);y[A].setAttribute("id",E),b.push(E)}if(b.push(this.ids.LIST),this.input.setAttribute("aria-owns",b.join(" ")),this.autoGrow&&this.options.placeholder){var O=this.selected.length?"":this.options.placeholder;this.input.setAttribute("placeholder",O)}}}}},{key:"setInputDescription",value:function(){var e=this.input.getAttribute("aria-describedby"),t=(0,i.trimString)(e||""),s=t.replace(this.ids.SR_ASSISTANCE,"");0===this.input.value.length&&(s=s+" "+this.ids.SR_ASSISTANCE),(s=(0,i.trimString)(s))?s!==t&&this.input.setAttribute("aria-describedby",s):e&&this.input.removeAttribute("aria-describedby")}},{key:"resetOptionAttributes",value:function(){for(var e=this.cssNameSpace,t=this.list.childNodes,s=t.length;s--;)(0,i.removeClass)(t[s],"".concat(e,"__option--focused focused focus")),t[s].setAttribute("aria-selected","false")}},{key:"setOptionFocus",value:function(e,t){this.resetOptionAttributes();var s=this.list.childNodes;if(t<0||!s||!s.length)return this.currentSelectedIndex=-1,void(e&&e.target!==this.input&&this.input.focus());if(t>=s.length)return this.currentSelectedIndex=s.length-1,void this.setOptionFocus(e,this.currentSelectedIndex);var n=s[t];if(n&&"string"==typeof n.getAttribute("tabindex")){this.currentSelectedIndex=t;var l="".concat(this.cssNameSpace,"__option--focused focused focus");return(0,i.addClass)(n,l),n.setAttribute("aria-selected","true"),void n.focus()}this.currentSelectedIndex=-1}},{key:"setSourceElementValues",value:function(){for(var e=[],t=0,s=this.selected.length;t<s;t+=1){var n=this.selected[t];e.push(n.value),(0,i.setElementState)(n.element,!0,this)}if(this.elementIsInput){var l=e.join(this.options.multipleSeparator);l!==this.element.value&&(this.element.value=l,(0,i.dispatchEvent)(this.element,"change"))}!this.selected.length&&this.elementIsSelect&&(this.element.value="")}},{key:"handleOptionSelect",value:function(e,t){var s=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];if(!("number"!=typeof t||t<0||this.multiple&&this.selected.length>=this.options.maxItems)&&this.filteredSource.length&&this.filteredSource[t]){for(var n=(0,i.mergeObjects)(this.filteredSource[t]),l=this.selected.length,r=!1;l--;)if(this.selected[l].value===n.value){r=!0;break}this.setInputValue(this.multiple?"":n.label,!0),r||this.multiple||(this.selected=[]),r||(this.selected.push(n),this.setSourceElementValues(),this.buildMultiSelected()),this.triggerOptionCallback("onConfirm",[n]),this.announce("".concat(n.label," ").concat(this.options.srSelectedText),0),this.disabled||!1===s||this.input.focus(),this.hide()}}},{key:"removeSelectedFromResults",value:function(e){if(!this.multiple||!this.selected.length)return e;var t=[];e:for(var i=0,s=e.length;i<s;i+=1){for(var n=this.selected,l=e[i],r=0,a=n.length;r<a;r+=1){if(l.label===n[r].label&&l.value===n[r].value)continue e}t.push(l)}return t}},{key:"setListOptions",value:function(e){var t=[],s=this.options.sourceMapping,n=this.removeSelectedFromResults(e),l=this.triggerOptionCallback("onResponse",n);this.filteredSource=l?(0,i.processSourceArray)(l,s):n;for(var r,a=this.ids.OPTION,o=this.cssNameSpace,c=this.filteredSource.length,h="function"==typeof this.options.onItemRender,u=this.forceShowAll?9999:this.options.maxResults,d=0;d<c&&d<u;d+=1){var p=this.filteredSource[d],m=h&&this.triggerOptionCallback("onItemRender",[p])||p.label;t.push('<li tabindex="-1" aria-selected="false" role="option" class="'.concat(o,'__option" ')+'id="'.concat(a,"--").concat(d,'" aria-posinset="').concat(d+1,'" ')+'aria-setsize="'.concat(c,'">').concat(m,"</li>"))}t.length?((0,i.addClass)(this.list,"".concat(o,"__list--has-results")),(0,i.removeClass)(this.list,"".concat(o,"__list--no-results"))):((0,i.removeClass)(this.list,"".concat(o,"__list--has-results")),(0,i.addClass)(this.list,"".concat(o,"__list--no-results")));var f=this.options.noResultsText;if(!t.length&&"string"==typeof f&&f.length){r=f;var v="".concat(o,"__option");t.push('<li class="'.concat(v," ").concat(v,'--no-results">').concat(f,"</li>"))}this.cancelFilterPrep(),r||(r=this.triggerOptionCallback("srResultsText",[c])),this.announce(r);var g=t.join("");if(this.currentListHtml!==g?(this.currentListHtml=g,this.list.innerHTML=g):this.resetOptionAttributes(),!t.length)return this.hide(),void(this.forceShowAll=!1);this.show(),this.forceShowAll=!1}},{key:"handleAsync",value:function(e){var t=this,s=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.xhr&&this.xhr.abort();var n=new XMLHttpRequest,l=encodeURIComponent,r=this.forceShowAll,a=r||s,o=s?null:this.api,c=this.multiple?this.selected.length:0,h=/\?/.test(this.source)?"&":"?",u=this.source+h+"".concat(l(this.options.asyncQueryParam),"=").concat(l(e),"&")+"".concat(l(this.options.asyncMaxResultsParam),"=")+"".concat(a?9999:c+this.options.maxResults);u=this.triggerOptionCallback("onAsyncPrep",[u],o)||u,n.open("GET",u),n.onload=function(){if(n.readyState===n.DONE&&200===n.status){t.forceShowAll=r;var l=t.triggerOptionCallback("onAsyncSuccess",[e,n],o),a=t.options.sourceMapping,c=l||n.responseText,h=(0,i.processSourceArray)(c,a,!1);s?(t.prepSelectedFromArray(h),t.setInputStartingStates(!1)):t.setListOptions(h)}},s||(this.xhr=n),n.send()}},{key:"filter",value:function(e){var t=this;if("string"==typeof e){var s=this.forceShowAll,n=this.triggerOptionCallback("onSearch",[e]);if(s||"string"!=typeof n||(e=n),this.term=this.inputPollingValue=e,"string"==typeof this.source&&this.source.length)return this.handleAsync(e),void(this.forceShowAll=!1);if("function"!=typeof this.source){e||(s=!0);var l=[];if(this.source&&this.source.length){var r=[i.CLEANED_LABEL_PROP];if(!s){e=(0,i.cleanString)(e,!0);var a=this.options.alsoSearchIn;Array.isArray(a)&&a.length&&(r=(0,i.removeDuplicatesAndLabel)(r.concat(a)))}for(var o=0,c=this.source.length;o<c;o+=1){var h=this.source[o];(s||(0,i.searchVarPropsFor)(h,r,e))&&l.push(h)}}this.setListOptions(l)}else this.source.call(this.api,this.term,function(e){var s=t.options.sourceMapping,n=(0,i.processSourceArray)(e,s);t.setListOptions(n)})}else this.cancelFilterPrep()}},{key:"cancelFilterPrep",value:function(){this.filterTimer&&clearTimeout(this.filterTimer);var e=this.cssNameSpace;(0,i.removeClass)(this.wrapper,"".concat(e,"__wrapper--loading loading")),(0,i.removeClass)(this.input,"".concat(e,"__input--loading loading")),this.filtering=!1}},{key:"filterPrep",value:function(e){var t=this,s=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],l=this.forceShowAll,r=l||n?0:this.options.delay;this.cancelFilterPrep(),this.filtering=!0,this.filterTimer=setTimeout(function(){var n=t.input.value;if((l||""===n||s&&!t.multiple&&t.selected.length&&(0,i.trimString)(t.selected[0].label)===(0,i.trimString)(n))&&(n=""),t.setInputDescription(),t.inputPollingValue=n,!l&&n.length<t.options.minLength)t.hide();else{var r;try{r=e&&"keydown"===e.type&&(e.altKey||e.ctrlKey||e.metaKey)}catch(e){}var a=""!==n&&n===t.term;if(!a||a&&!t.menuOpen&&!r){var o=t.cssNameSpace;(0,i.addClass)(t.wrapper,"".concat(o,"__wrapper--loading loading")),(0,i.addClass)(t.input,"".concat(o,"__input--loading loading")),t.currentSelectedIndex=-1,t.filter(n)}}},r)}},{key:"filterPrepShowAll",value:function(e){var t=this;this.disabled||(this.showAllPrepTimer&&clearTimeout(this.showAllPrepTimer),this.showAllPrepTimer=setTimeout(function(){t.componentBlurTimer&&clearTimeout(t.componentBlurTimer),e.preventDefault(),t.forceShowAll=!0,t.filterPrep(e,!1,!0)}))}},{key:"handleComponentBlur",value:function(e){var t=this,s=arguments.length>1&&void 0!==arguments[1]&&arguments[1];this.componentBlurTimer&&clearTimeout(this.componentBlurTimer);var n=s?0:100;this.componentBlurTimer=setTimeout(function(){var e=document.activeElement;if(s||!e||t.showAll&&t.showAll===e||e[i.SELECTED_OPTION_PROP]||!t.wrapper.contains(e)){t.xhr&&t.xhr.abort();var n=t.indexOfQueryIn.bind(t);if(!s&&t.options.confirmOnBlur&&t.menuOpen){var l=t.currentSelectedIndex;"number"==typeof l&&-1!==l||(l=n(t.filteredSource)),t.handleOptionSelect({},l,!1)}if(t.cancelFilterPrep(),t.hide(),!t.multiple&&-1===n(t.selected))(t.elementIsInput||t.elementIsSelect)&&""!==t.element.value&&(t.element.value="",(0,i.dispatchEvent)(t.element,"change")),t.selected.length&&t.removeEntryFromSelected(t.selected[0]),t.setInputValue("",!0);t.multiple&&t.setInputValue("",!0),t.documentClickBound&&(t.documentClickBound=!1,document.removeEventListener("click",t.documentClick))}},n)}},{key:"handleEnterKey",value:function(e){if(this.isSelectedElem(e.target)){var t=e.target[i.SELECTED_OPTION_PROP];return this.removeEntryFromSelected(t)}this.disabled||(this.showAll&&e.target===this.showAll?this.filterPrepShowAll(e):(this.menuOpen&&(e.preventDefault(),this.currentSelectedIndex>-1&&this.handleOptionSelect(e,this.currentSelectedIndex)),e.target===this.input&&this.filterPrep(e,!1,!0)))}},{key:"handleDownArrowKey",value:function(e){if(e.preventDefault(),this.menuOpen||(this.forceShowAll=this.options.minLength<1,(this.forceShowAll||this.input.value.length>=this.options.minLength)&&this.filterPrep(e)),this.menuOpen&&!this.filtering){var t=this.currentSelectedIndex;"number"!=typeof t||t<0?this.setOptionFocus(e,0):this.setOptionFocus(e,t+1)}}},{key:"handleUpArrowKey",value:function(e){e.preventDefault(),!this.disabled&&this.menuOpen&&"number"==typeof this.currentSelectedIndex&&this.setOptionFocus(e,this.currentSelectedIndex-1)}},{key:"handleKeyDownDefault",value:function(t){var i=t.target===this.input;if(32===t.keyCode&&!i)return t.preventDefault(),this.handleEnterKey(t);if(!this.disabled){var s=this.selected&&this.selected.length;if(this.options.deleteOnBackspace&&""===this.input.value&&8===t.keyCode&&s&&i&&this.multiple)this.removeEntryFromSelected(this.selected[s-1]);else{var n=(0,e.default)(t.keyCode),l=!i&&n;l&&this.input.focus(),(l||i&&n)&&this.filterPrep(t)}}}},{key:"prepKeyDown",value:function(e){switch(e.keyCode){case 13:this.handleEnterKey(e);break;case 27:this.handleComponentBlur(e,!0);break;case 38:this.handleUpArrowKey(e);break;case 40:this.handleDownArrowKey(e);break;default:this.handleKeyDownDefault(e)}}},{key:"cancelPolling",value:function(){this.pollingTimer&&clearTimeout(this.pollingTimer)}},{key:"startPolling",value:function(){var e=this;this.filtering||this.input.value===this.inputPollingValue||this.filterPrep({}),this.pollingTimer=setTimeout(function(){e.startPolling()},200)}},{key:"bindEvents",value:function(){var e=this;this.wrapper.addEventListener("focusout",function(t){e.handleComponentBlur(t,!1)}),this.wrapper.addEventListener("focusin",function(t){e.list.contains(t.target)||(e.currentSelectedIndex=-1)}),this.wrapper.addEventListener("keydown",function(t){e.prepKeyDown(t)}),this.wrapper.addEventListener("click",function(t){if(t.target!==e.wrapper){if(e.isSelectedElem(t.target)){var s=t.target[i.SELECTED_OPTION_PROP];e.removeEntryFromSelected(s)}}else e.input.focus()});var s="".concat(this.cssNameSpace,"__wrapper--focused focused focus"),n="".concat(this.cssNameSpace,"__input--focused focused focus");this.input.addEventListener("blur",function(){(0,i.removeClass)(e.wrapper,s),(0,i.removeClass)(e.input,n),e.cancelPolling()}),this.input.addEventListener("input",function(t){e.filterPrep(t)}),this.input.addEventListener("click",function(t){!e.menuOpen&&e.input.value.length>=e.options.minLength&&e.filterPrep(t,!0)}),this.input.addEventListener("focusin",function(){(0,i.addClass)(e.wrapper,s),(0,i.addClass)(e.input,n),e.startPolling(),e.disabled||e.menuOpen||e.filterPrep(event,!0)}),this.showAll&&this.showAll.addEventListener("click",function(t){e.filterPrepShowAll(t)}),this.list.addEventListener("mouseenter",function(t){e.resetOptionAttributes()}),this.list.addEventListener("click",function(t){if(t.target!==e.list){var i=e.list.childNodes;if(i.length){var s=[].indexOf.call(i,t.target);e.handleOptionSelect(t,s)}}}),this.autoGrow&&(this.inputAutoWidth=new t.default(this.input))}},{key:"prepListSourceCheckboxes",value:function(){this.multiple=!0,this.source=[];for(var e=this.element.querySelectorAll('input[type="checkbox"]'),t=0,s=e.length;t<s;t+=1){var n=e[t];if(n.value){var l={element:n,value:n.value},r=n.closest("label");!r&&n.id&&(r=document.querySelector('[for="'+n.id+'"]')),r&&(l.label=r.textContent),l.label||(l.label=l.value),l[i.CLEANED_LABEL_PROP]=(0,i.cleanString)(l.label),this.source.push(l),n.checked&&this.selected.push(l)}}}},{key:"prepListSourceDdl",value:function(){this.multiple=this.element.multiple,this.source=[];for(var e=this.element.querySelectorAll("option"),t=0,s=e.length;t<s;t+=1){var n=e[t];if(n.value){var l={element:n,value:n.value,label:n.textContent};l[i.CLEANED_LABEL_PROP]=(0,i.cleanString)(l.label),this.source.push(l),n.selected&&this.selected.push(l)}}}},{key:"prepSelectedFromArray",value:function(e){var t=this.elementIsInput&&this.element.value;if(t&&e&&e.length)for(var i=this.options.multiple,s=this.options.multipleSeparator,n=i?t.split(s):[t],l=0,r=n.length;l<r;l+=1){var a=n[l],o=this.indexOfQueryIn;if(!(o(this.selected,a,"value")>-1)){var c=o(e,a,"value");c>-1&&this.selected.push(e[c])}}}},{key:"prepListSourceArray",value:function(){var e=this.options.sourceMapping;this.source=(0,i.processSourceArray)(this.source,e),this.prepSelectedFromArray(this.source)}},{key:"prepListSourceAsync",value:function(){this.elementIsInput&&this.element.value&&this.handleAsync(this.element.value,!0)}},{key:"prepListSourceFunction",value:function(){var e=this;this.elementIsInput&&this.element.value&&this.source.call(void 0,this.element.value,function(t){e.prepSelectedFromArray((0,i.processSourceArray)(t,e.options.sourceMapping)),e.setInputStartingStates(!1)})}},{key:"prepListSource",value: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.elementIsSelect?this.prepListSourceDdl():void(this.element.querySelector('input[type="checkbox"]')&&this.prepListSourceCheckboxes())}},{key:"setInputStartingStates",value:function(){if(!(arguments.length>0&&void 0!==arguments[0])||arguments[0]){if(this.ids.ELEMENT){var e=document.querySelector('[for="'+this.ids.ELEMENT+'"]');e&&(e.ariaAutocompleteOriginalFor=this.ids.ELEMENT,e.setAttribute("for",this.ids.INPUT))}var t=this.element.getAttribute("aria-describedby");t&&this.input.setAttribute("aria-describedby",t);var i=this.element.getAttribute("aria-labelledby");i&&this.input.setAttribute("aria-labelledby",i)}this.selected.length&&(this.multiple?this.buildMultiSelected():this.setInputValue(this.selected[0].label||"",!0)),this.setInputDescription(),this.element.disabled&&this.disable()}},{key:"setHtml",value:function(){var e=this.options,t=this.cssNameSpace,i=e.wrapperClassName?" ".concat(e.wrapperClassName):"",s=['<div id="'.concat(this.ids.WRAPPER,'" class="').concat(t,"__wrapper").concat(i,'">')],n=e.name?" ".concat(e.name):"",l=e.inputClassName?" ".concat(e.inputClassName):"",r=e.placeholder?' placeholder="'.concat(e.placeholder,'" aria-placeholder="').concat(e.placeholder,'"'):"";s.push('<input type="text" autocomplete="off" aria-expanded="false" aria-autocomplete="list" '+'role="combobox" id="'.concat(this.ids.INPUT,'" aria-owns="').concat(this.ids.LIST,'" ')+'class="'.concat(t,"__input").concat(l,'"').concat(n).concat(r," />")),e.showAllControl&&s.push('<span role="button" aria-label="'.concat(e.srShowAllText,'" class="').concat(t,'__show-all" ')+'tabindex="0" id="'.concat(this.ids.BUTTON,'" aria-expanded="false"></span>'));var a=e.srListLabelText,o=e.listClassName?" ".concat(e.listClassName):"",c=a?' aria-label="'.concat(a,'"'):"";s.push('<ul id="'.concat(this.ids.LIST,'" class="').concat(t,"__list").concat(o,'" role="listbox" ')+'hidden="hidden"'.concat(c,"></ul>")),s.push('<span class="sr-only '.concat(t,"__sr-only ").concat(t,'__sr-assistance" ')+'id="'.concat(this.ids.SR_ASSISTANCE,'">').concat(e.srAssistiveText,"</span>")),s.push('<span class="sr-only '.concat(t,"__sr-only ").concat(t,'__sr-announcements" ')+'id="'.concat(this.ids.SR_ANNOUNCEMENTS,'" aria-live="polite" aria-atomic="true"></span>')),s.push("</div>"),this.element.insertAdjacentHTML("afterend",s.join(""))}},{key:"generateApi",value:function(){var e=this;this.api={open:function(){return e.show.call(e)},close:function(){return e.hide.call(e)},filter:function(t){return e.filter.call(t)}};for(var t=["options","destroy","enable","disable","input","wrapper","list","selected"],i=function(i,s){e.api[t[i]]="function"==typeof e[t[i]]?function(){return e[t[i]].call(e)}:e[t[i]]},s=0,n=t.length;s<n;s+=1)i(s);this.element.ariaAutocomplete=this.api}},{key:"destroy",value:function(){var e=document.querySelector('[for="'+this.ids.INPUT+'"]');for(var t in e&&e.ariaAutocompleteOriginalFor&&(e.setAttribute("for",e.ariaAutocompleteOriginalFor),delete e.ariaAutocompleteOriginalFor),this.documentClickBound&&document.removeEventListener("click",this.documentClick),this.autoGrow&&this.inputAutoWidth&&this.inputAutoWidth.destroy(),this.element.parentNode.removeChild(this.wrapper),delete this.element.ariaAutocomplete,this.show(this.element),this)this.hasOwnProperty(t)&&(this[t]=null)}},{key:"init",value:function(e,t){c+=1,this.ids={},this.ids.ELEMENT=e.id,this.ids.PREFIX="".concat(e.id||"","aria-autocomplete-").concat(c),this.ids.LIST="".concat(this.ids.PREFIX,"-list"),this.ids.INPUT="".concat(this.ids.PREFIX,"-input"),this.ids.BUTTON="".concat(this.ids.PREFIX,"-button"),this.ids.OPTION="".concat(this.ids.PREFIX,"-option"),this.ids.WRAPPER="".concat(this.ids.PREFIX,"-wrapper"),this.ids.OPTION_SELECTED="".concat(this.ids.OPTION,"-selected"),this.ids.SR_ASSISTANCE="".concat(this.ids.PREFIX,"-sr-assistance"),this.ids.SR_ANNOUNCEMENTS="".concat(this.ids.PREFIX,"-sr-announcements"),this.selected=[],this.element=e,this.elementIsInput="INPUT"===e.nodeName,this.elementIsSelect="SELECT"===e.nodeName,this.options=(0,i.mergeObjects)(s.default,t),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.srAnnouncements=document.getElementById(this.ids.SR_ANNOUNCEMENTS),this.prepListSource();var n="";this.options.showAllControl&&(n+=" ".concat(this.cssNameSpace,"__wrapper--show-all")),this.autoGrow&&(n+=" ".concat(this.cssNameSpace,"__wrapper--autogrow")),this.multiple&&(n+=" ".concat(this.cssNameSpace,"__wrapper--multiple")),n&&(0,i.addClass)(this.wrapper,n),this.hide(this.list),this.hide(this.element),this.generateApi(),this.setInputStartingStates(),this.bindEvents(),this.triggerOptionCallback("onReady",[this.wrapper])}}]),n}();window.AriaAutocomplete=function(e,t){return new h(e,t).api};var u=function(e,t){return new h(e,t).api};exports.default=u;
},{"is-printable-keycode":"diFG","input-autowidth":"AEQi","./autocomplete-helpers":"MBeS","./default-options":"vPu2","element-closest":"GbHv"}]},{},["c8cM"], null)
!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]}}(window,(function(){return 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=2)}([function(t,e,i){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 h=this.measureString(s)+4;this.options&&this.options.cache&&this.cache&&(this.cache[s]=h);var u=this.options&&this.options.minWidth;"number"==typeof u&&h<u&&(h=u);var c=this.options&&this.options.maxWidth;"number"==typeof c&&h>c&&(h=c),h!==this.currentWidth&&(this.currentWidth=h,this.input.style.width=h+"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}])},function(t,e){var i=Element.prototype;i.matches||(i.matches=i.msMatchesSelector||i.webkitMatchesSelector),i.closest||(i.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})},function(t,e,i){"use strict";i.r(e);var s=i(0),n=i.n(s),r=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;function o(t,e){if(t&&"number"==typeof t.length)for(var i=0,s=t.length;i<s;i+=1)o(t[i],e);else if(t&&t.nodeType){for(var n=t.getAttribute&&t.getAttribute("class")||"",l=" "+n+" ",a=0,h=e.split(" "),u=h.length;a<u;a+=1)l=l.replace(" "+h[a]+" "," ");n!==(l=null==(c=l)?"":(c+"").replace(r,""))&&t.setAttribute("class",l)}var c}var l=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;function a(t,e){if(t&&"number"==typeof t.length)for(var i=0,s=t.length;i<s;i+=1)a(t[i],e);else if(t&&t.nodeType){for(var n=t.getAttribute&&t.getAttribute("class")||"",r=" "+n+" ",o="",h=0,u=e.split(" "),c=u.length;h<c;h+=1)""!==u[h]&&-1===r.indexOf(" "+u[h]+" ")&&(o+=" "+u[h]);n!==(o=null==(p=n+o)?"":(p+"").replace(l,""))&&t.setAttribute("class",o)}var p}var h=function(t){for(var e in void 0===t&&(t={}),this.sourceMapping={},this.alsoSearchIn=[],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.asyncQueryParam="q",this.asyncMaxResultsParam="limit",this.noResultsText="No results",this.cssNameSpace="aria-autocomplete",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.srResultsText=function(t){return t+" "+(1===t?"result":"results")+" available."},t)t.hasOwnProperty(e)&&void 0!==t[e]&&(this[e]=t[e])},u="_ariaAutocompleteCleanedLabel",c="_ariaAutocompleteSelectedOption",p=8,d=13,f=27,m=32,v=35,b=36,y=38,g=40,S=46,A=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),t.element.ariaAutocomplete=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(){this.disable.call(this)},t.prototype.filter=function(t){this.filter.call(this,t)},t.prototype.destroy=function(){this.destroy.call(this)},t}(),w=0,E=function(t){w+=1,this.ELEMENT=t,this.PREFIX=(t||"")+"aria-autocomplete-"+w,this.LIST=this.PREFIX+"-list",this.INPUT=this.PREFIX+"-input",this.BUTTON=this.PREFIX+"-button",this.OPTION=this.PREFIX+"-option",this.WRAPPER=this.PREFIX+"-wrapper",this.SR_ASSISTANCE=this.PREFIX+"-sr-assistance",this.OPTION_SELECTED=this.PREFIX+"-option-selected",this.SR_ANNOUNCEMENTS=this.PREFIX+"-sr-announcements"};i(1);function x(t){return null==t?"":(t+"").trim()}var O=/&/g,T=/\s\s+/g,I=/[\u2018\u2019',:\u2013-]/g,_=/[\-\[\]{}()*+?.,\\\^$|#\s]/g;function C(t,e){return void 0===e&&(e=!1),t=x(t).toLowerCase().replace(I,"").replace(O,"and").replace(T," "),e&&(t=t.replace(_,"\\$&")),t}function L(){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 N(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 P(t){return t&&t.children?Array.prototype.slice.call(t.children):[]}function k(t,e,i){e=!!e,t&&("INPUT"===t.nodeName&&"checked"in t&&t.checked!==e&&(t.checked=e,N(t,"change")),"OPTION"===t.nodeName&&"selected"in t&&t.selected!==e&&(t.selected=e,i.elementChangeEventTimer&&clearTimeout(i.elementChangeEventTimer),i.elementChangeEventTimer=setTimeout((function(){N(t.closest("select"),"change")}),1)))}function F(t,e,i){void 0===e&&(e={}),void 0===i&&(i=!0);var s=[],n=e.value,r=e.label;return t.forEach((function(t){var e={};"string"==typeof t?e.value=e.label=t:((e=L(t)).value=(e[n]||e.value||e.label||"").toString(),e.label=(e[r]||e.label||e.value||"").toString()),!1!==i&&(e[u]=C(e.label)),s.push(e)})),s}function R(t,e,i){if("string"==typeof t)return function(t,e,i){return i!==u&&(t=C(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(R(t[s],e))return!0;return!1}var M=function(){function t(t,e){t&&this.init(t,e)}return t.prototype.triggerOptionCallback=function(t,e,i){if(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 o(t,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 a(t,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;o(this.input,t+"__input--disabled disabled"),o(this.wrapper,t+"__wrapper--disabled disabled"),this.showAll&&(this.showAll.setAttribute("tabindex","0"),o(this.showAll,t+"__show-all--disabled disabled"))}},t.prototype.disable=function(){if(!this.disabled){this.disabled=!0,this.input.disabled=!0;var t=this.cssNameSpace;a(this.input,t+"__input--disabled disabled"),a(this.wrapper,t+"__wrapper--disabled disabled"),this.showAll&&(this.showAll.setAttribute("tabindex","-1"),a(this.showAll,t+"__show-all--disabled disabled"))}},t.prototype.setInputValue=function(t,e){void 0===e&&(e=!1),this.input.value=this.term=t,e&&(this.inputPollingValue=t),this.autoGrow&&this.inputAutoWidth&&this.inputAutoWidth.trigger()},t.prototype.indexOfValueIn=function(t,e,i){if(void 0===e&&(e=this.input.value),void 0===i&&(i="label"),t.length&&(e=x(e).toLowerCase()))for(var s=0,n=t.length;s<n;s+=1)if(x(t[s][i]).toLowerCase()===e)return s;return-1},t.prototype.announce=function(t,e){var i=this;void 0===e&&(e=400),this.srAnnouncements&&t&&"string"==typeof t&&(0!==e?(clearTimeout(this.announcementTimer),this.announcementTimer=setTimeout((function(){i.srAnnouncements.textContent=t}),e)):this.srAnnouncements.textContent=t)},t.prototype.isSelectedElem=function(t){var e=t&&t[c];return this.multiple&&e&&"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.removeEntryFromSelected=function(t){var e=this.selected.indexOf(t);if(-1===e)for(var i=0,s=this.selected.length;i<s;i+=1)if(this.selected[i].value===t.value){e=i;break}if(e>-1&&this.selected[e]){var n=L(this.selected[e]),r=n.label;k(n.element,!1,this),this.selected.splice(e,1),this.triggerOptionCallback("onDelete",[n]),this.setSourceElementValues(),this.buildMultiSelected(),this.announce(r+" "+this.options.srDeletedText,0)}},t.prototype.createSelectElemFrom=function(t){var e=t.label,i=document.createElement("span");return i.setAttribute("aria-label",this.options.srDeleteText+" "+e),i.setAttribute("class",this.cssNameSpace+"__selected"),i.setAttribute("role","button"),i.setAttribute("tabindex","0"),i[c]=t,i.textContent=e,i},t.prototype.buildMultiSelected=function(){var t=this;if(this.multiple){this.multiple&&this.selected.length>=this.options.maxItems?this.disable():this.enable();var e=this.getSelectedElems();if(this.selected.length||e.length){var i=[];e.forEach((function(e){for(var s=e[c],n=0,r=t.selected.length;n<r;n+=1){var o=t.selected[n];if(o===s||o.value===s.value)return void i.push(e)}t.wrapper.removeChild(e)}));var s=document.createDocumentFragment();this.selected.forEach((function(e){for(var n=0,r=i.length;n<r;n+=1){var o=i[n][c];if(o===e||o.value===e.value)return}s.appendChild(t.createSelectElemFrom(e))})),s.childNodes&&s.childNodes.length&&this.wrapper.insertBefore(s,this.list);var n=this.getSelectedElems().map((function(e,i){var s=t.ids.OPTION_SELECTED+"-"+i;return e.setAttribute("id",s),s}));n.push(this.ids.LIST),this.input.setAttribute("aria-owns",n.join(" ")),this.autoGrow&&this.selected.length?this.input.removeAttribute("placeholder"):this.options.placeholder&&this.input.setAttribute("placeholder",this.options.placeholder)}}},t.prototype.setInputDescription=function(){var t=this.input.getAttribute("aria-describedby"),e=x(t),i=e.replace(this.ids.SR_ASSISTANCE,"");this.input.value.length||(i=i+" "+this.ids.SR_ASSISTANCE),(i=x(i))?i!==e&&this.input.setAttribute("aria-describedby",i):t&&this.input.removeAttribute("aria-describedby")},t.prototype.resetOptionAttributes=function(t){void 0===t&&(t=P(this.list));var e=this.cssNameSpace+"__option--focused focused focus";t.forEach((function(t){t.setAttribute("aria-selected","false"),o(t,e)}))},t.prototype.setOptionFocus=function(t,e){var i=P(this.list);if(this.resetOptionAttributes(i),e<0||!i.length)return this.currentSelectedIndex=-1,void(t&&t.target!==this.input&&this.input.focus());if(e>=i.length)return this.currentSelectedIndex=i.length-1,void this.setOptionFocus(t,this.currentSelectedIndex);var s=i[e];if(s&&"string"==typeof s.getAttribute("tabindex"))return this.currentSelectedIndex=e,a(s,this.cssNameSpace+"__option--focused focused focus"),s.setAttribute("aria-selected","true"),void s.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),k(s.element,!0,this)}if(this.elementIsInput){var n=t.join(this.options.multipleSeparator);n!==this.element.value&&(this.element.value=n,N(this.element,"change"))}!this.selected.length&&this.elementIsSelect&&(this.element.value="")},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]){for(var s=L(this.filteredSource[e]),n=!1,r=0,o=this.selected.length;r<o;r+=1)if(this.selected[r].value===s.value){n=!0;break}this.setInputValue(this.multiple?"":s.label,!0),n||this.multiple||this.selected.splice(0),n||(this.selected.push(s),this.setSourceElementValues(),this.buildMultiSelected()),this.triggerOptionCallback("onConfirm",[s]),this.announce(s.label+" "+this.options.srSelectedText,0),this.disabled||!1===i||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.setListOptions=function(t){var e=[],i=this.options.sourceMapping,s=this.removeSelectedFromResults(t),n=this.triggerOptionCallback("onResponse",s);this.filteredSource=n?F(n,i):s;for(var r,l=this.ids.OPTION,h=this.cssNameSpace,u=h+"__option",c=this.filteredSource.length,p="function"==typeof this.options.onItemRender,d=this.forceShowAll?9999:this.options.maxResults,f=d<c?d:c,m=0;m<f;m+=1){var v=this.filteredSource[m],b=p&&this.triggerOptionCallback("onItemRender",[v])||v.label;e.push('<li tabindex="-1" aria-selected="false" role="option" class="'+u+'" id="'+l+"--"+m+'" aria-posinset="'+(m+1)+'" aria-setsize="'+f+'">'+b+"</li>")}e.length?(a(this.list,h+"__list--has-results"),o(this.list,h+"__list--no-results")):(o(this.list,h+"__list--has-results"),a(this.list,h+"__list--no-results"));var y=this.options.noResultsText;!e.length&&"string"==typeof y&&y.length&&(r=y,e.push('<li class="'+u+" "+u+'--no-results">'+y+"</li>")),this.cancelFilterPrep(),r||(r=this.triggerOptionCallback("srResultsText",[f])),this.announce(r);var g=e.join("");if(this.currentListHtml!==g?(this.currentListHtml=g,this.list.innerHTML=g):this.resetOptionAttributes(),!e.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)?"&":"?")+encodeURIComponent(this.options.asyncQueryParam)+"="+encodeURIComponent(t)+"&"+encodeURIComponent(this.options.asyncMaxResultsParam)+"="+(l?9999:o+this.options.maxResults);a=this.triggerOptionCallback("onAsyncPrep",[a],r)||a,s.open("GET",a),s.onload=function(){if(s.readyState===s.DONE&&s.status>=200&&s.status<300){i.forceShowAll=n;var o=F(i.triggerOptionCallback("onAsyncSuccess",[t,s],r)||s.responseText,i.options.sourceMapping,!1);e?(i.prepSelectedFromArray(o),i.setInputStartingStates(!1)):i.setListOptions(o)}},s.onerror=function(){i.triggerOptionCallback("onAsyncError",[t,s],r)},e||(this.xhr=s),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,o=[];if(this.source&&this.source.length){var l=[u];if(!i){t=C(t,!0);var a=this.options.alsoSearchIn;Array.isArray(a)&&a.length&&(n=l.concat(a),r=[],n.forEach((function(t){if("string"==typeof t){for(var e=x(t),i="label"!==e,s=0,n=r.length;i&&s<n;s+=1)i=r[n]!==e;i&&r.push(e)}})),l=r)}this.source.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&&R(n,e,s))return!0}return!1}(e,t,l))&&o.push(e)}))}this.setListOptions(o)}else this.source.call(this.api,this.term,(function(t){var i=F(t,e.options.sourceMapping);e.setListOptions(i)}))}else this.cancelFilterPrep()},t.prototype.cancelFilterPrep=function(){clearTimeout(this.filterTimer),o(this.wrapper,this.cssNameSpace+"__wrapper--loading loading"),o(this.input,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&&x(s.selected[0].label)===x(i))&&(i=""),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 l=""!==i&&i===s.term;l&&(!l||s.menuOpen||r)||(a(s.wrapper,s.cssNameSpace+"__wrapper--loading loading"),a(s.input,s.cssNameSpace+"__input--loading loading"),s.currentSelectedIndex=-1,s.filter(i))}}),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.showAll&&i.showAll===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;"number"==typeof s&&-1!==s||(s=i.indexOfValueIn.call(i,i.filteredSource)),i.handleOptionSelect({},s,!1)}if(i.cancelFilterPrep(),i.hide(),!i.multiple&&-1===i.indexOfValueIn.call(i,i.selected)){var n=i.elementIsInput||i.elementIsSelect,r=i.element;n&&""!==r.value&&(r.value="",N(r,"change")),i.selected.length&&i.removeEntryFromSelected(i.selected[0]),i.setInputValue("",!0)}i.multiple&&i.setInputValue("",!0),i.documentClickBound&&(i.documentClickBound=!1,document.removeEventListener("click",i.documentClick))}}),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||(this.forceShowAll=this.options.minLength<1,(this.forceShowAll||this.input.value.length>=this.options.minLength)&&this.filterPrep(t)),this.menuOpen&&!this.filtering){var e=this.currentSelectedIndex;"number"!=typeof e||e<0?this.setOptionFocus(t,0):this.setOptionFocus(t,e+1)}},t.prototype.handleEndKey=function(t){if(!this.disabled&&this.menuOpen&&t.target!==this.input){var e=P(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.handleEnterKey=function(t){var e=t.target;this.isSelectedElem(e)?this.removeEntryFromSelected(e[c]):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(e===m&&!i||this.isSelectedElem(t.target)&&e===S)return t.preventDefault(),void this.handleEnterKey(t);if(!this.disabled){var s=this.selected&&this.selected.length;if(this.options.deleteOnBackspace&&e===p&&""===this.input.value&&s&&i&&this.multiple)this.removeEntryFromSelected(this.selected[s-1]);else{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 y:this.handleUpKey(t);break;case g:this.handleDownKey(t);break;case v:this.handleEndKey(t);break;case b:this.handleHomeKey(t);break;case d:this.handleEnterKey(t);break;case f: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)})),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[c]):t.input.focus()}));var e=this.cssNameSpace+"__wrapper--focused focused focus",i=this.cssNameSpace+"__input--focused focused focus";this.input.addEventListener("blur",(function(){o(t.wrapper,e),o(t.input,i),t.cancelPolling()})),this.input.addEventListener("input",(function(e){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(){a(t.wrapper,e),a(t.input,i),t.startPolling(),t.disabled||t.menuOpen||t.filterPrep(event,!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=P(t.list);if(i.length){var s=i.indexOf(e.target);t.handleOptionSelect(e,s)}}})),this.autoGrow&&(this.inputAutoWidth=new n.a(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={element:s,value:s.value},r=s.closest("label");!r&&s.id&&(r=document.querySelector('[for="'+s.id+'"]')),r&&(n.label=r.textContent),n.label||(n.label=n.value),n[u]=C(n.label),this.source.push(n),s.checked&&this.selected.push(n)}}},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={element:n,value:n.value,label:n.textContent};r[u]=C(r.label),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&&t&&t.length){var s=this.options.multiple,n=this.options.multipleSeparator;(s?i.split(n):[i]).forEach((function(i){if(-1===e.indexOfValueIn(e.selected,i,"value")){var s=e.indexOfValueIn(t,i,"value");s>-1&&e.selected.push(t[s])}}))}},t.prototype.prepListSourceArray=function(){this.source=F(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;this.elementIsInput&&e.value&&this.source.call(void 0,e.value,(function(e){t.prepSelectedFromArray(F(e,t.options.sourceMapping)),t.setInputStartingStates(!1)}))},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.elementIsSelect?this.prepListSourceDdl():void(this.element.querySelector('input[type="checkbox"]')&&this.prepListSourceCheckboxes())},t.prototype.setInputStartingStates=function(t){if(void 0===t&&(t=!0),t){if(this.ids.ELEMENT){var e=document.querySelector('[for="'+this.ids.ELEMENT+'"]');e&&(e._ariaAutocompleteLabelOriginallyFor=this.ids.ELEMENT,e.setAttribute("for",this.ids.INPUT))}var i=this.element.getAttribute("aria-describedby");i&&this.input.setAttribute("aria-describedby",i);var s=this.element.getAttribute("aria-labelledby");s&&this.input.setAttribute("aria-labelledby",s)}this.selected.length&&(this.multiple?this.buildMultiSelected():this.setInputValue(this.selected[0].label||"",!0)),this.setInputDescription(),this.element.disabled&&this.disable()},t.prototype.setHtml=function(){var t=this.options,e=this.cssNameSpace,i=t.wrapperClassName?" "+t.wrapperClassName:"",s=['<div id="'+this.ids.WRAPPER+'" class="'+e+"__wrapper"+i+'">'],n=t.name?" "+t.name:"",r=t.inputClassName?" "+t.inputClassName:"",o=t.placeholder?' placeholder="'+t.placeholder+'" aria-placeholder="'+t.placeholder+'"':"";s.push('<input type="text" autocomplete="off" aria-expanded="false" aria-autocomplete="list" role="combobox" id="'+this.ids.INPUT+'" aria-owns="'+this.ids.LIST+'" class="'+e+"__input"+r+'"'+n+o+" />"),t.showAllControl&&s.push('<span role="button" aria-label="'+t.srShowAllText+'" class="'+e+'__show-all" tabindex="0" id="'+this.ids.BUTTON+'" aria-expanded="false"></span>');var l=t.srListLabelText,a=t.listClassName?" "+t.listClassName:"",h=l?' aria-label="'+l+'"':"";s.push('<ul id="'+this.ids.LIST+'" class="'+e+"__list"+a+'" role="listbox" hidden="hidden"'+h+"></ul>"),s.push('<span class="sr-only '+e+"__sr-only "+e+'__sr-assistance" id="'+this.ids.SR_ASSISTANCE+'">'+t.srAssistiveText+"</span>"),s.push('<span class="sr-only '+e+"__sr-only "+e+'__sr-announcements" id="'+this.ids.SR_ANNOUNCEMENTS+'" aria-live="polite" aria-atomic="true"></span>'),s.push("</div>"),this.element.insertAdjacentHTML("afterend",s.join(""))},t.prototype.destroy=function(){var t=document.querySelector('[for="'+this.ids.INPUT+'"]');t&&t._ariaAutocompleteLabelOriginallyFor&&(t.setAttribute("for",t._ariaAutocompleteLabelOriginallyFor),delete t._ariaAutocompleteLabelOriginallyFor),this.documentClickBound&&document.removeEventListener("click",this.documentClick),this.autoGrow&&this.inputAutoWidth&&this.inputAutoWidth.destroy(),this.element.parentNode.removeChild(this.wrapper),delete this.element.ariaAutocomplete,this.show(this.element)},t.prototype.init=function(t,e){this.selected=[],this.element=t,this.ids=new E(t.id),this.elementIsInput="INPUT"===t.nodeName,this.elementIsSelect="SELECT"===t.nodeName,this.options=new h(e),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.srAnnouncements=document.getElementById(this.ids.SR_ANNOUNCEMENTS),this.prepListSource();var i=[];this.options.showAllControl&&i.push(this.cssNameSpace+"__wrapper--show-all"),this.autoGrow&&i.push(this.cssNameSpace+"__wrapper--autogrow"),this.multiple&&i.push(this.cssNameSpace+"__wrapper--multiple"),i.length&&a(this.wrapper,i.join(" ")),this.hide(this.list),this.hide(this.element),this.setInputStartingStates(),this.bindEvents(),this.api=new A(this),this.triggerOptionCallback("onReady",[this.wrapper])},t}();function D(t,e){return t&&t.ariaAutocomplete&&t.ariaAutocomplete.open?t.ariaAutocomplete:new M(t,e).api}i.d(e,"AriaAutocomplete",(function(){return D}));e.default=D}])}));
{
"name": "aria-autocomplete",
"version": "1.0.0",
"version": "1.1.0",
"description": "Accessible, extensible, JavaScript autocomplete with multi-select",
"main": "dist/aria-autocomplete.min.js",
"style": "dist/aria-autocomplete.min.css",
"browser": "dist/aria-autocomplete.min.js",
"style": "dist/aria-autocomplete.css",
"scripts": {
"build": "parcel build src/aria-autocomplete.js --out-file aria-autocomplete.min.js --no-source-maps",
"dev": "NODE_ENV=development parcel build src/aria-autocomplete.js --out-file aria-autocomplete.js --no-minify",
"css": "NODE_ENV=development parcel build src/aria-autocomplete.less --out-file aria-autocomplete.min.css --no-source-maps"
"build": "webpack",
"css": "lessc src/aria-autocomplete.less dist/aria-autocomplete.css"
},

@@ -33,2 +31,15 @@ "repository": {

],
"browserslist": [
">0.1%",
"last 5 Chrome versions",
"last 5 Firefox versions",
"last 5 Edge versions",
"last 5 Samsung versions",
"Safari >= 9",
"ie 9-11",
"iOS >= 9"
],
"files": [
"dist"
],
"author": "Leon Slater (https://www.mynamesleon.com)",

@@ -42,9 +53,13 @@ "license": "GPL-3.0-or-later",

"less": "^3.10.3",
"parcel-bundler": "^1.12.4"
"ts-loader": "^6.2.1",
"typescript": "^3.7.5",
"webpack": "^4.41.5",
"webpack-cli": "^3.3.10"
},
"dependencies": {
"element-closest": "^3.0.2",
"input-autowidth": "^1.0.2",
"is-printable-keycode": "^1.0.1"
"element-addclass": "^1.0.1",
"element-removeclass": "^1.0.0",
"input-autowidth": "^1.0.3",
"is-printable-keycode": "^1.0.3"
}
}

@@ -10,3 +10,3 @@ # Aria Autocomplete

[Try out the examples](https://mynamesleon.github.io/aria-autocomplete/examples/)
[Try out the examples](https://mynamesleon.github.io/aria-autocomplete/)

@@ -37,3 +37,3 @@ Key design goals and features are:

new AriaAutocomplete(document.getElementById('some-element'), {
AriaAutocomplete(document.getElementById('some-element'), {
source: ArrayOrStringOrFunction

@@ -43,8 +43,22 @@ });

At its core, the autocomplete requires only an element and a `source`. When the element is an input, its value will be set using the user's selection(s). If a `source` option isn't provided (is falsy, or an empty Array), and the element is either a `<select>`, or has child checkboxes, those will be used to build up the `source`.
```javascript
AriaAutocomplete(document.getElementById('some-input'), {
source: ['Afghanistan', 'Albania', 'Algeria', ...more]
});
const select = document.getElementById('some-select');
AriaAutocomplete(select);
const div = document.getElementById('some-div-with-child-checkboxes');
AriaAutocomplete(div);
```
### Plain JavaScript module
You can copy the [dist/aria-autocomplete.min.js](/mynamesleon/aria-autocomplete/blob/master/dist/aria-autocomplete.min.js) file into your project and import it into the browser:
You can grab the minified JS from the `dist` directory, or straight from unpkg:
```html
<script type="text/javascript" src="js/aria-autocomplete.min.js"></script>
<script src="https://unpkg.com/aria-autocomplete" type="text/javascript"></script>
```

@@ -54,8 +68,4 @@

I would encourage you to style it yourself to match your own site or application's design. An example stylesheet is included in the repository however at [dist/aria-autocomplete.min.css](/mynamesleon/aria-autocomplete/blob/master/dist/aria-autocomplete.css) which you can copy into your project and import into the browser:
**I would encourage you to style it yourself** to match your own site or application's design. An example stylesheet is included in the `dist` directory however which you can copy into your project and import into the browser.
```html
<link rel="stylesheet" src="css/aria-autocomplete.css" />
```
## Performance

@@ -67,26 +77,10 @@

## API Documentation
## Options
At its core, the autocomplete requires only an element, and a `source`. When the element is an input, its value will be set using the user's selection(s). If a `source` option isn't provided however (is falsy, or an empty Array), and the element is either a `<select>`, or has child checkboxes, those will be used to build up the `source`.
```javascript
new AriaAutocomplete(document.getElementById('some-input'), {
source: ['Afghanistan', 'Albania', 'Algeria', ...more]
});
const select = document.getElementById('some-select');
new AriaAutocomplete(select);
const div = document.getElementById('some-div-with-child-checkboxes');
new AriaAutocomplete(div);
```
### Options
The full list of options, and their defaults:
```javascript
```typescript
{
/**
* @description Give the autocomplete a name to be included in form submissions
* Give the autocomplete a name to be included in form submissions
* (Instead of using this option, I would advise initialising the autocomplete on

@@ -96,226 +90,221 @@ * an existing input that will be submitted, to also use any existing validation;

*/
name: '',
name: string;
/**
* @type {String | String[] | Object[] | Function}
* @description Specify source. See examples file for more specific usage.
* Specify source. See examples file for more specific usage.
* @example ['Afghanistan', 'Albania', 'Algeria', ...more]
* @example (query: String, render: Function) => render([])
* @example (query, render) => render(arrayToUse)
*/
source: '',
source: string[] | any[] | string | Function;
/**
* @description Properties to use for label and value
* when source is an Array of Objects
* Properties to use for label and value when source is an Array of Objects
*/
sourceMapping: { value: 'value', label: 'label' },
sourceMapping: any = {};
/**
* @type {String[]}
* @description Additional properties to use when searching for a match.
* Additional properties to use when searching for a match.
* `label` will always be used
*/
alsoSearchIn: [],
alsoSearchIn: string[] = [];
/**
* @description Input delay after typing before running a search
* Input delay after typing before running a search
*/
delay: 100,
delay: number = 100;
/**
* @description Minimum number of characters to run a search (includes spaces)
* Minimum number of characters to run a search (includes spaces)
*/
minLength: 1,
minLength: number = 1;
/**
* @description Maximum number of results to render. Also used with async endpoint
* Maximum number of results to render. Also used in async endpoint URL
*/
maxResults: 9999,
maxResults: number = 9999;
/**
* @description Render a control that triggers showing all options.
* Render a control that triggers showing all options.
* Runs a search with an empty query: '', and maxResults of 9999
*/
showAllControl: false,
showAllControl: boolean = false;
/**
* @description Confirm currently active selection when blurring off of the control.
* If no active selection, will compare current input value against available labels
* Confirm currently active selection when blurring off of the control. If
* no active selection, will compare current input value against available labels
*/
confirmOnBlur: true,
confirmOnBlur: boolean = true;
/**
* @description Allow multiple items to be selected
* Allow multiple items to be selected
*/
multiple: false,
multiple: boolean = false;
/**
* @description Adjust input width to match its value.
* Experimental, and a performance hit
* Adjust input width to match its value. This will incur a performance hit
*/
autoGrow: false,
autoGrow: boolean = false;
/**
* @description Maximum number of items that can be selected
* Maximum number of items that can be selected in multiple mode
*/
maxItems: 9999,
maxItems: number = 9999;
/**
* @description If initialised element is an input, and in multiple mode,
* If initialised element is an input, and in multiple mode,
* character that separates the selected values e.g. "GLP,ZWE"
*/
multipleSeparator: ',',
multipleSeparator: string = `,`;
/**
* @description If input is empty and in multiple mode,
* If input is empty and in multiple mode,
* delete last selected item on backspace
*/
deleteOnBackspace: false,
deleteOnBackspace: boolean = false;
/**
* @description In async mode, parameter to use when adding the input value
* to the endpoint String. e.g. https://some-endpoint?q=norway&limit=9999
* In async mode, parameter to use when adding the input value to the
* endpoint String. e.g. https://some-endpoint?q=norway&limit=9999
*/
asyncQueryParam: 'q',
asyncQueryParam: string = `q`;
/**
* @description In async mode, parameter to use when adding results limit
* to the endpoint String. e.g. https://some-endpoint?q=norway&limit=9999
* In async mode, parameter to use when adding results limit to the
* endpoint String. e.g. https://some-endpoint?q=norway&limit=9999
*/
asyncMaxResultsParam: 'limit',
asyncMaxResultsParam: string = `limit`;
/**
* @description Placeholder text to show in generated input
* Placeholder text to show in generated input
*/
placeholder: '',
placeholder: string;
/**
* @description Text to show (and announce to screen readers) if no results found.
* Text to show (and announce to screen readers) if no results found.
* If empty, the list of options will remain hidden when there are no results
*/
noResultsText: 'No results',
noResultsText: string = `No results`;
/**
* @description String to prepend to classes for BEM naming
* String to prepend to classes for BEM naming
* e.g. aria-autocomplete__input
*/
cssNameSpace: 'aria-autocomplete',
cssNameSpace: string = `aria-autocomplete`;
/**
* @description Custom class name to add to the options list holder
* Custom class name to add to the options list holder
*/
listClassName: '',
listClassName: string;
/**
* @description Custom class name to add to the generated input
* Custom class name to add to the generated input
*/
inputClassName: '',
inputClassName: string;
/**
* @description Custom class name to add to the component wrapper
* Custom class name to add to the component wrapper
*/
wrapperClassName: '',
wrapperClassName: string;
/**
* @description In multiple mode, screen reader text used for element deletion.
* Screen reader text used in multiple mode for element deletion.
* Prepended to option label in aria-label attribute e.g. 'delete Canada'
*/
srDeleteText: 'delete',
srDeleteText: string = `delete`;
/**
* @description Screen reader text announced after deletion.
* Screen reader text announced after deletion.
* Apended to option label e.g. 'Canada deleted'
*/
srDeletedText: 'deleted',
srDeletedText: string = `deleted`;
/**
* @description Value for aria-label attribute on the show all control
* Value for aria-label attribute on the show all control
*/
srShowAllText: 'Show all',
srShowAllText: string = `Show all`;
/**
* @description Screen reader text announced after confirming a selection.
* Screen reader text announced after confirming a selection.
* Appended to option label e.g. 'Canada selected'
*/
srSelectedText: 'selected',
srSelectedText: string = `selected`;
/**
* @description Screen reader explainer added to the list element
* via aria-label attribute
* Screen reader explainer added to the list element via aria-label attribute
*/
srListLabelText: 'Search suggestions',
srListLabelText: string = `Search suggestions`;
/**
* @description Screen reader description announced when the input receives focus.
* Screen reader description announced when the input receives focus.
* Only announced when input is empty
*/
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.',
srAssistiveText: string =
`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.`;
/**
* @description Screen reader announcement after results are rendered
* Screen reader announcement after results are rendered
*/
srResultsText: length =>
`${length} ${length === 1 ? 'result' : 'results'} available.`,
srResultsText: (length: number) => string | void = (length: number) =>
`${length} ${length === 1 ? 'result' : 'results'} available.`;
/**
* @description Callback before a search is performed - receives the input value.
* Callback before a search is performed - receives the input value.
* Can be used to alter the search value by returning a String
*/
onSearch: query => query,
onSearch: (value: string) => string | void;
/**
* @description Callback before async call is made - receives the URL.
* Callback before async call is made - receives the URL.
* Can be used to format the endpoint URL by returning a String
*/
onAsyncPrep: url => url,
onAsyncPrep: (url: string) => string | void;
/**
* @description Callback after async call completes - receives the xhr object.
* Callback after async call completes - receives the xhr object.
* Can be used to format the results by returning an Array
*/
onAsyncSuccess: (query, xhr) => xhr.responseText,
onAsyncSuccess: (xhr: XMLHttpRequest) => any[] | void;
/**
* @description Callback prior to rendering - receives the options that are going
* Callback prior to rendering - receives the options that are going
* to render. Can be used to format the results by returning an Array
*/
onResponse: optionsToRender => optionsToRender,
onResponse: (options: any[]) => any[] | void;
/**
* @description Callback when rendering items in the list.
* Callback when rendering items in the list - receives the source option.
* Can be used to format the <li> content by returning a String
*/
onItemRender: itemData => itemData.label,
onItemRender: (sourceEntry: any) => string | void;
/**
* @description Callback after selection is made -
* receives an object with the option details
* Callback after selection is made - receives an object with the option details
*/
onConfirm: selection => {},
onConfirm: (selected: any) => void;
/**
* @description Callback after an autocomplete selection is deleted.
* Callback after an autocomplete selection is deleted.
* Fires in single-select mode when selection is deleted automatically.
* Fires in multi-select mode when selected is deleted by user action
*/
onDelete: selection => {},
onDelete: (deleted: any) => void;
/**
* @description Callback when main script processing and initial rendering has finished
* Callback when main script processing and initial rendering has finished
*/
onReady: componentWrapper => {},
onReady: (wrapper: HTMLDivElement) => void;
/**
* @description Callback when list area closes - receives the list holder element
* Callback when list area closes - receives the list holder element
*/
onClose: listElement => {},
onClose: (list: HTMLUListElement) => void;
/**
* @description Callback when list area opens - receives the list holder element
* Callback when list area opens - receives the list holder element
*/
onOpen: listElement => {}
onOpen: (list: HTMLUListElement) => void;
}
```
Calling `new AriaAutocomplete(element, options);` returns the API object, which can also be accessed on the element via `element.ariaAutocomplete`.
Calling `AriaAutocomplete(element, options);` returns the API object, which can also be accessed on the element via `element.ariaAutocomplete`.
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