import { Component, EntitySubTree } from "@contember/binding";
import { AutoFields } from "./AutoFields.js";
import { jsxDEV } from "react/jsx-dev-runtime";
import { NotFoundWrapper } from "../pageRouting/pageComponents/NotFoundWrapper.js";
var _jsxFileName = "/__w/interface/interface/packages/admin/src/components/Auto/AutoForm.tsx";
const AutoForm = Component(({
  entity,
  id,
  onCreateSuccess,
  createEditLink
}) => {
  if (id === void 0) {
    return /* @__PURE__ */ jsxDEV(EntitySubTree, {
      entity,
      isCreating: true,
      onPersistSuccess: onCreateSuccess,
      children: /* @__PURE__ */ jsxDEV(AutoFields, {
        createEditLink
      }, void 0, false, {
        fileName: _jsxFileName,
        lineNumber: 19,
        columnNumber: 6
      }, void 0)
    }, void 0, false, {
      fileName: _jsxFileName,
      lineNumber: 18,
      columnNumber: 5
    }, void 0);
  } else {
    return /* @__PURE__ */ jsxDEV(EntitySubTree, {
      entity: {
        entityName: entity,
        where: {
          id
        }
      },
      children: /* @__PURE__ */ jsxDEV(NotFoundWrapper, {
        children: /* @__PURE__ */ jsxDEV(AutoFields, {
          createEditLink
        }, void 0, false, {
          fileName: _jsxFileName,
          lineNumber: 27,
          columnNumber: 7
        }, void 0)
      }, void 0, false, {
        fileName: _jsxFileName,
        lineNumber: 26,
        columnNumber: 6
      }, void 0)
    }, void 0, false, {
      fileName: _jsxFileName,
      lineNumber: 25,
      columnNumber: 5
    }, void 0);
  }
});
export {
  AutoForm
};
//# sourceMappingURL=AutoForm.js.map
