'use client';

import { NodeWrapper } from "./NodeWrapper/index.mjs";
import { useEditedContent, useFocusUnmergedDictionary } from "@intlayer/editor-react";
import { createElement } from "react";
import { jsx } from "react/jsx-runtime";

//#region src/components/DictionaryEditor/DictionaryEditor.tsx
const DictionaryEditor = ({ dictionary, ...props }) => {
	const { editedContent, addEditedContent } = useEditedContent();
	const { focusedContent, setFocusedContentKeyPath } = useFocusUnmergedDictionary();
	return /* @__PURE__ */ jsx("div", {
		className: "flex flex-col gap-2",
		children: /* @__PURE__ */ createElement(NodeWrapper, {
			...props,
			keyPath: [],
			dictionary,
			key: JSON.stringify((editedContent?.[dictionary.localId] ?? dictionary).content),
			editedContent: editedContent?.[dictionary.localId]?.content,
			focusedKeyPath: focusedContent?.keyPath,
			section: dictionary.content,
			onContentChange: (content) => {
				addEditedContent(dictionary.localId, content.newValue, content.keyPath);
			},
			onFocusKeyPath: setFocusedContentKeyPath
		})
	});
};

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