import { TableBlock, TableMeasure, TableFragment, TableRowMeasure } from '../../contracts/src/index.js';
import { PageState } from './paginator.js';
/**
 * Ratio of column width (0..1). An anchored table with totalWidth >= columnWidth * this value
 * is treated as full-width and laid out inline instead of as a floating fragment.
 */
export declare const ANCHORED_TABLE_FULL_WIDTH_RATIO = 0.99;
export type TableLayoutContext = {
    block: TableBlock;
    measure: TableMeasure;
    columnWidth: number;
    ensurePage: () => PageState;
    advanceColumn: (state: PageState) => PageState;
    columnX: (columnIndex: number) => number;
};
export declare function resolveRenderedTableWidth(columnWidth: number, measuredWidth: number, attrs: TableBlock['attrs']): number;
/**
 * Resolve the table fragment frame within a column based on justification.
 *
 * When justification is center or right/end, the table is aligned within the
 * column width and tableIndent is ignored. Otherwise, tableIndent offsets the
 * table from the left margin and clamps width only when needed to avoid overflow.
 *
 * @param baseX - Left edge of the column in pixels
 * @param columnWidth - Available column width in pixels
 * @param tableWidth - Measured table width in pixels
 * @param attrs - Table attributes
 * @returns Resolved x and width for the table fragment
 */
export declare function resolveTableFrame(baseX: number, columnWidth: number, tableWidth: number, attrs: TableBlock['attrs']): {
    x: number;
    width: number;
};
/**
 * Get the line segments for a single embedded table row.
 *
 * If any cell in the row contains nested tables, recursively expand using
 * the tallest cell's segments. This enables the layout engine to split at
 * sub-row boundaries even for deeply nested tables (table-in-table-in-table).
 * Otherwise, return the row as a single segment with its measured height.
 */
export declare function getEmbeddedRowLines(row: TableRowMeasure): Array<{
    lineHeight: number;
}>;
export declare function getCellLines(cell: TableRowMeasure['cells'][number]): Array<{
    lineHeight: number;
}>;
/**
 * Layout a table block with row-boundary and mid-row splitting.
 *
 * Implements MS Word-compatible table splitting:
 * - Breaks tables at row boundaries when exceeding page height
 * - Splits rows mid-content when cantSplit is false (default)
 * - Respects cantSplit attribute (prevents row from splitting)
 * - Repeats header rows on continuation fragments
 * - Handles floating tables (tblpPr) with monolithic layout
 * - Tracks partial row continuations across pages
 *
 * Algorithm:
 * 1. Detect floating tables → delegate to monolithic layout
 * 2. Count header rows
 * 3. Loop through rows, finding split points
 * 4. When a partial row split occurs, track it for continuation
 * 5. Create fragments with proper fromRow/toRow/repeatHeaderCount/partialRow
 * 6. Advance cursor by actual fragment height (not total table height)
 *
 * @param context - Table layout context

 */
export declare function layoutTableBlock({ block, measure, columnWidth, ensurePage, advanceColumn, columnX, }: TableLayoutContext): void;
/**
 * Create a table fragment for an anchored/floating table at its computed position.
 * Called by the layout engine after the float manager computes the table's position.
 */
export declare function createAnchoredTableFragment(block: TableBlock, measure: TableMeasure, x: number, y: number): TableFragment;
//# sourceMappingURL=layout-table.d.ts.map