import { ColumnLayout, FlowBlock, HeaderFooterLayout, Layout, Measure, ParagraphBlock, ParagraphMeasure, SectionMetadata, FlowMode, DocumentBackground } from '../../contracts/src/index.js';
type PageSize = {
    w: number;
    h: number;
};
type Margins = {
    top: number;
    right: number;
    bottom: number;
    left: number;
    header?: number;
    footer?: number;
};
/**
 * Synthetic page height used in semantic flow mode to avoid pagination-driven clipping
 * during measurement. A large finite value preserves stable measurement constraints.
 */
export declare const SEMANTIC_PAGE_HEIGHT_PX = 1000000;
export type LayoutOptions = {
    pageSize?: PageSize;
    margins?: Margins;
    documentBackground?: DocumentBackground;
    columns?: ColumnLayout;
    flowMode?: FlowMode;
    semantic?: {
        contentWidth?: number;
        marginLeft?: number;
        marginRight?: number;
        marginTop?: number;
        marginBottom?: number;
    };
    remeasureParagraph?: (block: ParagraphBlock, maxWidth: number, firstLineIndent?: number) => ParagraphMeasure;
    sectionMetadata?: SectionMetadata[];
    /**
     * Extra bottom margin per page index (0-based) reserved for non-body content
     * rendered at the bottom of the page (e.g., footnotes).
     *
     * When provided, the paginator will shrink the body content area on that page by
     * increasing the effective bottom margin for that page only.
     */
    footnoteReservedByPageIndex?: number[];
    /**
     * Footnote metadata. The core layout engine consumes only the fields below
     * (SD-3049: ref positions + per-footnote body heights for block-aware breaks).
     * Higher-level orchestration (layout-bridge) attaches additional fields
     * (`blocksById`, separator dimensions, etc.) which the engine ignores.
     */
    footnotes?: {
        refs?: Array<{
            id: string;
            pos: number;
        }>;
        /**
         * SD-3049: total measured body height per footnote id (sum of measured
         * paragraph heights + per-paragraph spacingAfter + inter-footnote gap +
         * separator overhead). Used by the body paginator to consult footnote
         * demand at fragment-commit time so body packs tight to the demand.
         */
        bodyHeightById?: Map<string, number>;
        /**
         * SD-2656: per-footnote first valid line/run height. The ordered-cluster
         * rule (Word-style) requires only the LAST anchor on a page to fit its
         * first line; all earlier anchors must fit fully (bodyHeightById). When
         * present, the body slicer uses this value for the last anchor in the
         * candidate cluster, otherwise falls back to bodyHeightById.
         */
        firstLineHeightById?: Map<string, number>;
        [key: string]: unknown;
    };
    /**
     * Actual measured header content heights per variant type.
     * When provided, the layout engine will ensure body content starts below
     * the header content, preventing overlap when headers exceed their allocated margin space.
     *
     * Keys correspond to header variant types: 'default', 'first', 'even', 'odd'
     * Values are the actual content heights in pixels.
     */
    headerContentHeights?: Partial<Record<'default' | 'first' | 'even' | 'odd', number>>;
    /**
     * Actual measured footer content heights per variant type.
     * When provided, the layout engine will ensure body content ends above
     * the footer content, preventing overlap when footers exceed their allocated margin space.
     *
     * Keys correspond to footer variant types: 'default', 'first', 'even', 'odd'
     * Values are the actual content heights in pixels.
     */
    footerContentHeights?: Partial<Record<'default' | 'first' | 'even' | 'odd', number>>;
    /**
     * Actual measured header content heights per relationship ID.
     * Used for multi-section documents where each section may have unique
     * headers/footers referenced by their relationship IDs.
     *
     * Keys are relationship IDs (e.g., 'rId6', 'rId7')
     * Values are the actual content heights in pixels.
     */
    headerContentHeightsByRId?: Map<string, number>;
    /**
     * Actual measured header content heights per section-specific reference.
     *
     * Keys combine the relationship ID and section index using the form
     * `${rId}::s${sectionIndex}` so the reserve path can distinguish documents
     * that reuse the same header part across sections with different geometry.
     */
    headerContentHeightsBySectionRef?: Map<string, number>;
    /**
     * Actual measured footer content heights per relationship ID.
     * Used for multi-section documents where each section may have unique
     * footers referenced by their relationship IDs.
     *
     * Keys are relationship IDs (e.g., 'rId8', 'rId9')
     * Values are the actual content heights in pixels.
     */
    footerContentHeightsByRId?: Map<string, number>;
    /**
     * Actual measured footer content heights per section-specific reference.
     *
     * Keys combine the relationship ID and section index using the form
     * `${rId}::s${sectionIndex}` so the reserve path can distinguish documents
     * that reuse the same footer part across sections with different geometry.
     */
    footerContentHeightsBySectionRef?: Map<string, number>;
    /**
     * Allow body layout to synthesize page 1 for anchored tables when a document has
     * no anchor paragraphs and would otherwise render zero pages.
     *
     * Header/footer layout keeps this disabled to avoid changing long-standing
     * overlay behavior in paragraph-free header/footer regions.
     */
    allowParagraphlessAnchoredTableFallback?: boolean;
    /**
     * Allow body layout to synthesize page 1 when section metadata exists but no
     * renderable body blocks survive conversion.
     *
     * Header/footer layout keeps this disabled to preserve existing empty-region
     * behavior for paragraph-free overlays.
     */
    allowSectionBreakOnlyPageFallback?: boolean;
    /**
     * Whether the document has odd/even header/footer differentiation enabled.
     * Corresponds to the w:evenAndOddHeaders element in OOXML settings.xml.
     * When true, odd pages use the 'odd' variant and even pages use the 'even' variant.
     * When false or omitted, all pages use the 'default' variant.
     *
     * Must stay in sync with `getHeaderFooterTypeForSection` in
     * `layout-bridge/src/headerFooterUtils.ts` — both sides read this value
     * and must agree on variant selection.
     */
    alternateHeaders?: boolean;
};
export type HeaderFooterConstraints = {
    width: number;
    /** Body content height used as the measurement canvas (pagination boundary). */
    height: number;
    /** Actual page width for page-relative anchor positioning. */
    pageWidth?: number;
    /** Physical page height for vertical page-relative anchor conversion. */
    pageHeight?: number;
    /**
     * Page margins for anchor positioning.
     * `left`/`right`: horizontal page-relative conversion.
     * `top`/`bottom`: vertical margin-relative conversion and fallback footer band origin.
     * `header`: header distance from page top edge (header band origin).
     * `footer`: footer distance from page bottom edge (footer band origin).
     */
    margins?: {
        left: number;
        right: number;
        top?: number;
        bottom?: number;
        header?: number;
        footer?: number;
    };
    /**
     * Optional base height used to bound behindDoc overflow handling.
     * When provided, decorative assets far outside the header/footer band
     * won't inflate layout height.
     */
    overflowBaseHeight?: number;
};
/**
 * Layout FlowBlocks into paginated fragments using measured line data.
 *
 * The function is intentionally deterministic: it walks the provided
 * FlowBlocks in order, consumes their Measure objects (same index),
 * and greedily stacks fragments inside the content box of each page/column.
 */
