@cannymindstech/file-viewers 0.27.11 → 0.28.0

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