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EIgC,EACFA,EAAMrM,KAAKtO,GAEXoU,EAAO9F,KAAK,CAACtO,GAEjB,EAESwO,GAAY,OAAgC7G,KAAiB4G,EAAQC,KAAaC,MACzF8N,IAGF,OAAOnI,CACT,CAEA,SAASma,EAAQC,GAGf,IAFA,IAE4DjgB,EAFxDkgB,EAAY,GAEPjgB,GAAY,OAAgCggB,KAAgBjgB,EAAQC,KAAaC,MAAO,CAC/F,IAAIigB,EAAMngB,EAAM9G,MAChBgnB,EAAUngB,KAAKqgB,MAAMF,EAAWC,EAClC,CAEA,OAAOD,CACT,CAEA,SAASG,EAAQ7uB,GACf,OAAOA,EAAMI,QAAQyuB,SACvB,C,kBCtCA,SAASC,EAAUhyB,GACjBA,EAAQgyB,WAAY,EACpBhyB,EAAQ6B,QACR7B,EAAQgyB,WAAY,CACtB,CACA,SAASC,EAAajyB,GACpB,QAASA,EAAQgyB,SACnB,CACA,SAASE,EAAalyB,EAAS4K,GAC7B5K,EAAQgyB,UAAYpnB,CACtB,C","sources":["webpack://@finviz/website/../node_modules/reakit-utils/es/closest.js","webpack://@finviz/website/../node_modules/reakit-utils/es/contains.js","webpack://@finviz/website/../node_modules/reakit-utils/es/createEvent.js","webpack://@finviz/website/../node_modules/reakit-utils/es/hasFocus.js","webpack://@finviz/website/../node_modules/reakit-utils/es/ensureFocus.js","webpack://@finviz/website/../node_modules/reakit-utils/es/getActiveElement.js","webpack://@finviz/website/../node_modules/reakit-utils/es/getNextActiveElementOnBlur.js","webpack://@finviz/website/../node_modules/reakit-utils/es/hasFocusWithin.js","webpack://@finviz/website/../node_modules/reakit-utils/es/isButton.js","webpack://@finviz/website/../node_modules/reakit-utils/es/isPortalEvent.js","webpack://@finviz/website/../node_modules/reakit-utils/es/matches.js","webpack://@finviz/website/../node_modules/reakit-utils/es/removeItemFromArray.js","webpack://@finviz/website/../node_modules/reakit-utils/es/removeIndexFromArray.js","webpack://@finviz/website/../node_modules/reakit-utils/es/tabbable.js","webpack://@finviz/website/../node_modules/reakit-utils/es/useUpdateEffect.js","webpack://@finviz/website/../node_modules/reakit/es/Box/Box.js","webpack://@finviz/website/../node_modules/reakit/es/Clickable/Clickable.js","webpack://@finviz/website/../node_modules/reakit/es/Combobox/Combobox.js","webpack://@finviz/website/../node_modules/reakit/es/Combobox/ComboboxItem.js","webpack://@finviz/website/../node_modules/reakit/es/Combobox/ComboboxOption.js","webpack://@finviz/website/../node_modules/reakit/es/Combobox/ComboboxList.js","webpack://@finviz/website/../node_modules/reakit/es/Combobox/ComboboxPopover.js","webpack://@finviz/website/../node_modules/reakit/es/ComboboxBaseState-73fabcba.js","webpack://@finviz/website/../node_modules/reakit/es/Combobox/ComboboxState.js","webpack://@finviz/website/../node_modules/reakit/es/Combobox/ComboboxListState.js","webpack://@finviz/website/../node_modules/reakit/es/ComboboxPopoverState-fdc371b4.js","webpack://@finviz/website/../node_modules/reakit-utils/es/fireBlurEvent.js","webpack://@finviz/website/../node_modules/reakit-utils/es/fireKeyboardEvent.js","webpack://@finviz/website/../node_modules/reakit/es/Composite/Composite.js","webpack://@finviz/website/../node_modules/reakit-utils/es/isTextField.js","webpack://@finviz/website/../node_modules/reakit/es/Id/Id.js","webpack://@finviz/website/../node_modules/reakit/es/setTextFieldValue-0a221f4e.js","webpack://@finviz/website/../node_modules/reakit-utils/es/fireEvent.js","webpack://@finviz/website/../node_modules/reakit/es/Composite/CompositeItem.js","webpack://@finviz/website/../node_modules/reakit-utils/es/applyState.js","webpack://@finviz/website/../node_modules/reakit/es/Composite/CompositeState.js","webpack://@finviz/website/../node_modules/reakit/es/MenuContext-6af6cf92.js","webpack://@finviz/website/../node_modules/reakit/es/DialogBackdropContext-8775f78b.js","webpack://@finviz/website/../node_modules/reakit/es/Dialog/Dialog.js","webpack://@finviz/website/../node_modules/reakit-utils/es/isEmpty.js","webpack://@finviz/website/../node_modules/reakit/es/Popover/Popover.js","webpack://@finviz/website/../node_modules/reakit/es/Tabbable/Tabbable.js","webpack://@finviz/website/../node_modules/reakit/es/__keys-0f89298f.js","webpack://@finviz/website/../node_modules/reakit/es/__keys-6742f591.js","webpack://@finviz/website/../node_modules/reakit/es/__keys-ed7b48af.js","webpack://@finviz/website/../node_modules/reakit/es/findEnabledItemById-8ddca752.js","webpack://@finviz/website/../node_modules/reakit/es/getCurrentId-5aa9849e.js","webpack://@finviz/website/../node_modules/reakit/es/getMenuId-34730bd3.js","webpack://@finviz/website/../node_modules/reakit/es/reverse-30eaa122.js","webpack://@finviz/website/../node_modules/reakit/es/userFocus-e16425e3.js"],"sourcesContent":["import { matches } from './matches.js';\n\n/**\n * Ponyfill for `Element.prototype.closest`\n *\n * @example\n * import { closest } from \"reakit-utils\";\n *\n * closest(document.getElementById(\"id\"), \"div\");\n * // same as\n * document.getElementById(\"id\").closest(\"div\");\n */\nfunction closest(element, selectors) {\n if (\"closest\" in element) return element.closest(selectors);\n\n do {\n if (matches(element, selectors)) return element;\n element = element.parentElement || element.parentNode;\n } while (element !== null && element.nodeType === 1);\n\n return null;\n}\n\nexport { closest };\n","/**\n * Similar to `Element.prototype.contains`, but a little bit faster when\n * `element` is the same as `child`.\n *\n * @example\n * import { contains } from \"reakit-utils\";\n *\n * contains(document.getElementById(\"parent\"), document.getElementById(\"child\"));\n */\nfunction contains(parent, child) {\n return parent === child || parent.contains(child);\n}\n\nexport { contains };\n","import { getDocument } from './getDocument.js';\n\n/**\n * Creates an `Event` in a way that also works on IE 11.\n *\n * @example\n * import { createEvent } from \"reakit-utils\";\n *\n * const el = document.getElementById(\"id\");\n * el.dispatchEvent(createEvent(el, \"blur\", { bubbles: false }));\n */\n\nfunction createEvent(element, type, eventInit) {\n if (typeof Event === \"function\") {\n return new Event(type, eventInit);\n } // IE 11 doesn't support Event constructors\n\n\n var event = getDocument(element).createEvent(\"Event\");\n event.initEvent(type, eventInit === null || eventInit === void 0 ? void 0 : eventInit.bubbles, eventInit === null || eventInit === void 0 ? void 0 : eventInit.cancelable);\n return event;\n}\n\nexport { createEvent };\n","import './getDocument.js';\nimport { getActiveElement } from './getActiveElement.js';\n\n/**\n * Checks if `element` has focus. Elements that are referenced by\n * `aria-activedescendant` are also considered.\n *\n * @example\n * import { hasFocus } from \"reakit-utils\";\n *\n * hasFocus(document.getElementById(\"id\"));\n */\n\nfunction hasFocus(element) {\n var activeElement = getActiveElement(element);\n if (!activeElement) return false;\n if (activeElement === element) return true;\n var activeDescendant = activeElement.getAttribute(\"aria-activedescendant\");\n if (!activeDescendant) return false;\n return activeDescendant === element.id;\n}\n\nexport { hasFocus };\n","import './getDocument.js';\nimport './getActiveElement.js';\nimport { hasFocus } from './hasFocus.js';\n\n/**\n * Ensures `element` will receive focus if it's not already.\n *\n * @example\n * import { ensureFocus } from \"reakit-utils\";\n *\n * ensureFocus(document.activeElement); // does nothing\n *\n * const element = document.querySelector(\"input\");\n *\n * ensureFocus(element); // focuses element\n * ensureFocus(element, { preventScroll: true }); // focuses element preventing scroll jump\n *\n * function isActive(el) {\n * return el.dataset.active === \"true\";\n * }\n *\n * ensureFocus(document.querySelector(\"[data-active='true']\"), { isActive }); // does nothing\n *\n * @returns {number} `requestAnimationFrame` call ID so it can be passed to `cancelAnimationFrame` if needed.\n */\nfunction ensureFocus(element, _temp) {\n var _ref = _temp === void 0 ? {} : _temp,\n preventScroll = _ref.preventScroll,\n _ref$isActive = _ref.isActive,\n isActive = _ref$isActive === void 0 ? hasFocus : _ref$isActive;\n\n if (isActive(element)) return -1;\n element.focus({\n preventScroll: preventScroll\n });\n if (isActive(element)) return -1;\n return requestAnimationFrame(function () {\n element.focus({\n preventScroll: preventScroll\n });\n });\n}\n\nexport { ensureFocus };\n","import { getDocument } from './getDocument.js';\n\n/**\n * Returns `element.ownerDocument.activeElement`.\n */\n\nfunction getActiveElement(element) {\n var _getDocument = getDocument(element),\n activeElement = _getDocument.activeElement;\n\n if (!(activeElement !== null && activeElement !== void 0 && activeElement.nodeName)) {\n // In IE11, activeElement might be an empty object if we're interacting\n // with elements inside of an iframe.\n return null;\n }\n\n return activeElement;\n}\n\nexport { getActiveElement };\n","import './getDocument.js';\nimport './getWindow.js';\nimport { canUseDOM } from './canUseDOM.js';\nimport { getActiveElement } from './getActiveElement.js';\n\nvar isIE11 = canUseDOM && \"msCrypto\" in window;\n/**\n * Cross-browser method that returns the next active element (the element that\n * is receiving focus) after a blur event is dispatched. It receives the blur\n * event object as the argument.\n *\n * @example\n * import { getNextActiveElementOnBlur } from \"reakit-utils\";\n *\n * const element = document.getElementById(\"id\");\n * element.addEventListener(\"blur\", (event) => {\n * const nextActiveElement = getNextActiveElementOnBlur(event);\n * });\n */\n\nfunction getNextActiveElementOnBlur(event) {\n // IE 11 doesn't support event.relatedTarget on blur.\n // document.activeElement points the the next active element.\n // On modern browsers, document.activeElement points to the current target.\n if (isIE11) {\n var activeElement = getActiveElement(event.currentTarget);\n return activeElement;\n }\n\n return event.relatedTarget;\n}\n\nexport { getNextActiveElementOnBlur };\n","import './getDocument.js';\nimport { getActiveElement } from './getActiveElement.js';\nimport { contains } from './contains.js';\n\n/**\n * Checks if `element` has focus within. Elements that are referenced by\n * `aria-activedescendant` are also considered.\n *\n * @example\n * import { hasFocusWithin } from \"reakit-utils\";\n *\n * hasFocusWithin(document.getElementById(\"id\"));\n */\n\nfunction hasFocusWithin(element) {\n var activeElement = getActiveElement(element);\n if (!activeElement) return false;\n if (contains(element, activeElement)) return true;\n var activeDescendant = activeElement.getAttribute(\"aria-activedescendant\");\n if (!activeDescendant) return false;\n if (activeDescendant === element.id) return true;\n return !!element.querySelector(\"#\" + activeDescendant);\n}\n\nexport { hasFocusWithin };\n","var buttonInputTypes = [\"button\", \"color\", \"file\", \"image\", \"reset\", \"submit\"];\n/**\n * Checks whether `element` is a native HTML button element.\n *\n * @example\n * import { isButton } from \"reakit-utils\";\n *\n * isButton(document.querySelector(\"button\")); // true\n * isButton(document.querySelector(\"input[type='button']\")); // true\n * isButton(document.querySelector(\"div\")); // false\n * isButton(document.querySelector(\"input[type='text']\")); // false\n * isButton(document.querySelector(\"div[role='button']\")); // false\n *\n * @returns {boolean}\n */\n\nfunction isButton(element) {\n if (element.tagName === \"BUTTON\") return true;\n\n if (element.tagName === \"INPUT\") {\n var input = element;\n return buttonInputTypes.indexOf(input.type) !== -1;\n }\n\n return false;\n}\n\nexport { isButton };\n","import { contains } from './contains.js';\n\n/**\n * Returns `true` if `event` has been fired within a React Portal element.\n */\n\nfunction isPortalEvent(event) {\n return !contains(event.currentTarget, event.target);\n}\n\nexport { isPortalEvent };\n","/**\n * Ponyfill for `Element.prototype.matches`\n *\n * @see https://developer.mozilla.org/en-US/docs/Web/API/Element/matches\n */\nfunction matches(element, selectors) {\n if (\"matches\" in element) {\n return element.matches(selectors);\n }\n\n if (\"msMatchesSelector\" in element) {\n return element.msMatchesSelector(selectors);\n }\n\n return element.webkitMatchesSelector(selectors);\n}\n\nexport { matches };\n","import { removeIndexFromArray } from './removeIndexFromArray.js';\n\n/**\n * Immutably removes an item from an array.\n *\n * @example\n * import { removeItemFromArray } from \"reakit-utils\";\n *\n * removeItemFromArray([\"a\", \"b\", \"c\"], \"b\"); // [\"a\", \"c\"]\n *\n * // This only works by reference\n * const obj = {};\n * removeItemFromArray([obj], {}); // [obj]\n * removeItemFromArray([obj], obj); // []\n *\n * @returns {Array} A new array without the passed item.\n */\n\nfunction removeItemFromArray(array, item) {\n var index = array.indexOf(item);\n return removeIndexFromArray(array, index);\n}\n\nexport { removeItemFromArray };\n","/**\n * Immutably removes an index from an array.\n *\n * @example\n * import { removeIndexFromArray } from \"reakit-utils\";\n *\n * removeIndexFromArray([\"a\", \"b\", \"c\"], 1); // [\"a\", \"c\"]\n *\n * @returns {Array} A new array without the item in the passed index.\n */\nfunction removeIndexFromArray(array, index) {\n if (index === -1) return array;\n return [].concat(array.slice(0, index), array.slice(index + 1));\n}\n\nexport { removeIndexFromArray };\n","import './getDocument.js';\nimport { matches } from './matches.js';\nimport { closest } from './closest.js';\nimport { getActiveElement } from './getActiveElement.js';\n\n/** @module tabbable */\nvar selector = \"input:not([type='hidden']):not([disabled]), select:not([disabled]), \" + \"textarea:not([disabled]), a[href], button:not([disabled]), [tabindex], \" + \"iframe, object, embed, area[href], audio[controls], video[controls], \" + \"[contenteditable]:not([contenteditable='false'])\";\n\nfunction isVisible(element) {\n var htmlElement = element;\n return htmlElement.offsetWidth > 0 || htmlElement.offsetHeight > 0 || element.getClientRects().length > 0;\n}\n\nfunction hasNegativeTabIndex(element) {\n var tabIndex = parseInt(element.getAttribute(\"tabindex\") || \"0\", 10);\n return tabIndex < 0;\n}\n/**\n * Checks whether `element` is focusable or not.\n *\n * @memberof tabbable\n *\n * @example\n * import { isFocusable } from \"reakit-utils\";\n *\n * isFocusable(document.querySelector(\"input\")); // true\n * isFocusable(document.querySelector(\"input[tabindex='-1']\")); // true\n * isFocusable(document.querySelector(\"input[hidden]\")); // false\n * isFocusable(document.querySelector(\"input:disabled\")); // false\n */\n\n\nfunction isFocusable(element) {\n return matches(element, selector) && isVisible(element);\n}\n/**\n * Checks whether `element` is tabbable or not.\n *\n * @memberof tabbable\n *\n * @example\n * import { isTabbable } from \"reakit-utils\";\n *\n * isTabbable(document.querySelector(\"input\")); // true\n * isTabbable(document.querySelector(\"input[tabindex='-1']\")); // false\n * isTabbable(document.querySelector(\"input[hidden]\")); // false\n * isTabbable(document.querySelector(\"input:disabled\")); // false\n */\n\nfunction isTabbable(element) {\n return isFocusable(element) && !hasNegativeTabIndex(element);\n}\n/**\n * Returns all the focusable elements in `container`.\n *\n * @memberof tabbable\n *\n * @param {Element} container\n *\n * @returns {Element[]}\n */\n\nfunction getAllFocusableIn(container) {\n var allFocusable = Array.from(container.querySelectorAll(selector));\n allFocusable.unshift(container);\n return allFocusable.filter(isFocusable);\n}\n/**\n * Returns the first focusable element in `container`.\n *\n * @memberof tabbable\n *\n * @param {Element} container\n *\n * @returns {Element|null}\n */\n\nfunction getFirstFocusableIn(container) {\n var _getAllFocusableIn = getAllFocusableIn(container),\n first = _getAllFocusableIn[0];\n\n return first || null;\n}\n/**\n * Returns all the tabbable elements in `container`, including the container\n * itself.\n *\n * @memberof tabbable\n *\n * @param {Element} container\n * @param fallbackToFocusable If `true`, it'll return focusable elements if there are no tabbable ones.\n *\n * @returns {Element[]}\n */\n\nfunction getAllTabbableIn(container, fallbackToFocusable) {\n var allFocusable = Array.from(container.querySelectorAll(selector));\n var allTabbable = allFocusable.filter(isTabbable);\n\n if (isTabbable(container)) {\n allTabbable.unshift(container);\n }\n\n if (!allTabbable.length && fallbackToFocusable) {\n return allFocusable;\n }\n\n return allTabbable;\n}\n/**\n * Returns the first tabbable element in `container`, including the container\n * itself if it's tabbable.\n *\n * @memberof tabbable\n *\n * @param {Element} container\n * @param fallbackToFocusable If `true`, it'll return the first focusable element if there are no tabbable ones.\n *\n * @returns {Element|null}\n */\n\nfunction getFirstTabbableIn(container, fallbackToFocusable) {\n var _getAllTabbableIn = getAllTabbableIn(container, fallbackToFocusable),\n first = _getAllTabbableIn[0];\n\n return first || null;\n}\n/**\n * Returns the last tabbable element in `container`, including the container\n * itself if it's tabbable.\n *\n * @memberof tabbable\n *\n * @param {Element} container\n * @param fallbackToFocusable If `true`, it'll return the last focusable element if there are no tabbable ones.\n *\n * @returns {Element|null}\n */\n\nfunction getLastTabbableIn(container, fallbackToFocusable) {\n var allTabbable = getAllTabbableIn(container, fallbackToFocusable);\n return allTabbable[allTabbable.length - 1] || null;\n}\n/**\n * Returns the next tabbable element in `container`.\n *\n * @memberof tabbable\n *\n * @param {Element} container\n * @param fallbackToFocusable If `true`, it'll return the next focusable element if there are no tabbable ones.\n *\n * @returns {Element|null}\n */\n\nfunction getNextTabbableIn(container, fallbackToFocusable) {\n var activeElement = getActiveElement(container);\n var allFocusable = getAllFocusableIn(container);\n var index = allFocusable.indexOf(activeElement);\n var slice = allFocusable.slice(index + 1);\n return slice.find(isTabbable) || allFocusable.find(isTabbable) || (fallbackToFocusable ? slice[0] : null);\n}\n/**\n * Returns the previous tabbable element in `container`.\n *\n * @memberof tabbable\n *\n * @param {Element} container\n * @param fallbackToFocusable If `true`, it'll return the previous focusable element if there are no tabbable ones.\n *\n * @returns {Element|null}\n */\n\nfunction getPreviousTabbableIn(container, fallbackToFocusable) {\n var activeElement = getActiveElement(container);\n var allFocusable = getAllFocusableIn(container).reverse();\n var index = allFocusable.indexOf(activeElement);\n var slice = allFocusable.slice(index + 1);\n return slice.find(isTabbable) || allFocusable.find(isTabbable) || (fallbackToFocusable ? slice[0] : null);\n}\n/**\n * Returns the closest focusable element.\n *\n * @memberof tabbable\n *\n * @param {Element} container\n *\n * @returns {Element|null}\n */\n\nfunction getClosestFocusable(element) {\n while (element && !isFocusable(element)) {\n element = closest(element, selector);\n }\n\n return element;\n}\n\nexport { getAllFocusableIn, getAllTabbableIn, getClosestFocusable, getFirstFocusableIn, getFirstTabbableIn, getLastTabbableIn, getNextTabbableIn, getPreviousTabbableIn, isFocusable, isTabbable };\n","import { useRef, useEffect } from 'react';\n\n/**\n * A `React.useEffect` that will not run on the first render.\n */\n\nfunction useUpdateEffect(effect, deps) {\n var mounted = useRef(false);\n useEffect(function () {\n if (mounted.current) {\n return effect();\n }\n\n mounted.current = true;\n return undefined;\n }, deps);\n}\n\nexport { useUpdateEffect };\n","import { _ as _objectWithoutPropertiesLoose } from '../_rollupPluginBabelHelpers-1f0bf8c2.js';\nimport { createComponent } from 'reakit-system/createComponent';\nimport { createHook } from 'reakit-system/createHook';\nimport { shallowEqual } from 'reakit-utils/shallowEqual';\n\n// Automatically generated\nvar BOX_KEYS = [\"unstable_system\"];\n\nvar useBox = createHook({\n name: \"Box\",\n keys: BOX_KEYS,\n propsAreEqual: function propsAreEqual(prev, next) {\n var prevSystem = prev.unstable_system,\n prevProps = _objectWithoutPropertiesLoose(prev, [\"unstable_system\"]);\n\n var nextSystem = next.unstable_system,\n nextProps = _objectWithoutPropertiesLoose(next, [\"unstable_system\"]);\n\n if (prevSystem !== nextSystem && !shallowEqual(prevSystem, nextSystem)) {\n return false;\n }\n\n return shallowEqual(prevProps, nextProps);\n }\n});\nvar Box = createComponent({\n as: \"div\",\n useHook: useBox\n});\n\nexport { Box, useBox };\n","import { _ as _objectWithoutPropertiesLoose, a as _objectSpread2 } from '../_rollupPluginBabelHelpers-1f0bf8c2.js';\nimport { createComponent } from 'reakit-system/createComponent';\nimport { createHook } from 'reakit-system/createHook';\nimport 'reakit-utils/shallowEqual';\nimport { useState, useCallback } from 'react';\nimport 'reakit-utils/useForkRef';\nimport { isButton } from 'reakit-utils/isButton';\nimport 'reakit-warning';\nimport { useLiveRef } from 'reakit-utils/useLiveRef';\nimport { isSelfTarget } from 'reakit-utils/isSelfTarget';\nimport 'reakit-utils/useIsomorphicEffect';\nimport 'reakit-utils/hasFocusWithin';\nimport 'reakit-utils/isPortalEvent';\nimport 'reakit-utils/dom';\nimport 'reakit-utils/tabbable';\nimport '../Role/Role.js';\nimport { useTabbable } from '../Tabbable/Tabbable.js';\n\n// Automatically generated\nvar CLICKABLE_KEYS = [\"unstable_clickOnEnter\", \"unstable_clickOnSpace\"];\n\nfunction isNativeClick(event) {\n var element = event.currentTarget;\n if (!event.isTrusted) return false; // istanbul ignore next: can't test trusted events yet\n\n return isButton(element) || element.tagName === \"INPUT\" || element.tagName === \"TEXTAREA\" || element.tagName === \"A\" || element.tagName === \"SELECT\";\n}\n\nvar useClickable = createHook({\n name: \"Clickable\",\n compose: useTabbable,\n keys: CLICKABLE_KEYS,\n useOptions: function useOptions(_ref) {\n var _ref$unstable_clickOn = _ref.unstable_clickOnEnter,\n unstable_clickOnEnter = _ref$unstable_clickOn === void 0 ? true : _ref$unstable_clickOn,\n _ref$unstable_clickOn2 = _ref.unstable_clickOnSpace,\n unstable_clickOnSpace = _ref$unstable_clickOn2 === void 0 ? true : _ref$unstable_clickOn2,\n options = _objectWithoutPropertiesLoose(_ref, [\"unstable_clickOnEnter\", \"unstable_clickOnSpace\"]);\n\n return _objectSpread2({\n unstable_clickOnEnter: unstable_clickOnEnter,\n unstable_clickOnSpace: unstable_clickOnSpace\n }, options);\n },\n useProps: function useProps(options, _ref2) {\n var htmlOnKeyDown = _ref2.onKeyDown,\n htmlOnKeyUp = _ref2.onKeyUp,\n htmlProps = _objectWithoutPropertiesLoose(_ref2, [\"onKeyDown\", \"onKeyUp\"]);\n\n var _React$useState = useState(false),\n active = _React$useState[0],\n setActive = _React$useState[1];\n\n var onKeyDownRef = useLiveRef(htmlOnKeyDown);\n var onKeyUpRef = useLiveRef(htmlOnKeyUp);\n var onKeyDown = useCallback(function (event) {\n var _onKeyDownRef$current;\n\n (_onKeyDownRef$current = onKeyDownRef.current) === null || _onKeyDownRef$current === void 0 ? void 0 : _onKeyDownRef$current.call(onKeyDownRef, event);\n if (event.defaultPrevented) return;\n if (options.disabled) return;\n if (event.metaKey) return;\n if (!isSelfTarget(event)) return;\n var isEnter = options.unstable_clickOnEnter && event.key === \"Enter\";\n var isSpace = options.unstable_clickOnSpace && event.key === \" \";\n\n if (isEnter || isSpace) {\n if (isNativeClick(event)) return;\n event.preventDefault();\n\n if (isEnter) {\n event.currentTarget.click();\n } else if (isSpace) {\n setActive(true);\n }\n }\n }, [options.disabled, options.unstable_clickOnEnter, options.unstable_clickOnSpace]);\n var onKeyUp = useCallback(function (event) {\n var _onKeyUpRef$current;\n\n (_onKeyUpRef$current = onKeyUpRef.current) === null || _onKeyUpRef$current === void 0 ? void 0 : _onKeyUpRef$current.call(onKeyUpRef, event);\n if (event.defaultPrevented) return;\n if (options.disabled) return;\n if (event.metaKey) return;\n var isSpace = options.unstable_clickOnSpace && event.key === \" \";\n\n if (active && isSpace) {\n setActive(false);\n event.currentTarget.click();\n }\n }, [options.disabled, options.unstable_clickOnSpace, active]);\n return _objectSpread2({\n \"data-active\": active || undefined,\n onKeyDown: onKeyDown,\n onKeyUp: onKeyUp\n }, htmlProps);\n }\n});\nvar Clickable = createComponent({\n as: \"button\",\n memo: true,\n useHook: useClickable\n});\n\nexport { Clickable, useClickable };\n","import { _ as _objectWithoutPropertiesLoose, a as _objectSpread2 } from '../_rollupPluginBabelHelpers-1f0bf8c2.js';\nimport { createComponent } from 'reakit-system/createComponent';\nimport { createHook } from 'reakit-system/createHook';\nimport 'reakit-utils/shallowEqual';\nimport { useRef, useReducer, useMemo, useEffect, useCallback } from 'react';\nimport { useForkRef } from 'reakit-utils/useForkRef';\nimport 'reakit-utils/isButton';\nimport { warning } from 'reakit-warning';\nimport { useLiveRef } from 'reakit-utils/useLiveRef';\nimport 'reakit-utils/isSelfTarget';\nimport 'reakit-utils/useIsomorphicEffect';\nimport 'reakit-utils/hasFocusWithin';\nimport 'reakit-utils/isPortalEvent';\nimport 'reakit-utils/dom';\nimport 'reakit-utils/tabbable';\nimport '../Role/Role.js';\nimport '../Tabbable/Tabbable.js';\nimport { useUpdateEffect } from 'reakit-utils/useUpdateEffect';\nimport 'reakit-system/useCreateElement';\nimport 'reakit-utils/getDocument';\nimport 'reakit-utils/fireBlurEvent';\nimport 'reakit-utils/fireKeyboardEvent';\nimport 'reakit-utils/canUseDOM';\nimport 'reakit-utils/getNextActiveElementOnBlur';\nimport '../reverse-30eaa122.js';\nimport '../getCurrentId-5aa9849e.js';\nimport '../findEnabledItemById-8ddca752.js';\nimport '../__keys-6742f591.js';\nimport '../userFocus-e16425e3.js';\nimport { useComposite } from '../Composite/Composite.js';\nimport { C as COMBOBOX_KEYS } from '../__keys-0f89298f.js';\nimport { g as getMenuId } from '../getMenuId-34730bd3.js';\n\nfunction getControls(baseId, ariaControls) {\n var menuId = getMenuId(baseId);\n\n if (ariaControls) {\n return ariaControls + \" \" + menuId;\n }\n\n return menuId;\n}\n\nfunction getAutocomplete(options) {\n if (options.list && options.inline) return \"both\";\n if (options.list) return \"list\";\n if (options.inline) return \"inline\";\n return \"none\";\n}\n\nfunction isFirstItemAutoSelected(items, autoSelect, currentId) {\n if (!autoSelect) return false;\n var firstItem = items.find(function (item) {\n return !item.disabled;\n });\n return currentId && (firstItem === null || firstItem === void 0 ? void 0 : firstItem.id) === currentId;\n}\n\nfunction hasCompletionString(inputValue, currentValue) {\n return !!currentValue && currentValue.length > inputValue.length && currentValue.toLowerCase().indexOf(inputValue.toLowerCase()) === 0;\n}\n\nfunction getCompletionString(inputValue, currentValue) {\n if (!currentValue) return \"\";\n var index = currentValue.toLowerCase().indexOf(inputValue.toLowerCase());\n return currentValue.slice(index + inputValue.length);\n}\n\nfunction useValue(options) {\n return useMemo(function () {\n if (!options.inline) {\n return options.inputValue;\n }\n\n var firstItemAutoSelected = isFirstItemAutoSelected(options.items, options.autoSelect, options.currentId);\n\n if (firstItemAutoSelected) {\n if (hasCompletionString(options.inputValue, options.currentValue)) {\n return options.inputValue + getCompletionString(options.inputValue, options.currentValue);\n }\n\n return options.inputValue;\n }\n\n return options.currentValue || options.inputValue;\n }, [options.inline, options.inputValue, options.autoSelect, options.items, options.currentId, options.currentValue]);\n}\n\nfunction getFirstEnabledItemId(items) {\n var _items$find;\n\n return (_items$find = items.find(function (item) {\n return !item.disabled;\n })) === null || _items$find === void 0 ? void 0 : _items$find.id;\n}\n\nvar unstable_useCombobox = createHook({\n name: \"Combobox\",\n compose: useComposite,\n keys: COMBOBOX_KEYS,\n useOptions: function useOptions(_ref) {\n var _ref$menuRole = _ref.menuRole,\n menuRole = _ref$menuRole === void 0 ? \"listbox\" : _ref$menuRole,\n _ref$hideOnEsc = _ref.hideOnEsc,\n hideOnEsc = _ref$hideOnEsc === void 0 ? true : _ref$hideOnEsc,\n options = _objectWithoutPropertiesLoose(_ref, [\"menuRole\", \"hideOnEsc\"]);\n\n return _objectSpread2({\n menuRole: menuRole,\n hideOnEsc: hideOnEsc\n }, options);\n },\n useProps: function useProps(options, _ref2) {\n var htmlRef = _ref2.ref,\n htmlOnKeyDown = _ref2.onKeyDown,\n htmlOnKeyPress = _ref2.onKeyPress,\n htmlOnChange = _ref2.onChange,\n htmlOnClick = _ref2.onClick,\n htmlOnBlur = _ref2.onBlur,\n ariaControls = _ref2[\"aria-controls\"],\n htmlProps = _objectWithoutPropertiesLoose(_ref2, [\"ref\", \"onKeyDown\", \"onKeyPress\", \"onChange\", \"onClick\", \"onBlur\", \"aria-controls\"]);\n\n var ref = useRef(null);\n\n var _React$useReducer = useReducer(function () {\n return {};\n }, {}),\n updated = _React$useReducer[0],\n update = _React$useReducer[1];\n\n var onKeyDownRef = useLiveRef(htmlOnKeyDown);\n var onKeyPressRef = useLiveRef(htmlOnKeyPress);\n var onChangeRef = useLiveRef(htmlOnChange);\n var onClickRef = useLiveRef(htmlOnClick);\n var onBlurRef = useLiveRef(htmlOnBlur);\n var value = useValue(options);\n var hasInsertedTextRef = useRef(false); // Completion string\n\n useEffect(function () {\n if (!options.inline) return;\n if (!options.autoSelect) return;\n if (!options.currentValue) return;\n if (options.currentId !== getFirstEnabledItemId(options.items)) return;\n\n if (!hasCompletionString(options.inputValue, options.currentValue)) {\n return;\n }\n\n var element = ref.current;\n process.env.NODE_ENV !== \"production\" ? warning(!element, \"Can't auto select combobox because `ref` wasn't passed to the component\", \"See https://reakit.io/docs/combobox\") : void 0;\n element === null || element === void 0 ? void 0 : element.setSelectionRange(options.inputValue.length, options.currentValue.length);\n }, [updated, options.inline, options.autoSelect, options.currentValue, options.inputValue, options.currentId, options.items]); // Auto select on type\n\n useUpdateEffect(function () {\n if (options.autoSelect && options.items.length && hasInsertedTextRef.current) {\n // If autoSelect is set to true and the last change was a text\n // insertion, we want to automatically focus on the first suggestion.\n // This effect will run both when inputValue changes and when items\n // change so we can also catch async items.\n options.setCurrentId(undefined);\n } else {\n // Without autoSelect, we'll always blur the combobox option and move\n // focus onto the combobox input.\n options.setCurrentId(null);\n }\n }, [options.items, options.inputValue, options.autoSelect, options.setCurrentId]);\n var onKeyDown = useCallback(function (event) {\n var _onKeyDownRef$current;\n\n (_onKeyDownRef$current = onKeyDownRef.current) === null || _onKeyDownRef$current === void 0 ? void 0 : _onKeyDownRef$current.call(onKeyDownRef, event); // Resets the reference on key down so we can figure it out later on\n // key press.\n\n hasInsertedTextRef.current = false;\n if (event.defaultPrevented) return;\n\n if (event.key === \"Escape\" && options.hideOnEsc) {\n var _options$hide;\n\n (_options$hide = options.hide) === null || _options$hide === void 0 ? void 0 : _options$hide.call(options);\n }\n }, [options.hideOnEsc, options.hide]);\n var onKeyPress = useCallback(function (event) {\n var _onKeyPressRef$curren;\n\n (_onKeyPressRef$curren = onKeyPressRef.current) === null || _onKeyPressRef$curren === void 0 ? void 0 : _onKeyPressRef$curren.call(onKeyPressRef, event); // onKeyPress will catch only printable character presses, so we skip\n // text removal and paste.\n\n hasInsertedTextRef.current = true;\n }, []);\n var onChange = useCallback(function (event) {\n var _onChangeRef$current, _options$show, _options$setInputValu;\n\n (_onChangeRef$current = onChangeRef.current) === null || _onChangeRef$current === void 0 ? void 0 : _onChangeRef$current.call(onChangeRef, event);\n if (event.defaultPrevented) return;\n (_options$show = options.show) === null || _options$show === void 0 ? void 0 : _options$show.call(options);\n (_options$setInputValu = options.setInputValue) === null || _options$setInputValu === void 0 ? void 0 : _options$setInputValu.call(options, event.target.value);\n update();\n\n if (!options.autoSelect || !hasInsertedTextRef.current) {\n var _options$setCurrentId;\n\n // If autoSelect is not set or it's not an insertion of text, focus\n // on the combobox input after changing the value.\n (_options$setCurrentId = options.setCurrentId) === null || _options$setCurrentId === void 0 ? void 0 : _options$setCurrentId.call(options, null);\n } else {\n var _options$setCurrentId2;\n\n // Selects first item\n (_options$setCurrentId2 = options.setCurrentId) === null || _options$setCurrentId2 === void 0 ? void 0 : _options$setCurrentId2.call(options, undefined);\n }\n }, [options.show, options.autoSelect, options.setCurrentId, options.setInputValue]);\n var onClick = useCallback(function (event) {\n var _onClickRef$current, _options$setCurrentId3;\n\n (_onClickRef$current = onClickRef.current) === null || _onClickRef$current === void 0 ? void 0 : _onClickRef$current.call(onClickRef, event);\n if (event.defaultPrevented) return; // https://github.com/reakit/reakit/issues/808\n\n if (!options.minValueLength || value.length >= options.minValueLength) {\n var _options$show2;\n\n (_options$show2 = options.show) === null || _options$show2 === void 0 ? void 0 : _options$show2.call(options);\n }\n\n (_options$setCurrentId3 = options.setCurrentId) === null || _options$setCurrentId3 === void 0 ? void 0 : _options$setCurrentId3.call(options, null);\n options.setInputValue(value);\n }, [options.show, options.setCurrentId, options.setInputValue, options.minValueLength, value]);\n var onBlur = useCallback(function (event) {\n var _onBlurRef$current;\n\n (_onBlurRef$current = onBlurRef.current) === null || _onBlurRef$current === void 0 ? void 0 : _onBlurRef$current.call(onBlurRef, event);\n if (event.defaultPrevented) return;\n options.setInputValue(value);\n }, [options.setInputValue, value]);\n return _objectSpread2({\n ref: useForkRef(ref, useForkRef(options.unstable_referenceRef, htmlRef)),\n role: \"combobox\",\n autoComplete: \"off\",\n \"aria-controls\": getControls(options.baseId, ariaControls),\n \"aria-haspopup\": options.menuRole,\n \"aria-expanded\": options.visible,\n \"aria-autocomplete\": getAutocomplete(options),\n value: value,\n onKeyDown: onKeyDown,\n onKeyPress: onKeyPress,\n onChange: onChange,\n onClick: onClick,\n onBlur: onBlur\n }, htmlProps);\n },\n useComposeProps: function useComposeProps(options, _ref3) {\n var onKeyUp = _ref3.onKeyUp,\n htmlOnKeyDownCapture = _ref3.onKeyDownCapture,\n htmlOnKeyDown = _ref3.onKeyDown,\n htmlProps = _objectWithoutPropertiesLoose(_ref3, [\"onKeyUp\", \"onKeyDownCapture\", \"onKeyDown\"]);\n\n var compositeHTMLProps = useComposite(options, htmlProps, true);\n var onKeyDownCaptureRef = useLiveRef(htmlOnKeyDownCapture);\n var onKeyDownRef = useLiveRef(htmlOnKeyDown);\n var onKeyDownCapture = useCallback(function (event) {\n var _onKeyDownCaptureRef$, _compositeHTMLProps$o;\n\n (_onKeyDownCaptureRef$ = onKeyDownCaptureRef.current) === null || _onKeyDownCaptureRef$ === void 0 ? void 0 : _onKeyDownCaptureRef$.call(onKeyDownCaptureRef, event);\n if (event.defaultPrevented) return;\n\n if (options.menuRole !== \"grid\") {\n // If menu is a one-dimensional list and there's an option with\n // focus, we don't want Home/End and printable characters to perform\n // actions on the option, only on the combobox input.\n if (event.key === \"Home\") return;\n if (event.key === \"End\") return;\n }\n\n if (event.key.length === 1) return; // Composite's onKeyDownCapture will proxy this event to the active\n // item.\n\n (_compositeHTMLProps$o = compositeHTMLProps.onKeyDownCapture) === null || _compositeHTMLProps$o === void 0 ? void 0 : _compositeHTMLProps$o.call(compositeHTMLProps, event);\n }, [options.menuRole, compositeHTMLProps.onKeyDownCapture]);\n var onKeyDown = useCallback(function (event) {\n var _onKeyDownRef$current2, _compositeHTMLProps$o2;\n\n (_onKeyDownRef$current2 = onKeyDownRef.current) === null || _onKeyDownRef$current2 === void 0 ? void 0 : _onKeyDownRef$current2.call(onKeyDownRef, event);\n if (event.defaultPrevented) return;\n var onlyInputHasFocus = options.currentId === null;\n if (!onlyInputHasFocus) return; // Do not perform list actions when pressing horizontal arrow keys when\n // focusing the combobox input while no option has focus.\n\n if (event.key === \"ArrowLeft\") return;\n if (event.key === \"ArrowRight\") return;\n if (event.key === \"Home\") return;\n if (event.key === \"End\") return;\n\n if (!event.ctrlKey && !event.altKey && !event.shiftKey && !event.metaKey && (event.key === \"ArrowUp\" || event.key === \"ArrowDown\" || event.key.length === 1)) {\n var _options$show3;\n\n // Up/Down arrow keys and printable characters should open the\n // combobox popover.\n (_options$show3 = options.show) === null || _options$show3 === void 0 ? void 0 : _options$show3.call(options);\n }\n\n (_compositeHTMLProps$o2 = compositeHTMLProps.onKeyDown) === null || _compositeHTMLProps$o2 === void 0 ? void 0 : _compositeHTMLProps$o2.call(compositeHTMLProps, event);\n }, [options.currentId, options.show, compositeHTMLProps.onKeyDown]);\n return _objectSpread2(_objectSpread2({}, compositeHTMLProps), {}, {\n onKeyDownCapture: onKeyDownCapture,\n onKeyDown: onKeyDown,\n onKeyUp: onKeyUp\n });\n }\n});\nvar unstable_Combobox = createComponent({\n as: \"input\",\n memo: true,\n useHook: unstable_useCombobox\n});\n\nexport { unstable_Combobox, unstable_useCombobox };\n","import { _ as _objectWithoutPropertiesLoose, a as _objectSpread2 } from '../_rollupPluginBabelHelpers-1f0bf8c2.js';\nimport { createComponent } from 'reakit-system/createComponent';\nimport { createHook } from 'reakit-system/createHook';\nimport 'reakit-utils/shallowEqual';\nimport { useBox } from '../Box/Box.js';\nimport { useCallback } from 'react';\nimport 'reakit-utils/useForkRef';\nimport 'reakit-utils/isButton';\nimport 'reakit-warning';\nimport { useLiveRef } from 'reakit-utils/useLiveRef';\nimport 'reakit-utils/isSelfTarget';\nimport 'reakit-utils/useIsomorphicEffect';\nimport 'reakit-utils/hasFocusWithin';\nimport 'reakit-utils/isPortalEvent';\nimport 'reakit-utils/dom';\nimport 'reakit-utils/tabbable';\nimport '../Role/Role.js';\nimport '../Tabbable/Tabbable.js';\nimport '../Clickable/Clickable.js';\nimport 'reakit-utils/getDocument';\nimport '../getCurrentId-5aa9849e.js';\nimport '../__keys-6742f591.js';\nimport '../userFocus-e16425e3.js';\nimport { c as COMBOBOX_ITEM_KEYS } from '../__keys-0f89298f.js';\nimport 'reakit-utils/isTextField';\nimport 'reakit-utils/ensureFocus';\nimport '../Id/IdProvider.js';\nimport '../Id/Id.js';\nimport 'reakit-utils/fireEvent';\nimport '../setTextFieldValue-0a221f4e.js';\nimport { useCompositeItem } from '../Composite/CompositeItem.js';\n\nfunction kebabCase(string) {\n return string.toLowerCase().replace(/[^a-z0-9]/g, \"-\");\n}\n\nfunction getItemId(baseId, value, id) {\n return id || baseId + \"-\" + kebabCase(value);\n}\n\nvar unstable_useComboboxItem = createHook({\n name: \"ComboboxItem\",\n compose: useBox,\n keys: COMBOBOX_ITEM_KEYS,\n propsAreEqual: function propsAreEqual(prev, next) {\n if (prev.value !== next.value) return false;\n\n if (!prev.value || !next.value || !prev.baseId || !next.baseId) {\n return useCompositeItem.unstable_propsAreEqual(prev, next);\n }\n\n var prevCurrentValue = prev.currentValue,\n prevInputValue = prev.inputValue,\n prevMatches = prev.matches,\n prevProps = _objectWithoutPropertiesLoose(prev, [\"currentValue\", \"inputValue\", \"matches\"]);\n\n var nextCurrentValue = next.currentValue,\n nextInputValue = next.inputValue,\n nextMatches = next.matches,\n nextProps = _objectWithoutPropertiesLoose(next, [\"currentValue\", \"inputValue\", \"matches\"]);\n\n if (prevCurrentValue !== nextCurrentValue) {\n if (next.value === prevCurrentValue || next.value === nextCurrentValue) {\n return false;\n }\n }\n\n var prevId = getItemId(prev.baseId, prev.value, prev.id);\n var nextId = getItemId(next.baseId, next.value, prev.id);\n return useCompositeItem.unstable_propsAreEqual(_objectSpread2(_objectSpread2({}, prevProps), {}, {\n id: prevId\n }), _objectSpread2(_objectSpread2({}, nextProps), {}, {\n id: nextId\n }));\n },\n useOptions: function useOptions(options) {\n var trulyDisabled = options.disabled && !options.focusable;\n var value = trulyDisabled ? undefined : options.value;\n var registerItem = useCallback(function (item) {\n if (options.visible) {\n var _options$registerItem;\n\n (_options$registerItem = options.registerItem) === null || _options$registerItem === void 0 ? void 0 : _options$registerItem.call(options, _objectSpread2(_objectSpread2({}, item), {}, {\n value: value\n }));\n }\n }, [options.registerItem, options.visible, value]);\n\n if (options.id || !options.baseId || !options.value) {\n return _objectSpread2(_objectSpread2({}, options), {}, {\n registerItem: registerItem\n });\n }\n\n var id = getItemId(options.baseId, options.value, options.id);\n return _objectSpread2(_objectSpread2({}, options), {}, {\n registerItem: registerItem,\n id: id\n });\n },\n useProps: function useProps(options, _ref) {\n var htmlOnClick = _ref.onClick,\n htmlProps = _objectWithoutPropertiesLoose(_ref, [\"onClick\"]);\n\n var onClickRef = useLiveRef(htmlOnClick);\n var onClick = useCallback(function (event) {\n var _onClickRef$current, _options$hide, _options$setInputValu;\n\n (_onClickRef$current = onClickRef.current) === null || _onClickRef$current === void 0 ? void 0 : _onClickRef$current.call(onClickRef, event);\n if (event.defaultPrevented) return;\n if (!options.value) return;\n (_options$hide = options.hide) === null || _options$hide === void 0 ? void 0 : _options$hide.call(options);\n (_options$setInputValu = options.setInputValue) === null || _options$setInputValu === void 0 ? void 0 : _options$setInputValu.call(options, options.value);\n }, [options.hide, options.setInputValue, options.value]);\n return _objectSpread2({\n children: options.value,\n onClick: onClick,\n tabIndex: -1\n }, htmlProps);\n }\n});\nvar unstable_ComboboxItem = createComponent({\n as: \"span\",\n memo: true,\n useHook: unstable_useComboboxItem\n});\n\nexport { unstable_ComboboxItem, unstable_useComboboxItem };\n","import { a as _objectSpread2 } from '../_rollupPluginBabelHelpers-1f0bf8c2.js';\nimport { createComponent } from 'reakit-system/createComponent';\nimport { createHook } from 'reakit-system/createHook';\nimport 'reakit-utils/shallowEqual';\nimport '../Box/Box.js';\nimport 'react';\nimport 'reakit-utils/useForkRef';\nimport 'reakit-utils/isButton';\nimport 'reakit-warning';\nimport 'reakit-utils/useLiveRef';\nimport 'reakit-utils/isSelfTarget';\nimport 'reakit-utils/useIsomorphicEffect';\nimport 'reakit-utils/hasFocusWithin';\nimport 'reakit-utils/isPortalEvent';\nimport 'reakit-utils/dom';\nimport 'reakit-utils/tabbable';\nimport '../Role/Role.js';\nimport '../Tabbable/Tabbable.js';\nimport '../Clickable/Clickable.js';\nimport 'reakit-utils/getDocument';\nimport '../getCurrentId-5aa9849e.js';\nimport '../__keys-6742f591.js';\nimport '../userFocus-e16425e3.js';\nimport { e as COMBOBOX_OPTION_KEYS } from '../__keys-0f89298f.js';\nimport 'reakit-utils/isTextField';\nimport 'reakit-utils/ensureFocus';\nimport '../Id/IdProvider.js';\nimport '../Id/Id.js';\nimport 'reakit-utils/fireEvent';\nimport '../setTextFieldValue-0a221f4e.js';\nimport { useCompositeItem } from '../Composite/CompositeItem.js';\nimport { unstable_useComboboxItem } from './ComboboxItem.js';\n\nvar unstable_useComboboxOption = createHook({\n name: \"ComboboxOption\",\n compose: [unstable_useComboboxItem, useCompositeItem],\n keys: COMBOBOX_OPTION_KEYS,\n useProps: function useProps(_, htmlProps) {\n return _objectSpread2({\n role: \"option\"\n }, htmlProps);\n }\n});\nvar unstable_ComboboxOption = createComponent({\n as: \"div\",\n memo: true,\n useHook: unstable_useComboboxOption\n});\n\nexport { unstable_ComboboxOption, unstable_useComboboxOption };\n","import { _ as _objectWithoutPropertiesLoose, a as _objectSpread2 } from '../_rollupPluginBabelHelpers-1f0bf8c2.js';\nimport { createComponent } from 'reakit-system/createComponent';\nimport { createHook } from 'reakit-system/createHook';\nimport 'reakit-utils/shallowEqual';\nimport { useBox } from '../Box/Box.js';\nimport { useWarning } from 'reakit-warning';\nimport { useCreateElement } from 'reakit-system/useCreateElement';\nimport { d as COMBOBOX_LIST_KEYS } from '../__keys-0f89298f.js';\nimport { g as getMenuId } from '../getMenuId-34730bd3.js';\n\nvar unstable_useComboboxList = createHook({\n name: \"ComboboxList\",\n compose: useBox,\n keys: COMBOBOX_LIST_KEYS,\n useOptions: function useOptions(_ref) {\n var _ref$menuRole = _ref.menuRole,\n menuRole = _ref$menuRole === void 0 ? \"listbox\" : _ref$menuRole,\n options = _objectWithoutPropertiesLoose(_ref, [\"menuRole\"]);\n\n return _objectSpread2({\n menuRole: menuRole\n }, options);\n },\n useProps: function useProps(options, htmlProps) {\n return _objectSpread2({\n role: options.menuRole,\n id: getMenuId(options.baseId)\n }, htmlProps);\n }\n});\nvar unstable_ComboboxList = createComponent({\n as: \"div\",\n useHook: unstable_useComboboxList,\n useCreateElement: function useCreateElement$1(type, props, children) {\n process.env.NODE_ENV !== \"production\" ? useWarning(!props[\"aria-label\"] && !props[\"aria-labelledby\"], \"You should provide either `aria-label` or `aria-labelledby` props.\", \"See https://reakit.io/docs/combobox\") : void 0;\n return useCreateElement(type, props, children);\n }\n});\n\nexport { unstable_ComboboxList, unstable_useComboboxList };\n","import { a as _objectSpread2, _ as _objectWithoutPropertiesLoose } from '../_rollupPluginBabelHelpers-1f0bf8c2.js';\nimport { createComponent } from 'reakit-system/createComponent';\nimport { createHook } from 'reakit-system/createHook';\nimport 'reakit-utils/shallowEqual';\nimport '../Box/Box.js';\nimport 'react';\nimport 'reakit-utils/useForkRef';\nimport 'reakit-utils/isButton';\nimport { useWarning } from 'reakit-warning';\nimport 'reakit-utils/useLiveRef';\nimport 'reakit-utils/isSelfTarget';\nimport 'reakit-utils/useIsomorphicEffect';\nimport 'reakit-utils/hasFocusWithin';\nimport 'reakit-utils/tabbable';\nimport '../Role/Role.js';\nimport 'reakit-utils/useUpdateEffect';\nimport { useCreateElement } from 'reakit-system/useCreateElement';\nimport 'reakit-utils/getDocument';\nimport 'reakit-utils/canUseDOM';\nimport 'reakit-utils/getNextActiveElementOnBlur';\nimport { f as COMBOBOX_POPOVER_KEYS } from '../__keys-0f89298f.js';\nimport '../getMenuId-34730bd3.js';\nimport 'reakit-utils/ensureFocus';\nimport { unstable_useComboboxList } from './ComboboxList.js';\nimport '../__keys-e6a5cfbe.js';\nimport '../Disclosure/DisclosureContent.js';\nimport 'react-dom';\nimport '../Portal/Portal.js';\nimport 'reakit-utils/removeItemFromArray';\nimport '../MenuContext-6af6cf92.js';\nimport '../Dialog/Dialog.js';\nimport 'body-scroll-lock';\nimport 'reakit-utils/closest';\nimport 'reakit-utils/getActiveElement';\nimport 'reakit-utils/contains';\nimport '../DialogBackdropContext-8775f78b.js';\nimport 'reakit-utils/isEmpty';\nimport '../__keys-ed7b48af.js';\nimport '../__keys-26bb1730.js';\nimport { usePopover } from '../Popover/Popover.js';\n\nvar unstable_useComboboxPopover = createHook({\n name: \"ComboboxPopover\",\n compose: [unstable_useComboboxList, usePopover],\n keys: COMBOBOX_POPOVER_KEYS,\n useOptions: function useOptions(options) {\n return _objectSpread2(_objectSpread2({}, options), {}, {\n unstable_disclosureRef: options.unstable_referenceRef,\n unstable_autoFocusOnShow: false,\n unstable_autoFocusOnHide: false\n });\n },\n useComposeProps: function useComposeProps(options, _ref) {\n var tabIndex = _ref.tabIndex,\n htmlProps = _objectWithoutPropertiesLoose(_ref, [\"tabIndex\"]);\n\n htmlProps = unstable_useComboboxList(options, htmlProps, true);\n htmlProps = usePopover(options, htmlProps, true);\n return _objectSpread2(_objectSpread2({}, htmlProps), {}, {\n tabIndex: tabIndex != null ? tabIndex : undefined\n });\n }\n});\nvar unstable_ComboboxPopover = createComponent({\n as: \"div\",\n useHook: unstable_useComboboxPopover,\n useCreateElement: function useCreateElement$1(type, props, children) {\n process.env.NODE_ENV !== \"production\" ? useWarning(!props[\"aria-label\"] && !props[\"aria-labelledby\"], \"You should provide either `aria-label` or `aria-labelledby` props.\", \"See https://reakit.io/docs/combobox\") : void 0;\n return useCreateElement(type, props, children);\n }\n});\n\nexport { unstable_ComboboxPopover, unstable_useComboboxPopover };\n","import { a as _objectSpread2, b as _createForOfIteratorHelperLoose } from './_rollupPluginBabelHelpers-1f0bf8c2.js';\nimport { useRef, useState, useMemo, useCallback } from 'react';\n\nfunction escapeRegExp(string) {\n return string.replace(/[.*+?^${}()|[\\]\\\\]/g, \"\\\\$&\");\n}\n\nfunction getMatches(inputValue, values, limit, list, autoSelect, minValueLength) {\n if (limit === 0 || inputValue.length < minValueLength) {\n // We don't want to populate combobox.matches if inputValue doesn't have\n // enough characters.\n return [];\n }\n\n var length = limit === false ? undefined : limit;\n\n if (!list) {\n // If list is false, this means that values aren't expected to be filtered.\n return values.slice(0, length);\n }\n\n var regex = new RegExp(escapeRegExp(inputValue), \"i\");\n var matches = [];\n\n if (autoSelect) {\n var match = values.find(function (value) {\n return value.search(regex) === 0;\n });\n\n if (match) {\n matches.push(match);\n }\n }\n\n for (var _iterator = _createForOfIteratorHelperLoose(values), _step; !(_step = _iterator()).done;) {\n var value = _step.value;\n\n if (length && matches.length >= length) {\n break;\n } // Excludes first match, that can be auto selected\n\n\n if (value !== matches[0] && value.search(regex) !== -1) {\n matches.push(value);\n }\n }\n\n return matches;\n}\n\nfunction useComboboxBaseState(composite, _temp) {\n var _ref = _temp === void 0 ? {} : _temp,\n _ref$inputValue = _ref.inputValue,\n initialInputValue = _ref$inputValue === void 0 ? \"\" : _ref$inputValue,\n _ref$minValueLength = _ref.minValueLength,\n initialMinValueLength = _ref$minValueLength === void 0 ? 0 : _ref$minValueLength,\n _ref$values = _ref.values,\n initialValues = _ref$values === void 0 ? [] : _ref$values,\n _ref$limit = _ref.limit,\n initialLimit = _ref$limit === void 0 ? 10 : _ref$limit,\n _ref$list = _ref.list,\n initialList = _ref$list === void 0 ? !!initialValues.length : _ref$list,\n _ref$inline = _ref.inline,\n initialInline = _ref$inline === void 0 ? false : _ref$inline,\n _ref$autoSelect = _ref.autoSelect,\n initialAutoSelect = _ref$autoSelect === void 0 ? false : _ref$autoSelect;\n\n var valuesById = useRef({});\n\n var _React$useState = useState(initialInputValue),\n inputValue = _React$useState[0],\n setInputValue = _React$useState[1];\n\n var _React$useState2 = useState(initialMinValueLength),\n minValueLength = _React$useState2[0],\n setMinValueLength = _React$useState2[1];\n\n var _React$useState3 = useState(initialValues),\n values = _React$useState3[0],\n setValues = _React$useState3[1];\n\n var _React$useState4 = useState(initialLimit),\n limit = _React$useState4[0],\n setLimit = _React$useState4[1];\n\n var _React$useState5 = useState(initialList),\n list = _React$useState5[0],\n setList = _React$useState5[1];\n\n var _React$useState6 = useState(initialInline),\n inline = _React$useState6[0],\n setInline = _React$useState6[1];\n\n var _React$useState7 = useState(initialAutoSelect),\n autoSelect = _React$useState7[0],\n setAutoSelect = _React$useState7[1];\n\n var matches = useMemo(function () {\n return getMatches(inputValue, values, limit, list, autoSelect, minValueLength);\n }, [inputValue, values, limit, list, autoSelect, minValueLength]);\n var currentValue = useMemo(function () {\n return composite.currentId ? valuesById.current[composite.currentId] : undefined;\n }, [valuesById, composite.currentId]);\n var items = useMemo(function () {\n composite.items.forEach(function (item) {\n if (item.id) {\n item.value = valuesById.current[item.id];\n }\n });\n return composite.items;\n }, [composite.items]);\n var registerItem = useCallback(function (item) {\n composite.registerItem(item);\n\n if (item.id) {\n valuesById.current[item.id] = item.value;\n }\n }, [composite.registerItem]);\n var unregisterItem = useCallback(function (id) {\n composite.unregisterItem(id);\n delete valuesById.current[id];\n }, [composite.unregisterItem]);\n return _objectSpread2(_objectSpread2({}, composite), {}, {\n menuRole: \"listbox\",\n items: items,\n registerItem: registerItem,\n unregisterItem: unregisterItem,\n visible: true,\n inputValue: inputValue,\n minValueLength: minValueLength,\n currentValue: currentValue,\n values: values,\n limit: limit,\n matches: matches,\n list: list,\n inline: inline,\n autoSelect: autoSelect,\n setInputValue: setInputValue,\n setMinValueLength: setMinValueLength,\n setValues: setValues,\n setLimit: setLimit,\n setList: setList,\n setInline: setInline,\n setAutoSelect: setAutoSelect\n });\n}\n\nexport { useComboboxBaseState as u };\n","import '../_rollupPluginBabelHelpers-1f0bf8c2.js';\nimport 'reakit-utils/shallowEqual';\nimport 'react';\nimport 'reakit-warning';\nimport 'reakit-utils/useIsomorphicEffect';\nimport 'reakit-utils/dom';\nimport { useSealedState } from 'reakit-utils/useSealedState';\nimport 'reakit-utils/getDocument';\nimport '../reverse-30eaa122.js';\nimport '../getCurrentId-5aa9849e.js';\nimport '../findEnabledItemById-8ddca752.js';\nimport '../Id/IdProvider.js';\nimport 'reakit-utils/applyState';\nimport '../Id/IdState.js';\nimport '../Composite/CompositeState.js';\nimport '../ComboboxBaseState-73fabcba.js';\nimport '@popperjs/core';\nimport '../Disclosure/DisclosureState.js';\nimport '../Dialog/DialogState.js';\nimport '../Popover/PopoverState.js';\nimport { u as useComboboxPopoverState } from '../ComboboxPopoverState-fdc371b4.js';\nimport { unstable_useComboboxListState } from './ComboboxListState.js';\n\nfunction unstable_useComboboxState(initialState) {\n if (initialState === void 0) {\n initialState = {};\n }\n\n var sealed = useSealedState(initialState);\n var combobox = unstable_useComboboxListState(sealed);\n return useComboboxPopoverState(combobox, sealed);\n}\n\nexport { unstable_useComboboxState };\n","import { _ as _objectWithoutPropertiesLoose, a as _objectSpread2 } from '../_rollupPluginBabelHelpers-1f0bf8c2.js';\nimport 'react';\nimport 'reakit-utils/useIsomorphicEffect';\nimport { useSealedState } from 'reakit-utils/useSealedState';\nimport 'reakit-utils/getDocument';\nimport '../reverse-30eaa122.js';\nimport '../getCurrentId-5aa9849e.js';\nimport '../findEnabledItemById-8ddca752.js';\nimport '../Id/IdProvider.js';\nimport 'reakit-utils/applyState';\nimport '../Id/IdState.js';\nimport { useCompositeState } from '../Composite/CompositeState.js';\nimport { u as useComboboxBaseState } from '../ComboboxBaseState-73fabcba.js';\n\nfunction unstable_useComboboxListState(initialState) {\n if (initialState === void 0) {\n initialState = {};\n }\n\n var _useSealedState = useSealedState(initialState),\n _useSealedState$curre = _useSealedState.currentId,\n currentId = _useSealedState$curre === void 0 ? null : _useSealedState$curre,\n _useSealedState$orien = _useSealedState.orientation,\n orientation = _useSealedState$orien === void 0 ? \"vertical\" : _useSealedState$orien,\n _useSealedState$loop = _useSealedState.loop,\n loop = _useSealedState$loop === void 0 ? true : _useSealedState$loop,\n sealed = _objectWithoutPropertiesLoose(_useSealedState, [\"currentId\", \"orientation\", \"loop\"]);\n\n var composite = useCompositeState(_objectSpread2(_objectSpread2({\n currentId: currentId,\n orientation: orientation,\n loop: loop\n }, sealed), {}, {\n unstable_virtual: true,\n unstable_includesBaseElement: true\n }));\n return useComboboxBaseState(composite, sealed);\n}\n\nexport { unstable_useComboboxListState };\n","import { a as _objectSpread2, _ as _objectWithoutPropertiesLoose } from './_rollupPluginBabelHelpers-1f0bf8c2.js';\nimport { useEffect } from 'react';\nimport { usePopoverState } from './Popover/PopoverState.js';\n\nfunction useComboboxPopoverState(combobox, _ref) {\n if (_ref === void 0) {\n _ref = {};\n }\n\n var _ref2 = _ref,\n _ref2$gutter = _ref2.gutter,\n gutter = _ref2$gutter === void 0 ? 0 : _ref2$gutter,\n _ref2$placement = _ref2.placement,\n placement = _ref2$placement === void 0 ? \"bottom-start\" : _ref2$placement,\n initialState = _objectWithoutPropertiesLoose(_ref2, [\"gutter\", \"placement\"]);\n\n var popover = usePopoverState(_objectSpread2({\n gutter: gutter,\n placement: placement\n }, initialState));\n var visible = popover.visible && combobox.inputValue.length >= combobox.minValueLength;\n useEffect(function () {\n if (!visible) {\n // We need to reset combobox.moves\n combobox.reset();\n }\n }, [visible, combobox.reset]);\n return _objectSpread2(_objectSpread2(_objectSpread2({}, combobox), popover), {}, {\n visible: visible\n });\n}\n\nexport { useComboboxPopoverState as u };\n","import './getDocument.js';\nimport { a as _objectSpread2 } from './_rollupPluginBabelHelpers-1f0bf8c2.js';\nimport { createEvent } from './createEvent.js';\n\nfunction createFocusEvent(element, type, eventInit) {\n if (eventInit === void 0) {\n eventInit = {};\n }\n\n if (typeof FocusEvent === \"function\") {\n return new FocusEvent(type, eventInit);\n }\n\n return createEvent(element, type, eventInit);\n}\n/**\n * Creates and dispatches a blur event in a way that also works on IE 11.\n *\n * @example\n * import { fireBlurEvent } from \"reakit-utils\";\n *\n * fireBlurEvent(document.getElementById(\"id\"));\n */\n\n\nfunction fireBlurEvent(element, eventInit) {\n var event = createFocusEvent(element, \"blur\", eventInit);\n var defaultAllowed = element.dispatchEvent(event);\n\n var bubbleInit = _objectSpread2(_objectSpread2({}, eventInit), {}, {\n bubbles: true\n });\n\n element.dispatchEvent(createFocusEvent(element, \"focusout\", bubbleInit));\n return defaultAllowed;\n}\n\nexport { fireBlurEvent };\n","import { getDocument } from './getDocument.js';\nimport { getWindow } from './getWindow.js';\n\nfunction createKeyboardEvent(element, type, eventInit) {\n if (eventInit === void 0) {\n eventInit = {};\n }\n\n if (typeof KeyboardEvent === \"function\") {\n return new KeyboardEvent(type, eventInit);\n } // IE 11 doesn't support Event constructors\n\n\n var event = getDocument(element).createEvent(\"KeyboardEvent\");\n event.initKeyboardEvent(type, eventInit.bubbles, eventInit.cancelable, getWindow(element), eventInit.key, eventInit.location, eventInit.ctrlKey, eventInit.altKey, eventInit.shiftKey, eventInit.metaKey);\n return event;\n}\n/**\n * Creates and dispatches `KeyboardEvent` in a way that also works on IE 11.\n *\n * @example\n * import { fireKeyboardEvent } from \"reakit-utils\";\n *\n * fireKeyboardEvent(document.getElementById(\"id\"), \"keydown\", {\n * key: \"ArrowDown\",\n * shiftKey: true,\n * });\n */\n\n\nfunction fireKeyboardEvent(element, type, eventInit) {\n return element.dispatchEvent(createKeyboardEvent(element, type, eventInit));\n}\n\nexport { fireKeyboardEvent };\n","import { a as _objectSpread2, _ as _objectWithoutPropertiesLoose } from '../_rollupPluginBabelHelpers-1f0bf8c2.js';\nimport { createComponent } from 'reakit-system/createComponent';\nimport { createHook } from 'reakit-system/createHook';\nimport 'reakit-utils/shallowEqual';\nimport { useRef, useEffect, useCallback, useReducer } from 'react';\nimport { useForkRef } from 'reakit-utils/useForkRef';\nimport 'reakit-utils/isButton';\nimport { warning, useWarning } from 'reakit-warning';\nimport { useLiveRef } from 'reakit-utils/useLiveRef';\nimport { isSelfTarget } from 'reakit-utils/isSelfTarget';\nimport 'reakit-utils/useIsomorphicEffect';\nimport 'reakit-utils/hasFocusWithin';\nimport 'reakit-utils/isPortalEvent';\nimport 'reakit-utils/dom';\nimport 'reakit-utils/tabbable';\nimport { useRole } from '../Role/Role.js';\nimport { useTabbable } from '../Tabbable/Tabbable.js';\nimport { useCreateElement } from 'reakit-system/useCreateElement';\nimport { getDocument } from 'reakit-utils/getDocument';\nimport { fireBlurEvent } from 'reakit-utils/fireBlurEvent';\nimport { fireKeyboardEvent } from 'reakit-utils/fireKeyboardEvent';\nimport { canUseDOM } from 'reakit-utils/canUseDOM';\nimport { getNextActiveElementOnBlur } from 'reakit-utils/getNextActiveElementOnBlur';\nimport { f as flatten, r as reverse, g as groupItems } from '../reverse-30eaa122.js';\nimport { g as getCurrentId, f as findFirstEnabledItem } from '../getCurrentId-5aa9849e.js';\nimport { f as findEnabledItemById } from '../findEnabledItemById-8ddca752.js';\nimport { C as COMPOSITE_KEYS } from '../__keys-6742f591.js';\nimport { u as userFocus } from '../userFocus-e16425e3.js';\n\nvar isIE11 = canUseDOM && \"msCrypto\" in window;\n\nfunction canProxyKeyboardEvent(event) {\n if (!isSelfTarget(event)) return false;\n if (event.metaKey) return false;\n if (event.key === \"Tab\") return false;\n return true;\n}\n\nfunction useKeyboardEventProxy(virtual, currentItem, htmlEventHandler) {\n var eventHandlerRef = useLiveRef(htmlEventHandler);\n return useCallback(function (event) {\n var _eventHandlerRef$curr;\n\n (_eventHandlerRef$curr = eventHandlerRef.current) === null || _eventHandlerRef$curr === void 0 ? void 0 : _eventHandlerRef$curr.call(eventHandlerRef, event);\n if (event.defaultPrevented) return;\n\n if (virtual && canProxyKeyboardEvent(event)) {\n var currentElement = currentItem === null || currentItem === void 0 ? void 0 : currentItem.ref.current;\n\n if (currentElement) {\n if (!fireKeyboardEvent(currentElement, event.type, event)) {\n event.preventDefault();\n } // The event will be triggered on the composite item and then\n // propagated up to this composite element again, so we can pretend\n // that it wasn't called on this component in the first place.\n\n\n if (event.currentTarget.contains(currentElement)) {\n event.stopPropagation();\n }\n }\n }\n }, [virtual, currentItem]);\n} // istanbul ignore next\n\n\nfunction useActiveElementRef(elementRef) {\n var activeElementRef = useRef(null);\n useEffect(function () {\n var document = getDocument(elementRef.current);\n\n var onFocus = function onFocus(event) {\n var target = event.target;\n activeElementRef.current = target;\n };\n\n document.addEventListener(\"focus\", onFocus, true);\n return function () {\n document.removeEventListener(\"focus\", onFocus, true);\n };\n }, []);\n return activeElementRef;\n}\n\nfunction findFirstEnabledItemInTheLastRow(items) {\n return findFirstEnabledItem(flatten(reverse(groupItems(items))));\n}\n\nfunction isItem(items, element) {\n return items === null || items === void 0 ? void 0 : items.some(function (item) {\n return !!element && item.ref.current === element;\n });\n}\n\nfunction useScheduleUserFocus(currentItem) {\n var currentItemRef = useLiveRef(currentItem);\n\n var _React$useReducer = useReducer(function (n) {\n return n + 1;\n }, 0),\n scheduled = _React$useReducer[0],\n schedule = _React$useReducer[1];\n\n useEffect(function () {\n var _currentItemRef$curre;\n\n var currentElement = (_currentItemRef$curre = currentItemRef.current) === null || _currentItemRef$curre === void 0 ? void 0 : _currentItemRef$curre.ref.current;\n\n if (scheduled && currentElement) {\n userFocus(currentElement);\n }\n }, [scheduled]);\n return schedule;\n}\n\nvar useComposite = createHook({\n name: \"Composite\",\n compose: [useTabbable],\n keys: COMPOSITE_KEYS,\n useOptions: function useOptions(options) {\n return _objectSpread2(_objectSpread2({}, options), {}, {\n currentId: getCurrentId(options)\n });\n },\n useProps: function useProps(options, _ref) {\n var htmlRef = _ref.ref,\n htmlOnFocusCapture = _ref.onFocusCapture,\n htmlOnFocus = _ref.onFocus,\n htmlOnBlurCapture = _ref.onBlurCapture,\n htmlOnKeyDown = _ref.onKeyDown,\n htmlOnKeyDownCapture = _ref.onKeyDownCapture,\n htmlOnKeyUpCapture = _ref.onKeyUpCapture,\n htmlProps = _objectWithoutPropertiesLoose(_ref, [\"ref\", \"onFocusCapture\", \"onFocus\", \"onBlurCapture\", \"onKeyDown\", \"onKeyDownCapture\", \"onKeyUpCapture\"]);\n\n var ref = useRef(null);\n var currentItem = findEnabledItemById(options.items, options.currentId);\n var previousElementRef = useRef(null);\n var onFocusCaptureRef = useLiveRef(htmlOnFocusCapture);\n var onFocusRef = useLiveRef(htmlOnFocus);\n var onBlurCaptureRef = useLiveRef(htmlOnBlurCapture);\n var onKeyDownRef = useLiveRef(htmlOnKeyDown);\n var scheduleUserFocus = useScheduleUserFocus(currentItem); // IE 11 doesn't support event.relatedTarget, so we use the active element\n // ref instead.\n\n var activeElementRef = isIE11 ? useActiveElementRef(ref) : undefined;\n useEffect(function () {\n var element = ref.current;\n\n if (options.unstable_moves && !currentItem) {\n process.env.NODE_ENV !== \"production\" ? warning(!element, \"Can't focus composite component because `ref` wasn't passed to component.\", \"See https://reakit.io/docs/composite\") : void 0; // If composite.move(null) has been called, the composite container\n // will receive focus.\n\n element === null || element === void 0 ? void 0 : element.focus();\n }\n }, [options.unstable_moves, currentItem]);\n var onKeyDownCapture = useKeyboardEventProxy(options.unstable_virtual, currentItem, htmlOnKeyDownCapture);\n var onKeyUpCapture = useKeyboardEventProxy(options.unstable_virtual, currentItem, htmlOnKeyUpCapture);\n var onFocusCapture = useCallback(function (event) {\n var _onFocusCaptureRef$cu;\n\n (_onFocusCaptureRef$cu = onFocusCaptureRef.current) === null || _onFocusCaptureRef$cu === void 0 ? void 0 : _onFocusCaptureRef$cu.call(onFocusCaptureRef, event);\n if (event.defaultPrevented) return;\n if (!options.unstable_virtual) return; // IE11 doesn't support event.relatedTarget, so we use the active\n // element ref instead.\n\n var previousActiveElement = (activeElementRef === null || activeElementRef === void 0 ? void 0 : activeElementRef.current) || event.relatedTarget;\n var previousActiveElementWasItem = isItem(options.items, previousActiveElement);\n\n if (isSelfTarget(event) && previousActiveElementWasItem) {\n // Composite has been focused as a result of an item receiving focus.\n // The composite item will move focus back to the composite\n // container. In this case, we don't want to propagate this\n // additional event nor call the onFocus handler passed to\n // .\n event.stopPropagation(); // We keep track of the previous active item element so we can\n // manually fire a blur event on it later when the focus is moved to\n // another item on the onBlurCapture event below.\n\n previousElementRef.current = previousActiveElement;\n }\n }, [options.unstable_virtual, options.items]);\n var onFocus = useCallback(function (event) {\n var _onFocusRef$current;\n\n (_onFocusRef$current = onFocusRef.current) === null || _onFocusRef$current === void 0 ? void 0 : _onFocusRef$current.call(onFocusRef, event);\n if (event.defaultPrevented) return;\n\n if (options.unstable_virtual) {\n if (isSelfTarget(event)) {\n // This means that the composite element has been focused while the\n // composite item has not. For example, by clicking on the\n // composite element without touching any item, or by tabbing into\n // the composite element. In this case, we want to trigger focus on\n // the item, just like it would happen with roving tabindex.\n // When it receives focus, the composite item will put focus back\n // on the composite element, in which case hasItemWithFocus will be\n // true.\n scheduleUserFocus();\n }\n } else if (isSelfTarget(event)) {\n var _options$setCurrentId;\n\n // When the roving tabindex composite gets intentionally focused (for\n // example, by clicking directly on it, and not on an item), we make\n // sure to set the current id to null (which means the composite\n // itself is focused).\n (_options$setCurrentId = options.setCurrentId) === null || _options$setCurrentId === void 0 ? void 0 : _options$setCurrentId.call(options, null);\n }\n }, [options.unstable_virtual, options.setCurrentId]);\n var onBlurCapture = useCallback(function (event) {\n var _onBlurCaptureRef$cur;\n\n (_onBlurCaptureRef$cur = onBlurCaptureRef.current) === null || _onBlurCaptureRef$cur === void 0 ? void 0 : _onBlurCaptureRef$cur.call(onBlurCaptureRef, event);\n if (event.defaultPrevented) return;\n if (!options.unstable_virtual) return; // When virtual is set to true, we move focus from the composite\n // container (this component) to the composite item that is being\n // selected. Then we move focus back to the composite container. This\n // is so we can provide the same API as the roving tabindex method,\n // which means people can attach onFocus/onBlur handlers on the\n // CompositeItem component regardless of whether it's virtual or not.\n // This sequence of blurring and focusing items and composite may be\n // confusing, so we ignore intermediate focus and blurs by stopping its\n // propagation and not calling the passed onBlur handler (htmlOnBlur).\n\n var currentElement = (currentItem === null || currentItem === void 0 ? void 0 : currentItem.ref.current) || null;\n var nextActiveElement = getNextActiveElementOnBlur(event);\n var nextActiveElementIsItem = isItem(options.items, nextActiveElement);\n\n if (isSelfTarget(event) && nextActiveElementIsItem) {\n // This is an intermediate blur event: blurring the composite\n // container to focus an item (nextActiveElement).\n if (nextActiveElement === currentElement) {\n // The next active element will be the same as the current item in\n // the state in two scenarios:\n // - Moving focus with keyboard: the state is updated before the\n // blur event is triggered, so here the current item is already\n // pointing to the next active element.\n // - Clicking on the current active item with a pointer: this\n // will trigger blur on the composite element and then the next\n // active element will be the same as the current item. Clicking on\n // an item other than the current one doesn't end up here as the\n // currentItem state will be updated only after it.\n if (previousElementRef.current && previousElementRef.current !== nextActiveElement) {\n // If there's a previous active item and it's not a click action,\n // then we fire a blur event on it so it will work just like if\n // it had DOM focus before (like when using roving tabindex).\n fireBlurEvent(previousElementRef.current, event);\n }\n } else if (currentElement) {\n // This will be true when the next active element is not the\n // current element, but there's a current item. This will only\n // happen when clicking with a pointer on a different item, when\n // there's already an item selected, in which case currentElement\n // is the item that is getting blurred, and nextActiveElement is\n // the item that is being clicked.\n fireBlurEvent(currentElement, event);\n } // We want to ignore intermediate blur events, so we stop its\n // propagation and return early so onFocus will not be called.\n\n\n event.stopPropagation();\n } else {\n var targetIsItem = isItem(options.items, event.target);\n\n if (!targetIsItem && currentElement) {\n // If target is not a composite item, it may be the composite\n // element itself (isSelfTarget) or a tabbable element inside the\n // composite widget. This may be triggered by clicking outside the\n // composite widget or by tabbing out of it. In either cases we\n // want to fire a blur event on the current item.\n fireBlurEvent(currentElement, event);\n }\n }\n }, [options.unstable_virtual, options.items, currentItem]);\n var onKeyDown = useCallback(function (event) {\n var _onKeyDownRef$current, _options$groups;\n\n (_onKeyDownRef$current = onKeyDownRef.current) === null || _onKeyDownRef$current === void 0 ? void 0 : _onKeyDownRef$current.call(onKeyDownRef, event);\n if (event.defaultPrevented) return;\n if (options.currentId !== null) return;\n if (!isSelfTarget(event)) return;\n var isVertical = options.orientation !== \"horizontal\";\n var isHorizontal = options.orientation !== \"vertical\";\n var isGrid = !!((_options$groups = options.groups) !== null && _options$groups !== void 0 && _options$groups.length);\n\n var up = function up() {\n if (isGrid) {\n var item = findFirstEnabledItemInTheLastRow(options.items);\n\n if (item !== null && item !== void 0 && item.id) {\n var _options$move;\n\n (_options$move = options.move) === null || _options$move === void 0 ? void 0 : _options$move.call(options, item.id);\n }\n } else {\n var _options$last;\n\n (_options$last = options.last) === null || _options$last === void 0 ? void 0 : _options$last.call(options);\n }\n };\n\n var keyMap = {\n ArrowUp: (isGrid || isVertical) && up,\n ArrowRight: (isGrid || isHorizontal) && options.first,\n ArrowDown: (isGrid || isVertical) && options.first,\n ArrowLeft: (isGrid || isHorizontal) && options.last,\n Home: options.first,\n End: options.last,\n PageUp: options.first,\n PageDown: options.last\n };\n var action = keyMap[event.key];\n\n if (action) {\n event.preventDefault();\n action();\n }\n }, [options.currentId, options.orientation, options.groups, options.items, options.move, options.last, options.first]);\n return _objectSpread2({\n ref: useForkRef(ref, htmlRef),\n id: options.baseId,\n onFocus: onFocus,\n onFocusCapture: onFocusCapture,\n onBlurCapture: onBlurCapture,\n onKeyDownCapture: onKeyDownCapture,\n onKeyDown: onKeyDown,\n onKeyUpCapture: onKeyUpCapture,\n \"aria-activedescendant\": options.unstable_virtual ? (currentItem === null || currentItem === void 0 ? void 0 : currentItem.id) || undefined : undefined\n }, htmlProps);\n },\n useComposeProps: function useComposeProps(options, htmlProps) {\n htmlProps = useRole(options, htmlProps, true);\n var tabbableHTMLProps = useTabbable(options, htmlProps, true);\n\n if (options.unstable_virtual || options.currentId === null) {\n // Composite will only be tabbable by default if the focus is managed\n // using aria-activedescendant, which requires DOM focus on the container\n // element (the composite)\n return _objectSpread2({\n tabIndex: 0\n }, tabbableHTMLProps);\n }\n\n return _objectSpread2(_objectSpread2({}, htmlProps), {}, {\n ref: tabbableHTMLProps.ref\n });\n }\n});\nvar Composite = createComponent({\n as: \"div\",\n useHook: useComposite,\n useCreateElement: function useCreateElement$1(type, props, children) {\n process.env.NODE_ENV !== \"production\" ? useWarning(!props[\"aria-label\"] && !props[\"aria-labelledby\"], \"You should provide either `aria-label` or `aria-labelledby` props.\", \"See https://reakit.io/docs/composite\") : void 0;\n return useCreateElement(type, props, children);\n }\n});\n\nexport { Composite, useComposite };\n","/**\n * Check whether the given element is a text field, where text field is defined\n * by the ability to select within the input, or that it is contenteditable.\n *\n * @example\n * import { isTextField } from \"reakit-utils\";\n *\n * isTextField(document.querySelector(\"div\")); // false\n * isTextField(document.querySelector(\"input\")); // true\n * isTextField(document.querySelector(\"input[type='button']\")); // false\n * isTextField(document.querySelector(\"textarea\")); // true\n * isTextField(document.querySelector(\"div[contenteditable='true']\")); // true\n */\nfunction isTextField(element) {\n try {\n var isTextInput = element instanceof HTMLInputElement && element.selectionStart !== null;\n var isTextArea = element.tagName === \"TEXTAREA\";\n var isContentEditable = element.contentEditable === \"true\";\n return isTextInput || isTextArea || isContentEditable || false;\n } catch (error) {\n // Safari throws an exception when trying to get `selectionStart`\n // on non-text elements (which, understandably, don't\n // have the text selection API). We catch this via a try/catch\n // block, as opposed to a more explicit check of the element's\n // input types, because of Safari's non-standard behavior. This\n // also means we don't have to worry about the list of input\n // types that support `selectionStart` changing as the HTML spec\n // evolves over time.\n return false;\n }\n}\n\nexport { isTextField };\n","import { a as _objectSpread2 } from '../_rollupPluginBabelHelpers-1f0bf8c2.js';\nimport { createComponent } from 'reakit-system/createComponent';\nimport { createHook } from 'reakit-system/createHook';\nimport { useContext, useState, useMemo } from 'react';\nimport { unstable_IdContext } from './IdProvider.js';\n\n// Automatically generated\nvar ID_STATE_KEYS = [\"baseId\", \"unstable_idCountRef\", \"setBaseId\"];\nvar ID_KEYS = [].concat(ID_STATE_KEYS, [\"id\"]);\n\nvar unstable_useId = createHook({\n keys: ID_KEYS,\n useOptions: function useOptions(options, htmlProps) {\n var generateId = useContext(unstable_IdContext);\n\n var _React$useState = useState(function () {\n // This comes from useIdState\n if (options.unstable_idCountRef) {\n options.unstable_idCountRef.current += 1;\n return \"-\" + options.unstable_idCountRef.current;\n } // If there's no useIdState, we check if `baseId` was passed (as a prop,\n // not from useIdState).\n\n\n if (options.baseId) {\n return \"-\" + generateId(\"\");\n }\n\n return \"\";\n }),\n suffix = _React$useState[0]; // `baseId` will be the prop passed directly as a prop or via useIdState.\n // If there's neither, then it'll fallback to Context's generateId.\n // This generateId can result in a sequential ID (if there's a Provider)\n // or a random string (without Provider).\n\n\n var baseId = useMemo(function () {\n return options.baseId || generateId();\n }, [options.baseId, generateId]);\n var id = htmlProps.id || options.id || \"\" + baseId + suffix;\n return _objectSpread2(_objectSpread2({}, options), {}, {\n id: id\n });\n },\n useProps: function useProps(options, htmlProps) {\n return _objectSpread2({\n id: options.id\n }, htmlProps);\n }\n});\nvar unstable_Id = createComponent({\n as: \"div\",\n useHook: unstable_useId\n});\n\nexport { unstable_Id, unstable_useId };\n","import { fireEvent } from 'reakit-utils/fireEvent';\n\nfunction setTextFieldValue(element, value) {\n if (element instanceof HTMLInputElement || element instanceof HTMLTextAreaElement) {\n var _Object$getOwnPropert;\n\n var proto = Object.getPrototypeOf(element);\n var setValue = (_Object$getOwnPropert = Object.getOwnPropertyDescriptor(proto, \"value\")) === null || _Object$getOwnPropert === void 0 ? void 0 : _Object$getOwnPropert.set;\n\n if (setValue) {\n setValue.call(element, value);\n fireEvent(element, \"input\", {\n bubbles: true\n });\n }\n }\n}\n\nexport { setTextFieldValue as s };\n","import './getDocument.js';\nimport { createEvent } from './createEvent.js';\n\n/**\n * Creates and dispatches `Event` in a way that also works on IE 11.\n *\n * @example\n * import { fireEvent } from \"reakit-utils\";\n *\n * fireEvent(document.getElementById(\"id\"), \"blur\", {\n * bubbles: true,\n * cancelable: true,\n * });\n */\n\nfunction fireEvent(element, type, eventInit) {\n return element.dispatchEvent(createEvent(element, type, eventInit));\n}\n\nexport { fireEvent };\n","import { _ as _objectWithoutPropertiesLoose, a as _objectSpread2, b as _createForOfIteratorHelperLoose } from '../_rollupPluginBabelHelpers-1f0bf8c2.js';\nimport { createComponent } from 'reakit-system/createComponent';\nimport { createHook } from 'reakit-system/createHook';\nimport 'reakit-utils/shallowEqual';\nimport { useRef, useMemo, useEffect, useCallback } from 'react';\nimport { useForkRef } from 'reakit-utils/useForkRef';\nimport 'reakit-utils/isButton';\nimport { warning } from 'reakit-warning';\nimport { useLiveRef } from 'reakit-utils/useLiveRef';\nimport { isSelfTarget } from 'reakit-utils/isSelfTarget';\nimport 'reakit-utils/useIsomorphicEffect';\nimport { hasFocusWithin } from 'reakit-utils/hasFocusWithin';\nimport { isPortalEvent } from 'reakit-utils/isPortalEvent';\nimport 'reakit-utils/dom';\nimport 'reakit-utils/tabbable';\nimport '../Role/Role.js';\nimport '../Tabbable/Tabbable.js';\nimport { useClickable } from '../Clickable/Clickable.js';\nimport { getDocument } from 'reakit-utils/getDocument';\nimport { g as getCurrentId } from '../getCurrentId-5aa9849e.js';\nimport { b as COMPOSITE_ITEM_KEYS } from '../__keys-6742f591.js';\nimport { u as userFocus, s as setUserFocus, h as hasUserFocus } from '../userFocus-e16425e3.js';\nimport { isTextField } from 'reakit-utils/isTextField';\nimport { ensureFocus } from 'reakit-utils/ensureFocus';\nimport '../Id/IdProvider.js';\nimport { unstable_useId } from '../Id/Id.js';\nimport 'reakit-utils/fireEvent';\nimport { s as setTextFieldValue } from '../setTextFieldValue-0a221f4e.js';\n\nfunction getWidget(itemElement) {\n return itemElement.querySelector(\"[data-composite-item-widget]\");\n}\n\nfunction useItem(options) {\n return useMemo(function () {\n var _options$items;\n\n return (_options$items = options.items) === null || _options$items === void 0 ? void 0 : _options$items.find(function (item) {\n return options.id && item.id === options.id;\n });\n }, [options.items, options.id]);\n}\n\nfunction targetIsAnotherItem(event, items) {\n if (isSelfTarget(event)) return false;\n\n for (var _iterator = _createForOfIteratorHelperLoose(items), _step; !(_step = _iterator()).done;) {\n var item = _step.value;\n\n if (item.ref.current === event.target) {\n return true;\n }\n }\n\n return false;\n}\n\nvar useCompositeItem = createHook({\n name: \"CompositeItem\",\n compose: [useClickable, unstable_useId],\n keys: COMPOSITE_ITEM_KEYS,\n propsAreEqual: function propsAreEqual(prev, next) {\n if (!next.id || prev.id !== next.id) {\n return useClickable.unstable_propsAreEqual(prev, next);\n }\n\n var prevCurrentId = prev.currentId,\n prevMoves = prev.unstable_moves,\n prevProps = _objectWithoutPropertiesLoose(prev, [\"currentId\", \"unstable_moves\"]);\n\n var nextCurrentId = next.currentId,\n nextMoves = next.unstable_moves,\n nextProps = _objectWithoutPropertiesLoose(next, [\"currentId\", \"unstable_moves\"]);\n\n if (nextCurrentId !== prevCurrentId) {\n if (next.id === nextCurrentId || next.id === prevCurrentId) {\n return false;\n }\n } else if (prevMoves !== nextMoves) {\n return false;\n }\n\n return useClickable.unstable_propsAreEqual(prevProps, nextProps);\n },\n useOptions: function useOptions(options) {\n return _objectSpread2(_objectSpread2({}, options), {}, {\n id: options.id,\n currentId: getCurrentId(options),\n unstable_clickOnSpace: options.unstable_hasActiveWidget ? false : options.unstable_clickOnSpace\n });\n },\n useProps: function useProps(options, _ref) {\n var _options$items2;\n\n var htmlRef = _ref.ref,\n _ref$tabIndex = _ref.tabIndex,\n htmlTabIndex = _ref$tabIndex === void 0 ? 0 : _ref$tabIndex,\n htmlOnMouseDown = _ref.onMouseDown,\n htmlOnFocus = _ref.onFocus,\n htmlOnBlurCapture = _ref.onBlurCapture,\n htmlOnKeyDown = _ref.onKeyDown,\n htmlOnClick = _ref.onClick,\n htmlProps = _objectWithoutPropertiesLoose(_ref, [\"ref\", \"tabIndex\", \"onMouseDown\", \"onFocus\", \"onBlurCapture\", \"onKeyDown\", \"onClick\"]);\n\n var ref = useRef(null);\n var id = options.id;\n var trulyDisabled = options.disabled && !options.focusable;\n var isCurrentItem = options.currentId === id;\n var isCurrentItemRef = useLiveRef(isCurrentItem);\n var hasFocusedComposite = useRef(false);\n var item = useItem(options);\n var onMouseDownRef = useLiveRef(htmlOnMouseDown);\n var onFocusRef = useLiveRef(htmlOnFocus);\n var onBlurCaptureRef = useLiveRef(htmlOnBlurCapture);\n var onKeyDownRef = useLiveRef(htmlOnKeyDown);\n var onClickRef = useLiveRef(htmlOnClick);\n var shouldTabIndex = !options.unstable_virtual && !options.unstable_hasActiveWidget && isCurrentItem || // We don't want to set tabIndex=\"-1\" when using CompositeItem as a\n // standalone component, without state props.\n !((_options$items2 = options.items) !== null && _options$items2 !== void 0 && _options$items2.length);\n useEffect(function () {\n var _options$registerItem;\n\n if (!id) return undefined;\n (_options$registerItem = options.registerItem) === null || _options$registerItem === void 0 ? void 0 : _options$registerItem.call(options, {\n id: id,\n ref: ref,\n disabled: !!trulyDisabled\n });\n return function () {\n var _options$unregisterIt;\n\n (_options$unregisterIt = options.unregisterItem) === null || _options$unregisterIt === void 0 ? void 0 : _options$unregisterIt.call(options, id);\n };\n }, [id, trulyDisabled, options.registerItem, options.unregisterItem]);\n useEffect(function () {\n var element = ref.current;\n\n if (!element) {\n process.env.NODE_ENV !== \"production\" ? warning(true, \"Can't focus composite item component because `ref` wasn't passed to component.\", \"See https://reakit.io/docs/composite\") : void 0;\n return;\n } // `moves` will be incremented whenever next, previous, up, down, first,\n // last or move have been called. This means that the composite item will\n // be focused whenever some of these functions are called. We're using\n // isCurrentItemRef instead of isCurrentItem because we don't want to\n // focus the item if isCurrentItem changes (and options.moves doesn't).\n\n\n if (options.unstable_moves && isCurrentItemRef.current) {\n userFocus(element);\n }\n }, [options.unstable_moves]);\n var onMouseDown = useCallback(function (event) {\n var _onMouseDownRef$curre;\n\n (_onMouseDownRef$curre = onMouseDownRef.current) === null || _onMouseDownRef$curre === void 0 ? void 0 : _onMouseDownRef$curre.call(onMouseDownRef, event);\n setUserFocus(event.currentTarget, true);\n }, []);\n var onFocus = useCallback(function (event) {\n var _onFocusRef$current, _options$setCurrentId;\n\n var shouldFocusComposite = hasUserFocus(event.currentTarget);\n setUserFocus(event.currentTarget, false);\n (_onFocusRef$current = onFocusRef.current) === null || _onFocusRef$current === void 0 ? void 0 : _onFocusRef$current.call(onFocusRef, event);\n if (event.defaultPrevented) return;\n if (isPortalEvent(event)) return;\n if (!id) return;\n if (targetIsAnotherItem(event, options.items)) return;\n (_options$setCurrentId = options.setCurrentId) === null || _options$setCurrentId === void 0 ? void 0 : _options$setCurrentId.call(options, id); // When using aria-activedescendant, we want to make sure that the\n // composite container receives focus, not the composite item.\n // But we don't want to do this if the target is another focusable\n // element inside the composite item, such as CompositeItemWidget.\n\n if (shouldFocusComposite && options.unstable_virtual && options.baseId && isSelfTarget(event)) {\n var target = event.target;\n var composite = getDocument(target).getElementById(options.baseId);\n\n if (composite) {\n hasFocusedComposite.current = true;\n ensureFocus(composite);\n }\n }\n }, [id, options.items, options.setCurrentId, options.unstable_virtual, options.baseId]);\n var onBlurCapture = useCallback(function (event) {\n var _onBlurCaptureRef$cur;\n\n (_onBlurCaptureRef$cur = onBlurCaptureRef.current) === null || _onBlurCaptureRef$cur === void 0 ? void 0 : _onBlurCaptureRef$cur.call(onBlurCaptureRef, event);\n if (event.defaultPrevented) return;\n\n if (options.unstable_virtual && hasFocusedComposite.current) {\n // When hasFocusedComposite is true, composite has been focused right\n // after focusing this item. This is an intermediate blur event, so\n // we ignore it.\n hasFocusedComposite.current = false;\n event.preventDefault();\n event.stopPropagation();\n }\n }, [options.unstable_virtual]);\n var onKeyDown = useCallback(function (event) {\n var _onKeyDownRef$current;\n\n if (!isSelfTarget(event)) return;\n var isVertical = options.orientation !== \"horizontal\";\n var isHorizontal = options.orientation !== \"vertical\";\n var isGrid = !!(item !== null && item !== void 0 && item.groupId);\n var keyMap = {\n ArrowUp: (isGrid || isVertical) && options.up,\n ArrowRight: (isGrid || isHorizontal) && options.next,\n ArrowDown: (isGrid || isVertical) && options.down,\n ArrowLeft: (isGrid || isHorizontal) && options.previous,\n Home: function Home() {\n if (!isGrid || event.ctrlKey) {\n var _options$first;\n\n (_options$first = options.first) === null || _options$first === void 0 ? void 0 : _options$first.call(options);\n } else {\n var _options$previous;\n\n (_options$previous = options.previous) === null || _options$previous === void 0 ? void 0 : _options$previous.call(options, true);\n }\n },\n End: function End() {\n if (!isGrid || event.ctrlKey) {\n var _options$last;\n\n (_options$last = options.last) === null || _options$last === void 0 ? void 0 : _options$last.call(options);\n } else {\n var _options$next;\n\n (_options$next = options.next) === null || _options$next === void 0 ? void 0 : _options$next.call(options, true);\n }\n },\n PageUp: function PageUp() {\n if (isGrid) {\n var _options$up;\n\n (_options$up = options.up) === null || _options$up === void 0 ? void 0 : _options$up.call(options, true);\n } else {\n var _options$first2;\n\n (_options$first2 = options.first) === null || _options$first2 === void 0 ? void 0 : _options$first2.call(options);\n }\n },\n PageDown: function PageDown() {\n if (isGrid) {\n var _options$down;\n\n (_options$down = options.down) === null || _options$down === void 0 ? void 0 : _options$down.call(options, true);\n } else {\n var _options$last2;\n\n (_options$last2 = options.last) === null || _options$last2 === void 0 ? void 0 : _options$last2.call(options);\n }\n }\n };\n var action = keyMap[event.key];\n\n if (action) {\n event.preventDefault();\n action();\n return;\n }\n\n (_onKeyDownRef$current = onKeyDownRef.current) === null || _onKeyDownRef$current === void 0 ? void 0 : _onKeyDownRef$current.call(onKeyDownRef, event);\n if (event.defaultPrevented) return;\n\n if (event.key.length === 1 && event.key !== \" \") {\n var widget = getWidget(event.currentTarget);\n\n if (widget && isTextField(widget)) {\n widget.focus();\n setTextFieldValue(widget, \"\");\n }\n } else if (event.key === \"Delete\" || event.key === \"Backspace\") {\n var _widget = getWidget(event.currentTarget);\n\n if (_widget && isTextField(_widget)) {\n event.preventDefault();\n setTextFieldValue(_widget, \"\");\n }\n }\n }, [options.orientation, item, options.up, options.next, options.down, options.previous, options.first, options.last]);\n var onClick = useCallback(function (event) {\n var _onClickRef$current;\n\n (_onClickRef$current = onClickRef.current) === null || _onClickRef$current === void 0 ? void 0 : _onClickRef$current.call(onClickRef, event);\n if (event.defaultPrevented) return;\n var element = event.currentTarget;\n var widget = getWidget(element);\n\n if (widget && !hasFocusWithin(widget)) {\n // If there's a widget inside the composite item, we make sure it's\n // focused when pressing enter, space or clicking on the composite item.\n widget.focus();\n }\n }, []);\n return _objectSpread2({\n ref: useForkRef(ref, htmlRef),\n id: id,\n tabIndex: shouldTabIndex ? htmlTabIndex : -1,\n \"aria-selected\": options.unstable_virtual && isCurrentItem ? true : undefined,\n onMouseDown: onMouseDown,\n onFocus: onFocus,\n onBlurCapture: onBlurCapture,\n onKeyDown: onKeyDown,\n onClick: onClick\n }, htmlProps);\n }\n});\nvar CompositeItem = createComponent({\n as: \"button\",\n memo: true,\n useHook: useCompositeItem\n});\n\nexport { CompositeItem, useCompositeItem };\n","function isUpdater(argument) {\n return typeof argument === \"function\";\n}\n/**\n * Receives a `setState` argument and calls it with `currentValue` if it's a\n * function. Otherwise return the argument as the new value.\n *\n * @example\n * import { applyState } from \"reakit-utils\";\n *\n * applyState((value) => value + 1, 1); // 2\n * applyState(2, 1); // 2\n */\n\n\nfunction applyState(argument, currentValue) {\n if (isUpdater(argument)) {\n return argument(currentValue);\n }\n\n return argument;\n}\n\nexport { applyState };\n","import { b as _createForOfIteratorHelperLoose, a as _objectSpread2, _ as _objectWithoutPropertiesLoose } from '../_rollupPluginBabelHelpers-1f0bf8c2.js';\nimport { useRef, useEffect, useReducer, useState, useCallback } from 'react';\nimport { useIsomorphicEffect } from 'reakit-utils/useIsomorphicEffect';\nimport { useSealedState } from 'reakit-utils/useSealedState';\nimport { getDocument } from 'reakit-utils/getDocument';\nimport { g as groupItems, r as reverse, f as flatten } from '../reverse-30eaa122.js';\nimport { f as findFirstEnabledItem, g as getCurrentId } from '../getCurrentId-5aa9849e.js';\nimport { f as findEnabledItemById } from '../findEnabledItemById-8ddca752.js';\nimport '../Id/IdProvider.js';\nimport { applyState } from 'reakit-utils/applyState';\nimport { unstable_useIdState } from '../Id/IdState.js';\n\nfunction isElementPreceding(element1, element2) {\n return Boolean(element2.compareDocumentPosition(element1) & Node.DOCUMENT_POSITION_PRECEDING);\n}\n\nfunction findDOMIndex(items, item) {\n return items.findIndex(function (currentItem) {\n if (!currentItem.ref.current || !item.ref.current) {\n return false;\n }\n\n return isElementPreceding(item.ref.current, currentItem.ref.current);\n });\n}\n\nfunction getMaxLength(rows) {\n var maxLength = 0;\n\n for (var _iterator = _createForOfIteratorHelperLoose(rows), _step; !(_step = _iterator()).done;) {\n var length = _step.value.length;\n\n if (length > maxLength) {\n maxLength = length;\n }\n }\n\n return maxLength;\n}\n\n/**\n * Turns [row1, row1, row2, row2] into [row1, row2, row1, row2]\n */\n\nfunction verticalizeItems(items) {\n var groups = groupItems(items);\n var maxLength = getMaxLength(groups);\n var verticalized = [];\n\n for (var i = 0; i < maxLength; i += 1) {\n for (var _iterator = _createForOfIteratorHelperLoose(groups), _step; !(_step = _iterator()).done;) {\n var group = _step.value;\n\n if (group[i]) {\n verticalized.push(_objectSpread2(_objectSpread2({}, group[i]), {}, {\n // If there's no groupId, it means that it's not a grid composite,\n // but a single row instead. So, instead of verticalizing it, that\n // is, assigning a different groupId based on the column index, we\n // keep it undefined so they will be part of the same group.\n // It's useful when using up/down on one-dimensional composites.\n groupId: group[i].groupId ? \"\" + i : undefined\n }));\n }\n }\n }\n\n return verticalized;\n}\n\nfunction createEmptyItem(groupId) {\n return {\n id: \"__EMPTY_ITEM__\",\n disabled: true,\n ref: {\n current: null\n },\n groupId: groupId\n };\n}\n/**\n * Turns [[row1, row1], [row2]] into [[row1, row1], [row2, row2]]\n */\n\n\nfunction fillGroups(groups, currentId, shift) {\n var maxLength = getMaxLength(groups);\n\n for (var _iterator = _createForOfIteratorHelperLoose(groups), _step; !(_step = _iterator()).done;) {\n var group = _step.value;\n\n for (var i = 0; i < maxLength; i += 1) {\n var item = group[i];\n\n if (!item || shift && item.disabled) {\n var isFrist = i === 0;\n var previousItem = isFrist && shift ? findFirstEnabledItem(group) : group[i - 1];\n group[i] = previousItem && currentId !== (previousItem === null || previousItem === void 0 ? void 0 : previousItem.id) && shift ? previousItem : createEmptyItem(previousItem === null || previousItem === void 0 ? void 0 : previousItem.groupId);\n }\n }\n }\n\n return groups;\n}\n\nvar nullItem = {\n id: null,\n ref: {\n current: null\n }\n};\nfunction placeItemsAfter(items, id, shouldInsertNullItem) {\n var index = items.findIndex(function (item) {\n return item.id === id;\n });\n return [].concat(items.slice(index + 1), shouldInsertNullItem ? [nullItem] : [], items.slice(0, index));\n}\n\nfunction getItemsInGroup(items, groupId) {\n return items.filter(function (item) {\n return item.groupId === groupId;\n });\n}\n\nvar map = {\n horizontal: \"vertical\",\n vertical: \"horizontal\"\n};\nfunction getOppositeOrientation(orientation) {\n return orientation && map[orientation];\n}\n\nfunction addItemAtIndex(array, item, index) {\n if (!(index in array)) {\n return [].concat(array, [item]);\n }\n\n return [].concat(array.slice(0, index), [item], array.slice(index));\n}\n\nfunction sortBasedOnDOMPosition(items) {\n var pairs = items.map(function (item, index) {\n return [index, item];\n });\n var isOrderDifferent = false;\n pairs.sort(function (_ref, _ref2) {\n var indexA = _ref[0],\n a = _ref[1];\n var indexB = _ref2[0],\n b = _ref2[1];\n var elementA = a.ref.current;\n var elementB = b.ref.current;\n if (!elementA || !elementB) return 0; // a before b\n\n if (isElementPreceding(elementA, elementB)) {\n if (indexA > indexB) {\n isOrderDifferent = true;\n }\n\n return -1;\n } // a after b\n\n\n if (indexA < indexB) {\n isOrderDifferent = true;\n }\n\n return 1;\n });\n\n if (isOrderDifferent) {\n return pairs.map(function (_ref3) {\n var _ = _ref3[0],\n item = _ref3[1];\n return item;\n });\n }\n\n return items;\n}\n\nfunction setItemsBasedOnDOMPosition(items, setItems) {\n var sortedItems = sortBasedOnDOMPosition(items);\n\n if (items !== sortedItems) {\n setItems(sortedItems);\n }\n}\n\nfunction getCommonParent(items) {\n var _firstItem$ref$curren;\n\n var firstItem = items[0],\n nextItems = items.slice(1);\n var parentElement = firstItem === null || firstItem === void 0 ? void 0 : (_firstItem$ref$curren = firstItem.ref.current) === null || _firstItem$ref$curren === void 0 ? void 0 : _firstItem$ref$curren.parentElement;\n\n var _loop = function _loop() {\n var parent = parentElement;\n\n if (nextItems.every(function (item) {\n return parent.contains(item.ref.current);\n })) {\n return {\n v: parentElement\n };\n }\n\n parentElement = parentElement.parentElement;\n };\n\n while (parentElement) {\n var _ret = _loop();\n\n if (typeof _ret === \"object\") return _ret.v;\n }\n\n return getDocument(parentElement).body;\n} // istanbul ignore next: JSDOM doesn't support IntersectionObverser\n// See https://github.com/jsdom/jsdom/issues/2032\n\n\nfunction useIntersectionObserver(items, setItems) {\n var previousItems = useRef([]);\n useEffect(function () {\n var callback = function callback() {\n var hasPreviousItems = !!previousItems.current.length; // We don't want to sort items if items have been just registered.\n\n if (hasPreviousItems) {\n setItemsBasedOnDOMPosition(items, setItems);\n }\n\n previousItems.current = items;\n };\n\n var root = getCommonParent(items);\n var observer = new IntersectionObserver(callback, {\n root: root\n });\n\n for (var _iterator = _createForOfIteratorHelperLoose(items), _step; !(_step = _iterator()).done;) {\n var item = _step.value;\n\n if (item.ref.current) {\n observer.observe(item.ref.current);\n }\n }\n\n return function () {\n observer.disconnect();\n };\n }, [items]);\n}\n\nfunction useTimeoutObserver(items, setItems) {\n useEffect(function () {\n var callback = function callback() {\n return setItemsBasedOnDOMPosition(items, setItems);\n };\n\n var timeout = setTimeout(callback, 250);\n return function () {\n return clearTimeout(timeout);\n };\n });\n}\n\nfunction useSortBasedOnDOMPosition(items, setItems) {\n if (typeof IntersectionObserver === \"function\") {\n useIntersectionObserver(items, setItems);\n } else {\n useTimeoutObserver(items, setItems);\n }\n}\n\nfunction reducer(state, action) {\n var virtual = state.unstable_virtual,\n rtl = state.rtl,\n orientation = state.orientation,\n items = state.items,\n groups = state.groups,\n currentId = state.currentId,\n loop = state.loop,\n wrap = state.wrap,\n pastIds = state.pastIds,\n shift = state.shift,\n moves = state.unstable_moves,\n includesBaseElement = state.unstable_includesBaseElement,\n initialVirtual = state.initialVirtual,\n initialRTL = state.initialRTL,\n initialOrientation = state.initialOrientation,\n initialCurrentId = state.initialCurrentId,\n initialLoop = state.initialLoop,\n initialWrap = state.initialWrap,\n initialShift = state.initialShift,\n hasSetCurrentId = state.hasSetCurrentId;\n\n switch (action.type) {\n case \"registerGroup\":\n {\n var _group = action.group; // If there are no groups yet, just add it as the first one\n\n if (groups.length === 0) {\n return _objectSpread2(_objectSpread2({}, state), {}, {\n groups: [_group]\n });\n } // Finds the group index based on DOM position\n\n\n var index = findDOMIndex(groups, _group);\n return _objectSpread2(_objectSpread2({}, state), {}, {\n groups: addItemAtIndex(groups, _group, index)\n });\n }\n\n case \"unregisterGroup\":\n {\n var _id = action.id;\n var nextGroups = groups.filter(function (group) {\n return group.id !== _id;\n }); // The group isn't registered, so do nothing\n\n if (nextGroups.length === groups.length) {\n return state;\n }\n\n return _objectSpread2(_objectSpread2({}, state), {}, {\n groups: nextGroups\n });\n }\n\n case \"registerItem\":\n {\n var _item = action.item; // Finds the item group based on the DOM hierarchy\n\n var _group2 = groups.find(function (r) {\n var _r$ref$current;\n\n return (_r$ref$current = r.ref.current) === null || _r$ref$current === void 0 ? void 0 : _r$ref$current.contains(_item.ref.current);\n }); // Group will be null if it's a one-dimensional composite\n\n\n var nextItem = _objectSpread2({\n groupId: _group2 === null || _group2 === void 0 ? void 0 : _group2.id\n }, _item);\n\n var _index = findDOMIndex(items, nextItem);\n\n var nextState = _objectSpread2(_objectSpread2({}, state), {}, {\n items: addItemAtIndex(items, nextItem, _index)\n });\n\n if (!hasSetCurrentId && !moves && initialCurrentId === undefined) {\n var _findFirstEnabledItem;\n\n // Sets currentId to the first enabled item. This runs whenever an item\n // is registered because the first enabled item may be registered\n // asynchronously.\n return _objectSpread2(_objectSpread2({}, nextState), {}, {\n currentId: (_findFirstEnabledItem = findFirstEnabledItem(nextState.items)) === null || _findFirstEnabledItem === void 0 ? void 0 : _findFirstEnabledItem.id\n });\n }\n\n return nextState;\n }\n\n case \"unregisterItem\":\n {\n var _id2 = action.id;\n var nextItems = items.filter(function (item) {\n return item.id !== _id2;\n }); // The item isn't registered, so do nothing\n\n if (nextItems.length === items.length) {\n return state;\n } // Filters out the item that is being removed from the pastIds list\n\n\n var nextPastIds = pastIds.filter(function (pastId) {\n return pastId !== _id2;\n });\n\n var _nextState = _objectSpread2(_objectSpread2({}, state), {}, {\n pastIds: nextPastIds,\n items: nextItems\n }); // If the current item is the item that is being removed, focus pastId\n\n\n if (currentId && currentId === _id2) {\n var nextId = includesBaseElement ? null : getCurrentId(_objectSpread2(_objectSpread2({}, _nextState), {}, {\n currentId: nextPastIds[0]\n }));\n return _objectSpread2(_objectSpread2({}, _nextState), {}, {\n currentId: nextId\n });\n }\n\n return _nextState;\n }\n\n case \"move\":\n {\n var _id3 = action.id; // move() does nothing\n\n if (_id3 === undefined) {\n return state;\n } // Removes the current item and the item that is receiving focus from the\n // pastIds list\n\n\n var filteredPastIds = pastIds.filter(function (pastId) {\n return pastId !== currentId && pastId !== _id3;\n }); // If there's a currentId, add it to the pastIds list so it can be focused\n // if the new item gets removed or disabled\n\n var _nextPastIds = currentId ? [currentId].concat(filteredPastIds) : filteredPastIds;\n\n var _nextState2 = _objectSpread2(_objectSpread2({}, state), {}, {\n pastIds: _nextPastIds\n }); // move(null) will focus the composite element itself, not an item\n\n\n if (_id3 === null) {\n return _objectSpread2(_objectSpread2({}, _nextState2), {}, {\n unstable_moves: moves + 1,\n currentId: getCurrentId(_nextState2, _id3)\n });\n }\n\n var _item2 = findEnabledItemById(items, _id3);\n\n return _objectSpread2(_objectSpread2({}, _nextState2), {}, {\n unstable_moves: _item2 ? moves + 1 : moves,\n currentId: getCurrentId(_nextState2, _item2 === null || _item2 === void 0 ? void 0 : _item2.id)\n });\n }\n\n case \"next\":\n {\n // If there's no item focused, we just move the first one\n if (currentId == null) {\n return reducer(state, _objectSpread2(_objectSpread2({}, action), {}, {\n type: \"first\"\n }));\n } // RTL doesn't make sense on vertical navigation\n\n\n var isHorizontal = orientation !== \"vertical\";\n var isRTL = rtl && isHorizontal;\n var allItems = isRTL ? reverse(items) : items;\n var currentItem = allItems.find(function (item) {\n return item.id === currentId;\n }); // If there's no item focused, we just move the first one\n\n if (!currentItem) {\n return reducer(state, _objectSpread2(_objectSpread2({}, action), {}, {\n type: \"first\"\n }));\n }\n\n var isGrid = !!currentItem.groupId;\n var currentIndex = allItems.indexOf(currentItem);\n\n var _nextItems = allItems.slice(currentIndex + 1);\n\n var nextItemsInGroup = getItemsInGroup(_nextItems, currentItem.groupId); // Home, End\n\n if (action.allTheWay) {\n // We reverse so we can get the last enabled item in the group. If it's\n // RTL, nextItems and nextItemsInGroup are already reversed and don't\n // have the items before the current one anymore. So we have to get\n // items in group again with allItems.\n var _nextItem2 = findFirstEnabledItem(isRTL ? getItemsInGroup(allItems, currentItem.groupId) : reverse(nextItemsInGroup));\n\n return reducer(state, _objectSpread2(_objectSpread2({}, action), {}, {\n type: \"move\",\n id: _nextItem2 === null || _nextItem2 === void 0 ? void 0 : _nextItem2.id\n }));\n }\n\n var oppositeOrientation = getOppositeOrientation( // If it's a grid and orientation is not set, it's a next/previous\n // call, which is inherently horizontal. up/down will call next with\n // orientation set to vertical by default (see below on up/down cases).\n isGrid ? orientation || \"horizontal\" : orientation);\n var canLoop = loop && loop !== oppositeOrientation;\n var canWrap = isGrid && wrap && wrap !== oppositeOrientation;\n var hasNullItem = // `previous` and `up` will set action.hasNullItem, but when calling\n // next directly, hasNullItem will only be true if it's not a grid and\n // loop is set to true, which means that pressing right or down keys on\n // grids will never focus the composite element. On one-dimensional\n // composites that don't loop, pressing right or down keys also doesn't\n // focus the composite element.\n action.hasNullItem || !isGrid && canLoop && includesBaseElement;\n\n if (canLoop) {\n var loopItems = canWrap && !hasNullItem ? allItems : getItemsInGroup(allItems, currentItem.groupId); // Turns [0, 1, current, 3, 4] into [3, 4, 0, 1]\n\n var sortedItems = placeItemsAfter(loopItems, currentId, hasNullItem);\n\n var _nextItem3 = findFirstEnabledItem(sortedItems, currentId);\n\n return reducer(state, _objectSpread2(_objectSpread2({}, action), {}, {\n type: \"move\",\n id: _nextItem3 === null || _nextItem3 === void 0 ? void 0 : _nextItem3.id\n }));\n }\n\n if (canWrap) {\n var _nextItem4 = findFirstEnabledItem( // We can use nextItems, which contains all the next items, including\n // items from other groups, to wrap between groups. However, if there\n // is a null item (the composite element), we'll only use the next\n // items in the group. So moving next from the last item will focus\n // the composite element (null). On grid composites, horizontal\n // navigation never focuses the composite element, only vertical.\n hasNullItem ? nextItemsInGroup : _nextItems, currentId);\n\n var _nextId = hasNullItem ? (_nextItem4 === null || _nextItem4 === void 0 ? void 0 : _nextItem4.id) || null : _nextItem4 === null || _nextItem4 === void 0 ? void 0 : _nextItem4.id;\n\n return reducer(state, _objectSpread2(_objectSpread2({}, action), {}, {\n type: \"move\",\n id: _nextId\n }));\n }\n\n var _nextItem = findFirstEnabledItem(nextItemsInGroup, currentId);\n\n if (!_nextItem && hasNullItem) {\n return reducer(state, _objectSpread2(_objectSpread2({}, action), {}, {\n type: \"move\",\n id: null\n }));\n }\n\n return reducer(state, _objectSpread2(_objectSpread2({}, action), {}, {\n type: \"move\",\n id: _nextItem === null || _nextItem === void 0 ? void 0 : _nextItem.id\n }));\n }\n\n case \"previous\":\n {\n // If currentId is initially set to null, the composite element will be\n // focusable while navigating with arrow keys. But, if it's a grid, we\n // don't want to focus the composite element with horizontal navigation.\n var _isGrid = !!groups.length;\n\n var _hasNullItem = !_isGrid && includesBaseElement;\n\n var _nextState3 = reducer(_objectSpread2(_objectSpread2({}, state), {}, {\n items: reverse(items)\n }), _objectSpread2(_objectSpread2({}, action), {}, {\n type: \"next\",\n hasNullItem: _hasNullItem\n }));\n\n return _objectSpread2(_objectSpread2({}, _nextState3), {}, {\n items: items\n });\n }\n\n case \"down\":\n {\n var shouldShift = shift && !action.allTheWay; // First, we make sure groups have the same number of items by filling it\n // with disabled fake items. Then, we reorganize the items list so\n // [1-1, 1-2, 2-1, 2-2] becomes [1-1, 2-1, 1-2, 2-2].\n\n var verticalItems = verticalizeItems(flatten(fillGroups(groupItems(items), currentId, shouldShift)));\n\n var _canLoop = loop && loop !== \"horizontal\"; // Pressing down arrow key will only focus the composite element if loop\n // is true or vertical.\n\n\n var _hasNullItem2 = _canLoop && includesBaseElement;\n\n var _nextState4 = reducer(_objectSpread2(_objectSpread2({}, state), {}, {\n orientation: \"vertical\",\n items: verticalItems\n }), _objectSpread2(_objectSpread2({}, action), {}, {\n type: \"next\",\n hasNullItem: _hasNullItem2\n }));\n\n return _objectSpread2(_objectSpread2({}, _nextState4), {}, {\n orientation: orientation,\n items: items\n });\n }\n\n case \"up\":\n {\n var _shouldShift = shift && !action.allTheWay;\n\n var _verticalItems = verticalizeItems(reverse(flatten(fillGroups(groupItems(items), currentId, _shouldShift)))); // If currentId is initially set to null, we'll always focus the\n // composite element when the up arrow key is pressed in the first row.\n\n\n var _hasNullItem3 = includesBaseElement;\n\n var _nextState5 = reducer(_objectSpread2(_objectSpread2({}, state), {}, {\n orientation: \"vertical\",\n items: _verticalItems\n }), _objectSpread2(_objectSpread2({}, action), {}, {\n type: \"next\",\n hasNullItem: _hasNullItem3\n }));\n\n return _objectSpread2(_objectSpread2({}, _nextState5), {}, {\n orientation: orientation,\n items: items\n });\n }\n\n case \"first\":\n {\n var firstItem = findFirstEnabledItem(items);\n return reducer(state, _objectSpread2(_objectSpread2({}, action), {}, {\n type: \"move\",\n id: firstItem === null || firstItem === void 0 ? void 0 : firstItem.id\n }));\n }\n\n case \"last\":\n {\n var _nextState6 = reducer(_objectSpread2(_objectSpread2({}, state), {}, {\n items: reverse(items)\n }), _objectSpread2(_objectSpread2({}, action), {}, {\n type: \"first\"\n }));\n\n return _objectSpread2(_objectSpread2({}, _nextState6), {}, {\n items: items\n });\n }\n\n case \"sort\":\n {\n return _objectSpread2(_objectSpread2({}, state), {}, {\n items: sortBasedOnDOMPosition(items),\n groups: sortBasedOnDOMPosition(groups)\n });\n }\n\n case \"setVirtual\":\n return _objectSpread2(_objectSpread2({}, state), {}, {\n unstable_virtual: applyState(action.virtual, virtual)\n });\n\n case \"setRTL\":\n return _objectSpread2(_objectSpread2({}, state), {}, {\n rtl: applyState(action.rtl, rtl)\n });\n\n case \"setOrientation\":\n return _objectSpread2(_objectSpread2({}, state), {}, {\n orientation: applyState(action.orientation, orientation)\n });\n\n case \"setCurrentId\":\n {\n var nextCurrentId = getCurrentId(_objectSpread2(_objectSpread2({}, state), {}, {\n currentId: applyState(action.currentId, currentId)\n }));\n return _objectSpread2(_objectSpread2({}, state), {}, {\n currentId: nextCurrentId,\n hasSetCurrentId: true\n });\n }\n\n case \"setLoop\":\n return _objectSpread2(_objectSpread2({}, state), {}, {\n loop: applyState(action.loop, loop)\n });\n\n case \"setWrap\":\n return _objectSpread2(_objectSpread2({}, state), {}, {\n wrap: applyState(action.wrap, wrap)\n });\n\n case \"setShift\":\n return _objectSpread2(_objectSpread2({}, state), {}, {\n shift: applyState(action.shift, shift)\n });\n\n case \"setIncludesBaseElement\":\n {\n return _objectSpread2(_objectSpread2({}, state), {}, {\n unstable_includesBaseElement: applyState(action.includesBaseElement, includesBaseElement)\n });\n }\n\n case \"reset\":\n return _objectSpread2(_objectSpread2({}, state), {}, {\n unstable_virtual: initialVirtual,\n rtl: initialRTL,\n orientation: initialOrientation,\n currentId: getCurrentId(_objectSpread2(_objectSpread2({}, state), {}, {\n currentId: initialCurrentId\n })),\n loop: initialLoop,\n wrap: initialWrap,\n shift: initialShift,\n unstable_moves: 0,\n pastIds: []\n });\n\n case \"setItems\":\n {\n return _objectSpread2(_objectSpread2({}, state), {}, {\n items: action.items\n });\n }\n\n default:\n throw new Error();\n }\n}\n\nfunction useAction(fn) {\n return useCallback(fn, []);\n}\n\nfunction useIsUnmountedRef() {\n var isUnmountedRef = useRef(false);\n useIsomorphicEffect(function () {\n return function () {\n isUnmountedRef.current = true;\n };\n }, []);\n return isUnmountedRef;\n}\n\nfunction useCompositeState(initialState) {\n if (initialState === void 0) {\n initialState = {};\n }\n\n var _useSealedState = useSealedState(initialState),\n _useSealedState$unsta = _useSealedState.unstable_virtual,\n virtual = _useSealedState$unsta === void 0 ? false : _useSealedState$unsta,\n _useSealedState$rtl = _useSealedState.rtl,\n rtl = _useSealedState$rtl === void 0 ? false : _useSealedState$rtl,\n orientation = _useSealedState.orientation,\n currentId = _useSealedState.currentId,\n _useSealedState$loop = _useSealedState.loop,\n loop = _useSealedState$loop === void 0 ? false : _useSealedState$loop,\n _useSealedState$wrap = _useSealedState.wrap,\n wrap = _useSealedState$wrap === void 0 ? false : _useSealedState$wrap,\n _useSealedState$shift = _useSealedState.shift,\n shift = _useSealedState$shift === void 0 ? false : _useSealedState$shift,\n unstable_includesBaseElement = _useSealedState.unstable_includesBaseElement,\n sealed = _objectWithoutPropertiesLoose(_useSealedState, [\"unstable_virtual\", \"rtl\", \"orientation\", \"currentId\", \"loop\", \"wrap\", \"shift\", \"unstable_includesBaseElement\"]);\n\n var idState = unstable_useIdState(sealed);\n\n var _React$useReducer = useReducer(reducer, {\n unstable_virtual: virtual,\n rtl: rtl,\n orientation: orientation,\n items: [],\n groups: [],\n currentId: currentId,\n loop: loop,\n wrap: wrap,\n shift: shift,\n unstable_moves: 0,\n pastIds: [],\n unstable_includesBaseElement: unstable_includesBaseElement != null ? unstable_includesBaseElement : currentId === null,\n initialVirtual: virtual,\n initialRTL: rtl,\n initialOrientation: orientation,\n initialCurrentId: currentId,\n initialLoop: loop,\n initialWrap: wrap,\n initialShift: shift\n }),\n _React$useReducer$ = _React$useReducer[0],\n pastIds = _React$useReducer$.pastIds,\n initialVirtual = _React$useReducer$.initialVirtual,\n initialRTL = _React$useReducer$.initialRTL,\n initialOrientation = _React$useReducer$.initialOrientation,\n initialCurrentId = _React$useReducer$.initialCurrentId,\n initialLoop = _React$useReducer$.initialLoop,\n initialWrap = _React$useReducer$.initialWrap,\n initialShift = _React$useReducer$.initialShift,\n hasSetCurrentId = _React$useReducer$.hasSetCurrentId,\n state = _objectWithoutPropertiesLoose(_React$useReducer$, [\"pastIds\", \"initialVirtual\", \"initialRTL\", \"initialOrientation\", \"initialCurrentId\", \"initialLoop\", \"initialWrap\", \"initialShift\", \"hasSetCurrentId\"]),\n dispatch = _React$useReducer[1];\n\n var _React$useState = useState(false),\n hasActiveWidget = _React$useState[0],\n setHasActiveWidget = _React$useState[1]; // register/unregister may be called when this component is unmounted. We\n // store the unmounted state here so we don't update the state if it's true.\n // This only happens in a very specific situation.\n // See https://github.com/reakit/reakit/issues/650\n\n\n var isUnmountedRef = useIsUnmountedRef();\n var setItems = useCallback(function (items) {\n return dispatch({\n type: \"setItems\",\n items: items\n });\n }, []);\n useSortBasedOnDOMPosition(state.items, setItems);\n return _objectSpread2(_objectSpread2(_objectSpread2({}, idState), state), {}, {\n unstable_hasActiveWidget: hasActiveWidget,\n unstable_setHasActiveWidget: setHasActiveWidget,\n registerItem: useAction(function (item) {\n if (isUnmountedRef.current) return;\n dispatch({\n type: \"registerItem\",\n item: item\n });\n }),\n unregisterItem: useAction(function (id) {\n if (isUnmountedRef.current) return;\n dispatch({\n type: \"unregisterItem\",\n id: id\n });\n }),\n registerGroup: useAction(function (group) {\n if (isUnmountedRef.current) return;\n dispatch({\n type: \"registerGroup\",\n group: group\n });\n }),\n unregisterGroup: useAction(function (id) {\n if (isUnmountedRef.current) return;\n dispatch({\n type: \"unregisterGroup\",\n id: id\n });\n }),\n move: useAction(function (id) {\n return dispatch({\n type: \"move\",\n id: id\n });\n }),\n next: useAction(function (allTheWay) {\n return dispatch({\n type: \"next\",\n allTheWay: allTheWay\n });\n }),\n previous: useAction(function (allTheWay) {\n return dispatch({\n type: \"previous\",\n allTheWay: allTheWay\n });\n }),\n up: useAction(function (allTheWay) {\n return dispatch({\n type: \"up\",\n allTheWay: allTheWay\n });\n }),\n down: useAction(function (allTheWay) {\n return dispatch({\n type: \"down\",\n allTheWay: allTheWay\n });\n }),\n first: useAction(function () {\n return dispatch({\n type: \"first\"\n });\n }),\n last: useAction(function () {\n return dispatch({\n type: \"last\"\n });\n }),\n sort: useAction(function () {\n return dispatch({\n type: \"sort\"\n });\n }),\n unstable_setVirtual: useAction(function (value) {\n return dispatch({\n type: \"setVirtual\",\n virtual: value\n });\n }),\n setRTL: useAction(function (value) {\n return dispatch({\n type: \"setRTL\",\n rtl: value\n });\n }),\n setOrientation: useAction(function (value) {\n return dispatch({\n type: \"setOrientation\",\n orientation: value\n });\n }),\n setCurrentId: useAction(function (value) {\n return dispatch({\n type: \"setCurrentId\",\n currentId: value\n });\n }),\n setLoop: useAction(function (value) {\n return dispatch({\n type: \"setLoop\",\n loop: value\n });\n }),\n setWrap: useAction(function (value) {\n return dispatch({\n type: \"setWrap\",\n wrap: value\n });\n }),\n setShift: useAction(function (value) {\n return dispatch({\n type: \"setShift\",\n shift: value\n });\n }),\n unstable_setIncludesBaseElement: useAction(function (value) {\n return dispatch({\n type: \"setIncludesBaseElement\",\n includesBaseElement: value\n });\n }),\n reset: useAction(function () {\n return dispatch({\n type: \"reset\"\n });\n })\n });\n}\n\nexport { useCompositeState };\n","import { createContext, useContext, useState, useCallback, useEffect, useMemo, createElement } from 'react';\nimport { removeItemFromArray } from 'reakit-utils/removeItemFromArray';\n\nvar MenuContext = /*#__PURE__*/createContext(null);\nfunction useMenuContext(menuRef, role, options) {\n var orphan = \"unstable_orphan\" in options && options.unstable_orphan;\n var parent = useContext(MenuContext);\n\n var _React$useState = useState([]),\n children = _React$useState[0],\n setChildren = _React$useState[1];\n\n var _ref = parent || {},\n addChildToParent = _ref.addChild,\n removeChildFromParent = _ref.removeChild;\n\n var addChild = useCallback(function (ref) {\n return setChildren(function (refs) {\n return [].concat(refs, [ref]);\n });\n }, []);\n var removeChild = useCallback(function (ref) {\n return setChildren(function (refs) {\n return removeItemFromArray(refs, ref);\n });\n }, []); // If it's a nested menu, add it to parent\n\n useEffect(function () {\n if (!addChildToParent || orphan) return undefined;\n addChildToParent(menuRef);\n return function () {\n removeChildFromParent === null || removeChildFromParent === void 0 ? void 0 : removeChildFromParent(menuRef);\n };\n }, [menuRef, addChildToParent, removeChildFromParent, orphan]);\n var providerValue = useMemo(function () {\n return {\n orientation: options.orientation,\n next: options.next,\n previous: options.previous,\n ref: menuRef,\n role: role,\n parent: parent,\n children: children,\n addChild: addChild,\n removeChild: removeChild\n };\n }, [options.orientation, options.next, options.previous, menuRef, role, parent, children, addChild, removeChild]);\n var wrapElement = useCallback(function (element) {\n return /*#__PURE__*/createElement(MenuContext.Provider, {\n value: providerValue\n }, element);\n }, [providerValue]);\n return wrapElement;\n}\n\nexport { MenuContext as M, useMenuContext as u };\n","import { createContext } from 'react';\n\nvar DialogBackdropContext = /*#__PURE__*/createContext(undefined);\n\nexport { DialogBackdropContext as D };\n","import { _ as _objectWithoutPropertiesLoose, a as _objectSpread2 } from '../_rollupPluginBabelHelpers-1f0bf8c2.js';\nimport { createComponent } from 'reakit-system/createComponent';\nimport { createHook } from 'reakit-system/createHook';\nimport 'reakit-utils/shallowEqual';\nimport { useRef, useEffect, useContext, useState, useCallback, useMemo, createElement, createContext, useReducer } from 'react';\nimport { useForkRef } from 'reakit-utils/useForkRef';\nimport { isButton } from 'reakit-utils/isButton';\nimport { warning, useWarning } from 'reakit-warning';\nimport { useLiveRef } from 'reakit-utils/useLiveRef';\nimport 'reakit-utils/isSelfTarget';\nimport { useIsomorphicEffect } from 'reakit-utils/useIsomorphicEffect';\nimport { hasFocusWithin } from 'reakit-utils/hasFocusWithin';\nimport { getFirstTabbableIn, getLastTabbableIn, isTabbable } from 'reakit-utils/tabbable';\nimport '../Role/Role.js';\nimport { useUpdateEffect } from 'reakit-utils/useUpdateEffect';\nimport { useCreateElement } from 'reakit-system/useCreateElement';\nimport { getDocument } from 'reakit-utils/getDocument';\nimport 'reakit-utils/canUseDOM';\nimport { getNextActiveElementOnBlur } from 'reakit-utils/getNextActiveElementOnBlur';\nimport { ensureFocus } from 'reakit-utils/ensureFocus';\nimport '../__keys-e6a5cfbe.js';\nimport { useDisclosureContent } from '../Disclosure/DisclosureContent.js';\nimport 'react-dom';\nimport { Portal } from '../Portal/Portal.js';\nimport { removeItemFromArray } from 'reakit-utils/removeItemFromArray';\nimport { M as MenuContext } from '../MenuContext-6af6cf92.js';\nimport { disableBodyScroll, enableBodyScroll } from 'body-scroll-lock';\nimport { closest } from 'reakit-utils/closest';\nimport { getActiveElement } from 'reakit-utils/getActiveElement';\nimport { contains } from 'reakit-utils/contains';\nimport { D as DialogBackdropContext } from '../DialogBackdropContext-8775f78b.js';\nimport { isEmpty } from 'reakit-utils/isEmpty';\nimport { D as DIALOG_KEYS } from '../__keys-ed7b48af.js';\n\nfunction useDisclosureRef(dialogRef, options) {\n var ref = useRef(null);\n var animating = !!(options.animated && options.animating);\n useEffect(function () {\n if (options.visible || animating) return undefined; // We get the last focused element before the dialog opens, so we can move\n // focus back to it when the dialog closes.\n\n var onFocus = function onFocus(event) {\n var target = event.target;\n\n if (\"focus\" in target) {\n ref.current = target;\n\n if (options.unstable_disclosureRef) {\n options.unstable_disclosureRef.current = target;\n }\n }\n };\n\n var document = getDocument(dialogRef.current);\n document.addEventListener(\"focusin\", onFocus);\n return function () {\n return document.removeEventListener(\"focusin\", onFocus);\n };\n }, [options.visible, animating, options.unstable_disclosureRef, dialogRef]);\n useEffect(function () {\n var _options$unstable_dis;\n\n if (!options.visible || animating) return undefined; // Safari and Firefox on MacOS don't focus on buttons on mouse down.\n // Instead, they focus on the closest focusable parent (ultimately, the\n // body element). This works around that by preventing that behavior and\n // forcing focus on the disclosure button. Otherwise, we wouldn't be able\n // to close the dialog by clicking again on the disclosure.\n\n var onMouseDown = function onMouseDown(event) {\n var element = event.currentTarget;\n if (!isButton(element)) return;\n event.preventDefault();\n element.focus();\n };\n\n var disclosure = ((_options$unstable_dis = options.unstable_disclosureRef) === null || _options$unstable_dis === void 0 ? void 0 : _options$unstable_dis.current) || ref.current;\n disclosure === null || disclosure === void 0 ? void 0 : disclosure.addEventListener(\"mousedown\", onMouseDown);\n return function () {\n return disclosure === null || disclosure === void 0 ? void 0 : disclosure.removeEventListener(\"mousedown\", onMouseDown);\n };\n }, [options.visible, animating, options.unstable_disclosureRef]);\n return options.unstable_disclosureRef || ref;\n}\n\nfunction usePreventBodyScroll(targetRef, options) {\n var shouldPrevent = Boolean(options.preventBodyScroll && options.visible);\n useEffect(function () {\n var element = targetRef.current;\n if (!element || !shouldPrevent) return undefined;\n disableBodyScroll(element, {\n reserveScrollBarGap: true\n });\n return function () {\n return enableBodyScroll(element);\n };\n }, [targetRef, shouldPrevent]);\n}\n\nfunction useFocusOnShow(dialogRef, nestedDialogs, options) {\n var initialFocusRef = options.unstable_initialFocusRef;\n var shouldFocus = options.visible && options.unstable_autoFocusOnShow;\n var animating = !!(options.animated && options.animating);\n useUpdateEffect(function () {\n var dialog = dialogRef.current;\n process.env.NODE_ENV !== \"production\" ? warning(!!shouldFocus && !dialog, \"[reakit/Dialog]\", \"Can't set initial focus on dialog because `ref` wasn't passed to the dialog element.\", \"See https://reakit.io/docs/dialog\") : void 0;\n if (!shouldFocus) return;\n if (!dialog) return;\n if (animating) return; // If there're nested open dialogs, let them handle focus\n\n if (nestedDialogs.some(function (child) {\n return child.current && !child.current.hidden;\n })) {\n return;\n }\n\n if (initialFocusRef !== null && initialFocusRef !== void 0 && initialFocusRef.current) {\n initialFocusRef.current.focus({\n preventScroll: true\n });\n } else {\n var tabbable = getFirstTabbableIn(dialog, true);\n\n var isActive = function isActive() {\n return hasFocusWithin(dialog);\n };\n\n if (tabbable) {\n ensureFocus(tabbable, {\n preventScroll: true,\n isActive: isActive\n });\n } else {\n ensureFocus(dialog, {\n preventScroll: true,\n isActive: isActive\n });\n process.env.NODE_ENV !== \"production\" ? warning(dialog.tabIndex === undefined || dialog.tabIndex < 0, \"It's recommended to have at least one tabbable element inside dialog. The dialog element has been automatically focused.\", \"If this is the intended behavior, pass `tabIndex={0}` to the dialog element to disable this warning.\", \"See https://reakit.io/docs/dialog/#initial-focus\", dialog) : void 0;\n }\n }\n }, [dialogRef, shouldFocus, animating, nestedDialogs, initialFocusRef]);\n}\n\nfunction usePortalRef(dialogRef, options) {\n var portalRef = useRef(null);\n useEffect(function () {\n var dialog = dialogRef.current;\n if (!dialog || !options.visible) return;\n portalRef.current = closest(dialog, Portal.__selector);\n }, [dialogRef, options.visible]);\n return portalRef;\n}\n\nfunction removeFromDOM(element) {\n if (element.parentNode == null) return;\n element.parentNode.removeChild(element);\n}\n\nvar focusTrapClassName = \"__reakit-focus-trap\";\nfunction isFocusTrap(element) {\n var _element$classList;\n\n return (_element$classList = element.classList) === null || _element$classList === void 0 ? void 0 : _element$classList.contains(focusTrapClassName);\n}\nfunction useFocusTrap(dialogRef, visibleModals, options) {\n var portalRef = usePortalRef(dialogRef, options);\n var shouldTrap = options.visible && options.modal;\n var beforeElement = useRef(null);\n var afterElement = useRef(null); // Create before and after elements\n // https://github.com/w3c/aria-practices/issues/545\n\n useEffect(function () {\n if (!shouldTrap) return undefined;\n var portal = portalRef.current;\n\n if (!portal) {\n process.env.NODE_ENV !== \"production\" ? warning(true, \"Can't trap focus within modal dialog because either `ref` wasn't passed to component or the component wasn't rendered within a portal\", \"See https://reakit.io/docs/dialog\") : void 0;\n return undefined;\n }\n\n if (!beforeElement.current) {\n var document = getDocument(portal);\n beforeElement.current = document.createElement(\"div\");\n beforeElement.current.className = focusTrapClassName;\n beforeElement.current.tabIndex = 0;\n beforeElement.current.style.position = \"fixed\";\n beforeElement.current.setAttribute(\"aria-hidden\", \"true\");\n }\n\n if (!afterElement.current) {\n afterElement.current = beforeElement.current.cloneNode();\n }\n\n portal.insertAdjacentElement(\"beforebegin\", beforeElement.current);\n portal.insertAdjacentElement(\"afterend\", afterElement.current);\n return function () {\n if (beforeElement.current) removeFromDOM(beforeElement.current);\n if (afterElement.current) removeFromDOM(afterElement.current);\n };\n }, [portalRef, shouldTrap]); // Focus trap\n\n useEffect(function () {\n var before = beforeElement.current;\n var after = afterElement.current;\n if (!shouldTrap || !before || !after) return undefined;\n\n var handleFocus = function handleFocus(event) {\n var dialog = dialogRef.current;\n if (!dialog || visibleModals.length) return;\n event.preventDefault();\n var isAfter = event.target === after;\n var tabbable = isAfter ? getFirstTabbableIn(dialog) : getLastTabbableIn(dialog);\n\n if (tabbable) {\n tabbable.focus();\n } else {\n // fallback to dialog\n dialog.focus();\n }\n };\n\n before.addEventListener(\"focus\", handleFocus);\n after.addEventListener(\"focus\", handleFocus);\n return function () {\n before.removeEventListener(\"focus\", handleFocus);\n after.removeEventListener(\"focus\", handleFocus);\n };\n }, [dialogRef, visibleModals, shouldTrap]);\n}\n\nfunction hidByFocusingAnotherElement(dialogRef) {\n var dialog = dialogRef.current;\n if (!dialog) return false;\n var activeElement = getActiveElement(dialog);\n if (!activeElement) return false;\n if (contains(dialog, activeElement)) return false;\n if (isTabbable(activeElement)) return true;\n if (activeElement.getAttribute(\"data-dialog\") === \"true\") return true;\n return false;\n}\n\nfunction useFocusOnHide(dialogRef, disclosureRef, options) {\n var shouldFocus = options.unstable_autoFocusOnHide && !options.visible;\n var animating = !!(options.animated && options.animating);\n useUpdateEffect(function () {\n var _options$unstable_fin;\n\n if (!shouldFocus) return;\n if (animating) return; // Hide was triggered by a click/focus on a tabbable element outside\n // the dialog or on another dialog. We won't change focus then.\n\n if (hidByFocusingAnotherElement(dialogRef)) {\n return;\n }\n\n var finalFocusEl = ((_options$unstable_fin = options.unstable_finalFocusRef) === null || _options$unstable_fin === void 0 ? void 0 : _options$unstable_fin.current) || disclosureRef.current;\n\n if (finalFocusEl) {\n if (finalFocusEl.id) {\n var document = getDocument(finalFocusEl);\n var compositeElement = document.querySelector(\"[aria-activedescendant='\" + finalFocusEl.id + \"']\");\n\n if (compositeElement) {\n ensureFocus(compositeElement);\n return;\n }\n }\n\n ensureFocus(finalFocusEl);\n return;\n }\n\n process.env.NODE_ENV !== \"production\" ? warning(true, \"Can't return focus after closing dialog. Either render a disclosure component or provide a `unstable_finalFocusRef` prop.\", \"See https://reakit.io/docs/dialog\", dialogRef.current) : void 0;\n }, [shouldFocus, animating, dialogRef, disclosureRef]);\n}\n\nvar DialogContext = /*#__PURE__*/createContext({});\nfunction useNestedDialogs(dialogRef, options) {\n var context = useContext(DialogContext);\n\n var _React$useState = useState([]),\n dialogs = _React$useState[0],\n setDialogs = _React$useState[1];\n\n var _React$useState2 = useState(dialogs),\n visibleModals = _React$useState2[0],\n setVisibleModals = _React$useState2[1];\n\n var addDialog = useCallback(function (ref) {\n var _context$addDialog;\n\n (_context$addDialog = context.addDialog) === null || _context$addDialog === void 0 ? void 0 : _context$addDialog.call(context, ref);\n setDialogs(function (prevDialogs) {\n return [].concat(prevDialogs, [ref]);\n });\n }, [context.addDialog]);\n var removeDialog = useCallback(function (ref) {\n var _context$removeDialog;\n\n (_context$removeDialog = context.removeDialog) === null || _context$removeDialog === void 0 ? void 0 : _context$removeDialog.call(context, ref);\n setDialogs(function (prevDialogs) {\n return removeItemFromArray(prevDialogs, ref);\n });\n }, [context.removeDialog]);\n var showDialog = useCallback(function (ref) {\n var _context$showDialog;\n\n (_context$showDialog = context.showDialog) === null || _context$showDialog === void 0 ? void 0 : _context$showDialog.call(context, ref);\n setVisibleModals(function (prevDialogs) {\n return [].concat(prevDialogs, [ref]);\n });\n }, [context.showDialog]);\n var hideDialog = useCallback(function (ref) {\n var _context$hideDialog;\n\n (_context$hideDialog = context.hideDialog) === null || _context$hideDialog === void 0 ? void 0 : _context$hideDialog.call(context, ref);\n setVisibleModals(function (prevDialogs) {\n return removeItemFromArray(prevDialogs, ref);\n });\n }, [context.hideDialog]); // If it's a nested dialog, add it to context\n\n useEffect(function () {\n var _context$addDialog2;\n\n if (options.unstable_orphan) return undefined;\n (_context$addDialog2 = context.addDialog) === null || _context$addDialog2 === void 0 ? void 0 : _context$addDialog2.call(context, dialogRef);\n return function () {\n var _context$removeDialog2;\n\n (_context$removeDialog2 = context.removeDialog) === null || _context$removeDialog2 === void 0 ? void 0 : _context$removeDialog2.call(context, dialogRef);\n };\n }, [options.unstable_orphan, context.addDialog, dialogRef, context.removeDialog]);\n useEffect(function () {\n var _context$showDialog2;\n\n if (options.unstable_orphan) return undefined;\n if (!options.modal) return undefined;\n if (!options.visible) return undefined;\n (_context$showDialog2 = context.showDialog) === null || _context$showDialog2 === void 0 ? void 0 : _context$showDialog2.call(context, dialogRef);\n return function () {\n var _context$hideDialog2;\n\n (_context$hideDialog2 = context.hideDialog) === null || _context$hideDialog2 === void 0 ? void 0 : _context$hideDialog2.call(context, dialogRef);\n };\n }, [options.unstable_orphan, options.modal, options.visible, context.showDialog, dialogRef, context.hideDialog]); // Close all nested dialogs when parent dialog closes\n\n useEffect(function () {\n if (context.visible === false && options.visible && !options.unstable_orphan) {\n var _options$hide;\n\n (_options$hide = options.hide) === null || _options$hide === void 0 ? void 0 : _options$hide.call(options);\n }\n }, [context.visible, options.visible, options.hide, options.unstable_orphan]); // Provider\n\n var providerValue = useMemo(function () {\n return {\n visible: options.visible,\n addDialog: addDialog,\n removeDialog: removeDialog,\n showDialog: showDialog,\n hideDialog: hideDialog\n };\n }, [options.visible, addDialog, removeDialog, showDialog, hideDialog]);\n var wrap = useCallback(function (element) {\n return /*#__PURE__*/createElement(DialogContext.Provider, {\n value: providerValue\n }, element);\n }, [providerValue]);\n return {\n dialogs: dialogs,\n visibleModals: visibleModals,\n wrap: wrap\n };\n}\n\nfunction dialogContains(target) {\n return function (dialogRef) {\n var dialog = dialogRef.current;\n if (!dialog) return false;\n if (contains(dialog, target)) return true;\n var document = getDocument(dialog);\n var backdrop = document.querySelector(\"[data-dialog-ref=\\\"\" + dialog.id + \"\\\"]\");\n\n if (backdrop) {\n return contains(backdrop, target);\n }\n\n return false;\n };\n}\n\nfunction isDisclosure(target, disclosure) {\n return contains(disclosure, target);\n}\n\nfunction isInDocument(target) {\n var document = getDocument(target);\n\n if (target.tagName === \"HTML\") {\n return true;\n }\n\n return contains(document.body, target);\n}\n\nfunction useEventListenerOutside(containerRef, disclosureRef, nestedDialogs, eventType, listener, shouldListen, capture) {\n var listenerRef = useLiveRef(listener);\n useEffect(function () {\n if (!shouldListen) return undefined;\n\n var onEvent = function onEvent(event) {\n if (!listenerRef.current) return;\n var container = containerRef.current;\n var disclosure = disclosureRef.current;\n var target = event.target;\n\n if (!container) {\n process.env.NODE_ENV !== \"production\" ? warning(true, \"Can't detect events outside dialog because `ref` wasn't passed to component.\", \"See https://reakit.io/docs/dialog\") : void 0;\n return;\n } // When an element is unmounted right after it receives focus, the focus\n // event is triggered after that, when the element isn't part of the\n // current document anymore. So we ignore it.\n\n\n if (!isInDocument(target)) return; // Event inside dialog\n\n if (contains(container, target)) return; // Event on disclosure\n\n if (disclosure && isDisclosure(target, disclosure)) return; // Event inside a nested dialog or focus trap\n\n if (isFocusTrap(target) || nestedDialogs.some(dialogContains(target))) {\n return;\n }\n\n listenerRef.current(event);\n };\n\n var document = getDocument(containerRef.current);\n document.addEventListener(eventType, onEvent, capture);\n return function () {\n return document.removeEventListener(eventType, onEvent, capture);\n };\n }, [containerRef, disclosureRef, nestedDialogs, eventType, shouldListen, listenerRef]);\n}\n\nfunction useMouseDownRef(dialogRef, options) {\n var mouseDownRef = useRef();\n useEffect(function () {\n if (!options.visible) return undefined;\n if (!options.hideOnClickOutside) return undefined;\n var document = getDocument(dialogRef.current);\n\n var onMouseDown = function onMouseDown(event) {\n mouseDownRef.current = event.target;\n };\n\n document.addEventListener(\"mousedown\", onMouseDown);\n return function () {\n return document.removeEventListener(\"mousedown\", onMouseDown);\n };\n }, [options.visible, options.hideOnClickOutside, dialogRef]);\n return mouseDownRef;\n}\n\nfunction useHideOnClickOutside(dialogRef, disclosureRef, nestedDialogs, options) {\n var mouseDownRef = useMouseDownRef(dialogRef, options);\n useEventListenerOutside(dialogRef, disclosureRef, nestedDialogs, \"click\", function (event) {\n // Make sure the element that has been clicked is the same that last\n // triggered the mousedown event. This prevents the dialog from closing\n // by dragging the cursor (for example, selecting some text inside the\n // dialog and releasing the mouse outside of it).\n if (mouseDownRef.current === event.target) {\n var _options$hide;\n\n (_options$hide = options.hide) === null || _options$hide === void 0 ? void 0 : _options$hide.call(options);\n }\n }, options.visible && options.hideOnClickOutside);\n useEventListenerOutside(dialogRef, disclosureRef, nestedDialogs, \"focusin\", function (event) {\n var document = getDocument(dialogRef.current); // Fix for https://github.com/reakit/reakit/issues/619\n // On IE11, calling element.blur() triggers the focus event on\n // document.body, so we make sure to ignore it as well.\n\n if (event.target !== document && event.target !== document.body) {\n var _options$hide2;\n\n (_options$hide2 = options.hide) === null || _options$hide2 === void 0 ? void 0 : _options$hide2.call(options);\n }\n }, options.visible && options.hideOnClickOutside);\n}\n\nfunction useDisableHoverOutside(portalRef, nestedDialogs, options) {\n var useEvent = function useEvent(eventType) {\n return useEventListenerOutside(portalRef, {\n current: null\n }, nestedDialogs, eventType, function (event) {\n event.stopPropagation();\n event.preventDefault();\n }, options.visible && options.modal, true);\n };\n\n useEvent(\"mouseover\");\n useEvent(\"mousemove\");\n useEvent(\"mouseout\");\n}\n\n/**\n * When the focused child gets removed from the DOM, we make sure to move focus\n * to the dialog.\n */\nfunction useFocusOnChildUnmount(dialogRef, options) {\n useEffect(function () {\n var dialog = dialogRef.current;\n if (!options.visible || !dialog) return undefined;\n var observer = new MutationObserver(function (mutations) {\n var target = mutations[0].target; // If target is not this dialog, then this observer was triggered by a\n // nested dialog, so we just ignore it here and let the nested dialog\n // handle it there.\n\n if (target !== dialog) return;\n var document = getDocument(dialog);\n var activeElement = getActiveElement(dialog); // We can check if the current focused element is the document body. On\n // IE 11, it's an empty object when the current document is in a frame or\n // iframe.\n\n if (activeElement === document.body || isEmpty(activeElement)) {\n dialog.focus();\n }\n });\n observer.observe(dialog, {\n childList: true,\n subtree: true\n });\n return function () {\n observer.disconnect();\n };\n }, [options.visible, dialogRef]);\n}\n\nfunction isActualElement(element) {\n return element && element.tagName && element.tagName !== \"HTML\" && element !== getDocument(element).body;\n}\n\nfunction useFocusOnBlur(dialogRef, options) {\n var _React$useReducer = useReducer(function (n) {\n return n + 1;\n }, 0),\n blurred = _React$useReducer[0],\n scheduleFocus = _React$useReducer[1];\n\n useIsomorphicEffect(function () {\n var dialog = dialogRef.current;\n if (!options.visible) return;\n if (!blurred) return; // After blur, if the active element isn't an actual element, this probably\n // means that element.blur() was called on an element inside the dialog.\n // In this case, the browser will automatically focus the body element.\n // So we move focus back to the dialog.\n\n if (!isActualElement(getActiveElement(dialog))) {\n process.env.NODE_ENV !== \"production\" ? warning(!dialog, \"Can't focus dialog after a nested element got blurred because `ref` wasn't passed to the component\", \"See https://reakit.io/docs/dialog\") : void 0;\n dialog === null || dialog === void 0 ? void 0 : dialog.focus();\n }\n }, [blurred, dialogRef]);\n var onBlur = useCallback(function (event) {\n if (!options.visible) return;\n var nextActiveElement = getNextActiveElementOnBlur(event);\n\n if (!isActualElement(nextActiveElement)) {\n scheduleFocus();\n }\n }, [options.visible]);\n return onBlur;\n}\n\nvar useDialog = createHook({\n name: \"Dialog\",\n compose: useDisclosureContent,\n keys: DIALOG_KEYS,\n useOptions: function useOptions(_ref) {\n var _ref$modal = _ref.modal,\n modal = _ref$modal === void 0 ? true : _ref$modal,\n _ref$hideOnEsc = _ref.hideOnEsc,\n hideOnEsc = _ref$hideOnEsc === void 0 ? true : _ref$hideOnEsc,\n _ref$hideOnClickOutsi = _ref.hideOnClickOutside,\n hideOnClickOutside = _ref$hideOnClickOutsi === void 0 ? true : _ref$hideOnClickOutsi,\n _ref$preventBodyScrol = _ref.preventBodyScroll,\n preventBodyScroll = _ref$preventBodyScrol === void 0 ? modal : _ref$preventBodyScrol,\n _ref$unstable_autoFoc = _ref.unstable_autoFocusOnShow,\n unstable_autoFocusOnShow = _ref$unstable_autoFoc === void 0 ? true : _ref$unstable_autoFoc,\n _ref$unstable_autoFoc2 = _ref.unstable_autoFocusOnHide,\n unstable_autoFocusOnHide = _ref$unstable_autoFoc2 === void 0 ? true : _ref$unstable_autoFoc2,\n unstable_orphan = _ref.unstable_orphan,\n options = _objectWithoutPropertiesLoose(_ref, [\"modal\", \"hideOnEsc\", \"hideOnClickOutside\", \"preventBodyScroll\", \"unstable_autoFocusOnShow\", \"unstable_autoFocusOnHide\", \"unstable_orphan\"]);\n\n return _objectSpread2({\n modal: modal,\n hideOnEsc: hideOnEsc,\n hideOnClickOutside: hideOnClickOutside,\n preventBodyScroll: modal && preventBodyScroll,\n unstable_autoFocusOnShow: unstable_autoFocusOnShow,\n unstable_autoFocusOnHide: unstable_autoFocusOnHide,\n unstable_orphan: modal && unstable_orphan\n }, options);\n },\n useProps: function useProps(options, _ref2) {\n var htmlRef = _ref2.ref,\n htmlOnKeyDown = _ref2.onKeyDown,\n htmlOnBlur = _ref2.onBlur,\n htmlWrapElement = _ref2.wrapElement,\n tabIndex = _ref2.tabIndex,\n htmlProps = _objectWithoutPropertiesLoose(_ref2, [\"ref\", \"onKeyDown\", \"onBlur\", \"wrapElement\", \"tabIndex\"]);\n\n var dialog = useRef(null);\n var backdrop = useContext(DialogBackdropContext);\n var hasBackdrop = backdrop && backdrop === options.baseId;\n var disclosure = useDisclosureRef(dialog, options);\n var onKeyDownRef = useLiveRef(htmlOnKeyDown);\n var onBlurRef = useLiveRef(htmlOnBlur);\n var focusOnBlur = useFocusOnBlur(dialog, options);\n\n var _useNestedDialogs = useNestedDialogs(dialog, options),\n dialogs = _useNestedDialogs.dialogs,\n visibleModals = _useNestedDialogs.visibleModals,\n wrap = _useNestedDialogs.wrap; // VoiceOver/Safari accepts only one `aria-modal` container, so if there\n // are visible child modals, then we don't want to set aria-modal on the\n // parent modal (this component).\n\n\n var modal = options.modal && !visibleModals.length ? true : undefined;\n usePreventBodyScroll(dialog, options);\n useFocusTrap(dialog, visibleModals, options);\n useFocusOnChildUnmount(dialog, options);\n useFocusOnShow(dialog, dialogs, options);\n useFocusOnHide(dialog, disclosure, options);\n useHideOnClickOutside(dialog, disclosure, dialogs, options);\n useDisableHoverOutside(dialog, dialogs, options);\n var onKeyDown = useCallback(function (event) {\n var _onKeyDownRef$current;\n\n (_onKeyDownRef$current = onKeyDownRef.current) === null || _onKeyDownRef$current === void 0 ? void 0 : _onKeyDownRef$current.call(onKeyDownRef, event);\n if (event.defaultPrevented) return;\n if (event.key !== \"Escape\") return;\n if (!options.hideOnEsc) return;\n\n if (!options.hide) {\n process.env.NODE_ENV !== \"production\" ? warning(true, \"`hideOnEsc` prop is truthy, but `hide` prop wasn't provided.\", \"See https://reakit.io/docs/dialog\", dialog.current) : void 0;\n return;\n }\n\n event.stopPropagation();\n options.hide();\n }, [options.hideOnEsc, options.hide]);\n var onBlur = useCallback(function (event) {\n var _onBlurRef$current;\n\n (_onBlurRef$current = onBlurRef.current) === null || _onBlurRef$current === void 0 ? void 0 : _onBlurRef$current.call(onBlurRef, event);\n focusOnBlur(event);\n }, [focusOnBlur]);\n var wrapElement = useCallback(function (element) {\n element = wrap(element);\n\n if (options.modal && !hasBackdrop) {\n element = /*#__PURE__*/createElement(Portal, null, element);\n }\n\n if (htmlWrapElement) {\n element = htmlWrapElement(element);\n }\n\n return (\n /*#__PURE__*/\n // Prevents Menu > Dialog > Menu to behave as a sub menu\n createElement(MenuContext.Provider, {\n value: null\n }, element)\n );\n }, [wrap, options.modal, hasBackdrop, htmlWrapElement]);\n return _objectSpread2({\n ref: useForkRef(dialog, htmlRef),\n role: \"dialog\",\n tabIndex: tabIndex != null ? tabIndex : -1,\n \"aria-modal\": modal,\n \"data-dialog\": true,\n onKeyDown: onKeyDown,\n onBlur: onBlur,\n wrapElement: wrapElement\n }, htmlProps);\n }\n});\nvar Dialog = createComponent({\n as: \"div\",\n useHook: useDialog,\n useCreateElement: function useCreateElement$1(type, props, children) {\n process.env.NODE_ENV !== \"production\" ? useWarning(!props[\"aria-label\"] && !props[\"aria-labelledby\"], \"You should provide either `aria-label` or `aria-labelledby` props.\", \"See https://reakit.io/docs/dialog\") : void 0;\n return useCreateElement(type, props, children);\n }\n});\n\nexport { Dialog, useDialog };\n","import { isObject } from './isObject.js';\n\n/**\n * Checks whether `arg` is empty or not.\n *\n * @example\n * import { isEmpty } from \"reakit-utils\";\n *\n * isEmpty([]); // true\n * isEmpty([\"a\"]); // false\n * isEmpty({}); // true\n * isEmpty({ a: \"a\" }); // false\n * isEmpty(); // true\n * isEmpty(null); // true\n * isEmpty(undefined); // true\n * isEmpty(\"\"); // true\n */\n\nfunction isEmpty(arg) {\n if (Array.isArray(arg)) return !arg.length;\n if (isObject(arg)) return !Object.keys(arg).length;\n if (arg == null) return true;\n if (arg === \"\") return true;\n return false;\n}\n\nexport { isEmpty };\n","import { _ as _objectWithoutPropertiesLoose, a as _objectSpread2 } from '../_rollupPluginBabelHelpers-1f0bf8c2.js';\nimport { createComponent } from 'reakit-system/createComponent';\nimport { createHook } from 'reakit-system/createHook';\nimport 'reakit-utils/shallowEqual';\nimport 'react';\nimport { useForkRef } from 'reakit-utils/useForkRef';\nimport 'reakit-utils/isButton';\nimport { useWarning } from 'reakit-warning';\nimport 'reakit-utils/useLiveRef';\nimport 'reakit-utils/isSelfTarget';\nimport 'reakit-utils/useIsomorphicEffect';\nimport 'reakit-utils/hasFocusWithin';\nimport 'reakit-utils/tabbable';\nimport '../Role/Role.js';\nimport 'reakit-utils/useUpdateEffect';\nimport { useCreateElement } from 'reakit-system/useCreateElement';\nimport 'reakit-utils/getDocument';\nimport 'reakit-utils/canUseDOM';\nimport 'reakit-utils/getNextActiveElementOnBlur';\nimport 'reakit-utils/ensureFocus';\nimport '../__keys-e6a5cfbe.js';\nimport '../Disclosure/DisclosureContent.js';\nimport 'react-dom';\nimport '../Portal/Portal.js';\nimport 'reakit-utils/removeItemFromArray';\nimport '../MenuContext-6af6cf92.js';\nimport { useDialog } from '../Dialog/Dialog.js';\nimport 'body-scroll-lock';\nimport 'reakit-utils/closest';\nimport 'reakit-utils/getActiveElement';\nimport 'reakit-utils/contains';\nimport '../DialogBackdropContext-8775f78b.js';\nimport 'reakit-utils/isEmpty';\nimport '../__keys-ed7b48af.js';\nimport { P as POPOVER_KEYS } from '../__keys-26bb1730.js';\n\nvar usePopover = createHook({\n name: \"Popover\",\n compose: useDialog,\n keys: POPOVER_KEYS,\n useOptions: function useOptions(_ref) {\n var _ref$modal = _ref.modal,\n modal = _ref$modal === void 0 ? false : _ref$modal,\n options = _objectWithoutPropertiesLoose(_ref, [\"modal\"]);\n\n return _objectSpread2({\n modal: modal\n }, options);\n },\n useProps: function useProps(options, _ref2) {\n var htmlRef = _ref2.ref,\n htmlStyle = _ref2.style,\n htmlProps = _objectWithoutPropertiesLoose(_ref2, [\"ref\", \"style\"]);\n\n return _objectSpread2({\n ref: useForkRef(options.unstable_popoverRef, htmlRef),\n style: _objectSpread2(_objectSpread2({}, options.unstable_popoverStyles), htmlStyle)\n }, htmlProps);\n }\n});\nvar Popover = createComponent({\n as: \"div\",\n useHook: usePopover,\n useCreateElement: function useCreateElement$1(type, props, children) {\n process.env.NODE_ENV !== \"production\" ? useWarning(!props[\"aria-label\"] && !props[\"aria-labelledby\"], \"You should provide either `aria-label` or `aria-labelledby` props.\", \"See https://reakit.io/docs/popover\") : void 0;\n return useCreateElement(type, props, children);\n }\n});\n\nexport { Popover, usePopover };\n","import { a as _objectSpread2, _ as _objectWithoutPropertiesLoose } from '../_rollupPluginBabelHelpers-1f0bf8c2.js';\nimport { createComponent } from 'reakit-system/createComponent';\nimport { createHook } from 'reakit-system/createHook';\nimport 'reakit-utils/shallowEqual';\nimport { useRef, useState, useCallback } from 'react';\nimport { useForkRef } from 'reakit-utils/useForkRef';\nimport { isButton } from 'reakit-utils/isButton';\nimport { warning } from 'reakit-warning';\nimport { useLiveRef } from 'reakit-utils/useLiveRef';\nimport { useIsomorphicEffect } from 'reakit-utils/useIsomorphicEffect';\nimport { hasFocusWithin } from 'reakit-utils/hasFocusWithin';\nimport { isPortalEvent } from 'reakit-utils/isPortalEvent';\nimport { isUA } from 'reakit-utils/dom';\nimport { isFocusable } from 'reakit-utils/tabbable';\nimport { useRole } from '../Role/Role.js';\n\n// Automatically generated\nvar TABBABLE_KEYS = [\"disabled\", \"focusable\"];\n\nvar isSafariOrFirefoxOnMac = isUA(\"Mac\") && !isUA(\"Chrome\") && (isUA(\"Safari\") || isUA(\"Firefox\"));\n\nfunction focusIfNeeded(element) {\n if (!hasFocusWithin(element) && isFocusable(element)) {\n element.focus();\n }\n}\n\nfunction isNativeTabbable(element) {\n return [\"BUTTON\", \"INPUT\", \"SELECT\", \"TEXTAREA\", \"A\"].includes(element.tagName);\n}\n\nfunction supportsDisabledAttribute(element) {\n return [\"BUTTON\", \"INPUT\", \"SELECT\", \"TEXTAREA\"].includes(element.tagName);\n}\n\nfunction getTabIndex(trulyDisabled, nativeTabbable, supportsDisabled, htmlTabIndex) {\n if (trulyDisabled) {\n if (nativeTabbable && !supportsDisabled) {\n // Anchor, audio and video tags don't support the `disabled` attribute.\n // We must pass tabIndex={-1} so they don't receive focus on tab.\n return -1;\n } // Elements that support the `disabled` attribute don't need tabIndex.\n\n\n return undefined;\n }\n\n if (nativeTabbable) {\n // If the element is enabled and it's natively tabbable, we don't need to\n // specify a tabIndex attribute unless it's explicitly set by the user.\n return htmlTabIndex;\n } // If the element is enabled and is not natively tabbable, we have to\n // fallback tabIndex={0}.\n\n\n return htmlTabIndex || 0;\n}\n\nfunction useDisableEvent(htmlEventRef, disabled) {\n return useCallback(function (event) {\n var _htmlEventRef$current;\n\n (_htmlEventRef$current = htmlEventRef.current) === null || _htmlEventRef$current === void 0 ? void 0 : _htmlEventRef$current.call(htmlEventRef, event);\n if (event.defaultPrevented) return;\n\n if (disabled) {\n event.stopPropagation();\n event.preventDefault();\n }\n }, [htmlEventRef, disabled]);\n}\n\nvar useTabbable = createHook({\n name: \"Tabbable\",\n compose: useRole,\n keys: TABBABLE_KEYS,\n useOptions: function useOptions(options, _ref) {\n var disabled = _ref.disabled;\n return _objectSpread2({\n disabled: disabled\n }, options);\n },\n useProps: function useProps(options, _ref2) {\n var htmlRef = _ref2.ref,\n htmlTabIndex = _ref2.tabIndex,\n htmlOnClickCapture = _ref2.onClickCapture,\n htmlOnMouseDownCapture = _ref2.onMouseDownCapture,\n htmlOnMouseDown = _ref2.onMouseDown,\n htmlOnKeyPressCapture = _ref2.onKeyPressCapture,\n htmlStyle = _ref2.style,\n htmlProps = _objectWithoutPropertiesLoose(_ref2, [\"ref\", \"tabIndex\", \"onClickCapture\", \"onMouseDownCapture\", \"onMouseDown\", \"onKeyPressCapture\", \"style\"]);\n\n var ref = useRef(null);\n var onClickCaptureRef = useLiveRef(htmlOnClickCapture);\n var onMouseDownCaptureRef = useLiveRef(htmlOnMouseDownCapture);\n var onMouseDownRef = useLiveRef(htmlOnMouseDown);\n var onKeyPressCaptureRef = useLiveRef(htmlOnKeyPressCapture);\n var trulyDisabled = !!options.disabled && !options.focusable;\n\n var _React$useState = useState(true),\n nativeTabbable = _React$useState[0],\n setNativeTabbable = _React$useState[1];\n\n var _React$useState2 = useState(true),\n supportsDisabled = _React$useState2[0],\n setSupportsDisabled = _React$useState2[1];\n\n var style = options.disabled ? _objectSpread2({\n pointerEvents: \"none\"\n }, htmlStyle) : htmlStyle;\n useIsomorphicEffect(function () {\n var tabbable = ref.current;\n\n if (!tabbable) {\n process.env.NODE_ENV !== \"production\" ? warning(true, \"Can't determine if the element is a native tabbable element because `ref` wasn't passed to the component.\", \"See https://reakit.io/docs/tabbable\") : void 0;\n return;\n }\n\n if (!isNativeTabbable(tabbable)) {\n setNativeTabbable(false);\n }\n\n if (!supportsDisabledAttribute(tabbable)) {\n setSupportsDisabled(false);\n }\n }, []);\n var onClickCapture = useDisableEvent(onClickCaptureRef, options.disabled);\n var onMouseDownCapture = useDisableEvent(onMouseDownCaptureRef, options.disabled);\n var onKeyPressCapture = useDisableEvent(onKeyPressCaptureRef, options.disabled);\n var onMouseDown = useCallback(function (event) {\n var _onMouseDownRef$curre;\n\n (_onMouseDownRef$curre = onMouseDownRef.current) === null || _onMouseDownRef$curre === void 0 ? void 0 : _onMouseDownRef$curre.call(onMouseDownRef, event);\n var element = event.currentTarget;\n if (event.defaultPrevented) return; // Safari and Firefox on MacOS don't focus on buttons on mouse down\n // like other browsers/platforms. Instead, they focus on the closest\n // focusable ancestor element, which is ultimately the body element. So\n // we make sure to give focus to the tabbable element on mouse down so\n // it works consistently across browsers.\n\n if (!isSafariOrFirefoxOnMac) return;\n if (isPortalEvent(event)) return;\n if (!isButton(element)) return; // We can't focus right away after on mouse down, otherwise it would\n // prevent drag events from happening. So we schedule the focus to the\n // next animation frame.\n\n var raf = requestAnimationFrame(function () {\n element.removeEventListener(\"mouseup\", focusImmediately, true);\n focusIfNeeded(element);\n }); // If mouseUp happens before the next animation frame (which is common\n // on touch screens or by just tapping the trackpad on MacBook's), we\n // cancel the animation frame and immediately focus on the element.\n\n var focusImmediately = function focusImmediately() {\n cancelAnimationFrame(raf);\n focusIfNeeded(element);\n }; // By listening to the event in the capture phase, we make sure the\n // focus event is fired before the onMouseUp and onMouseUpCapture React\n // events, which is aligned with the default browser behavior.\n\n\n element.addEventListener(\"mouseup\", focusImmediately, {\n once: true,\n capture: true\n });\n }, []);\n return _objectSpread2({\n ref: useForkRef(ref, htmlRef),\n style: style,\n tabIndex: getTabIndex(trulyDisabled, nativeTabbable, supportsDisabled, htmlTabIndex),\n disabled: trulyDisabled && supportsDisabled ? true : undefined,\n \"aria-disabled\": options.disabled ? true : undefined,\n onClickCapture: onClickCapture,\n onMouseDownCapture: onMouseDownCapture,\n onMouseDown: onMouseDown,\n onKeyPressCapture: onKeyPressCapture\n }, htmlProps);\n }\n});\nvar Tabbable = createComponent({\n as: \"div\",\n useHook: useTabbable\n});\n\nexport { Tabbable, useTabbable };\n","// Automatically generated\nvar COMBOBOX_LIST_STATE_KEYS = [\"baseId\", \"unstable_idCountRef\", \"unstable_virtual\", \"rtl\", \"orientation\", \"groups\", \"currentId\", \"loop\", \"wrap\", \"shift\", \"unstable_moves\", \"unstable_hasActiveWidget\", \"unstable_includesBaseElement\", \"items\", \"menuRole\", \"inputValue\", \"minValueLength\", \"currentValue\", \"values\", \"limit\", \"matches\", \"list\", \"inline\", \"autoSelect\", \"visible\", \"setBaseId\", \"unregisterItem\", \"registerGroup\", \"unregisterGroup\", \"move\", \"next\", \"previous\", \"up\", \"down\", \"first\", \"last\", \"sort\", \"unstable_setVirtual\", \"setRTL\", \"setOrientation\", \"setCurrentId\", \"setLoop\", \"setWrap\", \"setShift\", \"reset\", \"unstable_setIncludesBaseElement\", \"unstable_setHasActiveWidget\", \"registerItem\", \"setInputValue\", \"setMinValueLength\", \"setValues\", \"setLimit\", \"setList\", \"setInline\", \"setAutoSelect\"];\nvar COMBOBOX_LIST_GRID_STATE_KEYS = [].concat(COMBOBOX_LIST_STATE_KEYS, [\"columns\", \"setColumns\"]);\nvar COMBOBOX_STATE_KEYS = [].concat(COMBOBOX_LIST_STATE_KEYS, [\"animated\", \"animating\", \"modal\", \"unstable_disclosureRef\", \"unstable_referenceRef\", \"unstable_popoverRef\", \"unstable_arrowRef\", \"unstable_popoverStyles\", \"unstable_arrowStyles\", \"unstable_originalPlacement\", \"unstable_update\", \"placement\", \"show\", \"hide\", \"toggle\", \"setVisible\", \"setAnimated\", \"stopAnimation\", \"setModal\", \"place\"]);\nvar COMBOBOX_GRID_STATE_KEYS = [].concat(COMBOBOX_LIST_GRID_STATE_KEYS, COMBOBOX_STATE_KEYS);\nvar COMBOBOX_KEYS = [].concat(COMBOBOX_GRID_STATE_KEYS, [\"hideOnEsc\"]);\nvar COMBOBOX_GRID_CELL_KEYS = COMBOBOX_GRID_STATE_KEYS;\nvar COMBOBOX_GRID_ROW_KEYS = COMBOBOX_GRID_CELL_KEYS;\nvar COMBOBOX_ITEM_KEYS = [].concat(COMBOBOX_GRID_ROW_KEYS, [\"value\"]);\nvar COMBOBOX_LIST_KEYS = COMBOBOX_GRID_ROW_KEYS;\nvar COMBOBOX_OPTION_KEYS = COMBOBOX_LIST_KEYS;\nvar COMBOBOX_POPOVER_KEYS = COMBOBOX_OPTION_KEYS;\n\nexport { COMBOBOX_KEYS as C, COMBOBOX_GRID_CELL_KEYS as a, COMBOBOX_GRID_ROW_KEYS as b, COMBOBOX_ITEM_KEYS as c, COMBOBOX_LIST_KEYS as d, COMBOBOX_OPTION_KEYS as e, COMBOBOX_POPOVER_KEYS as f };\n","// Automatically generated\nvar COMPOSITE_STATE_KEYS = [\"baseId\", \"unstable_idCountRef\", \"setBaseId\", \"unstable_virtual\", \"rtl\", \"orientation\", \"items\", \"groups\", \"currentId\", \"loop\", \"wrap\", \"shift\", \"unstable_moves\", \"unstable_hasActiveWidget\", \"unstable_includesBaseElement\", \"registerItem\", \"unregisterItem\", \"registerGroup\", \"unregisterGroup\", \"move\", \"next\", \"previous\", \"up\", \"down\", \"first\", \"last\", \"sort\", \"unstable_setVirtual\", \"setRTL\", \"setOrientation\", \"setCurrentId\", \"setLoop\", \"setWrap\", \"setShift\", \"reset\", \"unstable_setIncludesBaseElement\", \"unstable_setHasActiveWidget\"];\nvar COMPOSITE_KEYS = COMPOSITE_STATE_KEYS;\nvar COMPOSITE_GROUP_KEYS = COMPOSITE_KEYS;\nvar COMPOSITE_ITEM_KEYS = COMPOSITE_GROUP_KEYS;\nvar COMPOSITE_ITEM_WIDGET_KEYS = COMPOSITE_ITEM_KEYS;\n\nexport { COMPOSITE_KEYS as C, COMPOSITE_GROUP_KEYS as a, COMPOSITE_ITEM_KEYS as b, COMPOSITE_ITEM_WIDGET_KEYS as c };\n","// Automatically generated\nvar DIALOG_STATE_KEYS = [\"baseId\", \"unstable_idCountRef\", \"visible\", \"animated\", \"animating\", \"setBaseId\", \"show\", \"hide\", \"toggle\", \"setVisible\", \"setAnimated\", \"stopAnimation\", \"modal\", \"unstable_disclosureRef\", \"setModal\"];\nvar DIALOG_KEYS = [].concat(DIALOG_STATE_KEYS, [\"hideOnEsc\", \"hideOnClickOutside\", \"preventBodyScroll\", \"unstable_initialFocusRef\", \"unstable_finalFocusRef\", \"unstable_orphan\", \"unstable_autoFocusOnShow\", \"unstable_autoFocusOnHide\"]);\nvar DIALOG_BACKDROP_KEYS = DIALOG_STATE_KEYS;\nvar DIALOG_DISCLOSURE_KEYS = DIALOG_BACKDROP_KEYS;\n\nexport { DIALOG_KEYS as D, DIALOG_BACKDROP_KEYS as a, DIALOG_DISCLOSURE_KEYS as b };\n","function findEnabledItemById(items, id) {\n if (!id) return undefined;\n return items === null || items === void 0 ? void 0 : items.find(function (item) {\n return item.id === id && !item.disabled;\n });\n}\n\nexport { findEnabledItemById as f };\n","function findFirstEnabledItem(items, excludeId) {\n if (excludeId) {\n return items.find(function (item) {\n return !item.disabled && item.id !== excludeId;\n });\n }\n\n return items.find(function (item) {\n return !item.disabled;\n });\n}\n\nfunction getCurrentId(options, passedId) {\n var _findFirstEnabledItem;\n\n if (passedId || passedId === null) {\n return passedId;\n }\n\n if (options.currentId || options.currentId === null) {\n return options.currentId;\n }\n\n return (_findFirstEnabledItem = findFirstEnabledItem(options.items || [])) === null || _findFirstEnabledItem === void 0 ? void 0 : _findFirstEnabledItem.id;\n}\n\nexport { findFirstEnabledItem as f, getCurrentId as g };\n","function getMenuId(baseId) {\n return baseId + \"-menu\";\n}\n\nexport { getMenuId as g };\n","import { b as _createForOfIteratorHelperLoose } from './_rollupPluginBabelHelpers-1f0bf8c2.js';\n\nfunction groupItems(items) {\n var groups = [[]];\n\n var _loop = function _loop() {\n var item = _step.value;\n var group = groups.find(function (g) {\n return !g[0] || g[0].groupId === item.groupId;\n });\n\n if (group) {\n group.push(item);\n } else {\n groups.push([item]);\n }\n };\n\n for (var _iterator = _createForOfIteratorHelperLoose(items), _step; !(_step = _iterator()).done;) {\n _loop();\n }\n\n return groups;\n}\n\nfunction flatten(grid) {\n var flattened = [];\n\n for (var _iterator = _createForOfIteratorHelperLoose(grid), _step; !(_step = _iterator()).done;) {\n var row = _step.value;\n flattened.push.apply(flattened, row);\n }\n\n return flattened;\n}\n\nfunction reverse(array) {\n return array.slice().reverse();\n}\n\nexport { flatten as f, groupItems as g, reverse as r };\n","function userFocus(element) {\n element.userFocus = true;\n element.focus();\n element.userFocus = false;\n}\nfunction hasUserFocus(element) {\n return !!element.userFocus;\n}\nfunction setUserFocus(element, value) {\n element.userFocus = value;\n}\n\nexport { hasUserFocus as h, setUserFocus as s, userFocus as u };\n"],"names":["closest","element","selectors","parentElement","parentNode","nodeType","contains","parent","child","createEvent","type","eventInit","Event","event","g","initEvent","bubbles","cancelable","hasFocus","activeElement","getActiveElement","activeDescendant","getAttribute","id","ensureFocus","_temp","_ref","preventScroll","_ref$isActive","isActive","focus","requestAnimationFrame","nodeName","isIE11","window","getNextActiveElementOnBlur","currentTarget","relatedTarget","hasFocusWithin","querySelector","buttonInputTypes","isButton","tagName","input","indexOf","isPortalEvent","target","matches","msMatchesSelector","webkitMatchesSelector","removeItemFromArray","array","item","index","concat","slice","removeIndexFromArray","selector","isFocusable","htmlElement","offsetWidth","offsetHeight","getClientRects","length","isVisible","isTabbable","parseInt","hasNegativeTabIndex","getAllTabbableIn","container","fallbackToFocusable","allFocusable","Array","from","querySelectorAll","allTabbable","filter","unshift","getFirstTabbableIn","getLastTabbableIn","useUpdateEffect","effect","deps","mounted","useRef","useEffect","current","useBox","name","keys","propsAreEqual","prev","next","prevSystem","unstable_system","prevProps","_","nextSystem","nextProps","as","useHook","useClickable","compose","useOptions","_ref$unstable_clickOn","unstable_clickOnEnter","_ref$unstable_clickOn2","unstable_clickOnSpace","options","useProps","_ref2","htmlOnKeyDown","onKeyDown","htmlOnKeyUp","onKeyUp","htmlProps","_React$useState","useState","active","setActive","onKeyDownRef","onKeyUpRef","useCallback","_onKeyDownRef$current","call","defaultPrevented","disabled","metaKey","isEnter","key","isSpace","isTrusted","isNativeClick","preventDefault","click","_onKeyUpRef$current","undefined","memo","getControls","baseId","ariaControls","menuId","getAutocomplete","list","inline","hasCompletionString","inputValue","currentValue","toLowerCase","unstable_useCombobox","C","_ref$menuRole","menuRole","_ref$hideOnEsc","hideOnEsc","htmlRef","ref","htmlOnKeyPress","onKeyPress","htmlOnChange","onChange","htmlOnClick","onClick","htmlOnBlur","onBlur","_React$useReducer","useReducer","updated","update","onKeyPressRef","onChangeRef","onClickRef","onBlurRef","value","useMemo","items","autoSelect","currentId","firstItem","find","isFirstItemAutoSelected","getCompletionString","useValue","hasInsertedTextRef","_items$find","setSelectionRange","setCurrentId","_options$hide","hide","_onKeyPressRef$curren","_onChangeRef$current","_options$show","_options$setInputValu","_options$setCurrentId2","_options$setCurrentId","show","setInputValue","_onClickRef$current","_options$setCurrentId3","_options$show2","minValueLength","_onBlurRef$current","unstable_referenceRef","role","autoComplete","visible","useComposeProps","_ref3","htmlOnKeyDownCapture","onKeyDownCapture","compositeHTMLProps","onKeyDownCaptureRef","_onKeyDownCaptureRef$","_compositeHTMLProps$o","_onKeyDownRef$current2","_compositeHTMLProps$o2","_options$show3","ctrlKey","altKey","shiftKey","unstable_Combobox","getItemId","replace","unstable_useComboboxItem","createHook","unstable_propsAreEqual","prevCurrentValue","nextCurrentValue","prevId","nextId","focusable","registerItem","_options$registerItem","useLiveRef","children","tabIndex","unstable_useComboboxOption","createComponent","unstable_ComboboxOption","unstable_useComboboxList","useCreateElement","props","unstable_useComboboxPopover","unstable_disclosureRef","unstable_autoFocusOnShow","unstable_autoFocusOnHide","unstable_ComboboxPopover","useComboboxBaseState","composite","_ref$inputValue","initialInputValue","_ref$minValueLength","initialMinValueLength","_ref$values","values","initialValues","_ref$limit","limit","initialLimit","_ref$list","initialList","_ref$inline","initialInline","_ref$autoSelect","initialAutoSelect","valuesById","_React$useState2","setMinValueLength","_React$useState3","setValues","_React$useState4","setLimit","_React$useState5","setList","_React$useState6","setInline","_React$useState7","setAutoSelect","regex","RegExp","match","search","push","_step","_iterator","done","getMatches","forEach","unregisterItem","unstable_useComboboxState","initialState","sealed","useSealedState","u","combobox","_useSealedState","_useSealedState$curre","_useSealedState$orien","orientation","_useSealedState$loop","loop","unstable_virtual","unstable_includesBaseElement","unstable_useComboboxListState","_ref2$gutter","gutter","_ref2$placement","placement","popover","reset","useComboboxPopoverState","createFocusEvent","FocusEvent","fireBlurEvent","defaultAllowed","dispatchEvent","bubbleInit","fireKeyboardEvent","KeyboardEvent","getDocument","initKeyboardEvent","getWindow","location","createKeyboardEvent","canUseDOM","useKeyboardEventProxy","virtual","currentItem","htmlEventHandler","eventHandlerRef","_eventHandlerRef$curr","isSelfTarget","canProxyKeyboardEvent","currentElement","stopPropagation","isItem","some","useComposite","htmlOnFocusCapture","onFocusCapture","htmlOnFocus","onFocus","htmlOnBlurCapture","onBlurCapture","htmlOnKeyUpCapture","onKeyUpCapture","f","previousElementRef","onFocusCaptureRef","onFocusRef","onBlurCaptureRef","scheduleUserFocus","currentItemRef","n","scheduled","schedule","_currentItemRef$curre","useScheduleUserFocus","activeElementRef","elementRef","document","addEventListener","removeEventListener","useActiveElementRef","unstable_moves","_onFocusCaptureRef$cu","previousActiveElement","previousActiveElementWasItem","_onFocusRef$current","_onBlurCaptureRef$cur","nextActiveElement","nextActiveElementIsItem","_options$groups","isVertical","isHorizontal","isGrid","groups","action","ArrowUp","_options$move","r","move","_options$last","last","ArrowRight","first","ArrowDown","ArrowLeft","Home","End","PageUp","PageDown","useForkRef","tabbableHTMLProps","Composite","isTextField","isTextInput","HTMLInputElement","selectionStart","isTextArea","isContentEditable","contentEditable","error","ID_KEYS","unstable_useId","generateId","useContext","suffix","unstable_idCountRef","setTextFieldValue","HTMLTextAreaElement","_Object$getOwnPropert","proto","Object","getPrototypeOf","setValue","getOwnPropertyDescriptor","set","fireEvent","getWidget","itemElement","useCompositeItem","prevCurrentId","prevMoves","nextCurrentId","nextMoves","unstable_hasActiveWidget","_options$items2","_ref$tabIndex","htmlTabIndex","htmlOnMouseDown","onMouseDown","trulyDisabled","isCurrentItem","isCurrentItemRef","hasFocusedComposite","_options$items","useItem","onMouseDownRef","shouldTabIndex","_options$unregisterIt","_onMouseDownRef$curre","s","shouldFocusComposite","h","targetIsAnotherItem","getElementById","groupId","up","down","previous","_options$first","_options$previous","_options$next","_options$up","_options$first2","_options$down","_options$last2","widget","_widget","CompositeItem","applyState","argument","isUpdater","isElementPreceding","element1","element2","Boolean","compareDocumentPosition","Node","DOCUMENT_POSITION_PRECEDING","findDOMIndex","findIndex","getMaxLength","rows","maxLength","verticalizeItems","verticalized","i","group","fillGroups","shift","previousItem","nullItem","getItemsInGroup","map","horizontal","vertical","addItemAtIndex","sortBasedOnDOMPosition","pairs","isOrderDifferent","sort","indexA","a","indexB","b","elementA","elementB","setItemsBasedOnDOMPosition","setItems","sortedItems","useIntersectionObserver","previousItems","root","_firstItem$ref$curren","nextItems","_loop","every","v","_ret","body","getCommonParent","observer","IntersectionObserver","observe","disconnect","useSortBasedOnDOMPosition","timeout","setTimeout","clearTimeout","useTimeoutObserver","reducer","state","rtl","wrap","pastIds","moves","includesBaseElement","initialVirtual","initialRTL","initialOrientation","initialCurrentId","initialLoop","initialWrap","initialShift","hasSetCurrentId","_group","_id","nextGroups","_findFirstEnabledItem","_item","_group2","_r$ref$current","nextItem","_index","nextState","_id2","nextPastIds","pastId","_nextState","_id3","filteredPastIds","_nextPastIds","_nextState2","_item2","isRTL","allItems","currentIndex","_nextItems","nextItemsInGroup","allTheWay","_nextItem2","oppositeOrientation","getOppositeOrientation","canLoop","canWrap","hasNullItem","shouldInsertNullItem","placeItemsAfter","_nextItem3","_nextItem4","_nextId","_nextItem","_hasNullItem","_nextState3","shouldShift","verticalItems","_hasNullItem2","_nextState4","_shouldShift","_verticalItems","_hasNullItem3","_nextState5","_nextState6","Error","useAction","fn","useCompositeState","_useSealedState$unsta","_useSealedState$rtl","_useSealedState$wrap","_useSealedState$shift","idState","_React$useReducer$","dispatch","hasActiveWidget","setHasActiveWidget","isUnmountedRef","useIsomorphicEffect","useIsUnmountedRef","unstable_setHasActiveWidget","registerGroup","unregisterGroup","unstable_setVirtual","setRTL","setOrientation","setLoop","setWrap","setShift","unstable_setIncludesBaseElement","MenuContext","createContext","useMenuContext","menuRef","orphan","unstable_orphan","setChildren","addChildToParent","addChild","removeChildFromParent","removeChild","refs","providerValue","createElement","Provider","DialogBackdropContext","removeFromDOM","focusTrapClassName","useFocusTrap","dialogRef","visibleModals","portalRef","dialog","Portal","__selector","usePortalRef","shouldTrap","modal","beforeElement","afterElement","portal","className","style","position","setAttribute","cloneNode","insertAdjacentElement","before","after","handleFocus","tabbable","useFocusOnHide","disclosureRef","shouldFocus","animating","animated","_options$unstable_fin","hidByFocusingAnotherElement","finalFocusEl","unstable_finalFocusRef","compositeElement","DialogContext","useEventListenerOutside","containerRef","nestedDialogs","eventType","listener","shouldListen","capture","listenerRef","onEvent","_element$classList","disclosure","isInDocument","isDisclosure","classList","backdrop","dialogContains","useHideOnClickOutside","mouseDownRef","hideOnClickOutside","useMouseDownRef","_options$hide2","useFocusOnChildUnmount","MutationObserver","mutations","arg","isArray","isObject","childList","subtree","isActualElement","useDialog","D","_ref$modal","_ref$hideOnClickOutsi","_ref$preventBodyScrol","preventBodyScroll","_ref$unstable_autoFoc","_ref$unstable_autoFoc2","htmlWrapElement","wrapElement","hasBackdrop","_options$unstable_dis","useDisclosureRef","focusOnBlur","blurred","scheduleFocus","useFocusOnBlur","_useNestedDialogs","context","dialogs","setDialogs","setVisibleModals","addDialog","_context$addDialog","prevDialogs","removeDialog","_context$removeDialog","showDialog","_context$showDialog","hideDialog","_context$hideDialog","_context$addDialog2","_context$removeDialog2","_context$showDialog2","_context$hideDialog2","useNestedDialogs","targetRef","shouldPrevent","reserveScrollBarGap","usePreventBodyScroll","initialFocusRef","unstable_initialFocusRef","hidden","useFocusOnShow","useEvent","useDisableHoverOutside","M","usePopover","P","htmlStyle","unstable_popoverRef","unstable_popoverStyles","Popover","isSafariOrFirefoxOnMac","focusIfNeeded","getTabIndex","nativeTabbable","supportsDisabled","useDisableEvent","htmlEventRef","_htmlEventRef$current","useTabbable","htmlOnClickCapture","onClickCapture","htmlOnMouseDownCapture","onMouseDownCapture","htmlOnKeyPressCapture","onKeyPressCapture","onClickCaptureRef","onMouseDownCaptureRef","onKeyPressCaptureRef","setNativeTabbable","setSupportsDisabled","pointerEvents","includes","supportsDisabledAttribute","raf","focusImmediately","cancelAnimationFrame","once","COMBOBOX_LIST_STATE_KEYS","COMBOBOX_LIST_GRID_STATE_KEYS","COMBOBOX_STATE_KEYS","COMBOBOX_GRID_STATE_KEYS","COMBOBOX_KEYS","COMBOBOX_GRID_ROW_KEYS","COMBOBOX_ITEM_KEYS","COMBOBOX_LIST_KEYS","COMBOBOX_OPTION_KEYS","COMBOBOX_POPOVER_KEYS","COMPOSITE_KEYS","COMPOSITE_ITEM_KEYS","DIALOG_STATE_KEYS","DIALOG_KEYS","DIALOG_DISCLOSURE_KEYS","findEnabledItemById","findFirstEnabledItem","excludeId","getCurrentId","passedId","getMenuId","groupItems","flatten","grid","flattened","row","apply","reverse","userFocus","hasUserFocus","setUserFocus"],"sourceRoot":""}