UNPKG

246 kBSource Map (JSON)View Raw
1{"version":3,"file":"downshift.umd.min.js","sources":["../node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js","../node_modules/@babel/runtime/helpers/esm/extends.js","../node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js","../node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js","../node_modules/prop-types/node_modules/react-is/cjs/react-is.production.min.js","../node_modules/object-assign/index.js","../node_modules/prop-types/factoryWithTypeCheckers.js","../node_modules/prop-types/factoryWithThrowingShims.js","../node_modules/prop-types/index.js","../node_modules/prop-types/lib/ReactPropTypesSecret.js","../node_modules/react-is/cjs/react-is.production.min.js","../node_modules/compute-scroll-into-view/dist/index.module.js","../src/utils.js","../src/set-a11y-status.js","../src/stateChangeTypes.js","../src/downshift.js","../node_modules/@babel/runtime/helpers/esm/inheritsLoose.js","../src/hooks/utils.js","../src/hooks/reducer.js","../node_modules/tslib/tslib.es6.js","../../src/hooks/useSelect/utils.ts","../src/hooks/useSelect/reducer.js","../src/hooks/useSelect/index.js","../src/hooks/useCombobox/stateChangeTypes.js","../src/hooks/useCombobox/utils.js","../src/hooks/useCombobox/reducer.js","../src/hooks/useCombobox/index.js","../src/hooks/useMultipleSelection/utils.js","../src/hooks/useMultipleSelection/reducer.js","../src/hooks/useMultipleSelection/index.js"],"sourcesContent":["export default function _objectWithoutPropertiesLoose(source, excluded) {\n if (source == null) return {};\n var target = {};\n var sourceKeys = Object.keys(source);\n var key, i;\n\n for (i = 0; i < sourceKeys.length; i++) {\n key = sourceKeys[i];\n if (excluded.indexOf(key) >= 0) continue;\n target[key] = source[key];\n }\n\n return target;\n}","export default function _extends() {\n _extends = Object.assign || function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n\n return target;\n };\n\n return _extends.apply(this, arguments);\n}","export default function _assertThisInitialized(self) {\n if (self === void 0) {\n throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\");\n }\n\n return self;\n}","export default function _setPrototypeOf(o, p) {\n _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {\n o.__proto__ = p;\n return o;\n };\n\n return _setPrototypeOf(o, p);\n}","/** @license React v16.13.1\n * react-is.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n'use strict';var b=\"function\"===typeof Symbol&&Symbol.for,c=b?Symbol.for(\"react.element\"):60103,d=b?Symbol.for(\"react.portal\"):60106,e=b?Symbol.for(\"react.fragment\"):60107,f=b?Symbol.for(\"react.strict_mode\"):60108,g=b?Symbol.for(\"react.profiler\"):60114,h=b?Symbol.for(\"react.provider\"):60109,k=b?Symbol.for(\"react.context\"):60110,l=b?Symbol.for(\"react.async_mode\"):60111,m=b?Symbol.for(\"react.concurrent_mode\"):60111,n=b?Symbol.for(\"react.forward_ref\"):60112,p=b?Symbol.for(\"react.suspense\"):60113,q=b?\nSymbol.for(\"react.suspense_list\"):60120,r=b?Symbol.for(\"react.memo\"):60115,t=b?Symbol.for(\"react.lazy\"):60116,v=b?Symbol.for(\"react.block\"):60121,w=b?Symbol.for(\"react.fundamental\"):60117,x=b?Symbol.for(\"react.responder\"):60118,y=b?Symbol.for(\"react.scope\"):60119;\nfunction z(a){if(\"object\"===typeof a&&null!==a){var u=a.$$typeof;switch(u){case c:switch(a=a.type,a){case l:case m:case e:case g:case f:case p:return a;default:switch(a=a&&a.$$typeof,a){case k:case n:case t:case r:case h:return a;default:return u}}case d:return u}}}function A(a){return z(a)===m}exports.AsyncMode=l;exports.ConcurrentMode=m;exports.ContextConsumer=k;exports.ContextProvider=h;exports.Element=c;exports.ForwardRef=n;exports.Fragment=e;exports.Lazy=t;exports.Memo=r;exports.Portal=d;\nexports.Profiler=g;exports.StrictMode=f;exports.Suspense=p;exports.isAsyncMode=function(a){return A(a)||z(a)===l};exports.isConcurrentMode=A;exports.isContextConsumer=function(a){return z(a)===k};exports.isContextProvider=function(a){return z(a)===h};exports.isElement=function(a){return\"object\"===typeof a&&null!==a&&a.$$typeof===c};exports.isForwardRef=function(a){return z(a)===n};exports.isFragment=function(a){return z(a)===e};exports.isLazy=function(a){return z(a)===t};\nexports.isMemo=function(a){return z(a)===r};exports.isPortal=function(a){return z(a)===d};exports.isProfiler=function(a){return z(a)===g};exports.isStrictMode=function(a){return z(a)===f};exports.isSuspense=function(a){return z(a)===p};\nexports.isValidElementType=function(a){return\"string\"===typeof a||\"function\"===typeof a||a===e||a===m||a===g||a===f||a===p||a===q||\"object\"===typeof a&&null!==a&&(a.$$typeof===t||a.$$typeof===r||a.$$typeof===h||a.$$typeof===k||a.$$typeof===n||a.$$typeof===w||a.$$typeof===x||a.$$typeof===y||a.$$typeof===v)};exports.typeOf=z;\n","/*\nobject-assign\n(c) Sindre Sorhus\n@license MIT\n*/\n\n'use strict';\n/* eslint-disable no-unused-vars */\nvar getOwnPropertySymbols = Object.getOwnPropertySymbols;\nvar hasOwnProperty = Object.prototype.hasOwnProperty;\nvar propIsEnumerable = Object.prototype.propertyIsEnumerable;\n\nfunction toObject(val) {\n\tif (val === null || val === undefined) {\n\t\tthrow new TypeError('Object.assign cannot be called with null or undefined');\n\t}\n\n\treturn Object(val);\n}\n\nfunction shouldUseNative() {\n\ttry {\n\t\tif (!Object.assign) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// Detect buggy property enumeration order in older V8 versions.\n\n\t\t// https://bugs.chromium.org/p/v8/issues/detail?id=4118\n\t\tvar test1 = new String('abc'); // eslint-disable-line no-new-wrappers\n\t\ttest1[5] = 'de';\n\t\tif (Object.getOwnPropertyNames(test1)[0] === '5') {\n\t\t\treturn false;\n\t\t}\n\n\t\t// https://bugs.chromium.org/p/v8/issues/detail?id=3056\n\t\tvar test2 = {};\n\t\tfor (var i = 0; i < 10; i++) {\n\t\t\ttest2['_' + String.fromCharCode(i)] = i;\n\t\t}\n\t\tvar order2 = Object.getOwnPropertyNames(test2).map(function (n) {\n\t\t\treturn test2[n];\n\t\t});\n\t\tif (order2.join('') !== '0123456789') {\n\t\t\treturn false;\n\t\t}\n\n\t\t// https://bugs.chromium.org/p/v8/issues/detail?id=3056\n\t\tvar test3 = {};\n\t\t'abcdefghijklmnopqrst'.split('').forEach(function (letter) {\n\t\t\ttest3[letter] = letter;\n\t\t});\n\t\tif (Object.keys(Object.assign({}, test3)).join('') !==\n\t\t\t\t'abcdefghijklmnopqrst') {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn true;\n\t} catch (err) {\n\t\t// We don't expect any of the above to throw, but better to be safe.\n\t\treturn false;\n\t}\n}\n\nmodule.exports = shouldUseNative() ? Object.assign : function (target, source) {\n\tvar from;\n\tvar to = toObject(target);\n\tvar symbols;\n\n\tfor (var s = 1; s < arguments.length; s++) {\n\t\tfrom = Object(arguments[s]);\n\n\t\tfor (var key in from) {\n\t\t\tif (hasOwnProperty.call(from, key)) {\n\t\t\t\tto[key] = from[key];\n\t\t\t}\n\t\t}\n\n\t\tif (getOwnPropertySymbols) {\n\t\t\tsymbols = getOwnPropertySymbols(from);\n\t\t\tfor (var i = 0; i < symbols.length; i++) {\n\t\t\t\tif (propIsEnumerable.call(from, symbols[i])) {\n\t\t\t\t\tto[symbols[i]] = from[symbols[i]];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\treturn to;\n};\n","/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n'use strict';\n\nvar ReactIs = require('react-is');\nvar assign = require('object-assign');\n\nvar ReactPropTypesSecret = require('./lib/ReactPropTypesSecret');\nvar checkPropTypes = require('./checkPropTypes');\n\nvar has = Function.call.bind(Object.prototype.hasOwnProperty);\nvar printWarning = function() {};\n\nif (process.env.NODE_ENV !== 'production') {\n printWarning = function(text) {\n var message = 'Warning: ' + text;\n if (typeof console !== 'undefined') {\n console.error(message);\n }\n try {\n // --- Welcome to debugging React ---\n // This error was thrown as a convenience so that you can use this stack\n // to find the callsite that caused this warning to fire.\n throw new Error(message);\n } catch (x) {}\n };\n}\n\nfunction emptyFunctionThatReturnsNull() {\n return null;\n}\n\nmodule.exports = function(isValidElement, throwOnDirectAccess) {\n /* global Symbol */\n var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;\n var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec.\n\n /**\n * Returns the iterator method function contained on the iterable object.\n *\n * Be sure to invoke the function with the iterable as context:\n *\n * var iteratorFn = getIteratorFn(myIterable);\n * if (iteratorFn) {\n * var iterator = iteratorFn.call(myIterable);\n * ...\n * }\n *\n * @param {?object} maybeIterable\n * @return {?function}\n */\n function getIteratorFn(maybeIterable) {\n var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]);\n if (typeof iteratorFn === 'function') {\n return iteratorFn;\n }\n }\n\n /**\n * Collection of methods that allow declaration and validation of props that are\n * supplied to React components. Example usage:\n *\n * var Props = require('ReactPropTypes');\n * var MyArticle = React.createClass({\n * propTypes: {\n * // An optional string prop named \"description\".\n * description: Props.string,\n *\n * // A required enum prop named \"category\".\n * category: Props.oneOf(['News','Photos']).isRequired,\n *\n * // A prop named \"dialog\" that requires an instance of Dialog.\n * dialog: Props.instanceOf(Dialog).isRequired\n * },\n * render: function() { ... }\n * });\n *\n * A more formal specification of how these methods are used:\n *\n * type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...)\n * decl := ReactPropTypes.{type}(.isRequired)?\n *\n * Each and every declaration produces a function with the same signature. This\n * allows the creation of custom validation functions. For example:\n *\n * var MyLink = React.createClass({\n * propTypes: {\n * // An optional string or URI prop named \"href\".\n * href: function(props, propName, componentName) {\n * var propValue = props[propName];\n * if (propValue != null && typeof propValue !== 'string' &&\n * !(propValue instanceof URI)) {\n * return new Error(\n * 'Expected a string or an URI for ' + propName + ' in ' +\n * componentName\n * );\n * }\n * }\n * },\n * render: function() {...}\n * });\n *\n * @internal\n */\n\n var ANONYMOUS = '<<anonymous>>';\n\n // Important!\n // Keep this list in sync with production version in `./factoryWithThrowingShims.js`.\n var ReactPropTypes = {\n array: createPrimitiveTypeChecker('array'),\n bool: createPrimitiveTypeChecker('boolean'),\n func: createPrimitiveTypeChecker('function'),\n number: createPrimitiveTypeChecker('number'),\n object: createPrimitiveTypeChecker('object'),\n string: createPrimitiveTypeChecker('string'),\n symbol: createPrimitiveTypeChecker('symbol'),\n\n any: createAnyTypeChecker(),\n arrayOf: createArrayOfTypeChecker,\n element: createElementTypeChecker(),\n elementType: createElementTypeTypeChecker(),\n instanceOf: createInstanceTypeChecker,\n node: createNodeChecker(),\n objectOf: createObjectOfTypeChecker,\n oneOf: createEnumTypeChecker,\n oneOfType: createUnionTypeChecker,\n shape: createShapeTypeChecker,\n exact: createStrictShapeTypeChecker,\n };\n\n /**\n * inlined Object.is polyfill to avoid requiring consumers ship their own\n * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is\n */\n /*eslint-disable no-self-compare*/\n function is(x, y) {\n // SameValue algorithm\n if (x === y) {\n // Steps 1-5, 7-10\n // Steps 6.b-6.e: +0 != -0\n return x !== 0 || 1 / x === 1 / y;\n } else {\n // Step 6.a: NaN == NaN\n return x !== x && y !== y;\n }\n }\n /*eslint-enable no-self-compare*/\n\n /**\n * We use an Error-like object for backward compatibility as people may call\n * PropTypes directly and inspect their output. However, we don't use real\n * Errors anymore. We don't inspect their stack anyway, and creating them\n * is prohibitively expensive if they are created too often, such as what\n * happens in oneOfType() for any type before the one that matched.\n */\n function PropTypeError(message) {\n this.message = message;\n this.stack = '';\n }\n // Make `instanceof Error` still work for returned errors.\n PropTypeError.prototype = Error.prototype;\n\n function createChainableTypeChecker(validate) {\n if (process.env.NODE_ENV !== 'production') {\n var manualPropTypeCallCache = {};\n var manualPropTypeWarningCount = 0;\n }\n function checkType(isRequired, props, propName, componentName, location, propFullName, secret) {\n componentName = componentName || ANONYMOUS;\n propFullName = propFullName || propName;\n\n if (secret !== ReactPropTypesSecret) {\n if (throwOnDirectAccess) {\n // New behavior only for users of `prop-types` package\n var err = new Error(\n 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +\n 'Use `PropTypes.checkPropTypes()` to call them. ' +\n 'Read more at http://fb.me/use-check-prop-types'\n );\n err.name = 'Invariant Violation';\n throw err;\n } else if (process.env.NODE_ENV !== 'production' && typeof console !== 'undefined') {\n // Old behavior for people using React.PropTypes\n var cacheKey = componentName + ':' + propName;\n if (\n !manualPropTypeCallCache[cacheKey] &&\n // Avoid spamming the console because they are often not actionable except for lib authors\n manualPropTypeWarningCount < 3\n ) {\n printWarning(\n 'You are manually calling a React.PropTypes validation ' +\n 'function for the `' + propFullName + '` prop on `' + componentName + '`. This is deprecated ' +\n 'and will throw in the standalone `prop-types` package. ' +\n 'You may be seeing this warning due to a third-party PropTypes ' +\n 'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.'\n );\n manualPropTypeCallCache[cacheKey] = true;\n manualPropTypeWarningCount++;\n }\n }\n }\n if (props[propName] == null) {\n if (isRequired) {\n if (props[propName] === null) {\n return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.'));\n }\n return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.'));\n }\n return null;\n } else {\n return validate(props, propName, componentName, location, propFullName);\n }\n }\n\n var chainedCheckType = checkType.bind(null, false);\n chainedCheckType.isRequired = checkType.bind(null, true);\n\n return chainedCheckType;\n }\n\n function createPrimitiveTypeChecker(expectedType) {\n function validate(props, propName, componentName, location, propFullName, secret) {\n var propValue = props[propName];\n var propType = getPropType(propValue);\n if (propType !== expectedType) {\n // `propValue` being instance of, say, date/regexp, pass the 'object'\n // check, but we can offer a more precise error message here rather than\n // 'of type `object`'.\n var preciseType = getPreciseType(propValue);\n\n return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'));\n }\n return null;\n }\n return createChainableTypeChecker(validate);\n }\n\n function createAnyTypeChecker() {\n return createChainableTypeChecker(emptyFunctionThatReturnsNull);\n }\n\n function createArrayOfTypeChecker(typeChecker) {\n function validate(props, propName, componentName, location, propFullName) {\n if (typeof typeChecker !== 'function') {\n return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.');\n }\n var propValue = props[propName];\n if (!Array.isArray(propValue)) {\n var propType = getPropType(propValue);\n return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.'));\n }\n for (var i = 0; i < propValue.length; i++) {\n var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', ReactPropTypesSecret);\n if (error instanceof Error) {\n return error;\n }\n }\n return null;\n }\n return createChainableTypeChecker(validate);\n }\n\n function createElementTypeChecker() {\n function validate(props, propName, componentName, location, propFullName) {\n var propValue = props[propName];\n if (!isValidElement(propValue)) {\n var propType = getPropType(propValue);\n return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement.'));\n }\n return null;\n }\n return createChainableTypeChecker(validate);\n }\n\n function createElementTypeTypeChecker() {\n function validate(props, propName, componentName, location, propFullName) {\n var propValue = props[propName];\n if (!ReactIs.isValidElementType(propValue)) {\n var propType = getPropType(propValue);\n return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement type.'));\n }\n return null;\n }\n return createChainableTypeChecker(validate);\n }\n\n function createInstanceTypeChecker(expectedClass) {\n function validate(props, propName, componentName, location, propFullName) {\n if (!(props[propName] instanceof expectedClass)) {\n var expectedClassName = expectedClass.name || ANONYMOUS;\n var actualClassName = getClassName(props[propName]);\n return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.'));\n }\n return null;\n }\n return createChainableTypeChecker(validate);\n }\n\n function createEnumTypeChecker(expectedValues) {\n if (!Array.isArray(expectedValues)) {\n if (process.env.NODE_ENV !== 'production') {\n if (arguments.length > 1) {\n printWarning(\n 'Invalid arguments supplied to oneOf, expected an array, got ' + arguments.length + ' arguments. ' +\n 'A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).'\n );\n } else {\n printWarning('Invalid argument supplied to oneOf, expected an array.');\n }\n }\n return emptyFunctionThatReturnsNull;\n }\n\n function validate(props, propName, componentName, location, propFullName) {\n var propValue = props[propName];\n for (var i = 0; i < expectedValues.length; i++) {\n if (is(propValue, expectedValues[i])) {\n return null;\n }\n }\n\n var valuesString = JSON.stringify(expectedValues, function replacer(key, value) {\n var type = getPreciseType(value);\n if (type === 'symbol') {\n return String(value);\n }\n return value;\n });\n return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + String(propValue) + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.'));\n }\n return createChainableTypeChecker(validate);\n }\n\n function createObjectOfTypeChecker(typeChecker) {\n function validate(props, propName, componentName, location, propFullName) {\n if (typeof typeChecker !== 'function') {\n return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.');\n }\n var propValue = props[propName];\n var propType = getPropType(propValue);\n if (propType !== 'object') {\n return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.'));\n }\n for (var key in propValue) {\n if (has(propValue, key)) {\n var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);\n if (error instanceof Error) {\n return error;\n }\n }\n }\n return null;\n }\n return createChainableTypeChecker(validate);\n }\n\n function createUnionTypeChecker(arrayOfTypeCheckers) {\n if (!Array.isArray(arrayOfTypeCheckers)) {\n process.env.NODE_ENV !== 'production' ? printWarning('Invalid argument supplied to oneOfType, expected an instance of array.') : void 0;\n return emptyFunctionThatReturnsNull;\n }\n\n for (var i = 0; i < arrayOfTypeCheckers.length; i++) {\n var checker = arrayOfTypeCheckers[i];\n if (typeof checker !== 'function') {\n printWarning(\n 'Invalid argument supplied to oneOfType. Expected an array of check functions, but ' +\n 'received ' + getPostfixForTypeWarning(checker) + ' at index ' + i + '.'\n );\n return emptyFunctionThatReturnsNull;\n }\n }\n\n function validate(props, propName, componentName, location, propFullName) {\n for (var i = 0; i < arrayOfTypeCheckers.length; i++) {\n var checker = arrayOfTypeCheckers[i];\n if (checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret) == null) {\n return null;\n }\n }\n\n return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`.'));\n }\n return createChainableTypeChecker(validate);\n }\n\n function createNodeChecker() {\n function validate(props, propName, componentName, location, propFullName) {\n if (!isNode(props[propName])) {\n return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.'));\n }\n return null;\n }\n return createChainableTypeChecker(validate);\n }\n\n function createShapeTypeChecker(shapeTypes) {\n function validate(props, propName, componentName, location, propFullName) {\n var propValue = props[propName];\n var propType = getPropType(propValue);\n if (propType !== 'object') {\n return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));\n }\n for (var key in shapeTypes) {\n var checker = shapeTypes[key];\n if (!checker) {\n continue;\n }\n var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);\n if (error) {\n return error;\n }\n }\n return null;\n }\n return createChainableTypeChecker(validate);\n }\n\n function createStrictShapeTypeChecker(shapeTypes) {\n function validate(props, propName, componentName, location, propFullName) {\n var propValue = props[propName];\n var propType = getPropType(propValue);\n if (propType !== 'object') {\n return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));\n }\n // We need to check all keys in case some are required but missing from\n // props.\n var allKeys = assign({}, props[propName], shapeTypes);\n for (var key in allKeys) {\n var checker = shapeTypes[key];\n if (!checker) {\n return new PropTypeError(\n 'Invalid ' + location + ' `' + propFullName + '` key `' + key + '` supplied to `' + componentName + '`.' +\n '\\nBad object: ' + JSON.stringify(props[propName], null, ' ') +\n '\\nValid keys: ' + JSON.stringify(Object.keys(shapeTypes), null, ' ')\n );\n }\n var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);\n if (error) {\n return error;\n }\n }\n return null;\n }\n\n return createChainableTypeChecker(validate);\n }\n\n function isNode(propValue) {\n switch (typeof propValue) {\n case 'number':\n case 'string':\n case 'undefined':\n return true;\n case 'boolean':\n return !propValue;\n case 'object':\n if (Array.isArray(propValue)) {\n return propValue.every(isNode);\n }\n if (propValue === null || isValidElement(propValue)) {\n return true;\n }\n\n var iteratorFn = getIteratorFn(propValue);\n if (iteratorFn) {\n var iterator = iteratorFn.call(propValue);\n var step;\n if (iteratorFn !== propValue.entries) {\n while (!(step = iterator.next()).done) {\n if (!isNode(step.value)) {\n return false;\n }\n }\n } else {\n // Iterator will provide entry [k,v] tuples rather than values.\n while (!(step = iterator.next()).done) {\n var entry = step.value;\n if (entry) {\n if (!isNode(entry[1])) {\n return false;\n }\n }\n }\n }\n } else {\n return false;\n }\n\n return true;\n default:\n return false;\n }\n }\n\n function isSymbol(propType, propValue) {\n // Native Symbol.\n if (propType === 'symbol') {\n return true;\n }\n\n // falsy value can't be a Symbol\n if (!propValue) {\n return false;\n }\n\n // 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol'\n if (propValue['@@toStringTag'] === 'Symbol') {\n return true;\n }\n\n // Fallback for non-spec compliant Symbols which are polyfilled.\n if (typeof Symbol === 'function' && propValue instanceof Symbol) {\n return true;\n }\n\n return false;\n }\n\n // Equivalent of `typeof` but with special handling for array and regexp.\n function getPropType(propValue) {\n var propType = typeof propValue;\n if (Array.isArray(propValue)) {\n return 'array';\n }\n if (propValue instanceof RegExp) {\n // Old webkits (at least until Android 4.0) return 'function' rather than\n // 'object' for typeof a RegExp. We'll normalize this here so that /bla/\n // passes PropTypes.object.\n return 'object';\n }\n if (isSymbol(propType, propValue)) {\n return 'symbol';\n }\n return propType;\n }\n\n // This handles more types than `getPropType`. Only used for error messages.\n // See `createPrimitiveTypeChecker`.\n function getPreciseType(propValue) {\n if (typeof propValue === 'undefined' || propValue === null) {\n return '' + propValue;\n }\n var propType = getPropType(propValue);\n if (propType === 'object') {\n if (propValue instanceof Date) {\n return 'date';\n } else if (propValue instanceof RegExp) {\n return 'regexp';\n }\n }\n return propType;\n }\n\n // Returns a string that is postfixed to a warning about an invalid type.\n // For example, \"undefined\" or \"of type array\"\n function getPostfixForTypeWarning(value) {\n var type = getPreciseType(value);\n switch (type) {\n case 'array':\n case 'object':\n return 'an ' + type;\n case 'boolean':\n case 'date':\n case 'regexp':\n return 'a ' + type;\n default:\n return type;\n }\n }\n\n // Returns class name of the object, if any.\n function getClassName(propValue) {\n if (!propValue.constructor || !propValue.constructor.name) {\n return ANONYMOUS;\n }\n return propValue.constructor.name;\n }\n\n ReactPropTypes.checkPropTypes = checkPropTypes;\n ReactPropTypes.resetWarningCache = checkPropTypes.resetWarningCache;\n ReactPropTypes.PropTypes = ReactPropTypes;\n\n return ReactPropTypes;\n};\n","/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n'use strict';\n\nvar ReactPropTypesSecret = require('./lib/ReactPropTypesSecret');\n\nfunction emptyFunction() {}\nfunction emptyFunctionWithReset() {}\nemptyFunctionWithReset.resetWarningCache = emptyFunction;\n\nmodule.exports = function() {\n function shim(props, propName, componentName, location, propFullName, secret) {\n if (secret === ReactPropTypesSecret) {\n // It is still safe when called from React.\n return;\n }\n var err = new Error(\n 'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +\n 'Use PropTypes.checkPropTypes() to call them. ' +\n 'Read more at http://fb.me/use-check-prop-types'\n );\n err.name = 'Invariant Violation';\n throw err;\n };\n shim.isRequired = shim;\n function getShim() {\n return shim;\n };\n // Important!\n // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.\n var ReactPropTypes = {\n array: shim,\n bool: shim,\n func: shim,\n number: shim,\n object: shim,\n string: shim,\n symbol: shim,\n\n any: shim,\n arrayOf: getShim,\n element: shim,\n elementType: shim,\n instanceOf: getShim,\n node: shim,\n objectOf: getShim,\n oneOf: getShim,\n oneOfType: getShim,\n shape: getShim,\n exact: getShim,\n\n checkPropTypes: emptyFunctionWithReset,\n resetWarningCache: emptyFunction\n };\n\n ReactPropTypes.PropTypes = ReactPropTypes;\n\n return ReactPropTypes;\n};\n","/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nif (process.env.NODE_ENV !== 'production') {\n var ReactIs = require('react-is');\n\n // By explicitly using `prop-types` you are opting into new development behavior.\n // http://fb.me/prop-types-in-prod\n var throwOnDirectAccess = true;\n module.exports = require('./factoryWithTypeCheckers')(ReactIs.isElement, throwOnDirectAccess);\n} else {\n // By explicitly using `prop-types` you are opting into new production behavior.\n // http://fb.me/prop-types-in-prod\n module.exports = require('./factoryWithThrowingShims')();\n}\n","/**\n * Copyright (c) 2013-present, Facebook, Inc.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n'use strict';\n\nvar ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';\n\nmodule.exports = ReactPropTypesSecret;\n","/** @license React v17.0.2\n * react-is.production.min.js\n *\n * Copyright (c) Facebook, Inc. and its affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n'use strict';var b=60103,c=60106,d=60107,e=60108,f=60114,g=60109,h=60110,k=60112,l=60113,m=60120,n=60115,p=60116,q=60121,r=60122,u=60117,v=60129,w=60131;\nif(\"function\"===typeof Symbol&&Symbol.for){var x=Symbol.for;b=x(\"react.element\");c=x(\"react.portal\");d=x(\"react.fragment\");e=x(\"react.strict_mode\");f=x(\"react.profiler\");g=x(\"react.provider\");h=x(\"react.context\");k=x(\"react.forward_ref\");l=x(\"react.suspense\");m=x(\"react.suspense_list\");n=x(\"react.memo\");p=x(\"react.lazy\");q=x(\"react.block\");r=x(\"react.server.block\");u=x(\"react.fundamental\");v=x(\"react.debug_trace_mode\");w=x(\"react.legacy_hidden\")}\nfunction y(a){if(\"object\"===typeof a&&null!==a){var t=a.$$typeof;switch(t){case b:switch(a=a.type,a){case d:case f:case e:case l:case m:return a;default:switch(a=a&&a.$$typeof,a){case h:case k:case p:case n:case g:return a;default:return t}}case c:return t}}}var z=g,A=b,B=k,C=d,D=p,E=n,F=c,G=f,H=e,I=l;exports.ContextConsumer=h;exports.ContextProvider=z;exports.Element=A;exports.ForwardRef=B;exports.Fragment=C;exports.Lazy=D;exports.Memo=E;exports.Portal=F;exports.Profiler=G;exports.StrictMode=H;\nexports.Suspense=I;exports.isAsyncMode=function(){return!1};exports.isConcurrentMode=function(){return!1};exports.isContextConsumer=function(a){return y(a)===h};exports.isContextProvider=function(a){return y(a)===g};exports.isElement=function(a){return\"object\"===typeof a&&null!==a&&a.$$typeof===b};exports.isForwardRef=function(a){return y(a)===k};exports.isFragment=function(a){return y(a)===d};exports.isLazy=function(a){return y(a)===p};exports.isMemo=function(a){return y(a)===n};\nexports.isPortal=function(a){return y(a)===c};exports.isProfiler=function(a){return y(a)===f};exports.isStrictMode=function(a){return y(a)===e};exports.isSuspense=function(a){return y(a)===l};exports.isValidElementType=function(a){return\"string\"===typeof a||\"function\"===typeof a||a===d||a===f||a===v||a===e||a===l||a===m||a===w||\"object\"===typeof a&&null!==a&&(a.$$typeof===p||a.$$typeof===n||a.$$typeof===g||a.$$typeof===h||a.$$typeof===k||a.$$typeof===u||a.$$typeof===q||a[0]===r)?!0:!1};\nexports.typeOf=y;\n","function t(t){return\"object\"==typeof t&&null!=t&&1===t.nodeType}function e(t,e){return(!e||\"hidden\"!==t)&&\"visible\"!==t&&\"clip\"!==t}function n(t,n){if(t.clientHeight<t.scrollHeight||t.clientWidth<t.scrollWidth){var r=getComputedStyle(t,null);return e(r.overflowY,n)||e(r.overflowX,n)||function(t){var e=function(t){if(!t.ownerDocument||!t.ownerDocument.defaultView)return null;try{return t.ownerDocument.defaultView.frameElement}catch(t){return null}}(t);return!!e&&(e.clientHeight<t.scrollHeight||e.clientWidth<t.scrollWidth)}(t)}return!1}function r(t,e,n,r,i,o,l,d){return o<t&&l>e||o>t&&l<e?0:o<=t&&d<=n||l>=e&&d>=n?o-t-r:l>e&&d<n||o<t&&d>n?l-e+i:0}export default function(e,i){var o=window,l=i.scrollMode,d=i.block,u=i.inline,h=i.boundary,a=i.skipOverflowHiddenElements,c=\"function\"==typeof h?h:function(t){return t!==h};if(!t(e))throw new TypeError(\"Invalid target\");for(var f=document.scrollingElement||document.documentElement,s=[],p=e;t(p)&&c(p);){if((p=p.parentElement)===f){s.push(p);break}null!=p&&p===document.body&&n(p)&&!n(document.documentElement)||null!=p&&n(p,a)&&s.push(p)}for(var m=o.visualViewport?o.visualViewport.width:innerWidth,g=o.visualViewport?o.visualViewport.height:innerHeight,w=window.scrollX||pageXOffset,v=window.scrollY||pageYOffset,W=e.getBoundingClientRect(),b=W.height,H=W.width,y=W.top,E=W.right,M=W.bottom,V=W.left,x=\"start\"===d||\"nearest\"===d?y:\"end\"===d?M:y+b/2,I=\"center\"===u?V+H/2:\"end\"===u?E:V,C=[],T=0;T<s.length;T++){var k=s[T],B=k.getBoundingClientRect(),D=B.height,O=B.width,R=B.top,X=B.right,Y=B.bottom,L=B.left;if(\"if-needed\"===l&&y>=0&&V>=0&&M<=g&&E<=m&&y>=R&&M<=Y&&V>=L&&E<=X)return C;var S=getComputedStyle(k),j=parseInt(S.borderLeftWidth,10),q=parseInt(S.borderTopWidth,10),z=parseInt(S.borderRightWidth,10),A=parseInt(S.borderBottomWidth,10),F=0,G=0,J=\"offsetWidth\"in k?k.offsetWidth-k.clientWidth-j-z:0,K=\"offsetHeight\"in k?k.offsetHeight-k.clientHeight-q-A:0;if(f===k)F=\"start\"===d?x:\"end\"===d?x-g:\"nearest\"===d?r(v,v+g,g,q,A,v+x,v+x+b,b):x-g/2,G=\"start\"===u?I:\"center\"===u?I-m/2:\"end\"===u?I-m:r(w,w+m,m,j,z,w+I,w+I+H,H),F=Math.max(0,F+v),G=Math.max(0,G+w);else{F=\"start\"===d?x-R-q:\"end\"===d?x-Y+A+K:\"nearest\"===d?r(R,Y,D,q,A+K,x,x+b,b):x-(R+D/2)+K/2,G=\"start\"===u?I-L-j:\"center\"===u?I-(L+O/2)+J/2:\"end\"===u?I-X+z+J:r(L,X,O,j,z+J,I,I+H,H);var N=k.scrollLeft,P=k.scrollTop;x+=P-(F=Math.max(0,Math.min(P+F,k.scrollHeight-D+K))),I+=N-(G=Math.max(0,Math.min(N+G,k.scrollWidth-O+J)))}C.push({el:k,top:F,left:G})}return C}\n//# sourceMappingURL=index.module.js.map\n","import computeScrollIntoView from 'compute-scroll-into-view'\nimport {isPreact} from './is.macro'\n\nlet idCounter = 0\n\n/**\n * Accepts a parameter and returns it if it's a function\n * or a noop function if it's not. This allows us to\n * accept a callback, but not worry about it if it's not\n * passed.\n * @param {Function} cb the callback\n * @return {Function} a function\n */\nfunction cbToCb(cb) {\n return typeof cb === 'function' ? cb : noop\n}\n\nfunction noop() {}\n\n/**\n * Scroll node into view if necessary\n * @param {HTMLElement} node the element that should scroll into view\n * @param {HTMLElement} menuNode the menu element of the component\n */\nfunction scrollIntoView(node, menuNode) {\n if (!node) {\n return\n }\n\n const actions = computeScrollIntoView(node, {\n boundary: menuNode,\n block: 'nearest',\n scrollMode: 'if-needed',\n })\n actions.forEach(({el, top, left}) => {\n el.scrollTop = top\n el.scrollLeft = left\n })\n}\n\n/**\n * @param {HTMLElement} parent the parent node\n * @param {HTMLElement} child the child node\n * @param {Window} environment The window context where downshift renders.\n * @return {Boolean} whether the parent is the child or the child is in the parent\n */\nfunction isOrContainsNode(parent, child, environment) {\n const result =\n parent === child ||\n (child instanceof environment.Node &&\n parent.contains &&\n parent.contains(child))\n return result\n}\n\n/**\n * Simple debounce implementation. Will call the given\n * function once after the time given has passed since\n * it was last called.\n * @param {Function} fn the function to call after the time\n * @param {Number} time the time to wait\n * @return {Function} the debounced function\n */\nfunction debounce(fn, time) {\n let timeoutId\n\n function cancel() {\n if (timeoutId) {\n clearTimeout(timeoutId)\n }\n }\n\n function wrapper(...args) {\n cancel()\n timeoutId = setTimeout(() => {\n timeoutId = null\n fn(...args)\n }, time)\n }\n\n wrapper.cancel = cancel\n\n return wrapper\n}\n\n/**\n * This is intended to be used to compose event handlers.\n * They are executed in order until one of them sets\n * `event.preventDownshiftDefault = true`.\n * @param {...Function} fns the event handler functions\n * @return {Function} the event handler to add to an element\n */\nfunction callAllEventHandlers(...fns) {\n return (event, ...args) =>\n fns.some(fn => {\n if (fn) {\n fn(event, ...args)\n }\n return (\n event.preventDownshiftDefault ||\n (event.hasOwnProperty('nativeEvent') &&\n event.nativeEvent.preventDownshiftDefault)\n )\n })\n}\n\nfunction handleRefs(...refs) {\n return node => {\n refs.forEach(ref => {\n if (typeof ref === 'function') {\n ref(node)\n } else if (ref) {\n ref.current = node\n }\n })\n }\n}\n\n/**\n * This generates a unique ID for an instance of Downshift\n * @return {String} the unique ID\n */\nfunction generateId() {\n return String(idCounter++)\n}\n\n/**\n * This is only used in tests\n * @param {Number} num the number to set the idCounter to\n */\nfunction setIdCounter(num) {\n idCounter = num\n}\n\n/**\n * Resets idCounter to 0. Used for SSR.\n */\nfunction resetIdCounter() {\n idCounter = 0\n}\n\n/**\n * Default implementation for status message. Only added when menu is open.\n * Will specify if there are results in the list, and if so, how many,\n * and what keys are relevant.\n *\n * @param {Object} param the downshift state and other relevant properties\n * @return {String} the a11y status message\n */\nfunction getA11yStatusMessage({isOpen, resultCount, previousResultCount}) {\n if (!isOpen) {\n return ''\n }\n\n if (!resultCount) {\n return 'No results are available.'\n }\n\n if (resultCount !== previousResultCount) {\n return `${resultCount} result${\n resultCount === 1 ? ' is' : 's are'\n } available, use up and down arrow keys to navigate. Press Enter key to select.`\n }\n\n return ''\n}\n\n/**\n * Takes an argument and if it's an array, returns the first item in the array\n * otherwise returns the argument\n * @param {*} arg the maybe-array\n * @param {*} defaultValue the value if arg is falsey not defined\n * @return {*} the arg or it's first item\n */\nfunction unwrapArray(arg, defaultValue) {\n arg = Array.isArray(arg) ? /* istanbul ignore next (preact) */ arg[0] : arg\n if (!arg && defaultValue) {\n return defaultValue\n } else {\n return arg\n }\n}\n\n/**\n * @param {Object} element (P)react element\n * @return {Boolean} whether it's a DOM element\n */\nfunction isDOMElement(element) {\n /* istanbul ignore if */\n if (isPreact) {\n // then this is preact or preact X\n return (\n typeof element.type === 'string' || typeof element.nodeName === 'string'\n )\n }\n\n // then we assume this is react\n return typeof element.type === 'string'\n}\n\n/**\n * @param {Object} element (P)react element\n * @return {Object} the props\n */\nfunction getElementProps(element) {\n // props for react, attributes for preact\n\n /* istanbul ignore if */\n if (isPreact) {\n return element.props || element.attributes\n }\n\n return element.props\n}\n\n/**\n * Throws a helpful error message for required properties. Useful\n * to be used as a default in destructuring or object params.\n * @param {String} fnName the function name\n * @param {String} propName the prop name\n */\nfunction requiredProp(fnName, propName) {\n // eslint-disable-next-line no-console\n console.error(`The property \"${propName}\" is required in \"${fnName}\"`)\n}\n\nconst stateKeys = [\n 'highlightedIndex',\n 'inputValue',\n 'isOpen',\n 'selectedItem',\n 'type',\n]\n/**\n * @param {Object} state the state object\n * @return {Object} state that is relevant to downshift\n */\nfunction pickState(state = {}) {\n const result = {}\n stateKeys.forEach(k => {\n if (state.hasOwnProperty(k)) {\n result[k] = state[k]\n }\n })\n return result\n}\n\n/**\n * This will perform a shallow merge of the given state object\n * with the state coming from props\n * (for the controlled component scenario)\n * This is used in state updater functions so they're referencing\n * the right state regardless of where it comes from.\n *\n * @param {Object} state The state of the component/hook.\n * @param {Object} props The props that may contain controlled values.\n * @returns {Object} The merged controlled state.\n */\nfunction getState(state, props) {\n return Object.keys(state).reduce((prevState, key) => {\n prevState[key] = isControlledProp(props, key) ? props[key] : state[key]\n\n return prevState\n }, {})\n}\n\n/**\n * This determines whether a prop is a \"controlled prop\" meaning it is\n * state which is controlled by the outside of this component rather\n * than within this component.\n *\n * @param {Object} props The props that may contain controlled values.\n * @param {String} key the key to check\n * @return {Boolean} whether it is a controlled controlled prop\n */\nfunction isControlledProp(props, key) {\n return props[key] !== undefined\n}\n\n/**\n * Normalizes the 'key' property of a KeyboardEvent in IE/Edge\n * @param {Object} event a keyboardEvent object\n * @return {String} keyboard key\n */\nfunction normalizeArrowKey(event) {\n const {key, keyCode} = event\n /* istanbul ignore next (ie) */\n if (keyCode >= 37 && keyCode <= 40 && key.indexOf('Arrow') !== 0) {\n return `Arrow${key}`\n }\n return key\n}\n\n/**\n * Simple check if the value passed is object literal\n * @param {*} obj any things\n * @return {Boolean} whether it's object literal\n */\nfunction isPlainObject(obj) {\n return Object.prototype.toString.call(obj) === '[object Object]'\n}\n\n/**\n * Returns the new index in the list, in a circular way. If next value is out of bonds from the total,\n * it will wrap to either 0 or itemCount - 1.\n *\n * @param {number} moveAmount Number of positions to move. Negative to move backwards, positive forwards.\n * @param {number} baseIndex The initial position to move from.\n * @param {number} itemCount The total number of items.\n * @param {Function} getItemNodeFromIndex Used to check if item is disabled.\n * @param {boolean} circular Specify if navigation is circular. Default is true.\n * @returns {number} The new index after the move.\n */\nfunction getNextWrappingIndex(\n moveAmount,\n baseIndex,\n itemCount,\n getItemNodeFromIndex,\n circular = true,\n) {\n if (itemCount === 0) {\n return -1\n }\n\n const itemsLastIndex = itemCount - 1\n\n if (\n typeof baseIndex !== 'number' ||\n baseIndex < 0 ||\n baseIndex >= itemCount\n ) {\n baseIndex = moveAmount > 0 ? -1 : itemsLastIndex + 1\n }\n\n let newIndex = baseIndex + moveAmount\n\n if (newIndex < 0) {\n newIndex = circular ? itemsLastIndex : 0\n } else if (newIndex > itemsLastIndex) {\n newIndex = circular ? 0 : itemsLastIndex\n }\n\n const nonDisabledNewIndex = getNextNonDisabledIndex(\n moveAmount,\n newIndex,\n itemCount,\n getItemNodeFromIndex,\n circular,\n )\n\n if (nonDisabledNewIndex === -1) {\n return baseIndex >= itemCount ? -1 : baseIndex\n }\n\n return nonDisabledNewIndex\n}\n\n/**\n * Returns the next index in the list of an item that is not disabled.\n *\n * @param {number} moveAmount Number of positions to move. Negative to move backwards, positive forwards.\n * @param {number} baseIndex The initial position to move from.\n * @param {number} itemCount The total number of items.\n * @param {Function} getItemNodeFromIndex Used to check if item is disabled.\n * @param {boolean} circular Specify if navigation is circular. Default is true.\n * @returns {number} The new index. Returns baseIndex if item is not disabled. Returns next non-disabled item otherwise. If no non-disabled found it will return -1.\n */\nfunction getNextNonDisabledIndex(\n moveAmount,\n baseIndex,\n itemCount,\n getItemNodeFromIndex,\n circular,\n) {\n const currentElementNode = getItemNodeFromIndex(baseIndex)\n if (!currentElementNode || !currentElementNode.hasAttribute('disabled')) {\n return baseIndex\n }\n\n if (moveAmount > 0) {\n for (let index = baseIndex + 1; index < itemCount; index++) {\n if (!getItemNodeFromIndex(index).hasAttribute('disabled')) {\n return index\n }\n }\n } else {\n for (let index = baseIndex - 1; index >= 0; index--) {\n if (!getItemNodeFromIndex(index).hasAttribute('disabled')) {\n return index\n }\n }\n }\n\n if (circular) {\n return moveAmount > 0\n ? getNextNonDisabledIndex(1, 0, itemCount, getItemNodeFromIndex, false)\n : getNextNonDisabledIndex(\n -1,\n itemCount - 1,\n itemCount,\n getItemNodeFromIndex,\n false,\n )\n }\n\n return -1\n}\n\n/**\n * Checks if event target is within the downshift elements.\n *\n * @param {EventTarget} target Target to check.\n * @param {HTMLElement[]} downshiftElements The elements that form downshift (list, toggle button etc).\n * @param {Window} environment The window context where downshift renders.\n * @param {boolean} checkActiveElement Whether to also check activeElement.\n *\n * @returns {boolean} Whether or not the target is within downshift elements.\n */\nfunction targetWithinDownshift(\n target,\n downshiftElements,\n environment,\n checkActiveElement = true,\n) {\n return downshiftElements.some(\n contextNode =>\n contextNode &&\n (isOrContainsNode(contextNode, target, environment) ||\n (checkActiveElement &&\n isOrContainsNode(\n contextNode,\n environment.document.activeElement,\n environment,\n ))),\n )\n}\n\n// eslint-disable-next-line import/no-mutable-exports\nlet validateControlledUnchanged = noop\n/* istanbul ignore next */\nif (process.env.NODE_ENV !== 'production') {\n validateControlledUnchanged = (state, prevProps, nextProps) => {\n const warningDescription = `This prop should not switch from controlled to uncontrolled (or vice versa). Decide between using a controlled or uncontrolled Downshift element for the lifetime of the component. More info: https://github.com/downshift-js/downshift#control-props`\n\n Object.keys(state).forEach(propKey => {\n if (\n prevProps[propKey] !== undefined &&\n nextProps[propKey] === undefined\n ) {\n // eslint-disable-next-line no-console\n console.error(\n `downshift: A component has changed the controlled prop \"${propKey}\" to be uncontrolled. ${warningDescription}`,\n )\n } else if (\n prevProps[propKey] === undefined &&\n nextProps[propKey] !== undefined\n ) {\n // eslint-disable-next-line no-console\n console.error(\n `downshift: A component has changed the uncontrolled prop \"${propKey}\" to be controlled. ${warningDescription}`,\n )\n }\n })\n }\n}\n\nexport {\n cbToCb,\n callAllEventHandlers,\n handleRefs,\n debounce,\n scrollIntoView,\n generateId,\n getA11yStatusMessage,\n unwrapArray,\n isDOMElement,\n getElementProps,\n noop,\n requiredProp,\n setIdCounter,\n resetIdCounter,\n pickState,\n isPlainObject,\n normalizeArrowKey,\n getNextWrappingIndex,\n getNextNonDisabledIndex,\n targetWithinDownshift,\n getState,\n isControlledProp,\n validateControlledUnchanged,\n}\n","import {debounce} from './utils'\n\nconst cleanupStatus = debounce(documentProp => {\n getStatusDiv(documentProp).textContent = ''\n}, 500)\n\n/**\n * @param {String} status the status message\n * @param {Object} documentProp document passed by the user.\n */\nfunction setStatus(status, documentProp) {\n const div = getStatusDiv(documentProp)\n if (!status) {\n return\n }\n\n div.textContent = status\n cleanupStatus(documentProp)\n}\n\n/**\n * Get the status node or create it if it does not already exist.\n * @param {Object} documentProp document passed by the user.\n * @return {HTMLElement} the status node.\n */\nfunction getStatusDiv(documentProp = document) {\n let statusDiv = documentProp.getElementById('a11y-status-message')\n if (statusDiv) {\n return statusDiv\n }\n\n statusDiv = documentProp.createElement('div')\n statusDiv.setAttribute('id', 'a11y-status-message')\n statusDiv.setAttribute('role', 'status')\n statusDiv.setAttribute('aria-live', 'polite')\n statusDiv.setAttribute('aria-relevant', 'additions text')\n Object.assign(statusDiv.style, {\n border: '0',\n clip: 'rect(0 0 0 0)',\n height: '1px',\n margin: '-1px',\n overflow: 'hidden',\n padding: '0',\n position: 'absolute',\n width: '1px',\n })\n documentProp.body.appendChild(statusDiv)\n return statusDiv\n}\n\nexport default setStatus\n","import productionEnum from './productionEnum.macro'\n\nexport const unknown = productionEnum('__autocomplete_unknown__')\nexport const mouseUp = productionEnum('__autocomplete_mouseup__')\nexport const itemMouseEnter = productionEnum('__autocomplete_item_mouseenter__')\nexport const keyDownArrowUp = productionEnum(\n '__autocomplete_keydown_arrow_up__',\n)\nexport const keyDownArrowDown = productionEnum(\n '__autocomplete_keydown_arrow_down__',\n)\nexport const keyDownEscape = productionEnum('__autocomplete_keydown_escape__')\nexport const keyDownEnter = productionEnum('__autocomplete_keydown_enter__')\nexport const keyDownHome = productionEnum('__autocomplete_keydown_home__')\nexport const keyDownEnd = productionEnum('__autocomplete_keydown_end__')\nexport const clickItem = productionEnum('__autocomplete_click_item__')\nexport const blurInput = productionEnum('__autocomplete_blur_input__')\nexport const changeInput = productionEnum('__autocomplete_change_input__')\nexport const keyDownSpaceButton = productionEnum(\n '__autocomplete_keydown_space_button__',\n)\nexport const clickButton = productionEnum('__autocomplete_click_button__')\nexport const blurButton = productionEnum('__autocomplete_blur_button__')\nexport const controlledPropUpdatedSelectedItem = productionEnum(\n '__autocomplete_controlled_prop_updated_selected_item__',\n)\nexport const touchEnd = productionEnum('__autocomplete_touchend__')\n","/* eslint camelcase:0 */\n\nimport PropTypes from 'prop-types'\nimport {Component, cloneElement} from 'react'\nimport {isForwardRef} from 'react-is'\nimport {isPreact, isReactNative} from './is.macro'\nimport setA11yStatus from './set-a11y-status'\nimport * as stateChangeTypes from './stateChangeTypes'\nimport {\n handleRefs,\n callAllEventHandlers,\n cbToCb,\n debounce,\n generateId,\n getA11yStatusMessage,\n getElementProps,\n isDOMElement,\n targetWithinDownshift,\n isPlainObject,\n noop,\n normalizeArrowKey,\n pickState,\n requiredProp,\n scrollIntoView,\n unwrapArray,\n getNextWrappingIndex,\n getNextNonDisabledIndex,\n getState,\n isControlledProp,\n validateControlledUnchanged,\n} from './utils'\n\nclass Downshift extends Component {\n static propTypes = {\n children: PropTypes.func,\n defaultHighlightedIndex: PropTypes.number,\n defaultIsOpen: PropTypes.bool,\n initialHighlightedIndex: PropTypes.number,\n initialSelectedItem: PropTypes.any,\n initialInputValue: PropTypes.string,\n initialIsOpen: PropTypes.bool,\n getA11yStatusMessage: PropTypes.func,\n itemToString: PropTypes.func,\n onChange: PropTypes.func,\n onSelect: PropTypes.func,\n onStateChange: PropTypes.func,\n onInputValueChange: PropTypes.func,\n onUserAction: PropTypes.func,\n onOuterClick: PropTypes.func,\n selectedItemChanged: PropTypes.func,\n stateReducer: PropTypes.func,\n itemCount: PropTypes.number,\n id: PropTypes.string,\n environment: PropTypes.shape({\n addEventListener: PropTypes.func,\n removeEventListener: PropTypes.func,\n document: PropTypes.shape({\n getElementById: PropTypes.func,\n activeElement: PropTypes.any,\n body: PropTypes.any,\n }),\n }),\n suppressRefError: PropTypes.bool,\n scrollIntoView: PropTypes.func,\n // things we keep in state for uncontrolled components\n // but can accept as props for controlled components\n /* eslint-disable react/no-unused-prop-types */\n selectedItem: PropTypes.any,\n isOpen: PropTypes.bool,\n inputValue: PropTypes.string,\n highlightedIndex: PropTypes.number,\n labelId: PropTypes.string,\n inputId: PropTypes.string,\n menuId: PropTypes.string,\n getItemId: PropTypes.func,\n /* eslint-enable react/no-unused-prop-types */\n }\n\n static defaultProps = {\n defaultHighlightedIndex: null,\n defaultIsOpen: false,\n getA11yStatusMessage,\n itemToString: i => {\n if (i == null) {\n return ''\n }\n if (\n process.env.NODE_ENV !== 'production' &&\n isPlainObject(i) &&\n !i.hasOwnProperty('toString')\n ) {\n // eslint-disable-next-line no-console\n console.warn(\n 'downshift: An object was passed to the default implementation of `itemToString`. You should probably provide your own `itemToString` implementation. Please refer to the `itemToString` API documentation.',\n 'The object that was passed:',\n i,\n )\n }\n return String(i)\n },\n onStateChange: noop,\n onInputValueChange: noop,\n onUserAction: noop,\n onChange: noop,\n onSelect: noop,\n onOuterClick: noop,\n selectedItemChanged: (prevItem, item) => prevItem !== item,\n environment:\n /* istanbul ignore next (ssr) */\n typeof window === 'undefined' ? {} : window,\n stateReducer: (state, stateToSet) => stateToSet,\n suppressRefError: false,\n scrollIntoView,\n }\n\n static stateChangeTypes = stateChangeTypes\n\n constructor(props) {\n super(props)\n // fancy destructuring + defaults + aliases\n // this basically says each value of state should either be set to\n // the initial value or the default value if the initial value is not provided\n const {\n defaultHighlightedIndex,\n initialHighlightedIndex: highlightedIndex = defaultHighlightedIndex,\n defaultIsOpen,\n initialIsOpen: isOpen = defaultIsOpen,\n initialInputValue: inputValue = '',\n initialSelectedItem: selectedItem = null,\n } = this.props\n const state = this.getState({\n highlightedIndex,\n isOpen,\n inputValue,\n selectedItem,\n })\n if (\n state.selectedItem != null &&\n this.props.initialInputValue === undefined\n ) {\n state.inputValue = this.props.itemToString(state.selectedItem)\n }\n this.state = state\n }\n\n id = this.props.id || `downshift-${generateId()}`\n menuId = this.props.menuId || `${this.id}-menu`\n labelId = this.props.labelId || `${this.id}-label`\n inputId = this.props.inputId || `${this.id}-input`\n getItemId = this.props.getItemId || (index => `${this.id}-item-${index}`)\n\n input = null\n items = []\n // itemCount can be changed asynchronously\n // from within downshift (so it can't come from a prop)\n // this is why we store it as an instance and use\n // getItemCount rather than just use items.length\n // (to support windowing + async)\n itemCount = null\n previousResultCount = 0\n\n timeoutIds = []\n\n /**\n * @param {Function} fn the function to call after the time\n * @param {Number} time the time to wait\n */\n internalSetTimeout = (fn, time) => {\n const id = setTimeout(() => {\n this.timeoutIds = this.timeoutIds.filter(i => i !== id)\n fn()\n }, time)\n\n this.timeoutIds.push(id)\n }\n\n /**\n * Clear all running timeouts\n */\n internalClearTimeouts() {\n this.timeoutIds.forEach(id => {\n clearTimeout(id)\n })\n\n this.timeoutIds = []\n }\n\n /**\n * Gets the state based on internal state or props\n * If a state value is passed via props, then that\n * is the value given, otherwise it's retrieved from\n * stateToMerge\n *\n * @param {Object} stateToMerge defaults to this.state\n * @return {Object} the state\n */\n getState(stateToMerge = this.state) {\n return getState(stateToMerge, this.props)\n }\n\n getItemCount() {\n // things read better this way. They're in priority order:\n // 1. `this.itemCount`\n // 2. `this.props.itemCount`\n // 3. `this.items.length`\n let itemCount = this.items.length\n if (this.itemCount != null) {\n itemCount = this.itemCount\n } else if (this.props.itemCount !== undefined) {\n itemCount = this.props.itemCount\n }\n return itemCount\n }\n\n setItemCount = count => {\n this.itemCount = count\n }\n\n unsetItemCount = () => {\n this.itemCount = null\n }\n\n getItemNodeFromIndex(index) {\n return this.props.environment.document.getElementById(this.getItemId(index))\n }\n\n setHighlightedIndex = (\n highlightedIndex = this.props.defaultHighlightedIndex,\n otherStateToSet = {},\n ) => {\n otherStateToSet = pickState(otherStateToSet)\n this.internalSetState({highlightedIndex, ...otherStateToSet})\n }\n\n scrollHighlightedItemIntoView() {\n /* istanbul ignore else (react-native) */\n if (!isReactNative) {\n const node = this.getItemNodeFromIndex(this.getState().highlightedIndex)\n this.props.scrollIntoView(node, this._menuNode)\n }\n }\n\n moveHighlightedIndex(amount, otherStateToSet) {\n const itemCount = this.getItemCount()\n const {highlightedIndex} = this.getState()\n if (itemCount > 0) {\n const nextHighlightedIndex = getNextWrappingIndex(\n amount,\n highlightedIndex,\n itemCount,\n index => this.getItemNodeFromIndex(index),\n )\n this.setHighlightedIndex(nextHighlightedIndex, otherStateToSet)\n }\n }\n\n clearSelection = cb => {\n this.internalSetState(\n {\n selectedItem: null,\n inputValue: '',\n highlightedIndex: this.props.defaultHighlightedIndex,\n isOpen: this.props.defaultIsOpen,\n },\n cb,\n )\n }\n\n selectItem = (item, otherStateToSet, cb) => {\n otherStateToSet = pickState(otherStateToSet)\n this.internalSetState(\n {\n isOpen: this.props.defaultIsOpen,\n highlightedIndex: this.props.defaultHighlightedIndex,\n selectedItem: item,\n inputValue: this.props.itemToString(item),\n ...otherStateToSet,\n },\n cb,\n )\n }\n\n selectItemAtIndex = (itemIndex, otherStateToSet, cb) => {\n const item = this.items[itemIndex]\n if (item == null) {\n return\n }\n this.selectItem(item, otherStateToSet, cb)\n }\n\n selectHighlightedItem = (otherStateToSet, cb) => {\n return this.selectItemAtIndex(\n this.getState().highlightedIndex,\n otherStateToSet,\n cb,\n )\n }\n\n // any piece of our state can live in two places:\n // 1. Uncontrolled: it's internal (this.state)\n // We will call this.setState to update that state\n // 2. Controlled: it's external (this.props)\n // We will call this.props.onStateChange to update that state\n //\n // In addition, we'll call this.props.onChange if the\n // selectedItem is changed.\n internalSetState = (stateToSet, cb) => {\n let isItemSelected, onChangeArg\n\n const onStateChangeArg = {}\n const isStateToSetFunction = typeof stateToSet === 'function'\n\n // we want to call `onInputValueChange` before the `setState` call\n // so someone controlling the `inputValue` state gets notified of\n // the input change as soon as possible. This avoids issues with\n // preserving the cursor position.\n // See https://github.com/downshift-js/downshift/issues/217 for more info.\n if (!isStateToSetFunction && stateToSet.hasOwnProperty('inputValue')) {\n this.props.onInputValueChange(stateToSet.inputValue, {\n ...this.getStateAndHelpers(),\n ...stateToSet,\n })\n }\n return this.setState(\n state => {\n state = this.getState(state)\n let newStateToSet = isStateToSetFunction\n ? stateToSet(state)\n : stateToSet\n\n // Your own function that could modify the state that will be set.\n newStateToSet = this.props.stateReducer(state, newStateToSet)\n\n // checks if an item is selected, regardless of if it's different from\n // what was selected before\n // used to determine if onSelect and onChange callbacks should be called\n isItemSelected = newStateToSet.hasOwnProperty('selectedItem')\n // this keeps track of the object we want to call with setState\n const nextState = {}\n // this is just used to tell whether the state changed\n const nextFullState = {}\n // we need to call on change if the outside world is controlling any of our state\n // and we're trying to update that state. OR if the selection has changed and we're\n // trying to update the selection\n if (\n isItemSelected &&\n newStateToSet.selectedItem !== state.selectedItem\n ) {\n onChangeArg = newStateToSet.selectedItem\n }\n newStateToSet.type = newStateToSet.type || stateChangeTypes.unknown\n\n Object.keys(newStateToSet).forEach(key => {\n // onStateChangeArg should only have the state that is\n // actually changing\n if (state[key] !== newStateToSet[key]) {\n onStateChangeArg[key] = newStateToSet[key]\n }\n // the type is useful for the onStateChangeArg\n // but we don't actually want to set it in internal state.\n // this is an undocumented feature for now... Not all internalSetState\n // calls support it and I'm not certain we want them to yet.\n // But it enables users controlling the isOpen state to know when\n // the isOpen state changes due to mouseup events which is quite handy.\n if (key === 'type') {\n return\n }\n nextFullState[key] = newStateToSet[key]\n // if it's coming from props, then we don't care to set it internally\n if (!isControlledProp(this.props, key)) {\n nextState[key] = newStateToSet[key]\n }\n })\n\n // if stateToSet is a function, then we weren't able to call onInputValueChange\n // earlier, so we'll call it now that we know what the inputValue state will be.\n if (\n isStateToSetFunction &&\n newStateToSet.hasOwnProperty('inputValue')\n ) {\n this.props.onInputValueChange(newStateToSet.inputValue, {\n ...this.getStateAndHelpers(),\n ...newStateToSet,\n })\n }\n\n return nextState\n },\n () => {\n // call the provided callback if it's a function\n cbToCb(cb)()\n\n // only call the onStateChange and onChange callbacks if\n // we have relevant information to pass them.\n const hasMoreStateThanType = Object.keys(onStateChangeArg).length > 1\n if (hasMoreStateThanType) {\n this.props.onStateChange(onStateChangeArg, this.getStateAndHelpers())\n }\n\n if (isItemSelected) {\n this.props.onSelect(\n stateToSet.selectedItem,\n this.getStateAndHelpers(),\n )\n }\n\n if (onChangeArg !== undefined) {\n this.props.onChange(onChangeArg, this.getStateAndHelpers())\n }\n // this is currently undocumented and therefore subject to change\n // We'll try to not break it, but just be warned.\n this.props.onUserAction(onStateChangeArg, this.getStateAndHelpers())\n },\n )\n }\n\n getStateAndHelpers() {\n const {highlightedIndex, inputValue, selectedItem, isOpen} = this.getState()\n const {itemToString} = this.props\n const {id} = this\n const {\n getRootProps,\n getToggleButtonProps,\n getLabelProps,\n getMenuProps,\n getInputProps,\n getItemProps,\n openMenu,\n closeMenu,\n toggleMenu,\n selectItem,\n selectItemAtIndex,\n selectHighlightedItem,\n setHighlightedIndex,\n clearSelection,\n clearItems,\n reset,\n setItemCount,\n unsetItemCount,\n internalSetState: setState,\n } = this\n return {\n // prop getters\n getRootProps,\n getToggleButtonProps,\n getLabelProps,\n getMenuProps,\n getInputProps,\n getItemProps,\n\n // actions\n reset,\n openMenu,\n closeMenu,\n toggleMenu,\n selectItem,\n selectItemAtIndex,\n selectHighlightedItem,\n setHighlightedIndex,\n clearSelection,\n clearItems,\n setItemCount,\n unsetItemCount,\n setState,\n\n // props\n itemToString,\n\n // derived\n id,\n\n // state\n highlightedIndex,\n inputValue,\n isOpen,\n selectedItem,\n }\n }\n\n //////////////////////////// ROOT\n\n rootRef = node => (this._rootNode = node)\n\n getRootProps = (\n {refKey = 'ref', ref, ...rest} = {},\n {suppressRefError = false} = {},\n ) => {\n // this is used in the render to know whether the user has called getRootProps.\n // It uses that to know whether to apply the props automatically\n this.getRootProps.called = true\n this.getRootProps.refKey = refKey\n this.getRootProps.suppressRefError = suppressRefError\n const {isOpen} = this.getState()\n return {\n [refKey]: handleRefs(ref, this.rootRef),\n role: 'combobox',\n 'aria-expanded': isOpen,\n 'aria-haspopup': 'listbox',\n 'aria-owns': isOpen ? this.menuId : null,\n 'aria-labelledby': this.labelId,\n ...rest,\n }\n }\n\n //\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ ROOT\n\n keyDownHandlers = {\n ArrowDown(event) {\n event.preventDefault()\n\n if (this.getState().isOpen) {\n const amount = event.shiftKey ? 5 : 1\n this.moveHighlightedIndex(amount, {\n type: stateChangeTypes.keyDownArrowDown,\n })\n } else {\n this.internalSetState(\n {\n isOpen: true,\n type: stateChangeTypes.keyDownArrowDown,\n },\n () => {\n const itemCount = this.getItemCount()\n if (itemCount > 0) {\n const {highlightedIndex} = this.getState()\n const nextHighlightedIndex = getNextWrappingIndex(\n 1,\n highlightedIndex,\n itemCount,\n index => this.getItemNodeFromIndex(index),\n )\n\n this.setHighlightedIndex(nextHighlightedIndex, {\n type: stateChangeTypes.keyDownArrowDown,\n })\n }\n },\n )\n }\n },\n\n ArrowUp(event) {\n event.preventDefault()\n\n if (this.getState().isOpen) {\n const amount = event.shiftKey ? -5 : -1\n this.moveHighlightedIndex(amount, {\n type: stateChangeTypes.keyDownArrowUp,\n })\n } else {\n this.internalSetState(\n {\n isOpen: true,\n type: stateChangeTypes.keyDownArrowUp,\n },\n () => {\n const itemCount = this.getItemCount()\n if (itemCount > 0) {\n const {highlightedIndex} = this.getState()\n const nextHighlightedIndex = getNextWrappingIndex(\n -1,\n highlightedIndex,\n itemCount,\n index => this.getItemNodeFromIndex(index),\n )\n\n this.setHighlightedIndex(nextHighlightedIndex, {\n type: stateChangeTypes.keyDownArrowUp,\n })\n }\n },\n )\n }\n },\n\n Enter(event) {\n if (event.which === 229) {\n return\n }\n\n const {isOpen, highlightedIndex} = this.getState()\n if (isOpen && highlightedIndex != null) {\n event.preventDefault()\n const item = this.items[highlightedIndex]\n const itemNode = this.getItemNodeFromIndex(highlightedIndex)\n if (item == null || (itemNode && itemNode.hasAttribute('disabled'))) {\n return\n }\n this.selectHighlightedItem({\n type: stateChangeTypes.keyDownEnter,\n })\n }\n },\n\n Escape(event) {\n event.preventDefault()\n this.reset({\n type: stateChangeTypes.keyDownEscape,\n ...(!this.state.isOpen && {selectedItem: null, inputValue: ''}),\n })\n },\n }\n\n //////////////////////////// BUTTON\n\n buttonKeyDownHandlers = {\n ...this.keyDownHandlers,\n\n ' '(event) {\n event.preventDefault()\n this.toggleMenu({type: stateChangeTypes.keyDownSpaceButton})\n },\n }\n\n inputKeyDownHandlers = {\n ...this.keyDownHandlers,\n Home(event) {\n const {isOpen} = this.getState()\n\n if (!isOpen) {\n return\n }\n\n event.preventDefault()\n\n const itemCount = this.getItemCount()\n\n if (itemCount <= 0 || !isOpen) {\n return\n }\n\n // get next non-disabled starting downwards from 0 if that's disabled.\n const newHighlightedIndex = getNextNonDisabledIndex(\n 1,\n 0,\n itemCount,\n index => this.getItemNodeFromIndex(index),\n false,\n )\n\n this.setHighlightedIndex(newHighlightedIndex, {\n type: stateChangeTypes.keyDownHome,\n })\n },\n\n End(event) {\n const {isOpen} = this.getState()\n\n if (!isOpen) {\n return\n }\n\n event.preventDefault()\n\n const itemCount = this.getItemCount()\n\n if (itemCount <= 0 || !isOpen) {\n return\n }\n\n // get next non-disabled starting upwards from last index if that's disabled.\n const newHighlightedIndex = getNextNonDisabledIndex(\n -1,\n itemCount - 1,\n itemCount,\n index => this.getItemNodeFromIndex(index),\n false,\n )\n\n this.setHighlightedIndex(newHighlightedIndex, {\n type: stateChangeTypes.keyDownEnd,\n })\n },\n }\n\n getToggleButtonProps = ({\n onClick,\n onPress,\n onKeyDown,\n onKeyUp,\n onBlur,\n ...rest\n } = {}) => {\n const {isOpen} = this.getState()\n const enabledEventHandlers = isReactNative\n ? /* istanbul ignore next (react-native) */\n {\n onPress: callAllEventHandlers(onPress, this.buttonHandleClick),\n }\n : {\n onClick: callAllEventHandlers(onClick, this.buttonHandleClick),\n onKeyDown: callAllEventHandlers(onKeyDown, this.buttonHandleKeyDown),\n onKeyUp: callAllEventHandlers(onKeyUp, this.buttonHandleKeyUp),\n onBlur: callAllEventHandlers(onBlur, this.buttonHandleBlur),\n }\n const eventHandlers = rest.disabled ? {} : enabledEventHandlers\n return {\n type: 'button',\n role: 'button',\n 'aria-label': isOpen ? 'close menu' : 'open menu',\n 'aria-haspopup': true,\n 'data-toggle': true,\n ...eventHandlers,\n ...rest,\n }\n }\n\n buttonHandleKeyUp = event => {\n // Prevent click event from emitting in Firefox\n event.preventDefault()\n }\n\n buttonHandleKeyDown = event => {\n const key = normalizeArrowKey(event)\n if (this.buttonKeyDownHandlers[key]) {\n this.buttonKeyDownHandlers[key].call(this, event)\n }\n }\n\n buttonHandleClick = event => {\n event.preventDefault()\n // handle odd case for Safari and Firefox which\n // don't give the button the focus properly.\n /* istanbul ignore if (can't reasonably test this) */\n if (\n !isReactNative &&\n this.props.environment.document.activeElement ===\n this.props.environment.document.body\n ) {\n event.target.focus()\n }\n // to simplify testing components that use downshift, we'll not wrap this in a setTimeout\n // if the NODE_ENV is test. With the proper build system, this should be dead code eliminated\n // when building for production and should therefore have no impact on production code.\n if (process.env.NODE_ENV === 'test') {\n this.toggleMenu({type: stateChangeTypes.clickButton})\n } else {\n // Ensure that toggle of menu occurs after the potential blur event in iOS\n this.internalSetTimeout(() =>\n this.toggleMenu({type: stateChangeTypes.clickButton}),\n )\n }\n }\n\n buttonHandleBlur = event => {\n const blurTarget = event.target // Save blur target for comparison with activeElement later\n // Need setTimeout, so that when the user presses Tab, the activeElement is the next focused element, not body element\n this.internalSetTimeout(() => {\n if (\n !this.isMouseDown &&\n (this.props.environment.document.activeElement == null ||\n this.props.environment.document.activeElement.id !== this.inputId) &&\n this.props.environment.document.activeElement !== blurTarget // Do nothing if we refocus the same element again (to solve issue in Safari on iOS)\n ) {\n this.reset({type: stateChangeTypes.blurButton})\n }\n })\n }\n\n //\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ BUTTON\n\n /////////////////////////////// LABEL\n\n getLabelProps = props => {\n return {htmlFor: this.inputId, id: this.labelId, ...props}\n }\n\n //\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ LABEL\n\n /////////////////////////////// INPUT\n\n getInputProps = ({\n onKeyDown,\n onBlur,\n onChange,\n onInput,\n onChangeText,\n ...rest\n } = {}) => {\n let onChangeKey\n let eventHandlers = {}\n\n /* istanbul ignore next (preact) */\n if (isPreact) {\n onChangeKey = 'onInput'\n } else {\n onChangeKey = 'onChange'\n }\n const {inputValue, isOpen, highlightedIndex} = this.getState()\n\n if (!rest.disabled) {\n eventHandlers = {\n [onChangeKey]: callAllEventHandlers(\n onChange,\n onInput,\n this.inputHandleChange,\n ),\n onKeyDown: callAllEventHandlers(onKeyDown, this.inputHandleKeyDown),\n onBlur: callAllEventHandlers(onBlur, this.inputHandleBlur),\n }\n }\n\n /* istanbul ignore if (react-native) */\n if (isReactNative) {\n eventHandlers = {\n onChange: callAllEventHandlers(\n onChange,\n onInput,\n this.inputHandleChange,\n ),\n onChangeText: callAllEventHandlers(onChangeText, onInput, text =>\n this.inputHandleChange({nativeEvent: {text}}),\n ),\n onBlur: callAllEventHandlers(onBlur, this.inputHandleBlur),\n }\n }\n\n return {\n 'aria-autocomplete': 'list',\n 'aria-activedescendant':\n isOpen && typeof highlightedIndex === 'number' && highlightedIndex >= 0\n ? this.getItemId(highlightedIndex)\n : null,\n 'aria-controls': isOpen ? this.menuId : null,\n 'aria-labelledby': this.labelId,\n // https://developer.mozilla.org/en-US/docs/Web/Security/Securing_your_site/Turning_off_form_autocompletion\n // revert back since autocomplete=\"nope\" is ignored on latest Chrome and Opera\n autoComplete: 'off',\n value: inputValue,\n id: this.inputId,\n ...eventHandlers,\n ...rest,\n }\n }\n\n inputHandleKeyDown = event => {\n const key = normalizeArrowKey(event)\n if (key && this.inputKeyDownHandlers[key]) {\n this.inputKeyDownHandlers[key].call(this, event)\n }\n }\n\n inputHandleChange = event => {\n this.internalSetState({\n type: stateChangeTypes.changeInput,\n isOpen: true,\n inputValue: isReactNative\n ? /* istanbul ignore next (react-native) */ event.nativeEvent.text\n : event.target.value,\n highlightedIndex: this.props.defaultHighlightedIndex,\n })\n }\n\n inputHandleBlur = () => {\n // Need setTimeout, so that when the user presses Tab, the activeElement is the next focused element, not the body element\n this.internalSetTimeout(() => {\n const downshiftButtonIsActive =\n this.props.environment.document &&\n !!this.props.environment.document.activeElement &&\n !!this.props.environment.document.activeElement.dataset &&\n this.props.environment.document.activeElement.dataset.toggle &&\n this._rootNode &&\n this._rootNode.contains(this.props.environment.document.activeElement)\n if (!this.isMouseDown && !downshiftButtonIsActive) {\n this.reset({type: stateChangeTypes.blurInput})\n }\n })\n }\n\n //\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ INPUT\n\n /////////////////////////////// MENU\n\n menuRef = node => {\n this._menuNode = node\n }\n\n getMenuProps = (\n {refKey = 'ref', ref, ...props} = {},\n {suppressRefError = false} = {},\n ) => {\n this.getMenuProps.called = true\n this.getMenuProps.refKey = refKey\n this.getMenuProps.suppressRefError = suppressRefError\n\n return {\n [refKey]: handleRefs(ref, this.menuRef),\n role: 'listbox',\n 'aria-labelledby': props && props['aria-label'] ? null : this.labelId,\n id: this.menuId,\n ...props,\n }\n }\n //\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ MENU\n\n /////////////////////////////// ITEM\n getItemProps = ({\n onMouseMove,\n onMouseDown,\n onClick,\n onPress,\n index,\n item = process.env.NODE_ENV === 'production'\n ? /* istanbul ignore next */ undefined\n : requiredProp('getItemProps', 'item'),\n ...rest\n } = {}) => {\n if (index === undefined) {\n this.items.push(item)\n index = this.items.indexOf(item)\n } else {\n this.items[index] = item\n }\n\n const onSelectKey = isReactNative\n ? /* istanbul ignore next (react-native) */ 'onPress'\n : 'onClick'\n const customClickHandler = isReactNative\n ? /* istanbul ignore next (react-native) */ onPress\n : onClick\n\n const enabledEventHandlers = {\n // onMouseMove is used over onMouseEnter here. onMouseMove\n // is only triggered on actual mouse movement while onMouseEnter\n // can fire on DOM changes, interrupting keyboard navigation\n onMouseMove: callAllEventHandlers(onMouseMove, () => {\n if (index === this.getState().highlightedIndex) {\n return\n }\n this.setHighlightedIndex(index, {\n type: stateChangeTypes.itemMouseEnter,\n })\n\n // We never want to manually scroll when changing state based\n // on `onMouseMove` because we will be moving the element out\n // from under the user which is currently scrolling/moving the\n // cursor\n this.avoidScrolling = true\n this.internalSetTimeout(() => (this.avoidScrolling = false), 250)\n }),\n onMouseDown: callAllEventHandlers(onMouseDown, event => {\n // This prevents the activeElement from being changed\n // to the item so it can remain with the current activeElement\n // which is a more common use case.\n event.preventDefault()\n }),\n [onSelectKey]: callAllEventHandlers(customClickHandler, () => {\n this.selectItemAtIndex(index, {\n type: stateChangeTypes.clickItem,\n })\n }),\n }\n\n // Passing down the onMouseDown handler to prevent redirect\n // of the activeElement if clicking on disabled items\n const eventHandlers = rest.disabled\n ? {onMouseDown: enabledEventHandlers.onMouseDown}\n : enabledEventHandlers\n\n return {\n id: this.getItemId(index),\n role: 'option',\n 'aria-selected': this.getState().highlightedIndex === index,\n ...eventHandlers,\n ...rest,\n }\n }\n //\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\ ITEM\n\n clearItems = () => {\n this.items = []\n }\n\n reset = (otherStateToSet = {}, cb) => {\n otherStateToSet = pickState(otherStateToSet)\n this.internalSetState(\n ({selectedItem}) => ({\n isOpen: this.props.defaultIsOpen,\n highlightedIndex: this.props.defaultHighlightedIndex,\n inputValue: this.props.itemToString(selectedItem),\n ...otherStateToSet,\n }),\n cb,\n )\n }\n\n toggleMenu = (otherStateToSet = {}, cb) => {\n otherStateToSet = pickState(otherStateToSet)\n this.internalSetState(\n ({isOpen}) => {\n return {\n isOpen: !isOpen,\n ...(isOpen && {\n highlightedIndex: this.props.defaultHighlightedIndex,\n }),\n ...otherStateToSet,\n }\n },\n () => {\n const {isOpen, highlightedIndex} = this.getState()\n if (isOpen) {\n if (this.getItemCount() > 0 && typeof highlightedIndex === 'number') {\n this.setHighlightedIndex(highlightedIndex, otherStateToSet)\n }\n }\n cbToCb(cb)()\n },\n )\n }\n\n openMenu = cb => {\n this.internalSetState({isOpen: true}, cb)\n }\n\n closeMenu = cb => {\n this.internalSetState({isOpen: false}, cb)\n }\n\n updateStatus = debounce(() => {\n const state = this.getState()\n const item = this.items[state.highlightedIndex]\n const resultCount = this.getItemCount()\n const status = this.props.getA11yStatusMessage({\n itemToString: this.props.itemToString,\n previousResultCount: this.previousResultCount,\n resultCount,\n highlightedItem: item,\n ...state,\n })\n this.previousResultCount = resultCount\n\n setA11yStatus(status, this.props.environment.document)\n }, 200)\n\n componentDidMount() {\n /* istanbul ignore if (react-native) */\n if (\n process.env.NODE_ENV !== 'production' &&\n !isReactNative &&\n this.getMenuProps.called &&\n !this.getMenuProps.suppressRefError\n ) {\n validateGetMenuPropsCalledCorrectly(this._menuNode, this.getMenuProps)\n }\n\n /* istanbul ignore if (react-native) */\n if (isReactNative) {\n this.cleanup = () => {\n this.internalClearTimeouts()\n }\n } else {\n // this.isMouseDown helps us track whether the mouse is currently held down.\n // This is useful when the user clicks on an item in the list, but holds the mouse\n // down long enough for the list to disappear (because the blur event fires on the input)\n // this.isMouseDown is used in the blur handler on the input to determine whether the blur event should\n // trigger hiding the menu.\n const onMouseDown = () => {\n this.isMouseDown = true\n }\n const onMouseUp = event => {\n this.isMouseDown = false\n // if the target element or the activeElement is within a downshift node\n // then we don't want to reset downshift\n const contextWithinDownshift = targetWithinDownshift(\n event.target,\n [this._rootNode, this._menuNode],\n this.props.environment,\n )\n if (!contextWithinDownshift && this.getState().isOpen) {\n this.reset({type: stateChangeTypes.mouseUp}, () =>\n this.props.onOuterClick(this.getStateAndHelpers()),\n )\n }\n }\n // Touching an element in iOS gives focus and hover states, but touching out of\n // the element will remove hover, and persist the focus state, resulting in the\n // blur event not being triggered.\n // this.isTouchMove helps us track whether the user is tapping or swiping on a touch screen.\n // If the user taps outside of Downshift, the component should be reset,\n // but not if the user is swiping\n const onTouchStart = () => {\n this.isTouchMove = false\n }\n\n const onTouchMove = () => {\n this.isTouchMove = true\n }\n\n const onTouchEnd = event => {\n const contextWithinDownshift = targetWithinDownshift(\n event.target,\n [this._rootNode, this._menuNode],\n this.props.environment,\n false,\n )\n if (\n !this.isTouchMove &&\n !contextWithinDownshift &&\n this.getState().isOpen\n ) {\n this.reset({type: stateChangeTypes.touchEnd}, () =>\n this.props.onOuterClick(this.getStateAndHelpers()),\n )\n }\n }\n const {environment} = this.props\n\n environment.addEventListener('mousedown', onMouseDown)\n environment.addEventListener('mouseup', onMouseUp)\n environment.addEventListener('touchstart', onTouchStart)\n environment.addEventListener('touchmove', onTouchMove)\n environment.addEventListener('touchend', onTouchEnd)\n\n this.cleanup = () => {\n this.internalClearTimeouts()\n this.updateStatus.cancel()\n environment.removeEventListener('mousedown', onMouseDown)\n environment.removeEventListener('mouseup', onMouseUp)\n environment.removeEventListener('touchstart', onTouchStart)\n environment.removeEventListener('touchmove', onTouchMove)\n environment.removeEventListener('touchend', onTouchEnd)\n }\n }\n }\n\n shouldScroll(prevState, prevProps) {\n const {highlightedIndex: currentHighlightedIndex} =\n this.props.highlightedIndex === undefined ? this.getState() : this.props\n const {highlightedIndex: prevHighlightedIndex} =\n prevProps.highlightedIndex === undefined ? prevState : prevProps\n const scrollWhenOpen =\n currentHighlightedIndex && this.getState().isOpen && !prevState.isOpen\n const scrollWhenNavigating =\n currentHighlightedIndex !== prevHighlightedIndex\n\n return scrollWhenOpen || scrollWhenNavigating\n }\n\n componentDidUpdate(prevProps, prevState) {\n if (process.env.NODE_ENV !== 'production') {\n validateControlledUnchanged(this.state, prevProps, this.props)\n /* istanbul ignore if (react-native) */\n if (\n !isReactNative &&\n this.getMenuProps.called &&\n !this.getMenuProps.suppressRefError\n ) {\n validateGetMenuPropsCalledCorrectly(this._menuNode, this.getMenuProps)\n }\n }\n\n if (\n isControlledProp(this.props, 'selectedItem') &&\n this.props.selectedItemChanged(\n prevProps.selectedItem,\n this.props.selectedItem,\n )\n ) {\n this.internalSetState({\n type: stateChangeTypes.controlledPropUpdatedSelectedItem,\n inputValue: this.props.itemToString(this.props.selectedItem),\n })\n }\n\n if (!this.avoidScrolling && this.shouldScroll(prevState, prevProps)) {\n this.scrollHighlightedItemIntoView()\n }\n\n /* istanbul ignore else (react-native) */\n if (!isReactNative) {\n this.updateStatus()\n }\n }\n\n componentWillUnmount() {\n this.cleanup() // avoids memory leak\n }\n\n render() {\n const children = unwrapArray(this.props.children, noop)\n // because the items are rerendered every time we call the children\n // we clear this out each render and it will be populated again as\n // getItemProps is called.\n this.clearItems()\n // we reset this so we know whether the user calls getRootProps during\n // this render. If they do then we don't need to do anything,\n // if they don't then we need to clone the element they return and\n // apply the props for them.\n this.getRootProps.called = false\n this.getRootProps.refKey = undefined\n this.getRootProps.suppressRefError = undefined\n // we do something similar for getMenuProps\n this.getMenuProps.called = false\n this.getMenuProps.refKey = undefined\n this.getMenuProps.suppressRefError = undefined\n // we do something similar for getLabelProps\n this.getLabelProps.called = false\n // and something similar for getInputProps\n this.getInputProps.called = false\n const element = unwrapArray(children(this.getStateAndHelpers()))\n if (!element) {\n return null\n }\n\n if (this.getRootProps.called || this.props.suppressRefError) {\n if (\n process.env.NODE_ENV !== 'production' &&\n !this.getRootProps.suppressRefError &&\n !this.props.suppressRefError\n ) {\n validateGetRootPropsCalledCorrectly(element, this.getRootProps)\n }\n return element\n } else if (isDOMElement(element)) {\n // they didn't apply the root props, but we can clone\n // this and apply the props ourselves\n return cloneElement(element, this.getRootProps(getElementProps(element)))\n }\n\n /* istanbul ignore else */\n if (process.env.NODE_ENV !== 'production') {\n // they didn't apply the root props, but they need to\n // otherwise we can't query around the autocomplete\n\n throw new Error(\n 'downshift: If you return a non-DOM element, you must apply the getRootProps function',\n )\n }\n\n /* istanbul ignore next */\n return undefined\n }\n}\n\nexport default Downshift\n\nfunction validateGetMenuPropsCalledCorrectly(node, {refKey}) {\n if (!node) {\n // eslint-disable-next-line no-console\n console.error(\n `downshift: The ref prop \"${refKey}\" from getMenuProps was not applied correctly on your menu element.`,\n )\n }\n}\n\nfunction validateGetRootPropsCalledCorrectly(element, {refKey}) {\n const refKeySpecified = refKey !== 'ref'\n const isComposite = !isDOMElement(element)\n if (isComposite && !refKeySpecified && !isForwardRef(element)) {\n // eslint-disable-next-line no-console\n console.error(\n 'downshift: You returned a non-DOM element. You must specify a refKey in getRootProps',\n )\n } else if (!isComposite && refKeySpecified) {\n // eslint-disable-next-line no-console\n console.error(\n `downshift: You returned a DOM element. You should not specify a refKey in getRootProps. You specified \"${refKey}\"`,\n )\n }\n if (!isForwardRef(element) && !getElementProps(element)[refKey]) {\n // eslint-disable-next-line no-console\n console.error(\n `downshift: You must apply the ref prop \"${refKey}\" from getRootProps onto your root element.`,\n )\n }\n}\n","import setPrototypeOf from \"./setPrototypeOf.js\";\nexport default function _inheritsLoose(subClass, superClass) {\n subClass.prototype = Object.create(superClass.prototype);\n subClass.prototype.constructor = subClass;\n setPrototypeOf(subClass, superClass);\n}","import {\n useRef,\n useCallback,\n useReducer,\n useEffect,\n useLayoutEffect,\n} from 'react'\nimport {isReactNative} from '../is.macro'\nimport {\n scrollIntoView,\n getNextWrappingIndex,\n getState,\n generateId,\n debounce,\n targetWithinDownshift,\n validateControlledUnchanged,\n noop,\n} from '../utils'\nimport setStatus from '../set-a11y-status'\n\nconst dropdownDefaultStateValues = {\n highlightedIndex: -1,\n isOpen: false,\n selectedItem: null,\n inputValue: '',\n}\n\nfunction callOnChangeProps(action, state, newState) {\n const {props, type} = action\n const changes = {}\n\n Object.keys(state).forEach(key => {\n invokeOnChangeHandler(key, action, state, newState)\n\n if (newState[key] !== state[key]) {\n changes[key] = newState[key]\n }\n })\n\n if (props.onStateChange && Object.keys(changes).length) {\n props.onStateChange({type, ...changes})\n }\n}\n\nfunction invokeOnChangeHandler(key, action, state, newState) {\n const {props, type} = action\n const handler = `on${capitalizeString(key)}Change`\n if (\n props[handler] &&\n newState[key] !== undefined &&\n newState[key] !== state[key]\n ) {\n props[handler]({type, ...newState})\n }\n}\n\n/**\n * Default state reducer that returns the changes.\n *\n * @param {Object} s state.\n * @param {Object} a action with changes.\n * @returns {Object} changes.\n */\nfunction stateReducer(s, a) {\n return a.changes\n}\n\n/**\n * Returns a message to be added to aria-live region when item is selected.\n *\n * @param {Object} selectionParameters Parameters required to build the message.\n * @returns {string} The a11y message.\n */\nfunction getA11ySelectionMessage(selectionParameters) {\n const {selectedItem, itemToString: itemToStringLocal} = selectionParameters\n\n return selectedItem\n ? `${itemToStringLocal(selectedItem)} has been selected.`\n : ''\n}\n\n/**\n * Debounced call for updating the a11y message.\n */\nconst updateA11yStatus = debounce((getA11yMessage, document) => {\n setStatus(getA11yMessage(), document)\n}, 200)\n\n// istanbul ignore next\nconst useIsomorphicLayoutEffect =\n typeof window !== 'undefined' &&\n typeof window.document !== 'undefined' &&\n typeof window.document.createElement !== 'undefined'\n ? useLayoutEffect\n : useEffect\n\nfunction useElementIds({\n id = `downshift-${generateId()}`,\n labelId,\n menuId,\n getItemId,\n toggleButtonId,\n inputId,\n}) {\n const elementIdsRef = useRef({\n labelId: labelId || `${id}-label`,\n menuId: menuId || `${id}-menu`,\n getItemId: getItemId || (index => `${id}-item-${index}`),\n toggleButtonId: toggleButtonId || `${id}-toggle-button`,\n inputId: inputId || `${id}-input`,\n })\n\n return elementIdsRef.current\n}\n\nfunction getItemIndex(index, item, items) {\n if (index !== undefined) {\n return index\n }\n if (items.length === 0) {\n return -1\n }\n return items.indexOf(item)\n}\n\nfunction itemToString(item) {\n return item ? String(item) : ''\n}\n\nfunction isAcceptedCharacterKey(key) {\n return /^\\S{1}$/.test(key)\n}\n\nfunction capitalizeString(string) {\n return `${string.slice(0, 1).toUpperCase()}${string.slice(1)}`\n}\n\nfunction useLatestRef(val) {\n const ref = useRef(val)\n // technically this is not \"concurrent mode safe\" because we're manipulating\n // the value during render (so it's not idempotent). However, the places this\n // hook is used is to support memoizing callbacks which will be called\n // *during* render, so we need the latest values *during* render.\n // If not for this, then we'd probably want to use useLayoutEffect instead.\n ref.current = val\n return ref\n}\n\n/**\n * Computes the controlled state using a the previous state, props,\n * two reducers, one from downshift and an optional one from the user.\n * Also calls the onChange handlers for state values that have changed.\n *\n * @param {Function} reducer Reducer function from downshift.\n * @param {Object} initialState Initial state of the hook.\n * @param {Object} props The hook props.\n * @returns {Array} An array with the state and an action dispatcher.\n */\nfunction useEnhancedReducer(reducer, initialState, props) {\n const prevStateRef = useRef()\n const actionRef = useRef()\n const enhancedReducer = useCallback(\n (state, action) => {\n actionRef.current = action\n state = getState(state, action.props)\n\n const changes = reducer(state, action)\n const newState = action.props.stateReducer(state, {...action, changes})\n\n return newState\n },\n [reducer],\n )\n const [state, dispatch] = useReducer(enhancedReducer, initialState)\n const propsRef = useLatestRef(props)\n const dispatchWithProps = useCallback(\n action => dispatch({props: propsRef.current, ...action}),\n [propsRef],\n )\n const action = actionRef.current\n\n useEffect(() => {\n if (action && prevStateRef.current && prevStateRef.current !== state) {\n callOnChangeProps(\n action,\n getState(prevStateRef.current, action.props),\n state,\n )\n }\n\n prevStateRef.current = state\n }, [state, props, action])\n\n return [state, dispatchWithProps]\n}\n\n/**\n * Wraps the useEnhancedReducer and applies the controlled prop values before\n * returning the new state.\n *\n * @param {Function} reducer Reducer function from downshift.\n * @param {Object} initialState Initial state of the hook.\n * @param {Object} props The hook props.\n * @returns {Array} An array with the state and an action dispatcher.\n */\nfunction useControlledReducer(reducer, initialState, props) {\n const [state, dispatch] = useEnhancedReducer(reducer, initialState, props)\n\n return [getState(state, props), dispatch]\n}\n\nconst defaultProps = {\n itemToString,\n stateReducer,\n getA11ySelectionMessage,\n scrollIntoView,\n circularNavigation: false,\n environment:\n /* istanbul ignore next (ssr) */\n typeof window === 'undefined' ? {} : window,\n}\n\nfunction getDefaultValue(\n props,\n propKey,\n defaultStateValues = dropdownDefaultStateValues,\n) {\n const defaultPropKey = `default${capitalizeString(propKey)}`\n\n if (defaultPropKey in props) {\n return props[defaultPropKey]\n }\n\n return defaultStateValues[propKey]\n}\n\nfunction getInitialValue(\n props,\n propKey,\n defaultStateValues = dropdownDefaultStateValues,\n) {\n if (propKey in props) {\n return props[propKey]\n }\n\n const initialPropKey = `initial${capitalizeString(propKey)}`\n\n if (initialPropKey in props) {\n return props[initialPropKey]\n }\n return getDefaultValue(props, propKey, defaultStateValues)\n}\n\nfunction getInitialState(props) {\n const selectedItem = getInitialValue(props, 'selectedItem')\n const isOpen = getInitialValue(props, 'isOpen')\n const highlightedIndex = getInitialValue(props, 'highlightedIndex')\n const inputValue = getInitialValue(props, 'inputValue')\n\n return {\n highlightedIndex:\n highlightedIndex < 0 && selectedItem && isOpen\n ? props.items.indexOf(selectedItem)\n : highlightedIndex,\n isOpen,\n selectedItem,\n inputValue,\n }\n}\n\nfunction getHighlightedIndexOnOpen(props, state, offset, getItemNodeFromIndex) {\n const {items, initialHighlightedIndex, defaultHighlightedIndex} = props\n const {selectedItem, highlightedIndex} = state\n\n if (items.length === 0) {\n return -1\n }\n\n // initialHighlightedIndex will give value to highlightedIndex on initial state only.\n if (\n initialHighlightedIndex !== undefined &&\n highlightedIndex === initialHighlightedIndex\n ) {\n return initialHighlightedIndex\n }\n if (defaultHighlightedIndex !== undefined) {\n return defaultHighlightedIndex\n }\n if (selectedItem) {\n if (offset === 0) {\n return items.indexOf(selectedItem)\n }\n return getNextWrappingIndex(\n offset,\n items.indexOf(selectedItem),\n items.length,\n getItemNodeFromIndex,\n false,\n )\n }\n if (offset === 0) {\n return -1\n }\n return offset < 0 ? items.length - 1 : 0\n}\n\n/**\n * Reuse the movement tracking of mouse and touch events.\n *\n * @param {boolean} isOpen Whether the dropdown is open or not.\n * @param {Array<Object>} downshiftElementRefs Downshift element refs to track movement (toggleButton, menu etc.)\n * @param {Object} environment Environment where component/hook exists.\n * @param {Function} handleBlur Handler on blur from mouse or touch.\n * @returns {Object} Ref containing whether mouseDown or touchMove event is happening\n */\nfunction useMouseAndTouchTracker(\n isOpen,\n downshiftElementRefs,\n environment,\n handleBlur,\n) {\n const mouseAndTouchTrackersRef = useRef({\n isMouseDown: false,\n isTouchMove: false,\n })\n\n useEffect(() => {\n // The same strategy for checking if a click occurred inside or outside downsift\n // as in downshift.js.\n const onMouseDown = () => {\n mouseAndTouchTrackersRef.current.isMouseDown = true\n }\n const onMouseUp = event => {\n mouseAndTouchTrackersRef.current.isMouseDown = false\n if (\n isOpen &&\n !targetWithinDownshift(\n event.target,\n downshiftElementRefs.map(ref => ref.current),\n environment,\n )\n ) {\n handleBlur()\n }\n }\n const onTouchStart = () => {\n mouseAndTouchTrackersRef.current.isTouchMove = false\n }\n const onTouchMove = () => {\n mouseAndTouchTrackersRef.current.isTouchMove = true\n }\n const onTouchEnd = event => {\n if (\n isOpen &&\n !mouseAndTouchTrackersRef.current.isTouchMove &&\n !targetWithinDownshift(\n event.target,\n downshiftElementRefs.map(ref => ref.current),\n environment,\n false,\n )\n ) {\n handleBlur()\n }\n }\n\n environment.addEventListener('mousedown', onMouseDown)\n environment.addEventListener('mouseup', onMouseUp)\n environment.addEventListener('touchstart', onTouchStart)\n environment.addEventListener('touchmove', onTouchMove)\n environment.addEventListener('touchend', onTouchEnd)\n\n return function cleanup() {\n environment.removeEventListener('mousedown', onMouseDown)\n environment.removeEventListener('mouseup', onMouseUp)\n environment.removeEventListener('touchstart', onTouchStart)\n environment.removeEventListener('touchmove', onTouchMove)\n environment.removeEventListener('touchend', onTouchEnd)\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [isOpen, environment])\n\n return mouseAndTouchTrackersRef\n}\n\n/* istanbul ignore next */\n// eslint-disable-next-line import/no-mutable-exports\nlet useGetterPropsCalledChecker = () => noop\n/**\n * Custom hook that checks if getter props are called correctly.\n *\n * @param {...any} propKeys Getter prop names to be handled.\n * @returns {Function} Setter function called inside getter props to set call information.\n */\n/* istanbul ignore next */\nif (process.env.NODE_ENV !== 'production') {\n useGetterPropsCalledChecker = (...propKeys) => {\n const isInitialMountRef = useRef(true)\n const getterPropsCalledRef = useRef(\n propKeys.reduce((acc, propKey) => {\n acc[propKey] = {}\n return acc\n }, {}),\n )\n\n useEffect(() => {\n Object.keys(getterPropsCalledRef.current).forEach(propKey => {\n const propCallInfo = getterPropsCalledRef.current[propKey]\n if (isInitialMountRef.current) {\n if (!Object.keys(propCallInfo).length) {\n // eslint-disable-next-line no-console\n console.error(\n `downshift: You forgot to call the ${propKey} getter function on your component / element.`,\n )\n return\n }\n }\n\n const {suppressRefError, refKey, elementRef} = propCallInfo\n\n if ((!elementRef || !elementRef.current) && !suppressRefError) {\n // eslint-disable-next-line no-console\n console.error(\n `downshift: The ref prop \"${refKey}\" from ${propKey} was not applied correctly on your element.`,\n )\n }\n })\n\n isInitialMountRef.current = false\n })\n\n const setGetterPropCallInfo = useCallback(\n (propKey, suppressRefError, refKey, elementRef) => {\n getterPropsCalledRef.current[propKey] = {\n suppressRefError,\n refKey,\n elementRef,\n }\n },\n [],\n )\n\n return setGetterPropCallInfo\n }\n}\n\nfunction useA11yMessageSetter(\n getA11yMessage,\n dependencyArray,\n {isInitialMount, highlightedIndex, items, environment, ...rest},\n) {\n // Sets a11y status message on changes in state.\n useEffect(() => {\n if (isInitialMount || isReactNative) {\n return\n }\n\n updateA11yStatus(\n () =>\n getA11yMessage({\n highlightedIndex,\n highlightedItem: items[highlightedIndex],\n resultCount: items.length,\n ...rest,\n }),\n environment.document,\n )\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, dependencyArray)\n}\n\nfunction useScrollIntoView({\n highlightedIndex,\n isOpen,\n itemRefs,\n getItemNodeFromIndex,\n menuElement,\n scrollIntoView: scrollIntoViewProp,\n}) {\n // used not to scroll on highlight by mouse.\n const shouldScrollRef = useRef(true)\n // Scroll on highlighted item if change comes from keyboard.\n useIsomorphicLayoutEffect(() => {\n if (\n highlightedIndex < 0 ||\n !isOpen ||\n !Object.keys(itemRefs.current).length\n ) {\n return\n }\n\n if (shouldScrollRef.current === false) {\n shouldScrollRef.current = true\n } else {\n scrollIntoViewProp(getItemNodeFromIndex(highlightedIndex), menuElement)\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [highlightedIndex])\n\n return shouldScrollRef\n}\n\n// eslint-disable-next-line import/no-mutable-exports\nlet useControlPropsValidator = noop\n/* istanbul ignore next */\nif (process.env.NODE_ENV !== 'production') {\n useControlPropsValidator = ({isInitialMount, props, state}) => {\n // used for checking when props are moving from controlled to uncontrolled.\n const prevPropsRef = useRef(props)\n\n useEffect(() => {\n if (isInitialMount) {\n return\n }\n\n validateControlledUnchanged(state, prevPropsRef.current, props)\n prevPropsRef.current = props\n }, [state, props, isInitialMount])\n }\n}\n\nexport {\n useControlPropsValidator,\n useScrollIntoView,\n useA11yMessageSetter,\n useGetterPropsCalledChecker,\n useMouseAndTouchTracker,\n getHighlightedIndexOnOpen,\n getInitialState,\n getInitialValue,\n getDefaultValue,\n defaultProps,\n useControlledReducer,\n useEnhancedReducer,\n useLatestRef,\n capitalizeString,\n isAcceptedCharacterKey,\n getItemIndex,\n useElementIds,\n}\n","import {getHighlightedIndexOnOpen, getDefaultValue} from './utils'\n\n/* eslint-disable complexity */\nexport default function downshiftCommonReducer(\n state,\n action,\n stateChangeTypes,\n) {\n const {type, props} = action\n let changes\n\n switch (type) {\n case stateChangeTypes.ItemMouseMove:\n changes = {\n highlightedIndex: action.index,\n }\n\n break\n case stateChangeTypes.MenuMouseLeave:\n changes = {\n highlightedIndex: -1,\n }\n\n break\n case stateChangeTypes.ToggleButtonClick:\n case stateChangeTypes.FunctionToggleMenu:\n changes = {\n isOpen: !state.isOpen,\n highlightedIndex: state.isOpen\n ? -1\n : getHighlightedIndexOnOpen(props, state, 0),\n }\n\n break\n case stateChangeTypes.FunctionOpenMenu:\n changes = {\n isOpen: true,\n highlightedIndex: getHighlightedIndexOnOpen(props, state, 0),\n }\n\n break\n case stateChangeTypes.FunctionCloseMenu:\n changes = {\n isOpen: false,\n }\n\n break\n case stateChangeTypes.FunctionSetHighlightedIndex:\n changes = {\n highlightedIndex: action.highlightedIndex,\n }\n\n break\n case stateChangeTypes.FunctionSetInputValue:\n changes = {\n inputValue: action.inputValue,\n }\n\n break\n case stateChangeTypes.FunctionReset:\n changes = {\n highlightedIndex: getDefaultValue(props, 'highlightedIndex'),\n isOpen: getDefaultValue(props, 'isOpen'),\n selectedItem: getDefaultValue(props, 'selectedItem'),\n inputValue: getDefaultValue(props, 'inputValue'),\n }\n\n break\n default:\n throw new Error('Reducer called without proper action type.')\n }\n\n return {\n ...state,\n ...changes,\n }\n}\n/* eslint-enable complexity */\n","/*! *****************************************************************************\r\nCopyright (c) Microsoft Corporation.\r\n\r\nPermission to use, copy, modify, and/or distribute this software for any\r\npurpose with or without fee is hereby granted.\r\n\r\nTHE SOFTWARE IS PROVIDED \"AS IS\" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH\r\nREGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY\r\nAND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,\r\nINDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM\r\nLOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR\r\nOTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR\r\nPERFORMANCE OF THIS SOFTWARE.\r\n***************************************************************************** */\r\n/* global Reflect, Promise */\r\n\r\nvar extendStatics = function(d, b) {\r\n extendStatics = Object.setPrototypeOf ||\r\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\r\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\r\n return extendStatics(d, b);\r\n};\r\n\r\nexport function __extends(d, b) {\r\n if (typeof b !== \"function\" && b !== null)\r\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\r\n extendStatics(d, b);\r\n function __() { this.constructor = d; }\r\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\r\n}\r\n\r\nexport var __assign = function() {\r\n __assign = Object.assign || function __assign(t) {\r\n for (var s, i = 1, n = arguments.length; i < n; i++) {\r\n s = arguments[i];\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];\r\n }\r\n return t;\r\n }\r\n return __assign.apply(this, arguments);\r\n}\r\n\r\nexport function __rest(s, e) {\r\n var t = {};\r\n for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)\r\n t[p] = s[p];\r\n if (s != null && typeof Object.getOwnPropertySymbols === \"function\")\r\n for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {\r\n if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))\r\n t[p[i]] = s[p[i]];\r\n }\r\n return t;\r\n}\r\n\r\nexport function __decorate(decorators, target, key, desc) {\r\n var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;\r\n if (typeof Reflect === \"object\" && typeof Reflect.decorate === \"function\") r = Reflect.decorate(decorators, target, key, desc);\r\n else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;\r\n return c > 3 && r && Object.defineProperty(target, key, r), r;\r\n}\r\n\r\nexport function __param(paramIndex, decorator) {\r\n return function (target, key) { decorator(target, key, paramIndex); }\r\n}\r\n\r\nexport function __metadata(metadataKey, metadataValue) {\r\n if (typeof Reflect === \"object\" && typeof Reflect.metadata === \"function\") return Reflect.metadata(metadataKey, metadataValue);\r\n}\r\n\r\nexport function __awaiter(thisArg, _arguments, P, generator) {\r\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\r\n return new (P || (P = Promise))(function (resolve, reject) {\r\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\r\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\r\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\r\n step((generator = generator.apply(thisArg, _arguments || [])).next());\r\n });\r\n}\r\n\r\nexport function __generator(thisArg, body) {\r\n var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;\r\n return g = { next: verb(0), \"throw\": verb(1), \"return\": verb(2) }, typeof Symbol === \"function\" && (g[Symbol.iterator] = function() { return this; }), g;\r\n function verb(n) { return function (v) { return step([n, v]); }; }\r\n function step(op) {\r\n if (f) throw new TypeError(\"Generator is already executing.\");\r\n while (_) try {\r\n if (f = 1, y && (t = op[0] & 2 ? y[\"return\"] : op[0] ? y[\"throw\"] || ((t = y[\"return\"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;\r\n if (y = 0, t) op = [op[0] & 2, t.value];\r\n switch (op[0]) {\r\n case 0: case 1: t = op; break;\r\n case 4: _.label++; return { value: op[1], done: false };\r\n case 5: _.label++; y = op[1]; op = [0]; continue;\r\n case 7: op = _.ops.pop(); _.trys.pop(); continue;\r\n default:\r\n if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }\r\n if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }\r\n if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }\r\n if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }\r\n if (t[2]) _.ops.pop();\r\n _.trys.pop(); continue;\r\n }\r\n op = body.call(thisArg, _);\r\n } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }\r\n if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };\r\n }\r\n}\r\n\r\nexport var __createBinding = Object.create ? (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });\r\n}) : (function(o, m, k, k2) {\r\n if (k2 === undefined) k2 = k;\r\n o[k2] = m[k];\r\n});\r\n\r\nexport function __exportStar(m, o) {\r\n for (var p in m) if (p !== \"default\" && !Object.prototype.hasOwnProperty.call(o, p)) __createBinding(o, m, p);\r\n}\r\n\r\nexport function __values(o) {\r\n var s = typeof Symbol === \"function\" && Symbol.iterator, m = s && o[s], i = 0;\r\n if (m) return m.call(o);\r\n if (o && typeof o.length === \"number\") return {\r\n next: function () {\r\n if (o && i >= o.length) o = void 0;\r\n return { value: o && o[i++], done: !o };\r\n }\r\n };\r\n throw new TypeError(s ? \"Object is not iterable.\" : \"Symbol.iterator is not defined.\");\r\n}\r\n\r\nexport function __read(o, n) {\r\n var m = typeof Symbol === \"function\" && o[Symbol.iterator];\r\n if (!m) return o;\r\n var i = m.call(o), r, ar = [], e;\r\n try {\r\n while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);\r\n }\r\n catch (error) { e = { error: error }; }\r\n finally {\r\n try {\r\n if (r && !r.done && (m = i[\"return\"])) m.call(i);\r\n }\r\n finally { if (e) throw e.error; }\r\n }\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spread() {\r\n for (var ar = [], i = 0; i < arguments.length; i++)\r\n ar = ar.concat(__read(arguments[i]));\r\n return ar;\r\n}\r\n\r\n/** @deprecated */\r\nexport function __spreadArrays() {\r\n for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;\r\n for (var r = Array(s), k = 0, i = 0; i < il; i++)\r\n for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)\r\n r[k] = a[j];\r\n return r;\r\n}\r\n\r\nexport function __spreadArray(to, from, pack) {\r\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\r\n if (ar || !(i in from)) {\r\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\r\n ar[i] = from[i];\r\n }\r\n }\r\n return to.concat(ar || from);\r\n}\r\n\r\nexport function __await(v) {\r\n return this instanceof __await ? (this.v = v, this) : new __await(v);\r\n}\r\n\r\nexport function __asyncGenerator(thisArg, _arguments, generator) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var g = generator.apply(thisArg, _arguments || []), i, q = [];\r\n return i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i;\r\n function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }\r\n function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }\r\n function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }\r\n function fulfill(value) { resume(\"next\", value); }\r\n function reject(value) { resume(\"throw\", value); }\r\n function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }\r\n}\r\n\r\nexport function __asyncDelegator(o) {\r\n var i, p;\r\n return i = {}, verb(\"next\"), verb(\"throw\", function (e) { throw e; }), verb(\"return\"), i[Symbol.iterator] = function () { return this; }, i;\r\n function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: n === \"return\" } : f ? f(v) : v; } : f; }\r\n}\r\n\r\nexport function __asyncValues(o) {\r\n if (!Symbol.asyncIterator) throw new TypeError(\"Symbol.asyncIterator is not defined.\");\r\n var m = o[Symbol.asyncIterator], i;\r\n return m ? m.call(o) : (o = typeof __values === \"function\" ? __values(o) : o[Symbol.iterator](), i = {}, verb(\"next\"), verb(\"throw\"), verb(\"return\"), i[Symbol.asyncIterator] = function () { return this; }, i);\r\n function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }\r\n function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }\r\n}\r\n\r\nexport function __makeTemplateObject(cooked, raw) {\r\n if (Object.defineProperty) { Object.defineProperty(cooked, \"raw\", { value: raw }); } else { cooked.raw = raw; }\r\n return cooked;\r\n};\r\n\r\nvar __setModuleDefault = Object.create ? (function(o, v) {\r\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\r\n}) : function(o, v) {\r\n o[\"default\"] = v;\r\n};\r\n\r\nexport function __importStar(mod) {\r\n if (mod && mod.__esModule) return mod;\r\n var result = {};\r\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\r\n __setModuleDefault(result, mod);\r\n return result;\r\n}\r\n\r\nexport function __importDefault(mod) {\r\n return (mod && mod.__esModule) ? mod : { default: mod };\r\n}\r\n\r\nexport function __classPrivateFieldGet(receiver, state, kind, f) {\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a getter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot read private member from an object whose class did not declare it\");\r\n return kind === \"m\" ? f : kind === \"a\" ? f.call(receiver) : f ? f.value : state.get(receiver);\r\n}\r\n\r\nexport function __classPrivateFieldSet(receiver, state, value, kind, f) {\r\n if (kind === \"m\") throw new TypeError(\"Private method is not writable\");\r\n if (kind === \"a\" && !f) throw new TypeError(\"Private accessor was defined without a setter\");\r\n if (typeof state === \"function\" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError(\"Cannot write private member to an object whose class did not declare it\");\r\n return (kind === \"a\" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;\r\n}\r\n","import PropTypes from 'prop-types'\nimport {defaultProps as commonDefaultProps} from '../utils'\nimport {noop} from '../../utils'\nimport {A11yStatusMessageOptions} from '../../types'\nimport {GetItemIndexByCharacterKeyOptions} from './types'\n\nexport function getItemIndexByCharacterKey<Item>({\n keysSoFar,\n highlightedIndex,\n items,\n itemToString,\n getItemNodeFromIndex,\n}: GetItemIndexByCharacterKeyOptions<Item>) {\n const lowerCasedKeysSoFar = keysSoFar.toLowerCase()\n\n for (let index = 0; index < items.length; index++) {\n const offsetIndex = (index + highlightedIndex + 1) % items.length\n const item = items[offsetIndex]\n\n if (\n item !== undefined &&\n itemToString(item)\n .toLowerCase()\n .startsWith(lowerCasedKeysSoFar)\n ) {\n const element = getItemNodeFromIndex(offsetIndex)\n\n if (!element?.hasAttribute('disabled')) {\n return offsetIndex\n }\n }\n }\n\n return highlightedIndex\n}\n\nconst propTypes = {\n items: PropTypes.array.isRequired,\n itemToString: PropTypes.func,\n getA11yStatusMessage: PropTypes.func,\n getA11ySelectionMessage: PropTypes.func,\n circularNavigation: PropTypes.bool,\n highlightedIndex: PropTypes.number,\n defaultHighlightedIndex: PropTypes.number,\n initialHighlightedIndex: PropTypes.number,\n isOpen: PropTypes.bool,\n defaultIsOpen: PropTypes.bool,\n initialIsOpen: PropTypes.bool,\n selectedItem: PropTypes.any,\n initialSelectedItem: PropTypes.any,\n defaultSelectedItem: PropTypes.any,\n id: PropTypes.string,\n labelId: PropTypes.string,\n menuId: PropTypes.string,\n getItemId: PropTypes.func,\n toggleButtonId: PropTypes.string,\n stateReducer: PropTypes.func,\n onSelectedItemChange: PropTypes.func,\n onHighlightedIndexChange: PropTypes.func,\n onStateChange: PropTypes.func,\n onIsOpenChange: PropTypes.func,\n environment: PropTypes.shape({\n addEventListener: PropTypes.func,\n removeEventListener: PropTypes.func,\n document: PropTypes.shape({\n getElementById: PropTypes.func,\n activeElement: PropTypes.any,\n body: PropTypes.any,\n }),\n }),\n}\n\n/**\n * Default implementation for status message. Only added when menu is open.\n * Will specift if there are results in the list, and if so, how many,\n * and what keys are relevant.\n *\n * @param {Object} param the downshift state and other relevant properties\n * @return {String} the a11y status message\n */\nfunction getA11yStatusMessage<Item>({\n isOpen,\n resultCount,\n previousResultCount,\n}: A11yStatusMessageOptions<Item>): string {\n if (!isOpen) {\n return ''\n }\n\n if (!resultCount) {\n return 'No results are available.'\n }\n\n if (resultCount !== previousResultCount) {\n return `${resultCount} result${\n resultCount === 1 ? ' is' : 's are'\n } available, use up and down arrow keys to navigate. Press Enter or Space Bar keys to select.`\n }\n\n return ''\n}\n\nexport const defaultProps = {\n ...commonDefaultProps,\n getA11yStatusMessage,\n}\n\n// eslint-disable-next-line import/no-mutable-exports\nexport let validatePropTypes = noop as (\n options: unknown,\n caller: Function,\n) => void\n/* istanbul ignore next */\nif (process.env.NODE_ENV !== 'production') {\n validatePropTypes = (options: unknown, caller: Function): void => {\n PropTypes.checkPropTypes(propTypes, options, 'prop', caller.name)\n }\n}\n","import {getNextWrappingIndex, getNextNonDisabledIndex} from '../../utils'\nimport {getHighlightedIndexOnOpen, getDefaultValue} from '../utils'\nimport commonReducer from '../reducer'\nimport {getItemIndexByCharacterKey} from './utils'\nimport * as stateChangeTypes from './stateChangeTypes'\n\n/* eslint-disable complexity */\nexport default function downshiftSelectReducer(state, action) {\n const {type, props, shiftKey} = action\n let changes\n\n switch (type) {\n case stateChangeTypes.ItemClick:\n changes = {\n isOpen: getDefaultValue(props, 'isOpen'),\n highlightedIndex: getDefaultValue(props, 'highlightedIndex'),\n selectedItem: props.items[action.index],\n }\n\n break\n case stateChangeTypes.ToggleButtonKeyDownCharacter:\n {\n const lowercasedKey = action.key\n const inputValue = `${state.inputValue}${lowercasedKey}`\n const itemIndex = getItemIndexByCharacterKey({\n keysSoFar: inputValue,\n highlightedIndex: state.selectedItem\n ? props.items.indexOf(state.selectedItem)\n : -1,\n items: props.items,\n itemToString: props.itemToString,\n getItemNodeFromIndex: action.getItemNodeFromIndex,\n })\n\n changes = {\n inputValue,\n ...(itemIndex >= 0 && {\n selectedItem: props.items[itemIndex],\n }),\n }\n }\n\n break\n case stateChangeTypes.ToggleButtonKeyDownArrowDown:\n changes = {\n highlightedIndex: getHighlightedIndexOnOpen(\n props,\n state,\n 1,\n action.getItemNodeFromIndex,\n ),\n isOpen: true,\n }\n\n break\n case stateChangeTypes.ToggleButtonKeyDownArrowUp:\n changes = {\n highlightedIndex: getHighlightedIndexOnOpen(\n props,\n state,\n -1,\n action.getItemNodeFromIndex,\n ),\n isOpen: true,\n }\n\n break\n case stateChangeTypes.MenuKeyDownEnter:\n case stateChangeTypes.MenuKeyDownSpaceButton:\n changes = {\n isOpen: getDefaultValue(props, 'isOpen'),\n highlightedIndex: getDefaultValue(props, 'highlightedIndex'),\n ...(state.highlightedIndex >= 0 && {\n selectedItem: props.items[state.highlightedIndex],\n }),\n }\n\n break\n case stateChangeTypes.MenuKeyDownHome:\n changes = {\n highlightedIndex: getNextNonDisabledIndex(\n 1,\n 0,\n props.items.length,\n action.getItemNodeFromIndex,\n false,\n ),\n }\n\n break\n case stateChangeTypes.MenuKeyDownEnd:\n changes = {\n highlightedIndex: getNextNonDisabledIndex(\n -1,\n props.items.length - 1,\n props.items.length,\n action.getItemNodeFromIndex,\n false,\n ),\n }\n\n break\n case stateChangeTypes.MenuKeyDownEscape:\n changes = {\n isOpen: false,\n highlightedIndex: -1,\n }\n\n break\n case stateChangeTypes.MenuBlur:\n changes = {\n isOpen: false,\n highlightedIndex: -1,\n }\n\n break\n case stateChangeTypes.MenuKeyDownCharacter:\n {\n const lowercasedKey = action.key\n const inputValue = `${state.inputValue}${lowercasedKey}`\n const highlightedIndex = getItemIndexByCharacterKey({\n keysSoFar: inputValue,\n highlightedIndex: state.highlightedIndex,\n items: props.items,\n itemToString: props.itemToString,\n getItemNodeFromIndex: action.getItemNodeFromIndex,\n })\n\n changes = {\n inputValue,\n ...(highlightedIndex >= 0 && {\n highlightedIndex,\n }),\n }\n }\n break\n case stateChangeTypes.MenuKeyDownArrowDown:\n changes = {\n highlightedIndex: getNextWrappingIndex(\n shiftKey ? 5 : 1,\n state.highlightedIndex,\n props.items.length,\n action.getItemNodeFromIndex,\n props.circularNavigation,\n ),\n }\n\n break\n case stateChangeTypes.MenuKeyDownArrowUp:\n changes = {\n highlightedIndex: getNextWrappingIndex(\n shiftKey ? -5 : -1,\n state.highlightedIndex,\n props.items.length,\n action.getItemNodeFromIndex,\n props.circularNavigation,\n ),\n }\n break\n\n case stateChangeTypes.FunctionSelectItem:\n changes = {\n selectedItem: action.selectedItem,\n }\n\n break\n default:\n return commonReducer(state, action, stateChangeTypes)\n }\n\n return {\n ...state,\n ...changes,\n }\n}\n/* eslint-enable complexity */\n","/* eslint-disable max-statements */\nimport {useRef, useEffect, useCallback, useMemo} from 'react'\nimport {\n getItemIndex,\n isAcceptedCharacterKey,\n useControlledReducer,\n getInitialState,\n useMouseAndTouchTracker,\n useGetterPropsCalledChecker,\n useLatestRef,\n useA11yMessageSetter,\n useScrollIntoView,\n useControlPropsValidator,\n useElementIds,\n} from '../utils'\nimport {\n callAllEventHandlers,\n handleRefs,\n debounce,\n normalizeArrowKey,\n} from '../../utils'\nimport downshiftSelectReducer from './reducer'\nimport {validatePropTypes, defaultProps} from './utils'\nimport * as stateChangeTypes from './stateChangeTypes'\n\nuseSelect.stateChangeTypes = stateChangeTypes\n\nfunction useSelect(userProps = {}) {\n validatePropTypes(userProps, useSelect)\n // Props defaults and destructuring.\n const props = {\n ...defaultProps,\n ...userProps,\n }\n const {\n items,\n scrollIntoView,\n environment,\n initialIsOpen,\n defaultIsOpen,\n itemToString,\n getA11ySelectionMessage,\n getA11yStatusMessage,\n } = props\n // Initial state depending on controlled props.\n const initialState = getInitialState(props)\n const [state, dispatch] = useControlledReducer(\n downshiftSelectReducer,\n initialState,\n props,\n )\n const {isOpen, highlightedIndex, selectedItem, inputValue} = state\n\n // Element efs.\n const toggleButtonRef = useRef(null)\n const menuRef = useRef(null)\n const itemRefs = useRef({})\n // used not to trigger menu blur action in some scenarios.\n const shouldBlurRef = useRef(true)\n // used to keep the inputValue clearTimeout object between renders.\n const clearTimeoutRef = useRef(null)\n // prevent id re-generation between renders.\n const elementIds = useElementIds(props)\n // used to keep track of how many items we had on previous cycle.\n const previousResultCountRef = useRef()\n const isInitialMountRef = useRef(true)\n // utility callback to get item element.\n const latest = useLatestRef({\n state,\n props,\n })\n\n // Some utils.\n const getItemNodeFromIndex = useCallback(\n index => itemRefs.current[elementIds.getItemId(index)],\n [elementIds],\n )\n\n // Effects.\n // Sets a11y status message on changes in state.\n useA11yMessageSetter(\n getA11yStatusMessage,\n [isOpen, highlightedIndex, inputValue, items],\n {\n isInitialMount: isInitialMountRef.current,\n previousResultCount: previousResultCountRef.current,\n items,\n environment,\n itemToString,\n ...state,\n },\n )\n // Sets a11y status message on changes in selectedItem.\n useA11yMessageSetter(getA11ySelectionMessage, [selectedItem], {\n isInitialMount: isInitialMountRef.current,\n previousResultCount: previousResultCountRef.current,\n items,\n environment,\n itemToString,\n ...state,\n })\n // Scroll on highlighted item if change comes from keyboard.\n const shouldScrollRef = useScrollIntoView({\n menuElement: menuRef.current,\n highlightedIndex,\n isOpen,\n itemRefs,\n scrollIntoView,\n getItemNodeFromIndex,\n })\n\n // Sets cleanup for the keysSoFar callback, debounded after 500ms.\n useEffect(() => {\n // init the clean function here as we need access to dispatch.\n clearTimeoutRef.current = debounce(outerDispatch => {\n outerDispatch({\n type: stateChangeTypes.FunctionSetInputValue,\n inputValue: '',\n })\n }, 500)\n\n // Cancel any pending debounced calls on mount\n return () => {\n clearTimeoutRef.current.cancel()\n }\n }, [])\n\n // Invokes the keysSoFar callback set up above.\n useEffect(() => {\n if (!inputValue) {\n return\n }\n\n clearTimeoutRef.current(dispatch)\n }, [dispatch, inputValue])\n\n useControlPropsValidator({\n isInitialMount: isInitialMountRef.current,\n props,\n state,\n })\n /* Controls the focus on the menu or the toggle button. */\n useEffect(() => {\n // Don't focus menu on first render.\n if (isInitialMountRef.current) {\n // Unless it was initialised as open.\n if ((initialIsOpen || defaultIsOpen || isOpen) && menuRef.current) {\n menuRef.current.focus()\n }\n return\n }\n // Focus menu on open.\n if (isOpen) {\n // istanbul ignore else\n if (menuRef.current) {\n menuRef.current.focus()\n }\n return\n }\n // Focus toggleButton on close, but not if it was closed with (Shift+)Tab.\n if (environment.document.activeElement === menuRef.current) {\n // istanbul ignore else\n if (toggleButtonRef.current) {\n shouldBlurRef.current = false\n toggleButtonRef.current.focus()\n }\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [isOpen])\n useEffect(() => {\n if (isInitialMountRef.current) {\n return\n }\n\n previousResultCountRef.current = items.length\n })\n // Add mouse/touch events to document.\n const mouseAndTouchTrackersRef = useMouseAndTouchTracker(\n isOpen,\n [menuRef, toggleButtonRef],\n environment,\n () => {\n dispatch({\n type: stateChangeTypes.MenuBlur,\n })\n },\n )\n const setGetterPropCallInfo = useGetterPropsCalledChecker(\n 'getMenuProps',\n 'getToggleButtonProps',\n )\n // Make initial ref false.\n useEffect(() => {\n isInitialMountRef.current = false\n }, [])\n // Reset itemRefs on close.\n useEffect(() => {\n if (!isOpen) {\n itemRefs.current = {}\n }\n }, [isOpen])\n\n // Event handler functions.\n const toggleButtonKeyDownHandlers = useMemo(\n () => ({\n ArrowDown(event) {\n event.preventDefault()\n\n dispatch({\n type: stateChangeTypes.ToggleButtonKeyDownArrowDown,\n getItemNodeFromIndex,\n shiftKey: event.shiftKey,\n })\n },\n ArrowUp(event) {\n event.preventDefault()\n\n dispatch({\n type: stateChangeTypes.ToggleButtonKeyDownArrowUp,\n getItemNodeFromIndex,\n shiftKey: event.shiftKey,\n })\n },\n }),\n [dispatch, getItemNodeFromIndex],\n )\n const menuKeyDownHandlers = useMemo(\n () => ({\n ArrowDown(event) {\n event.preventDefault()\n\n dispatch({\n type: stateChangeTypes.MenuKeyDownArrowDown,\n getItemNodeFromIndex,\n shiftKey: event.shiftKey,\n })\n },\n ArrowUp(event) {\n event.preventDefault()\n\n dispatch({\n type: stateChangeTypes.MenuKeyDownArrowUp,\n getItemNodeFromIndex,\n shiftKey: event.shiftKey,\n })\n },\n Home(event) {\n event.preventDefault()\n\n dispatch({\n type: stateChangeTypes.MenuKeyDownHome,\n getItemNodeFromIndex,\n })\n },\n End(event) {\n event.preventDefault()\n\n dispatch({\n type: stateChangeTypes.MenuKeyDownEnd,\n getItemNodeFromIndex,\n })\n },\n Escape() {\n dispatch({\n type: stateChangeTypes.MenuKeyDownEscape,\n })\n },\n Enter(event) {\n event.preventDefault()\n\n dispatch({\n type: stateChangeTypes.MenuKeyDownEnter,\n })\n },\n ' '(event) {\n event.preventDefault()\n\n dispatch({\n type: stateChangeTypes.MenuKeyDownSpaceButton,\n })\n },\n }),\n [dispatch, getItemNodeFromIndex],\n )\n\n // Action functions.\n const toggleMenu = useCallback(() => {\n dispatch({\n type: stateChangeTypes.FunctionToggleMenu,\n })\n }, [dispatch])\n const closeMenu = useCallback(() => {\n dispatch({\n type: stateChangeTypes.FunctionCloseMenu,\n })\n }, [dispatch])\n const openMenu = useCallback(() => {\n dispatch({\n type: stateChangeTypes.FunctionOpenMenu,\n })\n }, [dispatch])\n const setHighlightedIndex = useCallback(\n newHighlightedIndex => {\n dispatch({\n type: stateChangeTypes.FunctionSetHighlightedIndex,\n highlightedIndex: newHighlightedIndex,\n })\n },\n [dispatch],\n )\n const selectItem = useCallback(\n newSelectedItem => {\n dispatch({\n type: stateChangeTypes.FunctionSelectItem,\n selectedItem: newSelectedItem,\n })\n },\n [dispatch],\n )\n const reset = useCallback(() => {\n dispatch({\n type: stateChangeTypes.FunctionReset,\n })\n }, [dispatch])\n const setInputValue = useCallback(\n newInputValue => {\n dispatch({\n type: stateChangeTypes.FunctionSetInputValue,\n inputValue: newInputValue,\n })\n },\n [dispatch],\n )\n // Getter functions.\n const getLabelProps = useCallback(\n labelProps => ({\n id: elementIds.labelId,\n htmlFor: elementIds.toggleButtonId,\n ...labelProps,\n }),\n [elementIds],\n )\n const getMenuProps = useCallback(\n (\n {onMouseLeave, refKey = 'ref', onKeyDown, onBlur, ref, ...rest} = {},\n {suppressRefError = false} = {},\n ) => {\n const latestState = latest.current.state\n const menuHandleKeyDown = event => {\n const key = normalizeArrowKey(event)\n if (key && menuKeyDownHandlers[key]) {\n menuKeyDownHandlers[key](event)\n } else if (isAcceptedCharacterKey(key)) {\n dispatch({\n type: stateChangeTypes.MenuKeyDownCharacter,\n key,\n getItemNodeFromIndex,\n })\n }\n }\n const menuHandleBlur = () => {\n // if the blur was a result of selection, we don't trigger this action.\n if (shouldBlurRef.current === false) {\n shouldBlurRef.current = true\n return\n }\n\n const shouldBlur = !mouseAndTouchTrackersRef.current.isMouseDown\n /* istanbul ignore else */\n if (shouldBlur) {\n dispatch({type: stateChangeTypes.MenuBlur})\n }\n }\n const menuHandleMouseLeave = () => {\n dispatch({\n type: stateChangeTypes.MenuMouseLeave,\n })\n }\n\n setGetterPropCallInfo('getMenuProps', suppressRefError, refKey, menuRef)\n\n return {\n [refKey]: handleRefs(ref, menuNode => {\n menuRef.current = menuNode\n }),\n id: elementIds.menuId,\n role: 'listbox',\n 'aria-labelledby': elementIds.labelId,\n tabIndex: -1,\n ...(latestState.isOpen &&\n latestState.highlightedIndex > -1 && {\n 'aria-activedescendant': elementIds.getItemId(\n latestState.highlightedIndex,\n ),\n }),\n onMouseLeave: callAllEventHandlers(onMouseLeave, menuHandleMouseLeave),\n onKeyDown: callAllEventHandlers(onKeyDown, menuHandleKeyDown),\n onBlur: callAllEventHandlers(onBlur, menuHandleBlur),\n ...rest,\n }\n },\n [\n dispatch,\n latest,\n menuKeyDownHandlers,\n mouseAndTouchTrackersRef,\n setGetterPropCallInfo,\n elementIds,\n getItemNodeFromIndex,\n ],\n )\n const getToggleButtonProps = useCallback(\n (\n {onClick, onKeyDown, refKey = 'ref', ref, ...rest} = {},\n {suppressRefError = false} = {},\n ) => {\n const toggleButtonHandleClick = () => {\n dispatch({\n type: stateChangeTypes.ToggleButtonClick,\n })\n }\n const toggleButtonHandleKeyDown = event => {\n const key = normalizeArrowKey(event)\n if (key && toggleButtonKeyDownHandlers[key]) {\n toggleButtonKeyDownHandlers[key](event)\n } else if (isAcceptedCharacterKey(key)) {\n dispatch({\n type: stateChangeTypes.ToggleButtonKeyDownCharacter,\n key,\n getItemNodeFromIndex,\n })\n }\n }\n const toggleProps = {\n [refKey]: handleRefs(ref, toggleButtonNode => {\n toggleButtonRef.current = toggleButtonNode\n }),\n id: elementIds.toggleButtonId,\n 'aria-haspopup': 'listbox',\n 'aria-expanded': latest.current.state.isOpen,\n 'aria-labelledby': `${elementIds.labelId} ${elementIds.toggleButtonId}`,\n ...rest,\n }\n\n if (!rest.disabled) {\n toggleProps.onClick = callAllEventHandlers(\n onClick,\n toggleButtonHandleClick,\n )\n toggleProps.onKeyDown = callAllEventHandlers(\n onKeyDown,\n toggleButtonHandleKeyDown,\n )\n }\n\n setGetterPropCallInfo(\n 'getToggleButtonProps',\n suppressRefError,\n refKey,\n toggleButtonRef,\n )\n\n return toggleProps\n },\n [\n dispatch,\n latest,\n toggleButtonKeyDownHandlers,\n setGetterPropCallInfo,\n elementIds,\n getItemNodeFromIndex,\n ],\n )\n const getItemProps = useCallback(\n ({\n item,\n index,\n onMouseMove,\n onClick,\n refKey = 'ref',\n ref,\n ...rest\n } = {}) => {\n const {state: latestState, props: latestProps} = latest.current\n const itemHandleMouseMove = () => {\n if (index === latestState.highlightedIndex) {\n return\n }\n shouldScrollRef.current = false\n dispatch({\n type: stateChangeTypes.ItemMouseMove,\n index,\n })\n }\n const itemHandleClick = () => {\n dispatch({\n type: stateChangeTypes.ItemClick,\n index,\n })\n }\n\n const itemIndex = getItemIndex(index, item, latestProps.items)\n if (itemIndex < 0) {\n throw new Error('Pass either item or item index in getItemProps!')\n }\n const itemProps = {\n role: 'option',\n 'aria-selected': `${itemIndex === latestState.highlightedIndex}`,\n id: elementIds.getItemId(itemIndex),\n [refKey]: handleRefs(ref, itemNode => {\n if (itemNode) {\n itemRefs.current[elementIds.getItemId(itemIndex)] = itemNode\n }\n }),\n ...rest,\n }\n\n if (!rest.disabled) {\n itemProps.onMouseMove = callAllEventHandlers(\n onMouseMove,\n itemHandleMouseMove,\n )\n itemProps.onClick = callAllEventHandlers(onClick, itemHandleClick)\n }\n\n return itemProps\n },\n [dispatch, latest, shouldScrollRef, elementIds],\n )\n\n return {\n // prop getters.\n getToggleButtonProps,\n getLabelProps,\n getMenuProps,\n getItemProps,\n // actions.\n toggleMenu,\n openMenu,\n closeMenu,\n setHighlightedIndex,\n selectItem,\n reset,\n setInputValue,\n // state.\n highlightedIndex,\n isOpen,\n selectedItem,\n inputValue,\n }\n}\n\nexport default useSelect\n","import productionEnum from '../../productionEnum.macro'\n\nexport const InputKeyDownArrowDown = productionEnum(\n '__input_keydown_arrow_down__',\n)\nexport const InputKeyDownArrowUp = productionEnum('__input_keydown_arrow_up__')\nexport const InputKeyDownEscape = productionEnum('__input_keydown_escape__')\nexport const InputKeyDownHome = productionEnum('__input_keydown_home__')\nexport const InputKeyDownEnd = productionEnum('__input_keydown_end__')\nexport const InputKeyDownEnter = productionEnum('__input_keydown_enter__')\nexport const InputChange = productionEnum('__input_change__')\nexport const InputBlur = productionEnum('__input_blur__')\n\nexport const MenuMouseLeave = productionEnum('__menu_mouse_leave__')\n\nexport const ItemMouseMove = productionEnum('__item_mouse_move__')\nexport const ItemClick = productionEnum('__item_click__')\n\nexport const ToggleButtonClick = productionEnum('__togglebutton_click__')\n\nexport const FunctionToggleMenu = productionEnum('__function_toggle_menu__')\nexport const FunctionOpenMenu = productionEnum('__function_open_menu__')\nexport const FunctionCloseMenu = productionEnum('__function_close_menu__')\nexport const FunctionSetHighlightedIndex = productionEnum(\n '__function_set_highlighted_index__',\n)\nexport const FunctionSelectItem = productionEnum('__function_select_item__')\nexport const FunctionSetInputValue = productionEnum(\n '__function_set_input_value__',\n)\nexport const FunctionReset = productionEnum('__function_reset__')\nexport const ControlledPropUpdatedSelectedItem = productionEnum(\n '__controlled_prop_updated_selected_item__',\n)\n","import {useRef, useEffect} from 'react'\nimport PropTypes from 'prop-types'\nimport {\n getA11yStatusMessage,\n isControlledProp,\n getState,\n noop,\n} from '../../utils'\nimport {\n defaultProps as defaultPropsCommon,\n getInitialState as getInitialStateCommon,\n useEnhancedReducer,\n} from '../utils'\nimport {ControlledPropUpdatedSelectedItem} from './stateChangeTypes'\n\nfunction getInitialState(props) {\n const initialState = getInitialStateCommon(props)\n const {selectedItem} = initialState\n let {inputValue} = initialState\n\n if (\n inputValue === '' &&\n selectedItem &&\n props.defaultInputValue === undefined &&\n props.initialInputValue === undefined &&\n props.inputValue === undefined\n ) {\n inputValue = props.itemToString(selectedItem)\n }\n\n return {\n ...initialState,\n inputValue,\n }\n}\n\nconst propTypes = {\n items: PropTypes.array.isRequired,\n itemToString: PropTypes.func,\n getA11yStatusMessage: PropTypes.func,\n getA11ySelectionMessage: PropTypes.func,\n circularNavigation: PropTypes.bool,\n highlightedIndex: PropTypes.number,\n defaultHighlightedIndex: PropTypes.number,\n initialHighlightedIndex: PropTypes.number,\n isOpen: PropTypes.bool,\n defaultIsOpen: PropTypes.bool,\n initialIsOpen: PropTypes.bool,\n selectedItem: PropTypes.any,\n initialSelectedItem: PropTypes.any,\n defaultSelectedItem: PropTypes.any,\n inputValue: PropTypes.string,\n defaultInputValue: PropTypes.string,\n initialInputValue: PropTypes.string,\n id: PropTypes.string,\n labelId: PropTypes.string,\n menuId: PropTypes.string,\n getItemId: PropTypes.func,\n inputId: PropTypes.string,\n toggleButtonId: PropTypes.string,\n stateReducer: PropTypes.func,\n onSelectedItemChange: PropTypes.func,\n onHighlightedIndexChange: PropTypes.func,\n onStateChange: PropTypes.func,\n onIsOpenChange: PropTypes.func,\n onInputValueChange: PropTypes.func,\n environment: PropTypes.shape({\n addEventListener: PropTypes.func,\n removeEventListener: PropTypes.func,\n document: PropTypes.shape({\n getElementById: PropTypes.func,\n activeElement: PropTypes.any,\n body: PropTypes.any,\n }),\n }),\n}\n\n/**\n * The useCombobox version of useControlledReducer, which also\n * checks if the controlled prop selectedItem changed between\n * renders. If so, it will also update inputValue with its\n * string equivalent. It uses the common useEnhancedReducer to\n * compute the rest of the state.\n *\n * @param {Function} reducer Reducer function from downshift.\n * @param {Object} initialState Initial state of the hook.\n * @param {Object} props The hook props.\n * @returns {Array} An array with the state and an action dispatcher.\n */\nfunction useControlledReducer(reducer, initialState, props) {\n const previousSelectedItemRef = useRef()\n const [state, dispatch] = useEnhancedReducer(reducer, initialState, props)\n\n // ToDo: if needed, make same approach as selectedItemChanged from Downshift.\n useEffect(() => {\n if (isControlledProp(props, 'selectedItem')) {\n if (previousSelectedItemRef.current !== props.selectedItem) {\n dispatch({\n type: ControlledPropUpdatedSelectedItem,\n inputValue: props.itemToString(props.selectedItem),\n })\n }\n\n previousSelectedItemRef.current =\n state.selectedItem === previousSelectedItemRef.current\n ? props.selectedItem\n : state.selectedItem\n }\n })\n\n return [getState(state, props), dispatch]\n}\n\n// eslint-disable-next-line import/no-mutable-exports\nlet validatePropTypes = noop\n/* istanbul ignore next */\nif (process.env.NODE_ENV !== 'production') {\n validatePropTypes = (options, caller) => {\n PropTypes.checkPropTypes(propTypes, options, 'prop', caller.name)\n }\n}\n\nconst defaultProps = {\n ...defaultPropsCommon,\n getA11yStatusMessage,\n circularNavigation: true,\n}\n\nexport {validatePropTypes, useControlledReducer, getInitialState, defaultProps}\n","import {getHighlightedIndexOnOpen, getDefaultValue} from '../utils'\nimport {getNextWrappingIndex, getNextNonDisabledIndex} from '../../utils'\nimport commonReducer from '../reducer'\nimport * as stateChangeTypes from './stateChangeTypes'\n\n/* eslint-disable complexity */\nexport default function downshiftUseComboboxReducer(state, action) {\n const {type, props, shiftKey} = action\n let changes\n\n switch (type) {\n case stateChangeTypes.ItemClick:\n changes = {\n isOpen: getDefaultValue(props, 'isOpen'),\n highlightedIndex: getDefaultValue(props, 'highlightedIndex'),\n selectedItem: props.items[action.index],\n inputValue: props.itemToString(props.items[action.index]),\n }\n break\n case stateChangeTypes.InputKeyDownArrowDown:\n if (state.isOpen) {\n changes = {\n highlightedIndex: getNextWrappingIndex(\n shiftKey ? 5 : 1,\n state.highlightedIndex,\n props.items.length,\n action.getItemNodeFromIndex,\n props.circularNavigation,\n ),\n }\n } else {\n changes = {\n highlightedIndex: getHighlightedIndexOnOpen(\n props,\n state,\n 1,\n action.getItemNodeFromIndex,\n ),\n isOpen: props.items.length >= 0,\n }\n }\n break\n case stateChangeTypes.InputKeyDownArrowUp:\n if (state.isOpen) {\n changes = {\n highlightedIndex: getNextWrappingIndex(\n shiftKey ? -5 : -1,\n state.highlightedIndex,\n props.items.length,\n action.getItemNodeFromIndex,\n props.circularNavigation,\n ),\n }\n } else {\n changes = {\n highlightedIndex: getHighlightedIndexOnOpen(\n props,\n state,\n -1,\n action.getItemNodeFromIndex,\n ),\n isOpen: props.items.length >= 0,\n }\n }\n break\n case stateChangeTypes.InputKeyDownEnter:\n changes = {\n ...(state.isOpen &&\n state.highlightedIndex >= 0 && {\n selectedItem: props.items[state.highlightedIndex],\n isOpen: getDefaultValue(props, 'isOpen'),\n highlightedIndex: getDefaultValue(props, 'highlightedIndex'),\n inputValue: props.itemToString(props.items[state.highlightedIndex]),\n }),\n }\n break\n case stateChangeTypes.InputKeyDownEscape:\n changes = {\n isOpen: false,\n highlightedIndex: -1,\n ...(!state.isOpen && {\n selectedItem: null,\n inputValue: '',\n }),\n }\n break\n case stateChangeTypes.InputKeyDownHome:\n changes = {\n highlightedIndex: getNextNonDisabledIndex(\n 1,\n 0,\n props.items.length,\n action.getItemNodeFromIndex,\n false,\n ),\n }\n break\n case stateChangeTypes.InputKeyDownEnd:\n changes = {\n highlightedIndex: getNextNonDisabledIndex(\n -1,\n props.items.length - 1,\n props.items.length,\n action.getItemNodeFromIndex,\n false,\n ),\n }\n break\n case stateChangeTypes.InputBlur:\n changes = {\n isOpen: false,\n highlightedIndex: -1,\n ...(state.highlightedIndex >= 0 &&\n action.selectItem && {\n selectedItem: props.items[state.highlightedIndex],\n inputValue: props.itemToString(props.items[state.highlightedIndex]),\n }),\n }\n break\n case stateChangeTypes.InputChange:\n changes = {\n isOpen: true,\n highlightedIndex: getDefaultValue(props, 'highlightedIndex'),\n inputValue: action.inputValue,\n }\n break\n case stateChangeTypes.FunctionSelectItem:\n changes = {\n selectedItem: action.selectedItem,\n inputValue: props.itemToString(action.selectedItem),\n }\n break\n case stateChangeTypes.ControlledPropUpdatedSelectedItem:\n changes = {\n inputValue: action.inputValue,\n }\n break\n default:\n return commonReducer(state, action, stateChangeTypes)\n }\n\n return {\n ...state,\n ...changes,\n }\n}\n/* eslint-enable complexity */\n","/* eslint-disable max-statements */\nimport {useRef, useEffect, useCallback, useMemo} from 'react'\nimport {isPreact, isReactNative} from '../../is.macro'\nimport {handleRefs, normalizeArrowKey, callAllEventHandlers} from '../../utils'\nimport {\n getItemIndex,\n useA11yMessageSetter,\n useMouseAndTouchTracker,\n useGetterPropsCalledChecker,\n useLatestRef,\n useScrollIntoView,\n useControlPropsValidator,\n useElementIds,\n} from '../utils'\nimport {\n getInitialState,\n defaultProps,\n useControlledReducer,\n validatePropTypes,\n} from './utils'\nimport downshiftUseComboboxReducer from './reducer'\nimport * as stateChangeTypes from './stateChangeTypes'\n\nuseCombobox.stateChangeTypes = stateChangeTypes\n\nfunction useCombobox(userProps = {}) {\n validatePropTypes(userProps, useCombobox)\n // Props defaults and destructuring.\n const props = {\n ...defaultProps,\n ...userProps,\n }\n const {\n initialIsOpen,\n defaultIsOpen,\n items,\n scrollIntoView,\n environment,\n getA11yStatusMessage,\n getA11ySelectionMessage,\n itemToString,\n } = props\n // Initial state depending on controlled props.\n const initialState = getInitialState(props)\n const [state, dispatch] = useControlledReducer(\n downshiftUseComboboxReducer,\n initialState,\n props,\n )\n const {isOpen, highlightedIndex, selectedItem, inputValue} = state\n\n // Element refs.\n const menuRef = useRef(null)\n const itemRefs = useRef({})\n const inputRef = useRef(null)\n const toggleButtonRef = useRef(null)\n const comboboxRef = useRef(null)\n const isInitialMountRef = useRef(true)\n // prevent id re-generation between renders.\n const elementIds = useElementIds(props)\n // used to keep track of how many items we had on previous cycle.\n const previousResultCountRef = useRef()\n // utility callback to get item element.\n const latest = useLatestRef({state, props})\n\n const getItemNodeFromIndex = useCallback(\n index => itemRefs.current[elementIds.getItemId(index)],\n [elementIds],\n )\n\n // Effects.\n // Sets a11y status message on changes in state.\n useA11yMessageSetter(\n getA11yStatusMessage,\n [isOpen, highlightedIndex, inputValue, items],\n {\n isInitialMount: isInitialMountRef.current,\n previousResultCount: previousResultCountRef.current,\n items,\n environment,\n itemToString,\n ...state,\n },\n )\n // Sets a11y status message on changes in selectedItem.\n useA11yMessageSetter(getA11ySelectionMessage, [selectedItem], {\n isInitialMount: isInitialMountRef.current,\n previousResultCount: previousResultCountRef.current,\n items,\n environment,\n itemToString,\n ...state,\n })\n // Scroll on highlighted item if change comes from keyboard.\n const shouldScrollRef = useScrollIntoView({\n menuElement: menuRef.current,\n highlightedIndex,\n isOpen,\n itemRefs,\n scrollIntoView,\n getItemNodeFromIndex,\n })\n useControlPropsValidator({\n isInitialMount: isInitialMountRef.current,\n props,\n state,\n })\n // Focus the input on first render if required.\n useEffect(() => {\n const focusOnOpen = initialIsOpen || defaultIsOpen || isOpen\n\n if (focusOnOpen && inputRef.current) {\n inputRef.current.focus()\n }\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [])\n useEffect(() => {\n if (isInitialMountRef.current) {\n return\n }\n\n previousResultCountRef.current = items.length\n })\n // Add mouse/touch events to document.\n const mouseAndTouchTrackersRef = useMouseAndTouchTracker(\n isOpen,\n [comboboxRef, menuRef, toggleButtonRef],\n environment,\n () => {\n dispatch({\n type: stateChangeTypes.InputBlur,\n selectItem: false,\n })\n },\n )\n const setGetterPropCallInfo = useGetterPropsCalledChecker(\n 'getInputProps',\n 'getComboboxProps',\n 'getMenuProps',\n )\n // Make initial ref false.\n useEffect(() => {\n isInitialMountRef.current = false\n }, [])\n // Reset itemRefs on close.\n useEffect(() => {\n if (!isOpen) {\n itemRefs.current = {}\n }\n }, [isOpen])\n\n /* Event handler functions */\n const inputKeyDownHandlers = useMemo(\n () => ({\n ArrowDown(event) {\n event.preventDefault()\n dispatch({\n type: stateChangeTypes.InputKeyDownArrowDown,\n shiftKey: event.shiftKey,\n getItemNodeFromIndex,\n })\n },\n ArrowUp(event) {\n event.preventDefault()\n dispatch({\n type: stateChangeTypes.InputKeyDownArrowUp,\n shiftKey: event.shiftKey,\n getItemNodeFromIndex,\n })\n },\n Home(event) {\n if (!latest.current.state.isOpen) {\n return\n }\n\n event.preventDefault()\n dispatch({\n type: stateChangeTypes.InputKeyDownHome,\n getItemNodeFromIndex,\n })\n },\n End(event) {\n if (!latest.current.state.isOpen) {\n return\n }\n\n event.preventDefault()\n dispatch({\n type: stateChangeTypes.InputKeyDownEnd,\n getItemNodeFromIndex,\n })\n },\n Escape() {\n const latestState = latest.current.state\n if (\n latestState.isOpen ||\n latestState.inputValue ||\n latestState.selectedItem ||\n latestState.highlightedIndex > -1\n ) {\n dispatch({\n type: stateChangeTypes.InputKeyDownEscape,\n })\n }\n },\n Enter(event) {\n const latestState = latest.current.state\n // if closed or no highlighted index, do nothing.\n if (\n !latestState.isOpen ||\n latestState.highlightedIndex < 0 ||\n event.which === 229 // if IME composing, wait for next Enter keydown event.\n ) {\n return\n }\n\n event.preventDefault()\n dispatch({\n type: stateChangeTypes.InputKeyDownEnter,\n getItemNodeFromIndex,\n })\n },\n }),\n [dispatch, latest, getItemNodeFromIndex],\n )\n\n // Getter props.\n const getLabelProps = useCallback(\n labelProps => ({\n id: elementIds.labelId,\n htmlFor: elementIds.inputId,\n ...labelProps,\n }),\n [elementIds],\n )\n const getMenuProps = useCallback(\n (\n {onMouseLeave, refKey = 'ref', ref, ...rest} = {},\n {suppressRefError = false} = {},\n ) => {\n setGetterPropCallInfo('getMenuProps', suppressRefError, refKey, menuRef)\n return {\n [refKey]: handleRefs(ref, menuNode => {\n menuRef.current = menuNode\n }),\n id: elementIds.menuId,\n role: 'listbox',\n 'aria-labelledby': elementIds.labelId,\n onMouseLeave: callAllEventHandlers(onMouseLeave, () => {\n dispatch({\n type: stateChangeTypes.MenuMouseLeave,\n })\n }),\n ...rest,\n }\n },\n [dispatch, setGetterPropCallInfo, elementIds],\n )\n\n const getItemProps = useCallback(\n ({\n item,\n index,\n refKey = 'ref',\n ref,\n onMouseMove,\n onClick,\n onPress,\n ...rest\n } = {}) => {\n const {props: latestProps, state: latestState} = latest.current\n const itemIndex = getItemIndex(index, item, latestProps.items)\n if (itemIndex < 0) {\n throw new Error('Pass either item or item index in getItemProps!')\n }\n\n const onSelectKey = isReactNative\n ? /* istanbul ignore next (react-native) */ 'onPress'\n : 'onClick'\n const customClickHandler = isReactNative\n ? /* istanbul ignore next (react-native) */ onPress\n : onClick\n\n const itemHandleMouseMove = () => {\n if (index === latestState.highlightedIndex) {\n return\n }\n shouldScrollRef.current = false\n dispatch({\n type: stateChangeTypes.ItemMouseMove,\n index,\n })\n }\n const itemHandleClick = () => {\n dispatch({\n type: stateChangeTypes.ItemClick,\n index,\n })\n\n if (inputRef.current) {\n inputRef.current.focus()\n }\n }\n\n return {\n [refKey]: handleRefs(ref, itemNode => {\n if (itemNode) {\n itemRefs.current[elementIds.getItemId(itemIndex)] = itemNode\n }\n }),\n role: 'option',\n 'aria-selected': `${itemIndex === latestState.highlightedIndex}`,\n id: elementIds.getItemId(itemIndex),\n ...(!rest.disabled && {\n onMouseMove: callAllEventHandlers(onMouseMove, itemHandleMouseMove),\n [onSelectKey]: callAllEventHandlers(\n customClickHandler,\n itemHandleClick,\n ),\n }),\n ...rest,\n }\n },\n [dispatch, latest, shouldScrollRef, elementIds],\n )\n\n const getToggleButtonProps = useCallback(\n ({onClick, onPress, refKey = 'ref', ref, ...rest} = {}) => {\n const toggleButtonHandleClick = () => {\n dispatch({\n type: stateChangeTypes.ToggleButtonClick,\n })\n\n if (!latest.current.state.isOpen && inputRef.current) {\n inputRef.current.focus()\n }\n }\n\n return {\n [refKey]: handleRefs(ref, toggleButtonNode => {\n toggleButtonRef.current = toggleButtonNode\n }),\n id: elementIds.toggleButtonId,\n tabIndex: -1,\n ...(!rest.disabled && {\n ...(isReactNative\n ? /* istanbul ignore next (react-native) */ {\n onPress: callAllEventHandlers(onPress, toggleButtonHandleClick),\n }\n : {\n onClick: callAllEventHandlers(onClick, toggleButtonHandleClick),\n }),\n }),\n ...rest,\n }\n },\n [dispatch, latest, elementIds],\n )\n const getInputProps = useCallback(\n (\n {\n onKeyDown,\n onChange,\n onInput,\n onBlur,\n onChangeText,\n refKey = 'ref',\n ref,\n ...rest\n } = {},\n {suppressRefError = false} = {},\n ) => {\n setGetterPropCallInfo('getInputProps', suppressRefError, refKey, inputRef)\n\n const latestState = latest.current.state\n const inputHandleKeyDown = event => {\n const key = normalizeArrowKey(event)\n if (key && inputKeyDownHandlers[key]) {\n inputKeyDownHandlers[key](event)\n }\n }\n const inputHandleChange = event => {\n dispatch({\n type: stateChangeTypes.InputChange,\n inputValue: isReactNative\n ? /* istanbul ignore next (react-native) */ event.nativeEvent.text\n : event.target.value,\n })\n }\n const inputHandleBlur = () => {\n /* istanbul ignore else */\n if (\n latestState.isOpen &&\n !mouseAndTouchTrackersRef.current.isMouseDown\n ) {\n dispatch({\n type: stateChangeTypes.InputBlur,\n selectItem: true,\n })\n }\n }\n\n /* istanbul ignore next (preact) */\n const onChangeKey = isPreact ? 'onInput' : 'onChange'\n let eventHandlers = {}\n\n if (!rest.disabled) {\n eventHandlers = {\n [onChangeKey]: callAllEventHandlers(\n onChange,\n onInput,\n inputHandleChange,\n ),\n onKeyDown: callAllEventHandlers(onKeyDown, inputHandleKeyDown),\n onBlur: callAllEventHandlers(onBlur, inputHandleBlur),\n }\n }\n\n /* istanbul ignore if (react-native) */\n if (isReactNative) {\n eventHandlers.onChange = callAllEventHandlers(\n onChange,\n onInput,\n inputHandleChange,\n )\n eventHandlers.onChangeText = callAllEventHandlers(\n onChangeText,\n onInput,\n text => {\n inputHandleChange({nativeEvent: {text}})\n },\n )\n }\n\n return {\n [refKey]: handleRefs(ref, inputNode => {\n inputRef.current = inputNode\n }),\n id: elementIds.inputId,\n 'aria-autocomplete': 'list',\n 'aria-controls': elementIds.menuId,\n ...(latestState.isOpen &&\n latestState.highlightedIndex > -1 && {\n 'aria-activedescendant': elementIds.getItemId(\n latestState.highlightedIndex,\n ),\n }),\n 'aria-labelledby': elementIds.labelId,\n // https://developer.mozilla.org/en-US/docs/Web/Security/Securing_your_site/Turning_off_form_autocompletion\n // revert back since autocomplete=\"nope\" is ignored on latest Chrome and Opera\n autoComplete: 'off',\n value: latestState.inputValue,\n ...eventHandlers,\n ...rest,\n }\n },\n [\n dispatch,\n inputKeyDownHandlers,\n latest,\n mouseAndTouchTrackersRef,\n setGetterPropCallInfo,\n elementIds,\n ],\n )\n const getComboboxProps = useCallback(\n ({refKey = 'ref', ref, ...rest} = {}, {suppressRefError = false} = {}) => {\n setGetterPropCallInfo(\n 'getComboboxProps',\n suppressRefError,\n refKey,\n comboboxRef,\n )\n\n return {\n [refKey]: handleRefs(ref, comboboxNode => {\n comboboxRef.current = comboboxNode\n }),\n role: 'combobox',\n 'aria-haspopup': 'listbox',\n 'aria-owns': elementIds.menuId,\n 'aria-expanded': latest.current.state.isOpen,\n ...rest,\n }\n },\n [latest, setGetterPropCallInfo, elementIds],\n )\n\n // returns\n const toggleMenu = useCallback(() => {\n dispatch({\n type: stateChangeTypes.FunctionToggleMenu,\n })\n }, [dispatch])\n const closeMenu = useCallback(() => {\n dispatch({\n type: stateChangeTypes.FunctionCloseMenu,\n })\n }, [dispatch])\n const openMenu = useCallback(() => {\n dispatch({\n type: stateChangeTypes.FunctionOpenMenu,\n })\n }, [dispatch])\n const setHighlightedIndex = useCallback(\n newHighlightedIndex => {\n dispatch({\n type: stateChangeTypes.FunctionSetHighlightedIndex,\n highlightedIndex: newHighlightedIndex,\n })\n },\n [dispatch],\n )\n const selectItem = useCallback(\n newSelectedItem => {\n dispatch({\n type: stateChangeTypes.FunctionSelectItem,\n selectedItem: newSelectedItem,\n })\n },\n [dispatch],\n )\n const setInputValue = useCallback(\n newInputValue => {\n dispatch({\n type: stateChangeTypes.FunctionSetInputValue,\n inputValue: newInputValue,\n })\n },\n [dispatch],\n )\n const reset = useCallback(() => {\n dispatch({\n type: stateChangeTypes.FunctionReset,\n })\n }, [dispatch])\n\n return {\n // prop getters.\n getItemProps,\n getLabelProps,\n getMenuProps,\n getInputProps,\n getComboboxProps,\n getToggleButtonProps,\n // actions.\n toggleMenu,\n openMenu,\n closeMenu,\n setHighlightedIndex,\n setInputValue,\n selectItem,\n reset,\n // state.\n highlightedIndex,\n isOpen,\n selectedItem,\n inputValue,\n }\n}\n\nexport default useCombobox\n","import PropTypes from 'prop-types'\nimport {\n getInitialValue as getInitialValueCommon,\n getDefaultValue as getDefaultValueCommon,\n defaultProps as defaultPropsCommon,\n} from '../utils'\nimport {noop} from '../../utils'\n\nconst defaultStateValues = {\n activeIndex: -1,\n selectedItems: [],\n}\n\n/**\n * Returns the initial value for a state key in the following order:\n * 1. controlled prop, 2. initial prop, 3. default prop, 4. default\n * value from Downshift.\n *\n * @param {Object} props Props passed to the hook.\n * @param {string} propKey Props key to generate the value for.\n * @returns {any} The initial value for that prop.\n */\nfunction getInitialValue(props, propKey) {\n return getInitialValueCommon(props, propKey, defaultStateValues)\n}\n\n/**\n * Returns the default value for a state key in the following order:\n * 1. controlled prop, 2. default prop, 3. default value from Downshift.\n *\n * @param {Object} props Props passed to the hook.\n * @param {string} propKey Props key to generate the value for.\n * @returns {any} The initial value for that prop.\n */\nfunction getDefaultValue(props, propKey) {\n return getDefaultValueCommon(props, propKey, defaultStateValues)\n}\n\n/**\n * Gets the initial state based on the provided props. It uses initial, default\n * and controlled props related to state in order to compute the initial value.\n *\n * @param {Object} props Props passed to the hook.\n * @returns {Object} The initial state.\n */\nfunction getInitialState(props) {\n const activeIndex = getInitialValue(props, 'activeIndex')\n const selectedItems = getInitialValue(props, 'selectedItems')\n\n return {\n activeIndex,\n selectedItems,\n }\n}\n\n/**\n * Returns true if dropdown keydown operation is permitted. Should not be\n * allowed on keydown with modifier keys (ctrl, alt, shift, meta), on\n * input element with text content that is either highlighted or selection\n * cursor is not at the starting position.\n *\n * @param {KeyboardEvent} event The event from keydown.\n * @returns {boolean} Whether the operation is allowed.\n */\nfunction isKeyDownOperationPermitted(event) {\n if (event.shiftKey || event.metaKey || event.ctrlKey || event.altKey) {\n return false\n }\n\n const element = event.target\n\n if (\n element instanceof HTMLInputElement && // if element is a text input\n element.value !== '' && // and we have text in it\n // and cursor is either not at the start or is currently highlighting text.\n (element.selectionStart !== 0 || element.selectionEnd !== 0)\n ) {\n return false\n }\n\n return true\n}\n\n/**\n * Returns a message to be added to aria-live region when item is removed.\n *\n * @param {Object} selectionParameters Parameters required to build the message.\n * @returns {string} The a11y message.\n */\nfunction getA11yRemovalMessage(selectionParameters) {\n const {\n removedSelectedItem,\n itemToString: itemToStringLocal,\n } = selectionParameters\n\n return `${itemToStringLocal(removedSelectedItem)} has been removed.`\n}\n\nconst propTypes = {\n selectedItems: PropTypes.array,\n initialSelectedItems: PropTypes.array,\n defaultSelectedItems: PropTypes.array,\n itemToString: PropTypes.func,\n getA11yRemovalMessage: PropTypes.func,\n stateReducer: PropTypes.func,\n activeIndex: PropTypes.number,\n initialActiveIndex: PropTypes.number,\n defaultActiveIndex: PropTypes.number,\n onActiveIndexChange: PropTypes.func,\n onSelectedItemsChange: PropTypes.func,\n keyNavigationNext: PropTypes.string,\n keyNavigationPrevious: PropTypes.string,\n environment: PropTypes.shape({\n addEventListener: PropTypes.func,\n removeEventListener: PropTypes.func,\n document: PropTypes.shape({\n getElementById: PropTypes.func,\n activeElement: PropTypes.any,\n body: PropTypes.any,\n }),\n }),\n}\n\nexport const defaultProps = {\n itemToString: defaultPropsCommon.itemToString,\n stateReducer: defaultPropsCommon.stateReducer,\n environment: defaultPropsCommon.environment,\n getA11yRemovalMessage,\n keyNavigationNext: 'ArrowRight',\n keyNavigationPrevious: 'ArrowLeft',\n}\n\n// eslint-disable-next-line import/no-mutable-exports\nlet validatePropTypes = noop\n/* istanbul ignore next */\nif (process.env.NODE_ENV !== 'production') {\n validatePropTypes = (options, caller) => {\n PropTypes.checkPropTypes(propTypes, options, 'prop', caller.name)\n }\n}\n\nexport {\n validatePropTypes,\n getDefaultValue,\n getInitialState,\n isKeyDownOperationPermitted,\n}\n","import {getDefaultValue} from './utils'\nimport * as stateChangeTypes from './stateChangeTypes'\n\n/* eslint-disable complexity */\nexport default function downshiftMultipleSelectionReducer(state, action) {\n const {type, index, props, selectedItem} = action\n const {activeIndex, selectedItems} = state\n let changes\n\n switch (type) {\n case stateChangeTypes.SelectedItemClick:\n changes = {\n activeIndex: index,\n }\n\n break\n case stateChangeTypes.SelectedItemKeyDownNavigationPrevious:\n changes = {\n activeIndex: activeIndex - 1 < 0 ? 0 : activeIndex - 1,\n }\n\n break\n case stateChangeTypes.SelectedItemKeyDownNavigationNext:\n changes = {\n activeIndex:\n activeIndex + 1 >= selectedItems.length ? -1 : activeIndex + 1,\n }\n\n break\n case stateChangeTypes.SelectedItemKeyDownBackspace:\n case stateChangeTypes.SelectedItemKeyDownDelete: {\n let newActiveIndex = activeIndex\n\n if (selectedItems.length === 1) {\n newActiveIndex = -1\n } else if (activeIndex === selectedItems.length - 1) {\n newActiveIndex = selectedItems.length - 2\n }\n\n changes = {\n selectedItems: [\n ...selectedItems.slice(0, activeIndex),\n ...selectedItems.slice(activeIndex + 1),\n ],\n ...{activeIndex: newActiveIndex},\n }\n\n break\n }\n case stateChangeTypes.DropdownKeyDownNavigationPrevious:\n changes = {\n activeIndex: selectedItems.length - 1,\n }\n break\n case stateChangeTypes.DropdownKeyDownBackspace:\n changes = {\n selectedItems: selectedItems.slice(0, selectedItems.length - 1),\n }\n break\n case stateChangeTypes.FunctionAddSelectedItem:\n changes = {\n selectedItems: [...selectedItems, selectedItem],\n }\n break\n case stateChangeTypes.DropdownClick:\n changes = {\n activeIndex: -1,\n }\n break\n case stateChangeTypes.FunctionRemoveSelectedItem: {\n let newActiveIndex = activeIndex\n const selectedItemIndex = selectedItems.indexOf(selectedItem)\n\n if (selectedItems.length === 1) {\n newActiveIndex = -1\n } else if (selectedItemIndex === selectedItems.length - 1) {\n newActiveIndex = selectedItems.length - 2\n }\n\n changes = {\n selectedItems: [\n ...selectedItems.slice(0, selectedItemIndex),\n ...selectedItems.slice(selectedItemIndex + 1),\n ],\n ...{activeIndex: newActiveIndex},\n }\n break\n }\n case stateChangeTypes.FunctionSetSelectedItems: {\n const {selectedItems: newSelectedItems} = action\n changes = {\n selectedItems: newSelectedItems,\n }\n break\n }\n case stateChangeTypes.FunctionSetActiveIndex: {\n const {activeIndex: newActiveIndex} = action\n changes = {\n activeIndex: newActiveIndex,\n }\n break\n }\n case stateChangeTypes.FunctionReset:\n changes = {\n activeIndex: getDefaultValue(props, 'activeIndex'),\n selectedItems: getDefaultValue(props, 'selectedItems'),\n }\n break\n default:\n throw new Error('Reducer called without proper action type.')\n }\n\n return {\n ...state,\n ...changes,\n }\n}\n","import {useRef, useEffect, useCallback, useMemo} from 'react'\nimport setStatus from '../../set-a11y-status'\nimport {handleRefs, callAllEventHandlers, normalizeArrowKey} from '../../utils'\nimport {\n useControlledReducer,\n getItemIndex,\n useGetterPropsCalledChecker,\n useLatestRef,\n useControlPropsValidator,\n} from '../utils'\nimport {\n getInitialState,\n defaultProps,\n isKeyDownOperationPermitted,\n validatePropTypes,\n} from './utils'\nimport downshiftMultipleSelectionReducer from './reducer'\nimport * as stateChangeTypes from './stateChangeTypes'\n\nuseMultipleSelection.stateChangeTypes = stateChangeTypes\n\nfunction useMultipleSelection(userProps = {}) {\n validatePropTypes(userProps, useMultipleSelection)\n // Props defaults and destructuring.\n const props = {\n ...defaultProps,\n ...userProps,\n }\n const {\n getA11yRemovalMessage,\n itemToString,\n environment,\n keyNavigationNext,\n keyNavigationPrevious,\n } = props\n\n // Reducer init.\n const [state, dispatch] = useControlledReducer(\n downshiftMultipleSelectionReducer,\n getInitialState(props),\n props,\n )\n const {activeIndex, selectedItems} = state\n\n // Refs.\n const isInitialMountRef = useRef(true)\n const dropdownRef = useRef(null)\n const previousSelectedItemsRef = useRef(selectedItems)\n const selectedItemRefs = useRef()\n selectedItemRefs.current = []\n const latest = useLatestRef({state, props})\n\n // Effects.\n /* Sets a11y status message on changes in selectedItem. */\n useEffect(() => {\n if (isInitialMountRef.current) {\n return\n }\n\n if (selectedItems.length < previousSelectedItemsRef.current.length) {\n const removedSelectedItem = previousSelectedItemsRef.current.find(\n item => selectedItems.indexOf(item) < 0,\n )\n\n setStatus(\n getA11yRemovalMessage({\n itemToString,\n resultCount: selectedItems.length,\n removedSelectedItem,\n activeIndex,\n activeSelectedItem: selectedItems[activeIndex],\n }),\n environment.document,\n )\n }\n\n previousSelectedItemsRef.current = selectedItems\n\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [selectedItems.length])\n // Sets focus on active item.\n useEffect(() => {\n if (isInitialMountRef.current) {\n return\n }\n\n if (activeIndex === -1 && dropdownRef.current) {\n dropdownRef.current.focus()\n } else if (selectedItemRefs.current[activeIndex]) {\n selectedItemRefs.current[activeIndex].focus()\n }\n }, [activeIndex])\n useControlPropsValidator({\n isInitialMount: isInitialMountRef.current,\n props,\n state,\n })\n const setGetterPropCallInfo = useGetterPropsCalledChecker('getDropdownProps')\n // Make initial ref false.\n useEffect(() => {\n isInitialMountRef.current = false\n }, [])\n\n // Event handler functions.\n const selectedItemKeyDownHandlers = useMemo(\n () => ({\n [keyNavigationPrevious]() {\n dispatch({\n type: stateChangeTypes.SelectedItemKeyDownNavigationPrevious,\n })\n },\n [keyNavigationNext]() {\n dispatch({\n type: stateChangeTypes.SelectedItemKeyDownNavigationNext,\n })\n },\n Delete() {\n dispatch({\n type: stateChangeTypes.SelectedItemKeyDownDelete,\n })\n },\n Backspace() {\n dispatch({\n type: stateChangeTypes.SelectedItemKeyDownBackspace,\n })\n },\n }),\n [dispatch, keyNavigationNext, keyNavigationPrevious],\n )\n const dropdownKeyDownHandlers = useMemo(\n () => ({\n [keyNavigationPrevious](event) {\n if (isKeyDownOperationPermitted(event)) {\n dispatch({\n type: stateChangeTypes.DropdownKeyDownNavigationPrevious,\n })\n }\n },\n Backspace(event) {\n if (isKeyDownOperationPermitted(event)) {\n dispatch({\n type: stateChangeTypes.DropdownKeyDownBackspace,\n })\n }\n },\n }),\n [dispatch, keyNavigationPrevious],\n )\n\n // Getter props.\n const getSelectedItemProps = useCallback(\n ({\n refKey = 'ref',\n ref,\n onClick,\n onKeyDown,\n selectedItem,\n index,\n ...rest\n } = {}) => {\n const {state: latestState} = latest.current\n const itemIndex = getItemIndex(\n index,\n selectedItem,\n latestState.selectedItems,\n )\n if (itemIndex < 0) {\n throw new Error(\n 'Pass either selectedItem or index in getSelectedItemProps!',\n )\n }\n\n const selectedItemHandleClick = () => {\n dispatch({\n type: stateChangeTypes.SelectedItemClick,\n index,\n })\n }\n const selectedItemHandleKeyDown = event => {\n const key = normalizeArrowKey(event)\n if (key && selectedItemKeyDownHandlers[key]) {\n selectedItemKeyDownHandlers[key](event)\n }\n }\n\n return {\n [refKey]: handleRefs(ref, selectedItemNode => {\n if (selectedItemNode) {\n selectedItemRefs.current.push(selectedItemNode)\n }\n }),\n tabIndex: index === latestState.activeIndex ? 0 : -1,\n onClick: callAllEventHandlers(onClick, selectedItemHandleClick),\n onKeyDown: callAllEventHandlers(onKeyDown, selectedItemHandleKeyDown),\n ...rest,\n }\n },\n [dispatch, latest, selectedItemKeyDownHandlers],\n )\n const getDropdownProps = useCallback(\n (\n {\n refKey = 'ref',\n ref,\n onKeyDown,\n onClick,\n preventKeyAction = false,\n ...rest\n } = {},\n {suppressRefError = false} = {},\n ) => {\n setGetterPropCallInfo(\n 'getDropdownProps',\n suppressRefError,\n refKey,\n dropdownRef,\n )\n\n const dropdownHandleKeyDown = event => {\n const key = normalizeArrowKey(event)\n if (key && dropdownKeyDownHandlers[key]) {\n dropdownKeyDownHandlers[key](event)\n }\n }\n const dropdownHandleClick = () => {\n dispatch({\n type: stateChangeTypes.DropdownClick,\n })\n }\n\n return {\n [refKey]: handleRefs(ref, dropdownNode => {\n if (dropdownNode) {\n dropdownRef.current = dropdownNode\n }\n }),\n ...(!preventKeyAction && {\n onKeyDown: callAllEventHandlers(onKeyDown, dropdownHandleKeyDown),\n onClick: callAllEventHandlers(onClick, dropdownHandleClick),\n }),\n ...rest,\n }\n },\n [dispatch, dropdownKeyDownHandlers, setGetterPropCallInfo],\n )\n\n // returns\n const addSelectedItem = useCallback(\n selectedItem => {\n dispatch({\n type: stateChangeTypes.FunctionAddSelectedItem,\n selectedItem,\n })\n },\n [dispatch],\n )\n const removeSelectedItem = useCallback(\n selectedItem => {\n dispatch({\n type: stateChangeTypes.FunctionRemoveSelectedItem,\n selectedItem,\n })\n },\n [dispatch],\n )\n const setSelectedItems = useCallback(\n newSelectedItems => {\n dispatch({\n type: stateChangeTypes.FunctionSetSelectedItems,\n selectedItems: newSelectedItems,\n })\n },\n [dispatch],\n )\n const setActiveIndex = useCallback(\n newActiveIndex => {\n dispatch({\n type: stateChangeTypes.FunctionSetActiveIndex,\n activeIndex: newActiveIndex,\n })\n },\n [dispatch],\n )\n const reset = useCallback(() => {\n dispatch({\n type: stateChangeTypes.FunctionReset,\n })\n }, [dispatch])\n\n return {\n getSelectedItemProps,\n getDropdownProps,\n addSelectedItem,\n removeSelectedItem,\n setSelectedItems,\n setActiveIndex,\n reset,\n selectedItems,\n activeIndex,\n }\n}\n\nexport default useMultipleSelection\n"],"names":["_objectWithoutPropertiesLoose","source","excluded","key","i","target","sourceKeys","Object","keys","length","indexOf","_extends","assign","arguments","prototype","hasOwnProperty","call","apply","this","_assertThisInitialized","self","ReferenceError","_setPrototypeOf","o","p","setPrototypeOf","__proto__","b","Symbol","for","c","d","e","f","g","h","k","l","m","n","q","r","t","v","w","x","y","z","a","u","$$typeof","type","A","getOwnPropertySymbols","propertyIsEnumerable","test1","String","getOwnPropertyNames","test2","fromCharCode","map","join","test3","split","forEach","letter","err","shouldUseNative","Function","bind","emptyFunction","emptyFunctionWithReset","resetWarningCache","propTypesModule","shim","props","propName","componentName","location","propFullName","secret","Error","name","getShim","isRequired","ReactPropTypes","array","bool","func","number","object","string","symbol","any","arrayOf","element","elementType","instanceOf","node","objectOf","oneOf","oneOfType","shape","exact","checkPropTypes","PropTypes","require$$2","B","C","D","E","F","G","H","I","nodeType","clientHeight","scrollHeight","clientWidth","scrollWidth","getComputedStyle","overflowY","overflowX","ownerDocument","defaultView","frameElement","idCounter","cbToCb","cb","noop","scrollIntoView","menuNode","window","scrollMode","block","inline","boundary","skipOverflowHiddenElements","TypeError","document","scrollingElement","documentElement","s","parentElement","push","body","visualViewport","width","innerWidth","height","innerHeight","scrollX","pageXOffset","scrollY","pageYOffset","W","getBoundingClientRect","top","right","M","bottom","V","left","T","O","R","X","Y","L","S","j","parseInt","borderLeftWidth","borderTopWidth","borderRightWidth","borderBottomWidth","J","offsetWidth","K","offsetHeight","Math","max","N","scrollLeft","P","scrollTop","min","el","computeScrollIntoView","isOrContainsNode","parent","child","environment","Node","contains","debounce","fn","time","timeoutId","cancel","clearTimeout","wrapper","args","setTimeout","callAllEventHandlers","fns","event","some","preventDownshiftDefault","nativeEvent","handleRefs","refs","ref","current","generateId","getA11yStatusMessage","isOpen","resultCount","previousResultCount","unwrapArray","arg","defaultValue","Array","isArray","stateKeys","pickState","state","result","getState","reduce","prevState","isControlledProp","undefined","normalizeArrowKey","keyCode","getNextWrappingIndex","moveAmount","baseIndex","itemCount","getItemNodeFromIndex","circular","itemsLastIndex","newIndex","nonDisabledNewIndex","getNextNonDisabledIndex","currentElementNode","hasAttribute","index","targetWithinDownshift","downshiftElements","checkActiveElement","contextNode","activeElement","cleanupStatus","documentProp","getStatusDiv","textContent","setStatus","status","div","statusDiv","getElementById","createElement","setAttribute","style","border","clip","margin","overflow","padding","position","appendChild","Downshift","subClass","superClass","_Component","id","_this","menuId","labelId","inputId","getItemId","input","items","timeoutIds","internalSetTimeout","filter","setItemCount","count","unsetItemCount","setHighlightedIndex","highlightedIndex","otherStateToSet","defaultHighlightedIndex","internalSetState","clearSelection","selectedItem","inputValue","defaultIsOpen","selectItem","item","itemToString","selectItemAtIndex","itemIndex","selectHighlightedItem","stateToSet","isItemSelected","onChangeArg","onStateChangeArg","isStateToSetFunction","onInputValueChange","getStateAndHelpers","setState","newStateToSet","stateReducer","nextState","nextFullState","onStateChange","onSelect","onChange","onUserAction","rootRef","_rootNode","getRootProps","refKey","rest","suppressRefError","called","role","keyDownHandlers","ArrowDown","preventDefault","amount","shiftKey","moveHighlightedIndex","_this2","getItemCount","nextHighlightedIndex","ArrowUp","_this3","Enter","which","itemNode","Escape","reset","buttonKeyDownHandlers","toggleMenu","inputKeyDownHandlers","Home","newHighlightedIndex","_this4","End","_this5","getToggleButtonProps","onClick","onPress","onKeyDown","onKeyUp","onBlur","enabledEventHandlers","buttonHandleClick","buttonHandleKeyDown","buttonHandleKeyUp","buttonHandleBlur","disabled","focus","blurTarget","isMouseDown","getLabelProps","htmlFor","getInputProps","onInput","onChangeText","eventHandlers","inputHandleChange","inputHandleKeyDown","inputHandleBlur","autoComplete","value","downshiftButtonIsActive","dataset","toggle","menuRef","_menuNode","getMenuProps","getItemProps","onMouseMove","onMouseDown","customClickHandler","avoidScrolling","clearItems","openMenu","closeMenu","updateStatus","highlightedItem","setA11yStatus","initialHighlightedIndex","initialIsOpen","initialInputValue","initialSelectedItem","create","constructor","internalClearTimeouts","stateToMerge","scrollHighlightedItemIntoView","_this6","componentDidMount","_this7","onMouseUp","onOuterClick","onTouchStart","isTouchMove","onTouchMove","onTouchEnd","contextWithinDownshift","addEventListener","cleanup","removeEventListener","shouldScroll","prevProps","currentHighlightedIndex","prevHighlightedIndex","componentDidUpdate","selectedItemChanged","componentWillUnmount","render","children","isDOMElement","cloneElement","getElementProps","Component","defaultProps","prevItem","stateChangeTypes","dropdownDefaultStateValues","callOnChangeProps","action","newState","changes","handler","capitalizeString","invokeOnChangeHandler","updateA11yStatus","getA11yMessage","useIsomorphicLayoutEffect","useLayoutEffect","useEffect","useElementIds","toggleButtonId","useRef","getItemIndex","isAcceptedCharacterKey","test","slice","toUpperCase","useLatestRef","val","useEnhancedReducer","reducer","initialState","prevStateRef","actionRef","enhancedReducer","useCallback","useReducer","dispatch","propsRef","dispatchWithProps","useControlledReducer","getA11ySelectionMessage","selectionParameters","itemToStringLocal","circularNavigation","getDefaultValue","propKey","defaultStateValues","defaultPropKey","getInitialValue","initialPropKey","getInitialState","getHighlightedIndexOnOpen","offset","useMouseAndTouchTracker","downshiftElementRefs","handleBlur","mouseAndTouchTrackersRef","useGetterPropsCalledChecker","useA11yMessageSetter","dependencyArray","isInitialMount","useScrollIntoView","itemRefs","menuElement","scrollIntoViewProp","shouldScrollRef","useControlPropsValidator","downshiftCommonReducer","ItemMouseMove","MenuMouseLeave","ToggleButtonClick","FunctionToggleMenu","FunctionOpenMenu","FunctionCloseMenu","FunctionSetHighlightedIndex","FunctionSetInputValue","FunctionReset","__assign","getItemIndexByCharacterKey","_a","keysSoFar","lowerCasedKeysSoFar","toLowerCase","offsetIndex","startsWith","commonDefaultProps","validatePropTypes","downshiftSelectReducer","lowercasedKey","commonReducer","useSelect","userProps","toggleButtonRef","shouldBlurRef","clearTimeoutRef","elementIds","previousResultCountRef","isInitialMountRef","latest","outerDispatch","setGetterPropCallInfo","toggleButtonKeyDownHandlers","useMemo","menuKeyDownHandlers","newSelectedItem","setInputValue","newInputValue","labelProps","onMouseLeave","latestState","tabIndex","toggleProps","toggleButtonNode","latestProps","itemProps","defaultPropsCommon","downshiftUseComboboxReducer","useCombobox","previousSelectedItemRef","getInitialStateCommon","defaultInputValue","inputRef","comboboxRef","inputNode","getComboboxProps","comboboxNode","activeIndex","selectedItems","getInitialValueCommon","getDefaultValueCommon","isKeyDownOperationPermitted","metaKey","ctrlKey","altKey","HTMLInputElement","selectionStart","selectionEnd","getA11yRemovalMessage","removedSelectedItem","keyNavigationNext","keyNavigationPrevious","downshiftMultipleSelectionReducer","newActiveIndex","selectedItemIndex","useMultipleSelection","dropdownRef","previousSelectedItemsRef","selectedItemRefs","find","activeSelectedItem","selectedItemKeyDownHandlers","Delete","Backspace","dropdownKeyDownHandlers","getSelectedItemProps","selectedItemNode","getDropdownProps","preventKeyAction","dropdownNode","addSelectedItem","removeSelectedItem","setSelectedItems","newSelectedItems","setActiveIndex"],"mappings":"oRAAe,SAASA,EAA8BC,EAAQC,GAC5D,GAAc,MAAVD,EAAgB,MAAO,GAC3B,IAEIE,EAAKC,EAFLC,EAAS,GACTC,EAAaC,OAAOC,KAAKP,GAG7B,IAAKG,EAAI,EAAGA,EAAIE,EAAWG,OAAQL,IACjCD,EAAMG,EAAWF,GACbF,EAASQ,QAAQP,IAAQ,IAC7BE,EAAOF,GAAOF,EAAOE,IAGvB,OAAOE,ECZM,SAASM,IAetB,OAdAA,EAAWJ,OAAOK,QAAU,SAAUP,GACpC,IAAK,IAAID,EAAI,EAAGA,EAAIS,UAAUJ,OAAQL,IAAK,CACzC,IAAIH,EAASY,UAAUT,GAEvB,IAAK,IAAID,KAAOF,EACVM,OAAOO,UAAUC,eAAeC,KAAKf,EAAQE,KAC/CE,EAAOF,GAAOF,EAAOE,IAK3B,OAAOE,IAGOY,MAAMC,KAAML,WCff,SAASM,EAAuBC,GAC7C,QAAa,IAATA,EACF,MAAM,IAAIC,eAAe,6DAG3B,OAAOD,ECLM,SAASE,EAAgBC,EAAGC,GAMzC,OALAF,EAAkBf,OAAOkB,gBAAkB,SAAyBF,EAAGC,GAErE,OADAD,EAAEG,UAAYF,EACPD,IAGcA,EAAGC,2BCGXG,EAAE,mBAAoBC,QAAQA,OAAOC,IAAIC,EAAEH,EAAEC,OAAOC,IAAI,iBAAiB,MAAME,EAAEJ,EAAEC,OAAOC,IAAI,gBAAgB,MAAMG,EAAEL,EAAEC,OAAOC,IAAI,kBAAkB,MAAMI,EAAEN,EAAEC,OAAOC,IAAI,qBAAqB,MAAMK,EAAEP,EAAEC,OAAOC,IAAI,kBAAkB,MAAMM,EAAER,EAAEC,OAAOC,IAAI,kBAAkB,MAAMO,EAAET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