"use strict";
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
const jsxRuntime = require("react/jsx-runtime");
const reactBinding = require("@contember/react-binding");
const getFileUrlDataExtractor = ({ urlField }) => ({
  staticRender: () => /* @__PURE__ */ jsxRuntime.jsx(reactBinding.SugaredField, { field: urlField }),
  populateFields: ({ entity, uploadResult }) => {
    if (!uploadResult.fileUrl || typeof uploadResult.fileUrl !== "string") {
      return;
    }
    entity.getField(urlField).updateValue(uploadResult.fileUrl);
  },
  getErrorsHolders: ({ entity, environment }) => {
    const desugaredUrlField = reactBinding.QueryLanguage.desugarRelativeSingleField(urlField, environment);
    const owningEntity = entity.getRelativeSingleEntity({
      hasOneRelationPath: desugaredUrlField.hasOneRelationPath
    });
    return [entity.getField(urlField), owningEntity];
  }
});
exports.getFileUrlDataExtractor = getFileUrlDataExtractor;
//# sourceMappingURL=getFileUrlDataExtractor.cjs.map
