import { BorderSpec, BoxSpacing, CellBorders, ParagraphAttrs, ParagraphBorder, TableBorders, TableBorderValue } from '../../../../../../../layout-engine/contracts/src/index.js';
type BorderConversionUnit = 'px' | 'eighthPoints';
type BorderConversionOptions = {
    unit?: BorderConversionUnit;
    isRtl?: boolean;
};
/**
 * Convert an OOXML border size (stored in eighths of a point) to pixels.
 *
 * OOXML defines border size in eights of a point (ST_EighthPointMeasure),
 * so always convert using size/8 pt → px. This avoids misinterpreting small
 * values (e.g., size=4 means 0.5pt, not 4px).
 *
 * Clamps results to reasonable bounds to prevent edge cases.
 */
export declare const borderSizeToPx: (size?: number) => number | undefined;
/**
 * Converts an OOXML border specification to layout engine BorderSpec format.
 *
 * Border sizes emitted by the DOCX translator are already expressed in pixels,
 * so the pm-adapter simply clamps them to a safe range instead of converting
 * from eighths-of-a-point. Nil/none borders return a special BorderSpec with
 * style 'none' and width 0.
 *
 * @param ooxmlBorder - Raw OOXML border object with optional val, size, and color properties
 * @param options - Optional conversion options
 * @param options.unit - Unit of `size`. Defaults to `'px'` (clamps to a safe range).
 *   Use `'eighthPoints'` when callers haven't pre-converted from OOXML's ST_EighthPointMeasure.
 * @returns BorderSpec with style, width (in pixels), and color, or undefined if invalid
 *
 * @example
 * ```typescript
 * convertBorderSpec({ val: 'single', size: 4, color: 'FF0000' });
 * // { style: 'single', width: 4, color: '#FF0000' }
 *
 * convertBorderSpec({ val: 'nil' });
 * // { style: 'none', width: 0 }
 *
 * convertBorderSpec(null);
 * // undefined
 * ```
 */
export declare function convertBorderSpec(ooxmlBorder: unknown, options?: BorderConversionOptions): BorderSpec | undefined;
/**
 * Converts an OOXML border specification to table border value format.
 *
 * Similar to convertBorderSpec but returns TableBorderValue which includes
 * a `none` flag for nil/none borders instead of returning a style enum.
 *
 * @param ooxmlBorder - Raw OOXML border object with optional val, size, and color properties
 * @param options - Optional conversion options
 * @param options.unit - Unit of `size`. Defaults to `'px'` (clamps to a safe range).
 *   Use `'eighthPoints'` when callers haven't pre-converted from OOXML's ST_EighthPointMeasure.
 * @returns TableBorderValue with style, width, and color, or { none: true } for nil borders, or undefined if invalid
 *
 * @example
 * ```typescript
 * convertTableBorderValue({ val: 'single', size: 4, color: 'FF0000' });
 * // { style: 'single', width: 4, color: '#FF0000' }
 *
 * convertTableBorderValue({ val: 'nil' });
 * // { none: true }
 * ```
 */
export declare function convertTableBorderValue(ooxmlBorder: unknown, options?: BorderConversionOptions): TableBorderValue | undefined;
/**
 * Extracts and normalizes table border definitions.
 *
 * Accepts either:
 * - A normalized border object (TableBorders-like)
 * - A raw OOXML-like border object where each side may contain { size, val, ... }
 *
 * @param bordersInput - Record of border definitions for sides (top, left, right, etc.)
 * @param options - Optional conversion options forwarded to convertTableBorderValue
 * @param options.unit - Unit of border `size`. Defaults to `'px'`.
 *   Use `'eighthPoints'` when sides carry raw OOXML ST_EighthPointMeasure values.
 * @returns TableBorders | undefined
 */
export declare function extractTableBorders(bordersInput: Record<string, unknown> | undefined, options?: BorderConversionOptions): TableBorders | undefined;
/**
 * Extracts cell-level borders from ProseMirror table cell node attributes.
 *
 * Converts OOXML border specifications from the cell's `borders` attribute
 * to layout engine BorderSpec format. Only processes the four standard box sides.
 *
 * @param cellAttrs - ProseMirror table cell node attributes object
 * @returns CellBorders object with BorderSpec for each side (top, right, bottom, left), or undefined if no borders
 *
 * Sizes on `cellAttrs.borders` are expected to be already in pixels - the DOCX
 * translator converts from eighth-points before pm-adapter sees them.
 *
 * @example
 * ```typescript
 * extractCellBorders({
 *   borders: {
 *     top: { val: 'single', size: 8, color: '000000' },
 *     bottom: { val: 'double', size: 16 }
 *   }
 * });
 * // { top: { style: 'single', width: 8, color: '#000000' }, bottom: { style: 'double', width: 16, color: '#000000' } }
 * ```
 */
