import { Line, ParagraphBlock, ParagraphMeasure, LinePmRange } from '../../contracts/src/index.js';
/**
 * Tracks which paragraph spacing properties were explicitly set.
 *
 * Used to distinguish between explicit spacing values and those inherited
 * from docDefaults/styles. This affects empty paragraph rendering because
 * Word suppresses inherited spacing on empty paragraphs but honors explicit spacing.
 */
export type SpacingExplicit = {
    /** Whether 'before' spacing was explicitly set */
    before?: boolean;
    /** Whether 'after' spacing was explicitly set */
    after?: boolean;
    /** Whether 'line' spacing was explicitly set */
    line?: boolean;
};
/**
 * Checks if a paragraph block is an empty text paragraph.
 *
 * An empty text paragraph is defined as:
 * - No runs at all, OR
 * - Exactly one text run with an empty string
 *
 * This is used to determine if special empty paragraph handling
 * should apply (e.g., suppressing inherited spacing).
 *
 * @param block - The paragraph block to check
 * @returns True if the paragraph is empty text
 *
 * @example
 * ```typescript
 * isEmptyTextParagraph({ kind: 'paragraph', runs: [] }); // true
 * isEmptyTextParagraph({ kind: 'paragraph', runs: [{ text: '' }] }); // true
 * isEmptyTextParagraph({ kind: 'paragraph', runs: [{ text: 'Hi' }] }); // false
 * isEmptyTextParagraph({ kind: 'paragraph', runs: [{ kind: 'image', src: '...' }] }); // false
 * ```
 */
export declare const isEmptyTextParagraph: (block: ParagraphBlock) => boolean;
/**
 * Determines if spacing should be suppressed for an empty paragraph.
 *
 * In Microsoft Word, empty paragraphs only show spacing if it was explicitly
 * set on the paragraph. Spacing inherited from docDefaults or styles is
 * suppressed for empty paragraphs.
 *
 * @param block - The paragraph block to check
 * @param side - Which spacing side to check ('before' or 'after')
 * @returns True if spacing should be suppressed (paragraph is empty and spacing is not explicit)
 *
 * @example
 * ```typescript
 * // Empty paragraph with inherited spacing - suppress
 * shouldSuppressSpacingForEmpty(emptyBlock, 'before'); // true
 *
 * // Empty paragraph with explicit spacing - don't suppress
 * shouldSuppressSpacingForEmpty(emptyBlockWithExplicit, 'before'); // false
 *
 * // Non-empty paragraph - don't suppress
 * shouldSuppressSpacingForEmpty(nonEmptyBlock, 'before'); // false
 * ```
 */
export declare const shouldSuppressSpacingForEmpty: (block: ParagraphBlock, side: "before" | "after") => boolean;
export declare function normalizeLines(measure: ParagraphMeasure): ParagraphMeasure['lines'];
export declare function sliceLines(lines: ParagraphMeasure['lines'], startIndex: number, availableHeight: number): {
    toLine: number;
    height: number;
};
export type { LinePmRange };
export declare const computeFragmentPmRange: (block: ParagraphBlock, lines: ParagraphMeasure["lines"], fromLine: number, toLine: number) => LinePmRange;
export declare const computeLinePmRange: (block: ParagraphBlock, line: Line) => LinePmRange;
/**
 * Per-paragraph contextual spacing (OOXML w:contextualSpacing).
 *
 * A paragraph suppresses its own before/after spacing when it has
 * contextualSpacing enabled and the adjacent paragraph shares the same styleId.
 * The adjacent paragraph's contextualSpacing flag is NOT consulted — each
 * paragraph independently decides whether to suppress its own spacing.
 *
 * @see https://learn.microsoft.com/en-us/dotnet/api/documentformat.openxml.wordprocessing.contextualspacing
 */
export declare function shouldSuppressOwnSpacing(ownStyleId: string | undefined, ownContextualSpacing: boolean, adjacentStyleId: string | undefined): boolean;
export declare const extractBlockPmRange: (block: {
    attrs?: Record<string, unknown>;
} | null | undefined) => LinePmRange;
//# sourceMappingURL=layout-utils.d.ts.map