import { MutationStep, TextRewriteStep, TextInsertStep, TextDeleteStep, StyleApplyStep, PlanReceipt, StepOutcome, MutationsApplyInput } from '../../../../../../document-api/src/index.js';
import { Editor } from '../../core/Editor.js';
import { CompiledPlan } from './compiler.js';
import { CompiledTarget, CompiledRangeTarget, CompiledSpanTarget } from './executor-registry.types.js';
import { Node as ProseMirrorNode } from 'prosemirror-model';
import { Transaction } from 'prosemirror-state';
import { Mapping } from 'prosemirror-transform';
/**
 * Maps a character offset (within the text content of a range) to the
 * corresponding ProseMirror document position.  Needed because inline
 * node boundaries (run open/close) create gaps in the position space
 * that `textBetween` hides.
 *
 * Must mirror `textBetweenWithTabs`'s character accounting exactly — the diff
 * loop above computes prefix/suffix offsets against that string, then asks
 * this function to translate them back into PM positions. Any disagreement
 * (e.g. an atom that contributed a char on one side but not the other) maps
 * the edit to the wrong place. We count:
 *   - text nodes by char length (the obvious case),
 *   - `tab` nodes as 1 char (textBetweenWithTabs emits '\t'),
 *   - inline leaves declaring `leafText` by `leafText(node).length`
 *     (e.g. noBreakHyphen → '‑', length 1).
 * Everything else contributes 0 — matching the executor's call site, which
 * passes `leafFallback=''` so unknown leaves don't widen `originalText`.
 *
 * Atoms cannot be sliced mid-glyph, so when an offset lands strictly past an
 * atom's first char we resolve to the position immediately after the atom.
 */
export declare function charOffsetToDocPos(doc: ProseMirrorNode, rangeFrom: number, rangeTo: number, charOffset: number): number;
export declare function executeTextRewrite(editor: Editor, tr: Transaction, target: CompiledRangeTarget, step: TextRewriteStep, mapping: Mapping): {
    changed: boolean;
};
export declare function executeTextInsert(editor: Editor, tr: Transaction, target: CompiledRangeTarget, step: TextInsertStep, mapping: Mapping): {
    changed: boolean;
};
export declare function executeTextDelete(_editor: Editor, tr: Transaction, target: CompiledRangeTarget, _step: TextDeleteStep, mapping: Mapping): {
    changed: boolean;
};
export declare function executeStyleApply(editor: Editor, tr: Transaction, target: CompiledRangeTarget, step: StyleApplyStep, mapping: Mapping): {
    changed: boolean;
};
export declare function executeSpanTextRewrite(editor: Editor, tr: Transaction, target: CompiledSpanTarget, step: TextRewriteStep, mapping: Mapping): {
    changed: boolean;
};
export declare function executeSpanTextDelete(_editor: Editor, tr: Transaction, target: CompiledSpanTarget, step: TextDeleteStep, mapping: Mapping): {
    changed: boolean;
};
export declare function executeSpanStyleApply(editor: Editor, tr: Transaction, target: CompiledSpanTarget, step: StyleApplyStep, mapping: Mapping): {
    changed: boolean;
};
export declare function executeCreateStep(editor: Editor, tr: Transaction, step: MutationStep, targets: CompiledTarget[], mapping: Mapping): StepOutcome;
export declare function runMutationsOnTransaction(editor: Editor, tr: Transaction, compiled: CompiledPlan, options: {
    throwOnAssertFailure: boolean;
    changeMode?: 'direct' | 'tracked';
    isPreview?: boolean;
}): {
    stepOutcomes: StepOutcome[];
    assertFailures: Array<{
        stepId: string;
        expectedCount: number;
        actualCount: number;
    }>;
    commandDispatched: boolean;
};
export interface ExecuteCompiledOptions {
    changeMode?: 'direct' | 'tracked';
    expectedRevision?: string;
}
export declare function executeCompiledPlan(editor: Editor, compiled: CompiledPlan, options?: ExecuteCompiledOptions): PlanReceipt;
export declare function executePlan(editor: Editor, input: MutationsApplyInput): PlanReceipt;
//# sourceMappingURL=executor.d.ts.map