"use client";
const require_create_split_props = require("../../utils/create-split-props.cjs");
const require_factory = require("../factory.cjs");
const require_split_presence_props = require("../presence/split-presence-props.cjs");
const require_use_presence = require("../presence/use-presence.cjs");
const require_use_presence_context = require("../presence/use-presence-context.cjs");
const require_use_combobox_context = require("./use-combobox-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/combobox/combobox-root-provider.tsx
var ComboboxImpl = (props, ref) => {
	const [presenceProps, comboboxProps] = require_split_presence_props.splitPresenceProps(props);
	const [{ value: combobox }, localProps] = require_create_split_props.createSplitProps()(comboboxProps, ["value"]);
	const presence = require_use_presence.usePresence((0, _zag_js_react.mergeProps)({ present: combobox.open }, presenceProps));
	const mergedProps = (0, _zag_js_react.mergeProps)(combobox.getRootProps(), localProps);
	return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_use_combobox_context.ComboboxProvider, {
		value: combobox,
		children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_use_presence_context.PresenceProvider, {
			value: presence,
			children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_factory.ark.div, {
				...mergedProps,
				ref
			})
		})
	});
};
var ComboboxRootProvider = (0, react.forwardRef)(ComboboxImpl);
//#endregion
exports.ComboboxRootProvider = ComboboxRootProvider;
