@embedpdf-editor/vue3-chapter-viewer 1.0.8 → 1.0.9-beta.2

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.js CHANGED
@@ -24,7 +24,7 @@ import { AnnotationLayer, useAnnotationCapability } from "@embedpdf/plugin-annot
24
24
  import { RedactionLayer } from "@embedpdf/plugin-redaction/vue";
25
25
  import { RenderLayer } from "@embedpdf/plugin-render/vue";
26
26
  import { usePdfiumEngine } from "@embedpdf/engines/vue";
27
- const Pe$1 = { position: "relative", height: "100%", width: "100%" }, Ie = { userSelect: "none", WebkitUserSelect: "none" };
27
+ const Ie = { position: "relative", height: "100%", width: "100%" }, Pe$1 = { userSelect: "none", WebkitUserSelect: "none" };
28
28
  function be$1() {
29
29
  var _a2;
30
30
  "undefined" != typeof window && ((_a2 = window.getSelection()) == null ? void 0 : _a2.removeAllRanges());
@@ -404,12 +404,21 @@ const st$1 = class e extends BasePlugin {
404
404
  return 1e4 * this.manifest.chapters.findIndex((t3) => t3.chapterId === e14) + t2;
405
405
  }
406
406
  scheduleVisibleSegmentLoads(e14) {
407
- const t2 = [...e14].sort((e15, t3) => e15.priority - t3.priority), s2 = /* @__PURE__ */ new Set(), n9 = [];
408
- for (const r2 of t2) {
409
- const e15 = `${r2.chapterId}:${r2.segmentIndex}`;
410
- s2.has(e15) || (s2.add(e15), this.isSegmentDocumentOpen(r2.chapterId, r2.segmentIndex) || n9.push({ chapterId: r2.chapterId, segmentIndex: r2.segmentIndex }));
407
+ const t2 = [...e14].sort((e15, t3) => e15.priority - t3.priority), s2 = /* @__PURE__ */ new Set(), n9 = /* @__PURE__ */ new Map(), r2 = [];
408
+ for (const o2 of t2) {
409
+ const e15 = `${o2.chapterId}:${o2.segmentIndex}`;
410
+ s2.has(e15) || (s2.add(e15), this.isSegmentDocumentOpen(o2.chapterId, o2.segmentIndex) || (n9.has(o2.chapterId) || (n9.set(o2.chapterId, []), r2.push(o2.chapterId)), n9.get(o2.chapterId).push({ chapterId: o2.chapterId, segmentIndex: o2.segmentIndex })));
411
411
  }
412
- this.visibleSegmentBacklog = n9, this.pumpVisibleSegmentBacklog();
412
+ const a2 = [];
413
+ let i2 = true;
414
+ for (; i2; ) {
415
+ i2 = false;
416
+ for (const e15 of r2) {
417
+ const t3 = n9.get(e15);
418
+ t3 && 0 !== t3.length && (a2.push(t3.shift()), i2 = true);
419
+ }
420
+ }
421
+ this.visibleSegmentBacklog = a2, this.pumpVisibleSegmentBacklog();
413
422
  }
414
423
  pumpVisibleSegmentBacklog() {
415
424
  const e14 = Math.max(1, this.config.maxConcurrentSegmentLoads ?? 1);
@@ -463,13 +472,6 @@ const st$1 = class e extends BasePlugin {
463
472
  }
464
473
  if (0 === a2.size) return;
465
474
  const l = this.virtualPageMap.atIndex(r2);
466
- if (l) {
467
- const e15 = this.findChapter(l.chapterId);
468
- if (e15) {
469
- const t3 = Ze$1(e15, l.localPageIndex);
470
- o2(l.chapterId, t3 + 1);
471
- }
472
- }
473
475
  for (const d2 of a2) this.chapterLastUsed.set(d2, n9);
474
476
  const h2 = [...i2.entries()].map(([e15, t3]) => {
475
477
  const [s3, n10] = e15.split(":");
@@ -745,7 +747,7 @@ function ft$1(e14) {
745
747
  function vt$1(e14, t2) {
746
748
  return e14 <= 0 || t2 <= 0 ? 0 : Math.ceil(e14 / t2);
747
749
  }
748
- function Pt$1(e14) {
750
+ function It$1(e14) {
749
751
  const t2 = gt$1(e14);
750
752
  if (!t2) return null;
751
753
  const s2 = ut$1(e14), n9 = vt$1(s2, t2), r2 = pt$1(e14.source) ? e14.source.urls : void 0, a2 = [];
@@ -756,8 +758,8 @@ function Pt$1(e14) {
756
758
  }
757
759
  return { chapterId: e14.chapterId, threshold: t2, pageCount: s2, segments: a2 };
758
760
  }
759
- function It$1(e14, t2) {
760
- const s2 = Pt$1(e14);
761
+ function Pt$1(e14, t2) {
762
+ const s2 = It$1(e14);
761
763
  if (!s2) return { documentId: e14.chapterId, pageIndex: t2 };
762
764
  const n9 = s2.segments.find((e15) => t2 >= e15.localPageStart && t2 <= e15.localPageEnd);
763
765
  if (!n9) {
@@ -767,7 +769,7 @@ function It$1(e14, t2) {
767
769
  return { documentId: n9.documentId, pageIndex: t2 - n9.localPageStart };
768
770
  }
769
771
  function bt$1(e14, t2) {
770
- const s2 = Pt$1(e14);
772
+ const s2 = It$1(e14);
771
773
  if (!s2) return 0;
772
774
  const n9 = s2.segments.find((e15) => t2 >= e15.localPageStart && t2 <= e15.localPageEnd);
773
775
  return (null == n9 ? void 0 : n9.index) ?? Math.floor(t2 / s2.threshold);
@@ -888,10 +890,10 @@ const xt$1 = class e2 extends BasePlugin {
888
890
  t2 && (this.overlapStrategy = t2), this.setManifestInternal(e14);
889
891
  }, getManifest: () => this.manifest, getVirtualPageMap: () => this.virtualPageMap, setVisibleGlobalPages: (e14) => this.handleVisibleChange(e14), visibleRangeNeedsSegmentLoad: (e14) => this.visibleRangeNeedsSegmentLoad(e14), shouldShowChapterLoadError: (e14, t2) => this.shouldShowChapterLoadError(e14, t2), ensureChapterLoaded: (e14) => this.ensureChapterLoaded(e14), ensureSegmentLoaded: (e14, t2) => this.ensureSegmentLoaded(e14, t2), ensureAllSegmentsLoaded: (e14) => this.ensureAllSegmentsLoaded(e14), resolvePageDocument: (e14, t2) => {
890
892
  const s2 = this.findChapter(e14);
891
- return s2 ? It$1(s2, t2) : null;
893
+ return s2 ? Pt$1(s2, t2) : null;
892
894
  }, getSegmentPlan: (e14) => {
893
895
  const t2 = this.findChapter(e14);
894
- return t2 ? Pt$1(t2) : null;
896
+ return t2 ? It$1(t2) : null;
895
897
  }, isSegmentLoaded: (e14, t2) => this.isSegmentDocumentOpen(e14, t2), isSegmentLoadPending: (e14, t2) => this.isSegmentLoadPending(e14, t2), getChapterErrorMessage: (e14) => this.chapterErrorMessages.get(e14), getChapterStatus: (e14) => this.chapterStatus.get(e14) ?? "idle", getChapter: (e14) => this.findChapter(e14), onChapterStatusChange: this.statusChange$.on, onManifestChange: this.manifestChange$.on };
896
898
  }
897
899
  destroy() {
@@ -948,7 +950,7 @@ const xt$1 = class e2 extends BasePlugin {
948
950
  }
949
951
  getSegmentPlanForChapter(e14) {
950
952
  const t2 = this.findChapter(e14);
951
- return t2 ? Pt$1(t2) : null;
953
+ return t2 ? It$1(t2) : null;
952
954
  }
953
955
  anySegmentOpen(e14) {
954
956
  const t2 = this.getSegmentPlanForChapter(e14), s2 = this.documentManager.provides();
@@ -1020,17 +1022,26 @@ const xt$1 = class e2 extends BasePlugin {
1020
1022
  if (!this.virtualPageMap) return Number.MAX_SAFE_INTEGER;
1021
1023
  const n9 = this.findChapter(e14);
1022
1024
  if (!n9) return Number.MAX_SAFE_INTEGER;
1023
- const r2 = Pt$1(n9), a2 = (null == (s2 = null == r2 ? void 0 : r2.segments[t2]) ? void 0 : s2.localPageStart) ?? 0, i2 = this.virtualPageMap.toGlobal(e14, a2);
1025
+ const r2 = It$1(n9), a2 = (null == (s2 = null == r2 ? void 0 : r2.segments[t2]) ? void 0 : s2.localPageStart) ?? 0, i2 = this.virtualPageMap.toGlobal(e14, a2);
1024
1026
  if (i2) return i2.globalPageIndex;
1025
1027
  return 1e4 * this.manifest.chapters.findIndex((t3) => t3.chapterId === e14) + t2;
1026
1028
  }
1027
1029
  scheduleVisibleSegmentLoads(e14) {
1028
- const t2 = [...e14].sort((e15, t3) => e15.priority - t3.priority), s2 = /* @__PURE__ */ new Set(), n9 = [];
1029
- for (const r2 of t2) {
1030
- const e15 = `${r2.chapterId}:${r2.segmentIndex}`;
1031
- s2.has(e15) || (s2.add(e15), this.isSegmentDocumentOpen(r2.chapterId, r2.segmentIndex) || n9.push({ chapterId: r2.chapterId, segmentIndex: r2.segmentIndex }));
1030
+ const t2 = [...e14].sort((e15, t3) => e15.priority - t3.priority), s2 = /* @__PURE__ */ new Set(), n9 = /* @__PURE__ */ new Map(), r2 = [];
1031
+ for (const o2 of t2) {
1032
+ const e15 = `${o2.chapterId}:${o2.segmentIndex}`;
1033
+ s2.has(e15) || (s2.add(e15), this.isSegmentDocumentOpen(o2.chapterId, o2.segmentIndex) || (n9.has(o2.chapterId) || (n9.set(o2.chapterId, []), r2.push(o2.chapterId)), n9.get(o2.chapterId).push({ chapterId: o2.chapterId, segmentIndex: o2.segmentIndex })));
1032
1034
  }
1033
- this.visibleSegmentBacklog = n9, this.pumpVisibleSegmentBacklog();
1035
+ const a2 = [];
1036
+ let i2 = true;
1037
+ for (; i2; ) {
1038
+ i2 = false;
1039
+ for (const e15 of r2) {
1040
+ const t3 = n9.get(e15);
1041
+ t3 && 0 !== t3.length && (a2.push(t3.shift()), i2 = true);
1042
+ }
1043
+ }
1044
+ this.visibleSegmentBacklog = a2, this.pumpVisibleSegmentBacklog();
1034
1045
  }
1035
1046
  pumpVisibleSegmentBacklog() {
1036
1047
  const e14 = Math.max(1, this.config.maxConcurrentSegmentLoads ?? 1);
@@ -1067,7 +1078,7 @@ const xt$1 = class e2 extends BasePlugin {
1067
1078
  if (t3 < 0) return;
1068
1079
  const s3 = this.findChapter(e15);
1069
1080
  if (!s3) return;
1070
- const n10 = Pt$1(s3);
1081
+ const n10 = It$1(s3);
1071
1082
  if (n10 && t3 >= n10.segments.length) return;
1072
1083
  const a3 = `${e15}:${t3}`, o3 = this.segmentStartGlobalIndex(e15, t3), l2 = Math.abs(o3 - r2), h3 = i2.get(a3);
1073
1084
  (void 0 === h3 || l2 < h3) && i2.set(a3, l2);
@@ -1084,13 +1095,6 @@ const xt$1 = class e2 extends BasePlugin {
1084
1095
  }
1085
1096
  if (0 === a2.size) return;
1086
1097
  const l = this.virtualPageMap.atIndex(r2);
1087
- if (l) {
1088
- const e15 = this.findChapter(l.chapterId);
1089
- if (e15) {
1090
- const t3 = bt$1(e15, l.localPageIndex);
1091
- o2(l.chapterId, t3 + 1);
1092
- }
1093
- }
1094
1098
  for (const d2 of a2) this.chapterLastUsed.set(d2, n9);
1095
1099
  const h2 = [...i2.entries()].map(([e15, t3]) => {
1096
1100
  const [s3, n10] = e15.split(":");
@@ -1108,7 +1112,7 @@ const xt$1 = class e2 extends BasePlugin {
1108
1112
  if (this.config.autoActivateOnLoad ?? 1) {
1109
1113
  const e15 = this.virtualPageMap.atIndex(r2);
1110
1114
  if (e15) {
1111
- const t3 = It$1(this.findChapter(e15.chapterId), e15.localPageIndex);
1115
+ const t3 = Pt$1(this.findChapter(e15.chapterId), e15.localPageIndex);
1112
1116
  if (this.documentManager.provides().isDocumentOpen(t3.documentId)) {
1113
1117
  this.documentManager.provides().getActiveDocumentId() !== t3.documentId && this.documentManager.provides().setActiveDocument(t3.documentId);
1114
1118
  }
@@ -1144,7 +1148,7 @@ const xt$1 = class e2 extends BasePlugin {
1144
1148
  this.prepareChapterForSegmentLoad(e14);
1145
1149
  const n9 = this.findChapter(e14);
1146
1150
  if (!n9) return Promise.resolve("error");
1147
- const r2 = Pt$1(n9);
1151
+ const r2 = It$1(n9);
1148
1152
  if (!r2) return 0 !== t2 ? Promise.resolve(this.isSegmentDocumentOpen(e14, 0) ? "loaded" : "error") : this.ensureSingleDocumentChapter(n9);
1149
1153
  if (t2 < 0 || t2 >= r2.segments.length) return Promise.resolve("error");
1150
1154
  const a2 = r2.segments[t2], i2 = a2.documentId;
@@ -1285,7 +1289,7 @@ const xt$1 = class e2 extends BasePlugin {
1285
1289
  });
1286
1290
  }
1287
1291
  closeChapter(e14) {
1288
- const t2 = this.findChapter(e14), s2 = this.documentManager.provides(), n9 = t2 ? Pt$1(t2) : null, r2 = (e15) => {
1292
+ const t2 = this.findChapter(e14), s2 = this.documentManager.provides(), n9 = t2 ? It$1(t2) : null, r2 = (e15) => {
1289
1293
  if (s2.isDocumentOpen(e15)) {
1290
1294
  s2.closeDocument(e15).wait(() => {
1291
1295
  }, () => {
@@ -1836,12 +1840,21 @@ const jt$1 = class e3 extends BasePlugin {
1836
1840
  return 1e4 * this.manifest.chapters.findIndex((t3) => t3.chapterId === e14) + t2;
1837
1841
  }
1838
1842
  scheduleVisibleSegmentLoads(e14) {
1839
- const t2 = [...e14].sort((e15, t3) => e15.priority - t3.priority), s2 = /* @__PURE__ */ new Set(), n9 = [];
1840
- for (const r2 of t2) {
1841
- const e15 = `${r2.chapterId}:${r2.segmentIndex}`;
1842
- s2.has(e15) || (s2.add(e15), this.isSegmentDocumentOpen(r2.chapterId, r2.segmentIndex) || n9.push({ chapterId: r2.chapterId, segmentIndex: r2.segmentIndex }));
1843
+ const t2 = [...e14].sort((e15, t3) => e15.priority - t3.priority), s2 = /* @__PURE__ */ new Set(), n9 = /* @__PURE__ */ new Map(), r2 = [];
1844
+ for (const o2 of t2) {
1845
+ const e15 = `${o2.chapterId}:${o2.segmentIndex}`;
1846
+ s2.has(e15) || (s2.add(e15), this.isSegmentDocumentOpen(o2.chapterId, o2.segmentIndex) || (n9.has(o2.chapterId) || (n9.set(o2.chapterId, []), r2.push(o2.chapterId)), n9.get(o2.chapterId).push({ chapterId: o2.chapterId, segmentIndex: o2.segmentIndex })));
1843
1847
  }
1844
- this.visibleSegmentBacklog = n9, this.pumpVisibleSegmentBacklog();
1848
+ const a2 = [];
1849
+ let i2 = true;
1850
+ for (; i2; ) {
1851
+ i2 = false;
1852
+ for (const e15 of r2) {
1853
+ const t3 = n9.get(e15);
1854
+ t3 && 0 !== t3.length && (a2.push(t3.shift()), i2 = true);
1855
+ }
1856
+ }
1857
+ this.visibleSegmentBacklog = a2, this.pumpVisibleSegmentBacklog();
1845
1858
  }
1846
1859
  pumpVisibleSegmentBacklog() {
1847
1860
  const e14 = Math.max(1, this.config.maxConcurrentSegmentLoads ?? 1);
@@ -1895,13 +1908,6 @@ const jt$1 = class e3 extends BasePlugin {
1895
1908
  }
1896
1909
  if (0 === a2.size) return;
1897
1910
  const l = this.virtualPageMap.atIndex(r2);
1898
- if (l) {
1899
- const e15 = this.findChapter(l.chapterId);
1900
- if (e15) {
1901
- const t3 = Bt$1(e15, l.localPageIndex);
1902
- o2(l.chapterId, t3 + 1);
1903
- }
1904
- }
1905
1911
  for (const d2 of a2) this.chapterLastUsed.set(d2, n9);
1906
1912
  const h2 = [...i2.entries()].map(([e15, t3]) => {
1907
1913
  const [s3, n10] = e15.split(":");
@@ -2456,12 +2462,21 @@ const ms = class e4 extends BasePlugin {
2456
2462
  return 1e4 * this.manifest.chapters.findIndex((t3) => t3.chapterId === e14) + t2;
2457
2463
  }
2458
2464
  scheduleVisibleSegmentLoads(e14) {
2459
- const t2 = [...e14].sort((e15, t3) => e15.priority - t3.priority), s2 = /* @__PURE__ */ new Set(), n9 = [];
2460
- for (const r2 of t2) {
2461
- const e15 = `${r2.chapterId}:${r2.segmentIndex}`;
2462
- s2.has(e15) || (s2.add(e15), this.isSegmentDocumentOpen(r2.chapterId, r2.segmentIndex) || n9.push({ chapterId: r2.chapterId, segmentIndex: r2.segmentIndex }));
2465
+ const t2 = [...e14].sort((e15, t3) => e15.priority - t3.priority), s2 = /* @__PURE__ */ new Set(), n9 = /* @__PURE__ */ new Map(), r2 = [];
2466
+ for (const o2 of t2) {
2467
+ const e15 = `${o2.chapterId}:${o2.segmentIndex}`;
2468
+ s2.has(e15) || (s2.add(e15), this.isSegmentDocumentOpen(o2.chapterId, o2.segmentIndex) || (n9.has(o2.chapterId) || (n9.set(o2.chapterId, []), r2.push(o2.chapterId)), n9.get(o2.chapterId).push({ chapterId: o2.chapterId, segmentIndex: o2.segmentIndex })));
2469
+ }
2470
+ const a2 = [];
2471
+ let i2 = true;
2472
+ for (; i2; ) {
2473
+ i2 = false;
2474
+ for (const e15 of r2) {
2475
+ const t3 = n9.get(e15);
2476
+ t3 && 0 !== t3.length && (a2.push(t3.shift()), i2 = true);
2477
+ }
2463
2478
  }
2464
- this.visibleSegmentBacklog = n9, this.pumpVisibleSegmentBacklog();
2479
+ this.visibleSegmentBacklog = a2, this.pumpVisibleSegmentBacklog();
2465
2480
  }
2466
2481
  pumpVisibleSegmentBacklog() {
2467
2482
  const e14 = Math.max(1, this.config.maxConcurrentSegmentLoads ?? 1);
@@ -2515,13 +2530,6 @@ const ms = class e4 extends BasePlugin {
2515
2530
  }
2516
2531
  if (0 === a2.size) return;
2517
2532
  const l = this.virtualPageMap.atIndex(r2);
2518
- if (l) {
2519
- const e15 = this.findChapter(l.chapterId);
2520
- if (e15) {
2521
- const t3 = hs(e15, l.localPageIndex);
2522
- o2(l.chapterId, t3 + 1);
2523
- }
2524
- }
2525
2533
  for (const d2 of a2) this.chapterLastUsed.set(d2, n9);
2526
2534
  const h2 = [...i2.entries()].map(([e15, t3]) => {
2527
2535
  const [s3, n10] = e15.split(":");
@@ -2743,7 +2751,7 @@ function vs$1(e14, t2) {
2743
2751
  }
2744
2752
  return true;
2745
2753
  }
2746
- const Ps$1 = class Ps extends BasePlugin {
2754
+ const Is$1 = class Is extends BasePlugin {
2747
2755
  constructor(e14, t2) {
2748
2756
  super(e14, t2), this.layoutChange$ = createBehaviorEmitter(void 0, vs$1), this.visibleChange$ = createBehaviorEmitter(), this.virtualPageMap = null, this.pageSizes = /* @__PURE__ */ new Map(), this.offsets = [], this.totalHeight = 0, this.totalWidth = 0, this.viewportEl = null, this.viewportObservers = null, this.currentVisible = [], this.currentGlobalPageIndex = 0, this.lastLoadIndicesKey = "", this.chapterManagerUnsubs = [], this.chapterManager = this.registry.getPlugin(fs$1.id), this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
2749
2757
  }
@@ -2959,11 +2967,11 @@ const Ps$1 = class Ps extends BasePlugin {
2959
2967
  s2 && this.scrollToIndex(s2.globalPageIndex, t2);
2960
2968
  }
2961
2969
  };
2962
- Ps$1.id = "chapter-scroll";
2963
- let Is$1 = Ps$1;
2970
+ Is$1.id = "chapter-scroll";
2971
+ let Ps$1 = Is$1;
2964
2972
  const bs = class e5 extends BasePlugin {
2965
2973
  constructor(e14, t2) {
2966
- super(e14, t2), this.notesChange$ = createBehaviorEmitter([]), this.noteActivated$ = createEmitter(), this.notes = /* @__PURE__ */ new Map(), this.chapterScroll = this.registry.getPlugin(Is$1.id), this.chapterManager = this.registry.getPlugin(Xt$1.id), this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
2974
+ super(e14, t2), this.notesChange$ = createBehaviorEmitter([]), this.noteActivated$ = createEmitter(), this.notes = /* @__PURE__ */ new Map(), this.chapterScroll = this.registry.getPlugin(Ps$1.id), this.chapterManager = this.registry.getPlugin(Xt$1.id), this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
2967
2975
  }
2968
2976
  async initialize(t2) {
2969
2977
  if (this.config = t2, t2.callbacks.loadNotes) try {
@@ -3380,12 +3388,21 @@ const zs$1 = class e6 extends BasePlugin {
3380
3388
  return 1e4 * this.manifest.chapters.findIndex((t3) => t3.chapterId === e14) + t2;
3381
3389
  }
3382
3390
  scheduleVisibleSegmentLoads(e14) {
3383
- const t2 = [...e14].sort((e15, t3) => e15.priority - t3.priority), s2 = /* @__PURE__ */ new Set(), n9 = [];
3384
- for (const r2 of t2) {
3385
- const e15 = `${r2.chapterId}:${r2.segmentIndex}`;
3386
- s2.has(e15) || (s2.add(e15), this.isSegmentDocumentOpen(r2.chapterId, r2.segmentIndex) || n9.push({ chapterId: r2.chapterId, segmentIndex: r2.segmentIndex }));
3391
+ const t2 = [...e14].sort((e15, t3) => e15.priority - t3.priority), s2 = /* @__PURE__ */ new Set(), n9 = /* @__PURE__ */ new Map(), r2 = [];
3392
+ for (const o2 of t2) {
3393
+ const e15 = `${o2.chapterId}:${o2.segmentIndex}`;
3394
+ s2.has(e15) || (s2.add(e15), this.isSegmentDocumentOpen(o2.chapterId, o2.segmentIndex) || (n9.has(o2.chapterId) || (n9.set(o2.chapterId, []), r2.push(o2.chapterId)), n9.get(o2.chapterId).push({ chapterId: o2.chapterId, segmentIndex: o2.segmentIndex })));
3395
+ }
3396
+ const a2 = [];
3397
+ let i2 = true;
3398
+ for (; i2; ) {
3399
+ i2 = false;
3400
+ for (const e15 of r2) {
3401
+ const t3 = n9.get(e15);
3402
+ t3 && 0 !== t3.length && (a2.push(t3.shift()), i2 = true);
3403
+ }
3387
3404
  }
3388
- this.visibleSegmentBacklog = n9, this.pumpVisibleSegmentBacklog();
3405
+ this.visibleSegmentBacklog = a2, this.pumpVisibleSegmentBacklog();
3389
3406
  }
3390
3407
  pumpVisibleSegmentBacklog() {
3391
3408
  const e14 = Math.max(1, this.config.maxConcurrentSegmentLoads ?? 1);
@@ -3439,13 +3456,6 @@ const zs$1 = class e6 extends BasePlugin {
3439
3456
  }
3440
3457
  if (0 === a2.size) return;
3441
3458
  const l = this.virtualPageMap.atIndex(r2);
3442
- if (l) {
3443
- const e15 = this.findChapter(l.chapterId);
3444
- if (e15) {
3445
- const t3 = Ns$1(e15, l.localPageIndex);
3446
- o2(l.chapterId, t3 + 1);
3447
- }
3448
- }
3449
3459
  for (const d2 of a2) this.chapterLastUsed.set(d2, n9);
3450
3460
  const h2 = [...i2.entries()].map(([e15, t3]) => {
3451
3461
  const [s3, n10] = e15.split(":");
@@ -4000,12 +4010,21 @@ const ln = class e7 extends BasePlugin {
4000
4010
  return 1e4 * this.manifest.chapters.findIndex((t3) => t3.chapterId === e14) + t2;
4001
4011
  }
4002
4012
  scheduleVisibleSegmentLoads(e14) {
4003
- const t2 = [...e14].sort((e15, t3) => e15.priority - t3.priority), s2 = /* @__PURE__ */ new Set(), n9 = [];
4004
- for (const r2 of t2) {
4005
- const e15 = `${r2.chapterId}:${r2.segmentIndex}`;
4006
- s2.has(e15) || (s2.add(e15), this.isSegmentDocumentOpen(r2.chapterId, r2.segmentIndex) || n9.push({ chapterId: r2.chapterId, segmentIndex: r2.segmentIndex }));
4013
+ const t2 = [...e14].sort((e15, t3) => e15.priority - t3.priority), s2 = /* @__PURE__ */ new Set(), n9 = /* @__PURE__ */ new Map(), r2 = [];
4014
+ for (const o2 of t2) {
4015
+ const e15 = `${o2.chapterId}:${o2.segmentIndex}`;
4016
+ s2.has(e15) || (s2.add(e15), this.isSegmentDocumentOpen(o2.chapterId, o2.segmentIndex) || (n9.has(o2.chapterId) || (n9.set(o2.chapterId, []), r2.push(o2.chapterId)), n9.get(o2.chapterId).push({ chapterId: o2.chapterId, segmentIndex: o2.segmentIndex })));
4007
4017
  }
4008
- this.visibleSegmentBacklog = n9, this.pumpVisibleSegmentBacklog();
4018
+ const a2 = [];
4019
+ let i2 = true;
4020
+ for (; i2; ) {
4021
+ i2 = false;
4022
+ for (const e15 of r2) {
4023
+ const t3 = n9.get(e15);
4024
+ t3 && 0 !== t3.length && (a2.push(t3.shift()), i2 = true);
4025
+ }
4026
+ }
4027
+ this.visibleSegmentBacklog = a2, this.pumpVisibleSegmentBacklog();
4009
4028
  }
4010
4029
  pumpVisibleSegmentBacklog() {
4011
4030
  const e14 = Math.max(1, this.config.maxConcurrentSegmentLoads ?? 1);
@@ -4059,13 +4078,6 @@ const ln = class e7 extends BasePlugin {
4059
4078
  }
4060
4079
  if (0 === a2.size) return;
4061
4080
  const l = this.virtualPageMap.atIndex(r2);
4062
- if (l) {
4063
- const e15 = this.findChapter(l.chapterId);
4064
- if (e15) {
4065
- const t3 = tn(e15, l.localPageIndex);
4066
- o2(l.chapterId, t3 + 1);
4067
- }
4068
- }
4069
4081
  for (const d2 of a2) this.chapterLastUsed.set(d2, n9);
4070
4082
  const h2 = [...i2.entries()].map(([e15, t3]) => {
4071
4083
  const [s3, n10] = e15.split(":");
@@ -4537,7 +4549,7 @@ function vn(e14, t2, s2, n9) {
4537
4549
  if (0 === r2.length) throw new Error("buildParagraphBookmarkAnchor: no rects");
4538
4550
  return { chapterId: e14, localPageIndex: t2, globalPageIndex: null == n9 ? void 0 : n9.globalPageIndex, globalPageNumber: null == n9 ? void 0 : n9.globalPageNumber, rectPdfCoord: pn(r2), rectsPdfCoord: r2, markerAnchor: gn(r2) };
4539
4551
  }
4540
- async function Pn(e14, t2, s2) {
4552
+ async function In(e14, t2, s2) {
4541
4553
  e14.scrollToGlobalPageIndex(t2), await (function(e15, t3, s3 = 2500) {
4542
4554
  const n9 = e15.getLayout().items.find((e16) => e16.globalPageIndex === t3 && !e16.isPlaceholder);
4543
4555
  return n9 ? Promise.resolve(n9) : new Promise((n10) => {
@@ -4550,7 +4562,7 @@ async function Pn(e14, t2, s2) {
4550
4562
  });
4551
4563
  })(e14, t2), e14.scrollToGlobalPdfPoint(t2, s2, { marginTop: 80 });
4552
4564
  }
4553
- const In = class e8 extends BasePlugin {
4565
+ const Pn = class e8 extends BasePlugin {
4554
4566
  constructor(e14, t2) {
4555
4567
  super(e14, t2), this.change$ = createBehaviorEmitter([]), this.entries = /* @__PURE__ */ new Map(), this.chapterScroll = this.registry.getPlugin(un.id), this.chapterManager = this.registry.getPlugin(Gs$1.id), this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
4556
4568
  }
@@ -4624,11 +4636,11 @@ const In = class e8 extends BasePlugin {
4624
4636
  const t3 = e15.rectPdfCoord;
4625
4637
  return t3.origin.y + t3.size.height;
4626
4638
  })(t2.anchor);
4627
- await Pn(s2, r2, a2);
4639
+ await In(s2, r2, a2);
4628
4640
  }
4629
4641
  };
4630
- In.id = "paragraph-bookmark";
4631
- let bn = In;
4642
+ Pn.id = "paragraph-bookmark";
4643
+ let bn = Pn;
4632
4644
  const Sn = { manifest: Ms, create: (e14) => new bn(ws, e14), reducer: (e14) => e14, initialState: {} }, Cn = { "annotation-toolbar": { id: "annotation-toolbar", position: { placement: "top", slot: "secondary", order: 0 }, responsive: { breakpoints: { sm: { maxWidth: 640, hide: ["add-text", "add-ink", "add-ink-highlighter", "add-insert-text", "add-replace-text", "add-comment", "add-callout"], show: ["overflow-annotation-tools"] }, md: { minWidth: 640, hide: ["overflow-annotation-tools"], show: ["add-text", "add-ink", "add-ink-highlighter", "add-insert-text", "add-replace-text", "add-comment", "add-callout"] } } }, permanent: false, categories: ["annotation"], items: [{ type: "spacer", id: "spacer-3", flex: true }, { type: "group", id: "annotation-tools", alignment: "start", gap: 2, items: [{ type: "command-button", id: "add-highlight", commandId: "annotation:add-highlight", variant: "icon", categories: ["annotation", "annotation-markup", "annotation-highlight"] }, { type: "command-button", id: "add-strikeout", commandId: "annotation:add-strikeout", variant: "icon", categories: ["annotation", "annotation-markup", "annotation-strikeout"] }, { type: "command-button", id: "add-underline", commandId: "annotation:add-underline", variant: "icon", categories: ["annotation", "annotation-markup", "annotation-underline"] }, { type: "command-button", id: "add-squiggly", commandId: "annotation:add-squiggly", variant: "icon", categories: ["annotation", "annotation-markup", "annotation-squiggly"] }, { type: "command-button", id: "add-ink", commandId: "annotation:add-ink", variant: "icon", categories: ["annotation", "annotation-ink"] }, { type: "command-button", id: "add-ink-highlighter", commandId: "annotation:add-ink-highlighter", variant: "icon", categories: ["annotation", "annotation-ink"] }, { type: "command-button", id: "add-text", commandId: "annotation:add-text", variant: "icon", categories: ["annotation", "annotation-text"] }, { type: "command-button", id: "add-insert-text", commandId: "annotation:add-insert-text", variant: "icon", categories: ["annotation", "annotation-markup", "annotation-insert-text"] }, { type: "command-button", id: "add-replace-text", commandId: "annotation:add-replace-text", variant: "icon", categories: ["annotation", "annotation-markup", "annotation-replace-text"] }, { type: "command-button", id: "add-comment", commandId: "annotation:add-comment", variant: "icon", categories: ["annotation", "annotation-comment-tool"] }, { type: "command-button", id: "add-callout", commandId: "annotation:add-callout", variant: "icon", categories: ["annotation", "annotation-text"] }, { type: "command-button", id: "overflow-annotation-tools", commandId: "annotation:overflow-tools", variant: "icon", categories: ["annotation", "annotation-overflow"] }, { type: "divider", id: "annotation-tools-divider-1", orientation: "vertical" }, { type: "command-button", id: "toggle-annotation-style", commandId: "panel:toggle-annotation-style", variant: "icon", categories: ["panel", "panel-annotation-style"] }, { type: "divider", id: "annotation-tools-divider-2", orientation: "vertical", visibilityDependsOn: { itemIds: ["toggle-annotation-style"] } }, { type: "command-button", id: "undo-button", commandId: "history:undo", variant: "icon", categories: ["history", "history-undo"] }, { type: "command-button", id: "redo-button", commandId: "history:redo", variant: "icon", categories: ["history", "history-redo"] }] }, { type: "spacer", id: "spacer-4", flex: true }] }, "shapes-toolbar": { id: "shapes-toolbar", position: { placement: "top", slot: "secondary", order: 0 }, responsive: { breakpoints: { sm: { maxWidth: 640, hide: ["add-polygon", "add-polyline"], show: ["overflow-shapes-tools"] }, md: { minWidth: 640, hide: ["overflow-shapes-tools"], show: ["add-polygon", "add-polyline"] } } }, permanent: false, categories: ["annotation", "annotation-shape"], items: [{ type: "spacer", id: "spacer-5", flex: true }, { type: "group", id: "shapes-tools", alignment: "start", gap: 2, items: [{ type: "command-button", id: "add-rectangle", commandId: "annotation:add-rectangle", variant: "icon", categories: ["annotation", "annotation-shape", "annotation-rectangle"] }, { type: "command-button", id: "add-circle", commandId: "annotation:add-circle", variant: "icon", categories: ["annotation", "annotation-shape", "annotation-circle"] }, { type: "command-button", id: "add-line", commandId: "annotation:add-line", variant: "icon", categories: ["annotation", "annotation-shape", "annotation-line"] }, { type: "command-button", id: "add-arrow", commandId: "annotation:add-arrow", variant: "icon", categories: ["annotation", "annotation-shape", "annotation-arrow"] }, { type: "command-button", id: "add-polygon", commandId: "annotation:add-polygon", variant: "icon", categories: ["annotation", "annotation-shape", "annotation-polygon"] }, { type: "command-button", id: "add-polyline", commandId: "annotation:add-polyline", variant: "icon", categories: ["annotation", "annotation-shape", "annotation-polyline"] }, { type: "command-button", id: "overflow-shapes-tools", commandId: "annotation:overflow-shapes", variant: "icon", categories: ["annotation", "annotation-shape", "annotation-overflow"] }, { type: "divider", id: "shapes-tools-divider-1", orientation: "vertical" }, { type: "command-button", id: "toggle-annotation-style", commandId: "panel:toggle-annotation-style", variant: "icon", categories: ["panel", "panel-annotation-style"] }, { type: "divider", id: "shapes-tools-divider-2", orientation: "vertical", visibilityDependsOn: { itemIds: ["toggle-annotation-style"] } }, { type: "command-button", id: "undo-button", commandId: "history:undo", variant: "icon", categories: ["history", "history-undo"] }, { type: "command-button", id: "redo-button", commandId: "history:redo", variant: "icon", categories: ["history", "history-redo"] }] }, { type: "spacer", id: "spacer-6", flex: true }] }, "form-toolbar": { id: "form-toolbar", position: { placement: "top", slot: "secondary", order: 0 }, responsive: { breakpoints: { sm: { maxWidth: 640, hide: ["add-form-select", "add-form-listbox"], show: ["overflow-forms-tools"] }, md: { minWidth: 640, hide: ["overflow-forms-tools"], show: ["add-form-select", "add-form-listbox"] } } }, permanent: false, categories: ["form"], items: [{ type: "spacer", id: "spacer-form-1", flex: true }, { type: "group", id: "form-tools", alignment: "start", gap: 2, items: [{ type: "command-button", id: "add-form-textfield", commandId: "form:add-textfield", variant: "icon", categories: ["form", "form-textfield"] }, { type: "command-button", id: "add-form-checkbox", commandId: "form:add-checkbox", variant: "icon", categories: ["form", "form-checkbox"] }, { type: "command-button", id: "add-form-radio", commandId: "form:add-radio", variant: "icon", categories: ["form", "form-radio"] }, { type: "command-button", id: "add-form-select", commandId: "form:add-select", variant: "icon", categories: ["form", "form-select"] }, { type: "command-button", id: "add-form-listbox", commandId: "form:add-listbox", variant: "icon", categories: ["form", "form-listbox"] }, { type: "command-button", id: "overflow-forms-tools", commandId: "form:overflow-tools", variant: "icon", categories: ["form", "form-overflow"] }, { type: "divider", id: "form-tools-divider-1", orientation: "vertical" }, { type: "command-button", id: "toggle-annotation-style", commandId: "panel:toggle-annotation-style", variant: "icon", categories: ["panel", "panel-annotation-style"] }, { type: "command-button", id: "toggle-form-fill-mode", commandId: "form:toggle-fill-mode", variant: "icon", categories: ["form", "form-fill-mode"] }, { type: "divider", id: "form-tools-divider-2", orientation: "vertical" }, { type: "command-button", id: "undo-button", commandId: "history:undo", variant: "icon", categories: ["history", "history-undo"] }, { type: "command-button", id: "redo-button", commandId: "history:redo", variant: "icon", categories: ["history", "history-redo"] }] }, { type: "spacer", id: "spacer-form-2", flex: true }] }, "insert-toolbar": { id: "insert-toolbar", position: { placement: "top", slot: "secondary", order: 0 }, permanent: false, categories: ["insert"], items: [{ type: "spacer", id: "spacer-insert-1", flex: true }, { type: "group", id: "insert-tools", alignment: "start", gap: 2, items: [{ type: "command-button", id: "add-rubber-stamp", commandId: "insert:add-rubber-stamp", variant: "icon", categories: ["insert", "insert-rubber-stamp"] }, { type: "command-button", id: "add-signature", commandId: "insert:add-signature", variant: "icon", categories: ["insert", "insert-signature"] }, { type: "command-button", id: "add-image", commandId: "insert:add-image", variant: "icon", categories: ["insert", "insert-image"] }, { type: "divider", id: "insert-tools-divider-1", orientation: "vertical" }, { type: "command-button", id: "toggle-annotation-style", commandId: "panel:toggle-annotation-style", variant: "icon", categories: ["panel", "panel-annotation-style"] }, { type: "divider", id: "insert-tools-divider-2", orientation: "vertical", visibilityDependsOn: { itemIds: ["toggle-annotation-style"] } }, { type: "command-button", id: "undo-button", commandId: "history:undo", variant: "icon", categories: ["history", "history-undo"] }, { type: "command-button", id: "redo-button", commandId: "history:redo", variant: "icon", categories: ["history", "history-redo"] }] }, { type: "spacer", id: "spacer-insert-2", flex: true }] }, "redaction-toolbar": { id: "redaction-toolbar", position: { placement: "top", slot: "secondary", order: 0 }, permanent: false, categories: ["redaction"], items: [{ type: "spacer", id: "spacer-7", flex: true }, { type: "group", id: "redaction-tools", alignment: "start", gap: 2, items: [{ type: "command-button", id: "redact", commandId: "redaction:redact", variant: "icon", categories: ["redaction", "redaction-combined"] }, { type: "divider", id: "redaction-tools-divider-1", orientation: "vertical" }, { type: "command-button", id: "toggle-redaction-panel", commandId: "panel:toggle-redaction", variant: "icon", categories: ["panel", "panel-redaction"] }, { type: "command-button", id: "toggle-annotation-style", commandId: "panel:toggle-annotation-style", variant: "icon", categories: ["panel", "panel-annotation-style"] }, { type: "divider", id: "redaction-tools-divider-2", orientation: "vertical", visibilityDependsOn: { itemIds: ["toggle-annotation-style"] } }, { type: "command-button", id: "undo-button", commandId: "history:undo", variant: "icon", categories: ["history", "history-undo"] }, { type: "command-button", id: "redo-button", commandId: "history:redo", variant: "icon", categories: ["history", "history-redo"] }] }, { type: "spacer", id: "spacer-8", flex: true }] } };
4633
4645
  class yn {
4634
4646
  constructor() {
@@ -4783,15 +4795,15 @@ function Bn(e14) {
4783
4795
  return e14 instanceof HTMLElement ? e14.clientWidth : 0;
4784
4796
  }
4785
4797
  function _n(a2, i2, o2) {
4786
- const l = isRef(a2) ? a2 : computed(() => a2), { registry: h2 } = useRegistry(), { provides: d2 } = useCapability(DocumentManagerPlugin.id), { provides: c2 } = useCapability(nt$1.id), u2 = ref(P2()), p2 = ref(u2.value), g2 = ref(0), m2 = ref(false), f2 = () => {
4798
+ const l = isRef(a2) ? a2 : computed(() => a2), { registry: h2 } = useRegistry(), { provides: d2 } = useCapability(DocumentManagerPlugin.id), { provides: c2 } = useCapability(nt$1.id), u2 = ref(I2()), p2 = ref(u2.value), g2 = ref(0), m2 = ref(false), f2 = () => {
4787
4799
  var _a2;
4788
4800
  return (_a2 = i2.value) == null ? void 0 : _a2.pageWidth;
4789
4801
  }, v = () => (function(e14) {
4790
4802
  return null != e14 && e14 > 0;
4791
- })(f2()), P2 = () => {
4803
+ })(f2()), I2 = () => {
4792
4804
  var _a2;
4793
4805
  return ((_a2 = i2.value) == null ? void 0 : _a2.initial) ?? 1;
4794
- }, I2 = computed(() => {
4806
+ }, P2 = computed(() => {
4795
4807
  var _a2;
4796
4808
  return (function(e14, t2, s2, n9, r2) {
4797
4809
  if (!e14 || s2 <= 0) return r2;
@@ -4803,11 +4815,11 @@ function _n(a2, i2, o2) {
4803
4815
  })(d2.value, l.value, g2.value, f2(), ((_a2 = i2.value) == null ? void 0 : _a2.max) ?? 3);
4804
4816
  }), b2 = computed(() => {
4805
4817
  var _a2;
4806
- return Math.min(((_a2 = i2.value) == null ? void 0 : _a2.min) ?? 0.5, I2.value);
4818
+ return Math.min(((_a2 = i2.value) == null ? void 0 : _a2.min) ?? 0.5, P2.value);
4807
4819
  });
4808
4820
  let S;
4809
4821
  function C2(e14) {
4810
- const t2 = I2.value, s2 = b2.value, n9 = An(e14, s2, t2);
4822
+ const t2 = P2.value, s2 = b2.value, n9 = An(e14, s2, t2);
4811
4823
  p2.value = n9, u2.value = n9, (function(e15, t3, s3, n10 = 0.5, r2 = 3) {
4812
4824
  const a3 = e15 == null ? void 0 : e15.getStore();
4813
4825
  if (!a3) return;
@@ -4828,7 +4840,7 @@ function _n(a2, i2, o2) {
4828
4840
  n9 <= 0 || C2(On(s2, n9));
4829
4841
  }
4830
4842
  function x(e14) {
4831
- if (!m2.value) return v() ? y(e14) : C2(P2()), void (m2.value = true);
4843
+ if (!m2.value) return v() ? y(e14) : C2(I2()), void (m2.value = true);
4832
4844
  C2(p2.value);
4833
4845
  }
4834
4846
  return watch(() => o2 == null ? void 0 : o2.value, (e14) => {
@@ -4852,11 +4864,11 @@ function _n(a2, i2, o2) {
4852
4864
  })(e14, (e15) => {
4853
4865
  g2.value = e15;
4854
4866
  }) : void 0;
4855
- }, { immediate: true }), onBeforeUnmount(() => S == null ? void 0 : S()), watch([h2, () => P2(), () => v()], () => {
4856
- h2.value && (v() || C2(P2()));
4857
- }, { immediate: true }), watch(I2, (e14) => {
4867
+ }, { immediate: true }), onBeforeUnmount(() => S == null ? void 0 : S()), watch([h2, () => I2(), () => v()], () => {
4868
+ h2.value && (v() || C2(I2()));
4869
+ }, { immediate: true }), watch(P2, (e14) => {
4858
4870
  p2.value > e14 && C2(e14);
4859
- }), watch([c2, l, () => v(), () => P2()], () => {
4871
+ }), watch([c2, l, () => v(), () => I2()], () => {
4860
4872
  const e14 = c2.value;
4861
4873
  if (e14) {
4862
4874
  for (const t2 of l.value.chapters) "loaded" === e14.getChapterStatus(t2.chapterId) && x(t2.chapterId);
@@ -4879,7 +4891,7 @@ function _n(a2, i2, o2) {
4879
4891
  }), { scale: u2, setScale: C2, zoomEnabled: () => {
4880
4892
  var _a2;
4881
4893
  return false !== ((_a2 = i2.value) == null ? void 0 : _a2.enabled);
4882
- }, minZoom: b2, maxZoom: I2 };
4894
+ }, minZoom: b2, maxZoom: P2 };
4883
4895
  }
4884
4896
  function Wn(e14, t2, s2) {
4885
4897
  return Math.min(s2, Math.max(t2, e14));
@@ -5281,12 +5293,21 @@ const pr = class e9 extends BasePlugin {
5281
5293
  return 1e4 * this.manifest.chapters.findIndex((t3) => t3.chapterId === e14) + t2;
5282
5294
  }
5283
5295
  scheduleVisibleSegmentLoads(e14) {
5284
- const t2 = [...e14].sort((e15, t3) => e15.priority - t3.priority), s2 = /* @__PURE__ */ new Set(), n9 = [];
5285
- for (const r2 of t2) {
5286
- const e15 = `${r2.chapterId}:${r2.segmentIndex}`;
5287
- s2.has(e15) || (s2.add(e15), this.isSegmentDocumentOpen(r2.chapterId, r2.segmentIndex) || n9.push({ chapterId: r2.chapterId, segmentIndex: r2.segmentIndex }));
5296
+ const t2 = [...e14].sort((e15, t3) => e15.priority - t3.priority), s2 = /* @__PURE__ */ new Set(), n9 = /* @__PURE__ */ new Map(), r2 = [];
5297
+ for (const o2 of t2) {
5298
+ const e15 = `${o2.chapterId}:${o2.segmentIndex}`;
5299
+ s2.has(e15) || (s2.add(e15), this.isSegmentDocumentOpen(o2.chapterId, o2.segmentIndex) || (n9.has(o2.chapterId) || (n9.set(o2.chapterId, []), r2.push(o2.chapterId)), n9.get(o2.chapterId).push({ chapterId: o2.chapterId, segmentIndex: o2.segmentIndex })));
5288
5300
  }
5289
- this.visibleSegmentBacklog = n9, this.pumpVisibleSegmentBacklog();
5301
+ const a2 = [];
5302
+ let i2 = true;
5303
+ for (; i2; ) {
5304
+ i2 = false;
5305
+ for (const e15 of r2) {
5306
+ const t3 = n9.get(e15);
5307
+ t3 && 0 !== t3.length && (a2.push(t3.shift()), i2 = true);
5308
+ }
5309
+ }
5310
+ this.visibleSegmentBacklog = a2, this.pumpVisibleSegmentBacklog();
5290
5311
  }
5291
5312
  pumpVisibleSegmentBacklog() {
5292
5313
  const e14 = Math.max(1, this.config.maxConcurrentSegmentLoads ?? 1);
@@ -5340,13 +5361,6 @@ const pr = class e9 extends BasePlugin {
5340
5361
  }
5341
5362
  if (0 === a2.size) return;
5342
5363
  const l = this.virtualPageMap.atIndex(r2);
5343
- if (l) {
5344
- const e15 = this.findChapter(l.chapterId);
5345
- if (e15) {
5346
- const t3 = or(e15, l.localPageIndex);
5347
- o2(l.chapterId, t3 + 1);
5348
- }
5349
- }
5350
5364
  for (const d2 of a2) this.chapterLastUsed.set(d2, n9);
5351
5365
  const h2 = [...i2.entries()].map(([e15, t3]) => {
5352
5366
  const [s3, n10] = e15.split(":");
@@ -5786,7 +5800,7 @@ const fr = class extends BasePlugin {
5786
5800
  };
5787
5801
  fr.id = "chapter-scroll";
5788
5802
  let vr = fr;
5789
- const Pr = ["data-global-page-index", "data-chapter-id", "data-local-page-index"], Ir = /* @__PURE__ */ ((e14, t2) => {
5803
+ const Ir = ["data-global-page-index", "data-chapter-id", "data-local-page-index"], Pr = /* @__PURE__ */ ((e14, t2) => {
5790
5804
  const s2 = e14.__vccOpts || e14;
5791
5805
  for (const [n9, r2] of t2) s2[n9] = r2;
5792
5806
  return s2;
@@ -5803,7 +5817,7 @@ const Pr = ["data-global-page-index", "data-chapter-id", "data-local-page-index"
5803
5817
  null == f2 || f2(), null == (e15 = t2.value) || e15.registerViewport(null);
5804
5818
  }), watch(t2, v), (e15, t3) => {
5805
5819
  var s2, n9, r2;
5806
- return openBlock(), createElementBlock("div", { ref_key: "containerRef", ref: a2, "data-chapter-scroll-viewport": "", class: normalizeClass(e15.$props.class), style: normalizeStyle({ overflow: "auto", overflowX: "hidden", position: "relative", width: "100%", height: "100%", ...e15.$props.style }) }, [createElementVNode("div", { style: normalizeStyle({ position: "relative", width: `${(null == (s2 = m2.value) ? void 0 : s2.totalWidth) ?? 0}px`, height: `${(null == (n9 = m2.value) ? void 0 : n9.totalHeight) ?? 0}px`, margin: "0 auto" }) }, [(openBlock(true), createElementBlock(Fragment, null, renderList((null == (r2 = m2.value) ? void 0 : r2.items) ?? [], (s3) => (openBlock(), createElementBlock("div", { key: s3.globalPageIndex, "data-global-page-index": s3.globalPageIndex, "data-chapter-id": s3.chapterId, "data-local-page-index": s3.localPageIndex, style: normalizeStyle({ position: "absolute", top: `${s3.offsetTop}px`, left: "50%", transform: "translateX(-50%)", width: `${s3.width}px`, height: `${s3.height}px`, backgroundColor: s3.isPlaceholder ? "#f3f4f6" : "#fff", boxShadow: "0 1px 4px rgba(0,0,0,0.08)" }) }, [s3.isPlaceholder ? renderSlot(e15.$slots, "placeholder", { key: 0, item: s3 }, () => [t3[0] || (t3[0] = createElementVNode("div", { class: "chapter-scroll-placeholder" }, "Loading chapter…", -1))], true) : renderSlot(e15.$slots, "page", { key: 1, item: s3 }, void 0, true)], 12, Pr))), 128))], 4)], 6);
5820
+ return openBlock(), createElementBlock("div", { ref_key: "containerRef", ref: a2, "data-chapter-scroll-viewport": "", class: normalizeClass(e15.$props.class), style: normalizeStyle({ overflow: "auto", overflowX: "hidden", position: "relative", width: "100%", height: "100%", ...e15.$props.style }) }, [createElementVNode("div", { style: normalizeStyle({ position: "relative", width: `${(null == (s2 = m2.value) ? void 0 : s2.totalWidth) ?? 0}px`, height: `${(null == (n9 = m2.value) ? void 0 : n9.totalHeight) ?? 0}px`, margin: "0 auto" }) }, [(openBlock(true), createElementBlock(Fragment, null, renderList((null == (r2 = m2.value) ? void 0 : r2.items) ?? [], (s3) => (openBlock(), createElementBlock("div", { key: s3.globalPageIndex, "data-global-page-index": s3.globalPageIndex, "data-chapter-id": s3.chapterId, "data-local-page-index": s3.localPageIndex, style: normalizeStyle({ position: "absolute", top: `${s3.offsetTop}px`, left: "50%", transform: "translateX(-50%)", width: `${s3.width}px`, height: `${s3.height}px`, backgroundColor: s3.isPlaceholder ? "#f3f4f6" : "#fff", boxShadow: "0 1px 4px rgba(0,0,0,0.08)" }) }, [s3.isPlaceholder ? renderSlot(e15.$slots, "placeholder", { key: 0, item: s3 }, () => [t3[0] || (t3[0] = createElementVNode("div", { class: "chapter-scroll-placeholder" }, "Loading chapter…", -1))], true) : renderSlot(e15.$slots, "page", { key: 1, item: s3 }, void 0, true)], 12, Ir))), 128))], 4)], 6);
5807
5821
  };
5808
5822
  } }), [["__scopeId", "data-v-e9ab4da3"]]), br = /* @__PURE__ */ defineComponent({ __name: "ChapterRenderLayer", props: { chapterId: {}, localPageIndex: {}, pdfDocumentId: {}, pdfPageIndex: {}, scale: {}, dpr: {}, class: {} }, setup(e14) {
5809
5823
  const t2 = e14;
@@ -6113,12 +6127,21 @@ const Tr = class e10 extends BasePlugin {
6113
6127
  return 1e4 * this.manifest.chapters.findIndex((t3) => t3.chapterId === e14) + t2;
6114
6128
  }
6115
6129
  scheduleVisibleSegmentLoads(e14) {
6116
- const t2 = [...e14].sort((e15, t3) => e15.priority - t3.priority), s2 = /* @__PURE__ */ new Set(), n9 = [];
6117
- for (const r2 of t2) {
6118
- const e15 = `${r2.chapterId}:${r2.segmentIndex}`;
6119
- s2.has(e15) || (s2.add(e15), this.isSegmentDocumentOpen(r2.chapterId, r2.segmentIndex) || n9.push({ chapterId: r2.chapterId, segmentIndex: r2.segmentIndex }));
6130
+ const t2 = [...e14].sort((e15, t3) => e15.priority - t3.priority), s2 = /* @__PURE__ */ new Set(), n9 = /* @__PURE__ */ new Map(), r2 = [];
6131
+ for (const o2 of t2) {
6132
+ const e15 = `${o2.chapterId}:${o2.segmentIndex}`;
6133
+ s2.has(e15) || (s2.add(e15), this.isSegmentDocumentOpen(o2.chapterId, o2.segmentIndex) || (n9.has(o2.chapterId) || (n9.set(o2.chapterId, []), r2.push(o2.chapterId)), n9.get(o2.chapterId).push({ chapterId: o2.chapterId, segmentIndex: o2.segmentIndex })));
6134
+ }
6135
+ const a2 = [];
6136
+ let i2 = true;
6137
+ for (; i2; ) {
6138
+ i2 = false;
6139
+ for (const e15 of r2) {
6140
+ const t3 = n9.get(e15);
6141
+ t3 && 0 !== t3.length && (a2.push(t3.shift()), i2 = true);
6142
+ }
6120
6143
  }
6121
- this.visibleSegmentBacklog = n9, this.pumpVisibleSegmentBacklog();
6144
+ this.visibleSegmentBacklog = a2, this.pumpVisibleSegmentBacklog();
6122
6145
  }
6123
6146
  pumpVisibleSegmentBacklog() {
6124
6147
  const e14 = Math.max(1, this.config.maxConcurrentSegmentLoads ?? 1);
@@ -6172,13 +6195,6 @@ const Tr = class e10 extends BasePlugin {
6172
6195
  }
6173
6196
  if (0 === a2.size) return;
6174
6197
  const l = this.virtualPageMap.atIndex(r2);
6175
- if (l) {
6176
- const e15 = this.findChapter(l.chapterId);
6177
- if (e15) {
6178
- const t3 = kr(e15, l.localPageIndex);
6179
- o2(l.chapterId, t3 + 1);
6180
- }
6181
- }
6182
6198
  for (const d2 of a2) this.chapterLastUsed.set(d2, n9);
6183
6199
  const h2 = [...i2.entries()].map(([e15, t3]) => {
6184
6200
  const [s3, n10] = e15.split(":");
@@ -6733,12 +6749,21 @@ const sa = class e11 extends BasePlugin {
6733
6749
  return 1e4 * this.manifest.chapters.findIndex((t3) => t3.chapterId === e14) + t2;
6734
6750
  }
6735
6751
  scheduleVisibleSegmentLoads(e14) {
6736
- const t2 = [...e14].sort((e15, t3) => e15.priority - t3.priority), s2 = /* @__PURE__ */ new Set(), n9 = [];
6737
- for (const r2 of t2) {
6738
- const e15 = `${r2.chapterId}:${r2.segmentIndex}`;
6739
- s2.has(e15) || (s2.add(e15), this.isSegmentDocumentOpen(r2.chapterId, r2.segmentIndex) || n9.push({ chapterId: r2.chapterId, segmentIndex: r2.segmentIndex }));
6752
+ const t2 = [...e14].sort((e15, t3) => e15.priority - t3.priority), s2 = /* @__PURE__ */ new Set(), n9 = /* @__PURE__ */ new Map(), r2 = [];
6753
+ for (const o2 of t2) {
6754
+ const e15 = `${o2.chapterId}:${o2.segmentIndex}`;
6755
+ s2.has(e15) || (s2.add(e15), this.isSegmentDocumentOpen(o2.chapterId, o2.segmentIndex) || (n9.has(o2.chapterId) || (n9.set(o2.chapterId, []), r2.push(o2.chapterId)), n9.get(o2.chapterId).push({ chapterId: o2.chapterId, segmentIndex: o2.segmentIndex })));
6740
6756
  }
6741
- this.visibleSegmentBacklog = n9, this.pumpVisibleSegmentBacklog();
6757
+ const a2 = [];
6758
+ let i2 = true;
6759
+ for (; i2; ) {
6760
+ i2 = false;
6761
+ for (const e15 of r2) {
6762
+ const t3 = n9.get(e15);
6763
+ t3 && 0 !== t3.length && (a2.push(t3.shift()), i2 = true);
6764
+ }
6765
+ }
6766
+ this.visibleSegmentBacklog = a2, this.pumpVisibleSegmentBacklog();
6742
6767
  }
6743
6768
  pumpVisibleSegmentBacklog() {
6744
6769
  const e14 = Math.max(1, this.config.maxConcurrentSegmentLoads ?? 1);
@@ -6792,13 +6817,6 @@ const sa = class e11 extends BasePlugin {
6792
6817
  }
6793
6818
  if (0 === a2.size) return;
6794
6819
  const l = this.virtualPageMap.atIndex(r2);
6795
- if (l) {
6796
- const e15 = this.findChapter(l.chapterId);
6797
- if (e15) {
6798
- const t3 = Zr(e15, l.localPageIndex);
6799
- o2(l.chapterId, t3 + 1);
6800
- }
6801
- }
6802
6820
  for (const d2 of a2) this.chapterLastUsed.set(d2, n9);
6803
6821
  const h2 = [...i2.entries()].map(([e15, t3]) => {
6804
6822
  const [s3, n10] = e15.split(":");
@@ -7366,15 +7384,15 @@ const ca = { key: 0, style: { position: "absolute", inset: "0", pointerEvents: "
7366
7384
  d2.value = e16.filter((e17) => e17.chapterId === a2.chapterId && e17.localPageIndex === a2.localPageIndex);
7367
7385
  });
7368
7386
  }, { immediate: true });
7369
- let I2 = null;
7387
+ let P2 = null;
7370
7388
  watch(m2, (e15) => {
7371
- I2 && (document.removeEventListener("mousedown", I2), I2 = null), e15 && (I2 = (t2) => {
7389
+ P2 && (document.removeEventListener("mousedown", P2), P2 = null), e15 && (P2 = (t2) => {
7372
7390
  var _a2;
7373
7391
  const s2 = t2.target;
7374
7392
  ((_a2 = s2.closest) == null ? void 0 : _a2.call(s2, `[data-note-marker-zone="${e15}"]`)) || (m2.value = null, g2.value = null);
7375
- }, document.addEventListener("mousedown", I2));
7393
+ }, document.addEventListener("mousedown", P2));
7376
7394
  }), onBeforeUnmount(() => {
7377
- I2 && document.removeEventListener("mousedown", I2);
7395
+ P2 && document.removeEventListener("mousedown", P2);
7378
7396
  });
7379
7397
  const b2 = computed(() => {
7380
7398
  var _a2;
@@ -7401,14 +7419,14 @@ const ca = { key: 0, style: { position: "absolute", inset: "0", pointerEvents: "
7401
7419
  return s3 = e15.noteId, (_a2 = i2.value) == null ? void 0 : _a2.requestDeleteNote(s3), void (m2.value = null);
7402
7420
  var s3;
7403
7421
  } }, " 删除 ", 8, fa)], 36)) : createCommentVNode("", true)], 44, pa)) : createCommentVNode("", true)], 64))), 128))])) : createCommentVNode("", true);
7404
- } }), Pa = { key: 0, style: { position: "absolute", inset: "0", pointerEvents: "none" } }, Ia = ["title", "onClick"], ba = ["onClick"], Sa = /* @__PURE__ */ defineComponent({ __name: "BookmarkMarkerLayer", props: { chapterId: {}, localPageIndex: {}, pdfPageWidth: {}, pdfPageHeight: {}, cssPageWidth: {}, cssPageHeight: {}, ui: {} }, setup(e14) {
7422
+ } }), Ia = { key: 0, style: { position: "absolute", inset: "0", pointerEvents: "none" } }, Pa = ["title", "onClick"], ba = ["onClick"], Sa = /* @__PURE__ */ defineComponent({ __name: "BookmarkMarkerLayer", props: { chapterId: {}, localPageIndex: {}, pdfPageWidth: {}, pdfPageHeight: {}, cssPageWidth: {}, cssPageHeight: {}, ui: {} }, setup(e14) {
7405
7423
  const a2 = e14, { provides: i2 } = useCapability(bn.id), d2 = ref([]), g2 = ref(null), m2 = ref(null);
7406
- function I2() {
7424
+ function P2() {
7407
7425
  const e15 = i2.value;
7408
7426
  e15 && (d2.value = e15.listBookmarks().filter((e16) => e16.anchor.chapterId === a2.chapterId && e16.anchor.localPageIndex === a2.localPageIndex));
7409
7427
  }
7410
7428
  watch(i2, (e15) => {
7411
- if (e15) return I2(), e15.onBookmarksChange(I2);
7429
+ if (e15) return P2(), e15.onBookmarksChange(P2);
7412
7430
  }, { immediate: true });
7413
7431
  let b2 = null;
7414
7432
  watch(g2, (e15) => {
@@ -7431,8 +7449,8 @@ const ca = { key: 0, style: { position: "absolute", inset: "0", pointerEvents: "
7431
7449
  })(e15);
7432
7450
  return { position: "absolute", left: `${Math.max(0, t2 - 6)}px`, top: `${Math.max(0, s2 - 6)}px`, width: `${S.value + 12}px`, height: `${S.value + 12}px`, pointerEvents: "auto", zIndex: 20 };
7433
7451
  }
7434
- return (t2, s2) => unref(i2) && d2.value.length && e14.pdfPageWidth && e14.pdfPageHeight ? (openBlock(), createElementBlock("div", Pa, [(openBlock(true), createElementBlock(Fragment, null, renderList(d2.value, (e15) => (openBlock(), createElementBlock("div", { key: e15.id, style: normalizeStyle(C2(e15)), onMousedown: s2[1] || (s2[1] = withModifiers(() => {
7435
- }, ["stop"])) }, [createElementVNode("button", { type: "button", title: e15.label, style: normalizeStyle({ position: "absolute", left: "6px", top: "6px", width: `${S.value}px`, height: `${S.value}px`, border: "none", borderRadius: "4px", background: "#3b82f6", color: "#fff", cursor: "pointer", boxShadow: "0 2px 6px rgba(37, 99, 235, 0.35)", fontSize: "11px", padding: 0 }), onClick: withModifiers((t3) => g2.value = g2.value === e15.id ? null : e15.id, ["stop"]) }, " 🔖 ", 12, Ia), g2.value === e15.id ? (openBlock(), createElementBlock("div", { key: 0, ref_for: true, ref_key: "deleteMenuRef", ref: m2, style: { position: "absolute", left: "6px", top: "-36px", zIndex: 30, pointerEvents: "auto", minWidth: "88px", padding: "4px", borderRadius: "6px", background: "#fff", border: "1px solid #e5e7eb", boxShadow: "0 4px 12px rgba(0,0,0,0.12)" }, onClick: s2[0] || (s2[0] = withModifiers(() => {
7452
+ return (t2, s2) => unref(i2) && d2.value.length && e14.pdfPageWidth && e14.pdfPageHeight ? (openBlock(), createElementBlock("div", Ia, [(openBlock(true), createElementBlock(Fragment, null, renderList(d2.value, (e15) => (openBlock(), createElementBlock("div", { key: e15.id, style: normalizeStyle(C2(e15)), onMousedown: s2[1] || (s2[1] = withModifiers(() => {
7453
+ }, ["stop"])) }, [createElementVNode("button", { type: "button", title: e15.label, style: normalizeStyle({ position: "absolute", left: "6px", top: "6px", width: `${S.value}px`, height: `${S.value}px`, border: "none", borderRadius: "4px", background: "#3b82f6", color: "#fff", cursor: "pointer", boxShadow: "0 2px 6px rgba(37, 99, 235, 0.35)", fontSize: "11px", padding: 0 }), onClick: withModifiers((t3) => g2.value = g2.value === e15.id ? null : e15.id, ["stop"]) }, " 🔖 ", 12, Pa), g2.value === e15.id ? (openBlock(), createElementBlock("div", { key: 0, ref_for: true, ref_key: "deleteMenuRef", ref: m2, style: { position: "absolute", left: "6px", top: "-36px", zIndex: 30, pointerEvents: "auto", minWidth: "88px", padding: "4px", borderRadius: "6px", background: "#fff", border: "1px solid #e5e7eb", boxShadow: "0 4px 12px rgba(0,0,0,0.12)" }, onClick: s2[0] || (s2[0] = withModifiers(() => {
7436
7454
  }, ["stop"])) }, [createElementVNode("button", { type: "button", style: { width: "100%", padding: "6px 8px", "font-size": "12px", border: "none", "border-radius": "4px", background: "transparent", color: "#dc2626", cursor: "pointer", "text-align": "left" }, onClick: (t3) => (async function(e16) {
7437
7455
  const t4 = i2.value;
7438
7456
  if (!t4) return;
@@ -7540,13 +7558,13 @@ const ka = /* @__PURE__ */ defineComponent({ __name: "ChapterPageSurface", props
7540
7558
  if (t2) return { background: t2 };
7541
7559
  })((_a2 = s2.features) == null ? void 0 : _a2.selectionToolbar);
7542
7560
  });
7543
- return (t2, s3) => e14.item.isPlaceholder ? createCommentVNode("", true) : (openBlock(), createBlock(unref(GlobalPointerProvider), { key: 0, "document-id": r2.value }, { default: withCtx(() => [createVNode(unref(Rotate), { "document-id": r2.value, "page-index": a2.value, style: { backgroundColor: "#fff" } }, { default: withCtx(() => [createVNode(unref(PagePointerProvider), { "document-id": r2.value, "page-index": a2.value, style: normalizeStyle(unref(Ie)), onPointerdown: unref(be$1) }, { default: withCtx(() => [createVNode(unref(br), { "chapter-id": e14.item.chapterId, "local-page-index": e14.item.localPageIndex, "pdf-document-id": r2.value, "pdf-page-index": a2.value }, null, 8, ["chapter-id", "local-page-index", "pdf-document-id", "pdf-page-index"]), createVNode(unref(SelectionLayer), { "document-id": r2.value, "page-index": a2.value, "text-style": w2.value, "selection-menu": u2.value }, null, 8, ["document-id", "page-index", "text-style", "selection-menu"]), e14.showRedactionLayer ? (openBlock(), createBlock(unref(RedactionLayer), { key: 0, "document-id": r2.value, "page-index": a2.value, "selection-menu": e14.redactionSelectionMenu }, null, 8, ["document-id", "page-index", "selection-menu"])) : createCommentVNode("", true), createVNode(unref(AnnotationLayer), { "document-id": r2.value, "page-index": a2.value, "selection-menu": v.value }, null, 8, ["document-id", "page-index", "selection-menu"]), e14.showBookmarkMarkers && d2.value ? (openBlock(), createBlock(Sa, { key: 1, "chapter-id": e14.item.chapterId, "local-page-index": e14.item.localPageIndex, "pdf-page-width": d2.value.size.width, "pdf-page-height": d2.value.size.height, "css-page-width": e14.item.width, "css-page-height": e14.item.height, ui: e14.bookmarkMarkerUi }, null, 8, ["chapter-id", "local-page-index", "pdf-page-width", "pdf-page-height", "css-page-width", "css-page-height", "ui"])) : createCommentVNode("", true), y.value ? (openBlock(), createBlock(resolveDynamicComponent(y.value), { key: 2 })) : createCommentVNode("", true), e14.showNoteMarkers && d2.value ? (openBlock(), createBlock(va, { key: 3, "chapter-id": e14.item.chapterId, "local-page-index": e14.item.localPageIndex, "pdf-page-width": d2.value.size.width, "pdf-page-height": d2.value.size.height, "css-page-width": e14.item.width, "css-page-height": e14.item.height, ui: e14.noteMarkerUi }, null, 8, ["chapter-id", "local-page-index", "pdf-page-width", "pdf-page-height", "css-page-width", "css-page-height", "ui"])) : createCommentVNode("", true), renderSlot(t2.$slots, "default")]), _: 3 }, 8, ["document-id", "page-index", "style", "onPointerdown"])]), _: 3 }, 8, ["document-id", "page-index"])]), _: 3 }, 8, ["document-id"]));
7561
+ return (t2, s3) => e14.item.isPlaceholder ? createCommentVNode("", true) : (openBlock(), createBlock(unref(GlobalPointerProvider), { key: 0, "document-id": r2.value }, { default: withCtx(() => [createVNode(unref(Rotate), { "document-id": r2.value, "page-index": a2.value, style: { backgroundColor: "#fff" } }, { default: withCtx(() => [createVNode(unref(PagePointerProvider), { "document-id": r2.value, "page-index": a2.value, style: normalizeStyle(unref(Pe$1)), onPointerdown: unref(be$1) }, { default: withCtx(() => [createVNode(unref(br), { "chapter-id": e14.item.chapterId, "local-page-index": e14.item.localPageIndex, "pdf-document-id": r2.value, "pdf-page-index": a2.value }, null, 8, ["chapter-id", "local-page-index", "pdf-document-id", "pdf-page-index"]), createVNode(unref(SelectionLayer), { "document-id": r2.value, "page-index": a2.value, "text-style": w2.value, "selection-menu": u2.value }, null, 8, ["document-id", "page-index", "text-style", "selection-menu"]), e14.showRedactionLayer ? (openBlock(), createBlock(unref(RedactionLayer), { key: 0, "document-id": r2.value, "page-index": a2.value, "selection-menu": e14.redactionSelectionMenu }, null, 8, ["document-id", "page-index", "selection-menu"])) : createCommentVNode("", true), createVNode(unref(AnnotationLayer), { "document-id": r2.value, "page-index": a2.value, "selection-menu": v.value }, null, 8, ["document-id", "page-index", "selection-menu"]), e14.showBookmarkMarkers && d2.value ? (openBlock(), createBlock(Sa, { key: 1, "chapter-id": e14.item.chapterId, "local-page-index": e14.item.localPageIndex, "pdf-page-width": d2.value.size.width, "pdf-page-height": d2.value.size.height, "css-page-width": e14.item.width, "css-page-height": e14.item.height, ui: e14.bookmarkMarkerUi }, null, 8, ["chapter-id", "local-page-index", "pdf-page-width", "pdf-page-height", "css-page-width", "css-page-height", "ui"])) : createCommentVNode("", true), y.value ? (openBlock(), createBlock(resolveDynamicComponent(y.value), { key: 2 })) : createCommentVNode("", true), e14.showNoteMarkers && d2.value ? (openBlock(), createBlock(va, { key: 3, "chapter-id": e14.item.chapterId, "local-page-index": e14.item.localPageIndex, "pdf-page-width": d2.value.size.width, "pdf-page-height": d2.value.size.height, "css-page-width": e14.item.width, "css-page-height": e14.item.height, ui: e14.noteMarkerUi }, null, 8, ["chapter-id", "local-page-index", "pdf-page-width", "pdf-page-height", "css-page-width", "css-page-height", "ui"])) : createCommentVNode("", true), renderSlot(t2.$slots, "default")]), _: 3 }, 8, ["document-id", "page-index", "style", "onPointerdown"])]), _: 3 }, 8, ["document-id", "page-index"])]), _: 3 }, 8, ["document-id"]));
7544
7562
  } });
7545
7563
  const Da = /* @__PURE__ */ defineComponent({ __name: "HoverBookmarkLayer", props: { item: {}, pdfPageWidth: {}, pdfPageHeight: {}, cssPageWidth: {}, cssPageHeight: {}, hoverUi: {} }, setup(e14) {
7546
- const a2 = e14, i2 = computed(() => Ca(a2.item)), { provides: d2 } = useCapability(SelectionPlugin.id), { provides: u2 } = useCapability(bn.id), p2 = ref(null), g2 = ref(null), m2 = ref(null), I2 = ref(null), b2 = computed(() => {
7564
+ const a2 = e14, i2 = computed(() => Ca(a2.item)), { provides: d2 } = useCapability(SelectionPlugin.id), { provides: u2 } = useCapability(bn.id), p2 = ref(null), g2 = ref(null), m2 = ref(null), P2 = ref(null), b2 = computed(() => {
7547
7565
  var _a2;
7548
7566
  return ((_a2 = a2.hoverUi) == null ? void 0 : _a2.iconSize) ?? 16;
7549
- }), S = computed(() => I2.value ?? m2.value);
7567
+ }), S = computed(() => P2.value ?? m2.value);
7550
7568
  let C2 = null, y = 0;
7551
7569
  function w2() {
7552
7570
  const e15 = d2.value;
@@ -7573,9 +7591,9 @@ const Da = /* @__PURE__ */ defineComponent({ __name: "HoverBookmarkLayer", props
7573
7591
  };
7574
7592
  }, { immediate: true });
7575
7593
  let x = null;
7576
- watch([g2, () => a2.pdfPageWidth, I2, d2], () => {
7594
+ watch([g2, () => a2.pdfPageWidth, P2, d2], () => {
7577
7595
  x && (document.removeEventListener("mousemove", x), x = null), g2.value && a2.pdfPageWidth && (x = (e15) => {
7578
- if (I2.value) return;
7596
+ if (P2.value) return;
7579
7597
  const t2 = d2.value;
7580
7598
  if (t2) try {
7581
7599
  if (t2.forDocument(i2.value).getState().selecting) return void (m2.value = null);
@@ -7607,7 +7625,7 @@ const Da = /* @__PURE__ */ defineComponent({ __name: "HoverBookmarkLayer", props
7607
7625
  });
7608
7626
  function k2() {
7609
7627
  const e15 = u2.value, t2 = L2.value;
7610
- e15 && t2 && !$2.value && (e15.addBookmark({ label: `书签 ${/* @__PURE__ */ (/* @__PURE__ */ new Date()).toLocaleTimeString("zh-CN", { hour: "2-digit", minute: "2-digit" })}`, anchor: t2 }), m2.value = null, I2.value = null);
7628
+ e15 && t2 && !$2.value && (e15.addBookmark({ label: `书签 ${/* @__PURE__ */ (/* @__PURE__ */ new Date()).toLocaleTimeString("zh-CN", { hour: "2-digit", minute: "2-digit" })}`, anchor: t2 }), m2.value = null, P2.value = null);
7611
7629
  }
7612
7630
  const D2 = computed(() => {
7613
7631
  const e15 = S.value, t2 = e15 == null ? void 0 : e15[e15.length - 1];
@@ -7617,15 +7635,15 @@ const Da = /* @__PURE__ */ defineComponent({ __name: "HoverBookmarkLayer", props
7617
7635
  });
7618
7636
  return (t2, s2) => {
7619
7637
  var _a2;
7620
- return unref(u2) && e14.pdfPageWidth && e14.pdfPageHeight ? (openBlock(), createElementBlock("div", { key: 0, ref_key: "rootRef", ref: p2, style: { position: "absolute", inset: "0", zIndex: 14, pointerEvents: "none" } }, [D2.value && S.value && !$2.value ? (openBlock(), createElementBlock("div", { key: 0, style: normalizeStyle({ position: "absolute", left: `${D2.value.zoneLeft}px`, top: `${D2.value.zoneTop}px`, width: `${D2.value.size + 20}px`, height: `${(((_a2 = S.value[S.value.length - 1]) == null ? void 0 : _a2.size.height) ?? 0) * (e14.cssPageHeight / e14.pdfPageHeight) + D2.value.size + 12}px`, pointerEvents: "auto" }), onMouseenter: s2[0] || (s2[0] = (e15) => I2.value = S.value), onMouseleave: s2[1] || (s2[1] = (e15) => I2.value = null) }, [createElementVNode("button", { type: "button", title: "添加书签", style: normalizeStyle({ position: "absolute", left: D2.value.iconLeft - D2.value.zoneLeft + "px", top: D2.value.iconTop - D2.value.zoneTop + "px", width: `${D2.value.size}px`, height: `${D2.value.size}px`, cursor: "pointer", display: "flex", alignItems: "center", justifyContent: "center", background: "#3b82f6", color: "#fff", border: "none", borderRadius: "4px", boxShadow: "0 2px 8px rgba(37, 99, 235, 0.45)", fontSize: "12px", padding: 0 }), onClick: withModifiers(k2, ["stop"]) }, " 🔖 ", 4)], 36)) : createCommentVNode("", true)], 512)) : createCommentVNode("", true);
7638
+ return unref(u2) && e14.pdfPageWidth && e14.pdfPageHeight ? (openBlock(), createElementBlock("div", { key: 0, ref_key: "rootRef", ref: p2, style: { position: "absolute", inset: "0", zIndex: 14, pointerEvents: "none" } }, [D2.value && S.value && !$2.value ? (openBlock(), createElementBlock("div", { key: 0, style: normalizeStyle({ position: "absolute", left: `${D2.value.zoneLeft}px`, top: `${D2.value.zoneTop}px`, width: `${D2.value.size + 20}px`, height: `${(((_a2 = S.value[S.value.length - 1]) == null ? void 0 : _a2.size.height) ?? 0) * (e14.cssPageHeight / e14.pdfPageHeight) + D2.value.size + 12}px`, pointerEvents: "auto" }), onMouseenter: s2[0] || (s2[0] = (e15) => P2.value = S.value), onMouseleave: s2[1] || (s2[1] = (e15) => P2.value = null) }, [createElementVNode("button", { type: "button", title: "添加书签", style: normalizeStyle({ position: "absolute", left: D2.value.iconLeft - D2.value.zoneLeft + "px", top: D2.value.iconTop - D2.value.zoneTop + "px", width: `${D2.value.size}px`, height: `${D2.value.size}px`, cursor: "pointer", display: "flex", alignItems: "center", justifyContent: "center", background: "#3b82f6", color: "#fff", border: "none", borderRadius: "4px", boxShadow: "0 2px 8px rgba(37, 99, 235, 0.45)", fontSize: "12px", padding: 0 }), onClick: withModifiers(k2, ["stop"]) }, " 🔖 ", 4)], 36)) : createCommentVNode("", true)], 512)) : createCommentVNode("", true);
7621
7639
  };
7622
7640
  } }), Ua = { key: 0, width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", "aria-hidden": "" }, Ea = { key: 1, width: "24", height: "24", viewBox: "0 0 28 28", fill: "none", "aria-hidden": "" }, Va = { key: 0, x: "5", y: "4", width: "18", height: "20", rx: "3", fill: "#fde047" }, Na = { key: 1, d: "M6 22h16", stroke: "#dc2626", "stroke-width": "2.2", "stroke-linecap": "round" }, Ta = { key: 2, d: "M6 22c2-2 3-2 5 0s3 2 5 0 3-2 5 0", stroke: "#dc2626", "stroke-width": "2", "stroke-linecap": "round", fill: "none" }, Fa = { key: 3, d: "M5 14h18", stroke: "#dc2626", "stroke-width": "2.2", "stroke-linecap": "round" }, Aa = { key: 2, width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", "aria-hidden": "" }, Oa = /* @__PURE__ */ defineComponent({ __name: "SelectionToolbarIcons", props: { kind: {} }, setup: (e14) => (t2, s2) => "copy" === e14.kind ? (openBlock(), createElementBlock("svg", Ua, [...s2[0] || (s2[0] = [createElementVNode("rect", { x: "8.5", y: "8.5", width: "11", height: "13", rx: "2.25", fill: "#f1f5f9", stroke: "#94a3b8", "stroke-width": "1.35" }, null, -1), createElementVNode("rect", { x: "4.5", y: "3.5", width: "11", height: "13", rx: "2.25", fill: "#ffffff", stroke: "#334155", "stroke-width": "1.5" }, null, -1), createElementVNode("path", { d: "M7.5 7h5.5a1.5 1.5 0 0 1 1.5 1.5V14", stroke: "#64748b", "stroke-width": "1.2", "stroke-linecap": "round" }, null, -1)])])) : "note" !== e14.kind ? (openBlock(), createElementBlock("svg", Ea, ["highlight" === e14.kind ? (openBlock(), createElementBlock("rect", Va)) : createCommentVNode("", true), s2[1] || (s2[1] = createElementVNode("text", { x: "14", y: "19", "text-anchor": "middle", "font-size": "15", "font-weight": "700", "font-family": "system-ui, -apple-system, sans-serif", fill: "#0f172a" }, " A ", -1)), "underline" === e14.kind ? (openBlock(), createElementBlock("path", Na)) : "squiggly" === e14.kind ? (openBlock(), createElementBlock("path", Ta)) : "strikeout" === e14.kind ? (openBlock(), createElementBlock("path", Fa)) : createCommentVNode("", true)])) : (openBlock(), createElementBlock("svg", Aa, [...s2[2] || (s2[2] = [createElementVNode("path", { d: "M8 3h8l4 4v14H8V3z", fill: "#fef3c7", stroke: "#d97706", "stroke-width": "1.2", "stroke-linejoin": "round" }, null, -1), createElementVNode("path", { d: "M16 3v4h4", stroke: "#d97706", "stroke-width": "1.2" }, null, -1), createElementVNode("path", { d: "M10 12h6M10 16h4", stroke: "#92400e", "stroke-width": "1.2", "stroke-linecap": "round" }, null, -1)])])) }), Ra = ["title", "aria-label", "onMouseenter", "onClick"], za = ["title", "onMouseenter", "onClick"], Ga = { style: { "font-size": "11px", "font-weight": "600" } }, Ba = /* @__PURE__ */ defineComponent({ __name: "SelectionToolbarCard", props: { placementAbove: { type: Boolean }, anchorHeight: {}, hiddenBuiltinActions: {}, extraActions: {}, renderCopyIcon: { type: Function } }, emits: ["action"], setup(e14, { emit: n9 }) {
7623
- const r2 = e14, a2 = n9, i2 = [{ id: "highlight", label: "高亮背景" }, { id: "underline", label: "下划线" }, { id: "squiggly", label: "波浪线" }, { id: "strikeout", label: "删除线" }], d2 = computed(() => new Set(r2.hiddenBuiltinActions ?? [])), g2 = computed(() => !d2.value.has("copy")), f2 = computed(() => i2.filter((e15) => !d2.value.has(e15.id))), v = computed(() => !d2.value.has("note")), I2 = computed(() => [...r2.extraActions ?? []].sort((e15, t2) => (e15.order ?? 0) - (t2.order ?? 0))), b2 = computed(() => f2.value.length > 0 || I2.value.length > 0), w2 = ref(null), M2 = computed(() => ({ position: "absolute", pointerEvents: "auto", left: "50%", transform: "translateX(-50%)", top: r2.placementAbove ? void 0 : `${r2.anchorHeight + 10}px`, bottom: r2.placementAbove ? `${r2.anchorHeight + 10}px` : void 0, display: "flex", alignItems: "center", gap: "2px", padding: "4px 6px", borderRadius: "12px", background: "rgba(255, 255, 255, 0.96)", border: "1px solid rgba(15, 23, 42, 0.06)", boxShadow: "0 2px 8px rgba(15, 23, 42, 0.08), 0 12px 32px rgba(15, 23, 42, 0.1)", backdropFilter: "blur(10px)", WebkitBackdropFilter: "blur(10px)" }));
7641
+ const r2 = e14, a2 = n9, i2 = [{ id: "highlight", label: "高亮背景" }, { id: "underline", label: "下划线" }, { id: "squiggly", label: "波浪线" }, { id: "strikeout", label: "删除线" }], d2 = computed(() => new Set(r2.hiddenBuiltinActions ?? [])), g2 = computed(() => !d2.value.has("copy")), f2 = computed(() => i2.filter((e15) => !d2.value.has(e15.id))), v = computed(() => !d2.value.has("note")), P2 = computed(() => [...r2.extraActions ?? []].sort((e15, t2) => (e15.order ?? 0) - (t2.order ?? 0))), b2 = computed(() => f2.value.length > 0 || P2.value.length > 0), w2 = ref(null), M2 = computed(() => ({ position: "absolute", pointerEvents: "auto", left: "50%", transform: "translateX(-50%)", top: r2.placementAbove ? void 0 : `${r2.anchorHeight + 10}px`, bottom: r2.placementAbove ? `${r2.anchorHeight + 10}px` : void 0, display: "flex", alignItems: "center", gap: "2px", padding: "4px 6px", borderRadius: "12px", background: "rgba(255, 255, 255, 0.96)", border: "1px solid rgba(15, 23, 42, 0.06)", boxShadow: "0 2px 8px rgba(15, 23, 42, 0.08), 0 12px 32px rgba(15, 23, 42, 0.1)", backdropFilter: "blur(10px)", WebkitBackdropFilter: "blur(10px)" }));
7624
7642
  function x(e15, t2 = false) {
7625
7643
  return { display: "flex", alignItems: "center", justifyContent: "center", width: "32px", height: "32px", padding: 0, margin: 0, border: "none", borderRadius: "8px", background: w2.value === e15 ? t2 ? "#fffbeb" : "#f1f5f9" : "transparent", color: t2 ? "#b45309" : "#334155", cursor: "pointer", flexShrink: 0, WebkitAppearance: "none", appearance: "none" };
7626
7644
  }
7627
7645
  const L2 = { width: "1px", height: "20px", margin: "0 4px", background: "rgba(15, 23, 42, 0.1)", flexShrink: 0 };
7628
- return (t2, s2) => (openBlock(), createElementBlock("div", { role: "toolbar", "aria-label": "选区工具", style: normalizeStyle(M2.value) }, [g2.value ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [createElementVNode("button", { type: "button", title: "复制", "aria-label": "复制", style: normalizeStyle(x("copy")), onMouseenter: s2[0] || (s2[0] = (e15) => w2.value = "copy"), onMouseleave: s2[1] || (s2[1] = (e15) => w2.value = null), onClick: s2[2] || (s2[2] = (e15) => a2("action", "copy")) }, [e14.renderCopyIcon ? (openBlock(), createBlock(resolveDynamicComponent(e14.renderCopyIcon), { key: 0 })) : (openBlock(), createBlock(Oa, { key: 1, kind: "copy" }))], 36), b2.value ? (openBlock(), createElementBlock("span", { key: 0, style: L2, "aria-hidden": "" })) : createCommentVNode("", true)], 64)) : createCommentVNode("", true), (openBlock(true), createElementBlock(Fragment, null, renderList(f2.value, (e15) => (openBlock(), createElementBlock("button", { key: e15.id, type: "button", title: e15.label, "aria-label": e15.label, style: normalizeStyle(x(e15.id)), onMouseenter: (t3) => w2.value = e15.id, onMouseleave: s2[3] || (s2[3] = (e16) => w2.value = null), onClick: (t3) => a2("action", e15.id) }, [createVNode(Oa, { kind: e15.id }, null, 8, ["kind"])], 44, Ra))), 128)), (openBlock(true), createElementBlock(Fragment, null, renderList(I2.value, (e15) => (openBlock(), createElementBlock("button", { key: e15.id, type: "button", title: e15.label, style: normalizeStyle(x(e15.id)), onMouseenter: (t3) => w2.value = e15.id, onMouseleave: s2[4] || (s2[4] = (e16) => w2.value = null), onClick: (t3) => a2("action", e15.id) }, [createElementVNode("span", Ga, toDisplayString(e15.label.slice(0, 2)), 1)], 44, za))), 128)), v.value ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [b2.value || g2.value ? (openBlock(), createElementBlock("span", { key: 0, style: L2, "aria-hidden": "" })) : createCommentVNode("", true), createElementVNode("button", { type: "button", title: "添加笔记", "aria-label": "添加笔记", style: normalizeStyle(x("note", true)), onMouseenter: s2[5] || (s2[5] = (e15) => w2.value = "note"), onMouseleave: s2[6] || (s2[6] = (e15) => w2.value = null), onClick: s2[7] || (s2[7] = (e15) => a2("action", "note")) }, [createVNode(Oa, { kind: "note" })], 36)], 64)) : createCommentVNode("", true)], 4));
7646
+ return (t2, s2) => (openBlock(), createElementBlock("div", { role: "toolbar", "aria-label": "选区工具", style: normalizeStyle(M2.value) }, [g2.value ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [createElementVNode("button", { type: "button", title: "复制", "aria-label": "复制", style: normalizeStyle(x("copy")), onMouseenter: s2[0] || (s2[0] = (e15) => w2.value = "copy"), onMouseleave: s2[1] || (s2[1] = (e15) => w2.value = null), onClick: s2[2] || (s2[2] = (e15) => a2("action", "copy")) }, [e14.renderCopyIcon ? (openBlock(), createBlock(resolveDynamicComponent(e14.renderCopyIcon), { key: 0 })) : (openBlock(), createBlock(Oa, { key: 1, kind: "copy" }))], 36), b2.value ? (openBlock(), createElementBlock("span", { key: 0, style: L2, "aria-hidden": "" })) : createCommentVNode("", true)], 64)) : createCommentVNode("", true), (openBlock(true), createElementBlock(Fragment, null, renderList(f2.value, (e15) => (openBlock(), createElementBlock("button", { key: e15.id, type: "button", title: e15.label, "aria-label": e15.label, style: normalizeStyle(x(e15.id)), onMouseenter: (t3) => w2.value = e15.id, onMouseleave: s2[3] || (s2[3] = (e16) => w2.value = null), onClick: (t3) => a2("action", e15.id) }, [createVNode(Oa, { kind: e15.id }, null, 8, ["kind"])], 44, Ra))), 128)), (openBlock(true), createElementBlock(Fragment, null, renderList(P2.value, (e15) => (openBlock(), createElementBlock("button", { key: e15.id, type: "button", title: e15.label, style: normalizeStyle(x(e15.id)), onMouseenter: (t3) => w2.value = e15.id, onMouseleave: s2[4] || (s2[4] = (e16) => w2.value = null), onClick: (t3) => a2("action", e15.id) }, [createElementVNode("span", Ga, toDisplayString(e15.label.slice(0, 2)), 1)], 44, za))), 128)), v.value ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [b2.value || g2.value ? (openBlock(), createElementBlock("span", { key: 0, style: L2, "aria-hidden": "" })) : createCommentVNode("", true), createElementVNode("button", { type: "button", title: "添加笔记", "aria-label": "添加笔记", style: normalizeStyle(x("note", true)), onMouseenter: s2[5] || (s2[5] = (e15) => w2.value = "note"), onMouseleave: s2[6] || (s2[6] = (e15) => w2.value = null), onClick: s2[7] || (s2[7] = (e15) => a2("action", "note")) }, [createVNode(Oa, { kind: "note" })], 36)], 64)) : createCommentVNode("", true)], 4));
7629
7647
  } }), _a = { highlight: "highlight", underline: "underline", squiggly: "squiggly", strikeout: "strikeout" };
7630
7648
  const Wa = /* @__PURE__ */ defineComponent({ __name: "PdfChapterViewport", props: { className: {}, features: {}, buildSelectionMenu: {}, annotationSelectionMenu: {}, redactionSelectionMenu: {}, showNoteMarkers: { type: Boolean, default: true }, showBookmarkMarkers: { type: Boolean, default: true }, showRedactionLayer: { type: Boolean, default: false }, renderPageOverlay: {}, onExtraSelectionAction: {} }, setup(e14) {
7631
7649
  const s2 = e14, n9 = computed(() => s2.features), { hostRef: r2 } = Kn(n9), a2 = computed(() => {
@@ -7659,7 +7677,7 @@ const Wa = /* @__PURE__ */ defineComponent({ __name: "PdfChapterViewport", props
7659
7677
  }), v = computed(() => {
7660
7678
  var _a2, _b;
7661
7679
  return u2.value && false !== ((_b = (_a2 = s2.features) == null ? void 0 : _a2.bookmarks) == null ? void 0 : _b.enabled);
7662
- }), P2 = (function(e15, s3) {
7680
+ }), I2 = (function(e15, s3) {
7663
7681
  const n10 = computed(() => {
7664
7682
  var _a2;
7665
7683
  return (_a2 = e15()) == null ? void 0 : _a2.selectionToolbar;
@@ -7706,8 +7724,8 @@ const Wa = /* @__PURE__ */ defineComponent({ __name: "PdfChapterViewport", props
7706
7724
  };
7707
7725
  });
7708
7726
  })(() => s2.features, { onExtraAction: s2.onExtraSelectionAction }), C2 = computed(() => {
7709
- if (s2.buildSelectionMenu || P2.value) return (e15) => {
7710
- const t2 = P2.value ? P2.value(e15) : e15.defaultMenu;
7727
+ if (s2.buildSelectionMenu || I2.value) return (e15) => {
7728
+ const t2 = I2.value ? I2.value(e15) : e15.defaultMenu;
7711
7729
  return s2.buildSelectionMenu ? s2.buildSelectionMenu({ ...e15, defaultMenu: t2 }) : t2;
7712
7730
  };
7713
7731
  }), { provides: y } = useCapability(DocumentManagerPlugin.id);
@@ -7725,7 +7743,7 @@ const Wa = /* @__PURE__ */ defineComponent({ __name: "PdfChapterViewport", props
7725
7743
  const n10 = (_a2 = s2.renderPageOverlay) == null ? void 0 : _a2.call(s2, e15);
7726
7744
  if (n10 && t2.push(n10), t2.length) return h$1("div", t2);
7727
7745
  }
7728
- return (t2, s3) => (openBlock(), createElementBlock("div", { ref_key: "hostRef", ref: r2, class: normalizeClass(e14.className), style: normalizeStyle(e14.className ? void 0 : unref(Pe$1)) }, [createVNode(unref(Ir), { class: normalizeClass(e14.className), style: normalizeStyle(a2.value) }, { page: withCtx(({ item: t3 }) => {
7746
+ return (t2, s3) => (openBlock(), createElementBlock("div", { ref_key: "hostRef", ref: r2, class: normalizeClass(e14.className), style: normalizeStyle(e14.className ? void 0 : unref(Ie)) }, [createVNode(unref(Pr), { class: normalizeClass(e14.className), style: normalizeStyle(a2.value) }, { page: withCtx(({ item: t3 }) => {
7729
7747
  var _a2, _b, _c, _d;
7730
7748
  return [createVNode(ka, { item: t3, features: e14.features, "show-note-markers": p2.value, "show-bookmark-markers": m2.value, "show-redaction-layer": e14.showRedactionLayer, "note-marker-ui": (_b = (_a2 = e14.features) == null ? void 0 : _a2.notes) == null ? void 0 : _b.marker, "bookmark-marker-ui": (_d = (_c = e14.features) == null ? void 0 : _c.bookmarks) == null ? void 0 : _d.marker, "build-selection-menu": C2.value, "create-note": unref(i2), "annotation-selection-menu": e14.annotationSelectionMenu, "redaction-selection-menu": e14.redactionSelectionMenu, "render-page-overlay": x }, null, 8, ["item", "features", "show-note-markers", "show-bookmark-markers", "show-redaction-layer", "note-marker-ui", "bookmark-marker-ui", "build-selection-menu", "create-note", "annotation-selection-menu", "redaction-selection-menu"])];
7731
7749
  }), _: 1 }, 8, ["class", "style"]), renderSlot(t2.$slots, "default")], 6));
@@ -7736,7 +7754,7 @@ const Wa = /* @__PURE__ */ defineComponent({ __name: "PdfChapterViewport", props
7736
7754
  const t2 = ke$1(e15.features), { plugins: s3 } = Un({ ...e15.editorOptions, features: t2 });
7737
7755
  return { plugins: s3, features: t2, editorOptions: { ...e15.editorOptions, features: t2 } };
7738
7756
  })({ engine: s2.engine, options: s2.options, editorOptions: s2.editorOptions, features: s2.features }));
7739
- return (t2, s3) => (openBlock(), createElementBlock("div", { class: normalizeClass(e14.className), style: normalizeStyle(e14.className ? void 0 : unref(Pe$1)) }, [createVNode(unref(EmbedPDF), { engine: e14.engine, plugins: n9.value.plugins }, { default: withCtx(({ pluginsReady: s4 }) => [s4 ? (openBlock(), createElementBlock("div", qa, [renderSlot(t2.$slots, "prepend"), createVNode(Wa, { class: normalizeClass(e14.viewportClassName), style: { flex: 1, minHeight: 0 }, features: n9.value.features, "on-extra-selection-action": e14.onExtraSelectionAction }, null, 8, ["class", "features", "on-extra-selection-action"]), renderSlot(t2.$slots, "default")])) : createCommentVNode("", true)]), _: 3 }, 8, ["engine", "plugins"])], 6));
7757
+ return (t2, s3) => (openBlock(), createElementBlock("div", { class: normalizeClass(e14.className), style: normalizeStyle(e14.className ? void 0 : unref(Ie)) }, [createVNode(unref(EmbedPDF), { engine: e14.engine, plugins: n9.value.plugins }, { default: withCtx(({ pluginsReady: s4 }) => [s4 ? (openBlock(), createElementBlock("div", qa, [renderSlot(t2.$slots, "prepend"), createVNode(Wa, { class: normalizeClass(e14.viewportClassName), style: { flex: 1, minHeight: 0 }, features: n9.value.features, "on-extra-selection-action": e14.onExtraSelectionAction }, null, 8, ["class", "features", "on-extra-selection-action"]), renderSlot(t2.$slots, "default")])) : createCommentVNode("", true)]), _: 3 }, 8, ["engine", "plugins"])], 6));
7740
7758
  } }), Ka = { class: "chapter-tree-row" }, ja = ["aria-expanded"], Xa = { key: 1, class: "chapter-tree-toggle-spacer", "aria-hidden": "" }, Za = { class: "chapter-tree-label" }, Ya = { class: "chapter-tree-meta" }, Qa = { key: 0 }, Ja = (e14, t2) => {
7741
7759
  const s2 = e14.__vccOpts || e14;
7742
7760
  for (const [n9, r2] of t2) s2[n9] = r2;
@@ -8097,12 +8115,21 @@ const B = class n extends BasePlugin {
8097
8115
  return 1e4 * this.manifest.chapters.findIndex((t3) => t3.chapterId === e14) + t2;
8098
8116
  }
8099
8117
  scheduleVisibleSegmentLoads(e14) {
8100
- const t2 = [...e14].sort((e15, t3) => e15.priority - t3.priority), s2 = /* @__PURE__ */ new Set(), n9 = [];
8101
- for (const r2 of t2) {
8102
- const e15 = `${r2.chapterId}:${r2.segmentIndex}`;
8103
- s2.has(e15) || (s2.add(e15), this.isSegmentDocumentOpen(r2.chapterId, r2.segmentIndex) || n9.push({ chapterId: r2.chapterId, segmentIndex: r2.segmentIndex }));
8118
+ const t2 = [...e14].sort((e15, t3) => e15.priority - t3.priority), s2 = /* @__PURE__ */ new Set(), n9 = /* @__PURE__ */ new Map(), r2 = [];
8119
+ for (const o2 of t2) {
8120
+ const e15 = `${o2.chapterId}:${o2.segmentIndex}`;
8121
+ s2.has(e15) || (s2.add(e15), this.isSegmentDocumentOpen(o2.chapterId, o2.segmentIndex) || (n9.has(o2.chapterId) || (n9.set(o2.chapterId, []), r2.push(o2.chapterId)), n9.get(o2.chapterId).push({ chapterId: o2.chapterId, segmentIndex: o2.segmentIndex })));
8122
+ }
8123
+ const a2 = [];
8124
+ let i2 = true;
8125
+ for (; i2; ) {
8126
+ i2 = false;
8127
+ for (const e15 of r2) {
8128
+ const t3 = n9.get(e15);
8129
+ t3 && 0 !== t3.length && (a2.push(t3.shift()), i2 = true);
8130
+ }
8104
8131
  }
8105
- this.visibleSegmentBacklog = n9, this.pumpVisibleSegmentBacklog();
8132
+ this.visibleSegmentBacklog = a2, this.pumpVisibleSegmentBacklog();
8106
8133
  }
8107
8134
  pumpVisibleSegmentBacklog() {
8108
8135
  const e14 = Math.max(1, this.config.maxConcurrentSegmentLoads ?? 1);
@@ -8156,13 +8183,6 @@ const B = class n extends BasePlugin {
8156
8183
  }
8157
8184
  if (0 === a2.size) return;
8158
8185
  const h2 = this.virtualPageMap.atIndex(r2);
8159
- if (h2) {
8160
- const e15 = this.findChapter(h2.chapterId);
8161
- if (e15) {
8162
- const t3 = T(e15, h2.localPageIndex);
8163
- o2(h2.chapterId, t3 + 1);
8164
- }
8165
- }
8166
8186
  for (const d2 of a2) this.chapterLastUsed.set(d2, n9);
8167
8187
  const l = [...i2.entries()].map(([e15, t3]) => {
8168
8188
  const [s3, n10] = e15.split(":");
@@ -8717,12 +8737,21 @@ const ce = class n2 extends BasePlugin {
8717
8737
  return 1e4 * this.manifest.chapters.findIndex((t3) => t3.chapterId === e14) + t2;
8718
8738
  }
8719
8739
  scheduleVisibleSegmentLoads(e14) {
8720
- const t2 = [...e14].sort((e15, t3) => e15.priority - t3.priority), s2 = /* @__PURE__ */ new Set(), n9 = [];
8721
- for (const r2 of t2) {
8722
- const e15 = `${r2.chapterId}:${r2.segmentIndex}`;
8723
- s2.has(e15) || (s2.add(e15), this.isSegmentDocumentOpen(r2.chapterId, r2.segmentIndex) || n9.push({ chapterId: r2.chapterId, segmentIndex: r2.segmentIndex }));
8740
+ const t2 = [...e14].sort((e15, t3) => e15.priority - t3.priority), s2 = /* @__PURE__ */ new Set(), n9 = /* @__PURE__ */ new Map(), r2 = [];
8741
+ for (const o2 of t2) {
8742
+ const e15 = `${o2.chapterId}:${o2.segmentIndex}`;
8743
+ s2.has(e15) || (s2.add(e15), this.isSegmentDocumentOpen(o2.chapterId, o2.segmentIndex) || (n9.has(o2.chapterId) || (n9.set(o2.chapterId, []), r2.push(o2.chapterId)), n9.get(o2.chapterId).push({ chapterId: o2.chapterId, segmentIndex: o2.segmentIndex })));
8744
+ }
8745
+ const a2 = [];
8746
+ let i2 = true;
8747
+ for (; i2; ) {
8748
+ i2 = false;
8749
+ for (const e15 of r2) {
8750
+ const t3 = n9.get(e15);
8751
+ t3 && 0 !== t3.length && (a2.push(t3.shift()), i2 = true);
8752
+ }
8724
8753
  }
8725
- this.visibleSegmentBacklog = n9, this.pumpVisibleSegmentBacklog();
8754
+ this.visibleSegmentBacklog = a2, this.pumpVisibleSegmentBacklog();
8726
8755
  }
8727
8756
  pumpVisibleSegmentBacklog() {
8728
8757
  const e14 = Math.max(1, this.config.maxConcurrentSegmentLoads ?? 1);
@@ -8776,13 +8805,6 @@ const ce = class n2 extends BasePlugin {
8776
8805
  }
8777
8806
  if (0 === a2.size) return;
8778
8807
  const h2 = this.virtualPageMap.atIndex(r2);
8779
- if (h2) {
8780
- const e15 = this.findChapter(h2.chapterId);
8781
- if (e15) {
8782
- const t3 = ae(e15, h2.localPageIndex);
8783
- o2(h2.chapterId, t3 + 1);
8784
- }
8785
- }
8786
8808
  for (const d2 of a2) this.chapterLastUsed.set(d2, n9);
8787
8809
  const l = [...i2.entries()].map(([e15, t3]) => {
8788
8810
  const [s3, n10] = e15.split(":");
@@ -9525,12 +9547,21 @@ const Ee = class n3 extends BasePlugin {
9525
9547
  return 1e4 * this.manifest.chapters.findIndex((t3) => t3.chapterId === e14) + t2;
9526
9548
  }
9527
9549
  scheduleVisibleSegmentLoads(e14) {
9528
- const t2 = [...e14].sort((e15, t3) => e15.priority - t3.priority), s2 = /* @__PURE__ */ new Set(), n9 = [];
9529
- for (const r2 of t2) {
9530
- const e15 = `${r2.chapterId}:${r2.segmentIndex}`;
9531
- s2.has(e15) || (s2.add(e15), this.isSegmentDocumentOpen(r2.chapterId, r2.segmentIndex) || n9.push({ chapterId: r2.chapterId, segmentIndex: r2.segmentIndex }));
9550
+ const t2 = [...e14].sort((e15, t3) => e15.priority - t3.priority), s2 = /* @__PURE__ */ new Set(), n9 = /* @__PURE__ */ new Map(), r2 = [];
9551
+ for (const o2 of t2) {
9552
+ const e15 = `${o2.chapterId}:${o2.segmentIndex}`;
9553
+ s2.has(e15) || (s2.add(e15), this.isSegmentDocumentOpen(o2.chapterId, o2.segmentIndex) || (n9.has(o2.chapterId) || (n9.set(o2.chapterId, []), r2.push(o2.chapterId)), n9.get(o2.chapterId).push({ chapterId: o2.chapterId, segmentIndex: o2.segmentIndex })));
9554
+ }
9555
+ const a2 = [];
9556
+ let i2 = true;
9557
+ for (; i2; ) {
9558
+ i2 = false;
9559
+ for (const e15 of r2) {
9560
+ const t3 = n9.get(e15);
9561
+ t3 && 0 !== t3.length && (a2.push(t3.shift()), i2 = true);
9562
+ }
9532
9563
  }
9533
- this.visibleSegmentBacklog = n9, this.pumpVisibleSegmentBacklog();
9564
+ this.visibleSegmentBacklog = a2, this.pumpVisibleSegmentBacklog();
9534
9565
  }
9535
9566
  pumpVisibleSegmentBacklog() {
9536
9567
  const e14 = Math.max(1, this.config.maxConcurrentSegmentLoads ?? 1);
@@ -9584,13 +9615,6 @@ const Ee = class n3 extends BasePlugin {
9584
9615
  }
9585
9616
  if (0 === a2.size) return;
9586
9617
  const h2 = this.virtualPageMap.atIndex(r2);
9587
- if (h2) {
9588
- const e15 = this.findChapter(h2.chapterId);
9589
- if (e15) {
9590
- const t3 = Le(e15, h2.localPageIndex);
9591
- o2(h2.chapterId, t3 + 1);
9592
- }
9593
- }
9594
9618
  for (const d2 of a2) this.chapterLastUsed.set(d2, n9);
9595
9619
  const l = [...i2.entries()].map(([e15, t3]) => {
9596
9620
  const [s3, n10] = e15.split(":");
@@ -10145,12 +10169,21 @@ const et2 = class n4 extends BasePlugin {
10145
10169
  return 1e4 * this.manifest.chapters.findIndex((t3) => t3.chapterId === e14) + t2;
10146
10170
  }
10147
10171
  scheduleVisibleSegmentLoads(e14) {
10148
- const t2 = [...e14].sort((e15, t3) => e15.priority - t3.priority), s2 = /* @__PURE__ */ new Set(), n9 = [];
10149
- for (const r2 of t2) {
10150
- const e15 = `${r2.chapterId}:${r2.segmentIndex}`;
10151
- s2.has(e15) || (s2.add(e15), this.isSegmentDocumentOpen(r2.chapterId, r2.segmentIndex) || n9.push({ chapterId: r2.chapterId, segmentIndex: r2.segmentIndex }));
10172
+ const t2 = [...e14].sort((e15, t3) => e15.priority - t3.priority), s2 = /* @__PURE__ */ new Set(), n9 = /* @__PURE__ */ new Map(), r2 = [];
10173
+ for (const o2 of t2) {
10174
+ const e15 = `${o2.chapterId}:${o2.segmentIndex}`;
10175
+ s2.has(e15) || (s2.add(e15), this.isSegmentDocumentOpen(o2.chapterId, o2.segmentIndex) || (n9.has(o2.chapterId) || (n9.set(o2.chapterId, []), r2.push(o2.chapterId)), n9.get(o2.chapterId).push({ chapterId: o2.chapterId, segmentIndex: o2.segmentIndex })));
10176
+ }
10177
+ const a2 = [];
10178
+ let i2 = true;
10179
+ for (; i2; ) {
10180
+ i2 = false;
10181
+ for (const e15 of r2) {
10182
+ const t3 = n9.get(e15);
10183
+ t3 && 0 !== t3.length && (a2.push(t3.shift()), i2 = true);
10184
+ }
10152
10185
  }
10153
- this.visibleSegmentBacklog = n9, this.pumpVisibleSegmentBacklog();
10186
+ this.visibleSegmentBacklog = a2, this.pumpVisibleSegmentBacklog();
10154
10187
  }
10155
10188
  pumpVisibleSegmentBacklog() {
10156
10189
  const e14 = Math.max(1, this.config.maxConcurrentSegmentLoads ?? 1);
@@ -10204,13 +10237,6 @@ const et2 = class n4 extends BasePlugin {
10204
10237
  }
10205
10238
  if (0 === a2.size) return;
10206
10239
  const h2 = this.virtualPageMap.atIndex(r2);
10207
- if (h2) {
10208
- const e15 = this.findChapter(h2.chapterId);
10209
- if (e15) {
10210
- const t3 = je(e15, h2.localPageIndex);
10211
- o2(h2.chapterId, t3 + 1);
10212
- }
10213
- }
10214
10240
  for (const d2 of a2) this.chapterLastUsed.set(d2, n9);
10215
10241
  const l = [...i2.entries()].map(([e15, t3]) => {
10216
10242
  const [s3, n10] = e15.split(":");
@@ -11068,12 +11094,21 @@ const Mt = class n6 extends BasePlugin {
11068
11094
  return 1e4 * this.manifest.chapters.findIndex((t3) => t3.chapterId === e14) + t2;
11069
11095
  }
11070
11096
  scheduleVisibleSegmentLoads(e14) {
11071
- const t2 = [...e14].sort((e15, t3) => e15.priority - t3.priority), s2 = /* @__PURE__ */ new Set(), n9 = [];
11072
- for (const r2 of t2) {
11073
- const e15 = `${r2.chapterId}:${r2.segmentIndex}`;
11074
- s2.has(e15) || (s2.add(e15), this.isSegmentDocumentOpen(r2.chapterId, r2.segmentIndex) || n9.push({ chapterId: r2.chapterId, segmentIndex: r2.segmentIndex }));
11097
+ const t2 = [...e14].sort((e15, t3) => e15.priority - t3.priority), s2 = /* @__PURE__ */ new Set(), n9 = /* @__PURE__ */ new Map(), r2 = [];
11098
+ for (const o2 of t2) {
11099
+ const e15 = `${o2.chapterId}:${o2.segmentIndex}`;
11100
+ s2.has(e15) || (s2.add(e15), this.isSegmentDocumentOpen(o2.chapterId, o2.segmentIndex) || (n9.has(o2.chapterId) || (n9.set(o2.chapterId, []), r2.push(o2.chapterId)), n9.get(o2.chapterId).push({ chapterId: o2.chapterId, segmentIndex: o2.segmentIndex })));
11101
+ }
11102
+ const a2 = [];
11103
+ let i2 = true;
11104
+ for (; i2; ) {
11105
+ i2 = false;
11106
+ for (const e15 of r2) {
11107
+ const t3 = n9.get(e15);
11108
+ t3 && 0 !== t3.length && (a2.push(t3.shift()), i2 = true);
11109
+ }
11075
11110
  }
11076
- this.visibleSegmentBacklog = n9, this.pumpVisibleSegmentBacklog();
11111
+ this.visibleSegmentBacklog = a2, this.pumpVisibleSegmentBacklog();
11077
11112
  }
11078
11113
  pumpVisibleSegmentBacklog() {
11079
11114
  const e14 = Math.max(1, this.config.maxConcurrentSegmentLoads ?? 1);
@@ -11127,13 +11162,6 @@ const Mt = class n6 extends BasePlugin {
11127
11162
  }
11128
11163
  if (0 === a2.size) return;
11129
11164
  const h2 = this.virtualPageMap.atIndex(r2);
11130
- if (h2) {
11131
- const e15 = this.findChapter(h2.chapterId);
11132
- if (e15) {
11133
- const t3 = Pt(e15, h2.localPageIndex);
11134
- o2(h2.chapterId, t3 + 1);
11135
- }
11136
- }
11137
11165
  for (const d2 of a2) this.chapterLastUsed.set(d2, n9);
11138
11166
  const l = [...i2.entries()].map(([e15, t3]) => {
11139
11167
  const [s3, n10] = e15.split(":");
@@ -11688,12 +11716,21 @@ const Kt = class n7 extends BasePlugin {
11688
11716
  return 1e4 * this.manifest.chapters.findIndex((t3) => t3.chapterId === e14) + t2;
11689
11717
  }
11690
11718
  scheduleVisibleSegmentLoads(e14) {
11691
- const t2 = [...e14].sort((e15, t3) => e15.priority - t3.priority), s2 = /* @__PURE__ */ new Set(), n9 = [];
11692
- for (const r2 of t2) {
11693
- const e15 = `${r2.chapterId}:${r2.segmentIndex}`;
11694
- s2.has(e15) || (s2.add(e15), this.isSegmentDocumentOpen(r2.chapterId, r2.segmentIndex) || n9.push({ chapterId: r2.chapterId, segmentIndex: r2.segmentIndex }));
11719
+ const t2 = [...e14].sort((e15, t3) => e15.priority - t3.priority), s2 = /* @__PURE__ */ new Set(), n9 = /* @__PURE__ */ new Map(), r2 = [];
11720
+ for (const o2 of t2) {
11721
+ const e15 = `${o2.chapterId}:${o2.segmentIndex}`;
11722
+ s2.has(e15) || (s2.add(e15), this.isSegmentDocumentOpen(o2.chapterId, o2.segmentIndex) || (n9.has(o2.chapterId) || (n9.set(o2.chapterId, []), r2.push(o2.chapterId)), n9.get(o2.chapterId).push({ chapterId: o2.chapterId, segmentIndex: o2.segmentIndex })));
11723
+ }
11724
+ const a2 = [];
11725
+ let i2 = true;
11726
+ for (; i2; ) {
11727
+ i2 = false;
11728
+ for (const e15 of r2) {
11729
+ const t3 = n9.get(e15);
11730
+ t3 && 0 !== t3.length && (a2.push(t3.shift()), i2 = true);
11731
+ }
11695
11732
  }
11696
- this.visibleSegmentBacklog = n9, this.pumpVisibleSegmentBacklog();
11733
+ this.visibleSegmentBacklog = a2, this.pumpVisibleSegmentBacklog();
11697
11734
  }
11698
11735
  pumpVisibleSegmentBacklog() {
11699
11736
  const e14 = Math.max(1, this.config.maxConcurrentSegmentLoads ?? 1);
@@ -11747,13 +11784,6 @@ const Kt = class n7 extends BasePlugin {
11747
11784
  }
11748
11785
  if (0 === a2.size) return;
11749
11786
  const h2 = this.virtualPageMap.atIndex(r2);
11750
- if (h2) {
11751
- const e15 = this.findChapter(h2.chapterId);
11752
- if (e15) {
11753
- const t3 = Gt(e15, h2.localPageIndex);
11754
- o2(h2.chapterId, t3 + 1);
11755
- }
11756
- }
11757
11787
  for (const d2 of a2) this.chapterLastUsed.set(d2, n9);
11758
11788
  const l = [...i2.entries()].map(([e15, t3]) => {
11759
11789
  const [s3, n10] = e15.split(":");
@@ -12323,7 +12353,7 @@ function fs(e14) {
12323
12353
  function vs(e14, t2) {
12324
12354
  return `${e14}#s${t2}`;
12325
12355
  }
12326
- function Is(e14) {
12356
+ function Is2(e14) {
12327
12357
  const t2 = (function(e15) {
12328
12358
  if (null != e15.segmentPageThreshold && e15.segmentPageThreshold > 0) return e15.segmentPageThreshold;
12329
12359
  const t3 = e15.source;
@@ -12343,8 +12373,8 @@ function Is(e14) {
12343
12373
  }
12344
12374
  return { chapterId: e14.chapterId, threshold: t2, pageCount: s2, segments: a2 };
12345
12375
  }
12346
- function Ps2(e14, t2) {
12347
- const s2 = Is(e14);
12376
+ function Ps(e14, t2) {
12377
+ const s2 = Is2(e14);
12348
12378
  if (!s2) return 0;
12349
12379
  const n9 = s2.segments.find((e15) => t2 >= e15.localPageStart && t2 <= e15.localPageEnd);
12350
12380
  return (n9 == null ? void 0 : n9.index) ?? Math.floor(t2 / s2.threshold);
@@ -12475,7 +12505,7 @@ async function Gs(e14, t2, s2) {
12475
12505
  if (!i3) return;
12476
12506
  const o3 = /* @__PURE__ */ new Map();
12477
12507
  for (const h3 of n10) {
12478
- const e16 = h3.annotation.pageIndex, t4 = Ps2(i3, e16), s4 = a3.segments[t4];
12508
+ const e16 = h3.annotation.pageIndex, t4 = Ps(i3, e16), s4 = a3.segments[t4];
12479
12509
  if (!s4) continue;
12480
12510
  const n11 = o3.get(t4) ?? [];
12481
12511
  n11.push({ ...h3, annotation: { ...h3.annotation, pageIndex: e16 - s4.localPageStart } }), o3.set(t4, n11);
@@ -12992,13 +13022,29 @@ const _ChapterManagerPlugin = class _ChapterManagerPlugin2 extends BasePlugin {
12992
13022
  scheduleVisibleSegmentLoads(ranked) {
12993
13023
  const sorted = [...ranked].sort((a2, b2) => a2.priority - b2.priority);
12994
13024
  const seen = /* @__PURE__ */ new Set();
12995
- const nextBacklog = [];
13025
+ const grouped = /* @__PURE__ */ new Map();
13026
+ const chapterOrder = [];
12996
13027
  for (const t2 of sorted) {
12997
13028
  const k2 = `${t2.chapterId}:${t2.segmentIndex}`;
12998
13029
  if (seen.has(k2)) continue;
12999
13030
  seen.add(k2);
13000
13031
  if (this.isSegmentDocumentOpen(t2.chapterId, t2.segmentIndex)) continue;
13001
- nextBacklog.push({ chapterId: t2.chapterId, segmentIndex: t2.segmentIndex });
13032
+ if (!grouped.has(t2.chapterId)) {
13033
+ grouped.set(t2.chapterId, []);
13034
+ chapterOrder.push(t2.chapterId);
13035
+ }
13036
+ grouped.get(t2.chapterId).push({ chapterId: t2.chapterId, segmentIndex: t2.segmentIndex });
13037
+ }
13038
+ const nextBacklog = [];
13039
+ let remaining = true;
13040
+ while (remaining) {
13041
+ remaining = false;
13042
+ for (const chapterId of chapterOrder) {
13043
+ const queue = grouped.get(chapterId);
13044
+ if (!queue || queue.length === 0) continue;
13045
+ nextBacklog.push(queue.shift());
13046
+ remaining = true;
13047
+ }
13002
13048
  }
13003
13049
  this.visibleSegmentBacklog = nextBacklog;
13004
13050
  this.pumpVisibleSegmentBacklog();
@@ -13074,13 +13120,6 @@ const _ChapterManagerPlugin = class _ChapterManagerPlugin2 extends BasePlugin {
13074
13120
  }
13075
13121
  if (visibleChapters.size === 0) return;
13076
13122
  const focalLoc = this.virtualPageMap.atIndex(focalIdx);
13077
- if (focalLoc) {
13078
- const focalChapter = this.findChapter(focalLoc.chapterId);
13079
- if (focalChapter) {
13080
- const focalSeg = i(focalChapter, focalLoc.localPageIndex);
13081
- setSegPriority(focalLoc.chapterId, focalSeg + 1);
13082
- }
13083
- }
13084
13123
  for (const cid of visibleChapters) {
13085
13124
  this.chapterLastUsed.set(cid, now);
13086
13125
  }