import $i18n from '../../../../../../../locales/i18n.js';
import React from 'react';
import { CnLoading, CnIcon } from '@cainiaofe/cn-ui';
export function PreviewContent({ loading, error, result, interrupted, hasVariables, neverPreviewed = false, onRegenerate, }) {
    // 没有变量时，显示提示
    if (!hasVariables) {
        return (React.createElement("div", { className: "ai-field-config-preview-placeholder" }, $i18n.get({
            id: 'ThereIsNoPreviewForTheTimeBeing',
            dm: '暂无可预览内容，请在任务描述中插入字段',
        })));
    }
    if (loading) {
        return (React.createElement("div", { className: "ai-field-config-preview-loading" },
            React.createElement(CnLoading, { size: "medium" })));
    }
    // 预览被中断或内容已修改，显示重新生成按钮
    if (interrupted) {
        return (React.createElement("div", { className: "ai-field-config-preview-interrupted" },
            React.createElement("div", { className: "ai-field-config-preview-interrupted-text" },
                React.createElement(CnIcon, { type: "info-circle", style: { color: '#faad14', marginRight: '4px' } }),
                $i18n.get({ id: 'ContentHasBeenModifiedClick', dm: '内容已修改,点击' }),
                React.createElement("span", { style: { color: '#1890ff', cursor: 'pointer' }, onClick: onRegenerate }, $i18n.get({ id: 'Regenerate', dm: '重新生成' })))));
    }
    if (error) {
        return (React.createElement("div", { className: "ai-field-config-preview-error" },
            React.createElement(CnIcon, { type: "warning-circle-fill", style: { color: '#ff4d4f', marginRight: '4px' } }),
            error));
    }
    if (result) {
        return React.createElement("div", { className: "ai-field-config-preview-content" }, result);
    }
    // 有变量但从未预览过（编辑场景初始状态），显示"点击生成预览"按钮
    if (neverPreviewed) {
        return (React.createElement("div", { className: "ai-field-config-preview-placeholder" },
            React.createElement("span", { style: { color: '#1890ff', cursor: 'pointer' }, onClick: onRegenerate }, $i18n.get({ id: 'ClickToGeneratePreview', dm: '点击生成预览' }))));
    }
    // 有变量但还没生成过预览（新增场景，首次插入字段后自动预览中）
    return (React.createElement("div", { className: "ai-field-config-preview-placeholder" }, $i18n.get({ id: 'PreparingPreview', dm: '正在准备预览...' })));
}
