import { join, resolve } from "node:path";
import { getSettings } from "../../util/settings.js";
import { MdxRenderer, MdxSite } from "../mdx/renderer.js";
export class NextraSite extends MdxSite {
    buildPagePath(slug) {
        const settings = getSettings();
        return resolve(join(settings.output.pageOutDir, `${slug}/page.mdx`));
    }
    finalize() {
        const settings = getSettings();
        const schemasEntry = settings.display.showSchemasInNav
            ? `\n  schemas: { title: "Schemas", theme: { collapsed: false } },`
            : "";
        const config = `export default {
      about: { title: "About", theme: { collapsed: false } },
      tag: { title: "Operations", theme: { collapsed: false } },${schemasEntry}
    }`;
        this.createRawPage(join(settings.output.pageOutDir, "_meta.ts"), config);
        return super.finalize();
    }
}
export class NextraRenderer extends MdxRenderer {
    #frontMatter;
    insertFrontMatter({ sidebarLabel, }) {
        this.#frontMatter = `---
sidebarTitle: ${this.escapeText(sidebarLabel, { escape: "mdx" })}
---`;
    }
    finalize() {
        const parentData = super.finalize();
        const data = (this.#frontMatter ? this.#frontMatter + "\n\n" : "") + parentData;
        return data;
    }
}
//# sourceMappingURL=renderer.js.map