/**
 * Utility functions for manipulating highlights.
 */
import type { DOMHighlight, DOMHighlightSet, SerializedHighlight, DOMRange } from "./types";
/**
 * Given a list of DOMHighlights, return a new list that also includes the
 * given DOMRange as a new DOMHighlight. If the DOMHighlight intersects
 * existing DOMHighlights, the other Highlights are removed and their ranges
 * are merged into the new DOMHighlight.
 */
export declare function addHighlight(existingHighlights: DOMHighlightSet, newHighlight: DOMHighlight): DOMHighlightSet;
/**
 * Given a DOMRange and a list of word ranges, build a corresponding
 * DOMHighlight.
 *
 * If the DOMRange is not a valid highlight given the word ranges, return null.
 */
export declare function buildHighlight(existingHighlights: DOMHighlightSet, wordRanges: ReadonlyArray<DOMRange>, newHighlightRange: DOMRange): DOMHighlight | null | undefined;
/**
 * Given a SerializedHightlight and the current set of word ranges, return a
 * DOMHighlight representing the SerializedHighlight.
 *
 * If the SerializedHighlight is not valid given the list of word ranges, throw
 * an error.
 */
export declare function deserializeHighlight(serializedHighlight: SerializedHighlight, wordRanges: ReadonlyArray<DOMRange>): DOMHighlight;
/**
 * Return a SerializedHighlight representing the given DOMHighlight.
 */
export declare function serializeHighlight(highlight: DOMHighlight): SerializedHighlight;
