import { ItemLayout } from "../ItemLayout.mjs";
import { NodeWrapper, traceKeys } from "./index.mjs";
import { jsx } from "react/jsx-runtime";
import { isSameKeyPath } from "@intlayer/core";
import { NodeType } from "@intlayer/types";

//#region src/components/DictionaryEditor/NodeWrapper/NestedObjectWrapper.tsx
const NestedObjectWrapper = (props) => {
	const { keyPath, section, focusedKeyPath = [], onFocusKeyPath } = props;
	return Object.keys(section).filter((key) => !traceKeys.includes(key)).map((key) => {
		const newKeyPathEl = {
			key,
			type: NodeType.Object
		};
		const newKeyPath = [...keyPath, newKeyPathEl];
		return /* @__PURE__ */ jsx(ItemLayout, {
			level: keyPath.length,
			title: key,
			description: "",
			isSelected: isSameKeyPath(newKeyPath, focusedKeyPath),
			onClick: (e) => {
				e.stopPropagation();
				onFocusKeyPath(newKeyPath);
			},
			children: /* @__PURE__ */ jsx(NodeWrapper, {
				...props,
				keyPath: newKeyPath,
				section: section[key]
			})
		}, key);
	});
};

//#endregion
export { NestedObjectWrapper };
//# sourceMappingURL=NestedObjectWrapper.mjs.map