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