@cannyminds/dms-file-viewers 0.21.0 → 0.23.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 (31) hide show
  1. package/dist/{chunk-26SS5FLZ.js → chunk-4JX2MJLJ.js} +458 -387
  2. package/dist/chunk-4JX2MJLJ.js.map +1 -0
  3. package/dist/{chunk-IY5EEUCU.mjs → chunk-PCLERVB7.mjs} +375 -304
  4. package/dist/chunk-PCLERVB7.mjs.map +1 -0
  5. package/dist/components/viewers/AudioViewer.d.mts +1 -1
  6. package/dist/components/viewers/AudioViewer.d.ts +1 -1
  7. package/dist/components/viewers/DefaultViewer.d.mts +1 -1
  8. package/dist/components/viewers/DefaultViewer.d.ts +1 -1
  9. package/dist/components/viewers/ImageViewer.d.mts +1 -1
  10. package/dist/components/viewers/ImageViewer.d.ts +1 -1
  11. package/dist/components/viewers/PDFViewer.d.mts +5 -2
  12. package/dist/components/viewers/PDFViewer.d.ts +5 -2
  13. package/dist/components/viewers/PDFViewer.js +2 -2
  14. package/dist/components/viewers/PDFViewer.mjs +1 -1
  15. package/dist/components/viewers/TIFFViewer.d.mts +1 -1
  16. package/dist/components/viewers/TIFFViewer.d.ts +1 -1
  17. package/dist/components/viewers/TextViewer.d.mts +1 -1
  18. package/dist/components/viewers/TextViewer.d.ts +1 -1
  19. package/dist/components/viewers/VideoViewer.d.mts +1 -1
  20. package/dist/components/viewers/VideoViewer.d.ts +1 -1
  21. package/dist/index.d.mts +2 -2
  22. package/dist/index.d.ts +2 -2
  23. package/dist/index.js +19 -24
  24. package/dist/index.js.map +1 -1
  25. package/dist/index.mjs +18 -23
  26. package/dist/index.mjs.map +1 -1
  27. package/dist/{types-DFkMK86Q.d.mts → types-BnnKCdrQ.d.mts} +2 -0
  28. package/dist/{types-DFkMK86Q.d.ts → types-BnnKCdrQ.d.ts} +2 -0
  29. package/package.json +1 -1
  30. package/dist/chunk-26SS5FLZ.js.map +0 -1
  31. package/dist/chunk-IY5EEUCU.mjs.map +0 -1
