import React__default, { useState, useRef, useId, useMemo } from 'react';
import { useWindowDimensions, useRefocusOnActivator } from '@jobber/hooks';
import classnames from 'classnames';
import { AnimatePresence, motion } from 'framer-motion';
import { u as useFloating, c as useDismiss, g as useListNavigation, d as useInteractions, F as FloatingPortal } from './floating-ui.react-es.js';
import { B as Button } from './Button-es.js';
import { T as Typography } from './Typography-es.js';
import { I as Icon } from './Icon-es.js';
import { f as formFieldFocusAttribute } from './useFormFieldFocus-es.js';
import { c as calculateMaxHeight } from './maxHeight-es.js';
import { o as offset, f as flip, d as size, b as autoUpdate } from './floating-ui.react-dom-es.js';
import { m as mergeProps } from './useRenderElement-es.js';
import { n as normalizeBaseUiButtonProps, i as isAtlantisButtonRenderTarget, s as stripNativeTypeFromButtonRenderTarget, r as renderAtlantisButtonTarget } from './buttonRenderAdapter-es.js';
import { a as BottomSheet } from './BottomSheet-es.js';
import { D as DrawerTrigger } from './ScrollAreaViewport-es.js';
import { O as OverlaySeparator } from './OverlaySeparator-es.js';
import { D as DrawerTitle, a as DrawerClose } from './DrawerTitle-es.js';
import { M as MenuTrigger$1, a as MenuLinkItem, b as MenuItem$1, c as MenuRadioItem$1, d as MenuRadioItemIndicator, e as MenuSubmenuTrigger$1, f as MenuRoot, g as MenuPortal$1, h as MenuBackdrop, i as MenuPositioner, j as MenuPopup, k as MenuRadioGroup$1, l as MenuGroup$1, m as MenuSubmenuRoot, n as MenuGroupLabel$1 } from './MenuSubmenuTrigger-es.js';

var styles$2 = {"wrapper":"h-nk89U2n6Q-","floatingContainer":"krpkWzoaVcc-","menu":"_7sU7mp1w0jM-","legacySection":"_4x-vvEmn4gM-","separator":"i0QNcs4S-wk-","triggerWrapper":"_7CsejipGrzM-","ariaMenu":"bO7lGVQC42c-","ariaItem":"u6fDgbWmPck-","ariaSection":"-TSNrZBKZJI-","ariaSectionHeader":"zs7dS2pKjEw-","sectionHeader":"MZJgunQcmdQ-","legacyAction":"_-1GOlrzd098-","action":"NYXV5w4pd0c-","destructive":"baYK2zQ6-GA-","overlay":"A7T14ALVEKg-","fullWidth":"Lgbn9IRPI5Y-","screenReaderOnly":"o-ps580KdWI-","spinning":"f1oTdSTeUOM-"};

const SMALL_SCREEN_BREAKPOINT = 490;
const MENU_OFFSET = 6;
const MENU_MAX_HEIGHT_PERCENTAGE = 72;
const Y_TRANSLATION_DESKTOP = 10;
const Y_TRANSLATION_MOBILE = 150;
const MENU_ANIMATION_DURATION = 0.25;
const OVERLAY_ANIMATION_DURATION = 0.15;
const MENU_ANIMATION_CONFIG = {
    duration: MENU_ANIMATION_DURATION,
    type: "tween",
};
const OVERLAY_ANIMATION_CONFIG = {
    duration: OVERLAY_ANIMATION_DURATION,
    type: "tween",
};

