@pdf-viewer/react 1.8.0-beta.3 → 1.8.0-beta.5

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