import { Fragment, jsx, jsxs } from "react/jsx-runtime";
import { useMemo } from "react";
import { DocumentRoot } from "../DocumentRoot";
import { usePageSnippets } from "../hooks/use-page-snippets";
import { BodySnippet } from "./BodySnippet";
import { PageHead } from "./PageHead";
import { flattenMetadataSettings } from "./page-seo-settings";
function Page({ page, rootDocument, metadata = true }) {
  const { bodySnippets } = usePageSnippets({ page });
  const pageMetadataSettings = useMemo(() => flattenMetadataSettings(metadata), [metadata]);
  return /* @__PURE__ */ jsxs(Fragment, { children: [
    /* @__PURE__ */ jsx(PageHead, { document: page, metadata: pageMetadataSettings }),
    /* @__PURE__ */ jsx(DocumentRoot, { rootDocument }),
    bodySnippets.map((snippet) => /* @__PURE__ */ jsx(BodySnippet, { code: snippet.code, cleanup: snippet.cleanup }, snippet.id))
  ] });
}
export {
  Page
};
//# sourceMappingURL=Page.js.map