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,cAAY,SAAU8F,GAI1C,OAHAF,GAAY,SAAUG,GACpB,MAAO,GAAGI,OAAOJ,EAAU,CAACD,OAEvB,WACL,OAAOD,EAAkBC,MAE1B,CAACF,EAAaC,IACb9F,GAA4B,IAAAC,cAAY,WAC1C,IAAIoG,EAEAf,EAAUlF,SAASC,cACvB,SAA8C,OAAzCgG,EAAoBV,EAAS9E,cAAmB,EAASwF,EAAkBlG,SAASmF,KAElFM,EAASU,MAAK,SAAUC,GAC7B,IAAIC,EAAuBC,EAE3B,OAA2E,OAAlED,EAAwBpG,SAASsG,eAAeH,EAAIzI,gBAAqB,EAAS0I,EAAsBrG,SAASmF,MAAiF,OAAlEmB,EAAyBrG,SAASsG,eAAeH,EAAIrI,eAAoB,EAASuI,EAAuBtG,SAASmF,SAE5P,CAACK,EAAUC,IACVlE,GAAc,IAAAzB,cAAY,SAAUnC,GACtC,IAAK,IAA2D6I,EAAvDC,GAAY,QAAgChB,KAAoBe,EAAQC,KAAaC,MAAO,CACnG,IAAIC,EAAUH,EAAMzF,MAChB4F,EAAQhJ,WAAaA,GAAUgJ,EAAQjH,WAE5C,CAAC+F,IACAmB,GAAa,IAAAnH,UAAQ,WACvB,MAAO,CACLG,gBAAiBA,EACjB+F,kBAAmBA,EACnB9F,0BAA2BA,EAC3B0B,YAAaA,KAEd,CAAC3B,EAAiB+F,EAAmB9F,EAA2B0B,IAC/DX,GAAO,IAAAnB,UAAQ,WACjB,MAAO,KACN,IACC6D,EAAiB,CACnBpC,IAAKsE,GAEHnC,EAAmB5G,EACvB,OAAO,gBAAoBqC,EAAoBgC,SAAU,CACvDC,MAAO6F,IACN,QAAO,CACRnK,OAAO,QAAS,GAAI4G,EAAkBC,GACtC1C,KAAMA,EACNI,WApEoB,MAqEpBvC,KAAM","sources":["webpack://_N_E/./node_modules/@headlessui/react/dist/components/popover/popover.esm.js","webpack://_N_E/./node_modules/@headlessui/react/dist/hooks/use-resolve-button-type.esm.js"],"sourcesContent":["import { extends as _extends, objectWithoutPropertiesLoose as _objectWithoutPropertiesLoose, createForOfIteratorHelperLoose as _createForOfIteratorHelperLoose } from '../../_virtual/_rollupPluginBabelHelpers.js';\nimport React, { useReducer, useEffect, useMemo, useContext, useCallback, createContext, useRef, useState } from 'react';\nimport { match } from '../../utils/match.esm.js';\nimport { render, forwardRefWithAs, Features } from '../../utils/render.esm.js';\nimport { useSyncRefs } from '../../hooks/use-sync-refs.esm.js';\nimport { Keys } from '../keyboard.esm.js';\nimport { isDisabledReactIssue7711 } from '../../utils/bugs.esm.js';\nimport { useId } from '../../hooks/use-id.esm.js';\nimport { isFocusableElement, getFocusableElements, focusIn, Focus, FocusResult, FocusableMode } from '../../utils/focus-management.esm.js';\nimport { useWindowEvent } from '../../hooks/use-window-event.esm.js';\nimport { OpenClosedProvider, State, useOpenClosed } from '../../internal/open-closed.esm.js';\nimport { useResolveButtonType } from '../../hooks/use-resolve-button-type.esm.js';\n\nvar _reducers;\nvar PopoverStates;\n\n(function (PopoverStates) {\n PopoverStates[PopoverStates[\"Open\"] = 0] = \"Open\";\n PopoverStates[PopoverStates[\"Closed\"] = 1] = \"Closed\";\n})(PopoverStates || (PopoverStates = {}));\n\nvar ActionTypes;\n\n(function (ActionTypes) {\n ActionTypes[ActionTypes[\"TogglePopover\"] = 0] = \"TogglePopover\";\n ActionTypes[ActionTypes[\"ClosePopover\"] = 1] = \"ClosePopover\";\n ActionTypes[ActionTypes[\"SetButton\"] = 2] = \"SetButton\";\n ActionTypes[ActionTypes[\"SetButtonId\"] = 3] = \"SetButtonId\";\n ActionTypes[ActionTypes[\"SetPanel\"] = 4] = \"SetPanel\";\n ActionTypes[ActionTypes[\"SetPanelId\"] = 5] = \"SetPanelId\";\n})(ActionTypes || (ActionTypes = {}));\n\nvar reducers = (_reducers = {}, _reducers[ActionTypes.TogglePopover] = function (state) {\n var _match;\n\n return _extends({}, state, {\n popoverState: match(state.popoverState, (_match = {}, _match[PopoverStates.Open] = PopoverStates.Closed, _match[PopoverStates.Closed] = PopoverStates.Open, _match))\n });\n}, _reducers[ActionTypes.ClosePopover] = function (state) {\n if (state.popoverState === PopoverStates.Closed) return state;\n return _extends({}, state, {\n popoverState: PopoverStates.Closed\n });\n}, _reducers[ActionTypes.SetButton] = function (state, action) {\n if (state.button === action.button) return state;\n return _extends({}, state, {\n button: action.button\n });\n}, _reducers[ActionTypes.SetButtonId] = function (state, action) {\n if (state.buttonId === action.buttonId) return state;\n return _extends({}, state, {\n buttonId: action.buttonId\n });\n}, _reducers[ActionTypes.SetPanel] = function (state, action) {\n if (state.panel === action.panel) return state;\n return _extends({}, state, {\n panel: action.panel\n });\n}, _reducers[ActionTypes.SetPanelId] = function (state, action) {\n if (state.panelId === action.panelId) return state;\n return _extends({}, state, {\n panelId: action.panelId\n });\n}, _reducers);\nvar PopoverContext = /*#__PURE__*/createContext(null);\nPopoverContext.displayName = 'PopoverContext';\n\nfunction usePopoverContext(component) {\n var context = useContext(PopoverContext);\n\n if (context === null) {\n var err = new Error(\"<\" + component + \" /> is missing a parent <\" + Popover.name + \" /> component.\");\n if (Error.captureStackTrace) Error.captureStackTrace(err, usePopoverContext);\n throw err;\n }\n\n return context;\n}\n\nvar PopoverAPIContext = /*#__PURE__*/createContext(null);\nPopoverAPIContext.displayName = 'PopoverAPIContext';\n\nfunction usePopoverAPIContext(component) {\n var context = useContext(PopoverAPIContext);\n\n if (context === null) {\n var err = new Error(\"<\" + component + \" /> is missing a parent <\" + Popover.name + \" /> component.\");\n if (Error.captureStackTrace) Error.captureStackTrace(err, usePopoverAPIContext);\n throw err;\n }\n\n return context;\n}\n\nvar PopoverGroupContext = /*#__PURE__*/createContext(null);\nPopoverGroupContext.displayName = 'PopoverGroupContext';\n\nfunction usePopoverGroupContext() {\n return useContext(PopoverGroupContext);\n}\n\nvar PopoverPanelContext = /*#__PURE__*/createContext(null);\nPopoverPanelContext.displayName = 'PopoverPanelContext';\n\nfunction usePopoverPanelContext() {\n return useContext(PopoverPanelContext);\n}\n\nfunction stateReducer(state, action) {\n return match(action.type, reducers, state, action);\n} // ---\n\n\nvar DEFAULT_POPOVER_TAG = 'div';\nfunction Popover(props) {\n var _match2;\n\n var buttonId = \"headlessui-popover-button-\" + useId();\n var panelId = \"headlessui-popover-panel-\" + useId();\n var reducerBag = useReducer(stateReducer, {\n popoverState: PopoverStates.Closed,\n button: null,\n buttonId: buttonId,\n panel: null,\n panelId: panelId\n });\n var _reducerBag$ = reducerBag[0],\n popoverState = _reducerBag$.popoverState,\n button = _reducerBag$.button,\n panel = _reducerBag$.panel,\n dispatch = reducerBag[1];\n useEffect(function () {\n return dispatch({\n type: ActionTypes.SetButtonId,\n buttonId: buttonId\n });\n }, [buttonId, dispatch]);\n useEffect(function () {\n return dispatch({\n type: ActionTypes.SetPanelId,\n panelId: panelId\n });\n }, [panelId, dispatch]);\n var registerBag = useMemo(function () {\n return {\n buttonId: buttonId,\n panelId: panelId,\n close: function close() {\n return dispatch({\n type: ActionTypes.ClosePopover\n });\n }\n };\n }, [buttonId, panelId, dispatch]);\n var groupContext = usePopoverGroupContext();\n var registerPopover = groupContext == null ? void 0 : groupContext.registerPopover;\n var isFocusWithinPopoverGroup = useCallback(function () {\n var _groupContext$isFocus;\n\n return (_groupContext$isFocus = groupContext == null ? void 0 : groupContext.isFocusWithinPopoverGroup()) != null ? _groupContext$isFocus : (button == null ? void 0 : button.contains(document.activeElement)) || (panel == null ? void 0 : panel.contains(document.activeElement));\n }, [groupContext, button, panel]);\n useEffect(function () {\n return registerPopover == null ? void 0 : registerPopover(registerBag);\n }, [registerPopover, registerBag]); // Handle focus out\n\n useWindowEvent('focus', function () {\n if (popoverState !== PopoverStates.Open) return;\n if (isFocusWithinPopoverGroup()) return;\n if (!button) return;\n if (!panel) return;\n dispatch({\n type: ActionTypes.ClosePopover\n });\n }, true); // Handle outside click\n\n useWindowEvent('mousedown', function (event) {\n var target = event.target;\n if (popoverState !== PopoverStates.Open) return;\n if (button == null ? void 0 : button.contains(target)) return;\n if (panel == null ? void 0 : panel.contains(target)) return;\n dispatch({\n type: ActionTypes.ClosePopover\n });\n\n if (!isFocusableElement(target, FocusableMode.Loose)) {\n event.preventDefault();\n button == null ? void 0 : button.focus();\n }\n });\n var close = useCallback(function (focusableElement) {\n dispatch({\n type: ActionTypes.ClosePopover\n });\n\n var restoreElement = function () {\n if (!focusableElement) return button;\n if (focusableElement instanceof HTMLElement) return focusableElement;\n if (focusableElement.current instanceof HTMLElement) return focusableElement.current;\n return button;\n }();\n\n restoreElement == null ? void 0 : restoreElement.focus();\n }, [dispatch, button]);\n var api = useMemo(function () {\n return {\n close: close\n };\n }, [close]);\n var slot = useMemo(function () {\n return {\n open: popoverState === PopoverStates.Open,\n close: close\n };\n }, [popoverState, close]);\n return React.createElement(PopoverContext.Provider, {\n value: reducerBag\n }, React.createElement(PopoverAPIContext.Provider, {\n value: api\n }, React.createElement(OpenClosedProvider, {\n value: match(popoverState, (_match2 = {}, _match2[PopoverStates.Open] = State.Open, _match2[PopoverStates.Closed] = State.Closed, _match2))\n }, render({\n props: props,\n slot: slot,\n defaultTag: DEFAULT_POPOVER_TAG,\n name: 'Popover'\n }))));\n} // ---\n\nvar DEFAULT_BUTTON_TAG = 'button';\nvar Button = /*#__PURE__*/forwardRefWithAs(function Button(props, ref) {\n var _usePopoverContext = usePopoverContext([Popover.name, Button.name].join('.')),\n state = _usePopoverContext[0],\n dispatch = _usePopoverContext[1];\n\n var internalButtonRef = useRef(null);\n var groupContext = usePopoverGroupContext();\n var closeOthers = groupContext == null ? void 0 : groupContext.closeOthers;\n var panelContext = usePopoverPanelContext();\n var isWithinPanel = panelContext === null ? false : panelContext === state.panelId;\n var buttonRef = useSyncRefs(internalButtonRef, ref, isWithinPanel ? null : function (button) {\n return dispatch({\n type: ActionTypes.SetButton,\n button: button\n });\n });\n var withinPanelButtonRef = useSyncRefs(internalButtonRef, ref); // TODO: Revisit when handling Tab/Shift+Tab when using Portal's\n\n var activeElementRef = useRef(null);\n var previousActiveElementRef = useRef(typeof window === 'undefined' ? null : document.activeElement);\n useWindowEvent('focus', function () {\n previousActiveElementRef.current = activeElementRef.current;\n activeElementRef.current = document.activeElement;\n }, true);\n var handleKeyDown = useCallback(function (event) {\n var _state$button;\n\n if (isWithinPanel) {\n if (state.popoverState === PopoverStates.Closed) return;\n\n switch (event.key) {\n case Keys.Space:\n case Keys.Enter:\n event.preventDefault(); // Prevent triggering a *click* event\n\n event.stopPropagation();\n dispatch({\n type: ActionTypes.ClosePopover\n });\n (_state$button = state.button) == null ? void 0 : _state$button.focus(); // Re-focus the original opening Button\n\n break;\n }\n } else {\n switch (event.key) {\n case Keys.Space:\n case Keys.Enter:\n event.preventDefault(); // Prevent triggering a *click* event\n\n event.stopPropagation();\n if (state.popoverState === PopoverStates.Closed) closeOthers == null ? void 0 : closeOthers(state.buttonId);\n dispatch({\n type: ActionTypes.TogglePopover\n });\n break;\n\n case Keys.Escape:\n if (state.popoverState !== PopoverStates.Open) return closeOthers == null ? void 0 : closeOthers(state.buttonId);\n if (!internalButtonRef.current) return;\n if (!internalButtonRef.current.contains(document.activeElement)) return;\n dispatch({\n type: ActionTypes.ClosePopover\n });\n break;\n\n case Keys.Tab:\n if (state.popoverState !== PopoverStates.Open) return;\n if (!state.panel) return;\n if (!state.button) return; // TODO: Revisit when handling Tab/Shift+Tab when using Portal's\n\n if (event.shiftKey) {\n var _state$button2;\n\n // Check if the last focused element exists, and check that it is not inside button or panel itself\n if (!previousActiveElementRef.current) return;\n if ((_state$button2 = state.button) == null ? void 0 : _state$button2.contains(previousActiveElementRef.current)) return;\n if (state.panel.contains(previousActiveElementRef.current)) return; // Check if the last focused element is *after* the button in the DOM\n\n var focusableElements = getFocusableElements();\n var previousIdx = focusableElements.indexOf(previousActiveElementRef.current);\n var buttonIdx = focusableElements.indexOf(state.button);\n if (buttonIdx > previousIdx) return;\n event.preventDefault();\n event.stopPropagation();\n focusIn(state.panel, Focus.Last);\n } else {\n event.preventDefault();\n event.stopPropagation();\n focusIn(state.panel, Focus.First);\n }\n\n break;\n }\n }\n }, [dispatch, state.popoverState, state.buttonId, state.button, state.panel, internalButtonRef, closeOthers, isWithinPanel]);\n var handleKeyUp = useCallback(function (event) {\n var _state$button3;\n\n if (isWithinPanel) return;\n\n if (event.key === Keys.Space) {\n // Required for firefox, event.preventDefault() in handleKeyDown for\n // the Space key doesn't cancel the handleKeyUp, which in turn\n // triggers a *click*.\n event.preventDefault();\n }\n\n if (state.popoverState !== PopoverStates.Open) return;\n if (!state.panel) return;\n if (!state.button) return; // TODO: Revisit when handling Tab/Shift+Tab when using Portal's\n\n switch (event.key) {\n case Keys.Tab:\n // Check if the last focused element exists, and check that it is not inside button or panel itself\n if (!previousActiveElementRef.current) return;\n if ((_state$button3 = state.button) == null ? void 0 : _state$button3.contains(previousActiveElementRef.current)) return;\n if (state.panel.contains(previousActiveElementRef.current)) return; // Check if the last focused element is *after* the button in the DOM\n\n var focusableElements = getFocusableElements();\n var previousIdx = focusableElements.indexOf(previousActiveElementRef.current);\n var buttonIdx = focusableElements.indexOf(state.button);\n if (buttonIdx > previousIdx) return;\n event.preventDefault();\n event.stopPropagation();\n focusIn(state.panel, Focus.Last);\n break;\n }\n }, [state.popoverState, state.panel, state.button, isWithinPanel]);\n var handleClick = useCallback(function (event) {\n if (isDisabledReactIssue7711(event.currentTarget)) return;\n if (props.disabled) return;\n\n if (isWithinPanel) {\n var _state$button4;\n\n dispatch({\n type: ActionTypes.ClosePopover\n });\n (_state$button4 = state.button) == null ? void 0 : _state$button4.focus(); // Re-focus the original opening Button\n } else {\n var _state$button5;\n\n if (state.popoverState === PopoverStates.Closed) closeOthers == null ? void 0 : closeOthers(state.buttonId);\n (_state$button5 = state.button) == null ? void 0 : _state$button5.focus();\n dispatch({\n type: ActionTypes.TogglePopover\n });\n }\n }, [dispatch, state.button, state.popoverState, state.buttonId, props.disabled, closeOthers, isWithinPanel]);\n var slot = useMemo(function () {\n return {\n open: state.popoverState === PopoverStates.Open\n };\n }, [state]);\n var type = useResolveButtonType(props, internalButtonRef);\n var passthroughProps = props;\n var propsWeControl = isWithinPanel ? {\n ref: withinPanelButtonRef,\n type: type,\n onKeyDown: handleKeyDown,\n onClick: handleClick\n } : {\n ref: buttonRef,\n id: state.buttonId,\n type: type,\n 'aria-expanded': props.disabled ? undefined : state.popoverState === PopoverStates.Open,\n 'aria-controls': state.panel ? state.panelId : undefined,\n onKeyDown: handleKeyDown,\n onKeyUp: handleKeyUp,\n onClick: handleClick\n };\n return render({\n props: _extends({}, passthroughProps, propsWeControl),\n slot: slot,\n defaultTag: DEFAULT_BUTTON_TAG,\n name: 'Popover.Button'\n });\n}); // ---\n\nvar DEFAULT_OVERLAY_TAG = 'div';\nvar OverlayRenderFeatures = Features.RenderStrategy | Features.Static;\nvar Overlay = /*#__PURE__*/forwardRefWithAs(function Overlay(props, ref) {\n var _usePopoverContext2 = usePopoverContext([Popover.name, Overlay.name].join('.')),\n popoverState = _usePopoverContext2[0].popoverState,\n dispatch = _usePopoverContext2[1];\n\n var overlayRef = useSyncRefs(ref);\n var id = \"headlessui-popover-overlay-\" + useId();\n var usesOpenClosedState = useOpenClosed();\n\n var visible = function () {\n if (usesOpenClosedState !== null) {\n return usesOpenClosedState === State.Open;\n }\n\n return popoverState === PopoverStates.Open;\n }();\n\n var handleClick = useCallback(function (event) {\n if (isDisabledReactIssue7711(event.currentTarget)) return event.preventDefault();\n dispatch({\n type: ActionTypes.ClosePopover\n });\n }, [dispatch]);\n var slot = useMemo(function () {\n return {\n open: popoverState === PopoverStates.Open\n };\n }, [popoverState]);\n var propsWeControl = {\n ref: overlayRef,\n id: id,\n 'aria-hidden': true,\n onClick: handleClick\n };\n var passthroughProps = props;\n return render({\n props: _extends({}, passthroughProps, propsWeControl),\n slot: slot,\n defaultTag: DEFAULT_OVERLAY_TAG,\n features: OverlayRenderFeatures,\n visible: visible,\n name: 'Popover.Overlay'\n });\n}); // ---\n\nvar DEFAULT_PANEL_TAG = 'div';\nvar PanelRenderFeatures = Features.RenderStrategy | Features.Static;\nvar Panel = /*#__PURE__*/forwardRefWithAs(function Panel(props, ref) {\n var _props$focus = props.focus,\n focus = _props$focus === void 0 ? false : _props$focus,\n passthroughProps = _objectWithoutPropertiesLoose(props, [\"focus\"]);\n\n var _usePopoverContext3 = usePopoverContext([Popover.name, Panel.name].join('.')),\n state = _usePopoverContext3[0],\n dispatch = _usePopoverContext3[1];\n\n var _usePopoverAPIContext = usePopoverAPIContext([Popover.name, Panel.name].join('.')),\n close = _usePopoverAPIContext.close;\n\n var internalPanelRef = useRef(null);\n var panelRef = useSyncRefs(internalPanelRef, ref, function (panel) {\n dispatch({\n type: ActionTypes.SetPanel,\n panel: panel\n });\n });\n var usesOpenClosedState = useOpenClosed();\n\n var visible = function () {\n if (usesOpenClosedState !== null) {\n return usesOpenClosedState === State.Open;\n }\n\n return state.popoverState === PopoverStates.Open;\n }();\n\n var handleKeyDown = useCallback(function (event) {\n var _state$button6;\n\n switch (event.key) {\n case Keys.Escape:\n if (state.popoverState !== PopoverStates.Open) return;\n if (!internalPanelRef.current) return;\n if (!internalPanelRef.current.contains(document.activeElement)) return;\n event.preventDefault();\n dispatch({\n type: ActionTypes.ClosePopover\n });\n (_state$button6 = state.button) == null ? void 0 : _state$button6.focus();\n break;\n }\n }, [state, internalPanelRef, dispatch]); // Unlink on \"unmount\" myself\n\n useEffect(function () {\n return function () {\n return dispatch({\n type: ActionTypes.SetPanel,\n panel: null\n });\n };\n }, [dispatch]); // Unlink on \"unmount\" children\n\n useEffect(function () {\n var _props$unmount;\n\n if (state.popoverState === PopoverStates.Closed && ((_props$unmount = props.unmount) != null ? _props$unmount : true)) {\n dispatch({\n type: ActionTypes.SetPanel,\n panel: null\n });\n }\n }, [state.popoverState, props.unmount, dispatch]); // Move focus within panel\n\n useEffect(function () {\n if (!focus) return;\n if (state.popoverState !== PopoverStates.Open) return;\n if (!internalPanelRef.current) return;\n var activeElement = document.activeElement;\n if (internalPanelRef.current.contains(activeElement)) return; // Already focused within Dialog\n\n focusIn(internalPanelRef.current, Focus.First);\n }, [focus, internalPanelRef, state.popoverState]); // Handle Tab / Shift+Tab focus positioning\n\n useWindowEvent('keydown', function (event) {\n if (state.popoverState !== PopoverStates.Open) return;\n if (!internalPanelRef.current) return;\n if (event.key !== Keys.Tab) return;\n if (!document.activeElement) return;\n if (!internalPanelRef.current) return;\n if (!internalPanelRef.current.contains(document.activeElement)) return; // We will take-over the default tab behaviour so that we have a bit\n // control over what is focused next. It will behave exactly the same,\n // but it will also \"fix\" some issues based on whether you are using a\n // Portal or not.\n\n event.preventDefault();\n var result = focusIn(internalPanelRef.current, event.shiftKey ? Focus.Previous : Focus.Next);\n\n if (result === FocusResult.Underflow) {\n var _state$button7;\n\n return (_state$button7 = state.button) == null ? void 0 : _state$button7.focus();\n } else if (result === FocusResult.Overflow) {\n if (!state.button) return;\n var elements = getFocusableElements();\n var buttonIdx = elements.indexOf(state.button);\n var nextElements = elements.splice(buttonIdx + 1) // Elements after button\n .filter(function (element) {\n var _internalPanelRef$cur;\n\n return !((_internalPanelRef$cur = internalPanelRef.current) == null ? void 0 : _internalPanelRef$cur.contains(element));\n }); // Ignore items in panel\n // Try to focus the next element, however it could fail if we are in a\n // Portal that happens to be the very last one in the DOM. In that\n // case we would Error (because nothing after the button is\n // focusable). Therefore we will try and focus the very first item in\n // the document.body.\n\n if (focusIn(nextElements, Focus.First) === FocusResult.Error) {\n focusIn(document.body, Focus.First);\n }\n }\n }); // Handle focus out when we are in special \"focus\" mode\n\n useWindowEvent('focus', function () {\n var _internalPanelRef$cur2;\n\n if (!focus) return;\n if (state.popoverState !== PopoverStates.Open) return;\n if (!internalPanelRef.current) return;\n if ((_internalPanelRef$cur2 = internalPanelRef.current) == null ? void 0 : _internalPanelRef$cur2.contains(document.activeElement)) return;\n dispatch({\n type: ActionTypes.ClosePopover\n });\n }, true);\n var slot = useMemo(function () {\n return {\n open: state.popoverState === PopoverStates.Open,\n close: close\n };\n }, [state, close]);\n var propsWeControl = {\n ref: panelRef,\n id: state.panelId,\n onKeyDown: handleKeyDown\n };\n return React.createElement(PopoverPanelContext.Provider, {\n value: state.panelId\n }, render({\n props: _extends({}, passthroughProps, propsWeControl),\n slot: slot,\n defaultTag: DEFAULT_PANEL_TAG,\n features: PanelRenderFeatures,\n visible: visible,\n name: 'Popover.Panel'\n }));\n}); // ---\n\nvar DEFAULT_GROUP_TAG = 'div';\n\nfunction Group(props) {\n var groupRef = useRef(null);\n\n var _useState = useState([]),\n popovers = _useState[0],\n setPopovers = _useState[1];\n\n var unregisterPopover = useCallback(function (registerbag) {\n setPopovers(function (existing) {\n var idx = existing.indexOf(registerbag);\n\n if (idx !== -1) {\n var clone = existing.slice();\n clone.splice(idx, 1);\n return clone;\n }\n\n return existing;\n });\n }, [setPopovers]);\n var registerPopover = useCallback(function (registerbag) {\n setPopovers(function (existing) {\n return [].concat(existing, [registerbag]);\n });\n return function () {\n return unregisterPopover(registerbag);\n };\n }, [setPopovers, unregisterPopover]);\n var isFocusWithinPopoverGroup = useCallback(function () {\n var _groupRef$current;\n\n var element = document.activeElement;\n if ((_groupRef$current = groupRef.current) == null ? void 0 : _groupRef$current.contains(element)) return true; // Check if the focus is in one of the button or panel elements. This is important in case you are rendering inside a Portal.\n\n return popovers.some(function (bag) {\n var _document$getElementB, _document$getElementB2;\n\n return ((_document$getElementB = document.getElementById(bag.buttonId)) == null ? void 0 : _document$getElementB.contains(element)) || ((_document$getElementB2 = document.getElementById(bag.panelId)) == null ? void 0 : _document$getElementB2.contains(element));\n });\n }, [groupRef, popovers]);\n var closeOthers = useCallback(function (buttonId) {\n for (var _iterator = _createForOfIteratorHelperLoose(popovers), _step; !(_step = _iterator()).done;) {\n var popover = _step.value;\n if (popover.buttonId !== buttonId) popover.close();\n }\n }, [popovers]);\n var contextBag = useMemo(function () {\n return {\n registerPopover: registerPopover,\n unregisterPopover: unregisterPopover,\n isFocusWithinPopoverGroup: isFocusWithinPopoverGroup,\n closeOthers: closeOthers\n };\n }, [registerPopover, unregisterPopover, isFocusWithinPopoverGroup, closeOthers]);\n var slot = useMemo(function () {\n return {};\n }, []);\n var propsWeControl = {\n ref: groupRef\n };\n var passthroughProps = props;\n return React.createElement(PopoverGroupContext.Provider, {\n value: contextBag\n }, render({\n props: _extends({}, passthroughProps, propsWeControl),\n slot: slot,\n defaultTag: DEFAULT_GROUP_TAG,\n name: 'Popover.Group'\n }));\n} // ---\n\n\nPopover.Button = Button;\nPopover.Overlay = Overlay;\nPopover.Panel = Panel;\nPopover.Group = Group;\n\nexport { Popover };\n//# sourceMappingURL=popover.esm.js.map\n","import { useState } from 'react';\nimport { useIsoMorphicEffect } from './use-iso-morphic-effect.esm.js';\n\nfunction resolveType(props) {\n var _props$as;\n\n if (props.type) return props.type;\n var tag = (_props$as = props.as) != null ? _props$as : 'button';\n if (typeof tag === 'string' && tag.toLowerCase() === 'button') return 'button';\n return undefined;\n}\n\nfunction useResolveButtonType(props, ref) {\n var _useState = useState(function () {\n return resolveType(props);\n }),\n type = _useState[0],\n setType = _useState[1];\n\n useIsoMorphicEffect(function () {\n setType(resolveType(props));\n }, [props.type, props.as]);\n useIsoMorphicEffect(function () {\n if (type) return;\n if (!ref.current) return;\n\n if (ref.current instanceof HTMLButtonElement && !ref.current.hasAttribute('type')) {\n setType('button');\n }\n }, [type, ref]);\n return type;\n}\n\nexport { useResolveButtonType };\n//# sourceMappingURL=use-resolve-button-type.esm.js.map\n"],"names":["_reducers","PopoverStates","ActionTypes","resolveType","props","_props$as","type","tag","as","toLowerCase","reducers","TogglePopover","state","_match","popoverState","Open","Closed","ClosePopover","SetButton","action","button","SetButtonId","buttonId","SetPanel","panel","SetPanelId","panelId","PopoverContext","createContext","usePopoverContext","component","context","useContext","err","Error","Popover","name","captureStackTrace","displayName","PopoverAPIContext","usePopoverAPIContext","PopoverGroupContext","usePopoverGroupContext","PopoverPanelContext","stateReducer","_match2","reducerBag","useReducer","_reducerBag$","dispatch","useEffect","registerBag","useMemo","close","groupContext","registerPopover","isFocusWithinPopoverGroup","useCallback","_groupContext$isFocus","contains","document","activeElement","event","target","preventDefault","focus","focusableElement","restoreElement","HTMLElement","current","api","slot","open","Provider","value","defaultTag","Button","ref","_usePopoverContext","join","internalButtonRef","useRef","closeOthers","panelContext","isWithinPanel","buttonRef","withinPanelButtonRef","activeElementRef","previousActiveElementRef","window","handleKeyDown","_state$button","key","stopPropagation","shiftKey","_state$button2","focusableElements","previousIdx","indexOf","handleKeyUp","_state$button3","handleClick","_state$button4","_state$button5","currentTarget","disabled","_useState","useState","setType","HTMLButtonElement","hasAttribute","useResolveButtonType","passthroughProps","propsWeControl","onKeyDown","onClick","id","undefined","onKeyUp","OverlayRenderFeatures","Overlay","_usePopoverContext2","overlayRef","usesOpenClosedState","visible","features","PanelRenderFeatures","Panel","_props$focus","_usePopoverContext3","internalPanelRef","panelRef","_state$button6","_props$unmount","unmount","_state$button7","result","elements","buttonIdx","nextElements","splice","filter","element","_internalPanelRef$cur","body","_internalPanelRef$cur2","Group","groupRef","popovers","setPopovers","unregisterPopover","registerbag","existing","idx","clone","slice","concat","_groupRef$current","some","bag","_document$getElementB","_document$getElementB2","getElementById","_step","_iterator","done","popover","contextBag"],"sourceRoot":""}