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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { defineComponent, computed, h as h$1, openBlock, createElementBlock, normalizeStyle, unref, normalizeClass, createVNode, withCtx, renderSlot, createCommentVNode, ref, watch, onBeforeUnmount, Fragment, renderList, createElementVNode, toDisplayString, onMounted, createBlock, resolveDynamicComponent, withModifiers, isRef, normalizeProps, guardReactiveProps, createSlots } from "vue";
1
+ import { defineComponent, computed, openBlock, createElementBlock, normalizeStyle, unref, normalizeClass, createVNode, withCtx, renderSlot, createCommentVNode, h as h$1, ref, watch, onBeforeUnmount, onMounted, createElementVNode, Fragment, renderList, createBlock, resolveDynamicComponent, withModifiers, isRef, toDisplayString, normalizeProps, guardReactiveProps, createSlots } from "vue";
2
2
  import { useRegistry, useCapability, EmbedPDF } from "@embedpdf/core/vue";
3
3
  import { EmbedPDF as EmbedPDF2, useCapability as useCapability2, useRegistry as useRegistry2 } from "@embedpdf/core/vue";
4
4
  import { LockModeType, AnnotationPluginPackage, AnnotationPlugin, ANNOTATION_PLUGIN_ID } from "@embedpdf/plugin-annotation";
@@ -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$1 = "#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$1 }, 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,146 @@ 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
- var _a3;
2557
- return ((_a3 = o.value) == null ? void 0 : _a3.min) ?? 0.5;
2558
- }, p2 = () => {
2559
- var _a3;
2560
- return ((_a3 = o.value) == null ? void 0 : _a3.max) ?? 3;
2561
- }, g2 = () => {
2562
- 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) {
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
+ const l = isRef(o) ? o : computed(() => o), { registry: h2 } = useRegistry(), { provides: d2 } = useCapability(DocumentManagerPlugin.id), { provides: c } = useCapability(We.id), u = ref(v()), p2 = ref(u.value), g2 = ref(0), f = () => {
2578
+ var _a2;
2579
+ return (_a2 = r2.value) == null ? void 0 : _a2.pageWidth;
2580
+ }, m = () => (function(e14) {
2581
+ return null != e14 && e14 > 0;
2582
+ })(f()), v = () => {
2583
+ var _a2;
2584
+ return ((_a2 = r2.value) == null ? void 0 : _a2.initial) ?? 1;
2585
+ }, b = computed(() => {
2586
+ var _a2;
2587
+ return (function(e14, t2, a3, s9, i2) {
2588
+ if (!e14 || a3 <= 0) return i2;
2589
+ let o2 = i2;
2590
+ for (const r3 of t2.chapters) {
2591
+ const t3 = e14.getDocument(r3.chapterId);
2592
+ t3 && (o2 = Math.min(o2, fa(t3, a3, s9, i2)));
2593
+ }
2594
+ return o2;
2595
+ })(d2.value, l.value, g2.value, f(), ((_a2 = r2.value) == null ? void 0 : _a2.max) ?? 3);
2596
+ }), P = computed(() => {
2597
+ var _a2;
2598
+ return Math.min(((_a2 = r2.value) == null ? void 0 : _a2.min) ?? 0.5, b.value);
2599
+ });
2600
+ let w;
2601
+ function y(e14) {
2602
+ const t2 = b.value, a3 = P.value, s9 = ua(e14, a3, t2);
2603
+ p2.value = s9, u.value = s9, (function(e15, t3, a4, s10 = 0.5, i2 = 3) {
2568
2604
  const o2 = e15 == null ? void 0 : e15.getStore();
2569
2605
  if (!o2) return;
2570
- const r3 = ca(a3, s9, i3);
2606
+ const r3 = ua(a4, s10, i2);
2571
2607
  o2.dispatchToCore(setDefaultScale(r3));
2572
2608
  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, () => {
2588
- var _a3;
2589
- return (_a3 = o.value) == null ? void 0 : _a3.initial;
2590
- }, () => {
2591
- var _a3;
2592
- return (_a3 = o.value) == null ? void 0 : _a3.pageWidth;
2593
- }], () => {
2594
- var _a3;
2595
- n2.value && (g2() || f(((_a3 = o.value) == null ? void 0 : _a3.initial) ?? 1));
2596
- }, { immediate: true }), watch([h2, r2, () => {
2597
- var _a3;
2598
- return (_a3 = o.value) == null ? void 0 : _a3.pageWidth;
2599
- }], () => {
2600
- const e14 = h2.value;
2609
+ })(h2.value, l.value, s9, a3, t2);
2610
+ }
2611
+ function C(e14) {
2612
+ if (!d2.value) return;
2613
+ const t2 = d2.value.getDocument(e14);
2614
+ if (!t2) return;
2615
+ const a3 = ga(g2.value, f());
2616
+ a3 <= 0 || y(pa(t2, a3));
2617
+ }
2618
+ function I(e14) {
2619
+ m() ? C(e14) : y(v());
2620
+ }
2621
+ return watch(() => n2 == null ? void 0 : n2.value, (e14) => {
2622
+ w == null ? void 0 : w(), w = e14 ? (function(e15, t2) {
2623
+ if (!e15 || "undefined" == typeof ResizeObserver) return () => {
2624
+ };
2625
+ let a3 = null;
2626
+ const s9 = new ResizeObserver(() => {
2627
+ t2(ma(a3));
2628
+ }), i2 = () => {
2629
+ const i3 = e15.querySelector("[data-chapter-scroll-viewport]");
2630
+ i3 !== a3 ? (a3 && s9.unobserve(a3), a3 = i3, a3 ? (s9.observe(a3), t2(ma(a3))) : t2(0)) : t2(ma(a3));
2631
+ };
2632
+ i2();
2633
+ const o2 = new MutationObserver(i2);
2634
+ o2.observe(e15, { childList: true, subtree: true });
2635
+ const r3 = requestAnimationFrame(i2);
2636
+ return () => {
2637
+ cancelAnimationFrame(r3), o2.disconnect(), a3 && s9.unobserve(a3), s9.disconnect();
2638
+ };
2639
+ })(e14, (e15) => {
2640
+ g2.value = e15;
2641
+ }) : void 0;
2642
+ }, { immediate: true }), onBeforeUnmount(() => w == null ? void 0 : w()), watch([h2, () => v(), () => m()], () => {
2643
+ h2.value && (m() || y(v()));
2644
+ }, { immediate: true }), watch(b, (e14) => {
2645
+ p2.value > e14 && y(e14);
2646
+ }), watch([c, l, () => m(), () => v()], () => {
2647
+ const e14 = c.value;
2601
2648
  if (e14) {
2602
- for (const t2 of r2.value.chapters) "loaded" === e14.getChapterStatus(t2.chapterId) && m(t2.chapterId);
2649
+ for (const t2 of l.value.chapters) "loaded" === e14.getChapterStatus(t2.chapterId) && I(t2.chapterId);
2603
2650
  return e14.onChapterStatusChange((e15) => {
2604
- "loaded" === e15.status && m(e15.chapterId);
2651
+ "loaded" === e15.status && I(e15.chapterId);
2605
2652
  });
2606
2653
  }
2607
- }, { immediate: true }), { scale: d2, setScale: f, zoomEnabled: () => {
2608
- var _a3;
2609
- return false !== ((_a3 = o.value) == null ? void 0 : _a3.enabled);
2610
- }, minZoom: u, maxZoom: p2 };
2654
+ }, { immediate: true }), watch([g2, () => m(), c, l], () => {
2655
+ if (m() && !(g2.value <= 0) && c.value) {
2656
+ for (const e14 of l.value.chapters) if ("loaded" === c.value.getChapterStatus(e14.chapterId)) {
2657
+ C(e14.chapterId);
2658
+ break;
2659
+ }
2660
+ }
2661
+ }), { scale: u, setScale: y, zoomEnabled: () => {
2662
+ var _a2;
2663
+ return false !== ((_a2 = r2.value) == null ? void 0 : _a2.enabled);
2664
+ }, minZoom: P, maxZoom: b };
2611
2665
  }
