pdfjs-reader-core 0.2.5 → 0.2.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -346,6 +346,7 @@ function createViewerStore(initialOverrides = {}) {
346
346
  document: document2,
347
347
  numPages: document2.numPages,
348
348
  isLoading: false,
349
+ loadingProgress: null,
349
350
  error: null,
350
351
  currentPage: 1
351
352
  });
@@ -353,15 +354,22 @@ function createViewerStore(initialOverrides = {}) {
353
354
  set({
354
355
  document: null,
355
356
  numPages: 0,
356
- isLoading: false
357
+ isLoading: false,
358
+ loadingProgress: null
357
359
  });
358
360
  }
359
361
  },
360
- setLoading: (isLoading) => {
361
- set({ isLoading });
362
+ setLoading: (isLoading, progress) => {
363
+ set({
364
+ isLoading,
365
+ loadingProgress: isLoading ? progress ?? { phase: "initializing" } : null
366
+ });
367
+ },
368
+ setLoadingProgress: (progress) => {
369
+ set({ loadingProgress: progress });
362
370
  },
363
371
  setError: (error) => {
364
- set({ error, isLoading: false });
372
+ set({ error, isLoading: false, loadingProgress: null });
365
373
  },
366
374
  // Navigation actions
367
375
  setCurrentPage: (page) => {
@@ -509,6 +517,7 @@ var init_viewer_store = __esm({
509
517
  document: null,
510
518
  numPages: 0,
511
519
  isLoading: false,
520
+ loadingProgress: null,
512
521
  error: null,
513
522
  // Navigation state
514
523
  currentPage: 1,
@@ -4768,7 +4777,7 @@ var init_ThumbnailPanel = __esm({
4768
4777
  className,
4769
4778
  thumbnailScale = 0.2
4770
4779
  }) {
4771
- const { document: document2, currentPage, numPages, goToPage } = usePDFViewer();
4780
+ const { document: document2, currentPage, numPages, goToPage, isLoading } = usePDFViewer();
4772
4781
  const containerRef = (0, import_react18.useRef)(null);
4773
4782
  (0, import_react18.useEffect)(() => {
4774
4783
  const container = containerRef.current;
@@ -4785,6 +4794,9 @@ var init_ThumbnailPanel = __esm({
4785
4794
  [goToPage]
4786
4795
  );
4787
4796
  if (!document2) {
4797
+ if (isLoading) {
4798
+ return null;
4799
+ }
4788
4800
  return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: cn("thumbnail-panel p-4", className), children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "text-sm text-gray-500", children: "No document loaded" }) });
4789
4801
  }
4790
4802
  return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
@@ -5116,7 +5128,7 @@ var init_OutlinePanel = __esm({
5116
5128
  OutlinePanel = (0, import_react20.memo)(function OutlinePanel2({
5117
5129
  className
5118
5130
  }) {
5119
- const { document: document2, goToPage } = usePDFViewer();
5131
+ const { document: document2, goToPage, isLoading: isDocumentLoading } = usePDFViewer();
5120
5132
  const [outline, setOutline] = (0, import_react20.useState)(null);
5121
5133
  const [isLoading, setIsLoading] = (0, import_react20.useState)(false);
5122
5134
  const [error, setError] = (0, import_react20.useState)(null);
@@ -5195,6 +5207,9 @@ var init_OutlinePanel = __esm({
5195
5207
  [goToPage]
5196
5208
  );
5197
5209
  if (!document2) {
5210
+ if (isDocumentLoading) {
5211
+ return null;
5212
+ }
5198
5213
  return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: cn("flex items-center justify-center p-4", className), children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "text-sm text-gray-500 dark:text-gray-400", children: "No document loaded" }) });
5199
5214
  }
5200
5215
  if (isLoading) {
@@ -8234,6 +8249,7 @@ var init_DocumentContainer = __esm({
8234
8249
  scale,
8235
8250
  rotation,
8236
8251
  theme,
8252
+ isLoading,
8237
8253
  setScale,
8238
8254
  nextPage,
8239
8255
  previousPage
@@ -8373,6 +8389,9 @@ var init_DocumentContainer = __esm({
8373
8389
  sepia: "bg-amber-50"
8374
8390
  };
8375
8391
  if (!document2) {
8392
+ if (isLoading) {
8393
+ return null;
8394
+ }
8376
8395
  return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
8377
8396
  "div",
8378
8397
  {
@@ -8465,6 +8484,7 @@ var init_VirtualizedDocumentContainer = __esm({
8465
8484
  scale,
8466
8485
  rotation,
8467
8486
  theme,
8487
+ isLoading,
8468
8488
  setScale,
8469
8489
  goToPage,
8470
8490
  nextPage,
@@ -8720,6 +8740,9 @@ var init_VirtualizedDocumentContainer = __esm({
8720
8740
  sepia: "bg-amber-50"
8721
8741
  };
8722
8742
  if (!document2) {
8743
+ if (isLoading) {
8744
+ return null;
8745
+ }
8723
8746
  return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
8724
8747
  "div",
8725
8748
  {
@@ -8866,6 +8889,7 @@ var init_DualPageContainer = __esm({
8866
8889
  scale,
8867
8890
  rotation,
8868
8891
  theme,
8892
+ isLoading: isDocumentLoading,
8869
8893
  setScale,
8870
8894
  goToPage
8871
8895
  } = usePDFViewer();
@@ -9057,6 +9081,9 @@ var init_DualPageContainer = __esm({
9057
9081
  };
9058
9082
  const spread = getSpreadPages(currentPage);
9059
9083
  if (!document2) {
9084
+ if (isDocumentLoading) {
9085
+ return null;
9086
+ }
9060
9087
  return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
9061
9088
  "div",
9062
9089
  {
@@ -9295,6 +9322,138 @@ var init_FloatingZoomControls2 = __esm({
9295
9322
  }
9296
9323
  });
9297
9324
 
9325
+ // src/components/PDFLoadingScreen/PDFLoadingScreen.tsx
9326
+ function formatBytes(bytes) {
9327
+ if (bytes < 1024) return `${bytes} B`;
9328
+ if (bytes < 1024 * 1024) return `${(bytes / 1024).toFixed(1)} KB`;
9329
+ return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
9330
+ }
9331
+ var import_react40, import_jsx_runtime26, phaseMessages, PDFLoadingScreen;
9332
+ var init_PDFLoadingScreen = __esm({
9333
+ "src/components/PDFLoadingScreen/PDFLoadingScreen.tsx"() {
9334
+ "use strict";
9335
+ import_react40 = require("react");
9336
+ init_utils();
9337
+ import_jsx_runtime26 = require("react/jsx-runtime");
9338
+ phaseMessages = {
9339
+ initializing: "Initializing...",
9340
+ fetching: "Loading document...",
9341
+ parsing: "Processing pages...",
9342
+ rendering: "Preparing view..."
9343
+ };
9344
+ PDFLoadingScreen = (0, import_react40.memo)(function PDFLoadingScreen2({
9345
+ progress,
9346
+ bytesLoaded,
9347
+ totalBytes,
9348
+ phase = "fetching",
9349
+ documentName,
9350
+ className
9351
+ }) {
9352
+ const hasProgress = progress !== void 0 && progress >= 0;
9353
+ const hasBytes = bytesLoaded !== void 0 && totalBytes !== void 0 && totalBytes > 0;
9354
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
9355
+ "div",
9356
+ {
9357
+ className: cn(
9358
+ "pdf-loading-screen",
9359
+ "flex flex-col items-center justify-center",
9360
+ "w-full h-full min-h-[400px]",
9361
+ "bg-slate-50 dark:bg-slate-800",
9362
+ className
9363
+ ),
9364
+ role: "status",
9365
+ "aria-live": "polite",
9366
+ "aria-label": phaseMessages[phase],
9367
+ children: [
9368
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "pdf-loading-skeleton", children: [
9369
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "pdf-loading-icon", children: /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
9370
+ "svg",
9371
+ {
9372
+ width: "48",
9373
+ height: "56",
9374
+ viewBox: "0 0 48 56",
9375
+ fill: "none",
9376
+ xmlns: "http://www.w3.org/2000/svg",
9377
+ className: "pdf-document-icon",
9378
+ children: [
9379
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
9380
+ "path",
9381
+ {
9382
+ d: "M4 4C4 1.79086 5.79086 0 8 0H30L44 14V52C44 54.2091 42.2091 56 40 56H8C5.79086 56 4 54.2091 4 52V4Z",
9383
+ className: "fill-white dark:fill-slate-700"
9384
+ }
9385
+ ),
9386
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
9387
+ "path",
9388
+ {
9389
+ d: "M30 0L44 14H34C31.7909 14 30 12.2091 30 10V0Z",
9390
+ className: "fill-slate-200 dark:fill-slate-600"
9391
+ }
9392
+ ),
9393
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("rect", { x: "10", y: "22", width: "24", height: "3", rx: "1.5", className: "fill-slate-200 dark:fill-slate-600" }),
9394
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("rect", { x: "10", y: "28", width: "20", height: "3", rx: "1.5", className: "fill-slate-200 dark:fill-slate-600" }),
9395
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("rect", { x: "10", y: "34", width: "22", height: "3", rx: "1.5", className: "fill-slate-200 dark:fill-slate-600" }),
9396
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("rect", { x: "10", y: "40", width: "16", height: "3", rx: "1.5", className: "fill-slate-200 dark:fill-slate-600" }),
9397
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
9398
+ "path",
9399
+ {
9400
+ d: "M4 4C4 1.79086 5.79086 0 8 0H30L44 14V52C44 54.2091 42.2091 56 40 56H8C5.79086 56 4 54.2091 4 52V4Z",
9401
+ className: "stroke-slate-300 dark:stroke-slate-500",
9402
+ strokeWidth: "1",
9403
+ fill: "none"
9404
+ }
9405
+ )
9406
+ ]
9407
+ }
9408
+ ) }),
9409
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "pdf-skeleton-lines", children: [
9410
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "pdf-skeleton-line pdf-skeleton-line-1" }),
9411
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "pdf-skeleton-line pdf-skeleton-line-2" }),
9412
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "pdf-skeleton-line pdf-skeleton-line-3" })
9413
+ ] })
9414
+ ] }),
9415
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "pdf-loading-info", children: [
9416
+ documentName && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { className: "pdf-loading-document-name", children: documentName }),
9417
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("p", { className: "pdf-loading-message", children: phaseMessages[phase] }),
9418
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "pdf-loading-progress-container", children: [
9419
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "pdf-loading-progress-track", children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
9420
+ "div",
9421
+ {
9422
+ className: cn(
9423
+ "pdf-loading-progress-fill",
9424
+ !hasProgress && "pdf-loading-progress-indeterminate"
9425
+ ),
9426
+ style: hasProgress ? { width: `${Math.min(100, progress)}%` } : void 0
9427
+ }
9428
+ ) }),
9429
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "pdf-loading-progress-details", children: [
9430
+ hasProgress && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("span", { className: "pdf-loading-progress-percent", children: [
9431
+ Math.round(progress),
9432
+ "%"
9433
+ ] }),
9434
+ hasBytes && /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("span", { className: "pdf-loading-progress-bytes", children: [
9435
+ formatBytes(bytesLoaded),
9436
+ " / ",
9437
+ formatBytes(totalBytes)
9438
+ ] })
9439
+ ] })
9440
+ ] })
9441
+ ] })
9442
+ ]
9443
+ }
9444
+ );
9445
+ });
9446
+ }
9447
+ });
9448
+
9449
+ // src/components/PDFLoadingScreen/index.ts
9450
+ var init_PDFLoadingScreen2 = __esm({
9451
+ "src/components/PDFLoadingScreen/index.ts"() {
9452
+ "use strict";
9453
+ init_PDFLoadingScreen();
9454
+ }
9455
+ });
9456
+
9298
9457
  // src/components/PDFViewer/PDFViewerClient.tsx
9299
9458
  var PDFViewerClient_exports = {};
