unpdf 1.4.0 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (81) hide show
  1. package/README.md +22 -38
  2. package/dist/index.d.cts +1 -1
  3. package/dist/index.d.mts +1 -1
  4. package/dist/index.d.ts +1 -1
  5. package/dist/pdfjs.mjs +107 -1
  6. package/dist/types/src/display/annotation_layer.d.ts +14 -11
  7. package/dist/types/src/display/annotation_storage.d.ts +8 -8
  8. package/dist/types/src/display/api.d.ts +81 -57
  9. package/dist/types/src/display/api_utils.d.ts +1 -1
  10. package/dist/types/src/display/binary_data_factory.d.ts +26 -0
  11. package/dist/types/src/display/canvas.d.ts +19 -16
  12. package/dist/types/src/display/canvas_dependency_tracker.d.ts +66 -10
  13. package/dist/types/src/display/canvas_factory.d.ts +3 -1
  14. package/dist/types/src/display/display_utils.d.ts +4 -3
  15. package/dist/types/src/display/draw_layer.d.ts +2 -6
  16. package/dist/types/src/display/editor/alt_text.d.ts +1 -1
  17. package/dist/types/src/display/editor/annotation_editor_layer.d.ts +7 -12
  18. package/dist/types/src/display/editor/color_picker.d.ts +2 -2
  19. package/dist/types/src/display/editor/comment.d.ts +12 -0
  20. package/dist/types/src/display/editor/draw.d.ts +3 -7
  21. package/dist/types/src/display/editor/drawers/freedraw.d.ts +3 -3
  22. package/dist/types/src/display/editor/drawers/signaturedraw.d.ts +13 -13
  23. package/dist/types/src/display/editor/editor.d.ts +16 -13
  24. package/dist/types/src/display/editor/freetext.d.ts +2 -2
  25. package/dist/types/src/display/editor/highlight.d.ts +3 -3
  26. package/dist/types/src/display/editor/toolbar.d.ts +2 -2
  27. package/dist/types/src/display/editor/tools.d.ts +37 -1
  28. package/dist/types/src/display/fetch_stream.d.ts +3 -56
  29. package/dist/types/src/display/font_loader.d.ts +2 -1
  30. package/dist/types/src/display/network.d.ts +14 -80
  31. package/dist/types/src/display/network_stream.d.ts +2 -0
  32. package/dist/types/src/display/network_utils.d.ts +3 -3
  33. package/dist/types/src/display/node_stream.d.ts +2 -52
  34. package/dist/types/src/display/node_utils.d.ts +5 -19
  35. package/dist/types/src/{shared/obj-bin-transform.d.ts → display/obj_bin_transform_display.d.ts} +21 -18
  36. package/dist/types/src/display/pages_mapper.d.ts +72 -0
  37. package/dist/types/src/display/pattern_helper.d.ts +7 -2
  38. package/dist/types/src/display/text_layer.d.ts +16 -10
  39. package/dist/types/src/display/text_layer_images.d.ts +10 -0
  40. package/dist/types/src/display/transport_stream.d.ts +8 -64
  41. package/dist/types/src/display/webgpu_mesh.d.ts +3 -0
  42. package/dist/types/src/display/worker_options.d.ts +2 -2
  43. package/dist/types/src/display/xfa_layer.d.ts +3 -3
  44. package/dist/types/src/pdf.d.ts +5 -1
  45. package/dist/types/src/{interfaces.d.ts → shared/base_pdf_stream.d.ts} +26 -27
  46. package/dist/types/src/shared/obj_bin_transform_utils.d.ts +26 -0
  47. package/dist/types/src/shared/util.d.ts +14 -5
  48. package/dist/types/web/annotation_editor_layer_builder.d.ts +7 -8
  49. package/dist/types/web/annotation_layer_builder.d.ts +9 -9
  50. package/dist/types/web/app_options.d.ts +1 -1
  51. package/dist/types/web/autolinker.d.ts +3 -2
  52. package/dist/types/web/base_download_manager.d.ts +24 -0
  53. package/dist/types/web/base_pdf_page_view.d.ts +5 -5
  54. package/dist/types/web/comment_manager.d.ts +2 -2
  55. package/dist/types/web/download_manager.d.ts +3 -12
  56. package/dist/types/web/draw_layer_builder.d.ts +0 -12
  57. package/dist/types/web/genericl10n.d.ts +6 -10
  58. package/dist/types/web/l10n.d.ts +3 -6
  59. package/dist/types/web/menu.d.ts +11 -0
  60. package/dist/types/web/pdf_find_controller.d.ts +9 -11
  61. package/dist/types/web/pdf_history.d.ts +3 -3
  62. package/dist/types/web/pdf_link_service.d.ts +2 -7
  63. package/dist/types/web/pdf_page_detail_view.d.ts +1 -7
  64. package/dist/types/web/pdf_page_view.d.ts +17 -11
  65. package/dist/types/web/pdf_rendering_queue.d.ts +10 -14
  66. package/dist/types/web/pdf_thumbnail_view.d.ts +18 -42
  67. package/dist/types/web/pdf_thumbnail_viewer.d.ts +57 -13
  68. package/dist/types/web/pdf_viewer.component.d.ts +1 -1
  69. package/dist/types/web/pdf_viewer.d.ts +30 -27
  70. package/dist/types/web/renderable_view.d.ts +33 -0
  71. package/dist/types/web/sidebar.d.ts +65 -0
  72. package/dist/types/web/struct_tree_layer_builder.d.ts +1 -1
  73. package/dist/types/web/text_accessibility.d.ts +1 -1
  74. package/dist/types/web/text_layer_builder.d.ts +11 -6
  75. package/dist/types/web/ui_utils.d.ts +3 -11
  76. package/dist/types/web/xfa_layer_builder.d.ts +4 -4
  77. package/package.json +22 -17
  78. package/dist/types/src/display/cmap_reader_factory.d.ts +0 -25
  79. package/dist/types/src/display/standard_fontdata_factory.d.ts +0 -20
  80. package/dist/types/src/display/wasm_factory.d.ts +0 -20
  81. package/dist/types/web/interfaces.d.ts +0 -174
