/** Sub-field schema for the legacy `stats` shorthand ({value,label,description}). */
export const STATS_ROW_FIELDS = [
    { key: 'value', label: 'Value', type: 'text', placeholder: 'e.g. 99.99%' },
    { key: 'label', label: 'Label', type: 'text', placeholder: 'e.g. Uptime' },
    { key: 'description', label: 'Description', type: 'text' },
];
/** Sub-field schema for the legacy `gallery` shorthand ({url,alt,caption}). */
export const GALLERY_ROW_FIELDS = [
    { key: 'url', label: 'Image', type: 'media' },
    {
        key: 'alt',
        label: 'Alt text',
        type: 'text',
        help: 'Describe the image for screen readers.',
    },
    { key: 'caption', label: 'Caption', type: 'text' },
];
/**
 * Resolve a field into its repeater configuration, or `null` when it isn't a
 * repeater-like field. Handles the generic `repeater` type plus the `stats`
 * and `gallery` shorthands (kept as presets over the same row model) so the
 * inspector and validator share ONE path.
 */
export function resolveRepeaterField(field) {
    if (field.type === 'repeater') {
        return {
            rowLabel: field.rowLabel?.trim() || 'Item',
            fields: Array.isArray(field.fields) ? field.fields : [],
            minRows: field.minRows,
            maxRows: field.maxRows,
        };
    }
    if (field.type === 'stats')
        return { rowLabel: 'Stat', fields: STATS_ROW_FIELDS };
    if (field.type === 'gallery')
        return { rowLabel: 'Image', fields: GALLERY_ROW_FIELDS };
    return null;
}
/** True when a field renders/validates as a repeatable group of rows. */
export function isRepeaterField(field) {
    return resolveRepeaterField(field) !== null;
}
/** Build a blank row seeded with empty values for each sub-field. */
export function blankRepeaterRow(fields) {
    const row = {};
    for (const f of fields)
        row[f.key] = f.type === 'boolean' ? false : '';
    return row;
}
//# sourceMappingURL=fields.js.map