@cannyminds/dms-file-viewers 0.18.0 → 0.20.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 (43) hide show
  1. package/dist/{chunk-RTQRDZSN.js → chunk-26SS5FLZ.js} +683 -358
  2. package/dist/chunk-26SS5FLZ.js.map +1 -0
  3. package/dist/{chunk-ZTKUXLTZ.mjs → chunk-4XX5VZA2.mjs} +2 -2
  4. package/dist/chunk-5ECHDPQZ.js +425 -0
  5. package/dist/chunk-5ECHDPQZ.js.map +1 -0
  6. package/dist/{chunk-TOGDBQAN.js → chunk-AVQCUOWM.js} +4 -4
  7. package/dist/{chunk-TOGDBQAN.js.map → chunk-AVQCUOWM.js.map} +1 -1
  8. package/dist/{chunk-TQXRQCS4.mjs → chunk-IY5EEUCU.mjs} +655 -330
  9. package/dist/chunk-IY5EEUCU.mjs.map +1 -0
  10. package/dist/chunk-UVF6YOXY.mjs +425 -0
  11. package/dist/chunk-UVF6YOXY.mjs.map +1 -0
  12. package/dist/components/viewers/AudioViewer.d.mts +1 -1
  13. package/dist/components/viewers/AudioViewer.d.ts +1 -1
  14. package/dist/components/viewers/DefaultViewer.d.mts +1 -1
  15. package/dist/components/viewers/DefaultViewer.d.ts +1 -1
  16. package/dist/components/viewers/ImageViewer.d.mts +1 -1
  17. package/dist/components/viewers/ImageViewer.d.ts +1 -1
  18. package/dist/components/viewers/ImageViewer.js +3 -3
  19. package/dist/components/viewers/ImageViewer.mjs +2 -2
  20. package/dist/components/viewers/PDFViewer.d.mts +18 -1
  21. package/dist/components/viewers/PDFViewer.d.ts +18 -1
  22. package/dist/components/viewers/PDFViewer.js +3 -3
  23. package/dist/components/viewers/PDFViewer.mjs +2 -2
  24. package/dist/components/viewers/TIFFViewer.d.mts +1 -1
  25. package/dist/components/viewers/TIFFViewer.d.ts +1 -1
  26. package/dist/components/viewers/TextViewer.d.mts +1 -1
  27. package/dist/components/viewers/TextViewer.d.ts +1 -1
  28. package/dist/components/viewers/VideoViewer.d.mts +1 -1
  29. package/dist/components/viewers/VideoViewer.d.ts +1 -1
  30. package/dist/index.d.mts +3 -3
  31. package/dist/index.d.ts +3 -3
  32. package/dist/index.js +4 -4
  33. package/dist/index.mjs +3 -3
  34. package/dist/{types-DM0RG-Yu.d.mts → types-DFkMK86Q.d.mts} +18 -1
  35. package/dist/{types-DM0RG-Yu.d.ts → types-DFkMK86Q.d.ts} +18 -1
  36. package/package.json +6 -6
  37. package/dist/chunk-GMD6QQLG.js +0 -154
  38. package/dist/chunk-GMD6QQLG.js.map +0 -1
  39. package/dist/chunk-PPELANB4.mjs +0 -154
  40. package/dist/chunk-PPELANB4.mjs.map +0 -1
  41. package/dist/chunk-RTQRDZSN.js.map +0 -1
  42. package/dist/chunk-TQXRQCS4.mjs.map +0 -1
  43. /package/dist/{chunk-ZTKUXLTZ.mjs.map → chunk-4XX5VZA2.mjs.map} +0 -0
@@ -1,7 +1,7 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }"use client";
2
2
 
3
3
 
4
- var _chunkGMD6QQLGjs = require('./chunk-GMD6QQLG.js');
4
+ var _chunk5ECHDPQZjs = require('./chunk-5ECHDPQZ.js');
5
5
 
6
6
 
7
7
  var _chunkYEPEMLM3js = require('./chunk-YEPEMLM3.js');
@@ -29,14 +29,32 @@ var HeadlessPDFViewer = _pdfviewer.PDFViewer;
29
29
  var StablePDFViewer = _react2.default.memo(({
30
30
  pdfBuffer,
31
31
  onPasswordRequest,
32
- pdfViewerRef
32
+ pdfViewerRef,
33
+ showAnnotations,
34
+ userDetails,
35
+ annotationSelectionMenu,
36
+ isHighlighterActive,
37
+ isStampActive,
38
+ onHighlighterClick,
39
+ onStampClick,
40
+ onSignatureClick,
41
+ permissions
33
42
  }) => {
34
43
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
35
44
  HeadlessPDFViewer,
36
45
  {
37
46
  ref: pdfViewerRef,
38
47
  pdfBuffer,
39
- onPasswordRequest
48
+ onPasswordRequest,
49
+ showAnnotations,
50
+ userDetails,
51
+ annotationSelectionMenu: annotationSelectionMenu || [],
52
+ isHighlighterActive,
53
+ isStampActive,
54
+ onHighlighterClick,
55
+ onStampClick,
56
+ onSignatureClick,
57
+ permissions
40
58
  }
41
59
  );
42
60
  });
@@ -44,14 +62,16 @@ StablePDFViewer.displayName = "StablePDFViewer";
44
62
 
45
63
  // src/components/viewers/pdf/PDFToolbar.tsx
46
64
 
65
+ var _material = require('@mui/material');
47
66
  var _FirstPage = require('@mui/icons-material/FirstPage'); var _FirstPage2 = _interopRequireDefault(_FirstPage);
48
67
  var _LastPage = require('@mui/icons-material/LastPage'); var _LastPage2 = _interopRequireDefault(_LastPage);
49
68
  var _ChevronLeft = require('@mui/icons-material/ChevronLeft'); var _ChevronLeft2 = _interopRequireDefault(_ChevronLeft);
50
69
  var _ChevronRight = require('@mui/icons-material/ChevronRight'); var _ChevronRight2 = _interopRequireDefault(_ChevronRight);
51
- var _ZoomIn = require('@mui/icons-material/ZoomIn'); var _ZoomIn2 = _interopRequireDefault(_ZoomIn);
52
- var _ZoomOut = require('@mui/icons-material/ZoomOut'); var _ZoomOut2 = _interopRequireDefault(_ZoomOut);
70
+ var _Remove = require('@mui/icons-material/Remove'); var _Remove2 = _interopRequireDefault(_Remove);
71
+ var _Add = require('@mui/icons-material/Add'); var _Add2 = _interopRequireDefault(_Add);
53
72
  var _FitScreen = require('@mui/icons-material/FitScreen'); var _FitScreen2 = _interopRequireDefault(_FitScreen);
54
73
  var _AspectRatio = require('@mui/icons-material/AspectRatio'); var _AspectRatio2 = _interopRequireDefault(_AspectRatio);
74
+ var _Tune = require('@mui/icons-material/Tune'); var _Tune2 = _interopRequireDefault(_Tune);
55
75
  var _Search = require('@mui/icons-material/Search'); var _Search2 = _interopRequireDefault(_Search);
56
76
  var _Fullscreen = require('@mui/icons-material/Fullscreen'); var _Fullscreen2 = _interopRequireDefault(_Fullscreen);
57
77
  var _Download = require('@mui/icons-material/Download'); var _Download2 = _interopRequireDefault(_Download);
@@ -62,6 +82,13 @@ var _RotateLeft = require('@mui/icons-material/RotateLeft'); var _RotateLeft2 =
62
82
  var _RotateRight = require('@mui/icons-material/RotateRight'); var _RotateRight2 = _interopRequireDefault(_RotateRight);
63
83
  var _History = require('@mui/icons-material/History'); var _History2 = _interopRequireDefault(_History);
64
84
  var _iconsmaterial = require('@mui/icons-material');
85
+ var _Highlight = require('@mui/icons-material/Highlight'); var _Highlight2 = _interopRequireDefault(_Highlight);
86
+ var _Draw = require('@mui/icons-material/Draw'); var _Draw2 = _interopRequireDefault(_Draw);
87
+ var _Approval = require('@mui/icons-material/Approval'); var _Approval2 = _interopRequireDefault(_Approval);
88
+ var _KeyboardArrowDown = require('@mui/icons-material/KeyboardArrowDown'); var _KeyboardArrowDown2 = _interopRequireDefault(_KeyboardArrowDown);
89
+ var _Portrait = require('@mui/icons-material/Portrait'); var _Portrait2 = _interopRequireDefault(_Portrait);
90
+ var _SwapVert = require('@mui/icons-material/SwapVert'); var _SwapVert2 = _interopRequireDefault(_SwapVert);
91
+ var _AutoFixHigh = require('@mui/icons-material/AutoFixHigh'); var _AutoFixHigh2 = _interopRequireDefault(_AutoFixHigh);
65
92
 
66
93
  var PDFToolbar = _react2.default.memo(
67
94
  ({
@@ -80,6 +107,9 @@ var PDFToolbar = _react2.default.memo(
80
107
  showDownload,
81
108
  showPrint,
82
109
  showRotation,
110
+ showAnnotations,
111
+ isHighlighterActive,
112
+ isStampActive,
83
113
  disabledRotateLeft,
84
114
  disabledRotateRight,
85
115
  disabledMetadata,
@@ -88,6 +118,9 @@ var PDFToolbar = _react2.default.memo(
88
118
  disabledHistory,
89
119
  disabledDownload,
90
120
  disabledPrint,
121
+ disabledHighlighter,
122
+ disabledStamp,
123
+ disabledSignature,
91
124
  onFirstPage,
92
125
  onPreviousPage,
93
126
  onNextPage,
@@ -104,234 +137,412 @@ var PDFToolbar = _react2.default.memo(
104
137
  onRotateRight,
105
138
  onDownloadClick,
106
139
  onPrintClick,
140
+ onPrintWithAnnotations,
141
+ onPrintWithoutAnnotations,
107
142
  onMetadataClick,
108
143
  onPropertiesClick,
109
144
  onTagsClick,
110
- onHistoryClick
145
+ onHistoryClick,
146
+ onHighlighterClick,
147
+ onStampClick,
148
+ onSignatureClick,
149
+ // Save functionality
150
+ hasUnsavedAnnotations,
151
+ isSavingAnnotations,
152
+ canSaveAnnotations,
153
+ onSaveAnnotations
111
154
  }) => {
112
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "pdf-viewer-toolbar", children: [
113
- showPageNavigation && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
114
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "toolbar-separator" }),
115
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "toolbar-section", children: [
116
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
117
- "button",
118
- {
119
- className: "toolbar-button",
120
- onClick: onFirstPage,
121
- disabled: currentPage <= 1,
122
- title: "First Page",
123
- children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _FirstPage2.default, { fontSize: "small" })
124
- }
125
- ),
126
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
127
- "button",
128
- {
129
- className: "toolbar-button",
130
- onClick: onPreviousPage,
131
- disabled: currentPage <= 1,
132
- title: "Previous Page",
133
- children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _ChevronLeft2.default, { fontSize: "small" })
134
- }
135
- ),
136
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
137
- "input",
138
- {
139
- type: "number",
140
- className: "page-input",
141
- value: currentPage,
142
- onChange: onPageInput,
143
- onKeyPress: onPageInputKeyPress,
144
- min: 1,
145
- max: totalPages || void 0
146
- }
147
- ),
148
- showPageCount && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "page-info", children: [
149
- "of ",
150
- totalPages || "..."
155
+ const [isPrintMenuOpen, setIsPrintMenuOpen] = _react.useState.call(void 0, false);
156
+ const [isAnnotationMenuOpen, setIsAnnotationMenuOpen] = _react.useState.call(void 0, false);
157
+ const [isViewMenuOpen, setIsViewMenuOpen] = _react.useState.call(void 0, false);
158
+ const printMenuRef = _react.useRef.call(void 0, null);
159
+ const annotationMenuRef = _react.useRef.call(void 0, null);
160
+ const viewMenuRef = _react.useRef.call(void 0, null);
161
+ _react.useEffect.call(void 0, () => {
162
+ const handleClickOutside = (event) => {
163
+ if (printMenuRef.current && !printMenuRef.current.contains(event.target)) {
164
+ setIsPrintMenuOpen(false);
165
+ }
166
+ if (annotationMenuRef.current && !annotationMenuRef.current.contains(event.target)) {
167
+ setIsAnnotationMenuOpen(false);
168
+ }
169
+ if (viewMenuRef.current && !viewMenuRef.current.contains(event.target)) {
170
+ setIsViewMenuOpen(false);
171
+ }
172
+ };
173
+ document.addEventListener("mousedown", handleClickOutside);
174
+ return () => document.removeEventListener("mousedown", handleClickOutside);
175
+ }, []);
176
+ const handlePrintWithAnnotations = () => {
177
+ setIsPrintMenuOpen(false);
178
+ _optionalChain([onPrintWithAnnotations, 'optionalCall', _ => _()]);
179
+ };
180
+ const handlePrintWithoutAnnotations = () => {
181
+ setIsPrintMenuOpen(false);
182
+ _optionalChain([onPrintWithoutAnnotations, 'optionalCall', _2 => _2()]);
183
+ };
184
+ const [activeMode, setActiveMode] = _react.useState.call(void 0, "view");
185
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "pdf-viewer-toolbar-container", children: [
186
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "pdf-viewer-toolbar", children: [
187
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "toolbar-left", children: [
188
+ showPageNavigation && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "toolbar-section", children: [
189
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Tooltip, { title: "First Page", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
190
+ "button",
191
+ {
192
+ className: "toolbar-button",
193
+ onClick: onFirstPage,
194
+ disabled: currentPage <= 1,
195
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _FirstPage2.default, { fontSize: "small" })
196
+ }
197
+ ) }),
198
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Tooltip, { title: "Previous Page", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
199
+ "button",
200
+ {
201
+ className: "toolbar-button",
202
+ onClick: onPreviousPage,
203
+ disabled: currentPage <= 1,
204
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _ChevronLeft2.default, { fontSize: "small" })
205
+ }
206
+ ) }),
207
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
208
+ "input",
209
+ {
210
+ type: "number",
211
+ className: "page-input",
212
+ value: currentPage,
213
+ onChange: onPageInput,
214
+ onKeyPress: onPageInputKeyPress,
215
+ min: 1,
216
+ max: totalPages || void 0
217
+ }
218
+ ),
219
+ showPageCount && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "page-info", children: [
220
+ "/ ",
221
+ totalPages || "..."
222
+ ] }),
223
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Tooltip, { title: "Next Page", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
224
+ "button",
225
+ {
226
+ className: "toolbar-button",
227
+ onClick: onNextPage,
228
+ disabled: currentPage >= totalPages,
229
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _ChevronRight2.default, { fontSize: "small" })
230
+ }
231
+ ) }),
232
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Tooltip, { title: "Last Page", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
233
+ "button",
234
+ {
235
+ className: "toolbar-button",
236
+ onClick: onLastPage,
237
+ disabled: currentPage >= totalPages,
238
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _LastPage2.default, { fontSize: "small" })
239
+ }
240
+ ) })
151
241
  ] }),
