@pdf-viewer/react 1.12.0 → 1.13.0-rc.0

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