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