"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const jsxRuntime = require("react/jsx-runtime");
const reactBindingUi = require("@contember/react-binding-ui");
const defaultUploader = require("../../defaultUploader.cjs");
const getFileUrlDataExtractor = require("../../fileDataExtractors/getFileUrlDataExtractor.cjs");
const getGenericFileMetadataExtractor = require("../../fileDataExtractors/getGenericFileMetadataExtractor.cjs");
const acceptAnyFile = () => true;
const renderAnyFilePreview = ({ objectUrl }) => /* @__PURE__ */ jsxRuntime.jsx(
  "a",
  {
    style: { whiteSpace: "nowrap", overflow: "hidden", textOverflow: "ellipsis", direction: "rtl" },
    href: objectUrl,
    onClick: (e) => e.stopPropagation(),
    download: true,
    children: objectUrl.substring(Math.max(0, objectUrl.lastIndexOf("/") + 1))
  }
);
const getStockAnyFileKind = ({
  additionalExtractors = [],
  acceptMimeTypes = null,
  acceptFile = acceptAnyFile,
  baseEntity,
  children,
  fileSizeField,
  fileTypeField,
  lastModifiedField,
  fileNameField,
  renderFilePreview = renderAnyFilePreview,
  renderUploadedFile,
  uploader = defaultUploader.defaultUploader,
  urlField,
  childrenOutsideBaseEntity
}) => {
  const extractors = [
    getFileUrlDataExtractor.getFileUrlDataExtractor({ urlField }),
    getGenericFileMetadataExtractor.getGenericFileMetadataExtractor({ fileNameField, fileSizeField, fileTypeField, lastModifiedField }),
    ...additionalExtractors
  ];
  return {
    acceptMimeTypes,
    acceptFile,
    renderFilePreview,
    renderUploadedFile: renderUploadedFile ?? /* @__PURE__ */ jsxRuntime.jsx(reactBindingUi.FileUrlFieldView, { fileUrlField: urlField }),
    uploader,
    children,
    childrenOutsideBaseEntity,
    baseEntity,
    extractors
  };
};
exports.acceptAnyFile = acceptAnyFile;
exports.getStockAnyFileKind = getStockAnyFileKind;
exports.renderAnyFilePreview = renderAnyFilePreview;
//# sourceMappingURL=getStockAnyFileKind.cjs.map
