@react-pdf-kit/viewer 2.0.0-beta.4 → 2.0.0-beta.6

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 (124) hide show
  1. package/dist/{ToolbarLayout.module-692ae41a.js → ToolbarLayout.module-b9afb430.js} +9 -8
  2. package/dist/assets/style.js +32 -31
  3. package/dist/components/RPConfig.js +1 -1
  4. package/dist/components/RPController.js +5 -5
  5. package/dist/components/RPDropFileZone.js +1 -1
  6. package/dist/components/RPPages.js +5 -5
  7. package/dist/components/RPProvider.js +5 -5
  8. package/dist/components/layout/LayoutContainer.js +5 -5
  9. package/dist/components/layout/RPDefaultLayout.js +5 -5
  10. package/dist/components/layout/RPLayout.js +5 -5
  11. package/dist/components/layout/WrapperLayout.js +1 -1
  12. package/dist/components/layout/sidebar/RPSidebar.js +5 -5
  13. package/dist/components/layout/sidebar/Thumbnail.js +5 -5
  14. package/dist/components/layout/sidebar/Thumbnails.js +5 -5
  15. package/dist/components/layout/toolbar/DarkModeTool.js +2 -2
  16. package/dist/components/layout/toolbar/DocumentDialog.js +5 -5
  17. package/dist/components/layout/toolbar/DocumentProperties.js +3 -3
  18. package/dist/components/layout/toolbar/FileDownloadTool.js +5 -5
  19. package/dist/components/layout/toolbar/FileUploadTool.js +4 -4
  20. package/dist/components/layout/toolbar/FullScreenTool.js +3 -3
  21. package/dist/components/layout/toolbar/MenuItem.js +3 -3
  22. package/dist/components/layout/toolbar/MenuSeparator.js +3 -3
  23. package/dist/components/layout/toolbar/MostPageTool.js +5 -5
  24. package/dist/components/layout/toolbar/OtherTool.js +5 -5
  25. package/dist/components/layout/toolbar/Paginate.js +5 -5
  26. package/dist/components/layout/toolbar/PrintTool.js +5 -5
  27. package/dist/components/layout/toolbar/RPMenuItem.js +3 -3
  28. package/dist/components/layout/toolbar/RPMoreOptions.js +5 -5
  29. package/dist/components/layout/toolbar/RPToolbar.js +5 -5
  30. package/dist/components/layout/toolbar/RPToolbarEnd.js +5 -5
  31. package/dist/components/layout/toolbar/RotateTool.js +4 -4
  32. package/dist/components/layout/toolbar/ScrollModeTool.js +3 -3
  33. package/dist/components/layout/toolbar/SearchCloseButton.js +2 -2
  34. package/dist/components/layout/toolbar/SearchResultNavigator.js +5 -5
  35. package/dist/components/layout/toolbar/SearchTool.js +5 -5
  36. package/dist/components/layout/toolbar/SelectionModeTool.js +3 -3
  37. package/dist/components/layout/toolbar/ThumbnailTool.js +5 -5
  38. package/dist/components/layout/toolbar/ToolbarCustom.js +5 -5
  39. package/dist/components/layout/toolbar/ToolbarDefault.js +5 -5
  40. package/dist/components/layout/toolbar/ToolbarLayout.js +5 -5
  41. package/dist/components/layout/toolbar/ViewModeTool.js +3 -3
  42. package/dist/components/layout/toolbar/ZoomTool.js +5 -5
  43. package/dist/components/layout/toolbar/tools/DocumentPropertiesTool.js +5 -5
  44. package/dist/components/layout/toolbar/tools/DualPageTool.js +5 -5
  45. package/dist/components/layout/toolbar/tools/FileDownloadTool.js +5 -5
  46. package/dist/components/layout/toolbar/tools/FileUploadTool.js +3 -3
  47. package/dist/components/layout/toolbar/tools/FullScreenTool.js +2 -2
  48. package/dist/components/layout/toolbar/tools/InputPageTool.js +5 -5
  49. package/dist/components/layout/toolbar/tools/NextPageTool.js +5 -5
  50. package/dist/components/layout/toolbar/tools/PreviousPageTool.js +5 -5
  51. package/dist/components/layout/toolbar/tools/PrintTool.js +5 -5
  52. package/dist/components/layout/toolbar/tools/RotateClockwiseTool.js +3 -3
  53. package/dist/components/layout/toolbar/tools/RotateCounterclockwiseTool.js +3 -3
  54. package/dist/components/layout/toolbar/tools/SelectionModeSwitcherTool.js +2 -2
  55. package/dist/components/layout/toolbar/tools/SinglePageTool.js +5 -5
  56. package/dist/components/layout/toolbar/tools/ThemeSwitcherTool.js +2 -2
  57. package/dist/components/layout/toolbar/tools/ThumbnailTool.js +5 -5
  58. package/dist/components/layout/toolbar/tools/ZoomInTool.js +3 -3
  59. package/dist/components/layout/toolbar/tools/ZoomLevelDisplay.js +5 -5
  60. package/dist/components/layout/toolbar/tools/ZoomLevelTool.js +5 -5
  61. package/dist/components/layout/toolbar/tools/ZoomOutTool.js +3 -3
  62. package/dist/components/layout/toolbar/tools/defaults/RPHorizontalBar.js +5 -5
  63. package/dist/components/layout/toolbar/tools/defaults/RPVerticalBar.js +5 -5
  64. package/dist/components/layout/toolbar/tools/more-options/DocumentProperties.js +3 -3
  65. package/dist/components/layout/toolbar/tools/more-options/FileDownloadTool.js +5 -5
  66. package/dist/components/layout/toolbar/tools/more-options/FileUploadTool.js +5 -5
  67. package/dist/components/layout/toolbar/tools/more-options/FullScreenTool.js +3 -3
  68. package/dist/components/layout/toolbar/tools/more-options/MostPageTool.js +5 -5
  69. package/dist/components/layout/toolbar/tools/more-options/PrintTool.js +5 -5
  70. package/dist/components/layout/toolbar/tools/more-options/RotateTool.js +4 -4
  71. package/dist/components/layout/toolbar/tools/more-options/ScrollModeTool.js +3 -3
  72. package/dist/components/layout/toolbar/tools/more-options/SelectionModeTool.js +3 -3
  73. package/dist/components/layout/toolbar/tools/more-options/ViewModeTool.js +3 -3
  74. package/dist/components/page/AnnotationLayer.js +5 -5
  75. package/dist/components/page/CanvasLayer.js +5 -5
  76. package/dist/components/page/CustomElement.js +1 -1
  77. package/dist/components/page/DualPage.js +5 -5
  78. package/dist/components/page/RPPage.js +5 -5
  79. package/dist/components/page/SinglePage.js +5 -5
  80. package/dist/components/page/TextHighlightLayer.js +5 -5
  81. package/dist/components/page/TextLayer.js +5 -5
  82. package/dist/components/ui/Checkbox.js +1 -1
  83. package/dist/components/ui/DropDown.js +3 -3
  84. package/dist/components/ui/LoadingIndicator.js +5 -5
  85. package/dist/components/ui/RPTooltip.js +102 -118
  86. package/dist/contexts/DimensionPagesContext.js +1 -1
  87. package/dist/contexts/DropFileZoneContext.js +1 -1
  88. package/dist/contexts/ElementPageContext.js +1 -1
  89. package/dist/contexts/FileInputContext.js +1 -1
  90. package/dist/contexts/HighlightContext.js +1 -1
  91. package/dist/contexts/PagesRotateContext.js +1 -1
  92. package/dist/contexts/PaginationContext.js +5 -5
  93. package/dist/contexts/PrintContext.js +5 -5
  94. package/dist/contexts/RPDocumentContext.js +1 -1
  95. package/dist/contexts/RenderQueueProvider.js +5 -5
  96. package/dist/contexts/RotationContext.js +1 -1
  97. package/dist/contexts/SearchContext.js +5 -5
  98. package/dist/contexts/ThumbnailsContext.js +5 -5
  99. package/dist/contexts/ZoomContext.js +1 -1
  100. package/dist/{floating-ui.react-dom-d22a10b4.js → floating-ui.react-dom-6b2fe0df.js} +3 -3
  101. package/dist/{index-c9a2990a.js → index-35c7f4a2.js} +3 -3
  102. package/dist/{index-3bf64864.js → index-f563c6f0.js} +100 -97
  103. package/dist/main.js +17 -16
  104. package/dist/types/main.d.ts +1 -0
  105. package/dist/types/utils/annotations.d.ts +1 -0
  106. package/dist/types/utils/hooks/useLoadWorker.d.ts +15 -0
  107. package/dist/utils/annotations.js +137 -106
  108. package/dist/utils/hooks/useFileDownload.js +5 -5
  109. package/dist/utils/hooks/useLicense.js +1 -1
  110. package/dist/utils/hooks/useLoadPdf.js +23 -23
  111. package/dist/utils/hooks/useLoadWorker.js +12 -10
  112. package/dist/utils/hooks/usePageRotateContext.js +1 -1
  113. package/dist/utils/hooks/usePaginate.js +5 -5
  114. package/dist/utils/hooks/usePinch.js +1 -1
  115. package/dist/utils/hooks/usePresentPage.js +5 -5
  116. package/dist/utils/hooks/usePrint.js +5 -5
  117. package/dist/utils/hooks/useRotate.js +1 -1
  118. package/dist/utils/hooks/useScrollToPage.js +5 -5
  119. package/dist/utils/hooks/useSearch.js +5 -5
  120. package/dist/utils/hooks/useThumbnail.js +5 -5
  121. package/dist/utils/hooks/useVirtualReactWindow.js +5 -5
  122. package/dist/utils/renderPage.js +4 -4
  123. package/package.json +2 -1
  124. package/dist/pdf-ba2a5710.js +0 -17940
