import _extends from '../../../../../@babel_runtime@7.24.8/node_modules/@babel/runtime/helpers/esm/extends.js';
import { useRef, createElement, useCallback, forwardRef } from 'react';
import { composeEventHandlers as $e42e1063c40fb3ef$export$b9ecd428b558ff10 } from '../../../../../@radix-ui_primitive@1.0.1/node_modules/@radix-ui/primitive/dist/index.js';
import { composeRefs as $6ed0406888f73fc4$export$43e446d32b3d21af } from '../../../../../@radix-ui_react-compose-refs@1.0.1_@types_react@18.2.12_react@18.2.0/node_modules/@radix-ui/react-compose-refs/dist/index.js';
import { createContextScope as $c512c27ab02ef895$export$50c7b4e9d9f19c1 } from '../../../../../@radix-ui_react-context@1.0.1_@types_react@18.2.12_react@18.2.0/node_modules/@radix-ui/react-context/dist/index.js';
import { useControllableState as $71cd76cc60e0454e$export$6f32135080cb4c3 } from '../../../../../@radix-ui_react-use-controllable-state@1.0.1_@types_react@18.2.12_react@18.2.0/node_modules/@radix-ui/react-use-controllable-state/dist/index.js';
import { Primitive as $8927f6f2acc4f386$export$250ffa63cdc0d034 } from '../../../../../@radix-ui_react-primitive@1.0.3_@types_react-dom@18.0.11_@types_react@18.2.12_react-dom@18.3._44pjkdrkjq3hxuh62jsxoggm4e/node_modules/@radix-ui/react-primitive/dist/index.js';
import { createMenuScope as $6cc32821e9371a1c$export$4027731b685e72eb, Root as $6cc32821e9371a1c$export$be92b6f5f03c0fe9, Anchor as $6cc32821e9371a1c$export$b688253958b8dfe7, Portal as $6cc32821e9371a1c$export$602eac185826482c, Content as $6cc32821e9371a1c$export$7c6e2c02157bb7d2, Group as $6cc32821e9371a1c$export$eb2fcfdbd7ba97d4, Label as $6cc32821e9371a1c$export$b04be29aa201d4f5, Item as $6cc32821e9371a1c$export$6d08773d2e66f8f2, Separator as $6cc32821e9371a1c$export$1ff3c3f08ae963c0 } from '../../../../../@radix-ui_react-menu@2.0.5_@types_react-dom@18.0.11_@types_react@18.2.12_react-dom@18.3.1_react@18.2.0__react@18.2.0/node_modules/@radix-ui/react-menu/dist/index.js';
import { useId as $1746a345f3d73bb7$export$f680877a34711e37 } from '../../../../../@radix-ui_react-id@1.0.1_@types_react@18.2.12_react@18.2.0/node_modules/@radix-ui/react-id/dist/index.js';

/* -------------------------------------------------------------------------------------------------
 * DropdownMenu
 * -----------------------------------------------------------------------------------------------*/ const $d08ef79370b62062$var$DROPDOWN_MENU_NAME = 'DropdownMenu';
const [$d08ef79370b62062$var$createDropdownMenuContext, $d08ef79370b62062$export$c0623cd925aeb687] = $c512c27ab02ef895$export$50c7b4e9d9f19c1($d08ef79370b62062$var$DROPDOWN_MENU_NAME, [
    $6cc32821e9371a1c$export$4027731b685e72eb
]);
const $d08ef79370b62062$var$useMenuScope = $6cc32821e9371a1c$export$4027731b685e72eb();
const [$d08ef79370b62062$var$DropdownMenuProvider, $d08ef79370b62062$var$useDropdownMenuContext] = $d08ef79370b62062$var$createDropdownMenuContext($d08ef79370b62062$var$DROPDOWN_MENU_NAME);
const $d08ef79370b62062$export$e44a253a59704894 = (props)=>{
    const { __scopeDropdownMenu: __scopeDropdownMenu , children: children , dir: dir , open: openProp , defaultOpen: defaultOpen , onOpenChange: onOpenChange , modal: modal = true  } = props;
    const menuScope = $d08ef79370b62062$var$useMenuScope(__scopeDropdownMenu);
    const triggerRef = useRef(null);
    const [open = false, setOpen] = $71cd76cc60e0454e$export$6f32135080cb4c3({
        prop: openProp,
        defaultProp: defaultOpen,
        onChange: onOpenChange
    });
    return /*#__PURE__*/ createElement($d08ef79370b62062$var$DropdownMenuProvider, {
        scope: __scopeDropdownMenu,
        triggerId: $1746a345f3d73bb7$export$f680877a34711e37(),
        triggerRef: triggerRef,
        contentId: $1746a345f3d73bb7$export$f680877a34711e37(),
        open: open,
        onOpenChange: setOpen,
        onOpenToggle: useCallback(()=>setOpen((prevOpen)=>!prevOpen
            )
        , [
            setOpen
        ]),
        modal: modal
    }, /*#__PURE__*/ createElement($6cc32821e9371a1c$export$be92b6f5f03c0fe9, _extends({}, menuScope, {
        open: open,
        onOpenChange: setOpen,
        dir: dir,
        modal: modal
    }), children));
};
/* -------------------------------------------------------------------------------------------------
 * DropdownMenuTrigger
 * -----------------------------------------------------------------------------------------------*/ const $d08ef79370b62062$var$TRIGGER_NAME = 'DropdownMenuTrigger';
