import { jsx, jsxs } from 'react/jsx-runtime';
import * as React from 'react';
import React__default, { forwardRef, useRef, useEffect, useCallback } from 'react';
import { a as getAugmentedNamespace, c as cx } from './index-De1g9FRV.js';
import { d as drillDownStyles } from './DrillDown.module-D1Bf9_yP.js';
import { t as tabbable, f as focusable, i as isTabbable, g as getTabIndex, b as isFocusable, c as index_esm } from './usePopoverTransitionStates-CDXCdyKa.js';
import { u as useDrillDownContext } from './useDrillDownContext-iUvoTget.js';
import { F as Flex } from './Flex-DOUtHiPi.js';
import { B as Button } from './Button-Bnt8XUI7.js';
import { T as Text } from './Text-J5YtSSXY.js';
import { S as SvgClose } from './close-DZj38AEh.js';
import { c as childrenToString } from './childrenToString-Bz9MqbHb.js';
import { useTrackingId } from './useTrackingId.js';

var focusTrapReact = {exports: {}};

/*!
* focus-trap 7.7.1
* @license MIT, https://github.com/focus-trap/focus-trap/blob/master/LICENSE
*/

function _arrayLikeToArray(r, a) {
  (null == a || a > r.length) && (a = r.length);
  for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
  return n;
}
function _arrayWithoutHoles(r) {
  if (Array.isArray(r)) return _arrayLikeToArray(r);
}
function _createForOfIteratorHelper(r, e) {
  var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
  if (!t) {
    if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e) {
      t && (r = t);
      var n = 0,
        F = function () {};
      return {
        s: F,
        n: function () {
          return n >= r.length ? {
            done: true
          } : {
            done: false,
            value: r[n++]
          };
        },
        e: function (r) {
          throw r;
        },
        f: F
      };
    }
    throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
  }
  var o,
    a = true,
    u = false;
  return {
    s: function () {
      t = t.call(r);
    },
    n: function () {
      var r = t.next();
      return a = r.done, r;
    },
    e: function (r) {
      u = true, o = r;
    },
    f: function () {
      try {
        a || null == t.return || t.return();
      } finally {
        if (u) throw o;
      }
    }
  };
}
function _defineProperty(e, r, t) {
  return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
    value: t,
    enumerable: true,
    configurable: true,
    writable: true
  }) : e[r] = t, e;
}
function _iterableToArray(r) {
  if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
}
function _nonIterableSpread() {
  throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
function ownKeys(e, r) {
  var t = Object.keys(e);
  if (Object.getOwnPropertySymbols) {
    var o = Object.getOwnPropertySymbols(e);
    r && (o = o.filter(function (r) {
      return Object.getOwnPropertyDescriptor(e, r).enumerable;
    })), t.push.apply(t, o);
  }
  return t;
}
function _objectSpread2(e) {
  for (var r = 1; r < arguments.length; r++) {
    var t = null != arguments[r] ? arguments[r] : {};
    r % 2 ? ownKeys(Object(t), true).forEach(function (r) {
      _defineProperty(e, r, t[r]);
    }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {
      Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
    });
  }
  return e;
}
function _toConsumableArray(r) {
  return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread();
}
function _toPrimitive(t, r) {
  if ("object" != typeof t || !t) return t;
  var e = t[Symbol.toPrimitive];
  if (void 0 !== e) {
    var i = e.call(t, r);
    if ("object" != typeof i) return i;
    throw new TypeError("@@toPrimitive must return a primitive value.");
  }
  return ("string" === r ? String : Number)(t);
}
function _toPropertyKey(t) {
  var i = _toPrimitive(t, "string");
  return "symbol" == typeof i ? i : i + "";
}
function _unsupportedIterableToArray(r, a) {
  if (r) {
    if ("string" == typeof r) return _arrayLikeToArray(r, a);
    var t = {}.toString.call(r).slice(8, -1);
    return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
  }
}

var activeFocusTraps = {
  // Returns the trap from the top of the stack.
  getActiveTrap: function getActiveTrap(trapStack) {
    if ((trapStack === null || trapStack === void 0 ? void 0 : trapStack.length) > 0) {
      return trapStack[trapStack.length - 1];
    }
    return null;
  },
  // Pauses the currently active trap, then adds a new trap to the stack.
  activateTrap: function activateTrap(trapStack, trap) {
    var activeTrap = activeFocusTraps.getActiveTrap(trapStack);
    if (trap !== activeTrap) {
      activeFocusTraps.pauseTrap(trapStack);
    }
    var trapIndex = trapStack.indexOf(trap);
    if (trapIndex === -1) {
      trapStack.push(trap);
    } else {
      // move this existing trap to the front of the queue
      trapStack.splice(trapIndex, 1);
      trapStack.push(trap);
    }
  },
  // Removes the trap from the top of the stack, then unpauses the next trap down.
  deactivateTrap: function deactivateTrap(trapStack, trap) {
    var trapIndex = trapStack.indexOf(trap);
    if (trapIndex !== -1) {
      trapStack.splice(trapIndex, 1);
    }
    activeFocusTraps.unpauseTrap(trapStack);
  },
  // Pauses the trap at the top of the stack.
  pauseTrap: function pauseTrap(trapStack) {
    var activeTrap = activeFocusTraps.getActiveTrap(trapStack);
    activeTrap === null || activeTrap === void 0 || activeTrap._setPausedState(true);
  },
  // Unpauses the trap at the top of the stack.
  unpauseTrap: function unpauseTrap(trapStack) {
    var activeTrap = activeFocusTraps.getActiveTrap(trapStack);
    if (activeTrap && !activeTrap._isManuallyPaused()) {
      activeTrap._setPausedState(false);
    }
  }
};
var isSelectableInput = function isSelectableInput(node) {
  return node.tagName && node.tagName.toLowerCase() === 'input' && typeof node.select === 'function';
};
var isEscapeEvent = function isEscapeEvent(e) {
  return (e === null || e === void 0 ? void 0 : e.key) === 'Escape' || (e === null || e === void 0 ? void 0 : e.key) === 'Esc' || (e === null || e === void 0 ? void 0 : e.keyCode) === 27;
};
var isTabEvent = function isTabEvent(e) {
  return (e === null || e === void 0 ? void 0 : e.key) === 'Tab' || (e === null || e === void 0 ? void 0 : e.keyCode) === 9;
};

// checks for TAB by default
var isKeyForward = function isKeyForward(e) {
  return isTabEvent(e) && !e.shiftKey;
};

// checks for SHIFT+TAB by default
var isKeyBackward = function isKeyBackward(e) {
  return isTabEvent(e) && e.shiftKey;
};
var delay = function delay(fn) {
  return setTimeout(fn, 0);
};

/**
 * Get an option's value when it could be a plain value, or a handler that provides
 *  the value.
 * @param {*} value Option's value to check.
 * @param {...*} [params] Any parameters to pass to the handler, if `value` is a function.
 * @returns {*} The `value`, or the handler's returned value.
 */
var valueOrHandler = function valueOrHandler(value) {
  for (var _len = arguments.length, params = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
    params[_key - 1] = arguments[_key];
  }
  return typeof value === 'function' ? value.apply(void 0, params) : value;
};
var getActualTarget = function getActualTarget(event) {
  // NOTE: If the trap is _inside_ a shadow DOM, event.target will always be the
  //  shadow host. However, event.target.composedPath() will be an array of
  //  nodes "clicked" from inner-most (the actual element inside the shadow) to
  //  outer-most (the host HTML document). If we have access to composedPath(),
  //  then use its first element; otherwise, fall back to event.target (and
  //  this only works for an _open_ shadow DOM; otherwise,
  //  composedPath()[0] === event.target always).
  return event.target.shadowRoot && typeof event.composedPath === 'function' ? event.composedPath()[0] : event.target;
};

// NOTE: this must be _outside_ `createFocusTrap()` to make sure all traps in this
//  current instance use the same stack if `userOptions.trapStack` isn't specified
var internalTrapStack = [];
var createFocusTrap = function createFocusTrap(elements, userOptions) {
  // SSR: a live trap shouldn't be created in this type of environment so this
  //  should be safe code to execute if the `document` option isn't specified
  var doc = (userOptions === null || userOptions === void 0 ? void 0 : userOptions.document) || document;
  var trapStack = (userOptions === null || userOptions === void 0 ? void 0 : userOptions.trapStack) || internalTrapStack;
  var config = _objectSpread2({
    returnFocusOnDeactivate: true,
    escapeDeactivates: true,
    delayInitialFocus: true,
    isolateSubtrees: false,
    isKeyForward: isKeyForward,
    isKeyBackward: isKeyBackward
  }, userOptions);
  var state = {
    // containers given to createFocusTrap()
    /** @type {Array<HTMLElement>} */
    containers: [],
    // list of objects identifying tabbable nodes in `containers` in the trap
    // NOTE: it's possible that a group has no tabbable nodes if nodes get removed while the trap
    //  is active, but the trap should never get to a state where there isn't at least one group
    //  with at least one tabbable node in it (that would lead to an error condition that would
    //  result in an error being thrown)
    /** @type {Array<{
     *    container: HTMLElement,
     *    tabbableNodes: Array<HTMLElement>, // empty if none
     *    focusableNodes: Array<HTMLElement>, // empty if none
     *    posTabIndexesFound: boolean,
     *    firstTabbableNode: HTMLElement|undefined,
     *    lastTabbableNode: HTMLElement|undefined,
     *    firstDomTabbableNode: HTMLElement|undefined,
     *    lastDomTabbableNode: HTMLElement|undefined,
     *    nextTabbableNode: (node: HTMLElement, forward: boolean) => HTMLElement|undefined
     *  }>}
     */
    containerGroups: [],
    // same order/length as `containers` list

    // references to objects in `containerGroups`, but only those that actually have
    //  tabbable nodes in them
    // NOTE: same order as `containers` and `containerGroups`, but __not necessarily__
    //  the same length
    tabbableGroups: [],
    // references to nodes that are siblings to the ancestors of this trap's containers.
    /** @type {Set<HTMLElement>} */
    adjacentElements: new Set(),
    // references to nodes that were inert before the trap was activated.
    /** @type {Set<HTMLElement>} */
    alreadyInert: new Set(),
    nodeFocusedBeforeActivation: null,
    mostRecentlyFocusedNode: null,
    active: false,
    paused: false,
    manuallyPaused: false,
    // timer ID for when delayInitialFocus is true and initial focus in this trap
    //  has been delayed during activation
    delayInitialFocusTimer: undefined,
    // the most recent KeyboardEvent for the configured nav key (typically [SHIFT+]TAB), if any
    recentNavEvent: undefined
  };
  var trap; // eslint-disable-line prefer-const -- some private functions reference it, and its methods reference private functions, so we must declare here and define later

  /**
   * Gets a configuration option value.
   * @param {Object|undefined} configOverrideOptions If true, and option is defined in this set,
   *  value will be taken from this object. Otherwise, value will be taken from base configuration.
   * @param {string} optionName Name of the option whose value is sought.
   * @param {string|undefined} [configOptionName] Name of option to use __instead of__ `optionName`
   *  IIF `configOverrideOptions` is not defined. Otherwise, `optionName` is used.
   */
  var getOption = function getOption(configOverrideOptions, optionName, configOptionName) {
    return configOverrideOptions && configOverrideOptions[optionName] !== undefined ? configOverrideOptions[optionName] : config[configOptionName || optionName];
  };

  /**
   * Finds the index of the container that contains the element.
   * @param {HTMLElement} element
   * @param {Event} [event] If available, and `element` isn't directly found in any container,
   *  the event's composed path is used to see if includes any known trap containers in the
   *  case where the element is inside a Shadow DOM.
   * @returns {number} Index of the container in either `state.containers` or
   *  `state.containerGroups` (the order/length of these lists are the same); -1
   *  if the element isn't found.
   */
  var findContainerIndex = function findContainerIndex(element, event) {
    var composedPath = typeof (event === null || event === void 0 ? void 0 : event.composedPath) === 'function' ? event.composedPath() : undefined;
    // NOTE: search `containerGroups` because it's possible a group contains no tabbable
    //  nodes, but still contains focusable nodes (e.g. if they all have `tabindex=-1`)
    //  and we still need to find the element in there
    return state.containerGroups.findIndex(function (_ref) {
      var container = _ref.container,
        tabbableNodes = _ref.tabbableNodes;
      return container.contains(element) || (// fall back to explicit tabbable search which will take into consideration any
      //  web components if the `tabbableOptions.getShadowRoot` option was used for
      //  the trap, enabling shadow DOM support in tabbable (`Node.contains()` doesn't
      //  look inside web components even if open)
      composedPath === null || composedPath === void 0 ? void 0 : composedPath.includes(container)) || tabbableNodes.find(function (node) {
        return node === element;
      });
    });
  };

  /**
   * Gets the node for the given option, which is expected to be an option that
   *  can be either a DOM node, a string that is a selector to get a node, `false`
   *  (if a node is explicitly NOT given), or a function that returns any of these
   *  values.
   * @param {string} optionName
   * @param {Object} options
   * @param {boolean} [options.hasFallback] True if the option could be a selector string
   *  and the option allows for a fallback scenario in the case where the selector is
   *  valid but does not match a node (i.e. the queried node doesn't exist in the DOM).
   * @param {Array} [options.params] Params to pass to the option if it's a function.
   * @returns {undefined | null | false | HTMLElement | SVGElement} Returns
   *  `undefined` if the option is not specified; `null` if the option didn't resolve
   *  to a node but `options.hasFallback=true`, `false` if the option resolved to `false`
   *  (node explicitly not given); otherwise, the resolved DOM node.
   * @throws {Error} If the option is set, not `false`, and is not, or does not
   *  resolve to a node, unless the option is a selector string and `options.hasFallback=true`.
   */
  var getNodeForOption = function getNodeForOption(optionName) {
    var _ref2 = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
      _ref2$hasFallback = _ref2.hasFallback,
      hasFallback = _ref2$hasFallback === void 0 ? false : _ref2$hasFallback,
      _ref2$params = _ref2.params,
      params = _ref2$params === void 0 ? [] : _ref2$params;
    var optionValue = config[optionName];
    if (typeof optionValue === 'function') {
      optionValue = optionValue.apply(void 0, _toConsumableArray(params));
    }
    if (optionValue === true) {
      optionValue = undefined; // use default value
    }
    if (!optionValue) {
      if (optionValue === undefined || optionValue === false) {
        return optionValue;
      }
      // else, empty string (invalid), null (invalid), 0 (invalid)

      throw new Error("`".concat(optionName, "` was specified but was not a node, or did not return a node"));
    }
    var node = optionValue; // could be HTMLElement, SVGElement, or non-empty string at this point

    if (typeof optionValue === 'string') {
      try {
        node = doc.querySelector(optionValue); // resolve to node, or null if fails
      } catch (err) {
        throw new Error("`".concat(optionName, "` appears to be an invalid selector; error=\"").concat(err.message, "\""));
      }
      if (!node) {
        if (!hasFallback) {
          throw new Error("`".concat(optionName, "` as selector refers to no known node"));
        }
        // else, `node` MUST be `null` because that's what `Document.querySelector()` returns
        //  if the selector is valid but doesn't match anything
      }
    }
    return node;
  };
  var getInitialFocusNode = function getInitialFocusNode() {
    var node = getNodeForOption('initialFocus', {
      hasFallback: true
    });

    // false explicitly indicates we want no initialFocus at all
    if (node === false) {
      return false;
    }
    if (node === undefined || node && !isFocusable(node, config.tabbableOptions)) {
      // option not specified nor focusable: use fallback options
      if (findContainerIndex(doc.activeElement) >= 0) {
        node = doc.activeElement;
      } else {
        var firstTabbableGroup = state.tabbableGroups[0];
        var firstTabbableNode = firstTabbableGroup && firstTabbableGroup.firstTabbableNode;

        // NOTE: `fallbackFocus` option function cannot return `false` (not supported)
        node = firstTabbableNode || getNodeForOption('fallbackFocus');
      }
    } else if (node === null) {
      // option is a VALID selector string that doesn't yield a node: use the `fallbackFocus`
      //  option instead of the default behavior when the option isn't specified at all
      node = getNodeForOption('fallbackFocus');
    }
    if (!node) {
      throw new Error('Your focus-trap needs to have at least one focusable element');
    }
    return node;
  };
  var updateTabbableNodes = function updateTabbableNodes() {
    state.containerGroups = state.containers.map(function (container) {
      var tabbableNodes = tabbable(container, config.tabbableOptions);

      // NOTE: if we have tabbable nodes, we must have focusable nodes; focusable nodes
      //  are a superset of tabbable nodes since nodes with negative `tabindex` attributes
      //  are focusable but not tabbable
      var focusableNodes = focusable(container, config.tabbableOptions);
      var firstTabbableNode = tabbableNodes.length > 0 ? tabbableNodes[0] : undefined;
      var lastTabbableNode = tabbableNodes.length > 0 ? tabbableNodes[tabbableNodes.length - 1] : undefined;
      var firstDomTabbableNode = focusableNodes.find(function (node) {
        return isTabbable(node);
      });
      var lastDomTabbableNode = focusableNodes.slice().reverse().find(function (node) {
        return isTabbable(node);
      });
      var posTabIndexesFound = !!tabbableNodes.find(function (node) {
        return getTabIndex(node) > 0;
      });
      return {
        container: container,
        tabbableNodes: tabbableNodes,
        focusableNodes: focusableNodes,
        /** True if at least one node with positive `tabindex` was found in this container. */
        posTabIndexesFound: posTabIndexesFound,
        /** First tabbable node in container, __tabindex__ order; `undefined` if none. */
        firstTabbableNode: firstTabbableNode,
        /** Last tabbable node in container, __tabindex__ order; `undefined` if none. */
        lastTabbableNode: lastTabbableNode,
        // NOTE: DOM order is NOT NECESSARILY "document position" order, but figuring that out
        //  would require more than just https://developer.mozilla.org/en-US/docs/Web/API/Node/compareDocumentPosition
        //  because that API doesn't work with Shadow DOM as well as it should (@see
        //  https://github.com/whatwg/dom/issues/320) and since this first/last is only needed, so far,
        //  to address an edge case related to positive tabindex support, this seems like a much easier,
        //  "close enough most of the time" alternative for positive tabindexes which should generally
        //  be avoided anyway...
        /** First tabbable node in container, __DOM__ order; `undefined` if none. */
        firstDomTabbableNode: firstDomTabbableNode,
        /** Last tabbable node in container, __DOM__ order; `undefined` if none. */
        lastDomTabbableNode: lastDomTabbableNode,
        /**
         * Finds the __tabbable__ node that follows the given node in the specified direction,
         *  in this container, if any.
         * @param {HTMLElement} node
         * @param {boolean} [forward] True if going in forward tab order; false if going
         *  in reverse.
         * @returns {HTMLElement|undefined} The next tabbable node, if any.
         */
        nextTabbableNode: function nextTabbableNode(node) {
          var forward = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
          var nodeIdx = tabbableNodes.indexOf(node);
          if (nodeIdx < 0) {
            // either not tabbable nor focusable, or was focused but not tabbable (negative tabindex):
            //  since `node` should at least have been focusable, we assume that's the case and mimic
            //  what browsers do, which is set focus to the next node in __document position order__,
            //  regardless of positive tabindexes, if any -- and for reasons explained in the NOTE
            //  above related to `firstDomTabbable` and `lastDomTabbable` properties, we fall back to
            //  basic DOM order
            if (forward) {
              return focusableNodes.slice(focusableNodes.indexOf(node) + 1).find(function (el) {
                return isTabbable(el);
              });
            }
            return focusableNodes.slice(0, focusableNodes.indexOf(node)).reverse().find(function (el) {
              return isTabbable(el);
            });
          }
          return tabbableNodes[nodeIdx + (forward ? 1 : -1)];
        }
      };
    });
    state.tabbableGroups = state.containerGroups.filter(function (group) {
      return group.tabbableNodes.length > 0;
    });

    // throw if no groups have tabbable nodes and we don't have a fallback focus node either
    if (state.tabbableGroups.length <= 0 && !getNodeForOption('fallbackFocus') // returning false not supported for this option
    ) {
      throw new Error('Your focus-trap must have at least one container with at least one tabbable node in it at all times');
    }

    // NOTE: Positive tabindexes are only properly supported in single-container traps because
    //  doing it across multiple containers where tabindexes could be all over the place
    //  would require Tabbable to support multiple containers, would require additional
    //  specialized Shadow DOM support, and would require Tabbable's multi-container support
    //  to look at those containers in document position order rather than user-provided
    //  order (as they are treated in Focus-trap, for legacy reasons). See discussion on
    //  https://github.com/focus-trap/focus-trap/issues/375 for more details.
    if (state.containerGroups.find(function (g) {
      return g.posTabIndexesFound;
    }) && state.containerGroups.length > 1) {
      throw new Error("At least one node with a positive tabindex was found in one of your focus-trap's multiple containers. Positive tabindexes are only supported in single-container focus-traps.");
    }
  };

  /**
   * Gets the current activeElement. If it's a web-component and has open shadow-root
   * it will recursively search inside shadow roots for the "true" activeElement.
   *
   * @param {Document | ShadowRoot} el
   *
   * @returns {HTMLElement} The element that currently has the focus
   **/
  var _getActiveElement = function getActiveElement(el) {
    var activeElement = el.activeElement;
    if (!activeElement) {
      return;
    }
    if (activeElement.shadowRoot && activeElement.shadowRoot.activeElement !== null) {
      return _getActiveElement(activeElement.shadowRoot);
    }
    return activeElement;
  };
  var _tryFocus = function tryFocus(node) {
    if (node === false) {
      return;
    }
    if (node === _getActiveElement(document)) {
      return;
    }
    if (!node || !node.focus) {
      _tryFocus(getInitialFocusNode());
      return;
    }
    node.focus({
      preventScroll: !!config.preventScroll
    });
    // NOTE: focus() API does not trigger focusIn event so set MRU node manually
    state.mostRecentlyFocusedNode = node;
    if (isSelectableInput(node)) {
      node.select();
    }
  };
  var getReturnFocusNode = function getReturnFocusNode(previousActiveElement) {
    var node = getNodeForOption('setReturnFocus', {
      params: [previousActiveElement]
    });
    return node ? node : node === false ? false : previousActiveElement;
  };

  /**
   * Finds the next node (in either direction) where focus should move according to a
   *  keyboard focus-in event.
   * @param {Object} params
   * @param {Node} [params.target] Known target __from which__ to navigate, if any.
   * @param {KeyboardEvent|FocusEvent} [params.event] Event to use if `target` isn't known (event
   *  will be used to determine the `target`). Ignored if `target` is specified.
   * @param {boolean} [params.isBackward] True if focus should move backward.
   * @returns {Node|undefined} The next node, or `undefined` if a next node couldn't be
   *  determined given the current state of the trap.
   */
  var findNextNavNode = function findNextNavNode(_ref3) {
    var target = _ref3.target,
      event = _ref3.event,
      _ref3$isBackward = _ref3.isBackward,
      isBackward = _ref3$isBackward === void 0 ? false : _ref3$isBackward;
    target = target || getActualTarget(event);
    updateTabbableNodes();
    var destinationNode = null;
    if (state.tabbableGroups.length > 0) {
      // make sure the target is actually contained in a group
      // NOTE: the target may also be the container itself if it's focusable
      //  with tabIndex='-1' and was given initial focus
      var containerIndex = findContainerIndex(target, event);
      var containerGroup = containerIndex >= 0 ? state.containerGroups[containerIndex] : undefined;
      if (containerIndex < 0) {
        // target not found in any group: quite possible focus has escaped the trap,
        //  so bring it back into...
        if (isBackward) {
          // ...the last node in the last group
          destinationNode = state.tabbableGroups[state.tabbableGroups.length - 1].lastTabbableNode;
        } else {
          // ...the first node in the first group
          destinationNode = state.tabbableGroups[0].firstTabbableNode;
        }
      } else if (isBackward) {
        // REVERSE

        // is the target the first tabbable node in a group?
        var startOfGroupIndex = state.tabbableGroups.findIndex(function (_ref4) {
          var firstTabbableNode = _ref4.firstTabbableNode;
          return target === firstTabbableNode;
        });
        if (startOfGroupIndex < 0 && (containerGroup.container === target || isFocusable(target, config.tabbableOptions) && !isTabbable(target, config.tabbableOptions) && !containerGroup.nextTabbableNode(target, false))) {
          // an exception case where the target is either the container itself, or
          //  a non-tabbable node that was given focus (i.e. tabindex is negative
          //  and user clicked on it or node was programmatically given focus)
          //  and is not followed by any other tabbable node, in which
          //  case, we should handle shift+tab as if focus were on the container's
          //  first tabbable node, and go to the last tabbable node of the LAST group
          startOfGroupIndex = containerIndex;
        }
        if (startOfGroupIndex >= 0) {
          // YES: then shift+tab should go to the last tabbable node in the
          //  previous group (and wrap around to the last tabbable node of
          //  the LAST group if it's the first tabbable node of the FIRST group)
          var destinationGroupIndex = startOfGroupIndex === 0 ? state.tabbableGroups.length - 1 : startOfGroupIndex - 1;
          var destinationGroup = state.tabbableGroups[destinationGroupIndex];
          destinationNode = getTabIndex(target) >= 0 ? destinationGroup.lastTabbableNode : destinationGroup.lastDomTabbableNode;
        } else if (!isTabEvent(event)) {
          // user must have customized the nav keys so we have to move focus manually _within_
          //  the active group: do this based on the order determined by tabbable()
          destinationNode = containerGroup.nextTabbableNode(target, false);
        }
      } else {
        // FORWARD

        // is the target the last tabbable node in a group?
        var lastOfGroupIndex = state.tabbableGroups.findIndex(function (_ref5) {
          var lastTabbableNode = _ref5.lastTabbableNode;
          return target === lastTabbableNode;
        });
        if (lastOfGroupIndex < 0 && (containerGroup.container === target || isFocusable(target, config.tabbableOptions) && !isTabbable(target, config.tabbableOptions) && !containerGroup.nextTabbableNode(target))) {
          // an exception case where the target is the container itself, or
          //  a non-tabbable node that was given focus (i.e. tabindex is negative
          //  and user clicked on it or node was programmatically given focus)
          //  and is not followed by any other tabbable node, in which
          //  case, we should handle tab as if focus were on the container's
          //  last tabbable node, and go to the first tabbable node of the FIRST group
          lastOfGroupIndex = containerIndex;
        }
        if (lastOfGroupIndex >= 0) {
          // YES: then tab should go to the first tabbable node in the next
          //  group (and wrap around to the first tabbable node of the FIRST
          //  group if it's the last tabbable node of the LAST group)
          var _destinationGroupIndex = lastOfGroupIndex === state.tabbableGroups.length - 1 ? 0 : lastOfGroupIndex + 1;
          var _destinationGroup = state.tabbableGroups[_destinationGroupIndex];
          destinationNode = getTabIndex(target) >= 0 ? _destinationGroup.firstTabbableNode : _destinationGroup.firstDomTabbableNode;
        } else if (!isTabEvent(event)) {
          // user must have customized the nav keys so we have to move focus manually _within_
          //  the active group: do this based on the order determined by tabbable()
          destinationNode = containerGroup.nextTabbableNode(target);
        }
      }
    } else {
      // no groups available
      // NOTE: the fallbackFocus option does not support returning false to opt-out
      destinationNode = getNodeForOption('fallbackFocus');
    }
    return destinationNode;
  };

  // This needs to be done on mousedown and touchstart instead of click
  // so that it precedes the focus event.
  var checkPointerDown = function checkPointerDown(e) {
    var target = getActualTarget(e);
    if (findContainerIndex(target, e) >= 0) {
      // allow the click since it ocurred inside the trap
      return;
    }
    if (valueOrHandler(config.clickOutsideDeactivates, e)) {
      // immediately deactivate the trap
      trap.deactivate({
        // NOTE: by setting `returnFocus: false`, deactivate() will do nothing,
        //  which will result in the outside click setting focus to the node
        //  that was clicked (and if not focusable, to "nothing"); by setting
        //  `returnFocus: true`, we'll attempt to re-focus the node originally-focused
        //  on activation (or the configured `setReturnFocus` node), whether the
        //  outside click was on a focusable node or not
        returnFocus: config.returnFocusOnDeactivate
      });
      return;
    }

    // This is needed for mobile devices.
    // (If we'll only let `click` events through,
    // then on mobile they will be blocked anyways if `touchstart` is blocked.)
    if (valueOrHandler(config.allowOutsideClick, e)) {
      // allow the click outside the trap to take place
      return;
    }

    // otherwise, prevent the click
    e.preventDefault();
  };

  // In case focus escapes the trap for some strange reason, pull it back in.
  // NOTE: the focusIn event is NOT cancelable, so if focus escapes, it may cause unexpected
  //  scrolling if the node that got focused was out of view; there's nothing we can do to
  //  prevent that from happening by the time we discover that focus escaped
  var checkFocusIn = function checkFocusIn(event) {
    var target = getActualTarget(event);
    var targetContained = findContainerIndex(target, event) >= 0;

    // In Firefox when you Tab out of an iframe the Document is briefly focused.
    if (targetContained || target instanceof Document) {
      if (targetContained) {
        state.mostRecentlyFocusedNode = target;
      }
    } else {
      // escaped! pull it back in to where it just left
      event.stopImmediatePropagation();

      // focus will escape if the MRU node had a positive tab index and user tried to nav forward;
      //  it will also escape if the MRU node had a 0 tab index and user tried to nav backward
      //  toward a node with a positive tab index
      var nextNode; // next node to focus, if we find one
      var navAcrossContainers = true;
      if (state.mostRecentlyFocusedNode) {
        if (getTabIndex(state.mostRecentlyFocusedNode) > 0) {
          // MRU container index must be >=0 otherwise we wouldn't have it as an MRU node...
          var mruContainerIdx = findContainerIndex(state.mostRecentlyFocusedNode);
          // there MAY not be any tabbable nodes in the container if there are at least 2 containers
          //  and the MRU node is focusable but not tabbable (focus-trap requires at least 1 container
          //  with at least one tabbable node in order to function, so this could be the other container
          //  with nothing tabbable in it)
          var tabbableNodes = state.containerGroups[mruContainerIdx].tabbableNodes;
          if (tabbableNodes.length > 0) {
            // MRU tab index MAY not be found if the MRU node is focusable but not tabbable
            var mruTabIdx = tabbableNodes.findIndex(function (node) {
              return node === state.mostRecentlyFocusedNode;
            });
            if (mruTabIdx >= 0) {
              if (config.isKeyForward(state.recentNavEvent)) {
                if (mruTabIdx + 1 < tabbableNodes.length) {
                  nextNode = tabbableNodes[mruTabIdx + 1];
                  navAcrossContainers = false;
                }
                // else, don't wrap within the container as focus should move to next/previous
                //  container
              } else {
                if (mruTabIdx - 1 >= 0) {
                  nextNode = tabbableNodes[mruTabIdx - 1];
                  navAcrossContainers = false;
                }
                // else, don't wrap within the container as focus should move to next/previous
                //  container
              }
              // else, don't find in container order without considering direction too
            }
          }
          // else, no tabbable nodes in that container (which means we must have at least one other
          //  container with at least one tabbable node in it, otherwise focus-trap would've thrown
          //  an error the last time updateTabbableNodes() was run): find next node among all known
          //  containers
        } else {
          // check to see if there's at least one tabbable node with a positive tab index inside
          //  the trap because focus seems to escape when navigating backward from a tabbable node
          //  with tabindex=0 when this is the case (instead of wrapping to the tabbable node with
          //  the greatest positive tab index like it should)
          if (!state.containerGroups.some(function (g) {
            return g.tabbableNodes.some(function (n) {
              return getTabIndex(n) > 0;
            });
          })) {
            // no containers with tabbable nodes with positive tab indexes which means the focus
            //  escaped for some other reason and we should just execute the fallback to the
            //  MRU node or initial focus node, if any
            navAcrossContainers = false;
          }
        }
      } else {
        // no MRU node means we're likely in some initial condition when the trap has just
        //  been activated and initial focus hasn't been given yet, in which case we should
        //  fall through to trying to focus the initial focus node, which is what should
        //  happen below at this point in the logic
        navAcrossContainers = false;
      }
      if (navAcrossContainers) {
        nextNode = findNextNavNode({
          // move FROM the MRU node, not event-related node (which will be the node that is
          //  outside the trap causing the focus escape we're trying to fix)
          target: state.mostRecentlyFocusedNode,
          isBackward: config.isKeyBackward(state.recentNavEvent)
        });
      }
      if (nextNode) {
        _tryFocus(nextNode);
      } else {
        _tryFocus(state.mostRecentlyFocusedNode || getInitialFocusNode());
      }
    }
    state.recentNavEvent = undefined; // clear
  };

  // Hijack key nav events on the first and last focusable nodes of the trap,
  // in order to prevent focus from escaping. If it escapes for even a
  // moment it can end up scrolling the page and causing confusion so we
  // kind of need to capture the action at the keydown phase.
  var checkKeyNav = function checkKeyNav(event) {
    var isBackward = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
    state.recentNavEvent = event;
    var destinationNode = findNextNavNode({
      event: event,
      isBackward: isBackward
    });
    if (destinationNode) {
      if (isTabEvent(event)) {
        // since tab natively moves focus, we wouldn't have a destination node unless we
        //  were on the edge of a container and had to move to the next/previous edge, in
        //  which case we want to prevent default to keep the browser from moving focus
        //  to where it normally would
        event.preventDefault();
      }
      _tryFocus(destinationNode);
    }
    // else, let the browser take care of [shift+]tab and move the focus
  };
  var checkTabKey = function checkTabKey(event) {
    if (config.isKeyForward(event) || config.isKeyBackward(event)) {
      checkKeyNav(event, config.isKeyBackward(event));
    }
  };

  // we use a different event phase for the Escape key to allow canceling the event and checking for this in escapeDeactivates
  var checkEscapeKey = function checkEscapeKey(event) {
    if (isEscapeEvent(event) && valueOrHandler(config.escapeDeactivates, event) !== false) {
      event.preventDefault();
      trap.deactivate();
    }
  };
  var checkClick = function checkClick(e) {
    var target = getActualTarget(e);
    if (findContainerIndex(target, e) >= 0) {
      return;
    }
    if (valueOrHandler(config.clickOutsideDeactivates, e)) {
      return;
    }
    if (valueOrHandler(config.allowOutsideClick, e)) {
      return;
    }
    e.preventDefault();
    e.stopImmediatePropagation();
  };

  //
  // EVENT LISTENERS
  //

  var addListeners = function addListeners() {
    if (!state.active) {
      return;
    }

    // There can be only one listening focus trap at a time
    activeFocusTraps.activateTrap(trapStack, trap);

    // Delay ensures that the focused element doesn't capture the event
    // that caused the focus trap activation.
    state.delayInitialFocusTimer = config.delayInitialFocus ? delay(function () {
      _tryFocus(getInitialFocusNode());
    }) : _tryFocus(getInitialFocusNode());
    doc.addEventListener('focusin', checkFocusIn, true);
    doc.addEventListener('mousedown', checkPointerDown, {
      capture: true,
      passive: false
    });
    doc.addEventListener('touchstart', checkPointerDown, {
      capture: true,
      passive: false
    });
    doc.addEventListener('click', checkClick, {
      capture: true,
      passive: false
    });
    doc.addEventListener('keydown', checkTabKey, {
      capture: true,
      passive: false
    });
    doc.addEventListener('keydown', checkEscapeKey);
    return trap;
  };

  /**
   * Traverses up the DOM from each of `containers`, collecting references to
   * the elements that are siblings to `container` or an ancestor of `container`.
   * @param {Array<HTMLElement>} containers
   */
  var collectAdjacentElements = function collectAdjacentElements(containers) {
    // Re-activate all adjacent elements & clear previous collection.
    if (state.active && !state.paused) {
      trap._setSubtreeIsolation(false);
    }
    state.adjacentElements.clear();
    state.alreadyInert.clear();

    // Collect all ancestors of all containers to avoid redundant processing.
    var containerAncestors = new Set();
    var adjacentElements = new Set();

    // Compile all elements adjacent to the focus trap containers & lineage.
    var _iterator = _createForOfIteratorHelper(containers),
      _step;
    try {
      for (_iterator.s(); !(_step = _iterator.n()).done;) {
        var container = _step.value;
        containerAncestors.add(container);
        var insideShadowRoot = typeof ShadowRoot !== 'undefined' && container.getRootNode() instanceof ShadowRoot;
        var current = container;
        while (current) {
          containerAncestors.add(current);
          var parent = current.parentElement;
          var siblings = [];
          if (parent) {
            siblings = parent.children;
          } else if (!parent && insideShadowRoot) {
            siblings = current.getRootNode().children;
            parent = current.getRootNode().host;
            insideShadowRoot = typeof ShadowRoot !== 'undefined' && parent.getRootNode() instanceof ShadowRoot;
          }

          // Add all the children, we'll remove container lineage later.
          var _iterator2 = _createForOfIteratorHelper(siblings),
            _step2;
          try {
            for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
              var child = _step2.value;
              adjacentElements.add(child);
            }
          } catch (err) {
            _iterator2.e(err);
          } finally {
            _iterator2.f();
          }
          current = parent;
        }
      }

      // Multi-container traps may overlap.
      // Remove elements within container lineages.
    } catch (err) {
      _iterator.e(err);
    } finally {
      _iterator.f();
    }
    containerAncestors.forEach(function (el) {
      adjacentElements["delete"](el);
    });
    state.adjacentElements = adjacentElements;
  };
  var removeListeners = function removeListeners() {
    if (!state.active) {
      return;
    }
    doc.removeEventListener('focusin', checkFocusIn, true);
    doc.removeEventListener('mousedown', checkPointerDown, true);
    doc.removeEventListener('touchstart', checkPointerDown, true);
    doc.removeEventListener('click', checkClick, true);
    doc.removeEventListener('keydown', checkTabKey, true);
    doc.removeEventListener('keydown', checkEscapeKey);
    return trap;
  };

  //
  // MUTATION OBSERVER
  //

  var checkDomRemoval = function checkDomRemoval(mutations) {
    var isFocusedNodeRemoved = mutations.some(function (mutation) {
      var removedNodes = Array.from(mutation.removedNodes);
      return removedNodes.some(function (node) {
        return node === state.mostRecentlyFocusedNode;
      });
    });

    // If the currently focused is removed then browsers will move focus to the
    // <body> element. If this happens, try to move focus back into the trap.
    if (isFocusedNodeRemoved) {
      _tryFocus(getInitialFocusNode());
    }
  };

  // Use MutationObserver - if supported - to detect if focused node is removed
  // from the DOM.
  var mutationObserver = typeof window !== 'undefined' && 'MutationObserver' in window ? new MutationObserver(checkDomRemoval) : undefined;
  var updateObservedNodes = function updateObservedNodes() {
    if (!mutationObserver) {
      return;
    }
    mutationObserver.disconnect();
    if (state.active && !state.paused) {
      state.containers.map(function (container) {
        mutationObserver.observe(container, {
          subtree: true,
          childList: true
        });
      });
    }
  };

  //
  // TRAP DEFINITION
  //

  trap = {
    get active() {
      return state.active;
    },
    get paused() {
      return state.paused;
    },
    activate: function activate(activateOptions) {
      if (state.active) {
        return this;
      }
      var onActivate = getOption(activateOptions, 'onActivate');
      var onPostActivate = getOption(activateOptions, 'onPostActivate');
      var checkCanFocusTrap = getOption(activateOptions, 'checkCanFocusTrap');

      // If a currently-active trap is isolating its subtree, we need to remove
      // that isolation to allow the new trap to find tabbable nodes.
      var preexistingTrap = activeFocusTraps.getActiveTrap(trapStack);
      var revertState = false;
      if (preexistingTrap && !preexistingTrap.paused) {
        preexistingTrap._setSubtreeIsolation(false);
        revertState = true;
      }
      try {
        if (!checkCanFocusTrap) {
          updateTabbableNodes();
        }
        state.active = true;
        state.paused = false;
        state.nodeFocusedBeforeActivation = _getActiveElement(doc);
        onActivate === null || onActivate === void 0 || onActivate();
        var finishActivation = function finishActivation() {
          if (checkCanFocusTrap) {
            updateTabbableNodes();
          }
          addListeners();
          updateObservedNodes();
          if (config.isolateSubtrees) {
            trap._setSubtreeIsolation(true);
          }
          onPostActivate === null || onPostActivate === void 0 || onPostActivate();
        };
        if (checkCanFocusTrap) {
          checkCanFocusTrap(state.containers.concat()).then(finishActivation, finishActivation);
          return this;
        }
        finishActivation();
      } catch (error) {
        // If our activation throws an exception and the stack hasn't changed,
        // we need to re-enable the prior trap's subtree isolation.
        if (preexistingTrap === activeFocusTraps.getActiveTrap(trapStack) && revertState) {
          preexistingTrap._setSubtreeIsolation(true);
        }
        throw error;
      }
      return this;
    },
    deactivate: function deactivate(deactivateOptions) {
      if (!state.active) {
        return this;
      }
      var options = _objectSpread2({
        onDeactivate: config.onDeactivate,
        onPostDeactivate: config.onPostDeactivate,
        checkCanReturnFocus: config.checkCanReturnFocus
      }, deactivateOptions);
      clearTimeout(state.delayInitialFocusTimer); // noop if undefined
      state.delayInitialFocusTimer = undefined;

      // Prior to removing this trap from the trapStack, we need to remove any applications of `inert`.
      // This allows the next trap down to update its tabbable nodes properly.
      //
      // If this trap is not top of the stack, don't change any current isolation.
      if (!state.paused) {
        trap._setSubtreeIsolation(false);
      }
      state.alreadyInert.clear();
      removeListeners();
      state.active = false;
      state.paused = false;
      updateObservedNodes();
      activeFocusTraps.deactivateTrap(trapStack, trap);
      var onDeactivate = getOption(options, 'onDeactivate');
      var onPostDeactivate = getOption(options, 'onPostDeactivate');
      var checkCanReturnFocus = getOption(options, 'checkCanReturnFocus');
      var returnFocus = getOption(options, 'returnFocus', 'returnFocusOnDeactivate');
      onDeactivate === null || onDeactivate === void 0 || onDeactivate();
      var finishDeactivation = function finishDeactivation() {
        delay(function () {
          if (returnFocus) {
            _tryFocus(getReturnFocusNode(state.nodeFocusedBeforeActivation));
          }
          onPostDeactivate === null || onPostDeactivate === void 0 || onPostDeactivate();
        });
      };
      if (returnFocus && checkCanReturnFocus) {
        checkCanReturnFocus(getReturnFocusNode(state.nodeFocusedBeforeActivation)).then(finishDeactivation, finishDeactivation);
        return this;
      }
      finishDeactivation();
      return this;
    },
    pause: function pause(pauseOptions) {
      if (!state.active) {
        return this;
      }
      state.manuallyPaused = true;
      return this._setPausedState(true, pauseOptions);
    },
    unpause: function unpause(unpauseOptions) {
      if (!state.active) {
        return this;
      }
      state.manuallyPaused = false;
      if (trapStack[trapStack.length - 1] !== this) {
        return this;
      }
      return this._setPausedState(false, unpauseOptions);
    },
    updateContainerElements: function updateContainerElements(containerElements) {
      var elementsAsArray = [].concat(containerElements).filter(Boolean);
      state.containers = elementsAsArray.map(function (element) {
        return typeof element === 'string' ? doc.querySelector(element) : element;
      });
      if (config.isolateSubtrees) {
        collectAdjacentElements(state.containers);
      }
      if (state.active) {
        updateTabbableNodes();
        if (config.isolateSubtrees && !state.paused) {
          trap._setSubtreeIsolation(true);
        }
      }
      updateObservedNodes();
      return this;
    }
  };
  Object.defineProperties(trap, {
    _isManuallyPaused: {
      value: function value() {
        return state.manuallyPaused;
      }
    },
    _setPausedState: {
      value: function value(paused, options) {
        if (state.paused === paused) {
          return this;
        }
        state.paused = paused;
        if (paused) {
          var onPause = getOption(options, 'onPause');
          var onPostPause = getOption(options, 'onPostPause');
          onPause === null || onPause === void 0 || onPause();
          removeListeners();
          updateObservedNodes();
          trap._setSubtreeIsolation(false);
          onPostPause === null || onPostPause === void 0 || onPostPause();
        } else {
          var onUnpause = getOption(options, 'onUnpause');
          var onPostUnpause = getOption(options, 'onPostUnpause');
          onUnpause === null || onUnpause === void 0 || onUnpause();
          trap._setSubtreeIsolation(true);
          updateTabbableNodes();
          addListeners();
          updateObservedNodes();
          onPostUnpause === null || onPostUnpause === void 0 || onPostUnpause();
        }
        return this;
      }
    },
    _setSubtreeIsolation: {
      value: function value(isEnabled) {
        if (config.isolateSubtrees) {
          state.adjacentElements.forEach(function (el) {
            if (isEnabled) {
              // check both attribute and property to ensure initial state is captured
              // correctly across different browsers and test environments (like JSDOM)
              var isInitiallyInert = el.inert || el.hasAttribute('inert');
              if (isInitiallyInert) {
                state.alreadyInert.add(el);
              }
              el.inert = true;
            } else {
              if (state.alreadyInert.has(el)) ; else {
                el.inert = false;
              }
            }
          });
        }
      }
    }
  });

  // initialize container elements
  trap.updateContainerElements(elements);
  return trap;
};