function isMobileDevice() {
    if (typeof window === "undefined") {
        return false;
    }
    return window.innerWidth <= SMALL_SCREEN_BREAKPOINT;
}
const animationVariation = {
    overlayStartStop: { opacity: 0 },
    startOrStop: (placement) => {
        let y = Y_TRANSLATION_DESKTOP;
        if (placement === null || placement === void 0 ? void 0 : placement.includes("bottom"))
            y *= -1;
        if (isMobileDevice())
            y = Y_TRANSLATION_MOBILE;
        return { opacity: 0, y };
    },
    done: { opacity: 1, y: 0 },
};
// eslint-disable-next-line max-statements
function MenuLegacy({ activator, items, UNSAFE_className, UNSAFE_style, }) {
    var _a;
    const [visible, setVisible] = useState(false);
    const [referenceElement, setReferenceElement] = useState(null);
    const [activeIndex, setActiveIndex] = useState(null);
    const listRef = useRef([]);
    const { width } = useWindowDimensions();
    const buttonID = useId();
    const menuID = useId();
    const fullWidth = ((_a = activator === null || activator === void 0 ? void 0 : activator.props) === null || _a === void 0 ? void 0 : _a.fullWidth) || false;
    const wrapperClasses = classnames(styles$2.wrapper, {
        [styles$2.fullWidth]: fullWidth,
    });
    useRefocusOnActivator(visible);
    const isLargeScreen = width >= SMALL_SCREEN_BREAKPOINT;
    const middleware = useMemo(() => {
        if (isLargeScreen) {
            return [
                offset(MENU_OFFSET),
                flip({ fallbackPlacements: ["bottom-end", "top-start", "top-end"] }),
                size({
                    apply({ availableHeight, elements }) {
                        const menuElement = elements.floating.querySelector('[role="menu"]');
                        if (menuElement) {
                            const viewportHeight = window.innerHeight;
                            const maxHeightVh = (viewportHeight * MENU_MAX_HEIGHT_PERCENTAGE) / 100;
                            const maxHeight = calculateMaxHeight(availableHeight, {
                                maxHeight: maxHeightVh,
                            });
                            Object.assign(menuElement.style, {
                                maxHeight: `${maxHeight}px`,
                            });
                        }
                    },
                }),
            ];
        }
        return [];
    }, [isLargeScreen]);
    const { refs, floatingStyles, context } = useFloating({
        open: visible,
        onOpenChange: (isOpen) => {
            setVisible(isOpen);
        },
        placement: "bottom-start",
        strategy: "fixed",
        middleware,
        elements: {
            reference: referenceElement,
        },
        whileElementsMounted: autoUpdate,
    });
    const dismiss = useDismiss(context);
    const listNavigation = useListNavigation(context, {
        listRef,
        activeIndex,
        onNavigate: setActiveIndex,
        loop: true,
    });
    const { getReferenceProps, getFloatingProps, getItemProps } = useInteractions([dismiss, listNavigation]);
    const positionAttributes = isLargeScreen
        ? {
            style: floatingStyles,
        }
        : {};
    if (!activator) {
        activator = (React__default.createElement(Button, { fullWidth: true, label: "More Actions", icon: "more", type: "secondary" }));
    }
    let itemIndexCounter = 0;
    const renderedSections = items === null || items === void 0 ? void 0 : items.map((item, key) => (React__default.createElement("div", { key: key, className: styles$2.legacySection },
        item.header && (React__default.createElement(SectionHeader, { text: item.header, UNSAFE_style: UNSAFE_style === null || UNSAFE_style === void 0 ? void 0 : UNSAFE_style.header, UNSAFE_className: UNSAFE_className === null || UNSAFE_className === void 0 ? void 0 : UNSAFE_className.header })),
        item.actions.map(action => {
            const currentIndex = itemIndexCounter++;
            return (React__default.createElement(Action, Object.assign({ UNSAFE_style: UNSAFE_style === null || UNSAFE_style === void 0 ? void 0 : UNSAFE_style.action, UNSAFE_className: UNSAFE_className === null || UNSAFE_className === void 0 ? void 0 : UNSAFE_className.action, sectionLabel: item.header, key: action.label, tabIndex: activeIndex === currentIndex ? 0 : -1, setItemNode: node => {
                    listRef.current[currentIndex] = node;
                }, getItemProps: getItemProps }, action)));
        }))));
    return (React__default.createElement("div", { className: wrapperClasses, onClick: handleParentClick },
        React__default.createElement("div", Object.assign({ ref: setReferenceElement }, getReferenceProps()), React__default.cloneElement(activator, {
            onClick: toggle(activator.props.onClick),
            id: buttonID,
            ariaControls: menuID,
            ariaExpanded: visible,
            ariaHaspopup: true,
        })),
        React__default.createElement(MenuPortal, null,
            React__default.createElement(AnimatePresence, null, visible && (React__default.createElement(React__default.Fragment, null,
                React__default.createElement(motion.div, { className: styles$2.overlay, onClick: toggle(), variants: animationVariation, initial: "overlayStartStop", animate: "done", exit: "overlayStartStop", transition: Object.assign({}, OVERLAY_ANIMATION_CONFIG) }),
                React__default.createElement("div", Object.assign({ ref: refs.setFloating, className: styles$2.floatingContainer }, getFloatingProps({
                    onKeyDown: event => {
                        if (event.key === "Tab") {
                            event.preventDefault();
                        }
                    },
                }), positionAttributes, formFieldFocusAttribute), items.length > 0 && (React__default.createElement(motion.div, { className: classnames(styles$2.menu, UNSAFE_className === null || UNSAFE_className === void 0 ? void 0 : UNSAFE_className.menu), role: "menu", "data-elevation": "elevated", "aria-labelledby": buttonID, id: menuID, onClick: hide, variants: animationVariation, initial: "startOrStop", animate: "done", exit: "startOrStop", custom: context === null || context === void 0 ? void 0 : context.placement, transition: Object.assign({}, MENU_ANIMATION_CONFIG), style: UNSAFE_style === null || UNSAFE_style === void 0 ? void 0 : UNSAFE_style.menu }, renderedSections)))))))));
    function toggle(callbackPassthrough) {
        return (event) => {
            setVisible(!visible);
            callbackPassthrough && callbackPassthrough(event);
        };
    }
    function hide() {
        setVisible(false);
        setActiveIndex(null);
    }
    function handleParentClick(event) {
        event.stopPropagation();
    }
}
function SectionHeader({ text, UNSAFE_style, UNSAFE_className, }) {
    return (React__default.createElement("div", { className: classnames(styles$2.sectionHeader, UNSAFE_className), "aria-hidden": true, style: UNSAFE_style },
        React__default.createElement(DefaultHeaderContent, null, text)));
}
function Action(props) {
    const { label, sectionLabel, icon, iconColor, destructive, UNSAFE_style, UNSAFE_className, onClick, tabIndex, setItemNode, getItemProps, } = props;
    const buttonClasses = classnames(styles$2.action, styles$2.legacyAction, {
        [styles$2.destructive]: destructive,
    });
    return (React__default.createElement("button", Object.assign({ className: classnames(buttonClasses, UNSAFE_className), style: UNSAFE_style, key: label, type: "button" }, getItemProps({
        ref: setItemNode,
        role: "menuitem",
        onClick,
        tabIndex,
    })),
        React__default.createElement(DefaultItemContent, { label: label, icon: icon, iconColor: iconColor, destructive: destructive, sectionLabel: sectionLabel })));
}
function DefaultItemContent({ label, icon, iconColor, destructive, sectionLabel, }) {
    return (React__default.createElement(React__default.Fragment, null,
        icon && (React__default.createElement("div", null,
            React__default.createElement(Icon, { color: destructive ? "destructive" : iconColor, name: icon }))),
        React__default.createElement(Typography, { element: "span", fontWeight: "semiBold", textColor: destructive ? "destructive" : "text" },
            sectionLabel && (React__default.createElement("span", { className: styles$2.screenReaderOnly }, sectionLabel)),
            label)));
}
function DefaultHeaderContent({ children, }) {
    return (React__default.createElement(Typography, { element: "h6", size: "base", textColor: "textSecondary", fontWeight: "regular", textCase: "none" }, children));
}
function MenuPortal({ children }) {
    if (typeof document === "undefined") {
        return null;
    }
    return React__default.createElement(FloatingPortal, null, children);
}

var styles$1 = {"submenuHeader":"Vw9MFreevMU-","submenuTitle":"wpNMcBuNwwY-","spinning":"nOEBQCC4Cos-"};

var styles = {"wrapper":"fpi0W91w2ag-","floatingContainer":"ba-Kj6mvQUw-","composableBackdrop":"wqvf3hcDMM0-","menu":"-DayvgvIcVo-","legacySection":"VsRRunpS6Yo-","separator":"jnggqK3YTIU-","triggerWrapper":"oRQQVVq-yxA-","composableMenu":"atokGnmWVls-","composableDropdownPopup":"Uk14qmg-Fqc-","composableDropdownScroller":"CJKnGqldjF0-","bottomSheetMenuContent":"J3CW8IU48RM-","composableItem":"zSMkwrZodBk-","composableItemNoLeadingSlot":"qbDWOwkPouM-","composableSection":"_353OIWGazfE-","composableGroup":"Q0ssxff-Qo4-","composableRadioGroup":"_2VyPM45lQBE-","composableSectionHeader":"efA-ozx9w0w-","composableGroupHeader":"BklkzNPbJ5Q-","composableGroupLabel":"_5-p9DbyRav4-","sectionHeader":"Bq7pLWj3jm4-","legacyAction":"P4Sdaq0-lZs-","action":"M1BgN-oCmKw-","destructive":"U9ihZZavz9w-","overlay":"_7we5hh6kYs8-","bottomSheetSubmenuPopup":"nf47GCAYI-c-","menuHidden":"cuw8ct7rX6s-","bottomSheetSubmenuBody":"a6uZEXgX8sg-","fullWidth":"_5OJ7B6mFcwk-","screenReaderOnly":"Bzvkz60bwWE-","spinning":"_0-VzuzHdi8o-"};

