downshift
Advanced tools
Comparing version 8.0.0 to 8.0.1
@@ -1,2 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).Downshift={},e.React)}(this,(function(e,t){"use strict";function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var i=n(t);function o(e,t){if(null==e)return{};var n,i,o={},r=Object.keys(e);for(i=0;i<r.length;i++)n=r[i],t.indexOf(n)>=0||(o[n]=e[n]);return o}function r(){return r=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},r.apply(this,arguments)}function u(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function s(e,t){return s=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},s(e,t)}var a={exports:{}},l={},c="function"==typeof Symbol&&Symbol.for,d=c?Symbol.for("react.element"):60103,p=c?Symbol.for("react.portal"):60106,f=c?Symbol.for("react.fragment"):60107,g=c?Symbol.for("react.strict_mode"):60108,h=c?Symbol.for("react.profiler"):60114,m=c?Symbol.for("react.provider"):60109,I=c?Symbol.for("react.context"):60110,v=c?Symbol.for("react.async_mode"):60111,y=c?Symbol.for("react.concurrent_mode"):60111,b=c?Symbol.for("react.forward_ref"):60112,x=c?Symbol.for("react.suspense"):60113,w=c?Symbol.for("react.suspense_list"):60120,S=c?Symbol.for("react.memo"):60115,C=c?Symbol.for("react.lazy"):60116,k=c?Symbol.for("react.block"):60121,D=c?Symbol.for("react.fundamental"):60117,O=c?Symbol.for("react.responder"):60118,M=c?Symbol.for("react.scope"):60119;function E(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case d:switch(e=e.type){case v:case y:case f:case h:case g:case x:return e;default:switch(e=e&&e.$$typeof){case I:case b:case C:case S:case m:return e;default:return t}}case p:return t}}}function P(e){return E(e)===y}l.AsyncMode=v,l.ConcurrentMode=y,l.ContextConsumer=I,l.ContextProvider=m,l.Element=d,l.ForwardRef=b,l.Fragment=f,l.Lazy=C,l.Memo=S,l.Portal=p,l.Profiler=h,l.StrictMode=g,l.Suspense=x,l.isAsyncMode=function(e){return P(e)||E(e)===v},l.isConcurrentMode=P,l.isContextConsumer=function(e){return E(e)===I},l.isContextProvider=function(e){return E(e)===m},l.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===d},l.isForwardRef=function(e){return E(e)===b},l.isFragment=function(e){return E(e)===f},l.isLazy=function(e){return E(e)===C},l.isMemo=function(e){return E(e)===S},l.isPortal=function(e){return E(e)===p},l.isProfiler=function(e){return E(e)===h},l.isStrictMode=function(e){return E(e)===g},l.isSuspense=function(e){return E(e)===x},l.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===f||e===y||e===h||e===g||e===x||e===w||"object"==typeof e&&null!==e&&(e.$$typeof===C||e.$$typeof===S||e.$$typeof===m||e.$$typeof===I||e.$$typeof===b||e.$$typeof===D||e.$$typeof===O||e.$$typeof===M||e.$$typeof===k)},l.typeOf=E;function R(){}function K(){}K.resetWarningCache=R;a.exports=function(){function e(e,t,n,i,o,r){if("SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"!==r){var u=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw u.name="Invariant Violation",u}}function t(){return e}e.isRequired=e;var n={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:K,resetWarningCache:R};return n.PropTypes=n,n}();var T=a.exports,H={},V=60103,A=60106,B=60107,L=60108,_=60114,F=60109,$=60110,N=60112,j=60113,U=60120,W=60115,q=60116,z=60121,Y=60122,X=60117,G=60129,J=60131;if("function"==typeof Symbol&&Symbol.for){var Q=Symbol.for;V=Q("react.element"),A=Q("react.portal"),B=Q("react.fragment"),L=Q("react.strict_mode"),_=Q("react.profiler"),F=Q("react.provider"),$=Q("react.context"),N=Q("react.forward_ref"),j=Q("react.suspense"),U=Q("react.suspense_list"),W=Q("react.memo"),q=Q("react.lazy"),z=Q("react.block"),Y=Q("react.server.block"),X=Q("react.fundamental"),G=Q("react.debug_trace_mode"),J=Q("react.legacy_hidden")}function Z(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case V:switch(e=e.type){case B:case _:case L:case j:case U:return e;default:switch(e=e&&e.$$typeof){case $:case N:case q:case W:case F:return e;default:return t}}case A:return t}}}var ee=F,te=V,ne=N,ie=B,oe=q,re=W,ue=A,se=_,ae=L,le=j;H.ContextConsumer=$,H.ContextProvider=ee,H.Element=te,H.ForwardRef=ne,H.Fragment=ie,H.Lazy=oe,H.Memo=re,H.Portal=ue,H.Profiler=se,H.StrictMode=ae,H.Suspense=le,H.isAsyncMode=function(){return!1},H.isConcurrentMode=function(){return!1},H.isContextConsumer=function(e){return Z(e)===$},H.isContextProvider=function(e){return Z(e)===F},H.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===V},H.isForwardRef=function(e){return Z(e)===N},H.isFragment=function(e){return Z(e)===B},H.isLazy=function(e){return Z(e)===q},H.isMemo=function(e){return Z(e)===W},H.isPortal=function(e){return Z(e)===A},H.isProfiler=function(e){return Z(e)===_},H.isStrictMode=function(e){return Z(e)===L},H.isSuspense=function(e){return Z(e)===j},H.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===B||e===_||e===G||e===L||e===j||e===U||e===J||"object"==typeof e&&null!==e&&(e.$$typeof===q||e.$$typeof===W||e.$$typeof===F||e.$$typeof===$||e.$$typeof===N||e.$$typeof===X||e.$$typeof===z||e[0]===Y)},H.typeOf=Z;let ce=e=>"object"==typeof e&&null!=e&&1===e.nodeType,de=(e,t)=>(!t||"hidden"!==e)&&"visible"!==e&&"clip"!==e,pe=(e,t)=>{if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){let n=getComputedStyle(e,null);return de(n.overflowY,t)||de(n.overflowX,t)||(e=>{let t=(e=>{if(!e.ownerDocument||!e.ownerDocument.defaultView)return null;try{return e.ownerDocument.defaultView.frameElement}catch(e){return null}})(e);return!!t&&(t.clientHeight<e.scrollHeight||t.clientWidth<e.scrollWidth)})(e)}return!1},fe=(e,t,n,i,o,r,u,s)=>r<e&&u>t||r>e&&u<t?0:r<=e&&s<=n||u>=t&&s>=n?r-e-i:u>t&&s<n||r<e&&s>n?u-t+o:0,ge=e=>{let t=e.parentElement;return null==t?e.getRootNode().host||null:t};var he=0;function me(e){return"function"==typeof e?e:Ie}function Ie(){}function ve(e,t){if(e){var n=((e,t)=>{var n,i,o,r,u,s;if("undefined"==typeof document)return[];let{scrollMode:a,block:l,inline:c,boundary:d,skipOverflowHiddenElements:p}=t,f="function"==typeof d?d:e=>e!==d;if(!ce(e))throw new TypeError("Invalid target");let g=document.scrollingElement||document.documentElement,h=[],m=e;for(;ce(m)&&f(m);){if(m=ge(m),m===g){h.push(m);break}null!=m&&m===document.body&&pe(m)&&!pe(document.documentElement)||null!=m&&pe(m,p)&&h.push(m)}let I=null!=(i=null==(n=window.visualViewport)?void 0:n.width)?i:innerWidth,v=null!=(r=null==(o=window.visualViewport)?void 0:o.height)?r:innerHeight,y=null!=(u=window.scrollX)?u:pageXOffset,b=null!=(s=window.scrollY)?s:pageYOffset,{height:x,width:w,top:S,right:C,bottom:k,left:D}=e.getBoundingClientRect(),O="start"===l||"nearest"===l?S:"end"===l?k:S+x/2,M="center"===c?D+w/2:"end"===c?C:D,E=[];for(let e=0;e<h.length;e++){let t=h[e],{height:n,width:i,top:o,right:r,bottom:u,left:s}=t.getBoundingClientRect();if("if-needed"===a&&S>=0&&D>=0&&k<=v&&C<=I&&S>=o&&k<=u&&D>=s&&C<=r)return E;let d=getComputedStyle(t),p=parseInt(d.borderLeftWidth,10),f=parseInt(d.borderTopWidth,10),m=parseInt(d.borderRightWidth,10),P=parseInt(d.borderBottomWidth,10),R=0,K=0,T="offsetWidth"in t?t.offsetWidth-t.clientWidth-p-m:0,H="offsetHeight"in t?t.offsetHeight-t.clientHeight-f-P:0,V="offsetWidth"in t?0===t.offsetWidth?0:i/t.offsetWidth:0,A="offsetHeight"in t?0===t.offsetHeight?0:n/t.offsetHeight:0;if(g===t)R="start"===l?O:"end"===l?O-v:"nearest"===l?fe(b,b+v,v,f,P,b+O,b+O+x,x):O-v/2,K="start"===c?M:"center"===c?M-I/2:"end"===c?M-I:fe(y,y+I,I,p,m,y+M,y+M+w,w),R=Math.max(0,R+b),K=Math.max(0,K+y);else{R="start"===l?O-o-f:"end"===l?O-u+P+H:"nearest"===l?fe(o,u,n,f,P+H,O,O+x,x):O-(o+n/2)+H/2,K="start"===c?M-s-p:"center"===c?M-(s+i/2)+T/2:"end"===c?M-r+m+T:fe(s,r,i,p,m+T,M,M+w,w);let{scrollLeft:e,scrollTop:a}=t;R=Math.max(0,Math.min(a+R/A,t.scrollHeight-n/A+H)),K=Math.max(0,Math.min(e+K/V,t.scrollWidth-i/V+T)),O+=a-R,M+=e-K}E.push({el:t,top:R,left:K})}return E})(e,{boundary:t,block:"nearest",scrollMode:"if-needed"});n.forEach((function(e){var t=e.el,n=e.top,i=e.left;t.scrollTop=n,t.scrollLeft=i}))}}function ye(e,t,n){return e===t||t instanceof n.Node&&e.contains&&e.contains(t)}function be(e,t){var n;function i(){n&&clearTimeout(n)}function o(){for(var o=arguments.length,r=new Array(o),u=0;u<o;u++)r[u]=arguments[u];i(),n=setTimeout((function(){n=null,e.apply(void 0,r)}),t)}return o.cancel=i,o}function xe(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e){for(var n=arguments.length,i=new Array(n>1?n-1:0),o=1;o<n;o++)i[o-1]=arguments[o];return t.some((function(t){return t&&t.apply(void 0,[e].concat(i)),e.preventDownshiftDefault||e.hasOwnProperty("nativeEvent")&&e.nativeEvent.preventDownshiftDefault}))}}function we(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e){t.forEach((function(t){"function"==typeof t?t(e):t&&(t.current=e)}))}}function Se(){return String(he++)}function Ce(e){var t=e.isOpen,n=e.resultCount,i=e.previousResultCount;return t?n?n!==i?n+" result"+(1===n?" is":"s are")+" available, use up and down arrow keys to navigate. Press Enter key to select.":"":"No results are available.":""}function ke(e,t){return!(e=Array.isArray(e)?e[0]:e)&&t?t:e}var De=["highlightedIndex","inputValue","isOpen","selectedItem","type"];function Oe(e){void 0===e&&(e={});var t={};return De.forEach((function(n){e.hasOwnProperty(n)&&(t[n]=e[n])})),t}function Me(e,t){return Object.keys(e).reduce((function(n,i){return n[i]=Ee(t,i)?t[i]:e[i],n}),{})}function Ee(e,t){return void 0!==e[t]}function Pe(e){var t=e.key,n=e.keyCode;return n>=37&&n<=40&&0!==t.indexOf("Arrow")?"Arrow"+t:t}function Re(e,t,n,i,o){void 0===o&&(o=!1);var r=n.length;if(0===r)return-1;var u=r-1;("number"!=typeof e||e<0||e>u)&&(e=t>0?-1:u+1);var s=e+t;s<0?s=o?u:0:s>u&&(s=o?0:u);var a=Ke(s,t<0,n,i,o);return-1===a?e>=r?-1:e:a}function Ke(e,t,n,i,o){void 0===o&&(o=!1);var r=n.length;if(t){for(var u=e;u>=0;u--)if(!i(n[u],u))return u}else for(var s=e;s<r;s++)if(!i(n[s],s))return s;return o?Ke(t?r-1:0,t,n,i):-1}function Te(e,t,n,i){return void 0===i&&(i=!0),t.some((function(t){return t&&(ye(t,e,n)||i&&ye(t,n.document.activeElement,n))}))}var He=be((function(e){Ae(e).textContent=""}),500);function Ve(e,t){var n=Ae(t);e&&(n.textContent=e,He(t))}function Ae(e){void 0===e&&(e=document);var t=e.getElementById("a11y-status-message");return t||((t=e.createElement("div")).setAttribute("id","a11y-status-message"),t.setAttribute("role","status"),t.setAttribute("aria-live","polite"),t.setAttribute("aria-relevant","additions text"),Object.assign(t.style,{border:"0",clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:"0",position:"absolute",width:"1px"}),e.body.appendChild(t),t)}var Be=Object.freeze({__proto__:null,unknown:0,mouseUp:1,itemMouseEnter:2,keyDownArrowUp:3,keyDownArrowDown:4,keyDownEscape:5,keyDownEnter:6,keyDownHome:7,keyDownEnd:8,clickItem:9,blurInput:10,changeInput:11,keyDownSpaceButton:12,clickButton:13,blurButton:14,controlledPropUpdatedSelectedItem:15,touchEnd:16}),Le=["refKey","ref"],_e=["onClick","onPress","onKeyDown","onKeyUp","onBlur"],Fe=["onKeyDown","onBlur","onChange","onInput","onChangeText"],$e=["refKey","ref"],Ne=["onMouseMove","onMouseDown","onClick","onPress","index","item"],je=function(){var e=function(e){var n,i;function a(t){var n=e.call(this,t)||this;n.id=n.props.id||"downshift-"+Se(),n.menuId=n.props.menuId||n.id+"-menu",n.labelId=n.props.labelId||n.id+"-label",n.inputId=n.props.inputId||n.id+"-input",n.getItemId=n.props.getItemId||function(e){return n.id+"-item-"+e},n.input=null,n.items=[],n.itemCount=null,n.previousResultCount=0,n.timeoutIds=[],n.internalSetTimeout=function(e,t){var i=setTimeout((function(){n.timeoutIds=n.timeoutIds.filter((function(e){return e!==i})),e()}),t);n.timeoutIds.push(i)},n.setItemCount=function(e){n.itemCount=e},n.unsetItemCount=function(){n.itemCount=null},n.isItemDisabled=function(e,t){var i=n.getItemNodeFromIndex(t);return i&&i.hasAttribute("disabled")},n.setHighlightedIndex=function(e,t){void 0===e&&(e=n.props.defaultHighlightedIndex),void 0===t&&(t={}),t=Oe(t),n.internalSetState(r({highlightedIndex:e},t))},n.clearSelection=function(e){n.internalSetState({selectedItem:null,inputValue:"",highlightedIndex:n.props.defaultHighlightedIndex,isOpen:n.props.defaultIsOpen},e)},n.selectItem=function(e,t,i){t=Oe(t),n.internalSetState(r({isOpen:n.props.defaultIsOpen,highlightedIndex:n.props.defaultHighlightedIndex,selectedItem:e,inputValue:n.props.itemToString(e)},t),i)},n.selectItemAtIndex=function(e,t,i){var o=n.items[e];null!=o&&n.selectItem(o,t,i)},n.selectHighlightedItem=function(e,t){return n.selectItemAtIndex(n.getState().highlightedIndex,e,t)},n.internalSetState=function(e,t){var i,o,u={},s="function"==typeof e;return!s&&e.hasOwnProperty("inputValue")&&n.props.onInputValueChange(e.inputValue,r({},n.getStateAndHelpers(),e)),n.setState((function(t){t=n.getState(t);var a=s?e(t):e;a=n.props.stateReducer(t,a),i=a.hasOwnProperty("selectedItem");var l={};return i&&a.selectedItem!==t.selectedItem&&(o=a.selectedItem),a.type=a.type||0,Object.keys(a).forEach((function(e){t[e]!==a[e]&&(u[e]=a[e]),"type"!==e&&(a[e],Ee(n.props,e)||(l[e]=a[e]))})),s&&a.hasOwnProperty("inputValue")&&n.props.onInputValueChange(a.inputValue,r({},n.getStateAndHelpers(),a)),l}),(function(){me(t)(),Object.keys(u).length>1&&n.props.onStateChange(u,n.getStateAndHelpers()),i&&n.props.onSelect(e.selectedItem,n.getStateAndHelpers()),void 0!==o&&n.props.onChange(o,n.getStateAndHelpers()),n.props.onUserAction(u,n.getStateAndHelpers())}))},n.rootRef=function(e){return n._rootNode=e},n.getRootProps=function(e,t){var i,u=void 0===e?{}:e,s=u.refKey,a=void 0===s?"ref":s,l=u.ref,c=o(u,Le),d=(void 0===t?{}:t).suppressRefError,p=void 0!==d&&d;n.getRootProps.called=!0,n.getRootProps.refKey=a,n.getRootProps.suppressRefError=p;var f=n.getState().isOpen;return r(((i={})[a]=we(l,n.rootRef),i.role="combobox",i["aria-expanded"]=f,i["aria-haspopup"]="listbox",i["aria-owns"]=f?n.menuId:void 0,i["aria-labelledby"]=n.labelId,i),c)},n.keyDownHandlers={ArrowDown:function(e){var t=this;if(e.preventDefault(),this.getState().isOpen){var n=e.shiftKey?5:1;this.moveHighlightedIndex(n,{type:4})}else this.internalSetState({isOpen:!0,type:4},(function(){var e=t.getItemCount();if(e>0){var n=Re(t.getState().highlightedIndex,1,{length:e},t.isItemDisabled,!0);t.setHighlightedIndex(n,{type:4})}}))},ArrowUp:function(e){var t=this;if(e.preventDefault(),this.getState().isOpen){var n=e.shiftKey?-5:-1;this.moveHighlightedIndex(n,{type:3})}else this.internalSetState({isOpen:!0,type:3},(function(){var e=t.getItemCount();if(e>0){var n=Re(t.getState().highlightedIndex,-1,{length:e},t.isItemDisabled,!0);t.setHighlightedIndex(n,{type:3})}}))},Enter:function(e){if(229!==e.which){var t=this.getState(),n=t.isOpen,i=t.highlightedIndex;if(n&&null!=i){e.preventDefault();var o=this.items[i],r=this.getItemNodeFromIndex(i);if(null==o||r&&r.hasAttribute("disabled"))return;this.selectHighlightedItem({type:6})}}},Escape:function(e){e.preventDefault(),this.reset(r({type:5},!this.state.isOpen&&{selectedItem:null,inputValue:""}))}},n.buttonKeyDownHandlers=r({},n.keyDownHandlers,{" ":function(e){e.preventDefault(),this.toggleMenu({type:12})}}),n.inputKeyDownHandlers=r({},n.keyDownHandlers,{Home:function(e){var t=this.getState().isOpen;if(t){e.preventDefault();var n=this.getItemCount();if(!(n<=0)&&t){var i=Ke(0,!1,{length:n},this.isItemDisabled);this.setHighlightedIndex(i,{type:7})}}},End:function(e){var t=this.getState().isOpen;if(t){e.preventDefault();var n=this.getItemCount();if(!(n<=0)&&t){var i=Ke(n-1,!0,{length:n},this.isItemDisabled);this.setHighlightedIndex(i,{type:8})}}}}),n.getToggleButtonProps=function(e){var t=void 0===e?{}:e,i=t.onClick;t.onPress;var u=t.onKeyDown,s=t.onKeyUp,a=t.onBlur,l=o(t,_e),c=n.getState().isOpen,d={onClick:xe(i,n.buttonHandleClick),onKeyDown:xe(u,n.buttonHandleKeyDown),onKeyUp:xe(s,n.buttonHandleKeyUp),onBlur:xe(a,n.buttonHandleBlur)};return r({type:"button",role:"button","aria-label":c?"close menu":"open menu","aria-haspopup":!0,"data-toggle":!0},l.disabled?{}:d,l)},n.buttonHandleKeyUp=function(e){e.preventDefault()},n.buttonHandleKeyDown=function(e){var t=Pe(e);n.buttonKeyDownHandlers[t]&&n.buttonKeyDownHandlers[t].call(u(n),e)},n.buttonHandleClick=function(e){e.preventDefault(),n.props.environment.document.activeElement===n.props.environment.document.body&&e.target.focus(),n.internalSetTimeout((function(){return n.toggleMenu({type:13})}))},n.buttonHandleBlur=function(e){var t=e.target;n.internalSetTimeout((function(){n.isMouseDown||null!=n.props.environment.document.activeElement&&n.props.environment.document.activeElement.id===n.inputId||n.props.environment.document.activeElement===t||n.reset({type:14})}))},n.getLabelProps=function(e){return r({htmlFor:n.inputId,id:n.labelId},e)},n.getInputProps=function(e){var t=void 0===e?{}:e,i=t.onKeyDown,u=t.onBlur,s=t.onChange,a=t.onInput;t.onChangeText;var l=o(t,Fe),c={};var d,p=n.getState(),f=p.inputValue,g=p.isOpen,h=p.highlightedIndex;l.disabled||((d={}).onChange=xe(s,a,n.inputHandleChange),d.onKeyDown=xe(i,n.inputHandleKeyDown),d.onBlur=xe(u,n.inputHandleBlur),c=d);return r({"aria-autocomplete":"list","aria-activedescendant":g&&"number"==typeof h&&h>=0?n.getItemId(h):void 0,"aria-controls":g?n.menuId:void 0,"aria-labelledby":l&&l["aria-label"]?void 0:n.labelId,autoComplete:"off",value:f,id:n.inputId},c,l)},n.inputHandleKeyDown=function(e){var t=Pe(e);t&&n.inputKeyDownHandlers[t]&&n.inputKeyDownHandlers[t].call(u(n),e)},n.inputHandleChange=function(e){n.internalSetState({type:11,isOpen:!0,inputValue:e.target.value,highlightedIndex:n.props.defaultHighlightedIndex})},n.inputHandleBlur=function(){n.internalSetTimeout((function(){var e=n.props.environment.document&&!!n.props.environment.document.activeElement&&!!n.props.environment.document.activeElement.dataset&&n.props.environment.document.activeElement.dataset.toggle&&n._rootNode&&n._rootNode.contains(n.props.environment.document.activeElement);n.isMouseDown||e||n.reset({type:10})}))},n.menuRef=function(e){n._menuNode=e},n.getMenuProps=function(e,t){var i,u=void 0===e?{}:e,s=u.refKey,a=void 0===s?"ref":s,l=u.ref,c=o(u,$e),d=(void 0===t?{}:t).suppressRefError,p=void 0!==d&&d;return n.getMenuProps.called=!0,n.getMenuProps.refKey=a,n.getMenuProps.suppressRefError=p,r(((i={})[a]=we(l,n.menuRef),i.role="listbox",i["aria-labelledby"]=c&&c["aria-label"]?void 0:n.labelId,i.id=n.menuId,i),c)},n.getItemProps=function(e){var t,i=void 0===e?{}:e,u=i.onMouseMove,s=i.onMouseDown,a=i.onClick;i.onPress;var l=i.index,c=i.item,d=void 0===c?void 0:c,p=o(i,Ne);void 0===l?(n.items.push(d),l=n.items.indexOf(d)):n.items[l]=d;var f=a,g=((t={onMouseMove:xe(u,(function(){l!==n.getState().highlightedIndex&&(n.setHighlightedIndex(l,{type:2}),n.avoidScrolling=!0,n.internalSetTimeout((function(){return n.avoidScrolling=!1}),250))})),onMouseDown:xe(s,(function(e){e.preventDefault()}))}).onClick=xe(f,(function(){n.selectItemAtIndex(l,{type:9})})),t),h=p.disabled?{onMouseDown:g.onMouseDown}:g;return r({id:n.getItemId(l),role:"option","aria-selected":n.getState().highlightedIndex===l},h,p)},n.clearItems=function(){n.items=[]},n.reset=function(e,t){void 0===e&&(e={}),e=Oe(e),n.internalSetState((function(t){var i=t.selectedItem;return r({isOpen:n.props.defaultIsOpen,highlightedIndex:n.props.defaultHighlightedIndex,inputValue:n.props.itemToString(i)},e)}),t)},n.toggleMenu=function(e,t){void 0===e&&(e={}),e=Oe(e),n.internalSetState((function(t){var i=t.isOpen;return r({isOpen:!i},i&&{highlightedIndex:n.props.defaultHighlightedIndex},e)}),(function(){var i=n.getState(),o=i.isOpen,r=i.highlightedIndex;o&&n.getItemCount()>0&&"number"==typeof r&&n.setHighlightedIndex(r,e),me(t)()}))},n.openMenu=function(e){n.internalSetState({isOpen:!0},e)},n.closeMenu=function(e){n.internalSetState({isOpen:!1},e)},n.updateStatus=be((function(){var e=n.getState(),t=n.items[e.highlightedIndex],i=n.getItemCount(),o=n.props.getA11yStatusMessage(r({itemToString:n.props.itemToString,previousResultCount:n.previousResultCount,resultCount:i,highlightedItem:t},e));n.previousResultCount=i,Ve(o,n.props.environment.document)}),200);var i=n.props,s=i.defaultHighlightedIndex,a=i.initialHighlightedIndex,l=void 0===a?s:a,c=i.defaultIsOpen,d=i.initialIsOpen,p=void 0===d?c:d,f=i.initialInputValue,g=void 0===f?"":f,h=i.initialSelectedItem,m=void 0===h?null:h,I=n.getState({highlightedIndex:l,isOpen:p,inputValue:g,selectedItem:m});return null!=I.selectedItem&&void 0===n.props.initialInputValue&&(I.inputValue=n.props.itemToString(I.selectedItem)),n.state=I,n}i=e,(n=a).prototype=Object.create(i.prototype),n.prototype.constructor=n,s(n,i);var l=a.prototype;return l.internalClearTimeouts=function(){this.timeoutIds.forEach((function(e){clearTimeout(e)})),this.timeoutIds=[]},l.getState=function(e){return void 0===e&&(e=this.state),Me(e,this.props)},l.getItemCount=function(){var e=this.items.length;return null!=this.itemCount?e=this.itemCount:void 0!==this.props.itemCount&&(e=this.props.itemCount),e},l.getItemNodeFromIndex=function(e){return this.props.environment.document.getElementById(this.getItemId(e))},l.scrollHighlightedItemIntoView=function(){var e=this.getItemNodeFromIndex(this.getState().highlightedIndex);this.props.scrollIntoView(e,this._menuNode)},l.moveHighlightedIndex=function(e,t){var n=this.getItemCount(),i=this.getState().highlightedIndex;if(n>0){var o=Re(i,e,{length:n},this.isItemDisabled,!0);this.setHighlightedIndex(o,t)}},l.getStateAndHelpers=function(){var e=this.getState(),t=e.highlightedIndex,n=e.inputValue,i=e.selectedItem,o=e.isOpen,r=this.props.itemToString,u=this.id,s=this.getRootProps,a=this.getToggleButtonProps,l=this.getLabelProps,c=this.getMenuProps,d=this.getInputProps,p=this.getItemProps,f=this.openMenu,g=this.closeMenu,h=this.toggleMenu,m=this.selectItem,I=this.selectItemAtIndex,v=this.selectHighlightedItem,y=this.setHighlightedIndex,b=this.clearSelection,x=this.clearItems;return{getRootProps:s,getToggleButtonProps:a,getLabelProps:l,getMenuProps:c,getInputProps:d,getItemProps:p,reset:this.reset,openMenu:f,closeMenu:g,toggleMenu:h,selectItem:m,selectItemAtIndex:I,selectHighlightedItem:v,setHighlightedIndex:y,clearSelection:b,clearItems:x,setItemCount:this.setItemCount,unsetItemCount:this.unsetItemCount,setState:this.internalSetState,itemToString:r,id:u,highlightedIndex:t,inputValue:n,isOpen:o,selectedItem:i}},l.componentDidMount=function(){var e=this,t=function(){e.isMouseDown=!0},n=function(t){e.isMouseDown=!1,!Te(t.target,[e._rootNode,e._menuNode],e.props.environment)&&e.getState().isOpen&&e.reset({type:1},(function(){return e.props.onOuterClick(e.getStateAndHelpers())}))},i=function(){e.isTouchMove=!1},o=function(){e.isTouchMove=!0},r=function(t){var n=Te(t.target,[e._rootNode,e._menuNode],e.props.environment,!1);e.isTouchMove||n||!e.getState().isOpen||e.reset({type:16},(function(){return e.props.onOuterClick(e.getStateAndHelpers())}))},u=this.props.environment;u.addEventListener("mousedown",t),u.addEventListener("mouseup",n),u.addEventListener("touchstart",i),u.addEventListener("touchmove",o),u.addEventListener("touchend",r),this.cleanup=function(){e.internalClearTimeouts(),e.updateStatus.cancel(),u.removeEventListener("mousedown",t),u.removeEventListener("mouseup",n),u.removeEventListener("touchstart",i),u.removeEventListener("touchmove",o),u.removeEventListener("touchend",r)}},l.shouldScroll=function(e,t){var n=(void 0===this.props.highlightedIndex?this.getState():this.props).highlightedIndex,i=(void 0===t.highlightedIndex?e:t).highlightedIndex;return n&&this.getState().isOpen&&!e.isOpen||n!==i},l.componentDidUpdate=function(e,t){Ee(this.props,"selectedItem")&&this.props.selectedItemChanged(e.selectedItem,this.props.selectedItem)&&this.internalSetState({type:15,inputValue:this.props.itemToString(this.props.selectedItem)}),!this.avoidScrolling&&this.shouldScroll(t,e)&&this.scrollHighlightedItemIntoView(),this.updateStatus()},l.componentWillUnmount=function(){this.cleanup()},l.render=function(){var e=ke(this.props.children,Ie);this.clearItems(),this.getRootProps.called=!1,this.getRootProps.refKey=void 0,this.getRootProps.suppressRefError=void 0,this.getMenuProps.called=!1,this.getMenuProps.refKey=void 0,this.getMenuProps.suppressRefError=void 0,this.getLabelProps.called=!1,this.getInputProps.called=!1;var n=ke(e(this.getStateAndHelpers()));return n?this.getRootProps.called||this.props.suppressRefError?n:function(e){return"string"==typeof e.type}(n)?t.cloneElement(n,this.getRootProps(function(e){return e.props}(n))):void 0:null},a}(t.Component);return e.defaultProps={defaultHighlightedIndex:null,defaultIsOpen:!1,getA11yStatusMessage:Ce,itemToString:function(e){return null==e?"":String(e)},onStateChange:Ie,onInputValueChange:Ie,onUserAction:Ie,onChange:Ie,onSelect:Ie,onOuterClick:Ie,selectedItemChanged:function(e,t){return e!==t},environment:"undefined"==typeof window?{}:window,stateReducer:function(e,t){return t},suppressRefError:!1,scrollIntoView:ve},e.stateChangeTypes=Be,e}(),Ue=je,We=["isInitialMount","highlightedIndex","items","environment"],qe={highlightedIndex:-1,isOpen:!1,selectedItem:null,inputValue:""};function ze(e,t,n){var i=e.props,o=e.type,u={};Object.keys(t).forEach((function(i){!function(e,t,n,i){var o=t.props,u=t.type,s="on"+Qe(e)+"Change";o[s]&&void 0!==i[e]&&i[e]!==n[e]&&o[s](r({type:u},i))}(i,e,t,n),n[i]!==t[i]&&(u[i]=n[i])})),i.onStateChange&&Object.keys(u).length&&i.onStateChange(r({type:o},u))}var Ye=be((function(e,t){Ve(e(),t)}),200),Xe="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement?t.useLayoutEffect:t.useEffect,Ge="useId"in i.default?function(e){var n=e.id,o=e.labelId,r=e.menuId,u=e.getItemId,s=e.toggleButtonId,a=e.inputId,l="downshift-"+i.default.useId();return n||(n=l),t.useRef({labelId:o||n+"-label",menuId:r||n+"-menu",getItemId:u||function(e){return n+"-item-"+e},toggleButtonId:s||n+"-toggle-button",inputId:a||n+"-input"}).current}:function(e){var n=e.id,i=void 0===n?"downshift-"+Se():n,o=e.labelId,r=e.menuId,u=e.getItemId,s=e.toggleButtonId,a=e.inputId;return t.useRef({labelId:o||i+"-label",menuId:r||i+"-menu",getItemId:u||function(e){return i+"-item-"+e},toggleButtonId:s||i+"-toggle-button",inputId:a||i+"-input"}).current};function Je(e,t,n,i){var o,r;if(void 0===e){if(void 0===t)throw new Error(i);o=n[t],r=t}else r=void 0===t?n.indexOf(e):t,o=e;return[o,r]}function Qe(e){return""+e.slice(0,1).toUpperCase()+e.slice(1)}function Ze(e){var n=t.useRef(e);return n.current=e,n}function et(e,n,i){var o=t.useRef(),u=t.useRef(),s=t.useCallback((function(t,n){u.current=n,t=Me(t,n.props);var i=e(t,n);return n.props.stateReducer(t,r({},n,{changes:i}))}),[e]),a=t.useReducer(s,n),l=a[0],c=a[1],d=Ze(i),p=t.useCallback((function(e){return c(r({props:d.current},e))}),[d]),f=u.current;return t.useEffect((function(){f&&o.current&&o.current!==l&&ze(f,Me(o.current,f.props),l),o.current=l}),[l,i,f]),[l,p]}function tt(e,t,n){var i=et(e,t,n),o=i[0],r=i[1];return[Me(o,n),r]}var nt={itemToString:function(e){return e?String(e):""},stateReducer:function(e,t){return t.changes},getA11ySelectionMessage:function(e){var t=e.selectedItem,n=e.itemToString;return t?n(t)+" has been selected.":""},scrollIntoView:ve,environment:"undefined"==typeof window?{}:window};function it(e,t,n){void 0===n&&(n=qe);var i=e["default"+Qe(t)];return void 0!==i?i:n[t]}function ot(e,t,n){void 0===n&&(n=qe);var i=e[t];if(void 0!==i)return i;var o=e["initial"+Qe(t)];return void 0!==o?o:it(e,t,n)}function rt(e){var t=ot(e,"selectedItem"),n=ot(e,"isOpen"),i=ot(e,"highlightedIndex"),o=ot(e,"inputValue");return{highlightedIndex:i<0&&t&&n?e.items.indexOf(t):i,isOpen:n,selectedItem:t,inputValue:o}}function ut(e,t,n){var i=e.items,o=e.initialHighlightedIndex,r=e.defaultHighlightedIndex,u=t.selectedItem,s=t.highlightedIndex;return 0===i.length?-1:void 0!==o&&s===o?o:void 0!==r?r:u?i.indexOf(u):0===n?-1:n<0?i.length-1:0}function st(e,n,i,o){var r=t.useRef({isMouseDown:!1,isTouchMove:!1});return t.useEffect((function(){if(null!=(null==i?void 0:i.addEventListener)){var t=function(){r.current.isMouseDown=!0},u=function(t){r.current.isMouseDown=!1,e&&!Te(t.target,n.map((function(e){return e.current})),i)&&o()},s=function(){r.current.isTouchMove=!1},a=function(){r.current.isTouchMove=!0},l=function(t){!e||r.current.isTouchMove||Te(t.target,n.map((function(e){return e.current})),i,!1)||o()};return i.addEventListener("mousedown",t),i.addEventListener("mouseup",u),i.addEventListener("touchstart",s),i.addEventListener("touchmove",a),i.addEventListener("touchend",l),function(){i.removeEventListener("mousedown",t),i.removeEventListener("mouseup",u),i.removeEventListener("touchstart",s),i.removeEventListener("touchmove",a),i.removeEventListener("touchend",l)}}}),[e,i]),r}var at=function(){return Ie};function lt(e,n,i){var u=i.isInitialMount,s=i.highlightedIndex,a=i.items,l=i.environment,c=o(i,We);t.useEffect((function(){u||Ye((function(){return e(r({highlightedIndex:s,highlightedItem:a[s],resultCount:a.length},c))}),l.document)}),n)}function ct(e){var n=e.highlightedIndex,i=e.isOpen,o=e.itemRefs,r=e.getItemNodeFromIndex,u=e.menuElement,s=e.scrollIntoView,a=t.useRef(!0);return Xe((function(){n<0||!i||!Object.keys(o.current).length||(!1===a.current?a.current=!0:s(r(n),u))}),[n]),a}var dt=Ie;function pt(e,t,n){var i;return void 0===n&&(n=!0),r({isOpen:!1,highlightedIndex:-1},(null==(i=e.items)?void 0:i.length)&&t>=0&&r({selectedItem:e.items[t],isOpen:it(e,"isOpen"),highlightedIndex:it(e,"highlightedIndex")},n&&{inputValue:e.itemToString(e.items[t])}))}var ft={environment:T.shape({addEventListener:T.func.isRequired,removeEventListener:T.func.isRequired,document:T.shape({createElement:T.func.isRequired,getElementById:T.func.isRequired,activeElement:T.any.isRequired,body:T.any.isRequired}).isRequired,Node:T.func.isRequired}),itemToString:T.func,stateReducer:T.func},gt=r({},ft,{getA11yStatusMessage:T.func,highlightedIndex:T.number,defaultHighlightedIndex:T.number,initialHighlightedIndex:T.number,isOpen:T.bool,defaultIsOpen:T.bool,initialIsOpen:T.bool,selectedItem:T.any,initialSelectedItem:T.any,defaultSelectedItem:T.any,id:T.string,labelId:T.string,menuId:T.string,getItemId:T.func,toggleButtonId:T.string,onSelectedItemChange:T.func,onHighlightedIndexChange:T.func,onStateChange:T.func,onIsOpenChange:T.func,scrollIntoView:T.func});function ht(e,t,n){var i,o=t.type,u=t.props;switch(o){case n.ItemMouseMove:i={highlightedIndex:t.disabled?-1:t.index};break;case n.MenuMouseLeave:i={highlightedIndex:-1};break;case n.ToggleButtonClick:case n.FunctionToggleMenu:i={isOpen:!e.isOpen,highlightedIndex:e.isOpen?-1:ut(u,e,0)};break;case n.FunctionOpenMenu:i={isOpen:!0,highlightedIndex:ut(u,e,0)};break;case n.FunctionCloseMenu:i={isOpen:!1};break;case n.FunctionSetHighlightedIndex:i={highlightedIndex:t.highlightedIndex};break;case n.FunctionSetInputValue:i={inputValue:t.inputValue};break;case n.FunctionReset:i={highlightedIndex:it(u,"highlightedIndex"),isOpen:it(u,"isOpen"),selectedItem:it(u,"selectedItem"),inputValue:it(u,"inputValue")};break;default:throw new Error("Reducer called without proper action type.")}return r({},e,i)}var mt=function(){return mt=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},mt.apply(this,arguments)};"function"==typeof SuppressedError&&SuppressedError,mt(mt({},gt),{items:T.array.isRequired,isItemDisabled:T.func,getA11ySelectionMessage:T.func});var It=mt(mt({},nt),{getA11yStatusMessage:function(e){var t=e.isOpen,n=e.resultCount,i=e.previousResultCount;return t?n?n!==i?"".concat(n," result").concat(1===n?" is":"s are"," available, use up and down arrow keys to navigate. Press Enter or Space Bar keys to select."):"":"No results are available.":""},isItemDisabled:function(){return!1}}),vt=Ie,yt=1,bt=2,xt=3,wt=4,St=5,Ct=6,kt=7,Dt=8,Ot=9,Mt=10,Et=11,Pt=14,Rt=19,Kt=Object.freeze({__proto__:null,ToggleButtonClick:0,ToggleButtonKeyDownArrowDown:yt,ToggleButtonKeyDownArrowUp:bt,ToggleButtonKeyDownCharacter:xt,ToggleButtonKeyDownEscape:wt,ToggleButtonKeyDownHome:St,ToggleButtonKeyDownEnd:Ct,ToggleButtonKeyDownEnter:kt,ToggleButtonKeyDownSpaceButton:Dt,ToggleButtonKeyDownPageUp:Ot,ToggleButtonKeyDownPageDown:Mt,ToggleButtonBlur:Et,MenuMouseLeave:12,ItemMouseMove:13,ItemClick:Pt,FunctionToggleMenu:15,FunctionOpenMenu:16,FunctionCloseMenu:17,FunctionSetHighlightedIndex:18,FunctionSelectItem:Rt,FunctionSetInputValue:20,FunctionReset:21});function Tt(e,t){var n,i,o=t.type,u=t.props,s=t.altKey;switch(o){case Pt:i={isOpen:it(u,"isOpen"),highlightedIndex:it(u,"highlightedIndex"),selectedItem:u.items[t.index]};break;case xt:var a=t.key,l=""+e.inputValue+a,c=function(e){for(var t=e.keysSoFar,n=e.highlightedIndex,i=e.items,o=e.itemToString,r=e.isItemDisabled,u=t.toLowerCase(),s=0;s<i.length;s++){var a=(s+n+(t.length<2?1:0))%i.length,l=i[a];if(void 0!==l&&o(l).toLowerCase().startsWith(u)&&!r(l,a))return a}return n}({keysSoFar:l,highlightedIndex:!e.isOpen&&e.selectedItem?u.items.indexOf(e.selectedItem):e.highlightedIndex,items:u.items,itemToString:u.itemToString,isItemDisabled:u.isItemDisabled});i={inputValue:l,highlightedIndex:c,isOpen:!0};break;case yt:i={highlightedIndex:e.isOpen?Re(e.highlightedIndex,1,u.items,u.isItemDisabled):s&&null==e.selectedItem?-1:ut(u,e,1),isOpen:!0};break;case bt:if(e.isOpen&&s)i=pt(u,e.highlightedIndex,!1);else i={highlightedIndex:e.isOpen?Re(e.highlightedIndex,-1,u.items,u.isItemDisabled):ut(u,e,-1),isOpen:!0};break;case kt:case Dt:i=pt(u,e.highlightedIndex,!1);break;case St:i={highlightedIndex:Ke(0,!1,u.items,u.isItemDisabled),isOpen:!0};break;case Ct:i={highlightedIndex:Ke(u.items.length-1,!0,u.items,u.isItemDisabled),isOpen:!0};break;case Ot:i={highlightedIndex:Re(e.highlightedIndex,-10,u.items,u.isItemDisabled)};break;case Mt:i={highlightedIndex:Re(e.highlightedIndex,10,u.items,u.isItemDisabled)};break;case wt:i={isOpen:!1,highlightedIndex:-1};break;case Et:i=r({isOpen:!1,highlightedIndex:-1},e.highlightedIndex>=0&&(null==(n=u.items)?void 0:n.length)&&{selectedItem:u.items[e.highlightedIndex]});break;case Rt:i={selectedItem:t.selectedItem};break;default:return ht(e,t,Kt)}return r({},e,i)}var Ht=["onMouseLeave","refKey","onKeyDown","onBlur","ref"],Vt=["onBlur","onClick","onPress","onKeyDown","refKey","ref"],At=["item","index","onMouseMove","onClick","onPress","refKey","disabled","ref"];function Bt(e){void 0===e&&(e={}),vt();var n=r({},It,e),i=n.items,u=n.scrollIntoView,s=n.environment,a=n.itemToString,l=n.getA11ySelectionMessage,c=n.getA11yStatusMessage,d=tt(Tt,rt(n),n),p=d[0],f=d[1],g=p.isOpen,h=p.highlightedIndex,m=p.selectedItem,I=p.inputValue,v=t.useRef(null),y=t.useRef(null),b=t.useRef({}),x=t.useRef(null),w=Ge(n),S=t.useRef(),C=t.useRef(!0),k=Ze({state:p,props:n}),D=t.useCallback((function(e){return b.current[w.getItemId(e)]}),[w]);lt(c,[g,h,I,i],r({isInitialMount:C.current,previousResultCount:S.current,items:i,environment:s,itemToString:a},p)),lt(l,[m],r({isInitialMount:C.current,previousResultCount:S.current,items:i,environment:s,itemToString:a},p));var O=ct({menuElement:y.current,highlightedIndex:h,isOpen:g,itemRefs:b,scrollIntoView:u,getItemNodeFromIndex:D});t.useEffect((function(){return x.current=be((function(e){e({type:20,inputValue:""})}),500),function(){x.current.cancel()}}),[]),t.useEffect((function(){I&&x.current(f)}),[f,I]),dt({isInitialMount:C.current,props:n,state:p}),t.useEffect((function(){C.current||(S.current=i.length)}));var M=st(g,[y,v],s,(function(){f({type:Et})})),E=at();t.useEffect((function(){return C.current=!1,function(){C.current=!0}}),[]),t.useEffect((function(){g||(b.current={})}),[g]);var P=t.useMemo((function(){return{ArrowDown:function(e){e.preventDefault(),f({type:yt,altKey:e.altKey})},ArrowUp:function(e){e.preventDefault(),f({type:bt,altKey:e.altKey})},Home:function(e){e.preventDefault(),f({type:St})},End:function(e){e.preventDefault(),f({type:Ct})},Escape:function(){k.current.state.isOpen&&f({type:wt})},Enter:function(e){e.preventDefault(),f({type:k.current.state.isOpen?kt:0})},PageUp:function(e){k.current.state.isOpen&&(e.preventDefault(),f({type:Ot}))},PageDown:function(e){k.current.state.isOpen&&(e.preventDefault(),f({type:Mt}))}," ":function(e){e.preventDefault();var t=k.current.state;t.isOpen?t.inputValue?f({type:xt,key:" "}):f({type:Dt}):f({type:0})}}}),[f,k]),R=t.useCallback((function(){f({type:15})}),[f]),K=t.useCallback((function(){f({type:17})}),[f]),T=t.useCallback((function(){f({type:16})}),[f]),H=t.useCallback((function(e){f({type:18,highlightedIndex:e})}),[f]),V=t.useCallback((function(e){f({type:Rt,selectedItem:e})}),[f]),A=t.useCallback((function(){f({type:21})}),[f]),B=t.useCallback((function(e){f({type:20,inputValue:e})}),[f]),L=t.useCallback((function(e){return r({id:w.labelId,htmlFor:w.toggleButtonId},e)}),[w]),_=t.useCallback((function(e,t){var n,i=void 0===e?{}:e,u=i.onMouseLeave,s=i.refKey,a=void 0===s?"ref":s;i.onKeyDown,i.onBlur;var l=i.ref,c=o(i,Ht),d=(void 0===t?{}:t).suppressRefError;return E("getMenuProps",void 0!==d&&d,a,y),r(((n={})[a]=we(l,(function(e){y.current=e})),n.id=w.menuId,n.role="listbox",n["aria-labelledby"]=c&&c["aria-label"]?void 0:""+w.labelId,n.onMouseLeave=xe(u,(function(){f({type:12})})),n),c)}),[f,E,w]);return{getToggleButtonProps:t.useCallback((function(e,t){var n,i=void 0===e?{}:e,u=i.onBlur,s=i.onClick;i.onPress;var a=i.onKeyDown,l=i.refKey,c=void 0===l?"ref":l,d=i.ref,p=o(i,Vt),g=(void 0===t?{}:t).suppressRefError,h=void 0!==g&&g,m=k.current.state,I=r(((n={})[c]=we(d,(function(e){v.current=e})),n["aria-activedescendant"]=m.isOpen&&m.highlightedIndex>-1?w.getItemId(m.highlightedIndex):"",n["aria-controls"]=w.menuId,n["aria-expanded"]=k.current.state.isOpen,n["aria-haspopup"]="listbox",n["aria-labelledby"]=p&&p["aria-label"]?void 0:""+w.labelId,n.id=w.toggleButtonId,n.role="combobox",n.tabIndex=0,n.onBlur=xe(u,(function(){m.isOpen&&!M.current.isMouseDown&&f({type:Et})})),n),p);return p.disabled||(I.onClick=xe(s,(function(){f({type:0})})),I.onKeyDown=xe(a,(function(e){var t=Pe(e);t&&P[t]?P[t](e):function(e){return/^\S{1}$/.test(e)}(t)&&f({type:xt,key:t})}))),E("getToggleButtonProps",h,c,v),I}),[k,w,E,f,M,P]),getLabelProps:L,getMenuProps:_,getItemProps:t.useCallback((function(e){var t,n=void 0===e?{}:e,i=n.item,u=n.index,s=n.onMouseMove,a=n.onClick;n.onPress;var l=n.refKey,c=void 0===l?"ref":l,d=n.disabled,p=n.ref,g=o(n,At);void 0!==d&&console.warn('Passing "disabled" as an argument to getItemProps is not supported anymore. Please use the isItemDisabled prop from useSelect.');var h=k.current,m=h.state,I=h.props,v=Je(i,u,I.items,"Pass either item or index to getItemProps!"),y=v[0],x=v[1],S=I.isItemDisabled(y,x),C=r(((t={})[c]=we(p,(function(e){e&&(b.current[w.getItemId(x)]=e)})),t["aria-disabled"]=S,t["aria-selected"]=""+(y===m.selectedItem),t.id=w.getItemId(x),t.role="option",t),g);return S||(C.onClick=xe(a,(function(){f({type:Pt,index:x})}))),C.onMouseMove=xe(s,(function(){x!==m.highlightedIndex&&(O.current=!1,f({type:13,index:x,disabled:S}))})),C}),[k,w,O,f]),toggleMenu:R,openMenu:T,closeMenu:K,setHighlightedIndex:H,selectItem:V,reset:A,setInputValue:B,highlightedIndex:h,isOpen:g,selectedItem:m,inputValue:I}}Bt.stateChangeTypes=Kt;var Lt=0,_t=1,Ft=2,$t=3,Nt=4,jt=5,Ut=6,Wt=7,qt=8,zt=9,Yt=10,Xt=13,Gt=19,Jt=22,Qt=Object.freeze({__proto__:null,InputKeyDownArrowDown:Lt,InputKeyDownArrowUp:_t,InputKeyDownEscape:Ft,InputKeyDownHome:$t,InputKeyDownEnd:Nt,InputKeyDownPageUp:jt,InputKeyDownPageDown:Ut,InputKeyDownEnter:Wt,InputChange:qt,InputBlur:zt,InputClick:Yt,MenuMouseLeave:11,ItemMouseMove:12,ItemClick:Xt,ToggleButtonClick:14,FunctionToggleMenu:15,FunctionOpenMenu:16,FunctionCloseMenu:17,FunctionSetHighlightedIndex:18,FunctionSelectItem:Gt,FunctionSetInputValue:20,FunctionReset:21,ControlledPropUpdatedSelectedItem:Jt});r({},gt,{items:T.array.isRequired,isItemDisabled:T.func,selectedItemChanged:T.func,getA11ySelectionMessage:T.func,inputValue:T.string,defaultInputValue:T.string,initialInputValue:T.string,inputId:T.string,onInputValueChange:T.func});var Zt=Ie,en=r({},nt,{selectedItemChanged:function(e,t){return e!==t},getA11yStatusMessage:Ce,isItemDisabled:function(){return!1}});function tn(e,t){var n,i,o=t.type,u=t.props,s=t.altKey;switch(o){case Xt:i={isOpen:it(u,"isOpen"),highlightedIndex:it(u,"highlightedIndex"),selectedItem:u.items[t.index],inputValue:u.itemToString(u.items[t.index])};break;case Lt:i=e.isOpen?{highlightedIndex:Re(e.highlightedIndex,1,u.items,u.isItemDisabled,!0)}:{highlightedIndex:s&&null==e.selectedItem?-1:ut(u,e,1),isOpen:u.items.length>=0};break;case _t:i=e.isOpen?s?pt(u,e.highlightedIndex):{highlightedIndex:Re(e.highlightedIndex,-1,u.items,u.isItemDisabled,!0)}:{highlightedIndex:ut(u,e,-1),isOpen:u.items.length>=0};break;case Wt:i=pt(u,e.highlightedIndex);break;case Ft:i=r({isOpen:!1,highlightedIndex:-1},!e.isOpen&&{selectedItem:null,inputValue:""});break;case jt:i={highlightedIndex:Re(e.highlightedIndex,-10,u.items,u.isItemDisabled,!0)};break;case Ut:i={highlightedIndex:Re(e.highlightedIndex,10,u.items,u.isItemDisabled,!0)};break;case $t:i={highlightedIndex:Ke(0,!1,u.items,u.isItemDisabled)};break;case Nt:i={highlightedIndex:Ke(u.items.length-1,!0,u.items,u.isItemDisabled)};break;case zt:i=r({isOpen:!1,highlightedIndex:-1},e.highlightedIndex>=0&&(null==(n=u.items)?void 0:n.length)&&t.selectItem&&{selectedItem:u.items[e.highlightedIndex],inputValue:u.itemToString(u.items[e.highlightedIndex])});break;case qt:i={isOpen:!0,highlightedIndex:it(u,"highlightedIndex"),inputValue:t.inputValue};break;case Yt:i={isOpen:!e.isOpen,highlightedIndex:e.isOpen?-1:ut(u,e,0)};break;case Gt:i={selectedItem:t.selectedItem,inputValue:u.itemToString(t.selectedItem)};break;case Jt:i={inputValue:t.inputValue};break;default:return ht(e,t,Qt)}return r({},e,i)}var nn=["onMouseLeave","refKey","ref"],on=["item","index","refKey","ref","onMouseMove","onMouseDown","onClick","onPress","disabled"],rn=["onClick","onPress","refKey","ref"],un=["onKeyDown","onChange","onInput","onBlur","onChangeText","onClick","refKey","ref"];function sn(e){void 0===e&&(e={}),Zt();var n=r({},en,e),i=n.initialIsOpen,u=n.defaultIsOpen,s=n.items,a=n.scrollIntoView,l=n.environment,c=n.getA11yStatusMessage,d=n.getA11ySelectionMessage,p=n.itemToString,f=function(e){var t=rt(e),n=t.selectedItem,i=t.inputValue;return""===i&&n&&void 0===e.defaultInputValue&&void 0===e.initialInputValue&&void 0===e.inputValue&&(i=e.itemToString(n)),r({},t,{inputValue:i})}(n),g=function(e,n,i){var o=t.useRef(),r=et(e,n,i),u=r[0],s=r[1];return t.useEffect((function(){Ee(i,"selectedItem")&&(i.selectedItemChanged(o.current,i.selectedItem)&&s({type:Jt,inputValue:i.itemToString(i.selectedItem)}),o.current=u.selectedItem===o.current?i.selectedItem:u.selectedItem)}),[u.selectedItem,i.selectedItem]),[Me(u,i),s]}(tn,f,n),h=g[0],m=g[1],I=h.isOpen,v=h.highlightedIndex,y=h.selectedItem,b=h.inputValue,x=t.useRef(null),w=t.useRef({}),S=t.useRef(null),C=t.useRef(null),k=t.useRef(!0),D=Ge(n),O=t.useRef(),M=Ze({state:h,props:n}),E=t.useCallback((function(e){return w.current[D.getItemId(e)]}),[D]);lt(c,[I,v,b,s],r({isInitialMount:k.current,previousResultCount:O.current,items:s,environment:l,itemToString:p},h)),lt(d,[y],r({isInitialMount:k.current,previousResultCount:O.current,items:s,environment:l,itemToString:p},h));var P=ct({menuElement:x.current,highlightedIndex:v,isOpen:I,itemRefs:w,scrollIntoView:a,getItemNodeFromIndex:E});dt({isInitialMount:k.current,props:n,state:h}),t.useEffect((function(){(i||u||I)&&S.current&&S.current.focus()}),[]),t.useEffect((function(){k.current||(O.current=s.length)}));var R=st(I,[S,x,C],l,(function(){m({type:zt,selectItem:!1})})),K=at();t.useEffect((function(){return k.current=!1,function(){k.current=!0}}),[]),t.useEffect((function(){var e;if(I){if((null==(e=l.document)?void 0:e.activeElement)!==S.current){var t;null==S||null==(t=S.current)||t.focus()}}else w.current={}}),[I,l]);var T=t.useMemo((function(){return{ArrowDown:function(e){e.preventDefault(),m({type:Lt,altKey:e.altKey})},ArrowUp:function(e){e.preventDefault(),m({type:_t,altKey:e.altKey})},Home:function(e){M.current.state.isOpen&&(e.preventDefault(),m({type:$t}))},End:function(e){M.current.state.isOpen&&(e.preventDefault(),m({type:Nt}))},Escape:function(e){var t=M.current.state;(t.isOpen||t.inputValue||t.selectedItem||t.highlightedIndex>-1)&&(e.preventDefault(),m({type:Ft}))},Enter:function(e){M.current.state.isOpen&&229!==e.which&&(e.preventDefault(),m({type:Wt}))},PageUp:function(e){M.current.state.isOpen&&(e.preventDefault(),m({type:jt}))},PageDown:function(e){M.current.state.isOpen&&(e.preventDefault(),m({type:Ut}))}}}),[m,M]),H=t.useCallback((function(e){return r({id:D.labelId,htmlFor:D.inputId},e)}),[D]),V=t.useCallback((function(e,t){var n,i=void 0===e?{}:e,u=i.onMouseLeave,s=i.refKey,a=void 0===s?"ref":s,l=i.ref,c=o(i,nn),d=(void 0===t?{}:t).suppressRefError;return K("getMenuProps",void 0!==d&&d,a,x),r(((n={})[a]=we(l,(function(e){x.current=e})),n.id=D.menuId,n.role="listbox",n["aria-labelledby"]=c&&c["aria-label"]?void 0:""+D.labelId,n.onMouseLeave=xe(u,(function(){m({type:11})})),n),c)}),[m,K,D]),A=t.useCallback((function(e){var t,n,i=void 0===e?{}:e,u=i.item,s=i.index,a=i.refKey,l=void 0===a?"ref":a,c=i.ref,d=i.onMouseMove,p=i.onMouseDown,f=i.onClick;i.onPress;var g=i.disabled,h=o(i,on);void 0!==g&&console.warn('Passing "disabled" as an argument to getItemProps is not supported anymore. Please use the isItemDisabled prop from useCombobox.');var I=M.current,v=I.props,y=I.state,b=Je(u,s,v.items,"Pass either item or index to getItemProps!"),x=b[0],S=b[1],C=v.isItemDisabled(x,S),k=f;return r(((t={})[l]=we(c,(function(e){e&&(w.current[D.getItemId(S)]=e)})),t["aria-disabled"]=C,t["aria-selected"]=""+(S===y.highlightedIndex),t.id=D.getItemId(S),t.role="option",t),!C&&((n={}).onClick=xe(k,(function(){m({type:Xt,index:S})})),n),{onMouseMove:xe(d,(function(){S!==y.highlightedIndex&&(P.current=!1,m({type:12,index:S,disabled:C}))})),onMouseDown:xe(p,(function(e){return e.preventDefault()}))},h)}),[m,M,P,D]),B=t.useCallback((function(e){var t,n=void 0===e?{}:e,i=n.onClick;n.onPress;var u=n.refKey,s=void 0===u?"ref":u,a=n.ref,l=o(n,rn),c=M.current.state;return r(((t={})[s]=we(a,(function(e){C.current=e})),t["aria-controls"]=D.menuId,t["aria-expanded"]=c.isOpen,t.id=D.toggleButtonId,t.tabIndex=-1,t),!l.disabled&&r({},{onClick:xe(i,(function(){m({type:14})}))}),l)}),[m,M,D]),L=t.useCallback((function(e,t){var n,i=void 0===e?{}:e,u=i.onKeyDown,s=i.onChange,a=i.onInput,c=i.onBlur;i.onChangeText;var d=i.onClick,p=i.refKey,f=void 0===p?"ref":p,g=i.ref,h=o(i,un),I=(void 0===t?{}:t).suppressRefError;K("getInputProps",void 0!==I&&I,f,S);var v,y=M.current.state,b={};h.disabled||((v={}).onChange=xe(s,a,(function(e){m({type:qt,inputValue:e.target.value})})),v.onKeyDown=xe(u,(function(e){var t=Pe(e);t&&T[t]&&T[t](e)})),v.onBlur=xe(c,(function(e){if(y.isOpen&&!R.current.isMouseDown){var t=null===e.relatedTarget&&l.document.activeElement!==l.document.body;m({type:zt,selectItem:!t})}})),v.onClick=xe(d,(function(){m({type:Yt})})),b=v);return r(((n={})[f]=we(g,(function(e){S.current=e})),n["aria-activedescendant"]=y.isOpen&&y.highlightedIndex>-1?D.getItemId(y.highlightedIndex):"",n["aria-autocomplete"]="list",n["aria-controls"]=D.menuId,n["aria-expanded"]=y.isOpen,n["aria-labelledby"]=h&&h["aria-label"]?void 0:D.labelId,n.autoComplete="off",n.id=D.inputId,n.role="combobox",n.value=y.inputValue,n),b,h)}),[K,M,D,T,m,R,l]),_=t.useCallback((function(){m({type:15})}),[m]),F=t.useCallback((function(){m({type:17})}),[m]),$=t.useCallback((function(){m({type:16})}),[m]),N=t.useCallback((function(e){m({type:18,highlightedIndex:e})}),[m]),j=t.useCallback((function(e){m({type:Gt,selectedItem:e})}),[m]);return{getItemProps:A,getLabelProps:H,getMenuProps:V,getInputProps:L,getToggleButtonProps:B,toggleMenu:_,openMenu:$,closeMenu:F,setHighlightedIndex:N,setInputValue:t.useCallback((function(e){m({type:20,inputValue:e})}),[m]),selectItem:j,reset:t.useCallback((function(){m({type:21})}),[m]),highlightedIndex:v,isOpen:I,selectedItem:y,inputValue:b}}sn.stateChangeTypes=Qt;var an={activeIndex:-1,selectedItems:[]};function ln(e,t){return ot(e,t,an)}function cn(e,t){return it(e,t,an)}function dn(e){if(e.shiftKey||e.metaKey||e.ctrlKey||e.altKey)return!1;var t=e.target;return!(t instanceof HTMLInputElement&&""!==t.value)||0===t.selectionStart&&0===t.selectionEnd}r({},ft,{selectedItems:T.array,initialSelectedItems:T.array,defaultSelectedItems:T.array,getA11yRemovalMessage:T.func,activeIndex:T.number,initialActiveIndex:T.number,defaultActiveIndex:T.number,onActiveIndexChange:T.func,onSelectedItemsChange:T.func,keyNavigationNext:T.string,keyNavigationPrevious:T.string});var pn={itemToString:nt.itemToString,stateReducer:nt.stateReducer,environment:nt.environment,getA11yRemovalMessage:function(e){var t=e.removedSelectedItem;return(0,e.itemToString)(t)+" has been removed."},keyNavigationNext:"ArrowRight",keyNavigationPrevious:"ArrowLeft"},fn=Ie,gn=0,hn=1,mn=2,In=3,vn=4,yn=5,bn=6,xn=7,wn=8,Sn=9,Cn=10,kn=11,Dn=12,On=Object.freeze({__proto__:null,SelectedItemClick:gn,SelectedItemKeyDownDelete:hn,SelectedItemKeyDownBackspace:mn,SelectedItemKeyDownNavigationNext:In,SelectedItemKeyDownNavigationPrevious:vn,DropdownKeyDownNavigationPrevious:yn,DropdownKeyDownBackspace:bn,DropdownClick:xn,FunctionAddSelectedItem:wn,FunctionRemoveSelectedItem:Sn,FunctionSetSelectedItems:Cn,FunctionSetActiveIndex:kn,FunctionReset:Dn});function Mn(e,t){var n,i=t.type,o=t.index,u=t.props,s=t.selectedItem,a=e.activeIndex,l=e.selectedItems;switch(i){case gn:n={activeIndex:o};break;case vn:n={activeIndex:a-1<0?0:a-1};break;case In:n={activeIndex:a+1>=l.length?-1:a+1};break;case mn:case hn:if(a<0)break;var c=a;1===l.length?c=-1:a===l.length-1&&(c=l.length-2),n=r({selectedItems:[].concat(l.slice(0,a),l.slice(a+1))},{activeIndex:c});break;case yn:n={activeIndex:l.length-1};break;case bn:n={selectedItems:l.slice(0,l.length-1)};break;case wn:n={selectedItems:[].concat(l,[s])};break;case xn:n={activeIndex:-1};break;case Sn:var d=a,p=l.indexOf(s);if(p<0)break;1===l.length?d=-1:p===l.length-1&&(d=l.length-2),n={selectedItems:[].concat(l.slice(0,p),l.slice(p+1)),activeIndex:d};break;case Cn:n={selectedItems:t.selectedItems};break;case kn:n={activeIndex:t.activeIndex};break;case Dn:n={activeIndex:cn(u,"activeIndex"),selectedItems:cn(u,"selectedItems")};break;default:throw new Error("Reducer called without proper action type.")}return r({},e,n)}var En=["refKey","ref","onClick","onKeyDown","selectedItem","index"],Pn=["refKey","ref","onKeyDown","onClick","preventKeyAction"];function Rn(e){void 0===e&&(e={}),fn();var n=r({},pn,e),i=n.getA11yRemovalMessage,u=n.itemToString,s=n.environment,a=n.keyNavigationNext,l=n.keyNavigationPrevious,c=tt(Mn,function(e){return{activeIndex:ln(e,"activeIndex"),selectedItems:ln(e,"selectedItems")}}(n),n),d=c[0],p=c[1],f=d.activeIndex,g=d.selectedItems,h=t.useRef(!0),m=t.useRef(null),I=t.useRef(g),v=t.useRef();v.current=[];var y=Ze({state:d,props:n});t.useEffect((function(){if(!h.current){if(g.length<I.current.length){var e=I.current.find((function(e){return g.indexOf(e)<0}));Ve(i({itemToString:u,resultCount:g.length,removedSelectedItem:e,activeIndex:f,activeSelectedItem:g[f]}),s.document)}I.current=g}}),[g.length]),t.useEffect((function(){h.current||(-1===f&&m.current?m.current.focus():v.current[f]&&v.current[f].focus())}),[f]),dt({isInitialMount:h.current,props:n,state:d});var b=at();t.useEffect((function(){return h.current=!1,function(){h.current=!0}}),[]);var x=t.useMemo((function(){var e;return(e={})[l]=function(){p({type:vn})},e[a]=function(){p({type:In})},e.Delete=function(){p({type:hn})},e.Backspace=function(){p({type:mn})},e}),[p,a,l]),w=t.useMemo((function(){var e;return(e={})[l]=function(e){dn(e)&&p({type:yn})},e.Backspace=function(e){dn(e)&&p({type:bn})},e}),[p,l]);return{getSelectedItemProps:t.useCallback((function(e){var t,n=void 0===e?{}:e,i=n.refKey,u=void 0===i?"ref":i,s=n.ref,a=n.onClick,l=n.onKeyDown,c=n.selectedItem,d=n.index,f=o(n,En),g=y.current.state,h=Je(c,d,g.selectedItems,"Pass either item or index to getSelectedItemProps!")[1],m=h>-1&&h===g.activeIndex;return r(((t={})[u]=we(s,(function(e){e&&v.current.push(e)})),t.tabIndex=m?0:-1,t.onClick=xe(a,(function(){p({type:gn,index:h})})),t.onKeyDown=xe(l,(function(e){var t=Pe(e);t&&x[t]&&x[t](e)})),t),f)}),[p,y,x]),getDropdownProps:t.useCallback((function(e,t){var n,i=void 0===e?{}:e,u=i.refKey,s=void 0===u?"ref":u,a=i.ref,l=i.onKeyDown,c=i.onClick,d=i.preventKeyAction,f=void 0!==d&&d,g=o(i,Pn),h=(void 0===t?{}:t).suppressRefError;return b("getDropdownProps",void 0!==h&&h,s,m),r(((n={})[s]=we(a,(function(e){e&&(m.current=e)})),n),!f&&{onKeyDown:xe(l,(function(e){var t=Pe(e);t&&w[t]&&w[t](e)})),onClick:xe(c,(function(){p({type:xn})}))},g)}),[p,w,b]),addSelectedItem:t.useCallback((function(e){p({type:wn,selectedItem:e})}),[p]),removeSelectedItem:t.useCallback((function(e){p({type:Sn,selectedItem:e})}),[p]),setSelectedItems:t.useCallback((function(e){p({type:Cn,selectedItems:e})}),[p]),setActiveIndex:t.useCallback((function(e){p({type:kn,activeIndex:e})}),[p]),reset:t.useCallback((function(){p({type:Dn})}),[p]),selectedItems:g,activeIndex:f}}Rn.stateChangeTypes=On,e.default=Ue,e.resetIdCounter=function(){"useId"in i.default?console.warn("It is not necessary to call resetIdCounter when using React 18+"):he=0},e.useCombobox=sn,e.useMultipleSelection=Rn,e.useSelect=Bt,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("react")):"function"==typeof define&&define.amd?define(["exports","react"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).Downshift={},e.React)}(this,(function(e,t){"use strict";function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var i=n(t);function o(e,t){if(null==e)return{};var n,i,o={},r=Object.keys(e);for(i=0;i<r.length;i++)n=r[i],t.indexOf(n)>=0||(o[n]=e[n]);return o}function r(){return r=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},r.apply(this,arguments)}function u(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function s(e,t){return s=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},s(e,t)}var a={exports:{}},l={},c="function"==typeof Symbol&&Symbol.for,d=c?Symbol.for("react.element"):60103,p=c?Symbol.for("react.portal"):60106,f=c?Symbol.for("react.fragment"):60107,g=c?Symbol.for("react.strict_mode"):60108,h=c?Symbol.for("react.profiler"):60114,m=c?Symbol.for("react.provider"):60109,I=c?Symbol.for("react.context"):60110,v=c?Symbol.for("react.async_mode"):60111,y=c?Symbol.for("react.concurrent_mode"):60111,b=c?Symbol.for("react.forward_ref"):60112,x=c?Symbol.for("react.suspense"):60113,w=c?Symbol.for("react.suspense_list"):60120,S=c?Symbol.for("react.memo"):60115,C=c?Symbol.for("react.lazy"):60116,k=c?Symbol.for("react.block"):60121,D=c?Symbol.for("react.fundamental"):60117,O=c?Symbol.for("react.responder"):60118,M=c?Symbol.for("react.scope"):60119;function E(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case d:switch(e=e.type){case v:case y:case f:case h:case g:case x:return e;default:switch(e=e&&e.$$typeof){case I:case b:case C:case S:case m:return e;default:return t}}case p:return t}}}function P(e){return E(e)===y}l.AsyncMode=v,l.ConcurrentMode=y,l.ContextConsumer=I,l.ContextProvider=m,l.Element=d,l.ForwardRef=b,l.Fragment=f,l.Lazy=C,l.Memo=S,l.Portal=p,l.Profiler=h,l.StrictMode=g,l.Suspense=x,l.isAsyncMode=function(e){return P(e)||E(e)===v},l.isConcurrentMode=P,l.isContextConsumer=function(e){return E(e)===I},l.isContextProvider=function(e){return E(e)===m},l.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===d},l.isForwardRef=function(e){return E(e)===b},l.isFragment=function(e){return E(e)===f},l.isLazy=function(e){return E(e)===C},l.isMemo=function(e){return E(e)===S},l.isPortal=function(e){return E(e)===p},l.isProfiler=function(e){return E(e)===h},l.isStrictMode=function(e){return E(e)===g},l.isSuspense=function(e){return E(e)===x},l.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===f||e===y||e===h||e===g||e===x||e===w||"object"==typeof e&&null!==e&&(e.$$typeof===C||e.$$typeof===S||e.$$typeof===m||e.$$typeof===I||e.$$typeof===b||e.$$typeof===D||e.$$typeof===O||e.$$typeof===M||e.$$typeof===k)},l.typeOf=E;function R(){}function K(){}K.resetWarningCache=R;a.exports=function(){function e(e,t,n,i,o,r){if("SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"!==r){var u=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw u.name="Invariant Violation",u}}function t(){return e}e.isRequired=e;var n={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:K,resetWarningCache:R};return n.PropTypes=n,n}();var T=a.exports,H={},V=60103,A=60106,B=60107,L=60108,_=60114,F=60109,$=60110,N=60112,j=60113,U=60120,W=60115,q=60116,z=60121,Y=60122,X=60117,G=60129,J=60131;if("function"==typeof Symbol&&Symbol.for){var Q=Symbol.for;V=Q("react.element"),A=Q("react.portal"),B=Q("react.fragment"),L=Q("react.strict_mode"),_=Q("react.profiler"),F=Q("react.provider"),$=Q("react.context"),N=Q("react.forward_ref"),j=Q("react.suspense"),U=Q("react.suspense_list"),W=Q("react.memo"),q=Q("react.lazy"),z=Q("react.block"),Y=Q("react.server.block"),X=Q("react.fundamental"),G=Q("react.debug_trace_mode"),J=Q("react.legacy_hidden")}function Z(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case V:switch(e=e.type){case B:case _:case L:case j:case U:return e;default:switch(e=e&&e.$$typeof){case $:case N:case q:case W:case F:return e;default:return t}}case A:return t}}}var ee=F,te=V,ne=N,ie=B,oe=q,re=W,ue=A,se=_,ae=L,le=j;H.ContextConsumer=$,H.ContextProvider=ee,H.Element=te,H.ForwardRef=ne,H.Fragment=ie,H.Lazy=oe,H.Memo=re,H.Portal=ue,H.Profiler=se,H.StrictMode=ae,H.Suspense=le,H.isAsyncMode=function(){return!1},H.isConcurrentMode=function(){return!1},H.isContextConsumer=function(e){return Z(e)===$},H.isContextProvider=function(e){return Z(e)===F},H.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===V},H.isForwardRef=function(e){return Z(e)===N},H.isFragment=function(e){return Z(e)===B},H.isLazy=function(e){return Z(e)===q},H.isMemo=function(e){return Z(e)===W},H.isPortal=function(e){return Z(e)===A},H.isProfiler=function(e){return Z(e)===_},H.isStrictMode=function(e){return Z(e)===L},H.isSuspense=function(e){return Z(e)===j},H.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===B||e===_||e===G||e===L||e===j||e===U||e===J||"object"==typeof e&&null!==e&&(e.$$typeof===q||e.$$typeof===W||e.$$typeof===F||e.$$typeof===$||e.$$typeof===N||e.$$typeof===X||e.$$typeof===z||e[0]===Y)},H.typeOf=Z;let ce=e=>"object"==typeof e&&null!=e&&1===e.nodeType,de=(e,t)=>(!t||"hidden"!==e)&&"visible"!==e&&"clip"!==e,pe=(e,t)=>{if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){let n=getComputedStyle(e,null);return de(n.overflowY,t)||de(n.overflowX,t)||(e=>{let t=(e=>{if(!e.ownerDocument||!e.ownerDocument.defaultView)return null;try{return e.ownerDocument.defaultView.frameElement}catch(e){return null}})(e);return!!t&&(t.clientHeight<e.scrollHeight||t.clientWidth<e.scrollWidth)})(e)}return!1},fe=(e,t,n,i,o,r,u,s)=>r<e&&u>t||r>e&&u<t?0:r<=e&&s<=n||u>=t&&s>=n?r-e-i:u>t&&s<n||r<e&&s>n?u-t+o:0,ge=e=>{let t=e.parentElement;return null==t?e.getRootNode().host||null:t};var he=0;function me(e){return"function"==typeof e?e:Ie}function Ie(){}function ve(e,t){if(e){var n=((e,t)=>{var n,i,o,r,u,s;if("undefined"==typeof document)return[];let{scrollMode:a,block:l,inline:c,boundary:d,skipOverflowHiddenElements:p}=t,f="function"==typeof d?d:e=>e!==d;if(!ce(e))throw new TypeError("Invalid target");let g=document.scrollingElement||document.documentElement,h=[],m=e;for(;ce(m)&&f(m);){if(m=ge(m),m===g){h.push(m);break}null!=m&&m===document.body&&pe(m)&&!pe(document.documentElement)||null!=m&&pe(m,p)&&h.push(m)}let I=null!=(i=null==(n=window.visualViewport)?void 0:n.width)?i:innerWidth,v=null!=(r=null==(o=window.visualViewport)?void 0:o.height)?r:innerHeight,y=null!=(u=window.scrollX)?u:pageXOffset,b=null!=(s=window.scrollY)?s:pageYOffset,{height:x,width:w,top:S,right:C,bottom:k,left:D}=e.getBoundingClientRect(),O="start"===l||"nearest"===l?S:"end"===l?k:S+x/2,M="center"===c?D+w/2:"end"===c?C:D,E=[];for(let e=0;e<h.length;e++){let t=h[e],{height:n,width:i,top:o,right:r,bottom:u,left:s}=t.getBoundingClientRect();if("if-needed"===a&&S>=0&&D>=0&&k<=v&&C<=I&&S>=o&&k<=u&&D>=s&&C<=r)return E;let d=getComputedStyle(t),p=parseInt(d.borderLeftWidth,10),f=parseInt(d.borderTopWidth,10),m=parseInt(d.borderRightWidth,10),P=parseInt(d.borderBottomWidth,10),R=0,K=0,T="offsetWidth"in t?t.offsetWidth-t.clientWidth-p-m:0,H="offsetHeight"in t?t.offsetHeight-t.clientHeight-f-P:0,V="offsetWidth"in t?0===t.offsetWidth?0:i/t.offsetWidth:0,A="offsetHeight"in t?0===t.offsetHeight?0:n/t.offsetHeight:0;if(g===t)R="start"===l?O:"end"===l?O-v:"nearest"===l?fe(b,b+v,v,f,P,b+O,b+O+x,x):O-v/2,K="start"===c?M:"center"===c?M-I/2:"end"===c?M-I:fe(y,y+I,I,p,m,y+M,y+M+w,w),R=Math.max(0,R+b),K=Math.max(0,K+y);else{R="start"===l?O-o-f:"end"===l?O-u+P+H:"nearest"===l?fe(o,u,n,f,P+H,O,O+x,x):O-(o+n/2)+H/2,K="start"===c?M-s-p:"center"===c?M-(s+i/2)+T/2:"end"===c?M-r+m+T:fe(s,r,i,p,m+T,M,M+w,w);let{scrollLeft:e,scrollTop:a}=t;R=Math.max(0,Math.min(a+R/A,t.scrollHeight-n/A+H)),K=Math.max(0,Math.min(e+K/V,t.scrollWidth-i/V+T)),O+=a-R,M+=e-K}E.push({el:t,top:R,left:K})}return E})(e,{boundary:t,block:"nearest",scrollMode:"if-needed"});n.forEach((function(e){var t=e.el,n=e.top,i=e.left;t.scrollTop=n,t.scrollLeft=i}))}}function ye(e,t,n){return e===t||t instanceof n.Node&&e.contains&&e.contains(t)}function be(e,t){var n;function i(){n&&clearTimeout(n)}function o(){for(var o=arguments.length,r=new Array(o),u=0;u<o;u++)r[u]=arguments[u];i(),n=setTimeout((function(){n=null,e.apply(void 0,r)}),t)}return o.cancel=i,o}function xe(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e){for(var n=arguments.length,i=new Array(n>1?n-1:0),o=1;o<n;o++)i[o-1]=arguments[o];return t.some((function(t){return t&&t.apply(void 0,[e].concat(i)),e.preventDownshiftDefault||e.hasOwnProperty("nativeEvent")&&e.nativeEvent.preventDownshiftDefault}))}}function we(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e){t.forEach((function(t){"function"==typeof t?t(e):t&&(t.current=e)}))}}function Se(){return String(he++)}function Ce(e){var t=e.isOpen,n=e.resultCount,i=e.previousResultCount;return t?n?n!==i?n+" result"+(1===n?" is":"s are")+" available, use up and down arrow keys to navigate. Press Enter key to select.":"":"No results are available.":""}function ke(e,t){return!(e=Array.isArray(e)?e[0]:e)&&t?t:e}var De=["highlightedIndex","inputValue","isOpen","selectedItem","type"];function Oe(e){void 0===e&&(e={});var t={};return De.forEach((function(n){e.hasOwnProperty(n)&&(t[n]=e[n])})),t}function Me(e,t){return Object.keys(e).reduce((function(n,i){return n[i]=Ee(t,i)?t[i]:e[i],n}),{})}function Ee(e,t){return void 0!==e[t]}function Pe(e){var t=e.key,n=e.keyCode;return n>=37&&n<=40&&0!==t.indexOf("Arrow")?"Arrow"+t:t}function Re(e,t,n,i,o){void 0===o&&(o=!1);var r=n.length;if(0===r)return-1;var u=r-1;("number"!=typeof e||e<0||e>u)&&(e=t>0?-1:u+1);var s=e+t;s<0?s=o?u:0:s>u&&(s=o?0:u);var a=Ke(s,t<0,n,i,o);return-1===a?e>=r?-1:e:a}function Ke(e,t,n,i,o){void 0===o&&(o=!1);var r=n.length;if(t){for(var u=e;u>=0;u--)if(!i(n[u],u))return u}else for(var s=e;s<r;s++)if(!i(n[s],s))return s;return o?Ke(t?r-1:0,t,n,i):-1}function Te(e,t,n,i){return void 0===i&&(i=!0),t.some((function(t){return t&&(ye(t,e,n)||i&&ye(t,n.document.activeElement,n))}))}var He=be((function(e){Ae(e).textContent=""}),500);function Ve(e,t){var n=Ae(t);e&&(n.textContent=e,He(t))}function Ae(e){void 0===e&&(e=document);var t=e.getElementById("a11y-status-message");return t||((t=e.createElement("div")).setAttribute("id","a11y-status-message"),t.setAttribute("role","status"),t.setAttribute("aria-live","polite"),t.setAttribute("aria-relevant","additions text"),Object.assign(t.style,{border:"0",clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:"0",position:"absolute",width:"1px"}),e.body.appendChild(t),t)}var Be=Object.freeze({__proto__:null,unknown:0,mouseUp:1,itemMouseEnter:2,keyDownArrowUp:3,keyDownArrowDown:4,keyDownEscape:5,keyDownEnter:6,keyDownHome:7,keyDownEnd:8,clickItem:9,blurInput:10,changeInput:11,keyDownSpaceButton:12,clickButton:13,blurButton:14,controlledPropUpdatedSelectedItem:15,touchEnd:16}),Le=["refKey","ref"],_e=["onClick","onPress","onKeyDown","onKeyUp","onBlur"],Fe=["onKeyDown","onBlur","onChange","onInput","onChangeText"],$e=["refKey","ref"],Ne=["onMouseMove","onMouseDown","onClick","onPress","index","item"],je=function(){var e=function(e){var n,i;function a(t){var n=e.call(this,t)||this;n.id=n.props.id||"downshift-"+Se(),n.menuId=n.props.menuId||n.id+"-menu",n.labelId=n.props.labelId||n.id+"-label",n.inputId=n.props.inputId||n.id+"-input",n.getItemId=n.props.getItemId||function(e){return n.id+"-item-"+e},n.input=null,n.items=[],n.itemCount=null,n.previousResultCount=0,n.timeoutIds=[],n.internalSetTimeout=function(e,t){var i=setTimeout((function(){n.timeoutIds=n.timeoutIds.filter((function(e){return e!==i})),e()}),t);n.timeoutIds.push(i)},n.setItemCount=function(e){n.itemCount=e},n.unsetItemCount=function(){n.itemCount=null},n.isItemDisabled=function(e,t){var i=n.getItemNodeFromIndex(t);return i&&i.hasAttribute("disabled")},n.setHighlightedIndex=function(e,t){void 0===e&&(e=n.props.defaultHighlightedIndex),void 0===t&&(t={}),t=Oe(t),n.internalSetState(r({highlightedIndex:e},t))},n.clearSelection=function(e){n.internalSetState({selectedItem:null,inputValue:"",highlightedIndex:n.props.defaultHighlightedIndex,isOpen:n.props.defaultIsOpen},e)},n.selectItem=function(e,t,i){t=Oe(t),n.internalSetState(r({isOpen:n.props.defaultIsOpen,highlightedIndex:n.props.defaultHighlightedIndex,selectedItem:e,inputValue:n.props.itemToString(e)},t),i)},n.selectItemAtIndex=function(e,t,i){var o=n.items[e];null!=o&&n.selectItem(o,t,i)},n.selectHighlightedItem=function(e,t){return n.selectItemAtIndex(n.getState().highlightedIndex,e,t)},n.internalSetState=function(e,t){var i,o,u={},s="function"==typeof e;return!s&&e.hasOwnProperty("inputValue")&&n.props.onInputValueChange(e.inputValue,r({},n.getStateAndHelpers(),e)),n.setState((function(t){t=n.getState(t);var a=s?e(t):e;a=n.props.stateReducer(t,a),i=a.hasOwnProperty("selectedItem");var l={};return i&&a.selectedItem!==t.selectedItem&&(o=a.selectedItem),a.type=a.type||0,Object.keys(a).forEach((function(e){t[e]!==a[e]&&(u[e]=a[e]),"type"!==e&&(a[e],Ee(n.props,e)||(l[e]=a[e]))})),s&&a.hasOwnProperty("inputValue")&&n.props.onInputValueChange(a.inputValue,r({},n.getStateAndHelpers(),a)),l}),(function(){me(t)(),Object.keys(u).length>1&&n.props.onStateChange(u,n.getStateAndHelpers()),i&&n.props.onSelect(e.selectedItem,n.getStateAndHelpers()),void 0!==o&&n.props.onChange(o,n.getStateAndHelpers()),n.props.onUserAction(u,n.getStateAndHelpers())}))},n.rootRef=function(e){return n._rootNode=e},n.getRootProps=function(e,t){var i,u=void 0===e?{}:e,s=u.refKey,a=void 0===s?"ref":s,l=u.ref,c=o(u,Le),d=(void 0===t?{}:t).suppressRefError,p=void 0!==d&&d;n.getRootProps.called=!0,n.getRootProps.refKey=a,n.getRootProps.suppressRefError=p;var f=n.getState().isOpen;return r(((i={})[a]=we(l,n.rootRef),i.role="combobox",i["aria-expanded"]=f,i["aria-haspopup"]="listbox",i["aria-owns"]=f?n.menuId:void 0,i["aria-labelledby"]=n.labelId,i),c)},n.keyDownHandlers={ArrowDown:function(e){var t=this;if(e.preventDefault(),this.getState().isOpen){var n=e.shiftKey?5:1;this.moveHighlightedIndex(n,{type:4})}else this.internalSetState({isOpen:!0,type:4},(function(){var e=t.getItemCount();if(e>0){var n=Re(t.getState().highlightedIndex,1,{length:e},t.isItemDisabled,!0);t.setHighlightedIndex(n,{type:4})}}))},ArrowUp:function(e){var t=this;if(e.preventDefault(),this.getState().isOpen){var n=e.shiftKey?-5:-1;this.moveHighlightedIndex(n,{type:3})}else this.internalSetState({isOpen:!0,type:3},(function(){var e=t.getItemCount();if(e>0){var n=Re(t.getState().highlightedIndex,-1,{length:e},t.isItemDisabled,!0);t.setHighlightedIndex(n,{type:3})}}))},Enter:function(e){if(229!==e.which){var t=this.getState(),n=t.isOpen,i=t.highlightedIndex;if(n&&null!=i){e.preventDefault();var o=this.items[i],r=this.getItemNodeFromIndex(i);if(null==o||r&&r.hasAttribute("disabled"))return;this.selectHighlightedItem({type:6})}}},Escape:function(e){e.preventDefault(),this.reset(r({type:5},!this.state.isOpen&&{selectedItem:null,inputValue:""}))}},n.buttonKeyDownHandlers=r({},n.keyDownHandlers,{" ":function(e){e.preventDefault(),this.toggleMenu({type:12})}}),n.inputKeyDownHandlers=r({},n.keyDownHandlers,{Home:function(e){var t=this.getState().isOpen;if(t){e.preventDefault();var n=this.getItemCount();if(!(n<=0)&&t){var i=Ke(0,!1,{length:n},this.isItemDisabled);this.setHighlightedIndex(i,{type:7})}}},End:function(e){var t=this.getState().isOpen;if(t){e.preventDefault();var n=this.getItemCount();if(!(n<=0)&&t){var i=Ke(n-1,!0,{length:n},this.isItemDisabled);this.setHighlightedIndex(i,{type:8})}}}}),n.getToggleButtonProps=function(e){var t=void 0===e?{}:e,i=t.onClick;t.onPress;var u=t.onKeyDown,s=t.onKeyUp,a=t.onBlur,l=o(t,_e),c=n.getState().isOpen,d={onClick:xe(i,n.buttonHandleClick),onKeyDown:xe(u,n.buttonHandleKeyDown),onKeyUp:xe(s,n.buttonHandleKeyUp),onBlur:xe(a,n.buttonHandleBlur)};return r({type:"button",role:"button","aria-label":c?"close menu":"open menu","aria-haspopup":!0,"data-toggle":!0},l.disabled?{}:d,l)},n.buttonHandleKeyUp=function(e){e.preventDefault()},n.buttonHandleKeyDown=function(e){var t=Pe(e);n.buttonKeyDownHandlers[t]&&n.buttonKeyDownHandlers[t].call(u(n),e)},n.buttonHandleClick=function(e){e.preventDefault(),n.props.environment.document.activeElement===n.props.environment.document.body&&e.target.focus(),n.internalSetTimeout((function(){return n.toggleMenu({type:13})}))},n.buttonHandleBlur=function(e){var t=e.target;n.internalSetTimeout((function(){n.isMouseDown||null!=n.props.environment.document.activeElement&&n.props.environment.document.activeElement.id===n.inputId||n.props.environment.document.activeElement===t||n.reset({type:14})}))},n.getLabelProps=function(e){return r({htmlFor:n.inputId,id:n.labelId},e)},n.getInputProps=function(e){var t=void 0===e?{}:e,i=t.onKeyDown,u=t.onBlur,s=t.onChange,a=t.onInput;t.onChangeText;var l=o(t,Fe),c={};var d,p=n.getState(),f=p.inputValue,g=p.isOpen,h=p.highlightedIndex;l.disabled||((d={}).onChange=xe(s,a,n.inputHandleChange),d.onKeyDown=xe(i,n.inputHandleKeyDown),d.onBlur=xe(u,n.inputHandleBlur),c=d);return r({"aria-autocomplete":"list","aria-activedescendant":g&&"number"==typeof h&&h>=0?n.getItemId(h):void 0,"aria-controls":g?n.menuId:void 0,"aria-labelledby":l&&l["aria-label"]?void 0:n.labelId,autoComplete:"off",value:f,id:n.inputId},c,l)},n.inputHandleKeyDown=function(e){var t=Pe(e);t&&n.inputKeyDownHandlers[t]&&n.inputKeyDownHandlers[t].call(u(n),e)},n.inputHandleChange=function(e){n.internalSetState({type:11,isOpen:!0,inputValue:e.target.value,highlightedIndex:n.props.defaultHighlightedIndex})},n.inputHandleBlur=function(){n.internalSetTimeout((function(){var e=n.props.environment.document&&!!n.props.environment.document.activeElement&&!!n.props.environment.document.activeElement.dataset&&n.props.environment.document.activeElement.dataset.toggle&&n._rootNode&&n._rootNode.contains(n.props.environment.document.activeElement);n.isMouseDown||e||n.reset({type:10})}))},n.menuRef=function(e){n._menuNode=e},n.getMenuProps=function(e,t){var i,u=void 0===e?{}:e,s=u.refKey,a=void 0===s?"ref":s,l=u.ref,c=o(u,$e),d=(void 0===t?{}:t).suppressRefError,p=void 0!==d&&d;return n.getMenuProps.called=!0,n.getMenuProps.refKey=a,n.getMenuProps.suppressRefError=p,r(((i={})[a]=we(l,n.menuRef),i.role="listbox",i["aria-labelledby"]=c&&c["aria-label"]?void 0:n.labelId,i.id=n.menuId,i),c)},n.getItemProps=function(e){var t,i=void 0===e?{}:e,u=i.onMouseMove,s=i.onMouseDown,a=i.onClick;i.onPress;var l=i.index,c=i.item,d=void 0===c?void 0:c,p=o(i,Ne);void 0===l?(n.items.push(d),l=n.items.indexOf(d)):n.items[l]=d;var f=a,g=((t={onMouseMove:xe(u,(function(){l!==n.getState().highlightedIndex&&(n.setHighlightedIndex(l,{type:2}),n.avoidScrolling=!0,n.internalSetTimeout((function(){return n.avoidScrolling=!1}),250))})),onMouseDown:xe(s,(function(e){e.preventDefault()}))}).onClick=xe(f,(function(){n.selectItemAtIndex(l,{type:9})})),t),h=p.disabled?{onMouseDown:g.onMouseDown}:g;return r({id:n.getItemId(l),role:"option","aria-selected":n.getState().highlightedIndex===l},h,p)},n.clearItems=function(){n.items=[]},n.reset=function(e,t){void 0===e&&(e={}),e=Oe(e),n.internalSetState((function(t){var i=t.selectedItem;return r({isOpen:n.props.defaultIsOpen,highlightedIndex:n.props.defaultHighlightedIndex,inputValue:n.props.itemToString(i)},e)}),t)},n.toggleMenu=function(e,t){void 0===e&&(e={}),e=Oe(e),n.internalSetState((function(t){var i=t.isOpen;return r({isOpen:!i},i&&{highlightedIndex:n.props.defaultHighlightedIndex},e)}),(function(){var i=n.getState(),o=i.isOpen,r=i.highlightedIndex;o&&n.getItemCount()>0&&"number"==typeof r&&n.setHighlightedIndex(r,e),me(t)()}))},n.openMenu=function(e){n.internalSetState({isOpen:!0},e)},n.closeMenu=function(e){n.internalSetState({isOpen:!1},e)},n.updateStatus=be((function(){var e=n.getState(),t=n.items[e.highlightedIndex],i=n.getItemCount(),o=n.props.getA11yStatusMessage(r({itemToString:n.props.itemToString,previousResultCount:n.previousResultCount,resultCount:i,highlightedItem:t},e));n.previousResultCount=i,Ve(o,n.props.environment.document)}),200);var i=n.props,s=i.defaultHighlightedIndex,a=i.initialHighlightedIndex,l=void 0===a?s:a,c=i.defaultIsOpen,d=i.initialIsOpen,p=void 0===d?c:d,f=i.initialInputValue,g=void 0===f?"":f,h=i.initialSelectedItem,m=void 0===h?null:h,I=n.getState({highlightedIndex:l,isOpen:p,inputValue:g,selectedItem:m});return null!=I.selectedItem&&void 0===n.props.initialInputValue&&(I.inputValue=n.props.itemToString(I.selectedItem)),n.state=I,n}i=e,(n=a).prototype=Object.create(i.prototype),n.prototype.constructor=n,s(n,i);var l=a.prototype;return l.internalClearTimeouts=function(){this.timeoutIds.forEach((function(e){clearTimeout(e)})),this.timeoutIds=[]},l.getState=function(e){return void 0===e&&(e=this.state),Me(e,this.props)},l.getItemCount=function(){var e=this.items.length;return null!=this.itemCount?e=this.itemCount:void 0!==this.props.itemCount&&(e=this.props.itemCount),e},l.getItemNodeFromIndex=function(e){return this.props.environment.document.getElementById(this.getItemId(e))},l.scrollHighlightedItemIntoView=function(){var e=this.getItemNodeFromIndex(this.getState().highlightedIndex);this.props.scrollIntoView(e,this._menuNode)},l.moveHighlightedIndex=function(e,t){var n=this.getItemCount(),i=this.getState().highlightedIndex;if(n>0){var o=Re(i,e,{length:n},this.isItemDisabled,!0);this.setHighlightedIndex(o,t)}},l.getStateAndHelpers=function(){var e=this.getState(),t=e.highlightedIndex,n=e.inputValue,i=e.selectedItem,o=e.isOpen,r=this.props.itemToString,u=this.id,s=this.getRootProps,a=this.getToggleButtonProps,l=this.getLabelProps,c=this.getMenuProps,d=this.getInputProps,p=this.getItemProps,f=this.openMenu,g=this.closeMenu,h=this.toggleMenu,m=this.selectItem,I=this.selectItemAtIndex,v=this.selectHighlightedItem,y=this.setHighlightedIndex,b=this.clearSelection,x=this.clearItems;return{getRootProps:s,getToggleButtonProps:a,getLabelProps:l,getMenuProps:c,getInputProps:d,getItemProps:p,reset:this.reset,openMenu:f,closeMenu:g,toggleMenu:h,selectItem:m,selectItemAtIndex:I,selectHighlightedItem:v,setHighlightedIndex:y,clearSelection:b,clearItems:x,setItemCount:this.setItemCount,unsetItemCount:this.unsetItemCount,setState:this.internalSetState,itemToString:r,id:u,highlightedIndex:t,inputValue:n,isOpen:o,selectedItem:i}},l.componentDidMount=function(){var e=this,t=function(){e.isMouseDown=!0},n=function(t){e.isMouseDown=!1,!Te(t.target,[e._rootNode,e._menuNode],e.props.environment)&&e.getState().isOpen&&e.reset({type:1},(function(){return e.props.onOuterClick(e.getStateAndHelpers())}))},i=function(){e.isTouchMove=!1},o=function(){e.isTouchMove=!0},r=function(t){var n=Te(t.target,[e._rootNode,e._menuNode],e.props.environment,!1);e.isTouchMove||n||!e.getState().isOpen||e.reset({type:16},(function(){return e.props.onOuterClick(e.getStateAndHelpers())}))},u=this.props.environment;u.addEventListener("mousedown",t),u.addEventListener("mouseup",n),u.addEventListener("touchstart",i),u.addEventListener("touchmove",o),u.addEventListener("touchend",r),this.cleanup=function(){e.internalClearTimeouts(),e.updateStatus.cancel(),u.removeEventListener("mousedown",t),u.removeEventListener("mouseup",n),u.removeEventListener("touchstart",i),u.removeEventListener("touchmove",o),u.removeEventListener("touchend",r)}},l.shouldScroll=function(e,t){var n=(void 0===this.props.highlightedIndex?this.getState():this.props).highlightedIndex,i=(void 0===t.highlightedIndex?e:t).highlightedIndex;return n&&this.getState().isOpen&&!e.isOpen||n!==i},l.componentDidUpdate=function(e,t){Ee(this.props,"selectedItem")&&this.props.selectedItemChanged(e.selectedItem,this.props.selectedItem)&&this.internalSetState({type:15,inputValue:this.props.itemToString(this.props.selectedItem)}),!this.avoidScrolling&&this.shouldScroll(t,e)&&this.scrollHighlightedItemIntoView(),this.updateStatus()},l.componentWillUnmount=function(){this.cleanup()},l.render=function(){var e=ke(this.props.children,Ie);this.clearItems(),this.getRootProps.called=!1,this.getRootProps.refKey=void 0,this.getRootProps.suppressRefError=void 0,this.getMenuProps.called=!1,this.getMenuProps.refKey=void 0,this.getMenuProps.suppressRefError=void 0,this.getLabelProps.called=!1,this.getInputProps.called=!1;var n=ke(e(this.getStateAndHelpers()));return n?this.getRootProps.called||this.props.suppressRefError?n:function(e){return"string"==typeof e.type}(n)?t.cloneElement(n,this.getRootProps(function(e){return e.props}(n))):void 0:null},a}(t.Component);return e.defaultProps={defaultHighlightedIndex:null,defaultIsOpen:!1,getA11yStatusMessage:Ce,itemToString:function(e){return null==e?"":String(e)},onStateChange:Ie,onInputValueChange:Ie,onUserAction:Ie,onChange:Ie,onSelect:Ie,onOuterClick:Ie,selectedItemChanged:function(e,t){return e!==t},environment:"undefined"==typeof window?{}:window,stateReducer:function(e,t){return t},suppressRefError:!1,scrollIntoView:ve},e.stateChangeTypes=Be,e}(),Ue=je,We=["isInitialMount","highlightedIndex","items","environment"],qe={highlightedIndex:-1,isOpen:!1,selectedItem:null,inputValue:""};function ze(e,t,n){var i=e.props,o=e.type,u={};Object.keys(t).forEach((function(i){!function(e,t,n,i){var o=t.props,u=t.type,s="on"+Qe(e)+"Change";o[s]&&void 0!==i[e]&&i[e]!==n[e]&&o[s](r({type:u},i))}(i,e,t,n),n[i]!==t[i]&&(u[i]=n[i])})),i.onStateChange&&Object.keys(u).length&&i.onStateChange(r({type:o},u))}var Ye=be((function(e,t){Ve(e(),t)}),200),Xe="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement?t.useLayoutEffect:t.useEffect,Ge="useId"in i.default?function(e){var n=e.id,o=e.labelId,r=e.menuId,u=e.getItemId,s=e.toggleButtonId,a=e.inputId,l="downshift-"+i.default.useId();return n||(n=l),t.useRef({labelId:o||n+"-label",menuId:r||n+"-menu",getItemId:u||function(e){return n+"-item-"+e},toggleButtonId:s||n+"-toggle-button",inputId:a||n+"-input"}).current}:function(e){var n=e.id,i=void 0===n?"downshift-"+Se():n,o=e.labelId,r=e.menuId,u=e.getItemId,s=e.toggleButtonId,a=e.inputId;return t.useRef({labelId:o||i+"-label",menuId:r||i+"-menu",getItemId:u||function(e){return i+"-item-"+e},toggleButtonId:s||i+"-toggle-button",inputId:a||i+"-input"}).current};function Je(e,t,n,i){var o,r;if(void 0===e){if(void 0===t)throw new Error(i);o=n[t],r=t}else r=void 0===t?n.indexOf(e):t,o=e;return[o,r]}function Qe(e){return""+e.slice(0,1).toUpperCase()+e.slice(1)}function Ze(e){var n=t.useRef(e);return n.current=e,n}function et(e,n,i){var o=t.useRef(),u=t.useRef(),s=t.useCallback((function(t,n){u.current=n,t=Me(t,n.props);var i=e(t,n);return n.props.stateReducer(t,r({},n,{changes:i}))}),[e]),a=t.useReducer(s,n),l=a[0],c=a[1],d=Ze(i),p=t.useCallback((function(e){return c(r({props:d.current},e))}),[d]),f=u.current;return t.useEffect((function(){f&&o.current&&o.current!==l&&ze(f,Me(o.current,f.props),l),o.current=l}),[l,i,f]),[l,p]}function tt(e,t,n){var i=et(e,t,n),o=i[0],r=i[1];return[Me(o,n),r]}var nt={itemToString:function(e){return e?String(e):""},stateReducer:function(e,t){return t.changes},getA11ySelectionMessage:function(e){var t=e.selectedItem,n=e.itemToString;return t?n(t)+" has been selected.":""},scrollIntoView:ve,environment:"undefined"==typeof window?{}:window};function it(e,t,n){void 0===n&&(n=qe);var i=e["default"+Qe(t)];return void 0!==i?i:n[t]}function ot(e,t,n){void 0===n&&(n=qe);var i=e[t];if(void 0!==i)return i;var o=e["initial"+Qe(t)];return void 0!==o?o:it(e,t,n)}function rt(e){var t=ot(e,"selectedItem"),n=ot(e,"isOpen"),i=ot(e,"highlightedIndex"),o=ot(e,"inputValue");return{highlightedIndex:i<0&&t&&n?e.items.indexOf(t):i,isOpen:n,selectedItem:t,inputValue:o}}function ut(e,t,n){var i=e.items,o=e.initialHighlightedIndex,r=e.defaultHighlightedIndex,u=t.selectedItem,s=t.highlightedIndex;return 0===i.length?-1:void 0!==o&&s===o?o:void 0!==r?r:u?i.indexOf(u):0===n?-1:n<0?i.length-1:0}function st(e,n,i,o){var r=t.useRef({isMouseDown:!1,isTouchMove:!1});return t.useEffect((function(){if(null!=(null==i?void 0:i.addEventListener)){var t=function(){r.current.isMouseDown=!0},u=function(t){r.current.isMouseDown=!1,e&&!Te(t.target,n.map((function(e){return e.current})),i)&&o()},s=function(){r.current.isTouchMove=!1},a=function(){r.current.isTouchMove=!0},l=function(t){!e||r.current.isTouchMove||Te(t.target,n.map((function(e){return e.current})),i,!1)||o()};return i.addEventListener("mousedown",t),i.addEventListener("mouseup",u),i.addEventListener("touchstart",s),i.addEventListener("touchmove",a),i.addEventListener("touchend",l),function(){i.removeEventListener("mousedown",t),i.removeEventListener("mouseup",u),i.removeEventListener("touchstart",s),i.removeEventListener("touchmove",a),i.removeEventListener("touchend",l)}}}),[e,i]),r}var at=function(){return Ie};function lt(e,n,i){var u=i.isInitialMount,s=i.highlightedIndex,a=i.items,l=i.environment,c=o(i,We);t.useEffect((function(){u||Ye((function(){return e(r({highlightedIndex:s,highlightedItem:a[s],resultCount:a.length},c))}),l.document)}),n)}function ct(e){var n=e.highlightedIndex,i=e.isOpen,o=e.itemRefs,r=e.getItemNodeFromIndex,u=e.menuElement,s=e.scrollIntoView,a=t.useRef(!0);return Xe((function(){n<0||!i||!Object.keys(o.current).length||(!1===a.current?a.current=!0:s(r(n),u))}),[n]),a}var dt=Ie;function pt(e,t,n){var i;return void 0===n&&(n=!0),r({isOpen:!1,highlightedIndex:-1},(null==(i=e.items)?void 0:i.length)&&t>=0&&r({selectedItem:e.items[t],isOpen:it(e,"isOpen"),highlightedIndex:it(e,"highlightedIndex")},n&&{inputValue:e.itemToString(e.items[t])}))}var ft={environment:T.shape({addEventListener:T.func.isRequired,removeEventListener:T.func.isRequired,document:T.shape({createElement:T.func.isRequired,getElementById:T.func.isRequired,activeElement:T.any.isRequired,body:T.any.isRequired}).isRequired,Node:T.func.isRequired}),itemToString:T.func,stateReducer:T.func},gt=r({},ft,{getA11yStatusMessage:T.func,highlightedIndex:T.number,defaultHighlightedIndex:T.number,initialHighlightedIndex:T.number,isOpen:T.bool,defaultIsOpen:T.bool,initialIsOpen:T.bool,selectedItem:T.any,initialSelectedItem:T.any,defaultSelectedItem:T.any,id:T.string,labelId:T.string,menuId:T.string,getItemId:T.func,toggleButtonId:T.string,onSelectedItemChange:T.func,onHighlightedIndexChange:T.func,onStateChange:T.func,onIsOpenChange:T.func,scrollIntoView:T.func});function ht(e,t,n){var i,o=t.type,u=t.props;switch(o){case n.ItemMouseMove:i={highlightedIndex:t.disabled?-1:t.index};break;case n.MenuMouseLeave:i={highlightedIndex:-1};break;case n.ToggleButtonClick:case n.FunctionToggleMenu:i={isOpen:!e.isOpen,highlightedIndex:e.isOpen?-1:ut(u,e,0)};break;case n.FunctionOpenMenu:i={isOpen:!0,highlightedIndex:ut(u,e,0)};break;case n.FunctionCloseMenu:i={isOpen:!1};break;case n.FunctionSetHighlightedIndex:i={highlightedIndex:t.highlightedIndex};break;case n.FunctionSetInputValue:i={inputValue:t.inputValue};break;case n.FunctionReset:i={highlightedIndex:it(u,"highlightedIndex"),isOpen:it(u,"isOpen"),selectedItem:it(u,"selectedItem"),inputValue:it(u,"inputValue")};break;default:throw new Error("Reducer called without proper action type.")}return r({},e,i)}var mt=function(){return mt=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},mt.apply(this,arguments)};"function"==typeof SuppressedError&&SuppressedError,mt(mt({},gt),{items:T.array.isRequired,isItemDisabled:T.func,getA11ySelectionMessage:T.func});var It=mt(mt({},nt),{getA11yStatusMessage:function(e){var t=e.isOpen,n=e.resultCount,i=e.previousResultCount;return t?n?n!==i?"".concat(n," result").concat(1===n?" is":"s are"," available, use up and down arrow keys to navigate. Press Enter or Space Bar keys to select."):"":"No results are available.":""},isItemDisabled:function(){return!1}}),vt=Ie,yt=1,bt=2,xt=3,wt=4,St=5,Ct=6,kt=7,Dt=8,Ot=9,Mt=10,Et=11,Pt=14,Rt=19,Kt=Object.freeze({__proto__:null,ToggleButtonClick:0,ToggleButtonKeyDownArrowDown:yt,ToggleButtonKeyDownArrowUp:bt,ToggleButtonKeyDownCharacter:xt,ToggleButtonKeyDownEscape:wt,ToggleButtonKeyDownHome:St,ToggleButtonKeyDownEnd:Ct,ToggleButtonKeyDownEnter:kt,ToggleButtonKeyDownSpaceButton:Dt,ToggleButtonKeyDownPageUp:Ot,ToggleButtonKeyDownPageDown:Mt,ToggleButtonBlur:Et,MenuMouseLeave:12,ItemMouseMove:13,ItemClick:Pt,FunctionToggleMenu:15,FunctionOpenMenu:16,FunctionCloseMenu:17,FunctionSetHighlightedIndex:18,FunctionSelectItem:Rt,FunctionSetInputValue:20,FunctionReset:21});function Tt(e,t){var n,i,o=t.type,u=t.props,s=t.altKey;switch(o){case Pt:i={isOpen:it(u,"isOpen"),highlightedIndex:it(u,"highlightedIndex"),selectedItem:u.items[t.index]};break;case xt:var a=t.key,l=""+e.inputValue+a,c=function(e){for(var t=e.keysSoFar,n=e.highlightedIndex,i=e.items,o=e.itemToString,r=e.isItemDisabled,u=t.toLowerCase(),s=0;s<i.length;s++){var a=(s+n+(t.length<2?1:0))%i.length,l=i[a];if(void 0!==l&&o(l).toLowerCase().startsWith(u)&&!r(l,a))return a}return n}({keysSoFar:l,highlightedIndex:!e.isOpen&&e.selectedItem?u.items.indexOf(e.selectedItem):e.highlightedIndex,items:u.items,itemToString:u.itemToString,isItemDisabled:u.isItemDisabled});i={inputValue:l,highlightedIndex:c,isOpen:!0};break;case yt:i={highlightedIndex:e.isOpen?Re(e.highlightedIndex,1,u.items,u.isItemDisabled):s&&null==e.selectedItem?-1:ut(u,e,1),isOpen:!0};break;case bt:if(e.isOpen&&s)i=pt(u,e.highlightedIndex,!1);else i={highlightedIndex:e.isOpen?Re(e.highlightedIndex,-1,u.items,u.isItemDisabled):ut(u,e,-1),isOpen:!0};break;case kt:case Dt:i=pt(u,e.highlightedIndex,!1);break;case St:i={highlightedIndex:Ke(0,!1,u.items,u.isItemDisabled),isOpen:!0};break;case Ct:i={highlightedIndex:Ke(u.items.length-1,!0,u.items,u.isItemDisabled),isOpen:!0};break;case Ot:i={highlightedIndex:Re(e.highlightedIndex,-10,u.items,u.isItemDisabled)};break;case Mt:i={highlightedIndex:Re(e.highlightedIndex,10,u.items,u.isItemDisabled)};break;case wt:i={isOpen:!1,highlightedIndex:-1};break;case Et:i=r({isOpen:!1,highlightedIndex:-1},e.highlightedIndex>=0&&(null==(n=u.items)?void 0:n.length)&&{selectedItem:u.items[e.highlightedIndex]});break;case Rt:i={selectedItem:t.selectedItem};break;default:return ht(e,t,Kt)}return r({},e,i)}var Ht=["onMouseLeave","refKey","onKeyDown","onBlur","ref"],Vt=["onBlur","onClick","onPress","onKeyDown","refKey","ref"],At=["item","index","onMouseMove","onClick","onPress","refKey","disabled","ref"];function Bt(e){void 0===e&&(e={}),vt();var n=r({},It,e),i=n.items,u=n.scrollIntoView,s=n.environment,a=n.itemToString,l=n.getA11ySelectionMessage,c=n.getA11yStatusMessage,d=tt(Tt,rt(n),n),p=d[0],f=d[1],g=p.isOpen,h=p.highlightedIndex,m=p.selectedItem,I=p.inputValue,v=t.useRef(null),y=t.useRef(null),b=t.useRef({}),x=t.useRef(null),w=Ge(n),S=t.useRef(),C=t.useRef(!0),k=Ze({state:p,props:n}),D=t.useCallback((function(e){return b.current[w.getItemId(e)]}),[w]);lt(c,[g,h,I,i],r({isInitialMount:C.current,previousResultCount:S.current,items:i,environment:s,itemToString:a},p)),lt(l,[m],r({isInitialMount:C.current,previousResultCount:S.current,items:i,environment:s,itemToString:a},p));var O=ct({menuElement:y.current,highlightedIndex:h,isOpen:g,itemRefs:b,scrollIntoView:u,getItemNodeFromIndex:D});t.useEffect((function(){return x.current=be((function(e){e({type:20,inputValue:""})}),500),function(){x.current.cancel()}}),[]),t.useEffect((function(){I&&x.current(f)}),[f,I]),dt({isInitialMount:C.current,props:n,state:p}),t.useEffect((function(){C.current||(S.current=i.length)}));var M=st(g,[y,v],s,(function(){f({type:Et})})),E=at();t.useEffect((function(){return C.current=!1,function(){C.current=!0}}),[]),t.useEffect((function(){g||(b.current={})}),[g]);var P=t.useMemo((function(){return{ArrowDown:function(e){e.preventDefault(),f({type:yt,altKey:e.altKey})},ArrowUp:function(e){e.preventDefault(),f({type:bt,altKey:e.altKey})},Home:function(e){e.preventDefault(),f({type:St})},End:function(e){e.preventDefault(),f({type:Ct})},Escape:function(){k.current.state.isOpen&&f({type:wt})},Enter:function(e){e.preventDefault(),f({type:k.current.state.isOpen?kt:0})},PageUp:function(e){k.current.state.isOpen&&(e.preventDefault(),f({type:Ot}))},PageDown:function(e){k.current.state.isOpen&&(e.preventDefault(),f({type:Mt}))}," ":function(e){e.preventDefault();var t=k.current.state;t.isOpen?t.inputValue?f({type:xt,key:" "}):f({type:Dt}):f({type:0})}}}),[f,k]),R=t.useCallback((function(){f({type:15})}),[f]),K=t.useCallback((function(){f({type:17})}),[f]),T=t.useCallback((function(){f({type:16})}),[f]),H=t.useCallback((function(e){f({type:18,highlightedIndex:e})}),[f]),V=t.useCallback((function(e){f({type:Rt,selectedItem:e})}),[f]),A=t.useCallback((function(){f({type:21})}),[f]),B=t.useCallback((function(e){f({type:20,inputValue:e})}),[f]),L=t.useCallback((function(e){return r({id:w.labelId,htmlFor:w.toggleButtonId},e)}),[w]),_=t.useCallback((function(e,t){var n,i=void 0===e?{}:e,u=i.onMouseLeave,s=i.refKey,a=void 0===s?"ref":s;i.onKeyDown,i.onBlur;var l=i.ref,c=o(i,Ht),d=(void 0===t?{}:t).suppressRefError;return E("getMenuProps",void 0!==d&&d,a,y),r(((n={})[a]=we(l,(function(e){y.current=e})),n.id=w.menuId,n.role="listbox",n["aria-labelledby"]=c&&c["aria-label"]?void 0:""+w.labelId,n.onMouseLeave=xe(u,(function(){f({type:12})})),n),c)}),[f,E,w]);return{getToggleButtonProps:t.useCallback((function(e,t){var n,i=void 0===e?{}:e,u=i.onBlur,s=i.onClick;i.onPress;var a=i.onKeyDown,l=i.refKey,c=void 0===l?"ref":l,d=i.ref,p=o(i,Vt),g=(void 0===t?{}:t).suppressRefError,h=void 0!==g&&g,m=k.current.state,I=r(((n={})[c]=we(d,(function(e){v.current=e})),n["aria-activedescendant"]=m.isOpen&&m.highlightedIndex>-1?w.getItemId(m.highlightedIndex):"",n["aria-controls"]=w.menuId,n["aria-expanded"]=k.current.state.isOpen,n["aria-haspopup"]="listbox",n["aria-labelledby"]=p&&p["aria-label"]?void 0:""+w.labelId,n.id=w.toggleButtonId,n.role="combobox",n.tabIndex=0,n.onBlur=xe(u,(function(){m.isOpen&&!M.current.isMouseDown&&f({type:Et})})),n),p);return p.disabled||(I.onClick=xe(s,(function(){f({type:0})})),I.onKeyDown=xe(a,(function(e){var t=Pe(e);t&&P[t]?P[t](e):function(e){return/^\S{1}$/.test(e)}(t)&&f({type:xt,key:t})}))),E("getToggleButtonProps",h,c,v),I}),[k,w,E,f,M,P]),getLabelProps:L,getMenuProps:_,getItemProps:t.useCallback((function(e){var t,n=void 0===e?{}:e,i=n.item,u=n.index,s=n.onMouseMove,a=n.onClick;n.onPress;var l=n.refKey,c=void 0===l?"ref":l,d=n.disabled,p=n.ref,g=o(n,At);void 0!==d&&console.warn('Passing "disabled" as an argument to getItemProps is not supported anymore. Please use the isItemDisabled prop from useSelect.');var h=k.current,m=h.state,I=h.props,v=Je(i,u,I.items,"Pass either item or index to getItemProps!"),y=v[0],x=v[1],S=I.isItemDisabled(y,x),C=r(((t={})[c]=we(p,(function(e){e&&(b.current[w.getItemId(x)]=e)})),t["aria-disabled"]=S,t["aria-selected"]=""+(y===m.selectedItem),t.id=w.getItemId(x),t.role="option",t),g);return S||(C.onClick=xe(a,(function(){f({type:Pt,index:x})}))),C.onMouseMove=xe(s,(function(){x!==m.highlightedIndex&&(O.current=!1,f({type:13,index:x,disabled:S}))})),C}),[k,w,O,f]),toggleMenu:R,openMenu:T,closeMenu:K,setHighlightedIndex:H,selectItem:V,reset:A,setInputValue:B,highlightedIndex:h,isOpen:g,selectedItem:m,inputValue:I}}Bt.stateChangeTypes=Kt;var Lt=0,_t=1,Ft=2,$t=3,Nt=4,jt=5,Ut=6,Wt=7,qt=8,zt=9,Yt=10,Xt=13,Gt=19,Jt=22,Qt=Object.freeze({__proto__:null,InputKeyDownArrowDown:Lt,InputKeyDownArrowUp:_t,InputKeyDownEscape:Ft,InputKeyDownHome:$t,InputKeyDownEnd:Nt,InputKeyDownPageUp:jt,InputKeyDownPageDown:Ut,InputKeyDownEnter:Wt,InputChange:qt,InputBlur:zt,InputClick:Yt,MenuMouseLeave:11,ItemMouseMove:12,ItemClick:Xt,ToggleButtonClick:14,FunctionToggleMenu:15,FunctionOpenMenu:16,FunctionCloseMenu:17,FunctionSetHighlightedIndex:18,FunctionSelectItem:Gt,FunctionSetInputValue:20,FunctionReset:21,ControlledPropUpdatedSelectedItem:Jt});r({},gt,{items:T.array.isRequired,isItemDisabled:T.func,selectedItemChanged:T.func,getA11ySelectionMessage:T.func,inputValue:T.string,defaultInputValue:T.string,initialInputValue:T.string,inputId:T.string,onInputValueChange:T.func});var Zt=Ie,en=r({},nt,{selectedItemChanged:function(e,t){return e!==t},getA11yStatusMessage:Ce,isItemDisabled:function(){return!1}});function tn(e,t){var n,i,o=t.type,u=t.props,s=t.altKey;switch(o){case Xt:i={isOpen:it(u,"isOpen"),highlightedIndex:it(u,"highlightedIndex"),selectedItem:u.items[t.index],inputValue:u.itemToString(u.items[t.index])};break;case Lt:i=e.isOpen?{highlightedIndex:Re(e.highlightedIndex,1,u.items,u.isItemDisabled,!0)}:{highlightedIndex:s&&null==e.selectedItem?-1:ut(u,e,1),isOpen:u.items.length>=0};break;case _t:i=e.isOpen?s?pt(u,e.highlightedIndex):{highlightedIndex:Re(e.highlightedIndex,-1,u.items,u.isItemDisabled,!0)}:{highlightedIndex:ut(u,e,-1),isOpen:u.items.length>=0};break;case Wt:i=pt(u,e.highlightedIndex);break;case Ft:i=r({isOpen:!1,highlightedIndex:-1},!e.isOpen&&{selectedItem:null,inputValue:""});break;case jt:i={highlightedIndex:Re(e.highlightedIndex,-10,u.items,u.isItemDisabled,!0)};break;case Ut:i={highlightedIndex:Re(e.highlightedIndex,10,u.items,u.isItemDisabled,!0)};break;case $t:i={highlightedIndex:Ke(0,!1,u.items,u.isItemDisabled)};break;case Nt:i={highlightedIndex:Ke(u.items.length-1,!0,u.items,u.isItemDisabled)};break;case zt:i=r({isOpen:!1,highlightedIndex:-1},e.highlightedIndex>=0&&(null==(n=u.items)?void 0:n.length)&&t.selectItem&&{selectedItem:u.items[e.highlightedIndex],inputValue:u.itemToString(u.items[e.highlightedIndex])});break;case qt:i={isOpen:!0,highlightedIndex:it(u,"highlightedIndex"),inputValue:t.inputValue};break;case Yt:i={isOpen:!e.isOpen,highlightedIndex:e.isOpen?-1:ut(u,e,0)};break;case Gt:i={selectedItem:t.selectedItem,inputValue:u.itemToString(t.selectedItem)};break;case Jt:i={inputValue:t.inputValue};break;default:return ht(e,t,Qt)}return r({},e,i)}var nn=["onMouseLeave","refKey","ref"],on=["item","index","refKey","ref","onMouseMove","onMouseDown","onClick","onPress","disabled"],rn=["onClick","onPress","refKey","ref"],un=["onKeyDown","onChange","onInput","onBlur","onChangeText","onClick","refKey","ref"];function sn(e){void 0===e&&(e={}),Zt();var n=r({},en,e),i=n.items,u=n.scrollIntoView,s=n.environment,a=n.getA11yStatusMessage,l=n.getA11ySelectionMessage,c=n.itemToString,d=function(e){var t=rt(e),n=t.selectedItem,i=t.inputValue;return""===i&&n&&void 0===e.defaultInputValue&&void 0===e.initialInputValue&&void 0===e.inputValue&&(i=e.itemToString(n)),r({},t,{inputValue:i})}(n),p=function(e,n,i){var o=t.useRef(),r=et(e,n,i),u=r[0],s=r[1];return t.useEffect((function(){Ee(i,"selectedItem")&&(i.selectedItemChanged(o.current,i.selectedItem)&&s({type:Jt,inputValue:i.itemToString(i.selectedItem)}),o.current=u.selectedItem===o.current?i.selectedItem:u.selectedItem)}),[u.selectedItem,i.selectedItem]),[Me(u,i),s]}(tn,d,n),f=p[0],g=p[1],h=f.isOpen,m=f.highlightedIndex,I=f.selectedItem,v=f.inputValue,y=t.useRef(null),b=t.useRef({}),x=t.useRef(null),w=t.useRef(null),S=t.useRef(!0),C=Ge(n),k=t.useRef(),D=Ze({state:f,props:n}),O=t.useCallback((function(e){return b.current[C.getItemId(e)]}),[C]);lt(a,[h,m,v,i],r({isInitialMount:S.current,previousResultCount:k.current,items:i,environment:s,itemToString:c},f)),lt(l,[I],r({isInitialMount:S.current,previousResultCount:k.current,items:i,environment:s,itemToString:c},f));var M=ct({menuElement:y.current,highlightedIndex:m,isOpen:h,itemRefs:b,scrollIntoView:u,getItemNodeFromIndex:O});dt({isInitialMount:S.current,props:n,state:f}),t.useEffect((function(){ot(n,"isOpen")&&x.current&&x.current.focus()}),[]),t.useEffect((function(){S.current||(k.current=i.length)}));var E=st(h,[x,y,w],s,(function(){g({type:zt,selectItem:!1})})),P=at();t.useEffect((function(){return S.current=!1,function(){S.current=!0}}),[]),t.useEffect((function(){var e;if(h){if((null==(e=s.document)?void 0:e.activeElement)!==x.current){var t;null==x||null==(t=x.current)||t.focus()}}else b.current={}}),[h,s]);var R=t.useMemo((function(){return{ArrowDown:function(e){e.preventDefault(),g({type:Lt,altKey:e.altKey})},ArrowUp:function(e){e.preventDefault(),g({type:_t,altKey:e.altKey})},Home:function(e){D.current.state.isOpen&&(e.preventDefault(),g({type:$t}))},End:function(e){D.current.state.isOpen&&(e.preventDefault(),g({type:Nt}))},Escape:function(e){var t=D.current.state;(t.isOpen||t.inputValue||t.selectedItem||t.highlightedIndex>-1)&&(e.preventDefault(),g({type:Ft}))},Enter:function(e){D.current.state.isOpen&&229!==e.which&&(e.preventDefault(),g({type:Wt}))},PageUp:function(e){D.current.state.isOpen&&(e.preventDefault(),g({type:jt}))},PageDown:function(e){D.current.state.isOpen&&(e.preventDefault(),g({type:Ut}))}}}),[g,D]),K=t.useCallback((function(e){return r({id:C.labelId,htmlFor:C.inputId},e)}),[C]),T=t.useCallback((function(e,t){var n,i=void 0===e?{}:e,u=i.onMouseLeave,s=i.refKey,a=void 0===s?"ref":s,l=i.ref,c=o(i,nn),d=(void 0===t?{}:t).suppressRefError;return P("getMenuProps",void 0!==d&&d,a,y),r(((n={})[a]=we(l,(function(e){y.current=e})),n.id=C.menuId,n.role="listbox",n["aria-labelledby"]=c&&c["aria-label"]?void 0:""+C.labelId,n.onMouseLeave=xe(u,(function(){g({type:11})})),n),c)}),[g,P,C]),H=t.useCallback((function(e){var t,n,i=void 0===e?{}:e,u=i.item,s=i.index,a=i.refKey,l=void 0===a?"ref":a,c=i.ref,d=i.onMouseMove,p=i.onMouseDown,f=i.onClick;i.onPress;var h=i.disabled,m=o(i,on);void 0!==h&&console.warn('Passing "disabled" as an argument to getItemProps is not supported anymore. Please use the isItemDisabled prop from useCombobox.');var I=D.current,v=I.props,y=I.state,x=Je(u,s,v.items,"Pass either item or index to getItemProps!"),w=x[0],S=x[1],k=v.isItemDisabled(w,S),O=f;return r(((t={})[l]=we(c,(function(e){e&&(b.current[C.getItemId(S)]=e)})),t["aria-disabled"]=k,t["aria-selected"]=""+(S===y.highlightedIndex),t.id=C.getItemId(S),t.role="option",t),!k&&((n={}).onClick=xe(O,(function(){g({type:Xt,index:S})})),n),{onMouseMove:xe(d,(function(){S!==y.highlightedIndex&&(M.current=!1,g({type:12,index:S,disabled:k}))})),onMouseDown:xe(p,(function(e){return e.preventDefault()}))},m)}),[g,D,M,C]),V=t.useCallback((function(e){var t,n=void 0===e?{}:e,i=n.onClick;n.onPress;var u=n.refKey,s=void 0===u?"ref":u,a=n.ref,l=o(n,rn),c=D.current.state;return r(((t={})[s]=we(a,(function(e){w.current=e})),t["aria-controls"]=C.menuId,t["aria-expanded"]=c.isOpen,t.id=C.toggleButtonId,t.tabIndex=-1,t),!l.disabled&&r({},{onClick:xe(i,(function(){g({type:14})}))}),l)}),[g,D,C]),A=t.useCallback((function(e,t){var n,i=void 0===e?{}:e,u=i.onKeyDown,a=i.onChange,l=i.onInput,c=i.onBlur;i.onChangeText;var d=i.onClick,p=i.refKey,f=void 0===p?"ref":p,h=i.ref,m=o(i,un),I=(void 0===t?{}:t).suppressRefError;P("getInputProps",void 0!==I&&I,f,x);var v,y=D.current.state,b={};m.disabled||((v={}).onChange=xe(a,l,(function(e){g({type:qt,inputValue:e.target.value})})),v.onKeyDown=xe(u,(function(e){var t=Pe(e);t&&R[t]&&R[t](e)})),v.onBlur=xe(c,(function(e){if(y.isOpen&&!E.current.isMouseDown){var t=null===e.relatedTarget&&s.document.activeElement!==s.document.body;g({type:zt,selectItem:!t})}})),v.onClick=xe(d,(function(){g({type:Yt})})),b=v);return r(((n={})[f]=we(h,(function(e){x.current=e})),n["aria-activedescendant"]=y.isOpen&&y.highlightedIndex>-1?C.getItemId(y.highlightedIndex):"",n["aria-autocomplete"]="list",n["aria-controls"]=C.menuId,n["aria-expanded"]=y.isOpen,n["aria-labelledby"]=m&&m["aria-label"]?void 0:C.labelId,n.autoComplete="off",n.id=C.inputId,n.role="combobox",n.value=y.inputValue,n),b,m)}),[P,D,C,R,g,E,s]),B=t.useCallback((function(){g({type:15})}),[g]),L=t.useCallback((function(){g({type:17})}),[g]),_=t.useCallback((function(){g({type:16})}),[g]),F=t.useCallback((function(e){g({type:18,highlightedIndex:e})}),[g]),$=t.useCallback((function(e){g({type:Gt,selectedItem:e})}),[g]);return{getItemProps:H,getLabelProps:K,getMenuProps:T,getInputProps:A,getToggleButtonProps:V,toggleMenu:B,openMenu:_,closeMenu:L,setHighlightedIndex:F,setInputValue:t.useCallback((function(e){g({type:20,inputValue:e})}),[g]),selectItem:$,reset:t.useCallback((function(){g({type:21})}),[g]),highlightedIndex:m,isOpen:h,selectedItem:I,inputValue:v}}sn.stateChangeTypes=Qt;var an={activeIndex:-1,selectedItems:[]};function ln(e,t){return ot(e,t,an)}function cn(e,t){return it(e,t,an)}function dn(e){if(e.shiftKey||e.metaKey||e.ctrlKey||e.altKey)return!1;var t=e.target;return!(t instanceof HTMLInputElement&&""!==t.value)||0===t.selectionStart&&0===t.selectionEnd}r({},ft,{selectedItems:T.array,initialSelectedItems:T.array,defaultSelectedItems:T.array,getA11yRemovalMessage:T.func,activeIndex:T.number,initialActiveIndex:T.number,defaultActiveIndex:T.number,onActiveIndexChange:T.func,onSelectedItemsChange:T.func,keyNavigationNext:T.string,keyNavigationPrevious:T.string});var pn={itemToString:nt.itemToString,stateReducer:nt.stateReducer,environment:nt.environment,getA11yRemovalMessage:function(e){var t=e.removedSelectedItem;return(0,e.itemToString)(t)+" has been removed."},keyNavigationNext:"ArrowRight",keyNavigationPrevious:"ArrowLeft"},fn=Ie,gn=0,hn=1,mn=2,In=3,vn=4,yn=5,bn=6,xn=7,wn=8,Sn=9,Cn=10,kn=11,Dn=12,On=Object.freeze({__proto__:null,SelectedItemClick:gn,SelectedItemKeyDownDelete:hn,SelectedItemKeyDownBackspace:mn,SelectedItemKeyDownNavigationNext:In,SelectedItemKeyDownNavigationPrevious:vn,DropdownKeyDownNavigationPrevious:yn,DropdownKeyDownBackspace:bn,DropdownClick:xn,FunctionAddSelectedItem:wn,FunctionRemoveSelectedItem:Sn,FunctionSetSelectedItems:Cn,FunctionSetActiveIndex:kn,FunctionReset:Dn});function Mn(e,t){var n,i=t.type,o=t.index,u=t.props,s=t.selectedItem,a=e.activeIndex,l=e.selectedItems;switch(i){case gn:n={activeIndex:o};break;case vn:n={activeIndex:a-1<0?0:a-1};break;case In:n={activeIndex:a+1>=l.length?-1:a+1};break;case mn:case hn:if(a<0)break;var c=a;1===l.length?c=-1:a===l.length-1&&(c=l.length-2),n=r({selectedItems:[].concat(l.slice(0,a),l.slice(a+1))},{activeIndex:c});break;case yn:n={activeIndex:l.length-1};break;case bn:n={selectedItems:l.slice(0,l.length-1)};break;case wn:n={selectedItems:[].concat(l,[s])};break;case xn:n={activeIndex:-1};break;case Sn:var d=a,p=l.indexOf(s);if(p<0)break;1===l.length?d=-1:p===l.length-1&&(d=l.length-2),n={selectedItems:[].concat(l.slice(0,p),l.slice(p+1)),activeIndex:d};break;case Cn:n={selectedItems:t.selectedItems};break;case kn:n={activeIndex:t.activeIndex};break;case Dn:n={activeIndex:cn(u,"activeIndex"),selectedItems:cn(u,"selectedItems")};break;default:throw new Error("Reducer called without proper action type.")}return r({},e,n)}var En=["refKey","ref","onClick","onKeyDown","selectedItem","index"],Pn=["refKey","ref","onKeyDown","onClick","preventKeyAction"];function Rn(e){void 0===e&&(e={}),fn();var n=r({},pn,e),i=n.getA11yRemovalMessage,u=n.itemToString,s=n.environment,a=n.keyNavigationNext,l=n.keyNavigationPrevious,c=tt(Mn,function(e){return{activeIndex:ln(e,"activeIndex"),selectedItems:ln(e,"selectedItems")}}(n),n),d=c[0],p=c[1],f=d.activeIndex,g=d.selectedItems,h=t.useRef(!0),m=t.useRef(null),I=t.useRef(g),v=t.useRef();v.current=[];var y=Ze({state:d,props:n});t.useEffect((function(){if(!h.current){if(g.length<I.current.length){var e=I.current.find((function(e){return g.indexOf(e)<0}));Ve(i({itemToString:u,resultCount:g.length,removedSelectedItem:e,activeIndex:f,activeSelectedItem:g[f]}),s.document)}I.current=g}}),[g.length]),t.useEffect((function(){h.current||(-1===f&&m.current?m.current.focus():v.current[f]&&v.current[f].focus())}),[f]),dt({isInitialMount:h.current,props:n,state:d});var b=at();t.useEffect((function(){return h.current=!1,function(){h.current=!0}}),[]);var x=t.useMemo((function(){var e;return(e={})[l]=function(){p({type:vn})},e[a]=function(){p({type:In})},e.Delete=function(){p({type:hn})},e.Backspace=function(){p({type:mn})},e}),[p,a,l]),w=t.useMemo((function(){var e;return(e={})[l]=function(e){dn(e)&&p({type:yn})},e.Backspace=function(e){dn(e)&&p({type:bn})},e}),[p,l]);return{getSelectedItemProps:t.useCallback((function(e){var t,n=void 0===e?{}:e,i=n.refKey,u=void 0===i?"ref":i,s=n.ref,a=n.onClick,l=n.onKeyDown,c=n.selectedItem,d=n.index,f=o(n,En),g=y.current.state,h=Je(c,d,g.selectedItems,"Pass either item or index to getSelectedItemProps!")[1],m=h>-1&&h===g.activeIndex;return r(((t={})[u]=we(s,(function(e){e&&v.current.push(e)})),t.tabIndex=m?0:-1,t.onClick=xe(a,(function(){p({type:gn,index:h})})),t.onKeyDown=xe(l,(function(e){var t=Pe(e);t&&x[t]&&x[t](e)})),t),f)}),[p,y,x]),getDropdownProps:t.useCallback((function(e,t){var n,i=void 0===e?{}:e,u=i.refKey,s=void 0===u?"ref":u,a=i.ref,l=i.onKeyDown,c=i.onClick,d=i.preventKeyAction,f=void 0!==d&&d,g=o(i,Pn),h=(void 0===t?{}:t).suppressRefError;return b("getDropdownProps",void 0!==h&&h,s,m),r(((n={})[s]=we(a,(function(e){e&&(m.current=e)})),n),!f&&{onKeyDown:xe(l,(function(e){var t=Pe(e);t&&w[t]&&w[t](e)})),onClick:xe(c,(function(){p({type:xn})}))},g)}),[p,w,b]),addSelectedItem:t.useCallback((function(e){p({type:wn,selectedItem:e})}),[p]),removeSelectedItem:t.useCallback((function(e){p({type:Sn,selectedItem:e})}),[p]),setSelectedItems:t.useCallback((function(e){p({type:Cn,selectedItems:e})}),[p]),setActiveIndex:t.useCallback((function(e){p({type:kn,activeIndex:e})}),[p]),reset:t.useCallback((function(){p({type:Dn})}),[p]),selectedItems:g,activeIndex:f}}Rn.stateChangeTypes=On,e.default=Ue,e.resetIdCounter=function(){"useId"in i.default?console.warn("It is not necessary to call resetIdCounter when using React 18+"):he=0},e.useCombobox=sn,e.useMultipleSelection=Rn,e.useSelect=Bt,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
//# sourceMappingURL=downshift.umd.min.js.map |
{ | ||
"name": "downshift", | ||
"version": "8.0.0", | ||
"version": "8.0.1", | ||
"description": "🏎 A set of primitives to build simple, flexible, WAI-ARIA compliant React autocomplete, combobox or select dropdown components.", | ||
@@ -5,0 +5,0 @@ "main": "dist/downshift.cjs.js", |
@@ -9,3 +9,3 @@ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("preact"),require("prop-types")):"function"==typeof define&&define.amd?define(["exports","preact","prop-types"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).Downshift={},e.preact,e.PropTypes)}(this,(function(e,t,n){"use strict";function i(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var o=i(t),r=i(n);function u(e,t){if(null==e)return{};var n,i,o={},r=Object.keys(e);for(i=0;i<r.length;i++)n=r[i],t.indexOf(n)>=0||(o[n]=e[n]);return o}function s(){return s=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(e[i]=n[i])}return e},s.apply(this,arguments)}function l(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function a(e,t){return a=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},a(e,t)}var d={},c=60103,p=60106,f=60107,g=60108,h=60114,m=60109,I=60110,v=60112,y=60113,b=60120,x=60115,w=60116,S=60121,C=60122,k=60117,D=60129,O=60131; | ||
* LICENSE file in the root directory of this source tree. | ||
*/if("function"==typeof Symbol&&Symbol.for){var M=Symbol.for;c=M("react.element"),p=M("react.portal"),f=M("react.fragment"),g=M("react.strict_mode"),h=M("react.profiler"),m=M("react.provider"),I=M("react.context"),v=M("react.forward_ref"),y=M("react.suspense"),b=M("react.suspense_list"),x=M("react.memo"),w=M("react.lazy"),S=M("react.block"),C=M("react.server.block"),k=M("react.fundamental"),D=M("react.debug_trace_mode"),O=M("react.legacy_hidden")}function E(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case c:switch(e=e.type){case f:case h:case g:case y:case b:return e;default:switch(e=e&&e.$$typeof){case I:case v:case w:case x:case m:return e;default:return t}}case p:return t}}}var P=m,K=c,R=v,T=f,H=w,V=x,A=p,B=h,L=g,F=y;d.ContextConsumer=I,d.ContextProvider=P,d.Element=K,d.ForwardRef=R,d.Fragment=T,d.Lazy=H,d.Memo=V,d.Portal=A,d.Profiler=B,d.StrictMode=L,d.Suspense=F,d.isAsyncMode=function(){return!1},d.isConcurrentMode=function(){return!1},d.isContextConsumer=function(e){return E(e)===I},d.isContextProvider=function(e){return E(e)===m},d.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===c},d.isForwardRef=function(e){return E(e)===v},d.isFragment=function(e){return E(e)===f},d.isLazy=function(e){return E(e)===w},d.isMemo=function(e){return E(e)===x},d.isPortal=function(e){return E(e)===p},d.isProfiler=function(e){return E(e)===h},d.isStrictMode=function(e){return E(e)===g},d.isSuspense=function(e){return E(e)===y},d.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===f||e===h||e===D||e===g||e===y||e===b||e===O||"object"==typeof e&&null!==e&&(e.$$typeof===w||e.$$typeof===x||e.$$typeof===m||e.$$typeof===I||e.$$typeof===v||e.$$typeof===k||e.$$typeof===S||e[0]===C)},d.typeOf=E;let _=e=>"object"==typeof e&&null!=e&&1===e.nodeType,N=(e,t)=>(!t||"hidden"!==e)&&"visible"!==e&&"clip"!==e,j=(e,t)=>{if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){let n=getComputedStyle(e,null);return N(n.overflowY,t)||N(n.overflowX,t)||(e=>{let t=(e=>{if(!e.ownerDocument||!e.ownerDocument.defaultView)return null;try{return e.ownerDocument.defaultView.frameElement}catch(e){return null}})(e);return!!t&&(t.clientHeight<e.scrollHeight||t.clientWidth<e.scrollWidth)})(e)}return!1},U=(e,t,n,i,o,r,u,s)=>r<e&&u>t||r>e&&u<t?0:r<=e&&s<=n||u>=t&&s>=n?r-e-i:u>t&&s<n||r<e&&s>n?u-t+o:0,$=e=>{let t=e.parentElement;return null==t?e.getRootNode().host||null:t};var W=0;function q(e){return"function"==typeof e?e:z}function z(){}function X(e,t){if(e){var n=((e,t)=>{var n,i,o,r,u,s;if("undefined"==typeof document)return[];let{scrollMode:l,block:a,inline:d,boundary:c,skipOverflowHiddenElements:p}=t,f="function"==typeof c?c:e=>e!==c;if(!_(e))throw new TypeError("Invalid target");let g=document.scrollingElement||document.documentElement,h=[],m=e;for(;_(m)&&f(m);){if(m=$(m),m===g){h.push(m);break}null!=m&&m===document.body&&j(m)&&!j(document.documentElement)||null!=m&&j(m,p)&&h.push(m)}let I=null!=(i=null==(n=window.visualViewport)?void 0:n.width)?i:innerWidth,v=null!=(r=null==(o=window.visualViewport)?void 0:o.height)?r:innerHeight,y=null!=(u=window.scrollX)?u:pageXOffset,b=null!=(s=window.scrollY)?s:pageYOffset,{height:x,width:w,top:S,right:C,bottom:k,left:D}=e.getBoundingClientRect(),O="start"===a||"nearest"===a?S:"end"===a?k:S+x/2,M="center"===d?D+w/2:"end"===d?C:D,E=[];for(let e=0;e<h.length;e++){let t=h[e],{height:n,width:i,top:o,right:r,bottom:u,left:s}=t.getBoundingClientRect();if("if-needed"===l&&S>=0&&D>=0&&k<=v&&C<=I&&S>=o&&k<=u&&D>=s&&C<=r)return E;let c=getComputedStyle(t),p=parseInt(c.borderLeftWidth,10),f=parseInt(c.borderTopWidth,10),m=parseInt(c.borderRightWidth,10),P=parseInt(c.borderBottomWidth,10),K=0,R=0,T="offsetWidth"in t?t.offsetWidth-t.clientWidth-p-m:0,H="offsetHeight"in t?t.offsetHeight-t.clientHeight-f-P:0,V="offsetWidth"in t?0===t.offsetWidth?0:i/t.offsetWidth:0,A="offsetHeight"in t?0===t.offsetHeight?0:n/t.offsetHeight:0;if(g===t)K="start"===a?O:"end"===a?O-v:"nearest"===a?U(b,b+v,v,f,P,b+O,b+O+x,x):O-v/2,R="start"===d?M:"center"===d?M-I/2:"end"===d?M-I:U(y,y+I,I,p,m,y+M,y+M+w,w),K=Math.max(0,K+b),R=Math.max(0,R+y);else{K="start"===a?O-o-f:"end"===a?O-u+P+H:"nearest"===a?U(o,u,n,f,P+H,O,O+x,x):O-(o+n/2)+H/2,R="start"===d?M-s-p:"center"===d?M-(s+i/2)+T/2:"end"===d?M-r+m+T:U(s,r,i,p,m+T,M,M+w,w);let{scrollLeft:e,scrollTop:l}=t;K=Math.max(0,Math.min(l+K/A,t.scrollHeight-n/A+H)),R=Math.max(0,Math.min(e+R/V,t.scrollWidth-i/V+T)),O+=l-K,M+=e-R}E.push({el:t,top:K,left:R})}return E})(e,{boundary:t,block:"nearest",scrollMode:"if-needed"});n.forEach((function(e){var t=e.el,n=e.top,i=e.left;t.scrollTop=n,t.scrollLeft=i}))}}function Y(e,t,n){return e===t||t instanceof n.Node&&e.contains&&e.contains(t)}function G(e,t){var n;function i(){n&&clearTimeout(n)}function o(){for(var o=arguments.length,r=new Array(o),u=0;u<o;u++)r[u]=arguments[u];i(),n=setTimeout((function(){n=null,e.apply(void 0,r)}),t)}return o.cancel=i,o}function J(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e){for(var n=arguments.length,i=new Array(n>1?n-1:0),o=1;o<n;o++)i[o-1]=arguments[o];return t.some((function(t){return t&&t.apply(void 0,[e].concat(i)),e.preventDownshiftDefault||e.hasOwnProperty("nativeEvent")&&e.nativeEvent.preventDownshiftDefault}))}}function Q(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e){t.forEach((function(t){"function"==typeof t?t(e):t&&(t.current=e)}))}}function Z(){return String(W++)}function ee(e){var t=e.isOpen,n=e.resultCount,i=e.previousResultCount;return t?n?n!==i?n+" result"+(1===n?" is":"s are")+" available, use up and down arrow keys to navigate. Press Enter key to select.":"":"No results are available.":""}function te(e,t){return!(e=Array.isArray(e)?e[0]:e)&&t?t:e}var ne=["highlightedIndex","inputValue","isOpen","selectedItem","type"];function ie(e){void 0===e&&(e={});var t={};return ne.forEach((function(n){e.hasOwnProperty(n)&&(t[n]=e[n])})),t}function oe(e,t){return Object.keys(e).reduce((function(n,i){return n[i]=re(t,i)?t[i]:e[i],n}),{})}function re(e,t){return void 0!==e[t]}function ue(e){var t=e.key,n=e.keyCode;return n>=37&&n<=40&&0!==t.indexOf("Arrow")?"Arrow"+t:t}function se(e,t,n,i,o){void 0===o&&(o=!1);var r=n.length;if(0===r)return-1;var u=r-1;("number"!=typeof e||e<0||e>u)&&(e=t>0?-1:u+1);var s=e+t;s<0?s=o?u:0:s>u&&(s=o?0:u);var l=le(s,t<0,n,i,o);return-1===l?e>=r?-1:e:l}function le(e,t,n,i,o){void 0===o&&(o=!1);var r=n.length;if(t){for(var u=e;u>=0;u--)if(!i(n[u],u))return u}else for(var s=e;s<r;s++)if(!i(n[s],s))return s;return o?le(t?r-1:0,t,n,i):-1}function ae(e,t,n,i){return void 0===i&&(i=!0),t.some((function(t){return t&&(Y(t,e,n)||i&&Y(t,n.document.activeElement,n))}))}var de=G((function(e){pe(e).textContent=""}),500);function ce(e,t){var n=pe(t);e&&(n.textContent=e,de(t))}function pe(e){void 0===e&&(e=document);var t=e.getElementById("a11y-status-message");return t||((t=e.createElement("div")).setAttribute("id","a11y-status-message"),t.setAttribute("role","status"),t.setAttribute("aria-live","polite"),t.setAttribute("aria-relevant","additions text"),Object.assign(t.style,{border:"0",clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:"0",position:"absolute",width:"1px"}),e.body.appendChild(t),t)}var fe=Object.freeze({__proto__:null,unknown:0,mouseUp:1,itemMouseEnter:2,keyDownArrowUp:3,keyDownArrowDown:4,keyDownEscape:5,keyDownEnter:6,keyDownHome:7,keyDownEnd:8,clickItem:9,blurInput:10,changeInput:11,keyDownSpaceButton:12,clickButton:13,blurButton:14,controlledPropUpdatedSelectedItem:15,touchEnd:16}),ge=["refKey","ref"],he=["onClick","onPress","onKeyDown","onKeyUp","onBlur"],me=["onKeyDown","onBlur","onChange","onInput","onChangeText"],Ie=["refKey","ref"],ve=["onMouseMove","onMouseDown","onClick","onPress","index","item"],ye=function(){var e=function(e){var n,i;function o(t){var n=e.call(this,t)||this;n.id=n.props.id||"downshift-"+Z(),n.menuId=n.props.menuId||n.id+"-menu",n.labelId=n.props.labelId||n.id+"-label",n.inputId=n.props.inputId||n.id+"-input",n.getItemId=n.props.getItemId||function(e){return n.id+"-item-"+e},n.input=null,n.items=[],n.itemCount=null,n.previousResultCount=0,n.timeoutIds=[],n.internalSetTimeout=function(e,t){var i=setTimeout((function(){n.timeoutIds=n.timeoutIds.filter((function(e){return e!==i})),e()}),t);n.timeoutIds.push(i)},n.setItemCount=function(e){n.itemCount=e},n.unsetItemCount=function(){n.itemCount=null},n.isItemDisabled=function(e,t){var i=n.getItemNodeFromIndex(t);return i&&i.hasAttribute("disabled")},n.setHighlightedIndex=function(e,t){void 0===e&&(e=n.props.defaultHighlightedIndex),void 0===t&&(t={}),t=ie(t),n.internalSetState(s({highlightedIndex:e},t))},n.clearSelection=function(e){n.internalSetState({selectedItem:null,inputValue:"",highlightedIndex:n.props.defaultHighlightedIndex,isOpen:n.props.defaultIsOpen},e)},n.selectItem=function(e,t,i){t=ie(t),n.internalSetState(s({isOpen:n.props.defaultIsOpen,highlightedIndex:n.props.defaultHighlightedIndex,selectedItem:e,inputValue:n.props.itemToString(e)},t),i)},n.selectItemAtIndex=function(e,t,i){var o=n.items[e];null!=o&&n.selectItem(o,t,i)},n.selectHighlightedItem=function(e,t){return n.selectItemAtIndex(n.getState().highlightedIndex,e,t)},n.internalSetState=function(e,t){var i,o,r={},u="function"==typeof e;return!u&&e.hasOwnProperty("inputValue")&&n.props.onInputValueChange(e.inputValue,s({},n.getStateAndHelpers(),e)),n.setState((function(t){t=n.getState(t);var l=u?e(t):e;l=n.props.stateReducer(t,l),i=l.hasOwnProperty("selectedItem");var a={};return i&&l.selectedItem!==t.selectedItem&&(o=l.selectedItem),l.type=l.type||0,Object.keys(l).forEach((function(e){t[e]!==l[e]&&(r[e]=l[e]),"type"!==e&&(l[e],re(n.props,e)||(a[e]=l[e]))})),u&&l.hasOwnProperty("inputValue")&&n.props.onInputValueChange(l.inputValue,s({},n.getStateAndHelpers(),l)),a}),(function(){q(t)(),Object.keys(r).length>1&&n.props.onStateChange(r,n.getStateAndHelpers()),i&&n.props.onSelect(e.selectedItem,n.getStateAndHelpers()),void 0!==o&&n.props.onChange(o,n.getStateAndHelpers()),n.props.onUserAction(r,n.getStateAndHelpers())}))},n.rootRef=function(e){return n._rootNode=e},n.getRootProps=function(e,t){var i,o=void 0===e?{}:e,r=o.refKey,l=void 0===r?"ref":r,a=o.ref,d=u(o,ge),c=(void 0===t?{}:t).suppressRefError,p=void 0!==c&&c;n.getRootProps.called=!0,n.getRootProps.refKey=l,n.getRootProps.suppressRefError=p;var f=n.getState().isOpen;return s(((i={})[l]=Q(a,n.rootRef),i.role="combobox",i["aria-expanded"]=f,i["aria-haspopup"]="listbox",i["aria-owns"]=f?n.menuId:void 0,i["aria-labelledby"]=n.labelId,i),d)},n.keyDownHandlers={ArrowDown:function(e){var t=this;if(e.preventDefault(),this.getState().isOpen){var n=e.shiftKey?5:1;this.moveHighlightedIndex(n,{type:4})}else this.internalSetState({isOpen:!0,type:4},(function(){var e=t.getItemCount();if(e>0){var n=se(t.getState().highlightedIndex,1,{length:e},t.isItemDisabled,!0);t.setHighlightedIndex(n,{type:4})}}))},ArrowUp:function(e){var t=this;if(e.preventDefault(),this.getState().isOpen){var n=e.shiftKey?-5:-1;this.moveHighlightedIndex(n,{type:3})}else this.internalSetState({isOpen:!0,type:3},(function(){var e=t.getItemCount();if(e>0){var n=se(t.getState().highlightedIndex,-1,{length:e},t.isItemDisabled,!0);t.setHighlightedIndex(n,{type:3})}}))},Enter:function(e){if(229!==e.which){var t=this.getState(),n=t.isOpen,i=t.highlightedIndex;if(n&&null!=i){e.preventDefault();var o=this.items[i],r=this.getItemNodeFromIndex(i);if(null==o||r&&r.hasAttribute("disabled"))return;this.selectHighlightedItem({type:6})}}},Escape:function(e){e.preventDefault(),this.reset(s({type:5},!this.state.isOpen&&{selectedItem:null,inputValue:""}))}},n.buttonKeyDownHandlers=s({},n.keyDownHandlers,{" ":function(e){e.preventDefault(),this.toggleMenu({type:12})}}),n.inputKeyDownHandlers=s({},n.keyDownHandlers,{Home:function(e){var t=this.getState().isOpen;if(t){e.preventDefault();var n=this.getItemCount();if(!(n<=0)&&t){var i=le(0,!1,{length:n},this.isItemDisabled);this.setHighlightedIndex(i,{type:7})}}},End:function(e){var t=this.getState().isOpen;if(t){e.preventDefault();var n=this.getItemCount();if(!(n<=0)&&t){var i=le(n-1,!0,{length:n},this.isItemDisabled);this.setHighlightedIndex(i,{type:8})}}}}),n.getToggleButtonProps=function(e){var t=void 0===e?{}:e,i=t.onClick;t.onPress;var o=t.onKeyDown,r=t.onKeyUp,l=t.onBlur,a=u(t,he),d=n.getState().isOpen,c={onClick:J(i,n.buttonHandleClick),onKeyDown:J(o,n.buttonHandleKeyDown),onKeyUp:J(r,n.buttonHandleKeyUp),onBlur:J(l,n.buttonHandleBlur)};return s({type:"button",role:"button","aria-label":d?"close menu":"open menu","aria-haspopup":!0,"data-toggle":!0},a.disabled?{}:c,a)},n.buttonHandleKeyUp=function(e){e.preventDefault()},n.buttonHandleKeyDown=function(e){var t=ue(e);n.buttonKeyDownHandlers[t]&&n.buttonKeyDownHandlers[t].call(l(n),e)},n.buttonHandleClick=function(e){e.preventDefault(),n.props.environment.document.activeElement===n.props.environment.document.body&&e.target.focus(),n.internalSetTimeout((function(){return n.toggleMenu({type:13})}))},n.buttonHandleBlur=function(e){var t=e.target;n.internalSetTimeout((function(){n.isMouseDown||null!=n.props.environment.document.activeElement&&n.props.environment.document.activeElement.id===n.inputId||n.props.environment.document.activeElement===t||n.reset({type:14})}))},n.getLabelProps=function(e){return s({htmlFor:n.inputId,id:n.labelId},e)},n.getInputProps=function(e){var t=void 0===e?{}:e,i=t.onKeyDown,o=t.onBlur,r=t.onChange,l=t.onInput;t.onChangeText;var a=u(t,me),d={};var c,p=n.getState(),f=p.inputValue,g=p.isOpen,h=p.highlightedIndex;a.disabled||((c={}).onInput=J(r,l,n.inputHandleChange),c.onKeyDown=J(i,n.inputHandleKeyDown),c.onBlur=J(o,n.inputHandleBlur),d=c);return s({"aria-autocomplete":"list","aria-activedescendant":g&&"number"==typeof h&&h>=0?n.getItemId(h):void 0,"aria-controls":g?n.menuId:void 0,"aria-labelledby":a&&a["aria-label"]?void 0:n.labelId,autoComplete:"off",value:f,id:n.inputId},d,a)},n.inputHandleKeyDown=function(e){var t=ue(e);t&&n.inputKeyDownHandlers[t]&&n.inputKeyDownHandlers[t].call(l(n),e)},n.inputHandleChange=function(e){n.internalSetState({type:11,isOpen:!0,inputValue:e.target.value,highlightedIndex:n.props.defaultHighlightedIndex})},n.inputHandleBlur=function(){n.internalSetTimeout((function(){var e=n.props.environment.document&&!!n.props.environment.document.activeElement&&!!n.props.environment.document.activeElement.dataset&&n.props.environment.document.activeElement.dataset.toggle&&n._rootNode&&n._rootNode.contains(n.props.environment.document.activeElement);n.isMouseDown||e||n.reset({type:10})}))},n.menuRef=function(e){n._menuNode=e},n.getMenuProps=function(e,t){var i,o=void 0===e?{}:e,r=o.refKey,l=void 0===r?"ref":r,a=o.ref,d=u(o,Ie),c=(void 0===t?{}:t).suppressRefError,p=void 0!==c&&c;return n.getMenuProps.called=!0,n.getMenuProps.refKey=l,n.getMenuProps.suppressRefError=p,s(((i={})[l]=Q(a,n.menuRef),i.role="listbox",i["aria-labelledby"]=d&&d["aria-label"]?void 0:n.labelId,i.id=n.menuId,i),d)},n.getItemProps=function(e){var t,i=void 0===e?{}:e,o=i.onMouseMove,r=i.onMouseDown,l=i.onClick;i.onPress;var a=i.index,d=i.item,c=void 0===d?void 0:d,p=u(i,ve);void 0===a?(n.items.push(c),a=n.items.indexOf(c)):n.items[a]=c;var f=l,g=((t={onMouseMove:J(o,(function(){a!==n.getState().highlightedIndex&&(n.setHighlightedIndex(a,{type:2}),n.avoidScrolling=!0,n.internalSetTimeout((function(){return n.avoidScrolling=!1}),250))})),onMouseDown:J(r,(function(e){e.preventDefault()}))}).onClick=J(f,(function(){n.selectItemAtIndex(a,{type:9})})),t),h=p.disabled?{onMouseDown:g.onMouseDown}:g;return s({id:n.getItemId(a),role:"option","aria-selected":n.getState().highlightedIndex===a},h,p)},n.clearItems=function(){n.items=[]},n.reset=function(e,t){void 0===e&&(e={}),e=ie(e),n.internalSetState((function(t){var i=t.selectedItem;return s({isOpen:n.props.defaultIsOpen,highlightedIndex:n.props.defaultHighlightedIndex,inputValue:n.props.itemToString(i)},e)}),t)},n.toggleMenu=function(e,t){void 0===e&&(e={}),e=ie(e),n.internalSetState((function(t){var i=t.isOpen;return s({isOpen:!i},i&&{highlightedIndex:n.props.defaultHighlightedIndex},e)}),(function(){var i=n.getState(),o=i.isOpen,r=i.highlightedIndex;o&&n.getItemCount()>0&&"number"==typeof r&&n.setHighlightedIndex(r,e),q(t)()}))},n.openMenu=function(e){n.internalSetState({isOpen:!0},e)},n.closeMenu=function(e){n.internalSetState({isOpen:!1},e)},n.updateStatus=G((function(){var e=n.getState(),t=n.items[e.highlightedIndex],i=n.getItemCount(),o=n.props.getA11yStatusMessage(s({itemToString:n.props.itemToString,previousResultCount:n.previousResultCount,resultCount:i,highlightedItem:t},e));n.previousResultCount=i,ce(o,n.props.environment.document)}),200);var i=n.props,o=i.defaultHighlightedIndex,r=i.initialHighlightedIndex,a=void 0===r?o:r,d=i.defaultIsOpen,c=i.initialIsOpen,p=void 0===c?d:c,f=i.initialInputValue,g=void 0===f?"":f,h=i.initialSelectedItem,m=void 0===h?null:h,I=n.getState({highlightedIndex:a,isOpen:p,inputValue:g,selectedItem:m});return null!=I.selectedItem&&void 0===n.props.initialInputValue&&(I.inputValue=n.props.itemToString(I.selectedItem)),n.state=I,n}i=e,(n=o).prototype=Object.create(i.prototype),n.prototype.constructor=n,a(n,i);var r=o.prototype;return r.internalClearTimeouts=function(){this.timeoutIds.forEach((function(e){clearTimeout(e)})),this.timeoutIds=[]},r.getState=function(e){return void 0===e&&(e=this.state),oe(e,this.props)},r.getItemCount=function(){var e=this.items.length;return null!=this.itemCount?e=this.itemCount:void 0!==this.props.itemCount&&(e=this.props.itemCount),e},r.getItemNodeFromIndex=function(e){return this.props.environment.document.getElementById(this.getItemId(e))},r.scrollHighlightedItemIntoView=function(){var e=this.getItemNodeFromIndex(this.getState().highlightedIndex);this.props.scrollIntoView(e,this._menuNode)},r.moveHighlightedIndex=function(e,t){var n=this.getItemCount(),i=this.getState().highlightedIndex;if(n>0){var o=se(i,e,{length:n},this.isItemDisabled,!0);this.setHighlightedIndex(o,t)}},r.getStateAndHelpers=function(){var e=this.getState(),t=e.highlightedIndex,n=e.inputValue,i=e.selectedItem,o=e.isOpen,r=this.props.itemToString,u=this.id,s=this.getRootProps,l=this.getToggleButtonProps,a=this.getLabelProps,d=this.getMenuProps,c=this.getInputProps,p=this.getItemProps,f=this.openMenu,g=this.closeMenu,h=this.toggleMenu,m=this.selectItem,I=this.selectItemAtIndex,v=this.selectHighlightedItem,y=this.setHighlightedIndex,b=this.clearSelection,x=this.clearItems;return{getRootProps:s,getToggleButtonProps:l,getLabelProps:a,getMenuProps:d,getInputProps:c,getItemProps:p,reset:this.reset,openMenu:f,closeMenu:g,toggleMenu:h,selectItem:m,selectItemAtIndex:I,selectHighlightedItem:v,setHighlightedIndex:y,clearSelection:b,clearItems:x,setItemCount:this.setItemCount,unsetItemCount:this.unsetItemCount,setState:this.internalSetState,itemToString:r,id:u,highlightedIndex:t,inputValue:n,isOpen:o,selectedItem:i}},r.componentDidMount=function(){var e=this,t=function(){e.isMouseDown=!0},n=function(t){e.isMouseDown=!1,!ae(t.target,[e._rootNode,e._menuNode],e.props.environment)&&e.getState().isOpen&&e.reset({type:1},(function(){return e.props.onOuterClick(e.getStateAndHelpers())}))},i=function(){e.isTouchMove=!1},o=function(){e.isTouchMove=!0},r=function(t){var n=ae(t.target,[e._rootNode,e._menuNode],e.props.environment,!1);e.isTouchMove||n||!e.getState().isOpen||e.reset({type:16},(function(){return e.props.onOuterClick(e.getStateAndHelpers())}))},u=this.props.environment;u.addEventListener("mousedown",t),u.addEventListener("mouseup",n),u.addEventListener("touchstart",i),u.addEventListener("touchmove",o),u.addEventListener("touchend",r),this.cleanup=function(){e.internalClearTimeouts(),e.updateStatus.cancel(),u.removeEventListener("mousedown",t),u.removeEventListener("mouseup",n),u.removeEventListener("touchstart",i),u.removeEventListener("touchmove",o),u.removeEventListener("touchend",r)}},r.shouldScroll=function(e,t){var n=(void 0===this.props.highlightedIndex?this.getState():this.props).highlightedIndex,i=(void 0===t.highlightedIndex?e:t).highlightedIndex;return n&&this.getState().isOpen&&!e.isOpen||n!==i},r.componentDidUpdate=function(e,t){re(this.props,"selectedItem")&&this.props.selectedItemChanged(e.selectedItem,this.props.selectedItem)&&this.internalSetState({type:15,inputValue:this.props.itemToString(this.props.selectedItem)}),!this.avoidScrolling&&this.shouldScroll(t,e)&&this.scrollHighlightedItemIntoView(),this.updateStatus()},r.componentWillUnmount=function(){this.cleanup()},r.render=function(){var e=te(this.props.children,z);this.clearItems(),this.getRootProps.called=!1,this.getRootProps.refKey=void 0,this.getRootProps.suppressRefError=void 0,this.getMenuProps.called=!1,this.getMenuProps.refKey=void 0,this.getMenuProps.suppressRefError=void 0,this.getLabelProps.called=!1,this.getInputProps.called=!1;var n=te(e(this.getStateAndHelpers()));return n?this.getRootProps.called||this.props.suppressRefError?n:function(e){return"string"==typeof e.type||"string"==typeof e.nodeName}(n)?t.cloneElement(n,this.getRootProps(function(e){return e.props||e.attributes}(n))):void 0:null},o}(t.Component);return e.defaultProps={defaultHighlightedIndex:null,defaultIsOpen:!1,getA11yStatusMessage:ee,itemToString:function(e){return null==e?"":String(e)},onStateChange:z,onInputValueChange:z,onUserAction:z,onChange:z,onSelect:z,onOuterClick:z,selectedItemChanged:function(e,t){return e!==t},environment:"undefined"==typeof window?{}:window,stateReducer:function(e,t){return t},suppressRefError:!1,scrollIntoView:X},e.stateChangeTypes=fe,e}(),be=ye,xe=["isInitialMount","highlightedIndex","items","environment"],we={highlightedIndex:-1,isOpen:!1,selectedItem:null,inputValue:""};function Se(e,t,n){var i=e.props,o=e.type,r={};Object.keys(t).forEach((function(i){!function(e,t,n,i){var o=t.props,r=t.type,u="on"+Me(e)+"Change";o[u]&&void 0!==i[e]&&i[e]!==n[e]&&o[u](s({type:r},i))}(i,e,t,n),n[i]!==t[i]&&(r[i]=n[i])})),i.onStateChange&&Object.keys(r).length&&i.onStateChange(s({type:o},r))}var Ce=G((function(e,t){ce(e(),t)}),200),ke="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement?t.useLayoutEffect:t.useEffect,De="useId"in o.default?function(e){var n=e.id,i=e.labelId,r=e.menuId,u=e.getItemId,s=e.toggleButtonId,l=e.inputId,a="downshift-"+o.default.useId();return n||(n=a),t.useRef({labelId:i||n+"-label",menuId:r||n+"-menu",getItemId:u||function(e){return n+"-item-"+e},toggleButtonId:s||n+"-toggle-button",inputId:l||n+"-input"}).current}:function(e){var n=e.id,i=void 0===n?"downshift-"+Z():n,o=e.labelId,r=e.menuId,u=e.getItemId,s=e.toggleButtonId,l=e.inputId;return t.useRef({labelId:o||i+"-label",menuId:r||i+"-menu",getItemId:u||function(e){return i+"-item-"+e},toggleButtonId:s||i+"-toggle-button",inputId:l||i+"-input"}).current};function Oe(e,t,n,i){var o,r;if(void 0===e){if(void 0===t)throw new Error(i);o=n[t],r=t}else r=void 0===t?n.indexOf(e):t,o=e;return[o,r]}function Me(e){return""+e.slice(0,1).toUpperCase()+e.slice(1)}function Ee(e){var n=t.useRef(e);return n.current=e,n}function Pe(e,n,i){var o=t.useRef(),r=t.useRef(),u=t.useCallback((function(t,n){r.current=n,t=oe(t,n.props);var i=e(t,n);return n.props.stateReducer(t,s({},n,{changes:i}))}),[e]),l=t.useReducer(u,n),a=l[0],d=l[1],c=Ee(i),p=t.useCallback((function(e){return d(s({props:c.current},e))}),[c]),f=r.current;return t.useEffect((function(){f&&o.current&&o.current!==a&&Se(f,oe(o.current,f.props),a),o.current=a}),[a,i,f]),[a,p]}function Ke(e,t,n){var i=Pe(e,t,n),o=i[0],r=i[1];return[oe(o,n),r]}var Re={itemToString:function(e){return e?String(e):""},stateReducer:function(e,t){return t.changes},getA11ySelectionMessage:function(e){var t=e.selectedItem,n=e.itemToString;return t?n(t)+" has been selected.":""},scrollIntoView:X,environment:"undefined"==typeof window?{}:window};function Te(e,t,n){void 0===n&&(n=we);var i=e["default"+Me(t)];return void 0!==i?i:n[t]}function He(e,t,n){void 0===n&&(n=we);var i=e[t];if(void 0!==i)return i;var o=e["initial"+Me(t)];return void 0!==o?o:Te(e,t,n)}function Ve(e){var t=He(e,"selectedItem"),n=He(e,"isOpen"),i=He(e,"highlightedIndex"),o=He(e,"inputValue");return{highlightedIndex:i<0&&t&&n?e.items.indexOf(t):i,isOpen:n,selectedItem:t,inputValue:o}}function Ae(e,t,n){var i=e.items,o=e.initialHighlightedIndex,r=e.defaultHighlightedIndex,u=t.selectedItem,s=t.highlightedIndex;return 0===i.length?-1:void 0!==o&&s===o?o:void 0!==r?r:u?i.indexOf(u):0===n?-1:n<0?i.length-1:0}function Be(e,n,i,o){var r=t.useRef({isMouseDown:!1,isTouchMove:!1});return t.useEffect((function(){if(null!=(null==i?void 0:i.addEventListener)){var t=function(){r.current.isMouseDown=!0},u=function(t){r.current.isMouseDown=!1,e&&!ae(t.target,n.map((function(e){return e.current})),i)&&o()},s=function(){r.current.isTouchMove=!1},l=function(){r.current.isTouchMove=!0},a=function(t){!e||r.current.isTouchMove||ae(t.target,n.map((function(e){return e.current})),i,!1)||o()};return i.addEventListener("mousedown",t),i.addEventListener("mouseup",u),i.addEventListener("touchstart",s),i.addEventListener("touchmove",l),i.addEventListener("touchend",a),function(){i.removeEventListener("mousedown",t),i.removeEventListener("mouseup",u),i.removeEventListener("touchstart",s),i.removeEventListener("touchmove",l),i.removeEventListener("touchend",a)}}}),[e,i]),r}var Le=function(){return z};function Fe(e,n,i){var o=i.isInitialMount,r=i.highlightedIndex,l=i.items,a=i.environment,d=u(i,xe);t.useEffect((function(){o||Ce((function(){return e(s({highlightedIndex:r,highlightedItem:l[r],resultCount:l.length},d))}),a.document)}),n)}function _e(e){var n=e.highlightedIndex,i=e.isOpen,o=e.itemRefs,r=e.getItemNodeFromIndex,u=e.menuElement,s=e.scrollIntoView,l=t.useRef(!0);return ke((function(){n<0||!i||!Object.keys(o.current).length||(!1===l.current?l.current=!0:s(r(n),u))}),[n]),l}var Ne=z;function je(e,t,n){var i;return void 0===n&&(n=!0),s({isOpen:!1,highlightedIndex:-1},(null==(i=e.items)?void 0:i.length)&&t>=0&&s({selectedItem:e.items[t],isOpen:Te(e,"isOpen"),highlightedIndex:Te(e,"highlightedIndex")},n&&{inputValue:e.itemToString(e.items[t])}))}var Ue={environment:r.default.shape({addEventListener:r.default.func.isRequired,removeEventListener:r.default.func.isRequired,document:r.default.shape({createElement:r.default.func.isRequired,getElementById:r.default.func.isRequired,activeElement:r.default.any.isRequired,body:r.default.any.isRequired}).isRequired,Node:r.default.func.isRequired}),itemToString:r.default.func,stateReducer:r.default.func},$e=s({},Ue,{getA11yStatusMessage:r.default.func,highlightedIndex:r.default.number,defaultHighlightedIndex:r.default.number,initialHighlightedIndex:r.default.number,isOpen:r.default.bool,defaultIsOpen:r.default.bool,initialIsOpen:r.default.bool,selectedItem:r.default.any,initialSelectedItem:r.default.any,defaultSelectedItem:r.default.any,id:r.default.string,labelId:r.default.string,menuId:r.default.string,getItemId:r.default.func,toggleButtonId:r.default.string,onSelectedItemChange:r.default.func,onHighlightedIndexChange:r.default.func,onStateChange:r.default.func,onIsOpenChange:r.default.func,scrollIntoView:r.default.func});function We(e,t,n){var i,o=t.type,r=t.props;switch(o){case n.ItemMouseMove:i={highlightedIndex:t.disabled?-1:t.index};break;case n.MenuMouseLeave:i={highlightedIndex:-1};break;case n.ToggleButtonClick:case n.FunctionToggleMenu:i={isOpen:!e.isOpen,highlightedIndex:e.isOpen?-1:Ae(r,e,0)};break;case n.FunctionOpenMenu:i={isOpen:!0,highlightedIndex:Ae(r,e,0)};break;case n.FunctionCloseMenu:i={isOpen:!1};break;case n.FunctionSetHighlightedIndex:i={highlightedIndex:t.highlightedIndex};break;case n.FunctionSetInputValue:i={inputValue:t.inputValue};break;case n.FunctionReset:i={highlightedIndex:Te(r,"highlightedIndex"),isOpen:Te(r,"isOpen"),selectedItem:Te(r,"selectedItem"),inputValue:Te(r,"inputValue")};break;default:throw new Error("Reducer called without proper action type.")}return s({},e,i)}var qe=function(){return qe=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},qe.apply(this,arguments)};"function"==typeof SuppressedError&&SuppressedError,qe(qe({},$e),{items:r.default.array.isRequired,isItemDisabled:r.default.func,getA11ySelectionMessage:r.default.func});var ze=qe(qe({},Re),{getA11yStatusMessage:function(e){var t=e.isOpen,n=e.resultCount,i=e.previousResultCount;return t?n?n!==i?"".concat(n," result").concat(1===n?" is":"s are"," available, use up and down arrow keys to navigate. Press Enter or Space Bar keys to select."):"":"No results are available.":""},isItemDisabled:function(){return!1}}),Xe=z,Ye=1,Ge=2,Je=3,Qe=4,Ze=5,et=6,tt=7,nt=8,it=9,ot=10,rt=11,ut=14,st=19,lt=Object.freeze({__proto__:null,ToggleButtonClick:0,ToggleButtonKeyDownArrowDown:Ye,ToggleButtonKeyDownArrowUp:Ge,ToggleButtonKeyDownCharacter:Je,ToggleButtonKeyDownEscape:Qe,ToggleButtonKeyDownHome:Ze,ToggleButtonKeyDownEnd:et,ToggleButtonKeyDownEnter:tt,ToggleButtonKeyDownSpaceButton:nt,ToggleButtonKeyDownPageUp:it,ToggleButtonKeyDownPageDown:ot,ToggleButtonBlur:rt,MenuMouseLeave:12,ItemMouseMove:13,ItemClick:ut,FunctionToggleMenu:15,FunctionOpenMenu:16,FunctionCloseMenu:17,FunctionSetHighlightedIndex:18,FunctionSelectItem:st,FunctionSetInputValue:20,FunctionReset:21});function at(e,t){var n,i,o=t.type,r=t.props,u=t.altKey;switch(o){case ut:i={isOpen:Te(r,"isOpen"),highlightedIndex:Te(r,"highlightedIndex"),selectedItem:r.items[t.index]};break;case Je:var l=t.key,a=""+e.inputValue+l,d=function(e){for(var t=e.keysSoFar,n=e.highlightedIndex,i=e.items,o=e.itemToString,r=e.isItemDisabled,u=t.toLowerCase(),s=0;s<i.length;s++){var l=(s+n+(t.length<2?1:0))%i.length,a=i[l];if(void 0!==a&&o(a).toLowerCase().startsWith(u)&&!r(a,l))return l}return n}({keysSoFar:a,highlightedIndex:!e.isOpen&&e.selectedItem?r.items.indexOf(e.selectedItem):e.highlightedIndex,items:r.items,itemToString:r.itemToString,isItemDisabled:r.isItemDisabled});i={inputValue:a,highlightedIndex:d,isOpen:!0};break;case Ye:i={highlightedIndex:e.isOpen?se(e.highlightedIndex,1,r.items,r.isItemDisabled):u&&null==e.selectedItem?-1:Ae(r,e,1),isOpen:!0};break;case Ge:if(e.isOpen&&u)i=je(r,e.highlightedIndex,!1);else i={highlightedIndex:e.isOpen?se(e.highlightedIndex,-1,r.items,r.isItemDisabled):Ae(r,e,-1),isOpen:!0};break;case tt:case nt:i=je(r,e.highlightedIndex,!1);break;case Ze:i={highlightedIndex:le(0,!1,r.items,r.isItemDisabled),isOpen:!0};break;case et:i={highlightedIndex:le(r.items.length-1,!0,r.items,r.isItemDisabled),isOpen:!0};break;case it:i={highlightedIndex:se(e.highlightedIndex,-10,r.items,r.isItemDisabled)};break;case ot:i={highlightedIndex:se(e.highlightedIndex,10,r.items,r.isItemDisabled)};break;case Qe:i={isOpen:!1,highlightedIndex:-1};break;case rt:i=s({isOpen:!1,highlightedIndex:-1},e.highlightedIndex>=0&&(null==(n=r.items)?void 0:n.length)&&{selectedItem:r.items[e.highlightedIndex]});break;case st:i={selectedItem:t.selectedItem};break;default:return We(e,t,lt)}return s({},e,i)}var dt=["onMouseLeave","refKey","onKeyDown","onBlur","ref"],ct=["onBlur","onClick","onPress","onKeyDown","refKey","ref"],pt=["item","index","onMouseMove","onClick","onPress","refKey","disabled","ref"];function ft(e){void 0===e&&(e={}),Xe();var n=s({},ze,e),i=n.items,o=n.scrollIntoView,r=n.environment,l=n.itemToString,a=n.getA11ySelectionMessage,d=n.getA11yStatusMessage,c=Ke(at,Ve(n),n),p=c[0],f=c[1],g=p.isOpen,h=p.highlightedIndex,m=p.selectedItem,I=p.inputValue,v=t.useRef(null),y=t.useRef(null),b=t.useRef({}),x=t.useRef(null),w=De(n),S=t.useRef(),C=t.useRef(!0),k=Ee({state:p,props:n}),D=t.useCallback((function(e){return b.current[w.getItemId(e)]}),[w]);Fe(d,[g,h,I,i],s({isInitialMount:C.current,previousResultCount:S.current,items:i,environment:r,itemToString:l},p)),Fe(a,[m],s({isInitialMount:C.current,previousResultCount:S.current,items:i,environment:r,itemToString:l},p));var O=_e({menuElement:y.current,highlightedIndex:h,isOpen:g,itemRefs:b,scrollIntoView:o,getItemNodeFromIndex:D});t.useEffect((function(){return x.current=G((function(e){e({type:20,inputValue:""})}),500),function(){x.current.cancel()}}),[]),t.useEffect((function(){I&&x.current(f)}),[f,I]),Ne({isInitialMount:C.current,props:n,state:p}),t.useEffect((function(){C.current||(S.current=i.length)}));var M=Be(g,[y,v],r,(function(){f({type:rt})})),E=Le();t.useEffect((function(){return C.current=!1,function(){C.current=!0}}),[]),t.useEffect((function(){g||(b.current={})}),[g]);var P=t.useMemo((function(){return{ArrowDown:function(e){e.preventDefault(),f({type:Ye,altKey:e.altKey})},ArrowUp:function(e){e.preventDefault(),f({type:Ge,altKey:e.altKey})},Home:function(e){e.preventDefault(),f({type:Ze})},End:function(e){e.preventDefault(),f({type:et})},Escape:function(){k.current.state.isOpen&&f({type:Qe})},Enter:function(e){e.preventDefault(),f({type:k.current.state.isOpen?tt:0})},PageUp:function(e){k.current.state.isOpen&&(e.preventDefault(),f({type:it}))},PageDown:function(e){k.current.state.isOpen&&(e.preventDefault(),f({type:ot}))}," ":function(e){e.preventDefault();var t=k.current.state;t.isOpen?t.inputValue?f({type:Je,key:" "}):f({type:nt}):f({type:0})}}}),[f,k]),K=t.useCallback((function(){f({type:15})}),[f]),R=t.useCallback((function(){f({type:17})}),[f]),T=t.useCallback((function(){f({type:16})}),[f]),H=t.useCallback((function(e){f({type:18,highlightedIndex:e})}),[f]),V=t.useCallback((function(e){f({type:st,selectedItem:e})}),[f]),A=t.useCallback((function(){f({type:21})}),[f]),B=t.useCallback((function(e){f({type:20,inputValue:e})}),[f]),L=t.useCallback((function(e){return s({id:w.labelId,htmlFor:w.toggleButtonId},e)}),[w]),F=t.useCallback((function(e,t){var n,i=void 0===e?{}:e,o=i.onMouseLeave,r=i.refKey,l=void 0===r?"ref":r;i.onKeyDown,i.onBlur;var a=i.ref,d=u(i,dt),c=(void 0===t?{}:t).suppressRefError;return E("getMenuProps",void 0!==c&&c,l,y),s(((n={})[l]=Q(a,(function(e){y.current=e})),n.id=w.menuId,n.role="listbox",n["aria-labelledby"]=d&&d["aria-label"]?void 0:""+w.labelId,n.onMouseLeave=J(o,(function(){f({type:12})})),n),d)}),[f,E,w]);return{getToggleButtonProps:t.useCallback((function(e,t){var n,i=void 0===e?{}:e,o=i.onBlur,r=i.onClick;i.onPress;var l=i.onKeyDown,a=i.refKey,d=void 0===a?"ref":a,c=i.ref,p=u(i,ct),g=(void 0===t?{}:t).suppressRefError,h=void 0!==g&&g,m=k.current.state,I=s(((n={})[d]=Q(c,(function(e){v.current=e})),n["aria-activedescendant"]=m.isOpen&&m.highlightedIndex>-1?w.getItemId(m.highlightedIndex):"",n["aria-controls"]=w.menuId,n["aria-expanded"]=k.current.state.isOpen,n["aria-haspopup"]="listbox",n["aria-labelledby"]=p&&p["aria-label"]?void 0:""+w.labelId,n.id=w.toggleButtonId,n.role="combobox",n.tabIndex=0,n.onBlur=J(o,(function(){m.isOpen&&!M.current.isMouseDown&&f({type:rt})})),n),p);return p.disabled||(I.onClick=J(r,(function(){f({type:0})})),I.onKeyDown=J(l,(function(e){var t=ue(e);t&&P[t]?P[t](e):function(e){return/^\S{1}$/.test(e)}(t)&&f({type:Je,key:t})}))),E("getToggleButtonProps",h,d,v),I}),[k,w,E,f,M,P]),getLabelProps:L,getMenuProps:F,getItemProps:t.useCallback((function(e){var t,n=void 0===e?{}:e,i=n.item,o=n.index,r=n.onMouseMove,l=n.onClick;n.onPress;var a=n.refKey,d=void 0===a?"ref":a,c=n.disabled,p=n.ref,g=u(n,pt);void 0!==c&&console.warn('Passing "disabled" as an argument to getItemProps is not supported anymore. Please use the isItemDisabled prop from useSelect.');var h=k.current,m=h.state,I=h.props,v=Oe(i,o,I.items,"Pass either item or index to getItemProps!"),y=v[0],x=v[1],S=I.isItemDisabled(y,x),C=s(((t={})[d]=Q(p,(function(e){e&&(b.current[w.getItemId(x)]=e)})),t["aria-disabled"]=S,t["aria-selected"]=""+(y===m.selectedItem),t.id=w.getItemId(x),t.role="option",t),g);return S||(C.onClick=J(l,(function(){f({type:ut,index:x})}))),C.onMouseMove=J(r,(function(){x!==m.highlightedIndex&&(O.current=!1,f({type:13,index:x,disabled:S}))})),C}),[k,w,O,f]),toggleMenu:K,openMenu:T,closeMenu:R,setHighlightedIndex:H,selectItem:V,reset:A,setInputValue:B,highlightedIndex:h,isOpen:g,selectedItem:m,inputValue:I}}ft.stateChangeTypes=lt;var gt=0,ht=1,mt=2,It=3,vt=4,yt=5,bt=6,xt=7,wt=8,St=9,Ct=10,kt=13,Dt=19,Ot=22,Mt=Object.freeze({__proto__:null,InputKeyDownArrowDown:gt,InputKeyDownArrowUp:ht,InputKeyDownEscape:mt,InputKeyDownHome:It,InputKeyDownEnd:vt,InputKeyDownPageUp:yt,InputKeyDownPageDown:bt,InputKeyDownEnter:xt,InputChange:wt,InputBlur:St,InputClick:Ct,MenuMouseLeave:11,ItemMouseMove:12,ItemClick:kt,ToggleButtonClick:14,FunctionToggleMenu:15,FunctionOpenMenu:16,FunctionCloseMenu:17,FunctionSetHighlightedIndex:18,FunctionSelectItem:Dt,FunctionSetInputValue:20,FunctionReset:21,ControlledPropUpdatedSelectedItem:Ot});s({},$e,{items:r.default.array.isRequired,isItemDisabled:r.default.func,selectedItemChanged:r.default.func,getA11ySelectionMessage:r.default.func,inputValue:r.default.string,defaultInputValue:r.default.string,initialInputValue:r.default.string,inputId:r.default.string,onInputValueChange:r.default.func});var Et=z,Pt=s({},Re,{selectedItemChanged:function(e,t){return e!==t},getA11yStatusMessage:ee,isItemDisabled:function(){return!1}});function Kt(e,t){var n,i,o=t.type,r=t.props,u=t.altKey;switch(o){case kt:i={isOpen:Te(r,"isOpen"),highlightedIndex:Te(r,"highlightedIndex"),selectedItem:r.items[t.index],inputValue:r.itemToString(r.items[t.index])};break;case gt:i=e.isOpen?{highlightedIndex:se(e.highlightedIndex,1,r.items,r.isItemDisabled,!0)}:{highlightedIndex:u&&null==e.selectedItem?-1:Ae(r,e,1),isOpen:r.items.length>=0};break;case ht:i=e.isOpen?u?je(r,e.highlightedIndex):{highlightedIndex:se(e.highlightedIndex,-1,r.items,r.isItemDisabled,!0)}:{highlightedIndex:Ae(r,e,-1),isOpen:r.items.length>=0};break;case xt:i=je(r,e.highlightedIndex);break;case mt:i=s({isOpen:!1,highlightedIndex:-1},!e.isOpen&&{selectedItem:null,inputValue:""});break;case yt:i={highlightedIndex:se(e.highlightedIndex,-10,r.items,r.isItemDisabled,!0)};break;case bt:i={highlightedIndex:se(e.highlightedIndex,10,r.items,r.isItemDisabled,!0)};break;case It:i={highlightedIndex:le(0,!1,r.items,r.isItemDisabled)};break;case vt:i={highlightedIndex:le(r.items.length-1,!0,r.items,r.isItemDisabled)};break;case St:i=s({isOpen:!1,highlightedIndex:-1},e.highlightedIndex>=0&&(null==(n=r.items)?void 0:n.length)&&t.selectItem&&{selectedItem:r.items[e.highlightedIndex],inputValue:r.itemToString(r.items[e.highlightedIndex])});break;case wt:i={isOpen:!0,highlightedIndex:Te(r,"highlightedIndex"),inputValue:t.inputValue};break;case Ct:i={isOpen:!e.isOpen,highlightedIndex:e.isOpen?-1:Ae(r,e,0)};break;case Dt:i={selectedItem:t.selectedItem,inputValue:r.itemToString(t.selectedItem)};break;case Ot:i={inputValue:t.inputValue};break;default:return We(e,t,Mt)}return s({},e,i)}var Rt=["onMouseLeave","refKey","ref"],Tt=["item","index","refKey","ref","onMouseMove","onMouseDown","onClick","onPress","disabled"],Ht=["onClick","onPress","refKey","ref"],Vt=["onKeyDown","onChange","onInput","onBlur","onChangeText","onClick","refKey","ref"];function At(e){void 0===e&&(e={}),Et();var n=s({},Pt,e),i=n.initialIsOpen,o=n.defaultIsOpen,r=n.items,l=n.scrollIntoView,a=n.environment,d=n.getA11yStatusMessage,c=n.getA11ySelectionMessage,p=n.itemToString,f=function(e){var t=Ve(e),n=t.selectedItem,i=t.inputValue;return""===i&&n&&void 0===e.defaultInputValue&&void 0===e.initialInputValue&&void 0===e.inputValue&&(i=e.itemToString(n)),s({},t,{inputValue:i})}(n),g=function(e,n,i){var o=t.useRef(),r=Pe(e,n,i),u=r[0],s=r[1];return t.useEffect((function(){re(i,"selectedItem")&&(i.selectedItemChanged(o.current,i.selectedItem)&&s({type:Ot,inputValue:i.itemToString(i.selectedItem)}),o.current=u.selectedItem===o.current?i.selectedItem:u.selectedItem)}),[u.selectedItem,i.selectedItem]),[oe(u,i),s]}(Kt,f,n),h=g[0],m=g[1],I=h.isOpen,v=h.highlightedIndex,y=h.selectedItem,b=h.inputValue,x=t.useRef(null),w=t.useRef({}),S=t.useRef(null),C=t.useRef(null),k=t.useRef(!0),D=De(n),O=t.useRef(),M=Ee({state:h,props:n}),E=t.useCallback((function(e){return w.current[D.getItemId(e)]}),[D]);Fe(d,[I,v,b,r],s({isInitialMount:k.current,previousResultCount:O.current,items:r,environment:a,itemToString:p},h)),Fe(c,[y],s({isInitialMount:k.current,previousResultCount:O.current,items:r,environment:a,itemToString:p},h));var P=_e({menuElement:x.current,highlightedIndex:v,isOpen:I,itemRefs:w,scrollIntoView:l,getItemNodeFromIndex:E});Ne({isInitialMount:k.current,props:n,state:h}),t.useEffect((function(){(i||o||I)&&S.current&&S.current.focus()}),[]),t.useEffect((function(){k.current||(O.current=r.length)}));var K=Be(I,[S,x,C],a,(function(){m({type:St,selectItem:!1})})),R=Le();t.useEffect((function(){return k.current=!1,function(){k.current=!0}}),[]),t.useEffect((function(){var e;if(I){if((null==(e=a.document)?void 0:e.activeElement)!==S.current){var t;null==S||null==(t=S.current)||t.focus()}}else w.current={}}),[I,a]);var T=t.useMemo((function(){return{ArrowDown:function(e){e.preventDefault(),m({type:gt,altKey:e.altKey})},ArrowUp:function(e){e.preventDefault(),m({type:ht,altKey:e.altKey})},Home:function(e){M.current.state.isOpen&&(e.preventDefault(),m({type:It}))},End:function(e){M.current.state.isOpen&&(e.preventDefault(),m({type:vt}))},Escape:function(e){var t=M.current.state;(t.isOpen||t.inputValue||t.selectedItem||t.highlightedIndex>-1)&&(e.preventDefault(),m({type:mt}))},Enter:function(e){M.current.state.isOpen&&229!==e.which&&(e.preventDefault(),m({type:xt}))},PageUp:function(e){M.current.state.isOpen&&(e.preventDefault(),m({type:yt}))},PageDown:function(e){M.current.state.isOpen&&(e.preventDefault(),m({type:bt}))}}}),[m,M]),H=t.useCallback((function(e){return s({id:D.labelId,htmlFor:D.inputId},e)}),[D]),V=t.useCallback((function(e,t){var n,i=void 0===e?{}:e,o=i.onMouseLeave,r=i.refKey,l=void 0===r?"ref":r,a=i.ref,d=u(i,Rt),c=(void 0===t?{}:t).suppressRefError;return R("getMenuProps",void 0!==c&&c,l,x),s(((n={})[l]=Q(a,(function(e){x.current=e})),n.id=D.menuId,n.role="listbox",n["aria-labelledby"]=d&&d["aria-label"]?void 0:""+D.labelId,n.onMouseLeave=J(o,(function(){m({type:11})})),n),d)}),[m,R,D]),A=t.useCallback((function(e){var t,n,i=void 0===e?{}:e,o=i.item,r=i.index,l=i.refKey,a=void 0===l?"ref":l,d=i.ref,c=i.onMouseMove,p=i.onMouseDown,f=i.onClick;i.onPress;var g=i.disabled,h=u(i,Tt);void 0!==g&&console.warn('Passing "disabled" as an argument to getItemProps is not supported anymore. Please use the isItemDisabled prop from useCombobox.');var I=M.current,v=I.props,y=I.state,b=Oe(o,r,v.items,"Pass either item or index to getItemProps!"),x=b[0],S=b[1],C=v.isItemDisabled(x,S),k=f;return s(((t={})[a]=Q(d,(function(e){e&&(w.current[D.getItemId(S)]=e)})),t["aria-disabled"]=C,t["aria-selected"]=""+(S===y.highlightedIndex),t.id=D.getItemId(S),t.role="option",t),!C&&((n={}).onClick=J(k,(function(){m({type:kt,index:S})})),n),{onMouseMove:J(c,(function(){S!==y.highlightedIndex&&(P.current=!1,m({type:12,index:S,disabled:C}))})),onMouseDown:J(p,(function(e){return e.preventDefault()}))},h)}),[m,M,P,D]),B=t.useCallback((function(e){var t,n=void 0===e?{}:e,i=n.onClick;n.onPress;var o=n.refKey,r=void 0===o?"ref":o,l=n.ref,a=u(n,Ht),d=M.current.state;return s(((t={})[r]=Q(l,(function(e){C.current=e})),t["aria-controls"]=D.menuId,t["aria-expanded"]=d.isOpen,t.id=D.toggleButtonId,t.tabIndex=-1,t),!a.disabled&&s({},{onClick:J(i,(function(){m({type:14})}))}),a)}),[m,M,D]),L=t.useCallback((function(e,t){var n,i=void 0===e?{}:e,o=i.onKeyDown,r=i.onChange,l=i.onInput,d=i.onBlur;i.onChangeText;var c=i.onClick,p=i.refKey,f=void 0===p?"ref":p,g=i.ref,h=u(i,Vt),I=(void 0===t?{}:t).suppressRefError;R("getInputProps",void 0!==I&&I,f,S);var v,y=M.current.state,b={};h.disabled||((v={}).onInput=J(r,l,(function(e){m({type:wt,inputValue:e.target.value})})),v.onKeyDown=J(o,(function(e){var t=ue(e);t&&T[t]&&T[t](e)})),v.onBlur=J(d,(function(e){if(y.isOpen&&!K.current.isMouseDown){var t=null===e.relatedTarget&&a.document.activeElement!==a.document.body;m({type:St,selectItem:!t})}})),v.onClick=J(c,(function(){m({type:Ct})})),b=v);return s(((n={})[f]=Q(g,(function(e){S.current=e})),n["aria-activedescendant"]=y.isOpen&&y.highlightedIndex>-1?D.getItemId(y.highlightedIndex):"",n["aria-autocomplete"]="list",n["aria-controls"]=D.menuId,n["aria-expanded"]=y.isOpen,n["aria-labelledby"]=h&&h["aria-label"]?void 0:D.labelId,n.autoComplete="off",n.id=D.inputId,n.role="combobox",n.value=y.inputValue,n),b,h)}),[R,M,D,T,m,K,a]),F=t.useCallback((function(){m({type:15})}),[m]),_=t.useCallback((function(){m({type:17})}),[m]),N=t.useCallback((function(){m({type:16})}),[m]),j=t.useCallback((function(e){m({type:18,highlightedIndex:e})}),[m]),U=t.useCallback((function(e){m({type:Dt,selectedItem:e})}),[m]);return{getItemProps:A,getLabelProps:H,getMenuProps:V,getInputProps:L,getToggleButtonProps:B,toggleMenu:F,openMenu:N,closeMenu:_,setHighlightedIndex:j,setInputValue:t.useCallback((function(e){m({type:20,inputValue:e})}),[m]),selectItem:U,reset:t.useCallback((function(){m({type:21})}),[m]),highlightedIndex:v,isOpen:I,selectedItem:y,inputValue:b}}At.stateChangeTypes=Mt;var Bt={activeIndex:-1,selectedItems:[]};function Lt(e,t){return He(e,t,Bt)}function Ft(e,t){return Te(e,t,Bt)}function _t(e){if(e.shiftKey||e.metaKey||e.ctrlKey||e.altKey)return!1;var t=e.target;return!(t instanceof HTMLInputElement&&""!==t.value)||0===t.selectionStart&&0===t.selectionEnd}s({},Ue,{selectedItems:r.default.array,initialSelectedItems:r.default.array,defaultSelectedItems:r.default.array,getA11yRemovalMessage:r.default.func,activeIndex:r.default.number,initialActiveIndex:r.default.number,defaultActiveIndex:r.default.number,onActiveIndexChange:r.default.func,onSelectedItemsChange:r.default.func,keyNavigationNext:r.default.string,keyNavigationPrevious:r.default.string});var Nt={itemToString:Re.itemToString,stateReducer:Re.stateReducer,environment:Re.environment,getA11yRemovalMessage:function(e){var t=e.removedSelectedItem;return(0,e.itemToString)(t)+" has been removed."},keyNavigationNext:"ArrowRight",keyNavigationPrevious:"ArrowLeft"},jt=z,Ut=0,$t=1,Wt=2,qt=3,zt=4,Xt=5,Yt=6,Gt=7,Jt=8,Qt=9,Zt=10,en=11,tn=12,nn=Object.freeze({__proto__:null,SelectedItemClick:Ut,SelectedItemKeyDownDelete:$t,SelectedItemKeyDownBackspace:Wt,SelectedItemKeyDownNavigationNext:qt,SelectedItemKeyDownNavigationPrevious:zt,DropdownKeyDownNavigationPrevious:Xt,DropdownKeyDownBackspace:Yt,DropdownClick:Gt,FunctionAddSelectedItem:Jt,FunctionRemoveSelectedItem:Qt,FunctionSetSelectedItems:Zt,FunctionSetActiveIndex:en,FunctionReset:tn});function on(e,t){var n,i=t.type,o=t.index,r=t.props,u=t.selectedItem,l=e.activeIndex,a=e.selectedItems;switch(i){case Ut:n={activeIndex:o};break;case zt:n={activeIndex:l-1<0?0:l-1};break;case qt:n={activeIndex:l+1>=a.length?-1:l+1};break;case Wt:case $t:if(l<0)break;var d=l;1===a.length?d=-1:l===a.length-1&&(d=a.length-2),n=s({selectedItems:[].concat(a.slice(0,l),a.slice(l+1))},{activeIndex:d});break;case Xt:n={activeIndex:a.length-1};break;case Yt:n={selectedItems:a.slice(0,a.length-1)};break;case Jt:n={selectedItems:[].concat(a,[u])};break;case Gt:n={activeIndex:-1};break;case Qt:var c=l,p=a.indexOf(u);if(p<0)break;1===a.length?c=-1:p===a.length-1&&(c=a.length-2),n={selectedItems:[].concat(a.slice(0,p),a.slice(p+1)),activeIndex:c};break;case Zt:n={selectedItems:t.selectedItems};break;case en:n={activeIndex:t.activeIndex};break;case tn:n={activeIndex:Ft(r,"activeIndex"),selectedItems:Ft(r,"selectedItems")};break;default:throw new Error("Reducer called without proper action type.")}return s({},e,n)}var rn=["refKey","ref","onClick","onKeyDown","selectedItem","index"],un=["refKey","ref","onKeyDown","onClick","preventKeyAction"];function sn(e){void 0===e&&(e={}),jt();var n=s({},Nt,e),i=n.getA11yRemovalMessage,o=n.itemToString,r=n.environment,l=n.keyNavigationNext,a=n.keyNavigationPrevious,d=Ke(on,function(e){return{activeIndex:Lt(e,"activeIndex"),selectedItems:Lt(e,"selectedItems")}}(n),n),c=d[0],p=d[1],f=c.activeIndex,g=c.selectedItems,h=t.useRef(!0),m=t.useRef(null),I=t.useRef(g),v=t.useRef();v.current=[];var y=Ee({state:c,props:n});t.useEffect((function(){if(!h.current){if(g.length<I.current.length){var e=I.current.find((function(e){return g.indexOf(e)<0}));ce(i({itemToString:o,resultCount:g.length,removedSelectedItem:e,activeIndex:f,activeSelectedItem:g[f]}),r.document)}I.current=g}}),[g.length]),t.useEffect((function(){h.current||(-1===f&&m.current?m.current.focus():v.current[f]&&v.current[f].focus())}),[f]),Ne({isInitialMount:h.current,props:n,state:c});var b=Le();t.useEffect((function(){return h.current=!1,function(){h.current=!0}}),[]);var x=t.useMemo((function(){var e;return(e={})[a]=function(){p({type:zt})},e[l]=function(){p({type:qt})},e.Delete=function(){p({type:$t})},e.Backspace=function(){p({type:Wt})},e}),[p,l,a]),w=t.useMemo((function(){var e;return(e={})[a]=function(e){_t(e)&&p({type:Xt})},e.Backspace=function(e){_t(e)&&p({type:Yt})},e}),[p,a]);return{getSelectedItemProps:t.useCallback((function(e){var t,n=void 0===e?{}:e,i=n.refKey,o=void 0===i?"ref":i,r=n.ref,l=n.onClick,a=n.onKeyDown,d=n.selectedItem,c=n.index,f=u(n,rn),g=y.current.state,h=Oe(d,c,g.selectedItems,"Pass either item or index to getSelectedItemProps!")[1],m=h>-1&&h===g.activeIndex;return s(((t={})[o]=Q(r,(function(e){e&&v.current.push(e)})),t.tabIndex=m?0:-1,t.onClick=J(l,(function(){p({type:Ut,index:h})})),t.onKeyDown=J(a,(function(e){var t=ue(e);t&&x[t]&&x[t](e)})),t),f)}),[p,y,x]),getDropdownProps:t.useCallback((function(e,t){var n,i=void 0===e?{}:e,o=i.refKey,r=void 0===o?"ref":o,l=i.ref,a=i.onKeyDown,d=i.onClick,c=i.preventKeyAction,f=void 0!==c&&c,g=u(i,un),h=(void 0===t?{}:t).suppressRefError;return b("getDropdownProps",void 0!==h&&h,r,m),s(((n={})[r]=Q(l,(function(e){e&&(m.current=e)})),n),!f&&{onKeyDown:J(a,(function(e){var t=ue(e);t&&w[t]&&w[t](e)})),onClick:J(d,(function(){p({type:Gt})}))},g)}),[p,w,b]),addSelectedItem:t.useCallback((function(e){p({type:Jt,selectedItem:e})}),[p]),removeSelectedItem:t.useCallback((function(e){p({type:Qt,selectedItem:e})}),[p]),setSelectedItems:t.useCallback((function(e){p({type:Zt,selectedItems:e})}),[p]),setActiveIndex:t.useCallback((function(e){p({type:en,activeIndex:e})}),[p]),reset:t.useCallback((function(){p({type:tn})}),[p]),selectedItems:g,activeIndex:f}}sn.stateChangeTypes=nn,e.default=be,e.resetIdCounter=function(){"useId"in o.default?console.warn("It is not necessary to call resetIdCounter when using React 18+"):W=0},e.useCombobox=At,e.useMultipleSelection=sn,e.useSelect=ft,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
*/if("function"==typeof Symbol&&Symbol.for){var M=Symbol.for;c=M("react.element"),p=M("react.portal"),f=M("react.fragment"),g=M("react.strict_mode"),h=M("react.profiler"),m=M("react.provider"),I=M("react.context"),v=M("react.forward_ref"),y=M("react.suspense"),b=M("react.suspense_list"),x=M("react.memo"),w=M("react.lazy"),S=M("react.block"),C=M("react.server.block"),k=M("react.fundamental"),D=M("react.debug_trace_mode"),O=M("react.legacy_hidden")}function E(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case c:switch(e=e.type){case f:case h:case g:case y:case b:return e;default:switch(e=e&&e.$$typeof){case I:case v:case w:case x:case m:return e;default:return t}}case p:return t}}}var P=m,K=c,R=v,T=f,H=w,V=x,A=p,B=h,L=g,F=y;d.ContextConsumer=I,d.ContextProvider=P,d.Element=K,d.ForwardRef=R,d.Fragment=T,d.Lazy=H,d.Memo=V,d.Portal=A,d.Profiler=B,d.StrictMode=L,d.Suspense=F,d.isAsyncMode=function(){return!1},d.isConcurrentMode=function(){return!1},d.isContextConsumer=function(e){return E(e)===I},d.isContextProvider=function(e){return E(e)===m},d.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===c},d.isForwardRef=function(e){return E(e)===v},d.isFragment=function(e){return E(e)===f},d.isLazy=function(e){return E(e)===w},d.isMemo=function(e){return E(e)===x},d.isPortal=function(e){return E(e)===p},d.isProfiler=function(e){return E(e)===h},d.isStrictMode=function(e){return E(e)===g},d.isSuspense=function(e){return E(e)===y},d.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===f||e===h||e===D||e===g||e===y||e===b||e===O||"object"==typeof e&&null!==e&&(e.$$typeof===w||e.$$typeof===x||e.$$typeof===m||e.$$typeof===I||e.$$typeof===v||e.$$typeof===k||e.$$typeof===S||e[0]===C)},d.typeOf=E;let _=e=>"object"==typeof e&&null!=e&&1===e.nodeType,N=(e,t)=>(!t||"hidden"!==e)&&"visible"!==e&&"clip"!==e,j=(e,t)=>{if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){let n=getComputedStyle(e,null);return N(n.overflowY,t)||N(n.overflowX,t)||(e=>{let t=(e=>{if(!e.ownerDocument||!e.ownerDocument.defaultView)return null;try{return e.ownerDocument.defaultView.frameElement}catch(e){return null}})(e);return!!t&&(t.clientHeight<e.scrollHeight||t.clientWidth<e.scrollWidth)})(e)}return!1},U=(e,t,n,i,o,r,u,s)=>r<e&&u>t||r>e&&u<t?0:r<=e&&s<=n||u>=t&&s>=n?r-e-i:u>t&&s<n||r<e&&s>n?u-t+o:0,$=e=>{let t=e.parentElement;return null==t?e.getRootNode().host||null:t};var W=0;function q(e){return"function"==typeof e?e:z}function z(){}function X(e,t){if(e){var n=((e,t)=>{var n,i,o,r,u,s;if("undefined"==typeof document)return[];let{scrollMode:l,block:a,inline:d,boundary:c,skipOverflowHiddenElements:p}=t,f="function"==typeof c?c:e=>e!==c;if(!_(e))throw new TypeError("Invalid target");let g=document.scrollingElement||document.documentElement,h=[],m=e;for(;_(m)&&f(m);){if(m=$(m),m===g){h.push(m);break}null!=m&&m===document.body&&j(m)&&!j(document.documentElement)||null!=m&&j(m,p)&&h.push(m)}let I=null!=(i=null==(n=window.visualViewport)?void 0:n.width)?i:innerWidth,v=null!=(r=null==(o=window.visualViewport)?void 0:o.height)?r:innerHeight,y=null!=(u=window.scrollX)?u:pageXOffset,b=null!=(s=window.scrollY)?s:pageYOffset,{height:x,width:w,top:S,right:C,bottom:k,left:D}=e.getBoundingClientRect(),O="start"===a||"nearest"===a?S:"end"===a?k:S+x/2,M="center"===d?D+w/2:"end"===d?C:D,E=[];for(let e=0;e<h.length;e++){let t=h[e],{height:n,width:i,top:o,right:r,bottom:u,left:s}=t.getBoundingClientRect();if("if-needed"===l&&S>=0&&D>=0&&k<=v&&C<=I&&S>=o&&k<=u&&D>=s&&C<=r)return E;let c=getComputedStyle(t),p=parseInt(c.borderLeftWidth,10),f=parseInt(c.borderTopWidth,10),m=parseInt(c.borderRightWidth,10),P=parseInt(c.borderBottomWidth,10),K=0,R=0,T="offsetWidth"in t?t.offsetWidth-t.clientWidth-p-m:0,H="offsetHeight"in t?t.offsetHeight-t.clientHeight-f-P:0,V="offsetWidth"in t?0===t.offsetWidth?0:i/t.offsetWidth:0,A="offsetHeight"in t?0===t.offsetHeight?0:n/t.offsetHeight:0;if(g===t)K="start"===a?O:"end"===a?O-v:"nearest"===a?U(b,b+v,v,f,P,b+O,b+O+x,x):O-v/2,R="start"===d?M:"center"===d?M-I/2:"end"===d?M-I:U(y,y+I,I,p,m,y+M,y+M+w,w),K=Math.max(0,K+b),R=Math.max(0,R+y);else{K="start"===a?O-o-f:"end"===a?O-u+P+H:"nearest"===a?U(o,u,n,f,P+H,O,O+x,x):O-(o+n/2)+H/2,R="start"===d?M-s-p:"center"===d?M-(s+i/2)+T/2:"end"===d?M-r+m+T:U(s,r,i,p,m+T,M,M+w,w);let{scrollLeft:e,scrollTop:l}=t;K=Math.max(0,Math.min(l+K/A,t.scrollHeight-n/A+H)),R=Math.max(0,Math.min(e+R/V,t.scrollWidth-i/V+T)),O+=l-K,M+=e-R}E.push({el:t,top:K,left:R})}return E})(e,{boundary:t,block:"nearest",scrollMode:"if-needed"});n.forEach((function(e){var t=e.el,n=e.top,i=e.left;t.scrollTop=n,t.scrollLeft=i}))}}function Y(e,t,n){return e===t||t instanceof n.Node&&e.contains&&e.contains(t)}function G(e,t){var n;function i(){n&&clearTimeout(n)}function o(){for(var o=arguments.length,r=new Array(o),u=0;u<o;u++)r[u]=arguments[u];i(),n=setTimeout((function(){n=null,e.apply(void 0,r)}),t)}return o.cancel=i,o}function J(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e){for(var n=arguments.length,i=new Array(n>1?n-1:0),o=1;o<n;o++)i[o-1]=arguments[o];return t.some((function(t){return t&&t.apply(void 0,[e].concat(i)),e.preventDownshiftDefault||e.hasOwnProperty("nativeEvent")&&e.nativeEvent.preventDownshiftDefault}))}}function Q(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e){t.forEach((function(t){"function"==typeof t?t(e):t&&(t.current=e)}))}}function Z(){return String(W++)}function ee(e){var t=e.isOpen,n=e.resultCount,i=e.previousResultCount;return t?n?n!==i?n+" result"+(1===n?" is":"s are")+" available, use up and down arrow keys to navigate. Press Enter key to select.":"":"No results are available.":""}function te(e,t){return!(e=Array.isArray(e)?e[0]:e)&&t?t:e}var ne=["highlightedIndex","inputValue","isOpen","selectedItem","type"];function ie(e){void 0===e&&(e={});var t={};return ne.forEach((function(n){e.hasOwnProperty(n)&&(t[n]=e[n])})),t}function oe(e,t){return Object.keys(e).reduce((function(n,i){return n[i]=re(t,i)?t[i]:e[i],n}),{})}function re(e,t){return void 0!==e[t]}function ue(e){var t=e.key,n=e.keyCode;return n>=37&&n<=40&&0!==t.indexOf("Arrow")?"Arrow"+t:t}function se(e,t,n,i,o){void 0===o&&(o=!1);var r=n.length;if(0===r)return-1;var u=r-1;("number"!=typeof e||e<0||e>u)&&(e=t>0?-1:u+1);var s=e+t;s<0?s=o?u:0:s>u&&(s=o?0:u);var l=le(s,t<0,n,i,o);return-1===l?e>=r?-1:e:l}function le(e,t,n,i,o){void 0===o&&(o=!1);var r=n.length;if(t){for(var u=e;u>=0;u--)if(!i(n[u],u))return u}else for(var s=e;s<r;s++)if(!i(n[s],s))return s;return o?le(t?r-1:0,t,n,i):-1}function ae(e,t,n,i){return void 0===i&&(i=!0),t.some((function(t){return t&&(Y(t,e,n)||i&&Y(t,n.document.activeElement,n))}))}var de=G((function(e){pe(e).textContent=""}),500);function ce(e,t){var n=pe(t);e&&(n.textContent=e,de(t))}function pe(e){void 0===e&&(e=document);var t=e.getElementById("a11y-status-message");return t||((t=e.createElement("div")).setAttribute("id","a11y-status-message"),t.setAttribute("role","status"),t.setAttribute("aria-live","polite"),t.setAttribute("aria-relevant","additions text"),Object.assign(t.style,{border:"0",clip:"rect(0 0 0 0)",height:"1px",margin:"-1px",overflow:"hidden",padding:"0",position:"absolute",width:"1px"}),e.body.appendChild(t),t)}var fe=Object.freeze({__proto__:null,unknown:0,mouseUp:1,itemMouseEnter:2,keyDownArrowUp:3,keyDownArrowDown:4,keyDownEscape:5,keyDownEnter:6,keyDownHome:7,keyDownEnd:8,clickItem:9,blurInput:10,changeInput:11,keyDownSpaceButton:12,clickButton:13,blurButton:14,controlledPropUpdatedSelectedItem:15,touchEnd:16}),ge=["refKey","ref"],he=["onClick","onPress","onKeyDown","onKeyUp","onBlur"],me=["onKeyDown","onBlur","onChange","onInput","onChangeText"],Ie=["refKey","ref"],ve=["onMouseMove","onMouseDown","onClick","onPress","index","item"],ye=function(){var e=function(e){var n,i;function o(t){var n=e.call(this,t)||this;n.id=n.props.id||"downshift-"+Z(),n.menuId=n.props.menuId||n.id+"-menu",n.labelId=n.props.labelId||n.id+"-label",n.inputId=n.props.inputId||n.id+"-input",n.getItemId=n.props.getItemId||function(e){return n.id+"-item-"+e},n.input=null,n.items=[],n.itemCount=null,n.previousResultCount=0,n.timeoutIds=[],n.internalSetTimeout=function(e,t){var i=setTimeout((function(){n.timeoutIds=n.timeoutIds.filter((function(e){return e!==i})),e()}),t);n.timeoutIds.push(i)},n.setItemCount=function(e){n.itemCount=e},n.unsetItemCount=function(){n.itemCount=null},n.isItemDisabled=function(e,t){var i=n.getItemNodeFromIndex(t);return i&&i.hasAttribute("disabled")},n.setHighlightedIndex=function(e,t){void 0===e&&(e=n.props.defaultHighlightedIndex),void 0===t&&(t={}),t=ie(t),n.internalSetState(s({highlightedIndex:e},t))},n.clearSelection=function(e){n.internalSetState({selectedItem:null,inputValue:"",highlightedIndex:n.props.defaultHighlightedIndex,isOpen:n.props.defaultIsOpen},e)},n.selectItem=function(e,t,i){t=ie(t),n.internalSetState(s({isOpen:n.props.defaultIsOpen,highlightedIndex:n.props.defaultHighlightedIndex,selectedItem:e,inputValue:n.props.itemToString(e)},t),i)},n.selectItemAtIndex=function(e,t,i){var o=n.items[e];null!=o&&n.selectItem(o,t,i)},n.selectHighlightedItem=function(e,t){return n.selectItemAtIndex(n.getState().highlightedIndex,e,t)},n.internalSetState=function(e,t){var i,o,r={},u="function"==typeof e;return!u&&e.hasOwnProperty("inputValue")&&n.props.onInputValueChange(e.inputValue,s({},n.getStateAndHelpers(),e)),n.setState((function(t){t=n.getState(t);var l=u?e(t):e;l=n.props.stateReducer(t,l),i=l.hasOwnProperty("selectedItem");var a={};return i&&l.selectedItem!==t.selectedItem&&(o=l.selectedItem),l.type=l.type||0,Object.keys(l).forEach((function(e){t[e]!==l[e]&&(r[e]=l[e]),"type"!==e&&(l[e],re(n.props,e)||(a[e]=l[e]))})),u&&l.hasOwnProperty("inputValue")&&n.props.onInputValueChange(l.inputValue,s({},n.getStateAndHelpers(),l)),a}),(function(){q(t)(),Object.keys(r).length>1&&n.props.onStateChange(r,n.getStateAndHelpers()),i&&n.props.onSelect(e.selectedItem,n.getStateAndHelpers()),void 0!==o&&n.props.onChange(o,n.getStateAndHelpers()),n.props.onUserAction(r,n.getStateAndHelpers())}))},n.rootRef=function(e){return n._rootNode=e},n.getRootProps=function(e,t){var i,o=void 0===e?{}:e,r=o.refKey,l=void 0===r?"ref":r,a=o.ref,d=u(o,ge),c=(void 0===t?{}:t).suppressRefError,p=void 0!==c&&c;n.getRootProps.called=!0,n.getRootProps.refKey=l,n.getRootProps.suppressRefError=p;var f=n.getState().isOpen;return s(((i={})[l]=Q(a,n.rootRef),i.role="combobox",i["aria-expanded"]=f,i["aria-haspopup"]="listbox",i["aria-owns"]=f?n.menuId:void 0,i["aria-labelledby"]=n.labelId,i),d)},n.keyDownHandlers={ArrowDown:function(e){var t=this;if(e.preventDefault(),this.getState().isOpen){var n=e.shiftKey?5:1;this.moveHighlightedIndex(n,{type:4})}else this.internalSetState({isOpen:!0,type:4},(function(){var e=t.getItemCount();if(e>0){var n=se(t.getState().highlightedIndex,1,{length:e},t.isItemDisabled,!0);t.setHighlightedIndex(n,{type:4})}}))},ArrowUp:function(e){var t=this;if(e.preventDefault(),this.getState().isOpen){var n=e.shiftKey?-5:-1;this.moveHighlightedIndex(n,{type:3})}else this.internalSetState({isOpen:!0,type:3},(function(){var e=t.getItemCount();if(e>0){var n=se(t.getState().highlightedIndex,-1,{length:e},t.isItemDisabled,!0);t.setHighlightedIndex(n,{type:3})}}))},Enter:function(e){if(229!==e.which){var t=this.getState(),n=t.isOpen,i=t.highlightedIndex;if(n&&null!=i){e.preventDefault();var o=this.items[i],r=this.getItemNodeFromIndex(i);if(null==o||r&&r.hasAttribute("disabled"))return;this.selectHighlightedItem({type:6})}}},Escape:function(e){e.preventDefault(),this.reset(s({type:5},!this.state.isOpen&&{selectedItem:null,inputValue:""}))}},n.buttonKeyDownHandlers=s({},n.keyDownHandlers,{" ":function(e){e.preventDefault(),this.toggleMenu({type:12})}}),n.inputKeyDownHandlers=s({},n.keyDownHandlers,{Home:function(e){var t=this.getState().isOpen;if(t){e.preventDefault();var n=this.getItemCount();if(!(n<=0)&&t){var i=le(0,!1,{length:n},this.isItemDisabled);this.setHighlightedIndex(i,{type:7})}}},End:function(e){var t=this.getState().isOpen;if(t){e.preventDefault();var n=this.getItemCount();if(!(n<=0)&&t){var i=le(n-1,!0,{length:n},this.isItemDisabled);this.setHighlightedIndex(i,{type:8})}}}}),n.getToggleButtonProps=function(e){var t=void 0===e?{}:e,i=t.onClick;t.onPress;var o=t.onKeyDown,r=t.onKeyUp,l=t.onBlur,a=u(t,he),d=n.getState().isOpen,c={onClick:J(i,n.buttonHandleClick),onKeyDown:J(o,n.buttonHandleKeyDown),onKeyUp:J(r,n.buttonHandleKeyUp),onBlur:J(l,n.buttonHandleBlur)};return s({type:"button",role:"button","aria-label":d?"close menu":"open menu","aria-haspopup":!0,"data-toggle":!0},a.disabled?{}:c,a)},n.buttonHandleKeyUp=function(e){e.preventDefault()},n.buttonHandleKeyDown=function(e){var t=ue(e);n.buttonKeyDownHandlers[t]&&n.buttonKeyDownHandlers[t].call(l(n),e)},n.buttonHandleClick=function(e){e.preventDefault(),n.props.environment.document.activeElement===n.props.environment.document.body&&e.target.focus(),n.internalSetTimeout((function(){return n.toggleMenu({type:13})}))},n.buttonHandleBlur=function(e){var t=e.target;n.internalSetTimeout((function(){n.isMouseDown||null!=n.props.environment.document.activeElement&&n.props.environment.document.activeElement.id===n.inputId||n.props.environment.document.activeElement===t||n.reset({type:14})}))},n.getLabelProps=function(e){return s({htmlFor:n.inputId,id:n.labelId},e)},n.getInputProps=function(e){var t=void 0===e?{}:e,i=t.onKeyDown,o=t.onBlur,r=t.onChange,l=t.onInput;t.onChangeText;var a=u(t,me),d={};var c,p=n.getState(),f=p.inputValue,g=p.isOpen,h=p.highlightedIndex;a.disabled||((c={}).onInput=J(r,l,n.inputHandleChange),c.onKeyDown=J(i,n.inputHandleKeyDown),c.onBlur=J(o,n.inputHandleBlur),d=c);return s({"aria-autocomplete":"list","aria-activedescendant":g&&"number"==typeof h&&h>=0?n.getItemId(h):void 0,"aria-controls":g?n.menuId:void 0,"aria-labelledby":a&&a["aria-label"]?void 0:n.labelId,autoComplete:"off",value:f,id:n.inputId},d,a)},n.inputHandleKeyDown=function(e){var t=ue(e);t&&n.inputKeyDownHandlers[t]&&n.inputKeyDownHandlers[t].call(l(n),e)},n.inputHandleChange=function(e){n.internalSetState({type:11,isOpen:!0,inputValue:e.target.value,highlightedIndex:n.props.defaultHighlightedIndex})},n.inputHandleBlur=function(){n.internalSetTimeout((function(){var e=n.props.environment.document&&!!n.props.environment.document.activeElement&&!!n.props.environment.document.activeElement.dataset&&n.props.environment.document.activeElement.dataset.toggle&&n._rootNode&&n._rootNode.contains(n.props.environment.document.activeElement);n.isMouseDown||e||n.reset({type:10})}))},n.menuRef=function(e){n._menuNode=e},n.getMenuProps=function(e,t){var i,o=void 0===e?{}:e,r=o.refKey,l=void 0===r?"ref":r,a=o.ref,d=u(o,Ie),c=(void 0===t?{}:t).suppressRefError,p=void 0!==c&&c;return n.getMenuProps.called=!0,n.getMenuProps.refKey=l,n.getMenuProps.suppressRefError=p,s(((i={})[l]=Q(a,n.menuRef),i.role="listbox",i["aria-labelledby"]=d&&d["aria-label"]?void 0:n.labelId,i.id=n.menuId,i),d)},n.getItemProps=function(e){var t,i=void 0===e?{}:e,o=i.onMouseMove,r=i.onMouseDown,l=i.onClick;i.onPress;var a=i.index,d=i.item,c=void 0===d?void 0:d,p=u(i,ve);void 0===a?(n.items.push(c),a=n.items.indexOf(c)):n.items[a]=c;var f=l,g=((t={onMouseMove:J(o,(function(){a!==n.getState().highlightedIndex&&(n.setHighlightedIndex(a,{type:2}),n.avoidScrolling=!0,n.internalSetTimeout((function(){return n.avoidScrolling=!1}),250))})),onMouseDown:J(r,(function(e){e.preventDefault()}))}).onClick=J(f,(function(){n.selectItemAtIndex(a,{type:9})})),t),h=p.disabled?{onMouseDown:g.onMouseDown}:g;return s({id:n.getItemId(a),role:"option","aria-selected":n.getState().highlightedIndex===a},h,p)},n.clearItems=function(){n.items=[]},n.reset=function(e,t){void 0===e&&(e={}),e=ie(e),n.internalSetState((function(t){var i=t.selectedItem;return s({isOpen:n.props.defaultIsOpen,highlightedIndex:n.props.defaultHighlightedIndex,inputValue:n.props.itemToString(i)},e)}),t)},n.toggleMenu=function(e,t){void 0===e&&(e={}),e=ie(e),n.internalSetState((function(t){var i=t.isOpen;return s({isOpen:!i},i&&{highlightedIndex:n.props.defaultHighlightedIndex},e)}),(function(){var i=n.getState(),o=i.isOpen,r=i.highlightedIndex;o&&n.getItemCount()>0&&"number"==typeof r&&n.setHighlightedIndex(r,e),q(t)()}))},n.openMenu=function(e){n.internalSetState({isOpen:!0},e)},n.closeMenu=function(e){n.internalSetState({isOpen:!1},e)},n.updateStatus=G((function(){var e=n.getState(),t=n.items[e.highlightedIndex],i=n.getItemCount(),o=n.props.getA11yStatusMessage(s({itemToString:n.props.itemToString,previousResultCount:n.previousResultCount,resultCount:i,highlightedItem:t},e));n.previousResultCount=i,ce(o,n.props.environment.document)}),200);var i=n.props,o=i.defaultHighlightedIndex,r=i.initialHighlightedIndex,a=void 0===r?o:r,d=i.defaultIsOpen,c=i.initialIsOpen,p=void 0===c?d:c,f=i.initialInputValue,g=void 0===f?"":f,h=i.initialSelectedItem,m=void 0===h?null:h,I=n.getState({highlightedIndex:a,isOpen:p,inputValue:g,selectedItem:m});return null!=I.selectedItem&&void 0===n.props.initialInputValue&&(I.inputValue=n.props.itemToString(I.selectedItem)),n.state=I,n}i=e,(n=o).prototype=Object.create(i.prototype),n.prototype.constructor=n,a(n,i);var r=o.prototype;return r.internalClearTimeouts=function(){this.timeoutIds.forEach((function(e){clearTimeout(e)})),this.timeoutIds=[]},r.getState=function(e){return void 0===e&&(e=this.state),oe(e,this.props)},r.getItemCount=function(){var e=this.items.length;return null!=this.itemCount?e=this.itemCount:void 0!==this.props.itemCount&&(e=this.props.itemCount),e},r.getItemNodeFromIndex=function(e){return this.props.environment.document.getElementById(this.getItemId(e))},r.scrollHighlightedItemIntoView=function(){var e=this.getItemNodeFromIndex(this.getState().highlightedIndex);this.props.scrollIntoView(e,this._menuNode)},r.moveHighlightedIndex=function(e,t){var n=this.getItemCount(),i=this.getState().highlightedIndex;if(n>0){var o=se(i,e,{length:n},this.isItemDisabled,!0);this.setHighlightedIndex(o,t)}},r.getStateAndHelpers=function(){var e=this.getState(),t=e.highlightedIndex,n=e.inputValue,i=e.selectedItem,o=e.isOpen,r=this.props.itemToString,u=this.id,s=this.getRootProps,l=this.getToggleButtonProps,a=this.getLabelProps,d=this.getMenuProps,c=this.getInputProps,p=this.getItemProps,f=this.openMenu,g=this.closeMenu,h=this.toggleMenu,m=this.selectItem,I=this.selectItemAtIndex,v=this.selectHighlightedItem,y=this.setHighlightedIndex,b=this.clearSelection,x=this.clearItems;return{getRootProps:s,getToggleButtonProps:l,getLabelProps:a,getMenuProps:d,getInputProps:c,getItemProps:p,reset:this.reset,openMenu:f,closeMenu:g,toggleMenu:h,selectItem:m,selectItemAtIndex:I,selectHighlightedItem:v,setHighlightedIndex:y,clearSelection:b,clearItems:x,setItemCount:this.setItemCount,unsetItemCount:this.unsetItemCount,setState:this.internalSetState,itemToString:r,id:u,highlightedIndex:t,inputValue:n,isOpen:o,selectedItem:i}},r.componentDidMount=function(){var e=this,t=function(){e.isMouseDown=!0},n=function(t){e.isMouseDown=!1,!ae(t.target,[e._rootNode,e._menuNode],e.props.environment)&&e.getState().isOpen&&e.reset({type:1},(function(){return e.props.onOuterClick(e.getStateAndHelpers())}))},i=function(){e.isTouchMove=!1},o=function(){e.isTouchMove=!0},r=function(t){var n=ae(t.target,[e._rootNode,e._menuNode],e.props.environment,!1);e.isTouchMove||n||!e.getState().isOpen||e.reset({type:16},(function(){return e.props.onOuterClick(e.getStateAndHelpers())}))},u=this.props.environment;u.addEventListener("mousedown",t),u.addEventListener("mouseup",n),u.addEventListener("touchstart",i),u.addEventListener("touchmove",o),u.addEventListener("touchend",r),this.cleanup=function(){e.internalClearTimeouts(),e.updateStatus.cancel(),u.removeEventListener("mousedown",t),u.removeEventListener("mouseup",n),u.removeEventListener("touchstart",i),u.removeEventListener("touchmove",o),u.removeEventListener("touchend",r)}},r.shouldScroll=function(e,t){var n=(void 0===this.props.highlightedIndex?this.getState():this.props).highlightedIndex,i=(void 0===t.highlightedIndex?e:t).highlightedIndex;return n&&this.getState().isOpen&&!e.isOpen||n!==i},r.componentDidUpdate=function(e,t){re(this.props,"selectedItem")&&this.props.selectedItemChanged(e.selectedItem,this.props.selectedItem)&&this.internalSetState({type:15,inputValue:this.props.itemToString(this.props.selectedItem)}),!this.avoidScrolling&&this.shouldScroll(t,e)&&this.scrollHighlightedItemIntoView(),this.updateStatus()},r.componentWillUnmount=function(){this.cleanup()},r.render=function(){var e=te(this.props.children,z);this.clearItems(),this.getRootProps.called=!1,this.getRootProps.refKey=void 0,this.getRootProps.suppressRefError=void 0,this.getMenuProps.called=!1,this.getMenuProps.refKey=void 0,this.getMenuProps.suppressRefError=void 0,this.getLabelProps.called=!1,this.getInputProps.called=!1;var n=te(e(this.getStateAndHelpers()));return n?this.getRootProps.called||this.props.suppressRefError?n:function(e){return"string"==typeof e.type||"string"==typeof e.nodeName}(n)?t.cloneElement(n,this.getRootProps(function(e){return e.props||e.attributes}(n))):void 0:null},o}(t.Component);return e.defaultProps={defaultHighlightedIndex:null,defaultIsOpen:!1,getA11yStatusMessage:ee,itemToString:function(e){return null==e?"":String(e)},onStateChange:z,onInputValueChange:z,onUserAction:z,onChange:z,onSelect:z,onOuterClick:z,selectedItemChanged:function(e,t){return e!==t},environment:"undefined"==typeof window?{}:window,stateReducer:function(e,t){return t},suppressRefError:!1,scrollIntoView:X},e.stateChangeTypes=fe,e}(),be=ye,xe=["isInitialMount","highlightedIndex","items","environment"],we={highlightedIndex:-1,isOpen:!1,selectedItem:null,inputValue:""};function Se(e,t,n){var i=e.props,o=e.type,r={};Object.keys(t).forEach((function(i){!function(e,t,n,i){var o=t.props,r=t.type,u="on"+Me(e)+"Change";o[u]&&void 0!==i[e]&&i[e]!==n[e]&&o[u](s({type:r},i))}(i,e,t,n),n[i]!==t[i]&&(r[i]=n[i])})),i.onStateChange&&Object.keys(r).length&&i.onStateChange(s({type:o},r))}var Ce=G((function(e,t){ce(e(),t)}),200),ke="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement?t.useLayoutEffect:t.useEffect,De="useId"in o.default?function(e){var n=e.id,i=e.labelId,r=e.menuId,u=e.getItemId,s=e.toggleButtonId,l=e.inputId,a="downshift-"+o.default.useId();return n||(n=a),t.useRef({labelId:i||n+"-label",menuId:r||n+"-menu",getItemId:u||function(e){return n+"-item-"+e},toggleButtonId:s||n+"-toggle-button",inputId:l||n+"-input"}).current}:function(e){var n=e.id,i=void 0===n?"downshift-"+Z():n,o=e.labelId,r=e.menuId,u=e.getItemId,s=e.toggleButtonId,l=e.inputId;return t.useRef({labelId:o||i+"-label",menuId:r||i+"-menu",getItemId:u||function(e){return i+"-item-"+e},toggleButtonId:s||i+"-toggle-button",inputId:l||i+"-input"}).current};function Oe(e,t,n,i){var o,r;if(void 0===e){if(void 0===t)throw new Error(i);o=n[t],r=t}else r=void 0===t?n.indexOf(e):t,o=e;return[o,r]}function Me(e){return""+e.slice(0,1).toUpperCase()+e.slice(1)}function Ee(e){var n=t.useRef(e);return n.current=e,n}function Pe(e,n,i){var o=t.useRef(),r=t.useRef(),u=t.useCallback((function(t,n){r.current=n,t=oe(t,n.props);var i=e(t,n);return n.props.stateReducer(t,s({},n,{changes:i}))}),[e]),l=t.useReducer(u,n),a=l[0],d=l[1],c=Ee(i),p=t.useCallback((function(e){return d(s({props:c.current},e))}),[c]),f=r.current;return t.useEffect((function(){f&&o.current&&o.current!==a&&Se(f,oe(o.current,f.props),a),o.current=a}),[a,i,f]),[a,p]}function Ke(e,t,n){var i=Pe(e,t,n),o=i[0],r=i[1];return[oe(o,n),r]}var Re={itemToString:function(e){return e?String(e):""},stateReducer:function(e,t){return t.changes},getA11ySelectionMessage:function(e){var t=e.selectedItem,n=e.itemToString;return t?n(t)+" has been selected.":""},scrollIntoView:X,environment:"undefined"==typeof window?{}:window};function Te(e,t,n){void 0===n&&(n=we);var i=e["default"+Me(t)];return void 0!==i?i:n[t]}function He(e,t,n){void 0===n&&(n=we);var i=e[t];if(void 0!==i)return i;var o=e["initial"+Me(t)];return void 0!==o?o:Te(e,t,n)}function Ve(e){var t=He(e,"selectedItem"),n=He(e,"isOpen"),i=He(e,"highlightedIndex"),o=He(e,"inputValue");return{highlightedIndex:i<0&&t&&n?e.items.indexOf(t):i,isOpen:n,selectedItem:t,inputValue:o}}function Ae(e,t,n){var i=e.items,o=e.initialHighlightedIndex,r=e.defaultHighlightedIndex,u=t.selectedItem,s=t.highlightedIndex;return 0===i.length?-1:void 0!==o&&s===o?o:void 0!==r?r:u?i.indexOf(u):0===n?-1:n<0?i.length-1:0}function Be(e,n,i,o){var r=t.useRef({isMouseDown:!1,isTouchMove:!1});return t.useEffect((function(){if(null!=(null==i?void 0:i.addEventListener)){var t=function(){r.current.isMouseDown=!0},u=function(t){r.current.isMouseDown=!1,e&&!ae(t.target,n.map((function(e){return e.current})),i)&&o()},s=function(){r.current.isTouchMove=!1},l=function(){r.current.isTouchMove=!0},a=function(t){!e||r.current.isTouchMove||ae(t.target,n.map((function(e){return e.current})),i,!1)||o()};return i.addEventListener("mousedown",t),i.addEventListener("mouseup",u),i.addEventListener("touchstart",s),i.addEventListener("touchmove",l),i.addEventListener("touchend",a),function(){i.removeEventListener("mousedown",t),i.removeEventListener("mouseup",u),i.removeEventListener("touchstart",s),i.removeEventListener("touchmove",l),i.removeEventListener("touchend",a)}}}),[e,i]),r}var Le=function(){return z};function Fe(e,n,i){var o=i.isInitialMount,r=i.highlightedIndex,l=i.items,a=i.environment,d=u(i,xe);t.useEffect((function(){o||Ce((function(){return e(s({highlightedIndex:r,highlightedItem:l[r],resultCount:l.length},d))}),a.document)}),n)}function _e(e){var n=e.highlightedIndex,i=e.isOpen,o=e.itemRefs,r=e.getItemNodeFromIndex,u=e.menuElement,s=e.scrollIntoView,l=t.useRef(!0);return ke((function(){n<0||!i||!Object.keys(o.current).length||(!1===l.current?l.current=!0:s(r(n),u))}),[n]),l}var Ne=z;function je(e,t,n){var i;return void 0===n&&(n=!0),s({isOpen:!1,highlightedIndex:-1},(null==(i=e.items)?void 0:i.length)&&t>=0&&s({selectedItem:e.items[t],isOpen:Te(e,"isOpen"),highlightedIndex:Te(e,"highlightedIndex")},n&&{inputValue:e.itemToString(e.items[t])}))}var Ue={environment:r.default.shape({addEventListener:r.default.func.isRequired,removeEventListener:r.default.func.isRequired,document:r.default.shape({createElement:r.default.func.isRequired,getElementById:r.default.func.isRequired,activeElement:r.default.any.isRequired,body:r.default.any.isRequired}).isRequired,Node:r.default.func.isRequired}),itemToString:r.default.func,stateReducer:r.default.func},$e=s({},Ue,{getA11yStatusMessage:r.default.func,highlightedIndex:r.default.number,defaultHighlightedIndex:r.default.number,initialHighlightedIndex:r.default.number,isOpen:r.default.bool,defaultIsOpen:r.default.bool,initialIsOpen:r.default.bool,selectedItem:r.default.any,initialSelectedItem:r.default.any,defaultSelectedItem:r.default.any,id:r.default.string,labelId:r.default.string,menuId:r.default.string,getItemId:r.default.func,toggleButtonId:r.default.string,onSelectedItemChange:r.default.func,onHighlightedIndexChange:r.default.func,onStateChange:r.default.func,onIsOpenChange:r.default.func,scrollIntoView:r.default.func});function We(e,t,n){var i,o=t.type,r=t.props;switch(o){case n.ItemMouseMove:i={highlightedIndex:t.disabled?-1:t.index};break;case n.MenuMouseLeave:i={highlightedIndex:-1};break;case n.ToggleButtonClick:case n.FunctionToggleMenu:i={isOpen:!e.isOpen,highlightedIndex:e.isOpen?-1:Ae(r,e,0)};break;case n.FunctionOpenMenu:i={isOpen:!0,highlightedIndex:Ae(r,e,0)};break;case n.FunctionCloseMenu:i={isOpen:!1};break;case n.FunctionSetHighlightedIndex:i={highlightedIndex:t.highlightedIndex};break;case n.FunctionSetInputValue:i={inputValue:t.inputValue};break;case n.FunctionReset:i={highlightedIndex:Te(r,"highlightedIndex"),isOpen:Te(r,"isOpen"),selectedItem:Te(r,"selectedItem"),inputValue:Te(r,"inputValue")};break;default:throw new Error("Reducer called without proper action type.")}return s({},e,i)}var qe=function(){return qe=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++)for(var o in t=arguments[n])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},qe.apply(this,arguments)};"function"==typeof SuppressedError&&SuppressedError,qe(qe({},$e),{items:r.default.array.isRequired,isItemDisabled:r.default.func,getA11ySelectionMessage:r.default.func});var ze=qe(qe({},Re),{getA11yStatusMessage:function(e){var t=e.isOpen,n=e.resultCount,i=e.previousResultCount;return t?n?n!==i?"".concat(n," result").concat(1===n?" is":"s are"," available, use up and down arrow keys to navigate. Press Enter or Space Bar keys to select."):"":"No results are available.":""},isItemDisabled:function(){return!1}}),Xe=z,Ye=1,Ge=2,Je=3,Qe=4,Ze=5,et=6,tt=7,nt=8,it=9,ot=10,rt=11,ut=14,st=19,lt=Object.freeze({__proto__:null,ToggleButtonClick:0,ToggleButtonKeyDownArrowDown:Ye,ToggleButtonKeyDownArrowUp:Ge,ToggleButtonKeyDownCharacter:Je,ToggleButtonKeyDownEscape:Qe,ToggleButtonKeyDownHome:Ze,ToggleButtonKeyDownEnd:et,ToggleButtonKeyDownEnter:tt,ToggleButtonKeyDownSpaceButton:nt,ToggleButtonKeyDownPageUp:it,ToggleButtonKeyDownPageDown:ot,ToggleButtonBlur:rt,MenuMouseLeave:12,ItemMouseMove:13,ItemClick:ut,FunctionToggleMenu:15,FunctionOpenMenu:16,FunctionCloseMenu:17,FunctionSetHighlightedIndex:18,FunctionSelectItem:st,FunctionSetInputValue:20,FunctionReset:21});function at(e,t){var n,i,o=t.type,r=t.props,u=t.altKey;switch(o){case ut:i={isOpen:Te(r,"isOpen"),highlightedIndex:Te(r,"highlightedIndex"),selectedItem:r.items[t.index]};break;case Je:var l=t.key,a=""+e.inputValue+l,d=function(e){for(var t=e.keysSoFar,n=e.highlightedIndex,i=e.items,o=e.itemToString,r=e.isItemDisabled,u=t.toLowerCase(),s=0;s<i.length;s++){var l=(s+n+(t.length<2?1:0))%i.length,a=i[l];if(void 0!==a&&o(a).toLowerCase().startsWith(u)&&!r(a,l))return l}return n}({keysSoFar:a,highlightedIndex:!e.isOpen&&e.selectedItem?r.items.indexOf(e.selectedItem):e.highlightedIndex,items:r.items,itemToString:r.itemToString,isItemDisabled:r.isItemDisabled});i={inputValue:a,highlightedIndex:d,isOpen:!0};break;case Ye:i={highlightedIndex:e.isOpen?se(e.highlightedIndex,1,r.items,r.isItemDisabled):u&&null==e.selectedItem?-1:Ae(r,e,1),isOpen:!0};break;case Ge:if(e.isOpen&&u)i=je(r,e.highlightedIndex,!1);else i={highlightedIndex:e.isOpen?se(e.highlightedIndex,-1,r.items,r.isItemDisabled):Ae(r,e,-1),isOpen:!0};break;case tt:case nt:i=je(r,e.highlightedIndex,!1);break;case Ze:i={highlightedIndex:le(0,!1,r.items,r.isItemDisabled),isOpen:!0};break;case et:i={highlightedIndex:le(r.items.length-1,!0,r.items,r.isItemDisabled),isOpen:!0};break;case it:i={highlightedIndex:se(e.highlightedIndex,-10,r.items,r.isItemDisabled)};break;case ot:i={highlightedIndex:se(e.highlightedIndex,10,r.items,r.isItemDisabled)};break;case Qe:i={isOpen:!1,highlightedIndex:-1};break;case rt:i=s({isOpen:!1,highlightedIndex:-1},e.highlightedIndex>=0&&(null==(n=r.items)?void 0:n.length)&&{selectedItem:r.items[e.highlightedIndex]});break;case st:i={selectedItem:t.selectedItem};break;default:return We(e,t,lt)}return s({},e,i)}var dt=["onMouseLeave","refKey","onKeyDown","onBlur","ref"],ct=["onBlur","onClick","onPress","onKeyDown","refKey","ref"],pt=["item","index","onMouseMove","onClick","onPress","refKey","disabled","ref"];function ft(e){void 0===e&&(e={}),Xe();var n=s({},ze,e),i=n.items,o=n.scrollIntoView,r=n.environment,l=n.itemToString,a=n.getA11ySelectionMessage,d=n.getA11yStatusMessage,c=Ke(at,Ve(n),n),p=c[0],f=c[1],g=p.isOpen,h=p.highlightedIndex,m=p.selectedItem,I=p.inputValue,v=t.useRef(null),y=t.useRef(null),b=t.useRef({}),x=t.useRef(null),w=De(n),S=t.useRef(),C=t.useRef(!0),k=Ee({state:p,props:n}),D=t.useCallback((function(e){return b.current[w.getItemId(e)]}),[w]);Fe(d,[g,h,I,i],s({isInitialMount:C.current,previousResultCount:S.current,items:i,environment:r,itemToString:l},p)),Fe(a,[m],s({isInitialMount:C.current,previousResultCount:S.current,items:i,environment:r,itemToString:l},p));var O=_e({menuElement:y.current,highlightedIndex:h,isOpen:g,itemRefs:b,scrollIntoView:o,getItemNodeFromIndex:D});t.useEffect((function(){return x.current=G((function(e){e({type:20,inputValue:""})}),500),function(){x.current.cancel()}}),[]),t.useEffect((function(){I&&x.current(f)}),[f,I]),Ne({isInitialMount:C.current,props:n,state:p}),t.useEffect((function(){C.current||(S.current=i.length)}));var M=Be(g,[y,v],r,(function(){f({type:rt})})),E=Le();t.useEffect((function(){return C.current=!1,function(){C.current=!0}}),[]),t.useEffect((function(){g||(b.current={})}),[g]);var P=t.useMemo((function(){return{ArrowDown:function(e){e.preventDefault(),f({type:Ye,altKey:e.altKey})},ArrowUp:function(e){e.preventDefault(),f({type:Ge,altKey:e.altKey})},Home:function(e){e.preventDefault(),f({type:Ze})},End:function(e){e.preventDefault(),f({type:et})},Escape:function(){k.current.state.isOpen&&f({type:Qe})},Enter:function(e){e.preventDefault(),f({type:k.current.state.isOpen?tt:0})},PageUp:function(e){k.current.state.isOpen&&(e.preventDefault(),f({type:it}))},PageDown:function(e){k.current.state.isOpen&&(e.preventDefault(),f({type:ot}))}," ":function(e){e.preventDefault();var t=k.current.state;t.isOpen?t.inputValue?f({type:Je,key:" "}):f({type:nt}):f({type:0})}}}),[f,k]),K=t.useCallback((function(){f({type:15})}),[f]),R=t.useCallback((function(){f({type:17})}),[f]),T=t.useCallback((function(){f({type:16})}),[f]),H=t.useCallback((function(e){f({type:18,highlightedIndex:e})}),[f]),V=t.useCallback((function(e){f({type:st,selectedItem:e})}),[f]),A=t.useCallback((function(){f({type:21})}),[f]),B=t.useCallback((function(e){f({type:20,inputValue:e})}),[f]),L=t.useCallback((function(e){return s({id:w.labelId,htmlFor:w.toggleButtonId},e)}),[w]),F=t.useCallback((function(e,t){var n,i=void 0===e?{}:e,o=i.onMouseLeave,r=i.refKey,l=void 0===r?"ref":r;i.onKeyDown,i.onBlur;var a=i.ref,d=u(i,dt),c=(void 0===t?{}:t).suppressRefError;return E("getMenuProps",void 0!==c&&c,l,y),s(((n={})[l]=Q(a,(function(e){y.current=e})),n.id=w.menuId,n.role="listbox",n["aria-labelledby"]=d&&d["aria-label"]?void 0:""+w.labelId,n.onMouseLeave=J(o,(function(){f({type:12})})),n),d)}),[f,E,w]);return{getToggleButtonProps:t.useCallback((function(e,t){var n,i=void 0===e?{}:e,o=i.onBlur,r=i.onClick;i.onPress;var l=i.onKeyDown,a=i.refKey,d=void 0===a?"ref":a,c=i.ref,p=u(i,ct),g=(void 0===t?{}:t).suppressRefError,h=void 0!==g&&g,m=k.current.state,I=s(((n={})[d]=Q(c,(function(e){v.current=e})),n["aria-activedescendant"]=m.isOpen&&m.highlightedIndex>-1?w.getItemId(m.highlightedIndex):"",n["aria-controls"]=w.menuId,n["aria-expanded"]=k.current.state.isOpen,n["aria-haspopup"]="listbox",n["aria-labelledby"]=p&&p["aria-label"]?void 0:""+w.labelId,n.id=w.toggleButtonId,n.role="combobox",n.tabIndex=0,n.onBlur=J(o,(function(){m.isOpen&&!M.current.isMouseDown&&f({type:rt})})),n),p);return p.disabled||(I.onClick=J(r,(function(){f({type:0})})),I.onKeyDown=J(l,(function(e){var t=ue(e);t&&P[t]?P[t](e):function(e){return/^\S{1}$/.test(e)}(t)&&f({type:Je,key:t})}))),E("getToggleButtonProps",h,d,v),I}),[k,w,E,f,M,P]),getLabelProps:L,getMenuProps:F,getItemProps:t.useCallback((function(e){var t,n=void 0===e?{}:e,i=n.item,o=n.index,r=n.onMouseMove,l=n.onClick;n.onPress;var a=n.refKey,d=void 0===a?"ref":a,c=n.disabled,p=n.ref,g=u(n,pt);void 0!==c&&console.warn('Passing "disabled" as an argument to getItemProps is not supported anymore. Please use the isItemDisabled prop from useSelect.');var h=k.current,m=h.state,I=h.props,v=Oe(i,o,I.items,"Pass either item or index to getItemProps!"),y=v[0],x=v[1],S=I.isItemDisabled(y,x),C=s(((t={})[d]=Q(p,(function(e){e&&(b.current[w.getItemId(x)]=e)})),t["aria-disabled"]=S,t["aria-selected"]=""+(y===m.selectedItem),t.id=w.getItemId(x),t.role="option",t),g);return S||(C.onClick=J(l,(function(){f({type:ut,index:x})}))),C.onMouseMove=J(r,(function(){x!==m.highlightedIndex&&(O.current=!1,f({type:13,index:x,disabled:S}))})),C}),[k,w,O,f]),toggleMenu:K,openMenu:T,closeMenu:R,setHighlightedIndex:H,selectItem:V,reset:A,setInputValue:B,highlightedIndex:h,isOpen:g,selectedItem:m,inputValue:I}}ft.stateChangeTypes=lt;var gt=0,ht=1,mt=2,It=3,vt=4,yt=5,bt=6,xt=7,wt=8,St=9,Ct=10,kt=13,Dt=19,Ot=22,Mt=Object.freeze({__proto__:null,InputKeyDownArrowDown:gt,InputKeyDownArrowUp:ht,InputKeyDownEscape:mt,InputKeyDownHome:It,InputKeyDownEnd:vt,InputKeyDownPageUp:yt,InputKeyDownPageDown:bt,InputKeyDownEnter:xt,InputChange:wt,InputBlur:St,InputClick:Ct,MenuMouseLeave:11,ItemMouseMove:12,ItemClick:kt,ToggleButtonClick:14,FunctionToggleMenu:15,FunctionOpenMenu:16,FunctionCloseMenu:17,FunctionSetHighlightedIndex:18,FunctionSelectItem:Dt,FunctionSetInputValue:20,FunctionReset:21,ControlledPropUpdatedSelectedItem:Ot});s({},$e,{items:r.default.array.isRequired,isItemDisabled:r.default.func,selectedItemChanged:r.default.func,getA11ySelectionMessage:r.default.func,inputValue:r.default.string,defaultInputValue:r.default.string,initialInputValue:r.default.string,inputId:r.default.string,onInputValueChange:r.default.func});var Et=z,Pt=s({},Re,{selectedItemChanged:function(e,t){return e!==t},getA11yStatusMessage:ee,isItemDisabled:function(){return!1}});function Kt(e,t){var n,i,o=t.type,r=t.props,u=t.altKey;switch(o){case kt:i={isOpen:Te(r,"isOpen"),highlightedIndex:Te(r,"highlightedIndex"),selectedItem:r.items[t.index],inputValue:r.itemToString(r.items[t.index])};break;case gt:i=e.isOpen?{highlightedIndex:se(e.highlightedIndex,1,r.items,r.isItemDisabled,!0)}:{highlightedIndex:u&&null==e.selectedItem?-1:Ae(r,e,1),isOpen:r.items.length>=0};break;case ht:i=e.isOpen?u?je(r,e.highlightedIndex):{highlightedIndex:se(e.highlightedIndex,-1,r.items,r.isItemDisabled,!0)}:{highlightedIndex:Ae(r,e,-1),isOpen:r.items.length>=0};break;case xt:i=je(r,e.highlightedIndex);break;case mt:i=s({isOpen:!1,highlightedIndex:-1},!e.isOpen&&{selectedItem:null,inputValue:""});break;case yt:i={highlightedIndex:se(e.highlightedIndex,-10,r.items,r.isItemDisabled,!0)};break;case bt:i={highlightedIndex:se(e.highlightedIndex,10,r.items,r.isItemDisabled,!0)};break;case It:i={highlightedIndex:le(0,!1,r.items,r.isItemDisabled)};break;case vt:i={highlightedIndex:le(r.items.length-1,!0,r.items,r.isItemDisabled)};break;case St:i=s({isOpen:!1,highlightedIndex:-1},e.highlightedIndex>=0&&(null==(n=r.items)?void 0:n.length)&&t.selectItem&&{selectedItem:r.items[e.highlightedIndex],inputValue:r.itemToString(r.items[e.highlightedIndex])});break;case wt:i={isOpen:!0,highlightedIndex:Te(r,"highlightedIndex"),inputValue:t.inputValue};break;case Ct:i={isOpen:!e.isOpen,highlightedIndex:e.isOpen?-1:Ae(r,e,0)};break;case Dt:i={selectedItem:t.selectedItem,inputValue:r.itemToString(t.selectedItem)};break;case Ot:i={inputValue:t.inputValue};break;default:return We(e,t,Mt)}return s({},e,i)}var Rt=["onMouseLeave","refKey","ref"],Tt=["item","index","refKey","ref","onMouseMove","onMouseDown","onClick","onPress","disabled"],Ht=["onClick","onPress","refKey","ref"],Vt=["onKeyDown","onChange","onInput","onBlur","onChangeText","onClick","refKey","ref"];function At(e){void 0===e&&(e={}),Et();var n=s({},Pt,e),i=n.items,o=n.scrollIntoView,r=n.environment,l=n.getA11yStatusMessage,a=n.getA11ySelectionMessage,d=n.itemToString,c=function(e){var t=Ve(e),n=t.selectedItem,i=t.inputValue;return""===i&&n&&void 0===e.defaultInputValue&&void 0===e.initialInputValue&&void 0===e.inputValue&&(i=e.itemToString(n)),s({},t,{inputValue:i})}(n),p=function(e,n,i){var o=t.useRef(),r=Pe(e,n,i),u=r[0],s=r[1];return t.useEffect((function(){re(i,"selectedItem")&&(i.selectedItemChanged(o.current,i.selectedItem)&&s({type:Ot,inputValue:i.itemToString(i.selectedItem)}),o.current=u.selectedItem===o.current?i.selectedItem:u.selectedItem)}),[u.selectedItem,i.selectedItem]),[oe(u,i),s]}(Kt,c,n),f=p[0],g=p[1],h=f.isOpen,m=f.highlightedIndex,I=f.selectedItem,v=f.inputValue,y=t.useRef(null),b=t.useRef({}),x=t.useRef(null),w=t.useRef(null),S=t.useRef(!0),C=De(n),k=t.useRef(),D=Ee({state:f,props:n}),O=t.useCallback((function(e){return b.current[C.getItemId(e)]}),[C]);Fe(l,[h,m,v,i],s({isInitialMount:S.current,previousResultCount:k.current,items:i,environment:r,itemToString:d},f)),Fe(a,[I],s({isInitialMount:S.current,previousResultCount:k.current,items:i,environment:r,itemToString:d},f));var M=_e({menuElement:y.current,highlightedIndex:m,isOpen:h,itemRefs:b,scrollIntoView:o,getItemNodeFromIndex:O});Ne({isInitialMount:S.current,props:n,state:f}),t.useEffect((function(){He(n,"isOpen")&&x.current&&x.current.focus()}),[]),t.useEffect((function(){S.current||(k.current=i.length)}));var E=Be(h,[x,y,w],r,(function(){g({type:St,selectItem:!1})})),P=Le();t.useEffect((function(){return S.current=!1,function(){S.current=!0}}),[]),t.useEffect((function(){var e;if(h){if((null==(e=r.document)?void 0:e.activeElement)!==x.current){var t;null==x||null==(t=x.current)||t.focus()}}else b.current={}}),[h,r]);var K=t.useMemo((function(){return{ArrowDown:function(e){e.preventDefault(),g({type:gt,altKey:e.altKey})},ArrowUp:function(e){e.preventDefault(),g({type:ht,altKey:e.altKey})},Home:function(e){D.current.state.isOpen&&(e.preventDefault(),g({type:It}))},End:function(e){D.current.state.isOpen&&(e.preventDefault(),g({type:vt}))},Escape:function(e){var t=D.current.state;(t.isOpen||t.inputValue||t.selectedItem||t.highlightedIndex>-1)&&(e.preventDefault(),g({type:mt}))},Enter:function(e){D.current.state.isOpen&&229!==e.which&&(e.preventDefault(),g({type:xt}))},PageUp:function(e){D.current.state.isOpen&&(e.preventDefault(),g({type:yt}))},PageDown:function(e){D.current.state.isOpen&&(e.preventDefault(),g({type:bt}))}}}),[g,D]),R=t.useCallback((function(e){return s({id:C.labelId,htmlFor:C.inputId},e)}),[C]),T=t.useCallback((function(e,t){var n,i=void 0===e?{}:e,o=i.onMouseLeave,r=i.refKey,l=void 0===r?"ref":r,a=i.ref,d=u(i,Rt),c=(void 0===t?{}:t).suppressRefError;return P("getMenuProps",void 0!==c&&c,l,y),s(((n={})[l]=Q(a,(function(e){y.current=e})),n.id=C.menuId,n.role="listbox",n["aria-labelledby"]=d&&d["aria-label"]?void 0:""+C.labelId,n.onMouseLeave=J(o,(function(){g({type:11})})),n),d)}),[g,P,C]),H=t.useCallback((function(e){var t,n,i=void 0===e?{}:e,o=i.item,r=i.index,l=i.refKey,a=void 0===l?"ref":l,d=i.ref,c=i.onMouseMove,p=i.onMouseDown,f=i.onClick;i.onPress;var h=i.disabled,m=u(i,Tt);void 0!==h&&console.warn('Passing "disabled" as an argument to getItemProps is not supported anymore. Please use the isItemDisabled prop from useCombobox.');var I=D.current,v=I.props,y=I.state,x=Oe(o,r,v.items,"Pass either item or index to getItemProps!"),w=x[0],S=x[1],k=v.isItemDisabled(w,S),O=f;return s(((t={})[a]=Q(d,(function(e){e&&(b.current[C.getItemId(S)]=e)})),t["aria-disabled"]=k,t["aria-selected"]=""+(S===y.highlightedIndex),t.id=C.getItemId(S),t.role="option",t),!k&&((n={}).onClick=J(O,(function(){g({type:kt,index:S})})),n),{onMouseMove:J(c,(function(){S!==y.highlightedIndex&&(M.current=!1,g({type:12,index:S,disabled:k}))})),onMouseDown:J(p,(function(e){return e.preventDefault()}))},m)}),[g,D,M,C]),V=t.useCallback((function(e){var t,n=void 0===e?{}:e,i=n.onClick;n.onPress;var o=n.refKey,r=void 0===o?"ref":o,l=n.ref,a=u(n,Ht),d=D.current.state;return s(((t={})[r]=Q(l,(function(e){w.current=e})),t["aria-controls"]=C.menuId,t["aria-expanded"]=d.isOpen,t.id=C.toggleButtonId,t.tabIndex=-1,t),!a.disabled&&s({},{onClick:J(i,(function(){g({type:14})}))}),a)}),[g,D,C]),A=t.useCallback((function(e,t){var n,i=void 0===e?{}:e,o=i.onKeyDown,l=i.onChange,a=i.onInput,d=i.onBlur;i.onChangeText;var c=i.onClick,p=i.refKey,f=void 0===p?"ref":p,h=i.ref,m=u(i,Vt),I=(void 0===t?{}:t).suppressRefError;P("getInputProps",void 0!==I&&I,f,x);var v,y=D.current.state,b={};m.disabled||((v={}).onInput=J(l,a,(function(e){g({type:wt,inputValue:e.target.value})})),v.onKeyDown=J(o,(function(e){var t=ue(e);t&&K[t]&&K[t](e)})),v.onBlur=J(d,(function(e){if(y.isOpen&&!E.current.isMouseDown){var t=null===e.relatedTarget&&r.document.activeElement!==r.document.body;g({type:St,selectItem:!t})}})),v.onClick=J(c,(function(){g({type:Ct})})),b=v);return s(((n={})[f]=Q(h,(function(e){x.current=e})),n["aria-activedescendant"]=y.isOpen&&y.highlightedIndex>-1?C.getItemId(y.highlightedIndex):"",n["aria-autocomplete"]="list",n["aria-controls"]=C.menuId,n["aria-expanded"]=y.isOpen,n["aria-labelledby"]=m&&m["aria-label"]?void 0:C.labelId,n.autoComplete="off",n.id=C.inputId,n.role="combobox",n.value=y.inputValue,n),b,m)}),[P,D,C,K,g,E,r]),B=t.useCallback((function(){g({type:15})}),[g]),L=t.useCallback((function(){g({type:17})}),[g]),F=t.useCallback((function(){g({type:16})}),[g]),_=t.useCallback((function(e){g({type:18,highlightedIndex:e})}),[g]),N=t.useCallback((function(e){g({type:Dt,selectedItem:e})}),[g]);return{getItemProps:H,getLabelProps:R,getMenuProps:T,getInputProps:A,getToggleButtonProps:V,toggleMenu:B,openMenu:F,closeMenu:L,setHighlightedIndex:_,setInputValue:t.useCallback((function(e){g({type:20,inputValue:e})}),[g]),selectItem:N,reset:t.useCallback((function(){g({type:21})}),[g]),highlightedIndex:m,isOpen:h,selectedItem:I,inputValue:v}}At.stateChangeTypes=Mt;var Bt={activeIndex:-1,selectedItems:[]};function Lt(e,t){return He(e,t,Bt)}function Ft(e,t){return Te(e,t,Bt)}function _t(e){if(e.shiftKey||e.metaKey||e.ctrlKey||e.altKey)return!1;var t=e.target;return!(t instanceof HTMLInputElement&&""!==t.value)||0===t.selectionStart&&0===t.selectionEnd}s({},Ue,{selectedItems:r.default.array,initialSelectedItems:r.default.array,defaultSelectedItems:r.default.array,getA11yRemovalMessage:r.default.func,activeIndex:r.default.number,initialActiveIndex:r.default.number,defaultActiveIndex:r.default.number,onActiveIndexChange:r.default.func,onSelectedItemsChange:r.default.func,keyNavigationNext:r.default.string,keyNavigationPrevious:r.default.string});var Nt={itemToString:Re.itemToString,stateReducer:Re.stateReducer,environment:Re.environment,getA11yRemovalMessage:function(e){var t=e.removedSelectedItem;return(0,e.itemToString)(t)+" has been removed."},keyNavigationNext:"ArrowRight",keyNavigationPrevious:"ArrowLeft"},jt=z,Ut=0,$t=1,Wt=2,qt=3,zt=4,Xt=5,Yt=6,Gt=7,Jt=8,Qt=9,Zt=10,en=11,tn=12,nn=Object.freeze({__proto__:null,SelectedItemClick:Ut,SelectedItemKeyDownDelete:$t,SelectedItemKeyDownBackspace:Wt,SelectedItemKeyDownNavigationNext:qt,SelectedItemKeyDownNavigationPrevious:zt,DropdownKeyDownNavigationPrevious:Xt,DropdownKeyDownBackspace:Yt,DropdownClick:Gt,FunctionAddSelectedItem:Jt,FunctionRemoveSelectedItem:Qt,FunctionSetSelectedItems:Zt,FunctionSetActiveIndex:en,FunctionReset:tn});function on(e,t){var n,i=t.type,o=t.index,r=t.props,u=t.selectedItem,l=e.activeIndex,a=e.selectedItems;switch(i){case Ut:n={activeIndex:o};break;case zt:n={activeIndex:l-1<0?0:l-1};break;case qt:n={activeIndex:l+1>=a.length?-1:l+1};break;case Wt:case $t:if(l<0)break;var d=l;1===a.length?d=-1:l===a.length-1&&(d=a.length-2),n=s({selectedItems:[].concat(a.slice(0,l),a.slice(l+1))},{activeIndex:d});break;case Xt:n={activeIndex:a.length-1};break;case Yt:n={selectedItems:a.slice(0,a.length-1)};break;case Jt:n={selectedItems:[].concat(a,[u])};break;case Gt:n={activeIndex:-1};break;case Qt:var c=l,p=a.indexOf(u);if(p<0)break;1===a.length?c=-1:p===a.length-1&&(c=a.length-2),n={selectedItems:[].concat(a.slice(0,p),a.slice(p+1)),activeIndex:c};break;case Zt:n={selectedItems:t.selectedItems};break;case en:n={activeIndex:t.activeIndex};break;case tn:n={activeIndex:Ft(r,"activeIndex"),selectedItems:Ft(r,"selectedItems")};break;default:throw new Error("Reducer called without proper action type.")}return s({},e,n)}var rn=["refKey","ref","onClick","onKeyDown","selectedItem","index"],un=["refKey","ref","onKeyDown","onClick","preventKeyAction"];function sn(e){void 0===e&&(e={}),jt();var n=s({},Nt,e),i=n.getA11yRemovalMessage,o=n.itemToString,r=n.environment,l=n.keyNavigationNext,a=n.keyNavigationPrevious,d=Ke(on,function(e){return{activeIndex:Lt(e,"activeIndex"),selectedItems:Lt(e,"selectedItems")}}(n),n),c=d[0],p=d[1],f=c.activeIndex,g=c.selectedItems,h=t.useRef(!0),m=t.useRef(null),I=t.useRef(g),v=t.useRef();v.current=[];var y=Ee({state:c,props:n});t.useEffect((function(){if(!h.current){if(g.length<I.current.length){var e=I.current.find((function(e){return g.indexOf(e)<0}));ce(i({itemToString:o,resultCount:g.length,removedSelectedItem:e,activeIndex:f,activeSelectedItem:g[f]}),r.document)}I.current=g}}),[g.length]),t.useEffect((function(){h.current||(-1===f&&m.current?m.current.focus():v.current[f]&&v.current[f].focus())}),[f]),Ne({isInitialMount:h.current,props:n,state:c});var b=Le();t.useEffect((function(){return h.current=!1,function(){h.current=!0}}),[]);var x=t.useMemo((function(){var e;return(e={})[a]=function(){p({type:zt})},e[l]=function(){p({type:qt})},e.Delete=function(){p({type:$t})},e.Backspace=function(){p({type:Wt})},e}),[p,l,a]),w=t.useMemo((function(){var e;return(e={})[a]=function(e){_t(e)&&p({type:Xt})},e.Backspace=function(e){_t(e)&&p({type:Yt})},e}),[p,a]);return{getSelectedItemProps:t.useCallback((function(e){var t,n=void 0===e?{}:e,i=n.refKey,o=void 0===i?"ref":i,r=n.ref,l=n.onClick,a=n.onKeyDown,d=n.selectedItem,c=n.index,f=u(n,rn),g=y.current.state,h=Oe(d,c,g.selectedItems,"Pass either item or index to getSelectedItemProps!")[1],m=h>-1&&h===g.activeIndex;return s(((t={})[o]=Q(r,(function(e){e&&v.current.push(e)})),t.tabIndex=m?0:-1,t.onClick=J(l,(function(){p({type:Ut,index:h})})),t.onKeyDown=J(a,(function(e){var t=ue(e);t&&x[t]&&x[t](e)})),t),f)}),[p,y,x]),getDropdownProps:t.useCallback((function(e,t){var n,i=void 0===e?{}:e,o=i.refKey,r=void 0===o?"ref":o,l=i.ref,a=i.onKeyDown,d=i.onClick,c=i.preventKeyAction,f=void 0!==c&&c,g=u(i,un),h=(void 0===t?{}:t).suppressRefError;return b("getDropdownProps",void 0!==h&&h,r,m),s(((n={})[r]=Q(l,(function(e){e&&(m.current=e)})),n),!f&&{onKeyDown:J(a,(function(e){var t=ue(e);t&&w[t]&&w[t](e)})),onClick:J(d,(function(){p({type:Gt})}))},g)}),[p,w,b]),addSelectedItem:t.useCallback((function(e){p({type:Jt,selectedItem:e})}),[p]),removeSelectedItem:t.useCallback((function(e){p({type:Qt,selectedItem:e})}),[p]),setSelectedItems:t.useCallback((function(e){p({type:Zt,selectedItems:e})}),[p]),setActiveIndex:t.useCallback((function(e){p({type:en,activeIndex:e})}),[p]),reset:t.useCallback((function(){p({type:tn})}),[p]),selectedItems:g,activeIndex:f}}sn.stateChangeTypes=nn,e.default=be,e.resetIdCounter=function(){"useId"in o.default?console.warn("It is not necessary to call resetIdCounter when using React 18+"):W=0},e.useCombobox=At,e.useMultipleSelection=sn,e.useSelect=ft,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
//# sourceMappingURL=downshift.umd.min.js.map |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2793095
33010