@embedpdf-editor/react-chapter-viewer 0.1.0 → 0.2.1
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 +351 -46
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +584 -557
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useMemo, useState, useRef, useEffect, useCallback } from "react";
|
|
3
|
-
import { useCapability, EmbedPDF, useRegistry } from "@embedpdf/core/react";
|
|
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";
|
|
6
6
|
import { Rotate } from "@embedpdf/plugin-rotate/react";
|
|
@@ -8,9 +8,9 @@ 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 { DocumentManagerPlugin, DocumentManagerPluginPackage } from "@embedpdf/plugin-document-manager";
|
|
12
11
|
import { BasePlugin, createBehaviorEmitter, createEmitter, createPluginRegistration } from "@embedpdf/core";
|
|
13
12
|
import { PdfAnnotationSubtype, PdfErrorCode, uuidV4, PdfBlendMode } from "@embedpdf/models";
|
|
13
|
+
import { DocumentManagerPlugin, DocumentManagerPluginPackage } from "@embedpdf/plugin-document-manager";
|
|
14
14
|
import { RenderLayer } from "@embedpdf/plugin-render/react";
|
|
15
15
|
import "@embedpdf/plugin-tiling/react";
|
|
16
16
|
import { AnnotationPlugin, LockModeType, AnnotationPluginPackage, ANNOTATION_PLUGIN_ID } from "@embedpdf/plugin-annotation";
|
|
@@ -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 K$1 = { kind: "first-wins" };
|
|
30
|
+
function Z$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 K$1(t17, e2, a3) {
|
|
|
45
45
|
return a3.resolve(t17, e2);
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
|
-
let
|
|
48
|
+
let Q$1 = class Q {
|
|
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 Z$1 = class Z {
|
|
|
79
79
|
return a3 ? this._pages.indexOf(a3) : -1;
|
|
80
80
|
}
|
|
81
81
|
};
|
|
82
|
-
function
|
|
83
|
-
const a3 = (function(t18, e3 =
|
|
82
|
+
function J$1(t17, e2 = K$1) {
|
|
83
|
+
const a3 = (function(t18, e3 = K$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 Q$1(t17, e2 = X$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, Z$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 Q$1(t17, e2 = X$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 Q$1(r2);
|
|
106
106
|
}
|
|
107
|
-
const
|
|
107
|
+
const tt$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 = K$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 ?? K$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 J$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 = J$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 J$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
|
+
tt$1.id = "chapter-manager";
|
|
272
|
+
let et$1 = tt$1;
|
|
273
|
+
const at$1 = class at 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(et$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 }) => {
|
|
@@ -280,8 +280,7 @@ const et$1 = class et extends BasePlugin {
|
|
|
280
280
|
})), this.syncReadyChapterSizes();
|
|
281
281
|
}
|
|
282
282
|
isChapterDocumentReady(t17) {
|
|
283
|
-
|
|
284
|
-
const e2 = this.documentManager.provides().getDocumentState(t17);
|
|
283
|
+
const e2 = this.coreState.core.documents[t17];
|
|
285
284
|
return !(!e2 || "loaded" !== e2.status || !e2.document) && e2.document.pages.length > 0;
|
|
286
285
|
}
|
|
287
286
|
refreshLayout() {
|
|
@@ -292,12 +291,14 @@ const et$1 = class et extends BasePlugin {
|
|
|
292
291
|
this.refreshLayout();
|
|
293
292
|
}
|
|
294
293
|
onDocumentLoaded(t17) {
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
294
|
+
var e2;
|
|
295
|
+
if (0 === ((null == (e2 = this.virtualPageMap) ? void 0 : e2.pagesOfChapter(t17).length) ?? 0)) return;
|
|
296
|
+
const a3 = this.documentManager.provides();
|
|
297
|
+
a3.getActiveDocumentId() || a3.setActiveDocument(t17), this.harvestChapterSizes(t17), this.refreshLayout();
|
|
298
298
|
}
|
|
299
299
|
onDocumentClosed(t17) {
|
|
300
|
-
|
|
300
|
+
var e2;
|
|
301
|
+
0 !== ((null == (e2 = this.virtualPageMap) ? void 0 : e2.pagesOfChapter(t17).length) ?? 0) && (this.dropChapterSizes(t17), this.refreshLayout());
|
|
301
302
|
}
|
|
302
303
|
buildCapability() {
|
|
303
304
|
return { registerViewport: (t17) => this.bindViewport(t17), reportChapterPageSizes: (t17, e2) => this.applyChapterPageSizes(t17, e2), getLayout: () => this.computeLayout(), getCurrentGlobalPageIndex: () => this.currentGlobalPageIndex, getVisibleGlobalPageIndices: () => this.currentVisible.slice(), scrollToGlobalPageIndex: (t17, e2) => this.scrollToIndex(t17, e2), scrollToChapter: (t17, e2) => this.scrollToChapter(t17, e2), scrollToGlobalPageNumber: (t17, e2) => this.scrollToGlobalNumber(t17, e2), scrollToGlobalPdfPoint: (t17, e2, a3) => this.scrollToGlobalPdfPoint(t17, e2, a3), onLayoutChange: this.layoutChange$.on, onVisibleChange: this.visibleChange$.on };
|
|
@@ -440,27 +441,47 @@ const et$1 = class et extends BasePlugin {
|
|
|
440
441
|
a3 && this.scrollToIndex(a3.globalPageIndex, e2);
|
|
441
442
|
}
|
|
442
443
|
};
|
|
443
|
-
|
|
444
|
-
let
|
|
445
|
-
function
|
|
446
|
-
const
|
|
444
|
+
at$1.id = "chapter-scroll";
|
|
445
|
+
let st$1 = at$1;
|
|
446
|
+
function it$1({ item: e2, renderPage: a3, renderPlaceholder: s9 }) {
|
|
447
|
+
const n5 = (function(t17, e3) {
|
|
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
|
+
return useEffect(() => {
|
|
450
|
+
h(s10);
|
|
451
|
+
}, [s10]), useEffect(() => {
|
|
452
|
+
if (s10) return;
|
|
453
|
+
if (!a4 || "loaded" !== a4.status || !a4.document) return;
|
|
454
|
+
let t18 = false, i = 0;
|
|
455
|
+
const r2 = () => {
|
|
456
|
+
var s11;
|
|
457
|
+
t18 || ((null == (s11 = a4.document) ? void 0 : s11.pages[e3]) ? h(true) : ++i < 120 && requestAnimationFrame(r2));
|
|
458
|
+
};
|
|
459
|
+
return requestAnimationFrame(r2), () => {
|
|
460
|
+
t18 = true;
|
|
461
|
+
};
|
|
462
|
+
}, [a4, e3, s10]), n6;
|
|
463
|
+
})(e2.chapterId, e2.localPageIndex);
|
|
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
|
+
}
|
|
466
|
+
function rt$1({ renderPage: e2, renderPlaceholder: a3, className: o, style: n5, ...l2 }) {
|
|
467
|
+
const { provides: d } = useCapability(st$1.id), { provides: c } = useCapability(DocumentManagerPlugin.id), u = useRef(null), [p, g] = useState(null);
|
|
447
468
|
useEffect(() => {
|
|
448
469
|
if (!d) return;
|
|
449
|
-
const t17 =
|
|
470
|
+
const t17 = u.current;
|
|
450
471
|
d.registerViewport(t17);
|
|
451
|
-
const e3 = d.onLayoutChange((
|
|
472
|
+
const e3 = (t18) => g(t18), a4 = d.onLayoutChange(e3), s9 = null == c ? void 0 : c.onDocumentOpened(() => e3(d.getLayout())), i = null == c ? void 0 : c.onDocumentClosed(() => e3(d.getLayout()));
|
|
452
473
|
return () => {
|
|
453
|
-
|
|
474
|
+
a4(), null == s9 || s9(), null == i || i(), d.registerViewport(null);
|
|
454
475
|
};
|
|
455
|
-
}, [d]);
|
|
456
|
-
const
|
|
457
|
-
return jsx("div", { ...l2, ref:
|
|
476
|
+
}, [d, c]);
|
|
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(it$1, { item: s9, renderPage: e2, renderPlaceholder: a3 }, s9.globalPageIndex)) }) });
|
|
458
479
|
}
|
|
459
|
-
function
|
|
480
|
+
function ot$1({ chapterId: e2, localPageIndex: a3, scale: s9, dpr: i, className: r2 }) {
|
|
460
481
|
return jsx(RenderLayer, { documentId: e2, pageIndex: a3, scale: s9, dpr: i, className: r2, style: { pointerEvents: "none" } });
|
|
461
482
|
}
|
|
462
|
-
const
|
|
463
|
-
function
|
|
483
|
+
const nt$1 = { kind: "first-wins" };
|
|
484
|
+
function ht$1(t17, e2, a3) {
|
|
464
485
|
if (1 === e2.length) return e2[0].chapterId;
|
|
465
486
|
switch (a3.kind) {
|
|
466
487
|
case "first-wins":
|
|
@@ -478,7 +499,7 @@ function ot$1(t17, e2, a3) {
|
|
|
478
499
|
return a3.resolve(t17, e2);
|
|
479
500
|
}
|
|
480
501
|
}
|
|
481
|
-
let
|
|
502
|
+
let lt$1 = class lt {
|
|
482
503
|
constructor(t17) {
|
|
483
504
|
this._pages = t17, this._byChapter = /* @__PURE__ */ new Map(), this._byGlobalNumber = /* @__PURE__ */ new Map();
|
|
484
505
|
for (const e2 of t17) {
|
|
@@ -512,8 +533,8 @@ let nt$1 = class nt {
|
|
|
512
533
|
return a3 ? this._pages.indexOf(a3) : -1;
|
|
513
534
|
}
|
|
514
535
|
};
|
|
515
|
-
function
|
|
516
|
-
const a3 = (function(t18, e3 =
|
|
536
|
+
function dt$1(t17, e2 = nt$1) {
|
|
537
|
+
const a3 = (function(t18, e3 = nt$1) {
|
|
517
538
|
const a4 = /* @__PURE__ */ new Map();
|
|
518
539
|
for (const i2 of t18.chapters) {
|
|
519
540
|
const [t19, e4] = i2.globalPageRange;
|
|
@@ -523,7 +544,7 @@ function ht$1(t17, e2 = rt$1) {
|
|
|
523
544
|
}
|
|
524
545
|
}
|
|
525
546
|
const s10 = /* @__PURE__ */ new Map();
|
|
526
|
-
for (const [i2, r3] of a4) s10.set(i2,
|
|
547
|
+
for (const [i2, r3] of a4) s10.set(i2, ht$1(i2, r3, e3));
|
|
527
548
|
return s10;
|
|
528
549
|
})(t17, e2), s9 = /* @__PURE__ */ new Map();
|
|
529
550
|
for (const n5 of t17.chapters) s9.set(n5.chapterId, n5);
|
|
@@ -535,14 +556,14 @@ function ht$1(t17, e2 = rt$1) {
|
|
|
535
556
|
const [i2] = e3.globalPageRange, [h] = e3.localPageRange, l2 = h + (n5 - i2);
|
|
536
557
|
r2.push({ globalPageIndex: o++, globalPageNumber: n5, chapterId: t18, localPageIndex: l2 });
|
|
537
558
|
}
|
|
538
|
-
return new
|
|
559
|
+
return new lt$1(r2);
|
|
539
560
|
}
|
|
540
|
-
const
|
|
561
|
+
const ct$1 = class t2 extends BasePlugin {
|
|
541
562
|
constructor(t17, e2) {
|
|
542
|
-
super(t17, e2), this.statusChange$ = createBehaviorEmitter(), this.manifestChange$ = createEmitter(), this.overlapStrategy =
|
|
563
|
+
super(t17, e2), this.statusChange$ = createBehaviorEmitter(), this.manifestChange$ = createEmitter(), this.overlapStrategy = nt$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);
|
|
543
564
|
}
|
|
544
565
|
async initialize(t17) {
|
|
545
|
-
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 ?? nt$1, this.setManifestInternal(t17.manifest), this.documentManagerUnsubs.push(this.documentManager.provides().onDocumentOpened((t18) => {
|
|
546
567
|
this.isOwnedChapter(t18.id) && (this.passwordAttempts.delete(t18.id), this.updateStatus(t18.id, "loaded"));
|
|
547
568
|
}), this.documentManager.provides().onDocumentClosed((t18) => {
|
|
548
569
|
this.isOwnedChapter(t18) && this.updateStatus(t18, "closed");
|
|
@@ -577,7 +598,7 @@ const lt$1 = class t2 extends BasePlugin {
|
|
|
577
598
|
const s9 = new Set(this.chapterStatus.keys()), i = new Set(e2.chapters.map((t17) => t17.chapterId));
|
|
578
599
|
for (const t17 of s9) i.has(t17) || (this.closeChapter(t17), this.chapterStatus.delete(t17));
|
|
579
600
|
for (const t17 of e2.chapters) this.chapterStatus.has(t17.chapterId) || this.chapterStatus.set(t17.chapterId, "idle");
|
|
580
|
-
this.manifest = e2, this.virtualPageMap =
|
|
601
|
+
this.manifest = e2, this.virtualPageMap = dt$1(e2, this.overlapStrategy), this.manifestChange$.emit({ manifest: e2, map: this.virtualPageMap }), this.eagerPrefetchFromManifest();
|
|
581
602
|
}
|
|
582
603
|
eagerPrefetchFromManifest() {
|
|
583
604
|
const t17 = this.config.prefetchChapters ?? 0;
|
|
@@ -701,10 +722,10 @@ const lt$1 = class t2 extends BasePlugin {
|
|
|
701
722
|
this.chapterStatus.get(t17) !== e2 && (this.chapterStatus.set(t17, e2), this.statusChange$.emit({ chapterId: t17, status: e2, ..."error" === e2 && a3 ? { error: { message: a3 } } : {} }));
|
|
702
723
|
}
|
|
703
724
|
};
|
|
704
|
-
|
|
705
|
-
let
|
|
706
|
-
const
|
|
707
|
-
function
|
|
725
|
+
ct$1.id = "chapter-manager";
|
|
726
|
+
let ut$1 = ct$1;
|
|
727
|
+
const pt$1 = { kind: "first-wins" };
|
|
728
|
+
function gt$1(t17, e2, a3) {
|
|
708
729
|
if (1 === e2.length) return e2[0].chapterId;
|
|
709
730
|
switch (a3.kind) {
|
|
710
731
|
case "first-wins":
|
|
@@ -722,7 +743,7 @@ function ut$1(t17, e2, a3) {
|
|
|
722
743
|
return a3.resolve(t17, e2);
|
|
723
744
|
}
|
|
724
745
|
}
|
|
725
|
-
let
|
|
746
|
+
let ft$1 = class ft {
|
|
726
747
|
constructor(t17) {
|
|
727
748
|
this._pages = t17, this._byChapter = /* @__PURE__ */ new Map(), this._byGlobalNumber = /* @__PURE__ */ new Map();
|
|
728
749
|
for (const e2 of t17) {
|
|
@@ -756,8 +777,8 @@ let pt$1 = class pt {
|
|
|
756
777
|
return a3 ? this._pages.indexOf(a3) : -1;
|
|
757
778
|
}
|
|
758
779
|
};
|
|
759
|
-
function
|
|
760
|
-
const a3 = (function(t18, e3 =
|
|
780
|
+
function mt$1(t17, e2 = pt$1) {
|
|
781
|
+
const a3 = (function(t18, e3 = pt$1) {
|
|
761
782
|
const a4 = /* @__PURE__ */ new Map();
|
|
762
783
|
for (const i2 of t18.chapters) {
|
|
763
784
|
const [t19, e4] = i2.globalPageRange;
|
|
@@ -767,7 +788,7 @@ function gt$1(t17, e2 = ct$1) {
|
|
|
767
788
|
}
|
|
768
789
|
}
|
|
769
790
|
const s10 = /* @__PURE__ */ new Map();
|
|
770
|
-
for (const [i2, r3] of a4) s10.set(i2,
|
|
791
|
+
for (const [i2, r3] of a4) s10.set(i2, gt$1(i2, r3, e3));
|
|
771
792
|
return s10;
|
|
772
793
|
})(t17, e2), s9 = /* @__PURE__ */ new Map();
|
|
773
794
|
for (const n5 of t17.chapters) s9.set(n5.chapterId, n5);
|
|
@@ -779,14 +800,14 @@ function gt$1(t17, e2 = ct$1) {
|
|
|
779
800
|
const [i2] = e3.globalPageRange, [h] = e3.localPageRange, l2 = h + (n5 - i2);
|
|
780
801
|
r2.push({ globalPageIndex: o++, globalPageNumber: n5, chapterId: t18, localPageIndex: l2 });
|
|
781
802
|
}
|
|
782
|
-
return new
|
|
803
|
+
return new ft$1(r2);
|
|
783
804
|
}
|
|
784
|
-
const
|
|
805
|
+
const vt$1 = class t3 extends BasePlugin {
|
|
785
806
|
constructor(t17, e2) {
|
|
786
|
-
super(t17, e2), this.statusChange$ = createBehaviorEmitter(), this.manifestChange$ = createEmitter(), this.overlapStrategy =
|
|
807
|
+
super(t17, e2), this.statusChange$ = createBehaviorEmitter(), this.manifestChange$ = createEmitter(), this.overlapStrategy = pt$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);
|
|
787
808
|
}
|
|
788
809
|
async initialize(t17) {
|
|
789
|
-
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 ?? pt$1, this.setManifestInternal(t17.manifest), this.documentManagerUnsubs.push(this.documentManager.provides().onDocumentOpened((t18) => {
|
|
790
811
|
this.isOwnedChapter(t18.id) && (this.passwordAttempts.delete(t18.id), this.updateStatus(t18.id, "loaded"));
|
|
791
812
|
}), this.documentManager.provides().onDocumentClosed((t18) => {
|
|
792
813
|
this.isOwnedChapter(t18) && this.updateStatus(t18, "closed");
|
|
@@ -821,7 +842,7 @@ const ft$1 = class t3 extends BasePlugin {
|
|
|
821
842
|
const s9 = new Set(this.chapterStatus.keys()), i = new Set(e2.chapters.map((t17) => t17.chapterId));
|
|
822
843
|
for (const t17 of s9) i.has(t17) || (this.closeChapter(t17), this.chapterStatus.delete(t17));
|
|
823
844
|
for (const t17 of e2.chapters) this.chapterStatus.has(t17.chapterId) || this.chapterStatus.set(t17.chapterId, "idle");
|
|
824
|
-
this.manifest = e2, this.virtualPageMap =
|
|
845
|
+
this.manifest = e2, this.virtualPageMap = mt$1(e2, this.overlapStrategy), this.manifestChange$.emit({ manifest: e2, map: this.virtualPageMap }), this.eagerPrefetchFromManifest();
|
|
825
846
|
}
|
|
826
847
|
eagerPrefetchFromManifest() {
|
|
827
848
|
const t17 = this.config.prefetchChapters ?? 0;
|
|
@@ -945,11 +966,11 @@ const ft$1 = class t3 extends BasePlugin {
|
|
|
945
966
|
this.chapterStatus.get(t17) !== e2 && (this.chapterStatus.set(t17, e2), this.statusChange$.emit({ chapterId: t17, status: e2, ..."error" === e2 && a3 ? { error: { message: a3 } } : {} }));
|
|
946
967
|
}
|
|
947
968
|
};
|
|
948
|
-
|
|
949
|
-
let
|
|
950
|
-
const
|
|
969
|
+
vt$1.id = "chapter-manager";
|
|
970
|
+
let bt$1 = vt$1;
|
|
971
|
+
const Pt$1 = class Pt extends BasePlugin {
|
|
951
972
|
constructor(t17, e2) {
|
|
952
|
-
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(bt$1.id), this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
|
|
953
974
|
}
|
|
954
975
|
async initialize(t17) {
|
|
955
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 }) => {
|
|
@@ -957,8 +978,7 @@ const vt$1 = class vt extends BasePlugin {
|
|
|
957
978
|
})), this.syncReadyChapterSizes();
|
|
958
979
|
}
|
|
959
980
|
isChapterDocumentReady(t17) {
|
|
960
|
-
|
|
961
|
-
const e2 = this.documentManager.provides().getDocumentState(t17);
|
|
981
|
+
const e2 = this.coreState.core.documents[t17];
|
|
962
982
|
return !(!e2 || "loaded" !== e2.status || !e2.document) && e2.document.pages.length > 0;
|
|
963
983
|
}
|
|
964
984
|
refreshLayout() {
|
|
@@ -969,12 +989,14 @@ const vt$1 = class vt extends BasePlugin {
|
|
|
969
989
|
this.refreshLayout();
|
|
970
990
|
}
|
|
971
991
|
onDocumentLoaded(t17) {
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
992
|
+
var e2;
|
|
993
|
+
if (0 === ((null == (e2 = this.virtualPageMap) ? void 0 : e2.pagesOfChapter(t17).length) ?? 0)) return;
|
|
994
|
+
const a3 = this.documentManager.provides();
|
|
995
|
+
a3.getActiveDocumentId() || a3.setActiveDocument(t17), this.harvestChapterSizes(t17), this.refreshLayout();
|
|
975
996
|
}
|
|
976
997
|
onDocumentClosed(t17) {
|
|
977
|
-
|
|
998
|
+
var e2;
|
|
999
|
+
0 !== ((null == (e2 = this.virtualPageMap) ? void 0 : e2.pagesOfChapter(t17).length) ?? 0) && (this.dropChapterSizes(t17), this.refreshLayout());
|
|
978
1000
|
}
|
|
979
1001
|
buildCapability() {
|
|
980
1002
|
return { registerViewport: (t17) => this.bindViewport(t17), reportChapterPageSizes: (t17, e2) => this.applyChapterPageSizes(t17, e2), getLayout: () => this.computeLayout(), getCurrentGlobalPageIndex: () => this.currentGlobalPageIndex, getVisibleGlobalPageIndices: () => this.currentVisible.slice(), scrollToGlobalPageIndex: (t17, e2) => this.scrollToIndex(t17, e2), scrollToChapter: (t17, e2) => this.scrollToChapter(t17, e2), scrollToGlobalPageNumber: (t17, e2) => this.scrollToGlobalNumber(t17, e2), scrollToGlobalPdfPoint: (t17, e2, a3) => this.scrollToGlobalPdfPoint(t17, e2, a3), onLayoutChange: this.layoutChange$.on, onVisibleChange: this.visibleChange$.on };
|
|
@@ -1117,11 +1139,11 @@ const vt$1 = class vt extends BasePlugin {
|
|
|
1117
1139
|
a3 && this.scrollToIndex(a3.globalPageIndex, e2);
|
|
1118
1140
|
}
|
|
1119
1141
|
};
|
|
1120
|
-
|
|
1121
|
-
let
|
|
1122
|
-
const
|
|
1142
|
+
Pt$1.id = "chapter-scroll";
|
|
1143
|
+
let wt$1 = Pt$1;
|
|
1144
|
+
const It$1 = class t4 extends BasePlugin {
|
|
1123
1145
|
constructor(t17, e2) {
|
|
1124
|
-
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(wt$1.id), this.chapterManager = this.registry.getPlugin(ut$1.id), this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
|
|
1125
1147
|
}
|
|
1126
1148
|
async initialize(e2) {
|
|
1127
1149
|
if (this.config = e2, e2.callbacks.loadNotes) try {
|
|
@@ -1151,7 +1173,7 @@ const Pt$1 = class t4 extends BasePlugin {
|
|
|
1151
1173
|
return Array.from(this.notes.values());
|
|
1152
1174
|
}
|
|
1153
1175
|
buildDraft(t17) {
|
|
1154
|
-
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: Ct$1(t17.rectsPdfCoord), selectedText: t17.selectedText, content: t17.content };
|
|
1155
1177
|
}
|
|
1156
1178
|
async requestCreateFromSelection(t17) {
|
|
1157
1179
|
if (0 === t17.rectsPdfCoord.length) return null;
|
|
@@ -1218,24 +1240,24 @@ const Pt$1 = class t4 extends BasePlugin {
|
|
|
1218
1240
|
});
|
|
1219
1241
|
}
|
|
1220
1242
|
};
|
|
1221
|
-
|
|
1222
|
-
let
|
|
1223
|
-
function
|
|
1243
|
+
It$1.id = "note";
|
|
1244
|
+
let yt$1 = It$1;
|
|
1245
|
+
function Ct$1(t17) {
|
|
1224
1246
|
const e2 = t17[t17.length - 1];
|
|
1225
1247
|
return { x: e2.origin.x + e2.size.width, y: e2.origin.y + e2.size.height };
|
|
1226
1248
|
}
|
|
1227
|
-
function
|
|
1249
|
+
function Mt$1({ chapterId: a3, localPageIndex: s9, pdfPageWidth: o, pdfPageHeight: n5, cssPageWidth: h, cssPageHeight: l2, color: c = "#f59e0b", ui: u, className: p, style: g }) {
|
|
1228
1250
|
const { plugin: f } = (() => {
|
|
1229
1251
|
const { registry: t17 } = useRegistry();
|
|
1230
1252
|
if (null === t17) return { plugin: null, isLoading: true, ready: new Promise(() => {
|
|
1231
1253
|
}) };
|
|
1232
|
-
const e2 = t17.getPlugin(
|
|
1254
|
+
const e2 = t17.getPlugin(yt$1.id);
|
|
1233
1255
|
return { plugin: e2, isLoading: false, ready: (null == e2 ? void 0 : e2.ready()) ?? Promise.resolve() };
|
|
1234
1256
|
})(), { provides: m } = (() => {
|
|
1235
1257
|
const { registry: t17 } = useRegistry();
|
|
1236
1258
|
if (null === t17) return { provides: null, isLoading: true, ready: new Promise(() => {
|
|
1237
1259
|
}) };
|
|
1238
|
-
const e2 = t17.getPlugin(
|
|
1260
|
+
const e2 = t17.getPlugin(yt$1.id);
|
|
1239
1261
|
return (null == e2 ? void 0 : e2.provides) ? { provides: e2.provides(), isLoading: false, ready: e2.ready() } : { provides: null, isLoading: false, ready: Promise.resolve() };
|
|
1240
1262
|
})(), [v, b] = useState([]), [P, w] = useState(null), [I, y] = useState(null);
|
|
1241
1263
|
if (useEffect(() => {
|
|
@@ -1251,19 +1273,19 @@ function yt$1({ chapterId: a3, localPageIndex: s9, pdfPageWidth: o, pdfPageHeigh
|
|
|
1251
1273
|
};
|
|
1252
1274
|
return document.addEventListener("mousedown", t17), () => document.removeEventListener("mousedown", t17);
|
|
1253
1275
|
}, [I]), !m || 0 === v.length || !o || !n5) return null;
|
|
1254
|
-
const C2 = h / o, M2 =
|
|
1276
|
+
const C2 = 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)";
|
|
1255
1277
|
return jsx("div", { className: p, style: { position: "absolute", inset: 0, pointerEvents: "none", zIndex: 25, ...g }, children: v.map((a4) => {
|
|
1256
1278
|
const s10 = P === a4.noteId, i = I === a4.noteId, r2 = s10 || i, { left: o2, top: n6 } = (function(t17) {
|
|
1257
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;
|
|
1258
|
-
let
|
|
1259
|
-
h2 ? (
|
|
1280
|
+
let l4, d2;
|
|
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);
|
|
1260
1282
|
const c2 = Math.max(0, r3 - o3 - 2);
|
|
1261
|
-
return
|
|
1262
|
-
})({ markerPdf: a4.endAnchor, lineRects: a4.rectsPdfCoord, sx: C2, sy: M2, cssPageWidth: h, iconSize: S2 }),
|
|
1283
|
+
return l4 > c2 && (l4 = c2), d2 < 0 && (d2 = 0), { left: l4, top: d2 };
|
|
1284
|
+
})({ markerPdf: a4.endAnchor, lineRects: a4.rectsPdfCoord, sx: C2, sy: M2, cssPageWidth: h, iconSize: S2 }), l3 = (function(t17, e2, a5) {
|
|
1263
1285
|
let s11 = 1 / 0, i2 = 1 / 0, r3 = -1 / 0, o3 = -1 / 0;
|
|
1264
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);
|
|
1265
1287
|
return { left: s11, top: i2, width: r3 - s11, height: o3 - i2 };
|
|
1266
|
-
})(a4.rectsPdfCoord, C2, M2),
|
|
1288
|
+
})(a4.rectsPdfCoord, C2, 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;
|
|
1267
1289
|
return jsxs("div", { children: [a4.rectsPdfCoord.map((e2, s11) => /* @__PURE__ */ jsx("div", { style: { position: "absolute", left: e2.origin.x * C2 + "px", top: e2.origin.y * M2 + "px", width: e2.size.width * C2 + "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: () => {
|
|
1268
1290
|
I !== a4.noteId && w(null);
|
|
1269
1291
|
}, children: [(null == u ? void 0 : u.renderIcon) ? /* @__PURE__ */ jsx("div", { role: "button", tabIndex: 0, title: "笔记", "aria-label": "笔记", onMouseDown: (t17) => t17.stopPropagation(), onClick: (t17) => {
|
|
@@ -1275,18 +1297,18 @@ function yt$1({ chapterId: a3, localPageIndex: s9, pdfPageWidth: o, pdfPageHeigh
|
|
|
1275
1297
|
}, onDelete: () => {
|
|
1276
1298
|
y(null), w(null), m.deleteNote(a4.noteId);
|
|
1277
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: [
|
|
1278
|
-
/* @__PURE__ */ jsx("button", { type: "button", style:
|
|
1300
|
+
/* @__PURE__ */ jsx("button", { type: "button", style: St$1, onClick: (t17) => {
|
|
1279
1301
|
t17.stopPropagation(), y(null), w(null), null == f || f.requestEdit(a4.noteId);
|
|
1280
1302
|
}, children: "编辑" }),
|
|
1281
|
-
/* @__PURE__ */ jsx("button", { type: "button", style: { ...
|
|
1303
|
+
/* @__PURE__ */ jsx("button", { type: "button", style: { ...St$1, color: "#dc2626" }, onClick: (t17) => {
|
|
1282
1304
|
t17.stopPropagation(), y(null), w(null), m.deleteNote(a4.noteId);
|
|
1283
1305
|
}, children: "删除" })
|
|
1284
1306
|
] }))] })] }, a4.noteId);
|
|
1285
1307
|
}) });
|
|
1286
1308
|
}
|
|
1287
|
-
const
|
|
1288
|
-
const
|
|
1289
|
-
function
|
|
1309
|
+
const St$1 = { display: "block", width: "100%", padding: "6px 10px", fontSize: "12px", border: "none", borderRadius: "4px", background: "transparent", color: "#334155", cursor: "pointer", textAlign: "left" };
|
|
1310
|
+
const xt$1 = { kind: "first-wins" };
|
|
1311
|
+
function $t$1(t17, e2, a3) {
|
|
1290
1312
|
if (1 === e2.length) return e2[0].chapterId;
|
|
1291
1313
|
switch (a3.kind) {
|
|
1292
1314
|
case "first-wins":
|
|
@@ -1304,7 +1326,7 @@ function St$1(t17, e2, a3) {
|
|
|
1304
1326
|
return a3.resolve(t17, e2);
|
|
1305
1327
|
}
|
|
1306
1328
|
}
|
|
1307
|
-
let
|
|
1329
|
+
let kt$1 = class kt {
|
|
1308
1330
|
constructor(t17) {
|
|
1309
1331
|
this._pages = t17, this._byChapter = /* @__PURE__ */ new Map(), this._byGlobalNumber = /* @__PURE__ */ new Map();
|
|
1310
1332
|
for (const e2 of t17) {
|
|
@@ -1338,8 +1360,8 @@ let xt$1 = class xt {
|
|
|
1338
1360
|
return a3 ? this._pages.indexOf(a3) : -1;
|
|
1339
1361
|
}
|
|
1340
1362
|
};
|
|
1341
|
-
function $
|
|
1342
|
-
const a3 = (function(t18, e3 =
|
|
1363
|
+
function Lt$1(t17, e2 = xt$1) {
|
|
1364
|
+
const a3 = (function(t18, e3 = xt$1) {
|
|
1343
1365
|
const a4 = /* @__PURE__ */ new Map();
|
|
1344
1366
|
for (const i2 of t18.chapters) {
|
|
1345
1367
|
const [t19, e4] = i2.globalPageRange;
|
|
@@ -1349,7 +1371,7 @@ function $t$1(t17, e2 = Mt$1) {
|
|
|
1349
1371
|
}
|
|
1350
1372
|
}
|
|
1351
1373
|
const s10 = /* @__PURE__ */ new Map();
|
|
1352
|
-
for (const [i2, r3] of a4) s10.set(i2,
|
|
1374
|
+
for (const [i2, r3] of a4) s10.set(i2, $t$1(i2, r3, e3));
|
|
1353
1375
|
return s10;
|
|
1354
1376
|
})(t17, e2), s9 = /* @__PURE__ */ new Map();
|
|
1355
1377
|
for (const n5 of t17.chapters) s9.set(n5.chapterId, n5);
|
|
@@ -1361,14 +1383,14 @@ function $t$1(t17, e2 = Mt$1) {
|
|
|
1361
1383
|
const [i2] = e3.globalPageRange, [h] = e3.localPageRange, l2 = h + (n5 - i2);
|
|
1362
1384
|
r2.push({ globalPageIndex: o++, globalPageNumber: n5, chapterId: t18, localPageIndex: l2 });
|
|
1363
1385
|
}
|
|
1364
|
-
return new
|
|
1386
|
+
return new kt$1(r2);
|
|
1365
1387
|
}
|
|
1366
|
-
const
|
|
1388
|
+
const zt$1 = class t5 extends BasePlugin {
|
|
1367
1389
|
constructor(t17, e2) {
|
|
1368
|
-
super(t17, e2), this.statusChange$ = createBehaviorEmitter(), this.manifestChange$ = createEmitter(), this.overlapStrategy =
|
|
1390
|
+
super(t17, e2), this.statusChange$ = createBehaviorEmitter(), this.manifestChange$ = createEmitter(), this.overlapStrategy = xt$1, this.chapterStatus = /* @__PURE__ */ new Map(), this.chapterLastUsed = /* @__PURE__ */ new Map(), this.passwordAttempts = /* @__PURE__ */ new Map(), this.pendingLoadPromises = /* @__PURE__ */ new Map(), this.unloadTimer = null, this.documentManagerUnsubs = [], this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
|
|
1369
1391
|
}
|
|
1370
1392
|
async initialize(t17) {
|
|
1371
|
-
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 ?? xt$1, this.setManifestInternal(t17.manifest), this.documentManagerUnsubs.push(this.documentManager.provides().onDocumentOpened((t18) => {
|
|
1372
1394
|
this.isOwnedChapter(t18.id) && (this.passwordAttempts.delete(t18.id), this.updateStatus(t18.id, "loaded"));
|
|
1373
1395
|
}), this.documentManager.provides().onDocumentClosed((t18) => {
|
|
1374
1396
|
this.isOwnedChapter(t18) && this.updateStatus(t18, "closed");
|
|
@@ -1403,7 +1425,7 @@ const kt$1 = class t5 extends BasePlugin {
|
|
|
1403
1425
|
const s9 = new Set(this.chapterStatus.keys()), i = new Set(e2.chapters.map((t17) => t17.chapterId));
|
|
1404
1426
|
for (const t17 of s9) i.has(t17) || (this.closeChapter(t17), this.chapterStatus.delete(t17));
|
|
1405
1427
|
for (const t17 of e2.chapters) this.chapterStatus.has(t17.chapterId) || this.chapterStatus.set(t17.chapterId, "idle");
|
|
1406
|
-
this.manifest = e2, this.virtualPageMap = $
|
|
1428
|
+
this.manifest = e2, this.virtualPageMap = Lt$1(e2, this.overlapStrategy), this.manifestChange$.emit({ manifest: e2, map: this.virtualPageMap }), this.eagerPrefetchFromManifest();
|
|
1407
1429
|
}
|
|
1408
1430
|
eagerPrefetchFromManifest() {
|
|
1409
1431
|
const t17 = this.config.prefetchChapters ?? 0;
|
|
@@ -1527,10 +1549,10 @@ const kt$1 = class t5 extends BasePlugin {
|
|
|
1527
1549
|
this.chapterStatus.get(t17) !== e2 && (this.chapterStatus.set(t17, e2), this.statusChange$.emit({ chapterId: t17, status: e2, ..."error" === e2 && a3 ? { error: { message: a3 } } : {} }));
|
|
1528
1550
|
}
|
|
1529
1551
|
};
|
|
1530
|
-
|
|
1531
|
-
let
|
|
1532
|
-
const
|
|
1533
|
-
function
|
|
1552
|
+
zt$1.id = "chapter-manager";
|
|
1553
|
+
let Dt$1 = zt$1;
|
|
1554
|
+
const Tt$1 = { kind: "first-wins" };
|
|
1555
|
+
function Gt$1(t17, e2, a3) {
|
|
1534
1556
|
if (1 === e2.length) return e2[0].chapterId;
|
|
1535
1557
|
switch (a3.kind) {
|
|
1536
1558
|
case "first-wins":
|
|
@@ -1548,7 +1570,7 @@ function zt$1(t17, e2, a3) {
|
|
|
1548
1570
|
return a3.resolve(t17, e2);
|
|
1549
1571
|
}
|
|
1550
1572
|
}
|
|
1551
|
-
let
|
|
1573
|
+
let Ot$1 = class Ot {
|
|
1552
1574
|
constructor(t17) {
|
|
1553
1575
|
this._pages = t17, this._byChapter = /* @__PURE__ */ new Map(), this._byGlobalNumber = /* @__PURE__ */ new Map();
|
|
1554
1576
|
for (const e2 of t17) {
|
|
@@ -1582,8 +1604,8 @@ let Tt$1 = class Tt {
|
|
|
1582
1604
|
return a3 ? this._pages.indexOf(a3) : -1;
|
|
1583
1605
|
}
|
|
1584
1606
|
};
|
|
1585
|
-
function
|
|
1586
|
-
const a3 = (function(t18, e3 =
|
|
1607
|
+
function At$1(t17, e2 = Tt$1) {
|
|
1608
|
+
const a3 = (function(t18, e3 = Tt$1) {
|
|
1587
1609
|
const a4 = /* @__PURE__ */ new Map();
|
|
1588
1610
|
for (const i2 of t18.chapters) {
|
|
1589
1611
|
const [t19, e4] = i2.globalPageRange;
|
|
@@ -1593,7 +1615,7 @@ function Gt$1(t17, e2 = Dt$1) {
|
|
|
1593
1615
|
}
|
|
1594
1616
|
}
|
|
1595
1617
|
const s10 = /* @__PURE__ */ new Map();
|
|
1596
|
-
for (const [i2, r3] of a4) s10.set(i2,
|
|
1618
|
+
for (const [i2, r3] of a4) s10.set(i2, Gt$1(i2, r3, e3));
|
|
1597
1619
|
return s10;
|
|
1598
1620
|
})(t17, e2), s9 = /* @__PURE__ */ new Map();
|
|
1599
1621
|
for (const n5 of t17.chapters) s9.set(n5.chapterId, n5);
|
|
@@ -1605,14 +1627,14 @@ function Gt$1(t17, e2 = Dt$1) {
|
|
|
1605
1627
|
const [i2] = e3.globalPageRange, [h] = e3.localPageRange, l2 = h + (n5 - i2);
|
|
1606
1628
|
r2.push({ globalPageIndex: o++, globalPageNumber: n5, chapterId: t18, localPageIndex: l2 });
|
|
1607
1629
|
}
|
|
1608
|
-
return new
|
|
1630
|
+
return new Ot$1(r2);
|
|
1609
1631
|
}
|
|
1610
|
-
const
|
|
1632
|
+
const Nt$1 = class t6 extends BasePlugin {
|
|
1611
1633
|
constructor(t17, e2) {
|
|
1612
|
-
super(t17, e2), this.statusChange$ = createBehaviorEmitter(), this.manifestChange$ = createEmitter(), this.overlapStrategy =
|
|
1634
|
+
super(t17, e2), this.statusChange$ = createBehaviorEmitter(), this.manifestChange$ = createEmitter(), this.overlapStrategy = Tt$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);
|
|
1613
1635
|
}
|
|
1614
1636
|
async initialize(t17) {
|
|
1615
|
-
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 ?? Tt$1, this.setManifestInternal(t17.manifest), this.documentManagerUnsubs.push(this.documentManager.provides().onDocumentOpened((t18) => {
|
|
1616
1638
|
this.isOwnedChapter(t18.id) && (this.passwordAttempts.delete(t18.id), this.updateStatus(t18.id, "loaded"));
|
|
1617
1639
|
}), this.documentManager.provides().onDocumentClosed((t18) => {
|
|
1618
1640
|
this.isOwnedChapter(t18) && this.updateStatus(t18, "closed");
|
|
@@ -1647,7 +1669,7 @@ const At$1 = class t6 extends BasePlugin {
|
|
|
1647
1669
|
const s9 = new Set(this.chapterStatus.keys()), i = new Set(e2.chapters.map((t17) => t17.chapterId));
|
|
1648
1670
|
for (const t17 of s9) i.has(t17) || (this.closeChapter(t17), this.chapterStatus.delete(t17));
|
|
1649
1671
|
for (const t17 of e2.chapters) this.chapterStatus.has(t17.chapterId) || this.chapterStatus.set(t17.chapterId, "idle");
|
|
1650
|
-
this.manifest = e2, this.virtualPageMap =
|
|
1672
|
+
this.manifest = e2, this.virtualPageMap = At$1(e2, this.overlapStrategy), this.manifestChange$.emit({ manifest: e2, map: this.virtualPageMap }), this.eagerPrefetchFromManifest();
|
|
1651
1673
|
}
|
|
1652
1674
|
eagerPrefetchFromManifest() {
|
|
1653
1675
|
const t17 = this.config.prefetchChapters ?? 0;
|
|
@@ -1771,11 +1793,11 @@ const At$1 = class t6 extends BasePlugin {
|
|
|
1771
1793
|
this.chapterStatus.get(t17) !== e2 && (this.chapterStatus.set(t17, e2), this.statusChange$.emit({ chapterId: t17, status: e2, ..."error" === e2 && a3 ? { error: { message: a3 } } : {} }));
|
|
1772
1794
|
}
|
|
1773
1795
|
};
|
|
1774
|
-
|
|
1775
|
-
let
|
|
1776
|
-
const
|
|
1796
|
+
Nt$1.id = "chapter-manager";
|
|
1797
|
+
let Vt$1 = Nt$1;
|
|
1798
|
+
const Rt$1 = class Rt extends BasePlugin {
|
|
1777
1799
|
constructor(t17, e2) {
|
|
1778
|
-
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(Vt$1.id), this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
|
|
1779
1801
|
}
|
|
1780
1802
|
async initialize(t17) {
|
|
1781
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 }) => {
|
|
@@ -1783,8 +1805,7 @@ const Nt$1 = class Nt extends BasePlugin {
|
|
|
1783
1805
|
})), this.syncReadyChapterSizes();
|
|
1784
1806
|
}
|
|
1785
1807
|
isChapterDocumentReady(t17) {
|
|
1786
|
-
|
|
1787
|
-
const e2 = this.documentManager.provides().getDocumentState(t17);
|
|
1808
|
+
const e2 = this.coreState.core.documents[t17];
|
|
1788
1809
|
return !(!e2 || "loaded" !== e2.status || !e2.document) && e2.document.pages.length > 0;
|
|
1789
1810
|
}
|
|
1790
1811
|
refreshLayout() {
|
|
@@ -1795,12 +1816,14 @@ const Nt$1 = class Nt extends BasePlugin {
|
|
|
1795
1816
|
this.refreshLayout();
|
|
1796
1817
|
}
|
|
1797
1818
|
onDocumentLoaded(t17) {
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1819
|
+
var e2;
|
|
1820
|
+
if (0 === ((null == (e2 = this.virtualPageMap) ? void 0 : e2.pagesOfChapter(t17).length) ?? 0)) return;
|
|
1821
|
+
const a3 = this.documentManager.provides();
|
|
1822
|
+
a3.getActiveDocumentId() || a3.setActiveDocument(t17), this.harvestChapterSizes(t17), this.refreshLayout();
|
|
1801
1823
|
}
|
|
1802
1824
|
onDocumentClosed(t17) {
|
|
1803
|
-
|
|
1825
|
+
var e2;
|
|
1826
|
+
0 !== ((null == (e2 = this.virtualPageMap) ? void 0 : e2.pagesOfChapter(t17).length) ?? 0) && (this.dropChapterSizes(t17), this.refreshLayout());
|
|
1804
1827
|
}
|
|
1805
1828
|
buildCapability() {
|
|
1806
1829
|
return { registerViewport: (t17) => this.bindViewport(t17), reportChapterPageSizes: (t17, e2) => this.applyChapterPageSizes(t17, e2), getLayout: () => this.computeLayout(), getCurrentGlobalPageIndex: () => this.currentGlobalPageIndex, getVisibleGlobalPageIndices: () => this.currentVisible.slice(), scrollToGlobalPageIndex: (t17, e2) => this.scrollToIndex(t17, e2), scrollToChapter: (t17, e2) => this.scrollToChapter(t17, e2), scrollToGlobalPageNumber: (t17, e2) => this.scrollToGlobalNumber(t17, e2), scrollToGlobalPdfPoint: (t17, e2, a3) => this.scrollToGlobalPdfPoint(t17, e2, a3), onLayoutChange: this.layoutChange$.on, onVisibleChange: this.visibleChange$.on };
|
|
@@ -1943,30 +1966,30 @@ const Nt$1 = class Nt extends BasePlugin {
|
|
|
1943
1966
|
a3 && this.scrollToIndex(a3.globalPageIndex, e2);
|
|
1944
1967
|
}
|
|
1945
1968
|
};
|
|
1946
|
-
|
|
1947
|
-
let
|
|
1948
|
-
function
|
|
1969
|
+
Rt$1.id = "chapter-scroll";
|
|
1970
|
+
let Et$1 = Rt$1;
|
|
1971
|
+
function Ut$1(t17) {
|
|
1949
1972
|
const e2 = t17[t17.length - 1];
|
|
1950
1973
|
return { x: e2.origin.x + e2.size.width, y: e2.origin.y + e2.size.height };
|
|
1951
1974
|
}
|
|
1952
|
-
function
|
|
1975
|
+
function _t$1(t17, e2) {
|
|
1953
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);
|
|
1954
1977
|
if (o <= 0) return 0;
|
|
1955
1978
|
return Math.max(0, Math.min(s9, r2) - Math.max(a3, i)) / o;
|
|
1956
1979
|
}
|
|
1957
|
-
function
|
|
1980
|
+
function Ft$1(t17, e2) {
|
|
1958
1981
|
var a3, s9;
|
|
1959
1982
|
if (t17.chapterId !== e2.chapterId || t17.localPageIndex !== e2.localPageIndex) return false;
|
|
1960
|
-
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 ?? Ut$1(i), n5 = e2.markerAnchor ?? Ut$1(r2);
|
|
1961
1984
|
if (Math.hypot(o.x - n5.x, o.y - n5.y) <= 6) return true;
|
|
1962
1985
|
for (const h of i) for (const t18 of r2) {
|
|
1963
|
-
if (
|
|
1986
|
+
if (_t$1(h, t18) < 0.5) continue;
|
|
1964
1987
|
const e3 = Math.max(h.origin.x, t18.origin.x);
|
|
1965
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;
|
|
1966
1989
|
}
|
|
1967
1990
|
return false;
|
|
1968
1991
|
}
|
|
1969
|
-
async function
|
|
1992
|
+
async function qt(t17, e2, a3) {
|
|
1970
1993
|
t17.scrollToGlobalPageIndex(e2), await (function(t18, e3, a4 = 2500) {
|
|
1971
1994
|
const s9 = t18.getLayout().items.find((t19) => t19.globalPageIndex === e3 && !t19.isPlaceholder);
|
|
1972
1995
|
return s9 ? Promise.resolve(s9) : new Promise((s10) => {
|
|
@@ -1979,9 +2002,9 @@ async function _t$1(t17, e2, a3) {
|
|
|
1979
2002
|
});
|
|
1980
2003
|
})(t17, e2), t17.scrollToGlobalPdfPoint(e2, a3, { marginTop: 80 });
|
|
1981
2004
|
}
|
|
1982
|
-
const
|
|
2005
|
+
const Wt = class t7 extends BasePlugin {
|
|
1983
2006
|
constructor(t17, e2) {
|
|
1984
|
-
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(Et$1.id), this.chapterManager = this.registry.getPlugin(Dt$1.id), this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
|
|
1985
2008
|
}
|
|
1986
2009
|
async initialize(e2) {
|
|
1987
2010
|
var a3;
|
|
@@ -1997,7 +2020,7 @@ const Ft$1 = class t7 extends BasePlugin {
|
|
|
1997
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 };
|
|
1998
2021
|
}
|
|
1999
2022
|
addBookmark(t17) {
|
|
2000
|
-
for (const s9 of this.entries.values()) if (
|
|
2023
|
+
for (const s9 of this.entries.values()) if (Ft$1(s9.anchor, t17.anchor)) return s9;
|
|
2001
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() };
|
|
2002
2025
|
return this.entries.set(e2, a3), this.notifyAndPersist(), a3;
|
|
2003
2026
|
}
|
|
@@ -2045,13 +2068,13 @@ const Ft$1 = class t7 extends BasePlugin {
|
|
|
2045
2068
|
const e3 = t18.rectPdfCoord;
|
|
2046
2069
|
return e3.origin.y + e3.size.height;
|
|
2047
2070
|
})(e2.anchor);
|
|
2048
|
-
await
|
|
2071
|
+
await qt(a3, s9, i);
|
|
2049
2072
|
}
|
|
2050
2073
|
};
|
|
2051
|
-
|
|
2052
|
-
let
|
|
2053
|
-
function
|
|
2054
|
-
const { provides: m } = useCapability(
|
|
2074
|
+
Wt.id = "paragraph-bookmark";
|
|
2075
|
+
let Ht = Wt;
|
|
2076
|
+
function Bt({ 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(Ht.id), [v, b] = useState([]), [P, w] = useState(null), I = useRef(null);
|
|
2055
2078
|
if (useEffect(() => {
|
|
2056
2079
|
if (!m) return;
|
|
2057
2080
|
const t17 = () => {
|
|
@@ -2087,20 +2110,20 @@ function Wt({ chapterId: a3, localPageIndex: o, pdfPageWidth: n5, pdfPageHeight:
|
|
|
2087
2110
|
}, children: "删除书签" }) })] }, a4.id);
|
|
2088
2111
|
}) });
|
|
2089
2112
|
}
|
|
2090
|
-
function
|
|
2113
|
+
function jt(t17) {
|
|
2091
2114
|
return t17.chapterId;
|
|
2092
2115
|
}
|
|
2093
|
-
function
|
|
2116
|
+
function Yt(t17, e2) {
|
|
2094
2117
|
t17.wait(e2, () => {
|
|
2095
2118
|
});
|
|
2096
2119
|
}
|
|
2097
|
-
function
|
|
2120
|
+
function Xt(t17, e2, a3) {
|
|
2098
2121
|
return { chapterId: t17.chapterId, localPageIndex: t17.localPageIndex, globalPageIndex: t17.globalPageIndex, globalPageNumber: t17.globalPageNumber, rectsPdfCoord: e2, selectedText: a3 };
|
|
2099
2122
|
}
|
|
2100
|
-
const
|
|
2123
|
+
const Kt = "note", Zt = { id: Kt, name: "Note Plugin", version: "0.1.0", provides: ["note"], requires: ["selection", "chapter-scroll", "chapter-manager"], optional: [], defaultConfig: { callbacks: { onCreateNote: async () => null, onActivateNote: () => {
|
|
2101
2124
|
} }, markerSize: 18 } };
|
|
2102
|
-
const
|
|
2103
|
-
function
|
|
2125
|
+
const Qt = { kind: "first-wins" };
|
|
2126
|
+
function Jt(t17, e2, a3) {
|
|
2104
2127
|
if (1 === e2.length) return e2[0].chapterId;
|
|
2105
2128
|
switch (a3.kind) {
|
|
2106
2129
|
case "first-wins":
|
|
@@ -2118,7 +2141,7 @@ function Zt(t17, e2, a3) {
|
|
|
2118
2141
|
return a3.resolve(t17, e2);
|
|
2119
2142
|
}
|
|
2120
2143
|
}
|
|
2121
|
-
let
|
|
2144
|
+
let te = class {
|
|
2122
2145
|
constructor(t17) {
|
|
2123
2146
|
this._pages = t17, this._byChapter = /* @__PURE__ */ new Map(), this._byGlobalNumber = /* @__PURE__ */ new Map();
|
|
2124
2147
|
for (const e2 of t17) {
|
|
@@ -2152,8 +2175,8 @@ let Qt = class {
|
|
|
2152
2175
|
return a3 ? this._pages.indexOf(a3) : -1;
|
|
2153
2176
|
}
|
|
2154
2177
|
};
|
|
2155
|
-
function
|
|
2156
|
-
const a3 = (function(t18, e3 =
|
|
2178
|
+
function ee(t17, e2 = Qt) {
|
|
2179
|
+
const a3 = (function(t18, e3 = Qt) {
|
|
2157
2180
|
const a4 = /* @__PURE__ */ new Map();
|
|
2158
2181
|
for (const i2 of t18.chapters) {
|
|
2159
2182
|
const [t19, e4] = i2.globalPageRange;
|
|
@@ -2163,7 +2186,7 @@ function Jt(t17, e2 = Kt) {
|
|
|
2163
2186
|
}
|
|
2164
2187
|
}
|
|
2165
2188
|
const s10 = /* @__PURE__ */ new Map();
|
|
2166
|
-
for (const [i2, r3] of a4) s10.set(i2,
|
|
2189
|
+
for (const [i2, r3] of a4) s10.set(i2, Jt(i2, r3, e3));
|
|
2167
2190
|
return s10;
|
|
2168
2191
|
})(t17, e2), s9 = /* @__PURE__ */ new Map();
|
|
2169
2192
|
for (const n5 of t17.chapters) s9.set(n5.chapterId, n5);
|
|
@@ -2175,14 +2198,14 @@ function Jt(t17, e2 = Kt) {
|
|
|
2175
2198
|
const [i2] = e3.globalPageRange, [h] = e3.localPageRange, l2 = h + (n5 - i2);
|
|
2176
2199
|
r2.push({ globalPageIndex: o++, globalPageNumber: n5, chapterId: t18, localPageIndex: l2 });
|
|
2177
2200
|
}
|
|
2178
|
-
return new
|
|
2201
|
+
return new te(r2);
|
|
2179
2202
|
}
|
|
2180
|
-
const
|
|
2203
|
+
const ae = class t8 extends BasePlugin {
|
|
2181
2204
|
constructor(t17, e2) {
|
|
2182
|
-
super(t17, e2), this.statusChange$ = createBehaviorEmitter(), this.manifestChange$ = createEmitter(), this.overlapStrategy =
|
|
2205
|
+
super(t17, e2), this.statusChange$ = createBehaviorEmitter(), this.manifestChange$ = createEmitter(), this.overlapStrategy = Qt, 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);
|
|
2183
2206
|
}
|
|
2184
2207
|
async initialize(t17) {
|
|
2185
|
-
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 ?? Qt, this.setManifestInternal(t17.manifest), this.documentManagerUnsubs.push(this.documentManager.provides().onDocumentOpened((t18) => {
|
|
2186
2209
|
this.isOwnedChapter(t18.id) && (this.passwordAttempts.delete(t18.id), this.updateStatus(t18.id, "loaded"));
|
|
2187
2210
|
}), this.documentManager.provides().onDocumentClosed((t18) => {
|
|
2188
2211
|
this.isOwnedChapter(t18) && this.updateStatus(t18, "closed");
|
|
@@ -2217,7 +2240,7 @@ const te = class t8 extends BasePlugin {
|
|
|
2217
2240
|
const s9 = new Set(this.chapterStatus.keys()), i = new Set(e2.chapters.map((t17) => t17.chapterId));
|
|
2218
2241
|
for (const t17 of s9) i.has(t17) || (this.closeChapter(t17), this.chapterStatus.delete(t17));
|
|
2219
2242
|
for (const t17 of e2.chapters) this.chapterStatus.has(t17.chapterId) || this.chapterStatus.set(t17.chapterId, "idle");
|
|
2220
|
-
this.manifest = e2, this.virtualPageMap =
|
|
2243
|
+
this.manifest = e2, this.virtualPageMap = ee(e2, this.overlapStrategy), this.manifestChange$.emit({ manifest: e2, map: this.virtualPageMap }), this.eagerPrefetchFromManifest();
|
|
2221
2244
|
}
|
|
2222
2245
|
eagerPrefetchFromManifest() {
|
|
2223
2246
|
const t17 = this.config.prefetchChapters ?? 0;
|
|
@@ -2341,10 +2364,10 @@ const te = class t8 extends BasePlugin {
|
|
|
2341
2364
|
this.chapterStatus.get(t17) !== e2 && (this.chapterStatus.set(t17, e2), this.statusChange$.emit({ chapterId: t17, status: e2, ..."error" === e2 && a3 ? { error: { message: a3 } } : {} }));
|
|
2342
2365
|
}
|
|
2343
2366
|
};
|
|
2344
|
-
|
|
2345
|
-
let
|
|
2346
|
-
const
|
|
2347
|
-
function
|
|
2367
|
+
ae.id = "chapter-manager";
|
|
2368
|
+
let se = ae;
|
|
2369
|
+
const ie = { kind: "first-wins" };
|
|
2370
|
+
function re(t17, e2, a3) {
|
|
2348
2371
|
if (1 === e2.length) return e2[0].chapterId;
|
|
2349
2372
|
switch (a3.kind) {
|
|
2350
2373
|
case "first-wins":
|
|
@@ -2362,7 +2385,7 @@ function se(t17, e2, a3) {
|
|
|
2362
2385
|
return a3.resolve(t17, e2);
|
|
2363
2386
|
}
|
|
2364
2387
|
}
|
|
2365
|
-
let
|
|
2388
|
+
let oe = class {
|
|
2366
2389
|
constructor(t17) {
|
|
2367
2390
|
this._pages = t17, this._byChapter = /* @__PURE__ */ new Map(), this._byGlobalNumber = /* @__PURE__ */ new Map();
|
|
2368
2391
|
for (const e2 of t17) {
|
|
@@ -2396,8 +2419,8 @@ let ie = class {
|
|
|
2396
2419
|
return a3 ? this._pages.indexOf(a3) : -1;
|
|
2397
2420
|
}
|
|
2398
2421
|
};
|
|
2399
|
-
function
|
|
2400
|
-
const a3 = (function(t18, e3 =
|
|
2422
|
+
function ne(t17, e2 = ie) {
|
|
2423
|
+
const a3 = (function(t18, e3 = ie) {
|
|
2401
2424
|
const a4 = /* @__PURE__ */ new Map();
|
|
2402
2425
|
for (const i2 of t18.chapters) {
|
|
2403
2426
|
const [t19, e4] = i2.globalPageRange;
|
|
@@ -2407,7 +2430,7 @@ function re(t17, e2 = ae) {
|
|
|
2407
2430
|
}
|
|
2408
2431
|
}
|
|
2409
2432
|
const s10 = /* @__PURE__ */ new Map();
|
|
2410
|
-
for (const [i2, r3] of a4) s10.set(i2,
|
|
2433
|
+
for (const [i2, r3] of a4) s10.set(i2, re(i2, r3, e3));
|
|
2411
2434
|
return s10;
|
|
2412
2435
|
})(t17, e2), s9 = /* @__PURE__ */ new Map();
|
|
2413
2436
|
for (const n5 of t17.chapters) s9.set(n5.chapterId, n5);
|
|
@@ -2419,14 +2442,14 @@ function re(t17, e2 = ae) {
|
|
|
2419
2442
|
const [i2] = e3.globalPageRange, [h] = e3.localPageRange, l2 = h + (n5 - i2);
|
|
2420
2443
|
r2.push({ globalPageIndex: o++, globalPageNumber: n5, chapterId: t18, localPageIndex: l2 });
|
|
2421
2444
|
}
|
|
2422
|
-
return new
|
|
2445
|
+
return new oe(r2);
|
|
2423
2446
|
}
|
|
2424
|
-
const
|
|
2447
|
+
const he = class t9 extends BasePlugin {
|
|
2425
2448
|
constructor(t17, e2) {
|
|
2426
|
-
super(t17, e2), this.statusChange$ = createBehaviorEmitter(), this.manifestChange$ = createEmitter(), this.overlapStrategy =
|
|
2449
|
+
super(t17, e2), this.statusChange$ = createBehaviorEmitter(), this.manifestChange$ = createEmitter(), this.overlapStrategy = ie, 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);
|
|
2427
2450
|
}
|
|
2428
2451
|
async initialize(t17) {
|
|
2429
|
-
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 ?? ie, this.setManifestInternal(t17.manifest), this.documentManagerUnsubs.push(this.documentManager.provides().onDocumentOpened((t18) => {
|
|
2430
2453
|
this.isOwnedChapter(t18.id) && (this.passwordAttempts.delete(t18.id), this.updateStatus(t18.id, "loaded"));
|
|
2431
2454
|
}), this.documentManager.provides().onDocumentClosed((t18) => {
|
|
2432
2455
|
this.isOwnedChapter(t18) && this.updateStatus(t18, "closed");
|
|
@@ -2461,7 +2484,7 @@ const oe = class t9 extends BasePlugin {
|
|
|
2461
2484
|
const s9 = new Set(this.chapterStatus.keys()), i = new Set(e2.chapters.map((t17) => t17.chapterId));
|
|
2462
2485
|
for (const t17 of s9) i.has(t17) || (this.closeChapter(t17), this.chapterStatus.delete(t17));
|
|
2463
2486
|
for (const t17 of e2.chapters) this.chapterStatus.has(t17.chapterId) || this.chapterStatus.set(t17.chapterId, "idle");
|
|
2464
|
-
this.manifest = e2, this.virtualPageMap =
|
|
2487
|
+
this.manifest = e2, this.virtualPageMap = ne(e2, this.overlapStrategy), this.manifestChange$.emit({ manifest: e2, map: this.virtualPageMap }), this.eagerPrefetchFromManifest();
|
|
2465
2488
|
}
|
|
2466
2489
|
eagerPrefetchFromManifest() {
|
|
2467
2490
|
const t17 = this.config.prefetchChapters ?? 0;
|
|
@@ -2585,11 +2608,11 @@ const oe = class t9 extends BasePlugin {
|
|
|
2585
2608
|
this.chapterStatus.get(t17) !== e2 && (this.chapterStatus.set(t17, e2), this.statusChange$.emit({ chapterId: t17, status: e2, ..."error" === e2 && a3 ? { error: { message: a3 } } : {} }));
|
|
2586
2609
|
}
|
|
2587
2610
|
};
|
|
2588
|
-
|
|
2589
|
-
let
|
|
2590
|
-
const
|
|
2611
|
+
he.id = "chapter-manager";
|
|
2612
|
+
let le = he;
|
|
2613
|
+
const de = class extends BasePlugin {
|
|
2591
2614
|
constructor(t17, e2) {
|
|
2592
|
-
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(le.id), this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
|
|
2593
2616
|
}
|
|
2594
2617
|
async initialize(t17) {
|
|
2595
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 }) => {
|
|
@@ -2597,8 +2620,7 @@ const he = class extends BasePlugin {
|
|
|
2597
2620
|
})), this.syncReadyChapterSizes();
|
|
2598
2621
|
}
|
|
2599
2622
|
isChapterDocumentReady(t17) {
|
|
2600
|
-
|
|
2601
|
-
const e2 = this.documentManager.provides().getDocumentState(t17);
|
|
2623
|
+
const e2 = this.coreState.core.documents[t17];
|
|
2602
2624
|
return !(!e2 || "loaded" !== e2.status || !e2.document) && e2.document.pages.length > 0;
|
|
2603
2625
|
}
|
|
2604
2626
|
refreshLayout() {
|
|
@@ -2609,12 +2631,14 @@ const he = class extends BasePlugin {
|
|
|
2609
2631
|
this.refreshLayout();
|
|
2610
2632
|
}
|
|
2611
2633
|
onDocumentLoaded(t17) {
|
|
2612
|
-
|
|
2613
|
-
|
|
2614
|
-
|
|
2634
|
+
var e2;
|
|
2635
|
+
if (0 === ((null == (e2 = this.virtualPageMap) ? void 0 : e2.pagesOfChapter(t17).length) ?? 0)) return;
|
|
2636
|
+
const a3 = this.documentManager.provides();
|
|
2637
|
+
a3.getActiveDocumentId() || a3.setActiveDocument(t17), this.harvestChapterSizes(t17), this.refreshLayout();
|
|
2615
2638
|
}
|
|
2616
2639
|
onDocumentClosed(t17) {
|
|
2617
|
-
|
|
2640
|
+
var e2;
|
|
2641
|
+
0 !== ((null == (e2 = this.virtualPageMap) ? void 0 : e2.pagesOfChapter(t17).length) ?? 0) && (this.dropChapterSizes(t17), this.refreshLayout());
|
|
2618
2642
|
}
|
|
2619
2643
|
buildCapability() {
|
|
2620
2644
|
return { registerViewport: (t17) => this.bindViewport(t17), reportChapterPageSizes: (t17, e2) => this.applyChapterPageSizes(t17, e2), getLayout: () => this.computeLayout(), getCurrentGlobalPageIndex: () => this.currentGlobalPageIndex, getVisibleGlobalPageIndices: () => this.currentVisible.slice(), scrollToGlobalPageIndex: (t17, e2) => this.scrollToIndex(t17, e2), scrollToChapter: (t17, e2) => this.scrollToChapter(t17, e2), scrollToGlobalPageNumber: (t17, e2) => this.scrollToGlobalNumber(t17, e2), scrollToGlobalPdfPoint: (t17, e2, a3) => this.scrollToGlobalPdfPoint(t17, e2, a3), onLayoutChange: this.layoutChange$.on, onVisibleChange: this.visibleChange$.on };
|
|
@@ -2757,11 +2781,11 @@ const he = class extends BasePlugin {
|
|
|
2757
2781
|
a3 && this.scrollToIndex(a3.globalPageIndex, e2);
|
|
2758
2782
|
}
|
|
2759
2783
|
};
|
|
2760
|
-
|
|
2761
|
-
let
|
|
2762
|
-
const
|
|
2784
|
+
de.id = "chapter-scroll";
|
|
2785
|
+
let ce = de;
|
|
2786
|
+
const ue = class t10 extends BasePlugin {
|
|
2763
2787
|
constructor(t17, e2) {
|
|
2764
|
-
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(ce.id), this.chapterManager = this.registry.getPlugin(se.id), this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
|
|
2765
2789
|
}
|
|
2766
2790
|
async initialize(e2) {
|
|
2767
2791
|
if (this.config = e2, e2.callbacks.loadNotes) try {
|
|
@@ -2791,7 +2815,7 @@ const de = class t10 extends BasePlugin {
|
|
|
2791
2815
|
return Array.from(this.notes.values());
|
|
2792
2816
|
}
|
|
2793
2817
|
buildDraft(t17) {
|
|
2794
|
-
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: ge(t17.rectsPdfCoord), selectedText: t17.selectedText, content: t17.content };
|
|
2795
2819
|
}
|
|
2796
2820
|
async requestCreateFromSelection(t17) {
|
|
2797
2821
|
if (0 === t17.rectsPdfCoord.length) return null;
|
|
@@ -2858,15 +2882,15 @@ const de = class t10 extends BasePlugin {
|
|
|
2858
2882
|
});
|
|
2859
2883
|
}
|
|
2860
2884
|
};
|
|
2861
|
-
|
|
2862
|
-
let
|
|
2863
|
-
function
|
|
2885
|
+
ue.id = "note";
|
|
2886
|
+
let pe = ue;
|
|
2887
|
+
function ge(t17) {
|
|
2864
2888
|
const e2 = t17[t17.length - 1];
|
|
2865
2889
|
return { x: e2.origin.x + e2.size.width, y: e2.origin.y + e2.size.height };
|
|
2866
2890
|
}
|
|
2867
|
-
const
|
|
2868
|
-
const
|
|
2869
|
-
function
|
|
2891
|
+
const fe = { manifest: Zt, create: (t17) => new pe(Kt, t17), reducer: (t17) => t17, initialState: {} }, me = "paragraph-bookmark", ve = { id: me, name: "Paragraph Bookmark Plugin", version: "0.1.0", provides: ["paragraph-bookmark"], requires: ["chapter-scroll", "chapter-manager"], optional: [], defaultConfig: {} };
|
|
2892
|
+
const be = { kind: "first-wins" };
|
|
2893
|
+
function Pe(t17, e2, a3) {
|
|
2870
2894
|
if (1 === e2.length) return e2[0].chapterId;
|
|
2871
2895
|
switch (a3.kind) {
|
|
2872
2896
|
case "first-wins":
|
|
@@ -2884,7 +2908,7 @@ function ve(t17, e2, a3) {
|
|
|
2884
2908
|
return a3.resolve(t17, e2);
|
|
2885
2909
|
}
|
|
2886
2910
|
}
|
|
2887
|
-
let
|
|
2911
|
+
let we = class {
|
|
2888
2912
|
constructor(t17) {
|
|
2889
2913
|
this._pages = t17, this._byChapter = /* @__PURE__ */ new Map(), this._byGlobalNumber = /* @__PURE__ */ new Map();
|
|
2890
2914
|
for (const e2 of t17) {
|
|
@@ -2918,8 +2942,8 @@ let be = class {
|
|
|
2918
2942
|
return a3 ? this._pages.indexOf(a3) : -1;
|
|
2919
2943
|
}
|
|
2920
2944
|
};
|
|
2921
|
-
function
|
|
2922
|
-
const a3 = (function(t18, e3 =
|
|
2945
|
+
function Ie(t17, e2 = be) {
|
|
2946
|
+
const a3 = (function(t18, e3 = be) {
|
|
2923
2947
|
const a4 = /* @__PURE__ */ new Map();
|
|
2924
2948
|
for (const i2 of t18.chapters) {
|
|
2925
2949
|
const [t19, e4] = i2.globalPageRange;
|
|
@@ -2929,7 +2953,7 @@ function Pe(t17, e2 = me) {
|
|
|
2929
2953
|
}
|
|
2930
2954
|
}
|
|
2931
2955
|
const s10 = /* @__PURE__ */ new Map();
|
|
2932
|
-
for (const [i2, r3] of a4) s10.set(i2,
|
|
2956
|
+
for (const [i2, r3] of a4) s10.set(i2, Pe(i2, r3, e3));
|
|
2933
2957
|
return s10;
|
|
2934
2958
|
})(t17, e2), s9 = /* @__PURE__ */ new Map();
|
|
2935
2959
|
for (const n5 of t17.chapters) s9.set(n5.chapterId, n5);
|
|
@@ -2941,14 +2965,14 @@ function Pe(t17, e2 = me) {
|
|
|
2941
2965
|
const [i2] = e3.globalPageRange, [h] = e3.localPageRange, l2 = h + (n5 - i2);
|
|
2942
2966
|
r2.push({ globalPageIndex: o++, globalPageNumber: n5, chapterId: t18, localPageIndex: l2 });
|
|
2943
2967
|
}
|
|
2944
|
-
return new
|
|
2968
|
+
return new we(r2);
|
|
2945
2969
|
}
|
|
2946
|
-
const
|
|
2970
|
+
const ye = class t11 extends BasePlugin {
|
|
2947
2971
|
constructor(t17, e2) {
|
|
2948
|
-
super(t17, e2), this.statusChange$ = createBehaviorEmitter(), this.manifestChange$ = createEmitter(), this.overlapStrategy =
|
|
2972
|
+
super(t17, e2), this.statusChange$ = createBehaviorEmitter(), this.manifestChange$ = createEmitter(), this.overlapStrategy = be, 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);
|
|
2949
2973
|
}
|
|
2950
2974
|
async initialize(t17) {
|
|
2951
|
-
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 ?? be, this.setManifestInternal(t17.manifest), this.documentManagerUnsubs.push(this.documentManager.provides().onDocumentOpened((t18) => {
|
|
2952
2976
|
this.isOwnedChapter(t18.id) && (this.passwordAttempts.delete(t18.id), this.updateStatus(t18.id, "loaded"));
|
|
2953
2977
|
}), this.documentManager.provides().onDocumentClosed((t18) => {
|
|
2954
2978
|
this.isOwnedChapter(t18) && this.updateStatus(t18, "closed");
|
|
@@ -2983,7 +3007,7 @@ const we = class t11 extends BasePlugin {
|
|
|
2983
3007
|
const s9 = new Set(this.chapterStatus.keys()), i = new Set(e2.chapters.map((t17) => t17.chapterId));
|
|
2984
3008
|
for (const t17 of s9) i.has(t17) || (this.closeChapter(t17), this.chapterStatus.delete(t17));
|
|
2985
3009
|
for (const t17 of e2.chapters) this.chapterStatus.has(t17.chapterId) || this.chapterStatus.set(t17.chapterId, "idle");
|
|
2986
|
-
this.manifest = e2, this.virtualPageMap =
|
|
3010
|
+
this.manifest = e2, this.virtualPageMap = Ie(e2, this.overlapStrategy), this.manifestChange$.emit({ manifest: e2, map: this.virtualPageMap }), this.eagerPrefetchFromManifest();
|
|
2987
3011
|
}
|
|
2988
3012
|
eagerPrefetchFromManifest() {
|
|
2989
3013
|
const t17 = this.config.prefetchChapters ?? 0;
|
|
@@ -3107,10 +3131,10 @@ const we = class t11 extends BasePlugin {
|
|
|
3107
3131
|
this.chapterStatus.get(t17) !== e2 && (this.chapterStatus.set(t17, e2), this.statusChange$.emit({ chapterId: t17, status: e2, ..."error" === e2 && a3 ? { error: { message: a3 } } : {} }));
|
|
3108
3132
|
}
|
|
3109
3133
|
};
|
|
3110
|
-
|
|
3111
|
-
let
|
|
3112
|
-
const
|
|
3113
|
-
function
|
|
3134
|
+
ye.id = "chapter-manager";
|
|
3135
|
+
let Ce = ye;
|
|
3136
|
+
const Me = { kind: "first-wins" };
|
|
3137
|
+
function Se(t17, e2, a3) {
|
|
3114
3138
|
if (1 === e2.length) return e2[0].chapterId;
|
|
3115
3139
|
switch (a3.kind) {
|
|
3116
3140
|
case "first-wins":
|
|
@@ -3128,7 +3152,7 @@ function Ce(t17, e2, a3) {
|
|
|
3128
3152
|
return a3.resolve(t17, e2);
|
|
3129
3153
|
}
|
|
3130
3154
|
}
|
|
3131
|
-
class
|
|
3155
|
+
class xe {
|
|
3132
3156
|
constructor(t17) {
|
|
3133
3157
|
this._pages = t17, this._byChapter = /* @__PURE__ */ new Map(), this._byGlobalNumber = /* @__PURE__ */ new Map();
|
|
3134
3158
|
for (const e2 of t17) {
|
|
@@ -3162,8 +3186,8 @@ class Me {
|
|
|
3162
3186
|
return a3 ? this._pages.indexOf(a3) : -1;
|
|
3163
3187
|
}
|
|
3164
3188
|
}
|
|
3165
|
-
function
|
|
3166
|
-
const a3 = (function(t18, e3 =
|
|
3189
|
+
function $e(t17, e2 = Me) {
|
|
3190
|
+
const a3 = (function(t18, e3 = Me) {
|
|
3167
3191
|
const a4 = /* @__PURE__ */ new Map();
|
|
3168
3192
|
for (const i2 of t18.chapters) {
|
|
3169
3193
|
const [t19, e4] = i2.globalPageRange;
|
|
@@ -3173,7 +3197,7 @@ function Se(t17, e2 = ye) {
|
|
|
3173
3197
|
}
|
|
3174
3198
|
}
|
|
3175
3199
|
const s10 = /* @__PURE__ */ new Map();
|
|
3176
|
-
for (const [i2, r3] of a4) s10.set(i2,
|
|
3200
|
+
for (const [i2, r3] of a4) s10.set(i2, Se(i2, r3, e3));
|
|
3177
3201
|
return s10;
|
|
3178
3202
|
})(t17, e2), s9 = /* @__PURE__ */ new Map();
|
|
3179
3203
|
for (const n5 of t17.chapters) s9.set(n5.chapterId, n5);
|
|
@@ -3185,14 +3209,14 @@ function Se(t17, e2 = ye) {
|
|
|
3185
3209
|
const [i2] = e3.globalPageRange, [h] = e3.localPageRange, l2 = h + (n5 - i2);
|
|
3186
3210
|
r2.push({ globalPageIndex: o++, globalPageNumber: n5, chapterId: t18, localPageIndex: l2 });
|
|
3187
3211
|
}
|
|
3188
|
-
return new
|
|
3212
|
+
return new xe(r2);
|
|
3189
3213
|
}
|
|
3190
|
-
const
|
|
3214
|
+
const ke = class t12 extends BasePlugin {
|
|
3191
3215
|
constructor(t17, e2) {
|
|
3192
|
-
super(t17, e2), this.statusChange$ = createBehaviorEmitter(), this.manifestChange$ = createEmitter(), this.overlapStrategy =
|
|
3216
|
+
super(t17, e2), this.statusChange$ = createBehaviorEmitter(), this.manifestChange$ = createEmitter(), this.overlapStrategy = Me, 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);
|
|
3193
3217
|
}
|
|
3194
3218
|
async initialize(t17) {
|
|
3195
|
-
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 ?? Me, this.setManifestInternal(t17.manifest), this.documentManagerUnsubs.push(this.documentManager.provides().onDocumentOpened((t18) => {
|
|
3196
3220
|
this.isOwnedChapter(t18.id) && (this.passwordAttempts.delete(t18.id), this.updateStatus(t18.id, "loaded"));
|
|
3197
3221
|
}), this.documentManager.provides().onDocumentClosed((t18) => {
|
|
3198
3222
|
this.isOwnedChapter(t18) && this.updateStatus(t18, "closed");
|
|
@@ -3227,7 +3251,7 @@ const xe = class t12 extends BasePlugin {
|
|
|
3227
3251
|
const s9 = new Set(this.chapterStatus.keys()), i = new Set(e2.chapters.map((t17) => t17.chapterId));
|
|
3228
3252
|
for (const t17 of s9) i.has(t17) || (this.closeChapter(t17), this.chapterStatus.delete(t17));
|
|
3229
3253
|
for (const t17 of e2.chapters) this.chapterStatus.has(t17.chapterId) || this.chapterStatus.set(t17.chapterId, "idle");
|
|
3230
|
-
this.manifest = e2, this.virtualPageMap =
|
|
3254
|
+
this.manifest = e2, this.virtualPageMap = $e(e2, this.overlapStrategy), this.manifestChange$.emit({ manifest: e2, map: this.virtualPageMap }), this.eagerPrefetchFromManifest();
|
|
3231
3255
|
}
|
|
3232
3256
|
eagerPrefetchFromManifest() {
|
|
3233
3257
|
const t17 = this.config.prefetchChapters ?? 0;
|
|
@@ -3351,11 +3375,11 @@ const xe = class t12 extends BasePlugin {
|
|
|
3351
3375
|
this.chapterStatus.get(t17) !== e2 && (this.chapterStatus.set(t17, e2), this.statusChange$.emit({ chapterId: t17, status: e2, ..."error" === e2 && a3 ? { error: { message: a3 } } : {} }));
|
|
3352
3376
|
}
|
|
3353
3377
|
};
|
|
3354
|
-
|
|
3355
|
-
let
|
|
3356
|
-
const
|
|
3378
|
+
ke.id = "chapter-manager";
|
|
3379
|
+
let Le = ke;
|
|
3380
|
+
const ze = class extends BasePlugin {
|
|
3357
3381
|
constructor(t17, e2) {
|
|
3358
|
-
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(Le.id), this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
|
|
3359
3383
|
}
|
|
3360
3384
|
async initialize(t17) {
|
|
3361
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 }) => {
|
|
@@ -3363,8 +3387,7 @@ const ke = class extends BasePlugin {
|
|
|
3363
3387
|
})), this.syncReadyChapterSizes();
|
|
3364
3388
|
}
|
|
3365
3389
|
isChapterDocumentReady(t17) {
|
|
3366
|
-
|
|
3367
|
-
const e2 = this.documentManager.provides().getDocumentState(t17);
|
|
3390
|
+
const e2 = this.coreState.core.documents[t17];
|
|
3368
3391
|
return !(!e2 || "loaded" !== e2.status || !e2.document) && e2.document.pages.length > 0;
|
|
3369
3392
|
}
|
|
3370
3393
|
refreshLayout() {
|
|
@@ -3375,12 +3398,14 @@ const ke = class extends BasePlugin {
|
|
|
3375
3398
|
this.refreshLayout();
|
|
3376
3399
|
}
|
|
3377
3400
|
onDocumentLoaded(t17) {
|
|
3378
|
-
|
|
3379
|
-
|
|
3380
|
-
|
|
3401
|
+
var e2;
|
|
3402
|
+
if (0 === ((null == (e2 = this.virtualPageMap) ? void 0 : e2.pagesOfChapter(t17).length) ?? 0)) return;
|
|
3403
|
+
const a3 = this.documentManager.provides();
|
|
3404
|
+
a3.getActiveDocumentId() || a3.setActiveDocument(t17), this.harvestChapterSizes(t17), this.refreshLayout();
|
|
3381
3405
|
}
|
|
3382
3406
|
onDocumentClosed(t17) {
|
|
3383
|
-
|
|
3407
|
+
var e2;
|
|
3408
|
+
0 !== ((null == (e2 = this.virtualPageMap) ? void 0 : e2.pagesOfChapter(t17).length) ?? 0) && (this.dropChapterSizes(t17), this.refreshLayout());
|
|
3384
3409
|
}
|
|
3385
3410
|
buildCapability() {
|
|
3386
3411
|
return { registerViewport: (t17) => this.bindViewport(t17), reportChapterPageSizes: (t17, e2) => this.applyChapterPageSizes(t17, e2), getLayout: () => this.computeLayout(), getCurrentGlobalPageIndex: () => this.currentGlobalPageIndex, getVisibleGlobalPageIndices: () => this.currentVisible.slice(), scrollToGlobalPageIndex: (t17, e2) => this.scrollToIndex(t17, e2), scrollToChapter: (t17, e2) => this.scrollToChapter(t17, e2), scrollToGlobalPageNumber: (t17, e2) => this.scrollToGlobalNumber(t17, e2), scrollToGlobalPdfPoint: (t17, e2, a3) => this.scrollToGlobalPdfPoint(t17, e2, a3), onLayoutChange: this.layoutChange$.on, onVisibleChange: this.visibleChange$.on };
|
|
@@ -3523,36 +3548,36 @@ const ke = class extends BasePlugin {
|
|
|
3523
3548
|
a3 && this.scrollToIndex(a3.globalPageIndex, e2);
|
|
3524
3549
|
}
|
|
3525
3550
|
};
|
|
3526
|
-
|
|
3527
|
-
let
|
|
3528
|
-
function
|
|
3551
|
+
ze.id = "chapter-scroll";
|
|
3552
|
+
let De = ze;
|
|
3553
|
+
function Te(t17) {
|
|
3529
3554
|
if (0 === t17.length) throw new Error("unionRects: empty rects");
|
|
3530
3555
|
let e2 = 1 / 0, a3 = 1 / 0, s9 = -1 / 0, i = -1 / 0;
|
|
3531
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);
|
|
3532
3557
|
return { origin: { x: e2, y: a3 }, size: { width: s9 - e2, height: i - a3 } };
|
|
3533
3558
|
}
|
|
3534
|
-
function
|
|
3559
|
+
function Ge(t17) {
|
|
3535
3560
|
const e2 = t17[t17.length - 1];
|
|
3536
3561
|
return { x: e2.origin.x + e2.size.width, y: e2.origin.y + e2.size.height };
|
|
3537
3562
|
}
|
|
3538
|
-
function
|
|
3563
|
+
function Oe(t17, e2) {
|
|
3539
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);
|
|
3540
3565
|
if (o <= 0) return 0;
|
|
3541
3566
|
return Math.max(0, Math.min(s9, r2) - Math.max(a3, i)) / o;
|
|
3542
3567
|
}
|
|
3543
|
-
function
|
|
3568
|
+
function Ae(t17, e2) {
|
|
3544
3569
|
var a3, s9;
|
|
3545
3570
|
if (t17.chapterId !== e2.chapterId || t17.localPageIndex !== e2.localPageIndex) return false;
|
|
3546
|
-
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 ?? Ge(i), n5 = e2.markerAnchor ?? Ge(r2);
|
|
3547
3572
|
if (Math.hypot(o.x - n5.x, o.y - n5.y) <= 6) return true;
|
|
3548
3573
|
for (const h of i) for (const t18 of r2) {
|
|
3549
|
-
if (
|
|
3574
|
+
if (Oe(h, t18) < 0.5) continue;
|
|
3550
3575
|
const e3 = Math.max(h.origin.x, t18.origin.x);
|
|
3551
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;
|
|
3552
3577
|
}
|
|
3553
3578
|
return false;
|
|
3554
3579
|
}
|
|
3555
|
-
async function
|
|
3580
|
+
async function Ne(t17, e2, a3) {
|
|
3556
3581
|
t17.scrollToGlobalPageIndex(e2), await (function(t18, e3, a4 = 2500) {
|
|
3557
3582
|
const s9 = t18.getLayout().items.find((t19) => t19.globalPageIndex === e3 && !t19.isPlaceholder);
|
|
3558
3583
|
return s9 ? Promise.resolve(s9) : new Promise((s10) => {
|
|
@@ -3565,9 +3590,9 @@ async function Ae(t17, e2, a3) {
|
|
|
3565
3590
|
});
|
|
3566
3591
|
})(t17, e2), t17.scrollToGlobalPdfPoint(e2, a3, { marginTop: 80 });
|
|
3567
3592
|
}
|
|
3568
|
-
const
|
|
3593
|
+
const Ve = class t13 extends BasePlugin {
|
|
3569
3594
|
constructor(t17, e2) {
|
|
3570
|
-
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(De.id), this.chapterManager = this.registry.getPlugin(Ce.id), this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
|
|
3571
3596
|
}
|
|
3572
3597
|
async initialize(e2) {
|
|
3573
3598
|
var a3;
|
|
@@ -3583,7 +3608,7 @@ const Oe = class t13 extends BasePlugin {
|
|
|
3583
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 };
|
|
3584
3609
|
}
|
|
3585
3610
|
addBookmark(t17) {
|
|
3586
|
-
for (const s9 of this.entries.values()) if (
|
|
3611
|
+
for (const s9 of this.entries.values()) if (Ae(s9.anchor, t17.anchor)) return s9;
|
|
3587
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() };
|
|
3588
3613
|
return this.entries.set(e2, a3), this.notifyAndPersist(), a3;
|
|
3589
3614
|
}
|
|
@@ -3631,36 +3656,36 @@ const Oe = class t13 extends BasePlugin {
|
|
|
3631
3656
|
const e3 = t18.rectPdfCoord;
|
|
3632
3657
|
return e3.origin.y + e3.size.height;
|
|
3633
3658
|
})(e2.anchor);
|
|
3634
|
-
await
|
|
3659
|
+
await Ne(a3, s9, i);
|
|
3635
3660
|
}
|
|
3636
3661
|
};
|
|
3637
|
-
|
|
3638
|
-
let
|
|
3639
|
-
const
|
|
3640
|
-
function
|
|
3662
|
+
Ve.id = "paragraph-bookmark";
|
|
3663
|
+
let Re = Ve;
|
|
3664
|
+
const Ee = { manifest: ve, create: (t17) => new Re(me, t17), reducer: (t17) => t17, initialState: {} };
|
|
3665
|
+
function Ue(t17) {
|
|
3641
3666
|
const { provides: e2 } = useCapability(DocumentManagerPlugin.id);
|
|
3642
3667
|
useEffect(() => {
|
|
3643
3668
|
e2 && t17 && e2.isDocumentOpen(t17) && e2.setActiveDocument(t17);
|
|
3644
3669
|
}, [e2, t17]);
|
|
3645
3670
|
}
|
|
3646
|
-
function
|
|
3671
|
+
function _e() {
|
|
3647
3672
|
const { registry: t17 } = useRegistry();
|
|
3648
|
-
return !!(t17 == null ? void 0 : t17.getPlugin(
|
|
3673
|
+
return !!(t17 == null ? void 0 : t17.getPlugin(pe.id));
|
|
3649
3674
|
}
|
|
3650
|
-
function
|
|
3675
|
+
function Fe() {
|
|
3651
3676
|
const { registry: t17 } = useRegistry();
|
|
3652
|
-
return !!(t17 == null ? void 0 : t17.getPlugin(
|
|
3677
|
+
return !!(t17 == null ? void 0 : t17.getPlugin(Re.id));
|
|
3653
3678
|
}
|
|
3654
|
-
function
|
|
3679
|
+
function qe() {
|
|
3655
3680
|
const { registry: t17 } = useRegistry();
|
|
3656
3681
|
return useMemo(() => {
|
|
3657
|
-
var
|
|
3658
|
-
const e2 = (_b = (
|
|
3682
|
+
var _a2, _b;
|
|
3683
|
+
const e2 = (_b = (_a2 = t17 == null ? void 0 : t17.getPlugin(pe.id)) == null ? void 0 : _a2.provides) == null ? void 0 : _b.call(_a2);
|
|
3659
3684
|
return e2 ? (t18) => e2.createNoteFromSelection(t18) : null;
|
|
3660
3685
|
}, [t17]);
|
|
3661
3686
|
}
|
|
3662
|
-
function
|
|
3663
|
-
const u =
|
|
3687
|
+
function We({ item: e2, pdfPageWidth: a3, pdfPageHeight: o, cssPageWidth: l2, cssPageHeight: d, hoverUi: c }) {
|
|
3688
|
+
const u = jt(e2), { provides: p } = useCapability(SelectionPlugin.id), { provides: g } = useCapability(Re.id), f = useRef(null), [w, I] = useState(null), [y, C2] = useState(null), [M2, S2] = useState(null), x2 = (c == null ? void 0 : c.iconSize) ?? 16;
|
|
3664
3689
|
useEffect(() => {
|
|
3665
3690
|
if (!p) return;
|
|
3666
3691
|
const t17 = p.forDocument(u), a4 = () => {
|
|
@@ -3690,7 +3715,7 @@ function Fe({ item: e2, pdfPageWidth: a3, pdfPageHeight: o, cssPageWidth: l2, cs
|
|
|
3690
3715
|
if (p.forDocument(u).getState().selecting) return void C2(null);
|
|
3691
3716
|
} catch {
|
|
3692
3717
|
}
|
|
3693
|
-
const e3 =
|
|
3718
|
+
const e3 = f.current;
|
|
3694
3719
|
if (!e3) return;
|
|
3695
3720
|
const s9 = e3.getBoundingClientRect();
|
|
3696
3721
|
if (t18.clientX < s9.left || t18.clientX > s9.right || t18.clientY < s9.top || t18.clientY > s9.bottom) return void C2(null);
|
|
@@ -3709,176 +3734,172 @@ function Fe({ item: e2, pdfPageWidth: a3, pdfPageHeight: o, cssPageWidth: l2, cs
|
|
|
3709
3734
|
const k2 = ($2 == null ? void 0 : $2.length) ? (function(t17, e3, a4, s9) {
|
|
3710
3735
|
const i = a4.length > 0 ? a4 : [];
|
|
3711
3736
|
if (0 === i.length) throw new Error("buildParagraphBookmarkAnchor: no rects");
|
|
3712
|
-
return { chapterId: t17, localPageIndex: e3, globalPageIndex: null == s9 ? void 0 : s9.globalPageIndex, globalPageNumber: null == s9 ? void 0 : s9.globalPageNumber, rectPdfCoord:
|
|
3713
|
-
})(e2.chapterId, e2.localPageIndex, $2, { globalPageIndex: e2.globalPageIndex, globalPageNumber: e2.globalPageNumber }) : null, L2 = k2 && (g == null ? void 0 : g.listBookmarks().some((t17) =>
|
|
3737
|
+
return { chapterId: t17, localPageIndex: e3, globalPageIndex: null == s9 ? void 0 : s9.globalPageIndex, globalPageNumber: null == s9 ? void 0 : s9.globalPageNumber, rectPdfCoord: Te(i), rectsPdfCoord: i, markerAnchor: Ge(i) };
|
|
3738
|
+
})(e2.chapterId, e2.localPageIndex, $2, { globalPageIndex: e2.globalPageIndex, globalPageNumber: e2.globalPageNumber }) : null, L2 = k2 && (g == null ? void 0 : g.listBookmarks().some((t17) => Ae(t17.anchor, k2))), z2 = useCallback(() => {
|
|
3714
3739
|
g && k2 && !L2 && (g.addBookmark({ label: `书签 ${/* @__PURE__ */ (/* @__PURE__ */ new Date()).toLocaleTimeString("zh-CN", { hour: "2-digit", minute: "2-digit" })}`, anchor: k2 }), C2(null), S2(null));
|
|
3715
3740
|
}, [g, k2, L2]);
|
|
3716
3741
|
if (!g || !a3 || !o) return null;
|
|
3717
|
-
const
|
|
3718
|
-
return jsx("div", { ref:
|
|
3719
|
-
t17.stopPropagation(),
|
|
3720
|
-
}, style: { position: "absolute", left:
|
|
3721
|
-
t17.stopPropagation(),
|
|
3722
|
-
}, style: { position: "absolute", left:
|
|
3723
|
-
}
|
|
3724
|
-
const
|
|
3725
|
-
function
|
|
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;
|
|
3743
|
+
return jsx("div", { ref: f, style: { position: "absolute", inset: 0, zIndex: 14, pointerEvents: "none" }, children: $2 && G2 && !L2 && /* @__PURE__ */ jsx("div", { style: { position: "absolute", left: `${N2}px`, top: `${V2}px`, width: `${x2 + 20}px`, height: `${G2.size.height * T2 + x2 + 12}px`, pointerEvents: "auto" }, onMouseEnter: () => S2($2), onMouseLeave: () => S2(null), children: (c == null ? void 0 : c.renderAddIcon) ? /* @__PURE__ */ jsx("div", { role: "button", tabIndex: 0, title: "添加书签", onClick: (t17) => {
|
|
3744
|
+
t17.stopPropagation(), z2();
|
|
3745
|
+
}, style: { position: "absolute", left: O2 - N2 + "px", top: A2 - V2 + "px", width: x2, height: x2, cursor: "pointer", display: "flex", alignItems: "center", justifyContent: "center", background: "transparent", border: "none", padding: 0 }, children: c.renderAddIcon() }) : /* @__PURE__ */ jsx("button", { type: "button", title: "添加书签", onClick: (t17) => {
|
|
3746
|
+
t17.stopPropagation(), z2();
|
|
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
|
+
}
|
|
3749
|
+
const He = { position: "relative", height: "100%", width: "100%" }, Be = { height: "100%", width: "100%" }, je = { 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
|
+
function Xe(t17, e2) {
|
|
3726
3751
|
return 0 === e2 ? t17 : t17.map((t18) => ({ origin: { x: t18.origin.x, y: t18.origin.y + e2 }, size: { ...t18.size } }));
|
|
3727
3752
|
}
|
|
3728
|
-
function
|
|
3753
|
+
function Ke(t17) {
|
|
3729
3754
|
let e2 = 1 / 0, a3 = 1 / 0, s9 = -1 / 0, i = -1 / 0;
|
|
3730
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);
|
|
3731
3756
|
return { origin: { x: e2, y: a3 }, size: { width: s9 - e2, height: i - a3 } };
|
|
3732
3757
|
}
|
|
3733
|
-
function
|
|
3758
|
+
function Ze(t17, e2, a3, s9, i) {
|
|
3734
3759
|
const r2 = a3.forDocument(t17), o = s9.forDocument(t17);
|
|
3735
3760
|
if (!r2 || !o) return false;
|
|
3736
3761
|
const n5 = "highlight" === e2 ? "highlight" : "underline" === e2 ? "underline" : "squiggly" === e2 ? "squiggly" : "strikeout", h = a3.getTool(n5);
|
|
3737
3762
|
if (!h) return false;
|
|
3738
3763
|
const l2 = h.defaults, d = (function(t18, e3) {
|
|
3739
|
-
return { ...
|
|
3764
|
+
return { ...je[t18], ...null == e3 ? void 0 : e3[t18] };
|
|
3740
3765
|
})(e2, i), c = o.getFormattedSelection();
|
|
3741
3766
|
if (0 === c.length) return false;
|
|
3742
3767
|
r2.setLocked({ type: LockModeType.Exclude, categories: ["markup", "shape"] });
|
|
3743
3768
|
for (const u of c) {
|
|
3744
|
-
const t18 = uuidV4(), a4 = d.color ?? l2.color ?? l2.strokeColor, s10 = d.opacity ?? l2.opacity, i2 = d.thickness ?? l2.strokeWidth, o2 = d.offsetY ?? 0, n6 = "underline" === e2 || "squiggly" === e2 || "strikeout" === e2 ?
|
|
3745
|
-
r2.createAnnotation(u.pageIndex, { id: t18, created: /* @__PURE__ */ new Date(), flags: ["print"], type:
|
|
3769
|
+
const t18 = uuidV4(), a4 = d.color ?? l2.color ?? l2.strokeColor, s10 = d.opacity ?? l2.opacity, i2 = d.thickness ?? l2.strokeWidth, o2 = d.offsetY ?? 0, n6 = "underline" === e2 || "squiggly" === e2 || "strikeout" === e2 ? Xe(u.segmentRects, o2) : u.segmentRects, h2 = "underline" === e2 || "squiggly" === e2 || "strikeout" === e2 ? Ke(n6) : u.rect;
|
|
3770
|
+
r2.createAnnotation(u.pageIndex, { id: t18, created: /* @__PURE__ */ new Date(), flags: ["print"], type: Ye[e2], ..."highlight" === e2 ? { blendMode: PdfBlendMode.Multiply } : {}, strokeColor: a4, opacity: s10, ...null != i2 ? { strokeWidth: i2 } : {}, pageIndex: u.pageIndex, rect: h2, segmentRects: n6 });
|
|
3746
3771
|
}
|
|
3747
3772
|
return o.clear(), true;
|
|
3748
3773
|
}
|
|
3749
|
-
const
|
|
3750
|
-
function
|
|
3751
|
-
const h = new Set(o), l2 =
|
|
3752
|
-
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(
|
|
3774
|
+
const Qe = [{ id: "highlight", label: "高亮背景", icon: /* @__PURE__ */ jsx(aa, {}) }, { id: "underline", label: "下划线", icon: /* @__PURE__ */ jsx(sa, {}) }, { id: "squiggly", label: "波浪线", icon: /* @__PURE__ */ jsx(ia, {}) }, { id: "strikeout", label: "删除线", icon: /* @__PURE__ */ jsx(ra, {}) }, { id: "note", label: "添加笔记", icon: /* @__PURE__ */ jsx(oa, {}) }];
|
|
3775
|
+
function Je({ placementAbove: s9, anchorHeight: i, onAction: r2, hiddenBuiltinActions: o = [], extraActions: n5 = [] }) {
|
|
3776
|
+
const h = new Set(o), l2 = Qe.filter((t17) => "note" !== t17.id && !h.has(t17.id)), d = Qe.find((t17) => "note" === t17.id), c = d && !h.has("note"), u = [...n5].sort((t17, e2) => (t17.order ?? 0) - (e2.order ?? 0));
|
|
3777
|
+
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(ta, { label: e2.label, onClick: () => r2(e2.id), children: e2.icon }, e2.id)), u.map((e2) => /* @__PURE__ */ jsx(ta, { 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: [
|
|
3753
3778
|
/* @__PURE__ */ jsx("span", { style: { width: 1, height: 28, margin: "0 4px", background: "#e2e8f0", flexShrink: 0 }, "aria-hidden": true }),
|
|
3754
|
-
/* @__PURE__ */ jsx(
|
|
3779
|
+
/* @__PURE__ */ jsx(ta, { label: d.label, onClick: () => r2("note"), accent: true, children: d.icon })
|
|
3755
3780
|
] })] });
|
|
3756
3781
|
}
|
|
3757
|
-
function
|
|
3782
|
+
function ta({ label: e2, onClick: a3, accent: s9, children: i }) {
|
|
3758
3783
|
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) => {
|
|
3759
3784
|
t17.currentTarget.style.background = s9 ? "#fffbeb" : "#f1f5f9";
|
|
3760
3785
|
}, onMouseLeave: (t17) => {
|
|
3761
3786
|
t17.currentTarget.style.background = "transparent";
|
|
3762
3787
|
}, children: i });
|
|
3763
3788
|
}
|
|
3764
|
-
function
|
|
3789
|
+
function ea({ behind: a3, mark: s9 }) {
|
|
3765
3790
|
return jsxs("svg", { width: "28", height: "28", viewBox: "0 0 28 28", fill: "none", "aria-hidden": true, children: [
|
|
3766
3791
|
a3,
|
|
3767
3792
|
/* @__PURE__ */ jsx("text", { x: "14", y: "19", textAnchor: "middle", fontSize: "15", fontWeight: "700", fontFamily: "system-ui, sans-serif", fill: "#0f172a", children: "A" }),
|
|
3768
3793
|
s9
|
|
3769
3794
|
] });
|
|
3770
3795
|
}
|
|
3771
|
-
function
|
|
3772
|
-
return jsx(
|
|
3796
|
+
function aa() {
|
|
3797
|
+
return jsx(ea, { behind: /* @__PURE__ */ jsx("rect", { x: "5", y: "4", width: "18", height: "20", rx: "3", fill: "#facc15" }) });
|
|
3773
3798
|
}
|
|
3774
|
-
function
|
|
3775
|
-
return jsx(
|
|
3799
|
+
function sa() {
|
|
3800
|
+
return jsx(ea, { mark: /* @__PURE__ */ jsx("path", { d: "M6 22h16", stroke: "#dc2626", strokeWidth: "2.2", strokeLinecap: "round" }) });
|
|
3776
3801
|
}
|
|
3777
|
-
function
|
|
3778
|
-
return jsx(
|
|
3802
|
+
function ia() {
|
|
3803
|
+
return jsx(ea, { 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" }) });
|
|
3779
3804
|
}
|
|
3780
|
-
function
|
|
3781
|
-
return jsx(
|
|
3805
|
+
function ra() {
|
|
3806
|
+
return jsx(ea, { mark: /* @__PURE__ */ jsx("path", { d: "M5 14h18", stroke: "#dc2626", strokeWidth: "2.2", strokeLinecap: "round" }) });
|
|
3782
3807
|
}
|
|
3783
|
-
function
|
|
3808
|
+
function oa() {
|
|
3784
3809
|
return jsxs("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", "aria-hidden": true, children: [
|
|
3785
3810
|
/* @__PURE__ */ jsx("path", { d: "M8 3h8l4 4v14H8V3z", fill: "#fef3c7", stroke: "#d97706", strokeWidth: "1.2", strokeLinejoin: "round" }),
|
|
3786
3811
|
/* @__PURE__ */ jsx("path", { d: "M16 3v4h4", stroke: "#d97706", strokeWidth: "1.2" }),
|
|
3787
3812
|
/* @__PURE__ */ jsx("path", { d: "M10 12h6M10 16h4", stroke: "#92400e", strokeWidth: "1.2", strokeLinecap: "round" })
|
|
3788
3813
|
] });
|
|
3789
3814
|
}
|
|
3790
|
-
const
|
|
3791
|
-
function
|
|
3792
|
-
var
|
|
3793
|
-
const s9 = e2 == null ? void 0 : e2.selectionToolbar, i = false !== ((
|
|
3815
|
+
const na = { highlight: "highlight", underline: "underline", squiggly: "squiggly", strikeout: "strikeout" };
|
|
3816
|
+
function ha(e2, a3) {
|
|
3817
|
+
var _a2, _b, _c, _d;
|
|
3818
|
+
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);
|
|
3794
3819
|
if (false === (s9 == null ? void 0 : s9.enabled)) return;
|
|
3795
3820
|
if (!i && !r2 && !((_c = s9 == null ? void 0 : s9.extraActions) == null ? void 0 : _c.length)) return;
|
|
3796
|
-
const { provides: n5 } = useCapability(SelectionPlugin.id), { provides: l2 } = useCapability(AnnotationPlugin.id), { provides: d } = useCapability(
|
|
3821
|
+
const { provides: n5 } = useCapability(SelectionPlugin.id), { provides: l2 } = useCapability(AnnotationPlugin.id), { provides: d } = useCapability(pe.id);
|
|
3797
3822
|
return useMemo(() => (o) => {
|
|
3798
|
-
const h =
|
|
3823
|
+
const h = jt(o.item);
|
|
3799
3824
|
return (c) => {
|
|
3800
|
-
var
|
|
3801
|
-
return /* @__PURE__ */ jsx("div", { ...c.menuWrapperProps, children: /* @__PURE__ */ jsx(
|
|
3802
|
-
var
|
|
3825
|
+
var _a3;
|
|
3826
|
+
return /* @__PURE__ */ jsx("div", { ...c.menuWrapperProps, children: /* @__PURE__ */ jsx(Je, { placementAbove: !!((_a3 = c.placement) == null ? void 0 : _a3.suggestTop), anchorHeight: c.rect.size.height, onAction: (t17) => {
|
|
3827
|
+
var _a4, _b2;
|
|
3803
3828
|
if ("highlight" !== t17 && "underline" !== t17 && "squiggly" !== t17 && "strikeout" !== t17) {
|
|
3804
3829
|
if ("note" === t17) {
|
|
3805
3830
|
if (!n5 || !d || !r2) return;
|
|
3806
3831
|
const t18 = n5.getHighlightRectsForPage(o.item.localPageIndex, h);
|
|
3807
|
-
return void
|
|
3832
|
+
return void Yt(n5.getSelectedText(h), (e3) => {
|
|
3808
3833
|
d.requestCreateFromSelection({ chapterId: o.item.chapterId, localPageIndex: o.item.localPageIndex, globalPageIndex: o.item.globalPageIndex, globalPageNumber: o.item.globalPageNumber, rectsPdfCoord: t18, selectedText: e3.join("\n") });
|
|
3809
3834
|
});
|
|
3810
3835
|
}
|
|
3811
|
-
(
|
|
3836
|
+
(_a4 = a3 == null ? void 0 : a3.onExtraAction) == null ? void 0 : _a4.call(a3, t17, o);
|
|
3812
3837
|
} else {
|
|
3813
3838
|
if (!n5 || !l2 || !i) return;
|
|
3814
|
-
|
|
3839
|
+
Ze(h, na[t17], l2, n5, (_b2 = e2 == null ? void 0 : e2.markup) == null ? void 0 : _b2.styles);
|
|
3815
3840
|
}
|
|
3816
3841
|
}, hiddenBuiltinActions: s9 == null ? void 0 : s9.hiddenBuiltinActions, extraActions: s9 == null ? void 0 : s9.extraActions }) });
|
|
3817
3842
|
};
|
|
3818
3843
|
}, [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]);
|
|
3819
3844
|
}
|
|
3820
|
-
function
|
|
3821
|
-
var
|
|
3822
|
-
const f =
|
|
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(() => {
|
|
3823
3848
|
if (i || I) return (t17) => {
|
|
3824
3849
|
const e2 = I ? I(t17) : t17.defaultMenu;
|
|
3825
3850
|
return i ? i({ ...t17, defaultMenu: e2 }) : e2;
|
|
3826
3851
|
};
|
|
3827
3852
|
}, [i, I]), C2 = useMemo(() => c || w ? (s10) => {
|
|
3828
|
-
var
|
|
3829
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [w && /* @__PURE__ */ jsx(
|
|
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)] });
|
|
3830
3855
|
} : c, [(_d = u == null ? void 0 : u.bookmarks) == null ? void 0 : _d.hover, w, c]);
|
|
3831
|
-
return jsxs("div", { className: s9
|
|
3832
|
-
/* @__PURE__ */ jsx(
|
|
3833
|
-
var
|
|
3834
|
-
return /* @__PURE__ */ jsx(
|
|
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 });
|
|
3835
3860
|
} }),
|
|
3836
3861
|
g
|
|
3837
3862
|
] });
|
|
3838
3863
|
}
|
|
3839
|
-
function
|
|
3840
|
-
|
|
3841
|
-
|
|
3842
|
-
|
|
3843
|
-
|
|
3844
|
-
|
|
3845
|
-
|
|
3846
|
-
|
|
3847
|
-
|
|
3848
|
-
|
|
3849
|
-
|
|
3850
|
-
const t17 = M2 == null ? void 0 : M2.getDocument(C2);
|
|
3851
|
-
return t17 == null ? void 0 : t17.pages[a3.localPageIndex];
|
|
3852
|
-
}, [M2, C2, a3.localPageIndex]), x2 = (function(e2, a4) {
|
|
3853
|
-
const { provides: s10 } = useCapability(SelectionPlugin.id), i2 = Ht(e2);
|
|
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);
|
|
3854
3875
|
return useMemo(() => {
|
|
3855
3876
|
if (a4) return (r3) => {
|
|
3856
|
-
var
|
|
3857
|
-
const o = { position: "absolute", pointerEvents: "auto", left: "50%", transform: "translateX(-50%)", top: ((
|
|
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 };
|
|
3858
3879
|
return jsx("div", { ...r3.menuWrapperProps, children: /* @__PURE__ */ jsx("div", { style: o, children: /* @__PURE__ */ jsx("button", { type: "button", onClick: () => {
|
|
3859
3880
|
if (!s10) return;
|
|
3860
3881
|
const t17 = s10.getHighlightRectsForPage(e2.localPageIndex, i2);
|
|
3861
|
-
|
|
3862
|
-
const i3 = s11.join("\n"), r4 =
|
|
3882
|
+
Yt(s10.getSelectedText(i2), (s11) => {
|
|
3883
|
+
const i3 = s11.join("\n"), r4 = Xt(e2, t17, i3);
|
|
3863
3884
|
a4(r4);
|
|
3864
3885
|
});
|
|
3865
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: "添加附注" }) }) });
|
|
3866
3887
|
};
|
|
3867
3888
|
}, [a4, i2, e2, s10]);
|
|
3868
|
-
})(a3,
|
|
3869
|
-
return
|
|
3870
|
-
/* @__PURE__ */ jsx(
|
|
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 }),
|
|
3871
3892
|
/* @__PURE__ */ jsx(SelectionLayer, { documentId: C2, pageIndex: a3.localPageIndex, selectionMenu: $2 }),
|
|
3872
|
-
|
|
3873
|
-
/* @__PURE__ */ jsx(AnnotationLayer, { documentId: C2, pageIndex: a3.localPageIndex, selectionMenu:
|
|
3874
|
-
i && S2 && /* @__PURE__ */ jsx(
|
|
3875
|
-
|
|
3876
|
-
s9 && S2 && /* @__PURE__ */ jsx(
|
|
3877
|
-
] }) }) });
|
|
3878
|
-
}
|
|
3879
|
-
const
|
|
3880
|
-
const
|
|
3881
|
-
function
|
|
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
|
+
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
|
+
const ga = { kind: "first-wins" };
|
|
3902
|
+
function fa(t17, e2, a3) {
|
|
3882
3903
|
if (1 === e2.length) return e2[0].chapterId;
|
|
3883
3904
|
switch (a3.kind) {
|
|
3884
3905
|
case "first-wins":
|
|
@@ -3896,7 +3917,7 @@ function ca(t17, e2, a3) {
|
|
|
3896
3917
|
return a3.resolve(t17, e2);
|
|
3897
3918
|
}
|
|
3898
3919
|
}
|
|
3899
|
-
let
|
|
3920
|
+
let ma = class {
|
|
3900
3921
|
constructor(t17) {
|
|
3901
3922
|
this._pages = t17, this._byChapter = /* @__PURE__ */ new Map(), this._byGlobalNumber = /* @__PURE__ */ new Map();
|
|
3902
3923
|
for (const e2 of t17) {
|
|
@@ -3930,8 +3951,8 @@ let ua = class {
|
|
|
3930
3951
|
return a3 ? this._pages.indexOf(a3) : -1;
|
|
3931
3952
|
}
|
|
3932
3953
|
};
|
|
3933
|
-
function
|
|
3934
|
-
const a3 = (function(t18, e3 =
|
|
3954
|
+
function va(t17, e2 = ga) {
|
|
3955
|
+
const a3 = (function(t18, e3 = ga) {
|
|
3935
3956
|
const a4 = /* @__PURE__ */ new Map();
|
|
3936
3957
|
for (const i2 of t18.chapters) {
|
|
3937
3958
|
const [t19, e4] = i2.globalPageRange;
|
|
@@ -3941,7 +3962,7 @@ function pa(t17, e2 = da) {
|
|
|
3941
3962
|
}
|
|
3942
3963
|
}
|
|
3943
3964
|
const s10 = /* @__PURE__ */ new Map();
|
|
3944
|
-
for (const [i2, r3] of a4) s10.set(i2,
|
|
3965
|
+
for (const [i2, r3] of a4) s10.set(i2, fa(i2, r3, e3));
|
|
3945
3966
|
return s10;
|
|
3946
3967
|
})(t17, e2), s9 = /* @__PURE__ */ new Map();
|
|
3947
3968
|
for (const n5 of t17.chapters) s9.set(n5.chapterId, n5);
|
|
@@ -3953,14 +3974,14 @@ function pa(t17, e2 = da) {
|
|
|
3953
3974
|
const [i2] = e3.globalPageRange, [h] = e3.localPageRange, l2 = h + (n5 - i2);
|
|
3954
3975
|
r2.push({ globalPageIndex: o++, globalPageNumber: n5, chapterId: t18, localPageIndex: l2 });
|
|
3955
3976
|
}
|
|
3956
|
-
return new
|
|
3977
|
+
return new ma(r2);
|
|
3957
3978
|
}
|
|
3958
|
-
const
|
|
3979
|
+
const ba = class t14 extends BasePlugin {
|
|
3959
3980
|
constructor(t17, e2) {
|
|
3960
|
-
super(t17, e2), this.statusChange$ = createBehaviorEmitter(), this.manifestChange$ = createEmitter(), this.overlapStrategy =
|
|
3981
|
+
super(t17, e2), this.statusChange$ = createBehaviorEmitter(), this.manifestChange$ = createEmitter(), this.overlapStrategy = ga, this.chapterStatus = /* @__PURE__ */ new Map(), this.chapterLastUsed = /* @__PURE__ */ new Map(), this.passwordAttempts = /* @__PURE__ */ new Map(), this.pendingLoadPromises = /* @__PURE__ */ new Map(), this.unloadTimer = null, this.documentManagerUnsubs = [], this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
|
|
3961
3982
|
}
|
|
3962
3983
|
async initialize(t17) {
|
|
3963
|
-
if (this.config = t17, this.passwordProvider = t17.passwordProvider, this.overlapStrategy = t17.overlapStrategy ??
|
|
3984
|
+
if (this.config = t17, this.passwordProvider = t17.passwordProvider, this.overlapStrategy = t17.overlapStrategy ?? ga, this.setManifestInternal(t17.manifest), this.documentManagerUnsubs.push(this.documentManager.provides().onDocumentOpened((t18) => {
|
|
3964
3985
|
this.isOwnedChapter(t18.id) && (this.passwordAttempts.delete(t18.id), this.updateStatus(t18.id, "loaded"));
|
|
3965
3986
|
}), this.documentManager.provides().onDocumentClosed((t18) => {
|
|
3966
3987
|
this.isOwnedChapter(t18) && this.updateStatus(t18, "closed");
|
|
@@ -3995,7 +4016,7 @@ const ga = class t14 extends BasePlugin {
|
|
|
3995
4016
|
const s9 = new Set(this.chapterStatus.keys()), i = new Set(e2.chapters.map((t17) => t17.chapterId));
|
|
3996
4017
|
for (const t17 of s9) i.has(t17) || (this.closeChapter(t17), this.chapterStatus.delete(t17));
|
|
3997
4018
|
for (const t17 of e2.chapters) this.chapterStatus.has(t17.chapterId) || this.chapterStatus.set(t17.chapterId, "idle");
|
|
3998
|
-
this.manifest = e2, this.virtualPageMap =
|
|
4019
|
+
this.manifest = e2, this.virtualPageMap = va(e2, this.overlapStrategy), this.manifestChange$.emit({ manifest: e2, map: this.virtualPageMap }), this.eagerPrefetchFromManifest();
|
|
3999
4020
|
}
|
|
4000
4021
|
eagerPrefetchFromManifest() {
|
|
4001
4022
|
const t17 = this.config.prefetchChapters ?? 0;
|
|
@@ -4119,11 +4140,11 @@ const ga = class t14 extends BasePlugin {
|
|
|
4119
4140
|
this.chapterStatus.get(t17) !== e2 && (this.chapterStatus.set(t17, e2), this.statusChange$.emit({ chapterId: t17, status: e2, ..."error" === e2 && a3 ? { error: { message: a3 } } : {} }));
|
|
4120
4141
|
}
|
|
4121
4142
|
};
|
|
4122
|
-
|
|
4123
|
-
let
|
|
4124
|
-
const
|
|
4125
|
-
const
|
|
4126
|
-
function
|
|
4143
|
+
ba.id = "chapter-manager";
|
|
4144
|
+
let Pa = ba;
|
|
4145
|
+
const wa = { manifest: pa, create: (t17) => new Pa(ua, t17), reducer: (t17) => t17, initialState: {} }, Ia = "chapter-scroll", ya = { id: Ia, name: "Chapter Scroll Plugin", version: "0.1.0", provides: ["chapter-scroll"], requires: ["chapter-manager"], optional: [], defaultConfig: { placeholderPageHeight: 1200, placeholderPageWidth: 900, bufferSize: 2, pageGap: 20 } };
|
|
4146
|
+
const Ca = { kind: "first-wins" };
|
|
4147
|
+
function Ma(t17, e2, a3) {
|
|
4127
4148
|
if (1 === e2.length) return e2[0].chapterId;
|
|
4128
4149
|
switch (a3.kind) {
|
|
4129
4150
|
case "first-wins":
|
|
@@ -4141,7 +4162,7 @@ function wa(t17, e2, a3) {
|
|
|
4141
4162
|
return a3.resolve(t17, e2);
|
|
4142
4163
|
}
|
|
4143
4164
|
}
|
|
4144
|
-
class
|
|
4165
|
+
class Sa {
|
|
4145
4166
|
constructor(t17) {
|
|
4146
4167
|
this._pages = t17, this._byChapter = /* @__PURE__ */ new Map(), this._byGlobalNumber = /* @__PURE__ */ new Map();
|
|
4147
4168
|
for (const e2 of t17) {
|
|
@@ -4175,8 +4196,8 @@ class Ia {
|
|
|
4175
4196
|
return a3 ? this._pages.indexOf(a3) : -1;
|
|
4176
4197
|
}
|
|
4177
4198
|
}
|
|
4178
|
-
function
|
|
4179
|
-
const a3 = (function(t18, e3 =
|
|
4199
|
+
function xa(t17, e2 = Ca) {
|
|
4200
|
+
const a3 = (function(t18, e3 = Ca) {
|
|
4180
4201
|
const a4 = /* @__PURE__ */ new Map();
|
|
4181
4202
|
for (const i2 of t18.chapters) {
|
|
4182
4203
|
const [t19, e4] = i2.globalPageRange;
|
|
@@ -4186,7 +4207,7 @@ function ya(t17, e2 = Pa) {
|
|
|
4186
4207
|
}
|
|
4187
4208
|
}
|
|
4188
4209
|
const s10 = /* @__PURE__ */ new Map();
|
|
4189
|
-
for (const [i2, r3] of a4) s10.set(i2,
|
|
4210
|
+
for (const [i2, r3] of a4) s10.set(i2, Ma(i2, r3, e3));
|
|
4190
4211
|
return s10;
|
|
4191
4212
|
})(t17, e2), s9 = /* @__PURE__ */ new Map();
|
|
4192
4213
|
for (const n5 of t17.chapters) s9.set(n5.chapterId, n5);
|
|
@@ -4198,14 +4219,14 @@ function ya(t17, e2 = Pa) {
|
|
|
4198
4219
|
const [i2] = e3.globalPageRange, [h] = e3.localPageRange, l2 = h + (n5 - i2);
|
|
4199
4220
|
r2.push({ globalPageIndex: o++, globalPageNumber: n5, chapterId: t18, localPageIndex: l2 });
|
|
4200
4221
|
}
|
|
4201
|
-
return new
|
|
4222
|
+
return new Sa(r2);
|
|
4202
4223
|
}
|
|
4203
|
-
const
|
|
4224
|
+
const $a = class t15 extends BasePlugin {
|
|
4204
4225
|
constructor(t17, e2) {
|
|
4205
|
-
super(t17, e2), this.statusChange$ = createBehaviorEmitter(), this.manifestChange$ = createEmitter(), this.overlapStrategy =
|
|
4226
|
+
super(t17, e2), this.statusChange$ = createBehaviorEmitter(), this.manifestChange$ = createEmitter(), this.overlapStrategy = Ca, this.chapterStatus = /* @__PURE__ */ new Map(), this.chapterLastUsed = /* @__PURE__ */ new Map(), this.passwordAttempts = /* @__PURE__ */ new Map(), this.pendingLoadPromises = /* @__PURE__ */ new Map(), this.unloadTimer = null, this.documentManagerUnsubs = [], this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
|
|
4206
4227
|
}
|
|
4207
4228
|
async initialize(t17) {
|
|
4208
|
-
if (this.config = t17, this.passwordProvider = t17.passwordProvider, this.overlapStrategy = t17.overlapStrategy ??
|
|
4229
|
+
if (this.config = t17, this.passwordProvider = t17.passwordProvider, this.overlapStrategy = t17.overlapStrategy ?? Ca, this.setManifestInternal(t17.manifest), this.documentManagerUnsubs.push(this.documentManager.provides().onDocumentOpened((t18) => {
|
|
4209
4230
|
this.isOwnedChapter(t18.id) && (this.passwordAttempts.delete(t18.id), this.updateStatus(t18.id, "loaded"));
|
|
4210
4231
|
}), this.documentManager.provides().onDocumentClosed((t18) => {
|
|
4211
4232
|
this.isOwnedChapter(t18) && this.updateStatus(t18, "closed");
|
|
@@ -4240,7 +4261,7 @@ const Ca = class t15 extends BasePlugin {
|
|
|
4240
4261
|
const s9 = new Set(this.chapterStatus.keys()), i = new Set(e2.chapters.map((t17) => t17.chapterId));
|
|
4241
4262
|
for (const t17 of s9) i.has(t17) || (this.closeChapter(t17), this.chapterStatus.delete(t17));
|
|
4242
4263
|
for (const t17 of e2.chapters) this.chapterStatus.has(t17.chapterId) || this.chapterStatus.set(t17.chapterId, "idle");
|
|
4243
|
-
this.manifest = e2, this.virtualPageMap =
|
|
4264
|
+
this.manifest = e2, this.virtualPageMap = xa(e2, this.overlapStrategy), this.manifestChange$.emit({ manifest: e2, map: this.virtualPageMap }), this.eagerPrefetchFromManifest();
|
|
4244
4265
|
}
|
|
4245
4266
|
eagerPrefetchFromManifest() {
|
|
4246
4267
|
const t17 = this.config.prefetchChapters ?? 0;
|
|
@@ -4364,11 +4385,11 @@ const Ca = class t15 extends BasePlugin {
|
|
|
4364
4385
|
this.chapterStatus.get(t17) !== e2 && (this.chapterStatus.set(t17, e2), this.statusChange$.emit({ chapterId: t17, status: e2, ..."error" === e2 && a3 ? { error: { message: a3 } } : {} }));
|
|
4365
4386
|
}
|
|
4366
4387
|
};
|
|
4367
|
-
|
|
4368
|
-
let
|
|
4369
|
-
const
|
|
4388
|
+
$a.id = "chapter-manager";
|
|
4389
|
+
let ka = $a;
|
|
4390
|
+
const La = class extends BasePlugin {
|
|
4370
4391
|
constructor(t17, e2) {
|
|
4371
|
-
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(
|
|
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(ka.id), this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
|
|
4372
4393
|
}
|
|
4373
4394
|
async initialize(t17) {
|
|
4374
4395
|
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 }) => {
|
|
@@ -4376,8 +4397,7 @@ const Sa = class extends BasePlugin {
|
|
|
4376
4397
|
})), this.syncReadyChapterSizes();
|
|
4377
4398
|
}
|
|
4378
4399
|
isChapterDocumentReady(t17) {
|
|
4379
|
-
|
|
4380
|
-
const e2 = this.documentManager.provides().getDocumentState(t17);
|
|
4400
|
+
const e2 = this.coreState.core.documents[t17];
|
|
4381
4401
|
return !(!e2 || "loaded" !== e2.status || !e2.document) && e2.document.pages.length > 0;
|
|
4382
4402
|
}
|
|
4383
4403
|
refreshLayout() {
|
|
@@ -4388,12 +4408,14 @@ const Sa = class extends BasePlugin {
|
|
|
4388
4408
|
this.refreshLayout();
|
|
4389
4409
|
}
|
|
4390
4410
|
onDocumentLoaded(t17) {
|
|
4391
|
-
|
|
4392
|
-
|
|
4393
|
-
|
|
4411
|
+
var e2;
|
|
4412
|
+
if (0 === ((null == (e2 = this.virtualPageMap) ? void 0 : e2.pagesOfChapter(t17).length) ?? 0)) return;
|
|
4413
|
+
const a3 = this.documentManager.provides();
|
|
4414
|
+
a3.getActiveDocumentId() || a3.setActiveDocument(t17), this.harvestChapterSizes(t17), this.refreshLayout();
|
|
4394
4415
|
}
|
|
4395
4416
|
onDocumentClosed(t17) {
|
|
4396
|
-
|
|
4417
|
+
var e2;
|
|
4418
|
+
0 !== ((null == (e2 = this.virtualPageMap) ? void 0 : e2.pagesOfChapter(t17).length) ?? 0) && (this.dropChapterSizes(t17), this.refreshLayout());
|
|
4397
4419
|
}
|
|
4398
4420
|
buildCapability() {
|
|
4399
4421
|
return { registerViewport: (t17) => this.bindViewport(t17), reportChapterPageSizes: (t17, e2) => this.applyChapterPageSizes(t17, e2), getLayout: () => this.computeLayout(), getCurrentGlobalPageIndex: () => this.currentGlobalPageIndex, getVisibleGlobalPageIndices: () => this.currentVisible.slice(), scrollToGlobalPageIndex: (t17, e2) => this.scrollToIndex(t17, e2), scrollToChapter: (t17, e2) => this.scrollToChapter(t17, e2), scrollToGlobalPageNumber: (t17, e2) => this.scrollToGlobalNumber(t17, e2), scrollToGlobalPdfPoint: (t17, e2, a3) => this.scrollToGlobalPdfPoint(t17, e2, a3), onLayoutChange: this.layoutChange$.on, onVisibleChange: this.visibleChange$.on };
|
|
@@ -4536,10 +4558,10 @@ const Sa = class extends BasePlugin {
|
|
|
4536
4558
|
a3 && this.scrollToIndex(a3.globalPageIndex, e2);
|
|
4537
4559
|
}
|
|
4538
4560
|
};
|
|
4539
|
-
|
|
4540
|
-
let
|
|
4541
|
-
const $a = { manifest: ba, create: (t17) => new xa(va, t17), reducer: (t17) => t17, initialState: {} }, ka = { "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 }] } };
|
|
4542
|
-
class
|
|
4561
|
+
La.id = "chapter-scroll";
|
|
4562
|
+
let za = La;
|
|
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 Ga {
|
|
4543
4565
|
constructor() {
|
|
4544
4566
|
this.specs = [];
|
|
4545
4567
|
}
|
|
@@ -4554,17 +4576,17 @@ class La {
|
|
|
4554
4576
|
return this.specs;
|
|
4555
4577
|
}
|
|
4556
4578
|
buildToolbars() {
|
|
4557
|
-
const t17 = structuredClone(
|
|
4579
|
+
const t17 = structuredClone(Ta);
|
|
4558
4580
|
for (const e2 of this.specs) {
|
|
4559
4581
|
const a3 = t17[e2.toolbarSlot];
|
|
4560
4582
|
if (!a3) continue;
|
|
4561
4583
|
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 ?? [] };
|
|
4562
|
-
a3.items =
|
|
4584
|
+
a3.items = Oa(a3.items, s9, e2.position);
|
|
4563
4585
|
}
|
|
4564
4586
|
return t17;
|
|
4565
4587
|
}
|
|
4566
4588
|
}
|
|
4567
|
-
function
|
|
4589
|
+
function Oa(t17, e2, a3) {
|
|
4568
4590
|
return (null == a3 ? void 0 : a3.after) || (null == a3 ? void 0 : a3.before) ? (function(t18, e3, a4) {
|
|
4569
4591
|
const s9 = (t19) => {
|
|
4570
4592
|
const i = [];
|
|
@@ -4576,44 +4598,44 @@ function Da(t17, e2, a3) {
|
|
|
4576
4598
|
return t18.map((t19) => "group" === t19.type ? { ...t19, items: [...t19.items, e3] } : t19);
|
|
4577
4599
|
})(t17, e2);
|
|
4578
4600
|
}
|
|
4579
|
-
const
|
|
4580
|
-
function
|
|
4601
|
+
const Aa = { annotate: "annotation-toolbar", shapes: "shapes-toolbar", insert: "insert-toolbar", form: "form-toolbar", redact: "redaction-toolbar" };
|
|
4602
|
+
function Na() {
|
|
4581
4603
|
return { "mode:view": { id: "mode:view", label: "View", categories: ["mode", "mode-view"], action: ({ registry: t17, documentId: e2 }) => {
|
|
4582
|
-
var
|
|
4583
|
-
const a3 = (
|
|
4604
|
+
var _a2, _b, _c, _d;
|
|
4605
|
+
const a3 = (_a2 = t17.getPlugin("ui")) == null ? void 0 : _a2.provides(), s9 = (_b = t17.getPlugin("interaction-manager")) == null ? void 0 : _b.provides();
|
|
4584
4606
|
a3 && s9 && ((_c = s9.forDocument(e2)) == null ? void 0 : _c.activateDefaultMode(), a3.forDocument(e2).closeToolbarSlot("top", "secondary"), (_d = t17.getPlugin(ANNOTATION_PLUGIN_ID)) == null ? void 0 : _d.provides().forDocument(e2).setLocked(((t18) => t18.getPluginConfig(ANNOTATION_PLUGIN_ID).locked ?? { type: LockModeType.None })(t17)));
|
|
4585
4607
|
}, active: ({ state: t17, documentId: e2 }) => !isToolbarOpen(t17.plugins, e2, "top", "secondary") }, "mode:annotate": { id: "mode:annotate", label: "Annotate", categories: ["mode", "mode-annotate", "annotation"], action: ({ registry: t17, documentId: e2 }) => {
|
|
4586
|
-
var
|
|
4587
|
-
const a3 = (
|
|
4608
|
+
var _a2, _b;
|
|
4609
|
+
const a3 = (_a2 = t17.getPlugin("ui")) == null ? void 0 : _a2.provides();
|
|
4588
4610
|
a3 && (a3.setActiveToolbar("top", "secondary", "annotation-toolbar", e2), (_b = t17.getPlugin(ANNOTATION_PLUGIN_ID)) == null ? void 0 : _b.provides().forDocument(e2).setLocked({ type: LockModeType.Include, categories: ["form"] }));
|
|
4589
4611
|
}, active: ({ state: t17, documentId: e2 }) => isToolbarOpen(t17.plugins, e2, "top", "secondary", "annotation-toolbar") }, "mode:shapes": { id: "mode:shapes", label: "Shapes", categories: ["mode", "mode-shapes", "annotation"], action: ({ registry: t17, documentId: e2 }) => {
|
|
4590
|
-
var
|
|
4591
|
-
const a3 = (
|
|
4612
|
+
var _a2, _b;
|
|
4613
|
+
const a3 = (_a2 = t17.getPlugin("ui")) == null ? void 0 : _a2.provides();
|
|
4592
4614
|
a3 && (a3.setActiveToolbar("top", "secondary", "shapes-toolbar", e2), (_b = t17.getPlugin(ANNOTATION_PLUGIN_ID)) == null ? void 0 : _b.provides().forDocument(e2).setLocked({ type: LockModeType.Include, categories: ["form"] }));
|
|
4593
4615
|
}, active: ({ state: t17, documentId: e2 }) => isToolbarOpen(t17.plugins, e2, "top", "secondary", "shapes-toolbar") }, "mode:insert": { id: "mode:insert", label: "Insert", categories: ["mode", "mode-insert", "insert"], action: ({ registry: t17, documentId: e2 }) => {
|
|
4594
|
-
var
|
|
4595
|
-
const a3 = (
|
|
4616
|
+
var _a2, _b;
|
|
4617
|
+
const a3 = (_a2 = t17.getPlugin("ui")) == null ? void 0 : _a2.provides();
|
|
4596
4618
|
a3 && (a3.setActiveToolbar("top", "secondary", "insert-toolbar", e2), (_b = t17.getPlugin(ANNOTATION_PLUGIN_ID)) == null ? void 0 : _b.provides().forDocument(e2).setLocked({ type: LockModeType.Include, categories: ["form"] }));
|
|
4597
4619
|
}, active: ({ state: t17, documentId: e2 }) => isToolbarOpen(t17.plugins, e2, "top", "secondary", "insert-toolbar") }, "mode:form": { id: "mode:form", label: "Form", categories: ["mode", "mode-form", "form"], action: ({ registry: t17, documentId: e2 }) => {
|
|
4598
|
-
var
|
|
4599
|
-
const a3 = (
|
|
4620
|
+
var _a2, _b;
|
|
4621
|
+
const a3 = (_a2 = t17.getPlugin("ui")) == null ? void 0 : _a2.provides();
|
|
4600
4622
|
a3 && (a3.setActiveToolbar("top", "secondary", "form-toolbar", e2), (_b = t17.getPlugin(ANNOTATION_PLUGIN_ID)) == null ? void 0 : _b.provides().forDocument(e2).setLocked({ type: LockModeType.None }));
|
|
4601
4623
|
}, active: ({ state: t17, documentId: e2 }) => isToolbarOpen(t17.plugins, e2, "top", "secondary", "form-toolbar") }, "mode:redact": { id: "mode:redact", label: "Redact", categories: ["mode", "mode-redact", "redaction"], action: ({ registry: t17, documentId: e2 }) => {
|
|
4602
|
-
var
|
|
4603
|
-
const a3 = (
|
|
4624
|
+
var _a2, _b;
|
|
4625
|
+
const a3 = (_a2 = t17.getPlugin("ui")) == null ? void 0 : _a2.provides();
|
|
4604
4626
|
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"] }));
|
|
4605
4627
|
}, active: ({ state: t17, documentId: e2 }) => isToolbarOpen(t17.plugins, e2, "top", "secondary", "redaction-toolbar") } };
|
|
4606
4628
|
}
|
|
4607
|
-
function
|
|
4608
|
-
var
|
|
4629
|
+
function Va(t17) {
|
|
4630
|
+
var _a2, _b, _c, _d, _e2, _f;
|
|
4609
4631
|
const e2 = t17.toolbar ?? {}, a3 = e2.enabledModes ?? ["view", "annotate", "shapes", "insert", "form", "redact"], s9 = a3.length > 0, { schema: i, operationRegistry: r2 } = (function(t18 = {}) {
|
|
4610
4632
|
var e3, a4, s10, i2, r3, o2;
|
|
4611
|
-
const n6 = new Set(t18.enabledModes ?? ["view", "annotate", "shapes", "insert", "form", "redact"]), h = new
|
|
4633
|
+
const n6 = new Set(t18.enabledModes ?? ["view", "annotate", "shapes", "insert", "form", "redact"]), h = new Ga();
|
|
4612
4634
|
(null == (e3 = t18.customOperations) ? void 0 : e3.length) && h.registerAll(t18.customOperations);
|
|
4613
4635
|
const l2 = h.buildToolbars(), d = {};
|
|
4614
4636
|
for (const u of n6) {
|
|
4615
4637
|
if ("view" === u) continue;
|
|
4616
|
-
const t19 =
|
|
4638
|
+
const t19 = Aa[u];
|
|
4617
4639
|
l2[t19] && (d[t19] = l2[t19]);
|
|
4618
4640
|
}
|
|
4619
4641
|
const c = (function(t19) {
|
|
@@ -4622,60 +4644,60 @@ function Ga(t17) {
|
|
|
4622
4644
|
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 }] };
|
|
4623
4645
|
})(n6);
|
|
4624
4646
|
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 };
|
|
4625
|
-
})({ ...e2, enabledModes: a3 }), o = { ...s9 ?
|
|
4626
|
-
return t17.notes && n5.push(createPluginRegistration(
|
|
4647
|
+
})({ ...e2, enabledModes: a3 }), o = { ...s9 ? Na() : {}, ...s9 ? Ra(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(Da, { 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 })] : []];
|
|
4648
|
+
return t17.notes && n5.push(createPluginRegistration(fe, { callbacks: t17.notes.callbacks, ui: (_b = (_a2 = t17.features) == null ? void 0 : _a2.notes) == null ? void 0 : _b.marker })), t17.bookmarks && n5.push(createPluginRegistration(Ee, { 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 };
|
|
4627
4649
|
}
|
|
4628
|
-
function
|
|
4650
|
+
function Ra(t17) {
|
|
4629
4651
|
const e2 = {};
|
|
4630
4652
|
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 }) => {
|
|
4631
|
-
var
|
|
4632
|
-
(
|
|
4653
|
+
var _a2;
|
|
4654
|
+
(_a2 = a3.handler) == null ? void 0 : _a2.call(a3, { documentId: t18, chapterId: t18 });
|
|
4633
4655
|
} });
|
|
4634
4656
|
return e2;
|
|
4635
4657
|
}
|
|
4636
|
-
const
|
|
4637
|
-
function
|
|
4638
|
-
var
|
|
4639
|
-
return
|
|
4658
|
+
const Ea = { markup: { enabled: true }, bookmarks: { enabled: true }, notes: { enabled: true }, selectionToolbar: { enabled: true }, zoom: { enabled: true, min: 0.5, max: 3, initial: 1 } };
|
|
4659
|
+
function Ua(t17) {
|
|
4660
|
+
var _a2, _b, _c, _d, _e2;
|
|
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 } } });
|
|
4640
4662
|
}
|
|
4641
|
-
function
|
|
4663
|
+
function _a(t17, e2, a3) {
|
|
4642
4664
|
return Math.min(a3, Math.max(e2, t17));
|
|
4643
4665
|
}
|
|
4644
|
-
function
|
|
4645
|
-
var
|
|
4646
|
-
const m = useMemo(() => ({ ...
|
|
4666
|
+
function Fa({ engine: a3, editorOptions: n5, features: h, className: l2, viewportClassName: d, buildSelectionMenu: u, onExtraSelectionAction: p, renderPageOverlay: g, children: f }) {
|
|
4667
|
+
var _a2, _b, _c, _d;
|
|
4668
|
+
const m = useMemo(() => ({ ...Ea, ...h }), [h]), v = useMemo(() => Ua({ ...n5, features: m }), [n5, m]), b = false !== ((_a2 = m.zoom) == null ? void 0 : _a2.enabled), [P, w] = useState(((_b = m.zoom) == null ? void 0 : _b.initial) ?? 1), I = useRef(null);
|
|
4647
4669
|
return useEffect(() => {
|
|
4648
|
-
var
|
|
4670
|
+
var _a3, _b2;
|
|
4649
4671
|
if (!b) return;
|
|
4650
4672
|
const t17 = I.current;
|
|
4651
4673
|
if (!t17) return;
|
|
4652
4674
|
const e2 = t17.querySelector("[data-chapter-scroll-viewport]");
|
|
4653
4675
|
return e2 ? (function({ container: t18, getScale: e3, setScale: a4, minZoom: s9 = 0.5, maxZoom: i = 3 }) {
|
|
4654
4676
|
let r2 = 0, o = 1, n6 = null, h2 = 1, l3 = 1;
|
|
4655
|
-
const
|
|
4656
|
-
(t19.ctrlKey || t19.metaKey) && (t19.preventDefault(), null === n6 ? (l3 = e3(), h2 = 1) : clearTimeout(n6), h2 *= 1 - 0.01 * t19.deltaY, h2 =
|
|
4677
|
+
const d2 = (t19) => {
|
|
4678
|
+
(t19.ctrlKey || t19.metaKey) && (t19.preventDefault(), null === n6 ? (l3 = e3(), h2 = 1) : clearTimeout(n6), h2 *= 1 - 0.01 * t19.deltaY, h2 = _a(h2, 0.1, 10), a4(_a(l3 * h2, s9, i)), n6 = setTimeout(() => {
|
|
4657
4679
|
n6 = null;
|
|
4658
4680
|
}, 120));
|
|
4659
|
-
},
|
|
4660
|
-
if (
|
|
4661
|
-
const [t20, a5] = [...
|
|
4681
|
+
}, c = /* @__PURE__ */ new Map(), u2 = (t19) => {
|
|
4682
|
+
if (c.set(t19.pointerId, { x: t19.clientX, y: t19.clientY }), 2 === c.size) {
|
|
4683
|
+
const [t20, a5] = [...c.values()];
|
|
4662
4684
|
r2 = Math.hypot(a5.x - t20.x, a5.y - t20.y), o = e3();
|
|
4663
4685
|
}
|
|
4664
4686
|
}, p2 = (t19) => {
|
|
4665
|
-
if (
|
|
4687
|
+
if (c.has(t19.pointerId) && (c.set(t19.pointerId, { x: t19.clientX, y: t19.clientY }), 2 === c.size && r2 > 0)) {
|
|
4666
4688
|
t19.preventDefault();
|
|
4667
|
-
const [e4, n7] = [...
|
|
4668
|
-
a4(
|
|
4689
|
+
const [e4, n7] = [...c.values()], h3 = Math.hypot(n7.x - e4.x, n7.y - e4.y);
|
|
4690
|
+
a4(_a(o * (h3 / r2), s9, i));
|
|
4669
4691
|
}
|
|
4670
4692
|
}, g2 = (t19) => {
|
|
4671
|
-
|
|
4693
|
+
c.delete(t19.pointerId), c.size < 2 && (r2 = 0);
|
|
4672
4694
|
};
|
|
4673
|
-
return t18.addEventListener("wheel",
|
|
4674
|
-
t18.removeEventListener("wheel",
|
|
4695
|
+
return t18.addEventListener("wheel", d2, { passive: false }), t18.addEventListener("pointerdown", u2), t18.addEventListener("pointermove", p2, { passive: false }), t18.addEventListener("pointerup", g2), t18.addEventListener("pointercancel", g2), () => {
|
|
4696
|
+
t18.removeEventListener("wheel", d2), t18.removeEventListener("pointerdown", u2), t18.removeEventListener("pointermove", p2), t18.removeEventListener("pointerup", g2), t18.removeEventListener("pointercancel", g2), n6 && clearTimeout(n6);
|
|
4675
4697
|
};
|
|
4676
|
-
})({ container: e2, getScale: () => P, setScale: w, minZoom: ((
|
|
4677
|
-
}, [(_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
|
|
4678
|
-
/* @__PURE__ */ jsx(
|
|
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 }),
|
|
4679
4701
|
f
|
|
4680
4702
|
] }) : null }) });
|
|
4681
4703
|
}
|
|
@@ -5179,8 +5201,7 @@ const U = class extends BasePlugin {
|
|
|
5179
5201
|
})), this.syncReadyChapterSizes();
|
|
5180
5202
|
}
|
|
5181
5203
|
isChapterDocumentReady(t17) {
|
|
5182
|
-
|
|
5183
|
-
const e2 = this.documentManager.provides().getDocumentState(t17);
|
|
5204
|
+
const e2 = this.coreState.core.documents[t17];
|
|
5184
5205
|
return !(!e2 || "loaded" !== e2.status || !e2.document) && e2.document.pages.length > 0;
|
|
5185
5206
|
}
|
|
5186
5207
|
refreshLayout() {
|
|
@@ -5191,12 +5212,14 @@ const U = class extends BasePlugin {
|
|
|
5191
5212
|
this.refreshLayout();
|
|
5192
5213
|
}
|
|
5193
5214
|
onDocumentLoaded(t17) {
|
|
5194
|
-
|
|
5195
|
-
|
|
5196
|
-
|
|
5215
|
+
var e2;
|
|
5216
|
+
if (0 === ((null == (e2 = this.virtualPageMap) ? void 0 : e2.pagesOfChapter(t17).length) ?? 0)) return;
|
|
5217
|
+
const a3 = this.documentManager.provides();
|
|
5218
|
+
a3.getActiveDocumentId() || a3.setActiveDocument(t17), this.harvestChapterSizes(t17), this.refreshLayout();
|
|
5197
5219
|
}
|
|
5198
5220
|
onDocumentClosed(t17) {
|
|
5199
|
-
|
|
5221
|
+
var e2;
|
|
5222
|
+
0 !== ((null == (e2 = this.virtualPageMap) ? void 0 : e2.pagesOfChapter(t17).length) ?? 0) && (this.dropChapterSizes(t17), this.refreshLayout());
|
|
5200
5223
|
}
|
|
5201
5224
|
buildCapability() {
|
|
5202
5225
|
return { registerViewport: (t17) => this.bindViewport(t17), reportChapterPageSizes: (t17, e2) => this.applyChapterPageSizes(t17, e2), getLayout: () => this.computeLayout(), getCurrentGlobalPageIndex: () => this.currentGlobalPageIndex, getVisibleGlobalPageIndices: () => this.currentVisible.slice(), scrollToGlobalPageIndex: (t17, e2) => this.scrollToIndex(t17, e2), scrollToChapter: (t17, e2) => this.scrollToChapter(t17, e2), scrollToGlobalPageNumber: (t17, e2) => this.scrollToGlobalNumber(t17, e2), scrollToGlobalPdfPoint: (t17, e2, a3) => this.scrollToGlobalPdfPoint(t17, e2, a3), onLayoutChange: this.layoutChange$.on, onVisibleChange: this.visibleChange$.on };
|
|
@@ -5586,7 +5609,7 @@ const J = class s3 extends BasePlugin {
|
|
|
5586
5609
|
}
|
|
5587
5610
|
};
|
|
5588
5611
|
J.id = "chapter-manager";
|
|
5589
|
-
let
|
|
5612
|
+
let Q2 = J;
|
|
5590
5613
|
const X = { kind: "first-wins" };
|
|
5591
5614
|
function Y(t17, e2, a3) {
|
|
5592
5615
|
if (1 === e2.length) return e2[0].chapterId;
|
|
@@ -5606,7 +5629,7 @@ function Y(t17, e2, a3) {
|
|
|
5606
5629
|
return a3.resolve(t17, e2);
|
|
5607
5630
|
}
|
|
5608
5631
|
}
|
|
5609
|
-
let
|
|
5632
|
+
let Z = class {
|
|
5610
5633
|
constructor(t17) {
|
|
5611
5634
|
this._pages = t17, this._byChapter = /* @__PURE__ */ new Map(), this._byGlobalNumber = /* @__PURE__ */ new Map();
|
|
5612
5635
|
for (const e2 of t17) {
|
|
@@ -5663,9 +5686,9 @@ function tt(t17, e2 = X) {
|
|
|
5663
5686
|
const [i2] = e3.globalPageRange, [h] = e3.localPageRange, d = h + (n5 - i2);
|
|
5664
5687
|
o.push({ globalPageIndex: r2++, globalPageNumber: n5, chapterId: t18, localPageIndex: d });
|
|
5665
5688
|
}
|
|
5666
|
-
return new
|
|
5689
|
+
return new Z(o);
|
|
5667
5690
|
}
|
|
5668
|
-
const
|
|
5691
|
+
const et = class s4 extends BasePlugin {
|
|
5669
5692
|
constructor(t17, s9) {
|
|
5670
5693
|
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);
|
|
5671
5694
|
}
|
|
@@ -5829,11 +5852,11 @@ const et2 = class s4 extends BasePlugin {
|
|
|
5829
5852
|
this.chapterStatus.get(t17) !== e2 && (this.chapterStatus.set(t17, e2), this.statusChange$.emit({ chapterId: t17, status: e2, ..."error" === e2 && a3 ? { error: { message: a3 } } : {} }));
|
|
5830
5853
|
}
|
|
5831
5854
|
};
|
|
5832
|
-
|
|
5833
|
-
let
|
|
5855
|
+
et.id = "chapter-manager";
|
|
5856
|
+
let at2 = et;
|
|
5834
5857
|
const st = class extends BasePlugin {
|
|
5835
5858
|
constructor(t17, a3) {
|
|
5836
|
-
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(
|
|
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(at2.id), this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
|
|
5837
5860
|
}
|
|
5838
5861
|
async initialize(t17) {
|
|
5839
5862
|
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 }) => {
|
|
@@ -5841,8 +5864,7 @@ const st = class extends BasePlugin {
|
|
|
5841
5864
|
})), this.syncReadyChapterSizes();
|
|
5842
5865
|
}
|
|
5843
5866
|
isChapterDocumentReady(t17) {
|
|
5844
|
-
|
|
5845
|
-
const e2 = this.documentManager.provides().getDocumentState(t17);
|
|
5867
|
+
const e2 = this.coreState.core.documents[t17];
|
|
5846
5868
|
return !(!e2 || "loaded" !== e2.status || !e2.document) && e2.document.pages.length > 0;
|
|
5847
5869
|
}
|
|
5848
5870
|
refreshLayout() {
|
|
@@ -5853,12 +5875,14 @@ const st = class extends BasePlugin {
|
|
|
5853
5875
|
this.refreshLayout();
|
|
5854
5876
|
}
|
|
5855
5877
|
onDocumentLoaded(t17) {
|
|
5856
|
-
|
|
5857
|
-
|
|
5858
|
-
|
|
5878
|
+
var e2;
|
|
5879
|
+
if (0 === ((null == (e2 = this.virtualPageMap) ? void 0 : e2.pagesOfChapter(t17).length) ?? 0)) return;
|
|
5880
|
+
const a3 = this.documentManager.provides();
|
|
5881
|
+
a3.getActiveDocumentId() || a3.setActiveDocument(t17), this.harvestChapterSizes(t17), this.refreshLayout();
|
|
5859
5882
|
}
|
|
5860
5883
|
onDocumentClosed(t17) {
|
|
5861
|
-
|
|
5884
|
+
var e2;
|
|
5885
|
+
0 !== ((null == (e2 = this.virtualPageMap) ? void 0 : e2.pagesOfChapter(t17).length) ?? 0) && (this.dropChapterSizes(t17), this.refreshLayout());
|
|
5862
5886
|
}
|
|
5863
5887
|
buildCapability() {
|
|
5864
5888
|
return { registerViewport: (t17) => this.bindViewport(t17), reportChapterPageSizes: (t17, e2) => this.applyChapterPageSizes(t17, e2), getLayout: () => this.computeLayout(), getCurrentGlobalPageIndex: () => this.currentGlobalPageIndex, getVisibleGlobalPageIndices: () => this.currentVisible.slice(), scrollToGlobalPageIndex: (t17, e2) => this.scrollToIndex(t17, e2), scrollToChapter: (t17, e2) => this.scrollToChapter(t17, e2), scrollToGlobalPageNumber: (t17, e2) => this.scrollToGlobalNumber(t17, e2), scrollToGlobalPdfPoint: (t17, e2, a3) => this.scrollToGlobalPdfPoint(t17, e2, a3), onLayoutChange: this.layoutChange$.on, onVisibleChange: this.visibleChange$.on };
|
|
@@ -6005,7 +6029,7 @@ st.id = "chapter-scroll";
|
|
|
6005
6029
|
let it = st;
|
|
6006
6030
|
const ot = class s5 extends BasePlugin {
|
|
6007
6031
|
constructor(t17, s9) {
|
|
6008
|
-
super(t17, s9), this.notesChange$ = createBehaviorEmitter([]), this.noteActivated$ = createEmitter(), this.notes = /* @__PURE__ */ new Map(), this.chapterScroll = this.registry.getPlugin(it.id), this.chapterManager = this.registry.getPlugin(
|
|
6032
|
+
super(t17, s9), this.notesChange$ = createBehaviorEmitter([]), this.noteActivated$ = createEmitter(), this.notes = /* @__PURE__ */ new Map(), this.chapterScroll = this.registry.getPlugin(it.id), this.chapterManager = this.registry.getPlugin(Q2.id), this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
|
|
6009
6033
|
}
|
|
6010
6034
|
async initialize(t17) {
|
|
6011
6035
|
if (this.config = t17, t17.callbacks.loadNotes) try {
|
|
@@ -6035,7 +6059,7 @@ const ot = class s5 extends BasePlugin {
|
|
|
6035
6059
|
return Array.from(this.notes.values());
|
|
6036
6060
|
}
|
|
6037
6061
|
buildDraft(t17) {
|
|
6038
|
-
return { chapterId: t17.chapterId, localPageIndex: t17.localPageIndex, globalPageNumber: t17.globalPageNumber, globalPageIndex: t17.globalPageIndex, rectsPdfCoord: t17.rectsPdfCoord, endAnchor:
|
|
6062
|
+
return { chapterId: t17.chapterId, localPageIndex: t17.localPageIndex, globalPageNumber: t17.globalPageNumber, globalPageIndex: t17.globalPageIndex, rectsPdfCoord: t17.rectsPdfCoord, endAnchor: nt(t17.rectsPdfCoord), selectedText: t17.selectedText, content: t17.content };
|
|
6039
6063
|
}
|
|
6040
6064
|
async requestCreateFromSelection(t17) {
|
|
6041
6065
|
if (0 === t17.rectsPdfCoord.length) return null;
|
|
@@ -6104,11 +6128,11 @@ const ot = class s5 extends BasePlugin {
|
|
|
6104
6128
|
};
|
|
6105
6129
|
ot.id = "note";
|
|
6106
6130
|
let rt = ot;
|
|
6107
|
-
function
|
|
6131
|
+
function nt(t17) {
|
|
6108
6132
|
const e2 = t17[t17.length - 1];
|
|
6109
6133
|
return { x: e2.origin.x + e2.size.width, y: e2.origin.y + e2.size.height };
|
|
6110
6134
|
}
|
|
6111
|
-
const ht = { manifest: W, create: (t17) => new rt(q, t17), reducer: (t17) => t17, initialState: {} }, dt = "paragraph-bookmark",
|
|
6135
|
+
const ht = { manifest: W, create: (t17) => new rt(q, t17), reducer: (t17) => t17, initialState: {} }, dt = "paragraph-bookmark", lt2 = { id: dt, name: "Paragraph Bookmark Plugin", version: "0.1.0", provides: ["paragraph-bookmark"], requires: ["chapter-scroll", "chapter-manager"], optional: [], defaultConfig: {} };
|
|
6112
6136
|
const ct = { kind: "first-wins" };
|
|
6113
6137
|
function ut(t17, e2, a3) {
|
|
6114
6138
|
if (1 === e2.length) return e2[0].chapterId;
|
|
@@ -6128,7 +6152,7 @@ function ut(t17, e2, a3) {
|
|
|
6128
6152
|
return a3.resolve(t17, e2);
|
|
6129
6153
|
}
|
|
6130
6154
|
}
|
|
6131
|
-
let
|
|
6155
|
+
let pt = class {
|
|
6132
6156
|
constructor(t17) {
|
|
6133
6157
|
this._pages = t17, this._byChapter = /* @__PURE__ */ new Map(), this._byGlobalNumber = /* @__PURE__ */ new Map();
|
|
6134
6158
|
for (const e2 of t17) {
|
|
@@ -6185,9 +6209,9 @@ function gt(t17, e2 = ct) {
|
|
|
6185
6209
|
const [i2] = e3.globalPageRange, [h] = e3.localPageRange, d = h + (n5 - i2);
|
|
6186
6210
|
o.push({ globalPageIndex: r2++, globalPageNumber: n5, chapterId: t18, localPageIndex: d });
|
|
6187
6211
|
}
|
|
6188
|
-
return new
|
|
6212
|
+
return new pt(o);
|
|
6189
6213
|
}
|
|
6190
|
-
const
|
|
6214
|
+
const ft2 = class s6 extends BasePlugin {
|
|
6191
6215
|
constructor(t17, s9) {
|
|
6192
6216
|
super(t17, s9), this.statusChange$ = createBehaviorEmitter(), this.manifestChange$ = createEmitter(), this.overlapStrategy = ct, 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);
|
|
6193
6217
|
}
|
|
@@ -6351,9 +6375,9 @@ const ft = class s6 extends BasePlugin {
|
|
|
6351
6375
|
this.chapterStatus.get(t17) !== e2 && (this.chapterStatus.set(t17, e2), this.statusChange$.emit({ chapterId: t17, status: e2, ..."error" === e2 && a3 ? { error: { message: a3 } } : {} }));
|
|
6352
6376
|
}
|
|
6353
6377
|
};
|
|
6354
|
-
|
|
6355
|
-
let mt =
|
|
6356
|
-
const
|
|
6378
|
+
ft2.id = "chapter-manager";
|
|
6379
|
+
let mt = ft2;
|
|
6380
|
+
const vt = { kind: "first-wins" };
|
|
6357
6381
|
function bt(t17, e2, a3) {
|
|
6358
6382
|
if (1 === e2.length) return e2[0].chapterId;
|
|
6359
6383
|
switch (a3.kind) {
|
|
@@ -6372,7 +6396,7 @@ function bt(t17, e2, a3) {
|
|
|
6372
6396
|
return a3.resolve(t17, e2);
|
|
6373
6397
|
}
|
|
6374
6398
|
}
|
|
6375
|
-
class
|
|
6399
|
+
class Pt2 {
|
|
6376
6400
|
constructor(t17) {
|
|
6377
6401
|
this._pages = t17, this._byChapter = /* @__PURE__ */ new Map(), this._byGlobalNumber = /* @__PURE__ */ new Map();
|
|
6378
6402
|
for (const e2 of t17) {
|
|
@@ -6406,8 +6430,8 @@ class Pt {
|
|
|
6406
6430
|
return a3 ? this._pages.indexOf(a3) : -1;
|
|
6407
6431
|
}
|
|
6408
6432
|
}
|
|
6409
|
-
function wt(t17, e2 =
|
|
6410
|
-
const a3 = (function(t18, e3 =
|
|
6433
|
+
function wt(t17, e2 = vt) {
|
|
6434
|
+
const a3 = (function(t18, e3 = vt) {
|
|
6411
6435
|
const a4 = /* @__PURE__ */ new Map();
|
|
6412
6436
|
for (const i2 of t18.chapters) {
|
|
6413
6437
|
const [t19, e4] = i2.globalPageRange;
|
|
@@ -6429,14 +6453,14 @@ function wt(t17, e2 = vt2) {
|
|
|
6429
6453
|
const [i2] = e3.globalPageRange, [h] = e3.localPageRange, d = h + (n5 - i2);
|
|
6430
6454
|
o.push({ globalPageIndex: r2++, globalPageNumber: n5, chapterId: t18, localPageIndex: d });
|
|
6431
6455
|
}
|
|
6432
|
-
return new
|
|
6456
|
+
return new Pt2(o);
|
|
6433
6457
|
}
|
|
6434
6458
|
const yt = class s7 extends BasePlugin {
|
|
6435
6459
|
constructor(t17, s9) {
|
|
6436
|
-
super(t17, s9), this.statusChange$ = createBehaviorEmitter(), this.manifestChange$ = createEmitter(), this.overlapStrategy =
|
|
6460
|
+
super(t17, s9), this.statusChange$ = createBehaviorEmitter(), this.manifestChange$ = createEmitter(), this.overlapStrategy = vt, 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);
|
|
6437
6461
|
}
|
|
6438
6462
|
async initialize(t17) {
|
|
6439
|
-
if (this.config = t17, this.passwordProvider = t17.passwordProvider, this.overlapStrategy = t17.overlapStrategy ??
|
|
6463
|
+
if (this.config = t17, this.passwordProvider = t17.passwordProvider, this.overlapStrategy = t17.overlapStrategy ?? vt, this.setManifestInternal(t17.manifest), this.documentManagerUnsubs.push(this.documentManager.provides().onDocumentOpened((t18) => {
|
|
6440
6464
|
this.isOwnedChapter(t18.id) && (this.passwordAttempts.delete(t18.id), this.updateStatus(t18.id, "loaded"));
|
|
6441
6465
|
}), this.documentManager.provides().onDocumentClosed((t18) => {
|
|
6442
6466
|
this.isOwnedChapter(t18) && this.updateStatus(t18, "closed");
|
|
@@ -6607,8 +6631,7 @@ const Ct = class extends BasePlugin {
|
|
|
6607
6631
|
})), this.syncReadyChapterSizes();
|
|
6608
6632
|
}
|
|
6609
6633
|
isChapterDocumentReady(t17) {
|
|
6610
|
-
|
|
6611
|
-
const e2 = this.documentManager.provides().getDocumentState(t17);
|
|
6634
|
+
const e2 = this.coreState.core.documents[t17];
|
|
6612
6635
|
return !(!e2 || "loaded" !== e2.status || !e2.document) && e2.document.pages.length > 0;
|
|
6613
6636
|
}
|
|
6614
6637
|
refreshLayout() {
|
|
@@ -6619,12 +6642,14 @@ const Ct = class extends BasePlugin {
|
|
|
6619
6642
|
this.refreshLayout();
|
|
6620
6643
|
}
|
|
6621
6644
|
onDocumentLoaded(t17) {
|
|
6622
|
-
|
|
6623
|
-
|
|
6624
|
-
|
|
6645
|
+
var e2;
|
|
6646
|
+
if (0 === ((null == (e2 = this.virtualPageMap) ? void 0 : e2.pagesOfChapter(t17).length) ?? 0)) return;
|
|
6647
|
+
const a3 = this.documentManager.provides();
|
|
6648
|
+
a3.getActiveDocumentId() || a3.setActiveDocument(t17), this.harvestChapterSizes(t17), this.refreshLayout();
|
|
6625
6649
|
}
|
|
6626
6650
|
onDocumentClosed(t17) {
|
|
6627
|
-
|
|
6651
|
+
var e2;
|
|
6652
|
+
0 !== ((null == (e2 = this.virtualPageMap) ? void 0 : e2.pagesOfChapter(t17).length) ?? 0) && (this.dropChapterSizes(t17), this.refreshLayout());
|
|
6628
6653
|
}
|
|
6629
6654
|
buildCapability() {
|
|
6630
6655
|
return { registerViewport: (t17) => this.bindViewport(t17), reportChapterPageSizes: (t17, e2) => this.applyChapterPageSizes(t17, e2), getLayout: () => this.computeLayout(), getCurrentGlobalPageIndex: () => this.currentGlobalPageIndex, getVisibleGlobalPageIndices: () => this.currentVisible.slice(), scrollToGlobalPageIndex: (t17, e2) => this.scrollToIndex(t17, e2), scrollToChapter: (t17, e2) => this.scrollToChapter(t17, e2), scrollToGlobalPageNumber: (t17, e2) => this.scrollToGlobalNumber(t17, e2), scrollToGlobalPdfPoint: (t17, e2, a3) => this.scrollToGlobalPdfPoint(t17, e2, a3), onLayoutChange: this.layoutChange$.on, onVisibleChange: this.visibleChange$.on };
|
|
@@ -6773,7 +6798,7 @@ function St(t17) {
|
|
|
6773
6798
|
const e2 = t17[t17.length - 1];
|
|
6774
6799
|
return { x: e2.origin.x + e2.size.width, y: e2.origin.y + e2.size.height };
|
|
6775
6800
|
}
|
|
6776
|
-
function
|
|
6801
|
+
function xt(t17, e2) {
|
|
6777
6802
|
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);
|
|
6778
6803
|
if (r2 <= 0) return 0;
|
|
6779
6804
|
return Math.max(0, Math.min(s9, o) - Math.max(a3, i)) / r2;
|
|
@@ -6784,7 +6809,7 @@ function $t(t17, e2) {
|
|
|
6784
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 ?? St(i), n5 = e2.markerAnchor ?? St(o);
|
|
6785
6810
|
if (Math.hypot(r2.x - n5.x, r2.y - n5.y) <= 6) return true;
|
|
6786
6811
|
for (const h of i) for (const t18 of o) {
|
|
6787
|
-
if (
|
|
6812
|
+
if (xt(h, t18) < 0.5) continue;
|
|
6788
6813
|
const e3 = Math.max(h.origin.x, t18.origin.x);
|
|
6789
6814
|
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;
|
|
6790
6815
|
}
|
|
@@ -6873,8 +6898,8 @@ const Dt = class a extends BasePlugin {
|
|
|
6873
6898
|
}
|
|
6874
6899
|
};
|
|
6875
6900
|
Dt.id = "paragraph-bookmark";
|
|
6876
|
-
let
|
|
6877
|
-
const kt = { manifest: lt, create: (t17) => new Tt2(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 }] } };
|
|
6901
|
+
let Tt = Dt;
|
|
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 }] } };
|
|
6878
6903
|
class Gt {
|
|
6879
6904
|
constructor() {
|
|
6880
6905
|
this.specs = [];
|
|
@@ -6895,12 +6920,12 @@ class Gt {
|
|
|
6895
6920
|
const a3 = t17[e2.toolbarSlot];
|
|
6896
6921
|
if (!a3) continue;
|
|
6897
6922
|
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 ?? [] };
|
|
6898
|
-
a3.items =
|
|
6923
|
+
a3.items = Ot2(a3.items, s9, e2.position);
|
|
6899
6924
|
}
|
|
6900
6925
|
return t17;
|
|
6901
6926
|
}
|
|
6902
6927
|
}
|
|
6903
|
-
function
|
|
6928
|
+
function Ot2(t17, e2, a3) {
|
|
6904
6929
|
return (null == a3 ? void 0 : a3.after) || (null == a3 ? void 0 : a3.before) ? (function(t18, e3, a4) {
|
|
6905
6930
|
const s9 = (t19) => {
|
|
6906
6931
|
const i = [];
|
|
@@ -6913,35 +6938,35 @@ function Ot(t17, e2, a3) {
|
|
|
6913
6938
|
})(t17, e2);
|
|
6914
6939
|
}
|
|
6915
6940
|
const At = { annotate: "annotation-toolbar", shapes: "shapes-toolbar", insert: "insert-toolbar", form: "form-toolbar", redact: "redaction-toolbar" };
|
|
6916
|
-
function
|
|
6941
|
+
function Nt() {
|
|
6917
6942
|
return { "mode:view": { id: "mode:view", label: "View", categories: ["mode", "mode-view"], action: ({ registry: t17, documentId: e2 }) => {
|
|
6918
|
-
var
|
|
6919
|
-
const a3 = (
|
|
6943
|
+
var _a2, _b, _c, _d;
|
|
6944
|
+
const a3 = (_a2 = t17.getPlugin("ui")) == null ? void 0 : _a2.provides(), s9 = (_b = t17.getPlugin("interaction-manager")) == null ? void 0 : _b.provides();
|
|
6920
6945
|
a3 && s9 && ((_c = s9.forDocument(e2)) == null ? void 0 : _c.activateDefaultMode(), a3.forDocument(e2).closeToolbarSlot("top", "secondary"), (_d = t17.getPlugin(ANNOTATION_PLUGIN_ID)) == null ? void 0 : _d.provides().forDocument(e2).setLocked(((t18) => t18.getPluginConfig(ANNOTATION_PLUGIN_ID).locked ?? { type: LockModeType.None })(t17)));
|
|
6921
6946
|
}, active: ({ state: t17, documentId: e2 }) => !isToolbarOpen(t17.plugins, e2, "top", "secondary") }, "mode:annotate": { id: "mode:annotate", label: "Annotate", categories: ["mode", "mode-annotate", "annotation"], action: ({ registry: t17, documentId: e2 }) => {
|
|
6922
|
-
var
|
|
6923
|
-
const a3 = (
|
|
6947
|
+
var _a2, _b;
|
|
6948
|
+
const a3 = (_a2 = t17.getPlugin("ui")) == null ? void 0 : _a2.provides();
|
|
6924
6949
|
a3 && (a3.setActiveToolbar("top", "secondary", "annotation-toolbar", e2), (_b = t17.getPlugin(ANNOTATION_PLUGIN_ID)) == null ? void 0 : _b.provides().forDocument(e2).setLocked({ type: LockModeType.Include, categories: ["form"] }));
|
|
6925
6950
|
}, active: ({ state: t17, documentId: e2 }) => isToolbarOpen(t17.plugins, e2, "top", "secondary", "annotation-toolbar") }, "mode:shapes": { id: "mode:shapes", label: "Shapes", categories: ["mode", "mode-shapes", "annotation"], action: ({ registry: t17, documentId: e2 }) => {
|
|
6926
|
-
var
|
|
6927
|
-
const a3 = (
|
|
6951
|
+
var _a2, _b;
|
|
6952
|
+
const a3 = (_a2 = t17.getPlugin("ui")) == null ? void 0 : _a2.provides();
|
|
6928
6953
|
a3 && (a3.setActiveToolbar("top", "secondary", "shapes-toolbar", e2), (_b = t17.getPlugin(ANNOTATION_PLUGIN_ID)) == null ? void 0 : _b.provides().forDocument(e2).setLocked({ type: LockModeType.Include, categories: ["form"] }));
|
|
6929
6954
|
}, active: ({ state: t17, documentId: e2 }) => isToolbarOpen(t17.plugins, e2, "top", "secondary", "shapes-toolbar") }, "mode:insert": { id: "mode:insert", label: "Insert", categories: ["mode", "mode-insert", "insert"], action: ({ registry: t17, documentId: e2 }) => {
|
|
6930
|
-
var
|
|
6931
|
-
const a3 = (
|
|
6955
|
+
var _a2, _b;
|
|
6956
|
+
const a3 = (_a2 = t17.getPlugin("ui")) == null ? void 0 : _a2.provides();
|
|
6932
6957
|
a3 && (a3.setActiveToolbar("top", "secondary", "insert-toolbar", e2), (_b = t17.getPlugin(ANNOTATION_PLUGIN_ID)) == null ? void 0 : _b.provides().forDocument(e2).setLocked({ type: LockModeType.Include, categories: ["form"] }));
|
|
6933
6958
|
}, active: ({ state: t17, documentId: e2 }) => isToolbarOpen(t17.plugins, e2, "top", "secondary", "insert-toolbar") }, "mode:form": { id: "mode:form", label: "Form", categories: ["mode", "mode-form", "form"], action: ({ registry: t17, documentId: e2 }) => {
|
|
6934
|
-
var
|
|
6935
|
-
const a3 = (
|
|
6959
|
+
var _a2, _b;
|
|
6960
|
+
const a3 = (_a2 = t17.getPlugin("ui")) == null ? void 0 : _a2.provides();
|
|
6936
6961
|
a3 && (a3.setActiveToolbar("top", "secondary", "form-toolbar", e2), (_b = t17.getPlugin(ANNOTATION_PLUGIN_ID)) == null ? void 0 : _b.provides().forDocument(e2).setLocked({ type: LockModeType.None }));
|
|
6937
6962
|
}, active: ({ state: t17, documentId: e2 }) => isToolbarOpen(t17.plugins, e2, "top", "secondary", "form-toolbar") }, "mode:redact": { id: "mode:redact", label: "Redact", categories: ["mode", "mode-redact", "redaction"], action: ({ registry: t17, documentId: e2 }) => {
|
|
6938
|
-
var
|
|
6939
|
-
const a3 = (
|
|
6963
|
+
var _a2, _b;
|
|
6964
|
+
const a3 = (_a2 = t17.getPlugin("ui")) == null ? void 0 : _a2.provides();
|
|
6940
6965
|
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"] }));
|
|
6941
6966
|
}, active: ({ state: t17, documentId: e2 }) => isToolbarOpen(t17.plugins, e2, "top", "secondary", "redaction-toolbar") } };
|
|
6942
6967
|
}
|
|
6943
6968
|
function Vt(t17) {
|
|
6944
|
-
var
|
|
6969
|
+
var _a2, _b, _c, _d, _e2, _f;
|
|
6945
6970
|
const e2 = t17.toolbar ?? {}, a3 = e2.enabledModes ?? ["view", "annotate", "shapes", "insert", "form", "redact"], i = a3.length > 0, { schema: l2, operationRegistry: c } = (function(t18 = {}) {
|
|
6946
6971
|
var e3, a4, s9, i2, o, r2;
|
|
6947
6972
|
const n5 = new Set(t18.enabledModes ?? ["view", "annotate", "shapes", "insert", "form", "redact"]), h = new Gt();
|
|
@@ -6958,21 +6983,21 @@ function Vt(t17) {
|
|
|
6958
6983
|
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 }] };
|
|
6959
6984
|
})(n5);
|
|
6960
6985
|
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 };
|
|
6961
|
-
})({ ...e2, enabledModes: a3 }), w = { ...i ?
|
|
6962
|
-
return t17.notes && I.push(createPluginRegistration(ht, { callbacks: t17.notes.callbacks, ui: (_b = (
|
|
6986
|
+
})({ ...e2, enabledModes: a3 }), w = { ...i ? Nt() : {}, ...i ? Rt2(c.list()) : {}, ...t17.commands ?? {} }, I = [createPluginRegistration(DocumentManagerPluginPackage, { initialDocuments: [] }), createPluginRegistration(k, { manifest: t17.manifest, overlapStrategy: t17.overlapStrategy, passwordProvider: t17.passwordProvider, chapterPdfLoader: t17.chapterPdfLoader, prefetchChapters: t17.prefetchChapters, unloadTimeoutMs: t17.unloadTimeoutMs }), createPluginRegistration(F, { 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 })] : []];
|
|
6987
|
+
return t17.notes && I.push(createPluginRegistration(ht, { callbacks: t17.notes.callbacks, ui: (_b = (_a2 = t17.features) == null ? void 0 : _a2.notes) == null ? void 0 : _b.marker })), t17.bookmarks && I.push(createPluginRegistration(kt2, { 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 };
|
|
6963
6988
|
}
|
|
6964
|
-
function
|
|
6989
|
+
function Rt2(t17) {
|
|
6965
6990
|
const e2 = {};
|
|
6966
6991
|
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 }) => {
|
|
6967
|
-
var
|
|
6968
|
-
(
|
|
6992
|
+
var _a2;
|
|
6993
|
+
(_a2 = a3.handler) == null ? void 0 : _a2.call(a3, { documentId: t18, chapterId: t18 });
|
|
6969
6994
|
} });
|
|
6970
6995
|
return e2;
|
|
6971
6996
|
}
|
|
6972
6997
|
const _t = { markup: { enabled: true }, bookmarks: { enabled: true }, notes: { enabled: true }, selectionToolbar: { enabled: true }, zoom: { enabled: true, min: 0.5, max: 3, initial: 1 } };
|
|
6973
6998
|
function Ut(t17) {
|
|
6974
|
-
var
|
|
6975
|
-
return Vt({ ...t17, toolbar: t17.toolbar ?? { enabledModes: [] }, features: { ..._t, ...t17.features, markup: { ..._t.markup, ...(
|
|
6999
|
+
var _a2, _b, _c, _d, _e2;
|
|
7000
|
+
return Vt({ ...t17, toolbar: t17.toolbar ?? { enabledModes: [] }, features: { ..._t, ...t17.features, markup: { ..._t.markup, ...(_a2 = t17.features) == null ? void 0 : _a2.markup }, bookmarks: { ..._t.bookmarks, ...(_b = t17.features) == null ? void 0 : _b.bookmarks }, notes: { ..._t.notes, ...(_c = t17.features) == null ? void 0 : _c.notes }, selectionToolbar: { ..._t.selectionToolbar, ...(_d = t17.features) == null ? void 0 : _d.selectionToolbar }, zoom: { ..._t.zoom, ...(_e2 = t17.features) == null ? void 0 : _e2.zoom } } });
|
|
6976
7001
|
}
|
|
6977
7002
|
class Et {
|
|
6978
7003
|
constructor(t17) {
|
|
@@ -7096,8 +7121,8 @@ function a$1$1(e2, t22, s22) {
|
|
|
7096
7121
|
return t22[t22.length - 1].chapterId;
|
|
7097
7122
|
case "explicit": {
|
|
7098
7123
|
const s32 = t22.find((t32) => {
|
|
7099
|
-
var
|
|
7100
|
-
return (
|
|
7124
|
+
var _a2;
|
|
7125
|
+
return (_a2 = t32.ownedGlobalPages) == null ? void 0 : _a2.includes(e2);
|
|
7101
7126
|
});
|
|
7102
7127
|
return s32 ? s32.chapterId : t22[0].chapterId;
|
|
7103
7128
|
}
|
|
@@ -7134,8 +7159,8 @@ let n$1$1 = class n {
|
|
|
7134
7159
|
return this._byChapter.get(e2) ?? [];
|
|
7135
7160
|
}
|
|
7136
7161
|
firstIndexOfChapter(e2) {
|
|
7137
|
-
var
|
|
7138
|
-
const t22 = (
|
|
7162
|
+
var _a2;
|
|
7163
|
+
const t22 = (_a2 = this._byChapter.get(e2)) == null ? void 0 : _a2[0];
|
|
7139
7164
|
return t22 ? this._pages.indexOf(t22) : -1;
|
|
7140
7165
|
}
|
|
7141
7166
|
};
|
|
@@ -7350,10 +7375,10 @@ const _ChapterManagerPlugin$1$1 = class _ChapterManagerPlugin extends BasePlugin
|
|
|
7350
7375
|
);
|
|
7351
7376
|
}
|
|
7352
7377
|
async startLoad(chapter) {
|
|
7353
|
-
var
|
|
7378
|
+
var _a2;
|
|
7354
7379
|
this.updateStatus(chapter.chapterId, "loading");
|
|
7355
7380
|
this.chapterLastUsed.set(chapter.chapterId, Date.now());
|
|
7356
|
-
const cachedPwd = chapter.encrypted && ((
|
|
7381
|
+
const cachedPwd = chapter.encrypted && ((_a2 = this.passwordProvider) == null ? void 0 : _a2.getCachedPassword) ? this.passwordProvider.getCachedPassword(chapter.chapterId) : null;
|
|
7357
7382
|
const payload = await this.resolvePdfPayload(chapter);
|
|
7358
7383
|
const cap = this.documentManager.provides();
|
|
7359
7384
|
const openTask = "url" in payload ? cap.openDocumentUrl({
|
|
@@ -7482,8 +7507,8 @@ function a$2(e2, t22, s22) {
|
|
|
7482
7507
|
return t22[t22.length - 1].chapterId;
|
|
7483
7508
|
case "explicit": {
|
|
7484
7509
|
const s32 = t22.find((t32) => {
|
|
7485
|
-
var
|
|
7486
|
-
return (
|
|
7510
|
+
var _a2;
|
|
7511
|
+
return (_a2 = t32.ownedGlobalPages) == null ? void 0 : _a2.includes(e2);
|
|
7487
7512
|
});
|
|
7488
7513
|
return s32 ? s32.chapterId : t22[0].chapterId;
|
|
7489
7514
|
}
|
|
@@ -7520,8 +7545,8 @@ class n2 {
|
|
|
7520
7545
|
return this._byChapter.get(e2) ?? [];
|
|
7521
7546
|
}
|
|
7522
7547
|
firstIndexOfChapter(e2) {
|
|
7523
|
-
var
|
|
7524
|
-
const t22 = (
|
|
7548
|
+
var _a2;
|
|
7549
|
+
const t22 = (_a2 = this._byChapter.get(e2)) == null ? void 0 : _a2[0];
|
|
7525
7550
|
return t22 ? this._pages.indexOf(t22) : -1;
|
|
7526
7551
|
}
|
|
7527
7552
|
}
|
|
@@ -7736,10 +7761,10 @@ const _ChapterManagerPlugin2 = class _ChapterManagerPlugin22 extends BasePlugin
|
|
|
7736
7761
|
);
|
|
7737
7762
|
}
|
|
7738
7763
|
async startLoad(chapter) {
|
|
7739
|
-
var
|
|
7764
|
+
var _a2;
|
|
7740
7765
|
this.updateStatus(chapter.chapterId, "loading");
|
|
7741
7766
|
this.chapterLastUsed.set(chapter.chapterId, Date.now());
|
|
7742
|
-
const cachedPwd = chapter.encrypted && ((
|
|
7767
|
+
const cachedPwd = chapter.encrypted && ((_a2 = this.passwordProvider) == null ? void 0 : _a2.getCachedPassword) ? this.passwordProvider.getCachedPassword(chapter.chapterId) : null;
|
|
7743
7768
|
const payload = await this.resolvePdfPayload(chapter);
|
|
7744
7769
|
const cap = this.documentManager.provides();
|
|
7745
7770
|
const openTask = "url" in payload ? cap.openDocumentUrl({
|
|
@@ -7874,12 +7899,11 @@ const _ChapterScrollPlugin$1 = class _ChapterScrollPlugin2 extends BasePlugin {
|
|
|
7874
7899
|
);
|
|
7875
7900
|
this.syncReadyChapterSizes();
|
|
7876
7901
|
}
|
|
7877
|
-
/** 章节 PDF 在
|
|
7902
|
+
/** 章节 PDF 在 core 中是否已可渲染(documentId === chapterId) */
|
|
7878
7903
|
isChapterDocumentReady(chapterId) {
|
|
7879
|
-
|
|
7880
|
-
|
|
7881
|
-
|
|
7882
|
-
return docState.document.pages.length > 0;
|
|
7904
|
+
const coreDoc = this.coreState.core.documents[chapterId];
|
|
7905
|
+
if (!coreDoc || coreDoc.status !== "loaded" || !coreDoc.document) return false;
|
|
7906
|
+
return coreDoc.document.pages.length > 0;
|
|
7883
7907
|
}
|
|
7884
7908
|
refreshLayout() {
|
|
7885
7909
|
this.layoutChange$.emit(this.computeLayout());
|
|
@@ -7894,7 +7918,8 @@ const _ChapterScrollPlugin$1 = class _ChapterScrollPlugin2 extends BasePlugin {
|
|
|
7894
7918
|
this.refreshLayout();
|
|
7895
7919
|
}
|
|
7896
7920
|
onDocumentLoaded(documentId) {
|
|
7897
|
-
|
|
7921
|
+
var _a2;
|
|
7922
|
+
if ((((_a2 = this.virtualPageMap) == null ? void 0 : _a2.pagesOfChapter(documentId).length) ?? 0) === 0) return;
|
|
7898
7923
|
const dm = this.documentManager.provides();
|
|
7899
7924
|
if (!dm.getActiveDocumentId()) {
|
|
7900
7925
|
dm.setActiveDocument(documentId);
|
|
@@ -7903,7 +7928,8 @@ const _ChapterScrollPlugin$1 = class _ChapterScrollPlugin2 extends BasePlugin {
|
|
|
7903
7928
|
this.refreshLayout();
|
|
7904
7929
|
}
|
|
7905
7930
|
onDocumentClosed(documentId) {
|
|
7906
|
-
|
|
7931
|
+
var _a2;
|
|
7932
|
+
if ((((_a2 = this.virtualPageMap) == null ? void 0 : _a2.pagesOfChapter(documentId).length) ?? 0) === 0) return;
|
|
7907
7933
|
this.dropChapterSizes(documentId);
|
|
7908
7934
|
this.refreshLayout();
|
|
7909
7935
|
}
|
|
@@ -7923,11 +7949,11 @@ const _ChapterScrollPlugin$1 = class _ChapterScrollPlugin2 extends BasePlugin {
|
|
|
7923
7949
|
};
|
|
7924
7950
|
}
|
|
7925
7951
|
destroy() {
|
|
7926
|
-
var
|
|
7952
|
+
var _a2;
|
|
7927
7953
|
super.destroy();
|
|
7928
7954
|
for (const u of this.chapterManagerUnsubs) u();
|
|
7929
7955
|
this.chapterManagerUnsubs = [];
|
|
7930
|
-
(
|
|
7956
|
+
(_a2 = this.viewportObservers) == null ? void 0 : _a2.unbind();
|
|
7931
7957
|
this.viewportObservers = null;
|
|
7932
7958
|
this.viewportEl = null;
|
|
7933
7959
|
this.layoutChange$.clear();
|
|
@@ -7987,16 +8013,16 @@ const _ChapterScrollPlugin$1 = class _ChapterScrollPlugin2 extends BasePlugin {
|
|
|
7987
8013
|
}
|
|
7988
8014
|
/** 章节 document 在 core store 中的缩放(与 RenderLayer / Annotation 一致) */
|
|
7989
8015
|
getChapterDocumentScale(chapterId) {
|
|
7990
|
-
var
|
|
7991
|
-
return ((
|
|
8016
|
+
var _a2;
|
|
8017
|
+
return ((_a2 = this.coreState.core.documents[chapterId]) == null ? void 0 : _a2.scale) ?? 1;
|
|
7992
8018
|
}
|
|
7993
8019
|
/** 从已加载的 PdfDocumentObject 拉取章节内所有页尺寸并上报 */
|
|
7994
8020
|
harvestChapterSizes(chapterId, attempt = 0) {
|
|
7995
|
-
var
|
|
8021
|
+
var _a2;
|
|
7996
8022
|
if (!this.virtualPageMap) return;
|
|
7997
8023
|
const pdfDoc = this.documentManager.provides().getDocument(chapterId);
|
|
7998
8024
|
const owned = this.virtualPageMap.pagesOfChapter(chapterId);
|
|
7999
|
-
if (!((
|
|
8025
|
+
if (!((_a2 = pdfDoc == null ? void 0 : pdfDoc.pages) == null ? void 0 : _a2.length) || owned.length === 0) {
|
|
8000
8026
|
if (attempt < 60) {
|
|
8001
8027
|
requestAnimationFrame(() => this.harvestChapterSizes(chapterId, attempt + 1));
|
|
8002
8028
|
}
|
|
@@ -8041,8 +8067,8 @@ const _ChapterScrollPlugin$1 = class _ChapterScrollPlugin2 extends BasePlugin {
|
|
|
8041
8067
|
}
|
|
8042
8068
|
/* ───────────────── viewport 绑定 ───────────────── */
|
|
8043
8069
|
bindViewport(el) {
|
|
8044
|
-
var
|
|
8045
|
-
(
|
|
8070
|
+
var _a2;
|
|
8071
|
+
(_a2 = this.viewportObservers) == null ? void 0 : _a2.unbind();
|
|
8046
8072
|
this.viewportEl = el;
|
|
8047
8073
|
this.viewportObservers = null;
|
|
8048
8074
|
if (!el) return;
|
|
@@ -8164,7 +8190,7 @@ const _ChapterScrollPlugin$1 = class _ChapterScrollPlugin2 extends BasePlugin {
|
|
|
8164
8190
|
this.viewportEl.scrollTo({ top: targetTop, behavior: (options == null ? void 0 : options.behavior) ?? "auto" });
|
|
8165
8191
|
}
|
|
8166
8192
|
scrollToGlobalPdfPoint(idx, pdfY, options) {
|
|
8167
|
-
var
|
|
8193
|
+
var _a2;
|
|
8168
8194
|
if (!this.viewportEl || idx < 0 || idx >= this.offsets.length || !this.virtualPageMap) {
|
|
8169
8195
|
return;
|
|
8170
8196
|
}
|
|
@@ -8175,7 +8201,7 @@ const _ChapterScrollPlugin$1 = class _ChapterScrollPlugin2 extends BasePlugin {
|
|
|
8175
8201
|
return;
|
|
8176
8202
|
}
|
|
8177
8203
|
const cssSize = this.pageSizes.get(idx);
|
|
8178
|
-
const pdfPage = (
|
|
8204
|
+
const pdfPage = (_a2 = this.documentManager.provides().getDocument(loc.chapterId)) == null ? void 0 : _a2.pages[loc.localPageIndex];
|
|
8179
8205
|
if (!cssSize || !pdfPage) {
|
|
8180
8206
|
this.scrollToIndex(idx, options);
|
|
8181
8207
|
return;
|
|
@@ -8241,11 +8267,11 @@ function verticalOverlapRatio(a22, b) {
|
|
|
8241
8267
|
return intersect / union;
|
|
8242
8268
|
}
|
|
8243
8269
|
function anchorsMatch(a22, b) {
|
|
8244
|
-
var
|
|
8270
|
+
var _a2, _b;
|
|
8245
8271
|
if (a22.chapterId !== b.chapterId || a22.localPageIndex !== b.localPageIndex) {
|
|
8246
8272
|
return false;
|
|
8247
8273
|
}
|
|
8248
|
-
const rectsA = ((
|
|
8274
|
+
const rectsA = ((_a2 = a22.rectsPdfCoord) == null ? void 0 : _a2.length) ? a22.rectsPdfCoord : [a22.rectPdfCoord];
|
|
8249
8275
|
const rectsB = ((_b = b.rectsPdfCoord) == null ? void 0 : _b.length) ? b.rectsPdfCoord : [b.rectPdfCoord];
|
|
8250
8276
|
const ma2 = a22.markerAnchor ?? markerAnchorFromRects(rectsA);
|
|
8251
8277
|
const mb = b.markerAnchor ?? markerAnchorFromRects(rectsB);
|
|
@@ -8321,9 +8347,9 @@ const _ParagraphBookmarkPlugin = class _ParagraphBookmarkPlugin2 extends BasePlu
|
|
|
8321
8347
|
this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
|
|
8322
8348
|
}
|
|
8323
8349
|
async initialize(config) {
|
|
8324
|
-
var
|
|
8350
|
+
var _a2;
|
|
8325
8351
|
this.config = config;
|
|
8326
|
-
if ((
|
|
8352
|
+
if ((_a2 = config.callbacks) == null ? void 0 : _a2.load) {
|
|
8327
8353
|
try {
|
|
8328
8354
|
const initial = await config.callbacks.load();
|
|
8329
8355
|
for (const b of initial) this.entries.set(b.id, b);
|
|
@@ -8369,17 +8395,17 @@ const _ParagraphBookmarkPlugin = class _ParagraphBookmarkPlugin2 extends BasePlu
|
|
|
8369
8395
|
return entry;
|
|
8370
8396
|
}
|
|
8371
8397
|
removeBookmark(id) {
|
|
8372
|
-
var
|
|
8398
|
+
var _a2, _b, _c;
|
|
8373
8399
|
if (this.entries.delete(id)) {
|
|
8374
8400
|
this.notifyAndPersist();
|
|
8375
|
-
(_c = (_b = (
|
|
8401
|
+
(_c = (_b = (_a2 = this.config) == null ? void 0 : _a2.callbacks) == null ? void 0 : _b.onRemoveSuccess) == null ? void 0 : _c.call(_b, id);
|
|
8376
8402
|
}
|
|
8377
8403
|
}
|
|
8378
8404
|
async requestRemoveBookmark(id) {
|
|
8379
|
-
var
|
|
8405
|
+
var _a2, _b;
|
|
8380
8406
|
const entry = this.entries.get(id);
|
|
8381
8407
|
if (!entry) return false;
|
|
8382
|
-
const cb = (_b = (
|
|
8408
|
+
const cb = (_b = (_a2 = this.config) == null ? void 0 : _a2.callbacks) == null ? void 0 : _b.onRequestRemove;
|
|
8383
8409
|
if (cb) {
|
|
8384
8410
|
try {
|
|
8385
8411
|
const ok = await cb(entry);
|
|
@@ -8402,10 +8428,10 @@ const _ParagraphBookmarkPlugin = class _ParagraphBookmarkPlugin2 extends BasePlu
|
|
|
8402
8428
|
return Array.from(this.entries.values()).sort((a22, b) => a22.createdAt - b.createdAt);
|
|
8403
8429
|
}
|
|
8404
8430
|
notifyAndPersist() {
|
|
8405
|
-
var
|
|
8431
|
+
var _a2, _b;
|
|
8406
8432
|
const list = this.list();
|
|
8407
8433
|
this.change$.emit(list);
|
|
8408
|
-
if ((_b = (
|
|
8434
|
+
if ((_b = (_a2 = this.config) == null ? void 0 : _a2.callbacks) == null ? void 0 : _b.persist) {
|
|
8409
8435
|
Promise.resolve(this.config.callbacks.persist(list)).catch(
|
|
8410
8436
|
(err) => this.logger.error(
|
|
8411
8437
|
_ParagraphBookmarkPlugin2.id,
|
|
@@ -8472,8 +8498,8 @@ function a$1(e2, t22, s22) {
|
|
|
8472
8498
|
return t22[t22.length - 1].chapterId;
|
|
8473
8499
|
case "explicit": {
|
|
8474
8500
|
const s32 = t22.find((t32) => {
|
|
8475
|
-
var
|
|
8476
|
-
return (
|
|
8501
|
+
var _a2;
|
|
8502
|
+
return (_a2 = t32.ownedGlobalPages) == null ? void 0 : _a2.includes(e2);
|
|
8477
8503
|
});
|
|
8478
8504
|
return s32 ? s32.chapterId : t22[0].chapterId;
|
|
8479
8505
|
}
|
|
@@ -8510,8 +8536,8 @@ let n$1 = class n3 {
|
|
|
8510
8536
|
return this._byChapter.get(e2) ?? [];
|
|
8511
8537
|
}
|
|
8512
8538
|
firstIndexOfChapter(e2) {
|
|
8513
|
-
var
|
|
8514
|
-
const t22 = (
|
|
8539
|
+
var _a2;
|
|
8540
|
+
const t22 = (_a2 = this._byChapter.get(e2)) == null ? void 0 : _a2[0];
|
|
8515
8541
|
return t22 ? this._pages.indexOf(t22) : -1;
|
|
8516
8542
|
}
|
|
8517
8543
|
};
|
|
@@ -8726,10 +8752,10 @@ const _ChapterManagerPlugin$1 = class _ChapterManagerPlugin3 extends BasePlugin
|
|
|
8726
8752
|
);
|
|
8727
8753
|
}
|
|
8728
8754
|
async startLoad(chapter) {
|
|
8729
|
-
var
|
|
8755
|
+
var _a2;
|
|
8730
8756
|
this.updateStatus(chapter.chapterId, "loading");
|
|
8731
8757
|
this.chapterLastUsed.set(chapter.chapterId, Date.now());
|
|
8732
|
-
const cachedPwd = chapter.encrypted && ((
|
|
8758
|
+
const cachedPwd = chapter.encrypted && ((_a2 = this.passwordProvider) == null ? void 0 : _a2.getCachedPassword) ? this.passwordProvider.getCachedPassword(chapter.chapterId) : null;
|
|
8733
8759
|
const payload = await this.resolvePdfPayload(chapter);
|
|
8734
8760
|
const cap = this.documentManager.provides();
|
|
8735
8761
|
const openTask = "url" in payload ? cap.openDocumentUrl({
|
|
@@ -8858,8 +8884,8 @@ function a2(e2, t22, s22) {
|
|
|
8858
8884
|
return t22[t22.length - 1].chapterId;
|
|
8859
8885
|
case "explicit": {
|
|
8860
8886
|
const s32 = t22.find((t32) => {
|
|
8861
|
-
var
|
|
8862
|
-
return (
|
|
8887
|
+
var _a2;
|
|
8888
|
+
return (_a2 = t32.ownedGlobalPages) == null ? void 0 : _a2.includes(e2);
|
|
8863
8889
|
});
|
|
8864
8890
|
return s32 ? s32.chapterId : t22[0].chapterId;
|
|
8865
8891
|
}
|
|
@@ -8896,8 +8922,8 @@ class n4 {
|
|
|
8896
8922
|
return this._byChapter.get(e2) ?? [];
|
|
8897
8923
|
}
|
|
8898
8924
|
firstIndexOfChapter(e2) {
|
|
8899
|
-
var
|
|
8900
|
-
const t22 = (
|
|
8925
|
+
var _a2;
|
|
8926
|
+
const t22 = (_a2 = this._byChapter.get(e2)) == null ? void 0 : _a2[0];
|
|
8901
8927
|
return t22 ? this._pages.indexOf(t22) : -1;
|
|
8902
8928
|
}
|
|
8903
8929
|
}
|
|
@@ -9112,10 +9138,10 @@ const _ChapterManagerPlugin4 = class _ChapterManagerPlugin23 extends BasePlugin
|
|
|
9112
9138
|
);
|
|
9113
9139
|
}
|
|
9114
9140
|
async startLoad(chapter) {
|
|
9115
|
-
var
|
|
9141
|
+
var _a2;
|
|
9116
9142
|
this.updateStatus(chapter.chapterId, "loading");
|
|
9117
9143
|
this.chapterLastUsed.set(chapter.chapterId, Date.now());
|
|
9118
|
-
const cachedPwd = chapter.encrypted && ((
|
|
9144
|
+
const cachedPwd = chapter.encrypted && ((_a2 = this.passwordProvider) == null ? void 0 : _a2.getCachedPassword) ? this.passwordProvider.getCachedPassword(chapter.chapterId) : null;
|
|
9119
9145
|
const payload = await this.resolvePdfPayload(chapter);
|
|
9120
9146
|
const cap = this.documentManager.provides();
|
|
9121
9147
|
const openTask = "url" in payload ? cap.openDocumentUrl({
|
|
@@ -9250,12 +9276,11 @@ const _ChapterScrollPlugin = class _ChapterScrollPlugin3 extends BasePlugin {
|
|
|
9250
9276
|
);
|
|
9251
9277
|
this.syncReadyChapterSizes();
|
|
9252
9278
|
}
|
|
9253
|
-
/** 章节 PDF 在
|
|
9279
|
+
/** 章节 PDF 在 core 中是否已可渲染(documentId === chapterId) */
|
|
9254
9280
|
isChapterDocumentReady(chapterId) {
|
|
9255
|
-
|
|
9256
|
-
|
|
9257
|
-
|
|
9258
|
-
return docState.document.pages.length > 0;
|
|
9281
|
+
const coreDoc = this.coreState.core.documents[chapterId];
|
|
9282
|
+
if (!coreDoc || coreDoc.status !== "loaded" || !coreDoc.document) return false;
|
|
9283
|
+
return coreDoc.document.pages.length > 0;
|
|
9259
9284
|
}
|
|
9260
9285
|
refreshLayout() {
|
|
9261
9286
|
this.layoutChange$.emit(this.computeLayout());
|
|
@@ -9270,7 +9295,8 @@ const _ChapterScrollPlugin = class _ChapterScrollPlugin3 extends BasePlugin {
|
|
|
9270
9295
|
this.refreshLayout();
|
|
9271
9296
|
}
|
|
9272
9297
|
onDocumentLoaded(documentId) {
|
|
9273
|
-
|
|
9298
|
+
var _a2;
|
|
9299
|
+
if ((((_a2 = this.virtualPageMap) == null ? void 0 : _a2.pagesOfChapter(documentId).length) ?? 0) === 0) return;
|
|
9274
9300
|
const dm = this.documentManager.provides();
|
|
9275
9301
|
if (!dm.getActiveDocumentId()) {
|
|
9276
9302
|
dm.setActiveDocument(documentId);
|
|
@@ -9279,7 +9305,8 @@ const _ChapterScrollPlugin = class _ChapterScrollPlugin3 extends BasePlugin {
|
|
|
9279
9305
|
this.refreshLayout();
|
|
9280
9306
|
}
|
|
9281
9307
|
onDocumentClosed(documentId) {
|
|
9282
|
-
|
|
9308
|
+
var _a2;
|
|
9309
|
+
if ((((_a2 = this.virtualPageMap) == null ? void 0 : _a2.pagesOfChapter(documentId).length) ?? 0) === 0) return;
|
|
9283
9310
|
this.dropChapterSizes(documentId);
|
|
9284
9311
|
this.refreshLayout();
|
|
9285
9312
|
}
|
|
@@ -9299,11 +9326,11 @@ const _ChapterScrollPlugin = class _ChapterScrollPlugin3 extends BasePlugin {
|
|
|
9299
9326
|
};
|
|
9300
9327
|
}
|
|
9301
9328
|
destroy() {
|
|
9302
|
-
var
|
|
9329
|
+
var _a2;
|
|
9303
9330
|
super.destroy();
|
|
9304
9331
|
for (const u of this.chapterManagerUnsubs) u();
|
|
9305
9332
|
this.chapterManagerUnsubs = [];
|
|
9306
|
-
(
|
|
9333
|
+
(_a2 = this.viewportObservers) == null ? void 0 : _a2.unbind();
|
|
9307
9334
|
this.viewportObservers = null;
|
|
9308
9335
|
this.viewportEl = null;
|
|
9309
9336
|
this.layoutChange$.clear();
|
|
@@ -9363,16 +9390,16 @@ const _ChapterScrollPlugin = class _ChapterScrollPlugin3 extends BasePlugin {
|
|
|
9363
9390
|
}
|
|
9364
9391
|
/** 章节 document 在 core store 中的缩放(与 RenderLayer / Annotation 一致) */
|
|
9365
9392
|
getChapterDocumentScale(chapterId) {
|
|
9366
|
-
var
|
|
9367
|
-
return ((
|
|
9393
|
+
var _a2;
|
|
9394
|
+
return ((_a2 = this.coreState.core.documents[chapterId]) == null ? void 0 : _a2.scale) ?? 1;
|
|
9368
9395
|
}
|
|
9369
9396
|
/** 从已加载的 PdfDocumentObject 拉取章节内所有页尺寸并上报 */
|
|
9370
9397
|
harvestChapterSizes(chapterId, attempt = 0) {
|
|
9371
|
-
var
|
|
9398
|
+
var _a2;
|
|
9372
9399
|
if (!this.virtualPageMap) return;
|
|
9373
9400
|
const pdfDoc = this.documentManager.provides().getDocument(chapterId);
|
|
9374
9401
|
const owned = this.virtualPageMap.pagesOfChapter(chapterId);
|
|
9375
|
-
if (!((
|
|
9402
|
+
if (!((_a2 = pdfDoc == null ? void 0 : pdfDoc.pages) == null ? void 0 : _a2.length) || owned.length === 0) {
|
|
9376
9403
|
if (attempt < 60) {
|
|
9377
9404
|
requestAnimationFrame(() => this.harvestChapterSizes(chapterId, attempt + 1));
|
|
9378
9405
|
}
|
|
@@ -9417,8 +9444,8 @@ const _ChapterScrollPlugin = class _ChapterScrollPlugin3 extends BasePlugin {
|
|
|
9417
9444
|
}
|
|
9418
9445
|
/* ───────────────── viewport 绑定 ───────────────── */
|
|
9419
9446
|
bindViewport(el) {
|
|
9420
|
-
var
|
|
9421
|
-
(
|
|
9447
|
+
var _a2;
|
|
9448
|
+
(_a2 = this.viewportObservers) == null ? void 0 : _a2.unbind();
|
|
9422
9449
|
this.viewportEl = el;
|
|
9423
9450
|
this.viewportObservers = null;
|
|
9424
9451
|
if (!el) return;
|
|
@@ -9540,7 +9567,7 @@ const _ChapterScrollPlugin = class _ChapterScrollPlugin3 extends BasePlugin {
|
|
|
9540
9567
|
this.viewportEl.scrollTo({ top: targetTop, behavior: (options == null ? void 0 : options.behavior) ?? "auto" });
|
|
9541
9568
|
}
|
|
9542
9569
|
scrollToGlobalPdfPoint(idx, pdfY, options) {
|
|
9543
|
-
var
|
|
9570
|
+
var _a2;
|
|
9544
9571
|
if (!this.viewportEl || idx < 0 || idx >= this.offsets.length || !this.virtualPageMap) {
|
|
9545
9572
|
return;
|
|
9546
9573
|
}
|
|
@@ -9551,7 +9578,7 @@ const _ChapterScrollPlugin = class _ChapterScrollPlugin3 extends BasePlugin {
|
|
|
9551
9578
|
return;
|
|
9552
9579
|
}
|
|
9553
9580
|
const cssSize = this.pageSizes.get(idx);
|
|
9554
|
-
const pdfPage = (
|
|
9581
|
+
const pdfPage = (_a2 = this.documentManager.provides().getDocument(loc.chapterId)) == null ? void 0 : _a2.pages[loc.localPageIndex];
|
|
9555
9582
|
if (!cssSize || !pdfPage) {
|
|
9556
9583
|
this.scrollToIndex(idx, options);
|
|
9557
9584
|
return;
|
|
@@ -9601,10 +9628,10 @@ function ChapterTreePanel({
|
|
|
9601
9628
|
if (!chapterManager) return;
|
|
9602
9629
|
const next = {};
|
|
9603
9630
|
const walk = (nodes) => {
|
|
9604
|
-
var
|
|
9631
|
+
var _a2;
|
|
9605
9632
|
for (const n5 of nodes) {
|
|
9606
9633
|
next[n5.id] = chapterManager.getChapterStatus(n5.id);
|
|
9607
|
-
if ((
|
|
9634
|
+
if ((_a2 = n5.children) == null ? void 0 : _a2.length) walk(n5.children);
|
|
9608
9635
|
}
|
|
9609
9636
|
};
|
|
9610
9637
|
walk(tree);
|
|
@@ -9774,12 +9801,12 @@ const itemBtnStyle = {
|
|
|
9774
9801
|
export {
|
|
9775
9802
|
l as CallbackPasswordProvider,
|
|
9776
9803
|
ChapterManagerPlugin$1 as ChapterManagerPlugin,
|
|
9777
|
-
|
|
9804
|
+
Fa as ChapterPdfViewer,
|
|
9778
9805
|
ChapterScrollPlugin,
|
|
9779
9806
|
ChapterTreePanel,
|
|
9780
9807
|
_t as DEFAULT_CHAPTER_VIEWER_FEATURES,
|
|
9781
9808
|
EmbedPDF2 as EmbedPDF,
|
|
9782
|
-
|
|
9809
|
+
la as PdfChapterViewport,
|
|
9783
9810
|
applySelectionMarkup,
|
|
9784
9811
|
buildParagraphBookmarkAnchor,
|
|
9785
9812
|
Ut as createChapterViewerEditor,
|