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

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