export declare function layoutDocument(blocks: FlowBlock[], measures: Measure[], options?: LayoutOptions): Layout;
/**
 * Lays out header or footer content within specified dimensional constraints.
 *
 * Positions blocks within a header/footer region, handling page-relative anchor
 * transformations and computing the actual height required by visible content.
 *
 * When `kind` and `constraints.pageHeight` are provided, page-relative and
 * margin-relative anchored drawings are post-normalized from the synthetic
 * measurement canvas to header/footer-local coordinates.
 *
 * Returns separate measurement bounds (for pagination) and render bounds
 * (for overlay shift). See the Coordinate Contract in the fix plan for details.
 */
export declare function layoutHeaderFooter(blocks: FlowBlock[], measures: Measure[], constraints: HeaderFooterConstraints, kind?: 'header' | 'footer'): HeaderFooterLayout;
export { buildAnchorMap, resolvePageRefTokens, getTocBlocksForRemeasurement } from './resolvePageRefs.js';
export { buildChapterContextByPage, computeDisplayPageNumber, formatPageNumber, formatPageNumberFieldValue, formatSectionPageNumberText, normalizeChapterMarkerText, } from './pageNumbering.js';
export type { ChapterPageInfo, DisplayPageInfo, PageNumberFormat } from './pageNumbering.js';
export { resolvePageNumberTokens } from './resolvePageTokens.js';
export type { NumberingContext, ResolvePageTokensResult } from './resolvePageTokens.js';
export { getCellLines, getEmbeddedRowLines, resolveTableFrame, resolveRenderedTableWidth } from './layout-table.js';
export { describeCellRenderBlocks, computeCellSliceContentHeight } from './table-cell-slice.js';
export { SINGLE_COLUMN_DEFAULT } from './section-breaks.js';
//# sourceMappingURL=index.d.ts.map