"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Article = void 0;
const tslib_1 = require("tslib");
const markdown_viewer_1 = require("@stoplight/markdown-viewer");
const builder_1 = require("@stoplight/markdown/builder");
const react_error_boundary_1 = require("@stoplight/react-error-boundary");
const classnames_1 = tslib_1.__importDefault(require("classnames"));
const React = tslib_1.__importStar(require("react"));
const MarkdownViewer_1 = require("../../MarkdownViewer");
const Headings_1 = require("./Headings");
const ArticleComponent = React.memo(({ data, className }) => {
    const [container, setContainer] = React.useState(null);
    const markdown = new builder_1.Builder();
    markdown.addMarkdown(data);
    const tree = markdown_viewer_1.processMarkdownTree(markdown.root);
    return (React.createElement("div", { className: classnames_1.default(className, 'flex w-full relative'), ref: setContainer },
        React.createElement(MarkdownViewer_1.MarkdownViewer, { className: "flex-1", markdown: tree }),
        React.createElement(Headings_1.ArticleHeadings, { tree: tree, container: container })));
});
exports.Article = react_error_boundary_1.withErrorBoundary(ArticleComponent, { recoverableProps: ['data'] });
//# sourceMappingURL=index.js.map