import { TrackedChangesMode, SectionMetadata, FlowBlock, TrackedChangeMeta } from '../../../../../../layout-engine/contracts/src/index.js';
import { StyleContext as StyleEngineContext, ComputedParagraphStyle } from '../../../../../../layout-engine/style-engine/src/index.js';
import { SectionRange } from './sections/index.js';
import { ConverterContext } from './converter-context.js';
import { paragraphToFlowBlocks } from './converters/paragraph.js';
import { tableNodeToBlock } from './converters/table.js';
import { contentBlockNodeToDrawingBlock } from './converters/content-block.js';
import { imageNodeToBlock } from './converters/image.js';
import { shapeContainerNodeToDrawingBlock, shapeGroupNodeToDrawingBlock, shapeTextboxNodeToDrawingBlock, vectorShapeNodeToDrawingBlock } from './converters/shapes.js';
import { chartNodeToDrawingBlock } from './converters/chart.js';
export type { ConverterContext } from './converter-context.js';
export type StyleContext = StyleEngineContext;
export type { ComputedParagraphStyle };
export type ThemeColorPalette = Record<string, string>;
/**
 * ProseMirror node shape (simplified interface for what we need)
 */
export interface PMNode {
    type: string;
    attrs?: Record<string, unknown>;
    content?: PMNode[];
    text?: string;
    marks?: PMMark[];
}
/**
 * ProseMirror mark shape
 */
export interface PMMark {
    type: string;
    attrs?: Record<string, unknown>;
}
/**
 * Tracked changes configuration for rendering modes
 */
export type TrackedChangesConfig = {
    mode: TrackedChangesMode;
    enabled: boolean;
};
/**
 * Hyperlink configuration for link rendering
 */
export type HyperlinkConfig = {
    enableRichHyperlinks: boolean;
};
export type FlowRunLinkMetadata = {
    version?: 1 | 2;
    href?: string;
    title?: string;
    target?: '_blank' | '_self' | '_parent' | '_top';
    rel?: string;
    tooltip?: string;
    anchor?: string;
    docLocation?: string;
    rId?: string;
    name?: string;
    history?: boolean;
};
/**
 * Adapter options for customizing conversion behavior
 */
export interface AdapterOptions {
    /**
     * Default font family for text without explicit styling
     * @default "Arial"
     */
    defaultFont?: string;
    /**
     * Default font size in pixels for text without explicit styling
     * @default 16
     */
    defaultSize?: number;
    /**
     * Optional prefix applied to every generated BlockId (e.g., `header-default-`).
     * Useful when converting multiple documents that share the same position space.
     */
    blockIdPrefix?: string;
    /**
     * Story key for the document being converted. Used to stamp tracked-change
     * metadata so rendered DOM anchors can distinguish body, header/footer, and
     * note stories.
     */
    storyKey?: string;
    /**
     * Optional list of ProseMirror node type names that should be treated as atom/leaf nodes
     * for position mapping. Use this to keep PM positions correct when custom atom nodes exist.
     */
    atomNodeTypes?: Iterable<string>;
    /**
     * Optional precomputed position map keyed by the PM JSON nodes passed to toFlowBlocks.
     * When provided, this is used directly instead of building a new position map.
     */
    positions?: PositionMap;
    /**
     * Optional media files map for hydrating image blocks.
     * Key: normalized file path (e.g., "word/media/image1.jpeg")
     * Value: base64-encoded image data
     *
     * When provided, image blocks will have their `src` converted from file paths
     * to data URLs (e.g., "data:image/jpeg;base64,...")
     */
    mediaFiles?: Record<string, string>;
    /**
     * When true, emit a sectionBreak block after any paragraph that carries a sectPr
     * or normalized sectionMargins. Default: false (to avoid breaking existing pipelines
     * that don't yet handle section breaks).
     */
    emitSectionBreaks?: boolean;
    /**
     * When true, render visible gray `[` / `]` marker runs at bookmarkStart and
     * bookmarkEnd positions (SD-2454). Matches Word's opt-in "Show bookmarks"
     * behavior. Off by default because bookmarks are structural, not visual.
     */
    showBookmarks?: boolean;
    /**
     * Optional instrumentation hook for fidelity logging.
     */
    instrumentation?: AdapterInstrumentation;
    /**
     * Locale overrides (decimal separator, etc.).
     */
    locale?: {
        decimalSeparator?: string;
    };
    /**
     * Desired track-changes viewing mode for layout output.
     * When omitted, the adapter should assume `'review'`.
     */
    trackedChangesMode?: TrackedChangesMode;
    /**
     * Feature flag for propagating tracked-change metadata into FlowBlocks.
     * Disable when consumers are not ready to handle the additional payload.
     * Defaults to `true`.
     */
    enableTrackedChanges?: boolean;
    /**
     * Composed per-author tracked-change color resolver. When provided, the
     * adapter stamps `TrackedChangeMeta.color` for every tracked-change layer
     * from the author identity before paint. Build it from the host
     * `authorColors` config via `composeAuthorColorResolver`. Omit (or leave
     * `undefined`) to keep the default tracked-change palette.
     */
    resolveTrackedChangeColor?: import('../../../../../../layout-engine/contracts/src/index.js').TrackChangeAuthorColorResolver;
    /**
     * Feature flag for emitting rich hyperlink metadata (FlowRunLink v2 schema).
     * When false, the adapter outputs the legacy `{ href, title }` shape.
     * Defaults to `false`.
     */
    enableRichHyperlinks?: boolean;
    /**
     * Feature flag for propagating comment annotations into FlowBlocks.
     * When false, comment marks are ignored and no comment highlights appear.
     * Defaults to `true`.
     */
    enableComments?: boolean;
    /**
     * Theme color palette extracted from the DOCX `word/theme/theme1.xml` part.
     * Used to resolve `w:themeColor` marks when `w:val` is missing.
     */
    themeColors?: ThemeColorPalette;
    /**
     * Optional container for section metadata extracted during conversion.
     * When provided, the adapter will populate it with SectionMetadata entries
     * describing each section's header/footer refs & numbering.
     */
    sectionMetadata?: SectionMetadata[];
    /**
     * Optional snapshot of the converter's DOCX context (styles.xml, numbering).
     * When provided, the adapter can hydrate style-linked attributes so layout
     * renders match the original Word document more closely.
     */
    converterContext?: ConverterContext;
    /**
     * Optional FlowBlock cache for incremental conversion.
     * When provided, paragraph blocks are cached and reused when content hasn't changed.
     * This can significantly improve toFlowBlocks performance for large documents.
     *
     * The cache is managed externally (typically by PresentationEditor) and should
     * persist across render cycles. Call cache.clear() on document load or when
     * conversion settings change (tracked changes mode, comments enabled, etc.).
     */
    flowBlockCache?: import('./cache.js').FlowBlockCache;
}
/**
 * Section types re-exported from sections module
 */