package/dist/main.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { RPProvider as kr } from "./components/RPProvider.js";
2
- import { a as Br, R as Hr, S as Ir, b as Or, u as zr, c as Er, d as Nr } from "./ToolbarLayout.module-692ae41a.js";
3
- import { RPConfig as jr } from "./components/RPConfig.js";
2
+ import { a as Br, R as Hr, S as Ir, b as Or, u as jr, c as zr, d as Er } from "./ToolbarLayout.module-b9afb430.js";
3
+ import { RPConfig as Ur } from "./components/RPConfig.js";
4
4
  import { RPLayout as Ar } from "./components/layout/RPLayout.js";
5
5
  import { RPTheme as Jr } from "./components/RPTheme.js";
6
6
  import { useDarkModeContext as Qr } from "./contexts/DarkModeContext.js";
@@ -14,6 +14,7 @@ import { useHighlightContext as lt } from "./contexts/HighlightContext.js";
14
14
  import { useFullScreenContext as ft } from "./contexts/FullScreenContext.js";
15
15
  import { usePageRotateContext as st } from "./utils/hooks/usePageRotateContext.js";
16
16
  import { useElementPageContext as Tt } from "./contexts/ElementPageContext.js";
17
+ import * as o from "pdfjs-dist";
17
18
  import { ThemeSwitcherTool as ct } from "./components/layout/toolbar/tools/ThemeSwitcherTool.js";
