'use strict';
import { jsx } from 'react/jsx-runtime';
import { FileUpload } from '../../components/file-upload/FileUpload.js';
import { fileUploadTypes } from '../../../../fd-toolbox/enums/enums.js';
import { onImageDelete, onImageChange } from './EditResourceImageField.funcs.js';

var __defProp = Object.defineProperty;
var __name = (target, value) => __defProp(target, "name", {
  value,
  configurable: true
});
function EditResourceImageField({
  propertyMeta,
  relatedResourceId,
  form,
  isNew,
  onChange
}) {
  return /* @__PURE__ */jsx("div", {
    className: "text-muted-foreground relative flex items-center gap-3 pb-2",
    children: /* @__PURE__ */jsx(FileUpload, {
      propertyMeta,
      value: form.getValues(propertyMeta.name),
      allowMultiple: propertyMeta.fileUploadType === fileUploadTypes.multiple,
      required: propertyMeta.required,
      label: propertyMeta.displayName,
      relatedResourceId,
      onChange: (files, fileUrls) => {
        onImageChange(propertyMeta, form, files, fileUrls, isNew, onChange);
      },
      onFileDelete: (fileUrls, file) => {
        onImageDelete(propertyMeta, form, fileUrls, file, isNew, onChange);
      }
    })
  });
}
__name(EditResourceImageField, "EditResourceImageField");

export { EditResourceImageField };