export { SectionType, type SectPrElement, type SectPrChildElement, type ParagraphProperties, type SectPrLikeObject, } from './sections/index.js';
/**
 * Adapter feature snapshot for instrumentation
 */
export type AdapterFeatureSnapshot = {
    totalBlocks: number;
    blockCounts: Partial<Record<FlowBlock['kind'], number>>;
};
/**
 * Instrumentation callbacks for monitoring adapter behavior
 */
export interface AdapterInstrumentation {
    onBlocksConverted?: (snapshot: AdapterFeatureSnapshot) => void;
    log?: (payload: {
        totalBlocks: number;
        blockCounts: Partial<Record<FlowBlock['kind'], number>>;
        bookmarks: number;
    }) => void;
}
/**
 * Section range and signature re-exported from sections module
 */
export type { SectionRange, SectionSignature } from './sections/index.js';
/**
 * Block ID generator function
 */
export type BlockIdGenerator = (kind: string) => string;
/**
 * Position tracking for PM nodes
 */
export type Position = {
    start: number;
    end: number;
};
/**
 * Position map for tracking PM node positions
 */
export type PositionMap = WeakMap<PMNode, Position>;
/**
 * PM document map for batch processing
 */
export type PMDocumentMap = Record<string, PMNode | object | null | undefined>;
/**
 * Batch adapter options with additional factory
 */
export type BatchAdapterOptions = AdapterOptions & {
    /**
     * Factory for generating per-document block ID prefixes
     */
    blockIdPrefixFactory?: (docKey: string) => string;
};
/**
 * Flow blocks result with bookmark tracking.
 * Bookmarks map bookmark names to their PM positions for cross-reference resolution.
 */
export type FlowBlocksResult = {
    blocks: FlowBlock[];
    bookmarks: Map<string, number>;
};
/**
 * Context object passed to all node handlers containing shared state and utilities.
 */
