import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
// (C) 2025-2026 GoodData Corporation
import { useIntl } from "react-intl";
import { AttachmentSettings } from "./AttachmentSettings.js";
import { attachmentIcons, dashboardAttachmentLabels, widgetAttachmentLabels } from "./AttachmentsSelect.js";
import { SlidesTemplateSettings } from "./SlidesTemplateSettings.js";
export function AttachmentsList({ attachments, onDelete, xlsxSettings, onXlsxSettingsChange, pdfSettings, onPdfSettingsChange, csvSettings, onCsvSettingsChange, csvRawSettings, onCsvRawSettingsChange, isCsvSettingsEnabled, defaultPdfPageSize, mode, exportTemplates, slidesTemplateIds, onSlidesTemplateIdChange, }) {
    const intl = useIntl();
    return (_jsx(_Fragment, { children: attachments.map((attachment) => (_jsxs("div", { className: "gd-attachment-chip", children: [
                _jsx("span", { className: `gd-attachment-chip-label ${attachmentIcons[attachment]}`, children: mode === "widget"
                        ? widgetAttachmentLabels[attachment]
                        : dashboardAttachmentLabels[attachment] }), attachment === "XLSX" && (_jsx(AttachmentSettings, { type: "XLSX", settings: xlsxSettings, onSettingsChange: onXlsxSettingsChange })), attachment === "PDF_TABULAR" && pdfSettings && onPdfSettingsChange ? (_jsx(AttachmentSettings, { type: "PDF_TABULAR", settings: pdfSettings, onSettingsChange: onPdfSettingsChange, defaultPdfPageSize: defaultPdfPageSize })) : null, attachment === "CSV" && isCsvSettingsEnabled && csvSettings && onCsvSettingsChange ? (_jsx(AttachmentSettings, { type: "CSV", settings: csvSettings, onSettingsChange: onCsvSettingsChange })) : null, attachment === "CSV_RAW" &&
                    isCsvSettingsEnabled &&
                    csvRawSettings &&
                    onCsvRawSettingsChange ? (_jsx(AttachmentSettings, { type: "CSV_RAW", settings: csvRawSettings, onSettingsChange: onCsvRawSettingsChange })) : null, attachment === "PPTX" && exportTemplates && onSlidesTemplateIdChange ? (_jsx(SlidesTemplateSettings, { templates: exportTemplates, templateId: slidesTemplateIds?.PPTX, onTemplateIdChange: (id) => onSlidesTemplateIdChange(id, "PPTX") })) : null, attachment === "PDF_SLIDES" && exportTemplates && onSlidesTemplateIdChange ? (_jsx(SlidesTemplateSettings, { templates: exportTemplates, templateId: slidesTemplateIds?.PDF_SLIDES, onTemplateIdChange: (id) => onSlidesTemplateIdChange(id, "PDF_SLIDES") })) : null, attachment === "PDF" &&
                    mode === "widget" &&
                    exportTemplates &&
                    onSlidesTemplateIdChange ? (_jsx(SlidesTemplateSettings, { templates: exportTemplates, templateId: slidesTemplateIds?.PDF, onTemplateIdChange: (id) => onSlidesTemplateIdChange(id, "PDF") })) : null, _jsx("button", { className: "gd-attachment-chip-button gd-attachment-chip-delete", "aria-label": intl.formatMessage({ id: "dialogs.schedule.management.attachments.delete" }, { format: attachment }), onClick: () => onDelete(attachment), children: _jsx("svg", { width: "14", height: "14", viewBox: "0 0 20 20", "aria-hidden": "true", fill: "currentColor", children: _jsx("path", { d: "M10.7031 10.0049L16.3574 15.6494C16.4551 15.7471 16.5039 15.8643 16.5039 16.001C16.5039 16.1377 16.4551 16.2549 16.3574 16.3525C16.3053 16.4046 16.2467 16.4437 16.1816 16.4697C16.123 16.4893 16.0612 16.499 15.9961 16.499C15.9375 16.499 15.8757 16.4893 15.8105 16.4697C15.752 16.4437 15.6966 16.4046 15.6445 16.3525L10 10.708L4.35547 16.3525C4.30339 16.4046 4.24479 16.4437 4.17969 16.4697C4.12109 16.4893 4.0625 16.499 4.00391 16.499C3.9388 16.499 3.8737 16.4893 3.80859 16.4697C3.75 16.4437 3.69466 16.4046 3.64258 16.3525C3.54492 16.2549 3.49609 16.1377 3.49609 16.001C3.49609 15.8643 3.54492 15.7471 3.64258 15.6494L9.29688 10.0049L3.64258 4.35059C3.54492 4.25293 3.49609 4.13574 3.49609 3.99902C3.49609 3.8623 3.54492 3.74512 3.64258 3.64746C3.74023 3.5498 3.85742 3.50098 3.99414 3.50098C4.13737 3.50098 4.25781 3.5498 4.35547 3.64746L10 9.29199L15.6445 3.64746C15.7422 3.5498 15.8594 3.50098 15.9961 3.50098C16.1393 3.50098 16.2598 3.5498 16.3574 3.64746C16.4551 3.74512 16.5039 3.8623 16.5039 3.99902C16.5039 4.13574 16.4551 4.25293 16.3574 4.35059L10.7031 10.0049Z" }) }) })
            ] }, attachment))) }));
}