const focusTrap_esm = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
  __proto__: null,
  createFocusTrap
}, Symbol.toStringTag, { value: 'Module' }));

const require$$1 = /*@__PURE__*/getAugmentedNamespace(focusTrap_esm);

const require$$2 = /*@__PURE__*/getAugmentedNamespace(index_esm);

var hasRequiredFocusTrapReact;

function requireFocusTrapReact () {
	if (hasRequiredFocusTrapReact) return focusTrapReact.exports;
	hasRequiredFocusTrapReact = 1;

	function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
	var _exec$, _exec;
	function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
	function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || false, o.configurable = true, "value" in o && (o.writable = true), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
	function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), Object.defineProperty(e, "prototype", { writable: false }), e; }
	function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
	function _possibleConstructorReturn(t, e) { if (e && ("object" == _typeof(e) || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
	function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
	function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }
	function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
	function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: true, configurable: true } }), Object.defineProperty(t, "prototype", { writable: false }), e && _setPrototypeOf(t, e); }
	function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
	function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: true, configurable: true, writable: true }) : e[r] = t, e; }
	function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
	function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
	var React = React__default;
	var _require = require$$1,
	  createFocusTrap = _require.createFocusTrap;
	var _require2 = require$$2,
	  isFocusable = _require2.isFocusable;

	/**
	 * The major version of React currently running.
	 * @type {number}
	 */
	var reactVerMajor = parseInt((_exec$ = (_exec = /^(\d+)\./.exec(React.version)) === null || _exec === void 0 ? void 0 : _exec[1]) !== null && _exec$ !== void 0 ? _exec$ : 0, 10);

	/**
	 * @type {import('../index.d.ts').FocusTrap}
	 */
	var FocusTrap = /*#__PURE__*/function (_React$Component) {
	  function FocusTrap(props) {
	    var _this;
	    _classCallCheck(this, FocusTrap);
	    _this = _callSuper(this, FocusTrap, [props]);
	    /**
	     * Gets the node for the given option, which is expected to be an option that
	     *  can be either a DOM node, a string that is a selector to get a node, `false`
	     *  (if a node is explicitly NOT given), or a function that returns any of these
	     *  values.
	     * @param {string} optionName
	     * @returns {undefined | false | HTMLElement | SVGElement} Returns
	     *  `undefined` if the option is not specified; `false` if the option
	     *  resolved to `false` (node explicitly not given); otherwise, the resolved
	     *  DOM node.
	     * @throws {Error} If the option is set, not `false`, and is not, or does not
	     *  resolve to a node.
	     */
	    _defineProperty(_this, "getNodeForOption", function (optionName) {
	      var _this$internalOptions;
	      // use internal options first, falling back to original options
	      var optionValue = (_this$internalOptions = this.internalOptions[optionName]) !== null && _this$internalOptions !== void 0 ? _this$internalOptions : this.originalOptions[optionName];
	      if (typeof optionValue === 'function') {
	        for (var _len = arguments.length, params = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
	          params[_key - 1] = arguments[_key];
	        }
	        optionValue = optionValue.apply(void 0, params);
	      }
	      if (optionValue === true) {
	        optionValue = undefined; // use default value
	      }
	      if (!optionValue) {
	        if (optionValue === undefined || optionValue === false) {
	          return optionValue;
	        }
	        // else, empty string (invalid), null (invalid), 0 (invalid)

	        throw new Error("`".concat(optionName, "` was specified but was not a node, or did not return a node"));
	      }
	      var node = optionValue; // could be HTMLElement, SVGElement, or non-empty string at this point

	      if (typeof optionValue === 'string') {
	        var _this$getDocument;
	        node = (_this$getDocument = this.getDocument()) === null || _this$getDocument === void 0 ? void 0 : _this$getDocument.querySelector(optionValue); // resolve to node, or null if fails
	        if (!node) {
	          throw new Error("`".concat(optionName, "` as selector refers to no known node"));
	        }
	      }
	      return node;
	    });
	    _this.handleDeactivate = _this.handleDeactivate.bind(_this);
	    _this.handlePostDeactivate = _this.handlePostDeactivate.bind(_this);
	    _this.handleClickOutsideDeactivates = _this.handleClickOutsideDeactivates.bind(_this);

	    // focus-trap options used internally when creating the trap
	    _this.internalOptions = {
	      // We need to hijack the returnFocusOnDeactivate option,
	      // because React can move focus into the element before we arrived at
	      // this lifecycle hook (e.g. with autoFocus inputs). So the component
	      // captures the previouslyFocusedElement in componentWillMount,
	      // then (optionally) returns focus to it in componentWillUnmount.
	      returnFocusOnDeactivate: false,
	      // the rest of these are also related to deactivation of the trap, and we
	      //  need to use them and control them as well
	      checkCanReturnFocus: null,
	      onDeactivate: _this.handleDeactivate,
	      onPostDeactivate: _this.handlePostDeactivate,
	      // we need to special-case this setting as well so that we can know if we should
	      //  NOT return focus if the trap gets auto-deactivated as the result of an
	      //  outside click (otherwise, we'll always think we should return focus because
	      //  of how we manage that flag internally here)
	      clickOutsideDeactivates: _this.handleClickOutsideDeactivates
	    };

	    // original options provided by the consumer
	    _this.originalOptions = {
	      // because of the above `internalOptions`, we maintain our own flag for
	      //  this option, and default it to `true` because that's focus-trap's default
	      returnFocusOnDeactivate: true,
	      // because of the above `internalOptions`, we keep these separate since
	      //  they're part of the deactivation process which we configure (internally) to
	      //  be shared between focus-trap and focus-trap-react
	      onDeactivate: null,
	      onPostDeactivate: null,
	      checkCanReturnFocus: null,
	      // the user's setting, defaulted to false since focus-trap defaults this to false
	      clickOutsideDeactivates: false
	    };
	    var focusTrapOptions = props.focusTrapOptions;
	    for (var optionName in focusTrapOptions) {
	      if (!Object.prototype.hasOwnProperty.call(focusTrapOptions, optionName)) {
	        continue;
	      }
	      if (optionName === 'returnFocusOnDeactivate' || optionName === 'onDeactivate' || optionName === 'onPostDeactivate' || optionName === 'checkCanReturnFocus' || optionName === 'clickOutsideDeactivates') {
	        _this.originalOptions[optionName] = focusTrapOptions[optionName];
	        continue; // exclude from internalOptions
	      }
	      _this.internalOptions[optionName] = focusTrapOptions[optionName];
	    }

	    // if set, `{ target: Node, allowDeactivation: boolean }` where `target` is the outside
	    //  node that was clicked, and `allowDeactivation` is the result of the consumer's
	    //  option (stored in `this.originalOptions.clickOutsideDeactivates`, which may be a
	    //  function) whether to allow or deny auto-deactivation on click on this outside node
	    _this.outsideClick = null;

	    // elements from which to create the focus trap on mount; if a child is used
	    //  instead of the `containerElements` prop, we'll get the child's related
	    //  element when the trap renders and then is declared 'mounted'
	    _this.focusTrapElements = props.containerElements || [];

	    // now we remember what the currently focused element is, not relying on focus-trap
	    _this.updatePreviousElement();
	    return _this;
	  }

	  /**
	   * Gets the configured document.
	   * @returns {Document|undefined} Configured document, falling back to the main
	   *  document, if it exists. During SSR, `undefined` is returned since the
	   *  document doesn't exist.
	   */
	  _inherits(FocusTrap, _React$Component);
	  return _createClass(FocusTrap, [{
	    key: "getDocument",
	    value: function getDocument() {
	      // SSR: careful to check if `document` exists before accessing it as a variable
	      return this.props.focusTrapOptions.document || (typeof document !== 'undefined' ? document : undefined);
	    }
	  }, {
	    key: "getReturnFocusNode",
	    value: function getReturnFocusNode() {
	      var node = this.getNodeForOption('setReturnFocus', this.previouslyFocusedElement);
	      return node ? node : node === false ? false : this.previouslyFocusedElement;
	    }

	    /** Update the previously focused element with the currently focused element. */
	  }, {
	    key: "updatePreviousElement",
	    value: function updatePreviousElement() {
	      var currentDocument = this.getDocument();
	      if (currentDocument) {
	        this.previouslyFocusedElement = currentDocument.activeElement;
	      }
	    }
	  }, {
	    key: "deactivateTrap",
	    value: function deactivateTrap() {
	      // NOTE: it's possible the focus trap has already been deactivated without our knowing it,
	      //  especially if the user set the `clickOutsideDeactivates: true` option on the trap,
	      //  and the mouse was clicked on some element outside the trap; at that point, focus-trap
	      //  will initiate its auto-deactivation process, which will call our own
	      //  handleDeactivate(), which will call into this method
	      if (!this.focusTrap || !this.focusTrap.active) {
	        return;
	      }
	      this.focusTrap.deactivate({
	        // NOTE: we never let the trap return the focus since we do that ourselves
	        returnFocus: false,
	        // we'll call this in our own post deactivate handler so make sure the trap doesn't
	        //  do it prematurely
	        checkCanReturnFocus: null,
	        // let it call the user's original deactivate handler, if any, instead of
	        //  our own which calls back into this function
	        onDeactivate: this.originalOptions.onDeactivate
	        // NOTE: for post deactivate, don't specify anything so that it calls the
	        //  onPostDeactivate handler specified on `this.internalOptions`
	        //  which will always be our own `handlePostDeactivate()` handler, which
	        //  will finish things off by calling the user's provided onPostDeactivate
	        //  handler, if any, at the right time
	        // onPostDeactivate: NOTHING
	      });
	    }
	  }, {
	    key: "handleClickOutsideDeactivates",
	    value: function handleClickOutsideDeactivates(event) {
	      // use consumer's option (or call their handler) as the permission or denial
	      var allowDeactivation = typeof this.originalOptions.clickOutsideDeactivates === 'function' ? this.originalOptions.clickOutsideDeactivates.call(null, event) // call out of context
	      : this.originalOptions.clickOutsideDeactivates; // boolean

	      if (allowDeactivation) {
	        // capture the outside target that was clicked so we can use it in the deactivation
	        //  process since the consumer allowed it to cause auto-deactivation
	        this.outsideClick = {
	          target: event.target,
	          allowDeactivation: allowDeactivation
	        };
	      }
	      return allowDeactivation;
	    }
	  }, {
	    key: "handleDeactivate",
	    value: function handleDeactivate() {
	      if (this.originalOptions.onDeactivate) {
	        this.originalOptions.onDeactivate.call(null); // call user's handler out of context
	      }
	      this.deactivateTrap();
	    }
	  }, {
	    key: "handlePostDeactivate",
	    value: function handlePostDeactivate() {
	      var _this2 = this;
	      var finishDeactivation = function finishDeactivation() {
	        var returnFocusNode = _this2.getReturnFocusNode();
	        var canReturnFocus = !!(
	        // did the consumer allow it?

	        _this2.originalOptions.returnFocusOnDeactivate && // can we actually focus the node?
	        returnFocusNode !== null && returnFocusNode !== void 0 && returnFocusNode.focus && (
	        // was there an outside click that allowed deactivation?
	        !_this2.outsideClick ||
	        // did the consumer allow deactivation when the outside node was clicked?
	        _this2.outsideClick.allowDeactivation &&
	        // is the outside node NOT focusable (implying that it did NOT receive focus
	        //  as a result of the click-through) -- in which case do NOT restore focus
	        //  to `returnFocusNode` because focus should remain on the outside node
	        !isFocusable(_this2.outsideClick.target, _this2.internalOptions.tabbableOptions))

	        // if no, the restore focus to `returnFocusNode` at this point
	        );
	        var _this2$internalOption = _this2.internalOptions.preventScroll,
	          preventScroll = _this2$internalOption === void 0 ? false : _this2$internalOption;
	        if (canReturnFocus) {
	          // return focus to the element that had focus when the trap was activated
	          returnFocusNode.focus({
	            preventScroll: preventScroll
	          });
	        }
	        if (_this2.originalOptions.onPostDeactivate) {
	          _this2.originalOptions.onPostDeactivate.call(null); // don't call it in context of "this"
	        }
	        _this2.outsideClick = null; // reset: no longer needed
	      };
	      if (this.originalOptions.checkCanReturnFocus) {
	        this.originalOptions.checkCanReturnFocus.call(null, this.getReturnFocusNode()) // call out of context
	        .then(finishDeactivation, finishDeactivation);
	      } else {
	        finishDeactivation();
	      }
	    }
	  }, {
	    key: "setupFocusTrap",
	    value: function setupFocusTrap() {
	      if (this.focusTrap) {
	        // trap already exists: it's possible we're in StrictMode and we're being remounted,
	        //  in which case, we will have deactivated the trap when we got unmounted (remember,
	        //  StrictMode, in development, purposely unmounts and remounts components after
	        //  mounting them the first time to make sure they have reusable state,
	        //  @see https://reactjs.org/docs/strict-mode.html#ensuring-reusable-state) so now
	        //  we need to restore the state of the trap according to our component state
	        // NOTE: Strict mode __violates__ assumptions about the `componentWillUnmount()` API
	        //  which clearly states -- even for React 18 -- that, "Once a component instance is
	        //  unmounted, __it will never be mounted again.__" (emphasis ours). So when we get
	        //  unmounted, we assume we're gone forever and we deactivate the trap. But then
	        //  we get remounted and we're supposed to restore state. But if you had paused,
	        //  we've now deactivated (we don't know we're amount to get remounted again)
	        //  which means we need to reactivate and then pause. Otherwise, do nothing.
	        if (this.props.active && !this.focusTrap.active) {
	          this.focusTrap.activate();
	          if (this.props.paused) {
	            this.focusTrap.pause();
	          }
	        }
	      } else {
	        var nodesExist = this.focusTrapElements.some(Boolean);
	        if (nodesExist) {
	          this.focusTrap = this.props._createFocusTrap(this.focusTrapElements, this.internalOptions);
	          if (this.props.active) {
	            this.focusTrap.activate();
	          }
	          if (this.props.paused) {
	            this.focusTrap.pause();
	          }
	        }
	      }
	    }
	  }, {
	    key: "componentDidMount",
	    value: function componentDidMount() {
	      if (this.props.active) {
	        this.setupFocusTrap();
	      }
	      // else, wait for later activation in case the `focusTrapOptions` will be updated
	      //  again before the trap is activated (e.g. if waiting to know what the document
	      //  object will be, so the Trap must be rendered, but the consumer is waiting to
	      //  activate until they have obtained the document from a ref)
	      //  @see https://github.com/focus-trap/focus-trap-react/issues/539
	    }
	  }, {
	    key: "componentDidUpdate",
	    value: function componentDidUpdate(prevProps) {
	      if (this.focusTrap) {
	        if (prevProps.containerElements !== this.props.containerElements) {
	          this.focusTrap.updateContainerElements(this.props.containerElements);
	        }
	        var hasActivated = !prevProps.active && this.props.active;
	        var hasDeactivated = prevProps.active && !this.props.active;
	        var hasPaused = !prevProps.paused && this.props.paused;
	        var hasUnpaused = prevProps.paused && !this.props.paused;
	        if (hasActivated) {
	          this.updatePreviousElement();
	          this.focusTrap.activate();
	        }
	        if (hasDeactivated) {
	          this.deactivateTrap();
	          return; // un/pause does nothing on an inactive trap
	        }
	        if (hasPaused) {
	          this.focusTrap.pause();
	        }
	        if (hasUnpaused) {
	          this.focusTrap.unpause();
	        }
	      } else {
	        // NOTE: if we're in `componentDidUpdate` and we don't have a trap yet,
	        //  it either means it shouldn't be active, or it should be but none of
	        //  of given `containerElements` were present in the DOM the last time
	        //  we tried to create the trap

	        if (prevProps.containerElements !== this.props.containerElements) {
	          this.focusTrapElements = this.props.containerElements;
	        }

	        // don't create the trap unless it should be active in case the consumer
	        //  is still updating `focusTrapOptions`
	        //  @see https://github.com/focus-trap/focus-trap-react/issues/539
	        if (this.props.active) {
	          this.updatePreviousElement();
	          this.setupFocusTrap();
	        }
	      }
	    }
	  }, {
	    key: "componentWillUnmount",
	    value: function componentWillUnmount() {
	      this.deactivateTrap();
	    }
	  }, {
	    key: "render",
	    value: function render() {
	      var _this3 = this;
	      var child = this.props.children ? React.Children.only(this.props.children) : undefined;
	      if (child) {
	        if (child.type && child.type === React.Fragment) {
	          throw new Error('A focus-trap cannot use a Fragment as its child container. Try replacing it with a <div> element.');
	        }
	        var callbackRef = function callbackRef(element) {
	          var containerElements = _this3.props.containerElements;
	          if (child) {
	            // React 19 moved the `ref` to an official prop
	            if (reactVerMajor >= 19) {
	              if (typeof child.props.ref === 'function') {
	                child.props.ref(element);
	              } else if (child.props.ref) {
	                child.props.ref.current = element;
	              }
	            } else {
	              // older versions of React had the `ref` separate from props (still works in R19
	              //  but results in a deprecation warning in Dev builds)
	              if (typeof child.ref === 'function') {
	                child.ref(element);
	              } else if (child.ref) {
	                child.ref.current = element;
	              }
	            }
	          }
	          _this3.focusTrapElements = containerElements ? containerElements : [element];
	        };
	        var childWithRef = React.cloneElement(child, {
	          ref: callbackRef
	        });
	        return childWithRef;
	      }
	      return null;
	    }
	  }]);
	}(React.Component); // NOTE: While React 19 REMOVED support for `propTypes`, support for `defaultProps`
	//  __for class components ONLY__ remains: "Class components will continue to support
	//  defaultProps since there is no ES6 alternative."
	//  @see https://react.dev/blog/2024/04/25/react-19-upgrade-guide#removed-proptypes-and-defaultprops
	FocusTrap.defaultProps = {
	  active: true,
	  paused: false,
	  focusTrapOptions: {},
	  _createFocusTrap: createFocusTrap
	};

	// 🔺 DEPRECATED: default export
	focusTrapReact.exports = FocusTrap;

	// named export
	focusTrapReact.exports.FocusTrap = FocusTrap;
	return focusTrapReact.exports;
}