152
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
153
- "button",
154
- {
155
- className: "toolbar-button",
156
- onClick: onNextPage,
157
- disabled: currentPage >= totalPages,
158
- title: "Next Page",
159
- children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _ChevronRight2.default, { fontSize: "small" })
160
- }
161
- ),
162
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
163
- "button",
164
- {
165
- className: "toolbar-button",
166
- onClick: onLastPage,
167
- disabled: currentPage >= totalPages,
168
- title: "Last Page",
169
- children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _LastPage2.default, { fontSize: "small" })
170
- }
171
- )
172
- ] })
173
- ] }),
174
- showZoomControls && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
175
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "toolbar-separator" }),
176
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "toolbar-section", children: [
177
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
178
- "button",
179
- {
180
- className: "toolbar-button",
181
- onClick: onZoomOut,
182
- title: "Zoom Out",
183
- children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _ZoomOut2.default, { fontSize: "small" })
184
- }
185
- ),
186
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "zoom-display", children: [
187
- zoom,
188
- "%"
242
+ showZoomControls && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
243
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "toolbar-separator" }),
244
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "toolbar-section", children: [
245
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Tooltip, { title: "Zoom Out", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
246
+ "button",
247
+ {
248
+ className: "toolbar-button",
249
+ onClick: onZoomOut,
250
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _Remove2.default, { fontSize: "small" })
251
+ }
252
+ ) }),
253
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "zoom-display", children: [
254
+ zoom,
255
+ "%"
256
+ ] }),
257
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Tooltip, { title: "Zoom In", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
258
+ "button",
259
+ {
260
+ className: "toolbar-button",
261
+ onClick: onZoomIn,
262
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _Add2.default, { fontSize: "small" })
263
+ }
264
+ ) })
265
+ ] })
189
266
  ] }),
