import type { Element } from '@xmldom/xmldom'; import type { ReplacementValue } from './replacement-keys.js'; export interface PatchResult { outputPath: string; zeroMatchKeys: string[]; } /** * Patch a DOCX document by replacing bracketed placeholders with template tags. * Uses a char_map algorithm to handle cross-run replacements where Word splits * placeholder text across multiple XML run elements. * * Supports two key syntax types: * - Simple: "search text" → replaces all occurrences * - Context: "context > placeholder" → in tables, replaces placeholder in rows * where label matches; in paragraphs, replaces first placeholder after context * * Processing order: context keys first, simple keys last. * This ensures qualified rules claim their targets before simple rules sweep up the rest. */ export interface PatchOptions { /** Hex color (e.g. "000000") to apply to replacement text. When set, the * patcher explicitly sets on runs that receive replacement text, * overriding any inherited placeholder styling (e.g. gray). */ replacementColor?: string; } export declare function patchDocument(inputPath: string, outputPath: string, replacements: Record, options?: PatchOptions): Promise; /** * Get the text content of the first table cell (label cell) in the same row * as the paragraph. Returns null if the paragraph is not inside a table cell. */ export declare function getTableRowContext(para: Element): string | null; export declare function getRunText(run: Element): string; /** * Check if a run is safe to remove when its text is empty. * Returns true only if all element children are or . * Returns false if the run contains drawings, fields, breaks, or other non-text elements. */ export declare function isRunSafeToRemove(run: Element): boolean; //# sourceMappingURL=patcher.d.ts.map