"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
  for (var name in all)
    __defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
  if (from && typeof from === "object" || typeof from === "function") {
    for (let key of __getOwnPropNames(from))
      if (!__hasOwnProp.call(to, key) && key !== except)
        __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
  }
  return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var Page_exports = {};
__export(Page_exports, {
  Page: () => Page
});
module.exports = __toCommonJS(Page_exports);
var import_jsx_runtime = require("react/jsx-runtime");
var import_react = require("react");
var import_DocumentRoot = require("../DocumentRoot");
var import_use_page_snippets = require("../hooks/use-page-snippets");
var import_BodySnippet = require("./BodySnippet");
var import_PageHead = require("./PageHead");
var import_page_seo_settings = require("./page-seo-settings");
function Page({ page, rootDocument, metadata = true }) {
  const { bodySnippets } = (0, import_use_page_snippets.usePageSnippets)({ page });
  const pageMetadataSettings = (0, import_react.useMemo)(() => (0, import_page_seo_settings.flattenMetadataSettings)(metadata), [metadata]);
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
    /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_PageHead.PageHead, { document: page, metadata: pageMetadataSettings }),
    /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_DocumentRoot.DocumentRoot, { rootDocument }),
    bodySnippets.map((snippet) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_BodySnippet.BodySnippet, { code: snippet.code, cleanup: snippet.cleanup }, snippet.id))
  ] });
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
  Page
});
//# sourceMappingURL=Page.js.map