function mergeUnsafeProps(props) {
    return mergeProps({
        className: props.UNSAFE_className,
        style: props.UNSAFE_style,
    }, {
        className: props.className,
        style: props.style,
    });
}

// New composable menu pieces prefer standard DOM props, but we still accept the
// old UNSAFE_* names during the migration window. Base UI's merge semantics let
// either API path continue to work while standard props still win on conflicts.
function resolveComposableBaseProps(props) {
    return mergeUnsafeProps(props);
}
// Detects whether a composed item already includes a specific slot so each
// shell can adjust layout without needing to understand every child shape.
function hasMenuSlot(children, slot) {
    return React__default.Children.toArray(children).some(child => {
        if (!React__default.isValidElement(child)) {
            return false;
        }
        if (typeof child.type === "string" || !("menuSlot" in child.type)) {
            return false;
        }
        return child.type.menuSlot === slot;
    });
}
// Falls back to the default Atlantis button trigger when a consumer does not
// provide a custom render function or element.
function resolveMenuTriggerRender({ children, render, }) {
    if (render) {
        if (typeof render === "function") {
            return (props) => {
                const renderedElement = render(normalizeBaseUiButtonProps(props));
                return isAtlantisButtonRenderTarget(renderedElement)
                    ? stripNativeTypeFromButtonRenderTarget(renderedElement)
                    : renderedElement;
            };
        }
        return isAtlantisButtonRenderTarget(render)
            ? renderAtlantisButtonTarget(render)
            : render;
    }
    if (isAtlantisButtonRenderTarget(children)) {
        return renderAtlantisButtonTarget(children);
    }
    if (React__default.isValidElement(children)) {
        return children;
    }
    return renderAtlantisButtonTarget(React__default.createElement(Button, { type: "secondary" },
        React__default.createElement(Button.Label, null, children)));
}
const MenuItemContext = React__default.createContext(null);
function MenuItemProvider({ children, variation, }) {
    return (React__default.createElement(MenuItemContext.Provider, { value: { variation } }, children));
}
function useMenuItemContext() {
    const context = React__default.useContext(MenuItemContext);
    return context !== null && context !== void 0 ? context : {};
}
function SharedMenuItemIcon(props) {
    const { variation } = useMenuItemContext();
    return (
    // TODO: Remove this wrapper once Icon can accept the data attributes needed
    // for Menu slot styling directly.
    React__default.createElement("div", { "data-menu-slot": "icon" },
        React__default.createElement(Icon, Object.assign({}, props, { color: variation === "destructive" ? "destructive" : props.color }))));
}
function SharedMenuItemLabel(props) {
    const { variation } = useMenuItemContext();
    return (
    // TODO: Remove this wrapper once Typography can accept the data attributes
    // needed for Menu slot styling directly.
    React__default.createElement("div", { "data-menu-slot": "label" },
        React__default.createElement(Typography, { element: "span", size: "base", fontWeight: "semiBold", textColor: variation === "destructive" ? "destructive" : "text" }, props.children)));
}
function SharedMenuItemPrefix(props) {
    const { className, style } = resolveComposableBaseProps(props);
    return (React__default.createElement("div", { className: className, "data-menu-slot": "prefix", style: style }, props.children));
}
function SharedMenuItemSuffix(props) {
    const { className, style } = resolveComposableBaseProps(props);
    return (React__default.createElement("div", { className: className, "data-menu-slot": "suffix", style: style }, props.children));
}
const sharedMenuGroupLabelClassName = `${styles.composableGroupHeader} ${styles.composableGroupLabel}`;
function DefaultGroupLabelContent({ children, }) {
    return (React__default.createElement(Typography, { element: "span", size: "base", textColor: "textSecondary", fontWeight: "regular", textCase: "none" }, children));
}
function SharedMenuGroupLabelContent(props) {
    return React__default.createElement(DefaultGroupLabelContent, null, props.children);
}

