"use client";
import { ark } from "../factory.js";
import { SwapProvider } from "./use-swap-context.js";
import { useSwap } from "./use-swap.js";
import { forwardRef } from "react";
import { mergeProps } from "@zag-js/react";
import { jsx } from "react/jsx-runtime";
//#region src/components/swap/swap-root.tsx
var SwapRoot = forwardRef((props, ref) => {
	const { children, swap: swapProp, lazyMount, unmountOnExit, ...restProps } = props;
	const swap = useSwap({
		swap: swapProp,
		lazyMount,
		unmountOnExit
	});
	const mergedProps = mergeProps(swap.getRootProps(), restProps);
	return /* @__PURE__ */ jsx(SwapProvider, {
		value: swap,
		children: /* @__PURE__ */ jsx(ark.span, {
			...mergedProps,
			ref,
			children
		})
	});
});
SwapRoot.displayName = "SwapRoot";
//#endregion
export { SwapRoot };
