@pdf-viewer/react 1.8.0-rc.2 → 1.9.0-beta.1

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