const BottomSheetContext = React__default.createContext(null);
const BottomSheetRadioGroupContext = React__default.createContext(null);
const BottomSheetGroupContext = React__default.createContext(null);
const BottomSheetSubmenuContext = React__default.createContext(null);
const MENU_ITEM_SELECTOR = '[role="menuitem"], [role="menuitemradio"]';
function useBottomSheetContext() {
    const context = React__default.useContext(BottomSheetContext);
    if (!context) {
        throw new Error("BottomSheetContext used outside provider");
    }
    return context;
}
function useBottomSheetRadioGroupContext() {
    return React__default.useContext(BottomSheetRadioGroupContext);
}
function useBottomSheetGroupContext() {
    const context = React__default.useContext(BottomSheetGroupContext);
    if (!context) {
        throw new Error("BottomSheetGroupContext used outside provider");
    }
    return context;
}
function useBottomSheetSubmenuContext() {
    const context = React__default.useContext(BottomSheetSubmenuContext);
    if (!context) {
        throw new Error("BottomSheetSubmenuContext used outside provider");
    }
    return context;
}
function getTextContent(node) {
    if (typeof node === "string" || typeof node === "number") {
        return String(node);
    }
    if (Array.isArray(node)) {
        return node.map(child => getTextContent(child)).join(" ");
    }
    if (!React__default.isValidElement(node)) {
        return "";
    }
    return getTextContent(node.props.children);
}
function getBottomSheetContentStyle(style) {
    if (!style) {
        return undefined;
    }
    const safeStyle = Object.assign({}, style);
    delete safeStyle.height;
    delete safeStyle.maxHeight;
    delete safeStyle.minHeight;
    delete safeStyle.width;
    return safeStyle;
}
// Bottom sheet menu interaction helpers. These adapt Drawer semantics into the
// menu-style keyboard and focus behavior we want for the mobile shell.
function getNavigableMenuItems(target) {
    const menu = target.closest('[role="menu"]');
    if (!menu) {
        return [];
    }
    return Array.from(menu.querySelectorAll(MENU_ITEM_SELECTOR)).filter(item => !item.hasAttribute("disabled"));
}
function moveBottomSheetMenuFocus(currentTarget, direction) {
    var _a, _b;
    const items = getNavigableMenuItems(currentTarget);
    if (items.length === 0) {
        return;
    }
    const boundaryIndex = direction === "first" ? 0 : direction === "last" ? items.length - 1 : null;
    if (boundaryIndex !== null) {
        (_a = items[boundaryIndex]) === null || _a === void 0 ? void 0 : _a.focus();
        return;
    }
    const currentIndex = items.indexOf(currentTarget);
    const startIndex = currentIndex === -1 ? 0 : currentIndex;
    const offset = direction === "next" ? 1 : -1;
    const nextIndex = (startIndex + offset + items.length) % items.length;
    (_b = items[nextIndex]) === null || _b === void 0 ? void 0 : _b.focus();
}
function handleBottomSheetMenuItemKeyDown(event) {
    switch (event.key) {
        case "ArrowDown":
            event.preventDefault();
            moveBottomSheetMenuFocus(event.currentTarget, "next");
            break;
        case "ArrowUp":
            event.preventDefault();
            moveBottomSheetMenuFocus(event.currentTarget, "previous");
            break;
        case "Home":
            event.preventDefault();
            moveBottomSheetMenuFocus(event.currentTarget, "first");
            break;
        case "End":
            event.preventDefault();
            moveBottomSheetMenuFocus(event.currentTarget, "last");
            break;
    }
}
function updateBottomSheetHighlight(event, focusModalityRef, setHighlighted) {
    setHighlighted(focusModalityRef.current === "keyboard" ||
        event.currentTarget.matches(":focus-visible"));
}
function useBottomSheetMenuItemInteractions() {
    const { focusModalityRef } = useBottomSheetContext();
    const [isHighlighted, setIsHighlighted] = React__default.useState(false);
    return {
        isHighlighted,
        interactionProps: {
            onPointerDown: () => {
                focusModalityRef.current = "pointer";
            },
            onFocus: (event) => {
                updateBottomSheetHighlight(event, focusModalityRef, setIsHighlighted);
            },
            onBlur: () => {
                setIsHighlighted(false);
            },
            onKeyDown: (event) => {
                focusModalityRef.current = "keyboard";
                handleBottomSheetMenuItemKeyDown(event);
            },
        },
    };
}
function getInitialBottomSheetFocus(menuRef, focusModalityRef) {
    return (openType) => {
        var _a;
        if (openType === "keyboard") {
            focusModalityRef.current = "keyboard";
            return (_a = menuRef.current) === null || _a === void 0 ? void 0 : _a.querySelector(MENU_ITEM_SELECTOR);
        }
        focusModalityRef.current = "pointer";
        return menuRef.current;
    };
}
function handleBottomSheetMenuContainerKeyDown(event) {
    if (event.target !== event.currentTarget) {
        return;
    }
    switch (event.key) {
        case "ArrowDown":
        case "Home":
            event.preventDefault();
            moveBottomSheetMenuFocus(event.currentTarget, "first");
            break;
        case "ArrowUp":
        case "End":
            event.preventDefault();
            moveBottomSheetMenuFocus(event.currentTarget, "last");
            break;
    }
}
function BottomSheetMenuSurface({ children, className, menuRef, style, }) {
    const { focusModalityRef } = useBottomSheetContext();
    return (React__default.createElement("div", { ref: menuRef, className: classnames(styles.composableMenu, className), role: "menu", tabIndex: -1, onKeyDown: event => {
            focusModalityRef.current = "keyboard";
            handleBottomSheetMenuContainerKeyDown(event);
        }, style: style }, children));
}
function BottomSheetRoot({ children, onOpenChange, open, defaultOpen, }) {
    // Mobile submenu drill-downs use their own drawer layer. We track that here
    // so the parent sheet can hide while a nested submenu is open.
    const [submenuOpen, setSubmenuOpen] = React__default.useState(false);
    const focusModalityRef = React__default.useRef("pointer");
    const actionsRef = React__default.useRef(null);
    return (React__default.createElement(BottomSheet.Root, { actionsRef: actionsRef, open: open, defaultOpen: defaultOpen, onOpenChange: nextOpen => {
            if (!nextOpen) {
                setSubmenuOpen(false);
            }
            onOpenChange === null || onOpenChange === void 0 ? void 0 : onOpenChange(nextOpen);
        } },
        React__default.createElement(BottomSheetContext.Provider, { value: {
                close: () => {
                    var _a;
                    (_a = actionsRef.current) === null || _a === void 0 ? void 0 : _a.close();
                },
                focusModalityRef,
                setSubmenuOpen,
                submenuOpen,
            } }, children)));
}
const BottomSheetTrigger = React__default.forwardRef(function BottomSheetTrigger({ ariaLabel, children, style, className, render, UNSAFE_style, UNSAFE_className, }, ref) {
    const resolvedBaseProps = resolveComposableBaseProps({
        className,
        style,
        UNSAFE_className,
        UNSAFE_style,
    });
    return (React__default.createElement(DrawerTrigger, { "aria-label": ariaLabel, className: classnames(styles.triggerWrapper, resolvedBaseProps.className), style: resolvedBaseProps.style, render: resolveMenuTriggerRender({ children, render }), ref: ref }));
});
function BottomSheetContent({ children, style, className, UNSAFE_style, UNSAFE_className, }) {
    const { focusModalityRef, submenuOpen } = useBottomSheetContext();
    const menuRef = React__default.useRef(null);
    const resolvedBaseProps = resolveComposableBaseProps({
        className,
        style,
        UNSAFE_className,
        UNSAFE_style,
    });
    const bottomSheetStyle = getBottomSheetContentStyle(resolvedBaseProps.style);
    return (React__default.createElement(BottomSheet.Popup, { initialFocus: getInitialBottomSheetFocus(menuRef, focusModalityRef), className: classnames({
            [styles.menuHidden]: submenuOpen,
        }) },
        React__default.createElement(BottomSheet.Content, null,
            React__default.createElement(BottomSheetMenuSurface, { menuRef: menuRef, className: classnames(styles.bottomSheetMenuContent, resolvedBaseProps.className), style: bottomSheetStyle }, children))));
}
function BottomSheetSeparator({ style, className, UNSAFE_style, UNSAFE_className, }) {
    const resolvedBaseProps = resolveComposableBaseProps({
        className,
        style,
        UNSAFE_className,
        UNSAFE_style,
    });
    return (React__default.createElement(OverlaySeparator, { className: classnames(styles.separator, resolvedBaseProps.className), style: resolvedBaseProps.style, "data-testid": "ATL-Menu-Separator" }));
}
function BottomSheetRadioGroup({ children, value, defaultValue, onValueChange, className, style, UNSAFE_style, UNSAFE_className, }) {
    const resolvedBaseProps = resolveComposableBaseProps({
        className,
        style,
        UNSAFE_className,
        UNSAFE_style,
    });
    const [internalValue, setInternalValue] = React__default.useState(defaultValue);
    const selectedValue = value !== null && value !== void 0 ? value : internalValue;
    return (React__default.createElement(BottomSheetRadioGroupContext.Provider, { value: {
            value: selectedValue,
            setValue: nextValue => {
                if (value === undefined) {
                    setInternalValue(nextValue);
                }
                onValueChange === null || onValueChange === void 0 ? void 0 : onValueChange(nextValue);
            },
        } },
        React__default.createElement("div", { className: classnames(styles.composableRadioGroup, resolvedBaseProps.className), style: resolvedBaseProps.style }, children)));
}
function BottomSheetGroup(props) {
    const { className, style } = resolveComposableBaseProps(props);
    const labelId = React__default.useId();
    const [hasLabel, setHasLabel] = React__default.useState(false);
    const registerLabel = React__default.useCallback((nextHasLabel) => {
        setHasLabel(nextHasLabel);
    }, []);
    return (React__default.createElement(BottomSheetGroupContext.Provider, { value: { labelId, registerLabel } },
        React__default.createElement("div", { role: "group", "aria-labelledby": hasLabel ? labelId : undefined, "aria-label": !hasLabel ? props.ariaLabel : undefined, className: classnames(styles.composableGroup, className), style: style }, props.children)));
}
const BottomSheetItem = React__default.forwardRef(function BottomSheetItem(props, ref) {
    const { close } = useBottomSheetContext();
    const { isHighlighted, interactionProps } = useBottomSheetMenuItemInteractions();
    const { className: itemClassName, style } = resolveComposableBaseProps(props);
    const hasLeadingContent = hasMenuSlot(props.children, "icon") ||
        hasMenuSlot(props.children, "prefix");
    const className = classnames(styles.action, styles.composableItem, {
        [styles.composableItemNoLeadingSlot]: !hasLeadingContent,
    }, {
        [styles.destructive]: props.variation === "destructive",
    }, itemClassName);
    if (props.href) {
        const { href, target, rel, onClick, closeOnClick = true } = props;
        return (React__default.createElement("a", Object.assign({ ref: ref, className: className, "data-highlighted": isHighlighted ? "" : undefined, style: style, href: href, role: "menuitem", target: target, rel: rel }, interactionProps, { onClick: event => {
                onClick === null || onClick === void 0 ? void 0 : onClick(event);
                if (closeOnClick) {
                    close();
                }
            } }),
            React__default.createElement(MenuItemProvider, { variation: props.variation }, props.children)));
    }
    return (React__default.createElement("button", Object.assign({ ref: ref, className: className, "data-highlighted": isHighlighted ? "" : undefined, style: style, type: "button", role: "menuitem" }, interactionProps, { onClick: () => {
            var _a;
            (_a = props.onClick) === null || _a === void 0 ? void 0 : _a.call(props);
            if (props.closeOnClick !== false) {
                close();
            }
        }, onKeyUp: event => {
            if (event.key === " ") {
                close();
            }
        } }),
        React__default.createElement(MenuItemProvider, { variation: props.variation }, props.children)));
});
const BottomSheetRadioItem = React__default.forwardRef(function BottomSheetRadioItem(props, ref) {
    const { close } = useBottomSheetContext();
    const radioGroup = useBottomSheetRadioGroupContext();
    const { isHighlighted, interactionProps } = useBottomSheetMenuItemInteractions();
    const { className, style } = resolveComposableBaseProps(props);
    const checked = (radioGroup === null || radioGroup === void 0 ? void 0 : radioGroup.value) === props.value;
    const hasCustomSuffix = hasMenuSlot(props.children, "suffix");
    const hasLeadingContent = hasMenuSlot(props.children, "icon") ||
        hasMenuSlot(props.children, "prefix");
    return (React__default.createElement("button", Object.assign({ ref: ref, className: classnames(styles.action, styles.composableItem, {
            [styles.composableItemNoLeadingSlot]: !hasLeadingContent,
        }, className), "data-highlighted": isHighlighted ? "" : undefined, style: style, type: "button", role: "menuitemradio", "aria-checked": checked }, interactionProps, { onClick: () => {
            radioGroup === null || radioGroup === void 0 ? void 0 : radioGroup.setValue(props.value);
            if (props.closeOnClick) {
                close();
            }
        } }),
        React__default.createElement(MenuItemProvider, null,
            props.children,
            !hasCustomSuffix ? (React__default.createElement("div", { "data-menu-slot": "suffix", "data-checked": checked ? "" : undefined, "data-unchecked": !checked ? "" : undefined },
                React__default.createElement(Icon, { color: "icon", name: "checkmark" }))) : null)));
});
function BottomSheetSubmenu({ children, open, defaultOpen, onOpenChange, }) {
    const { setSubmenuOpen } = useBottomSheetContext();
    // The trigger writes its title here during render; the content reads it
    // when the drill-down sheet mounts. No setState, no effect roundtrip.
    const titleRef = React__default.useRef("");
    React__default.useEffect(() => {
        // Safety reset so the parent sheet is never left hidden if this submenu
        // unmounts unexpectedly while it controls the nested-drawer state.
        return () => {
            setSubmenuOpen(false);
        };
    }, [setSubmenuOpen]);
    return (React__default.createElement(BottomSheetSubmenuContext.Provider, { value: { titleRef } },
        React__default.createElement(BottomSheet.Root, { open: open, defaultOpen: defaultOpen, onOpenChange: isOpen => {
                setSubmenuOpen(isOpen);
                onOpenChange === null || onOpenChange === void 0 ? void 0 : onOpenChange(isOpen);
            } }, children)));
}
const BottomSheetSubmenuTrigger = React__default.forwardRef(function BottomSheetSubmenuTrigger({ children, className, style, textValue, UNSAFE_style, UNSAFE_className }, ref) {
    const { isHighlighted, interactionProps } = useBottomSheetMenuItemInteractions();
    const resolvedBaseProps = resolveComposableBaseProps({
        className,
        style,
        UNSAFE_className,
        UNSAFE_style,
    });
    const hasCustomSuffix = hasMenuSlot(children, "suffix");
    const hasLeadingContent = hasMenuSlot(children, "icon") || hasMenuSlot(children, "prefix");
    const { titleRef } = useBottomSheetSubmenuContext();
    // Publish the title synchronously during render so the drill-down sheet
    // header can read it the moment it mounts. Prefer the explicit textValue
    // used for type-to-select, and fall back to the rendered text content.
    titleRef.current = textValue !== null && textValue !== void 0 ? textValue : getTextContent(children).trim();
    return (React__default.createElement(DrawerTrigger, Object.assign({ ref: ref, role: "menuitem", "aria-haspopup": "menu", "data-highlighted": isHighlighted ? "" : undefined, className: classnames(styles.action, styles.composableItem, {
            [styles.composableItemNoLeadingSlot]: !hasLeadingContent,
        }, resolvedBaseProps.className), style: resolvedBaseProps.style, nativeButton: true }, interactionProps, { render: React__default.createElement("button", { type: "button" }) }),
        children,
        !hasCustomSuffix ? (React__default.createElement("div", { "data-menu-slot": "suffix" },
            React__default.createElement(Icon, { color: "icon", name: "arrowRight" }))) : null));
});
function BottomSheetSubmenuContent({ children, className, style, UNSAFE_style, UNSAFE_className, }) {
    const { titleRef } = useBottomSheetSubmenuContext();
    const title = titleRef.current;
    const { focusModalityRef } = useBottomSheetContext();
    const menuRef = React__default.useRef(null);
    const resolvedBaseProps = resolveComposableBaseProps({
        className,
        style,
        UNSAFE_className,
        UNSAFE_style,
    });
    const bottomSheetStyle = getBottomSheetContentStyle(resolvedBaseProps.style);
    return (React__default.createElement(BottomSheet.Popup, { initialFocus: getInitialBottomSheetFocus(menuRef, focusModalityRef), className: classnames(styles.menu, styles.bottomSheetSubmenuPopup) },
        React__default.createElement(BottomSheet.Content, { style: bottomSheetStyle },
            title ? (React__default.createElement(DrawerTitle, { className: styles.screenReaderOnly }, title)) : null,
            React__default.createElement("div", { className: styles$1.submenuHeader },
                React__default.createElement(DrawerClose, { "aria-label": title ? `Back to ${title}` : "Back", render: React__default.createElement(Button, { ariaLabel: title ? `Back to ${title}` : "Back", icon: "arrowLeft", type: "tertiary", variation: "subtle" }) }),
                title ? (React__default.createElement("div", { className: styles$1.submenuTitle },
                    React__default.createElement(Typography, { element: "span", size: "base", fontWeight: "semiBold", textColor: "text" }, title))) : null),
            React__default.createElement(BottomSheetMenuSurface, { menuRef: menuRef, className: classnames(styles.bottomSheetSubmenuBody, styles.composableSection, resolvedBaseProps.className) }, children))));
}
function BottomSheetGroupLabel(props) {
    const { className, style } = resolveComposableBaseProps(props);
    const { labelId, registerLabel } = useBottomSheetGroupContext();
    React__default.useEffect(() => {
        registerLabel(true);
        return () => {
            registerLabel(false);
        };
    }, [registerLabel]);
    return (React__default.createElement("div", { id: labelId, role: "presentation", className: classnames(sharedMenuGroupLabelClassName, className), style: style },
        React__default.createElement(SharedMenuGroupLabelContent, Object.assign({}, props))));
}
const MenuBottomSheet = Object.assign(BottomSheetRoot, {
    Trigger: BottomSheetTrigger,
    Content: BottomSheetContent,
    Separator: BottomSheetSeparator,
    RadioGroup: BottomSheetRadioGroup,
    RadioItem: BottomSheetRadioItem,
    Submenu: BottomSheetSubmenu,
    SubmenuTrigger: BottomSheetSubmenuTrigger,
    SubmenuContent: BottomSheetSubmenuContent,
    Group: BottomSheetGroup,
    Item: BottomSheetItem,
    ItemIcon: SharedMenuItemIcon,
    ItemLabel: SharedMenuItemLabel,
    ItemPrefix: SharedMenuItemPrefix,
    ItemSuffix: SharedMenuItemSuffix,
    GroupLabel: BottomSheetGroupLabel,
});

