@pdf-viewer/react 1.10.0-beta.0 → 1.11.0-beta.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 (90) hide show
  1. package/dist/LayoutWrapper-a871c161.js +19 -0
  2. package/dist/ToolbarLayout.module-310f3470.js +3368 -0
  3. package/dist/assets/LayoutWrapper.css +1 -1
  4. package/dist/assets/RPDropFileZone.css +1 -1
  5. package/dist/assets/ToolbarLayout.css +1 -1
  6. package/dist/components/RPController.js +1 -1
  7. package/dist/components/RPPages.js +3 -3
  8. package/dist/components/layout/LayoutContainer.js +3 -3
  9. package/dist/components/layout/LayoutWrapper.js +1 -1
  10. package/dist/components/layout/RPDefaultLayout.js +4 -3
  11. package/dist/components/layout/RPLayout.js +3 -3
  12. package/dist/components/layout/sidebar/RPSidebar.js +1 -1
  13. package/dist/components/layout/sidebar/Thumbnail.js +3 -3
  14. package/dist/components/layout/sidebar/Thumbnails.js +1 -1
  15. package/dist/components/layout/toolbar/DocumentDialog.js +3 -3
  16. package/dist/components/layout/toolbar/FileDownloadTool.js +1 -1
  17. package/dist/components/layout/toolbar/MenuItem.js +1 -1
  18. package/dist/components/layout/toolbar/MenuSeparator.js +1 -1
  19. package/dist/components/layout/toolbar/MostPageTool.js +4 -4
  20. package/dist/components/layout/toolbar/OtherTool.js +2 -2
  21. package/dist/components/layout/toolbar/Paginate.js +1 -1
  22. package/dist/components/layout/toolbar/PrintTool.js +1 -1
  23. package/dist/components/layout/toolbar/RPToolbar.js +1 -1
  24. package/dist/components/layout/toolbar/RPToolbarEnd.js +1 -1
  25. package/dist/components/layout/toolbar/RotateTool.js +21 -20
  26. package/dist/components/layout/toolbar/ScrollModeTool.js +1 -1
  27. package/dist/components/layout/toolbar/SearchResultNavigator.js +1 -1
  28. package/dist/components/layout/toolbar/SearchTool.js +4 -4
  29. package/dist/components/layout/toolbar/SelectionModeTool.js +1 -1
  30. package/dist/components/layout/toolbar/ThumbnailTool.js +1 -1
  31. package/dist/components/layout/toolbar/ToolbarCustom.js +3 -3
  32. package/dist/components/layout/toolbar/ToolbarDefault.js +4 -7
  33. package/dist/components/layout/toolbar/ViewModeTool.js +1 -1
  34. package/dist/components/layout/toolbar/ZoomTool.js +1 -1
  35. package/dist/components/layout/toolbar/tools/FileDownloadTool.js +1 -1
  36. package/dist/components/layout/toolbar/tools/InputPageTool.js +1 -1
  37. package/dist/components/layout/toolbar/tools/NextPageTool.js +3 -3
  38. package/dist/components/layout/toolbar/tools/PreviousPageTool.js +1 -1
  39. package/dist/components/layout/toolbar/tools/PrintTool.js +1 -1
  40. package/dist/components/layout/toolbar/tools/ThumbnailTool.js +1 -1
  41. package/dist/components/layout/toolbar/tools/ZoomLevelTool.js +1 -1
  42. package/dist/components/layout/toolbar/tools/defaults/RPHorizontalBar.js +4 -7
  43. package/dist/components/page/AnnotationLayer.js +3 -3
  44. package/dist/components/page/CanvasLayer.js +3 -3
  45. package/dist/components/page/DualPage.js +1 -1
  46. package/dist/components/page/RPPage.js +3 -3
  47. package/dist/components/page/SinglePage.js +1 -1
  48. package/dist/components/page/TextHighlightLayer.js +3 -3
  49. package/dist/components/page/TextLayer.js +3 -3
  50. package/dist/components/ui/Checkbox.js +14 -13
  51. package/dist/components/ui/DropDown.js +1 -1
  52. package/dist/components/ui/LoadingIndicator.js +1 -1
  53. package/dist/components/ui/RPTooltip.js +687 -329
  54. package/dist/contexts/PaginationContext.js +1 -1
  55. package/dist/contexts/PrintContext.js +1 -1
  56. package/dist/contexts/RenderQueueProvider.js +1 -1
  57. package/dist/contexts/SearchContext.js +1 -1
  58. package/dist/contexts/ThumbnailsContext.js +1 -1
  59. package/dist/floating-ui.react-dom-bbd2b1a7.js +1330 -0
  60. package/dist/index-54351a14.js +1995 -0
  61. package/dist/index-94df4e25.js +139 -0
  62. package/dist/index-e620205e.js +172 -0
  63. package/dist/main.js +23 -29
  64. package/dist/types/main.d.ts +0 -3
  65. package/dist/types/utils/calculatePage.d.ts +0 -7
  66. package/dist/types/utils/hooks/useVirtualReactWindow.d.ts +0 -8
  67. package/dist/utils/calculatePage.js +5 -12
  68. package/dist/utils/getScrollDistance.js +2 -2
  69. package/dist/utils/hooks/useFileDownload.js +3 -3
  70. package/dist/utils/hooks/useLicense.js +1 -1
  71. package/dist/utils/hooks/usePaginate.js +3 -3
  72. package/dist/utils/hooks/usePresentPage.js +3 -3
  73. package/dist/utils/hooks/usePrint.js +3 -3
  74. package/dist/utils/hooks/useScrollToPage.js +4 -5
  75. package/dist/utils/hooks/useSearch.js +3 -3
  76. package/dist/utils/hooks/useThumbnail.js +3 -3
  77. package/dist/utils/hooks/useVirtualReactWindow.js +4 -5
  78. package/package.json +1 -1
  79. package/dist/LayoutWrapper-e99afee2.js +0 -19
  80. package/dist/RotateTool.module-03987eba.js +0 -6
  81. package/dist/ToolbarLayout.module-c014f04b.js +0 -3389
  82. package/dist/components/layout/toolbar/tools/DocumentPropertiesTool.js +0 -28
  83. package/dist/components/layout/toolbar/tools/RotateClockwiseTool.js +0 -17
  84. package/dist/components/layout/toolbar/tools/RotateCounterclockwiseTool.js +0 -25
  85. package/dist/floating-ui.react-dom-88a86594.js +0 -1447
  86. package/dist/index-48ca3f30.js +0 -307
  87. package/dist/index-4ba3ab9a.js +0 -1877
  88. package/dist/types/components/layout/toolbar/tools/DocumentPropertiesTool.d.ts +0 -3
  89. package/dist/types/components/layout/toolbar/tools/RotateClockwiseTool.d.ts +0 -3
  90. package/dist/types/components/layout/toolbar/tools/RotateCounterclockwiseTool.d.ts +0 -3