export interface NodeHandlerContext {
    blocks: FlowBlock[];
    recordBlockKind?: (kind: FlowBlock['kind']) => void;
    nextBlockId: BlockIdGenerator;
    blockIdPrefix?: string;
    storyKey?: string;
    positions: PositionMap;
    defaultFont: string;
    defaultSize: number;
    converterContext: ConverterContext;
    trackedChangesConfig: TrackedChangesConfig;
    hyperlinkConfig: HyperlinkConfig;
    enableComments: boolean;
    bookmarks: Map<string, number>;
    sectionState?: {
        ranges: SectionRange[];
        currentSectionIndex: number;
        currentParagraphIndex: number;
        /**
         * Index of the current top-level `doc.content` child being dispatched.
         * Advanced by the main dispatch loop in internal.ts — drives end-tagged
         * section transitions for non-paragraph nodes (tables, top-level
         * drawings, …) per ECMA-376 §17.6.17.
         */
        currentNodeIndex: number;
    };
    converters: NestedConverters;
    themeColors?: ThemeColorPalette;
    flowBlockCache?: import('./cache.js').FlowBlockCache;
    trackedListMarkerOffsets?: Map<string, number>;
    trackedListLastOrdinals?: Map<string, number>;
}
/**
 * Handler function signature for processing a specific node type.
 * Handlers mutate the context (add blocks, update counters, etc.).
 */
export type NodeHandler = (node: PMNode, context: NodeHandlerContext) => void;
/**
 * List counter context for numbering
 */
export type ListCounterContext = {
    getListCounter: (numId: number, ilvl: number) => number;
    incrementListCounter: (numId: number, ilvl: number) => number;
    resetListCounter: (numId: number, ilvl: number) => void;
};
export type ParagraphToFlowBlocksParams = {
    para: PMNode;
    nextBlockId: BlockIdGenerator;
    positions: PositionMap;
    storyKey?: string;
    trackedChangesConfig: TrackedChangesConfig;
    hyperlinkConfig: HyperlinkConfig;
    themeColors?: ThemeColorPalette;
    bookmarks: Map<string, number>;
    converters: NestedConverters;
    enableComments: boolean;
    converterContext: ConverterContext;
    stableBlockId?: string;
    /** When set, used as default/marker font for list paragraphs that have no explicit run properties (e.g. new list item after Enter). */
    previousParagraphFont?: ParagraphFont;
};
export type TableNodeToBlockParams = {
    nextBlockId: BlockIdGenerator;
    positions: PositionMap;
    storyKey?: string;
    trackedChangesConfig: TrackedChangesConfig;
    bookmarks: Map<string, number>;
    hyperlinkConfig: HyperlinkConfig;
    themeColors?: ThemeColorPalette;
    converterContext: ConverterContext;
    converters: NestedConverters;
    enableComments: boolean;
};
export type ParagraphToFlowBlocksConverter = (para: PMNode, nextBlockId: BlockIdGenerator, positions: PositionMap, defaultFont: string, defaultSize: number, styleContext: StyleContext, listCounterContext?: ListCounterContext, trackedChanges?: TrackedChangesConfig, bookmarks?: Map<string, number>, hyperlinkConfig?: HyperlinkConfig, themeColors?: ThemeColorPalette, converterContext?: ConverterContext, enableComments?: boolean, stableBlockId?: string) => FlowBlock[];
export type ImageNodeToBlockConverter = (node: PMNode, nextBlockId: BlockIdGenerator, positions: PositionMap, trackedMeta?: TrackedChangeMeta, trackedChanges?: TrackedChangesConfig) => FlowBlock | null;
export type DrawingNodeToBlockConverter = (node: PMNode, nextBlockId: BlockIdGenerator, positions: PositionMap) => FlowBlock | null;
export type TableNodeToBlockOptions = {
    listCounterContext?: ListCounterContext;
    converters?: NestedConverters;
};
export type NestedConverters = {
    paragraphToFlowBlocks: typeof paragraphToFlowBlocks;
    tableNodeToBlock: typeof tableNodeToBlock;
    contentBlockNodeToDrawingBlock: typeof contentBlockNodeToDrawingBlock;
    imageNodeToBlock: typeof imageNodeToBlock;
    vectorShapeNodeToDrawingBlock: typeof vectorShapeNodeToDrawingBlock;
    shapeGroupNodeToDrawingBlock: typeof shapeGroupNodeToDrawingBlock;
    shapeContainerNodeToDrawingBlock: typeof shapeContainerNodeToDrawingBlock;
    shapeTextboxNodeToDrawingBlock: typeof shapeTextboxNodeToDrawingBlock;
    chartNodeToDrawingBlock: typeof chartNodeToDrawingBlock;
};
/**
 * OOXML border specification
 */
export interface OoxmlBorder {
    val?: string;
    size?: number;
    color?: string;
}
/**
 * Underline style type derived from TextRun contract
 */
export type UnderlineStyle = NonNullable<import('../../../../../../layout-engine/contracts/src/index.js').TextRun['underline']>['style'];
export type ParagraphFont = {
    fontFamily: string;
    fontSize: number;
};
//# sourceMappingURL=types.d.ts.map