// Copyright (c) 2026 Modelware. All rights reserved.
import { ChartMarkdownBlockRenderer } from './chart-renderer.js';
import { DiagramMarkdownBlockRenderer } from './diagram-renderer.js';
import { GraphMarkdownBlockRenderer } from './graph-renderer.js';
import { ListMarkdownBlockRenderer } from './list-renderer.js';
import { MatrixMarkdownBlockRenderer } from './matrix-renderer.js';
import { MessageMarkdownBlockRenderer } from './message-renderer.js';
import { TableEditorMarkdownBlockRenderer } from './table-editor-renderer.js';
import { TableMarkdownBlockRenderer } from './table-renderer.js';
import { TextMarkdownBlockRenderer } from './text-renderer.js';
import { TreeMarkdownBlockRenderer } from './tree-renderer.js';
export class MarkdownRendererRegistry {
    constructor(renderers) {
        this.renderers = renderers;
    }
    render(result) {
        const renderer = this.renderers.find((candidate) => candidate.canRender(result));
        if (!renderer) {
            throw new Error(`No renderer registered for block '${result.blockId}'.`);
        }
        return renderer.render(result);
    }
}
export function createCoreMarkdownRenderers() {
    return [
        new MatrixMarkdownBlockRenderer(),
        new TreeMarkdownBlockRenderer(),
        new TableEditorMarkdownBlockRenderer(),
        new TableMarkdownBlockRenderer(),
        new ListMarkdownBlockRenderer(),
        new TextMarkdownBlockRenderer(),
        new GraphMarkdownBlockRenderer(),
        new DiagramMarkdownBlockRenderer(),
        new ChartMarkdownBlockRenderer(),
        new MessageMarkdownBlockRenderer(),
    ];
}
export function createMarkdownRendererRegistry() {
    return new MarkdownRendererRegistry(createCoreMarkdownRenderers());
}
//# sourceMappingURL=registry.js.map