9300
9459
  __export(PDFViewerClient_exports, {
@@ -9339,11 +9498,11 @@ function calculateMatchRects3(textItems, startOffset, length, viewport) {
9339
9498
  }
9340
9499
  return rects;
9341
9500
  }
9342
- var import_react40, import_jsx_runtime26, PDFViewerInner, PDFViewerInnerWithRef, PDFViewerClient;
9501
+ var import_react41, import_jsx_runtime27, PDFViewerInner, PDFViewerInnerWithRef, PDFViewerClient;
9343
9502
  var init_PDFViewerClient = __esm({
9344
9503
  "src/components/PDFViewer/PDFViewerClient.tsx"() {
9345
9504
  "use strict";
9346
- import_react40 = require("react");
9505
+ import_react41 = require("react");
9347
9506
  init_hooks();
9348
9507
  init_utils();
9349
9508
  init_Toolbar2();
@@ -9353,9 +9512,10 @@ var init_PDFViewerClient = __esm({
9353
9512
  init_ContinuousScrollContainer();
9354
9513
  init_DualPageContainer();
9355
9514
  init_FloatingZoomControls2();
9515
+ init_PDFLoadingScreen2();
9356
9516
  init_utils();
9357
- import_jsx_runtime26 = require("react/jsx-runtime");
9358
- PDFViewerInner = (0, import_react40.memo)(function PDFViewerInner2({
9517
+ import_jsx_runtime27 = require("react/jsx-runtime");
9518
+ PDFViewerInner = (0, import_react41.memo)(function PDFViewerInner2({
9359
9519
  src,
9360
9520
  initialPage = 1,
9361
9521
  page: controlledPage,
@@ -9382,19 +9542,19 @@ var init_PDFViewerClient = __esm({
9382
9542
  onReady
9383
9543
  }) {
9384
9544
  const { viewerStore, annotationStore, searchStore } = usePDFViewerStores();
9385
- const mountedRef = (0, import_react40.useRef)(true);
9386
- const [, setLoadState] = (0, import_react40.useState)("idle");
9387
- const onDocumentLoadRef = (0, import_react40.useRef)(onDocumentLoad);
9388
- const onErrorRef = (0, import_react40.useRef)(onError);
9389
- const onPageChangeRef = (0, import_react40.useRef)(onPageChange);
9390
- const onScaleChangeRef = (0, import_react40.useRef)(onScaleChange);
9391
- const onZoomChangeRef = (0, import_react40.useRef)(onZoomChange);
9392
- const onPageRenderStartRef = (0, import_react40.useRef)(onPageRenderStart);
9393
- const onPageRenderCompleteRef = (0, import_react40.useRef)(onPageRenderComplete);
9394
- const onHighlightAddedRef = (0, import_react40.useRef)(onHighlightAdded);
9395
- const onHighlightRemovedRef = (0, import_react40.useRef)(onHighlightRemoved);
9396
- const onAnnotationAddedRef = (0, import_react40.useRef)(onAnnotationAdded);
9397
- const onReadyRef = (0, import_react40.useRef)(onReady);
9545
+ const mountedRef = (0, import_react41.useRef)(true);
9546
+ const [, setLoadState] = (0, import_react41.useState)("idle");
9547
+ const onDocumentLoadRef = (0, import_react41.useRef)(onDocumentLoad);
9548
+ const onErrorRef = (0, import_react41.useRef)(onError);
9549
+ const onPageChangeRef = (0, import_react41.useRef)(onPageChange);
9550
+ const onScaleChangeRef = (0, import_react41.useRef)(onScaleChange);
9551
+ const onZoomChangeRef = (0, import_react41.useRef)(onZoomChange);
9552
+ const onPageRenderStartRef = (0, import_react41.useRef)(onPageRenderStart);
9553
+ const onPageRenderCompleteRef = (0, import_react41.useRef)(onPageRenderComplete);
9554
+ const onHighlightAddedRef = (0, import_react41.useRef)(onHighlightAdded);
9555
+ const onHighlightRemovedRef = (0, import_react41.useRef)(onHighlightRemoved);
9556
+ const onAnnotationAddedRef = (0, import_react41.useRef)(onAnnotationAdded);
9557
+ const onReadyRef = (0, import_react41.useRef)(onReady);
9398
9558
  onDocumentLoadRef.current = onDocumentLoad;
9399
9559
  onErrorRef.current = onError;
9400
9560
  onPageChangeRef.current = onPageChange;
@@ -9407,17 +9567,18 @@ var init_PDFViewerClient = __esm({
9407
9567
  onAnnotationAddedRef.current = onAnnotationAdded;
9408
9568
  onReadyRef.current = onReady;
9409
9569
  const isControlled = controlledPage !== void 0;
9410
- const prevControlledPageRef = (0, import_react40.useRef)(controlledPage);
9411
- const srcIdRef = (0, import_react40.useRef)(null);
9570
+ const prevControlledPageRef = (0, import_react41.useRef)(controlledPage);
9571
+ const srcIdRef = (0, import_react41.useRef)(null);
9412
9572
  const currentPage = useViewerStore((s) => s.currentPage);
9413
9573
  const scale = useViewerStore((s) => s.scale);
9414
9574
  const theme = useViewerStore((s) => s.theme);
9415
9575
  const isLoading = useViewerStore((s) => s.isLoading);
9576
+ const loadingProgress = useViewerStore((s) => s.loadingProgress);
9416
9577
  const error = useViewerStore((s) => s.error);
9417
9578
  const sidebarOpen = useViewerStore((s) => s.sidebarOpen);
9418
9579
  const srcId = getSrcIdentifier(src);
9419
- const handleRef = (0, import_react40.useRef)(null);
9420
- (0, import_react40.useEffect)(() => {
9580
+ const handleRef = (0, import_react41.useRef)(null);
9581
+ (0, import_react41.useEffect)(() => {
9421
9582
  const handle = {
9422
9583
  // ==================== Text Highlighting ====================
9423
9584
  highlightText: async (text, options) => {
@@ -9835,18 +9996,18 @@ var init_PDFViewerClient = __esm({
9835
9996
  handleRef.current = handle;
9836
9997
  onReadyRef.current?.(handle);
9837
9998
  }, [viewerStore, annotationStore, searchStore]);
9838
- const handleRetry = (0, import_react40.useCallback)(() => {
9999
+ const handleRetry = (0, import_react41.useCallback)(() => {
9839
10000
  srcIdRef.current = null;
9840
10001
  viewerStore.getState().setError(null);
9841
10002
  setLoadState("idle");
9842
10003
  }, [viewerStore]);
9843
- (0, import_react40.useEffect)(() => {
10004
+ (0, import_react41.useEffect)(() => {
9844
10005
  mountedRef.current = true;
9845
10006
  return () => {
9846
10007
  mountedRef.current = false;
9847
10008
  };
9848
10009
  }, []);
9849
- (0, import_react40.useEffect)(() => {
10010
+ (0, import_react41.useEffect)(() => {
9850
10011
  if (srcIdRef.current === srcId && viewerStore.getState().document) {
9851
10012
  return;
9852
10013
  }
@@ -9860,13 +10021,27 @@ var init_PDFViewerClient = __esm({
9860
10021
  const loadDoc = async () => {
9861
10022
  if (!mountedRef.current) return;
9862
10023
  try {
9863
- viewerStore.getState().setLoading(true);
10024
+ viewerStore.getState().setLoading(true, { phase: "fetching" });
9864
10025
  viewerStore.getState().setError(null);
9865
10026
  setLoadState("loading");
9866
10027
  const { document: document2, numPages } = await loadDocument({
9867
10028
  src,
9868
- workerSrc
10029
+ workerSrc,
10030
+ onProgress: ({ loaded, total }) => {
10031
+ if (mountedRef.current && srcIdRef.current === loadId) {
10032
+ const percent = total > 0 ? Math.round(loaded / total * 100) : void 0;
10033
+ viewerStore.getState().setLoadingProgress({
10034
+ phase: "fetching",
10035
+ percent,
10036
+ bytesLoaded: loaded,
10037
+ totalBytes: total
10038
+ });
10039
+ }
10040
+ }
9869
10041
  });
10042
+ if (mountedRef.current && srcIdRef.current === loadId) {
10043
+ viewerStore.getState().setLoadingProgress({ phase: "parsing", percent: 100 });
10044
+ }
9870
10045
  if (mountedRef.current && srcIdRef.current === loadId) {
9871
10046
  viewerStore.getState().setDocument(document2);
9872
10047
  setLoadState("loaded");
@@ -9898,22 +10073,22 @@ var init_PDFViewerClient = __esm({
9898
10073
  return () => {
9899
10074
  };
9900
10075
  }, [srcId, src, workerSrc, initialPage, initialScale, viewerStore]);
9901
- const prevPageRef = (0, import_react40.useRef)(currentPage);
9902
- (0, import_react40.useEffect)(() => {
10076
+ const prevPageRef = (0, import_react41.useRef)(currentPage);
10077
+ (0, import_react41.useEffect)(() => {
9903
10078
  if (prevPageRef.current !== currentPage) {
9904
10079
  prevPageRef.current = currentPage;
9905
10080
  onPageChangeRef.current?.(currentPage);
9906
10081
  }
9907
10082
  }, [currentPage]);
9908
- const prevScaleRef = (0, import_react40.useRef)(scale);
9909
- (0, import_react40.useEffect)(() => {
10083
+ const prevScaleRef = (0, import_react41.useRef)(scale);
10084
+ (0, import_react41.useEffect)(() => {
9910
10085
  if (prevScaleRef.current !== scale) {
9911
10086
  prevScaleRef.current = scale;
9912
10087
  onScaleChangeRef.current?.(scale);
9913
10088
  onZoomChangeRef.current?.(scale);
9914
10089
  }
9915
10090
  }, [scale]);
9916
- (0, import_react40.useEffect)(() => {
10091
+ (0, import_react41.useEffect)(() => {
9917
10092
  if (!isControlled || controlledPage === void 0) return;
9918
10093
  if (prevControlledPageRef.current === controlledPage) return;
9919
10094
  prevControlledPageRef.current = controlledPage;
@@ -9926,7 +10101,7 @@ var init_PDFViewerClient = __esm({
9926
10101
  if (error) {
9927
10102
  if (errorComponent) {
9928
10103
  const errorContent = typeof errorComponent === "function" ? errorComponent(error, handleRetry) : errorComponent;
9929
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
10104
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
9930
10105
  "div",
9931
10106
  {
9932
10107
  className: cn(
@@ -9940,7 +10115,7 @@ var init_PDFViewerClient = __esm({
9940
10115
  }
9941
10116
  );
9942
10117
  }
9943
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
10118
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
9944
10119
  "div",
9945
10120
  {
9946
10121
  className: cn(
@@ -9950,10 +10125,10 @@ var init_PDFViewerClient = __esm({
9950
10125
  themeClass,
9951
10126
  className
9952
10127
  ),
9953
- children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "flex-1 flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "text-center p-8", children: [
9954
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "text-red-500 text-lg font-semibold mb-2", children: "Failed to load PDF" }),
9955
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "text-gray-500 text-sm", children: error.message }),
9956
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
10128
+ children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "flex-1 flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "text-center p-8", children: [
10129
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "text-red-500 text-lg font-semibold mb-2", children: "Failed to load PDF" }),
10130
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "text-gray-500 text-sm", children: error.message }),
10131
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
9957
10132
  "button",
9958
10133
  {
9959
10134
  onClick: handleRetry,
@@ -9968,15 +10143,15 @@ var init_PDFViewerClient = __esm({
9968
10143
  const renderContainer = () => {
9969
10144
  switch (viewMode) {
9970
10145
  case "continuous":
9971
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ContinuousScrollContainer, {});
10146
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(ContinuousScrollContainer, {});
9972
10147
  case "dual":
9973
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(DualPageContainer, {});
10148
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(DualPageContainer, {});
9974
10149
  case "single":
9975
10150
  default:
9976
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(DocumentContainer, {});
10151
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(DocumentContainer, {});
9977
10152
  }
9978
10153
  };
9979
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
10154
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(
9980
10155
  "div",
9981
10156
  {
9982
10157
  className: cn(
@@ -9988,25 +10163,30 @@ var init_PDFViewerClient = __esm({
9988
10163
  className
9989
10164
  ),
9990
10165
  children: [
9991
- showToolbar && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Toolbar, {}),
9992
- showAnnotationToolbar && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(AnnotationToolbar, {}),
9993
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex flex-1 overflow-hidden", children: [
9994
- showSidebar && sidebarOpen && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(Sidebar, {}),
10166
+ showToolbar && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Toolbar, {}),
10167
+ showAnnotationToolbar && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(AnnotationToolbar, {}),
10168
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex flex-1 overflow-hidden", children: [
10169
+ showSidebar && sidebarOpen && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Sidebar, {}),
9995
10170
  renderContainer()
9996
10171
  ] }),
9997
- showFloatingZoom && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(FloatingZoomControls, { position: "bottom-right" }),
9998
- isLoading && /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "absolute inset-0 flex items-center justify-center bg-white/80 dark:bg-gray-900/80", children: loadingComponent ?? /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "flex flex-col items-center", children: [
9999
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "w-8 h-8 border-4 border-blue-500 border-t-transparent rounded-full animate-spin" }),
10000
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "mt-2 text-sm text-gray-500", children: "Loading PDF..." })
10001
- ] }) })
10172
+ showFloatingZoom && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(FloatingZoomControls, { position: "bottom-right" }),
10173
+ isLoading && /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "absolute inset-0 z-50", children: loadingComponent ?? /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
10174
+ PDFLoadingScreen,
10175
+ {
10176
+ phase: loadingProgress?.phase ?? "fetching",
10177
+ progress: loadingProgress?.percent,
10178
+ bytesLoaded: loadingProgress?.bytesLoaded,
10179
+ totalBytes: loadingProgress?.totalBytes
10180
+ }
10181
+ ) })
10002
10182
  ]
10003
10183
  }
10004
10184
  );
10005
10185
  });
10006
- PDFViewerInnerWithRef = (0, import_react40.forwardRef)(
10186
+ PDFViewerInnerWithRef = (0, import_react41.forwardRef)(
10007
10187
  function PDFViewerInnerWithRef2(props, ref) {
10008
- const handleRef = (0, import_react40.useRef)(null);
10009
- const handleReady = (0, import_react40.useCallback)((handle) => {
10188
+ const handleRef = (0, import_react41.useRef)(null);
10189
+ const handleReady = (0, import_react41.useCallback)((handle) => {
10010
10190
  handleRef.current = handle;
10011
10191
  if (typeof ref === "function") {
10012
10192
  ref(handle);
@@ -10014,17 +10194,17 @@ var init_PDFViewerClient = __esm({
10014
10194
  ref.current = handle;
10015
10195
  }
10016
10196
  }, [ref]);
10017
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(PDFViewerInner, { ...props, onReady: handleReady });
10197
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(PDFViewerInner, { ...props, onReady: handleReady });
10018
10198
  }
10019
10199
  );
10020
- PDFViewerClient = (0, import_react40.memo)(
10021
- (0, import_react40.forwardRef)(function PDFViewerClient2(props, ref) {
10022
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
10200
+ PDFViewerClient = (0, import_react41.memo)(
10201
+ (0, import_react41.forwardRef)(function PDFViewerClient2(props, ref) {
10202
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
10023
10203
  PDFViewerProvider,
10024
10204
  {
10025
10205
  theme: props.theme,
10026
10206
  defaultSidebarPanel: props.defaultSidebarPanel,
10027
- children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(PDFViewerInnerWithRef, { ref, ...props })
10207
+ children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(PDFViewerInnerWithRef, { ref, ...props })
10028
10208
  }
10029
10209
  );
10030
10210
  })
@@ -10033,20 +10213,20 @@ var init_PDFViewerClient = __esm({
10033
10213
  });
10034
10214
 
10035
10215
  // src/components/PDFViewer/PDFViewer.tsx
10036
- var import_react41, import_jsx_runtime27, PDFViewerClient3, PDFViewerLoading, PDFViewer;
10216
+ var import_react42, import_jsx_runtime28, PDFViewerClient3, PDFViewerLoading, PDFViewer;
10037
10217
  var init_PDFViewer = __esm({
10038
10218
  "src/components/PDFViewer/PDFViewer.tsx"() {
10039
10219
  "use strict";
10040
- import_react41 = require("react");
10220
+ import_react42 = require("react");
10041
10221
  init_utils();
10042
- import_jsx_runtime27 = require("react/jsx-runtime");
10043
- PDFViewerClient3 = (0, import_react41.lazy)(
10222
+ import_jsx_runtime28 = require("react/jsx-runtime");
10223
+ PDFViewerClient3 = (0, import_react42.lazy)(
10044
10224
  () => Promise.resolve().then(() => (init_PDFViewerClient(), PDFViewerClient_exports)).then((mod) => ({ default: mod.PDFViewerClient }))
10045
10225
  );
10046
- PDFViewerLoading = (0, import_react41.memo)(function PDFViewerLoading2({
10226
+ PDFViewerLoading = (0, import_react42.memo)(function PDFViewerLoading2({
10047
10227
  className
10048
10228
  }) {
10049
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
10229
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
10050
10230
  "div",
10051
10231
  {
10052
10232
  className: cn(
@@ -10055,18 +10235,18 @@ var init_PDFViewer = __esm({
10055
10235
  "bg-white dark:bg-gray-900",
10056
10236
  className
10057
10237
  ),
10058
- children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "flex-1 flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { className: "flex flex-col items-center", children: [
10059
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "w-8 h-8 border-4 border-blue-500 border-t-transparent rounded-full animate-spin" }),
10060
- /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { className: "mt-2 text-sm text-gray-500", children: "Loading PDF viewer..." })
10238
+ children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "flex-1 flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex flex-col items-center", children: [
10239
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "w-8 h-8 border-4 border-blue-500 border-t-transparent rounded-full animate-spin" }),
10240
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "mt-2 text-sm text-gray-500", children: "Loading PDF viewer..." })
10061
10241
  ] }) })
10062
10242
  }
10063
10243
  );
10064
10244
  });
10065
- PDFViewer = (0, import_react41.memo)(function PDFViewer2(props) {
10245
+ PDFViewer = (0, import_react42.memo)(function PDFViewer2(props) {
10066
10246
  if (typeof window === "undefined") {
10067
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(PDFViewerLoading, { className: props.className });
10247
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(PDFViewerLoading, { className: props.className });
10068
10248
  }
10069
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_react41.Suspense, { fallback: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(PDFViewerLoading, { className: props.className }), children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(PDFViewerClient3, { ...props }) });
10249
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_react42.Suspense, { fallback: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(PDFViewerLoading, { className: props.className }), children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(PDFViewerClient3, { ...props }) });
10070
10250
  });
10071
10251
  }
10072
10252
  });
@@ -10107,6 +10287,7 @@ __export(index_exports, {
10107
10287
  MobileToolbar: () => MobileToolbar,
10108
10288
  OutlinePanel: () => OutlinePanel,
10109
10289
  PDFErrorBoundary: () => PDFErrorBoundary,
10290
+ PDFLoadingScreen: () => PDFLoadingScreen,
10110
10291
  PDFPage: () => PDFPage,
10111
10292
  PDFThumbnailNav: () => PDFThumbnailNav,
10112
10293
  PDFViewer: () => PDFViewer,
@@ -10218,9 +10399,9 @@ init_HighlightPopover2();
10218
10399
  init_AnnotationToolbar2();
10219
10400
 
10220
10401
  // src/components/Annotations/StickyNote.tsx
10221
- var import_react42 = require("react");
10402
+ var import_react43 = require("react");
10222
10403
  init_utils();
10223
- var import_jsx_runtime28 = require("react/jsx-runtime");
10404
+ var import_jsx_runtime29 = require("react/jsx-runtime");
10224
10405
  var NOTE_COLORS = [
10225
10406
  "#fef08a",
10226
10407
  // yellow
@@ -10233,7 +10414,7 @@ var NOTE_COLORS = [
10233
10414
  "#fed7aa"
10234
10415
  // orange
10235
10416
  ];
10236
- var StickyNote = (0, import_react42.memo)(function StickyNote2({
10417
+ var StickyNote = (0, import_react43.memo)(function StickyNote2({
10237
10418
  note,
10238
10419
  scale,
10239
10420
  isSelected,
@@ -10246,37 +10427,37 @@ var StickyNote = (0, import_react42.memo)(function StickyNote2({
10246
10427
  onDragStart,
10247
10428
  className
10248
10429
  }) {
10249
- const [isExpanded, setIsExpanded] = (0, import_react42.useState)(false);
10250
- const [localContent, setLocalContent] = (0, import_react42.useState)(note.content);
10251
- const textareaRef = (0, import_react42.useRef)(null);
10252
- const noteRef = (0, import_react42.useRef)(null);
10253
- (0, import_react42.useEffect)(() => {
10430
+ const [isExpanded, setIsExpanded] = (0, import_react43.useState)(false);
10431
+ const [localContent, setLocalContent] = (0, import_react43.useState)(note.content);
10432
+ const textareaRef = (0, import_react43.useRef)(null);
10433
+ const noteRef = (0, import_react43.useRef)(null);
10434
+ (0, import_react43.useEffect)(() => {
10254
10435
  setLocalContent(note.content);
10255
10436
  }, [note.content]);
10256
- (0, import_react42.useEffect)(() => {
10437
+ (0, import_react43.useEffect)(() => {
10257
10438
  if (isEditing && textareaRef.current) {
10258
10439
  textareaRef.current.focus();
10259
10440
  textareaRef.current.select();
10260
10441
  }
10261
10442
  }, [isEditing]);
10262
- const handleClick = (0, import_react42.useCallback)((e) => {
10443
+ const handleClick = (0, import_react43.useCallback)((e) => {
10263
10444
  e.stopPropagation();
10264
10445
  onSelect?.();
10265
10446
  if (!isExpanded) {
10266
10447
  setIsExpanded(true);
10267
10448
  }
10268
10449
  }, [isExpanded, onSelect]);
10269
- const handleDoubleClick = (0, import_react42.useCallback)((e) => {
10450
+ const handleDoubleClick = (0, import_react43.useCallback)((e) => {
10270
10451
  e.stopPropagation();
10271
10452
  onStartEdit?.();
10272
10453
  }, [onStartEdit]);
10273
- const handleBlur = (0, import_react42.useCallback)(() => {
10454
+ const handleBlur = (0, import_react43.useCallback)(() => {
10274
10455
  if (isEditing && localContent !== note.content) {
10275
10456
  onUpdate?.({ content: localContent });
10276
10457
  }
10277
10458
  onEndEdit?.();
10278
10459
  }, [isEditing, localContent, note.content, onUpdate, onEndEdit]);
10279
- const handleKeyDown = (0, import_react42.useCallback)((e) => {
10460
+ const handleKeyDown = (0, import_react43.useCallback)((e) => {
10280
10461
  if (e.key === "Escape") {
10281
10462
  setLocalContent(note.content);
10282
10463
  onEndEdit?.();
@@ -10284,16 +10465,16 @@ var StickyNote = (0, import_react42.memo)(function StickyNote2({
10284
10465
  handleBlur();
10285
10466
  }
10286
10467
  }, [note.content, onEndEdit, handleBlur]);
10287
- const handleColorChange = (0, import_react42.useCallback)((color) => {
10468
+ const handleColorChange = (0, import_react43.useCallback)((color) => {
10288
10469
  onUpdate?.({ color });
10289
10470
  }, [onUpdate]);
10290
- const handleCollapse = (0, import_react42.useCallback)((e) => {
10471
+ const handleCollapse = (0, import_react43.useCallback)((e) => {
10291
10472
  e.stopPropagation();
10292
10473
  setIsExpanded(false);
10293
10474
  onEndEdit?.();
10294
10475
  }, [onEndEdit]);
10295
10476
  if (!isExpanded) {
10296
- return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
10477
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
10297
10478
  "div",
10298
10479
  {
10299
10480
  ref: noteRef,
@@ -10314,14 +10495,14 @@ var StickyNote = (0, import_react42.memo)(function StickyNote2({
10314
10495
  onMouseDown: onDragStart,
10315
10496
  onTouchStart: onDragStart,
10316
10497
  title: note.content || "Empty note",
10317
- children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
10498
+ children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
10318
10499
  "svg",
10319
10500
  {
10320
10501
  className: "w-4 h-4 opacity-70",
10321
10502
  fill: "currentColor",
10322
10503
  viewBox: "0 0 20 20",
10323
10504
  style: { color: "#333" },
10324
- children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
10505
+ children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
10325
10506
  "path",
10326
10507
  {
10327
10508
  fillRule: "evenodd",
@@ -10334,7 +10515,7 @@ var StickyNote = (0, import_react42.memo)(function StickyNote2({
10334
10515
  }
10335
10516
  );
10336
10517
  }
10337
- return /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
10518
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
10338
10519
  "div",
10339
10520
  {
10340
10521
  ref: noteRef,
@@ -10352,14 +10533,14 @@ var StickyNote = (0, import_react42.memo)(function StickyNote2({
10352
10533
  },
10353
10534
  onClick: handleClick,
10354
10535
  children: [
10355
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(
10536
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(
10356
10537
  "div",
10357
10538
  {
10358
10539
  className: "flex items-center justify-between px-2 py-1 border-b border-black/10 cursor-move",
10359
10540
  onMouseDown: onDragStart,
10360
10541
  onTouchStart: onDragStart,
10361
10542
  children: [
10362
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "flex gap-1", children: NOTE_COLORS.map((color) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
10543
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "flex gap-1", children: NOTE_COLORS.map((color) => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
10363
10544
  "button",
10364
10545
  {
10365
10546
  className: cn(
@@ -10376,8 +10557,8 @@ var StickyNote = (0, import_react42.memo)(function StickyNote2({
10376
10557
  },
10377
10558
  color
10378
10559
  )) }),
10379
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { className: "flex gap-1", children: [
10380
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
10560
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "flex gap-1", children: [
10561
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
10381
10562
  "button",
10382
10563
  {
10383
10564
  className: "p-0.5 hover:bg-black/10 rounded",
@@ -10386,23 +10567,23 @@ var StickyNote = (0, import_react42.memo)(function StickyNote2({
10386
10567
  onDelete?.();
10387
10568
  },
10388
10569
  title: "Delete note",
10389
- children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("svg", { className: "w-3.5 h-3.5 text-gray-600", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16" }) })
10570
+ children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("svg", { className: "w-3.5 h-3.5 text-gray-600", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16" }) })
10390
10571
  }
10391
10572
  ),
10392
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
10573
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
10393
10574
  "button",
10394
10575
  {
10395
10576
  className: "p-0.5 hover:bg-black/10 rounded",
10396
10577
  onClick: handleCollapse,
10397
10578
  title: "Collapse note",
10398
- children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("svg", { className: "w-3.5 h-3.5 text-gray-600", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M6 18L18 6M6 6l12 12" }) })
10579
+ children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("svg", { className: "w-3.5 h-3.5 text-gray-600", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M6 18L18 6M6 6l12 12" }) })
10399
10580
  }
10400
10581
  )
10401
10582
  ] })
10402
10583
  ]
10403
10584
  }
10404
10585
  ),
10405
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "p-2", children: isEditing ? /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
10586
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "p-2", children: isEditing ? /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
10406
10587
  "textarea",
10407
10588
  {
10408
10589
  ref: textareaRef,
@@ -10417,7 +10598,7 @@ var StickyNote = (0, import_react42.memo)(function StickyNote2({
10417
10598
  onKeyDown: handleKeyDown,
10418
10599
  placeholder: "Enter note..."
10419
10600
  }
10420
- ) : /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
10601
+ ) : /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
10421
10602
  "div",
10422
10603
  {
10423
10604
  className: cn(
@@ -10428,16 +10609,16 @@ var StickyNote = (0, import_react42.memo)(function StickyNote2({
10428
10609
  children: note.content || "Double-click to edit..."
10429
10610
  }
10430
10611
  ) }),
10431
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { className: "px-2 pb-1 text-[10px] text-gray-500", children: new Date(note.updatedAt).toLocaleDateString() })
10612
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "px-2 pb-1 text-[10px] text-gray-500", children: new Date(note.updatedAt).toLocaleDateString() })
10432
10613
  ]
10433
10614
  }
10434
10615
  );
10435
10616
  });
10436
10617
 
10437
10618
  // src/components/Annotations/DrawingCanvas.tsx
10438
- var import_react43 = require("react");
10619
+ var import_react44 = require("react");
10439
10620
  init_utils();
10440
- var import_jsx_runtime29 = require("react/jsx-runtime");
10621
+ var import_jsx_runtime30 = require("react/jsx-runtime");
10441
10622
  function pointsToSvgPath(points) {
10442
10623
  if (points.length === 0) return "";
10443
10624
  if (points.length === 1) {
@@ -10475,7 +10656,7 @@ function simplifyPath(points, tolerance = 1) {
10475
10656
  result.push(points[points.length - 1]);
10476
10657
  return result;
10477
10658
  }
10478
- var DrawingCanvas = (0, import_react43.memo)(function DrawingCanvas2({
10659
+ var DrawingCanvas = (0, import_react44.memo)(function DrawingCanvas2({
10479
10660
  width,
10480
10661
  height,
10481
10662
  scale,
@@ -10485,10 +10666,10 @@ var DrawingCanvas = (0, import_react43.memo)(function DrawingCanvas2({
10485
10666
  onDrawingComplete,
10486
10667
  className
10487
10668
  }) {
10488
- const svgRef = (0, import_react43.useRef)(null);
10489
- const [isDrawing, setIsDrawing] = (0, import_react43.useState)(false);
10490
- const [currentPath, setCurrentPath] = (0, import_react43.useState)([]);
10491
- const getPoint = (0, import_react43.useCallback)((e) => {
10669
+ const svgRef = (0, import_react44.useRef)(null);
10670
+ const [isDrawing, setIsDrawing] = (0, import_react44.useState)(false);
10671
+ const [currentPath, setCurrentPath] = (0, import_react44.useState)([]);
10672
+ const getPoint = (0, import_react44.useCallback)((e) => {
10492
10673
  if (!svgRef.current) return null;
10493
10674
  const svg = svgRef.current;
10494
10675
  const rect = svg.getBoundingClientRect();
@@ -10508,7 +10689,7 @@ var DrawingCanvas = (0, import_react43.memo)(function DrawingCanvas2({
10508
10689
  y: (clientY - rect.top) / scale
10509
10690
  };
10510
10691
  }, [scale]);
10511
- const handleStart = (0, import_react43.useCallback)((e) => {
10692
+ const handleStart = (0, import_react44.useCallback)((e) => {
10512
10693
  if (!isActive) return;
10513
10694
  const point = getPoint(e);
10514
10695
  if (point) {
@@ -10516,14 +10697,14 @@ var DrawingCanvas = (0, import_react43.memo)(function DrawingCanvas2({
10516
10697
  setCurrentPath([point]);
10517
10698
  }
10518
10699
  }, [isActive, getPoint]);
10519
- const handleMove = (0, import_react43.useCallback)((e) => {
10700
+ const handleMove = (0, import_react44.useCallback)((e) => {
10520
10701
  if (!isDrawing || !isActive) return;
10521
10702
  const point = getPoint(e);
10522
10703
  if (point) {
10523
10704
  setCurrentPath((prev) => [...prev, point]);
10524
10705
  }
10525
10706
  }, [isDrawing, isActive, getPoint]);
10526
- const handleEnd = (0, import_react43.useCallback)(() => {
10707
+ const handleEnd = (0, import_react44.useCallback)(() => {
10527
10708
  if (!isDrawing) return;
10528
10709
  setIsDrawing(false);
10529
10710
  if (currentPath.length >= 2) {
@@ -10532,7 +10713,7 @@ var DrawingCanvas = (0, import_react43.memo)(function DrawingCanvas2({
10532
10713
  }
10533
10714
  setCurrentPath([]);
10534
10715
  }, [isDrawing, currentPath, onDrawingComplete]);
10535
- return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
10716
+ return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
10536
10717
  "svg",
10537
10718
  {
10538
10719
  ref: svgRef,
@@ -10552,7 +10733,7 @@ var DrawingCanvas = (0, import_react43.memo)(function DrawingCanvas2({
10552
10733
  onTouchStart: handleStart,
10553
10734
  onTouchMove: handleMove,
10554
10735
  onTouchEnd: handleEnd,
10555
- children: isDrawing && currentPath.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
10736
+ children: isDrawing && currentPath.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
10556
10737
  "path",
10557
10738
  {
10558
10739
  d: pointsToSvgPath(currentPath),
@@ -10569,10 +10750,10 @@ var DrawingCanvas = (0, import_react43.memo)(function DrawingCanvas2({
10569
10750
  });
10570
10751
 
10571
10752
  // src/components/Annotations/ShapeRenderer.tsx
10572
- var import_react44 = require("react");
10753
+ var import_react45 = require("react");
10573
10754
  init_utils();
10574
- var import_jsx_runtime30 = require("react/jsx-runtime");
10575
- var ShapeRenderer = (0, import_react44.memo)(function ShapeRenderer2({
10755
+ var import_jsx_runtime31 = require("react/jsx-runtime");
10756
+ var ShapeRenderer = (0, import_react45.memo)(function ShapeRenderer2({
10576
10757
  shape,
10577
10758
  scale,
10578
10759
  isSelected,
@@ -10582,18 +10763,18 @@ var ShapeRenderer = (0, import_react44.memo)(function ShapeRenderer2({
10582
10763
  onDelete: _onDelete,
10583
10764
  className
10584
10765
  }) {
10585
- const [_isDragging, setIsDragging] = (0, import_react44.useState)(false);
10586
- const [_isResizing, setIsResizing] = (0, import_react44.useState)(false);
10587
- const [activeHandle, setActiveHandle] = (0, import_react44.useState)(null);
10588
- const startPosRef = (0, import_react44.useRef)({ x: 0, y: 0 });
10589
- const startShapeRef = (0, import_react44.useRef)({ x: 0, y: 0, width: 0, height: 0 });
10766
+ const [_isDragging, setIsDragging] = (0, import_react45.useState)(false);
10767
+ const [_isResizing, setIsResizing] = (0, import_react45.useState)(false);
10768
+ const [activeHandle, setActiveHandle] = (0, import_react45.useState)(null);
10769
+ const startPosRef = (0, import_react45.useRef)({ x: 0, y: 0 });
10770
+ const startShapeRef = (0, import_react45.useRef)({ x: 0, y: 0, width: 0, height: 0 });
10590
10771
  const { shapeType, x, y, width, height, color, strokeWidth, id: _id } = shape;
10591
10772
  const scaledX = x * scale;
10592
10773
  const scaledY = y * scale;
10593
10774
  const scaledWidth = width * scale;
10594
10775
  const scaledHeight = height * scale;
10595
10776
  const scaledStroke = strokeWidth * scale;
10596
- const getResizeHandles = (0, import_react44.useCallback)(() => {
10777
+ const getResizeHandles = (0, import_react45.useCallback)(() => {
10597
10778
  const handleSize = 8;
10598
10779
  const half = handleSize / 2;
10599
10780
  return [
@@ -10607,7 +10788,7 @@ var ShapeRenderer = (0, import_react44.memo)(function ShapeRenderer2({
10607
10788
  { position: "w", cursor: "ew-resize", x: scaledX - half, y: scaledY + scaledHeight / 2 - half }
10608
10789
  ];
10609
10790
  }, [scaledX, scaledY, scaledWidth, scaledHeight]);
10610
- const handleMouseDown = (0, import_react44.useCallback)((e, handle) => {
10791
+ const handleMouseDown = (0, import_react45.useCallback)((e, handle) => {
10611
10792
  e.stopPropagation();
10612
10793
  onSelect?.();
10613
10794
  if (!isEditing) return;
@@ -10683,7 +10864,7 @@ var ShapeRenderer = (0, import_react44.memo)(function ShapeRenderer2({
10683
10864
  document.addEventListener("mousemove", handleMouseMove);
10684
10865
  document.addEventListener("mouseup", handleMouseUp);
10685
10866
  }, [isEditing, x, y, width, height, scale, onSelect, onUpdate]);
10686
- const renderShape2 = (0, import_react44.useCallback)(() => {
10867
+ const renderShape2 = (0, import_react45.useCallback)(() => {
10687
10868
  const commonProps = {
10688
10869
  stroke: color,
10689
10870
  strokeWidth: scaledStroke,
@@ -10695,7 +10876,7 @@ var ShapeRenderer = (0, import_react44.memo)(function ShapeRenderer2({
10695
10876
  };
10696
10877
  switch (shapeType) {
10697
10878
  case "rect":
10698
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
10879
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
10699
10880
  "rect",
10700
10881
  {
10701
10882
  x: scaledX,
@@ -10706,7 +10887,7 @@ var ShapeRenderer = (0, import_react44.memo)(function ShapeRenderer2({
10706
10887
  }
10707
10888
  );
10708
10889
  case "circle":
10709
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
10890
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
10710
10891
  "ellipse",
10711
10892
  {
10712
10893
  cx: scaledX + scaledWidth / 2,
@@ -10717,7 +10898,7 @@ var ShapeRenderer = (0, import_react44.memo)(function ShapeRenderer2({
10717
10898
  }
10718
10899
  );
10719
10900
  case "line":
10720
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
10901
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
10721
10902
  "line",
10722
10903
  {
10723
10904
  x1: scaledX,
@@ -10737,22 +10918,22 @@ var ShapeRenderer = (0, import_react44.memo)(function ShapeRenderer2({
10737
10918
  const arrow1Y = endY - arrowLength * Math.sin(angle - arrowAngle);
10738
10919
  const arrow2X = endX - arrowLength * Math.cos(angle + arrowAngle);
10739
10920
  const arrow2Y = endY - arrowLength * Math.sin(angle + arrowAngle);
10740
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("g", { children: [
10741
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("line", { x1: scaledX, y1: scaledY, x2: endX, y2: endY, ...commonProps }),
10742
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("line", { x1: endX, y1: endY, x2: arrow1X, y2: arrow1Y, ...commonProps }),
10743
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("line", { x1: endX, y1: endY, x2: arrow2X, y2: arrow2Y, ...commonProps })
10921
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("g", { children: [
10922
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("line", { x1: scaledX, y1: scaledY, x2: endX, y2: endY, ...commonProps }),
10923
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("line", { x1: endX, y1: endY, x2: arrow1X, y2: arrow1Y, ...commonProps }),
10924
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("line", { x1: endX, y1: endY, x2: arrow2X, y2: arrow2Y, ...commonProps })
10744
10925
  ] });
10745
10926
  default:
10746
10927
  return null;
10747
10928
  }
10748
10929
  }, [shapeType, scaledX, scaledY, scaledWidth, scaledHeight, color, scaledStroke, isSelected]);
10749
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(
10930
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)(
10750
10931
  "g",
10751
10932
  {
10752
10933
  className: cn("shape-renderer", className),
10753
10934
  onMouseDown: (e) => handleMouseDown(e),
10754
10935
  children: [
10755
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
10936
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
10756
10937
  "rect",
10757
10938
  {
10758
10939
  x: scaledX - 5,
@@ -10765,7 +10946,7 @@ var ShapeRenderer = (0, import_react44.memo)(function ShapeRenderer2({
10765
10946
  }
10766
10947
  ),
10767
10948
  renderShape2(),
10768
- isSelected && /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
10949
+ isSelected && /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
10769
10950
  "rect",
10770
10951
  {
10771
10952
  x: scaledX - 2,
@@ -10778,7 +10959,7 @@ var ShapeRenderer = (0, import_react44.memo)(function ShapeRenderer2({
10778
10959
  strokeDasharray: "4 2"
10779
10960
  }
10780
10961
  ),
10781
- isSelected && isEditing && getResizeHandles().map((handle) => /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
10962
+ isSelected && isEditing && getResizeHandles().map((handle) => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
10782
10963
  "rect",
10783
10964
  {
10784
10965
  x: handle.x,
@@ -10798,7 +10979,7 @@ var ShapeRenderer = (0, import_react44.memo)(function ShapeRenderer2({
10798
10979
  }
10799
10980
  );
10800
10981
  });
10801
- var ShapePreview = (0, import_react44.memo)(function ShapePreview2({
10982
+ var ShapePreview = (0, import_react45.memo)(function ShapePreview2({
10802
10983
  shapeType,
10803
10984
  startPoint,
10804
10985
  endPoint,
@@ -10819,9 +11000,9 @@ var ShapePreview = (0, import_react44.memo)(function ShapePreview2({
10819
11000
  };
10820
11001
  switch (shapeType) {
10821
11002
  case "rect":
10822
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("rect", { x, y, width, height, ...commonProps });
11003
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("rect", { x, y, width, height, ...commonProps });
10823
11004
  case "circle":
10824
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
11005
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
10825
11006
  "ellipse",
10826
11007
  {
10827
11008
  cx: x + width / 2,
@@ -10832,7 +11013,7 @@ var ShapePreview = (0, import_react44.memo)(function ShapePreview2({
10832
11013
  }
10833
11014
  );
10834
11015
  case "line":
10835
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
11016
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
10836
11017
  "line",
10837
11018
  {
10838
11019
  x1: startPoint.x * scale,
@@ -10854,8 +11035,8 @@ var ShapePreview = (0, import_react44.memo)(function ShapePreview2({
10854
11035
  const arrow1Y = endY - arrowLength * Math.sin(angle - arrowAngle);
10855
11036
  const arrow2X = endX - arrowLength * Math.cos(angle + arrowAngle);
10856
11037
  const arrow2Y = endY - arrowLength * Math.sin(angle + arrowAngle);
10857
- return /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)("g", { children: [
10858
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(
11038
+ return /* @__PURE__ */ (0, import_jsx_runtime31.jsxs)("g", { children: [
11039
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
10859
11040
  "line",
10860
11041
  {
10861
11042
  x1: startPoint.x * scale,
@@ -10865,8 +11046,8 @@ var ShapePreview = (0, import_react44.memo)(function ShapePreview2({
10865
11046
  ...commonProps
10866
11047
  }
10867
11048
  ),
10868
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("line", { x1: endX, y1: endY, x2: arrow1X, y2: arrow1Y, ...commonProps }),
10869
- /* @__PURE__ */ (0, import_jsx_runtime30.jsx)("line", { x1: endX, y1: endY, x2: arrow2X, y2: arrow2Y, ...commonProps })
11049
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("line", { x1: endX, y1: endY, x2: arrow1X, y2: arrow1Y, ...commonProps }),
11050
+ /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("line", { x1: endX, y1: endY, x2: arrow2X, y2: arrow2Y, ...commonProps })
10870
11051
  ] });
10871
11052
  default:
10872
11053
  return null;
@@ -10874,10 +11055,10 @@ var ShapePreview = (0, import_react44.memo)(function ShapePreview2({
10874
11055
  });
10875
11056
 
10876
11057
  // src/components/Annotations/QuickNoteButton.tsx
10877
- var import_react45 = require("react");
11058
+ var import_react46 = require("react");
10878
11059
  init_utils();
10879
- var import_jsx_runtime31 = require("react/jsx-runtime");
10880
- var QuickNoteButton = (0, import_react45.memo)(function QuickNoteButton2({
11060
+ var import_jsx_runtime32 = require("react/jsx-runtime");
11061
+ var QuickNoteButton = (0, import_react46.memo)(function QuickNoteButton2({
10881
11062
  pageNumber,
10882
11063
  scale,
10883
11064
  position = "top-right",
@@ -10885,8 +11066,8 @@ var QuickNoteButton = (0, import_react45.memo)(function QuickNoteButton2({
10885
11066
  className,
10886
11067
  visible = true
10887
11068
  }) {
10888
- const [isHovered, setIsHovered] = (0, import_react45.useState)(false);
10889
- const handleClick = (0, import_react45.useCallback)(
11069
+ const [isHovered, setIsHovered] = (0, import_react46.useState)(false);
11070
+ const handleClick = (0, import_react46.useCallback)(
10890
11071
  (e) => {
10891
11072
  e.stopPropagation();
10892
11073
  const x = position === "top-right" ? 80 : 80;
@@ -10898,7 +11079,7 @@ var QuickNoteButton = (0, import_react45.memo)(function QuickNoteButton2({
10898
11079
  if (!visible) {
10899
11080
  return null;
10900
11081
  }
10901
- return /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
11082
+ return /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
10902
11083
  "button",
10903
11084
  {
10904
11085
  onClick: handleClick,
@@ -10920,7 +11101,7 @@ var QuickNoteButton = (0, import_react45.memo)(function QuickNoteButton2({
10920
11101
  ),
10921
11102
  title: "Add quick note",
10922
11103
  "aria-label": "Add quick note",
10923
- children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(
11104
+ children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
10924
11105
  "svg",
10925
11106
  {
10926
11107
  className: "w-4 h-4 text-yellow-900",
@@ -10928,7 +11109,7 @@ var QuickNoteButton = (0, import_react45.memo)(function QuickNoteButton2({
10928
11109
  viewBox: "0 0 24 24",
10929
11110
  stroke: "currentColor",
10930
11111
  strokeWidth: 2,
10931
- children: /* @__PURE__ */ (0, import_jsx_runtime31.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M12 4v16m8-8H4" })
11112
+ children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M12 4v16m8-8H4" })
10932
11113
  }
10933
11114
  )
10934
11115
  }
@@ -10936,10 +11117,10 @@ var QuickNoteButton = (0, import_react45.memo)(function QuickNoteButton2({
10936
11117
  });
10937
11118
 
10938
11119
  // src/components/Annotations/QuickNotePopover.tsx
10939
- var import_react46 = require("react");
11120
+ var import_react47 = require("react");
10940
11121
  init_utils();
10941
- var import_jsx_runtime32 = require("react/jsx-runtime");
10942
- var QuickNotePopover = (0, import_react46.memo)(function QuickNotePopover2({
11122
+ var import_jsx_runtime33 = require("react/jsx-runtime");
11123
+ var QuickNotePopover = (0, import_react47.memo)(function QuickNotePopover2({
10943
11124
  visible,
10944
11125
  position,
10945
11126
  initialContent = "",
@@ -10948,21 +11129,21 @@ var QuickNotePopover = (0, import_react46.memo)(function QuickNotePopover2({
10948
11129
  onCancel,
10949
11130
  className
10950
11131
  }) {
10951
- const [content, setContent] = (0, import_react46.useState)(initialContent);
10952
- const textareaRef = (0, import_react46.useRef)(null);
10953
- const popoverRef = (0, import_react46.useRef)(null);
10954
- const [adjustedPosition, setAdjustedPosition] = (0, import_react46.useState)(position);
10955
- (0, import_react46.useEffect)(() => {
11132
+ const [content, setContent] = (0, import_react47.useState)(initialContent);
11133
+ const textareaRef = (0, import_react47.useRef)(null);
11134
+ const popoverRef = (0, import_react47.useRef)(null);
11135
+ const [adjustedPosition, setAdjustedPosition] = (0, import_react47.useState)(position);
11136
+ (0, import_react47.useEffect)(() => {
10956
11137
  if (visible && textareaRef.current) {
10957
11138
  textareaRef.current.focus();
10958
11139
  }
10959
11140
  }, [visible]);
10960
- (0, import_react46.useEffect)(() => {
11141
+ (0, import_react47.useEffect)(() => {
10961
11142
  if (visible) {
10962
11143
  setContent(initialContent);
10963
11144
  }
10964
11145
  }, [visible, initialContent]);
10965
- (0, import_react46.useEffect)(() => {
11146
+ (0, import_react47.useEffect)(() => {
10966
11147
  if (!visible || !popoverRef.current) return;
10967
11148
  const rect = popoverRef.current.getBoundingClientRect();
10968
11149
  const padding = 10;
@@ -10981,14 +11162,14 @@ var QuickNotePopover = (0, import_react46.memo)(function QuickNotePopover2({
10981
11162
  }
10982
11163
  setAdjustedPosition({ x, y });
10983
11164
  }, [position, visible]);
10984
- const handleSave = (0, import_react46.useCallback)(() => {
11165
+ const handleSave = (0, import_react47.useCallback)(() => {
10985
11166
  if (content.trim()) {
10986
11167
  onSave(content.trim());
10987
11168
  } else {
10988
11169
  onCancel();
10989
11170
  }
10990
11171
  }, [content, onSave, onCancel]);
10991
- const handleKeyDown = (0, import_react46.useCallback)(
11172
+ const handleKeyDown = (0, import_react47.useCallback)(
10992
11173
  (e) => {
10993
11174
  if (e.key === "Enter" && (e.ctrlKey || e.metaKey)) {
10994
11175
  e.preventDefault();
@@ -11003,7 +11184,7 @@ var QuickNotePopover = (0, import_react46.memo)(function QuickNotePopover2({
11003
11184
  if (!visible) {
11004
11185
  return null;
11005
11186
  }
11006
- return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)(
11187
+ return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
11007
11188
  "div",
11008
11189
  {
11009
11190
  ref: popoverRef,
@@ -11022,15 +11203,15 @@ var QuickNotePopover = (0, import_react46.memo)(function QuickNotePopover2({
11022
11203
  top: adjustedPosition.y
11023
11204
  },
11024
11205
  children: [
11025
- agentLastStatement && /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { className: "mb-2 p-2 bg-blue-50 dark:bg-blue-900/50 rounded text-xs text-blue-600 dark:text-blue-300 border border-blue-100 dark:border-blue-800", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex items-start gap-1", children: [
11026
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("svg", { className: "w-3 h-3 mt-0.5 flex-shrink-0", fill: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)("path", { d: "M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z" }) }),
11027
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("span", { className: "line-clamp-2", children: [
11206
+ agentLastStatement && /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("div", { className: "mb-2 p-2 bg-blue-50 dark:bg-blue-900/50 rounded text-xs text-blue-600 dark:text-blue-300 border border-blue-100 dark:border-blue-800", children: /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex items-start gap-1", children: [
11207
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("svg", { className: "w-3 h-3 mt-0.5 flex-shrink-0", fill: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("path", { d: "M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z" }) }),
11208
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("span", { className: "line-clamp-2", children: [
11028
11209
  "AI discussed: \u201C",
11029
11210
  agentLastStatement,
11030
11211
  "\u201D"
11031
11212
  ] })
11032
11213
  ] }) }),
11033
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
11214
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
11034
11215
  "textarea",
11035
11216
  {
11036
11217
  ref: textareaRef,
@@ -11049,13 +11230,13 @@ var QuickNotePopover = (0, import_react46.memo)(function QuickNotePopover2({
11049
11230
  )
11050
11231
  }
11051
11232
  ),
11052
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex items-center justify-between mt-2", children: [
11053
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("span", { className: "text-xs text-gray-500 dark:text-gray-400", children: [
11233
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex items-center justify-between mt-2", children: [
11234
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("span", { className: "text-xs text-gray-500 dark:text-gray-400", children: [
11054
11235
  navigator.platform.includes("Mac") ? "\u2318" : "Ctrl",
11055
11236
  "+Enter to save"
11056
11237
  ] }),
11057
- /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: "flex gap-2", children: [
11058
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
11238
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)("div", { className: "flex gap-2", children: [
11239
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
11059
11240
  "button",
11060
11241
  {
11061
11242
  onClick: onCancel,
@@ -11068,7 +11249,7 @@ var QuickNotePopover = (0, import_react46.memo)(function QuickNotePopover2({
11068
11249
  children: "Cancel"
11069
11250
  }
11070
11251
  ),
11071
- /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
11252
+ /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
11072
11253
  "button",
11073
11254
  {
11074
11255
  onClick: handleSave,
@@ -11091,10 +11272,10 @@ var QuickNotePopover = (0, import_react46.memo)(function QuickNotePopover2({
11091
11272
  });
11092
11273
 
11093
11274
  // src/components/AskAbout/AskAboutOverlay.tsx
11094
- var import_react47 = require("react");
11275
+ var import_react48 = require("react");
11095
11276
  init_utils();
11096
- var import_jsx_runtime33 = require("react/jsx-runtime");
11097
- var AskAboutOverlay = (0, import_react47.memo)(function AskAboutOverlay2({
11277
+ var import_jsx_runtime34 = require("react/jsx-runtime");
11278
+ var AskAboutOverlay = (0, import_react48.memo)(function AskAboutOverlay2({
11098
11279
  visible,
11099
11280
  progress,
11100
11281
  position,
@@ -11108,7 +11289,7 @@ var AskAboutOverlay = (0, import_react47.memo)(function AskAboutOverlay2({
11108
11289
  const radius = (size - strokeWidth) / 2;
11109
11290
  const circumference = 2 * Math.PI * radius;
11110
11291
  const strokeDashoffset = circumference * (1 - progress);
11111
- return /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
11292
+ return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
11112
11293
  "div",
11113
11294
  {
11114
11295
  className: cn(
@@ -11121,7 +11302,7 @@ var AskAboutOverlay = (0, import_react47.memo)(function AskAboutOverlay2({
11121
11302
  top: position.y - size / 2
11122
11303
  },
11123
11304
  children: [
11124
- /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
11305
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
11125
11306
  "svg",
11126
11307
  {
11127
11308
  width: size,
@@ -11129,7 +11310,7 @@ var AskAboutOverlay = (0, import_react47.memo)(function AskAboutOverlay2({
11129
11310
  viewBox: `0 0 ${size} ${size}`,
11130
11311
  className: "transform -rotate-90",
11131
11312
  children: [
11132
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
11313
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
11133
11314
  "circle",
11134
11315
  {
11135
11316
  cx: size / 2,
@@ -11140,7 +11321,7 @@ var AskAboutOverlay = (0, import_react47.memo)(function AskAboutOverlay2({
11140
11321
  strokeWidth
11141
11322
  }
11142
11323
  ),
11143
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
11324
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
11144
11325
  "circle",
11145
11326
  {
11146
11327
  cx: size / 2,
@@ -11158,12 +11339,12 @@ var AskAboutOverlay = (0, import_react47.memo)(function AskAboutOverlay2({
11158
11339
  ]
11159
11340
  }
11160
11341
  ),
11161
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
11342
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
11162
11343
  "div",
11163
11344
  {
11164
11345
  className: "absolute inset-0 flex items-center justify-center",
11165
11346
  style: { color: progress >= 1 ? "#22c55e" : "white" },
11166
- children: progress >= 1 ? /* @__PURE__ */ (0, import_jsx_runtime33.jsx)(
11347
+ children: progress >= 1 ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
11167
11348
  "svg",
11168
11349
  {
11169
11350
  width: "24",
@@ -11174,9 +11355,9 @@ var AskAboutOverlay = (0, import_react47.memo)(function AskAboutOverlay2({
11174
11355
  strokeWidth: "2",
11175
11356
  strokeLinecap: "round",
11176
11357
  strokeLinejoin: "round",
11177
- children: /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("polyline", { points: "20 6 9 17 4 12" })
11358
+ children: /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("polyline", { points: "20 6 9 17 4 12" })
11178
11359
  }
11179
- ) : /* @__PURE__ */ (0, import_jsx_runtime33.jsxs)(
11360
+ ) : /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
11180
11361
  "svg",
11181
11362
  {
11182
11363
  width: "20",
@@ -11188,9 +11369,9 @@ var AskAboutOverlay = (0, import_react47.memo)(function AskAboutOverlay2({
11188
11369
  strokeLinecap: "round",
11189
11370
  strokeLinejoin: "round",
11190
11371
  children: [
11191
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("circle", { cx: "12", cy: "12", r: "10" }),
11192
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("path", { d: "M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3" }),
11193
- /* @__PURE__ */ (0, import_jsx_runtime33.jsx)("line", { x1: "12", y1: "17", x2: "12.01", y2: "17" })
11372
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("circle", { cx: "12", cy: "12", r: "10" }),
11373
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("path", { d: "M9.09 9a3 3 0 0 1 5.83 1c0 2-3 3-3 3" }),
11374
+ /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("line", { x1: "12", y1: "17", x2: "12.01", y2: "17" })
11194
11375
  ]
11195
11376
  }
11196
11377
  )
@@ -11202,10 +11383,10 @@ var AskAboutOverlay = (0, import_react47.memo)(function AskAboutOverlay2({
11202
11383
  });
11203
11384
 
11204
11385
  // src/components/AskAbout/AskAboutTrigger.tsx
11205
- var import_react48 = require("react");
11386
+ var import_react49 = require("react");
11206
11387
  init_utils();
11207
- var import_jsx_runtime34 = require("react/jsx-runtime");
11208
- var AskAboutTrigger = (0, import_react48.memo)(function AskAboutTrigger2({
11388
+ var import_jsx_runtime35 = require("react/jsx-runtime");
11389
+ var AskAboutTrigger = (0, import_react49.memo)(function AskAboutTrigger2({
11209
11390
  position,
11210
11391
  onConfirm,
11211
11392
  onCancel,
@@ -11213,9 +11394,9 @@ var AskAboutTrigger = (0, import_react48.memo)(function AskAboutTrigger2({
11213
11394
  autoHideDelay = 5e3,
11214
11395
  className
11215
11396
  }) {
11216
- const [adjustedPosition, setAdjustedPosition] = (0, import_react48.useState)(position);
11217
- const triggerRef = (0, import_react48.useRef)(null);
11218
- (0, import_react48.useEffect)(() => {
11397
+ const [adjustedPosition, setAdjustedPosition] = (0, import_react49.useState)(position);
11398
+ const triggerRef = (0, import_react49.useRef)(null);
11399
+ (0, import_react49.useEffect)(() => {
11219
11400
  if (!visible || !triggerRef.current) return;
11220
11401
  const rect = triggerRef.current.getBoundingClientRect();
11221
11402
  const padding = 10;
@@ -11231,19 +11412,19 @@ var AskAboutTrigger = (0, import_react48.memo)(function AskAboutTrigger2({
11231
11412
  }
11232
11413
  setAdjustedPosition({ x, y });
11233
11414
  }, [position, visible]);
11234
- (0, import_react48.useEffect)(() => {
11415
+ (0, import_react49.useEffect)(() => {
11235
11416
  if (!visible || autoHideDelay === 0) return;
11236
11417
  const timer = setTimeout(onCancel, autoHideDelay);
11237
11418
  return () => clearTimeout(timer);
11238
11419
  }, [visible, autoHideDelay, onCancel]);
11239
- const handleConfirm = (0, import_react48.useCallback)(
11420
+ const handleConfirm = (0, import_react49.useCallback)(
11240
11421
  (e) => {
11241
11422
  e.stopPropagation();
11242
11423
  onConfirm();
11243
11424
  },
11244
11425
  [onConfirm]
11245
11426
  );
11246
- const handleCancel = (0, import_react48.useCallback)(
11427
+ const handleCancel = (0, import_react49.useCallback)(
11247
11428
  (e) => {
11248
11429
  e.stopPropagation();
11249
11430
  onCancel();
@@ -11253,7 +11434,7 @@ var AskAboutTrigger = (0, import_react48.memo)(function AskAboutTrigger2({
11253
11434
  if (!visible) {
11254
11435
  return null;
11255
11436
  }
11256
- return /* @__PURE__ */ (0, import_jsx_runtime34.jsxs)(
11437
+ return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
11257
11438
  "div",
11258
11439
  {
11259
11440
  ref: triggerRef,
@@ -11272,8 +11453,8 @@ var AskAboutTrigger = (0, import_react48.memo)(function AskAboutTrigger2({
11272
11453
  transform: "translate(-50%, 0)"
11273
11454
  },
11274
11455
  children: [
11275
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)("span", { className: "text-sm text-gray-600 dark:text-gray-300 px-2", children: "Ask about this?" }),
11276
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
11456
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: "text-sm text-gray-600 dark:text-gray-300 px-2", children: "Ask about this?" }),
11457
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
11277
11458
  "button",
11278
11459
  {
11279
11460
  onClick: handleConfirm,
@@ -11286,7 +11467,7 @@ var AskAboutTrigger = (0, import_react48.memo)(function AskAboutTrigger2({
11286
11467
  children: "Ask"
11287
11468
  }
11288
11469
  ),
11289
- /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
11470
+ /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
11290
11471
  "button",
11291
11472
  {
11292
11473
  onClick: handleCancel,
@@ -11306,11 +11487,11 @@ var AskAboutTrigger = (0, import_react48.memo)(function AskAboutTrigger2({
11306
11487
  });
11307
11488
 
11308
11489
  // src/components/Minimap/Minimap.tsx
11309
- var import_react49 = require("react");
11490
+ var import_react50 = require("react");
11310
11491
  init_hooks();
11311
11492
  init_utils();
11312
- var import_jsx_runtime35 = require("react/jsx-runtime");
11313
- var PageIndicator = (0, import_react49.memo)(function PageIndicator2({
11493
+ var import_jsx_runtime36 = require("react/jsx-runtime");
11494
+ var PageIndicator = (0, import_react50.memo)(function PageIndicator2({
11314
11495
  pageNumber,
11315
11496
  status,
11316
11497
  isBookmarked,
@@ -11324,7 +11505,7 @@ var PageIndicator = (0, import_react49.memo)(function PageIndicator2({
11324
11505
  if (status === "visited") return "bg-green-400";
11325
11506
  return "bg-gray-200 dark:bg-gray-700";
11326
11507
  };
11327
- return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
11508
+ return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
11328
11509
  "button",
11329
11510
  {
11330
11511
  onClick,
@@ -11340,13 +11521,13 @@ var PageIndicator = (0, import_react49.memo)(function PageIndicator2({
11340
11521
  title: `Page ${pageNumber}${isBookmarked ? " (bookmarked)" : ""}`,
11341
11522
  "aria-label": `Go to page ${pageNumber}`,
11342
11523
  children: [
11343
- isBookmarked && !compact && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "absolute -top-1 -right-1 w-2 h-2 bg-yellow-500 rounded-full border border-white" }),
11344
- showNumber && !compact && /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { className: "absolute inset-0 flex items-center justify-center text-[8px] font-medium text-white", children: pageNumber })
11524
+ isBookmarked && !compact && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "absolute -top-1 -right-1 w-2 h-2 bg-yellow-500 rounded-full border border-white" }),
11525
+ showNumber && !compact && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { className: "absolute inset-0 flex items-center justify-center text-[8px] font-medium text-white", children: pageNumber })
11345
11526
  ]
11346
11527
  }
11347
11528
  );
11348
11529
  });
11349
- var Minimap = (0, import_react49.memo)(function Minimap2({
11530
+ var Minimap = (0, import_react50.memo)(function Minimap2({
11350
11531
  variant = "sidebar",
11351
11532
  floatingPosition = "right",
11352
11533
  maxHeight = 300,
@@ -11359,18 +11540,18 @@ var Minimap = (0, import_react49.memo)(function Minimap2({
11359
11540
  const currentPage = useViewerStore((s) => s.currentPage);
11360
11541
  const numPages = useViewerStore((s) => s.numPages);
11361
11542
  const goToPage = useViewerStore((s) => s.goToPage);
11362
- const bookmarkedPages = (0, import_react49.useMemo)(() => {
11543
+ const bookmarkedPages = (0, import_react50.useMemo)(() => {
11363
11544
  return new Set(bookmarks.map((b) => b.pageNumber));
11364
11545
  }, [bookmarks]);
11365
11546
  const compact = numPages > 50;
11366
- const handlePageClick = (0, import_react49.useCallback)(
11547
+ const handlePageClick = (0, import_react50.useCallback)(
11367
11548
  (pageNumber) => {
11368
11549
  goToPage(pageNumber);
11369
11550
  onPageClick?.(pageNumber);
11370
11551
  },
11371
11552
  [goToPage, onPageClick]
11372
11553
  );
11373
- const getPageStatus = (0, import_react49.useCallback)(
11554
+ const getPageStatus = (0, import_react50.useCallback)(
11374
11555
  (pageNumber) => {
11375
11556
  if (pageNumber === currentPage) return "current";
11376
11557
  if (bookmarkedPages.has(pageNumber)) return "bookmarked";
@@ -11379,11 +11560,11 @@ var Minimap = (0, import_react49.memo)(function Minimap2({
11379
11560
  },
11380
11561
  [currentPage, visitedPages, bookmarkedPages]
11381
11562
  );
11382
- const pageIndicators = (0, import_react49.useMemo)(() => {
11563
+ const pageIndicators = (0, import_react50.useMemo)(() => {
11383
11564
  const pages = [];
11384
11565
  for (let i = 1; i <= numPages; i++) {
11385
11566
  pages.push(
11386
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
11567
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
11387
11568
  PageIndicator,
11388
11569
  {
11389
11570
  pageNumber: i,
@@ -11404,16 +11585,16 @@ var Minimap = (0, import_react49.memo)(function Minimap2({
11404
11585
  if (numPages === 0) {
11405
11586
  return null;
11406
11587
  }
11407
- const content = /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(import_jsx_runtime35.Fragment, { children: [
11408
- /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "mb-3", children: [
11409
- /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "flex items-center justify-between text-xs text-gray-500 dark:text-gray-400 mb-1", children: [
11410
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { children: "Progress" }),
11411
- /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("span", { children: [
11588
+ const content = /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(import_jsx_runtime36.Fragment, { children: [
11589
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "mb-3", children: [
11590
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex items-center justify-between text-xs text-gray-500 dark:text-gray-400 mb-1", children: [
11591
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { children: "Progress" }),
11592
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("span", { children: [
11412
11593
  progressPercentage,
11413
11594
  "%"
11414
11595
  ] })
11415
11596
  ] }),
11416
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "h-1.5 bg-gray-200 dark:bg-gray-700 rounded-full overflow-hidden", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
11597
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "h-1.5 bg-gray-200 dark:bg-gray-700 rounded-full overflow-hidden", children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
11417
11598
  "div",
11418
11599
  {
11419
11600
  className: "h-full bg-green-500 rounded-full transition-all duration-300",
@@ -11421,7 +11602,7 @@ var Minimap = (0, import_react49.memo)(function Minimap2({
11421
11602
  }
11422
11603
  ) })
11423
11604
  ] }),
11424
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
11605
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
11425
11606
  "div",
11426
11607
  {
11427
11608
  className: cn(
@@ -11432,21 +11613,21 @@ var Minimap = (0, import_react49.memo)(function Minimap2({
11432
11613
  children: pageIndicators
11433
11614
  }
11434
11615
  ),
11435
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "mt-3 pt-2 border-t border-gray-200 dark:border-gray-700", children: /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "flex flex-wrap gap-3 text-xs text-gray-500 dark:text-gray-400", children: [
11436
- /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "flex items-center gap-1", children: [
11437
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "w-2 h-2 rounded-sm bg-blue-500" }),
11438
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { children: "Current" })
11616
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "mt-3 pt-2 border-t border-gray-200 dark:border-gray-700", children: /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex flex-wrap gap-3 text-xs text-gray-500 dark:text-gray-400", children: [
11617
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex items-center gap-1", children: [
11618
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "w-2 h-2 rounded-sm bg-blue-500" }),
11619
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { children: "Current" })
11439
11620
  ] }),
11440
- /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "flex items-center gap-1", children: [
11441
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "w-2 h-2 rounded-sm bg-green-400" }),
11442
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { children: "Visited" })
11621
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex items-center gap-1", children: [
11622
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "w-2 h-2 rounded-sm bg-green-400" }),
11623
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { children: "Visited" })
11443
11624
  ] }),
11444
- /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "flex items-center gap-1", children: [
11445
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("div", { className: "w-2 h-2 rounded-sm bg-yellow-400" }),
11446
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("span", { children: "Bookmarked" })
11625
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "flex items-center gap-1", children: [
11626
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "w-2 h-2 rounded-sm bg-yellow-400" }),
11627
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("span", { children: "Bookmarked" })
11447
11628
  ] })
11448
11629
  ] }) }),
11449
- /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)("div", { className: "mt-2 text-xs text-gray-500 dark:text-gray-400", children: [
11630
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)("div", { className: "mt-2 text-xs text-gray-500 dark:text-gray-400", children: [
11450
11631
  visitedCount,
11451
11632
  " of ",
11452
11633
  numPages,
@@ -11454,7 +11635,7 @@ var Minimap = (0, import_react49.memo)(function Minimap2({
11454
11635
  ] })
11455
11636
  ] });
11456
11637
  if (variant === "floating") {
11457
- return /* @__PURE__ */ (0, import_jsx_runtime35.jsxs)(
11638
+ return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
11458
11639
  "div",
11459
11640
  {
11460
11641
  className: cn(
@@ -11470,13 +11651,13 @@ var Minimap = (0, import_react49.memo)(function Minimap2({
11470
11651
  ),
11471
11652
  style: { maxHeight },
11472
11653
  children: [
11473
- /* @__PURE__ */ (0, import_jsx_runtime35.jsx)("h3", { className: "text-sm font-semibold text-gray-700 dark:text-gray-200 mb-2", children: "Reading Progress" }),
11654
+ /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("h3", { className: "text-sm font-semibold text-gray-700 dark:text-gray-200 mb-2", children: "Reading Progress" }),
11474
11655
  content
11475
11656
  ]
11476
11657
  }
11477
11658
  );
11478
11659
  }
11479
- return /* @__PURE__ */ (0, import_jsx_runtime35.jsx)(
11660
+ return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
11480
11661
  "div",
11481
11662
  {
11482
11663
  className: cn(
@@ -11494,13 +11675,13 @@ var Minimap = (0, import_react49.memo)(function Minimap2({
11494
11675
  init_FloatingZoomControls2();
11495
11676
 
11496
11677
  // src/components/PDFThumbnailNav/PDFThumbnailNav.tsx
11497
- var import_react50 = require("react");
11678
+ var import_react51 = require("react");
11498
11679
  init_hooks();
11499
11680
  init_utils();
11500
- var import_jsx_runtime36 = require("react/jsx-runtime");
11681
+ var import_jsx_runtime37 = require("react/jsx-runtime");
11501
11682
  var DEFAULT_WIDTH = 612;
11502
11683
  var DEFAULT_HEIGHT = 792;
11503
- var PDFThumbnailNav = (0, import_react50.memo)(function PDFThumbnailNav2({
11684
+ var PDFThumbnailNav = (0, import_react51.memo)(function PDFThumbnailNav2({
11504
11685
  thumbnailScale = 0.15,
11505
11686
  orientation = "vertical",
11506
11687
  maxVisible = 10,
@@ -11511,14 +11692,14 @@ var PDFThumbnailNav = (0, import_react50.memo)(function PDFThumbnailNav2({
11511
11692
  }) {
11512
11693
  const { document: document2, numPages, currentPage } = usePDFViewer();
11513
11694
  const { viewerStore } = usePDFViewerStores();
11514
- const containerRef = (0, import_react50.useRef)(null);
11515
- const [thumbnails, setThumbnails] = (0, import_react50.useState)(/* @__PURE__ */ new Map());
11516
- const [visibleRange, setVisibleRange] = (0, import_react50.useState)({ start: 1, end: maxVisible });
11517
- const renderQueueRef = (0, import_react50.useRef)(/* @__PURE__ */ new Set());
11518
- const pageCache = (0, import_react50.useRef)(/* @__PURE__ */ new Map());
11695
+ const containerRef = (0, import_react51.useRef)(null);
11696
+ const [thumbnails, setThumbnails] = (0, import_react51.useState)(/* @__PURE__ */ new Map());
11697
+ const [visibleRange, setVisibleRange] = (0, import_react51.useState)({ start: 1, end: maxVisible });
11698
+ const renderQueueRef = (0, import_react51.useRef)(/* @__PURE__ */ new Set());
11699
+ const pageCache = (0, import_react51.useRef)(/* @__PURE__ */ new Map());
11519
11700
  const thumbnailWidth = Math.floor(DEFAULT_WIDTH * thumbnailScale);
11520
11701
  const thumbnailHeight = Math.floor(DEFAULT_HEIGHT * thumbnailScale);
11521
- const updateVisibleRange = (0, import_react50.useCallback)(() => {
11702
+ const updateVisibleRange = (0, import_react51.useCallback)(() => {
11522
11703
  if (!containerRef.current || numPages === 0) return;
11523
11704
  const container = containerRef.current;
11524
11705
  const isHorizontal2 = orientation === "horizontal";
@@ -11530,7 +11711,7 @@ var PDFThumbnailNav = (0, import_react50.memo)(function PDFThumbnailNav2({
11530
11711
  const lastVisible = Math.min(numPages, firstVisible + visibleCount);
11531
11712
  setVisibleRange({ start: firstVisible, end: lastVisible });
11532
11713
  }, [numPages, orientation, thumbnailWidth, thumbnailHeight, gap]);
11533
- (0, import_react50.useEffect)(() => {
11714
+ (0, import_react51.useEffect)(() => {
11534
11715
  const container = containerRef.current;
11535
11716
  if (!container) return;
11536
11717
  const handleScroll = () => {
@@ -11540,7 +11721,7 @@ var PDFThumbnailNav = (0, import_react50.memo)(function PDFThumbnailNav2({
11540
11721
  updateVisibleRange();
11541
11722
  return () => container.removeEventListener("scroll", handleScroll);
11542
11723
  }, [updateVisibleRange]);
11543
- (0, import_react50.useEffect)(() => {
11724
+ (0, import_react51.useEffect)(() => {
11544
11725
  if (!document2) {
11545
11726
  setThumbnails(/* @__PURE__ */ new Map());
11546
11727
  pageCache.current.clear();
@@ -11591,7 +11772,7 @@ var PDFThumbnailNav = (0, import_react50.memo)(function PDFThumbnailNav2({
11591
11772
  };
11592
11773
  renderThumbnails();
11593
11774
  }, [document2, visibleRange, thumbnailScale, thumbnails]);
11594
- (0, import_react50.useEffect)(() => {
11775
+ (0, import_react51.useEffect)(() => {
11595
11776
  if (!containerRef.current || numPages === 0) return;
11596
11777
  const container = containerRef.current;
11597
11778
  const isHorizontal2 = orientation === "horizontal";
@@ -11607,12 +11788,12 @@ var PDFThumbnailNav = (0, import_react50.memo)(function PDFThumbnailNav2({
11607
11788
  });
11608
11789
  }
11609
11790
  }, [currentPage, numPages, orientation, thumbnailWidth, thumbnailHeight, gap]);
11610
- const handleThumbnailClick = (0, import_react50.useCallback)((pageNum) => {
11791
+ const handleThumbnailClick = (0, import_react51.useCallback)((pageNum) => {
11611
11792
  onThumbnailClick?.(pageNum);
11612
11793
  viewerStore.getState().requestScrollToPage(pageNum, "smooth");
11613
11794
  }, [onThumbnailClick, viewerStore]);
11614
11795
  if (!document2 || numPages === 0) {
11615
- return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
11796
+ return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
11616
11797
  "div",
11617
11798
  {
11618
11799
  className: cn(
@@ -11633,7 +11814,7 @@ var PDFThumbnailNav = (0, import_react50.memo)(function PDFThumbnailNav2({
11633
11814
  }
11634
11815
  const isHorizontal = orientation === "horizontal";
11635
11816
  const totalSize = numPages * ((isHorizontal ? thumbnailWidth : thumbnailHeight) + gap) - gap;
11636
- return /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
11817
+ return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
11637
11818
  "div",
11638
11819
  {
11639
11820
  ref: containerRef,
@@ -11647,7 +11828,7 @@ var PDFThumbnailNav = (0, import_react50.memo)(function PDFThumbnailNav2({
11647
11828
  style: {
11648
11829
  ...isHorizontal ? { overflowX: "auto", overflowY: "hidden" } : { overflowX: "hidden", overflowY: "auto" }
11649
11830
  },
11650
- children: /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
11831
+ children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
11651
11832
  "div",
11652
11833
  {
11653
11834
  className: cn(
@@ -11664,7 +11845,7 @@ var PDFThumbnailNav = (0, import_react50.memo)(function PDFThumbnailNav2({
11664
11845
  const thumbnail = thumbnails.get(pageNum);
11665
11846
  const isActive = pageNum === currentPage;
11666
11847
  const isVisible = pageNum >= visibleRange.start && pageNum <= visibleRange.end;
11667
- return /* @__PURE__ */ (0, import_jsx_runtime36.jsxs)(
11848
+ return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
11668
11849
  "div",
11669
11850
  {
11670
11851
  className: cn(
@@ -11689,7 +11870,7 @@ var PDFThumbnailNav = (0, import_react50.memo)(function PDFThumbnailNav2({
11689
11870
  }
11690
11871
  },
11691
11872
  children: [
11692
- /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
11873
+ /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
11693
11874
  "div",
11694
11875
  {
11695
11876
  className: "relative bg-white dark:bg-gray-700",
@@ -11697,7 +11878,7 @@ var PDFThumbnailNav = (0, import_react50.memo)(function PDFThumbnailNav2({
11697
11878
  width: thumbnailWidth,
11698
11879
  height: thumbnailHeight
11699
11880
  },
11700
- children: isVisible && thumbnail?.canvas ? /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
11881
+ children: isVisible && thumbnail?.canvas ? /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
11701
11882
  "img",
11702
11883
  {
11703
11884
  src: thumbnail.canvas.toDataURL(),
@@ -11705,10 +11886,10 @@ var PDFThumbnailNav = (0, import_react50.memo)(function PDFThumbnailNav2({
11705
11886
  className: "w-full h-full object-contain",
11706
11887
  loading: "lazy"
11707
11888
  }
11708
- ) : /* @__PURE__ */ (0, import_jsx_runtime36.jsx)("div", { className: "absolute inset-0 flex items-center justify-center text-gray-400 dark:text-gray-500 text-xs", children: pageNum })
11889
+ ) : /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("div", { className: "absolute inset-0 flex items-center justify-center text-gray-400 dark:text-gray-500 text-xs", children: pageNum })
11709
11890
  }
11710
11891
  ),
11711
- showPageNumbers && /* @__PURE__ */ (0, import_jsx_runtime36.jsx)(
11892
+ showPageNumbers && /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
11712
11893
  "div",
11713
11894
  {
11714
11895
  className: cn(
@@ -11731,10 +11912,10 @@ var PDFThumbnailNav = (0, import_react50.memo)(function PDFThumbnailNav2({
11731
11912
  });
11732
11913
 
11733
11914
  // src/components/ErrorBoundary/PDFErrorBoundary.tsx
11734
- var import_react51 = require("react");
11915
+ var import_react52 = require("react");
11735
11916
  init_utils();
11736
- var import_jsx_runtime37 = require("react/jsx-runtime");
11737
- var PDFErrorBoundary = class extends import_react51.Component {
11917
+ var import_jsx_runtime38 = require("react/jsx-runtime");
11918
+ var PDFErrorBoundary = class extends import_react52.Component {
11738
11919
  constructor(props) {
11739
11920
  super(props);
11740
11921
  this.handleReset = () => {
@@ -11761,7 +11942,7 @@ var PDFErrorBoundary = class extends import_react51.Component {
11761
11942
  return fallback;
11762
11943
  }
11763
11944
  if (showDefaultUI) {
11764
- return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
11945
+ return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
11765
11946
  DefaultErrorUI,
11766
11947
  {
11767
11948
  error,
@@ -11780,7 +11961,7 @@ function DefaultErrorUI({ error, onReset, className }) {
11780
11961
  const isNetworkError = error.message.includes("fetch") || error.message.includes("network") || error.message.includes("Failed to load");
11781
11962
  let title = "Something went wrong";
11782
11963
  let description = error.message;
11783
- let icon = /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("svg", { className: "w-12 h-12 text-red-500", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
11964
+ let icon = /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("svg", { className: "w-12 h-12 text-red-500", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
11784
11965
  "path",
11785
11966
  {
11786
11967
  strokeLinecap: "round",
@@ -11792,7 +11973,7 @@ function DefaultErrorUI({ error, onReset, className }) {
11792
11973
  if (isPDFError) {
11793
11974
  title = "Unable to load PDF";
11794
11975
  description = "The PDF file could not be loaded. It may be corrupted or in an unsupported format.";
11795
- icon = /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("svg", { className: "w-12 h-12 text-red-500", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
11976
+ icon = /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("svg", { className: "w-12 h-12 text-red-500", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
11796
11977
  "path",
11797
11978
  {
11798
11979
  strokeLinecap: "round",
@@ -11804,7 +11985,7 @@ function DefaultErrorUI({ error, onReset, className }) {
11804
11985
  } else if (isNetworkError) {
11805
11986
  title = "Network error";
11806
11987
  description = "Unable to fetch the PDF file. Please check your internet connection and try again.";
11807
- icon = /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("svg", { className: "w-12 h-12 text-red-500", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
11988
+ icon = /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("svg", { className: "w-12 h-12 text-red-500", fill: "none", viewBox: "0 0 24 24", stroke: "currentColor", children: /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
11808
11989
  "path",
11809
11990
  {
11810
11991
  strokeLinecap: "round",
@@ -11814,7 +11995,7 @@ function DefaultErrorUI({ error, onReset, className }) {
11814
11995
  }
11815
11996
  ) });
11816
11997
  }
11817
- return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(
11998
+ return /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)(
11818
11999
  "div",
11819
12000
  {
11820
12001
  className: cn(
@@ -11827,14 +12008,14 @@ function DefaultErrorUI({ error, onReset, className }) {
11827
12008
  ),
11828
12009
  children: [
11829
12010
  icon,
11830
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("h2", { className: "mt-4 text-xl font-semibold text-gray-900 dark:text-gray-100", children: title }),
11831
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("p", { className: "mt-2 text-sm text-gray-600 dark:text-gray-400 max-w-md", children: description }),
11832
- /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("details", { className: "mt-4 text-left max-w-md w-full", children: [
11833
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("summary", { className: "cursor-pointer text-sm text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200", children: "Technical details" }),
11834
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)("pre", { className: "mt-2 p-2 bg-gray-100 dark:bg-gray-800 rounded text-xs overflow-auto", children: error.stack || error.message })
12011
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("h2", { className: "mt-4 text-xl font-semibold text-gray-900 dark:text-gray-100", children: title }),
12012
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("p", { className: "mt-2 text-sm text-gray-600 dark:text-gray-400 max-w-md", children: description }),
12013
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("details", { className: "mt-4 text-left max-w-md w-full", children: [
12014
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("summary", { className: "cursor-pointer text-sm text-gray-500 hover:text-gray-700 dark:text-gray-400 dark:hover:text-gray-200", children: "Technical details" }),
12015
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)("pre", { className: "mt-2 p-2 bg-gray-100 dark:bg-gray-800 rounded text-xs overflow-auto", children: error.stack || error.message })
11835
12016
  ] }),
11836
- /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)("div", { className: "mt-6 flex gap-3", children: [
11837
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
12017
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsxs)("div", { className: "mt-6 flex gap-3", children: [
12018
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
11838
12019
  "button",
11839
12020
  {
11840
12021
  onClick: onReset,
@@ -11848,7 +12029,7 @@ function DefaultErrorUI({ error, onReset, className }) {
11848
12029
  children: "Try again"
11849
12030
  }
11850
12031
  ),
11851
- /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
12032
+ /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(
11852
12033
  "button",
11853
12034
  {
11854
12035
  onClick: () => window.location.reload(),
@@ -11868,9 +12049,12 @@ function DefaultErrorUI({ error, onReset, className }) {
11868
12049
  );
11869
12050
  }
11870
12051
  function withErrorBoundary({ component, ...props }) {
11871
- return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(PDFErrorBoundary, { ...props, children: component });
12052
+ return /* @__PURE__ */ (0, import_jsx_runtime38.jsx)(PDFErrorBoundary, { ...props, children: component });
11872
12053
  }
11873
12054
 
12055
+ // src/components/index.ts
12056
+ init_PDFLoadingScreen2();
12057
+
11874
12058
  // src/index.ts
11875
12059
  init_hooks();
11876
12060
  init_store();
@@ -11902,6 +12086,7 @@ init_utils();
11902
12086
  MobileToolbar,
11903
12087
  OutlinePanel,
11904
12088
  PDFErrorBoundary,
12089
+ PDFLoadingScreen,
11905
12090
  PDFPage,
11906
12091
  PDFThumbnailNav,
11907
12092
  PDFViewer,