const defaultRenderers = new WeakSet();
export function createMessageRendererRegistry() {
    return {};
}
export function registerMessageRenderer(registry, contentType, renderer, options) {
    const existingRenderer = registry[contentType];
    if (process.env.NODE_ENV !== 'production' &&
        existingRenderer &&
        !defaultRenderers.has(existingRenderer)) {
        // eslint-disable-next-line no-console
        console.warn(`registerMessageRenderer: overwriting existing renderer for content type "${contentType}"`);
    }
    const registeredRenderer = renderer;
    if (options === null || options === void 0 ? void 0 : options.isDefault) {
        defaultRenderers.add(registeredRenderer);
    }
    Object.assign(registry, {
        [contentType]: registeredRenderer,
    });
    return registry;
}
export function getMessageRenderer(registry, contentType) {
    var _a;
    return (_a = registry[contentType]) === null || _a === void 0 ? void 0 : _a.component;
}
export function mergeMessageRendererRegistries(defaultRegistry, customRegistry) {
    return Object.assign(Object.assign({}, defaultRegistry), customRegistry);
}
//# sourceMappingURL=messageTypeRegistry.js.map
