"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 getImageFileDataExtractor = require("../../fileDataExtractors/getImageFileDataExtractor.cjs");
const getFileUrlDataExtractor = require("../../fileDataExtractors/getFileUrlDataExtractor.cjs");
const getGenericFileMetadataExtractor = require("../../fileDataExtractors/getGenericFileMetadataExtractor.cjs");
const acceptImageFile = ({ file }) => file.type.startsWith("image");
const renderImageFilePreview = ({ objectUrl }) => /* @__PURE__ */ jsxRuntime.jsx("img", { src: objectUrl, alt: "" });
const getStockImageFileKind = ({
  additionalExtractors = [],
  acceptMimeTypes = "image/*",
  acceptFile = acceptImageFile,
  baseEntity,
  children,
  fileSizeField,
  fileTypeField,
  lastModifiedField,
  fileNameField,
  renderFilePreview = renderImageFilePreview,
  renderUploadedFile,
  heightField,
  widthField,
  uploader = defaultUploader.defaultUploader,
  urlField,
  childrenOutsideBaseEntity
}) => {
  const extractors = [
    getFileUrlDataExtractor.getFileUrlDataExtractor({ urlField }),
    getGenericFileMetadataExtractor.getGenericFileMetadataExtractor({ fileNameField, fileSizeField, fileTypeField, lastModifiedField }),
    getImageFileDataExtractor.getImageFileDataExtractor({ heightField, widthField }),
    ...additionalExtractors
  ];
  return {
    acceptMimeTypes,
    acceptFile,
    renderFilePreview,
    uploader,
    renderUploadedFile: renderUploadedFile ?? /* @__PURE__ */ jsxRuntime.jsx(reactBindingUi.ImageFieldView, { srcField: urlField }),
    children,
    childrenOutsideBaseEntity,
    baseEntity,
    extractors
  };
};
exports.acceptImageFile = acceptImageFile;
exports.getStockImageFileKind = getStockImageFileKind;
exports.renderImageFilePreview = renderImageFilePreview;
//# sourceMappingURL=getStockImageFileKind.cjs.map
