import { j as jsxRuntimeExports } from '../../node_modules/.pnpm/react@18.2.0/node_modules/react/jsx-runtime.js';
import { useMenuContext } from '../../node_modules/.pnpm/@ariakit_react-core@0.4.16_react-dom@18.3.1_react@18.2.0__react@18.2.0/node_modules/@ariakit/react-core/esm/__chunks/VIIRIBF3.js';
import { Menu } from '../../node_modules/.pnpm/@ariakit_react-core@0.4.16_react-dom@18.3.1_react@18.2.0__react@18.2.0/node_modules/@ariakit/react-core/esm/menu/menu.js';
import { Combobox } from '../../node_modules/.pnpm/@ariakit_react-core@0.4.16_react-dom@18.3.1_react@18.2.0__react@18.2.0/node_modules/@ariakit/react-core/esm/combobox/combobox.js';
import { ComboboxList } from '../../node_modules/.pnpm/@ariakit_react-core@0.4.16_react-dom@18.3.1_react@18.2.0__react@18.2.0/node_modules/@ariakit/react-core/esm/__chunks/MAXQOH4L.js';
import { cx } from '../../node_modules/.pnpm/class-variance-authority@0.7.1/node_modules/class-variance-authority/dist/index.js';
import { forwardRef, useRef } from 'react';
import { useDropdownContext } from './dropdown-menu-root.js';
import styles from './dropdown-menu.module.css.js';
import { Root as Slot } from '../../node_modules/.pnpm/@radix-ui_react-slot@1.2.3_@types_react@18.2.12_react@18.2.0/node_modules/@radix-ui/react-slot/dist/index.js';

const DropdownMenuContent = forwardRef(({ className, children, asChild, searchPlaceholder = 'Search...', ...props }, ref) => {
    const menu = useMenuContext();
    const { autocomplete } = useDropdownContext();
    const isSubMenu = !!menu?.parent;
    const comboboxRef = useRef(null);
    return (jsxRuntimeExports.jsx(Menu, { ref: ref, modal: true, portal: true, portalElement: typeof window === 'undefined' ? null : window?.document?.body, unmountOnHide: true, gutter: isSubMenu ? 2 : 4, className: cx(styles.content, autocomplete && styles.comboboxContainer, className), render: asChild ? jsxRuntimeExports.jsx(Slot, {}) : undefined, ...props, children: autocomplete ? (jsxRuntimeExports.jsxs(jsxRuntimeExports.Fragment, { children: [jsxRuntimeExports.jsx(Combobox, { ref: comboboxRef, placeholder: searchPlaceholder, className: styles.comboboxInput, autoSelect: true, onPointerEnter: e => {
                        if (document && document.activeElement !== comboboxRef.current)
                            comboboxRef.current?.focus();
                    } }), jsxRuntimeExports.jsx(ComboboxList, { className: styles.comboboxContent, children: children })] })) : (children) }));
});

export { DropdownMenuContent };
//# sourceMappingURL=dropdown-menu-content.js.map
