// Copyright (c) 2026 Modelware. All rights reserved.
export function buildTemplateCatalog(templates) {
    const byId = new Map();
    for (const template of templates) {
        const id = normalizeTemplateId(template.id);
        if (!id) {
            continue;
        }
        byId.set(id, { ...template, id });
    }
    return {
        byId,
        all: [...byId.values()]
    };
}
export function normalizeTemplateId(value) {
    return value.trim().replace(/^<|>$/g, '');
}
export function getTemplateById(catalog, templateId) {
    const normalized = normalizeTemplateId(templateId);
    if (!normalized) {
        return undefined;
    }
    return catalog.byId.get(normalized);
}
//# sourceMappingURL=catalog.js.map