!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.Listbox=t():e.Listbox=t()}(self,(()=>(()=>{var e={942:e=>{window,e.exports=function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=0)}([function(e,t,n){"use strict";n.r(t),n.d(t,"BACKSPACE",(function(){return r})),n.d(t,"TAB",(function(){return o})),n.d(t,"ENTER",(function(){return i})),n.d(t,"SHIFT",(function(){return s})),n.d(t,"ESCAPE",(function(){return u})),n.d(t,"SPACE",(function(){return c})),n.d(t,"PAGE_UP",(function(){return l})),n.d(t,"PAGE_DOWN",(function(){return f})),n.d(t,"END",(function(){return a})),n.d(t,"HOME",(function(){return h})),n.d(t,"ARROW_LEFT",(function(){return p})),n.d(t,"ARROW_UP",(function(){return v})),n.d(t,"ARROW_RIGHT",(function(){return y})),n.d(t,"ARROW_DOWN",(function(){return d})),n.d(t,"DELETE",(function(){return b}));var r=8,o=9,i=13,s=16,u=27,c=32,l=33,f=34,a=35,h=36,p=37,v=38,y=39,d=40,b=46}])},187:e=>{"use strict";var t,n="object"==typeof Reflect?Reflect:null,r=n&&"function"==typeof n.apply?n.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)};t=n&&"function"==typeof n.ownKeys?n.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var o=Number.isNaN||function(e){return e!=e};function i(){i.init.call(this)}e.exports=i,e.exports.once=function(e,t){return new Promise((function(n,r){function o(n){e.removeListener(t,i),r(n)}function i(){"function"==typeof e.removeListener&&e.removeListener("error",o),n([].slice.call(arguments))}y(e,t,i,{once:!0}),"error"!==t&&function(e,t,n){"function"==typeof e.on&&y(e,"error",t,{once:!0})}(e,o)}))},i.EventEmitter=i,i.prototype._events=void 0,i.prototype._eventsCount=0,i.prototype._maxListeners=void 0;var s=10;function u(e){if("function"!=typeof e)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function c(e){return void 0===e._maxListeners?i.defaultMaxListeners:e._maxListeners}function l(e,t,n,r){var o,i,s,l;if(u(n),void 0===(i=e._events)?(i=e._events=Object.create(null),e._eventsCount=0):(void 0!==i.newListener&&(e.emit("newListener",t,n.listener?n.listener:n),i=e._events),s=i[t]),void 0===s)s=i[t]=n,++e._eventsCount;else if("function"==typeof s?s=i[t]=r?[n,s]:[s,n]:r?s.unshift(n):s.push(n),(o=c(e))>0&&s.length>o&&!s.warned){s.warned=!0;var f=new Error("Possible EventEmitter memory leak detected. "+s.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");f.name="MaxListenersExceededWarning",f.emitter=e,f.type=t,f.count=s.length,l=f,console&&console.warn&&console.warn(l)}return e}function f(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0===arguments.length?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function a(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},o=f.bind(r);return o.listener=n,r.wrapFn=o,o}function h(e,t,n){var r=e._events;if(void 0===r)return[];var o=r[t];return void 0===o?[]:"function"==typeof o?n?[o.listener||o]:[o]:n?function(e){for(var t=new Array(e.length),n=0;n0&&(s=t[0]),s instanceof Error)throw s;var u=new Error("Unhandled error."+(s?" ("+s.message+")":""));throw u.context=s,u}var c=i[e];if(void 0===c)return!1;if("function"==typeof c)r(c,this,t);else{var l=c.length,f=v(c,l);for(n=0;n=0;i--)if(n[i]===t||n[i].listener===t){s=n[i].listener,o=i;break}if(o<0)return this;0===o?n.shift():function(e,t){for(;t+1=0;r--)this.removeListener(e,t[r]);return this},i.prototype.listeners=function(e){return h(this,e,!0)},i.prototype.rawListeners=function(e){return h(this,e,!1)},i.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):p.call(e,t)},i.prototype.listenerCount=p,i.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]}}},t={};function n(r){var o=t[r];if(void 0!==o)return o.exports;var i=t[r]={exports:{}};return e[r](i,i.exports,n),i.exports}n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var r={};return(()=>{"use strict";function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},e(t)}function t(t){var n=function(t,n){if("object"!==e(t)||null===t)return t;var r=t[Symbol.toPrimitive];if(void 0!==r){var o=r.call(t,"string");if("object"!==e(o))return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"===e(n)?n:String(n)}function o(e,n,r){return(n=t(n))in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e}function i(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);nd,Button:()=>m});var h=n(942),p=n(187),v=function(e,t){return e.classList.add(t)},y=function(e,t){return e.classList.remove(t)};var d=function(t){!function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&f(e,t)}(p,t);var n,r,u=(n=p,r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(e){return!1}}(),function(){var t,o=a(n);if(r){var i=a(this).constructor;t=Reflect.construct(o,arguments,i)}else t=o.apply(this,arguments);return function(t,n){if(n&&("object"===e(n)||"function"==typeof n))return n;if(void 0!==n)throw new TypeError("Derived constructors may only return object or undefined");return l(t)}(this,t)});function p(e){var t,n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=arguments.length>2&&void 0!==arguments[2]&&arguments[2];return s(this,p),(t=u.call(this)).rootElement=e,t.keys="",t.active=!1,t.selectOnFocus=n,t.blurOnFocus=r,t.multiple=!1,t.multiple&&(t.selectOnFocus=!1),t.onFocus=t.onFocus.bind(l(t)),t.onKeydown=t.onKeydown.bind(l(t)),t.onClick=t.onClick.bind(l(t)),t.blur=t.blur.bind(l(t)),t}return c(p,[{key:"init",value:function(){var e;this.activeDescendant=this.rootElement.getAttribute("aria-activedescendant"),this.options=function(e){if(Array.isArray(e))return i(e)}(e=this.rootElement.querySelectorAll('[role="option"]'))||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return i(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?i(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}(),this.initEvents()}},{key:"initEvents",value:function(){this.rootElement.addEventListener("focus",this.onFocus),this.rootElement.addEventListener("keydown",this.onKeydown),this.rootElement.addEventListener("click",this.onClick),this.rootElement.addEventListener("blur",this.blur)}},{key:"blur",value:function(){this.emit("Box.blur")}},{key:"onClick",value:function(e){var t=e.target;"option"===t.getAttribute("role")&&(this.focusOption(t),this.multiple||this.emit("Box.click",t),this.blurOnFocus&&this.rootElement.blur())}},{key:"onFocus",value:function(){return!this.activeDescendant&&this.focusOption(this.options[0])}},{key:"onKeydown",value:function(e){var t,n=this;this.emit("Box.keydown",e);var r=e.keyCode||e.which,i=this.rootElement.querySelector("#".concat(this.activeDescendant));if(this.active=this.options.indexOf(i),!i)return!1;var s=function(t){e.preventDefault(),n.focusOption(t)},u=(o(t={},h.HOME,(function(){return s(n.options[0])})),o(t,h.END,(function(){return s(n.options[n.options.length-1])})),o(t,h.ARROW_UP,(function(){return!!i.previousElementSibling&&s(i.previousElementSibling)})),o(t,h.ARROW_DOWN,(function(){return!!i.nextElementSibling&&s(i.nextElementSibling)})),o(t,h.PAGE_UP,(function(){0n.active+5?s(n.options[n.active+5]):s(n.options[n.options.length-1])})),o(t,"default",(function(){var e=n.find(r);return!!e&&n.focusOption(e)})),t);return(u[r]||u.default)()}},{key:"focusOption",value:function(e){if(this.multiple)"is-active",e.classList.toggle("is-active"),r="aria-selected",(n=e).hasAttribute(r)?n.removeAttribute(r):n.setAttribute(r,"");else{var t=this.rootElement.querySelector("#".concat(this.activeDescendant));t&&(y(t,"is-active"),t.removeAttribute("aria-selected")),v(e,"is-active"),e.setAttribute("aria-selected",!0)}var n,r;if(this.rootElement.setAttribute("aria-activedescendant",e.id),this.activeDescendant=e.id,this.rootElement.scrollHeight>this.rootElement.clientHeight){var o=this.rootElement.clientHeight+this.rootElement.scrollTop,i=e.offsetTop+e.offsetHeight;i>o?this.rootElement.scrollTop=i-this.rootElement.clientHeight:e.offsetTop0&&void 0!==arguments[0]?arguments[0]:500;this.keyClear&&(clearTimeout(this.keyClear),this.keyClear=null),this.keyClear=setTimeout((function(){e.keys="",e.emit("Box.keysChange",e.keys),e.keyClear=null}),t)}},{key:"findMatchInRange",value:function(e,t,n){for(var r=t;r2&&void 0!==arguments[2]?arguments[2]:{};s(this,e),this.rootElement=t,this.box=n,this.options=function(e){for(var t=1;t