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