@cannyminds/dms-file-viewers 0.13.0 → 0.15.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-42VHR3EK.mjs +714 -0
- package/dist/chunk-42VHR3EK.mjs.map +1 -0
- package/dist/{chunk-J3JKVSAM.js → chunk-AYVTSFZA.js} +2 -1
- package/dist/chunk-AYVTSFZA.js.map +1 -0
- package/dist/chunk-C4L2R2QY.mjs +277 -0
- package/dist/chunk-C4L2R2QY.mjs.map +1 -0
- package/dist/chunk-DBXSX2B6.js +277 -0
- package/dist/chunk-DBXSX2B6.js.map +1 -0
- package/dist/chunk-DPSRGULQ.mjs +247 -0
- package/dist/chunk-DPSRGULQ.mjs.map +1 -0
- package/dist/chunk-FK6RYOAZ.mjs +297 -0
- package/dist/chunk-FK6RYOAZ.mjs.map +1 -0
- package/dist/chunk-FZVXQGA7.mjs +466 -0
- package/dist/chunk-FZVXQGA7.mjs.map +1 -0
- package/dist/chunk-GSRAK2YV.js +266 -0
- package/dist/chunk-GSRAK2YV.js.map +1 -0
- package/dist/chunk-HYRQBGAX.js +466 -0
- package/dist/chunk-HYRQBGAX.js.map +1 -0
- package/dist/chunk-RKDOWWQD.js +247 -0
- package/dist/chunk-RKDOWWQD.js.map +1 -0
- package/dist/chunk-TMAHQICY.mjs +1842 -0
- package/dist/chunk-TMAHQICY.mjs.map +1 -0
- package/dist/chunk-VBJVOB45.mjs +266 -0
- package/dist/chunk-VBJVOB45.mjs.map +1 -0
- package/dist/{chunk-DFBVN4MO.mjs → chunk-WR5SJ3LM.mjs} +2 -1
- package/dist/chunk-WR5SJ3LM.mjs.map +1 -0
- package/dist/chunk-XSXOX4MV.js +297 -0
- package/dist/chunk-XSXOX4MV.js.map +1 -0
- package/dist/chunk-XWWMHRVU.js +1842 -0
- package/dist/chunk-XWWMHRVU.js.map +1 -0
- package/dist/chunk-YU535XRJ.js +714 -0
- package/dist/chunk-YU535XRJ.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 +3 -3
- package/dist/components/viewers/AudioViewer.mjs +2 -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 +3 -3
- package/dist/components/viewers/DefaultViewer.mjs +2 -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 +3 -3
- package/dist/components/viewers/ImageViewer.mjs +2 -2
- package/dist/components/viewers/PDFViewer.d.mts +1 -1
- package/dist/components/viewers/PDFViewer.d.ts +1 -1
- package/dist/components/viewers/PDFViewer.js +3 -3
- package/dist/components/viewers/PDFViewer.mjs +2 -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 +3 -3
- package/dist/components/viewers/TIFFViewer.mjs +2 -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 +3 -3
- package/dist/components/viewers/TextViewer.mjs +2 -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 +3 -3
- package/dist/components/viewers/VideoViewer.mjs +2 -2
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +9 -9
- package/dist/index.mjs +8 -8
- package/dist/{types-DNrkDJdK.d.mts → types-DxRCbIFP.d.mts} +4 -2
- package/dist/{types-DNrkDJdK.d.ts → types-DxRCbIFP.d.ts} +4 -2
- package/package.json +1 -1
- package/dist/chunk-7QRYWFCO.js +0 -639
- package/dist/chunk-7QRYWFCO.js.map +0 -1
- package/dist/chunk-7R2KG3PE.mjs +0 -210
- package/dist/chunk-7R2KG3PE.mjs.map +0 -1
- package/dist/chunk-CFYOPDCG.mjs +0 -235
- package/dist/chunk-CFYOPDCG.mjs.map +0 -1
- package/dist/chunk-D74R4IKW.mjs +0 -341
- package/dist/chunk-D74R4IKW.mjs.map +0 -1
- package/dist/chunk-DFBVN4MO.mjs.map +0 -1
- package/dist/chunk-EXZCEYLI.js +0 -247
- package/dist/chunk-EXZCEYLI.js.map +0 -1
- package/dist/chunk-J3JKVSAM.js.map +0 -1
- package/dist/chunk-NXVIRFGL.mjs +0 -247
- package/dist/chunk-NXVIRFGL.mjs.map +0 -1
- package/dist/chunk-P2VNW6OE.mjs +0 -180
- package/dist/chunk-P2VNW6OE.mjs.map +0 -1
- package/dist/chunk-P5FH7LK7.mjs +0 -639
- package/dist/chunk-P5FH7LK7.mjs.map +0 -1
- package/dist/chunk-PZJSY6OF.mjs +0 -1736
- package/dist/chunk-PZJSY6OF.mjs.map +0 -1
- package/dist/chunk-RVHIXSUP.js +0 -235
- package/dist/chunk-RVHIXSUP.js.map +0 -1
- package/dist/chunk-TGVFAAIP.js +0 -341
- package/dist/chunk-TGVFAAIP.js.map +0 -1
- package/dist/chunk-VOLQW3NF.js +0 -1736
- package/dist/chunk-VOLQW3NF.js.map +0 -1
- package/dist/chunk-VSGX22FQ.js +0 -180
- package/dist/chunk-VSGX22FQ.js.map +0 -1
- package/dist/chunk-WCAXWJE7.js +0 -210
- package/dist/chunk-WCAXWJE7.js.map +0 -1
|
@@ -0,0 +1,1842 @@
|
|
|
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
|
+
|
|
3
|
+
|
|
4
|
+
var _chunkA2MSWOEMjs = require('./chunk-A2MSWOEM.js');
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
var _chunkYEPEMLM3js = require('./chunk-YEPEMLM3.js');
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
var _chunkAYVTSFZAjs = require('./chunk-AYVTSFZA.js');
|
|
12
|
+
|
|
13
|
+
// src/components/viewers/PDFViewer.tsx
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
var _react = require('react'); var _react2 = _interopRequireDefault(_react);
|
|
23
|
+
|
|
24
|
+
// src/components/viewers/pdf/StablePDFViewer.tsx
|
|
25
|
+
|
|
26
|
+
var _pdfviewer = require('@cannyminds/pdf-viewer');
|
|
27
|
+
var _jsxruntime = require('react/jsx-runtime');
|
|
28
|
+
var HeadlessPDFViewer = _pdfviewer.PDFViewer;
|
|
29
|
+
var StablePDFViewer = _react2.default.memo(({
|
|
30
|
+
pdfBuffer,
|
|
31
|
+
onPasswordRequest,
|
|
32
|
+
pdfViewerRef
|
|
33
|
+
}) => {
|
|
34
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
35
|
+
HeadlessPDFViewer,
|
|
36
|
+
{
|
|
37
|
+
ref: pdfViewerRef,
|
|
38
|
+
pdfBuffer,
|
|
39
|
+
onPasswordRequest
|
|
40
|
+
}
|
|
41
|
+
);
|
|
42
|
+
});
|
|
43
|
+
StablePDFViewer.displayName = "StablePDFViewer";
|
|
44
|
+
|
|
45
|
+
// src/components/viewers/pdf/PDFToolbar.tsx
|
|
46
|
+
|
|
47
|
+
var _FirstPage = require('@mui/icons-material/FirstPage'); var _FirstPage2 = _interopRequireDefault(_FirstPage);
|
|
48
|
+
var _LastPage = require('@mui/icons-material/LastPage'); var _LastPage2 = _interopRequireDefault(_LastPage);
|
|
49
|
+
var _ChevronLeft = require('@mui/icons-material/ChevronLeft'); var _ChevronLeft2 = _interopRequireDefault(_ChevronLeft);
|
|
50
|
+
var _ChevronRight = require('@mui/icons-material/ChevronRight'); var _ChevronRight2 = _interopRequireDefault(_ChevronRight);
|
|
51
|
+
var _ZoomIn = require('@mui/icons-material/ZoomIn'); var _ZoomIn2 = _interopRequireDefault(_ZoomIn);
|
|
52
|
+
var _ZoomOut = require('@mui/icons-material/ZoomOut'); var _ZoomOut2 = _interopRequireDefault(_ZoomOut);
|
|
53
|
+
var _FitScreen = require('@mui/icons-material/FitScreen'); var _FitScreen2 = _interopRequireDefault(_FitScreen);
|
|
54
|
+
var _AspectRatio = require('@mui/icons-material/AspectRatio'); var _AspectRatio2 = _interopRequireDefault(_AspectRatio);
|
|
55
|
+
var _Search = require('@mui/icons-material/Search'); var _Search2 = _interopRequireDefault(_Search);
|
|
56
|
+
var _Fullscreen = require('@mui/icons-material/Fullscreen'); var _Fullscreen2 = _interopRequireDefault(_Fullscreen);
|
|
57
|
+
var _Download = require('@mui/icons-material/Download'); var _Download2 = _interopRequireDefault(_Download);
|
|
58
|
+
var _Print = require('@mui/icons-material/Print'); var _Print2 = _interopRequireDefault(_Print);
|
|
59
|
+
var _Info = require('@mui/icons-material/Info'); var _Info2 = _interopRequireDefault(_Info);
|
|
60
|
+
var _Description = require('@mui/icons-material/Description'); var _Description2 = _interopRequireDefault(_Description);
|
|
61
|
+
var _RotateLeft = require('@mui/icons-material/RotateLeft'); var _RotateLeft2 = _interopRequireDefault(_RotateLeft);
|
|
62
|
+
var _RotateRight = require('@mui/icons-material/RotateRight'); var _RotateRight2 = _interopRequireDefault(_RotateRight);
|
|
63
|
+
var _iconsmaterial = require('@mui/icons-material');
|
|
64
|
+
|
|
65
|
+
var PDFToolbar = _react2.default.memo(
|
|
66
|
+
({
|
|
67
|
+
currentPage,
|
|
68
|
+
totalPages,
|
|
69
|
+
zoom,
|
|
70
|
+
isSidebarOpen,
|
|
71
|
+
showPageNavigation,
|
|
72
|
+
showPageCount,
|
|
73
|
+
showZoomControls,
|
|
74
|
+
showSearch,
|
|
75
|
+
showMetadata,
|
|
76
|
+
showProperties,
|
|
77
|
+
showTags,
|
|
78
|
+
showDownload,
|
|
79
|
+
showPrint,
|
|
80
|
+
showRotation,
|
|
81
|
+
disabledRotateLeft,
|
|
82
|
+
disabledRotateRight,
|
|
83
|
+
disabledMetadata,
|
|
84
|
+
disabledProperties,
|
|
85
|
+
disabledTags,
|
|
86
|
+
disabledDownload,
|
|
87
|
+
disabledPrint,
|
|
88
|
+
onFirstPage,
|
|
89
|
+
onPreviousPage,
|
|
90
|
+
onNextPage,
|
|
91
|
+
onLastPage,
|
|
92
|
+
onPageInput,
|
|
93
|
+
onPageInputKeyPress,
|
|
94
|
+
onZoomIn,
|
|
95
|
+
onZoomOut,
|
|
96
|
+
onFitToWidth,
|
|
97
|
+
onFitToPage,
|
|
98
|
+
onToggleSidebar,
|
|
99
|
+
onToggleFullScreen,
|
|
100
|
+
onRotateLeft,
|
|
101
|
+
onRotateRight,
|
|
102
|
+
onDownloadClick,
|
|
103
|
+
onPrintClick,
|
|
104
|
+
onMetadataClick,
|
|
105
|
+
onPropertiesClick,
|
|
106
|
+
onTagsClick
|
|
107
|
+
}) => {
|
|
108
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "pdf-viewer-toolbar", children: [
|
|
109
|
+
showPageNavigation && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
110
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "toolbar-separator" }),
|
|
111
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "toolbar-section", children: [
|
|
112
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
113
|
+
"button",
|
|
114
|
+
{
|
|
115
|
+
className: "toolbar-button",
|
|
116
|
+
onClick: onFirstPage,
|
|
117
|
+
disabled: currentPage <= 1,
|
|
118
|
+
title: "First Page",
|
|
119
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _FirstPage2.default, { fontSize: "small" })
|
|
120
|
+
}
|
|
121
|
+
),
|
|
122
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
123
|
+
"button",
|
|
124
|
+
{
|
|
125
|
+
className: "toolbar-button",
|
|
126
|
+
onClick: onPreviousPage,
|
|
127
|
+
disabled: currentPage <= 1,
|
|
128
|
+
title: "Previous Page",
|
|
129
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _ChevronLeft2.default, { fontSize: "small" })
|
|
130
|
+
}
|
|
131
|
+
),
|
|
132
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
133
|
+
"input",
|
|
134
|
+
{
|
|
135
|
+
type: "number",
|
|
136
|
+
className: "page-input",
|
|
137
|
+
value: currentPage,
|
|
138
|
+
onChange: onPageInput,
|
|
139
|
+
onKeyPress: onPageInputKeyPress,
|
|
140
|
+
min: 1,
|
|
141
|
+
max: totalPages || void 0
|
|
142
|
+
}
|
|
143
|
+
),
|
|
144
|
+
showPageCount && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "page-info", children: [
|
|
145
|
+
"of ",
|
|
146
|
+
totalPages || "..."
|
|
147
|
+
] }),
|
|
148
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
149
|
+
"button",
|
|
150
|
+
{
|
|
151
|
+
className: "toolbar-button",
|
|
152
|
+
onClick: onNextPage,
|
|
153
|
+
disabled: currentPage >= totalPages,
|
|
154
|
+
title: "Next Page",
|
|
155
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _ChevronRight2.default, { fontSize: "small" })
|
|
156
|
+
}
|
|
157
|
+
),
|
|
158
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
159
|
+
"button",
|
|
160
|
+
{
|
|
161
|
+
className: "toolbar-button",
|
|
162
|
+
onClick: onLastPage,
|
|
163
|
+
disabled: currentPage >= totalPages,
|
|
164
|
+
title: "Last Page",
|
|
165
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _LastPage2.default, { fontSize: "small" })
|
|
166
|
+
}
|
|
167
|
+
)
|
|
168
|
+
] })
|
|
169
|
+
] }),
|
|
170
|
+
showZoomControls && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
171
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "toolbar-separator" }),
|
|
172
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "toolbar-section", children: [
|
|
173
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
174
|
+
"button",
|
|
175
|
+
{
|
|
176
|
+
className: "toolbar-button",
|
|
177
|
+
onClick: onZoomOut,
|
|
178
|
+
title: "Zoom Out",
|
|
179
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _ZoomOut2.default, { fontSize: "small" })
|
|
180
|
+
}
|
|
181
|
+
),
|
|
182
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "zoom-display", children: [
|
|
183
|
+
zoom,
|
|
184
|
+
"%"
|
|
185
|
+
] }),
|
|
186
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
187
|
+
"button",
|
|
188
|
+
{
|
|
189
|
+
className: "toolbar-button",
|
|
190
|
+
onClick: onZoomIn,
|
|
191
|
+
title: "Zoom In",
|
|
192
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _ZoomIn2.default, { fontSize: "small" })
|
|
193
|
+
}
|
|
194
|
+
),
|
|
195
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
196
|
+
"button",
|
|
197
|
+
{
|
|
198
|
+
className: "toolbar-button",
|
|
199
|
+
onClick: onFitToWidth,
|
|
200
|
+
title: "Fit to Width",
|
|
201
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _AspectRatio2.default, { fontSize: "small" })
|
|
202
|
+
}
|
|
203
|
+
),
|
|
204
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
205
|
+
"button",
|
|
206
|
+
{
|
|
207
|
+
className: "toolbar-button",
|
|
208
|
+
onClick: onFitToPage,
|
|
209
|
+
title: "Fit to Page",
|
|
210
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _FitScreen2.default, { fontSize: "small" })
|
|
211
|
+
}
|
|
212
|
+
)
|
|
213
|
+
] })
|
|
214
|
+
] }),
|
|
215
|
+
showRotation && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
216
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "toolbar-separator" }),
|
|
217
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "toolbar-section", children: [
|
|
218
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
219
|
+
"button",
|
|
220
|
+
{
|
|
221
|
+
className: "toolbar-button",
|
|
222
|
+
onClick: onRotateLeft,
|
|
223
|
+
disabled: disabledRotateLeft,
|
|
224
|
+
title: "Rotate Counterclockwise",
|
|
225
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _RotateLeft2.default, { fontSize: "small" })
|
|
226
|
+
}
|
|
227
|
+
),
|
|
228
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
229
|
+
"button",
|
|
230
|
+
{
|
|
231
|
+
className: "toolbar-button",
|
|
232
|
+
onClick: onRotateRight,
|
|
233
|
+
disabled: disabledRotateRight,
|
|
234
|
+
title: "Rotate Clockwise",
|
|
235
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _RotateRight2.default, { fontSize: "small" })
|
|
236
|
+
}
|
|
237
|
+
)
|
|
238
|
+
] })
|
|
239
|
+
] }),
|
|
240
|
+
showSearch && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
241
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "toolbar-separator" }),
|
|
242
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "toolbar-section", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
243
|
+
"button",
|
|
244
|
+
{
|
|
245
|
+
className: "toolbar-button",
|
|
246
|
+
onClick: onToggleSidebar,
|
|
247
|
+
title: "Search in PDF",
|
|
248
|
+
style: {
|
|
249
|
+
backgroundColor: isSidebarOpen ? "#e3f2fd" : "transparent",
|
|
250
|
+
color: isSidebarOpen ? "#1976d2" : "inherit"
|
|
251
|
+
},
|
|
252
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _Search2.default, { fontSize: "small" })
|
|
253
|
+
}
|
|
254
|
+
) })
|
|
255
|
+
] }),
|
|
256
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "toolbar-separator" }),
|
|
257
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "toolbar-section", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
258
|
+
"button",
|
|
259
|
+
{
|
|
260
|
+
className: "toolbar-button",
|
|
261
|
+
onClick: onToggleFullScreen,
|
|
262
|
+
title: "Fullscreen",
|
|
263
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _Fullscreen2.default, { fontSize: "small" })
|
|
264
|
+
}
|
|
265
|
+
) }),
|
|
266
|
+
(showMetadata || showProperties || showDownload || showPrint || showTags) && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
267
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "toolbar-separator" }),
|
|
268
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "toolbar-section", children: [
|
|
269
|
+
showDownload && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
270
|
+
"button",
|
|
271
|
+
{
|
|
272
|
+
className: "toolbar-button",
|
|
273
|
+
onClick: onDownloadClick,
|
|
274
|
+
disabled: disabledDownload,
|
|
275
|
+
title: "Download PDF",
|
|
276
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _Download2.default, { fontSize: "small" })
|
|
277
|
+
}
|
|
278
|
+
),
|
|
279
|
+
showPrint && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
280
|
+
"button",
|
|
281
|
+
{
|
|
282
|
+
className: "toolbar-button",
|
|
283
|
+
onClick: onPrintClick,
|
|
284
|
+
disabled: disabledPrint,
|
|
285
|
+
title: "Print PDF",
|
|
286
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _Print2.default, { fontSize: "small" })
|
|
287
|
+
}
|
|
288
|
+
),
|
|
289
|
+
showMetadata && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
290
|
+
"button",
|
|
291
|
+
{
|
|
292
|
+
className: "toolbar-button",
|
|
293
|
+
onClick: onMetadataClick,
|
|
294
|
+
disabled: disabledMetadata,
|
|
295
|
+
title: "Document Metadata",
|
|
296
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _Description2.default, { fontSize: "small" })
|
|
297
|
+
}
|
|
298
|
+
),
|
|
299
|
+
showProperties && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
300
|
+
"button",
|
|
301
|
+
{
|
|
302
|
+
className: "toolbar-button",
|
|
303
|
+
onClick: onPropertiesClick,
|
|
304
|
+
disabled: disabledProperties,
|
|
305
|
+
title: "Document Properties",
|
|
306
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _Info2.default, { fontSize: "small" })
|
|
307
|
+
}
|
|
308
|
+
),
|
|
309
|
+
showTags && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
310
|
+
"button",
|
|
311
|
+
{
|
|
312
|
+
className: "toolbar-button",
|
|
313
|
+
onClick: onTagsClick,
|
|
314
|
+
disabled: disabledTags,
|
|
315
|
+
title: "Document Tags",
|
|
316
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _iconsmaterial.LocalOffer, { fontSize: "small" })
|
|
317
|
+
}
|
|
318
|
+
)
|
|
319
|
+
] })
|
|
320
|
+
] })
|
|
321
|
+
] });
|
|
322
|
+
}
|
|
323
|
+
);
|
|
324
|
+
PDFToolbar.displayName = "PDFToolbar";
|
|
325
|
+
|
|
326
|
+
// src/components/viewers/pdf/PDFHeader.tsx
|
|
327
|
+
|
|
328
|
+
|
|
329
|
+
var PDFHeader = _react2.default.memo(({ fileName, fileExtension }) => {
|
|
330
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "pdf-viewer-header", children: [
|
|
331
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkAYVTSFZAjs.FileIcon_default, { ext: fileExtension, size: 26 }),
|
|
332
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "header-file-name", title: fileName, children: fileName })
|
|
333
|
+
] });
|
|
334
|
+
});
|
|
335
|
+
PDFHeader.displayName = "PDFHeader";
|
|
336
|
+
|
|
337
|
+
// src/components/viewers/pdf/SearchSidebar.tsx
|
|
338
|
+
|
|
339
|
+
|
|
340
|
+
|
|
341
|
+
|
|
342
|
+
|
|
343
|
+
|
|
344
|
+
|
|
345
|
+
|
|
346
|
+
|
|
347
|
+
var _material = require('@mui/material');
|
|
348
|
+
|
|
349
|
+
var _Close = require('@mui/icons-material/Close'); var _Close2 = _interopRequireDefault(_Close);
|
|
350
|
+
var _KeyboardArrowUp = require('@mui/icons-material/KeyboardArrowUp'); var _KeyboardArrowUp2 = _interopRequireDefault(_KeyboardArrowUp);
|
|
351
|
+
var _KeyboardArrowDown = require('@mui/icons-material/KeyboardArrowDown'); var _KeyboardArrowDown2 = _interopRequireDefault(_KeyboardArrowDown);
|
|
352
|
+
var _Clear = require('@mui/icons-material/Clear'); var _Clear2 = _interopRequireDefault(_Clear);
|
|
353
|
+
var _FindInPage = require('@mui/icons-material/FindInPage'); var _FindInPage2 = _interopRequireDefault(_FindInPage);
|
|
354
|
+
|
|
355
|
+
var SearchSidebar = ({
|
|
356
|
+
isOpen,
|
|
357
|
+
onClose,
|
|
358
|
+
onSearch,
|
|
359
|
+
onSearchResultClick,
|
|
360
|
+
onNextResult,
|
|
361
|
+
onPreviousResult,
|
|
362
|
+
currentResultIndex,
|
|
363
|
+
totalResults,
|
|
364
|
+
searchKeyword,
|
|
365
|
+
searchResults = [],
|
|
366
|
+
isSearching = false,
|
|
367
|
+
isSyntheticResults = false
|
|
368
|
+
}) => {
|
|
369
|
+
const [searchTerm, setSearchTerm] = _react.useState.call(void 0, searchKeyword || "");
|
|
370
|
+
const [hasSearched, setHasSearched] = _react.useState.call(void 0, false);
|
|
371
|
+
const contentRef = _react.useRef.call(void 0, null);
|
|
372
|
+
_react.useEffect.call(void 0, () => {
|
|
373
|
+
if (searchKeyword && searchKeyword !== searchTerm) {
|
|
374
|
+
setSearchTerm(searchKeyword);
|
|
375
|
+
}
|
|
376
|
+
}, [searchKeyword]);
|
|
377
|
+
_react.useLayoutEffect.call(void 0, () => {
|
|
378
|
+
const element = contentRef.current;
|
|
379
|
+
if (!element) return;
|
|
380
|
+
const handleMouseMove = (e) => {
|
|
381
|
+
const rect = element.getBoundingClientRect();
|
|
382
|
+
const distanceFromRight = rect.right - e.clientX;
|
|
383
|
+
const distanceFromBottom = rect.bottom - e.clientY;
|
|
384
|
+
if (distanceFromRight <= 15 || distanceFromBottom <= 15) {
|
|
385
|
+
element.classList.add("scrollbar-hover");
|
|
386
|
+
} else {
|
|
387
|
+
element.classList.remove("scrollbar-hover");
|
|
388
|
+
}
|
|
389
|
+
};
|
|
390
|
+
const handleMouseLeave = () => element.classList.remove("scrollbar-hover");
|
|
391
|
+
element.addEventListener("mousemove", handleMouseMove);
|
|
392
|
+
element.addEventListener("mouseleave", handleMouseLeave);
|
|
393
|
+
return () => {
|
|
394
|
+
element.removeEventListener("mousemove", handleMouseMove);
|
|
395
|
+
element.removeEventListener("mouseleave", handleMouseLeave);
|
|
396
|
+
};
|
|
397
|
+
}, []);
|
|
398
|
+
_react.useLayoutEffect.call(void 0, () => {
|
|
399
|
+
const style = document.createElement("style");
|
|
400
|
+
style.id = "search-sidebar-scrollbar";
|
|
401
|
+
style.textContent = `
|
|
402
|
+
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+Tamil:wght@400;600&family=Noto+Sans+Devanagari:wght@400;600&display=swap');
|
|
403
|
+
|
|
404
|
+
.search-sidebar-content::-webkit-scrollbar {
|
|
405
|
+
width: 12px;
|
|
406
|
+
height: 12px;
|
|
407
|
+
}
|
|
408
|
+
.search-sidebar-content::-webkit-scrollbar-track {
|
|
409
|
+
background-color: transparent;
|
|
410
|
+
}
|
|
411
|
+
.search-sidebar-content::-webkit-scrollbar-thumb {
|
|
412
|
+
background-color: rgba(128, 128, 128, 0.3);
|
|
413
|
+
border-radius: 8px;
|
|
414
|
+
border: 4px solid transparent;
|
|
415
|
+
background-clip: padding-box;
|
|
416
|
+
transition: all 0.15s ease;
|
|
417
|
+
}
|
|
418
|
+
.search-sidebar-content.scrollbar-hover::-webkit-scrollbar-thumb {
|
|
419
|
+
background-color: rgba(128, 128, 128, 0.5);
|
|
420
|
+
border: 2px solid transparent;
|
|
421
|
+
}
|
|
422
|
+
.search-sidebar-content::-webkit-scrollbar-thumb:active {
|
|
423
|
+
background-color: rgba(25, 118, 210, 0.8);
|
|
424
|
+
border: 1px solid transparent;
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
@media (prefers-color-scheme: dark) {
|
|
428
|
+
.search-sidebar-content::-webkit-scrollbar-thumb {
|
|
429
|
+
background-color: rgba(255, 255, 255, 0.2);
|
|
430
|
+
}
|
|
431
|
+
.search-sidebar-content.scrollbar-hover::-webkit-scrollbar-thumb {
|
|
432
|
+
background-color: rgba(255, 255, 255, 0.35);
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
/* Tamil font support for search results */
|
|
437
|
+
.search-result-text {
|
|
438
|
+
font-family: 'Noto Sans Tamil', 'Noto Sans Devanagari', Arial, sans-serif !important;
|
|
439
|
+
}
|
|
440
|
+
`;
|
|
441
|
+
document.head.appendChild(style);
|
|
442
|
+
return () => {
|
|
443
|
+
const el = document.getElementById("search-sidebar-scrollbar");
|
|
444
|
+
if (el) el.remove();
|
|
445
|
+
};
|
|
446
|
+
}, []);
|
|
447
|
+
_react.useLayoutEffect.call(void 0, () => {
|
|
448
|
+
setSearchTerm(searchKeyword || "");
|
|
449
|
+
if (searchKeyword || searchResults.length > 0) {
|
|
450
|
+
setHasSearched(true);
|
|
451
|
+
}
|
|
452
|
+
}, [searchKeyword, searchResults]);
|
|
453
|
+
const handleSearchSubmit = (e) => {
|
|
454
|
+
if (e) e.preventDefault();
|
|
455
|
+
if (searchTerm.trim()) {
|
|
456
|
+
setHasSearched(true);
|
|
457
|
+
onSearch(searchTerm.trim());
|
|
458
|
+
}
|
|
459
|
+
};
|
|
460
|
+
const handleSearchChange = (e) => {
|
|
461
|
+
const value = e.target.value;
|
|
462
|
+
setSearchTerm(value);
|
|
463
|
+
if (!value.trim()) {
|
|
464
|
+
setHasSearched(false);
|
|
465
|
+
onSearch("");
|
|
466
|
+
}
|
|
467
|
+
};
|
|
468
|
+
const handleClearSearch = () => {
|
|
469
|
+
setSearchTerm("");
|
|
470
|
+
setHasSearched(false);
|
|
471
|
+
onSearch("");
|
|
472
|
+
};
|
|
473
|
+
const resultsByPage = searchResults.reduce((acc, result) => {
|
|
474
|
+
if (!acc[result.pageNumber]) {
|
|
475
|
+
acc[result.pageNumber] = [];
|
|
476
|
+
}
|
|
477
|
+
acc[result.pageNumber].push(result);
|
|
478
|
+
return acc;
|
|
479
|
+
}, {});
|
|
480
|
+
const highlightText = (text, keyword) => {
|
|
481
|
+
if (!keyword) return text;
|
|
482
|
+
const textString = typeof text === "string" ? text : String(text || "");
|
|
483
|
+
if (!textString) return text;
|
|
484
|
+
try {
|
|
485
|
+
const escapedKeyword = keyword.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
486
|
+
const regex = new RegExp(`(${escapedKeyword})`, "gi");
|
|
487
|
+
const parts = textString.split(regex);
|
|
488
|
+
return parts.map(
|
|
489
|
+
(part, index) => regex.test(part) ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
490
|
+
_material.Box,
|
|
491
|
+
{
|
|
492
|
+
component: "span",
|
|
493
|
+
sx: {
|
|
494
|
+
color: "primary.main",
|
|
495
|
+
fontWeight: 600,
|
|
496
|
+
fontSize: "inherit"
|
|
497
|
+
},
|
|
498
|
+
children: part
|
|
499
|
+
},
|
|
500
|
+
index
|
|
501
|
+
) : part
|
|
502
|
+
);
|
|
503
|
+
} catch (error) {
|
|
504
|
+
return textString;
|
|
505
|
+
}
|
|
506
|
+
};
|
|
507
|
+
if (!isOpen) return null;
|
|
508
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
509
|
+
_material.Box,
|
|
510
|
+
{
|
|
511
|
+
sx: {
|
|
512
|
+
display: "flex",
|
|
513
|
+
flexDirection: "column",
|
|
514
|
+
height: "100%",
|
|
515
|
+
width: "320px",
|
|
516
|
+
backgroundColor: "background.paper",
|
|
517
|
+
borderLeft: "1px solid",
|
|
518
|
+
borderColor: "divider",
|
|
519
|
+
overflow: "hidden"
|
|
520
|
+
},
|
|
521
|
+
children: [
|
|
522
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _material.Box, { sx: { px: 3, py: 2.5, backgroundColor: "background.default" }, children: [
|
|
523
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _material.Box, { sx: { display: "flex", alignItems: "center", justifyContent: "space-between", mb: 2 }, children: [
|
|
524
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Typography, { variant: "h6", sx: { fontSize: "1.125rem", fontWeight: 600, color: "text.primary" }, children: "Search" }),
|
|
525
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
526
|
+
_material.IconButton,
|
|
527
|
+
{
|
|
528
|
+
size: "small",
|
|
529
|
+
onClick: onClose,
|
|
530
|
+
sx: {
|
|
531
|
+
color: "text.secondary",
|
|
532
|
+
padding: "6px"
|
|
533
|
+
},
|
|
534
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _Close2.default, { fontSize: "small" })
|
|
535
|
+
}
|
|
536
|
+
)
|
|
537
|
+
] }),
|
|
538
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "form", { onSubmit: handleSearchSubmit, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
539
|
+
_material.TextField,
|
|
540
|
+
{
|
|
541
|
+
fullWidth: true,
|
|
542
|
+
size: "medium",
|
|
543
|
+
placeholder: "Search in document...",
|
|
544
|
+
value: searchTerm,
|
|
545
|
+
onChange: handleSearchChange,
|
|
546
|
+
autoComplete: "off",
|
|
547
|
+
InputProps: {
|
|
548
|
+
startAdornment: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.InputAdornment, { position: "start", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _Search2.default, { sx: { color: "text.disabled", fontSize: 20 } }) }),
|
|
549
|
+
endAdornment: searchTerm && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.InputAdornment, { position: "end", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
550
|
+
_material.IconButton,
|
|
551
|
+
{
|
|
552
|
+
size: "small",
|
|
553
|
+
onClick: handleClearSearch,
|
|
554
|
+
sx: {
|
|
555
|
+
color: "text.secondary",
|
|
556
|
+
padding: "4px",
|
|
557
|
+
"&:hover": {
|
|
558
|
+
backgroundColor: "action.hover"
|
|
559
|
+
}
|
|
560
|
+
},
|
|
561
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _Clear2.default, { sx: { fontSize: 18 } })
|
|
562
|
+
}
|
|
563
|
+
) })
|
|
564
|
+
},
|
|
565
|
+
sx: {
|
|
566
|
+
"& .MuiOutlinedInput-root": {
|
|
567
|
+
fontSize: "0.9375rem",
|
|
568
|
+
backgroundColor: "background.paper",
|
|
569
|
+
borderRadius: "8px",
|
|
570
|
+
"& fieldset": {
|
|
571
|
+
borderColor: "divider"
|
|
572
|
+
},
|
|
573
|
+
"&.Mui-focused fieldset": {
|
|
574
|
+
borderColor: "primary.main",
|
|
575
|
+
borderWidth: "2px"
|
|
576
|
+
}
|
|
577
|
+
},
|
|
578
|
+
"& .MuiInputBase-input": {
|
|
579
|
+
padding: "10px 14px"
|
|
580
|
+
}
|
|
581
|
+
}
|
|
582
|
+
}
|
|
583
|
+
) }),
|
|
584
|
+
totalResults > 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
585
|
+
_material.Box,
|
|
586
|
+
{
|
|
587
|
+
sx: {
|
|
588
|
+
display: "flex",
|
|
589
|
+
alignItems: "center",
|
|
590
|
+
justifyContent: "space-between",
|
|
591
|
+
mt: 2,
|
|
592
|
+
pt: 2,
|
|
593
|
+
borderTop: "1px solid",
|
|
594
|
+
borderColor: "divider"
|
|
595
|
+
},
|
|
596
|
+
children: [
|
|
597
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _material.Typography, { variant: "body2", sx: { color: "text.secondary", fontSize: "0.875rem", fontWeight: 500 }, children: [
|
|
598
|
+
currentResultIndex + 1,
|
|
599
|
+
" of ",
|
|
600
|
+
totalResults,
|
|
601
|
+
" results"
|
|
602
|
+
] }),
|
|
603
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _material.Box, { sx: { display: "flex", alignItems: "center", gap: 0.5 }, children: [
|
|
604
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
605
|
+
_material.IconButton,
|
|
606
|
+
{
|
|
607
|
+
size: "small",
|
|
608
|
+
onClick: onPreviousResult,
|
|
609
|
+
disabled: currentResultIndex <= 0,
|
|
610
|
+
sx: {
|
|
611
|
+
color: currentResultIndex <= 0 ? "text.disabled" : "primary.main",
|
|
612
|
+
padding: "6px",
|
|
613
|
+
borderRadius: "6px",
|
|
614
|
+
border: "1px solid",
|
|
615
|
+
borderColor: currentResultIndex <= 0 ? "divider" : "primary.main"
|
|
616
|
+
},
|
|
617
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _KeyboardArrowUp2.default, { sx: { fontSize: 20 } })
|
|
618
|
+
}
|
|
619
|
+
),
|
|
620
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
621
|
+
_material.IconButton,
|
|
622
|
+
{
|
|
623
|
+
size: "small",
|
|
624
|
+
onClick: onNextResult,
|
|
625
|
+
disabled: currentResultIndex >= totalResults - 1,
|
|
626
|
+
sx: {
|
|
627
|
+
color: currentResultIndex >= totalResults - 1 ? "text.disabled" : "primary.main",
|
|
628
|
+
padding: "6px",
|
|
629
|
+
borderRadius: "6px",
|
|
630
|
+
border: "1px solid",
|
|
631
|
+
borderColor: currentResultIndex >= totalResults - 1 ? "divider" : "primary.main"
|
|
632
|
+
},
|
|
633
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _KeyboardArrowDown2.default, { sx: { fontSize: 20 } })
|
|
634
|
+
}
|
|
635
|
+
)
|
|
636
|
+
] })
|
|
637
|
+
]
|
|
638
|
+
}
|
|
639
|
+
)
|
|
640
|
+
] }),
|
|
641
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Divider, {}),
|
|
642
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _material.Box, { ref: contentRef, className: "search-sidebar-content", sx: {
|
|
643
|
+
flex: 1,
|
|
644
|
+
overflow: "auto",
|
|
645
|
+
backgroundColor: "background.default"
|
|
646
|
+
}, children: [
|
|
647
|
+
!searchTerm && !hasSearched && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _material.Box, { sx: { p: 4, textAlign: "center", mt: 6 }, children: [
|
|
648
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
649
|
+
_material.Box,
|
|
650
|
+
{
|
|
651
|
+
sx: {
|
|
652
|
+
width: 80,
|
|
653
|
+
height: 80,
|
|
654
|
+
borderRadius: "50%",
|
|
655
|
+
backgroundColor: "action.hover",
|
|
656
|
+
display: "flex",
|
|
657
|
+
alignItems: "center",
|
|
658
|
+
justifyContent: "center",
|
|
659
|
+
margin: "0 auto",
|
|
660
|
+
mb: 3
|
|
661
|
+
},
|
|
662
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _Search2.default, { sx: { fontSize: 40, color: "text.disabled" } })
|
|
663
|
+
}
|
|
664
|
+
),
|
|
665
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Typography, { variant: "body1", sx: { color: "text.primary", fontWeight: 500, mb: 1 }, children: "Search in Document" }),
|
|
666
|
+
/* @__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" })
|
|
667
|
+
] }),
|
|
668
|
+
searchTerm && !hasSearched && !isSearching && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _material.Box, { sx: { p: 4, textAlign: "center", mt: 6 }, children: [
|
|
669
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
670
|
+
_material.Box,
|
|
671
|
+
{
|
|
672
|
+
sx: {
|
|
673
|
+
width: 80,
|
|
674
|
+
height: 80,
|
|
675
|
+
borderRadius: "50%",
|
|
676
|
+
backgroundColor: "primary.light",
|
|
677
|
+
display: "flex",
|
|
678
|
+
alignItems: "center",
|
|
679
|
+
justifyContent: "center",
|
|
680
|
+
margin: "0 auto",
|
|
681
|
+
mb: 3,
|
|
682
|
+
opacity: 0.2
|
|
683
|
+
},
|
|
684
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _FindInPage2.default, { sx: { fontSize: 40, color: "primary.main" } })
|
|
685
|
+
}
|
|
686
|
+
),
|
|
687
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Typography, { variant: "body1", sx: { color: "text.primary", fontWeight: 500, mb: 1 }, children: "Ready to Search" }),
|
|
688
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Typography, { variant: "body2", sx: { color: "text.secondary", mb: 2, lineHeight: 1.6 }, children: "Press Enter to find" }),
|
|
689
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
690
|
+
_material.Typography,
|
|
691
|
+
{
|
|
692
|
+
variant: "body2",
|
|
693
|
+
sx: {
|
|
694
|
+
color: "white",
|
|
695
|
+
fontWeight: 600,
|
|
696
|
+
backgroundColor: (theme) => theme.palette.mode === "dark" ? "rgba(144, 202, 249, 0.16)" : "primary.light",
|
|
697
|
+
padding: "6px 16px",
|
|
698
|
+
borderRadius: "16px",
|
|
699
|
+
display: "inline-block",
|
|
700
|
+
opacity: 0.9
|
|
701
|
+
},
|
|
702
|
+
children: [
|
|
703
|
+
'"',
|
|
704
|
+
searchTerm,
|
|
705
|
+
'"'
|
|
706
|
+
]
|
|
707
|
+
}
|
|
708
|
+
)
|
|
709
|
+
] }),
|
|
710
|
+
isSearching && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _material.Box, { sx: { p: 4, textAlign: "center", mt: 6 }, children: [
|
|
711
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
712
|
+
_material.Box,
|
|
713
|
+
{
|
|
714
|
+
sx: {
|
|
715
|
+
display: "flex",
|
|
716
|
+
alignItems: "center",
|
|
717
|
+
justifyContent: "center",
|
|
718
|
+
margin: "0 auto",
|
|
719
|
+
mb: 3
|
|
720
|
+
},
|
|
721
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.CircularProgress, { size: 60, thickness: 4 })
|
|
722
|
+
}
|
|
723
|
+
),
|
|
724
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Typography, { variant: "body1", sx: { color: "text.primary", fontWeight: 500, mb: 1 }, children: "Searching..." }),
|
|
725
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _material.Typography, { variant: "body2", sx: { color: "text.secondary", lineHeight: 1.6 }, children: [
|
|
726
|
+
'Finding matches for "',
|
|
727
|
+
searchTerm,
|
|
728
|
+
'"'
|
|
729
|
+
] })
|
|
730
|
+
] }),
|
|
731
|
+
hasSearched && totalResults === 0 && !isSearching && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _material.Box, { sx: { p: 4, textAlign: "center", mt: 6 }, children: [
|
|
732
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
733
|
+
_material.Box,
|
|
734
|
+
{
|
|
735
|
+
sx: {
|
|
736
|
+
width: 80,
|
|
737
|
+
height: 80,
|
|
738
|
+
borderRadius: "50%",
|
|
739
|
+
backgroundColor: (theme) => theme.palette.mode === "dark" ? "rgba(255, 152, 0, 0.12)" : "warning.light",
|
|
740
|
+
display: "flex",
|
|
741
|
+
alignItems: "center",
|
|
742
|
+
justifyContent: "center",
|
|
743
|
+
margin: "0 auto",
|
|
744
|
+
mb: 3,
|
|
745
|
+
opacity: 0.6
|
|
746
|
+
},
|
|
747
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _Search2.default, { sx: { fontSize: 40, color: "warning.main" } })
|
|
748
|
+
}
|
|
749
|
+
),
|
|
750
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Typography, { variant: "body1", sx: { color: "text.primary", fontWeight: 500, mb: 1 }, children: "No Results Found" }),
|
|
751
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _material.Typography, { variant: "body2", sx: { color: "text.secondary", lineHeight: 1.6 }, children: [
|
|
752
|
+
"No matches found for ",
|
|
753
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "strong", { children: [
|
|
754
|
+
'"',
|
|
755
|
+
searchTerm,
|
|
756
|
+
'"'
|
|
757
|
+
] })
|
|
758
|
+
] })
|
|
759
|
+
] }),
|
|
760
|
+
totalResults > 0 && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Box, { sx: { p: 2 }, children: Object.keys(resultsByPage).sort((a, b) => parseInt(a) - parseInt(b)).map((pageNum) => {
|
|
761
|
+
const pageNumber = parseInt(pageNum);
|
|
762
|
+
const pageResults = resultsByPage[pageNumber];
|
|
763
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _material.Box, { sx: { mb: 3 }, children: [
|
|
764
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
765
|
+
_material.Typography,
|
|
766
|
+
{
|
|
767
|
+
variant: "subtitle2",
|
|
768
|
+
sx: {
|
|
769
|
+
color: "text.secondary",
|
|
770
|
+
mb: 1.5,
|
|
771
|
+
px: 1,
|
|
772
|
+
fontSize: "0.8125rem",
|
|
773
|
+
fontWeight: 600,
|
|
774
|
+
textTransform: "uppercase",
|
|
775
|
+
letterSpacing: "0.5px"
|
|
776
|
+
},
|
|
777
|
+
children: [
|
|
778
|
+
"Page ",
|
|
779
|
+
pageNumber
|
|
780
|
+
]
|
|
781
|
+
}
|
|
782
|
+
),
|
|
783
|
+
pageResults.map((result, index) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
784
|
+
_material.Box,
|
|
785
|
+
{
|
|
786
|
+
onClick: () => onSearchResultClick(result.pageNumber, result.index),
|
|
787
|
+
sx: {
|
|
788
|
+
p: 2,
|
|
789
|
+
mx: 1,
|
|
790
|
+
mb: 1.5,
|
|
791
|
+
borderRadius: "8px",
|
|
792
|
+
border: "2px solid",
|
|
793
|
+
borderColor: result.index === currentResultIndex ? "primary.main" : "divider",
|
|
794
|
+
backgroundColor: "background.paper",
|
|
795
|
+
cursor: "pointer",
|
|
796
|
+
transition: "all 0.2s ease",
|
|
797
|
+
boxShadow: (theme) => theme.palette.mode === "dark" ? "0 1px 3px rgba(0, 0, 0, 0.3)" : "0 1px 3px rgba(0, 0, 0, 0.05)",
|
|
798
|
+
"&:hover": {
|
|
799
|
+
borderColor: "primary.main",
|
|
800
|
+
boxShadow: (theme) => theme.palette.mode === "dark" ? "0 2px 8px rgba(255, 255, 255, 0.15)" : "0 2px 8px rgba(0, 0, 0, 0.1)",
|
|
801
|
+
transform: "translateY(-1px)"
|
|
802
|
+
}
|
|
803
|
+
},
|
|
804
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
805
|
+
_material.Typography,
|
|
806
|
+
{
|
|
807
|
+
variant: "body2",
|
|
808
|
+
className: "search-result-text",
|
|
809
|
+
sx: {
|
|
810
|
+
fontSize: "0.875rem",
|
|
811
|
+
lineHeight: 1.6,
|
|
812
|
+
color: result.index === currentResultIndex ? "text.primary" : "text.secondary"
|
|
813
|
+
},
|
|
814
|
+
children: highlightText(result.context, searchTerm)
|
|
815
|
+
}
|
|
816
|
+
)
|
|
817
|
+
},
|
|
818
|
+
index
|
|
819
|
+
))
|
|
820
|
+
] }, pageNumber);
|
|
821
|
+
}) })
|
|
822
|
+
] })
|
|
823
|
+
]
|
|
824
|
+
}
|
|
825
|
+
);
|
|
826
|
+
};
|
|
827
|
+
|
|
828
|
+
// src/components/viewers/pdf/PasswordDialog.tsx
|
|
829
|
+
|
|
830
|
+
|
|
831
|
+
|
|
832
|
+
|
|
833
|
+
|
|
834
|
+
|
|
835
|
+
|
|
836
|
+
|
|
837
|
+
|
|
838
|
+
|
|
839
|
+
|
|
840
|
+
|
|
841
|
+
|
|
842
|
+
|
|
843
|
+
|
|
844
|
+
var _Lock = require('@mui/icons-material/Lock'); var _Lock2 = _interopRequireDefault(_Lock);
|
|
845
|
+
var _Visibility = require('@mui/icons-material/Visibility'); var _Visibility2 = _interopRequireDefault(_Visibility);
|
|
846
|
+
var _VisibilityOff = require('@mui/icons-material/VisibilityOff'); var _VisibilityOff2 = _interopRequireDefault(_VisibilityOff);
|
|
847
|
+
|
|
848
|
+
var PasswordDialog = ({
|
|
849
|
+
open,
|
|
850
|
+
fileName,
|
|
851
|
+
onSubmit,
|
|
852
|
+
onCancel,
|
|
853
|
+
error
|
|
854
|
+
}) => {
|
|
855
|
+
const [password, setPassword] = _react.useState.call(void 0, "");
|
|
856
|
+
const [showPassword, setShowPassword] = _react.useState.call(void 0, false);
|
|
857
|
+
_react.useEffect.call(void 0, () => {
|
|
858
|
+
if (open) {
|
|
859
|
+
setPassword("");
|
|
860
|
+
setShowPassword(false);
|
|
861
|
+
}
|
|
862
|
+
}, [open]);
|
|
863
|
+
const handleSubmit = (e) => {
|
|
864
|
+
e.preventDefault();
|
|
865
|
+
if (password.trim()) {
|
|
866
|
+
onSubmit(password);
|
|
867
|
+
}
|
|
868
|
+
};
|
|
869
|
+
const handleTogglePasswordVisibility = () => {
|
|
870
|
+
setShowPassword(!showPassword);
|
|
871
|
+
};
|
|
872
|
+
const handleKeyPress = (e) => {
|
|
873
|
+
if (e.key === "Enter" && password.trim()) {
|
|
874
|
+
handleSubmit(e);
|
|
875
|
+
}
|
|
876
|
+
};
|
|
877
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
878
|
+
_material.Dialog,
|
|
879
|
+
{
|
|
880
|
+
open,
|
|
881
|
+
onClose: onCancel,
|
|
882
|
+
maxWidth: "sm",
|
|
883
|
+
fullWidth: true,
|
|
884
|
+
PaperProps: {
|
|
885
|
+
sx: {
|
|
886
|
+
borderRadius: 2
|
|
887
|
+
}
|
|
888
|
+
},
|
|
889
|
+
children: [
|
|
890
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.DialogTitle, { sx: { pb: 1 }, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _material.Box, { sx: { display: "flex", alignItems: "center", justifyContent: "space-between" }, children: [
|
|
891
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _material.Box, { sx: { display: "flex", alignItems: "center", gap: 1.5 }, children: [
|
|
892
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
893
|
+
_material.Box,
|
|
894
|
+
{
|
|
895
|
+
sx: {
|
|
896
|
+
width: 40,
|
|
897
|
+
height: 40,
|
|
898
|
+
borderRadius: "50%",
|
|
899
|
+
backgroundColor: "primary.light",
|
|
900
|
+
display: "flex",
|
|
901
|
+
alignItems: "center",
|
|
902
|
+
justifyContent: "center",
|
|
903
|
+
opacity: 0.9
|
|
904
|
+
},
|
|
905
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _Lock2.default, { sx: { color: "white", fontSize: 20 } })
|
|
906
|
+
}
|
|
907
|
+
),
|
|
908
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Typography, { variant: "h6", component: "div", sx: { fontWeight: 600 }, children: "Password Protected" })
|
|
909
|
+
] }),
|
|
910
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
911
|
+
_material.IconButton,
|
|
912
|
+
{
|
|
913
|
+
size: "small",
|
|
914
|
+
onClick: onCancel,
|
|
915
|
+
sx: { color: "text.secondary" },
|
|
916
|
+
"aria-label": "Close dialog",
|
|
917
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _Close2.default, { fontSize: "small" })
|
|
918
|
+
}
|
|
919
|
+
)
|
|
920
|
+
] }) }),
|
|
921
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _material.DialogContent, { sx: { pt: 2 }, children: [
|
|
922
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _material.Typography, { variant: "body2", sx: { color: "text.secondary", mb: 3 }, children: [
|
|
923
|
+
"This PDF is password protected. Please enter the password to view",
|
|
924
|
+
" ",
|
|
925
|
+
fileName && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "strong", { children: [
|
|
926
|
+
'"',
|
|
927
|
+
fileName,
|
|
928
|
+
'"'
|
|
929
|
+
] })
|
|
930
|
+
] }),
|
|
931
|
+
error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Alert, { severity: "error", sx: { mb: 2 }, children: error }),
|
|
932
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "form", { onSubmit: handleSubmit, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
933
|
+
_material.TextField,
|
|
934
|
+
{
|
|
935
|
+
fullWidth: true,
|
|
936
|
+
autoFocus: true,
|
|
937
|
+
type: showPassword ? "text" : "password",
|
|
938
|
+
label: "Password",
|
|
939
|
+
placeholder: "Enter password",
|
|
940
|
+
value: password,
|
|
941
|
+
onChange: (e) => setPassword(e.target.value),
|
|
942
|
+
onKeyPress: handleKeyPress,
|
|
943
|
+
error: Boolean(error),
|
|
944
|
+
InputProps: {
|
|
945
|
+
endAdornment: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.InputAdornment, { position: "end", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
946
|
+
_material.IconButton,
|
|
947
|
+
{
|
|
948
|
+
onClick: handleTogglePasswordVisibility,
|
|
949
|
+
edge: "end",
|
|
950
|
+
size: "small",
|
|
951
|
+
"aria-label": showPassword ? "Hide password" : "Show password",
|
|
952
|
+
children: showPassword ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _VisibilityOff2.default, {}) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _Visibility2.default, {})
|
|
953
|
+
}
|
|
954
|
+
) })
|
|
955
|
+
},
|
|
956
|
+
sx: {
|
|
957
|
+
"& .MuiOutlinedInput-root": {
|
|
958
|
+
borderRadius: 2
|
|
959
|
+
}
|
|
960
|
+
}
|
|
961
|
+
}
|
|
962
|
+
) })
|
|
963
|
+
] }),
|
|
964
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _material.DialogActions, { sx: { px: 3, pb: 3, pt: 2 }, children: [
|
|
965
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
966
|
+
_material.Button,
|
|
967
|
+
{
|
|
968
|
+
onClick: onCancel,
|
|
969
|
+
variant: "outlined",
|
|
970
|
+
sx: {
|
|
971
|
+
borderRadius: 2,
|
|
972
|
+
textTransform: "none",
|
|
973
|
+
px: 3
|
|
974
|
+
},
|
|
975
|
+
children: "Cancel"
|
|
976
|
+
}
|
|
977
|
+
),
|
|
978
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
979
|
+
_material.Button,
|
|
980
|
+
{
|
|
981
|
+
onClick: handleSubmit,
|
|
982
|
+
variant: "contained",
|
|
983
|
+
disabled: !password.trim(),
|
|
984
|
+
sx: {
|
|
985
|
+
borderRadius: 2,
|
|
986
|
+
textTransform: "none",
|
|
987
|
+
px: 3,
|
|
988
|
+
boxShadow: 2
|
|
989
|
+
},
|
|
990
|
+
children: "Unlock PDF"
|
|
991
|
+
}
|
|
992
|
+
)
|
|
993
|
+
] })
|
|
994
|
+
]
|
|
995
|
+
}
|
|
996
|
+
);
|
|
997
|
+
};
|
|
998
|
+
|
|
999
|
+
// src/components/viewers/PDFViewer.tsx
|
|
1000
|
+
|
|
1001
|
+
var PDFViewerContent = _react.forwardRef.call(void 0,
|
|
1002
|
+
(props, ref) => {
|
|
1003
|
+
const {
|
|
1004
|
+
file,
|
|
1005
|
+
onLoad,
|
|
1006
|
+
onError,
|
|
1007
|
+
fileName,
|
|
1008
|
+
showPageCount = true,
|
|
1009
|
+
showPageNavigation = true,
|
|
1010
|
+
showZoomControls = true,
|
|
1011
|
+
showRotation = true,
|
|
1012
|
+
showDownload = true,
|
|
1013
|
+
showPrint = true,
|
|
1014
|
+
showSearch = true,
|
|
1015
|
+
showMetadata = true,
|
|
1016
|
+
showProperties = true,
|
|
1017
|
+
showTags = true,
|
|
1018
|
+
onMetadataClick,
|
|
1019
|
+
onPropertiesClick,
|
|
1020
|
+
onTagsClick,
|
|
1021
|
+
onDownloadClick,
|
|
1022
|
+
onPrintClick,
|
|
1023
|
+
initialSearchText,
|
|
1024
|
+
initialSearchPages
|
|
1025
|
+
} = props;
|
|
1026
|
+
const [pdfBuffer, setPdfBuffer] = _react.useState.call(void 0, null);
|
|
1027
|
+
const [state, setState] = _react.useState.call(void 0, "idle");
|
|
1028
|
+
const [error, setError] = _react.useState.call(void 0, null);
|
|
1029
|
+
const pdfViewerRef = _react.useRef.call(void 0, null);
|
|
1030
|
+
const resolvedFileName = _react.useMemo.call(void 0, () => {
|
|
1031
|
+
if (fileName) return fileName;
|
|
1032
|
+
if (file instanceof File) return file.name;
|
|
1033
|
+
if (typeof file === "string") {
|
|
1034
|
+
const urlParts = file.split("/");
|
|
1035
|
+
return urlParts[urlParts.length - 1] || "document.pdf";
|
|
1036
|
+
}
|
|
1037
|
+
return "document.pdf";
|
|
1038
|
+
}, [file, fileName]);
|
|
1039
|
+
const fileExtension = _react.useMemo.call(void 0,
|
|
1040
|
+
() => _chunkYEPEMLM3js.getFileExtension.call(void 0, resolvedFileName),
|
|
1041
|
+
[resolvedFileName]
|
|
1042
|
+
);
|
|
1043
|
+
const [currentPage, setCurrentPage] = _react.useState.call(void 0, 1);
|
|
1044
|
+
const [totalPages, setTotalPages] = _react.useState.call(void 0, 0);
|
|
1045
|
+
const [zoom, setZoom] = _react.useState.call(void 0, 100);
|
|
1046
|
+
const [searchQuery, setSearchQuery] = _react.useState.call(void 0, "");
|
|
1047
|
+
const [isSearching, setIsSearching] = _react.useState.call(void 0, false);
|
|
1048
|
+
const [pdfContainer, setPdfContainer] = _react.useState.call(void 0, null);
|
|
1049
|
+
const [isSidebarOpen, setIsSidebarOpen] = _react.useState.call(void 0, false);
|
|
1050
|
+
const [searchResults, setSearchResults] = _react.useState.call(void 0, []);
|
|
1051
|
+
const [currentSearchResultIndex, setCurrentSearchResultIndex] = _react.useState.call(void 0, 0);
|
|
1052
|
+
const [totalSearchResults, setTotalSearchResults] = _react.useState.call(void 0, 0);
|
|
1053
|
+
const [autoExecuteSearch, setAutoExecuteSearch] = _react.useState.call(void 0,
|
|
1054
|
+
!!initialSearchText
|
|
1055
|
+
);
|
|
1056
|
+
const [isFullScreen, setIsFullScreen] = _react.useState.call(void 0, false);
|
|
1057
|
+
const containerRef = _react.useRef.call(void 0, null);
|
|
1058
|
+
const [isPasswordDialogOpen, setIsPasswordDialogOpen] = _react.useState.call(void 0, false);
|
|
1059
|
+
const [passwordError, setPasswordError] = _react.useState.call(void 0, "");
|
|
1060
|
+
const [passwordResolve, setPasswordResolve] = _react.useState.call(void 0, null);
|
|
1061
|
+
const hasExecutedInitialSearch = _react.useRef.call(void 0, false);
|
|
1062
|
+
const handleToggleFullScreen = _react.useCallback.call(void 0, () => {
|
|
1063
|
+
if (!isFullScreen && _optionalChain([containerRef, 'access', _ => _.current, 'optionalAccess', _2 => _2.requestFullscreen])) {
|
|
1064
|
+
containerRef.current.requestFullscreen();
|
|
1065
|
+
setIsFullScreen(true);
|
|
1066
|
+
} else if (isFullScreen && document.exitFullscreen) {
|
|
1067
|
+
document.exitFullscreen();
|
|
1068
|
+
setIsFullScreen(false);
|
|
1069
|
+
}
|
|
1070
|
+
}, [isFullScreen]);
|
|
1071
|
+
const handleSidebarClose = _react.useCallback.call(void 0, () => {
|
|
1072
|
+
setIsSidebarOpen(false);
|
|
1073
|
+
setSearchQuery("");
|
|
1074
|
+
setSearchResults([]);
|
|
1075
|
+
setTotalSearchResults(0);
|
|
1076
|
+
setCurrentSearchResultIndex(0);
|
|
1077
|
+
_optionalChain([pdfViewerRef, 'access', _3 => _3.current, 'optionalAccess', _4 => _4.search, 'access', _5 => _5.stopSearch, 'call', _6 => _6()]);
|
|
1078
|
+
}, []);
|
|
1079
|
+
const toolbar = _chunkAYVTSFZAjs.mergeToolbarConfig.call(void 0, {
|
|
1080
|
+
showDownload,
|
|
1081
|
+
showPrint,
|
|
1082
|
+
showMetadata,
|
|
1083
|
+
showProperties,
|
|
1084
|
+
showTags,
|
|
1085
|
+
showRotation,
|
|
1086
|
+
onDownloadClick,
|
|
1087
|
+
onPrintClick,
|
|
1088
|
+
onMetadataClick,
|
|
1089
|
+
onPropertiesClick,
|
|
1090
|
+
onTagsClick,
|
|
1091
|
+
toolbarActions: props.toolbarActions
|
|
1092
|
+
});
|
|
1093
|
+
const toolbarHandlers = _react.useMemo.call(void 0,
|
|
1094
|
+
() => ({
|
|
1095
|
+
handleZoomIn: () => {
|
|
1096
|
+
_optionalChain([pdfViewerRef, 'access', _7 => _7.current, 'optionalAccess', _8 => _8.zoom, 'access', _9 => _9.zoomIn, 'call', _10 => _10()]);
|
|
1097
|
+
requestAnimationFrame(() => {
|
|
1098
|
+
const zoomValue = _optionalChain([pdfViewerRef, 'access', _11 => _11.current, 'optionalAccess', _12 => _12.zoom, 'access', _13 => _13.getZoom, 'call', _14 => _14()]);
|
|
1099
|
+
if (typeof zoomValue === "number") {
|
|
1100
|
+
setZoom(Math.round(zoomValue * 100));
|
|
1101
|
+
}
|
|
1102
|
+
});
|
|
1103
|
+
},
|
|
1104
|
+
handleZoomOut: () => {
|
|
1105
|
+
_optionalChain([pdfViewerRef, 'access', _15 => _15.current, 'optionalAccess', _16 => _16.zoom, 'access', _17 => _17.zoomOut, 'call', _18 => _18()]);
|
|
1106
|
+
requestAnimationFrame(() => {
|
|
1107
|
+
const zoomValue = _optionalChain([pdfViewerRef, 'access', _19 => _19.current, 'optionalAccess', _20 => _20.zoom, 'access', _21 => _21.getZoom, 'call', _22 => _22()]);
|
|
1108
|
+
if (typeof zoomValue === "number") {
|
|
1109
|
+
setZoom(Math.round(zoomValue * 100));
|
|
1110
|
+
}
|
|
1111
|
+
});
|
|
1112
|
+
},
|
|
1113
|
+
handleFitToWidth: () => {
|
|
1114
|
+
_optionalChain([pdfViewerRef, 'access', _23 => _23.current, 'optionalAccess', _24 => _24.zoom, 'access', _25 => _25.fitToWidth, 'call', _26 => _26()]);
|
|
1115
|
+
requestAnimationFrame(() => {
|
|
1116
|
+
const zoomValue = _optionalChain([pdfViewerRef, 'access', _27 => _27.current, 'optionalAccess', _28 => _28.zoom, 'access', _29 => _29.getZoom, 'call', _30 => _30()]);
|
|
1117
|
+
if (typeof zoomValue === "number") {
|
|
1118
|
+
setZoom(Math.round(zoomValue * 100));
|
|
1119
|
+
}
|
|
1120
|
+
});
|
|
1121
|
+
},
|
|
1122
|
+
handleFitToPage: () => {
|
|
1123
|
+
_optionalChain([pdfViewerRef, 'access', _31 => _31.current, 'optionalAccess', _32 => _32.zoom, 'access', _33 => _33.fitToPage, 'call', _34 => _34()]);
|
|
1124
|
+
requestAnimationFrame(() => {
|
|
1125
|
+
const zoomValue = _optionalChain([pdfViewerRef, 'access', _35 => _35.current, 'optionalAccess', _36 => _36.zoom, 'access', _37 => _37.getZoom, 'call', _38 => _38()]);
|
|
1126
|
+
if (typeof zoomValue === "number") {
|
|
1127
|
+
setZoom(Math.round(zoomValue * 100));
|
|
1128
|
+
}
|
|
1129
|
+
});
|
|
1130
|
+
},
|
|
1131
|
+
handlePreviousPage: () => {
|
|
1132
|
+
_optionalChain([pdfViewerRef, 'access', _39 => _39.current, 'optionalAccess', _40 => _40.navigation, 'access', _41 => _41.previousPage, 'call', _42 => _42()]);
|
|
1133
|
+
requestAnimationFrame(() => {
|
|
1134
|
+
const current = _optionalChain([pdfViewerRef, 'access', _43 => _43.current, 'optionalAccess', _44 => _44.navigation, 'access', _45 => _45.getCurrentPage, 'call', _46 => _46()]) || 1;
|
|
1135
|
+
setCurrentPage(current);
|
|
1136
|
+
});
|
|
1137
|
+
},
|
|
1138
|
+
handleNextPage: () => {
|
|
1139
|
+
_optionalChain([pdfViewerRef, 'access', _47 => _47.current, 'optionalAccess', _48 => _48.navigation, 'access', _49 => _49.nextPage, 'call', _50 => _50()]);
|
|
1140
|
+
requestAnimationFrame(() => {
|
|
1141
|
+
const current = _optionalChain([pdfViewerRef, 'access', _51 => _51.current, 'optionalAccess', _52 => _52.navigation, 'access', _53 => _53.getCurrentPage, 'call', _54 => _54()]) || 1;
|
|
1142
|
+
setCurrentPage(current);
|
|
1143
|
+
});
|
|
1144
|
+
},
|
|
1145
|
+
handleFirstPage: () => {
|
|
1146
|
+
_optionalChain([pdfViewerRef, 'access', _55 => _55.current, 'optionalAccess', _56 => _56.navigation, 'access', _57 => _57.goToFirstPage, 'call', _58 => _58()]);
|
|
1147
|
+
requestAnimationFrame(() => {
|
|
1148
|
+
const current = _optionalChain([pdfViewerRef, 'access', _59 => _59.current, 'optionalAccess', _60 => _60.navigation, 'access', _61 => _61.getCurrentPage, 'call', _62 => _62()]) || 1;
|
|
1149
|
+
setCurrentPage(current);
|
|
1150
|
+
});
|
|
1151
|
+
},
|
|
1152
|
+
handleLastPage: () => {
|
|
1153
|
+
_optionalChain([pdfViewerRef, 'access', _63 => _63.current, 'optionalAccess', _64 => _64.navigation, 'access', _65 => _65.goToLastPage, 'call', _66 => _66()]);
|
|
1154
|
+
requestAnimationFrame(() => {
|
|
1155
|
+
const current = _optionalChain([pdfViewerRef, 'access', _67 => _67.current, 'optionalAccess', _68 => _68.navigation, 'access', _69 => _69.getCurrentPage, 'call', _70 => _70()]) || 1;
|
|
1156
|
+
setCurrentPage(current);
|
|
1157
|
+
});
|
|
1158
|
+
},
|
|
1159
|
+
toggleSidebar: () => {
|
|
1160
|
+
if (isSidebarOpen) {
|
|
1161
|
+
handleSidebarClose();
|
|
1162
|
+
} else {
|
|
1163
|
+
setIsSidebarOpen(true);
|
|
1164
|
+
}
|
|
1165
|
+
},
|
|
1166
|
+
handlePageInput: (e) => {
|
|
1167
|
+
const value = e.target.value;
|
|
1168
|
+
if (/^\d*$/.test(value)) {
|
|
1169
|
+
return;
|
|
1170
|
+
}
|
|
1171
|
+
const page = parseInt(value, 10);
|
|
1172
|
+
if (!isNaN(page) && page >= 1 && (totalPages === 0 || page <= totalPages)) {
|
|
1173
|
+
_optionalChain([pdfViewerRef, 'access', _71 => _71.current, 'optionalAccess', _72 => _72.navigation, 'access', _73 => _73.goToPage, 'call', _74 => _74(page)]);
|
|
1174
|
+
setCurrentPage(page);
|
|
1175
|
+
}
|
|
1176
|
+
},
|
|
1177
|
+
handlePageInputKeyPress: (e) => {
|
|
1178
|
+
if (e.key === "Enter") {
|
|
1179
|
+
const value = e.target.value;
|
|
1180
|
+
const page = parseInt(value, 10);
|
|
1181
|
+
if (!isNaN(page) && page >= 1 && (totalPages === 0 || page <= totalPages)) {
|
|
1182
|
+
_optionalChain([pdfViewerRef, 'access', _75 => _75.current, 'optionalAccess', _76 => _76.navigation, 'access', _77 => _77.goToPage, 'call', _78 => _78(page)]);
|
|
1183
|
+
setCurrentPage(page);
|
|
1184
|
+
}
|
|
1185
|
+
}
|
|
1186
|
+
},
|
|
1187
|
+
handleRotateLeft: () => {
|
|
1188
|
+
_optionalChain([pdfViewerRef, 'access', _79 => _79.current, 'optionalAccess', _80 => _80.rotate, 'optionalAccess', _81 => _81.rotateBackward, 'call', _82 => _82()]);
|
|
1189
|
+
},
|
|
1190
|
+
handleRotateRight: () => {
|
|
1191
|
+
_optionalChain([pdfViewerRef, 'access', _83 => _83.current, 'optionalAccess', _84 => _84.rotate, 'optionalAccess', _85 => _85.rotateForward, 'call', _86 => _86()]);
|
|
1192
|
+
},
|
|
1193
|
+
handleToggleFullScreen
|
|
1194
|
+
}),
|
|
1195
|
+
[isSidebarOpen, totalPages, handleToggleFullScreen]
|
|
1196
|
+
);
|
|
1197
|
+
_react.useEffect.call(void 0, () => {
|
|
1198
|
+
console.log(
|
|
1199
|
+
"came",
|
|
1200
|
+
initialSearchText,
|
|
1201
|
+
pdfViewerRef.current,
|
|
1202
|
+
hasExecutedInitialSearch.current,
|
|
1203
|
+
"state:",
|
|
1204
|
+
state,
|
|
1205
|
+
"totalPages:",
|
|
1206
|
+
totalPages
|
|
1207
|
+
);
|
|
1208
|
+
if (!initialSearchText || hasExecutedInitialSearch.current) return;
|
|
1209
|
+
const isPDFReady = state === "ready";
|
|
1210
|
+
const isPagesInitialized = totalPages > 0;
|
|
1211
|
+
const isViewerAvailable = !!pdfViewerRef.current;
|
|
1212
|
+
const isSearchAPIReady = !!_optionalChain([pdfViewerRef, 'access', _87 => _87.current, 'optionalAccess', _88 => _88.search, 'optionalAccess', _89 => _89.searchText]);
|
|
1213
|
+
const canExecuteSearch = isPDFReady && isPagesInitialized && isViewerAvailable && isSearchAPIReady;
|
|
1214
|
+
if (!canExecuteSearch) return;
|
|
1215
|
+
hasExecutedInitialSearch.current = true;
|
|
1216
|
+
const SEARCH_INITIALIZATION_DELAY = 100;
|
|
1217
|
+
setTimeout(() => {
|
|
1218
|
+
if (!_optionalChain([pdfViewerRef, 'access', _90 => _90.current, 'optionalAccess', _91 => _91.search, 'optionalAccess', _92 => _92.searchText])) {
|
|
1219
|
+
console.warn(
|
|
1220
|
+
"Search API became unavailable, skipping initial search"
|
|
1221
|
+
);
|
|
1222
|
+
hasExecutedInitialSearch.current = false;
|
|
1223
|
+
return;
|
|
1224
|
+
}
|
|
1225
|
+
requestAnimationFrame(() => {
|
|
1226
|
+
requestAnimationFrame(() => {
|
|
1227
|
+
setIsSidebarOpen(true);
|
|
1228
|
+
handleSidebarSearch(initialSearchText, initialSearchPages);
|
|
1229
|
+
setAutoExecuteSearch(false);
|
|
1230
|
+
});
|
|
1231
|
+
});
|
|
1232
|
+
}, SEARCH_INITIALIZATION_DELAY);
|
|
1233
|
+
}, [
|
|
1234
|
+
state,
|
|
1235
|
+
totalPages,
|
|
1236
|
+
pdfViewerRef.current,
|
|
1237
|
+
initialSearchText,
|
|
1238
|
+
initialSearchPages
|
|
1239
|
+
]);
|
|
1240
|
+
_react.useEffect.call(void 0, () => {
|
|
1241
|
+
setSearchQuery("");
|
|
1242
|
+
setSearchResults([]);
|
|
1243
|
+
setCurrentSearchResultIndex(0);
|
|
1244
|
+
setTotalSearchResults(0);
|
|
1245
|
+
setIsSearching(false);
|
|
1246
|
+
setIsSidebarOpen(false);
|
|
1247
|
+
hasExecutedInitialSearch.current = false;
|
|
1248
|
+
setCurrentPage(1);
|
|
1249
|
+
setTotalPages(0);
|
|
1250
|
+
setZoom(100);
|
|
1251
|
+
setState("idle");
|
|
1252
|
+
setError(null);
|
|
1253
|
+
setPdfBuffer(null);
|
|
1254
|
+
}, [file]);
|
|
1255
|
+
_react.useEffect.call(void 0, () => {
|
|
1256
|
+
if (state !== "ready") return;
|
|
1257
|
+
const container = document.querySelector(
|
|
1258
|
+
'[data-pdf-viewer], .embedpdf-viewport, [role="document"]'
|
|
1259
|
+
);
|
|
1260
|
+
if (container) {
|
|
1261
|
+
setPdfContainer(container);
|
|
1262
|
+
return;
|
|
1263
|
+
}
|
|
1264
|
+
const observer = new MutationObserver(() => {
|
|
1265
|
+
const foundContainer = document.querySelector(
|
|
1266
|
+
'[data-pdf-viewer], .embedpdf-viewport, [role="document"]'
|
|
1267
|
+
);
|
|
1268
|
+
if (foundContainer) {
|
|
1269
|
+
setPdfContainer(foundContainer);
|
|
1270
|
+
observer.disconnect();
|
|
1271
|
+
}
|
|
1272
|
+
});
|
|
1273
|
+
observer.observe(document.body, { childList: true, subtree: true });
|
|
1274
|
+
return () => observer.disconnect();
|
|
1275
|
+
}, [state]);
|
|
1276
|
+
_react.useEffect.call(void 0, () => {
|
|
1277
|
+
if (state !== "ready" || totalPages > 0) return;
|
|
1278
|
+
const initializePageCount = async () => {
|
|
1279
|
+
const waitForViewer = async (maxAttempts = 10) => {
|
|
1280
|
+
for (let i = 0; i < maxAttempts; i++) {
|
|
1281
|
+
if (pdfViewerRef.current) return pdfViewerRef.current;
|
|
1282
|
+
await new Promise(
|
|
1283
|
+
(resolve) => requestAnimationFrame(
|
|
1284
|
+
() => setTimeout(resolve, Math.min(100 * Math.pow(2, i), 1e3))
|
|
1285
|
+
)
|
|
1286
|
+
);
|
|
1287
|
+
}
|
|
1288
|
+
return null;
|
|
1289
|
+
};
|
|
1290
|
+
const viewer = await waitForViewer();
|
|
1291
|
+
if (!viewer) return;
|
|
1292
|
+
await new Promise((resolve) => requestAnimationFrame(resolve));
|
|
1293
|
+
try {
|
|
1294
|
+
const count = _optionalChain([viewer, 'access', _93 => _93.navigation, 'optionalAccess', _94 => _94.getTotalPages, 'optionalCall', _95 => _95()]);
|
|
1295
|
+
if (count && count > 1) {
|
|
1296
|
+
setTotalPages(count);
|
|
1297
|
+
return;
|
|
1298
|
+
}
|
|
1299
|
+
} catch (e) {
|
|
1300
|
+
}
|
|
1301
|
+
try {
|
|
1302
|
+
const results = await _optionalChain([viewer, 'access', _96 => _96.search, 'optionalAccess', _97 => _97.searchText, 'optionalCall', _98 => _98("e")]);
|
|
1303
|
+
if (_optionalChain([results, 'optionalAccess', _99 => _99.results]) && results.results.length > 0) {
|
|
1304
|
+
const pageIndices = results.results.map((m) => m.pageIndex).filter((idx) => typeof idx === "number");
|
|
1305
|
+
const count = Math.max(...pageIndices) + 1;
|
|
1306
|
+
_optionalChain([viewer, 'access', _100 => _100.search, 'optionalAccess', _101 => _101.stopSearch, 'optionalCall', _102 => _102()]);
|
|
1307
|
+
setTotalPages(count);
|
|
1308
|
+
return;
|
|
1309
|
+
}
|
|
1310
|
+
} catch (error2) {
|
|
1311
|
+
}
|
|
1312
|
+
await new Promise((resolve) => setTimeout(resolve, 200));
|
|
1313
|
+
try {
|
|
1314
|
+
const selectors = [
|
|
1315
|
+
"[data-page-index]",
|
|
1316
|
+
"[data-page-number]",
|
|
1317
|
+
".embedpdf-page",
|
|
1318
|
+
'[role="article"]',
|
|
1319
|
+
"canvas[data-page]",
|
|
1320
|
+
".react-pdf__Page"
|
|
1321
|
+
];
|
|
1322
|
+
for (const selector of selectors) {
|
|
1323
|
+
const pages = document.querySelectorAll(selector);
|
|
1324
|
+
if (pages.length > 0) {
|
|
1325
|
+
setTotalPages(pages.length);
|
|
1326
|
+
return;
|
|
1327
|
+
}
|
|
1328
|
+
}
|
|
1329
|
+
} catch (error2) {
|
|
1330
|
+
}
|
|
1331
|
+
try {
|
|
1332
|
+
const count = _optionalChain([viewer, 'access', _103 => _103.navigation, 'optionalAccess', _104 => _104.getTotalPages, 'optionalCall', _105 => _105()]);
|
|
1333
|
+
if (count && count > 0) {
|
|
1334
|
+
setTotalPages(count);
|
|
1335
|
+
return;
|
|
1336
|
+
}
|
|
1337
|
+
} catch (e) {
|
|
1338
|
+
}
|
|
1339
|
+
console.warn(
|
|
1340
|
+
"Could not determine total pages, using fallback value of 1"
|
|
1341
|
+
);
|
|
1342
|
+
setTotalPages(1);
|
|
1343
|
+
};
|
|
1344
|
+
initializePageCount();
|
|
1345
|
+
}, [state, totalPages]);
|
|
1346
|
+
_react.useEffect.call(void 0, () => {
|
|
1347
|
+
if (state === "ready" && pdfViewerRef.current) {
|
|
1348
|
+
const updateInfo = () => {
|
|
1349
|
+
const current = _optionalChain([pdfViewerRef, 'access', _106 => _106.current, 'optionalAccess', _107 => _107.navigation, 'access', _108 => _108.getCurrentPage, 'call', _109 => _109()]) || 1;
|
|
1350
|
+
const total = _optionalChain([pdfViewerRef, 'access', _110 => _110.current, 'optionalAccess', _111 => _111.navigation, 'access', _112 => _112.getTotalPages, 'call', _113 => _113()]) || 0;
|
|
1351
|
+
const zoomValue = _optionalChain([pdfViewerRef, 'access', _114 => _114.current, 'optionalAccess', _115 => _115.zoom, 'access', _116 => _116.getZoom, 'call', _117 => _117()]);
|
|
1352
|
+
const currentSearchState = _optionalChain([pdfViewerRef, 'access', _118 => _118.current, 'optionalAccess', _119 => _119.search, 'access', _120 => _120.getSearchState, 'call', _121 => _121()]);
|
|
1353
|
+
setCurrentPage(current);
|
|
1354
|
+
if (total > 0 && total !== totalPages) {
|
|
1355
|
+
setTotalPages(total);
|
|
1356
|
+
}
|
|
1357
|
+
if (typeof zoomValue === "number") {
|
|
1358
|
+
setZoom(Math.round(zoomValue * 100));
|
|
1359
|
+
}
|
|
1360
|
+
};
|
|
1361
|
+
updateInfo();
|
|
1362
|
+
const interval = setInterval(updateInfo, 300);
|
|
1363
|
+
return () => clearInterval(interval);
|
|
1364
|
+
}
|
|
1365
|
+
}, [state, totalPages]);
|
|
1366
|
+
_react.useImperativeHandle.call(void 0,
|
|
1367
|
+
ref,
|
|
1368
|
+
() => ({
|
|
1369
|
+
zoomIn: () => {
|
|
1370
|
+
_optionalChain([pdfViewerRef, 'access', _122 => _122.current, 'optionalAccess', _123 => _123.zoom, 'access', _124 => _124.zoomIn, 'call', _125 => _125()]);
|
|
1371
|
+
updateZoomDisplay();
|
|
1372
|
+
},
|
|
1373
|
+
zoomOut: () => {
|
|
1374
|
+
_optionalChain([pdfViewerRef, 'access', _126 => _126.current, 'optionalAccess', _127 => _127.zoom, 'access', _128 => _128.zoomOut, 'call', _129 => _129()]);
|
|
1375
|
+
updateZoomDisplay();
|
|
1376
|
+
},
|
|
1377
|
+
setZoom: (level) => {
|
|
1378
|
+
_optionalChain([pdfViewerRef, 'access', _130 => _130.current, 'optionalAccess', _131 => _131.zoom, 'access', _132 => _132.setZoom, 'call', _133 => _133(level)]);
|
|
1379
|
+
updateZoomDisplay();
|
|
1380
|
+
},
|
|
1381
|
+
resetZoom: () => {
|
|
1382
|
+
_optionalChain([pdfViewerRef, 'access', _134 => _134.current, 'optionalAccess', _135 => _135.zoom, 'access', _136 => _136.resetZoom, 'call', _137 => _137()]);
|
|
1383
|
+
updateZoomDisplay();
|
|
1384
|
+
},
|
|
1385
|
+
getZoom: () => {
|
|
1386
|
+
const zoom2 = _optionalChain([pdfViewerRef, 'access', _138 => _138.current, 'optionalAccess', _139 => _139.zoom, 'access', _140 => _140.getZoom, 'call', _141 => _141()]);
|
|
1387
|
+
return typeof zoom2 === "number" ? zoom2 : 1;
|
|
1388
|
+
},
|
|
1389
|
+
goToPage: (page) => {
|
|
1390
|
+
_optionalChain([pdfViewerRef, 'access', _142 => _142.current, 'optionalAccess', _143 => _143.navigation, 'access', _144 => _144.goToPage, 'call', _145 => _145(page)]);
|
|
1391
|
+
setCurrentPage(page);
|
|
1392
|
+
},
|
|
1393
|
+
getCurrentPage: () => _optionalChain([pdfViewerRef, 'access', _146 => _146.current, 'optionalAccess', _147 => _147.navigation, 'access', _148 => _148.getCurrentPage, 'call', _149 => _149()]) || 1,
|
|
1394
|
+
getTotalPages: () => _optionalChain([pdfViewerRef, 'access', _150 => _150.current, 'optionalAccess', _151 => _151.navigation, 'access', _152 => _152.getTotalPages, 'call', _153 => _153()]) || 0,
|
|
1395
|
+
nextPage: () => {
|
|
1396
|
+
_optionalChain([pdfViewerRef, 'access', _154 => _154.current, 'optionalAccess', _155 => _155.navigation, 'access', _156 => _156.nextPage, 'call', _157 => _157()]);
|
|
1397
|
+
updatePageDisplay();
|
|
1398
|
+
},
|
|
1399
|
+
previousPage: () => {
|
|
1400
|
+
_optionalChain([pdfViewerRef, 'access', _158 => _158.current, 'optionalAccess', _159 => _159.navigation, 'access', _160 => _160.previousPage, 'call', _161 => _161()]);
|
|
1401
|
+
updatePageDisplay();
|
|
1402
|
+
},
|
|
1403
|
+
goToFirstPage: () => {
|
|
1404
|
+
_optionalChain([pdfViewerRef, 'access', _162 => _162.current, 'optionalAccess', _163 => _163.navigation, 'access', _164 => _164.goToFirstPage, 'call', _165 => _165()]);
|
|
1405
|
+
updatePageDisplay();
|
|
1406
|
+
},
|
|
1407
|
+
goToLastPage: () => {
|
|
1408
|
+
_optionalChain([pdfViewerRef, 'access', _166 => _166.current, 'optionalAccess', _167 => _167.navigation, 'access', _168 => _168.goToLastPage, 'call', _169 => _169()]);
|
|
1409
|
+
updatePageDisplay();
|
|
1410
|
+
},
|
|
1411
|
+
searchText: async (keyword) => {
|
|
1412
|
+
setIsSearching(true);
|
|
1413
|
+
const results = await _optionalChain([pdfViewerRef, 'access', _170 => _170.current, 'optionalAccess', _171 => _171.search, 'access', _172 => _172.searchText, 'call', _173 => _173(
|
|
1414
|
+
keyword
|
|
1415
|
+
)]);
|
|
1416
|
+
setIsSearching(false);
|
|
1417
|
+
setSearchQuery(keyword);
|
|
1418
|
+
return results;
|
|
1419
|
+
},
|
|
1420
|
+
nextResult: () => {
|
|
1421
|
+
const index = _optionalChain([pdfViewerRef, 'access', _174 => _174.current, 'optionalAccess', _175 => _175.search, 'access', _176 => _176.nextResult, 'call', _177 => _177()]) || -1;
|
|
1422
|
+
return index;
|
|
1423
|
+
},
|
|
1424
|
+
previousResult: () => {
|
|
1425
|
+
const index = _optionalChain([pdfViewerRef, 'access', _178 => _178.current, 'optionalAccess', _179 => _179.search, 'access', _180 => _180.previousResult, 'call', _181 => _181()]) || -1;
|
|
1426
|
+
return index;
|
|
1427
|
+
},
|
|
1428
|
+
goToResult: (index) => _optionalChain([pdfViewerRef, 'access', _182 => _182.current, 'optionalAccess', _183 => _183.search, 'access', _184 => _184.goToResult, 'call', _185 => _185(index)]) || -1,
|
|
1429
|
+
stopSearch: () => {
|
|
1430
|
+
_optionalChain([pdfViewerRef, 'access', _186 => _186.current, 'optionalAccess', _187 => _187.search, 'access', _188 => _188.stopSearch, 'call', _189 => _189()]);
|
|
1431
|
+
setSearchQuery("");
|
|
1432
|
+
},
|
|
1433
|
+
getSearchState: () => _optionalChain([pdfViewerRef, 'access', _190 => _190.current, 'optionalAccess', _191 => _191.search, 'access', _192 => _192.getSearchState, 'call', _193 => _193()]) || null,
|
|
1434
|
+
getSelectedText: () => _optionalChain([pdfViewerRef, 'access', _194 => _194.current, 'optionalAccess', _195 => _195.selection, 'access', _196 => _196.getSelectedText, 'call', _197 => _197()]) || "",
|
|
1435
|
+
clearSelection: () => _optionalChain([pdfViewerRef, 'access', _198 => _198.current, 'optionalAccess', _199 => _199.selection, 'access', _200 => _200.clearSelection, 'call', _201 => _201()]),
|
|
1436
|
+
rotateForward: () => _optionalChain([pdfViewerRef, 'access', _202 => _202.current, 'optionalAccess', _203 => _203.rotate, 'optionalAccess', _204 => _204.rotateForward, 'call', _205 => _205()]),
|
|
1437
|
+
rotateBackward: () => _optionalChain([pdfViewerRef, 'access', _206 => _206.current, 'optionalAccess', _207 => _207.rotate, 'optionalAccess', _208 => _208.rotateBackward, 'call', _209 => _209()]),
|
|
1438
|
+
getRotation: () => _optionalChain([pdfViewerRef, 'access', _210 => _210.current, 'optionalAccess', _211 => _211.rotate, 'optionalAccess', _212 => _212.getRotation, 'call', _213 => _213()]) || 0
|
|
1439
|
+
}),
|
|
1440
|
+
[]
|
|
1441
|
+
);
|
|
1442
|
+
const updatePageDisplay = () => {
|
|
1443
|
+
requestAnimationFrame(() => {
|
|
1444
|
+
const current = _optionalChain([pdfViewerRef, 'access', _214 => _214.current, 'optionalAccess', _215 => _215.navigation, 'access', _216 => _216.getCurrentPage, 'call', _217 => _217()]) || 1;
|
|
1445
|
+
setCurrentPage(current);
|
|
1446
|
+
});
|
|
1447
|
+
};
|
|
1448
|
+
const updateZoomDisplay = () => {
|
|
1449
|
+
requestAnimationFrame(() => {
|
|
1450
|
+
const zoomValue = _optionalChain([pdfViewerRef, 'access', _218 => _218.current, 'optionalAccess', _219 => _219.zoom, 'access', _220 => _220.getZoom, 'call', _221 => _221()]);
|
|
1451
|
+
if (typeof zoomValue === "number") {
|
|
1452
|
+
setZoom(Math.round(zoomValue * 100));
|
|
1453
|
+
}
|
|
1454
|
+
});
|
|
1455
|
+
};
|
|
1456
|
+
const handleSearch = async () => {
|
|
1457
|
+
if (!searchQuery.trim()) return;
|
|
1458
|
+
setIsSearching(true);
|
|
1459
|
+
const results = await _optionalChain([pdfViewerRef, 'access', _222 => _222.current, 'optionalAccess', _223 => _223.search, 'access', _224 => _224.searchText, 'call', _225 => _225(
|
|
1460
|
+
searchQuery
|
|
1461
|
+
)]);
|
|
1462
|
+
setIsSearching(false);
|
|
1463
|
+
if (_optionalChain([results, 'optionalAccess', _226 => _226.results]) && Array.isArray(results.results) && results.results.length > 0) {
|
|
1464
|
+
const formattedResults = formatSearchResults(results.results);
|
|
1465
|
+
updateSearchState(formattedResults);
|
|
1466
|
+
} else {
|
|
1467
|
+
clearSearchResults();
|
|
1468
|
+
}
|
|
1469
|
+
};
|
|
1470
|
+
const handleSearchKeyPress = (e) => {
|
|
1471
|
+
if (e.key === "Enter") {
|
|
1472
|
+
handleSearch();
|
|
1473
|
+
}
|
|
1474
|
+
};
|
|
1475
|
+
const handleSidebarSearch = async (keyword, pageNumbers) => {
|
|
1476
|
+
setSearchQuery(keyword);
|
|
1477
|
+
if (!keyword.trim()) {
|
|
1478
|
+
setSearchResults([]);
|
|
1479
|
+
setTotalSearchResults(0);
|
|
1480
|
+
setCurrentSearchResultIndex(0);
|
|
1481
|
+
_optionalChain([pdfViewerRef, 'access', _227 => _227.current, 'optionalAccess', _228 => _228.search, 'access', _229 => _229.stopSearch, 'call', _230 => _230()]);
|
|
1482
|
+
return;
|
|
1483
|
+
}
|
|
1484
|
+
if (!_optionalChain([pdfViewerRef, 'access', _231 => _231.current, 'optionalAccess', _232 => _232.search, 'optionalAccess', _233 => _233.searchText])) {
|
|
1485
|
+
console.warn("Search functionality not yet available");
|
|
1486
|
+
return;
|
|
1487
|
+
}
|
|
1488
|
+
setIsSearching(true);
|
|
1489
|
+
try {
|
|
1490
|
+
const results = await pdfViewerRef.current.search.searchText(keyword);
|
|
1491
|
+
console.log("Search completed:", results);
|
|
1492
|
+
setIsSearching(false);
|
|
1493
|
+
const hasValidResults = _optionalChain([results, 'optionalAccess', _234 => _234.results]) && Array.isArray(results.results) && results.results.length > 0;
|
|
1494
|
+
if (hasValidResults) {
|
|
1495
|
+
const formattedResults = formatSearchResults(results.results);
|
|
1496
|
+
updateSearchState(formattedResults);
|
|
1497
|
+
navigateToFirstResult(formattedResults);
|
|
1498
|
+
} else if (pageNumbers && pageNumbers.length > 0) {
|
|
1499
|
+
const fallbackResults = createFallbackResults(pageNumbers, keyword);
|
|
1500
|
+
updateSearchState(fallbackResults);
|
|
1501
|
+
navigateToPage(pageNumbers[0]);
|
|
1502
|
+
} else {
|
|
1503
|
+
clearSearchResults();
|
|
1504
|
+
}
|
|
1505
|
+
} catch (error2) {
|
|
1506
|
+
console.error("Search failed:", error2);
|
|
1507
|
+
setIsSearching(false);
|
|
1508
|
+
clearSearchResults();
|
|
1509
|
+
}
|
|
1510
|
+
};
|
|
1511
|
+
const formatSearchResults = (results) => {
|
|
1512
|
+
return results.map((result, index) => {
|
|
1513
|
+
let textContent = "";
|
|
1514
|
+
let contextContent = "";
|
|
1515
|
+
if (result.context && typeof result.context === "object") {
|
|
1516
|
+
const { before = "", match = "", after = "" } = result.context;
|
|
1517
|
+
textContent = match;
|
|
1518
|
+
contextContent = `${before}${match}${after}`;
|
|
1519
|
+
} else if (typeof result === "string") {
|
|
1520
|
+
textContent = result;
|
|
1521
|
+
contextContent = result;
|
|
1522
|
+
} else {
|
|
1523
|
+
textContent = String(result.match || result.text || "");
|
|
1524
|
+
contextContent = textContent;
|
|
1525
|
+
}
|
|
1526
|
+
return {
|
|
1527
|
+
pageNumber: (_nullishCoalesce(_nullishCoalesce(result.pageIndex, () => ( result.pageNumber)), () => ( 0))) + 1,
|
|
1528
|
+
text: textContent,
|
|
1529
|
+
context: contextContent,
|
|
1530
|
+
index
|
|
1531
|
+
};
|
|
1532
|
+
});
|
|
1533
|
+
};
|
|
1534
|
+
const createFallbackResults = (pageNumbers, keyword) => {
|
|
1535
|
+
return pageNumbers.map((pageNum, index) => ({
|
|
1536
|
+
pageNumber: pageNum,
|
|
1537
|
+
text: keyword,
|
|
1538
|
+
context: `"${keyword}" found on this page ${pageNum}`,
|
|
1539
|
+
index
|
|
1540
|
+
}));
|
|
1541
|
+
};
|
|
1542
|
+
const updateSearchState = (results) => {
|
|
1543
|
+
setSearchResults(results);
|
|
1544
|
+
setTotalSearchResults(results.length);
|
|
1545
|
+
setCurrentSearchResultIndex(0);
|
|
1546
|
+
};
|
|
1547
|
+
const clearSearchResults = () => {
|
|
1548
|
+
setSearchResults([]);
|
|
1549
|
+
setTotalSearchResults(0);
|
|
1550
|
+
setCurrentSearchResultIndex(0);
|
|
1551
|
+
};
|
|
1552
|
+
const navigateToFirstResult = (results) => {
|
|
1553
|
+
if (results.length > 0) {
|
|
1554
|
+
navigateToPage(results[0].pageNumber);
|
|
1555
|
+
}
|
|
1556
|
+
};
|
|
1557
|
+
const navigateToPage = (pageNumber) => {
|
|
1558
|
+
requestAnimationFrame(() => {
|
|
1559
|
+
_optionalChain([pdfViewerRef, 'access', _235 => _235.current, 'optionalAccess', _236 => _236.navigation, 'access', _237 => _237.goToPage, 'call', _238 => _238(pageNumber)]);
|
|
1560
|
+
setCurrentPage(pageNumber);
|
|
1561
|
+
});
|
|
1562
|
+
};
|
|
1563
|
+
const handleSearchResultClick = (pageNumber, resultIndex) => {
|
|
1564
|
+
_optionalChain([pdfViewerRef, 'access', _239 => _239.current, 'optionalAccess', _240 => _240.navigation, 'access', _241 => _241.goToPage, 'call', _242 => _242(pageNumber)]);
|
|
1565
|
+
setCurrentSearchResultIndex(resultIndex);
|
|
1566
|
+
setCurrentPage(pageNumber);
|
|
1567
|
+
_optionalChain([pdfViewerRef, 'access', _243 => _243.current, 'optionalAccess', _244 => _244.search, 'access', _245 => _245.goToResult, 'call', _246 => _246(resultIndex)]);
|
|
1568
|
+
};
|
|
1569
|
+
const handleNextSearchResult = () => {
|
|
1570
|
+
if (currentSearchResultIndex < totalSearchResults - 1) {
|
|
1571
|
+
const nextIndex = currentSearchResultIndex + 1;
|
|
1572
|
+
setCurrentSearchResultIndex(nextIndex);
|
|
1573
|
+
_optionalChain([pdfViewerRef, 'access', _247 => _247.current, 'optionalAccess', _248 => _248.search, 'access', _249 => _249.nextResult, 'call', _250 => _250()]);
|
|
1574
|
+
if (searchResults[nextIndex]) {
|
|
1575
|
+
const pageNumber = searchResults[nextIndex].pageNumber;
|
|
1576
|
+
_optionalChain([pdfViewerRef, 'access', _251 => _251.current, 'optionalAccess', _252 => _252.navigation, 'access', _253 => _253.goToPage, 'call', _254 => _254(pageNumber)]);
|
|
1577
|
+
setCurrentPage(pageNumber);
|
|
1578
|
+
}
|
|
1579
|
+
}
|
|
1580
|
+
};
|
|
1581
|
+
const handlePreviousSearchResult = () => {
|
|
1582
|
+
if (currentSearchResultIndex > 0) {
|
|
1583
|
+
const prevIndex = currentSearchResultIndex - 1;
|
|
1584
|
+
setCurrentSearchResultIndex(prevIndex);
|
|
1585
|
+
_optionalChain([pdfViewerRef, 'access', _255 => _255.current, 'optionalAccess', _256 => _256.search, 'access', _257 => _257.previousResult, 'call', _258 => _258()]);
|
|
1586
|
+
if (searchResults[prevIndex]) {
|
|
1587
|
+
const pageNumber = searchResults[prevIndex].pageNumber;
|
|
1588
|
+
_optionalChain([pdfViewerRef, 'access', _259 => _259.current, 'optionalAccess', _260 => _260.navigation, 'access', _261 => _261.goToPage, 'call', _262 => _262(pageNumber)]);
|
|
1589
|
+
setCurrentPage(pageNumber);
|
|
1590
|
+
}
|
|
1591
|
+
}
|
|
1592
|
+
};
|
|
1593
|
+
_react.useEffect.call(void 0, () => {
|
|
1594
|
+
if (!file) {
|
|
1595
|
+
setState("error");
|
|
1596
|
+
setError("No file provided");
|
|
1597
|
+
return;
|
|
1598
|
+
}
|
|
1599
|
+
const loadPDF = async () => {
|
|
1600
|
+
try {
|
|
1601
|
+
setState("loading");
|
|
1602
|
+
setError(null);
|
|
1603
|
+
let arrayBuffer;
|
|
1604
|
+
if (file instanceof File) {
|
|
1605
|
+
arrayBuffer = await file.arrayBuffer();
|
|
1606
|
+
} else if (typeof file === "string") {
|
|
1607
|
+
const response = await fetch(file);
|
|
1608
|
+
if (!response.ok) {
|
|
1609
|
+
throw new Error(`Failed to load PDF: ${response.statusText}`);
|
|
1610
|
+
}
|
|
1611
|
+
arrayBuffer = await response.arrayBuffer();
|
|
1612
|
+
} else if (file instanceof ArrayBuffer) {
|
|
1613
|
+
arrayBuffer = file;
|
|
1614
|
+
} else {
|
|
1615
|
+
throw new Error("Unsupported file type");
|
|
1616
|
+
}
|
|
1617
|
+
setPdfBuffer(arrayBuffer);
|
|
1618
|
+
setState("ready");
|
|
1619
|
+
_optionalChain([onLoad, 'optionalCall', _263 => _263()]);
|
|
1620
|
+
} catch (err) {
|
|
1621
|
+
const errorMessage = err.message || "Failed to load PDF";
|
|
1622
|
+
setState("error");
|
|
1623
|
+
setError(errorMessage);
|
|
1624
|
+
_optionalChain([onError, 'optionalCall', _264 => _264(err)]);
|
|
1625
|
+
}
|
|
1626
|
+
};
|
|
1627
|
+
loadPDF();
|
|
1628
|
+
}, [file, onLoad, onError]);
|
|
1629
|
+
const handlePasswordRequest = _react.useCallback.call(void 0,
|
|
1630
|
+
async (fileName2) => {
|
|
1631
|
+
return new Promise((resolve) => {
|
|
1632
|
+
setPasswordResolve(() => resolve);
|
|
1633
|
+
setPasswordError("");
|
|
1634
|
+
setIsPasswordDialogOpen(true);
|
|
1635
|
+
});
|
|
1636
|
+
},
|
|
1637
|
+
[]
|
|
1638
|
+
);
|
|
1639
|
+
const handlePasswordSubmit = _react.useCallback.call(void 0,
|
|
1640
|
+
(password) => {
|
|
1641
|
+
if (passwordResolve) {
|
|
1642
|
+
passwordResolve(password);
|
|
1643
|
+
setPasswordResolve(null);
|
|
1644
|
+
setIsPasswordDialogOpen(false);
|
|
1645
|
+
setPasswordError("");
|
|
1646
|
+
}
|
|
1647
|
+
},
|
|
1648
|
+
[passwordResolve]
|
|
1649
|
+
);
|
|
1650
|
+
const handlePasswordCancel = _react.useCallback.call(void 0, () => {
|
|
1651
|
+
if (passwordResolve) {
|
|
1652
|
+
passwordResolve(null);
|
|
1653
|
+
setPasswordResolve(null);
|
|
1654
|
+
setIsPasswordDialogOpen(false);
|
|
1655
|
+
setPasswordError("");
|
|
1656
|
+
}
|
|
1657
|
+
}, [passwordResolve]);
|
|
1658
|
+
if (state === "loading") {
|
|
1659
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1660
|
+
"div",
|
|
1661
|
+
{
|
|
1662
|
+
style: {
|
|
1663
|
+
display: "flex",
|
|
1664
|
+
flexDirection: "column",
|
|
1665
|
+
alignItems: "center",
|
|
1666
|
+
justifyContent: "center",
|
|
1667
|
+
height: "100%",
|
|
1668
|
+
gap: "16px"
|
|
1669
|
+
},
|
|
1670
|
+
children: [
|
|
1671
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1672
|
+
"div",
|
|
1673
|
+
{
|
|
1674
|
+
className: "spinner",
|
|
1675
|
+
style: {
|
|
1676
|
+
width: "48px",
|
|
1677
|
+
height: "48px",
|
|
1678
|
+
border: "4px solid #f3f3f3",
|
|
1679
|
+
borderTop: "4px solid #3498db",
|
|
1680
|
+
borderRadius: "50%",
|
|
1681
|
+
animation: "spin 1s linear infinite"
|
|
1682
|
+
}
|
|
1683
|
+
}
|
|
1684
|
+
),
|
|
1685
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { children: "Loading PDF..." }),
|
|
1686
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "style", { children: `
|
|
1687
|
+
@keyframes spin {
|
|
1688
|
+
0% { transform: rotate(0deg); }
|
|
1689
|
+
100% { transform: rotate(360deg); }
|
|
1690
|
+
}
|
|
1691
|
+
` })
|
|
1692
|
+
]
|
|
1693
|
+
}
|
|
1694
|
+
);
|
|
1695
|
+
}
|
|
1696
|
+
if (state === "error" || error) {
|
|
1697
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1698
|
+
"div",
|
|
1699
|
+
{
|
|
1700
|
+
style: {
|
|
1701
|
+
display: "flex",
|
|
1702
|
+
flexDirection: "column",
|
|
1703
|
+
alignItems: "center",
|
|
1704
|
+
justifyContent: "center",
|
|
1705
|
+
height: "100%",
|
|
1706
|
+
padding: "24px"
|
|
1707
|
+
},
|
|
1708
|
+
children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1709
|
+
"div",
|
|
1710
|
+
{
|
|
1711
|
+
style: {
|
|
1712
|
+
maxWidth: "400px",
|
|
1713
|
+
padding: "16px",
|
|
1714
|
+
backgroundColor: "#fee",
|
|
1715
|
+
border: "1px solid #fcc",
|
|
1716
|
+
borderRadius: "4px"
|
|
1717
|
+
},
|
|
1718
|
+
children: [
|
|
1719
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { style: { marginTop: 0 }, children: "Failed to Load PDF" }),
|
|
1720
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { children: error || "Unknown error occurred" })
|
|
1721
|
+
]
|
|
1722
|
+
}
|
|
1723
|
+
)
|
|
1724
|
+
}
|
|
1725
|
+
);
|
|
1726
|
+
}
|
|
1727
|
+
if (!pdfBuffer || state !== "ready") {
|
|
1728
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1729
|
+
"div",
|
|
1730
|
+
{
|
|
1731
|
+
style: {
|
|
1732
|
+
display: "flex",
|
|
1733
|
+
alignItems: "center",
|
|
1734
|
+
justifyContent: "center",
|
|
1735
|
+
height: "100%"
|
|
1736
|
+
},
|
|
1737
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { children: "Preparing PDF..." })
|
|
1738
|
+
}
|
|
1739
|
+
);
|
|
1740
|
+
}
|
|
1741
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { ref: containerRef, className: "pdf-viewer-container", children: [
|
|
1742
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "style", { children: _chunkA2MSWOEMjs.toolbarStyles }),
|
|
1743
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, PDFHeader, { fileName: resolvedFileName, fileExtension }),
|
|
1744
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1745
|
+
PDFToolbar,
|
|
1746
|
+
{
|
|
1747
|
+
currentPage,
|
|
1748
|
+
totalPages,
|
|
1749
|
+
zoom,
|
|
1750
|
+
isSidebarOpen,
|
|
1751
|
+
showPageNavigation,
|
|
1752
|
+
showPageCount,
|
|
1753
|
+
showZoomControls,
|
|
1754
|
+
showSearch,
|
|
1755
|
+
showRotation: !toolbar.isHidden("rotation"),
|
|
1756
|
+
showMetadata: !toolbar.isHidden("metadata"),
|
|
1757
|
+
showProperties: !toolbar.isHidden("properties"),
|
|
1758
|
+
showDownload: !toolbar.isHidden("download"),
|
|
1759
|
+
showPrint: !toolbar.isHidden("print"),
|
|
1760
|
+
showTags: !toolbar.isHidden("tags"),
|
|
1761
|
+
disabledRotateLeft: toolbar.isDisabled("rotateLeft"),
|
|
1762
|
+
disabledRotateRight: toolbar.isDisabled("rotateRight"),
|
|
1763
|
+
disabledMetadata: toolbar.isDisabled("metadata"),
|
|
1764
|
+
disabledTags: toolbar.isDisabled("tags"),
|
|
1765
|
+
disabledProperties: toolbar.isDisabled("properties"),
|
|
1766
|
+
disabledDownload: toolbar.isDisabled("download"),
|
|
1767
|
+
disabledPrint: toolbar.isDisabled("print"),
|
|
1768
|
+
onFirstPage: toolbarHandlers.handleFirstPage,
|
|
1769
|
+
onPreviousPage: toolbarHandlers.handlePreviousPage,
|
|
1770
|
+
onNextPage: toolbarHandlers.handleNextPage,
|
|
1771
|
+
onLastPage: toolbarHandlers.handleLastPage,
|
|
1772
|
+
onPageInput: toolbarHandlers.handlePageInput,
|
|
1773
|
+
onPageInputKeyPress: toolbarHandlers.handlePageInputKeyPress,
|
|
1774
|
+
onZoomIn: toolbarHandlers.handleZoomIn,
|
|
1775
|
+
onZoomOut: toolbarHandlers.handleZoomOut,
|
|
1776
|
+
onFitToWidth: toolbarHandlers.handleFitToWidth,
|
|
1777
|
+
onFitToPage: toolbarHandlers.handleFitToPage,
|
|
1778
|
+
onToggleSidebar: toolbarHandlers.toggleSidebar,
|
|
1779
|
+
onToggleFullScreen: toolbarHandlers.handleToggleFullScreen,
|
|
1780
|
+
onRotateLeft: toolbarHandlers.handleRotateLeft,
|
|
1781
|
+
onRotateRight: toolbarHandlers.handleRotateRight,
|
|
1782
|
+
onDownloadClick: toolbar.getHandler("download", onDownloadClick),
|
|
1783
|
+
onPrintClick: toolbar.getHandler("print", onPrintClick),
|
|
1784
|
+
onMetadataClick: toolbar.getHandler("metadata", onMetadataClick),
|
|
1785
|
+
onPropertiesClick: toolbar.getHandler(
|
|
1786
|
+
"properties",
|
|
1787
|
+
onPropertiesClick
|
|
1788
|
+
),
|
|
1789
|
+
onTagsClick: toolbar.getHandler("tags", onTagsClick)
|
|
1790
|
+
}
|
|
1791
|
+
),
|
|
1792
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "pdf-viewer-main", children: [
|
|
1793
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "pdf-viewer-viewer-area", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1794
|
+
StablePDFViewer,
|
|
1795
|
+
{
|
|
1796
|
+
pdfBuffer,
|
|
1797
|
+
onPasswordRequest: handlePasswordRequest,
|
|
1798
|
+
pdfViewerRef
|
|
1799
|
+
}
|
|
1800
|
+
) }),
|
|
1801
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1802
|
+
SearchSidebar,
|
|
1803
|
+
{
|
|
1804
|
+
isOpen: isSidebarOpen,
|
|
1805
|
+
onClose: handleSidebarClose,
|
|
1806
|
+
onSearch: handleSidebarSearch,
|
|
1807
|
+
onSearchResultClick: handleSearchResultClick,
|
|
1808
|
+
onNextResult: handleNextSearchResult,
|
|
1809
|
+
onPreviousResult: handlePreviousSearchResult,
|
|
1810
|
+
currentResultIndex: currentSearchResultIndex,
|
|
1811
|
+
totalResults: totalSearchResults,
|
|
1812
|
+
searchKeyword: searchQuery,
|
|
1813
|
+
searchResults,
|
|
1814
|
+
isSearching
|
|
1815
|
+
}
|
|
1816
|
+
)
|
|
1817
|
+
] }),
|
|
1818
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1819
|
+
PasswordDialog,
|
|
1820
|
+
{
|
|
1821
|
+
open: isPasswordDialogOpen,
|
|
1822
|
+
fileName: resolvedFileName,
|
|
1823
|
+
onSubmit: handlePasswordSubmit,
|
|
1824
|
+
onCancel: handlePasswordCancel,
|
|
1825
|
+
error: passwordError
|
|
1826
|
+
}
|
|
1827
|
+
)
|
|
1828
|
+
] });
|
|
1829
|
+
}
|
|
1830
|
+
);
|
|
1831
|
+
PDFViewerContent.displayName = "PDFViewerContent";
|
|
1832
|
+
var PDFViewer = _react.forwardRef.call(void 0,
|
|
1833
|
+
(props, ref) => {
|
|
1834
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PDFViewerContent, { ...props, sourceDescription: "doc.pdf", ref });
|
|
1835
|
+
}
|
|
1836
|
+
);
|
|
1837
|
+
PDFViewer.displayName = "PDFViewer";
|
|
1838
|
+
|
|
1839
|
+
|
|
1840
|
+
|
|
1841
|
+
exports.PDFViewer = PDFViewer;
|
|
1842
|
+
//# sourceMappingURL=chunk-XWWMHRVU.js.map
|