@@ -1,3389 +0,0 @@
1
- import { jsx as a, Fragment as pe, jsxs as H } from "react/jsx-runtime";
2
- import * as X from "react";
3
- import { useRef as W, useEffect as D, useCallback as E, useState as q, useMemo as M, createContext as $e, useContext as qe, useImperativeHandle as on, createElement as Ve, PureComponent as oo, Component as ro, memo as rn, forwardRef as io } from "react";
4
- import { ChevronUpIcon as Ze } from "./components/icons/ChevronUpIcon.js";
5
- import { UIButton as ge } from "./components/ui/Button.js";
6
- import { UIInput as an } from "./components/ui/Input.js";
7
- import { ViewMode as Re, ScrollMode as ne, AnnotationSubType as Dt, SelectionMode as ao, ErrorType as so } from "./utils/types.js";
8
- import { useScrollModeContext as Ee } from "./contexts/ScrollModeContext.js";
9
- import { useDocumentContext as oe } from "./contexts/RPDocumentContext.js";
10
- import { useDocumentPasswordContext as co } from "./contexts/DocumentPasswordContext.js";
11
- import { useDarkModeContext as lo } from "./contexts/DarkModeContext.js";
12
- import "./contexts/RotationContext.js";
13
- import { useLayerContext as uo } from "./contexts/LayerContext.js";
14
- import { useZoomContext as wt } from "./contexts/ZoomContext.js";
15
- import { useViewModeContext as Fe } from "./contexts/ViewModeContext.js";
16
- import { useVirtualScrollContext as Ye } from "./contexts/VirtualScrollContext.js";
17
- import { useVirtualGridContext as sn } from "./contexts/VirtualGridContext.js";
18
- import { useSelectionModeContext as po } from "./contexts/SelectionModeContext.js";
19
- import { useInitialStateContext as ho } from "./contexts/InitialStateContext.js";
20
- import { useFullScreenContext as fo } from "./contexts/FullScreenContext.js";
21
- import "./contexts/FileInputContext.js";
22
- import "./contexts/DropFileZoneContext.js";
23
- import { findMatches as mo, resetDivs as go, highlightMatches as vo, isMatchEntireWord as wo } from "./utils/highlight.js";
24
- import { useLayoutContainer as _e } from "./contexts/LayoutContainerContext.js";
25
- import { useDimensionPagesContext as Ge } from "./contexts/DimensionPagesContext.js";
26
- import { useLocalizationContext as he } from "./contexts/LocalizationContext.js";
27
- import { useHighlightContext as _o } from "./contexts/HighlightContext.js";
28
- import "./contexts/LicenseContext.js";
29
- import { useDownloadContext as bo } from "./contexts/DownloadContext.js";
30
- import { useSmoothScrollContext as cn } from "./contexts/SmoothScrollContext.js";
31
- import "./contexts/ElementPageContext.js";
32
- import { usePagesRotateContext as Je } from "./contexts/PagesRotateContext.js";
33
- import { Queue as To } from "./utils/Queue.js";
34
- import { renderPage as Co } from "./utils/renderPage.js";
35
- import { useGlobalCurrentPage as Po } from "./contexts/GlobalCurrentPage.js";
36
- import { useLoaderContext as _t } from "./contexts/LoaderContext.js";
37
- import { useToolComponentContext as Ne } from "./contexts/ToolComponentContext.js";
38
- import { useIconToolContext as be } from "./contexts/IconToolContext.js";
39
- import { useOtherToolContext as yo } from "./contexts/OtherToolContext.js";
40
- import "./components/RPConfig.js";
41
- import { ThumbnailIcon as xo } from "./components/icons/Thumbnail.js";
42
- import { c as se } from "./clsx-0c6e471a.js";
43
- import { LoaderIcon as ln } from "./components/icons/LoaderIcon.js";
44
- import { Container as So } from "./components/layout/Container.js";
45
- import { useViewportContext as Oe, ViewportProvider as Io } from "./contexts/ViewportContext.js";
46
- import { useToolbarComponentContext as Te, ToolbarComponentProvider as Ro } from "./contexts/ToolbarComponentContext.js";
47
- import { RPSplitter as Lo } from "./components/layout/sidebar/RPSplitter.js";
48
- import { WrapperLayout as Eo } from "./components/layout/WrapperLayout.js";
49
- import { c as we, L as No } from "./LayoutWrapper-e99afee2.js";
50
- import { useThemeContext as Oo } from "./contexts/ThemeContext.js";
51
- import { RPDropFileZone as Do } from "./components/RPDropFileZone.js";
52
- import { c as te, S as At } from "./SearchCloseButton-cbf182aa.js";
53
- import { UICheckbox as zt } from "./components/ui/Checkbox.js";
54
- import { useIconContext as Ce, IconProvider as Ao } from "./contexts/IconContext.js";
55
- import Q from "./components/ui/RPTooltip.js";
56
- import { UIDropDown as dn } from "./components/ui/DropDown.js";
57
- import "./ZoomTool.module-6c5eabbb.js";
58
- import { MenuItem as Xe } from "./components/layout/toolbar/MenuItem.js";
59
- import { MenuSeparator as un } from "./components/layout/toolbar/MenuSeparator.js";
60
- import { dateFormatter as Ft } from "./utils/dateFormatter.js";
61
- import { PropertyItem as zo } from "./components/layout/toolbar/PropertyItem.js";
62
- import "./RotateTool.module-03987eba.js";
63
- import { withRef as et } from "./utils/withRef.js";
64
- import { useInfiniteScroll as Fo } from "./utils/hooks/useInfiniteScroll.js";
65
- import { THUMBNAIL_MIN_WIDTH as Mo } from "./utils/constants.js";
66
- import * as ko from "pdfjs-dist";
67
- import { PixelsPerInch as Wo, AnnotationMode as Ho, RenderingCancelledException as $o, AnnotationLayer as qo } from "pdfjs-dist";
68
- import { SimpleLinkService as Go } from "./utils/link_service.js";
69
- import { annotationsEvents as Uo, annotationEventsHandler as Vo, handleClick as Mt, handleAnnotationWidget as Bo, handleAnnotationLink as jo, bindLayerEvents as Ko, unbindLayerEvents as kt } from "./utils/annotations.js";
70
- import { normalizeSingleKeyword as Zo, sortHighlightPosition as Xo, unwrap as Qo } from "./components/page/searchHighlight.js";
71
- import { CustomElement as Yo } from "./components/page/CustomElement.js";
72
- import { getGridDimension as bt, getPositionFromPage as Jo, getPageFromPosition as er } from "./utils/calculatePage.js";
73
- import { useMousePressed as tr } from "./utils/hooks/useMousePressed.js";
74
- import { useGrabScroll as nr } from "./utils/hooks/useGrabScroll.js";
75
- import { usePinch as or } from "./utils/hooks/usePinch.js";
76
- import { useDebounce as Tt } from "./utils/hooks/useDebounce.js";
77
- import rr from "./components/ui/PasswordModal.js";
78
- import { getScrollDistance as ze } from "./utils/getScrollDistance.js";
79
- import { getWordPositionInPage as ir } from "./utils/getWordPositionInPage.js";
80
- import { getThumbnailViewport as ar } from "./utils/getThumbnailViewport.js";
81
- import { smoothScrollTo as it } from "./utils/smoothScrollTo.js";
82
- import { appConsole as sr } from "./utils/appConsole.js";
83
- import { FileUploadTool as pn } from "./components/layout/toolbar/FileUploadTool.js";
84
- import { DarkModeTool as cr } from "./components/layout/toolbar/DarkModeTool.js";
85
- import { ThreeDotIcon as lr } from "./components/icons/ThreeDotIcon.js";
86
- import { c as dr, u as Ct, P as Ue, b as He, d as Pt, i as ur, k as pr, a as hr } from "./index-48ca3f30.js";
87
- import { D as fr, d as at } from "./floating-ui.react-dom-88a86594.js";
88
- import { a as mr, h as gr, u as vr, F as wr, b as _r, G as hn } from "./index-4ba3ab9a.js";
89
- import { CloseIcon as br } from "./components/icons/CloseIcon.js";
90
- import { DocumentProperties as Tr } from "./components/layout/toolbar/DocumentProperties.js";
91
- import { RotateTool as Cr } from "./components/layout/toolbar/RotateTool.js";
92
- import { ViewModeTool as Pr } from "./components/layout/toolbar/ViewModeTool.js";
93
- import { ScrollModeTool as yr } from "./components/layout/toolbar/ScrollModeTool.js";
94
- import { FileDownloadDefaultIcon as xr } from "./components/icons/FileDownloadDefaultIcon.js";
95
- import { PrintDefaultTool as Sr } from "./components/icons/PrintDefaultIcon.js";
96
- import { FullScreenTool as fn } from "./components/layout/toolbar/FullScreenTool.js";
97
- import { GoToDownIcon as mn } from "./components/icons/GoToDownIcon.js";
98
- import { SelectionModeTool as Ir } from "./components/layout/toolbar/SelectionModeTool.js";
99
- import { ZoomTool as Rr } from "./components/layout/toolbar/ZoomTool.js";
100
- import { SearchIcon as gn } from "./components/icons/SearchIcon.js";
101
- import { ClearIcon as Lr } from "./components/icons/ClearIcon.js";
102
- import { InfoIcon as Wt } from "./components/icons/InfoIcon.js";
103
- import './assets/ToolbarLayout.css';const vn = () => {
104
- const { viewMode: t } = Fe(), { scrollMode: e } = Ee(), { virtualScrollRef: n, virtualScrollableElementRef: r, pageScrollElementRef: o } = Ye(), { setFocusedPage: i } = le(), c = W(), { columnCount: l } = sn(), { widths: d, heights: f } = Ge(), m = W(e), P = W(t), h = W(l), { targetScrollPage: T } = cn();
105
- D(() => {
106
- n != null && n.scrollToItem && (c.current = n);
107
- }, [n]), D(() => {
108
- m.current = e, P.current = t;
109
- }, [e, t]);
110
- const C = E(
111
- (v, y) => {
112
- if (!o)
113
- return;
114
- const g = Math.ceil(v / 2) * 2 - 1;
115
- if (v === g + 1) {
116
- const u = {
117
- left: d[g],
118
- top: 0
119
- };
120
- return new Promise(
121
- (s) => it(o, u, s)
122
- );
123
- }
124
- const p = {
125
- left: 0,
126
- top: 0
127
- };
128
- return o == null ? void 0 : o.scrollTo({
129
- ...p,
130
- behavior: y
131
- });
132
- },
133
- [o, d, it]
134
- );
135
- return D(() => {
136
- m.current = e, P.current = t;
137
- }, [e, t]), D(() => {
138
- h.current = l;
139
- }, [l]), { scrollToPage: E(
140
- (v, y = "smooth") => {
141
- i(v);
142
- const g = v - 1;
143
- let p = g, u = 0;
144
- if (P.current === Re.DUAL_PAGE && m.current === ne.PAGE_SCROLLING) {
145
- C(v, y);
146
- return;
147
- }
148
- if (m.current === ne.PAGE_SCROLLING) {
149
- i(v);
150
- return;
151
- }
152
- if (!c.current || !r)
153
- return;
154
- const s = r;
155
- y === "smooth" && (T.current = v);
156
- const { columnsWidth: _, rowsHeight: w } = bt(
157
- { widths: d, heights: f },
158
- l
159
- );
160
- if (m.current === ne.HORIZONTAL_SCROLLING) {
161
- u = g;
162
- const S = {
163
- left: ze(_, u),
164
- top: 0
165
- };
166
- return s.scrollTo({
167
- ...S,
168
- behavior: y
169
- });
170
- }
171
- if (P.current === Re.DUAL_PAGE) {
172
- u = g % 2, p = Math.floor(g / 2);
173
- const S = {
174
- left: ze(_, u),
175
- top: ze(w, p)
176
- };
177
- return s.scrollTo({
178
- ...S,
179
- behavior: y
180
- });
181
- }
182
- const x = {
183
- left: 0,
184
- top: ze(w, p)
185
- };
186
- return s.scrollTo({
187
- ...x,
188
- behavior: y
189
- });
190
- },
191
- [
192
- r,
193
- l,
194
- C,
195
- i,
196
- it,
197
- f,
198
- d
199
- ]
200
- ) };
201
- }, Er = (t = 1) => {
202
- const [e, n] = q(t), [r, o] = q(0), { scrollToPage: i } = vn(), c = W(1), { viewMode: l } = Fe(), { scrollMode: d } = Ee(), { widths: f } = Ge(), { pagesRef: m } = _e(), P = Tt(e, 100), h = E(
203
- (p) => {
204
- if (!/^[0-9]*$/g.test(p.toString()) || !p)
205
- return { success: !1, currentPage: c.current };
206
- const s = +p;
207
- return s < 0 || s > r ? { success: !1, currentPage: c.current } : (n(s), c.current = s, { success: !0, currentPage: +p });
208
- },
209
- [r]
210
- ), T = E(h, [h]), C = E(
211
- (p) => {
212
- const u = h(p);
213
- return u.success && i(u.currentPage), u;
214
- },
215
- [h, i]
216
- ), b = E((p) => {
217
- const u = p % 2 === 1;
218
- if (!m || u)
219
- return !1;
220
- const s = u ? f[p] : f[p - 1], _ = u ? f[p + 1] : f[p];
221
- return l === Re.DUAL_PAGE && s + _ < m.clientWidth;
222
- }, [l, f, m, r]), v = E(() => {
223
- let p = e - 1;
224
- b(p) && (p = e - 2), C(p);
225
- }, [C, e, l, d, b]), y = M(() => l === Re.DUAL_PAGE && d === ne.PAGE_SCROLLING ? e === r - 1 : e === r, [e, r, l, d]), g = E(() => {
226
- if (y)
227
- return;
228
- let p = e + 1;
229
- b(p) && (p = e + 2), C(p);
230
- }, [C, e, b, l, d, y]);
231
- return {
232
- focusedPage: P,
233
- totalPages: r,
234
- setFocusedPage: T,
235
- setTotalPages: o,
236
- nextPage: g,
237
- prevPage: v,
238
- goToPage: C
239
- };
240
- }, wn = $e({
241
- focusedPage: 0,
242
- setFocusedPage: (t) => {
243
- },
244
- goToPage: (t) => ({ success: !!t, currentPage: +t }),
245
- totalPages: 0,
246
- setTotalPages: (t) => {
247
- },
248
- prevPage: () => {
249
- },
250
- nextPage: () => {
251
- }
252
- }), le = () => {
253
- const t = qe(wn);
254
- return typeof (t == null ? void 0 : t.focusedPage) > "u" && sr.error("Please use this hooks inside children component of RPProvider"), t;
255
- }, Ks = ({ children: t }) => {
256
- const { pdf: e } = oe(), { setCurrentPage: n } = Po(), { focusedPage: r, totalPages: o, setFocusedPage: i, setTotalPages: c, goToPage: l, nextPage: d, prevPage: f } = Er();
257
- return D(() => {
258
- e != null && e.numPages && (c(e.numPages), i(1));
259
- }, [e, c, i]), D(() => {
260
- n(r);
261
- }, [r, n]), /* @__PURE__ */ a(
262
- wn.Provider,
263
- {
264
- value: {
265
- focusedPage: r,
266
- totalPages: o,
267
- setFocusedPage: i,
268
- setTotalPages: c,
269
- nextPage: d,
270
- prevPage: f,
271
- goToPage: l
272
- },
273
- children: t
274
- }
275
- );
276
- };
277
- const Nr = () => {
278
- const { pdf: t, pages: e } = oe(), [n, r] = q({
279
- loadedPages: 0,
280
- totalPages: 0,
281
- percentage: 0
282
- }), [o, i] = q(!1), [c, l] = q(!1), [d, f] = q(null), m = W(!1);
283
- D(() => {
284
- m.current;
285
- }, [m]);
286
- const P = E(() => {
287
- document.documentElement.classList.remove("rp-print-html-printing"), document.body.classList.remove("rp-print-body-printing");
288
- const p = document.querySelector(".rp-print-zone");
289
- p && p.remove();
290
- }, []), h = E(() => {
291
- m.current = !1, i(!1), l(!1), f(null), r({
292
- loadedPages: 0,
293
- totalPages: 0,
294
- percentage: 0
295
- });
296
- }, []), T = () => {
297
- m.current = !0;
298
- }, C = async ({
299
- scratchCanvas: p,
300
- pdfDocument: u,
301
- pageNumber: s,
302
- viewerPdfPage: _,
303
- printResolution: w,
304
- optionalContentConfigPromise: x,
305
- printAnnotationStoragePromise: I
306
- }) => {
307
- if (m.current) {
308
- h();
309
- return;
310
- }
311
- const S = w / Wo.PDF;
312
- p.width = Math.floor(_.width * S), p.height = Math.floor(_.height * S);
313
- const R = p.getContext("2d");
314
- R.save(), R.fillStyle = "rgb(255, 255, 255)", R.fillRect(0, 0, p.width, p.height), R.restore();
315
- const [N, A] = await Promise.all([
316
- u.getPage(s),
317
- I
318
- ]);
319
- if (m.current) {
320
- h();
321
- return;
322
- }
323
- const z = {
324
- canvasContext: R,
325
- transform: [S, 0, 0, S, 0, 0],
326
- viewport: N.getViewport({ scale: 1, rotation: _.rotation }),
327
- intent: "print",
328
- annotationMode: Ho.ENABLE_STORAGE,
329
- optionalContentConfigPromise: x,
330
- printAnnotationStorage: A
331
- };
332
- try {
333
- return N.render(z).promise;
334
- } catch (L) {
335
- throw L instanceof $o || console.error(L), L;
336
- }
337
- }, b = E(() => {
338
- const p = window.print;
339
- return new Promise((u) => {
340
- const s = (x) => {
341
- setTimeout(() => {
342
- p.call(window), setTimeout(() => x(), 20);
343
- }, 0);
344
- };
345
- if (document.querySelector(".rp-print-zone")) {
346
- s(u);
347
- return;
348
- }
349
- const w = new MutationObserver(() => {
350
- document.querySelector(".rp-print-zone") && (s(u), w.disconnect());
351
- });
352
- w.observe(document.body, { childList: !0, subtree: !0 });
353
- });
354
- }, []), v = async (p) => {
355
- const u = document.createElement("img"), s = document.createElement("div");
356
- return s.classList.add("rp-print-page"), await new Promise((_, w) => {
357
- p.toBlob((x) => {
358
- x ? (u.src = URL.createObjectURL(x), u.onload = () => {
359
- URL.revokeObjectURL(u.src), _();
360
- }, u.onerror = w) : w(new Error("Failed to create blob"));
361
- });
362
- }).catch(() => {
363
- }), s.appendChild(u), s;
364
- }, y = (p, u) => {
365
- const s = document.createElement("div");
366
- s.classList.add("rp-print-zone");
367
- const _ = document.createElement("style"), w = u.get(1);
368
- if (w) {
369
- const { width: x, height: I } = w == null ? void 0 : w.page.getViewport({ scale: 1 });
370
- _.innerHTML = `@page { size: ${x}px ${I}px }`;
371
- }
372
- return s.appendChild(_), s.append(...p), s;
373
- }, g = E(async () => {
374
- if (!t)
375
- return;
376
- h();
377
- const p = document.createElement("canvas"), u = [];
378
- try {
379
- t.isPureXfa && console.warn("[rp] XFA Form is not supported at the moment.");
380
- const _ = t.getOptionalContentConfig({ intent: "print" }), w = Promise.resolve(
381
- t.annotationStorage.print ?? void 0
382
- ), x = e.size;
383
- for (const [S, R] of e) {
384
- if (m.current) {
385
- h();
386
- return;
387
- }
388
- const N = R.page.getViewport({ scale: 1 });
389
- if (await C({
390
- scratchCanvas: p,
391
- pdfDocument: t,
392
- pageNumber: S,
393
- viewerPdfPage: N,
394
- printResolution: 150,
395
- optionalContentConfigPromise: _,
396
- printAnnotationStoragePromise: w
397
- }), m.current) {
398
- h();
399
- return;
400
- }
401
- const A = await v(p);
402
- u.push(A);
403
- const z = parseFloat((u.length / x * 100).toFixed(2));
404
- r({
405
- loadedPages: S,
406
- totalPages: x,
407
- percentage: z
408
- });
409
- }
410
- if (m.current) {
411
- h();
412
- return;
413
- }
414
- const I = y(u, e);
415
- document.body.appendChild(I), document.documentElement.classList.add("rp-print-html-printing"), document.body.classList.add("rp-print-body-printing"), i(!0), await b();
416
- } catch (s) {
417
- l(!0), s instanceof Error && f(s);
418
- } finally {
419
- p.height = 0, p.width = 0;
420
- }
421
- }, [t, e, m]);
422
- return D(() => {
423
- const p = () => {
424
- h(), P();
425
- };
426
- return window.addEventListener("afterprint", p, !0), () => {
427
- window.removeEventListener("afterprint", p, !0);
428
- };
429
- }, [P, h]), {
430
- print: g,
431
- cancel: T,
432
- progress: n,
433
- isComplete: o,
434
- isError: c,
435
- error: d
436
- };
437
- }, _n = $e({
438
- print: () => {
439
- },
440
- cancel: () => {
441
- },
442
- setOnProgress: (t) => {
443
- },
444
- progress: {},
445
- setOnComplete: (t) => t(),
446
- setOnError: (t) => {
447
- try {
448
- const e = new Error("Print error occurred");
449
- t(e);
450
- } catch (e) {
451
- console.error("Error in setOnError callback:", e);
452
- }
453
- }
454
- }), Zs = ({ children: t }) => {
455
- const [e, n] = q(null), [r, o] = q(null), { print: i, cancel: c, progress: l, isComplete: d, isError: f, error: m } = Nr(), P = E((v) => {
456
- v && typeof v == "function" && o(() => v);
457
- }, []), h = (v) => {
458
- m && v(m);
459
- }, T = E(
460
- (v) => {
461
- n(() => v);
462
- },
463
- [l, e]
464
- );
465
- D(() => {
466
- d && r && C();
467
- }, [d, r]), D(() => {
468
- f && h((v) => {
469
- console.error(v);
470
- });
471
- }, [f]), D(() => {
472
- l && e && e(l);
473
- }, [l, e]);
474
- const C = () => {
475
- r && (r(), o(null));
476
- }, b = {
477
- print: i,
478
- cancel: c,
479
- setOnProgress: T,
480
- setOnComplete: P,
481
- setOnError: h,
482
- progress: l
483
- };
484
- return /* @__PURE__ */ a(_n.Provider, { value: b, children: t });
485
- }, tt = () => {
486
- const t = qe(_n);
487
- if (!t)
488
- throw new Error("usePrintContext must be used within a PrintProvider");
489
- return t;
490
- }, Or = () => {
491
- const [t, e] = q({}), { pages: n } = oe(), r = M(() => Object.keys(t).length, [t]), o = E(
492
- (c) => {
493
- if (!n.size)
494
- return;
495
- const l = c > n.size ? n.size : c, f = Array.from(n.values()).slice(0, l).map((m) => {
496
- const { thumbnailViewport: P, scale: h } = ar(m.page, m.defaultRotation);
497
- return {
498
- scale: h,
499
- page: m.page,
500
- loading: !0,
501
- viewport: P,
502
- defaultRotation: m.defaultRotation
503
- };
504
- }).reduce((m, P) => (m[P.page.pageNumber] = P, m), {});
505
- e(f);
506
- },
507
- [n]
508
- );
509
- D(() => {
510
- o(10);
511
- }, [o]);
512
- const i = E(
513
- (c) => {
514
- if (!n)
515
- return;
516
- const l = n.get(c);
517
- l && e((d) => ({
518
- ...d,
519
- [c]: {
520
- loading: !0,
521
- page: l.page,
522
- viewport: l.thumbnailViewport,
523
- scale: l.thumbnailScale,
524
- defaultRotation: l.defaultRotation
525
- }
526
- }));
527
- },
528
- [n]
529
- );
530
- return { thumbnailPages: t, addPage: i, addToPage: o, thumbnailLength: r };
531
- }, bn = $e({
532
- thumbnailPages: {},
533
- addPage: (t) => {
534
- },
535
- addToPage: (t) => {
536
- },
537
- thumbnailLength: 0,
538
- setActive: (t) => {
539
- },
540
- active: !1
541
- }), Tn = () => qe(bn), Xs = ({
542
- children: t,
543
- initialThumbnailsVisible: e
544
- }) => {
545
- const { thumbnailPages: n, addPage: r, addToPage: o, thumbnailLength: i } = Or(), [c, l] = q(e);
546
- return /* @__PURE__ */ a(
547
- bn.Provider,
548
- {
549
- value: { thumbnailPages: n, addPage: r, addToPage: o, thumbnailLength: i, active: c, setActive: l },
550
- children: t
551
- }
552
- );
553
- }, Dr = (t = {}, e = "") => {
554
- const [n, r] = q(e), [o, i] = q(!1), { pdf: c, pages: l } = oe(), { widths: d, heights: f } = Ge(), m = W(!n), { currentZoom: P } = wt(), [h, T] = q([]), { setFocusedPage: C } = le(), { columnCount: b } = Fe(), { pageRotate: v } = Je(), [y, g] = q(0), { pageScrollElementRef: p, virtualScrollableElementRef: u } = Ye(), { scrollMode: s } = Ee(), { pagesRef: _ } = _e(), [w, x] = q(null), I = W({}), S = M(() => y === 0 ? null : h[y - 1], [y, h]), R = M(() => h.length, [h]);
555
- D(() => {
556
- if (!S || !l)
557
- return;
558
- const L = u || p;
559
- if (!L || !_)
560
- return;
561
- const O = l.get(S.page);
562
- if (s === ne.PAGE_SCROLLING && C(S.page), !O)
563
- return;
564
- let F = 0, $ = 0;
565
- if (s === ne.VERTICAL_SCROLLING) {
566
- const J = S.page - 1, ee = b, re = J % ee, ve = Math.floor(J / ee);
567
- F = ze(f, ve), $ = ze(d, re);
568
- }
569
- s === ne.HORIZONTAL_SCROLLING && ($ = d.slice(0, S.page - 1).reduce((J, ee) => J + ee, 0));
570
- const k = {
571
- height: f[S.page - 1],
572
- width: d[S.page - 1]
573
- }, B = {
574
- top: k.height / 2,
575
- left: k.width / 2
576
- }, Z = v[S.page], { leftInPage: U, topInPage: ie } = ir(
577
- k,
578
- B,
579
- S.rect,
580
- P,
581
- Z
582
- ), G = $ + U, K = F + ie, Y = {
583
- left: Math.max(G, 0),
584
- top: Math.max(K, 0)
585
- };
586
- L.scrollTo({
587
- ...Y,
588
- behavior: "smooth"
589
- });
590
- }, [
591
- l,
592
- C,
593
- d,
594
- f,
595
- S,
596
- s,
597
- u,
598
- p,
599
- _
600
- ]);
601
- const N = E(() => {
602
- g((L) => R ? L + 1 > R ? 1 : L + 1 : 0);
603
- }, [R]), A = E(() => {
604
- g((L) => R ? L - 1 <= 0 ? R : L - 1 : 0);
605
- }, [R]), z = E(async (L) => {
606
- if (!L)
607
- return {};
608
- const O = L.numPages, F = {};
609
- for (let $ = 1; $ <= O; $++) {
610
- if (m.current)
611
- throw "close pop over";
612
- const k = await L.getPage($);
613
- F[$.toString()] = await k.getTextContent();
614
- }
615
- return F;
616
- }, []);
617
- return D(() => {
618
- if (!n) {
619
- m.current = !0, T([]), g(0);
620
- return;
621
- }
622
- m.current = !1, i(!0), T([]), g(0), z(c).then((L) => {
623
- I.current = L;
624
- const F = Object.keys(L).reduce(($, k) => {
625
- const B = mo(
626
- [n],
627
- L[k],
628
- Number(k) - 1,
629
- t
630
- ).map((Z, U) => ({ ...Z, page: Number(k), pageMatchIdx: U }));
631
- return [...$, ...B];
632
- }, []);
633
- T(F), g(F.length ? 1 : 0);
634
- }).catch(() => {
635
- T([]), g(0);
636
- }).finally(() => i(!1));
637
- }, [n, z, c, t]), {
638
- search: n,
639
- setSearch: r,
640
- loading: o,
641
- matches: h,
642
- totalMatches: R,
643
- currentMatchPosition: y,
644
- currentMatch: S,
645
- nextMatch: N,
646
- prevMatch: A,
647
- currentMatchElement: w,
648
- setCurrentMatchElement: x
649
- };
650
- }, Cn = $e({
651
- search: "",
652
- setSearch: (t) => {
653
- },
654
- loading: !1,
655
- matches: [],
656
- totalMatches: 0,
657
- currentMatchPosition: 0,
658
- currentMatch: null,
659
- nextMatch: () => {
660
- },
661
- prevMatch: () => {
662
- },
663
- searchOptions: {},
664
- setSearchOptions: (t) => t,
665
- currentMatchElement: null,
666
- setCurrentMatchElement: (t) => {
667
- }
668
- }), Qs = ({
669
- children: t,
670
- initialSearch: e
671
- }) => {
672
- const [n, r] = q({}), {
673
- loading: o,
674
- setSearch: i,
675
- totalMatches: c,
676
- currentMatchPosition: l,
677
- currentMatch: d,
678
- search: f,
679
- matches: m,
680
- nextMatch: P,
681
- prevMatch: h,
682
- currentMatchElement: T,
683
- setCurrentMatchElement: C
684
- } = Dr(n, e);
685
- return /* @__PURE__ */ a(
686
- Cn.Provider,
687
- {
688
- value: {
689
- searchOptions: n,
690
- setSearchOptions: r,
691
- loading: o,
692
- setSearch: i,
693
- totalMatches: c,
694
- currentMatchPosition: l,
695
- currentMatch: d,
696
- nextMatch: P,
697
- prevMatch: h,
698
- search: f,
699
- matches: m,
700
- currentMatchElement: T,
701
- setCurrentMatchElement: C
702
- },
703
- children: t
704
- }
705
- );
706
- }, yt = () => qe(Cn), Pn = $e(null), Ys = ({ children: t }) => {
707
- const e = W(!1), [n, r] = q([]), o = E((d) => {
708
- r((f) => [...f, { id: d.page.pageNumber.toString(), data: d, priority: 0 }]);
709
- }, []), i = M(() => new To(o), [o]), { focusedPage: c } = le(), l = E((d) => (e.current = !0, Co(
710
- d.data.page,
711
- d.data.canvasElem,
712
- d.data.options
713
- ).promise.then(() => {
714
- d.data.canvasElem.hidden = !1;
715
- }).finally(() => {
716
- d.data.onLoaded && d.data.onLoaded();
717
- })), []);
718
- return D(() => {
719
- c && (i.changePagePriority(`^page-${c}`, 0), i.changePagePriority(`^thumbnail-${c}`, 1));
720
- }, [c]), D(() => {
721
- if (i.isEmpty() || e.current)
722
- return;
723
- const d = () => {
724
- const f = i.dequeue();
725
- f ? l(f).finally(() => {
726
- d();
727
- }) : (e.current = !1, r(i.peekAll()));
728
- };
729
- d();
730
- }, [i, l, n]), /* @__PURE__ */ a(Pn.Provider, { value: i, children: t });
731
- }, yn = () => {
732
- const t = qe(Pn);
733
- if (!t)
734
- throw new Error("RenderQueue not found");
735
- return t;
736
- }, ae = {
737
- "rp-pages": "_rp-pages_1fvmx_1",
738
- "rp-page-scrolling-wrapper": "_rp-page-scrolling-wrapper_1fvmx_6",
739
- "rp-pages-horizontal-scroll": "_rp-pages-horizontal-scroll_1fvmx_11",
740
- "rp-pages-container": "_rp-pages-container_1fvmx_15",
741
- "rp-viewer": "_rp-viewer_1fvmx_57",
742
- "rp-cursor-grab": "_rp-cursor-grab_1fvmx_62",
743
- "rp-cursor-grabbing": "_rp-cursor-grabbing_1fvmx_70",
744
- "rp-loader": "_rp-loader_1fvmx_78",
745
- "rp-not-supported": "_rp-not-supported_1fvmx_86",
746
- "rp-not-supported-content": "_rp-not-supported-content_1fvmx_102"
747
- }, st = {
748
- "rp-page-wrapper": "_rp-page-wrapper_14ohm_1",
749
- "rp-page": "_rp-page_14ohm_1",
750
- "rp-loader-wrapper": "_rp-loader-wrapper_14ohm_15"
751
- }, Ar = (t) => {
752
- const { pageNumber: e, onLoaded: n, onLoading: r } = t, o = W(null), { pages: i } = oe(), { pageRotate: c } = Je(), l = W(), { currentZoom: d } = wt(), f = yn(), m = W(`page-${e}`);
753
- return D(() => {
754
- if (!i || d === 0)
755
- return;
756
- const P = i.get(e);
757
- if (o.current && P) {
758
- const h = o.current;
759
- h.hidden = !0;
760
- const T = l.current;
761
- T && T.cancel(), r && r(), f.enqueue(
762
- m.current,
763
- {
764
- page: P.page,
765
- canvasElem: h,
766
- options: {
767
- scale: d,
768
- rotate: c[e],
769
- renderForms: !0
770
- },
771
- onLoaded: n
772
- },
773
- 3
774
- );
775
- }
776
- return () => {
777
- f.removeQueue(m.current);
778
- };
779
- }, [i, e, c, d, r, n, f]), /* @__PURE__ */ a("canvas", { "data-rp": `page-${e}-canvas`, ref: o });
780
- }, zr = "_selecting_1uik2_10", Fr = "_markedContent_1uik2_33", fe = {
781
- "rp-text-layer": "_rp-text-layer_1uik2_1",
782
- selecting: zr,
783
- markedContent: Fr,
784
- "rp-text-layer-text": "_rp-text-layer-text_1uik2_52"
785
- }, Mr = (t) => {
786
- const { pageNumber: e } = t, { pages: n } = oe(), r = W(null), { matches: o, currentMatch: i, setCurrentMatchElement: c } = yt(), [l, d] = q(
787
- []
788
- ), f = W(), m = W(), P = W([]), h = M(() => o.filter((p) => p.pageIndex === e - 1), [o, e]), T = E(
789
- (p, u, s = !1) => {
790
- if (s && go(p, u), !h.length) {
791
- P.current = [], d([]);
792
- return;
793
- }
794
- const _ = vo(h, p, u);
795
- d(_);
796
- },
797
- [h]
798
- ), C = W(), b = W(!1), v = E(() => Array.from(document.querySelectorAll('[data-rp$="-textLayer"]')), []);
799
- D(() => ((() => {
800
- if (C.current)
801
- return;
802
- C.current = new AbortController();
803
- const { signal: u } = C.current, s = () => {
804
- v().forEach((w) => {
805
- const x = w.querySelector(".endOfContent");
806
- x && (w.appendChild(x), x.style.width = "", x.style.height = "", w.classList.remove(fe.selecting));
807
- });
808
- };
809
- document.addEventListener(
810
- "pointerdown",
811
- () => {
812
- b.current = !0;
813
- },
814
- { signal: u }
815
- ), document.addEventListener(
816
- "pointerup",
817
- () => {
818
- b.current = !1, s();
819
- },
820
- { signal: u }
821
- ), window.addEventListener(
822
- "blur",
823
- () => {
824
- b.current = !1, s();
825
- },
826
- { signal: u }
827
- ), document.addEventListener(
828
- "keyup",
829
- () => {
830
- b.current || s();
831
- },
832
- { signal: u }
833
- );
834
- let _ = null;
835
- document.addEventListener(
836
- "selectionchange",
837
- () => {
838
- var z, L;
839
- const w = document.getSelection();
840
- if (!w)
841
- return;
842
- if (w.rangeCount === 0) {
843
- s();
844
- return;
845
- }
846
- const x = /* @__PURE__ */ new Set();
847
- for (let O = 0; O < w.rangeCount; O++) {
848
- const F = w.getRangeAt(O);
849
- v().forEach(($) => {
850
- F.intersectsNode($) && !x.has($) && x.add($);
851
- });
852
- }
853
- v().forEach((O) => {
854
- if (x.has(O))
855
- O.classList.add(fe.selecting);
856
- else {
857
- const F = O.querySelector(".endOfContent");
858
- F && (O.appendChild(F), F.style.width = "", F.style.height = "", O.classList.remove(fe.selecting));
859
- }
860
- });
861
- const I = w.getRangeAt(0);
862
- let R = _ && (I.compareBoundaryPoints(Range.END_TO_END, _) === 0 || I.compareBoundaryPoints(Range.START_TO_END, _) === 0) ? I.startContainer : I.endContainer;
863
- R.nodeType === Node.TEXT_NODE && (R = R.parentNode);
864
- const N = (z = R.parentElement) == null ? void 0 : z.closest(
865
- fe["rp-text-layer"]
866
- ), A = N == null ? void 0 : N.querySelector(".endOfContent");
867
- A && N && (A.style.width = N.style.width, A.style.height = N.style.height, (L = R.parentElement) == null || L.insertBefore(A, R.nextSibling)), _ = I.cloneRange();
868
- },
869
- { signal: u }
870
- );
871
- })(), () => {
872
- var u;
873
- (u = C.current) == null || u.abort(), C.current = void 0;
874
- }), [v]);
875
- const y = E(() => {
876
- r.current && r.current.classList.add(fe.selecting);
877
- }, []), g = E(() => {
878
- r.current && r.current.classList.remove(fe.selecting);
879
- }, []);
880
- return D(() => {
881
- if (P.current.forEach((s) => {
882
- s.classList.remove("selected");
883
- }), !l.length || !i || i.pageIndex !== e - 1)
884
- return;
885
- const p = h.findIndex(
886
- (s) => JSON.stringify(s) === JSON.stringify(i)
887
- );
888
- if (p === -1)
889
- return;
890
- const u = l.filter((s) => s.index === p);
891
- u.length && (P.current = u.map((s) => s.element), c(u[0].element), u.forEach((s) => {
892
- s.element.classList.add("selected");
893
- }));
894
- }, [i, l, h]), D(() => {
895
- const p = n.get(e);
896
- if (!p || !r.current)
897
- return;
898
- const u = r.current;
899
- return f.current && f.current.cancel(), p.page.getTextContent().then((s) => {
900
- const _ = p.page.getViewport({ scale: 1 });
901
- return f.current = new ko.TextLayer({
902
- viewport: _,
903
- textContentSource: s,
904
- container: u
905
- }), m.current = s, u && (u.innerText = ""), f.current.render();
906
- }).then(() => {
907
- var x, I;
908
- [].slice.call(u.children).forEach((S) => {
909
- S.classList.add(fe["rp-text-layer-text"]), S.setAttribute("data-rp", "rp-text-layer-text");
910
- });
911
- const _ = (x = f.current) == null ? void 0 : x.textDivs;
912
- _ && m.current && T(m.current, _);
913
- const w = document.createElement("div");
914
- w.className = "endOfContent", (I = r.current) == null || I.appendChild(w);
915
- }).catch(() => {
916
- }), () => {
917
- var s;
918
- (s = f.current) == null || s.cancel();
919
- };
920
- }, [n, e]), D(() => {
921
- var s;
922
- [].slice.call(r.current.children).forEach((_) => {
923
- _.classList.add(fe["rp-text-layer-text"]);
924
- });
925
- const u = (s = f.current) == null ? void 0 : s.textDivs;
926
- u && m.current && T(m.current, u, !0);
927
- }, [T]), /* @__PURE__ */ a(
928
- "div",
929
- {
930
- "data-rp-text-layer": !0,
931
- "data-rp": `page-${e}-textLayer`,
932
- className: fe["rp-text-layer"],
933
- ref: r,
934
- onMouseDown: y,
935
- onMouseUp: g
936
- }
937
- );
938
- }, kr = {
939
- "rp-annotation-layer": "_rp-annotation-layer_1udza_1"
940
- };
941
- let Wr = "https://unpkg.com/pdfjs-dist@4.4.168/web/images/";
942
- const Hr = (t) => {
943
- const { pageNumber: e } = t, n = W(null), { pages: r, pdf: o } = oe(), i = W(), [c, l] = q(), { setFocusedPage: d, goToPage: f } = le(), { scrollMode: m } = Ee(), { print: P } = tt(), { download: h } = Gn(), T = M(() => r.get(e), [r, e]), C = M(() => T == null ? void 0 : T.page.getViewport(), [T]);
944
- D(() => {
945
- i.current && (i.current.div.replaceChildren(), i.current = void 0);
946
- }, [o]), D(() => {
947
- T && T.page.getAnnotations().then((v) => {
948
- i.current = void 0, l(v), n.current && (n.current.innerText = "");
949
- });
950
- }, [T]);
951
- const b = E(
952
- (v) => {
953
- !c || !o || (Uo(v), Vo(v, o, c).then((y) => {
954
- var g, p;
955
- ((g = y == null ? void 0 : y.data) == null ? void 0 : g.action) === "Print" ? P() : ((p = y == null ? void 0 : y.data) == null ? void 0 : p.action) === "SaveAs" && h();
956
- }), m === ne.PAGE_SCROLLING ? Mt(v, c, o, (y) => d(y.pageIndex + 1)) : Mt(v, c, o, (y) => f(y.pageIndex + 1)));
957
- },
958
- [o, c, f, d, m, P, h]
959
- );
960
- return D(() => {
961
- if (!T || !c)
962
- return;
963
- const v = T.page.getViewport();
964
- if (i.current) {
965
- i.current.update({
966
- viewport: v.clone({ dontFlip: !0 })
967
- });
968
- return;
969
- }
970
- const y = /* @__PURE__ */ new Map([]);
971
- for (const u of c) {
972
- const { annotationType: s } = u;
973
- switch (s) {
974
- case Dt.Link:
975
- jo(u);
976
- break;
977
- case Dt.Widget:
978
- Bo(u, v, y);
979
- break;
980
- }
981
- }
982
- const g = new AbortController();
983
- return (async () => {
984
- var _;
985
- i.current && (i.current.div.replaceChildren(), i.current = void 0), n.current && (n.current.innerText = ""), i.current = new qo({
986
- div: n.current,
987
- accessibilityManager: void 0,
988
- annotationCanvasMap: void 0,
989
- annotationEditorUIManager: void 0,
990
- structTreeLayer: null,
991
- page: T.page,
992
- viewport: v.clone({ dontFlip: !0 })
993
- }), n.current && kt(n.current, b);
994
- const u = await (o == null ? void 0 : o.hasJSActions()), s = await (o == null ? void 0 : o.getFieldObjects());
995
- if (g.signal.aborted)
996
- throw "abort";
997
- return (_ = i.current) == null ? void 0 : _.render({
998
- annotations: c,
999
- annotationStorage: o == null ? void 0 : o.annotationStorage,
1000
- hasJSActions: u,
1001
- fieldObjects: s,
1002
- div: n.current,
1003
- viewport: v.clone({ dontFlip: !0 }),
1004
- page: T.page,
1005
- imageResourcesPath: Wr,
1006
- renderForms: !0,
1007
- linkService: new Go(),
1008
- downloadManager: null,
1009
- enableScripting: !1
1010
- });
1011
- })().then(() => {
1012
- n.current && Ko(n.current, b);
1013
- }).catch((u) => {
1014
- if (u !== "abort")
1015
- throw u;
1016
- }), () => {
1017
- g.abort("clear"), n.current && kt(n.current, b);
1018
- };
1019
- }, [o, c, b]), /* @__PURE__ */ a(
1020
- "div",
1021
- {
1022
- "data-rp": `page-${e}-annotationLayer`,
1023
- style: { width: `${C == null ? void 0 : C.width}px`, height: `${C == null ? void 0 : C.height}px` },
1024
- className: kr["rp-annotation-layer"],
1025
- ref: n
1026
- }
1027
- );
1028
- }, $r = {
1029
- "rp-text-highlight": "_rp-text-highlight_jdkf8_1"
1030
- }, qr = ({ pageNumber: t, viewport: e }) => {
1031
- const [n, r] = q(), { pages: o } = oe(), { highlightKeywords: i } = _o(), c = !0, l = W(null), [d, f] = q(null), [m, P] = q([]);
1032
- D(() => {
1033
- l.current && f(l.current.parentElement);
1034
- }, [l]), D(() => {
1035
- (async () => {
1036
- const p = o.get(t);
1037
- if (!p || !l.current)
1038
- return;
1039
- const u = await p.page.getTextContent();
1040
- r(u);
1041
- })();
1042
- }, [o, t]);
1043
- const h = M(() => i ? i.map((g) => {
1044
- var p, u;
1045
- return {
1046
- ...Zo(g.keyword, (p = g.options) == null ? void 0 : p.matchCase, (u = g.options) == null ? void 0 : u.wholeWords),
1047
- color: g.highlightColor
1048
- };
1049
- }) : [], [i]);
1050
- function T(g, p) {
1051
- if (!g)
1052
- return;
1053
- const u = `[data-rp="page-${p}-textLayer"]`;
1054
- return new Promise((s) => {
1055
- const _ = g.querySelector(u);
1056
- if (_) {
1057
- s(_);
1058
- return;
1059
- }
1060
- new MutationObserver((x, I) => {
1061
- const S = g.querySelector(u);
1062
- S && (s(S), I.disconnect());
1063
- }).observe(g, { childList: !0, subtree: !0 });
1064
- });
1065
- }
1066
- function C(g) {
1067
- return new Promise((p) => {
1068
- const u = g.querySelectorAll(
1069
- '[data-rp="rp-text-layer-text"]'
1070
- );
1071
- if (u.length) {
1072
- p(Array.from(u));
1073
- return;
1074
- }
1075
- new MutationObserver((_, w) => {
1076
- const x = g.querySelectorAll(
1077
- ".rp-text-layer-text"
1078
- );
1079
- x.length && (p(Array.from(x)), w.disconnect());
1080
- }).observe(g, { childList: !0, subtree: !0 });
1081
- });
1082
- }
1083
- const b = (g, p, u, s) => {
1084
- var B;
1085
- const _ = document.createRange(), w = u.firstChild;
1086
- if (!w || w.nodeType !== Node.TEXT_NODE)
1087
- return null;
1088
- const x = ((B = w.textContent) == null ? void 0 : B.length) ?? 0, I = s[0].charIdxInSpan, S = s.length === 1 ? I : s[s.length - 1].charIdxInSpan;
1089
- if (I > x || S + 1 > x)
1090
- return null;
1091
- _.setStart(w, I), _.setEnd(w, S + 1);
1092
- const R = document.createElement("span");
1093
- R.style.width = "auto", _.surroundContents(R);
1094
- const N = R.getBoundingClientRect(), A = g.getBoundingClientRect(), z = A.height, L = A.width, O = 100 * (N.left - A.left) / L, F = 100 * (N.top - A.top) / z, $ = 100 * N.height / z, k = 100 * N.width / L;
1095
- return Qo(R), {
1096
- keywordStr: p,
1097
- left: O,
1098
- top: F,
1099
- height: $,
1100
- width: k,
1101
- pageHeight: z,
1102
- pageWidth: L
1103
- };
1104
- };
1105
- async function v(g, p) {
1106
- const u = await T(d, g);
1107
- if (!u)
1108
- return;
1109
- const s = await C(u);
1110
- if (s.length) {
1111
- const _ = s.map((x) => x.tagName === "BR" ? " " : x.textContent).reduce(
1112
- (x, I, S) => x.concat(
1113
- I.split("").map((R, N) => ({
1114
- char: R,
1115
- charIdxInSpan: N,
1116
- spanIdx: S
1117
- }))
1118
- ),
1119
- [
1120
- {
1121
- char: "",
1122
- charIdxInSpan: 0,
1123
- spanIdx: 0
1124
- }
1125
- ]
1126
- ).slice(1), w = y(u, p, s, _);
1127
- P(w);
1128
- }
1129
- }
1130
- const y = (g, p, u, s) => {
1131
- const _ = p.length;
1132
- if (!s.length || !_)
1133
- return [];
1134
- const w = [], x = s.map((I) => I.char).join("");
1135
- return h.forEach((I) => {
1136
- const { keyword: S, regExp: R, wholeWords: N, color: A } = I, z = S;
1137
- if (!z.trim())
1138
- return;
1139
- const L = R.flags.indexOf("g") === -1 ? new RegExp(R, `${R.flags}g`) : R;
1140
- let O;
1141
- const F = [];
1142
- for (; (O = L.exec(x)) !== null; )
1143
- N && !wo(x, O.index, O[0].length) || F.push({
1144
- keyword: L,
1145
- startIndex: O.index,
1146
- endIndex: L.lastIndex
1147
- });
1148
- const $ = F.map((k) => ({
1149
- keyword: k.keyword,
1150
- indexes: s.slice(k.startIndex, k.endIndex),
1151
- color: A
1152
- }));
1153
- for (const k of $) {
1154
- const B = k.indexes.reduce(
1155
- (Z, U) => (Z[U.spanIdx] = (Z[U.spanIdx] || []).concat([U]), Z),
1156
- {}
1157
- );
1158
- for (const Z of Object.values(B))
1159
- if (Z.length !== 1 || Z[0].char.trim() !== "") {
1160
- const U = Z, ie = u[U[0].spanIdx], G = b(
1161
- g,
1162
- z,
1163
- ie,
1164
- U
1165
- );
1166
- if (G) {
1167
- const { left: K, top: Y } = G;
1168
- if (w.find((ee) => ee.left === K && ee.top === Y))
1169
- continue;
1170
- w.push({ ...G, highlightColor: k.color });
1171
- }
1172
- }
1173
- }
1174
- }), w.sort(Xo), w;
1175
- };
1176
- return D(() => {
1177
- (async () => {
1178
- if (!(!i || i.length === 0))
1179
- try {
1180
- await v(t, i);
1181
- } catch (p) {
1182
- console.error(p);
1183
- }
1184
- })();
1185
- }, [c, i, t, n, e]), /* @__PURE__ */ a(pe, { children: /* @__PURE__ */ a("div", { ref: l, "data-rp": `page-${t}-textHighlightLayer`, children: m.map((g, p) => /* @__PURE__ */ a(
1186
- "div",
1187
- {
1188
- className: $r["rp-text-highlight"],
1189
- style: {
1190
- top: `${g.top}%`,
1191
- left: `${g.left}%`,
1192
- width: `${g.width}%`,
1193
- height: `${g.height}%`,
1194
- backgroundColor: g.highlightColor
1195
- }
1196
- },
1197
- p
1198
- )) }) });
1199
- }, xt = et((t, e) => {
1200
- const { pageNumber: n, style: r, ...o } = t, { pages: i } = oe(), { pageRotate: c } = Je(), { textLayer: l } = uo(), { currentZoom: d } = wt(), { LoaderImageComponent: f } = _t(), m = W(i.get(n)), [P, h] = q(!1), T = W(null), [C, b] = q({
1201
- width: 0,
1202
- height: 0
1203
- });
1204
- on(e, () => T.current);
1205
- const v = M(() => m.current ? c[n] : 0, [n, c]);
1206
- D(() => {
1207
- if (i && (m.current = i.get(n), m.current)) {
1208
- const u = m.current.page.getViewport({
1209
- scale: d,
1210
- rotation: v
1211
- });
1212
- b(u);
1213
- }
1214
- }, [i, n, v, d]);
1215
- const y = M(() => {
1216
- switch (v) {
1217
- case 90:
1218
- return `${C.width / 2}px ${C.width / 2}px`;
1219
- case -90:
1220
- case 270:
1221
- return `${C.height / 2}px ${C.height / 2}px`;
1222
- default:
1223
- return "center";
1224
- }
1225
- }, [v, C]), g = E(() => {
1226
- h(!0);
1227
- }, []), p = E(() => {
1228
- h(!1);
1229
- }, []);
1230
- return /* @__PURE__ */ a(
1231
- "div",
1232
- {
1233
- ref: T,
1234
- id: `page-${n}`,
1235
- "data-rp": `page-${n}`,
1236
- ...o,
1237
- style: {
1238
- ...r,
1239
- "--rp-rotate": `${v}deg`,
1240
- "--rp-page-rotate-translate": `${y}`,
1241
- "--scale-factor": d
1242
- },
1243
- className: st["rp-page-wrapper"],
1244
- children: /* @__PURE__ */ H(
1245
- "div",
1246
- {
1247
- style: {
1248
- width: `${C.width}px`,
1249
- height: `${C.height}px`
1250
- },
1251
- className: st["rp-page"],
1252
- children: [
1253
- /* @__PURE__ */ a(Ar, { onLoading: g, onLoaded: p, pageNumber: n }),
1254
- P && f && /* @__PURE__ */ a("div", { className: st["rp-loader-wrapper"], children: /* @__PURE__ */ a(f, {}) }),
1255
- /* @__PURE__ */ a(Yo, { pageNumber: n }),
1256
- l && /* @__PURE__ */ a(Mr, { pageNumber: n }),
1257
- /* @__PURE__ */ a(qr, { pageNumber: n, viewport: C }),
1258
- /* @__PURE__ */ a(Hr, { pageNumber: n })
1259
- ]
1260
- }
1261
- )
1262
- }
1263
- );
1264
- });
1265
- function ft() {
1266
- return ft = Object.assign ? Object.assign.bind() : function(t) {
1267
- for (var e = 1; e < arguments.length; e++) {
1268
- var n = arguments[e];
1269
- for (var r in n)
1270
- ({}).hasOwnProperty.call(n, r) && (t[r] = n[r]);
1271
- }
1272
- return t;
1273
- }, ft.apply(null, arguments);
1274
- }
1275
- function Ht(t) {
1276
- if (t === void 0)
1277
- throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
1278
- return t;
1279
- }
1280
- function mt(t, e) {
1281
- return mt = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(n, r) {
1282
- return n.__proto__ = r, n;
1283
- }, mt(t, e);
1284
- }
1285
- function Gr(t, e) {
1286
- t.prototype = Object.create(e.prototype), t.prototype.constructor = t, mt(t, e);
1287
- }
1288
- var $t = Number.isNaN || function(e) {
1289
- return typeof e == "number" && e !== e;
1290
- };
1291
- function Ur(t, e) {
1292
- return !!(t === e || $t(t) && $t(e));
1293
- }
1294
- function Vr(t, e) {
1295
- if (t.length !== e.length)
1296
- return !1;
1297
- for (var n = 0; n < t.length; n++)
1298
- if (!Ur(t[n], e[n]))
1299
- return !1;
1300
- return !0;
1301
- }
1302
- function ct(t, e) {
1303
- e === void 0 && (e = Vr);
1304
- var n, r = [], o, i = !1;
1305
- function c() {
1306
- for (var l = [], d = 0; d < arguments.length; d++)
1307
- l[d] = arguments[d];
1308
- return i && n === this && e(l, r) || (o = t.apply(this, l), i = !0, n = this, r = l), o;
1309
- }
1310
- return c;
1311
- }
1312
- function qt(t, e) {
1313
- if (t == null)
1314
- return {};
1315
- var n = {};
1316
- for (var r in t)
1317
- if ({}.hasOwnProperty.call(t, r)) {
1318
- if (e.indexOf(r) !== -1)
1319
- continue;
1320
- n[r] = t[r];
1321
- }
1322
- return n;
1323
- }
1324
- var Br = typeof performance == "object" && typeof performance.now == "function", Gt = Br ? function() {
1325
- return performance.now();
1326
- } : function() {
1327
- return Date.now();
1328
- };
1329
- function Ut(t) {
1330
- cancelAnimationFrame(t.id);
1331
- }
1332
- function jr(t, e) {
1333
- var n = Gt();
1334
- function r() {
1335
- Gt() - n >= e ? t.call(null) : o.id = requestAnimationFrame(r);
1336
- }
1337
- var o = {
1338
- id: requestAnimationFrame(r)
1339
- };
1340
- return o;
1341
- }
1342
- var lt = -1;
1343
- function Kr(t) {
1344
- if (t === void 0 && (t = !1), lt === -1 || t) {
1345
- var e = document.createElement("div"), n = e.style;
1346
- n.width = "50px", n.height = "50px", n.overflow = "scroll", document.body.appendChild(e), lt = e.offsetWidth - e.clientWidth, document.body.removeChild(e);
1347
- }
1348
- return lt;
1349
- }
1350
- var De = null;
1351
- function Vt(t) {
1352
- if (t === void 0 && (t = !1), De === null || t) {
1353
- var e = document.createElement("div"), n = e.style;
1354
- n.width = "50px", n.height = "50px", n.overflow = "scroll", n.direction = "rtl";
1355
- var r = document.createElement("div"), o = r.style;
1356
- return o.width = "100px", o.height = "100px", e.appendChild(r), document.body.appendChild(e), e.scrollLeft > 0 ? De = "positive-descending" : (e.scrollLeft = 1, e.scrollLeft === 0 ? De = "negative" : De = "positive-ascending"), document.body.removeChild(e), De;
1357
- }
1358
- return De;
1359
- }
1360
- var Zr = 150, Xr = function(e) {
1361
- var n = e.columnIndex;
1362
- e.data;
1363
- var r = e.rowIndex;
1364
- return r + ":" + n;
1365
- }, Be = null, je = null, Ke = null;
1366
- process.env.NODE_ENV !== "production" && typeof window < "u" && typeof window.WeakSet < "u" && (Be = /* @__PURE__ */ new WeakSet(), je = /* @__PURE__ */ new WeakSet(), Ke = /* @__PURE__ */ new WeakSet());
1367
- function Qr(t) {
1368
- var e, n = t.getColumnOffset, r = t.getColumnStartIndexForOffset, o = t.getColumnStopIndexForStartIndex, i = t.getColumnWidth, c = t.getEstimatedTotalHeight, l = t.getEstimatedTotalWidth, d = t.getOffsetForColumnAndAlignment, f = t.getOffsetForRowAndAlignment, m = t.getRowHeight, P = t.getRowOffset, h = t.getRowStartIndexForOffset, T = t.getRowStopIndexForStartIndex, C = t.initInstanceProps, b = t.shouldResetStyleCacheOnItemSizeChange, v = t.validateProps;
1369
- return e = /* @__PURE__ */ function(y) {
1370
- Gr(g, y);
1371
- function g(u) {
1372
- var s;
1373
- return s = y.call(this, u) || this, s._instanceProps = C(s.props, Ht(s)), s._resetIsScrollingTimeoutId = null, s._outerRef = void 0, s.state = {
1374
- instance: Ht(s),
1375
- isScrolling: !1,
1376
- horizontalScrollDirection: "forward",
1377
- scrollLeft: typeof s.props.initialScrollLeft == "number" ? s.props.initialScrollLeft : 0,
1378
- scrollTop: typeof s.props.initialScrollTop == "number" ? s.props.initialScrollTop : 0,
1379
- scrollUpdateWasRequested: !1,
1380
- verticalScrollDirection: "forward"
1381
- }, s._callOnItemsRendered = void 0, s._callOnItemsRendered = ct(function(_, w, x, I, S, R, N, A) {
1382
- return s.props.onItemsRendered({
1383
- overscanColumnStartIndex: _,
1384
- overscanColumnStopIndex: w,
1385
- overscanRowStartIndex: x,
1386
- overscanRowStopIndex: I,
1387
- visibleColumnStartIndex: S,
1388
- visibleColumnStopIndex: R,
1389
- visibleRowStartIndex: N,
1390
- visibleRowStopIndex: A
1391
- });
1392
- }), s._callOnScroll = void 0, s._callOnScroll = ct(function(_, w, x, I, S) {
1393
- return s.props.onScroll({
1394
- horizontalScrollDirection: x,
1395
- scrollLeft: _,
1396
- scrollTop: w,
1397
- verticalScrollDirection: I,
1398
- scrollUpdateWasRequested: S
1399
- });
1400
- }), s._getItemStyle = void 0, s._getItemStyle = function(_, w) {
1401
- var x = s.props, I = x.columnWidth, S = x.direction, R = x.rowHeight, N = s._getItemStyleCache(b && I, b && S, b && R), A = _ + ":" + w, z;
1402
- if (N.hasOwnProperty(A))
1403
- z = N[A];
1404
- else {
1405
- var L = n(s.props, w, s._instanceProps), O = S === "rtl";
1406
- N[A] = z = {
1407
- position: "absolute",
1408
- left: O ? void 0 : L,
1409
- right: O ? L : void 0,
1410
- top: P(s.props, _, s._instanceProps),
1411
- height: m(s.props, _, s._instanceProps),
1412
- width: i(s.props, w, s._instanceProps)
1413
- };
1414
- }
1415
- return z;
1416
- }, s._getItemStyleCache = void 0, s._getItemStyleCache = ct(function(_, w, x) {
1417
- return {};
1418
- }), s._onScroll = function(_) {
1419
- var w = _.currentTarget, x = w.clientHeight, I = w.clientWidth, S = w.scrollLeft, R = w.scrollTop, N = w.scrollHeight, A = w.scrollWidth;
1420
- s.setState(function(z) {
1421
- if (z.scrollLeft === S && z.scrollTop === R)
1422
- return null;
1423
- var L = s.props.direction, O = S;
1424
- if (L === "rtl")
1425
- switch (Vt()) {
1426
- case "negative":
1427
- O = -S;
1428
- break;
1429
- case "positive-descending":
1430
- O = A - I - S;
1431
- break;
1432
- }
1433
- O = Math.max(0, Math.min(O, A - I));
1434
- var F = Math.max(0, Math.min(R, N - x));
1435
- return {
1436
- isScrolling: !0,
1437
- horizontalScrollDirection: z.scrollLeft < S ? "forward" : "backward",
1438
- scrollLeft: O,
1439
- scrollTop: F,
1440
- verticalScrollDirection: z.scrollTop < R ? "forward" : "backward",
1441
- scrollUpdateWasRequested: !1
1442
- };
1443
- }, s._resetIsScrollingDebounced);
1444
- }, s._outerRefSetter = function(_) {
1445
- var w = s.props.outerRef;
1446
- s._outerRef = _, typeof w == "function" ? w(_) : w != null && typeof w == "object" && w.hasOwnProperty("current") && (w.current = _);
1447
- }, s._resetIsScrollingDebounced = function() {
1448
- s._resetIsScrollingTimeoutId !== null && Ut(s._resetIsScrollingTimeoutId), s._resetIsScrollingTimeoutId = jr(s._resetIsScrolling, Zr);
1449
- }, s._resetIsScrolling = function() {
1450
- s._resetIsScrollingTimeoutId = null, s.setState({
1451
- isScrolling: !1
1452
- }, function() {
1453
- s._getItemStyleCache(-1);
1454
- });
1455
- }, s;
1456
- }
1457
- g.getDerivedStateFromProps = function(s, _) {
1458
- return Yr(s, _), v(s), null;
1459
- };
1460
- var p = g.prototype;
1461
- return p.scrollTo = function(s) {
1462
- var _ = s.scrollLeft, w = s.scrollTop;
1463
- _ !== void 0 && (_ = Math.max(0, _)), w !== void 0 && (w = Math.max(0, w)), this.setState(function(x) {
1464
- return _ === void 0 && (_ = x.scrollLeft), w === void 0 && (w = x.scrollTop), x.scrollLeft === _ && x.scrollTop === w ? null : {
1465
- horizontalScrollDirection: x.scrollLeft < _ ? "forward" : "backward",
1466
- scrollLeft: _,
1467
- scrollTop: w,
1468
- scrollUpdateWasRequested: !0,
1469
- verticalScrollDirection: x.scrollTop < w ? "forward" : "backward"
1470
- };
1471
- }, this._resetIsScrollingDebounced);
1472
- }, p.scrollToItem = function(s) {
1473
- var _ = s.align, w = _ === void 0 ? "auto" : _, x = s.columnIndex, I = s.rowIndex, S = this.props, R = S.columnCount, N = S.height, A = S.rowCount, z = S.width, L = this.state, O = L.scrollLeft, F = L.scrollTop, $ = Kr();
1474
- x !== void 0 && (x = Math.max(0, Math.min(x, R - 1))), I !== void 0 && (I = Math.max(0, Math.min(I, A - 1)));
1475
- var k = c(this.props, this._instanceProps), B = l(this.props, this._instanceProps), Z = B > z ? $ : 0, U = k > N ? $ : 0;
1476
- this.scrollTo({
1477
- scrollLeft: x !== void 0 ? d(this.props, x, w, O, this._instanceProps, U) : O,
1478
- scrollTop: I !== void 0 ? f(this.props, I, w, F, this._instanceProps, Z) : F
1479
- });
1480
- }, p.componentDidMount = function() {
1481
- var s = this.props, _ = s.initialScrollLeft, w = s.initialScrollTop;
1482
- if (this._outerRef != null) {
1483
- var x = this._outerRef;
1484
- typeof _ == "number" && (x.scrollLeft = _), typeof w == "number" && (x.scrollTop = w);
1485
- }
1486
- this._callPropsCallbacks();
1487
- }, p.componentDidUpdate = function() {
1488
- var s = this.props.direction, _ = this.state, w = _.scrollLeft, x = _.scrollTop, I = _.scrollUpdateWasRequested;
1489
- if (I && this._outerRef != null) {
1490
- var S = this._outerRef;
1491
- if (s === "rtl")
1492
- switch (Vt()) {
1493
- case "negative":
1494
- S.scrollLeft = -w;
1495
- break;
1496
- case "positive-ascending":
1497
- S.scrollLeft = w;
1498
- break;
1499
- default:
1500
- var R = S.clientWidth, N = S.scrollWidth;
1501
- S.scrollLeft = N - R - w;
1502
- break;
1503
- }
1504
- else
1505
- S.scrollLeft = Math.max(0, w);
1506
- S.scrollTop = Math.max(0, x);
1507
- }
1508
- this._callPropsCallbacks();
1509
- }, p.componentWillUnmount = function() {
1510
- this._resetIsScrollingTimeoutId !== null && Ut(this._resetIsScrollingTimeoutId);
1511
- }, p.render = function() {
1512
- var s = this.props, _ = s.children, w = s.className, x = s.columnCount, I = s.direction, S = s.height, R = s.innerRef, N = s.innerElementType, A = s.innerTagName, z = s.itemData, L = s.itemKey, O = L === void 0 ? Xr : L, F = s.outerElementType, $ = s.outerTagName, k = s.rowCount, B = s.style, Z = s.useIsScrolling, U = s.width, ie = this.state.isScrolling, G = this._getHorizontalRangeToRender(), K = G[0], Y = G[1], J = this._getVerticalRangeToRender(), ee = J[0], re = J[1], ve = [];
1513
- if (x > 0 && k)
1514
- for (var de = ee; de <= re; de++)
1515
- for (var Pe = K; Pe <= Y; Pe++)
1516
- ve.push(Ve(_, {
1517
- columnIndex: Pe,
1518
- data: z,
1519
- isScrolling: Z ? ie : void 0,
1520
- key: O({
1521
- columnIndex: Pe,
1522
- data: z,
1523
- rowIndex: de
1524
- }),
1525
- rowIndex: de,
1526
- style: this._getItemStyle(de, Pe)
1527
- }));
1528
- var Me = c(this.props, this._instanceProps), nt = l(this.props, this._instanceProps);
1529
- return Ve(F || $ || "div", {
1530
- className: w,
1531
- onScroll: this._onScroll,
1532
- ref: this._outerRefSetter,
1533
- style: ft({
1534
- position: "relative",
1535
- height: S,
1536
- width: U,
1537
- overflow: "auto",
1538
- WebkitOverflowScrolling: "touch",
1539
- willChange: "transform",
1540
- direction: I
1541
- }, B)
1542
- }, Ve(N || A || "div", {
1543
- children: ve,
1544
- ref: R,
1545
- style: {
1546
- height: Me,
1547
- pointerEvents: ie ? "none" : void 0,
1548
- width: nt
1549
- }
1550
- }));
1551
- }, p._callPropsCallbacks = function() {
1552
- var s = this.props, _ = s.columnCount, w = s.onItemsRendered, x = s.onScroll, I = s.rowCount;
1553
- if (typeof w == "function" && _ > 0 && I > 0) {
1554
- var S = this._getHorizontalRangeToRender(), R = S[0], N = S[1], A = S[2], z = S[3], L = this._getVerticalRangeToRender(), O = L[0], F = L[1], $ = L[2], k = L[3];
1555
- this._callOnItemsRendered(R, N, O, F, A, z, $, k);
1556
- }
1557
- if (typeof x == "function") {
1558
- var B = this.state, Z = B.horizontalScrollDirection, U = B.scrollLeft, ie = B.scrollTop, G = B.scrollUpdateWasRequested, K = B.verticalScrollDirection;
1559
- this._callOnScroll(U, ie, Z, K, G);
1560
- }
1561
- }, p._getHorizontalRangeToRender = function() {
1562
- var s = this.props, _ = s.columnCount, w = s.overscanColumnCount, x = s.overscanColumnsCount, I = s.overscanCount, S = s.rowCount, R = this.state, N = R.horizontalScrollDirection, A = R.isScrolling, z = R.scrollLeft, L = w || x || I || 1;
1563
- if (_ === 0 || S === 0)
1564
- return [0, 0, 0, 0];
1565
- var O = r(this.props, z, this._instanceProps), F = o(this.props, O, z, this._instanceProps), $ = !A || N === "backward" ? Math.max(1, L) : 1, k = !A || N === "forward" ? Math.max(1, L) : 1;
1566
- return [Math.max(0, O - $), Math.max(0, Math.min(_ - 1, F + k)), O, F];
1567
- }, p._getVerticalRangeToRender = function() {
1568
- var s = this.props, _ = s.columnCount, w = s.overscanCount, x = s.overscanRowCount, I = s.overscanRowsCount, S = s.rowCount, R = this.state, N = R.isScrolling, A = R.verticalScrollDirection, z = R.scrollTop, L = x || I || w || 1;
1569
- if (_ === 0 || S === 0)
1570
- return [0, 0, 0, 0];
1571
- var O = h(this.props, z, this._instanceProps), F = T(this.props, O, z, this._instanceProps), $ = !N || A === "backward" ? Math.max(1, L) : 1, k = !N || A === "forward" ? Math.max(1, L) : 1;
1572
- return [Math.max(0, O - $), Math.max(0, Math.min(S - 1, F + k)), O, F];
1573
- }, g;
1574
- }(oo), e.defaultProps = {
1575
- direction: "ltr",
1576
- itemData: void 0,
1577
- useIsScrolling: !1
1578
- }, e;
1579
- }
1580
- var Yr = function(e, n) {
1581
- var r = e.children, o = e.direction, i = e.height, c = e.innerTagName, l = e.outerTagName, d = e.overscanColumnsCount, f = e.overscanCount, m = e.overscanRowsCount, P = e.width, h = n.instance;
1582
- if (process.env.NODE_ENV !== "production") {
1583
- if (typeof f == "number" && Be && !Be.has(h) && (Be.add(h), console.warn("The overscanCount prop has been deprecated. Please use the overscanColumnCount and overscanRowCount props instead.")), (typeof d == "number" || typeof m == "number") && je && !je.has(h) && (je.add(h), console.warn("The overscanColumnsCount and overscanRowsCount props have been deprecated. Please use the overscanColumnCount and overscanRowCount props instead.")), (c != null || l != null) && Ke && !Ke.has(h) && (Ke.add(h), console.warn("The innerTagName and outerTagName props have been deprecated. Please use the innerElementType and outerElementType props instead.")), r == null)
1584
- throw Error('An invalid "children" prop has been specified. Value should be a React component. ' + ('"' + (r === null ? "null" : typeof r) + '" was specified.'));
1585
- switch (o) {
1586
- case "ltr":
1587
- case "rtl":
1588
- break;
1589
- default:
1590
- throw Error('An invalid "direction" prop has been specified. Value should be either "ltr" or "rtl". ' + ('"' + o + '" was specified.'));
1591
- }
1592
- if (typeof P != "number")
1593
- throw Error('An invalid "width" prop has been specified. Grids must specify a number for width. ' + ('"' + (P === null ? "null" : typeof P) + '" was specified.'));
1594
- if (typeof i != "number")
1595
- throw Error('An invalid "height" prop has been specified. Grids must specify a number for height. ' + ('"' + (i === null ? "null" : typeof i) + '" was specified.'));
1596
- }
1597
- }, Bt = 50, xn = function(e, n) {
1598
- var r = e.rowCount, o = n.rowMetadataMap, i = n.estimatedRowHeight, c = n.lastMeasuredRowIndex, l = 0;
1599
- if (c >= r && (c = r - 1), c >= 0) {
1600
- var d = o[c];
1601
- l = d.offset + d.size;
1602
- }
1603
- var f = r - c - 1, m = f * i;
1604
- return l + m;
1605
- }, Sn = function(e, n) {
1606
- var r = e.columnCount, o = n.columnMetadataMap, i = n.estimatedColumnWidth, c = n.lastMeasuredColumnIndex, l = 0;
1607
- if (c >= r && (c = r - 1), c >= 0) {
1608
- var d = o[c];
1609
- l = d.offset + d.size;
1610
- }
1611
- var f = r - c - 1, m = f * i;
1612
- return l + m;
1613
- }, me = function(e, n, r, o) {
1614
- var i, c, l;
1615
- if (e === "column" ? (i = o.columnMetadataMap, c = n.columnWidth, l = o.lastMeasuredColumnIndex) : (i = o.rowMetadataMap, c = n.rowHeight, l = o.lastMeasuredRowIndex), r > l) {
1616
- var d = 0;
1617
- if (l >= 0) {
1618
- var f = i[l];
1619
- d = f.offset + f.size;
1620
- }
1621
- for (var m = l + 1; m <= r; m++) {
1622
- var P = c(m);
1623
- i[m] = {
1624
- offset: d,
1625
- size: P
1626
- }, d += P;
1627
- }
1628
- e === "column" ? o.lastMeasuredColumnIndex = r : o.lastMeasuredRowIndex = r;
1629
- }
1630
- return i[r];
1631
- }, jt = function(e, n, r, o) {
1632
- var i, c;
1633
- e === "column" ? (i = r.columnMetadataMap, c = r.lastMeasuredColumnIndex) : (i = r.rowMetadataMap, c = r.lastMeasuredRowIndex);
1634
- var l = c > 0 ? i[c].offset : 0;
1635
- return l >= o ? In(e, n, r, c, 0, o) : Jr(e, n, r, Math.max(0, c), o);
1636
- }, In = function(e, n, r, o, i, c) {
1637
- for (; i <= o; ) {
1638
- var l = i + Math.floor((o - i) / 2), d = me(e, n, l, r).offset;
1639
- if (d === c)
1640
- return l;
1641
- d < c ? i = l + 1 : d > c && (o = l - 1);
1642
- }
1643
- return i > 0 ? i - 1 : 0;
1644
- }, Jr = function(e, n, r, o, i) {
1645
- for (var c = e === "column" ? n.columnCount : n.rowCount, l = 1; o < c && me(e, n, o, r).offset < i; )
1646
- o += l, l *= 2;
1647
- return In(e, n, r, Math.min(o, c - 1), Math.floor(o / 2), i);
1648
- }, Kt = function(e, n, r, o, i, c, l) {
1649
- var d = e === "column" ? n.width : n.height, f = me(e, n, r, c), m = e === "column" ? Sn(n, c) : xn(n, c), P = Math.max(0, Math.min(m - d, f.offset)), h = Math.max(0, f.offset - d + l + f.size);
1650
- switch (o === "smart" && (i >= h - d && i <= P + d ? o = "auto" : o = "center"), o) {
1651
- case "start":
1652
- return P;
1653
- case "end":
1654
- return h;
1655
- case "center":
1656
- return Math.round(h + (P - h) / 2);
1657
- case "auto":
1658
- default:
1659
- return i >= h && i <= P ? i : h > P || i < h ? h : P;
1660
- }
1661
- }, ei = /* @__PURE__ */ Qr({
1662
- getColumnOffset: function(e, n, r) {
1663
- return me("column", e, n, r).offset;
1664
- },
1665
- getColumnStartIndexForOffset: function(e, n, r) {
1666
- return jt("column", e, r, n);
1667
- },
1668
- getColumnStopIndexForStartIndex: function(e, n, r, o) {
1669
- for (var i = e.columnCount, c = e.width, l = me("column", e, n, o), d = r + c, f = l.offset + l.size, m = n; m < i - 1 && f < d; )
1670
- m++, f += me("column", e, m, o).size;
1671
- return m;
1672
- },
1673
- getColumnWidth: function(e, n, r) {
1674
- return r.columnMetadataMap[n].size;
1675
- },
1676
- getEstimatedTotalHeight: xn,
1677
- getEstimatedTotalWidth: Sn,
1678
- getOffsetForColumnAndAlignment: function(e, n, r, o, i, c) {
1679
- return Kt("column", e, n, r, o, i, c);
1680
- },
1681
- getOffsetForRowAndAlignment: function(e, n, r, o, i, c) {
1682
- return Kt("row", e, n, r, o, i, c);
1683
- },
1684
- getRowOffset: function(e, n, r) {
1685
- return me("row", e, n, r).offset;
1686
- },
1687
- getRowHeight: function(e, n, r) {
1688
- return r.rowMetadataMap[n].size;
1689
- },
1690
- getRowStartIndexForOffset: function(e, n, r) {
1691
- return jt("row", e, r, n);
1692
- },
1693
- getRowStopIndexForStartIndex: function(e, n, r, o) {
1694
- for (var i = e.rowCount, c = e.height, l = me("row", e, n, o), d = r + c, f = l.offset + l.size, m = n; m < i - 1 && f < d; )
1695
- m++, f += me("row", e, m, o).size;
1696
- return m;
1697
- },
1698
- initInstanceProps: function(e, n) {
1699
- var r = e, o = r.estimatedColumnWidth, i = r.estimatedRowHeight, c = {
1700
- columnMetadataMap: {},
1701
- estimatedColumnWidth: o || Bt,
1702
- estimatedRowHeight: i || Bt,
1703
- lastMeasuredColumnIndex: -1,
1704
- lastMeasuredRowIndex: -1,
1705
- rowMetadataMap: {}
1706
- };
1707
- return n.resetAfterColumnIndex = function(l, d) {
1708
- d === void 0 && (d = !0), n.resetAfterIndices({
1709
- columnIndex: l,
1710
- shouldForceUpdate: d
1711
- });
1712
- }, n.resetAfterRowIndex = function(l, d) {
1713
- d === void 0 && (d = !0), n.resetAfterIndices({
1714
- rowIndex: l,
1715
- shouldForceUpdate: d
1716
- });
1717
- }, n.resetAfterIndices = function(l) {
1718
- var d = l.columnIndex, f = l.rowIndex, m = l.shouldForceUpdate, P = m === void 0 ? !0 : m;
1719
- typeof d == "number" && (c.lastMeasuredColumnIndex = Math.min(c.lastMeasuredColumnIndex, d - 1)), typeof f == "number" && (c.lastMeasuredRowIndex = Math.min(c.lastMeasuredRowIndex, f - 1)), n._getItemStyleCache(-1), P && n.forceUpdate();
1720
- }, c;
1721
- },
1722
- shouldResetStyleCacheOnItemSizeChange: !1,
1723
- validateProps: function(e) {
1724
- var n = e.columnWidth, r = e.rowHeight;
1725
- if (process.env.NODE_ENV !== "production") {
1726
- if (typeof n != "function")
1727
- throw Error('An invalid "columnWidth" prop has been specified. Value should be a function. ' + ('"' + (n === null ? "null" : typeof n) + '" was specified.'));
1728
- if (typeof r != "function")
1729
- throw Error('An invalid "rowHeight" prop has been specified. Value should be a function. ' + ('"' + (r === null ? "null" : typeof r) + '" was specified.'));
1730
- }
1731
- }
1732
- });
1733
- process.env.NODE_ENV;
1734
- function Zt(t, e) {
1735
- for (var n in t)
1736
- if (!(n in e))
1737
- return !0;
1738
- for (var r in e)
1739
- if (t[r] !== e[r])
1740
- return !0;
1741
- return !1;
1742
- }
1743
- var ti = ["style"], ni = ["style"];
1744
- function oi(t, e) {
1745
- var n = t.style, r = qt(t, ti), o = e.style, i = qt(e, ni);
1746
- return !Zt(n, o) && !Zt(r, i);
1747
- }
1748
- const ri = () => {
1749
- const { viewMode: t } = Fe(), { scrollMode: e } = Ee(), { setColumnCount: n } = sn(), { virtualScrollableElementRef: r } = Ye(), o = Ge(), i = M(() => o.heights.length, [o.heights]), c = M(() => e === ne.HORIZONTAL_SCROLLING ? i : t === Re.DUAL_PAGE ? 2 : 1, [t, e, e, i, r]), l = M(() => o.widths.reduce((v, y, g) => {
1750
- const p = g % c;
1751
- return (!v[p] || y > v[p]) && (v[p] = y), v;
1752
- }, []), [o.widths, c]), d = E(
1753
- (b) => {
1754
- const v = b % l.length;
1755
- return l[v] || 0;
1756
- },
1757
- [l]
1758
- ), f = E(
1759
- (b) => {
1760
- const v = Array.from({ length: c }, (y, g) => {
1761
- const p = b * c + g;
1762
- return o.heights[p] || 0;
1763
- });
1764
- return Math.max(...v);
1765
- },
1766
- [o.heights, c]
1767
- );
1768
- D(() => {
1769
- n(c);
1770
- }, [c, n]);
1771
- const m = M(() => e === ne.HORIZONTAL_SCROLLING || e === ne.PAGE_SCROLLING ? 1 : Math.round(i / c), [c, i, e]), P = M(() => o.heights.reduce((b, v) => b + v, 0) / o.heights.length || 0, [o]), h = M(() => o.widths.reduce((b, v) => b + v, 0) / o.widths.length || 0, [o]), T = M(() => {
1772
- const { rowsHeight: b, columnsWidth: v } = bt(o, c);
1773
- return {
1774
- rowsHeight: b,
1775
- columnsWidth: v
1776
- };
1777
- }, [o, c]), C = M(() => ({
1778
- width: T.columnsWidth.reduce((b, v) => b + v, 0),
1779
- height: T.rowsHeight.reduce((b, v) => b + v, 0)
1780
- }), [T]);
1781
- return {
1782
- rowCount: m,
1783
- rowHeight: f,
1784
- columnCount: c,
1785
- columnWidth: d,
1786
- pageDimension: o,
1787
- estimatedRowHeight: P,
1788
- estimatedColumnWidth: h,
1789
- gridDimension: T,
1790
- totalDimension: C
1791
- };
1792
- };
1793
- let ce;
1794
- typeof window < "u" ? ce = window : typeof self < "u" ? ce = self : ce = global;
1795
- let gt = null, vt = null;
1796
- const Xt = 20, dt = ce.clearTimeout, Qt = ce.setTimeout, ut = ce.cancelAnimationFrame || ce.mozCancelAnimationFrame || ce.webkitCancelAnimationFrame, Yt = ce.requestAnimationFrame || ce.mozRequestAnimationFrame || ce.webkitRequestAnimationFrame;
1797
- ut == null || Yt == null ? (gt = dt, vt = function(e) {
1798
- return Qt(e, Xt);
1799
- }) : (gt = function([e, n]) {
1800
- ut(e), dt(n);
1801
- }, vt = function(e) {
1802
- const n = Yt(function() {
1803
- dt(r), e();
1804
- }), r = Qt(function() {
1805
- ut(n), e();
1806
- }, Xt);
1807
- return [n, r];
1808
- });
1809
- function ii(t) {
1810
- let e, n, r, o, i, c, l;
1811
- const d = typeof document < "u" && document.attachEvent;
1812
- if (!d) {
1813
- c = function(y) {
1814
- const g = y.__resizeTriggers__, p = g.firstElementChild, u = g.lastElementChild, s = p.firstElementChild;
1815
- u.scrollLeft = u.scrollWidth, u.scrollTop = u.scrollHeight, s.style.width = p.offsetWidth + 1 + "px", s.style.height = p.offsetHeight + 1 + "px", p.scrollLeft = p.scrollWidth, p.scrollTop = p.scrollHeight;
1816
- }, i = function(y) {
1817
- return y.offsetWidth !== y.__resizeLast__.width || y.offsetHeight !== y.__resizeLast__.height;
1818
- }, l = function(y) {
1819
- if (y.target.className && typeof y.target.className.indexOf == "function" && y.target.className.indexOf("contract-trigger") < 0 && y.target.className.indexOf("expand-trigger") < 0)
1820
- return;
1821
- const g = this;
1822
- c(this), this.__resizeRAF__ && gt(this.__resizeRAF__), this.__resizeRAF__ = vt(function() {
1823
- i(g) && (g.__resizeLast__.width = g.offsetWidth, g.__resizeLast__.height = g.offsetHeight, g.__resizeListeners__.forEach(function(s) {
1824
- s.call(g, y);
1825
- }));
1826
- });
1827
- };
1828
- let h = !1, T = "";
1829
- r = "animationstart";
1830
- const C = "Webkit Moz O ms".split(" ");
1831
- let b = "webkitAnimationStart animationstart oAnimationStart MSAnimationStart".split(" "), v = "";
1832
- {
1833
- const y = document.createElement("fakeelement");
1834
- if (y.style.animationName !== void 0 && (h = !0), h === !1) {
1835
- for (let g = 0; g < C.length; g++)
1836
- if (y.style[C[g] + "AnimationName"] !== void 0) {
1837
- v = C[g], T = "-" + v.toLowerCase() + "-", r = b[g], h = !0;
1838
- break;
1839
- }
1840
- }
1841
- }
1842
- n = "resizeanim", e = "@" + T + "keyframes " + n + " { from { opacity: 0; } to { opacity: 0; } } ", o = T + "animation: 1ms " + n + "; ";
1843
- }
1844
- const f = function(h) {
1845
- if (!h.getElementById("detectElementResize")) {
1846
- const T = (e || "") + ".resize-triggers { " + (o || "") + 'visibility: hidden; opacity: 0; } .resize-triggers, .resize-triggers > div, .contract-trigger:before { content: " "; display: block; position: absolute; top: 0; left: 0; height: 100%; width: 100%; overflow: hidden; z-index: -1; } .resize-triggers > div { background: #eee; overflow: auto; } .contract-trigger:before { width: 200%; height: 200%; }', C = h.head || h.getElementsByTagName("head")[0], b = h.createElement("style");
1847
- b.id = "detectElementResize", b.type = "text/css", t != null && b.setAttribute("nonce", t), b.styleSheet ? b.styleSheet.cssText = T : b.appendChild(h.createTextNode(T)), C.appendChild(b);
1848
- }
1849
- };
1850
- return {
1851
- addResizeListener: function(h, T) {
1852
- if (d)
1853
- h.attachEvent("onresize", T);
1854
- else {
1855
- if (!h.__resizeTriggers__) {
1856
- const C = h.ownerDocument, b = ce.getComputedStyle(h);
1857
- b && b.position === "static" && (h.style.position = "relative"), f(C), h.__resizeLast__ = {}, h.__resizeListeners__ = [], (h.__resizeTriggers__ = C.createElement("div")).className = "resize-triggers";
1858
- const v = C.createElement("div");
1859
- v.className = "expand-trigger", v.appendChild(C.createElement("div"));
1860
- const y = C.createElement("div");
1861
- y.className = "contract-trigger", h.__resizeTriggers__.appendChild(v), h.__resizeTriggers__.appendChild(y), h.appendChild(h.__resizeTriggers__), c(h), h.addEventListener("scroll", l, !0), r && (h.__resizeTriggers__.__animationListener__ = function(p) {
1862
- p.animationName === n && c(h);
1863
- }, h.__resizeTriggers__.addEventListener(r, h.__resizeTriggers__.__animationListener__));
1864
- }
1865
- h.__resizeListeners__.push(T);
1866
- }
1867
- },
1868
- removeResizeListener: function(h, T) {
1869
- if (d)
1870
- h.detachEvent("onresize", T);
1871
- else if (h.__resizeListeners__.splice(h.__resizeListeners__.indexOf(T), 1), !h.__resizeListeners__.length) {
1872
- h.removeEventListener("scroll", l, !0), h.__resizeTriggers__.__animationListener__ && (h.__resizeTriggers__.removeEventListener(r, h.__resizeTriggers__.__animationListener__), h.__resizeTriggers__.__animationListener__ = null);
1873
- try {
1874
- h.__resizeTriggers__ = !h.removeChild(h.__resizeTriggers__);
1875
- } catch {
1876
- }
1877
- }
1878
- }
1879
- };
1880
- }
1881
- class ai extends ro {
1882
- constructor(...e) {
1883
- super(...e), this.state = {
1884
- height: this.props.defaultHeight || 0,
1885
- scaledHeight: this.props.defaultHeight || 0,
1886
- scaledWidth: this.props.defaultWidth || 0,
1887
- width: this.props.defaultWidth || 0
1888
- }, this._autoSizer = null, this._detectElementResize = null, this._parentNode = null, this._resizeObserver = null, this._timeoutId = null, this._onResize = () => {
1889
- this._timeoutId = null;
1890
- const {
1891
- disableHeight: n,
1892
- disableWidth: r,
1893
- onResize: o
1894
- } = this.props;
1895
- if (this._parentNode) {
1896
- const i = window.getComputedStyle(this._parentNode) || {}, c = parseFloat(i.paddingLeft || "0"), l = parseFloat(i.paddingRight || "0"), d = parseFloat(i.paddingTop || "0"), f = parseFloat(i.paddingBottom || "0"), m = this._parentNode.getBoundingClientRect(), P = m.height - d - f, h = m.width - c - l, T = this._parentNode.offsetHeight - d - f, C = this._parentNode.offsetWidth - c - l;
1897
- (!n && (this.state.height !== T || this.state.scaledHeight !== P) || !r && (this.state.width !== C || this.state.scaledWidth !== h)) && (this.setState({
1898
- height: T,
1899
- width: C,
1900
- scaledHeight: P,
1901
- scaledWidth: h
1902
- }), typeof o == "function" && o({
1903
- height: T,
1904
- scaledHeight: P,
1905
- scaledWidth: h,
1906
- width: C
1907
- }));
1908
- }
1909
- }, this._setRef = (n) => {
1910
- this._autoSizer = n;
1911
- };
1912
- }
1913
- componentDidMount() {
1914
- const {
1915
- nonce: e
1916
- } = this.props, n = this._autoSizer ? this._autoSizer.parentNode : null;
1917
- if (n != null && n.ownerDocument && n.ownerDocument.defaultView && n instanceof n.ownerDocument.defaultView.HTMLElement) {
1918
- this._parentNode = n;
1919
- const r = n.ownerDocument.defaultView.ResizeObserver;
1920
- r != null ? (this._resizeObserver = new r(() => {
1921
- this._timeoutId = setTimeout(this._onResize, 0);
1922
- }), this._resizeObserver.observe(n)) : (this._detectElementResize = ii(e), this._detectElementResize.addResizeListener(n, this._onResize)), this._onResize();
1923
- }
1924
- }
1925
- componentWillUnmount() {
1926
- this._parentNode && (this._detectElementResize && this._detectElementResize.removeResizeListener(this._parentNode, this._onResize), this._timeoutId !== null && clearTimeout(this._timeoutId), this._resizeObserver && this._resizeObserver.disconnect());
1927
- }
1928
- render() {
1929
- const {
1930
- children: e,
1931
- defaultHeight: n,
1932
- defaultWidth: r,
1933
- disableHeight: o = !1,
1934
- disableWidth: i = !1,
1935
- doNotBailOutOnEmptyChildren: c = !1,
1936
- nonce: l,
1937
- onResize: d,
1938
- style: f = {},
1939
- tagName: m = "div",
1940
- ...P
1941
- } = this.props, {
1942
- height: h,
1943
- scaledHeight: T,
1944
- scaledWidth: C,
1945
- width: b
1946
- } = this.state, v = {
1947
- overflow: "visible"
1948
- }, y = {};
1949
- let g = !1;
1950
- return o || (h === 0 && (g = !0), v.height = 0, y.height = h, y.scaledHeight = T), i || (b === 0 && (g = !0), v.width = 0, y.width = b, y.scaledWidth = C), c && (g = !1), Ve(m, {
1951
- ref: this._setRef,
1952
- style: {
1953
- ...v,
1954
- ...f
1955
- },
1956
- ...P
1957
- }, !g && e(y));
1958
- }
1959
- }
1960
- const si = rn(({ widths: t, heights: e }) => {
1961
- const { focusedPage: n, totalPages: r } = le(), o = M(() => {
1962
- const l = [], d = Math.ceil(n / 2) * 2 - 1;
1963
- if (l.push(d), d + 1 <= r) {
1964
- const f = d + 1;
1965
- l.push(f);
1966
- }
1967
- return l;
1968
- }, [n, r]), i = M(() => {
1969
- const l = n % 2 === 1 ? n - 1 : n - 2, d = Math.floor(l / 2), f = e(d), m = t(l), P = t(l + 1);
1970
- return [
1971
- {
1972
- position: "absolute",
1973
- left: 0,
1974
- width: m,
1975
- height: f
1976
- },
1977
- {
1978
- position: "absolute",
1979
- left: m,
1980
- width: P,
1981
- height: f
1982
- }
1983
- ];
1984
- }, [t, e, o]), c = M(() => i.reduce((l, d) => l + Number(d.width || 0), 0), [i]);
1985
- return /* @__PURE__ */ a("div", { style: { width: c, position: "relative" }, children: o.map((l, d) => /* @__PURE__ */ a(xt, { style: i[d], pageNumber: l }, l)) });
1986
- }), ci = ({ widths: t, heights: e }) => {
1987
- const { focusedPage: n } = le(), r = M(() => ({
1988
- position: "absolute",
1989
- width: t(n - 1),
1990
- height: e(n - 1)
1991
- }), [t, e, n]), o = M(() => t(n - 1), [t]);
1992
- return /* @__PURE__ */ a(
1993
- "div",
1994
- {
1995
- style: {
1996
- width: o,
1997
- position: "relative"
1998
- },
1999
- children: /* @__PURE__ */ a(xt, { style: r, pageNumber: n }, n)
2000
- }
2001
- );
2002
- }, li = (t, e, n) => {
2003
- const r = W(), { contentRef: o } = _e(), { heights: i, widths: c } = Ge(), { setFocusedPage: l } = le(), [d, f] = q([]), { targetScrollPage: m } = cn(), P = Tt(d, 0, 500), h = M(() => {
2004
- const { rowsHeight: C, columnsWidth: b } = bt({ heights: i, widths: c }, t);
2005
- return i.map((v, y) => {
2006
- const g = c[y], p = Jo(y + 1, t), u = b.slice(0, p.columnIndex).reduce((x, I) => x + I, 0), s = C.slice(0, p.rowIndex).reduce((x, I) => x + I, 0), _ = u + g, w = s + v;
2007
- return {
2008
- pageNumber: y + 1,
2009
- ...p,
2010
- width: g,
2011
- height: v,
2012
- startX: u,
2013
- startY: s,
2014
- endX: _,
2015
- endY: w
2016
- };
2017
- });
2018
- }, [i, c, t, e]);
2019
- D(() => {
2020
- var b;
2021
- P.length > 0 && !m.current && l(P[0].pageNumber), ((b = P[0]) == null ? void 0 : b.ratio) && P.some((v) => v.pageNumber === m.current) && setTimeout(() => {
2022
- m.current = void 0;
2023
- }, 500);
2024
- }, [P, l]);
2025
- const T = E(
2026
- (C) => {
2027
- r.current && cancelAnimationFrame(r.current), r.current = requestAnimationFrame(() => {
2028
- const b = C.target, v = {
2029
- startTop: b.scrollTop,
2030
- startLeft: b.scrollLeft,
2031
- endTop: b.scrollTop + b.clientHeight,
2032
- endLeft: b.scrollLeft + b.clientWidth
2033
- }, y = h.filter((g) => {
2034
- const p = g.endX >= v.startLeft && g.endY >= v.startTop, u = g.startX <= v.endLeft && g.startY <= v.endTop;
2035
- return p && u;
2036
- }).map((g) => {
2037
- const p = v.startLeft > g.startX ? v.startLeft : g.startX, u = v.startTop > g.startY ? v.startTop : g.startY, s = v.endLeft < g.endX ? v.endLeft : g.endX, _ = v.endTop < g.endY ? v.endTop : g.endY, w = s - p, x = _ - u, S = +(w * x / (g.width * g.height) * 100).toFixed(2);
2038
- return {
2039
- pageNumber: g.pageNumber,
2040
- ratio: S
2041
- };
2042
- }).sort((g, p) => p.ratio - g.ratio);
2043
- f(y);
2044
- });
2045
- },
2046
- [o, h]
2047
- );
2048
- D(() => {
2049
- if (n)
2050
- return n == null || n.addEventListener("scroll", T), () => {
2051
- n == null || n.removeEventListener("scroll", T);
2052
- };
2053
- }, [n, T]);
2054
- }, Rn = et((t, e) => {
2055
- const { children: n, toolbarRef: r, style: o, className: i, ...c } = t, { customVariables: l, customDarkVariables: d } = Oo(), { darkMode: f } = lo();
2056
- return /* @__PURE__ */ a(
2057
- "div",
2058
- {
2059
- ref: e,
2060
- ...c,
2061
- className: se(
2062
- we["rp-theme-variables"],
2063
- we["rp-container"],
2064
- f ? we["rp-dark-mode"] : "",
2065
- i
2066
- ),
2067
- style: {
2068
- "--rp-toolbar-height": `${(r == null ? void 0 : r.clientHeight) || 48}px`,
2069
- ...l,
2070
- ...f ? d : {},
2071
- ...o
2072
- },
2073
- children: n
2074
- }
2075
- );
2076
- }), di = rn(({ columnIndex: t, rowIndex: e, data: n, style: r }) => {
2077
- const o = er(e, t, n.columnCount);
2078
- return /* @__PURE__ */ a(xt, { style: r, pageNumber: o }, o);
2079
- }, oi), Js = () => {
2080
- const { initialPage: t = 1, initialScrollMode: e, instanceId: n } = ho(), { pagesRef: r, setPagesRef: o, setContentRef: i } = _e(), { scrollToPage: c } = vn(), {
2081
- virtualScrollRef: l,
2082
- getVirtualScrollRef: d,
2083
- getPageScrollElementRef: f,
2084
- getVirtualScrollableElementRef: m,
2085
- setTotalInnerDimensions: P,
2086
- virtualScrollableElementRef: h,
2087
- totalInnerDimensions: T,
2088
- pageScrollElementRef: C
2089
- } = Ye(), b = W(!0), { nextPage: v, prevPage: y, setFocusedPage: g, focusedPage: p } = le(), { scrollMode: u } = Ee(), { viewMode: s } = Fe(), _ = W(null), { loading: w, error: x } = oe(), { passwordRequired: I } = co(), { LoaderImageComponent: S } = _t(), R = W(
2090
- T
2091
- ), N = W({
2092
- viewMode: s,
2093
- scrollMode: u
2094
- }), A = W(!1), z = W(), { isFullScreen: L } = fo(), {
2095
- pageDimension: O,
2096
- rowCount: F,
2097
- rowHeight: $,
2098
- columnCount: k,
2099
- columnWidth: B,
2100
- estimatedColumnWidth: Z,
2101
- estimatedRowHeight: U,
2102
- totalDimension: ie
2103
- } = ri(), G = Tt(T, 100), K = W();
2104
- li(k, F, h);
2105
- const Y = W({
2106
- scrollTop: 0,
2107
- scrollLeft: 0
2108
- });
2109
- or(r);
2110
- const { isPressed: J } = tr(), { selectionMode: ee } = po(), { initializeGrabScroll: re, resetGrabState: ve } = nr({
2111
- isPressed: J
2112
- }), de = M(() => ee === ao.HAND, [ee]), Pe = M(() => ({
2113
- columnCount: k
2114
- }), [k]), Me = E(
2115
- (V) => {
2116
- const j = document.activeElement !== r;
2117
- !L && j || (["ArrowUp", "ArrowLeft"].includes(V.key) ? (V.preventDefault(), y()) : ["ArrowDown", "ArrowRight"].includes(V.key) && (V.preventDefault(), v()));
2118
- },
2119
- [v, y, L, u]
2120
- );
2121
- D(() => (window.addEventListener("keydown", Me), () => {
2122
- window.removeEventListener("keydown", Me);
2123
- }), [Me]), D(() => {
2124
- if (_.current && (_.current.style.position = "relative"), !!l)
2125
- for (let V = 0; V < F; V++)
2126
- for (let j = 0; j < k; j++)
2127
- l.resetAfterIndices({
2128
- columnIndex: j,
2129
- rowIndex: V,
2130
- shouldForceUpdate: !0
2131
- });
2132
- }, [F, k, O, l]);
2133
- const nt = E(
2134
- (V, j) => {
2135
- if (!h)
2136
- return { scrollTop: 0, scrollLeft: 0 };
2137
- const ye = Y.current.scrollTop > j, xe = Y.current.scrollLeft > V;
2138
- return ye || xe ? Y.current : {
2139
- scrollTop: h.scrollTop,
2140
- scrollLeft: h.scrollLeft
2141
- };
2142
- },
2143
- [h]
2144
- ), Et = E(
2145
- (V, j) => {
2146
- if (N.current.viewMode !== s || N.current.scrollMode !== u) {
2147
- K.current && clearTimeout(K.current), A.current = !0, c(p, "auto"), K.current = setTimeout(() => {
2148
- requestAnimationFrame(() => {
2149
- N.current = { viewMode: s, scrollMode: u };
2150
- });
2151
- }, 100);
2152
- return;
2153
- }
2154
- const xe = V.scrollTop, ot = V.scrollLeft;
2155
- if (!j.height || !j.width)
2156
- return;
2157
- A.current = !0;
2158
- const { height: Se, width: rt } = j, { height: Nt, width: Ot } = R.current;
2159
- if (Nt === Se && Ot === rt)
2160
- return;
2161
- const Jn = xe / Nt * Se, eo = ot / Ot * rt, to = Math.round(Math.min(Jn, Se)) || 0, no = Math.round(Math.min(eo, rt)) || 0;
2162
- z.current = setTimeout(() => {
2163
- requestAnimationFrame(() => {
2164
- h == null || h.scrollTo({
2165
- top: to,
2166
- left: no,
2167
- behavior: "auto"
2168
- });
2169
- });
2170
- }, 0), R.current = {
2171
- height: j.height,
2172
- width: j.width
2173
- };
2174
- },
2175
- [h, s, u, c]
2176
- );
2177
- D(() => {
2178
- clearTimeout(z.current);
2179
- const V = Array.from({ length: F }).reduce(
2180
- (xe, ot, Se) => xe + $(Se),
2181
- 0
2182
- ), j = Array.from({ length: k }).reduce(
2183
- (xe, ot, Se) => xe + B(Se),
2184
- 0
2185
- ), ye = nt(j, V);
2186
- Y.current = ye, Et(ye, { height: V, width: j }), P({
2187
- height: V,
2188
- width: j
2189
- });
2190
- }, [O, F, k, Et]);
2191
- const Xn = E(
2192
- (V) => {
2193
- Y.current = {
2194
- scrollTop: V.scrollTop,
2195
- scrollLeft: V.scrollLeft
2196
- };
2197
- },
2198
- [h]
2199
- );
2200
- D(() => () => {
2201
- K.current && clearTimeout(K.current);
2202
- }, []);
2203
- const Qn = M(() => se(ae["rp-pages-container"], {
2204
- [ae["rp-cursor-grab"]]: de && !J,
2205
- [ae["rp-cursor-grabbing"]]: de && J
2206
- }), [de, J]), Yn = E(
2207
- (V) => {
2208
- if (de && V) {
2209
- const j = se(ae["rp-pages"]), ye = document.querySelector(`.${j}`);
2210
- re(ye);
2211
- }
2212
- },
2213
- [de, re, ae]
2214
- );
2215
- return D(() => {
2216
- w && ve();
2217
- }, [w]), D(() => {
2218
- if (!(G.height === 0 || !b.current)) {
2219
- if (e === ne.PAGE_SCROLLING) {
2220
- t !== p && C && g(t), b.current = !1;
2221
- return;
2222
- }
2223
- c(t, "auto"), g(t), b.current = !1;
2224
- }
2225
- }, [
2226
- c,
2227
- e,
2228
- C,
2229
- g,
2230
- G
2231
- ]), /* @__PURE__ */ H(pe, { children: [
2232
- /* @__PURE__ */ a(No, { ref: i, children: /* @__PURE__ */ a(
2233
- Rn,
2234
- {
2235
- id: n,
2236
- ref: o,
2237
- tabIndex: -1,
2238
- className: Qn,
2239
- children: /* @__PURE__ */ a(ai, { style: { minHeight: "50px" }, children: ({ width: V, height: j }) => /* @__PURE__ */ a("div", { "data-rp": "pages", ref: Yn, style: { width: V, height: j }, children: u === ne.PAGE_SCROLLING ? /* @__PURE__ */ a(
2240
- "div",
2241
- {
2242
- ref: f,
2243
- style: { width: V, height: j },
2244
- className: se(ae["rp-pages"], ae["rp-page-scrolling-wrapper"]),
2245
- children: s === Re.DUAL_PAGE ? /* @__PURE__ */ a(si, { widths: B, heights: $ }) : /* @__PURE__ */ a(ci, { widths: B, heights: $ })
2246
- }
2247
- ) : U ? /* @__PURE__ */ a(
2248
- ei,
2249
- {
2250
- ref: d,
2251
- itemData: Pe,
2252
- outerRef: m,
2253
- innerRef: _,
2254
- onScroll: Xn,
2255
- columnCount: k,
2256
- columnWidth: B,
2257
- rowHeight: $,
2258
- height: j,
2259
- width: V,
2260
- estimatedColumnWidth: Z,
2261
- estimatedRowHeight: U,
2262
- rowCount: F,
2263
- className: se(
2264
- ae["rp-pages"],
2265
- u === ne.HORIZONTAL_SCROLLING ? ae["rp-pages-horizontal-scroll"] : ""
2266
- ),
2267
- style: {
2268
- "--rp-page-height": `${ie.height}px`,
2269
- "--rp-page-width": `${ie.width}px`,
2270
- "--rp-row-count": `${F}`,
2271
- "--rp-column-count": `${k}`
2272
- },
2273
- children: di
2274
- }
2275
- ) : !w && !x ? /* @__PURE__ */ a(
2276
- "div",
2277
- {
2278
- className: ae["rp-loader"],
2279
- style: {
2280
- display: "flex",
2281
- justifyContent: "center",
2282
- alignItems: "center",
2283
- height: "100%",
2284
- width: "100%"
2285
- },
2286
- children: S && /* @__PURE__ */ a(S, {})
2287
- }
2288
- ) : x === so.NOT_SUPPORTED ? /* @__PURE__ */ a("div", { className: ae["rp-not-supported"], children: /* @__PURE__ */ H("div", { className: ae["rp-not-supported-content"], children: [
2289
- "React PDF is unable to render on this browser. Please use the supported browsers from the list below:",
2290
- /* @__PURE__ */ a("div", { children: /* @__PURE__ */ H("ul", { children: [
2291
- /* @__PURE__ */ a("li", { children: "Chrome 110+" }),
2292
- /* @__PURE__ */ a("li", { children: "Edge 115+" }),
2293
- /* @__PURE__ */ a("li", { children: "Firefox 115+" }),
2294
- /* @__PURE__ */ a("li", { children: "Safari 16.5+" }),
2295
- /* @__PURE__ */ a("li", { children: "Safari iOS 16.5+" }),
2296
- /* @__PURE__ */ a("li", { children: "Chrome Android 126+" })
2297
- ] }) })
2298
- ] }) }) : null }) })
2299
- }
2300
- ) }),
2301
- I && /* @__PURE__ */ a(rr, {})
2302
- ] });
2303
- }, ke = {
2304
- "rp-toolbar-content": "_rp-toolbar-content_sz31z_1",
2305
- "rp-toolbar-wrapper": "_rp-toolbar-wrapper_sz31z_10",
2306
- "rp-toolbar-start": "_rp-toolbar-start_sz31z_33",
2307
- "rp-toolbar-middle": "_rp-toolbar-middle_sz31z_39",
2308
- "rp-toolbar-end": "_rp-toolbar-end_sz31z_46"
2309
- }, pt = {
2310
- "rp-paginate": "_rp-paginate_1gck0_1",
2311
- "rp-page-input": "_rp-page-input_1gck0_6",
2312
- "rp-total-page": "_rp-total-page_1gck0_18"
2313
- }, ui = () => {
2314
- const { prevIcon: t } = Ce(), { prevIcon: e } = be();
2315
- return t || e || /* @__PURE__ */ a(Ze, {});
2316
- }, pi = () => {
2317
- const { nextIcon: t } = Ce(), { nextIcon: e } = be();
2318
- return t || e || /* @__PURE__ */ a(Ze, { style: { transform: "rotate(180deg" } });
2319
- }, hi = () => {
2320
- const { focusedPage: t, totalPages: e, setFocusedPage: n, nextPage: r, prevPage: o, goToPage: i } = le(), [c, l] = q(t.toString()), { pageNavigationTool: d = !0 } = Te(), { pageNavigationTool: f = !0 } = Ne(), { isSmallScreen: m } = Oe(), { viewMode: P } = Fe(), { scrollMode: h } = Ee(), { localeMessages: T } = he();
2321
- D(() => {
2322
- l(t.toString());
2323
- }, [t]);
2324
- const C = E((p) => {
2325
- const u = p.target.value;
2326
- l(u);
2327
- }, []), b = E(async () => {
2328
- const p = i(c);
2329
- p.success || l(p.currentPage.toString());
2330
- }, [i, c, e]), v = E(() => {
2331
- l(t.toString());
2332
- }, [t]), y = E(
2333
- (p) => {
2334
- p.key === "Enter" && b();
2335
- },
2336
- [b]
2337
- ), g = M(() => P === Re.DUAL_PAGE && h === ne.PAGE_SCROLLING && t === e - 1 || t === e, [t, e, P, h]);
2338
- return !d || !f ? null : typeof d != "boolean" ? /* @__PURE__ */ a(
2339
- d,
2340
- {
2341
- total: e,
2342
- current: t,
2343
- nextPage: r,
2344
- prevPage: o,
2345
- goToPage: i,
2346
- changePage: n
2347
- }
2348
- ) : typeof f != "boolean" ? /* @__PURE__ */ a(
2349
- f,
2350
- {
2351
- total: e,
2352
- current: t,
2353
- nextPage: r,
2354
- prevPage: o,
2355
- goToPage: i,
2356
- changePage: n
2357
- }
2358
- ) : /* @__PURE__ */ H("div", { className: pt["rp-paginate"], children: [
2359
- !m && /* @__PURE__ */ a(Q, { content: T == null ? void 0 : T.previousPageTooltip, children: /* @__PURE__ */ a(
2360
- ge,
2361
- {
2362
- onClick: o,
2363
- "aria-label": T == null ? void 0 : T.previousPageTooltip,
2364
- "aria-disabled": t === 1,
2365
- children: /* @__PURE__ */ a(ui, {})
2366
- }
2367
- ) }),
2368
- /* @__PURE__ */ a(Q, { content: T == null ? void 0 : T.currentPageTooltip, children: /* @__PURE__ */ a(
2369
- an,
2370
- {
2371
- onKeyDown: y,
2372
- onBlur: v,
2373
- onChange: C,
2374
- value: c,
2375
- className: pt["rp-page-input"],
2376
- id: "page-input",
2377
- name: "page-input"
2378
- }
2379
- ) }),
2380
- /* @__PURE__ */ H("span", { className: pt["rp-total-page"], children: [
2381
- "/",
2382
- e
2383
- ] }),
2384
- !m && /* @__PURE__ */ a(Q, { content: T == null ? void 0 : T.nextPageTooltip, children: /* @__PURE__ */ a(
2385
- ge,
2386
- {
2387
- onClick: r,
2388
- "aria-label": T == null ? void 0 : T.nextPageTooltip,
2389
- "aria-disabled": g,
2390
- children: /* @__PURE__ */ a(pi, {})
2391
- }
2392
- ) })
2393
- ] });
2394
- };
2395
- var St = "Dialog", [Ln, ec] = dr(St), [fi, ue] = Ln(St), En = (t) => {
2396
- const {
2397
- __scopeDialog: e,
2398
- children: n,
2399
- open: r,
2400
- defaultOpen: o,
2401
- onOpenChange: i,
2402
- modal: c = !0
2403
- } = t, l = X.useRef(null), d = X.useRef(null), [f = !1, m] = hr({
2404
- prop: r,
2405
- defaultProp: o,
2406
- onChange: i
2407
- });
2408
- return /* @__PURE__ */ a(
2409
- fi,
2410
- {
2411
- scope: e,
2412
- triggerRef: l,
2413
- contentRef: d,
2414
- contentId: at(),
2415
- titleId: at(),
2416
- descriptionId: at(),
2417
- open: f,
2418
- onOpenChange: m,
2419
- onOpenToggle: X.useCallback(() => m((P) => !P), [m]),
2420
- modal: c,
2421
- children: n
2422
- }
2423
- );
2424
- };
2425
- En.displayName = St;
2426
- var Nn = "DialogTrigger", mi = X.forwardRef(
2427
- (t, e) => {
2428
- const { __scopeDialog: n, ...r } = t, o = ue(Nn, n), i = Ct(e, o.triggerRef);
2429
- return /* @__PURE__ */ a(
2430
- Ue.button,
2431
- {
2432
- type: "button",
2433
- "aria-haspopup": "dialog",
2434
- "aria-expanded": o.open,
2435
- "aria-controls": o.contentId,
2436
- "data-state": Lt(o.open),
2437
- ...r,
2438
- ref: i,
2439
- onClick: He(t.onClick, o.onOpenToggle)
2440
- }
2441
- );
2442
- }
2443
- );
2444
- mi.displayName = Nn;
2445
- var It = "DialogPortal", [gi, On] = Ln(It, {
2446
- forceMount: void 0
2447
- }), Dn = (t) => {
2448
- const { __scopeDialog: e, forceMount: n, children: r, container: o } = t, i = ue(It, e);
2449
- return /* @__PURE__ */ a(gi, { scope: e, forceMount: n, children: X.Children.map(r, (c) => /* @__PURE__ */ a(Pt, { present: n || i.open, children: /* @__PURE__ */ a(_r, { asChild: !0, container: o, children: c }) })) });
2450
- };
2451
- Dn.displayName = It;
2452
- var Qe = "DialogOverlay", An = X.forwardRef(
2453
- (t, e) => {
2454
- const n = On(Qe, t.__scopeDialog), { forceMount: r = n.forceMount, ...o } = t, i = ue(Qe, t.__scopeDialog);
2455
- return i.modal ? /* @__PURE__ */ a(Pt, { present: r || i.open, children: /* @__PURE__ */ a(vi, { ...o, ref: e }) }) : null;
2456
- }
2457
- );
2458
- An.displayName = Qe;
2459
- var vi = X.forwardRef(
2460
- (t, e) => {
2461
- const { __scopeDialog: n, ...r } = t, o = ue(Qe, n);
2462
- return (
2463
- // Make sure `Content` is scrollable even when it doesn't live inside `RemoveScroll`
2464
- // ie. when `Overlay` and `Content` are siblings
2465
- /* @__PURE__ */ a(mr, { as: ur, allowPinchZoom: !0, shards: [o.contentRef], children: /* @__PURE__ */ a(
2466
- Ue.div,
2467
- {
2468
- "data-state": Lt(o.open),
2469
- ...r,
2470
- ref: e,
2471
- style: { pointerEvents: "auto", ...r.style }
2472
- }
2473
- ) })
2474
- );
2475
- }
2476
- ), Le = "DialogContent", zn = X.forwardRef(
2477
- (t, e) => {
2478
- const n = On(Le, t.__scopeDialog), { forceMount: r = n.forceMount, ...o } = t, i = ue(Le, t.__scopeDialog);
2479
- return /* @__PURE__ */ a(Pt, { present: r || i.open, children: i.modal ? /* @__PURE__ */ a(wi, { ...o, ref: e }) : /* @__PURE__ */ a(_i, { ...o, ref: e }) });
2480
- }
2481
- );
2482
- zn.displayName = Le;
2483
- var wi = X.forwardRef(
2484
- (t, e) => {
2485
- const n = ue(Le, t.__scopeDialog), r = X.useRef(null), o = Ct(e, n.contentRef, r);
2486
- return X.useEffect(() => {
2487
- const i = r.current;
2488
- if (i)
2489
- return gr(i);
2490
- }, []), /* @__PURE__ */ a(
2491
- Fn,
2492
- {
2493
- ...t,
2494
- ref: o,
2495
- trapFocus: n.open,
2496
- disableOutsidePointerEvents: !0,
2497
- onCloseAutoFocus: He(t.onCloseAutoFocus, (i) => {
2498
- var c;
2499
- i.preventDefault(), (c = n.triggerRef.current) == null || c.focus();
2500
- }),
2501
- onPointerDownOutside: He(t.onPointerDownOutside, (i) => {
2502
- const c = i.detail.originalEvent, l = c.button === 0 && c.ctrlKey === !0;
2503
- (c.button === 2 || l) && i.preventDefault();
2504
- }),
2505
- onFocusOutside: He(
2506
- t.onFocusOutside,
2507
- (i) => i.preventDefault()
2508
- )
2509
- }
2510
- );
2511
- }
2512
- ), _i = X.forwardRef(
2513
- (t, e) => {
2514
- const n = ue(Le, t.__scopeDialog), r = X.useRef(!1), o = X.useRef(!1);
2515
- return /* @__PURE__ */ a(
2516
- Fn,
2517
- {
2518
- ...t,
2519
- ref: e,
2520
- trapFocus: !1,
2521
- disableOutsidePointerEvents: !1,
2522
- onCloseAutoFocus: (i) => {
2523
- var c, l;
2524
- (c = t.onCloseAutoFocus) == null || c.call(t, i), i.defaultPrevented || (r.current || (l = n.triggerRef.current) == null || l.focus(), i.preventDefault()), r.current = !1, o.current = !1;
2525
- },
2526
- onInteractOutside: (i) => {
2527
- var d, f;
2528
- (d = t.onInteractOutside) == null || d.call(t, i), i.defaultPrevented || (r.current = !0, i.detail.originalEvent.type === "pointerdown" && (o.current = !0));
2529
- const c = i.target;
2530
- ((f = n.triggerRef.current) == null ? void 0 : f.contains(c)) && i.preventDefault(), i.detail.originalEvent.type === "focusin" && o.current && i.preventDefault();
2531
- }
2532
- }
2533
- );
2534
- }
2535
- ), Fn = X.forwardRef(
2536
- (t, e) => {
2537
- const { __scopeDialog: n, trapFocus: r, onOpenAutoFocus: o, onCloseAutoFocus: i, ...c } = t, l = ue(Le, n), d = X.useRef(null), f = Ct(e, d);
2538
- return vr(), /* @__PURE__ */ H(pe, { children: [
2539
- /* @__PURE__ */ a(
2540
- wr,
2541
- {
2542
- asChild: !0,
2543
- loop: !0,
2544
- trapped: r,
2545
- onMountAutoFocus: o,
2546
- onUnmountAutoFocus: i,
2547
- children: /* @__PURE__ */ a(
2548
- fr,
2549
- {
2550
- role: "dialog",
2551
- id: l.contentId,
2552
- "aria-describedby": l.descriptionId,
2553
- "aria-labelledby": l.titleId,
2554
- "data-state": Lt(l.open),
2555
- ...c,
2556
- ref: f,
2557
- onDismiss: () => l.onOpenChange(!1)
2558
- }
2559
- )
2560
- }
2561
- ),
2562
- /* @__PURE__ */ H(pe, { children: [
2563
- /* @__PURE__ */ a(Ti, { titleId: l.titleId }),
2564
- /* @__PURE__ */ a(Pi, { contentRef: d, descriptionId: l.descriptionId })
2565
- ] })
2566
- ] });
2567
- }
2568
- ), Rt = "DialogTitle", Mn = X.forwardRef(
2569
- (t, e) => {
2570
- const { __scopeDialog: n, ...r } = t, o = ue(Rt, n);
2571
- return /* @__PURE__ */ a(Ue.h2, { id: o.titleId, ...r, ref: e });
2572
- }
2573
- );
2574
- Mn.displayName = Rt;
2575
- var kn = "DialogDescription", bi = X.forwardRef(
2576
- (t, e) => {
2577
- const { __scopeDialog: n, ...r } = t, o = ue(kn, n);
2578
- return /* @__PURE__ */ a(Ue.p, { id: o.descriptionId, ...r, ref: e });
2579
- }
2580
- );
2581
- bi.displayName = kn;
2582
- var Wn = "DialogClose", Hn = X.forwardRef(
2583
- (t, e) => {
2584
- const { __scopeDialog: n, ...r } = t, o = ue(Wn, n);
2585
- return /* @__PURE__ */ a(
2586
- Ue.button,
2587
- {
2588
- type: "button",
2589
- ...r,
2590
- ref: e,
2591
- onClick: He(t.onClick, () => o.onOpenChange(!1))
2592
- }
2593
- );
2594
- }
2595
- );
2596
- Hn.displayName = Wn;
2597
- function Lt(t) {
2598
- return t ? "open" : "closed";
2599
- }
2600
- var $n = "DialogTitleWarning", [tc, qn] = pr($n, {
2601
- contentName: Le,
2602
- titleName: Rt,
2603
- docsSlug: "dialog"
2604
- }), Ti = ({ titleId: t }) => {
2605
- const e = qn($n), n = `\`${e.contentName}\` requires a \`${e.titleName}\` for the component to be accessible for screen reader users.
2606
-
2607
- If you want to hide the \`${e.titleName}\`, you can wrap it with our VisuallyHidden component.
2608
-
2609
- For more information, see https://radix-ui.com/primitives/docs/components/${e.docsSlug}`;
2610
- return X.useEffect(() => {
2611
- t && (document.getElementById(t) || console.error(n));
2612
- }, [n, t]), null;
2613
- }, Ci = "DialogDescriptionWarning", Pi = ({ contentRef: t, descriptionId: e }) => {
2614
- const r = `Warning: Missing \`Description\` or \`aria-describedby={undefined}\` for {${qn(Ci).contentName}}.`;
2615
- return X.useEffect(() => {
2616
- var i;
2617
- const o = (i = t.current) == null ? void 0 : i.getAttribute("aria-describedby");
2618
- e && o && (document.getElementById(e) || console.warn(r));
2619
- }, [r, t, e]), null;
2620
- }, yi = En, xi = Dn, Si = An, Ii = zn, Ri = Mn, Li = Hn;
2621
- const Ie = {
2622
- "rp-dialog-wrapper": "_rp-dialog-wrapper_slqo7_1",
2623
- "rp-dialog-overlay": "_rp-dialog-overlay_slqo7_7",
2624
- "rp-document-dialog": "_rp-document-dialog_slqo7_13",
2625
- "rp-document-properties": "_rp-document-properties_slqo7_35",
2626
- "rp-dialog-title": "_rp-dialog-title_slqo7_39",
2627
- "rp-dialog-close": "_rp-dialog-close_slqo7_47",
2628
- "rp-properties-divider": "_rp-properties-divider_slqo7_55"
2629
- }, Ei = () => {
2630
- const { pdfProperties: t } = oe(), { container: e } = _e(), { activeDocumentProperties: n, setActiveDocumentProperties: r } = yo(), { localeMessages: o } = he(), i = M(() => {
2631
- if (!t)
2632
- return [];
2633
- const {
2634
- fileSize: c,
2635
- filename: l,
2636
- title: d,
2637
- author: f,
2638
- subject: m,
2639
- createdOn: P,
2640
- creator: h,
2641
- keywords: T,
2642
- modifiedOn: C,
2643
- pdfProducer: b,
2644
- pdfVersion: v,
2645
- pageCount: y
2646
- } = t;
2647
- return [
2648
- { label: o == null ? void 0 : o.propertiesFilenameLabel, value: l },
2649
- { label: o == null ? void 0 : o.propertiesFileSizeLabel, value: c },
2650
- { separate: !0 },
2651
- { label: o == null ? void 0 : o.propertiesTitleLabel, value: d },
2652
- { label: o == null ? void 0 : o.propertiesAuthorLabel, value: f },
2653
- { label: o == null ? void 0 : o.propertiesSubjectLabel, value: m },
2654
- { label: o == null ? void 0 : o.propertiesKeywordLabel, value: T },
2655
- { label: o == null ? void 0 : o.propertiesCreatorLabel, value: h },
2656
- {
2657
- label: o == null ? void 0 : o.propertiesCreateOnLabel,
2658
- value: P ? Ft(P) : ""
2659
- },
2660
- {
2661
- label: o == null ? void 0 : o.propertiesModifiedOnLabel,
2662
- value: C ? Ft(C) : ""
2663
- },
2664
- { separate: !0 },
2665
- { label: o == null ? void 0 : o.propertiesPDFProducerLabel, value: b },
2666
- { label: o == null ? void 0 : o.propertiesPDFVersionLabel, value: v },
2667
- { label: o == null ? void 0 : o.propertiesPageCountLabel, value: y }
2668
- ];
2669
- }, [t, o]);
2670
- return /* @__PURE__ */ a(yi, { open: n, onOpenChange: r, children: /* @__PURE__ */ a(xi, { container: e, children: /* @__PURE__ */ H("div", { className: Ie["rp-dialog-wrapper"], children: [
2671
- /* @__PURE__ */ a(Si, { className: Ie["rp-dialog-overlay"] }),
2672
- /* @__PURE__ */ H(Ii, { className: Ie["rp-document-dialog"], children: [
2673
- /* @__PURE__ */ a(Ri, { className: Ie["rp-dialog-title"], children: o == null ? void 0 : o.documentPropertiesLabel }),
2674
- /* @__PURE__ */ a("div", { className: Ie["rp-document-properties"], children: i.map((c, l) => /* @__PURE__ */ a("div", { children: c.separate ? /* @__PURE__ */ a("div", { className: Ie["rp-properties-divider"] }) : /* @__PURE__ */ a(zo, { label: c.label, value: c.value }) }, l)) }),
2675
- /* @__PURE__ */ a(Li, { asChild: !0, className: Ie["rp-dialog-close"], children: /* @__PURE__ */ a(br, {}) })
2676
- ] })
2677
- ] }) }) });
2678
- }, Ni = {
2679
- "rp-other-tool-content": "_rp-other-tool-content_su718_1"
2680
- }, Jt = ".pdf", Oi = (t) => URL.createObjectURL(t), Di = async (t) => {
2681
- const n = await (await fetch(t)).blob();
2682
- return Oi(n);
2683
- }, Gn = () => {
2684
- const { filename: t, pdfSrc: e } = oe(), { downloadFilename: n } = bo(), r = (i) => {
2685
- const c = n || i;
2686
- return c.endsWith(Jt) ? c : `${c}${Jt}`;
2687
- };
2688
- return { download: E(async () => {
2689
- if (!t || !e)
2690
- throw new Error("There is no PDF source to download");
2691
- const i = document.createElement("a");
2692
- i.href = await Di(e), i.download = r(t), document.body.appendChild(i), i.click(), document.body.removeChild(i);
2693
- }, [t, e]) };
2694
- }, Un = () => {
2695
- const { downloadIcon: t } = Ce(), { downloadIcon: e } = be();
2696
- return t || e || /* @__PURE__ */ a(xr, {});
2697
- }, Vn = ({ children: t, className: e, localeMessages: n }) => /* @__PURE__ */ a(Q, { className: e, content: n == null ? void 0 : n.downloadFileTooltip, children: t }), Ai = ({ download: t, localeMessages: e }) => /* @__PURE__ */ a(Vn, { localeMessages: e, children: /* @__PURE__ */ a(ge, { onClick: t, "aria-label": e == null ? void 0 : e.downloadFileTooltip, children: /* @__PURE__ */ a(Un, {}) }) }), zi = ({ download: t, localeMessages: e }) => /* @__PURE__ */ a(Xe, { onClick: t, children: /* @__PURE__ */ H(Vn, { className: "rp-menu-item", localeMessages: e, children: [
2698
- /* @__PURE__ */ a("div", { className: "rp-menu-item-left", children: /* @__PURE__ */ a(Un, {}) }),
2699
- e == null ? void 0 : e.downloadFileLabel
2700
- ] }) }), Bn = () => {
2701
- const { download: t } = Gn(), { downloadTool: e = !0 } = Te(), { downloadTool: n = !0 } = Ne(), { isSmallScreen: r } = Oe(), { localeMessages: o } = he(), i = o == null ? void 0 : o.downloadFileTooltip;
2702
- return !e || !n ? null : r ? /* @__PURE__ */ a(zi, { download: t, localeMessages: o }) : typeof e == "function" ? /* @__PURE__ */ a(Q, { content: i, children: /* @__PURE__ */ a(e, { download: t }) }) : typeof n == "function" ? /* @__PURE__ */ a(Q, { content: i, children: /* @__PURE__ */ a(n, { download: t }) }) : /* @__PURE__ */ a(Ai, { download: t, localeMessages: o });
2703
- }, jn = () => {
2704
- const { printIcon: t } = Ce(), { printIcon: e } = be();
2705
- return t || e || /* @__PURE__ */ a(Sr, {});
2706
- }, Kn = ({ children: t, className: e, localeMessages: n }) => /* @__PURE__ */ a(Q, { className: e, content: n == null ? void 0 : n.printTooltip, children: t }), Fi = ({ print: t, localeMessages: e }) => /* @__PURE__ */ a(Kn, { localeMessages: e, children: /* @__PURE__ */ a(ge, { onClick: t, "aria-label": e == null ? void 0 : e.printTooltip, children: /* @__PURE__ */ a(jn, {}) }) }), Mi = ({ print: t, localeMessages: e }) => /* @__PURE__ */ a(Xe, { onClick: t, children: /* @__PURE__ */ H(Kn, { className: "rp-menu-item", localeMessages: e, children: [
2707
- /* @__PURE__ */ a("div", { className: "rp-menu-item-left", children: /* @__PURE__ */ a(jn, {}) }),
2708
- e == null ? void 0 : e.printLabel
2709
- ] }) }), Zn = () => {
2710
- const { print: t, cancel: e, setOnProgress: n, setOnComplete: r, setOnError: o, progress: i } = tt(), { printTool: c = !0 } = Te(), { printTool: l = !0 } = Ne(), { isSmallScreen: d } = Oe(), { localeMessages: f } = he(), m = f == null ? void 0 : f.printTooltip;
2711
- return !c || !l ? null : d ? /* @__PURE__ */ a(Mi, { print: t, localeMessages: f }) : typeof c == "function" ? /* @__PURE__ */ a(Q, { content: m, children: /* @__PURE__ */ a(
2712
- c,
2713
- {
2714
- print: t,
2715
- cancel: e,
2716
- setOnProgress: n,
2717
- setOnError: o,
2718
- setOnComplete: r,
2719
- progress: i
2720
- }
2721
- ) }) : typeof l == "function" ? /* @__PURE__ */ a(Q, { content: m, children: /* @__PURE__ */ a(
2722
- l,
2723
- {
2724
- print: t,
2725
- cancel: e,
2726
- setOnProgress: n,
2727
- setOnError: o,
2728
- setOnComplete: r,
2729
- progress: i
2730
- }
2731
- ) }) : /* @__PURE__ */ a(Fi, { print: t, localeMessages: f });
2732
- }, ki = {
2733
- "rp-go-to-Top": "_rp-go-to-Top_4e0yd_1"
2734
- }, Wi = () => {
2735
- const { goToFirstPageIcon: t } = Ce(), { goToFirstPageIcon: e } = be();
2736
- return t || e || /* @__PURE__ */ a(mn, { className: ki["rp-go-to-Top"] });
2737
- }, Hi = () => {
2738
- const { goToLastPageIcon: t } = Ce(), { goToLastPageIcon: e } = be();
2739
- return t || e || /* @__PURE__ */ a(mn, {});
2740
- }, en = { width: "100%" }, $i = () => {
2741
- const { goToPage: t, totalPages: e, focusedPage: n } = le(), { jumpNavigationTool: r = !0 } = Te(), { jumpNavigationTool: o = !0 } = Ne(), { localeMessages: i } = he(), c = M(() => n === 1, [n]), l = M(() => n === e, [n, e]), d = E(() => {
2742
- t(1);
2743
- }, [t]), f = E(() => {
2744
- t(e);
2745
- }, [t, e]);
2746
- return !r || !o ? null : /* @__PURE__ */ H(hn, { children: [
2747
- /* @__PURE__ */ a(Xe, { onClick: d, children: /* @__PURE__ */ a(Q, { content: i == null ? void 0 : i.firstPageTooltip, style: en, children: /* @__PURE__ */ H("div", { className: "rp-menu-item", "aria-disabled": c, children: [
2748
- /* @__PURE__ */ a("div", { className: "rp-menu-item-left", children: /* @__PURE__ */ a(Wi, {}) }),
2749
- /* @__PURE__ */ a("span", { children: i == null ? void 0 : i.firstPageLabel })
2750
- ] }) }) }),
2751
- /* @__PURE__ */ a(Xe, { onClick: f, children: /* @__PURE__ */ a(Q, { content: i == null ? void 0 : i.lastPageTooltip, style: en, children: /* @__PURE__ */ H("div", { className: "rp-menu-item", "aria-disabled": l, children: [
2752
- /* @__PURE__ */ a("div", { className: "rp-menu-item-left", children: /* @__PURE__ */ a(Hi, {}) }),
2753
- /* @__PURE__ */ a("span", { children: i == null ? void 0 : i.lastPageLabel })
2754
- ] }) }) }),
2755
- /* @__PURE__ */ a(un, {})
2756
- ] });
2757
- }, qi = () => {
2758
- const [t, e] = q(!1), { container: n, pagesRef: r } = _e(), { isSmallScreen: o } = Oe(), {
2759
- openFileTool: i,
2760
- downloadTool: c,
2761
- documentProperties: l,
2762
- scrollModeTool: d,
2763
- rotateTool: f,
2764
- selectionModeTool: m,
2765
- jumpNavigationTool: P,
2766
- printTool: h,
2767
- fullscreenTool: T,
2768
- viewModeTool: C
2769
- } = Te(), {
2770
- openFileTool: b,
2771
- downloadTool: v,
2772
- documentProperties: y,
2773
- scrollModeTool: g,
2774
- rotateTool: p,
2775
- selectionModeTool: u,
2776
- jumpNavigationTool: s,
2777
- printTool: _,
2778
- fullscreenTool: w,
2779
- viewModeTool: x
2780
- } = Ne(), { localeMessages: I } = he(), [S, R] = q(0), N = W(
2781
- new ResizeObserver((L) => {
2782
- R(L[0].contentRect.height);
2783
- })
2784
- ), A = M(() => P || f || m || d || l || C || o && (i || c || h || T), [
2785
- i,
2786
- c,
2787
- h,
2788
- T,
2789
- l,
2790
- d,
2791
- f,
2792
- m,
2793
- P,
2794
- o
2795
- ]), z = M(() => s || p || u || g || y || x || o && (b || v || _ || w), [
2796
- b,
2797
- v,
2798
- _,
2799
- w,
2800
- y,
2801
- g,
2802
- p,
2803
- u,
2804
- s,
2805
- o
2806
- ]);
2807
- return D(() => (r && N.current.observe(r), () => {
2808
- N.current.disconnect();
2809
- }), [r]), !A || !z ? null : /* @__PURE__ */ H(pe, { children: [
2810
- /* @__PURE__ */ a(
2811
- dn,
2812
- {
2813
- container: n,
2814
- onOpenChange: e,
2815
- triggerComponent: /* @__PURE__ */ a("div", { role: "button", children: /* @__PURE__ */ a(Q, { content: I == null ? void 0 : I.moreOptionTooltip, children: /* @__PURE__ */ a(ge, { active: t, "aria-label": I == null ? void 0 : I.moreOptionTooltip, children: /* @__PURE__ */ a(lr, {}) }) }) }),
2816
- side: "bottom",
2817
- avoidCollisions: !1,
2818
- children: /* @__PURE__ */ H(
2819
- "div",
2820
- {
2821
- style: { maxHeight: `${S}px`, overflow: "auto" },
2822
- className: Ni["rp-other-tool-content"],
2823
- "data-rp": "moreOptionsDropdown",
2824
- children: [
2825
- o && /* @__PURE__ */ H(hn, { children: [
2826
- /* @__PURE__ */ a(pn, {}),
2827
- /* @__PURE__ */ a(Bn, {}),
2828
- /* @__PURE__ */ a(Zn, {}),
2829
- /* @__PURE__ */ a(fn, {}),
2830
- /* @__PURE__ */ a(un, {})
2831
- ] }),
2832
- /* @__PURE__ */ a($i, {}),
2833
- /* @__PURE__ */ a(Cr, {}),
2834
- /* @__PURE__ */ a(Ir, {}),
2835
- /* @__PURE__ */ a(Pr, {}),
2836
- /* @__PURE__ */ a(yr, {}),
2837
- /* @__PURE__ */ a(Tr, {})
2838
- ]
2839
- }
2840
- )
2841
- }
2842
- ),
2843
- /* @__PURE__ */ a(Ei, {})
2844
- ] });
2845
- }, Gi = () => {
2846
- const { isSmallScreen: t } = Oe();
2847
- return /* @__PURE__ */ H(pe, { children: [
2848
- /* @__PURE__ */ a(cr, {}),
2849
- !t && /* @__PURE__ */ H(pe, { children: [
2850
- /* @__PURE__ */ a(pn, {}),
2851
- /* @__PURE__ */ a(Bn, {}),
2852
- /* @__PURE__ */ a(Zn, {}),
2853
- /* @__PURE__ */ a(fn, {})
2854
- ] }),
2855
- /* @__PURE__ */ a(qi, {})
2856
- ] });
2857
- }, tn = () => {
2858
- const { totalMatches: t, nextMatch: e, prevMatch: n } = yt(), { localeMessages: r } = he();
2859
- return /* @__PURE__ */ H(pe, { children: [
2860
- /* @__PURE__ */ a(
2861
- Q,
2862
- {
2863
- content: r == null ? void 0 : r.searchPrevTooltip,
2864
- className: te["rp-search-tool-result-navigator"],
2865
- children: /* @__PURE__ */ a(ge, { tabIndex: 0, onClick: n, "aria-label": r == null ? void 0 : r.searchPrevTooltip, children: /* @__PURE__ */ a(
2866
- Ze,
2867
- {
2868
- className: te["rp-search-tool-input-icon"],
2869
- "aria-disabled": !t
2870
- }
2871
- ) })
2872
- }
2873
- ),
2874
- /* @__PURE__ */ a(
2875
- Q,
2876
- {
2877
- content: r == null ? void 0 : r.searchNextTooltip,
2878
- className: te["rp-search-tool-result-navigator"],
2879
- children: /* @__PURE__ */ a(ge, { tabIndex: 0, onClick: e, "aria-label": r == null ? void 0 : r.searchNextTooltip, children: /* @__PURE__ */ a(
2880
- Ze,
2881
- {
2882
- style: { transform: "rotate(180deg" },
2883
- className: te["rp-search-tool-input-icon"],
2884
- "aria-disabled": !t
2885
- }
2886
- ) })
2887
- }
2888
- )
2889
- ] });
2890
- }, Ui = () => {
2891
- const { searchIcon: t } = Ce(), { searchIcon: e } = be();
2892
- return t || e || /* @__PURE__ */ a(gn, {});
2893
- }, Vi = ({ icon: t }) => {
2894
- const { container: e } = _e(), [n, r] = q(!1), { pdf: o } = oe(), [i, c] = q(null), {
2895
- searchOptions: l,
2896
- setSearchOptions: d,
2897
- loading: f,
2898
- setSearch: m,
2899
- totalMatches: P,
2900
- currentMatchPosition: h,
2901
- nextMatch: T,
2902
- prevMatch: C,
2903
- search: b
2904
- } = yt(), { searchTool: v = !0 } = Te(), { searchTool: y = !0 } = Ne(), [g, p] = q(b), { localeMessages: u } = he(), { isSmallScreen: s } = Oe(), [_, w] = q(null), [x, I] = q(!1), S = E(() => {
2905
- r(!0);
2906
- }, []), R = E(() => {
2907
- m(""), p(""), r(!1);
2908
- }, [m]), N = (G) => {
2909
- const K = G.key === "Enter", Y = G.key === " ";
2910
- (K || Y) && R();
2911
- }, A = E(
2912
- (G) => {
2913
- G.key === "Escape" && n && R();
2914
- },
2915
- [n]
2916
- ), z = E(
2917
- (G) => {
2918
- G.shiftKey && G.key === "Enter" ? C() : G.key === "Enter" && b !== g ? m(g) : G.key === "Enter" && T();
2919
- },
2920
- [g, C, T, m, b]
2921
- );
2922
- D(() => {
2923
- p(b);
2924
- }, [b]), D(() => {
2925
- b && o && I(!0);
2926
- }, [b, o]), D(() => {
2927
- b && b.trim() !== "" && (p(b), m(b));
2928
- }, []), D(() => (window.addEventListener("keydown", A), () => {
2929
- window.removeEventListener("keydown", A);
2930
- }), [A]), D(() => {
2931
- i && setTimeout(() => {
2932
- i.focus();
2933
- }, 0);
2934
- }, [i]);
2935
- const L = E((G) => {
2936
- p(G.target.value);
2937
- }, []), O = E(() => {
2938
- p(""), m("");
2939
- }, [m]), F = M(() => `${h} / ${P}`, [h, P]), { wholeWords: $, matchCase: k } = M(() => l, [l]), B = E(
2940
- (G) => {
2941
- d((K) => ({ ...K, matchCase: G }));
2942
- },
2943
- [d]
2944
- ), Z = E(
2945
- (G) => {
2946
- d((K) => ({ ...K, wholeWords: G }));
2947
- },
2948
- [d]
2949
- );
2950
- D(() => {
2951
- o && x && R();
2952
- }, [o, R]);
2953
- const U = M(() => (_ == null ? void 0 : _.querySelectorAll('[tabindex]:not([tabindex="-1"])')) || [], [_]), ie = E(
2954
- (G) => {
2955
- if (G.key === "Tab") {
2956
- const K = document.activeElement;
2957
- let Y = 0;
2958
- U.forEach((re, ve) => {
2959
- re === K && (Y = ve);
2960
- });
2961
- let J = Y + 1;
2962
- G.shiftKey && (J = Y - 1);
2963
- const ee = U[J];
2964
- if (ee)
2965
- ee.focus();
2966
- else if (J > U.length - 1) {
2967
- const re = U[0];
2968
- re && re.focus();
2969
- } else {
2970
- const re = U[U.length - 1];
2971
- re && re.focus();
2972
- }
2973
- }
2974
- },
2975
- [U]
2976
- );
2977
- return !v || !y ? null : /* @__PURE__ */ a(pe, { children: /* @__PURE__ */ a(
2978
- dn,
2979
- {
2980
- open: n,
2981
- container: e,
2982
- side: "bottom",
2983
- align: "start",
2984
- tabIndex: 0,
2985
- avoidCollisions: !1,
2986
- triggerComponent: /* @__PURE__ */ a(Q, { content: u == null ? void 0 : u.searchButtonTooltip, children: /* @__PURE__ */ a(
2987
- ge,
2988
- {
2989
- active: n,
2990
- onClick: S,
2991
- "aria-label": u == null ? void 0 : u.searchButtonTooltip,
2992
- children: t || /* @__PURE__ */ a(Ui, {})
2993
- }
2994
- ) }),
2995
- children: /* @__PURE__ */ H(
2996
- "div",
2997
- {
2998
- ref: w,
2999
- className: te["rp-search-tool-content"],
3000
- tabIndex: 0,
3001
- onKeyDown: ie,
3002
- children: [
3003
- /* @__PURE__ */ H("div", { className: te["rp-search-tool-input-wrapper"], children: [
3004
- /* @__PURE__ */ H("div", { className: te["rp-search-tool-input"], children: [
3005
- /* @__PURE__ */ a(Q, { content: u == null ? void 0 : u.searchInputTooltip, children: /* @__PURE__ */ a(
3006
- an,
3007
- {
3008
- value: g,
3009
- onKeyDown: z,
3010
- onChange: L,
3011
- icon: /* @__PURE__ */ a(gn, {}),
3012
- placeholder: u == null ? void 0 : u.searchInputPlaceholder,
3013
- className: te["rp-search-input"],
3014
- ref: c,
3015
- id: "search-input",
3016
- name: "search-input",
3017
- tabIndex: 0,
3018
- children: !!g && /* @__PURE__ */ a("span", { className: te["rp-search-tool-input-clear"], onClick: O, children: /* @__PURE__ */ a(Lr, {}) })
3019
- }
3020
- ) }),
3021
- f ? /* @__PURE__ */ a("span", { children: /* @__PURE__ */ a(ln, { className: te["rp-search-loader-icon"] }) }) : /* @__PURE__ */ a("span", { children: F }),
3022
- s && /* @__PURE__ */ a("div", { className: te["rp-search-tool-controls"], children: /* @__PURE__ */ a(At, { onKeyPress: N, handleClose: R }) })
3023
- ] }),
3024
- /* @__PURE__ */ H("div", { className: te["rp-search-tool-input-checkboxes"], children: [
3025
- s && /* @__PURE__ */ a(tn, {}),
3026
- /* @__PURE__ */ a(
3027
- zt,
3028
- {
3029
- tabIndex: 0,
3030
- name: "matchCase",
3031
- value: k,
3032
- onChange: B,
3033
- children: u == null ? void 0 : u.searchMatchCaseLabel
3034
- }
3035
- ),
3036
- !s && /* @__PURE__ */ a(Q, { content: u == null ? void 0 : u.searchMatchCaseTooltip, children: /* @__PURE__ */ a("div", { className: te["rp-search-icon-info"], tabIndex: 0, children: /* @__PURE__ */ a(Wt, {}) }) }),
3037
- /* @__PURE__ */ a(
3038
- zt,
3039
- {
3040
- tabIndex: 0,
3041
- name: "wholeWord",
3042
- value: $,
3043
- onChange: Z,
3044
- children: u == null ? void 0 : u.searchWholeWordsLabel
3045
- }
3046
- ),
3047
- !s && /* @__PURE__ */ a(Q, { content: u == null ? void 0 : u.searchWholeWordsTooltip, children: /* @__PURE__ */ a("div", { tabIndex: 0, className: te["rp-search-icon-info"], children: /* @__PURE__ */ a(Wt, {}) }) })
3048
- ] })
3049
- ] }),
3050
- !s && /* @__PURE__ */ H("div", { className: te["rp-search-tool-controls"], children: [
3051
- /* @__PURE__ */ a(tn, {}),
3052
- /* @__PURE__ */ a(At, { onKeyPress: N, handleClose: R })
3053
- ] })
3054
- ]
3055
- }
3056
- )
3057
- }
3058
- ) });
3059
- }, Bi = "_loading_wazy2_1", Ae = {
3060
- "rp-loading-overlay": "_rp-loading-overlay_wazy2_1",
3061
- "rp-loading-modal": "_rp-loading-modal_wazy2_14",
3062
- "rp-loading-title": "_rp-loading-title_wazy2_27",
3063
- "rp-loading-progress-bar": "_rp-loading-progress-bar_wazy2_35",
3064
- "rp-loading-progress": "_rp-loading-progress_wazy2_35",
3065
- "rp-loading-cancel-button": "_rp-loading-cancel-button_wazy2_55",
3066
- loading: Bi
3067
- }, ji = ({ percentage: t }) => {
3068
- const { cancel: e } = tt(), { localeMessages: n } = he();
3069
- return t < 1 ? null : /* @__PURE__ */ a("div", { className: se(Ae["rp-loading-overlay"]), children: /* @__PURE__ */ H("div", { className: se(Ae["rp-loading-modal"]), children: [
3070
- /* @__PURE__ */ H("div", { className: se(Ae["rp-loading-title"]), children: [
3071
- n == null ? void 0 : n.printLoadingMessage,
3072
- "..."
3073
- ] }),
3074
- /* @__PURE__ */ a("div", { className: se(Ae["rp-loading-progress-bar"]), children: /* @__PURE__ */ a(
3075
- "div",
3076
- {
3077
- className: se(Ae["rp-loading-progress"]),
3078
- style: { width: `${t}%` }
3079
- }
3080
- ) }),
3081
- /* @__PURE__ */ a("button", { className: se(Ae["rp-loading-cancel-button"]), onClick: e, children: n == null ? void 0 : n.printCancelLabel })
3082
- ] }) });
3083
- }, Ki = et((t, e) => {
3084
- const { showPrintProgress: n = !0 } = Te(), { showPrintProgress: r = !0 } = Ne(), { progress: o } = tt(), { isSmallScreen: i } = Oe(), { percentage: c } = o || {}, l = () => i ? { gridTemplateColumns: "25% 60% 15%" } : void 0, d = () => {
3085
- if (!(!n || !r || !c))
3086
- return /* @__PURE__ */ a(ji, { percentage: c });
3087
- };
3088
- return /* @__PURE__ */ H("div", { children: [
3089
- /* @__PURE__ */ a("div", { "data-rp": "topBar", ref: e, className: ke["rp-toolbar-content"], children: /* @__PURE__ */ H("div", { className: ke["rp-toolbar-wrapper"], style: l(), children: [
3090
- /* @__PURE__ */ H("div", { "data-rp": "topBarLeft", className: ke["rp-toolbar-start"], children: [
3091
- /* @__PURE__ */ a(Vi, {}),
3092
- /* @__PURE__ */ a(hi, {})
3093
- ] }),
3094
- /* @__PURE__ */ a("div", { "data-rp": "topBarCenter", className: ke["rp-toolbar-middle"], children: /* @__PURE__ */ a(Rr, {}) }),
3095
- /* @__PURE__ */ a("div", { "data-rp": "topBarRight", className: ke["rp-toolbar-end"], children: /* @__PURE__ */ a(Gi, {}) })
3096
- ] }) }),
3097
- /* @__PURE__ */ a(d, {})
3098
- ] });
3099
- }), ht = {
3100
- "rp-sidebar-content-wrapper": "_rp-sidebar-content-wrapper_1bqgz_1",
3101
- "rp-sidebar-content": "_rp-sidebar-content_1bqgz_1",
3102
- "rp-thumbnails-wrapper": "_rp-thumbnails-wrapper_1bqgz_16"
3103
- }, We = {
3104
- "rp-thumbnail-wrapper": "_rp-thumbnail-wrapper_3fenb_1",
3105
- "rp-thumbnail-text": "_rp-thumbnail-text_3fenb_10",
3106
- "rp-thumbnail": "_rp-thumbnail_3fenb_1",
3107
- "rp-thumbnail-active": "_rp-thumbnail-active_3fenb_22",
3108
- "rp-thumbnail-loader": "_rp-thumbnail-loader_3fenb_31"
3109
- }, Zi = (t) => {
3110
- const { pageNumber: e, isFocused: n, viewport: r } = t, { goToPage: o } = le(), { pageRotate: i } = Je(), c = W(null), l = yn(), { pages: d } = oe(), [f, m] = q(null), P = W(!1), h = W(), T = M(() => n ? We["rp-thumbnail-active"] : "", [n]), C = M(() => ({
3111
- width: Math.round(r.width),
3112
- height: Math.round(r.height)
3113
- }), [r]), b = E(() => {
3114
- e && o(e);
3115
- }, [o, e]);
3116
- return D(() => {
3117
- const v = d.get(e);
3118
- h.current === v || (m(null), h.current = v);
3119
- }, [d, e]), D(() => {
3120
- const v = d.get(e);
3121
- if (!c.current || !e || !v || f)
3122
- return;
3123
- const y = new IntersectionObserver((g) => {
3124
- g.forEach((p) => {
3125
- if (P.current) {
3126
- P.current = !1, l.removeQueue(`thumbnail-${e}`);
3127
- return;
3128
- }
3129
- if (p.isIntersecting) {
3130
- const u = document.createElement("canvas");
3131
- P.current = !0, l.enqueue(
3132
- `thumbnail-${e}`,
3133
- {
3134
- page: v.page,
3135
- canvasElem: u,
3136
- options: {
3137
- scale: 1
3138
- },
3139
- onLoaded: () => {
3140
- u.toBlob((s) => {
3141
- if (!s)
3142
- return;
3143
- const _ = URL.createObjectURL(s);
3144
- m(_);
3145
- });
3146
- }
3147
- },
3148
- 2
3149
- );
3150
- }
3151
- });
3152
- });
3153
- return c.current && y.observe(c.current), () => {
3154
- y.disconnect(), l.removeQueue(`thumbnail-${e}`);
3155
- };
3156
- }, [l, e, d, f]), /* @__PURE__ */ H(
3157
- "div",
3158
- {
3159
- onClick: b,
3160
- id: `page-${e}`,
3161
- className: We["rp-thumbnail-wrapper"],
3162
- ref: c,
3163
- children: [
3164
- /* @__PURE__ */ a(
3165
- "div",
3166
- {
3167
- style: {
3168
- transform: `rotate(${i[e || 0]}deg)`
3169
- },
3170
- className: se(T, We["rp-thumbnail"]),
3171
- children: f ? /* @__PURE__ */ a(
3172
- "img",
3173
- {
3174
- src: f,
3175
- width: C.width,
3176
- height: C.height,
3177
- alt: "thumbnail"
3178
- }
3179
- ) : /* @__PURE__ */ a(
3180
- "div",
3181
- {
3182
- className: We["rp-thumbnail-loader"],
3183
- style: {
3184
- width: `${C.width}px`,
3185
- height: `${C.height}px`
3186
- },
3187
- children: /* @__PURE__ */ a(ln, {})
3188
- }
3189
- )
3190
- }
3191
- ),
3192
- /* @__PURE__ */ a("div", { className: We["rp-thumbnail-text"], children: e })
3193
- ]
3194
- }
3195
- );
3196
- }, nn = {
3197
- "rp-thumbnails-container": "_rp-thumbnails-container_16vqr_1",
3198
- "rp-thumbnails": "_rp-thumbnails_16vqr_1"
3199
- }, Xi = 16, Qi = (t, e) => {
3200
- const n = t == null ? void 0 : t.querySelector(`#page-${e}`);
3201
- t && (n != null && n.offsetTop) && (t.scrollTop = (n == null ? void 0 : n.offsetTop) - Xi);
3202
- }, Yi = et((t, e) => {
3203
- const { show: n, width: r } = t, { focusedPage: o, totalPages: i } = le(), { thumbnailPages: c, addPage: l, thumbnailLength: d, addToPage: f } = Tn(), m = W(null), P = W(1);
3204
- on(e, () => m.current);
3205
- const h = M(() => Object.values(c), [c]), T = E(() => {
3206
- const C = d + 1;
3207
- C <= i && l(C);
3208
- }, [l, i, d]);
3209
- return D(() => {
3210
- o > d && i > d ? f(o) : n && P.current !== o && (Qi(m.current, o), P.current = o);
3211
- }, [o, d, f, n, h]), Fo(m.current, T), /* @__PURE__ */ a("div", { ref: m, className: nn["rp-thumbnails-container"], style: { width: r }, children: /* @__PURE__ */ a("div", { className: nn["rp-thumbnails"], children: n ? h.map((C, b) => {
3212
- var v, y;
3213
- return /* @__PURE__ */ a(
3214
- Zi,
3215
- {
3216
- isFocused: o === ((v = C.page) == null ? void 0 : v.pageNumber),
3217
- pageNumber: (y = C.page) == null ? void 0 : y.pageNumber,
3218
- loading: C.loading,
3219
- viewport: C.viewport,
3220
- defaultRotation: C.defaultRotation
3221
- },
3222
- b
3223
- );
3224
- }) : null }) });
3225
- }), Ji = () => {
3226
- const { thumbnailIcon: t } = Ce(), { thumbnailIcon: e } = be();
3227
- return t || e || /* @__PURE__ */ a(xo, {});
3228
- }, ea = () => {
3229
- const { active: t, setActive: e } = Tn(), [n, r] = q(Mo), o = W(null), i = W(null), { thumbnailTool: c, sidebarEnable: l } = Te(), { localeMessages: d } = he(), f = E(() => {
3230
- e((P) => !P);
3231
- }, []), m = M(() => typeof c != "boolean" && c ? /* @__PURE__ */ a(c, { onClick: f, active: t }) : c ? /* @__PURE__ */ a(Q, { content: d == null ? void 0 : d.thumbnailTooltip, children: /* @__PURE__ */ a(
3232
- ge,
3233
- {
3234
- onClick: f,
3235
- active: t,
3236
- "aria-label": d == null ? void 0 : d.thumbnailTooltip,
3237
- children: /* @__PURE__ */ a(Ji, {})
3238
- }
3239
- ) }) : null, [c, t, f, d]);
3240
- return /* @__PURE__ */ a(pe, { children: l && /* @__PURE__ */ H(
3241
- "div",
3242
- {
3243
- style: { "--rp-thumbnail-width": `${n}px` },
3244
- className: ht["rp-sidebar-content-wrapper"],
3245
- "data-rp": "sidebar",
3246
- children: [
3247
- /* @__PURE__ */ a("div", { ref: i, className: ht["rp-sidebar-content"], children: m }),
3248
- /* @__PURE__ */ H(
3249
- "div",
3250
- {
3251
- "data-rp": "thumbnailSidebar",
3252
- hidden: !t,
3253
- className: ht["rp-thumbnails-wrapper"],
3254
- children: [
3255
- /* @__PURE__ */ a(Yi, { show: t, ref: o }),
3256
- /* @__PURE__ */ a(
3257
- Lo,
3258
- {
3259
- onWidthChange: r,
3260
- thumbnailRef: o,
3261
- leftSidebarRef: i
3262
- }
3263
- )
3264
- ]
3265
- }
3266
- )
3267
- ]
3268
- }
3269
- ) });
3270
- }, nc = io((t, e) => {
3271
- const {
3272
- children: n,
3273
- slots: r,
3274
- icons: o,
3275
- style: i,
3276
- className: c,
3277
- mobileWidth: l,
3278
- onLoaded: d,
3279
- cleanupOnLoaded: f,
3280
- onLayoutWidthChange: m
3281
- } = t, [P, h] = q(null), { setContainer: T, setContentRef: C } = _e(), { loading: b } = oe(), { LoaderImageComponent: v } = _t();
3282
- return D(() => (d && d(), () => {
3283
- f && f();
3284
- }), [d, f]), // TODO: deprecated in v2.0.0, remove later ~
3285
- /* @__PURE__ */ a(Rn, { toolbarRef: P, ref: e, children: /* @__PURE__ */ a(Io, { mobileWidth: l, onLayoutWidthChange: m, children: /* @__PURE__ */ a(Ro, { slots: r, children: /* @__PURE__ */ a(Ao, { icons: o, children: /* @__PURE__ */ H(So, { getContainerRef: T, style: i, className: c, children: [
3286
- /* @__PURE__ */ H(Eo, { children: [
3287
- /* @__PURE__ */ H("div", { className: we["rp-layout"], children: [
3288
- /* @__PURE__ */ a(
3289
- Ki,
3290
- {
3291
- ref: h
3292
- }
3293
- ),
3294
- /* @__PURE__ */ H("div", { className: we["rp-content"], children: [
3295
- /* @__PURE__ */ a("div", { className: we["rp-sidebar"], children: /* @__PURE__ */ a(ea, {}) }),
3296
- /* @__PURE__ */ a("div", { ref: C, className: we["rp-pages"], children: n })
3297
- ] })
3298
- ] }),
3299
- /* @__PURE__ */ a(Do, {})
3300
- ] }),
3301
- b ? /* @__PURE__ */ a(
3302
- "div",
3303
- {
3304
- className: we["rp-loader"],
3305
- style: {
3306
- position: "absolute",
3307
- top: 0,
3308
- left: 0,
3309
- right: 0,
3310
- bottom: 0,
3311
- width: "100%",
3312
- height: "100%"
3313
- },
3314
- children: /* @__PURE__ */ a(
3315
- "div",
3316
- {
3317
- style: {
3318
- display: "flex",
3319
- justifyContent: "center",
3320
- alignItems: "center",
3321
- height: "100%",
3322
- width: "100%"
3323
- },
3324
- children: v && /* @__PURE__ */ a(v, {})
3325
- }
3326
- )
3327
- }
3328
- ) : null
3329
- ] }) }) }) }) });
3330
- }), oc = {
3331
- "rp-toolbar-layout": "_rp-toolbar-layout_vwobs_1",
3332
- "rp-content": "_rp-content_vwobs_7",
3333
- "rp-topbar-content": "_rp-topbar-content_vwobs_13",
3334
- "rp-sidebar-content": "_rp-sidebar-content_vwobs_22",
3335
- "rp-pages": "_rp-pages_vwobs_32",
3336
- "rp-thumbnails-wrapper": "_rp-thumbnails-wrapper_vwobs_37"
3337
- };
3338
- export {
3339
- yn as A,
3340
- Mr as B,
3341
- Ar as C,
3342
- Ei as D,
3343
- Hr as E,
3344
- qr as F,
3345
- xt as G,
3346
- ri as H,
3347
- si as I,
3348
- ci as J,
3349
- li as K,
3350
- Rn as L,
3351
- Bn as M,
3352
- Zn as N,
3353
- $i as O,
3354
- Ks as P,
3355
- qi as Q,
3356
- Js as R,
3357
- Vi as S,
3358
- Xs as T,
3359
- tn as U,
3360
- Ki as V,
3361
- Zi as W,
3362
- ea as X,
3363
- nc as a,
3364
- Gn as b,
3365
- tt as c,
3366
- yt as d,
3367
- Qs as e,
3368
- Ys as f,
3369
- Zs as g,
3370
- Tn as h,
3371
- pt as i,
3372
- ke as j,
3373
- hi as k,
3374
- Gi as l,
3375
- oc as m,
3376
- Yi as n,
3377
- ji as o,
3378
- vn as p,
3379
- Er as q,
3380
- wn as r,
3381
- Nr as s,
3382
- _n as t,
3383
- le as u,
3384
- Or as v,
3385
- bn as w,
3386
- Dr as x,
3387
- Cn as y,
3388
- Pn as z
3389
- };