import { jsx as _jsx } from "react/jsx-runtime";
import { memo } from 'react';
import { useMarkdownTransform } from "../../../hooks/useMarkdownTransform.js";
import { useRemend } from "../../../hooks/useRemend.js";
import { block } from "../../../utils/cn.js";
import { areOptionsEqual } from "../../../utils/markdownUtils.js";
import "./MarkdownRenderer.css";
const b = block('markdown-renderer');
function MarkdownRendererComponent({ content, className, qa, transformOptions, shouldParseIncompleteMarkdown = false, }) {
    const closedContent = useRemend(content, shouldParseIncompleteMarkdown);
    const html = useMarkdownTransform(closedContent, transformOptions);
    return (_jsx("div", { className: b(null, [className, 'yfm']), "data-qa": qa, dangerouslySetInnerHTML: { __html: html } }));
}
export const MarkdownRenderer = memo(MarkdownRendererComponent, (prevProps, nextProps) => {
    if (prevProps.content !== nextProps.content) {
        return false;
    }
    if (prevProps.shouldParseIncompleteMarkdown !== nextProps.shouldParseIncompleteMarkdown) {
        return false;
    }
    if (prevProps.className !== nextProps.className) {
        return false;
    }
    if (prevProps.qa !== nextProps.qa) {
        return false;
    }
    return areOptionsEqual(prevProps.transformOptions, nextProps.transformOptions);
});
MarkdownRenderer.displayName = 'MarkdownRenderer';
//# sourceMappingURL=MarkdownRenderer.js.map
