/** Text in Stücke zerlegen, Links erkennen – ohne v-html */ export function linkify(text) { const parts = []; const pattern = /(https?:\/\/[^\s<>"']+[^\s<>"'.,;:!?)\]])/g; let last = 0; for (const match of (text ?? '').matchAll(pattern)) { if (match.index > last) parts.push({ text: text.slice(last, match.index) }); parts.push({ text: match[0], href: match[0] }); last = match.index + match[0].length; } if (last < (text ?? '').length) parts.push({ text: text.slice(last) }); return parts; } export function fileSize(bytes) { if (bytes < 1024 * 1024) return `${Math.max(1, Math.round(bytes / 1024))} KB`; return `${(bytes / 1024 / 1024).toFixed(1).replace('.', ',')} MB`; }