import { UdpTreeContext } from "./UdpTree.mjs";
import { c } from "react-compiler-runtime";
import React, { useContext } from "react";
//#region src/UI/fluent-web-components/UdpTreeItem.tsx
/**
* Tree item component for composable tree construction.
* Use inside UdpTree (without treeItems prop) when you need custom JSX in slots.
*
* Renders fluent-tree-item directly (no Stencil wrapper) so that
* fluent-tree's nesting detection works correctly.
*
* Inherits size and appearance from the parent UdpTree via context.
* These can be overridden per-item if needed.
*/
const slotted = (content, slotName) => {
	if (!content) return null;
	if (React.isValidElement(content) && content.type !== React.Fragment) return React.cloneElement(content, { slot: slotName });
	return /* @__PURE__ */ React.createElement("span", { slot: slotName }, content);
};
const UdpTreeItem = (t0) => {
	const $ = c(22);
	let appearance;
	let aside;
	let children;
	let end;
	let props;
	let size;
	let start;
	if ($[0] !== t0) {
		({children, start, end, aside, size, appearance, ...props} = t0);
		$[0] = t0;
		$[1] = appearance;
		$[2] = aside;
		$[3] = children;
		$[4] = end;
		$[5] = props;
		$[6] = size;
		$[7] = start;
	} else {
		appearance = $[1];
		aside = $[2];
		children = $[3];
		end = $[4];
		props = $[5];
		size = $[6];
		start = $[7];
	}
	const treeContext = useContext(UdpTreeContext);
	const t1 = size ?? treeContext.size;
	const t2 = appearance ?? treeContext.appearance;
	let t3;
	if ($[8] !== start) {
		t3 = slotted(start, "start");
		$[8] = start;
		$[9] = t3;
	} else t3 = $[9];
	let t4;
	if ($[10] !== end) {
		t4 = slotted(end, "end");
		$[10] = end;
		$[11] = t4;
	} else t4 = $[11];
	let t5;
	if ($[12] !== aside) {
		t5 = slotted(aside, "aside");
		$[12] = aside;
		$[13] = t5;
	} else t5 = $[13];
	let t6;
	if ($[14] !== children || $[15] !== props || $[16] !== t1 || $[17] !== t2 || $[18] !== t3 || $[19] !== t4 || $[20] !== t5) {
		t6 = /* @__PURE__ */ React.createElement("fluent-tree-item", {
			size: t1,
			appearance: t2,
			...props
		}, t3, children, t4, t5);
		$[14] = children;
		$[15] = props;
		$[16] = t1;
		$[17] = t2;
		$[18] = t3;
		$[19] = t4;
		$[20] = t5;
		$[21] = t6;
	} else t6 = $[21];
	return t6;
};
//#endregion
export { UdpTreeItem };

//# sourceMappingURL=UdpTreeItem.mjs.map