var focusTrapReactExports = requireFocusTrapReact();

const SvgArrowBackIos = (props) => /* @__PURE__ */ React.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "1em", height: "1em", viewBox: "0 0 24 24", ...props }, /* @__PURE__ */ React.createElement("path", { d: "M16.62 2.99a1.25 1.25 0 0 0-1.77 0L6.54 11.3a.996.996 0 0 0 0 1.41l8.31 8.31c.49.49 1.28.49 1.77 0s.49-1.28 0-1.77L9.38 12l7.25-7.25c.48-.48.48-1.28-.01-1.76z" }));

const DrillDownHeader = forwardRef(
  (props, ref) => {
    const { el, className, children, ...rest } = props;
    const { index, back, onClose } = useDrillDownContext();
    const data = {
      children: childrenToString(props.children)
    };
    const trackingId = useTrackingId({
      name: "DrillDownHeader",
      data,
      hasOverride: !!props["data-tracking-id"]
    });
    return /* @__PURE__ */ jsx(
      "header",
      {
        ...rest,
        className: cx(drillDownStyles["header"], className),
        "data-tracking-id": trackingId,
        ref,
        children: /* @__PURE__ */ jsxs(Flex, { justifyContent: "space-between", flex: "1", children: [
          /* @__PURE__ */ jsxs(Flex, { gap: "4", children: [
            /* @__PURE__ */ jsx("span", { className: drillDownStyles["close-container"], children: /* @__PURE__ */ jsx(
              Button,
              {
                size: "small",
                appearance: "ghost",
                "aria-label": "Previous",
                "data-anv": "drilldown-header-back-button",
                icon: SvgArrowBackIos,
                onClick: () => back?.()
              }
            ) }),
            /* @__PURE__ */ jsx(Text, { variant: "headline", el: el ?? "h1", children })
          ] }),
          index != null && onClose && onClose[index] ? /* @__PURE__ */ jsx("span", { className: drillDownStyles["close-container"], children: /* @__PURE__ */ jsx(
            Button,
            {
              className: drillDownStyles["close-button"],
              size: "small",
              appearance: "ghost",
              "aria-label": "Close",
              "data-anv": "drilldown-header-close-button",
              icon: SvgClose,
              onClick: onClose[index]
            }
          ) }) : null
        ] })
      }
    );
  }
);
DrillDownHeader.displayName = "DrillDownHeader";

