@pdf-viewer/react 1.1.0-beta.5 → 1.1.0-beta.7

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