import { jsx as _jsx } from "react/jsx-runtime";
export function str(content, key, fallback = '') {
    const v = content[key];
    return typeof v === 'string' ? v : fallback;
}
export function bool(content, key, fallback = false) {
    const v = content[key];
    return typeof v === 'boolean' ? v : fallback;
}
/** Vertical padding scale for a section. */
export function paddingClass(settings) {
    switch (settings.paddingY) {
        case 'sm':
            return 'py-8';
        case 'md':
            return 'py-12';
        case 'xl':
            return 'py-20 sm:py-28';
        case 'lg':
        default:
            return 'py-16 sm:py-20';
    }
}
/** Returns true when the section background is the dark/purple treatment. */
export function isDarkBackground(settings) {
    return ((settings.backgroundType === 'solid' || settings.backgroundType === 'gradient') &&
        settings.backgroundColor === 'purple');
}
/** Background utility classes derived from settings. */
export function backgroundClass(settings) {
    if (settings.backgroundType === 'gradient' && settings.backgroundColor === 'purple') {
        return 'bg-gradient-to-br from-violet-600 to-violet-700 text-white';
    }
    if (settings.backgroundType === 'solid' && settings.backgroundColor === 'purple') {
        return 'bg-violet-600 text-white';
    }
    if (settings.backgroundType === 'solid' && settings.backgroundColor === 'muted') {
        return 'bg-zinc-50 text-zinc-900';
    }
    return 'bg-white text-zinc-900';
}
/**
 * Preview-only button. `tone="onDark"` renders the white-on-purple button
 * from the screenshot; `tone="primary"` renders a solid violet button for
 * light backgrounds.
 */
export function PreviewButton({ label, href, tone = 'primary', }) {
    if (!label)
        return null;
    const base = 'inline-flex items-center justify-center rounded-lg px-5 py-2.5 text-sm font-medium transition-colors';
    const toneClass = tone === 'onDark'
        ? 'bg-white text-violet-700 hover:bg-violet-50'
        : tone === 'ghost'
            ? 'border border-zinc-300 text-zinc-700 hover:bg-zinc-50'
            : 'bg-violet-600 text-white hover:bg-violet-700';
    // Editor preview: links are inert (preventDefault) so clicking content
    // selects the section instead of navigating away.
    return (_jsx("a", { href: href || '#', onClick: (e) => e.preventDefault(), className: `${base} ${toneClass}`, tabIndex: -1, children: label }));
}
//# sourceMappingURL=parts.js.map