import { jsx } from "react/jsx-runtime";
import { ImageFieldView } from "@contember/react-binding-ui";
import { defaultUploader } from "../../defaultUploader.js";
import { getImageFileDataExtractor } from "../../fileDataExtractors/getImageFileDataExtractor.js";
import { getFileUrlDataExtractor } from "../../fileDataExtractors/getFileUrlDataExtractor.js";
import { getGenericFileMetadataExtractor } from "../../fileDataExtractors/getGenericFileMetadataExtractor.js";
const acceptImageFile = ({ file }) => file.type.startsWith("image");
const renderImageFilePreview = ({ objectUrl }) => /* @__PURE__ */ 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,
  urlField,
  childrenOutsideBaseEntity
}) => {
  const extractors = [
    getFileUrlDataExtractor({ urlField }),
    getGenericFileMetadataExtractor({ fileNameField, fileSizeField, fileTypeField, lastModifiedField }),
    getImageFileDataExtractor({ heightField, widthField }),
    ...additionalExtractors
  ];
  return {
    acceptMimeTypes,
    acceptFile,
    renderFilePreview,
    uploader,
    renderUploadedFile: renderUploadedFile ?? /* @__PURE__ */ jsx(ImageFieldView, { srcField: urlField }),
    children,
    childrenOutsideBaseEntity,
    baseEntity,
    extractors
  };
};
export {
  acceptImageFile,
  getStockImageFileKind,
  renderImageFilePreview
};
//# sourceMappingURL=getStockImageFileKind.js.map
