"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const jsxRuntime = require("react/jsx-runtime");
const reactBinding = require("@contember/react-binding");
const BareUploadField = require("./BareUploadField.cjs");
const useResolvedSingleKindFileSelection = require("./selection/useResolvedSingleKindFileSelection.cjs");
const createEntityConnector = require("../fileHandler/utils/createEntityConnector.cjs");
const react = require("react");
const useSingleKindFileHandler = require("../fileHandler/useSingleKindFileHandler.cjs");
const SingleKindFileHandler = require("../fileHandler/SingleKindFileHandler.cjs");
const SingleKindUploadField = reactBinding.Component(
  (props) => {
    const env = reactBinding.useEnvironment();
    const connectorFactoryFactory = react.useCallback(
      () => createEntityConnector.createEntityConnectorFactory(env, props.baseEntity),
      [env, props.baseEntity]
    );
    return /* @__PURE__ */ jsxRuntime.jsx(
      BareUploadField.BareUploadField,
      {
        ...props,
        fileSelection: useResolvedSingleKindFileSelection.useResolvedSingleKindFileSelection(props, connectorFactoryFactory),
        fileHandler: useSingleKindFileHandler.useSingleKindFileHandler(props, props.kindFactory)
      }
    );
  },
  (props) => /* @__PURE__ */ jsxRuntime.jsx(
    BareUploadField.BareUploadField,
    {
      ...props,
      fileHandler: new SingleKindFileHandler.SingleKindFileHandler(
        props.kindFactory(props),
        SingleKindFileHandler.isEmptyByUrlField(props.urlField)
      )
    }
  ),
  "SingleKindUploadField"
);
exports.SingleKindUploadField = SingleKindUploadField;
//# sourceMappingURL=SingleKindUploadField.cjs.map
