"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.PreviewFileUploaderFile = void 0;
const jsx_runtime_1 = require("react/jsx-runtime");
const Fade_1 = require("../../transitions/Fade");
const FileError_1 = require("./FileError");
const FileLoading_1 = require("./FileLoading");
const FilePreview_1 = require("./FilePreview");
const styles_1 = require("./styles");
const PreviewFileUploaderFile = (props) => {
    const { id, name, type, file, url, size, status, generateDownloadLink, onRetry, onDelete, onView, selfFiles, setErrorStatusFile, isHidePersonalData, PdfViewer, isDeletingFile, } = props;
    const { isLoading, isUploadError, isRestrictionError, errorMsg, progress } = status || {};
    const isError = isUploadError || isRestrictionError;
    return ((0, jsx_runtime_1.jsx)(Fade_1.Fade, { in: true, children: (0, jsx_runtime_1.jsxs)(styles_1.Wrapper, { "$isLoading": isLoading, "$isError": isError, children: [!isLoading && !isError && ((0, jsx_runtime_1.jsx)(FilePreview_1.FilePreview, { fileId: id, fileName: name, fileType: type, file: file, fileUrl: url, fileSize: size, generateDownloadLink: generateDownloadLink, onView: onView, onDelete: onDelete, isHidePersonalData: isHidePersonalData, PdfViewer: PdfViewer, isDeletingFile: isDeletingFile })), isLoading && ((0, jsx_runtime_1.jsx)(FileLoading_1.FileLoading, { selfFiles: selfFiles, setErrorStatusFile: setErrorStatusFile, fileId: id, fileName: name, fileSize: size, progress: progress })), isError && ((0, jsx_runtime_1.jsx)(FileError_1.FileError, { fileId: id, fileName: name, file: file, fileSize: size, errorMsg: errorMsg, isUploadError: isUploadError, onRetry: onRetry, onDelete: onDelete }))] }) }));
};
exports.PreviewFileUploaderFile = PreviewFileUploaderFile;
