@pdf-viewer/react 1.1.0-beta.4 → 1.1.0-beta.6

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