@embedpdf-editor/vue3-chapter-viewer 0.3.4 → 0.3.5

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
@@ -29,39 +29,40 @@ function we$1() {
29
29
  var _a2;
30
30
  "undefined" != typeof window && ((_a2 = window.getSelection()) == null ? void 0 : _a2.removeAllRanges());
31
31
  }
32
- const ye = { highlight: { offsetY: 0 }, underline: { offsetY: 2.5 }, squiggly: { offsetY: 4 }, strikeout: { offsetY: 0 } }, Ce = { highlight: PdfAnnotationSubtype.HIGHLIGHT, underline: PdfAnnotationSubtype.UNDERLINE, squiggly: PdfAnnotationSubtype.SQUIGGLY, strikeout: PdfAnnotationSubtype.STRIKEOUT };
33
- function Ie(e14, t2) {
32
+ const ye = "#f1f5f9", Ce = { highlight: { offsetY: 0 }, underline: { offsetY: 2.5 }, squiggly: { offsetY: 4 }, strikeout: { offsetY: 0 } }, Ie = { highlight: PdfAnnotationSubtype.HIGHLIGHT, underline: PdfAnnotationSubtype.UNDERLINE, squiggly: PdfAnnotationSubtype.SQUIGGLY, strikeout: PdfAnnotationSubtype.STRIKEOUT };
33
+ function Me(e14, t2) {
34
34
  return 0 === t2 ? e14 : e14.map((e15) => ({ origin: { x: e15.origin.x, y: e15.origin.y + t2 }, size: { ...e15.size } }));
35
35
  }
36
- function Me(e14) {
36
+ function Se(e14) {
37
37
  let t2 = 1 / 0, a3 = 1 / 0, s9 = -1 / 0, i2 = -1 / 0;
38
38
  for (const o of e14) t2 = Math.min(t2, o.origin.x), a3 = Math.min(a3, o.origin.y), s9 = Math.max(s9, o.origin.x + o.size.width), i2 = Math.max(i2, o.origin.y + o.size.height);
39
39
  return { origin: { x: t2, y: a3 }, size: { width: s9 - t2, height: i2 - a3 } };
40
40
  }
41
- function Se(e14, t2, a3, s9, i2) {
41
+ function xe(e14, t2, a3, s9, i2) {
42
42
  const o = a3.forDocument(e14), r2 = s9.forDocument(e14);
43
43
  if (!o || !r2) return false;
44
44
  const n2 = "highlight" === t2 ? "highlight" : "underline" === t2 ? "underline" : "squiggly" === t2 ? "squiggly" : "strikeout", l = a3.getTool(n2);
45
45
  if (!l) return false;
46
46
  const h2 = l.defaults, d2 = (function(e15, t3) {
47
- return { ...ye[e15], ...null == t3 ? void 0 : t3[e15] };
47
+ return { ...Ce[e15], ...null == t3 ? void 0 : t3[e15] };
48
48
  })(t2, i2), c = r2.getFormattedSelection();
49
49
  if (0 === c.length) return false;
50
50
  o.setLocked({ type: LockModeType.Exclude, categories: ["markup", "shape"] });
51
51
  for (const u of c) {
52
- const e15 = uuidV4(), a4 = d2.color ?? h2.color ?? h2.strokeColor, s10 = d2.opacity ?? h2.opacity, i3 = d2.thickness ?? h2.strokeWidth, r3 = d2.offsetY ?? 0, n3 = "underline" === t2 || "squiggly" === t2 || "strikeout" === t2 ? Ie(u.segmentRects, r3) : u.segmentRects, l2 = "underline" === t2 || "squiggly" === t2 || "strikeout" === t2 ? Me(n3) : u.rect;
53
- o.createAnnotation(u.pageIndex, { id: e15, created: /* @__PURE__ */ new Date(), flags: ["print"], type: Ce[t2], ..."highlight" === t2 ? { blendMode: PdfBlendMode.Multiply } : {}, strokeColor: a4, opacity: s10, ...null != i3 ? { strokeWidth: i3 } : {}, pageIndex: u.pageIndex, rect: l2, segmentRects: n3 });
52
+ const e15 = uuidV4(), a4 = d2.color ?? h2.color ?? h2.strokeColor, s10 = d2.opacity ?? h2.opacity, i3 = d2.thickness ?? h2.strokeWidth, r3 = d2.offsetY ?? 0, n3 = "underline" === t2 || "squiggly" === t2 || "strikeout" === t2 ? Me(u.segmentRects, r3) : u.segmentRects, l2 = "underline" === t2 || "squiggly" === t2 || "strikeout" === t2 ? Se(n3) : u.rect;
53
+ o.createAnnotation(u.pageIndex, { id: e15, created: /* @__PURE__ */ new Date(), flags: ["print"], type: Ie[t2], ..."highlight" === t2 ? { blendMode: PdfBlendMode.Multiply } : {}, strokeColor: a4, opacity: s10, ...null != i3 ? { strokeWidth: i3 } : {}, pageIndex: u.pageIndex, rect: l2, segmentRects: n3 });
54
54
  }
55
55
  return r2.clear(), true;
56
56
  }
57
- const xe = /* @__PURE__ */ new Set([PdfAnnotationSubtype.HIGHLIGHT, PdfAnnotationSubtype.UNDERLINE, PdfAnnotationSubtype.SQUIGGLY, PdfAnnotationSubtype.STRIKEOUT]);
58
- function ke(e14, t2) {
57
+ const ke = /* @__PURE__ */ new Set([PdfAnnotationSubtype.HIGHLIGHT, PdfAnnotationSubtype.UNDERLINE, PdfAnnotationSubtype.SQUIGGLY, PdfAnnotationSubtype.STRIKEOUT]);
58
+ function Le(e14, t2) {
59
59
  const a3 = e14;
60
60
  return false === e14 ? { ...t2, enabled: false } : true === e14 || void 0 === e14 ? { ...t2, enabled: t2.enabled ?? true } : { ...t2, ...a3, enabled: false !== (null == a3 ? void 0 : a3.enabled) };
61
61
  }
62
- function Le(e14) {
63
- const t2 = ke(null == e14 ? void 0 : e14.markup, { enabled: true }), a3 = ke(null == e14 ? void 0 : e14.bookmarks, { enabled: true }), s9 = ke(null == e14 ? void 0 : e14.notes, { enabled: true });
64
- return { markup: t2, bookmarks: a3, notes: s9, zoom: ke(null == e14 ? void 0 : e14.zoom, { enabled: true, min: 0.5, max: 3, initial: 1 }), selectionToolbar: ke(void 0 === (null == e14 ? void 0 : e14.selectionToolbar) ? false !== t2.enabled || false !== s9.enabled : e14.selectionToolbar, { enabled: true }) };
62
+ function $e(e14) {
63
+ var t2;
64
+ const a3 = Le(null == e14 ? void 0 : e14.markup, { enabled: true }), s9 = Le(null == e14 ? void 0 : e14.bookmarks, { enabled: true }), i2 = Le(null == e14 ? void 0 : e14.notes, { enabled: true }), o = Le(null == e14 ? void 0 : e14.zoom, { enabled: true, min: 0.5, max: 3, initial: 1 }), r2 = Le(void 0 === (null == e14 ? void 0 : e14.selectionToolbar) ? false !== a3.enabled || false !== i2.enabled : e14.selectionToolbar, { enabled: true });
65
+ return { markup: a3, bookmarks: s9, notes: i2, zoom: o, scrollViewport: { background: (null == (t2 = null == e14 ? void 0 : e14.scrollViewport) ? void 0 : t2.background) ?? ye }, selectionToolbar: r2 };
65
66
  }
66
67
  class ze {
67
68
  constructor(e14) {
@@ -71,9 +72,9 @@ class ze {
71
72
  return this.cb(e14, t2);
72
73
  }
73
74
  }
74
- const Ae = "chapter-manager", Ve = { id: Ae, name: "Chapter Manager Plugin", version: "0.1.0", provides: ["chapter-manager"], requires: ["document-manager"], optional: [], defaultConfig: { manifest: { chapters: [] }, prefetchChapters: 1, unloadTimeoutMs: 6e4, autoActivateOnLoad: true } };
75
- const Ee = { kind: "first-wins" };
76
- function _e(e14, t2, a3) {
75
+ const Ve = "chapter-manager", Ee = { id: Ve, name: "Chapter Manager Plugin", version: "0.1.0", provides: ["chapter-manager"], requires: ["document-manager"], optional: [], defaultConfig: { manifest: { chapters: [] }, prefetchChapters: 1, unloadTimeoutMs: 6e4, autoActivateOnLoad: true } };
76
+ const _e = { kind: "first-wins" };
77
+ function Re(e14, t2, a3) {
77
78
  if (1 === t2.length) return t2[0].chapterId;
78
79
  switch (a3.kind) {
79
80
  case "first-wins":
@@ -91,7 +92,7 @@ function _e(e14, t2, a3) {
91
92
  return a3.resolve(e14, t2);
92
93
  }
93
94
  }
94
- let Re = class {
95
+ let Fe = class {
95
96
  constructor(e14) {
96
97
  this._pages = e14, this._byChapter = /* @__PURE__ */ new Map(), this._byGlobalNumber = /* @__PURE__ */ new Map();
97
98
  for (const t2 of e14) {
@@ -125,8 +126,8 @@ let Re = class {
125
126
  return a3 ? this._pages.indexOf(a3) : -1;
126
127
  }
127
128
  };
128
- function Fe(e14, t2 = Ee) {
129
- const a3 = (function(e15, t3 = Ee) {
129
+ function Ue(e14, t2 = _e) {
130
+ const a3 = (function(e15, t3 = _e) {
130
131
  const a4 = /* @__PURE__ */ new Map();
131
132
  for (const i3 of e15.chapters) {
132
133
  const [e16, t4] = i3.globalPageRange;
@@ -136,7 +137,7 @@ function Fe(e14, t2 = Ee) {
136
137
  }
137
138
  }
138
139
  const s10 = /* @__PURE__ */ new Map();
139
- for (const [i3, o2] of a4) s10.set(i3, _e(i3, o2, t3));
140
+ for (const [i3, o2] of a4) s10.set(i3, Re(i3, o2, t3));
140
141
  return s10;
141
142
  })(e14, t2), s9 = /* @__PURE__ */ new Map();
142
143
  for (const n2 of e14.chapters) s9.set(n2.chapterId, n2);
@@ -148,14 +149,14 @@ function Fe(e14, t2 = Ee) {
148
149
  const [i3] = t3.globalPageRange, [l] = t3.localPageRange, h2 = l + (n2 - i3);
149
150
  o.push({ globalPageIndex: r2++, globalPageNumber: n2, chapterId: e15, localPageIndex: h2 });
150
151
  }
151
- return new Re(o);
152
+ return new Fe(o);
152
153
  }
153
- const Ue = class e extends BasePlugin {
154
+ const qe = class e extends BasePlugin {
154
155
  constructor(e14, t2) {
155
- super(e14, t2), this.statusChange$ = createBehaviorEmitter(), this.manifestChange$ = createEmitter(), this.overlapStrategy = Ee, this.chapterStatus = /* @__PURE__ */ new Map(), this.chapterLastUsed = /* @__PURE__ */ new Map(), this.passwordAttempts = /* @__PURE__ */ new Map(), this.pendingLoadPromises = /* @__PURE__ */ new Map(), this.unloadTimer = null, this.documentManagerUnsubs = [], this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
156
+ super(e14, t2), this.statusChange$ = createBehaviorEmitter(), this.manifestChange$ = createEmitter(), this.overlapStrategy = _e, this.chapterStatus = /* @__PURE__ */ new Map(), this.chapterLastUsed = /* @__PURE__ */ new Map(), this.passwordAttempts = /* @__PURE__ */ new Map(), this.pendingLoadPromises = /* @__PURE__ */ new Map(), this.unloadTimer = null, this.documentManagerUnsubs = [], this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
156
157
  }
157
158
  async initialize(e14) {
158
- if (this.config = e14, this.passwordProvider = e14.passwordProvider, this.overlapStrategy = e14.overlapStrategy ?? Ee, this.documentManagerUnsubs.push(this.documentManager.provides().onDocumentOpened((e15) => {
159
+ if (this.config = e14, this.passwordProvider = e14.passwordProvider, this.overlapStrategy = e14.overlapStrategy ?? _e, this.documentManagerUnsubs.push(this.documentManager.provides().onDocumentOpened((e15) => {
159
160
  this.isOwnedChapter(e15.id) && (this.passwordAttempts.delete(e15.id), this.updateStatus(e15.id, "loaded"));
160
161
  }), this.documentManager.provides().onDocumentClosed((e15) => {
161
162
  this.isOwnedChapter(e15) && this.updateStatus(e15, "closed");
@@ -190,7 +191,7 @@ const Ue = class e extends BasePlugin {
190
191
  const s9 = new Set(this.chapterStatus.keys()), i2 = new Set(t2.chapters.map((e14) => e14.chapterId));
191
192
  for (const e14 of s9) i2.has(e14) || (this.closeChapter(e14), this.chapterStatus.delete(e14));
192
193
  for (const e14 of t2.chapters) this.chapterStatus.has(e14.chapterId) || this.chapterStatus.set(e14.chapterId, "idle");
193
- this.manifest = t2, this.virtualPageMap = Fe(t2, this.overlapStrategy), this.manifestChange$.emit({ manifest: t2, map: this.virtualPageMap }), this.eagerPrefetchFromManifest();
194
+ this.manifest = t2, this.virtualPageMap = Ue(t2, this.overlapStrategy), this.manifestChange$.emit({ manifest: t2, map: this.virtualPageMap }), this.eagerPrefetchFromManifest();
194
195
  }
195
196
  eagerPrefetchFromManifest() {
196
197
  const e14 = this.config.prefetchChapters ?? 0;
@@ -328,11 +329,11 @@ const Ue = class e extends BasePlugin {
328
329
  this.chapterStatus.get(e14) !== t2 && (this.chapterStatus.set(e14, t2), this.statusChange$.emit({ chapterId: e14, status: t2, ..."error" === t2 && a3 ? { error: { message: a3 } } : {} }));
329
330
  }
330
331
  };
331
- Ue.id = "chapter-manager";
332
- let qe = Ue;
333
- const We = { manifest: Ve, create: (e14) => new qe(Ae, e14), reducer: (e14) => e14, initialState: {} }, He = "chapter-scroll", Be = { id: He, name: "Chapter Scroll Plugin", version: "0.1.0", provides: ["chapter-scroll"], requires: ["chapter-manager"], optional: [], defaultConfig: { placeholderPageHeight: 1200, placeholderPageWidth: 900, bufferSize: 2, pageGap: 20 } };
334
- const je = { kind: "first-wins" };
335
- function Ze(e14, t2, a3) {
332
+ qe.id = "chapter-manager";
333
+ let We = qe;
334
+ const He = { manifest: Ee, create: (e14) => new We(Ve, e14), reducer: (e14) => e14, initialState: {} }, Be = "chapter-scroll", je = { id: Be, name: "Chapter Scroll Plugin", version: "0.1.0", provides: ["chapter-scroll"], requires: ["chapter-manager"], optional: [], defaultConfig: { placeholderPageHeight: 1200, placeholderPageWidth: 900, bufferSize: 2, pageGap: 20 } };
335
+ const Ze = { kind: "first-wins" };
336
+ function Ye(e14, t2, a3) {
336
337
  if (1 === t2.length) return t2[0].chapterId;
337
338
  switch (a3.kind) {
338
339
  case "first-wins":
@@ -350,7 +351,7 @@ function Ze(e14, t2, a3) {
350
351
  return a3.resolve(e14, t2);
351
352
  }
352
353
  }
353
- let Ye = class {
354
+ let Xe = class {
354
355
  constructor(e14) {
355
356
  this._pages = e14, this._byChapter = /* @__PURE__ */ new Map(), this._byGlobalNumber = /* @__PURE__ */ new Map();
356
357
  for (const t2 of e14) {
@@ -384,8 +385,8 @@ let Ye = class {
384
385
  return a3 ? this._pages.indexOf(a3) : -1;
385
386
  }
386
387
  };
387
- function Ke(e14, t2 = je) {
388
- const a3 = (function(e15, t3 = je) {
388
+ function Ke(e14, t2 = Ze) {
389
+ const a3 = (function(e15, t3 = Ze) {
389
390
  const a4 = /* @__PURE__ */ new Map();
390
391
  for (const i3 of e15.chapters) {
391
392
  const [e16, t4] = i3.globalPageRange;
@@ -395,7 +396,7 @@ function Ke(e14, t2 = je) {
395
396
  }
396
397
  }
397
398
  const s10 = /* @__PURE__ */ new Map();
398
- for (const [i3, o2] of a4) s10.set(i3, Ze(i3, o2, t3));
399
+ for (const [i3, o2] of a4) s10.set(i3, Ye(i3, o2, t3));
399
400
  return s10;
400
401
  })(e14, t2), s9 = /* @__PURE__ */ new Map();
401
402
  for (const n2 of e14.chapters) s9.set(n2.chapterId, n2);
@@ -407,14 +408,14 @@ function Ke(e14, t2 = je) {
407
408
  const [i3] = t3.globalPageRange, [l] = t3.localPageRange, h2 = l + (n2 - i3);
408
409
  o.push({ globalPageIndex: r2++, globalPageNumber: n2, chapterId: e15, localPageIndex: h2 });
409
410
  }
410
- return new Ye(o);
411
+ return new Xe(o);
411
412
  }
412
- const Xe = class e2 extends BasePlugin {
413
+ const Qe = class e2 extends BasePlugin {
413
414
  constructor(e14, t2) {
414
- super(e14, t2), this.statusChange$ = createBehaviorEmitter(), this.manifestChange$ = createEmitter(), this.overlapStrategy = je, this.chapterStatus = /* @__PURE__ */ new Map(), this.chapterLastUsed = /* @__PURE__ */ new Map(), this.passwordAttempts = /* @__PURE__ */ new Map(), this.pendingLoadPromises = /* @__PURE__ */ new Map(), this.unloadTimer = null, this.documentManagerUnsubs = [], this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
415
+ super(e14, t2), this.statusChange$ = createBehaviorEmitter(), this.manifestChange$ = createEmitter(), this.overlapStrategy = Ze, this.chapterStatus = /* @__PURE__ */ new Map(), this.chapterLastUsed = /* @__PURE__ */ new Map(), this.passwordAttempts = /* @__PURE__ */ new Map(), this.pendingLoadPromises = /* @__PURE__ */ new Map(), this.unloadTimer = null, this.documentManagerUnsubs = [], this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
415
416
  }
416
417
  async initialize(e14) {
417
- if (this.config = e14, this.passwordProvider = e14.passwordProvider, this.overlapStrategy = e14.overlapStrategy ?? je, this.documentManagerUnsubs.push(this.documentManager.provides().onDocumentOpened((e15) => {
418
+ if (this.config = e14, this.passwordProvider = e14.passwordProvider, this.overlapStrategy = e14.overlapStrategy ?? Ze, this.documentManagerUnsubs.push(this.documentManager.provides().onDocumentOpened((e15) => {
418
419
  this.isOwnedChapter(e15.id) && (this.passwordAttempts.delete(e15.id), this.updateStatus(e15.id, "loaded"));
419
420
  }), this.documentManager.provides().onDocumentClosed((e15) => {
420
421
  this.isOwnedChapter(e15) && this.updateStatus(e15, "closed");
@@ -587,9 +588,9 @@ const Xe = class e2 extends BasePlugin {
587
588
  this.chapterStatus.get(e14) !== t2 && (this.chapterStatus.set(e14, t2), this.statusChange$.emit({ chapterId: e14, status: t2, ..."error" === t2 && a3 ? { error: { message: a3 } } : {} }));
588
589
  }
589
590
  };
590
- Xe.id = "chapter-manager";
591
- let Qe = Xe;
592
- function Je(e14, t2) {
591
+ Qe.id = "chapter-manager";
592
+ let Je = Qe;
593
+ function et$1(e14, t2) {
593
594
  if (e14 === t2) return true;
594
595
  if (e14.totalHeight !== t2.totalHeight || e14.totalWidth !== t2.totalWidth || e14.pageGap !== t2.pageGap || e14.items.length !== t2.items.length) return false;
595
596
  for (let a3 = 0; a3 < e14.items.length; a3++) {
@@ -598,9 +599,9 @@ function Je(e14, t2) {
598
599
  }
599
600
  return true;
600
601
  }
601
- const et$1 = class et extends BasePlugin {
602
+ const tt$1 = class tt extends BasePlugin {
602
603
  constructor(e14, t2) {
603
- super(e14, t2), this.layoutChange$ = createBehaviorEmitter(void 0, Je), 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.chapterManagerUnsubs = [], this.chapterManager = this.registry.getPlugin(Qe.id), this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
604
+ super(e14, t2), this.layoutChange$ = createBehaviorEmitter(void 0, et$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.chapterManagerUnsubs = [], this.chapterManager = this.registry.getPlugin(Je.id), this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
604
605
  }
605
606
  async initialize(e14) {
606
607
  this.config = { placeholderPageHeight: e14.placeholderPageHeight ?? 1200, placeholderPageWidth: e14.placeholderPageWidth ?? 900, bufferSize: e14.bufferSize ?? 2, pageGap: e14.pageGap ?? 20 }, this.virtualPageMap = this.chapterManager.provides().getVirtualPageMap(), this.rebuildOffsets(), this.chapterManagerUnsubs.push(this.chapterManager.provides().onManifestChange(({ map: e15 }) => {
@@ -777,12 +778,12 @@ const et$1 = class et extends BasePlugin {
777
778
  a3 && this.scrollToIndex(a3.globalPageIndex, t2);
778
779
  }
779
780
  };
780
- et$1.id = "chapter-scroll";
781
- let tt$1 = et$1;
782
- const at$1 = { manifest: Be, create: (e14) => new tt$1(He, e14), reducer: (e14) => e14, initialState: {} }, st$1 = "note", it$1 = { id: st$1, name: "Note Plugin", version: "0.1.0", provides: ["note"], requires: ["selection", "chapter-scroll", "chapter-manager"], optional: [], defaultConfig: { callbacks: { onCreateNote: async () => null, onActivateNote: () => {
781
+ tt$1.id = "chapter-scroll";
782
+ let at$1 = tt$1;
783
+ const st$1 = { manifest: je, create: (e14) => new at$1(Be, e14), reducer: (e14) => e14, initialState: {} }, it$1 = "note", ot$1 = { id: it$1, name: "Note Plugin", version: "0.1.0", provides: ["note"], requires: ["selection", "chapter-scroll", "chapter-manager"], optional: [], defaultConfig: { callbacks: { onCreateNote: async () => null, onActivateNote: () => {
783
784
  } }, markerSize: 18 } };
784
- const ot$1 = { kind: "first-wins" };
785
- function rt$1(e14, t2, a3) {
785
+ const rt$1 = { kind: "first-wins" };
786
+ function nt$1(e14, t2, a3) {
786
787
  if (1 === t2.length) return t2[0].chapterId;
787
788
  switch (a3.kind) {
788
789
  case "first-wins":
@@ -800,7 +801,7 @@ function rt$1(e14, t2, a3) {
800
801
  return a3.resolve(e14, t2);
801
802
  }
802
803
  }
803
- let nt$1 = class nt {
804
+ let lt$1 = class lt {
804
805
  constructor(e14) {
805
806
  this._pages = e14, this._byChapter = /* @__PURE__ */ new Map(), this._byGlobalNumber = /* @__PURE__ */ new Map();
806
807
  for (const t2 of e14) {
@@ -834,8 +835,8 @@ let nt$1 = class nt {
834
835
  return a3 ? this._pages.indexOf(a3) : -1;
835
836
  }
836
837
  };
837
- function lt$1(e14, t2 = ot$1) {
838
- const a3 = (function(e15, t3 = ot$1) {
838
+ function ht$1(e14, t2 = rt$1) {
839
+ const a3 = (function(e15, t3 = rt$1) {
839
840
  const a4 = /* @__PURE__ */ new Map();
840
841
  for (const i3 of e15.chapters) {
841
842
  const [e16, t4] = i3.globalPageRange;
@@ -845,7 +846,7 @@ function lt$1(e14, t2 = ot$1) {
845
846
  }
846
847
  }
847
848
  const s10 = /* @__PURE__ */ new Map();
848
- for (const [i3, o2] of a4) s10.set(i3, rt$1(i3, o2, t3));
849
+ for (const [i3, o2] of a4) s10.set(i3, nt$1(i3, o2, t3));
849
850
  return s10;
850
851
  })(e14, t2), s9 = /* @__PURE__ */ new Map();
851
852
  for (const n2 of e14.chapters) s9.set(n2.chapterId, n2);
@@ -857,14 +858,14 @@ function lt$1(e14, t2 = ot$1) {
857
858
  const [i3] = t3.globalPageRange, [l] = t3.localPageRange, h2 = l + (n2 - i3);
858
859
  o.push({ globalPageIndex: r2++, globalPageNumber: n2, chapterId: e15, localPageIndex: h2 });
859
860
  }
860
- return new nt$1(o);
861
+ return new lt$1(o);
861
862
  }
862
- const ht$1 = class e3 extends BasePlugin {
863
+ const dt$1 = class e3 extends BasePlugin {
863
864
  constructor(e14, t2) {
864
- super(e14, t2), this.statusChange$ = createBehaviorEmitter(), this.manifestChange$ = createEmitter(), this.overlapStrategy = ot$1, this.chapterStatus = /* @__PURE__ */ new Map(), this.chapterLastUsed = /* @__PURE__ */ new Map(), this.passwordAttempts = /* @__PURE__ */ new Map(), this.pendingLoadPromises = /* @__PURE__ */ new Map(), this.unloadTimer = null, this.documentManagerUnsubs = [], this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
865
+ super(e14, t2), this.statusChange$ = createBehaviorEmitter(), this.manifestChange$ = createEmitter(), this.overlapStrategy = rt$1, this.chapterStatus = /* @__PURE__ */ new Map(), this.chapterLastUsed = /* @__PURE__ */ new Map(), this.passwordAttempts = /* @__PURE__ */ new Map(), this.pendingLoadPromises = /* @__PURE__ */ new Map(), this.unloadTimer = null, this.documentManagerUnsubs = [], this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
865
866
  }
866
867
  async initialize(e14) {
867
- if (this.config = e14, this.passwordProvider = e14.passwordProvider, this.overlapStrategy = e14.overlapStrategy ?? ot$1, this.documentManagerUnsubs.push(this.documentManager.provides().onDocumentOpened((e15) => {
868
+ if (this.config = e14, this.passwordProvider = e14.passwordProvider, this.overlapStrategy = e14.overlapStrategy ?? rt$1, this.documentManagerUnsubs.push(this.documentManager.provides().onDocumentOpened((e15) => {
868
869
  this.isOwnedChapter(e15.id) && (this.passwordAttempts.delete(e15.id), this.updateStatus(e15.id, "loaded"));
869
870
  }), this.documentManager.provides().onDocumentClosed((e15) => {
870
871
  this.isOwnedChapter(e15) && this.updateStatus(e15, "closed");
@@ -899,7 +900,7 @@ const ht$1 = class e3 extends BasePlugin {
899
900
  const s9 = new Set(this.chapterStatus.keys()), i2 = new Set(t2.chapters.map((e14) => e14.chapterId));
900
901
  for (const e14 of s9) i2.has(e14) || (this.closeChapter(e14), this.chapterStatus.delete(e14));
901
902
  for (const e14 of t2.chapters) this.chapterStatus.has(e14.chapterId) || this.chapterStatus.set(e14.chapterId, "idle");
902
- this.manifest = t2, this.virtualPageMap = lt$1(t2, this.overlapStrategy), this.manifestChange$.emit({ manifest: t2, map: this.virtualPageMap }), this.eagerPrefetchFromManifest();
903
+ this.manifest = t2, this.virtualPageMap = ht$1(t2, this.overlapStrategy), this.manifestChange$.emit({ manifest: t2, map: this.virtualPageMap }), this.eagerPrefetchFromManifest();
903
904
  }
904
905
  eagerPrefetchFromManifest() {
905
906
  const e14 = this.config.prefetchChapters ?? 0;
@@ -1037,10 +1038,10 @@ const ht$1 = class e3 extends BasePlugin {
1037
1038
  this.chapterStatus.get(e14) !== t2 && (this.chapterStatus.set(e14, t2), this.statusChange$.emit({ chapterId: e14, status: t2, ..."error" === t2 && a3 ? { error: { message: a3 } } : {} }));
1038
1039
  }
1039
1040
  };
1040
- ht$1.id = "chapter-manager";
1041
- let dt$1 = ht$1;
1042
- const ct$1 = { kind: "first-wins" };
1043
- function ut(e14, t2, a3) {
1041
+ dt$1.id = "chapter-manager";
1042
+ let ct$1 = dt$1;
1043
+ const ut = { kind: "first-wins" };
1044
+ function pt(e14, t2, a3) {
1044
1045
  if (1 === t2.length) return t2[0].chapterId;
1045
1046
  switch (a3.kind) {
1046
1047
  case "first-wins":
@@ -1058,7 +1059,7 @@ function ut(e14, t2, a3) {
1058
1059
  return a3.resolve(e14, t2);
1059
1060
  }
1060
1061
  }
1061
- let pt = class {
1062
+ let gt = class {
1062
1063
  constructor(e14) {
1063
1064
  this._pages = e14, this._byChapter = /* @__PURE__ */ new Map(), this._byGlobalNumber = /* @__PURE__ */ new Map();
1064
1065
  for (const t2 of e14) {
@@ -1092,8 +1093,8 @@ let pt = class {
1092
1093
  return a3 ? this._pages.indexOf(a3) : -1;
1093
1094
  }
1094
1095
  };
1095
- function gt(e14, t2 = ct$1) {
1096
- const a3 = (function(e15, t3 = ct$1) {
1096
+ function ft$1(e14, t2 = ut) {
1097
+ const a3 = (function(e15, t3 = ut) {
1097
1098
  const a4 = /* @__PURE__ */ new Map();
1098
1099
  for (const i3 of e15.chapters) {
1099
1100
  const [e16, t4] = i3.globalPageRange;
@@ -1103,7 +1104,7 @@ function gt(e14, t2 = ct$1) {
1103
1104
  }
1104
1105
  }
1105
1106
  const s10 = /* @__PURE__ */ new Map();
1106
- for (const [i3, o2] of a4) s10.set(i3, ut(i3, o2, t3));
1107
+ for (const [i3, o2] of a4) s10.set(i3, pt(i3, o2, t3));
1107
1108
  return s10;
1108
1109
  })(e14, t2), s9 = /* @__PURE__ */ new Map();
1109
1110
  for (const n2 of e14.chapters) s9.set(n2.chapterId, n2);
@@ -1115,14 +1116,14 @@ function gt(e14, t2 = ct$1) {
1115
1116
  const [i3] = t3.globalPageRange, [l] = t3.localPageRange, h2 = l + (n2 - i3);
1116
1117
  o.push({ globalPageIndex: r2++, globalPageNumber: n2, chapterId: e15, localPageIndex: h2 });
1117
1118
  }
1118
- return new pt(o);
1119
+ return new gt(o);
1119
1120
  }
1120
- const ft$1 = class e4 extends BasePlugin {
1121
+ const mt$1 = class e4 extends BasePlugin {
1121
1122
  constructor(e14, t2) {
1122
- super(e14, t2), this.statusChange$ = createBehaviorEmitter(), this.manifestChange$ = createEmitter(), this.overlapStrategy = ct$1, this.chapterStatus = /* @__PURE__ */ new Map(), this.chapterLastUsed = /* @__PURE__ */ new Map(), this.passwordAttempts = /* @__PURE__ */ new Map(), this.pendingLoadPromises = /* @__PURE__ */ new Map(), this.unloadTimer = null, this.documentManagerUnsubs = [], this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
1123
+ super(e14, t2), this.statusChange$ = createBehaviorEmitter(), this.manifestChange$ = createEmitter(), this.overlapStrategy = ut, this.chapterStatus = /* @__PURE__ */ new Map(), this.chapterLastUsed = /* @__PURE__ */ new Map(), this.passwordAttempts = /* @__PURE__ */ new Map(), this.pendingLoadPromises = /* @__PURE__ */ new Map(), this.unloadTimer = null, this.documentManagerUnsubs = [], this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
1123
1124
  }
1124
1125
  async initialize(e14) {
1125
- if (this.config = e14, this.passwordProvider = e14.passwordProvider, this.overlapStrategy = e14.overlapStrategy ?? ct$1, this.documentManagerUnsubs.push(this.documentManager.provides().onDocumentOpened((e15) => {
1126
+ if (this.config = e14, this.passwordProvider = e14.passwordProvider, this.overlapStrategy = e14.overlapStrategy ?? ut, this.documentManagerUnsubs.push(this.documentManager.provides().onDocumentOpened((e15) => {
1126
1127
  this.isOwnedChapter(e15.id) && (this.passwordAttempts.delete(e15.id), this.updateStatus(e15.id, "loaded"));
1127
1128
  }), this.documentManager.provides().onDocumentClosed((e15) => {
1128
1129
  this.isOwnedChapter(e15) && this.updateStatus(e15, "closed");
@@ -1157,7 +1158,7 @@ const ft$1 = class e4 extends BasePlugin {
1157
1158
  const s9 = new Set(this.chapterStatus.keys()), i2 = new Set(t2.chapters.map((e14) => e14.chapterId));
1158
1159
  for (const e14 of s9) i2.has(e14) || (this.closeChapter(e14), this.chapterStatus.delete(e14));
1159
1160
  for (const e14 of t2.chapters) this.chapterStatus.has(e14.chapterId) || this.chapterStatus.set(e14.chapterId, "idle");
1160
- this.manifest = t2, this.virtualPageMap = gt(t2, this.overlapStrategy), this.manifestChange$.emit({ manifest: t2, map: this.virtualPageMap }), this.eagerPrefetchFromManifest();
1161
+ this.manifest = t2, this.virtualPageMap = ft$1(t2, this.overlapStrategy), this.manifestChange$.emit({ manifest: t2, map: this.virtualPageMap }), this.eagerPrefetchFromManifest();
1161
1162
  }
1162
1163
  eagerPrefetchFromManifest() {
1163
1164
  const e14 = this.config.prefetchChapters ?? 0;
@@ -1295,9 +1296,9 @@ const ft$1 = class e4 extends BasePlugin {
1295
1296
  this.chapterStatus.get(e14) !== t2 && (this.chapterStatus.set(e14, t2), this.statusChange$.emit({ chapterId: e14, status: t2, ..."error" === t2 && a3 ? { error: { message: a3 } } : {} }));
1296
1297
  }
1297
1298
  };
1298
- ft$1.id = "chapter-manager";
1299
- let mt$1 = ft$1;
1300
- function vt$1(e14, t2) {
1299
+ mt$1.id = "chapter-manager";
1300
+ let vt$1 = mt$1;
1301
+ function bt$1(e14, t2) {
1301
1302
  if (e14 === t2) return true;
1302
1303
  if (e14.totalHeight !== t2.totalHeight || e14.totalWidth !== t2.totalWidth || e14.pageGap !== t2.pageGap || e14.items.length !== t2.items.length) return false;
1303
1304
  for (let a3 = 0; a3 < e14.items.length; a3++) {
@@ -1306,9 +1307,9 @@ function vt$1(e14, t2) {
1306
1307
  }
1307
1308
  return true;
1308
1309
  }
1309
- const bt$1 = class bt extends BasePlugin {
1310
+ const Pt$1 = class Pt extends BasePlugin {
1310
1311
  constructor(e14, t2) {
1311
- super(e14, t2), this.layoutChange$ = createBehaviorEmitter(void 0, vt$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.chapterManagerUnsubs = [], this.chapterManager = this.registry.getPlugin(mt$1.id), this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
1312
+ super(e14, t2), this.layoutChange$ = createBehaviorEmitter(void 0, bt$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.chapterManagerUnsubs = [], this.chapterManager = this.registry.getPlugin(vt$1.id), this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
1312
1313
  }
1313
1314
  async initialize(e14) {
1314
1315
  this.config = { placeholderPageHeight: e14.placeholderPageHeight ?? 1200, placeholderPageWidth: e14.placeholderPageWidth ?? 900, bufferSize: e14.bufferSize ?? 2, pageGap: e14.pageGap ?? 20 }, this.virtualPageMap = this.chapterManager.provides().getVirtualPageMap(), this.rebuildOffsets(), this.chapterManagerUnsubs.push(this.chapterManager.provides().onManifestChange(({ map: e15 }) => {
@@ -1485,11 +1486,11 @@ const bt$1 = class bt extends BasePlugin {
1485
1486
  a3 && this.scrollToIndex(a3.globalPageIndex, t2);
1486
1487
  }
1487
1488
  };
1488
- bt$1.id = "chapter-scroll";
1489
- let Pt$1 = bt$1;
1490
- const wt$1 = class e5 extends BasePlugin {
1489
+ Pt$1.id = "chapter-scroll";
1490
+ let wt$1 = Pt$1;
1491
+ const yt$1 = class e5 extends BasePlugin {
1491
1492
  constructor(e14, t2) {
1492
- super(e14, t2), this.notesChange$ = createBehaviorEmitter([]), this.noteActivated$ = createEmitter(), this.notes = /* @__PURE__ */ new Map(), this.chapterScroll = this.registry.getPlugin(Pt$1.id), this.chapterManager = this.registry.getPlugin(dt$1.id), this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
1493
+ super(e14, t2), this.notesChange$ = createBehaviorEmitter([]), this.noteActivated$ = createEmitter(), this.notes = /* @__PURE__ */ new Map(), this.chapterScroll = this.registry.getPlugin(wt$1.id), this.chapterManager = this.registry.getPlugin(ct$1.id), this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
1493
1494
  }
1494
1495
  async initialize(t2) {
1495
1496
  if (this.config = t2, t2.callbacks.loadNotes) try {
@@ -1527,7 +1528,7 @@ const wt$1 = class e5 extends BasePlugin {
1527
1528
  this.notesChange$.emit(this.listAll());
1528
1529
  }
1529
1530
  buildDraft(e14) {
1530
- return { chapterId: e14.chapterId, localPageIndex: e14.localPageIndex, globalPageNumber: e14.globalPageNumber, globalPageIndex: e14.globalPageIndex, rectsPdfCoord: e14.rectsPdfCoord, endAnchor: Ct$1(e14.rectsPdfCoord), selectedText: e14.selectedText, content: e14.content };
1531
+ return { chapterId: e14.chapterId, localPageIndex: e14.localPageIndex, globalPageNumber: e14.globalPageNumber, globalPageIndex: e14.globalPageIndex, rectsPdfCoord: e14.rectsPdfCoord, endAnchor: It$1(e14.rectsPdfCoord), selectedText: e14.selectedText, content: e14.content };
1531
1532
  }
1532
1533
  async requestCreateFromSelection(e14) {
1533
1534
  if (0 === e14.rectsPdfCoord.length) return null;
@@ -1594,15 +1595,15 @@ const wt$1 = class e5 extends BasePlugin {
1594
1595
  });
1595
1596
  }
1596
1597
  };
1597
- wt$1.id = "note";
1598
- let yt$1 = wt$1;
1599
- function Ct$1(e14) {
1598
+ yt$1.id = "note";
1599
+ let Ct$1 = yt$1;
1600
+ function It$1(e14) {
1600
1601
  const t2 = e14[e14.length - 1];
1601
1602
  return { x: t2.origin.x + t2.size.width, y: t2.origin.y + t2.size.height };
1602
1603
  }
1603
- const It$1 = { manifest: it$1, create: (e14) => new yt$1(st$1, e14), reducer: (e14) => e14, initialState: {} }, Mt$1 = "paragraph-bookmark", St$1 = { id: Mt$1, name: "Paragraph Bookmark Plugin", version: "0.1.0", provides: ["paragraph-bookmark"], requires: ["chapter-scroll", "chapter-manager"], optional: [], defaultConfig: {} };
1604
- const xt$1 = { kind: "first-wins" };
1605
- function kt$1(e14, t2, a3) {
1604
+ const Mt$1 = { manifest: ot$1, create: (e14) => new Ct$1(it$1, e14), reducer: (e14) => e14, initialState: {} }, St$1 = "paragraph-bookmark", xt$1 = { id: St$1, name: "Paragraph Bookmark Plugin", version: "0.1.0", provides: ["paragraph-bookmark"], requires: ["chapter-scroll", "chapter-manager"], optional: [], defaultConfig: {} };
1605
+ const kt$1 = { kind: "first-wins" };
1606
+ function Lt$1(e14, t2, a3) {
1606
1607
  if (1 === t2.length) return t2[0].chapterId;
1607
1608
  switch (a3.kind) {
1608
1609
  case "first-wins":
@@ -1620,7 +1621,7 @@ function kt$1(e14, t2, a3) {
1620
1621
  return a3.resolve(e14, t2);
1621
1622
  }
1622
1623
  }
1623
- let Lt$1 = class Lt {
1624
+ let $t$1 = class $t {
1624
1625
  constructor(e14) {
1625
1626
  this._pages = e14, this._byChapter = /* @__PURE__ */ new Map(), this._byGlobalNumber = /* @__PURE__ */ new Map();
1626
1627
  for (const t2 of e14) {
@@ -1654,8 +1655,8 @@ let Lt$1 = class Lt {
1654
1655
  return a3 ? this._pages.indexOf(a3) : -1;
1655
1656
  }
1656
1657
  };
1657
- function $t$1(e14, t2 = xt$1) {
1658
- const a3 = (function(e15, t3 = xt$1) {
1658
+ function Tt$1(e14, t2 = kt$1) {
1659
+ const a3 = (function(e15, t3 = kt$1) {
1659
1660
  const a4 = /* @__PURE__ */ new Map();
1660
1661
  for (const i3 of e15.chapters) {
1661
1662
  const [e16, t4] = i3.globalPageRange;
@@ -1665,7 +1666,7 @@ function $t$1(e14, t2 = xt$1) {
1665
1666
  }
1666
1667
  }
1667
1668
  const s10 = /* @__PURE__ */ new Map();
1668
- for (const [i3, o2] of a4) s10.set(i3, kt$1(i3, o2, t3));
1669
+ for (const [i3, o2] of a4) s10.set(i3, Lt$1(i3, o2, t3));
1669
1670
  return s10;
1670
1671
  })(e14, t2), s9 = /* @__PURE__ */ new Map();
1671
1672
  for (const n2 of e14.chapters) s9.set(n2.chapterId, n2);
@@ -1677,14 +1678,14 @@ function $t$1(e14, t2 = xt$1) {
1677
1678
  const [i3] = t3.globalPageRange, [l] = t3.localPageRange, h2 = l + (n2 - i3);
1678
1679
  o.push({ globalPageIndex: r2++, globalPageNumber: n2, chapterId: e15, localPageIndex: h2 });
1679
1680
  }
1680
- return new Lt$1(o);
1681
+ return new $t$1(o);
1681
1682
  }
1682
1683
  const zt$1 = class e6 extends BasePlugin {
1683
1684
  constructor(e14, t2) {
1684
- super(e14, t2), this.statusChange$ = createBehaviorEmitter(), this.manifestChange$ = createEmitter(), this.overlapStrategy = xt$1, this.chapterStatus = /* @__PURE__ */ new Map(), this.chapterLastUsed = /* @__PURE__ */ new Map(), this.passwordAttempts = /* @__PURE__ */ new Map(), this.pendingLoadPromises = /* @__PURE__ */ new Map(), this.unloadTimer = null, this.documentManagerUnsubs = [], this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
1685
+ super(e14, t2), this.statusChange$ = createBehaviorEmitter(), this.manifestChange$ = createEmitter(), this.overlapStrategy = kt$1, this.chapterStatus = /* @__PURE__ */ new Map(), this.chapterLastUsed = /* @__PURE__ */ new Map(), this.passwordAttempts = /* @__PURE__ */ new Map(), this.pendingLoadPromises = /* @__PURE__ */ new Map(), this.unloadTimer = null, this.documentManagerUnsubs = [], this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
1685
1686
  }
1686
1687
  async initialize(e14) {
1687
- if (this.config = e14, this.passwordProvider = e14.passwordProvider, this.overlapStrategy = e14.overlapStrategy ?? xt$1, this.documentManagerUnsubs.push(this.documentManager.provides().onDocumentOpened((e15) => {
1688
+ if (this.config = e14, this.passwordProvider = e14.passwordProvider, this.overlapStrategy = e14.overlapStrategy ?? kt$1, this.documentManagerUnsubs.push(this.documentManager.provides().onDocumentOpened((e15) => {
1688
1689
  this.isOwnedChapter(e15.id) && (this.passwordAttempts.delete(e15.id), this.updateStatus(e15.id, "loaded"));
1689
1690
  }), this.documentManager.provides().onDocumentClosed((e15) => {
1690
1691
  this.isOwnedChapter(e15) && this.updateStatus(e15, "closed");
@@ -1719,7 +1720,7 @@ const zt$1 = class e6 extends BasePlugin {
1719
1720
  const s9 = new Set(this.chapterStatus.keys()), i2 = new Set(t2.chapters.map((e14) => e14.chapterId));
1720
1721
  for (const e14 of s9) i2.has(e14) || (this.closeChapter(e14), this.chapterStatus.delete(e14));
1721
1722
  for (const e14 of t2.chapters) this.chapterStatus.has(e14.chapterId) || this.chapterStatus.set(e14.chapterId, "idle");
1722
- this.manifest = t2, this.virtualPageMap = $t$1(t2, this.overlapStrategy), this.manifestChange$.emit({ manifest: t2, map: this.virtualPageMap }), this.eagerPrefetchFromManifest();
1723
+ this.manifest = t2, this.virtualPageMap = Tt$1(t2, this.overlapStrategy), this.manifestChange$.emit({ manifest: t2, map: this.virtualPageMap }), this.eagerPrefetchFromManifest();
1723
1724
  }
1724
1725
  eagerPrefetchFromManifest() {
1725
1726
  const e14 = this.config.prefetchChapters ?? 0;
@@ -1858,9 +1859,9 @@ const zt$1 = class e6 extends BasePlugin {
1858
1859
  }
1859
1860
  };
1860
1861
  zt$1.id = "chapter-manager";
1861
- let Tt$1 = zt$1;
1862
- const Dt$1 = { kind: "first-wins" };
1863
- function Ot$1(e14, t2, a3) {
1862
+ let Dt$1 = zt$1;
1863
+ const Ot$1 = { kind: "first-wins" };
1864
+ function Gt$1(e14, t2, a3) {
1864
1865
  if (1 === t2.length) return t2[0].chapterId;
1865
1866
  switch (a3.kind) {
1866
1867
  case "first-wins":
@@ -1878,7 +1879,7 @@ function Ot$1(e14, t2, a3) {
1878
1879
  return a3.resolve(e14, t2);
1879
1880
  }
1880
1881
  }
1881
- let Gt$1 = class Gt {
1882
+ let Nt = class {
1882
1883
  constructor(e14) {
1883
1884
  this._pages = e14, this._byChapter = /* @__PURE__ */ new Map(), this._byGlobalNumber = /* @__PURE__ */ new Map();
1884
1885
  for (const t2 of e14) {
@@ -1912,8 +1913,8 @@ let Gt$1 = class Gt {
1912
1913
  return a3 ? this._pages.indexOf(a3) : -1;
1913
1914
  }
1914
1915
  };
1915
- function Nt(e14, t2 = Dt$1) {
1916
- const a3 = (function(e15, t3 = Dt$1) {
1916
+ function At$1(e14, t2 = Ot$1) {
1917
+ const a3 = (function(e15, t3 = Ot$1) {
1917
1918
  const a4 = /* @__PURE__ */ new Map();
1918
1919
  for (const i3 of e15.chapters) {
1919
1920
  const [e16, t4] = i3.globalPageRange;
@@ -1923,7 +1924,7 @@ function Nt(e14, t2 = Dt$1) {
1923
1924
  }
1924
1925
  }
1925
1926
  const s10 = /* @__PURE__ */ new Map();
1926
- for (const [i3, o2] of a4) s10.set(i3, Ot$1(i3, o2, t3));
1927
+ for (const [i3, o2] of a4) s10.set(i3, Gt$1(i3, o2, t3));
1927
1928
  return s10;
1928
1929
  })(e14, t2), s9 = /* @__PURE__ */ new Map();
1929
1930
  for (const n2 of e14.chapters) s9.set(n2.chapterId, n2);
@@ -1935,14 +1936,14 @@ function Nt(e14, t2 = Dt$1) {
1935
1936
  const [i3] = t3.globalPageRange, [l] = t3.localPageRange, h2 = l + (n2 - i3);
1936
1937
  o.push({ globalPageIndex: r2++, globalPageNumber: n2, chapterId: e15, localPageIndex: h2 });
1937
1938
  }
1938
- return new Gt$1(o);
1939
+ return new Nt(o);
1939
1940
  }
1940
- const At$1 = class e7 extends BasePlugin {
1941
+ const Vt = class e7 extends BasePlugin {
1941
1942
  constructor(e14, t2) {
1942
- super(e14, t2), this.statusChange$ = createBehaviorEmitter(), this.manifestChange$ = createEmitter(), this.overlapStrategy = Dt$1, this.chapterStatus = /* @__PURE__ */ new Map(), this.chapterLastUsed = /* @__PURE__ */ new Map(), this.passwordAttempts = /* @__PURE__ */ new Map(), this.pendingLoadPromises = /* @__PURE__ */ new Map(), this.unloadTimer = null, this.documentManagerUnsubs = [], this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
1943
+ super(e14, t2), this.statusChange$ = createBehaviorEmitter(), this.manifestChange$ = createEmitter(), this.overlapStrategy = Ot$1, this.chapterStatus = /* @__PURE__ */ new Map(), this.chapterLastUsed = /* @__PURE__ */ new Map(), this.passwordAttempts = /* @__PURE__ */ new Map(), this.pendingLoadPromises = /* @__PURE__ */ new Map(), this.unloadTimer = null, this.documentManagerUnsubs = [], this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
1943
1944
  }
1944
1945
  async initialize(e14) {
1945
- if (this.config = e14, this.passwordProvider = e14.passwordProvider, this.overlapStrategy = e14.overlapStrategy ?? Dt$1, this.documentManagerUnsubs.push(this.documentManager.provides().onDocumentOpened((e15) => {
1946
+ if (this.config = e14, this.passwordProvider = e14.passwordProvider, this.overlapStrategy = e14.overlapStrategy ?? Ot$1, this.documentManagerUnsubs.push(this.documentManager.provides().onDocumentOpened((e15) => {
1946
1947
  this.isOwnedChapter(e15.id) && (this.passwordAttempts.delete(e15.id), this.updateStatus(e15.id, "loaded"));
1947
1948
  }), this.documentManager.provides().onDocumentClosed((e15) => {
1948
1949
  this.isOwnedChapter(e15) && this.updateStatus(e15, "closed");
@@ -1977,7 +1978,7 @@ const At$1 = class e7 extends BasePlugin {
1977
1978
  const s9 = new Set(this.chapterStatus.keys()), i2 = new Set(t2.chapters.map((e14) => e14.chapterId));
1978
1979
  for (const e14 of s9) i2.has(e14) || (this.closeChapter(e14), this.chapterStatus.delete(e14));
1979
1980
  for (const e14 of t2.chapters) this.chapterStatus.has(e14.chapterId) || this.chapterStatus.set(e14.chapterId, "idle");
1980
- this.manifest = t2, this.virtualPageMap = Nt(t2, this.overlapStrategy), this.manifestChange$.emit({ manifest: t2, map: this.virtualPageMap }), this.eagerPrefetchFromManifest();
1981
+ this.manifest = t2, this.virtualPageMap = At$1(t2, this.overlapStrategy), this.manifestChange$.emit({ manifest: t2, map: this.virtualPageMap }), this.eagerPrefetchFromManifest();
1981
1982
  }
1982
1983
  eagerPrefetchFromManifest() {
1983
1984
  const e14 = this.config.prefetchChapters ?? 0;
@@ -2115,9 +2116,9 @@ const At$1 = class e7 extends BasePlugin {
2115
2116
  this.chapterStatus.get(e14) !== t2 && (this.chapterStatus.set(e14, t2), this.statusChange$.emit({ chapterId: e14, status: t2, ..."error" === t2 && a3 ? { error: { message: a3 } } : {} }));
2116
2117
  }
2117
2118
  };
2118
- At$1.id = "chapter-manager";
2119
- let Vt = At$1;
2120
- function Et(e14, t2) {
2119
+ Vt.id = "chapter-manager";
2120
+ let Et = Vt;
2121
+ function _t(e14, t2) {
2121
2122
  if (e14 === t2) return true;
2122
2123
  if (e14.totalHeight !== t2.totalHeight || e14.totalWidth !== t2.totalWidth || e14.pageGap !== t2.pageGap || e14.items.length !== t2.items.length) return false;
2123
2124
  for (let a3 = 0; a3 < e14.items.length; a3++) {
@@ -2126,9 +2127,9 @@ function Et(e14, t2) {
2126
2127
  }
2127
2128
  return true;
2128
2129
  }
2129
- const _t = class extends BasePlugin {
2130
+ const Rt = class extends BasePlugin {
2130
2131
  constructor(e14, t2) {
2131
- super(e14, t2), this.layoutChange$ = createBehaviorEmitter(void 0, Et), 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.chapterManagerUnsubs = [], this.chapterManager = this.registry.getPlugin(Vt.id), this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
2132
+ super(e14, t2), this.layoutChange$ = createBehaviorEmitter(void 0, _t), 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.chapterManagerUnsubs = [], this.chapterManager = this.registry.getPlugin(Et.id), this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
2132
2133
  }
2133
2134
  async initialize(e14) {
2134
2135
  this.config = { placeholderPageHeight: e14.placeholderPageHeight ?? 1200, placeholderPageWidth: e14.placeholderPageWidth ?? 900, bufferSize: e14.bufferSize ?? 2, pageGap: e14.pageGap ?? 20 }, this.virtualPageMap = this.chapterManager.provides().getVirtualPageMap(), this.rebuildOffsets(), this.chapterManagerUnsubs.push(this.chapterManager.provides().onManifestChange(({ map: e15 }) => {
@@ -2305,41 +2306,41 @@ const _t = class extends BasePlugin {
2305
2306
  a3 && this.scrollToIndex(a3.globalPageIndex, t2);
2306
2307
  }
2307
2308
  };
2308
- _t.id = "chapter-scroll";
2309
- let Rt = _t;
2310
- function Ft(e14) {
2309
+ Rt.id = "chapter-scroll";
2310
+ let Ft = Rt;
2311
+ function Ut(e14) {
2311
2312
  if (0 === e14.length) throw new Error("unionRects: empty rects");
2312
2313
  let t2 = 1 / 0, a3 = 1 / 0, s9 = -1 / 0, i2 = -1 / 0;
2313
2314
  for (const o of e14) t2 = Math.min(t2, o.origin.x), a3 = Math.min(a3, o.origin.y), s9 = Math.max(s9, o.origin.x + o.size.width), i2 = Math.max(i2, o.origin.y + o.size.height);
2314
2315
  return { origin: { x: t2, y: a3 }, size: { width: s9 - t2, height: i2 - a3 } };
2315
2316
  }
2316
- function Ut(e14) {
2317
+ function qt(e14) {
2317
2318
  const t2 = e14[e14.length - 1];
2318
2319
  return { x: t2.origin.x + t2.size.width, y: t2.origin.y + t2.size.height };
2319
2320
  }
2320
- function qt(e14, t2) {
2321
+ function Wt(e14, t2) {
2321
2322
  const a3 = e14.origin.y, s9 = e14.origin.y + e14.size.height, i2 = t2.origin.y, o = t2.origin.y + t2.size.height, r2 = Math.max(s9, o) - Math.min(a3, i2);
2322
2323
  if (r2 <= 0) return 0;
2323
2324
  return Math.max(0, Math.min(s9, o) - Math.max(a3, i2)) / r2;
2324
2325
  }
2325
- function Wt(e14, t2) {
2326
+ function Ht$1(e14, t2) {
2326
2327
  var a3, s9;
2327
2328
  if (e14.chapterId !== t2.chapterId || e14.localPageIndex !== t2.localPageIndex) return false;
2328
- const i2 = (null == (a3 = e14.rectsPdfCoord) ? void 0 : a3.length) ? e14.rectsPdfCoord : [e14.rectPdfCoord], o = (null == (s9 = t2.rectsPdfCoord) ? void 0 : s9.length) ? t2.rectsPdfCoord : [t2.rectPdfCoord], r2 = e14.markerAnchor ?? Ut(i2), n2 = t2.markerAnchor ?? Ut(o);
2329
+ const i2 = (null == (a3 = e14.rectsPdfCoord) ? void 0 : a3.length) ? e14.rectsPdfCoord : [e14.rectPdfCoord], o = (null == (s9 = t2.rectsPdfCoord) ? void 0 : s9.length) ? t2.rectsPdfCoord : [t2.rectPdfCoord], r2 = e14.markerAnchor ?? qt(i2), n2 = t2.markerAnchor ?? qt(o);
2329
2330
  if (Math.hypot(r2.x - n2.x, r2.y - n2.y) <= 6) return true;
2330
2331
  for (const l of i2) for (const e15 of o) {
2331
- if (qt(l, e15) < 0.5) continue;
2332
+ if (Wt(l, e15) < 0.5) continue;
2332
2333
  const t3 = Math.max(l.origin.x, e15.origin.x);
2333
2334
  if (Math.min(l.origin.x + l.size.width, e15.origin.x + e15.size.width) - t3 > 0.25 * Math.min(l.size.width, e15.size.width)) return true;
2334
2335
  }
2335
2336
  return false;
2336
2337
  }
2337
- function Ht$1(e14, t2, a3, s9) {
2338
+ function Bt$1(e14, t2, a3, s9) {
2338
2339
  const i2 = a3.length > 0 ? a3 : [];
2339
2340
  if (0 === i2.length) throw new Error("buildParagraphBookmarkAnchor: no rects");
2340
- return { chapterId: e14, localPageIndex: t2, globalPageIndex: null == s9 ? void 0 : s9.globalPageIndex, globalPageNumber: null == s9 ? void 0 : s9.globalPageNumber, rectPdfCoord: Ft(i2), rectsPdfCoord: i2, markerAnchor: Ut(i2) };
2341
+ return { chapterId: e14, localPageIndex: t2, globalPageIndex: null == s9 ? void 0 : s9.globalPageIndex, globalPageNumber: null == s9 ? void 0 : s9.globalPageNumber, rectPdfCoord: Ut(i2), rectsPdfCoord: i2, markerAnchor: qt(i2) };
2341
2342
  }
2342
- async function Bt$1(e14, t2, a3) {
2343
+ async function jt(e14, t2, a3) {
2343
2344
  e14.scrollToGlobalPageIndex(t2), await (function(e15, t3, a4 = 2500) {
2344
2345
  const s9 = e15.getLayout().items.find((e16) => e16.globalPageIndex === t3 && !e16.isPlaceholder);
2345
2346
  return s9 ? Promise.resolve(s9) : new Promise((s10) => {
@@ -2352,9 +2353,9 @@ async function Bt$1(e14, t2, a3) {
2352
2353
  });
2353
2354
  })(e14, t2), e14.scrollToGlobalPdfPoint(t2, a3, { marginTop: 80 });
2354
2355
  }
2355
- const jt = class e8 extends BasePlugin {
2356
+ const Zt = class e8 extends BasePlugin {
2356
2357
  constructor(e14, t2) {
2357
- super(e14, t2), this.change$ = createBehaviorEmitter([]), this.entries = /* @__PURE__ */ new Map(), this.chapterScroll = this.registry.getPlugin(Rt.id), this.chapterManager = this.registry.getPlugin(Tt$1.id), this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
2358
+ super(e14, t2), this.change$ = createBehaviorEmitter([]), this.entries = /* @__PURE__ */ new Map(), this.chapterScroll = this.registry.getPlugin(Ft.id), this.chapterManager = this.registry.getPlugin(Dt$1.id), this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
2358
2359
  }
2359
2360
  async initialize(t2) {
2360
2361
  var a3;
@@ -2370,7 +2371,7 @@ const jt = class e8 extends BasePlugin {
2370
2371
  return { addBookmark: (e14) => this.addBookmark(e14), removeBookmark: (e14) => this.removeBookmark(e14), updateBookmark: (e14, t2) => this.updateBookmark(e14, t2), listBookmarks: () => this.list(), getBookmark: (e14) => this.entries.get(e14) ?? null, scrollToBookmark: (e14) => this.scrollToBookmark(e14), requestRemoveBookmark: (e14) => this.requestRemoveBookmark(e14), listBookmarksForChapter: (e14) => this.listBookmarksForChapter(e14), replaceBookmarksForChapter: (e14, t2) => this.replaceBookmarksForChapter(e14, t2), onBookmarksChange: this.change$.on };
2371
2372
  }
2372
2373
  addBookmark(e14) {
2373
- for (const s9 of this.entries.values()) if (Wt(s9.anchor, e14.anchor)) return s9;
2374
+ for (const s9 of this.entries.values()) if (Ht$1(s9.anchor, e14.anchor)) return s9;
2374
2375
  const t2 = e14.id ?? `bm-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`, a3 = { id: t2, label: e14.label, anchor: e14.anchor, metadata: e14.metadata, createdAt: Date.now() };
2375
2376
  return this.entries.set(t2, a3), this.notifyAndPersist(), a3;
2376
2377
  }
@@ -2426,13 +2427,13 @@ const jt = class e8 extends BasePlugin {
2426
2427
  const t3 = e15.rectPdfCoord;
2427
2428
  return t3.origin.y + t3.size.height;
2428
2429
  })(t2.anchor);
2429
- await Bt$1(a3, s9, i2);
2430
+ await jt(a3, s9, i2);
2430
2431
  }
2431
2432
  };
2432
- jt.id = "paragraph-bookmark";
2433
- let Zt = jt;
2434
- const Yt = { manifest: St$1, create: (e14) => new Zt(Mt$1, e14), reducer: (e14) => e14, initialState: {} }, Kt = { "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 }] } };
2435
- class Xt {
2433
+ Zt.id = "paragraph-bookmark";
2434
+ let Yt = Zt;
2435
+ const Xt = { manifest: xt$1, create: (e14) => new Yt(St$1, e14), reducer: (e14) => e14, initialState: {} }, Kt = { "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 }] } };
2436
+ class Qt {
2436
2437
  constructor() {
2437
2438
  this.specs = [];
2438
2439
  }
@@ -2452,12 +2453,12 @@ class Xt {
2452
2453
  const a3 = e14[t2.toolbarSlot];
2453
2454
  if (!a3) continue;
2454
2455
  const s9 = { type: "command-button", id: t2.id, commandId: t2.commandId, variant: "icon", ...t2.icon ? { icon: t2.icon } : {}, ...t2.i18nKey ? { labelKey: t2.i18nKey } : {}, ...t2.label ? { label: t2.label } : {}, categories: t2.categories ?? [] };
2455
- a3.items = Qt(a3.items, s9, t2.position);
2456
+ a3.items = Jt(a3.items, s9, t2.position);
2456
2457
  }
2457
2458
  return e14;
2458
2459
  }
2459
2460
  }
2460
- function Qt(e14, t2, a3) {
2461
+ function Jt(e14, t2, a3) {
2461
2462
  return (null == a3 ? void 0 : a3.after) || (null == a3 ? void 0 : a3.before) ? (function(e15, t3, a4) {
2462
2463
  const s9 = (e16) => {
2463
2464
  const i2 = [];
@@ -2469,8 +2470,8 @@ function Qt(e14, t2, a3) {
2469
2470
  return e15.map((e16) => "group" === e16.type ? { ...e16, items: [...e16.items, t3] } : e16);
2470
2471
  })(e14, t2);
2471
2472
  }
2472
- const Jt = { annotate: "annotation-toolbar", shapes: "shapes-toolbar", insert: "insert-toolbar", form: "form-toolbar", redact: "redaction-toolbar" };
2473
- function ea() {
2473
+ const ea = { annotate: "annotation-toolbar", shapes: "shapes-toolbar", insert: "insert-toolbar", form: "form-toolbar", redact: "redaction-toolbar" };
2474
+ function ta() {
2474
2475
  return { "mode:view": { id: "mode:view", label: "View", categories: ["mode", "mode-view"], action: ({ registry: e14, documentId: t2 }) => {
2475
2476
  var _a2, _b, _c, _d;
2476
2477
  const a3 = (_a2 = e14.getPlugin("ui")) == null ? void 0 : _a2.provides(), s9 = (_b = e14.getPlugin("interaction-manager")) == null ? void 0 : _b.provides();
@@ -2497,16 +2498,16 @@ function ea() {
2497
2498
  a3 && (a3.setActiveToolbar("top", "secondary", "redaction-toolbar", t2), (_b = e14.getPlugin(ANNOTATION_PLUGIN_ID)) == null ? void 0 : _b.provides().forDocument(t2).setLocked({ type: LockModeType.Include, categories: ["form"] }));
2498
2499
  }, active: ({ state: e14, documentId: t2 }) => isToolbarOpen(e14.plugins, t2, "top", "secondary", "redaction-toolbar") } };
2499
2500
  }
2500
- function ta(e14) {
2501
+ function aa(e14) {
2501
2502
  var _a2, _b, _c, _d, _e2, _f;
2502
2503
  const t2 = e14.toolbar ?? {}, a3 = t2.enabledModes ?? ["view", "annotate", "shapes", "insert", "form", "redact"], s9 = a3.length > 0, { schema: i2, operationRegistry: o } = (function(e15 = {}) {
2503
2504
  var t3, a4, s10, i3, o2, r3;
2504
- const n3 = new Set(e15.enabledModes ?? ["view", "annotate", "shapes", "insert", "form", "redact"]), l = new Xt();
2505
+ const n3 = new Set(e15.enabledModes ?? ["view", "annotate", "shapes", "insert", "form", "redact"]), l = new Qt();
2505
2506
  (null == (t3 = e15.customOperations) ? void 0 : t3.length) && l.registerAll(e15.customOperations);
2506
2507
  const h2 = l.buildToolbars(), d2 = {};
2507
2508
  for (const u of n3) {
2508
2509
  if ("view" === u) continue;
2509
- const e16 = Jt[u];
2510
+ const e16 = ea[u];
2510
2511
  h2[e16] && (d2[e16] = h2[e16]);
2511
2512
  }
2512
2513
  const c = (function(e16) {
@@ -2515,10 +2516,10 @@ function ta(e14) {
2515
2516
  return { id: "chapter-editor-main-toolbar", position: { placement: "top", slot: "main", order: 0 }, permanent: true, items: [{ type: "spacer", id: "main-spacer-left", flex: true }, { type: "group", id: "mode-group", alignment: "start", gap: 2, items: [...e16.has("view") ? [t4("view", "View", "mode:view")] : [], ...e16.has("annotate") ? [t4("annotate", "Annotate", "mode:annotate")] : [], ...e16.has("shapes") ? [t4("shapes", "Shapes", "mode:shapes")] : [], ...e16.has("insert") ? [t4("insert", "Insert", "mode:insert")] : [], ...e16.has("form") ? [t4("form", "Form", "mode:form")] : [], ...e16.has("redact") ? [t4("redact", "Redact", "mode:redact")] : []] }, { type: "spacer", id: "main-spacer-right", flex: true }] };
2516
2517
  })(n3);
2517
2518
  return c && (d2["chapter-editor-main-toolbar"] = c), (null == (a4 = e15.extend) ? void 0 : a4.toolbars) && Object.assign(d2, e15.extend.toolbars), { schema: { id: "chapter-pdf-editor-ui", version: "1.0.0", toolbars: d2, menus: (null == (s10 = e15.extend) ? void 0 : s10.menus) ?? {}, sidebars: (null == (i3 = e15.extend) ? void 0 : i3.sidebars) ?? {}, modals: (null == (o2 = e15.extend) ? void 0 : o2.modals) ?? {}, selectionMenus: (null == (r3 = e15.extend) ? void 0 : r3.selectionMenus) ?? {} }, operationRegistry: l };
2518
- })({ ...t2, enabledModes: a3 }), r2 = { ...s9 ? ea() : {}, ...s9 ? aa(o.list()) : {}, ...e14.commands ?? {} }, n2 = [createPluginRegistration(DocumentManagerPluginPackage, { initialDocuments: [] }), createPluginRegistration(We, { manifest: e14.manifest, overlapStrategy: e14.overlapStrategy, passwordProvider: e14.passwordProvider, chapterPdfLoader: e14.chapterPdfLoader, prefetchChapters: e14.prefetchChapters, unloadTimeoutMs: e14.unloadTimeoutMs }), createPluginRegistration(at$1, { placeholderPageHeight: e14.placeholderPageHeight, placeholderPageWidth: e14.placeholderPageWidth }), createPluginRegistration(InteractionManagerPluginPackage), createPluginRegistration(RenderPluginPackage), createPluginRegistration(RotatePluginPackage), createPluginRegistration(SelectionPluginPackage, { marquee: { enabled: false }, toleranceFactor: 1.2, minSelectionDragDistance: 4 }), createPluginRegistration(HistoryPluginPackage), createPluginRegistration(AnnotationPluginPackage), createPluginRegistration(RedactionPluginPackage), createPluginRegistration(FormPluginPackage), createPluginRegistration(StampPluginPackage, false === e14.loadDefaultStampLibrary ? { manifests: [] } : void 0), createPluginRegistration(SignaturePluginPackage), ...Object.keys(r2).length > 0 ? [createPluginRegistration(CommandsPluginPackage, { commands: r2 })] : [], ...s9 ? [createPluginRegistration(I18nPluginPackage), createPluginRegistration(UIPluginPackage, { schema: i2 })] : []];
2519
- return e14.notes && n2.push(createPluginRegistration(It$1, { callbacks: e14.notes.callbacks, ui: (_b = (_a2 = e14.features) == null ? void 0 : _a2.notes) == null ? void 0 : _b.marker })), e14.bookmarks && n2.push(createPluginRegistration(Yt, { callbacks: e14.bookmarks.callbacks, ui: (_d = (_c = e14.features) == null ? void 0 : _c.bookmarks) == null ? void 0 : _d.marker, hover: (_f = (_e2 = e14.features) == null ? void 0 : _e2.bookmarks) == null ? void 0 : _f.hover })), { plugins: n2, uiSchema: i2, operationRegistry: o };
2519
+ })({ ...t2, enabledModes: a3 }), r2 = { ...s9 ? ta() : {}, ...s9 ? sa(o.list()) : {}, ...e14.commands ?? {} }, n2 = [createPluginRegistration(DocumentManagerPluginPackage, { initialDocuments: [] }), createPluginRegistration(He, { manifest: e14.manifest, overlapStrategy: e14.overlapStrategy, passwordProvider: e14.passwordProvider, chapterPdfLoader: e14.chapterPdfLoader, prefetchChapters: e14.prefetchChapters, unloadTimeoutMs: e14.unloadTimeoutMs }), createPluginRegistration(st$1, { placeholderPageHeight: e14.placeholderPageHeight, placeholderPageWidth: e14.placeholderPageWidth }), createPluginRegistration(InteractionManagerPluginPackage), createPluginRegistration(RenderPluginPackage), createPluginRegistration(RotatePluginPackage), createPluginRegistration(SelectionPluginPackage, { marquee: { enabled: false }, toleranceFactor: 1.2, minSelectionDragDistance: 4 }), createPluginRegistration(HistoryPluginPackage), createPluginRegistration(AnnotationPluginPackage), createPluginRegistration(RedactionPluginPackage), createPluginRegistration(FormPluginPackage), createPluginRegistration(StampPluginPackage, false === e14.loadDefaultStampLibrary ? { manifests: [] } : void 0), createPluginRegistration(SignaturePluginPackage), ...Object.keys(r2).length > 0 ? [createPluginRegistration(CommandsPluginPackage, { commands: r2 })] : [], ...s9 ? [createPluginRegistration(I18nPluginPackage), createPluginRegistration(UIPluginPackage, { schema: i2 })] : []];
2520
+ return e14.notes && n2.push(createPluginRegistration(Mt$1, { callbacks: e14.notes.callbacks, ui: (_b = (_a2 = e14.features) == null ? void 0 : _a2.notes) == null ? void 0 : _b.marker })), e14.bookmarks && n2.push(createPluginRegistration(Xt, { callbacks: e14.bookmarks.callbacks, ui: (_d = (_c = e14.features) == null ? void 0 : _c.bookmarks) == null ? void 0 : _d.marker, hover: (_f = (_e2 = e14.features) == null ? void 0 : _e2.bookmarks) == null ? void 0 : _f.hover })), { plugins: n2, uiSchema: i2, operationRegistry: o };
2520
2521
  }
2521
- function aa(e14) {
2522
+ function sa(e14) {
2522
2523
  const t2 = {};
2523
2524
  for (const a3 of e14) a3.handler && (t2[a3.commandId] = { id: a3.commandId, labelKey: a3.i18nKey, label: a3.label, icon: a3.icon, categories: a3.categories, action: ({ documentId: e15 }) => {
2524
2525
  var _a2;
@@ -2526,93 +2527,152 @@ function aa(e14) {
2526
2527
  } });
2527
2528
  return t2;
2528
2529
  }
2529
- const sa = Le(), ia = {};
2530
- function oa(e14) {
2531
- return ta({ ...e14, toolbar: e14.toolbar ?? { enabledModes: [] }, features: Le(e14.features) });
2530
+ const ia = $e(), oa = {};
2531
+ function ra(e14) {
2532
+ return aa({ ...e14, toolbar: e14.toolbar ?? { enabledModes: [] }, features: $e(e14.features) });
2532
2533
  }
2533
- const ra = { overlapStrategy: { kind: "first-wins" }, passwordProvider: new ze(async () => null), prefetchChapters: 1, loadDefaultStampLibrary: false, unloadTimeoutMs: 12e4, toolbar: { enabledModes: [] } };
2534
- function na(e14) {
2534
+ const na = { overlapStrategy: { kind: "first-wins" }, passwordProvider: new ze(async () => null), prefetchChapters: 1, loadDefaultStampLibrary: false, unloadTimeoutMs: 12e4, toolbar: { enabledModes: [] } };
2535
+ function la(e14) {
2535
2536
  return (function(e15) {
2536
2537
  return "callbacks" in e15.notes;
2537
2538
  })(e14) ? { manifest: e14.manifest, chapterPdfLoader: e14.chapterPdfLoader, notes: e14.notes.callbacks, bookmarks: e14.bookmarks.callbacks } : e14;
2538
2539
  }
2539
- function la(e14) {
2540
- return { ...ra, manifest: e14.manifest, chapterPdfLoader: e14.chapterPdfLoader, overlapStrategy: e14.overlapStrategy ?? ra.overlapStrategy, notes: { callbacks: e14.notes }, bookmarks: { callbacks: e14.bookmarks }, features: Le(e14.features) };
2541
- }
2542
2540
  function ha(e14) {
2543
- const t2 = la(na(e14)), { plugins: a3 } = oa(t2);
2544
- return { plugins: a3, features: t2.features, editorOptions: t2 };
2541
+ return { ...na, manifest: e14.manifest, chapterPdfLoader: e14.chapterPdfLoader, overlapStrategy: e14.overlapStrategy ?? na.overlapStrategy, notes: { callbacks: e14.notes }, bookmarks: { callbacks: e14.bookmarks }, features: $e(e14.features) };
2545
2542
  }
2546
2543
  function da(e14) {
2547
- const { features: t2, ...a3 } = la(na(e14));
2544
+ const t2 = ha(la(e14)), { plugins: a3 } = ra(t2);
2545
+ return { plugins: a3, features: t2.features, editorOptions: t2 };
2546
+ }
2547
+ function ca(e14) {
2548
+ const { features: t2, ...a3 } = ha(la(e14));
2548
2549
  return a3;
2549
2550
  }
2550
- function ca(e14, t2 = 0.5, a3 = 3) {
2551
+ function ua(e14, t2 = 0.5, a3 = 3) {
2551
2552
  return Math.min(a3, Math.max(t2, e14));
2552
2553
  }
2553
- function ua(i2, o) {
2554
+ function pa(e14, t2) {
2554
2555
  var _a2;
2555
- const r2 = isRef(i2) ? i2 : computed(() => i2), { registry: n2 } = useRegistry(), { provides: l } = useCapability(DocumentManagerPlugin.id), { provides: h2 } = useCapability(qe.id), d2 = ref(((_a2 = o.value) == null ? void 0 : _a2.initial) ?? 1), c = ref(d2.value), u = () => {
2556
+ if (t2 <= 0) return 1;
2557
+ let a3 = 0;
2558
+ for (const s9 of e14.pages) {
2559
+ const e15 = ((_a2 = s9 == null ? void 0 : s9.size) == null ? void 0 : _a2.width) ?? 0;
2560
+ e15 > a3 && (a3 = e15);
2561
+ }
2562
+ return a3 <= 0 ? 1 : t2 / a3;
2563
+ }
2564
+ function ga(e14, t2) {
2565
+ return e14 <= 0 ? t2 ?? 0 : null == t2 || t2 <= 0 ? e14 : Math.min(t2, e14);
2566
+ }
2567
+ function fa(e14, t2, a3, s9) {
2568
+ const i2 = ga(t2, a3);
2569
+ if (i2 <= 0) return s9;
2570
+ const o = pa(e14, i2);
2571
+ return Math.min(s9, o);
2572
+ }
2573
+ function ma(e14) {
2574
+ return e14 instanceof HTMLElement ? e14.clientWidth : 0;
2575
+ }
2576
+ function va(o, r2, n2) {
2577
+ var _a2;
2578
+ const l = isRef(o) ? o : computed(() => o), { registry: h2 } = useRegistry(), { provides: d2 } = useCapability(DocumentManagerPlugin.id), { provides: c } = useCapability(We.id), u = ref(((_a2 = r2.value) == null ? void 0 : _a2.initial) ?? 1), p2 = ref(u.value), g2 = ref(0), f = () => {
2556
2579
  var _a3;
2557
- return ((_a3 = o.value) == null ? void 0 : _a3.min) ?? 0.5;
2558
- }, p2 = () => {
2580
+ return (_a3 = r2.value) == null ? void 0 : _a3.pageWidth;
2581
+ }, m = computed(() => {
2559
2582
  var _a3;
2560
- return ((_a3 = o.value) == null ? void 0 : _a3.max) ?? 3;
2561
- }, g2 = () => {
2583
+ return (function(e14, t2, a3, s9, i2) {
2584
+ if (!e14 || a3 <= 0) return i2;
2585
+ let o2 = i2;
2586
+ for (const r3 of t2.chapters) {
2587
+ const t3 = e14.getDocument(r3.chapterId);
2588
+ t3 && (o2 = Math.min(o2, fa(t3, a3, s9, i2)));
2589
+ }
2590
+ return o2;
2591
+ })(d2.value, l.value, g2.value, f(), ((_a3 = r2.value) == null ? void 0 : _a3.max) ?? 3);
2592
+ }), v = computed(() => {
2562
2593
  var _a3;
2563
- return (_a3 = o.value) == null ? void 0 : _a3.pageWidth;
2564
- };
2565
- function f(e14) {
2566
- const t2 = ca(e14, u(), p2());
2567
- c.value = t2, d2.value = t2, (function(e15, t3, a3, s9 = 0.5, i3 = 3) {
2594
+ return Math.min(((_a3 = r2.value) == null ? void 0 : _a3.min) ?? 0.5, m.value);
2595
+ });
2596
+ let b;
2597
+ function P(e14) {
2598
+ const t2 = m.value, a3 = v.value, s9 = ua(e14, a3, t2);
2599
+ p2.value = s9, u.value = s9, (function(e15, t3, a4, s10 = 0.5, i2 = 3) {
2568
2600
  const o2 = e15 == null ? void 0 : e15.getStore();
2569
2601
  if (!o2) return;
2570
- const r3 = ca(a3, s9, i3);
2602
+ const r3 = ua(a4, s10, i2);
2571
2603
  o2.dispatchToCore(setDefaultScale(r3));
2572
2604
  for (const n3 of t3.chapters) o2.getState().core.documents[n3.chapterId] && o2.dispatchToCore(setScale(r3, n3.chapterId));
2573
- })(n2.value, r2.value, t2, u(), p2());
2574
- }
2575
- function m(e14) {
2576
- g2() ? (function(e15) {
2577
- const t2 = g2();
2578
- if (!t2 || !l.value) return;
2579
- const a3 = l.value.getDocument(e15);
2580
- a3 && f((function(e16, t3, a4 = 0) {
2581
- var _a3;
2582
- const s9 = e16.pages[a4];
2583
- return ((_a3 = s9 == null ? void 0 : s9.size) == null ? void 0 : _a3.width) ? t3 / s9.size.width : 1;
2584
- })(a3, t2));
2585
- })(e14) : f(c.value);
2586
- }
2587
- return watch([n2, () => {
2605
+ })(h2.value, l.value, s9, a3, t2);
2606
+ }
2607
+ function w(e14) {
2608
+ if (!d2.value) return;
2609
+ const t2 = d2.value.getDocument(e14);
2610
+ if (!t2) return;
2611
+ const a3 = ga(g2.value, f());
2612
+ a3 <= 0 || P(pa(t2, a3));
2613
+ }
2614
+ function y(e14) {
2615
+ null != f() || g2.value > 0 ? w(e14) : P(p2.value);
2616
+ }
2617
+ return watch(() => n2 == null ? void 0 : n2.value, (e14) => {
2618
+ b == null ? void 0 : b(), b = e14 ? (function(e15, t2) {
2619
+ if (!e15 || "undefined" == typeof ResizeObserver) return () => {
2620
+ };
2621
+ let a3 = null;
2622
+ const s9 = new ResizeObserver(() => {
2623
+ t2(ma(a3));
2624
+ }), i2 = () => {
2625
+ const i3 = e15.querySelector("[data-chapter-scroll-viewport]");
2626
+ i3 !== a3 ? (a3 && s9.unobserve(a3), a3 = i3, a3 ? (s9.observe(a3), t2(ma(a3))) : t2(0)) : t2(ma(a3));
2627
+ };
2628
+ i2();
2629
+ const o2 = new MutationObserver(i2);
2630
+ o2.observe(e15, { childList: true, subtree: true });
2631
+ const r3 = requestAnimationFrame(i2);
2632
+ return () => {
2633
+ cancelAnimationFrame(r3), o2.disconnect(), a3 && s9.unobserve(a3), s9.disconnect();
2634
+ };
2635
+ })(e14, (e15) => {
2636
+ g2.value = e15;
2637
+ }) : void 0;
2638
+ }, { immediate: true }), onBeforeUnmount(() => b == null ? void 0 : b()), watch([h2, () => {
2588
2639
  var _a3;
2589
- return (_a3 = o.value) == null ? void 0 : _a3.initial;
2640
+ return (_a3 = r2.value) == null ? void 0 : _a3.initial;
2590
2641
  }, () => {
2591
2642
  var _a3;
2592
- return (_a3 = o.value) == null ? void 0 : _a3.pageWidth;
2593
- }], () => {
2643
+ return (_a3 = r2.value) == null ? void 0 : _a3.pageWidth;
2644
+ }, g2], () => {
2594
2645
  var _a3;
2595
- n2.value && (g2() || f(((_a3 = o.value) == null ? void 0 : _a3.initial) ?? 1));
2596
- }, { immediate: true }), watch([h2, r2, () => {
2646
+ h2.value && (null != f() || g2.value > 0 || P(((_a3 = r2.value) == null ? void 0 : _a3.initial) ?? 1));
2647
+ }, { immediate: true }), watch(m, (e14) => {
2648
+ p2.value > e14 && P(e14);
2649
+ }), watch([c, l, () => {
2597
2650
  var _a3;
2598
- return (_a3 = o.value) == null ? void 0 : _a3.pageWidth;
2599
- }], () => {
2600
- const e14 = h2.value;
2651
+ return (_a3 = r2.value) == null ? void 0 : _a3.pageWidth;
2652
+ }, g2], () => {
2653
+ const e14 = c.value;
2601
2654
  if (e14) {
2602
- for (const t2 of r2.value.chapters) "loaded" === e14.getChapterStatus(t2.chapterId) && m(t2.chapterId);
2655
+ for (const t2 of l.value.chapters) "loaded" === e14.getChapterStatus(t2.chapterId) && y(t2.chapterId);
2603
2656
  return e14.onChapterStatusChange((e15) => {
2604
- "loaded" === e15.status && m(e15.chapterId);
2657
+ "loaded" === e15.status && y(e15.chapterId);
2605
2658
  });
2606
2659
  }
2607
- }, { immediate: true }), { scale: d2, setScale: f, zoomEnabled: () => {
2660
+ }, { immediate: true }), watch(g2, (e14) => {
2661
+ if (!(e14 <= 0) && c.value) {
2662
+ for (const t2 of l.value.chapters) if ("loaded" === c.value.getChapterStatus(t2.chapterId)) {
2663
+ w(t2.chapterId);
2664
+ break;
2665
+ }
2666
+ }
2667
+ }), { scale: u, setScale: P, zoomEnabled: () => {
2608
2668
  var _a3;
2609
- return false !== ((_a3 = o.value) == null ? void 0 : _a3.enabled);
2610
- }, minZoom: u, maxZoom: p2 };
2669
+ return false !== ((_a3 = r2.value) == null ? void 0 : _a3.enabled);
2670
+ }, minZoom: v, maxZoom: m };
2611
2671
  }
2612
- function pa(e14, t2, a3) {
2672
+ function ba(e14, t2, a3) {
2613
2673
  return Math.min(a3, Math.max(t2, e14));
2614
2674
  }
2615
- function ga(e14, t2) {
2675
+ function Pa(e14, t2) {
2616
2676
  if (!e14 || false === t2.enabled) return () => {
2617
2677
  };
2618
2678
  let a3 = null, s9 = null, i2 = 0;
@@ -2621,7 +2681,7 @@ function ga(e14, t2) {
2621
2681
  return !!s10 && (a3 == null ? void 0 : a3(), a3 = (function({ container: e15, getScale: t3, setScale: a4, minZoom: s11 = 0.5, maxZoom: i3 = 3 }) {
2622
2682
  let o2 = 0, r2 = 1, n2 = null, l = 1, h2 = 1;
2623
2683
  const d2 = (e16) => {
2624
- (e16.ctrlKey || e16.metaKey) && (e16.preventDefault(), null === n2 ? (h2 = t3(), l = 1) : clearTimeout(n2), l *= 1 - 0.01 * e16.deltaY, l = pa(l, 0.1, 10), a4(pa(h2 * l, s11, i3)), n2 = setTimeout(() => {
2684
+ (e16.ctrlKey || e16.metaKey) && (e16.preventDefault(), null === n2 ? (h2 = t3(), l = 1) : clearTimeout(n2), l *= 1 - 0.01 * e16.deltaY, l = ba(l, 0.1, 10), a4(ba(h2 * l, s11, i3)), n2 = setTimeout(() => {
2625
2685
  n2 = null;
2626
2686
  }, 120));
2627
2687
  }, c = /* @__PURE__ */ new Map(), u = (e16) => {
@@ -2633,7 +2693,7 @@ function ga(e14, t2) {
2633
2693
  if (c.has(e16.pointerId) && (c.set(e16.pointerId, { x: e16.clientX, y: e16.clientY }), 2 === c.size && o2 > 0)) {
2634
2694
  e16.preventDefault();
2635
2695
  const [t4, n3] = [...c.values()], l2 = Math.hypot(n3.x - t4.x, n3.y - t4.y);
2636
- a4(pa(r2 * (l2 / o2), s11, i3));
2696
+ a4(ba(r2 * (l2 / o2), s11, i3));
2637
2697
  }
2638
2698
  }, g2 = (e16) => {
2639
2699
  c.delete(e16.pointerId), c.size < 2 && (o2 = 0);
@@ -2649,26 +2709,26 @@ function ga(e14, t2) {
2649
2709
  i2 && cancelAnimationFrame(i2), s9 == null ? void 0 : s9.disconnect(), a3 == null ? void 0 : a3();
2650
2710
  };
2651
2711
  }
2652
- const fa = { chapters: [] };
2653
- function ma(e14) {
2654
- const o = ref(null), { provides: r2 } = useCapability(qe.id), n2 = computed(() => {
2712
+ const wa = { chapters: [] };
2713
+ function ya(e14) {
2714
+ const o = ref(null), { provides: r2 } = useCapability(We.id), n2 = computed(() => {
2655
2715
  var _a2;
2656
- return ((_a2 = r2.value) == null ? void 0 : _a2.getManifest()) ?? fa;
2716
+ return ((_a2 = r2.value) == null ? void 0 : _a2.getManifest()) ?? wa;
2657
2717
  }), l = computed(() => {
2658
2718
  var _a2;
2659
2719
  return (_a2 = e14.value) == null ? void 0 : _a2.zoom;
2660
- }), { scale: h2, setScale: d2, zoomEnabled: c, minZoom: u, maxZoom: p2 } = ua(n2, l);
2720
+ }), { scale: h2, setScale: d2, zoomEnabled: c, minZoom: u, maxZoom: p2 } = va(n2, l, o);
2661
2721
  return (function(e15, t2) {
2662
2722
  let a3 = null;
2663
2723
  watch([e15, t2], () => {
2664
2724
  a3 == null ? void 0 : a3();
2665
2725
  const s9 = t2.value;
2666
- a3 = ga(e15.value ?? null, { enabled: s9.enabled, getScale: s9.getScale, setScale: s9.setScale, minZoom: s9.minZoom, maxZoom: s9.maxZoom });
2726
+ a3 = Pa(e15.value ?? null, { enabled: s9.enabled, getScale: s9.getScale, setScale: s9.setScale, minZoom: s9.minZoom, maxZoom: s9.maxZoom });
2667
2727
  }, { deep: true, flush: "post" }), onBeforeUnmount(() => a3 == null ? void 0 : a3());
2668
- })(o, computed(() => ({ enabled: c(), getScale: () => h2.value, setScale: d2, minZoom: u(), maxZoom: p2() }))), { hostRef: o, scale: h2, setScale: d2, zoomEnabled: c };
2728
+ })(o, computed(() => ({ enabled: c(), getScale: () => h2.value, setScale: d2, minZoom: u.value, maxZoom: p2.value }))), { hostRef: o, scale: h2, setScale: d2, zoomEnabled: c };
2669
2729
  }
2670
- const va = { kind: "first-wins" };
2671
- function ba(e14, t2, a3) {
2730
+ const Ca = { kind: "first-wins" };
2731
+ function Ia(e14, t2, a3) {
2672
2732
  if (1 === t2.length) return t2[0].chapterId;
2673
2733
  switch (a3.kind) {
2674
2734
  case "first-wins":
@@ -2686,7 +2746,7 @@ function ba(e14, t2, a3) {
2686
2746
  return a3.resolve(e14, t2);
2687
2747
  }
2688
2748
  }
2689
- class Pa {
2749
+ class Ma {
2690
2750
  constructor(e14) {
2691
2751
  this._pages = e14, this._byChapter = /* @__PURE__ */ new Map(), this._byGlobalNumber = /* @__PURE__ */ new Map();
2692
2752
  for (const t2 of e14) {
@@ -2720,8 +2780,8 @@ class Pa {
2720
2780
  return a3 ? this._pages.indexOf(a3) : -1;
2721
2781
  }
2722
2782
  }
2723
- function wa(e14, t2 = va) {
2724
- const a3 = (function(e15, t3 = va) {
2783
+ function Sa(e14, t2 = Ca) {
2784
+ const a3 = (function(e15, t3 = Ca) {
2725
2785
  const a4 = /* @__PURE__ */ new Map();
2726
2786
  for (const i3 of e15.chapters) {
2727
2787
  const [e16, t4] = i3.globalPageRange;
@@ -2731,7 +2791,7 @@ function wa(e14, t2 = va) {
2731
2791
  }
2732
2792
  }
2733
2793
  const s10 = /* @__PURE__ */ new Map();
2734
- for (const [i3, o2] of a4) s10.set(i3, ba(i3, o2, t3));
2794
+ for (const [i3, o2] of a4) s10.set(i3, Ia(i3, o2, t3));
2735
2795
  return s10;
2736
2796
  })(e14, t2), s9 = /* @__PURE__ */ new Map();
2737
2797
  for (const n2 of e14.chapters) s9.set(n2.chapterId, n2);
@@ -2743,14 +2803,14 @@ function wa(e14, t2 = va) {
2743
2803
  const [i3] = t3.globalPageRange, [l] = t3.localPageRange, h2 = l + (n2 - i3);
2744
2804
  o.push({ globalPageIndex: r2++, globalPageNumber: n2, chapterId: e15, localPageIndex: h2 });
2745
2805
  }
2746
- return new Pa(o);
2806
+ return new Ma(o);
2747
2807
  }
2748
- const ya = class e9 extends BasePlugin {
2808
+ const xa = class e9 extends BasePlugin {
2749
2809
  constructor(e14, t2) {
2750
- super(e14, t2), this.statusChange$ = createBehaviorEmitter(), this.manifestChange$ = createEmitter(), this.overlapStrategy = va, this.chapterStatus = /* @__PURE__ */ new Map(), this.chapterLastUsed = /* @__PURE__ */ new Map(), this.passwordAttempts = /* @__PURE__ */ new Map(), this.pendingLoadPromises = /* @__PURE__ */ new Map(), this.unloadTimer = null, this.documentManagerUnsubs = [], this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
2810
+ super(e14, t2), this.statusChange$ = createBehaviorEmitter(), this.manifestChange$ = createEmitter(), this.overlapStrategy = Ca, this.chapterStatus = /* @__PURE__ */ new Map(), this.chapterLastUsed = /* @__PURE__ */ new Map(), this.passwordAttempts = /* @__PURE__ */ new Map(), this.pendingLoadPromises = /* @__PURE__ */ new Map(), this.unloadTimer = null, this.documentManagerUnsubs = [], this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
2751
2811
  }
2752
2812
  async initialize(e14) {
2753
- if (this.config = e14, this.passwordProvider = e14.passwordProvider, this.overlapStrategy = e14.overlapStrategy ?? va, this.documentManagerUnsubs.push(this.documentManager.provides().onDocumentOpened((e15) => {
2813
+ if (this.config = e14, this.passwordProvider = e14.passwordProvider, this.overlapStrategy = e14.overlapStrategy ?? Ca, this.documentManagerUnsubs.push(this.documentManager.provides().onDocumentOpened((e15) => {
2754
2814
  this.isOwnedChapter(e15.id) && (this.passwordAttempts.delete(e15.id), this.updateStatus(e15.id, "loaded"));
2755
2815
  }), this.documentManager.provides().onDocumentClosed((e15) => {
2756
2816
  this.isOwnedChapter(e15) && this.updateStatus(e15, "closed");
@@ -2785,7 +2845,7 @@ const ya = class e9 extends BasePlugin {
2785
2845
  const s9 = new Set(this.chapterStatus.keys()), i2 = new Set(t2.chapters.map((e14) => e14.chapterId));
2786
2846
  for (const e14 of s9) i2.has(e14) || (this.closeChapter(e14), this.chapterStatus.delete(e14));
2787
2847
  for (const e14 of t2.chapters) this.chapterStatus.has(e14.chapterId) || this.chapterStatus.set(e14.chapterId, "idle");
2788
- this.manifest = t2, this.virtualPageMap = wa(t2, this.overlapStrategy), this.manifestChange$.emit({ manifest: t2, map: this.virtualPageMap }), this.eagerPrefetchFromManifest();
2848
+ this.manifest = t2, this.virtualPageMap = Sa(t2, this.overlapStrategy), this.manifestChange$.emit({ manifest: t2, map: this.virtualPageMap }), this.eagerPrefetchFromManifest();
2789
2849
  }
2790
2850
  eagerPrefetchFromManifest() {
2791
2851
  const e14 = this.config.prefetchChapters ?? 0;
@@ -2923,9 +2983,9 @@ const ya = class e9 extends BasePlugin {
2923
2983
  this.chapterStatus.get(e14) !== t2 && (this.chapterStatus.set(e14, t2), this.statusChange$.emit({ chapterId: e14, status: t2, ..."error" === t2 && a3 ? { error: { message: a3 } } : {} }));
2924
2984
  }
2925
2985
  };
2926
- ya.id = "chapter-manager";
2927
- let Ca = ya;
2928
- function Ia(e14, t2) {
2986
+ xa.id = "chapter-manager";
2987
+ let ka = xa;
2988
+ function La(e14, t2) {
2929
2989
  if (e14 === t2) return true;
2930
2990
  if (e14.totalHeight !== t2.totalHeight || e14.totalWidth !== t2.totalWidth || e14.pageGap !== t2.pageGap || e14.items.length !== t2.items.length) return false;
2931
2991
  for (let a3 = 0; a3 < e14.items.length; a3++) {
@@ -2934,9 +2994,9 @@ function Ia(e14, t2) {
2934
2994
  }
2935
2995
  return true;
2936
2996
  }
2937
- const Ma = class extends BasePlugin {
2997
+ const $a = class extends BasePlugin {
2938
2998
  constructor(e14, t2) {
2939
- super(e14, t2), this.layoutChange$ = createBehaviorEmitter(void 0, Ia), 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.chapterManagerUnsubs = [], this.chapterManager = this.registry.getPlugin(Ca.id), this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
2999
+ super(e14, t2), this.layoutChange$ = createBehaviorEmitter(void 0, La), 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.chapterManagerUnsubs = [], this.chapterManager = this.registry.getPlugin(ka.id), this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
2940
3000
  }
2941
3001
  async initialize(e14) {
2942
3002
  this.config = { placeholderPageHeight: e14.placeholderPageHeight ?? 1200, placeholderPageWidth: e14.placeholderPageWidth ?? 900, bufferSize: e14.bufferSize ?? 2, pageGap: e14.pageGap ?? 20 }, this.virtualPageMap = this.chapterManager.provides().getVirtualPageMap(), this.rebuildOffsets(), this.chapterManagerUnsubs.push(this.chapterManager.provides().onManifestChange(({ map: e15 }) => {
@@ -3113,14 +3173,14 @@ const Ma = class extends BasePlugin {
3113
3173
  a3 && this.scrollToIndex(a3.globalPageIndex, t2);
3114
3174
  }
3115
3175
  };
3116
- Ma.id = "chapter-scroll";
3117
- let Sa = Ma;
3118
- const xa = ["data-global-page-index", "data-chapter-id", "data-local-page-index"], ka = /* @__PURE__ */ ((e14, t2) => {
3176
+ $a.id = "chapter-scroll";
3177
+ let Ta = $a;
3178
+ const za = ["data-global-page-index", "data-chapter-id", "data-local-page-index"], Da = /* @__PURE__ */ ((e14, t2) => {
3119
3179
  const a3 = e14.__vccOpts || e14;
3120
3180
  for (const [s9, i2] of t2) a3[s9] = i2;
3121
3181
  return a3;
3122
3182
  })(/* @__PURE__ */ defineComponent({ __name: "ChapterScroller", props: { class: {}, style: {} }, setup(e14) {
3123
- const { provides: t2 } = useCapability(Sa.id), o = ref(null), f = ref(null);
3183
+ const { provides: t2 } = useCapability(Ta.id), o = ref(null), f = ref(null);
3124
3184
  let m = null;
3125
3185
  const v = () => {
3126
3186
  null == m || m(), m = null, t2.value && (t2.value.registerViewport(o.value), m = t2.value.onLayoutChange((e15) => {
@@ -3132,11 +3192,11 @@ const xa = ["data-global-page-index", "data-chapter-id", "data-local-page-index"
3132
3192
  null == m || m(), null == (e15 = t2.value) || e15.registerViewport(null);
3133
3193
  }), watch(t2, v), (e15, t3) => {
3134
3194
  var a3, s9, i2;
3135
- return openBlock(), createElementBlock("div", { ref_key: "containerRef", ref: o, "data-chapter-scroll-viewport": "", class: normalizeClass(e15.$props.class), style: normalizeStyle({ overflow: "auto", position: "relative", width: "100%", height: "100%", ...e15.$props.style }) }, [createElementVNode("div", { style: normalizeStyle({ position: "relative", width: `${(null == (a3 = f.value) ? void 0 : a3.totalWidth) ?? 0}px`, height: `${(null == (s9 = f.value) ? void 0 : s9.totalHeight) ?? 0}px`, margin: "0 auto" }) }, [(openBlock(true), createElementBlock(Fragment, null, renderList((null == (i2 = f.value) ? void 0 : i2.items) ?? [], (a4) => (openBlock(), createElementBlock("div", { key: a4.globalPageIndex, "data-global-page-index": a4.globalPageIndex, "data-chapter-id": a4.chapterId, "data-local-page-index": a4.localPageIndex, style: normalizeStyle({ position: "absolute", top: `${a4.offsetTop}px`, left: "50%", transform: "translateX(-50%)", width: `${a4.width}px`, height: `${a4.height}px`, backgroundColor: a4.isPlaceholder ? "#f3f4f6" : "#fff", boxShadow: "0 1px 4px rgba(0,0,0,0.08)" }) }, [a4.isPlaceholder ? renderSlot(e15.$slots, "placeholder", { key: 0, item: a4 }, () => [t3[0] || (t3[0] = createElementVNode("div", { class: "chapter-scroll-placeholder" }, "Loading chapter…", -1))], true) : renderSlot(e15.$slots, "page", { key: 1, item: a4 }, void 0, true)], 12, xa))), 128))], 4)], 6);
3195
+ return openBlock(), createElementBlock("div", { ref_key: "containerRef", ref: o, "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 == (a3 = f.value) ? void 0 : a3.totalWidth) ?? 0}px`, height: `${(null == (s9 = f.value) ? void 0 : s9.totalHeight) ?? 0}px`, margin: "0 auto" }) }, [(openBlock(true), createElementBlock(Fragment, null, renderList((null == (i2 = f.value) ? void 0 : i2.items) ?? [], (a4) => (openBlock(), createElementBlock("div", { key: a4.globalPageIndex, "data-global-page-index": a4.globalPageIndex, "data-chapter-id": a4.chapterId, "data-local-page-index": a4.localPageIndex, style: normalizeStyle({ position: "absolute", top: `${a4.offsetTop}px`, left: "50%", transform: "translateX(-50%)", width: `${a4.width}px`, height: `${a4.height}px`, backgroundColor: a4.isPlaceholder ? "#f3f4f6" : "#fff", boxShadow: "0 1px 4px rgba(0,0,0,0.08)" }) }, [a4.isPlaceholder ? renderSlot(e15.$slots, "placeholder", { key: 0, item: a4 }, () => [t3[0] || (t3[0] = createElementVNode("div", { class: "chapter-scroll-placeholder" }, "Loading chapter…", -1))], true) : renderSlot(e15.$slots, "page", { key: 1, item: a4 }, void 0, true)], 12, za))), 128))], 4)], 6);
3136
3196
  };
3137
- } }), [["__scopeId", "data-v-8a737137"]]), La = /* @__PURE__ */ defineComponent({ __name: "ChapterRenderLayer", props: { chapterId: {}, localPageIndex: {}, scale: {}, dpr: {}, class: {} }, setup: (e14) => (t2, a3) => (openBlock(), createBlock(unref(RenderLayer), { "document-id": e14.chapterId, "page-index": e14.localPageIndex, scale: e14.scale, dpr: e14.dpr, class: normalizeClass(e14.class), style: { pointerEvents: "none" } }, null, 8, ["document-id", "page-index", "scale", "dpr", "class"])) });
3138
- const $a = { kind: "first-wins" };
3139
- function za(e14, t2, a3) {
3197
+ } }), [["__scopeId", "data-v-e9ab4da3"]]), Oa = /* @__PURE__ */ defineComponent({ __name: "ChapterRenderLayer", props: { chapterId: {}, localPageIndex: {}, scale: {}, dpr: {}, class: {} }, setup: (e14) => (t2, a3) => (openBlock(), createBlock(unref(RenderLayer), { "document-id": e14.chapterId, "page-index": e14.localPageIndex, scale: e14.scale, dpr: e14.dpr, class: normalizeClass(e14.class), style: { pointerEvents: "none" } }, null, 8, ["document-id", "page-index", "scale", "dpr", "class"])) });
3198
+ const Ga = { kind: "first-wins" };
3199
+ function Na(e14, t2, a3) {
3140
3200
  if (1 === t2.length) return t2[0].chapterId;
3141
3201
  switch (a3.kind) {
3142
3202
  case "first-wins":
@@ -3154,7 +3214,7 @@ function za(e14, t2, a3) {
3154
3214
  return a3.resolve(e14, t2);
3155
3215
  }
3156
3216
  }
3157
- let Ta = class {
3217
+ let Aa = class {
3158
3218
  constructor(e14) {
3159
3219
  this._pages = e14, this._byChapter = /* @__PURE__ */ new Map(), this._byGlobalNumber = /* @__PURE__ */ new Map();
3160
3220
  for (const t2 of e14) {
@@ -3188,8 +3248,8 @@ let Ta = class {
3188
3248
  return a3 ? this._pages.indexOf(a3) : -1;
3189
3249
  }
3190
3250
  };
3191
- function Da(e14, t2 = $a) {
3192
- const a3 = (function(e15, t3 = $a) {
3251
+ function Va(e14, t2 = Ga) {
3252
+ const a3 = (function(e15, t3 = Ga) {
3193
3253
  const a4 = /* @__PURE__ */ new Map();
3194
3254
  for (const i3 of e15.chapters) {
3195
3255
  const [e16, t4] = i3.globalPageRange;
@@ -3199,7 +3259,7 @@ function Da(e14, t2 = $a) {
3199
3259
  }
3200
3260
  }
3201
3261
  const s10 = /* @__PURE__ */ new Map();
3202
- for (const [i3, o2] of a4) s10.set(i3, za(i3, o2, t3));
3262
+ for (const [i3, o2] of a4) s10.set(i3, Na(i3, o2, t3));
3203
3263
  return s10;
3204
3264
  })(e14, t2), s9 = /* @__PURE__ */ new Map();
3205
3265
  for (const n2 of e14.chapters) s9.set(n2.chapterId, n2);
@@ -3211,14 +3271,14 @@ function Da(e14, t2 = $a) {
3211
3271
  const [i3] = t3.globalPageRange, [l] = t3.localPageRange, h2 = l + (n2 - i3);
3212
3272
  o.push({ globalPageIndex: r2++, globalPageNumber: n2, chapterId: e15, localPageIndex: h2 });
3213
3273
  }
3214
- return new Ta(o);
3274
+ return new Aa(o);
3215
3275
  }
3216
- const Oa = class e10 extends BasePlugin {
3276
+ const Ea = class e10 extends BasePlugin {
3217
3277
  constructor(e14, t2) {
3218
- super(e14, t2), this.statusChange$ = createBehaviorEmitter(), this.manifestChange$ = createEmitter(), this.overlapStrategy = $a, this.chapterStatus = /* @__PURE__ */ new Map(), this.chapterLastUsed = /* @__PURE__ */ new Map(), this.passwordAttempts = /* @__PURE__ */ new Map(), this.pendingLoadPromises = /* @__PURE__ */ new Map(), this.unloadTimer = null, this.documentManagerUnsubs = [], this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
3278
+ super(e14, t2), this.statusChange$ = createBehaviorEmitter(), this.manifestChange$ = createEmitter(), this.overlapStrategy = Ga, this.chapterStatus = /* @__PURE__ */ new Map(), this.chapterLastUsed = /* @__PURE__ */ new Map(), this.passwordAttempts = /* @__PURE__ */ new Map(), this.pendingLoadPromises = /* @__PURE__ */ new Map(), this.unloadTimer = null, this.documentManagerUnsubs = [], this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
3219
3279
  }
3220
3280
  async initialize(e14) {
3221
- if (this.config = e14, this.passwordProvider = e14.passwordProvider, this.overlapStrategy = e14.overlapStrategy ?? $a, this.documentManagerUnsubs.push(this.documentManager.provides().onDocumentOpened((e15) => {
3281
+ if (this.config = e14, this.passwordProvider = e14.passwordProvider, this.overlapStrategy = e14.overlapStrategy ?? Ga, this.documentManagerUnsubs.push(this.documentManager.provides().onDocumentOpened((e15) => {
3222
3282
  this.isOwnedChapter(e15.id) && (this.passwordAttempts.delete(e15.id), this.updateStatus(e15.id, "loaded"));
3223
3283
  }), this.documentManager.provides().onDocumentClosed((e15) => {
3224
3284
  this.isOwnedChapter(e15) && this.updateStatus(e15, "closed");
@@ -3253,7 +3313,7 @@ const Oa = class e10 extends BasePlugin {
3253
3313
  const s9 = new Set(this.chapterStatus.keys()), i2 = new Set(t2.chapters.map((e14) => e14.chapterId));
3254
3314
  for (const e14 of s9) i2.has(e14) || (this.closeChapter(e14), this.chapterStatus.delete(e14));
3255
3315
  for (const e14 of t2.chapters) this.chapterStatus.has(e14.chapterId) || this.chapterStatus.set(e14.chapterId, "idle");
3256
- this.manifest = t2, this.virtualPageMap = Da(t2, this.overlapStrategy), this.manifestChange$.emit({ manifest: t2, map: this.virtualPageMap }), this.eagerPrefetchFromManifest();
3316
+ this.manifest = t2, this.virtualPageMap = Va(t2, this.overlapStrategy), this.manifestChange$.emit({ manifest: t2, map: this.virtualPageMap }), this.eagerPrefetchFromManifest();
3257
3317
  }
3258
3318
  eagerPrefetchFromManifest() {
3259
3319
  const e14 = this.config.prefetchChapters ?? 0;
@@ -3391,10 +3451,10 @@ const Oa = class e10 extends BasePlugin {
3391
3451
  this.chapterStatus.get(e14) !== t2 && (this.chapterStatus.set(e14, t2), this.statusChange$.emit({ chapterId: e14, status: t2, ..."error" === t2 && a3 ? { error: { message: a3 } } : {} }));
3392
3452
  }
3393
3453
  };
3394
- Oa.id = "chapter-manager";
3395
- let Ga = Oa;
3396
- const Na = { kind: "first-wins" };
3397
- function Aa(e14, t2, a3) {
3454
+ Ea.id = "chapter-manager";
3455
+ let _a = Ea;
3456
+ const Ra = { kind: "first-wins" };
3457
+ function Fa(e14, t2, a3) {
3398
3458
  if (1 === t2.length) return t2[0].chapterId;
3399
3459
  switch (a3.kind) {
3400
3460
  case "first-wins":
@@ -3412,7 +3472,7 @@ function Aa(e14, t2, a3) {
3412
3472
  return a3.resolve(e14, t2);
3413
3473
  }
3414
3474
  }
3415
- class Va {
3475
+ class Ua {
3416
3476
  constructor(e14) {
3417
3477
  this._pages = e14, this._byChapter = /* @__PURE__ */ new Map(), this._byGlobalNumber = /* @__PURE__ */ new Map();
3418
3478
  for (const t2 of e14) {
@@ -3446,8 +3506,8 @@ class Va {
3446
3506
  return a3 ? this._pages.indexOf(a3) : -1;
3447
3507
  }
3448
3508
  }
3449
- function Ea(e14, t2 = Na) {
3450
- const a3 = (function(e15, t3 = Na) {
3509
+ function qa(e14, t2 = Ra) {
3510
+ const a3 = (function(e15, t3 = Ra) {
3451
3511
  const a4 = /* @__PURE__ */ new Map();
3452
3512
  for (const i3 of e15.chapters) {
3453
3513
  const [e16, t4] = i3.globalPageRange;
@@ -3457,7 +3517,7 @@ function Ea(e14, t2 = Na) {
3457
3517
  }
3458
3518
  }
3459
3519
  const s10 = /* @__PURE__ */ new Map();
3460
- for (const [i3, o2] of a4) s10.set(i3, Aa(i3, o2, t3));
3520
+ for (const [i3, o2] of a4) s10.set(i3, Fa(i3, o2, t3));
3461
3521
  return s10;
3462
3522
  })(e14, t2), s9 = /* @__PURE__ */ new Map();
3463
3523
  for (const n2 of e14.chapters) s9.set(n2.chapterId, n2);
@@ -3469,14 +3529,14 @@ function Ea(e14, t2 = Na) {
3469
3529
  const [i3] = t3.globalPageRange, [l] = t3.localPageRange, h2 = l + (n2 - i3);
3470
3530
  o.push({ globalPageIndex: r2++, globalPageNumber: n2, chapterId: e15, localPageIndex: h2 });
3471
3531
  }
3472
- return new Va(o);
3532
+ return new Ua(o);
3473
3533
  }
3474
- const _a = class e11 extends BasePlugin {
3534
+ const Wa = class e11 extends BasePlugin {
3475
3535
  constructor(e14, t2) {
3476
- super(e14, t2), this.statusChange$ = createBehaviorEmitter(), this.manifestChange$ = createEmitter(), this.overlapStrategy = Na, this.chapterStatus = /* @__PURE__ */ new Map(), this.chapterLastUsed = /* @__PURE__ */ new Map(), this.passwordAttempts = /* @__PURE__ */ new Map(), this.pendingLoadPromises = /* @__PURE__ */ new Map(), this.unloadTimer = null, this.documentManagerUnsubs = [], this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
3536
+ super(e14, t2), this.statusChange$ = createBehaviorEmitter(), this.manifestChange$ = createEmitter(), this.overlapStrategy = Ra, this.chapterStatus = /* @__PURE__ */ new Map(), this.chapterLastUsed = /* @__PURE__ */ new Map(), this.passwordAttempts = /* @__PURE__ */ new Map(), this.pendingLoadPromises = /* @__PURE__ */ new Map(), this.unloadTimer = null, this.documentManagerUnsubs = [], this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
3477
3537
  }
3478
3538
  async initialize(e14) {
3479
- if (this.config = e14, this.passwordProvider = e14.passwordProvider, this.overlapStrategy = e14.overlapStrategy ?? Na, this.documentManagerUnsubs.push(this.documentManager.provides().onDocumentOpened((e15) => {
3539
+ if (this.config = e14, this.passwordProvider = e14.passwordProvider, this.overlapStrategy = e14.overlapStrategy ?? Ra, this.documentManagerUnsubs.push(this.documentManager.provides().onDocumentOpened((e15) => {
3480
3540
  this.isOwnedChapter(e15.id) && (this.passwordAttempts.delete(e15.id), this.updateStatus(e15.id, "loaded"));
3481
3541
  }), this.documentManager.provides().onDocumentClosed((e15) => {
3482
3542
  this.isOwnedChapter(e15) && this.updateStatus(e15, "closed");
@@ -3511,7 +3571,7 @@ const _a = class e11 extends BasePlugin {
3511
3571
  const s9 = new Set(this.chapterStatus.keys()), i2 = new Set(t2.chapters.map((e14) => e14.chapterId));
3512
3572
  for (const e14 of s9) i2.has(e14) || (this.closeChapter(e14), this.chapterStatus.delete(e14));
3513
3573
  for (const e14 of t2.chapters) this.chapterStatus.has(e14.chapterId) || this.chapterStatus.set(e14.chapterId, "idle");
3514
- this.manifest = t2, this.virtualPageMap = Ea(t2, this.overlapStrategy), this.manifestChange$.emit({ manifest: t2, map: this.virtualPageMap }), this.eagerPrefetchFromManifest();
3574
+ this.manifest = t2, this.virtualPageMap = qa(t2, this.overlapStrategy), this.manifestChange$.emit({ manifest: t2, map: this.virtualPageMap }), this.eagerPrefetchFromManifest();
3515
3575
  }
3516
3576
  eagerPrefetchFromManifest() {
3517
3577
  const e14 = this.config.prefetchChapters ?? 0;
@@ -3649,9 +3709,9 @@ const _a = class e11 extends BasePlugin {
3649
3709
  this.chapterStatus.get(e14) !== t2 && (this.chapterStatus.set(e14, t2), this.statusChange$.emit({ chapterId: e14, status: t2, ..."error" === t2 && a3 ? { error: { message: a3 } } : {} }));
3650
3710
  }
3651
3711
  };
3652
- _a.id = "chapter-manager";
3653
- let Ra = _a;
3654
- function Fa(e14, t2) {
3712
+ Wa.id = "chapter-manager";
3713
+ let Ha = Wa;
3714
+ function Ba(e14, t2) {
3655
3715
  if (e14 === t2) return true;
3656
3716
  if (e14.totalHeight !== t2.totalHeight || e14.totalWidth !== t2.totalWidth || e14.pageGap !== t2.pageGap || e14.items.length !== t2.items.length) return false;
3657
3717
  for (let a3 = 0; a3 < e14.items.length; a3++) {
@@ -3660,9 +3720,9 @@ function Fa(e14, t2) {
3660
3720
  }
3661
3721
  return true;
3662
3722
  }
3663
- const Ua = class extends BasePlugin {
3723
+ const ja = class extends BasePlugin {
3664
3724
  constructor(e14, t2) {
3665
- super(e14, t2), this.layoutChange$ = createBehaviorEmitter(void 0, Fa), 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.chapterManagerUnsubs = [], this.chapterManager = this.registry.getPlugin(Ra.id), this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
3725
+ super(e14, t2), this.layoutChange$ = createBehaviorEmitter(void 0, Ba), 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.chapterManagerUnsubs = [], this.chapterManager = this.registry.getPlugin(Ha.id), this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
3666
3726
  }
3667
3727
  async initialize(e14) {
3668
3728
  this.config = { placeholderPageHeight: e14.placeholderPageHeight ?? 1200, placeholderPageWidth: e14.placeholderPageWidth ?? 900, bufferSize: e14.bufferSize ?? 2, pageGap: e14.pageGap ?? 20 }, this.virtualPageMap = this.chapterManager.provides().getVirtualPageMap(), this.rebuildOffsets(), this.chapterManagerUnsubs.push(this.chapterManager.provides().onManifestChange(({ map: e15 }) => {
@@ -3839,11 +3899,11 @@ const Ua = class extends BasePlugin {
3839
3899
  a3 && this.scrollToIndex(a3.globalPageIndex, t2);
3840
3900
  }
3841
3901
  };
3842
- Ua.id = "chapter-scroll";
3843
- let qa = Ua;
3844
- const Wa = class e12 extends BasePlugin {
3902
+ ja.id = "chapter-scroll";
3903
+ let Za = ja;
3904
+ const Ya = class e12 extends BasePlugin {
3845
3905
  constructor(e14, t2) {
3846
- super(e14, t2), this.notesChange$ = createBehaviorEmitter([]), this.noteActivated$ = createEmitter(), this.notes = /* @__PURE__ */ new Map(), this.chapterScroll = this.registry.getPlugin(qa.id), this.chapterManager = this.registry.getPlugin(Ga.id), this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
3906
+ super(e14, t2), this.notesChange$ = createBehaviorEmitter([]), this.noteActivated$ = createEmitter(), this.notes = /* @__PURE__ */ new Map(), this.chapterScroll = this.registry.getPlugin(Za.id), this.chapterManager = this.registry.getPlugin(_a.id), this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
3847
3907
  }
3848
3908
  async initialize(t2) {
3849
3909
  if (this.config = t2, t2.callbacks.loadNotes) try {
@@ -3881,7 +3941,7 @@ const Wa = class e12 extends BasePlugin {
3881
3941
  this.notesChange$.emit(this.listAll());
3882
3942
  }
3883
3943
  buildDraft(e14) {
3884
- return { chapterId: e14.chapterId, localPageIndex: e14.localPageIndex, globalPageNumber: e14.globalPageNumber, globalPageIndex: e14.globalPageIndex, rectsPdfCoord: e14.rectsPdfCoord, endAnchor: Ba(e14.rectsPdfCoord), selectedText: e14.selectedText, content: e14.content };
3944
+ return { chapterId: e14.chapterId, localPageIndex: e14.localPageIndex, globalPageNumber: e14.globalPageNumber, globalPageIndex: e14.globalPageIndex, rectsPdfCoord: e14.rectsPdfCoord, endAnchor: Ka(e14.rectsPdfCoord), selectedText: e14.selectedText, content: e14.content };
3885
3945
  }
3886
3946
  async requestCreateFromSelection(e14) {
3887
3947
  if (0 === e14.rectsPdfCoord.length) return null;
@@ -3948,21 +4008,21 @@ const Wa = class e12 extends BasePlugin {
3948
4008
  });
3949
4009
  }
3950
4010
  };
3951
- Wa.id = "note";
3952
- let Ha = Wa;
3953
- function Ba(e14) {
4011
+ Ya.id = "note";
4012
+ let Xa = Ya;
4013
+ function Ka(e14) {
3954
4014
  const t2 = e14[e14.length - 1];
3955
4015
  return { x: t2.origin.x + t2.size.width, y: t2.origin.y + t2.size.height };
3956
4016
  }
3957
- function ja(e14) {
4017
+ function Qa(e14) {
3958
4018
  const { markerPdf: t2, lineRects: a3, sx: s9, sy: i2, cssPageWidth: o, iconSize: r2, gapPx: n2 = 6 } = e14, l = (a3 == null ? void 0 : a3.length) ? a3[a3.length - 1] : void 0;
3959
4019
  let h2, d2;
3960
4020
  l ? (h2 = (l.origin.x + l.size.width) * s9 + n2, d2 = l.origin.y * i2 + (l.size.height * i2 - r2) / 2) : (h2 = t2.x * s9 - r2 / 2, d2 = t2.y * i2 - r2 - n2);
3961
4021
  const c = Math.max(0, o - r2 - 2);
3962
4022
  return h2 > c && (h2 = c), d2 < 0 && (d2 = 0), { left: h2, top: d2 };
3963
4023
  }
3964
- const Za = { key: 0, style: { position: "absolute", inset: "0", pointerEvents: "none", zIndex: 25 } }, Ya = ["onMouseenter"], Ka = ["data-note-marker-zone", "onMouseenter", "onMouseleave"], Xa = ["onClick"], Qa = ["onClick"], Ja = ["onClick"], es = /* @__PURE__ */ defineComponent({ __name: "NoteMarkerLayer", props: { chapterId: {}, localPageIndex: {}, pdfPageWidth: {}, pdfPageHeight: {}, cssPageWidth: {}, cssPageHeight: {}, ui: {} }, setup(e14) {
3965
- const o = e14, { provides: r2 } = useCapability(Ha.id), d2 = ref([]), g2 = ref(null), f = ref(null);
4024
+ const Ja = { key: 0, style: { position: "absolute", inset: "0", pointerEvents: "none", zIndex: 25 } }, es = ["onMouseenter"], ts = ["data-note-marker-zone", "onMouseenter", "onMouseleave"], as = ["onClick"], ss = ["onClick"], is = ["onClick"], os = /* @__PURE__ */ defineComponent({ __name: "NoteMarkerLayer", props: { chapterId: {}, localPageIndex: {}, pdfPageWidth: {}, pdfPageHeight: {}, cssPageWidth: {}, cssPageHeight: {}, ui: {} }, setup(e14) {
4025
+ const o = e14, { provides: r2 } = useCapability(Xa.id), d2 = ref([]), g2 = ref(null), f = ref(null);
3966
4026
  watch(r2, (e15) => {
3967
4027
  if (e15) return e15.onNotesChange((e16) => {
3968
4028
  d2.value = e16.filter((e17) => e17.chapterId === o.chapterId && e17.localPageIndex === o.localPageIndex);
@@ -3986,25 +4046,25 @@ const Za = { key: 0, style: { position: "absolute", inset: "0", pointerEvents: "
3986
4046
  return ((_a2 = o.ui) == null ? void 0 : _a2.highlightColor) ?? "rgba(245, 158, 11, 0.08)";
3987
4047
  });
3988
4048
  function C(e15) {
3989
- const t2 = o.cssPageWidth / o.pdfPageWidth, a3 = o.cssPageHeight / o.pdfPageHeight, s9 = w.value, { left: i2, top: r3 } = ja({ markerPdf: e15.endAnchor, lineRects: e15.rectsPdfCoord, sx: t2, sy: a3, cssPageWidth: o.cssPageWidth, iconSize: s9 }), n2 = (function(e16, t3, a4) {
4049
+ const t2 = o.cssPageWidth / o.pdfPageWidth, a3 = o.cssPageHeight / o.pdfPageHeight, s9 = w.value, { left: i2, top: r3 } = Qa({ markerPdf: e15.endAnchor, lineRects: e15.rectsPdfCoord, sx: t2, sy: a3, cssPageWidth: o.cssPageWidth, iconSize: s9 }), n2 = (function(e16, t3, a4) {
3990
4050
  let s10 = 1 / 0, i3 = 1 / 0, o2 = -1 / 0, r4 = -1 / 0;
3991
4051
  for (const n3 of e16) s10 = Math.min(s10, n3.origin.x * t3), i3 = Math.min(i3, n3.origin.y * a4), o2 = Math.max(o2, (n3.origin.x + n3.size.width) * t3), r4 = Math.max(r4, (n3.origin.y + n3.size.height) * a4);
3992
4052
  return { left: s10, top: i3, width: o2 - s10, height: r4 - i3 };
3993
4053
  })(e15.rectsPdfCoord, t2, a3), l = f.value === e15.noteId ? 72 : 0, h2 = Math.max(0, Math.min(n2.left, i2) - 8), d3 = Math.max(0, Math.min(n2.top, r3) - 8);
3994
4054
  return { zoneLeft: h2, zoneTop: d3, zoneW: Math.min(o.cssPageWidth, Math.max(n2.left + n2.width, i2 + s9) + 8) - h2, zoneH: Math.max(n2.top + n2.height, r3 + s9 + 6 + l) + 8 - d3, iconLeft: i2, iconTop: r3, sx: t2, sy: a3 };
3995
4055
  }
3996
- return (t2, a3) => unref(r2) && d2.value.length && e14.pdfPageWidth && e14.pdfPageHeight ? (openBlock(), createElementBlock("div", Za, [(openBlock(true), createElementBlock(Fragment, null, renderList(d2.value, (e15) => (openBlock(), createElementBlock(Fragment, { key: e15.noteId }, [(openBlock(true), createElementBlock(Fragment, null, renderList(e15.rectsPdfCoord, (t3, a4) => (openBlock(), createElementBlock("div", { key: `${e15.noteId}-bg-${a4}`, style: normalizeStyle({ position: "absolute", left: t3.origin.x * C(e15).sx + "px", top: t3.origin.y * C(e15).sy + "px", width: t3.size.width * C(e15).sx + "px", height: t3.size.height * C(e15).sy + "px", background: y.value, borderRadius: "2px", pointerEvents: "auto" }), onMouseenter: (t4) => g2.value = e15.noteId }, null, 44, Ya))), 128)), g2.value === e15.noteId || f.value === e15.noteId ? (openBlock(), createElementBlock("div", { key: 0, "data-note-marker-zone": e15.noteId, style: normalizeStyle({ position: "absolute", left: `${C(e15).zoneLeft}px`, top: `${C(e15).zoneTop}px`, width: `${C(e15).zoneW}px`, height: `${C(e15).zoneH}px`, pointerEvents: "auto", zIndex: 26 }), onMouseenter: (t3) => g2.value = e15.noteId, onMouseleave: (t3) => f.value !== e15.noteId && (g2.value = null) }, [createElementVNode("button", { type: "button", title: "笔记", style: normalizeStyle({ position: "absolute", left: C(e15).iconLeft - C(e15).zoneLeft + "px", top: C(e15).iconTop - C(e15).zoneTop + "px", width: `${w.value}px`, height: `${w.value}px`, border: "none", borderRadius: "50%", background: "#f59e0b", color: "#fff", cursor: "pointer", fontSize: "11px", padding: 0 }), onMousedown: a3[0] || (a3[0] = withModifiers(() => {
3997
- }, ["stop"])), onClick: withModifiers((t3) => f.value = f.value === e15.noteId ? null : e15.noteId, ["stop"]) }, " 💬 ", 44, Xa), f.value === e15.noteId ? (openBlock(), createElementBlock("div", { key: 0, style: normalizeStyle({ position: "absolute", left: C(e15).iconLeft - C(e15).zoneLeft + "px", top: `${C(e15).iconTop - C(e15).zoneTop + w.value + 4}px`, minWidth: "120px", padding: "6px", borderRadius: "8px", background: "#fff", border: "1px solid #e5e7eb", boxShadow: "0 4px 12px rgba(0,0,0,0.12)", zIndex: 30 }), onMousedown: a3[1] || (a3[1] = withModifiers(() => {
4056
+ return (t2, a3) => unref(r2) && d2.value.length && e14.pdfPageWidth && e14.pdfPageHeight ? (openBlock(), createElementBlock("div", Ja, [(openBlock(true), createElementBlock(Fragment, null, renderList(d2.value, (e15) => (openBlock(), createElementBlock(Fragment, { key: e15.noteId }, [(openBlock(true), createElementBlock(Fragment, null, renderList(e15.rectsPdfCoord, (t3, a4) => (openBlock(), createElementBlock("div", { key: `${e15.noteId}-bg-${a4}`, style: normalizeStyle({ position: "absolute", left: t3.origin.x * C(e15).sx + "px", top: t3.origin.y * C(e15).sy + "px", width: t3.size.width * C(e15).sx + "px", height: t3.size.height * C(e15).sy + "px", background: y.value, borderRadius: "2px", pointerEvents: "auto" }), onMouseenter: (t4) => g2.value = e15.noteId }, null, 44, es))), 128)), g2.value === e15.noteId || f.value === e15.noteId ? (openBlock(), createElementBlock("div", { key: 0, "data-note-marker-zone": e15.noteId, style: normalizeStyle({ position: "absolute", left: `${C(e15).zoneLeft}px`, top: `${C(e15).zoneTop}px`, width: `${C(e15).zoneW}px`, height: `${C(e15).zoneH}px`, pointerEvents: "auto", zIndex: 26 }), onMouseenter: (t3) => g2.value = e15.noteId, onMouseleave: (t3) => f.value !== e15.noteId && (g2.value = null) }, [createElementVNode("button", { type: "button", title: "笔记", style: normalizeStyle({ position: "absolute", left: C(e15).iconLeft - C(e15).zoneLeft + "px", top: C(e15).iconTop - C(e15).zoneTop + "px", width: `${w.value}px`, height: `${w.value}px`, border: "none", borderRadius: "50%", background: "#f59e0b", color: "#fff", cursor: "pointer", fontSize: "11px", padding: 0 }), onMousedown: a3[0] || (a3[0] = withModifiers(() => {
4057
+ }, ["stop"])), onClick: withModifiers((t3) => f.value = f.value === e15.noteId ? null : e15.noteId, ["stop"]) }, " 💬 ", 44, as), f.value === e15.noteId ? (openBlock(), createElementBlock("div", { key: 0, style: normalizeStyle({ position: "absolute", left: C(e15).iconLeft - C(e15).zoneLeft + "px", top: `${C(e15).iconTop - C(e15).zoneTop + w.value + 4}px`, minWidth: "120px", padding: "6px", borderRadius: "8px", background: "#fff", border: "1px solid #e5e7eb", boxShadow: "0 4px 12px rgba(0,0,0,0.12)", zIndex: 30 }), onMousedown: a3[1] || (a3[1] = withModifiers(() => {
3998
4058
  }, ["stop"])) }, [createElementVNode("button", { type: "button", style: { display: "block", width: "100%", padding: "6px 8px", "font-size": "12px", border: "none", "border-radius": "4px", background: "transparent", color: "#334155", cursor: "pointer", "text-align": "left" }, onClick: (t3) => (function(e16) {
3999
4059
  var _a2;
4000
4060
  (_a2 = r2.value) == null ? void 0 : _a2.requestEditNote(e16.noteId, e16);
4001
- })(e15) }, " 编辑 ", 8, Qa), createElementVNode("button", { type: "button", style: { display: "block", width: "100%", padding: "6px 8px", "font-size": "12px", border: "none", "border-radius": "4px", background: "transparent", color: "#dc2626", cursor: "pointer", "text-align": "left" }, onClick: (t3) => {
4061
+ })(e15) }, " 编辑 ", 8, ss), createElementVNode("button", { type: "button", style: { display: "block", width: "100%", padding: "6px 8px", "font-size": "12px", border: "none", "border-radius": "4px", background: "transparent", color: "#dc2626", cursor: "pointer", "text-align": "left" }, onClick: (t3) => {
4002
4062
  var _a2;
4003
4063
  return a4 = e15.noteId, (_a2 = r2.value) == null ? void 0 : _a2.requestDeleteNote(a4), void (f.value = null);
4004
4064
  var a4;
4005
- } }, " 删除 ", 8, Ja)], 36)) : createCommentVNode("", true)], 44, Ka)) : createCommentVNode("", true)], 64))), 128))])) : createCommentVNode("", true);
4006
- } }), ts = { key: 0, style: { position: "absolute", inset: "0", pointerEvents: "none" } }, as = ["title", "onClick"], ss = ["onClick"], is = /* @__PURE__ */ defineComponent({ __name: "BookmarkMarkerLayer", props: { chapterId: {}, localPageIndex: {}, pdfPageWidth: {}, pdfPageHeight: {}, cssPageWidth: {}, cssPageHeight: {}, ui: {} }, setup(e14) {
4007
- const o = e14, { provides: r2 } = useCapability(Zt.id), d2 = ref([]), g2 = ref(null), f = ref(null);
4065
+ } }, " 删除 ", 8, is)], 36)) : createCommentVNode("", true)], 44, ts)) : createCommentVNode("", true)], 64))), 128))])) : createCommentVNode("", true);
4066
+ } }), rs = { key: 0, style: { position: "absolute", inset: "0", pointerEvents: "none" } }, ns = ["title", "onClick"], ls = ["onClick"], hs = /* @__PURE__ */ defineComponent({ __name: "BookmarkMarkerLayer", props: { chapterId: {}, localPageIndex: {}, pdfPageWidth: {}, pdfPageHeight: {}, cssPageWidth: {}, cssPageHeight: {}, ui: {} }, setup(e14) {
4067
+ const o = e14, { provides: r2 } = useCapability(Yt.id), d2 = ref([]), g2 = ref(null), f = ref(null);
4008
4068
  function P() {
4009
4069
  const e15 = r2.value;
4010
4070
  e15 && (d2.value = e15.listBookmarks().filter((e16) => e16.anchor.chapterId === o.chapterId && e16.anchor.localPageIndex === o.localPageIndex));
@@ -4029,27 +4089,27 @@ const Za = { key: 0, style: { position: "absolute", inset: "0", pointerEvents: "
4029
4089
  const { left: t2, top: a3 } = (function(e16) {
4030
4090
  var _a2;
4031
4091
  const t3 = o.cssPageWidth / o.pdfPageWidth, a4 = o.cssPageHeight / o.pdfPageHeight, s9 = ((_a2 = e16.anchor.rectsPdfCoord) == null ? void 0 : _a2.length) ? e16.anchor.rectsPdfCoord : [e16.anchor.rectPdfCoord];
4032
- return ja({ markerPdf: e16.anchor.markerAnchor ?? { x: e16.anchor.rectPdfCoord.origin.x + e16.anchor.rectPdfCoord.size.width, y: e16.anchor.rectPdfCoord.origin.y + e16.anchor.rectPdfCoord.size.height }, lineRects: s9, sx: t3, sy: a4, cssPageWidth: o.cssPageWidth, iconSize: y.value });
4092
+ return Qa({ markerPdf: e16.anchor.markerAnchor ?? { x: e16.anchor.rectPdfCoord.origin.x + e16.anchor.rectPdfCoord.size.width, y: e16.anchor.rectPdfCoord.origin.y + e16.anchor.rectPdfCoord.size.height }, lineRects: s9, sx: t3, sy: a4, cssPageWidth: o.cssPageWidth, iconSize: y.value });
4033
4093
  })(e15);
4034
4094
  return { position: "absolute", left: `${Math.max(0, t2 - 6)}px`, top: `${Math.max(0, a3 - 6)}px`, width: `${y.value + 12}px`, height: `${y.value + 12}px`, pointerEvents: "auto", zIndex: 20 };
4035
4095
  }
4036
- return (t2, a3) => unref(r2) && d2.value.length && e14.pdfPageWidth && e14.pdfPageHeight ? (openBlock(), createElementBlock("div", ts, [(openBlock(true), createElementBlock(Fragment, null, renderList(d2.value, (e15) => (openBlock(), createElementBlock("div", { key: e15.id, style: normalizeStyle(C(e15)), onMousedown: a3[1] || (a3[1] = withModifiers(() => {
4037
- }, ["stop"])) }, [createElementVNode("button", { type: "button", title: e15.label, style: normalizeStyle({ position: "absolute", left: "6px", top: "6px", width: `${y.value}px`, height: `${y.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, as), g2.value === e15.id ? (openBlock(), createElementBlock("div", { key: 0, ref_for: true, ref_key: "deleteMenuRef", ref: f, 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: a3[0] || (a3[0] = withModifiers(() => {
4096
+ return (t2, a3) => unref(r2) && d2.value.length && e14.pdfPageWidth && e14.pdfPageHeight ? (openBlock(), createElementBlock("div", rs, [(openBlock(true), createElementBlock(Fragment, null, renderList(d2.value, (e15) => (openBlock(), createElementBlock("div", { key: e15.id, style: normalizeStyle(C(e15)), onMousedown: a3[1] || (a3[1] = withModifiers(() => {
4097
+ }, ["stop"])) }, [createElementVNode("button", { type: "button", title: e15.label, style: normalizeStyle({ position: "absolute", left: "6px", top: "6px", width: `${y.value}px`, height: `${y.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, ns), g2.value === e15.id ? (openBlock(), createElementBlock("div", { key: 0, ref_for: true, ref_key: "deleteMenuRef", ref: f, 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: a3[0] || (a3[0] = withModifiers(() => {
4038
4098
  }, ["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) {
4039
4099
  const t4 = r2.value;
4040
4100
  if (!t4) return;
4041
4101
  await t4.requestRemoveBookmark(e16) && (g2.value = null);
4042
- })(e15.id) }, " 删除书签 ", 8, ss)], 512)) : createCommentVNode("", true)], 36))), 128))])) : createCommentVNode("", true);
4102
+ })(e15.id) }, " 删除书签 ", 8, ls)], 512)) : createCommentVNode("", true)], 36))), 128))])) : createCommentVNode("", true);
4043
4103
  } });
4044
- function os(e14) {
4104
+ function ds(e14) {
4045
4105
  return e14.chapterId;
4046
4106
  }
4047
- function rs(e14, t2) {
4107
+ function cs(e14, t2) {
4048
4108
  e14.wait(t2, () => {
4049
4109
  });
4050
4110
  }
4051
- const ns = { display: "flex", alignItems: "center", justifyContent: "center", padding: "4px 8px", borderRadius: "8px", background: "#ffffff", border: "1px solid rgba(15, 23, 42, 0.08)", boxShadow: "0 4px 6px -1px rgba(15, 23, 42, 0.08), 0 10px 24px -4px rgba(15, 23, 42, 0.12)" }, ls = { padding: "6px 12px", fontSize: "12px", fontWeight: "500", border: "none", borderRadius: "6px", background: "transparent", color: "#dc2626", cursor: "pointer" };
4052
- function hs(e14, a3) {
4111
+ const us = { display: "flex", alignItems: "center", justifyContent: "center", padding: "4px 8px", borderRadius: "8px", background: "#ffffff", border: "1px solid rgba(15, 23, 42, 0.08)", boxShadow: "0 4px 6px -1px rgba(15, 23, 42, 0.08), 0 10px 24px -4px rgba(15, 23, 42, 0.12)" }, ps = { padding: "6px 12px", fontSize: "12px", fontWeight: "500", border: "none", borderRadius: "6px", background: "transparent", color: "#dc2626", cursor: "pointer" };
4112
+ function gs(e14, a3) {
4053
4113
  var _a2, _b;
4054
4114
  const { provides: s9 } = useAnnotationCapability(), i2 = (_a2 = a3 == null ? void 0 : a3.markup) == null ? void 0 : _a2.annotationMenu, o = false !== ((_b = a3 == null ? void 0 : a3.markup) == null ? void 0 : _b.enabled), r2 = false !== (i2 == null ? void 0 : i2.enabled);
4055
4115
  return computed(() => {
@@ -4058,17 +4118,17 @@ function hs(e14, a3) {
4058
4118
  const { context: a4, rect: o2, placement: r3, menuWrapperProps: n2, selected: l } = e15;
4059
4119
  if (!l || "annotation" !== a4.type) return h$1("span", n2);
4060
4120
  if (a4.structurallyLocked) return h$1("span", n2);
4061
- if (h2 = a4.annotation.object.type, !xe.has(h2)) return h$1("span", n2);
4121
+ if (h2 = a4.annotation.object.type, !ke.has(h2)) return h$1("span", n2);
4062
4122
  var h2;
4063
4123
  const d2 = s9.value.forDocument(t2), { pageIndex: c, id: u } = a4.annotation.object, p2 = () => {
4064
4124
  d2 == null ? void 0 : d2.deleteAnnotation(c, u);
4065
- }, g2 = { position: "absolute", pointerEvents: "auto", left: "50%", transform: "translateX(-50%)", top: (r3 == null ? void 0 : r3.suggestTop) ? void 0 : `${o2.size.height + 8}px`, bottom: (r3 == null ? void 0 : r3.suggestTop) ? `${o2.size.height + 8}px` : void 0 }, f = (i2 == null ? void 0 : i2.renderMenu) ? i2.renderMenu({ pageIndex: c, annotationId: u, onDelete: p2 }) : h$1("button", { type: "button", style: ls, onClick: p2 }, "删除");
4066
- return h$1("div", n2, [h$1("div", { style: g2 }, [h$1("div", { style: ns, role: "toolbar", "aria-label": "划线标注" }, [f])])]);
4125
+ }, g2 = { position: "absolute", pointerEvents: "auto", left: "50%", transform: "translateX(-50%)", top: (r3 == null ? void 0 : r3.suggestTop) ? void 0 : `${o2.size.height + 8}px`, bottom: (r3 == null ? void 0 : r3.suggestTop) ? `${o2.size.height + 8}px` : void 0 }, f = (i2 == null ? void 0 : i2.renderMenu) ? i2.renderMenu({ pageIndex: c, annotationId: u, onDelete: p2 }) : h$1("button", { type: "button", style: ps, onClick: p2 }, "删除");
4126
+ return h$1("div", n2, [h$1("div", { style: g2 }, [h$1("div", { style: us, role: "toolbar", "aria-label": "划线标注" }, [f])])]);
4067
4127
  };
4068
4128
  });
4069
4129
  }
4070
- const ds = /* @__PURE__ */ defineComponent({ __name: "ChapterPageSurface", props: { item: {}, features: {}, showNoteMarkers: { type: Boolean }, showBookmarkMarkers: { type: Boolean }, showRedactionLayer: { type: Boolean }, noteMarkerUi: {}, bookmarkMarkerUi: {}, buildSelectionMenu: { type: Function }, createNote: {}, annotationSelectionMenu: {}, redactionSelectionMenu: {}, renderPageOverlay: { type: Function } }, setup(e14) {
4071
- const a3 = e14, i2 = computed(() => os(a3.item));
4130
+ const fs = /* @__PURE__ */ defineComponent({ __name: "ChapterPageSurface", props: { item: {}, features: {}, showNoteMarkers: { type: Boolean }, showBookmarkMarkers: { type: Boolean }, showRedactionLayer: { type: Boolean }, noteMarkerUi: {}, bookmarkMarkerUi: {}, buildSelectionMenu: { type: Function }, createNote: {}, annotationSelectionMenu: {}, redactionSelectionMenu: {}, renderPageOverlay: { type: Function } }, setup(e14) {
4131
+ const a3 = e14, i2 = computed(() => ds(a3.item));
4072
4132
  !(function(e15) {
4073
4133
  const { provides: t2 } = useCapability(DocumentManagerPlugin.id);
4074
4134
  watch([t2, e15], ([e16, t3]) => {
@@ -4080,14 +4140,15 @@ const ds = /* @__PURE__ */ defineComponent({ __name: "ChapterPageSurface", props
4080
4140
  return (_b = (_a2 = o.value) == null ? void 0 : _a2.getDocument(i2.value)) == null ? void 0 : _b.pages[a3.item.localPageIndex];
4081
4141
  });
4082
4142
  function d2(e15, t2) {
4143
+ var _a2, _b, _c, _d;
4083
4144
  const s9 = a3.createNote.value;
4084
- if (s9) return (a4) => {
4085
- var _a2;
4086
- const i3 = { position: "absolute", pointerEvents: "auto", left: "50%", transform: "translateX(-50%)", top: ((_a2 = a4.placement) == null ? void 0 : _a2.suggestTop) ? -40 : a4.rect.size.height + 8 };
4145
+ if (s9 && false !== ((_b = (_a2 = a3.features) == null ? void 0 : _a2.notes) == null ? void 0 : _b.enabled) && false !== ((_d = (_c = a3.features) == null ? void 0 : _c.selectionToolbar) == null ? void 0 : _d.enabled)) return (a4) => {
4146
+ var _a3;
4147
+ const i3 = { position: "absolute", pointerEvents: "auto", left: "50%", transform: "translateX(-50%)", top: ((_a3 = a4.placement) == null ? void 0 : _a3.suggestTop) ? -40 : a4.rect.size.height + 8 };
4087
4148
  return h$1("div", a4.menuWrapperProps, [h$1("div", { style: i3 }, h$1("button", { type: "button", style: { padding: "6px 10px", fontSize: "12px", border: "1px solid #e2e8f0", borderRadius: "6px", background: "#fff", cursor: "pointer" }, onClick: () => {
4088
4149
  if (!r2.value) return;
4089
4150
  const a5 = r2.value.getHighlightRectsForPage(e15.localPageIndex, t2);
4090
- rs(r2.value.getSelectedText(t2), (t3) => {
4151
+ cs(r2.value.getSelectedText(t2), (t3) => {
4091
4152
  s9((function(e16, t4, a6) {
4092
4153
  return { chapterId: e16.chapterId, localPageIndex: e16.localPageIndex, globalPageIndex: e16.globalPageIndex, globalPageNumber: e16.globalPageNumber, rectsPdfCoord: t4, selectedText: a6 };
4093
4154
  })(e15, a5, t3.join("\n")));
@@ -4102,7 +4163,7 @@ const ds = /* @__PURE__ */ defineComponent({ __name: "ChapterPageSurface", props
4102
4163
  if (a4) return a4;
4103
4164
  }
4104
4165
  return t2.defaultMenu;
4105
- }), u = hs(i2, a3.features), p2 = computed(() => (function(e15, t2) {
4166
+ }), u = gs(i2, a3.features), p2 = computed(() => (function(e15, t2) {
4106
4167
  if (e15 || t2) return (a4) => {
4107
4168
  if (e15) {
4108
4169
  const t3 = e15(a4);
@@ -4114,10 +4175,10 @@ const ds = /* @__PURE__ */ defineComponent({ __name: "ChapterPageSurface", props
4114
4175
  var _a2;
4115
4176
  return (_a2 = a3.renderPageOverlay) == null ? void 0 : _a2.call(a3, a3.item);
4116
4177
  });
4117
- return (t2, a4) => e14.item.isPlaceholder ? createCommentVNode("", true) : (openBlock(), createBlock(unref(GlobalPointerProvider), { key: 0, "document-id": i2.value }, { default: withCtx(() => [createVNode(unref(Rotate), { "document-id": i2.value, "page-index": e14.item.localPageIndex, style: { backgroundColor: "#fff" } }, { default: withCtx(() => [createVNode(unref(PagePointerProvider), { "document-id": i2.value, "page-index": e14.item.localPageIndex, style: normalizeStyle(unref(Pe$1)), onPointerdown: unref(we$1) }, { default: withCtx(() => [createVNode(unref(La), { "chapter-id": i2.value, "local-page-index": e14.item.localPageIndex }, null, 8, ["chapter-id", "local-page-index"]), createVNode(unref(SelectionLayer), { "document-id": i2.value, "page-index": e14.item.localPageIndex, "selection-menu": c.value }, null, 8, ["document-id", "page-index", "selection-menu"]), e14.showRedactionLayer ? (openBlock(), createBlock(unref(RedactionLayer), { key: 0, "document-id": i2.value, "page-index": e14.item.localPageIndex, "selection-menu": e14.redactionSelectionMenu }, null, 8, ["document-id", "page-index", "selection-menu"])) : createCommentVNode("", true), createVNode(unref(AnnotationLayer), { "document-id": i2.value, "page-index": e14.item.localPageIndex, "selection-menu": p2.value }, null, 8, ["document-id", "page-index", "selection-menu"]), e14.showBookmarkMarkers && l.value ? (openBlock(), createBlock(is, { key: 1, "chapter-id": i2.value, "local-page-index": e14.item.localPageIndex, "pdf-page-width": l.value.size.width, "pdf-page-height": l.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), v.value ? (openBlock(), createBlock(resolveDynamicComponent(v.value), { key: 2 })) : createCommentVNode("", true), e14.showNoteMarkers && l.value ? (openBlock(), createBlock(es, { key: 3, "chapter-id": i2.value, "local-page-index": e14.item.localPageIndex, "pdf-page-width": l.value.size.width, "pdf-page-height": l.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"]));
4178
+ return (t2, a4) => e14.item.isPlaceholder ? createCommentVNode("", true) : (openBlock(), createBlock(unref(GlobalPointerProvider), { key: 0, "document-id": i2.value }, { default: withCtx(() => [createVNode(unref(Rotate), { "document-id": i2.value, "page-index": e14.item.localPageIndex, style: { backgroundColor: "#fff" } }, { default: withCtx(() => [createVNode(unref(PagePointerProvider), { "document-id": i2.value, "page-index": e14.item.localPageIndex, style: normalizeStyle(unref(Pe$1)), onPointerdown: unref(we$1) }, { default: withCtx(() => [createVNode(unref(Oa), { "chapter-id": i2.value, "local-page-index": e14.item.localPageIndex }, null, 8, ["chapter-id", "local-page-index"]), createVNode(unref(SelectionLayer), { "document-id": i2.value, "page-index": e14.item.localPageIndex, "selection-menu": c.value }, null, 8, ["document-id", "page-index", "selection-menu"]), e14.showRedactionLayer ? (openBlock(), createBlock(unref(RedactionLayer), { key: 0, "document-id": i2.value, "page-index": e14.item.localPageIndex, "selection-menu": e14.redactionSelectionMenu }, null, 8, ["document-id", "page-index", "selection-menu"])) : createCommentVNode("", true), createVNode(unref(AnnotationLayer), { "document-id": i2.value, "page-index": e14.item.localPageIndex, "selection-menu": p2.value }, null, 8, ["document-id", "page-index", "selection-menu"]), e14.showBookmarkMarkers && l.value ? (openBlock(), createBlock(hs, { key: 1, "chapter-id": i2.value, "local-page-index": e14.item.localPageIndex, "pdf-page-width": l.value.size.width, "pdf-page-height": l.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), v.value ? (openBlock(), createBlock(resolveDynamicComponent(v.value), { key: 2 })) : createCommentVNode("", true), e14.showNoteMarkers && l.value ? (openBlock(), createBlock(os, { key: 3, "chapter-id": i2.value, "local-page-index": e14.item.localPageIndex, "pdf-page-width": l.value.size.width, "pdf-page-height": l.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"]));
4118
4179
  } });
4119
- const cs = /* @__PURE__ */ defineComponent({ __name: "HoverBookmarkLayer", props: { item: {}, pdfPageWidth: {}, pdfPageHeight: {}, cssPageWidth: {}, cssPageHeight: {}, hoverUi: {} }, setup(e14) {
4120
- const o = e14, r2 = computed(() => os(o.item)), { provides: d2 } = useCapability(SelectionPlugin.id), { provides: u } = useCapability(Zt.id), p2 = ref(null), g2 = ref(null), f = ref(null), P = ref(null), w = computed(() => {
4180
+ const ms = /* @__PURE__ */ defineComponent({ __name: "HoverBookmarkLayer", props: { item: {}, pdfPageWidth: {}, pdfPageHeight: {}, cssPageWidth: {}, cssPageHeight: {}, hoverUi: {} }, setup(e14) {
4181
+ const o = e14, r2 = computed(() => ds(o.item)), { provides: d2 } = useCapability(SelectionPlugin.id), { provides: u } = useCapability(Yt.id), p2 = ref(null), g2 = ref(null), f = ref(null), P = ref(null), w = computed(() => {
4121
4182
  var _a2;
4122
4183
  return ((_a2 = o.hoverUi) == null ? void 0 : _a2.iconSize) ?? 16;
4123
4184
  }), y = computed(() => P.value ?? f.value);
@@ -4174,16 +4235,16 @@ const cs = /* @__PURE__ */ defineComponent({ __name: "HoverBookmarkLayer", props
4174
4235
  });
4175
4236
  const k2 = computed(() => {
4176
4237
  const e15 = y.value;
4177
- return (e15 == null ? void 0 : e15.length) ? Ht$1(o.item.chapterId, o.item.localPageIndex, e15, { globalPageIndex: o.item.globalPageIndex, globalPageNumber: o.item.globalPageNumber }) : null;
4238
+ return (e15 == null ? void 0 : e15.length) ? Bt$1(o.item.chapterId, o.item.localPageIndex, e15, { globalPageIndex: o.item.globalPageIndex, globalPageNumber: o.item.globalPageNumber }) : null;
4178
4239
  }), L2 = computed(() => {
4179
4240
  const e15 = k2.value, t2 = u.value;
4180
- return !(!e15 || !t2) && t2.listBookmarks().some((t3) => Wt(t3.anchor, e15));
4241
+ return !(!e15 || !t2) && t2.listBookmarks().some((t3) => Ht$1(t3.anchor, e15));
4181
4242
  });
4182
4243
  function $2() {
4183
4244
  const e15 = u.value, t2 = k2.value;
4184
4245
  e15 && t2 && !L2.value && (e15.addBookmark({ label: `书签 ${/* @__PURE__ */ (/* @__PURE__ */ new Date()).toLocaleTimeString("zh-CN", { hour: "2-digit", minute: "2-digit" })}`, anchor: t2 }), f.value = null, P.value = null);
4185
4246
  }
4186
- const z = computed(() => {
4247
+ const T2 = computed(() => {
4187
4248
  const e15 = y.value, t2 = e15 == null ? void 0 : e15[e15.length - 1];
4188
4249
  if (!t2 || !o.pdfPageWidth) return null;
4189
4250
  const a3 = o.cssPageWidth / o.pdfPageWidth, s9 = o.cssPageHeight / o.pdfPageHeight, i2 = w.value;
@@ -4191,46 +4252,49 @@ const cs = /* @__PURE__ */ defineComponent({ __name: "HoverBookmarkLayer", props
4191
4252
  });
4192
4253
  return (t2, a3) => {
4193
4254
  var _a2;
4194
- return unref(u) && e14.pdfPageWidth && e14.pdfPageHeight ? (openBlock(), createElementBlock("div", { key: 0, ref_key: "rootRef", ref: p2, style: { position: "absolute", inset: "0", zIndex: 14, pointerEvents: "none" } }, [z.value && y.value && !L2.value ? (openBlock(), createElementBlock("div", { key: 0, style: normalizeStyle({ position: "absolute", left: `${z.value.zoneLeft}px`, top: `${z.value.zoneTop}px`, width: `${z.value.size + 20}px`, height: `${(((_a2 = y.value[y.value.length - 1]) == null ? void 0 : _a2.size.height) ?? 0) * (e14.cssPageHeight / e14.pdfPageHeight) + z.value.size + 12}px`, pointerEvents: "auto" }), onMouseenter: a3[0] || (a3[0] = (e15) => P.value = y.value), onMouseleave: a3[1] || (a3[1] = (e15) => P.value = null) }, [createElementVNode("button", { type: "button", title: "添加书签", style: normalizeStyle({ position: "absolute", left: z.value.iconLeft - z.value.zoneLeft + "px", top: z.value.iconTop - z.value.zoneTop + "px", width: `${z.value.size}px`, height: `${z.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($2, ["stop"]) }, " 🔖 ", 4)], 36)) : createCommentVNode("", true)], 512)) : createCommentVNode("", true);
4255
+ return unref(u) && e14.pdfPageWidth && e14.pdfPageHeight ? (openBlock(), createElementBlock("div", { key: 0, ref_key: "rootRef", ref: p2, style: { position: "absolute", inset: "0", zIndex: 14, pointerEvents: "none" } }, [T2.value && y.value && !L2.value ? (openBlock(), createElementBlock("div", { key: 0, style: normalizeStyle({ position: "absolute", left: `${T2.value.zoneLeft}px`, top: `${T2.value.zoneTop}px`, width: `${T2.value.size + 20}px`, height: `${(((_a2 = y.value[y.value.length - 1]) == null ? void 0 : _a2.size.height) ?? 0) * (e14.cssPageHeight / e14.pdfPageHeight) + T2.value.size + 12}px`, pointerEvents: "auto" }), onMouseenter: a3[0] || (a3[0] = (e15) => P.value = y.value), onMouseleave: a3[1] || (a3[1] = (e15) => P.value = null) }, [createElementVNode("button", { type: "button", title: "添加书签", style: normalizeStyle({ position: "absolute", left: T2.value.iconLeft - T2.value.zoneLeft + "px", top: T2.value.iconTop - T2.value.zoneTop + "px", width: `${T2.value.size}px`, height: `${T2.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($2, ["stop"]) }, " 🔖 ", 4)], 36)) : createCommentVNode("", true)], 512)) : createCommentVNode("", true);
4195
4256
  };
4196
- } }), us = { key: 0, width: "24", height: "24", viewBox: "0 0 28 28", fill: "none", "aria-hidden": "" }, ps = { key: 0, x: "5", y: "4", width: "18", height: "20", rx: "3", fill: "#fde047" }, gs = { key: 1, d: "M6 22h16", stroke: "#dc2626", "stroke-width": "2.2", "stroke-linecap": "round" }, fs = { 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" }, ms = { key: 3, d: "M5 14h18", stroke: "#dc2626", "stroke-width": "2.2", "stroke-linecap": "round" }, vs = { key: 1, width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", "aria-hidden": "" }, bs = /* @__PURE__ */ defineComponent({ __name: "SelectionToolbarIcons", props: { kind: {} }, setup: (e14) => (t2, a3) => "note" !== e14.kind ? (openBlock(), createElementBlock("svg", us, ["highlight" === e14.kind ? (openBlock(), createElementBlock("rect", ps)) : createCommentVNode("", true), a3[0] || (a3[0] = 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", gs)) : "squiggly" === e14.kind ? (openBlock(), createElementBlock("path", fs)) : "strikeout" === e14.kind ? (openBlock(), createElementBlock("path", ms)) : createCommentVNode("", true)])) : (openBlock(), createElementBlock("svg", vs, [...a3[1] || (a3[1] = [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)])])) }), Ps = ["title", "aria-label", "onMouseenter", "onClick"], ws = ["title", "onMouseenter", "onClick"], ys = { style: { "font-size": "11px", "font-weight": "600" } }, Cs = /* @__PURE__ */ defineComponent({ __name: "SelectionToolbarCard", props: { placementAbove: { type: Boolean }, anchorHeight: {}, hiddenBuiltinActions: {}, extraActions: {} }, emits: ["action"], setup(e14, { emit: s9 }) {
4257
+ } }), vs = { key: 0, width: "24", height: "24", viewBox: "0 0 28 28", fill: "none", "aria-hidden": "" }, bs = { key: 0, x: "5", y: "4", width: "18", height: "20", rx: "3", fill: "#fde047" }, Ps = { key: 1, d: "M6 22h16", stroke: "#dc2626", "stroke-width": "2.2", "stroke-linecap": "round" }, ws = { 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" }, ys = { key: 3, d: "M5 14h18", stroke: "#dc2626", "stroke-width": "2.2", "stroke-linecap": "round" }, Cs = { key: 1, width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", "aria-hidden": "" }, Is = /* @__PURE__ */ defineComponent({ __name: "SelectionToolbarIcons", props: { kind: {} }, setup: (e14) => (t2, a3) => "note" !== e14.kind ? (openBlock(), createElementBlock("svg", vs, ["highlight" === e14.kind ? (openBlock(), createElementBlock("rect", bs)) : createCommentVNode("", true), a3[0] || (a3[0] = 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", Ps)) : "squiggly" === e14.kind ? (openBlock(), createElementBlock("path", ws)) : "strikeout" === e14.kind ? (openBlock(), createElementBlock("path", ys)) : createCommentVNode("", true)])) : (openBlock(), createElementBlock("svg", Cs, [...a3[1] || (a3[1] = [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)])])) }), Ms = ["title", "aria-label", "onMouseenter", "onClick"], Ss = ["title", "onMouseenter", "onClick"], xs = { style: { "font-size": "11px", "font-weight": "600" } }, ks = /* @__PURE__ */ defineComponent({ __name: "SelectionToolbarCard", props: { placementAbove: { type: Boolean }, anchorHeight: {}, hiddenBuiltinActions: {}, extraActions: {} }, emits: ["action"], setup(e14, { emit: s9 }) {
4197
4258
  const i2 = e14, o = s9, r2 = [{ id: "highlight", label: "高亮背景" }, { id: "underline", label: "下划线" }, { id: "squiggly", label: "波浪线" }, { id: "strikeout", label: "删除线" }, { id: "note", label: "添加笔记" }], d2 = computed(() => new Set(i2.hiddenBuiltinActions ?? [])), g2 = computed(() => r2.filter((e15) => "note" !== e15.id && !d2.value.has(e15.id))), f = computed(() => !d2.value.has("note")), m = computed(() => [...i2.extraActions ?? []].sort((e15, t2) => (e15.order ?? 0) - (t2.order ?? 0))), v = ref(null), P = computed(() => ({ position: "absolute", pointerEvents: "auto", left: "50%", transform: "translateX(-50%)", top: i2.placementAbove ? void 0 : `${i2.anchorHeight + 10}px`, bottom: i2.placementAbove ? `${i2.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)" }));
4198
4259
  function w(e15, t2 = false) {
4199
4260
  return { display: "flex", alignItems: "center", justifyContent: "center", width: "32px", height: "32px", padding: 0, margin: 0, border: "none", borderRadius: "8px", background: v.value === e15 ? t2 ? "#fffbeb" : "#f1f5f9" : "transparent", color: t2 ? "#b45309" : "#334155", cursor: "pointer", flexShrink: 0, WebkitAppearance: "none", appearance: "none" };
4200
4261
  }
4201
4262
  const C = { width: "1px", height: "20px", margin: "0 4px", background: "rgba(15, 23, 42, 0.1)", flexShrink: 0 };
4202
- return (e15, t2) => (openBlock(), createElementBlock("div", { role: "toolbar", "aria-label": "选区工具", style: normalizeStyle(P.value) }, [(openBlock(true), createElementBlock(Fragment, null, renderList(g2.value, (e16) => (openBlock(), createElementBlock("button", { key: e16.id, type: "button", title: e16.label, "aria-label": e16.label, style: normalizeStyle(w(e16.id)), onMouseenter: (t3) => v.value = e16.id, onMouseleave: t2[0] || (t2[0] = (e17) => v.value = null), onClick: (t3) => o("action", e16.id) }, [createVNode(bs, { kind: e16.id }, null, 8, ["kind"])], 44, Ps))), 128)), (openBlock(true), createElementBlock(Fragment, null, renderList(m.value, (e16) => (openBlock(), createElementBlock("button", { key: e16.id, type: "button", title: e16.label, style: normalizeStyle(w(e16.id)), onMouseenter: (t3) => v.value = e16.id, onMouseleave: t2[1] || (t2[1] = (e17) => v.value = null), onClick: (t3) => o("action", e16.id) }, [createElementVNode("span", ys, toDisplayString(e16.label.slice(0, 2)), 1)], 44, ws))), 128)), f.value ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [createElementVNode("span", { style: C, "aria-hidden": "" }), createElementVNode("button", { type: "button", title: "添加笔记", "aria-label": "添加笔记", style: normalizeStyle(w("note", true)), onMouseenter: t2[2] || (t2[2] = (e16) => v.value = "note"), onMouseleave: t2[3] || (t2[3] = (e16) => v.value = null), onClick: t2[4] || (t2[4] = (e16) => o("action", "note")) }, [createVNode(bs, { kind: "note" })], 36)], 64)) : createCommentVNode("", true)], 4));
4203
- } }), Is = { highlight: "highlight", underline: "underline", squiggly: "squiggly", strikeout: "strikeout" };
4204
- const Ms = /* @__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) {
4205
- const a3 = e14, s9 = computed(() => a3.features), { hostRef: i2 } = ma(s9), o = (function() {
4263
+ return (e15, t2) => (openBlock(), createElementBlock("div", { role: "toolbar", "aria-label": "选区工具", style: normalizeStyle(P.value) }, [(openBlock(true), createElementBlock(Fragment, null, renderList(g2.value, (e16) => (openBlock(), createElementBlock("button", { key: e16.id, type: "button", title: e16.label, "aria-label": e16.label, style: normalizeStyle(w(e16.id)), onMouseenter: (t3) => v.value = e16.id, onMouseleave: t2[0] || (t2[0] = (e17) => v.value = null), onClick: (t3) => o("action", e16.id) }, [createVNode(Is, { kind: e16.id }, null, 8, ["kind"])], 44, Ms))), 128)), (openBlock(true), createElementBlock(Fragment, null, renderList(m.value, (e16) => (openBlock(), createElementBlock("button", { key: e16.id, type: "button", title: e16.label, style: normalizeStyle(w(e16.id)), onMouseenter: (t3) => v.value = e16.id, onMouseleave: t2[1] || (t2[1] = (e17) => v.value = null), onClick: (t3) => o("action", e16.id) }, [createElementVNode("span", xs, toDisplayString(e16.label.slice(0, 2)), 1)], 44, Ss))), 128)), f.value ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [createElementVNode("span", { style: C, "aria-hidden": "" }), createElementVNode("button", { type: "button", title: "添加笔记", "aria-label": "添加笔记", style: normalizeStyle(w("note", true)), onMouseenter: t2[2] || (t2[2] = (e16) => v.value = "note"), onMouseleave: t2[3] || (t2[3] = (e16) => v.value = null), onClick: t2[4] || (t2[4] = (e16) => o("action", "note")) }, [createVNode(Is, { kind: "note" })], 36)], 64)) : createCommentVNode("", true)], 4));
4264
+ } }), Ls = { highlight: "highlight", underline: "underline", squiggly: "squiggly", strikeout: "strikeout" };
4265
+ const $s = /* @__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) {
4266
+ const a3 = e14, s9 = computed(() => a3.features), { hostRef: i2 } = ya(s9), o = computed(() => {
4267
+ var _a2, _b;
4268
+ return { background: ((_b = (_a2 = a3.features) == null ? void 0 : _a2.scrollViewport) == null ? void 0 : _b.background) ?? ye };
4269
+ }), r2 = (function() {
4206
4270
  const { registry: e15 } = useRegistry();
4207
4271
  return computed(() => {
4208
4272
  var _a2, _b, _c;
4209
- const t2 = (_c = (_b = (_a2 = e15.value) == null ? void 0 : _a2.getPlugin(yt$1.id)) == null ? void 0 : _b.provides) == null ? void 0 : _c.call(_b);
4273
+ const t2 = (_c = (_b = (_a2 = e15.value) == null ? void 0 : _a2.getPlugin(Ct$1.id)) == null ? void 0 : _b.provides) == null ? void 0 : _c.call(_b);
4210
4274
  return t2 ? (e16) => t2.createNoteFromSelection(e16) : null;
4211
4275
  });
4212
- })(), r2 = (function() {
4276
+ })(), c = (function() {
4213
4277
  const { registry: e15 } = useRegistry();
4214
4278
  return computed(() => {
4215
4279
  var _a2;
4216
- return !!((_a2 = e15.value) == null ? void 0 : _a2.getPlugin(yt$1.id));
4280
+ return !!((_a2 = e15.value) == null ? void 0 : _a2.getPlugin(Ct$1.id));
4217
4281
  });
4218
- })(), c = (function() {
4282
+ })(), u = (function() {
4219
4283
  const { registry: e15 } = useRegistry();
4220
4284
  return computed(() => {
4221
4285
  var _a2;
4222
- return !!((_a2 = e15.value) == null ? void 0 : _a2.getPlugin(Zt.id));
4286
+ return !!((_a2 = e15.value) == null ? void 0 : _a2.getPlugin(Yt.id));
4223
4287
  });
4224
- })(), u = computed(() => {
4288
+ })(), p2 = computed(() => {
4225
4289
  var _a2, _b;
4226
- return a3.showNoteMarkers && r2.value && false !== ((_b = (_a2 = a3.features) == null ? void 0 : _a2.notes) == null ? void 0 : _b.enabled);
4227
- }), p2 = computed(() => {
4228
- var _a2, _b;
4229
- return a3.showBookmarkMarkers && c.value && false !== ((_b = (_a2 = a3.features) == null ? void 0 : _a2.bookmarks) == null ? void 0 : _b.enabled);
4290
+ return a3.showNoteMarkers && c.value && false !== ((_b = (_a2 = a3.features) == null ? void 0 : _a2.notes) == null ? void 0 : _b.enabled);
4230
4291
  }), f = computed(() => {
4231
4292
  var _a2, _b;
4232
- return c.value && false !== ((_b = (_a2 = a3.features) == null ? void 0 : _a2.bookmarks) == null ? void 0 : _b.enabled);
4233
- }), v = (function(e15, a4) {
4293
+ return a3.showBookmarkMarkers && u.value && false !== ((_b = (_a2 = a3.features) == null ? void 0 : _a2.bookmarks) == null ? void 0 : _b.enabled);
4294
+ }), v = computed(() => {
4295
+ var _a2, _b;
4296
+ return u.value && false !== ((_b = (_a2 = a3.features) == null ? void 0 : _a2.bookmarks) == null ? void 0 : _b.enabled);
4297
+ }), b = (function(e15, a4) {
4234
4298
  const s10 = computed(() => {
4235
4299
  var _a2;
4236
4300
  return (_a2 = e15()) == null ? void 0 : _a2.selectionToolbar;
@@ -4240,20 +4304,20 @@ const Ms = /* @__PURE__ */ defineComponent({ __name: "PdfChapterViewport", props
4240
4304
  }), o2 = computed(() => {
4241
4305
  var _a2, _b;
4242
4306
  return false !== ((_b = (_a2 = e15()) == null ? void 0 : _a2.notes) == null ? void 0 : _b.enabled);
4243
- }), { provides: r3 } = useCapability(SelectionPlugin.id), { provides: n2 } = useCapability(AnnotationPlugin.id), { provides: l } = useCapability(yt$1.id);
4307
+ }), { provides: r3 } = useCapability(SelectionPlugin.id), { provides: n2 } = useCapability(AnnotationPlugin.id), { provides: l } = useCapability(Ct$1.id);
4244
4308
  return computed(() => {
4245
4309
  var _a2, _b, _c;
4246
4310
  if (false !== ((_a2 = s10.value) == null ? void 0 : _a2.enabled) && (i3.value || o2.value || ((_c = (_b = s10.value) == null ? void 0 : _b.extraActions) == null ? void 0 : _c.length))) return (t2) => {
4247
- const h2 = os(t2.item);
4311
+ const h2 = ds(t2.item);
4248
4312
  return (d2) => {
4249
4313
  var _a3, _b2, _c2;
4250
- return h$1("div", d2.menuWrapperProps, h$1(Cs, { placementAbove: !!((_a3 = d2.placement) == null ? void 0 : _a3.suggestTop), anchorHeight: d2.rect.size.height, hiddenBuiltinActions: (_b2 = s10.value) == null ? void 0 : _b2.hiddenBuiltinActions, extraActions: (_c2 = s10.value) == null ? void 0 : _c2.extraActions, onAction: (s11) => {
4314
+ return h$1("div", d2.menuWrapperProps, h$1(ks, { placementAbove: !!((_a3 = d2.placement) == null ? void 0 : _a3.suggestTop), anchorHeight: d2.rect.size.height, hiddenBuiltinActions: (_b2 = s10.value) == null ? void 0 : _b2.hiddenBuiltinActions, extraActions: (_c2 = s10.value) == null ? void 0 : _c2.extraActions, onAction: (s11) => {
4251
4315
  var _a4, _b3, _c3;
4252
4316
  if ("highlight" !== s11 && "underline" !== s11 && "squiggly" !== s11 && "strikeout" !== s11) {
4253
4317
  if ("note" === s11) {
4254
4318
  if (!r3.value || !l.value || !o2.value) return;
4255
4319
  const e16 = r3.value.getHighlightRectsForPage(t2.item.localPageIndex, h2);
4256
- return void rs(r3.value.getSelectedText(h2), (a5) => {
4320
+ return void cs(r3.value.getSelectedText(h2), (a5) => {
4257
4321
  var _a5;
4258
4322
  (_a5 = l.value) == null ? void 0 : _a5.requestCreateFromSelection({ chapterId: t2.item.chapterId, localPageIndex: t2.item.localPageIndex, globalPageIndex: t2.item.globalPageIndex, globalPageNumber: t2.item.globalPageNumber, rectsPdfCoord: e16, selectedText: a5.join("\n") });
4259
4323
  });
@@ -4261,53 +4325,53 @@ const Ms = /* @__PURE__ */ defineComponent({ __name: "PdfChapterViewport", props
4261
4325
  (_a4 = a4 == null ? void 0 : a4.onExtraAction) == null ? void 0 : _a4.call(a4, s11, t2);
4262
4326
  } else {
4263
4327
  if (!r3.value || !n2.value || !i3.value) return;
4264
- Se(h2, Is[s11], n2.value, r3.value, (_c3 = (_b3 = e15()) == null ? void 0 : _b3.markup) == null ? void 0 : _c3.styles);
4328
+ xe(h2, Ls[s11], n2.value, r3.value, (_c3 = (_b3 = e15()) == null ? void 0 : _b3.markup) == null ? void 0 : _c3.styles);
4265
4329
  }
4266
4330
  } }));
4267
4331
  };
4268
4332
  };
4269
4333
  });
4270
- })(() => a3.features, { onExtraAction: a3.onExtraSelectionAction }), b = computed(() => {
4271
- if (a3.buildSelectionMenu || v.value) return (e15) => {
4272
- const t2 = v.value ? v.value(e15) : e15.defaultMenu;
4334
+ })(() => a3.features, { onExtraAction: a3.onExtraSelectionAction }), C = computed(() => {
4335
+ if (a3.buildSelectionMenu || b.value) return (e15) => {
4336
+ const t2 = b.value ? b.value(e15) : e15.defaultMenu;
4273
4337
  return a3.buildSelectionMenu ? a3.buildSelectionMenu({ ...e15, defaultMenu: t2 }) : t2;
4274
4338
  };
4275
- }), { provides: C } = useCapability(DocumentManagerPlugin.id);
4276
- function I(e15) {
4339
+ }), { provides: I } = useCapability(DocumentManagerPlugin.id);
4340
+ function x(e15) {
4277
4341
  var _a2;
4278
4342
  const t2 = [];
4279
- if (f.value) {
4343
+ if (v.value) {
4280
4344
  const s11 = (function(e16) {
4281
4345
  var _a3, _b, _c, _d;
4282
- const t3 = os(e16), s12 = (_b = (_a3 = C.value) == null ? void 0 : _a3.getDocument(t3)) == null ? void 0 : _b.pages[e16.localPageIndex];
4283
- return e16.isPlaceholder || !s12 ? null : h$1(cs, { item: e16, pdfPageWidth: s12.size.width, pdfPageHeight: s12.size.height, cssPageWidth: e16.width, cssPageHeight: e16.height, hoverUi: (_d = (_c = a3.features) == null ? void 0 : _c.bookmarks) == null ? void 0 : _d.hover });
4346
+ const t3 = ds(e16), s12 = (_b = (_a3 = I.value) == null ? void 0 : _a3.getDocument(t3)) == null ? void 0 : _b.pages[e16.localPageIndex];
4347
+ return e16.isPlaceholder || !s12 ? null : h$1(ms, { item: e16, pdfPageWidth: s12.size.width, pdfPageHeight: s12.size.height, cssPageWidth: e16.width, cssPageHeight: e16.height, hoverUi: (_d = (_c = a3.features) == null ? void 0 : _c.bookmarks) == null ? void 0 : _d.hover });
4284
4348
  })(e15);
4285
4349
  s11 && t2.push(s11);
4286
4350
  }
4287
4351
  const s10 = (_a2 = a3.renderPageOverlay) == null ? void 0 : _a2.call(a3, e15);
4288
4352
  if (s10 && t2.push(s10), t2.length) return h$1("div", t2);
4289
4353
  }
4290
- return (t2, a4) => (openBlock(), createElementBlock("div", { ref_key: "hostRef", ref: i2, class: normalizeClass(e14.className), style: normalizeStyle(e14.className ? void 0 : unref(be$1)) }, [createVNode(unref(ka), { class: normalizeClass(e14.className) }, { page: withCtx(({ item: t3 }) => {
4354
+ return (t2, a4) => (openBlock(), createElementBlock("div", { ref_key: "hostRef", ref: i2, class: normalizeClass(e14.className), style: normalizeStyle(e14.className ? void 0 : unref(be$1)) }, [createVNode(unref(Da), { class: normalizeClass(e14.className), style: normalizeStyle(o.value) }, { page: withCtx(({ item: t3 }) => {
4291
4355
  var _a2, _b, _c, _d;
4292
- return [createVNode(ds, { item: t3, features: e14.features, "show-note-markers": u.value, "show-bookmark-markers": p2.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": b.value, "create-note": unref(o), "annotation-selection-menu": e14.annotationSelectionMenu, "redaction-selection-menu": e14.redactionSelectionMenu, "render-page-overlay": I }, 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"])];
4293
- }), _: 1 }, 8, ["class"]), renderSlot(t2.$slots, "default")], 6));
4294
- } }), Ss = { key: 0, style: { display: "flex", flexDirection: "column", height: "100%", minHeight: 0, width: "100%" } }, xs = /* @__PURE__ */ defineComponent({ __name: "ChapterPdfViewer", props: { engine: {}, options: {}, editorOptions: {}, features: {}, className: {}, viewportClassName: {}, onExtraSelectionAction: { type: Function } }, setup(e14) {
4356
+ return [createVNode(fs, { item: t3, features: e14.features, "show-note-markers": p2.value, "show-bookmark-markers": f.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": C.value, "create-note": unref(r2), "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"])];
4357
+ }), _: 1 }, 8, ["class", "style"]), renderSlot(t2.$slots, "default")], 6));
4358
+ } }), Ts = { key: 0, style: { display: "flex", flexDirection: "column", height: "100%", minHeight: 0, width: "100%" } }, zs = /* @__PURE__ */ defineComponent({ __name: "ChapterPdfViewer", props: { engine: {}, options: {}, editorOptions: {}, features: {}, className: {}, viewportClassName: {}, onExtraSelectionAction: { type: Function } }, setup(e14) {
4295
4359
  const a3 = e14, s9 = computed(() => (function(e15) {
4296
- if (e15.options) return ha(e15.options);
4360
+ if (e15.options) return da(e15.options);
4297
4361
  if (!e15.editorOptions) throw new Error("ChapterPdfViewer: 请传入 `options`(推荐),或同时传入 `editorOptions` 与 `features`");
4298
- const t2 = Le(e15.features), { plugins: a4 } = oa({ ...e15.editorOptions, features: t2 });
4362
+ const t2 = $e(e15.features), { plugins: a4 } = ra({ ...e15.editorOptions, features: t2 });
4299
4363
  return { plugins: a4, features: t2, editorOptions: { ...e15.editorOptions, features: t2 } };
4300
4364
  })({ engine: a3.engine, options: a3.options, editorOptions: a3.editorOptions, features: a3.features }));
4301
- return (t2, a4) => (openBlock(), createElementBlock("div", { class: normalizeClass(e14.className), style: normalizeStyle(e14.className ? void 0 : unref(be$1)) }, [createVNode(unref(EmbedPDF), { engine: e14.engine, plugins: s9.value.plugins }, { default: withCtx(({ pluginsReady: a5 }) => [a5 ? (openBlock(), createElementBlock("div", Ss, [renderSlot(t2.$slots, "prepend"), createVNode(Ms, { class: normalizeClass(e14.viewportClassName), style: { flex: 1, minHeight: 0 }, features: s9.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));
4302
- } }), ks = { class: "chapter-tree-row" }, Ls = ["aria-expanded"], $s = { key: 1, class: "chapter-tree-toggle-spacer", "aria-hidden": "" }, zs = { class: "chapter-tree-label" }, Ts = { class: "chapter-tree-meta" }, Ds = { key: 0 }, Os = (e14, t2) => {
4365
+ return (t2, a4) => (openBlock(), createElementBlock("div", { class: normalizeClass(e14.className), style: normalizeStyle(e14.className ? void 0 : unref(be$1)) }, [createVNode(unref(EmbedPDF), { engine: e14.engine, plugins: s9.value.plugins }, { default: withCtx(({ pluginsReady: a5 }) => [a5 ? (openBlock(), createElementBlock("div", Ts, [renderSlot(t2.$slots, "prepend"), createVNode($s, { class: normalizeClass(e14.viewportClassName), style: { flex: 1, minHeight: 0 }, features: s9.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));
4366
+ } }), Ds = { class: "chapter-tree-row" }, Os = ["aria-expanded"], Gs = { key: 1, class: "chapter-tree-toggle-spacer", "aria-hidden": "" }, Ns = { class: "chapter-tree-label" }, As = { class: "chapter-tree-meta" }, Vs = { key: 0 }, Es = (e14, t2) => {
4303
4367
  const a3 = e14.__vccOpts || e14;
4304
4368
  for (const [s9, i2] of t2) a3[s9] = i2;
4305
4369
  return a3;
4306
- }, Gs = /* @__PURE__ */ Os(/* @__PURE__ */ defineComponent({ __name: "ChapterTreeItem", props: { node: {}, depth: {}, activeChapterId: {}, chapterStatus: {} }, emits: ["select"], setup(e14) {
4370
+ }, _s = /* @__PURE__ */ Es(/* @__PURE__ */ defineComponent({ __name: "ChapterTreeItem", props: { node: {}, depth: {}, activeChapterId: {}, chapterStatus: {} }, emits: ["select"], setup(e14) {
4307
4371
  const s9 = { idle: "未加载", loading: "加载中", loaded: "已加载", closed: "已卸载", error: "失败", "password-required": "需密码" }, i2 = e14, o = computed(() => i2.node.children ?? []), r2 = computed(() => o.value.length > 0), h2 = ref(i2.depth < 1), u = computed(() => i2.activeChapterId === i2.node.id), p2 = computed(() => i2.chapterStatus[i2.node.id] ?? "idle"), g2 = computed(() => !r2.value);
4308
- return (t2, a3) => (openBlock(), createElementBlock("li", null, [createElementVNode("div", ks, [r2.value ? (openBlock(), createElementBlock("button", { key: 0, type: "button", class: "chapter-tree-toggle", "aria-expanded": h2.value, onClick: a3[0] || (a3[0] = (e15) => h2.value = !h2.value) }, toDisplayString(h2.value ? "▼" : "▶"), 9, Ls)) : (openBlock(), createElementBlock("span", $s)), createElementVNode("button", { type: "button", class: normalizeClass(["chapter-tree-btn", { "chapter-tree-btn-active": u.value }]), onClick: a3[1] || (a3[1] = (a4) => t2.$emit("select", e14.node.id)) }, [createElementVNode("div", zs, toDisplayString(e14.node.title), 1), createElementVNode("div", Ts, [createElementVNode("span", null, " 第 " + toDisplayString(e14.node.startPage) + toDisplayString(e14.node.endPage !== e14.node.startPage ? `–${e14.node.endPage}` : "") + " 页 ", 1), g2.value ? (openBlock(), createElementBlock("span", Ds, toDisplayString(s9[p2.value]), 1)) : createCommentVNode("", true)])], 2)]), r2.value && h2.value ? (openBlock(), createBlock(Ns, { key: 0, nodes: o.value, depth: e14.depth + 1, "active-chapter-id": e14.activeChapterId, "chapter-status": e14.chapterStatus, onSelect: a3[2] || (a3[2] = (e15) => t2.$emit("select", e15)) }, null, 8, ["nodes", "depth", "active-chapter-id", "chapter-status"])) : createCommentVNode("", true)]));
4309
- } }), [["__scopeId", "data-v-315bbf7a"]]), Ns = /* @__PURE__ */ Os(/* @__PURE__ */ defineComponent({ __name: "ChapterTreeList", props: { nodes: {}, depth: {}, activeChapterId: {}, chapterStatus: {} }, emits: ["select"], setup: (e14) => (t2, a3) => (openBlock(), createElementBlock("ul", { class: "chapter-tree-list", style: normalizeStyle({ marginLeft: e14.depth > 0 ? "12px" : "0" }) }, [(openBlock(true), createElementBlock(Fragment, null, renderList(e14.nodes, (s9) => (openBlock(), createBlock(Gs, { key: s9.id, node: s9, depth: e14.depth, "active-chapter-id": e14.activeChapterId, "chapter-status": e14.chapterStatus, onSelect: a3[0] || (a3[0] = (e15) => t2.$emit("select", e15)) }, null, 8, ["node", "depth", "active-chapter-id", "chapter-status"]))), 128))], 4)) }), [["__scopeId", "data-v-eb742e4f"]]), As = { class: "chapter-tree" }, Vs = { class: "chapter-tree-nav", "aria-label": "章节目录" }, Es = /* @__PURE__ */ Os(/* @__PURE__ */ defineComponent({ __name: "ChapterTreePanel", props: { tree: {}, activeChapterId: {} }, emits: ["active-chapter-change"], setup(e14, { emit: t2 }) {
4310
- const o = e14, r2 = t2, { provides: h2 } = useCapability(tt$1.id), { provides: d2 } = useCapability(qe.id), u = ref({});
4372
+ return (t2, a3) => (openBlock(), createElementBlock("li", null, [createElementVNode("div", Ds, [r2.value ? (openBlock(), createElementBlock("button", { key: 0, type: "button", class: "chapter-tree-toggle", "aria-expanded": h2.value, onClick: a3[0] || (a3[0] = (e15) => h2.value = !h2.value) }, toDisplayString(h2.value ? "▼" : "▶"), 9, Os)) : (openBlock(), createElementBlock("span", Gs)), createElementVNode("button", { type: "button", class: normalizeClass(["chapter-tree-btn", { "chapter-tree-btn-active": u.value }]), onClick: a3[1] || (a3[1] = (a4) => t2.$emit("select", e14.node.id)) }, [createElementVNode("div", Ns, toDisplayString(e14.node.title), 1), createElementVNode("div", As, [createElementVNode("span", null, " 第 " + toDisplayString(e14.node.startPage) + toDisplayString(e14.node.endPage !== e14.node.startPage ? `–${e14.node.endPage}` : "") + " 页 ", 1), g2.value ? (openBlock(), createElementBlock("span", Vs, toDisplayString(s9[p2.value]), 1)) : createCommentVNode("", true)])], 2)]), r2.value && h2.value ? (openBlock(), createBlock(Rs, { key: 0, nodes: o.value, depth: e14.depth + 1, "active-chapter-id": e14.activeChapterId, "chapter-status": e14.chapterStatus, onSelect: a3[2] || (a3[2] = (e15) => t2.$emit("select", e15)) }, null, 8, ["nodes", "depth", "active-chapter-id", "chapter-status"])) : createCommentVNode("", true)]));
4373
+ } }), [["__scopeId", "data-v-315bbf7a"]]), Rs = /* @__PURE__ */ Es(/* @__PURE__ */ defineComponent({ __name: "ChapterTreeList", props: { nodes: {}, depth: {}, activeChapterId: {}, chapterStatus: {} }, emits: ["select"], setup: (e14) => (t2, a3) => (openBlock(), createElementBlock("ul", { class: "chapter-tree-list", style: normalizeStyle({ marginLeft: e14.depth > 0 ? "12px" : "0" }) }, [(openBlock(true), createElementBlock(Fragment, null, renderList(e14.nodes, (s9) => (openBlock(), createBlock(_s, { key: s9.id, node: s9, depth: e14.depth, "active-chapter-id": e14.activeChapterId, "chapter-status": e14.chapterStatus, onSelect: a3[0] || (a3[0] = (e15) => t2.$emit("select", e15)) }, null, 8, ["node", "depth", "active-chapter-id", "chapter-status"]))), 128))], 4)) }), [["__scopeId", "data-v-eb742e4f"]]), Fs = { class: "chapter-tree" }, Us = { class: "chapter-tree-nav", "aria-label": "章节目录" }, qs = /* @__PURE__ */ Es(/* @__PURE__ */ defineComponent({ __name: "ChapterTreePanel", props: { tree: {}, activeChapterId: {} }, emits: ["active-chapter-change"], setup(e14, { emit: t2 }) {
4374
+ const o = e14, r2 = t2, { provides: h2 } = useCapability(at$1.id), { provides: d2 } = useCapability(We.id), u = ref({});
4311
4375
  function p2() {
4312
4376
  if (!d2.value) return;
4313
4377
  const e15 = {}, t3 = (a3) => {
@@ -4324,7 +4388,7 @@ const Ms = /* @__PURE__ */ defineComponent({ __name: "PdfChapterViewport", props
4324
4388
  }
4325
4389
  return watch(d2, (e15) => {
4326
4390
  g2 == null ? void 0 : g2(), g2 = e15 ? e15.onChapterStatusChange(p2) : null;
4327
- }, { immediate: true }), onBeforeUnmount(() => g2 == null ? void 0 : g2()), (t3, a3) => (openBlock(), createElementBlock("aside", As, [a3[0] || (a3[0] = createElementVNode("h2", { class: "chapter-tree-title" }, "章节目录", -1)), createElementVNode("nav", Vs, [createVNode(Ns, { nodes: e14.tree, depth: 0, "active-chapter-id": e14.activeChapterId, "chapter-status": u.value, onSelect: f }, null, 8, ["nodes", "active-chapter-id", "chapter-status"])])]));
4391
+ }, { immediate: true }), onBeforeUnmount(() => g2 == null ? void 0 : g2()), (t3, a3) => (openBlock(), createElementBlock("aside", Fs, [a3[0] || (a3[0] = createElementVNode("h2", { class: "chapter-tree-title" }, "章节目录", -1)), createElementVNode("nav", Us, [createVNode(Rs, { nodes: e14.tree, depth: 0, "active-chapter-id": e14.activeChapterId, "chapter-status": u.value, onSelect: f }, null, 8, ["nodes", "active-chapter-id", "chapter-status"])])]));
4328
4392
  } }), [["__scopeId", "data-v-d7a0838d"]]);
4329
4393
  const _sfc_main = /* @__PURE__ */ defineComponent({
4330
4394
  __name: "ChapterPdfViewer",
@@ -4338,7 +4402,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
4338
4402
  },
4339
4403
  setup(__props) {
4340
4404
  return (_ctx, _cache) => {
4341
- return openBlock(), createBlock(unref(xs), normalizeProps(guardReactiveProps(_ctx.$props)), createSlots({
4405
+ return openBlock(), createBlock(unref(zs), normalizeProps(guardReactiveProps(_ctx.$props)), createSlots({
4342
4406
  default: withCtx(() => [
4343
4407
  renderSlot(_ctx.$slots, "default")
4344
4408
  ]),
@@ -5731,8 +5795,8 @@ const X = class s4 extends BasePlugin {
5731
5795
  };
5732
5796
  X.id = "chapter-manager";
5733
5797
  let Z = X;
5734
- const tt = { kind: "first-wins" };
5735
- function et2(t2, e14, a3) {
5798
+ const tt2 = { kind: "first-wins" };
5799
+ function et(t2, e14, a3) {
5736
5800
  if (1 === e14.length) return e14[0].chapterId;
5737
5801
  switch (a3.kind) {
5738
5802
  case "first-wins":
@@ -5784,8 +5848,8 @@ let at = class {
5784
5848
  return a3 ? this._pages.indexOf(a3) : -1;
5785
5849
  }
5786
5850
  };
5787
- function st(t2, e14 = tt) {
5788
- const a3 = (function(t3, e15 = tt) {
5851
+ function st(t2, e14 = tt2) {
5852
+ const a3 = (function(t3, e15 = tt2) {
5789
5853
  const a4 = /* @__PURE__ */ new Map();
5790
5854
  for (const o2 of t3.chapters) {
5791
5855
  const [t4, e16] = o2.globalPageRange;
@@ -5795,7 +5859,7 @@ function st(t2, e14 = tt) {
5795
5859
  }
5796
5860
  }
5797
5861
  const s10 = /* @__PURE__ */ new Map();
5798
- for (const [o2, r3] of a4) s10.set(o2, et2(o2, r3, e15));
5862
+ for (const [o2, r3] of a4) s10.set(o2, et(o2, r3, e15));
5799
5863
  return s10;
5800
5864
  })(t2, e14), s9 = /* @__PURE__ */ new Map();
5801
5865
  for (const n2 of t2.chapters) s9.set(n2.chapterId, n2);
@@ -5811,10 +5875,10 @@ function st(t2, e14 = tt) {
5811
5875
  }
5812
5876
  const ot = class s5 extends BasePlugin {
5813
5877
  constructor(t2, s9) {
5814
- super(t2, s9), this.statusChange$ = createBehaviorEmitter(), this.manifestChange$ = createEmitter(), this.overlapStrategy = tt, this.chapterStatus = /* @__PURE__ */ new Map(), this.chapterLastUsed = /* @__PURE__ */ new Map(), this.passwordAttempts = /* @__PURE__ */ new Map(), this.pendingLoadPromises = /* @__PURE__ */ new Map(), this.unloadTimer = null, this.documentManagerUnsubs = [], this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
5878
+ super(t2, s9), this.statusChange$ = createBehaviorEmitter(), this.manifestChange$ = createEmitter(), this.overlapStrategy = tt2, this.chapterStatus = /* @__PURE__ */ new Map(), this.chapterLastUsed = /* @__PURE__ */ new Map(), this.passwordAttempts = /* @__PURE__ */ new Map(), this.pendingLoadPromises = /* @__PURE__ */ new Map(), this.unloadTimer = null, this.documentManagerUnsubs = [], this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
5815
5879
  }
5816
5880
  async initialize(t2) {
5817
- if (this.config = t2, this.passwordProvider = t2.passwordProvider, this.overlapStrategy = t2.overlapStrategy ?? tt, this.documentManagerUnsubs.push(this.documentManager.provides().onDocumentOpened((t3) => {
5881
+ if (this.config = t2, this.passwordProvider = t2.passwordProvider, this.overlapStrategy = t2.overlapStrategy ?? tt2, this.documentManagerUnsubs.push(this.documentManager.provides().onDocumentOpened((t3) => {
5818
5882
  this.isOwnedChapter(t3.id) && (this.passwordAttempts.delete(t3.id), this.updateStatus(t3.id, "loaded"));
5819
5883
  }), this.documentManager.provides().onDocumentClosed((t3) => {
5820
5884
  this.isOwnedChapter(t3) && this.updateStatus(t3, "closed");
@@ -5998,7 +6062,7 @@ function it(t2, e14) {
5998
6062
  }
5999
6063
  return true;
6000
6064
  }
6001
- const nt2 = class extends BasePlugin {
6065
+ const nt = class extends BasePlugin {
6002
6066
  constructor(t2, a3) {
6003
6067
  super(t2, a3), this.layoutChange$ = createBehaviorEmitter(void 0, it), 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.chapterManagerUnsubs = [], this.chapterManager = this.registry.getPlugin(rt.id), this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
6004
6068
  }
@@ -6177,8 +6241,8 @@ const nt2 = class extends BasePlugin {
6177
6241
  a3 && this.scrollToIndex(a3.globalPageIndex, e14);
6178
6242
  }
6179
6243
  };
6180
- nt2.id = "chapter-scroll";
6181
- let ht = nt2;
6244
+ nt.id = "chapter-scroll";
6245
+ let ht = nt;
6182
6246
  const dt = class s6 extends BasePlugin {
6183
6247
  constructor(t2, s9) {
6184
6248
  super(t2, s9), this.notesChange$ = createBehaviorEmitter([]), this.noteActivated$ = createEmitter(), this.notes = /* @__PURE__ */ new Map(), this.chapterScroll = this.registry.getPlugin(ht.id), this.chapterManager = this.registry.getPlugin(Z.id), this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
@@ -6287,7 +6351,7 @@ const dt = class s6 extends BasePlugin {
6287
6351
  }
6288
6352
  };
6289
6353
  dt.id = "note";
6290
- let lt = dt;
6354
+ let lt2 = dt;
6291
6355
  function ct(t2) {
6292
6356
  const e14 = t2[t2.length - 1];
6293
6357
  return { x: e14.origin.x + e14.size.width, y: e14.origin.y + e14.size.height };
@@ -6345,7 +6409,7 @@ let vt = class {
6345
6409
  return a3 ? this._pages.indexOf(a3) : -1;
6346
6410
  }
6347
6411
  };
6348
- function bt2(t2, e14 = ft) {
6412
+ function bt(t2, e14 = ft) {
6349
6413
  const a3 = (function(t3, e15 = ft) {
6350
6414
  const a4 = /* @__PURE__ */ new Map();
6351
6415
  for (const o2 of t3.chapters) {
@@ -6370,7 +6434,7 @@ function bt2(t2, e14 = ft) {
6370
6434
  }
6371
6435
  return new vt(r2);
6372
6436
  }
6373
- const Pt = class s7 extends BasePlugin {
6437
+ const Pt2 = class s7 extends BasePlugin {
6374
6438
  constructor(t2, s9) {
6375
6439
  super(t2, s9), this.statusChange$ = createBehaviorEmitter(), this.manifestChange$ = createEmitter(), this.overlapStrategy = ft, this.chapterStatus = /* @__PURE__ */ new Map(), this.chapterLastUsed = /* @__PURE__ */ new Map(), this.passwordAttempts = /* @__PURE__ */ new Map(), this.pendingLoadPromises = /* @__PURE__ */ new Map(), this.unloadTimer = null, this.documentManagerUnsubs = [], this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
6376
6440
  }
@@ -6410,7 +6474,7 @@ const Pt = class s7 extends BasePlugin {
6410
6474
  const a3 = new Set(this.chapterStatus.keys()), o = new Set(t2.chapters.map((t3) => t3.chapterId));
6411
6475
  for (const s9 of a3) o.has(s9) || (this.closeChapter(s9), this.chapterStatus.delete(s9));
6412
6476
  for (const s9 of t2.chapters) this.chapterStatus.has(s9.chapterId) || this.chapterStatus.set(s9.chapterId, "idle");
6413
- this.manifest = t2, this.virtualPageMap = bt2(t2, this.overlapStrategy), this.manifestChange$.emit({ manifest: t2, map: this.virtualPageMap }), this.eagerPrefetchFromManifest();
6477
+ this.manifest = t2, this.virtualPageMap = bt(t2, this.overlapStrategy), this.manifestChange$.emit({ manifest: t2, map: this.virtualPageMap }), this.eagerPrefetchFromManifest();
6414
6478
  }
6415
6479
  eagerPrefetchFromManifest() {
6416
6480
  const t2 = this.config.prefetchChapters ?? 0;
@@ -6548,8 +6612,8 @@ const Pt = class s7 extends BasePlugin {
6548
6612
  this.chapterStatus.get(t2) !== e14 && (this.chapterStatus.set(t2, e14), this.statusChange$.emit({ chapterId: t2, status: e14, ..."error" === e14 && a3 ? { error: { message: a3 } } : {} }));
6549
6613
  }
6550
6614
  };
6551
- Pt.id = "chapter-manager";
6552
- let wt = Pt;
6615
+ Pt2.id = "chapter-manager";
6616
+ let wt = Pt2;
6553
6617
  const yt = { kind: "first-wins" };
6554
6618
  function It(t2, e14, a3) {
6555
6619
  if (1 === e14.length) return e14[0].chapterId;
@@ -6817,7 +6881,7 @@ function kt(t2, e14) {
6817
6881
  }
6818
6882
  return true;
6819
6883
  }
6820
- const Lt2 = class extends BasePlugin {
6884
+ const Lt = class extends BasePlugin {
6821
6885
  constructor(t2, a3) {
6822
6886
  super(t2, a3), this.layoutChange$ = createBehaviorEmitter(void 0, kt), 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.chapterManagerUnsubs = [], this.chapterManager = this.registry.getPlugin(xt.id), this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
6823
6887
  }
@@ -6996,8 +7060,8 @@ const Lt2 = class extends BasePlugin {
6996
7060
  a3 && this.scrollToIndex(a3.globalPageIndex, e14);
6997
7061
  }
6998
7062
  };
6999
- Lt2.id = "chapter-scroll";
7000
- let $t = Lt2;
7063
+ Lt.id = "chapter-scroll";
7064
+ let $t2 = Lt;
7001
7065
  function Tt(t2) {
7002
7066
  const e14 = t2[t2.length - 1];
7003
7067
  return { x: e14.origin.x + e14.size.width, y: e14.origin.y + e14.size.height };
@@ -7019,7 +7083,7 @@ function Ot(t2, e14) {
7019
7083
  }
7020
7084
  return false;
7021
7085
  }
7022
- async function Gt2(t2, e14, a3) {
7086
+ async function Gt(t2, e14, a3) {
7023
7087
  t2.scrollToGlobalPageIndex(e14), await (function(t3, e15, a4 = 2500) {
7024
7088
  const s9 = t3.getLayout().items.find((t4) => t4.globalPageIndex === e15 && !t4.isPlaceholder);
7025
7089
  return s9 ? Promise.resolve(s9) : new Promise((s10) => {
@@ -7034,7 +7098,7 @@ async function Gt2(t2, e14, a3) {
7034
7098
  }
7035
7099
  const zt = class a2 extends BasePlugin {
7036
7100
  constructor(t2, a3) {
7037
- super(t2, a3), this.change$ = createBehaviorEmitter([]), this.entries = /* @__PURE__ */ new Map(), this.chapterScroll = this.registry.getPlugin($t.id), this.chapterManager = this.registry.getPlugin(wt.id), this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
7101
+ super(t2, a3), this.change$ = createBehaviorEmitter([]), this.entries = /* @__PURE__ */ new Map(), this.chapterScroll = this.registry.getPlugin($t2.id), this.chapterManager = this.registry.getPlugin(wt.id), this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
7038
7102
  }
7039
7103
  async initialize(t2) {
7040
7104
  var e14;
@@ -7106,7 +7170,7 @@ const zt = class a2 extends BasePlugin {
7106
7170
  const e15 = t3.rectPdfCoord;
7107
7171
  return e15.origin.y + e15.size.height;
7108
7172
  })(e14.anchor);
7109
- await Gt2(a3, s9, o);
7173
+ await Gt(a3, s9, o);
7110
7174
  }
7111
7175
  };
7112
7176
  zt.id = "paragraph-bookmark";
@@ -7116,8 +7180,9 @@ function Ht(t2, e14) {
7116
7180
  return false === t2 ? { ...e14, enabled: false } : true === t2 || void 0 === t2 ? { ...e14, enabled: e14.enabled ?? true } : { ...e14, ...a3, enabled: false !== (null == a3 ? void 0 : a3.enabled) };
7117
7181
  }
7118
7182
  function Bt(t2) {
7119
- const e14 = Ht(void 0, { enabled: true }), a3 = Ht(void 0, { enabled: true }), s9 = Ht(void 0, { enabled: true });
7120
- return { markup: e14, bookmarks: a3, notes: s9, zoom: Ht(void 0, { enabled: true, min: 0.5, max: 3, initial: 1 }), selectionToolbar: Ht(false !== e14.enabled || false !== s9.enabled, { enabled: true }) };
7183
+ var e14;
7184
+ const a3 = Ht(void 0, { enabled: true }), s9 = Ht(void 0, { enabled: true }), o = Ht(void 0, { enabled: true }), r2 = Ht(void 0, { enabled: true, min: 0.5, max: 3, initial: 1 }), i2 = Ht(false !== a3.enabled || false !== o.enabled, { enabled: true });
7185
+ return { markup: a3, bookmarks: s9, notes: o, zoom: r2, scrollViewport: { background: (null == (e14 = void 0) ? void 0 : e14.background) ?? "#f1f5f9" }, selectionToolbar: i2 };
7121
7186
  }
7122
7187
  PdfAnnotationSubtype.HIGHLIGHT, PdfAnnotationSubtype.UNDERLINE, PdfAnnotationSubtype.SQUIGGLY, PdfAnnotationSubtype.STRIKEOUT, PdfAnnotationSubtype.HIGHLIGHT, PdfAnnotationSubtype.UNDERLINE, PdfAnnotationSubtype.SQUIGGLY, PdfAnnotationSubtype.STRIKEOUT;
7123
7188
  Bt();
@@ -7152,7 +7217,7 @@ function ne(t2) {
7152
7217
  }
7153
7218
  function he(t2) {
7154
7219
  var _a2, _b, _c, _d;
7155
- const e14 = (_a2 = t2.getPlugin(AnnotationPlugin.id)) == null ? void 0 : _a2.provides(), a3 = (_b = t2.getPlugin(lt.id)) == null ? void 0 : _b.provides(), s9 = (_c = t2.getPlugin(At.id)) == null ? void 0 : _c.provides(), o = (_d = t2.getPlugin(O.id)) == null ? void 0 : _d.provides();
7220
+ const e14 = (_a2 = t2.getPlugin(AnnotationPlugin.id)) == null ? void 0 : _a2.provides(), a3 = (_b = t2.getPlugin(lt2.id)) == null ? void 0 : _b.provides(), s9 = (_c = t2.getPlugin(At.id)) == null ? void 0 : _c.provides(), o = (_d = t2.getPlugin(O.id)) == null ? void 0 : _d.provides();
7156
7221
  return { annotation: e14, note: a3, bookmark: s9, chapterManager: o };
7157
7222
  }
7158
7223
  async function de(t2, e14, a3) {
@@ -7268,21 +7333,21 @@ export {
7268
7333
  ze as CallbackPasswordProvider,
7269
7334
  ChapterManagerPlugin,
7270
7335
  _sfc_main as ChapterPdfViewer,
7271
- Es as ChapterTreePanel,
7272
- ia as DEFAULT_CHAPTER_VIEWER_CONFIG,
7273
- sa as DEFAULT_CHAPTER_VIEWER_FEATURES,
7336
+ qs as ChapterTreePanel,
7337
+ oa as DEFAULT_CHAPTER_VIEWER_CONFIG,
7338
+ ia as DEFAULT_CHAPTER_VIEWER_FEATURES,
7274
7339
  EmbedPDF2 as EmbedPDF,
7275
- Ms as PdfChapterViewport,
7276
- Se as applySelectionMarkup,
7340
+ $s as PdfChapterViewport,
7341
+ xe as applySelectionMarkup,
7277
7342
  d as buildChapterViewerCatalog,
7278
- Ht$1 as buildParagraphBookmarkAnchor,
7343
+ Bt$1 as buildParagraphBookmarkAnchor,
7279
7344
  ge as chapterAnnotationsArchiveToJson,
7280
7345
  me as chapterAnnotationsSnapshotToJson,
7281
7346
  h as chapterDescriptorFromTreeNode,
7282
- ha as createChapterViewerBundle,
7283
- oa as createChapterViewerEditor,
7284
- da as createChapterViewerEditorOptions,
7285
- ta as createPdfChapterEditor,
7347
+ da as createChapterViewerBundle,
7348
+ ra as createChapterViewerEditor,
7349
+ ca as createChapterViewerEditorOptions,
7350
+ aa as createPdfChapterEditor,
7286
7351
  t as defaultOverlapStrategy,
7287
7352
  Pe as downloadChapterAnnotationsArchive,
7288
7353
  we as downloadChapterAnnotationsSnapshot,