@pdf-viewer/react 1.9.0-beta.3 → 1.9.0-beta.4

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