'use strict';

var _defineProperty = require('@babel/runtime/helpers/defineProperty');
var _toConsumableArray = require('@babel/runtime/helpers/toConsumableArray');
var _asyncToGenerator = require('@babel/runtime/helpers/asyncToGenerator');
var _slicedToArray = require('@babel/runtime/helpers/slicedToArray');
var _regeneratorRuntime = require('@babel/runtime/regenerator');
var React = require('react');
var neetoAtoms = require('@bigbinary/neeto-atoms');
var classnames = require('classnames');
var neetoCist = require('@bigbinary/neeto-cist');
var ramda = require('ramda');
var reactI18next = require('react-i18next');
var reactFileIcon_esm = require('./chunk-D3Unocnm.cjs.js');
var FileIcon = require('./chunk-CDAiAyof.cjs.js');
var lucideReact = require('lucide-react');
var useOnClickOutside = require('@bigbinary/neeto-commons-frontend/v2/react-utils/useOnClickOutside');
var utils = require('@bigbinary/neeto-commons-frontend/v2/utils');
var jsxRuntime = require('react/jsx-runtime');

function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }

var _defineProperty__default = /*#__PURE__*/_interopDefault(_defineProperty);
var _toConsumableArray__default = /*#__PURE__*/_interopDefault(_toConsumableArray);
var _asyncToGenerator__default = /*#__PURE__*/_interopDefault(_asyncToGenerator);
var _slicedToArray__default = /*#__PURE__*/_interopDefault(_slicedToArray);
var _regeneratorRuntime__default = /*#__PURE__*/_interopDefault(_regeneratorRuntime);
var classnames__default = /*#__PURE__*/_interopDefault(classnames);
var useOnClickOutside__default = /*#__PURE__*/_interopDefault(useOnClickOutside);

