import { QuestionnaireState } from '../types/QuestionnaireState'; import { DescriptorState } from './types'; /** * Submit-time safety net: drop values for fields whose descriptors say they * should be hidden in the current state. A field that disappears from the UI * (because the user changed a prior answer) can still hold a stale value in * state; this filter prevents that value from leaving in the wire payload. * * A stateKey is kept when *any* descriptor sharing that slot is both supported * and visible — variants targeting the same slot (e.g. `accountHolderNameDps` * vs `accountHolderNameWForm`) share storage, so the slot survives if any * variant claims it. Keys with no descriptor pass through unchanged. * * Runs a bounded stabilizing loop: when a non-self-sufficient predicate reads * a value that this pass just cleared, the next pass sees the cleared state * and can drop the dependent. Bounded by field count because clearing is * monotonic — a cleared field stays cleared, and clearing only reduces what * can be visible. */ export declare const filterHiddenFields: (state: DescriptorState) => QuestionnaireState;