import { createElement } from "react";
import { defaultUploader } from "../../defaultUploader.js";
import { getAudioFileDataExtractor } from "../../fileDataExtractors/getAudioFileDataExtractor.js";
import { getFileUrlDataExtractor } from "../../fileDataExtractors/getFileUrlDataExtractor.js";
import { getGenericFileMetadataExtractor } from "../../fileDataExtractors/getGenericFileMetadataExtractor.js";
import { FileUrlFieldView } from "../../../fieldViews/FileUrlFieldView.js";
const acceptAudioFile = ({ file }) => file.type.startsWith("audio");
const renderAudioFilePreview = ({ objectUrl }) => /* @__PURE__ */ createElement("audio", {
  src: objectUrl,
  controls: true
});
const getStockAudioFileKind = ({
  additionalExtractors = [],
  acceptMimeTypes = "audio/*",
  acceptFile = acceptAudioFile,
  baseEntity,
  children,
  durationField,
  fileSizeField,
  fileTypeField,
  lastModifiedField,
  fileNameField,
  renderFilePreview = renderAudioFilePreview,
  renderUploadedFile,
  uploader = defaultUploader,
  urlField,
  childrenOutsideBaseEntity
}) => {
  const extractors = [
    getFileUrlDataExtractor({ urlField }),
    getGenericFileMetadataExtractor({ fileNameField, fileSizeField, fileTypeField, lastModifiedField }),
    getAudioFileDataExtractor({ durationField }),
    ...additionalExtractors
  ];
  return {
    acceptMimeTypes,
    acceptFile,
    renderFilePreview,
    uploader,
    renderUploadedFile: renderUploadedFile ?? /* @__PURE__ */ createElement(FileUrlFieldView, {
      fileUrlField: urlField
    }),
    baseEntity,
    children,
    childrenOutsideBaseEntity,
    extractors
  };
};
export { acceptAudioFile, getStockAudioFileKind, renderAudioFilePreview };
//# sourceMappingURL=getStockAudioFileKind.js.map
