@pdf-viewer/react 1.17.0-beta.0 → 1.17.0-beta.2

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