import { PDFDocumentProxy } from 'pdfjs-dist'; import { EventBus, PDFViewer } from 'pdfjs-dist/legacy/web/pdf_viewer.mjs'; import { PointerEventHandler, PureComponent, RefObject } from 'react'; import { Root } from 'react-dom/client'; import { IHighlight, LTWH, LTWHP, Position, Scaled, ScaledPosition } from '../types'; export type T_ViewportHighlight = { position: Position; } & T_HT; interface State { ghostHighlight: { position: ScaledPosition; content?: { text?: string; image?: string; }; } | null; isCollapsed: boolean; range: Range | null; tip: { highlight: T_ViewportHighlight; callback: (highlight: T_ViewportHighlight) => JSX.Element; } | null; tipPosition: Position | null; tipChildren: JSX.Element | null; isAreaSelectionInProgress: boolean; scrolledToHighlightId: string; } interface Props { highlightTransform: (highlight: T_ViewportHighlight, index: number, setTip: (highlight: T_ViewportHighlight, callback: (highlight: T_ViewportHighlight) => JSX.Element) => void, hideTip: () => void, viewportToScaled: (rect: LTWHP) => Scaled, screenshot: (position: LTWH) => string, isScrolledTo: boolean) => JSX.Element; highlights: Array; onScrollChange: () => void; scrollRef: (scrollTo: (highlight: T_HT) => void) => void; pdfDocument: PDFDocumentProxy; pdfScaleValue: string; onSelectionFinished: (position: ScaledPosition, content: { text?: string; image?: string; }, hideTipAndSelection: () => void, transformSelection: () => void) => JSX.Element | null; enableAreaSelection: (event: MouseEvent) => boolean; } export declare class PdfHighlighter extends PureComponent, State> { static defaultProps: { pdfScaleValue: string; }; state: State; viewer: PDFViewer; resizeObserver: ResizeObserver | null; containerNode?: HTMLDivElement | null; containerNodeRef: RefObject; highlightRoots: { [page: number]: { reactRoot: Root; container: Element; }; }; unsubscribe: () => void; constructor(props: Props); componentDidMount(): void; attachRef: (eventBus: EventBus) => void; componentDidUpdate(prevProps: Props): void; init(): Promise; componentWillUnmount(): void; findOrCreateHighlightLayer(page: number): Element | null; groupHighlightsByPage(highlights: Array): { [pageNumber: string]: Array; }; showTip(highlight: T_ViewportHighlight, content: JSX.Element): void; scaledPositionToViewport({ pageNumber, boundingRect, rects, usePdfCoordinates, }: ScaledPosition): Position; viewportPositionToScaled({ pageNumber, boundingRect, rects, }: Position): ScaledPosition; screenshot(position: LTWH, pageNumber: number): string; hideTipAndSelection: () => void; setTip(position: Position, inner: JSX.Element | null): void; renderTip: () => import("react/jsx-runtime").JSX.Element | null; onTextLayerRendered: () => void; scrollTo: (highlight: T_HT) => void; onDocumentReady: () => void; onSelectionChange: () => void; onScroll: () => void; onMouseDown: PointerEventHandler; handleKeyDown: (event: KeyboardEvent) => void; afterSelection: () => void; debouncedAfterSelection: () => void; toggleTextSelection(flag: boolean): void; handleScaleValue: () => void; debouncedScaleValue: () => void; render(): import("react/jsx-runtime").JSX.Element; private renderHighlightLayers; private renderHighlightLayer; } export {};