'use client';
import { jsx as _jsx } from "react/jsx-runtime";
import { CardRenderer, isCardMessage } from '../cards';
import { UserMessage } from './user-message';
import { AssistantMessage } from './assistant-message';
export function ChatMessage({ role, content, messageId, images, toolInvocations, isStreaming, onDeleteMessage, onNavigate, onNavigateToDocPage, onOpenFile, cardActions }) {
    if (role === 'user') {
        return /*#__PURE__*/ _jsx(UserMessage, {
            content: content,
            images: images,
            cardActions: cardActions
        });
    }
    if (role === 'assistant') {
        // Check if this is a card message (like response options)
        if (isCardMessage(content)) {
            return /*#__PURE__*/ _jsx(CardRenderer, {
                content: content,
                actions: cardActions
            });
        }
        return /*#__PURE__*/ _jsx(AssistantMessage, {
            content: content,
            messageId: messageId,
            toolInvocations: toolInvocations,
            isStreaming: isStreaming,
            onDeleteMessage: onDeleteMessage,
            onNavigate: onNavigate,
            onNavigateToDocPage: onNavigateToDocPage,
            onOpenFile: onOpenFile
        });
    }
    return null;
}
