"use client";
import { RenderStrategyPropsProvider, splitRenderStrategyProps } from "../../utils/render-strategy.js";
import { splitPresenceProps } from "../presence/split-presence-props.js";
import { usePresence } from "../presence/use-presence.js";
import { PresenceProvider } from "../presence/use-presence-context.js";
import { DialogProvider } from "./use-dialog-context.js";
import { useDialog } from "./use-dialog.js";
import { mergeProps } from "@zag-js/react";
import { jsx } from "react/jsx-runtime";
//#region src/components/dialog/dialog-root.tsx
var DialogRoot = (props) => {
	const [presenceProps, { children, ...localProps }] = splitPresenceProps(props);
	const [renderStrategyProps] = splitRenderStrategyProps(presenceProps);
	const dialog = useDialog(localProps);
	return /* @__PURE__ */ jsx(DialogProvider, {
		value: dialog,
		children: /* @__PURE__ */ jsx(RenderStrategyPropsProvider, {
			value: renderStrategyProps,
			children: /* @__PURE__ */ jsx(PresenceProvider, {
				value: usePresence(mergeProps({ present: dialog.open }, presenceProps)),
				children
			})
		})
	});
};
//#endregion
export { DialogRoot };
