@cannyminds/dms-file-viewers 0.4.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-DOOYIHGW.js → chunk-56PP5GHZ.js} +70 -18
- package/dist/chunk-56PP5GHZ.js.map +1 -0
- package/dist/{chunk-7BLEPGZ4.mjs → chunk-7AUCINV2.mjs} +70 -18
- package/dist/chunk-7AUCINV2.mjs.map +1 -0
- package/dist/chunk-A2MSWOEM.js +159 -0
- package/dist/chunk-A2MSWOEM.js.map +1 -0
- package/dist/{chunk-SBEFC7HP.js → chunk-CQ3HSM5S.js} +70 -18
- package/dist/chunk-CQ3HSM5S.js.map +1 -0
- package/dist/{chunk-DDT3GC3C.js → chunk-D7LXG67Z.js} +482 -510
- package/dist/chunk-D7LXG67Z.js.map +1 -0
- package/dist/chunk-EAM7CURM.js +334 -0
- package/dist/chunk-EAM7CURM.js.map +1 -0
- package/dist/{chunk-SNEIVT4R.js → chunk-ETHSDRF5.js} +70 -18
- package/dist/chunk-ETHSDRF5.js.map +1 -0
- package/dist/{chunk-RE4XRGSV.js → chunk-FA5L62Y5.js} +52 -32
- package/dist/chunk-FA5L62Y5.js.map +1 -0
- package/dist/chunk-GMDRDOWP.mjs +159 -0
- package/dist/chunk-GMDRDOWP.mjs.map +1 -0
- package/dist/{chunk-4DJJINTB.mjs → chunk-KBST5Z5H.mjs} +69 -17
- package/dist/chunk-KBST5Z5H.mjs.map +1 -0
- package/dist/{chunk-WP55NYFS.js → chunk-LQVHD4FS.js} +71 -19
- package/dist/chunk-LQVHD4FS.js.map +1 -0
- package/dist/chunk-M57PSU4O.mjs +36 -0
- package/dist/chunk-M57PSU4O.mjs.map +1 -0
- package/dist/{chunk-YHMHDPLQ.mjs → chunk-PFJKVNUA.mjs} +69 -17
- package/dist/chunk-PFJKVNUA.mjs.map +1 -0
- package/dist/{chunk-677DWENS.mjs → chunk-THFHTTQX.mjs} +64 -17
- package/dist/chunk-THFHTTQX.mjs.map +1 -0
- package/dist/chunk-U4W524VZ.mjs +334 -0
- package/dist/chunk-U4W524VZ.mjs.map +1 -0
- package/dist/{chunk-77UARJVQ.js → chunk-UUM656JE.js} +66 -19
- package/dist/chunk-UUM656JE.js.map +1 -0
- package/dist/{chunk-QQDQJ7TS.mjs → chunk-VJFXCN5Z.mjs} +50 -30
- package/dist/chunk-VJFXCN5Z.mjs.map +1 -0
- package/dist/{chunk-BHMFZTZ7.mjs → chunk-WNZHGFNC.mjs} +69 -17
- package/dist/chunk-WNZHGFNC.mjs.map +1 -0
- package/dist/chunk-YEPEMLM3.js +36 -0
- package/dist/chunk-YEPEMLM3.js.map +1 -0
- package/dist/{chunk-J2YW5DHC.mjs → chunk-ZKGWS327.mjs} +517 -545
- package/dist/chunk-ZKGWS327.mjs.map +1 -0
- package/dist/components/viewers/AudioViewer.d.mts +1 -1
- package/dist/components/viewers/AudioViewer.d.ts +1 -1
- package/dist/components/viewers/AudioViewer.js +4 -3
- package/dist/components/viewers/AudioViewer.js.map +1 -1
- package/dist/components/viewers/AudioViewer.mjs +3 -2
- package/dist/components/viewers/DefaultViewer.d.mts +1 -1
- package/dist/components/viewers/DefaultViewer.d.ts +1 -1
- package/dist/components/viewers/DefaultViewer.js +4 -3
- package/dist/components/viewers/DefaultViewer.js.map +1 -1
- package/dist/components/viewers/DefaultViewer.mjs +3 -2
- package/dist/components/viewers/ImageViewer.d.mts +1 -1
- package/dist/components/viewers/ImageViewer.d.ts +1 -1
- package/dist/components/viewers/ImageViewer.js +4 -4
- package/dist/components/viewers/ImageViewer.mjs +3 -3
- package/dist/components/viewers/PDFViewer.d.mts +1 -1
- package/dist/components/viewers/PDFViewer.d.ts +1 -1
- package/dist/components/viewers/PDFViewer.js +5 -3
- package/dist/components/viewers/PDFViewer.js.map +1 -1
- package/dist/components/viewers/PDFViewer.mjs +4 -2
- package/dist/components/viewers/TIFFViewer.d.mts +1 -1
- package/dist/components/viewers/TIFFViewer.d.ts +1 -1
- package/dist/components/viewers/TIFFViewer.js +4 -3
- package/dist/components/viewers/TIFFViewer.js.map +1 -1
- package/dist/components/viewers/TIFFViewer.mjs +3 -2
- package/dist/components/viewers/TextViewer.d.mts +1 -1
- package/dist/components/viewers/TextViewer.d.ts +1 -1
- package/dist/components/viewers/TextViewer.js +4 -3
- package/dist/components/viewers/TextViewer.js.map +1 -1
- package/dist/components/viewers/TextViewer.mjs +3 -2
- package/dist/components/viewers/VideoViewer.d.mts +1 -1
- package/dist/components/viewers/VideoViewer.d.ts +1 -1
- package/dist/components/viewers/VideoViewer.js +4 -3
- package/dist/components/viewers/VideoViewer.js.map +1 -1
- package/dist/components/viewers/VideoViewer.mjs +3 -2
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +14 -11
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +12 -9
- package/dist/index.mjs.map +1 -1
- package/dist/{types-C6IEfcTM.d.mts → types-BmZB9kkJ.d.mts} +13 -1
- package/dist/{types-C6IEfcTM.d.ts → types-BmZB9kkJ.d.ts} +13 -1
- package/package.json +1 -1
- package/dist/chunk-4DJJINTB.mjs.map +0 -1
- package/dist/chunk-677DWENS.mjs.map +0 -1
- package/dist/chunk-77UARJVQ.js.map +0 -1
- package/dist/chunk-7BLEPGZ4.mjs.map +0 -1
- package/dist/chunk-BHMFZTZ7.mjs.map +0 -1
- package/dist/chunk-BONT4K3R.mjs +0 -294
- package/dist/chunk-BONT4K3R.mjs.map +0 -1
- package/dist/chunk-DDT3GC3C.js.map +0 -1
- package/dist/chunk-DOOYIHGW.js.map +0 -1
- package/dist/chunk-J2YW5DHC.mjs.map +0 -1
- package/dist/chunk-QQDQJ7TS.mjs.map +0 -1
- package/dist/chunk-RE4XRGSV.js.map +0 -1
- package/dist/chunk-SBEFC7HP.js.map +0 -1
- package/dist/chunk-SNEIVT4R.js.map +0 -1
- package/dist/chunk-WP55NYFS.js.map +0 -1
- package/dist/chunk-YHMHDPLQ.mjs.map +0 -1
- package/dist/chunk-Z3IUTTJQ.js +0 -294
- package/dist/chunk-Z3IUTTJQ.js.map +0 -1
|
@@ -1,12 +1,41 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import {
|
|
3
|
-
|
|
3
|
+
toolbarStyles
|
|
4
|
+
} from "./chunk-GMDRDOWP.mjs";
|
|
5
|
+
import {
|
|
4
6
|
getFileExtension
|
|
5
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-M57PSU4O.mjs";
|
|
8
|
+
import {
|
|
9
|
+
FileIcon_default,
|
|
10
|
+
mergeToolbarConfig
|
|
11
|
+
} from "./chunk-VJFXCN5Z.mjs";
|
|
6
12
|
|
|
7
13
|
// src/components/viewers/PDFViewer.tsx
|
|
8
14
|
import { useCallback, useEffect as useEffect3, useMemo, useRef as useRef2, useState as useState3, forwardRef, useImperativeHandle } from "react";
|
|
15
|
+
|
|
16
|
+
// src/components/viewers/pdf/StablePDFViewer.tsx
|
|
17
|
+
import React from "react";
|
|
9
18
|
import { PDFViewer as HeadlessPDFViewerImport } from "@cannyminds/pdf-viewer";
|
|
19
|
+
import { jsx } from "react/jsx-runtime";
|
|
20
|
+
var HeadlessPDFViewer = HeadlessPDFViewerImport;
|
|
21
|
+
var StablePDFViewer = React.memo(({
|
|
22
|
+
pdfBuffer,
|
|
23
|
+
onPasswordRequest,
|
|
24
|
+
pdfViewerRef
|
|
25
|
+
}) => {
|
|
26
|
+
return /* @__PURE__ */ jsx(
|
|
27
|
+
HeadlessPDFViewer,
|
|
28
|
+
{
|
|
29
|
+
ref: pdfViewerRef,
|
|
30
|
+
pdfBuffer,
|
|
31
|
+
onPasswordRequest
|
|
32
|
+
}
|
|
33
|
+
);
|
|
34
|
+
});
|
|
35
|
+
StablePDFViewer.displayName = "StablePDFViewer";
|
|
36
|
+
|
|
37
|
+
// src/components/viewers/pdf/PDFToolbar.tsx
|
|
38
|
+
import React2 from "react";
|
|
10
39
|
import FirstPageIcon from "@mui/icons-material/FirstPage";
|
|
11
40
|
import LastPageIcon from "@mui/icons-material/LastPage";
|
|
12
41
|
import ChevronLeftIcon from "@mui/icons-material/ChevronLeft";
|
|
@@ -15,11 +44,239 @@ import ZoomInIcon from "@mui/icons-material/ZoomIn";
|
|
|
15
44
|
import ZoomOutIcon from "@mui/icons-material/ZoomOut";
|
|
16
45
|
import FitScreenIcon from "@mui/icons-material/FitScreen";
|
|
17
46
|
import AspectRatioIcon from "@mui/icons-material/AspectRatio";
|
|
18
|
-
import
|
|
47
|
+
import SearchIcon from "@mui/icons-material/Search";
|
|
48
|
+
import FullscreenIcon from "@mui/icons-material/Fullscreen";
|
|
19
49
|
import DownloadIcon from "@mui/icons-material/Download";
|
|
20
50
|
import PrintIcon from "@mui/icons-material/Print";
|
|
21
51
|
import InfoIcon from "@mui/icons-material/Info";
|
|
22
52
|
import DescriptionIcon from "@mui/icons-material/Description";
|
|
53
|
+
import { Fragment, jsx as jsx2, jsxs } from "react/jsx-runtime";
|
|
54
|
+
var PDFToolbar = React2.memo(({
|
|
55
|
+
currentPage,
|
|
56
|
+
totalPages,
|
|
57
|
+
zoom,
|
|
58
|
+
isSidebarOpen,
|
|
59
|
+
showPageNavigation,
|
|
60
|
+
showPageCount,
|
|
61
|
+
showZoomControls,
|
|
62
|
+
showSearch,
|
|
63
|
+
showMetadata,
|
|
64
|
+
showProperties,
|
|
65
|
+
showDownload,
|
|
66
|
+
showPrint,
|
|
67
|
+
disabledMetadata,
|
|
68
|
+
disabledProperties,
|
|
69
|
+
disabledDownload,
|
|
70
|
+
disabledPrint,
|
|
71
|
+
onFirstPage,
|
|
72
|
+
onPreviousPage,
|
|
73
|
+
onNextPage,
|
|
74
|
+
onLastPage,
|
|
75
|
+
onPageInput,
|
|
76
|
+
onPageInputKeyPress,
|
|
77
|
+
onZoomIn,
|
|
78
|
+
onZoomOut,
|
|
79
|
+
onFitToWidth,
|
|
80
|
+
onFitToPage,
|
|
81
|
+
onToggleSidebar,
|
|
82
|
+
onToggleFullScreen,
|
|
83
|
+
onDownloadClick,
|
|
84
|
+
onPrintClick,
|
|
85
|
+
onMetadataClick,
|
|
86
|
+
onPropertiesClick
|
|
87
|
+
}) => {
|
|
88
|
+
return /* @__PURE__ */ jsxs("div", { className: "pdf-viewer-toolbar", children: [
|
|
89
|
+
showPageNavigation && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
90
|
+
/* @__PURE__ */ jsx2("div", { className: "toolbar-separator" }),
|
|
91
|
+
/* @__PURE__ */ jsxs("div", { className: "toolbar-section", children: [
|
|
92
|
+
/* @__PURE__ */ jsx2(
|
|
93
|
+
"button",
|
|
94
|
+
{
|
|
95
|
+
className: "toolbar-button",
|
|
96
|
+
onClick: onFirstPage,
|
|
97
|
+
disabled: currentPage <= 1,
|
|
98
|
+
title: "First Page",
|
|
99
|
+
children: /* @__PURE__ */ jsx2(FirstPageIcon, { fontSize: "small" })
|
|
100
|
+
}
|
|
101
|
+
),
|
|
102
|
+
/* @__PURE__ */ jsx2(
|
|
103
|
+
"button",
|
|
104
|
+
{
|
|
105
|
+
className: "toolbar-button",
|
|
106
|
+
onClick: onPreviousPage,
|
|
107
|
+
disabled: currentPage <= 1,
|
|
108
|
+
title: "Previous Page",
|
|
109
|
+
children: /* @__PURE__ */ jsx2(ChevronLeftIcon, { fontSize: "small" })
|
|
110
|
+
}
|
|
111
|
+
),
|
|
112
|
+
/* @__PURE__ */ jsx2(
|
|
113
|
+
"input",
|
|
114
|
+
{
|
|
115
|
+
type: "number",
|
|
116
|
+
className: "page-input",
|
|
117
|
+
value: currentPage,
|
|
118
|
+
onChange: onPageInput,
|
|
119
|
+
onKeyPress: onPageInputKeyPress,
|
|
120
|
+
min: 1,
|
|
121
|
+
max: totalPages || void 0
|
|
122
|
+
}
|
|
123
|
+
),
|
|
124
|
+
showPageCount && /* @__PURE__ */ jsxs("span", { className: "page-info", children: [
|
|
125
|
+
"of ",
|
|
126
|
+
totalPages || "..."
|
|
127
|
+
] }),
|
|
128
|
+
/* @__PURE__ */ jsx2(
|
|
129
|
+
"button",
|
|
130
|
+
{
|
|
131
|
+
className: "toolbar-button",
|
|
132
|
+
onClick: onNextPage,
|
|
133
|
+
disabled: currentPage >= totalPages,
|
|
134
|
+
title: "Next Page",
|
|
135
|
+
children: /* @__PURE__ */ jsx2(ChevronRightIcon, { fontSize: "small" })
|
|
136
|
+
}
|
|
137
|
+
),
|
|
138
|
+
/* @__PURE__ */ jsx2(
|
|
139
|
+
"button",
|
|
140
|
+
{
|
|
141
|
+
className: "toolbar-button",
|
|
142
|
+
onClick: onLastPage,
|
|
143
|
+
disabled: currentPage >= totalPages,
|
|
144
|
+
title: "Last Page",
|
|
145
|
+
children: /* @__PURE__ */ jsx2(LastPageIcon, { fontSize: "small" })
|
|
146
|
+
}
|
|
147
|
+
)
|
|
148
|
+
] })
|
|
149
|
+
] }),
|
|
150
|
+
showZoomControls && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
151
|
+
/* @__PURE__ */ jsx2("div", { className: "toolbar-separator" }),
|
|
152
|
+
/* @__PURE__ */ jsxs("div", { className: "toolbar-section", children: [
|
|
153
|
+
/* @__PURE__ */ jsx2(
|
|
154
|
+
"button",
|
|
155
|
+
{
|
|
156
|
+
className: "toolbar-button",
|
|
157
|
+
onClick: onZoomOut,
|
|
158
|
+
title: "Zoom Out",
|
|
159
|
+
children: /* @__PURE__ */ jsx2(ZoomOutIcon, { fontSize: "small" })
|
|
160
|
+
}
|
|
161
|
+
),
|
|
162
|
+
/* @__PURE__ */ jsxs("span", { className: "zoom-display", children: [
|
|
163
|
+
zoom,
|
|
164
|
+
"%"
|
|
165
|
+
] }),
|
|
166
|
+
/* @__PURE__ */ jsx2(
|
|
167
|
+
"button",
|
|
168
|
+
{
|
|
169
|
+
className: "toolbar-button",
|
|
170
|
+
onClick: onZoomIn,
|
|
171
|
+
title: "Zoom In",
|
|
172
|
+
children: /* @__PURE__ */ jsx2(ZoomInIcon, { fontSize: "small" })
|
|
173
|
+
}
|
|
174
|
+
),
|
|
175
|
+
/* @__PURE__ */ jsx2(
|
|
176
|
+
"button",
|
|
177
|
+
{
|
|
178
|
+
className: "toolbar-button",
|
|
179
|
+
onClick: onFitToWidth,
|
|
180
|
+
title: "Fit to Width",
|
|
181
|
+
children: /* @__PURE__ */ jsx2(AspectRatioIcon, { fontSize: "small" })
|
|
182
|
+
}
|
|
183
|
+
),
|
|
184
|
+
/* @__PURE__ */ jsx2(
|
|
185
|
+
"button",
|
|
186
|
+
{
|
|
187
|
+
className: "toolbar-button",
|
|
188
|
+
onClick: onFitToPage,
|
|
189
|
+
title: "Fit to Page",
|
|
190
|
+
children: /* @__PURE__ */ jsx2(FitScreenIcon, { fontSize: "small" })
|
|
191
|
+
}
|
|
192
|
+
)
|
|
193
|
+
] })
|
|
194
|
+
] }),
|
|
195
|
+
showSearch && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
196
|
+
/* @__PURE__ */ jsx2("div", { className: "toolbar-separator" }),
|
|
197
|
+
/* @__PURE__ */ jsx2("div", { className: "toolbar-section", children: /* @__PURE__ */ jsx2(
|
|
198
|
+
"button",
|
|
199
|
+
{
|
|
200
|
+
className: "toolbar-button",
|
|
201
|
+
onClick: onToggleSidebar,
|
|
202
|
+
title: "Search in PDF",
|
|
203
|
+
style: {
|
|
204
|
+
backgroundColor: isSidebarOpen ? "#e3f2fd" : "transparent",
|
|
205
|
+
color: isSidebarOpen ? "#1976d2" : "inherit"
|
|
206
|
+
},
|
|
207
|
+
children: /* @__PURE__ */ jsx2(SearchIcon, { fontSize: "small" })
|
|
208
|
+
}
|
|
209
|
+
) })
|
|
210
|
+
] }),
|
|
211
|
+
/* @__PURE__ */ jsx2("div", { className: "toolbar-separator" }),
|
|
212
|
+
/* @__PURE__ */ jsx2("div", { className: "toolbar-section", children: /* @__PURE__ */ jsx2(
|
|
213
|
+
"button",
|
|
214
|
+
{
|
|
215
|
+
className: "toolbar-button",
|
|
216
|
+
onClick: onToggleFullScreen,
|
|
217
|
+
title: "Fullscreen",
|
|
218
|
+
children: /* @__PURE__ */ jsx2(FullscreenIcon, { fontSize: "small" })
|
|
219
|
+
}
|
|
220
|
+
) }),
|
|
221
|
+
(showMetadata || showProperties || showDownload || showPrint) && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
222
|
+
/* @__PURE__ */ jsx2("div", { className: "toolbar-separator" }),
|
|
223
|
+
/* @__PURE__ */ jsxs("div", { className: "toolbar-section", children: [
|
|
224
|
+
showDownload && /* @__PURE__ */ jsx2(
|
|
225
|
+
"button",
|
|
226
|
+
{
|
|
227
|
+
className: "toolbar-button",
|
|
228
|
+
onClick: onDownloadClick,
|
|
229
|
+
disabled: disabledDownload,
|
|
230
|
+
title: "Download PDF",
|
|
231
|
+
children: /* @__PURE__ */ jsx2(DownloadIcon, { fontSize: "small" })
|
|
232
|
+
}
|
|
233
|
+
),
|
|
234
|
+
showPrint && /* @__PURE__ */ jsx2(
|
|
235
|
+
"button",
|
|
236
|
+
{
|
|
237
|
+
className: "toolbar-button",
|
|
238
|
+
onClick: onPrintClick,
|
|
239
|
+
disabled: disabledPrint,
|
|
240
|
+
title: "Print PDF",
|
|
241
|
+
children: /* @__PURE__ */ jsx2(PrintIcon, { fontSize: "small" })
|
|
242
|
+
}
|
|
243
|
+
),
|
|
244
|
+
showMetadata && /* @__PURE__ */ jsx2(
|
|
245
|
+
"button",
|
|
246
|
+
{
|
|
247
|
+
className: "toolbar-button",
|
|
248
|
+
onClick: onMetadataClick,
|
|
249
|
+
disabled: disabledMetadata,
|
|
250
|
+
title: "Document Metadata",
|
|
251
|
+
children: /* @__PURE__ */ jsx2(DescriptionIcon, { fontSize: "small" })
|
|
252
|
+
}
|
|
253
|
+
),
|
|
254
|
+
showProperties && /* @__PURE__ */ jsx2(
|
|
255
|
+
"button",
|
|
256
|
+
{
|
|
257
|
+
className: "toolbar-button",
|
|
258
|
+
onClick: onPropertiesClick,
|
|
259
|
+
disabled: disabledProperties,
|
|
260
|
+
title: "Document Properties",
|
|
261
|
+
children: /* @__PURE__ */ jsx2(InfoIcon, { fontSize: "small" })
|
|
262
|
+
}
|
|
263
|
+
)
|
|
264
|
+
] })
|
|
265
|
+
] })
|
|
266
|
+
] });
|
|
267
|
+
});
|
|
268
|
+
PDFToolbar.displayName = "PDFToolbar";
|
|
269
|
+
|
|
270
|
+
// src/components/viewers/pdf/PDFHeader.tsx
|
|
271
|
+
import React3 from "react";
|
|
272
|
+
import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
273
|
+
var PDFHeader = React3.memo(({ fileName, fileExtension }) => {
|
|
274
|
+
return /* @__PURE__ */ jsxs2("div", { className: "pdf-viewer-header", children: [
|
|
275
|
+
/* @__PURE__ */ jsx3(FileIcon_default, { ext: fileExtension, size: 26 }),
|
|
276
|
+
/* @__PURE__ */ jsx3("div", { className: "header-file-name", title: fileName, children: fileName })
|
|
277
|
+
] });
|
|
278
|
+
});
|
|
279
|
+
PDFHeader.displayName = "PDFHeader";
|
|
23
280
|
|
|
24
281
|
// src/components/viewers/pdf/SearchSidebar.tsx
|
|
25
282
|
import { useState, useLayoutEffect, useEffect, useRef } from "react";
|
|
@@ -31,13 +288,13 @@ import {
|
|
|
31
288
|
InputAdornment,
|
|
32
289
|
Divider
|
|
33
290
|
} from "@mui/material";
|
|
34
|
-
import
|
|
291
|
+
import SearchIcon2 from "@mui/icons-material/Search";
|
|
35
292
|
import CloseIcon from "@mui/icons-material/Close";
|
|
36
293
|
import KeyboardArrowUpIcon from "@mui/icons-material/KeyboardArrowUp";
|
|
37
294
|
import KeyboardArrowDownIcon from "@mui/icons-material/KeyboardArrowDown";
|
|
38
295
|
import ClearIcon from "@mui/icons-material/Clear";
|
|
39
296
|
import FindInPageIcon from "@mui/icons-material/FindInPage";
|
|
40
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
297
|
+
import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
41
298
|
var SearchSidebar = ({
|
|
42
299
|
isOpen,
|
|
43
300
|
onClose,
|
|
@@ -172,7 +429,7 @@ var SearchSidebar = ({
|
|
|
172
429
|
const regex = new RegExp(`(${escapedKeyword})`, "gi");
|
|
173
430
|
const parts = textString.split(regex);
|
|
174
431
|
return parts.map(
|
|
175
|
-
(part, index) => regex.test(part) ? /* @__PURE__ */
|
|
432
|
+
(part, index) => regex.test(part) ? /* @__PURE__ */ jsx4(
|
|
176
433
|
Box,
|
|
177
434
|
{
|
|
178
435
|
component: "span",
|
|
@@ -191,7 +448,7 @@ var SearchSidebar = ({
|
|
|
191
448
|
}
|
|
192
449
|
};
|
|
193
450
|
if (!isOpen) return null;
|
|
194
|
-
return /* @__PURE__ */
|
|
451
|
+
return /* @__PURE__ */ jsxs3(
|
|
195
452
|
Box,
|
|
196
453
|
{
|
|
197
454
|
sx: {
|
|
@@ -205,10 +462,10 @@ var SearchSidebar = ({
|
|
|
205
462
|
overflow: "hidden"
|
|
206
463
|
},
|
|
207
464
|
children: [
|
|
208
|
-
/* @__PURE__ */
|
|
209
|
-
/* @__PURE__ */
|
|
210
|
-
/* @__PURE__ */
|
|
211
|
-
/* @__PURE__ */
|
|
465
|
+
/* @__PURE__ */ jsxs3(Box, { sx: { px: 3, py: 2.5, backgroundColor: "background.default" }, children: [
|
|
466
|
+
/* @__PURE__ */ jsxs3(Box, { sx: { display: "flex", alignItems: "center", justifyContent: "space-between", mb: 2 }, children: [
|
|
467
|
+
/* @__PURE__ */ jsx4(Typography, { variant: "h6", sx: { fontSize: "1.125rem", fontWeight: 600, color: "text.primary" }, children: "Search" }),
|
|
468
|
+
/* @__PURE__ */ jsx4(
|
|
212
469
|
IconButton,
|
|
213
470
|
{
|
|
214
471
|
size: "small",
|
|
@@ -217,11 +474,11 @@ var SearchSidebar = ({
|
|
|
217
474
|
color: "text.secondary",
|
|
218
475
|
padding: "6px"
|
|
219
476
|
},
|
|
220
|
-
children: /* @__PURE__ */
|
|
477
|
+
children: /* @__PURE__ */ jsx4(CloseIcon, { fontSize: "small" })
|
|
221
478
|
}
|
|
222
479
|
)
|
|
223
480
|
] }),
|
|
224
|
-
/* @__PURE__ */
|
|
481
|
+
/* @__PURE__ */ jsx4("form", { onSubmit: handleSearchSubmit, children: /* @__PURE__ */ jsx4(
|
|
225
482
|
TextField,
|
|
226
483
|
{
|
|
227
484
|
fullWidth: true,
|
|
@@ -231,8 +488,8 @@ var SearchSidebar = ({
|
|
|
231
488
|
onChange: handleSearchChange,
|
|
232
489
|
autoComplete: "off",
|
|
233
490
|
InputProps: {
|
|
234
|
-
startAdornment: /* @__PURE__ */
|
|
235
|
-
endAdornment: searchTerm && /* @__PURE__ */
|
|
491
|
+
startAdornment: /* @__PURE__ */ jsx4(InputAdornment, { position: "start", children: /* @__PURE__ */ jsx4(SearchIcon2, { sx: { color: "text.disabled", fontSize: 20 } }) }),
|
|
492
|
+
endAdornment: searchTerm && /* @__PURE__ */ jsx4(InputAdornment, { position: "end", children: /* @__PURE__ */ jsx4(
|
|
236
493
|
IconButton,
|
|
237
494
|
{
|
|
238
495
|
size: "small",
|
|
@@ -244,7 +501,7 @@ var SearchSidebar = ({
|
|
|
244
501
|
backgroundColor: "action.hover"
|
|
245
502
|
}
|
|
246
503
|
},
|
|
247
|
-
children: /* @__PURE__ */
|
|
504
|
+
children: /* @__PURE__ */ jsx4(ClearIcon, { sx: { fontSize: 18 } })
|
|
248
505
|
}
|
|
249
506
|
) })
|
|
250
507
|
},
|
|
@@ -267,7 +524,7 @@ var SearchSidebar = ({
|
|
|
267
524
|
}
|
|
268
525
|
}
|
|
269
526
|
) }),
|
|
270
|
-
totalResults > 0 && /* @__PURE__ */
|
|
527
|
+
totalResults > 0 && /* @__PURE__ */ jsxs3(
|
|
271
528
|
Box,
|
|
272
529
|
{
|
|
273
530
|
sx: {
|
|
@@ -280,14 +537,14 @@ var SearchSidebar = ({
|
|
|
280
537
|
borderColor: "divider"
|
|
281
538
|
},
|
|
282
539
|
children: [
|
|
283
|
-
/* @__PURE__ */
|
|
540
|
+
/* @__PURE__ */ jsxs3(Typography, { variant: "body2", sx: { color: "text.secondary", fontSize: "0.875rem", fontWeight: 500 }, children: [
|
|
284
541
|
currentResultIndex + 1,
|
|
285
542
|
" of ",
|
|
286
543
|
totalResults,
|
|
287
544
|
" results"
|
|
288
545
|
] }),
|
|
289
|
-
/* @__PURE__ */
|
|
290
|
-
/* @__PURE__ */
|
|
546
|
+
/* @__PURE__ */ jsxs3(Box, { sx: { display: "flex", alignItems: "center", gap: 0.5 }, children: [
|
|
547
|
+
/* @__PURE__ */ jsx4(
|
|
291
548
|
IconButton,
|
|
292
549
|
{
|
|
293
550
|
size: "small",
|
|
@@ -300,10 +557,10 @@ var SearchSidebar = ({
|
|
|
300
557
|
border: "1px solid",
|
|
301
558
|
borderColor: currentResultIndex <= 0 ? "divider" : "primary.main"
|
|
302
559
|
},
|
|
303
|
-
children: /* @__PURE__ */
|
|
560
|
+
children: /* @__PURE__ */ jsx4(KeyboardArrowUpIcon, { sx: { fontSize: 20 } })
|
|
304
561
|
}
|
|
305
562
|
),
|
|
306
|
-
/* @__PURE__ */
|
|
563
|
+
/* @__PURE__ */ jsx4(
|
|
307
564
|
IconButton,
|
|
308
565
|
{
|
|
309
566
|
size: "small",
|
|
@@ -316,7 +573,7 @@ var SearchSidebar = ({
|
|
|
316
573
|
border: "1px solid",
|
|
317
574
|
borderColor: currentResultIndex >= totalResults - 1 ? "divider" : "primary.main"
|
|
318
575
|
},
|
|
319
|
-
children: /* @__PURE__ */
|
|
576
|
+
children: /* @__PURE__ */ jsx4(KeyboardArrowDownIcon, { sx: { fontSize: 20 } })
|
|
320
577
|
}
|
|
321
578
|
)
|
|
322
579
|
] })
|
|
@@ -324,14 +581,14 @@ var SearchSidebar = ({
|
|
|
324
581
|
}
|
|
325
582
|
)
|
|
326
583
|
] }),
|
|
327
|
-
/* @__PURE__ */
|
|
328
|
-
/* @__PURE__ */
|
|
584
|
+
/* @__PURE__ */ jsx4(Divider, {}),
|
|
585
|
+
/* @__PURE__ */ jsxs3(Box, { ref: contentRef, className: "search-sidebar-content", sx: {
|
|
329
586
|
flex: 1,
|
|
330
587
|
overflow: "auto",
|
|
331
588
|
backgroundColor: "background.default"
|
|
332
589
|
}, children: [
|
|
333
|
-
!searchTerm && !hasSearched && /* @__PURE__ */
|
|
334
|
-
/* @__PURE__ */
|
|
590
|
+
!searchTerm && !hasSearched && /* @__PURE__ */ jsxs3(Box, { sx: { p: 4, textAlign: "center", mt: 6 }, children: [
|
|
591
|
+
/* @__PURE__ */ jsx4(
|
|
335
592
|
Box,
|
|
336
593
|
{
|
|
337
594
|
sx: {
|
|
@@ -345,14 +602,14 @@ var SearchSidebar = ({
|
|
|
345
602
|
margin: "0 auto",
|
|
346
603
|
mb: 3
|
|
347
604
|
},
|
|
348
|
-
children: /* @__PURE__ */
|
|
605
|
+
children: /* @__PURE__ */ jsx4(SearchIcon2, { sx: { fontSize: 40, color: "text.disabled" } })
|
|
349
606
|
}
|
|
350
607
|
),
|
|
351
|
-
/* @__PURE__ */
|
|
352
|
-
/* @__PURE__ */
|
|
608
|
+
/* @__PURE__ */ jsx4(Typography, { variant: "body1", sx: { color: "text.primary", fontWeight: 500, mb: 1 }, children: "Search in Document" }),
|
|
609
|
+
/* @__PURE__ */ jsx4(Typography, { variant: "body2", sx: { color: "text.secondary", lineHeight: 1.6 }, children: "Enter keywords to find text within the PDF document" })
|
|
353
610
|
] }),
|
|
354
|
-
searchTerm && !hasSearched && /* @__PURE__ */
|
|
355
|
-
/* @__PURE__ */
|
|
611
|
+
searchTerm && !hasSearched && /* @__PURE__ */ jsxs3(Box, { sx: { p: 4, textAlign: "center", mt: 6 }, children: [
|
|
612
|
+
/* @__PURE__ */ jsx4(
|
|
356
613
|
Box,
|
|
357
614
|
{
|
|
358
615
|
sx: {
|
|
@@ -367,12 +624,12 @@ var SearchSidebar = ({
|
|
|
367
624
|
mb: 3,
|
|
368
625
|
opacity: 0.2
|
|
369
626
|
},
|
|
370
|
-
children: /* @__PURE__ */
|
|
627
|
+
children: /* @__PURE__ */ jsx4(FindInPageIcon, { sx: { fontSize: 40, color: "primary.main" } })
|
|
371
628
|
}
|
|
372
629
|
),
|
|
373
|
-
/* @__PURE__ */
|
|
374
|
-
/* @__PURE__ */
|
|
375
|
-
/* @__PURE__ */
|
|
630
|
+
/* @__PURE__ */ jsx4(Typography, { variant: "body1", sx: { color: "text.primary", fontWeight: 500, mb: 1 }, children: "Ready to Search" }),
|
|
631
|
+
/* @__PURE__ */ jsx4(Typography, { variant: "body2", sx: { color: "text.secondary", mb: 2, lineHeight: 1.6 }, children: "Press Enter to find" }),
|
|
632
|
+
/* @__PURE__ */ jsxs3(
|
|
376
633
|
Typography,
|
|
377
634
|
{
|
|
378
635
|
variant: "body2",
|
|
@@ -393,8 +650,8 @@ var SearchSidebar = ({
|
|
|
393
650
|
}
|
|
394
651
|
)
|
|
395
652
|
] }),
|
|
396
|
-
hasSearched && totalResults === 0 && !isSearching && /* @__PURE__ */
|
|
397
|
-
/* @__PURE__ */
|
|
653
|
+
hasSearched && totalResults === 0 && !isSearching && /* @__PURE__ */ jsxs3(Box, { sx: { p: 4, textAlign: "center", mt: 6 }, children: [
|
|
654
|
+
/* @__PURE__ */ jsx4(
|
|
398
655
|
Box,
|
|
399
656
|
{
|
|
400
657
|
sx: {
|
|
@@ -409,24 +666,24 @@ var SearchSidebar = ({
|
|
|
409
666
|
mb: 3,
|
|
410
667
|
opacity: 0.6
|
|
411
668
|
},
|
|
412
|
-
children: /* @__PURE__ */
|
|
669
|
+
children: /* @__PURE__ */ jsx4(SearchIcon2, { sx: { fontSize: 40, color: "warning.main" } })
|
|
413
670
|
}
|
|
414
671
|
),
|
|
415
|
-
/* @__PURE__ */
|
|
416
|
-
/* @__PURE__ */
|
|
672
|
+
/* @__PURE__ */ jsx4(Typography, { variant: "body1", sx: { color: "text.primary", fontWeight: 500, mb: 1 }, children: "No Results Found" }),
|
|
673
|
+
/* @__PURE__ */ jsxs3(Typography, { variant: "body2", sx: { color: "text.secondary", lineHeight: 1.6 }, children: [
|
|
417
674
|
"No matches found for ",
|
|
418
|
-
/* @__PURE__ */
|
|
675
|
+
/* @__PURE__ */ jsxs3("strong", { children: [
|
|
419
676
|
'"',
|
|
420
677
|
searchTerm,
|
|
421
678
|
'"'
|
|
422
679
|
] })
|
|
423
680
|
] })
|
|
424
681
|
] }),
|
|
425
|
-
totalResults > 0 && /* @__PURE__ */
|
|
682
|
+
totalResults > 0 && /* @__PURE__ */ jsx4(Box, { sx: { p: 2 }, children: Object.keys(resultsByPage).sort((a, b) => parseInt(a) - parseInt(b)).map((pageNum) => {
|
|
426
683
|
const pageNumber = parseInt(pageNum);
|
|
427
684
|
const pageResults = resultsByPage[pageNumber];
|
|
428
|
-
return /* @__PURE__ */
|
|
429
|
-
/* @__PURE__ */
|
|
685
|
+
return /* @__PURE__ */ jsxs3(Box, { sx: { mb: 3 }, children: [
|
|
686
|
+
/* @__PURE__ */ jsxs3(
|
|
430
687
|
Typography,
|
|
431
688
|
{
|
|
432
689
|
variant: "subtitle2",
|
|
@@ -445,7 +702,7 @@ var SearchSidebar = ({
|
|
|
445
702
|
]
|
|
446
703
|
}
|
|
447
704
|
),
|
|
448
|
-
pageResults.map((result, index) => /* @__PURE__ */
|
|
705
|
+
pageResults.map((result, index) => /* @__PURE__ */ jsx4(
|
|
449
706
|
Box,
|
|
450
707
|
{
|
|
451
708
|
onClick: () => onSearchResultClick(result.pageNumber, result.index),
|
|
@@ -466,7 +723,7 @@ var SearchSidebar = ({
|
|
|
466
723
|
transform: "translateY(-1px)"
|
|
467
724
|
}
|
|
468
725
|
},
|
|
469
|
-
children: /* @__PURE__ */
|
|
726
|
+
children: /* @__PURE__ */ jsx4(
|
|
470
727
|
Typography,
|
|
471
728
|
{
|
|
472
729
|
variant: "body2",
|
|
@@ -509,7 +766,7 @@ import CloseIcon2 from "@mui/icons-material/Close";
|
|
|
509
766
|
import LockIcon from "@mui/icons-material/Lock";
|
|
510
767
|
import VisibilityIcon from "@mui/icons-material/Visibility";
|
|
511
768
|
import VisibilityOffIcon from "@mui/icons-material/VisibilityOff";
|
|
512
|
-
import { jsx as
|
|
769
|
+
import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
513
770
|
var PasswordDialog = ({
|
|
514
771
|
open,
|
|
515
772
|
fileName,
|
|
@@ -539,7 +796,7 @@ var PasswordDialog = ({
|
|
|
539
796
|
handleSubmit(e);
|
|
540
797
|
}
|
|
541
798
|
};
|
|
542
|
-
return /* @__PURE__ */
|
|
799
|
+
return /* @__PURE__ */ jsxs4(
|
|
543
800
|
Dialog,
|
|
544
801
|
{
|
|
545
802
|
open,
|
|
@@ -552,9 +809,9 @@ var PasswordDialog = ({
|
|
|
552
809
|
}
|
|
553
810
|
},
|
|
554
811
|
children: [
|
|
555
|
-
/* @__PURE__ */
|
|
556
|
-
/* @__PURE__ */
|
|
557
|
-
/* @__PURE__ */
|
|
812
|
+
/* @__PURE__ */ jsx5(DialogTitle, { sx: { pb: 1 }, children: /* @__PURE__ */ jsxs4(Box2, { sx: { display: "flex", alignItems: "center", justifyContent: "space-between" }, children: [
|
|
813
|
+
/* @__PURE__ */ jsxs4(Box2, { sx: { display: "flex", alignItems: "center", gap: 1.5 }, children: [
|
|
814
|
+
/* @__PURE__ */ jsx5(
|
|
558
815
|
Box2,
|
|
559
816
|
{
|
|
560
817
|
sx: {
|
|
@@ -567,34 +824,34 @@ var PasswordDialog = ({
|
|
|
567
824
|
justifyContent: "center",
|
|
568
825
|
opacity: 0.9
|
|
569
826
|
},
|
|
570
|
-
children: /* @__PURE__ */
|
|
827
|
+
children: /* @__PURE__ */ jsx5(LockIcon, { sx: { color: "white", fontSize: 20 } })
|
|
571
828
|
}
|
|
572
829
|
),
|
|
573
|
-
/* @__PURE__ */
|
|
830
|
+
/* @__PURE__ */ jsx5(Typography2, { variant: "h6", component: "div", sx: { fontWeight: 600 }, children: "Password Protected" })
|
|
574
831
|
] }),
|
|
575
|
-
/* @__PURE__ */
|
|
832
|
+
/* @__PURE__ */ jsx5(
|
|
576
833
|
IconButton2,
|
|
577
834
|
{
|
|
578
835
|
size: "small",
|
|
579
836
|
onClick: onCancel,
|
|
580
837
|
sx: { color: "text.secondary" },
|
|
581
838
|
"aria-label": "Close dialog",
|
|
582
|
-
children: /* @__PURE__ */
|
|
839
|
+
children: /* @__PURE__ */ jsx5(CloseIcon2, { fontSize: "small" })
|
|
583
840
|
}
|
|
584
841
|
)
|
|
585
842
|
] }) }),
|
|
586
|
-
/* @__PURE__ */
|
|
587
|
-
/* @__PURE__ */
|
|
843
|
+
/* @__PURE__ */ jsxs4(DialogContent, { sx: { pt: 2 }, children: [
|
|
844
|
+
/* @__PURE__ */ jsxs4(Typography2, { variant: "body2", sx: { color: "text.secondary", mb: 3 }, children: [
|
|
588
845
|
"This PDF is password protected. Please enter the password to view",
|
|
589
846
|
" ",
|
|
590
|
-
fileName && /* @__PURE__ */
|
|
847
|
+
fileName && /* @__PURE__ */ jsxs4("strong", { children: [
|
|
591
848
|
'"',
|
|
592
849
|
fileName,
|
|
593
850
|
'"'
|
|
594
851
|
] })
|
|
595
852
|
] }),
|
|
596
|
-
error && /* @__PURE__ */
|
|
597
|
-
/* @__PURE__ */
|
|
853
|
+
error && /* @__PURE__ */ jsx5(Alert, { severity: "error", sx: { mb: 2 }, children: error }),
|
|
854
|
+
/* @__PURE__ */ jsx5("form", { onSubmit: handleSubmit, children: /* @__PURE__ */ jsx5(
|
|
598
855
|
TextField2,
|
|
599
856
|
{
|
|
600
857
|
fullWidth: true,
|
|
@@ -607,14 +864,14 @@ var PasswordDialog = ({
|
|
|
607
864
|
onKeyPress: handleKeyPress,
|
|
608
865
|
error: Boolean(error),
|
|
609
866
|
InputProps: {
|
|
610
|
-
endAdornment: /* @__PURE__ */
|
|
867
|
+
endAdornment: /* @__PURE__ */ jsx5(InputAdornment2, { position: "end", children: /* @__PURE__ */ jsx5(
|
|
611
868
|
IconButton2,
|
|
612
869
|
{
|
|
613
870
|
onClick: handleTogglePasswordVisibility,
|
|
614
871
|
edge: "end",
|
|
615
872
|
size: "small",
|
|
616
873
|
"aria-label": showPassword ? "Hide password" : "Show password",
|
|
617
|
-
children: showPassword ? /* @__PURE__ */
|
|
874
|
+
children: showPassword ? /* @__PURE__ */ jsx5(VisibilityOffIcon, {}) : /* @__PURE__ */ jsx5(VisibilityIcon, {})
|
|
618
875
|
}
|
|
619
876
|
) })
|
|
620
877
|
},
|
|
@@ -626,8 +883,8 @@ var PasswordDialog = ({
|
|
|
626
883
|
}
|
|
627
884
|
) })
|
|
628
885
|
] }),
|
|
629
|
-
/* @__PURE__ */
|
|
630
|
-
/* @__PURE__ */
|
|
886
|
+
/* @__PURE__ */ jsxs4(DialogActions, { sx: { px: 3, pb: 3, pt: 2 }, children: [
|
|
887
|
+
/* @__PURE__ */ jsx5(
|
|
631
888
|
Button,
|
|
632
889
|
{
|
|
633
890
|
onClick: onCancel,
|
|
@@ -640,7 +897,7 @@ var PasswordDialog = ({
|
|
|
640
897
|
children: "Cancel"
|
|
641
898
|
}
|
|
642
899
|
),
|
|
643
|
-
/* @__PURE__ */
|
|
900
|
+
/* @__PURE__ */ jsx5(
|
|
644
901
|
Button,
|
|
645
902
|
{
|
|
646
903
|
onClick: handleSubmit,
|
|
@@ -662,159 +919,7 @@ var PasswordDialog = ({
|
|
|
662
919
|
};
|
|
663
920
|
|
|
664
921
|
// src/components/viewers/PDFViewer.tsx
|
|
665
|
-
import {
|
|
666
|
-
var HeadlessPDFViewer = HeadlessPDFViewerImport;
|
|
667
|
-
var toolbarStyles = `
|
|
668
|
-
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+Tamil:wght@400;500;600;700&family=Noto+Sans+Devanagari:wght@400;500;600;700&display=swap');
|
|
669
|
-
|
|
670
|
-
* {
|
|
671
|
-
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
|
|
672
|
-
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
|
|
673
|
-
'Noto Sans Tamil', 'Noto Sans Devanagari', 'Lohit Tamil', 'Tamil MN',
|
|
674
|
-
'Arial Unicode MS', sans-serif !important;
|
|
675
|
-
}
|
|
676
|
-
|
|
677
|
-
/* Target PDF.js text layer */
|
|
678
|
-
.textLayer,
|
|
679
|
-
.textLayer span,
|
|
680
|
-
.textLayer div,
|
|
681
|
-
[class*="pdf"],
|
|
682
|
-
[class*="page"],
|
|
683
|
-
canvas + div,
|
|
684
|
-
.embedpdf-viewport *,
|
|
685
|
-
[data-pdf-viewer] *,
|
|
686
|
-
[role="document"] * {
|
|
687
|
-
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
|
|
688
|
-
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
|
|
689
|
-
'Noto Sans Tamil', 'Noto Sans Devanagari', 'Lohit Tamil', 'Tamil MN',
|
|
690
|
-
'Arial Unicode MS', sans-serif !important;
|
|
691
|
-
}
|
|
692
|
-
|
|
693
|
-
.pdf-viewer-header {
|
|
694
|
-
display: flex;
|
|
695
|
-
align-items: center;
|
|
696
|
-
justify-content: flex-start;
|
|
697
|
-
gap: 8px;
|
|
698
|
-
padding: 3px 16px 0 16px;
|
|
699
|
-
background: #fff;
|
|
700
|
-
min-height: 36px;
|
|
701
|
-
}
|
|
702
|
-
.header-file-name {
|
|
703
|
-
font-size: 12px;
|
|
704
|
-
font-weight: 500;
|
|
705
|
-
color: #424242;
|
|
706
|
-
white-space: nowrap;
|
|
707
|
-
overflow: hidden;
|
|
708
|
-
text-overflow: ellipsis;
|
|
709
|
-
max-width: 400px;
|
|
710
|
-
}
|
|
711
|
-
.pdf-viewer-toolbar {
|
|
712
|
-
display: flex;
|
|
713
|
-
align-items: center;
|
|
714
|
-
justify-content: center;
|
|
715
|
-
padding: 0 16px 6px 16px;
|
|
716
|
-
background: #fff;
|
|
717
|
-
gap: 12px;
|
|
718
|
-
flex-wrap: wrap;
|
|
719
|
-
min-height: 44px;
|
|
720
|
-
}
|
|
721
|
-
.toolbar-section {
|
|
722
|
-
display: flex;
|
|
723
|
-
align-items: center;
|
|
724
|
-
gap: 8px;
|
|
725
|
-
}
|
|
726
|
-
.toolbar-separator {
|
|
727
|
-
width: 1px;
|
|
728
|
-
height: 24px;
|
|
729
|
-
background: #e0e0e0;
|
|
730
|
-
margin: 0 4px;
|
|
731
|
-
}
|
|
732
|
-
.toolbar-button {
|
|
733
|
-
padding: 8px;
|
|
734
|
-
border: none;
|
|
735
|
-
background: transparent;
|
|
736
|
-
cursor: pointer;
|
|
737
|
-
border-radius: 4px;
|
|
738
|
-
display: flex;
|
|
739
|
-
align-items: center;
|
|
740
|
-
justify-content: center;
|
|
741
|
-
transition: background 0.2s;
|
|
742
|
-
}
|
|
743
|
-
.toolbar-button:hover:not(:disabled) {
|
|
744
|
-
background: #f5f5f5;
|
|
745
|
-
}
|
|
746
|
-
.toolbar-button:disabled {
|
|
747
|
-
opacity: 0.4;
|
|
748
|
-
cursor: not-allowed;
|
|
749
|
-
}
|
|
750
|
-
.toolbar-button svg {
|
|
751
|
-
width: 20px;
|
|
752
|
-
height: 20px;
|
|
753
|
-
display: block;
|
|
754
|
-
}
|
|
755
|
-
.page-input {
|
|
756
|
-
width: 60px;
|
|
757
|
-
padding: 4px 8px;
|
|
758
|
-
border: 1px solid #e0e0e0;
|
|
759
|
-
border-radius: 4px;
|
|
760
|
-
text-align: center;
|
|
761
|
-
font-size: 14px;
|
|
762
|
-
}
|
|
763
|
-
.page-info {
|
|
764
|
-
font-size: 14px;
|
|
765
|
-
color: #666;
|
|
766
|
-
white-space: nowrap;
|
|
767
|
-
}
|
|
768
|
-
.zoom-display {
|
|
769
|
-
min-width: 60px;
|
|
770
|
-
text-align: center;
|
|
771
|
-
font-size: 14px;
|
|
772
|
-
color: #666;
|
|
773
|
-
}
|
|
774
|
-
.search-input {
|
|
775
|
-
padding: 4px 8px;
|
|
776
|
-
border: 1px solid #e0e0e0;
|
|
777
|
-
border-radius: 4px;
|
|
778
|
-
font-size: 14px;
|
|
779
|
-
min-width: 200px;
|
|
780
|
-
}
|
|
781
|
-
.pdf-viewer-content {
|
|
782
|
-
flex: 1;
|
|
783
|
-
overflow: hidden;
|
|
784
|
-
position: relative;
|
|
785
|
-
user-select: text;
|
|
786
|
-
-webkit-user-select: text;
|
|
787
|
-
-moz-user-select: text;
|
|
788
|
-
-ms-user-select: text;
|
|
789
|
-
}
|
|
790
|
-
.pdf-viewer-container {
|
|
791
|
-
display: flex;
|
|
792
|
-
flex-direction: column;
|
|
793
|
-
height: 100%;
|
|
794
|
-
width: 100%;
|
|
795
|
-
}
|
|
796
|
-
.pdf-viewer-main {
|
|
797
|
-
display: flex;
|
|
798
|
-
flex: 1;
|
|
799
|
-
overflow: hidden;
|
|
800
|
-
position: relative;
|
|
801
|
-
}
|
|
802
|
-
.pdf-viewer-viewer-area {
|
|
803
|
-
flex: 1;
|
|
804
|
-
overflow: hidden;
|
|
805
|
-
position: relative;
|
|
806
|
-
user-select: text;
|
|
807
|
-
-webkit-user-select: text;
|
|
808
|
-
-moz-user-select: text;
|
|
809
|
-
-ms-user-select: text;
|
|
810
|
-
}
|
|
811
|
-
.pdf-viewer-viewer-area * {
|
|
812
|
-
user-select: text !important;
|
|
813
|
-
-webkit-user-select: text !important;
|
|
814
|
-
-moz-user-select: text !important;
|
|
815
|
-
-ms-user-select: text !important;
|
|
816
|
-
}
|
|
817
|
-
`;
|
|
922
|
+
import { jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
818
923
|
var PDFViewerContent = forwardRef((props, ref) => {
|
|
819
924
|
const {
|
|
820
925
|
file,
|
|
@@ -864,9 +969,137 @@ var PDFViewerContent = forwardRef((props, ref) => {
|
|
|
864
969
|
const [currentSearchResultIndex, setCurrentSearchResultIndex] = useState3(0);
|
|
865
970
|
const [totalSearchResults, setTotalSearchResults] = useState3(0);
|
|
866
971
|
const [autoExecuteSearch, setAutoExecuteSearch] = useState3(!!initialSearchText);
|
|
972
|
+
const [isFullScreen, setIsFullScreen] = useState3(false);
|
|
973
|
+
const containerRef = useRef2(null);
|
|
867
974
|
const [isPasswordDialogOpen, setIsPasswordDialogOpen] = useState3(false);
|
|
868
975
|
const [passwordError, setPasswordError] = useState3("");
|
|
869
976
|
const [passwordResolve, setPasswordResolve] = useState3(null);
|
|
977
|
+
const hasExecutedInitialSearch = useRef2(false);
|
|
978
|
+
const handleToggleFullScreen = useCallback(() => {
|
|
979
|
+
if (!isFullScreen && containerRef.current?.requestFullscreen) {
|
|
980
|
+
containerRef.current.requestFullscreen();
|
|
981
|
+
setIsFullScreen(true);
|
|
982
|
+
} else if (isFullScreen && document.exitFullscreen) {
|
|
983
|
+
document.exitFullscreen();
|
|
984
|
+
setIsFullScreen(false);
|
|
985
|
+
}
|
|
986
|
+
}, [isFullScreen]);
|
|
987
|
+
const toolbar = mergeToolbarConfig({
|
|
988
|
+
showDownload,
|
|
989
|
+
showPrint,
|
|
990
|
+
showMetadata,
|
|
991
|
+
showProperties,
|
|
992
|
+
onDownloadClick,
|
|
993
|
+
onPrintClick,
|
|
994
|
+
onMetadataClick,
|
|
995
|
+
onPropertiesClick,
|
|
996
|
+
toolbarActions: props.toolbarActions
|
|
997
|
+
});
|
|
998
|
+
const toolbarHandlers = useMemo(() => ({
|
|
999
|
+
handleZoomIn: () => {
|
|
1000
|
+
pdfViewerRef.current?.zoom.zoomIn();
|
|
1001
|
+
requestAnimationFrame(() => {
|
|
1002
|
+
const zoomValue = pdfViewerRef.current?.zoom.getZoom();
|
|
1003
|
+
if (typeof zoomValue === "number") {
|
|
1004
|
+
setZoom(Math.round(zoomValue * 100));
|
|
1005
|
+
}
|
|
1006
|
+
});
|
|
1007
|
+
},
|
|
1008
|
+
handleZoomOut: () => {
|
|
1009
|
+
pdfViewerRef.current?.zoom.zoomOut();
|
|
1010
|
+
requestAnimationFrame(() => {
|
|
1011
|
+
const zoomValue = pdfViewerRef.current?.zoom.getZoom();
|
|
1012
|
+
if (typeof zoomValue === "number") {
|
|
1013
|
+
setZoom(Math.round(zoomValue * 100));
|
|
1014
|
+
}
|
|
1015
|
+
});
|
|
1016
|
+
},
|
|
1017
|
+
handleFitToWidth: () => {
|
|
1018
|
+
pdfViewerRef.current?.zoom.fitToWidth();
|
|
1019
|
+
requestAnimationFrame(() => {
|
|
1020
|
+
const zoomValue = pdfViewerRef.current?.zoom.getZoom();
|
|
1021
|
+
if (typeof zoomValue === "number") {
|
|
1022
|
+
setZoom(Math.round(zoomValue * 100));
|
|
1023
|
+
}
|
|
1024
|
+
});
|
|
1025
|
+
},
|
|
1026
|
+
handleFitToPage: () => {
|
|
1027
|
+
pdfViewerRef.current?.zoom.fitToPage();
|
|
1028
|
+
requestAnimationFrame(() => {
|
|
1029
|
+
const zoomValue = pdfViewerRef.current?.zoom.getZoom();
|
|
1030
|
+
if (typeof zoomValue === "number") {
|
|
1031
|
+
setZoom(Math.round(zoomValue * 100));
|
|
1032
|
+
}
|
|
1033
|
+
});
|
|
1034
|
+
},
|
|
1035
|
+
handlePreviousPage: () => {
|
|
1036
|
+
pdfViewerRef.current?.navigation.previousPage();
|
|
1037
|
+
requestAnimationFrame(() => {
|
|
1038
|
+
const current = pdfViewerRef.current?.navigation.getCurrentPage() || 1;
|
|
1039
|
+
setCurrentPage(current);
|
|
1040
|
+
});
|
|
1041
|
+
},
|
|
1042
|
+
handleNextPage: () => {
|
|
1043
|
+
pdfViewerRef.current?.navigation.nextPage();
|
|
1044
|
+
requestAnimationFrame(() => {
|
|
1045
|
+
const current = pdfViewerRef.current?.navigation.getCurrentPage() || 1;
|
|
1046
|
+
setCurrentPage(current);
|
|
1047
|
+
});
|
|
1048
|
+
},
|
|
1049
|
+
handleFirstPage: () => {
|
|
1050
|
+
pdfViewerRef.current?.navigation.goToFirstPage();
|
|
1051
|
+
requestAnimationFrame(() => {
|
|
1052
|
+
const current = pdfViewerRef.current?.navigation.getCurrentPage() || 1;
|
|
1053
|
+
setCurrentPage(current);
|
|
1054
|
+
});
|
|
1055
|
+
},
|
|
1056
|
+
handleLastPage: () => {
|
|
1057
|
+
pdfViewerRef.current?.navigation.goToLastPage();
|
|
1058
|
+
requestAnimationFrame(() => {
|
|
1059
|
+
const current = pdfViewerRef.current?.navigation.getCurrentPage() || 1;
|
|
1060
|
+
setCurrentPage(current);
|
|
1061
|
+
});
|
|
1062
|
+
},
|
|
1063
|
+
toggleSidebar: () => setIsSidebarOpen(!isSidebarOpen),
|
|
1064
|
+
handlePageInput: (e) => {
|
|
1065
|
+
const value = e.target.value;
|
|
1066
|
+
if (/^\d*$/.test(value)) {
|
|
1067
|
+
return;
|
|
1068
|
+
}
|
|
1069
|
+
const page = parseInt(value, 10);
|
|
1070
|
+
if (!isNaN(page) && page >= 1 && (totalPages === 0 || page <= totalPages)) {
|
|
1071
|
+
pdfViewerRef.current?.navigation.goToPage(page);
|
|
1072
|
+
setCurrentPage(page);
|
|
1073
|
+
}
|
|
1074
|
+
},
|
|
1075
|
+
handlePageInputKeyPress: (e) => {
|
|
1076
|
+
if (e.key === "Enter") {
|
|
1077
|
+
const value = e.target.value;
|
|
1078
|
+
const page = parseInt(value, 10);
|
|
1079
|
+
if (!isNaN(page) && page >= 1 && (totalPages === 0 || page <= totalPages)) {
|
|
1080
|
+
pdfViewerRef.current?.navigation.goToPage(page);
|
|
1081
|
+
setCurrentPage(page);
|
|
1082
|
+
}
|
|
1083
|
+
}
|
|
1084
|
+
},
|
|
1085
|
+
handleToggleFullScreen
|
|
1086
|
+
}), [isSidebarOpen, totalPages, handleToggleFullScreen]);
|
|
1087
|
+
useEffect3(() => {
|
|
1088
|
+
console.log("came", initialSearchText, pdfViewerRef.current, hasExecutedInitialSearch.current);
|
|
1089
|
+
if (pdfViewerRef.current && !hasExecutedInitialSearch.current && initialSearchText) {
|
|
1090
|
+
hasExecutedInitialSearch.current = true;
|
|
1091
|
+
setIsSidebarOpen(true);
|
|
1092
|
+
setSearchQuery(initialSearchText);
|
|
1093
|
+
handleSidebarSearch(initialSearchText, initialSearchPages);
|
|
1094
|
+
setAutoExecuteSearch(false);
|
|
1095
|
+
pdfViewerRef.current.search.searchText(initialSearchText).then((results) => {
|
|
1096
|
+
console.log("results", results);
|
|
1097
|
+
if (results?.results?.length > 0) {
|
|
1098
|
+
pdfViewerRef.current?.navigation.goToPage(results.results[0].pageIndex + 1);
|
|
1099
|
+
}
|
|
1100
|
+
});
|
|
1101
|
+
}
|
|
1102
|
+
}, [pdfViewerRef.current, initialSearchText]);
|
|
870
1103
|
useEffect3(() => {
|
|
871
1104
|
setSearchQuery("");
|
|
872
1105
|
setSearchResults([]);
|
|
@@ -954,23 +1187,6 @@ var PDFViewerContent = forwardRef((props, ref) => {
|
|
|
954
1187
|
};
|
|
955
1188
|
initializePageCount();
|
|
956
1189
|
}, [state, totalPages]);
|
|
957
|
-
useEffect3(() => {
|
|
958
|
-
if (state !== "ready" || !autoExecuteSearch || !initialSearchText) return;
|
|
959
|
-
const scheduleSearch = (callback) => {
|
|
960
|
-
if ("requestIdleCallback" in window) {
|
|
961
|
-
requestIdleCallback(callback, { timeout: 2e3 });
|
|
962
|
-
} else {
|
|
963
|
-
requestAnimationFrame(() => setTimeout(callback, 0));
|
|
964
|
-
}
|
|
965
|
-
};
|
|
966
|
-
scheduleSearch(() => {
|
|
967
|
-
if (!pdfViewerRef.current) return;
|
|
968
|
-
setIsSidebarOpen(true);
|
|
969
|
-
setSearchQuery(initialSearchText);
|
|
970
|
-
handleSidebarSearch(initialSearchText, initialSearchPages);
|
|
971
|
-
setAutoExecuteSearch(false);
|
|
972
|
-
});
|
|
973
|
-
}, [state, autoExecuteSearch, initialSearchText, initialSearchPages]);
|
|
974
1190
|
useEffect3(() => {
|
|
975
1191
|
if (state === "ready" && pdfViewerRef.current) {
|
|
976
1192
|
const updateInfo = () => {
|
|
@@ -1072,59 +1288,6 @@ var PDFViewerContent = forwardRef((props, ref) => {
|
|
|
1072
1288
|
}
|
|
1073
1289
|
});
|
|
1074
1290
|
};
|
|
1075
|
-
const handleZoomIn = () => {
|
|
1076
|
-
pdfViewerRef.current?.zoom.zoomIn();
|
|
1077
|
-
updateZoomDisplay();
|
|
1078
|
-
};
|
|
1079
|
-
const handleZoomOut = () => {
|
|
1080
|
-
pdfViewerRef.current?.zoom.zoomOut();
|
|
1081
|
-
updateZoomDisplay();
|
|
1082
|
-
};
|
|
1083
|
-
const handleFitToWidth = () => {
|
|
1084
|
-
pdfViewerRef.current?.zoom.fitToWidth();
|
|
1085
|
-
updateZoomDisplay();
|
|
1086
|
-
};
|
|
1087
|
-
const handleFitToPage = () => {
|
|
1088
|
-
pdfViewerRef.current?.zoom.fitToPage();
|
|
1089
|
-
updateZoomDisplay();
|
|
1090
|
-
};
|
|
1091
|
-
const handlePreviousPage = () => {
|
|
1092
|
-
pdfViewerRef.current?.navigation.previousPage();
|
|
1093
|
-
updatePageDisplay();
|
|
1094
|
-
};
|
|
1095
|
-
const handleNextPage = () => {
|
|
1096
|
-
pdfViewerRef.current?.navigation.nextPage();
|
|
1097
|
-
updatePageDisplay();
|
|
1098
|
-
};
|
|
1099
|
-
const handleFirstPage = () => {
|
|
1100
|
-
pdfViewerRef.current?.navigation.goToFirstPage();
|
|
1101
|
-
updatePageDisplay();
|
|
1102
|
-
};
|
|
1103
|
-
const handleLastPage = () => {
|
|
1104
|
-
pdfViewerRef.current?.navigation.goToLastPage();
|
|
1105
|
-
updatePageDisplay();
|
|
1106
|
-
};
|
|
1107
|
-
const handlePageInput = (e) => {
|
|
1108
|
-
const value = e.target.value;
|
|
1109
|
-
const page = parseInt(value, 10);
|
|
1110
|
-
if (/^\d*$/.test(value)) {
|
|
1111
|
-
return;
|
|
1112
|
-
}
|
|
1113
|
-
if (!isNaN(page) && page >= 1 && (totalPages === 0 || page <= totalPages)) {
|
|
1114
|
-
pdfViewerRef.current?.navigation.goToPage(page);
|
|
1115
|
-
setCurrentPage(page);
|
|
1116
|
-
}
|
|
1117
|
-
};
|
|
1118
|
-
const handlePageInputKeyPress = (e) => {
|
|
1119
|
-
if (e.key === "Enter") {
|
|
1120
|
-
const value = e.target.value;
|
|
1121
|
-
const page = parseInt(value, 10);
|
|
1122
|
-
if (!isNaN(page) && page >= 1 && (totalPages === 0 || page <= totalPages)) {
|
|
1123
|
-
pdfViewerRef.current?.navigation.goToPage(page);
|
|
1124
|
-
setCurrentPage(page);
|
|
1125
|
-
}
|
|
1126
|
-
}
|
|
1127
|
-
};
|
|
1128
1291
|
const handleSearch = async () => {
|
|
1129
1292
|
if (searchQuery.trim()) {
|
|
1130
1293
|
setIsSearching(true);
|
|
@@ -1240,9 +1403,6 @@ var PDFViewerContent = forwardRef((props, ref) => {
|
|
|
1240
1403
|
setCurrentPage(pageNumber);
|
|
1241
1404
|
pdfViewerRef.current?.search.goToResult(resultIndex);
|
|
1242
1405
|
};
|
|
1243
|
-
const toggleSidebar = () => {
|
|
1244
|
-
setIsSidebarOpen(!isSidebarOpen);
|
|
1245
|
-
};
|
|
1246
1406
|
const handleNextSearchResult = () => {
|
|
1247
1407
|
if (currentSearchResultIndex < totalSearchResults - 1) {
|
|
1248
1408
|
const nextIndex = currentSearchResultIndex + 1;
|
|
@@ -1267,69 +1427,6 @@ var PDFViewerContent = forwardRef((props, ref) => {
|
|
|
1267
1427
|
}
|
|
1268
1428
|
}
|
|
1269
1429
|
};
|
|
1270
|
-
const handlePrint = () => {
|
|
1271
|
-
if (onPrintClick) {
|
|
1272
|
-
onPrintClick();
|
|
1273
|
-
return;
|
|
1274
|
-
}
|
|
1275
|
-
if (!pdfBuffer) return;
|
|
1276
|
-
const blob = new Blob([pdfBuffer], { type: "application/pdf" });
|
|
1277
|
-
const blobUrl = URL.createObjectURL(blob);
|
|
1278
|
-
const iframe = document.createElement("iframe");
|
|
1279
|
-
iframe.style.position = "fixed";
|
|
1280
|
-
iframe.style.right = "0";
|
|
1281
|
-
iframe.style.bottom = "0";
|
|
1282
|
-
iframe.style.width = "0";
|
|
1283
|
-
iframe.style.height = "0";
|
|
1284
|
-
iframe.style.border = "0";
|
|
1285
|
-
document.body.appendChild(iframe);
|
|
1286
|
-
iframe.onload = () => {
|
|
1287
|
-
try {
|
|
1288
|
-
requestAnimationFrame(() => {
|
|
1289
|
-
const iframeWindow = iframe.contentWindow;
|
|
1290
|
-
if (!iframeWindow) return;
|
|
1291
|
-
iframeWindow.focus();
|
|
1292
|
-
iframeWindow.print();
|
|
1293
|
-
const cleanup = () => {
|
|
1294
|
-
requestAnimationFrame(() => {
|
|
1295
|
-
try {
|
|
1296
|
-
if (document.body.contains(iframe)) {
|
|
1297
|
-
document.body.removeChild(iframe);
|
|
1298
|
-
}
|
|
1299
|
-
URL.revokeObjectURL(blobUrl);
|
|
1300
|
-
} catch (e) {
|
|
1301
|
-
}
|
|
1302
|
-
});
|
|
1303
|
-
};
|
|
1304
|
-
if ("onafterprint" in iframeWindow) {
|
|
1305
|
-
iframeWindow.onafterprint = cleanup;
|
|
1306
|
-
} else {
|
|
1307
|
-
const visibilityHandler = () => {
|
|
1308
|
-
if (!document.hidden) {
|
|
1309
|
-
cleanup();
|
|
1310
|
-
document.removeEventListener("visibilitychange", visibilityHandler);
|
|
1311
|
-
}
|
|
1312
|
-
};
|
|
1313
|
-
document.addEventListener("visibilitychange", visibilityHandler);
|
|
1314
|
-
setTimeout(() => {
|
|
1315
|
-
cleanup();
|
|
1316
|
-
document.removeEventListener("visibilitychange", visibilityHandler);
|
|
1317
|
-
}, 5e3);
|
|
1318
|
-
}
|
|
1319
|
-
});
|
|
1320
|
-
} catch (error2) {
|
|
1321
|
-
if (document.body.contains(iframe)) {
|
|
1322
|
-
document.body.removeChild(iframe);
|
|
1323
|
-
}
|
|
1324
|
-
URL.revokeObjectURL(blobUrl);
|
|
1325
|
-
}
|
|
1326
|
-
};
|
|
1327
|
-
iframe.onerror = () => {
|
|
1328
|
-
document.body.removeChild(iframe);
|
|
1329
|
-
URL.revokeObjectURL(blobUrl);
|
|
1330
|
-
};
|
|
1331
|
-
iframe.src = blobUrl;
|
|
1332
|
-
};
|
|
1333
1430
|
useEffect3(() => {
|
|
1334
1431
|
if (!file) {
|
|
1335
1432
|
setState("error");
|
|
@@ -1390,7 +1487,7 @@ var PDFViewerContent = forwardRef((props, ref) => {
|
|
|
1390
1487
|
}
|
|
1391
1488
|
}, [passwordResolve]);
|
|
1392
1489
|
if (state === "loading") {
|
|
1393
|
-
return /* @__PURE__ */
|
|
1490
|
+
return /* @__PURE__ */ jsxs5("div", { style: {
|
|
1394
1491
|
display: "flex",
|
|
1395
1492
|
flexDirection: "column",
|
|
1396
1493
|
alignItems: "center",
|
|
@@ -1398,7 +1495,7 @@ var PDFViewerContent = forwardRef((props, ref) => {
|
|
|
1398
1495
|
height: "100%",
|
|
1399
1496
|
gap: "16px"
|
|
1400
1497
|
}, children: [
|
|
1401
|
-
/* @__PURE__ */
|
|
1498
|
+
/* @__PURE__ */ jsx6("div", { className: "spinner", style: {
|
|
1402
1499
|
width: "48px",
|
|
1403
1500
|
height: "48px",
|
|
1404
1501
|
border: "4px solid #f3f3f3",
|
|
@@ -1406,8 +1503,8 @@ var PDFViewerContent = forwardRef((props, ref) => {
|
|
|
1406
1503
|
borderRadius: "50%",
|
|
1407
1504
|
animation: "spin 1s linear infinite"
|
|
1408
1505
|
} }),
|
|
1409
|
-
/* @__PURE__ */
|
|
1410
|
-
/* @__PURE__ */
|
|
1506
|
+
/* @__PURE__ */ jsx6("p", { children: "Loading PDF..." }),
|
|
1507
|
+
/* @__PURE__ */ jsx6("style", { children: `
|
|
1411
1508
|
@keyframes spin {
|
|
1412
1509
|
0% { transform: rotate(0deg); }
|
|
1413
1510
|
100% { transform: rotate(360deg); }
|
|
@@ -1416,213 +1513,88 @@ var PDFViewerContent = forwardRef((props, ref) => {
|
|
|
1416
1513
|
] });
|
|
1417
1514
|
}
|
|
1418
1515
|
if (state === "error" || error) {
|
|
1419
|
-
return /* @__PURE__ */
|
|
1516
|
+
return /* @__PURE__ */ jsx6("div", { style: {
|
|
1420
1517
|
display: "flex",
|
|
1421
1518
|
flexDirection: "column",
|
|
1422
1519
|
alignItems: "center",
|
|
1423
1520
|
justifyContent: "center",
|
|
1424
1521
|
height: "100%",
|
|
1425
1522
|
padding: "24px"
|
|
1426
|
-
}, children: /* @__PURE__ */
|
|
1523
|
+
}, children: /* @__PURE__ */ jsxs5("div", { style: {
|
|
1427
1524
|
maxWidth: "400px",
|
|
1428
1525
|
padding: "16px",
|
|
1429
1526
|
backgroundColor: "#fee",
|
|
1430
1527
|
border: "1px solid #fcc",
|
|
1431
1528
|
borderRadius: "4px"
|
|
1432
1529
|
}, children: [
|
|
1433
|
-
/* @__PURE__ */
|
|
1434
|
-
/* @__PURE__ */
|
|
1530
|
+
/* @__PURE__ */ jsx6("h3", { style: { marginTop: 0 }, children: "Failed to Load PDF" }),
|
|
1531
|
+
/* @__PURE__ */ jsx6("p", { children: error || "Unknown error occurred" })
|
|
1435
1532
|
] }) });
|
|
1436
1533
|
}
|
|
1437
1534
|
if (!pdfBuffer || state !== "ready") {
|
|
1438
|
-
return /* @__PURE__ */
|
|
1535
|
+
return /* @__PURE__ */ jsx6("div", { style: {
|
|
1439
1536
|
display: "flex",
|
|
1440
1537
|
alignItems: "center",
|
|
1441
1538
|
justifyContent: "center",
|
|
1442
1539
|
height: "100%"
|
|
1443
|
-
}, children: /* @__PURE__ */
|
|
1540
|
+
}, children: /* @__PURE__ */ jsx6("p", { children: "Preparing PDF..." }) });
|
|
1444
1541
|
}
|
|
1445
|
-
return /* @__PURE__ */
|
|
1446
|
-
/* @__PURE__ */
|
|
1447
|
-
/* @__PURE__ */
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
className: "toolbar-button",
|
|
1495
|
-
onClick: handleNextPage,
|
|
1496
|
-
disabled: currentPage >= totalPages,
|
|
1497
|
-
title: "Next Page",
|
|
1498
|
-
children: /* @__PURE__ */ jsx3(ChevronRightIcon, { fontSize: "small" })
|
|
1499
|
-
}
|
|
1500
|
-
),
|
|
1501
|
-
/* @__PURE__ */ jsx3(
|
|
1502
|
-
"button",
|
|
1503
|
-
{
|
|
1504
|
-
className: "toolbar-button",
|
|
1505
|
-
onClick: handleLastPage,
|
|
1506
|
-
disabled: currentPage >= totalPages,
|
|
1507
|
-
title: "Last Page",
|
|
1508
|
-
children: /* @__PURE__ */ jsx3(LastPageIcon, { fontSize: "small" })
|
|
1509
|
-
}
|
|
1510
|
-
)
|
|
1511
|
-
] })
|
|
1512
|
-
] }),
|
|
1513
|
-
showZoomControls && /* @__PURE__ */ jsxs3(Fragment, { children: [
|
|
1514
|
-
/* @__PURE__ */ jsx3("div", { className: "toolbar-separator" }),
|
|
1515
|
-
/* @__PURE__ */ jsxs3("div", { className: "toolbar-section", children: [
|
|
1516
|
-
/* @__PURE__ */ jsx3(
|
|
1517
|
-
"button",
|
|
1518
|
-
{
|
|
1519
|
-
className: "toolbar-button",
|
|
1520
|
-
onClick: handleZoomOut,
|
|
1521
|
-
title: "Zoom Out",
|
|
1522
|
-
children: /* @__PURE__ */ jsx3(ZoomOutIcon, { fontSize: "small" })
|
|
1523
|
-
}
|
|
1524
|
-
),
|
|
1525
|
-
/* @__PURE__ */ jsxs3("span", { className: "zoom-display", children: [
|
|
1526
|
-
zoom,
|
|
1527
|
-
"%"
|
|
1528
|
-
] }),
|
|
1529
|
-
/* @__PURE__ */ jsx3(
|
|
1530
|
-
"button",
|
|
1531
|
-
{
|
|
1532
|
-
className: "toolbar-button",
|
|
1533
|
-
onClick: handleZoomIn,
|
|
1534
|
-
title: "Zoom In",
|
|
1535
|
-
children: /* @__PURE__ */ jsx3(ZoomInIcon, { fontSize: "small" })
|
|
1536
|
-
}
|
|
1537
|
-
),
|
|
1538
|
-
/* @__PURE__ */ jsx3(
|
|
1539
|
-
"button",
|
|
1540
|
-
{
|
|
1541
|
-
className: "toolbar-button",
|
|
1542
|
-
onClick: handleFitToWidth,
|
|
1543
|
-
title: "Fit to Width",
|
|
1544
|
-
children: /* @__PURE__ */ jsx3(AspectRatioIcon, { fontSize: "small" })
|
|
1545
|
-
}
|
|
1546
|
-
),
|
|
1547
|
-
/* @__PURE__ */ jsx3(
|
|
1548
|
-
"button",
|
|
1549
|
-
{
|
|
1550
|
-
className: "toolbar-button",
|
|
1551
|
-
onClick: handleFitToPage,
|
|
1552
|
-
title: "Fit to Page",
|
|
1553
|
-
children: /* @__PURE__ */ jsx3(FitScreenIcon, { fontSize: "small" })
|
|
1554
|
-
}
|
|
1555
|
-
)
|
|
1556
|
-
] })
|
|
1557
|
-
] }),
|
|
1558
|
-
showSearch && /* @__PURE__ */ jsxs3(Fragment, { children: [
|
|
1559
|
-
/* @__PURE__ */ jsx3("div", { className: "toolbar-separator" }),
|
|
1560
|
-
/* @__PURE__ */ jsx3("div", { className: "toolbar-section", children: /* @__PURE__ */ jsx3(
|
|
1561
|
-
"button",
|
|
1562
|
-
{
|
|
1563
|
-
className: "toolbar-button",
|
|
1564
|
-
onClick: toggleSidebar,
|
|
1565
|
-
title: "Search in PDF",
|
|
1566
|
-
style: {
|
|
1567
|
-
backgroundColor: isSidebarOpen ? "#e3f2fd" : "transparent",
|
|
1568
|
-
color: isSidebarOpen ? "#1976d2" : "inherit"
|
|
1569
|
-
},
|
|
1570
|
-
children: /* @__PURE__ */ jsx3(SearchIcon2, { fontSize: "small" })
|
|
1571
|
-
}
|
|
1572
|
-
) })
|
|
1573
|
-
] }),
|
|
1574
|
-
(showMetadata || showProperties || showDownload || showPrint) && /* @__PURE__ */ jsxs3(Fragment, { children: [
|
|
1575
|
-
/* @__PURE__ */ jsx3("div", { className: "toolbar-separator" }),
|
|
1576
|
-
/* @__PURE__ */ jsxs3("div", { className: "toolbar-section", children: [
|
|
1577
|
-
showDownload && /* @__PURE__ */ jsx3(
|
|
1578
|
-
"button",
|
|
1579
|
-
{
|
|
1580
|
-
className: "toolbar-button",
|
|
1581
|
-
onClick: onDownloadClick,
|
|
1582
|
-
title: "Download PDF",
|
|
1583
|
-
children: /* @__PURE__ */ jsx3(DownloadIcon, { fontSize: "small" })
|
|
1584
|
-
}
|
|
1585
|
-
),
|
|
1586
|
-
showPrint && /* @__PURE__ */ jsx3(
|
|
1587
|
-
"button",
|
|
1588
|
-
{
|
|
1589
|
-
className: "toolbar-button",
|
|
1590
|
-
onClick: onPrintClick,
|
|
1591
|
-
title: "Print PDF",
|
|
1592
|
-
children: /* @__PURE__ */ jsx3(PrintIcon, { fontSize: "small" })
|
|
1593
|
-
}
|
|
1594
|
-
),
|
|
1595
|
-
showMetadata && /* @__PURE__ */ jsx3(
|
|
1596
|
-
"button",
|
|
1597
|
-
{
|
|
1598
|
-
className: "toolbar-button",
|
|
1599
|
-
onClick: onMetadataClick,
|
|
1600
|
-
title: "Document Metadata",
|
|
1601
|
-
children: /* @__PURE__ */ jsx3(InfoIcon, { fontSize: "small" })
|
|
1602
|
-
}
|
|
1603
|
-
),
|
|
1604
|
-
showProperties && /* @__PURE__ */ jsx3(
|
|
1605
|
-
"button",
|
|
1606
|
-
{
|
|
1607
|
-
className: "toolbar-button",
|
|
1608
|
-
onClick: onPropertiesClick,
|
|
1609
|
-
title: "Document Properties",
|
|
1610
|
-
children: /* @__PURE__ */ jsx3(DescriptionIcon, { fontSize: "small" })
|
|
1611
|
-
}
|
|
1612
|
-
)
|
|
1613
|
-
] })
|
|
1614
|
-
] })
|
|
1615
|
-
] }),
|
|
1616
|
-
/* @__PURE__ */ jsxs3("div", { className: "pdf-viewer-main", children: [
|
|
1617
|
-
/* @__PURE__ */ jsx3("div", { className: "pdf-viewer-viewer-area", children: /* @__PURE__ */ jsx3(
|
|
1618
|
-
HeadlessPDFViewer,
|
|
1542
|
+
return /* @__PURE__ */ jsxs5("div", { ref: containerRef, className: "pdf-viewer-container", children: [
|
|
1543
|
+
/* @__PURE__ */ jsx6("style", { children: toolbarStyles }),
|
|
1544
|
+
/* @__PURE__ */ jsx6(
|
|
1545
|
+
PDFHeader,
|
|
1546
|
+
{
|
|
1547
|
+
fileName: resolvedFileName,
|
|
1548
|
+
fileExtension
|
|
1549
|
+
}
|
|
1550
|
+
),
|
|
1551
|
+
/* @__PURE__ */ jsx6(
|
|
1552
|
+
PDFToolbar,
|
|
1553
|
+
{
|
|
1554
|
+
currentPage,
|
|
1555
|
+
totalPages,
|
|
1556
|
+
zoom,
|
|
1557
|
+
isSidebarOpen,
|
|
1558
|
+
showPageNavigation,
|
|
1559
|
+
showPageCount,
|
|
1560
|
+
showZoomControls,
|
|
1561
|
+
showSearch,
|
|
1562
|
+
showMetadata: !toolbar.isHidden("metadata"),
|
|
1563
|
+
showProperties: !toolbar.isHidden("properties"),
|
|
1564
|
+
showDownload: !toolbar.isHidden("download"),
|
|
1565
|
+
showPrint: !toolbar.isHidden("print"),
|
|
1566
|
+
disabledMetadata: toolbar.isDisabled("metadata"),
|
|
1567
|
+
disabledProperties: toolbar.isDisabled("properties"),
|
|
1568
|
+
disabledDownload: toolbar.isDisabled("download"),
|
|
1569
|
+
disabledPrint: toolbar.isDisabled("print"),
|
|
1570
|
+
onFirstPage: toolbarHandlers.handleFirstPage,
|
|
1571
|
+
onPreviousPage: toolbarHandlers.handlePreviousPage,
|
|
1572
|
+
onNextPage: toolbarHandlers.handleNextPage,
|
|
1573
|
+
onLastPage: toolbarHandlers.handleLastPage,
|
|
1574
|
+
onPageInput: toolbarHandlers.handlePageInput,
|
|
1575
|
+
onPageInputKeyPress: toolbarHandlers.handlePageInputKeyPress,
|
|
1576
|
+
onZoomIn: toolbarHandlers.handleZoomIn,
|
|
1577
|
+
onZoomOut: toolbarHandlers.handleZoomOut,
|
|
1578
|
+
onFitToWidth: toolbarHandlers.handleFitToWidth,
|
|
1579
|
+
onFitToPage: toolbarHandlers.handleFitToPage,
|
|
1580
|
+
onToggleSidebar: toolbarHandlers.toggleSidebar,
|
|
1581
|
+
onToggleFullScreen: toolbarHandlers.handleToggleFullScreen,
|
|
1582
|
+
onDownloadClick: toolbar.getHandler("download", onDownloadClick),
|
|
1583
|
+
onPrintClick: toolbar.getHandler("print", onPrintClick),
|
|
1584
|
+
onMetadataClick: toolbar.getHandler("metadata", onMetadataClick),
|
|
1585
|
+
onPropertiesClick: toolbar.getHandler("properties", onPropertiesClick)
|
|
1586
|
+
}
|
|
1587
|
+
),
|
|
1588
|
+
/* @__PURE__ */ jsxs5("div", { className: "pdf-viewer-main", children: [
|
|
1589
|
+
/* @__PURE__ */ jsx6("div", { className: "pdf-viewer-viewer-area", children: /* @__PURE__ */ jsx6(
|
|
1590
|
+
StablePDFViewer,
|
|
1619
1591
|
{
|
|
1620
|
-
ref: pdfViewerRef,
|
|
1621
1592
|
pdfBuffer,
|
|
1622
|
-
onPasswordRequest: handlePasswordRequest
|
|
1593
|
+
onPasswordRequest: handlePasswordRequest,
|
|
1594
|
+
pdfViewerRef
|
|
1623
1595
|
}
|
|
1624
1596
|
) }),
|
|
1625
|
-
/* @__PURE__ */
|
|
1597
|
+
/* @__PURE__ */ jsx6(
|
|
1626
1598
|
SearchSidebar,
|
|
1627
1599
|
{
|
|
1628
1600
|
isOpen: isSidebarOpen,
|
|
@@ -1639,7 +1611,7 @@ var PDFViewerContent = forwardRef((props, ref) => {
|
|
|
1639
1611
|
}
|
|
1640
1612
|
)
|
|
1641
1613
|
] }),
|
|
1642
|
-
/* @__PURE__ */
|
|
1614
|
+
/* @__PURE__ */ jsx6(
|
|
1643
1615
|
PasswordDialog,
|
|
1644
1616
|
{
|
|
1645
1617
|
open: isPasswordDialogOpen,
|
|
@@ -1653,11 +1625,11 @@ var PDFViewerContent = forwardRef((props, ref) => {
|
|
|
1653
1625
|
});
|
|
1654
1626
|
PDFViewerContent.displayName = "PDFViewerContent";
|
|
1655
1627
|
var PDFViewer = forwardRef((props, ref) => {
|
|
1656
|
-
return /* @__PURE__ */
|
|
1628
|
+
return /* @__PURE__ */ jsx6(PDFViewerContent, { ...props, sourceDescription: "doc.pdf", ref });
|
|
1657
1629
|
});
|
|
1658
1630
|
PDFViewer.displayName = "PDFViewer";
|
|
1659
1631
|
|
|
1660
1632
|
export {
|
|
1661
1633
|
PDFViewer
|
|
1662
1634
|
};
|
|
1663
|
-
//# sourceMappingURL=chunk-
|
|
1635
|
+
//# sourceMappingURL=chunk-ZKGWS327.mjs.map
|