18
19
  import { ThumbnailTool as gt } from "./components/layout/toolbar/tools/ThumbnailTool.js";
19
20
  import { FileUploadTool as dt } from "./components/layout/toolbar/tools/FileUploadTool.js";
@@ -25,9 +26,9 @@ import { NextPageTool as Vt } from "./components/layout/toolbar/tools/NextPageTo
25
26
  import { InputPageTool as kt } from "./components/layout/toolbar/tools/InputPageTool.js";
26
27
  import { ZoomInTool as Bt } from "./components/layout/toolbar/tools/ZoomInTool.js";
27
28
  import { ZoomOutTool as It } from "./components/layout/toolbar/tools/ZoomOutTool.js";
28
- import { ZoomLevelTool as zt } from "./components/layout/toolbar/tools/ZoomLevelTool.js";
29
- import { DocumentPropertiesTool as Nt } from "./components/layout/toolbar/tools/DocumentPropertiesTool.js";
30
- import { RotateClockwiseTool as jt } from "./components/layout/toolbar/tools/RotateClockwiseTool.js";
29
+ import { ZoomLevelTool as jt } from "./components/layout/toolbar/tools/ZoomLevelTool.js";
30
+ import { DocumentPropertiesTool as Et } from "./components/layout/toolbar/tools/DocumentPropertiesTool.js";
31
+ import { RotateClockwiseTool as Ut } from "./components/layout/toolbar/tools/RotateClockwiseTool.js";
31
32
  import { RotateCounterclockwiseTool as At } from "./components/layout/toolbar/tools/RotateCounterclockwiseTool.js";
32
33
  import { RPHorizontalBar as Jt } from "./components/layout/toolbar/tools/defaults/RPHorizontalBar.js";
33
34
  import { RPVerticalBar as Qt } from "./components/layout/toolbar/tools/defaults/RPVerticalBar.js";
@@ -78,7 +79,6 @@ import "./utils/highlight.js";
78
79
  import "./utils/charators.js";
79
80
  import "./utils/Queue.js";
80
81
  import "./utils/renderPage.js";
81
- import "./pdf-ba2a5710.js";
82
82
  import "./contexts/ThemeContext.js";
83
83
  import "./contexts/ConfigContext.js";
84
84
  import "./components/icons/Thumbnail.js";
@@ -93,15 +93,15 @@ import "./components/icons/DarkPdfIcon.js";
93
93
  import "./LayoutWrapper-6224491f.js";
94
94
  import "./SearchCloseButton-08d57275.js";
95
95
  import "./components/ui/RPTooltip.js";
96
- import "./index-c9a2990a.js";
96
+ import "./index-35c7f4a2.js";
97
97
  import "react-dom";
98
- import "./floating-ui.react-dom-d22a10b4.js";
98
+ import "./floating-ui.react-dom-6b2fe0df.js";
99
99
  import "./components/icons/CloseIcon.js";
100
100
  import "./components/ui/Checkbox.js";
101
101
  import "./components/icons/CheckIcon.js";
102
102
  import "./contexts/IconContext.js";
103
103
  import "./components/ui/DropDown.js";
104
- import "./index-3bf64864.js";
104
+ import "./index-f563c6f0.js";
105
105
  import "./components/layout/toolbar/MenuItem.js";
106
106
  import "./components/layout/toolbar/MenuSeparator.js";
107
107
  import "./utils/dateFormatter.js";
@@ -173,7 +173,7 @@ import "./utils/getElementPositionInPage.js";
173
173
  import "./components/icons/ChevronDownIcon.js";
174
174
  import "./components/layout/toolbar/ThumbnailTool.js";
