@pdf-viewer/react 1.5.0-beta.3 → 1.5.0-beta.4

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