@@ -1,6 +1,51 @@
1
1
  export type SimpleDependency = "lineWidth" | "lineCap" | "lineJoin" | "miterLimit" | "dash" | "strokeAlpha" | "fillColor" | "fillAlpha" | "globalCompositeOperation" | "path" | "filter" | "font" | "fontObj";
2
2
  export type IncrementalDependency = "transform" | "moveText" | "sameLineText";
3
3
  export type InternalIncrementalDependency = IncrementalDependency | typeof FORCED_DEPENDENCY_LABEL;
4
+ export class CanvasBBoxTracker {
5
+ constructor(canvas: any, operationsCount: any);
6
+ _pendingBBoxIdx: number;
7
+ _savesStack: any[];
8
+ _markedContentStack: any[];
9
+ growOperationsCount(operationsCount: any): void;
10
+ get clipBox(): number[];
11
+ save(opIdx: any): this;
12
+ restore(opIdx: any, onSavePopped: any): this;
13
+ /**
14
+ * @param {number} idx
15
+ */
16
+ recordOpenMarker(idx: number): this;
17
+ getOpenMarker(): any;
18
+ recordCloseMarker(opIdx: any, onSavePopped: any): this;
19
+ beginMarkedContent(opIdx: any): this;
20
+ endMarkedContent(opIdx: any, onSavePopped: any): this;
21
+ pushBaseTransform(ctx: any): this;
22
+ popBaseTransform(): this;
23
+ resetBBox(idx: any): this;
24
+ recordClipBox(idx: any, ctx: any, minX: any, maxX: any, minY: any, maxY: any): this;
25
+ recordBBox(idx: any, ctx: any, minX: any, maxX: any, minY: any, maxY: any): this;
26
+ recordFullPageBBox(idx: any): this;
27
+ /**
28
+ * @param {number} idx
29
+ */
30
+ recordOperation(idx: number, preserve: boolean | undefined, dependencyLists: any): this;
31
+ bboxToClipBoxDropOperation(idx: any): this;
32
+ take(): BBoxReader;
33
+ takeDebugMetadata(): void;
34
+ recordSimpleData(name: any, idx: any): this;
35
+ recordIncrementalData(name: any, idx: any): this;
36
+ resetIncrementalData(name: any, idx: any): this;
37
+ recordNamedData(name: any, idx: any): this;
38
+ recordSimpleDataFromNamed(name: any, depName: any, fallbackIdx: any): this;
39
+ recordFutureForcedDependency(name: any, idx: any): this;
40
+ inheritSimpleDataAsFutureForcedDependencies(names: any): this;
41
+ inheritPendingDependenciesAsFutureForcedDependencies(): this;
42
+ recordCharacterBBox(idx: any, ctx: any, font: any, scale: number | undefined, x: number | undefined, y: number | undefined, getMeasure: any): this;
43
+ getSimpleIndex(dependencyName: any): undefined;
44
+ recordDependencies(idx: any, dependencyNames: any): this;
45
+ recordNamedDependency(idx: any, name: any): this;
46
+ recordShowTextOperation(idx: any, preserve?: boolean): this;
47
+ #private;
48
+ }
4
49
  /**
5
50
  * @typedef {"lineWidth" | "lineCap" | "lineJoin" | "miterLimit" | "dash" |
6
51
  * "strokeAlpha" | "fillColor" | "fillAlpha" | "globalCompositeOperation" |
@@ -14,17 +59,18 @@ export type InternalIncrementalDependency = IncrementalDependency | typeof FORCE
14
59
  * typeof FORCED_DEPENDENCY_LABEL} InternalIncrementalDependency
15
60
  */