2612
- function pa(e14, t2, a3) {
2666
+ function ba(e14, t2, a3) {
2613
2667
  return Math.min(a3, Math.max(t2, e14));
2614
2668
  }
2615
- function ga(e14, t2) {
2669
+ function Pa(e14, t2) {
2616
2670
  if (!e14 || false === t2.enabled) return () => {
2617
2671
  };
2618
2672
  let a3 = null, s9 = null, i2 = 0;
@@ -2621,7 +2675,7 @@ function ga(e14, t2) {
2621
2675
  return !!s10 && (a3 == null ? void 0 : a3(), a3 = (function({ container: e15, getScale: t3, setScale: a4, minZoom: s11 = 0.5, maxZoom: i3 = 3 }) {
2622
2676
  let o2 = 0, r2 = 1, n2 = null, l = 1, h2 = 1;
2623
2677
  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(() => {
2678
+ (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
2679
  n2 = null;
2626
2680
  }, 120));
2627
2681
  }, c = /* @__PURE__ */ new Map(), u = (e16) => {
@@ -2633,7 +2687,7 @@ function ga(e14, t2) {
2633
2687
  if (c.has(e16.pointerId) && (c.set(e16.pointerId, { x: e16.clientX, y: e16.clientY }), 2 === c.size && o2 > 0)) {
2634
2688
  e16.preventDefault();
2635
2689
  const [t4, n3] = [...c.values()], l2 = Math.hypot(n3.x - t4.x, n3.y - t4.y);
2636
- a4(pa(r2 * (l2 / o2), s11, i3));
2690
+ a4(ba(r2 * (l2 / o2), s11, i3));
2637
2691
  }
2638
2692
  }, g2 = (e16) => {
2639
2693
  c.delete(e16.pointerId), c.size < 2 && (o2 = 0);
@@ -2649,26 +2703,26 @@ function ga(e14, t2) {
2649
2703
  i2 && cancelAnimationFrame(i2), s9 == null ? void 0 : s9.disconnect(), a3 == null ? void 0 : a3();
2650
2704
  };
2651
2705
  }
2652
- const fa = { chapters: [] };
2653
- function ma(e14) {
2654
- const o = ref(null), { provides: r2 } = useCapability(qe.id), n2 = computed(() => {
2706
+ const wa = { chapters: [] };
2707
+ function ya(e14) {
2708
+ const o = ref(null), { provides: r2 } = useCapability(We.id), n2 = computed(() => {
2655
2709
  var _a2;
2656
- return ((_a2 = r2.value) == null ? void 0 : _a2.getManifest()) ?? fa;
2710
+ return ((_a2 = r2.value) == null ? void 0 : _a2.getManifest()) ?? wa;
2657
2711
  }), l = computed(() => {
2658
2712
  var _a2;
2659
2713
  return (_a2 = e14.value) == null ? void 0 : _a2.zoom;
2660
- }), { scale: h2, setScale: d2, zoomEnabled: c, minZoom: u, maxZoom: p2 } = ua(n2, l);
2714
+ }), { scale: h2, setScale: d2, zoomEnabled: c, minZoom: u, maxZoom: p2 } = va(n2, l, o);
2661
2715
  return (function(e15, t2) {
2662
2716
  let a3 = null;
2663
2717
  watch([e15, t2], () => {
2664
2718
  a3 == null ? void 0 : a3();
2665
2719
  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 });
2720
+ a3 = Pa(e15.value ?? null, { enabled: s9.enabled, getScale: s9.getScale, setScale: s9.setScale, minZoom: s9.minZoom, maxZoom: s9.maxZoom });
2667
2721
  }, { 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 };
2722
+ })(o, computed(() => ({ enabled: c(), getScale: () => h2.value, setScale: d2, minZoom: u.value, maxZoom: p2.value }))), { hostRef: o, scale: h2, setScale: d2, zoomEnabled: c };
2669
2723
  }
2670
- const va = { kind: "first-wins" };
2671
- function ba(e14, t2, a3) {
2724
+ const Ca = { kind: "first-wins" };
2725
+ function Ia(e14, t2, a3) {
2672
2726
  if (1 === t2.length) return t2[0].chapterId;
2673
2727
  switch (a3.kind) {
2674
2728
  case "first-wins":
@@ -2686,7 +2740,7 @@ function ba(e14, t2, a3) {
2686
2740
  return a3.resolve(e14, t2);
2687
2741
  }
2688
2742
  }
2689
- class Pa {
2743
+ class Ma {
2690
2744
  constructor(e14) {
2691
2745
  this._pages = e14, this._byChapter = /* @__PURE__ */ new Map(), this._byGlobalNumber = /* @__PURE__ */ new Map();
2692
2746
  for (const t2 of e14) {
@@ -2720,8 +2774,8 @@ class Pa {
2720
2774
  return a3 ? this._pages.indexOf(a3) : -1;
2721
2775
  }
2722
2776
  }
2723
- function wa(e14, t2 = va) {
2724
- const a3 = (function(e15, t3 = va) {
2777
+ function Sa(e14, t2 = Ca) {
2778
+ const a3 = (function(e15, t3 = Ca) {
2725
2779
  const a4 = /* @__PURE__ */ new Map();
2726
2780
  for (const i3 of e15.chapters) {
2727
2781
  const [e16, t4] = i3.globalPageRange;
@@ -2731,7 +2785,7 @@ function wa(e14, t2 = va) {
2731
2785
  }
2732
2786
  }
2733
2787
  const s10 = /* @__PURE__ */ new Map();
2734
- for (const [i3, o2] of a4) s10.set(i3, ba(i3, o2, t3));
2788
+ for (const [i3, o2] of a4) s10.set(i3, Ia(i3, o2, t3));
2735
2789
  return s10;
2736
2790
  })(e14, t2), s9 = /* @__PURE__ */ new Map();
2737
2791
  for (const n2 of e14.chapters) s9.set(n2.chapterId, n2);
@@ -2743,14 +2797,14 @@ function wa(e14, t2 = va) {
2743
2797
  const [i3] = t3.globalPageRange, [l] = t3.localPageRange, h2 = l + (n2 - i3);
2744
2798
  o.push({ globalPageIndex: r2++, globalPageNumber: n2, chapterId: e15, localPageIndex: h2 });
2745
2799
  }
2746
- return new Pa(o);
2800
+ return new Ma(o);
2747
2801
  }
2748
- const ya = class e9 extends BasePlugin {
2802
+ const xa = class e9 extends BasePlugin {
2749
2803
  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);
2804
+ 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
2805
  }
2752
2806
  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) => {
2807
+ if (this.config = e14, this.passwordProvider = e14.passwordProvider, this.overlapStrategy = e14.overlapStrategy ?? Ca, this.documentManagerUnsubs.push(this.documentManager.provides().onDocumentOpened((e15) => {
2754
2808
  this.isOwnedChapter(e15.id) && (this.passwordAttempts.delete(e15.id), this.updateStatus(e15.id, "loaded"));
2755
2809
  }), this.documentManager.provides().onDocumentClosed((e15) => {
2756
2810
  this.isOwnedChapter(e15) && this.updateStatus(e15, "closed");
@@ -2785,7 +2839,7 @@ const ya = class e9 extends BasePlugin {
2785
2839
  const s9 = new Set(this.chapterStatus.keys()), i2 = new Set(t2.chapters.map((e14) => e14.chapterId));
2786
2840
  for (const e14 of s9) i2.has(e14) || (this.closeChapter(e14), this.chapterStatus.delete(e14));
2787
2841
  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();
2842
+ this.manifest = t2, this.virtualPageMap = Sa(t2, this.overlapStrategy), this.manifestChange$.emit({ manifest: t2, map: this.virtualPageMap }), this.eagerPrefetchFromManifest();
2789
2843
  }
2790
2844
  eagerPrefetchFromManifest() {
2791
2845
  const e14 = this.config.prefetchChapters ?? 0;
@@ -2923,9 +2977,9 @@ const ya = class e9 extends BasePlugin {
2923
2977
  this.chapterStatus.get(e14) !== t2 && (this.chapterStatus.set(e14, t2), this.statusChange$.emit({ chapterId: e14, status: t2, ..."error" === t2 && a3 ? { error: { message: a3 } } : {} }));
2924
2978
  }
2925
2979
  };
2926
- ya.id = "chapter-manager";
2927
- let Ca = ya;
2928
- function Ia(e14, t2) {
2980
+ xa.id = "chapter-manager";
2981
+ let ka = xa;
2982
+ function La(e14, t2) {
2929
2983
  if (e14 === t2) return true;
2930
2984
  if (e14.totalHeight !== t2.totalHeight || e14.totalWidth !== t2.totalWidth || e14.pageGap !== t2.pageGap || e14.items.length !== t2.items.length) return false;
2931
2985
  for (let a3 = 0; a3 < e14.items.length; a3++) {
@@ -2934,9 +2988,9 @@ function Ia(e14, t2) {
2934
2988
  }
2935
2989
  return true;
2936
2990
  }
2937
- const Ma = class extends BasePlugin {
2991
+ const $a = class extends BasePlugin {
2938
2992
  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);
2993
+ 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
2994
  }
2941
2995
  async initialize(e14) {
2942
2996
  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 +3167,14 @@ const Ma = class extends BasePlugin {
3113
3167
  a3 && this.scrollToIndex(a3.globalPageIndex, t2);
3114
3168
  }
3115
3169
  };
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) => {
3170
+ $a.id = "chapter-scroll";
3171
+ let Ta = $a;
3172
+ const za = ["data-global-page-index", "data-chapter-id", "data-local-page-index"], Da = /* @__PURE__ */ ((e14, t2) => {
3119
3173
  const a3 = e14.__vccOpts || e14;
3120
3174
  for (const [s9, i2] of t2) a3[s9] = i2;
3121
3175
  return a3;
3122
3176
  })(/* @__PURE__ */ defineComponent({ __name: "ChapterScroller", props: { class: {}, style: {} }, setup(e14) {
3123
- const { provides: t2 } = useCapability(Sa.id), o = ref(null), f = ref(null);
3177
+ const { provides: t2 } = useCapability(Ta.id), o = ref(null), f = ref(null);
3124
3178
  let m = null;
3125
3179
  const v = () => {
3126
3180
  null == m || m(), m = null, t2.value && (t2.value.registerViewport(o.value), m = t2.value.onLayoutChange((e15) => {
@@ -3132,11 +3186,11 @@ const xa = ["data-global-page-index", "data-chapter-id", "data-local-page-index"
3132
3186
  null == m || m(), null == (e15 = t2.value) || e15.registerViewport(null);
3133
3187
  }), watch(t2, v), (e15, t3) => {
3134
3188
  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);
3189
+ 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
3190
  };
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) {
3191
+ } }), [["__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"])) });
3192
+ const Ga = { kind: "first-wins" };
3193
+ function Na(e14, t2, a3) {
3140
3194
  if (1 === t2.length) return t2[0].chapterId;
3141
3195
  switch (a3.kind) {
3142
3196
  case "first-wins":
@@ -3154,7 +3208,7 @@ function za(e14, t2, a3) {
3154
3208
  return a3.resolve(e14, t2);
3155
3209
  }
3156
3210
  }
3157
- let Ta = class {
3211
+ let Aa = class {
3158
3212
  constructor(e14) {
3159
3213
  this._pages = e14, this._byChapter = /* @__PURE__ */ new Map(), this._byGlobalNumber = /* @__PURE__ */ new Map();
3160
3214
  for (const t2 of e14) {
@@ -3188,8 +3242,8 @@ let Ta = class {
3188
3242
  return a3 ? this._pages.indexOf(a3) : -1;
3189
3243
  }
3190
3244
  };
3191
- function Da(e14, t2 = $a) {
3192
- const a3 = (function(e15, t3 = $a) {
3245
+ function Va(e14, t2 = Ga) {
3246
+ const a3 = (function(e15, t3 = Ga) {
3193
3247
  const a4 = /* @__PURE__ */ new Map();
3194
3248
  for (const i3 of e15.chapters) {
3195
3249
  const [e16, t4] = i3.globalPageRange;
@@ -3199,7 +3253,7 @@ function Da(e14, t2 = $a) {
3199
3253
  }
3200
3254
  }
3201
3255
  const s10 = /* @__PURE__ */ new Map();
3202
- for (const [i3, o2] of a4) s10.set(i3, za(i3, o2, t3));
3256
+ for (const [i3, o2] of a4) s10.set(i3, Na(i3, o2, t3));
3203
3257
  return s10;
3204
3258
  })(e14, t2), s9 = /* @__PURE__ */ new Map();
3205
3259
  for (const n2 of e14.chapters) s9.set(n2.chapterId, n2);
@@ -3211,14 +3265,14 @@ function Da(e14, t2 = $a) {
3211
3265
  const [i3] = t3.globalPageRange, [l] = t3.localPageRange, h2 = l + (n2 - i3);
3212
3266
  o.push({ globalPageIndex: r2++, globalPageNumber: n2, chapterId: e15, localPageIndex: h2 });
3213
3267
  }
3214
- return new Ta(o);
3268
+ return new Aa(o);
3215
3269
  }
3216
- const Oa = class e10 extends BasePlugin {
3270
+ const Ea = class e10 extends BasePlugin {
3217
3271
  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);
3272
+ 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
3273
  }
3220
3274
  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) => {
3275
+ if (this.config = e14, this.passwordProvider = e14.passwordProvider, this.overlapStrategy = e14.overlapStrategy ?? Ga, this.documentManagerUnsubs.push(this.documentManager.provides().onDocumentOpened((e15) => {
3222
3276
  this.isOwnedChapter(e15.id) && (this.passwordAttempts.delete(e15.id), this.updateStatus(e15.id, "loaded"));
3223
3277
  }), this.documentManager.provides().onDocumentClosed((e15) => {
3224
3278
  this.isOwnedChapter(e15) && this.updateStatus(e15, "closed");
@@ -3253,7 +3307,7 @@ const Oa = class e10 extends BasePlugin {
3253
3307
  const s9 = new Set(this.chapterStatus.keys()), i2 = new Set(t2.chapters.map((e14) => e14.chapterId));
3254
3308
  for (const e14 of s9) i2.has(e14) || (this.closeChapter(e14), this.chapterStatus.delete(e14));
3255
3309
  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();
3310
+ this.manifest = t2, this.virtualPageMap = Va(t2, this.overlapStrategy), this.manifestChange$.emit({ manifest: t2, map: this.virtualPageMap }), this.eagerPrefetchFromManifest();
3257
3311
  }
3258
3312
  eagerPrefetchFromManifest() {
3259
3313
  const e14 = this.config.prefetchChapters ?? 0;
@@ -3391,10 +3445,10 @@ const Oa = class e10 extends BasePlugin {
3391
3445
  this.chapterStatus.get(e14) !== t2 && (this.chapterStatus.set(e14, t2), this.statusChange$.emit({ chapterId: e14, status: t2, ..."error" === t2 && a3 ? { error: { message: a3 } } : {} }));
3392
3446
  }
3393
3447
  };
3394
- Oa.id = "chapter-manager";
3395
- let Ga = Oa;
3396
- const Na = { kind: "first-wins" };
3397
- function Aa(e14, t2, a3) {
3448
+ Ea.id = "chapter-manager";
3449
+ let _a = Ea;
3450
+ const Ra = { kind: "first-wins" };
3451
+ function Fa(e14, t2, a3) {
3398
3452
  if (1 === t2.length) return t2[0].chapterId;
3399
3453
  switch (a3.kind) {
3400
3454
  case "first-wins":
@@ -3412,7 +3466,7 @@ function Aa(e14, t2, a3) {
3412
3466
  return a3.resolve(e14, t2);
3413
3467
  }
3414
3468
  }
3415
- class Va {
3469
+ class Ua {
3416
3470
  constructor(e14) {
3417
3471
  this._pages = e14, this._byChapter = /* @__PURE__ */ new Map(), this._byGlobalNumber = /* @__PURE__ */ new Map();
3418
3472
  for (const t2 of e14) {
@@ -3446,8 +3500,8 @@ class Va {
3446
3500
  return a3 ? this._pages.indexOf(a3) : -1;
3447
3501
  }
3448
3502
  }
3449
- function Ea(e14, t2 = Na) {
3450
- const a3 = (function(e15, t3 = Na) {
3503
+ function qa(e14, t2 = Ra) {
3504
+ const a3 = (function(e15, t3 = Ra) {
3451
3505
  const a4 = /* @__PURE__ */ new Map();
3452
3506
  for (const i3 of e15.chapters) {
3453
3507
  const [e16, t4] = i3.globalPageRange;
@@ -3457,7 +3511,7 @@ function Ea(e14, t2 = Na) {
3457
3511
  }
3458
3512
  }
3459
3513
  const s10 = /* @__PURE__ */ new Map();
3460
- for (const [i3, o2] of a4) s10.set(i3, Aa(i3, o2, t3));
3514
+ for (const [i3, o2] of a4) s10.set(i3, Fa(i3, o2, t3));
3461
3515
  return s10;
3462
3516
  })(e14, t2), s9 = /* @__PURE__ */ new Map();
3463
3517
  for (const n2 of e14.chapters) s9.set(n2.chapterId, n2);
@@ -3469,14 +3523,14 @@ function Ea(e14, t2 = Na) {
3469
3523
  const [i3] = t3.globalPageRange, [l] = t3.localPageRange, h2 = l + (n2 - i3);
3470
3524
  o.push({ globalPageIndex: r2++, globalPageNumber: n2, chapterId: e15, localPageIndex: h2 });
3471
3525
  }
3472
- return new Va(o);
3526
+ return new Ua(o);
3473
3527
  }
3474
- const _a = class e11 extends BasePlugin {
3528
+ const Wa = class e11 extends BasePlugin {
3475
3529
  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);
3530
+ 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
3531
  }
3478
3532
  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) => {
3533
+ if (this.config = e14, this.passwordProvider = e14.passwordProvider, this.overlapStrategy = e14.overlapStrategy ?? Ra, this.documentManagerUnsubs.push(this.documentManager.provides().onDocumentOpened((e15) => {
3480
3534
  this.isOwnedChapter(e15.id) && (this.passwordAttempts.delete(e15.id), this.updateStatus(e15.id, "loaded"));
3481
3535
  }), this.documentManager.provides().onDocumentClosed((e15) => {
3482
3536
  this.isOwnedChapter(e15) && this.updateStatus(e15, "closed");
@@ -3511,7 +3565,7 @@ const _a = class e11 extends BasePlugin {
3511
3565
  const s9 = new Set(this.chapterStatus.keys()), i2 = new Set(t2.chapters.map((e14) => e14.chapterId));
3512
3566
  for (const e14 of s9) i2.has(e14) || (this.closeChapter(e14), this.chapterStatus.delete(e14));
3513
3567
  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();
3568
+ this.manifest = t2, this.virtualPageMap = qa(t2, this.overlapStrategy), this.manifestChange$.emit({ manifest: t2, map: this.virtualPageMap }), this.eagerPrefetchFromManifest();
3515
3569
  }
3516
3570
  eagerPrefetchFromManifest() {
3517
3571
  const e14 = this.config.prefetchChapters ?? 0;
@@ -3649,9 +3703,9 @@ const _a = class e11 extends BasePlugin {
3649
3703
  this.chapterStatus.get(e14) !== t2 && (this.chapterStatus.set(e14, t2), this.statusChange$.emit({ chapterId: e14, status: t2, ..."error" === t2 && a3 ? { error: { message: a3 } } : {} }));
3650
3704
  }
3651
3705
  };
3652
- _a.id = "chapter-manager";
3653
- let Ra = _a;
3654
- function Fa(e14, t2) {
3706
+ Wa.id = "chapter-manager";
3707
+ let Ha = Wa;
3708
+ function Ba(e14, t2) {
3655
3709
  if (e14 === t2) return true;
3656
3710
  if (e14.totalHeight !== t2.totalHeight || e14.totalWidth !== t2.totalWidth || e14.pageGap !== t2.pageGap || e14.items.length !== t2.items.length) return false;
3657
3711
  for (let a3 = 0; a3 < e14.items.length; a3++) {
@@ -3660,9 +3714,9 @@ function Fa(e14, t2) {
3660
3714
  }
3661
3715
  return true;
3662
3716
  }
3663
- const Ua = class extends BasePlugin {
3717
+ const ja = class extends BasePlugin {
3664
3718
  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);
3719
+ 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
3720
  }
3667
3721
  async initialize(e14) {
3668
3722
  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 +3893,11 @@ const Ua = class extends BasePlugin {
3839
3893
  a3 && this.scrollToIndex(a3.globalPageIndex, t2);
3840
3894
  }
3841
3895
  };
3842
- Ua.id = "chapter-scroll";
3843
- let qa = Ua;
3844
- const Wa = class e12 extends BasePlugin {
3896
+ ja.id = "chapter-scroll";
3897
+ let Za = ja;
3898
+ const Ya = class e12 extends BasePlugin {
3845
3899
  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);
3900
+ 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
3901
  }
3848
3902
  async initialize(t2) {
3849
3903
  if (this.config = t2, t2.callbacks.loadNotes) try {
@@ -3881,7 +3935,7 @@ const Wa = class e12 extends BasePlugin {
3881
3935
  this.notesChange$.emit(this.listAll());
3882
3936
  }
3883
3937
  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 };
3938
+ 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
3939
  }
3886
3940
  async requestCreateFromSelection(e14) {
3887
3941
  if (0 === e14.rectsPdfCoord.length) return null;
@@ -3948,21 +4002,21 @@ const Wa = class e12 extends BasePlugin {
3948
4002
  });
3949
4003
  }
3950
4004
  };
3951
- Wa.id = "note";
3952
- let Ha = Wa;
3953
- function Ba(e14) {
4005
+ Ya.id = "note";
4006
+ let Xa = Ya;
4007
+ function Ka(e14) {
3954
4008
  const t2 = e14[e14.length - 1];
3955
4009
  return { x: t2.origin.x + t2.size.width, y: t2.origin.y + t2.size.height };
3956
4010
  }
3957
- function ja(e14) {
4011
+ function Qa(e14) {
3958
4012
  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
4013
  let h2, d2;
3960
4014
  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
4015
  const c = Math.max(0, o - r2 - 2);
3962
4016
  return h2 > c && (h2 = c), d2 < 0 && (d2 = 0), { left: h2, top: d2 };
3963
4017
  }
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);
4018
+ 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) {
4019
+ const o = e14, { provides: r2 } = useCapability(Xa.id), d2 = ref([]), g2 = ref(null), f = ref(null);
3966
4020
  watch(r2, (e15) => {
3967
4021
  if (e15) return e15.onNotesChange((e16) => {
3968
4022
  d2.value = e16.filter((e17) => e17.chapterId === o.chapterId && e17.localPageIndex === o.localPageIndex);
@@ -3986,25 +4040,25 @@ const Za = { key: 0, style: { position: "absolute", inset: "0", pointerEvents: "
3986
4040
  return ((_a2 = o.ui) == null ? void 0 : _a2.highlightColor) ?? "rgba(245, 158, 11, 0.08)";
3987
4041
  });
3988
4042
  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) {
4043
+ 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
4044
  let s10 = 1 / 0, i3 = 1 / 0, o2 = -1 / 0, r4 = -1 / 0;
3991
4045
  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
4046
  return { left: s10, top: i3, width: o2 - s10, height: r4 - i3 };
3993
4047
  })(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
4048
  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
4049
  }
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(() => {
4050
+ 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(() => {
4051
+ }, ["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
4052
  }, ["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
4053
  var _a2;
4000
4054
  (_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) => {
4055
+ })(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
4056
  var _a2;
4003
4057
  return a4 = e15.noteId, (_a2 = r2.value) == null ? void 0 : _a2.requestDeleteNote(a4), void (f.value = null);
4004
4058
  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);
4059
+ } }, " 删除 ", 8, is)], 36)) : createCommentVNode("", true)], 44, ts)) : createCommentVNode("", true)], 64))), 128))])) : createCommentVNode("", true);
4060
+ } }), 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) {
4061
+ const o = e14, { provides: r2 } = useCapability(Yt.id), d2 = ref([]), g2 = ref(null), f = ref(null);
4008
4062
  function P() {
4009
4063
  const e15 = r2.value;
4010
4064
  e15 && (d2.value = e15.listBookmarks().filter((e16) => e16.anchor.chapterId === o.chapterId && e16.anchor.localPageIndex === o.localPageIndex));
@@ -4029,27 +4083,27 @@ const Za = { key: 0, style: { position: "absolute", inset: "0", pointerEvents: "
4029
4083
  const { left: t2, top: a3 } = (function(e16) {
4030
4084
  var _a2;
4031
4085
  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 });
4086
+ 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
4087
  })(e15);
4034
4088
  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
4089
  }
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(() => {
4090
+ 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(() => {
4091
+ }, ["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
4092
  }, ["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
4093
  const t4 = r2.value;
4040
4094
  if (!t4) return;
4041
4095
  await t4.requestRemoveBookmark(e16) && (g2.value = null);
4042
- })(e15.id) }, " 删除书签 ", 8, ss)], 512)) : createCommentVNode("", true)], 36))), 128))])) : createCommentVNode("", true);
4096
+ })(e15.id) }, " 删除书签 ", 8, ls)], 512)) : createCommentVNode("", true)], 36))), 128))])) : createCommentVNode("", true);
4043
4097
  } });
