import { __decorate, __param } from '../../../../../../../external/tslib/tslib.es6.js';
import { MarkdownRenderer } from '../../../../editor/browser/widget/markdownRenderer/browser/markdownRenderer.js';
import { ILanguageService } from '../../../../editor/common/languages/language.js';
import { IOpenerService } from '../../../../platform/opener/common/opener.service.js';
import { ITrustedDomainService } from '../../url/browser/trustedDomainService.service.js';
const allowedHtmlTags = [
    'b',
    'blockquote',
    'br',
    'code',
    'em',
    'h1',
    'h2',
    'h3',
    'h4',
    'h5',
    'h6',
    'hr',
    'i',
    'li',
    'ol',
    'p',
    'pre',
    'strong',
    'table',
    'tbody',
    'td',
    'th',
    'thead',
    'tr',
    'ul',
    'a',
    'img',
    'span',
    'div',
];
let ChatMarkdownRenderer = class ChatMarkdownRenderer extends MarkdownRenderer {
    constructor(options, languageService, openerService, trustedDomainService) {
        super(options ?? {}, languageService, openerService);
        this.trustedDomainService = trustedDomainService;
    }
    render(markdown, options, markedOptions) {
        options = {
            ...options,
            remoteImageIsAllowed: (uri) => this.trustedDomainService.isValid(uri),
            sanitizerOptions: {
                replaceWithPlaintext: true,
                allowedTags: allowedHtmlTags,
            }
        };
        const mdWithBody = (markdown && markdown.supportHtml) ?
            {
                ...markdown,
                value: `<body>\n\n${markdown.value}</body>`,
            }
            : markdown;
        return super.render(mdWithBody, options, markedOptions);
    }
};
ChatMarkdownRenderer = ( __decorate([
    ( __param(1, ILanguageService)),
    ( __param(2, IOpenerService)),
    ( __param(3, ITrustedDomainService))
], ChatMarkdownRenderer));
export { ChatMarkdownRenderer };
