@pdf-viewer/react 1.6.0-beta.4 → 1.6.0-beta.6

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