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

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