// Pure helpers for the printed document. No DOM; tested in Node. // build.js strips `export` when bundling. // What to print for a field. Secrets are either shown or withheld; an empty // secret is always "(not set)" so a blank is never mistaken for a hidden value. export function displayValue(field, includeSecrets) { if (field.secret) { if (!field.value) return '(not set)'; return includeSecrets ? field.value : '[withheld]'; } return field.value || '(blank)'; } export function footerText(doc) { return `${doc.meta.title || 'Final Wishes'} — Last update: ${doc.meta.lastUpdated}`; } export function countSecrets(doc) { let n = 0; for (const s of doc.sections) { for (const r of s.records || []) for (const f of r.fields) if (f.secret && f.value) n++; } return n; }