@react-pdf-kit/viewer 2.0.0-beta.0 → 2.0.0-beta.1

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 (184) hide show
  1. package/README.md +6 -6
  2. package/dist/{LayoutWrapper-a871c161.js → LayoutWrapper-6224491f.js} +1 -1
  3. package/dist/{RotateTool.module-03987eba.js → RotateTool.module-67946714.js} +1 -1
  4. package/dist/{SearchCloseButton-cbf182aa.js → SearchCloseButton-08d57275.js} +1 -1
  5. package/dist/ToolbarLayout.module-37619c4b.js +3548 -0
  6. package/dist/assets/style.css +1 -0
  7. package/dist/assets/style.js +74 -0
  8. package/dist/components/RPConfig.js +127 -127
  9. package/dist/components/RPController.js +178 -64
  10. package/dist/components/RPDropFileZone.js +26 -12
  11. package/dist/components/RPPages.js +82 -6
  12. package/dist/components/RPProvider.js +169 -19
  13. package/dist/components/RPTheme.js +6 -5
  14. package/dist/components/icons/LoaderIcon.js +1 -1
  15. package/dist/components/layout/Container.js +1 -1
  16. package/dist/components/layout/LayoutContainer.js +88 -6
  17. package/dist/components/layout/LayoutWrapper.js +2 -1
  18. package/dist/components/layout/RPDefaultLayout.js +129 -3
  19. package/dist/components/layout/RPLayout.js +97 -7
  20. package/dist/components/layout/WrapperLayout.js +22 -9
  21. package/dist/components/layout/sidebar/RPSidebar.js +129 -2
  22. package/dist/components/layout/sidebar/RPSplitter.js +1 -1
  23. package/dist/components/layout/sidebar/Thumbnail.js +89 -6
  24. package/dist/components/layout/sidebar/Thumbnails.js +136 -2
  25. package/dist/components/layout/toolbar/DarkModeTool.js +22 -13
  26. package/dist/components/layout/toolbar/DocumentDialog.js +89 -6
  27. package/dist/components/layout/toolbar/DocumentProperties.js +18 -8
  28. package/dist/components/layout/toolbar/FileDownloadTool.js +129 -2
  29. package/dist/components/layout/toolbar/FileUploadTool.js +31 -10
  30. package/dist/components/layout/toolbar/FullScreenTool.js +39 -27
  31. package/dist/components/layout/toolbar/MenuItem.js +12 -8
  32. package/dist/components/layout/toolbar/MenuSeparator.js +8 -4
  33. package/dist/components/layout/toolbar/MostPageTool.js +89 -7
  34. package/dist/components/layout/toolbar/OtherTool.js +121 -3
  35. package/dist/components/layout/toolbar/Paginate.js +125 -2
  36. package/dist/components/layout/toolbar/PrintTool.js +129 -2
  37. package/dist/components/layout/toolbar/PropertyItem.js +1 -1
  38. package/dist/components/layout/toolbar/RPMenuItem.js +20 -13
  39. package/dist/components/layout/toolbar/RPMoreOptions.js +171 -44
  40. package/dist/components/layout/toolbar/RPToolbar.js +135 -3
  41. package/dist/components/layout/toolbar/RPToolbarEnd.js +135 -2
  42. package/dist/components/layout/toolbar/RotateTool.js +39 -18
  43. package/dist/components/layout/toolbar/ScrollModeTool.js +27 -18
  44. package/dist/components/layout/toolbar/SearchCloseButton.js +11 -2
  45. package/dist/components/layout/toolbar/SearchResultNavigator.js +135 -3
  46. package/dist/components/layout/toolbar/SearchTool.js +87 -6
  47. package/dist/components/layout/toolbar/SelectionModeTool.js +19 -10
  48. package/dist/components/layout/toolbar/ThumbnailTool.js +141 -10
  49. package/dist/components/layout/toolbar/ToolbarCustom.js +90 -7
  50. package/dist/components/layout/toolbar/ToolbarDefault.js +91 -7
  51. package/dist/components/layout/toolbar/ToolbarLayout.js +147 -6
  52. package/dist/components/layout/toolbar/ViewModeTool.js +26 -17
  53. package/dist/components/layout/toolbar/ZoomTool.js +140 -128
  54. package/dist/components/layout/toolbar/tools/DocumentPropertiesTool.js +139 -7
  55. package/dist/components/layout/toolbar/tools/FileDownloadTool.js +142 -9
  56. package/dist/components/layout/toolbar/tools/FileUploadTool.js +27 -8
  57. package/dist/components/layout/toolbar/tools/FullScreenTool.js +23 -13
  58. package/dist/components/layout/toolbar/tools/InputPageTool.js +159 -26
  59. package/dist/components/layout/toolbar/tools/NextPageTool.js +89 -7
  60. package/dist/components/layout/toolbar/tools/PreviousPageTool.js +144 -11
  61. package/dist/components/layout/toolbar/tools/PrintTool.js +140 -7
  62. package/dist/components/layout/toolbar/tools/RotateClockwiseTool.js +29 -8
  63. package/dist/components/layout/toolbar/tools/RotateCounterclockwiseTool.js +32 -11
  64. package/dist/components/layout/toolbar/tools/ThemeSwitcherTool.js +15 -6
  65. package/dist/components/layout/toolbar/tools/ThumbnailTool.js +144 -11
  66. package/dist/components/layout/toolbar/tools/ZoomInTool.js +47 -20
  67. package/dist/components/layout/toolbar/tools/ZoomLevelDisplay.js +142 -0
  68. package/dist/components/layout/toolbar/tools/ZoomLevelTool.js +160 -29
  69. package/dist/components/layout/toolbar/tools/ZoomOutTool.js +45 -18
  70. package/dist/components/layout/toolbar/tools/defaults/RPHorizontalBar.js +100 -13
  71. package/dist/components/layout/toolbar/tools/defaults/RPVerticalBar.js +146 -11
  72. package/dist/components/layout/toolbar/tools/more-options/DocumentProperties.js +15 -5
  73. package/dist/components/layout/toolbar/tools/more-options/FileDownloadTool.js +143 -11
  74. package/dist/components/layout/toolbar/tools/more-options/FileUploadTool.js +90 -7
  75. package/dist/components/layout/toolbar/tools/more-options/FullScreenTool.js +21 -9
  76. package/dist/components/layout/toolbar/tools/more-options/MostPageTool.js +90 -8
  77. package/dist/components/layout/toolbar/tools/more-options/PrintTool.js +139 -7
  78. package/dist/components/layout/toolbar/tools/more-options/RotateTool.js +33 -12
  79. package/dist/components/layout/toolbar/tools/more-options/ScrollModeTool.js +23 -14
  80. package/dist/components/layout/toolbar/tools/more-options/SelectionModeTool.js +22 -13
  81. package/dist/components/layout/toolbar/tools/more-options/ViewModeTool.js +25 -16
  82. package/dist/components/page/AnnotationLayer.js +86 -6
  83. package/dist/components/page/CanvasLayer.js +90 -6
  84. package/dist/components/page/CustomElement.js +49 -18
  85. package/dist/components/page/DualPage.js +138 -2
  86. package/dist/components/page/RPPage.js +88 -6
  87. package/dist/components/page/SinglePage.js +138 -2
  88. package/dist/components/page/TextHighlightLayer.js +88 -6
  89. package/dist/components/page/TextLayer.js +88 -6
  90. package/dist/components/ui/Button.js +9 -8
  91. package/dist/components/ui/Checkbox.js +6 -5
  92. package/dist/components/ui/DropDown.js +18 -14
  93. package/dist/components/ui/Input.js +10 -9
  94. package/dist/components/ui/LoadingIndicator.js +137 -2
  95. package/dist/components/ui/PasswordModal.js +18 -15
  96. package/dist/components/ui/RPTooltip.js +202 -415
  97. package/dist/contexts/DimensionPagesContext.js +35 -17
  98. package/dist/contexts/DropFileZoneContext.js +32 -22
  99. package/dist/contexts/ElementPageContext.js +114 -51
  100. package/dist/contexts/EventCallbackContext.js +30 -0
  101. package/dist/contexts/FileInputContext.js +32 -22
  102. package/dist/contexts/GlobalCurrentPage.js +13 -10
  103. package/dist/contexts/HighlightContext.js +24 -11
  104. package/dist/contexts/LicenseContext.js +1 -0
  105. package/dist/contexts/LoaderContext.js +10 -9
  106. package/dist/contexts/LocalizationContext.js +11 -10
  107. package/dist/contexts/PagesRotateContext.js +36 -18
  108. package/dist/contexts/PaginationContext.js +137 -4
  109. package/dist/contexts/PrintContext.js +140 -4
  110. package/dist/contexts/RPDocumentContext.js +38 -28
  111. package/dist/contexts/RenderQueueProvider.js +138 -4
  112. package/dist/contexts/RotationContext.js +25 -15
  113. package/dist/contexts/ScrollModeContext.js +7 -6
  114. package/dist/contexts/SearchContext.js +140 -4
  115. package/dist/contexts/SelectionModeContext.js +5 -4
  116. package/dist/contexts/ThumbnailsContext.js +140 -4
  117. package/dist/contexts/ViewModeContext.js +10 -9
  118. package/dist/contexts/ZoomContext.js +34 -24
  119. package/dist/index-808ea7bf.js +1685 -0
  120. package/dist/index-a48ec088.js +1672 -0
  121. package/dist/{index-35c7f4a2.js → index-c9a2990a.js} +3 -3
  122. package/dist/libInjectCss.js +9 -0
  123. package/dist/main.js +218 -84
  124. package/dist/types/assets/style.d.ts +1 -0
  125. package/dist/types/components/layout/toolbar/tools/ZoomLevelDisplay.d.ts +7 -0
  126. package/dist/types/contexts/EventCallbackContext.d.ts +5 -0
  127. package/dist/types/libInjectCss.d.ts +1 -0
  128. package/dist/types/main.d.ts +1 -1
  129. package/dist/types/utils/annotations.d.ts +1 -2
  130. package/dist/types/utils/approximateFragtion.d.ts +9 -0
  131. package/dist/types/utils/getElementPositionInPage.d.ts +5 -0
  132. package/dist/types/utils/injectPrintCSS.d.ts +1 -0
  133. package/dist/types/utils/link_service.d.ts +11 -1
  134. package/dist/types/utils/types.d.ts +11 -1
  135. package/dist/types/utils/zoom.d.ts +2 -0
  136. package/dist/utils/annotations.js +48 -58
  137. package/dist/utils/approximateFragtion.js +22 -0
  138. package/dist/utils/getElementPositionInPage.js +84 -0
  139. package/dist/utils/getZoomLevel.js +9 -8
  140. package/dist/utils/hooks/useDarkModeProps.js +3 -2
  141. package/dist/utils/hooks/useFileDownload.js +90 -6
  142. package/dist/utils/hooks/useHighlight.js +13 -12
  143. package/dist/utils/hooks/useLicense.js +1 -1
  144. package/dist/utils/hooks/useLoadPdf.js +46 -41
  145. package/dist/utils/hooks/useLoadWorker.js +8 -8
  146. package/dist/utils/hooks/usePageRotateContext.js +33 -17
  147. package/dist/utils/hooks/usePaginate.js +88 -6
  148. package/dist/utils/hooks/usePinch.js +62 -41
  149. package/dist/utils/hooks/usePresentPage.js +88 -6
  150. package/dist/utils/hooks/usePrint.js +89 -6
  151. package/dist/utils/hooks/useRotate.js +21 -7
  152. package/dist/utils/hooks/useScrollToPage.js +86 -6
  153. package/dist/utils/hooks/useSearch.js +86 -6
  154. package/dist/utils/hooks/useThumbnail.js +89 -6
  155. package/dist/utils/hooks/useVirtualReactWindow.js +88 -6
  156. package/dist/utils/hooks/useWatermark.js +18 -15
  157. package/dist/utils/injectPrintCSS.js +22 -0
  158. package/dist/utils/link_service.js +49 -9
  159. package/dist/utils/renderPage.js +1 -0
  160. package/dist/utils/zoom.js +6 -0
  161. package/package.json +18 -23
  162. package/dist/ToolbarLayout.module-c588d36b.js +0 -3411
  163. package/dist/ZoomTool.module-6c5eabbb.js +0 -12
  164. package/dist/assets/Button.css +0 -1
  165. package/dist/assets/Checkbox.css +0 -1
  166. package/dist/assets/Container.css +0 -1
  167. package/dist/assets/DropDown.css +0 -1
  168. package/dist/assets/Input.css +0 -1
  169. package/dist/assets/LayoutWrapper.css +0 -1
  170. package/dist/assets/LoaderIcon.css +0 -1
  171. package/dist/assets/MenuItem.css +0 -1
  172. package/dist/assets/MenuSeparator.css +0 -1
  173. package/dist/assets/PasswordModal.css +0 -1
  174. package/dist/assets/PropertyItem.css +0 -1
  175. package/dist/assets/RPDropFileZone.css +0 -1
  176. package/dist/assets/RPSplitter.css +0 -1
  177. package/dist/assets/RPTooltip.css +0 -1
  178. package/dist/assets/RotateTool.css +0 -1
  179. package/dist/assets/SearchCloseButton.css +0 -1
  180. package/dist/assets/ToolbarLayout.css +0 -1
  181. package/dist/assets/WrapperLayout.css +0 -1
  182. package/dist/assets/ZoomTool.css +0 -1
  183. package/dist/floating-ui.react-dom-6b2fe0df.js +0 -1474
  184. package/dist/index-f563c6f0.js +0 -1889
