"use client";
import { createSplitProps } from "../../utils/create-split-props.js";
import { ark } from "../factory.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 { ColorPickerProvider } from "./use-color-picker-context.js";
import { forwardRef } from "react";
import { mergeProps } from "@zag-js/react";
import { jsx } from "react/jsx-runtime";
//#region src/components/color-picker/color-picker-root-provider.tsx
var splitRootProviderProps = createSplitProps();
var ColorPickerRootProvider = forwardRef((props, ref) => {
	const [presenceProps, colorPickerProps] = splitPresenceProps(props);
	const [{ value: colorPicker }, localProps] = splitRootProviderProps(colorPickerProps, ["value"]);
	const presence = usePresence(mergeProps({ present: colorPicker.open }, presenceProps));
	const mergedProps = mergeProps(colorPicker.getRootProps(), localProps);
	return /* @__PURE__ */ jsx(ColorPickerProvider, {
		value: colorPicker,
		children: /* @__PURE__ */ jsx(PresenceProvider, {
			value: presence,
			children: /* @__PURE__ */ jsx(ark.div, {
				...mergedProps,
				ref
			})
		})
	});
});
ColorPickerRootProvider.displayName = "ColorPickerRootProvider";
//#endregion
export { ColorPickerRootProvider };
