import { jsx } from "react/jsx-runtime";
import { forwardRef, memo } from "react";
import { useDocument } from "../hooks/use-document";
import { FallbackComponent } from "../../../components/shared/FallbackComponent";
import { Document as DocumentComponent } from "./Document";
const DocumentRoot = memo(
  forwardRef(function DocumentRoot2({ rootDocument }, ref) {
    const document = useDocument(rootDocument.key) ?? rootDocument;
    if (document == null) {
      return /* @__PURE__ */ jsx(FallbackComponent, { ref, text: "Document not found" });
    }
    return /* @__PURE__ */ jsx(DocumentComponent, { ref, document });
  })
);
export {
  DocumentRoot
};
//# sourceMappingURL=DocumentRoot.js.map