downshift
Advanced tools
Comparing version 7.1.1 to 7.1.2
@@ -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";var n={exports:{}},i={},o="function"==typeof Symbol&&Symbol.for,r=o?Symbol.for("react.element"):60103,s=o?Symbol.for("react.portal"):60106,u=o?Symbol.for("react.fragment"):60107,l=o?Symbol.for("react.strict_mode"):60108,a=o?Symbol.for("react.profiler"):60114,d=o?Symbol.for("react.provider"):60109,c=o?Symbol.for("react.context"):60110,h=o?Symbol.for("react.async_mode"):60111,p=o?Symbol.for("react.concurrent_mode"):60111,g=o?Symbol.for("react.forward_ref"):60112,m=o?Symbol.for("react.suspense"):60113,f=o?Symbol.for("react.suspense_list"):60120,I=o?Symbol.for("react.memo"):60115,y=o?Symbol.for("react.lazy"):60116,v=o?Symbol.for("react.block"):60121,x=o?Symbol.for("react.fundamental"):60117,b=o?Symbol.for("react.responder"):60118,w=o?Symbol.for("react.scope"):60119;function S(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case r:switch(e=e.type){case h:case p:case u:case a:case l:case m:return e;default:switch(e=e&&e.$$typeof){case c:case g:case y:case I:case d:return e;default:return t}}case s:return t}}}function C(e){return S(e)===p}i.AsyncMode=h,i.ConcurrentMode=p,i.ContextConsumer=c,i.ContextProvider=d,i.Element=r,i.ForwardRef=g,i.Fragment=u,i.Lazy=y,i.Memo=I,i.Portal=s,i.Profiler=a,i.StrictMode=l,i.Suspense=m,i.isAsyncMode=function(e){return C(e)||S(e)===h},i.isConcurrentMode=C,i.isContextConsumer=function(e){return S(e)===c},i.isContextProvider=function(e){return S(e)===d},i.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===r},i.isForwardRef=function(e){return S(e)===g},i.isFragment=function(e){return S(e)===u},i.isLazy=function(e){return S(e)===y},i.isMemo=function(e){return S(e)===I},i.isPortal=function(e){return S(e)===s},i.isProfiler=function(e){return S(e)===a},i.isStrictMode=function(e){return S(e)===l},i.isSuspense=function(e){return S(e)===m},i.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===u||e===p||e===a||e===l||e===m||e===f||"object"==typeof e&&null!==e&&(e.$$typeof===y||e.$$typeof===I||e.$$typeof===d||e.$$typeof===c||e.$$typeof===g||e.$$typeof===x||e.$$typeof===b||e.$$typeof===w||e.$$typeof===v)},i.typeOf=S;function k(){}function O(){}O.resetWarningCache=k;n.exports=function(){function e(e,t,n,i,o,r){if("SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"!==r){var s=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 s.name="Invariant Violation",s}}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:O,resetWarningCache:k};return n.PropTypes=n,n}();var M=n.exports,E={},D=60103,P=60106,T=60107,R=60108,H=60114,F=60109,K=60110,V=60112,$=60113,A=60120,N=60115,B=60116,L=60121,_=60122,j=60117,U=60129,W=60131;if("function"==typeof Symbol&&Symbol.for){var z=Symbol.for;D=z("react.element"),P=z("react.portal"),T=z("react.fragment"),R=z("react.strict_mode"),H=z("react.profiler"),F=z("react.provider"),K=z("react.context"),V=z("react.forward_ref"),$=z("react.suspense"),A=z("react.suspense_list"),N=z("react.memo"),B=z("react.lazy"),L=z("react.block"),_=z("react.server.block"),j=z("react.fundamental"),U=z("react.debug_trace_mode"),W=z("react.legacy_hidden")}function q(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case D:switch(e=e.type){case T:case H:case R:case $:case A:return e;default:switch(e=e&&e.$$typeof){case K:case V:case B:case N:case F:return e;default:return t}}case P:return t}}}var Y=F,X=D,G=V,J=T,Q=B,Z=N,ee=P,te=H,ne=R,ie=$;function oe(e){return"object"==typeof e&&null!=e&&1===e.nodeType}function re(e,t){return(!t||"hidden"!==e)&&"visible"!==e&&"clip"!==e}function se(e,t){if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){var n=getComputedStyle(e,null);return re(n.overflowY,t)||re(n.overflowX,t)||function(e){var t=function(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}function ue(e,t,n,i,o,r,s,u){return r<e&&s>t||r>e&&s<t?0:r<=e&&u<=n||s>=t&&u>=n?r-e-i:s>t&&u<n||r<e&&u>n?s-t+o:0}E.ContextConsumer=K,E.ContextProvider=Y,E.Element=X,E.ForwardRef=G,E.Fragment=J,E.Lazy=Q,E.Memo=Z,E.Portal=ee,E.Profiler=te,E.StrictMode=ne,E.Suspense=ie,E.isAsyncMode=function(){return!1},E.isConcurrentMode=function(){return!1},E.isContextConsumer=function(e){return q(e)===K},E.isContextProvider=function(e){return q(e)===F},E.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===D},E.isForwardRef=function(e){return q(e)===V},E.isFragment=function(e){return q(e)===T},E.isLazy=function(e){return q(e)===B},E.isMemo=function(e){return q(e)===N},E.isPortal=function(e){return q(e)===P},E.isProfiler=function(e){return q(e)===H},E.isStrictMode=function(e){return q(e)===R},E.isSuspense=function(e){return q(e)===$},E.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===T||e===H||e===U||e===R||e===$||e===A||e===W||"object"==typeof e&&null!==e&&(e.$$typeof===B||e.$$typeof===N||e.$$typeof===F||e.$$typeof===K||e.$$typeof===V||e.$$typeof===j||e.$$typeof===L||e[0]===_)},E.typeOf=q;let le=0;function ae(e){return"function"==typeof e?e:de}function de(){}function ce(e,t){if(!e)return;const n=function(e,t){var n=window,i=t.scrollMode,o=t.block,r=t.inline,s=t.boundary,u=t.skipOverflowHiddenElements,l="function"==typeof s?s:function(e){return e!==s};if(!oe(e))throw new TypeError("Invalid target");for(var a,d,c=document.scrollingElement||document.documentElement,h=[],p=e;oe(p)&&l(p);){if((p=null==(d=(a=p).parentElement)?a.getRootNode().host||null:d)===c){h.push(p);break}null!=p&&p===document.body&&se(p)&&!se(document.documentElement)||null!=p&&se(p,u)&&h.push(p)}for(var g=n.visualViewport?n.visualViewport.width:innerWidth,m=n.visualViewport?n.visualViewport.height:innerHeight,f=window.scrollX||pageXOffset,I=window.scrollY||pageYOffset,y=e.getBoundingClientRect(),v=y.height,x=y.width,b=y.top,w=y.right,S=y.bottom,C=y.left,k="start"===o||"nearest"===o?b:"end"===o?S:b+v/2,O="center"===r?C+x/2:"end"===r?w:C,M=[],E=0;E<h.length;E++){var D=h[E],P=D.getBoundingClientRect(),T=P.height,R=P.width,H=P.top,F=P.right,K=P.bottom,V=P.left;if("if-needed"===i&&b>=0&&C>=0&&S<=m&&w<=g&&b>=H&&S<=K&&C>=V&&w<=F)return M;var $=getComputedStyle(D),A=parseInt($.borderLeftWidth,10),N=parseInt($.borderTopWidth,10),B=parseInt($.borderRightWidth,10),L=parseInt($.borderBottomWidth,10),_=0,j=0,U="offsetWidth"in D?D.offsetWidth-D.clientWidth-A-B:0,W="offsetHeight"in D?D.offsetHeight-D.clientHeight-N-L:0,z="offsetWidth"in D?0===D.offsetWidth?0:R/D.offsetWidth:0,q="offsetHeight"in D?0===D.offsetHeight?0:T/D.offsetHeight:0;if(c===D)_="start"===o?k:"end"===o?k-m:"nearest"===o?ue(I,I+m,m,N,L,I+k,I+k+v,v):k-m/2,j="start"===r?O:"center"===r?O-g/2:"end"===r?O-g:ue(f,f+g,g,A,B,f+O,f+O+x,x),_=Math.max(0,_+I),j=Math.max(0,j+f);else{_="start"===o?k-H-N:"end"===o?k-K+L+W:"nearest"===o?ue(H,K,T,N,L+W,k,k+v,v):k-(H+T/2)+W/2,j="start"===r?O-V-A:"center"===r?O-(V+R/2)+U/2:"end"===r?O-F+B+U:ue(V,F,R,A,B+U,O,O+x,x);var Y=D.scrollLeft,X=D.scrollTop;k+=X-(_=Math.max(0,Math.min(X+_/q,D.scrollHeight-T/q+W))),O+=Y-(j=Math.max(0,Math.min(Y+j/z,D.scrollWidth-R/z+U)))}M.push({el:D,top:_,left:j})}return M}(e,{boundary:t,block:"nearest",scrollMode:"if-needed"});n.forEach((e=>{let{el:t,top:n,left:i}=e;t.scrollTop=n,t.scrollLeft=i}))}function he(e,t,n){return e===t||t instanceof n.Node&&e.contains&&e.contains(t)}function pe(e,t){let n;function i(){n&&clearTimeout(n)}function o(){for(var o=arguments.length,r=new Array(o),s=0;s<o;s++)r[s]=arguments[s];i(),n=setTimeout((()=>{n=null,e(...r)}),t)}return o.cancel=i,o}function ge(){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((t=>(t&&t(e,...i),e.preventDownshiftDefault||e.hasOwnProperty("nativeEvent")&&e.nativeEvent.preventDownshiftDefault)))}}function me(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return e=>{t.forEach((t=>{"function"==typeof t?t(e):t&&(t.current=e)}))}}function fe(){return String(le++)}function Ie(e){let{isOpen:t,resultCount:n,previousResultCount:i}=e;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 ye(e,t){return!(e=Array.isArray(e)?e[0]:e)&&t?t:e}const ve=["highlightedIndex","inputValue","isOpen","selectedItem","type"];function xe(e){void 0===e&&(e={});const t={};return ve.forEach((n=>{e.hasOwnProperty(n)&&(t[n]=e[n])})),t}function be(e,t){return Object.keys(e).reduce(((n,i)=>(n[i]=we(t,i)?t[i]:e[i],n)),{})}function we(e,t){return void 0!==e[t]}function Se(e){const{key:t,keyCode:n}=e;return n>=37&&n<=40&&0!==t.indexOf("Arrow")?`Arrow${t}`:t}function Ce(e,t,n,i,o){if(void 0===o&&(o=!0),0===n)return-1;const r=n-1;("number"!=typeof t||t<0||t>=n)&&(t=e>0?-1:r+1);let s=t+e;s<0?s=o?r:0:s>r&&(s=o?0:r);const u=ke(e,s,n,i,o);return-1===u?t>=n?-1:t:u}function ke(e,t,n,i,o){const r=i(t);if(!r||!r.hasAttribute("disabled"))return t;if(e>0){for(let e=t+1;e<n;e++)if(!i(e).hasAttribute("disabled"))return e}else for(let e=t-1;e>=0;e--)if(!i(e).hasAttribute("disabled"))return e;return o?e>0?ke(1,0,n,i,!1):ke(-1,n-1,n,i,!1):-1}function Oe(e,t,n,i){return void 0===i&&(i=!0),t.some((t=>t&&(he(t,e,n)||i&&he(t,n.document.activeElement,n))))}const Me=pe((e=>{De(e).textContent=""}),500);function Ee(e,t){const n=De(t);e&&(n.textContent=e,Me(t))}function De(e){void 0===e&&(e=document);let t=e.getElementById("a11y-status-message");return t||(t=e.createElement("div"),t.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 Pe=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});const Te=(()=>{class e extends t.Component{constructor(e){var t;super(e),t=this,this.id=this.props.id||`downshift-${fe()}`,this.menuId=this.props.menuId||`${this.id}-menu`,this.labelId=this.props.labelId||`${this.id}-label`,this.inputId=this.props.inputId||`${this.id}-input`,this.getItemId=this.props.getItemId||(e=>`${this.id}-item-${e}`),this.input=null,this.items=[],this.itemCount=null,this.previousResultCount=0,this.timeoutIds=[],this.internalSetTimeout=(e,t)=>{const n=setTimeout((()=>{this.timeoutIds=this.timeoutIds.filter((e=>e!==n)),e()}),t);this.timeoutIds.push(n)},this.setItemCount=e=>{this.itemCount=e},this.unsetItemCount=()=>{this.itemCount=null},this.setHighlightedIndex=function(e,n){void 0===e&&(e=t.props.defaultHighlightedIndex),void 0===n&&(n={}),n=xe(n),t.internalSetState({highlightedIndex:e,...n})},this.clearSelection=e=>{this.internalSetState({selectedItem:null,inputValue:"",highlightedIndex:this.props.defaultHighlightedIndex,isOpen:this.props.defaultIsOpen},e)},this.selectItem=(e,t,n)=>{t=xe(t),this.internalSetState({isOpen:this.props.defaultIsOpen,highlightedIndex:this.props.defaultHighlightedIndex,selectedItem:e,inputValue:this.props.itemToString(e),...t},n)},this.selectItemAtIndex=(e,t,n)=>{const i=this.items[e];null!=i&&this.selectItem(i,t,n)},this.selectHighlightedItem=(e,t)=>this.selectItemAtIndex(this.getState().highlightedIndex,e,t),this.internalSetState=(e,t)=>{let n,i;const o={},r="function"==typeof e;return!r&&e.hasOwnProperty("inputValue")&&this.props.onInputValueChange(e.inputValue,{...this.getStateAndHelpers(),...e}),this.setState((t=>{t=this.getState(t);let s=r?e(t):e;s=this.props.stateReducer(t,s),n=s.hasOwnProperty("selectedItem");const u={};return n&&s.selectedItem!==t.selectedItem&&(i=s.selectedItem),s.type=s.type||0,Object.keys(s).forEach((e=>{t[e]!==s[e]&&(o[e]=s[e]),"type"!==e&&(s[e],we(this.props,e)||(u[e]=s[e]))})),r&&s.hasOwnProperty("inputValue")&&this.props.onInputValueChange(s.inputValue,{...this.getStateAndHelpers(),...s}),u}),(()=>{ae(t)();Object.keys(o).length>1&&this.props.onStateChange(o,this.getStateAndHelpers()),n&&this.props.onSelect(e.selectedItem,this.getStateAndHelpers()),void 0!==i&&this.props.onChange(i,this.getStateAndHelpers()),this.props.onUserAction(o,this.getStateAndHelpers())}))},this.rootRef=e=>this._rootNode=e,this.getRootProps=function(e,n){let{refKey:i="ref",ref:o,...r}=void 0===e?{}:e,{suppressRefError:s=!1}=void 0===n?{}:n;t.getRootProps.called=!0,t.getRootProps.refKey=i,t.getRootProps.suppressRefError=s;const{isOpen:u}=t.getState();return{[i]:me(o,t.rootRef),role:"combobox","aria-expanded":u,"aria-haspopup":"listbox","aria-owns":u?t.menuId:null,"aria-labelledby":t.labelId,...r}},this.keyDownHandlers={ArrowDown(e){if(e.preventDefault(),this.getState().isOpen){const t=e.shiftKey?5:1;this.moveHighlightedIndex(t,{type:4})}else this.internalSetState({isOpen:!0,type:4},(()=>{const e=this.getItemCount();if(e>0){const{highlightedIndex:t}=this.getState(),n=Ce(1,t,e,(e=>this.getItemNodeFromIndex(e)));this.setHighlightedIndex(n,{type:4})}}))},ArrowUp(e){if(e.preventDefault(),this.getState().isOpen){const t=e.shiftKey?-5:-1;this.moveHighlightedIndex(t,{type:3})}else this.internalSetState({isOpen:!0,type:3},(()=>{const e=this.getItemCount();if(e>0){const{highlightedIndex:t}=this.getState(),n=Ce(-1,t,e,(e=>this.getItemNodeFromIndex(e)));this.setHighlightedIndex(n,{type:3})}}))},Enter(e){if(229===e.which)return;const{isOpen:t,highlightedIndex:n}=this.getState();if(t&&null!=n){e.preventDefault();const t=this.items[n],i=this.getItemNodeFromIndex(n);if(null==t||i&&i.hasAttribute("disabled"))return;this.selectHighlightedItem({type:6})}},Escape(e){e.preventDefault(),this.reset({type:5,...!this.state.isOpen&&{selectedItem:null,inputValue:""}})}},this.buttonKeyDownHandlers={...this.keyDownHandlers," "(e){e.preventDefault(),this.toggleMenu({type:12})}},this.inputKeyDownHandlers={...this.keyDownHandlers,Home(e){const{isOpen:t}=this.getState();if(!t)return;e.preventDefault();const n=this.getItemCount();if(n<=0||!t)return;const i=ke(1,0,n,(e=>this.getItemNodeFromIndex(e)),!1);this.setHighlightedIndex(i,{type:7})},End(e){const{isOpen:t}=this.getState();if(!t)return;e.preventDefault();const n=this.getItemCount();if(n<=0||!t)return;const i=ke(-1,n-1,n,(e=>this.getItemNodeFromIndex(e)),!1);this.setHighlightedIndex(i,{type:8})}},this.getToggleButtonProps=function(e){let{onClick:n,onPress:i,onKeyDown:o,onKeyUp:r,onBlur:s,...u}=void 0===e?{}:e;const{isOpen:l}=t.getState(),a={onClick:ge(n,t.buttonHandleClick),onKeyDown:ge(o,t.buttonHandleKeyDown),onKeyUp:ge(r,t.buttonHandleKeyUp),onBlur:ge(s,t.buttonHandleBlur)};return{type:"button",role:"button","aria-label":l?"close menu":"open menu","aria-haspopup":!0,"data-toggle":!0,...u.disabled?{}:a,...u}},this.buttonHandleKeyUp=e=>{e.preventDefault()},this.buttonHandleKeyDown=e=>{const t=Se(e);this.buttonKeyDownHandlers[t]&&this.buttonKeyDownHandlers[t].call(this,e)},this.buttonHandleClick=e=>{e.preventDefault(),this.props.environment.document.activeElement===this.props.environment.document.body&&e.target.focus(),this.internalSetTimeout((()=>this.toggleMenu({type:13})))},this.buttonHandleBlur=e=>{const t=e.target;this.internalSetTimeout((()=>{this.isMouseDown||null!=this.props.environment.document.activeElement&&this.props.environment.document.activeElement.id===this.inputId||this.props.environment.document.activeElement===t||this.reset({type:14})}))},this.getLabelProps=e=>({htmlFor:this.inputId,id:this.labelId,...e}),this.getInputProps=function(e){let n,{onKeyDown:i,onBlur:o,onChange:r,onInput:s,onChangeText:u,...l}=void 0===e?{}:e,a={};n="onChange";const{inputValue:d,isOpen:c,highlightedIndex:h}=t.getState();return l.disabled||(a={onChange:ge(r,s,t.inputHandleChange),onKeyDown:ge(i,t.inputHandleKeyDown),onBlur:ge(o,t.inputHandleBlur)}),{"aria-autocomplete":"list","aria-activedescendant":c&&"number"==typeof h&&h>=0?t.getItemId(h):null,"aria-controls":c?t.menuId:null,"aria-labelledby":t.labelId,autoComplete:"off",value:d,id:t.inputId,...a,...l}},this.inputHandleKeyDown=e=>{const t=Se(e);t&&this.inputKeyDownHandlers[t]&&this.inputKeyDownHandlers[t].call(this,e)},this.inputHandleChange=e=>{this.internalSetState({type:11,isOpen:!0,inputValue:e.target.value,highlightedIndex:this.props.defaultHighlightedIndex})},this.inputHandleBlur=()=>{this.internalSetTimeout((()=>{const e=this.props.environment.document&&!!this.props.environment.document.activeElement&&!!this.props.environment.document.activeElement.dataset&&this.props.environment.document.activeElement.dataset.toggle&&this._rootNode&&this._rootNode.contains(this.props.environment.document.activeElement);this.isMouseDown||e||this.reset({type:10})}))},this.menuRef=e=>{this._menuNode=e},this.getMenuProps=function(e,n){let{refKey:i="ref",ref:o,...r}=void 0===e?{}:e,{suppressRefError:s=!1}=void 0===n?{}:n;return t.getMenuProps.called=!0,t.getMenuProps.refKey=i,t.getMenuProps.suppressRefError=s,{[i]:me(o,t.menuRef),role:"listbox","aria-labelledby":r&&r["aria-label"]?null:t.labelId,id:t.menuId,...r}},this.getItemProps=function(e){let{onMouseMove:n,onMouseDown:i,onClick:o,onPress:r,index:s,item:u,...l}=void 0===e?{}:e;void 0===s?(t.items.push(u),s=t.items.indexOf(u)):t.items[s]=u;const a=o,d={onMouseMove:ge(n,(()=>{s!==t.getState().highlightedIndex&&(t.setHighlightedIndex(s,{type:2}),t.avoidScrolling=!0,t.internalSetTimeout((()=>t.avoidScrolling=!1),250))})),onMouseDown:ge(i,(e=>{e.preventDefault()})),onClick:ge(a,(()=>{t.selectItemAtIndex(s,{type:9})}))},c=l.disabled?{onMouseDown:d.onMouseDown}:d;return{id:t.getItemId(s),role:"option","aria-selected":t.getState().highlightedIndex===s,...c,...l}},this.clearItems=()=>{this.items=[]},this.reset=function(e,n){void 0===e&&(e={}),e=xe(e),t.internalSetState((n=>{let{selectedItem:i}=n;return{isOpen:t.props.defaultIsOpen,highlightedIndex:t.props.defaultHighlightedIndex,inputValue:t.props.itemToString(i),...e}}),n)},this.toggleMenu=function(e,n){void 0===e&&(e={}),e=xe(e),t.internalSetState((n=>{let{isOpen:i}=n;return{isOpen:!i,...i&&{highlightedIndex:t.props.defaultHighlightedIndex},...e}}),(()=>{const{isOpen:i,highlightedIndex:o}=t.getState();i&&t.getItemCount()>0&&"number"==typeof o&&t.setHighlightedIndex(o,e),ae(n)()}))},this.openMenu=e=>{this.internalSetState({isOpen:!0},e)},this.closeMenu=e=>{this.internalSetState({isOpen:!1},e)},this.updateStatus=pe((()=>{const e=this.getState(),t=this.items[e.highlightedIndex],n=this.getItemCount(),i=this.props.getA11yStatusMessage({itemToString:this.props.itemToString,previousResultCount:this.previousResultCount,resultCount:n,highlightedItem:t,...e});this.previousResultCount=n,Ee(i,this.props.environment.document)}),200);const{defaultHighlightedIndex:n,initialHighlightedIndex:i=n,defaultIsOpen:o,initialIsOpen:r=o,initialInputValue:s="",initialSelectedItem:u=null}=this.props,l=this.getState({highlightedIndex:i,isOpen:r,inputValue:s,selectedItem:u});null!=l.selectedItem&&void 0===this.props.initialInputValue&&(l.inputValue=this.props.itemToString(l.selectedItem)),this.state=l}internalClearTimeouts(){this.timeoutIds.forEach((e=>{clearTimeout(e)})),this.timeoutIds=[]}getState(e){return void 0===e&&(e=this.state),be(e,this.props)}getItemCount(){let e=this.items.length;return null!=this.itemCount?e=this.itemCount:void 0!==this.props.itemCount&&(e=this.props.itemCount),e}getItemNodeFromIndex(e){return this.props.environment.document.getElementById(this.getItemId(e))}scrollHighlightedItemIntoView(){{const e=this.getItemNodeFromIndex(this.getState().highlightedIndex);this.props.scrollIntoView(e,this._menuNode)}}moveHighlightedIndex(e,t){const n=this.getItemCount(),{highlightedIndex:i}=this.getState();if(n>0){const o=Ce(e,i,n,(e=>this.getItemNodeFromIndex(e)));this.setHighlightedIndex(o,t)}}getStateAndHelpers(){const{highlightedIndex:e,inputValue:t,selectedItem:n,isOpen:i}=this.getState(),{itemToString:o}=this.props,{id:r}=this,{getRootProps:s,getToggleButtonProps:u,getLabelProps:l,getMenuProps:a,getInputProps:d,getItemProps:c,openMenu:h,closeMenu:p,toggleMenu:g,selectItem:m,selectItemAtIndex:f,selectHighlightedItem:I,setHighlightedIndex:y,clearSelection:v,clearItems:x,reset:b,setItemCount:w,unsetItemCount:S,internalSetState:C}=this;return{getRootProps:s,getToggleButtonProps:u,getLabelProps:l,getMenuProps:a,getInputProps:d,getItemProps:c,reset:b,openMenu:h,closeMenu:p,toggleMenu:g,selectItem:m,selectItemAtIndex:f,selectHighlightedItem:I,setHighlightedIndex:y,clearSelection:v,clearItems:x,setItemCount:w,unsetItemCount:S,setState:C,itemToString:o,id:r,highlightedIndex:e,inputValue:t,isOpen:i,selectedItem:n}}componentDidMount(){{const e=()=>{this.isMouseDown=!0},t=e=>{this.isMouseDown=!1;!Oe(e.target,[this._rootNode,this._menuNode],this.props.environment)&&this.getState().isOpen&&this.reset({type:1},(()=>this.props.onOuterClick(this.getStateAndHelpers())))},n=()=>{this.isTouchMove=!1},i=()=>{this.isTouchMove=!0},o=e=>{const t=Oe(e.target,[this._rootNode,this._menuNode],this.props.environment,!1);this.isTouchMove||t||!this.getState().isOpen||this.reset({type:16},(()=>this.props.onOuterClick(this.getStateAndHelpers())))},{environment:r}=this.props;r.addEventListener("mousedown",e),r.addEventListener("mouseup",t),r.addEventListener("touchstart",n),r.addEventListener("touchmove",i),r.addEventListener("touchend",o),this.cleanup=()=>{this.internalClearTimeouts(),this.updateStatus.cancel(),r.removeEventListener("mousedown",e),r.removeEventListener("mouseup",t),r.removeEventListener("touchstart",n),r.removeEventListener("touchmove",i),r.removeEventListener("touchend",o)}}}shouldScroll(e,t){const{highlightedIndex:n}=void 0===this.props.highlightedIndex?this.getState():this.props,{highlightedIndex:i}=void 0===t.highlightedIndex?e:t;return n&&this.getState().isOpen&&!e.isOpen||n!==i}componentDidUpdate(e,t){we(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()}componentWillUnmount(){this.cleanup()}render(){const e=ye(this.props.children,de);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;const n=ye(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}}return e.defaultProps={defaultHighlightedIndex:null,defaultIsOpen:!1,getA11yStatusMessage:Ie,itemToString:e=>null==e?"":String(e),onStateChange:de,onInputValueChange:de,onUserAction:de,onChange:de,onSelect:de,onOuterClick:de,selectedItemChanged:(e,t)=>e!==t,environment:"undefined"==typeof window?{}:window,stateReducer:(e,t)=>t,suppressRefError:!1,scrollIntoView:ce},e.stateChangeTypes=Pe,e})();var Re=Te;const He={highlightedIndex:-1,isOpen:!1,selectedItem:null,inputValue:""};function Fe(e,t,n){const{props:i,type:o}=e,r={};Object.keys(t).forEach((i=>{!function(e,t,n,i){const{props:o,type:r}=t,s=`on${Ne(e)}Change`;o[s]&&void 0!==i[e]&&i[e]!==n[e]&&o[s]({type:r,...i})}(i,e,t,n),n[i]!==t[i]&&(r[i]=n[i])})),i.onStateChange&&Object.keys(r).length&&i.onStateChange({type:o,...r})}const Ke=pe(((e,t)=>{Ee(e(),t)}),200),Ve="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement?t.useLayoutEffect:t.useEffect;function $e(e){let{id:n=`downshift-${fe()}`,labelId:i,menuId:o,getItemId:r,toggleButtonId:s,inputId:u}=e;return t.useRef({labelId:i||`${n}-label`,menuId:o||`${n}-menu`,getItemId:r||(e=>`${n}-item-${e}`),toggleButtonId:s||`${n}-toggle-button`,inputId:u||`${n}-input`}).current}function Ae(e,t,n){return void 0!==e?e:0===n.length?-1:n.indexOf(t)}function Ne(e){return`${e.slice(0,1).toUpperCase()}${e.slice(1)}`}function Be(e){const n=t.useRef(e);return n.current=e,n}function Le(e,n,i){const o=t.useRef(),r=t.useRef(),s=t.useCallback(((t,n)=>{r.current=n,t=be(t,n.props);const i=e(t,n);return n.props.stateReducer(t,{...n,changes:i})}),[e]),[u,l]=t.useReducer(s,n),a=Be(i),d=t.useCallback((e=>l({props:a.current,...e})),[a]),c=r.current;return t.useEffect((()=>{c&&o.current&&o.current!==u&&Fe(c,be(o.current,c.props),u),o.current=u}),[u,i,c]),[u,d]}function _e(e,t,n){const[i,o]=Le(e,t,n);return[be(i,n),o]}const je={itemToString:function(e){return e?String(e):""},stateReducer:function(e,t){return t.changes},getA11ySelectionMessage:function(e){const{selectedItem:t,itemToString:n}=e;return t?`${n(t)} has been selected.`:""},scrollIntoView:ce,environment:"undefined"==typeof window?{}:window};function Ue(e,t,n){void 0===n&&(n=He);const i=e[`default${Ne(t)}`];return void 0!==i?i:n[t]}function We(e,t,n){void 0===n&&(n=He);const i=e[t];if(void 0!==i)return i;const o=e[`initial${Ne(t)}`];return void 0!==o?o:Ue(e,t,n)}function ze(e){const t=We(e,"selectedItem"),n=We(e,"isOpen"),i=We(e,"highlightedIndex"),o=We(e,"inputValue");return{highlightedIndex:i<0&&t&&n?e.items.indexOf(t):i,isOpen:n,selectedItem:t,inputValue:o}}function qe(e,t,n){const{items:i,initialHighlightedIndex:o,defaultHighlightedIndex:r}=e,{selectedItem:s,highlightedIndex:u}=t;return 0===i.length?-1:void 0!==o&&u===o?o:void 0!==r?r:s?i.indexOf(s):0===n?-1:n<0?i.length-1:0}function Ye(e,n,i,o){const r=t.useRef({isMouseDown:!1,isTouchMove:!1});return t.useEffect((()=>{const t=()=>{r.current.isMouseDown=!0},s=t=>{r.current.isMouseDown=!1,e&&!Oe(t.target,n.map((e=>e.current)),i)&&o()},u=()=>{r.current.isTouchMove=!1},l=()=>{r.current.isTouchMove=!0},a=t=>{!e||r.current.isTouchMove||Oe(t.target,n.map((e=>e.current)),i,!1)||o()};return i.addEventListener("mousedown",t),i.addEventListener("mouseup",s),i.addEventListener("touchstart",u),i.addEventListener("touchmove",l),i.addEventListener("touchend",a),function(){i.removeEventListener("mousedown",t),i.removeEventListener("mouseup",s),i.removeEventListener("touchstart",u),i.removeEventListener("touchmove",l),i.removeEventListener("touchend",a)}}),[e,i]),r}let Xe=()=>de;function Ge(e,n,i){let{isInitialMount:o,highlightedIndex:r,items:s,environment:u,...l}=i;t.useEffect((()=>{o||Ke((()=>e({highlightedIndex:r,highlightedItem:s[r],resultCount:s.length,...l})),u.document)}),n)}function Je(e){let{highlightedIndex:n,isOpen:i,itemRefs:o,getItemNodeFromIndex:r,menuElement:s,scrollIntoView:u}=e;const l=t.useRef(!0);return Ve((()=>{n<0||!i||!Object.keys(o.current).length||(!1===l.current?l.current=!0:u(r(n),s))}),[n]),l}let Qe=de;function Ze(e,t,n){const{type:i,props:o}=t;let r;switch(i){case n.ItemMouseMove:r={highlightedIndex:t.disabled?-1:t.index};break;case n.MenuMouseLeave:r={highlightedIndex:-1};break;case n.ToggleButtonClick:case n.FunctionToggleMenu:r={isOpen:!e.isOpen,highlightedIndex:e.isOpen?-1:qe(o,e,0)};break;case n.FunctionOpenMenu:r={isOpen:!0,highlightedIndex:qe(o,e,0)};break;case n.FunctionCloseMenu:r={isOpen:!1};break;case n.FunctionSetHighlightedIndex:r={highlightedIndex:t.highlightedIndex};break;case n.FunctionSetInputValue:r={inputValue:t.inputValue};break;case n.FunctionReset:r={highlightedIndex:Ue(o,"highlightedIndex"),isOpen:Ue(o,"isOpen"),selectedItem:Ue(o,"selectedItem"),inputValue:Ue(o,"inputValue")};break;default:throw new Error("Reducer called without proper action type.")}return{...e,...r}}var et=function(){return et=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},et.apply(this,arguments)};M.array.isRequired,M.func,M.func,M.func,M.number,M.number,M.number,M.bool,M.bool,M.bool,M.any,M.any,M.any,M.string,M.string,M.string,M.func,M.string,M.func,M.func,M.func,M.func,M.func,M.shape({addEventListener:M.func,removeEventListener:M.func,document:M.shape({getElementById:M.func,activeElement:M.any,body:M.any})});var tt=et(et({},je),{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.":""}}),nt=de;var it=Object.freeze({__proto__:null,ToggleButtonClick:0,ToggleButtonKeyDownArrowDown:1,ToggleButtonKeyDownArrowUp:2,ToggleButtonKeyDownCharacter:3,ToggleButtonKeyDownEscape:4,ToggleButtonKeyDownHome:5,ToggleButtonKeyDownEnd:6,ToggleButtonKeyDownEnter:7,ToggleButtonKeyDownSpaceButton:8,ToggleButtonKeyDownPageUp:9,ToggleButtonKeyDownPageDown:10,ToggleButtonBlur:11,MenuMouseLeave:12,ItemMouseMove:13,ItemClick:14,FunctionToggleMenu:15,FunctionOpenMenu:16,FunctionCloseMenu:17,FunctionSetHighlightedIndex:18,FunctionSelectItem:19,FunctionSetInputValue:20,FunctionReset:21});function ot(e,t){const{type:n,props:i,altKey:o}=t;let r;switch(n){case 14:r={isOpen:Ue(i,"isOpen"),highlightedIndex:Ue(i,"highlightedIndex"),selectedItem:i.items[t.index]};break;case 3:{const n=t.key,o=`${e.inputValue}${n}`,s=function(e){for(var t=e.keysSoFar,n=e.highlightedIndex,i=e.items,o=e.itemToString,r=e.getItemNodeFromIndex,s=t.toLowerCase(),u=0;u<i.length;u++){var l=(u+n+(t.length<2?1:0))%i.length,a=i[l];if(void 0!==a&&o(a).toLowerCase().startsWith(s)){var d=r(l);if(!(null==d?void 0:d.hasAttribute("disabled")))return l}}return n}({keysSoFar:o,highlightedIndex:!e.isOpen&&e.selectedItem?i.items.indexOf(e.selectedItem):e.highlightedIndex,items:i.items,itemToString:i.itemToString,getItemNodeFromIndex:t.getItemNodeFromIndex});r={inputValue:o,highlightedIndex:s,isOpen:!0}}break;case 1:r={highlightedIndex:e.isOpen?Ce(1,e.highlightedIndex,i.items.length,t.getItemNodeFromIndex,!1):o&&null==e.selectedItem?-1:qe(i,e,1),isOpen:!0};break;case 2:if(e.isOpen&&o)r={isOpen:Ue(i,"isOpen"),highlightedIndex:Ue(i,"highlightedIndex"),...e.highlightedIndex>=0&&{selectedItem:i.items[e.highlightedIndex]}};else{r={highlightedIndex:e.isOpen?Ce(-1,e.highlightedIndex,i.items.length,t.getItemNodeFromIndex,!1):qe(i,e,-1),isOpen:!0}}break;case 7:case 8:r={isOpen:Ue(i,"isOpen"),highlightedIndex:Ue(i,"highlightedIndex"),...e.highlightedIndex>=0&&{selectedItem:i.items[e.highlightedIndex]}};break;case 5:r={highlightedIndex:ke(1,0,i.items.length,t.getItemNodeFromIndex,!1),isOpen:!0};break;case 6:r={highlightedIndex:ke(-1,i.items.length-1,i.items.length,t.getItemNodeFromIndex,!1),isOpen:!0};break;case 9:r={highlightedIndex:Ce(-10,e.highlightedIndex,i.items.length,t.getItemNodeFromIndex,!1)};break;case 10:r={highlightedIndex:Ce(10,e.highlightedIndex,i.items.length,t.getItemNodeFromIndex,!1)};break;case 4:r={isOpen:!1,highlightedIndex:-1};break;case 11:r={isOpen:!1,highlightedIndex:-1,...e.highlightedIndex>=0&&{selectedItem:i.items[e.highlightedIndex]}};break;case 19:r={selectedItem:t.selectedItem};break;default:return Ze(e,t,it)}return{...e,...r}}function rt(e){void 0===e&&(e={}),nt();const n={...tt,...e},{items:i,scrollIntoView:o,environment:r,itemToString:s,getA11ySelectionMessage:u,getA11yStatusMessage:l}=n,a=ze(n),[d,c]=_e(ot,a,n),{isOpen:h,highlightedIndex:p,selectedItem:g,inputValue:m}=d,f=t.useRef(null),I=t.useRef(null),y=t.useRef({}),v=t.useRef(null),x=$e(n),b=t.useRef(),w=t.useRef(!0),S=Be({state:d,props:n}),C=t.useCallback((e=>y.current[x.getItemId(e)]),[x]);Ge(l,[h,p,m,i],{isInitialMount:w.current,previousResultCount:b.current,items:i,environment:r,itemToString:s,...d}),Ge(u,[g],{isInitialMount:w.current,previousResultCount:b.current,items:i,environment:r,itemToString:s,...d});const k=Je({menuElement:I.current,highlightedIndex:p,isOpen:h,itemRefs:y,scrollIntoView:o,getItemNodeFromIndex:C});t.useEffect((()=>(v.current=pe((e=>{e({type:20,inputValue:""})}),500),()=>{v.current.cancel()})),[]),t.useEffect((()=>{m&&v.current(c)}),[c,m]),Qe({isInitialMount:w.current,props:n,state:d}),t.useEffect((()=>{w.current||(b.current=i.length)}));const O=Ye(h,[I,f],r,(()=>{c({type:11})})),M=Xe();t.useEffect((()=>(w.current=!1,()=>{w.current=!0})),[]),t.useEffect((()=>{h||(y.current={})}),[h]);const E=t.useMemo((()=>({ArrowDown(e){e.preventDefault(),c({type:1,getItemNodeFromIndex:C,altKey:e.altKey})},ArrowUp(e){e.preventDefault(),c({type:2,getItemNodeFromIndex:C,altKey:e.altKey})},Home(e){e.preventDefault(),c({type:5,getItemNodeFromIndex:C})},End(e){e.preventDefault(),c({type:6,getItemNodeFromIndex:C})},Escape(){S.current.state.isOpen&&c({type:4})},Enter(e){e.preventDefault(),c({type:S.current.state.isOpen?7:0})},PageUp(e){S.current.state.isOpen&&(e.preventDefault(),c({type:9,getItemNodeFromIndex:C}))},PageDown(e){S.current.state.isOpen&&(e.preventDefault(),c({type:10,getItemNodeFromIndex:C}))}," "(e){e.preventDefault();const t=S.current.state;t.isOpen?t.inputValue?c({type:3,key:" ",getItemNodeFromIndex:C}):c({type:8}):c({type:0})}})),[c,C,S]),D=t.useCallback((()=>{c({type:15})}),[c]),P=t.useCallback((()=>{c({type:17})}),[c]),T=t.useCallback((()=>{c({type:16})}),[c]),R=t.useCallback((e=>{c({type:18,highlightedIndex:e})}),[c]),H=t.useCallback((e=>{c({type:19,selectedItem:e})}),[c]),F=t.useCallback((()=>{c({type:21})}),[c]),K=t.useCallback((e=>{c({type:20,inputValue:e})}),[c]),V=t.useCallback((e=>({id:x.labelId,htmlFor:x.toggleButtonId,...e})),[x]),$=t.useCallback((function(e,t){let{onMouseLeave:n,refKey:i="ref",onKeyDown:o,onBlur:r,ref:s,...u}=void 0===e?{}:e,{suppressRefError:l=!1}=void 0===t?{}:t;return M("getMenuProps",l,i,I),{[i]:me(s,(e=>{I.current=e})),id:x.menuId,role:"listbox","aria-labelledby":x.labelId,tabIndex:-1,onMouseLeave:ge(n,(()=>{c({type:12})})),...u}}),[c,M,x]);return{getToggleButtonProps:t.useCallback((function(e,t){let{onBlur:n,onClick:i,onKeyDown:o,refKey:r="ref",ref:s,...u}=void 0===e?{}:e,{suppressRefError:l=!1}=void 0===t?{}:t;const a=S.current.state,d=()=>{c({type:0})},h=e=>{const t=Se(e);t&&E[t]?E[t](e):function(e){return/^\S{1}$/.test(e)}(t)&&c({type:3,key:t,getItemNodeFromIndex:C})},p={[r]:me(s,(e=>{f.current=e})),"aria-activedescendant":a.isOpen&&a.highlightedIndex>-1?x.getItemId(a.highlightedIndex):"","aria-controls":x.menuId,"aria-expanded":S.current.state.isOpen,"aria-haspopup":"listbox","aria-labelledby":`${x.labelId}`,id:x.toggleButtonId,role:"combobox",tabIndex:0,onBlur:ge(n,(()=>{a.isOpen&&!O.current.isMouseDown&&c({type:11})})),...u};return u.disabled||(p.onClick=ge(i,d),p.onKeyDown=ge(o,h)),M("getToggleButtonProps",l,r,f),p}),[S,x,M,c,O,E,C]),getLabelProps:V,getMenuProps:$,getItemProps:t.useCallback((function(e){let{item:t,index:n,onMouseMove:o,onClick:r,refKey:s="ref",ref:u,disabled:l,...a}=void 0===e?{}:e;const{state:d,props:h}=S.current,p=t??i[n],m=Ae(n,p,h.items),f=()=>{c({type:14,index:m})},I=Ae(m,p,h.items);if(I<0)throw new Error("Pass either item or item index in getItemProps!");const v={disabled:l,role:"option","aria-selected":`${p===g}`,id:x.getItemId(I),[s]:me(u,(e=>{e&&(y.current[x.getItemId(I)]=e)})),...a};return l||(v.onClick=ge(r,f)),v.onMouseMove=ge(o,(()=>{m!==d.highlightedIndex&&(k.current=!1,c({type:13,index:m,disabled:l}))})),v}),[S,i,g,x,k,c]),toggleMenu:D,openMenu:T,closeMenu:P,setHighlightedIndex:R,selectItem:H,reset:F,setInputValue:K,highlightedIndex:p,isOpen:h,selectedItem:g,inputValue:m}}rt.stateChangeTypes=it;var st=Object.freeze({__proto__:null,InputKeyDownArrowDown:0,InputKeyDownArrowUp:1,InputKeyDownEscape:2,InputKeyDownHome:3,InputKeyDownEnd:4,InputKeyDownPageUp:5,InputKeyDownPageDown:6,InputKeyDownEnter:7,InputChange:8,InputBlur:9,InputFocus:10,MenuMouseLeave:11,ItemMouseMove:12,ItemClick:13,ToggleButtonClick:14,FunctionToggleMenu:15,FunctionOpenMenu:16,FunctionCloseMenu:17,FunctionSetHighlightedIndex:18,FunctionSelectItem:19,FunctionSetInputValue:20,FunctionReset:21,ControlledPropUpdatedSelectedItem:22});M.array.isRequired,M.func,M.func,M.func,M.number,M.number,M.number,M.bool,M.bool,M.bool,M.any,M.any,M.any,M.string,M.string,M.string,M.string,M.string,M.string,M.func,M.string,M.string,M.func,M.func,M.func,M.func,M.func,M.func,M.shape({addEventListener:M.func,removeEventListener:M.func,document:M.shape({getElementById:M.func,activeElement:M.any,body:M.any})});let ut=de;const lt={...je,getA11yStatusMessage:Ie};function at(e,t){const{type:n,props:i,altKey:o}=t;let r;switch(n){case 13:r={isOpen:Ue(i,"isOpen"),highlightedIndex:Ue(i,"highlightedIndex"),selectedItem:i.items[t.index],inputValue:i.itemToString(i.items[t.index])};break;case 0:r=e.isOpen?{highlightedIndex:Ce(1,e.highlightedIndex,i.items.length,t.getItemNodeFromIndex,!0)}:{highlightedIndex:o&&null==e.selectedItem?-1:qe(i,e,1,t.getItemNodeFromIndex),isOpen:i.items.length>=0};break;case 1:r=e.isOpen?o?{isOpen:Ue(i,"isOpen"),highlightedIndex:Ue(i,"highlightedIndex"),...e.highlightedIndex>=0&&{selectedItem:i.items[e.highlightedIndex],inputValue:i.itemToString(i.items[e.highlightedIndex])}}:{highlightedIndex:Ce(-1,e.highlightedIndex,i.items.length,t.getItemNodeFromIndex,!0)}:{highlightedIndex:qe(i,e,-1,t.getItemNodeFromIndex),isOpen:i.items.length>=0};break;case 7:r={isOpen:Ue(i,"isOpen"),highlightedIndex:Ue(i,"highlightedIndex"),...e.highlightedIndex>=0&&{selectedItem:i.items[e.highlightedIndex],inputValue:i.itemToString(i.items[e.highlightedIndex])}};break;case 2:r={isOpen:!1,highlightedIndex:-1,...!e.isOpen&&{selectedItem:null,inputValue:""}};break;case 5:r={highlightedIndex:Ce(-10,e.highlightedIndex,i.items.length,t.getItemNodeFromIndex,!1)};break;case 6:r={highlightedIndex:Ce(10,e.highlightedIndex,i.items.length,t.getItemNodeFromIndex,!1)};break;case 3:r={highlightedIndex:ke(1,0,i.items.length,t.getItemNodeFromIndex,!1)};break;case 4:r={highlightedIndex:ke(-1,i.items.length-1,i.items.length,t.getItemNodeFromIndex,!1)};break;case 9:r={isOpen:!1,highlightedIndex:-1,...e.highlightedIndex>=0&&t.selectItem&&{selectedItem:i.items[e.highlightedIndex],inputValue:i.itemToString(i.items[e.highlightedIndex])}};break;case 8:r={isOpen:!0,highlightedIndex:Ue(i,"highlightedIndex"),inputValue:t.inputValue};break;case 10:r={isOpen:!0,highlightedIndex:qe(i,e,0)};break;case 19:r={selectedItem:t.selectedItem,inputValue:i.itemToString(t.selectedItem)};break;case 22:r={inputValue:t.inputValue};break;default:return Ze(e,t,st)}return{...e,...r}}function dt(e){void 0===e&&(e={}),ut();const n={...lt,...e},{initialIsOpen:i,defaultIsOpen:o,items:r,scrollIntoView:s,environment:u,getA11yStatusMessage:l,getA11ySelectionMessage:a,itemToString:d}=n,c=function(e){const t=ze(e),{selectedItem:n}=t;let{inputValue:i}=t;return""===i&&n&&void 0===e.defaultInputValue&&void 0===e.initialInputValue&&void 0===e.inputValue&&(i=e.itemToString(n)),{...t,inputValue:i}}(n),[h,p]=function(e,n,i){const o=t.useRef(),[r,s]=Le(e,n,i);return t.useEffect((()=>{we(i,"selectedItem")&&(o.current!==i.selectedItem&&s({type:22,inputValue:i.itemToString(i.selectedItem)}),o.current=r.selectedItem===o.current?i.selectedItem:r.selectedItem)})),[be(r,i),s]}(at,c,n),{isOpen:g,highlightedIndex:m,selectedItem:f,inputValue:I}=h,y=t.useRef(null),v=t.useRef({}),x=t.useRef(null),b=t.useRef(null),w=t.useRef(!0),S=$e(n),C=t.useRef(),k=Be({state:h,props:n}),O=t.useCallback((e=>v.current[S.getItemId(e)]),[S]);Ge(l,[g,m,I,r],{isInitialMount:w.current,previousResultCount:C.current,items:r,environment:u,itemToString:d,...h}),Ge(a,[f],{isInitialMount:w.current,previousResultCount:C.current,items:r,environment:u,itemToString:d,...h});const M=Je({menuElement:y.current,highlightedIndex:m,isOpen:g,itemRefs:v,scrollIntoView:s,getItemNodeFromIndex:O});Qe({isInitialMount:w.current,props:n,state:h}),t.useEffect((()=>{(i||o||g)&&x.current&&x.current.focus()}),[]),t.useEffect((()=>{w.current||(C.current=r.length)}));const E=Ye(g,[x,y,b],u,(()=>{p({type:9,selectItem:!1})})),D=Xe();t.useEffect((()=>(w.current=!1,()=>{w.current=!0})),[]),t.useEffect((()=>{g?document.activeElement!==x.current&&x?.current?.focus():v.current={}}),[g]);const P=t.useMemo((()=>({ArrowDown(e){e.preventDefault(),p({type:0,altKey:e.altKey,getItemNodeFromIndex:O})},ArrowUp(e){e.preventDefault(),p({type:1,altKey:e.altKey,getItemNodeFromIndex:O})},Home(e){k.current.state.isOpen&&(e.preventDefault(),p({type:3,getItemNodeFromIndex:O}))},End(e){k.current.state.isOpen&&(e.preventDefault(),p({type:4,getItemNodeFromIndex:O}))},Escape(e){const t=k.current.state;(t.isOpen||t.inputValue||t.selectedItem||t.highlightedIndex>-1)&&(e.preventDefault(),p({type:2}))},Enter(e){k.current.state.isOpen&&229!==e.which&&(e.preventDefault(),p({type:7,getItemNodeFromIndex:O}))},PageUp(e){k.current.state.isOpen&&(e.preventDefault(),p({type:5,getItemNodeFromIndex:O}))},PageDown(e){k.current.state.isOpen&&(e.preventDefault(),p({type:6,getItemNodeFromIndex:O}))}})),[p,k,O]),T=t.useCallback((e=>({id:S.labelId,htmlFor:S.inputId,...e})),[S]),R=t.useCallback((function(e,t){let{onMouseLeave:n,refKey:i="ref",ref:o,...r}=void 0===e?{}:e,{suppressRefError:s=!1}=void 0===t?{}:t;return D("getMenuProps",s,i,y),{[i]:me(o,(e=>{y.current=e})),id:S.menuId,role:"listbox","aria-labelledby":S.labelId,onMouseLeave:ge(n,(()=>{p({type:11})})),...r}}),[p,D,S]),H=t.useCallback((function(e){let{item:t,index:n,refKey:i="ref",ref:o,onMouseMove:r,onMouseDown:s,onClick:u,onPress:l,disabled:a,...d}=void 0===e?{}:e;const{props:c,state:h}=k.current,g=Ae(n,t,c.items);if(g<0)throw new Error("Pass either item or item index in getItemProps!");const m=u;return{[i]:me(o,(e=>{e&&(v.current[S.getItemId(g)]=e)})),disabled:a,role:"option","aria-selected":`${g===h.highlightedIndex}`,id:S.getItemId(g),...!a&&{onClick:ge(m,(()=>{p({type:13,index:n})}))},onMouseMove:ge(r,(()=>{n!==h.highlightedIndex&&(M.current=!1,p({type:12,index:n,disabled:a}))})),onMouseDown:ge(s,(e=>e.preventDefault())),...d}}),[p,k,M,S]),F=t.useCallback((function(e){let{onClick:t,onPress:n,refKey:i="ref",ref:o,...r}=void 0===e?{}:e;const s=k.current.state;return{[i]:me(o,(e=>{b.current=e})),"aria-controls":S.menuId,"aria-expanded":s.isOpen,id:S.toggleButtonId,tabIndex:-1,...!r.disabled&&{onClick:ge(t,(()=>{p({type:14})}))},...r}}),[p,k,S]),K=t.useCallback((function(e,t){let{onKeyDown:n,onChange:i,onInput:o,onFocus:r,onBlur:s,onChangeText:u,refKey:l="ref",ref:a,...d}=void 0===e?{}:e,{suppressRefError:c=!1}=void 0===t?{}:t;D("getInputProps",c,l,x);const h=k.current.state,g=e=>{const t=Se(e);t&&P[t]&&P[t](e)},m=e=>{p({type:8,inputValue:e.target.value})},f=()=>{h.isOpen&&!E.current.isMouseDown&&p({type:9,selectItem:!0})},I=()=>{h.isOpen||p({type:10})};let y={};return d.disabled||(y={onChange:ge(i,o,m),onKeyDown:ge(n,g),onBlur:ge(s,f),onFocus:ge(r,I)}),{[l]:me(a,(e=>{x.current=e})),"aria-activedescendant":h.isOpen&&h.highlightedIndex>-1?S.getItemId(h.highlightedIndex):"","aria-autocomplete":"list","aria-controls":S.menuId,"aria-expanded":h.isOpen,"aria-labelledby":S.labelId,autoComplete:"off",id:S.inputId,role:"combobox",value:h.inputValue,...y,...d}}),[p,P,k,E,D,S]),V=t.useCallback((()=>{p({type:15})}),[p]),$=t.useCallback((()=>{p({type:17})}),[p]),A=t.useCallback((()=>{p({type:16})}),[p]),N=t.useCallback((e=>{p({type:18,highlightedIndex:e})}),[p]),B=t.useCallback((e=>{p({type:19,selectedItem:e})}),[p]);return{getItemProps:H,getLabelProps:T,getMenuProps:R,getInputProps:K,getToggleButtonProps:F,toggleMenu:V,openMenu:A,closeMenu:$,setHighlightedIndex:N,setInputValue:t.useCallback((e=>{p({type:20,inputValue:e})}),[p]),selectItem:B,reset:t.useCallback((()=>{p({type:21})}),[p]),highlightedIndex:m,isOpen:g,selectedItem:f,inputValue:I}}dt.stateChangeTypes=st;const ct={activeIndex:-1,selectedItems:[]};function ht(e,t){return We(e,t,ct)}function pt(e,t){return Ue(e,t,ct)}function gt(e){if(e.shiftKey||e.metaKey||e.ctrlKey||e.altKey)return!1;const t=e.target;return!(t instanceof HTMLInputElement&&""!==t.value)||0===t.selectionStart&&0===t.selectionEnd}M.array,M.array,M.array,M.func,M.func,M.func,M.number,M.number,M.number,M.func,M.func,M.string,M.string,M.shape({addEventListener:M.func,removeEventListener:M.func,document:M.shape({getElementById:M.func,activeElement:M.any,body:M.any})});const mt={itemToString:je.itemToString,stateReducer:je.stateReducer,environment:je.environment,getA11yRemovalMessage:function(e){const{removedSelectedItem:t,itemToString:n}=e;return`${n(t)} has been removed.`},keyNavigationNext:"ArrowRight",keyNavigationPrevious:"ArrowLeft"};let ft=de;var It=Object.freeze({__proto__:null,SelectedItemClick:0,SelectedItemKeyDownDelete:1,SelectedItemKeyDownBackspace:2,SelectedItemKeyDownNavigationNext:3,SelectedItemKeyDownNavigationPrevious:4,DropdownKeyDownNavigationPrevious:5,DropdownKeyDownBackspace:6,DropdownClick:7,FunctionAddSelectedItem:8,FunctionRemoveSelectedItem:9,FunctionSetSelectedItems:10,FunctionSetActiveIndex:11,FunctionReset:12});function yt(e,t){const{type:n,index:i,props:o,selectedItem:r}=t,{activeIndex:s,selectedItems:u}=e;let l;switch(n){case 0:l={activeIndex:i};break;case 4:l={activeIndex:s-1<0?0:s-1};break;case 3:l={activeIndex:s+1>=u.length?-1:s+1};break;case 2:case 1:{if(s<0)break;let e=s;1===u.length?e=-1:s===u.length-1&&(e=u.length-2),l={selectedItems:[...u.slice(0,s),...u.slice(s+1)],activeIndex:e};break}case 5:l={activeIndex:u.length-1};break;case 6:l={selectedItems:u.slice(0,u.length-1)};break;case 8:l={selectedItems:[...u,r]};break;case 7:l={activeIndex:-1};break;case 9:{let e=s;const t=u.indexOf(r);if(t<0)break;1===u.length?e=-1:t===u.length-1&&(e=u.length-2),l={selectedItems:[...u.slice(0,t),...u.slice(t+1)],activeIndex:e};break}case 10:{const{selectedItems:e}=t;l={selectedItems:e};break}case 11:{const{activeIndex:e}=t;l={activeIndex:e};break}case 12:l={activeIndex:pt(o,"activeIndex"),selectedItems:pt(o,"selectedItems")};break;default:throw new Error("Reducer called without proper action type.")}return{...e,...l}}function vt(e){void 0===e&&(e={}),ft();const n={...mt,...e},{getA11yRemovalMessage:i,itemToString:o,environment:r,keyNavigationNext:s,keyNavigationPrevious:u}=n,[l,a]=_e(yt,function(e){return{activeIndex:ht(e,"activeIndex"),selectedItems:ht(e,"selectedItems")}}(n),n),{activeIndex:d,selectedItems:c}=l,h=t.useRef(!0),p=t.useRef(null),g=t.useRef(c),m=t.useRef();m.current=[];const f=Be({state:l,props:n});t.useEffect((()=>{if(!h.current){if(c.length<g.current.length){const e=g.current.find((e=>c.indexOf(e)<0));Ee(i({itemToString:o,resultCount:c.length,removedSelectedItem:e,activeIndex:d,activeSelectedItem:c[d]}),r.document)}g.current=c}}),[c.length]),t.useEffect((()=>{h.current||(-1===d&&p.current?p.current.focus():m.current[d]&&m.current[d].focus())}),[d]),Qe({isInitialMount:h.current,props:n,state:l});const I=Xe();t.useEffect((()=>(h.current=!1,()=>{h.current=!0})),[]);const y=t.useMemo((()=>({[u](){a({type:4})},[s](){a({type:3})},Delete(){a({type:1})},Backspace(){a({type:2})}})),[a,s,u]),v=t.useMemo((()=>({[u](e){gt(e)&&a({type:5})},Backspace(e){gt(e)&&a({type:6})}})),[a,u]);return{getSelectedItemProps:t.useCallback((function(e){let{refKey:t="ref",ref:n,onClick:i,onKeyDown:o,selectedItem:r,index:s,...u}=void 0===e?{}:e;const{state:l}=f.current;if(Ae(s,r,l.selectedItems)<0)throw new Error("Pass either selectedItem or index in getSelectedItemProps!");return{[t]:me(n,(e=>{e&&m.current.push(e)})),tabIndex:s===l.activeIndex?0:-1,onClick:ge(i,(()=>{a({type:0,index:s})})),onKeyDown:ge(o,(e=>{const t=Se(e);t&&y[t]&&y[t](e)})),...u}}),[a,f,y]),getDropdownProps:t.useCallback((function(e,t){let{refKey:n="ref",ref:i,onKeyDown:o,onClick:r,preventKeyAction:s=!1,...u}=void 0===e?{}:e,{suppressRefError:l=!1}=void 0===t?{}:t;return I("getDropdownProps",l,n,p),{[n]:me(i,(e=>{e&&(p.current=e)})),...!s&&{onKeyDown:ge(o,(e=>{const t=Se(e);t&&v[t]&&v[t](e)})),onClick:ge(r,(()=>{a({type:7})}))},...u}}),[a,v,I]),addSelectedItem:t.useCallback((e=>{a({type:8,selectedItem:e})}),[a]),removeSelectedItem:t.useCallback((e=>{a({type:9,selectedItem:e})}),[a]),setSelectedItems:t.useCallback((e=>{a({type:10,selectedItems:e})}),[a]),setActiveIndex:t.useCallback((e=>{a({type:11,activeIndex:e})}),[a]),reset:t.useCallback((()=>{a({type:12})}),[a]),selectedItems:c,activeIndex:d}}vt.stateChangeTypes=It,e.default=Re,e.resetIdCounter=function(){le=0},e.useCombobox=dt,e.useMultipleSelection=vt,e.useSelect=rt,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,t){if(null==e)return{};var n,o,i={},r=Object.keys(e);for(o=0;o<r.length;o++)n=r[o],t.indexOf(n)>=0||(i[n]=e[n]);return i}function o(){return o=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},o.apply(this,arguments)}function i(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function r(e,t){return r=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},r(e,t)}var u={exports:{}},s={},a="function"==typeof Symbol&&Symbol.for,l=a?Symbol.for("react.element"):60103,c=a?Symbol.for("react.portal"):60106,d=a?Symbol.for("react.fragment"):60107,p=a?Symbol.for("react.strict_mode"):60108,f=a?Symbol.for("react.profiler"):60114,g=a?Symbol.for("react.provider"):60109,h=a?Symbol.for("react.context"):60110,m=a?Symbol.for("react.async_mode"):60111,I=a?Symbol.for("react.concurrent_mode"):60111,v=a?Symbol.for("react.forward_ref"):60112,y=a?Symbol.for("react.suspense"):60113,x=a?Symbol.for("react.suspense_list"):60120,b=a?Symbol.for("react.memo"):60115,w=a?Symbol.for("react.lazy"):60116,S=a?Symbol.for("react.block"):60121,C=a?Symbol.for("react.fundamental"):60117,k=a?Symbol.for("react.responder"):60118,O=a?Symbol.for("react.scope"):60119;function M(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case l:switch(e=e.type){case m:case I:case d:case f:case p:case y:return e;default:switch(e=e&&e.$$typeof){case h:case v:case w:case b:case g:return e;default:return t}}case c:return t}}}function D(e){return M(e)===I}s.AsyncMode=m,s.ConcurrentMode=I,s.ContextConsumer=h,s.ContextProvider=g,s.Element=l,s.ForwardRef=v,s.Fragment=d,s.Lazy=w,s.Memo=b,s.Portal=c,s.Profiler=f,s.StrictMode=p,s.Suspense=y,s.isAsyncMode=function(e){return D(e)||M(e)===m},s.isConcurrentMode=D,s.isContextConsumer=function(e){return M(e)===h},s.isContextProvider=function(e){return M(e)===g},s.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===l},s.isForwardRef=function(e){return M(e)===v},s.isFragment=function(e){return M(e)===d},s.isLazy=function(e){return M(e)===w},s.isMemo=function(e){return M(e)===b},s.isPortal=function(e){return M(e)===c},s.isProfiler=function(e){return M(e)===f},s.isStrictMode=function(e){return M(e)===p},s.isSuspense=function(e){return M(e)===y},s.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===d||e===I||e===f||e===p||e===y||e===x||"object"==typeof e&&null!==e&&(e.$$typeof===w||e.$$typeof===b||e.$$typeof===g||e.$$typeof===h||e.$$typeof===v||e.$$typeof===C||e.$$typeof===k||e.$$typeof===O||e.$$typeof===S)},s.typeOf=M;function E(){}function P(){}P.resetWarningCache=E;u.exports=function(){function e(e,t,n,o,i,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:P,resetWarningCache:E};return n.PropTypes=n,n}();var K=u.exports,T={},R=60103,H=60106,F=60107,V=60108,A=60114,N=60109,B=60110,L=60112,_=60113,$=60120,j=60115,U=60116,W=60121,z=60122,q=60117,Y=60129,X=60131;if("function"==typeof Symbol&&Symbol.for){var G=Symbol.for;R=G("react.element"),H=G("react.portal"),F=G("react.fragment"),V=G("react.strict_mode"),A=G("react.profiler"),N=G("react.provider"),B=G("react.context"),L=G("react.forward_ref"),_=G("react.suspense"),$=G("react.suspense_list"),j=G("react.memo"),U=G("react.lazy"),W=G("react.block"),z=G("react.server.block"),q=G("react.fundamental"),Y=G("react.debug_trace_mode"),X=G("react.legacy_hidden")}function J(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case R:switch(e=e.type){case F:case A:case V:case _:case $:return e;default:switch(e=e&&e.$$typeof){case B:case L:case U:case j:case N:return e;default:return t}}case H:return t}}}var Q=N,Z=R,ee=L,te=F,ne=U,oe=j,ie=H,re=A,ue=V,se=_;function ae(e){return"object"==typeof e&&null!=e&&1===e.nodeType}function le(e,t){return(!t||"hidden"!==e)&&"visible"!==e&&"clip"!==e}function ce(e,t){if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){var n=getComputedStyle(e,null);return le(n.overflowY,t)||le(n.overflowX,t)||function(e){var t=function(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}function de(e,t,n,o,i,r,u,s){return r<e&&u>t||r>e&&u<t?0:r<=e&&s<=n||u>=t&&s>=n?r-e-o:u>t&&s<n||r<e&&s>n?u-t+i:0}T.ContextConsumer=B,T.ContextProvider=Q,T.Element=Z,T.ForwardRef=ee,T.Fragment=te,T.Lazy=ne,T.Memo=oe,T.Portal=ie,T.Profiler=re,T.StrictMode=ue,T.Suspense=se,T.isAsyncMode=function(){return!1},T.isConcurrentMode=function(){return!1},T.isContextConsumer=function(e){return J(e)===B},T.isContextProvider=function(e){return J(e)===N},T.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===R},T.isForwardRef=function(e){return J(e)===L},T.isFragment=function(e){return J(e)===F},T.isLazy=function(e){return J(e)===U},T.isMemo=function(e){return J(e)===j},T.isPortal=function(e){return J(e)===H},T.isProfiler=function(e){return J(e)===A},T.isStrictMode=function(e){return J(e)===V},T.isSuspense=function(e){return J(e)===_},T.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===F||e===A||e===Y||e===V||e===_||e===$||e===X||"object"==typeof e&&null!==e&&(e.$$typeof===U||e.$$typeof===j||e.$$typeof===N||e.$$typeof===B||e.$$typeof===L||e.$$typeof===q||e.$$typeof===W||e[0]===z)},T.typeOf=J;var pe=0;function fe(e){return"function"==typeof e?e:ge}function ge(){}function he(e,t){if(e){var n=function(e,t){var n=window,o=t.scrollMode,i=t.block,r=t.inline,u=t.boundary,s=t.skipOverflowHiddenElements,a="function"==typeof u?u:function(e){return e!==u};if(!ae(e))throw new TypeError("Invalid target");for(var l,c,d=document.scrollingElement||document.documentElement,p=[],f=e;ae(f)&&a(f);){if((f=null==(c=(l=f).parentElement)?l.getRootNode().host||null:c)===d){p.push(f);break}null!=f&&f===document.body&&ce(f)&&!ce(document.documentElement)||null!=f&&ce(f,s)&&p.push(f)}for(var g=n.visualViewport?n.visualViewport.width:innerWidth,h=n.visualViewport?n.visualViewport.height:innerHeight,m=window.scrollX||pageXOffset,I=window.scrollY||pageYOffset,v=e.getBoundingClientRect(),y=v.height,x=v.width,b=v.top,w=v.right,S=v.bottom,C=v.left,k="start"===i||"nearest"===i?b:"end"===i?S:b+y/2,O="center"===r?C+x/2:"end"===r?w:C,M=[],D=0;D<p.length;D++){var E=p[D],P=E.getBoundingClientRect(),K=P.height,T=P.width,R=P.top,H=P.right,F=P.bottom,V=P.left;if("if-needed"===o&&b>=0&&C>=0&&S<=h&&w<=g&&b>=R&&S<=F&&C>=V&&w<=H)return M;var A=getComputedStyle(E),N=parseInt(A.borderLeftWidth,10),B=parseInt(A.borderTopWidth,10),L=parseInt(A.borderRightWidth,10),_=parseInt(A.borderBottomWidth,10),$=0,j=0,U="offsetWidth"in E?E.offsetWidth-E.clientWidth-N-L:0,W="offsetHeight"in E?E.offsetHeight-E.clientHeight-B-_:0,z="offsetWidth"in E?0===E.offsetWidth?0:T/E.offsetWidth:0,q="offsetHeight"in E?0===E.offsetHeight?0:K/E.offsetHeight:0;if(d===E)$="start"===i?k:"end"===i?k-h:"nearest"===i?de(I,I+h,h,B,_,I+k,I+k+y,y):k-h/2,j="start"===r?O:"center"===r?O-g/2:"end"===r?O-g:de(m,m+g,g,N,L,m+O,m+O+x,x),$=Math.max(0,$+I),j=Math.max(0,j+m);else{$="start"===i?k-R-B:"end"===i?k-F+_+W:"nearest"===i?de(R,F,K,B,_+W,k,k+y,y):k-(R+K/2)+W/2,j="start"===r?O-V-N:"center"===r?O-(V+T/2)+U/2:"end"===r?O-H+L+U:de(V,H,T,N,L+U,O,O+x,x);var Y=E.scrollLeft,X=E.scrollTop;k+=X-($=Math.max(0,Math.min(X+$/q,E.scrollHeight-K/q+W))),O+=Y-(j=Math.max(0,Math.min(Y+j/z,E.scrollWidth-T/z+U)))}M.push({el:E,top:$,left:j})}return M}(e,{boundary:t,block:"nearest",scrollMode:"if-needed"});n.forEach((function(e){var t=e.el,n=e.top,o=e.left;t.scrollTop=n,t.scrollLeft=o}))}}function me(e,t,n){return e===t||t instanceof n.Node&&e.contains&&e.contains(t)}function Ie(e,t){var n;function o(){n&&clearTimeout(n)}function i(){for(var i=arguments.length,r=new Array(i),u=0;u<i;u++)r[u]=arguments[u];o(),n=setTimeout((function(){n=null,e.apply(void 0,r)}),t)}return i.cancel=o,i}function ve(){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,o=new Array(n>1?n-1:0),i=1;i<n;i++)o[i-1]=arguments[i];return t.some((function(t){return t&&t.apply(void 0,[e].concat(o)),e.preventDownshiftDefault||e.hasOwnProperty("nativeEvent")&&e.nativeEvent.preventDownshiftDefault}))}}function ye(){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 xe(){return String(pe++)}function be(e){var t=e.isOpen,n=e.resultCount,o=e.previousResultCount;return t?n?n!==o?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 we(e,t){return!(e=Array.isArray(e)?e[0]:e)&&t?t:e}var Se=["highlightedIndex","inputValue","isOpen","selectedItem","type"];function Ce(e){void 0===e&&(e={});var t={};return Se.forEach((function(n){e.hasOwnProperty(n)&&(t[n]=e[n])})),t}function ke(e,t){return Object.keys(e).reduce((function(n,o){return n[o]=Oe(t,o)?t[o]:e[o],n}),{})}function Oe(e,t){return void 0!==e[t]}function Me(e){var t=e.key,n=e.keyCode;return n>=37&&n<=40&&0!==t.indexOf("Arrow")?"Arrow"+t:t}function De(e,t,n,o,i){if(void 0===i&&(i=!0),0===n)return-1;var r=n-1;("number"!=typeof t||t<0||t>=n)&&(t=e>0?-1:r+1);var u=t+e;u<0?u=i?r:0:u>r&&(u=i?0:r);var s=Ee(e,u,n,o,i);return-1===s?t>=n?-1:t:s}function Ee(e,t,n,o,i){var r=o(t);if(!r||!r.hasAttribute("disabled"))return t;if(e>0){for(var u=t+1;u<n;u++)if(!o(u).hasAttribute("disabled"))return u}else for(var s=t-1;s>=0;s--)if(!o(s).hasAttribute("disabled"))return s;return i?e>0?Ee(1,0,n,o,!1):Ee(-1,n-1,n,o,!1):-1}function Pe(e,t,n,o){return void 0===o&&(o=!0),t.some((function(t){return t&&(me(t,e,n)||o&&me(t,n.document.activeElement,n))}))}var Ke=Ie((function(e){Re(e).textContent=""}),500);function Te(e,t){var n=Re(t);e&&(n.textContent=e,Ke(t))}function Re(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 He=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}),Fe=["refKey","ref"],Ve=["onClick","onPress","onKeyDown","onKeyUp","onBlur"],Ae=["onKeyDown","onBlur","onChange","onInput","onChangeText"],Ne=["refKey","ref"],Be=["onMouseMove","onMouseDown","onClick","onPress","index","item"],Le=function(){var e=function(e){var u,s;function a(t){var r=e.call(this,t)||this;r.id=r.props.id||"downshift-"+xe(),r.menuId=r.props.menuId||r.id+"-menu",r.labelId=r.props.labelId||r.id+"-label",r.inputId=r.props.inputId||r.id+"-input",r.getItemId=r.props.getItemId||function(e){return r.id+"-item-"+e},r.input=null,r.items=[],r.itemCount=null,r.previousResultCount=0,r.timeoutIds=[],r.internalSetTimeout=function(e,t){var n=setTimeout((function(){r.timeoutIds=r.timeoutIds.filter((function(e){return e!==n})),e()}),t);r.timeoutIds.push(n)},r.setItemCount=function(e){r.itemCount=e},r.unsetItemCount=function(){r.itemCount=null},r.setHighlightedIndex=function(e,t){void 0===e&&(e=r.props.defaultHighlightedIndex),void 0===t&&(t={}),t=Ce(t),r.internalSetState(o({highlightedIndex:e},t))},r.clearSelection=function(e){r.internalSetState({selectedItem:null,inputValue:"",highlightedIndex:r.props.defaultHighlightedIndex,isOpen:r.props.defaultIsOpen},e)},r.selectItem=function(e,t,n){t=Ce(t),r.internalSetState(o({isOpen:r.props.defaultIsOpen,highlightedIndex:r.props.defaultHighlightedIndex,selectedItem:e,inputValue:r.props.itemToString(e)},t),n)},r.selectItemAtIndex=function(e,t,n){var o=r.items[e];null!=o&&r.selectItem(o,t,n)},r.selectHighlightedItem=function(e,t){return r.selectItemAtIndex(r.getState().highlightedIndex,e,t)},r.internalSetState=function(e,t){var n,i,u={},s="function"==typeof e;return!s&&e.hasOwnProperty("inputValue")&&r.props.onInputValueChange(e.inputValue,o({},r.getStateAndHelpers(),e)),r.setState((function(t){t=r.getState(t);var a=s?e(t):e;a=r.props.stateReducer(t,a),n=a.hasOwnProperty("selectedItem");var l={};return n&&a.selectedItem!==t.selectedItem&&(i=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],Oe(r.props,e)||(l[e]=a[e]))})),s&&a.hasOwnProperty("inputValue")&&r.props.onInputValueChange(a.inputValue,o({},r.getStateAndHelpers(),a)),l}),(function(){fe(t)(),Object.keys(u).length>1&&r.props.onStateChange(u,r.getStateAndHelpers()),n&&r.props.onSelect(e.selectedItem,r.getStateAndHelpers()),void 0!==i&&r.props.onChange(i,r.getStateAndHelpers()),r.props.onUserAction(u,r.getStateAndHelpers())}))},r.rootRef=function(e){return r._rootNode=e},r.getRootProps=function(e,t){var i,u=void 0===e?{}:e,s=u.refKey,a=void 0===s?"ref":s,l=u.ref,c=n(u,Fe),d=(void 0===t?{}:t).suppressRefError,p=void 0!==d&&d;r.getRootProps.called=!0,r.getRootProps.refKey=a,r.getRootProps.suppressRefError=p;var f=r.getState().isOpen;return o(((i={})[a]=ye(l,r.rootRef),i.role="combobox",i["aria-expanded"]=f,i["aria-haspopup"]="listbox",i["aria-owns"]=f?r.menuId:null,i["aria-labelledby"]=r.labelId,i),c)},r.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=De(1,t.getState().highlightedIndex,e,(function(e){return t.getItemNodeFromIndex(e)}));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=De(-1,t.getState().highlightedIndex,e,(function(e){return t.getItemNodeFromIndex(e)}));t.setHighlightedIndex(n,{type:3})}}))},Enter:function(e){if(229!==e.which){var t=this.getState(),n=t.isOpen,o=t.highlightedIndex;if(n&&null!=o){e.preventDefault();var i=this.items[o],r=this.getItemNodeFromIndex(o);if(null==i||r&&r.hasAttribute("disabled"))return;this.selectHighlightedItem({type:6})}}},Escape:function(e){e.preventDefault(),this.reset(o({type:5},!this.state.isOpen&&{selectedItem:null,inputValue:""}))}},r.buttonKeyDownHandlers=o({},r.keyDownHandlers,{" ":function(e){e.preventDefault(),this.toggleMenu({type:12})}}),r.inputKeyDownHandlers=o({},r.keyDownHandlers,{Home:function(e){var t=this,n=this.getState().isOpen;if(n){e.preventDefault();var o=this.getItemCount();if(!(o<=0)&&n){var i=Ee(1,0,o,(function(e){return t.getItemNodeFromIndex(e)}),!1);this.setHighlightedIndex(i,{type:7})}}},End:function(e){var t=this,n=this.getState().isOpen;if(n){e.preventDefault();var o=this.getItemCount();if(!(o<=0)&&n){var i=Ee(-1,o-1,o,(function(e){return t.getItemNodeFromIndex(e)}),!1);this.setHighlightedIndex(i,{type:8})}}}}),r.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=n(t,Ve),c=r.getState().isOpen,d={onClick:ve(i,r.buttonHandleClick),onKeyDown:ve(u,r.buttonHandleKeyDown),onKeyUp:ve(s,r.buttonHandleKeyUp),onBlur:ve(a,r.buttonHandleBlur)};return o({type:"button",role:"button","aria-label":c?"close menu":"open menu","aria-haspopup":!0,"data-toggle":!0},l.disabled?{}:d,l)},r.buttonHandleKeyUp=function(e){e.preventDefault()},r.buttonHandleKeyDown=function(e){var t=Me(e);r.buttonKeyDownHandlers[t]&&r.buttonKeyDownHandlers[t].call(i(r),e)},r.buttonHandleClick=function(e){e.preventDefault(),r.props.environment.document.activeElement===r.props.environment.document.body&&e.target.focus(),r.internalSetTimeout((function(){return r.toggleMenu({type:13})}))},r.buttonHandleBlur=function(e){var t=e.target;r.internalSetTimeout((function(){r.isMouseDown||null!=r.props.environment.document.activeElement&&r.props.environment.document.activeElement.id===r.inputId||r.props.environment.document.activeElement===t||r.reset({type:14})}))},r.getLabelProps=function(e){return o({htmlFor:r.inputId,id:r.labelId},e)},r.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=n(t,Ae),c={};var d,p=r.getState(),f=p.inputValue,g=p.isOpen,h=p.highlightedIndex;l.disabled||((d={}).onChange=ve(s,a,r.inputHandleChange),d.onKeyDown=ve(i,r.inputHandleKeyDown),d.onBlur=ve(u,r.inputHandleBlur),c=d);return o({"aria-autocomplete":"list","aria-activedescendant":g&&"number"==typeof h&&h>=0?r.getItemId(h):null,"aria-controls":g?r.menuId:null,"aria-labelledby":r.labelId,autoComplete:"off",value:f,id:r.inputId},c,l)},r.inputHandleKeyDown=function(e){var t=Me(e);t&&r.inputKeyDownHandlers[t]&&r.inputKeyDownHandlers[t].call(i(r),e)},r.inputHandleChange=function(e){r.internalSetState({type:11,isOpen:!0,inputValue:e.target.value,highlightedIndex:r.props.defaultHighlightedIndex})},r.inputHandleBlur=function(){r.internalSetTimeout((function(){var e=r.props.environment.document&&!!r.props.environment.document.activeElement&&!!r.props.environment.document.activeElement.dataset&&r.props.environment.document.activeElement.dataset.toggle&&r._rootNode&&r._rootNode.contains(r.props.environment.document.activeElement);r.isMouseDown||e||r.reset({type:10})}))},r.menuRef=function(e){r._menuNode=e},r.getMenuProps=function(e,t){var i,u=void 0===e?{}:e,s=u.refKey,a=void 0===s?"ref":s,l=u.ref,c=n(u,Ne),d=(void 0===t?{}:t).suppressRefError,p=void 0!==d&&d;return r.getMenuProps.called=!0,r.getMenuProps.refKey=a,r.getMenuProps.suppressRefError=p,o(((i={})[a]=ye(l,r.menuRef),i.role="listbox",i["aria-labelledby"]=c&&c["aria-label"]?null:r.labelId,i.id=r.menuId,i),c)},r.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=n(i,Be);void 0===l?(r.items.push(d),l=r.items.indexOf(d)):r.items[l]=d;var f=a,g=((t={onMouseMove:ve(u,(function(){l!==r.getState().highlightedIndex&&(r.setHighlightedIndex(l,{type:2}),r.avoidScrolling=!0,r.internalSetTimeout((function(){return r.avoidScrolling=!1}),250))})),onMouseDown:ve(s,(function(e){e.preventDefault()}))}).onClick=ve(f,(function(){r.selectItemAtIndex(l,{type:9})})),t),h=p.disabled?{onMouseDown:g.onMouseDown}:g;return o({id:r.getItemId(l),role:"option","aria-selected":r.getState().highlightedIndex===l},h,p)},r.clearItems=function(){r.items=[]},r.reset=function(e,t){void 0===e&&(e={}),e=Ce(e),r.internalSetState((function(t){var n=t.selectedItem;return o({isOpen:r.props.defaultIsOpen,highlightedIndex:r.props.defaultHighlightedIndex,inputValue:r.props.itemToString(n)},e)}),t)},r.toggleMenu=function(e,t){void 0===e&&(e={}),e=Ce(e),r.internalSetState((function(t){var n=t.isOpen;return o({isOpen:!n},n&&{highlightedIndex:r.props.defaultHighlightedIndex},e)}),(function(){var n=r.getState(),o=n.isOpen,i=n.highlightedIndex;o&&r.getItemCount()>0&&"number"==typeof i&&r.setHighlightedIndex(i,e),fe(t)()}))},r.openMenu=function(e){r.internalSetState({isOpen:!0},e)},r.closeMenu=function(e){r.internalSetState({isOpen:!1},e)},r.updateStatus=Ie((function(){var e=r.getState(),t=r.items[e.highlightedIndex],n=r.getItemCount(),i=r.props.getA11yStatusMessage(o({itemToString:r.props.itemToString,previousResultCount:r.previousResultCount,resultCount:n,highlightedItem:t},e));r.previousResultCount=n,Te(i,r.props.environment.document)}),200);var u=r.props,s=u.defaultHighlightedIndex,a=u.initialHighlightedIndex,l=void 0===a?s:a,c=u.defaultIsOpen,d=u.initialIsOpen,p=void 0===d?c:d,f=u.initialInputValue,g=void 0===f?"":f,h=u.initialSelectedItem,m=void 0===h?null:h,I=r.getState({highlightedIndex:l,isOpen:p,inputValue:g,selectedItem:m});return null!=I.selectedItem&&void 0===r.props.initialInputValue&&(I.inputValue=r.props.itemToString(I.selectedItem)),r.state=I,r}s=e,(u=a).prototype=Object.create(s.prototype),u.prototype.constructor=u,r(u,s);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),ke(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,o=this.getItemCount(),i=this.getState().highlightedIndex;if(o>0){var r=De(e,i,o,(function(e){return n.getItemNodeFromIndex(e)}));this.setHighlightedIndex(r,t)}},l.getStateAndHelpers=function(){var e=this.getState(),t=e.highlightedIndex,n=e.inputValue,o=e.selectedItem,i=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,x=this.clearSelection,b=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:x,clearItems:b,setItemCount:this.setItemCount,unsetItemCount:this.unsetItemCount,setState:this.internalSetState,itemToString:r,id:u,highlightedIndex:t,inputValue:n,isOpen:i,selectedItem:o}},l.componentDidMount=function(){var e=this,t=function(){e.isMouseDown=!0},n=function(t){e.isMouseDown=!1,!Pe(t.target,[e._rootNode,e._menuNode],e.props.environment)&&e.getState().isOpen&&e.reset({type:1},(function(){return e.props.onOuterClick(e.getStateAndHelpers())}))},o=function(){e.isTouchMove=!1},i=function(){e.isTouchMove=!0},r=function(t){var n=Pe(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",o),u.addEventListener("touchmove",i),u.addEventListener("touchend",r),this.cleanup=function(){e.internalClearTimeouts(),e.updateStatus.cancel(),u.removeEventListener("mousedown",t),u.removeEventListener("mouseup",n),u.removeEventListener("touchstart",o),u.removeEventListener("touchmove",i),u.removeEventListener("touchend",r)}},l.shouldScroll=function(e,t){var n=(void 0===this.props.highlightedIndex?this.getState():this.props).highlightedIndex,o=(void 0===t.highlightedIndex?e:t).highlightedIndex;return n&&this.getState().isOpen&&!e.isOpen||n!==o},l.componentDidUpdate=function(e,t){Oe(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=we(this.props.children,ge);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=we(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:be,itemToString:function(e){return null==e?"":String(e)},onStateChange:ge,onInputValueChange:ge,onUserAction:ge,onChange:ge,onSelect:ge,onOuterClick:ge,selectedItemChanged:function(e,t){return e!==t},environment:"undefined"==typeof window?{}:window,stateReducer:function(e,t){return t},suppressRefError:!1,scrollIntoView:he},e.stateChangeTypes=He,e}(),_e=Le,$e=["isInitialMount","highlightedIndex","items","environment"],je={highlightedIndex:-1,isOpen:!1,selectedItem:null,inputValue:""};function Ue(e,t,n){var i=e.props,r=e.type,u={};Object.keys(t).forEach((function(i){!function(e,t,n,i){var r=t.props,u=t.type,s="on"+Xe(e)+"Change";r[s]&&void 0!==i[e]&&i[e]!==n[e]&&r[s](o({type:u},i))}(i,e,t,n),n[i]!==t[i]&&(u[i]=n[i])})),i.onStateChange&&Object.keys(u).length&&i.onStateChange(o({type:r},u))}var We=Ie((function(e,t){Te(e(),t)}),200),ze="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement?t.useLayoutEffect:t.useEffect;function qe(e){var n=e.id,o=void 0===n?"downshift-"+xe():n,i=e.labelId,r=e.menuId,u=e.getItemId,s=e.toggleButtonId,a=e.inputId;return t.useRef({labelId:i||o+"-label",menuId:r||o+"-menu",getItemId:u||function(e){return o+"-item-"+e},toggleButtonId:s||o+"-toggle-button",inputId:a||o+"-input"}).current}function Ye(e,t,n){return void 0!==e?e:0===n.length?-1:n.indexOf(t)}function Xe(e){return""+e.slice(0,1).toUpperCase()+e.slice(1)}function Ge(e){var n=t.useRef(e);return n.current=e,n}function Je(e,n,i){var r=t.useRef(),u=t.useRef(),s=t.useCallback((function(t,n){u.current=n,t=ke(t,n.props);var i=e(t,n);return n.props.stateReducer(t,o({},n,{changes:i}))}),[e]),a=t.useReducer(s,n),l=a[0],c=a[1],d=Ge(i),p=t.useCallback((function(e){return c(o({props:d.current},e))}),[d]),f=u.current;return t.useEffect((function(){f&&r.current&&r.current!==l&&Ue(f,ke(r.current,f.props),l),r.current=l}),[l,i,f]),[l,p]}function Qe(e,t,n){var o=Je(e,t,n),i=o[0],r=o[1];return[ke(i,n),r]}var Ze={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:he,environment:"undefined"==typeof window?{}:window};function et(e,t,n){void 0===n&&(n=je);var o=e["default"+Xe(t)];return void 0!==o?o:n[t]}function tt(e,t,n){void 0===n&&(n=je);var o=e[t];if(void 0!==o)return o;var i=e["initial"+Xe(t)];return void 0!==i?i:et(e,t,n)}function nt(e){var t=tt(e,"selectedItem"),n=tt(e,"isOpen"),o=tt(e,"highlightedIndex"),i=tt(e,"inputValue");return{highlightedIndex:o<0&&t&&n?e.items.indexOf(t):o,isOpen:n,selectedItem:t,inputValue:i}}function ot(e,t,n){var o=e.items,i=e.initialHighlightedIndex,r=e.defaultHighlightedIndex,u=t.selectedItem,s=t.highlightedIndex;return 0===o.length?-1:void 0!==i&&s===i?i:void 0!==r?r:u?o.indexOf(u):0===n?-1:n<0?o.length-1:0}function it(e,n,o,i){var r=t.useRef({isMouseDown:!1,isTouchMove:!1});return t.useEffect((function(){var t=function(){r.current.isMouseDown=!0},u=function(t){r.current.isMouseDown=!1,e&&!Pe(t.target,n.map((function(e){return e.current})),o)&&i()},s=function(){r.current.isTouchMove=!1},a=function(){r.current.isTouchMove=!0},l=function(t){!e||r.current.isTouchMove||Pe(t.target,n.map((function(e){return e.current})),o,!1)||i()};return o.addEventListener("mousedown",t),o.addEventListener("mouseup",u),o.addEventListener("touchstart",s),o.addEventListener("touchmove",a),o.addEventListener("touchend",l),function(){o.removeEventListener("mousedown",t),o.removeEventListener("mouseup",u),o.removeEventListener("touchstart",s),o.removeEventListener("touchmove",a),o.removeEventListener("touchend",l)}}),[e,o]),r}var rt=function(){return ge};function ut(e,i,r){var u=r.isInitialMount,s=r.highlightedIndex,a=r.items,l=r.environment,c=n(r,$e);t.useEffect((function(){u||We((function(){return e(o({highlightedIndex:s,highlightedItem:a[s],resultCount:a.length},c))}),l.document)}),i)}function st(e){var n=e.highlightedIndex,o=e.isOpen,i=e.itemRefs,r=e.getItemNodeFromIndex,u=e.menuElement,s=e.scrollIntoView,a=t.useRef(!0);return ze((function(){n<0||!o||!Object.keys(i.current).length||(!1===a.current?a.current=!0:s(r(n),u))}),[n]),a}var at=ge;function lt(e,t,n){var i,r=t.type,u=t.props;switch(r){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:ot(u,e,0)};break;case n.FunctionOpenMenu:i={isOpen:!0,highlightedIndex:ot(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:et(u,"highlightedIndex"),isOpen:et(u,"isOpen"),selectedItem:et(u,"selectedItem"),inputValue:et(u,"inputValue")};break;default:throw new Error("Reducer called without proper action type.")}return o({},e,i)}var ct=function(){return ct=Object.assign||function(e){for(var t,n=1,o=arguments.length;n<o;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e},ct.apply(this,arguments)};K.array.isRequired,K.func,K.func,K.func,K.number,K.number,K.number,K.bool,K.bool,K.bool,K.any,K.any,K.any,K.string,K.string,K.string,K.func,K.string,K.func,K.func,K.func,K.func,K.func,K.shape({addEventListener:K.func,removeEventListener:K.func,document:K.shape({getElementById:K.func,activeElement:K.any,body:K.any})});var dt=ct(ct({},Ze),{getA11yStatusMessage:function(e){var t=e.isOpen,n=e.resultCount,o=e.previousResultCount;return t?n?n!==o?"".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.":""}}),pt=ge,ft=Object.freeze({__proto__:null,ToggleButtonClick:0,ToggleButtonKeyDownArrowDown:1,ToggleButtonKeyDownArrowUp:2,ToggleButtonKeyDownCharacter:3,ToggleButtonKeyDownEscape:4,ToggleButtonKeyDownHome:5,ToggleButtonKeyDownEnd:6,ToggleButtonKeyDownEnter:7,ToggleButtonKeyDownSpaceButton:8,ToggleButtonKeyDownPageUp:9,ToggleButtonKeyDownPageDown:10,ToggleButtonBlur:11,MenuMouseLeave:12,ItemMouseMove:13,ItemClick:14,FunctionToggleMenu:15,FunctionOpenMenu:16,FunctionCloseMenu:17,FunctionSetHighlightedIndex:18,FunctionSelectItem:19,FunctionSetInputValue:20,FunctionReset:21});function gt(e,t){var n,i=t.type,r=t.props,u=t.altKey;switch(i){case 14:n={isOpen:et(r,"isOpen"),highlightedIndex:et(r,"highlightedIndex"),selectedItem:r.items[t.index]};break;case 3:var s=t.key,a=""+e.inputValue+s,l=function(e){for(var t=e.keysSoFar,n=e.highlightedIndex,o=e.items,i=e.itemToString,r=e.getItemNodeFromIndex,u=t.toLowerCase(),s=0;s<o.length;s++){var a=(s+n+(t.length<2?1:0))%o.length,l=o[a];if(void 0!==l&&i(l).toLowerCase().startsWith(u)){var c=r(a);if(!(null==c?void 0:c.hasAttribute("disabled")))return a}}return n}({keysSoFar:a,highlightedIndex:!e.isOpen&&e.selectedItem?r.items.indexOf(e.selectedItem):e.highlightedIndex,items:r.items,itemToString:r.itemToString,getItemNodeFromIndex:t.getItemNodeFromIndex});n={inputValue:a,highlightedIndex:l,isOpen:!0};break;case 1:n={highlightedIndex:e.isOpen?De(1,e.highlightedIndex,r.items.length,t.getItemNodeFromIndex,!1):u&&null==e.selectedItem?-1:ot(r,e,1),isOpen:!0};break;case 2:if(e.isOpen&&u)n=o({isOpen:et(r,"isOpen"),highlightedIndex:et(r,"highlightedIndex")},e.highlightedIndex>=0&&{selectedItem:r.items[e.highlightedIndex]});else n={highlightedIndex:e.isOpen?De(-1,e.highlightedIndex,r.items.length,t.getItemNodeFromIndex,!1):ot(r,e,-1),isOpen:!0};break;case 7:case 8:n=o({isOpen:et(r,"isOpen"),highlightedIndex:et(r,"highlightedIndex")},e.highlightedIndex>=0&&{selectedItem:r.items[e.highlightedIndex]});break;case 5:n={highlightedIndex:Ee(1,0,r.items.length,t.getItemNodeFromIndex,!1),isOpen:!0};break;case 6:n={highlightedIndex:Ee(-1,r.items.length-1,r.items.length,t.getItemNodeFromIndex,!1),isOpen:!0};break;case 9:n={highlightedIndex:De(-10,e.highlightedIndex,r.items.length,t.getItemNodeFromIndex,!1)};break;case 10:n={highlightedIndex:De(10,e.highlightedIndex,r.items.length,t.getItemNodeFromIndex,!1)};break;case 4:n={isOpen:!1,highlightedIndex:-1};break;case 11:n=o({isOpen:!1,highlightedIndex:-1},e.highlightedIndex>=0&&{selectedItem:r.items[e.highlightedIndex]});break;case 19:n={selectedItem:t.selectedItem};break;default:return lt(e,t,ft)}return o({},e,n)}var ht=["onMouseLeave","refKey","onKeyDown","onBlur","ref"],mt=["onBlur","onClick","onKeyDown","refKey","ref"],It=["item","index","onMouseMove","onClick","refKey","ref","disabled"];function vt(e){void 0===e&&(e={}),pt();var i=o({},dt,e),r=i.items,u=i.scrollIntoView,s=i.environment,a=i.itemToString,l=i.getA11ySelectionMessage,c=i.getA11yStatusMessage,d=Qe(gt,nt(i),i),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),x=t.useRef({}),b=t.useRef(null),w=qe(i),S=t.useRef(),C=t.useRef(!0),k=Ge({state:p,props:i}),O=t.useCallback((function(e){return x.current[w.getItemId(e)]}),[w]);ut(c,[g,h,I,r],o({isInitialMount:C.current,previousResultCount:S.current,items:r,environment:s,itemToString:a},p)),ut(l,[m],o({isInitialMount:C.current,previousResultCount:S.current,items:r,environment:s,itemToString:a},p));var M=st({menuElement:y.current,highlightedIndex:h,isOpen:g,itemRefs:x,scrollIntoView:u,getItemNodeFromIndex:O});t.useEffect((function(){return b.current=Ie((function(e){e({type:20,inputValue:""})}),500),function(){b.current.cancel()}}),[]),t.useEffect((function(){I&&b.current(f)}),[f,I]),at({isInitialMount:C.current,props:i,state:p}),t.useEffect((function(){C.current||(S.current=r.length)}));var D=it(g,[y,v],s,(function(){f({type:11})})),E=rt();t.useEffect((function(){return C.current=!1,function(){C.current=!0}}),[]),t.useEffect((function(){g||(x.current={})}),[g]);var P=t.useMemo((function(){return{ArrowDown:function(e){e.preventDefault(),f({type:1,getItemNodeFromIndex:O,altKey:e.altKey})},ArrowUp:function(e){e.preventDefault(),f({type:2,getItemNodeFromIndex:O,altKey:e.altKey})},Home:function(e){e.preventDefault(),f({type:5,getItemNodeFromIndex:O})},End:function(e){e.preventDefault(),f({type:6,getItemNodeFromIndex:O})},Escape:function(){k.current.state.isOpen&&f({type:4})},Enter:function(e){e.preventDefault(),f({type:k.current.state.isOpen?7:0})},PageUp:function(e){k.current.state.isOpen&&(e.preventDefault(),f({type:9,getItemNodeFromIndex:O}))},PageDown:function(e){k.current.state.isOpen&&(e.preventDefault(),f({type:10,getItemNodeFromIndex:O}))}," ":function(e){e.preventDefault();var t=k.current.state;t.isOpen?t.inputValue?f({type:3,key:" ",getItemNodeFromIndex:O}):f({type:8}):f({type:0})}}}),[f,O,k]),K=t.useCallback((function(){f({type:15})}),[f]),T=t.useCallback((function(){f({type:17})}),[f]),R=t.useCallback((function(){f({type:16})}),[f]),H=t.useCallback((function(e){f({type:18,highlightedIndex:e})}),[f]),F=t.useCallback((function(e){f({type:19,selectedItem:e})}),[f]),V=t.useCallback((function(){f({type:21})}),[f]),A=t.useCallback((function(e){f({type:20,inputValue:e})}),[f]),N=t.useCallback((function(e){return o({id:w.labelId,htmlFor:w.toggleButtonId},e)}),[w]),B=t.useCallback((function(e,t){var i,r=void 0===e?{}:e,u=r.onMouseLeave,s=r.refKey,a=void 0===s?"ref":s;r.onKeyDown,r.onBlur;var l=r.ref,c=n(r,ht),d=(void 0===t?{}:t).suppressRefError;return E("getMenuProps",void 0!==d&&d,a,y),o(((i={})[a]=ye(l,(function(e){y.current=e})),i.id=w.menuId,i.role="listbox",i["aria-labelledby"]=w.labelId,i.tabIndex=-1,i.onMouseLeave=ve(u,(function(){f({type:12})})),i),c)}),[f,E,w]);return{getToggleButtonProps:t.useCallback((function(e,t){var i,r=void 0===e?{}:e,u=r.onBlur,s=r.onClick,a=r.onKeyDown,l=r.refKey,c=void 0===l?"ref":l,d=r.ref,p=n(r,mt),g=(void 0===t?{}:t).suppressRefError,h=void 0!==g&&g,m=k.current.state,I=o(((i={})[c]=ye(d,(function(e){v.current=e})),i["aria-activedescendant"]=m.isOpen&&m.highlightedIndex>-1?w.getItemId(m.highlightedIndex):"",i["aria-controls"]=w.menuId,i["aria-expanded"]=k.current.state.isOpen,i["aria-haspopup"]="listbox",i["aria-labelledby"]=""+w.labelId,i.id=w.toggleButtonId,i.role="combobox",i.tabIndex=0,i.onBlur=ve(u,(function(){m.isOpen&&!D.current.isMouseDown&&f({type:11})})),i),p);return p.disabled||(I.onClick=ve(s,(function(){f({type:0})})),I.onKeyDown=ve(a,(function(e){var t=Me(e);t&&P[t]?P[t](e):function(e){return/^\S{1}$/.test(e)}(t)&&f({type:3,key:t,getItemNodeFromIndex:O})}))),E("getToggleButtonProps",h,c,v),I}),[k,w,E,f,D,P,O]),getLabelProps:N,getMenuProps:B,getItemProps:t.useCallback((function(e){var t,i=void 0===e?{}:e,u=i.item,s=i.index,a=i.onMouseMove,l=i.onClick,c=i.refKey,d=void 0===c?"ref":c,p=i.ref,g=i.disabled,h=n(i,It),I=k.current,v=I.state,y=I.props,b=null!=u?u:r[s],S=Ye(s,b,y.items),C=Ye(S,b,y.items);if(C<0)throw new Error("Pass either item or item index in getItemProps!");var O=o(((t={disabled:g,role:"option","aria-selected":""+(b===m),id:w.getItemId(C)})[d]=ye(p,(function(e){e&&(x.current[w.getItemId(C)]=e)})),t),h);return g||(O.onClick=ve(l,(function(){f({type:14,index:S})}))),O.onMouseMove=ve(a,(function(){S!==v.highlightedIndex&&(M.current=!1,f({type:13,index:S,disabled:g}))})),O}),[k,r,m,w,M,f]),toggleMenu:K,openMenu:R,closeMenu:T,setHighlightedIndex:H,selectItem:F,reset:V,setInputValue:A,highlightedIndex:h,isOpen:g,selectedItem:m,inputValue:I}}vt.stateChangeTypes=ft;var yt=Object.freeze({__proto__:null,InputKeyDownArrowDown:0,InputKeyDownArrowUp:1,InputKeyDownEscape:2,InputKeyDownHome:3,InputKeyDownEnd:4,InputKeyDownPageUp:5,InputKeyDownPageDown:6,InputKeyDownEnter:7,InputChange:8,InputBlur:9,InputFocus:10,MenuMouseLeave:11,ItemMouseMove:12,ItemClick:13,ToggleButtonClick:14,FunctionToggleMenu:15,FunctionOpenMenu:16,FunctionCloseMenu:17,FunctionSetHighlightedIndex:18,FunctionSelectItem:19,FunctionSetInputValue:20,FunctionReset:21,ControlledPropUpdatedSelectedItem:22});K.array.isRequired,K.func,K.func,K.func,K.number,K.number,K.number,K.bool,K.bool,K.bool,K.any,K.any,K.any,K.string,K.string,K.string,K.string,K.string,K.string,K.func,K.string,K.string,K.func,K.func,K.func,K.func,K.func,K.func,K.shape({addEventListener:K.func,removeEventListener:K.func,document:K.shape({getElementById:K.func,activeElement:K.any,body:K.any})});var xt=ge,bt=o({},Ze,{getA11yStatusMessage:be});function wt(e,t){var n,i=t.type,r=t.props,u=t.altKey;switch(i){case 13:n={isOpen:et(r,"isOpen"),highlightedIndex:et(r,"highlightedIndex"),selectedItem:r.items[t.index],inputValue:r.itemToString(r.items[t.index])};break;case 0:n=e.isOpen?{highlightedIndex:De(1,e.highlightedIndex,r.items.length,t.getItemNodeFromIndex,!0)}:{highlightedIndex:u&&null==e.selectedItem?-1:ot(r,e,1,t.getItemNodeFromIndex),isOpen:r.items.length>=0};break;case 1:n=e.isOpen?u?o({isOpen:et(r,"isOpen"),highlightedIndex:et(r,"highlightedIndex")},e.highlightedIndex>=0&&{selectedItem:r.items[e.highlightedIndex],inputValue:r.itemToString(r.items[e.highlightedIndex])}):{highlightedIndex:De(-1,e.highlightedIndex,r.items.length,t.getItemNodeFromIndex,!0)}:{highlightedIndex:ot(r,e,-1,t.getItemNodeFromIndex),isOpen:r.items.length>=0};break;case 7:n=o({isOpen:et(r,"isOpen"),highlightedIndex:et(r,"highlightedIndex")},e.highlightedIndex>=0&&{selectedItem:r.items[e.highlightedIndex],inputValue:r.itemToString(r.items[e.highlightedIndex])});break;case 2:n=o({isOpen:!1,highlightedIndex:-1},!e.isOpen&&{selectedItem:null,inputValue:""});break;case 5:n={highlightedIndex:De(-10,e.highlightedIndex,r.items.length,t.getItemNodeFromIndex,!1)};break;case 6:n={highlightedIndex:De(10,e.highlightedIndex,r.items.length,t.getItemNodeFromIndex,!1)};break;case 3:n={highlightedIndex:Ee(1,0,r.items.length,t.getItemNodeFromIndex,!1)};break;case 4:n={highlightedIndex:Ee(-1,r.items.length-1,r.items.length,t.getItemNodeFromIndex,!1)};break;case 9:n=o({isOpen:!1,highlightedIndex:-1},e.highlightedIndex>=0&&t.selectItem&&{selectedItem:r.items[e.highlightedIndex],inputValue:r.itemToString(r.items[e.highlightedIndex])});break;case 8:n={isOpen:!0,highlightedIndex:et(r,"highlightedIndex"),inputValue:t.inputValue};break;case 10:n={isOpen:!0,highlightedIndex:ot(r,e,0)};break;case 19:n={selectedItem:t.selectedItem,inputValue:r.itemToString(t.selectedItem)};break;case 22:n={inputValue:t.inputValue};break;default:return lt(e,t,yt)}return o({},e,n)}var St=["onMouseLeave","refKey","ref"],Ct=["item","index","refKey","ref","onMouseMove","onMouseDown","onClick","onPress","disabled"],kt=["onClick","onPress","refKey","ref"],Ot=["onKeyDown","onChange","onInput","onFocus","onBlur","onChangeText","refKey","ref"];function Mt(e){void 0===e&&(e={}),xt();var i=o({},bt,e),r=i.initialIsOpen,u=i.defaultIsOpen,s=i.items,a=i.scrollIntoView,l=i.environment,c=i.getA11yStatusMessage,d=i.getA11ySelectionMessage,p=i.itemToString,f=function(e){var t=nt(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)),o({},t,{inputValue:i})}(i),g=function(e,n,o){var i=t.useRef(),r=Je(e,n,o),u=r[0],s=r[1];return t.useEffect((function(){Oe(o,"selectedItem")&&(i.current!==o.selectedItem&&s({type:22,inputValue:o.itemToString(o.selectedItem)}),i.current=u.selectedItem===i.current?o.selectedItem:u.selectedItem)})),[ke(u,o),s]}(wt,f,i),h=g[0],m=g[1],I=h.isOpen,v=h.highlightedIndex,y=h.selectedItem,x=h.inputValue,b=t.useRef(null),w=t.useRef({}),S=t.useRef(null),C=t.useRef(null),k=t.useRef(!0),O=qe(i),M=t.useRef(),D=Ge({state:h,props:i}),E=t.useCallback((function(e){return w.current[O.getItemId(e)]}),[O]);ut(c,[I,v,x,s],o({isInitialMount:k.current,previousResultCount:M.current,items:s,environment:l,itemToString:p},h)),ut(d,[y],o({isInitialMount:k.current,previousResultCount:M.current,items:s,environment:l,itemToString:p},h));var P=st({menuElement:b.current,highlightedIndex:v,isOpen:I,itemRefs:w,scrollIntoView:a,getItemNodeFromIndex:E});at({isInitialMount:k.current,props:i,state:h}),t.useEffect((function(){(r||u||I)&&S.current&&S.current.focus()}),[]),t.useEffect((function(){k.current||(M.current=s.length)}));var K=it(I,[S,b,C],l,(function(){m({type:9,selectItem:!1})})),T=rt();t.useEffect((function(){return k.current=!1,function(){k.current=!0}}),[]),t.useEffect((function(){if(I){if(document.activeElement!==S.current){var e;null==S||null==(e=S.current)||e.focus()}}else w.current={}}),[I]);var R=t.useMemo((function(){return{ArrowDown:function(e){e.preventDefault(),m({type:0,altKey:e.altKey,getItemNodeFromIndex:E})},ArrowUp:function(e){e.preventDefault(),m({type:1,altKey:e.altKey,getItemNodeFromIndex:E})},Home:function(e){D.current.state.isOpen&&(e.preventDefault(),m({type:3,getItemNodeFromIndex:E}))},End:function(e){D.current.state.isOpen&&(e.preventDefault(),m({type:4,getItemNodeFromIndex:E}))},Escape:function(e){var t=D.current.state;(t.isOpen||t.inputValue||t.selectedItem||t.highlightedIndex>-1)&&(e.preventDefault(),m({type:2}))},Enter:function(e){D.current.state.isOpen&&229!==e.which&&(e.preventDefault(),m({type:7,getItemNodeFromIndex:E}))},PageUp:function(e){D.current.state.isOpen&&(e.preventDefault(),m({type:5,getItemNodeFromIndex:E}))},PageDown:function(e){D.current.state.isOpen&&(e.preventDefault(),m({type:6,getItemNodeFromIndex:E}))}}}),[m,D,E]),H=t.useCallback((function(e){return o({id:O.labelId,htmlFor:O.inputId},e)}),[O]),F=t.useCallback((function(e,t){var i,r=void 0===e?{}:e,u=r.onMouseLeave,s=r.refKey,a=void 0===s?"ref":s,l=r.ref,c=n(r,St),d=(void 0===t?{}:t).suppressRefError;return T("getMenuProps",void 0!==d&&d,a,b),o(((i={})[a]=ye(l,(function(e){b.current=e})),i.id=O.menuId,i.role="listbox",i["aria-labelledby"]=O.labelId,i.onMouseLeave=ve(u,(function(){m({type:11})})),i),c)}),[m,T,O]),V=t.useCallback((function(e){var t,i,r=void 0===e?{}:e,u=r.item,s=r.index,a=r.refKey,l=void 0===a?"ref":a,c=r.ref,d=r.onMouseMove,p=r.onMouseDown,f=r.onClick;r.onPress;var g=r.disabled,h=n(r,Ct),I=D.current,v=I.props,y=I.state,x=Ye(s,u,v.items);if(x<0)throw new Error("Pass either item or item index in getItemProps!");var b=f;return o(((t={})[l]=ye(c,(function(e){e&&(w.current[O.getItemId(x)]=e)})),t.disabled=g,t.role="option",t["aria-selected"]=""+(x===y.highlightedIndex),t.id=O.getItemId(x),t),!g&&((i={}).onClick=ve(b,(function(){m({type:13,index:s})})),i),{onMouseMove:ve(d,(function(){s!==y.highlightedIndex&&(P.current=!1,m({type:12,index:s,disabled:g}))})),onMouseDown:ve(p,(function(e){return e.preventDefault()}))},h)}),[m,D,P,O]),A=t.useCallback((function(e){var t,i=void 0===e?{}:e,r=i.onClick;i.onPress;var u=i.refKey,s=void 0===u?"ref":u,a=i.ref,l=n(i,kt),c=D.current.state;return o(((t={})[s]=ye(a,(function(e){C.current=e})),t["aria-controls"]=O.menuId,t["aria-expanded"]=c.isOpen,t.id=O.toggleButtonId,t.tabIndex=-1,t),!l.disabled&&o({},{onClick:ve(r,(function(){m({type:14})}))}),l)}),[m,D,O]),N=t.useCallback((function(e,t){var i,r=void 0===e?{}:e,u=r.onKeyDown,s=r.onChange,a=r.onInput,l=r.onFocus,c=r.onBlur;r.onChangeText;var d=r.refKey,p=void 0===d?"ref":d,f=r.ref,g=n(r,Ot),h=(void 0===t?{}:t).suppressRefError;T("getInputProps",void 0!==h&&h,p,S);var I,v=D.current.state,y={};g.disabled||((I={}).onChange=ve(s,a,(function(e){m({type:8,inputValue:e.target.value})})),I.onKeyDown=ve(u,(function(e){var t=Me(e);t&&R[t]&&R[t](e)})),I.onBlur=ve(c,(function(){v.isOpen&&!K.current.isMouseDown&&m({type:9,selectItem:!0})})),I.onFocus=ve(l,(function(){v.isOpen||m({type:10})})),y=I);return o(((i={})[p]=ye(f,(function(e){S.current=e})),i["aria-activedescendant"]=v.isOpen&&v.highlightedIndex>-1?O.getItemId(v.highlightedIndex):"",i["aria-autocomplete"]="list",i["aria-controls"]=O.menuId,i["aria-expanded"]=v.isOpen,i["aria-labelledby"]=O.labelId,i.autoComplete="off",i.id=O.inputId,i.role="combobox",i.value=v.inputValue,i),y,g)}),[m,R,D,K,T,O]),B=t.useCallback((function(){m({type:15})}),[m]),L=t.useCallback((function(){m({type:17})}),[m]),_=t.useCallback((function(){m({type:16})}),[m]),$=t.useCallback((function(e){m({type:18,highlightedIndex:e})}),[m]),j=t.useCallback((function(e){m({type:19,selectedItem:e})}),[m]);return{getItemProps:V,getLabelProps:H,getMenuProps:F,getInputProps:N,getToggleButtonProps:A,toggleMenu:B,openMenu:_,closeMenu:L,setHighlightedIndex:$,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:x}}Mt.stateChangeTypes=yt;var Dt={activeIndex:-1,selectedItems:[]};function Et(e,t){return tt(e,t,Dt)}function Pt(e,t){return et(e,t,Dt)}function Kt(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}K.array,K.array,K.array,K.func,K.func,K.func,K.number,K.number,K.number,K.func,K.func,K.string,K.string,K.shape({addEventListener:K.func,removeEventListener:K.func,document:K.shape({getElementById:K.func,activeElement:K.any,body:K.any})});var Tt={itemToString:Ze.itemToString,stateReducer:Ze.stateReducer,environment:Ze.environment,getA11yRemovalMessage:function(e){var t=e.removedSelectedItem;return(0,e.itemToString)(t)+" has been removed."},keyNavigationNext:"ArrowRight",keyNavigationPrevious:"ArrowLeft"},Rt=ge,Ht=Object.freeze({__proto__:null,SelectedItemClick:0,SelectedItemKeyDownDelete:1,SelectedItemKeyDownBackspace:2,SelectedItemKeyDownNavigationNext:3,SelectedItemKeyDownNavigationPrevious:4,DropdownKeyDownNavigationPrevious:5,DropdownKeyDownBackspace:6,DropdownClick:7,FunctionAddSelectedItem:8,FunctionRemoveSelectedItem:9,FunctionSetSelectedItems:10,FunctionSetActiveIndex:11,FunctionReset:12});function Ft(e,t){var n,i=t.type,r=t.index,u=t.props,s=t.selectedItem,a=e.activeIndex,l=e.selectedItems;switch(i){case 0:n={activeIndex:r};break;case 4:n={activeIndex:a-1<0?0:a-1};break;case 3:n={activeIndex:a+1>=l.length?-1:a+1};break;case 2:case 1:if(a<0)break;var c=a;1===l.length?c=-1:a===l.length-1&&(c=l.length-2),n=o({selectedItems:[].concat(l.slice(0,a),l.slice(a+1))},{activeIndex:c});break;case 5:n={activeIndex:l.length-1};break;case 6:n={selectedItems:l.slice(0,l.length-1)};break;case 8:n={selectedItems:[].concat(l,[s])};break;case 7:n={activeIndex:-1};break;case 9: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 10:n={selectedItems:t.selectedItems};break;case 11:n={activeIndex:t.activeIndex};break;case 12:n={activeIndex:Pt(u,"activeIndex"),selectedItems:Pt(u,"selectedItems")};break;default:throw new Error("Reducer called without proper action type.")}return o({},e,n)}var Vt=["refKey","ref","onClick","onKeyDown","selectedItem","index"],At=["refKey","ref","onKeyDown","onClick","preventKeyAction"];function Nt(e){void 0===e&&(e={}),Rt();var i=o({},Tt,e),r=i.getA11yRemovalMessage,u=i.itemToString,s=i.environment,a=i.keyNavigationNext,l=i.keyNavigationPrevious,c=Qe(Ft,function(e){return{activeIndex:Et(e,"activeIndex"),selectedItems:Et(e,"selectedItems")}}(i),i),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=Ge({state:d,props:i});t.useEffect((function(){if(!h.current){if(g.length<I.current.length){var e=I.current.find((function(e){return g.indexOf(e)<0}));Te(r({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]),at({isInitialMount:h.current,props:i,state:d});var x=rt();t.useEffect((function(){return h.current=!1,function(){h.current=!0}}),[]);var b=t.useMemo((function(){var e;return(e={})[l]=function(){p({type:4})},e[a]=function(){p({type:3})},e.Delete=function(){p({type:1})},e.Backspace=function(){p({type:2})},e}),[p,a,l]),w=t.useMemo((function(){var e;return(e={})[l]=function(e){Kt(e)&&p({type:5})},e.Backspace=function(e){Kt(e)&&p({type:6})},e}),[p,l]);return{getSelectedItemProps:t.useCallback((function(e){var t,i=void 0===e?{}:e,r=i.refKey,u=void 0===r?"ref":r,s=i.ref,a=i.onClick,l=i.onKeyDown,c=i.selectedItem,d=i.index,f=n(i,Vt),g=y.current.state;if(Ye(d,c,g.selectedItems)<0)throw new Error("Pass either selectedItem or index in getSelectedItemProps!");return o(((t={})[u]=ye(s,(function(e){e&&v.current.push(e)})),t.tabIndex=d===g.activeIndex?0:-1,t.onClick=ve(a,(function(){p({type:0,index:d})})),t.onKeyDown=ve(l,(function(e){var t=Me(e);t&&b[t]&&b[t](e)})),t),f)}),[p,y,b]),getDropdownProps:t.useCallback((function(e,t){var i,r=void 0===e?{}:e,u=r.refKey,s=void 0===u?"ref":u,a=r.ref,l=r.onKeyDown,c=r.onClick,d=r.preventKeyAction,f=void 0!==d&&d,g=n(r,At),h=(void 0===t?{}:t).suppressRefError;return x("getDropdownProps",void 0!==h&&h,s,m),o(((i={})[s]=ye(a,(function(e){e&&(m.current=e)})),i),!f&&{onKeyDown:ve(l,(function(e){var t=Me(e);t&&w[t]&&w[t](e)})),onClick:ve(c,(function(){p({type:7})}))},g)}),[p,w,x]),addSelectedItem:t.useCallback((function(e){p({type:8,selectedItem:e})}),[p]),removeSelectedItem:t.useCallback((function(e){p({type:9,selectedItem:e})}),[p]),setSelectedItems:t.useCallback((function(e){p({type:10,selectedItems:e})}),[p]),setActiveIndex:t.useCallback((function(e){p({type:11,activeIndex:e})}),[p]),reset:t.useCallback((function(){p({type:12})}),[p]),selectedItems:g,activeIndex:f}}Nt.stateChangeTypes=Ht,e.default=_e,e.resetIdCounter=function(){pe=0},e.useCombobox=Mt,e.useMultipleSelection=Nt,e.useSelect=vt,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
//# sourceMappingURL=downshift.umd.min.js.map |
{ | ||
"name": "downshift", | ||
"version": "7.1.1", | ||
"version": "7.1.2", | ||
"description": "🏎 A set of primitives to build simple, flexible, WAI-ARIA compliant React autocomplete, combobox or select dropdown components.", | ||
@@ -10,2 +10,3 @@ "main": "dist/downshift.cjs.js", | ||
"sideEffects": false, | ||
"browserslist": [], | ||
"scripts": { | ||
@@ -12,0 +13,0 @@ "build": "npm run build:web --silent && npm run build:native --silent", |
@@ -1,2 +0,10 @@ | ||
!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(n),s={},r=60103,l=60106,u=60107,d=60108,a=60114,c=60109,h=60110,p=60112,g=60113,m=60120,f=60115,I=60116,y=60121,v=60122,x=60117,b=60129,w=60131;if("function"==typeof Symbol&&Symbol.for){var S=Symbol.for;r=S("react.element"),l=S("react.portal"),u=S("react.fragment"),d=S("react.strict_mode"),a=S("react.profiler"),c=S("react.provider"),h=S("react.context"),p=S("react.forward_ref"),g=S("react.suspense"),m=S("react.suspense_list"),f=S("react.memo"),I=S("react.lazy"),y=S("react.block"),v=S("react.server.block"),x=S("react.fundamental"),b=S("react.debug_trace_mode"),w=S("react.legacy_hidden")}function k(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case r:switch(e=e.type){case u:case a:case d:case g:case m:return e;default:switch(e=e&&e.$$typeof){case h:case p:case I:case f:case c:return e;default:return t}}case l:return t}}}var C=c,O=r,M=p,E=u,D=I,P=f,R=l,T=a,H=d,K=g;function F(e){return"object"==typeof e&&null!=e&&1===e.nodeType}function V(e,t){return(!t||"hidden"!==e)&&"visible"!==e&&"clip"!==e}function N(e,t){if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){var n=getComputedStyle(e,null);return V(n.overflowY,t)||V(n.overflowX,t)||function(e){var t=function(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}function A(e,t,n,i,o,s,r,l){return s<e&&r>t||s>e&&r<t?0:s<=e&&l<=n||r>=t&&l>=n?s-e-i:r>t&&l<n||s<e&&l>n?r-t+o:0}s.ContextConsumer=h,s.ContextProvider=C,s.Element=O,s.ForwardRef=M,s.Fragment=E,s.Lazy=D,s.Memo=P,s.Portal=R,s.Profiler=T,s.StrictMode=H,s.Suspense=K,s.isAsyncMode=function(){return!1},s.isConcurrentMode=function(){return!1},s.isContextConsumer=function(e){return k(e)===h},s.isContextProvider=function(e){return k(e)===c},s.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===r},s.isForwardRef=function(e){return k(e)===p},s.isFragment=function(e){return k(e)===u},s.isLazy=function(e){return k(e)===I},s.isMemo=function(e){return k(e)===f},s.isPortal=function(e){return k(e)===l},s.isProfiler=function(e){return k(e)===a},s.isStrictMode=function(e){return k(e)===d},s.isSuspense=function(e){return k(e)===g},s.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===u||e===a||e===b||e===d||e===g||e===m||e===w||"object"==typeof e&&null!==e&&(e.$$typeof===I||e.$$typeof===f||e.$$typeof===c||e.$$typeof===h||e.$$typeof===p||e.$$typeof===x||e.$$typeof===y||e[0]===v)},s.typeOf=k;let B=0;function L(e){return"function"==typeof e?e:$}function $(){}function _(e,t){if(!e)return;const n=function(e,t){var n=window,i=t.scrollMode,o=t.block,s=t.inline,r=t.boundary,l=t.skipOverflowHiddenElements,u="function"==typeof r?r:function(e){return e!==r};if(!F(e))throw new TypeError("Invalid target");for(var d,a,c=document.scrollingElement||document.documentElement,h=[],p=e;F(p)&&u(p);){if((p=null==(a=(d=p).parentElement)?d.getRootNode().host||null:a)===c){h.push(p);break}null!=p&&p===document.body&&N(p)&&!N(document.documentElement)||null!=p&&N(p,l)&&h.push(p)}for(var g=n.visualViewport?n.visualViewport.width:innerWidth,m=n.visualViewport?n.visualViewport.height:innerHeight,f=window.scrollX||pageXOffset,I=window.scrollY||pageYOffset,y=e.getBoundingClientRect(),v=y.height,x=y.width,b=y.top,w=y.right,S=y.bottom,k=y.left,C="start"===o||"nearest"===o?b:"end"===o?S:b+v/2,O="center"===s?k+x/2:"end"===s?w:k,M=[],E=0;E<h.length;E++){var D=h[E],P=D.getBoundingClientRect(),R=P.height,T=P.width,H=P.top,K=P.right,V=P.bottom,B=P.left;if("if-needed"===i&&b>=0&&k>=0&&S<=m&&w<=g&&b>=H&&S<=V&&k>=B&&w<=K)return M;var L=getComputedStyle(D),$=parseInt(L.borderLeftWidth,10),_=parseInt(L.borderTopWidth,10),U=parseInt(L.borderRightWidth,10),j=parseInt(L.borderBottomWidth,10),W=0,z=0,q="offsetWidth"in D?D.offsetWidth-D.clientWidth-$-U:0,X="offsetHeight"in D?D.offsetHeight-D.clientHeight-_-j:0,Y="offsetWidth"in D?0===D.offsetWidth?0:T/D.offsetWidth:0,G="offsetHeight"in D?0===D.offsetHeight?0:R/D.offsetHeight:0;if(c===D)W="start"===o?C:"end"===o?C-m:"nearest"===o?A(I,I+m,m,_,j,I+C,I+C+v,v):C-m/2,z="start"===s?O:"center"===s?O-g/2:"end"===s?O-g:A(f,f+g,g,$,U,f+O,f+O+x,x),W=Math.max(0,W+I),z=Math.max(0,z+f);else{W="start"===o?C-H-_:"end"===o?C-V+j+X:"nearest"===o?A(H,V,R,_,j+X,C,C+v,v):C-(H+R/2)+X/2,z="start"===s?O-B-$:"center"===s?O-(B+T/2)+q/2:"end"===s?O-K+U+q:A(B,K,T,$,U+q,O,O+x,x);var J=D.scrollLeft,Q=D.scrollTop;C+=Q-(W=Math.max(0,Math.min(Q+W/G,D.scrollHeight-R/G+X))),O+=J-(z=Math.max(0,Math.min(J+z/Y,D.scrollWidth-T/Y+q)))}M.push({el:D,top:W,left:z})}return M}(e,{boundary:t,block:"nearest",scrollMode:"if-needed"});n.forEach((e=>{let{el:t,top:n,left:i}=e;t.scrollTop=n,t.scrollLeft=i}))}function U(e,t,n){return e===t||t instanceof n.Node&&e.contains&&e.contains(t)}function j(e,t){let n;function i(){n&&clearTimeout(n)}function o(){for(var o=arguments.length,s=new Array(o),r=0;r<o;r++)s[r]=arguments[r];i(),n=setTimeout((()=>{n=null,e(...s)}),t)}return o.cancel=i,o}function W(){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((t=>(t&&t(e,...i),e.preventDownshiftDefault||e.hasOwnProperty("nativeEvent")&&e.nativeEvent.preventDownshiftDefault)))}}function z(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return e=>{t.forEach((t=>{"function"==typeof t?t(e):t&&(t.current=e)}))}}function q(){return String(B++)}function X(e){let{isOpen:t,resultCount:n,previousResultCount:i}=e;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 Y(e,t){return!(e=Array.isArray(e)?e[0]:e)&&t?t:e}const G=["highlightedIndex","inputValue","isOpen","selectedItem","type"];function J(e){void 0===e&&(e={});const t={};return G.forEach((n=>{e.hasOwnProperty(n)&&(t[n]=e[n])})),t}function Q(e,t){return Object.keys(e).reduce(((n,i)=>(n[i]=Z(t,i)?t[i]:e[i],n)),{})}function Z(e,t){return void 0!==e[t]}function ee(e){const{key:t,keyCode:n}=e;return n>=37&&n<=40&&0!==t.indexOf("Arrow")?`Arrow${t}`:t}function te(e,t,n,i,o){if(void 0===o&&(o=!0),0===n)return-1;const s=n-1;("number"!=typeof t||t<0||t>=n)&&(t=e>0?-1:s+1);let r=t+e;r<0?r=o?s:0:r>s&&(r=o?0:s);const l=ne(e,r,n,i,o);return-1===l?t>=n?-1:t:l}function ne(e,t,n,i,o){const s=i(t);if(!s||!s.hasAttribute("disabled"))return t;if(e>0){for(let e=t+1;e<n;e++)if(!i(e).hasAttribute("disabled"))return e}else for(let e=t-1;e>=0;e--)if(!i(e).hasAttribute("disabled"))return e;return o?e>0?ne(1,0,n,i,!1):ne(-1,n-1,n,i,!1):-1}function ie(e,t,n,i){return void 0===i&&(i=!0),t.some((t=>t&&(U(t,e,n)||i&&U(t,n.document.activeElement,n))))}const oe=j((e=>{re(e).textContent=""}),500);function se(e,t){const n=re(t);e&&(n.textContent=e,oe(t))}function re(e){void 0===e&&(e=document);let t=e.getElementById("a11y-status-message");return t||(t=e.createElement("div"),t.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 le=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});const ue=(()=>{class e extends t.Component{constructor(e){var t;super(e),t=this,this.id=this.props.id||`downshift-${q()}`,this.menuId=this.props.menuId||`${this.id}-menu`,this.labelId=this.props.labelId||`${this.id}-label`,this.inputId=this.props.inputId||`${this.id}-input`,this.getItemId=this.props.getItemId||(e=>`${this.id}-item-${e}`),this.input=null,this.items=[],this.itemCount=null,this.previousResultCount=0,this.timeoutIds=[],this.internalSetTimeout=(e,t)=>{const n=setTimeout((()=>{this.timeoutIds=this.timeoutIds.filter((e=>e!==n)),e()}),t);this.timeoutIds.push(n)},this.setItemCount=e=>{this.itemCount=e},this.unsetItemCount=()=>{this.itemCount=null},this.setHighlightedIndex=function(e,n){void 0===e&&(e=t.props.defaultHighlightedIndex),void 0===n&&(n={}),n=J(n),t.internalSetState({highlightedIndex:e,...n})},this.clearSelection=e=>{this.internalSetState({selectedItem:null,inputValue:"",highlightedIndex:this.props.defaultHighlightedIndex,isOpen:this.props.defaultIsOpen},e)},this.selectItem=(e,t,n)=>{t=J(t),this.internalSetState({isOpen:this.props.defaultIsOpen,highlightedIndex:this.props.defaultHighlightedIndex,selectedItem:e,inputValue:this.props.itemToString(e),...t},n)},this.selectItemAtIndex=(e,t,n)=>{const i=this.items[e];null!=i&&this.selectItem(i,t,n)},this.selectHighlightedItem=(e,t)=>this.selectItemAtIndex(this.getState().highlightedIndex,e,t),this.internalSetState=(e,t)=>{let n,i;const o={},s="function"==typeof e;return!s&&e.hasOwnProperty("inputValue")&&this.props.onInputValueChange(e.inputValue,{...this.getStateAndHelpers(),...e}),this.setState((t=>{t=this.getState(t);let r=s?e(t):e;r=this.props.stateReducer(t,r),n=r.hasOwnProperty("selectedItem");const l={};return n&&r.selectedItem!==t.selectedItem&&(i=r.selectedItem),r.type=r.type||0,Object.keys(r).forEach((e=>{t[e]!==r[e]&&(o[e]=r[e]),"type"!==e&&(r[e],Z(this.props,e)||(l[e]=r[e]))})),s&&r.hasOwnProperty("inputValue")&&this.props.onInputValueChange(r.inputValue,{...this.getStateAndHelpers(),...r}),l}),(()=>{L(t)();Object.keys(o).length>1&&this.props.onStateChange(o,this.getStateAndHelpers()),n&&this.props.onSelect(e.selectedItem,this.getStateAndHelpers()),void 0!==i&&this.props.onChange(i,this.getStateAndHelpers()),this.props.onUserAction(o,this.getStateAndHelpers())}))},this.rootRef=e=>this._rootNode=e,this.getRootProps=function(e,n){let{refKey:i="ref",ref:o,...s}=void 0===e?{}:e,{suppressRefError:r=!1}=void 0===n?{}:n;t.getRootProps.called=!0,t.getRootProps.refKey=i,t.getRootProps.suppressRefError=r;const{isOpen:l}=t.getState();return{[i]:z(o,t.rootRef),role:"combobox","aria-expanded":l,"aria-haspopup":"listbox","aria-owns":l?t.menuId:null,"aria-labelledby":t.labelId,...s}},this.keyDownHandlers={ArrowDown(e){if(e.preventDefault(),this.getState().isOpen){const t=e.shiftKey?5:1;this.moveHighlightedIndex(t,{type:4})}else this.internalSetState({isOpen:!0,type:4},(()=>{const e=this.getItemCount();if(e>0){const{highlightedIndex:t}=this.getState(),n=te(1,t,e,(e=>this.getItemNodeFromIndex(e)));this.setHighlightedIndex(n,{type:4})}}))},ArrowUp(e){if(e.preventDefault(),this.getState().isOpen){const t=e.shiftKey?-5:-1;this.moveHighlightedIndex(t,{type:3})}else this.internalSetState({isOpen:!0,type:3},(()=>{const e=this.getItemCount();if(e>0){const{highlightedIndex:t}=this.getState(),n=te(-1,t,e,(e=>this.getItemNodeFromIndex(e)));this.setHighlightedIndex(n,{type:3})}}))},Enter(e){if(229===e.which)return;const{isOpen:t,highlightedIndex:n}=this.getState();if(t&&null!=n){e.preventDefault();const t=this.items[n],i=this.getItemNodeFromIndex(n);if(null==t||i&&i.hasAttribute("disabled"))return;this.selectHighlightedItem({type:6})}},Escape(e){e.preventDefault(),this.reset({type:5,...!this.state.isOpen&&{selectedItem:null,inputValue:""}})}},this.buttonKeyDownHandlers={...this.keyDownHandlers," "(e){e.preventDefault(),this.toggleMenu({type:12})}},this.inputKeyDownHandlers={...this.keyDownHandlers,Home(e){const{isOpen:t}=this.getState();if(!t)return;e.preventDefault();const n=this.getItemCount();if(n<=0||!t)return;const i=ne(1,0,n,(e=>this.getItemNodeFromIndex(e)),!1);this.setHighlightedIndex(i,{type:7})},End(e){const{isOpen:t}=this.getState();if(!t)return;e.preventDefault();const n=this.getItemCount();if(n<=0||!t)return;const i=ne(-1,n-1,n,(e=>this.getItemNodeFromIndex(e)),!1);this.setHighlightedIndex(i,{type:8})}},this.getToggleButtonProps=function(e){let{onClick:n,onPress:i,onKeyDown:o,onKeyUp:s,onBlur:r,...l}=void 0===e?{}:e;const{isOpen:u}=t.getState(),d={onClick:W(n,t.buttonHandleClick),onKeyDown:W(o,t.buttonHandleKeyDown),onKeyUp:W(s,t.buttonHandleKeyUp),onBlur:W(r,t.buttonHandleBlur)};return{type:"button",role:"button","aria-label":u?"close menu":"open menu","aria-haspopup":!0,"data-toggle":!0,...l.disabled?{}:d,...l}},this.buttonHandleKeyUp=e=>{e.preventDefault()},this.buttonHandleKeyDown=e=>{const t=ee(e);this.buttonKeyDownHandlers[t]&&this.buttonKeyDownHandlers[t].call(this,e)},this.buttonHandleClick=e=>{e.preventDefault(),this.props.environment.document.activeElement===this.props.environment.document.body&&e.target.focus(),this.internalSetTimeout((()=>this.toggleMenu({type:13})))},this.buttonHandleBlur=e=>{const t=e.target;this.internalSetTimeout((()=>{this.isMouseDown||null!=this.props.environment.document.activeElement&&this.props.environment.document.activeElement.id===this.inputId||this.props.environment.document.activeElement===t||this.reset({type:14})}))},this.getLabelProps=e=>({htmlFor:this.inputId,id:this.labelId,...e}),this.getInputProps=function(e){let n,{onKeyDown:i,onBlur:o,onChange:s,onInput:r,onChangeText:l,...u}=void 0===e?{}:e,d={};n="onInput";const{inputValue:a,isOpen:c,highlightedIndex:h}=t.getState();return u.disabled||(d={onInput:W(s,r,t.inputHandleChange),onKeyDown:W(i,t.inputHandleKeyDown),onBlur:W(o,t.inputHandleBlur)}),{"aria-autocomplete":"list","aria-activedescendant":c&&"number"==typeof h&&h>=0?t.getItemId(h):null,"aria-controls":c?t.menuId:null,"aria-labelledby":t.labelId,autoComplete:"off",value:a,id:t.inputId,...d,...u}},this.inputHandleKeyDown=e=>{const t=ee(e);t&&this.inputKeyDownHandlers[t]&&this.inputKeyDownHandlers[t].call(this,e)},this.inputHandleChange=e=>{this.internalSetState({type:11,isOpen:!0,inputValue:e.target.value,highlightedIndex:this.props.defaultHighlightedIndex})},this.inputHandleBlur=()=>{this.internalSetTimeout((()=>{const e=this.props.environment.document&&!!this.props.environment.document.activeElement&&!!this.props.environment.document.activeElement.dataset&&this.props.environment.document.activeElement.dataset.toggle&&this._rootNode&&this._rootNode.contains(this.props.environment.document.activeElement);this.isMouseDown||e||this.reset({type:10})}))},this.menuRef=e=>{this._menuNode=e},this.getMenuProps=function(e,n){let{refKey:i="ref",ref:o,...s}=void 0===e?{}:e,{suppressRefError:r=!1}=void 0===n?{}:n;return t.getMenuProps.called=!0,t.getMenuProps.refKey=i,t.getMenuProps.suppressRefError=r,{[i]:z(o,t.menuRef),role:"listbox","aria-labelledby":s&&s["aria-label"]?null:t.labelId,id:t.menuId,...s}},this.getItemProps=function(e){let{onMouseMove:n,onMouseDown:i,onClick:o,onPress:s,index:r,item:l,...u}=void 0===e?{}:e;void 0===r?(t.items.push(l),r=t.items.indexOf(l)):t.items[r]=l;const d=o,a={onMouseMove:W(n,(()=>{r!==t.getState().highlightedIndex&&(t.setHighlightedIndex(r,{type:2}),t.avoidScrolling=!0,t.internalSetTimeout((()=>t.avoidScrolling=!1),250))})),onMouseDown:W(i,(e=>{e.preventDefault()})),onClick:W(d,(()=>{t.selectItemAtIndex(r,{type:9})}))},c=u.disabled?{onMouseDown:a.onMouseDown}:a;return{id:t.getItemId(r),role:"option","aria-selected":t.getState().highlightedIndex===r,...c,...u}},this.clearItems=()=>{this.items=[]},this.reset=function(e,n){void 0===e&&(e={}),e=J(e),t.internalSetState((n=>{let{selectedItem:i}=n;return{isOpen:t.props.defaultIsOpen,highlightedIndex:t.props.defaultHighlightedIndex,inputValue:t.props.itemToString(i),...e}}),n)},this.toggleMenu=function(e,n){void 0===e&&(e={}),e=J(e),t.internalSetState((n=>{let{isOpen:i}=n;return{isOpen:!i,...i&&{highlightedIndex:t.props.defaultHighlightedIndex},...e}}),(()=>{const{isOpen:i,highlightedIndex:o}=t.getState();i&&t.getItemCount()>0&&"number"==typeof o&&t.setHighlightedIndex(o,e),L(n)()}))},this.openMenu=e=>{this.internalSetState({isOpen:!0},e)},this.closeMenu=e=>{this.internalSetState({isOpen:!1},e)},this.updateStatus=j((()=>{const e=this.getState(),t=this.items[e.highlightedIndex],n=this.getItemCount(),i=this.props.getA11yStatusMessage({itemToString:this.props.itemToString,previousResultCount:this.previousResultCount,resultCount:n,highlightedItem:t,...e});this.previousResultCount=n,se(i,this.props.environment.document)}),200);const{defaultHighlightedIndex:n,initialHighlightedIndex:i=n,defaultIsOpen:o,initialIsOpen:s=o,initialInputValue:r="",initialSelectedItem:l=null}=this.props,u=this.getState({highlightedIndex:i,isOpen:s,inputValue:r,selectedItem:l});null!=u.selectedItem&&void 0===this.props.initialInputValue&&(u.inputValue=this.props.itemToString(u.selectedItem)),this.state=u}internalClearTimeouts(){this.timeoutIds.forEach((e=>{clearTimeout(e)})),this.timeoutIds=[]}getState(e){return void 0===e&&(e=this.state),Q(e,this.props)}getItemCount(){let e=this.items.length;return null!=this.itemCount?e=this.itemCount:void 0!==this.props.itemCount&&(e=this.props.itemCount),e}getItemNodeFromIndex(e){return this.props.environment.document.getElementById(this.getItemId(e))}scrollHighlightedItemIntoView(){{const e=this.getItemNodeFromIndex(this.getState().highlightedIndex);this.props.scrollIntoView(e,this._menuNode)}}moveHighlightedIndex(e,t){const n=this.getItemCount(),{highlightedIndex:i}=this.getState();if(n>0){const o=te(e,i,n,(e=>this.getItemNodeFromIndex(e)));this.setHighlightedIndex(o,t)}}getStateAndHelpers(){const{highlightedIndex:e,inputValue:t,selectedItem:n,isOpen:i}=this.getState(),{itemToString:o}=this.props,{id:s}=this,{getRootProps:r,getToggleButtonProps:l,getLabelProps:u,getMenuProps:d,getInputProps:a,getItemProps:c,openMenu:h,closeMenu:p,toggleMenu:g,selectItem:m,selectItemAtIndex:f,selectHighlightedItem:I,setHighlightedIndex:y,clearSelection:v,clearItems:x,reset:b,setItemCount:w,unsetItemCount:S,internalSetState:k}=this;return{getRootProps:r,getToggleButtonProps:l,getLabelProps:u,getMenuProps:d,getInputProps:a,getItemProps:c,reset:b,openMenu:h,closeMenu:p,toggleMenu:g,selectItem:m,selectItemAtIndex:f,selectHighlightedItem:I,setHighlightedIndex:y,clearSelection:v,clearItems:x,setItemCount:w,unsetItemCount:S,setState:k,itemToString:o,id:s,highlightedIndex:e,inputValue:t,isOpen:i,selectedItem:n}}componentDidMount(){{const e=()=>{this.isMouseDown=!0},t=e=>{this.isMouseDown=!1;!ie(e.target,[this._rootNode,this._menuNode],this.props.environment)&&this.getState().isOpen&&this.reset({type:1},(()=>this.props.onOuterClick(this.getStateAndHelpers())))},n=()=>{this.isTouchMove=!1},i=()=>{this.isTouchMove=!0},o=e=>{const t=ie(e.target,[this._rootNode,this._menuNode],this.props.environment,!1);this.isTouchMove||t||!this.getState().isOpen||this.reset({type:16},(()=>this.props.onOuterClick(this.getStateAndHelpers())))},{environment:s}=this.props;s.addEventListener("mousedown",e),s.addEventListener("mouseup",t),s.addEventListener("touchstart",n),s.addEventListener("touchmove",i),s.addEventListener("touchend",o),this.cleanup=()=>{this.internalClearTimeouts(),this.updateStatus.cancel(),s.removeEventListener("mousedown",e),s.removeEventListener("mouseup",t),s.removeEventListener("touchstart",n),s.removeEventListener("touchmove",i),s.removeEventListener("touchend",o)}}}shouldScroll(e,t){const{highlightedIndex:n}=void 0===this.props.highlightedIndex?this.getState():this.props,{highlightedIndex:i}=void 0===t.highlightedIndex?e:t;return n&&this.getState().isOpen&&!e.isOpen||n!==i}componentDidUpdate(e,t){Z(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()}componentWillUnmount(){this.cleanup()}render(){const e=Y(this.props.children,$);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;const n=Y(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}}return e.defaultProps={defaultHighlightedIndex:null,defaultIsOpen:!1,getA11yStatusMessage:X,itemToString:e=>null==e?"":String(e),onStateChange:$,onInputValueChange:$,onUserAction:$,onChange:$,onSelect:$,onOuterClick:$,selectedItemChanged:(e,t)=>e!==t,environment:"undefined"==typeof window?{}:window,stateReducer:(e,t)=>t,suppressRefError:!1,scrollIntoView:_},e.stateChangeTypes=le,e})();var de=ue;const ae={highlightedIndex:-1,isOpen:!1,selectedItem:null,inputValue:""};function ce(e,t,n){const{props:i,type:o}=e,s={};Object.keys(t).forEach((i=>{!function(e,t,n,i){const{props:o,type:s}=t,r=`on${fe(e)}Change`;o[r]&&void 0!==i[e]&&i[e]!==n[e]&&o[r]({type:s,...i})}(i,e,t,n),n[i]!==t[i]&&(s[i]=n[i])})),i.onStateChange&&Object.keys(s).length&&i.onStateChange({type:o,...s})}const he=j(((e,t)=>{se(e(),t)}),200),pe="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement?t.useLayoutEffect:t.useEffect;function ge(e){let{id:n=`downshift-${q()}`,labelId:i,menuId:o,getItemId:s,toggleButtonId:r,inputId:l}=e;return t.useRef({labelId:i||`${n}-label`,menuId:o||`${n}-menu`,getItemId:s||(e=>`${n}-item-${e}`),toggleButtonId:r||`${n}-toggle-button`,inputId:l||`${n}-input`}).current}function me(e,t,n){return void 0!==e?e:0===n.length?-1:n.indexOf(t)}function fe(e){return`${e.slice(0,1).toUpperCase()}${e.slice(1)}`}function Ie(e){const n=t.useRef(e);return n.current=e,n}function ye(e,n,i){const o=t.useRef(),s=t.useRef(),r=t.useCallback(((t,n)=>{s.current=n,t=Q(t,n.props);const i=e(t,n);return n.props.stateReducer(t,{...n,changes:i})}),[e]),[l,u]=t.useReducer(r,n),d=Ie(i),a=t.useCallback((e=>u({props:d.current,...e})),[d]),c=s.current;return t.useEffect((()=>{c&&o.current&&o.current!==l&&ce(c,Q(o.current,c.props),l),o.current=l}),[l,i,c]),[l,a]}function ve(e,t,n){const[i,o]=ye(e,t,n);return[Q(i,n),o]}const xe={itemToString:function(e){return e?String(e):""},stateReducer:function(e,t){return t.changes},getA11ySelectionMessage:function(e){const{selectedItem:t,itemToString:n}=e;return t?`${n(t)} has been selected.`:""},scrollIntoView:_,environment:"undefined"==typeof window?{}:window};function be(e,t,n){void 0===n&&(n=ae);const i=e[`default${fe(t)}`];return void 0!==i?i:n[t]}function we(e,t,n){void 0===n&&(n=ae);const i=e[t];if(void 0!==i)return i;const o=e[`initial${fe(t)}`];return void 0!==o?o:be(e,t,n)}function Se(e){const t=we(e,"selectedItem"),n=we(e,"isOpen"),i=we(e,"highlightedIndex"),o=we(e,"inputValue");return{highlightedIndex:i<0&&t&&n?e.items.indexOf(t):i,isOpen:n,selectedItem:t,inputValue:o}}function ke(e,t,n){const{items:i,initialHighlightedIndex:o,defaultHighlightedIndex:s}=e,{selectedItem:r,highlightedIndex:l}=t;return 0===i.length?-1:void 0!==o&&l===o?o:void 0!==s?s:r?i.indexOf(r):0===n?-1:n<0?i.length-1:0}function Ce(e,n,i,o){const s=t.useRef({isMouseDown:!1,isTouchMove:!1});return t.useEffect((()=>{const t=()=>{s.current.isMouseDown=!0},r=t=>{s.current.isMouseDown=!1,e&&!ie(t.target,n.map((e=>e.current)),i)&&o()},l=()=>{s.current.isTouchMove=!1},u=()=>{s.current.isTouchMove=!0},d=t=>{!e||s.current.isTouchMove||ie(t.target,n.map((e=>e.current)),i,!1)||o()};return i.addEventListener("mousedown",t),i.addEventListener("mouseup",r),i.addEventListener("touchstart",l),i.addEventListener("touchmove",u),i.addEventListener("touchend",d),function(){i.removeEventListener("mousedown",t),i.removeEventListener("mouseup",r),i.removeEventListener("touchstart",l),i.removeEventListener("touchmove",u),i.removeEventListener("touchend",d)}}),[e,i]),s}let Oe=()=>$;function Me(e,n,i){let{isInitialMount:o,highlightedIndex:s,items:r,environment:l,...u}=i;t.useEffect((()=>{o||he((()=>e({highlightedIndex:s,highlightedItem:r[s],resultCount:r.length,...u})),l.document)}),n)}function Ee(e){let{highlightedIndex:n,isOpen:i,itemRefs:o,getItemNodeFromIndex:s,menuElement:r,scrollIntoView:l}=e;const u=t.useRef(!0);return pe((()=>{n<0||!i||!Object.keys(o.current).length||(!1===u.current?u.current=!0:l(s(n),r))}),[n]),u}let De=$;function Pe(e,t,n){const{type:i,props:o}=t;let s;switch(i){case n.ItemMouseMove:s={highlightedIndex:t.disabled?-1:t.index};break;case n.MenuMouseLeave:s={highlightedIndex:-1};break;case n.ToggleButtonClick:case n.FunctionToggleMenu:s={isOpen:!e.isOpen,highlightedIndex:e.isOpen?-1:ke(o,e,0)};break;case n.FunctionOpenMenu:s={isOpen:!0,highlightedIndex:ke(o,e,0)};break;case n.FunctionCloseMenu:s={isOpen:!1};break;case n.FunctionSetHighlightedIndex:s={highlightedIndex:t.highlightedIndex};break;case n.FunctionSetInputValue:s={inputValue:t.inputValue};break;case n.FunctionReset:s={highlightedIndex:be(o,"highlightedIndex"),isOpen:be(o,"isOpen"),selectedItem:be(o,"selectedItem"),inputValue:be(o,"inputValue")};break;default:throw new Error("Reducer called without proper action type.")}return{...e,...s}}var Re=function(){return Re=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},Re.apply(this,arguments)};o.default.array.isRequired,o.default.func,o.default.func,o.default.func,o.default.number,o.default.number,o.default.number,o.default.bool,o.default.bool,o.default.bool,o.default.any,o.default.any,o.default.any,o.default.string,o.default.string,o.default.string,o.default.func,o.default.string,o.default.func,o.default.func,o.default.func,o.default.func,o.default.func,o.default.shape({addEventListener:o.default.func,removeEventListener:o.default.func,document:o.default.shape({getElementById:o.default.func,activeElement:o.default.any,body:o.default.any})});var Te=Re(Re({},xe),{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.":""}}),He=$;var Ke=Object.freeze({__proto__:null,ToggleButtonClick:0,ToggleButtonKeyDownArrowDown:1,ToggleButtonKeyDownArrowUp:2,ToggleButtonKeyDownCharacter:3,ToggleButtonKeyDownEscape:4,ToggleButtonKeyDownHome:5,ToggleButtonKeyDownEnd:6,ToggleButtonKeyDownEnter:7,ToggleButtonKeyDownSpaceButton:8,ToggleButtonKeyDownPageUp:9,ToggleButtonKeyDownPageDown:10,ToggleButtonBlur:11,MenuMouseLeave:12,ItemMouseMove:13,ItemClick:14,FunctionToggleMenu:15,FunctionOpenMenu:16,FunctionCloseMenu:17,FunctionSetHighlightedIndex:18,FunctionSelectItem:19,FunctionSetInputValue:20,FunctionReset:21});function Fe(e,t){const{type:n,props:i,altKey:o}=t;let s;switch(n){case 14:s={isOpen:be(i,"isOpen"),highlightedIndex:be(i,"highlightedIndex"),selectedItem:i.items[t.index]};break;case 3:{const n=t.key,o=`${e.inputValue}${n}`,r=function(e){for(var t=e.keysSoFar,n=e.highlightedIndex,i=e.items,o=e.itemToString,s=e.getItemNodeFromIndex,r=t.toLowerCase(),l=0;l<i.length;l++){var u=(l+n+(t.length<2?1:0))%i.length,d=i[u];if(void 0!==d&&o(d).toLowerCase().startsWith(r)){var a=s(u);if(!(null==a?void 0:a.hasAttribute("disabled")))return u}}return n}({keysSoFar:o,highlightedIndex:!e.isOpen&&e.selectedItem?i.items.indexOf(e.selectedItem):e.highlightedIndex,items:i.items,itemToString:i.itemToString,getItemNodeFromIndex:t.getItemNodeFromIndex});s={inputValue:o,highlightedIndex:r,isOpen:!0}}break;case 1:s={highlightedIndex:e.isOpen?te(1,e.highlightedIndex,i.items.length,t.getItemNodeFromIndex,!1):o&&null==e.selectedItem?-1:ke(i,e,1),isOpen:!0};break;case 2:if(e.isOpen&&o)s={isOpen:be(i,"isOpen"),highlightedIndex:be(i,"highlightedIndex"),...e.highlightedIndex>=0&&{selectedItem:i.items[e.highlightedIndex]}};else{s={highlightedIndex:e.isOpen?te(-1,e.highlightedIndex,i.items.length,t.getItemNodeFromIndex,!1):ke(i,e,-1),isOpen:!0}}break;case 7:case 8:s={isOpen:be(i,"isOpen"),highlightedIndex:be(i,"highlightedIndex"),...e.highlightedIndex>=0&&{selectedItem:i.items[e.highlightedIndex]}};break;case 5:s={highlightedIndex:ne(1,0,i.items.length,t.getItemNodeFromIndex,!1),isOpen:!0};break;case 6:s={highlightedIndex:ne(-1,i.items.length-1,i.items.length,t.getItemNodeFromIndex,!1),isOpen:!0};break;case 9:s={highlightedIndex:te(-10,e.highlightedIndex,i.items.length,t.getItemNodeFromIndex,!1)};break;case 10:s={highlightedIndex:te(10,e.highlightedIndex,i.items.length,t.getItemNodeFromIndex,!1)};break;case 4:s={isOpen:!1,highlightedIndex:-1};break;case 11:s={isOpen:!1,highlightedIndex:-1,...e.highlightedIndex>=0&&{selectedItem:i.items[e.highlightedIndex]}};break;case 19:s={selectedItem:t.selectedItem};break;default:return Pe(e,t,Ke)}return{...e,...s}}function Ve(e){void 0===e&&(e={}),He();const n={...Te,...e},{items:i,scrollIntoView:o,environment:s,itemToString:r,getA11ySelectionMessage:l,getA11yStatusMessage:u}=n,d=Se(n),[a,c]=ve(Fe,d,n),{isOpen:h,highlightedIndex:p,selectedItem:g,inputValue:m}=a,f=t.useRef(null),I=t.useRef(null),y=t.useRef({}),v=t.useRef(null),x=ge(n),b=t.useRef(),w=t.useRef(!0),S=Ie({state:a,props:n}),k=t.useCallback((e=>y.current[x.getItemId(e)]),[x]);Me(u,[h,p,m,i],{isInitialMount:w.current,previousResultCount:b.current,items:i,environment:s,itemToString:r,...a}),Me(l,[g],{isInitialMount:w.current,previousResultCount:b.current,items:i,environment:s,itemToString:r,...a});const C=Ee({menuElement:I.current,highlightedIndex:p,isOpen:h,itemRefs:y,scrollIntoView:o,getItemNodeFromIndex:k});t.useEffect((()=>(v.current=j((e=>{e({type:20,inputValue:""})}),500),()=>{v.current.cancel()})),[]),t.useEffect((()=>{m&&v.current(c)}),[c,m]),De({isInitialMount:w.current,props:n,state:a}),t.useEffect((()=>{w.current||(b.current=i.length)}));const O=Ce(h,[I,f],s,(()=>{c({type:11})})),M=Oe();t.useEffect((()=>(w.current=!1,()=>{w.current=!0})),[]),t.useEffect((()=>{h||(y.current={})}),[h]);const E=t.useMemo((()=>({ArrowDown(e){e.preventDefault(),c({type:1,getItemNodeFromIndex:k,altKey:e.altKey})},ArrowUp(e){e.preventDefault(),c({type:2,getItemNodeFromIndex:k,altKey:e.altKey})},Home(e){e.preventDefault(),c({type:5,getItemNodeFromIndex:k})},End(e){e.preventDefault(),c({type:6,getItemNodeFromIndex:k})},Escape(){S.current.state.isOpen&&c({type:4})},Enter(e){e.preventDefault(),c({type:S.current.state.isOpen?7:0})},PageUp(e){S.current.state.isOpen&&(e.preventDefault(),c({type:9,getItemNodeFromIndex:k}))},PageDown(e){S.current.state.isOpen&&(e.preventDefault(),c({type:10,getItemNodeFromIndex:k}))}," "(e){e.preventDefault();const t=S.current.state;t.isOpen?t.inputValue?c({type:3,key:" ",getItemNodeFromIndex:k}):c({type:8}):c({type:0})}})),[c,k,S]),D=t.useCallback((()=>{c({type:15})}),[c]),P=t.useCallback((()=>{c({type:17})}),[c]),R=t.useCallback((()=>{c({type:16})}),[c]),T=t.useCallback((e=>{c({type:18,highlightedIndex:e})}),[c]),H=t.useCallback((e=>{c({type:19,selectedItem:e})}),[c]),K=t.useCallback((()=>{c({type:21})}),[c]),F=t.useCallback((e=>{c({type:20,inputValue:e})}),[c]),V=t.useCallback((e=>({id:x.labelId,htmlFor:x.toggleButtonId,...e})),[x]),N=t.useCallback((function(e,t){let{onMouseLeave:n,refKey:i="ref",onKeyDown:o,onBlur:s,ref:r,...l}=void 0===e?{}:e,{suppressRefError:u=!1}=void 0===t?{}:t;return M("getMenuProps",u,i,I),{[i]:z(r,(e=>{I.current=e})),id:x.menuId,role:"listbox","aria-labelledby":x.labelId,tabIndex:-1,onMouseLeave:W(n,(()=>{c({type:12})})),...l}}),[c,M,x]);return{getToggleButtonProps:t.useCallback((function(e,t){let{onBlur:n,onClick:i,onKeyDown:o,refKey:s="ref",ref:r,...l}=void 0===e?{}:e,{suppressRefError:u=!1}=void 0===t?{}:t;const d=S.current.state,a=()=>{c({type:0})},h=e=>{const t=ee(e);t&&E[t]?E[t](e):function(e){return/^\S{1}$/.test(e)}(t)&&c({type:3,key:t,getItemNodeFromIndex:k})},p={[s]:z(r,(e=>{f.current=e})),"aria-activedescendant":d.isOpen&&d.highlightedIndex>-1?x.getItemId(d.highlightedIndex):"","aria-controls":x.menuId,"aria-expanded":S.current.state.isOpen,"aria-haspopup":"listbox","aria-labelledby":`${x.labelId}`,id:x.toggleButtonId,role:"combobox",tabIndex:0,onBlur:W(n,(()=>{d.isOpen&&!O.current.isMouseDown&&c({type:11})})),...l};return l.disabled||(p.onClick=W(i,a),p.onKeyDown=W(o,h)),M("getToggleButtonProps",u,s,f),p}),[S,x,M,c,O,E,k]),getLabelProps:V,getMenuProps:N,getItemProps:t.useCallback((function(e){let{item:t,index:n,onMouseMove:o,onClick:s,refKey:r="ref",ref:l,disabled:u,...d}=void 0===e?{}:e;const{state:a,props:h}=S.current,p=t??i[n],m=me(n,p,h.items),f=()=>{c({type:14,index:m})},I=me(m,p,h.items);if(I<0)throw new Error("Pass either item or item index in getItemProps!");const v={disabled:u,role:"option","aria-selected":`${p===g}`,id:x.getItemId(I),[r]:z(l,(e=>{e&&(y.current[x.getItemId(I)]=e)})),...d};return u||(v.onClick=W(s,f)),v.onMouseMove=W(o,(()=>{m!==a.highlightedIndex&&(C.current=!1,c({type:13,index:m,disabled:u}))})),v}),[S,i,g,x,C,c]),toggleMenu:D,openMenu:R,closeMenu:P,setHighlightedIndex:T,selectItem:H,reset:K,setInputValue:F,highlightedIndex:p,isOpen:h,selectedItem:g,inputValue:m}}Ve.stateChangeTypes=Ke;var Ne=Object.freeze({__proto__:null,InputKeyDownArrowDown:0,InputKeyDownArrowUp:1,InputKeyDownEscape:2,InputKeyDownHome:3,InputKeyDownEnd:4,InputKeyDownPageUp:5,InputKeyDownPageDown:6,InputKeyDownEnter:7,InputChange:8,InputBlur:9,InputFocus:10,MenuMouseLeave:11,ItemMouseMove:12,ItemClick:13,ToggleButtonClick:14,FunctionToggleMenu:15,FunctionOpenMenu:16,FunctionCloseMenu:17,FunctionSetHighlightedIndex:18,FunctionSelectItem:19,FunctionSetInputValue:20,FunctionReset:21,ControlledPropUpdatedSelectedItem:22});o.default.array.isRequired,o.default.func,o.default.func,o.default.func,o.default.number,o.default.number,o.default.number,o.default.bool,o.default.bool,o.default.bool,o.default.any,o.default.any,o.default.any,o.default.string,o.default.string,o.default.string,o.default.string,o.default.string,o.default.string,o.default.func,o.default.string,o.default.string,o.default.func,o.default.func,o.default.func,o.default.func,o.default.func,o.default.func,o.default.shape({addEventListener:o.default.func,removeEventListener:o.default.func,document:o.default.shape({getElementById:o.default.func,activeElement:o.default.any,body:o.default.any})});let Ae=$;const Be={...xe,getA11yStatusMessage:X};function Le(e,t){const{type:n,props:i,altKey:o}=t;let s;switch(n){case 13:s={isOpen:be(i,"isOpen"),highlightedIndex:be(i,"highlightedIndex"),selectedItem:i.items[t.index],inputValue:i.itemToString(i.items[t.index])};break;case 0:s=e.isOpen?{highlightedIndex:te(1,e.highlightedIndex,i.items.length,t.getItemNodeFromIndex,!0)}:{highlightedIndex:o&&null==e.selectedItem?-1:ke(i,e,1,t.getItemNodeFromIndex),isOpen:i.items.length>=0};break;case 1:s=e.isOpen?o?{isOpen:be(i,"isOpen"),highlightedIndex:be(i,"highlightedIndex"),...e.highlightedIndex>=0&&{selectedItem:i.items[e.highlightedIndex],inputValue:i.itemToString(i.items[e.highlightedIndex])}}:{highlightedIndex:te(-1,e.highlightedIndex,i.items.length,t.getItemNodeFromIndex,!0)}:{highlightedIndex:ke(i,e,-1,t.getItemNodeFromIndex),isOpen:i.items.length>=0};break;case 7:s={isOpen:be(i,"isOpen"),highlightedIndex:be(i,"highlightedIndex"),...e.highlightedIndex>=0&&{selectedItem:i.items[e.highlightedIndex],inputValue:i.itemToString(i.items[e.highlightedIndex])}};break;case 2:s={isOpen:!1,highlightedIndex:-1,...!e.isOpen&&{selectedItem:null,inputValue:""}};break;case 5:s={highlightedIndex:te(-10,e.highlightedIndex,i.items.length,t.getItemNodeFromIndex,!1)};break;case 6:s={highlightedIndex:te(10,e.highlightedIndex,i.items.length,t.getItemNodeFromIndex,!1)};break;case 3:s={highlightedIndex:ne(1,0,i.items.length,t.getItemNodeFromIndex,!1)};break;case 4:s={highlightedIndex:ne(-1,i.items.length-1,i.items.length,t.getItemNodeFromIndex,!1)};break;case 9:s={isOpen:!1,highlightedIndex:-1,...e.highlightedIndex>=0&&t.selectItem&&{selectedItem:i.items[e.highlightedIndex],inputValue:i.itemToString(i.items[e.highlightedIndex])}};break;case 8:s={isOpen:!0,highlightedIndex:be(i,"highlightedIndex"),inputValue:t.inputValue};break;case 10:s={isOpen:!0,highlightedIndex:ke(i,e,0)};break;case 19:s={selectedItem:t.selectedItem,inputValue:i.itemToString(t.selectedItem)};break;case 22:s={inputValue:t.inputValue};break;default:return Pe(e,t,Ne)}return{...e,...s}}function $e(e){void 0===e&&(e={}),Ae();const n={...Be,...e},{initialIsOpen:i,defaultIsOpen:o,items:s,scrollIntoView:r,environment:l,getA11yStatusMessage:u,getA11ySelectionMessage:d,itemToString:a}=n,c=function(e){const t=Se(e),{selectedItem:n}=t;let{inputValue:i}=t;return""===i&&n&&void 0===e.defaultInputValue&&void 0===e.initialInputValue&&void 0===e.inputValue&&(i=e.itemToString(n)),{...t,inputValue:i}}(n),[h,p]=function(e,n,i){const o=t.useRef(),[s,r]=ye(e,n,i);return t.useEffect((()=>{Z(i,"selectedItem")&&(o.current!==i.selectedItem&&r({type:22,inputValue:i.itemToString(i.selectedItem)}),o.current=s.selectedItem===o.current?i.selectedItem:s.selectedItem)})),[Q(s,i),r]}(Le,c,n),{isOpen:g,highlightedIndex:m,selectedItem:f,inputValue:I}=h,y=t.useRef(null),v=t.useRef({}),x=t.useRef(null),b=t.useRef(null),w=t.useRef(!0),S=ge(n),k=t.useRef(),C=Ie({state:h,props:n}),O=t.useCallback((e=>v.current[S.getItemId(e)]),[S]);Me(u,[g,m,I,s],{isInitialMount:w.current,previousResultCount:k.current,items:s,environment:l,itemToString:a,...h}),Me(d,[f],{isInitialMount:w.current,previousResultCount:k.current,items:s,environment:l,itemToString:a,...h});const M=Ee({menuElement:y.current,highlightedIndex:m,isOpen:g,itemRefs:v,scrollIntoView:r,getItemNodeFromIndex:O});De({isInitialMount:w.current,props:n,state:h}),t.useEffect((()=>{(i||o||g)&&x.current&&x.current.focus()}),[]),t.useEffect((()=>{w.current||(k.current=s.length)}));const E=Ce(g,[x,y,b],l,(()=>{p({type:9,selectItem:!1})})),D=Oe();t.useEffect((()=>(w.current=!1,()=>{w.current=!0})),[]),t.useEffect((()=>{g?document.activeElement!==x.current&&x?.current?.focus():v.current={}}),[g]);const P=t.useMemo((()=>({ArrowDown(e){e.preventDefault(),p({type:0,altKey:e.altKey,getItemNodeFromIndex:O})},ArrowUp(e){e.preventDefault(),p({type:1,altKey:e.altKey,getItemNodeFromIndex:O})},Home(e){C.current.state.isOpen&&(e.preventDefault(),p({type:3,getItemNodeFromIndex:O}))},End(e){C.current.state.isOpen&&(e.preventDefault(),p({type:4,getItemNodeFromIndex:O}))},Escape(e){const t=C.current.state;(t.isOpen||t.inputValue||t.selectedItem||t.highlightedIndex>-1)&&(e.preventDefault(),p({type:2}))},Enter(e){C.current.state.isOpen&&229!==e.which&&(e.preventDefault(),p({type:7,getItemNodeFromIndex:O}))},PageUp(e){C.current.state.isOpen&&(e.preventDefault(),p({type:5,getItemNodeFromIndex:O}))},PageDown(e){C.current.state.isOpen&&(e.preventDefault(),p({type:6,getItemNodeFromIndex:O}))}})),[p,C,O]),R=t.useCallback((e=>({id:S.labelId,htmlFor:S.inputId,...e})),[S]),T=t.useCallback((function(e,t){let{onMouseLeave:n,refKey:i="ref",ref:o,...s}=void 0===e?{}:e,{suppressRefError:r=!1}=void 0===t?{}:t;return D("getMenuProps",r,i,y),{[i]:z(o,(e=>{y.current=e})),id:S.menuId,role:"listbox","aria-labelledby":S.labelId,onMouseLeave:W(n,(()=>{p({type:11})})),...s}}),[p,D,S]),H=t.useCallback((function(e){let{item:t,index:n,refKey:i="ref",ref:o,onMouseMove:s,onMouseDown:r,onClick:l,onPress:u,disabled:d,...a}=void 0===e?{}:e;const{props:c,state:h}=C.current,g=me(n,t,c.items);if(g<0)throw new Error("Pass either item or item index in getItemProps!");const m=l;return{[i]:z(o,(e=>{e&&(v.current[S.getItemId(g)]=e)})),disabled:d,role:"option","aria-selected":`${g===h.highlightedIndex}`,id:S.getItemId(g),...!d&&{onClick:W(m,(()=>{p({type:13,index:n})}))},onMouseMove:W(s,(()=>{n!==h.highlightedIndex&&(M.current=!1,p({type:12,index:n,disabled:d}))})),onMouseDown:W(r,(e=>e.preventDefault())),...a}}),[p,C,M,S]),K=t.useCallback((function(e){let{onClick:t,onPress:n,refKey:i="ref",ref:o,...s}=void 0===e?{}:e;const r=C.current.state;return{[i]:z(o,(e=>{b.current=e})),"aria-controls":S.menuId,"aria-expanded":r.isOpen,id:S.toggleButtonId,tabIndex:-1,...!s.disabled&&{onClick:W(t,(()=>{p({type:14})}))},...s}}),[p,C,S]),F=t.useCallback((function(e,t){let{onKeyDown:n,onChange:i,onInput:o,onFocus:s,onBlur:r,onChangeText:l,refKey:u="ref",ref:d,...a}=void 0===e?{}:e,{suppressRefError:c=!1}=void 0===t?{}:t;D("getInputProps",c,u,x);const h=C.current.state,g=e=>{const t=ee(e);t&&P[t]&&P[t](e)},m=e=>{p({type:8,inputValue:e.target.value})},f=()=>{h.isOpen&&!E.current.isMouseDown&&p({type:9,selectItem:!0})},I=()=>{h.isOpen||p({type:10})};let y={};return a.disabled||(y={onInput:W(i,o,m),onKeyDown:W(n,g),onBlur:W(r,f),onFocus:W(s,I)}),{[u]:z(d,(e=>{x.current=e})),"aria-activedescendant":h.isOpen&&h.highlightedIndex>-1?S.getItemId(h.highlightedIndex):"","aria-autocomplete":"list","aria-controls":S.menuId,"aria-expanded":h.isOpen,"aria-labelledby":S.labelId,autoComplete:"off",id:S.inputId,role:"combobox",value:h.inputValue,...y,...a}}),[p,P,C,E,D,S]),V=t.useCallback((()=>{p({type:15})}),[p]),N=t.useCallback((()=>{p({type:17})}),[p]),A=t.useCallback((()=>{p({type:16})}),[p]),B=t.useCallback((e=>{p({type:18,highlightedIndex:e})}),[p]),L=t.useCallback((e=>{p({type:19,selectedItem:e})}),[p]);return{getItemProps:H,getLabelProps:R,getMenuProps:T,getInputProps:F,getToggleButtonProps:K,toggleMenu:V,openMenu:A,closeMenu:N,setHighlightedIndex:B,setInputValue:t.useCallback((e=>{p({type:20,inputValue:e})}),[p]),selectItem:L,reset:t.useCallback((()=>{p({type:21})}),[p]),highlightedIndex:m,isOpen:g,selectedItem:f,inputValue:I}}$e.stateChangeTypes=Ne;const _e={activeIndex:-1,selectedItems:[]};function Ue(e,t){return we(e,t,_e)}function je(e,t){return be(e,t,_e)}function We(e){if(e.shiftKey||e.metaKey||e.ctrlKey||e.altKey)return!1;const t=e.target;return!(t instanceof HTMLInputElement&&""!==t.value)||0===t.selectionStart&&0===t.selectionEnd}o.default.array,o.default.array,o.default.array,o.default.func,o.default.func,o.default.func,o.default.number,o.default.number,o.default.number,o.default.func,o.default.func,o.default.string,o.default.string,o.default.shape({addEventListener:o.default.func,removeEventListener:o.default.func,document:o.default.shape({getElementById:o.default.func,activeElement:o.default.any,body:o.default.any})});const ze={itemToString:xe.itemToString,stateReducer:xe.stateReducer,environment:xe.environment,getA11yRemovalMessage:function(e){const{removedSelectedItem:t,itemToString:n}=e;return`${n(t)} has been removed.`},keyNavigationNext:"ArrowRight",keyNavigationPrevious:"ArrowLeft"};let qe=$;var Xe=Object.freeze({__proto__:null,SelectedItemClick:0,SelectedItemKeyDownDelete:1,SelectedItemKeyDownBackspace:2,SelectedItemKeyDownNavigationNext:3,SelectedItemKeyDownNavigationPrevious:4,DropdownKeyDownNavigationPrevious:5,DropdownKeyDownBackspace:6,DropdownClick:7,FunctionAddSelectedItem:8,FunctionRemoveSelectedItem:9,FunctionSetSelectedItems:10,FunctionSetActiveIndex:11,FunctionReset:12});function Ye(e,t){const{type:n,index:i,props:o,selectedItem:s}=t,{activeIndex:r,selectedItems:l}=e;let u;switch(n){case 0:u={activeIndex:i};break;case 4:u={activeIndex:r-1<0?0:r-1};break;case 3:u={activeIndex:r+1>=l.length?-1:r+1};break;case 2:case 1:{if(r<0)break;let e=r;1===l.length?e=-1:r===l.length-1&&(e=l.length-2),u={selectedItems:[...l.slice(0,r),...l.slice(r+1)],activeIndex:e};break}case 5:u={activeIndex:l.length-1};break;case 6:u={selectedItems:l.slice(0,l.length-1)};break;case 8:u={selectedItems:[...l,s]};break;case 7:u={activeIndex:-1};break;case 9:{let e=r;const t=l.indexOf(s);if(t<0)break;1===l.length?e=-1:t===l.length-1&&(e=l.length-2),u={selectedItems:[...l.slice(0,t),...l.slice(t+1)],activeIndex:e};break}case 10:{const{selectedItems:e}=t;u={selectedItems:e};break}case 11:{const{activeIndex:e}=t;u={activeIndex:e};break}case 12:u={activeIndex:je(o,"activeIndex"),selectedItems:je(o,"selectedItems")};break;default:throw new Error("Reducer called without proper action type.")}return{...e,...u}}function Ge(e){void 0===e&&(e={}),qe();const n={...ze,...e},{getA11yRemovalMessage:i,itemToString:o,environment:s,keyNavigationNext:r,keyNavigationPrevious:l}=n,[u,d]=ve(Ye,function(e){return{activeIndex:Ue(e,"activeIndex"),selectedItems:Ue(e,"selectedItems")}}(n),n),{activeIndex:a,selectedItems:c}=u,h=t.useRef(!0),p=t.useRef(null),g=t.useRef(c),m=t.useRef();m.current=[];const f=Ie({state:u,props:n});t.useEffect((()=>{if(!h.current){if(c.length<g.current.length){const e=g.current.find((e=>c.indexOf(e)<0));se(i({itemToString:o,resultCount:c.length,removedSelectedItem:e,activeIndex:a,activeSelectedItem:c[a]}),s.document)}g.current=c}}),[c.length]),t.useEffect((()=>{h.current||(-1===a&&p.current?p.current.focus():m.current[a]&&m.current[a].focus())}),[a]),De({isInitialMount:h.current,props:n,state:u});const I=Oe();t.useEffect((()=>(h.current=!1,()=>{h.current=!0})),[]);const y=t.useMemo((()=>({[l](){d({type:4})},[r](){d({type:3})},Delete(){d({type:1})},Backspace(){d({type:2})}})),[d,r,l]),v=t.useMemo((()=>({[l](e){We(e)&&d({type:5})},Backspace(e){We(e)&&d({type:6})}})),[d,l]);return{getSelectedItemProps:t.useCallback((function(e){let{refKey:t="ref",ref:n,onClick:i,onKeyDown:o,selectedItem:s,index:r,...l}=void 0===e?{}:e;const{state:u}=f.current;if(me(r,s,u.selectedItems)<0)throw new Error("Pass either selectedItem or index in getSelectedItemProps!");return{[t]:z(n,(e=>{e&&m.current.push(e)})),tabIndex:r===u.activeIndex?0:-1,onClick:W(i,(()=>{d({type:0,index:r})})),onKeyDown:W(o,(e=>{const t=ee(e);t&&y[t]&&y[t](e)})),...l}}),[d,f,y]),getDropdownProps:t.useCallback((function(e,t){let{refKey:n="ref",ref:i,onKeyDown:o,onClick:s,preventKeyAction:r=!1,...l}=void 0===e?{}:e,{suppressRefError:u=!1}=void 0===t?{}:t;return I("getDropdownProps",u,n,p),{[n]:z(i,(e=>{e&&(p.current=e)})),...!r&&{onKeyDown:W(o,(e=>{const t=ee(e);t&&v[t]&&v[t](e)})),onClick:W(s,(()=>{d({type:7})}))},...l}}),[d,v,I]),addSelectedItem:t.useCallback((e=>{d({type:8,selectedItem:e})}),[d]),removeSelectedItem:t.useCallback((e=>{d({type:9,selectedItem:e})}),[d]),setSelectedItems:t.useCallback((e=>{d({type:10,selectedItems:e})}),[d]),setActiveIndex:t.useCallback((e=>{d({type:11,activeIndex:e})}),[d]),reset:t.useCallback((()=>{d({type:12})}),[d]),selectedItems:c,activeIndex:a}}Ge.stateChangeTypes=Xe,e.default=de,e.resetIdCounter=function(){B=0},e.useCombobox=$e,e.useMultipleSelection=Ge,e.useSelect=Ve,Object.defineProperty(e,"__esModule",{value:!0})})); | ||
!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(n);function r(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 u(){return u=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},u.apply(this,arguments)}function s(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function l(e,t){return l=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},l(e,t)}var a={},d=60103,c=60106,p=60107,f=60108,g=60114,h=60109,m=60110,I=60112,v=60113,y=60120,x=60115,b=60116,w=60121,S=60122,k=60117,C=60129,O=60131; | ||
/** @license React v17.0.2 | ||
* react-is.production.min.js | ||
* | ||
* Copyright (c) Facebook, Inc. and its affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/if("function"==typeof Symbol&&Symbol.for){var M=Symbol.for;d=M("react.element"),c=M("react.portal"),p=M("react.fragment"),f=M("react.strict_mode"),g=M("react.profiler"),h=M("react.provider"),m=M("react.context"),I=M("react.forward_ref"),v=M("react.suspense"),y=M("react.suspense_list"),x=M("react.memo"),b=M("react.lazy"),w=M("react.block"),S=M("react.server.block"),k=M("react.fundamental"),C=M("react.debug_trace_mode"),O=M("react.legacy_hidden")}function D(e){if("object"==typeof e&&null!==e){var t=e.$$typeof;switch(t){case d:switch(e=e.type){case p:case g:case f:case v:case y:return e;default:switch(e=e&&e.$$typeof){case m:case I:case b:case x:case h:return e;default:return t}}case c:return t}}}var E=h,K=d,P=I,T=p,R=b,H=x,F=c,V=g,N=f,A=v;function B(e){return"object"==typeof e&&null!=e&&1===e.nodeType}function L(e,t){return(!t||"hidden"!==e)&&"visible"!==e&&"clip"!==e}function _(e,t){if(e.clientHeight<e.scrollHeight||e.clientWidth<e.scrollWidth){var n=getComputedStyle(e,null);return L(n.overflowY,t)||L(n.overflowX,t)||function(e){var t=function(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}function j(e,t,n,i,o,r,u,s){return 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}a.ContextConsumer=m,a.ContextProvider=E,a.Element=K,a.ForwardRef=P,a.Fragment=T,a.Lazy=R,a.Memo=H,a.Portal=F,a.Profiler=V,a.StrictMode=N,a.Suspense=A,a.isAsyncMode=function(){return!1},a.isConcurrentMode=function(){return!1},a.isContextConsumer=function(e){return D(e)===m},a.isContextProvider=function(e){return D(e)===h},a.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===d},a.isForwardRef=function(e){return D(e)===I},a.isFragment=function(e){return D(e)===p},a.isLazy=function(e){return D(e)===b},a.isMemo=function(e){return D(e)===x},a.isPortal=function(e){return D(e)===c},a.isProfiler=function(e){return D(e)===g},a.isStrictMode=function(e){return D(e)===f},a.isSuspense=function(e){return D(e)===v},a.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===p||e===g||e===C||e===f||e===v||e===y||e===O||"object"==typeof e&&null!==e&&(e.$$typeof===b||e.$$typeof===x||e.$$typeof===h||e.$$typeof===m||e.$$typeof===I||e.$$typeof===k||e.$$typeof===w||e[0]===S)},a.typeOf=D;var U=0;function $(e){return"function"==typeof e?e:W}function W(){}function z(e,t){if(e){var n=function(e,t){var n=window,i=t.scrollMode,o=t.block,r=t.inline,u=t.boundary,s=t.skipOverflowHiddenElements,l="function"==typeof u?u:function(e){return e!==u};if(!B(e))throw new TypeError("Invalid target");for(var a,d,c=document.scrollingElement||document.documentElement,p=[],f=e;B(f)&&l(f);){if((f=null==(d=(a=f).parentElement)?a.getRootNode().host||null:d)===c){p.push(f);break}null!=f&&f===document.body&&_(f)&&!_(document.documentElement)||null!=f&&_(f,s)&&p.push(f)}for(var g=n.visualViewport?n.visualViewport.width:innerWidth,h=n.visualViewport?n.visualViewport.height:innerHeight,m=window.scrollX||pageXOffset,I=window.scrollY||pageYOffset,v=e.getBoundingClientRect(),y=v.height,x=v.width,b=v.top,w=v.right,S=v.bottom,k=v.left,C="start"===o||"nearest"===o?b:"end"===o?S:b+y/2,O="center"===r?k+x/2:"end"===r?w:k,M=[],D=0;D<p.length;D++){var E=p[D],K=E.getBoundingClientRect(),P=K.height,T=K.width,R=K.top,H=K.right,F=K.bottom,V=K.left;if("if-needed"===i&&b>=0&&k>=0&&S<=h&&w<=g&&b>=R&&S<=F&&k>=V&&w<=H)return M;var N=getComputedStyle(E),A=parseInt(N.borderLeftWidth,10),L=parseInt(N.borderTopWidth,10),U=parseInt(N.borderRightWidth,10),$=parseInt(N.borderBottomWidth,10),W=0,z=0,q="offsetWidth"in E?E.offsetWidth-E.clientWidth-A-U:0,X="offsetHeight"in E?E.offsetHeight-E.clientHeight-L-$:0,Y="offsetWidth"in E?0===E.offsetWidth?0:T/E.offsetWidth:0,G="offsetHeight"in E?0===E.offsetHeight?0:P/E.offsetHeight:0;if(c===E)W="start"===o?C:"end"===o?C-h:"nearest"===o?j(I,I+h,h,L,$,I+C,I+C+y,y):C-h/2,z="start"===r?O:"center"===r?O-g/2:"end"===r?O-g:j(m,m+g,g,A,U,m+O,m+O+x,x),W=Math.max(0,W+I),z=Math.max(0,z+m);else{W="start"===o?C-R-L:"end"===o?C-F+$+X:"nearest"===o?j(R,F,P,L,$+X,C,C+y,y):C-(R+P/2)+X/2,z="start"===r?O-V-A:"center"===r?O-(V+T/2)+q/2:"end"===r?O-H+U+q:j(V,H,T,A,U+q,O,O+x,x);var J=E.scrollLeft,Q=E.scrollTop;C+=Q-(W=Math.max(0,Math.min(Q+W/G,E.scrollHeight-P/G+X))),O+=J-(z=Math.max(0,Math.min(J+z/Y,E.scrollWidth-T/Y+q)))}M.push({el:E,top:W,left:z})}return M}(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 q(e,t,n){return e===t||t instanceof n.Node&&e.contains&&e.contains(t)}function X(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 Y(){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 G(){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 J(){return String(U++)}function Q(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 Z(e,t){return!(e=Array.isArray(e)?e[0]:e)&&t?t:e}var ee=["highlightedIndex","inputValue","isOpen","selectedItem","type"];function te(e){void 0===e&&(e={});var t={};return ee.forEach((function(n){e.hasOwnProperty(n)&&(t[n]=e[n])})),t}function ne(e,t){return Object.keys(e).reduce((function(n,i){return n[i]=ie(t,i)?t[i]:e[i],n}),{})}function ie(e,t){return void 0!==e[t]}function oe(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){if(void 0===o&&(o=!0),0===n)return-1;var r=n-1;("number"!=typeof t||t<0||t>=n)&&(t=e>0?-1:r+1);var u=t+e;u<0?u=o?r:0:u>r&&(u=o?0:r);var s=ue(e,u,n,i,o);return-1===s?t>=n?-1:t:s}function ue(e,t,n,i,o){var r=i(t);if(!r||!r.hasAttribute("disabled"))return t;if(e>0){for(var u=t+1;u<n;u++)if(!i(u).hasAttribute("disabled"))return u}else for(var s=t-1;s>=0;s--)if(!i(s).hasAttribute("disabled"))return s;return o?e>0?ue(1,0,n,i,!1):ue(-1,n-1,n,i,!1):-1}function se(e,t,n,i){return void 0===i&&(i=!0),t.some((function(t){return t&&(q(t,e,n)||i&&q(t,n.document.activeElement,n))}))}var le=X((function(e){de(e).textContent=""}),500);function ae(e,t){var n=de(t);e&&(n.textContent=e,le(t))}function de(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 ce=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}),pe=["refKey","ref"],fe=["onClick","onPress","onKeyDown","onKeyUp","onBlur"],ge=["onKeyDown","onBlur","onChange","onInput","onChangeText"],he=["refKey","ref"],me=["onMouseMove","onMouseDown","onClick","onPress","index","item"],Ie=function(){var e=function(e){var n,i;function o(t){var n=e.call(this,t)||this;n.id=n.props.id||"downshift-"+J(),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.setHighlightedIndex=function(e,t){void 0===e&&(e=n.props.defaultHighlightedIndex),void 0===t&&(t={}),t=te(t),n.internalSetState(u({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=te(t),n.internalSetState(u({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={},s="function"==typeof e;return!s&&e.hasOwnProperty("inputValue")&&n.props.onInputValueChange(e.inputValue,u({},n.getStateAndHelpers(),e)),n.setState((function(t){t=n.getState(t);var l=s?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],ie(n.props,e)||(a[e]=l[e]))})),s&&l.hasOwnProperty("inputValue")&&n.props.onInputValueChange(l.inputValue,u({},n.getStateAndHelpers(),l)),a}),(function(){$(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,s=o.refKey,l=void 0===s?"ref":s,a=o.ref,d=r(o,pe),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 u(((i={})[l]=G(a,n.rootRef),i.role="combobox",i["aria-expanded"]=f,i["aria-haspopup"]="listbox",i["aria-owns"]=f?n.menuId:null,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=re(1,t.getState().highlightedIndex,e,(function(e){return t.getItemNodeFromIndex(e)}));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(-1,t.getState().highlightedIndex,e,(function(e){return t.getItemNodeFromIndex(e)}));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(u({type:5},!this.state.isOpen&&{selectedItem:null,inputValue:""}))}},n.buttonKeyDownHandlers=u({},n.keyDownHandlers,{" ":function(e){e.preventDefault(),this.toggleMenu({type:12})}}),n.inputKeyDownHandlers=u({},n.keyDownHandlers,{Home:function(e){var t=this,n=this.getState().isOpen;if(n){e.preventDefault();var i=this.getItemCount();if(!(i<=0)&&n){var o=ue(1,0,i,(function(e){return t.getItemNodeFromIndex(e)}),!1);this.setHighlightedIndex(o,{type:7})}}},End:function(e){var t=this,n=this.getState().isOpen;if(n){e.preventDefault();var i=this.getItemCount();if(!(i<=0)&&n){var o=ue(-1,i-1,i,(function(e){return t.getItemNodeFromIndex(e)}),!1);this.setHighlightedIndex(o,{type:8})}}}}),n.getToggleButtonProps=function(e){var t=void 0===e?{}:e,i=t.onClick;t.onPress;var o=t.onKeyDown,s=t.onKeyUp,l=t.onBlur,a=r(t,fe),d=n.getState().isOpen,c={onClick:Y(i,n.buttonHandleClick),onKeyDown:Y(o,n.buttonHandleKeyDown),onKeyUp:Y(s,n.buttonHandleKeyUp),onBlur:Y(l,n.buttonHandleBlur)};return u({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=oe(e);n.buttonKeyDownHandlers[t]&&n.buttonKeyDownHandlers[t].call(s(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 u({htmlFor:n.inputId,id:n.labelId},e)},n.getInputProps=function(e){var t=void 0===e?{}:e,i=t.onKeyDown,o=t.onBlur,s=t.onChange,l=t.onInput;t.onChangeText;var a=r(t,ge),d={};var c,p=n.getState(),f=p.inputValue,g=p.isOpen,h=p.highlightedIndex;a.disabled||((c={}).onInput=Y(s,l,n.inputHandleChange),c.onKeyDown=Y(i,n.inputHandleKeyDown),c.onBlur=Y(o,n.inputHandleBlur),d=c);return u({"aria-autocomplete":"list","aria-activedescendant":g&&"number"==typeof h&&h>=0?n.getItemId(h):null,"aria-controls":g?n.menuId:null,"aria-labelledby":n.labelId,autoComplete:"off",value:f,id:n.inputId},d,a)},n.inputHandleKeyDown=function(e){var t=oe(e);t&&n.inputKeyDownHandlers[t]&&n.inputKeyDownHandlers[t].call(s(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,s=o.refKey,l=void 0===s?"ref":s,a=o.ref,d=r(o,he),c=(void 0===t?{}:t).suppressRefError,p=void 0!==c&&c;return n.getMenuProps.called=!0,n.getMenuProps.refKey=l,n.getMenuProps.suppressRefError=p,u(((i={})[l]=G(a,n.menuRef),i.role="listbox",i["aria-labelledby"]=d&&d["aria-label"]?null:n.labelId,i.id=n.menuId,i),d)},n.getItemProps=function(e){var t,i=void 0===e?{}:e,o=i.onMouseMove,s=i.onMouseDown,l=i.onClick;i.onPress;var a=i.index,d=i.item,c=void 0===d?void 0:d,p=r(i,me);void 0===a?(n.items.push(c),a=n.items.indexOf(c)):n.items[a]=c;var f=l,g=((t={onMouseMove:Y(o,(function(){a!==n.getState().highlightedIndex&&(n.setHighlightedIndex(a,{type:2}),n.avoidScrolling=!0,n.internalSetTimeout((function(){return n.avoidScrolling=!1}),250))})),onMouseDown:Y(s,(function(e){e.preventDefault()}))}).onClick=Y(f,(function(){n.selectItemAtIndex(a,{type:9})})),t),h=p.disabled?{onMouseDown:g.onMouseDown}:g;return u({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=te(e),n.internalSetState((function(t){var i=t.selectedItem;return u({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=te(e),n.internalSetState((function(t){var i=t.isOpen;return u({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),$(t)()}))},n.openMenu=function(e){n.internalSetState({isOpen:!0},e)},n.closeMenu=function(e){n.internalSetState({isOpen:!1},e)},n.updateStatus=X((function(){var e=n.getState(),t=n.items[e.highlightedIndex],i=n.getItemCount(),o=n.props.getA11yStatusMessage(u({itemToString:n.props.itemToString,previousResultCount:n.previousResultCount,resultCount:i,highlightedItem:t},e));n.previousResultCount=i,ae(o,n.props.environment.document)}),200);var i=n.props,o=i.defaultHighlightedIndex,l=i.initialHighlightedIndex,a=void 0===l?o:l,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,l(n,i);var a=o.prototype;return a.internalClearTimeouts=function(){this.timeoutIds.forEach((function(e){clearTimeout(e)})),this.timeoutIds=[]},a.getState=function(e){return void 0===e&&(e=this.state),ne(e,this.props)},a.getItemCount=function(){var e=this.items.length;return null!=this.itemCount?e=this.itemCount:void 0!==this.props.itemCount&&(e=this.props.itemCount),e},a.getItemNodeFromIndex=function(e){return this.props.environment.document.getElementById(this.getItemId(e))},a.scrollHighlightedItemIntoView=function(){var e=this.getItemNodeFromIndex(this.getState().highlightedIndex);this.props.scrollIntoView(e,this._menuNode)},a.moveHighlightedIndex=function(e,t){var n=this,i=this.getItemCount(),o=this.getState().highlightedIndex;if(i>0){var r=re(e,o,i,(function(e){return n.getItemNodeFromIndex(e)}));this.setHighlightedIndex(r,t)}},a.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,x=this.clearSelection,b=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:x,clearItems:b,setItemCount:this.setItemCount,unsetItemCount:this.unsetItemCount,setState:this.internalSetState,itemToString:r,id:u,highlightedIndex:t,inputValue:n,isOpen:o,selectedItem:i}},a.componentDidMount=function(){var e=this,t=function(){e.isMouseDown=!0},n=function(t){e.isMouseDown=!1,!se(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=se(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)}},a.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},a.componentDidUpdate=function(e,t){ie(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()},a.componentWillUnmount=function(){this.cleanup()},a.render=function(){var e=Z(this.props.children,W);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=Z(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:Q,itemToString:function(e){return null==e?"":String(e)},onStateChange:W,onInputValueChange:W,onUserAction:W,onChange:W,onSelect:W,onOuterClick:W,selectedItemChanged:function(e,t){return e!==t},environment:"undefined"==typeof window?{}:window,stateReducer:function(e,t){return t},suppressRefError:!1,scrollIntoView:z},e.stateChangeTypes=ce,e}(),ve=Ie,ye=["isInitialMount","highlightedIndex","items","environment"],xe={highlightedIndex:-1,isOpen:!1,selectedItem:null,inputValue:""};function be(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,s="on"+Oe(e)+"Change";o[s]&&void 0!==i[e]&&i[e]!==n[e]&&o[s](u({type:r},i))}(i,e,t,n),n[i]!==t[i]&&(r[i]=n[i])})),i.onStateChange&&Object.keys(r).length&&i.onStateChange(u({type:o},r))}var we=X((function(e,t){ae(e(),t)}),200),Se="undefined"!=typeof window&&void 0!==window.document&&void 0!==window.document.createElement?t.useLayoutEffect:t.useEffect;function ke(e){var n=e.id,i=void 0===n?"downshift-"+J():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 Ce(e,t,n){return void 0!==e?e:0===n.length?-1:n.indexOf(t)}function Oe(e){return""+e.slice(0,1).toUpperCase()+e.slice(1)}function Me(e){var n=t.useRef(e);return n.current=e,n}function De(e,n,i){var o=t.useRef(),r=t.useRef(),s=t.useCallback((function(t,n){r.current=n,t=ne(t,n.props);var i=e(t,n);return n.props.stateReducer(t,u({},n,{changes:i}))}),[e]),l=t.useReducer(s,n),a=l[0],d=l[1],c=Me(i),p=t.useCallback((function(e){return d(u({props:c.current},e))}),[c]),f=r.current;return t.useEffect((function(){f&&o.current&&o.current!==a&&be(f,ne(o.current,f.props),a),o.current=a}),[a,i,f]),[a,p]}function Ee(e,t,n){var i=De(e,t,n),o=i[0],r=i[1];return[ne(o,n),r]}var Ke={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:z,environment:"undefined"==typeof window?{}:window};function Pe(e,t,n){void 0===n&&(n=xe);var i=e["default"+Oe(t)];return void 0!==i?i:n[t]}function Te(e,t,n){void 0===n&&(n=xe);var i=e[t];if(void 0!==i)return i;var o=e["initial"+Oe(t)];return void 0!==o?o:Pe(e,t,n)}function Re(e){var t=Te(e,"selectedItem"),n=Te(e,"isOpen"),i=Te(e,"highlightedIndex"),o=Te(e,"inputValue");return{highlightedIndex:i<0&&t&&n?e.items.indexOf(t):i,isOpen:n,selectedItem:t,inputValue:o}}function He(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 Fe(e,n,i,o){var r=t.useRef({isMouseDown:!1,isTouchMove:!1});return t.useEffect((function(){var t=function(){r.current.isMouseDown=!0},u=function(t){r.current.isMouseDown=!1,e&&!se(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||se(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 Ve=function(){return W};function Ne(e,n,i){var o=i.isInitialMount,s=i.highlightedIndex,l=i.items,a=i.environment,d=r(i,ye);t.useEffect((function(){o||we((function(){return e(u({highlightedIndex:s,highlightedItem:l[s],resultCount:l.length},d))}),a.document)}),n)}function Ae(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 Se((function(){n<0||!i||!Object.keys(o.current).length||(!1===l.current?l.current=!0:s(r(n),u))}),[n]),l}var Be=W;function Le(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:He(r,e,0)};break;case n.FunctionOpenMenu:i={isOpen:!0,highlightedIndex:He(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:Pe(r,"highlightedIndex"),isOpen:Pe(r,"isOpen"),selectedItem:Pe(r,"selectedItem"),inputValue:Pe(r,"inputValue")};break;default:throw new Error("Reducer called without proper action type.")}return u({},e,i)}var _e=function(){return _e=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},_e.apply(this,arguments)};o.default.array.isRequired,o.default.func,o.default.func,o.default.func,o.default.number,o.default.number,o.default.number,o.default.bool,o.default.bool,o.default.bool,o.default.any,o.default.any,o.default.any,o.default.string,o.default.string,o.default.string,o.default.func,o.default.string,o.default.func,o.default.func,o.default.func,o.default.func,o.default.func,o.default.shape({addEventListener:o.default.func,removeEventListener:o.default.func,document:o.default.shape({getElementById:o.default.func,activeElement:o.default.any,body:o.default.any})});var je=_e(_e({},Ke),{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.":""}}),Ue=W,$e=Object.freeze({__proto__:null,ToggleButtonClick:0,ToggleButtonKeyDownArrowDown:1,ToggleButtonKeyDownArrowUp:2,ToggleButtonKeyDownCharacter:3,ToggleButtonKeyDownEscape:4,ToggleButtonKeyDownHome:5,ToggleButtonKeyDownEnd:6,ToggleButtonKeyDownEnter:7,ToggleButtonKeyDownSpaceButton:8,ToggleButtonKeyDownPageUp:9,ToggleButtonKeyDownPageDown:10,ToggleButtonBlur:11,MenuMouseLeave:12,ItemMouseMove:13,ItemClick:14,FunctionToggleMenu:15,FunctionOpenMenu:16,FunctionCloseMenu:17,FunctionSetHighlightedIndex:18,FunctionSelectItem:19,FunctionSetInputValue:20,FunctionReset:21});function We(e,t){var n,i=t.type,o=t.props,r=t.altKey;switch(i){case 14:n={isOpen:Pe(o,"isOpen"),highlightedIndex:Pe(o,"highlightedIndex"),selectedItem:o.items[t.index]};break;case 3:var s=t.key,l=""+e.inputValue+s,a=function(e){for(var t=e.keysSoFar,n=e.highlightedIndex,i=e.items,o=e.itemToString,r=e.getItemNodeFromIndex,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)){var d=r(l);if(!(null==d?void 0:d.hasAttribute("disabled")))return l}}return n}({keysSoFar:l,highlightedIndex:!e.isOpen&&e.selectedItem?o.items.indexOf(e.selectedItem):e.highlightedIndex,items:o.items,itemToString:o.itemToString,getItemNodeFromIndex:t.getItemNodeFromIndex});n={inputValue:l,highlightedIndex:a,isOpen:!0};break;case 1:n={highlightedIndex:e.isOpen?re(1,e.highlightedIndex,o.items.length,t.getItemNodeFromIndex,!1):r&&null==e.selectedItem?-1:He(o,e,1),isOpen:!0};break;case 2:if(e.isOpen&&r)n=u({isOpen:Pe(o,"isOpen"),highlightedIndex:Pe(o,"highlightedIndex")},e.highlightedIndex>=0&&{selectedItem:o.items[e.highlightedIndex]});else n={highlightedIndex:e.isOpen?re(-1,e.highlightedIndex,o.items.length,t.getItemNodeFromIndex,!1):He(o,e,-1),isOpen:!0};break;case 7:case 8:n=u({isOpen:Pe(o,"isOpen"),highlightedIndex:Pe(o,"highlightedIndex")},e.highlightedIndex>=0&&{selectedItem:o.items[e.highlightedIndex]});break;case 5:n={highlightedIndex:ue(1,0,o.items.length,t.getItemNodeFromIndex,!1),isOpen:!0};break;case 6:n={highlightedIndex:ue(-1,o.items.length-1,o.items.length,t.getItemNodeFromIndex,!1),isOpen:!0};break;case 9:n={highlightedIndex:re(-10,e.highlightedIndex,o.items.length,t.getItemNodeFromIndex,!1)};break;case 10:n={highlightedIndex:re(10,e.highlightedIndex,o.items.length,t.getItemNodeFromIndex,!1)};break;case 4:n={isOpen:!1,highlightedIndex:-1};break;case 11:n=u({isOpen:!1,highlightedIndex:-1},e.highlightedIndex>=0&&{selectedItem:o.items[e.highlightedIndex]});break;case 19:n={selectedItem:t.selectedItem};break;default:return Le(e,t,$e)}return u({},e,n)}var ze=["onMouseLeave","refKey","onKeyDown","onBlur","ref"],qe=["onBlur","onClick","onKeyDown","refKey","ref"],Xe=["item","index","onMouseMove","onClick","refKey","ref","disabled"];function Ye(e){void 0===e&&(e={}),Ue();var n=u({},je,e),i=n.items,o=n.scrollIntoView,s=n.environment,l=n.itemToString,a=n.getA11ySelectionMessage,d=n.getA11yStatusMessage,c=Ee(We,Re(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),x=t.useRef({}),b=t.useRef(null),w=ke(n),S=t.useRef(),k=t.useRef(!0),C=Me({state:p,props:n}),O=t.useCallback((function(e){return x.current[w.getItemId(e)]}),[w]);Ne(d,[g,h,I,i],u({isInitialMount:k.current,previousResultCount:S.current,items:i,environment:s,itemToString:l},p)),Ne(a,[m],u({isInitialMount:k.current,previousResultCount:S.current,items:i,environment:s,itemToString:l},p));var M=Ae({menuElement:y.current,highlightedIndex:h,isOpen:g,itemRefs:x,scrollIntoView:o,getItemNodeFromIndex:O});t.useEffect((function(){return b.current=X((function(e){e({type:20,inputValue:""})}),500),function(){b.current.cancel()}}),[]),t.useEffect((function(){I&&b.current(f)}),[f,I]),Be({isInitialMount:k.current,props:n,state:p}),t.useEffect((function(){k.current||(S.current=i.length)}));var D=Fe(g,[y,v],s,(function(){f({type:11})})),E=Ve();t.useEffect((function(){return k.current=!1,function(){k.current=!0}}),[]),t.useEffect((function(){g||(x.current={})}),[g]);var K=t.useMemo((function(){return{ArrowDown:function(e){e.preventDefault(),f({type:1,getItemNodeFromIndex:O,altKey:e.altKey})},ArrowUp:function(e){e.preventDefault(),f({type:2,getItemNodeFromIndex:O,altKey:e.altKey})},Home:function(e){e.preventDefault(),f({type:5,getItemNodeFromIndex:O})},End:function(e){e.preventDefault(),f({type:6,getItemNodeFromIndex:O})},Escape:function(){C.current.state.isOpen&&f({type:4})},Enter:function(e){e.preventDefault(),f({type:C.current.state.isOpen?7:0})},PageUp:function(e){C.current.state.isOpen&&(e.preventDefault(),f({type:9,getItemNodeFromIndex:O}))},PageDown:function(e){C.current.state.isOpen&&(e.preventDefault(),f({type:10,getItemNodeFromIndex:O}))}," ":function(e){e.preventDefault();var t=C.current.state;t.isOpen?t.inputValue?f({type:3,key:" ",getItemNodeFromIndex:O}):f({type:8}):f({type:0})}}}),[f,O,C]),P=t.useCallback((function(){f({type:15})}),[f]),T=t.useCallback((function(){f({type:17})}),[f]),R=t.useCallback((function(){f({type:16})}),[f]),H=t.useCallback((function(e){f({type:18,highlightedIndex:e})}),[f]),F=t.useCallback((function(e){f({type:19,selectedItem:e})}),[f]),V=t.useCallback((function(){f({type:21})}),[f]),N=t.useCallback((function(e){f({type:20,inputValue:e})}),[f]),A=t.useCallback((function(e){return u({id:w.labelId,htmlFor:w.toggleButtonId},e)}),[w]),B=t.useCallback((function(e,t){var n,i=void 0===e?{}:e,o=i.onMouseLeave,s=i.refKey,l=void 0===s?"ref":s;i.onKeyDown,i.onBlur;var a=i.ref,d=r(i,ze),c=(void 0===t?{}:t).suppressRefError;return E("getMenuProps",void 0!==c&&c,l,y),u(((n={})[l]=G(a,(function(e){y.current=e})),n.id=w.menuId,n.role="listbox",n["aria-labelledby"]=w.labelId,n.tabIndex=-1,n.onMouseLeave=Y(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,s=i.onClick,l=i.onKeyDown,a=i.refKey,d=void 0===a?"ref":a,c=i.ref,p=r(i,qe),g=(void 0===t?{}:t).suppressRefError,h=void 0!==g&&g,m=C.current.state,I=u(((n={})[d]=G(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"]=C.current.state.isOpen,n["aria-haspopup"]="listbox",n["aria-labelledby"]=""+w.labelId,n.id=w.toggleButtonId,n.role="combobox",n.tabIndex=0,n.onBlur=Y(o,(function(){m.isOpen&&!D.current.isMouseDown&&f({type:11})})),n),p);return p.disabled||(I.onClick=Y(s,(function(){f({type:0})})),I.onKeyDown=Y(l,(function(e){var t=oe(e);t&&K[t]?K[t](e):function(e){return/^\S{1}$/.test(e)}(t)&&f({type:3,key:t,getItemNodeFromIndex:O})}))),E("getToggleButtonProps",h,d,v),I}),[C,w,E,f,D,K,O]),getLabelProps:A,getMenuProps:B,getItemProps:t.useCallback((function(e){var t,n=void 0===e?{}:e,o=n.item,s=n.index,l=n.onMouseMove,a=n.onClick,d=n.refKey,c=void 0===d?"ref":d,p=n.ref,g=n.disabled,h=r(n,Xe),I=C.current,v=I.state,y=I.props,b=null!=o?o:i[s],S=Ce(s,b,y.items),k=Ce(S,b,y.items);if(k<0)throw new Error("Pass either item or item index in getItemProps!");var O=u(((t={disabled:g,role:"option","aria-selected":""+(b===m),id:w.getItemId(k)})[c]=G(p,(function(e){e&&(x.current[w.getItemId(k)]=e)})),t),h);return g||(O.onClick=Y(a,(function(){f({type:14,index:S})}))),O.onMouseMove=Y(l,(function(){S!==v.highlightedIndex&&(M.current=!1,f({type:13,index:S,disabled:g}))})),O}),[C,i,m,w,M,f]),toggleMenu:P,openMenu:R,closeMenu:T,setHighlightedIndex:H,selectItem:F,reset:V,setInputValue:N,highlightedIndex:h,isOpen:g,selectedItem:m,inputValue:I}}Ye.stateChangeTypes=$e;var Ge=Object.freeze({__proto__:null,InputKeyDownArrowDown:0,InputKeyDownArrowUp:1,InputKeyDownEscape:2,InputKeyDownHome:3,InputKeyDownEnd:4,InputKeyDownPageUp:5,InputKeyDownPageDown:6,InputKeyDownEnter:7,InputChange:8,InputBlur:9,InputFocus:10,MenuMouseLeave:11,ItemMouseMove:12,ItemClick:13,ToggleButtonClick:14,FunctionToggleMenu:15,FunctionOpenMenu:16,FunctionCloseMenu:17,FunctionSetHighlightedIndex:18,FunctionSelectItem:19,FunctionSetInputValue:20,FunctionReset:21,ControlledPropUpdatedSelectedItem:22});o.default.array.isRequired,o.default.func,o.default.func,o.default.func,o.default.number,o.default.number,o.default.number,o.default.bool,o.default.bool,o.default.bool,o.default.any,o.default.any,o.default.any,o.default.string,o.default.string,o.default.string,o.default.string,o.default.string,o.default.string,o.default.func,o.default.string,o.default.string,o.default.func,o.default.func,o.default.func,o.default.func,o.default.func,o.default.func,o.default.shape({addEventListener:o.default.func,removeEventListener:o.default.func,document:o.default.shape({getElementById:o.default.func,activeElement:o.default.any,body:o.default.any})});var Je=W,Qe=u({},Ke,{getA11yStatusMessage:Q});function Ze(e,t){var n,i=t.type,o=t.props,r=t.altKey;switch(i){case 13:n={isOpen:Pe(o,"isOpen"),highlightedIndex:Pe(o,"highlightedIndex"),selectedItem:o.items[t.index],inputValue:o.itemToString(o.items[t.index])};break;case 0:n=e.isOpen?{highlightedIndex:re(1,e.highlightedIndex,o.items.length,t.getItemNodeFromIndex,!0)}:{highlightedIndex:r&&null==e.selectedItem?-1:He(o,e,1,t.getItemNodeFromIndex),isOpen:o.items.length>=0};break;case 1:n=e.isOpen?r?u({isOpen:Pe(o,"isOpen"),highlightedIndex:Pe(o,"highlightedIndex")},e.highlightedIndex>=0&&{selectedItem:o.items[e.highlightedIndex],inputValue:o.itemToString(o.items[e.highlightedIndex])}):{highlightedIndex:re(-1,e.highlightedIndex,o.items.length,t.getItemNodeFromIndex,!0)}:{highlightedIndex:He(o,e,-1,t.getItemNodeFromIndex),isOpen:o.items.length>=0};break;case 7:n=u({isOpen:Pe(o,"isOpen"),highlightedIndex:Pe(o,"highlightedIndex")},e.highlightedIndex>=0&&{selectedItem:o.items[e.highlightedIndex],inputValue:o.itemToString(o.items[e.highlightedIndex])});break;case 2:n=u({isOpen:!1,highlightedIndex:-1},!e.isOpen&&{selectedItem:null,inputValue:""});break;case 5:n={highlightedIndex:re(-10,e.highlightedIndex,o.items.length,t.getItemNodeFromIndex,!1)};break;case 6:n={highlightedIndex:re(10,e.highlightedIndex,o.items.length,t.getItemNodeFromIndex,!1)};break;case 3:n={highlightedIndex:ue(1,0,o.items.length,t.getItemNodeFromIndex,!1)};break;case 4:n={highlightedIndex:ue(-1,o.items.length-1,o.items.length,t.getItemNodeFromIndex,!1)};break;case 9:n=u({isOpen:!1,highlightedIndex:-1},e.highlightedIndex>=0&&t.selectItem&&{selectedItem:o.items[e.highlightedIndex],inputValue:o.itemToString(o.items[e.highlightedIndex])});break;case 8:n={isOpen:!0,highlightedIndex:Pe(o,"highlightedIndex"),inputValue:t.inputValue};break;case 10:n={isOpen:!0,highlightedIndex:He(o,e,0)};break;case 19:n={selectedItem:t.selectedItem,inputValue:o.itemToString(t.selectedItem)};break;case 22:n={inputValue:t.inputValue};break;default:return Le(e,t,Ge)}return u({},e,n)}var et=["onMouseLeave","refKey","ref"],tt=["item","index","refKey","ref","onMouseMove","onMouseDown","onClick","onPress","disabled"],nt=["onClick","onPress","refKey","ref"],it=["onKeyDown","onChange","onInput","onFocus","onBlur","onChangeText","refKey","ref"];function ot(e){void 0===e&&(e={}),Je();var n=u({},Qe,e),i=n.initialIsOpen,o=n.defaultIsOpen,s=n.items,l=n.scrollIntoView,a=n.environment,d=n.getA11yStatusMessage,c=n.getA11ySelectionMessage,p=n.itemToString,f=function(e){var t=Re(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)),u({},t,{inputValue:i})}(n),g=function(e,n,i){var o=t.useRef(),r=De(e,n,i),u=r[0],s=r[1];return t.useEffect((function(){ie(i,"selectedItem")&&(o.current!==i.selectedItem&&s({type:22,inputValue:i.itemToString(i.selectedItem)}),o.current=u.selectedItem===o.current?i.selectedItem:u.selectedItem)})),[ne(u,i),s]}(Ze,f,n),h=g[0],m=g[1],I=h.isOpen,v=h.highlightedIndex,y=h.selectedItem,x=h.inputValue,b=t.useRef(null),w=t.useRef({}),S=t.useRef(null),k=t.useRef(null),C=t.useRef(!0),O=ke(n),M=t.useRef(),D=Me({state:h,props:n}),E=t.useCallback((function(e){return w.current[O.getItemId(e)]}),[O]);Ne(d,[I,v,x,s],u({isInitialMount:C.current,previousResultCount:M.current,items:s,environment:a,itemToString:p},h)),Ne(c,[y],u({isInitialMount:C.current,previousResultCount:M.current,items:s,environment:a,itemToString:p},h));var K=Ae({menuElement:b.current,highlightedIndex:v,isOpen:I,itemRefs:w,scrollIntoView:l,getItemNodeFromIndex:E});Be({isInitialMount:C.current,props:n,state:h}),t.useEffect((function(){(i||o||I)&&S.current&&S.current.focus()}),[]),t.useEffect((function(){C.current||(M.current=s.length)}));var P=Fe(I,[S,b,k],a,(function(){m({type:9,selectItem:!1})})),T=Ve();t.useEffect((function(){return C.current=!1,function(){C.current=!0}}),[]),t.useEffect((function(){if(I){if(document.activeElement!==S.current){var e;null==S||null==(e=S.current)||e.focus()}}else w.current={}}),[I]);var R=t.useMemo((function(){return{ArrowDown:function(e){e.preventDefault(),m({type:0,altKey:e.altKey,getItemNodeFromIndex:E})},ArrowUp:function(e){e.preventDefault(),m({type:1,altKey:e.altKey,getItemNodeFromIndex:E})},Home:function(e){D.current.state.isOpen&&(e.preventDefault(),m({type:3,getItemNodeFromIndex:E}))},End:function(e){D.current.state.isOpen&&(e.preventDefault(),m({type:4,getItemNodeFromIndex:E}))},Escape:function(e){var t=D.current.state;(t.isOpen||t.inputValue||t.selectedItem||t.highlightedIndex>-1)&&(e.preventDefault(),m({type:2}))},Enter:function(e){D.current.state.isOpen&&229!==e.which&&(e.preventDefault(),m({type:7,getItemNodeFromIndex:E}))},PageUp:function(e){D.current.state.isOpen&&(e.preventDefault(),m({type:5,getItemNodeFromIndex:E}))},PageDown:function(e){D.current.state.isOpen&&(e.preventDefault(),m({type:6,getItemNodeFromIndex:E}))}}}),[m,D,E]),H=t.useCallback((function(e){return u({id:O.labelId,htmlFor:O.inputId},e)}),[O]),F=t.useCallback((function(e,t){var n,i=void 0===e?{}:e,o=i.onMouseLeave,s=i.refKey,l=void 0===s?"ref":s,a=i.ref,d=r(i,et),c=(void 0===t?{}:t).suppressRefError;return T("getMenuProps",void 0!==c&&c,l,b),u(((n={})[l]=G(a,(function(e){b.current=e})),n.id=O.menuId,n.role="listbox",n["aria-labelledby"]=O.labelId,n.onMouseLeave=Y(o,(function(){m({type:11})})),n),d)}),[m,T,O]),V=t.useCallback((function(e){var t,n,i=void 0===e?{}:e,o=i.item,s=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=r(i,tt),I=D.current,v=I.props,y=I.state,x=Ce(s,o,v.items);if(x<0)throw new Error("Pass either item or item index in getItemProps!");var b=f;return u(((t={})[a]=G(d,(function(e){e&&(w.current[O.getItemId(x)]=e)})),t.disabled=g,t.role="option",t["aria-selected"]=""+(x===y.highlightedIndex),t.id=O.getItemId(x),t),!g&&((n={}).onClick=Y(b,(function(){m({type:13,index:s})})),n),{onMouseMove:Y(c,(function(){s!==y.highlightedIndex&&(K.current=!1,m({type:12,index:s,disabled:g}))})),onMouseDown:Y(p,(function(e){return e.preventDefault()}))},h)}),[m,D,K,O]),N=t.useCallback((function(e){var t,n=void 0===e?{}:e,i=n.onClick;n.onPress;var o=n.refKey,s=void 0===o?"ref":o,l=n.ref,a=r(n,nt),d=D.current.state;return u(((t={})[s]=G(l,(function(e){k.current=e})),t["aria-controls"]=O.menuId,t["aria-expanded"]=d.isOpen,t.id=O.toggleButtonId,t.tabIndex=-1,t),!a.disabled&&u({},{onClick:Y(i,(function(){m({type:14})}))}),a)}),[m,D,O]),A=t.useCallback((function(e,t){var n,i=void 0===e?{}:e,o=i.onKeyDown,s=i.onChange,l=i.onInput,a=i.onFocus,d=i.onBlur;i.onChangeText;var c=i.refKey,p=void 0===c?"ref":c,f=i.ref,g=r(i,it),h=(void 0===t?{}:t).suppressRefError;T("getInputProps",void 0!==h&&h,p,S);var I,v=D.current.state,y={};g.disabled||((I={}).onInput=Y(s,l,(function(e){m({type:8,inputValue:e.target.value})})),I.onKeyDown=Y(o,(function(e){var t=oe(e);t&&R[t]&&R[t](e)})),I.onBlur=Y(d,(function(){v.isOpen&&!P.current.isMouseDown&&m({type:9,selectItem:!0})})),I.onFocus=Y(a,(function(){v.isOpen||m({type:10})})),y=I);return u(((n={})[p]=G(f,(function(e){S.current=e})),n["aria-activedescendant"]=v.isOpen&&v.highlightedIndex>-1?O.getItemId(v.highlightedIndex):"",n["aria-autocomplete"]="list",n["aria-controls"]=O.menuId,n["aria-expanded"]=v.isOpen,n["aria-labelledby"]=O.labelId,n.autoComplete="off",n.id=O.inputId,n.role="combobox",n.value=v.inputValue,n),y,g)}),[m,R,D,P,T,O]),B=t.useCallback((function(){m({type:15})}),[m]),L=t.useCallback((function(){m({type:17})}),[m]),_=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:19,selectedItem:e})}),[m]);return{getItemProps:V,getLabelProps:H,getMenuProps:F,getInputProps:A,getToggleButtonProps:N,toggleMenu:B,openMenu:_,closeMenu:L,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:x}}ot.stateChangeTypes=Ge;var rt={activeIndex:-1,selectedItems:[]};function ut(e,t){return Te(e,t,rt)}function st(e,t){return Pe(e,t,rt)}function lt(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}o.default.array,o.default.array,o.default.array,o.default.func,o.default.func,o.default.func,o.default.number,o.default.number,o.default.number,o.default.func,o.default.func,o.default.string,o.default.string,o.default.shape({addEventListener:o.default.func,removeEventListener:o.default.func,document:o.default.shape({getElementById:o.default.func,activeElement:o.default.any,body:o.default.any})});var at={itemToString:Ke.itemToString,stateReducer:Ke.stateReducer,environment:Ke.environment,getA11yRemovalMessage:function(e){var t=e.removedSelectedItem;return(0,e.itemToString)(t)+" has been removed."},keyNavigationNext:"ArrowRight",keyNavigationPrevious:"ArrowLeft"},dt=W,ct=Object.freeze({__proto__:null,SelectedItemClick:0,SelectedItemKeyDownDelete:1,SelectedItemKeyDownBackspace:2,SelectedItemKeyDownNavigationNext:3,SelectedItemKeyDownNavigationPrevious:4,DropdownKeyDownNavigationPrevious:5,DropdownKeyDownBackspace:6,DropdownClick:7,FunctionAddSelectedItem:8,FunctionRemoveSelectedItem:9,FunctionSetSelectedItems:10,FunctionSetActiveIndex:11,FunctionReset:12});function pt(e,t){var n,i=t.type,o=t.index,r=t.props,s=t.selectedItem,l=e.activeIndex,a=e.selectedItems;switch(i){case 0:n={activeIndex:o};break;case 4:n={activeIndex:l-1<0?0:l-1};break;case 3:n={activeIndex:l+1>=a.length?-1:l+1};break;case 2:case 1:if(l<0)break;var d=l;1===a.length?d=-1:l===a.length-1&&(d=a.length-2),n=u({selectedItems:[].concat(a.slice(0,l),a.slice(l+1))},{activeIndex:d});break;case 5:n={activeIndex:a.length-1};break;case 6:n={selectedItems:a.slice(0,a.length-1)};break;case 8:n={selectedItems:[].concat(a,[s])};break;case 7:n={activeIndex:-1};break;case 9:var c=l,p=a.indexOf(s);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 10:n={selectedItems:t.selectedItems};break;case 11:n={activeIndex:t.activeIndex};break;case 12:n={activeIndex:st(r,"activeIndex"),selectedItems:st(r,"selectedItems")};break;default:throw new Error("Reducer called without proper action type.")}return u({},e,n)}var ft=["refKey","ref","onClick","onKeyDown","selectedItem","index"],gt=["refKey","ref","onKeyDown","onClick","preventKeyAction"];function ht(e){void 0===e&&(e={}),dt();var n=u({},at,e),i=n.getA11yRemovalMessage,o=n.itemToString,s=n.environment,l=n.keyNavigationNext,a=n.keyNavigationPrevious,d=Ee(pt,function(e){return{activeIndex:ut(e,"activeIndex"),selectedItems:ut(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=Me({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}));ae(i({itemToString:o,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]),Be({isInitialMount:h.current,props:n,state:c});var x=Ve();t.useEffect((function(){return h.current=!1,function(){h.current=!0}}),[]);var b=t.useMemo((function(){var e;return(e={})[a]=function(){p({type:4})},e[l]=function(){p({type:3})},e.Delete=function(){p({type:1})},e.Backspace=function(){p({type:2})},e}),[p,l,a]),w=t.useMemo((function(){var e;return(e={})[a]=function(e){lt(e)&&p({type:5})},e.Backspace=function(e){lt(e)&&p({type:6})},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,s=n.ref,l=n.onClick,a=n.onKeyDown,d=n.selectedItem,c=n.index,f=r(n,ft),g=y.current.state;if(Ce(c,d,g.selectedItems)<0)throw new Error("Pass either selectedItem or index in getSelectedItemProps!");return u(((t={})[o]=G(s,(function(e){e&&v.current.push(e)})),t.tabIndex=c===g.activeIndex?0:-1,t.onClick=Y(l,(function(){p({type:0,index:c})})),t.onKeyDown=Y(a,(function(e){var t=oe(e);t&&b[t]&&b[t](e)})),t),f)}),[p,y,b]),getDropdownProps:t.useCallback((function(e,t){var n,i=void 0===e?{}:e,o=i.refKey,s=void 0===o?"ref":o,l=i.ref,a=i.onKeyDown,d=i.onClick,c=i.preventKeyAction,f=void 0!==c&&c,g=r(i,gt),h=(void 0===t?{}:t).suppressRefError;return x("getDropdownProps",void 0!==h&&h,s,m),u(((n={})[s]=G(l,(function(e){e&&(m.current=e)})),n),!f&&{onKeyDown:Y(a,(function(e){var t=oe(e);t&&w[t]&&w[t](e)})),onClick:Y(d,(function(){p({type:7})}))},g)}),[p,w,x]),addSelectedItem:t.useCallback((function(e){p({type:8,selectedItem:e})}),[p]),removeSelectedItem:t.useCallback((function(e){p({type:9,selectedItem:e})}),[p]),setSelectedItems:t.useCallback((function(e){p({type:10,selectedItems:e})}),[p]),setActiveIndex:t.useCallback((function(e){p({type:11,activeIndex:e})}),[p]),reset:t.useCallback((function(){p({type:12})}),[p]),selectedItems:g,activeIndex:f}}ht.stateChangeTypes=ct,e.default=ve,e.resetIdCounter=function(){U=0},e.useCombobox=ot,e.useMultipleSelection=ht,e.useSelect=Ye,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 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
2571081
28763