import CompletionMessagePaper_default from "../../../components/messages/CompletionMessagePaper.js";
import OAuthPromptRenderer_default from "../../oauth/OAuthPromptRenderer.js";
import "../../oauth/index.js";
import AiMessage_default from "./document-renderer/AiMessage.js";
import LinkMessageRenderer_default from "./document-renderer/LinkMessageRenderer.js";
import DocumentDebugRenderer_default from "./document-renderer/DocumentDebugRenderer.js";
import DocumentFormRenderer_default from "./document-renderer/DocumentFormRenderer.js";
import DocumentMessageRenderer_default from "./document-renderer/DocumentMessageRenderer.js";
import ErrorMessageRenderer_default from "./document-renderer/ErrorMessageRenderer.js";
import MarkdownMessageRenderer_default from "./document-renderer/MarkdownMessageRenderer.js";
import PlainMessageRenderer_default from "./document-renderer/PlainMessageRenderer.js";
import { c } from "react/compiler-runtime";
import React from "react";
import { Fragment as Fragment$1, jsx } from "react/jsx-runtime";
var DocumentRenderer_default = (m) => {
	let h = c(8), { pipeline: g, workflow: _, document: v, isActive: y, isLastItem: b } = m, x = !y, S = v, C = S.ui?.form?.widget ?? "object-form", w;
	return h[0] !== S || h[1] !== y || h[2] !== b || h[3] !== g || h[4] !== x || h[5] !== C || h[6] !== _ ? (w = /* @__PURE__ */ jsx("div", { children: (() => {
		switch (C) {
			case "ai-message": return /* @__PURE__ */ jsx(AiMessage_default, {
				document: S,
				isLastItem: b
			});
			case "debug": return /* @__PURE__ */ jsx("div", {
				className: "mb-4 flex",
				children: /* @__PURE__ */ jsx(DocumentDebugRenderer_default, { document: S })
			});
			case "object-form": return /* @__PURE__ */ jsx(CompletionMessagePaper_default, {
				role: "document",
				fullWidth: !0,
				timestamp: new Date(S.createdAt),
				children: /* @__PURE__ */ jsx(DocumentFormRenderer_default, {
					pipeline: g,
					workflow: _,
					document: S,
					enabled: y,
					viewOnly: x
				})
			});
			case "message": return /* @__PURE__ */ jsx(DocumentMessageRenderer_default, { document: S });
			case "error": return /* @__PURE__ */ jsx(ErrorMessageRenderer_default, { document: S });
			case "plain": return /* @__PURE__ */ jsx(PlainMessageRenderer_default, { document: S });
			case "markdown": return /* @__PURE__ */ jsx(MarkdownMessageRenderer_default, { document: S });
			case "link": return /* @__PURE__ */ jsx(LinkMessageRenderer_default, { document: S });
			case "oauth-prompt": return /* @__PURE__ */ jsx(OAuthPromptRenderer_default, {
				pipeline: g,
				workflow: _,
				document: S,
				isActive: y
			});
			default: return /* @__PURE__ */ jsx(Fragment$1, { children: "unknown document type" });
		}
	})() }), h[0] = S, h[1] = y, h[2] = b, h[3] = g, h[4] = x, h[5] = C, h[6] = _, h[7] = w) : w = h[7], w;
};
export { DocumentRenderer_default as default };