4044
- function os(e14) {
4098
+ function ds(e14) {
4045
4099
  return e14.chapterId;
4046
4100
  }
4047
- function rs(e14, t2) {
4101
+ function cs(e14, t2) {
4048
4102
  e14.wait(t2, () => {
4049
4103
  });
4050
4104
  }
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) {
4105
+ 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" };
4106
+ function gs(e14, a3) {
4053
4107
  var _a2, _b;
4054
4108
  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
4109
  return computed(() => {
@@ -4058,17 +4112,17 @@ function hs(e14, a3) {
4058
4112
  const { context: a4, rect: o2, placement: r3, menuWrapperProps: n2, selected: l } = e15;
4059
4113
  if (!l || "annotation" !== a4.type) return h$1("span", n2);
4060
4114
  if (a4.structurallyLocked) return h$1("span", n2);
4061
- if (h2 = a4.annotation.object.type, !xe.has(h2)) return h$1("span", n2);
4115
+ if (h2 = a4.annotation.object.type, !ke.has(h2)) return h$1("span", n2);
4062
4116
  var h2;
4063
4117
  const d2 = s9.value.forDocument(t2), { pageIndex: c, id: u } = a4.annotation.object, p2 = () => {
4064
4118
  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])])]);
4119
+ }, 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 }, "删除");
4120
+ return h$1("div", n2, [h$1("div", { style: g2 }, [h$1("div", { style: us, role: "toolbar", "aria-label": "划线标注" }, [f])])]);
4067
4121
  };
