import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
import { bool, str } from './parts.js';
/**
 * Renders the post's main body. When `source === 'field'` it shows the
 * post's own Body field (passed via context); otherwise it renders the
 * section's own `body` copy.
 *
 * The Body field is a `richText` field (sanitized HTML on write), so this
 * canvas preview renders it as HTML — exactly like the public site's
 * article-body renderer — to stay WYSIWYG. It previews the author's own
 * in-progress draft; the server sanitizes (sanitize-html) on save.
 */
export function ArticleBodySection({ section, context, }) {
    const c = section.content;
    const source = str(c, 'source', 'field');
    const html = source === 'field' ? (context?.body ?? '') : str(c, 'body');
    const wide = str(c, 'width', 'normal') === 'wide';
    const showToc = bool(c, 'showToc');
    return (_jsxs("div", { className: `mx-auto px-6 ${wide ? 'max-w-4xl' : 'max-w-2xl'}`, children: [showToc && (_jsxs("div", { className: "mb-8 rounded-lg border border-zinc-200 bg-zinc-50 p-4", children: [_jsx("p", { className: "text-xs font-semibold tracking-wider text-zinc-500 uppercase", children: "On this page" }), _jsx("p", { className: "mt-1 text-sm text-zinc-400", children: "A table of contents will be generated from the body headings." })] })), html.trim() ? (_jsx("div", { className: "prose prose-zinc max-w-none text-base leading-relaxed text-zinc-700", dangerouslySetInnerHTML: { __html: html } })) : (_jsx("p", { className: "text-base leading-relaxed text-zinc-400 italic", children: source === 'field'
                    ? "This will show the post's Body content."
                    : 'Add body copy in the inspector.' }))] }));
}
//# sourceMappingURL=ArticleBodySection.js.map