import { memo, createElement } from "react";
import { DataBindingProvider, EntitySubTree } from "@contember/binding";
import { useOnPersistSuccess } from "../useOnPersistSuccess.js";
import { NotFoundWrapper } from "./NotFoundWrapper.js";
import { getPageName } from "./getPageName.js";
import { FeedbackRenderer } from "../../bindingFacade/renderers/FeedbackRenderer.js";
import { LayoutRenderer } from "../../bindingFacade/renderers/LayoutRenderer.js";
import { PersistButton } from "../../bindingFacade/buttons/PersistButton.js";
const EditPage = memo(({ pageName, children, rendererProps, redirectOnSuccess, onPersistSuccess, refreshDataBindingOnPersist, ...entityProps }) => /* @__PURE__ */ createElement(DataBindingProvider, {
  stateComponent: FeedbackRenderer,
  refreshOnPersist: refreshDataBindingOnPersist ?? true
}, /* @__PURE__ */ createElement(EntitySubTree, {
  ...entityProps,
  onPersistSuccess: useOnPersistSuccess({ redirectOnSuccess, onPersistSuccess })
}, /* @__PURE__ */ createElement(NotFoundWrapper, {
  title: rendererProps?.title
}, /* @__PURE__ */ createElement(LayoutRenderer, {
  ...rendererProps,
  actions: rendererProps?.actions ?? /* @__PURE__ */ createElement(PersistButton, null)
}, children)))));
EditPage.displayName = "EditPage";
EditPage.getPageName = getPageName;
export { EditPage };
//# sourceMappingURL=EditPage.js.map