// Desktop/dropdown implementation for Menu. This maps the Atlantis
// sugar API onto Base UI Menu primitives while sharing the visual slot layer
// with the mobile BottomSheet implementation.
const MenuDropdownContext = React__default.createContext(null);
function useMenuDropdownContext() {
    const context = React__default.useContext(MenuDropdownContext);
    if (!context) {
        throw new Error("MenuDropdownContext used outside provider");
    }
    return context;
}
function getFloatingLayerStyle(style) {
    if ((style === null || style === void 0 ? void 0 : style.zIndex) == null)
        return undefined;
    return { zIndex: style.zIndex };
}
function getMenuPopupStyle(style) {
    return Object.assign({ maxHeight: `min(${MENU_MAX_HEIGHT_PERCENTAGE}vh, max(0px, calc(var(--available-height) - var(--space-base))))` }, style);
}
function MenuDropdownRoot({ children, onOpenChange, open, defaultOpen, }) {
    const actionsRef = React__default.useRef(null);
    return (React__default.createElement(MenuDropdownContext.Provider, { value: {
            close: () => {
                var _a;
                (_a = actionsRef.current) === null || _a === void 0 ? void 0 : _a.close();
            },
        } },
        React__default.createElement(MenuRoot, { actionsRef: actionsRef, open: open, defaultOpen: defaultOpen, onOpenChange: isOpen => {
                onOpenChange === null || onOpenChange === void 0 ? void 0 : onOpenChange(isOpen);
            } }, children)));
}
const MenuDropdownTrigger = React__default.forwardRef(function MenuDropdownTrigger({ ariaLabel, children, style, className, render, UNSAFE_style, UNSAFE_className, }, ref) {
    const resolvedBaseProps = resolveComposableBaseProps({
        className,
        style,
        UNSAFE_className,
        UNSAFE_style,
    });
    // ComposableMenu.Trigger is Atlantis sugar over Base UI's trigger render API,
    // letting us provide a default Atlantis trigger while still allowing custom renders.
    return (React__default.createElement(MenuTrigger$1, { "aria-label": ariaLabel, className: classnames(styles.triggerWrapper, resolvedBaseProps.className), style: resolvedBaseProps.style, render: resolveMenuTriggerRender({ children, render }), ref: ref }));
});
function MenuDropdownContent({ children, style, className, preferredPlacement, UNSAFE_style, UNSAFE_className, }) {
    var _a;
    const resolvedBaseProps = resolveComposableBaseProps({
        className,
        style,
        UNSAFE_className,
        UNSAFE_style,
    });
    // Safe assertion: MenuPlacement is a bare side or a "side align" pair.
    const [side = "bottom", align = "start"] = ((_a = preferredPlacement === null || preferredPlacement === void 0 ? void 0 : preferredPlacement.split(" ")) !== null && _a !== void 0 ? _a : []);
    const floatingLayerStyle = getFloatingLayerStyle(resolvedBaseProps.style);
    const popupStyle = getMenuPopupStyle(resolvedBaseProps.style);
    return (React__default.createElement(MenuPortal$1, null,
        React__default.createElement(MenuBackdrop, { className: styles.composableBackdrop }),
        React__default.createElement(MenuPositioner, { className: styles.floatingContainer, style: floatingLayerStyle, align: align, side: side, sideOffset: MENU_OFFSET },
            React__default.createElement(MenuPopup, { className: classnames(styles.menu, styles.composableDropdownPopup, resolvedBaseProps.className), style: popupStyle },
                React__default.createElement("div", { className: classnames(styles.composableMenu, styles.composableDropdownScroller) }, children)))));
}
function MenuDropdownRadioGroup({ children, value, defaultValue, onValueChange, className, style, UNSAFE_style, UNSAFE_className, }) {
    const resolvedBaseProps = resolveComposableBaseProps({
        className,
        style,
        UNSAFE_className,
        UNSAFE_style,
    });
    return (React__default.createElement(MenuRadioGroup$1, { value: value, defaultValue: defaultValue, onValueChange: nextValue => {
            onValueChange === null || onValueChange === void 0 ? void 0 : onValueChange(String(nextValue));
        }, className: classnames(styles.composableRadioGroup, resolvedBaseProps.className), style: resolvedBaseProps.style }, children));
}
function MenuDropdownSeparator({ style, className, UNSAFE_style, UNSAFE_className, }) {
    const resolvedBaseProps = resolveComposableBaseProps({
        className,
        style,
        UNSAFE_className,
        UNSAFE_style,
    });
    return (React__default.createElement(OverlaySeparator, { className: classnames(styles.separator, resolvedBaseProps.className), style: resolvedBaseProps.style, "data-testid": "ATL-Menu-Separator" }));
}
function MenuDropdownGroup(props) {
    const { className, style } = resolveComposableBaseProps(props);
    return (React__default.createElement(MenuGroup$1, { "aria-label": props.ariaLabel, className: classnames(styles.composableGroup, className), style: style }, props.children));
}
const MenuDropdownItem = React__default.forwardRef(function MenuDropdownItem(props, ref) {
    const { close } = useMenuDropdownContext();
    const { className: itemClassName, style } = resolveComposableBaseProps(props);
    const { textValue } = props;
    const hasLeadingContent = hasMenuSlot(props.children, "icon") ||
        hasMenuSlot(props.children, "prefix");
    const className = classnames(styles.action, styles.composableItem, {
        [styles.composableItemNoLeadingSlot]: !hasLeadingContent,
        [styles.destructive]: props.variation === "destructive",
    }, itemClassName);
    if (props.href) {
        const { href, target, rel, onClick, closeOnClick = true } = props;
        return (React__default.createElement(MenuLinkItem, { ref: ref, className: className, style: style, label: textValue, href: href, target: target, rel: rel, closeOnClick: closeOnClick, onClick: onClick },
            React__default.createElement(MenuItemProvider, { variation: props.variation }, props.children)));
    }
    return (React__default.createElement(MenuItem$1, { ref: ref, className: className, style: style, label: textValue, closeOnClick: props.closeOnClick, nativeButton: true, render: React__default.createElement("button", { type: "button" }), onClick: () => {
            var _a;
            (_a = props.onClick) === null || _a === void 0 ? void 0 : _a.call(props);
        }, onKeyUp: event => {
            // Base UI handles dismissal on click, but this keeps the Atlantis
            // button-rendered item path closing consistently on Space as well.
            if (event.key === " ") {
                close();
            }
        } },
        React__default.createElement(MenuItemProvider, { variation: props.variation }, props.children)));
});
const MenuDropdownRadioItem = React__default.forwardRef(function MenuDropdownRadioItem(props, ref) {
    const { className, style } = resolveComposableBaseProps(props);
    const hasCustomSuffix = hasMenuSlot(props.children, "suffix");
    const hasLeadingContent = hasMenuSlot(props.children, "icon") ||
        hasMenuSlot(props.children, "prefix");
    return (React__default.createElement(MenuRadioItem$1, { ref: ref, className: classnames(styles.action, styles.composableItem, {
            [styles.composableItemNoLeadingSlot]: !hasLeadingContent,
        }, className), style: style, value: props.value, label: props.textValue, closeOnClick: props.closeOnClick, nativeButton: true, render: React__default.createElement("button", { type: "button" }) },
        React__default.createElement(MenuItemProvider, null,
            props.children,
            !hasCustomSuffix ? (React__default.createElement(MenuRadioItemIndicator, { "data-menu-slot": "suffix", keepMounted: true },
                React__default.createElement(Icon, { color: "icon", name: "checkmark" }))) : null)));
});
function MenuDropdownSubmenu({ children, open, defaultOpen, onOpenChange, }) {
    return (React__default.createElement(MenuSubmenuRoot, { open: open, defaultOpen: defaultOpen, onOpenChange: isOpen => {
            onOpenChange === null || onOpenChange === void 0 ? void 0 : onOpenChange(isOpen);
        } }, children));
}
const MenuDropdownSubmenuTrigger = React__default.forwardRef(function MenuDropdownSubmenuTrigger(props, ref) {
    const resolvedBaseProps = resolveComposableBaseProps(props);
    const hasCustomSuffix = hasMenuSlot(props.children, "suffix");
    const hasLeadingContent = hasMenuSlot(props.children, "icon") ||
        hasMenuSlot(props.children, "prefix");
    return (React__default.createElement(MenuSubmenuTrigger$1, { ref: ref, className: classnames(styles.action, styles.composableItem, {
            [styles.composableItemNoLeadingSlot]: !hasLeadingContent,
        }, resolvedBaseProps.className), style: resolvedBaseProps.style, label: props.textValue, nativeButton: true, render: React__default.createElement("button", { type: "button" }) },
        props.children,
        !hasCustomSuffix ? (React__default.createElement("div", { "data-menu-slot": "suffix" },
            React__default.createElement(Icon, { color: "icon", name: "arrowRight" }))) : null));
});
function MenuDropdownSubmenuContent({ children, className, style, UNSAFE_style, UNSAFE_className, }) {
    const resolvedBaseProps = resolveComposableBaseProps({
        className,
        style,
        UNSAFE_className,
        UNSAFE_style,
    });
    const floatingLayerStyle = getFloatingLayerStyle(resolvedBaseProps.style);
    const popupStyle = getMenuPopupStyle(resolvedBaseProps.style);
    return (React__default.createElement(MenuPortal$1, null,
        React__default.createElement(MenuPositioner, { className: styles.floatingContainer, style: floatingLayerStyle, align: "start", side: "right", sideOffset: MENU_OFFSET },
            React__default.createElement(MenuPopup, { className: classnames(styles.menu, styles.composableDropdownPopup, resolvedBaseProps.className), style: popupStyle },
                React__default.createElement("div", { className: classnames(styles.composableMenu, styles.composableDropdownScroller) }, children)))));
}
function MenuDropdownGroupLabel(props) {
    const { className, style } = resolveComposableBaseProps(props);
    return (React__default.createElement(MenuGroupLabel$1, { className: classnames(sharedMenuGroupLabelClassName, className), style: style },
        React__default.createElement(SharedMenuGroupLabelContent, Object.assign({}, props))));
}
const MenuDropdown = Object.assign(MenuDropdownRoot, {
    Trigger: MenuDropdownTrigger,
    Content: MenuDropdownContent,
    Separator: MenuDropdownSeparator,
    RadioGroup: MenuDropdownRadioGroup,
    RadioItem: MenuDropdownRadioItem,
    Submenu: MenuDropdownSubmenu,
    SubmenuTrigger: MenuDropdownSubmenuTrigger,
    SubmenuContent: MenuDropdownSubmenuContent,
    Group: MenuDropdownGroup,
    Item: MenuDropdownItem,
    ItemIcon: SharedMenuItemIcon,
    ItemLabel: SharedMenuItemLabel,
    ItemPrefix: SharedMenuItemPrefix,
    ItemSuffix: SharedMenuItemSuffix,
    GroupLabel: MenuDropdownGroupLabel,
});

