@pdf-viewer/react 0.6.0-beta.5 → 0.7.0-beta.0

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