@pdf-viewer/react 1.6.0-beta.10 → 1.6.0-beta.11

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