/** @license MIT | @cube-dev/ui-kit v0.135.1 | Cube Dev Team */
//#region src/components/content/Tree/tree-index.ts
function buildTreeIndex(treeData) {
	const byKey = /* @__PURE__ */ new Map();
	const parentOf = /* @__PURE__ */ new Map();
	const childrenOf = /* @__PURE__ */ new Map();
	const visit = (nodes, parent) => {
		for (const node of nodes) {
			byKey.set(node.key, node);
			parentOf.set(node.key, parent);
			const childKeys = (node.children ?? []).map((c) => c.key);
			childrenOf.set(node.key, childKeys);
			if (node.children) visit(node.children, node.key);
		}
	};
	visit(treeData, null);
	return {
		byKey,
		parentOf,
		childrenOf
	};
}

//#endregion
export { buildTreeIndex };
//# sourceMappingURL=tree-index.js.map