"use client";
const require_create_split_props = require("../../utils/create-split-props.cjs");
const require_factory = require("../factory.cjs");
const require_use_menu_context = require("./use-menu-context.cjs");
const require_use_menu_item_context = require("./use-menu-item-context.cjs");
const require_use_menu_option_item_props_context = require("./use-menu-option-item-props-context.cjs");
let react = require("react");
let _zag_js_react = require("@zag-js/react");
let react_jsx_runtime = require("react/jsx-runtime");
//#region src/components/menu/menu-item.tsx
var splitItemBaseProps = require_create_split_props.createSplitProps();
var MenuItem = (0, react.forwardRef)((props, ref) => {
	const [itemProps, localProps] = splitItemBaseProps(props, [
		"closeOnSelect",
		"disabled",
		"value",
		"valueText",
		"onSelect"
	]);
	const menu = require_use_menu_context.useMenuContext();
	const mergedProps = (0, _zag_js_react.mergeProps)(menu.getItemProps(itemProps), localProps);
	const itemState = menu.getItemState(itemProps);
	(0, react.useEffect)(() => {
		return menu.addItemListener({
			id: itemState.id,
			onSelect: itemProps.onSelect
		});
	}, [itemState.id, itemProps.onSelect]);
	return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_use_menu_option_item_props_context.MenuItemPropsProvider, {
		value: itemProps,
		children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_use_menu_item_context.MenuItemProvider, {
			value: itemState,
			children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_factory.ark.div, {
				...mergedProps,
				ref
			})
		})
	});
});
MenuItem.displayName = "MenuItem";
//#endregion
exports.MenuItem = MenuItem;