type CellBorderExtractionOptions = {
    isRtl?: boolean;
};
export declare function extractCellBorders(cellAttrs: Record<string, unknown>, _options?: CellBorderExtractionOptions): CellBorders | undefined;
/**
 * Extracts cell padding from ProseMirror table cell node attributes.
 *
 * Cell margins in OOXML are converted to padding in the layout engine.
 * Values are assumed to already be converted to pixels from their original
 * OOXML twips format.
 *
 * @param cellAttrs - ProseMirror table cell node attributes object
 * @returns BoxSpacing object with padding values for each side, or undefined if no padding
 *
 * @example
 * ```typescript
 * extractCellPadding({
 *   cellMargins: { top: 8, left: 12, right: 12, bottom: 8 }
 * });
 * // { top: 8, left: 12, right: 12, bottom: 8 }
 * ```
 */
type CellPaddingExtractionOptions = {
    isRtl?: boolean;
};
export declare function extractCellPadding(cellAttrs: Record<string, unknown>, _options?: CellPaddingExtractionOptions): BoxSpacing | undefined;
/**
 * Normalizes paragraph borders from raw OOXML attributes.
 *
 * Processes border specifications for all four sides (top, right, bottom, left)
 * and converts them to the layout engine's paragraph border format.
 *
 * @param value - Raw OOXML borders object with properties for each side
 * @returns Normalized paragraph borders object, or undefined if no valid borders
 *
 * @example
 * ```typescript
 * normalizeParagraphBorders({
 *   top: { val: 'single', size: 12, color: '000000', space: 1 },
 *   bottom: { val: 'double', size: 24 }
 * });
 * // { top: { style: 'solid', width: 2, color: '#000000', space: 1 }, bottom: { style: 'double', width: 4, ... } }
 * ```
 */
export declare const normalizeParagraphBorders: (value: unknown) => ParagraphAttrs["borders"] | undefined;
/**
 * Normalizes a single border side specification from OOXML format.
 *
 * Extracts and converts border properties including style, width (in pixels),
 * color, and spacing. Negative values for width and space are clamped to zero.
 *
 * @param value - Raw OOXML border specification for a single side
 * @returns ParagraphBorder with normalized properties, or undefined if no valid border properties or if style is 'none'
 *
 * @example
 * ```typescript
 * normalizeBorderSide({ val: 'single', size: 12, color: 'FF0000', space: 2 });
 * // { style: 'solid', width: 2, color: '#FF0000', space: 2 }
 *
 * normalizeBorderSide({ val: 'nil' });
 * // undefined
 * ```
 */
export declare const normalizeBorderSide: (value: unknown) => ParagraphBorder | undefined;
/**
 * Maps OOXML border style values to paragraph border style format.
 *
 * Converts OOXML border style strings (case-insensitive) to normalized
 * paragraph border styles. Unknown styles default to 'solid'.
 *
 * @param value - OOXML border style string (e.g., 'single', 'double', 'dashed')
 * @returns Normalized border style ('solid', 'double', 'dashed', 'dotted', 'none'), or undefined if not a string
 *
 * @example
 * ```typescript
 * mapBorderStyle('single'); // 'solid'
 * mapBorderStyle('DOUBLE'); // 'double'
 * mapBorderStyle('dashSmallGap'); // 'dashed'
 * mapBorderStyle('nil'); // 'none'
 * mapBorderStyle('unknown'); // 'solid' (default)
 * ```
 */
export declare const mapBorderStyle: (value: unknown) => ParagraphBorder["style"];
/**
 * Normalizes paragraph shading from raw OOXML attributes.
 *
 * Extracts and normalizes shading properties including fill color, foreground color,
 * pattern value, and theme-related properties. Auto colors are filtered out.
 *
 * @param value - Raw OOXML shading object with properties like fill, color, val, themeColor, etc.
 * @returns Normalized paragraph shading object with valid properties, or undefined if no valid shading
 *
 * @example
 * ```typescript
 * normalizeParagraphShading({
 *   fill: 'FFFF00',
 *   color: '000000',
 *   val: 'clear'
 * });
 * // { fill: '#FFFF00', color: '#000000', val: 'clear' }
 *
 * normalizeParagraphShading({ fill: 'auto' });
 * // undefined (auto colors are filtered)
 * ```
 */
export declare const normalizeParagraphShading: (value: unknown) => ParagraphAttrs["shading"] | undefined;
/**
 * Normalizes shading color values, filtering out 'auto' colors.
 *
 * Applies color normalization (adding # prefix) and removes auto colors
 * which should not be rendered. Case-insensitive auto detection.
 *
 * @param value - Raw color value (string with or without # prefix, or 'auto')
 * @returns Normalized color with # prefix, or undefined if auto or invalid
 *
 * @example
 * ```typescript
 * normalizeShadingColor('FF0000'); // '#FF0000'
 * normalizeShadingColor('#00FF00'); // '#00FF00'
 * normalizeShadingColor('auto'); // undefined
 * normalizeShadingColor('AUTO'); // undefined
 * ```
 */
export declare const normalizeShadingColor: (value: unknown) => string | undefined;
export {};
//# sourceMappingURL=borders.d.ts.map