"use client";
import { parts } from "./segment-group.anatomy.js";
import { createSplitProps } from "../../utils/create-split-props.js";
import { ark } from "../factory.js";
import { useSegmentGroupContext } from "./use-segment-group-context.js";
import { SegmentGroupItemProvider } from "./use-segment-group-item-context.js";
import { SegmentGroupItemPropsProvider } from "./use-segment-group-item-props-context.js";
import { forwardRef } from "react";
import { mergeProps } from "@zag-js/react";
import { jsx } from "react/jsx-runtime";
//#region src/components/segment-group/segment-group-item.tsx
var splitItemProps = createSplitProps();
var SegmentGroupItem = forwardRef((props, ref) => {
	const [itemProps, localProps] = splitItemProps(props, [
		"value",
		"disabled",
		"invalid"
	]);
	const segmentGroup = useSegmentGroupContext();
	const mergedProps = mergeProps(segmentGroup.getItemProps(itemProps), parts.item.attrs, localProps);
	return /* @__PURE__ */ jsx(SegmentGroupItemPropsProvider, {
		value: itemProps,
		children: /* @__PURE__ */ jsx(SegmentGroupItemProvider, {
			value: segmentGroup.getItemState(itemProps),
			children: /* @__PURE__ */ jsx(ark.label, {
				...mergedProps,
				ref
			})
		})
	});
});
SegmentGroupItem.displayName = "SegmentGroupItem";
//#endregion
export { SegmentGroupItem };