const $d08ef79370b62062$export$d2469213b3befba9 = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
    const { __scopeDropdownMenu: __scopeDropdownMenu , disabled: disabled = false , ...triggerProps } = props;
    const context = $d08ef79370b62062$var$useDropdownMenuContext($d08ef79370b62062$var$TRIGGER_NAME, __scopeDropdownMenu);
    const menuScope = $d08ef79370b62062$var$useMenuScope(__scopeDropdownMenu);
    return /*#__PURE__*/ createElement($6cc32821e9371a1c$export$b688253958b8dfe7, _extends({
        asChild: true
    }, menuScope), /*#__PURE__*/ createElement($8927f6f2acc4f386$export$250ffa63cdc0d034.button, _extends({
        type: "button",
        id: context.triggerId,
        "aria-haspopup": "menu",
        "aria-expanded": context.open,
        "aria-controls": context.open ? context.contentId : undefined,
        "data-state": context.open ? 'open' : 'closed',
        "data-disabled": disabled ? '' : undefined,
        disabled: disabled
    }, triggerProps, {
        ref: $6ed0406888f73fc4$export$43e446d32b3d21af(forwardedRef, context.triggerRef),
        onPointerDown: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onPointerDown, (event)=>{
            // only call handler if it's the left button (mousedown gets triggered by all mouse buttons)
            // but not when the control key is pressed (avoiding MacOS right click)
            if (!disabled && event.button === 0 && event.ctrlKey === false) {
                context.onOpenToggle(); // prevent trigger focusing when opening
                // this allows the content to be given focus without competition
                if (!context.open) event.preventDefault();
            }
        }),
        onKeyDown: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onKeyDown, (event)=>{
            if (disabled) return;
            if ([
                'Enter',
                ' '
            ].includes(event.key)) context.onOpenToggle();
            if (event.key === 'ArrowDown') context.onOpenChange(true); // prevent keydown from scrolling window / first focused item to execute
            // that keydown (inadvertently closing the menu)
            if ([
                'Enter',
                ' ',
                'ArrowDown'
            ].includes(event.key)) event.preventDefault();
        })
    })));
});
const $d08ef79370b62062$export$cd369b4d4d54efc9 = (props)=>{
    const { __scopeDropdownMenu: __scopeDropdownMenu , ...portalProps } = props;
    const menuScope = $d08ef79370b62062$var$useMenuScope(__scopeDropdownMenu);
    return /*#__PURE__*/ createElement($6cc32821e9371a1c$export$602eac185826482c, _extends({}, menuScope, portalProps));
};
/* -------------------------------------------------------------------------------------------------
 * DropdownMenuContent
 * -----------------------------------------------------------------------------------------------*/ const $d08ef79370b62062$var$CONTENT_NAME = 'DropdownMenuContent';
