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