175
175
  export {
176
- Nt as DocumentPropertiesTool,
176
+ Et as DocumentPropertiesTool,
177
177
  om as DualPageTool,
178
178
  ht as FileDownloadTool,
179
179
  dt as FileUploadTool,
@@ -183,7 +183,7 @@ export {
183
183
  Vt as NextPageTool,
184
184
  Lt as PreviousPageTool,
185
185
  Dt as PrintTool,
186
- jr as RPConfig,
186
+ Ur as RPConfig,
187
187
  Br as RPDefaultLayout,
188
188
  Jt as RPHorizontalBar,
189
189
  Ar as RPLayout,
@@ -191,7 +191,7 @@ export {
191
191
  kr as RPProvider,
192
192
  Jr as RPTheme,
193
193
  Qt as RPVerticalBar,
194
- jt as RotateClockwiseTool,
194
+ Ut as RotateClockwiseTool,
195
195
  At as RotateCounterclockwiseTool,
196
196
  mm as ScrollMode,
197
197
  Ir as SearchTool,
@@ -204,8 +204,9 @@ export {
204
204
  em as ViewMode,
205
205
  Bt as ZoomInTool,
206
206
  xm as ZoomLevel,
207
- zt as ZoomLevelTool,
207
+ jt as ZoomLevelTool,
208
208
  It as ZoomOutTool,
209
+ o as pdfjs,
209
210
  Qr as useDarkModeContext,
210
211
  Xr as useDocumentContext,
211
212
  tt as useDropFileZoneContext,
@@ -215,10 +216,10 @@ export {
215
216
  lt as useHighlightContext,
216
217
  pt as useOpenFileContext,
217
218
  st as usePageRotateContext,
218
- zr as usePaginationContext,
219
- Er as usePrintContext,
219
+ jr as usePaginationContext,
220
+ zr as usePrintContext,
220
221
  _r as useRotationContext,
221
- Nr as useSearchContext,
222
+ Er as useSearchContext,
222
223
  ot as useViewModeContext,
223
224
  et as useZoomContext
224
225
  };
@@ -20,6 +20,7 @@ export { useFullScreenContext } from './contexts/FullScreenContext';
20
20
  export { usePageRotateContext } from './utils/hooks/usePageRotateContext';
21
21
  export { useElementPageContext } from './contexts/ElementPageContext';
22
22
  export { type PDFDocumentProxy } from 'pdfjs-dist';
23
+ export * as pdfjs from 'pdfjs-dist';
23
24
  export { SearchTool } from '../lib/components/layout/toolbar/SearchTool';
24
25
  export { ThemeSwitcherTool } from './components/layout/toolbar/tools/ThemeSwitcherTool';
25
26
  export { ThumbnailTool } from './components/layout/toolbar/tools/ThumbnailTool';
@@ -5,4 +5,5 @@ export declare function bindLayerEvents(annotatedLayer: HTMLDivElement, handler:
5
5
  export declare function unbindLayerEvents(annotatedLayer: HTMLDivElement, handler: (event: Event) => void): void;
6
6
  export declare function handleAnnotationLink(annotation: Annotation): void;
7
7
  export declare function handleAnnotationWidget(annotation: Annotation, viewport: PageViewport, canvasMap: Map<string, HTMLCanvasElement>): void;
8
+ export declare function handleAriaHasPopup(targetElement: HTMLElement): void;
8
9
  export declare function annotationEventsHandler(evt: Event, PDFDoc: PDFDocumentProxy, Annotations: Object[]): Promise<AnnotationEventPayload | undefined>;
@@ -1,3 +1,18 @@
1
+ /**
2
+ * Hook to configure the PDF.js worker URL.
3
+ *
4
+ * For Next.js 14 compatibility, users should configure the worker in their own code:
5
+ * ```ts
6
+ * import { pdfjs } from '@react-pdf-kit/viewer'
7
+ *
8
+ * pdfjs.GlobalWorkerOptions.workerSrc = new URL(
9
+ * 'pdfjs-dist/build/pdf.worker.min.mjs',
10
+ * import.meta.url,
11
+ * ).toString();
12
+ * ```
13
+ *
14
+ * The workerUrl prop can still be used to override the worker URL if needed.
15
+ */
1
16
  export declare const useLoadWorker: (workerUrl?: string) => {
2
17
  workerUrlAdded: boolean;
3
18
  };
@@ -1,22 +1,22 @@
1
- import { sanitizeExternalUrl as y } from "./sanitizeExternalUrl.js";
1
+ import { sanitizeExternalUrl as I } from "./sanitizeExternalUrl.js";
2
2
  import { AnnotationType as l } from "./types.js";
3
- import { dateFormatter as O } from "./dateFormatter.js";
3
+ import { dateFormatter as B } from "./dateFormatter.js";
4
4
  import "../th_TH-d627cd51.js";
5
- const b = ["click", "dblclick", "input", "change", "mouseover"], m = /* @__PURE__ */ new Map(), N = (e, s) => `${e.loadingTask.docId}___${s.num}R${s.gen === 0 ? "" : s.gen}`;
6
- function A(e, s) {
7
- const t = N(e, s);
8
- return m.has(t) ? m.get(t) ?? null : null;
5
+ const v = ["click", "dblclick", "input", "change", "mouseover"], g = /* @__PURE__ */ new Map(), x = (e, t) => `${e.loadingTask.docId}___${t.num}R${t.gen === 0 ? "" : t.gen}`;
6
+ function C(e, t) {
7
+ const n = x(e, t);
8
+ return g.has(n) ? g.get(n) ?? null : null;
9
9
  }
10
- const v = (e, s, t) => {
11
- m.set(N(e, s), t);
12
- }, g = (e, s) => {
13
- switch (s[1].name) {
10
+ const S = (e, t, n) => {
11
+ g.set(x(e, t), n);
12
+ }, T = (e, t) => {
13
+ switch (t[1].name) {
14
14
  case "XYZ":
15
15
  return {
16
- bottomOffset: (t, n) => s[3] === null ? n : s[3],
17
- leftOffset: (t, n) => s[2] === null ? 0 : s[2],
16
+ bottomOffset: (n, s) => t[3] === null ? s : t[3],
17
+ leftOffset: (n, s) => t[2] === null ? 0 : t[2],
18
18
  pageIndex: e,
19
- scaleTo: s[4]
19
+ scaleTo: t[4]
20
20
  };
21
21
  case "Fit":
22
22
  case "FitB":
@@ -29,7 +29,7 @@ const v = (e, s, t) => {
29
29
  case "FitH":
30
30
  case "FitBH":
31
31
  return {
32
- bottomOffset: s[2],
32
+ bottomOffset: t[2],
33
33
  leftOffset: 0,
34
34
  pageIndex: e,
35
35
  scaleTo: 1
@@ -42,76 +42,106 @@ const v = (e, s, t) => {
42
42
  scaleTo: 1
43
43
  };
44
44
  }
45
- }, R = (e) => {
45
+ }, M = (e) => {
46
46
  e && (() => {
47
- const t = e == null ? void 0 : e.querySelectorAll(
47
+ const n = e == null ? void 0 : e.querySelectorAll(
48
48
  '[data-l10n-id="pdfjs-annotation-date-time-string"]'
49
49
  );
50
- t == null || t.forEach((n) => {
51
- const { date: a, time: o, dateObj: i } = JSON.parse(n.dataset.l10nArgs ?? "{}");
52
- a && o ? n.textContent = `${a}, ${o}` : i && (n.textContent = O(i));
50
+ n == null || n.forEach((s) => {
51
+ const { date: a, time: o, dateObj: i } = JSON.parse(s.dataset.l10nArgs ?? "{}");
52
+ a && o ? s.textContent = `${a}, ${o}` : i && (s.textContent = B(i));
53
53
  });
54
54
  })();
55
55
  };
56
- async function h(e, s) {
57
- let t;
58
- if (typeof s == "string" ? t = await e.getDestination(s) : t = s, t && typeof t[0] == "object" && t[0] !== null) {
59
- const n = t[0], a = A(e, n);
56
+ async function E(e, t) {
57
+ let n;
58
+ if (typeof t == "string" ? n = await e.getDestination(t) : n = t, n && typeof n[0] == "object" && n[0] !== null) {
59
+ const s = n[0], a = C(e, s);
60
60
  if (a === null) {
61
- const o = await e.getPageIndex(n);
62
- return v(e, n, o), await h(e, t);
61
+ const o = await e.getPageIndex(s);
62
+ return S(e, s, o), await E(e, n);
63
63
  } else
64
- return g(a, t);
64
+ return T(a, n);
65
65
  } else
66
- return g(t[0], t);
66
+ return T(n[0], n);
67
67
  }
68
- function C(e, s) {
69
- for (const t of b)
70
- e.addEventListener(t, s);
68
+ function P(e, t) {
69
+ for (const n of v)
70
+ e.addEventListener(n, t);
71
71
  }
72
- function F(e, s) {
73
- for (const t of b)
74
- e.removeEventListener(t, s);
72
+ function $(e, t) {
73
+ for (const n of v)
74
+ e.removeEventListener(n, t);
75
75
  }
76
- function w(e) {
77
- const { id: s, url: t, unsafeUrl: n } = e;
76
+ function D(e) {
77
+ const { id: t, url: n, unsafeUrl: s } = e;
78
78
  new MutationObserver((o, i) => {
79
- const c = document.querySelector(`[data-annotation-id="${s}"]`);
79
+ const c = document.querySelector(`[data-annotation-id="${t}"]`);
80
80
  if (c) {
81
- const r = c.querySelector("a"), T = y((t || n) ?? "", "");
82
- r && (r == null || r.setAttribute("target", "_blank"), r == null || r.setAttribute("href", T), r == null || r.setAttribute("rel", "noopener noreferrer")), i.disconnect();
81
+ const r = c.querySelector("a"), p = I((n || s) ?? "", "");
82
+ r && (r == null || r.setAttribute("target", "_blank"), r == null || r.setAttribute("href", p), r == null || r.setAttribute("rel", "noopener noreferrer")), i.disconnect();
83
83
  }
84
84
  }).observe(document.body, { childList: !0, subtree: !0 });
85
85
  }
86
- function L(e, s, t) {
87
- const { rotation: n, scale: a } = s, o = n % 180 === 0;
86
+ function U(e, t, n) {
87
+ const { rotation: s, scale: a } = t, o = s % 180 === 0;
88
88
  if (e.fieldType === "Btn" && e.pushButton) {
89
89
  const i = e.rect[2] - e.rect[0], c = e.rect[3] - e.rect[1], r = document.createElement("canvas");
90
- r.setAttribute("width", ((o ? i : c) * a).toString()), r.setAttribute("height", ((o ? c : i) * a).toString()), t.set(e.id, r);
90
+ r.setAttribute("width", ((o ? i : c) * a).toString()), r.setAttribute("height", ((o ? c : i) * a).toString()), n.set(e.id, r);
91
91
  }
92
92
  }
93
- function d(e, s, t) {
94
- const n = [];
95
- if (t)
96
- for (const a of t)
97
- a[e] === s && n.push(a);
98
- return n;
93
+ function V(e) {
94
+ var o;
95
+ let t = e;
96
+ for (; t.tagName !== "SECTION"; )
97
+ t = t.parentElement;
98
+ const n = t.getAttribute("aria-haspopup") === "dialog", s = t.classList.contains("popupAnnotation");
99
+ if (!n && !s)
100
+ return;
101
+ let a = t.id || t.getAttribute("aria-controls");
102
+ if (a || (a = (o = t.firstChild) == null ? void 0 : o.id), a && t.parentElement) {
103
+ const i = t.parentElement.querySelector(`[aria-controls="${a}"]`);
104
+ i && new MutationObserver((r, p) => {
105
+ const b = document.querySelectorAll(".popupDate");
106
+ b.length > 0 && (b.forEach((m) => {
107
+ if (m.innerHTML)
108
+ return !1;
109
+ const N = m.getAttribute("data-l10n-args");
110
+ if (N) {
111
+ const { date: h, time: O, dateObj: A } = JSON.parse(N);
112
+ if (h && O)
113
+ m.textContent = `${h}, ${O}`;
114
+ else if (A) {
115
+ const _ = new Date(A);
116
+ m.textContent = _.toLocaleString();
117
+ }
118
+ }
119
+ }), p.disconnect());
120
+ }).observe(i, { childList: !0, subtree: !0 });
121
+ }
99
122
  }
100
- function u(e, s) {
101
- return { type: e, data: s };
123
+ function d(e, t, n) {
124
+ const s = [];
125
+ if (n)
126
+ for (const a of n)
127
+ a[e] === t && s.push(a);
128
+ return s;
102
129
  }
103
- async function _(e, s) {
130
+ function u(e, t) {
131
+ return { type: e, data: t };
132
+ }
133
+ async function k(e, t) {
104
134
  if (e.dest)
105
135
  if (typeof e.dest == "string") {
106
- const t = await h(s, e.dest);
136
+ const n = await E(t, e.dest);
107
137
  return u(l.INTERNAL_LINK, {
108
- referencedPage: t.pageIndex,
138
+ referencedPage: n.pageIndex,
109
139
  offset: null
110
140
  });
111
141
  } else {
112
- const t = await s.getPageIndex(e.dest[0]);
142
+ const n = await t.getPageIndex(e.dest[0]);
113
143
  return u(l.INTERNAL_LINK, {
114
- referencedPage: t,
144
+ referencedPage: n,
115
145
  offset: {
116
146
  left: e.dest[2],
117
147
  bottom: e.dest[3]
@@ -124,20 +154,20 @@ async function _(e, s) {
124
154
  unsafeUrl: e.unsafeUrl
125
155
  });
126
156
  }
127
- function p(e) {
128
- for (const s of e.getElementsByTagName("span")) {
129
- let t = s.textContent;
130
- const n = JSON.parse(s.dataset.l10nArgs ?? "{}");
131
- if (t)
132
- for (const a in n)
133
- t = t.replace(`{{${a}}}`, n[a]);
134
- s.textContent = t;
157
+ function y(e) {
158
+ for (const t of e.getElementsByTagName("span")) {
159
+ let n = t.textContent;
160
+ const s = JSON.parse(t.dataset.l10nArgs ?? "{}");
161
+ if (n)
162
+ for (const a in s)
163
+ n = n.replace(`{{${a}}}`, s[a]);
164
+ t.textContent = n;
135
165
  }
136
166
  }
137
- function x(e) {
167
+ function w(e) {
138
168
  return u(l.FILE_ATTACHMENT, e.file);
139
169
  }
140
- function f(e, s) {
170
+ function f(e, t) {
141
171
  switch (e.type) {
142
172
  case "textarea":
143
173
  case "text":
@@ -147,22 +177,22 @@ function f(e, s) {
147
177
  });
148
178
  case "select-one":
149
179
  case "select-multiple":
150
- const t = [];
180
+ const n = [];
151
181
  for (const a of e.options)
152
- t.push({
182
+ n.push({
153
183
  value: a.value,
154
184
  label: a.label
155
185
  });
156
- const n = [];
186
+ const s = [];
157
187
  for (const a of e.selectedOptions)
158
- n.push({
188
+ s.push({
159
189
  value: a.value,
160
190
  label: a.label
161
191
  });
162
192
  return u(l.FORM_SELECT, {
163
193
  fieldName: e.name,
164
- value: n,
165
- options: t
194
+ value: s,
195
+ options: n
166
196
  });
167
197
  case "checkbox":
168
198
  return u(l.FORM_CHECKBOX, {
@@ -172,64 +202,64 @@ function f(e, s) {
172
202
  case "radio":
173
203
  return u(l.FORM_RADIO, {
174
204
  fieldName: e.name,
175
- ...s
205
+ ...t
176
206
  });
177
207
  case "button":
178
208
  return u(l.FORM_BUTTON, {
179
209
  fieldName: e.name,
180
- ...s
210
+ ...t
181
211
  });
182
212
  }
183
213
  }
184
- async function S(e, s, t) {
214
+ async function j(e, t, n) {
185
215
  var a;
186
- let n = e.target.parentNode;
187
- if (n.tagName === "DIV" && (n = n.firstChild), typeof n.className != "object")
188
- if (n.className === "linkAnnotation" && e.type === "click") {
189
- const o = (a = n.dataset) == null ? void 0 : a.annotationId;
216
+ let s = e.target.parentNode;
217
+ if (s.tagName === "DIV" && (s = s.firstChild), typeof s.className != "object")
218
+ if (s.className === "linkAnnotation" && e.type === "click") {
219
+ const o = (a = s.dataset) == null ? void 0 : a.annotationId;
190
220
  if (o) {
191
- const i = d("id", o, t);
221
+ const i = d("id", o, n);
192
222
  if (i.length)
193
- return await _(i[0], s);
223
+ return await k(i[0], t);
194
224
  }
195
225
  } else if (
196
226
  /* annotation.className.includes('popupAnnotation') || */
197
- n.className.includes("textAnnotation")
227
+ s.className.includes("textAnnotation")
198
228
  )
199
- p(n);
200
- else if (n.className.includes("fileAttachmentAnnotation")) {
201
- p(n);
202
- const o = n.dataset.annotationId;
229
+ y(s);
230
+ else if (s.className.includes("fileAttachmentAnnotation")) {
231
+ y(s);
232
+ const o = s.dataset.annotationId;
203
233
  if (o && e.type === "dblclick")
204
- return x(d("id", o, t)[0]);
205
- } else if (n.className.includes("textWidgetAnnotation") && e.type === "input") {
206
- let o = n.getElementsByTagName("input")[0];
207
- return o || (o = n.getElementsByTagName("textarea")[0]), f(o);
234
+ return w(d("id", o, n)[0]);
235
+ } else if (s.className.includes("textWidgetAnnotation") && e.type === "input") {
236
+ let o = s.getElementsByTagName("input")[0];
237
+ return o || (o = s.getElementsByTagName("textarea")[0]), f(o);
208
238
  } else {
209
- if (n.className.includes("choiceWidgetAnnotation") && e.type === "input")
210
- return f(n.getElementsByTagName("select")[0]);
211
- if (n.className.includes("buttonWidgetAnnotation checkBox") && e.type === "change")
212
- return f(n.getElementsByTagName("input")[0]);
213
- if (n.className.includes("buttonWidgetAnnotation radioButton") && e.type === "change") {
214
- const o = n.dataset.annotationId;
239
+ if (s.className.includes("choiceWidgetAnnotation") && e.type === "input")
240
+ return f(s.getElementsByTagName("select")[0]);
241
+ if (s.className.includes("buttonWidgetAnnotation checkBox") && e.type === "change")
242
+ return f(s.getElementsByTagName("input")[0]);
243
+ if (s.className.includes("buttonWidgetAnnotation radioButton") && e.type === "change") {
244
+ const o = s.dataset.annotationId;
215
245
  if (o) {
216
- const i = d("id", o, t)[0], c = [];
246
+ const i = d("id", o, n)[0], c = [];
217
247
  for (const r of d(
218
248
  "fieldName",
219
249
  i.fieldName,
220
- t
250
+ n
221
251
  ))
222
252
  r.buttonValue && c.push(r.buttonValue);
223
- return f(n.getElementsByTagName("input")[0], {
253
+ return f(s.getElementsByTagName("input")[0], {
224
254
  value: i.buttonValue,
225
255
  defaultValue: i.fieldValue,
226
256
  options: c
227
257
  });
228
258
  }
229
- } else if (n.className.includes("buttonWidgetAnnotation pushButton") && e.type === "click") {
230
- const o = n.dataset.annotationId;
259
+ } else if (s.className.includes("buttonWidgetAnnotation pushButton") && e.type === "click") {
260
+ const o = s.dataset.annotationId;
231
261
  if (o) {
232
- const i = d("id", o, t)[0], { action: c } = i;
262
+ const i = d("id", o, n)[0], { action: c } = i;
233
263
  return c && ["Print", "SaveAs"].includes(c) ? { type: l.BUTTON, data: i } : i.resetForm ? f(
234
264
  { name: i.fieldName, type: "button" },
235
265
  { actions: i.actions, reset: !0 }
@@ -242,10 +272,11 @@ async function S(e, s, t) {
242
272
  }
243
273
  }
244
274
  export {
245
- S as annotationEventsHandler,
246
- C as bindLayerEvents,
247
- w as handleAnnotationLink,
248
- L as handleAnnotationWidget,
249
- R as insertDateText,
250
- F as unbindLayerEvents
275
+ j as annotationEventsHandler,
276
+ P as bindLayerEvents,
277
+ D as handleAnnotationLink,
278
+ U as handleAnnotationWidget,
279
+ V as handleAriaHasPopup,
280
+ M as insertDateText,
281
+ $ as unbindLayerEvents
251
282
  };
@@ -2,7 +2,7 @@ import "react/jsx-runtime";
2
2
  import "react";
3
3
  import "../../contexts/RPDocumentContext.js";
4
4
  import "../../contexts/DocumentPasswordContext.js";
5
- import { b as Er } from "../../ToolbarLayout.module-692ae41a.js";
5
+ import { b as Er } from "../../ToolbarLayout.module-b9afb430.js";
6
6
  import "../../contexts/DarkModeContext.js";
7
7
  import "../../contexts/RotationContext.js";
8
8
  import "../../contexts/LayerContext.js";
@@ -33,7 +33,7 @@ import "../../contexts/OtherToolContext.js";
33
33
  import "../../contexts/EventCallbackContext.js";
34
34
  import "../../contexts/ThemeContext.js";
35
35
  import "../../contexts/ConfigContext.js";
36
- import "../../pdf-ba2a5710.js";
36
+ import "pdfjs-dist";
37
37
  import "../../components/layout/Container.js";
38
38
  import "../../contexts/ViewportContext.js";
39
39
  import "../../contexts/ToolbarComponentContext.js";
@@ -95,10 +95,10 @@ import "../getWordPositionInPage.js";
95
95
  import "../smoothScrollTo.js";
96
96
  import "../../components/layout/toolbar/FileUploadTool.js";
97
97
  import "../../components/icons/FileUploadDefaultIcon.js";
98
- import "../../index-3bf64864.js";
99
- import "../../index-c9a2990a.js";
98
+ import "../../index-f563c6f0.js";
99
+ import "../../index-35c7f4a2.js";
100
100
  import "react-dom";
101
- import "../../floating-ui.react-dom-d22a10b4.js";
101
+ import "../../floating-ui.react-dom-6b2fe0df.js";
102
102
  import "../../components/layout/toolbar/DarkModeTool.js";
103
103
  import "../../components/icons/MoonIcon.js";
104
104
  import "../../components/icons/SunIcon.js";
@@ -1,6 +1,6 @@
1
1
  import { useState as E, useCallback as h, useEffect as A } from "react";
2
2
  import { appConsole as l } from "../appConsole.js";
3
- const b = /* @__PURE__ */ new Date("2026-01-22T17:22:58.542Z"), d = "Please visit https://www.react-pdf.dev/manage-license/ to generate a new license key.", s = {
3
+ const b = /* @__PURE__ */ new Date("2026-02-02T14:51:17.318Z"), d = "Please visit https://www.react-pdf.dev/manage-license/ to generate a new license key.", s = {
4
4
  invalidLicense: `You are currently using without a valid license. ${d}`,
5
5
  mismatchedDomain: `Your license key is not valid for the current domain / IP. ${d}`,
6
6
  expired: `Your license key has expired. ${d}`,
@@ -1,39 +1,39 @@
1
- import { useState as a, useRef as U, useEffect as k } from "react";
2
- import { V as A, g as F } from "../../pdf-ba2a5710.js";
3
- import { ErrorType as z } from "../types.js";
4
- import { getThumbnailViewport as _ } from "../getThumbnailViewport.js";
5
- import { useConfigContext as j } from "../../contexts/ConfigContext.js";
6
- import { useDocumentPasswordContext as B } from "../../contexts/DocumentPasswordContext.js";
1
+ import { useState as d, useRef as A, useEffect as k } from "react";
2
+ import * as I from "pdfjs-dist";
3
+ import { ErrorType as F } from "../types.js";
4
+ import { getThumbnailViewport as j } from "../getThumbnailViewport.js";
5
+ import { useConfigContext as z } from "../../contexts/ConfigContext.js";
6
+ import { useDocumentPasswordContext as _ } from "../../contexts/DocumentPasswordContext.js";
7
7
  import "../../th_TH-d627cd51.js";
8
8
  import "react/jsx-runtime";
9
9
  import "../appConsole.js";
10
- const $ = (m, s, I = {}) => {
11
- const [n, h] = a(), { workerUrlAdded: v } = j(), [q, S] = a(/* @__PURE__ */ new Map()), d = U(), [f, g] = a(0), [P, T] = a(!1), [D, N] = a(), { password: u, passwordError: O, setPasswordError: c, passwordRequired: p, setPasswordRequired: w } = B(), { onLoadError: i, onLoaded: E, onLoadProgress: b, disableAutoFetch: V, disableStream: x, rangeChunkSize: C } = I;
10
+ const Y = (m, s, h = {}) => {
11
+ const [n, q] = d(), { workerUrlAdded: v } = z(), [D, S] = d(/* @__PURE__ */ new Map()), a = A(), [f, g] = d(0), [P, T] = d(!1), [N, O] = d(), { password: u, passwordError: U, setPasswordError: c, passwordRequired: p, setPasswordRequired: w } = _(), { onLoadError: i, onLoaded: E, onLoadProgress: b, disableAutoFetch: x, disableStream: C, rangeChunkSize: V } = h;
12
12
  return k(() => {
13
13
  b && b(f);
14
14
  }, [f, b]), k(() => {
15
15
  if (!v || !m)
16
16
  return;
17
- g(0), d.current = Date.now();
18
- const r = d.current, R = {
17
+ g(0), a.current = Date.now();
18
+ const r = a.current, R = {
19
19
  url: m,
20
20
  cMapPacked: (s == null ? void 0 : s.isCompressed) ?? !0,
21
21
  ...(s == null ? void 0 : s.url) && { cMapUrl: s.url },
22
22
  ...u && { password: u },
23
- ...V !== void 0 && { disableAutoFetch: V },
24
- ...x !== void 0 && { disableStream: x },
25
- ...C !== void 0 && { rangeChunkSize: C },
26
- verbosity: A.ERRORS
23
+ ...x !== void 0 && { disableAutoFetch: x },
24
+ ...C !== void 0 && { disableStream: C },
25
+ ...V !== void 0 && { rangeChunkSize: V },
26
+ verbosity: I.VerbosityLevel.ERRORS
27
27
  };
28
28
  try {
29
- const e = F(R);
29
+ const e = I.getDocument(R);
30
30
  e.onProgress = (o) => {
31
- if (r === d.current) {
31
+ if (r === a.current) {
32
32
  const { loaded: y, total: l } = o, L = l ? Math.min(100, Math.round(y / l * 100)) : 0;
33
33
  g(L);
34
34
  }
35
35
  }, T(!0);
36
- const t = e.promise.then((o) => (r === d.current && (h(o), g(100)), E && E(o), w(!1), c(""), o)).catch((o) => {
36
+ const t = e.promise.then((o) => (r === a.current && (q(o), g(100)), E && E(o), w(!1), c(""), o)).catch((o) => {
37
37
  o instanceof Error && o.name === "PasswordException" ? (w(!0), c(o.message || "Password required")) : o instanceof Error && o.name === "InvalidPDFException" && u ? (w(!0), c("Incorrect password")) : i && i(o);
38
38
  }).finally(() => {
39
39
  T(!1);
@@ -44,7 +44,7 @@ const $ = (m, s, I = {}) => {
44
44
  });
45
45
  };
46
46
  } catch (e) {
47
- N(z.NOT_SUPPORTED), i && i(e);
47
+ O(F.NOT_SUPPORTED), i && i(e);
48
48
  }
49
49
  }, [m, v, u, i, E]), k(() => {
50
50
  if (p)
@@ -61,7 +61,7 @@ const $ = (m, s, I = {}) => {
61
61
  }
62
62
  Promise.all(e).then((t) => {
63
63
  t.map((o) => {
64
- const { thumbnailViewport: y, scale: l } = _(o), L = o.getViewport();
64
+ const { thumbnailViewport: y, scale: l } = j(o), L = o.getViewport();
65
65
  r.set(o.pageNumber, {
66
66
  page: o,
67
67
  thumbnailViewport: y,
@@ -72,14 +72,14 @@ const $ = (m, s, I = {}) => {
72
72
  });
73
73
  }, [n, P, p]), {
74
74
  pdf: n,
75
- pages: q,
75
+ pages: D,
76
76
  loading: P,
77
- error: D,
77
+ error: N,
78
78
  loadingProgress: f,
79
79
  passwordRequired: p,
80
- passwordError: O
80
+ passwordError: U
81
81
  };
82
82
  };
83
83
  export {
84
- $ as useLoadPdf
84
+ Y as useLoadPdf
85
85
  };