@pdf-viewer/react 1.6.0-beta.1 → 1.6.0-beta.2

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