@pdf-viewer/react 1.5.0-beta.0 → 1.5.0-beta.10

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