16
61
  export class CanvasDependencyTracker {
17
- constructor(canvas: any, operationsCount: any, recordDebugMetadata?: boolean);
62
+ constructor(bboxTracker: any, recordDebugMetadata?: boolean);
63
+ get clipBox(): any;
18
64
  growOperationsCount(operationsCount: any): void;
19
65
  save(opIdx: any): this;
20
66
  restore(opIdx: any): this;
21
- /**
22
- * @param {number} idx
23
- */
24
- recordOpenMarker(idx: number): this;
67
+ recordOpenMarker(opIdx: any): this;
25
68
  getOpenMarker(): any;
26
69
  recordCloseMarker(opIdx: any): this;
27
- beginMarkedContent(opIdx: any): this;
70
+ /**
71
+ * @param {number} opIdx
72
+ */
73
+ beginMarkedContent(opIdx: number): this;
28
74
  endMarkedContent(opIdx: any): this;
29
75
  pushBaseTransform(ctx: any): this;
30
76
  popBaseTransform(): this;
@@ -67,13 +113,22 @@ export class CanvasDependencyTracker {
67
113
  recordOperation(idx: number, preserve?: boolean): this;
68
114
  recordShowTextOperation(idx: any, preserve?: boolean): this;
69
115
  bboxToClipBoxDropOperation(idx: any, preserve?: boolean): this;
70
- _takePendingDependencies(): Set<any>;
71
- _extractOperation(idx: any): any;
72
- _pushPendingDependencies(dependencies: any): void;
73
- take(): BBoxReader;
116
+ take(): any;
74
117
  takeDebugMetadata(): Map<any, any> | undefined;
75
118
  #private;
76
119
  }
120
+ /**
121
+ * Track the locations of images in the canvas. For each image it computes
122
+ * a bounding box as a potentially rotated rectangle, matching the rotation of
123
+ * the current canvas transform.
124
+ */
125
+ export class CanvasImagesTracker {
126
+ static "__#private@#CoordsArray": Float32ArrayConstructor | Float16ArrayConstructor;
127
+ constructor(canvas: any);
128
+ record(ctx: any, width: any, height: any, clipBox: any): void;
129
+ take(): Float32Array<ArrayBuffer> | Float16Array<ArrayBuffer>;
130
+ #private;
131
+ }
77
132
  /**
78
133
  * Used to track dependencies of nested operations list, that
79
134
  * should actually all map to the index of the operation that
@@ -83,6 +138,7 @@ export class CanvasDependencyTracker {
83
138
  */
84
139
  export class CanvasNestedDependencyTracker implements CanvasDependencyTracker {
85
140
  constructor(dependencyTracker: any, opIdx: any, ignoreBBoxes: any);
141
+ get clipBox(): any;
86
142
  growOperationsCount(): void;
87
143
  save(opIdx: any): this;
88
144
  restore(opIdx: any): this;
@@ -6,7 +6,9 @@ export class BaseCanvasFactory {
6
6
  canvas: void;
7
7
  context: any;
8
8
  };
9
- reset(canvasAndContext: any, width: any, height: any): void;
9
+ reset({ canvas }: {
10
+ canvas: any;
11
+ }, width: any, height: any): void;
10
12
  destroy(canvasAndContext: any): void;
11
13
  /**
12
14
  * @ignore
@@ -59,7 +59,7 @@ export type PageViewportCloneParameters = {
59
59
  */
60
60
  dontFlip?: boolean | undefined;
61
61
  };
62
- export function applyOpacity(r: any, g: any, b: any, opacity: any): any[];
62
+ export function applyOpacity(color: any, opacity: any): any;
63
63
  export class ColorScheme {
64
64
  static get isDarkMode(): any;
65
65
  }
@@ -106,6 +106,7 @@ export function getXfaPageViewport(xfaPage: any, { scale, rotation }: {
106
106
  export function isDataScheme(url: any): boolean;
107
107
  export function isPdfFile(filename: any): boolean;
108
108
  export function isValidFetchUrl(url: any, baseUrl: any): boolean;
109
+ export function makePathFromDrawOPS(data: any): Path2D;
109
110
  /**
110
111
  * Event handler to suppress context menu.
111
112
  */
@@ -225,7 +226,7 @@ export class PageViewport {
225
226
  convertToPdfPoint(x: number, y: number): any[];
226
227
  }
227
228
  export class PDFDateString {
228
- static #regex: any;
229
+ static "__#private@#regex": any;
229
230
  /**
230
231
  * Convert a PDF date string to a JavaScript `Date` object.
231
232
  *
@@ -268,11 +269,11 @@ export function renderRichText({ html, dir, className }: {
268
269
  */
269
270
  export function setLayerDimensions(div: HTMLDivElement, viewport: PageViewport, mustFlip?: boolean, mustRotate?: boolean): void;
270
271
  export class StatTimer {
271
- started: any;
272
272
  times: any[];
273
273
  time(name: any): void;
274
274
  timeEnd(name: any): void;
275
275
  toString(): string;
276
+ #private;
276
277
  }
277
278
  export function stopEvent(e: any): void;
278
279
  export const SupportedImageMimeTypes: string[];
@@ -4,13 +4,9 @@
4
4
  * be able to use mix-blend-mode for some of them.
5
5
  */
6
6
  export class DrawLayer {
7
- static #id: number;
7
+ static "__#private@#id": number;
8
8
  static get _svgFactory(): any;
9
- static #setBox(element: any, [x, y, width, height]: [any, any, any, any]): void;
10
- constructor({ pageIndex }: {
11
- pageIndex: any;
12
- });
13
- pageIndex: any;
9
+ static "__#private@#setBox"(element: any, [x, y, width, height]: [any, any, any, any]): void;
14
10
  setParent(parent: any): void;
15
11
  draw(properties: any, isPathUpdatable?: boolean, hasClip?: boolean): {
16
12
  id: number;
@@ -1,5 +1,5 @@
1
1
  export class AltText {
2
- static #l10nNewButton: null;
2
+ static "__#private@#l10nNewButton": null;
3
3
  static _l10n: null;
4
4
  static initialize(l10n: any): void;
5
5
  constructor(editor: any);
@@ -1,10 +1,10 @@
1
1
  export type AnnotationEditorUIManager = import("./tools.js").AnnotationEditorUIManager;
2
2
  export type PageViewport = import("../display_utils.js").PageViewport;
3
3
  export type TextAccessibilityManager = import("../../../web/text_accessibility.js").TextAccessibilityManager;
4
- export type IL10n = import("../../../web/interfaces").IL10n;
5
4
  export type AnnotationLayer = import("../annotation_layer.js").AnnotationLayer;
6
5
  export type DrawLayer = import("../draw_layer.js").DrawLayer;
7
- export type StructTreeLayerBuilder = any;
6
+ export type StructTreeLayerBuilder = import("../../../web/struct_tree_layer_builder.js").StructTreeLayerBuilder;
7
+ export type L10n = import("../../../web/l10n.js").L10n;
8
8
  export type AnnotationEditorLayerOptions = {
9
9
  mode: Object;
10
10
  div: HTMLDivElement;
@@ -13,7 +13,7 @@ export type AnnotationEditorLayerOptions = {
13
13
  enabled: boolean;
14
14
  accessibilityManager?: import("../../../web/text_accessibility.js").TextAccessibilityManager | undefined;
15
15
  pageIndex: number;
16
- l10n: IL10n;
16
+ l10n: L10n;
17
17
  annotationLayer?: import("../annotation_layer.js").AnnotationLayer | undefined;
18
18
  textLayer?: HTMLDivElement | undefined;
19
19
  drawLayer: DrawLayer;
@@ -31,7 +31,7 @@ export type RenderEditorLayerOptions = {
31
31
  * @property {boolean} enabled
32
32
  * @property {TextAccessibilityManager} [accessibilityManager]
33
33
  * @property {number} pageIndex
34
- * @property {IL10n} l10n
34
+ * @property {L10n} l10n
35
35
  * @property {AnnotationLayer} [annotationLayer]
36
36
  * @property {HTMLDivElement} [textLayer]
37
37
  * @property {DrawLayer} drawLayer
@@ -46,7 +46,7 @@ export type RenderEditorLayerOptions = {
46
46
  */
47
47
  export class AnnotationEditorLayer {
48
48
  static _initialized: boolean;
49
- static #editorTypes: Map<number, typeof FreeTextEditor | typeof HighlightEditor | typeof InkEditor | typeof SignatureEditor | typeof StampEditor>;
49
+ static "__#private@#editorTypes": Map<number, typeof FreeTextEditor | typeof HighlightEditor | typeof InkEditor | typeof SignatureEditor | typeof StampEditor>;
50
50
  /**
51
51
  * @param {AnnotationEditorLayerOptions} options
52
52
  */
@@ -55,7 +55,7 @@ export class AnnotationEditorLayer {
55
55
  div: HTMLDivElement;
56
56
  viewport: import("../display_utils.js").PageViewport;
57
57
  drawLayer: import("../draw_layer.js").DrawLayer;
58
- _structTree: any;
58
+ _structTree: import("../../../web/struct_tree_layer_builder.js").StructTreeLayerBuilder;
59
59
  get isEmpty(): boolean;
60
60
  get isInvisible(): boolean;
61
61
  /**
@@ -132,11 +132,6 @@ export class AnnotationEditorLayer {
132
132
  */
133
133
  addUndoableEditor(editor: AnnotationEditor): void;
134
134
  getEditorByUID(uid: any): any;
135
- /**
136
- * Get an id for an editor.
137
- * @returns {string}
138
- */
139
- getNextId(): string;
140
135
  combinedSignal(ac: any): AbortSignal;
141
136
  canCreateNewEmptyEditor(): boolean | undefined;
142
137
  /**
@@ -210,7 +205,7 @@ export class AnnotationEditorLayer {
210
205
  * Render the main editor.
211
206
  * @param {RenderEditorLayerOptions} parameters
212
207
  */
213
- render({ viewport }: RenderEditorLayerOptions): void;
208
+ render({ viewport }: RenderEditorLayerOptions): Promise<void>;
214
209
  /**
215
210
  * Update the main editor.
216
211
  * @param {RenderEditorLayerOptions} parameters
@@ -4,7 +4,7 @@
4
4
  * to select a color for the annotation.
5
5
  */
6
6
  export class BasicColorPicker {
7
- static #l10nColor: null;
7
+ static "__#private@#l10nColor": null;
8
8
  constructor(editor: any);
9
9
  renderButton(): HTMLInputElement;
10
10
  update(value: any): void;
@@ -18,7 +18,7 @@ export class BasicColorPicker {
18
18
  * to select a color for the annotation.
19
19
  */
20
20
  export class ColorPicker {
21
- static #l10nColor: null;
21
+ static "__#private@#l10nColor": null;
22
22
  static get _keyboardManager(): any;
23
23
  constructor({ editor, uiManager }: {
24
24
  editor?: null | undefined;
@@ -40,6 +40,18 @@ export class Comment {
40
40
  date: null;
41
41
  deleted: boolean;
42
42
  };
43
+ /**
44
+ * Restore the comment data (used for undo).
45
+ * @param {Object} data - The comment data to restore.
46
+ * @param {string} data.text - The comment text.
47
+ * @param {string|null} data.richText - The rich text content.
48
+ * @param {Date|null} data.date - The original date.
49
+ */
50
+ restoreData({ text, richText, date }: {
51
+ text: string;
52
+ richText: string | null;
53
+ date: Date | null;
54
+ }): void;
43
55
  setInitialText(text: any, richText?: null): void;
44
56
  shown(): void;
45
57
  destroy(): void;
@@ -4,13 +4,9 @@
4
4
  export class DrawingEditor extends AnnotationEditor {
5
5
  static _currentDrawId: number;
6
6
  static _currentParent: null;
7
- static #currentDraw: null;
8
- static #currentDrawingAC: null;
9
- static #currentDrawingOptions: null;
10
- static #currentPointerId: number;
11
- static #currentPointerType: null;
12
- static #currentPointerIds: null;
13
- static #currentMoveTimestamp: number;
7
+ static "__#private@#currentDraw": null;
8
+ static "__#private@#currentDrawingAC": null;
9
+ static "__#private@#currentDrawingOptions": null;
14
10
  static _INNER_MARGIN: number;
15
11
  static _mergeSVGProperties(p1: any, p2: any): any;
16
12
  /**
@@ -12,9 +12,9 @@ export class FreeDrawOutline extends Outline {
12
12
  #private;
13
13
  }
14
14
  export class FreeDrawOutliner {
15
- static #MIN_DIST: number;
16
- static #MIN_DIFF: number;
17
- static #MIN: number;
15
+ static "__#private@#MIN_DIST": number;
16
+ static "__#private@#MIN_DIFF": number;
17
+ static "__#private@#MIN": number;
18
18
  constructor({ x, y }: {
19
19
  x: any;
20
20
  y: any;
@@ -2,29 +2,29 @@
2
2
  * Basic text editor in order to create a Signature annotation.
3
3
  */
4
4
  export class SignatureExtractor {
5
- static #PARAMETERS: {
5
+ static "__#private@#PARAMETERS": {
6
6
  maxDim: number;
7
7
  sigmaSFactor: number;
8
8
  sigmaR: number;
9
9
  kernelSize: number;
10
10
  };
11
- static #neighborIndexToId(i0: any, j0: any, i: any, j: any): any;
12
- static #neighborIdToIndex: Int32Array<ArrayBuffer>;
13
- static #clockwiseNonZero(buf: any, width: any, i0: any, j0: any, i: any, j: any, offset: any): number;
14
- static #counterClockwiseNonZero(buf: any, width: any, i0: any, j0: any, i: any, j: any, offset: any): number;
15
- static #findContours(buf: any, width: any, height: any, threshold: any): {
11
+ static "__#private@#neighborIndexToId"(i0: any, j0: any, i: any, j: any): any;
12
+ static "__#private@#neighborIdToIndex": Int32Array<ArrayBuffer>;
13
+ static "__#private@#clockwiseNonZero"(buf: any, width: any, i0: any, j0: any, i: any, j: any, offset: any): number;
14
+ static "__#private@#counterClockwiseNonZero"(buf: any, width: any, i0: any, j0: any, i: any, j: any, offset: any): number;
15
+ static "__#private@#findContours"(buf: any, width: any, height: any, threshold: any): {
16
16
  isHole: boolean;
17
17
  points: number[];
18
18
  id: number;
19
19
  parent: number;
20
20
  }[];
21
- static #douglasPeuckerHelper(points: any, start: any, end: any, output: any): void;
22
- static #douglasPeucker(points: any): any[] | null;
23
- static #bilateralFilter(buf: any, width: any, height: any, sigmaS: any, sigmaR: any, kernelSize: any): (Uint32Array<ArrayBuffer> | Uint8Array<any>)[];
24
- static #getHistogram(buf: any): Uint32Array<ArrayBuffer>;
25
- static #toUint8(buf: any): Uint8ClampedArray<ArrayBuffer>;
26
- static #guessThreshold(histogram: any): number;
27
- static #getGrayPixels(bitmap: any): any[];
21
+ static "__#private@#douglasPeuckerHelper"(points: any, start: any, end: any, output: any): void;
22
+ static "__#private@#douglasPeucker"(points: any): any[] | null;
23
+ static "__#private@#bilateralFilter"(buf: any, width: any, height: any, sigmaS: any, sigmaR: any, kernelSize: any): (Uint32Array<ArrayBuffer> | Uint8Array<any>)[];
24
+ static "__#private@#getHistogram"(buf: any): Uint32Array<ArrayBuffer>;
25
+ static "__#private@#toUint8"(buf: any): Uint8ClampedArray<ArrayBuffer>;
26
+ static "__#private@#guessThreshold"(histogram: any): number;
27
+ static "__#private@#getGrayPixels"(bitmap: any): any[];
28
28
  static extractContoursFromText(text: any, { fontFamily, fontStyle, fontWeight }: {
29
29
  fontFamily: any;
30
30
  fontStyle: any;
@@ -73,7 +73,7 @@ export class AnnotationEditor {
73
73
  * @param {AnnotationEditorLayer} parent
74
74
  */
75
75
  static paste(item: DataTransferItem, parent: AnnotationEditorLayer): void;
76
- static #rotatePoint(x: any, y: any, angle: any): any[];
76
+ static "__#private@#rotatePoint"(x: any, y: any, angle: any): any[];
77
77
  static _round(x: any): number;
78
78
  /**
79
79
  * Deserialize the editor.
@@ -111,6 +111,7 @@ export class AnnotationEditor {
111
111
  _structTreeParentId: any;
112
112
  creationDate: any;
113
113
  modificationDate: any;
114
+ canAddComment: boolean;
114
115
  rotation: number;
115
116
  pageRotation: number;
116
117
  pageDimensions: any[];
@@ -119,6 +120,7 @@ export class AnnotationEditor {
119
120
  y: number;
120
121
  isAttachedToDOM: boolean;
121
122
  deleted: boolean;
123
+ updatePageIndex(newPageIndex: any): void;
122
124
  get editorType(): any;
123
125
  get mode(): any;
124
126
  /**
@@ -287,26 +289,26 @@ export class AnnotationEditor {
287
289
  hasAltText(): boolean;
288
290
  hasAltTextData(): any;
289
291
  focusCommentButton(): void;
290
- addCommentButton(): Comment;
292
+ addCommentButton(): Comment | null;
291
293
  addStandaloneCommentButton(): void;
292
294
  removeStandaloneCommentButton(): void;
293
295
  hideStandaloneCommentButton(): void;
294
- set comment(text: {
295
- text: any;
296
- richText: any;
297
- date: any;
298
- deleted: any;
296
+ set comment(value: {
297
+ text: never;
298
+ richText: never;
299
+ date: never;
300
+ deleted: never;
299
301
  color: any;
300
302
  opacity: any;
301
- });
303
+ } | null);
302
304
  get comment(): {
303
- text: any;
304
- richText: any;
305
- date: any;
306
- deleted: any;
305
+ text: never;
306
+ richText: never;
307
+ date: never;
308
+ deleted: never;
307
309
  color: any;
308
310
  opacity: any;
309
- };
311
+ } | null;
310
312
  setCommentData({ comment, popupRef, richText }: {
311
313
  comment: any;
312
314
  popupRef: any;
@@ -490,6 +492,7 @@ export class AnnotationEditor {
490
492
  * Unselect this editor.
491
493
  */
492
494
  unselect(): void;
495
+ hideCommentPopup(): void;
493
496
  /**
494
497
  * Update some parameters which have been changed through the UI.
495
498
  * @param {number} type
@@ -16,8 +16,8 @@ export class FreeTextEditor extends AnnotationEditor {
16
16
  static updateDefaultParams(type: any, value: any): void;
17
17
  /** @inheritdoc */
18
18
  static get defaultPropertiesToUpdate(): any[][];
19
- static #getNodeContent(node: any): any;
20
- static #deserializeContent(content: any): any;
19
+ static "__#private@#getNodeContent"(node: any): any;
20
+ static "__#private@#deserializeContent"(content: any): any;
21
21
  /** @inheritdoc */
22
22
  static deserialize(data: any, parent: any, uiManager: any): Promise<AnnotationEditor | null>;
23
23
  constructor(params: any);
@@ -19,14 +19,14 @@ export class HighlightEditor extends AnnotationEditor {
19
19
  /** @inheritdoc */
20
20
  static updateDefaultParams(type: any, value: any): void;
21
21
  static get defaultPropertiesToUpdate(): (number | null)[][];
22
- static #rotateBbox([x, y, width, height]: [any, any, any, any], angle: any): any[];
22
+ static "__#private@#rotateBbox"([x, y, width, height]: [any, any, any, any], angle: any): any[];
23
23
  static startHighlighting(parent: any, isLTR: any, { target: textLayer, x, y }: {
24
24
  target: any;
25
25
  x: any;
26
26
  y: any;
27
27
  }): void;
28
- static #highlightMove(parent: any, event: any): void;
29
- static #endHighlight(parent: any, event: any): void;
28
+ static "__#private@#highlightMove"(parent: any, event: any): void;
29
+ static "__#private@#endHighlight"(parent: any, event: any): void;
30
30
  /** @inheritdoc */
31
31
  static deserialize(data: any, parent: any, uiManager: any): Promise<AnnotationEditor | null>;
32
32
  constructor(params: any);
@@ -1,6 +1,6 @@
1
1
  export class EditorToolbar {
2
- static #l10nRemove: null;
3
- static #pointerDown(e: any): void;
2
+ static "__#private@#l10nRemove": null;
3
+ static "__#private@#pointerDown"(e: any): void;
4
4
  constructor(editor: any);
5
5
  render(): HTMLDivElement;
6
6
  get div(): null;
@@ -47,6 +47,12 @@ export class AnnotationEditorUIManager {
47
47
  updateComment(editor: any): void;
48
48
  updatePopupColor(editor: any): void;
49
49
  removeComment(editor: any): void;
50
+ /**
51
+ * Delete a comment from an editor with undo support.
52
+ * @param {AnnotationEditor} editor - The editor whose comment to delete.
53
+ * @param {Object} savedData - The comment data to save for undo.
54
+ */
55
+ deleteComment(editor: AnnotationEditor, savedData: Object): void;
50
56
  toggleComment(editor: any, isSelected: any, visibility?: undefined): void;
51
57
  makeCommentColor(color: any, opacity: any): any;
52
58
  getCommentDialogElement(): any;
@@ -62,6 +68,7 @@ export class AnnotationEditorUIManager {
62
68
  onPageChanging({ pageNumber }: {
63
69
  pageNumber: any;
64
70
  }): void;
71
+ deletePage(id: any): void;
65
72
  focusMainContainer(): void;
66
73
  findParent(x: any, y: any): any;
67
74
  disableUserSelect(value?: boolean): void;
@@ -133,6 +140,11 @@ export class AnnotationEditorUIManager {
133
140
  onEditingAction({ name }: {
134
141
  name: any;
135
142
  }): void;
143
+ updatePageIndex(oldPageIndex: any, newPageIndex: any): void;
144
+ startUpdatePages(): void;
145
+ endUpdatePages(): void;
146
+ clonePage(pageIndex: any, newPageIndex: any): void;
147
+ findClonesForPage(layer: any): Promise<any[]>;
136
148
  /**
137
149
  * Set the editing state.
138
150
  * It can be useful to temporarily disable it when the user is editing a
@@ -163,6 +175,8 @@ export class AnnotationEditorUIManager {
163
175
  * Change the editor mode (None, FreeText, Ink, ...)
164
176
  * @param {number} mode
165
177
  * @param {string|null} editId
178
+ * @param {boolean} [isFromUser] - true if the mode change is due to a
179
+ * user action.
166
180
  * @param {boolean} [isFromKeyboard] - true if the mode change is due to a
167
181
  * keyboard action.
168
182
  * @param {boolean} [mustEnterInEditMode] - true if the editor must enter in
@@ -170,7 +184,7 @@ export class AnnotationEditorUIManager {
170
184
  * @param {boolean} [editComment] - true if the mode change is due to a
171
185
  * comment edit.
172
186
  */
173
- updateMode(mode: number, editId?: string | null, isFromKeyboard?: boolean, mustEnterInEditMode?: boolean, editComment?: boolean): Promise<void>;
187
+ updateMode(mode: number, editId?: string | null, isFromUser?: boolean, isFromKeyboard?: boolean, mustEnterInEditMode?: boolean, editComment?: boolean): Promise<void>;
174
188
  addNewEditorFromKeyboard(): void;
175
189
  /**
176
190
  * Update the toolbar if it's required to reflect the tool currently used.
@@ -421,6 +435,28 @@ export class CommandManager {
421
435
  destroy(): void;
422
436
  #private;
423
437
  }
438
+ /**
439
+ * Class to store current pointers used by the editor to be able to handle
440
+ * multiple pointers (e.g. two fingers, a pen, a mouse, ...).
441
+ */
442
+ export class CurrentPointers {
443
+ static "__#private@#pointerId": number;
444
+ static "__#private@#pointerIds": null;
445
+ static "__#private@#moveTimestamp": number;
446
+ static "__#private@#pointerType": null;
447
+ static initializeAndAddPointerId(pointerId: any): void;
448
+ static setPointer(pointerType: any, pointerId: any): void;
449
+ static setTimeStamp(timeStamp: any): void;
450
+ static isSamePointerId(pointerId: any): boolean;
451
+ static isSamePointerIdOrRemove(pointerId: any): boolean;
452
+ static isSamePointerType(pointerType: any): boolean;
453
+ static isInitializedAndDifferentPointerType(pointerType: any): boolean;
454
+ static isSameTimeStamp(timeStamp: any): boolean;
455
+ static isUsingMultiplePointers(): boolean;
456
+ static clearPointerType(): void;
457
+ static clearPointerIds(): void;
458
+ static clearTimeStamp(): void;
459
+ }
424
460
  /**
425
461
  * Class to handle the different keyboards shortcuts we can have on mac or
426
462
  * non-mac OSes.
@@ -1,60 +1,7 @@
1
- /** @implements {IPDFStream} */
2
- export class PDFFetchStream implements IPDFStream {
1
+ export function getArrayBuffer(val: any): ArrayBufferLike;
2
+ export class PDFFetchStream extends BasePDFStream {
3
3
  constructor(source: any);
4
4
  _responseOrigin: null;
5
- source: any;
6
- isHttp: boolean;
7
5
  headers: Headers;
8
- _fullRequestReader: PDFFetchStreamReader | null;
9
- _rangeRequestReaders: any[];
10
- get _progressiveDataLength(): number;
11
- getFullReader(): PDFFetchStreamReader;
12
- getRangeReader(begin: any, end: any): PDFFetchStreamRangeReader | null;
13
- cancelAllRequests(reason: any): void;
14
6
  }
15
- /** @implements {IPDFStreamReader} */
16
- declare class PDFFetchStreamReader implements IPDFStreamReader {
17
- constructor(stream: any);
18
- _stream: any;
19
- _reader: ReadableStreamDefaultReader<Uint8Array<ArrayBuffer>> | null;
20
- _loaded: number;
21
- _filename: string | null;
22
- _withCredentials: any;
23
- _contentLength: any;
24
- _headersCapability: any;
25
- _disableRange: any;
26
- _rangeChunkSize: any;
27
- _abortController: AbortController;
28
- _isStreamingSupported: boolean;
29
- _isRangeSupported: boolean;
30
- onProgress: any;
31
- get headersReady(): any;
32
- get filename(): string | null;
33
- get contentLength(): any;
34
- get isRangeSupported(): boolean;
35
- get isStreamingSupported(): boolean;
36
- read(): Promise<{
37
- value: any;
38
- done: boolean;
39
- }>;
40
- cancel(reason: any): void;
41
- }
42
- /** @implements {IPDFStreamRangeReader} */
43
- declare class PDFFetchStreamRangeReader implements IPDFStreamRangeReader {
44
- constructor(stream: any, begin: any, end: any);
45
- _stream: any;
46
- _reader: ReadableStreamDefaultReader<Uint8Array<ArrayBuffer>> | null;
47
- _loaded: number;
48
- _withCredentials: any;
49
- _readCapability: any;
50
- _isStreamingSupported: boolean;
51
- _abortController: AbortController;
52
- onProgress: any;
53
- get isStreamingSupported(): boolean;
54
- read(): Promise<{
55
- value: any;
56
- done: boolean;
57
- }>;
58
- cancel(reason: any): void;
59
- }
60
- export {};
7
+ import { BasePDFStream } from "../shared/base_pdf_stream.js";
@@ -1,5 +1,5 @@
1
1
  export class FontFaceObject {
2
- constructor(translatedData: any, inspectFont: null | undefined, extra: any, charProcOperatorList: any);
2
+ constructor(translatedData: any, inspectFont: null | undefined, charProcOperatorList: any, extra: any);
3
3
  compiledGlyphs: any;
4
4
  _inspectFont: any;
5
5
  charProcOperatorList: any;
@@ -8,6 +8,7 @@ export class FontFaceObject {
8
8
  getPathGenerator(objs: any, character: any): any;
9
9
  get black(): any;
10
10
  get bold(): any;
11
+ set disableFontFace(value: any);
11
12
  get disableFontFace(): any;
12
13
  get fontExtraProperties(): any;
13
14
  get isInvalidPDFjsFont(): any;