@pdf-viewer/react 1.3.0-rc.2 → 1.4.0-beta.0

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