@@ -1,14 +1,15 @@
1
- import { sanitizeExternalUrl as L } from "./sanitizeExternalUrl.js";
2
- import { AnnotationSubType as _, AnnotationType as l } from "./types.js";
3
- import { dateFormatter as I } from "./dateFormatter.js";
4
- const v = ["click", "dblclick", "input", "change"], g = /* @__PURE__ */ new Map(), E = (e, t) => `${e.loadingTask.docId}___${t.num}R${t.gen === 0 ? "" : t.gen}`;
5
- function x(e, t) {
6
- const n = E(e, t);
7
- return g.has(n) ? g.get(n) ?? null : null;
1
+ import { sanitizeExternalUrl as _ } from "./sanitizeExternalUrl.js";
2
+ import { AnnotationType as l } from "./types.js";
3
+ import { dateFormatter as L } from "./dateFormatter.js";
4
+ import "../th_TH-d627cd51.js";
5
+ const T = ["click", "dblclick", "input", "change"], m = /* @__PURE__ */ new Map(), v = (e, t) => `${e.loadingTask.docId}___${t.num}R${t.gen === 0 ? "" : t.gen}`;
6
+ function I(e, t) {
7
+ const n = v(e, t);
8
+ return m.has(n) ? m.get(n) ?? null : null;
8
9
  }
9
- const B = (e, t, n) => {
10
- g.set(E(e, t), n);
11
- }, O = (e, t) => {
10
+ const x = (e, t, n) => {
11
+ m.set(v(e, t), n);
12
+ }, A = (e, t) => {
12
13
  switch (t[1].name) {
13
14
  case "XYZ":
14
15
  return {
@@ -42,19 +43,19 @@ const B = (e, t, n) => {
42
43
  };
43
44
  }
44
45
  };
45
- async function b(e, t) {
46
+ async function E(e, t) {
46
47
  let n;
47
48
  if (typeof t == "string" ? n = await e.getDestination(t) : n = t, n && typeof n[0] == "object" && n[0] !== null) {
48
- const a = n[0], s = x(e, a);
49
+ const a = n[0], s = I(e, a);
49
50
  if (s === null) {
50
51
  const r = await e.getPageIndex(a);
51
- return B(e, a, r), await b(e, n);
52
+ return x(e, a, r), await E(e, n);
52
53
  } else
53
- return O(s, n);
54
+ return A(s, n);
54
55
  } else
55
- return O(n[0], n);
56
+ return A(n[0], n);
56
57
  }
57
- const H = (e) => {
58
+ const M = (e) => {
58
59
  const n = e.target.parentNode;
59
60
  if (!n)
60
61
  return;
@@ -67,7 +68,7 @@ const H = (e) => {
67
68
  if (c) {
68
69
  try {
69
70
  const { dateObj: i } = JSON.parse(c);
70
- i && (o.textContent = I(i));
71
+ i && (o.textContent = L(i));
71
72
  } catch {
72
73
  }
73
74
  a.disconnect();
@@ -83,43 +84,33 @@ const H = (e) => {
83
84
  attributes: !0
84
85
  // Watch for changes to attributes
85
86
  }), () => a.disconnect();
86
- }, M = (e, t, n, a) => {
87
- if (e.type !== "click")
88
- return;
89
- const s = e.target, r = s.getAttribute("data-element-id"), o = s.getAttribute("href");
90
- if (o && o !== "#")
91
- return;
92
- const c = t.find((i) => i.id === r);
93
- !c || c.annotationType !== _.Link || c.dest && b(n, c.dest).then((i) => {
94
- a(i);
95
- });
96
87
  };
97
- function P(e, t) {
98
- for (const n of v)
88
+ function H(e, t) {
89
+ for (const n of T)
99
90
  e.addEventListener(n, t);
100
91
  }
101
- function U(e, t) {
102
- for (const n of v)
92
+ function P(e, t) {
93
+ for (const n of T)
103
94
  e.removeEventListener(n, t);
104
95
  }
105
- function V(e) {
96
+ function U(e) {
106
97
  const { id: t, url: n, unsafeUrl: a } = e;
107
98
  new MutationObserver((r, o) => {
108
99
  const c = document.querySelector(`[data-annotation-id="${t}"]`);
109
100
  if (c) {
110
- const i = c.querySelector("a"), p = L((n || a) ?? "", "");
101
+ const i = c.querySelector("a"), p = _((n || a) ?? "", "");
111
102
  i && (i == null || i.setAttribute("target", "_blank"), i == null || i.setAttribute("href", p), i == null || i.setAttribute("rel", "noopener noreferrer")), o.disconnect();
112
103
  }
113
104
  }).observe(document.body, { childList: !0, subtree: !0 });
114
105
  }
115
- function $(e, t, n) {
106
+ function V(e, t, n) {
116
107
  const { rotation: a, scale: s } = t, r = a % 180 === 0;
117
108
  if (e.fieldType === "Btn" && e.pushButton) {
118
109
  const o = e.rect[2] - e.rect[0], c = e.rect[3] - e.rect[1], i = document.createElement("canvas");
119
110
  i.setAttribute("width", ((r ? o : c) * s).toString()), i.setAttribute("height", ((r ? c : o) * s).toString()), n.set(e.id, i);
120
111
  }
121
112
  }
122
- function k(e) {
113
+ function B(e) {
123
114
  var r;
124
115
  let t = e;
125
116
  for (; t.tagName !== "SECTION"; )
@@ -131,14 +122,14 @@ function k(e) {
131
122
  if (s || (s = (r = t.firstChild) == null ? void 0 : r.id), s && t.parentElement) {
132
123
  const o = t.parentElement.querySelector(`[aria-controls="${s}"]`);
133
124
  o && new MutationObserver((i, p) => {
134
- const h = document.querySelectorAll(".popupDate");
135
- h.length > 0 && (h.forEach((m) => {
136
- if (m.innerHTML)
125
+ const b = document.querySelectorAll(".popupDate");
126
+ b.length > 0 && (b.forEach((g) => {
127
+ if (g.innerHTML)
137
128
  return !1;
138
- const N = m.getAttribute("data-l10n-args");
129
+ const N = g.getAttribute("data-l10n-args");
139
130
  if (N) {
140
- const { date: y, time: A } = JSON.parse(N);
141
- y && A && (m.textContent = `${y}, ${A}`);
131
+ const { date: h, time: y } = JSON.parse(N);
132
+ h && y && (g.textContent = `${h}, ${y}`);
142
133
  }
143
134
  }), p.disconnect());
144
135
  }).observe(o, { childList: !0, subtree: !0 });
@@ -154,10 +145,10 @@ function d(e, t, n) {
154
145
  function u(e, t) {
155
146
  return { type: e, data: t };
156
147
  }
157
- async function S(e, t) {
148
+ async function w(e, t) {
158
149
  if (e.dest)
159
150
  if (typeof e.dest == "string") {
160
- const n = await b(t, e.dest);
151
+ const n = await E(t, e.dest);
161
152
  return u(l.INTERNAL_LINK, {
162
153
  referencedPage: n.pageIndex,
163
154
  offset: null
@@ -178,7 +169,7 @@ async function S(e, t) {
178
169
  unsafeUrl: e.unsafeUrl
179
170
  });
180
171
  }
181
- function T(e) {
172
+ function O(e) {
182
173
  for (const t of e.getElementsByTagName("span")) {
183
174
  let n = t.textContent;
184
175
  const a = JSON.parse(t.dataset.l10nArgs ?? "{}");
@@ -188,7 +179,7 @@ function T(e) {
188
179
  t.textContent = n;
189
180
  }
190
181
  }
191
- function w(e) {
182
+ function S(e) {
192
183
  return u(l.FILE_ATTACHMENT, e.file);
193
184
  }
194
185
  function f(e, t) {
@@ -235,27 +226,27 @@ function f(e, t) {
235
226
  });
236
227
  }
237
228
  }
238
- async function D(e, t, n) {
229
+ async function $(e, t, n) {
239
230
  var s;
240
231
  let a = e.target.parentNode;
241
- if (a.tagName === "DIV" && (a = a.firstChild), k(a), typeof a.className != "object")
232
+ if (a.tagName === "DIV" && (a = a.firstChild), B(a), typeof a.className != "object")
242
233
  if (a.className === "linkAnnotation" && e.type === "click") {
243
234
  const r = (s = a.dataset) == null ? void 0 : s.annotationId;
244
235
  if (r) {
245
236
  const o = d("id", r, n);
246
237
  if (o.length)
247
- return await S(o[0], t);
238
+ return await w(o[0], t);
248
239
  }
249
240
  } else if (
250
241
  /* annotation.className.includes('popupAnnotation') || */
251
242
  a.className.includes("textAnnotation")
252
243
  )
253
- T(a);
244
+ O(a);
254
245
  else if (a.className.includes("fileAttachmentAnnotation")) {
255
- T(a);
246
+ O(a);
256
247
  const r = a.dataset.annotationId;
257
248
  if (r && e.type === "dblclick")
258
- return w(d("id", r, n)[0]);
249
+ return S(d("id", r, n)[0]);
259
250
  } else if (a.className.includes("textWidgetAnnotation") && e.type === "input") {
260
251
  let r = a.getElementsByTagName("input")[0];
261
252
  return r || (r = a.getElementsByTagName("textarea")[0]), f(r);
@@ -296,11 +287,10 @@ async function D(e, t, n) {
296
287
  }
297
288
  }
298
289
  export {
299
- D as annotationEventsHandler,
300
- H as annotationsEvents,
301
- P as bindLayerEvents,
302
- V as handleAnnotationLink,
303
- $ as handleAnnotationWidget,
304
- M as handleClick,
305
- U as unbindLayerEvents
290
+ $ as annotationEventsHandler,
291
+ M as annotationsEvents,
292
+ H as bindLayerEvents,
293
+ U as handleAnnotationLink,
294
+ V as handleAnnotationWidget,
295
+ P as unbindLayerEvents
306
296
  };
@@ -0,0 +1,22 @@
1
+ function u(t) {
2
+ if (Math.floor(t) === t)
3
+ return [t, 1];
4
+ const e = 1 / t, s = 8;
5
+ if (e > s)
6
+ return [1, s];
7
+ if (Math.floor(e) === e)
8
+ return [1, e];
9
+ const r = t > 1 ? e : t;
10
+ let i = 0, n = 1, o = 1, l = 1;
11
+ for (; ; ) {
12
+ const c = i + o, f = n + l;
13
+ if (f > s)
14
+ break;
15
+ r <= c / f ? (o = c, l = f) : (i = c, n = f);
16
+ }
17
+ let a;
18
+ return r - i / n < o / l - r ? a = r === t ? [i, n] : [n, i] : a = r === t ? [o, l] : [l, o], a;
19
+ }
20
+ export {
21
+ u as approximateFraction
22
+ };
@@ -0,0 +1,84 @@
1
+ function g(e, o) {
2
+ !e || typeof e != "object" || Object.entries(e).forEach(([d, i]) => {
3
+ if (i == null)
4
+ return;
5
+ const s = d.replace(/([A-Z])/g, "-$1").toLowerCase(), n = [
6
+ "width",
7
+ "height",
8
+ "top",
9
+ "right",
10
+ "bottom",
11
+ "left",
12
+ "margin",
13
+ "margin-top",
14
+ "margin-right",
15
+ "margin-bottom",
16
+ "margin-left",
17
+ "padding",
18
+ "padding-top",
19
+ "padding-right",
20
+ "padding-bottom",
21
+ "padding-left",
22
+ "border-width",
23
+ "border-top-width",
24
+ "border-right-width",
25
+ "border-bottom-width",
26
+ "border-left-width",
27
+ "font-size",
28
+ "line-height",
29
+ "letter-spacing",
30
+ "word-spacing",
31
+ "min-width",
32
+ "min-height",
33
+ "max-width",
34
+ "max-height",
35
+ "flex-basis",
36
+ "grid-gap",
37
+ "grid-row-gap",
38
+ "grid-column-gap"
39
+ ];
40
+ let t;
41
+ typeof i == "number" && i !== 0 ? t = n.includes(s) ? `${i}px` : String(i) : t = String(i), o.style.setProperty(s, t);
42
+ });
43
+ }
44
+ const f = (e, o, d, i, s) => {
45
+ let n = "center";
46
+ switch (i) {
47
+ case 90:
48
+ n = `${e.width / 2}px ${e.width / 2}px`;
49
+ break;
50
+ case -90:
51
+ case 270:
52
+ n = `${e.height / 2}px ${e.height / 2}px`;
53
+ break;
54
+ default:
55
+ n = "center";
56
+ }
57
+ const t = document.createElement("div");
58
+ t.id = "parent-element", t.style.width = `${e.width}px`, t.style.height = `${e.height}px`, t.style.setProperty("--scale-factor", s.toString()), t.style.setProperty("--rotation", i.toString()), t.style.setProperty("--transform-origin", n), t.style.left = "-99999px", t.style.visibility = "hidden", t.style.position = "absolute";
59
+ const l = document.createElement("div");
60
+ l.style.position = "relative", l.style.width = "100%", l.style.height = "100%", t.appendChild(l);
61
+ let r;
62
+ if (d instanceof HTMLElement)
63
+ r = d.cloneNode(!0), l.appendChild(r);
64
+ else {
65
+ const p = d.props;
66
+ r = document.createElement("div"), p.style && g(p.style, r), p.className && (r.className = p.className), l.appendChild(r);
67
+ }
68
+ o.appendChild(t);
69
+ const c = t.getBoundingClientRect(), h = r.getBoundingClientRect();
70
+ o.removeChild(t);
71
+ const a = {
72
+ top: o.clientHeight / 2,
73
+ left: o.clientWidth / 2
74
+ };
75
+ return {
76
+ left: h.left - c.left - a.left,
77
+ top: h.top - c.top - a.top,
78
+ width: h.width,
79
+ height: h.height
80
+ };
81
+ };
82
+ export {
83
+ f as getElementPagePosition
84
+ };
@@ -1,23 +1,24 @@
1
- import { SCROLL_BAR_WIDTH as a, PAGE_PADDING as f } from "./constants.js";
2
- import { ViewMode as u, ZoomLevel as r } from "./types.js";
3
- const l = (o, t, m, e, A, c) => {
1
+ import { SCROLL_BAR_WIDTH as n, PAGE_PADDING as f } from "./constants.js";
2
+ import { ViewMode as i, ZoomLevel as r } from "./types.js";
3
+ import "../th_TH-d627cd51.js";
4
+ const D = (o, t, a, e, A, c) => {
4
5
  if (typeof o == "number")
5
6
  return o;
6
- const n = c === u.DUAL_PAGE ? 2 * e : e;
7
+ const m = c === i.DUAL_PAGE ? 2 * e : e;
7
8
  switch (o) {
8
9
  case r.PAGE_FIT:
9
10
  const s = Math.min(
10
- (t - a) / n,
11
- (m - f) / A
11
+ (t - n) / m,
12
+ (a - f) / A
12
13
  );
13
14
  return Math.floor(s * 100);
14
15
  case r.PAGE_WIDTH:
15
- return Math.floor((t - a) / n * 100);
16
+ return Math.floor((t - n) / m * 100);
16
17
  case r.ACTUAL:
17
18
  default:
18
19
  return 100;
19
20
  }
20
21
  };
21
22
  export {
22
- l as getZoomLevel
23
+ D as getZoomLevel
23
24
  };
@@ -1,5 +1,6 @@
1
1
  import { useDarkMode as e } from "./useDarkMode.js";
2
- const t = () => {
2
+ import "react";
3
+ const d = () => {
3
4
  const { darkMode: o, setDarkMode: r } = e();
4
5
  return {
5
6
  darkMode: o,
@@ -7,5 +8,5 @@ const t = () => {
7
8
  };
8
9
  };
9
10
  export {
10
- t as useDarkModeProps
11
+ d as useDarkModeProps
11
12
  };
@@ -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 io } from "../../ToolbarLayout.module-c588d36b.js";
5
+ import { b as Hr } from "../../ToolbarLayout.module-37619c4b.js";
6
6
  import "../../contexts/DarkModeContext.js";
7
7
  import "../../contexts/RotationContext.js";
8
8
  import "../../contexts/LayerContext.js";
@@ -30,29 +30,113 @@ import "../../contexts/LoaderContext.js";
30
30
  import "../../contexts/ToolComponentContext.js";
31
31
  import "../../contexts/IconToolContext.js";
32
32
  import "../../contexts/OtherToolContext.js";
33
+ import "../../contexts/EventCallbackContext.js";
33
34
  import "../../components/RPConfig.js";
34
35
  import "../../components/layout/Container.js";
35
36
  import "../../contexts/ViewportContext.js";
36
37
  import "../../contexts/ToolbarComponentContext.js";
37
38
  import "../../components/layout/sidebar/RPSplitter.js";
38
39
  import "../../components/layout/WrapperLayout.js";
39
- import "../../LayoutWrapper-a871c161.js";
40
+ import "../../LayoutWrapper-6224491f.js";
40
41
  import "../../contexts/ThemeContext.js";
41
42
  import "../../components/RPDropFileZone.js";
42
43
  import "../../components/ui/Button.js";
43
- import "../../SearchCloseButton-cbf182aa.js";
44
+ import "../../SearchCloseButton-08d57275.js";
44
45
  import "../../components/ui/Input.js";
45
46
  import "../../components/ui/Checkbox.js";
46
47
  import "../../components/icons/LoaderIcon.js";
47
48
  import "../../contexts/IconContext.js";
48
49
  import "../../components/ui/RPTooltip.js";
49
50
  import "../../components/ui/DropDown.js";
50
- import "../../ZoomTool.module-6c5eabbb.js";
51
51
  import "../../components/layout/toolbar/MenuItem.js";
52
52
  import "../../components/layout/toolbar/MenuSeparator.js";
53
53
  import "../dateFormatter.js";
54
54
  import "../../components/layout/toolbar/PropertyItem.js";
55
- import "../../RotateTool.module-03987eba.js";
55
+ import "../../RotateTool.module-67946714.js";
56
+ import "./useLoadPdf.js";
57
+ import "pdfjs-dist";
58
+ import "../types.js";
59
+ import "../../th_TH-d627cd51.js";
60
+ import "../getThumbnailViewport.js";
61
+ import "../../contexts/ConfigContext.js";
62
+ import "../appConsole.js";
63
+ import "./usePdfProperties.js";
64
+ import "../convertPdfDate.js";
65
+ import "../formatFileSize.js";
66
+ import "../../components/icons/ChevronUpIcon.js";
67
+ import "../highlight.js";
68
+ import "../charators.js";
69
+ import "../Queue.js";
70
+ import "../renderPage.js";
71
+ import "../../components/icons/Thumbnail.js";
72
+ import "../../clsx-0c6e471a.js";
73
+ import "../withRef.js";
74
+ import "./useInfiniteScroll.js";
75
+ import "../constants.js";
76
+ import "../link_service.js";
77
+ import "../annotations.js";
78
+ import "../sanitizeExternalUrl.js";
79
+ import "../../components/page/searchHighlight.js";
80
+ import "../const.js";
81
+ import "../../components/page/CustomElement.js";
82
+ import "../getZoomLevel.js";
83
+ import "./useDebounce.js";
84
+ import "./useLicense.js";
85
+ import "../getScrollDistance.js";
86
+ import "../getElementPositionInPage.js";
87
+ import "../calculatePage.js";
88
+ import "./useMousePressed.js";
89
+ import "./useGrabScroll.js";
90
+ import "./usePinch.js";
91
+ import "../../components/ui/PasswordModal.js";
92
+ import "./useLocalization.js";
93
+ import "../approximateFragtion.js";
94
+ import "../getWordPositionInPage.js";
95
+ import "../smoothScrollTo.js";
96
+ import "../../components/layout/toolbar/FileUploadTool.js";
97
+ import "../../components/icons/FileUploadDefaultIcon.js";
98
+ import "../../index-a48ec088.js";
99
+ import "../../index-c9a2990a.js";
100
+ import "react-dom";
101
+ import "../../index-808ea7bf.js";
102
+ import "../../components/layout/toolbar/DarkModeTool.js";
103
+ import "../../components/icons/MoonIcon.js";
104
+ import "../../components/icons/SunIcon.js";
105
+ import "./useDarkMode.js";
106
+ import "../../components/icons/ThreeDotIcon.js";
107
+ import "../../components/icons/CloseIcon.js";
108
+ import "../../components/layout/toolbar/DocumentProperties.js";
109
+ import "../../components/icons/InfoIcon.js";
110
+ import "../../components/layout/toolbar/RotateTool.js";
111
+ import "../../components/icons/ClockwiseIcon.js";
112
+ import "./useRotate.js";
113
+ import "../../components/layout/toolbar/ViewModeTool.js";
114
+ import "../../components/icons/SinglePageIcon.js";
115
+ import "../../components/icons/DualPageIcon.js";
116
+ import "../../components/icons/CheckIcon.js";
117
+ import "../../components/layout/toolbar/ScrollModeTool.js";
118
+ import "../../components/icons/PageScrollingIcon.js";
119
+ import "../../components/icons/VerticalScrollingIcon.js";
120
+ import "../../components/icons/HorizontalScrollingIcon.js";
121
+ import "../../components/icons/FileDownloadDefaultIcon.js";
122
+ import "../../components/icons/PrintDefaultIcon.js";
123
+ import "../../components/layout/toolbar/FullScreenTool.js";
124
+ import "../../components/icons/FullScreenIcon.js";
125
+ import "./useFullScreen.js";
126
+ import "../../components/icons/GoToDownIcon.js";
127
+ import "../../components/layout/toolbar/SelectionModeTool.js";
128
+ import "../../components/icons/TextSelectionDefaultIcon.js";
129
+ import "../../components/icons/HandModeDefaultIcon.js";
130
+ import "../../components/icons/ZoomInIcon.js";
131
+ import "../../components/icons/ZoomOutIcon.js";
132
+ import "../zoom.js";
133
+ import "../../components/icons/SearchIcon.js";
134
+ import "../../components/icons/ClearIcon.js";
135
+ import "./useHighlight.js";
136
+ import "../../components/RPTheme.js";
137
+ import "./useLoadWorker.js";
138
+ import "../../components/icons/LightPdfIcon.js";
139
+ import "../../components/icons/DarkPdfIcon.js";
56
140
  export {
57
- io as useFileDownload
141
+ Hr as useFileDownload
58
142
  };
@@ -1,23 +1,24 @@
1
1
  import { useState as l, useCallback as x, useEffect as C } from "react";
2
2
  import { getHighlightOptionsWithDefaults as H, findMatches as M } from "../highlight.js";
3
- const d = (i) => {
4
- const [n, a] = l(void 0), [u, r] = l([]), f = x(async (t) => {
3
+ import "../charators.js";
4
+ const k = (s) => {
5
+ const [n, a] = l(void 0), [u, r] = l([]), m = x(async (t) => {
5
6
  if (!t)
6
7
  return {};
7
- const s = t.numPages, e = {};
8
- for (let o = 1; o <= s; o++) {
8
+ const i = t.numPages, e = {};
9
+ for (let o = 1; o <= i; o++) {
9
10
  const g = await t.getPage(o);
10
11
  e[o.toString()] = await g.getTextContent();
11
12
  }
12
13
  return e;
13
- }, []), m = async (t) => {
14
+ }, []), f = async (t) => {
14
15
  a(t);
15
16
  }, c = () => {
16
17
  r([]), a(void 0);
17
18
  };
18
19
  return C(() => {
19
- i && f(i).then((t) => {
20
- let s = [];
20
+ s && m(s).then((t) => {
21
+ let i = [];
21
22
  for (const { keyword: e, highlightColor: o, options: g } of n) {
22
23
  if (!e)
23
24
  continue;
@@ -35,20 +36,20 @@ const d = (i) => {
35
36
  color: o,
36
37
  keyword: e
37
38
  }));
38
- s = [...s, ...y];
39
+ i = [...i, ...y];
39
40
  }
40
41
  }
41
- r(s);
42
+ r(i);
42
43
  }).catch(() => {
43
44
  c();
44
45
  });
45
- }, [n, i]), {
46
- highlight: m,
46
+ }, [n, s]), {
47
+ highlight: f,
47
48
  clear: c,
48
49
  highlightMatches: u,
49
50
  highlightKeywords: n
50
51
  };
51
52
  };
52
53
  export {
53
- d as useHighlight
54
+ k as useHighlight
54
55
  };
@@ -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-05T03:59:23.044Z"), d = "Please visit https://www.react-pdf.dev/manage-license/ to generate a new license key.", s = {
3
+ const b = /* @__PURE__ */ new Date("2026-01-06T03:19:25.099Z"), 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}`,