@cannyminds/dms-file-viewers 0.5.0 → 0.7.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-57BAESSV.mjs +341 -0
- package/dist/chunk-57BAESSV.mjs.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-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-K5SKH4SD.mjs → chunk-HLDLNHNY.mjs} +226 -282
- package/dist/chunk-HLDLNHNY.mjs.map +1 -0
- package/dist/{chunk-QELOFQEB.js → chunk-HQJPMN53.js} +283 -339
- package/dist/chunk-HQJPMN53.js.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-QGM5J3SP.js +341 -0
- package/dist/chunk-QGM5J3SP.js.map +1 -0
- package/dist/{chunk-677DWENS.mjs → chunk-THFHTTQX.mjs} +64 -17
- package/dist/chunk-THFHTTQX.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/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-6ZBHO5SP.js +0 -294
- package/dist/chunk-6ZBHO5SP.js.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-DOOYIHGW.js.map +0 -1
- package/dist/chunk-K5SKH4SD.mjs.map +0 -1
- package/dist/chunk-QELOFQEB.js.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-UX6U3H7J.mjs +0 -294
- package/dist/chunk-UX6U3H7J.mjs.map +0 -1
- package/dist/chunk-WP55NYFS.js.map +0 -1
- package/dist/chunk-YHMHDPLQ.mjs.map +0 -1
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }"use client";
|
|
2
2
|
|
|
3
3
|
|
|
4
|
+
var _chunkA2MSWOEMjs = require('./chunk-A2MSWOEM.js');
|
|
4
5
|
|
|
5
|
-
|
|
6
|
+
|
|
7
|
+
var _chunkYEPEMLM3js = require('./chunk-YEPEMLM3.js');
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
var _chunkFA5L62Y5js = require('./chunk-FA5L62Y5.js');
|
|
6
12
|
|
|
7
13
|
// src/components/viewers/PDFViewer.tsx
|
|
8
14
|
var _react = require('react'); var _react2 = _interopRequireDefault(_react);
|
|
@@ -39,6 +45,7 @@ var _ZoomOut = require('@mui/icons-material/ZoomOut'); var _ZoomOut2 = _interopR
|
|
|
39
45
|
var _FitScreen = require('@mui/icons-material/FitScreen'); var _FitScreen2 = _interopRequireDefault(_FitScreen);
|
|
40
46
|
var _AspectRatio = require('@mui/icons-material/AspectRatio'); var _AspectRatio2 = _interopRequireDefault(_AspectRatio);
|
|
41
47
|
var _Search = require('@mui/icons-material/Search'); var _Search2 = _interopRequireDefault(_Search);
|
|
48
|
+
var _Fullscreen = require('@mui/icons-material/Fullscreen'); var _Fullscreen2 = _interopRequireDefault(_Fullscreen);
|
|
42
49
|
var _Download = require('@mui/icons-material/Download'); var _Download2 = _interopRequireDefault(_Download);
|
|
43
50
|
var _Print = require('@mui/icons-material/Print'); var _Print2 = _interopRequireDefault(_Print);
|
|
44
51
|
var _Info = require('@mui/icons-material/Info'); var _Info2 = _interopRequireDefault(_Info);
|
|
@@ -57,6 +64,10 @@ var PDFToolbar = _react2.default.memo(({
|
|
|
57
64
|
showProperties,
|
|
58
65
|
showDownload,
|
|
59
66
|
showPrint,
|
|
67
|
+
disabledMetadata,
|
|
68
|
+
disabledProperties,
|
|
69
|
+
disabledDownload,
|
|
70
|
+
disabledPrint,
|
|
60
71
|
onFirstPage,
|
|
61
72
|
onPreviousPage,
|
|
62
73
|
onNextPage,
|
|
@@ -68,6 +79,7 @@ var PDFToolbar = _react2.default.memo(({
|
|
|
68
79
|
onFitToWidth,
|
|
69
80
|
onFitToPage,
|
|
70
81
|
onToggleSidebar,
|
|
82
|
+
onToggleFullScreen,
|
|
71
83
|
onDownloadClick,
|
|
72
84
|
onPrintClick,
|
|
73
85
|
onMetadataClick,
|
|
@@ -196,6 +208,16 @@ var PDFToolbar = _react2.default.memo(({
|
|
|
196
208
|
}
|
|
197
209
|
) })
|
|
198
210
|
] }),
|
|
211
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "toolbar-separator" }),
|
|
212
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "toolbar-section", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
213
|
+
"button",
|
|
214
|
+
{
|
|
215
|
+
className: "toolbar-button",
|
|
216
|
+
onClick: onToggleFullScreen,
|
|
217
|
+
title: "Fullscreen",
|
|
218
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _Fullscreen2.default, { fontSize: "small" })
|
|
219
|
+
}
|
|
220
|
+
) }),
|
|
199
221
|
(showMetadata || showProperties || showDownload || showPrint) && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
200
222
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "toolbar-separator" }),
|
|
201
223
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "toolbar-section", children: [
|
|
@@ -204,6 +226,7 @@ var PDFToolbar = _react2.default.memo(({
|
|
|
204
226
|
{
|
|
205
227
|
className: "toolbar-button",
|
|
206
228
|
onClick: onDownloadClick,
|
|
229
|
+
disabled: disabledDownload,
|
|
207
230
|
title: "Download PDF",
|
|
208
231
|
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _Download2.default, { fontSize: "small" })
|
|
209
232
|
}
|
|
@@ -213,6 +236,7 @@ var PDFToolbar = _react2.default.memo(({
|
|
|
213
236
|
{
|
|
214
237
|
className: "toolbar-button",
|
|
215
238
|
onClick: onPrintClick,
|
|
239
|
+
disabled: disabledPrint,
|
|
216
240
|
title: "Print PDF",
|
|
217
241
|
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _Print2.default, { fontSize: "small" })
|
|
218
242
|
}
|
|
@@ -222,8 +246,9 @@ var PDFToolbar = _react2.default.memo(({
|
|
|
222
246
|
{
|
|
223
247
|
className: "toolbar-button",
|
|
224
248
|
onClick: onMetadataClick,
|
|
249
|
+
disabled: disabledMetadata,
|
|
225
250
|
title: "Document Metadata",
|
|
226
|
-
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
251
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _Description2.default, { fontSize: "small" })
|
|
227
252
|
}
|
|
228
253
|
),
|
|
229
254
|
showProperties && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
@@ -231,8 +256,9 @@ var PDFToolbar = _react2.default.memo(({
|
|
|
231
256
|
{
|
|
232
257
|
className: "toolbar-button",
|
|
233
258
|
onClick: onPropertiesClick,
|
|
259
|
+
disabled: disabledProperties,
|
|
234
260
|
title: "Document Properties",
|
|
235
|
-
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
261
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _Info2.default, { fontSize: "small" })
|
|
236
262
|
}
|
|
237
263
|
)
|
|
238
264
|
] })
|
|
@@ -246,7 +272,7 @@ PDFToolbar.displayName = "PDFToolbar";
|
|
|
246
272
|
|
|
247
273
|
var PDFHeader = _react2.default.memo(({ fileName, fileExtension }) => {
|
|
248
274
|
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "pdf-viewer-header", children: [
|
|
249
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
275
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkFA5L62Y5js.FileIcon_default, { ext: fileExtension, size: 26 }),
|
|
250
276
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "header-file-name", title: fileName, children: fileName })
|
|
251
277
|
] });
|
|
252
278
|
});
|
|
@@ -261,6 +287,7 @@ PDFHeader.displayName = "PDFHeader";
|
|
|
261
287
|
|
|
262
288
|
|
|
263
289
|
|
|
290
|
+
|
|
264
291
|
var _material = require('@mui/material');
|
|
265
292
|
|
|
266
293
|
var _Close = require('@mui/icons-material/Close'); var _Close2 = _interopRequireDefault(_Close);
|
|
@@ -363,10 +390,10 @@ var SearchSidebar = ({
|
|
|
363
390
|
}, []);
|
|
364
391
|
_react.useLayoutEffect.call(void 0, () => {
|
|
365
392
|
setSearchTerm(searchKeyword || "");
|
|
366
|
-
if (searchKeyword) {
|
|
393
|
+
if (searchKeyword || searchResults.length > 0) {
|
|
367
394
|
setHasSearched(true);
|
|
368
395
|
}
|
|
369
|
-
}, [searchKeyword]);
|
|
396
|
+
}, [searchKeyword, searchResults]);
|
|
370
397
|
const handleSearchSubmit = (e) => {
|
|
371
398
|
if (e) e.preventDefault();
|
|
372
399
|
if (searchTerm.trim()) {
|
|
@@ -582,7 +609,7 @@ var SearchSidebar = ({
|
|
|
582
609
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Typography, { variant: "body1", sx: { color: "text.primary", fontWeight: 500, mb: 1 }, children: "Search in Document" }),
|
|
583
610
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Typography, { variant: "body2", sx: { color: "text.secondary", lineHeight: 1.6 }, children: "Enter keywords to find text within the PDF document" })
|
|
584
611
|
] }),
|
|
585
|
-
searchTerm && !hasSearched && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _material.Box, { sx: { p: 4, textAlign: "center", mt: 6 }, children: [
|
|
612
|
+
searchTerm && !hasSearched && !isSearching && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _material.Box, { sx: { p: 4, textAlign: "center", mt: 6 }, children: [
|
|
586
613
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
587
614
|
_material.Box,
|
|
588
615
|
{
|
|
@@ -624,6 +651,27 @@ var SearchSidebar = ({
|
|
|
624
651
|
}
|
|
625
652
|
)
|
|
626
653
|
] }),
|
|
654
|
+
isSearching && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _material.Box, { sx: { p: 4, textAlign: "center", mt: 6 }, children: [
|
|
655
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
656
|
+
_material.Box,
|
|
657
|
+
{
|
|
658
|
+
sx: {
|
|
659
|
+
display: "flex",
|
|
660
|
+
alignItems: "center",
|
|
661
|
+
justifyContent: "center",
|
|
662
|
+
margin: "0 auto",
|
|
663
|
+
mb: 3
|
|
664
|
+
},
|
|
665
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.CircularProgress, { size: 60, thickness: 4 })
|
|
666
|
+
}
|
|
667
|
+
),
|
|
668
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Typography, { variant: "body1", sx: { color: "text.primary", fontWeight: 500, mb: 1 }, children: "Searching..." }),
|
|
669
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _material.Typography, { variant: "body2", sx: { color: "text.secondary", lineHeight: 1.6 }, children: [
|
|
670
|
+
'Finding matches for "',
|
|
671
|
+
searchTerm,
|
|
672
|
+
'"'
|
|
673
|
+
] })
|
|
674
|
+
] }),
|
|
627
675
|
hasSearched && totalResults === 0 && !isSearching && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _material.Box, { sx: { p: 4, textAlign: "center", mt: 6 }, children: [
|
|
628
676
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
629
677
|
_material.Box,
|
|
@@ -892,159 +940,6 @@ var PasswordDialog = ({
|
|
|
892
940
|
);
|
|
893
941
|
};
|
|
894
942
|
|
|
895
|
-
// src/components/viewers/pdf/PDFStyles.tsx
|
|
896
|
-
var toolbarStyles = `
|
|
897
|
-
@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');
|
|
898
|
-
|
|
899
|
-
* {
|
|
900
|
-
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
|
|
901
|
-
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
|
|
902
|
-
'Noto Sans Tamil', 'Noto Sans Devanagari', 'Lohit Tamil', 'Tamil MN',
|
|
903
|
-
'Arial Unicode MS', sans-serif !important;
|
|
904
|
-
}
|
|
905
|
-
|
|
906
|
-
/* Target PDF.js text layer */
|
|
907
|
-
.textLayer,
|
|
908
|
-
.textLayer span,
|
|
909
|
-
.textLayer div,
|
|
910
|
-
[class*="pdf"],
|
|
911
|
-
[class*="page"],
|
|
912
|
-
canvas + div,
|
|
913
|
-
.embedpdf-viewport *,
|
|
914
|
-
[data-pdf-viewer] *,
|
|
915
|
-
[role="document"] * {
|
|
916
|
-
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
|
|
917
|
-
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
|
|
918
|
-
'Noto Sans Tamil', 'Noto Sans Devanagari', 'Lohit Tamil', 'Tamil MN',
|
|
919
|
-
'Arial Unicode MS', sans-serif !important;
|
|
920
|
-
}
|
|
921
|
-
|
|
922
|
-
.pdf-viewer-header {
|
|
923
|
-
display: flex;
|
|
924
|
-
align-items: center;
|
|
925
|
-
justify-content: flex-start;
|
|
926
|
-
gap: 8px;
|
|
927
|
-
padding: 3px 16px 0 16px;
|
|
928
|
-
background: #fff;
|
|
929
|
-
min-height: 36px;
|
|
930
|
-
}
|
|
931
|
-
.header-file-name {
|
|
932
|
-
font-size: 12px;
|
|
933
|
-
font-weight: 500;
|
|
934
|
-
color: #424242;
|
|
935
|
-
white-space: nowrap;
|
|
936
|
-
overflow: hidden;
|
|
937
|
-
text-overflow: ellipsis;
|
|
938
|
-
max-width: 400px;
|
|
939
|
-
}
|
|
940
|
-
.pdf-viewer-toolbar {
|
|
941
|
-
display: flex;
|
|
942
|
-
align-items: center;
|
|
943
|
-
justify-content: center;
|
|
944
|
-
padding: 0 16px 6px 16px;
|
|
945
|
-
background: #fff;
|
|
946
|
-
gap: 12px;
|
|
947
|
-
flex-wrap: wrap;
|
|
948
|
-
min-height: 44px;
|
|
949
|
-
}
|
|
950
|
-
.toolbar-section {
|
|
951
|
-
display: flex;
|
|
952
|
-
align-items: center;
|
|
953
|
-
gap: 8px;
|
|
954
|
-
}
|
|
955
|
-
.toolbar-separator {
|
|
956
|
-
width: 1px;
|
|
957
|
-
height: 24px;
|
|
958
|
-
background: #e0e0e0;
|
|
959
|
-
margin: 0 4px;
|
|
960
|
-
}
|
|
961
|
-
.toolbar-button {
|
|
962
|
-
padding: 8px;
|
|
963
|
-
border: none;
|
|
964
|
-
background: transparent;
|
|
965
|
-
cursor: pointer;
|
|
966
|
-
border-radius: 4px;
|
|
967
|
-
display: flex;
|
|
968
|
-
align-items: center;
|
|
969
|
-
justify-content: center;
|
|
970
|
-
transition: background 0.2s;
|
|
971
|
-
}
|
|
972
|
-
.toolbar-button:hover:not(:disabled) {
|
|
973
|
-
background: #f5f5f5;
|
|
974
|
-
}
|
|
975
|
-
.toolbar-button:disabled {
|
|
976
|
-
opacity: 0.4;
|
|
977
|
-
cursor: not-allowed;
|
|
978
|
-
}
|
|
979
|
-
.toolbar-button svg {
|
|
980
|
-
width: 20px;
|
|
981
|
-
height: 20px;
|
|
982
|
-
display: block;
|
|
983
|
-
}
|
|
984
|
-
.page-input {
|
|
985
|
-
width: 60px;
|
|
986
|
-
padding: 4px 8px;
|
|
987
|
-
border: 1px solid #e0e0e0;
|
|
988
|
-
border-radius: 4px;
|
|
989
|
-
text-align: center;
|
|
990
|
-
font-size: 14px;
|
|
991
|
-
}
|
|
992
|
-
.page-info {
|
|
993
|
-
font-size: 14px;
|
|
994
|
-
color: #666;
|
|
995
|
-
white-space: nowrap;
|
|
996
|
-
}
|
|
997
|
-
.zoom-display {
|
|
998
|
-
min-width: 60px;
|
|
999
|
-
text-align: center;
|
|
1000
|
-
font-size: 14px;
|
|
1001
|
-
color: #666;
|
|
1002
|
-
}
|
|
1003
|
-
.search-input {
|
|
1004
|
-
padding: 4px 8px;
|
|
1005
|
-
border: 1px solid #e0e0e0;
|
|
1006
|
-
border-radius: 4px;
|
|
1007
|
-
font-size: 14px;
|
|
1008
|
-
min-width: 200px;
|
|
1009
|
-
}
|
|
1010
|
-
.pdf-viewer-content {
|
|
1011
|
-
flex: 1;
|
|
1012
|
-
overflow: hidden;
|
|
1013
|
-
position: relative;
|
|
1014
|
-
user-select: text;
|
|
1015
|
-
-webkit-user-select: text;
|
|
1016
|
-
-moz-user-select: text;
|
|
1017
|
-
-ms-user-select: text;
|
|
1018
|
-
}
|
|
1019
|
-
.pdf-viewer-container {
|
|
1020
|
-
display: flex;
|
|
1021
|
-
flex-direction: column;
|
|
1022
|
-
height: 100%;
|
|
1023
|
-
width: 100%;
|
|
1024
|
-
}
|
|
1025
|
-
.pdf-viewer-main {
|
|
1026
|
-
display: flex;
|
|
1027
|
-
flex: 1;
|
|
1028
|
-
overflow: hidden;
|
|
1029
|
-
position: relative;
|
|
1030
|
-
}
|
|
1031
|
-
.pdf-viewer-viewer-area {
|
|
1032
|
-
flex: 1;
|
|
1033
|
-
overflow: hidden;
|
|
1034
|
-
position: relative;
|
|
1035
|
-
user-select: text;
|
|
1036
|
-
-webkit-user-select: text;
|
|
1037
|
-
-moz-user-select: text;
|
|
1038
|
-
-ms-user-select: text;
|
|
1039
|
-
}
|
|
1040
|
-
.pdf-viewer-viewer-area * {
|
|
1041
|
-
user-select: text !important;
|
|
1042
|
-
-webkit-user-select: text !important;
|
|
1043
|
-
-moz-user-select: text !important;
|
|
1044
|
-
-ms-user-select: text !important;
|
|
1045
|
-
}
|
|
1046
|
-
`;
|
|
1047
|
-
|
|
1048
943
|
// src/components/viewers/PDFViewer.tsx
|
|
1049
944
|
|
|
1050
945
|
var PDFViewerContent = _react.forwardRef.call(void 0, (props, ref) => {
|
|
@@ -1082,7 +977,7 @@ var PDFViewerContent = _react.forwardRef.call(void 0, (props, ref) => {
|
|
|
1082
977
|
return "document.pdf";
|
|
1083
978
|
}, [file, fileName]);
|
|
1084
979
|
const fileExtension = _react.useMemo.call(void 0,
|
|
1085
|
-
() =>
|
|
980
|
+
() => _chunkYEPEMLM3js.getFileExtension.call(void 0, resolvedFileName),
|
|
1086
981
|
[resolvedFileName]
|
|
1087
982
|
);
|
|
1088
983
|
const [currentPage, setCurrentPage] = _react.useState.call(void 0, 1);
|
|
@@ -1096,76 +991,112 @@ var PDFViewerContent = _react.forwardRef.call(void 0, (props, ref) => {
|
|
|
1096
991
|
const [currentSearchResultIndex, setCurrentSearchResultIndex] = _react.useState.call(void 0, 0);
|
|
1097
992
|
const [totalSearchResults, setTotalSearchResults] = _react.useState.call(void 0, 0);
|
|
1098
993
|
const [autoExecuteSearch, setAutoExecuteSearch] = _react.useState.call(void 0, !!initialSearchText);
|
|
994
|
+
const [isFullScreen, setIsFullScreen] = _react.useState.call(void 0, false);
|
|
995
|
+
const containerRef = _react.useRef.call(void 0, null);
|
|
1099
996
|
const [isPasswordDialogOpen, setIsPasswordDialogOpen] = _react.useState.call(void 0, false);
|
|
1100
997
|
const [passwordError, setPasswordError] = _react.useState.call(void 0, "");
|
|
1101
998
|
const [passwordResolve, setPasswordResolve] = _react.useState.call(void 0, null);
|
|
1102
999
|
const hasExecutedInitialSearch = _react.useRef.call(void 0, false);
|
|
1000
|
+
const handleToggleFullScreen = _react.useCallback.call(void 0, () => {
|
|
1001
|
+
if (!isFullScreen && _optionalChain([containerRef, 'access', _ => _.current, 'optionalAccess', _2 => _2.requestFullscreen])) {
|
|
1002
|
+
containerRef.current.requestFullscreen();
|
|
1003
|
+
setIsFullScreen(true);
|
|
1004
|
+
} else if (isFullScreen && document.exitFullscreen) {
|
|
1005
|
+
document.exitFullscreen();
|
|
1006
|
+
setIsFullScreen(false);
|
|
1007
|
+
}
|
|
1008
|
+
}, [isFullScreen]);
|
|
1009
|
+
const handleSidebarClose = _react.useCallback.call(void 0, () => {
|
|
1010
|
+
setIsSidebarOpen(false);
|
|
1011
|
+
setSearchQuery("");
|
|
1012
|
+
setSearchResults([]);
|
|
1013
|
+
setTotalSearchResults(0);
|
|
1014
|
+
setCurrentSearchResultIndex(0);
|
|
1015
|
+
_optionalChain([pdfViewerRef, 'access', _3 => _3.current, 'optionalAccess', _4 => _4.search, 'access', _5 => _5.stopSearch, 'call', _6 => _6()]);
|
|
1016
|
+
}, []);
|
|
1017
|
+
const toolbar = _chunkFA5L62Y5js.mergeToolbarConfig.call(void 0, {
|
|
1018
|
+
showDownload,
|
|
1019
|
+
showPrint,
|
|
1020
|
+
showMetadata,
|
|
1021
|
+
showProperties,
|
|
1022
|
+
onDownloadClick,
|
|
1023
|
+
onPrintClick,
|
|
1024
|
+
onMetadataClick,
|
|
1025
|
+
onPropertiesClick,
|
|
1026
|
+
toolbarActions: props.toolbarActions
|
|
1027
|
+
});
|
|
1103
1028
|
const toolbarHandlers = _react.useMemo.call(void 0, () => ({
|
|
1104
1029
|
handleZoomIn: () => {
|
|
1105
|
-
_optionalChain([pdfViewerRef, 'access',
|
|
1030
|
+
_optionalChain([pdfViewerRef, 'access', _7 => _7.current, 'optionalAccess', _8 => _8.zoom, 'access', _9 => _9.zoomIn, 'call', _10 => _10()]);
|
|
1106
1031
|
requestAnimationFrame(() => {
|
|
1107
|
-
const zoomValue = _optionalChain([pdfViewerRef, 'access',
|
|
1032
|
+
const zoomValue = _optionalChain([pdfViewerRef, 'access', _11 => _11.current, 'optionalAccess', _12 => _12.zoom, 'access', _13 => _13.getZoom, 'call', _14 => _14()]);
|
|
1108
1033
|
if (typeof zoomValue === "number") {
|
|
1109
1034
|
setZoom(Math.round(zoomValue * 100));
|
|
1110
1035
|
}
|
|
1111
1036
|
});
|
|
1112
1037
|
},
|
|
1113
1038
|
handleZoomOut: () => {
|
|
1114
|
-
_optionalChain([pdfViewerRef, 'access',
|
|
1039
|
+
_optionalChain([pdfViewerRef, 'access', _15 => _15.current, 'optionalAccess', _16 => _16.zoom, 'access', _17 => _17.zoomOut, 'call', _18 => _18()]);
|
|
1115
1040
|
requestAnimationFrame(() => {
|
|
1116
|
-
const zoomValue = _optionalChain([pdfViewerRef, 'access',
|
|
1041
|
+
const zoomValue = _optionalChain([pdfViewerRef, 'access', _19 => _19.current, 'optionalAccess', _20 => _20.zoom, 'access', _21 => _21.getZoom, 'call', _22 => _22()]);
|
|
1117
1042
|
if (typeof zoomValue === "number") {
|
|
1118
1043
|
setZoom(Math.round(zoomValue * 100));
|
|
1119
1044
|
}
|
|
1120
1045
|
});
|
|
1121
1046
|
},
|
|
1122
1047
|
handleFitToWidth: () => {
|
|
1123
|
-
_optionalChain([pdfViewerRef, 'access',
|
|
1048
|
+
_optionalChain([pdfViewerRef, 'access', _23 => _23.current, 'optionalAccess', _24 => _24.zoom, 'access', _25 => _25.fitToWidth, 'call', _26 => _26()]);
|
|
1124
1049
|
requestAnimationFrame(() => {
|
|
1125
|
-
const zoomValue = _optionalChain([pdfViewerRef, 'access',
|
|
1050
|
+
const zoomValue = _optionalChain([pdfViewerRef, 'access', _27 => _27.current, 'optionalAccess', _28 => _28.zoom, 'access', _29 => _29.getZoom, 'call', _30 => _30()]);
|
|
1126
1051
|
if (typeof zoomValue === "number") {
|
|
1127
1052
|
setZoom(Math.round(zoomValue * 100));
|
|
1128
1053
|
}
|
|
1129
1054
|
});
|
|
1130
1055
|
},
|
|
1131
1056
|
handleFitToPage: () => {
|
|
1132
|
-
_optionalChain([pdfViewerRef, 'access',
|
|
1057
|
+
_optionalChain([pdfViewerRef, 'access', _31 => _31.current, 'optionalAccess', _32 => _32.zoom, 'access', _33 => _33.fitToPage, 'call', _34 => _34()]);
|
|
1133
1058
|
requestAnimationFrame(() => {
|
|
1134
|
-
const zoomValue = _optionalChain([pdfViewerRef, 'access',
|
|
1059
|
+
const zoomValue = _optionalChain([pdfViewerRef, 'access', _35 => _35.current, 'optionalAccess', _36 => _36.zoom, 'access', _37 => _37.getZoom, 'call', _38 => _38()]);
|
|
1135
1060
|
if (typeof zoomValue === "number") {
|
|
1136
1061
|
setZoom(Math.round(zoomValue * 100));
|
|
1137
1062
|
}
|
|
1138
1063
|
});
|
|
1139
1064
|
},
|
|
1140
1065
|
handlePreviousPage: () => {
|
|
1141
|
-
_optionalChain([pdfViewerRef, 'access',
|
|
1066
|
+
_optionalChain([pdfViewerRef, 'access', _39 => _39.current, 'optionalAccess', _40 => _40.navigation, 'access', _41 => _41.previousPage, 'call', _42 => _42()]);
|
|
1142
1067
|
requestAnimationFrame(() => {
|
|
1143
|
-
const current = _optionalChain([pdfViewerRef, 'access',
|
|
1068
|
+
const current = _optionalChain([pdfViewerRef, 'access', _43 => _43.current, 'optionalAccess', _44 => _44.navigation, 'access', _45 => _45.getCurrentPage, 'call', _46 => _46()]) || 1;
|
|
1144
1069
|
setCurrentPage(current);
|
|
1145
1070
|
});
|
|
1146
1071
|
},
|
|
1147
1072
|
handleNextPage: () => {
|
|
1148
|
-
_optionalChain([pdfViewerRef, 'access',
|
|
1073
|
+
_optionalChain([pdfViewerRef, 'access', _47 => _47.current, 'optionalAccess', _48 => _48.navigation, 'access', _49 => _49.nextPage, 'call', _50 => _50()]);
|
|
1149
1074
|
requestAnimationFrame(() => {
|
|
1150
|
-
const current = _optionalChain([pdfViewerRef, 'access',
|
|
1075
|
+
const current = _optionalChain([pdfViewerRef, 'access', _51 => _51.current, 'optionalAccess', _52 => _52.navigation, 'access', _53 => _53.getCurrentPage, 'call', _54 => _54()]) || 1;
|
|
1151
1076
|
setCurrentPage(current);
|
|
1152
1077
|
});
|
|
1153
1078
|
},
|
|
1154
1079
|
handleFirstPage: () => {
|
|
1155
|
-
_optionalChain([pdfViewerRef, 'access',
|
|
1080
|
+
_optionalChain([pdfViewerRef, 'access', _55 => _55.current, 'optionalAccess', _56 => _56.navigation, 'access', _57 => _57.goToFirstPage, 'call', _58 => _58()]);
|
|
1156
1081
|
requestAnimationFrame(() => {
|
|
1157
|
-
const current = _optionalChain([pdfViewerRef, 'access',
|
|
1082
|
+
const current = _optionalChain([pdfViewerRef, 'access', _59 => _59.current, 'optionalAccess', _60 => _60.navigation, 'access', _61 => _61.getCurrentPage, 'call', _62 => _62()]) || 1;
|
|
1158
1083
|
setCurrentPage(current);
|
|
1159
1084
|
});
|
|
1160
1085
|
},
|
|
1161
1086
|
handleLastPage: () => {
|
|
1162
|
-
_optionalChain([pdfViewerRef, 'access',
|
|
1087
|
+
_optionalChain([pdfViewerRef, 'access', _63 => _63.current, 'optionalAccess', _64 => _64.navigation, 'access', _65 => _65.goToLastPage, 'call', _66 => _66()]);
|
|
1163
1088
|
requestAnimationFrame(() => {
|
|
1164
|
-
const current = _optionalChain([pdfViewerRef, 'access',
|
|
1089
|
+
const current = _optionalChain([pdfViewerRef, 'access', _67 => _67.current, 'optionalAccess', _68 => _68.navigation, 'access', _69 => _69.getCurrentPage, 'call', _70 => _70()]) || 1;
|
|
1165
1090
|
setCurrentPage(current);
|
|
1166
1091
|
});
|
|
1167
1092
|
},
|
|
1168
|
-
toggleSidebar: () =>
|
|
1093
|
+
toggleSidebar: () => {
|
|
1094
|
+
if (isSidebarOpen) {
|
|
1095
|
+
handleSidebarClose();
|
|
1096
|
+
} else {
|
|
1097
|
+
setIsSidebarOpen(true);
|
|
1098
|
+
}
|
|
1099
|
+
},
|
|
1169
1100
|
handlePageInput: (e) => {
|
|
1170
1101
|
const value = e.target.value;
|
|
1171
1102
|
if (/^\d*$/.test(value)) {
|
|
@@ -1173,7 +1104,7 @@ var PDFViewerContent = _react.forwardRef.call(void 0, (props, ref) => {
|
|
|
1173
1104
|
}
|
|
1174
1105
|
const page = parseInt(value, 10);
|
|
1175
1106
|
if (!isNaN(page) && page >= 1 && (totalPages === 0 || page <= totalPages)) {
|
|
1176
|
-
_optionalChain([pdfViewerRef, 'access',
|
|
1107
|
+
_optionalChain([pdfViewerRef, 'access', _71 => _71.current, 'optionalAccess', _72 => _72.navigation, 'access', _73 => _73.goToPage, 'call', _74 => _74(page)]);
|
|
1177
1108
|
setCurrentPage(page);
|
|
1178
1109
|
}
|
|
1179
1110
|
},
|
|
@@ -1182,28 +1113,39 @@ var PDFViewerContent = _react.forwardRef.call(void 0, (props, ref) => {
|
|
|
1182
1113
|
const value = e.target.value;
|
|
1183
1114
|
const page = parseInt(value, 10);
|
|
1184
1115
|
if (!isNaN(page) && page >= 1 && (totalPages === 0 || page <= totalPages)) {
|
|
1185
|
-
_optionalChain([pdfViewerRef, 'access',
|
|
1116
|
+
_optionalChain([pdfViewerRef, 'access', _75 => _75.current, 'optionalAccess', _76 => _76.navigation, 'access', _77 => _77.goToPage, 'call', _78 => _78(page)]);
|
|
1186
1117
|
setCurrentPage(page);
|
|
1187
1118
|
}
|
|
1188
1119
|
}
|
|
1189
|
-
}
|
|
1190
|
-
|
|
1120
|
+
},
|
|
1121
|
+
handleToggleFullScreen
|
|
1122
|
+
}), [isSidebarOpen, totalPages, handleToggleFullScreen]);
|
|
1191
1123
|
_react.useEffect.call(void 0, () => {
|
|
1192
|
-
console.log("came", initialSearchText, pdfViewerRef.current, hasExecutedInitialSearch.current);
|
|
1193
|
-
if (
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1124
|
+
console.log("came", initialSearchText, pdfViewerRef.current, hasExecutedInitialSearch.current, "state:", state, "totalPages:", totalPages);
|
|
1125
|
+
if (!initialSearchText || hasExecutedInitialSearch.current) return;
|
|
1126
|
+
const isPDFReady = state === "ready";
|
|
1127
|
+
const isPagesInitialized = totalPages > 0;
|
|
1128
|
+
const isViewerAvailable = !!pdfViewerRef.current;
|
|
1129
|
+
const isSearchAPIReady = !!_optionalChain([pdfViewerRef, 'access', _79 => _79.current, 'optionalAccess', _80 => _80.search, 'optionalAccess', _81 => _81.searchText]);
|
|
1130
|
+
const canExecuteSearch = isPDFReady && isPagesInitialized && isViewerAvailable && isSearchAPIReady;
|
|
1131
|
+
if (!canExecuteSearch) return;
|
|
1132
|
+
hasExecutedInitialSearch.current = true;
|
|
1133
|
+
const SEARCH_INITIALIZATION_DELAY = 10;
|
|
1134
|
+
setTimeout(() => {
|
|
1135
|
+
if (!_optionalChain([pdfViewerRef, 'access', _82 => _82.current, 'optionalAccess', _83 => _83.search, 'optionalAccess', _84 => _84.searchText])) {
|
|
1136
|
+
console.warn("Search API became unavailable, skipping initial search");
|
|
1137
|
+
hasExecutedInitialSearch.current = false;
|
|
1138
|
+
return;
|
|
1139
|
+
}
|
|
1140
|
+
requestAnimationFrame(() => {
|
|
1141
|
+
requestAnimationFrame(() => {
|
|
1142
|
+
setIsSidebarOpen(true);
|
|
1143
|
+
handleSidebarSearch(initialSearchText, initialSearchPages);
|
|
1144
|
+
setAutoExecuteSearch(false);
|
|
1145
|
+
});
|
|
1204
1146
|
});
|
|
1205
|
-
}
|
|
1206
|
-
}, [pdfViewerRef.current, initialSearchText]);
|
|
1147
|
+
}, SEARCH_INITIALIZATION_DELAY);
|
|
1148
|
+
}, [state, totalPages, pdfViewerRef.current, initialSearchText, initialSearchPages]);
|
|
1207
1149
|
_react.useEffect.call(void 0, () => {
|
|
1208
1150
|
setSearchQuery("");
|
|
1209
1151
|
setSearchResults([]);
|
|
@@ -1211,6 +1153,7 @@ var PDFViewerContent = _react.forwardRef.call(void 0, (props, ref) => {
|
|
|
1211
1153
|
setTotalSearchResults(0);
|
|
1212
1154
|
setIsSearching(false);
|
|
1213
1155
|
setIsSidebarOpen(false);
|
|
1156
|
+
hasExecutedInitialSearch.current = false;
|
|
1214
1157
|
setCurrentPage(1);
|
|
1215
1158
|
setTotalPages(0);
|
|
1216
1159
|
setZoom(100);
|
|
@@ -1251,7 +1194,7 @@ var PDFViewerContent = _react.forwardRef.call(void 0, (props, ref) => {
|
|
|
1251
1194
|
if (!viewer) return;
|
|
1252
1195
|
await new Promise((resolve) => requestAnimationFrame(resolve));
|
|
1253
1196
|
try {
|
|
1254
|
-
const count = _optionalChain([viewer, 'access',
|
|
1197
|
+
const count = _optionalChain([viewer, 'access', _85 => _85.navigation, 'optionalAccess', _86 => _86.getTotalPages, 'optionalCall', _87 => _87()]);
|
|
1255
1198
|
if (count && count > 1) {
|
|
1256
1199
|
setTotalPages(count);
|
|
1257
1200
|
return;
|
|
@@ -1259,11 +1202,11 @@ var PDFViewerContent = _react.forwardRef.call(void 0, (props, ref) => {
|
|
|
1259
1202
|
} catch (e) {
|
|
1260
1203
|
}
|
|
1261
1204
|
try {
|
|
1262
|
-
const results = await _optionalChain([viewer, 'access',
|
|
1263
|
-
if (_optionalChain([results, 'optionalAccess',
|
|
1205
|
+
const results = await _optionalChain([viewer, 'access', _88 => _88.search, 'optionalAccess', _89 => _89.searchText, 'optionalCall', _90 => _90("e")]);
|
|
1206
|
+
if (_optionalChain([results, 'optionalAccess', _91 => _91.results]) && results.results.length > 0) {
|
|
1264
1207
|
const pageIndices = results.results.map((m) => m.pageIndex).filter((idx) => typeof idx === "number");
|
|
1265
1208
|
const count = Math.max(...pageIndices) + 1;
|
|
1266
|
-
_optionalChain([viewer, 'access',
|
|
1209
|
+
_optionalChain([viewer, 'access', _92 => _92.search, 'optionalAccess', _93 => _93.stopSearch, 'optionalCall', _94 => _94()]);
|
|
1267
1210
|
setTotalPages(count);
|
|
1268
1211
|
return;
|
|
1269
1212
|
}
|
|
@@ -1294,10 +1237,10 @@ var PDFViewerContent = _react.forwardRef.call(void 0, (props, ref) => {
|
|
|
1294
1237
|
_react.useEffect.call(void 0, () => {
|
|
1295
1238
|
if (state === "ready" && pdfViewerRef.current) {
|
|
1296
1239
|
const updateInfo = () => {
|
|
1297
|
-
const current = _optionalChain([pdfViewerRef, 'access',
|
|
1298
|
-
const total = _optionalChain([pdfViewerRef, 'access',
|
|
1299
|
-
const zoomValue = _optionalChain([pdfViewerRef, 'access',
|
|
1300
|
-
const currentSearchState = _optionalChain([pdfViewerRef, 'access',
|
|
1240
|
+
const current = _optionalChain([pdfViewerRef, 'access', _95 => _95.current, 'optionalAccess', _96 => _96.navigation, 'access', _97 => _97.getCurrentPage, 'call', _98 => _98()]) || 1;
|
|
1241
|
+
const total = _optionalChain([pdfViewerRef, 'access', _99 => _99.current, 'optionalAccess', _100 => _100.navigation, 'access', _101 => _101.getTotalPages, 'call', _102 => _102()]) || 0;
|
|
1242
|
+
const zoomValue = _optionalChain([pdfViewerRef, 'access', _103 => _103.current, 'optionalAccess', _104 => _104.zoom, 'access', _105 => _105.getZoom, 'call', _106 => _106()]);
|
|
1243
|
+
const currentSearchState = _optionalChain([pdfViewerRef, 'access', _107 => _107.current, 'optionalAccess', _108 => _108.search, 'access', _109 => _109.getSearchState, 'call', _110 => _110()]);
|
|
1301
1244
|
setCurrentPage(current);
|
|
1302
1245
|
if (total > 0 && total !== totalPages) {
|
|
1303
1246
|
setTotalPages(total);
|
|
@@ -1313,125 +1256,95 @@ var PDFViewerContent = _react.forwardRef.call(void 0, (props, ref) => {
|
|
|
1313
1256
|
}, [state, totalPages]);
|
|
1314
1257
|
_react.useImperativeHandle.call(void 0, ref, () => ({
|
|
1315
1258
|
zoomIn: () => {
|
|
1316
|
-
_optionalChain([pdfViewerRef, 'access',
|
|
1259
|
+
_optionalChain([pdfViewerRef, 'access', _111 => _111.current, 'optionalAccess', _112 => _112.zoom, 'access', _113 => _113.zoomIn, 'call', _114 => _114()]);
|
|
1317
1260
|
updateZoomDisplay();
|
|
1318
1261
|
},
|
|
1319
1262
|
zoomOut: () => {
|
|
1320
|
-
_optionalChain([pdfViewerRef, 'access',
|
|
1263
|
+
_optionalChain([pdfViewerRef, 'access', _115 => _115.current, 'optionalAccess', _116 => _116.zoom, 'access', _117 => _117.zoomOut, 'call', _118 => _118()]);
|
|
1321
1264
|
updateZoomDisplay();
|
|
1322
1265
|
},
|
|
1323
1266
|
setZoom: (level) => {
|
|
1324
|
-
_optionalChain([pdfViewerRef, 'access',
|
|
1267
|
+
_optionalChain([pdfViewerRef, 'access', _119 => _119.current, 'optionalAccess', _120 => _120.zoom, 'access', _121 => _121.setZoom, 'call', _122 => _122(level)]);
|
|
1325
1268
|
updateZoomDisplay();
|
|
1326
1269
|
},
|
|
1327
1270
|
resetZoom: () => {
|
|
1328
|
-
_optionalChain([pdfViewerRef, 'access',
|
|
1271
|
+
_optionalChain([pdfViewerRef, 'access', _123 => _123.current, 'optionalAccess', _124 => _124.zoom, 'access', _125 => _125.resetZoom, 'call', _126 => _126()]);
|
|
1329
1272
|
updateZoomDisplay();
|
|
1330
1273
|
},
|
|
1331
1274
|
getZoom: () => {
|
|
1332
|
-
const zoom2 = _optionalChain([pdfViewerRef, 'access',
|
|
1275
|
+
const zoom2 = _optionalChain([pdfViewerRef, 'access', _127 => _127.current, 'optionalAccess', _128 => _128.zoom, 'access', _129 => _129.getZoom, 'call', _130 => _130()]);
|
|
1333
1276
|
return typeof zoom2 === "number" ? zoom2 : 1;
|
|
1334
1277
|
},
|
|
1335
1278
|
goToPage: (page) => {
|
|
1336
|
-
_optionalChain([pdfViewerRef, 'access',
|
|
1279
|
+
_optionalChain([pdfViewerRef, 'access', _131 => _131.current, 'optionalAccess', _132 => _132.navigation, 'access', _133 => _133.goToPage, 'call', _134 => _134(page)]);
|
|
1337
1280
|
setCurrentPage(page);
|
|
1338
1281
|
},
|
|
1339
|
-
getCurrentPage: () => _optionalChain([pdfViewerRef, 'access',
|
|
1340
|
-
getTotalPages: () => _optionalChain([pdfViewerRef, 'access',
|
|
1282
|
+
getCurrentPage: () => _optionalChain([pdfViewerRef, 'access', _135 => _135.current, 'optionalAccess', _136 => _136.navigation, 'access', _137 => _137.getCurrentPage, 'call', _138 => _138()]) || 1,
|
|
1283
|
+
getTotalPages: () => _optionalChain([pdfViewerRef, 'access', _139 => _139.current, 'optionalAccess', _140 => _140.navigation, 'access', _141 => _141.getTotalPages, 'call', _142 => _142()]) || 0,
|
|
1341
1284
|
nextPage: () => {
|
|
1342
|
-
_optionalChain([pdfViewerRef, 'access',
|
|
1285
|
+
_optionalChain([pdfViewerRef, 'access', _143 => _143.current, 'optionalAccess', _144 => _144.navigation, 'access', _145 => _145.nextPage, 'call', _146 => _146()]);
|
|
1343
1286
|
updatePageDisplay();
|
|
1344
1287
|
},
|
|
1345
1288
|
previousPage: () => {
|
|
1346
|
-
_optionalChain([pdfViewerRef, 'access',
|
|
1289
|
+
_optionalChain([pdfViewerRef, 'access', _147 => _147.current, 'optionalAccess', _148 => _148.navigation, 'access', _149 => _149.previousPage, 'call', _150 => _150()]);
|
|
1347
1290
|
updatePageDisplay();
|
|
1348
1291
|
},
|
|
1349
1292
|
goToFirstPage: () => {
|
|
1350
|
-
_optionalChain([pdfViewerRef, 'access',
|
|
1293
|
+
_optionalChain([pdfViewerRef, 'access', _151 => _151.current, 'optionalAccess', _152 => _152.navigation, 'access', _153 => _153.goToFirstPage, 'call', _154 => _154()]);
|
|
1351
1294
|
updatePageDisplay();
|
|
1352
1295
|
},
|
|
1353
1296
|
goToLastPage: () => {
|
|
1354
|
-
_optionalChain([pdfViewerRef, 'access',
|
|
1297
|
+
_optionalChain([pdfViewerRef, 'access', _155 => _155.current, 'optionalAccess', _156 => _156.navigation, 'access', _157 => _157.goToLastPage, 'call', _158 => _158()]);
|
|
1355
1298
|
updatePageDisplay();
|
|
1356
1299
|
},
|
|
1357
1300
|
searchText: async (keyword) => {
|
|
1358
1301
|
setIsSearching(true);
|
|
1359
|
-
const results = await _optionalChain([pdfViewerRef, 'access',
|
|
1302
|
+
const results = await _optionalChain([pdfViewerRef, 'access', _159 => _159.current, 'optionalAccess', _160 => _160.search, 'access', _161 => _161.searchText, 'call', _162 => _162(keyword)]);
|
|
1360
1303
|
setIsSearching(false);
|
|
1361
1304
|
setSearchQuery(keyword);
|
|
1362
1305
|
return results;
|
|
1363
1306
|
},
|
|
1364
1307
|
nextResult: () => {
|
|
1365
|
-
const index = _optionalChain([pdfViewerRef, 'access',
|
|
1308
|
+
const index = _optionalChain([pdfViewerRef, 'access', _163 => _163.current, 'optionalAccess', _164 => _164.search, 'access', _165 => _165.nextResult, 'call', _166 => _166()]) || -1;
|
|
1366
1309
|
return index;
|
|
1367
1310
|
},
|
|
1368
1311
|
previousResult: () => {
|
|
1369
|
-
const index = _optionalChain([pdfViewerRef, 'access',
|
|
1312
|
+
const index = _optionalChain([pdfViewerRef, 'access', _167 => _167.current, 'optionalAccess', _168 => _168.search, 'access', _169 => _169.previousResult, 'call', _170 => _170()]) || -1;
|
|
1370
1313
|
return index;
|
|
1371
1314
|
},
|
|
1372
|
-
goToResult: (index) => _optionalChain([pdfViewerRef, 'access',
|
|
1315
|
+
goToResult: (index) => _optionalChain([pdfViewerRef, 'access', _171 => _171.current, 'optionalAccess', _172 => _172.search, 'access', _173 => _173.goToResult, 'call', _174 => _174(index)]) || -1,
|
|
1373
1316
|
stopSearch: () => {
|
|
1374
|
-
_optionalChain([pdfViewerRef, 'access',
|
|
1317
|
+
_optionalChain([pdfViewerRef, 'access', _175 => _175.current, 'optionalAccess', _176 => _176.search, 'access', _177 => _177.stopSearch, 'call', _178 => _178()]);
|
|
1375
1318
|
setSearchQuery("");
|
|
1376
1319
|
},
|
|
1377
|
-
getSearchState: () => _optionalChain([pdfViewerRef, 'access',
|
|
1378
|
-
getSelectedText: () => _optionalChain([pdfViewerRef, 'access',
|
|
1379
|
-
clearSelection: () => _optionalChain([pdfViewerRef, 'access',
|
|
1320
|
+
getSearchState: () => _optionalChain([pdfViewerRef, 'access', _179 => _179.current, 'optionalAccess', _180 => _180.search, 'access', _181 => _181.getSearchState, 'call', _182 => _182()]) || null,
|
|
1321
|
+
getSelectedText: () => _optionalChain([pdfViewerRef, 'access', _183 => _183.current, 'optionalAccess', _184 => _184.selection, 'access', _185 => _185.getSelectedText, 'call', _186 => _186()]) || "",
|
|
1322
|
+
clearSelection: () => _optionalChain([pdfViewerRef, 'access', _187 => _187.current, 'optionalAccess', _188 => _188.selection, 'access', _189 => _189.clearSelection, 'call', _190 => _190()])
|
|
1380
1323
|
}), []);
|
|
1381
1324
|
const updatePageDisplay = () => {
|
|
1382
1325
|
requestAnimationFrame(() => {
|
|
1383
|
-
const current = _optionalChain([pdfViewerRef, 'access',
|
|
1326
|
+
const current = _optionalChain([pdfViewerRef, 'access', _191 => _191.current, 'optionalAccess', _192 => _192.navigation, 'access', _193 => _193.getCurrentPage, 'call', _194 => _194()]) || 1;
|
|
1384
1327
|
setCurrentPage(current);
|
|
1385
1328
|
});
|
|
1386
1329
|
};
|
|
1387
1330
|
const updateZoomDisplay = () => {
|
|
1388
1331
|
requestAnimationFrame(() => {
|
|
1389
|
-
const zoomValue = _optionalChain([pdfViewerRef, 'access',
|
|
1332
|
+
const zoomValue = _optionalChain([pdfViewerRef, 'access', _195 => _195.current, 'optionalAccess', _196 => _196.zoom, 'access', _197 => _197.getZoom, 'call', _198 => _198()]);
|
|
1390
1333
|
if (typeof zoomValue === "number") {
|
|
1391
1334
|
setZoom(Math.round(zoomValue * 100));
|
|
1392
1335
|
}
|
|
1393
1336
|
});
|
|
1394
1337
|
};
|
|
1395
1338
|
const handleSearch = async () => {
|
|
1396
|
-
if (searchQuery.trim())
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
textContent = result;
|
|
1406
|
-
contextContent = result;
|
|
1407
|
-
} else if (result.text) {
|
|
1408
|
-
textContent = String(result.text);
|
|
1409
|
-
contextContent = result.context ? String(result.context) : String(result.text);
|
|
1410
|
-
} else if (result.str) {
|
|
1411
|
-
textContent = String(result.str);
|
|
1412
|
-
contextContent = String(result.str);
|
|
1413
|
-
} else if (result.match) {
|
|
1414
|
-
textContent = String(result.match);
|
|
1415
|
-
contextContent = String(result.match);
|
|
1416
|
-
} else {
|
|
1417
|
-
textContent = JSON.stringify(result);
|
|
1418
|
-
contextContent = textContent;
|
|
1419
|
-
}
|
|
1420
|
-
return {
|
|
1421
|
-
pageNumber: (_nullishCoalesce(_nullishCoalesce(result.pageIndex, () => ( result.pageNumber)), () => ( 0))) + 1,
|
|
1422
|
-
text: textContent,
|
|
1423
|
-
context: contextContent,
|
|
1424
|
-
index
|
|
1425
|
-
};
|
|
1426
|
-
});
|
|
1427
|
-
setSearchResults(formattedResults);
|
|
1428
|
-
setTotalSearchResults(formattedResults.length);
|
|
1429
|
-
setCurrentSearchResultIndex(0);
|
|
1430
|
-
} else {
|
|
1431
|
-
setSearchResults([]);
|
|
1432
|
-
setTotalSearchResults(0);
|
|
1433
|
-
setCurrentSearchResultIndex(0);
|
|
1434
|
-
}
|
|
1339
|
+
if (!searchQuery.trim()) return;
|
|
1340
|
+
setIsSearching(true);
|
|
1341
|
+
const results = await _optionalChain([pdfViewerRef, 'access', _199 => _199.current, 'optionalAccess', _200 => _200.search, 'access', _201 => _201.searchText, 'call', _202 => _202(searchQuery)]);
|
|
1342
|
+
setIsSearching(false);
|
|
1343
|
+
if (_optionalChain([results, 'optionalAccess', _203 => _203.results]) && Array.isArray(results.results) && results.results.length > 0) {
|
|
1344
|
+
const formattedResults = formatSearchResults(results.results);
|
|
1345
|
+
updateSearchState(formattedResults);
|
|
1346
|
+
} else {
|
|
1347
|
+
clearSearchResults();
|
|
1435
1348
|
}
|
|
1436
1349
|
};
|
|
1437
1350
|
const handleSearchKeyPress = (e) => {
|
|
@@ -1441,80 +1354,106 @@ var PDFViewerContent = _react.forwardRef.call(void 0, (props, ref) => {
|
|
|
1441
1354
|
};
|
|
1442
1355
|
const handleSidebarSearch = async (keyword, pageNumbers) => {
|
|
1443
1356
|
setSearchQuery(keyword);
|
|
1444
|
-
if (keyword.trim()) {
|
|
1445
|
-
|
|
1446
|
-
|
|
1357
|
+
if (!keyword.trim()) {
|
|
1358
|
+
setSearchResults([]);
|
|
1359
|
+
setTotalSearchResults(0);
|
|
1360
|
+
setCurrentSearchResultIndex(0);
|
|
1361
|
+
_optionalChain([pdfViewerRef, 'access', _204 => _204.current, 'optionalAccess', _205 => _205.search, 'access', _206 => _206.stopSearch, 'call', _207 => _207()]);
|
|
1362
|
+
return;
|
|
1363
|
+
}
|
|
1364
|
+
if (!_optionalChain([pdfViewerRef, 'access', _208 => _208.current, 'optionalAccess', _209 => _209.search, 'optionalAccess', _210 => _210.searchText])) {
|
|
1365
|
+
console.warn("Search functionality not yet available");
|
|
1366
|
+
return;
|
|
1367
|
+
}
|
|
1368
|
+
setIsSearching(true);
|
|
1369
|
+
try {
|
|
1370
|
+
const results = await pdfViewerRef.current.search.searchText(keyword);
|
|
1371
|
+
console.log("Search completed:", results);
|
|
1447
1372
|
setIsSearching(false);
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
const before = result.context.before || "";
|
|
1454
|
-
const match = result.context.match || "";
|
|
1455
|
-
const after = result.context.after || "";
|
|
1456
|
-
textContent = match;
|
|
1457
|
-
contextContent = `${before}${match}${after}`;
|
|
1458
|
-
} else if (typeof result === "string") {
|
|
1459
|
-
textContent = result;
|
|
1460
|
-
contextContent = result;
|
|
1461
|
-
} else {
|
|
1462
|
-
textContent = String(result.match || result.text || "");
|
|
1463
|
-
contextContent = textContent;
|
|
1464
|
-
}
|
|
1465
|
-
return {
|
|
1466
|
-
pageNumber: (_nullishCoalesce(_nullishCoalesce(result.pageIndex, () => ( result.pageNumber)), () => ( 0))) + 1,
|
|
1467
|
-
text: textContent,
|
|
1468
|
-
context: contextContent,
|
|
1469
|
-
index
|
|
1470
|
-
};
|
|
1471
|
-
});
|
|
1472
|
-
setSearchResults(formattedResults);
|
|
1473
|
-
setTotalSearchResults(formattedResults.length);
|
|
1474
|
-
setCurrentSearchResultIndex(0);
|
|
1475
|
-
if (formattedResults.length > 0) {
|
|
1476
|
-
const firstPageNumber = formattedResults[0].pageNumber;
|
|
1477
|
-
_optionalChain([pdfViewerRef, 'access', _201 => _201.current, 'optionalAccess', _202 => _202.navigation, 'access', _203 => _203.goToPage, 'call', _204 => _204(firstPageNumber)]);
|
|
1478
|
-
setCurrentPage(firstPageNumber);
|
|
1479
|
-
}
|
|
1373
|
+
const hasValidResults = _optionalChain([results, 'optionalAccess', _211 => _211.results]) && Array.isArray(results.results) && results.results.length > 0;
|
|
1374
|
+
if (hasValidResults) {
|
|
1375
|
+
const formattedResults = formatSearchResults(results.results);
|
|
1376
|
+
updateSearchState(formattedResults);
|
|
1377
|
+
navigateToFirstResult(formattedResults);
|
|
1480
1378
|
} else if (pageNumbers && pageNumbers.length > 0) {
|
|
1481
|
-
const fallbackResults = pageNumbers
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
context: `"${keyword}" found on this page ${pageNum}`,
|
|
1485
|
-
index
|
|
1486
|
-
}));
|
|
1487
|
-
setSearchResults(fallbackResults);
|
|
1488
|
-
setTotalSearchResults(fallbackResults.length);
|
|
1489
|
-
setCurrentSearchResultIndex(0);
|
|
1490
|
-
_optionalChain([pdfViewerRef, 'access', _205 => _205.current, 'optionalAccess', _206 => _206.navigation, 'access', _207 => _207.goToPage, 'call', _208 => _208(pageNumbers[0])]);
|
|
1491
|
-
setCurrentPage(pageNumbers[0]);
|
|
1379
|
+
const fallbackResults = createFallbackResults(pageNumbers, keyword);
|
|
1380
|
+
updateSearchState(fallbackResults);
|
|
1381
|
+
navigateToPage(pageNumbers[0]);
|
|
1492
1382
|
} else {
|
|
1493
|
-
|
|
1494
|
-
setTotalSearchResults(0);
|
|
1495
|
-
setCurrentSearchResultIndex(0);
|
|
1383
|
+
clearSearchResults();
|
|
1496
1384
|
}
|
|
1497
|
-
}
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
setCurrentSearchResultIndex(0);
|
|
1385
|
+
} catch (error2) {
|
|
1386
|
+
console.error("Search failed:", error2);
|
|
1387
|
+
setIsSearching(false);
|
|
1388
|
+
clearSearchResults();
|
|
1502
1389
|
}
|
|
1503
1390
|
};
|
|
1391
|
+
const formatSearchResults = (results) => {
|
|
1392
|
+
return results.map((result, index) => {
|
|
1393
|
+
let textContent = "";
|
|
1394
|
+
let contextContent = "";
|
|
1395
|
+
if (result.context && typeof result.context === "object") {
|
|
1396
|
+
const { before = "", match = "", after = "" } = result.context;
|
|
1397
|
+
textContent = match;
|
|
1398
|
+
contextContent = `${before}${match}${after}`;
|
|
1399
|
+
} else if (typeof result === "string") {
|
|
1400
|
+
textContent = result;
|
|
1401
|
+
contextContent = result;
|
|
1402
|
+
} else {
|
|
1403
|
+
textContent = String(result.match || result.text || "");
|
|
1404
|
+
contextContent = textContent;
|
|
1405
|
+
}
|
|
1406
|
+
return {
|
|
1407
|
+
pageNumber: (_nullishCoalesce(_nullishCoalesce(result.pageIndex, () => ( result.pageNumber)), () => ( 0))) + 1,
|
|
1408
|
+
text: textContent,
|
|
1409
|
+
context: contextContent,
|
|
1410
|
+
index
|
|
1411
|
+
};
|
|
1412
|
+
});
|
|
1413
|
+
};
|
|
1414
|
+
const createFallbackResults = (pageNumbers, keyword) => {
|
|
1415
|
+
return pageNumbers.map((pageNum, index) => ({
|
|
1416
|
+
pageNumber: pageNum,
|
|
1417
|
+
text: keyword,
|
|
1418
|
+
context: `"${keyword}" found on this page ${pageNum}`,
|
|
1419
|
+
index
|
|
1420
|
+
}));
|
|
1421
|
+
};
|
|
1422
|
+
const updateSearchState = (results) => {
|
|
1423
|
+
setSearchResults(results);
|
|
1424
|
+
setTotalSearchResults(results.length);
|
|
1425
|
+
setCurrentSearchResultIndex(0);
|
|
1426
|
+
};
|
|
1427
|
+
const clearSearchResults = () => {
|
|
1428
|
+
setSearchResults([]);
|
|
1429
|
+
setTotalSearchResults(0);
|
|
1430
|
+
setCurrentSearchResultIndex(0);
|
|
1431
|
+
};
|
|
1432
|
+
const navigateToFirstResult = (results) => {
|
|
1433
|
+
if (results.length > 0) {
|
|
1434
|
+
navigateToPage(results[0].pageNumber);
|
|
1435
|
+
}
|
|
1436
|
+
};
|
|
1437
|
+
const navigateToPage = (pageNumber) => {
|
|
1438
|
+
requestAnimationFrame(() => {
|
|
1439
|
+
_optionalChain([pdfViewerRef, 'access', _212 => _212.current, 'optionalAccess', _213 => _213.navigation, 'access', _214 => _214.goToPage, 'call', _215 => _215(pageNumber)]);
|
|
1440
|
+
setCurrentPage(pageNumber);
|
|
1441
|
+
});
|
|
1442
|
+
};
|
|
1504
1443
|
const handleSearchResultClick = (pageNumber, resultIndex) => {
|
|
1505
|
-
_optionalChain([pdfViewerRef, 'access',
|
|
1444
|
+
_optionalChain([pdfViewerRef, 'access', _216 => _216.current, 'optionalAccess', _217 => _217.navigation, 'access', _218 => _218.goToPage, 'call', _219 => _219(pageNumber)]);
|
|
1506
1445
|
setCurrentSearchResultIndex(resultIndex);
|
|
1507
1446
|
setCurrentPage(pageNumber);
|
|
1508
|
-
_optionalChain([pdfViewerRef, 'access',
|
|
1447
|
+
_optionalChain([pdfViewerRef, 'access', _220 => _220.current, 'optionalAccess', _221 => _221.search, 'access', _222 => _222.goToResult, 'call', _223 => _223(resultIndex)]);
|
|
1509
1448
|
};
|
|
1510
1449
|
const handleNextSearchResult = () => {
|
|
1511
1450
|
if (currentSearchResultIndex < totalSearchResults - 1) {
|
|
1512
1451
|
const nextIndex = currentSearchResultIndex + 1;
|
|
1513
1452
|
setCurrentSearchResultIndex(nextIndex);
|
|
1514
|
-
_optionalChain([pdfViewerRef, 'access',
|
|
1453
|
+
_optionalChain([pdfViewerRef, 'access', _224 => _224.current, 'optionalAccess', _225 => _225.search, 'access', _226 => _226.nextResult, 'call', _227 => _227()]);
|
|
1515
1454
|
if (searchResults[nextIndex]) {
|
|
1516
1455
|
const pageNumber = searchResults[nextIndex].pageNumber;
|
|
1517
|
-
_optionalChain([pdfViewerRef, 'access',
|
|
1456
|
+
_optionalChain([pdfViewerRef, 'access', _228 => _228.current, 'optionalAccess', _229 => _229.navigation, 'access', _230 => _230.goToPage, 'call', _231 => _231(pageNumber)]);
|
|
1518
1457
|
setCurrentPage(pageNumber);
|
|
1519
1458
|
}
|
|
1520
1459
|
}
|
|
@@ -1523,10 +1462,10 @@ var PDFViewerContent = _react.forwardRef.call(void 0, (props, ref) => {
|
|
|
1523
1462
|
if (currentSearchResultIndex > 0) {
|
|
1524
1463
|
const prevIndex = currentSearchResultIndex - 1;
|
|
1525
1464
|
setCurrentSearchResultIndex(prevIndex);
|
|
1526
|
-
_optionalChain([pdfViewerRef, 'access',
|
|
1465
|
+
_optionalChain([pdfViewerRef, 'access', _232 => _232.current, 'optionalAccess', _233 => _233.search, 'access', _234 => _234.previousResult, 'call', _235 => _235()]);
|
|
1527
1466
|
if (searchResults[prevIndex]) {
|
|
1528
1467
|
const pageNumber = searchResults[prevIndex].pageNumber;
|
|
1529
|
-
_optionalChain([pdfViewerRef, 'access',
|
|
1468
|
+
_optionalChain([pdfViewerRef, 'access', _236 => _236.current, 'optionalAccess', _237 => _237.navigation, 'access', _238 => _238.goToPage, 'call', _239 => _239(pageNumber)]);
|
|
1530
1469
|
setCurrentPage(pageNumber);
|
|
1531
1470
|
}
|
|
1532
1471
|
}
|
|
@@ -1557,12 +1496,12 @@ var PDFViewerContent = _react.forwardRef.call(void 0, (props, ref) => {
|
|
|
1557
1496
|
}
|
|
1558
1497
|
setPdfBuffer(arrayBuffer);
|
|
1559
1498
|
setState("ready");
|
|
1560
|
-
_optionalChain([onLoad, 'optionalCall',
|
|
1499
|
+
_optionalChain([onLoad, 'optionalCall', _240 => _240()]);
|
|
1561
1500
|
} catch (err) {
|
|
1562
1501
|
const errorMessage = err.message || "Failed to load PDF";
|
|
1563
1502
|
setState("error");
|
|
1564
1503
|
setError(errorMessage);
|
|
1565
|
-
_optionalChain([onError, 'optionalCall',
|
|
1504
|
+
_optionalChain([onError, 'optionalCall', _241 => _241(err)]);
|
|
1566
1505
|
}
|
|
1567
1506
|
};
|
|
1568
1507
|
loadPDF();
|
|
@@ -1643,8 +1582,8 @@ var PDFViewerContent = _react.forwardRef.call(void 0, (props, ref) => {
|
|
|
1643
1582
|
height: "100%"
|
|
1644
1583
|
}, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { children: "Preparing PDF..." }) });
|
|
1645
1584
|
}
|
|
1646
|
-
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "pdf-viewer-container", children: [
|
|
1647
|
-
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "style", { children: toolbarStyles }),
|
|
1585
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { ref: containerRef, className: "pdf-viewer-container", children: [
|
|
1586
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "style", { children: _chunkA2MSWOEMjs.toolbarStyles }),
|
|
1648
1587
|
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1649
1588
|
PDFHeader,
|
|
1650
1589
|
{
|
|
@@ -1663,10 +1602,14 @@ var PDFViewerContent = _react.forwardRef.call(void 0, (props, ref) => {
|
|
|
1663
1602
|
showPageCount,
|
|
1664
1603
|
showZoomControls,
|
|
1665
1604
|
showSearch,
|
|
1666
|
-
showMetadata,
|
|
1667
|
-
showProperties,
|
|
1668
|
-
showDownload,
|
|
1669
|
-
showPrint,
|
|
1605
|
+
showMetadata: !toolbar.isHidden("metadata"),
|
|
1606
|
+
showProperties: !toolbar.isHidden("properties"),
|
|
1607
|
+
showDownload: !toolbar.isHidden("download"),
|
|
1608
|
+
showPrint: !toolbar.isHidden("print"),
|
|
1609
|
+
disabledMetadata: toolbar.isDisabled("metadata"),
|
|
1610
|
+
disabledProperties: toolbar.isDisabled("properties"),
|
|
1611
|
+
disabledDownload: toolbar.isDisabled("download"),
|
|
1612
|
+
disabledPrint: toolbar.isDisabled("print"),
|
|
1670
1613
|
onFirstPage: toolbarHandlers.handleFirstPage,
|
|
1671
1614
|
onPreviousPage: toolbarHandlers.handlePreviousPage,
|
|
1672
1615
|
onNextPage: toolbarHandlers.handleNextPage,
|
|
@@ -1678,10 +1621,11 @@ var PDFViewerContent = _react.forwardRef.call(void 0, (props, ref) => {
|
|
|
1678
1621
|
onFitToWidth: toolbarHandlers.handleFitToWidth,
|
|
1679
1622
|
onFitToPage: toolbarHandlers.handleFitToPage,
|
|
1680
1623
|
onToggleSidebar: toolbarHandlers.toggleSidebar,
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1624
|
+
onToggleFullScreen: toolbarHandlers.handleToggleFullScreen,
|
|
1625
|
+
onDownloadClick: toolbar.getHandler("download", onDownloadClick),
|
|
1626
|
+
onPrintClick: toolbar.getHandler("print", onPrintClick),
|
|
1627
|
+
onMetadataClick: toolbar.getHandler("metadata", onMetadataClick),
|
|
1628
|
+
onPropertiesClick: toolbar.getHandler("properties", onPropertiesClick)
|
|
1685
1629
|
}
|
|
1686
1630
|
),
|
|
1687
1631
|
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "pdf-viewer-main", children: [
|
|
@@ -1697,7 +1641,7 @@ var PDFViewerContent = _react.forwardRef.call(void 0, (props, ref) => {
|
|
|
1697
1641
|
SearchSidebar,
|
|
1698
1642
|
{
|
|
1699
1643
|
isOpen: isSidebarOpen,
|
|
1700
|
-
onClose:
|
|
1644
|
+
onClose: handleSidebarClose,
|
|
1701
1645
|
onSearch: handleSidebarSearch,
|
|
1702
1646
|
onSearchResultClick: handleSearchResultClick,
|
|
1703
1647
|
onNextResult: handleNextSearchResult,
|
|
@@ -1731,4 +1675,4 @@ PDFViewer.displayName = "PDFViewer";
|
|
|
1731
1675
|
|
|
1732
1676
|
|
|
1733
1677
|
exports.PDFViewer = PDFViewer;
|
|
1734
|
-
//# sourceMappingURL=chunk-
|
|
1678
|
+
//# sourceMappingURL=chunk-HQJPMN53.js.map
|