"use strict";var e=require("@babel/runtime/helpers/defineProperty"),r=require("react/jsx-runtime"),t=require("classnames"),i=require("@material-ui/core"),n=require("@material-ui/icons/Close"),o=require("@material-ui/icons/GetApp"),s=require("../GoogleDocsViewer/index.js"),l=require("../../utils/env.js"),a=require("../LoadingIndicator/LoadingIndicator.js"),c=require("./effects/useFileContent.js"),u=require("./styles.js");function d(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var f=d(e),p=d(t),j=d(n),m=d(o);function h(e,r){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);r&&(i=i.filter((function(r){return Object.getOwnPropertyDescriptor(e,r).enumerable}))),t.push.apply(t,i)}return t}function b(e){for(var r=1;r<arguments.length;r++){var t=null!=arguments[r]?arguments[r]:{};r%2?h(Object(t),!0).forEach((function(r){f.default(e,r,t[r])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(t)):h(Object(t)).forEach((function(r){Object.defineProperty(e,r,Object.getOwnPropertyDescriptor(t,r))}))}return e}module.exports=function(e){var t=e.classes,n=e.open,o=e.fileUrl,d=e.fileName,f=void 0===d?"DocumentViewer":d,h=e.onClose,v=e.fileSize,x=e.webviewType,y=e["data-testid"],g=void 0===y?"DocumentViewer":y,w=u.useStyles(),O=c.useFileContent({fileUrl:o,fileName:f}),q=O.isLoading,N=O.fileContent;return l.isGoogleDocsPreviewEnabled?r.jsx(i.Dialog,{open:n,onClose:h,classes:b(b({},t),{},{paper:p.default(w.paper,null==t?void 0:t.paper)}),children:r.jsx(s,{webviewType:x,fileUrl:o,fileName:f,fileSize:v,onClose:h,width:"100%",height:"100%"})}):r.jsx(i.Dialog,{classes:b(b({},t),{},{paper:p.default(w.paper,null==t?void 0:t.paper)}),open:n,onClose:h,onContextMenu:function(e){return e.stopPropagation()},children:r.jsxs("div",{"data-testid":"".concat(g,"_file_").concat(f),className:w.root,children:[r.jsxs("div",{className:w.toolbar,children:[r.jsx(i.Typography,{"data-testid":"".concat(g,"_fileName"),children:f}),r.jsxs("div",{children:[r.jsx(i.IconButton,{size:"small",className:w.iconButton,children:r.jsx("a",{download:!0,href:o,target:"_blank",rel:"noopener noreferrer",children:r.jsx(m.default,{fontSize:"small"})})}),r.jsx(i.IconButton,{size:"small",onClick:h,className:w.iconButton,children:r.jsx(j.default,{fontSize:"small"})})]})]}),q&&r.jsx("div",{className:w.frame,children:r.jsx(a,{white:!1})}),!q&&r.jsx("div",{className:w.frame,children:r.jsx("div",{className:w.sheet,children:N})})]})})};
//# sourceMappingURL=NewDocumentViewer.js.map
