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