import { NodeType } from "../types/dist/esm/nodeType.mjs";
import { isValidElement } from "../utils/isValidReactElement.mjs";

//#region ../@intlayer/cli/dist/esm/core/dist/esm/dictionaryManipulator/getNodeType.mjs
/**
* Type guard to check if content is a TypedNode
*/
const isTypedNode = (content) => {
	return typeof content === "object" && content !== null && "nodeType" in content && typeof content.nodeType === "string";
};
/**
* Type guard to check if content is a valid NodeType
*/
const isValidNodeType = (nodeType) => {
	return Object.values(NodeType).includes(nodeType);
};
const getNodeType = (content) => {
	if (typeof content === "string") return NodeType.Text;
	if (isTypedNode(content)) {
		const nodeType = content.nodeType;
		if (isValidNodeType(nodeType)) return nodeType;
		return NodeType.Unknown;
	}
	if (Array.isArray(content)) return NodeType.Array;
	if (isValidElement(content)) return NodeType.ReactNode;
	if (typeof content === "number") return NodeType.Number;
	if (typeof content === "boolean") return NodeType.Boolean;
	if (content && typeof content === "object") return NodeType.Object;
	if (content === null) return NodeType.Null;
	return NodeType.Unknown;
};

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