import { join, resolve } from "node:path";
import { getSettings } from "../../util/settings.js";
import { MdxRenderer, MdxSite } from "../mdx/renderer.js";
export class DocusaurusSite extends MdxSite {
    buildPagePath(slug) {
        const settings = getSettings();
        return resolve(join(settings.output.pageOutDir, `${slug}.mdx`));
    }
    finalize() {
        const settings = getSettings();
        this.createRawPage(join(settings.output.pageOutDir, "_category_.json"), JSON.stringify({
            position: 2,
            label: "API Reference",
            collapsible: true,
            collapsed: false,
        }, null, "  "));
        this.createRawPage(join(settings.output.pageOutDir, "tag", "_category_.json"), JSON.stringify({
            position: 3,
            label: "Operations",
            collapsible: true,
            collapsed: false,
        }, null, "  "));
        if (settings.display.showSchemasInNav) {
            this.createRawPage(join(settings.output.pageOutDir, "schema", "_category_.json"), JSON.stringify({
                position: 4,
                label: "Schemas",
                collapsible: true,
                collapsed: true,
            }, null, "  "));
        }
        return super.finalize();
    }
}
export class DocusaurusRenderer extends MdxRenderer {
    #frontMatter;
    insertFrontMatter({ sidebarPosition, sidebarLabel, }) {
        this.#frontMatter = `---
sidebar_position: ${sidebarPosition}
sidebar_label: ${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