267
+ (showZoomControls || showRotation) && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
268
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "toolbar-separator" }),
269
+ /* @__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: [
270
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Tooltip, { title: "View Options", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
271
+ "button",
272
+ {
273
+ className: `toolbar-button toolbar-dropdown-button ${isViewMenuOpen ? "toolbar-button-active" : ""}`,
274
+ onClick: () => setIsViewMenuOpen(!isViewMenuOpen),
275
+ children: [
276
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _Tune2.default, { fontSize: "small" }),
277
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _KeyboardArrowDown2.default, { fontSize: "small", style: { marginLeft: -4 } })
278
+ ]
279
+ }
280
+ ) }),
281
+ isViewMenuOpen && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "toolbar-dropdown-menu", style: { width: "240px" }, children: [
282
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "toolbar-dropdown-header", children: "SPREAD MODE" }),
283
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "button", { className: "toolbar-dropdown-item toolbar-dropdown-item-active", onClick: () => setIsViewMenuOpen(false), children: [
284
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _Portrait2.default, { fontSize: "small" }),
285
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Single Page" })
286
+ ] }),
287
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "toolbar-dropdown-divider" }),
288
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "toolbar-dropdown-header", children: "SCROLL LAYOUT" }),
289
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "button", { className: "toolbar-dropdown-item toolbar-dropdown-item-active", onClick: () => setIsViewMenuOpen(false), children: [
290
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _SwapVert2.default, { fontSize: "small" }),
291
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Vertical" })
292
+ ] }),
293
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "toolbar-dropdown-divider" }),
294
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "button", { className: "toolbar-dropdown-item", onClick: () => {
295
+ setIsViewMenuOpen(false);
296
+ _optionalChain([onFitToWidth, 'optionalCall', _3 => _3()]);
297
+ }, children: [
298
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _AspectRatio2.default, { fontSize: "small" }),
299
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Fit to Width" })
300
+ ] }),
301
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "button", { className: "toolbar-dropdown-item", onClick: () => {
302
+ setIsViewMenuOpen(false);
303
+ _optionalChain([onFitToPage, 'optionalCall', _4 => _4()]);
304
+ }, children: [
305
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _FitScreen2.default, { fontSize: "small" }),
306
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Fit to Page" })
307
+ ] }),
308
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "toolbar-dropdown-divider" }),
309
+ showRotation && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
310
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "toolbar-dropdown-header", children: "PAGE ROTATION" }),
311
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
312
+ "button",
313
+ {
314
+ className: "toolbar-dropdown-item",
315
+ onClick: () => {
316
+ setIsViewMenuOpen(false);
317
+ _optionalChain([onRotateRight, 'optionalCall', _5 => _5()]);
318
+ },
319
+ disabled: false,
320
+ children: [
321
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _RotateRight2.default, { fontSize: "small" }),
322
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Rotate Clockwise" })
323
+ ]
324
+ }
325
+ ),
326
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
327
+ "button",
328
+ {
329
+ className: "toolbar-dropdown-item",
330
+ onClick: () => {
331
+ setIsViewMenuOpen(false);
332
+ _optionalChain([onRotateLeft, 'optionalCall', _6 => _6()]);
333
+ },
334
+ disabled: disabledRotateLeft,
335
+ children: [
336
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _RotateLeft2.default, { fontSize: "small" }),
337
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Rotate Counter-Clockwise" })
338
+ ]
339
+ }
340
+ )
341
+ ] }),
342
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "toolbar-dropdown-divider" }),
343
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
344
+ "button",
345
+ {
346
+ className: "toolbar-dropdown-item",
347
+ onClick: () => {
348
+ setIsViewMenuOpen(false);
349
+ onToggleFullScreen();
350
+ },
351
+ children: [
352
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _Fullscreen2.default, { fontSize: "small" }),
353
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Fullscreen" })
354
+ ]
355
+ }
356
+ )
357
+ ] })
358
+ ] }) })
359
+ ] }),
360
+ showSearch && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
361
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "toolbar-separator" }),
362
+ /* @__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,
363
+ "button",
364
+ {
365
+ className: `toolbar-button ${isSidebarOpen ? "toolbar-button-active" : ""}`,
366
+ onClick: onToggleSidebar,
367
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _Search2.default, { fontSize: "small" })
368
+ }
369
+ ) }) })
370
+ ] })
371
+ ] }),
372
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "toolbar-center", children: [
190
373
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
191
374
  "button",
192
375
  {
193
- className: "toolbar-button",
194
- onClick: onZoomIn,
195
- title: "Zoom In",
196
- children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _ZoomIn2.default, { fontSize: "small" })
197
- }
198
- ),
199
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
200
- "button",
201
- {
202
- className: "toolbar-button",
203
- onClick: onFitToWidth,
204
- title: "Fit to Width",
205
- children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _AspectRatio2.default, { fontSize: "small" })
206
- }
207
- ),
208
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
209
- "button",
210
- {
211
- className: "toolbar-button",
212
- onClick: onFitToPage,
213
- title: "Fit to Page",
214
- children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _FitScreen2.default, { fontSize: "small" })
215
- }
216
- )
217
- ] })
218
- ] }),
219
- showRotation && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
220
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "toolbar-separator" }),
221
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "toolbar-section", children: [
222
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
223
- "button",
224
- {
225
- className: "toolbar-button",
226
- onClick: onRotateLeft,
227
- disabled: disabledRotateLeft,
228
- title: "Rotate Counterclockwise",
229
- children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _RotateLeft2.default, { fontSize: "small" })
376
+ className: `toolbar-tab ${activeMode === "view" ? "toolbar-tab-active" : ""}`,
377
+ onClick: () => setActiveMode("view"),
378
+ children: "View"
230
379
  }
231
380
  ),
232
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
381
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
233
382
  "button",
234
383
  {
235
- className: "toolbar-button",
236
- onClick: onRotateRight,
237
- disabled: disabledRotateRight,
238
- title: "Rotate Clockwise",
239
- children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _RotateRight2.default, { fontSize: "small" })
384
+ className: `toolbar-tab ${activeMode === "annotate" ? "toolbar-tab-active" : ""}`,
385
+ onClick: () => setActiveMode("annotate"),
386
+ style: { position: "relative" },
387
+ children: [
388
+ "Annotate",
389
+ hasUnsavedAnnotations && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { style: {
390
+ position: "absolute",
391
+ top: "4px",
392
+ right: "4px",
393
+ width: "6px",
394
+ height: "6px",
395
+ backgroundColor: "#ef4444",
396
+ borderRadius: "50%"
397
+ } })
398
+ ]
240
399
  }
241
400
  )
242
- ] })
401
+ ] }),
402
+ /* @__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: [
403
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "toolbar-separator" }),
404
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "toolbar-section", children: [
405
+ showDownload && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Tooltip, { title: "Download", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
406
+ "button",
407
+ {
408
+ className: "toolbar-button",
409
+ onClick: onDownloadClick,
410
+ disabled: disabledDownload,
411
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _Download2.default, { fontSize: "small" })
412
+ }
413
+ ) }),
414
+ showPrint && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "toolbar-dropdown-container", ref: printMenuRef, children: [
415
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Tooltip, { title: "Print", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
416
+ "button",
417
+ {
418
+ className: `toolbar-button toolbar-dropdown-button ${isPrintMenuOpen ? "toolbar-button-active" : ""}`,
419
+ onClick: () => setIsPrintMenuOpen(!isPrintMenuOpen),
420
+ children: [
421
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _Print2.default, { fontSize: "small" }),
422
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _KeyboardArrowDown2.default, { fontSize: "small", style: { marginLeft: -4 } })
423
+ ]
424
+ }
425
+ ) }),
426
+ isPrintMenuOpen && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "toolbar-dropdown-menu", children: [
427
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
428
+ "button",
429
+ {
430
+ className: "toolbar-dropdown-item",
431
+ onClick: handlePrintWithoutAnnotations,
432
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Print Document Only" })
433
+ }
434
+ ),
435
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
436
+ "button",
437
+ {
438
+ className: "toolbar-dropdown-item",
439
+ onClick: handlePrintWithAnnotations,
440
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Print with Annotations" })
441
+ }
442
+ )
443
+ ] })
444
+ ] }),
445
+ showMetadata && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Tooltip, { title: "Metadata", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
446
+ "button",
447
+ {
448
+ className: "toolbar-button",
449
+ onClick: onMetadataClick,
450
+ disabled: disabledMetadata,
451
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _Description2.default, { fontSize: "small" })
452
+ }
453
+ ) }),
454
+ showProperties && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Tooltip, { title: "Properties", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
455
+ "button",
456
+ {
457
+ className: "toolbar-button",
458
+ onClick: onPropertiesClick,
459
+ disabled: disabledProperties,
460
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _Info2.default, { fontSize: "small" })
461
+ }
462
+ ) }),
463
+ showTags && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Tooltip, { title: "Tags", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
464
+ "button",
465
+ {
466
+ className: "toolbar-button",
467
+ onClick: onTagsClick,
468
+ disabled: disabledTags,
469
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _iconsmaterial.LocalOffer, { fontSize: "small" })
470
+ }
471
+ ) }),
472
+ showHistory && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Tooltip, { title: "Version History", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
473
+ "button",
474
+ {
475
+ className: "toolbar-button",
476
+ onClick: onHistoryClick,
477
+ disabled: disabledHistory,
478
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _History2.default, { fontSize: "small" })
479
+ }
480
+ ) })
481
+ ] })
482
+ ] }) })
243
483
  ] }),
244
- showSearch && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
245
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "toolbar-separator" }),
246
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "toolbar-section", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
484
+ activeMode === "annotate" && showAnnotations && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "pdf-viewer-secondary-toolbar", children: [
485
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Tooltip, { title: "Highlight", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
486
+ "button",
487
+ {
488
+ className: `toolbar-button ${isHighlighterActive ? "toolbar-button-active" : ""}`,
489
+ onClick: onHighlighterClick,
490
+ disabled: disabledHighlighter,
491
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _Highlight2.default, { fontSize: "small" })
492
+ }
493
+ ) }),
494
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Tooltip, { title: "Stamp", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
495
+ "button",
496
+ {
497
+ className: `toolbar-button ${isStampActive ? "toolbar-button-active" : ""}`,
498
+ onClick: onStampClick,
499
+ disabled: disabledStamp,
500
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _Approval2.default, { fontSize: "small" })
501
+ }
502
+ ) }),
503
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Tooltip, { title: "Signature", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
247
504
  "button",
248
505
  {
249
506
  className: "toolbar-button",
250
- onClick: onToggleSidebar,
251
- title: "Search in PDF",
252
- style: {
253
- backgroundColor: isSidebarOpen ? "#e3f2fd" : "transparent",
254
- color: isSidebarOpen ? "#1976d2" : "inherit"
255
- },
256
- children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _Search2.default, { fontSize: "small" })
507
+ onClick: onSignatureClick,
508
+ disabled: disabledSignature,
509
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _Draw2.default, { fontSize: "small" })
257
510
  }
258
- ) })
259
- ] }),
260
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "toolbar-separator" }),
261
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "toolbar-section", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
262
- "button",
263
- {
264
- className: "toolbar-button",
265
- onClick: onToggleFullScreen,
266
- title: "Fullscreen",
267
- children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _Fullscreen2.default, { fontSize: "small" })
268
- }
269
- ) }),
270
- (showMetadata || showProperties || showDownload || showPrint || showTags || showHistory) && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
271
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "toolbar-separator" }),
272
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "toolbar-section", children: [
273
- showDownload && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
274
- "button",
275
- {
276
- className: "toolbar-button",
277
- onClick: onDownloadClick,
278
- disabled: disabledDownload,
279
- title: "Download PDF",
280
- children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _Download2.default, { fontSize: "small" })
281
- }
282
- ),
283
- showPrint && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
284
- "button",
285
- {
286
- className: "toolbar-button",
287
- onClick: onPrintClick,
288
- disabled: disabledPrint,
289
- title: "Print PDF",
290
- children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _Print2.default, { fontSize: "small" })
291
- }
292
- ),
293
- showMetadata && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
294
- "button",
295
- {
296
- className: "toolbar-button",
297
- onClick: onMetadataClick,
298
- disabled: disabledMetadata,
299
- title: "Document Metadata",
300
- children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _Description2.default, { fontSize: "small" })
301
- }
302
- ),
303
- showProperties && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
304
- "button",
305
- {
306
- className: "toolbar-button",
307
- onClick: onPropertiesClick,
308
- disabled: disabledProperties,
309
- title: "Document Properties",
310
- children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _Info2.default, { fontSize: "small" })
311
- }
312
- ),
313
- showTags && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
314
- "button",
315
- {
316
- className: "toolbar-button",
317
- onClick: onTagsClick,
318
- disabled: disabledTags,
319
- title: "Document Tags",
320
- children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _iconsmaterial.LocalOffer, { fontSize: "small" })
321
- }
322
- ),
323
- showHistory && /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
511
+ ) }),
512
+ hasUnsavedAnnotations && canSaveAnnotations !== false && onSaveAnnotations && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
513
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { style: { width: 1, height: 24, backgroundColor: "#e5e7eb", margin: "0 8px" } }),
514
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Tooltip, { title: "Save Annotations", children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
324
515
  "button",
325
516
  {
326
517
  className: "toolbar-button",
327
- onClick: onHistoryClick,
328
- disabled: disabledHistory,
329
- title: "Document History",
330
- children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _History2.default, { fontSize: "small" })
518
+ onClick: onSaveAnnotations,
519
+ disabled: isSavingAnnotations,
520
+ style: {
521
+ color: hasUnsavedAnnotations ? "#2563eb" : "inherit",
522
+ padding: "6px 16px",
523
+ border: hasUnsavedAnnotations ? "1px solid #2563eb" : "1px solid transparent",
524
+ borderRadius: "6px",
525
+ display: "flex",
526
+ alignItems: "center",
527
+ gap: "6px",
528
+ backgroundColor: hasUnsavedAnnotations ? "#eff6ff" : "transparent",
529
+ fontSize: "14px",
530
+ fontWeight: 500,
531
+ width: "auto"
532
+ },
533
+ children: [
534
+ 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: [
535
+ /* @__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" }),
536
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "polyline", { points: "17 21 17 13 7 13 7 21" }),
537
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "polyline", { points: "7 3 7 8 15 8" })
538
+ ] }),
539
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: isSavingAnnotations ? "Saving..." : "Save" })
540
+ ]
331
541
  }
332
- )
542
+ ) })
333
543
  ] })
334
- ] })
544
+ ] }),
545
+ 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" }) }) }) })
335
546
  ] });
336
547
  }
337
548
  );
@@ -358,11 +569,11 @@ PDFHeader.displayName = "PDFHeader";
358
569
 
359
570
 
360
571
 
361
- var _material = require('@mui/material');
572
+
362
573
 
363
574
  var _Close = require('@mui/icons-material/Close'); var _Close2 = _interopRequireDefault(_Close);
364
575
  var _KeyboardArrowUp = require('@mui/icons-material/KeyboardArrowUp'); var _KeyboardArrowUp2 = _interopRequireDefault(_KeyboardArrowUp);
365
- var _KeyboardArrowDown = require('@mui/icons-material/KeyboardArrowDown'); var _KeyboardArrowDown2 = _interopRequireDefault(_KeyboardArrowDown);
576
+
366
577
  var _Clear = require('@mui/icons-material/Clear'); var _Clear2 = _interopRequireDefault(_Clear);
367
578
  var _FindInPage = require('@mui/icons-material/FindInPage'); var _FindInPage2 = _interopRequireDefault(_FindInPage);
368
579
 
@@ -864,19 +1075,29 @@ var PasswordDialog = ({
864
1075
  fileName,
865
1076
  onSubmit,
866
1077
  onCancel,
867
- error
1078
+ error,
1079
+ isLoading = false
868
1080
  }) => {
869
1081
  const [password, setPassword] = _react.useState.call(void 0, "");
870
1082
  const [showPassword, setShowPassword] = _react.useState.call(void 0, false);
1083
+ _react.useEffect.call(void 0, () => {
1084
+ if (open && !isLoading) {
1085
+ if (error) {
1086
+ setPassword("");
1087
+ }
1088
+ }
1089
+ }, [open, error, isLoading]);
871
1090
  _react.useEffect.call(void 0, () => {
872
1091
  if (open) {
873
- setPassword("");
874
1092
  setShowPassword(false);
1093
+ if (!error) {
1094
+ setPassword("");
1095
+ }
875
1096
  }
876
1097
  }, [open]);
877
1098
  const handleSubmit = (e) => {
878
1099
  e.preventDefault();
879
- if (password.trim()) {
1100
+ if (password.trim() && !isLoading) {
880
1101
  onSubmit(password);
881
1102
  }
882
1103
  };
@@ -884,7 +1105,7 @@ var PasswordDialog = ({
884
1105
  setShowPassword(!showPassword);
885
1106
  };
886
1107
  const handleKeyPress = (e) => {
887
- if (e.key === "Enter" && password.trim()) {
1108
+ if (e.key === "Enter" && password.trim() && !isLoading) {
888
1109
  handleSubmit(e);
889
1110
  }
890
1111
  };
@@ -892,45 +1113,44 @@ var PasswordDialog = ({
892
1113
  _material.Dialog,
893
1114
  {
894
1115
  open,
895
- onClose: onCancel,
1116
+ disableEscapeKeyDown: true,
1117
+ onClose: (event, reason) => {
1118
+ if (reason === "backdropClick") return;
1119
+ },
896
1120
  maxWidth: "sm",
897
1121
  fullWidth: true,
1122
+ slotProps: {
1123
+ backdrop: {
1124
+ sx: {
1125
+ backdropFilter: "blur(8px)",
1126
+ backgroundColor: "rgba(0, 0, 0, 0.6)"
1127
+ }
1128
+ }
1129
+ },
898
1130
  PaperProps: {
899
1131
  sx: {
900
1132
  borderRadius: 2
901
1133
  }
902
1134
  },
903
1135
  children: [
904
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.DialogTitle, { sx: { pb: 1 }, children: /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _material.Box, { sx: { display: "flex", alignItems: "center", justifyContent: "space-between" }, children: [
905
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _material.Box, { sx: { display: "flex", alignItems: "center", gap: 1.5 }, children: [
906
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
907
- _material.Box,
908
- {
909
- sx: {
910
- width: 40,
911
- height: 40,
912
- borderRadius: "50%",
913
- backgroundColor: "primary.light",
914
- display: "flex",
915
- alignItems: "center",
916
- justifyContent: "center",
917
- opacity: 0.9
918
- },
919
- children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _Lock2.default, { sx: { color: "white", fontSize: 20 } })
920
- }
921
- ),
922
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Typography, { variant: "h6", component: "div", sx: { fontWeight: 600 }, children: "Password Protected" })
923
- ] }),
1136
+ /* @__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: [
924
1137
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
925
- _material.IconButton,
1138
+ _material.Box,
926
1139
  {
927
- size: "small",
928
- onClick: onCancel,
929
- sx: { color: "text.secondary" },
930
- "aria-label": "Close dialog",
931
- children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _Close2.default, { fontSize: "small" })
1140
+ sx: {
1141
+ width: 40,
1142
+ height: 40,
1143
+ borderRadius: "50%",
1144
+ backgroundColor: "primary.light",
1145
+ display: "flex",
1146
+ alignItems: "center",
1147
+ justifyContent: "center",
1148
+ opacity: 0.9
1149
+ },
1150
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _Lock2.default, { sx: { color: "white", fontSize: 20 } })
932
1151
  }
933
- )
1152
+ ),
1153
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Typography, { variant: "h6", component: "div", sx: { fontWeight: 600 }, children: "Password Protected" })
934
1154
  ] }) }),
935
1155
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _material.DialogContent, { sx: { pt: 2 }, children: [
936
1156
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _material.Typography, { variant: "body2", sx: { color: "text.secondary", mb: 3 }, children: [
@@ -955,6 +1175,7 @@ var PasswordDialog = ({
955
1175
  onChange: (e) => setPassword(e.target.value),
956
1176
  onKeyPress: handleKeyPress,
957
1177
  error: Boolean(error),
1178
+ disabled: isLoading,
958
1179
  InputProps: {
959
1180
  endAdornment: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.InputAdornment, { position: "end", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
960
1181
  _material.IconButton,
@@ -963,6 +1184,7 @@ var PasswordDialog = ({
963
1184
  edge: "end",
964
1185
  size: "small",
965
1186
  "aria-label": showPassword ? "Hide password" : "Show password",
1187
+ disabled: isLoading,
966
1188
  children: showPassword ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _VisibilityOff2.default, {}) : /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _Visibility2.default, {})
967
1189
  }
968
1190
  ) })
@@ -975,36 +1197,25 @@ var PasswordDialog = ({
975
1197
  }
976
1198
  ) })
977
1199
  ] }),
978
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _material.DialogActions, { sx: { px: 3, pb: 3, pt: 2 }, children: [
979
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
980
- _material.Button,
981
- {
982
- onClick: onCancel,
983
- variant: "outlined",
984
- sx: {
985
- borderRadius: 2,
986
- textTransform: "none",
987
- px: 3
988
- },
989
- children: "Cancel"
990
- }
991
- ),
992
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
993
- _material.Button,
994
- {
995
- onClick: handleSubmit,
996
- variant: "contained",
997
- disabled: !password.trim(),
998
- sx: {
999
- borderRadius: 2,
1000
- textTransform: "none",
1001
- px: 3,
1002
- boxShadow: 2
1003
- },
1004
- children: "Unlock PDF"
1005
- }
1006
- )
1007
- ] })
1200
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.DialogActions, { sx: { px: 3, pb: 3, pt: 2 }, children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1201
+ _material.Button,
1202
+ {
1203
+ onClick: handleSubmit,
1204
+ variant: "contained",
1205
+ disabled: !password.trim() || isLoading,
1206
+ sx: {
1207
+ borderRadius: 2,
1208
+ textTransform: "none",
1209
+ px: 3,
1210
+ boxShadow: 2,
1211
+ minWidth: 120
1212
+ },
1213
+ children: isLoading ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
1214
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.CircularProgress, { size: 16, color: "inherit", sx: { mr: 1 } }),
1215
+ "Verifying..."
1216
+ ] }) : "Unlock PDF"
1217
+ }
1218
+ ) })
1008
1219
  ]
1009
1220
  }
1010
1221
  );
@@ -1037,12 +1248,29 @@ var PDFViewerContent = _react.forwardRef.call(void 0,
1037
1248
  onDownloadClick,
1038
1249
  onPrintClick,
1039
1250
  initialSearchText,
1040
- initialSearchPages
1251
+ initialSearchPages,
1252
+ showAnnotations,
1253
+ userDetails,
1254
+ annotationSelectionMenu,
1255
+ isHighlighterActive,
1256
+ isStampActive,
1257
+ onHighlighterClick,
1258
+ onStampClick,
1259
+ onSignatureClick,
1260
+ // Annotation save props
1261
+ hasUnsavedAnnotations,
1262
+ isSavingAnnotations,
1263
+ canSaveAnnotations,
1264
+ onSaveAnnotations
1041
1265
  } = props;
1042
1266
  const [pdfBuffer, setPdfBuffer] = _react.useState.call(void 0, null);
1043
1267
  const [state, setState] = _react.useState.call(void 0, "idle");
1044
1268
  const [error, setError] = _react.useState.call(void 0, null);
1045
1269
  const pdfViewerRef = _react.useRef.call(void 0, null);
1270
+ const [internalHighlighterActive, setInternalHighlighterActive] = _react.useState.call(void 0, false);
1271
+ const [internalStampActive, setInternalStampActive] = _react.useState.call(void 0, false);
1272
+ const highlighterActive = isHighlighterActive !== void 0 ? isHighlighterActive : internalHighlighterActive;
1273
+ const stampActive = isStampActive !== void 0 ? isStampActive : internalStampActive;
1046
1274
  const resolvedFileName = _react.useMemo.call(void 0, () => {
1047
1275
  if (fileName) return fileName;
1048
1276
  if (file instanceof File) return file.name;
@@ -1073,10 +1301,12 @@ var PDFViewerContent = _react.forwardRef.call(void 0,
1073
1301
  const containerRef = _react.useRef.call(void 0, null);
1074
1302
  const [isPasswordDialogOpen, setIsPasswordDialogOpen] = _react.useState.call(void 0, false);
1075
1303
  const [passwordError, setPasswordError] = _react.useState.call(void 0, "");
1304
+ const [isVerifyingPassword, setIsVerifyingPassword] = _react.useState.call(void 0, false);
1076
1305
  const [passwordResolve, setPasswordResolve] = _react.useState.call(void 0, null);
1306
+ const passwordTimeoutRef = _react.useRef.call(void 0, null);
1077
1307
  const hasExecutedInitialSearch = _react.useRef.call(void 0, false);
1078
1308
  const handleToggleFullScreen = _react.useCallback.call(void 0, () => {
1079
- if (!isFullScreen && _optionalChain([containerRef, 'access', _ => _.current, 'optionalAccess', _2 => _2.requestFullscreen])) {
1309
+ if (!isFullScreen && _optionalChain([containerRef, 'access', _7 => _7.current, 'optionalAccess', _8 => _8.requestFullscreen])) {
1080
1310
  containerRef.current.requestFullscreen();
1081
1311
  setIsFullScreen(true);
1082
1312
  } else if (isFullScreen && document.exitFullscreen) {
@@ -1084,13 +1314,23 @@ var PDFViewerContent = _react.forwardRef.call(void 0,
1084
1314
  setIsFullScreen(false);
1085
1315
  }
1086
1316
  }, [isFullScreen]);
1317
+ _react.useEffect.call(void 0, () => {
1318
+ const handleFullscreenChange = () => {
1319
+ const isCurrentlyFullscreen = !!document.fullscreenElement;
1320
+ setIsFullScreen(isCurrentlyFullscreen);
1321
+ };
1322
+ document.addEventListener("fullscreenchange", handleFullscreenChange);
1323
+ return () => {
1324
+ document.removeEventListener("fullscreenchange", handleFullscreenChange);
1325
+ };
1326
+ }, []);
1087
1327
  const handleSidebarClose = _react.useCallback.call(void 0, () => {
1088
1328
  setIsSidebarOpen(false);
1089
1329
  setSearchQuery("");
1090
1330
  setSearchResults([]);
1091
1331
  setTotalSearchResults(0);
1092
1332
  setCurrentSearchResultIndex(0);
1093
- _optionalChain([pdfViewerRef, 'access', _3 => _3.current, 'optionalAccess', _4 => _4.search, 'access', _5 => _5.stopSearch, 'call', _6 => _6()]);
1333
+ _optionalChain([pdfViewerRef, 'access', _9 => _9.current, 'optionalAccess', _10 => _10.search, 'access', _11 => _11.stopSearch, 'call', _12 => _12()]);
1094
1334
  }, []);
1095
1335
  const toolbar = _chunkEEIQAW55js.mergeToolbarConfig.call(void 0, {
1096
1336
  showDownload,
@@ -1111,66 +1351,66 @@ var PDFViewerContent = _react.forwardRef.call(void 0,
1111
1351
  const toolbarHandlers = _react.useMemo.call(void 0,
1112
1352
  () => ({
1113
1353
  handleZoomIn: () => {
1114
- _optionalChain([pdfViewerRef, 'access', _7 => _7.current, 'optionalAccess', _8 => _8.zoom, 'access', _9 => _9.zoomIn, 'call', _10 => _10()]);
1354
+ _optionalChain([pdfViewerRef, 'access', _13 => _13.current, 'optionalAccess', _14 => _14.zoom, 'access', _15 => _15.zoomIn, 'call', _16 => _16()]);
1115
1355
  requestAnimationFrame(() => {
1116
- const zoomValue = _optionalChain([pdfViewerRef, 'access', _11 => _11.current, 'optionalAccess', _12 => _12.zoom, 'access', _13 => _13.getZoom, 'call', _14 => _14()]);
1356
+ const zoomValue = _optionalChain([pdfViewerRef, 'access', _17 => _17.current, 'optionalAccess', _18 => _18.zoom, 'access', _19 => _19.getZoom, 'call', _20 => _20()]);
1117
1357
  if (typeof zoomValue === "number") {
1118
1358
  setZoom(Math.round(zoomValue * 100));
1119
1359
  }
1120
1360
  });
1121
1361
  },
1122
1362
  handleZoomOut: () => {
1123
- _optionalChain([pdfViewerRef, 'access', _15 => _15.current, 'optionalAccess', _16 => _16.zoom, 'access', _17 => _17.zoomOut, 'call', _18 => _18()]);
1363
+ _optionalChain([pdfViewerRef, 'access', _21 => _21.current, 'optionalAccess', _22 => _22.zoom, 'access', _23 => _23.zoomOut, 'call', _24 => _24()]);
1124
1364
  requestAnimationFrame(() => {
1125
- const zoomValue = _optionalChain([pdfViewerRef, 'access', _19 => _19.current, 'optionalAccess', _20 => _20.zoom, 'access', _21 => _21.getZoom, 'call', _22 => _22()]);
1365
+ const zoomValue = _optionalChain([pdfViewerRef, 'access', _25 => _25.current, 'optionalAccess', _26 => _26.zoom, 'access', _27 => _27.getZoom, 'call', _28 => _28()]);
1126
1366
  if (typeof zoomValue === "number") {
1127
1367
  setZoom(Math.round(zoomValue * 100));
1128
1368
  }
1129
1369
  });
1130
1370
  },
1131
1371
  handleFitToWidth: () => {
1132
- _optionalChain([pdfViewerRef, 'access', _23 => _23.current, 'optionalAccess', _24 => _24.zoom, 'access', _25 => _25.fitToWidth, 'call', _26 => _26()]);
1372
+ _optionalChain([pdfViewerRef, 'access', _29 => _29.current, 'optionalAccess', _30 => _30.zoom, 'access', _31 => _31.fitToWidth, 'call', _32 => _32()]);
1133
1373
  requestAnimationFrame(() => {
1134
- const zoomValue = _optionalChain([pdfViewerRef, 'access', _27 => _27.current, 'optionalAccess', _28 => _28.zoom, 'access', _29 => _29.getZoom, 'call', _30 => _30()]);
1374
+ const zoomValue = _optionalChain([pdfViewerRef, 'access', _33 => _33.current, 'optionalAccess', _34 => _34.zoom, 'access', _35 => _35.getZoom, 'call', _36 => _36()]);
1135
1375
  if (typeof zoomValue === "number") {
1136
1376
  setZoom(Math.round(zoomValue * 100));
1137
1377
  }
1138
1378
  });
1139
1379
  },
1140
1380
  handleFitToPage: () => {
1141
- _optionalChain([pdfViewerRef, 'access', _31 => _31.current, 'optionalAccess', _32 => _32.zoom, 'access', _33 => _33.fitToPage, 'call', _34 => _34()]);
1381
+ _optionalChain([pdfViewerRef, 'access', _37 => _37.current, 'optionalAccess', _38 => _38.zoom, 'access', _39 => _39.fitToPage, 'call', _40 => _40()]);
1142
1382
  requestAnimationFrame(() => {
1143
- const zoomValue = _optionalChain([pdfViewerRef, 'access', _35 => _35.current, 'optionalAccess', _36 => _36.zoom, 'access', _37 => _37.getZoom, 'call', _38 => _38()]);
1383
+ const zoomValue = _optionalChain([pdfViewerRef, 'access', _41 => _41.current, 'optionalAccess', _42 => _42.zoom, 'access', _43 => _43.getZoom, 'call', _44 => _44()]);
1144
1384
  if (typeof zoomValue === "number") {
1145
1385
  setZoom(Math.round(zoomValue * 100));
1146
1386
  }
1147
1387
  });
1148
1388
  },
1149
1389
  handlePreviousPage: () => {
1150
- _optionalChain([pdfViewerRef, 'access', _39 => _39.current, 'optionalAccess', _40 => _40.navigation, 'access', _41 => _41.previousPage, 'call', _42 => _42()]);
1390
+ _optionalChain([pdfViewerRef, 'access', _45 => _45.current, 'optionalAccess', _46 => _46.navigation, 'access', _47 => _47.previousPage, 'call', _48 => _48()]);
1151
1391
  requestAnimationFrame(() => {
1152
- const current = _optionalChain([pdfViewerRef, 'access', _43 => _43.current, 'optionalAccess', _44 => _44.navigation, 'access', _45 => _45.getCurrentPage, 'call', _46 => _46()]) || 1;
1392
+ const current = _optionalChain([pdfViewerRef, 'access', _49 => _49.current, 'optionalAccess', _50 => _50.navigation, 'access', _51 => _51.getCurrentPage, 'call', _52 => _52()]) || 1;
1153
1393
  setCurrentPage(current);
1154
1394
  });
1155
1395
  },
1156
1396
  handleNextPage: () => {
1157
- _optionalChain([pdfViewerRef, 'access', _47 => _47.current, 'optionalAccess', _48 => _48.navigation, 'access', _49 => _49.nextPage, 'call', _50 => _50()]);
1397
+ _optionalChain([pdfViewerRef, 'access', _53 => _53.current, 'optionalAccess', _54 => _54.navigation, 'access', _55 => _55.nextPage, 'call', _56 => _56()]);
1158
1398
  requestAnimationFrame(() => {
1159
- const current = _optionalChain([pdfViewerRef, 'access', _51 => _51.current, 'optionalAccess', _52 => _52.navigation, 'access', _53 => _53.getCurrentPage, 'call', _54 => _54()]) || 1;
1399
+ const current = _optionalChain([pdfViewerRef, 'access', _57 => _57.current, 'optionalAccess', _58 => _58.navigation, 'access', _59 => _59.getCurrentPage, 'call', _60 => _60()]) || 1;
1160
1400
  setCurrentPage(current);
1161
1401
  });
1162
1402
  },
1163
1403
  handleFirstPage: () => {
1164
- _optionalChain([pdfViewerRef, 'access', _55 => _55.current, 'optionalAccess', _56 => _56.navigation, 'access', _57 => _57.goToFirstPage, 'call', _58 => _58()]);
1404
+ _optionalChain([pdfViewerRef, 'access', _61 => _61.current, 'optionalAccess', _62 => _62.navigation, 'access', _63 => _63.goToFirstPage, 'call', _64 => _64()]);
1165
1405
  requestAnimationFrame(() => {
1166
- const current = _optionalChain([pdfViewerRef, 'access', _59 => _59.current, 'optionalAccess', _60 => _60.navigation, 'access', _61 => _61.getCurrentPage, 'call', _62 => _62()]) || 1;
1406
+ const current = _optionalChain([pdfViewerRef, 'access', _65 => _65.current, 'optionalAccess', _66 => _66.navigation, 'access', _67 => _67.getCurrentPage, 'call', _68 => _68()]) || 1;
1167
1407
  setCurrentPage(current);
1168
1408
  });
1169
1409
  },
1170
1410
  handleLastPage: () => {
1171
- _optionalChain([pdfViewerRef, 'access', _63 => _63.current, 'optionalAccess', _64 => _64.navigation, 'access', _65 => _65.goToLastPage, 'call', _66 => _66()]);
1411
+ _optionalChain([pdfViewerRef, 'access', _69 => _69.current, 'optionalAccess', _70 => _70.navigation, 'access', _71 => _71.goToLastPage, 'call', _72 => _72()]);
1172
1412
  requestAnimationFrame(() => {
1173
- const current = _optionalChain([pdfViewerRef, 'access', _67 => _67.current, 'optionalAccess', _68 => _68.navigation, 'access', _69 => _69.getCurrentPage, 'call', _70 => _70()]) || 1;
1413
+ const current = _optionalChain([pdfViewerRef, 'access', _73 => _73.current, 'optionalAccess', _74 => _74.navigation, 'access', _75 => _75.getCurrentPage, 'call', _76 => _76()]) || 1;
1174
1414
  setCurrentPage(current);
1175
1415
  });
1176
1416
  },
@@ -1188,7 +1428,7 @@ var PDFViewerContent = _react.forwardRef.call(void 0,
1188
1428
  }
1189
1429
  const page = parseInt(value, 10);
1190
1430
  if (!isNaN(page) && page >= 1 && (totalPages === 0 || page <= totalPages)) {
1191
- _optionalChain([pdfViewerRef, 'access', _71 => _71.current, 'optionalAccess', _72 => _72.navigation, 'access', _73 => _73.goToPage, 'call', _74 => _74(page)]);
1431
+ _optionalChain([pdfViewerRef, 'access', _77 => _77.current, 'optionalAccess', _78 => _78.navigation, 'access', _79 => _79.goToPage, 'call', _80 => _80(page)]);
1192
1432
  setCurrentPage(page);
1193
1433
  }
1194
1434
  },
@@ -1197,20 +1437,63 @@ var PDFViewerContent = _react.forwardRef.call(void 0,
1197
1437
  const value = e.target.value;
1198
1438
  const page = parseInt(value, 10);
1199
1439
  if (!isNaN(page) && page >= 1 && (totalPages === 0 || page <= totalPages)) {
1200
- _optionalChain([pdfViewerRef, 'access', _75 => _75.current, 'optionalAccess', _76 => _76.navigation, 'access', _77 => _77.goToPage, 'call', _78 => _78(page)]);
1440
+ _optionalChain([pdfViewerRef, 'access', _81 => _81.current, 'optionalAccess', _82 => _82.navigation, 'access', _83 => _83.goToPage, 'call', _84 => _84(page)]);
1201
1441
  setCurrentPage(page);
1202
1442
  }
1203
1443
  }
1204
1444
  },
1205
1445
  handleRotateLeft: () => {
1206
- _optionalChain([pdfViewerRef, 'access', _79 => _79.current, 'optionalAccess', _80 => _80.rotate, 'optionalAccess', _81 => _81.rotateBackward, 'call', _82 => _82()]);
1446
+ _optionalChain([pdfViewerRef, 'access', _85 => _85.current, 'optionalAccess', _86 => _86.rotate, 'optionalAccess', _87 => _87.rotateBackward, 'call', _88 => _88()]);
1207
1447
  },
1208
1448
  handleRotateRight: () => {
1209
- _optionalChain([pdfViewerRef, 'access', _83 => _83.current, 'optionalAccess', _84 => _84.rotate, 'optionalAccess', _85 => _85.rotateForward, 'call', _86 => _86()]);
1449
+ _optionalChain([pdfViewerRef, 'access', _89 => _89.current, 'optionalAccess', _90 => _90.rotate, 'optionalAccess', _91 => _91.rotateForward, 'call', _92 => _92()]);
1450
+ },
1451
+ handlePrint: () => {
1452
+ _optionalChain([pdfViewerRef, 'access', _93 => _93.current, 'optionalAccess', _94 => _94.print, 'optionalAccess', _95 => _95.print, 'call', _96 => _96()]);
1453
+ },
1454
+ handlePrintWithAnnotations: async () => {
1455
+ console.log("\u{1F5A8}\uFE0F Print with Annotations clicked");
1456
+ console.log("pdfViewerRef.current:", pdfViewerRef.current);
1457
+ console.log("pdfViewerRef.current?.print:", _optionalChain([pdfViewerRef, 'access', _97 => _97.current, 'optionalAccess', _98 => _98.print]));
1458
+ await _optionalChain([pdfViewerRef, 'access', _99 => _99.current, 'optionalAccess', _100 => _100.print, 'optionalAccess', _101 => _101.printWithAnnotations, 'optionalCall', _102 => _102()]);
1459
+ },
1460
+ handlePrintWithoutAnnotations: async () => {
1461
+ console.log("\u{1F5A8}\uFE0F Print without Annotations clicked");
1462
+ console.log("pdfViewerRef.current:", pdfViewerRef.current);
1463
+ console.log("pdfViewerRef.current?.print:", _optionalChain([pdfViewerRef, 'access', _103 => _103.current, 'optionalAccess', _104 => _104.print]));
1464
+ await _optionalChain([pdfViewerRef, 'access', _105 => _105.current, 'optionalAccess', _106 => _106.print, 'optionalAccess', _107 => _107.printWithoutAnnotations, 'optionalCall', _108 => _108()]);
1465
+ },
1466
+ handleHighlighterClick: () => {
1467
+ if (highlighterActive) {
1468
+ _optionalChain([pdfViewerRef, 'access', _109 => _109.current, 'optionalAccess', _110 => _110.annotation, 'optionalAccess', _111 => _111.deactivateHighlighter, 'call', _112 => _112()]);
1469
+ setInternalHighlighterActive(false);
1470
+ } else {
1471
+ if (stampActive) {
1472
+ _optionalChain([pdfViewerRef, 'access', _113 => _113.current, 'optionalAccess', _114 => _114.annotation, 'optionalAccess', _115 => _115.deactivateStamp, 'call', _116 => _116()]);
1473
+ setInternalStampActive(false);
1474
+ }
1475
+ _optionalChain([pdfViewerRef, 'access', _117 => _117.current, 'optionalAccess', _118 => _118.annotation, 'optionalAccess', _119 => _119.activateHighlighter, 'call', _120 => _120()]);
1476
+ setInternalHighlighterActive(true);
1477
+ }
1478
+ },
1479
+ handleStampClick: () => {
1480
+ if (stampActive) {
1481
+ _optionalChain([pdfViewerRef, 'access', _121 => _121.current, 'optionalAccess', _122 => _122.annotation, 'optionalAccess', _123 => _123.deactivateStamp, 'call', _124 => _124()]);
1482
+ setInternalStampActive(false);
1483
+ } else {
1484
+ if (highlighterActive) {
1485
+ _optionalChain([pdfViewerRef, 'access', _125 => _125.current, 'optionalAccess', _126 => _126.annotation, 'optionalAccess', _127 => _127.deactivateHighlighter, 'call', _128 => _128()]);
1486
+ setInternalHighlighterActive(false);
1487
+ }
1488
+ _optionalChain([pdfViewerRef, 'access', _129 => _129.current, 'optionalAccess', _130 => _130.annotation, 'optionalAccess', _131 => _131.activateStamp, 'call', _132 => _132("")]);
1489
+ setInternalStampActive(true);
1490
+ }
1491
+ },
1492
+ handleSignatureClick: () => {
1210
1493
  },
1211
1494
  handleToggleFullScreen
1212
1495
  }),
1213
- [isSidebarOpen, totalPages, handleToggleFullScreen]
1496
+ [isSidebarOpen, totalPages, handleToggleFullScreen, highlighterActive, stampActive]
1214
1497
  );
1215
1498
  _react.useEffect.call(void 0, () => {
1216
1499
  console.log(
@@ -1227,13 +1510,13 @@ var PDFViewerContent = _react.forwardRef.call(void 0,
1227
1510
  const isPDFReady = state === "ready";
1228
1511
  const isPagesInitialized = totalPages > 0;
1229
1512
  const isViewerAvailable = !!pdfViewerRef.current;
1230
- const isSearchAPIReady = !!_optionalChain([pdfViewerRef, 'access', _87 => _87.current, 'optionalAccess', _88 => _88.search, 'optionalAccess', _89 => _89.searchText]);
1513
+ const isSearchAPIReady = !!_optionalChain([pdfViewerRef, 'access', _133 => _133.current, 'optionalAccess', _134 => _134.search, 'optionalAccess', _135 => _135.searchText]);
1231
1514
  const canExecuteSearch = isPDFReady && isPagesInitialized && isViewerAvailable && isSearchAPIReady;
1232
1515
  if (!canExecuteSearch) return;
1233
1516
  hasExecutedInitialSearch.current = true;
1234
1517
  const SEARCH_INITIALIZATION_DELAY = 100;
1235
1518
  setTimeout(() => {
1236
- if (!_optionalChain([pdfViewerRef, 'access', _90 => _90.current, 'optionalAccess', _91 => _91.search, 'optionalAccess', _92 => _92.searchText])) {
1519
+ if (!_optionalChain([pdfViewerRef, 'access', _136 => _136.current, 'optionalAccess', _137 => _137.search, 'optionalAccess', _138 => _138.searchText])) {
1237
1520
  console.warn(
1238
1521
  "Search API became unavailable, skipping initial search"
1239
1522
  );
@@ -1309,7 +1592,7 @@ var PDFViewerContent = _react.forwardRef.call(void 0,
1309
1592
  if (!viewer) return;
1310
1593
  await new Promise((resolve) => requestAnimationFrame(resolve));
1311
1594
  try {
1312
- const count = _optionalChain([viewer, 'access', _93 => _93.navigation, 'optionalAccess', _94 => _94.getTotalPages, 'optionalCall', _95 => _95()]);
1595
+ const count = _optionalChain([viewer, 'access', _139 => _139.navigation, 'optionalAccess', _140 => _140.getTotalPages, 'optionalCall', _141 => _141()]);
1313
1596
  if (count && count > 1) {
1314
1597
  setTotalPages(count);
1315
1598
  return;
@@ -1317,11 +1600,11 @@ var PDFViewerContent = _react.forwardRef.call(void 0,
1317
1600
  } catch (e) {
1318
1601
  }
1319
1602
  try {
1320
- const results = await _optionalChain([viewer, 'access', _96 => _96.search, 'optionalAccess', _97 => _97.searchText, 'optionalCall', _98 => _98("e")]);
1321
- if (_optionalChain([results, 'optionalAccess', _99 => _99.results]) && results.results.length > 0) {
1603
+ const results = await _optionalChain([viewer, 'access', _142 => _142.search, 'optionalAccess', _143 => _143.searchText, 'optionalCall', _144 => _144("e")]);
1604
+ if (_optionalChain([results, 'optionalAccess', _145 => _145.results]) && results.results.length > 0) {
1322
1605
  const pageIndices = results.results.map((m) => m.pageIndex).filter((idx) => typeof idx === "number");
1323
1606
  const count = Math.max(...pageIndices) + 1;
1324
- _optionalChain([viewer, 'access', _100 => _100.search, 'optionalAccess', _101 => _101.stopSearch, 'optionalCall', _102 => _102()]);
1607
+ _optionalChain([viewer, 'access', _146 => _146.search, 'optionalAccess', _147 => _147.stopSearch, 'optionalCall', _148 => _148()]);
1325
1608
  setTotalPages(count);
1326
1609
  return;
1327
1610
  }
@@ -1347,7 +1630,7 @@ var PDFViewerContent = _react.forwardRef.call(void 0,
1347
1630
  } catch (error2) {
1348
1631
  }
1349
1632
  try {
1350
- const count = _optionalChain([viewer, 'access', _103 => _103.navigation, 'optionalAccess', _104 => _104.getTotalPages, 'optionalCall', _105 => _105()]);
1633
+ const count = _optionalChain([viewer, 'access', _149 => _149.navigation, 'optionalAccess', _150 => _150.getTotalPages, 'optionalCall', _151 => _151()]);
1351
1634
  if (count && count > 0) {
1352
1635
  setTotalPages(count);
1353
1636
  return;
@@ -1364,10 +1647,10 @@ var PDFViewerContent = _react.forwardRef.call(void 0,
1364
1647
  _react.useEffect.call(void 0, () => {
1365
1648
  if (state === "ready" && pdfViewerRef.current) {
1366
1649
  const updateInfo = () => {
1367
- const current = _optionalChain([pdfViewerRef, 'access', _106 => _106.current, 'optionalAccess', _107 => _107.navigation, 'access', _108 => _108.getCurrentPage, 'call', _109 => _109()]) || 1;
1368
- const total = _optionalChain([pdfViewerRef, 'access', _110 => _110.current, 'optionalAccess', _111 => _111.navigation, 'access', _112 => _112.getTotalPages, 'call', _113 => _113()]) || 0;
1369
- const zoomValue = _optionalChain([pdfViewerRef, 'access', _114 => _114.current, 'optionalAccess', _115 => _115.zoom, 'access', _116 => _116.getZoom, 'call', _117 => _117()]);
1370
- const currentSearchState = _optionalChain([pdfViewerRef, 'access', _118 => _118.current, 'optionalAccess', _119 => _119.search, 'access', _120 => _120.getSearchState, 'call', _121 => _121()]);
1650
+ const current = _optionalChain([pdfViewerRef, 'access', _152 => _152.current, 'optionalAccess', _153 => _153.navigation, 'access', _154 => _154.getCurrentPage, 'call', _155 => _155()]) || 1;
1651
+ const total = _optionalChain([pdfViewerRef, 'access', _156 => _156.current, 'optionalAccess', _157 => _157.navigation, 'access', _158 => _158.getTotalPages, 'call', _159 => _159()]) || 0;
1652
+ const zoomValue = _optionalChain([pdfViewerRef, 'access', _160 => _160.current, 'optionalAccess', _161 => _161.zoom, 'access', _162 => _162.getZoom, 'call', _163 => _163()]);
1653
+ const currentSearchState = _optionalChain([pdfViewerRef, 'access', _164 => _164.current, 'optionalAccess', _165 => _165.search, 'access', _166 => _166.getSearchState, 'call', _167 => _167()]);
1371
1654
  setCurrentPage(current);
1372
1655
  if (total > 0 && total !== totalPages) {
1373
1656
  setTotalPages(total);
@@ -1385,50 +1668,50 @@ var PDFViewerContent = _react.forwardRef.call(void 0,
1385
1668
  ref,
1386
1669
  () => ({
1387
1670
  zoomIn: () => {
1388
- _optionalChain([pdfViewerRef, 'access', _122 => _122.current, 'optionalAccess', _123 => _123.zoom, 'access', _124 => _124.zoomIn, 'call', _125 => _125()]);
1671
+ _optionalChain([pdfViewerRef, 'access', _168 => _168.current, 'optionalAccess', _169 => _169.zoom, 'access', _170 => _170.zoomIn, 'call', _171 => _171()]);
1389
1672
  updateZoomDisplay();
1390
1673
  },
1391
1674
  zoomOut: () => {
1392
- _optionalChain([pdfViewerRef, 'access', _126 => _126.current, 'optionalAccess', _127 => _127.zoom, 'access', _128 => _128.zoomOut, 'call', _129 => _129()]);
1675
+ _optionalChain([pdfViewerRef, 'access', _172 => _172.current, 'optionalAccess', _173 => _173.zoom, 'access', _174 => _174.zoomOut, 'call', _175 => _175()]);
1393
1676
  updateZoomDisplay();
1394
1677
  },
1395
1678
  setZoom: (level) => {
1396
- _optionalChain([pdfViewerRef, 'access', _130 => _130.current, 'optionalAccess', _131 => _131.zoom, 'access', _132 => _132.setZoom, 'call', _133 => _133(level)]);
1679
+ _optionalChain([pdfViewerRef, 'access', _176 => _176.current, 'optionalAccess', _177 => _177.zoom, 'access', _178 => _178.setZoom, 'call', _179 => _179(level)]);
1397
1680
  updateZoomDisplay();
1398
1681
  },
1399
1682
  resetZoom: () => {
1400
- _optionalChain([pdfViewerRef, 'access', _134 => _134.current, 'optionalAccess', _135 => _135.zoom, 'access', _136 => _136.resetZoom, 'call', _137 => _137()]);
1683
+ _optionalChain([pdfViewerRef, 'access', _180 => _180.current, 'optionalAccess', _181 => _181.zoom, 'access', _182 => _182.resetZoom, 'call', _183 => _183()]);
1401
1684
  updateZoomDisplay();
1402
1685
  },
1403
1686
  getZoom: () => {
1404
- const zoom2 = _optionalChain([pdfViewerRef, 'access', _138 => _138.current, 'optionalAccess', _139 => _139.zoom, 'access', _140 => _140.getZoom, 'call', _141 => _141()]);
1687
+ const zoom2 = _optionalChain([pdfViewerRef, 'access', _184 => _184.current, 'optionalAccess', _185 => _185.zoom, 'access', _186 => _186.getZoom, 'call', _187 => _187()]);
1405
1688
  return typeof zoom2 === "number" ? zoom2 : 1;
1406
1689
  },
1407
1690
  goToPage: (page) => {
1408
- _optionalChain([pdfViewerRef, 'access', _142 => _142.current, 'optionalAccess', _143 => _143.navigation, 'access', _144 => _144.goToPage, 'call', _145 => _145(page)]);
1691
+ _optionalChain([pdfViewerRef, 'access', _188 => _188.current, 'optionalAccess', _189 => _189.navigation, 'access', _190 => _190.goToPage, 'call', _191 => _191(page)]);
1409
1692
  setCurrentPage(page);
1410
1693
  },
1411
- getCurrentPage: () => _optionalChain([pdfViewerRef, 'access', _146 => _146.current, 'optionalAccess', _147 => _147.navigation, 'access', _148 => _148.getCurrentPage, 'call', _149 => _149()]) || 1,
1412
- getTotalPages: () => _optionalChain([pdfViewerRef, 'access', _150 => _150.current, 'optionalAccess', _151 => _151.navigation, 'access', _152 => _152.getTotalPages, 'call', _153 => _153()]) || 0,
1694
+ getCurrentPage: () => _optionalChain([pdfViewerRef, 'access', _192 => _192.current, 'optionalAccess', _193 => _193.navigation, 'access', _194 => _194.getCurrentPage, 'call', _195 => _195()]) || 1,
1695
+ getTotalPages: () => _optionalChain([pdfViewerRef, 'access', _196 => _196.current, 'optionalAccess', _197 => _197.navigation, 'access', _198 => _198.getTotalPages, 'call', _199 => _199()]) || 0,
1413
1696
  nextPage: () => {
1414
- _optionalChain([pdfViewerRef, 'access', _154 => _154.current, 'optionalAccess', _155 => _155.navigation, 'access', _156 => _156.nextPage, 'call', _157 => _157()]);
1697
+ _optionalChain([pdfViewerRef, 'access', _200 => _200.current, 'optionalAccess', _201 => _201.navigation, 'access', _202 => _202.nextPage, 'call', _203 => _203()]);
1415
1698
  updatePageDisplay();
1416
1699
  },
1417
1700
  previousPage: () => {
1418
- _optionalChain([pdfViewerRef, 'access', _158 => _158.current, 'optionalAccess', _159 => _159.navigation, 'access', _160 => _160.previousPage, 'call', _161 => _161()]);
1701
+ _optionalChain([pdfViewerRef, 'access', _204 => _204.current, 'optionalAccess', _205 => _205.navigation, 'access', _206 => _206.previousPage, 'call', _207 => _207()]);
1419
1702
  updatePageDisplay();
1420
1703
  },
1421
1704
  goToFirstPage: () => {
1422
- _optionalChain([pdfViewerRef, 'access', _162 => _162.current, 'optionalAccess', _163 => _163.navigation, 'access', _164 => _164.goToFirstPage, 'call', _165 => _165()]);
1705
+ _optionalChain([pdfViewerRef, 'access', _208 => _208.current, 'optionalAccess', _209 => _209.navigation, 'access', _210 => _210.goToFirstPage, 'call', _211 => _211()]);
1423
1706
  updatePageDisplay();
1424
1707
  },
1425
1708
  goToLastPage: () => {
1426
- _optionalChain([pdfViewerRef, 'access', _166 => _166.current, 'optionalAccess', _167 => _167.navigation, 'access', _168 => _168.goToLastPage, 'call', _169 => _169()]);
1709
+ _optionalChain([pdfViewerRef, 'access', _212 => _212.current, 'optionalAccess', _213 => _213.navigation, 'access', _214 => _214.goToLastPage, 'call', _215 => _215()]);
1427
1710
  updatePageDisplay();
1428
1711
  },
1429
1712
  searchText: async (keyword) => {
1430
1713
  setIsSearching(true);
1431
- const results = await _optionalChain([pdfViewerRef, 'access', _170 => _170.current, 'optionalAccess', _171 => _171.search, 'access', _172 => _172.searchText, 'call', _173 => _173(
1714
+ const results = await _optionalChain([pdfViewerRef, 'access', _216 => _216.current, 'optionalAccess', _217 => _217.search, 'access', _218 => _218.searchText, 'call', _219 => _219(
1432
1715
  keyword
1433
1716
  )]);
1434
1717
  setIsSearching(false);
@@ -1436,36 +1719,49 @@ var PDFViewerContent = _react.forwardRef.call(void 0,
1436
1719
  return results;
1437
1720
  },
1438
1721
  nextResult: () => {
1439
- const index = _optionalChain([pdfViewerRef, 'access', _174 => _174.current, 'optionalAccess', _175 => _175.search, 'access', _176 => _176.nextResult, 'call', _177 => _177()]) || -1;
1722
+ const index = _optionalChain([pdfViewerRef, 'access', _220 => _220.current, 'optionalAccess', _221 => _221.search, 'access', _222 => _222.nextResult, 'call', _223 => _223()]) || -1;
1440
1723
  return index;
1441
1724
  },
1442
1725
  previousResult: () => {
1443
- const index = _optionalChain([pdfViewerRef, 'access', _178 => _178.current, 'optionalAccess', _179 => _179.search, 'access', _180 => _180.previousResult, 'call', _181 => _181()]) || -1;
1726
+ const index = _optionalChain([pdfViewerRef, 'access', _224 => _224.current, 'optionalAccess', _225 => _225.search, 'access', _226 => _226.previousResult, 'call', _227 => _227()]) || -1;
1444
1727
  return index;
1445
1728
  },
1446
- goToResult: (index) => _optionalChain([pdfViewerRef, 'access', _182 => _182.current, 'optionalAccess', _183 => _183.search, 'access', _184 => _184.goToResult, 'call', _185 => _185(index)]) || -1,
1729
+ goToResult: (index) => _optionalChain([pdfViewerRef, 'access', _228 => _228.current, 'optionalAccess', _229 => _229.search, 'access', _230 => _230.goToResult, 'call', _231 => _231(index)]) || -1,
1447
1730
  stopSearch: () => {
1448
- _optionalChain([pdfViewerRef, 'access', _186 => _186.current, 'optionalAccess', _187 => _187.search, 'access', _188 => _188.stopSearch, 'call', _189 => _189()]);
1731
+ _optionalChain([pdfViewerRef, 'access', _232 => _232.current, 'optionalAccess', _233 => _233.search, 'access', _234 => _234.stopSearch, 'call', _235 => _235()]);
1449
1732
  setSearchQuery("");
1450
1733
  },
1451
- getSearchState: () => _optionalChain([pdfViewerRef, 'access', _190 => _190.current, 'optionalAccess', _191 => _191.search, 'access', _192 => _192.getSearchState, 'call', _193 => _193()]) || null,
1452
- getSelectedText: () => _optionalChain([pdfViewerRef, 'access', _194 => _194.current, 'optionalAccess', _195 => _195.selection, 'access', _196 => _196.getSelectedText, 'call', _197 => _197()]) || "",
1453
- clearSelection: () => _optionalChain([pdfViewerRef, 'access', _198 => _198.current, 'optionalAccess', _199 => _199.selection, 'access', _200 => _200.clearSelection, 'call', _201 => _201()]),
1454
- rotateForward: () => _optionalChain([pdfViewerRef, 'access', _202 => _202.current, 'optionalAccess', _203 => _203.rotate, 'optionalAccess', _204 => _204.rotateForward, 'call', _205 => _205()]),
1455
- rotateBackward: () => _optionalChain([pdfViewerRef, 'access', _206 => _206.current, 'optionalAccess', _207 => _207.rotate, 'optionalAccess', _208 => _208.rotateBackward, 'call', _209 => _209()]),
1456
- getRotation: () => _optionalChain([pdfViewerRef, 'access', _210 => _210.current, 'optionalAccess', _211 => _211.rotate, 'optionalAccess', _212 => _212.getRotation, 'call', _213 => _213()]) || 0
1734
+ getSearchState: () => _optionalChain([pdfViewerRef, 'access', _236 => _236.current, 'optionalAccess', _237 => _237.search, 'access', _238 => _238.getSearchState, 'call', _239 => _239()]) || null,
1735
+ getSelectedText: () => _optionalChain([pdfViewerRef, 'access', _240 => _240.current, 'optionalAccess', _241 => _241.selection, 'access', _242 => _242.getSelectedText, 'call', _243 => _243()]) || "",
1736
+ clearSelection: () => _optionalChain([pdfViewerRef, 'access', _244 => _244.current, 'optionalAccess', _245 => _245.selection, 'access', _246 => _246.clearSelection, 'call', _247 => _247()]),
1737
+ rotateForward: () => _optionalChain([pdfViewerRef, 'access', _248 => _248.current, 'optionalAccess', _249 => _249.rotate, 'optionalAccess', _250 => _250.rotateForward, 'call', _251 => _251()]),
1738
+ rotateBackward: () => _optionalChain([pdfViewerRef, 'access', _252 => _252.current, 'optionalAccess', _253 => _253.rotate, 'optionalAccess', _254 => _254.rotateBackward, 'call', _255 => _255()]),
1739
+ getRotation: () => _optionalChain([pdfViewerRef, 'access', _256 => _256.current, 'optionalAccess', _257 => _257.rotate, 'optionalAccess', _258 => _258.getRotation, 'call', _259 => _259()]) || 0,
1740
+ print: () => _optionalChain([pdfViewerRef, 'access', _260 => _260.current, 'optionalAccess', _261 => _261.print, 'optionalAccess', _262 => _262.print, 'call', _263 => _263()]),
1741
+ printWithAnnotations: async () => {
1742
+ await _optionalChain([pdfViewerRef, 'access', _264 => _264.current, 'optionalAccess', _265 => _265.print, 'optionalAccess', _266 => _266.printWithAnnotations, 'optionalCall', _267 => _267()]);
1743
+ },
1744
+ printWithoutAnnotations: async () => {
1745
+ await _optionalChain([pdfViewerRef, 'access', _268 => _268.current, 'optionalAccess', _269 => _269.print, 'optionalAccess', _270 => _270.printWithoutAnnotations, 'optionalCall', _271 => _271()]);
1746
+ },
1747
+ get annotation() {
1748
+ return _optionalChain([pdfViewerRef, 'access', _272 => _272.current, 'optionalAccess', _273 => _273.annotation]);
1749
+ },
1750
+ get download() {
1751
+ return _optionalChain([pdfViewerRef, 'access', _274 => _274.current, 'optionalAccess', _275 => _275.download]);
1752
+ }
1457
1753
  }),
1458
1754
  []
1459
1755
  );
1460
1756
  const updatePageDisplay = () => {
1461
1757
  requestAnimationFrame(() => {
1462
- const current = _optionalChain([pdfViewerRef, 'access', _214 => _214.current, 'optionalAccess', _215 => _215.navigation, 'access', _216 => _216.getCurrentPage, 'call', _217 => _217()]) || 1;
1758
+ const current = _optionalChain([pdfViewerRef, 'access', _276 => _276.current, 'optionalAccess', _277 => _277.navigation, 'access', _278 => _278.getCurrentPage, 'call', _279 => _279()]) || 1;
1463
1759
  setCurrentPage(current);
1464
1760
  });
1465
1761
  };
1466
1762
  const updateZoomDisplay = () => {
1467
1763
  requestAnimationFrame(() => {
1468
- const zoomValue = _optionalChain([pdfViewerRef, 'access', _218 => _218.current, 'optionalAccess', _219 => _219.zoom, 'access', _220 => _220.getZoom, 'call', _221 => _221()]);
1764
+ const zoomValue = _optionalChain([pdfViewerRef, 'access', _280 => _280.current, 'optionalAccess', _281 => _281.zoom, 'access', _282 => _282.getZoom, 'call', _283 => _283()]);
1469
1765
  if (typeof zoomValue === "number") {
1470
1766
  setZoom(Math.round(zoomValue * 100));
1471
1767
  }
@@ -1474,11 +1770,11 @@ var PDFViewerContent = _react.forwardRef.call(void 0,
1474
1770
  const handleSearch = async () => {
1475
1771
  if (!searchQuery.trim()) return;
1476
1772
  setIsSearching(true);
1477
- const results = await _optionalChain([pdfViewerRef, 'access', _222 => _222.current, 'optionalAccess', _223 => _223.search, 'access', _224 => _224.searchText, 'call', _225 => _225(
1773
+ const results = await _optionalChain([pdfViewerRef, 'access', _284 => _284.current, 'optionalAccess', _285 => _285.search, 'access', _286 => _286.searchText, 'call', _287 => _287(
1478
1774
  searchQuery
1479
1775
  )]);
1480
1776
  setIsSearching(false);
1481
- if (_optionalChain([results, 'optionalAccess', _226 => _226.results]) && Array.isArray(results.results) && results.results.length > 0) {
1777
+ if (_optionalChain([results, 'optionalAccess', _288 => _288.results]) && Array.isArray(results.results) && results.results.length > 0) {
1482
1778
  const formattedResults = formatSearchResults(results.results);
1483
1779
  updateSearchState(formattedResults);
1484
1780
  } else {
@@ -1496,10 +1792,10 @@ var PDFViewerContent = _react.forwardRef.call(void 0,
1496
1792
  setSearchResults([]);
1497
1793
  setTotalSearchResults(0);
1498
1794
  setCurrentSearchResultIndex(0);
1499
- _optionalChain([pdfViewerRef, 'access', _227 => _227.current, 'optionalAccess', _228 => _228.search, 'access', _229 => _229.stopSearch, 'call', _230 => _230()]);
1795
+ _optionalChain([pdfViewerRef, 'access', _289 => _289.current, 'optionalAccess', _290 => _290.search, 'access', _291 => _291.stopSearch, 'call', _292 => _292()]);
1500
1796
  return;
1501
1797
  }
1502
- if (!_optionalChain([pdfViewerRef, 'access', _231 => _231.current, 'optionalAccess', _232 => _232.search, 'optionalAccess', _233 => _233.searchText])) {
1798
+ if (!_optionalChain([pdfViewerRef, 'access', _293 => _293.current, 'optionalAccess', _294 => _294.search, 'optionalAccess', _295 => _295.searchText])) {
1503
1799
  console.warn("Search functionality not yet available");
1504
1800
  return;
1505
1801
  }
@@ -1508,7 +1804,7 @@ var PDFViewerContent = _react.forwardRef.call(void 0,
1508
1804
  const results = await pdfViewerRef.current.search.searchText(keyword);
1509
1805
  console.log("Search completed:", results);
1510
1806
  setIsSearching(false);
1511
- const hasValidResults = _optionalChain([results, 'optionalAccess', _234 => _234.results]) && Array.isArray(results.results) && results.results.length > 0;
1807
+ const hasValidResults = _optionalChain([results, 'optionalAccess', _296 => _296.results]) && Array.isArray(results.results) && results.results.length > 0;
1512
1808
  if (hasValidResults) {
1513
1809
  const formattedResults = formatSearchResults(results.results);
1514
1810
  updateSearchState(formattedResults);
@@ -1574,24 +1870,24 @@ var PDFViewerContent = _react.forwardRef.call(void 0,
1574
1870
  };
1575
1871
  const navigateToPage = (pageNumber) => {
1576
1872
  requestAnimationFrame(() => {
1577
- _optionalChain([pdfViewerRef, 'access', _235 => _235.current, 'optionalAccess', _236 => _236.navigation, 'access', _237 => _237.goToPage, 'call', _238 => _238(pageNumber)]);
1873
+ _optionalChain([pdfViewerRef, 'access', _297 => _297.current, 'optionalAccess', _298 => _298.navigation, 'access', _299 => _299.goToPage, 'call', _300 => _300(pageNumber)]);
1578
1874
  setCurrentPage(pageNumber);
1579
1875
  });
1580
1876
  };
1581
1877
  const handleSearchResultClick = (pageNumber, resultIndex) => {
1582
- _optionalChain([pdfViewerRef, 'access', _239 => _239.current, 'optionalAccess', _240 => _240.navigation, 'access', _241 => _241.goToPage, 'call', _242 => _242(pageNumber)]);
1878
+ _optionalChain([pdfViewerRef, 'access', _301 => _301.current, 'optionalAccess', _302 => _302.navigation, 'access', _303 => _303.goToPage, 'call', _304 => _304(pageNumber)]);
1583
1879
  setCurrentSearchResultIndex(resultIndex);
1584
1880
  setCurrentPage(pageNumber);
1585
- _optionalChain([pdfViewerRef, 'access', _243 => _243.current, 'optionalAccess', _244 => _244.search, 'access', _245 => _245.goToResult, 'call', _246 => _246(resultIndex)]);
1881
+ _optionalChain([pdfViewerRef, 'access', _305 => _305.current, 'optionalAccess', _306 => _306.search, 'access', _307 => _307.goToResult, 'call', _308 => _308(resultIndex)]);
1586
1882
  };
1587
1883
  const handleNextSearchResult = () => {
1588
1884
  if (currentSearchResultIndex < totalSearchResults - 1) {
1589
1885
  const nextIndex = currentSearchResultIndex + 1;
1590
1886
  setCurrentSearchResultIndex(nextIndex);
1591
- _optionalChain([pdfViewerRef, 'access', _247 => _247.current, 'optionalAccess', _248 => _248.search, 'access', _249 => _249.nextResult, 'call', _250 => _250()]);
1887
+ _optionalChain([pdfViewerRef, 'access', _309 => _309.current, 'optionalAccess', _310 => _310.search, 'access', _311 => _311.nextResult, 'call', _312 => _312()]);
1592
1888
  if (searchResults[nextIndex]) {
1593
1889
  const pageNumber = searchResults[nextIndex].pageNumber;
1594
- _optionalChain([pdfViewerRef, 'access', _251 => _251.current, 'optionalAccess', _252 => _252.navigation, 'access', _253 => _253.goToPage, 'call', _254 => _254(pageNumber)]);
1890
+ _optionalChain([pdfViewerRef, 'access', _313 => _313.current, 'optionalAccess', _314 => _314.navigation, 'access', _315 => _315.goToPage, 'call', _316 => _316(pageNumber)]);
1595
1891
  setCurrentPage(pageNumber);
1596
1892
  }
1597
1893
  }
@@ -1600,10 +1896,10 @@ var PDFViewerContent = _react.forwardRef.call(void 0,
1600
1896
  if (currentSearchResultIndex > 0) {
1601
1897
  const prevIndex = currentSearchResultIndex - 1;
1602
1898
  setCurrentSearchResultIndex(prevIndex);
1603
- _optionalChain([pdfViewerRef, 'access', _255 => _255.current, 'optionalAccess', _256 => _256.search, 'access', _257 => _257.previousResult, 'call', _258 => _258()]);
1899
+ _optionalChain([pdfViewerRef, 'access', _317 => _317.current, 'optionalAccess', _318 => _318.search, 'access', _319 => _319.previousResult, 'call', _320 => _320()]);
1604
1900
  if (searchResults[prevIndex]) {
1605
1901
  const pageNumber = searchResults[prevIndex].pageNumber;
1606
- _optionalChain([pdfViewerRef, 'access', _259 => _259.current, 'optionalAccess', _260 => _260.navigation, 'access', _261 => _261.goToPage, 'call', _262 => _262(pageNumber)]);
1902
+ _optionalChain([pdfViewerRef, 'access', _321 => _321.current, 'optionalAccess', _322 => _322.navigation, 'access', _323 => _323.goToPage, 'call', _324 => _324(pageNumber)]);
1607
1903
  setCurrentPage(pageNumber);
1608
1904
  }
1609
1905
  }
@@ -1634,21 +1930,25 @@ var PDFViewerContent = _react.forwardRef.call(void 0,
1634
1930
  }
1635
1931
  setPdfBuffer(arrayBuffer);
1636
1932
  setState("ready");
1637
- _optionalChain([onLoad, 'optionalCall', _263 => _263()]);
1933
+ _optionalChain([onLoad, 'optionalCall', _325 => _325()]);
1638
1934
  } catch (err) {
1639
1935
  const errorMessage = err.message || "Failed to load PDF";
1640
1936
  setState("error");
1641
1937
  setError(errorMessage);
1642
- _optionalChain([onError, 'optionalCall', _264 => _264(err)]);
1938
+ _optionalChain([onError, 'optionalCall', _326 => _326(err)]);
1643
1939
  }
1644
1940
  };
1645
1941
  loadPDF();
1646
1942
  }, [file, onLoad, onError]);
1647
1943
  const handlePasswordRequest = _react.useCallback.call(void 0,
1648
- async (fileName2) => {
1944
+ async (fileName2, isRetry) => {
1649
1945
  return new Promise((resolve) => {
1650
1946
  setPasswordResolve(() => resolve);
1651
- setPasswordError("");
1947
+ if (isRetry) {
1948
+ setPasswordError("Incorrect password. Please try again.");
1949
+ } else {
1950
+ setPasswordError("");
1951
+ }
1652
1952
  setIsPasswordDialogOpen(true);
1653
1953
  });
1654
1954
  },
@@ -1658,10 +1958,10 @@ var PDFViewerContent = _react.forwardRef.call(void 0,
1658
1958
  (password) => {
1659
1959
  if (passwordResolve) {
1660
1960
  passwordResolve(password);
1661
- setPasswordResolve(null);
1662
- setIsPasswordDialogOpen(false);
1663
- setPasswordError("");
1664
1961
  }
1962
+ setIsPasswordDialogOpen(false);
1963
+ setPasswordResolve(null);
1964
+ setPasswordError("");
1665
1965
  },
1666
1966
  [passwordResolve]
1667
1967
  );
@@ -1757,7 +2057,7 @@ var PDFViewerContent = _react.forwardRef.call(void 0,
1757
2057
  );
1758
2058
  }
1759
2059
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { ref: containerRef, className: "pdf-viewer-container", children: [
1760
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "style", { children: _chunkGMD6QQLGjs.toolbarStyles }),
2060
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "style", { children: _chunk5ECHDPQZjs.toolbarStyles }),
1761
2061
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PDFHeader, { fileName: resolvedFileName, fileExtension }),
1762
2062
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1763
2063
  PDFToolbar,
@@ -1778,7 +2078,7 @@ var PDFViewerContent = _react.forwardRef.call(void 0,
1778
2078
  showTags: !toolbar.isHidden("tags"),
1779
2079
  showHistory: !toolbar.isHidden("history"),
1780
2080
  disabledRotateLeft: toolbar.isDisabled("rotateLeft"),
1781
- disabledRotateRight: toolbar.isDisabled("rotateRight"),
2081
+ disabledRotateRight: false,
1782
2082
  disabledMetadata: toolbar.isDisabled("metadata"),
1783
2083
  disabledTags: toolbar.isDisabled("tags"),
1784
2084
  disabledProperties: toolbar.isDisabled("properties"),
@@ -1800,14 +2100,29 @@ var PDFViewerContent = _react.forwardRef.call(void 0,
1800
2100
  onRotateLeft: toolbarHandlers.handleRotateLeft,
1801
2101
  onRotateRight: toolbarHandlers.handleRotateRight,
1802
2102
  onDownloadClick: toolbar.getHandler("download", onDownloadClick),
1803
- onPrintClick: toolbar.getHandler("print", onPrintClick),
2103
+ onPrintClick: toolbar.getHandler("print", onPrintClick || toolbarHandlers.handlePrint),
2104
+ onPrintWithAnnotations: toolbarHandlers.handlePrintWithAnnotations,
2105
+ onPrintWithoutAnnotations: toolbarHandlers.handlePrintWithoutAnnotations,
1804
2106
  onMetadataClick: toolbar.getHandler("metadata", onMetadataClick),
1805
2107
  onPropertiesClick: toolbar.getHandler(
1806
2108
  "properties",
1807
2109
  onPropertiesClick
1808
2110
  ),
1809
2111
  onTagsClick: toolbar.getHandler("tags", onTagsClick),
1810
- onHistoryClick: toolbar.getHandler("history", onHistoryClick)
2112
+ onHistoryClick: toolbar.getHandler("history", onHistoryClick),
2113
+ showAnnotations,
2114
+ isHighlighterActive: highlighterActive,
2115
+ isStampActive: stampActive,
2116
+ disabledHighlighter: toolbar.isDisabled("highlighter"),
2117
+ disabledStamp: toolbar.isDisabled("stamp"),
2118
+ disabledSignature: toolbar.isDisabled("signature"),
2119
+ onHighlighterClick: toolbar.getHandler("highlighter", onHighlighterClick || toolbarHandlers.handleHighlighterClick),
2120
+ onStampClick: toolbar.getHandler("stamp", onStampClick || toolbarHandlers.handleStampClick),
2121
+ onSignatureClick: toolbar.getHandler("signature", onSignatureClick || toolbarHandlers.handleSignatureClick),
2122
+ hasUnsavedAnnotations,
2123
+ isSavingAnnotations,
2124
+ canSaveAnnotations,
2125
+ onSaveAnnotations
1811
2126
  }
1812
2127
  ),
1813
2128
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "pdf-viewer-main", children: [
@@ -1816,7 +2131,16 @@ var PDFViewerContent = _react.forwardRef.call(void 0,
1816
2131
  {
1817
2132
  pdfBuffer,
1818
2133
  onPasswordRequest: handlePasswordRequest,
1819
- pdfViewerRef
2134
+ pdfViewerRef,
2135
+ showAnnotations,
2136
+ userDetails,
2137
+ annotationSelectionMenu,
2138
+ isHighlighterActive: highlighterActive,
2139
+ isStampActive: stampActive,
2140
+ onHighlighterClick: onHighlighterClick || toolbarHandlers.handleHighlighterClick,
2141
+ onStampClick: onStampClick || toolbarHandlers.handleStampClick,
2142
+ onSignatureClick: onSignatureClick || toolbarHandlers.handleSignatureClick,
2143
+ permissions: props.permissions
1820
2144
  }
1821
2145
  ) }),
1822
2146
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
@@ -1843,7 +2167,8 @@ var PDFViewerContent = _react.forwardRef.call(void 0,
1843
2167
  fileName: resolvedFileName,
1844
2168
  onSubmit: handlePasswordSubmit,
1845
2169
  onCancel: handlePasswordCancel,
1846
- error: passwordError
2170
+ error: passwordError,
2171
+ isLoading: isVerifyingPassword
1847
2172
  }
1848
2173
  )
1849
2174
  ] });
@@ -1860,4 +2185,4 @@ PDFViewer.displayName = "PDFViewer";
1860
2185
 
1861
2186
 
1862
2187
  exports.PDFViewer = PDFViewer;
1863
- //# sourceMappingURL=chunk-RTQRDZSN.js.map
2188
+ //# sourceMappingURL=chunk-26SS5FLZ.js.map