function isLegacy(props) {
    return "items" in props;
}
const MenuContext = React__default.createContext(null);
function useMenuContext() {
    const context = React__default.useContext(MenuContext);
    if (!context) {
        throw new Error("Menu components must be rendered inside Menu");
    }
    return context;
}
function useMenuShell() {
    const { isMobile } = useMenuContext();
    return isMobile ? MenuBottomSheet : MenuDropdown;
}
function MenuComposableRoot(props) {
    const { width } = useWindowDimensions();
    const isMobile = width !== undefined && width <= SMALL_SCREEN_BREAKPOINT;
    const RootComponent = isMobile ? MenuBottomSheet : MenuDropdown;
    return (React__default.createElement(MenuContext.Provider, { value: { isMobile } },
        React__default.createElement(RootComponent, { onOpenChange: props.onOpenChange, open: props.open, defaultOpen: props.defaultOpen }, props.children)));
}
function Menu(props) {
    if (isLegacy(props)) {
        return React__default.createElement(MenuLegacy, Object.assign({}, props));
    }
    return React__default.createElement(MenuComposableRoot, Object.assign({}, props));
}
const MenuTrigger = React__default.forwardRef(function MenuTrigger(props, ref) {
    const Shell = useMenuShell();
    return React__default.createElement(Shell.Trigger, Object.assign({}, props, { ref: ref }));
});
function MenuContent(props) {
    const Shell = useMenuShell();
    return React__default.createElement(Shell.Content, Object.assign({}, props));
}
function MenuSeparator(props) {
    const Shell = useMenuShell();
    return React__default.createElement(Shell.Separator, Object.assign({}, props));
}
function MenuRadioGroup(props) {
    const Shell = useMenuShell();
    return React__default.createElement(Shell.RadioGroup, Object.assign({}, props));
}
const MenuRadioItem = React__default.forwardRef(function MenuRadioItem(props, ref) {
    const Shell = useMenuShell();
    return React__default.createElement(Shell.RadioItem, Object.assign({}, props, { ref: ref }));
});
function MenuSubmenu(props) {
    const Shell = useMenuShell();
    return React__default.createElement(Shell.Submenu, Object.assign({}, props));
}
const MenuSubmenuTrigger = React__default.forwardRef(function MenuSubmenuTrigger(props, ref) {
    const Shell = useMenuShell();
    return React__default.createElement(Shell.SubmenuTrigger, Object.assign({}, props, { ref: ref }));
});
function MenuSubmenuContent(props) {
    const Shell = useMenuShell();
    return React__default.createElement(Shell.SubmenuContent, Object.assign({}, props));
}
function MenuGroup(props) {
    const Shell = useMenuShell();
    return React__default.createElement(Shell.Group, Object.assign({}, props));
}
/**
 * @deprecated Use Menu.Group instead.
 * This wrapper keeps the old composable authoring shape working while the
 * underlying menu structure uses grouped semantics.
 */
