@pdf-viewer/react 0.0.0-experimental.2 → 0.0.0-experimental.3

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