const DrillDownContent = forwardRef((props, ref) => {
  const { className, ...rest } = props;
  return /* @__PURE__ */ jsx("div", { ...rest, className: cx(drillDownStyles["content"], className), ref });
});
DrillDownContent.displayName = "DrillDownContent";

const DrillDownFooter = forwardRef(
  (props, ref) => {
    const { className, ...rest } = props;
    return /* @__PURE__ */ jsx(
      "div",
      {
        ...rest,
        className: cx(drillDownStyles["footer"], className),
        ref
      }
    );
  }
);
DrillDownFooter.displayName = "DrillDownFooter";

const DrillDownNextButton = forwardRef((props, ref) => {
  const { onClick, ...rest } = props;
  const { next } = useDrillDownContext();
  const data = {
    title: props.title,
    appearance: props.appearance,
    size: props.size,
    type: props.type
  };
  const trackingId = useTrackingId({
    name: "DrillDownNextButton",
    data,
    hasOverride: !!props["data-tracking-id"]
  });
  const onClickHandler = (e) => {
    onClick?.(e);
    next?.();
  };
  return /* @__PURE__ */ jsx(
    Button,
    {
      "aria-label": "Next",
      "data-anv": "drilldown-next-button",
      "data-tracking-id": trackingId,
      onClick: onClickHandler,
      ref,
      ...rest
    }
  );
});
DrillDownNextButton.displayName = "DrillDownNextButton";