var buildFileUploadConfig = function buildFileUploadConfig(config) {
  return ramda.mergeRight(FileIcon.DEFAULT_FILE_UPLOAD_CONFIG, config);
};
var downloadFile = /*#__PURE__*/function () {
  var _ref = _asyncToGenerator__default.default(/*#__PURE__*/_regeneratorRuntime__default.default.mark(function _callee(fileUrl, filename) {
    var response, blob, blobUrl, a;
    return _regeneratorRuntime__default.default.wrap(function _callee$(_context) {
      while (1) switch (_context.prev = _context.next) {
        case 0:
          _context.prev = 0;
          _context.next = 3;
          return fetch(fileUrl);
        case 3:
          response = _context.sent;
          _context.next = 6;
          return response.blob();
        case 6:
          blob = _context.sent;
          blobUrl = URL.createObjectURL(blob);
          a = document.createElement("a");
          a.href = blobUrl;
          a.setAttribute("download", filename);
          a.style.display = "none";
          document.body.appendChild(a);
          a.click();
          document.body.removeChild(a);
          URL.revokeObjectURL(blobUrl);
          _context.next = 21;
          break;
        case 18:
          _context.prev = 18;
          _context.t0 = _context["catch"](0);
          neetoAtoms.Toastr.error(_context.t0);
        case 21:
        case "end":
          return _context.stop();
      }
    }, _callee, null, [[0, 18]]);
  }));
  return function downloadFile(_x, _x2) {
    return _ref.apply(this, arguments);
  };
}();
var checkPreviewAvailability = function checkPreviewAvailability(contentType) {
  return contentType && (contentType.startsWith("video/") || contentType === "application/pdf" || contentType === "image/jpeg" || contentType === "image/gif" || contentType === "image/png" || contentType === "image/webp" || contentType === "text/plain" || contentType === "image/bmp" || contentType === "application/msword" || contentType === "application/vnd.openxmlformats-officedocument.wordprocessingml.document" || contentType === "image/jpg" || contentType === "application/vnd.ms-powerpoint" || contentType === "application/vnd.openxmlformats-officedocument.presentationml.presentation" || contentType === "image/tiff" || contentType === "application/vnd.ms-excel" || contentType === "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
};

function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), true).forEach(function (r) { _defineProperty__default.default(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
var Menu = neetoAtoms.DropdownMenu.Menu,
  MenuItem = neetoAtoms.DropdownMenu.MenuItem;
var Attachment = function Attachment(_ref) {
  var attachment = _ref.attachment,
    attachments = _ref.attachments,
    disabled = _ref.disabled,
    onChange = _ref.onChange,
    setSelectedAttachment = _ref.setSelectedAttachment,
    isLoading = _ref.isLoading,
    allowDelete = _ref.allowDelete,
    allowOpenInNewTab = _ref.allowOpenInNewTab;
  var _useTranslation = reactI18next.useTranslation(),
    t = _useTranslation.t;
  var _useState = React.useState(false),
    _useState2 = _slicedToArray__default.default(_useState, 2),
    isRenaming = _useState2[0],
    setIsRenaming = _useState2[1];
  var _useState3 = React.useState(false),
    _useState4 = _slicedToArray__default.default(_useState3, 2),
    isUpdating = _useState4[0],
    setIsUpdating = _useState4[1];
  var _useState5 = React.useState(false),
    _useState6 = _slicedToArray__default.default(_useState5, 2),
    isDeleteAlertOpen = _useState6[0],
    setIsDeleteAlertOpen = _useState6[1];
  var _useState7 = React.useState(false),
    _useState8 = _slicedToArray__default.default(_useState7, 2),
    isDeleting = _useState8[0],
    setIsDeleting = _useState8[1];
  var _useState9 = React.useState(""),
    _useState0 = _slicedToArray__default.default(_useState9, 2),
    newFilename = _useState0[0],
    setNewFilename = _useState0[1];
  var renameRef = React.useRef(null);
  useOnClickOutside__default.default(renameRef, function () {
    if (!isRenaming) return;
    setIsRenaming(false);
    setNewFilename("");
  });
  var handleDownload = function handleDownload() {
    return downloadFile(attachment.url, attachment.filename);
  };
  var handleOpenInNewTab = function handleOpenInNewTab() {
    return window.open(attachment.url, "_blank", "noopener,noreferrer");
  };
  var handleRename = /*#__PURE__*/function () {
    var _ref2 = _asyncToGenerator__default.default(/*#__PURE__*/_regeneratorRuntime__default.default.mark(function _callee() {
      var _response$data, signedId, payload, response, filename;
      return _regeneratorRuntime__default.default.wrap(function _callee$(_context) {
        while (1) switch (_context.prev = _context.next) {
          case 0:
            _context.prev = 0;
            setIsUpdating(true);
            signedId = attachment.signedId;
            payload = {
              blob: {
                filename: newFilename
              }
            };
            _context.next = 6;
            return reactFileIcon_esm.directUploadsApi.update({
              signedId: signedId,
              payload: payload
            });
          case 6:
            response = _context.sent;
            filename = ((_response$data = response.data) === null || _response$data === void 0 || (_response$data = _response$data.blob) === null || _response$data === void 0 ? void 0 : _response$data.filename) || response.blob.filename;
            onChange(attachments.map(function (attachment) {
              return attachment.signedId === signedId ? ramda.assoc("filename", filename, attachment) : attachment;
            }));
            _context.next = 14;
            break;
          case 11:
            _context.prev = 11;
            _context.t0 = _context["catch"](0);
            neetoAtoms.Toastr.error(_context.t0);
          case 14:
            _context.prev = 14;
            setIsRenaming(false);
            setIsUpdating(false);
            setNewFilename("");
            return _context.finish(14);
          case 19:
          case "end":
            return _context.stop();
        }
      }, _callee, null, [[0, 11, 14, 19]]);
    }));
    return function handleRename() {
      return _ref2.apply(this, arguments);
    };
  }();
  var handleDelete = /*#__PURE__*/function () {
    var _ref3 = _asyncToGenerator__default.default(/*#__PURE__*/_regeneratorRuntime__default.default.mark(function _callee2() {
      var signedId;
      return _regeneratorRuntime__default.default.wrap(function _callee2$(_context2) {
        while (1) switch (_context2.prev = _context2.next) {
          case 0:
            if (allowDelete) {
              _context2.next = 2;
              break;
            }
            return _context2.abrupt("return");
          case 2:
            setIsDeleting(true);
            _context2.prev = 3;
            signedId = attachment.signedId;
            _context2.next = 7;
            return reactFileIcon_esm.directUploadsApi.destroy(signedId);
          case 7:
            onChange(neetoCist.removeBy({
              signedId: signedId
            }, attachments));
            _context2.next = 13;
            break;
          case 10:
            _context2.prev = 10;
            _context2.t0 = _context2["catch"](3);
            neetoAtoms.Toastr.error(_context2.t0);
          case 13:
          case "end":
            return _context2.stop();
        }
      }, _callee2, null, [[3, 10]]);
    }));
    return function handleDelete() {
      return _ref3.apply(this, arguments);
    };
  }();
  var handlers = _objectSpread(_objectSpread({}, allowOpenInNewTab && _defineProperty__default.default({}, FileIcon.ATTACHMENT_OPTIONS.OPEN_IN_NEW_TAB, handleOpenInNewTab)), {}, _defineProperty__default.default(_defineProperty__default.default({}, FileIcon.ATTACHMENT_OPTIONS.DOWNLOAD, handleDownload), FileIcon.ATTACHMENT_OPTIONS.RENAME, handleRename), allowDelete && _defineProperty__default.default({}, FileIcon.ATTACHMENT_OPTIONS.DELETE, handleDelete));
  var onMenuItemClick = function onMenuItemClick(_ref6) {
    var key = _ref6.key,
      handler = _ref6.handler;
    if (key === FileIcon.ATTACHMENT_OPTIONS.RENAME) {
      setIsRenaming(true);
      setNewFilename(attachment.filename);
    } else if (key === FileIcon.ATTACHMENT_OPTIONS.DELETE) {
      setNewFilename(attachment.filename);
      setIsDeleteAlertOpen(true);
    } else {
      handler();
    }
  };
  var handleKeyDown = function handleKeyDown(_ref7) {
    var event = _ref7.event,
      key = _ref7.key;
    var handler = handlers[key];
    if (event.key === "Enter" && handler && !ramda.isEmpty(newFilename)) {
      event.stopPropagation();
      event.preventDefault();
      handler();
    }
    if (event.key === "Escape") {
      setIsRenaming(false);
      setNewFilename("");
    }
  };
  return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
    children: [/*#__PURE__*/jsxRuntime.jsx("div", {
      className: "ne-attachments__preview",
      "data-testid": "ne-attachments-wrapper",
      children: isRenaming ? /*#__PURE__*/jsxRuntime.jsx("div", {
        ref: renameRef,
        children: /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Tooltip, {
          content: newFilename,
          position: "top",
          children: /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Input, {
            autoFocus: true,
            "data-testid": "neeto-editor-preview-rename-input",
            size: "small",
            value: newFilename,
            error: ramda.isEmpty(newFilename) ? t("neetoEditor.attachments.nameEmpty") : "",
            suffix: /*#__PURE__*/jsxRuntime.jsxs("div", {
              className: "flex items-center justify-end",
              children: [/*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Button, {
                "data-testid": "neeto-editor-preview-rename-submit-button",
                disabled: ramda.isEmpty(newFilename) || isUpdating,
                icon: lucideReact.Check,
                loading: isUpdating,
                size: "sm",
                variant: "ghost",
                onClick: handleRename
              }), /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Button, {
                "data-testid": "neeto-editor-preview-rename-cancel-button",
                disabled: isUpdating,
                icon: lucideReact.X,
                size: "sm",
                variant: "ghost",
                onClick: function onClick() {
                  setIsRenaming(false);
                  setNewFilename("");
                }
              })]
            }),
            onChange: utils.withEventTargetValue(setNewFilename),
            onKeyDown: function onKeyDown(event) {
              return handleKeyDown({
                event: event,
                key: FileIcon.ATTACHMENT_OPTIONS.RENAME
              });
            }
          })
        })
      }) : /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
        children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
          className: "ne-attachments__preview-wrapper",
          onClick: function onClick() {
            return setSelectedAttachment(attachment);
          },
          children: [/*#__PURE__*/jsxRuntime.jsx(FileIcon.File, {
            className: "ne-attachments__preview-wrapper__icon",
            fileName: attachment.filename
          }), /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Tooltip, {
            content: attachment.filename,
            position: "top",
            children: /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Typography, {
              variant: "body2",
              children: attachment.filename
            })
          }), isLoading && /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Spinner, {
            className: "attachment-button-loader"
          })]
        }), /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Tooltip, {
          content: t("neetoEditor.attachments.actionsBlocked"),
          disabled: !disabled,
          position: "top",
          children: /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.DropdownMenu, {
            disabled: disabled,
            // neeto-atoms's default rich trigger always appends a
            // ChevronDown as trailing icon. For an ellipsis "more
            // actions" button the ellipsis itself signals a menu —
            // use customTarget to render the icon-only button without
            // the redundant chevron.
            dropdownProps: {
              className: "ne-editor-dropdown"
            },
            customTarget: /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Button, {
              disabled: disabled,
              "data-testid": "neeto-editor-attachment-actions",
              icon: lucideReact.EllipsisVertical,
              size: "sm",
              variant: "ghost"
            }),
            children: /*#__PURE__*/jsxRuntime.jsx(Menu, {
              children: Object.entries(handlers).map(function (_ref8) {
                var _ref9 = _slicedToArray__default.default(_ref8, 2),
                  label = _ref9[0],
                  handler = _ref9[1];
                return /*#__PURE__*/jsxRuntime.jsx(MenuItem, {
                  "data-testid": "neeto-editor-preview-".concat(label.toLowerCase(), "-button"),
                  onClick: function onClick() {
                    return onMenuItemClick({
                      key: label,
                      handler: handler
                    });
                  },
                  children: label
                }, label);
              })
            })
          })
        })]
      })
    }), /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Alert, {
      isOpen: isDeleteAlertOpen,
      isSubmitting: isDeleting,
      style: "danger",
      submitButtonLabel: t("neetoEditor.menu.delete"),
      title: t("neetoEditor.attachments.deleteTitle"),
      message: /*#__PURE__*/jsxRuntime.jsx(reactI18next.Trans, {
        i18nKey: "neetoEditor.attachments.deleteConfirmation",
        values: {
          entity: newFilename
        }
      }),
      onClose: function onClose() {
        return setIsDeleteAlertOpen(false);
      },
      onSubmit: handleDelete
    })]
  });
};

