import{jsxs as o,jsx as s,Fragment as c}from"react/jsx-runtime";import i from"classnames";import{LinearProgress as n}from"@material-ui/core";import{FileIcon as r}from"../FileIcon/FileIcon.js";import e from"../IconButton/index.js";import{CloseIcon as t,DeleteFourIcon as m,RedoIcon as l}from"../../icons/iconParkIcons.js";import"../../icons/customIcons/icons/AddMessage.js";import"../../icons/customIcons/icons/Attention.js";import"../../icons/customIcons/icons/Collapse.js";import"../../icons/customIcons/icons/Dashboard.js";import"../../icons/customIcons/icons/Expand.js";import"../../icons/customIcons/icons/FolderClosed.js";import"../../icons/customIcons/icons/FolderClosedFilled.js";import"../../icons/customIcons/icons/FolderOpened.js";import"../../icons/customIcons/icons/GreaterOrEqual.js";import"../../icons/customIcons/icons/LessOrEqual.js";import"../../icons/customIcons/icons/Search.js";import"../../icons/customIcons/icons/Wellhub.js";import"../../icons/customIcons/icons/MultiRuler.js";import"../../icons/customIcons/icons/Checkbox.js";import"../../icons/customIcons/icons/CheckboxChecked.js";import"../../icons/customIcons/icons/CheckboxIndeterminate.js";import"../../icons/customIcons/icons/Radio.js";import"../../icons/customIcons/icons/RadioChecked.js";import"../../icons/customIcons/icons/SimulFrac.js";import"../../icons/customIcons/icons/ZipperFrac.js";import{CautionFilledCustomIcon as a}from"../../icons/customIcons/icons/CautionFilled.js";import"../../icons/customIcons/icons/MoreApp.js";import{MiddleTruncatedText as p}from"../MiddleTruncatedText/MiddleTruncatedText.js";import{Regular14 as d,Regular12 as u}from"../Typography.js";import{formatSizeProgress as j}from"./utils.js";import{useStyles as I}from"./styles.js";var h=function(h){var C=h.formatProgress,f=void 0===C?j:C,x=h.className,k=h.name,v=h.current,F=h.total,N=h.errorText,T=h.onCancel,g=h.onReload,M=h.onDelete,R=I(),b=F>=0&&v>=0,P=Math.min(100,Math.ceil(v/F*100)),z=v>=F;return o("div",{className:i(R.root,x),children:[s(r,{name:k,className:R.icon,strokeWidth:2}),o("div",{className:R.content,children:[s(d,{className:R.name,children:s(p,{children:k},k)}),!N&&!z&&o(c,{children:[s(n,{className:R.progressBar,variant:b?"determinate":void 0,value:P}),o("div",{className:R.progressTextContainer,children:[s(u,{className:R.progressText,children:f(F,v)}),b&&o(u,{className:R.progressText,children:[P,"%"]})]})]}),N&&o(d,{className:R.error,children:[s(a,{size:16}),N]})]}),T&&!N&&!z&&s(e,{onClick:T,size:"small",tooltipProps:{title:"Cancel"},children:s(t,{})}),M&&(N||z)&&s(e,{onClick:M,size:"small",tooltipProps:{title:"Remove File"},children:s(m,{})}),g&&N&&s(e,{onClick:g,size:"small",tooltipProps:{title:"Reload"},children:s(l,{})})]})};export{h as FilesLoaderV2};