function MenuSection(props) {
    return React__default.createElement(MenuGroup, Object.assign({}, props));
}
const MenuItem = React__default.forwardRef(function MenuItem(props, ref) {
    const Shell = useMenuShell();
    return React__default.createElement(Shell.Item, Object.assign({}, props, { ref: ref }));
});
function MenuItemIcon(props) {
    const Shell = useMenuShell();
    return React__default.createElement(Shell.ItemIcon, Object.assign({}, props));
}
function MenuItemLabel(props) {
    const Shell = useMenuShell();
    return React__default.createElement(Shell.ItemLabel, Object.assign({}, props));
}
function MenuItemPrefix(props) {
    const Shell = useMenuShell();
    return React__default.createElement(Shell.ItemPrefix, Object.assign({}, props));
}
function MenuItemSuffix(props) {
    const Shell = useMenuShell();
    return React__default.createElement(Shell.ItemSuffix, Object.assign({}, props));
}
MenuItemPrefix.menuSlot =
    "prefix";
MenuItemSuffix.menuSlot =
    "suffix";
MenuItemIcon.menuSlot = "icon";
function MenuGroupLabel(props) {
    const Shell = useMenuShell();
    return React__default.createElement(Shell.GroupLabel, Object.assign({}, props));
}
/**
 * @deprecated Use Menu.GroupLabel instead.
 * Header remains as a thin wrapper so older JSX can keep compiling without
 * recreating the old internal DOM structure.
 */