4068
4122
  });
4069
4123
  }
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));
4124
+ 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) {
4125
+ const a3 = e14, i2 = computed(() => ds(a3.item));
4072
4126
  !(function(e15) {
4073
4127
  const { provides: t2 } = useCapability(DocumentManagerPlugin.id);
4074
4128
  watch([t2, e15], ([e16, t3]) => {
@@ -4080,14 +4134,15 @@ const ds = /* @__PURE__ */ defineComponent({ __name: "ChapterPageSurface", props
4080
4134
  return (_b = (_a2 = o.value) == null ? void 0 : _a2.getDocument(i2.value)) == null ? void 0 : _b.pages[a3.item.localPageIndex];
4081
4135
  });
4082
4136
  function d2(e15, t2) {
4137
+ var _a2, _b, _c, _d;
4083
4138
  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 };
4139
+ 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) => {
4140
+ var _a3;
4141
+ 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
4142
  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
4143
  if (!r2.value) return;
4089
4144
  const a5 = r2.value.getHighlightRectsForPage(e15.localPageIndex, t2);
4090
- rs(r2.value.getSelectedText(t2), (t3) => {
4145
+ cs(r2.value.getSelectedText(t2), (t3) => {
4091
4146
  s9((function(e16, t4, a6) {
4092
4147
  return { chapterId: e16.chapterId, localPageIndex: e16.localPageIndex, globalPageIndex: e16.globalPageIndex, globalPageNumber: e16.globalPageNumber, rectsPdfCoord: t4, selectedText: a6 };
4093
4148
  })(e15, a5, t3.join("\n")));
@@ -4102,7 +4157,7 @@ const ds = /* @__PURE__ */ defineComponent({ __name: "ChapterPageSurface", props
4102
4157
  if (a4) return a4;
4103
4158
  }
4104
4159
  return t2.defaultMenu;
4105
- }), u = hs(i2, a3.features), p2 = computed(() => (function(e15, t2) {
4160
+ }), u = gs(i2, a3.features), p2 = computed(() => (function(e15, t2) {
4106
4161
  if (e15 || t2) return (a4) => {
4107
4162
  if (e15) {
4108
4163
  const t3 = e15(a4);
@@ -4114,10 +4169,10 @@ const ds = /* @__PURE__ */ defineComponent({ __name: "ChapterPageSurface", props
4114
4169
  var _a2;
4115
4170
  return (_a2 = a3.renderPageOverlay) == null ? void 0 : _a2.call(a3, a3.item);
4116
4171
  });
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"]));
4172
+ 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
4173
  } });
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(() => {
4174
+ const ms = /* @__PURE__ */ defineComponent({ __name: "HoverBookmarkLayer", props: { item: {}, pdfPageWidth: {}, pdfPageHeight: {}, cssPageWidth: {}, cssPageHeight: {}, hoverUi: {} }, setup(e14) {
4175
+ 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
4176
  var _a2;
4122
4177
  return ((_a2 = o.hoverUi) == null ? void 0 : _a2.iconSize) ?? 16;
4123
4178
  }), y = computed(() => P.value ?? f.value);
@@ -4174,16 +4229,16 @@ const cs = /* @__PURE__ */ defineComponent({ __name: "HoverBookmarkLayer", props
4174
4229
  });
4175
4230
  const k2 = computed(() => {
4176
4231
  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;
4232
+ 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
4233
  }), L2 = computed(() => {
4179
4234
  const e15 = k2.value, t2 = u.value;
4180
- return !(!e15 || !t2) && t2.listBookmarks().some((t3) => Wt(t3.anchor, e15));
4235
+ return !(!e15 || !t2) && t2.listBookmarks().some((t3) => Ht$1(t3.anchor, e15));
4181
4236
  });
4182
4237
  function $2() {
4183
4238
  const e15 = u.value, t2 = k2.value;
4184
4239
  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
4240
  }
4186
- const z = computed(() => {
4241
+ const T2 = computed(() => {
4187
4242
  const e15 = y.value, t2 = e15 == null ? void 0 : e15[e15.length - 1];
4188
4243
  if (!t2 || !o.pdfPageWidth) return null;
4189
4244
  const a3 = o.cssPageWidth / o.pdfPageWidth, s9 = o.cssPageHeight / o.pdfPageHeight, i2 = w.value;
@@ -4191,123 +4246,153 @@ const cs = /* @__PURE__ */ defineComponent({ __name: "HoverBookmarkLayer", props
4191
4246
  });
4192
4247
  return (t2, a3) => {
4193
4248
  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);
4249
+ 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
4250
  };
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 }) {
4197
- 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
- function w(e15, t2 = false) {
4199
- 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
- }
4201
- 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() {
4251
+ } }), vs = { key: 0, width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", "aria-hidden": "" }, bs = { key: 1, 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" }, ws = { key: 1, d: "M6 22h16", stroke: "#dc2626", "stroke-width": "2.2", "stroke-linecap": "round" }, ys = { 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" }, Cs = { key: 3, d: "M5 14h18", stroke: "#dc2626", "stroke-width": "2.2", "stroke-linecap": "round" }, Is = { key: 2, width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", "aria-hidden": "" }, Ms = /* @__PURE__ */ defineComponent({ __name: "SelectionToolbarIcons", props: { kind: {} }, setup: (e14) => (t2, a3) => "copy" === e14.kind ? (openBlock(), createElementBlock("svg", vs, [...a3[0] || (a3[0] = [createElementVNode("rect", { x: "8.5", y: "8.5", width: "11", height: "13", rx: "2.25", fill: "#f1f5f9", stroke: "#94a3b8", "stroke-width": "1.35" }, null, -1), createElementVNode("rect", { x: "4.5", y: "3.5", width: "11", height: "13", rx: "2.25", fill: "#ffffff", stroke: "#334155", "stroke-width": "1.5" }, null, -1), createElementVNode("path", { d: "M7.5 7h5.5a1.5 1.5 0 0 1 1.5 1.5V14", stroke: "#64748b", "stroke-width": "1.2", "stroke-linecap": "round" }, null, -1)])])) : "note" !== e14.kind ? (openBlock(), createElementBlock("svg", bs, ["highlight" === e14.kind ? (openBlock(), createElementBlock("rect", Ps)) : createCommentVNode("", true), a3[1] || (a3[1] = createElementVNode("text", { x: "14", y: "19", "text-anchor": "middle", "font-size": "15", "font-weight": "700", "font-family": "system-ui, -apple-system, sans-serif", fill: "#0f172a" }, " A ", -1)), "underline" === e14.kind ? (openBlock(), createElementBlock("path", ws)) : "squiggly" === e14.kind ? (openBlock(), createElementBlock("path", ys)) : "strikeout" === e14.kind ? (openBlock(), createElementBlock("path", Cs)) : createCommentVNode("", true)])) : (openBlock(), createElementBlock("svg", Is, [...a3[2] || (a3[2] = [createElementVNode("path", { d: "M8 3h8l4 4v14H8V3z", fill: "#fef3c7", stroke: "#d97706", "stroke-width": "1.2", "stroke-linejoin": "round" }, null, -1), createElementVNode("path", { d: "M16 3v4h4", stroke: "#d97706", "stroke-width": "1.2" }, null, -1), createElementVNode("path", { d: "M10 12h6M10 16h4", stroke: "#92400e", "stroke-width": "1.2", "stroke-linecap": "round" }, null, -1)])])) }), Ss = ["title", "aria-label", "onMouseenter", "onClick"], xs = ["title", "onMouseenter", "onClick"], ks = { style: { "font-size": "11px", "font-weight": "600" } }, Ls = /* @__PURE__ */ defineComponent({ __name: "SelectionToolbarCard", props: { placementAbove: { type: Boolean }, anchorHeight: {}, hiddenBuiltinActions: {}, extraActions: {}, renderCopyIcon: { type: Function } }, emits: ["action"], setup(e14, { emit: s9 }) {
4252
+ const i2 = e14, o = s9, r2 = [{ id: "highlight", label: "高亮背景" }, { id: "underline", label: "下划线" }, { id: "squiggly", label: "波浪线" }, { id: "strikeout", label: "删除线" }], d2 = computed(() => new Set(i2.hiddenBuiltinActions ?? [])), g2 = computed(() => !d2.value.has("copy")), m = computed(() => r2.filter((e15) => !d2.value.has(e15.id))), v = computed(() => !d2.value.has("note")), P = computed(() => [...i2.extraActions ?? []].sort((e15, t2) => (e15.order ?? 0) - (t2.order ?? 0))), w = computed(() => m.value.length > 0 || P.value.length > 0), M = ref(null), S = 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)" }));
4253
+ function x(e15, t2 = false) {
4254
+ return { display: "flex", alignItems: "center", justifyContent: "center", width: "32px", height: "32px", padding: 0, margin: 0, border: "none", borderRadius: "8px", background: M.value === e15 ? t2 ? "#fffbeb" : "#f1f5f9" : "transparent", color: t2 ? "#b45309" : "#334155", cursor: "pointer", flexShrink: 0, WebkitAppearance: "none", appearance: "none" };
4255
+ }
4256
+ const k2 = { width: "1px", height: "20px", margin: "0 4px", background: "rgba(15, 23, 42, 0.1)", flexShrink: 0 };
4257
+ return (t2, a3) => (openBlock(), createElementBlock("div", { role: "toolbar", "aria-label": "选区工具", style: normalizeStyle(S.value) }, [g2.value ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [createElementVNode("button", { type: "button", title: "复制", "aria-label": "复制", style: normalizeStyle(x("copy")), onMouseenter: a3[0] || (a3[0] = (e15) => M.value = "copy"), onMouseleave: a3[1] || (a3[1] = (e15) => M.value = null), onClick: a3[2] || (a3[2] = (e15) => o("action", "copy")) }, [e14.renderCopyIcon ? (openBlock(), createBlock(resolveDynamicComponent(e14.renderCopyIcon), { key: 0 })) : (openBlock(), createBlock(Ms, { key: 1, kind: "copy" }))], 36), w.value ? (openBlock(), createElementBlock("span", { key: 0, style: k2, "aria-hidden": "" })) : createCommentVNode("", true)], 64)) : createCommentVNode("", true), (openBlock(true), createElementBlock(Fragment, null, renderList(m.value, (e15) => (openBlock(), createElementBlock("button", { key: e15.id, type: "button", title: e15.label, "aria-label": e15.label, style: normalizeStyle(x(e15.id)), onMouseenter: (t3) => M.value = e15.id, onMouseleave: a3[3] || (a3[3] = (e16) => M.value = null), onClick: (t3) => o("action", e15.id) }, [createVNode(Ms, { kind: e15.id }, null, 8, ["kind"])], 44, Ss))), 128)), (openBlock(true), createElementBlock(Fragment, null, renderList(P.value, (e15) => (openBlock(), createElementBlock("button", { key: e15.id, type: "button", title: e15.label, style: normalizeStyle(x(e15.id)), onMouseenter: (t3) => M.value = e15.id, onMouseleave: a3[4] || (a3[4] = (e16) => M.value = null), onClick: (t3) => o("action", e15.id) }, [createElementVNode("span", ks, toDisplayString(e15.label.slice(0, 2)), 1)], 44, xs))), 128)), v.value ? (openBlock(), createElementBlock(Fragment, { key: 1 }, [w.value || g2.value ? (openBlock(), createElementBlock("span", { key: 0, style: k2, "aria-hidden": "" })) : createCommentVNode("", true), createElementVNode("button", { type: "button", title: "添加笔记", "aria-label": "添加笔记", style: normalizeStyle(x("note", true)), onMouseenter: a3[5] || (a3[5] = (e15) => M.value = "note"), onMouseleave: a3[6] || (a3[6] = (e15) => M.value = null), onClick: a3[7] || (a3[7] = (e15) => o("action", "note")) }, [createVNode(Ms, { kind: "note" })], 36)], 64)) : createCommentVNode("", true)], 4));
4258
+ } }), $s = { highlight: "highlight", underline: "underline", squiggly: "squiggly", strikeout: "strikeout" };
4259
+ function Ts(e14, a3) {
4260
+ const s9 = computed(() => {
4261
+ var _a2;
4262
+ return (_a2 = e14()) == null ? void 0 : _a2.selectionToolbar;
4263
+ }), i2 = computed(() => {
4264
+ var _a2, _b;
4265
+ return false !== ((_b = (_a2 = e14()) == null ? void 0 : _a2.markup) == null ? void 0 : _b.enabled);
4266
+ }), o = computed(() => {
4267
+ var _a2, _b;
4268
+ return false !== ((_b = (_a2 = e14()) == null ? void 0 : _a2.notes) == null ? void 0 : _b.enabled);
4269
+ }), r2 = computed(() => {
4270
+ var _a2, _b;
4271
+ return !((_b = (_a2 = s9.value) == null ? void 0 : _a2.hiddenBuiltinActions) == null ? void 0 : _b.includes("copy"));
4272
+ }), { provides: n2 } = useCapability(SelectionPlugin.id), { provides: l } = useCapability(AnnotationPlugin.id), { provides: h2 } = useCapability(Ct$1.id);
4273
+ return computed(() => {
4274
+ var _a2, _b, _c;
4275
+ if (false !== ((_a2 = s9.value) == null ? void 0 : _a2.enabled) && (i2.value || o.value || r2.value || ((_c = (_b = s9.value) == null ? void 0 : _b.extraActions) == null ? void 0 : _c.length))) return (t2) => {
4276
+ const d2 = ds(t2.item);
4277
+ return (c) => {
4278
+ var _a3, _b2, _c2, _d;
4279
+ return h$1("div", c.menuWrapperProps, h$1(Ls, { placementAbove: !!((_a3 = c.placement) == null ? void 0 : _a3.suggestTop), anchorHeight: c.rect.size.height, hiddenBuiltinActions: (_b2 = s9.value) == null ? void 0 : _b2.hiddenBuiltinActions, extraActions: (_c2 = s9.value) == null ? void 0 : _c2.extraActions, renderCopyIcon: (_d = s9.value) == null ? void 0 : _d.renderCopyIcon, onAction: (s10) => {
4280
+ var _a4, _b3, _c3;
4281
+ if ("copy" !== s10) if ("highlight" !== s10 && "underline" !== s10 && "squiggly" !== s10 && "strikeout" !== s10) {
4282
+ if ("note" === s10) {
4283
+ if (!n2.value || !h2.value || !o.value) return;
4284
+ const e15 = n2.value.getHighlightRectsForPage(t2.item.localPageIndex, d2);
4285
+ return void cs(n2.value.getSelectedText(d2), (a4) => {
4286
+ var _a5;
4287
+ (_a5 = h2.value) == null ? void 0 : _a5.requestCreateFromSelection({ chapterId: t2.item.chapterId, localPageIndex: t2.item.localPageIndex, globalPageIndex: t2.item.globalPageIndex, globalPageNumber: t2.item.globalPageNumber, rectsPdfCoord: e15, selectedText: a4.join("\n") });
4288
+ });
4289
+ }
4290
+ (_a4 = a3 == null ? void 0 : a3.onExtraAction) == null ? void 0 : _a4.call(a3, s10, t2);
4291
+ } else {
4292
+ if (!n2.value || !l.value || !i2.value) return;
4293
+ xe(d2, $s[s10], l.value, n2.value, (_c3 = (_b3 = e14()) == null ? void 0 : _b3.markup) == null ? void 0 : _c3.styles);
4294
+ }
4295
+ else {
4296
+ if (!n2.value || !r2.value) return;
4297
+ cs(n2.value.getSelectedText(d2), (e15) => {
4298
+ !(async function(e16) {
4299
+ var _a5;
4300
+ const t3 = e16.trim();
4301
+ if (!t3) return false;
4302
+ try {
4303
+ if ("undefined" != typeof navigator && ((_a5 = navigator.clipboard) == null ? void 0 : _a5.writeText)) return await navigator.clipboard.writeText(t3), true;
4304
+ } catch {
4305
+ }
4306
+ if ("undefined" == typeof document) return false;
4307
+ try {
4308
+ const e17 = document.createElement("textarea");
4309
+ e17.value = t3, e17.setAttribute("readonly", ""), e17.style.position = "fixed", e17.style.left = "-9999px", document.body.appendChild(e17), e17.select();
4310
+ const a4 = document.execCommand("copy");
4311
+ return document.body.removeChild(e17), a4;
4312
+ } catch {
4313
+ return false;
4314
+ }
4315
+ })(e15.join("\n"));
4316
+ });
4317
+ }
4318
+ } }));
4319
+ };
4320
+ };
4321
+ });
4322
+ }
4323
+ const zs = /* @__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) {
4324
+ const a3 = e14, s9 = computed(() => a3.features), { hostRef: i2 } = ya(s9), o = computed(() => {
4325
+ var _a2, _b;
4326
+ return { background: ((_b = (_a2 = a3.features) == null ? void 0 : _a2.scrollViewport) == null ? void 0 : _b.background) ?? ye$1 };
4327
+ }), r2 = (function() {
4206
4328
  const { registry: e15 } = useRegistry();
4207
4329
  return computed(() => {
4208
4330
  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);
4331
+ 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
4332
  return t2 ? (e16) => t2.createNoteFromSelection(e16) : null;
4211
4333
  });
4212
- })(), r2 = (function() {
4334
+ })(), c = (function() {
4213
4335
  const { registry: e15 } = useRegistry();
4214
4336
  return computed(() => {
4215
4337
  var _a2;
4216
- return !!((_a2 = e15.value) == null ? void 0 : _a2.getPlugin(yt$1.id));
4338
+ return !!((_a2 = e15.value) == null ? void 0 : _a2.getPlugin(Ct$1.id));
4217
4339
  });
4218
- })(), c = (function() {
4340
+ })(), u = (function() {
4219
4341
  const { registry: e15 } = useRegistry();
4220
4342
  return computed(() => {
4221
4343
  var _a2;
4222
- return !!((_a2 = e15.value) == null ? void 0 : _a2.getPlugin(Zt.id));
4344
+ return !!((_a2 = e15.value) == null ? void 0 : _a2.getPlugin(Yt.id));
4223
4345
  });
4224
- })(), u = computed(() => {
4346
+ })(), p2 = computed(() => {
4225
4347
  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);
4348
+ return a3.showNoteMarkers && c.value && false !== ((_b = (_a2 = a3.features) == null ? void 0 : _a2.notes) == null ? void 0 : _b.enabled);
4230
4349
  }), f = computed(() => {
4231
4350
  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) {
4234
- const s10 = computed(() => {
4235
- var _a2;
4236
- return (_a2 = e15()) == null ? void 0 : _a2.selectionToolbar;
4237
- }), i3 = computed(() => {
4238
- var _a2, _b;
4239
- return false !== ((_b = (_a2 = e15()) == null ? void 0 : _a2.markup) == null ? void 0 : _b.enabled);
4240
- }), o2 = computed(() => {
4241
- var _a2, _b;
4242
- 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);
4244
- return computed(() => {
4245
- var _a2, _b, _c;
4246
- 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);
4248
- return (d2) => {
4249
- 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) => {
4251
- var _a4, _b3, _c3;
4252
- if ("highlight" !== s11 && "underline" !== s11 && "squiggly" !== s11 && "strikeout" !== s11) {
4253
- if ("note" === s11) {
4254
- if (!r3.value || !l.value || !o2.value) return;
4255
- const e16 = r3.value.getHighlightRectsForPage(t2.item.localPageIndex, h2);
4256
- return void rs(r3.value.getSelectedText(h2), (a5) => {
4257
- var _a5;
4258
- (_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
- });
4260
- }
4261
- (_a4 = a4 == null ? void 0 : a4.onExtraAction) == null ? void 0 : _a4.call(a4, s11, t2);
4262
- } else {
4263
- 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);
4265
- }
4266
- } }));
4267
- };
4268
- };
4269
- });
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;
4351
+ return a3.showBookmarkMarkers && u.value && false !== ((_b = (_a2 = a3.features) == null ? void 0 : _a2.bookmarks) == null ? void 0 : _b.enabled);
4352
+ }), v = computed(() => {
4353
+ var _a2, _b;
4354
+ return u.value && false !== ((_b = (_a2 = a3.features) == null ? void 0 : _a2.bookmarks) == null ? void 0 : _b.enabled);
4355
+ }), b = Ts(() => a3.features, { onExtraAction: a3.onExtraSelectionAction }), C = computed(() => {
4356
+ if (a3.buildSelectionMenu || b.value) return (e15) => {
4357
+ const t2 = b.value ? b.value(e15) : e15.defaultMenu;
4273
4358
  return a3.buildSelectionMenu ? a3.buildSelectionMenu({ ...e15, defaultMenu: t2 }) : t2;
4274
4359
  };
4275
- }), { provides: C } = useCapability(DocumentManagerPlugin.id);
4276
- function I(e15) {
4360
+ }), { provides: I } = useCapability(DocumentManagerPlugin.id);
4361
+ function x(e15) {
4277
4362
  var _a2;
4278
4363
  const t2 = [];
4279
- if (f.value) {
4364
+ if (v.value) {
4280
4365
  const s11 = (function(e16) {
4281
4366
  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 });
4367
+ const t3 = ds(e16), s12 = (_b = (_a3 = I.value) == null ? void 0 : _a3.getDocument(t3)) == null ? void 0 : _b.pages[e16.localPageIndex];
4368
+ 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
4369
  })(e15);
4285
4370
  s11 && t2.push(s11);
4286
4371
  }
4287
4372
  const s10 = (_a2 = a3.renderPageOverlay) == null ? void 0 : _a2.call(a3, e15);
4288
4373
  if (s10 && t2.push(s10), t2.length) return h$1("div", t2);
4289
4374
  }
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 }) => {
4375
+ 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
4376
  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) {
4377
+ 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"])];
4378
+ }), _: 1 }, 8, ["class", "style"]), renderSlot(t2.$slots, "default")], 6));
4379
+ } }), Ds = { key: 0, style: { display: "flex", flexDirection: "column", height: "100%", minHeight: 0, width: "100%" } }, Os = /* @__PURE__ */ defineComponent({ __name: "ChapterPdfViewer", props: { engine: {}, options: {}, editorOptions: {}, features: {}, className: {}, viewportClassName: {}, onExtraSelectionAction: { type: Function } }, setup(e14) {
4295
4380
  const a3 = e14, s9 = computed(() => (function(e15) {
4296
- if (e15.options) return ha(e15.options);
4381
+ if (e15.options) return da(e15.options);
4297
4382
  if (!e15.editorOptions) throw new Error("ChapterPdfViewer: 请传入 `options`(推荐),或同时传入 `editorOptions` 与 `features`");
4298
- const t2 = Le(e15.features), { plugins: a4 } = oa({ ...e15.editorOptions, features: t2 });
4383
+ const t2 = $e(e15.features), { plugins: a4 } = ra({ ...e15.editorOptions, features: t2 });
4299
4384
  return { plugins: a4, features: t2, editorOptions: { ...e15.editorOptions, features: t2 } };
4300
4385
  })({ 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) => {
4386
+ 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", Ds, [renderSlot(t2.$slots, "prepend"), createVNode(zs, { 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));
4387
+ } }), Gs = { class: "chapter-tree-row" }, Ns = ["aria-expanded"], As = { key: 1, class: "chapter-tree-toggle-spacer", "aria-hidden": "" }, Vs = { class: "chapter-tree-label" }, Es = { class: "chapter-tree-meta" }, _s = { key: 0 }, Rs = (e14, t2) => {
4303
4388
  const a3 = e14.__vccOpts || e14;
4304
4389
  for (const [s9, i2] of t2) a3[s9] = i2;
4305
4390
  return a3;
4306
- }, Gs = /* @__PURE__ */ Os(/* @__PURE__ */ defineComponent({ __name: "ChapterTreeItem", props: { node: {}, depth: {}, activeChapterId: {}, chapterStatus: {} }, emits: ["select"], setup(e14) {
4391
+ }, Fs = /* @__PURE__ */ Rs(/* @__PURE__ */ defineComponent({ __name: "ChapterTreeItem", props: { node: {}, depth: {}, activeChapterId: {}, chapterStatus: {} }, emits: ["select"], setup(e14) {
4307
4392
  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({});
4393
+ return (t2, a3) => (openBlock(), createElementBlock("li", null, [createElementVNode("div", Gs, [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, Ns)) : (openBlock(), createElementBlock("span", As)), 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", Vs, toDisplayString(e14.node.title), 1), createElementVNode("div", Es, [createElementVNode("span", null, " 第 " + toDisplayString(e14.node.startPage) + toDisplayString(e14.node.endPage !== e14.node.startPage ? `–${e14.node.endPage}` : "") + " 页 ", 1), g2.value ? (openBlock(), createElementBlock("span", _s, toDisplayString(s9[p2.value]), 1)) : createCommentVNode("", true)])], 2)]), r2.value && h2.value ? (openBlock(), createBlock(Us, { 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)]));
4394
+ } }), [["__scopeId", "data-v-315bbf7a"]]), Us = /* @__PURE__ */ Rs(/* @__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(Fs, { 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"]]), qs = { class: "chapter-tree" }, Ws = { class: "chapter-tree-nav", "aria-label": "章节目录" }, Hs = /* @__PURE__ */ Rs(/* @__PURE__ */ defineComponent({ __name: "ChapterTreePanel", props: { tree: {}, activeChapterId: {} }, emits: ["active-chapter-change"], setup(e14, { emit: t2 }) {
4395
+ const o = e14, r2 = t2, { provides: h2 } = useCapability(at$1.id), { provides: d2 } = useCapability(We.id), u = ref({});
4311
4396
  function p2() {
4312
4397
  if (!d2.value) return;
4313
4398
  const e15 = {}, t3 = (a3) => {
@@ -4324,7 +4409,7 @@ const Ms = /* @__PURE__ */ defineComponent({ __name: "PdfChapterViewport", props
4324
4409
  }
4325
4410
  return watch(d2, (e15) => {
4326
4411
  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"])])]));
4412
+ }, { immediate: true }), onBeforeUnmount(() => g2 == null ? void 0 : g2()), (t3, a3) => (openBlock(), createElementBlock("aside", qs, [a3[0] || (a3[0] = createElementVNode("h2", { class: "chapter-tree-title" }, "章节目录", -1)), createElementVNode("nav", Ws, [createVNode(Us, { 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
4413
  } }), [["__scopeId", "data-v-d7a0838d"]]);
4329
4414
  const _sfc_main = /* @__PURE__ */ defineComponent({
4330
4415
  __name: "ChapterPdfViewer",
@@ -4338,7 +4423,7 @@ const _sfc_main = /* @__PURE__ */ defineComponent({
4338
4423
  },
4339
4424
  setup(__props) {
4340
4425
  return (_ctx, _cache) => {
4341
- return openBlock(), createBlock(unref(xs), normalizeProps(guardReactiveProps(_ctx.$props)), createSlots({
4426
+ return openBlock(), createBlock(unref(Os), normalizeProps(guardReactiveProps(_ctx.$props)), createSlots({
4342
4427
  default: withCtx(() => [
4343
4428
  renderSlot(_ctx.$slots, "default")
4344
4429
  ]),
@@ -5731,8 +5816,8 @@ const X = class s4 extends BasePlugin {
5731
5816
  };
5732
5817
  X.id = "chapter-manager";
5733
5818
  let Z = X;
5734
- const tt = { kind: "first-wins" };
5735
- function et2(t2, e14, a3) {
5819
+ const tt2 = { kind: "first-wins" };
5820
+ function et(t2, e14, a3) {
5736
5821
  if (1 === e14.length) return e14[0].chapterId;
5737
5822
  switch (a3.kind) {
5738
5823
  case "first-wins":
@@ -5784,8 +5869,8 @@ let at = class {
5784
5869
  return a3 ? this._pages.indexOf(a3) : -1;
5785
5870
  }
5786
5871
  };
5787
- function st(t2, e14 = tt) {
5788
- const a3 = (function(t3, e15 = tt) {
5872
+ function st(t2, e14 = tt2) {
5873
+ const a3 = (function(t3, e15 = tt2) {
5789
5874
  const a4 = /* @__PURE__ */ new Map();
5790
5875
  for (const o2 of t3.chapters) {
5791
5876
  const [t4, e16] = o2.globalPageRange;
@@ -5795,7 +5880,7 @@ function st(t2, e14 = tt) {
5795
5880
  }
5796
5881
  }
5797
5882
  const s10 = /* @__PURE__ */ new Map();
5798
- for (const [o2, r3] of a4) s10.set(o2, et2(o2, r3, e15));
5883
+ for (const [o2, r3] of a4) s10.set(o2, et(o2, r3, e15));
5799
5884
  return s10;
5800
5885
  })(t2, e14), s9 = /* @__PURE__ */ new Map();
5801
5886
  for (const n2 of t2.chapters) s9.set(n2.chapterId, n2);
@@ -5811,10 +5896,10 @@ function st(t2, e14 = tt) {
5811
5896
  }
5812
5897
  const ot = class s5 extends BasePlugin {
5813
5898
  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);
5899
+ 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
5900
  }
5816
5901
  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) => {
5902
+ if (this.config = t2, this.passwordProvider = t2.passwordProvider, this.overlapStrategy = t2.overlapStrategy ?? tt2, this.documentManagerUnsubs.push(this.documentManager.provides().onDocumentOpened((t3) => {
5818
5903
  this.isOwnedChapter(t3.id) && (this.passwordAttempts.delete(t3.id), this.updateStatus(t3.id, "loaded"));
5819
5904
  }), this.documentManager.provides().onDocumentClosed((t3) => {
5820
5905
  this.isOwnedChapter(t3) && this.updateStatus(t3, "closed");
@@ -5998,7 +6083,7 @@ function it(t2, e14) {
5998
6083
  }
5999
6084
  return true;
6000
6085
  }
6001
- const nt2 = class extends BasePlugin {
6086
+ const nt = class extends BasePlugin {
6002
6087
  constructor(t2, a3) {
6003
6088
  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
6089
  }
@@ -6177,8 +6262,8 @@ const nt2 = class extends BasePlugin {
6177
6262
  a3 && this.scrollToIndex(a3.globalPageIndex, e14);
6178
6263
  }
6179
6264
  };
6180
- nt2.id = "chapter-scroll";
6181
- let ht = nt2;
6265
+ nt.id = "chapter-scroll";
6266
+ let ht = nt;
6182
6267
  const dt = class s6 extends BasePlugin {
6183
6268
  constructor(t2, s9) {
6184
6269
  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 +6372,7 @@ const dt = class s6 extends BasePlugin {
6287
6372
  }
6288
6373
  };
6289
6374
  dt.id = "note";
6290
- let lt = dt;
6375
+ let lt2 = dt;
6291
6376
  function ct(t2) {
6292
6377
  const e14 = t2[t2.length - 1];
6293
6378
  return { x: e14.origin.x + e14.size.width, y: e14.origin.y + e14.size.height };
@@ -6345,7 +6430,7 @@ let vt = class {
6345
6430
  return a3 ? this._pages.indexOf(a3) : -1;
6346
6431
  }
6347
6432
  };
6348
- function bt2(t2, e14 = ft) {
6433
+ function bt(t2, e14 = ft) {
6349
6434
  const a3 = (function(t3, e15 = ft) {
6350
6435
  const a4 = /* @__PURE__ */ new Map();
6351
6436
  for (const o2 of t3.chapters) {
@@ -6370,7 +6455,7 @@ function bt2(t2, e14 = ft) {
6370
6455
  }
6371
6456
  return new vt(r2);
6372
6457
  }
6373
- const Pt = class s7 extends BasePlugin {
6458
+ const Pt2 = class s7 extends BasePlugin {
6374
6459
  constructor(t2, s9) {
6375
6460
  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
6461
  }
@@ -6410,7 +6495,7 @@ const Pt = class s7 extends BasePlugin {
6410
6495
  const a3 = new Set(this.chapterStatus.keys()), o = new Set(t2.chapters.map((t3) => t3.chapterId));
6411
6496
  for (const s9 of a3) o.has(s9) || (this.closeChapter(s9), this.chapterStatus.delete(s9));
6412
6497
  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();
6498
+ this.manifest = t2, this.virtualPageMap = bt(t2, this.overlapStrategy), this.manifestChange$.emit({ manifest: t2, map: this.virtualPageMap }), this.eagerPrefetchFromManifest();
6414
6499
  }
6415
6500
  eagerPrefetchFromManifest() {
6416
6501
  const t2 = this.config.prefetchChapters ?? 0;
@@ -6548,8 +6633,8 @@ const Pt = class s7 extends BasePlugin {
6548
6633
  this.chapterStatus.get(t2) !== e14 && (this.chapterStatus.set(t2, e14), this.statusChange$.emit({ chapterId: t2, status: e14, ..."error" === e14 && a3 ? { error: { message: a3 } } : {} }));
6549
6634
  }
6550
6635
  };
6551
- Pt.id = "chapter-manager";
6552
- let wt = Pt;
6636
+ Pt2.id = "chapter-manager";
6637
+ let wt = Pt2;
6553
6638
  const yt = { kind: "first-wins" };
6554
6639
  function It(t2, e14, a3) {
6555
6640
  if (1 === e14.length) return e14[0].chapterId;
@@ -6817,7 +6902,7 @@ function kt(t2, e14) {
6817
6902
  }
6818
6903
  return true;
6819
6904
  }
6820
- const Lt2 = class extends BasePlugin {
6905
+ const Lt = class extends BasePlugin {
6821
6906
  constructor(t2, a3) {
6822
6907
  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
6908
  }
@@ -6996,8 +7081,8 @@ const Lt2 = class extends BasePlugin {
6996
7081
  a3 && this.scrollToIndex(a3.globalPageIndex, e14);
6997
7082
  }
6998
7083
  };
6999
- Lt2.id = "chapter-scroll";
7000
- let $t = Lt2;
7084
+ Lt.id = "chapter-scroll";
7085
+ let $t2 = Lt;
7001
7086
  function Tt(t2) {
7002
7087
  const e14 = t2[t2.length - 1];
7003
7088
  return { x: e14.origin.x + e14.size.width, y: e14.origin.y + e14.size.height };
@@ -7019,7 +7104,7 @@ function Ot(t2, e14) {
7019
7104
  }
7020
7105
  return false;
7021
7106
  }
7022
- async function Gt2(t2, e14, a3) {
7107
+ async function Gt(t2, e14, a3) {
7023
7108
  t2.scrollToGlobalPageIndex(e14), await (function(t3, e15, a4 = 2500) {
7024
7109
  const s9 = t3.getLayout().items.find((t4) => t4.globalPageIndex === e15 && !t4.isPlaceholder);
7025
7110
  return s9 ? Promise.resolve(s9) : new Promise((s10) => {
@@ -7034,7 +7119,7 @@ async function Gt2(t2, e14, a3) {
7034
7119
  }
7035
7120
  const zt = class a2 extends BasePlugin {
7036
7121
  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);
7122
+ 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
7123
  }
7039
7124
  async initialize(t2) {
7040
7125
  var e14;
@@ -7106,7 +7191,7 @@ const zt = class a2 extends BasePlugin {
7106
7191
  const e15 = t3.rectPdfCoord;
7107
7192
  return e15.origin.y + e15.size.height;
7108
7193
  })(e14.anchor);
7109
- await Gt2(a3, s9, o);
7194
+ await Gt(a3, s9, o);
7110
7195
  }
7111
7196
  };
7112
7197
  zt.id = "paragraph-bookmark";
@@ -7116,26 +7201,27 @@ function Ht(t2, e14) {
7116
7201
  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
7202
  }
7118
7203
  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 }) };
7204
+ var e14;
7205
+ 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 });
7206
+ return { markup: a3, bookmarks: s9, notes: o, zoom: r2, scrollViewport: { background: (null == (e14 = void 0) ? void 0 : e14.background) ?? "#f1f5f9" }, selectionToolbar: i2 };
7121
7207
  }
7122
7208
  PdfAnnotationSubtype.HIGHLIGHT, PdfAnnotationSubtype.UNDERLINE, PdfAnnotationSubtype.SQUIGGLY, PdfAnnotationSubtype.STRIKEOUT, PdfAnnotationSubtype.HIGHLIGHT, PdfAnnotationSubtype.UNDERLINE, PdfAnnotationSubtype.SQUIGGLY, PdfAnnotationSubtype.STRIKEOUT;
7123
7209
  Bt();
7124
- const se = 1;
7125
- function oe(t2) {
7210
+ const oe = 1;
7211
+ function re(t2) {
7126
7212
  const e14 = new Uint8Array(t2);
7127
7213
  let a3 = "";
7128
7214
  for (let s9 = 0; s9 < e14.length; s9++) a3 += String.fromCharCode(e14[s9]);
7129
7215
  return btoa(a3);
7130
7216
  }
7131
- function re(t2) {
7217
+ function ie(t2) {
7132
7218
  return t2.map((t3) => {
7133
7219
  if (!(t3.ctx && "data" in t3.ctx && t3.ctx.data instanceof ArrayBuffer)) return { annotation: t3.annotation };
7134
7220
  const e14 = t3.ctx;
7135
- return { annotation: t3.annotation, ctx: { dataBase64: oe(e14.data), mimeType: e14.mimeType } };
7221
+ return { annotation: t3.annotation, ctx: { dataBase64: re(e14.data), mimeType: e14.mimeType } };
7136
7222
  });
7137
7223
  }
7138
- function ie(t2) {
7224
+ function ne(t2) {
7139
7225
  return t2.map((t3) => {
7140
7226
  var _a2;
7141
7227
  if (!((_a2 = t3.ctx) == null ? void 0 : _a2.dataBase64)) return { annotation: t3.annotation };
@@ -7147,21 +7233,21 @@ function ie(t2) {
7147
7233
  return { annotation: t3.annotation, ctx: { data: e14, ...t3.ctx.mimeType ? { mimeType: t3.ctx.mimeType } : {} } };
7148
7234
  });
7149
7235
  }
7150
- function ne(t2) {
7236
+ function he(t2) {
7151
7237
  return { bookmarks: false !== (t2 == null ? void 0 : t2.bookmarks), notes: false !== (t2 == null ? void 0 : t2.notes), markup: false !== (t2 == null ? void 0 : t2.markup) };
7152
7238
  }
7153
- function he(t2) {
7239
+ function de(t2) {
7154
7240
  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();
7241
+ 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
7242
  return { annotation: e14, note: a3, bookmark: s9, chapterManager: o };
7157
7243
  }
7158
- async function de(t2, e14, a3) {
7244
+ async function le(t2, e14, a3) {
7159
7245
  if (!a3 || !t2) return;
7160
7246
  const s9 = await t2.ensureChapterLoaded(e14);
7161
7247
  if ("loaded" !== s9) throw new Error(`章节 ${e14} 未加载成功(${s9}),无法导入/导出划线`);
7162
7248
  }
7163
- async function le(t2, e14, a3) {
7164
- const s9 = ne(a3), { annotation: o, note: r2, bookmark: i2, chapterManager: n2 } = he(t2), h2 = { chapterId: e14 };
7249
+ async function ce(t2, e14, a3) {
7250
+ const s9 = he(a3), { annotation: o, note: r2, bookmark: i2, chapterManager: n2 } = de(t2), h2 = { chapterId: e14 };
7165
7251
  if (s9.bookmarks) {
7166
7252
  if (!i2) throw new Error("paragraph-bookmark 插件未注册");
7167
7253
  h2.bookmarks = i2.listBookmarksForChapter(e14);
@@ -7172,25 +7258,25 @@ async function le(t2, e14, a3) {
7172
7258
  }
7173
7259
  if (s9.markup) {
7174
7260
  if (!o) throw new Error("annotation 插件未注册");
7175
- await de(n2, e14, false !== (a3 == null ? void 0 : a3.ensureChapterLoaded));
7261
+ await le(n2, e14, false !== (a3 == null ? void 0 : a3.ensureChapterLoaded));
7176
7262
  const t3 = await (d2 = o.forDocument(e14).exportAnnotations(), new Promise((t4, e15) => {
7177
7263
  d2.wait((e16) => t4(e16), (t5) => e15(t5));
7178
7264
  }));
7179
- h2.markup = re(t3);
7265
+ h2.markup = ie(t3);
7180
7266
  }
7181
7267
  var d2;
7182
7268
  return h2;
7183
7269
  }
7184
- async function ce(t2, e14, a3) {
7270
+ async function ue(t2, e14, a3) {
7185
7271
  const s9 = {};
7186
7272
  for (const o of e14.chapters) {
7187
- const e15 = await le(t2, o.chapterId, a3), { chapterId: r2, ...i2 } = e15;
7273
+ const e15 = await ce(t2, o.chapterId, a3), { chapterId: r2, ...i2 } = e15;
7188
7274
  s9[o.chapterId] = i2;
7189
7275
  }
7190
7276
  return { version: 1, exportedAt: /* @__PURE__ */ (/* @__PURE__ */ new Date()).toISOString(), chapters: s9 };
7191
7277
  }
7192
- async function ue(t2, e14, a3) {
7193
- const s9 = ne(a3), o = (a3 == null ? void 0 : a3.mode) ?? "replace", { annotation: r2, note: i2, bookmark: n2, chapterManager: h2 } = he(t2), d2 = e14.chapterId;
7278
+ async function pe(t2, e14, a3) {
7279
+ const s9 = he(a3), o = (a3 == null ? void 0 : a3.mode) ?? "replace", { annotation: r2, note: i2, bookmark: n2, chapterManager: h2 } = de(t2), d2 = e14.chapterId;
7194
7280
  if (s9.bookmarks && e14.bookmarks) {
7195
7281
  if (!n2) throw new Error("paragraph-bookmark 插件未注册");
7196
7282
  if ("replace" === o) n2.replaceBookmarksForChapter(d2, e14.bookmarks);
@@ -7203,41 +7289,41 @@ async function ue(t2, e14, a3) {
7203
7289
  }
7204
7290
  if (s9.markup && e14.markup) {
7205
7291
  if (!r2) throw new Error("annotation 插件未注册");
7206
- await de(h2, d2, false !== (a3 == null ? void 0 : a3.ensureChapterLoaded));
7207
- const t3 = r2.forDocument(d2), s10 = ie(e14.markup);
7292
+ await le(h2, d2, false !== (a3 == null ? void 0 : a3.ensureChapterLoaded));
7293
+ const t3 = r2.forDocument(d2), s10 = ne(e14.markup);
7208
7294
  "replace" === o && t3.deleteAllAnnotations(), t3.importAnnotations(s10);
7209
7295
  }
7210
7296
  (a3 == null ? void 0 : a3.persistNotes) && i2 && await a3.persistNotes(i2.listAllNotes()), (a3 == null ? void 0 : a3.persistBookmarks) && n2 && await a3.persistBookmarks(n2.listBookmarks());
7211
7297
  }
7212
- async function pe(t2, e14, a3) {
7298
+ async function ge(t2, e14, a3) {
7213
7299
  if (1 !== e14.version) throw new Error(`不支持的归档版本 ${e14.version},当前为 1`);
7214
- for (const [s9, o] of Object.entries(e14.chapters)) await ue(t2, { chapterId: s9, ...o }, a3);
7300
+ for (const [s9, o] of Object.entries(e14.chapters)) await pe(t2, { chapterId: s9, ...o }, a3);
7215
7301
  }
7216
- function ge(t2) {
7302
+ function fe(t2) {
7217
7303
  return JSON.stringify(t2, null, 2);
7218
7304
  }
7219
- function fe(t2) {
7305
+ function me(t2) {
7220
7306
  const e14 = JSON.parse(t2);
7221
7307
  if (!e14 || "object" != typeof e14 || !e14.chapters) throw new Error("无效的章节标注 JSON");
7222
7308
  return e14;
7223
7309
  }
7224
- function me(t2) {
7310
+ function ve(t2) {
7225
7311
  return JSON.stringify(t2, null, 2);
7226
7312
  }
7227
- function ve(t2) {
7313
+ function be(t2) {
7228
7314
  const e14 = JSON.parse(t2);
7229
7315
  if (!(e14 == null ? void 0 : e14.chapterId)) throw new Error("无效的章节标注 JSON:缺少 chapterId");
7230
7316
  return e14;
7231
7317
  }
7232
- function be(t2, e14) {
7318
+ function Pe(t2, e14) {
7233
7319
  const a3 = new Blob([e14], { type: "application/json;charset=utf-8" }), s9 = URL.createObjectURL(a3), o = document.createElement("a");
7234
7320
  o.href = s9, o.download = t2, o.click(), URL.revokeObjectURL(s9);
7235
7321
  }
7236
- function Pe(t2, e14 = "chapter-annotations.json") {
7237
- be(e14, ge(t2));
7322
+ function we(t2, e14 = "chapter-annotations.json") {
7323
+ Pe(e14, fe(t2));
7238
7324
  }
7239
- function we(t2, e14) {
7240
- be(e14 ?? `chapter-annotations-${t2.chapterId}.json`, me(t2));
7325
+ function ye(t2, e14) {
7326
+ Pe(e14 ?? `chapter-annotations-${t2.chapterId}.json`, ve(t2));
7241
7327
  }
7242
7328
  const t = { kind: "first-wins" };
7243
7329
  function i(e14) {
@@ -7264,37 +7350,37 @@ function d(e14) {
7264
7350
  return { tree: g(e14), manifest: { chapters: p(e14) } };
7265
7351
  }
7266
7352
  export {
7267
- se as CHAPTER_ANNOTATIONS_ARCHIVE_VERSION,
7353
+ oe as CHAPTER_ANNOTATIONS_ARCHIVE_VERSION,
7268
7354
  ze as CallbackPasswordProvider,
7269
7355
  ChapterManagerPlugin,
7270
7356
  _sfc_main as ChapterPdfViewer,
7271
- Es as ChapterTreePanel,
7272
- ia as DEFAULT_CHAPTER_VIEWER_CONFIG,
7273
- sa as DEFAULT_CHAPTER_VIEWER_FEATURES,
7357
+ Hs as ChapterTreePanel,
7358
+ oa as DEFAULT_CHAPTER_VIEWER_CONFIG,
7359
+ ia as DEFAULT_CHAPTER_VIEWER_FEATURES,
7274
7360
  EmbedPDF2 as EmbedPDF,
7275
- Ms as PdfChapterViewport,
7276
- Se as applySelectionMarkup,
7361
+ zs as PdfChapterViewport,
7362
+ xe as applySelectionMarkup,
7277
7363
  d as buildChapterViewerCatalog,
7278
- Ht$1 as buildParagraphBookmarkAnchor,
7279
- ge as chapterAnnotationsArchiveToJson,
7280
- me as chapterAnnotationsSnapshotToJson,
7364
+ Bt$1 as buildParagraphBookmarkAnchor,
7365
+ fe as chapterAnnotationsArchiveToJson,
7366
+ ve as chapterAnnotationsSnapshotToJson,
7281
7367
  h as chapterDescriptorFromTreeNode,
7282
- ha as createChapterViewerBundle,
7283
- oa as createChapterViewerEditor,
7284
- da as createChapterViewerEditorOptions,
7285
- ta as createPdfChapterEditor,
7368
+ da as createChapterViewerBundle,
7369
+ ra as createChapterViewerEditor,
7370
+ ca as createChapterViewerEditorOptions,
7371
+ aa as createPdfChapterEditor,
7286
7372
  t as defaultOverlapStrategy,
7287
- Pe as downloadChapterAnnotationsArchive,
7288
- we as downloadChapterAnnotationsSnapshot,
7289
- be as downloadJsonFile,
7290
- ce as exportAllChapterAnnotations,
7291
- le as exportChapterAnnotations,
7373
+ we as downloadChapterAnnotationsArchive,
7374
+ ye as downloadChapterAnnotationsSnapshot,
7375
+ Pe as downloadJsonFile,
7376
+ ue as exportAllChapterAnnotations,
7377
+ ce as exportChapterAnnotations,
7292
7378
  p as flattenChapterTree,
7293
- ue as importChapterAnnotations,
7294
- pe as importChapterAnnotationsArchive,
7379
+ pe as importChapterAnnotations,
7380
+ ge as importChapterAnnotationsArchive,
7295
7381
  i as overlapStrategyForSamePageOwner,
7296
- fe as parseChapterAnnotationsArchiveJson,
7297
- ve as parseChapterAnnotationsSnapshotJson,
7382
+ me as parseChapterAnnotationsArchiveJson,
7383
+ be as parseChapterAnnotationsSnapshotJson,
7298
7384
  g as toChapterTreeNodes,
7299
7385
  useCapability2 as useCapability,
7300
7386
  usePdfiumEngine,