import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
import { BinOutlineMd } from '../../../../icons/BinOutlineMd';
import { DownloadOutlineMd } from '../../../../icons/DownloadOutlineMd';
import { EyeOutlineMd } from '../../../../icons/EyeOutlineMd';
import { Button } from '../../../Button';
import { IconButton } from '../../../IconButton';
import { Tooltip } from '../../../Tooltip';
import { Typography } from '../../../Typography';
import { useViewportType } from '../../../useViewportType';
import { previewFileUploaderClassnames } from '../../constants';
import { Preview } from './Preview';
import { Actions, Details, StyledFileInfo, Wrapper } from './styles';
import { useLogic } from './useLogic';
export const FilePreview = (props) => {
    const { viewButtonProps, downloadButtonProps, deleteButtonProps, isImageFile, isPdfFile, isOtherFile, } = useLogic(props);
    const { file, fileName, fileSize, fileUrl, generateDownloadLink, isHidePersonalData, PdfViewer, isDeletingFile, } = props;
    const { isMobile } = useViewportType();
    return (_jsxs(Wrapper, { children: [_jsx(Preview, { isImageFile: isImageFile, isPdfFile: isPdfFile, file: file, fileUrl: fileUrl, generateDownloadLink: generateDownloadLink, isHidePersonalData: isHidePersonalData, PdfViewer: PdfViewer }), _jsxs(Details, { className: previewFileUploaderClassnames.details, "$isOtherFile": isOtherFile, children: [isOtherFile && _jsx(Typography, { variant: "h6", children: "\u0424\u0430\u0439\u043B \u0437\u0430\u0433\u0440\u0443\u0436\u0435\u043D" }), _jsx(StyledFileInfo, { "$isOtherFile": isOtherFile, fileName: fileName, fileSize: fileSize }), _jsx(Actions, { children: isMobile && isOtherFile ? (_jsx(Button, { variant: "light", color: "grey", loading: isDeletingFile, ...deleteButtonProps, children: "\u0423\u0434\u0430\u043B\u0438\u0442\u044C" })) : (_jsxs(_Fragment, { children: [!isOtherFile && (_jsx(Tooltip, { title: "\u041F\u043E\u0441\u043C\u043E\u0442\u0440\u0435\u0442\u044C", disableInteractive: true, children: _jsx(IconButton, { variant: "light", color: "grey", ...viewButtonProps, children: _jsx(EyeOutlineMd, {}) }) })), _jsx(Tooltip, { title: "\u0421\u043A\u0430\u0447\u0430\u0442\u044C", disableInteractive: true, children: _jsx(IconButton, { component: "a", variant: "light", color: "grey", download: fileName, ...downloadButtonProps, children: _jsx(DownloadOutlineMd, {}) }) }), _jsx(Tooltip, { title: "\u0423\u0434\u0430\u043B\u0438\u0442\u044C", disableInteractive: true, children: _jsx(IconButton, { variant: "light", color: "grey", loading: isDeletingFile, ...deleteButtonProps, children: _jsx(BinOutlineMd, {}) }) })] })) })] })] }));
};