function MenuHeader(props) {
    return React__default.createElement(MenuGroupLabel, Object.assign({}, props));
}
/**
 * @deprecated Use Menu.GroupLabel content directly instead.
 * HeaderLabel is intentionally a pass-through so the old nested pattern:
 * Menu.Header > Menu.HeaderLabel continues to compose onto the new GroupLabel.
 */
function MenuHeaderLabel(props) {
    return React__default.createElement(React__default.Fragment, null, props.children);
}
// Menu now routes the legacy items-based API locally and owns the new
// Base UI-backed composable implementation directly.
Menu.Group = MenuGroup;
Menu.GroupLabel = MenuGroupLabel;
Menu.Section = MenuSection;
Menu.Header = MenuHeader;
Menu.HeaderLabel = MenuHeaderLabel;
Menu.Item = MenuItem;
Menu.Trigger = MenuTrigger;
Menu.Content = MenuContent;
Menu.Separator = MenuSeparator;
Menu.RadioGroup = MenuRadioGroup;
Menu.RadioItem = MenuRadioItem;
Menu.Submenu = MenuSubmenu;
Menu.SubmenuTrigger = MenuSubmenuTrigger;
Menu.SubmenuContent = MenuSubmenuContent;
Menu.ItemIcon = MenuItemIcon;
Menu.ItemLabel = MenuItemLabel;
Menu.ItemPrefix = MenuItemPrefix;
Menu.ItemSuffix = MenuItemSuffix;

export { Menu as M };
