@cannymindstech/file-viewers 0.28.0 → 0.28.1
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-2BLHLWNN.js +299 -0
- package/dist/chunk-2BLHLWNN.js.map +1 -0
- package/dist/chunk-4HVU224A.js +2454 -0
- package/dist/chunk-4HVU224A.js.map +1 -0
- package/dist/chunk-6BRYDA3B.js +329 -0
- package/dist/chunk-6BRYDA3B.js.map +1 -0
- package/dist/chunk-6L72TJIW.mjs +2454 -0
- package/dist/chunk-6L72TJIW.mjs.map +1 -0
- package/dist/chunk-7PMZ4GN5.mjs +290 -0
- package/dist/chunk-7PMZ4GN5.mjs.map +1 -0
- package/dist/chunk-B5NNB4KD.mjs +268 -0
- package/dist/chunk-B5NNB4KD.mjs.map +1 -0
- package/dist/chunk-CIWCHSAA.js +309 -0
- package/dist/chunk-CIWCHSAA.js.map +1 -0
- package/dist/chunk-D7SDEVDM.js +268 -0
- package/dist/chunk-D7SDEVDM.js.map +1 -0
- package/dist/chunk-EKNP342T.mjs +299 -0
- package/dist/chunk-EKNP342T.mjs.map +1 -0
- package/dist/chunk-EM63H4SA.js +290 -0
- package/dist/chunk-EM63H4SA.js.map +1 -0
- package/dist/chunk-IJMNPAXX.mjs +309 -0
- package/dist/chunk-IJMNPAXX.mjs.map +1 -0
- package/dist/chunk-JKX5RSLF.mjs +871 -0
- package/dist/chunk-JKX5RSLF.mjs.map +1 -0
- package/dist/chunk-KJNOBIUZ.mjs +36 -0
- package/dist/chunk-KJNOBIUZ.mjs.map +1 -0
- package/dist/chunk-KQLIG6WK.js +871 -0
- package/dist/chunk-KQLIG6WK.js.map +1 -0
- package/dist/chunk-KWHXS7I4.mjs +615 -0
- package/dist/chunk-KWHXS7I4.mjs.map +1 -0
- package/dist/chunk-NELCZBZV.js +489 -0
- package/dist/chunk-NELCZBZV.js.map +1 -0
- package/dist/chunk-OPJOCUSL.js +36 -0
- package/dist/chunk-OPJOCUSL.js.map +1 -0
- package/dist/chunk-S5KXYKBX.js +615 -0
- package/dist/chunk-S5KXYKBX.js.map +1 -0
- package/dist/chunk-W2P6JHTQ.mjs +489 -0
- package/dist/chunk-W2P6JHTQ.mjs.map +1 -0
- package/dist/chunk-XJQ5J2UF.mjs +329 -0
- package/dist/chunk-XJQ5J2UF.mjs.map +1 -0
- package/dist/components/viewers/AudioViewer.d.mts +6 -0
- package/dist/components/viewers/AudioViewer.d.ts +6 -0
- package/dist/components/viewers/AudioViewer.js +10 -0
- package/dist/components/viewers/AudioViewer.js.map +1 -0
- package/dist/components/viewers/AudioViewer.mjs +10 -0
- package/dist/components/viewers/AudioViewer.mjs.map +1 -0
- package/dist/components/viewers/DefaultViewer.d.mts +6 -0
- package/dist/components/viewers/DefaultViewer.d.ts +6 -0
- package/dist/components/viewers/DefaultViewer.js +10 -0
- package/dist/components/viewers/DefaultViewer.js.map +1 -0
- package/dist/components/viewers/DefaultViewer.mjs +10 -0
- package/dist/components/viewers/DefaultViewer.mjs.map +1 -0
- package/dist/components/viewers/ImageViewer.d.mts +6 -0
- package/dist/components/viewers/ImageViewer.d.ts +6 -0
- package/dist/components/viewers/ImageViewer.js +10 -0
- package/dist/components/viewers/ImageViewer.js.map +1 -0
- package/dist/components/viewers/ImageViewer.mjs +10 -0
- package/dist/components/viewers/ImageViewer.mjs.map +1 -0
- package/dist/components/viewers/PDFViewer.d.mts +51 -0
- package/dist/components/viewers/PDFViewer.d.ts +51 -0
- package/dist/components/viewers/PDFViewer.js +11 -0
- package/dist/components/viewers/PDFViewer.js.map +1 -0
- package/dist/components/viewers/PDFViewer.mjs +11 -0
- package/dist/components/viewers/PDFViewer.mjs.map +1 -0
- package/dist/components/viewers/TIFFViewer.d.mts +6 -0
- package/dist/components/viewers/TIFFViewer.d.ts +6 -0
- package/dist/components/viewers/TIFFViewer.js +10 -0
- package/dist/components/viewers/TIFFViewer.js.map +1 -0
- package/dist/components/viewers/TIFFViewer.mjs +10 -0
- package/dist/components/viewers/TIFFViewer.mjs.map +1 -0
- package/dist/components/viewers/TextViewer.d.mts +6 -0
- package/dist/components/viewers/TextViewer.d.ts +6 -0
- package/dist/components/viewers/TextViewer.js +10 -0
- package/dist/components/viewers/TextViewer.js.map +1 -0
- package/dist/components/viewers/TextViewer.mjs +10 -0
- package/dist/components/viewers/TextViewer.mjs.map +1 -0
- package/dist/components/viewers/VideoViewer.d.mts +6 -0
- package/dist/components/viewers/VideoViewer.d.ts +6 -0
- package/dist/components/viewers/VideoViewer.js +10 -0
- package/dist/components/viewers/VideoViewer.js.map +1 -0
- package/dist/components/viewers/VideoViewer.mjs +10 -0
- package/dist/components/viewers/VideoViewer.mjs.map +1 -0
- package/dist/index.d.mts +75 -0
- package/dist/index.d.ts +75 -0
- package/dist/index.js +305 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +305 -0
- package/dist/index.mjs.map +1 -0
- package/dist/types-DMF9gANJ.d.mts +101 -0
- package/dist/types-DMF9gANJ.d.ts +101 -0
- package/package.json +3 -2
|
@@ -0,0 +1,2454 @@
|
|
|
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 _chunkS5KXYKBXjs = require('./chunk-S5KXYKBX.js');
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
var _chunkOPJOCUSLjs = require('./chunk-OPJOCUSL.js');
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
var _chunkEM63H4SAjs = require('./chunk-EM63H4SA.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('@cannymindstech/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
|
+
showAnnotations,
|
|
34
|
+
userDetails,
|
|
35
|
+
annotationSelectionMenu,
|
|
36
|
+
isHighlighterActive,
|
|
37
|
+
isStampActive,
|
|
38
|
+
onHighlighterClick,
|
|
39
|
+
onStampClick,
|
|
40
|
+
onSignatureClick,
|
|
41
|
+
onNoteClick,
|
|
42
|
+
permissions,
|
|
43
|
+
hideInternalLoading,
|
|
44
|
+
isAnnotationForeign,
|
|
45
|
+
onAnnotationNoteClick,
|
|
46
|
+
isAnnotationInteractive,
|
|
47
|
+
twoPageMode,
|
|
48
|
+
scrollStrategy
|
|
49
|
+
}) => {
|
|
50
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
51
|
+
HeadlessPDFViewer,
|
|
52
|
+
{
|
|
53
|
+
ref: pdfViewerRef,
|
|
54
|
+
pdfBuffer,
|
|
55
|
+
onPasswordRequest,
|
|
56
|
+
showAnnotations,
|
|
57
|
+
userDetails,
|
|
58
|
+
annotationSelectionMenu,
|
|
59
|
+
isHighlighterActive,
|
|
60
|
+
isStampActive,
|
|
61
|
+
onHighlighterClick,
|
|
62
|
+
onStampClick,
|
|
63
|
+
onSignatureClick,
|
|
64
|
+
onNoteClick,
|
|
65
|
+
permissions,
|
|
66
|
+
hideInternalLoading,
|
|
67
|
+
isAnnotationForeign,
|
|
68
|
+
onAnnotationNoteClick,
|
|
69
|
+
isAnnotationInteractive,
|
|
70
|
+
twoPageMode,
|
|
71
|
+
scrollStrategy
|
|
72
|
+
}
|
|
73
|
+
);
|
|
74
|
+
});
|
|
75
|
+
StablePDFViewer.displayName = "StablePDFViewer";
|
|
76
|
+
|
|
77
|
+
// src/components/viewers/pdf/PDFToolbar.tsx
|
|
78
|
+
|
|
79
|
+
var _material = require('@mui/material');
|
|
80
|
+
var _FirstPage = require('@mui/icons-material/FirstPage'); var _FirstPage2 = _interopRequireDefault(_FirstPage);
|
|
81
|
+
var _LastPage = require('@mui/icons-material/LastPage'); var _LastPage2 = _interopRequireDefault(_LastPage);
|
|
82
|
+
var _ChevronLeft = require('@mui/icons-material/ChevronLeft'); var _ChevronLeft2 = _interopRequireDefault(_ChevronLeft);
|
|
83
|
+
var _ChevronRight = require('@mui/icons-material/ChevronRight'); var _ChevronRight2 = _interopRequireDefault(_ChevronRight);
|
|
84
|
+
var _Remove = require('@mui/icons-material/Remove'); var _Remove2 = _interopRequireDefault(_Remove);
|
|
85
|
+
var _Add = require('@mui/icons-material/Add'); var _Add2 = _interopRequireDefault(_Add);
|
|
86
|
+
var _FitScreen = require('@mui/icons-material/FitScreen'); var _FitScreen2 = _interopRequireDefault(_FitScreen);
|
|
87
|
+
var _AspectRatio = require('@mui/icons-material/AspectRatio'); var _AspectRatio2 = _interopRequireDefault(_AspectRatio);
|
|
88
|
+
var _Tune = require('@mui/icons-material/Tune'); var _Tune2 = _interopRequireDefault(_Tune);
|
|
89
|
+
var _Search = require('@mui/icons-material/Search'); var _Search2 = _interopRequireDefault(_Search);
|
|
90
|
+
var _Fullscreen = require('@mui/icons-material/Fullscreen'); var _Fullscreen2 = _interopRequireDefault(_Fullscreen);
|
|
91
|
+
var _Download = require('@mui/icons-material/Download'); var _Download2 = _interopRequireDefault(_Download);
|
|
92
|
+
var _Print = require('@mui/icons-material/Print'); var _Print2 = _interopRequireDefault(_Print);
|
|
93
|
+
var _Info = require('@mui/icons-material/Info'); var _Info2 = _interopRequireDefault(_Info);
|
|
94
|
+
var _Description = require('@mui/icons-material/Description'); var _Description2 = _interopRequireDefault(_Description);
|
|
95
|
+
var _RotateLeft = require('@mui/icons-material/RotateLeft'); var _RotateLeft2 = _interopRequireDefault(_RotateLeft);
|
|
96
|
+
var _RotateRight = require('@mui/icons-material/RotateRight'); var _RotateRight2 = _interopRequireDefault(_RotateRight);
|
|
97
|
+
var _History = require('@mui/icons-material/History'); var _History2 = _interopRequireDefault(_History);
|
|
98
|
+
var _iconsmaterial = require('@mui/icons-material');
|
|
99
|
+
var _Highlight = require('@mui/icons-material/Highlight'); var _Highlight2 = _interopRequireDefault(_Highlight);
|
|
100
|
+
var _Draw = require('@mui/icons-material/Draw'); var _Draw2 = _interopRequireDefault(_Draw);
|
|
101
|
+
var _Approval = require('@mui/icons-material/Approval'); var _Approval2 = _interopRequireDefault(_Approval);
|
|
102
|
+
var _StickyNote2 = require('@mui/icons-material/StickyNote2'); var _StickyNote22 = _interopRequireDefault(_StickyNote2);
|
|
103
|
+
var _KeyboardArrowDown = require('@mui/icons-material/KeyboardArrowDown'); var _KeyboardArrowDown2 = _interopRequireDefault(_KeyboardArrowDown);
|
|
104
|
+
var _Portrait = require('@mui/icons-material/Portrait'); var _Portrait2 = _interopRequireDefault(_Portrait);
|
|
105
|
+
var _MenuBook = require('@mui/icons-material/MenuBook'); var _MenuBook2 = _interopRequireDefault(_MenuBook);
|
|
106
|
+
var _VerticalSplit = require('@mui/icons-material/VerticalSplit'); var _VerticalSplit2 = _interopRequireDefault(_VerticalSplit);
|
|
107
|
+
var _SwapVert = require('@mui/icons-material/SwapVert'); var _SwapVert2 = _interopRequireDefault(_SwapVert);
|
|
108
|
+
var _SwapHoriz = require('@mui/icons-material/SwapHoriz'); var _SwapHoriz2 = _interopRequireDefault(_SwapHoriz);
|
|
109
|
+
var _AutoFixHigh = require('@mui/icons-material/AutoFixHigh'); var _AutoFixHigh2 = _interopRequireDefault(_AutoFixHigh);
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
var PDFToolbar = _react2.default.memo(
|
|
113
|
+
({
|
|
114
|
+
currentPage,
|
|
115
|
+
totalPages,
|
|
116
|
+
zoom,
|
|
117
|
+
isSidebarOpen,
|
|
118
|
+
showPageNavigation,
|
|
119
|
+
showPageCount,
|
|
120
|
+
showZoomControls,
|
|
121
|
+
showSearch,
|
|
122
|
+
showMetadata,
|
|
123
|
+
showProperties,
|
|
124
|
+
showTags,
|
|
125
|
+
showHistory,
|
|
126
|
+
showDownload,
|
|
127
|
+
showPrint,
|
|
128
|
+
showRotation,
|
|
129
|
+
showAnnotations,
|
|
130
|
+
// Layout and Sidebar controls
|
|
131
|
+
twoPageMode = false,
|
|
132
|
+
onTwoPageModeChange,
|
|
133
|
+
scrollStrategy = _pdfviewer.ScrollStrategy.Vertical,
|
|
134
|
+
onScrollStrategyChange,
|
|
135
|
+
showThumbnails = false,
|
|
136
|
+
onToggleThumbnails,
|
|
137
|
+
// Destructure new props with defaults
|
|
138
|
+
showAnnotate = true,
|
|
139
|
+
disabledAnnotate = false,
|
|
140
|
+
showPrintOriginal = true,
|
|
141
|
+
showPrintWithAnnotations = true,
|
|
142
|
+
showDownloadOriginal = true,
|
|
143
|
+
showDownloadWithAnnotations = true,
|
|
144
|
+
isHighlighterActive,
|
|
145
|
+
isStampActive,
|
|
146
|
+
disabledRotateLeft,
|
|
147
|
+
disabledRotateRight,
|
|
148
|
+
disabledMetadata,
|
|
149
|
+
disabledProperties,
|
|
150
|
+
disabledTags,
|
|
151
|
+
disabledHistory,
|
|
152
|
+
disabledDownload,
|
|
153
|
+
disabledPrint,
|
|
154
|
+
disabledCopy,
|
|
155
|
+
disabledHighlighter,
|
|
156
|
+
disabledStamp,
|
|
157
|
+
disabledSignature,
|
|
158
|
+
disabledNote,
|
|
159
|
+
onFirstPage,
|
|
160
|
+
onPreviousPage,
|
|
161
|
+
onNextPage,
|
|
162
|
+
onLastPage,
|
|
163
|
+
onPageInput,
|
|
164
|
+
onPageInputKeyPress,
|
|
165
|
+
onZoomIn,
|
|
166
|
+
onZoomOut,
|
|
167
|
+
onFitToWidth,
|
|
168
|
+
onFitToPage,
|
|
169
|
+
onToggleSidebar,
|
|
170
|
+
onToggleFullScreen,
|
|
171
|
+
onRotateLeft,
|
|
172
|
+
onRotateRight,
|
|
173
|
+
onDownloadClick,
|
|
174
|
+
onDownloadWithAnnotations,
|
|
175
|
+
onDownloadWithoutAnnotations,
|
|
176
|
+
onPrintClick,
|
|
177
|
+
onPrintWithAnnotations,
|
|
178
|
+
onPrintWithoutAnnotations,
|
|
179
|
+
onCopyClick,
|
|
180
|
+
onMetadataClick,
|
|
181
|
+
onPropertiesClick,
|
|
182
|
+
onTagsClick,
|
|
183
|
+
onHistoryClick,
|
|
184
|
+
onHighlighterClick,
|
|
185
|
+
onStampClick,
|
|
186
|
+
onSignatureClick,
|
|
187
|
+
onNoteClick,
|
|
188
|
+
// Save functionality
|
|
189
|
+
hasUnsavedAnnotations,
|
|
190
|
+
isSavingAnnotations,
|
|
191
|
+
canSaveAnnotations,
|
|
192
|
+
onSaveAnnotations,
|
|
193
|
+
// Toolbar mode state
|
|
194
|
+
activeMode = "view",
|
|
195
|
+
onActiveModeChange
|
|
196
|
+
}) => {
|
|
197
|
+
const [isPrintMenuOpen, setIsPrintMenuOpen] = _react.useState.call(void 0, false);
|
|
198
|
+
const [isDownloadMenuOpen, setIsDownloadMenuOpen] = _react.useState.call(void 0, false);
|
|
199
|
+
const [isAnnotationMenuOpen, setIsAnnotationMenuOpen] = _react.useState.call(void 0, false);
|
|
200
|
+
const [isViewMenuOpen, setIsViewMenuOpen] = _react.useState.call(void 0, false);
|
|
201
|
+
const printMenuRef = _react.useRef.call(void 0, null);
|
|
202
|
+
const downloadMenuRef = _react.useRef.call(void 0, null);
|
|
203
|
+
const annotationMenuRef = _react.useRef.call(void 0, null);
|
|
204
|
+
const viewMenuRef = _react.useRef.call(void 0, null);
|
|
205
|
+
_react.useEffect.call(void 0, () => {
|
|
206
|
+
const handleClickOutside = (event) => {
|
|
207
|
+
if (printMenuRef.current && !printMenuRef.current.contains(event.target)) {
|
|
208
|
+
setIsPrintMenuOpen(false);
|
|
209
|
+
}
|
|
210
|
+
if (downloadMenuRef.current && !downloadMenuRef.current.contains(event.target)) {
|
|
211
|
+
setIsDownloadMenuOpen(false);
|
|
212
|
+
}
|
|
213
|
+
if (annotationMenuRef.current && !annotationMenuRef.current.contains(event.target)) {
|
|
214
|
+
setIsAnnotationMenuOpen(false);
|
|
215
|
+
}
|
|
216
|
+
if (viewMenuRef.current && !viewMenuRef.current.contains(event.target)) {
|
|
217
|
+
setIsViewMenuOpen(false);
|
|
218
|
+
}
|
|
219
|
+
};
|
|
220
|
+
document.addEventListener("mousedown", handleClickOutside);
|
|
221
|
+
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
222
|
+
}, []);
|
|
223
|
+
const handlePrintWithAnnotations = () => {
|
|
224
|
+
setIsPrintMenuOpen(false);
|
|
225
|
+
_optionalChain([onPrintWithAnnotations, 'optionalCall', _ => _()]);
|
|
226
|
+
};
|
|
227
|
+
const handlePrintWithoutAnnotations = () => {
|
|
228
|
+
setIsPrintMenuOpen(false);
|
|
229
|
+
_optionalChain([onPrintWithoutAnnotations, 'optionalCall', _2 => _2()]);
|
|
230
|
+
};
|
|
231
|
+
const handleDownloadWithAnnotations = () => {
|
|
232
|
+
setIsDownloadMenuOpen(false);
|
|
233
|
+
_optionalChain([onDownloadWithAnnotations, 'optionalCall', _3 => _3()]);
|
|
234
|
+
};
|
|
235
|
+
const handleDownloadWithoutAnnotations = () => {
|
|
236
|
+
setIsDownloadMenuOpen(false);
|
|
237
|
+
_optionalChain([onDownloadWithoutAnnotations, 'optionalCall', _4 => _4()]);
|
|
238
|
+
};
|
|
239
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "pdf-viewer-toolbar-container", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "pdf-viewer-toolbar", children: [
|
|
240
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "toolbar-left", children: [
|
|
241
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Tooltip, { title: "Toggle Page Previews", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
242
|
+
"button",
|
|
243
|
+
{
|
|
244
|
+
className: `toolbar-button ${showThumbnails ? "toolbar-button-active" : ""}`,
|
|
245
|
+
onClick: onToggleThumbnails,
|
|
246
|
+
style: { marginRight: "8px" },
|
|
247
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _VerticalSplit2.default, { fontSize: "small" })
|
|
248
|
+
}
|
|
249
|
+
) }),
|
|
250
|
+
showPageNavigation && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "toolbar-section", children: [
|
|
251
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Tooltip, { title: "First Page", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
252
|
+
"button",
|
|
253
|
+
{
|
|
254
|
+
className: "toolbar-button",
|
|
255
|
+
onClick: onFirstPage,
|
|
256
|
+
disabled: currentPage <= 1,
|
|
257
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _FirstPage2.default, { fontSize: "small" })
|
|
258
|
+
}
|
|
259
|
+
) }) }),
|
|
260
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Tooltip, { title: "Previous Page", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
261
|
+
"button",
|
|
262
|
+
{
|
|
263
|
+
className: "toolbar-button",
|
|
264
|
+
onClick: onPreviousPage,
|
|
265
|
+
disabled: currentPage <= 1,
|
|
266
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _ChevronLeft2.default, { fontSize: "small" })
|
|
267
|
+
}
|
|
268
|
+
) }) }),
|
|
269
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "page-info", style: { display: "flex", alignItems: "center", margin: "0 8px", fontSize: "14px", fontWeight: 500 }, children: [
|
|
270
|
+
currentPage,
|
|
271
|
+
" ",
|
|
272
|
+
showPageCount && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { style: { color: "#6b7280", marginLeft: "4px" }, children: [
|
|
273
|
+
"/ ",
|
|
274
|
+
totalPages || "..."
|
|
275
|
+
] })
|
|
276
|
+
] }),
|
|
277
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Tooltip, { title: "Next Page", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
278
|
+
"button",
|
|
279
|
+
{
|
|
280
|
+
className: "toolbar-button",
|
|
281
|
+
onClick: onNextPage,
|
|
282
|
+
disabled: currentPage >= totalPages,
|
|
283
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _ChevronRight2.default, { fontSize: "small" })
|
|
284
|
+
}
|
|
285
|
+
) }) }),
|
|
286
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Tooltip, { title: "Last Page", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
287
|
+
"button",
|
|
288
|
+
{
|
|
289
|
+
className: "toolbar-button",
|
|
290
|
+
onClick: onLastPage,
|
|
291
|
+
disabled: currentPage >= totalPages,
|
|
292
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _LastPage2.default, { fontSize: "small" })
|
|
293
|
+
}
|
|
294
|
+
) }) })
|
|
295
|
+
] }),
|
|
296
|
+
showZoomControls && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
297
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "toolbar-separator" }),
|
|
298
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "toolbar-section", children: [
|
|
299
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Tooltip, { title: "Zoom Out", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
300
|
+
"button",
|
|
301
|
+
{
|
|
302
|
+
className: "toolbar-button",
|
|
303
|
+
onClick: onZoomOut,
|
|
304
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _Remove2.default, { fontSize: "small" })
|
|
305
|
+
}
|
|
306
|
+
) }),
|
|
307
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "zoom-display", children: [
|
|
308
|
+
zoom,
|
|
309
|
+
"%"
|
|
310
|
+
] }),
|
|
311
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Tooltip, { title: "Zoom In", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
312
|
+
"button",
|
|
313
|
+
{
|
|
314
|
+
className: "toolbar-button",
|
|
315
|
+
onClick: onZoomIn,
|
|
316
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _Add2.default, { fontSize: "small" })
|
|
317
|
+
}
|
|
318
|
+
) })
|
|
319
|
+
] })
|
|
320
|
+
] }),
|
|
321
|
+
(showZoomControls || showRotation) && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
322
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "toolbar-separator" }),
|
|
323
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "toolbar-section", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "toolbar-dropdown-container", ref: viewMenuRef, children: [
|
|
324
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Tooltip, { title: "View Options", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
325
|
+
"button",
|
|
326
|
+
{
|
|
327
|
+
className: `toolbar-button toolbar-dropdown-button ${isViewMenuOpen ? "toolbar-button-active" : ""}`,
|
|
328
|
+
onClick: () => setIsViewMenuOpen(!isViewMenuOpen),
|
|
329
|
+
children: [
|
|
330
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _Tune2.default, { fontSize: "small" }),
|
|
331
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _KeyboardArrowDown2.default, { fontSize: "small", style: { marginLeft: -4 } })
|
|
332
|
+
]
|
|
333
|
+
}
|
|
334
|
+
) }),
|
|
335
|
+
isViewMenuOpen && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "toolbar-dropdown-menu", style: { width: "240px" }, children: [
|
|
336
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "toolbar-dropdown-header", children: "SPREAD MODE" }),
|
|
337
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
338
|
+
"button",
|
|
339
|
+
{
|
|
340
|
+
className: `toolbar-dropdown-item ${!twoPageMode ? "toolbar-dropdown-item-active" : ""}`,
|
|
341
|
+
onClick: () => {
|
|
342
|
+
setIsViewMenuOpen(false);
|
|
343
|
+
_optionalChain([onTwoPageModeChange, 'optionalCall', _5 => _5(false)]);
|
|
344
|
+
},
|
|
345
|
+
children: [
|
|
346
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _Portrait2.default, { fontSize: "small" }),
|
|
347
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Single Page" })
|
|
348
|
+
]
|
|
349
|
+
}
|
|
350
|
+
),
|
|
351
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
352
|
+
"button",
|
|
353
|
+
{
|
|
354
|
+
className: `toolbar-dropdown-item ${twoPageMode ? "toolbar-dropdown-item-active" : ""}`,
|
|
355
|
+
onClick: () => {
|
|
356
|
+
setIsViewMenuOpen(false);
|
|
357
|
+
_optionalChain([onTwoPageModeChange, 'optionalCall', _6 => _6(true)]);
|
|
358
|
+
},
|
|
359
|
+
children: [
|
|
360
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _MenuBook2.default, { fontSize: "small" }),
|
|
361
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Two-Page Spread" })
|
|
362
|
+
]
|
|
363
|
+
}
|
|
364
|
+
),
|
|
365
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "toolbar-dropdown-divider" }),
|
|
366
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "toolbar-dropdown-header", children: "SCROLL LAYOUT" }),
|
|
367
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
368
|
+
"button",
|
|
369
|
+
{
|
|
370
|
+
className: `toolbar-dropdown-item ${scrollStrategy !== _pdfviewer.ScrollStrategy.Horizontal ? "toolbar-dropdown-item-active" : ""}`,
|
|
371
|
+
onClick: () => {
|
|
372
|
+
setIsViewMenuOpen(false);
|
|
373
|
+
_optionalChain([onScrollStrategyChange, 'optionalCall', _7 => _7(_pdfviewer.ScrollStrategy.Vertical)]);
|
|
374
|
+
},
|
|
375
|
+
children: [
|
|
376
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _SwapVert2.default, { fontSize: "small" }),
|
|
377
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Vertical Scroll" })
|
|
378
|
+
]
|
|
379
|
+
}
|
|
380
|
+
),
|
|
381
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
382
|
+
"button",
|
|
383
|
+
{
|
|
384
|
+
className: `toolbar-dropdown-item ${scrollStrategy === _pdfviewer.ScrollStrategy.Horizontal ? "toolbar-dropdown-item-active" : ""}`,
|
|
385
|
+
onClick: () => {
|
|
386
|
+
setIsViewMenuOpen(false);
|
|
387
|
+
_optionalChain([onScrollStrategyChange, 'optionalCall', _8 => _8(_pdfviewer.ScrollStrategy.Horizontal)]);
|
|
388
|
+
},
|
|
389
|
+
children: [
|
|
390
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _SwapHoriz2.default, { fontSize: "small" }),
|
|
391
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Horizontal Scroll" })
|
|
392
|
+
]
|
|
393
|
+
}
|
|
394
|
+
),
|
|
395
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "toolbar-dropdown-divider" }),
|
|
396
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "button", { className: "toolbar-dropdown-item", onClick: () => {
|
|
397
|
+
setIsViewMenuOpen(false);
|
|
398
|
+
_optionalChain([onFitToWidth, 'optionalCall', _9 => _9()]);
|
|
399
|
+
}, children: [
|
|
400
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _AspectRatio2.default, { fontSize: "small" }),
|
|
401
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Fit to Width" })
|
|
402
|
+
] }),
|
|
403
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "button", { className: "toolbar-dropdown-item", onClick: () => {
|
|
404
|
+
setIsViewMenuOpen(false);
|
|
405
|
+
_optionalChain([onFitToPage, 'optionalCall', _10 => _10()]);
|
|
406
|
+
}, children: [
|
|
407
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _FitScreen2.default, { fontSize: "small" }),
|
|
408
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Fit to Page" })
|
|
409
|
+
] }),
|
|
410
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "toolbar-dropdown-divider" }),
|
|
411
|
+
showRotation && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
412
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "toolbar-dropdown-header", children: "PAGE ROTATION" }),
|
|
413
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
414
|
+
"button",
|
|
415
|
+
{
|
|
416
|
+
className: "toolbar-dropdown-item",
|
|
417
|
+
onClick: () => {
|
|
418
|
+
setIsViewMenuOpen(false);
|
|
419
|
+
_optionalChain([onRotateRight, 'optionalCall', _11 => _11()]);
|
|
420
|
+
},
|
|
421
|
+
disabled: false,
|
|
422
|
+
children: [
|
|
423
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _RotateRight2.default, { fontSize: "small" }),
|
|
424
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Rotate Clockwise" })
|
|
425
|
+
]
|
|
426
|
+
}
|
|
427
|
+
),
|
|
428
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
429
|
+
"button",
|
|
430
|
+
{
|
|
431
|
+
className: "toolbar-dropdown-item",
|
|
432
|
+
onClick: () => {
|
|
433
|
+
setIsViewMenuOpen(false);
|
|
434
|
+
_optionalChain([onRotateLeft, 'optionalCall', _12 => _12()]);
|
|
435
|
+
},
|
|
436
|
+
disabled: disabledRotateLeft,
|
|
437
|
+
children: [
|
|
438
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _RotateLeft2.default, { fontSize: "small" }),
|
|
439
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Rotate Counter-Clockwise" })
|
|
440
|
+
]
|
|
441
|
+
}
|
|
442
|
+
)
|
|
443
|
+
] }),
|
|
444
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "toolbar-dropdown-divider" }),
|
|
445
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
446
|
+
"button",
|
|
447
|
+
{
|
|
448
|
+
className: "toolbar-dropdown-item",
|
|
449
|
+
onClick: () => {
|
|
450
|
+
setIsViewMenuOpen(false);
|
|
451
|
+
onToggleFullScreen();
|
|
452
|
+
},
|
|
453
|
+
children: [
|
|
454
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _Fullscreen2.default, { fontSize: "small" }),
|
|
455
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Fullscreen" })
|
|
456
|
+
]
|
|
457
|
+
}
|
|
458
|
+
)
|
|
459
|
+
] })
|
|
460
|
+
] }) })
|
|
461
|
+
] }),
|
|
462
|
+
showSearch && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
463
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "toolbar-separator" }),
|
|
464
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "toolbar-section", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Tooltip, { title: "Search", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
465
|
+
"button",
|
|
466
|
+
{
|
|
467
|
+
className: `toolbar-button ${isSidebarOpen ? "toolbar-button-active" : ""}`,
|
|
468
|
+
onClick: onToggleSidebar,
|
|
469
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _Search2.default, { fontSize: "small" })
|
|
470
|
+
}
|
|
471
|
+
) }) })
|
|
472
|
+
] })
|
|
473
|
+
] }),
|
|
474
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "toolbar-center", children: [
|
|
475
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
476
|
+
"button",
|
|
477
|
+
{
|
|
478
|
+
className: `toolbar-tab ${activeMode === "view" ? "toolbar-tab-active" : ""}`,
|
|
479
|
+
onClick: () => _optionalChain([onActiveModeChange, 'optionalCall', _13 => _13("view")]),
|
|
480
|
+
children: "View"
|
|
481
|
+
}
|
|
482
|
+
),
|
|
483
|
+
showAnnotate && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
484
|
+
"button",
|
|
485
|
+
{
|
|
486
|
+
className: `toolbar-tab ${activeMode === "annotate" ? "toolbar-tab-active" : ""}`,
|
|
487
|
+
onClick: () => !disabledAnnotate && _optionalChain([onActiveModeChange, 'optionalCall', _14 => _14("annotate")]),
|
|
488
|
+
style: {
|
|
489
|
+
position: "relative",
|
|
490
|
+
opacity: disabledAnnotate ? 0.5 : 1,
|
|
491
|
+
cursor: disabledAnnotate ? "not-allowed" : "pointer"
|
|
492
|
+
},
|
|
493
|
+
children: [
|
|
494
|
+
"Annotate",
|
|
495
|
+
hasUnsavedAnnotations && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { style: {
|
|
496
|
+
position: "absolute",
|
|
497
|
+
top: "4px",
|
|
498
|
+
right: "4px",
|
|
499
|
+
width: "6px",
|
|
500
|
+
height: "6px",
|
|
501
|
+
backgroundColor: "#ef4444",
|
|
502
|
+
borderRadius: "50%"
|
|
503
|
+
} })
|
|
504
|
+
]
|
|
505
|
+
}
|
|
506
|
+
)
|
|
507
|
+
] }),
|
|
508
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "toolbar-right", children: (hasUnsavedAnnotations || showDownload || showPrint || showMetadata || showProperties || showTags || showHistory) && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
509
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "toolbar-separator" }),
|
|
510
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "toolbar-section", children: [
|
|
511
|
+
showDownload && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "toolbar-dropdown-container", ref: downloadMenuRef, children: showDownloadOriginal && showDownloadWithAnnotations ? (
|
|
512
|
+
// RENDER DROPDOWN if BOTH are enabled
|
|
513
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
514
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Tooltip, { title: "Download", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
515
|
+
"button",
|
|
516
|
+
{
|
|
517
|
+
className: `toolbar-button toolbar-dropdown-button ${isDownloadMenuOpen ? "toolbar-button-active" : ""}`,
|
|
518
|
+
onClick: () => setIsDownloadMenuOpen(!isDownloadMenuOpen),
|
|
519
|
+
disabled: disabledDownload,
|
|
520
|
+
children: [
|
|
521
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _Download2.default, { fontSize: "small" }),
|
|
522
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _KeyboardArrowDown2.default, { fontSize: "small", style: { marginLeft: -4 } })
|
|
523
|
+
]
|
|
524
|
+
}
|
|
525
|
+
) }) }),
|
|
526
|
+
isDownloadMenuOpen && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "toolbar-dropdown-menu toolbar-dropdown-menu-right", children: [
|
|
527
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
528
|
+
"button",
|
|
529
|
+
{
|
|
530
|
+
className: "toolbar-dropdown-item",
|
|
531
|
+
onClick: handleDownloadWithoutAnnotations,
|
|
532
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Download Document Only" })
|
|
533
|
+
}
|
|
534
|
+
),
|
|
535
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
536
|
+
"button",
|
|
537
|
+
{
|
|
538
|
+
className: "toolbar-dropdown-item",
|
|
539
|
+
onClick: handleDownloadWithAnnotations,
|
|
540
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Download with Annotations" })
|
|
541
|
+
}
|
|
542
|
+
)
|
|
543
|
+
] })
|
|
544
|
+
] })
|
|
545
|
+
) : (
|
|
546
|
+
// RENDER SINGLE BUTTON if ONLY ONE is enabled
|
|
547
|
+
(showDownloadOriginal || showDownloadWithAnnotations) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Tooltip, { title: "Download", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
548
|
+
"button",
|
|
549
|
+
{
|
|
550
|
+
className: "toolbar-button",
|
|
551
|
+
onClick: showDownloadOriginal ? handleDownloadWithoutAnnotations : handleDownloadWithAnnotations,
|
|
552
|
+
disabled: disabledDownload,
|
|
553
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _Download2.default, { fontSize: "small" })
|
|
554
|
+
}
|
|
555
|
+
) }) })
|
|
556
|
+
) }),
|
|
557
|
+
showPrint && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "toolbar-dropdown-container", ref: printMenuRef, children: showPrintOriginal && showPrintWithAnnotations ? (
|
|
558
|
+
// RENDER DROPDOWN if BOTH are enabled
|
|
559
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
560
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Tooltip, { title: "Print", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
561
|
+
"button",
|
|
562
|
+
{
|
|
563
|
+
className: `toolbar-button toolbar-dropdown-button ${isPrintMenuOpen ? "toolbar-button-active" : ""}`,
|
|
564
|
+
onClick: () => setIsPrintMenuOpen(!isPrintMenuOpen),
|
|
565
|
+
disabled: disabledPrint,
|
|
566
|
+
children: [
|
|
567
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _Print2.default, { fontSize: "small" }),
|
|
568
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _KeyboardArrowDown2.default, { fontSize: "small", style: { marginLeft: -4 } })
|
|
569
|
+
]
|
|
570
|
+
}
|
|
571
|
+
) }) }),
|
|
572
|
+
isPrintMenuOpen && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "toolbar-dropdown-menu toolbar-dropdown-menu-right", children: [
|
|
573
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
574
|
+
"button",
|
|
575
|
+
{
|
|
576
|
+
className: "toolbar-dropdown-item",
|
|
577
|
+
onClick: handlePrintWithoutAnnotations,
|
|
578
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Print Document Only" })
|
|
579
|
+
}
|
|
580
|
+
),
|
|
581
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
582
|
+
"button",
|
|
583
|
+
{
|
|
584
|
+
className: "toolbar-dropdown-item",
|
|
585
|
+
onClick: handlePrintWithAnnotations,
|
|
586
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Print with Annotations" })
|
|
587
|
+
}
|
|
588
|
+
)
|
|
589
|
+
] })
|
|
590
|
+
] })
|
|
591
|
+
) : (
|
|
592
|
+
// RENDER SINGLE BUTTON if ONLY ONE is enabled
|
|
593
|
+
(showPrintOriginal || showPrintWithAnnotations) && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Tooltip, { title: "Print", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
594
|
+
"button",
|
|
595
|
+
{
|
|
596
|
+
className: "toolbar-button",
|
|
597
|
+
onClick: showPrintOriginal ? handlePrintWithoutAnnotations : handlePrintWithAnnotations,
|
|
598
|
+
disabled: disabledPrint,
|
|
599
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _Print2.default, { fontSize: "small" })
|
|
600
|
+
}
|
|
601
|
+
) }) })
|
|
602
|
+
) }),
|
|
603
|
+
showMetadata && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Tooltip, { title: "Metadata", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
604
|
+
"button",
|
|
605
|
+
{
|
|
606
|
+
className: "toolbar-button",
|
|
607
|
+
onClick: onMetadataClick,
|
|
608
|
+
disabled: disabledMetadata,
|
|
609
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _Description2.default, { fontSize: "small" })
|
|
610
|
+
}
|
|
611
|
+
) }) }),
|
|
612
|
+
showProperties && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Tooltip, { title: "Properties", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
613
|
+
"button",
|
|
614
|
+
{
|
|
615
|
+
className: "toolbar-button",
|
|
616
|
+
onClick: onPropertiesClick,
|
|
617
|
+
disabled: disabledProperties,
|
|
618
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _Info2.default, { fontSize: "small" })
|
|
619
|
+
}
|
|
620
|
+
) }) }),
|
|
621
|
+
showTags && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Tooltip, { title: "Tags", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
622
|
+
"button",
|
|
623
|
+
{
|
|
624
|
+
className: "toolbar-button",
|
|
625
|
+
onClick: onTagsClick,
|
|
626
|
+
disabled: disabledTags,
|
|
627
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _iconsmaterial.LocalOffer, { fontSize: "small" })
|
|
628
|
+
}
|
|
629
|
+
) }) }),
|
|
630
|
+
showHistory && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Tooltip, { title: "Version History", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
631
|
+
"button",
|
|
632
|
+
{
|
|
633
|
+
className: "toolbar-button",
|
|
634
|
+
onClick: onHistoryClick,
|
|
635
|
+
disabled: disabledHistory,
|
|
636
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _History2.default, { fontSize: "small" })
|
|
637
|
+
}
|
|
638
|
+
) }) })
|
|
639
|
+
] })
|
|
640
|
+
] }) })
|
|
641
|
+
] }) });
|
|
642
|
+
}
|
|
643
|
+
);
|
|
644
|
+
PDFToolbar.displayName = "PDFToolbar";
|
|
645
|
+
var PDFSecondaryToolbar = _react2.default.memo(({
|
|
646
|
+
activeMode,
|
|
647
|
+
showAnnotations,
|
|
648
|
+
isHighlighterActive,
|
|
649
|
+
isStampActive,
|
|
650
|
+
disabledHighlighter,
|
|
651
|
+
disabledStamp,
|
|
652
|
+
disabledSignature,
|
|
653
|
+
disabledNote,
|
|
654
|
+
onHighlighterClick,
|
|
655
|
+
onStampClick,
|
|
656
|
+
onSignatureClick,
|
|
657
|
+
onNoteClick,
|
|
658
|
+
hasUnsavedAnnotations,
|
|
659
|
+
isSavingAnnotations,
|
|
660
|
+
canSaveAnnotations,
|
|
661
|
+
onSaveAnnotations
|
|
662
|
+
}) => {
|
|
663
|
+
if (!showAnnotations) return null;
|
|
664
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
665
|
+
activeMode === "annotate" && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "pdf-viewer-secondary-toolbar", children: [
|
|
666
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Tooltip, { title: "Highlight", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
667
|
+
"button",
|
|
668
|
+
{
|
|
669
|
+
className: `toolbar-button ${isHighlighterActive ? "toolbar-button-active" : ""}`,
|
|
670
|
+
onClick: onHighlighterClick,
|
|
671
|
+
disabled: disabledHighlighter,
|
|
672
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _Highlight2.default, { fontSize: "small" })
|
|
673
|
+
}
|
|
674
|
+
) }) }),
|
|
675
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Tooltip, { title: "Stamp", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
676
|
+
"button",
|
|
677
|
+
{
|
|
678
|
+
className: `toolbar-button ${isStampActive ? "toolbar-button-active" : ""}`,
|
|
679
|
+
onClick: onStampClick,
|
|
680
|
+
disabled: disabledStamp,
|
|
681
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _Approval2.default, { fontSize: "small" })
|
|
682
|
+
}
|
|
683
|
+
) }) }),
|
|
684
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Tooltip, { title: "Signature", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
685
|
+
"button",
|
|
686
|
+
{
|
|
687
|
+
className: "toolbar-button",
|
|
688
|
+
onClick: onSignatureClick,
|
|
689
|
+
disabled: disabledSignature,
|
|
690
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _Draw2.default, { fontSize: "small" })
|
|
691
|
+
}
|
|
692
|
+
) }) }),
|
|
693
|
+
onNoteClick && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Tooltip, { title: "Sticky Note", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
694
|
+
"button",
|
|
695
|
+
{
|
|
696
|
+
className: "toolbar-button",
|
|
697
|
+
onClick: onNoteClick,
|
|
698
|
+
disabled: disabledNote,
|
|
699
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _StickyNote22.default, { fontSize: "small" })
|
|
700
|
+
}
|
|
701
|
+
) }) }),
|
|
702
|
+
hasUnsavedAnnotations && canSaveAnnotations !== false && onSaveAnnotations && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
703
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { style: { width: 1, height: 24, backgroundColor: "#e5e7eb", margin: "0 8px" } }),
|
|
704
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Tooltip, { title: "Save Annotations", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
705
|
+
"button",
|
|
706
|
+
{
|
|
707
|
+
className: "toolbar-button",
|
|
708
|
+
onClick: onSaveAnnotations,
|
|
709
|
+
disabled: isSavingAnnotations,
|
|
710
|
+
style: {
|
|
711
|
+
color: hasUnsavedAnnotations ? "#2563eb" : "inherit",
|
|
712
|
+
padding: "6px 16px",
|
|
713
|
+
border: hasUnsavedAnnotations ? "1px solid #2563eb" : "1px solid transparent",
|
|
714
|
+
borderRadius: "6px",
|
|
715
|
+
display: "flex",
|
|
716
|
+
alignItems: "center",
|
|
717
|
+
gap: "6px",
|
|
718
|
+
backgroundColor: hasUnsavedAnnotations ? "#eff6ff" : "transparent",
|
|
719
|
+
fontSize: "14px",
|
|
720
|
+
fontWeight: 500,
|
|
721
|
+
width: "auto",
|
|
722
|
+
cursor: isSavingAnnotations ? "not-allowed" : "pointer"
|
|
723
|
+
},
|
|
724
|
+
children: [
|
|
725
|
+
isSavingAnnotations ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "svg", { width: "16", height: "16", viewBox: "0 0 24 24", style: { animation: "spin 1s linear infinite" }, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "circle", { cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "3", fill: "none", strokeDasharray: "31.4", strokeDashoffset: "10" }) }) : /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
726
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "path", { d: "M19 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h11l5 5v11a2 2 0 0 1-2 2z" }),
|
|
727
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "polyline", { points: "17 21 17 13 7 13 7 21" }),
|
|
728
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "polyline", { points: "7 3 7 8 15 8" })
|
|
729
|
+
] }),
|
|
730
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: isSavingAnnotations ? "Saving..." : "Save" })
|
|
731
|
+
]
|
|
732
|
+
}
|
|
733
|
+
) }) })
|
|
734
|
+
] })
|
|
735
|
+
] }),
|
|
736
|
+
activeMode === "redact" && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "pdf-viewer-secondary-toolbar", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Tooltip, { title: "Redact Text", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "button", { className: "toolbar-button", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _AutoFixHigh2.default, { fontSize: "small" }) }) }) })
|
|
737
|
+
] });
|
|
738
|
+
});
|
|
739
|
+
PDFSecondaryToolbar.displayName = "PDFSecondaryToolbar";
|
|
740
|
+
PDFToolbar.displayName = "PDFToolbar";
|
|
741
|
+
|
|
742
|
+
// src/components/viewers/pdf/PDFHeader.tsx
|
|
743
|
+
|
|
744
|
+
|
|
745
|
+
var PDFHeader = _react2.default.memo(({ fileName, fileExtension }) => {
|
|
746
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "pdf-viewer-header", children: [
|
|
747
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _chunkEM63H4SAjs.FileIcon_default, { ext: fileExtension, size: 26 }),
|
|
748
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "header-file-name", title: fileName, children: fileName })
|
|
749
|
+
] });
|
|
750
|
+
});
|
|
751
|
+
PDFHeader.displayName = "PDFHeader";
|
|
752
|
+
|
|
753
|
+
// src/components/viewers/pdf/SearchSidebar.tsx
|
|
754
|
+
|
|
755
|
+
|
|
756
|
+
|
|
757
|
+
|
|
758
|
+
|
|
759
|
+
|
|
760
|
+
|
|
761
|
+
|
|
762
|
+
|
|
763
|
+
|
|
764
|
+
|
|
765
|
+
var _Close = require('@mui/icons-material/Close'); var _Close2 = _interopRequireDefault(_Close);
|
|
766
|
+
var _KeyboardArrowUp = require('@mui/icons-material/KeyboardArrowUp'); var _KeyboardArrowUp2 = _interopRequireDefault(_KeyboardArrowUp);
|
|
767
|
+
|
|
768
|
+
var _Clear = require('@mui/icons-material/Clear'); var _Clear2 = _interopRequireDefault(_Clear);
|
|
769
|
+
var _FindInPage = require('@mui/icons-material/FindInPage'); var _FindInPage2 = _interopRequireDefault(_FindInPage);
|
|
770
|
+
|
|
771
|
+
var SearchSidebar = ({
|
|
772
|
+
isOpen,
|
|
773
|
+
onClose,
|
|
774
|
+
onSearch,
|
|
775
|
+
onSearchResultClick,
|
|
776
|
+
onNextResult,
|
|
777
|
+
onPreviousResult,
|
|
778
|
+
currentResultIndex,
|
|
779
|
+
totalResults,
|
|
780
|
+
searchKeyword,
|
|
781
|
+
searchResults = [],
|
|
782
|
+
isSearching = false,
|
|
783
|
+
isSyntheticResults = false
|
|
784
|
+
}) => {
|
|
785
|
+
const [searchTerm, setSearchTerm] = _react.useState.call(void 0, searchKeyword || "");
|
|
786
|
+
const [hasSearched, setHasSearched] = _react.useState.call(void 0, false);
|
|
787
|
+
const contentRef = _react.useRef.call(void 0, null);
|
|
788
|
+
_react.useEffect.call(void 0, () => {
|
|
789
|
+
if (searchKeyword && searchKeyword !== searchTerm) {
|
|
790
|
+
setSearchTerm(searchKeyword);
|
|
791
|
+
}
|
|
792
|
+
}, [searchKeyword]);
|
|
793
|
+
_react.useLayoutEffect.call(void 0, () => {
|
|
794
|
+
const element = contentRef.current;
|
|
795
|
+
if (!element) return;
|
|
796
|
+
const handleMouseMove = (e) => {
|
|
797
|
+
const rect = element.getBoundingClientRect();
|
|
798
|
+
const distanceFromRight = rect.right - e.clientX;
|
|
799
|
+
const distanceFromBottom = rect.bottom - e.clientY;
|
|
800
|
+
if (distanceFromRight <= 15 || distanceFromBottom <= 15) {
|
|
801
|
+
element.classList.add("scrollbar-hover");
|
|
802
|
+
} else {
|
|
803
|
+
element.classList.remove("scrollbar-hover");
|
|
804
|
+
}
|
|
805
|
+
};
|
|
806
|
+
const handleMouseLeave = () => element.classList.remove("scrollbar-hover");
|
|
807
|
+
element.addEventListener("mousemove", handleMouseMove);
|
|
808
|
+
element.addEventListener("mouseleave", handleMouseLeave);
|
|
809
|
+
return () => {
|
|
810
|
+
element.removeEventListener("mousemove", handleMouseMove);
|
|
811
|
+
element.removeEventListener("mouseleave", handleMouseLeave);
|
|
812
|
+
};
|
|
813
|
+
}, []);
|
|
814
|
+
_react.useLayoutEffect.call(void 0, () => {
|
|
815
|
+
const style = document.createElement("style");
|
|
816
|
+
style.id = "search-sidebar-scrollbar";
|
|
817
|
+
style.textContent = `
|
|
818
|
+
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+Tamil:wght@400;600&family=Noto+Sans+Devanagari:wght@400;600&display=swap');
|
|
819
|
+
|
|
820
|
+
.search-sidebar-content::-webkit-scrollbar {
|
|
821
|
+
width: 12px;
|
|
822
|
+
height: 12px;
|
|
823
|
+
}
|
|
824
|
+
.search-sidebar-content::-webkit-scrollbar-track {
|
|
825
|
+
background-color: transparent;
|
|
826
|
+
}
|
|
827
|
+
.search-sidebar-content::-webkit-scrollbar-thumb {
|
|
828
|
+
background-color: rgba(128, 128, 128, 0.3);
|
|
829
|
+
border-radius: 8px;
|
|
830
|
+
border: 4px solid transparent;
|
|
831
|
+
background-clip: padding-box;
|
|
832
|
+
transition: all 0.15s ease;
|
|
833
|
+
}
|
|
834
|
+
.search-sidebar-content.scrollbar-hover::-webkit-scrollbar-thumb {
|
|
835
|
+
background-color: rgba(128, 128, 128, 0.5);
|
|
836
|
+
border: 2px solid transparent;
|
|
837
|
+
}
|
|
838
|
+
.search-sidebar-content::-webkit-scrollbar-thumb:active {
|
|
839
|
+
background-color: rgba(25, 118, 210, 0.8);
|
|
840
|
+
border: 1px solid transparent;
|
|
841
|
+
}
|
|
842
|
+
|
|
843
|
+
@media (prefers-color-scheme: dark) {
|
|
844
|
+
.search-sidebar-content::-webkit-scrollbar-thumb {
|
|
845
|
+
background-color: rgba(255, 255, 255, 0.2);
|
|
846
|
+
}
|
|
847
|
+
.search-sidebar-content.scrollbar-hover::-webkit-scrollbar-thumb {
|
|
848
|
+
background-color: rgba(255, 255, 255, 0.35);
|
|
849
|
+
}
|
|
850
|
+
}
|
|
851
|
+
|
|
852
|
+
/* Tamil font support for search results */
|
|
853
|
+
.search-result-text {
|
|
854
|
+
font-family: 'Noto Sans Tamil', 'Noto Sans Devanagari', Arial, sans-serif !important;
|
|
855
|
+
}
|
|
856
|
+
`;
|
|
857
|
+
document.head.appendChild(style);
|
|
858
|
+
return () => {
|
|
859
|
+
const el = document.getElementById("search-sidebar-scrollbar");
|
|
860
|
+
if (el) el.remove();
|
|
861
|
+
};
|
|
862
|
+
}, []);
|
|
863
|
+
_react.useLayoutEffect.call(void 0, () => {
|
|
864
|
+
setSearchTerm(searchKeyword || "");
|
|
865
|
+
if (searchKeyword || searchResults.length > 0) {
|
|
866
|
+
setHasSearched(true);
|
|
867
|
+
}
|
|
868
|
+
}, [searchKeyword, searchResults]);
|
|
869
|
+
const handleSearchSubmit = (e) => {
|
|
870
|
+
if (e) e.preventDefault();
|
|
871
|
+
if (searchTerm.trim()) {
|
|
872
|
+
setHasSearched(true);
|
|
873
|
+
onSearch(searchTerm.trim());
|
|
874
|
+
}
|
|
875
|
+
};
|
|
876
|
+
const handleSearchChange = (e) => {
|
|
877
|
+
const value = e.target.value;
|
|
878
|
+
setSearchTerm(value);
|
|
879
|
+
if (!value.trim()) {
|
|
880
|
+
setHasSearched(false);
|
|
881
|
+
onSearch("");
|
|
882
|
+
}
|
|
883
|
+
};
|
|
884
|
+
const handleClearSearch = () => {
|
|
885
|
+
setSearchTerm("");
|
|
886
|
+
setHasSearched(false);
|
|
887
|
+
onSearch("");
|
|
888
|
+
};
|
|
889
|
+
const resultsByPage = searchResults.reduce((acc, result) => {
|
|
890
|
+
if (!acc[result.pageNumber]) {
|
|
891
|
+
acc[result.pageNumber] = [];
|
|
892
|
+
}
|
|
893
|
+
acc[result.pageNumber].push(result);
|
|
894
|
+
return acc;
|
|
895
|
+
}, {});
|
|
896
|
+
const highlightText = (text, keyword) => {
|
|
897
|
+
if (!keyword) return text;
|
|
898
|
+
const textString = typeof text === "string" ? text : String(text || "");
|
|
899
|
+
if (!textString) return text;
|
|
900
|
+
try {
|
|
901
|
+
const escapedKeyword = keyword.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
902
|
+
const regex = new RegExp(`(${escapedKeyword})`, "gi");
|
|
903
|
+
const parts = textString.split(regex);
|
|
904
|
+
return parts.map(
|
|
905
|
+
(part, index) => regex.test(part) ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
906
|
+
_material.Box,
|
|
907
|
+
{
|
|
908
|
+
component: "span",
|
|
909
|
+
sx: {
|
|
910
|
+
color: "primary.main",
|
|
911
|
+
fontWeight: 600,
|
|
912
|
+
fontSize: "inherit"
|
|
913
|
+
},
|
|
914
|
+
children: part
|
|
915
|
+
},
|
|
916
|
+
index
|
|
917
|
+
) : part
|
|
918
|
+
);
|
|
919
|
+
} catch (error) {
|
|
920
|
+
return textString;
|
|
921
|
+
}
|
|
922
|
+
};
|
|
923
|
+
if (!isOpen) return null;
|
|
924
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
925
|
+
_material.Box,
|
|
926
|
+
{
|
|
927
|
+
sx: {
|
|
928
|
+
display: "flex",
|
|
929
|
+
flexDirection: "column",
|
|
930
|
+
height: "100%",
|
|
931
|
+
width: "320px",
|
|
932
|
+
backgroundColor: "background.paper",
|
|
933
|
+
borderLeft: "1px solid",
|
|
934
|
+
borderColor: "divider",
|
|
935
|
+
overflow: "hidden"
|
|
936
|
+
},
|
|
937
|
+
children: [
|
|
938
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _material.Box, { sx: { px: 3, py: 2.5, backgroundColor: "background.default" }, children: [
|
|
939
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _material.Box, { sx: { display: "flex", alignItems: "center", justifyContent: "space-between", mb: 2 }, children: [
|
|
940
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Typography, { variant: "h6", sx: { fontSize: "1.125rem", fontWeight: 600, color: "text.primary" }, children: "Search" }),
|
|
941
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
942
|
+
_material.IconButton,
|
|
943
|
+
{
|
|
944
|
+
size: "small",
|
|
945
|
+
onClick: onClose,
|
|
946
|
+
sx: {
|
|
947
|
+
color: "text.secondary",
|
|
948
|
+
padding: "6px"
|
|
949
|
+
},
|
|
950
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _Close2.default, { fontSize: "small" })
|
|
951
|
+
}
|
|
952
|
+
)
|
|
953
|
+
] }),
|
|
954
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "form", { onSubmit: handleSearchSubmit, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
955
|
+
_material.TextField,
|
|
956
|
+
{
|
|
957
|
+
fullWidth: true,
|
|
958
|
+
size: "medium",
|
|
959
|
+
placeholder: "Search in document...",
|
|
960
|
+
value: searchTerm,
|
|
961
|
+
onChange: handleSearchChange,
|
|
962
|
+
autoComplete: "off",
|
|
963
|
+
InputProps: {
|
|
964
|
+
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 } }) }),
|
|
965
|
+
endAdornment: searchTerm && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.InputAdornment, { position: "end", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
966
|
+
_material.IconButton,
|
|
967
|
+
{
|
|
968
|
+
size: "small",
|
|
969
|
+
onClick: handleClearSearch,
|
|
970
|
+
sx: {
|
|
971
|
+
color: "text.secondary",
|
|
972
|
+
padding: "4px",
|
|
973
|
+
"&:hover": {
|
|
974
|
+
backgroundColor: "action.hover"
|
|
975
|
+
}
|
|
976
|
+
},
|
|
977
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _Clear2.default, { sx: { fontSize: 18 } })
|
|
978
|
+
}
|
|
979
|
+
) })
|
|
980
|
+
},
|
|
981
|
+
sx: {
|
|
982
|
+
"& .MuiOutlinedInput-root": {
|
|
983
|
+
fontSize: "0.9375rem",
|
|
984
|
+
backgroundColor: "background.paper",
|
|
985
|
+
borderRadius: "8px",
|
|
986
|
+
"& fieldset": {
|
|
987
|
+
borderColor: "divider"
|
|
988
|
+
},
|
|
989
|
+
"&.Mui-focused fieldset": {
|
|
990
|
+
borderColor: "primary.main",
|
|
991
|
+
borderWidth: "2px"
|
|
992
|
+
}
|
|
993
|
+
},
|
|
994
|
+
"& .MuiInputBase-input": {
|
|
995
|
+
padding: "10px 14px"
|
|
996
|
+
}
|
|
997
|
+
}
|
|
998
|
+
}
|
|
999
|
+
) }),
|
|
1000
|
+
totalResults > 0 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1001
|
+
_material.Box,
|
|
1002
|
+
{
|
|
1003
|
+
sx: {
|
|
1004
|
+
display: "flex",
|
|
1005
|
+
alignItems: "center",
|
|
1006
|
+
justifyContent: "space-between",
|
|
1007
|
+
mt: 2,
|
|
1008
|
+
pt: 2,
|
|
1009
|
+
borderTop: "1px solid",
|
|
1010
|
+
borderColor: "divider"
|
|
1011
|
+
},
|
|
1012
|
+
children: [
|
|
1013
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _material.Typography, { variant: "body2", sx: { color: "text.secondary", fontSize: "0.875rem", fontWeight: 500 }, children: [
|
|
1014
|
+
currentResultIndex + 1,
|
|
1015
|
+
" of ",
|
|
1016
|
+
totalResults,
|
|
1017
|
+
" results"
|
|
1018
|
+
] }),
|
|
1019
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _material.Box, { sx: { display: "flex", alignItems: "center", gap: 0.5 }, children: [
|
|
1020
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1021
|
+
_material.IconButton,
|
|
1022
|
+
{
|
|
1023
|
+
size: "small",
|
|
1024
|
+
onClick: onPreviousResult,
|
|
1025
|
+
disabled: currentResultIndex <= 0,
|
|
1026
|
+
sx: {
|
|
1027
|
+
color: currentResultIndex <= 0 ? "text.disabled" : "primary.main",
|
|
1028
|
+
padding: "6px",
|
|
1029
|
+
borderRadius: "6px",
|
|
1030
|
+
border: "1px solid",
|
|
1031
|
+
borderColor: currentResultIndex <= 0 ? "divider" : "primary.main"
|
|
1032
|
+
},
|
|
1033
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _KeyboardArrowUp2.default, { sx: { fontSize: 20 } })
|
|
1034
|
+
}
|
|
1035
|
+
),
|
|
1036
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1037
|
+
_material.IconButton,
|
|
1038
|
+
{
|
|
1039
|
+
size: "small",
|
|
1040
|
+
onClick: onNextResult,
|
|
1041
|
+
disabled: currentResultIndex >= totalResults - 1,
|
|
1042
|
+
sx: {
|
|
1043
|
+
color: currentResultIndex >= totalResults - 1 ? "text.disabled" : "primary.main",
|
|
1044
|
+
padding: "6px",
|
|
1045
|
+
borderRadius: "6px",
|
|
1046
|
+
border: "1px solid",
|
|
1047
|
+
borderColor: currentResultIndex >= totalResults - 1 ? "divider" : "primary.main"
|
|
1048
|
+
},
|
|
1049
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _KeyboardArrowDown2.default, { sx: { fontSize: 20 } })
|
|
1050
|
+
}
|
|
1051
|
+
)
|
|
1052
|
+
] })
|
|
1053
|
+
]
|
|
1054
|
+
}
|
|
1055
|
+
)
|
|
1056
|
+
] }),
|
|
1057
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Divider, {}),
|
|
1058
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _material.Box, { ref: contentRef, className: "search-sidebar-content", sx: {
|
|
1059
|
+
flex: 1,
|
|
1060
|
+
overflow: "auto",
|
|
1061
|
+
backgroundColor: "background.default"
|
|
1062
|
+
}, children: [
|
|
1063
|
+
!searchTerm && !hasSearched && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _material.Box, { sx: { p: 4, textAlign: "center", mt: 6 }, children: [
|
|
1064
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1065
|
+
_material.Box,
|
|
1066
|
+
{
|
|
1067
|
+
sx: {
|
|
1068
|
+
width: 80,
|
|
1069
|
+
height: 80,
|
|
1070
|
+
borderRadius: "50%",
|
|
1071
|
+
backgroundColor: "action.hover",
|
|
1072
|
+
display: "flex",
|
|
1073
|
+
alignItems: "center",
|
|
1074
|
+
justifyContent: "center",
|
|
1075
|
+
margin: "0 auto",
|
|
1076
|
+
mb: 3
|
|
1077
|
+
},
|
|
1078
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _Search2.default, { sx: { fontSize: 40, color: "text.disabled" } })
|
|
1079
|
+
}
|
|
1080
|
+
),
|
|
1081
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Typography, { variant: "body1", sx: { color: "text.primary", fontWeight: 500, mb: 1 }, children: "Search in Document" }),
|
|
1082
|
+
/* @__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" })
|
|
1083
|
+
] }),
|
|
1084
|
+
searchTerm && !hasSearched && !isSearching && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _material.Box, { sx: { p: 4, textAlign: "center", mt: 6 }, children: [
|
|
1085
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1086
|
+
_material.Box,
|
|
1087
|
+
{
|
|
1088
|
+
sx: {
|
|
1089
|
+
width: 80,
|
|
1090
|
+
height: 80,
|
|
1091
|
+
borderRadius: "50%",
|
|
1092
|
+
backgroundColor: "primary.light",
|
|
1093
|
+
display: "flex",
|
|
1094
|
+
alignItems: "center",
|
|
1095
|
+
justifyContent: "center",
|
|
1096
|
+
margin: "0 auto",
|
|
1097
|
+
mb: 3,
|
|
1098
|
+
opacity: 0.2
|
|
1099
|
+
},
|
|
1100
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _FindInPage2.default, { sx: { fontSize: 40, color: "primary.main" } })
|
|
1101
|
+
}
|
|
1102
|
+
),
|
|
1103
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Typography, { variant: "body1", sx: { color: "text.primary", fontWeight: 500, mb: 1 }, children: "Ready to Search" }),
|
|
1104
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Typography, { variant: "body2", sx: { color: "text.secondary", mb: 2, lineHeight: 1.6 }, children: "Press Enter to find" }),
|
|
1105
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1106
|
+
_material.Typography,
|
|
1107
|
+
{
|
|
1108
|
+
variant: "body2",
|
|
1109
|
+
sx: {
|
|
1110
|
+
color: "white",
|
|
1111
|
+
fontWeight: 600,
|
|
1112
|
+
backgroundColor: (theme) => theme.palette.mode === "dark" ? "rgba(144, 202, 249, 0.16)" : "primary.light",
|
|
1113
|
+
padding: "6px 16px",
|
|
1114
|
+
borderRadius: "16px",
|
|
1115
|
+
display: "inline-block",
|
|
1116
|
+
opacity: 0.9
|
|
1117
|
+
},
|
|
1118
|
+
children: [
|
|
1119
|
+
'"',
|
|
1120
|
+
searchTerm,
|
|
1121
|
+
'"'
|
|
1122
|
+
]
|
|
1123
|
+
}
|
|
1124
|
+
)
|
|
1125
|
+
] }),
|
|
1126
|
+
isSearching && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _material.Box, { sx: { p: 4, textAlign: "center", mt: 6 }, children: [
|
|
1127
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1128
|
+
_material.Box,
|
|
1129
|
+
{
|
|
1130
|
+
sx: {
|
|
1131
|
+
display: "flex",
|
|
1132
|
+
alignItems: "center",
|
|
1133
|
+
justifyContent: "center",
|
|
1134
|
+
margin: "0 auto",
|
|
1135
|
+
mb: 3
|
|
1136
|
+
},
|
|
1137
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.CircularProgress, { size: 60, thickness: 4 })
|
|
1138
|
+
}
|
|
1139
|
+
),
|
|
1140
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Typography, { variant: "body1", sx: { color: "text.primary", fontWeight: 500, mb: 1 }, children: "Searching..." }),
|
|
1141
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _material.Typography, { variant: "body2", sx: { color: "text.secondary", lineHeight: 1.6 }, children: [
|
|
1142
|
+
'Finding matches for "',
|
|
1143
|
+
searchTerm,
|
|
1144
|
+
'"'
|
|
1145
|
+
] })
|
|
1146
|
+
] }),
|
|
1147
|
+
hasSearched && totalResults === 0 && !isSearching && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _material.Box, { sx: { p: 4, textAlign: "center", mt: 6 }, children: [
|
|
1148
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1149
|
+
_material.Box,
|
|
1150
|
+
{
|
|
1151
|
+
sx: {
|
|
1152
|
+
width: 80,
|
|
1153
|
+
height: 80,
|
|
1154
|
+
borderRadius: "50%",
|
|
1155
|
+
backgroundColor: (theme) => theme.palette.mode === "dark" ? "rgba(255, 152, 0, 0.12)" : "warning.light",
|
|
1156
|
+
display: "flex",
|
|
1157
|
+
alignItems: "center",
|
|
1158
|
+
justifyContent: "center",
|
|
1159
|
+
margin: "0 auto",
|
|
1160
|
+
mb: 3,
|
|
1161
|
+
opacity: 0.6
|
|
1162
|
+
},
|
|
1163
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _Search2.default, { sx: { fontSize: 40, color: "warning.main" } })
|
|
1164
|
+
}
|
|
1165
|
+
),
|
|
1166
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Typography, { variant: "body1", sx: { color: "text.primary", fontWeight: 500, mb: 1 }, children: "No Results Found" }),
|
|
1167
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _material.Typography, { variant: "body2", sx: { color: "text.secondary", lineHeight: 1.6 }, children: [
|
|
1168
|
+
"No matches found for ",
|
|
1169
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "strong", { children: [
|
|
1170
|
+
'"',
|
|
1171
|
+
searchTerm,
|
|
1172
|
+
'"'
|
|
1173
|
+
] })
|
|
1174
|
+
] })
|
|
1175
|
+
] }),
|
|
1176
|
+
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) => {
|
|
1177
|
+
const pageNumber = parseInt(pageNum);
|
|
1178
|
+
const pageResults = resultsByPage[pageNumber];
|
|
1179
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _material.Box, { sx: { mb: 3 }, children: [
|
|
1180
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1181
|
+
_material.Typography,
|
|
1182
|
+
{
|
|
1183
|
+
variant: "subtitle2",
|
|
1184
|
+
sx: {
|
|
1185
|
+
color: "text.secondary",
|
|
1186
|
+
mb: 1.5,
|
|
1187
|
+
px: 1,
|
|
1188
|
+
fontSize: "0.8125rem",
|
|
1189
|
+
fontWeight: 600,
|
|
1190
|
+
textTransform: "uppercase",
|
|
1191
|
+
letterSpacing: "0.5px"
|
|
1192
|
+
},
|
|
1193
|
+
children: [
|
|
1194
|
+
"Page ",
|
|
1195
|
+
pageNumber
|
|
1196
|
+
]
|
|
1197
|
+
}
|
|
1198
|
+
),
|
|
1199
|
+
pageResults.map((result, index) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1200
|
+
_material.Box,
|
|
1201
|
+
{
|
|
1202
|
+
onClick: () => onSearchResultClick(result.pageNumber, result.index),
|
|
1203
|
+
sx: {
|
|
1204
|
+
p: 2,
|
|
1205
|
+
mx: 1,
|
|
1206
|
+
mb: 1.5,
|
|
1207
|
+
borderRadius: "8px",
|
|
1208
|
+
border: "2px solid",
|
|
1209
|
+
borderColor: result.index === currentResultIndex ? "primary.main" : "divider",
|
|
1210
|
+
backgroundColor: "background.paper",
|
|
1211
|
+
cursor: "pointer",
|
|
1212
|
+
transition: "all 0.2s ease",
|
|
1213
|
+
boxShadow: (theme) => theme.palette.mode === "dark" ? "0 1px 3px rgba(0, 0, 0, 0.3)" : "0 1px 3px rgba(0, 0, 0, 0.05)",
|
|
1214
|
+
"&:hover": {
|
|
1215
|
+
borderColor: "primary.main",
|
|
1216
|
+
boxShadow: (theme) => theme.palette.mode === "dark" ? "0 2px 8px rgba(255, 255, 255, 0.15)" : "0 2px 8px rgba(0, 0, 0, 0.1)",
|
|
1217
|
+
transform: "translateY(-1px)"
|
|
1218
|
+
}
|
|
1219
|
+
},
|
|
1220
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1221
|
+
_material.Typography,
|
|
1222
|
+
{
|
|
1223
|
+
variant: "body2",
|
|
1224
|
+
className: "search-result-text",
|
|
1225
|
+
sx: {
|
|
1226
|
+
fontSize: "0.875rem",
|
|
1227
|
+
lineHeight: 1.6,
|
|
1228
|
+
color: result.index === currentResultIndex ? "text.primary" : "text.secondary"
|
|
1229
|
+
},
|
|
1230
|
+
children: highlightText(result.context, searchTerm)
|
|
1231
|
+
}
|
|
1232
|
+
)
|
|
1233
|
+
},
|
|
1234
|
+
index
|
|
1235
|
+
))
|
|
1236
|
+
] }, pageNumber);
|
|
1237
|
+
}) })
|
|
1238
|
+
] })
|
|
1239
|
+
]
|
|
1240
|
+
}
|
|
1241
|
+
);
|
|
1242
|
+
};
|
|
1243
|
+
|
|
1244
|
+
// src/components/viewers/pdf/PasswordDialog.tsx
|
|
1245
|
+
|
|
1246
|
+
|
|
1247
|
+
|
|
1248
|
+
|
|
1249
|
+
|
|
1250
|
+
|
|
1251
|
+
|
|
1252
|
+
|
|
1253
|
+
|
|
1254
|
+
|
|
1255
|
+
|
|
1256
|
+
|
|
1257
|
+
|
|
1258
|
+
|
|
1259
|
+
|
|
1260
|
+
var _Lock = require('@mui/icons-material/Lock'); var _Lock2 = _interopRequireDefault(_Lock);
|
|
1261
|
+
var _Visibility = require('@mui/icons-material/Visibility'); var _Visibility2 = _interopRequireDefault(_Visibility);
|
|
1262
|
+
var _VisibilityOff = require('@mui/icons-material/VisibilityOff'); var _VisibilityOff2 = _interopRequireDefault(_VisibilityOff);
|
|
1263
|
+
|
|
1264
|
+
var PasswordDialog = ({
|
|
1265
|
+
open,
|
|
1266
|
+
fileName,
|
|
1267
|
+
onSubmit,
|
|
1268
|
+
onCancel,
|
|
1269
|
+
error,
|
|
1270
|
+
isLoading = false
|
|
1271
|
+
}) => {
|
|
1272
|
+
const [password, setPassword] = _react.useState.call(void 0, "");
|
|
1273
|
+
const [showPassword, setShowPassword] = _react.useState.call(void 0, false);
|
|
1274
|
+
_react.useEffect.call(void 0, () => {
|
|
1275
|
+
if (open && !isLoading) {
|
|
1276
|
+
if (error) {
|
|
1277
|
+
setPassword("");
|
|
1278
|
+
}
|
|
1279
|
+
}
|
|
1280
|
+
}, [open, error, isLoading]);
|
|
1281
|
+
_react.useEffect.call(void 0, () => {
|
|
1282
|
+
if (open) {
|
|
1283
|
+
setShowPassword(false);
|
|
1284
|
+
if (!error) {
|
|
1285
|
+
setPassword("");
|
|
1286
|
+
}
|
|
1287
|
+
}
|
|
1288
|
+
}, [open]);
|
|
1289
|
+
const handleSubmit = (e) => {
|
|
1290
|
+
e.preventDefault();
|
|
1291
|
+
if (password.trim() && !isLoading) {
|
|
1292
|
+
onSubmit(password);
|
|
1293
|
+
}
|
|
1294
|
+
};
|
|
1295
|
+
const handleTogglePasswordVisibility = () => {
|
|
1296
|
+
setShowPassword(!showPassword);
|
|
1297
|
+
};
|
|
1298
|
+
const handleKeyPress = (e) => {
|
|
1299
|
+
if (e.key === "Enter" && password.trim() && !isLoading) {
|
|
1300
|
+
handleSubmit(e);
|
|
1301
|
+
}
|
|
1302
|
+
};
|
|
1303
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
1304
|
+
_material.Dialog,
|
|
1305
|
+
{
|
|
1306
|
+
open,
|
|
1307
|
+
disableEscapeKeyDown: true,
|
|
1308
|
+
onClose: (event, reason) => {
|
|
1309
|
+
if (reason === "backdropClick") return;
|
|
1310
|
+
},
|
|
1311
|
+
maxWidth: "sm",
|
|
1312
|
+
fullWidth: true,
|
|
1313
|
+
slotProps: {
|
|
1314
|
+
backdrop: {
|
|
1315
|
+
sx: {
|
|
1316
|
+
backdropFilter: "blur(8px)",
|
|
1317
|
+
backgroundColor: "rgba(0, 0, 0, 0.6)"
|
|
1318
|
+
}
|
|
1319
|
+
}
|
|
1320
|
+
},
|
|
1321
|
+
PaperProps: {
|
|
1322
|
+
sx: {
|
|
1323
|
+
borderRadius: 2
|
|
1324
|
+
}
|
|
1325
|
+
},
|
|
1326
|
+
children: [
|
|
1327
|
+
/* @__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", gap: 1.5 }, children: [
|
|
1328
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1329
|
+
_material.Box,
|
|
1330
|
+
{
|
|
1331
|
+
sx: {
|
|
1332
|
+
width: 40,
|
|
1333
|
+
height: 40,
|
|
1334
|
+
borderRadius: "50%",
|
|
1335
|
+
backgroundColor: "primary.light",
|
|
1336
|
+
display: "flex",
|
|
1337
|
+
alignItems: "center",
|
|
1338
|
+
justifyContent: "center",
|
|
1339
|
+
opacity: 0.9
|
|
1340
|
+
},
|
|
1341
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _Lock2.default, { sx: { color: "white", fontSize: 20 } })
|
|
1342
|
+
}
|
|
1343
|
+
),
|
|
1344
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Typography, { variant: "h6", component: "div", sx: { fontWeight: 600 }, children: "Password Protected" })
|
|
1345
|
+
] }) }),
|
|
1346
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _material.DialogContent, { sx: { pt: 2 }, children: [
|
|
1347
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _material.Typography, { variant: "body2", sx: { color: "text.secondary", mb: 3 }, children: [
|
|
1348
|
+
"This PDF is password protected. Please enter the password to view",
|
|
1349
|
+
" ",
|
|
1350
|
+
fileName && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "strong", { children: [
|
|
1351
|
+
'"',
|
|
1352
|
+
fileName,
|
|
1353
|
+
'"'
|
|
1354
|
+
] })
|
|
1355
|
+
] }),
|
|
1356
|
+
error && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Alert, { severity: "error", sx: { mb: 2 }, children: error }),
|
|
1357
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "form", { onSubmit: handleSubmit, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1358
|
+
_material.TextField,
|
|
1359
|
+
{
|
|
1360
|
+
fullWidth: true,
|
|
1361
|
+
autoFocus: true,
|
|
1362
|
+
type: showPassword ? "text" : "password",
|
|
1363
|
+
label: "Password",
|
|
1364
|
+
placeholder: "Enter password",
|
|
1365
|
+
value: password,
|
|
1366
|
+
onChange: (e) => setPassword(e.target.value),
|
|
1367
|
+
onKeyPress: handleKeyPress,
|
|
1368
|
+
error: Boolean(error),
|
|
1369
|
+
disabled: isLoading,
|
|
1370
|
+
InputProps: {
|
|
1371
|
+
endAdornment: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.InputAdornment, { position: "end", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1372
|
+
_material.IconButton,
|
|
1373
|
+
{
|
|
1374
|
+
onClick: handleTogglePasswordVisibility,
|
|
1375
|
+
edge: "end",
|
|
1376
|
+
size: "small",
|
|
1377
|
+
"aria-label": showPassword ? "Hide password" : "Show password",
|
|
1378
|
+
disabled: isLoading,
|
|
1379
|
+
children: showPassword ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _VisibilityOff2.default, {}) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _Visibility2.default, {})
|
|
1380
|
+
}
|
|
1381
|
+
) })
|
|
1382
|
+
},
|
|
1383
|
+
sx: {
|
|
1384
|
+
"& .MuiOutlinedInput-root": {
|
|
1385
|
+
borderRadius: 2
|
|
1386
|
+
}
|
|
1387
|
+
}
|
|
1388
|
+
}
|
|
1389
|
+
) })
|
|
1390
|
+
] }),
|
|
1391
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.DialogActions, { sx: { px: 3, pb: 3, pt: 2 }, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
1392
|
+
_material.Button,
|
|
1393
|
+
{
|
|
1394
|
+
onClick: handleSubmit,
|
|
1395
|
+
variant: "contained",
|
|
1396
|
+
disabled: !password.trim() || isLoading,
|
|
1397
|
+
sx: {
|
|
1398
|
+
borderRadius: 2,
|
|
1399
|
+
textTransform: "none",
|
|
1400
|
+
px: 3,
|
|
1401
|
+
boxShadow: 2,
|
|
1402
|
+
minWidth: 120
|
|
1403
|
+
},
|
|
1404
|
+
children: isLoading ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
|
|
1405
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.CircularProgress, { size: 16, color: "inherit", sx: { mr: 1 } }),
|
|
1406
|
+
"Verifying..."
|
|
1407
|
+
] }) : "Unlock PDF"
|
|
1408
|
+
}
|
|
1409
|
+
) })
|
|
1410
|
+
]
|
|
1411
|
+
}
|
|
1412
|
+
);
|
|
1413
|
+
};
|
|
1414
|
+
|
|
1415
|
+
// src/components/viewers/PDFViewer.tsx
|
|
1416
|
+
|
|
1417
|
+
|
|
1418
|
+
var PDFViewerContent = _react.forwardRef.call(void 0,
|
|
1419
|
+
(props, ref) => {
|
|
1420
|
+
const {
|
|
1421
|
+
file,
|
|
1422
|
+
onLoad,
|
|
1423
|
+
onError,
|
|
1424
|
+
fileName,
|
|
1425
|
+
showPageCount = true,
|
|
1426
|
+
showPageNavigation = true,
|
|
1427
|
+
showZoomControls = true,
|
|
1428
|
+
showRotation = true,
|
|
1429
|
+
showDownload = true,
|
|
1430
|
+
showPrint = true,
|
|
1431
|
+
showSearch = true,
|
|
1432
|
+
showMetadata = true,
|
|
1433
|
+
showProperties = true,
|
|
1434
|
+
showTags = true,
|
|
1435
|
+
showHistory = true,
|
|
1436
|
+
onMetadataClick,
|
|
1437
|
+
onPropertiesClick,
|
|
1438
|
+
onTagsClick,
|
|
1439
|
+
onHistoryClick,
|
|
1440
|
+
onDownloadClick,
|
|
1441
|
+
onDownloadWithAnnotations,
|
|
1442
|
+
onDownloadWithoutAnnotations,
|
|
1443
|
+
onPrintClick,
|
|
1444
|
+
onPrintWithAnnotations,
|
|
1445
|
+
onPrintWithoutAnnotations,
|
|
1446
|
+
initialSearchText,
|
|
1447
|
+
initialSearchPages,
|
|
1448
|
+
showAnnotations,
|
|
1449
|
+
userDetails,
|
|
1450
|
+
annotationSelectionMenu,
|
|
1451
|
+
isHighlighterActive,
|
|
1452
|
+
isStampActive,
|
|
1453
|
+
onHighlighterClick,
|
|
1454
|
+
onStampClick,
|
|
1455
|
+
onSignatureClick,
|
|
1456
|
+
onNoteClick,
|
|
1457
|
+
isAnnotationForeign,
|
|
1458
|
+
onAnnotationNoteClick,
|
|
1459
|
+
isAnnotationInteractive,
|
|
1460
|
+
// New granular toolbar props
|
|
1461
|
+
showAnnotate,
|
|
1462
|
+
disabledAnnotate,
|
|
1463
|
+
showPrintOriginal,
|
|
1464
|
+
showPrintWithAnnotations,
|
|
1465
|
+
showDownloadOriginal,
|
|
1466
|
+
showDownloadWithAnnotations,
|
|
1467
|
+
// Annotation save props
|
|
1468
|
+
hasUnsavedAnnotations,
|
|
1469
|
+
isSavingAnnotations,
|
|
1470
|
+
canSaveAnnotations,
|
|
1471
|
+
onSaveAnnotations,
|
|
1472
|
+
loading,
|
|
1473
|
+
themeMode = "light"
|
|
1474
|
+
} = props;
|
|
1475
|
+
const [pdfBuffer, setPdfBuffer] = _react.useState.call(void 0, null);
|
|
1476
|
+
const [state, setState] = _react.useState.call(void 0, "idle");
|
|
1477
|
+
const [error, setError] = _react.useState.call(void 0, null);
|
|
1478
|
+
const pdfViewerRef = _react.useRef.call(void 0, null);
|
|
1479
|
+
const [isInternalReady, setIsInternalReady] = _react.useState.call(void 0, false);
|
|
1480
|
+
const [internalHighlighterActive, setInternalHighlighterActive] = _react.useState.call(void 0, false);
|
|
1481
|
+
const [internalStampActive, setInternalStampActive] = _react.useState.call(void 0, false);
|
|
1482
|
+
const highlighterActive = isHighlighterActive !== void 0 ? isHighlighterActive : internalHighlighterActive;
|
|
1483
|
+
const stampActive = isStampActive !== void 0 ? isStampActive : internalStampActive;
|
|
1484
|
+
const resolvedFileName = _react.useMemo.call(void 0, () => {
|
|
1485
|
+
if (fileName) return fileName;
|
|
1486
|
+
if (file instanceof File) return file.name;
|
|
1487
|
+
if (typeof file === "string") {
|
|
1488
|
+
const urlParts = file.split("/");
|
|
1489
|
+
return urlParts[urlParts.length - 1] || "document.pdf";
|
|
1490
|
+
}
|
|
1491
|
+
return "document.pdf";
|
|
1492
|
+
}, [file, fileName]);
|
|
1493
|
+
const fileExtension = _react.useMemo.call(void 0,
|
|
1494
|
+
() => _chunkOPJOCUSLjs.getFileExtension.call(void 0, resolvedFileName),
|
|
1495
|
+
[resolvedFileName]
|
|
1496
|
+
);
|
|
1497
|
+
const [currentPage, setCurrentPage] = _react.useState.call(void 0, 1);
|
|
1498
|
+
const [totalPages, setTotalPages] = _react.useState.call(void 0, 0);
|
|
1499
|
+
const [zoom, setZoom] = _react.useState.call(void 0, 122);
|
|
1500
|
+
const [searchQuery, setSearchQuery] = _react.useState.call(void 0, "");
|
|
1501
|
+
const [isSearching, setIsSearching] = _react.useState.call(void 0, false);
|
|
1502
|
+
const [pdfContainer, setPdfContainer] = _react.useState.call(void 0, null);
|
|
1503
|
+
const [isSidebarOpen, setIsSidebarOpen] = _react.useState.call(void 0, false);
|
|
1504
|
+
const [searchResults, setSearchResults] = _react.useState.call(void 0, []);
|
|
1505
|
+
const [currentSearchResultIndex, setCurrentSearchResultIndex] = _react.useState.call(void 0, 0);
|
|
1506
|
+
const [totalSearchResults, setTotalSearchResults] = _react.useState.call(void 0, 0);
|
|
1507
|
+
const [autoExecuteSearch, setAutoExecuteSearch] = _react.useState.call(void 0,
|
|
1508
|
+
!!initialSearchText
|
|
1509
|
+
);
|
|
1510
|
+
const [isFullScreen, setIsFullScreen] = _react.useState.call(void 0, false);
|
|
1511
|
+
const [twoPageMode, setTwoPageMode] = _react.useState.call(void 0, false);
|
|
1512
|
+
const [scrollStrategy, setScrollStrategy] = _react.useState.call(void 0, _pdfviewer.ScrollStrategy.Vertical);
|
|
1513
|
+
const [showThumbnails, setShowThumbnails] = _react.useState.call(void 0, true);
|
|
1514
|
+
const [activeMode, setActiveMode] = _react.useState.call(void 0, "view");
|
|
1515
|
+
const containerRef = _react.useRef.call(void 0, null);
|
|
1516
|
+
const [isPasswordDialogOpen, setIsPasswordDialogOpen] = _react.useState.call(void 0, false);
|
|
1517
|
+
const [passwordError, setPasswordError] = _react.useState.call(void 0, "");
|
|
1518
|
+
const [isVerifyingPassword, setIsVerifyingPassword] = _react.useState.call(void 0, false);
|
|
1519
|
+
const [passwordResolve, setPasswordResolve] = _react.useState.call(void 0, null);
|
|
1520
|
+
const passwordTimeoutRef = _react.useRef.call(void 0, null);
|
|
1521
|
+
const hasExecutedInitialSearch = _react.useRef.call(void 0, false);
|
|
1522
|
+
const handleToggleFullScreen = _react.useCallback.call(void 0, () => {
|
|
1523
|
+
if (!isFullScreen && _optionalChain([containerRef, 'access', _15 => _15.current, 'optionalAccess', _16 => _16.requestFullscreen])) {
|
|
1524
|
+
containerRef.current.requestFullscreen();
|
|
1525
|
+
setIsFullScreen(true);
|
|
1526
|
+
} else if (isFullScreen && document.exitFullscreen) {
|
|
1527
|
+
document.exitFullscreen();
|
|
1528
|
+
setIsFullScreen(false);
|
|
1529
|
+
}
|
|
1530
|
+
}, [isFullScreen]);
|
|
1531
|
+
_react.useEffect.call(void 0, () => {
|
|
1532
|
+
const handleFullscreenChange = () => {
|
|
1533
|
+
const isCurrentlyFullscreen = !!document.fullscreenElement;
|
|
1534
|
+
setIsFullScreen(isCurrentlyFullscreen);
|
|
1535
|
+
};
|
|
1536
|
+
document.addEventListener("fullscreenchange", handleFullscreenChange);
|
|
1537
|
+
return () => {
|
|
1538
|
+
document.removeEventListener("fullscreenchange", handleFullscreenChange);
|
|
1539
|
+
};
|
|
1540
|
+
}, []);
|
|
1541
|
+
const handleSidebarClose = _react.useCallback.call(void 0, () => {
|
|
1542
|
+
setIsSidebarOpen(false);
|
|
1543
|
+
setSearchQuery("");
|
|
1544
|
+
setSearchResults([]);
|
|
1545
|
+
setTotalSearchResults(0);
|
|
1546
|
+
setCurrentSearchResultIndex(0);
|
|
1547
|
+
_optionalChain([pdfViewerRef, 'access', _17 => _17.current, 'optionalAccess', _18 => _18.search, 'access', _19 => _19.stopSearch, 'call', _20 => _20()]);
|
|
1548
|
+
}, []);
|
|
1549
|
+
const toolbar = _chunkEM63H4SAjs.mergeToolbarConfig.call(void 0, {
|
|
1550
|
+
showDownload,
|
|
1551
|
+
showPrint,
|
|
1552
|
+
showMetadata,
|
|
1553
|
+
showProperties,
|
|
1554
|
+
showTags,
|
|
1555
|
+
showHistory,
|
|
1556
|
+
showRotation,
|
|
1557
|
+
onDownloadClick,
|
|
1558
|
+
onPrintClick,
|
|
1559
|
+
onMetadataClick,
|
|
1560
|
+
onPropertiesClick,
|
|
1561
|
+
onTagsClick,
|
|
1562
|
+
onHistoryClick,
|
|
1563
|
+
toolbarActions: props.toolbarActions
|
|
1564
|
+
});
|
|
1565
|
+
const toolbarHandlers = _react.useMemo.call(void 0,
|
|
1566
|
+
() => ({
|
|
1567
|
+
handleZoomIn: () => {
|
|
1568
|
+
_optionalChain([pdfViewerRef, 'access', _21 => _21.current, 'optionalAccess', _22 => _22.zoom, 'access', _23 => _23.zoomIn, 'call', _24 => _24()]);
|
|
1569
|
+
requestAnimationFrame(() => {
|
|
1570
|
+
const zoomValue = _optionalChain([pdfViewerRef, 'access', _25 => _25.current, 'optionalAccess', _26 => _26.zoom, 'access', _27 => _27.getZoom, 'call', _28 => _28()]);
|
|
1571
|
+
if (typeof zoomValue === "number") {
|
|
1572
|
+
setZoom(Math.round(zoomValue * 100));
|
|
1573
|
+
}
|
|
1574
|
+
});
|
|
1575
|
+
},
|
|
1576
|
+
handleZoomOut: () => {
|
|
1577
|
+
_optionalChain([pdfViewerRef, 'access', _29 => _29.current, 'optionalAccess', _30 => _30.zoom, 'access', _31 => _31.zoomOut, 'call', _32 => _32()]);
|
|
1578
|
+
requestAnimationFrame(() => {
|
|
1579
|
+
const zoomValue = _optionalChain([pdfViewerRef, 'access', _33 => _33.current, 'optionalAccess', _34 => _34.zoom, 'access', _35 => _35.getZoom, 'call', _36 => _36()]);
|
|
1580
|
+
if (typeof zoomValue === "number") {
|
|
1581
|
+
setZoom(Math.round(zoomValue * 100));
|
|
1582
|
+
}
|
|
1583
|
+
});
|
|
1584
|
+
},
|
|
1585
|
+
handleFitToWidth: () => {
|
|
1586
|
+
_optionalChain([pdfViewerRef, 'access', _37 => _37.current, 'optionalAccess', _38 => _38.zoom, 'access', _39 => _39.fitToWidth, 'call', _40 => _40()]);
|
|
1587
|
+
requestAnimationFrame(() => {
|
|
1588
|
+
const zoomValue = _optionalChain([pdfViewerRef, 'access', _41 => _41.current, 'optionalAccess', _42 => _42.zoom, 'access', _43 => _43.getZoom, 'call', _44 => _44()]);
|
|
1589
|
+
if (typeof zoomValue === "number") {
|
|
1590
|
+
setZoom(Math.round(zoomValue * 100));
|
|
1591
|
+
}
|
|
1592
|
+
});
|
|
1593
|
+
},
|
|
1594
|
+
handleFitToPage: () => {
|
|
1595
|
+
_optionalChain([pdfViewerRef, 'access', _45 => _45.current, 'optionalAccess', _46 => _46.zoom, 'access', _47 => _47.fitToPage, 'call', _48 => _48()]);
|
|
1596
|
+
requestAnimationFrame(() => {
|
|
1597
|
+
const zoomValue = _optionalChain([pdfViewerRef, 'access', _49 => _49.current, 'optionalAccess', _50 => _50.zoom, 'access', _51 => _51.getZoom, 'call', _52 => _52()]);
|
|
1598
|
+
if (typeof zoomValue === "number") {
|
|
1599
|
+
setZoom(Math.round(zoomValue * 100));
|
|
1600
|
+
}
|
|
1601
|
+
});
|
|
1602
|
+
},
|
|
1603
|
+
handlePreviousPage: () => {
|
|
1604
|
+
_optionalChain([pdfViewerRef, 'access', _53 => _53.current, 'optionalAccess', _54 => _54.navigation, 'access', _55 => _55.previousPage, 'call', _56 => _56()]);
|
|
1605
|
+
requestAnimationFrame(() => {
|
|
1606
|
+
const current = _optionalChain([pdfViewerRef, 'access', _57 => _57.current, 'optionalAccess', _58 => _58.navigation, 'access', _59 => _59.getCurrentPage, 'call', _60 => _60()]) || 1;
|
|
1607
|
+
setCurrentPage(current);
|
|
1608
|
+
});
|
|
1609
|
+
},
|
|
1610
|
+
handleNextPage: () => {
|
|
1611
|
+
_optionalChain([pdfViewerRef, 'access', _61 => _61.current, 'optionalAccess', _62 => _62.navigation, 'access', _63 => _63.nextPage, 'call', _64 => _64()]);
|
|
1612
|
+
requestAnimationFrame(() => {
|
|
1613
|
+
const current = _optionalChain([pdfViewerRef, 'access', _65 => _65.current, 'optionalAccess', _66 => _66.navigation, 'access', _67 => _67.getCurrentPage, 'call', _68 => _68()]) || 1;
|
|
1614
|
+
setCurrentPage(current);
|
|
1615
|
+
});
|
|
1616
|
+
},
|
|
1617
|
+
handleFirstPage: () => {
|
|
1618
|
+
_optionalChain([pdfViewerRef, 'access', _69 => _69.current, 'optionalAccess', _70 => _70.navigation, 'access', _71 => _71.goToFirstPage, 'call', _72 => _72()]);
|
|
1619
|
+
requestAnimationFrame(() => {
|
|
1620
|
+
const current = _optionalChain([pdfViewerRef, 'access', _73 => _73.current, 'optionalAccess', _74 => _74.navigation, 'access', _75 => _75.getCurrentPage, 'call', _76 => _76()]) || 1;
|
|
1621
|
+
setCurrentPage(current);
|
|
1622
|
+
});
|
|
1623
|
+
},
|
|
1624
|
+
handleLastPage: () => {
|
|
1625
|
+
_optionalChain([pdfViewerRef, 'access', _77 => _77.current, 'optionalAccess', _78 => _78.navigation, 'access', _79 => _79.goToLastPage, 'call', _80 => _80()]);
|
|
1626
|
+
requestAnimationFrame(() => {
|
|
1627
|
+
const current = _optionalChain([pdfViewerRef, 'access', _81 => _81.current, 'optionalAccess', _82 => _82.navigation, 'access', _83 => _83.getCurrentPage, 'call', _84 => _84()]) || 1;
|
|
1628
|
+
setCurrentPage(current);
|
|
1629
|
+
});
|
|
1630
|
+
},
|
|
1631
|
+
toggleSidebar: () => {
|
|
1632
|
+
if (isSidebarOpen) {
|
|
1633
|
+
handleSidebarClose();
|
|
1634
|
+
} else {
|
|
1635
|
+
setIsSidebarOpen(true);
|
|
1636
|
+
}
|
|
1637
|
+
},
|
|
1638
|
+
handlePageInput: (e) => {
|
|
1639
|
+
const value = e.target.value;
|
|
1640
|
+
if (/^\d*$/.test(value)) {
|
|
1641
|
+
return;
|
|
1642
|
+
}
|
|
1643
|
+
const page = parseInt(value, 10);
|
|
1644
|
+
if (!isNaN(page) && page >= 1 && (totalPages === 0 || page <= totalPages)) {
|
|
1645
|
+
_optionalChain([pdfViewerRef, 'access', _85 => _85.current, 'optionalAccess', _86 => _86.navigation, 'access', _87 => _87.goToPage, 'call', _88 => _88(page)]);
|
|
1646
|
+
setCurrentPage(page);
|
|
1647
|
+
}
|
|
1648
|
+
},
|
|
1649
|
+
handlePageInputKeyPress: (e) => {
|
|
1650
|
+
if (e.key === "Enter") {
|
|
1651
|
+
const value = e.target.value;
|
|
1652
|
+
const page = parseInt(value, 10);
|
|
1653
|
+
if (!isNaN(page) && page >= 1 && (totalPages === 0 || page <= totalPages)) {
|
|
1654
|
+
_optionalChain([pdfViewerRef, 'access', _89 => _89.current, 'optionalAccess', _90 => _90.navigation, 'access', _91 => _91.goToPage, 'call', _92 => _92(page)]);
|
|
1655
|
+
setCurrentPage(page);
|
|
1656
|
+
}
|
|
1657
|
+
}
|
|
1658
|
+
},
|
|
1659
|
+
handleRotateLeft: () => {
|
|
1660
|
+
_optionalChain([pdfViewerRef, 'access', _93 => _93.current, 'optionalAccess', _94 => _94.rotate, 'optionalAccess', _95 => _95.rotateBackward, 'call', _96 => _96()]);
|
|
1661
|
+
},
|
|
1662
|
+
handleRotateRight: () => {
|
|
1663
|
+
_optionalChain([pdfViewerRef, 'access', _97 => _97.current, 'optionalAccess', _98 => _98.rotate, 'optionalAccess', _99 => _99.rotateForward, 'call', _100 => _100()]);
|
|
1664
|
+
},
|
|
1665
|
+
handlePrint: () => {
|
|
1666
|
+
_optionalChain([pdfViewerRef, 'access', _101 => _101.current, 'optionalAccess', _102 => _102.print, 'optionalAccess', _103 => _103.print, 'call', _104 => _104()]);
|
|
1667
|
+
},
|
|
1668
|
+
handlePrintWithAnnotations: async () => {
|
|
1669
|
+
if (onPrintWithAnnotations) {
|
|
1670
|
+
await onPrintWithAnnotations();
|
|
1671
|
+
} else {
|
|
1672
|
+
await _optionalChain([pdfViewerRef, 'access', _105 => _105.current, 'optionalAccess', _106 => _106.print, 'optionalAccess', _107 => _107.printWithAnnotations, 'optionalCall', _108 => _108()]);
|
|
1673
|
+
}
|
|
1674
|
+
},
|
|
1675
|
+
handlePrintWithoutAnnotations: async () => {
|
|
1676
|
+
if (onPrintWithoutAnnotations) {
|
|
1677
|
+
await onPrintWithoutAnnotations();
|
|
1678
|
+
} else {
|
|
1679
|
+
await _optionalChain([pdfViewerRef, 'access', _109 => _109.current, 'optionalAccess', _110 => _110.print, 'optionalAccess', _111 => _111.printWithoutAnnotations, 'optionalCall', _112 => _112()]);
|
|
1680
|
+
}
|
|
1681
|
+
},
|
|
1682
|
+
handleDownloadWithAnnotations: async () => {
|
|
1683
|
+
if (onDownloadWithAnnotations) {
|
|
1684
|
+
onDownloadWithAnnotations();
|
|
1685
|
+
} else {
|
|
1686
|
+
await _optionalChain([pdfViewerRef, 'access', _113 => _113.current, 'optionalAccess', _114 => _114.download, 'optionalAccess', _115 => _115.downloadWithAnnotations, 'optionalCall', _116 => _116(resolvedFileName)]);
|
|
1687
|
+
}
|
|
1688
|
+
},
|
|
1689
|
+
handleDownloadWithoutAnnotations: async () => {
|
|
1690
|
+
if (onDownloadWithoutAnnotations) {
|
|
1691
|
+
onDownloadWithoutAnnotations();
|
|
1692
|
+
} else {
|
|
1693
|
+
await _optionalChain([pdfViewerRef, 'access', _117 => _117.current, 'optionalAccess', _118 => _118.download, 'optionalAccess', _119 => _119.downloadWithoutAnnotations, 'optionalCall', _120 => _120(resolvedFileName)]);
|
|
1694
|
+
}
|
|
1695
|
+
},
|
|
1696
|
+
handleHighlighterClick: () => {
|
|
1697
|
+
if (highlighterActive) {
|
|
1698
|
+
_optionalChain([pdfViewerRef, 'access', _121 => _121.current, 'optionalAccess', _122 => _122.annotation, 'optionalAccess', _123 => _123.deactivateHighlighter, 'call', _124 => _124()]);
|
|
1699
|
+
setInternalHighlighterActive(false);
|
|
1700
|
+
} else {
|
|
1701
|
+
if (stampActive) {
|
|
1702
|
+
_optionalChain([pdfViewerRef, 'access', _125 => _125.current, 'optionalAccess', _126 => _126.annotation, 'optionalAccess', _127 => _127.deactivateStamp, 'call', _128 => _128()]);
|
|
1703
|
+
setInternalStampActive(false);
|
|
1704
|
+
}
|
|
1705
|
+
_optionalChain([pdfViewerRef, 'access', _129 => _129.current, 'optionalAccess', _130 => _130.annotation, 'optionalAccess', _131 => _131.activateHighlighter, 'call', _132 => _132()]);
|
|
1706
|
+
setInternalHighlighterActive(true);
|
|
1707
|
+
}
|
|
1708
|
+
},
|
|
1709
|
+
handleStampClick: () => {
|
|
1710
|
+
if (stampActive) {
|
|
1711
|
+
_optionalChain([pdfViewerRef, 'access', _133 => _133.current, 'optionalAccess', _134 => _134.annotation, 'optionalAccess', _135 => _135.deactivateStamp, 'call', _136 => _136()]);
|
|
1712
|
+
setInternalStampActive(false);
|
|
1713
|
+
} else {
|
|
1714
|
+
if (highlighterActive) {
|
|
1715
|
+
_optionalChain([pdfViewerRef, 'access', _137 => _137.current, 'optionalAccess', _138 => _138.annotation, 'optionalAccess', _139 => _139.deactivateHighlighter, 'call', _140 => _140()]);
|
|
1716
|
+
setInternalHighlighterActive(false);
|
|
1717
|
+
}
|
|
1718
|
+
_optionalChain([pdfViewerRef, 'access', _141 => _141.current, 'optionalAccess', _142 => _142.annotation, 'optionalAccess', _143 => _143.activateStamp, 'call', _144 => _144("")]);
|
|
1719
|
+
setInternalStampActive(true);
|
|
1720
|
+
}
|
|
1721
|
+
},
|
|
1722
|
+
handleSignatureClick: () => {
|
|
1723
|
+
},
|
|
1724
|
+
handleCopy: () => {
|
|
1725
|
+
_optionalChain([pdfViewerRef, 'access', _145 => _145.current, 'optionalAccess', _146 => _146.selection, 'access', _147 => _147.copy, 'call', _148 => _148()]);
|
|
1726
|
+
},
|
|
1727
|
+
handleToggleFullScreen
|
|
1728
|
+
}),
|
|
1729
|
+
[isSidebarOpen, totalPages, handleToggleFullScreen, highlighterActive, stampActive, onDownloadWithAnnotations, onDownloadWithoutAnnotations, onPrintWithAnnotations, onPrintWithoutAnnotations]
|
|
1730
|
+
);
|
|
1731
|
+
_react.useEffect.call(void 0, () => {
|
|
1732
|
+
if (!initialSearchText || hasExecutedInitialSearch.current) return;
|
|
1733
|
+
const isPDFReady = state === "ready";
|
|
1734
|
+
const isPagesInitialized = totalPages > 0;
|
|
1735
|
+
const isViewerAvailable = !!pdfViewerRef.current;
|
|
1736
|
+
const isSearchAPIReady = !!_optionalChain([pdfViewerRef, 'access', _149 => _149.current, 'optionalAccess', _150 => _150.search, 'optionalAccess', _151 => _151.searchText]);
|
|
1737
|
+
const canExecuteSearch = isPDFReady && isPagesInitialized && isViewerAvailable && isSearchAPIReady;
|
|
1738
|
+
if (!canExecuteSearch) return;
|
|
1739
|
+
hasExecutedInitialSearch.current = true;
|
|
1740
|
+
const SEARCH_INITIALIZATION_DELAY = 100;
|
|
1741
|
+
setTimeout(() => {
|
|
1742
|
+
if (!_optionalChain([pdfViewerRef, 'access', _152 => _152.current, 'optionalAccess', _153 => _153.search, 'optionalAccess', _154 => _154.searchText])) {
|
|
1743
|
+
hasExecutedInitialSearch.current = false;
|
|
1744
|
+
return;
|
|
1745
|
+
}
|
|
1746
|
+
requestAnimationFrame(() => {
|
|
1747
|
+
requestAnimationFrame(() => {
|
|
1748
|
+
setIsSidebarOpen(true);
|
|
1749
|
+
handleSidebarSearch(initialSearchText, initialSearchPages);
|
|
1750
|
+
setAutoExecuteSearch(false);
|
|
1751
|
+
});
|
|
1752
|
+
});
|
|
1753
|
+
}, SEARCH_INITIALIZATION_DELAY);
|
|
1754
|
+
}, [
|
|
1755
|
+
state,
|
|
1756
|
+
totalPages,
|
|
1757
|
+
pdfViewerRef.current,
|
|
1758
|
+
initialSearchText,
|
|
1759
|
+
initialSearchPages
|
|
1760
|
+
]);
|
|
1761
|
+
_react.useEffect.call(void 0, () => {
|
|
1762
|
+
setSearchQuery("");
|
|
1763
|
+
setSearchResults([]);
|
|
1764
|
+
setCurrentSearchResultIndex(0);
|
|
1765
|
+
setTotalSearchResults(0);
|
|
1766
|
+
setIsSearching(false);
|
|
1767
|
+
setIsSidebarOpen(false);
|
|
1768
|
+
hasExecutedInitialSearch.current = false;
|
|
1769
|
+
setCurrentPage(1);
|
|
1770
|
+
setTotalPages(0);
|
|
1771
|
+
setZoom(122);
|
|
1772
|
+
setState("idle");
|
|
1773
|
+
setError(null);
|
|
1774
|
+
setPdfBuffer(null);
|
|
1775
|
+
}, [file]);
|
|
1776
|
+
_react.useEffect.call(void 0, () => {
|
|
1777
|
+
if (state !== "ready") return;
|
|
1778
|
+
const container = document.querySelector(
|
|
1779
|
+
'[data-pdf-viewer], .embedpdf-viewport, [role="document"]'
|
|
1780
|
+
);
|
|
1781
|
+
if (container) {
|
|
1782
|
+
setPdfContainer(container);
|
|
1783
|
+
return;
|
|
1784
|
+
}
|
|
1785
|
+
const observer = new MutationObserver(() => {
|
|
1786
|
+
const foundContainer = document.querySelector(
|
|
1787
|
+
'[data-pdf-viewer], .embedpdf-viewport, [role="document"]'
|
|
1788
|
+
);
|
|
1789
|
+
if (foundContainer) {
|
|
1790
|
+
setPdfContainer(foundContainer);
|
|
1791
|
+
observer.disconnect();
|
|
1792
|
+
}
|
|
1793
|
+
});
|
|
1794
|
+
observer.observe(document.body, { childList: true, subtree: true });
|
|
1795
|
+
return () => observer.disconnect();
|
|
1796
|
+
}, [state]);
|
|
1797
|
+
_react.useEffect.call(void 0, () => {
|
|
1798
|
+
if (state !== "ready") return;
|
|
1799
|
+
const checkInternalReadiness = async () => {
|
|
1800
|
+
if (!pdfViewerRef.current) return;
|
|
1801
|
+
try {
|
|
1802
|
+
const count = _optionalChain([pdfViewerRef, 'access', _155 => _155.current, 'access', _156 => _156.navigation, 'optionalAccess', _157 => _157.getTotalPages, 'optionalCall', _158 => _158()]);
|
|
1803
|
+
if (count && count > 0) {
|
|
1804
|
+
setTotalPages(count);
|
|
1805
|
+
setIsInternalReady(true);
|
|
1806
|
+
return;
|
|
1807
|
+
}
|
|
1808
|
+
const docInfo = _optionalChain([pdfViewerRef, 'access', _159 => _159.current, 'optionalAccess', _160 => _160.document, 'optionalAccess', _161 => _161.getDocumentInfo, 'optionalCall', _162 => _162()]);
|
|
1809
|
+
if (docInfo && docInfo.totalPages > 0) {
|
|
1810
|
+
setTotalPages(docInfo.totalPages);
|
|
1811
|
+
setIsInternalReady(true);
|
|
1812
|
+
return;
|
|
1813
|
+
}
|
|
1814
|
+
} catch (e) {
|
|
1815
|
+
}
|
|
1816
|
+
};
|
|
1817
|
+
const pollInterval = setInterval(checkInternalReadiness, 100);
|
|
1818
|
+
return () => clearInterval(pollInterval);
|
|
1819
|
+
}, [state]);
|
|
1820
|
+
_react.useEffect.call(void 0, () => {
|
|
1821
|
+
if (isInternalReady && pdfViewerRef.current) {
|
|
1822
|
+
try {
|
|
1823
|
+
pdfViewerRef.current.zoom.setZoom(1.22);
|
|
1824
|
+
setZoom(122);
|
|
1825
|
+
} catch (e) {
|
|
1826
|
+
}
|
|
1827
|
+
}
|
|
1828
|
+
}, [isInternalReady]);
|
|
1829
|
+
_react.useEffect.call(void 0, () => {
|
|
1830
|
+
if (state !== "ready" || totalPages > 0) return;
|
|
1831
|
+
const initializePageCount = async () => {
|
|
1832
|
+
const waitForViewer = async (maxAttempts = 10) => {
|
|
1833
|
+
for (let i = 0; i < maxAttempts; i++) {
|
|
1834
|
+
if (pdfViewerRef.current) return pdfViewerRef.current;
|
|
1835
|
+
await new Promise(
|
|
1836
|
+
(resolve) => requestAnimationFrame(
|
|
1837
|
+
() => setTimeout(resolve, Math.min(100 * Math.pow(2, i), 1e3))
|
|
1838
|
+
)
|
|
1839
|
+
);
|
|
1840
|
+
}
|
|
1841
|
+
return null;
|
|
1842
|
+
};
|
|
1843
|
+
const viewer = await waitForViewer();
|
|
1844
|
+
if (!viewer) return;
|
|
1845
|
+
await new Promise((resolve) => requestAnimationFrame(resolve));
|
|
1846
|
+
try {
|
|
1847
|
+
const count = _optionalChain([viewer, 'access', _163 => _163.navigation, 'optionalAccess', _164 => _164.getTotalPages, 'optionalCall', _165 => _165()]);
|
|
1848
|
+
if (count && count > 0) {
|
|
1849
|
+
setTotalPages(count);
|
|
1850
|
+
setIsInternalReady(true);
|
|
1851
|
+
return;
|
|
1852
|
+
}
|
|
1853
|
+
} catch (e) {
|
|
1854
|
+
}
|
|
1855
|
+
};
|
|
1856
|
+
initializePageCount();
|
|
1857
|
+
}, [state, totalPages]);
|
|
1858
|
+
_react.useEffect.call(void 0, () => {
|
|
1859
|
+
if (state === "ready") {
|
|
1860
|
+
const updateInfo = () => {
|
|
1861
|
+
if (!pdfViewerRef.current) return;
|
|
1862
|
+
const current = _optionalChain([pdfViewerRef, 'access', _166 => _166.current, 'optionalAccess', _167 => _167.navigation, 'access', _168 => _168.getCurrentPage, 'call', _169 => _169()]) || 1;
|
|
1863
|
+
const docInfo = _optionalChain([pdfViewerRef, 'access', _170 => _170.current, 'optionalAccess', _171 => _171.document, 'optionalAccess', _172 => _172.getDocumentInfo, 'optionalCall', _173 => _173()]);
|
|
1864
|
+
const navTotal = _optionalChain([pdfViewerRef, 'access', _174 => _174.current, 'optionalAccess', _175 => _175.navigation, 'optionalAccess', _176 => _176.getTotalPages, 'optionalCall', _177 => _177()]);
|
|
1865
|
+
let total = 0;
|
|
1866
|
+
if (docInfo && docInfo.totalPages > 0) {
|
|
1867
|
+
total = docInfo.totalPages;
|
|
1868
|
+
} else if (typeof navTotal === "number" && navTotal > 0) {
|
|
1869
|
+
total = navTotal;
|
|
1870
|
+
}
|
|
1871
|
+
const zoomValue = _optionalChain([pdfViewerRef, 'access', _178 => _178.current, 'optionalAccess', _179 => _179.zoom, 'access', _180 => _180.getZoom, 'call', _181 => _181()]);
|
|
1872
|
+
const currentSearchState = _optionalChain([pdfViewerRef, 'access', _182 => _182.current, 'optionalAccess', _183 => _183.search, 'access', _184 => _184.getSearchState, 'call', _185 => _185()]);
|
|
1873
|
+
setCurrentPage(current);
|
|
1874
|
+
if (total > 0 && total !== totalPages) {
|
|
1875
|
+
setTotalPages(total);
|
|
1876
|
+
}
|
|
1877
|
+
if (typeof zoomValue === "number") {
|
|
1878
|
+
setZoom(Math.round(zoomValue * 100));
|
|
1879
|
+
}
|
|
1880
|
+
};
|
|
1881
|
+
updateInfo();
|
|
1882
|
+
const pollInterval = totalPages === 0 ? 50 : 300;
|
|
1883
|
+
const interval = setInterval(updateInfo, pollInterval);
|
|
1884
|
+
return () => clearInterval(interval);
|
|
1885
|
+
}
|
|
1886
|
+
}, [state, totalPages]);
|
|
1887
|
+
_react.useImperativeHandle.call(void 0,
|
|
1888
|
+
ref,
|
|
1889
|
+
() => ({
|
|
1890
|
+
zoomIn: () => {
|
|
1891
|
+
_optionalChain([pdfViewerRef, 'access', _186 => _186.current, 'optionalAccess', _187 => _187.zoom, 'access', _188 => _188.zoomIn, 'call', _189 => _189()]);
|
|
1892
|
+
updateZoomDisplay();
|
|
1893
|
+
},
|
|
1894
|
+
zoomOut: () => {
|
|
1895
|
+
_optionalChain([pdfViewerRef, 'access', _190 => _190.current, 'optionalAccess', _191 => _191.zoom, 'access', _192 => _192.zoomOut, 'call', _193 => _193()]);
|
|
1896
|
+
updateZoomDisplay();
|
|
1897
|
+
},
|
|
1898
|
+
setZoom: (level) => {
|
|
1899
|
+
_optionalChain([pdfViewerRef, 'access', _194 => _194.current, 'optionalAccess', _195 => _195.zoom, 'access', _196 => _196.setZoom, 'call', _197 => _197(level)]);
|
|
1900
|
+
updateZoomDisplay();
|
|
1901
|
+
},
|
|
1902
|
+
resetZoom: () => {
|
|
1903
|
+
_optionalChain([pdfViewerRef, 'access', _198 => _198.current, 'optionalAccess', _199 => _199.zoom, 'access', _200 => _200.resetZoom, 'call', _201 => _201()]);
|
|
1904
|
+
updateZoomDisplay();
|
|
1905
|
+
},
|
|
1906
|
+
getZoom: () => {
|
|
1907
|
+
const zoom2 = _optionalChain([pdfViewerRef, 'access', _202 => _202.current, 'optionalAccess', _203 => _203.zoom, 'access', _204 => _204.getZoom, 'call', _205 => _205()]);
|
|
1908
|
+
return typeof zoom2 === "number" ? zoom2 : 1;
|
|
1909
|
+
},
|
|
1910
|
+
goToPage: (page) => {
|
|
1911
|
+
_optionalChain([pdfViewerRef, 'access', _206 => _206.current, 'optionalAccess', _207 => _207.navigation, 'access', _208 => _208.goToPage, 'call', _209 => _209(page)]);
|
|
1912
|
+
setCurrentPage(page);
|
|
1913
|
+
},
|
|
1914
|
+
getCurrentPage: () => _optionalChain([pdfViewerRef, 'access', _210 => _210.current, 'optionalAccess', _211 => _211.navigation, 'access', _212 => _212.getCurrentPage, 'call', _213 => _213()]) || 1,
|
|
1915
|
+
getTotalPages: () => _optionalChain([pdfViewerRef, 'access', _214 => _214.current, 'optionalAccess', _215 => _215.navigation, 'access', _216 => _216.getTotalPages, 'call', _217 => _217()]) || 0,
|
|
1916
|
+
nextPage: () => {
|
|
1917
|
+
_optionalChain([pdfViewerRef, 'access', _218 => _218.current, 'optionalAccess', _219 => _219.navigation, 'access', _220 => _220.nextPage, 'call', _221 => _221()]);
|
|
1918
|
+
updatePageDisplay();
|
|
1919
|
+
},
|
|
1920
|
+
previousPage: () => {
|
|
1921
|
+
_optionalChain([pdfViewerRef, 'access', _222 => _222.current, 'optionalAccess', _223 => _223.navigation, 'access', _224 => _224.previousPage, 'call', _225 => _225()]);
|
|
1922
|
+
updatePageDisplay();
|
|
1923
|
+
},
|
|
1924
|
+
goToFirstPage: () => {
|
|
1925
|
+
_optionalChain([pdfViewerRef, 'access', _226 => _226.current, 'optionalAccess', _227 => _227.navigation, 'access', _228 => _228.goToFirstPage, 'call', _229 => _229()]);
|
|
1926
|
+
updatePageDisplay();
|
|
1927
|
+
},
|
|
1928
|
+
goToLastPage: () => {
|
|
1929
|
+
_optionalChain([pdfViewerRef, 'access', _230 => _230.current, 'optionalAccess', _231 => _231.navigation, 'access', _232 => _232.goToLastPage, 'call', _233 => _233()]);
|
|
1930
|
+
updatePageDisplay();
|
|
1931
|
+
},
|
|
1932
|
+
searchText: async (keyword) => {
|
|
1933
|
+
setIsSearching(true);
|
|
1934
|
+
const results = await _optionalChain([pdfViewerRef, 'access', _234 => _234.current, 'optionalAccess', _235 => _235.search, 'access', _236 => _236.searchText, 'call', _237 => _237(
|
|
1935
|
+
keyword
|
|
1936
|
+
)]);
|
|
1937
|
+
setIsSearching(false);
|
|
1938
|
+
setSearchQuery(keyword);
|
|
1939
|
+
return results;
|
|
1940
|
+
},
|
|
1941
|
+
nextResult: () => {
|
|
1942
|
+
const index = _optionalChain([pdfViewerRef, 'access', _238 => _238.current, 'optionalAccess', _239 => _239.search, 'access', _240 => _240.nextResult, 'call', _241 => _241()]) || -1;
|
|
1943
|
+
return index;
|
|
1944
|
+
},
|
|
1945
|
+
previousResult: () => {
|
|
1946
|
+
const index = _optionalChain([pdfViewerRef, 'access', _242 => _242.current, 'optionalAccess', _243 => _243.search, 'access', _244 => _244.previousResult, 'call', _245 => _245()]) || -1;
|
|
1947
|
+
return index;
|
|
1948
|
+
},
|
|
1949
|
+
goToResult: (index) => _optionalChain([pdfViewerRef, 'access', _246 => _246.current, 'optionalAccess', _247 => _247.search, 'access', _248 => _248.goToResult, 'call', _249 => _249(index)]) || -1,
|
|
1950
|
+
stopSearch: () => {
|
|
1951
|
+
_optionalChain([pdfViewerRef, 'access', _250 => _250.current, 'optionalAccess', _251 => _251.search, 'access', _252 => _252.stopSearch, 'call', _253 => _253()]);
|
|
1952
|
+
setSearchQuery("");
|
|
1953
|
+
},
|
|
1954
|
+
getSearchState: () => _optionalChain([pdfViewerRef, 'access', _254 => _254.current, 'optionalAccess', _255 => _255.search, 'access', _256 => _256.getSearchState, 'call', _257 => _257()]) || null,
|
|
1955
|
+
getSelectedText: async () => {
|
|
1956
|
+
return await _optionalChain([pdfViewerRef, 'access', _258 => _258.current, 'optionalAccess', _259 => _259.selection, 'access', _260 => _260.getSelectedText, 'call', _261 => _261()]) || "";
|
|
1957
|
+
},
|
|
1958
|
+
clearSelection: () => _optionalChain([pdfViewerRef, 'access', _262 => _262.current, 'optionalAccess', _263 => _263.selection, 'access', _264 => _264.clearSelection, 'call', _265 => _265()]),
|
|
1959
|
+
copy: () => _optionalChain([pdfViewerRef, 'access', _266 => _266.current, 'optionalAccess', _267 => _267.selection, 'access', _268 => _268.copy, 'call', _269 => _269()]),
|
|
1960
|
+
rotateForward: () => _optionalChain([pdfViewerRef, 'access', _270 => _270.current, 'optionalAccess', _271 => _271.rotate, 'optionalAccess', _272 => _272.rotateForward, 'call', _273 => _273()]),
|
|
1961
|
+
rotateBackward: () => _optionalChain([pdfViewerRef, 'access', _274 => _274.current, 'optionalAccess', _275 => _275.rotate, 'optionalAccess', _276 => _276.rotateBackward, 'call', _277 => _277()]),
|
|
1962
|
+
getRotation: () => _optionalChain([pdfViewerRef, 'access', _278 => _278.current, 'optionalAccess', _279 => _279.rotate, 'optionalAccess', _280 => _280.getRotation, 'call', _281 => _281()]) || 0,
|
|
1963
|
+
print: () => _optionalChain([pdfViewerRef, 'access', _282 => _282.current, 'optionalAccess', _283 => _283.print, 'optionalAccess', _284 => _284.print, 'call', _285 => _285()]),
|
|
1964
|
+
printWithAnnotations: async () => {
|
|
1965
|
+
await _optionalChain([pdfViewerRef, 'access', _286 => _286.current, 'optionalAccess', _287 => _287.print, 'optionalAccess', _288 => _288.printWithAnnotations, 'optionalCall', _289 => _289()]);
|
|
1966
|
+
},
|
|
1967
|
+
printWithoutAnnotations: async () => {
|
|
1968
|
+
await _optionalChain([pdfViewerRef, 'access', _290 => _290.current, 'optionalAccess', _291 => _291.print, 'optionalAccess', _292 => _292.printWithoutAnnotations, 'optionalCall', _293 => _293()]);
|
|
1969
|
+
},
|
|
1970
|
+
downloadWithAnnotations: async (filename) => {
|
|
1971
|
+
await _optionalChain([pdfViewerRef, 'access', _294 => _294.current, 'optionalAccess', _295 => _295.download, 'optionalAccess', _296 => _296.downloadWithAnnotations, 'optionalCall', _297 => _297(filename)]);
|
|
1972
|
+
},
|
|
1973
|
+
downloadWithoutAnnotations: async (filename) => {
|
|
1974
|
+
await _optionalChain([pdfViewerRef, 'access', _298 => _298.current, 'optionalAccess', _299 => _299.download, 'optionalAccess', _300 => _300.downloadWithoutAnnotations, 'optionalCall', _301 => _301(filename)]);
|
|
1975
|
+
},
|
|
1976
|
+
get annotation() {
|
|
1977
|
+
return _optionalChain([pdfViewerRef, 'access', _302 => _302.current, 'optionalAccess', _303 => _303.annotation]);
|
|
1978
|
+
},
|
|
1979
|
+
get download() {
|
|
1980
|
+
return _optionalChain([pdfViewerRef, 'access', _304 => _304.current, 'optionalAccess', _305 => _305.download]);
|
|
1981
|
+
}
|
|
1982
|
+
}),
|
|
1983
|
+
[]
|
|
1984
|
+
);
|
|
1985
|
+
const updatePageDisplay = () => {
|
|
1986
|
+
requestAnimationFrame(() => {
|
|
1987
|
+
const current = _optionalChain([pdfViewerRef, 'access', _306 => _306.current, 'optionalAccess', _307 => _307.navigation, 'access', _308 => _308.getCurrentPage, 'call', _309 => _309()]) || 1;
|
|
1988
|
+
setCurrentPage(current);
|
|
1989
|
+
});
|
|
1990
|
+
};
|
|
1991
|
+
const updateZoomDisplay = () => {
|
|
1992
|
+
requestAnimationFrame(() => {
|
|
1993
|
+
const zoomValue = _optionalChain([pdfViewerRef, 'access', _310 => _310.current, 'optionalAccess', _311 => _311.zoom, 'access', _312 => _312.getZoom, 'call', _313 => _313()]);
|
|
1994
|
+
if (typeof zoomValue === "number") {
|
|
1995
|
+
setZoom(Math.round(zoomValue * 100));
|
|
1996
|
+
}
|
|
1997
|
+
});
|
|
1998
|
+
};
|
|
1999
|
+
const handleSearch = async () => {
|
|
2000
|
+
if (!searchQuery.trim()) return;
|
|
2001
|
+
setIsSearching(true);
|
|
2002
|
+
const results = await _optionalChain([pdfViewerRef, 'access', _314 => _314.current, 'optionalAccess', _315 => _315.search, 'access', _316 => _316.searchText, 'call', _317 => _317(
|
|
2003
|
+
searchQuery
|
|
2004
|
+
)]);
|
|
2005
|
+
setIsSearching(false);
|
|
2006
|
+
if (_optionalChain([results, 'optionalAccess', _318 => _318.results]) && Array.isArray(results.results) && results.results.length > 0) {
|
|
2007
|
+
const formattedResults = formatSearchResults(results.results);
|
|
2008
|
+
updateSearchState(formattedResults);
|
|
2009
|
+
} else {
|
|
2010
|
+
clearSearchResults();
|
|
2011
|
+
}
|
|
2012
|
+
};
|
|
2013
|
+
const handleSearchKeyPress = (e) => {
|
|
2014
|
+
if (e.key === "Enter") {
|
|
2015
|
+
handleSearch();
|
|
2016
|
+
}
|
|
2017
|
+
};
|
|
2018
|
+
const handleSidebarSearch = async (keyword, pageNumbers) => {
|
|
2019
|
+
setSearchQuery(keyword);
|
|
2020
|
+
if (!keyword.trim()) {
|
|
2021
|
+
setSearchResults([]);
|
|
2022
|
+
setTotalSearchResults(0);
|
|
2023
|
+
setCurrentSearchResultIndex(0);
|
|
2024
|
+
_optionalChain([pdfViewerRef, 'access', _319 => _319.current, 'optionalAccess', _320 => _320.search, 'access', _321 => _321.stopSearch, 'call', _322 => _322()]);
|
|
2025
|
+
return;
|
|
2026
|
+
}
|
|
2027
|
+
if (!_optionalChain([pdfViewerRef, 'access', _323 => _323.current, 'optionalAccess', _324 => _324.search, 'optionalAccess', _325 => _325.searchText])) {
|
|
2028
|
+
console.warn("Search functionality not yet available");
|
|
2029
|
+
return;
|
|
2030
|
+
}
|
|
2031
|
+
setIsSearching(true);
|
|
2032
|
+
try {
|
|
2033
|
+
const results = await pdfViewerRef.current.search.searchText(keyword);
|
|
2034
|
+
setIsSearching(false);
|
|
2035
|
+
const hasValidResults = _optionalChain([results, 'optionalAccess', _326 => _326.results]) && Array.isArray(results.results) && results.results.length > 0;
|
|
2036
|
+
if (hasValidResults) {
|
|
2037
|
+
const formattedResults = formatSearchResults(results.results);
|
|
2038
|
+
updateSearchState(formattedResults);
|
|
2039
|
+
navigateToFirstResult(formattedResults);
|
|
2040
|
+
} else if (pageNumbers && pageNumbers.length > 0) {
|
|
2041
|
+
const fallbackResults = createFallbackResults(pageNumbers, keyword);
|
|
2042
|
+
updateSearchState(fallbackResults);
|
|
2043
|
+
navigateToPage(pageNumbers[0]);
|
|
2044
|
+
} else {
|
|
2045
|
+
clearSearchResults();
|
|
2046
|
+
}
|
|
2047
|
+
} catch (error2) {
|
|
2048
|
+
console.error("Search failed:", error2);
|
|
2049
|
+
setIsSearching(false);
|
|
2050
|
+
clearSearchResults();
|
|
2051
|
+
}
|
|
2052
|
+
};
|
|
2053
|
+
const formatSearchResults = (results) => {
|
|
2054
|
+
return results.map((result, index) => {
|
|
2055
|
+
let textContent = "";
|
|
2056
|
+
let contextContent = "";
|
|
2057
|
+
if (result.context && typeof result.context === "object") {
|
|
2058
|
+
const { before = "", match = "", after = "" } = result.context;
|
|
2059
|
+
textContent = match;
|
|
2060
|
+
contextContent = `${before}${match}${after}`;
|
|
2061
|
+
} else if (typeof result === "string") {
|
|
2062
|
+
textContent = result;
|
|
2063
|
+
contextContent = result;
|
|
2064
|
+
} else {
|
|
2065
|
+
textContent = String(result.match || result.text || "");
|
|
2066
|
+
contextContent = textContent;
|
|
2067
|
+
}
|
|
2068
|
+
return {
|
|
2069
|
+
pageNumber: (_nullishCoalesce(_nullishCoalesce(result.pageIndex, () => ( result.pageNumber)), () => ( 0))) + 1,
|
|
2070
|
+
text: textContent,
|
|
2071
|
+
context: contextContent,
|
|
2072
|
+
index
|
|
2073
|
+
};
|
|
2074
|
+
});
|
|
2075
|
+
};
|
|
2076
|
+
const createFallbackResults = (pageNumbers, keyword) => {
|
|
2077
|
+
return pageNumbers.map((pageNum, index) => ({
|
|
2078
|
+
pageNumber: pageNum,
|
|
2079
|
+
text: keyword,
|
|
2080
|
+
context: `"${keyword}" found on this page ${pageNum}`,
|
|
2081
|
+
index
|
|
2082
|
+
}));
|
|
2083
|
+
};
|
|
2084
|
+
const updateSearchState = (results) => {
|
|
2085
|
+
setSearchResults(results);
|
|
2086
|
+
setTotalSearchResults(results.length);
|
|
2087
|
+
setCurrentSearchResultIndex(0);
|
|
2088
|
+
};
|
|
2089
|
+
const clearSearchResults = () => {
|
|
2090
|
+
setSearchResults([]);
|
|
2091
|
+
setTotalSearchResults(0);
|
|
2092
|
+
setCurrentSearchResultIndex(0);
|
|
2093
|
+
};
|
|
2094
|
+
const navigateToFirstResult = (results) => {
|
|
2095
|
+
if (results.length > 0) {
|
|
2096
|
+
navigateToPage(results[0].pageNumber);
|
|
2097
|
+
}
|
|
2098
|
+
};
|
|
2099
|
+
const navigateToPage = (pageNumber) => {
|
|
2100
|
+
requestAnimationFrame(() => {
|
|
2101
|
+
_optionalChain([pdfViewerRef, 'access', _327 => _327.current, 'optionalAccess', _328 => _328.navigation, 'access', _329 => _329.goToPage, 'call', _330 => _330(pageNumber)]);
|
|
2102
|
+
setCurrentPage(pageNumber);
|
|
2103
|
+
});
|
|
2104
|
+
};
|
|
2105
|
+
const handleSearchResultClick = (pageNumber, resultIndex) => {
|
|
2106
|
+
_optionalChain([pdfViewerRef, 'access', _331 => _331.current, 'optionalAccess', _332 => _332.navigation, 'access', _333 => _333.goToPage, 'call', _334 => _334(pageNumber)]);
|
|
2107
|
+
setCurrentSearchResultIndex(resultIndex);
|
|
2108
|
+
setCurrentPage(pageNumber);
|
|
2109
|
+
_optionalChain([pdfViewerRef, 'access', _335 => _335.current, 'optionalAccess', _336 => _336.search, 'access', _337 => _337.goToResult, 'call', _338 => _338(resultIndex)]);
|
|
2110
|
+
};
|
|
2111
|
+
const handleNextSearchResult = () => {
|
|
2112
|
+
if (currentSearchResultIndex < totalSearchResults - 1) {
|
|
2113
|
+
const nextIndex = currentSearchResultIndex + 1;
|
|
2114
|
+
setCurrentSearchResultIndex(nextIndex);
|
|
2115
|
+
_optionalChain([pdfViewerRef, 'access', _339 => _339.current, 'optionalAccess', _340 => _340.search, 'access', _341 => _341.nextResult, 'call', _342 => _342()]);
|
|
2116
|
+
if (searchResults[nextIndex]) {
|
|
2117
|
+
const pageNumber = searchResults[nextIndex].pageNumber;
|
|
2118
|
+
_optionalChain([pdfViewerRef, 'access', _343 => _343.current, 'optionalAccess', _344 => _344.navigation, 'access', _345 => _345.goToPage, 'call', _346 => _346(pageNumber)]);
|
|
2119
|
+
setCurrentPage(pageNumber);
|
|
2120
|
+
}
|
|
2121
|
+
}
|
|
2122
|
+
};
|
|
2123
|
+
const handlePreviousSearchResult = () => {
|
|
2124
|
+
if (currentSearchResultIndex > 0) {
|
|
2125
|
+
const prevIndex = currentSearchResultIndex - 1;
|
|
2126
|
+
setCurrentSearchResultIndex(prevIndex);
|
|
2127
|
+
_optionalChain([pdfViewerRef, 'access', _347 => _347.current, 'optionalAccess', _348 => _348.search, 'access', _349 => _349.previousResult, 'call', _350 => _350()]);
|
|
2128
|
+
if (searchResults[prevIndex]) {
|
|
2129
|
+
const pageNumber = searchResults[prevIndex].pageNumber;
|
|
2130
|
+
_optionalChain([pdfViewerRef, 'access', _351 => _351.current, 'optionalAccess', _352 => _352.navigation, 'access', _353 => _353.goToPage, 'call', _354 => _354(pageNumber)]);
|
|
2131
|
+
setCurrentPage(pageNumber);
|
|
2132
|
+
}
|
|
2133
|
+
}
|
|
2134
|
+
};
|
|
2135
|
+
_react.useEffect.call(void 0, () => {
|
|
2136
|
+
if (!file) {
|
|
2137
|
+
setState("error");
|
|
2138
|
+
setError("No file provided");
|
|
2139
|
+
return;
|
|
2140
|
+
}
|
|
2141
|
+
const loadPDF = async () => {
|
|
2142
|
+
try {
|
|
2143
|
+
setState("loading");
|
|
2144
|
+
setError(null);
|
|
2145
|
+
let arrayBuffer;
|
|
2146
|
+
if (file instanceof File) {
|
|
2147
|
+
arrayBuffer = await file.arrayBuffer();
|
|
2148
|
+
} else if (typeof file === "string") {
|
|
2149
|
+
const response = await fetch(file);
|
|
2150
|
+
if (!response.ok) {
|
|
2151
|
+
throw new Error(`Failed to load PDF: ${response.statusText}`);
|
|
2152
|
+
}
|
|
2153
|
+
arrayBuffer = await response.arrayBuffer();
|
|
2154
|
+
} else if (file instanceof ArrayBuffer) {
|
|
2155
|
+
arrayBuffer = file;
|
|
2156
|
+
} else {
|
|
2157
|
+
throw new Error("Unsupported file type");
|
|
2158
|
+
}
|
|
2159
|
+
setPdfBuffer(arrayBuffer);
|
|
2160
|
+
setState("ready");
|
|
2161
|
+
_optionalChain([onLoad, 'optionalCall', _355 => _355()]);
|
|
2162
|
+
} catch (err) {
|
|
2163
|
+
const errorMessage = err.message || "Failed to load PDF";
|
|
2164
|
+
setState("error");
|
|
2165
|
+
setError(errorMessage);
|
|
2166
|
+
_optionalChain([onError, 'optionalCall', _356 => _356(err)]);
|
|
2167
|
+
}
|
|
2168
|
+
};
|
|
2169
|
+
loadPDF();
|
|
2170
|
+
}, [file, onLoad, onError]);
|
|
2171
|
+
const handlePasswordRequest = _react.useCallback.call(void 0,
|
|
2172
|
+
async (fileName2, isRetry) => {
|
|
2173
|
+
return new Promise((resolve) => {
|
|
2174
|
+
setPasswordResolve(() => resolve);
|
|
2175
|
+
if (isRetry) {
|
|
2176
|
+
setPasswordError("Incorrect password. Please try again.");
|
|
2177
|
+
} else {
|
|
2178
|
+
setPasswordError("");
|
|
2179
|
+
}
|
|
2180
|
+
setIsPasswordDialogOpen(true);
|
|
2181
|
+
});
|
|
2182
|
+
},
|
|
2183
|
+
[]
|
|
2184
|
+
);
|
|
2185
|
+
const handlePasswordSubmit = _react.useCallback.call(void 0,
|
|
2186
|
+
(password) => {
|
|
2187
|
+
if (passwordResolve) {
|
|
2188
|
+
passwordResolve(password);
|
|
2189
|
+
}
|
|
2190
|
+
setIsPasswordDialogOpen(false);
|
|
2191
|
+
setPasswordResolve(null);
|
|
2192
|
+
setPasswordError("");
|
|
2193
|
+
},
|
|
2194
|
+
[passwordResolve]
|
|
2195
|
+
);
|
|
2196
|
+
const handlePasswordCancel = _react.useCallback.call(void 0, () => {
|
|
2197
|
+
if (passwordResolve) {
|
|
2198
|
+
passwordResolve(null);
|
|
2199
|
+
setPasswordResolve(null);
|
|
2200
|
+
setIsPasswordDialogOpen(false);
|
|
2201
|
+
setPasswordError("");
|
|
2202
|
+
}
|
|
2203
|
+
}, [passwordResolve]);
|
|
2204
|
+
const LoadingSpinner = ({ fileName: fileName2 }) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { style: {
|
|
2205
|
+
position: "absolute",
|
|
2206
|
+
inset: 0,
|
|
2207
|
+
zIndex: 50,
|
|
2208
|
+
backgroundColor: "#fff",
|
|
2209
|
+
display: "flex",
|
|
2210
|
+
flexDirection: "column",
|
|
2211
|
+
alignItems: "center",
|
|
2212
|
+
justifyContent: "center"
|
|
2213
|
+
}, children: [
|
|
2214
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "dms-loading-spinner", style: {
|
|
2215
|
+
width: "40px",
|
|
2216
|
+
height: "40px",
|
|
2217
|
+
border: "3px solid #f3f3f3",
|
|
2218
|
+
borderTop: "3px solid #3498db",
|
|
2219
|
+
borderRadius: "50%",
|
|
2220
|
+
animation: "spin 1s linear infinite"
|
|
2221
|
+
} }),
|
|
2222
|
+
fileName2 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { style: { marginTop: "16px", color: "#666", fontSize: "14px" }, children: [
|
|
2223
|
+
"Loading ",
|
|
2224
|
+
fileName2,
|
|
2225
|
+
"..."
|
|
2226
|
+
] }),
|
|
2227
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "style", { children: `@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }` })
|
|
2228
|
+
] });
|
|
2229
|
+
if (state === "error" || error) {
|
|
2230
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2231
|
+
"div",
|
|
2232
|
+
{
|
|
2233
|
+
style: {
|
|
2234
|
+
display: "flex",
|
|
2235
|
+
flexDirection: "column",
|
|
2236
|
+
alignItems: "center",
|
|
2237
|
+
justifyContent: "center",
|
|
2238
|
+
height: "100%",
|
|
2239
|
+
padding: "24px"
|
|
2240
|
+
},
|
|
2241
|
+
children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
|
|
2242
|
+
"div",
|
|
2243
|
+
{
|
|
2244
|
+
style: {
|
|
2245
|
+
maxWidth: "400px",
|
|
2246
|
+
padding: "16px",
|
|
2247
|
+
backgroundColor: "#fee",
|
|
2248
|
+
border: "1px solid #fcc",
|
|
2249
|
+
borderRadius: "4px"
|
|
2250
|
+
},
|
|
2251
|
+
children: [
|
|
2252
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "h3", { style: { marginTop: 0 }, children: "Failed to Load PDF" }),
|
|
2253
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { children: error || "Unknown error occurred" })
|
|
2254
|
+
]
|
|
2255
|
+
}
|
|
2256
|
+
)
|
|
2257
|
+
}
|
|
2258
|
+
);
|
|
2259
|
+
}
|
|
2260
|
+
const isReady = pdfBuffer && state === "ready";
|
|
2261
|
+
const showOverlay = loading || !isReady || !isInternalReady;
|
|
2262
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { ref: containerRef, className: `pdf-viewer-container ${themeMode === "dark" ? "dark-theme" : ""}`, style: { position: "relative", height: "100%", width: "100%" }, children: [
|
|
2263
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, "style", { children: _chunkS5KXYKBXjs.toolbarStyles }),
|
|
2264
|
+
showOverlay && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, LoadingSpinner, { fileName: resolvedFileName }),
|
|
2265
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { style: { opacity: !showOverlay ? 1 : 0, height: "100%", display: "flex", flexDirection: "column" }, children: [
|
|
2266
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, PDFHeader, { fileName: resolvedFileName, fileExtension }),
|
|
2267
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2268
|
+
PDFToolbar,
|
|
2269
|
+
{
|
|
2270
|
+
currentPage,
|
|
2271
|
+
totalPages,
|
|
2272
|
+
zoom,
|
|
2273
|
+
isSidebarOpen,
|
|
2274
|
+
showPageNavigation,
|
|
2275
|
+
showPageCount,
|
|
2276
|
+
showZoomControls,
|
|
2277
|
+
showSearch,
|
|
2278
|
+
showRotation: !toolbar.isHidden("rotation"),
|
|
2279
|
+
showMetadata: !toolbar.isHidden("metadata"),
|
|
2280
|
+
showProperties: !toolbar.isHidden("properties"),
|
|
2281
|
+
showDownload: !toolbar.isHidden("download"),
|
|
2282
|
+
showPrint: !toolbar.isHidden("print"),
|
|
2283
|
+
showTags: !toolbar.isHidden("tags"),
|
|
2284
|
+
showHistory: !toolbar.isHidden("history"),
|
|
2285
|
+
disabledRotateLeft: toolbar.isDisabled("rotateLeft"),
|
|
2286
|
+
disabledRotateRight: false,
|
|
2287
|
+
disabledMetadata: toolbar.isDisabled("metadata"),
|
|
2288
|
+
disabledTags: toolbar.isDisabled("tags"),
|
|
2289
|
+
disabledProperties: toolbar.isDisabled("properties"),
|
|
2290
|
+
disabledHistory: toolbar.isDisabled("history"),
|
|
2291
|
+
disabledDownload: toolbar.isDisabled("download"),
|
|
2292
|
+
disabledPrint: toolbar.isDisabled("print"),
|
|
2293
|
+
onFirstPage: toolbarHandlers.handleFirstPage,
|
|
2294
|
+
onPreviousPage: toolbarHandlers.handlePreviousPage,
|
|
2295
|
+
onNextPage: toolbarHandlers.handleNextPage,
|
|
2296
|
+
onLastPage: toolbarHandlers.handleLastPage,
|
|
2297
|
+
onPageInput: toolbarHandlers.handlePageInput,
|
|
2298
|
+
onPageInputKeyPress: toolbarHandlers.handlePageInputKeyPress,
|
|
2299
|
+
onZoomIn: toolbarHandlers.handleZoomIn,
|
|
2300
|
+
onZoomOut: toolbarHandlers.handleZoomOut,
|
|
2301
|
+
onFitToWidth: toolbarHandlers.handleFitToWidth,
|
|
2302
|
+
onFitToPage: toolbarHandlers.handleFitToPage,
|
|
2303
|
+
onToggleSidebar: toolbarHandlers.toggleSidebar,
|
|
2304
|
+
onToggleFullScreen: toolbarHandlers.handleToggleFullScreen,
|
|
2305
|
+
onRotateLeft: toolbarHandlers.handleRotateLeft,
|
|
2306
|
+
onRotateRight: toolbarHandlers.handleRotateRight,
|
|
2307
|
+
onDownloadClick: toolbar.getHandler("download", onDownloadClick),
|
|
2308
|
+
onDownloadWithAnnotations: toolbarHandlers.handleDownloadWithAnnotations,
|
|
2309
|
+
onDownloadWithoutAnnotations: toolbarHandlers.handleDownloadWithoutAnnotations,
|
|
2310
|
+
onPrintClick: toolbar.getHandler("print", onPrintClick || toolbarHandlers.handlePrint),
|
|
2311
|
+
onPrintWithAnnotations: toolbarHandlers.handlePrintWithAnnotations,
|
|
2312
|
+
onPrintWithoutAnnotations: toolbarHandlers.handlePrintWithoutAnnotations,
|
|
2313
|
+
onCopyClick: toolbarHandlers.handleCopy,
|
|
2314
|
+
onMetadataClick: toolbar.getHandler("metadata", onMetadataClick),
|
|
2315
|
+
onPropertiesClick: toolbar.getHandler(
|
|
2316
|
+
"properties",
|
|
2317
|
+
onPropertiesClick
|
|
2318
|
+
),
|
|
2319
|
+
onTagsClick: toolbar.getHandler("tags", onTagsClick),
|
|
2320
|
+
onHistoryClick: toolbar.getHandler("history", onHistoryClick),
|
|
2321
|
+
showAnnotations,
|
|
2322
|
+
isHighlighterActive: highlighterActive,
|
|
2323
|
+
isStampActive: stampActive,
|
|
2324
|
+
disabledHighlighter: toolbar.isDisabled("highlighter"),
|
|
2325
|
+
disabledStamp: toolbar.isDisabled("stamp"),
|
|
2326
|
+
disabledSignature: toolbar.isDisabled("signature"),
|
|
2327
|
+
disabledNote: toolbar.isDisabled("note"),
|
|
2328
|
+
onHighlighterClick: toolbar.getHandler("highlighter", onHighlighterClick || toolbarHandlers.handleHighlighterClick),
|
|
2329
|
+
onStampClick: toolbar.getHandler("stamp", onStampClick || toolbarHandlers.handleStampClick),
|
|
2330
|
+
onSignatureClick: toolbar.getHandler("signature", onSignatureClick || toolbarHandlers.handleSignatureClick),
|
|
2331
|
+
onNoteClick: toolbar.getHandler("note", onNoteClick),
|
|
2332
|
+
showAnnotate,
|
|
2333
|
+
disabledAnnotate,
|
|
2334
|
+
showPrintOriginal,
|
|
2335
|
+
showPrintWithAnnotations,
|
|
2336
|
+
showDownloadOriginal,
|
|
2337
|
+
showDownloadWithAnnotations,
|
|
2338
|
+
twoPageMode,
|
|
2339
|
+
onTwoPageModeChange: setTwoPageMode,
|
|
2340
|
+
scrollStrategy,
|
|
2341
|
+
onScrollStrategyChange: setScrollStrategy,
|
|
2342
|
+
showThumbnails,
|
|
2343
|
+
onToggleThumbnails: () => setShowThumbnails(!showThumbnails),
|
|
2344
|
+
hasUnsavedAnnotations,
|
|
2345
|
+
isSavingAnnotations,
|
|
2346
|
+
canSaveAnnotations,
|
|
2347
|
+
onSaveAnnotations,
|
|
2348
|
+
activeMode,
|
|
2349
|
+
onActiveModeChange: setActiveMode
|
|
2350
|
+
}
|
|
2351
|
+
),
|
|
2352
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "pdf-viewer-main", children: [
|
|
2353
|
+
showThumbnails && pdfBuffer && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2354
|
+
_pdfviewer.PdfThumbnailSidebar,
|
|
2355
|
+
{
|
|
2356
|
+
pdfBuffer,
|
|
2357
|
+
totalPages,
|
|
2358
|
+
currentPage,
|
|
2359
|
+
onPageClick: (pageNum) => _optionalChain([pdfViewerRef, 'access', _357 => _357.current, 'optionalAccess', _358 => _358.navigation, 'access', _359 => _359.goToPage, 'call', _360 => _360(pageNum)]),
|
|
2360
|
+
onClose: () => setShowThumbnails(false),
|
|
2361
|
+
twoPageMode: false
|
|
2362
|
+
}
|
|
2363
|
+
),
|
|
2364
|
+
/* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "pdf-viewer-viewer-area", children: [
|
|
2365
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2366
|
+
PDFSecondaryToolbar,
|
|
2367
|
+
{
|
|
2368
|
+
activeMode,
|
|
2369
|
+
showAnnotations,
|
|
2370
|
+
isHighlighterActive: highlighterActive,
|
|
2371
|
+
isStampActive: stampActive,
|
|
2372
|
+
disabledHighlighter: toolbar.isDisabled("highlighter"),
|
|
2373
|
+
disabledStamp: toolbar.isDisabled("stamp"),
|
|
2374
|
+
disabledSignature: toolbar.isDisabled("signature"),
|
|
2375
|
+
disabledNote: toolbar.isDisabled("note"),
|
|
2376
|
+
onHighlighterClick: onHighlighterClick || toolbarHandlers.handleHighlighterClick,
|
|
2377
|
+
onStampClick: onStampClick || toolbarHandlers.handleStampClick,
|
|
2378
|
+
onSignatureClick: onSignatureClick || toolbarHandlers.handleSignatureClick,
|
|
2379
|
+
onNoteClick,
|
|
2380
|
+
hasUnsavedAnnotations,
|
|
2381
|
+
isSavingAnnotations,
|
|
2382
|
+
canSaveAnnotations,
|
|
2383
|
+
onSaveAnnotations
|
|
2384
|
+
}
|
|
2385
|
+
),
|
|
2386
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2387
|
+
StablePDFViewer,
|
|
2388
|
+
{
|
|
2389
|
+
pdfBuffer: pdfBuffer || new ArrayBuffer(0),
|
|
2390
|
+
onPasswordRequest: handlePasswordRequest,
|
|
2391
|
+
pdfViewerRef,
|
|
2392
|
+
hideInternalLoading: true,
|
|
2393
|
+
showAnnotations,
|
|
2394
|
+
userDetails,
|
|
2395
|
+
annotationSelectionMenu,
|
|
2396
|
+
isHighlighterActive: highlighterActive,
|
|
2397
|
+
isStampActive: stampActive,
|
|
2398
|
+
onHighlighterClick: onHighlighterClick || toolbarHandlers.handleHighlighterClick,
|
|
2399
|
+
onStampClick: onStampClick || toolbarHandlers.handleStampClick,
|
|
2400
|
+
onSignatureClick: onSignatureClick || toolbarHandlers.handleSignatureClick,
|
|
2401
|
+
onNoteClick,
|
|
2402
|
+
permissions: props.permissions,
|
|
2403
|
+
isAnnotationForeign,
|
|
2404
|
+
onAnnotationNoteClick,
|
|
2405
|
+
isAnnotationInteractive,
|
|
2406
|
+
twoPageMode,
|
|
2407
|
+
scrollStrategy
|
|
2408
|
+
}
|
|
2409
|
+
)
|
|
2410
|
+
] }),
|
|
2411
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2412
|
+
SearchSidebar,
|
|
2413
|
+
{
|
|
2414
|
+
isOpen: isSidebarOpen,
|
|
2415
|
+
onClose: handleSidebarClose,
|
|
2416
|
+
onSearch: handleSidebarSearch,
|
|
2417
|
+
onSearchResultClick: handleSearchResultClick,
|
|
2418
|
+
onNextResult: handleNextSearchResult,
|
|
2419
|
+
onPreviousResult: handlePreviousSearchResult,
|
|
2420
|
+
currentResultIndex: currentSearchResultIndex,
|
|
2421
|
+
totalResults: totalSearchResults,
|
|
2422
|
+
searchKeyword: searchQuery,
|
|
2423
|
+
searchResults,
|
|
2424
|
+
isSearching
|
|
2425
|
+
}
|
|
2426
|
+
)
|
|
2427
|
+
] }),
|
|
2428
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
2429
|
+
PasswordDialog,
|
|
2430
|
+
{
|
|
2431
|
+
open: isPasswordDialogOpen,
|
|
2432
|
+
fileName: resolvedFileName,
|
|
2433
|
+
onSubmit: handlePasswordSubmit,
|
|
2434
|
+
onCancel: handlePasswordCancel,
|
|
2435
|
+
error: passwordError,
|
|
2436
|
+
isLoading: isVerifyingPassword
|
|
2437
|
+
}
|
|
2438
|
+
)
|
|
2439
|
+
] })
|
|
2440
|
+
] });
|
|
2441
|
+
}
|
|
2442
|
+
);
|
|
2443
|
+
PDFViewerContent.displayName = "PDFViewerContent";
|
|
2444
|
+
var PDFViewer = _react.forwardRef.call(void 0,
|
|
2445
|
+
(props, ref) => {
|
|
2446
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PDFViewerContent, { ...props, sourceDescription: "doc.pdf", ref });
|
|
2447
|
+
}
|
|
2448
|
+
);
|
|
2449
|
+
PDFViewer.displayName = "PDFViewer";
|
|
2450
|
+
|
|
2451
|
+
|
|
2452
|
+
|
|
2453
|
+
exports.PDFViewer = PDFViewer;
|
|
2454
|
+
//# sourceMappingURL=chunk-4HVU224A.js.map
|