@embedpdf-editor/react-chapter-viewer 0.2.1 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +159 -146
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +64 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +636 -503
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useMemo,
|
|
2
|
+
import { useMemo, useRef, useEffect, useState, useCallback } from "react";
|
|
3
3
|
import { useDocumentState, useCapability, EmbedPDF, useRegistry } from "@embedpdf/core/react";
|
|
4
4
|
import { EmbedPDF as EmbedPDF2, useCapability as useCapability2 } from "@embedpdf/core/react";
|
|
5
5
|
import { GlobalPointerProvider, PagePointerProvider } from "@embedpdf/plugin-interaction-manager/react";
|
|
@@ -8,7 +8,7 @@ import { SelectionLayer } from "@embedpdf/plugin-selection/react";
|
|
|
8
8
|
import { SelectionPlugin, glyphAt, expandToLineBoundary, rectsWithinSlice, SelectionPluginPackage } from "@embedpdf/plugin-selection";
|
|
9
9
|
import { AnnotationLayer } from "@embedpdf/plugin-annotation/react";
|
|
10
10
|
import { RedactionLayer } from "@embedpdf/plugin-redaction/react";
|
|
11
|
-
import { BasePlugin, createBehaviorEmitter, createEmitter, createPluginRegistration } from "@embedpdf/core";
|
|
11
|
+
import { BasePlugin, createBehaviorEmitter, createEmitter, setDefaultScale, setScale, createPluginRegistration } from "@embedpdf/core";
|
|
12
12
|
import { PdfAnnotationSubtype, PdfErrorCode, uuidV4, PdfBlendMode } from "@embedpdf/models";
|
|
13
13
|
import { DocumentManagerPlugin, DocumentManagerPluginPackage } from "@embedpdf/plugin-document-manager";
|
|
14
14
|
import { RenderLayer } from "@embedpdf/plugin-render/react";
|
|
@@ -26,8 +26,8 @@ import { CommandsPluginPackage } from "@embedpdf/plugin-commands";
|
|
|
26
26
|
import { I18nPluginPackage } from "@embedpdf/plugin-i18n";
|
|
27
27
|
import { UIPluginPackage, isToolbarOpen } from "@embedpdf/plugin-ui";
|
|
28
28
|
import { usePdfiumEngine } from "@embedpdf/engines/react";
|
|
29
|
-
const
|
|
30
|
-
function
|
|
29
|
+
const Q$1 = { kind: "first-wins" };
|
|
30
|
+
function J$1(t17, e2, a3) {
|
|
31
31
|
if (1 === e2.length) return e2[0].chapterId;
|
|
32
32
|
switch (a3.kind) {
|
|
33
33
|
case "first-wins":
|
|
@@ -45,7 +45,7 @@ function Z$1(t17, e2, a3) {
|
|
|
45
45
|
return a3.resolve(t17, e2);
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
|
-
let
|
|
48
|
+
let tt$1 = class tt {
|
|
49
49
|
constructor(t17) {
|
|
50
50
|
this._pages = t17, this._byChapter = /* @__PURE__ */ new Map(), this._byGlobalNumber = /* @__PURE__ */ new Map();
|
|
51
51
|
for (const e2 of t17) {
|
|
@@ -79,8 +79,8 @@ let Q$1 = class Q {
|
|
|
79
79
|
return a3 ? this._pages.indexOf(a3) : -1;
|
|
80
80
|
}
|
|
81
81
|
};
|
|
82
|
-
function
|
|
83
|
-
const a3 = (function(t18, e3 =
|
|
82
|
+
function et$1(t17, e2 = Q$1) {
|
|
83
|
+
const a3 = (function(t18, e3 = Q$1) {
|
|
84
84
|
const a4 = /* @__PURE__ */ new Map();
|
|
85
85
|
for (const i2 of t18.chapters) {
|
|
86
86
|
const [t19, e4] = i2.globalPageRange;
|
|
@@ -90,7 +90,7 @@ function J$1(t17, e2 = K$1) {
|
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
92
|
const s10 = /* @__PURE__ */ new Map();
|
|
93
|
-
for (const [i2, r3] of a4) s10.set(i2,
|
|
93
|
+
for (const [i2, r3] of a4) s10.set(i2, J$1(i2, r3, e3));
|
|
94
94
|
return s10;
|
|
95
95
|
})(t17, e2), s9 = /* @__PURE__ */ new Map();
|
|
96
96
|
for (const n5 of t17.chapters) s9.set(n5.chapterId, n5);
|
|
@@ -102,14 +102,14 @@ function J$1(t17, e2 = K$1) {
|
|
|
102
102
|
const [i2] = e3.globalPageRange, [h] = e3.localPageRange, l2 = h + (n5 - i2);
|
|
103
103
|
r2.push({ globalPageIndex: o++, globalPageNumber: n5, chapterId: t18, localPageIndex: l2 });
|
|
104
104
|
}
|
|
105
|
-
return new
|
|
105
|
+
return new tt$1(r2);
|
|
106
106
|
}
|
|
107
|
-
const
|
|
107
|
+
const at$1 = class t extends BasePlugin {
|
|
108
108
|
constructor(t17, e2) {
|
|
109
|
-
super(t17, e2), this.statusChange$ = createBehaviorEmitter(), this.manifestChange$ = createEmitter(), this.overlapStrategy =
|
|
109
|
+
super(t17, e2), this.statusChange$ = createBehaviorEmitter(), this.manifestChange$ = createEmitter(), this.overlapStrategy = Q$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);
|
|
110
110
|
}
|
|
111
111
|
async initialize(t17) {
|
|
112
|
-
if (this.config = t17, this.passwordProvider = t17.passwordProvider, this.overlapStrategy = t17.overlapStrategy ??
|
|
112
|
+
if (this.config = t17, this.passwordProvider = t17.passwordProvider, this.overlapStrategy = t17.overlapStrategy ?? Q$1, this.setManifestInternal(t17.manifest), this.documentManagerUnsubs.push(this.documentManager.provides().onDocumentOpened((t18) => {
|
|
113
113
|
this.isOwnedChapter(t18.id) && (this.passwordAttempts.delete(t18.id), this.updateStatus(t18.id, "loaded"));
|
|
114
114
|
}), this.documentManager.provides().onDocumentClosed((t18) => {
|
|
115
115
|
this.isOwnedChapter(t18) && this.updateStatus(t18, "closed");
|
|
@@ -144,7 +144,7 @@ const tt$1 = class t extends BasePlugin {
|
|
|
144
144
|
const s9 = new Set(this.chapterStatus.keys()), i = new Set(e2.chapters.map((t17) => t17.chapterId));
|
|
145
145
|
for (const t17 of s9) i.has(t17) || (this.closeChapter(t17), this.chapterStatus.delete(t17));
|
|
146
146
|
for (const t17 of e2.chapters) this.chapterStatus.has(t17.chapterId) || this.chapterStatus.set(t17.chapterId, "idle");
|
|
147
|
-
this.manifest = e2, this.virtualPageMap =
|
|
147
|
+
this.manifest = e2, this.virtualPageMap = et$1(e2, this.overlapStrategy), this.manifestChange$.emit({ manifest: e2, map: this.virtualPageMap }), this.eagerPrefetchFromManifest();
|
|
148
148
|
}
|
|
149
149
|
eagerPrefetchFromManifest() {
|
|
150
150
|
const t17 = this.config.prefetchChapters ?? 0;
|
|
@@ -268,11 +268,11 @@ const tt$1 = class t extends BasePlugin {
|
|
|
268
268
|
this.chapterStatus.get(t17) !== e2 && (this.chapterStatus.set(t17, e2), this.statusChange$.emit({ chapterId: t17, status: e2, ..."error" === e2 && a3 ? { error: { message: a3 } } : {} }));
|
|
269
269
|
}
|
|
270
270
|
};
|
|
271
|
-
|
|
272
|
-
let
|
|
273
|
-
const
|
|
271
|
+
at$1.id = "chapter-manager";
|
|
272
|
+
let st$1 = at$1;
|
|
273
|
+
const it$1 = class it extends BasePlugin {
|
|
274
274
|
constructor(t17, e2) {
|
|
275
|
-
super(t17, e2), this.layoutChange$ = createBehaviorEmitter(), 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(
|
|
275
|
+
super(t17, e2), this.layoutChange$ = createBehaviorEmitter(), 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(st$1.id), this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
|
|
276
276
|
}
|
|
277
277
|
async initialize(t17) {
|
|
278
278
|
this.config = { placeholderPageHeight: t17.placeholderPageHeight ?? 1200, placeholderPageWidth: t17.placeholderPageWidth ?? 900, bufferSize: t17.bufferSize ?? 2, pageGap: t17.pageGap ?? 20 }, this.virtualPageMap = this.chapterManager.provides().getVirtualPageMap(), this.rebuildOffsets(), this.chapterManagerUnsubs.push(this.chapterManager.provides().onManifestChange(({ map: t18 }) => {
|
|
@@ -441,9 +441,9 @@ const at$1 = class at extends BasePlugin {
|
|
|
441
441
|
a3 && this.scrollToIndex(a3.globalPageIndex, e2);
|
|
442
442
|
}
|
|
443
443
|
};
|
|
444
|
-
|
|
445
|
-
let
|
|
446
|
-
function
|
|
444
|
+
it$1.id = "chapter-scroll";
|
|
445
|
+
let rt$1 = it$1;
|
|
446
|
+
function ot$1({ item: e2, renderPage: a3, renderPlaceholder: s9 }) {
|
|
447
447
|
const n5 = (function(t17, e3) {
|
|
448
448
|
const a4 = useDocumentState(t17), s10 = useMemo(() => !(!a4 || "loaded" !== a4.status || !a4.document) && Boolean(a4.document.pages[e3]), [a4, e3]), [n6, h] = useState(s10);
|
|
449
449
|
return useEffect(() => {
|
|
@@ -463,8 +463,8 @@ function it$1({ item: e2, renderPage: a3, renderPlaceholder: s9 }) {
|
|
|
463
463
|
})(e2.chapterId, e2.localPageIndex);
|
|
464
464
|
return jsx("div", { "data-global-page-index": e2.globalPageIndex, "data-chapter-id": e2.chapterId, "data-local-page-index": e2.localPageIndex, style: { position: "absolute", top: `${e2.offsetTop}px`, left: "50%", transform: "translateX(-50%)", width: `${e2.width}px`, height: `${e2.height}px`, backgroundColor: n5 ? "#fff" : "#f3f4f6", boxShadow: "0 1px 4px rgba(0,0,0,0.08)" }, children: n5 ? a3(e2) : (null == s9 ? void 0 : s9(e2)) ?? /* @__PURE__ */ jsx("div", { style: { display: "flex", width: "100%", height: "100%", alignItems: "center", justifyContent: "center", color: "#9ca3af", fontSize: "12px" }, children: "Loading chapter…" }) });
|
|
465
465
|
}
|
|
466
|
-
function
|
|
467
|
-
const { provides: d } = useCapability(
|
|
466
|
+
function nt$1({ renderPage: e2, renderPlaceholder: a3, className: o, style: n5, ...l2 }) {
|
|
467
|
+
const { provides: d } = useCapability(rt$1.id), { provides: c } = useCapability(DocumentManagerPlugin.id), u = useRef(null), [p, g] = useState(null);
|
|
468
468
|
useEffect(() => {
|
|
469
469
|
if (!d) return;
|
|
470
470
|
const t17 = u.current;
|
|
@@ -475,13 +475,13 @@ function rt$1({ renderPage: e2, renderPlaceholder: a3, className: o, style: n5,
|
|
|
475
475
|
};
|
|
476
476
|
}, [d, c]);
|
|
477
477
|
const f = (null == p ? void 0 : p.totalHeight) ?? 0, m = (null == p ? void 0 : p.totalWidth) ?? 0;
|
|
478
|
-
return jsx("div", { ...l2, ref: u, "data-chapter-scroll-viewport": "", className: o, style: { overflow: "auto", position: "relative", width: "100%", height: "100%", ...n5 }, children: /* @__PURE__ */ jsx("div", { style: { position: "relative", width: `${m}px`, height: `${f}px`, margin: "0 auto" }, children: null == p ? void 0 : p.items.map((s9) => /* @__PURE__ */ jsx(
|
|
478
|
+
return jsx("div", { ...l2, ref: u, "data-chapter-scroll-viewport": "", className: o, style: { overflow: "auto", position: "relative", width: "100%", height: "100%", ...n5 }, children: /* @__PURE__ */ jsx("div", { style: { position: "relative", width: `${m}px`, height: `${f}px`, margin: "0 auto" }, children: null == p ? void 0 : p.items.map((s9) => /* @__PURE__ */ jsx(ot$1, { item: s9, renderPage: e2, renderPlaceholder: a3 }, s9.globalPageIndex)) }) });
|
|
479
479
|
}
|
|
480
|
-
function
|
|
480
|
+
function ht$1({ chapterId: e2, localPageIndex: a3, scale: s9, dpr: i, className: r2 }) {
|
|
481
481
|
return jsx(RenderLayer, { documentId: e2, pageIndex: a3, scale: s9, dpr: i, className: r2, style: { pointerEvents: "none" } });
|
|
482
482
|
}
|
|
483
|
-
const
|
|
484
|
-
function
|
|
483
|
+
const lt$1 = { kind: "first-wins" };
|
|
484
|
+
function dt$1(t17, e2, a3) {
|
|
485
485
|
if (1 === e2.length) return e2[0].chapterId;
|
|
486
486
|
switch (a3.kind) {
|
|
487
487
|
case "first-wins":
|
|
@@ -499,7 +499,7 @@ function ht$1(t17, e2, a3) {
|
|
|
499
499
|
return a3.resolve(t17, e2);
|
|
500
500
|
}
|
|
501
501
|
}
|
|
502
|
-
let
|
|
502
|
+
let ct$1 = class ct {
|
|
503
503
|
constructor(t17) {
|
|
504
504
|
this._pages = t17, this._byChapter = /* @__PURE__ */ new Map(), this._byGlobalNumber = /* @__PURE__ */ new Map();
|
|
505
505
|
for (const e2 of t17) {
|
|
@@ -533,8 +533,8 @@ let lt$1 = class lt {
|
|
|
533
533
|
return a3 ? this._pages.indexOf(a3) : -1;
|
|
534
534
|
}
|
|
535
535
|
};
|
|
536
|
-
function
|
|
537
|
-
const a3 = (function(t18, e3 =
|
|
536
|
+
function ut$1(t17, e2 = lt$1) {
|
|
537
|
+
const a3 = (function(t18, e3 = lt$1) {
|
|
538
538
|
const a4 = /* @__PURE__ */ new Map();
|
|
539
539
|
for (const i2 of t18.chapters) {
|
|
540
540
|
const [t19, e4] = i2.globalPageRange;
|
|
@@ -544,7 +544,7 @@ function dt$1(t17, e2 = nt$1) {
|
|
|
544
544
|
}
|
|
545
545
|
}
|
|
546
546
|
const s10 = /* @__PURE__ */ new Map();
|
|
547
|
-
for (const [i2, r3] of a4) s10.set(i2,
|
|
547
|
+
for (const [i2, r3] of a4) s10.set(i2, dt$1(i2, r3, e3));
|
|
548
548
|
return s10;
|
|
549
549
|
})(t17, e2), s9 = /* @__PURE__ */ new Map();
|
|
550
550
|
for (const n5 of t17.chapters) s9.set(n5.chapterId, n5);
|
|
@@ -556,14 +556,14 @@ function dt$1(t17, e2 = nt$1) {
|
|
|
556
556
|
const [i2] = e3.globalPageRange, [h] = e3.localPageRange, l2 = h + (n5 - i2);
|
|
557
557
|
r2.push({ globalPageIndex: o++, globalPageNumber: n5, chapterId: t18, localPageIndex: l2 });
|
|
558
558
|
}
|
|
559
|
-
return new
|
|
559
|
+
return new ct$1(r2);
|
|
560
560
|
}
|
|
561
|
-
const
|
|
561
|
+
const pt$1 = class t2 extends BasePlugin {
|
|
562
562
|
constructor(t17, e2) {
|
|
563
|
-
super(t17, e2), this.statusChange$ = createBehaviorEmitter(), this.manifestChange$ = createEmitter(), this.overlapStrategy =
|
|
563
|
+
super(t17, e2), this.statusChange$ = createBehaviorEmitter(), this.manifestChange$ = createEmitter(), this.overlapStrategy = lt$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);
|
|
564
564
|
}
|
|
565
565
|
async initialize(t17) {
|
|
566
|
-
if (this.config = t17, this.passwordProvider = t17.passwordProvider, this.overlapStrategy = t17.overlapStrategy ??
|
|
566
|
+
if (this.config = t17, this.passwordProvider = t17.passwordProvider, this.overlapStrategy = t17.overlapStrategy ?? lt$1, this.setManifestInternal(t17.manifest), this.documentManagerUnsubs.push(this.documentManager.provides().onDocumentOpened((t18) => {
|
|
567
567
|
this.isOwnedChapter(t18.id) && (this.passwordAttempts.delete(t18.id), this.updateStatus(t18.id, "loaded"));
|
|
568
568
|
}), this.documentManager.provides().onDocumentClosed((t18) => {
|
|
569
569
|
this.isOwnedChapter(t18) && this.updateStatus(t18, "closed");
|
|
@@ -598,7 +598,7 @@ const ct$1 = class t2 extends BasePlugin {
|
|
|
598
598
|
const s9 = new Set(this.chapterStatus.keys()), i = new Set(e2.chapters.map((t17) => t17.chapterId));
|
|
599
599
|
for (const t17 of s9) i.has(t17) || (this.closeChapter(t17), this.chapterStatus.delete(t17));
|
|
600
600
|
for (const t17 of e2.chapters) this.chapterStatus.has(t17.chapterId) || this.chapterStatus.set(t17.chapterId, "idle");
|
|
601
|
-
this.manifest = e2, this.virtualPageMap =
|
|
601
|
+
this.manifest = e2, this.virtualPageMap = ut$1(e2, this.overlapStrategy), this.manifestChange$.emit({ manifest: e2, map: this.virtualPageMap }), this.eagerPrefetchFromManifest();
|
|
602
602
|
}
|
|
603
603
|
eagerPrefetchFromManifest() {
|
|
604
604
|
const t17 = this.config.prefetchChapters ?? 0;
|
|
@@ -722,10 +722,10 @@ const ct$1 = class t2 extends BasePlugin {
|
|
|
722
722
|
this.chapterStatus.get(t17) !== e2 && (this.chapterStatus.set(t17, e2), this.statusChange$.emit({ chapterId: t17, status: e2, ..."error" === e2 && a3 ? { error: { message: a3 } } : {} }));
|
|
723
723
|
}
|
|
724
724
|
};
|
|
725
|
-
|
|
726
|
-
let
|
|
727
|
-
const
|
|
728
|
-
function
|
|
725
|
+
pt$1.id = "chapter-manager";
|
|
726
|
+
let gt$1 = pt$1;
|
|
727
|
+
const ft$1 = { kind: "first-wins" };
|
|
728
|
+
function mt$1(t17, e2, a3) {
|
|
729
729
|
if (1 === e2.length) return e2[0].chapterId;
|
|
730
730
|
switch (a3.kind) {
|
|
731
731
|
case "first-wins":
|
|
@@ -743,7 +743,7 @@ function gt$1(t17, e2, a3) {
|
|
|
743
743
|
return a3.resolve(t17, e2);
|
|
744
744
|
}
|
|
745
745
|
}
|
|
746
|
-
let
|
|
746
|
+
let vt$1 = class vt {
|
|
747
747
|
constructor(t17) {
|
|
748
748
|
this._pages = t17, this._byChapter = /* @__PURE__ */ new Map(), this._byGlobalNumber = /* @__PURE__ */ new Map();
|
|
749
749
|
for (const e2 of t17) {
|
|
@@ -777,8 +777,8 @@ let ft$1 = class ft {
|
|
|
777
777
|
return a3 ? this._pages.indexOf(a3) : -1;
|
|
778
778
|
}
|
|
779
779
|
};
|
|
780
|
-
function
|
|
781
|
-
const a3 = (function(t18, e3 =
|
|
780
|
+
function bt$1(t17, e2 = ft$1) {
|
|
781
|
+
const a3 = (function(t18, e3 = ft$1) {
|
|
782
782
|
const a4 = /* @__PURE__ */ new Map();
|
|
783
783
|
for (const i2 of t18.chapters) {
|
|
784
784
|
const [t19, e4] = i2.globalPageRange;
|
|
@@ -788,7 +788,7 @@ function mt$1(t17, e2 = pt$1) {
|
|
|
788
788
|
}
|
|
789
789
|
}
|
|
790
790
|
const s10 = /* @__PURE__ */ new Map();
|
|
791
|
-
for (const [i2, r3] of a4) s10.set(i2,
|
|
791
|
+
for (const [i2, r3] of a4) s10.set(i2, mt$1(i2, r3, e3));
|
|
792
792
|
return s10;
|
|
793
793
|
})(t17, e2), s9 = /* @__PURE__ */ new Map();
|
|
794
794
|
for (const n5 of t17.chapters) s9.set(n5.chapterId, n5);
|
|
@@ -800,14 +800,14 @@ function mt$1(t17, e2 = pt$1) {
|
|
|
800
800
|
const [i2] = e3.globalPageRange, [h] = e3.localPageRange, l2 = h + (n5 - i2);
|
|
801
801
|
r2.push({ globalPageIndex: o++, globalPageNumber: n5, chapterId: t18, localPageIndex: l2 });
|
|
802
802
|
}
|
|
803
|
-
return new
|
|
803
|
+
return new vt$1(r2);
|
|
804
804
|
}
|
|
805
|
-
const
|
|
805
|
+
const Pt$1 = class t3 extends BasePlugin {
|
|
806
806
|
constructor(t17, e2) {
|
|
807
|
-
super(t17, e2), this.statusChange$ = createBehaviorEmitter(), this.manifestChange$ = createEmitter(), this.overlapStrategy =
|
|
807
|
+
super(t17, e2), this.statusChange$ = createBehaviorEmitter(), this.manifestChange$ = createEmitter(), this.overlapStrategy = ft$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);
|
|
808
808
|
}
|
|
809
809
|
async initialize(t17) {
|
|
810
|
-
if (this.config = t17, this.passwordProvider = t17.passwordProvider, this.overlapStrategy = t17.overlapStrategy ??
|
|
810
|
+
if (this.config = t17, this.passwordProvider = t17.passwordProvider, this.overlapStrategy = t17.overlapStrategy ?? ft$1, this.setManifestInternal(t17.manifest), this.documentManagerUnsubs.push(this.documentManager.provides().onDocumentOpened((t18) => {
|
|
811
811
|
this.isOwnedChapter(t18.id) && (this.passwordAttempts.delete(t18.id), this.updateStatus(t18.id, "loaded"));
|
|
812
812
|
}), this.documentManager.provides().onDocumentClosed((t18) => {
|
|
813
813
|
this.isOwnedChapter(t18) && this.updateStatus(t18, "closed");
|
|
@@ -842,7 +842,7 @@ const vt$1 = class t3 extends BasePlugin {
|
|
|
842
842
|
const s9 = new Set(this.chapterStatus.keys()), i = new Set(e2.chapters.map((t17) => t17.chapterId));
|
|
843
843
|
for (const t17 of s9) i.has(t17) || (this.closeChapter(t17), this.chapterStatus.delete(t17));
|
|
844
844
|
for (const t17 of e2.chapters) this.chapterStatus.has(t17.chapterId) || this.chapterStatus.set(t17.chapterId, "idle");
|
|
845
|
-
this.manifest = e2, this.virtualPageMap =
|
|
845
|
+
this.manifest = e2, this.virtualPageMap = bt$1(e2, this.overlapStrategy), this.manifestChange$.emit({ manifest: e2, map: this.virtualPageMap }), this.eagerPrefetchFromManifest();
|
|
846
846
|
}
|
|
847
847
|
eagerPrefetchFromManifest() {
|
|
848
848
|
const t17 = this.config.prefetchChapters ?? 0;
|
|
@@ -966,11 +966,11 @@ const vt$1 = class t3 extends BasePlugin {
|
|
|
966
966
|
this.chapterStatus.get(t17) !== e2 && (this.chapterStatus.set(t17, e2), this.statusChange$.emit({ chapterId: t17, status: e2, ..."error" === e2 && a3 ? { error: { message: a3 } } : {} }));
|
|
967
967
|
}
|
|
968
968
|
};
|
|
969
|
-
|
|
970
|
-
let
|
|
971
|
-
const
|
|
969
|
+
Pt$1.id = "chapter-manager";
|
|
970
|
+
let wt$1 = Pt$1;
|
|
971
|
+
const It$1 = class It extends BasePlugin {
|
|
972
972
|
constructor(t17, e2) {
|
|
973
|
-
super(t17, e2), this.layoutChange$ = createBehaviorEmitter(), 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(
|
|
973
|
+
super(t17, e2), this.layoutChange$ = createBehaviorEmitter(), 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(wt$1.id), this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
|
|
974
974
|
}
|
|
975
975
|
async initialize(t17) {
|
|
976
976
|
this.config = { placeholderPageHeight: t17.placeholderPageHeight ?? 1200, placeholderPageWidth: t17.placeholderPageWidth ?? 900, bufferSize: t17.bufferSize ?? 2, pageGap: t17.pageGap ?? 20 }, this.virtualPageMap = this.chapterManager.provides().getVirtualPageMap(), this.rebuildOffsets(), this.chapterManagerUnsubs.push(this.chapterManager.provides().onManifestChange(({ map: t18 }) => {
|
|
@@ -1139,11 +1139,11 @@ const Pt$1 = class Pt extends BasePlugin {
|
|
|
1139
1139
|
a3 && this.scrollToIndex(a3.globalPageIndex, e2);
|
|
1140
1140
|
}
|
|
1141
1141
|
};
|
|
1142
|
-
|
|
1143
|
-
let
|
|
1144
|
-
const
|
|
1142
|
+
It$1.id = "chapter-scroll";
|
|
1143
|
+
let yt$1 = It$1;
|
|
1144
|
+
const Ct$1 = class t4 extends BasePlugin {
|
|
1145
1145
|
constructor(t17, e2) {
|
|
1146
|
-
super(t17, e2), this.notesChange$ = createBehaviorEmitter([]), this.noteActivated$ = createEmitter(), this.notes = /* @__PURE__ */ new Map(), this.chapterScroll = this.registry.getPlugin(
|
|
1146
|
+
super(t17, e2), this.notesChange$ = createBehaviorEmitter([]), this.noteActivated$ = createEmitter(), this.notes = /* @__PURE__ */ new Map(), this.chapterScroll = this.registry.getPlugin(yt$1.id), this.chapterManager = this.registry.getPlugin(gt$1.id), this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
|
|
1147
1147
|
}
|
|
1148
1148
|
async initialize(e2) {
|
|
1149
1149
|
if (this.config = e2, e2.callbacks.loadNotes) try {
|
|
@@ -1173,7 +1173,7 @@ const It$1 = class t4 extends BasePlugin {
|
|
|
1173
1173
|
return Array.from(this.notes.values());
|
|
1174
1174
|
}
|
|
1175
1175
|
buildDraft(t17) {
|
|
1176
|
-
return { chapterId: t17.chapterId, localPageIndex: t17.localPageIndex, globalPageNumber: t17.globalPageNumber, globalPageIndex: t17.globalPageIndex, rectsPdfCoord: t17.rectsPdfCoord, endAnchor:
|
|
1176
|
+
return { chapterId: t17.chapterId, localPageIndex: t17.localPageIndex, globalPageNumber: t17.globalPageNumber, globalPageIndex: t17.globalPageIndex, rectsPdfCoord: t17.rectsPdfCoord, endAnchor: St$1(t17.rectsPdfCoord), selectedText: t17.selectedText, content: t17.content };
|
|
1177
1177
|
}
|
|
1178
1178
|
async requestCreateFromSelection(t17) {
|
|
1179
1179
|
if (0 === t17.rectsPdfCoord.length) return null;
|
|
@@ -1240,24 +1240,24 @@ const It$1 = class t4 extends BasePlugin {
|
|
|
1240
1240
|
});
|
|
1241
1241
|
}
|
|
1242
1242
|
};
|
|
1243
|
-
|
|
1244
|
-
let
|
|
1245
|
-
function
|
|
1243
|
+
Ct$1.id = "note";
|
|
1244
|
+
let Mt$1 = Ct$1;
|
|
1245
|
+
function St$1(t17) {
|
|
1246
1246
|
const e2 = t17[t17.length - 1];
|
|
1247
1247
|
return { x: e2.origin.x + e2.size.width, y: e2.origin.y + e2.size.height };
|
|
1248
1248
|
}
|
|
1249
|
-
function
|
|
1249
|
+
function xt$1({ chapterId: a3, localPageIndex: s9, pdfPageWidth: o, pdfPageHeight: n5, cssPageWidth: h, cssPageHeight: l2, color: c = "#f59e0b", ui: u, className: p, style: g }) {
|
|
1250
1250
|
const { plugin: f } = (() => {
|
|
1251
1251
|
const { registry: t17 } = useRegistry();
|
|
1252
1252
|
if (null === t17) return { plugin: null, isLoading: true, ready: new Promise(() => {
|
|
1253
1253
|
}) };
|
|
1254
|
-
const e2 = t17.getPlugin(
|
|
1254
|
+
const e2 = t17.getPlugin(Mt$1.id);
|
|
1255
1255
|
return { plugin: e2, isLoading: false, ready: (null == e2 ? void 0 : e2.ready()) ?? Promise.resolve() };
|
|
1256
1256
|
})(), { provides: m } = (() => {
|
|
1257
1257
|
const { registry: t17 } = useRegistry();
|
|
1258
1258
|
if (null === t17) return { provides: null, isLoading: true, ready: new Promise(() => {
|
|
1259
1259
|
}) };
|
|
1260
|
-
const e2 = t17.getPlugin(
|
|
1260
|
+
const e2 = t17.getPlugin(Mt$1.id);
|
|
1261
1261
|
return (null == e2 ? void 0 : e2.provides) ? { provides: e2.provides(), isLoading: false, ready: e2.ready() } : { provides: null, isLoading: false, ready: Promise.resolve() };
|
|
1262
1262
|
})(), [v, b] = useState([]), [P, w] = useState(null), [I, y] = useState(null);
|
|
1263
1263
|
if (useEffect(() => {
|
|
@@ -1273,7 +1273,7 @@ function Mt$1({ chapterId: a3, localPageIndex: s9, pdfPageWidth: o, pdfPageHeigh
|
|
|
1273
1273
|
};
|
|
1274
1274
|
return document.addEventListener("mousedown", t17), () => document.removeEventListener("mousedown", t17);
|
|
1275
1275
|
}, [I]), !m || 0 === v.length || !o || !n5) return null;
|
|
1276
|
-
const
|
|
1276
|
+
const C = h / o, M2 = l2 / n5, S2 = (null == u ? void 0 : u.iconSize) ?? 16, x2 = (null == u ? void 0 : u.highlightColor) ?? "rgba(245, 158, 11, 0.08)";
|
|
1277
1277
|
return jsx("div", { className: p, style: { position: "absolute", inset: 0, pointerEvents: "none", zIndex: 25, ...g }, children: v.map((a4) => {
|
|
1278
1278
|
const s10 = P === a4.noteId, i = I === a4.noteId, r2 = s10 || i, { left: o2, top: n6 } = (function(t17) {
|
|
1279
1279
|
const { markerPdf: e2, lineRects: a5, sx: s11, sy: i2, cssPageWidth: r3, iconSize: o3, gapPx: n7 = 6 } = t17, h2 = (null == a5 ? void 0 : a5.length) ? a5[a5.length - 1] : void 0;
|
|
@@ -1281,12 +1281,12 @@ function Mt$1({ chapterId: a3, localPageIndex: s9, pdfPageWidth: o, pdfPageHeigh
|
|
|
1281
1281
|
h2 ? (l4 = (h2.origin.x + h2.size.width) * s11 + n7, d2 = h2.origin.y * i2 + (h2.size.height * i2 - o3) / 2) : (l4 = e2.x * s11 - o3 / 2, d2 = e2.y * i2 - o3 - n7);
|
|
1282
1282
|
const c2 = Math.max(0, r3 - o3 - 2);
|
|
1283
1283
|
return l4 > c2 && (l4 = c2), d2 < 0 && (d2 = 0), { left: l4, top: d2 };
|
|
1284
|
-
})({ markerPdf: a4.endAnchor, lineRects: a4.rectsPdfCoord, sx:
|
|
1284
|
+
})({ markerPdf: a4.endAnchor, lineRects: a4.rectsPdfCoord, sx: C, sy: M2, cssPageWidth: h, iconSize: S2 }), l3 = (function(t17, e2, a5) {
|
|
1285
1285
|
let s11 = 1 / 0, i2 = 1 / 0, r3 = -1 / 0, o3 = -1 / 0;
|
|
1286
1286
|
for (const n7 of t17) s11 = Math.min(s11, n7.origin.x * e2), i2 = Math.min(i2, n7.origin.y * a5), r3 = Math.max(r3, (n7.origin.x + n7.size.width) * e2), o3 = Math.max(o3, (n7.origin.y + n7.size.height) * a5);
|
|
1287
1287
|
return { left: s11, top: i2, width: r3 - s11, height: o3 - i2 };
|
|
1288
|
-
})(a4.rectsPdfCoord,
|
|
1289
|
-
return jsxs("div", { children: [a4.rectsPdfCoord.map((e2, s11) => /* @__PURE__ */ jsx("div", { style: { position: "absolute", left: e2.origin.x *
|
|
1288
|
+
})(a4.rectsPdfCoord, C, M2), d = i ? 72 : 0, p2 = Math.max(0, Math.min(l3.left, o2) - 8), g2 = Math.max(0, Math.min(l3.top, n6) - 8), v2 = Math.min(h, Math.max(l3.left + l3.width, o2 + S2) + 8) - p2, b2 = Math.max(l3.top + l3.height, n6 + S2 + 6 + d) + 8 - g2;
|
|
1289
|
+
return jsxs("div", { children: [a4.rectsPdfCoord.map((e2, s11) => /* @__PURE__ */ jsx("div", { style: { position: "absolute", left: e2.origin.x * C + "px", top: e2.origin.y * M2 + "px", width: e2.size.width * C + "px", height: e2.size.height * M2 + "px", background: x2, borderRadius: "2px", pointerEvents: "auto", cursor: "default" }, onMouseEnter: () => w(a4.noteId) }, `${a4.noteId}-bg-${s11}`)), r2 && /* @__PURE__ */ jsxs("div", { "data-note-marker-zone": a4.noteId, style: { position: "absolute", left: `${p2}px`, top: `${g2}px`, width: `${v2}px`, height: `${b2}px`, pointerEvents: "auto", zIndex: 26 }, onMouseEnter: () => w(a4.noteId), onMouseLeave: () => {
|
|
1290
1290
|
I !== a4.noteId && w(null);
|
|
1291
1291
|
}, children: [(null == u ? void 0 : u.renderIcon) ? /* @__PURE__ */ jsx("div", { role: "button", tabIndex: 0, title: "笔记", "aria-label": "笔记", onMouseDown: (t17) => t17.stopPropagation(), onClick: (t17) => {
|
|
1292
1292
|
t17.stopPropagation(), y((t18) => t18 === a4.noteId ? null : a4.noteId);
|
|
@@ -1297,18 +1297,18 @@ function Mt$1({ chapterId: a3, localPageIndex: s9, pdfPageWidth: o, pdfPageHeigh
|
|
|
1297
1297
|
}, onDelete: () => {
|
|
1298
1298
|
y(null), w(null), m.deleteNote(a4.noteId);
|
|
1299
1299
|
} }) }) : /* @__PURE__ */ jsxs("div", { style: { position: "absolute", left: o2 - p2 + S2 / 2 + "px", top: `${n6 - g2 + S2 + 6}px`, transform: "translateX(-50%)", zIndex: 30, pointerEvents: "auto", minWidth: "80px", padding: "4px", borderRadius: "6px", background: "#fff", border: "1px solid #e5e7eb", boxShadow: "0 4px 12px rgba(0,0,0,0.12)" }, onMouseDown: (t17) => t17.stopPropagation(), children: [
|
|
1300
|
-
/* @__PURE__ */ jsx("button", { type: "button", style:
|
|
1300
|
+
/* @__PURE__ */ jsx("button", { type: "button", style: $t$1, onClick: (t17) => {
|
|
1301
1301
|
t17.stopPropagation(), y(null), w(null), null == f || f.requestEdit(a4.noteId);
|
|
1302
1302
|
}, children: "编辑" }),
|
|
1303
|
-
/* @__PURE__ */ jsx("button", { type: "button", style: {
|
|
1303
|
+
/* @__PURE__ */ jsx("button", { type: "button", style: { ...$t$1, color: "#dc2626" }, onClick: (t17) => {
|
|
1304
1304
|
t17.stopPropagation(), y(null), w(null), m.deleteNote(a4.noteId);
|
|
1305
1305
|
}, children: "删除" })
|
|
1306
1306
|
] }))] })] }, a4.noteId);
|
|
1307
1307
|
}) });
|
|
1308
1308
|
}
|
|
1309
|
-
const
|
|
1310
|
-
const
|
|
1311
|
-
function $
|
|
1309
|
+
const $t$1 = { display: "block", width: "100%", padding: "6px 10px", fontSize: "12px", border: "none", borderRadius: "4px", background: "transparent", color: "#334155", cursor: "pointer", textAlign: "left" };
|
|
1310
|
+
const kt$1 = { kind: "first-wins" };
|
|
1311
|
+
function Lt$1(t17, e2, a3) {
|
|
1312
1312
|
if (1 === e2.length) return e2[0].chapterId;
|
|
1313
1313
|
switch (a3.kind) {
|
|
1314
1314
|
case "first-wins":
|
|
@@ -1326,7 +1326,7 @@ function $t$1(t17, e2, a3) {
|
|
|
1326
1326
|
return a3.resolve(t17, e2);
|
|
1327
1327
|
}
|
|
1328
1328
|
}
|
|
1329
|
-
let
|
|
1329
|
+
let zt$1 = class zt {
|
|
1330
1330
|
constructor(t17) {
|
|
1331
1331
|
this._pages = t17, this._byChapter = /* @__PURE__ */ new Map(), this._byGlobalNumber = /* @__PURE__ */ new Map();
|
|
1332
1332
|
for (const e2 of t17) {
|
|
@@ -1360,8 +1360,8 @@ let kt$1 = class kt {
|
|
|
1360
1360
|
return a3 ? this._pages.indexOf(a3) : -1;
|
|
1361
1361
|
}
|
|
1362
1362
|
};
|
|
1363
|
-
function
|
|
1364
|
-
const a3 = (function(t18, e3 =
|
|
1363
|
+
function Dt$1(t17, e2 = kt$1) {
|
|
1364
|
+
const a3 = (function(t18, e3 = kt$1) {
|
|
1365
1365
|
const a4 = /* @__PURE__ */ new Map();
|
|
1366
1366
|
for (const i2 of t18.chapters) {
|
|
1367
1367
|
const [t19, e4] = i2.globalPageRange;
|
|
@@ -1371,7 +1371,7 @@ function Lt$1(t17, e2 = xt$1) {
|
|
|
1371
1371
|
}
|
|
1372
1372
|
}
|
|
1373
1373
|
const s10 = /* @__PURE__ */ new Map();
|
|
1374
|
-
for (const [i2, r3] of a4) s10.set(i2, $
|
|
1374
|
+
for (const [i2, r3] of a4) s10.set(i2, Lt$1(i2, r3, e3));
|
|
1375
1375
|
return s10;
|
|
1376
1376
|
})(t17, e2), s9 = /* @__PURE__ */ new Map();
|
|
1377
1377
|
for (const n5 of t17.chapters) s9.set(n5.chapterId, n5);
|
|
@@ -1383,14 +1383,14 @@ function Lt$1(t17, e2 = xt$1) {
|
|
|
1383
1383
|
const [i2] = e3.globalPageRange, [h] = e3.localPageRange, l2 = h + (n5 - i2);
|
|
1384
1384
|
r2.push({ globalPageIndex: o++, globalPageNumber: n5, chapterId: t18, localPageIndex: l2 });
|
|
1385
1385
|
}
|
|
1386
|
-
return new
|
|
1386
|
+
return new zt$1(r2);
|
|
1387
1387
|
}
|
|
1388
|
-
const
|
|
1388
|
+
const Tt$1 = class t5 extends BasePlugin {
|
|
1389
1389
|
constructor(t17, e2) {
|
|
1390
|
-
super(t17, e2), this.statusChange$ = createBehaviorEmitter(), this.manifestChange$ = createEmitter(), this.overlapStrategy =
|
|
1390
|
+
super(t17, e2), 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);
|
|
1391
1391
|
}
|
|
1392
1392
|
async initialize(t17) {
|
|
1393
|
-
if (this.config = t17, this.passwordProvider = t17.passwordProvider, this.overlapStrategy = t17.overlapStrategy ??
|
|
1393
|
+
if (this.config = t17, this.passwordProvider = t17.passwordProvider, this.overlapStrategy = t17.overlapStrategy ?? kt$1, this.setManifestInternal(t17.manifest), this.documentManagerUnsubs.push(this.documentManager.provides().onDocumentOpened((t18) => {
|
|
1394
1394
|
this.isOwnedChapter(t18.id) && (this.passwordAttempts.delete(t18.id), this.updateStatus(t18.id, "loaded"));
|
|
1395
1395
|
}), this.documentManager.provides().onDocumentClosed((t18) => {
|
|
1396
1396
|
this.isOwnedChapter(t18) && this.updateStatus(t18, "closed");
|
|
@@ -1425,7 +1425,7 @@ const zt$1 = class t5 extends BasePlugin {
|
|
|
1425
1425
|
const s9 = new Set(this.chapterStatus.keys()), i = new Set(e2.chapters.map((t17) => t17.chapterId));
|
|
1426
1426
|
for (const t17 of s9) i.has(t17) || (this.closeChapter(t17), this.chapterStatus.delete(t17));
|
|
1427
1427
|
for (const t17 of e2.chapters) this.chapterStatus.has(t17.chapterId) || this.chapterStatus.set(t17.chapterId, "idle");
|
|
1428
|
-
this.manifest = e2, this.virtualPageMap =
|
|
1428
|
+
this.manifest = e2, this.virtualPageMap = Dt$1(e2, this.overlapStrategy), this.manifestChange$.emit({ manifest: e2, map: this.virtualPageMap }), this.eagerPrefetchFromManifest();
|
|
1429
1429
|
}
|
|
1430
1430
|
eagerPrefetchFromManifest() {
|
|
1431
1431
|
const t17 = this.config.prefetchChapters ?? 0;
|
|
@@ -1549,10 +1549,10 @@ const zt$1 = class t5 extends BasePlugin {
|
|
|
1549
1549
|
this.chapterStatus.get(t17) !== e2 && (this.chapterStatus.set(t17, e2), this.statusChange$.emit({ chapterId: t17, status: e2, ..."error" === e2 && a3 ? { error: { message: a3 } } : {} }));
|
|
1550
1550
|
}
|
|
1551
1551
|
};
|
|
1552
|
-
|
|
1553
|
-
let
|
|
1554
|
-
const
|
|
1555
|
-
function
|
|
1552
|
+
Tt$1.id = "chapter-manager";
|
|
1553
|
+
let Gt$1 = Tt$1;
|
|
1554
|
+
const Ot$1 = { kind: "first-wins" };
|
|
1555
|
+
function At$1(t17, e2, a3) {
|
|
1556
1556
|
if (1 === e2.length) return e2[0].chapterId;
|
|
1557
1557
|
switch (a3.kind) {
|
|
1558
1558
|
case "first-wins":
|
|
@@ -1570,7 +1570,7 @@ function Gt$1(t17, e2, a3) {
|
|
|
1570
1570
|
return a3.resolve(t17, e2);
|
|
1571
1571
|
}
|
|
1572
1572
|
}
|
|
1573
|
-
let
|
|
1573
|
+
let Nt$1 = class Nt {
|
|
1574
1574
|
constructor(t17) {
|
|
1575
1575
|
this._pages = t17, this._byChapter = /* @__PURE__ */ new Map(), this._byGlobalNumber = /* @__PURE__ */ new Map();
|
|
1576
1576
|
for (const e2 of t17) {
|
|
@@ -1604,8 +1604,8 @@ let Ot$1 = class Ot {
|
|
|
1604
1604
|
return a3 ? this._pages.indexOf(a3) : -1;
|
|
1605
1605
|
}
|
|
1606
1606
|
};
|
|
1607
|
-
function
|
|
1608
|
-
const a3 = (function(t18, e3 =
|
|
1607
|
+
function Vt$1(t17, e2 = Ot$1) {
|
|
1608
|
+
const a3 = (function(t18, e3 = Ot$1) {
|
|
1609
1609
|
const a4 = /* @__PURE__ */ new Map();
|
|
1610
1610
|
for (const i2 of t18.chapters) {
|
|
1611
1611
|
const [t19, e4] = i2.globalPageRange;
|
|
@@ -1615,7 +1615,7 @@ function At$1(t17, e2 = Tt$1) {
|
|
|
1615
1615
|
}
|
|
1616
1616
|
}
|
|
1617
1617
|
const s10 = /* @__PURE__ */ new Map();
|
|
1618
|
-
for (const [i2, r3] of a4) s10.set(i2,
|
|
1618
|
+
for (const [i2, r3] of a4) s10.set(i2, At$1(i2, r3, e3));
|
|
1619
1619
|
return s10;
|
|
1620
1620
|
})(t17, e2), s9 = /* @__PURE__ */ new Map();
|
|
1621
1621
|
for (const n5 of t17.chapters) s9.set(n5.chapterId, n5);
|
|
@@ -1627,14 +1627,14 @@ function At$1(t17, e2 = Tt$1) {
|
|
|
1627
1627
|
const [i2] = e3.globalPageRange, [h] = e3.localPageRange, l2 = h + (n5 - i2);
|
|
1628
1628
|
r2.push({ globalPageIndex: o++, globalPageNumber: n5, chapterId: t18, localPageIndex: l2 });
|
|
1629
1629
|
}
|
|
1630
|
-
return new
|
|
1630
|
+
return new Nt$1(r2);
|
|
1631
1631
|
}
|
|
1632
|
-
const
|
|
1632
|
+
const Rt$1 = class t6 extends BasePlugin {
|
|
1633
1633
|
constructor(t17, e2) {
|
|
1634
|
-
super(t17, e2), this.statusChange$ = createBehaviorEmitter(), this.manifestChange$ = createEmitter(), this.overlapStrategy =
|
|
1634
|
+
super(t17, e2), 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);
|
|
1635
1635
|
}
|
|
1636
1636
|
async initialize(t17) {
|
|
1637
|
-
if (this.config = t17, this.passwordProvider = t17.passwordProvider, this.overlapStrategy = t17.overlapStrategy ??
|
|
1637
|
+
if (this.config = t17, this.passwordProvider = t17.passwordProvider, this.overlapStrategy = t17.overlapStrategy ?? Ot$1, this.setManifestInternal(t17.manifest), this.documentManagerUnsubs.push(this.documentManager.provides().onDocumentOpened((t18) => {
|
|
1638
1638
|
this.isOwnedChapter(t18.id) && (this.passwordAttempts.delete(t18.id), this.updateStatus(t18.id, "loaded"));
|
|
1639
1639
|
}), this.documentManager.provides().onDocumentClosed((t18) => {
|
|
1640
1640
|
this.isOwnedChapter(t18) && this.updateStatus(t18, "closed");
|
|
@@ -1669,7 +1669,7 @@ const Nt$1 = class t6 extends BasePlugin {
|
|
|
1669
1669
|
const s9 = new Set(this.chapterStatus.keys()), i = new Set(e2.chapters.map((t17) => t17.chapterId));
|
|
1670
1670
|
for (const t17 of s9) i.has(t17) || (this.closeChapter(t17), this.chapterStatus.delete(t17));
|
|
1671
1671
|
for (const t17 of e2.chapters) this.chapterStatus.has(t17.chapterId) || this.chapterStatus.set(t17.chapterId, "idle");
|
|
1672
|
-
this.manifest = e2, this.virtualPageMap =
|
|
1672
|
+
this.manifest = e2, this.virtualPageMap = Vt$1(e2, this.overlapStrategy), this.manifestChange$.emit({ manifest: e2, map: this.virtualPageMap }), this.eagerPrefetchFromManifest();
|
|
1673
1673
|
}
|
|
1674
1674
|
eagerPrefetchFromManifest() {
|
|
1675
1675
|
const t17 = this.config.prefetchChapters ?? 0;
|
|
@@ -1793,11 +1793,11 @@ const Nt$1 = class t6 extends BasePlugin {
|
|
|
1793
1793
|
this.chapterStatus.get(t17) !== e2 && (this.chapterStatus.set(t17, e2), this.statusChange$.emit({ chapterId: t17, status: e2, ..."error" === e2 && a3 ? { error: { message: a3 } } : {} }));
|
|
1794
1794
|
}
|
|
1795
1795
|
};
|
|
1796
|
-
|
|
1797
|
-
let
|
|
1798
|
-
const
|
|
1796
|
+
Rt$1.id = "chapter-manager";
|
|
1797
|
+
let Et$1 = Rt$1;
|
|
1798
|
+
const Ut$1 = class Ut extends BasePlugin {
|
|
1799
1799
|
constructor(t17, e2) {
|
|
1800
|
-
super(t17, e2), this.layoutChange$ = createBehaviorEmitter(), 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(
|
|
1800
|
+
super(t17, e2), this.layoutChange$ = createBehaviorEmitter(), 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$1.id), this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
|
|
1801
1801
|
}
|
|
1802
1802
|
async initialize(t17) {
|
|
1803
1803
|
this.config = { placeholderPageHeight: t17.placeholderPageHeight ?? 1200, placeholderPageWidth: t17.placeholderPageWidth ?? 900, bufferSize: t17.bufferSize ?? 2, pageGap: t17.pageGap ?? 20 }, this.virtualPageMap = this.chapterManager.provides().getVirtualPageMap(), this.rebuildOffsets(), this.chapterManagerUnsubs.push(this.chapterManager.provides().onManifestChange(({ map: t18 }) => {
|
|
@@ -1966,30 +1966,30 @@ const Rt$1 = class Rt extends BasePlugin {
|
|
|
1966
1966
|
a3 && this.scrollToIndex(a3.globalPageIndex, e2);
|
|
1967
1967
|
}
|
|
1968
1968
|
};
|
|
1969
|
-
|
|
1970
|
-
let
|
|
1971
|
-
function
|
|
1969
|
+
Ut$1.id = "chapter-scroll";
|
|
1970
|
+
let _t$1 = Ut$1;
|
|
1971
|
+
function Ft$1(t17) {
|
|
1972
1972
|
const e2 = t17[t17.length - 1];
|
|
1973
1973
|
return { x: e2.origin.x + e2.size.width, y: e2.origin.y + e2.size.height };
|
|
1974
1974
|
}
|
|
1975
|
-
function
|
|
1975
|
+
function qt$1(t17, e2) {
|
|
1976
1976
|
const a3 = t17.origin.y, s9 = t17.origin.y + t17.size.height, i = e2.origin.y, r2 = e2.origin.y + e2.size.height, o = Math.max(s9, r2) - Math.min(a3, i);
|
|
1977
1977
|
if (o <= 0) return 0;
|
|
1978
1978
|
return Math.max(0, Math.min(s9, r2) - Math.max(a3, i)) / o;
|
|
1979
1979
|
}
|
|
1980
|
-
function
|
|
1980
|
+
function Wt$1(t17, e2) {
|
|
1981
1981
|
var a3, s9;
|
|
1982
1982
|
if (t17.chapterId !== e2.chapterId || t17.localPageIndex !== e2.localPageIndex) return false;
|
|
1983
|
-
const i = (null == (a3 = t17.rectsPdfCoord) ? void 0 : a3.length) ? t17.rectsPdfCoord : [t17.rectPdfCoord], r2 = (null == (s9 = e2.rectsPdfCoord) ? void 0 : s9.length) ? e2.rectsPdfCoord : [e2.rectPdfCoord], o = t17.markerAnchor ??
|
|
1983
|
+
const i = (null == (a3 = t17.rectsPdfCoord) ? void 0 : a3.length) ? t17.rectsPdfCoord : [t17.rectPdfCoord], r2 = (null == (s9 = e2.rectsPdfCoord) ? void 0 : s9.length) ? e2.rectsPdfCoord : [e2.rectPdfCoord], o = t17.markerAnchor ?? Ft$1(i), n5 = e2.markerAnchor ?? Ft$1(r2);
|
|
1984
1984
|
if (Math.hypot(o.x - n5.x, o.y - n5.y) <= 6) return true;
|
|
1985
1985
|
for (const h of i) for (const t18 of r2) {
|
|
1986
|
-
if (
|
|
1986
|
+
if (qt$1(h, t18) < 0.5) continue;
|
|
1987
1987
|
const e3 = Math.max(h.origin.x, t18.origin.x);
|
|
1988
1988
|
if (Math.min(h.origin.x + h.size.width, t18.origin.x + t18.size.width) - e3 > 0.25 * Math.min(h.size.width, t18.size.width)) return true;
|
|
1989
1989
|
}
|
|
1990
1990
|
return false;
|
|
1991
1991
|
}
|
|
1992
|
-
async function
|
|
1992
|
+
async function Ht$1(t17, e2, a3) {
|
|
1993
1993
|
t17.scrollToGlobalPageIndex(e2), await (function(t18, e3, a4 = 2500) {
|
|
1994
1994
|
const s9 = t18.getLayout().items.find((t19) => t19.globalPageIndex === e3 && !t19.isPlaceholder);
|
|
1995
1995
|
return s9 ? Promise.resolve(s9) : new Promise((s10) => {
|
|
@@ -2002,9 +2002,9 @@ async function qt(t17, e2, a3) {
|
|
|
2002
2002
|
});
|
|
2003
2003
|
})(t17, e2), t17.scrollToGlobalPdfPoint(e2, a3, { marginTop: 80 });
|
|
2004
2004
|
}
|
|
2005
|
-
const
|
|
2005
|
+
const Bt$1 = class t7 extends BasePlugin {
|
|
2006
2006
|
constructor(t17, e2) {
|
|
2007
|
-
super(t17, e2), this.change$ = createBehaviorEmitter([]), this.entries = /* @__PURE__ */ new Map(), this.chapterScroll = this.registry.getPlugin(
|
|
2007
|
+
super(t17, e2), this.change$ = createBehaviorEmitter([]), this.entries = /* @__PURE__ */ new Map(), this.chapterScroll = this.registry.getPlugin(_t$1.id), this.chapterManager = this.registry.getPlugin(Gt$1.id), this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
|
|
2008
2008
|
}
|
|
2009
2009
|
async initialize(e2) {
|
|
2010
2010
|
var a3;
|
|
@@ -2020,7 +2020,7 @@ const Wt = class t7 extends BasePlugin {
|
|
|
2020
2020
|
return { addBookmark: (t17) => this.addBookmark(t17), removeBookmark: (t17) => this.removeBookmark(t17), updateBookmark: (t17, e2) => this.updateBookmark(t17, e2), listBookmarks: () => this.list(), getBookmark: (t17) => this.entries.get(t17) ?? null, scrollToBookmark: (t17) => this.scrollToBookmark(t17), requestRemoveBookmark: (t17) => this.requestRemoveBookmark(t17), onBookmarksChange: this.change$.on };
|
|
2021
2021
|
}
|
|
2022
2022
|
addBookmark(t17) {
|
|
2023
|
-
for (const s9 of this.entries.values()) if (
|
|
2023
|
+
for (const s9 of this.entries.values()) if (Wt$1(s9.anchor, t17.anchor)) return s9;
|
|
2024
2024
|
const e2 = t17.id ?? `bm-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`, a3 = { id: e2, label: t17.label, anchor: t17.anchor, metadata: t17.metadata, createdAt: Date.now() };
|
|
2025
2025
|
return this.entries.set(e2, a3), this.notifyAndPersist(), a3;
|
|
2026
2026
|
}
|
|
@@ -2068,13 +2068,13 @@ const Wt = class t7 extends BasePlugin {
|
|
|
2068
2068
|
const e3 = t18.rectPdfCoord;
|
|
2069
2069
|
return e3.origin.y + e3.size.height;
|
|
2070
2070
|
})(e2.anchor);
|
|
2071
|
-
await
|
|
2071
|
+
await Ht$1(a3, s9, i);
|
|
2072
2072
|
}
|
|
2073
2073
|
};
|
|
2074
|
-
|
|
2075
|
-
let
|
|
2076
|
-
function
|
|
2077
|
-
const { provides: m } = useCapability(
|
|
2074
|
+
Bt$1.id = "paragraph-bookmark";
|
|
2075
|
+
let jt$1 = Bt$1;
|
|
2076
|
+
function Zt({ chapterId: a3, localPageIndex: o, pdfPageWidth: n5, pdfPageHeight: l2, cssPageWidth: d, cssPageHeight: c, onBookmarkClick: u, ui: p, className: g, style: f }) {
|
|
2077
|
+
const { provides: m } = useCapability(jt$1.id), [v, b] = useState([]), [P, w] = useState(null), I = useRef(null);
|
|
2078
2078
|
if (useEffect(() => {
|
|
2079
2079
|
if (!m) return;
|
|
2080
2080
|
const t17 = () => {
|
|
@@ -2089,7 +2089,7 @@ function Bt({ chapterId: a3, localPageIndex: o, pdfPageWidth: n5, pdfPageHeight:
|
|
|
2089
2089
|
};
|
|
2090
2090
|
return document.addEventListener("mousedown", t17), () => document.removeEventListener("mousedown", t17);
|
|
2091
2091
|
}, [P]), !m || 0 === v.length || !n5 || !l2) return null;
|
|
2092
|
-
const y = d / n5,
|
|
2092
|
+
const y = d / n5, C = c / l2, M2 = (null == p ? void 0 : p.iconSize) ?? 16;
|
|
2093
2093
|
return jsx("div", { className: g, style: { position: "absolute", inset: 0, pointerEvents: "none", ...f }, children: v.map((a4) => {
|
|
2094
2094
|
var s9;
|
|
2095
2095
|
const i = (null == (s9 = a4.anchor.rectsPdfCoord) ? void 0 : s9.length) ? a4.anchor.rectsPdfCoord : [a4.anchor.rectPdfCoord], r2 = a4.anchor.markerAnchor ?? { x: a4.anchor.rectPdfCoord.origin.x + a4.anchor.rectPdfCoord.size.width, y: a4.anchor.rectPdfCoord.origin.y + a4.anchor.rectPdfCoord.size.height }, { left: o2, top: n6 } = (function(t17) {
|
|
@@ -2098,7 +2098,7 @@ function Bt({ chapterId: a3, localPageIndex: o, pdfPageWidth: n5, pdfPageHeight:
|
|
|
2098
2098
|
h2 ? (l4 = (h2.origin.x + h2.size.width) * s10 + n7, d2 = h2.origin.y * i2 + (h2.size.height * i2 - o3) / 2) : (l4 = e2.x * s10 - o3 / 2, d2 = e2.y * i2 - o3 - n7);
|
|
2099
2099
|
const c2 = Math.max(0, r3 - o3 - 2);
|
|
2100
2100
|
return l4 > c2 && (l4 = c2), d2 < 0 && (d2 = 0), { left: l4, top: d2 };
|
|
2101
|
-
})({ markerPdf: r2, lineRects: i, sx: y, sy:
|
|
2101
|
+
})({ markerPdf: r2, lineRects: i, sx: y, sy: C, cssPageWidth: d, iconSize: M2 }), h = Math.max(0, o2 - 6), l3 = Math.max(0, n6 - 6);
|
|
2102
2102
|
return jsxs("div", { style: { position: "absolute", left: `${h}px`, top: `${l3}px`, width: `${M2 + 12}px`, height: `${M2 + 12}px`, pointerEvents: "auto", zIndex: 20 }, onMouseDown: (t17) => t17.stopPropagation(), children: [(null == p ? void 0 : p.renderIcon) ? /* @__PURE__ */ jsx("div", { role: "button", tabIndex: 0, title: a4.label, "aria-label": `bookmark ${a4.label}`, style: { position: "absolute", left: "6px", top: "6px", width: `${M2}px`, height: `${M2}px`, cursor: "pointer", display: "flex", alignItems: "center", justifyContent: "center", background: "transparent", border: "none", padding: 0 }, onClick: (t17) => {
|
|
2103
2103
|
t17.stopPropagation(), w((t18) => t18 === a4.id ? null : a4.id), null == u || u(a4);
|
|
2104
2104
|
}, children: p.renderIcon({ bookmark: a4 }) }) : /* @__PURE__ */ jsx("button", { type: "button", title: a4.label, onClick: (t17) => {
|
|
@@ -2110,20 +2110,20 @@ function Bt({ chapterId: a3, localPageIndex: o, pdfPageWidth: n5, pdfPageHeight:
|
|
|
2110
2110
|
}, children: "删除书签" }) })] }, a4.id);
|
|
2111
2111
|
}) });
|
|
2112
2112
|
}
|
|
2113
|
-
function
|
|
2113
|
+
function Yt(t17) {
|
|
2114
2114
|
return t17.chapterId;
|
|
2115
2115
|
}
|
|
2116
|
-
function
|
|
2116
|
+
function Xt(t17, e2) {
|
|
2117
2117
|
t17.wait(e2, () => {
|
|
2118
2118
|
});
|
|
2119
2119
|
}
|
|
2120
|
-
function
|
|
2120
|
+
function Kt$1(t17, e2, a3) {
|
|
2121
2121
|
return { chapterId: t17.chapterId, localPageIndex: t17.localPageIndex, globalPageIndex: t17.globalPageIndex, globalPageNumber: t17.globalPageNumber, rectsPdfCoord: e2, selectedText: a3 };
|
|
2122
2122
|
}
|
|
2123
|
-
const
|
|
2123
|
+
const Qt$1 = "note", Jt = { id: Qt$1, name: "Note Plugin", version: "0.1.0", provides: ["note"], requires: ["selection", "chapter-scroll", "chapter-manager"], optional: [], defaultConfig: { callbacks: { onCreateNote: async () => null, onActivateNote: () => {
|
|
2124
2124
|
} }, markerSize: 18 } };
|
|
2125
|
-
const
|
|
2126
|
-
function
|
|
2125
|
+
const te = { kind: "first-wins" };
|
|
2126
|
+
function ee(t17, e2, a3) {
|
|
2127
2127
|
if (1 === e2.length) return e2[0].chapterId;
|
|
2128
2128
|
switch (a3.kind) {
|
|
2129
2129
|
case "first-wins":
|
|
@@ -2141,7 +2141,7 @@ function Jt(t17, e2, a3) {
|
|
|
2141
2141
|
return a3.resolve(t17, e2);
|
|
2142
2142
|
}
|
|
2143
2143
|
}
|
|
2144
|
-
let
|
|
2144
|
+
let ae = class {
|
|
2145
2145
|
constructor(t17) {
|
|
2146
2146
|
this._pages = t17, this._byChapter = /* @__PURE__ */ new Map(), this._byGlobalNumber = /* @__PURE__ */ new Map();
|
|
2147
2147
|
for (const e2 of t17) {
|
|
@@ -2175,8 +2175,8 @@ let te = class {
|
|
|
2175
2175
|
return a3 ? this._pages.indexOf(a3) : -1;
|
|
2176
2176
|
}
|
|
2177
2177
|
};
|
|
2178
|
-
function
|
|
2179
|
-
const a3 = (function(t18, e3 =
|
|
2178
|
+
function se(t17, e2 = te) {
|
|
2179
|
+
const a3 = (function(t18, e3 = te) {
|
|
2180
2180
|
const a4 = /* @__PURE__ */ new Map();
|
|
2181
2181
|
for (const i2 of t18.chapters) {
|
|
2182
2182
|
const [t19, e4] = i2.globalPageRange;
|
|
@@ -2186,7 +2186,7 @@ function ee(t17, e2 = Qt) {
|
|
|
2186
2186
|
}
|
|
2187
2187
|
}
|
|
2188
2188
|
const s10 = /* @__PURE__ */ new Map();
|
|
2189
|
-
for (const [i2, r3] of a4) s10.set(i2,
|
|
2189
|
+
for (const [i2, r3] of a4) s10.set(i2, ee(i2, r3, e3));
|
|
2190
2190
|
return s10;
|
|
2191
2191
|
})(t17, e2), s9 = /* @__PURE__ */ new Map();
|
|
2192
2192
|
for (const n5 of t17.chapters) s9.set(n5.chapterId, n5);
|
|
@@ -2198,14 +2198,14 @@ function ee(t17, e2 = Qt) {
|
|
|
2198
2198
|
const [i2] = e3.globalPageRange, [h] = e3.localPageRange, l2 = h + (n5 - i2);
|
|
2199
2199
|
r2.push({ globalPageIndex: o++, globalPageNumber: n5, chapterId: t18, localPageIndex: l2 });
|
|
2200
2200
|
}
|
|
2201
|
-
return new
|
|
2201
|
+
return new ae(r2);
|
|
2202
2202
|
}
|
|
2203
|
-
const
|
|
2203
|
+
const ie = class t8 extends BasePlugin {
|
|
2204
2204
|
constructor(t17, e2) {
|
|
2205
|
-
super(t17, e2), this.statusChange$ = createBehaviorEmitter(), this.manifestChange$ = createEmitter(), this.overlapStrategy =
|
|
2205
|
+
super(t17, e2), this.statusChange$ = createBehaviorEmitter(), this.manifestChange$ = createEmitter(), this.overlapStrategy = te, 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);
|
|
2206
2206
|
}
|
|
2207
2207
|
async initialize(t17) {
|
|
2208
|
-
if (this.config = t17, this.passwordProvider = t17.passwordProvider, this.overlapStrategy = t17.overlapStrategy ??
|
|
2208
|
+
if (this.config = t17, this.passwordProvider = t17.passwordProvider, this.overlapStrategy = t17.overlapStrategy ?? te, this.setManifestInternal(t17.manifest), this.documentManagerUnsubs.push(this.documentManager.provides().onDocumentOpened((t18) => {
|
|
2209
2209
|
this.isOwnedChapter(t18.id) && (this.passwordAttempts.delete(t18.id), this.updateStatus(t18.id, "loaded"));
|
|
2210
2210
|
}), this.documentManager.provides().onDocumentClosed((t18) => {
|
|
2211
2211
|
this.isOwnedChapter(t18) && this.updateStatus(t18, "closed");
|
|
@@ -2240,7 +2240,7 @@ const ae = class t8 extends BasePlugin {
|
|
|
2240
2240
|
const s9 = new Set(this.chapterStatus.keys()), i = new Set(e2.chapters.map((t17) => t17.chapterId));
|
|
2241
2241
|
for (const t17 of s9) i.has(t17) || (this.closeChapter(t17), this.chapterStatus.delete(t17));
|
|
2242
2242
|
for (const t17 of e2.chapters) this.chapterStatus.has(t17.chapterId) || this.chapterStatus.set(t17.chapterId, "idle");
|
|
2243
|
-
this.manifest = e2, this.virtualPageMap =
|
|
2243
|
+
this.manifest = e2, this.virtualPageMap = se(e2, this.overlapStrategy), this.manifestChange$.emit({ manifest: e2, map: this.virtualPageMap }), this.eagerPrefetchFromManifest();
|
|
2244
2244
|
}
|
|
2245
2245
|
eagerPrefetchFromManifest() {
|
|
2246
2246
|
const t17 = this.config.prefetchChapters ?? 0;
|
|
@@ -2364,10 +2364,10 @@ const ae = class t8 extends BasePlugin {
|
|
|
2364
2364
|
this.chapterStatus.get(t17) !== e2 && (this.chapterStatus.set(t17, e2), this.statusChange$.emit({ chapterId: t17, status: e2, ..."error" === e2 && a3 ? { error: { message: a3 } } : {} }));
|
|
2365
2365
|
}
|
|
2366
2366
|
};
|
|
2367
|
-
|
|
2368
|
-
let
|
|
2369
|
-
const
|
|
2370
|
-
function
|
|
2367
|
+
ie.id = "chapter-manager";
|
|
2368
|
+
let re = ie;
|
|
2369
|
+
const oe = { kind: "first-wins" };
|
|
2370
|
+
function ne(t17, e2, a3) {
|
|
2371
2371
|
if (1 === e2.length) return e2[0].chapterId;
|
|
2372
2372
|
switch (a3.kind) {
|
|
2373
2373
|
case "first-wins":
|
|
@@ -2385,7 +2385,7 @@ function re(t17, e2, a3) {
|
|
|
2385
2385
|
return a3.resolve(t17, e2);
|
|
2386
2386
|
}
|
|
2387
2387
|
}
|
|
2388
|
-
let
|
|
2388
|
+
let he = class {
|
|
2389
2389
|
constructor(t17) {
|
|
2390
2390
|
this._pages = t17, this._byChapter = /* @__PURE__ */ new Map(), this._byGlobalNumber = /* @__PURE__ */ new Map();
|
|
2391
2391
|
for (const e2 of t17) {
|
|
@@ -2419,8 +2419,8 @@ let oe = class {
|
|
|
2419
2419
|
return a3 ? this._pages.indexOf(a3) : -1;
|
|
2420
2420
|
}
|
|
2421
2421
|
};
|
|
2422
|
-
function
|
|
2423
|
-
const a3 = (function(t18, e3 =
|
|
2422
|
+
function le(t17, e2 = oe) {
|
|
2423
|
+
const a3 = (function(t18, e3 = oe) {
|
|
2424
2424
|
const a4 = /* @__PURE__ */ new Map();
|
|
2425
2425
|
for (const i2 of t18.chapters) {
|
|
2426
2426
|
const [t19, e4] = i2.globalPageRange;
|
|
@@ -2430,7 +2430,7 @@ function ne(t17, e2 = ie) {
|
|
|
2430
2430
|
}
|
|
2431
2431
|
}
|
|
2432
2432
|
const s10 = /* @__PURE__ */ new Map();
|
|
2433
|
-
for (const [i2, r3] of a4) s10.set(i2,
|
|
2433
|
+
for (const [i2, r3] of a4) s10.set(i2, ne(i2, r3, e3));
|
|
2434
2434
|
return s10;
|
|
2435
2435
|
})(t17, e2), s9 = /* @__PURE__ */ new Map();
|
|
2436
2436
|
for (const n5 of t17.chapters) s9.set(n5.chapterId, n5);
|
|
@@ -2442,14 +2442,14 @@ function ne(t17, e2 = ie) {
|
|
|
2442
2442
|
const [i2] = e3.globalPageRange, [h] = e3.localPageRange, l2 = h + (n5 - i2);
|
|
2443
2443
|
r2.push({ globalPageIndex: o++, globalPageNumber: n5, chapterId: t18, localPageIndex: l2 });
|
|
2444
2444
|
}
|
|
2445
|
-
return new
|
|
2445
|
+
return new he(r2);
|
|
2446
2446
|
}
|
|
2447
|
-
const
|
|
2447
|
+
const de = class t9 extends BasePlugin {
|
|
2448
2448
|
constructor(t17, e2) {
|
|
2449
|
-
super(t17, e2), this.statusChange$ = createBehaviorEmitter(), this.manifestChange$ = createEmitter(), this.overlapStrategy =
|
|
2449
|
+
super(t17, e2), this.statusChange$ = createBehaviorEmitter(), this.manifestChange$ = createEmitter(), this.overlapStrategy = oe, 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);
|
|
2450
2450
|
}
|
|
2451
2451
|
async initialize(t17) {
|
|
2452
|
-
if (this.config = t17, this.passwordProvider = t17.passwordProvider, this.overlapStrategy = t17.overlapStrategy ??
|
|
2452
|
+
if (this.config = t17, this.passwordProvider = t17.passwordProvider, this.overlapStrategy = t17.overlapStrategy ?? oe, this.setManifestInternal(t17.manifest), this.documentManagerUnsubs.push(this.documentManager.provides().onDocumentOpened((t18) => {
|
|
2453
2453
|
this.isOwnedChapter(t18.id) && (this.passwordAttempts.delete(t18.id), this.updateStatus(t18.id, "loaded"));
|
|
2454
2454
|
}), this.documentManager.provides().onDocumentClosed((t18) => {
|
|
2455
2455
|
this.isOwnedChapter(t18) && this.updateStatus(t18, "closed");
|
|
@@ -2484,7 +2484,7 @@ const he = class t9 extends BasePlugin {
|
|
|
2484
2484
|
const s9 = new Set(this.chapterStatus.keys()), i = new Set(e2.chapters.map((t17) => t17.chapterId));
|
|
2485
2485
|
for (const t17 of s9) i.has(t17) || (this.closeChapter(t17), this.chapterStatus.delete(t17));
|
|
2486
2486
|
for (const t17 of e2.chapters) this.chapterStatus.has(t17.chapterId) || this.chapterStatus.set(t17.chapterId, "idle");
|
|
2487
|
-
this.manifest = e2, this.virtualPageMap =
|
|
2487
|
+
this.manifest = e2, this.virtualPageMap = le(e2, this.overlapStrategy), this.manifestChange$.emit({ manifest: e2, map: this.virtualPageMap }), this.eagerPrefetchFromManifest();
|
|
2488
2488
|
}
|
|
2489
2489
|
eagerPrefetchFromManifest() {
|
|
2490
2490
|
const t17 = this.config.prefetchChapters ?? 0;
|
|
@@ -2608,11 +2608,11 @@ const he = class t9 extends BasePlugin {
|
|
|
2608
2608
|
this.chapterStatus.get(t17) !== e2 && (this.chapterStatus.set(t17, e2), this.statusChange$.emit({ chapterId: t17, status: e2, ..."error" === e2 && a3 ? { error: { message: a3 } } : {} }));
|
|
2609
2609
|
}
|
|
2610
2610
|
};
|
|
2611
|
-
|
|
2612
|
-
let
|
|
2613
|
-
const
|
|
2611
|
+
de.id = "chapter-manager";
|
|
2612
|
+
let ce = de;
|
|
2613
|
+
const ue = class extends BasePlugin {
|
|
2614
2614
|
constructor(t17, e2) {
|
|
2615
|
-
super(t17, e2), this.layoutChange$ = createBehaviorEmitter(), 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(
|
|
2615
|
+
super(t17, e2), this.layoutChange$ = createBehaviorEmitter(), 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(ce.id), this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
|
|
2616
2616
|
}
|
|
2617
2617
|
async initialize(t17) {
|
|
2618
2618
|
this.config = { placeholderPageHeight: t17.placeholderPageHeight ?? 1200, placeholderPageWidth: t17.placeholderPageWidth ?? 900, bufferSize: t17.bufferSize ?? 2, pageGap: t17.pageGap ?? 20 }, this.virtualPageMap = this.chapterManager.provides().getVirtualPageMap(), this.rebuildOffsets(), this.chapterManagerUnsubs.push(this.chapterManager.provides().onManifestChange(({ map: t18 }) => {
|
|
@@ -2781,11 +2781,11 @@ const de = class extends BasePlugin {
|
|
|
2781
2781
|
a3 && this.scrollToIndex(a3.globalPageIndex, e2);
|
|
2782
2782
|
}
|
|
2783
2783
|
};
|
|
2784
|
-
|
|
2785
|
-
let
|
|
2786
|
-
const
|
|
2784
|
+
ue.id = "chapter-scroll";
|
|
2785
|
+
let pe = ue;
|
|
2786
|
+
const ge = class t10 extends BasePlugin {
|
|
2787
2787
|
constructor(t17, e2) {
|
|
2788
|
-
super(t17, e2), this.notesChange$ = createBehaviorEmitter([]), this.noteActivated$ = createEmitter(), this.notes = /* @__PURE__ */ new Map(), this.chapterScroll = this.registry.getPlugin(
|
|
2788
|
+
super(t17, e2), this.notesChange$ = createBehaviorEmitter([]), this.noteActivated$ = createEmitter(), this.notes = /* @__PURE__ */ new Map(), this.chapterScroll = this.registry.getPlugin(pe.id), this.chapterManager = this.registry.getPlugin(re.id), this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
|
|
2789
2789
|
}
|
|
2790
2790
|
async initialize(e2) {
|
|
2791
2791
|
if (this.config = e2, e2.callbacks.loadNotes) try {
|
|
@@ -2815,7 +2815,7 @@ const ue = class t10 extends BasePlugin {
|
|
|
2815
2815
|
return Array.from(this.notes.values());
|
|
2816
2816
|
}
|
|
2817
2817
|
buildDraft(t17) {
|
|
2818
|
-
return { chapterId: t17.chapterId, localPageIndex: t17.localPageIndex, globalPageNumber: t17.globalPageNumber, globalPageIndex: t17.globalPageIndex, rectsPdfCoord: t17.rectsPdfCoord, endAnchor:
|
|
2818
|
+
return { chapterId: t17.chapterId, localPageIndex: t17.localPageIndex, globalPageNumber: t17.globalPageNumber, globalPageIndex: t17.globalPageIndex, rectsPdfCoord: t17.rectsPdfCoord, endAnchor: me(t17.rectsPdfCoord), selectedText: t17.selectedText, content: t17.content };
|
|
2819
2819
|
}
|
|
2820
2820
|
async requestCreateFromSelection(t17) {
|
|
2821
2821
|
if (0 === t17.rectsPdfCoord.length) return null;
|
|
@@ -2882,15 +2882,15 @@ const ue = class t10 extends BasePlugin {
|
|
|
2882
2882
|
});
|
|
2883
2883
|
}
|
|
2884
2884
|
};
|
|
2885
|
-
|
|
2886
|
-
let
|
|
2887
|
-
function
|
|
2885
|
+
ge.id = "note";
|
|
2886
|
+
let fe = ge;
|
|
2887
|
+
function me(t17) {
|
|
2888
2888
|
const e2 = t17[t17.length - 1];
|
|
2889
2889
|
return { x: e2.origin.x + e2.size.width, y: e2.origin.y + e2.size.height };
|
|
2890
2890
|
}
|
|
2891
|
-
const
|
|
2892
|
-
const
|
|
2893
|
-
function
|
|
2891
|
+
const ve = { manifest: Jt, create: (t17) => new fe(Qt$1, t17), reducer: (t17) => t17, initialState: {} }, be = "paragraph-bookmark", Pe = { id: be, name: "Paragraph Bookmark Plugin", version: "0.1.0", provides: ["paragraph-bookmark"], requires: ["chapter-scroll", "chapter-manager"], optional: [], defaultConfig: {} };
|
|
2892
|
+
const we = { kind: "first-wins" };
|
|
2893
|
+
function Ie(t17, e2, a3) {
|
|
2894
2894
|
if (1 === e2.length) return e2[0].chapterId;
|
|
2895
2895
|
switch (a3.kind) {
|
|
2896
2896
|
case "first-wins":
|
|
@@ -2908,7 +2908,7 @@ function Pe(t17, e2, a3) {
|
|
|
2908
2908
|
return a3.resolve(t17, e2);
|
|
2909
2909
|
}
|
|
2910
2910
|
}
|
|
2911
|
-
let
|
|
2911
|
+
let ye = class {
|
|
2912
2912
|
constructor(t17) {
|
|
2913
2913
|
this._pages = t17, this._byChapter = /* @__PURE__ */ new Map(), this._byGlobalNumber = /* @__PURE__ */ new Map();
|
|
2914
2914
|
for (const e2 of t17) {
|
|
@@ -2942,8 +2942,8 @@ let we = class {
|
|
|
2942
2942
|
return a3 ? this._pages.indexOf(a3) : -1;
|
|
2943
2943
|
}
|
|
2944
2944
|
};
|
|
2945
|
-
function
|
|
2946
|
-
const a3 = (function(t18, e3 =
|
|
2945
|
+
function Ce(t17, e2 = we) {
|
|
2946
|
+
const a3 = (function(t18, e3 = we) {
|
|
2947
2947
|
const a4 = /* @__PURE__ */ new Map();
|
|
2948
2948
|
for (const i2 of t18.chapters) {
|
|
2949
2949
|
const [t19, e4] = i2.globalPageRange;
|
|
@@ -2953,7 +2953,7 @@ function Ie(t17, e2 = be) {
|
|
|
2953
2953
|
}
|
|
2954
2954
|
}
|
|
2955
2955
|
const s10 = /* @__PURE__ */ new Map();
|
|
2956
|
-
for (const [i2, r3] of a4) s10.set(i2,
|
|
2956
|
+
for (const [i2, r3] of a4) s10.set(i2, Ie(i2, r3, e3));
|
|
2957
2957
|
return s10;
|
|
2958
2958
|
})(t17, e2), s9 = /* @__PURE__ */ new Map();
|
|
2959
2959
|
for (const n5 of t17.chapters) s9.set(n5.chapterId, n5);
|
|
@@ -2965,14 +2965,14 @@ function Ie(t17, e2 = be) {
|
|
|
2965
2965
|
const [i2] = e3.globalPageRange, [h] = e3.localPageRange, l2 = h + (n5 - i2);
|
|
2966
2966
|
r2.push({ globalPageIndex: o++, globalPageNumber: n5, chapterId: t18, localPageIndex: l2 });
|
|
2967
2967
|
}
|
|
2968
|
-
return new
|
|
2968
|
+
return new ye(r2);
|
|
2969
2969
|
}
|
|
2970
|
-
const
|
|
2970
|
+
const Me = class t11 extends BasePlugin {
|
|
2971
2971
|
constructor(t17, e2) {
|
|
2972
|
-
super(t17, e2), this.statusChange$ = createBehaviorEmitter(), this.manifestChange$ = createEmitter(), this.overlapStrategy =
|
|
2972
|
+
super(t17, e2), this.statusChange$ = createBehaviorEmitter(), this.manifestChange$ = createEmitter(), this.overlapStrategy = we, 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);
|
|
2973
2973
|
}
|
|
2974
2974
|
async initialize(t17) {
|
|
2975
|
-
if (this.config = t17, this.passwordProvider = t17.passwordProvider, this.overlapStrategy = t17.overlapStrategy ??
|
|
2975
|
+
if (this.config = t17, this.passwordProvider = t17.passwordProvider, this.overlapStrategy = t17.overlapStrategy ?? we, this.setManifestInternal(t17.manifest), this.documentManagerUnsubs.push(this.documentManager.provides().onDocumentOpened((t18) => {
|
|
2976
2976
|
this.isOwnedChapter(t18.id) && (this.passwordAttempts.delete(t18.id), this.updateStatus(t18.id, "loaded"));
|
|
2977
2977
|
}), this.documentManager.provides().onDocumentClosed((t18) => {
|
|
2978
2978
|
this.isOwnedChapter(t18) && this.updateStatus(t18, "closed");
|
|
@@ -3007,7 +3007,7 @@ const ye = class t11 extends BasePlugin {
|
|
|
3007
3007
|
const s9 = new Set(this.chapterStatus.keys()), i = new Set(e2.chapters.map((t17) => t17.chapterId));
|
|
3008
3008
|
for (const t17 of s9) i.has(t17) || (this.closeChapter(t17), this.chapterStatus.delete(t17));
|
|
3009
3009
|
for (const t17 of e2.chapters) this.chapterStatus.has(t17.chapterId) || this.chapterStatus.set(t17.chapterId, "idle");
|
|
3010
|
-
this.manifest = e2, this.virtualPageMap =
|
|
3010
|
+
this.manifest = e2, this.virtualPageMap = Ce(e2, this.overlapStrategy), this.manifestChange$.emit({ manifest: e2, map: this.virtualPageMap }), this.eagerPrefetchFromManifest();
|
|
3011
3011
|
}
|
|
3012
3012
|
eagerPrefetchFromManifest() {
|
|
3013
3013
|
const t17 = this.config.prefetchChapters ?? 0;
|
|
@@ -3131,10 +3131,10 @@ const ye = class t11 extends BasePlugin {
|
|
|
3131
3131
|
this.chapterStatus.get(t17) !== e2 && (this.chapterStatus.set(t17, e2), this.statusChange$.emit({ chapterId: t17, status: e2, ..."error" === e2 && a3 ? { error: { message: a3 } } : {} }));
|
|
3132
3132
|
}
|
|
3133
3133
|
};
|
|
3134
|
-
|
|
3135
|
-
let
|
|
3136
|
-
const
|
|
3137
|
-
function
|
|
3134
|
+
Me.id = "chapter-manager";
|
|
3135
|
+
let Se = Me;
|
|
3136
|
+
const xe = { kind: "first-wins" };
|
|
3137
|
+
function $e(t17, e2, a3) {
|
|
3138
3138
|
if (1 === e2.length) return e2[0].chapterId;
|
|
3139
3139
|
switch (a3.kind) {
|
|
3140
3140
|
case "first-wins":
|
|
@@ -3152,7 +3152,7 @@ function Se(t17, e2, a3) {
|
|
|
3152
3152
|
return a3.resolve(t17, e2);
|
|
3153
3153
|
}
|
|
3154
3154
|
}
|
|
3155
|
-
class
|
|
3155
|
+
class ke {
|
|
3156
3156
|
constructor(t17) {
|
|
3157
3157
|
this._pages = t17, this._byChapter = /* @__PURE__ */ new Map(), this._byGlobalNumber = /* @__PURE__ */ new Map();
|
|
3158
3158
|
for (const e2 of t17) {
|
|
@@ -3186,8 +3186,8 @@ class xe {
|
|
|
3186
3186
|
return a3 ? this._pages.indexOf(a3) : -1;
|
|
3187
3187
|
}
|
|
3188
3188
|
}
|
|
3189
|
-
function
|
|
3190
|
-
const a3 = (function(t18, e3 =
|
|
3189
|
+
function Le(t17, e2 = xe) {
|
|
3190
|
+
const a3 = (function(t18, e3 = xe) {
|
|
3191
3191
|
const a4 = /* @__PURE__ */ new Map();
|
|
3192
3192
|
for (const i2 of t18.chapters) {
|
|
3193
3193
|
const [t19, e4] = i2.globalPageRange;
|
|
@@ -3197,7 +3197,7 @@ function $e(t17, e2 = Me) {
|
|
|
3197
3197
|
}
|
|
3198
3198
|
}
|
|
3199
3199
|
const s10 = /* @__PURE__ */ new Map();
|
|
3200
|
-
for (const [i2, r3] of a4) s10.set(i2,
|
|
3200
|
+
for (const [i2, r3] of a4) s10.set(i2, $e(i2, r3, e3));
|
|
3201
3201
|
return s10;
|
|
3202
3202
|
})(t17, e2), s9 = /* @__PURE__ */ new Map();
|
|
3203
3203
|
for (const n5 of t17.chapters) s9.set(n5.chapterId, n5);
|
|
@@ -3209,14 +3209,14 @@ function $e(t17, e2 = Me) {
|
|
|
3209
3209
|
const [i2] = e3.globalPageRange, [h] = e3.localPageRange, l2 = h + (n5 - i2);
|
|
3210
3210
|
r2.push({ globalPageIndex: o++, globalPageNumber: n5, chapterId: t18, localPageIndex: l2 });
|
|
3211
3211
|
}
|
|
3212
|
-
return new
|
|
3212
|
+
return new ke(r2);
|
|
3213
3213
|
}
|
|
3214
|
-
const
|
|
3214
|
+
const ze = class t12 extends BasePlugin {
|
|
3215
3215
|
constructor(t17, e2) {
|
|
3216
|
-
super(t17, e2), this.statusChange$ = createBehaviorEmitter(), this.manifestChange$ = createEmitter(), this.overlapStrategy =
|
|
3216
|
+
super(t17, e2), this.statusChange$ = createBehaviorEmitter(), this.manifestChange$ = createEmitter(), this.overlapStrategy = xe, 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);
|
|
3217
3217
|
}
|
|
3218
3218
|
async initialize(t17) {
|
|
3219
|
-
if (this.config = t17, this.passwordProvider = t17.passwordProvider, this.overlapStrategy = t17.overlapStrategy ??
|
|
3219
|
+
if (this.config = t17, this.passwordProvider = t17.passwordProvider, this.overlapStrategy = t17.overlapStrategy ?? xe, this.setManifestInternal(t17.manifest), this.documentManagerUnsubs.push(this.documentManager.provides().onDocumentOpened((t18) => {
|
|
3220
3220
|
this.isOwnedChapter(t18.id) && (this.passwordAttempts.delete(t18.id), this.updateStatus(t18.id, "loaded"));
|
|
3221
3221
|
}), this.documentManager.provides().onDocumentClosed((t18) => {
|
|
3222
3222
|
this.isOwnedChapter(t18) && this.updateStatus(t18, "closed");
|
|
@@ -3251,7 +3251,7 @@ const ke = class t12 extends BasePlugin {
|
|
|
3251
3251
|
const s9 = new Set(this.chapterStatus.keys()), i = new Set(e2.chapters.map((t17) => t17.chapterId));
|
|
3252
3252
|
for (const t17 of s9) i.has(t17) || (this.closeChapter(t17), this.chapterStatus.delete(t17));
|
|
3253
3253
|
for (const t17 of e2.chapters) this.chapterStatus.has(t17.chapterId) || this.chapterStatus.set(t17.chapterId, "idle");
|
|
3254
|
-
this.manifest = e2, this.virtualPageMap =
|
|
3254
|
+
this.manifest = e2, this.virtualPageMap = Le(e2, this.overlapStrategy), this.manifestChange$.emit({ manifest: e2, map: this.virtualPageMap }), this.eagerPrefetchFromManifest();
|
|
3255
3255
|
}
|
|
3256
3256
|
eagerPrefetchFromManifest() {
|
|
3257
3257
|
const t17 = this.config.prefetchChapters ?? 0;
|
|
@@ -3375,11 +3375,11 @@ const ke = class t12 extends BasePlugin {
|
|
|
3375
3375
|
this.chapterStatus.get(t17) !== e2 && (this.chapterStatus.set(t17, e2), this.statusChange$.emit({ chapterId: t17, status: e2, ..."error" === e2 && a3 ? { error: { message: a3 } } : {} }));
|
|
3376
3376
|
}
|
|
3377
3377
|
};
|
|
3378
|
-
|
|
3379
|
-
let
|
|
3380
|
-
const
|
|
3378
|
+
ze.id = "chapter-manager";
|
|
3379
|
+
let De = ze;
|
|
3380
|
+
const Te = class extends BasePlugin {
|
|
3381
3381
|
constructor(t17, e2) {
|
|
3382
|
-
super(t17, e2), this.layoutChange$ = createBehaviorEmitter(), 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(
|
|
3382
|
+
super(t17, e2), this.layoutChange$ = createBehaviorEmitter(), 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(De.id), this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
|
|
3383
3383
|
}
|
|
3384
3384
|
async initialize(t17) {
|
|
3385
3385
|
this.config = { placeholderPageHeight: t17.placeholderPageHeight ?? 1200, placeholderPageWidth: t17.placeholderPageWidth ?? 900, bufferSize: t17.bufferSize ?? 2, pageGap: t17.pageGap ?? 20 }, this.virtualPageMap = this.chapterManager.provides().getVirtualPageMap(), this.rebuildOffsets(), this.chapterManagerUnsubs.push(this.chapterManager.provides().onManifestChange(({ map: t18 }) => {
|
|
@@ -3548,36 +3548,36 @@ const ze = class extends BasePlugin {
|
|
|
3548
3548
|
a3 && this.scrollToIndex(a3.globalPageIndex, e2);
|
|
3549
3549
|
}
|
|
3550
3550
|
};
|
|
3551
|
-
|
|
3552
|
-
let
|
|
3553
|
-
function
|
|
3551
|
+
Te.id = "chapter-scroll";
|
|
3552
|
+
let Ge = Te;
|
|
3553
|
+
function Oe(t17) {
|
|
3554
3554
|
if (0 === t17.length) throw new Error("unionRects: empty rects");
|
|
3555
3555
|
let e2 = 1 / 0, a3 = 1 / 0, s9 = -1 / 0, i = -1 / 0;
|
|
3556
3556
|
for (const r2 of t17) e2 = Math.min(e2, r2.origin.x), a3 = Math.min(a3, r2.origin.y), s9 = Math.max(s9, r2.origin.x + r2.size.width), i = Math.max(i, r2.origin.y + r2.size.height);
|
|
3557
3557
|
return { origin: { x: e2, y: a3 }, size: { width: s9 - e2, height: i - a3 } };
|
|
3558
3558
|
}
|
|
3559
|
-
function
|
|
3559
|
+
function Ae(t17) {
|
|
3560
3560
|
const e2 = t17[t17.length - 1];
|
|
3561
3561
|
return { x: e2.origin.x + e2.size.width, y: e2.origin.y + e2.size.height };
|
|
3562
3562
|
}
|
|
3563
|
-
function
|
|
3563
|
+
function Ne(t17, e2) {
|
|
3564
3564
|
const a3 = t17.origin.y, s9 = t17.origin.y + t17.size.height, i = e2.origin.y, r2 = e2.origin.y + e2.size.height, o = Math.max(s9, r2) - Math.min(a3, i);
|
|
3565
3565
|
if (o <= 0) return 0;
|
|
3566
3566
|
return Math.max(0, Math.min(s9, r2) - Math.max(a3, i)) / o;
|
|
3567
3567
|
}
|
|
3568
|
-
function
|
|
3568
|
+
function Ve(t17, e2) {
|
|
3569
3569
|
var a3, s9;
|
|
3570
3570
|
if (t17.chapterId !== e2.chapterId || t17.localPageIndex !== e2.localPageIndex) return false;
|
|
3571
|
-
const i = (null == (a3 = t17.rectsPdfCoord) ? void 0 : a3.length) ? t17.rectsPdfCoord : [t17.rectPdfCoord], r2 = (null == (s9 = e2.rectsPdfCoord) ? void 0 : s9.length) ? e2.rectsPdfCoord : [e2.rectPdfCoord], o = t17.markerAnchor ??
|
|
3571
|
+
const i = (null == (a3 = t17.rectsPdfCoord) ? void 0 : a3.length) ? t17.rectsPdfCoord : [t17.rectPdfCoord], r2 = (null == (s9 = e2.rectsPdfCoord) ? void 0 : s9.length) ? e2.rectsPdfCoord : [e2.rectPdfCoord], o = t17.markerAnchor ?? Ae(i), n5 = e2.markerAnchor ?? Ae(r2);
|
|
3572
3572
|
if (Math.hypot(o.x - n5.x, o.y - n5.y) <= 6) return true;
|
|
3573
3573
|
for (const h of i) for (const t18 of r2) {
|
|
3574
|
-
if (
|
|
3574
|
+
if (Ne(h, t18) < 0.5) continue;
|
|
3575
3575
|
const e3 = Math.max(h.origin.x, t18.origin.x);
|
|
3576
3576
|
if (Math.min(h.origin.x + h.size.width, t18.origin.x + t18.size.width) - e3 > 0.25 * Math.min(h.size.width, t18.size.width)) return true;
|
|
3577
3577
|
}
|
|
3578
3578
|
return false;
|
|
3579
3579
|
}
|
|
3580
|
-
async function
|
|
3580
|
+
async function Re(t17, e2, a3) {
|
|
3581
3581
|
t17.scrollToGlobalPageIndex(e2), await (function(t18, e3, a4 = 2500) {
|
|
3582
3582
|
const s9 = t18.getLayout().items.find((t19) => t19.globalPageIndex === e3 && !t19.isPlaceholder);
|
|
3583
3583
|
return s9 ? Promise.resolve(s9) : new Promise((s10) => {
|
|
@@ -3590,9 +3590,9 @@ async function Ne(t17, e2, a3) {
|
|
|
3590
3590
|
});
|
|
3591
3591
|
})(t17, e2), t17.scrollToGlobalPdfPoint(e2, a3, { marginTop: 80 });
|
|
3592
3592
|
}
|
|
3593
|
-
const
|
|
3593
|
+
const Ee = class t13 extends BasePlugin {
|
|
3594
3594
|
constructor(t17, e2) {
|
|
3595
|
-
super(t17, e2), this.change$ = createBehaviorEmitter([]), this.entries = /* @__PURE__ */ new Map(), this.chapterScroll = this.registry.getPlugin(
|
|
3595
|
+
super(t17, e2), this.change$ = createBehaviorEmitter([]), this.entries = /* @__PURE__ */ new Map(), this.chapterScroll = this.registry.getPlugin(Ge.id), this.chapterManager = this.registry.getPlugin(Se.id), this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
|
|
3596
3596
|
}
|
|
3597
3597
|
async initialize(e2) {
|
|
3598
3598
|
var a3;
|
|
@@ -3608,7 +3608,7 @@ const Ve = class t13 extends BasePlugin {
|
|
|
3608
3608
|
return { addBookmark: (t17) => this.addBookmark(t17), removeBookmark: (t17) => this.removeBookmark(t17), updateBookmark: (t17, e2) => this.updateBookmark(t17, e2), listBookmarks: () => this.list(), getBookmark: (t17) => this.entries.get(t17) ?? null, scrollToBookmark: (t17) => this.scrollToBookmark(t17), requestRemoveBookmark: (t17) => this.requestRemoveBookmark(t17), onBookmarksChange: this.change$.on };
|
|
3609
3609
|
}
|
|
3610
3610
|
addBookmark(t17) {
|
|
3611
|
-
for (const s9 of this.entries.values()) if (
|
|
3611
|
+
for (const s9 of this.entries.values()) if (Ve(s9.anchor, t17.anchor)) return s9;
|
|
3612
3612
|
const e2 = t17.id ?? `bm-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`, a3 = { id: e2, label: t17.label, anchor: t17.anchor, metadata: t17.metadata, createdAt: Date.now() };
|
|
3613
3613
|
return this.entries.set(e2, a3), this.notifyAndPersist(), a3;
|
|
3614
3614
|
}
|
|
@@ -3656,36 +3656,36 @@ const Ve = class t13 extends BasePlugin {
|
|
|
3656
3656
|
const e3 = t18.rectPdfCoord;
|
|
3657
3657
|
return e3.origin.y + e3.size.height;
|
|
3658
3658
|
})(e2.anchor);
|
|
3659
|
-
await
|
|
3659
|
+
await Re(a3, s9, i);
|
|
3660
3660
|
}
|
|
3661
3661
|
};
|
|
3662
|
-
|
|
3663
|
-
let
|
|
3664
|
-
const
|
|
3665
|
-
function
|
|
3662
|
+
Ee.id = "paragraph-bookmark";
|
|
3663
|
+
let Ue = Ee;
|
|
3664
|
+
const _e = { manifest: Pe, create: (t17) => new Ue(be, t17), reducer: (t17) => t17, initialState: {} };
|
|
3665
|
+
function Fe(t17) {
|
|
3666
3666
|
const { provides: e2 } = useCapability(DocumentManagerPlugin.id);
|
|
3667
3667
|
useEffect(() => {
|
|
3668
3668
|
e2 && t17 && e2.isDocumentOpen(t17) && e2.setActiveDocument(t17);
|
|
3669
3669
|
}, [e2, t17]);
|
|
3670
3670
|
}
|
|
3671
|
-
function
|
|
3671
|
+
function qe() {
|
|
3672
3672
|
const { registry: t17 } = useRegistry();
|
|
3673
|
-
return !!(t17 == null ? void 0 : t17.getPlugin(
|
|
3673
|
+
return !!(t17 == null ? void 0 : t17.getPlugin(fe.id));
|
|
3674
3674
|
}
|
|
3675
|
-
function
|
|
3675
|
+
function We() {
|
|
3676
3676
|
const { registry: t17 } = useRegistry();
|
|
3677
|
-
return !!(t17 == null ? void 0 : t17.getPlugin(
|
|
3677
|
+
return !!(t17 == null ? void 0 : t17.getPlugin(Ue.id));
|
|
3678
3678
|
}
|
|
3679
|
-
function
|
|
3679
|
+
function He() {
|
|
3680
3680
|
const { registry: t17 } = useRegistry();
|
|
3681
3681
|
return useMemo(() => {
|
|
3682
3682
|
var _a2, _b;
|
|
3683
|
-
const e2 = (_b = (_a2 = t17 == null ? void 0 : t17.getPlugin(
|
|
3683
|
+
const e2 = (_b = (_a2 = t17 == null ? void 0 : t17.getPlugin(fe.id)) == null ? void 0 : _a2.provides) == null ? void 0 : _b.call(_a2);
|
|
3684
3684
|
return e2 ? (t18) => e2.createNoteFromSelection(t18) : null;
|
|
3685
3685
|
}, [t17]);
|
|
3686
3686
|
}
|
|
3687
|
-
function
|
|
3688
|
-
const u =
|
|
3687
|
+
function Be({ item: e2, pdfPageWidth: a3, pdfPageHeight: o, cssPageWidth: l2, cssPageHeight: d, hoverUi: c }) {
|
|
3688
|
+
const u = Yt(e2), { provides: p } = useCapability(SelectionPlugin.id), { provides: g } = useCapability(Ue.id), f = useRef(null), [w, I] = useState(null), [y, C] = useState(null), [M2, S2] = useState(null), x2 = (c == null ? void 0 : c.iconSize) ?? 16;
|
|
3689
3689
|
useEffect(() => {
|
|
3690
3690
|
if (!p) return;
|
|
3691
3691
|
const t17 = p.forDocument(u), a4 = () => {
|
|
@@ -3712,13 +3712,13 @@ function We({ item: e2, pdfPageWidth: a3, pdfPageHeight: o, cssPageWidth: l2, cs
|
|
|
3712
3712
|
const t17 = (t18) => {
|
|
3713
3713
|
if (M2) return;
|
|
3714
3714
|
if (p) try {
|
|
3715
|
-
if (p.forDocument(u).getState().selecting) return void
|
|
3715
|
+
if (p.forDocument(u).getState().selecting) return void C(null);
|
|
3716
3716
|
} catch {
|
|
3717
3717
|
}
|
|
3718
3718
|
const e3 = f.current;
|
|
3719
3719
|
if (!e3) return;
|
|
3720
3720
|
const s9 = e3.getBoundingClientRect();
|
|
3721
|
-
if (t18.clientX < s9.left || t18.clientX > s9.right || t18.clientY < s9.top || t18.clientY > s9.bottom) return void
|
|
3721
|
+
if (t18.clientX < s9.left || t18.clientX > s9.right || t18.clientY < s9.top || t18.clientY > s9.bottom) return void C(null);
|
|
3722
3722
|
const i = (function(t19, e4) {
|
|
3723
3723
|
const a4 = glyphAt(t19, e4);
|
|
3724
3724
|
if (a4 < 0) return null;
|
|
@@ -3727,16 +3727,16 @@ function We({ item: e2, pdfPageWidth: a3, pdfPageHeight: o, cssPageWidth: l2, cs
|
|
|
3727
3727
|
const i2 = rectsWithinSlice(t19, s10.from, s10.to);
|
|
3728
3728
|
return 0 === i2.length ? null : { lineRects: i2, charFrom: s10.from, charTo: s10.to };
|
|
3729
3729
|
})(w, { x: (t18.clientX - s9.left) / (l2 / a3), y: (t18.clientY - s9.top) / (d / o) });
|
|
3730
|
-
|
|
3730
|
+
C((i == null ? void 0 : i.lineRects) ?? null);
|
|
3731
3731
|
};
|
|
3732
3732
|
return document.addEventListener("mousemove", t17), () => document.removeEventListener("mousemove", t17);
|
|
3733
3733
|
}, [w, a3, o, l2, d, p, u, M2]);
|
|
3734
3734
|
const k2 = ($2 == null ? void 0 : $2.length) ? (function(t17, e3, a4, s9) {
|
|
3735
3735
|
const i = a4.length > 0 ? a4 : [];
|
|
3736
3736
|
if (0 === i.length) throw new Error("buildParagraphBookmarkAnchor: no rects");
|
|
3737
|
-
return { chapterId: t17, localPageIndex: e3, globalPageIndex: null == s9 ? void 0 : s9.globalPageIndex, globalPageNumber: null == s9 ? void 0 : s9.globalPageNumber, rectPdfCoord:
|
|
3738
|
-
})(e2.chapterId, e2.localPageIndex, $2, { globalPageIndex: e2.globalPageIndex, globalPageNumber: e2.globalPageNumber }) : null, L2 = k2 && (g == null ? void 0 : g.listBookmarks().some((t17) =>
|
|
3739
|
-
g && k2 && !L2 && (g.addBookmark({ label: `书签 ${/* @__PURE__ */ (/* @__PURE__ */ new Date()).toLocaleTimeString("zh-CN", { hour: "2-digit", minute: "2-digit" })}`, anchor: k2 }),
|
|
3737
|
+
return { chapterId: t17, localPageIndex: e3, globalPageIndex: null == s9 ? void 0 : s9.globalPageIndex, globalPageNumber: null == s9 ? void 0 : s9.globalPageNumber, rectPdfCoord: Oe(i), rectsPdfCoord: i, markerAnchor: Ae(i) };
|
|
3738
|
+
})(e2.chapterId, e2.localPageIndex, $2, { globalPageIndex: e2.globalPageIndex, globalPageNumber: e2.globalPageNumber }) : null, L2 = k2 && (g == null ? void 0 : g.listBookmarks().some((t17) => Ve(t17.anchor, k2))), z2 = useCallback(() => {
|
|
3739
|
+
g && k2 && !L2 && (g.addBookmark({ label: `书签 ${/* @__PURE__ */ (/* @__PURE__ */ new Date()).toLocaleTimeString("zh-CN", { hour: "2-digit", minute: "2-digit" })}`, anchor: k2 }), C(null), S2(null));
|
|
3740
3740
|
}, [g, k2, L2]);
|
|
3741
3741
|
if (!g || !a3 || !o) return null;
|
|
3742
3742
|
const D2 = l2 / a3, T2 = d / o, G2 = $2 == null ? void 0 : $2[$2.length - 1], O2 = G2 ? Math.min((G2.origin.x + G2.size.width) * D2 + 6, Math.max(0, l2 - x2 - 2)) : 0, A2 = G2 ? G2.origin.y * T2 + (G2.size.height * T2 - x2) / 2 : 0, N2 = G2 ? Math.max(0, (G2.origin.x + G2.size.width) * D2 - 4) : 0, V2 = G2 ? Math.max(0, G2.origin.y * T2 - 4) : 0;
|
|
@@ -3746,7 +3746,7 @@ function We({ item: e2, pdfPageWidth: a3, pdfPageHeight: o, cssPageWidth: l2, cs
|
|
|
3746
3746
|
t17.stopPropagation(), z2();
|
|
3747
3747
|
}, style: { position: "absolute", left: O2 - N2 + "px", top: A2 - V2 + "px", width: `${x2}px`, height: `${x2}px`, border: "none", borderRadius: "4px", background: "#3b82f6", color: "#fff", cursor: "pointer", boxShadow: "0 2px 8px rgba(37, 99, 235, 0.45)", fontSize: "12px", lineHeight: 1, padding: 0, display: "flex", alignItems: "center", justifyContent: "center" }, children: "🔖" }) }) });
|
|
3748
3748
|
}
|
|
3749
|
-
const
|
|
3749
|
+
const je = { position: "relative", height: "100%", width: "100%" }, Ze = { highlight: { offsetY: 0 }, underline: { offsetY: 2.5 }, squiggly: { offsetY: 0 }, strikeout: { offsetY: 0 } }, Ye = { highlight: PdfAnnotationSubtype.HIGHLIGHT, underline: PdfAnnotationSubtype.UNDERLINE, squiggly: PdfAnnotationSubtype.SQUIGGLY, strikeout: PdfAnnotationSubtype.STRIKEOUT };
|
|
3750
3750
|
function Xe(t17, e2) {
|
|
3751
3751
|
return 0 === e2 ? t17 : t17.map((t18) => ({ origin: { x: t18.origin.x, y: t18.origin.y + e2 }, size: { ...t18.size } }));
|
|
3752
3752
|
}
|
|
@@ -3755,13 +3755,13 @@ function Ke(t17) {
|
|
|
3755
3755
|
for (const r2 of t17) e2 = Math.min(e2, r2.origin.x), a3 = Math.min(a3, r2.origin.y), s9 = Math.max(s9, r2.origin.x + r2.size.width), i = Math.max(i, r2.origin.y + r2.size.height);
|
|
3756
3756
|
return { origin: { x: e2, y: a3 }, size: { width: s9 - e2, height: i - a3 } };
|
|
3757
3757
|
}
|
|
3758
|
-
function
|
|
3758
|
+
function Qe(t17, e2, a3, s9, i) {
|
|
3759
3759
|
const r2 = a3.forDocument(t17), o = s9.forDocument(t17);
|
|
3760
3760
|
if (!r2 || !o) return false;
|
|
3761
3761
|
const n5 = "highlight" === e2 ? "highlight" : "underline" === e2 ? "underline" : "squiggly" === e2 ? "squiggly" : "strikeout", h = a3.getTool(n5);
|
|
3762
3762
|
if (!h) return false;
|
|
3763
3763
|
const l2 = h.defaults, d = (function(t18, e3) {
|
|
3764
|
-
return { ...
|
|
3764
|
+
return { ...Ze[t18], ...null == e3 ? void 0 : e3[t18] };
|
|
3765
3765
|
})(e2, i), c = o.getFormattedSelection();
|
|
3766
3766
|
if (0 === c.length) return false;
|
|
3767
3767
|
r2.setLocked({ type: LockModeType.Exclude, categories: ["markup", "shape"] });
|
|
@@ -3771,132 +3771,85 @@ function Ze(t17, e2, a3, s9, i) {
|
|
|
3771
3771
|
}
|
|
3772
3772
|
return o.clear(), true;
|
|
3773
3773
|
}
|
|
3774
|
-
|
|
3775
|
-
|
|
3776
|
-
|
|
3777
|
-
|
|
3774
|
+
function Je(t17, e2) {
|
|
3775
|
+
const a3 = t17;
|
|
3776
|
+
return false === t17 ? { ...e2, enabled: false } : true === t17 || void 0 === t17 ? { ...e2, enabled: e2.enabled ?? true } : { ...e2, ...a3, enabled: false !== (null == a3 ? void 0 : a3.enabled) };
|
|
3777
|
+
}
|
|
3778
|
+
function ta(t17) {
|
|
3779
|
+
const e2 = Je(null == t17 ? void 0 : t17.markup, { enabled: true }), a3 = Je(null == t17 ? void 0 : t17.bookmarks, { enabled: true }), s9 = Je(null == t17 ? void 0 : t17.notes, { enabled: true });
|
|
3780
|
+
return { markup: e2, bookmarks: a3, notes: s9, zoom: Je(null == t17 ? void 0 : t17.zoom, { enabled: true, min: 0.5, max: 3, initial: 1 }), selectionToolbar: Je(void 0 === (null == t17 ? void 0 : t17.selectionToolbar) ? false !== e2.enabled || false !== s9.enabled : t17.selectionToolbar, { enabled: true }) };
|
|
3781
|
+
}
|
|
3782
|
+
const ea = [{ id: "highlight", label: "高亮背景", icon: /* @__PURE__ */ jsx(ra, {}) }, { id: "underline", label: "下划线", icon: /* @__PURE__ */ jsx(oa, {}) }, { id: "squiggly", label: "波浪线", icon: /* @__PURE__ */ jsx(na, {}) }, { id: "strikeout", label: "删除线", icon: /* @__PURE__ */ jsx(ha, {}) }, { id: "note", label: "添加笔记", icon: /* @__PURE__ */ jsx(la, {}) }];
|
|
3783
|
+
function aa({ placementAbove: s9, anchorHeight: i, onAction: r2, hiddenBuiltinActions: o = [], extraActions: n5 = [] }) {
|
|
3784
|
+
const h = new Set(o), l2 = ea.filter((t17) => "note" !== t17.id && !h.has(t17.id)), d = ea.find((t17) => "note" === t17.id), c = d && !h.has("note"), u = [...n5].sort((t17, e2) => (t17.order ?? 0) - (e2.order ?? 0));
|
|
3785
|
+
return jsxs("div", { style: { position: "absolute", pointerEvents: "auto", left: "50%", transform: "translateX(-50%)", top: s9 ? void 0 : i + 10, bottom: s9 ? i + 10 : void 0, display: "flex", alignItems: "center", gap: 2, padding: "6px 8px", borderRadius: 10, 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)" }, role: "toolbar", "aria-label": "选区工具", children: [l2.map((e2) => /* @__PURE__ */ jsx(sa, { label: e2.label, onClick: () => r2(e2.id), children: e2.icon }, e2.id)), u.map((e2) => /* @__PURE__ */ jsx(sa, { label: e2.label, onClick: () => r2(e2.id), children: /* @__PURE__ */ jsx("span", { style: { fontSize: 11, fontWeight: 600 }, children: e2.label.slice(0, 2) }) }, e2.id)), c && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
3778
3786
|
/* @__PURE__ */ jsx("span", { style: { width: 1, height: 28, margin: "0 4px", background: "#e2e8f0", flexShrink: 0 }, "aria-hidden": true }),
|
|
3779
|
-
/* @__PURE__ */ jsx(
|
|
3787
|
+
/* @__PURE__ */ jsx(sa, { label: d.label, onClick: () => r2("note"), accent: true, children: d.icon })
|
|
3780
3788
|
] })] });
|
|
3781
3789
|
}
|
|
3782
|
-
function
|
|
3790
|
+
function sa({ label: e2, onClick: a3, accent: s9, children: i }) {
|
|
3783
3791
|
return jsx("button", { type: "button", title: e2, "aria-label": e2, onClick: a3, style: { display: "flex", alignItems: "center", justifyContent: "center", width: 36, height: 36, padding: 0, border: "none", borderRadius: 8, background: "transparent", color: s9 ? "#b45309" : "#334155", cursor: "pointer" }, onMouseEnter: (t17) => {
|
|
3784
3792
|
t17.currentTarget.style.background = s9 ? "#fffbeb" : "#f1f5f9";
|
|
3785
3793
|
}, onMouseLeave: (t17) => {
|
|
3786
3794
|
t17.currentTarget.style.background = "transparent";
|
|
3787
3795
|
}, children: i });
|
|
3788
3796
|
}
|
|
3789
|
-
function
|
|
3797
|
+
function ia({ behind: a3, mark: s9 }) {
|
|
3790
3798
|
return jsxs("svg", { width: "28", height: "28", viewBox: "0 0 28 28", fill: "none", "aria-hidden": true, children: [
|
|
3791
3799
|
a3,
|
|
3792
3800
|
/* @__PURE__ */ jsx("text", { x: "14", y: "19", textAnchor: "middle", fontSize: "15", fontWeight: "700", fontFamily: "system-ui, sans-serif", fill: "#0f172a", children: "A" }),
|
|
3793
3801
|
s9
|
|
3794
3802
|
] });
|
|
3795
3803
|
}
|
|
3796
|
-
function
|
|
3797
|
-
return jsx(
|
|
3804
|
+
function ra() {
|
|
3805
|
+
return jsx(ia, { behind: /* @__PURE__ */ jsx("rect", { x: "5", y: "4", width: "18", height: "20", rx: "3", fill: "#facc15" }) });
|
|
3798
3806
|
}
|
|
3799
|
-
function
|
|
3800
|
-
return jsx(
|
|
3807
|
+
function oa() {
|
|
3808
|
+
return jsx(ia, { mark: /* @__PURE__ */ jsx("path", { d: "M6 22h16", stroke: "#dc2626", strokeWidth: "2.2", strokeLinecap: "round" }) });
|
|
3801
3809
|
}
|
|
3802
|
-
function
|
|
3803
|
-
return jsx(
|
|
3810
|
+
function na() {
|
|
3811
|
+
return jsx(ia, { mark: /* @__PURE__ */ jsx("path", { d: "M6 22c2-2 3-2 5 0s3 2 5 0 3-2 5 0", stroke: "#dc2626", strokeWidth: "2", strokeLinecap: "round", fill: "none" }) });
|
|
3804
3812
|
}
|
|
3805
|
-
function
|
|
3806
|
-
return jsx(
|
|
3813
|
+
function ha() {
|
|
3814
|
+
return jsx(ia, { mark: /* @__PURE__ */ jsx("path", { d: "M5 14h18", stroke: "#dc2626", strokeWidth: "2.2", strokeLinecap: "round" }) });
|
|
3807
3815
|
}
|
|
3808
|
-
function
|
|
3816
|
+
function la() {
|
|
3809
3817
|
return jsxs("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", "aria-hidden": true, children: [
|
|
3810
3818
|
/* @__PURE__ */ jsx("path", { d: "M8 3h8l4 4v14H8V3z", fill: "#fef3c7", stroke: "#d97706", strokeWidth: "1.2", strokeLinejoin: "round" }),
|
|
3811
3819
|
/* @__PURE__ */ jsx("path", { d: "M16 3v4h4", stroke: "#d97706", strokeWidth: "1.2" }),
|
|
3812
3820
|
/* @__PURE__ */ jsx("path", { d: "M10 12h6M10 16h4", stroke: "#92400e", strokeWidth: "1.2", strokeLinecap: "round" })
|
|
3813
3821
|
] });
|
|
3814
3822
|
}
|
|
3815
|
-
const
|
|
3816
|
-
function
|
|
3823
|
+
const da = { highlight: "highlight", underline: "underline", squiggly: "squiggly", strikeout: "strikeout" };
|
|
3824
|
+
function ca(e2, a3) {
|
|
3817
3825
|
var _a2, _b, _c, _d;
|
|
3818
3826
|
const s9 = e2 == null ? void 0 : e2.selectionToolbar, i = false !== ((_a2 = e2 == null ? void 0 : e2.markup) == null ? void 0 : _a2.enabled), r2 = false !== ((_b = e2 == null ? void 0 : e2.notes) == null ? void 0 : _b.enabled);
|
|
3819
3827
|
if (false === (s9 == null ? void 0 : s9.enabled)) return;
|
|
3820
3828
|
if (!i && !r2 && !((_c = s9 == null ? void 0 : s9.extraActions) == null ? void 0 : _c.length)) return;
|
|
3821
|
-
const { provides: n5 } = useCapability(SelectionPlugin.id), { provides: l2 } = useCapability(AnnotationPlugin.id), { provides: d } = useCapability(
|
|
3829
|
+
const { provides: n5 } = useCapability(SelectionPlugin.id), { provides: l2 } = useCapability(AnnotationPlugin.id), { provides: d } = useCapability(fe.id);
|
|
3822
3830
|
return useMemo(() => (o) => {
|
|
3823
|
-
const h =
|
|
3831
|
+
const h = Yt(o.item);
|
|
3824
3832
|
return (c) => {
|
|
3825
3833
|
var _a3;
|
|
3826
|
-
return /* @__PURE__ */ jsx("div", { ...c.menuWrapperProps, children: /* @__PURE__ */ jsx(
|
|
3834
|
+
return /* @__PURE__ */ jsx("div", { ...c.menuWrapperProps, children: /* @__PURE__ */ jsx(aa, { placementAbove: !!((_a3 = c.placement) == null ? void 0 : _a3.suggestTop), anchorHeight: c.rect.size.height, onAction: (t17) => {
|
|
3827
3835
|
var _a4, _b2;
|
|
3828
3836
|
if ("highlight" !== t17 && "underline" !== t17 && "squiggly" !== t17 && "strikeout" !== t17) {
|
|
3829
3837
|
if ("note" === t17) {
|
|
3830
3838
|
if (!n5 || !d || !r2) return;
|
|
3831
3839
|
const t18 = n5.getHighlightRectsForPage(o.item.localPageIndex, h);
|
|
3832
|
-
return void
|
|
3840
|
+
return void Xt(n5.getSelectedText(h), (e3) => {
|
|
3833
3841
|
d.requestCreateFromSelection({ chapterId: o.item.chapterId, localPageIndex: o.item.localPageIndex, globalPageIndex: o.item.globalPageIndex, globalPageNumber: o.item.globalPageNumber, rectsPdfCoord: t18, selectedText: e3.join("\n") });
|
|
3834
3842
|
});
|
|
3835
3843
|
}
|
|
3836
3844
|
(_a4 = a3 == null ? void 0 : a3.onExtraAction) == null ? void 0 : _a4.call(a3, t17, o);
|
|
3837
3845
|
} else {
|
|
3838
3846
|
if (!n5 || !l2 || !i) return;
|
|
3839
|
-
|
|
3847
|
+
Qe(h, da[t17], l2, n5, (_b2 = e2 == null ? void 0 : e2.markup) == null ? void 0 : _b2.styles);
|
|
3840
3848
|
}
|
|
3841
3849
|
}, hiddenBuiltinActions: s9 == null ? void 0 : s9.hiddenBuiltinActions, extraActions: s9 == null ? void 0 : s9.extraActions }) });
|
|
3842
3850
|
};
|
|
3843
3851
|
}, [l2, (_d = e2 == null ? void 0 : e2.markup) == null ? void 0 : _d.styles, a3 == null ? void 0 : a3.onExtraAction, i, d, r2, n5, s9 == null ? void 0 : s9.extraActions, s9 == null ? void 0 : s9.hiddenBuiltinActions]);
|
|
3844
3852
|
}
|
|
3845
|
-
function la({ className: s9, buildSelectionMenu: i, annotationSelectionMenu: r2, redactionSelectionMenu: n5, showNoteMarkers: h = true, showBookmarkMarkers: l2 = true, showRedactionLayer: d = false, renderPageOverlay: c, features: u, onExtraSelectionAction: p, children: g }) {
|
|
3846
|
-
var _a2, _b, _c, _d;
|
|
3847
|
-
const f = qe(), m = _e(), v = Fe(), b = h && m && false !== ((_a2 = u == null ? void 0 : u.notes) == null ? void 0 : _a2.enabled), P = l2 && v && false !== ((_b = u == null ? void 0 : u.bookmarks) == null ? void 0 : _b.enabled), w = v && false !== ((_c = u == null ? void 0 : u.bookmarks) == null ? void 0 : _c.enabled), I = ha(u, { onExtraAction: p }), y = useMemo(() => {
|
|
3848
|
-
if (i || I) return (t17) => {
|
|
3849
|
-
const e2 = I ? I(t17) : t17.defaultMenu;
|
|
3850
|
-
return i ? i({ ...t17, defaultMenu: e2 }) : e2;
|
|
3851
|
-
};
|
|
3852
|
-
}, [i, I]), C2 = useMemo(() => c || w ? (s10) => {
|
|
3853
|
-
var _a3;
|
|
3854
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [w && /* @__PURE__ */ jsx(da, { item: s10, hoverUi: (_a3 = u == null ? void 0 : u.bookmarks) == null ? void 0 : _a3.hover }), c == null ? void 0 : c(s10)] });
|
|
3855
|
-
} : c, [(_d = u == null ? void 0 : u.bookmarks) == null ? void 0 : _d.hover, w, c]);
|
|
3856
|
-
return jsxs("div", { className: s9, style: s9 ? void 0 : He, children: [
|
|
3857
|
-
/* @__PURE__ */ jsx(rt$1, { renderPage: (e2) => {
|
|
3858
|
-
var _a3, _b2;
|
|
3859
|
-
return /* @__PURE__ */ jsx(ca, { item: e2, showNoteMarkers: b, showBookmarkMarkers: P, noteMarkerUi: (_a3 = u == null ? void 0 : u.notes) == null ? void 0 : _a3.marker, bookmarkMarkerUi: (_b2 = u == null ? void 0 : u.bookmarks) == null ? void 0 : _b2.marker, renderPageOverlay: C2, buildSelectionMenu: y, createNote: f, annotationSelectionMenu: r2, redactionSelectionMenu: n5, showRedactionLayer: d });
|
|
3860
|
-
} }),
|
|
3861
|
-
g
|
|
3862
|
-
] });
|
|
3863
|
-
}
|
|
3864
|
-
function da({ item: e2, hoverUi: a3 }) {
|
|
3865
|
-
var _a2;
|
|
3866
|
-
const s9 = jt(e2), i = useDocumentState(s9), r2 = ((_a2 = i == null ? void 0 : i.document) == null ? void 0 : _a2.pages[e2.localPageIndex]) ?? null;
|
|
3867
|
-
return r2 ? /* @__PURE__ */ jsx(We, { item: e2, pdfPageWidth: r2.size.width, pdfPageHeight: r2.size.height, cssPageWidth: e2.width, cssPageHeight: e2.height, hoverUi: a3 }) : null;
|
|
3868
|
-
}
|
|
3869
|
-
function ca({ item: a3, showNoteMarkers: s9, showBookmarkMarkers: i, noteMarkerUi: r2, bookmarkMarkerUi: n5, renderPageOverlay: d, createNote: c, buildSelectionMenu: m, annotationSelectionMenu: v, redactionSelectionMenu: b, showRedactionLayer: w = false }) {
|
|
3870
|
-
var _a2;
|
|
3871
|
-
const C2 = jt(a3);
|
|
3872
|
-
Ue(C2);
|
|
3873
|
-
const M2 = useDocumentState(C2), S2 = ((_a2 = M2 == null ? void 0 : M2.document) == null ? void 0 : _a2.pages[a3.localPageIndex]) ?? null, x2 = (function(e2, a4) {
|
|
3874
|
-
const { provides: s10 } = useCapability(SelectionPlugin.id), i2 = jt(e2);
|
|
3875
|
-
return useMemo(() => {
|
|
3876
|
-
if (a4) return (r3) => {
|
|
3877
|
-
var _a3;
|
|
3878
|
-
const o = { position: "absolute", pointerEvents: "auto", left: "50%", transform: "translateX(-50%)", top: ((_a3 = r3.placement) == null ? void 0 : _a3.suggestTop) ? -40 : r3.rect.size.height + 8 };
|
|
3879
|
-
return jsx("div", { ...r3.menuWrapperProps, children: /* @__PURE__ */ jsx("div", { style: o, children: /* @__PURE__ */ jsx("button", { type: "button", onClick: () => {
|
|
3880
|
-
if (!s10) return;
|
|
3881
|
-
const t17 = s10.getHighlightRectsForPage(e2.localPageIndex, i2);
|
|
3882
|
-
Yt(s10.getSelectedText(i2), (s11) => {
|
|
3883
|
-
const i3 = s11.join("\n"), r4 = Xt(e2, t17, i3);
|
|
3884
|
-
a4(r4);
|
|
3885
|
-
});
|
|
3886
|
-
}, style: { padding: "6px 10px", fontSize: "12px", border: "1px solid #e5e7eb", borderRadius: "6px", background: "#fff", cursor: "pointer", boxShadow: "0 2px 8px rgba(0,0,0,0.08)" }, children: "添加附注" }) }) });
|
|
3887
|
-
};
|
|
3888
|
-
}, [a4, i2, e2, s10]);
|
|
3889
|
-
})(a3, c), $2 = void 0 !== m ? m({ item: a3, defaultMenu: x2, createNote: c }) : x2;
|
|
3890
|
-
return S2 ? /* @__PURE__ */ jsx(GlobalPointerProvider, { documentId: C2, children: /* @__PURE__ */ jsx(Rotate, { documentId: C2, pageIndex: a3.localPageIndex, style: { backgroundColor: "#fff" }, children: /* @__PURE__ */ jsxs(PagePointerProvider, { documentId: C2, pageIndex: a3.localPageIndex, children: [
|
|
3891
|
-
/* @__PURE__ */ jsx(ot$1, { chapterId: C2, localPageIndex: a3.localPageIndex }),
|
|
3892
|
-
/* @__PURE__ */ jsx(SelectionLayer, { documentId: C2, pageIndex: a3.localPageIndex, selectionMenu: $2 }),
|
|
3893
|
-
w && /* @__PURE__ */ jsx(RedactionLayer, { documentId: C2, pageIndex: a3.localPageIndex, selectionMenu: b }),
|
|
3894
|
-
/* @__PURE__ */ jsx(AnnotationLayer, { documentId: C2, pageIndex: a3.localPageIndex, selectionMenu: v }),
|
|
3895
|
-
i && S2 && /* @__PURE__ */ jsx(Bt, { chapterId: C2, localPageIndex: a3.localPageIndex, pdfPageWidth: S2.size.width, pdfPageHeight: S2.size.height, cssPageWidth: a3.width, cssPageHeight: a3.height, ui: n5 }),
|
|
3896
|
-
d == null ? void 0 : d(a3),
|
|
3897
|
-
s9 && S2 && /* @__PURE__ */ jsx(Mt$1, { chapterId: C2, localPageIndex: a3.localPageIndex, pdfPageWidth: S2.size.width, pdfPageHeight: S2.size.height, cssPageWidth: a3.width, cssPageHeight: a3.height, ui: r2 })
|
|
3898
|
-
] }) }) }) : null;
|
|
3899
|
-
}
|
|
3900
3853
|
const ua = "chapter-manager", pa = { id: ua, name: "Chapter Manager Plugin", version: "0.1.0", provides: ["chapter-manager"], requires: ["document-manager"], optional: [], defaultConfig: { manifest: { chapters: [] }, prefetchChapters: 1, unloadTimeoutMs: 6e4, autoActivateOnLoad: true } };
|
|
3901
3854
|
const ga = { kind: "first-wins" };
|
|
3902
3855
|
function fa(t17, e2, a3) {
|
|
@@ -4142,9 +4095,150 @@ const ba = class t14 extends BasePlugin {
|
|
|
4142
4095
|
};
|
|
4143
4096
|
ba.id = "chapter-manager";
|
|
4144
4097
|
let Pa = ba;
|
|
4145
|
-
const wa = { manifest: pa, create: (t17) => new Pa(ua, t17), reducer: (t17) => t17, initialState: {} }
|
|
4146
|
-
|
|
4147
|
-
|
|
4098
|
+
const wa = { manifest: pa, create: (t17) => new Pa(ua, t17), reducer: (t17) => t17, initialState: {} };
|
|
4099
|
+
function Ia(t17, e2 = 0.5, a3 = 3) {
|
|
4100
|
+
return Math.min(a3, Math.max(e2, t17));
|
|
4101
|
+
}
|
|
4102
|
+
function ya(t17, e2) {
|
|
4103
|
+
const { registry: a3 } = useRegistry(), { provides: o } = useCapability(DocumentManagerPlugin.id), { provides: l2 } = useCapability(Pa.id), c = false !== (e2 == null ? void 0 : e2.enabled), u = (e2 == null ? void 0 : e2.min) ?? 0.5, p = (e2 == null ? void 0 : e2.max) ?? 3, g = e2 == null ? void 0 : e2.pageWidth, [f, m] = useState(() => (e2 == null ? void 0 : e2.initial) ?? 1), v = useRef(f), b = useCallback((e3) => {
|
|
4104
|
+
const s9 = Ia(e3, u, p);
|
|
4105
|
+
v.current = s9, m(s9), (function(t18, e4, a4, s10 = 0.5, i = 3) {
|
|
4106
|
+
const r2 = t18 == null ? void 0 : t18.getStore();
|
|
4107
|
+
if (!r2) return;
|
|
4108
|
+
const o2 = Ia(a4, s10, i);
|
|
4109
|
+
r2.dispatchToCore(setDefaultScale(o2));
|
|
4110
|
+
for (const n5 of e4.chapters) r2.getState().core.documents[n5.chapterId] && r2.dispatchToCore(setScale(o2, n5.chapterId));
|
|
4111
|
+
})(a3, t17, s9, u, p);
|
|
4112
|
+
}, [a3, t17, u, p]), P = useCallback((t18) => {
|
|
4113
|
+
if (!g || !o) return;
|
|
4114
|
+
const e3 = o.getDocument(t18);
|
|
4115
|
+
e3 && b((function(t19, e4, a4 = 0) {
|
|
4116
|
+
var _a2;
|
|
4117
|
+
const s9 = t19.pages[a4];
|
|
4118
|
+
return ((_a2 = s9 == null ? void 0 : s9.size) == null ? void 0 : _a2.width) ? e4 / s9.size.width : 1;
|
|
4119
|
+
})(e3, g));
|
|
4120
|
+
}, [b, o, g]);
|
|
4121
|
+
return useEffect(() => {
|
|
4122
|
+
c && a3 && (g || b((e2 == null ? void 0 : e2.initial) ?? 1));
|
|
4123
|
+
}, [b, c, g, a3, e2 == null ? void 0 : e2.initial]), useEffect(() => {
|
|
4124
|
+
if (!c || !l2) return;
|
|
4125
|
+
const e3 = (t18) => {
|
|
4126
|
+
g ? P(t18) : b(v.current);
|
|
4127
|
+
}, a4 = l2.onChapterStatusChange((t18) => {
|
|
4128
|
+
"loaded" === t18.status && e3(t18.chapterId);
|
|
4129
|
+
});
|
|
4130
|
+
for (const s9 of t17.chapters) "loaded" === l2.getChapterStatus(s9.chapterId) && e3(s9.chapterId);
|
|
4131
|
+
return a4;
|
|
4132
|
+
}, [P, b, l2, c, t17.chapters, g]), { scale: f, setScale: b, zoomEnabled: c, minZoom: u, maxZoom: p };
|
|
4133
|
+
}
|
|
4134
|
+
function Ca(t17, e2, a3) {
|
|
4135
|
+
return Math.min(a3, Math.max(e2, t17));
|
|
4136
|
+
}
|
|
4137
|
+
function Ma(t17, e2) {
|
|
4138
|
+
if (!t17 || false === e2.enabled) return () => {
|
|
4139
|
+
};
|
|
4140
|
+
let a3 = null, s9 = null, i = 0;
|
|
4141
|
+
const r2 = () => {
|
|
4142
|
+
const s10 = t17.querySelector("[data-chapter-scroll-viewport]");
|
|
4143
|
+
return !!s10 && (a3 == null ? void 0 : a3(), a3 = (function({ container: t18, getScale: e3, setScale: a4, minZoom: s11 = 0.5, maxZoom: i2 = 3 }) {
|
|
4144
|
+
let r3 = 0, o = 1, n5 = null, h = 1, l2 = 1;
|
|
4145
|
+
const d = (t19) => {
|
|
4146
|
+
(t19.ctrlKey || t19.metaKey) && (t19.preventDefault(), null === n5 ? (l2 = e3(), h = 1) : clearTimeout(n5), h *= 1 - 0.01 * t19.deltaY, h = Ca(h, 0.1, 10), a4(Ca(l2 * h, s11, i2)), n5 = setTimeout(() => {
|
|
4147
|
+
n5 = null;
|
|
4148
|
+
}, 120));
|
|
4149
|
+
}, c = /* @__PURE__ */ new Map(), u = (t19) => {
|
|
4150
|
+
if (c.set(t19.pointerId, { x: t19.clientX, y: t19.clientY }), 2 === c.size) {
|
|
4151
|
+
const [t20, a5] = [...c.values()];
|
|
4152
|
+
r3 = Math.hypot(a5.x - t20.x, a5.y - t20.y), o = e3();
|
|
4153
|
+
}
|
|
4154
|
+
}, p = (t19) => {
|
|
4155
|
+
if (c.has(t19.pointerId) && (c.set(t19.pointerId, { x: t19.clientX, y: t19.clientY }), 2 === c.size && r3 > 0)) {
|
|
4156
|
+
t19.preventDefault();
|
|
4157
|
+
const [e4, n6] = [...c.values()], h2 = Math.hypot(n6.x - e4.x, n6.y - e4.y);
|
|
4158
|
+
a4(Ca(o * (h2 / r3), s11, i2));
|
|
4159
|
+
}
|
|
4160
|
+
}, g = (t19) => {
|
|
4161
|
+
c.delete(t19.pointerId), c.size < 2 && (r3 = 0);
|
|
4162
|
+
};
|
|
4163
|
+
return t18.addEventListener("wheel", d, { passive: false }), t18.addEventListener("pointerdown", u), t18.addEventListener("pointermove", p, { passive: false }), t18.addEventListener("pointerup", g), t18.addEventListener("pointercancel", g), () => {
|
|
4164
|
+
t18.removeEventListener("wheel", d), t18.removeEventListener("pointerdown", u), t18.removeEventListener("pointermove", p), t18.removeEventListener("pointerup", g), t18.removeEventListener("pointercancel", g), n5 && clearTimeout(n5);
|
|
4165
|
+
};
|
|
4166
|
+
})({ container: s10, getScale: e2.getScale, setScale: e2.setScale, minZoom: e2.minZoom, maxZoom: e2.maxZoom }), true);
|
|
4167
|
+
};
|
|
4168
|
+
return r2() || (s9 = new MutationObserver(() => {
|
|
4169
|
+
r2() && (s9 == null ? void 0 : s9.disconnect(), s9 = null);
|
|
4170
|
+
}), s9.observe(t17, { childList: true, subtree: true }), i = requestAnimationFrame(() => r2())), () => {
|
|
4171
|
+
i && cancelAnimationFrame(i), s9 == null ? void 0 : s9.disconnect(), a3 == null ? void 0 : a3();
|
|
4172
|
+
};
|
|
4173
|
+
}
|
|
4174
|
+
const Sa = { chapters: [] };
|
|
4175
|
+
function xa(t17) {
|
|
4176
|
+
const e2 = useRef(null), { provides: a3 } = useCapability(Pa.id), i = useMemo(() => (a3 == null ? void 0 : a3.getManifest()) ?? Sa, [a3]), { scale: n5, setScale: l2, zoomEnabled: d, minZoom: c, maxZoom: u } = ya(i, t17 == null ? void 0 : t17.zoom);
|
|
4177
|
+
return (function(t18, e3) {
|
|
4178
|
+
const { enabled: a4, getScale: s9, setScale: i2, minZoom: o, maxZoom: n6 } = e3;
|
|
4179
|
+
useEffect(() => {
|
|
4180
|
+
if (a4) return Ma(t18.current, { enabled: true, getScale: s9, setScale: i2, minZoom: o, maxZoom: n6 });
|
|
4181
|
+
}, [a4, s9, t18, n6, o, i2]);
|
|
4182
|
+
})(e2, { enabled: d, getScale: () => n5, setScale: l2, minZoom: c, maxZoom: u }), { hostRef: e2, scale: n5, setScale: l2, zoomEnabled: d };
|
|
4183
|
+
}
|
|
4184
|
+
function $a({ className: s9, buildSelectionMenu: i, annotationSelectionMenu: r2, redactionSelectionMenu: n5, showNoteMarkers: h = true, showBookmarkMarkers: l2 = true, showRedactionLayer: d = false, renderPageOverlay: c, features: u, onExtraSelectionAction: p, children: g }) {
|
|
4185
|
+
var _a2, _b, _c, _d;
|
|
4186
|
+
const { hostRef: f } = xa(u), m = He(), v = qe(), b = We(), P = h && v && false !== ((_a2 = u == null ? void 0 : u.notes) == null ? void 0 : _a2.enabled), w = l2 && b && false !== ((_b = u == null ? void 0 : u.bookmarks) == null ? void 0 : _b.enabled), I = b && false !== ((_c = u == null ? void 0 : u.bookmarks) == null ? void 0 : _c.enabled), y = ca(u, { onExtraAction: p }), C = useMemo(() => {
|
|
4187
|
+
if (i || y) return (t17) => {
|
|
4188
|
+
const e2 = y ? y(t17) : t17.defaultMenu;
|
|
4189
|
+
return i ? i({ ...t17, defaultMenu: e2 }) : e2;
|
|
4190
|
+
};
|
|
4191
|
+
}, [i, y]), M2 = useMemo(() => c || I ? (s10) => {
|
|
4192
|
+
var _a3;
|
|
4193
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [I && /* @__PURE__ */ jsx(ka, { item: s10, hoverUi: (_a3 = u == null ? void 0 : u.bookmarks) == null ? void 0 : _a3.hover }), c == null ? void 0 : c(s10)] });
|
|
4194
|
+
} : c, [(_d = u == null ? void 0 : u.bookmarks) == null ? void 0 : _d.hover, I, c]);
|
|
4195
|
+
return jsxs("div", { ref: f, className: s9, style: s9 ? void 0 : je, children: [
|
|
4196
|
+
/* @__PURE__ */ jsx(nt$1, { renderPage: (e2) => {
|
|
4197
|
+
var _a3, _b2;
|
|
4198
|
+
return /* @__PURE__ */ jsx(La, { item: e2, showNoteMarkers: P, showBookmarkMarkers: w, noteMarkerUi: (_a3 = u == null ? void 0 : u.notes) == null ? void 0 : _a3.marker, bookmarkMarkerUi: (_b2 = u == null ? void 0 : u.bookmarks) == null ? void 0 : _b2.marker, renderPageOverlay: M2, buildSelectionMenu: C, createNote: m, annotationSelectionMenu: r2, redactionSelectionMenu: n5, showRedactionLayer: d });
|
|
4199
|
+
} }),
|
|
4200
|
+
g
|
|
4201
|
+
] });
|
|
4202
|
+
}
|
|
4203
|
+
function ka({ item: e2, hoverUi: a3 }) {
|
|
4204
|
+
var _a2;
|
|
4205
|
+
const s9 = Yt(e2), i = useDocumentState(s9), r2 = ((_a2 = i == null ? void 0 : i.document) == null ? void 0 : _a2.pages[e2.localPageIndex]) ?? null;
|
|
4206
|
+
return r2 ? /* @__PURE__ */ jsx(Be, { item: e2, pdfPageWidth: r2.size.width, pdfPageHeight: r2.size.height, cssPageWidth: e2.width, cssPageHeight: e2.height, hoverUi: a3 }) : null;
|
|
4207
|
+
}
|
|
4208
|
+
function La({ item: a3, showNoteMarkers: s9, showBookmarkMarkers: i, noteMarkerUi: r2, bookmarkMarkerUi: n5, renderPageOverlay: d, createNote: c, buildSelectionMenu: m, annotationSelectionMenu: v, redactionSelectionMenu: b, showRedactionLayer: w = false }) {
|
|
4209
|
+
var _a2;
|
|
4210
|
+
const C = Yt(a3);
|
|
4211
|
+
Fe(C);
|
|
4212
|
+
const M2 = useDocumentState(C), S2 = ((_a2 = M2 == null ? void 0 : M2.document) == null ? void 0 : _a2.pages[a3.localPageIndex]) ?? null, x2 = (function(e2, a4) {
|
|
4213
|
+
const { provides: s10 } = useCapability(SelectionPlugin.id), i2 = Yt(e2);
|
|
4214
|
+
return useMemo(() => {
|
|
4215
|
+
if (a4) return (r3) => {
|
|
4216
|
+
var _a3;
|
|
4217
|
+
const o = { position: "absolute", pointerEvents: "auto", left: "50%", transform: "translateX(-50%)", top: ((_a3 = r3.placement) == null ? void 0 : _a3.suggestTop) ? -40 : r3.rect.size.height + 8 };
|
|
4218
|
+
return jsx("div", { ...r3.menuWrapperProps, children: /* @__PURE__ */ jsx("div", { style: o, children: /* @__PURE__ */ jsx("button", { type: "button", onClick: () => {
|
|
4219
|
+
if (!s10) return;
|
|
4220
|
+
const t17 = s10.getHighlightRectsForPage(e2.localPageIndex, i2);
|
|
4221
|
+
Xt(s10.getSelectedText(i2), (s11) => {
|
|
4222
|
+
const i3 = s11.join("\n"), r4 = Kt$1(e2, t17, i3);
|
|
4223
|
+
a4(r4);
|
|
4224
|
+
});
|
|
4225
|
+
}, style: { padding: "6px 10px", fontSize: "12px", border: "1px solid #e5e7eb", borderRadius: "6px", background: "#fff", cursor: "pointer", boxShadow: "0 2px 8px rgba(0,0,0,0.08)" }, children: "添加附注" }) }) });
|
|
4226
|
+
};
|
|
4227
|
+
}, [a4, i2, e2, s10]);
|
|
4228
|
+
})(a3, c), $2 = void 0 !== m ? m({ item: a3, defaultMenu: x2, createNote: c }) : x2;
|
|
4229
|
+
return S2 ? /* @__PURE__ */ jsx(GlobalPointerProvider, { documentId: C, children: /* @__PURE__ */ jsx(Rotate, { documentId: C, pageIndex: a3.localPageIndex, style: { backgroundColor: "#fff" }, children: /* @__PURE__ */ jsxs(PagePointerProvider, { documentId: C, pageIndex: a3.localPageIndex, children: [
|
|
4230
|
+
/* @__PURE__ */ jsx(ht$1, { chapterId: C, localPageIndex: a3.localPageIndex }),
|
|
4231
|
+
/* @__PURE__ */ jsx(SelectionLayer, { documentId: C, pageIndex: a3.localPageIndex, selectionMenu: $2 }),
|
|
4232
|
+
w && /* @__PURE__ */ jsx(RedactionLayer, { documentId: C, pageIndex: a3.localPageIndex, selectionMenu: b }),
|
|
4233
|
+
/* @__PURE__ */ jsx(AnnotationLayer, { documentId: C, pageIndex: a3.localPageIndex, selectionMenu: v }),
|
|
4234
|
+
i && S2 && /* @__PURE__ */ jsx(Zt, { chapterId: C, localPageIndex: a3.localPageIndex, pdfPageWidth: S2.size.width, pdfPageHeight: S2.size.height, cssPageWidth: a3.width, cssPageHeight: a3.height, ui: n5 }),
|
|
4235
|
+
d == null ? void 0 : d(a3),
|
|
4236
|
+
s9 && S2 && /* @__PURE__ */ jsx(xt$1, { chapterId: C, localPageIndex: a3.localPageIndex, pdfPageWidth: S2.size.width, pdfPageHeight: S2.size.height, cssPageWidth: a3.width, cssPageHeight: a3.height, ui: r2 })
|
|
4237
|
+
] }) }) }) : null;
|
|
4238
|
+
}
|
|
4239
|
+
const za = "chapter-scroll", Da = { id: za, name: "Chapter Scroll Plugin", version: "0.1.0", provides: ["chapter-scroll"], requires: ["chapter-manager"], optional: [], defaultConfig: { placeholderPageHeight: 1200, placeholderPageWidth: 900, bufferSize: 2, pageGap: 20 } };
|
|
4240
|
+
const Ta = { kind: "first-wins" };
|
|
4241
|
+
function Ga(t17, e2, a3) {
|
|
4148
4242
|
if (1 === e2.length) return e2[0].chapterId;
|
|
4149
4243
|
switch (a3.kind) {
|
|
4150
4244
|
case "first-wins":
|
|
@@ -4162,7 +4256,7 @@ function Ma(t17, e2, a3) {
|
|
|
4162
4256
|
return a3.resolve(t17, e2);
|
|
4163
4257
|
}
|
|
4164
4258
|
}
|
|
4165
|
-
class
|
|
4259
|
+
class Oa {
|
|
4166
4260
|
constructor(t17) {
|
|
4167
4261
|
this._pages = t17, this._byChapter = /* @__PURE__ */ new Map(), this._byGlobalNumber = /* @__PURE__ */ new Map();
|
|
4168
4262
|
for (const e2 of t17) {
|
|
@@ -4196,8 +4290,8 @@ class Sa {
|
|
|
4196
4290
|
return a3 ? this._pages.indexOf(a3) : -1;
|
|
4197
4291
|
}
|
|
4198
4292
|
}
|
|
4199
|
-
function
|
|
4200
|
-
const a3 = (function(t18, e3 =
|
|
4293
|
+
function Aa(t17, e2 = Ta) {
|
|
4294
|
+
const a3 = (function(t18, e3 = Ta) {
|
|
4201
4295
|
const a4 = /* @__PURE__ */ new Map();
|
|
4202
4296
|
for (const i2 of t18.chapters) {
|
|
4203
4297
|
const [t19, e4] = i2.globalPageRange;
|
|
@@ -4207,7 +4301,7 @@ function xa(t17, e2 = Ca) {
|
|
|
4207
4301
|
}
|
|
4208
4302
|
}
|
|
4209
4303
|
const s10 = /* @__PURE__ */ new Map();
|
|
4210
|
-
for (const [i2, r3] of a4) s10.set(i2,
|
|
4304
|
+
for (const [i2, r3] of a4) s10.set(i2, Ga(i2, r3, e3));
|
|
4211
4305
|
return s10;
|
|
4212
4306
|
})(t17, e2), s9 = /* @__PURE__ */ new Map();
|
|
4213
4307
|
for (const n5 of t17.chapters) s9.set(n5.chapterId, n5);
|
|
@@ -4219,14 +4313,14 @@ function xa(t17, e2 = Ca) {
|
|
|
4219
4313
|
const [i2] = e3.globalPageRange, [h] = e3.localPageRange, l2 = h + (n5 - i2);
|
|
4220
4314
|
r2.push({ globalPageIndex: o++, globalPageNumber: n5, chapterId: t18, localPageIndex: l2 });
|
|
4221
4315
|
}
|
|
4222
|
-
return new
|
|
4316
|
+
return new Oa(r2);
|
|
4223
4317
|
}
|
|
4224
|
-
const
|
|
4318
|
+
const Na = class t15 extends BasePlugin {
|
|
4225
4319
|
constructor(t17, e2) {
|
|
4226
|
-
super(t17, e2), this.statusChange$ = createBehaviorEmitter(), this.manifestChange$ = createEmitter(), this.overlapStrategy =
|
|
4320
|
+
super(t17, e2), this.statusChange$ = createBehaviorEmitter(), this.manifestChange$ = createEmitter(), this.overlapStrategy = Ta, 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);
|
|
4227
4321
|
}
|
|
4228
4322
|
async initialize(t17) {
|
|
4229
|
-
if (this.config = t17, this.passwordProvider = t17.passwordProvider, this.overlapStrategy = t17.overlapStrategy ??
|
|
4323
|
+
if (this.config = t17, this.passwordProvider = t17.passwordProvider, this.overlapStrategy = t17.overlapStrategy ?? Ta, this.setManifestInternal(t17.manifest), this.documentManagerUnsubs.push(this.documentManager.provides().onDocumentOpened((t18) => {
|
|
4230
4324
|
this.isOwnedChapter(t18.id) && (this.passwordAttempts.delete(t18.id), this.updateStatus(t18.id, "loaded"));
|
|
4231
4325
|
}), this.documentManager.provides().onDocumentClosed((t18) => {
|
|
4232
4326
|
this.isOwnedChapter(t18) && this.updateStatus(t18, "closed");
|
|
@@ -4261,7 +4355,7 @@ const $a = class t15 extends BasePlugin {
|
|
|
4261
4355
|
const s9 = new Set(this.chapterStatus.keys()), i = new Set(e2.chapters.map((t17) => t17.chapterId));
|
|
4262
4356
|
for (const t17 of s9) i.has(t17) || (this.closeChapter(t17), this.chapterStatus.delete(t17));
|
|
4263
4357
|
for (const t17 of e2.chapters) this.chapterStatus.has(t17.chapterId) || this.chapterStatus.set(t17.chapterId, "idle");
|
|
4264
|
-
this.manifest = e2, this.virtualPageMap =
|
|
4358
|
+
this.manifest = e2, this.virtualPageMap = Aa(e2, this.overlapStrategy), this.manifestChange$.emit({ manifest: e2, map: this.virtualPageMap }), this.eagerPrefetchFromManifest();
|
|
4265
4359
|
}
|
|
4266
4360
|
eagerPrefetchFromManifest() {
|
|
4267
4361
|
const t17 = this.config.prefetchChapters ?? 0;
|
|
@@ -4385,11 +4479,11 @@ const $a = class t15 extends BasePlugin {
|
|
|
4385
4479
|
this.chapterStatus.get(t17) !== e2 && (this.chapterStatus.set(t17, e2), this.statusChange$.emit({ chapterId: t17, status: e2, ..."error" === e2 && a3 ? { error: { message: a3 } } : {} }));
|
|
4386
4480
|
}
|
|
4387
4481
|
};
|
|
4388
|
-
|
|
4389
|
-
let
|
|
4390
|
-
const
|
|
4482
|
+
Na.id = "chapter-manager";
|
|
4483
|
+
let Va = Na;
|
|
4484
|
+
const Ra = class extends BasePlugin {
|
|
4391
4485
|
constructor(t17, e2) {
|
|
4392
|
-
super(t17, e2), this.layoutChange$ = createBehaviorEmitter(), 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(
|
|
4486
|
+
super(t17, e2), this.layoutChange$ = createBehaviorEmitter(), 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(Va.id), this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
|
|
4393
4487
|
}
|
|
4394
4488
|
async initialize(t17) {
|
|
4395
4489
|
this.config = { placeholderPageHeight: t17.placeholderPageHeight ?? 1200, placeholderPageWidth: t17.placeholderPageWidth ?? 900, bufferSize: t17.bufferSize ?? 2, pageGap: t17.pageGap ?? 20 }, this.virtualPageMap = this.chapterManager.provides().getVirtualPageMap(), this.rebuildOffsets(), this.chapterManagerUnsubs.push(this.chapterManager.provides().onManifestChange(({ map: t18 }) => {
|
|
@@ -4558,10 +4652,10 @@ const La = class extends BasePlugin {
|
|
|
4558
4652
|
a3 && this.scrollToIndex(a3.globalPageIndex, e2);
|
|
4559
4653
|
}
|
|
4560
4654
|
};
|
|
4561
|
-
|
|
4562
|
-
let
|
|
4563
|
-
const Da = { manifest: ya, create: (t17) => new za(Ia, t17), reducer: (t17) => t17, initialState: {} }, Ta = { "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 }] } };
|
|
4564
|
-
class
|
|
4655
|
+
Ra.id = "chapter-scroll";
|
|
4656
|
+
let Ea = Ra;
|
|
4657
|
+
const Ua = { manifest: Da, create: (t17) => new Ea(za, t17), reducer: (t17) => t17, initialState: {} }, _a = { "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 }] } };
|
|
4658
|
+
class Fa {
|
|
4565
4659
|
constructor() {
|
|
4566
4660
|
this.specs = [];
|
|
4567
4661
|
}
|
|
@@ -4576,17 +4670,17 @@ class Ga {
|
|
|
4576
4670
|
return this.specs;
|
|
4577
4671
|
}
|
|
4578
4672
|
buildToolbars() {
|
|
4579
|
-
const t17 = structuredClone(
|
|
4673
|
+
const t17 = structuredClone(_a);
|
|
4580
4674
|
for (const e2 of this.specs) {
|
|
4581
4675
|
const a3 = t17[e2.toolbarSlot];
|
|
4582
4676
|
if (!a3) continue;
|
|
4583
4677
|
const s9 = { type: "command-button", id: e2.id, commandId: e2.commandId, variant: "icon", ...e2.icon ? { icon: e2.icon } : {}, ...e2.i18nKey ? { labelKey: e2.i18nKey } : {}, ...e2.label ? { label: e2.label } : {}, categories: e2.categories ?? [] };
|
|
4584
|
-
a3.items =
|
|
4678
|
+
a3.items = qa(a3.items, s9, e2.position);
|
|
4585
4679
|
}
|
|
4586
4680
|
return t17;
|
|
4587
4681
|
}
|
|
4588
4682
|
}
|
|
4589
|
-
function
|
|
4683
|
+
function qa(t17, e2, a3) {
|
|
4590
4684
|
return (null == a3 ? void 0 : a3.after) || (null == a3 ? void 0 : a3.before) ? (function(t18, e3, a4) {
|
|
4591
4685
|
const s9 = (t19) => {
|
|
4592
4686
|
const i = [];
|
|
@@ -4598,8 +4692,8 @@ function Oa(t17, e2, a3) {
|
|
|
4598
4692
|
return t18.map((t19) => "group" === t19.type ? { ...t19, items: [...t19.items, e3] } : t19);
|
|
4599
4693
|
})(t17, e2);
|
|
4600
4694
|
}
|
|
4601
|
-
const
|
|
4602
|
-
function
|
|
4695
|
+
const Wa = { annotate: "annotation-toolbar", shapes: "shapes-toolbar", insert: "insert-toolbar", form: "form-toolbar", redact: "redaction-toolbar" };
|
|
4696
|
+
function Ha() {
|
|
4603
4697
|
return { "mode:view": { id: "mode:view", label: "View", categories: ["mode", "mode-view"], action: ({ registry: t17, documentId: e2 }) => {
|
|
4604
4698
|
var _a2, _b, _c, _d;
|
|
4605
4699
|
const a3 = (_a2 = t17.getPlugin("ui")) == null ? void 0 : _a2.provides(), s9 = (_b = t17.getPlugin("interaction-manager")) == null ? void 0 : _b.provides();
|
|
@@ -4626,16 +4720,16 @@ function Na() {
|
|
|
4626
4720
|
a3 && (a3.setActiveToolbar("top", "secondary", "redaction-toolbar", e2), (_b = t17.getPlugin(ANNOTATION_PLUGIN_ID)) == null ? void 0 : _b.provides().forDocument(e2).setLocked({ type: LockModeType.Include, categories: ["form"] }));
|
|
4627
4721
|
}, active: ({ state: t17, documentId: e2 }) => isToolbarOpen(t17.plugins, e2, "top", "secondary", "redaction-toolbar") } };
|
|
4628
4722
|
}
|
|
4629
|
-
function
|
|
4723
|
+
function Ba(t17) {
|
|
4630
4724
|
var _a2, _b, _c, _d, _e2, _f;
|
|
4631
4725
|
const e2 = t17.toolbar ?? {}, a3 = e2.enabledModes ?? ["view", "annotate", "shapes", "insert", "form", "redact"], s9 = a3.length > 0, { schema: i, operationRegistry: r2 } = (function(t18 = {}) {
|
|
4632
4726
|
var e3, a4, s10, i2, r3, o2;
|
|
4633
|
-
const n6 = new Set(t18.enabledModes ?? ["view", "annotate", "shapes", "insert", "form", "redact"]), h = new
|
|
4727
|
+
const n6 = new Set(t18.enabledModes ?? ["view", "annotate", "shapes", "insert", "form", "redact"]), h = new Fa();
|
|
4634
4728
|
(null == (e3 = t18.customOperations) ? void 0 : e3.length) && h.registerAll(t18.customOperations);
|
|
4635
4729
|
const l2 = h.buildToolbars(), d = {};
|
|
4636
4730
|
for (const u of n6) {
|
|
4637
4731
|
if ("view" === u) continue;
|
|
4638
|
-
const t19 =
|
|
4732
|
+
const t19 = Wa[u];
|
|
4639
4733
|
l2[t19] && (d[t19] = l2[t19]);
|
|
4640
4734
|
}
|
|
4641
4735
|
const c = (function(t19) {
|
|
@@ -4644,10 +4738,10 @@ function Va(t17) {
|
|
|
4644
4738
|
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: [...t19.has("view") ? [e4("view", "View", "mode:view")] : [], ...t19.has("annotate") ? [e4("annotate", "Annotate", "mode:annotate")] : [], ...t19.has("shapes") ? [e4("shapes", "Shapes", "mode:shapes")] : [], ...t19.has("insert") ? [e4("insert", "Insert", "mode:insert")] : [], ...t19.has("form") ? [e4("form", "Form", "mode:form")] : [], ...t19.has("redact") ? [e4("redact", "Redact", "mode:redact")] : []] }, { type: "spacer", id: "main-spacer-right", flex: true }] };
|
|
4645
4739
|
})(n6);
|
|
4646
4740
|
return c && (d["chapter-editor-main-toolbar"] = c), (null == (a4 = t18.extend) ? void 0 : a4.toolbars) && Object.assign(d, t18.extend.toolbars), { schema: { id: "chapter-pdf-editor-ui", version: "1.0.0", toolbars: d, menus: (null == (s10 = t18.extend) ? void 0 : s10.menus) ?? {}, sidebars: (null == (i2 = t18.extend) ? void 0 : i2.sidebars) ?? {}, modals: (null == (r3 = t18.extend) ? void 0 : r3.modals) ?? {}, selectionMenus: (null == (o2 = t18.extend) ? void 0 : o2.selectionMenus) ?? {} }, operationRegistry: h };
|
|
4647
|
-
})({ ...e2, enabledModes: a3 }), o = { ...s9 ?
|
|
4648
|
-
return t17.notes && n5.push(createPluginRegistration(
|
|
4741
|
+
})({ ...e2, enabledModes: a3 }), o = { ...s9 ? Ha() : {}, ...s9 ? ja(r2.list()) : {}, ...t17.commands ?? {} }, n5 = [createPluginRegistration(DocumentManagerPluginPackage, { initialDocuments: [] }), createPluginRegistration(wa, { manifest: t17.manifest, overlapStrategy: t17.overlapStrategy, passwordProvider: t17.passwordProvider, chapterPdfLoader: t17.chapterPdfLoader, prefetchChapters: t17.prefetchChapters, unloadTimeoutMs: t17.unloadTimeoutMs }), createPluginRegistration(Ua, { placeholderPageHeight: t17.placeholderPageHeight, placeholderPageWidth: t17.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 === t17.loadDefaultStampLibrary ? { manifests: [] } : void 0), createPluginRegistration(SignaturePluginPackage), ...Object.keys(o).length > 0 ? [createPluginRegistration(CommandsPluginPackage, { commands: o })] : [], ...s9 ? [createPluginRegistration(I18nPluginPackage), createPluginRegistration(UIPluginPackage, { schema: i })] : []];
|
|
4742
|
+
return t17.notes && n5.push(createPluginRegistration(ve, { callbacks: t17.notes.callbacks, ui: (_b = (_a2 = t17.features) == null ? void 0 : _a2.notes) == null ? void 0 : _b.marker })), t17.bookmarks && n5.push(createPluginRegistration(_e, { callbacks: t17.bookmarks.callbacks, ui: (_d = (_c = t17.features) == null ? void 0 : _c.bookmarks) == null ? void 0 : _d.marker, hover: (_f = (_e2 = t17.features) == null ? void 0 : _e2.bookmarks) == null ? void 0 : _f.hover })), { plugins: n5, uiSchema: i, operationRegistry: r2 };
|
|
4649
4743
|
}
|
|
4650
|
-
function
|
|
4744
|
+
function ja(t17) {
|
|
4651
4745
|
const e2 = {};
|
|
4652
4746
|
for (const a3 of t17) a3.handler && (e2[a3.commandId] = { id: a3.commandId, labelKey: a3.i18nKey, label: a3.label, icon: a3.icon, categories: a3.categories, action: ({ documentId: t18 }) => {
|
|
4653
4747
|
var _a2;
|
|
@@ -4655,55 +4749,40 @@ function Ra(t17) {
|
|
|
4655
4749
|
} });
|
|
4656
4750
|
return e2;
|
|
4657
4751
|
}
|
|
4658
|
-
|
|
4659
|
-
function
|
|
4660
|
-
|
|
4661
|
-
return Va({ ...t17, toolbar: t17.toolbar ?? { enabledModes: [] }, features: { ...Ea, ...t17.features, markup: { ...Ea.markup, ...(_a2 = t17.features) == null ? void 0 : _a2.markup }, bookmarks: { ...Ea.bookmarks, ...(_b = t17.features) == null ? void 0 : _b.bookmarks }, notes: { ...Ea.notes, ...(_c = t17.features) == null ? void 0 : _c.notes }, selectionToolbar: { ...Ea.selectionToolbar, ...(_d = t17.features) == null ? void 0 : _d.selectionToolbar }, zoom: { ...Ea.zoom, ...(_e2 = t17.features) == null ? void 0 : _e2.zoom } } });
|
|
4662
|
-
}
|
|
4663
|
-
function _a(t17, e2, a3) {
|
|
4664
|
-
return Math.min(a3, Math.max(e2, t17));
|
|
4752
|
+
ta();
|
|
4753
|
+
function Xa(t17) {
|
|
4754
|
+
return Ba({ ...t17, toolbar: t17.toolbar ?? { enabledModes: [] }, features: ta(t17.features) });
|
|
4665
4755
|
}
|
|
4666
|
-
|
|
4667
|
-
|
|
4668
|
-
|
|
4669
|
-
|
|
4670
|
-
|
|
4671
|
-
|
|
4672
|
-
|
|
4673
|
-
|
|
4674
|
-
|
|
4675
|
-
|
|
4676
|
-
|
|
4677
|
-
|
|
4678
|
-
|
|
4679
|
-
|
|
4680
|
-
|
|
4681
|
-
|
|
4682
|
-
|
|
4683
|
-
|
|
4684
|
-
|
|
4685
|
-
|
|
4686
|
-
|
|
4687
|
-
|
|
4688
|
-
|
|
4689
|
-
|
|
4690
|
-
|
|
4691
|
-
|
|
4692
|
-
|
|
4693
|
-
|
|
4694
|
-
|
|
4695
|
-
|
|
4696
|
-
t18.removeEventListener("wheel", d2), t18.removeEventListener("pointerdown", u2), t18.removeEventListener("pointermove", p2), t18.removeEventListener("pointerup", g2), t18.removeEventListener("pointercancel", g2), n6 && clearTimeout(n6);
|
|
4697
|
-
};
|
|
4698
|
-
})({ container: e2, getScale: () => P, setScale: w, minZoom: ((_a3 = m.zoom) == null ? void 0 : _a3.min) ?? 0.5, maxZoom: ((_b2 = m.zoom) == null ? void 0 : _b2.max) ?? 3 }) : void 0;
|
|
4699
|
-
}, [(_c = m.zoom) == null ? void 0 : _c.max, (_d = m.zoom) == null ? void 0 : _d.min, P, b]), /* @__PURE__ */ jsx("div", { ref: I, className: l2, style: l2 ? void 0 : He, children: /* @__PURE__ */ jsx(EmbedPDF, { engine: a3, plugins: v.plugins, children: ({ pluginsReady: a4 }) => a4 ? /* @__PURE__ */ jsxs("div", { style: b ? { ...Be, transform: `scale(${P})`, transformOrigin: "top center" } : Be, children: [
|
|
4700
|
-
/* @__PURE__ */ jsx(la, { className: d, features: m, buildSelectionMenu: u, onExtraSelectionAction: p, renderPageOverlay: g }),
|
|
4701
|
-
f
|
|
4702
|
-
] }) : null }) });
|
|
4703
|
-
}
|
|
4704
|
-
const C = "chapter-manager", M = { id: C, name: "Chapter Manager Plugin", version: "0.1.0", provides: ["chapter-manager"], requires: ["document-manager"], optional: [], defaultConfig: { manifest: { chapters: [] }, prefetchChapters: 1, unloadTimeoutMs: 6e4, autoActivateOnLoad: true } };
|
|
4705
|
-
const S = { kind: "first-wins" };
|
|
4706
|
-
function x(t17, e2, a3) {
|
|
4756
|
+
const Ka = { overlapStrategy: { kind: "first-wins" }, passwordProvider: new class {
|
|
4757
|
+
constructor(t17) {
|
|
4758
|
+
this.cb = t17;
|
|
4759
|
+
}
|
|
4760
|
+
resolvePassword(t17, e2) {
|
|
4761
|
+
return this.cb(t17, e2);
|
|
4762
|
+
}
|
|
4763
|
+
}(async () => null), prefetchChapters: 1, loadDefaultStampLibrary: false, unloadTimeoutMs: 12e4, toolbar: { enabledModes: [] } };
|
|
4764
|
+
function Qa(t17) {
|
|
4765
|
+
const e2 = (function(t18) {
|
|
4766
|
+
return (function(t19) {
|
|
4767
|
+
return "callbacks" in t19.notes;
|
|
4768
|
+
})(t18) ? { manifest: t18.manifest, chapterPdfLoader: t18.chapterPdfLoader, notes: t18.notes.callbacks, bookmarks: t18.bookmarks.callbacks } : t18;
|
|
4769
|
+
})(t17), a3 = (function(t18) {
|
|
4770
|
+
return { manifest: t18.manifest, chapterPdfLoader: t18.chapterPdfLoader, ...Ka, notes: { callbacks: t18.notes }, bookmarks: { callbacks: t18.bookmarks }, features: ta(t18.features) };
|
|
4771
|
+
})(e2), { plugins: s9 } = Xa(a3);
|
|
4772
|
+
return { plugins: s9, features: a3.features, editorOptions: a3 };
|
|
4773
|
+
}
|
|
4774
|
+
function Ja({ engine: e2, options: a3, editorOptions: s9, features: i, className: r2, viewportClassName: n5, buildSelectionMenu: h, onExtraSelectionAction: l2, renderPageOverlay: d, children: u }) {
|
|
4775
|
+
const { plugins: p, features: g } = useMemo(() => (function(t17) {
|
|
4776
|
+
if (t17.options) return Qa(t17.options);
|
|
4777
|
+
if (!t17.editorOptions) throw new Error("ChapterPdfViewer: 请传入 `options`(推荐),或同时传入 `editorOptions` 与 `features`");
|
|
4778
|
+
const e3 = ta(t17.features), { plugins: a4 } = Xa({ ...t17.editorOptions, features: e3 });
|
|
4779
|
+
return { plugins: a4, features: e3, editorOptions: { ...t17.editorOptions, features: e3 } };
|
|
4780
|
+
})({ options: a3, editorOptions: s9, features: i }), [s9, i, a3]);
|
|
4781
|
+
return jsx("div", { className: r2, style: r2 ? void 0 : je, children: /* @__PURE__ */ jsx(EmbedPDF, { engine: e2, plugins: p, children: ({ pluginsReady: e3 }) => e3 ? /* @__PURE__ */ jsx($a, { className: n5, features: g, buildSelectionMenu: h, onExtraSelectionAction: l2, renderPageOverlay: d, children: u }) : null }) });
|
|
4782
|
+
}
|
|
4783
|
+
const M = "chapter-manager", S = { id: M, name: "Chapter Manager Plugin", version: "0.1.0", provides: ["chapter-manager"], requires: ["document-manager"], optional: [], defaultConfig: { manifest: { chapters: [] }, prefetchChapters: 1, unloadTimeoutMs: 6e4, autoActivateOnLoad: true } };
|
|
4784
|
+
const x = { kind: "first-wins" };
|
|
4785
|
+
function L(t17, e2, a3) {
|
|
4707
4786
|
if (1 === e2.length) return e2[0].chapterId;
|
|
4708
4787
|
switch (a3.kind) {
|
|
4709
4788
|
case "first-wins":
|
|
@@ -4755,8 +4834,8 @@ let $ = class {
|
|
|
4755
4834
|
return a3 ? this._pages.indexOf(a3) : -1;
|
|
4756
4835
|
}
|
|
4757
4836
|
};
|
|
4758
|
-
function
|
|
4759
|
-
const a3 = (function(t18, e3 =
|
|
4837
|
+
function D(t17, e2 = x) {
|
|
4838
|
+
const a3 = (function(t18, e3 = x) {
|
|
4760
4839
|
const a4 = /* @__PURE__ */ new Map();
|
|
4761
4840
|
for (const i2 of t18.chapters) {
|
|
4762
4841
|
const [t19, e4] = i2.globalPageRange;
|
|
@@ -4766,7 +4845,7 @@ function L(t17, e2 = S) {
|
|
|
4766
4845
|
}
|
|
4767
4846
|
}
|
|
4768
4847
|
const s10 = /* @__PURE__ */ new Map();
|
|
4769
|
-
for (const [i2, o2] of a4) s10.set(i2,
|
|
4848
|
+
for (const [i2, o2] of a4) s10.set(i2, L(i2, o2, e3));
|
|
4770
4849
|
return s10;
|
|
4771
4850
|
})(t17, e2), s9 = /* @__PURE__ */ new Map();
|
|
4772
4851
|
for (const n5 of t17.chapters) s9.set(n5.chapterId, n5);
|
|
@@ -4780,12 +4859,12 @@ function L(t17, e2 = S) {
|
|
|
4780
4859
|
}
|
|
4781
4860
|
return new $(o);
|
|
4782
4861
|
}
|
|
4783
|
-
const
|
|
4862
|
+
const T = class s extends BasePlugin {
|
|
4784
4863
|
constructor(t17, s9) {
|
|
4785
|
-
super(t17, s9), this.statusChange$ = createBehaviorEmitter(), this.manifestChange$ = createEmitter(), this.overlapStrategy =
|
|
4864
|
+
super(t17, s9), this.statusChange$ = createBehaviorEmitter(), this.manifestChange$ = createEmitter(), this.overlapStrategy = x, 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);
|
|
4786
4865
|
}
|
|
4787
4866
|
async initialize(t17) {
|
|
4788
|
-
if (this.config = t17, this.passwordProvider = t17.passwordProvider, this.overlapStrategy = t17.overlapStrategy ??
|
|
4867
|
+
if (this.config = t17, this.passwordProvider = t17.passwordProvider, this.overlapStrategy = t17.overlapStrategy ?? x, this.setManifestInternal(t17.manifest), this.documentManagerUnsubs.push(this.documentManager.provides().onDocumentOpened((t18) => {
|
|
4789
4868
|
this.isOwnedChapter(t18.id) && (this.passwordAttempts.delete(t18.id), this.updateStatus(t18.id, "loaded"));
|
|
4790
4869
|
}), this.documentManager.provides().onDocumentClosed((t18) => {
|
|
4791
4870
|
this.isOwnedChapter(t18) && this.updateStatus(t18, "closed");
|
|
@@ -4820,7 +4899,7 @@ const D = class s extends BasePlugin {
|
|
|
4820
4899
|
const a3 = new Set(this.chapterStatus.keys()), i = new Set(t17.chapters.map((t18) => t18.chapterId));
|
|
4821
4900
|
for (const s9 of a3) i.has(s9) || (this.closeChapter(s9), this.chapterStatus.delete(s9));
|
|
4822
4901
|
for (const s9 of t17.chapters) this.chapterStatus.has(s9.chapterId) || this.chapterStatus.set(s9.chapterId, "idle");
|
|
4823
|
-
this.manifest = t17, this.virtualPageMap =
|
|
4902
|
+
this.manifest = t17, this.virtualPageMap = D(t17, this.overlapStrategy), this.manifestChange$.emit({ manifest: t17, map: this.virtualPageMap }), this.eagerPrefetchFromManifest();
|
|
4824
4903
|
}
|
|
4825
4904
|
eagerPrefetchFromManifest() {
|
|
4826
4905
|
const t17 = this.config.prefetchChapters ?? 0;
|
|
@@ -4944,11 +5023,11 @@ const D = class s extends BasePlugin {
|
|
|
4944
5023
|
this.chapterStatus.get(t17) !== e2 && (this.chapterStatus.set(t17, e2), this.statusChange$.emit({ chapterId: t17, status: e2, ..."error" === e2 && a3 ? { error: { message: a3 } } : {} }));
|
|
4945
5024
|
}
|
|
4946
5025
|
};
|
|
4947
|
-
|
|
4948
|
-
let
|
|
4949
|
-
const
|
|
4950
|
-
const
|
|
4951
|
-
function
|
|
5026
|
+
T.id = "chapter-manager";
|
|
5027
|
+
let k = T;
|
|
5028
|
+
const G = { manifest: S, create: (t17) => new k(M, t17), reducer: (t17) => t17, initialState: {} }, z = "chapter-scroll", O = { id: z, name: "Chapter Scroll Plugin", version: "0.1.0", provides: ["chapter-scroll"], requires: ["chapter-manager"], optional: [], defaultConfig: { placeholderPageHeight: 1200, placeholderPageWidth: 900, bufferSize: 2, pageGap: 20 } };
|
|
5029
|
+
const A = { kind: "first-wins" };
|
|
5030
|
+
function N(t17, e2, a3) {
|
|
4952
5031
|
if (1 === e2.length) return e2[0].chapterId;
|
|
4953
5032
|
switch (a3.kind) {
|
|
4954
5033
|
case "first-wins":
|
|
@@ -4966,7 +5045,7 @@ function A(t17, e2, a3) {
|
|
|
4966
5045
|
return a3.resolve(t17, e2);
|
|
4967
5046
|
}
|
|
4968
5047
|
}
|
|
4969
|
-
class
|
|
5048
|
+
class V {
|
|
4970
5049
|
constructor(t17) {
|
|
4971
5050
|
this._pages = t17, this._byChapter = /* @__PURE__ */ new Map(), this._byGlobalNumber = /* @__PURE__ */ new Map();
|
|
4972
5051
|
for (const e2 of t17) {
|
|
@@ -5000,8 +5079,8 @@ class N {
|
|
|
5000
5079
|
return a3 ? this._pages.indexOf(a3) : -1;
|
|
5001
5080
|
}
|
|
5002
5081
|
}
|
|
5003
|
-
function
|
|
5004
|
-
const a3 = (function(t18, e3 =
|
|
5082
|
+
function R(t17, e2 = A) {
|
|
5083
|
+
const a3 = (function(t18, e3 = A) {
|
|
5005
5084
|
const a4 = /* @__PURE__ */ new Map();
|
|
5006
5085
|
for (const i2 of t18.chapters) {
|
|
5007
5086
|
const [t19, e4] = i2.globalPageRange;
|
|
@@ -5011,7 +5090,7 @@ function V(t17, e2 = O) {
|
|
|
5011
5090
|
}
|
|
5012
5091
|
}
|
|
5013
5092
|
const s10 = /* @__PURE__ */ new Map();
|
|
5014
|
-
for (const [i2, o2] of a4) s10.set(i2,
|
|
5093
|
+
for (const [i2, o2] of a4) s10.set(i2, N(i2, o2, e3));
|
|
5015
5094
|
return s10;
|
|
5016
5095
|
})(t17, e2), s9 = /* @__PURE__ */ new Map();
|
|
5017
5096
|
for (const n5 of t17.chapters) s9.set(n5.chapterId, n5);
|
|
@@ -5023,14 +5102,14 @@ function V(t17, e2 = O) {
|
|
|
5023
5102
|
const [i2] = e3.globalPageRange, [h] = e3.localPageRange, d = h + (n5 - i2);
|
|
5024
5103
|
o.push({ globalPageIndex: r2++, globalPageNumber: n5, chapterId: t18, localPageIndex: d });
|
|
5025
5104
|
}
|
|
5026
|
-
return new
|
|
5105
|
+
return new V(o);
|
|
5027
5106
|
}
|
|
5028
|
-
const
|
|
5107
|
+
const _ = class s2 extends BasePlugin {
|
|
5029
5108
|
constructor(t17, s9) {
|
|
5030
|
-
super(t17, s9), this.statusChange$ = createBehaviorEmitter(), this.manifestChange$ = createEmitter(), this.overlapStrategy =
|
|
5109
|
+
super(t17, s9), 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);
|
|
5031
5110
|
}
|
|
5032
5111
|
async initialize(t17) {
|
|
5033
|
-
if (this.config = t17, this.passwordProvider = t17.passwordProvider, this.overlapStrategy = t17.overlapStrategy ??
|
|
5112
|
+
if (this.config = t17, this.passwordProvider = t17.passwordProvider, this.overlapStrategy = t17.overlapStrategy ?? A, this.setManifestInternal(t17.manifest), this.documentManagerUnsubs.push(this.documentManager.provides().onDocumentOpened((t18) => {
|
|
5034
5113
|
this.isOwnedChapter(t18.id) && (this.passwordAttempts.delete(t18.id), this.updateStatus(t18.id, "loaded"));
|
|
5035
5114
|
}), this.documentManager.provides().onDocumentClosed((t18) => {
|
|
5036
5115
|
this.isOwnedChapter(t18) && this.updateStatus(t18, "closed");
|
|
@@ -5065,7 +5144,7 @@ const R = class s2 extends BasePlugin {
|
|
|
5065
5144
|
const a3 = new Set(this.chapterStatus.keys()), i = new Set(t17.chapters.map((t18) => t18.chapterId));
|
|
5066
5145
|
for (const s9 of a3) i.has(s9) || (this.closeChapter(s9), this.chapterStatus.delete(s9));
|
|
5067
5146
|
for (const s9 of t17.chapters) this.chapterStatus.has(s9.chapterId) || this.chapterStatus.set(s9.chapterId, "idle");
|
|
5068
|
-
this.manifest = t17, this.virtualPageMap =
|
|
5147
|
+
this.manifest = t17, this.virtualPageMap = R(t17, this.overlapStrategy), this.manifestChange$.emit({ manifest: t17, map: this.virtualPageMap }), this.eagerPrefetchFromManifest();
|
|
5069
5148
|
}
|
|
5070
5149
|
eagerPrefetchFromManifest() {
|
|
5071
5150
|
const t17 = this.config.prefetchChapters ?? 0;
|
|
@@ -5189,11 +5268,11 @@ const R = class s2 extends BasePlugin {
|
|
|
5189
5268
|
this.chapterStatus.get(t17) !== e2 && (this.chapterStatus.set(t17, e2), this.statusChange$.emit({ chapterId: t17, status: e2, ..."error" === e2 && a3 ? { error: { message: a3 } } : {} }));
|
|
5190
5269
|
}
|
|
5191
5270
|
};
|
|
5192
|
-
|
|
5193
|
-
let
|
|
5194
|
-
const
|
|
5271
|
+
_.id = "chapter-manager";
|
|
5272
|
+
let U = _;
|
|
5273
|
+
const E = class extends BasePlugin {
|
|
5195
5274
|
constructor(t17, a3) {
|
|
5196
|
-
super(t17, a3), this.layoutChange$ = createBehaviorEmitter(), 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(
|
|
5275
|
+
super(t17, a3), this.layoutChange$ = createBehaviorEmitter(), 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(U.id), this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
|
|
5197
5276
|
}
|
|
5198
5277
|
async initialize(t17) {
|
|
5199
5278
|
this.config = { placeholderPageHeight: t17.placeholderPageHeight ?? 1200, placeholderPageWidth: t17.placeholderPageWidth ?? 900, bufferSize: t17.bufferSize ?? 2, pageGap: t17.pageGap ?? 20 }, this.virtualPageMap = this.chapterManager.provides().getVirtualPageMap(), this.rebuildOffsets(), this.chapterManagerUnsubs.push(this.chapterManager.provides().onManifestChange(({ map: t18 }) => {
|
|
@@ -5362,12 +5441,12 @@ const U = class extends BasePlugin {
|
|
|
5362
5441
|
a3 && this.scrollToIndex(a3.globalPageIndex, e2);
|
|
5363
5442
|
}
|
|
5364
5443
|
};
|
|
5365
|
-
|
|
5366
|
-
let
|
|
5367
|
-
const
|
|
5444
|
+
E.id = "chapter-scroll";
|
|
5445
|
+
let F = E;
|
|
5446
|
+
const q = { manifest: O, create: (t17) => new F(z, t17), reducer: (t17) => t17, initialState: {} }, H = "note", W = { id: H, name: "Note Plugin", version: "0.1.0", provides: ["note"], requires: ["selection", "chapter-scroll", "chapter-manager"], optional: [], defaultConfig: { callbacks: { onCreateNote: async () => null, onActivateNote: () => {
|
|
5368
5447
|
} }, markerSize: 18 } };
|
|
5369
|
-
const
|
|
5370
|
-
function
|
|
5448
|
+
const B = { kind: "first-wins" };
|
|
5449
|
+
function j(t17, e2, a3) {
|
|
5371
5450
|
if (1 === e2.length) return e2[0].chapterId;
|
|
5372
5451
|
switch (a3.kind) {
|
|
5373
5452
|
case "first-wins":
|
|
@@ -5385,7 +5464,7 @@ function B(t17, e2, a3) {
|
|
|
5385
5464
|
return a3.resolve(t17, e2);
|
|
5386
5465
|
}
|
|
5387
5466
|
}
|
|
5388
|
-
let
|
|
5467
|
+
let K = class {
|
|
5389
5468
|
constructor(t17) {
|
|
5390
5469
|
this._pages = t17, this._byChapter = /* @__PURE__ */ new Map(), this._byGlobalNumber = /* @__PURE__ */ new Map();
|
|
5391
5470
|
for (const e2 of t17) {
|
|
@@ -5419,8 +5498,8 @@ let j = class {
|
|
|
5419
5498
|
return a3 ? this._pages.indexOf(a3) : -1;
|
|
5420
5499
|
}
|
|
5421
5500
|
};
|
|
5422
|
-
function
|
|
5423
|
-
const a3 = (function(t18, e3 =
|
|
5501
|
+
function Q(t17, e2 = B) {
|
|
5502
|
+
const a3 = (function(t18, e3 = B) {
|
|
5424
5503
|
const a4 = /* @__PURE__ */ new Map();
|
|
5425
5504
|
for (const i2 of t18.chapters) {
|
|
5426
5505
|
const [t19, e4] = i2.globalPageRange;
|
|
@@ -5430,7 +5509,7 @@ function K(t17, e2 = H) {
|
|
|
5430
5509
|
}
|
|
5431
5510
|
}
|
|
5432
5511
|
const s10 = /* @__PURE__ */ new Map();
|
|
5433
|
-
for (const [i2, o2] of a4) s10.set(i2,
|
|
5512
|
+
for (const [i2, o2] of a4) s10.set(i2, j(i2, o2, e3));
|
|
5434
5513
|
return s10;
|
|
5435
5514
|
})(t17, e2), s9 = /* @__PURE__ */ new Map();
|
|
5436
5515
|
for (const n5 of t17.chapters) s9.set(n5.chapterId, n5);
|
|
@@ -5442,14 +5521,14 @@ function K(t17, e2 = H) {
|
|
|
5442
5521
|
const [i2] = e3.globalPageRange, [h] = e3.localPageRange, d = h + (n5 - i2);
|
|
5443
5522
|
o.push({ globalPageIndex: r2++, globalPageNumber: n5, chapterId: t18, localPageIndex: d });
|
|
5444
5523
|
}
|
|
5445
|
-
return new
|
|
5524
|
+
return new K(o);
|
|
5446
5525
|
}
|
|
5447
|
-
const
|
|
5526
|
+
const Y = class s3 extends BasePlugin {
|
|
5448
5527
|
constructor(t17, s9) {
|
|
5449
|
-
super(t17, s9), this.statusChange$ = createBehaviorEmitter(), this.manifestChange$ = createEmitter(), this.overlapStrategy =
|
|
5528
|
+
super(t17, s9), this.statusChange$ = createBehaviorEmitter(), this.manifestChange$ = createEmitter(), this.overlapStrategy = B, 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);
|
|
5450
5529
|
}
|
|
5451
5530
|
async initialize(t17) {
|
|
5452
|
-
if (this.config = t17, this.passwordProvider = t17.passwordProvider, this.overlapStrategy = t17.overlapStrategy ??
|
|
5531
|
+
if (this.config = t17, this.passwordProvider = t17.passwordProvider, this.overlapStrategy = t17.overlapStrategy ?? B, this.setManifestInternal(t17.manifest), this.documentManagerUnsubs.push(this.documentManager.provides().onDocumentOpened((t18) => {
|
|
5453
5532
|
this.isOwnedChapter(t18.id) && (this.passwordAttempts.delete(t18.id), this.updateStatus(t18.id, "loaded"));
|
|
5454
5533
|
}), this.documentManager.provides().onDocumentClosed((t18) => {
|
|
5455
5534
|
this.isOwnedChapter(t18) && this.updateStatus(t18, "closed");
|
|
@@ -5484,7 +5563,7 @@ const J = class s3 extends BasePlugin {
|
|
|
5484
5563
|
const a3 = new Set(this.chapterStatus.keys()), i = new Set(t17.chapters.map((t18) => t18.chapterId));
|
|
5485
5564
|
for (const s9 of a3) i.has(s9) || (this.closeChapter(s9), this.chapterStatus.delete(s9));
|
|
5486
5565
|
for (const s9 of t17.chapters) this.chapterStatus.has(s9.chapterId) || this.chapterStatus.set(s9.chapterId, "idle");
|
|
5487
|
-
this.manifest = t17, this.virtualPageMap =
|
|
5566
|
+
this.manifest = t17, this.virtualPageMap = Q(t17, this.overlapStrategy), this.manifestChange$.emit({ manifest: t17, map: this.virtualPageMap }), this.eagerPrefetchFromManifest();
|
|
5488
5567
|
}
|
|
5489
5568
|
eagerPrefetchFromManifest() {
|
|
5490
5569
|
const t17 = this.config.prefetchChapters ?? 0;
|
|
@@ -5608,10 +5687,10 @@ const J = class s3 extends BasePlugin {
|
|
|
5608
5687
|
this.chapterStatus.get(t17) !== e2 && (this.chapterStatus.set(t17, e2), this.statusChange$.emit({ chapterId: t17, status: e2, ..."error" === e2 && a3 ? { error: { message: a3 } } : {} }));
|
|
5609
5688
|
}
|
|
5610
5689
|
};
|
|
5611
|
-
|
|
5612
|
-
let
|
|
5690
|
+
Y.id = "chapter-manager";
|
|
5691
|
+
let J = Y;
|
|
5613
5692
|
const X = { kind: "first-wins" };
|
|
5614
|
-
function
|
|
5693
|
+
function Z(t17, e2, a3) {
|
|
5615
5694
|
if (1 === e2.length) return e2[0].chapterId;
|
|
5616
5695
|
switch (a3.kind) {
|
|
5617
5696
|
case "first-wins":
|
|
@@ -5629,7 +5708,7 @@ function Y(t17, e2, a3) {
|
|
|
5629
5708
|
return a3.resolve(t17, e2);
|
|
5630
5709
|
}
|
|
5631
5710
|
}
|
|
5632
|
-
let
|
|
5711
|
+
let tt2 = class {
|
|
5633
5712
|
constructor(t17) {
|
|
5634
5713
|
this._pages = t17, this._byChapter = /* @__PURE__ */ new Map(), this._byGlobalNumber = /* @__PURE__ */ new Map();
|
|
5635
5714
|
for (const e2 of t17) {
|
|
@@ -5663,7 +5742,7 @@ let Z = class {
|
|
|
5663
5742
|
return a3 ? this._pages.indexOf(a3) : -1;
|
|
5664
5743
|
}
|
|
5665
5744
|
};
|
|
5666
|
-
function
|
|
5745
|
+
function et(t17, e2 = X) {
|
|
5667
5746
|
const a3 = (function(t18, e3 = X) {
|
|
5668
5747
|
const a4 = /* @__PURE__ */ new Map();
|
|
5669
5748
|
for (const i2 of t18.chapters) {
|
|
@@ -5674,7 +5753,7 @@ function tt(t17, e2 = X) {
|
|
|
5674
5753
|
}
|
|
5675
5754
|
}
|
|
5676
5755
|
const s10 = /* @__PURE__ */ new Map();
|
|
5677
|
-
for (const [i2, o2] of a4) s10.set(i2,
|
|
5756
|
+
for (const [i2, o2] of a4) s10.set(i2, Z(i2, o2, e3));
|
|
5678
5757
|
return s10;
|
|
5679
5758
|
})(t17, e2), s9 = /* @__PURE__ */ new Map();
|
|
5680
5759
|
for (const n5 of t17.chapters) s9.set(n5.chapterId, n5);
|
|
@@ -5686,9 +5765,9 @@ function tt(t17, e2 = X) {
|
|
|
5686
5765
|
const [i2] = e3.globalPageRange, [h] = e3.localPageRange, d = h + (n5 - i2);
|
|
5687
5766
|
o.push({ globalPageIndex: r2++, globalPageNumber: n5, chapterId: t18, localPageIndex: d });
|
|
5688
5767
|
}
|
|
5689
|
-
return new
|
|
5768
|
+
return new tt2(o);
|
|
5690
5769
|
}
|
|
5691
|
-
const
|
|
5770
|
+
const at = class s4 extends BasePlugin {
|
|
5692
5771
|
constructor(t17, s9) {
|
|
5693
5772
|
super(t17, s9), this.statusChange$ = createBehaviorEmitter(), this.manifestChange$ = createEmitter(), this.overlapStrategy = X, 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);
|
|
5694
5773
|
}
|
|
@@ -5728,7 +5807,7 @@ const et = class s4 extends BasePlugin {
|
|
|
5728
5807
|
const a3 = new Set(this.chapterStatus.keys()), i = new Set(t17.chapters.map((t18) => t18.chapterId));
|
|
5729
5808
|
for (const s9 of a3) i.has(s9) || (this.closeChapter(s9), this.chapterStatus.delete(s9));
|
|
5730
5809
|
for (const s9 of t17.chapters) this.chapterStatus.has(s9.chapterId) || this.chapterStatus.set(s9.chapterId, "idle");
|
|
5731
|
-
this.manifest = t17, this.virtualPageMap =
|
|
5810
|
+
this.manifest = t17, this.virtualPageMap = et(t17, this.overlapStrategy), this.manifestChange$.emit({ manifest: t17, map: this.virtualPageMap }), this.eagerPrefetchFromManifest();
|
|
5732
5811
|
}
|
|
5733
5812
|
eagerPrefetchFromManifest() {
|
|
5734
5813
|
const t17 = this.config.prefetchChapters ?? 0;
|
|
@@ -5852,11 +5931,11 @@ const et = class s4 extends BasePlugin {
|
|
|
5852
5931
|
this.chapterStatus.get(t17) !== e2 && (this.chapterStatus.set(t17, e2), this.statusChange$.emit({ chapterId: t17, status: e2, ..."error" === e2 && a3 ? { error: { message: a3 } } : {} }));
|
|
5853
5932
|
}
|
|
5854
5933
|
};
|
|
5855
|
-
|
|
5856
|
-
let
|
|
5857
|
-
const
|
|
5934
|
+
at.id = "chapter-manager";
|
|
5935
|
+
let st = at;
|
|
5936
|
+
const it2 = class extends BasePlugin {
|
|
5858
5937
|
constructor(t17, a3) {
|
|
5859
|
-
super(t17, a3), this.layoutChange$ = createBehaviorEmitter(), 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(
|
|
5938
|
+
super(t17, a3), this.layoutChange$ = createBehaviorEmitter(), 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(st.id), this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
|
|
5860
5939
|
}
|
|
5861
5940
|
async initialize(t17) {
|
|
5862
5941
|
this.config = { placeholderPageHeight: t17.placeholderPageHeight ?? 1200, placeholderPageWidth: t17.placeholderPageWidth ?? 900, bufferSize: t17.bufferSize ?? 2, pageGap: t17.pageGap ?? 20 }, this.virtualPageMap = this.chapterManager.provides().getVirtualPageMap(), this.rebuildOffsets(), this.chapterManagerUnsubs.push(this.chapterManager.provides().onManifestChange(({ map: t18 }) => {
|
|
@@ -6025,11 +6104,11 @@ const st = class extends BasePlugin {
|
|
|
6025
6104
|
a3 && this.scrollToIndex(a3.globalPageIndex, e2);
|
|
6026
6105
|
}
|
|
6027
6106
|
};
|
|
6028
|
-
|
|
6029
|
-
let
|
|
6030
|
-
const
|
|
6107
|
+
it2.id = "chapter-scroll";
|
|
6108
|
+
let ot = it2;
|
|
6109
|
+
const rt = class s5 extends BasePlugin {
|
|
6031
6110
|
constructor(t17, s9) {
|
|
6032
|
-
super(t17, s9), this.notesChange$ = createBehaviorEmitter([]), this.noteActivated$ = createEmitter(), this.notes = /* @__PURE__ */ new Map(), this.chapterScroll = this.registry.getPlugin(
|
|
6111
|
+
super(t17, s9), this.notesChange$ = createBehaviorEmitter([]), this.noteActivated$ = createEmitter(), this.notes = /* @__PURE__ */ new Map(), this.chapterScroll = this.registry.getPlugin(ot.id), this.chapterManager = this.registry.getPlugin(J.id), this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
|
|
6033
6112
|
}
|
|
6034
6113
|
async initialize(t17) {
|
|
6035
6114
|
if (this.config = t17, t17.callbacks.loadNotes) try {
|
|
@@ -6059,7 +6138,7 @@ const ot = class s5 extends BasePlugin {
|
|
|
6059
6138
|
return Array.from(this.notes.values());
|
|
6060
6139
|
}
|
|
6061
6140
|
buildDraft(t17) {
|
|
6062
|
-
return { chapterId: t17.chapterId, localPageIndex: t17.localPageIndex, globalPageNumber: t17.globalPageNumber, globalPageIndex: t17.globalPageIndex, rectsPdfCoord: t17.rectsPdfCoord, endAnchor:
|
|
6141
|
+
return { chapterId: t17.chapterId, localPageIndex: t17.localPageIndex, globalPageNumber: t17.globalPageNumber, globalPageIndex: t17.globalPageIndex, rectsPdfCoord: t17.rectsPdfCoord, endAnchor: ht(t17.rectsPdfCoord), selectedText: t17.selectedText, content: t17.content };
|
|
6063
6142
|
}
|
|
6064
6143
|
async requestCreateFromSelection(t17) {
|
|
6065
6144
|
if (0 === t17.rectsPdfCoord.length) return null;
|
|
@@ -6126,15 +6205,15 @@ const ot = class s5 extends BasePlugin {
|
|
|
6126
6205
|
});
|
|
6127
6206
|
}
|
|
6128
6207
|
};
|
|
6129
|
-
|
|
6130
|
-
let
|
|
6131
|
-
function
|
|
6208
|
+
rt.id = "note";
|
|
6209
|
+
let nt = rt;
|
|
6210
|
+
function ht(t17) {
|
|
6132
6211
|
const e2 = t17[t17.length - 1];
|
|
6133
6212
|
return { x: e2.origin.x + e2.size.width, y: e2.origin.y + e2.size.height };
|
|
6134
6213
|
}
|
|
6135
|
-
const
|
|
6136
|
-
const
|
|
6137
|
-
function
|
|
6214
|
+
const dt = { manifest: W, create: (t17) => new nt(H, t17), reducer: (t17) => t17, initialState: {} }, lt = "paragraph-bookmark", ct2 = { id: lt, name: "Paragraph Bookmark Plugin", version: "0.1.0", provides: ["paragraph-bookmark"], requires: ["chapter-scroll", "chapter-manager"], optional: [], defaultConfig: {} };
|
|
6215
|
+
const ut = { kind: "first-wins" };
|
|
6216
|
+
function pt(t17, e2, a3) {
|
|
6138
6217
|
if (1 === e2.length) return e2[0].chapterId;
|
|
6139
6218
|
switch (a3.kind) {
|
|
6140
6219
|
case "first-wins":
|
|
@@ -6152,7 +6231,7 @@ function ut(t17, e2, a3) {
|
|
|
6152
6231
|
return a3.resolve(t17, e2);
|
|
6153
6232
|
}
|
|
6154
6233
|
}
|
|
6155
|
-
let
|
|
6234
|
+
let gt = class {
|
|
6156
6235
|
constructor(t17) {
|
|
6157
6236
|
this._pages = t17, this._byChapter = /* @__PURE__ */ new Map(), this._byGlobalNumber = /* @__PURE__ */ new Map();
|
|
6158
6237
|
for (const e2 of t17) {
|
|
@@ -6186,8 +6265,8 @@ let pt = class {
|
|
|
6186
6265
|
return a3 ? this._pages.indexOf(a3) : -1;
|
|
6187
6266
|
}
|
|
6188
6267
|
};
|
|
6189
|
-
function
|
|
6190
|
-
const a3 = (function(t18, e3 =
|
|
6268
|
+
function ft(t17, e2 = ut) {
|
|
6269
|
+
const a3 = (function(t18, e3 = ut) {
|
|
6191
6270
|
const a4 = /* @__PURE__ */ new Map();
|
|
6192
6271
|
for (const i2 of t18.chapters) {
|
|
6193
6272
|
const [t19, e4] = i2.globalPageRange;
|
|
@@ -6197,7 +6276,7 @@ function gt(t17, e2 = ct) {
|
|
|
6197
6276
|
}
|
|
6198
6277
|
}
|
|
6199
6278
|
const s10 = /* @__PURE__ */ new Map();
|
|
6200
|
-
for (const [i2, o2] of a4) s10.set(i2,
|
|
6279
|
+
for (const [i2, o2] of a4) s10.set(i2, pt(i2, o2, e3));
|
|
6201
6280
|
return s10;
|
|
6202
6281
|
})(t17, e2), s9 = /* @__PURE__ */ new Map();
|
|
6203
6282
|
for (const n5 of t17.chapters) s9.set(n5.chapterId, n5);
|
|
@@ -6209,14 +6288,14 @@ function gt(t17, e2 = ct) {
|
|
|
6209
6288
|
const [i2] = e3.globalPageRange, [h] = e3.localPageRange, d = h + (n5 - i2);
|
|
6210
6289
|
o.push({ globalPageIndex: r2++, globalPageNumber: n5, chapterId: t18, localPageIndex: d });
|
|
6211
6290
|
}
|
|
6212
|
-
return new
|
|
6291
|
+
return new gt(o);
|
|
6213
6292
|
}
|
|
6214
|
-
const
|
|
6293
|
+
const mt = class s6 extends BasePlugin {
|
|
6215
6294
|
constructor(t17, s9) {
|
|
6216
|
-
super(t17, s9), this.statusChange$ = createBehaviorEmitter(), this.manifestChange$ = createEmitter(), this.overlapStrategy =
|
|
6295
|
+
super(t17, s9), 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);
|
|
6217
6296
|
}
|
|
6218
6297
|
async initialize(t17) {
|
|
6219
|
-
if (this.config = t17, this.passwordProvider = t17.passwordProvider, this.overlapStrategy = t17.overlapStrategy ??
|
|
6298
|
+
if (this.config = t17, this.passwordProvider = t17.passwordProvider, this.overlapStrategy = t17.overlapStrategy ?? ut, this.setManifestInternal(t17.manifest), this.documentManagerUnsubs.push(this.documentManager.provides().onDocumentOpened((t18) => {
|
|
6220
6299
|
this.isOwnedChapter(t18.id) && (this.passwordAttempts.delete(t18.id), this.updateStatus(t18.id, "loaded"));
|
|
6221
6300
|
}), this.documentManager.provides().onDocumentClosed((t18) => {
|
|
6222
6301
|
this.isOwnedChapter(t18) && this.updateStatus(t18, "closed");
|
|
@@ -6251,7 +6330,7 @@ const ft2 = class s6 extends BasePlugin {
|
|
|
6251
6330
|
const a3 = new Set(this.chapterStatus.keys()), i = new Set(t17.chapters.map((t18) => t18.chapterId));
|
|
6252
6331
|
for (const s9 of a3) i.has(s9) || (this.closeChapter(s9), this.chapterStatus.delete(s9));
|
|
6253
6332
|
for (const s9 of t17.chapters) this.chapterStatus.has(s9.chapterId) || this.chapterStatus.set(s9.chapterId, "idle");
|
|
6254
|
-
this.manifest = t17, this.virtualPageMap =
|
|
6333
|
+
this.manifest = t17, this.virtualPageMap = ft(t17, this.overlapStrategy), this.manifestChange$.emit({ manifest: t17, map: this.virtualPageMap }), this.eagerPrefetchFromManifest();
|
|
6255
6334
|
}
|
|
6256
6335
|
eagerPrefetchFromManifest() {
|
|
6257
6336
|
const t17 = this.config.prefetchChapters ?? 0;
|
|
@@ -6375,10 +6454,10 @@ const ft2 = class s6 extends BasePlugin {
|
|
|
6375
6454
|
this.chapterStatus.get(t17) !== e2 && (this.chapterStatus.set(t17, e2), this.statusChange$.emit({ chapterId: t17, status: e2, ..."error" === e2 && a3 ? { error: { message: a3 } } : {} }));
|
|
6376
6455
|
}
|
|
6377
6456
|
};
|
|
6378
|
-
|
|
6379
|
-
let
|
|
6380
|
-
const
|
|
6381
|
-
function
|
|
6457
|
+
mt.id = "chapter-manager";
|
|
6458
|
+
let vt2 = mt;
|
|
6459
|
+
const bt = { kind: "first-wins" };
|
|
6460
|
+
function Pt(t17, e2, a3) {
|
|
6382
6461
|
if (1 === e2.length) return e2[0].chapterId;
|
|
6383
6462
|
switch (a3.kind) {
|
|
6384
6463
|
case "first-wins":
|
|
@@ -6396,7 +6475,7 @@ function bt(t17, e2, a3) {
|
|
|
6396
6475
|
return a3.resolve(t17, e2);
|
|
6397
6476
|
}
|
|
6398
6477
|
}
|
|
6399
|
-
class
|
|
6478
|
+
class wt {
|
|
6400
6479
|
constructor(t17) {
|
|
6401
6480
|
this._pages = t17, this._byChapter = /* @__PURE__ */ new Map(), this._byGlobalNumber = /* @__PURE__ */ new Map();
|
|
6402
6481
|
for (const e2 of t17) {
|
|
@@ -6430,8 +6509,8 @@ class Pt2 {
|
|
|
6430
6509
|
return a3 ? this._pages.indexOf(a3) : -1;
|
|
6431
6510
|
}
|
|
6432
6511
|
}
|
|
6433
|
-
function
|
|
6434
|
-
const a3 = (function(t18, e3 =
|
|
6512
|
+
function yt(t17, e2 = bt) {
|
|
6513
|
+
const a3 = (function(t18, e3 = bt) {
|
|
6435
6514
|
const a4 = /* @__PURE__ */ new Map();
|
|
6436
6515
|
for (const i2 of t18.chapters) {
|
|
6437
6516
|
const [t19, e4] = i2.globalPageRange;
|
|
@@ -6441,7 +6520,7 @@ function wt(t17, e2 = vt) {
|
|
|
6441
6520
|
}
|
|
6442
6521
|
}
|
|
6443
6522
|
const s10 = /* @__PURE__ */ new Map();
|
|
6444
|
-
for (const [i2, o2] of a4) s10.set(i2,
|
|
6523
|
+
for (const [i2, o2] of a4) s10.set(i2, Pt(i2, o2, e3));
|
|
6445
6524
|
return s10;
|
|
6446
6525
|
})(t17, e2), s9 = /* @__PURE__ */ new Map();
|
|
6447
6526
|
for (const n5 of t17.chapters) s9.set(n5.chapterId, n5);
|
|
@@ -6453,14 +6532,14 @@ function wt(t17, e2 = vt) {
|
|
|
6453
6532
|
const [i2] = e3.globalPageRange, [h] = e3.localPageRange, d = h + (n5 - i2);
|
|
6454
6533
|
o.push({ globalPageIndex: r2++, globalPageNumber: n5, chapterId: t18, localPageIndex: d });
|
|
6455
6534
|
}
|
|
6456
|
-
return new
|
|
6535
|
+
return new wt(o);
|
|
6457
6536
|
}
|
|
6458
|
-
const
|
|
6537
|
+
const It2 = class s7 extends BasePlugin {
|
|
6459
6538
|
constructor(t17, s9) {
|
|
6460
|
-
super(t17, s9), this.statusChange$ = createBehaviorEmitter(), this.manifestChange$ = createEmitter(), this.overlapStrategy =
|
|
6539
|
+
super(t17, s9), this.statusChange$ = createBehaviorEmitter(), this.manifestChange$ = createEmitter(), this.overlapStrategy = bt, 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);
|
|
6461
6540
|
}
|
|
6462
6541
|
async initialize(t17) {
|
|
6463
|
-
if (this.config = t17, this.passwordProvider = t17.passwordProvider, this.overlapStrategy = t17.overlapStrategy ??
|
|
6542
|
+
if (this.config = t17, this.passwordProvider = t17.passwordProvider, this.overlapStrategy = t17.overlapStrategy ?? bt, this.setManifestInternal(t17.manifest), this.documentManagerUnsubs.push(this.documentManager.provides().onDocumentOpened((t18) => {
|
|
6464
6543
|
this.isOwnedChapter(t18.id) && (this.passwordAttempts.delete(t18.id), this.updateStatus(t18.id, "loaded"));
|
|
6465
6544
|
}), this.documentManager.provides().onDocumentClosed((t18) => {
|
|
6466
6545
|
this.isOwnedChapter(t18) && this.updateStatus(t18, "closed");
|
|
@@ -6495,7 +6574,7 @@ const yt = class s7 extends BasePlugin {
|
|
|
6495
6574
|
const a3 = new Set(this.chapterStatus.keys()), i = new Set(t17.chapters.map((t18) => t18.chapterId));
|
|
6496
6575
|
for (const s9 of a3) i.has(s9) || (this.closeChapter(s9), this.chapterStatus.delete(s9));
|
|
6497
6576
|
for (const s9 of t17.chapters) this.chapterStatus.has(s9.chapterId) || this.chapterStatus.set(s9.chapterId, "idle");
|
|
6498
|
-
this.manifest = t17, this.virtualPageMap =
|
|
6577
|
+
this.manifest = t17, this.virtualPageMap = yt(t17, this.overlapStrategy), this.manifestChange$.emit({ manifest: t17, map: this.virtualPageMap }), this.eagerPrefetchFromManifest();
|
|
6499
6578
|
}
|
|
6500
6579
|
eagerPrefetchFromManifest() {
|
|
6501
6580
|
const t17 = this.config.prefetchChapters ?? 0;
|
|
@@ -6619,11 +6698,11 @@ const yt = class s7 extends BasePlugin {
|
|
|
6619
6698
|
this.chapterStatus.get(t17) !== e2 && (this.chapterStatus.set(t17, e2), this.statusChange$.emit({ chapterId: t17, status: e2, ..."error" === e2 && a3 ? { error: { message: a3 } } : {} }));
|
|
6620
6699
|
}
|
|
6621
6700
|
};
|
|
6622
|
-
|
|
6623
|
-
let
|
|
6624
|
-
const
|
|
6701
|
+
It2.id = "chapter-manager";
|
|
6702
|
+
let Ct = It2;
|
|
6703
|
+
const Mt = class extends BasePlugin {
|
|
6625
6704
|
constructor(t17, a3) {
|
|
6626
|
-
super(t17, a3), this.layoutChange$ = createBehaviorEmitter(), 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(
|
|
6705
|
+
super(t17, a3), this.layoutChange$ = createBehaviorEmitter(), 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(Ct.id), this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
|
|
6627
6706
|
}
|
|
6628
6707
|
async initialize(t17) {
|
|
6629
6708
|
this.config = { placeholderPageHeight: t17.placeholderPageHeight ?? 1200, placeholderPageWidth: t17.placeholderPageWidth ?? 900, bufferSize: t17.bufferSize ?? 2, pageGap: t17.pageGap ?? 20 }, this.virtualPageMap = this.chapterManager.provides().getVirtualPageMap(), this.rebuildOffsets(), this.chapterManagerUnsubs.push(this.chapterManager.provides().onManifestChange(({ map: t18 }) => {
|
|
@@ -6792,13 +6871,13 @@ const Ct = class extends BasePlugin {
|
|
|
6792
6871
|
a3 && this.scrollToIndex(a3.globalPageIndex, e2);
|
|
6793
6872
|
}
|
|
6794
6873
|
};
|
|
6795
|
-
|
|
6796
|
-
let
|
|
6797
|
-
function
|
|
6874
|
+
Mt.id = "chapter-scroll";
|
|
6875
|
+
let St = Mt;
|
|
6876
|
+
function xt(t17) {
|
|
6798
6877
|
const e2 = t17[t17.length - 1];
|
|
6799
6878
|
return { x: e2.origin.x + e2.size.width, y: e2.origin.y + e2.size.height };
|
|
6800
6879
|
}
|
|
6801
|
-
function
|
|
6880
|
+
function Lt(t17, e2) {
|
|
6802
6881
|
const a3 = t17.origin.y, s9 = t17.origin.y + t17.size.height, i = e2.origin.y, o = e2.origin.y + e2.size.height, r2 = Math.max(s9, o) - Math.min(a3, i);
|
|
6803
6882
|
if (r2 <= 0) return 0;
|
|
6804
6883
|
return Math.max(0, Math.min(s9, o) - Math.max(a3, i)) / r2;
|
|
@@ -6806,16 +6885,16 @@ function xt(t17, e2) {
|
|
|
6806
6885
|
function $t(t17, e2) {
|
|
6807
6886
|
var a3, s9;
|
|
6808
6887
|
if (t17.chapterId !== e2.chapterId || t17.localPageIndex !== e2.localPageIndex) return false;
|
|
6809
|
-
const i = (null == (a3 = t17.rectsPdfCoord) ? void 0 : a3.length) ? t17.rectsPdfCoord : [t17.rectPdfCoord], o = (null == (s9 = e2.rectsPdfCoord) ? void 0 : s9.length) ? e2.rectsPdfCoord : [e2.rectPdfCoord], r2 = t17.markerAnchor ??
|
|
6888
|
+
const i = (null == (a3 = t17.rectsPdfCoord) ? void 0 : a3.length) ? t17.rectsPdfCoord : [t17.rectPdfCoord], o = (null == (s9 = e2.rectsPdfCoord) ? void 0 : s9.length) ? e2.rectsPdfCoord : [e2.rectPdfCoord], r2 = t17.markerAnchor ?? xt(i), n5 = e2.markerAnchor ?? xt(o);
|
|
6810
6889
|
if (Math.hypot(r2.x - n5.x, r2.y - n5.y) <= 6) return true;
|
|
6811
6890
|
for (const h of i) for (const t18 of o) {
|
|
6812
|
-
if (
|
|
6891
|
+
if (Lt(h, t18) < 0.5) continue;
|
|
6813
6892
|
const e3 = Math.max(h.origin.x, t18.origin.x);
|
|
6814
6893
|
if (Math.min(h.origin.x + h.size.width, t18.origin.x + t18.size.width) - e3 > 0.25 * Math.min(h.size.width, t18.size.width)) return true;
|
|
6815
6894
|
}
|
|
6816
6895
|
return false;
|
|
6817
6896
|
}
|
|
6818
|
-
async function
|
|
6897
|
+
async function Dt(t17, e2, a3) {
|
|
6819
6898
|
t17.scrollToGlobalPageIndex(e2), await (function(t18, e3, a4 = 2500) {
|
|
6820
6899
|
const s9 = t18.getLayout().items.find((t19) => t19.globalPageIndex === e3 && !t19.isPlaceholder);
|
|
6821
6900
|
return s9 ? Promise.resolve(s9) : new Promise((s10) => {
|
|
@@ -6828,9 +6907,9 @@ async function Lt(t17, e2, a3) {
|
|
|
6828
6907
|
});
|
|
6829
6908
|
})(t17, e2), t17.scrollToGlobalPdfPoint(e2, a3, { marginTop: 80 });
|
|
6830
6909
|
}
|
|
6831
|
-
const
|
|
6910
|
+
const Tt = class a extends BasePlugin {
|
|
6832
6911
|
constructor(t17, a3) {
|
|
6833
|
-
super(t17, a3), this.change$ = createBehaviorEmitter([]), this.entries = /* @__PURE__ */ new Map(), this.chapterScroll = this.registry.getPlugin(
|
|
6912
|
+
super(t17, a3), this.change$ = createBehaviorEmitter([]), this.entries = /* @__PURE__ */ new Map(), this.chapterScroll = this.registry.getPlugin(St.id), this.chapterManager = this.registry.getPlugin(vt2.id), this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
|
|
6834
6913
|
}
|
|
6835
6914
|
async initialize(t17) {
|
|
6836
6915
|
var e2;
|
|
@@ -6894,13 +6973,13 @@ const Dt = class a extends BasePlugin {
|
|
|
6894
6973
|
const e3 = t18.rectPdfCoord;
|
|
6895
6974
|
return e3.origin.y + e3.size.height;
|
|
6896
6975
|
})(e2.anchor);
|
|
6897
|
-
await
|
|
6976
|
+
await Dt(a3, s9, i);
|
|
6898
6977
|
}
|
|
6899
6978
|
};
|
|
6900
|
-
|
|
6901
|
-
let
|
|
6902
|
-
const kt2 = { manifest: lt2, create: (t17) => new Tt(dt, t17), reducer: (t17) => t17, initialState: {} }, zt = { "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 }] } };
|
|
6903
|
-
class
|
|
6979
|
+
Tt.id = "paragraph-bookmark";
|
|
6980
|
+
let kt = Tt;
|
|
6981
|
+
const Gt = { manifest: ct2, create: (t17) => new kt(lt, t17), reducer: (t17) => t17, initialState: {} }, zt2 = { "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 }] } };
|
|
6982
|
+
class Ot {
|
|
6904
6983
|
constructor() {
|
|
6905
6984
|
this.specs = [];
|
|
6906
6985
|
}
|
|
@@ -6915,17 +6994,17 @@ class Gt {
|
|
|
6915
6994
|
return this.specs;
|
|
6916
6995
|
}
|
|
6917
6996
|
buildToolbars() {
|
|
6918
|
-
const t17 = structuredClone(
|
|
6997
|
+
const t17 = structuredClone(zt2);
|
|
6919
6998
|
for (const e2 of this.specs) {
|
|
6920
6999
|
const a3 = t17[e2.toolbarSlot];
|
|
6921
7000
|
if (!a3) continue;
|
|
6922
7001
|
const s9 = { type: "command-button", id: e2.id, commandId: e2.commandId, variant: "icon", ...e2.icon ? { icon: e2.icon } : {}, ...e2.i18nKey ? { labelKey: e2.i18nKey } : {}, ...e2.label ? { label: e2.label } : {}, categories: e2.categories ?? [] };
|
|
6923
|
-
a3.items =
|
|
7002
|
+
a3.items = At(a3.items, s9, e2.position);
|
|
6924
7003
|
}
|
|
6925
7004
|
return t17;
|
|
6926
7005
|
}
|
|
6927
7006
|
}
|
|
6928
|
-
function
|
|
7007
|
+
function At(t17, e2, a3) {
|
|
6929
7008
|
return (null == a3 ? void 0 : a3.after) || (null == a3 ? void 0 : a3.before) ? (function(t18, e3, a4) {
|
|
6930
7009
|
const s9 = (t19) => {
|
|
6931
7010
|
const i = [];
|
|
@@ -6937,8 +7016,8 @@ function Ot2(t17, e2, a3) {
|
|
|
6937
7016
|
return t18.map((t19) => "group" === t19.type ? { ...t19, items: [...t19.items, e3] } : t19);
|
|
6938
7017
|
})(t17, e2);
|
|
6939
7018
|
}
|
|
6940
|
-
const
|
|
6941
|
-
function
|
|
7019
|
+
const Nt2 = { annotate: "annotation-toolbar", shapes: "shapes-toolbar", insert: "insert-toolbar", form: "form-toolbar", redact: "redaction-toolbar" };
|
|
7020
|
+
function Vt() {
|
|
6942
7021
|
return { "mode:view": { id: "mode:view", label: "View", categories: ["mode", "mode-view"], action: ({ registry: t17, documentId: e2 }) => {
|
|
6943
7022
|
var _a2, _b, _c, _d;
|
|
6944
7023
|
const a3 = (_a2 = t17.getPlugin("ui")) == null ? void 0 : _a2.provides(), s9 = (_b = t17.getPlugin("interaction-manager")) == null ? void 0 : _b.provides();
|
|
@@ -6965,16 +7044,16 @@ function Nt() {
|
|
|
6965
7044
|
a3 && (a3.setActiveToolbar("top", "secondary", "redaction-toolbar", e2), (_b = t17.getPlugin(ANNOTATION_PLUGIN_ID)) == null ? void 0 : _b.provides().forDocument(e2).setLocked({ type: LockModeType.Include, categories: ["form"] }));
|
|
6966
7045
|
}, active: ({ state: t17, documentId: e2 }) => isToolbarOpen(t17.plugins, e2, "top", "secondary", "redaction-toolbar") } };
|
|
6967
7046
|
}
|
|
6968
|
-
function
|
|
7047
|
+
function Rt(t17) {
|
|
6969
7048
|
var _a2, _b, _c, _d, _e2, _f;
|
|
6970
7049
|
const e2 = t17.toolbar ?? {}, a3 = e2.enabledModes ?? ["view", "annotate", "shapes", "insert", "form", "redact"], i = a3.length > 0, { schema: l2, operationRegistry: c } = (function(t18 = {}) {
|
|
6971
7050
|
var e3, a4, s9, i2, o, r2;
|
|
6972
|
-
const n5 = new Set(t18.enabledModes ?? ["view", "annotate", "shapes", "insert", "form", "redact"]), h = new
|
|
7051
|
+
const n5 = new Set(t18.enabledModes ?? ["view", "annotate", "shapes", "insert", "form", "redact"]), h = new Ot();
|
|
6973
7052
|
(null == (e3 = t18.customOperations) ? void 0 : e3.length) && h.registerAll(t18.customOperations);
|
|
6974
7053
|
const d = h.buildToolbars(), l3 = {};
|
|
6975
7054
|
for (const u of n5) {
|
|
6976
7055
|
if ("view" === u) continue;
|
|
6977
|
-
const t19 =
|
|
7056
|
+
const t19 = Nt2[u];
|
|
6978
7057
|
d[t19] && (l3[t19] = d[t19]);
|
|
6979
7058
|
}
|
|
6980
7059
|
const c2 = (function(t19) {
|
|
@@ -6983,10 +7062,10 @@ function Vt(t17) {
|
|
|
6983
7062
|
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: [...t19.has("view") ? [e4("view", "View", "mode:view")] : [], ...t19.has("annotate") ? [e4("annotate", "Annotate", "mode:annotate")] : [], ...t19.has("shapes") ? [e4("shapes", "Shapes", "mode:shapes")] : [], ...t19.has("insert") ? [e4("insert", "Insert", "mode:insert")] : [], ...t19.has("form") ? [e4("form", "Form", "mode:form")] : [], ...t19.has("redact") ? [e4("redact", "Redact", "mode:redact")] : []] }, { type: "spacer", id: "main-spacer-right", flex: true }] };
|
|
6984
7063
|
})(n5);
|
|
6985
7064
|
return c2 && (l3["chapter-editor-main-toolbar"] = c2), (null == (a4 = t18.extend) ? void 0 : a4.toolbars) && Object.assign(l3, t18.extend.toolbars), { schema: { id: "chapter-pdf-editor-ui", version: "1.0.0", toolbars: l3, menus: (null == (s9 = t18.extend) ? void 0 : s9.menus) ?? {}, sidebars: (null == (i2 = t18.extend) ? void 0 : i2.sidebars) ?? {}, modals: (null == (o = t18.extend) ? void 0 : o.modals) ?? {}, selectionMenus: (null == (r2 = t18.extend) ? void 0 : r2.selectionMenus) ?? {} }, operationRegistry: h };
|
|
6986
|
-
})({ ...e2, enabledModes: a3 }), w = { ...i ?
|
|
6987
|
-
return t17.notes && I.push(createPluginRegistration(
|
|
7065
|
+
})({ ...e2, enabledModes: a3 }), w = { ...i ? Vt() : {}, ...i ? _t(c.list()) : {}, ...t17.commands ?? {} }, I = [createPluginRegistration(DocumentManagerPluginPackage, { initialDocuments: [] }), createPluginRegistration(G, { manifest: t17.manifest, overlapStrategy: t17.overlapStrategy, passwordProvider: t17.passwordProvider, chapterPdfLoader: t17.chapterPdfLoader, prefetchChapters: t17.prefetchChapters, unloadTimeoutMs: t17.unloadTimeoutMs }), createPluginRegistration(q, { placeholderPageHeight: t17.placeholderPageHeight, placeholderPageWidth: t17.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 === t17.loadDefaultStampLibrary ? { manifests: [] } : void 0), createPluginRegistration(SignaturePluginPackage), ...Object.keys(w).length > 0 ? [createPluginRegistration(CommandsPluginPackage, { commands: w })] : [], ...i ? [createPluginRegistration(I18nPluginPackage), createPluginRegistration(UIPluginPackage, { schema: l2 })] : []];
|
|
7066
|
+
return t17.notes && I.push(createPluginRegistration(dt, { callbacks: t17.notes.callbacks, ui: (_b = (_a2 = t17.features) == null ? void 0 : _a2.notes) == null ? void 0 : _b.marker })), t17.bookmarks && I.push(createPluginRegistration(Gt, { callbacks: t17.bookmarks.callbacks, ui: (_d = (_c = t17.features) == null ? void 0 : _c.bookmarks) == null ? void 0 : _d.marker, hover: (_f = (_e2 = t17.features) == null ? void 0 : _e2.bookmarks) == null ? void 0 : _f.hover })), { plugins: I, uiSchema: l2, operationRegistry: c };
|
|
6988
7067
|
}
|
|
6989
|
-
function
|
|
7068
|
+
function _t(t17) {
|
|
6990
7069
|
const e2 = {};
|
|
6991
7070
|
for (const a3 of t17) a3.handler && (e2[a3.commandId] = { id: a3.commandId, labelKey: a3.i18nKey, label: a3.label, icon: a3.icon, categories: a3.categories, action: ({ documentId: t18 }) => {
|
|
6992
7071
|
var _a2;
|
|
@@ -6994,21 +7073,42 @@ function Rt2(t17) {
|
|
|
6994
7073
|
} });
|
|
6995
7074
|
return e2;
|
|
6996
7075
|
}
|
|
6997
|
-
|
|
6998
|
-
|
|
6999
|
-
|
|
7000
|
-
|
|
7076
|
+
function Ut2(t17, e2) {
|
|
7077
|
+
const a3 = t17;
|
|
7078
|
+
return false === t17 ? { ...e2, enabled: false } : true === t17 || void 0 === t17 ? { ...e2, enabled: e2.enabled ?? true } : { ...e2, ...a3, enabled: false !== (null == a3 ? void 0 : a3.enabled) };
|
|
7079
|
+
}
|
|
7080
|
+
function Et(t17) {
|
|
7081
|
+
const e2 = Ut2(null == t17 ? void 0 : t17.markup, { enabled: true }), a3 = Ut2(null == t17 ? void 0 : t17.bookmarks, { enabled: true }), s9 = Ut2(null == t17 ? void 0 : t17.notes, { enabled: true });
|
|
7082
|
+
return { markup: e2, bookmarks: a3, notes: s9, zoom: Ut2(null == t17 ? void 0 : t17.zoom, { enabled: true, min: 0.5, max: 3, initial: 1 }), selectionToolbar: Ut2(void 0 === (null == t17 ? void 0 : t17.selectionToolbar) ? false !== e2.enabled || false !== s9.enabled : t17.selectionToolbar, { enabled: true }) };
|
|
7001
7083
|
}
|
|
7002
|
-
|
|
7084
|
+
PdfAnnotationSubtype.HIGHLIGHT, PdfAnnotationSubtype.UNDERLINE, PdfAnnotationSubtype.SQUIGGLY, PdfAnnotationSubtype.STRIKEOUT;
|
|
7085
|
+
const Ft = Et(), qt = {};
|
|
7086
|
+
function Ht(t17) {
|
|
7087
|
+
return Rt({ ...t17, toolbar: t17.toolbar ?? { enabledModes: [] }, features: Et(t17.features) });
|
|
7088
|
+
}
|
|
7089
|
+
const Wt = { overlapStrategy: { kind: "first-wins" }, passwordProvider: new class {
|
|
7003
7090
|
constructor(t17) {
|
|
7004
7091
|
this.cb = t17;
|
|
7005
7092
|
}
|
|
7006
7093
|
resolvePassword(t17, e2) {
|
|
7007
7094
|
return this.cb(t17, e2);
|
|
7008
7095
|
}
|
|
7096
|
+
}(async () => null), prefetchChapters: 1, loadDefaultStampLibrary: false, unloadTimeoutMs: 12e4, toolbar: { enabledModes: [] } };
|
|
7097
|
+
function Bt(t17) {
|
|
7098
|
+
return (function(t18) {
|
|
7099
|
+
return "callbacks" in t18.notes;
|
|
7100
|
+
})(t17) ? { manifest: t17.manifest, chapterPdfLoader: t17.chapterPdfLoader, notes: t17.notes.callbacks, bookmarks: t17.bookmarks.callbacks } : t17;
|
|
7009
7101
|
}
|
|
7010
|
-
function
|
|
7011
|
-
return { manifest: t17.manifest, chapterPdfLoader: t17.chapterPdfLoader,
|
|
7102
|
+
function jt(t17) {
|
|
7103
|
+
return { manifest: t17.manifest, chapterPdfLoader: t17.chapterPdfLoader, ...Wt, notes: { callbacks: t17.notes }, bookmarks: { callbacks: t17.bookmarks }, features: Et(t17.features) };
|
|
7104
|
+
}
|
|
7105
|
+
function Kt(t17) {
|
|
7106
|
+
const e2 = jt(Bt(t17)), { plugins: a3 } = Ht(e2);
|
|
7107
|
+
return { plugins: a3, features: e2.features, editorOptions: e2 };
|
|
7108
|
+
}
|
|
7109
|
+
function Qt(t17) {
|
|
7110
|
+
const { features: e2, ...a3 } = jt(Bt(t17));
|
|
7111
|
+
return a3;
|
|
7012
7112
|
}
|
|
7013
7113
|
const DEFAULT_STYLES = {
|
|
7014
7114
|
highlight: { offsetY: 0 },
|
|
@@ -7089,6 +7189,36 @@ function applySelectionMarkup(documentId, kind, annotation, selection, styles) {
|
|
|
7089
7189
|
selectionScope.clear();
|
|
7090
7190
|
return true;
|
|
7091
7191
|
}
|
|
7192
|
+
function featureOn(value, defaults) {
|
|
7193
|
+
const partial = value;
|
|
7194
|
+
if (value === false) return { ...defaults, enabled: false };
|
|
7195
|
+
if (value === true || value === void 0) {
|
|
7196
|
+
return { ...defaults, enabled: defaults.enabled ?? true };
|
|
7197
|
+
}
|
|
7198
|
+
return { ...defaults, ...partial, enabled: (partial == null ? void 0 : partial.enabled) !== false };
|
|
7199
|
+
}
|
|
7200
|
+
function normalizeChapterViewerConfig(config) {
|
|
7201
|
+
const markup = featureOn(config == null ? void 0 : config.markup, { enabled: true });
|
|
7202
|
+
const bookmarks = featureOn(config == null ? void 0 : config.bookmarks, { enabled: true });
|
|
7203
|
+
const notes = featureOn(config == null ? void 0 : config.notes, { enabled: true });
|
|
7204
|
+
const zoom = featureOn(config == null ? void 0 : config.zoom, {
|
|
7205
|
+
enabled: true,
|
|
7206
|
+
min: 0.5,
|
|
7207
|
+
max: 3,
|
|
7208
|
+
initial: 1
|
|
7209
|
+
});
|
|
7210
|
+
const selectionToolbarDefault = (config == null ? void 0 : config.selectionToolbar) === void 0 ? markup.enabled !== false || notes.enabled !== false : config.selectionToolbar;
|
|
7211
|
+
const selectionToolbar = featureOn(selectionToolbarDefault, {
|
|
7212
|
+
enabled: true
|
|
7213
|
+
});
|
|
7214
|
+
return {
|
|
7215
|
+
markup,
|
|
7216
|
+
bookmarks,
|
|
7217
|
+
notes,
|
|
7218
|
+
zoom,
|
|
7219
|
+
selectionToolbar
|
|
7220
|
+
};
|
|
7221
|
+
}
|
|
7092
7222
|
function e$1$1(e2) {
|
|
7093
7223
|
const t22 = [], s22 = /* @__PURE__ */ new Set();
|
|
7094
7224
|
for (const a22 of e2.chapters) {
|
|
@@ -9801,17 +9931,20 @@ const itemBtnStyle = {
|
|
|
9801
9931
|
export {
|
|
9802
9932
|
l as CallbackPasswordProvider,
|
|
9803
9933
|
ChapterManagerPlugin$1 as ChapterManagerPlugin,
|
|
9804
|
-
|
|
9934
|
+
Ja as ChapterPdfViewer,
|
|
9805
9935
|
ChapterScrollPlugin,
|
|
9806
9936
|
ChapterTreePanel,
|
|
9807
|
-
|
|
9937
|
+
qt as DEFAULT_CHAPTER_VIEWER_CONFIG,
|
|
9938
|
+
Ft as DEFAULT_CHAPTER_VIEWER_FEATURES,
|
|
9808
9939
|
EmbedPDF2 as EmbedPDF,
|
|
9809
|
-
|
|
9940
|
+
$a as PdfChapterViewport,
|
|
9810
9941
|
applySelectionMarkup,
|
|
9811
9942
|
buildParagraphBookmarkAnchor,
|
|
9812
|
-
|
|
9813
|
-
|
|
9814
|
-
|
|
9943
|
+
Kt as createChapterViewerBundle,
|
|
9944
|
+
Ht as createChapterViewerEditor,
|
|
9945
|
+
Qt as createChapterViewerEditorOptions,
|
|
9946
|
+
Rt as createPdfChapterEditor,
|
|
9947
|
+
normalizeChapterViewerConfig,
|
|
9815
9948
|
useCapability2 as useCapability,
|
|
9816
9949
|
usePdfiumEngine
|
|
9817
9950
|
};
|