import {
  AssistantMessage
} from "./chunk-X477GDGZ.mjs";
import {
  ImageRenderer
} from "./chunk-DBKRAOH7.mjs";
import {
  UserMessage
} from "./chunk-VVL6JFCJ.mjs";
import {
  __objRest
} from "./chunk-MRXNTQOX.mjs";

// src/components/chat/messages/RenderMessage.tsx
import { jsx } from "react/jsx-runtime";
function RenderMessage(_a) {
  var _b = _a, {
    UserMessage: UserMessage2 = UserMessage,
    AssistantMessage: AssistantMessage2 = AssistantMessage,
    ImageRenderer: ImageRenderer2 = ImageRenderer
  } = _b, props = __objRest(_b, [
    "UserMessage",
    "AssistantMessage",
    "ImageRenderer"
  ]);
  var _a2;
  const {
    message,
    inProgress,
    index,
    isCurrentMessage,
    onRegenerate,
    onCopy,
    onThumbsUp,
    onThumbsDown,
    markdownTagRenderers
  } = props;
  switch (message.role) {
    case "user":
      return /* @__PURE__ */ jsx(
        UserMessage2,
        {
          rawData: message,
          "data-message-role": "user",
          message,
          ImageRenderer: ImageRenderer2
        },
        index
      );
    case "assistant":
      return /* @__PURE__ */ jsx(
        AssistantMessage2,
        {
          "data-message-role": "assistant",
          subComponent: (_a2 = message.generativeUI) == null ? void 0 : _a2.call(message),
          rawData: message,
          message,
          isLoading: inProgress && isCurrentMessage && !message.content,
          isGenerating: inProgress && isCurrentMessage && !!message.content,
          isCurrentMessage,
          onRegenerate: () => onRegenerate == null ? void 0 : onRegenerate(message.id),
          onCopy,
          onThumbsUp,
          onThumbsDown,
          markdownTagRenderers,
          ImageRenderer: ImageRenderer2
        },
        index
      );
  }
}

export {
  RenderMessage
};
//# sourceMappingURL=chunk-LJAYSRCB.mjs.map