@@ -38,7 +38,8 @@ var StablePDFViewer = _react2.default.memo(({
38
38
  onHighlighterClick,
39
39
  onStampClick,
40
40
  onSignatureClick,
41
- permissions
41
+ permissions,
42
+ hideInternalLoading
42
43
  }) => {
43
44
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
44
45
  HeadlessPDFViewer,
@@ -54,7 +55,8 @@ var StablePDFViewer = _react2.default.memo(({
54
55
  onHighlighterClick,
55
56
  onStampClick,
56
57
  onSignatureClick,
57
- permissions
58
+ permissions,
59
+ hideInternalLoading
58
60
  }
59
61
  );
60
62
  });
@@ -108,6 +110,13 @@ var PDFToolbar = _react2.default.memo(
108
110
  showPrint,
109
111
  showRotation,
110
112
  showAnnotations,
113
+ // Destructure new props with defaults
114
+ showAnnotate = true,
115
+ disabledAnnotate = false,
116
+ showPrintOriginal = true,
117
+ showPrintWithAnnotations = true,
118
+ showDownloadOriginal = true,
119
+ showDownloadWithAnnotations = true,
111
120
  isHighlighterActive,
112
121
  isStampActive,
113
122
  disabledRotateLeft,
@@ -118,6 +127,7 @@ var PDFToolbar = _react2.default.memo(
118
127
  disabledHistory,
119
128
  disabledDownload,
120
129
  disabledPrint,
130
+ disabledCopy,
121
131
  disabledHighlighter,
122
132
  disabledStamp,
123
133
  disabledSignature,
@@ -136,9 +146,12 @@ var PDFToolbar = _react2.default.memo(
136
146
  onRotateLeft,
137
147
  onRotateRight,
138
148
  onDownloadClick,
149
+ onDownloadWithAnnotations,
150
+ onDownloadWithoutAnnotations,
139
151
  onPrintClick,
140
152
  onPrintWithAnnotations,
141
153
  onPrintWithoutAnnotations,
154
+ onCopyClick,
142
155
  onMetadataClick,
143
156
  onPropertiesClick,
144
157
  onTagsClick,
@@ -153,9 +166,11 @@ var PDFToolbar = _react2.default.memo(
153
166
  onSaveAnnotations
154
167
  }) => {
155
168
  const [isPrintMenuOpen, setIsPrintMenuOpen] = _react.useState.call(void 0, false);
169
+ const [isDownloadMenuOpen, setIsDownloadMenuOpen] = _react.useState.call(void 0, false);
156
170
  const [isAnnotationMenuOpen, setIsAnnotationMenuOpen] = _react.useState.call(void 0, false);
157
171
  const [isViewMenuOpen, setIsViewMenuOpen] = _react.useState.call(void 0, false);
158
172
  const printMenuRef = _react.useRef.call(void 0, null);
173
+ const downloadMenuRef = _react.useRef.call(void 0, null);
159
174
  const annotationMenuRef = _react.useRef.call(void 0, null);
160
175
  const viewMenuRef = _react.useRef.call(void 0, null);
161
176
  _react.useEffect.call(void 0, () => {
@@ -163,6 +178,9 @@ var PDFToolbar = _react2.default.memo(
163
178
  if (printMenuRef.current && !printMenuRef.current.contains(event.target)) {
164
179
  setIsPrintMenuOpen(false);
165
180
  }
181
+ if (downloadMenuRef.current && !downloadMenuRef.current.contains(event.target)) {
182
+ setIsDownloadMenuOpen(false);
183
+ }
166
184
  if (annotationMenuRef.current && !annotationMenuRef.current.contains(event.target)) {
167
185
  setIsAnnotationMenuOpen(false);
168
186
  }
@@ -181,12 +199,20 @@ var PDFToolbar = _react2.default.memo(
181
199
  setIsPrintMenuOpen(false);
182
200
  _optionalChain([onPrintWithoutAnnotations, 'optionalCall', _2 => _2()]);
183
201
  };
202
+ const handleDownloadWithAnnotations = () => {
203
+ setIsDownloadMenuOpen(false);
204
+ _optionalChain([onDownloadWithAnnotations, 'optionalCall', _3 => _3()]);
205
+ };
206
+ const handleDownloadWithoutAnnotations = () => {
207
+ setIsDownloadMenuOpen(false);
208
+ _optionalChain([onDownloadWithoutAnnotations, 'optionalCall', _4 => _4()]);
209
+ };
184
210
  const [activeMode, setActiveMode] = _react.useState.call(void 0, "view");
185
211
  return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "pdf-viewer-toolbar-container", children: [
186
212
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "pdf-viewer-toolbar", children: [
187
213
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "toolbar-left", children: [
188
214
  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,
215
+ /* @__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,
190
216
  "button",
191
217
  {
192
218
  className: "toolbar-button",
@@ -194,8 +220,8 @@ var PDFToolbar = _react2.default.memo(
194
220
  disabled: currentPage <= 1,
195
221
  children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _FirstPage2.default, { fontSize: "small" })
196
222
  }
197
- ) }),
198
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Tooltip, { title: "Previous Page", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
223
+ ) }) }),
224
+ /* @__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,
199
225
  "button",
200
226
  {
201
227
  className: "toolbar-button",
@@ -203,24 +229,16 @@ var PDFToolbar = _react2.default.memo(
203
229
  disabled: currentPage <= 1,
204
230
  children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _ChevronLeft2.default, { fontSize: "small" })
205
231
  }
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 || "..."
232
+ ) }) }),
233
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { className: "page-info", style: { display: "flex", alignItems: "center", margin: "0 8px", fontSize: "14px", fontWeight: 500 }, children: [
234
+ currentPage,
235
+ " ",
236
+ showPageCount && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "span", { style: { color: "#6b7280", marginLeft: "4px" }, children: [
237
+ "/ ",
238
+ totalPages || "..."
239
+ ] })
222
240
  ] }),
223
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Tooltip, { title: "Next Page", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
241
+ /* @__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,
224
242
  "button",
225
243
  {
226
244
  className: "toolbar-button",
@@ -228,8 +246,8 @@ var PDFToolbar = _react2.default.memo(
228
246
  disabled: currentPage >= totalPages,
229
247
  children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _ChevronRight2.default, { fontSize: "small" })
230
248
  }
231
- ) }),
232
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Tooltip, { title: "Last Page", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
249
+ ) }) }),
250
+ /* @__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,
233
251
  "button",
234
252
  {
235
253
  className: "toolbar-button",
@@ -237,7 +255,7 @@ var PDFToolbar = _react2.default.memo(
237
255
  disabled: currentPage >= totalPages,
238
256
  children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _LastPage2.default, { fontSize: "small" })
239
257
  }
240
- ) })
258
+ ) }) })
241
259
  ] }),
242
260
  showZoomControls && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
243
261
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "toolbar-separator" }),
@@ -293,14 +311,14 @@ var PDFToolbar = _react2.default.memo(
293
311
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "toolbar-dropdown-divider" }),
294
312
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "button", { className: "toolbar-dropdown-item", onClick: () => {
295
313
  setIsViewMenuOpen(false);
296
- _optionalChain([onFitToWidth, 'optionalCall', _3 => _3()]);
314
+ _optionalChain([onFitToWidth, 'optionalCall', _5 => _5()]);
297
315
  }, children: [
298
316
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _AspectRatio2.default, { fontSize: "small" }),
299
317
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Fit to Width" })
300
318
  ] }),
301
319
  /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "button", { className: "toolbar-dropdown-item", onClick: () => {
302
320
  setIsViewMenuOpen(false);
303
- _optionalChain([onFitToPage, 'optionalCall', _4 => _4()]);
321
+ _optionalChain([onFitToPage, 'optionalCall', _6 => _6()]);
304
322
  }, children: [
305
323
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _FitScreen2.default, { fontSize: "small" }),
306
324
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Fit to Page" })
@@ -314,7 +332,7 @@ var PDFToolbar = _react2.default.memo(
314
332
  className: "toolbar-dropdown-item",
315
333
  onClick: () => {
316
334
  setIsViewMenuOpen(false);
317
- _optionalChain([onRotateRight, 'optionalCall', _5 => _5()]);
335
+ _optionalChain([onRotateRight, 'optionalCall', _7 => _7()]);
318
336
  },
319
337
  disabled: false,
320
338
  children: [
@@ -329,7 +347,7 @@ var PDFToolbar = _react2.default.memo(
329
347
  className: "toolbar-dropdown-item",
330
348
  onClick: () => {
331
349
  setIsViewMenuOpen(false);
332
- _optionalChain([onRotateLeft, 'optionalCall', _6 => _6()]);
350
+ _optionalChain([onRotateLeft, 'optionalCall', _8 => _8()]);
333
351
  },
334
352
  disabled: disabledRotateLeft,
335
353
  children: [
@@ -378,12 +396,16 @@ var PDFToolbar = _react2.default.memo(
378
396
  children: "View"
379
397
  }
380
398
  ),
381
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
399
+ showAnnotate && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
382
400
  "button",
383
401
  {
384
402
  className: `toolbar-tab ${activeMode === "annotate" ? "toolbar-tab-active" : ""}`,
385
- onClick: () => setActiveMode("annotate"),
386
- style: { position: "relative" },
403
+ onClick: () => !disabledAnnotate && setActiveMode("annotate"),
404
+ style: {
405
+ position: "relative",
406
+ opacity: disabledAnnotate ? 0.5 : 1,
407
+ cursor: disabledAnnotate ? "not-allowed" : "pointer"
408
+ },
387
409
  children: [
388
410
  "Annotate",
389
411
  hasUnsavedAnnotations && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { style: {
@@ -402,47 +424,99 @@ var PDFToolbar = _react2.default.memo(
402
424
  /* @__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
425
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "toolbar-separator" }),
404
426
  /* @__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,
427
+ showDownload && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "toolbar-dropdown-container", ref: downloadMenuRef, children: showDownloadOriginal && showDownloadWithAnnotations ? (
428
+ // RENDER DROPDOWN if BOTH are enabled
429
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
430
+ /* @__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,
428
431
  "button",
429
432
  {
430
- className: "toolbar-dropdown-item",
431
- onClick: handlePrintWithoutAnnotations,
432
- children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Print Document Only" })
433
+ className: `toolbar-button toolbar-dropdown-button ${isDownloadMenuOpen ? "toolbar-button-active" : ""}`,
434
+ onClick: () => setIsDownloadMenuOpen(!isDownloadMenuOpen),
435
+ disabled: disabledDownload,
436
+ children: [
437
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _Download2.default, { fontSize: "small" }),
438
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _KeyboardArrowDown2.default, { fontSize: "small", style: { marginLeft: -4 } })
439
+ ]
433
440
  }
434
- ),
435
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
441
+ ) }) }),
442
+ isDownloadMenuOpen && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "toolbar-dropdown-menu toolbar-dropdown-menu-right", children: [
443
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
444
+ "button",
445
+ {
446
+ className: "toolbar-dropdown-item",
447
+ onClick: handleDownloadWithoutAnnotations,
448
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Download Document Only" })
449
+ }
450
+ ),
451
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
452
+ "button",
453
+ {
454
+ className: "toolbar-dropdown-item",
455
+ onClick: handleDownloadWithAnnotations,
456
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Download with Annotations" })
457
+ }
458
+ )
459
+ ] })
460
+ ] })
461
+ ) : (
462
+ // RENDER SINGLE BUTTON if ONLY ONE is enabled
463
+ (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,
464
+ "button",
465
+ {
466
+ className: "toolbar-button",
467
+ onClick: showDownloadOriginal ? handleDownloadWithoutAnnotations : handleDownloadWithAnnotations,
468
+ disabled: disabledDownload,
469
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _Download2.default, { fontSize: "small" })
470
+ }
471
+ ) }) })
472
+ ) }),
473
+ showPrint && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "toolbar-dropdown-container", ref: printMenuRef, children: showPrintOriginal && showPrintWithAnnotations ? (
474
+ // RENDER DROPDOWN if BOTH are enabled
475
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
476
+ /* @__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,
436
477
  "button",
437
478
  {
438
- className: "toolbar-dropdown-item",
439
- onClick: handlePrintWithAnnotations,
440
- children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Print with Annotations" })
479
+ className: `toolbar-button toolbar-dropdown-button ${isPrintMenuOpen ? "toolbar-button-active" : ""}`,
480
+ onClick: () => setIsPrintMenuOpen(!isPrintMenuOpen),
481
+ disabled: disabledPrint,
482
+ children: [
483
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _Print2.default, { fontSize: "small" }),
484
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _KeyboardArrowDown2.default, { fontSize: "small", style: { marginLeft: -4 } })
485
+ ]
441
486
  }
442
- )
487
+ ) }) }),
488
+ isPrintMenuOpen && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "toolbar-dropdown-menu toolbar-dropdown-menu-right", children: [
489
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
490
+ "button",
491
+ {
492
+ className: "toolbar-dropdown-item",
493
+ onClick: handlePrintWithoutAnnotations,
494
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Print Document Only" })
495
+ }
496
+ ),
497
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
498
+ "button",
499
+ {
500
+ className: "toolbar-dropdown-item",
501
+ onClick: handlePrintWithAnnotations,
502
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: "Print with Annotations" })
503
+ }
504
+ )
505
+ ] })
443
506
  ] })
444
- ] }),
445
- showMetadata && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Tooltip, { title: "Metadata", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
507
+ ) : (
508
+ // RENDER SINGLE BUTTON if ONLY ONE is enabled
509
+ (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,
510
+ "button",
511
+ {
512
+ className: "toolbar-button",
513
+ onClick: showPrintOriginal ? handlePrintWithoutAnnotations : handlePrintWithAnnotations,
514
+ disabled: disabledPrint,
515
+ children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _Print2.default, { fontSize: "small" })
516
+ }
517
+ ) }) })
518
+ ) }),
519
+ 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,
446
520
  "button",
447
521
  {
448
522
  className: "toolbar-button",
@@ -450,8 +524,8 @@ var PDFToolbar = _react2.default.memo(
450
524
  disabled: disabledMetadata,
451
525
  children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _Description2.default, { fontSize: "small" })
452
526
  }
453
- ) }),
454
- showProperties && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Tooltip, { title: "Properties", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
527
+ ) }) }),
528
+ 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,
455
529
  "button",
456
530
  {
457
531
  className: "toolbar-button",
@@ -459,8 +533,8 @@ var PDFToolbar = _react2.default.memo(
459
533
  disabled: disabledProperties,
460
534
  children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _Info2.default, { fontSize: "small" })
461
535
  }
462
- ) }),
463
- showTags && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Tooltip, { title: "Tags", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
536
+ ) }) }),
537
+ 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,
464
538
  "button",
465
539
  {
466
540
  className: "toolbar-button",
@@ -468,8 +542,8 @@ var PDFToolbar = _react2.default.memo(
468
542
  disabled: disabledTags,
469
543
  children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _iconsmaterial.LocalOffer, { fontSize: "small" })
470
544
  }
471
- ) }),
472
- showHistory && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Tooltip, { title: "Version History", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
545
+ ) }) }),
546
+ 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,
473
547
  "button",
474
548
  {
475
549
  className: "toolbar-button",
@@ -477,12 +551,12 @@ var PDFToolbar = _react2.default.memo(
477
551
  disabled: disabledHistory,
478
552
  children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _History2.default, { fontSize: "small" })
479
553
  }
480
- ) })
554
+ ) }) })
481
555
  ] })
482
556
  ] }) })
483
557
  ] }),
484
558
  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,
559
+ /* @__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,
486
560
  "button",
487
561
  {
488
562
  className: `toolbar-button ${isHighlighterActive ? "toolbar-button-active" : ""}`,
@@ -490,8 +564,8 @@ var PDFToolbar = _react2.default.memo(
490
564
  disabled: disabledHighlighter,
491
565
  children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _Highlight2.default, { fontSize: "small" })
492
566
  }
493
- ) }),
494
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Tooltip, { title: "Stamp", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
567
+ ) }) }),
568
+ /* @__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,
495
569
  "button",
496
570
  {
497
571
  className: `toolbar-button ${isStampActive ? "toolbar-button-active" : ""}`,
@@ -499,8 +573,8 @@ var PDFToolbar = _react2.default.memo(
499
573
  disabled: disabledStamp,
500
574
  children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _Approval2.default, { fontSize: "small" })
501
575
  }
502
- ) }),
503
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _material.Tooltip, { title: "Signature", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
576
+ ) }) }),
577
+ /* @__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,
504
578
  "button",
505
579
  {
506
580
  className: "toolbar-button",
@@ -508,10 +582,10 @@ var PDFToolbar = _react2.default.memo(
508
582
  disabled: disabledSignature,
509
583
  children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _Draw2.default, { fontSize: "small" })
510
584
  }
511
- ) }),
585
+ ) }) }),
512
586
  hasUnsavedAnnotations && canSaveAnnotations !== false && onSaveAnnotations && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _jsxruntime.Fragment, { children: [
513
587
  /* @__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,
588
+ /* @__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,
515
589
  "button",
516
590
  {
517
591
  className: "toolbar-button",
@@ -528,7 +602,8 @@ var PDFToolbar = _react2.default.memo(
528
602
  backgroundColor: hasUnsavedAnnotations ? "#eff6ff" : "transparent",
529
603
  fontSize: "14px",
530
604
  fontWeight: 500,
531
- width: "auto"
605
+ width: "auto",
606
+ cursor: isSavingAnnotations ? "not-allowed" : "pointer"
532
607
  },
533
608
  children: [
534
609
  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: [
@@ -539,7 +614,7 @@ var PDFToolbar = _react2.default.memo(
539
614
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "span", { children: isSavingAnnotations ? "Saving..." : "Save" })
540
615
  ]
541
616
  }
542
- ) })
617
+ ) }) })
543
618
  ] })
544
619
  ] }),
545
620
  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" }) }) }) })
@@ -1246,6 +1321,8 @@ var PDFViewerContent = _react.forwardRef.call(void 0,
1246
1321
  onTagsClick,
1247
1322
  onHistoryClick,
1248
1323
  onDownloadClick,
1324
+ onDownloadWithAnnotations,
1325
+ onDownloadWithoutAnnotations,
1249
1326
  onPrintClick,
1250
1327
  initialSearchText,
1251
1328
  initialSearchPages,
@@ -1257,16 +1334,25 @@ var PDFViewerContent = _react.forwardRef.call(void 0,
1257
1334
  onHighlighterClick,
1258
1335
  onStampClick,
1259
1336
  onSignatureClick,
1337
+ // New granular toolbar props
1338
+ showAnnotate,
1339
+ disabledAnnotate,
1340
+ showPrintOriginal,
1341
+ showPrintWithAnnotations,
1342
+ showDownloadOriginal,
1343
+ showDownloadWithAnnotations,
1260
1344
  // Annotation save props
1261
1345
  hasUnsavedAnnotations,
1262
1346
  isSavingAnnotations,
1263
1347
  canSaveAnnotations,
1264
- onSaveAnnotations
1348
+ onSaveAnnotations,
1349
+ loading
1265
1350
  } = props;
1266
1351
  const [pdfBuffer, setPdfBuffer] = _react.useState.call(void 0, null);
1267
1352
  const [state, setState] = _react.useState.call(void 0, "idle");
1268
1353
  const [error, setError] = _react.useState.call(void 0, null);
1269
1354
  const pdfViewerRef = _react.useRef.call(void 0, null);
1355
+ const [isInternalReady, setIsInternalReady] = _react.useState.call(void 0, false);
1270
1356
  const [internalHighlighterActive, setInternalHighlighterActive] = _react.useState.call(void 0, false);
1271
1357
  const [internalStampActive, setInternalStampActive] = _react.useState.call(void 0, false);
1272
1358
  const highlighterActive = isHighlighterActive !== void 0 ? isHighlighterActive : internalHighlighterActive;
@@ -1306,7 +1392,7 @@ var PDFViewerContent = _react.forwardRef.call(void 0,
1306
1392
  const passwordTimeoutRef = _react.useRef.call(void 0, null);
1307
1393
  const hasExecutedInitialSearch = _react.useRef.call(void 0, false);
1308
1394
  const handleToggleFullScreen = _react.useCallback.call(void 0, () => {
1309
- if (!isFullScreen && _optionalChain([containerRef, 'access', _7 => _7.current, 'optionalAccess', _8 => _8.requestFullscreen])) {
1395
+ if (!isFullScreen && _optionalChain([containerRef, 'access', _9 => _9.current, 'optionalAccess', _10 => _10.requestFullscreen])) {
1310
1396
  containerRef.current.requestFullscreen();
1311
1397
  setIsFullScreen(true);
1312
1398
  } else if (isFullScreen && document.exitFullscreen) {
@@ -1330,7 +1416,7 @@ var PDFViewerContent = _react.forwardRef.call(void 0,
1330
1416
  setSearchResults([]);
1331
1417
  setTotalSearchResults(0);
1332
1418
  setCurrentSearchResultIndex(0);
1333
- _optionalChain([pdfViewerRef, 'access', _9 => _9.current, 'optionalAccess', _10 => _10.search, 'access', _11 => _11.stopSearch, 'call', _12 => _12()]);
1419
+ _optionalChain([pdfViewerRef, 'access', _11 => _11.current, 'optionalAccess', _12 => _12.search, 'access', _13 => _13.stopSearch, 'call', _14 => _14()]);
1334
1420
  }, []);
1335
1421
  const toolbar = _chunkEEIQAW55js.mergeToolbarConfig.call(void 0, {
1336
1422
  showDownload,
@@ -1351,66 +1437,66 @@ var PDFViewerContent = _react.forwardRef.call(void 0,
1351
1437
  const toolbarHandlers = _react.useMemo.call(void 0,
1352
1438
  () => ({
1353
1439
  handleZoomIn: () => {
1354
- _optionalChain([pdfViewerRef, 'access', _13 => _13.current, 'optionalAccess', _14 => _14.zoom, 'access', _15 => _15.zoomIn, 'call', _16 => _16()]);
1440
+ _optionalChain([pdfViewerRef, 'access', _15 => _15.current, 'optionalAccess', _16 => _16.zoom, 'access', _17 => _17.zoomIn, 'call', _18 => _18()]);
1355
1441
  requestAnimationFrame(() => {
1356
- const zoomValue = _optionalChain([pdfViewerRef, 'access', _17 => _17.current, 'optionalAccess', _18 => _18.zoom, 'access', _19 => _19.getZoom, 'call', _20 => _20()]);
1442
+ const zoomValue = _optionalChain([pdfViewerRef, 'access', _19 => _19.current, 'optionalAccess', _20 => _20.zoom, 'access', _21 => _21.getZoom, 'call', _22 => _22()]);
1357
1443
  if (typeof zoomValue === "number") {
1358
1444
  setZoom(Math.round(zoomValue * 100));
1359
1445
  }
1360
1446
  });
1361
1447
  },
1362
1448
  handleZoomOut: () => {
1363
- _optionalChain([pdfViewerRef, 'access', _21 => _21.current, 'optionalAccess', _22 => _22.zoom, 'access', _23 => _23.zoomOut, 'call', _24 => _24()]);
1449
+ _optionalChain([pdfViewerRef, 'access', _23 => _23.current, 'optionalAccess', _24 => _24.zoom, 'access', _25 => _25.zoomOut, 'call', _26 => _26()]);
1364
1450
  requestAnimationFrame(() => {
1365
- const zoomValue = _optionalChain([pdfViewerRef, 'access', _25 => _25.current, 'optionalAccess', _26 => _26.zoom, 'access', _27 => _27.getZoom, 'call', _28 => _28()]);
1451
+ const zoomValue = _optionalChain([pdfViewerRef, 'access', _27 => _27.current, 'optionalAccess', _28 => _28.zoom, 'access', _29 => _29.getZoom, 'call', _30 => _30()]);
1366
1452
  if (typeof zoomValue === "number") {
1367
1453
  setZoom(Math.round(zoomValue * 100));
1368
1454
  }
1369
1455
  });
1370
1456
  },
1371
1457
  handleFitToWidth: () => {
1372
- _optionalChain([pdfViewerRef, 'access', _29 => _29.current, 'optionalAccess', _30 => _30.zoom, 'access', _31 => _31.fitToWidth, 'call', _32 => _32()]);
1458
+ _optionalChain([pdfViewerRef, 'access', _31 => _31.current, 'optionalAccess', _32 => _32.zoom, 'access', _33 => _33.fitToWidth, 'call', _34 => _34()]);
1373
1459
  requestAnimationFrame(() => {
1374
- const zoomValue = _optionalChain([pdfViewerRef, 'access', _33 => _33.current, 'optionalAccess', _34 => _34.zoom, 'access', _35 => _35.getZoom, 'call', _36 => _36()]);
1460
+ const zoomValue = _optionalChain([pdfViewerRef, 'access', _35 => _35.current, 'optionalAccess', _36 => _36.zoom, 'access', _37 => _37.getZoom, 'call', _38 => _38()]);
1375
1461
  if (typeof zoomValue === "number") {
1376
1462
  setZoom(Math.round(zoomValue * 100));
1377
1463
  }
1378
1464
  });
1379
1465
  },
1380
1466
  handleFitToPage: () => {
1381
- _optionalChain([pdfViewerRef, 'access', _37 => _37.current, 'optionalAccess', _38 => _38.zoom, 'access', _39 => _39.fitToPage, 'call', _40 => _40()]);
1467
+ _optionalChain([pdfViewerRef, 'access', _39 => _39.current, 'optionalAccess', _40 => _40.zoom, 'access', _41 => _41.fitToPage, 'call', _42 => _42()]);
1382
1468
  requestAnimationFrame(() => {
1383
- const zoomValue = _optionalChain([pdfViewerRef, 'access', _41 => _41.current, 'optionalAccess', _42 => _42.zoom, 'access', _43 => _43.getZoom, 'call', _44 => _44()]);
1469
+ const zoomValue = _optionalChain([pdfViewerRef, 'access', _43 => _43.current, 'optionalAccess', _44 => _44.zoom, 'access', _45 => _45.getZoom, 'call', _46 => _46()]);
1384
1470
  if (typeof zoomValue === "number") {
1385
1471
  setZoom(Math.round(zoomValue * 100));
1386
1472
  }
1387
1473
  });
1388
1474
  },
1389
1475
  handlePreviousPage: () => {
1390
- _optionalChain([pdfViewerRef, 'access', _45 => _45.current, 'optionalAccess', _46 => _46.navigation, 'access', _47 => _47.previousPage, 'call', _48 => _48()]);
1476
+ _optionalChain([pdfViewerRef, 'access', _47 => _47.current, 'optionalAccess', _48 => _48.navigation, 'access', _49 => _49.previousPage, 'call', _50 => _50()]);
1391
1477
  requestAnimationFrame(() => {
1392
- const current = _optionalChain([pdfViewerRef, 'access', _49 => _49.current, 'optionalAccess', _50 => _50.navigation, 'access', _51 => _51.getCurrentPage, 'call', _52 => _52()]) || 1;
1478
+ const current = _optionalChain([pdfViewerRef, 'access', _51 => _51.current, 'optionalAccess', _52 => _52.navigation, 'access', _53 => _53.getCurrentPage, 'call', _54 => _54()]) || 1;
1393
1479
  setCurrentPage(current);
1394
1480
  });
1395
1481
  },
1396
1482
  handleNextPage: () => {
1397
- _optionalChain([pdfViewerRef, 'access', _53 => _53.current, 'optionalAccess', _54 => _54.navigation, 'access', _55 => _55.nextPage, 'call', _56 => _56()]);
1483
+ _optionalChain([pdfViewerRef, 'access', _55 => _55.current, 'optionalAccess', _56 => _56.navigation, 'access', _57 => _57.nextPage, 'call', _58 => _58()]);
1398
1484
  requestAnimationFrame(() => {
1399
- const current = _optionalChain([pdfViewerRef, 'access', _57 => _57.current, 'optionalAccess', _58 => _58.navigation, 'access', _59 => _59.getCurrentPage, 'call', _60 => _60()]) || 1;
1485
+ const current = _optionalChain([pdfViewerRef, 'access', _59 => _59.current, 'optionalAccess', _60 => _60.navigation, 'access', _61 => _61.getCurrentPage, 'call', _62 => _62()]) || 1;
1400
1486
  setCurrentPage(current);
1401
1487
  });
1402
1488
  },
1403
1489
  handleFirstPage: () => {
1404
- _optionalChain([pdfViewerRef, 'access', _61 => _61.current, 'optionalAccess', _62 => _62.navigation, 'access', _63 => _63.goToFirstPage, 'call', _64 => _64()]);
1490
+ _optionalChain([pdfViewerRef, 'access', _63 => _63.current, 'optionalAccess', _64 => _64.navigation, 'access', _65 => _65.goToFirstPage, 'call', _66 => _66()]);
1405
1491
  requestAnimationFrame(() => {
1406
- const current = _optionalChain([pdfViewerRef, 'access', _65 => _65.current, 'optionalAccess', _66 => _66.navigation, 'access', _67 => _67.getCurrentPage, 'call', _68 => _68()]) || 1;
1492
+ const current = _optionalChain([pdfViewerRef, 'access', _67 => _67.current, 'optionalAccess', _68 => _68.navigation, 'access', _69 => _69.getCurrentPage, 'call', _70 => _70()]) || 1;
1407
1493
  setCurrentPage(current);
1408
1494
  });
1409
1495
  },
1410
1496
  handleLastPage: () => {
1411
- _optionalChain([pdfViewerRef, 'access', _69 => _69.current, 'optionalAccess', _70 => _70.navigation, 'access', _71 => _71.goToLastPage, 'call', _72 => _72()]);
1497
+ _optionalChain([pdfViewerRef, 'access', _71 => _71.current, 'optionalAccess', _72 => _72.navigation, 'access', _73 => _73.goToLastPage, 'call', _74 => _74()]);
1412
1498
  requestAnimationFrame(() => {
1413
- const current = _optionalChain([pdfViewerRef, 'access', _73 => _73.current, 'optionalAccess', _74 => _74.navigation, 'access', _75 => _75.getCurrentPage, 'call', _76 => _76()]) || 1;
1499
+ const current = _optionalChain([pdfViewerRef, 'access', _75 => _75.current, 'optionalAccess', _76 => _76.navigation, 'access', _77 => _77.getCurrentPage, 'call', _78 => _78()]) || 1;
1414
1500
  setCurrentPage(current);
1415
1501
  });
1416
1502
  },
@@ -1428,7 +1514,7 @@ var PDFViewerContent = _react.forwardRef.call(void 0,
1428
1514
  }
1429
1515
  const page = parseInt(value, 10);
1430
1516
  if (!isNaN(page) && page >= 1 && (totalPages === 0 || page <= totalPages)) {
1431
- _optionalChain([pdfViewerRef, 'access', _77 => _77.current, 'optionalAccess', _78 => _78.navigation, 'access', _79 => _79.goToPage, 'call', _80 => _80(page)]);
1517
+ _optionalChain([pdfViewerRef, 'access', _79 => _79.current, 'optionalAccess', _80 => _80.navigation, 'access', _81 => _81.goToPage, 'call', _82 => _82(page)]);
1432
1518
  setCurrentPage(page);
1433
1519
  }
1434
1520
  },
@@ -1437,89 +1523,87 @@ var PDFViewerContent = _react.forwardRef.call(void 0,
1437
1523
  const value = e.target.value;
1438
1524
  const page = parseInt(value, 10);
1439
1525
  if (!isNaN(page) && page >= 1 && (totalPages === 0 || page <= totalPages)) {
1440
- _optionalChain([pdfViewerRef, 'access', _81 => _81.current, 'optionalAccess', _82 => _82.navigation, 'access', _83 => _83.goToPage, 'call', _84 => _84(page)]);
1526
+ _optionalChain([pdfViewerRef, 'access', _83 => _83.current, 'optionalAccess', _84 => _84.navigation, 'access', _85 => _85.goToPage, 'call', _86 => _86(page)]);
1441
1527
  setCurrentPage(page);
1442
1528
  }
1443
1529
  }
1444
1530
  },
1445
1531
  handleRotateLeft: () => {
1446
- _optionalChain([pdfViewerRef, 'access', _85 => _85.current, 'optionalAccess', _86 => _86.rotate, 'optionalAccess', _87 => _87.rotateBackward, 'call', _88 => _88()]);
1532
+ _optionalChain([pdfViewerRef, 'access', _87 => _87.current, 'optionalAccess', _88 => _88.rotate, 'optionalAccess', _89 => _89.rotateBackward, 'call', _90 => _90()]);
1447
1533
  },
1448
1534
  handleRotateRight: () => {
1449
- _optionalChain([pdfViewerRef, 'access', _89 => _89.current, 'optionalAccess', _90 => _90.rotate, 'optionalAccess', _91 => _91.rotateForward, 'call', _92 => _92()]);
1535
+ _optionalChain([pdfViewerRef, 'access', _91 => _91.current, 'optionalAccess', _92 => _92.rotate, 'optionalAccess', _93 => _93.rotateForward, 'call', _94 => _94()]);
1450
1536
  },
1451
1537
  handlePrint: () => {
1452
- _optionalChain([pdfViewerRef, 'access', _93 => _93.current, 'optionalAccess', _94 => _94.print, 'optionalAccess', _95 => _95.print, 'call', _96 => _96()]);
1538
+ _optionalChain([pdfViewerRef, 'access', _95 => _95.current, 'optionalAccess', _96 => _96.print, 'optionalAccess', _97 => _97.print, 'call', _98 => _98()]);
1453
1539
  },
1454
1540
  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
1541
  await _optionalChain([pdfViewerRef, 'access', _99 => _99.current, 'optionalAccess', _100 => _100.print, 'optionalAccess', _101 => _101.printWithAnnotations, 'optionalCall', _102 => _102()]);
1459
1542
  },
1460
1543
  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()]);
1544
+ await _optionalChain([pdfViewerRef, 'access', _103 => _103.current, 'optionalAccess', _104 => _104.print, 'optionalAccess', _105 => _105.printWithoutAnnotations, 'optionalCall', _106 => _106()]);
1545
+ },
1546
+ handleDownloadWithAnnotations: async () => {
1547
+ if (onDownloadWithAnnotations) {
1548
+ onDownloadWithAnnotations();
1549
+ } else {
1550
+ await _optionalChain([pdfViewerRef, 'access', _107 => _107.current, 'optionalAccess', _108 => _108.download, 'optionalAccess', _109 => _109.downloadWithAnnotations, 'optionalCall', _110 => _110(resolvedFileName)]);
1551
+ }
1552
+ },
1553
+ handleDownloadWithoutAnnotations: async () => {
1554
+ if (onDownloadWithoutAnnotations) {
1555
+ onDownloadWithoutAnnotations();
1556
+ } else {
1557
+ await _optionalChain([pdfViewerRef, 'access', _111 => _111.current, 'optionalAccess', _112 => _112.download, 'optionalAccess', _113 => _113.downloadWithoutAnnotations, 'optionalCall', _114 => _114(resolvedFileName)]);
1558
+ }
1465
1559
  },
1466
1560
  handleHighlighterClick: () => {
1467
1561
  if (highlighterActive) {
1468
- _optionalChain([pdfViewerRef, 'access', _109 => _109.current, 'optionalAccess', _110 => _110.annotation, 'optionalAccess', _111 => _111.deactivateHighlighter, 'call', _112 => _112()]);
1562
+ _optionalChain([pdfViewerRef, 'access', _115 => _115.current, 'optionalAccess', _116 => _116.annotation, 'optionalAccess', _117 => _117.deactivateHighlighter, 'call', _118 => _118()]);
1469
1563
  setInternalHighlighterActive(false);
1470
1564
  } else {
1471
1565
  if (stampActive) {
1472
- _optionalChain([pdfViewerRef, 'access', _113 => _113.current, 'optionalAccess', _114 => _114.annotation, 'optionalAccess', _115 => _115.deactivateStamp, 'call', _116 => _116()]);
1566
+ _optionalChain([pdfViewerRef, 'access', _119 => _119.current, 'optionalAccess', _120 => _120.annotation, 'optionalAccess', _121 => _121.deactivateStamp, 'call', _122 => _122()]);
1473
1567
  setInternalStampActive(false);
1474
1568
  }
1475
- _optionalChain([pdfViewerRef, 'access', _117 => _117.current, 'optionalAccess', _118 => _118.annotation, 'optionalAccess', _119 => _119.activateHighlighter, 'call', _120 => _120()]);
1569
+ _optionalChain([pdfViewerRef, 'access', _123 => _123.current, 'optionalAccess', _124 => _124.annotation, 'optionalAccess', _125 => _125.activateHighlighter, 'call', _126 => _126()]);
1476
1570
  setInternalHighlighterActive(true);
1477
1571
  }
1478
1572
  },
1479
1573
  handleStampClick: () => {
1480
1574
  if (stampActive) {
1481
- _optionalChain([pdfViewerRef, 'access', _121 => _121.current, 'optionalAccess', _122 => _122.annotation, 'optionalAccess', _123 => _123.deactivateStamp, 'call', _124 => _124()]);
1575
+ _optionalChain([pdfViewerRef, 'access', _127 => _127.current, 'optionalAccess', _128 => _128.annotation, 'optionalAccess', _129 => _129.deactivateStamp, 'call', _130 => _130()]);
1482
1576
  setInternalStampActive(false);
1483
1577
  } else {
1484
1578
  if (highlighterActive) {
1485
- _optionalChain([pdfViewerRef, 'access', _125 => _125.current, 'optionalAccess', _126 => _126.annotation, 'optionalAccess', _127 => _127.deactivateHighlighter, 'call', _128 => _128()]);
1579
+ _optionalChain([pdfViewerRef, 'access', _131 => _131.current, 'optionalAccess', _132 => _132.annotation, 'optionalAccess', _133 => _133.deactivateHighlighter, 'call', _134 => _134()]);
1486
1580
  setInternalHighlighterActive(false);
1487
1581
  }
1488
- _optionalChain([pdfViewerRef, 'access', _129 => _129.current, 'optionalAccess', _130 => _130.annotation, 'optionalAccess', _131 => _131.activateStamp, 'call', _132 => _132("")]);
1582
+ _optionalChain([pdfViewerRef, 'access', _135 => _135.current, 'optionalAccess', _136 => _136.annotation, 'optionalAccess', _137 => _137.activateStamp, 'call', _138 => _138("")]);
1489
1583
  setInternalStampActive(true);
1490
1584
  }
1491
1585
  },
1492
1586
  handleSignatureClick: () => {
1493
1587
  },
1588
+ handleCopy: () => {
1589
+ _optionalChain([pdfViewerRef, 'access', _139 => _139.current, 'optionalAccess', _140 => _140.selection, 'access', _141 => _141.copy, 'call', _142 => _142()]);
1590
+ },
1494
1591
  handleToggleFullScreen
1495
1592
  }),
1496
- [isSidebarOpen, totalPages, handleToggleFullScreen, highlighterActive, stampActive]
1593
+ [isSidebarOpen, totalPages, handleToggleFullScreen, highlighterActive, stampActive, onDownloadWithAnnotations, onDownloadWithoutAnnotations]
1497
1594
  );
1498
1595
  _react.useEffect.call(void 0, () => {
1499
- console.log(
1500
- "came",
1501
- initialSearchText,
1502
- pdfViewerRef.current,
1503
- hasExecutedInitialSearch.current,
1504
- "state:",
1505
- state,
1506
- "totalPages:",
1507
- totalPages
1508
- );
1509
1596
  if (!initialSearchText || hasExecutedInitialSearch.current) return;
1510
1597
  const isPDFReady = state === "ready";
1511
1598
  const isPagesInitialized = totalPages > 0;
1512
1599
  const isViewerAvailable = !!pdfViewerRef.current;
1513
- const isSearchAPIReady = !!_optionalChain([pdfViewerRef, 'access', _133 => _133.current, 'optionalAccess', _134 => _134.search, 'optionalAccess', _135 => _135.searchText]);
1600
+ const isSearchAPIReady = !!_optionalChain([pdfViewerRef, 'access', _143 => _143.current, 'optionalAccess', _144 => _144.search, 'optionalAccess', _145 => _145.searchText]);
1514
1601
  const canExecuteSearch = isPDFReady && isPagesInitialized && isViewerAvailable && isSearchAPIReady;
1515
1602
  if (!canExecuteSearch) return;
1516
1603
  hasExecutedInitialSearch.current = true;
1517
1604
  const SEARCH_INITIALIZATION_DELAY = 100;
1518
1605
  setTimeout(() => {
1519
- if (!_optionalChain([pdfViewerRef, 'access', _136 => _136.current, 'optionalAccess', _137 => _137.search, 'optionalAccess', _138 => _138.searchText])) {
1520
- console.warn(
1521
- "Search API became unavailable, skipping initial search"
1522
- );
1606
+ if (!_optionalChain([pdfViewerRef, 'access', _146 => _146.current, 'optionalAccess', _147 => _147.search, 'optionalAccess', _148 => _148.searchText])) {
1523
1607
  hasExecutedInitialSearch.current = false;
1524
1608
  return;
1525
1609
  }
@@ -1574,6 +1658,29 @@ var PDFViewerContent = _react.forwardRef.call(void 0,
1574
1658
  observer.observe(document.body, { childList: true, subtree: true });
1575
1659
  return () => observer.disconnect();
1576
1660
  }, [state]);
1661
+ _react.useEffect.call(void 0, () => {
1662
+ if (state !== "ready") return;
1663
+ const checkInternalReadiness = async () => {
1664
+ if (!pdfViewerRef.current) return;
1665
+ try {
1666
+ const count = _optionalChain([pdfViewerRef, 'access', _149 => _149.current, 'access', _150 => _150.navigation, 'optionalAccess', _151 => _151.getTotalPages, 'optionalCall', _152 => _152()]);
1667
+ if (count && count > 0) {
1668
+ setTotalPages(count);
1669
+ setIsInternalReady(true);
1670
+ return;
1671
+ }
1672
+ const docInfo = _optionalChain([pdfViewerRef, 'access', _153 => _153.current, 'optionalAccess', _154 => _154.document, 'optionalAccess', _155 => _155.getDocumentInfo, 'optionalCall', _156 => _156()]);
1673
+ if (docInfo && docInfo.totalPages > 0) {
1674
+ setTotalPages(docInfo.totalPages);
1675
+ setIsInternalReady(true);
1676
+ return;
1677
+ }
1678
+ } catch (e) {
1679
+ }
1680
+ };
1681
+ const pollInterval = setInterval(checkInternalReadiness, 100);
1682
+ return () => clearInterval(pollInterval);
1683
+ }, [state]);
1577
1684
  _react.useEffect.call(void 0, () => {
1578
1685
  if (state !== "ready" || totalPages > 0) return;
1579
1686
  const initializePageCount = async () => {
@@ -1592,65 +1699,32 @@ var PDFViewerContent = _react.forwardRef.call(void 0,
1592
1699
  if (!viewer) return;
1593
1700
  await new Promise((resolve) => requestAnimationFrame(resolve));
1594
1701
  try {
1595
- const count = _optionalChain([viewer, 'access', _139 => _139.navigation, 'optionalAccess', _140 => _140.getTotalPages, 'optionalCall', _141 => _141()]);
1596
- if (count && count > 1) {
1597
- setTotalPages(count);
1598
- return;
1599
- }
1600
- } catch (e) {
1601
- }
1602
- try {
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) {
1605
- const pageIndices = results.results.map((m) => m.pageIndex).filter((idx) => typeof idx === "number");
1606
- const count = Math.max(...pageIndices) + 1;
1607
- _optionalChain([viewer, 'access', _146 => _146.search, 'optionalAccess', _147 => _147.stopSearch, 'optionalCall', _148 => _148()]);
1608
- setTotalPages(count);
1609
- return;
1610
- }
1611
- } catch (error2) {
1612
- }
1613
- await new Promise((resolve) => setTimeout(resolve, 200));
1614
- try {
1615
- const selectors = [
1616
- "[data-page-index]",
1617
- "[data-page-number]",
1618
- ".embedpdf-page",
1619
- '[role="article"]',
1620
- "canvas[data-page]",
1621
- ".react-pdf__Page"
1622
- ];
1623
- for (const selector of selectors) {
1624
- const pages = document.querySelectorAll(selector);
1625
- if (pages.length > 0) {
1626
- setTotalPages(pages.length);
1627
- return;
1628
- }
1629
- }
1630
- } catch (error2) {
1631
- }
1632
- try {
1633
- const count = _optionalChain([viewer, 'access', _149 => _149.navigation, 'optionalAccess', _150 => _150.getTotalPages, 'optionalCall', _151 => _151()]);
1702
+ const count = _optionalChain([viewer, 'access', _157 => _157.navigation, 'optionalAccess', _158 => _158.getTotalPages, 'optionalCall', _159 => _159()]);
1634
1703
  if (count && count > 0) {
1635
1704
  setTotalPages(count);
1705
+ setIsInternalReady(true);
1636
1706
  return;
1637
1707
  }
1638
1708
  } catch (e) {
1639
1709
  }
1640
- console.warn(
1641
- "Could not determine total pages, using fallback value of 1"
1642
- );
1643
- setTotalPages(1);
1644
1710
  };
1645
1711
  initializePageCount();
1646
1712
  }, [state, totalPages]);
1647
1713
  _react.useEffect.call(void 0, () => {
1648
- if (state === "ready" && pdfViewerRef.current) {
1714
+ if (state === "ready") {
1649
1715
  const updateInfo = () => {
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()]);
1716
+ if (!pdfViewerRef.current) return;
1717
+ const current = _optionalChain([pdfViewerRef, 'access', _160 => _160.current, 'optionalAccess', _161 => _161.navigation, 'access', _162 => _162.getCurrentPage, 'call', _163 => _163()]) || 1;
1718
+ const docInfo = _optionalChain([pdfViewerRef, 'access', _164 => _164.current, 'optionalAccess', _165 => _165.document, 'optionalAccess', _166 => _166.getDocumentInfo, 'optionalCall', _167 => _167()]);
1719
+ const navTotal = _optionalChain([pdfViewerRef, 'access', _168 => _168.current, 'optionalAccess', _169 => _169.navigation, 'optionalAccess', _170 => _170.getTotalPages, 'optionalCall', _171 => _171()]);
1720
+ let total = 0;
1721
+ if (docInfo && docInfo.totalPages > 0) {
1722
+ total = docInfo.totalPages;
1723
+ } else if (typeof navTotal === "number" && navTotal > 0) {
1724
+ total = navTotal;
1725
+ }
1726
+ const zoomValue = _optionalChain([pdfViewerRef, 'access', _172 => _172.current, 'optionalAccess', _173 => _173.zoom, 'access', _174 => _174.getZoom, 'call', _175 => _175()]);
1727
+ const currentSearchState = _optionalChain([pdfViewerRef, 'access', _176 => _176.current, 'optionalAccess', _177 => _177.search, 'access', _178 => _178.getSearchState, 'call', _179 => _179()]);
1654
1728
  setCurrentPage(current);
1655
1729
  if (total > 0 && total !== totalPages) {
1656
1730
  setTotalPages(total);
@@ -1660,7 +1734,8 @@ var PDFViewerContent = _react.forwardRef.call(void 0,
1660
1734
  }
1661
1735
  };
1662
1736
  updateInfo();
1663
- const interval = setInterval(updateInfo, 300);
1737
+ const pollInterval = totalPages === 0 ? 50 : 300;
1738
+ const interval = setInterval(updateInfo, pollInterval);
1664
1739
  return () => clearInterval(interval);
1665
1740
  }
1666
1741
  }, [state, totalPages]);
@@ -1668,50 +1743,50 @@ var PDFViewerContent = _react.forwardRef.call(void 0,
1668
1743
  ref,
1669
1744
  () => ({
1670
1745
  zoomIn: () => {
1671
- _optionalChain([pdfViewerRef, 'access', _168 => _168.current, 'optionalAccess', _169 => _169.zoom, 'access', _170 => _170.zoomIn, 'call', _171 => _171()]);
1746
+ _optionalChain([pdfViewerRef, 'access', _180 => _180.current, 'optionalAccess', _181 => _181.zoom, 'access', _182 => _182.zoomIn, 'call', _183 => _183()]);
1672
1747
  updateZoomDisplay();
1673
1748
  },
1674
1749
  zoomOut: () => {
1675
- _optionalChain([pdfViewerRef, 'access', _172 => _172.current, 'optionalAccess', _173 => _173.zoom, 'access', _174 => _174.zoomOut, 'call', _175 => _175()]);
1750
+ _optionalChain([pdfViewerRef, 'access', _184 => _184.current, 'optionalAccess', _185 => _185.zoom, 'access', _186 => _186.zoomOut, 'call', _187 => _187()]);
1676
1751
  updateZoomDisplay();
1677
1752
  },
1678
1753
  setZoom: (level) => {
1679
- _optionalChain([pdfViewerRef, 'access', _176 => _176.current, 'optionalAccess', _177 => _177.zoom, 'access', _178 => _178.setZoom, 'call', _179 => _179(level)]);
1754
+ _optionalChain([pdfViewerRef, 'access', _188 => _188.current, 'optionalAccess', _189 => _189.zoom, 'access', _190 => _190.setZoom, 'call', _191 => _191(level)]);
1680
1755
  updateZoomDisplay();
1681
1756
  },
1682
1757
  resetZoom: () => {
1683
- _optionalChain([pdfViewerRef, 'access', _180 => _180.current, 'optionalAccess', _181 => _181.zoom, 'access', _182 => _182.resetZoom, 'call', _183 => _183()]);
1758
+ _optionalChain([pdfViewerRef, 'access', _192 => _192.current, 'optionalAccess', _193 => _193.zoom, 'access', _194 => _194.resetZoom, 'call', _195 => _195()]);
1684
1759
  updateZoomDisplay();
1685
1760
  },
1686
1761
  getZoom: () => {
1687
- const zoom2 = _optionalChain([pdfViewerRef, 'access', _184 => _184.current, 'optionalAccess', _185 => _185.zoom, 'access', _186 => _186.getZoom, 'call', _187 => _187()]);
1762
+ const zoom2 = _optionalChain([pdfViewerRef, 'access', _196 => _196.current, 'optionalAccess', _197 => _197.zoom, 'access', _198 => _198.getZoom, 'call', _199 => _199()]);
1688
1763
  return typeof zoom2 === "number" ? zoom2 : 1;
1689
1764
  },
1690
1765
  goToPage: (page) => {
1691
- _optionalChain([pdfViewerRef, 'access', _188 => _188.current, 'optionalAccess', _189 => _189.navigation, 'access', _190 => _190.goToPage, 'call', _191 => _191(page)]);
1766
+ _optionalChain([pdfViewerRef, 'access', _200 => _200.current, 'optionalAccess', _201 => _201.navigation, 'access', _202 => _202.goToPage, 'call', _203 => _203(page)]);
1692
1767
  setCurrentPage(page);
1693
1768
  },
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,
1769
+ getCurrentPage: () => _optionalChain([pdfViewerRef, 'access', _204 => _204.current, 'optionalAccess', _205 => _205.navigation, 'access', _206 => _206.getCurrentPage, 'call', _207 => _207()]) || 1,
1770
+ getTotalPages: () => _optionalChain([pdfViewerRef, 'access', _208 => _208.current, 'optionalAccess', _209 => _209.navigation, 'access', _210 => _210.getTotalPages, 'call', _211 => _211()]) || 0,
1696
1771
  nextPage: () => {
1697
- _optionalChain([pdfViewerRef, 'access', _200 => _200.current, 'optionalAccess', _201 => _201.navigation, 'access', _202 => _202.nextPage, 'call', _203 => _203()]);
1772
+ _optionalChain([pdfViewerRef, 'access', _212 => _212.current, 'optionalAccess', _213 => _213.navigation, 'access', _214 => _214.nextPage, 'call', _215 => _215()]);
1698
1773
  updatePageDisplay();
1699
1774
  },
1700
1775
  previousPage: () => {
1701
- _optionalChain([pdfViewerRef, 'access', _204 => _204.current, 'optionalAccess', _205 => _205.navigation, 'access', _206 => _206.previousPage, 'call', _207 => _207()]);
1776
+ _optionalChain([pdfViewerRef, 'access', _216 => _216.current, 'optionalAccess', _217 => _217.navigation, 'access', _218 => _218.previousPage, 'call', _219 => _219()]);
1702
1777
  updatePageDisplay();
1703
1778
  },
1704
1779
  goToFirstPage: () => {
1705
- _optionalChain([pdfViewerRef, 'access', _208 => _208.current, 'optionalAccess', _209 => _209.navigation, 'access', _210 => _210.goToFirstPage, 'call', _211 => _211()]);
1780
+ _optionalChain([pdfViewerRef, 'access', _220 => _220.current, 'optionalAccess', _221 => _221.navigation, 'access', _222 => _222.goToFirstPage, 'call', _223 => _223()]);
1706
1781
  updatePageDisplay();
1707
1782
  },
1708
1783
  goToLastPage: () => {
1709
- _optionalChain([pdfViewerRef, 'access', _212 => _212.current, 'optionalAccess', _213 => _213.navigation, 'access', _214 => _214.goToLastPage, 'call', _215 => _215()]);
1784
+ _optionalChain([pdfViewerRef, 'access', _224 => _224.current, 'optionalAccess', _225 => _225.navigation, 'access', _226 => _226.goToLastPage, 'call', _227 => _227()]);
1710
1785
  updatePageDisplay();
1711
1786
  },
1712
1787
  searchText: async (keyword) => {
1713
1788
  setIsSearching(true);
1714
- const results = await _optionalChain([pdfViewerRef, 'access', _216 => _216.current, 'optionalAccess', _217 => _217.search, 'access', _218 => _218.searchText, 'call', _219 => _219(
1789
+ const results = await _optionalChain([pdfViewerRef, 'access', _228 => _228.current, 'optionalAccess', _229 => _229.search, 'access', _230 => _230.searchText, 'call', _231 => _231(
1715
1790
  keyword
1716
1791
  )]);
1717
1792
  setIsSearching(false);
@@ -1719,49 +1794,58 @@ var PDFViewerContent = _react.forwardRef.call(void 0,
1719
1794
  return results;
1720
1795
  },
1721
1796
  nextResult: () => {
1722
- const index = _optionalChain([pdfViewerRef, 'access', _220 => _220.current, 'optionalAccess', _221 => _221.search, 'access', _222 => _222.nextResult, 'call', _223 => _223()]) || -1;
1797
+ const index = _optionalChain([pdfViewerRef, 'access', _232 => _232.current, 'optionalAccess', _233 => _233.search, 'access', _234 => _234.nextResult, 'call', _235 => _235()]) || -1;
1723
1798
  return index;
1724
1799
  },
1725
1800
  previousResult: () => {
1726
- const index = _optionalChain([pdfViewerRef, 'access', _224 => _224.current, 'optionalAccess', _225 => _225.search, 'access', _226 => _226.previousResult, 'call', _227 => _227()]) || -1;
1801
+ const index = _optionalChain([pdfViewerRef, 'access', _236 => _236.current, 'optionalAccess', _237 => _237.search, 'access', _238 => _238.previousResult, 'call', _239 => _239()]) || -1;
1727
1802
  return index;
1728
1803
  },
1729
- goToResult: (index) => _optionalChain([pdfViewerRef, 'access', _228 => _228.current, 'optionalAccess', _229 => _229.search, 'access', _230 => _230.goToResult, 'call', _231 => _231(index)]) || -1,
1804
+ goToResult: (index) => _optionalChain([pdfViewerRef, 'access', _240 => _240.current, 'optionalAccess', _241 => _241.search, 'access', _242 => _242.goToResult, 'call', _243 => _243(index)]) || -1,
1730
1805
  stopSearch: () => {
1731
- _optionalChain([pdfViewerRef, 'access', _232 => _232.current, 'optionalAccess', _233 => _233.search, 'access', _234 => _234.stopSearch, 'call', _235 => _235()]);
1806
+ _optionalChain([pdfViewerRef, 'access', _244 => _244.current, 'optionalAccess', _245 => _245.search, 'access', _246 => _246.stopSearch, 'call', _247 => _247()]);
1732
1807
  setSearchQuery("");
1733
1808
  },
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()]),
1809
+ getSearchState: () => _optionalChain([pdfViewerRef, 'access', _248 => _248.current, 'optionalAccess', _249 => _249.search, 'access', _250 => _250.getSearchState, 'call', _251 => _251()]) || null,
1810
+ getSelectedText: async () => {
1811
+ return await _optionalChain([pdfViewerRef, 'access', _252 => _252.current, 'optionalAccess', _253 => _253.selection, 'access', _254 => _254.getSelectedText, 'call', _255 => _255()]) || "";
1812
+ },
1813
+ clearSelection: () => _optionalChain([pdfViewerRef, 'access', _256 => _256.current, 'optionalAccess', _257 => _257.selection, 'access', _258 => _258.clearSelection, 'call', _259 => _259()]),
1814
+ copy: () => _optionalChain([pdfViewerRef, 'access', _260 => _260.current, 'optionalAccess', _261 => _261.selection, 'access', _262 => _262.copy, 'call', _263 => _263()]),
1815
+ rotateForward: () => _optionalChain([pdfViewerRef, 'access', _264 => _264.current, 'optionalAccess', _265 => _265.rotate, 'optionalAccess', _266 => _266.rotateForward, 'call', _267 => _267()]),
1816
+ rotateBackward: () => _optionalChain([pdfViewerRef, 'access', _268 => _268.current, 'optionalAccess', _269 => _269.rotate, 'optionalAccess', _270 => _270.rotateBackward, 'call', _271 => _271()]),
1817
+ getRotation: () => _optionalChain([pdfViewerRef, 'access', _272 => _272.current, 'optionalAccess', _273 => _273.rotate, 'optionalAccess', _274 => _274.getRotation, 'call', _275 => _275()]) || 0,
1818
+ print: () => _optionalChain([pdfViewerRef, 'access', _276 => _276.current, 'optionalAccess', _277 => _277.print, 'optionalAccess', _278 => _278.print, 'call', _279 => _279()]),
1741
1819
  printWithAnnotations: async () => {
1742
- await _optionalChain([pdfViewerRef, 'access', _264 => _264.current, 'optionalAccess', _265 => _265.print, 'optionalAccess', _266 => _266.printWithAnnotations, 'optionalCall', _267 => _267()]);
1820
+ await _optionalChain([pdfViewerRef, 'access', _280 => _280.current, 'optionalAccess', _281 => _281.print, 'optionalAccess', _282 => _282.printWithAnnotations, 'optionalCall', _283 => _283()]);
1743
1821
  },
1744
1822
  printWithoutAnnotations: async () => {
1745
- await _optionalChain([pdfViewerRef, 'access', _268 => _268.current, 'optionalAccess', _269 => _269.print, 'optionalAccess', _270 => _270.printWithoutAnnotations, 'optionalCall', _271 => _271()]);
1823
+ await _optionalChain([pdfViewerRef, 'access', _284 => _284.current, 'optionalAccess', _285 => _285.print, 'optionalAccess', _286 => _286.printWithoutAnnotations, 'optionalCall', _287 => _287()]);
1824
+ },
1825
+ downloadWithAnnotations: async (filename) => {
1826
+ await _optionalChain([pdfViewerRef, 'access', _288 => _288.current, 'optionalAccess', _289 => _289.download, 'optionalAccess', _290 => _290.downloadWithAnnotations, 'optionalCall', _291 => _291(filename)]);
1827
+ },
1828
+ downloadWithoutAnnotations: async (filename) => {
1829
+ await _optionalChain([pdfViewerRef, 'access', _292 => _292.current, 'optionalAccess', _293 => _293.download, 'optionalAccess', _294 => _294.downloadWithoutAnnotations, 'optionalCall', _295 => _295(filename)]);
1746
1830
  },
1747
1831
  get annotation() {
1748
- return _optionalChain([pdfViewerRef, 'access', _272 => _272.current, 'optionalAccess', _273 => _273.annotation]);
1832
+ return _optionalChain([pdfViewerRef, 'access', _296 => _296.current, 'optionalAccess', _297 => _297.annotation]);
1749
1833
  },
1750
1834
  get download() {
1751
- return _optionalChain([pdfViewerRef, 'access', _274 => _274.current, 'optionalAccess', _275 => _275.download]);
1835
+ return _optionalChain([pdfViewerRef, 'access', _298 => _298.current, 'optionalAccess', _299 => _299.download]);
1752
1836
  }
1753
1837
  }),
1754
1838
  []
1755
1839
  );
1756
1840
  const updatePageDisplay = () => {
1757
1841
  requestAnimationFrame(() => {
1758
- const current = _optionalChain([pdfViewerRef, 'access', _276 => _276.current, 'optionalAccess', _277 => _277.navigation, 'access', _278 => _278.getCurrentPage, 'call', _279 => _279()]) || 1;
1842
+ const current = _optionalChain([pdfViewerRef, 'access', _300 => _300.current, 'optionalAccess', _301 => _301.navigation, 'access', _302 => _302.getCurrentPage, 'call', _303 => _303()]) || 1;
1759
1843
  setCurrentPage(current);
1760
1844
  });
1761
1845
  };
1762
1846
  const updateZoomDisplay = () => {
1763
1847
  requestAnimationFrame(() => {
1764
- const zoomValue = _optionalChain([pdfViewerRef, 'access', _280 => _280.current, 'optionalAccess', _281 => _281.zoom, 'access', _282 => _282.getZoom, 'call', _283 => _283()]);
1848
+ const zoomValue = _optionalChain([pdfViewerRef, 'access', _304 => _304.current, 'optionalAccess', _305 => _305.zoom, 'access', _306 => _306.getZoom, 'call', _307 => _307()]);
1765
1849
  if (typeof zoomValue === "number") {
1766
1850
  setZoom(Math.round(zoomValue * 100));
1767
1851
  }
@@ -1770,11 +1854,11 @@ var PDFViewerContent = _react.forwardRef.call(void 0,
1770
1854
  const handleSearch = async () => {
1771
1855
  if (!searchQuery.trim()) return;
1772
1856
  setIsSearching(true);
1773
- const results = await _optionalChain([pdfViewerRef, 'access', _284 => _284.current, 'optionalAccess', _285 => _285.search, 'access', _286 => _286.searchText, 'call', _287 => _287(
1857
+ const results = await _optionalChain([pdfViewerRef, 'access', _308 => _308.current, 'optionalAccess', _309 => _309.search, 'access', _310 => _310.searchText, 'call', _311 => _311(
1774
1858
  searchQuery
1775
1859
  )]);
1776
1860
  setIsSearching(false);
1777
- if (_optionalChain([results, 'optionalAccess', _288 => _288.results]) && Array.isArray(results.results) && results.results.length > 0) {
1861
+ if (_optionalChain([results, 'optionalAccess', _312 => _312.results]) && Array.isArray(results.results) && results.results.length > 0) {
1778
1862
  const formattedResults = formatSearchResults(results.results);
1779
1863
  updateSearchState(formattedResults);
1780
1864
  } else {
@@ -1792,19 +1876,18 @@ var PDFViewerContent = _react.forwardRef.call(void 0,
1792
1876
  setSearchResults([]);
1793
1877
  setTotalSearchResults(0);
1794
1878
  setCurrentSearchResultIndex(0);
1795
- _optionalChain([pdfViewerRef, 'access', _289 => _289.current, 'optionalAccess', _290 => _290.search, 'access', _291 => _291.stopSearch, 'call', _292 => _292()]);
1879
+ _optionalChain([pdfViewerRef, 'access', _313 => _313.current, 'optionalAccess', _314 => _314.search, 'access', _315 => _315.stopSearch, 'call', _316 => _316()]);
1796
1880
  return;
1797
1881
  }
1798
- if (!_optionalChain([pdfViewerRef, 'access', _293 => _293.current, 'optionalAccess', _294 => _294.search, 'optionalAccess', _295 => _295.searchText])) {
1882
+ if (!_optionalChain([pdfViewerRef, 'access', _317 => _317.current, 'optionalAccess', _318 => _318.search, 'optionalAccess', _319 => _319.searchText])) {
1799
1883
  console.warn("Search functionality not yet available");
1800
1884
  return;
1801
1885
  }
1802
1886
  setIsSearching(true);
1803
1887
  try {
1804
1888
  const results = await pdfViewerRef.current.search.searchText(keyword);
1805
- console.log("Search completed:", results);
1806
1889
  setIsSearching(false);
1807
- const hasValidResults = _optionalChain([results, 'optionalAccess', _296 => _296.results]) && Array.isArray(results.results) && results.results.length > 0;
1890
+ const hasValidResults = _optionalChain([results, 'optionalAccess', _320 => _320.results]) && Array.isArray(results.results) && results.results.length > 0;
1808
1891
  if (hasValidResults) {
1809
1892
  const formattedResults = formatSearchResults(results.results);
1810
1893
  updateSearchState(formattedResults);
@@ -1870,24 +1953,24 @@ var PDFViewerContent = _react.forwardRef.call(void 0,
1870
1953
  };
1871
1954
  const navigateToPage = (pageNumber) => {
1872
1955
  requestAnimationFrame(() => {
1873
- _optionalChain([pdfViewerRef, 'access', _297 => _297.current, 'optionalAccess', _298 => _298.navigation, 'access', _299 => _299.goToPage, 'call', _300 => _300(pageNumber)]);
1956
+ _optionalChain([pdfViewerRef, 'access', _321 => _321.current, 'optionalAccess', _322 => _322.navigation, 'access', _323 => _323.goToPage, 'call', _324 => _324(pageNumber)]);
1874
1957
  setCurrentPage(pageNumber);
1875
1958
  });
1876
1959
  };
1877
1960
  const handleSearchResultClick = (pageNumber, resultIndex) => {
1878
- _optionalChain([pdfViewerRef, 'access', _301 => _301.current, 'optionalAccess', _302 => _302.navigation, 'access', _303 => _303.goToPage, 'call', _304 => _304(pageNumber)]);
1961
+ _optionalChain([pdfViewerRef, 'access', _325 => _325.current, 'optionalAccess', _326 => _326.navigation, 'access', _327 => _327.goToPage, 'call', _328 => _328(pageNumber)]);
1879
1962
  setCurrentSearchResultIndex(resultIndex);
1880
1963
  setCurrentPage(pageNumber);
1881
- _optionalChain([pdfViewerRef, 'access', _305 => _305.current, 'optionalAccess', _306 => _306.search, 'access', _307 => _307.goToResult, 'call', _308 => _308(resultIndex)]);
1964
+ _optionalChain([pdfViewerRef, 'access', _329 => _329.current, 'optionalAccess', _330 => _330.search, 'access', _331 => _331.goToResult, 'call', _332 => _332(resultIndex)]);
1882
1965
  };
1883
1966
  const handleNextSearchResult = () => {
1884
1967
  if (currentSearchResultIndex < totalSearchResults - 1) {
1885
1968
  const nextIndex = currentSearchResultIndex + 1;
1886
1969
  setCurrentSearchResultIndex(nextIndex);
1887
- _optionalChain([pdfViewerRef, 'access', _309 => _309.current, 'optionalAccess', _310 => _310.search, 'access', _311 => _311.nextResult, 'call', _312 => _312()]);
1970
+ _optionalChain([pdfViewerRef, 'access', _333 => _333.current, 'optionalAccess', _334 => _334.search, 'access', _335 => _335.nextResult, 'call', _336 => _336()]);
1888
1971
  if (searchResults[nextIndex]) {
1889
1972
  const pageNumber = searchResults[nextIndex].pageNumber;
1890
- _optionalChain([pdfViewerRef, 'access', _313 => _313.current, 'optionalAccess', _314 => _314.navigation, 'access', _315 => _315.goToPage, 'call', _316 => _316(pageNumber)]);
1973
+ _optionalChain([pdfViewerRef, 'access', _337 => _337.current, 'optionalAccess', _338 => _338.navigation, 'access', _339 => _339.goToPage, 'call', _340 => _340(pageNumber)]);
1891
1974
  setCurrentPage(pageNumber);
1892
1975
  }
1893
1976
  }
@@ -1896,10 +1979,10 @@ var PDFViewerContent = _react.forwardRef.call(void 0,
1896
1979
  if (currentSearchResultIndex > 0) {
1897
1980
  const prevIndex = currentSearchResultIndex - 1;
1898
1981
  setCurrentSearchResultIndex(prevIndex);
1899
- _optionalChain([pdfViewerRef, 'access', _317 => _317.current, 'optionalAccess', _318 => _318.search, 'access', _319 => _319.previousResult, 'call', _320 => _320()]);
1982
+ _optionalChain([pdfViewerRef, 'access', _341 => _341.current, 'optionalAccess', _342 => _342.search, 'access', _343 => _343.previousResult, 'call', _344 => _344()]);
1900
1983
  if (searchResults[prevIndex]) {
1901
1984
  const pageNumber = searchResults[prevIndex].pageNumber;
1902
- _optionalChain([pdfViewerRef, 'access', _321 => _321.current, 'optionalAccess', _322 => _322.navigation, 'access', _323 => _323.goToPage, 'call', _324 => _324(pageNumber)]);
1985
+ _optionalChain([pdfViewerRef, 'access', _345 => _345.current, 'optionalAccess', _346 => _346.navigation, 'access', _347 => _347.goToPage, 'call', _348 => _348(pageNumber)]);
1903
1986
  setCurrentPage(pageNumber);
1904
1987
  }
1905
1988
  }
@@ -1930,12 +2013,12 @@ var PDFViewerContent = _react.forwardRef.call(void 0,
1930
2013
  }
1931
2014
  setPdfBuffer(arrayBuffer);
1932
2015
  setState("ready");
1933
- _optionalChain([onLoad, 'optionalCall', _325 => _325()]);
2016
+ _optionalChain([onLoad, 'optionalCall', _349 => _349()]);
1934
2017
  } catch (err) {
1935
2018
  const errorMessage = err.message || "Failed to load PDF";
1936
2019
  setState("error");
1937
2020
  setError(errorMessage);
1938
- _optionalChain([onError, 'optionalCall', _326 => _326(err)]);
2021
+ _optionalChain([onError, 'optionalCall', _350 => _350(err)]);
1939
2022
  }
1940
2023
  };
1941
2024
  loadPDF();
@@ -1973,44 +2056,31 @@ var PDFViewerContent = _react.forwardRef.call(void 0,
1973
2056
  setPasswordError("");
1974
2057
  }
1975
2058
  }, [passwordResolve]);
1976
- if (state === "loading") {
1977
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0,
1978
- "div",
1979
- {
1980
- style: {
1981
- display: "flex",
1982
- flexDirection: "column",
1983
- alignItems: "center",
1984
- justifyContent: "center",
1985
- height: "100%",
1986
- gap: "16px"
1987
- },
1988
- children: [
1989
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
1990
- "div",
1991
- {
1992
- className: "spinner",
1993
- style: {
1994
- width: "48px",
1995
- height: "48px",
1996
- border: "4px solid #f3f3f3",
1997
- borderTop: "4px solid #3498db",
1998
- borderRadius: "50%",
1999
- animation: "spin 1s linear infinite"
2000
- }
2001
- }
2002
- ),
2003
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { children: "Loading PDF..." }),
2004
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "style", { children: `
2005
- @keyframes spin {
2006
- 0% { transform: rotate(0deg); }
2007
- 100% { transform: rotate(360deg); }
2008
- }
2009
- ` })
2010
- ]
2011
- }
2012
- );
2013
- }
2059
+ const LoadingSpinner = ({ fileName: fileName2 }) => /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { style: {
2060
+ position: "absolute",
2061
+ inset: 0,
2062
+ zIndex: 50,
2063
+ backgroundColor: "#fff",
2064
+ display: "flex",
2065
+ flexDirection: "column",
2066
+ alignItems: "center",
2067
+ justifyContent: "center"
2068
+ }, children: [
2069
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "dms-loading-spinner", style: {
2070
+ width: "40px",
2071
+ height: "40px",
2072
+ border: "3px solid #f3f3f3",
2073
+ borderTop: "3px solid #3498db",
2074
+ borderRadius: "50%",
2075
+ animation: "spin 1s linear infinite"
2076
+ } }),
2077
+ fileName2 && /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "p", { style: { marginTop: "16px", color: "#666", fontSize: "14px" }, children: [
2078
+ "Loading ",
2079
+ fileName2,
2080
+ "..."
2081
+ ] }),
2082
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "style", { children: `@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }` })
2083
+ ] });
2014
2084
  if (state === "error" || error) {
2015
2085
  return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
2016
2086
  "div",
@@ -2042,135 +2112,136 @@ var PDFViewerContent = _react.forwardRef.call(void 0,
2042
2112
  }
2043
2113
  );
2044
2114
  }
2045
- if (!pdfBuffer || state !== "ready") {
2046
- return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
2047
- "div",
2048
- {
2049
- style: {
2050
- display: "flex",
2051
- alignItems: "center",
2052
- justifyContent: "center",
2053
- height: "100%"
2054
- },
2055
- children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "p", { children: "Preparing PDF..." })
2056
- }
2057
- );
2058
- }
2059
- return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { ref: containerRef, className: "pdf-viewer-container", children: [
2115
+ const isReady = pdfBuffer && state === "ready";
2116
+ const showOverlay = loading || !isReady || !isInternalReady;
2117
+ return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { ref: containerRef, className: "pdf-viewer-container", style: { position: "relative", height: "100%", width: "100%" }, children: [
2060
2118
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "style", { children: _chunk5ECHDPQZjs.toolbarStyles }),
2061
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PDFHeader, { fileName: resolvedFileName, fileExtension }),
2062
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
2063
- PDFToolbar,
2064
- {
2065
- currentPage,
2066
- totalPages,
2067
- zoom,
2068
- isSidebarOpen,
2069
- showPageNavigation,
2070
- showPageCount,
2071
- showZoomControls,
2072
- showSearch,
2073
- showRotation: !toolbar.isHidden("rotation"),
2074
- showMetadata: !toolbar.isHidden("metadata"),
2075
- showProperties: !toolbar.isHidden("properties"),
2076
- showDownload: !toolbar.isHidden("download"),
2077
- showPrint: !toolbar.isHidden("print"),
2078
- showTags: !toolbar.isHidden("tags"),
2079
- showHistory: !toolbar.isHidden("history"),
2080
- disabledRotateLeft: toolbar.isDisabled("rotateLeft"),
2081
- disabledRotateRight: false,
2082
- disabledMetadata: toolbar.isDisabled("metadata"),
2083
- disabledTags: toolbar.isDisabled("tags"),
2084
- disabledProperties: toolbar.isDisabled("properties"),
2085
- disabledHistory: toolbar.isDisabled("history"),
2086
- disabledDownload: toolbar.isDisabled("download"),
2087
- disabledPrint: toolbar.isDisabled("print"),
2088
- onFirstPage: toolbarHandlers.handleFirstPage,
2089
- onPreviousPage: toolbarHandlers.handlePreviousPage,
2090
- onNextPage: toolbarHandlers.handleNextPage,
2091
- onLastPage: toolbarHandlers.handleLastPage,
2092
- onPageInput: toolbarHandlers.handlePageInput,
2093
- onPageInputKeyPress: toolbarHandlers.handlePageInputKeyPress,
2094
- onZoomIn: toolbarHandlers.handleZoomIn,
2095
- onZoomOut: toolbarHandlers.handleZoomOut,
2096
- onFitToWidth: toolbarHandlers.handleFitToWidth,
2097
- onFitToPage: toolbarHandlers.handleFitToPage,
2098
- onToggleSidebar: toolbarHandlers.toggleSidebar,
2099
- onToggleFullScreen: toolbarHandlers.handleToggleFullScreen,
2100
- onRotateLeft: toolbarHandlers.handleRotateLeft,
2101
- onRotateRight: toolbarHandlers.handleRotateRight,
2102
- onDownloadClick: toolbar.getHandler("download", onDownloadClick),
2103
- onPrintClick: toolbar.getHandler("print", onPrintClick || toolbarHandlers.handlePrint),
2104
- onPrintWithAnnotations: toolbarHandlers.handlePrintWithAnnotations,
2105
- onPrintWithoutAnnotations: toolbarHandlers.handlePrintWithoutAnnotations,
2106
- onMetadataClick: toolbar.getHandler("metadata", onMetadataClick),
2107
- onPropertiesClick: toolbar.getHandler(
2108
- "properties",
2109
- onPropertiesClick
2110
- ),
2111
- onTagsClick: toolbar.getHandler("tags", onTagsClick),
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
2126
- }
2127
- ),
2128
- /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "pdf-viewer-main", children: [
2129
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "pdf-viewer-viewer-area", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
2130
- StablePDFViewer,
2119
+ showOverlay && /* @__PURE__ */ _jsxruntime.jsx.call(void 0, LoadingSpinner, { fileName: resolvedFileName }),
2120
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { style: { opacity: !showOverlay ? 1 : 0, height: "100%", display: "flex", flexDirection: "column" }, children: [
2121
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, PDFHeader, { fileName: resolvedFileName, fileExtension }),
2122
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
2123
+ PDFToolbar,
2131
2124
  {
2132
- pdfBuffer,
2133
- onPasswordRequest: handlePasswordRequest,
2134
- pdfViewerRef,
2125
+ currentPage,
2126
+ totalPages,
2127
+ zoom,
2128
+ isSidebarOpen,
2129
+ showPageNavigation,
2130
+ showPageCount,
2131
+ showZoomControls,
2132
+ showSearch,
2133
+ showRotation: !toolbar.isHidden("rotation"),
2134
+ showMetadata: !toolbar.isHidden("metadata"),
2135
+ showProperties: !toolbar.isHidden("properties"),
2136
+ showDownload: !toolbar.isHidden("download"),
2137
+ showPrint: !toolbar.isHidden("print"),
2138
+ showTags: !toolbar.isHidden("tags"),
2139
+ showHistory: !toolbar.isHidden("history"),
2140
+ disabledRotateLeft: toolbar.isDisabled("rotateLeft"),
2141
+ disabledRotateRight: false,
2142
+ disabledMetadata: toolbar.isDisabled("metadata"),
2143
+ disabledTags: toolbar.isDisabled("tags"),
2144
+ disabledProperties: toolbar.isDisabled("properties"),
2145
+ disabledHistory: toolbar.isDisabled("history"),
2146
+ disabledDownload: toolbar.isDisabled("download"),
2147
+ disabledPrint: toolbar.isDisabled("print"),
2148
+ onFirstPage: toolbarHandlers.handleFirstPage,
2149
+ onPreviousPage: toolbarHandlers.handlePreviousPage,
2150
+ onNextPage: toolbarHandlers.handleNextPage,
2151
+ onLastPage: toolbarHandlers.handleLastPage,
2152
+ onPageInput: toolbarHandlers.handlePageInput,
2153
+ onPageInputKeyPress: toolbarHandlers.handlePageInputKeyPress,
2154
+ onZoomIn: toolbarHandlers.handleZoomIn,
2155
+ onZoomOut: toolbarHandlers.handleZoomOut,
2156
+ onFitToWidth: toolbarHandlers.handleFitToWidth,
2157
+ onFitToPage: toolbarHandlers.handleFitToPage,
2158
+ onToggleSidebar: toolbarHandlers.toggleSidebar,
2159
+ onToggleFullScreen: toolbarHandlers.handleToggleFullScreen,
2160
+ onRotateLeft: toolbarHandlers.handleRotateLeft,
2161
+ onRotateRight: toolbarHandlers.handleRotateRight,
2162
+ onDownloadClick: toolbar.getHandler("download", onDownloadClick),
2163
+ onDownloadWithAnnotations: toolbarHandlers.handleDownloadWithAnnotations,
2164
+ onDownloadWithoutAnnotations: toolbarHandlers.handleDownloadWithoutAnnotations,
2165
+ onPrintClick: toolbar.getHandler("print", onPrintClick || toolbarHandlers.handlePrint),
2166
+ onPrintWithAnnotations: toolbarHandlers.handlePrintWithAnnotations,
2167
+ onPrintWithoutAnnotations: toolbarHandlers.handlePrintWithoutAnnotations,
2168
+ onCopyClick: toolbarHandlers.handleCopy,
2169
+ onMetadataClick: toolbar.getHandler("metadata", onMetadataClick),
2170
+ onPropertiesClick: toolbar.getHandler(
2171
+ "properties",
2172
+ onPropertiesClick
2173
+ ),
2174
+ onTagsClick: toolbar.getHandler("tags", onTagsClick),
2175
+ onHistoryClick: toolbar.getHandler("history", onHistoryClick),
2135
2176
  showAnnotations,
2136
- userDetails,
2137
- annotationSelectionMenu,
2138
2177
  isHighlighterActive: highlighterActive,
2139
2178
  isStampActive: stampActive,
2140
- onHighlighterClick: onHighlighterClick || toolbarHandlers.handleHighlighterClick,
2141
- onStampClick: onStampClick || toolbarHandlers.handleStampClick,
2142
- onSignatureClick: onSignatureClick || toolbarHandlers.handleSignatureClick,
2143
- permissions: props.permissions
2179
+ disabledHighlighter: toolbar.isDisabled("highlighter"),
2180
+ disabledStamp: toolbar.isDisabled("stamp"),
2181
+ disabledSignature: toolbar.isDisabled("signature"),
2182
+ onHighlighterClick: toolbar.getHandler("highlighter", onHighlighterClick || toolbarHandlers.handleHighlighterClick),
2183
+ onStampClick: toolbar.getHandler("stamp", onStampClick || toolbarHandlers.handleStampClick),
2184
+ onSignatureClick: toolbar.getHandler("signature", onSignatureClick || toolbarHandlers.handleSignatureClick),
2185
+ showAnnotate,
2186
+ disabledAnnotate,
2187
+ showPrintOriginal,
2188
+ showPrintWithAnnotations,
2189
+ showDownloadOriginal,
2190
+ showDownloadWithAnnotations,
2191
+ hasUnsavedAnnotations,
2192
+ isSavingAnnotations,
2193
+ canSaveAnnotations,
2194
+ onSaveAnnotations
2144
2195
  }
2145
- ) }),
2196
+ ),
2197
+ /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, "div", { className: "pdf-viewer-main", children: [
2198
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "div", { className: "pdf-viewer-viewer-area", children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
2199
+ StablePDFViewer,
2200
+ {
2201
+ pdfBuffer: pdfBuffer || new ArrayBuffer(0),
2202
+ onPasswordRequest: handlePasswordRequest,
2203
+ pdfViewerRef,
2204
+ hideInternalLoading: true,
2205
+ showAnnotations,
2206
+ userDetails,
2207
+ annotationSelectionMenu,
2208
+ isHighlighterActive: highlighterActive,
2209
+ isStampActive: stampActive,
2210
+ onHighlighterClick: onHighlighterClick || toolbarHandlers.handleHighlighterClick,
2211
+ onStampClick: onStampClick || toolbarHandlers.handleStampClick,
2212
+ onSignatureClick: onSignatureClick || toolbarHandlers.handleSignatureClick,
2213
+ permissions: props.permissions
2214
+ }
2215
+ ) }),
2216
+ /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
2217
+ SearchSidebar,
2218
+ {
2219
+ isOpen: isSidebarOpen,
2220
+ onClose: handleSidebarClose,
2221
+ onSearch: handleSidebarSearch,
2222
+ onSearchResultClick: handleSearchResultClick,
2223
+ onNextResult: handleNextSearchResult,
2224
+ onPreviousResult: handlePreviousSearchResult,
2225
+ currentResultIndex: currentSearchResultIndex,
2226
+ totalResults: totalSearchResults,
2227
+ searchKeyword: searchQuery,
2228
+ searchResults,
2229
+ isSearching
2230
+ }
2231
+ )
2232
+ ] }),
2146
2233
  /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
2147
- SearchSidebar,
2234
+ PasswordDialog,
2148
2235
  {
2149
- isOpen: isSidebarOpen,
2150
- onClose: handleSidebarClose,
2151
- onSearch: handleSidebarSearch,
2152
- onSearchResultClick: handleSearchResultClick,
2153
- onNextResult: handleNextSearchResult,
2154
- onPreviousResult: handlePreviousSearchResult,
2155
- currentResultIndex: currentSearchResultIndex,
2156
- totalResults: totalSearchResults,
2157
- searchKeyword: searchQuery,
2158
- searchResults,
2159
- isSearching
2236
+ open: isPasswordDialogOpen,
2237
+ fileName: resolvedFileName,
2238
+ onSubmit: handlePasswordSubmit,
2239
+ onCancel: handlePasswordCancel,
2240
+ error: passwordError,
2241
+ isLoading: isVerifyingPassword
2160
2242
  }
2161
2243
  )
2162
- ] }),
2163
- /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
2164
- PasswordDialog,
2165
- {
2166
- open: isPasswordDialogOpen,
2167
- fileName: resolvedFileName,
2168
- onSubmit: handlePasswordSubmit,
2169
- onCancel: handlePasswordCancel,
2170
- error: passwordError,
2171
- isLoading: isVerifyingPassword
2172
- }
2173
- )
2244
+ ] })
2174
2245
  ] });
2175
2246
  }
2176
2247
  );
@@ -2185,4 +2256,4 @@ PDFViewer.displayName = "PDFViewer";
2185
2256
 
2186
2257
 
2187
2258
  exports.PDFViewer = PDFViewer;
2188
- //# sourceMappingURL=chunk-26SS5FLZ.js.map
2259
+ //# sourceMappingURL=chunk-4JX2MJLJ.js.map