/** * A tiny, JavaScript-free evaluator for the most common AcroForm field * calculation: Acrobat's built-in `AFSimple_Calculate`. The vendored * `pdfium.wasm` has no JS engine, so calculate actions (`/AA/C`) are read but * never run; this recomputes the common cases on the client instead. Arbitrary * custom field JavaScript is intentionally not supported. * */ /** Reduction operation of an `AFSimple_Calculate` action. */ export type FormCalcOp = 'SUM' | 'PRD' | 'AVG' | 'MIN' | 'MAX'; /** A parsed `AFSimple_Calculate(op, [fields])` calculation. */ export interface FormCalcSpec { readonly op: FormCalcOp; /** Fully-qualified names of the operand fields. */ readonly fields: readonly string[]; } /** * Parses a calculate-action JavaScript source into a {@link FormCalcSpec}, or * returns `null` when it is not a recognized `AFSimple_Calculate` call (custom * scripts are left untouched). * @param js - The js value (string or or undefined). * @returns The resulting FormCalcSpec or `null`. * */ export declare function parseCalcAction(js: string | null | undefined): FormCalcSpec | null; /** * Parses a form-field display value to a number, stripping thousands * separators, currency symbols and other non-numeric decoration. Returns `null` * for blank or unparseable values. * @param value - The value to use. * @returns The resulting number or `null`. * */ export declare function parseFieldNumber(value: string | null | undefined): number | null; /** * Evaluates a {@link FormCalcSpec} against the current field values. Blank or * unparseable operands are skipped (a `SUM` of no operands is `0`; the other * operations return `null` when there is nothing to combine, leaving the field * unchanged). Returns the computed value as a plain number string, or `null`. * @param spec - The spec value (FormCalcSpec). * @param values - The values to use. * @returns The resulting string or `null`. * */ export declare function evaluateCalc(spec: FormCalcSpec, values: ReadonlyMap): string | null; //# sourceMappingURL=form-calc.d.ts.map