"use client";
import { createSplitProps } from "../../utils/create-split-props.js";
import { RenderStrategyPropsProvider, splitRenderStrategyProps } from "../../utils/render-strategy.js";
import { ark } from "../factory.js";
import { TreeViewProvider } from "./use-tree-view-context.js";
import { useTreeView } from "./use-tree-view.js";
import { forwardRef } from "react";
import { mergeProps } from "@zag-js/react";
import { jsx } from "react/jsx-runtime";
//#region src/components/tree-view/tree-view-root.tsx
var TreeViewImpl = (props, ref) => {
	const [renderStrategyProps, treeViewProps] = splitRenderStrategyProps(props);
	const [useTreeViewProps, localProps] = createSplitProps()(treeViewProps, [
		"canRename",
		"checkedValue",
		"collection",
		"defaultCheckedValue",
		"defaultExpandedValue",
		"defaultFocusedValue",
		"defaultSelectedValue",
		"expandedValue",
		"expandOnClick",
		"focusedValue",
		"id",
		"ids",
		"loadChildren",
		"onBeforeRename",
		"onCheckedChange",
		"onExpandedChange",
		"onFocusChange",
		"onLoadChildrenComplete",
		"onLoadChildrenError",
		"onRenameComplete",
		"onRenameStart",
		"onSelectionChange",
		"scrollToIndexFn",
		"selectedValue",
		"selectionMode",
		"translations",
		"typeahead"
	]);
	const treeView = useTreeView(useTreeViewProps);
	const mergedProps = mergeProps(treeView.getRootProps(), localProps);
	return /* @__PURE__ */ jsx(TreeViewProvider, {
		value: treeView,
		children: /* @__PURE__ */ jsx(RenderStrategyPropsProvider, {
			value: renderStrategyProps,
			children: /* @__PURE__ */ jsx(ark.div, {
				...mergedProps,
				ref
			})
		})
	});
};
var TreeViewRoot = forwardRef(TreeViewImpl);
//#endregion
export { TreeViewRoot };