var AttachmentProgress = function AttachmentProgress(_ref) {
  var _attachment$progress;
  var attachment = _ref.attachment,
    cancelUpload = _ref.cancelUpload;
  var progressPercentage = "".concat((_attachment$progress = attachment.progress) !== null && _attachment$progress !== void 0 ? _attachment$progress : 0, "%");
  var handleCancel = function handleCancel() {
    cancelUpload(attachment.id);
  };
  return /*#__PURE__*/jsxRuntime.jsxs("div", {
    className: "ne-attachments__preview",
    children: [/*#__PURE__*/jsxRuntime.jsx("div", {
      className: "ne-attachments__preview__progress-icon",
      children: /*#__PURE__*/jsxRuntime.jsx(reactFileIcon_esm.FileIcon, {})
    }), /*#__PURE__*/jsxRuntime.jsxs("div", {
      className: "ne-attachments__preview__progress",
      children: [/*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Typography, {
        variant: "body2",
        children: attachment.filename
      }), /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Typography, {
        variant: "body2",
        children: progressPercentage
      })]
    }), /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Button, {
      "data-testid": "neeto-editor-preview-upload-cancel-button",
      icon: lucideReact.X,
      size: "sm",
      variant: "ghost",
      onClick: handleCancel
    })]
  });
};

var Preview = /*#__PURE__*/React.lazy(function () {
  return Promise.resolve().then(function () { return require('./chunk-n7U2G1az.cjs.js'); });
});
var Attachments$1 = function Attachments(_ref, ref) {
  var _fileUploadConfig$all;
  var _ref$attachments = _ref.attachments,
    attachments = _ref$attachments === void 0 ? [] : _ref$attachments,
    _ref$className = _ref.className,
    className = _ref$className === void 0 ? "" : _ref$className,
    _ref$onChange = _ref.onChange,
    onChange = _ref$onChange === void 0 ? neetoCist.noop : _ref$onChange,
    _ref$isIndependent = _ref.isIndependent,
    isIndependent = _ref$isIndependent === void 0 ? true : _ref$isIndependent,
    _ref$disabled = _ref.disabled,
    disabled = _ref$disabled === void 0 ? false : _ref$disabled,
    _ref$dragDropRef = _ref.dragDropRef,
    dragDropRef = _ref$dragDropRef === void 0 ? null : _ref$dragDropRef,
    _ref$config = _ref.config,
    config = _ref$config === void 0 ? {} : _ref$config,
    _ref$setIsUploading = _ref.setIsUploading,
    setIsUploading = _ref$setIsUploading === void 0 ? neetoCist.noop : _ref$setIsUploading,
    _ref$allowDelete = _ref.allowDelete,
    allowDelete = _ref$allowDelete === void 0 ? true : _ref$allowDelete,
    _ref$allowOpenInNewTa = _ref.allowOpenInNewTab,
    allowOpenInNewTab = _ref$allowOpenInNewTa === void 0 ? true : _ref$allowOpenInNewTa;
  var _useTranslation = reactI18next.useTranslation(),
    t = _useTranslation.t;
  var _useState = React.useState({}),
    _useState2 = _slicedToArray__default.default(_useState, 2),
    selectedAttachment = _useState2[0],
    setSelectedAttachment = _useState2[1];
  var _useState3 = React.useState(false),
    _useState4 = _slicedToArray__default.default(_useState3, 2),
    didFetchPreviewBundle = _useState4[0],
    setDidFetchPreviewBundle = _useState4[1];
  var attachmentInputRef = React.useRef(null);
  var fileUploadConfig = React.useMemo(function () {
    return buildFileUploadConfig(config);
  }, [config]);
  var _useFileUploader = FileIcon.useFileUploader({
      config: fileUploadConfig,
      setIsUploadingOnHost: setIsUploading,
      attachments: attachments
    }),
    addFiles = _useFileUploader.addFiles,
    uploadFiles = _useFileUploader.uploadFiles,
    queuedFiles = _useFileUploader.queuedFiles,
    cancelUpload = _useFileUploader.cancelUpload,
    isUploading = _useFileUploader.isUploading;
  var handleAddFile = /*#__PURE__*/function () {
    var _ref2 = _asyncToGenerator__default.default(/*#__PURE__*/_regeneratorRuntime__default.default.mark(function _callee(event) {
      var uploadedFiles;
      return _regeneratorRuntime__default.default.wrap(function _callee$(_context) {
        while (1) switch (_context.prev = _context.next) {
          case 0:
            addFiles(event.target.files);
            _context.next = 3;
            return uploadFiles();
          case 3:
            uploadedFiles = _context.sent;
            neetoCist.isNotEmpty(uploadedFiles) && onChange([].concat(_toConsumableArray__default.default(attachments), _toConsumableArray__default.default(uploadedFiles)));
            attachmentInputRef.current.value = null;
          case 6:
          case "end":
            return _context.stop();
        }
      }, _callee);
    }));
    return function handleAddFile(_x) {
      return _ref2.apply(this, arguments);
    };
  }();
  var handleUploadAttachments = function handleUploadAttachments() {
    return attachmentInputRef.current.click();
  };
  var handleFileInputClick = function handleFileInputClick(event) {
    if (!(!ramda.isEmpty(attachments) && fileUploadConfig.maxNumberOfFiles === 1)) {
      return;
    }
    event.preventDefault();
    neetoAtoms.Toastr.warning(t("neetoEditor.attachments.oneAttachmentAllowed"));
  };
  React.useImperativeHandle(ref, function () {
    return {
      handleUploadAttachments: handleUploadAttachments
    };
  }, []);
  var handleFilesDrop = /*#__PURE__*/function () {
    var _ref3 = _asyncToGenerator__default.default(/*#__PURE__*/_regeneratorRuntime__default.default.mark(function _callee2(files) {
      var uploadedFiles;
      return _regeneratorRuntime__default.default.wrap(function _callee2$(_context2) {
        while (1) switch (_context2.prev = _context2.next) {
          case 0:
            addFiles(files);
            _context2.next = 3;
            return uploadFiles();
          case 3:
            uploadedFiles = _context2.sent;
            neetoCist.isNotEmpty(uploadedFiles) && onChange([].concat(_toConsumableArray__default.default(attachments), _toConsumableArray__default.default(uploadedFiles)));
          case 5:
          case "end":
            return _context2.stop();
        }
      }, _callee2);
    }));
    return function handleFilesDrop(_x2) {
      return _ref3.apply(this, arguments);
    };
  }();
  reactFileIcon_esm.useDropFiles({
    dropTargetRef: dragDropRef,
    attachments: attachments,
    onDrop: handleFilesDrop
  });
  return /*#__PURE__*/jsxRuntime.jsxs("div", {
    className: classnames__default.default("ne-attachments", _defineProperty__default.default({}, className, className)),
    children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
      className: "ne-attachments__items",
      children: [attachments.map(function (attachment) {
        return /*#__PURE__*/React.createElement(Attachment, {
          allowDelete: allowDelete,
          allowOpenInNewTab: allowOpenInNewTab,
          attachment: attachment,
          attachments: attachments,
          disabled: disabled,
          onChange: onChange,
          setSelectedAttachment: setSelectedAttachment,
          key: attachment.signedId,
          isLoading: !didFetchPreviewBundle && selectedAttachment.url === attachment.url
        });
      }), queuedFiles.map(function (attachment) {
        return /*#__PURE__*/React.createElement(AttachmentProgress, {
          attachment: attachment,
          cancelUpload: cancelUpload,
          key: attachment.id
        });
      })]
    }), /*#__PURE__*/jsxRuntime.jsxs("div", {
      children: [isIndependent && /*#__PURE__*/jsxRuntime.jsx(neetoAtoms.Button, {
        "data-testid": "neeto-editor-attachments-upload-button",
        disabled: isUploading,
        label: t("neetoEditor.attachments.add"),
        loading: isUploading,
        variant: "link",
        onClick: handleUploadAttachments
      }), /*#__PURE__*/jsxRuntime.jsx("input", {
        accept: (_fileUploadConfig$all = fileUploadConfig.allowedFileTypes) === null || _fileUploadConfig$all === void 0 ? void 0 : _fileUploadConfig$all.join(","),
        multiple: fileUploadConfig.maxNumberOfFiles !== 1,
        ref: attachmentInputRef,
        type: "file",
        onChange: handleAddFile,
        onClick: handleFileInputClick
      }), /*#__PURE__*/jsxRuntime.jsx(React.Suspense, {
        fallback: /*#__PURE__*/jsxRuntime.jsx("span", {}),
        children: neetoCist.isPresent(selectedAttachment) && /*#__PURE__*/jsxRuntime.jsx(Preview, {
          attachments: attachments,
          selectedAttachment: selectedAttachment,
          setDidFetchPreviewBundle: setDidFetchPreviewBundle,
          setSelectedAttachment: setSelectedAttachment,
          onClose: function onClose() {
            return setSelectedAttachment({});
          }
        })
      })]
    })]
  });
};
Attachments$1.displayName = "NeetoEditorAttachments";
var Attachments = /*#__PURE__*/React.memo(/*#__PURE__*/React.forwardRef(Attachments$1));

exports.Attachments = Attachments;
exports.checkPreviewAvailability = checkPreviewAvailability;
exports.downloadFile = downloadFile;
//# sourceMappingURL=chunk-Cvxaj__T.cjs.js.map
