import { wrapMinimal } from '../utils.js';
export function parseComText(codigo) {
    const lines = codigo.split('\n');
    const totalLines = lines.length;
    const nonEmptyLines = lines.filter(l => l.trim()).length;
    const commentLines = lines.filter(l => /^\s*[#;]/.test(l)).length;
    const blankLines = lines.filter(l => !l.trim()).length;
    const words = codigo.split(/\s+/).filter(Boolean).length;
    const chars = codigo.length;
    const keyValuePairs = [];
    for (const line of lines) {
        const match = line.match(/^\s*([A-Za-z_][A-Za-z0-9_]*)\s*=\s*(.+?)\s*$/);
        if (match) {
            keyValuePairs.push({ key: match[1], value: match[2] });
        }
    }
    return wrapMinimal('text', {
        totalLines,
        nonEmptyLines,
        commentLines,
        blankLines,
        words,
        chars,
        hasKeyValuePairs: keyValuePairs.length > 0,
        keyValuePairs: keyValuePairs.length > 0 ? keyValuePairs : undefined,
        averageLineLength: totalLines > 0 ? Math.round(chars / totalLines) : 0
    });
}
//# sourceMappingURL=text.js.map