const $d08ef79370b62062$export$6e76d93a37c01248 = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
    const { __scopeDropdownMenu: __scopeDropdownMenu , ...contentProps } = props;
    const context = $d08ef79370b62062$var$useDropdownMenuContext($d08ef79370b62062$var$CONTENT_NAME, __scopeDropdownMenu);
    const menuScope = $d08ef79370b62062$var$useMenuScope(__scopeDropdownMenu);
    const hasInteractedOutsideRef = useRef(false);
    return /*#__PURE__*/ createElement($6cc32821e9371a1c$export$7c6e2c02157bb7d2, _extends({
        id: context.contentId,
        "aria-labelledby": context.triggerId
    }, menuScope, contentProps, {
        ref: forwardedRef,
        onCloseAutoFocus: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onCloseAutoFocus, (event)=>{
            var _context$triggerRef$c;
            if (!hasInteractedOutsideRef.current) (_context$triggerRef$c = context.triggerRef.current) === null || _context$triggerRef$c === void 0 || _context$triggerRef$c.focus();
            hasInteractedOutsideRef.current = false; // Always prevent auto focus because we either focus manually or want user agent focus
            event.preventDefault();
        }),
        onInteractOutside: $e42e1063c40fb3ef$export$b9ecd428b558ff10(props.onInteractOutside, (event)=>{
            const originalEvent = event.detail.originalEvent;
            const ctrlLeftClick = originalEvent.button === 0 && originalEvent.ctrlKey === true;
            const isRightClick = originalEvent.button === 2 || ctrlLeftClick;
            if (!context.modal || isRightClick) hasInteractedOutsideRef.current = true;
        }),
        style: {
            ...props.style,
            '--radix-dropdown-menu-content-transform-origin': 'var(--radix-popper-transform-origin)',
            '--radix-dropdown-menu-content-available-width': 'var(--radix-popper-available-width)',
            '--radix-dropdown-menu-content-available-height': 'var(--radix-popper-available-height)',
            '--radix-dropdown-menu-trigger-width': 'var(--radix-popper-anchor-width)',
            '--radix-dropdown-menu-trigger-height': 'var(--radix-popper-anchor-height)'
        }
    }));
});
const $d08ef79370b62062$export$246bebaba3a2f70e = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
    const { __scopeDropdownMenu: __scopeDropdownMenu , ...groupProps } = props;
    const menuScope = $d08ef79370b62062$var$useMenuScope(__scopeDropdownMenu);
    return /*#__PURE__*/ createElement($6cc32821e9371a1c$export$eb2fcfdbd7ba97d4, _extends({}, menuScope, groupProps, {
        ref: forwardedRef
    }));
});
const $d08ef79370b62062$export$76e48c5b57f24495 = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
    const { __scopeDropdownMenu: __scopeDropdownMenu , ...labelProps } = props;
    const menuScope = $d08ef79370b62062$var$useMenuScope(__scopeDropdownMenu);
    return /*#__PURE__*/ createElement($6cc32821e9371a1c$export$b04be29aa201d4f5, _extends({}, menuScope, labelProps, {
        ref: forwardedRef
    }));
});
const $d08ef79370b62062$export$ed97964d1871885d = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
    const { __scopeDropdownMenu: __scopeDropdownMenu , ...itemProps } = props;
    const menuScope = $d08ef79370b62062$var$useMenuScope(__scopeDropdownMenu);
    return /*#__PURE__*/ createElement($6cc32821e9371a1c$export$6d08773d2e66f8f2, _extends({}, menuScope, itemProps, {
        ref: forwardedRef
    }));
});
const $d08ef79370b62062$export$da160178fd3bc7e9 = /*#__PURE__*/ forwardRef((props, forwardedRef)=>{
    const { __scopeDropdownMenu: __scopeDropdownMenu , ...separatorProps } = props;
    const menuScope = $d08ef79370b62062$var$useMenuScope(__scopeDropdownMenu);
    return /*#__PURE__*/ createElement($6cc32821e9371a1c$export$1ff3c3f08ae963c0, _extends({}, menuScope, separatorProps, {
        ref: forwardedRef
    }));
});
/* -----------------------------------------------------------------------------------------------*/ const $d08ef79370b62062$export$be92b6f5f03c0fe9 = $d08ef79370b62062$export$e44a253a59704894;
const $d08ef79370b62062$export$41fb9f06171c75f4 = $d08ef79370b62062$export$d2469213b3befba9;
const $d08ef79370b62062$export$602eac185826482c = $d08ef79370b62062$export$cd369b4d4d54efc9;
const $d08ef79370b62062$export$7c6e2c02157bb7d2 = $d08ef79370b62062$export$6e76d93a37c01248;
const $d08ef79370b62062$export$eb2fcfdbd7ba97d4 = $d08ef79370b62062$export$246bebaba3a2f70e;
const $d08ef79370b62062$export$b04be29aa201d4f5 = $d08ef79370b62062$export$76e48c5b57f24495;
const $d08ef79370b62062$export$6d08773d2e66f8f2 = $d08ef79370b62062$export$ed97964d1871885d;
const $d08ef79370b62062$export$1ff3c3f08ae963c0 = $d08ef79370b62062$export$da160178fd3bc7e9;

export { $d08ef79370b62062$export$7c6e2c02157bb7d2 as Content, $d08ef79370b62062$export$e44a253a59704894 as DropdownMenu, $d08ef79370b62062$export$6e76d93a37c01248 as DropdownMenuContent, $d08ef79370b62062$export$246bebaba3a2f70e as DropdownMenuGroup, $d08ef79370b62062$export$ed97964d1871885d as DropdownMenuItem, $d08ef79370b62062$export$76e48c5b57f24495 as DropdownMenuLabel, $d08ef79370b62062$export$cd369b4d4d54efc9 as DropdownMenuPortal, $d08ef79370b62062$export$da160178fd3bc7e9 as DropdownMenuSeparator, $d08ef79370b62062$export$d2469213b3befba9 as DropdownMenuTrigger, $d08ef79370b62062$export$eb2fcfdbd7ba97d4 as Group, $d08ef79370b62062$export$6d08773d2e66f8f2 as Item, $d08ef79370b62062$export$b04be29aa201d4f5 as Label, $d08ef79370b62062$export$602eac185826482c as Portal, $d08ef79370b62062$export$be92b6f5f03c0fe9 as Root, $d08ef79370b62062$export$1ff3c3f08ae963c0 as Separator, $d08ef79370b62062$export$41fb9f06171c75f4 as Trigger, $d08ef79370b62062$export$c0623cd925aeb687 as createDropdownMenuScope };
//# sourceMappingURL=index.js.map
