xwt
2025-07-04 b76e716ff4656191d73eba398e9eb39ee975e13b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
export type EventBus = import("./event_utils").EventBus;
export type PDFFindController = import("./pdf_find_controller").PDFFindController;
export type TextHighlighterOptions = {
    findController: PDFFindController;
    /**
     * - The application event bus.
     */
    eventBus: EventBus;
    /**
     * - The page index.
     */
    pageIndex: number;
};
/** @typedef {import("./event_utils").EventBus} EventBus */
/** @typedef {import("./pdf_find_controller").PDFFindController} PDFFindController */
/**
 * @typedef {Object} TextHighlighterOptions
 * @property {PDFFindController} findController
 * @property {EventBus} eventBus - The application event bus.
 * @property {number} pageIndex - The page index.
 */
/**
 * TextHighlighter handles highlighting matches from the FindController in
 * either the text layer or XFA layer depending on the type of document.
 */
export class TextHighlighter {
    /**
     * @param {TextHighlighterOptions} options
     */
    constructor({ findController, eventBus, pageIndex }: TextHighlighterOptions);
    findController: import("./pdf_find_controller").PDFFindController;
    matches: any[];
    eventBus: import("./event_utils").EventBus;
    pageIdx: number;
    textDivs: Node[] | null;
    textContentItemsStr: string[] | null;
    enabled: boolean;
    /**
     * Store two arrays that will map DOM nodes to text they should contain.
     * The arrays should be of equal length and the array element at each index
     * should correspond to the other. e.g.
     * `items[0] = "<span>Item 0</span>" and texts[0] = "Item 0";
     *
     * @param {Array<Node>} divs
     * @param {Array<string>} texts
     */
    setTextMapping(divs: Array<Node>, texts: Array<string>): void;
    /**
     * Start listening for events to update the highlighter and check if there are
     * any current matches that need be highlighted.
     */
    enable(): void;
    disable(): void;
    _convertMatches(matches: any, matchesLength: any): {
        begin: {
            divIdx: number;
            offset: number;
        };
    }[];
    _renderMatches(matches: any): void;
    _updateMatches(reset?: boolean): void;
    #private;
}