/** * Shared utilities for the fill stage of all pipelines (template, fieldSelector, external). */ import type { VerifyResult } from './field-selector/types.js'; /** * Visible placeholder rendered for fields the user hasn't filled yet. * Makes it obvious what still needs attention in the output document. */ export declare const BLANK_PLACEHOLDER = "_______"; /** * Scan a DOCX template buffer for fields that have a literal `$` immediately * before the `{field_name}` tag. Returns the set of field names. * * Works by parsing OOXML text parts and concatenating `` elements per * paragraph, then matching `$` + `{field_name}` patterns. Handles cross-run * splits because text is concatenated at the paragraph level. */ export declare function detectCurrencyFields(docxBuffer: Buffer): Set; /** * Strip leading `$` from user values where the DOCX template already has * a literal `$` before the `{field_name}` tag. Prevents double-dollar * output like `$$1,000,000`. * * This is the DOCX-aware version that works for all pipelines — it scans * the template buffer directly instead of requiring a replacements map. */ export declare function sanitizeCurrencyValuesFromDocx(values: Record, docxBuffer: Buffer): Record; /** * A doubled percent sign (`%%` or `% %`) in rendered output — the artifact left * when a sign-carrying value lands in a placeholder whose source already * supplies the `%`. The trailing-sigil twin of the `doubleDollarPattern`. * * Shared with the fieldSelector verifier so both entry points flag the same * shape. Not global: every caller only asks whether a line matches. */ export declare const DOUBLE_PERCENT_PATTERN: RegExp; /** * Scan a DOCX template buffer for fields whose `{field_name}` tag is * immediately followed by a literal `%` — the trailing-sigil mirror of * {@link detectCurrencyFields}. * * A field is reported only when **every** occurrence of its tag carries the * adjacent `%`. That asymmetry with the currency detector is deliberate and * is the whole reason this is not a literal mirror: recipes disagree about * which side of the seam owns the sign (`nvca-rofr-co-sale-agreement` maps the * key `"[specify percentage]%"`, absorbing the source `%`, while the * certificate of incorporation and stock purchase agreement map * `"[specify percentage]"` and leave it in place), so one field can plausibly * land in a document with the sign on some occurrences and not others. When * the occurrences disagree there is no value that renders correctly * everywhere, so we strip nothing and let the `%%` artifact surface loudly in * the verifier rather than silently dropping the sign from the occurrence that * needed it. * * Works by parsing OOXML text parts and concatenating `` elements per * paragraph, so a tag split across runs is still seen whole. */ export declare function detectPercentFields(docxBuffer: Buffer): Set; /** * Strip a trailing `%` from user values where the DOCX template already has a * literal `%` after the `{field_name}` tag. Prevents double-percent output * like `60%%`. * * The mirror of {@link sanitizeCurrencyValuesFromDocx} is not literal: `$` is a * leading sigil and `%` a trailing one, so this strips from the end, and it * also absorbs any horizontal whitespace the user typed before the sign, a * non-breaking or figure space included: "60%", "60 %", and a value with a * U+00A0 before the sign all become "60". A value that is nothing but a * percent sign is left alone rather than blanked. */ export declare function sanitizePercentValuesFromDocx(values: Record, docxBuffer: Buffer): Record; /** * Verify a filled template DOCX output. * Runs a subset of checks that are safe for templates: * - No double dollar signs (catches currency sanitization failures) * - No double percent signs (catches percentage sanitization failures) * - No unrendered {template_tags} (catches fill failures) * * Does NOT check: leftover brackets (templates don't use them), * context values present (templates use {IF} conditionals that hide values), * drafting notes (stripped by fillDocx). Footnote text is read for the * sigil-doubling checks only — the unrendered-tag check keeps body/header/ * footer/endnote scope, where a leftover footnote tag may be legitimate. */ export declare function verifyTemplateFill(outputPath: string): VerifyResult; //# sourceMappingURL=fill-utils.d.ts.map