const DrillDownPrevButton = forwardRef((props, ref) => {
  const { onClick, ...rest } = props;
  const { back } = useDrillDownContext();
  const data = {
    title: props.title,
    appearance: props.appearance,
    size: props.size,
    type: props.type
  };
  const trackingId = useTrackingId({
    name: "DrillDownPrevButton",
    data,
    hasOverride: !!props["data-tracking-id"]
  });
  const onClickHandler = (e) => {
    onClick?.(e);
    back?.();
  };
  return /* @__PURE__ */ jsx(
    Button,
    {
      "aria-label": "Prev",
      "data-anv": "drilldown-prev-button",
      "data-tracking-id": trackingId,
      onClick: onClickHandler,
      ref,
      ...rest
    }
  );
});
DrillDownPrevButton.displayName = "DrillDownPrevButton";

const DrillDown = Object.assign(
  forwardRef(
    function DrillDownInner(props, ref) {
      const { index: indexProp, onClose, className, children, ...rest } = props;
      const {
        index,
        setRegisteredIndices,
        setOnClose,
        hostIsInteractive = true
      } = useDrillDownContext();
      const sectionRef = useRef(null);
      const isActiveScreen = hostIsInteractive && index === indexProp;
      useEffect(() => {
        setRegisteredIndices?.((registeredIndices) => {
          if (registeredIndices == null) return registeredIndices;
          const nextRegisteredIndices = [...registeredIndices];
          if (nextRegisteredIndices[indexProp] == null) {
            nextRegisteredIndices[indexProp] = 1;
            return nextRegisteredIndices;
          }
          nextRegisteredIndices[indexProp] += 1;
          return nextRegisteredIndices;
        });
        return () => {
          setRegisteredIndices?.((registeredIndices) => {
            if (registeredIndices == null) return registeredIndices;
            const nextRegisteredIndices = [...registeredIndices];
            if (nextRegisteredIndices[indexProp] === 1) {
              delete nextRegisteredIndices[indexProp];
              return nextRegisteredIndices;
            }
            if (nextRegisteredIndices[indexProp] > 1) {
              nextRegisteredIndices[indexProp] -= 1;
              return nextRegisteredIndices;
            }
            return nextRegisteredIndices;
          });
        };
      }, [indexProp, setRegisteredIndices]);
      useEffect(() => {
        if (onClose && indexProp != null) {
          setOnClose?.(onClose, indexProp);
        }
      }, [setOnClose, onClose, indexProp]);
      return isActiveScreen ? /* @__PURE__ */ jsx("div", { ...rest, className: cx(drillDownStyles["drilldown"], className), ref, children: /* @__PURE__ */ jsx(
        focusTrapReactExports.FocusTrap,
        {
          active: hostIsInteractive,
          focusTrapOptions: {
            returnFocusOnDeactivate: false,
            fallbackFocus: () => sectionRef.current ?? document.body
          },
          children: /* @__PURE__ */ jsx(
            "section",
            {
              className: drillDownStyles["container"],
              ref: sectionRef,
              tabIndex: -1,
              children
            }
          )
        }
      ) }) : null;
    }
  ),
  {
    Header: DrillDownHeader,
    Content: DrillDownContent,
    Footer: DrillDownFooter,
    NextButton: DrillDownNextButton,
    PrevButton: DrillDownPrevButton
  }
);
DrillDown.displayName = "DrillDown";

function useDrillDown() {
  const contextRef = useRef(null);
  const onDrillDownContextChange = useCallback(
    (passedContext) => {
      contextRef.current = passedContext;
    },
    []
  );
  const setIndex = useCallback((index) => {
    contextRef.current?.setIndex?.(index);
  }, []);
  const back = useCallback(() => {
    contextRef.current?.back?.();
  }, []);
  const next = useCallback(() => {
    contextRef.current?.next?.();
  }, []);
  return {
    setIndex,
    back,
    next,
    drillDownProps: {
      onDrillDownContextChange
    }
  };
}

export { DrillDown as D, DrillDownHeader as a, DrillDownContent as b, DrillDownFooter as c, DrillDownNextButton as d, DrillDownPrevButton as e, useDrillDown as u };
//# sourceMappingURL=useDrilldown-D5WWJRU2.js.map
