@pdf-viewer/react 1.7.0-beta.2 → 1.7.0-beta.4

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