@prose-reader/core 1.271.0 → 1.272.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cfi/generate.d.ts +4 -6
- package/dist/createReaderWithEnhancer.d.ts +4 -4
- package/dist/index.js +415 -418
- package/dist/index.js.map +1 -1
- package/dist/index.umd.cjs +19 -19
- package/dist/index.umd.cjs.map +1 -1
- package/dist/reader.d.ts +5 -5
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { switchMap as w, of as v, fromEvent as X, take as $t, map as S, from as k, takeUntil as T, Observable as ce, defer as Tt, Subject as
|
|
1
|
+
import { switchMap as w, of as v, fromEvent as X, take as $t, map as S, from as k, takeUntil as T, Observable as ce, defer as Tt, Subject as N, combineLatest as j, merge as P, EMPTY as _, NEVER as he, tap as x, share as D, BehaviorSubject as q, distinctUntilChanged as R, filter as C, mergeMap as ge, first as U, endWith as fe, catchError as ze, finalize as me, lastValueFrom as nn, scheduled as on, animationFrameScheduler as re, exhaustMap as sn, debounceTime as Ie, withLatestFrom as z, throttleTime as rn, startWith as ne, shareReplay as J, switchScan as an, defaultIfEmpty as cn, forkJoin as un, delay as Pe, timer as Te, skip as Ft, ReplaySubject as ot, identity as xe, concatMap as ln } from "rxjs";
|
|
2
2
|
import { Report as dn, isShallowEqual as O, shallowMergeIfDefined as $e, getParentPath as pn, parseContentType as gn, detectMimeTypeFromName as Me, arrayEqual as hn } from "@prose-reader/shared";
|
|
3
3
|
import { isShallowEqual as tr } from "@prose-reader/shared";
|
|
4
|
-
import { switchMap as Y, first as mn, map as ie, distinctUntilChanged as be, startWith as fn, shareReplay as Ge, tap as V, pairwise as yn, take as Sn, takeUntil as K, filter as
|
|
4
|
+
import { switchMap as Y, first as mn, map as ie, distinctUntilChanged as be, startWith as fn, shareReplay as Ge, tap as V, pairwise as yn, take as Sn, takeUntil as K, filter as pe, debounceTime as In, skip as Lt, mergeMap as bn, catchError as st, share as vn } from "rxjs/operators";
|
|
5
5
|
import { generate as We, parse as Mt, isIndirectionOnly as wn, isParsedCfiRange as Pn, resolve as xn } from "@prose-reader/cfi";
|
|
6
6
|
const $n = "@prose-reader/core", A = dn.namespace($n, void 0, {
|
|
7
7
|
color: "#98cde7"
|
|
@@ -136,7 +136,7 @@ const Cn = (n, e) => {
|
|
|
136
136
|
// JavaScript files
|
|
137
137
|
].join(",");
|
|
138
138
|
return Array.from(n?.querySelectorAll(e) || []);
|
|
139
|
-
},
|
|
139
|
+
}, Nn = (n) => {
|
|
140
140
|
if (Et(n).forEach((t) => {
|
|
141
141
|
const i = t.getAttribute("src") || t.getAttribute("href");
|
|
142
142
|
i?.startsWith("blob:") && n?.defaultView?.URL.revokeObjectURL(i);
|
|
@@ -171,7 +171,7 @@ function At(n) {
|
|
|
171
171
|
// biome-ignore lint/suspicious/noExplicitAny: TODO
|
|
172
172
|
) && n.nodeType === Node.ELEMENT_NODE;
|
|
173
173
|
}
|
|
174
|
-
function
|
|
174
|
+
function Rn(n, e) {
|
|
175
175
|
return At(n) && n.tagName.toLowerCase() === e.toLowerCase();
|
|
176
176
|
}
|
|
177
177
|
function On(n) {
|
|
@@ -288,7 +288,7 @@ const Ce = (n, e, t, i) => {
|
|
|
288
288
|
const s = t.spineItemsManager.get(i)?.renderer.getDocumentFrame();
|
|
289
289
|
s && s.contentDocument?.body.setAttribute("tabindex", "-1");
|
|
290
290
|
}), t;
|
|
291
|
-
},
|
|
291
|
+
}, Ne = ({
|
|
292
292
|
position: n,
|
|
293
293
|
frameElement: e
|
|
294
294
|
}) => {
|
|
@@ -303,7 +303,7 @@ const Ce = (n, e, t, i) => {
|
|
|
303
303
|
const s = t.getSpineItemFromIframe(o), r = o, { height: a, width: c } = i.pageSize;
|
|
304
304
|
if (!s || !(r instanceof HTMLIFrameElement)) return n;
|
|
305
305
|
if (Ze(n)) {
|
|
306
|
-
const { clientX: u, clientY: l } =
|
|
306
|
+
const { clientX: u, clientY: l } = Ne({
|
|
307
307
|
position: n,
|
|
308
308
|
frameElement: r
|
|
309
309
|
}), d = new PointerEvent(n.type, {
|
|
@@ -318,7 +318,7 @@ const Ce = (n, e, t, i) => {
|
|
|
318
318
|
}), d;
|
|
319
319
|
}
|
|
320
320
|
if (En(n)) {
|
|
321
|
-
const { clientX: u, clientY: l } =
|
|
321
|
+
const { clientX: u, clientY: l } = Ne({
|
|
322
322
|
position: n,
|
|
323
323
|
frameElement: r
|
|
324
324
|
}), d = new MouseEvent(n.type, {
|
|
@@ -333,15 +333,15 @@ const Ce = (n, e, t, i) => {
|
|
|
333
333
|
}
|
|
334
334
|
if (Dn(n)) {
|
|
335
335
|
const u = Array.from(n.touches).map((d) => {
|
|
336
|
-
const { clientX:
|
|
336
|
+
const { clientX: g, clientY: p } = Ne({
|
|
337
337
|
position: d,
|
|
338
338
|
frameElement: r
|
|
339
339
|
});
|
|
340
340
|
return new Touch({
|
|
341
341
|
identifier: d.identifier,
|
|
342
342
|
target: d.target,
|
|
343
|
-
clientX:
|
|
344
|
-
clientY:
|
|
343
|
+
clientX: g,
|
|
344
|
+
clientY: p
|
|
345
345
|
});
|
|
346
346
|
}), l = new TouchEvent(n.type, {
|
|
347
347
|
touches: u,
|
|
@@ -377,13 +377,13 @@ const Ce = (n, e, t, i) => {
|
|
|
377
377
|
const u = (l) => {
|
|
378
378
|
let d = l;
|
|
379
379
|
if (Ze(l) && (d = new PointerEvent(l.type, l)), d !== l) {
|
|
380
|
-
const
|
|
380
|
+
const g = Wn(
|
|
381
381
|
d,
|
|
382
382
|
l,
|
|
383
383
|
t.spine.locator,
|
|
384
384
|
t.viewport
|
|
385
385
|
);
|
|
386
|
-
t.context.value.rootElement?.dispatchEvent(
|
|
386
|
+
t.context.value.rootElement?.dispatchEvent(g);
|
|
387
387
|
}
|
|
388
388
|
};
|
|
389
389
|
return r.contentDocument?.addEventListener(c, u), () => {
|
|
@@ -397,13 +397,13 @@ const Ce = (n, e, t, i) => {
|
|
|
397
397
|
});
|
|
398
398
|
}
|
|
399
399
|
), t;
|
|
400
|
-
},
|
|
400
|
+
}, Nt = (n) => ie((e) => Object.entries(e).reduce(
|
|
401
401
|
(t, [i, o]) => n.includes(i) ? {
|
|
402
402
|
...t,
|
|
403
403
|
[i]: o
|
|
404
404
|
} : t,
|
|
405
405
|
{}
|
|
406
|
-
)), Ke = (n) => (e) => e.pipe(
|
|
406
|
+
)), Ke = (n) => (e) => e.pipe(Nt(n), be(O));
|
|
407
407
|
function Qe(n) {
|
|
408
408
|
return new ce((e) => {
|
|
409
409
|
const t = new ResizeObserver((i) => {
|
|
@@ -461,7 +461,7 @@ function _s(n, e) {
|
|
|
461
461
|
};
|
|
462
462
|
});
|
|
463
463
|
}
|
|
464
|
-
class
|
|
464
|
+
class Rt {
|
|
465
465
|
constructor(e, t) {
|
|
466
466
|
this.settingsManager = t;
|
|
467
467
|
const i = $e(
|
|
@@ -471,7 +471,7 @@ class Nt {
|
|
|
471
471
|
this.outputSettings = this.computeOutputSettings(i), this.inputSettings = $e(
|
|
472
472
|
this.getDefaultSettings(),
|
|
473
473
|
e
|
|
474
|
-
), this.outputSettingsUpdateSubject = new
|
|
474
|
+
), this.outputSettingsUpdateSubject = new N(), this.values$ = j([
|
|
475
475
|
this.settingsManager.values$,
|
|
476
476
|
this.outputSettingsUpdateSubject.pipe(fn(this.outputSettings))
|
|
477
477
|
]).pipe(
|
|
@@ -521,7 +521,7 @@ const Hs = (n) => {
|
|
|
521
521
|
), e.readAsDataURL(n);
|
|
522
522
|
});
|
|
523
523
|
};
|
|
524
|
-
let Yn = class extends
|
|
524
|
+
let Yn = class extends Rt {
|
|
525
525
|
computeOutputSettings(e) {
|
|
526
526
|
return e;
|
|
527
527
|
}
|
|
@@ -548,7 +548,7 @@ let Yn = class extends Nt {
|
|
|
548
548
|
}
|
|
549
549
|
};
|
|
550
550
|
const qn = (n) => (e) => {
|
|
551
|
-
const { fontScale: t, lineHeight: i, fontWeight: o, fontJustification: s } = e, r = new
|
|
551
|
+
const { fontScale: t, lineHeight: i, fontWeight: o, fontJustification: s } = e, r = new N(), a = n(e), c = new Yn(
|
|
552
552
|
{
|
|
553
553
|
fontScale: t,
|
|
554
554
|
lineHeight: i,
|
|
@@ -564,24 +564,24 @@ const qn = (n) => (e) => {
|
|
|
564
564
|
${c.values.fontWeight !== "publisher" ? `font-weight: ${c.values.fontWeight} !important;` : ""}
|
|
565
565
|
${c.values.fontJustification !== "publisher" ? `text-align: ${c.values.fontJustification} !important;` : ""}
|
|
566
566
|
}
|
|
567
|
-
`, l = (
|
|
568
|
-
a.spineItemsManager.items.forEach((
|
|
569
|
-
if (
|
|
570
|
-
const h =
|
|
567
|
+
`, l = (g) => {
|
|
568
|
+
a.spineItemsManager.items.forEach((p) => {
|
|
569
|
+
if (p.renditionLayout !== "pre-paginated") {
|
|
570
|
+
const h = p.renderer.getDocumentFrame();
|
|
571
571
|
h && oe(h, "prose-reader-fonts", u());
|
|
572
572
|
}
|
|
573
|
-
}),
|
|
573
|
+
}), g && a.layout();
|
|
574
574
|
};
|
|
575
|
-
a.hookManager.register("item.onDocumentLoad", ({ itemId:
|
|
576
|
-
const
|
|
577
|
-
if (
|
|
578
|
-
const h =
|
|
575
|
+
a.hookManager.register("item.onDocumentLoad", ({ itemId: g }) => {
|
|
576
|
+
const p = a.spineItemsManager.get(g);
|
|
577
|
+
if (p?.renditionLayout !== "pre-paginated") {
|
|
578
|
+
const h = p?.renderer.getDocumentFrame();
|
|
579
579
|
h && oe(h, "prose-reader-fonts", u());
|
|
580
580
|
}
|
|
581
581
|
});
|
|
582
|
-
const d = (
|
|
582
|
+
const d = (g) => g.pipe(
|
|
583
583
|
yn(),
|
|
584
|
-
S(([
|
|
584
|
+
S(([p, h]) => h.fontScale !== p.fontScale || h.lineHeight !== p.lineHeight)
|
|
585
585
|
);
|
|
586
586
|
return c.values$.pipe(
|
|
587
587
|
d,
|
|
@@ -636,7 +636,7 @@ const qn = (n) => (e) => {
|
|
|
636
636
|
...e.map((t) => t.watch("isLoaded").pipe(
|
|
637
637
|
w(() => {
|
|
638
638
|
const i = t.renderer.getDocumentFrame();
|
|
639
|
-
if (!i || !i?.contentDocument) return
|
|
639
|
+
if (!i || !i?.contentDocument) return he;
|
|
640
640
|
const s = Array.from(
|
|
641
641
|
i.contentDocument.querySelectorAll("a")
|
|
642
642
|
).map(
|
|
@@ -647,14 +647,14 @@ const qn = (n) => (e) => {
|
|
|
647
647
|
))
|
|
648
648
|
)
|
|
649
649
|
),
|
|
650
|
-
|
|
650
|
+
x((e) => {
|
|
651
651
|
e.preventDefault();
|
|
652
652
|
}),
|
|
653
653
|
D()
|
|
654
654
|
);
|
|
655
655
|
class Q extends ce {
|
|
656
656
|
constructor(e) {
|
|
657
|
-
super((t) => this.stateSubject.pipe(T(this._destroy$)).subscribe(t)), this._destroy$ = new
|
|
657
|
+
super((t) => this.stateSubject.pipe(T(this._destroy$)).subscribe(t)), this._destroy$ = new N(), this.destroy$ = this._destroy$.asObservable(), this.stateSubject = new q(e);
|
|
658
658
|
}
|
|
659
659
|
next(e) {
|
|
660
660
|
this.stateSubject.next(e);
|
|
@@ -669,7 +669,7 @@ class Q extends ce {
|
|
|
669
669
|
watch(e) {
|
|
670
670
|
return Array.isArray(e) ? this.stateSubject.pipe(Ke(e)) : this.stateSubject.pipe(
|
|
671
671
|
S((t) => t[e]),
|
|
672
|
-
|
|
672
|
+
R(O)
|
|
673
673
|
);
|
|
674
674
|
}
|
|
675
675
|
get value() {
|
|
@@ -684,15 +684,15 @@ const Le = class Le extends Q {
|
|
|
684
684
|
super({
|
|
685
685
|
state: "idle",
|
|
686
686
|
error: void 0
|
|
687
|
-
}), this.triggerSubject = new
|
|
687
|
+
}), this.triggerSubject = new N(), this.context = e.context, this.settings = e.settings, this.hookManager = e.hookManager, this.item = e.item, this.containerElement = e.containerElement, this.resourcesHandler = e.resourcesHandler, this.viewport = e.viewport;
|
|
688
688
|
const t = this.triggerSubject.pipe(
|
|
689
689
|
C((o) => o.type === "unload")
|
|
690
690
|
), i = this.triggerSubject.pipe(
|
|
691
691
|
C((o) => o.type === "load")
|
|
692
692
|
);
|
|
693
693
|
this.loaded$ = i.pipe(
|
|
694
|
-
|
|
695
|
-
|
|
694
|
+
ge(() => this.value.state === "loaded" || this.value.state === "loading" ? _ : (this.next({ state: "loading", error: void 0 }), this.onCreateDocument().pipe(U()).pipe(
|
|
695
|
+
ge((r) => (this.hookManager.execute("item.onDocumentCreated", this.item.id, {
|
|
696
696
|
itemId: this.item.id,
|
|
697
697
|
documentContainer: r
|
|
698
698
|
}), this.onLoadDocument().pipe(
|
|
@@ -717,7 +717,7 @@ const Le = class Le extends Q {
|
|
|
717
717
|
))),
|
|
718
718
|
D()
|
|
719
719
|
), this.unloaded$ = t.pipe(
|
|
720
|
-
|
|
720
|
+
ge(() => this.value.state === "unloading" || this.value.state === "idle" ? _ : (this.next({ state: "unloading", error: void 0 }), this.context.bridgeEvent.viewportFree$.pipe(
|
|
721
721
|
U(),
|
|
722
722
|
w(() => (this.hookManager.destroy("item.onDocumentLoad", this.item.id), this.onUnload().pipe(fe(null), U()))),
|
|
723
723
|
S(() => {
|
|
@@ -758,7 +758,7 @@ const Le = class Le extends Q {
|
|
|
758
758
|
* Automatically release on complete or error.
|
|
759
759
|
*/
|
|
760
760
|
renderHeadless() {
|
|
761
|
-
const e = new
|
|
761
|
+
const e = new N();
|
|
762
762
|
return Tt(() => this.onRenderHeadless({ release: e })).pipe(
|
|
763
763
|
fe(void 0),
|
|
764
764
|
U(),
|
|
@@ -832,7 +832,7 @@ const Ot = (n, e) => {
|
|
|
832
832
|
if (n.defaultView && c instanceof n.defaultView.CSSFontFaceRule) {
|
|
833
833
|
const u = c.style.getPropertyValue("src");
|
|
834
834
|
if (u.match(/url\(['"]?([^'"]+)['"]?\)/g)) {
|
|
835
|
-
const d = u.split(",").map((h) => h.trim()),
|
|
835
|
+
const d = u.split(",").map((h) => h.trim()), g = await Promise.all(
|
|
836
836
|
d.map(async (h) => {
|
|
837
837
|
if (h.startsWith("local("))
|
|
838
838
|
return h;
|
|
@@ -846,10 +846,10 @@ const Ot = (n, e) => {
|
|
|
846
846
|
try {
|
|
847
847
|
const b = await I.getResource();
|
|
848
848
|
if (b instanceof Response) {
|
|
849
|
-
const F = await b.blob(),
|
|
849
|
+
const F = await b.blob(), $ = n.defaultView?.URL.createObjectURL(F);
|
|
850
850
|
return h.replace(
|
|
851
851
|
m[0],
|
|
852
|
-
`url("${
|
|
852
|
+
`url("${$}")`
|
|
853
853
|
);
|
|
854
854
|
}
|
|
855
855
|
} catch (b) {
|
|
@@ -858,11 +858,11 @@ const Ot = (n, e) => {
|
|
|
858
858
|
}
|
|
859
859
|
return h;
|
|
860
860
|
})
|
|
861
|
-
),
|
|
861
|
+
), p = c.cssText.replace(
|
|
862
862
|
/src:\s*[^;]+;/,
|
|
863
|
-
`src: ${
|
|
863
|
+
`src: ${g.join(", ")};`
|
|
864
864
|
);
|
|
865
|
-
s.deleteRule(a), s.insertRule(
|
|
865
|
+
s.deleteRule(a), s.insertRule(p, a);
|
|
866
866
|
}
|
|
867
867
|
}
|
|
868
868
|
}
|
|
@@ -878,10 +878,10 @@ const Ot = (n, e) => {
|
|
|
878
878
|
if (!r) return v(null);
|
|
879
879
|
const a = new tt(r, o);
|
|
880
880
|
return k(a.getResource()).pipe(
|
|
881
|
-
|
|
881
|
+
ge(
|
|
882
882
|
(c) => c instanceof Response ? k(c.blob()) : v(void 0)
|
|
883
883
|
),
|
|
884
|
-
|
|
884
|
+
ge((c) => {
|
|
885
885
|
if (!c)
|
|
886
886
|
return v(null);
|
|
887
887
|
const u = n?.defaultView?.URL.createObjectURL(c) ?? "";
|
|
@@ -926,7 +926,7 @@ const Ot = (n, e) => {
|
|
|
926
926
|
return j(a).pipe(S(() => o));
|
|
927
927
|
})
|
|
928
928
|
), ti = (n) => {
|
|
929
|
-
|
|
929
|
+
Nn(n?.contentDocument);
|
|
930
930
|
}, Xs = "@prose-reader/core", Ys = 0, qs = 200, ni = [".xhtml", ".html", ".htm"], W = "prose-reader", Vt = `${W}-style`, ii = `data-${W}-id`, oi = `${W}-viewport`, si = `${W}-scroll-navigator`, ri = async (n, e) => {
|
|
931
931
|
if (typeof n == "string") return n;
|
|
932
932
|
const t = gn(n.headers.get("Content-Type") || "") || Me(e.href);
|
|
@@ -987,7 +987,7 @@ const Ot = (n, e) => {
|
|
|
987
987
|
throw new Error("Invalid resource");
|
|
988
988
|
return k(t(a));
|
|
989
989
|
}),
|
|
990
|
-
|
|
990
|
+
x((a) => {
|
|
991
991
|
if (a) {
|
|
992
992
|
const c = new Blob([a], { type: "text/html" }), u = URL.createObjectURL(c);
|
|
993
993
|
o?.setAttribute("src", u);
|
|
@@ -1042,7 +1042,7 @@ const Ot = (n, e) => {
|
|
|
1042
1042
|
}) => {
|
|
1043
1043
|
const a = n * o;
|
|
1044
1044
|
if (s?.contentDocument && s?.contentWindow) {
|
|
1045
|
-
const { viewportDimensions: c, computedScale: u = 1 } = jt({ frameElement: s, pageHeight: i, pageWidth: o }) ?? {}, l = !!c, d = o,
|
|
1045
|
+
const { viewportDimensions: c, computedScale: u = 1 } = jt({ frameElement: s, pageHeight: i, pageWidth: o }) ?? {}, l = !!c, d = o, g = i;
|
|
1046
1046
|
if (s.contentDocument?.documentElement && s.contentDocument?.documentElement.setAttribute(
|
|
1047
1047
|
"data-prose-reader-html-renderer-has-viewport-dimensions",
|
|
1048
1048
|
l.toString()
|
|
@@ -1051,23 +1051,23 @@ const Ot = (n, e) => {
|
|
|
1051
1051
|
height: c.height ?? 1
|
|
1052
1052
|
}) : ut(s, {
|
|
1053
1053
|
width: d,
|
|
1054
|
-
height:
|
|
1054
|
+
height: g
|
|
1055
1055
|
}), c) {
|
|
1056
1056
|
s?.style.setProperty("position", "absolute"), s?.style.setProperty("top", "50%"), t === "left" ? (s?.style.setProperty("right", "0"), s?.style.removeProperty("left")) : e === "before" && r ? (s?.style.setProperty("right", "50%"), s?.style.removeProperty("left")) : t === "right" ? (s?.style.setProperty("left", "0"), s?.style.removeProperty("right")) : (s?.style.setProperty(
|
|
1057
1057
|
"left",
|
|
1058
1058
|
e === "before" ? r ? "25%" : "75%" : e === "after" ? r ? "75%" : "25%" : "50%"
|
|
1059
1059
|
), s?.style.removeProperty("right"));
|
|
1060
|
-
const
|
|
1060
|
+
const p = t !== "none" ? "0" : "-50%", h = t === "right" && e !== "before" ? "left" : t === "left" || e === "before" && r ? "right" : "center";
|
|
1061
1061
|
s?.style.setProperty(
|
|
1062
1062
|
"transform",
|
|
1063
|
-
`translate(${
|
|
1063
|
+
`translate(${p}, -50%) scale(${u})`
|
|
1064
1064
|
), s?.style.setProperty(
|
|
1065
1065
|
"transform-origin",
|
|
1066
1066
|
`${h} center`
|
|
1067
1067
|
);
|
|
1068
1068
|
} else
|
|
1069
1069
|
e === "before" ? r ? s?.style.setProperty("margin-right", `${o}px`) : s?.style.setProperty("margin-left", `${o}px`) : (s?.style.removeProperty("margin-left"), s?.style.removeProperty("margin-right"));
|
|
1070
|
-
return { width: a, height:
|
|
1070
|
+
return { width: a, height: g };
|
|
1071
1071
|
}
|
|
1072
1072
|
return { width: a, height: i };
|
|
1073
1073
|
}, di = () => `
|
|
@@ -1208,23 +1208,23 @@ const Ot = (n, e) => {
|
|
|
1208
1208
|
enableTouch: c,
|
|
1209
1209
|
isUsingVerticalWriting: u
|
|
1210
1210
|
}) => {
|
|
1211
|
-
const l = o * e, d = i?.renditionLayout === "reflowable" && i?.renditionFlow === "scrolled-continuous",
|
|
1212
|
-
t?.style.setProperty("width", `${e}px`), d ? t?.style.removeProperty("height") : t?.style.setProperty("height", `${
|
|
1213
|
-
const { viewportDimensions:
|
|
1211
|
+
const l = o * e, d = i?.renditionLayout === "reflowable" && i?.renditionFlow === "scrolled-continuous", g = d ? Math.min(400, n) : n;
|
|
1212
|
+
t?.style.setProperty("width", `${e}px`), d ? t?.style.removeProperty("height") : t?.style.setProperty("height", `${g}px`);
|
|
1213
|
+
const { viewportDimensions: p, computedScale: h = 1 } = jt({
|
|
1214
1214
|
frameElement: t,
|
|
1215
|
-
pageHeight:
|
|
1215
|
+
pageHeight: g,
|
|
1216
1216
|
pageWidth: e
|
|
1217
1217
|
}) ?? {}, m = i?.renditionLayout === "pre-paginated";
|
|
1218
1218
|
if (t?.contentDocument && t?.contentWindow && t.contentDocument.body) {
|
|
1219
|
-
let y = e, f =
|
|
1220
|
-
if (
|
|
1219
|
+
let y = e, f = g;
|
|
1220
|
+
if (p?.hasViewport)
|
|
1221
1221
|
oe(
|
|
1222
1222
|
t,
|
|
1223
1223
|
"prose-reader-html-renderer-framce-css",
|
|
1224
1224
|
di()
|
|
1225
1225
|
), ve(t, {
|
|
1226
|
-
width:
|
|
1227
|
-
height:
|
|
1226
|
+
width: p.width ?? 1,
|
|
1227
|
+
height: p.height ?? 1
|
|
1228
1228
|
}), t?.style.setProperty("position", "absolute"), t?.style.setProperty("top", "50%"), t?.style.setProperty(
|
|
1229
1229
|
"left",
|
|
1230
1230
|
r === "before" ? s ? "25%" : "75%" : r === "after" ? s ? "75%" : "25%" : "50%"
|
|
@@ -1240,14 +1240,14 @@ const Ot = (n, e) => {
|
|
|
1240
1240
|
hi({
|
|
1241
1241
|
isUsingVerticalWriting: u,
|
|
1242
1242
|
minimumWidth: l,
|
|
1243
|
-
pageHeight:
|
|
1243
|
+
pageHeight: g,
|
|
1244
1244
|
pageWidth: e
|
|
1245
1245
|
})
|
|
1246
1246
|
);
|
|
1247
1247
|
if (oe(t, "prose-reader-css", b, !0), u)
|
|
1248
1248
|
f = Math.ceil(
|
|
1249
|
-
t.contentDocument.documentElement.scrollHeight /
|
|
1250
|
-
) *
|
|
1249
|
+
t.contentDocument.documentElement.scrollHeight / g
|
|
1250
|
+
) * g, ve(t, {
|
|
1251
1251
|
width: l,
|
|
1252
1252
|
height: f
|
|
1253
1253
|
});
|
|
@@ -1287,11 +1287,11 @@ class fi extends ye {
|
|
|
1287
1287
|
settings: this.settings
|
|
1288
1288
|
}),
|
|
1289
1289
|
De(this.context.bridgeEvent.viewportFree$),
|
|
1290
|
-
|
|
1290
|
+
x(() => {
|
|
1291
1291
|
this.attach();
|
|
1292
1292
|
}),
|
|
1293
1293
|
jn,
|
|
1294
|
-
|
|
1294
|
+
x((t) => {
|
|
1295
1295
|
this.isPrePaginated() ? oe(t, "prose-reader-css", ui) : this.isImageType();
|
|
1296
1296
|
}),
|
|
1297
1297
|
ei({
|
|
@@ -1430,7 +1430,7 @@ class E {
|
|
|
1430
1430
|
this.__symbol = /* @__PURE__ */ Symbol("SpineItemPosition"), this.x = e.x, this.y = e.y;
|
|
1431
1431
|
}
|
|
1432
1432
|
}
|
|
1433
|
-
class
|
|
1433
|
+
class Re {
|
|
1434
1434
|
constructor(e) {
|
|
1435
1435
|
this.__symbol = /* @__PURE__ */ Symbol("SpineItemPagePosition"), this.x = e.x, this.y = e.y;
|
|
1436
1436
|
}
|
|
@@ -1493,7 +1493,7 @@ const bi = (n, e) => {
|
|
|
1493
1493
|
visibility: hidden;
|
|
1494
1494
|
`, c.appendChild(e), () => {
|
|
1495
1495
|
e?.remove(), e = void 0;
|
|
1496
|
-
})) :
|
|
1496
|
+
})) : he)
|
|
1497
1497
|
), i = (c) => on(c, re).pipe(
|
|
1498
1498
|
V(() => {
|
|
1499
1499
|
e?.style.setProperty(
|
|
@@ -1622,11 +1622,11 @@ const bi = (n, e) => {
|
|
|
1622
1622
|
}
|
|
1623
1623
|
);
|
|
1624
1624
|
}, Mi = (n) => n.spineItemsObserver.states$.pipe(
|
|
1625
|
-
|
|
1625
|
+
x(({ item: e, isReady: t, isDirty: i }) => {
|
|
1626
1626
|
e.containerElement.dataset.isDirty = i.toString(), e.containerElement.dataset.isReady = t.toString();
|
|
1627
1627
|
})
|
|
1628
1628
|
);
|
|
1629
|
-
let Ci = class extends
|
|
1629
|
+
let Ci = class extends Rt {
|
|
1630
1630
|
computeOutputSettings(e) {
|
|
1631
1631
|
return e;
|
|
1632
1632
|
}
|
|
@@ -1656,7 +1656,7 @@ const Ei = (n) => j([
|
|
|
1656
1656
|
n.viewport.watch(["width", "height"]),
|
|
1657
1657
|
n.context.watch("manifest")
|
|
1658
1658
|
]).pipe(
|
|
1659
|
-
|
|
1659
|
+
x(([{ width: e, height: t }, i]) => {
|
|
1660
1660
|
const o = e > t;
|
|
1661
1661
|
return !o && i?.renditionSpread === "portrait" ? n.settings.update({ spreadMode: !0 }) : o && (i?.renditionSpread === void 0 || i?.renditionSpread === "auto" || i?.renditionSpread === "landscape" || i?.renditionSpread === "both") ? n.settings.update({ spreadMode: !0 }) : n.settings.update({ spreadMode: !1 });
|
|
1662
1662
|
})
|
|
@@ -1682,12 +1682,12 @@ const Ei = (n) => j([
|
|
|
1682
1682
|
!m && f && (f.getBoundingClientRect().left, m = !0);
|
|
1683
1683
|
});
|
|
1684
1684
|
}), r.hookManager.register("item.onBeforeLayout", ({ item: m }) => {
|
|
1685
|
-
const y = r.spineItemsManager.get(m.id), I = !!(m.mediaType ?? Me(m.href))?.startsWith("image/"), { pageHorizontalMargin: b = 0, pageVerticalMargin: F = 0 } = a.values,
|
|
1685
|
+
const y = r.spineItemsManager.get(m.id), I = !!(m.mediaType ?? Me(m.href))?.startsWith("image/"), { pageHorizontalMargin: b = 0, pageVerticalMargin: F = 0 } = a.values, $ = r.viewport.pageSize;
|
|
1686
1686
|
if (y?.renditionLayout === "reflowable" && !I) {
|
|
1687
|
-
let L =
|
|
1688
|
-
const H =
|
|
1689
|
-
let B =
|
|
1690
|
-
y.isUsingVerticalWriting() && (B =
|
|
1687
|
+
let L = $.width - b * 2;
|
|
1688
|
+
const H = $.height - F * 2;
|
|
1689
|
+
let B = $.width - b * 2, se = b * 2;
|
|
1690
|
+
y.isUsingVerticalWriting() && (B = $.width - b * 2, L = H, se = F * 2);
|
|
1691
1691
|
const ue = y?.renderer.getDocumentFrame();
|
|
1692
1692
|
ue && oe(
|
|
1693
1693
|
ue,
|
|
@@ -1723,18 +1723,18 @@ const Ei = (n) => j([
|
|
|
1723
1723
|
r.settings.values.computedPageTurnMode !== "scrollable" && f?.setAttribute("tab-index", "0");
|
|
1724
1724
|
});
|
|
1725
1725
|
const c = r.spineItemsObserver.states$.pipe(
|
|
1726
|
-
|
|
1726
|
+
pe(({ isReady: m }) => m),
|
|
1727
1727
|
V(({ item: m }) => {
|
|
1728
1728
|
const y = m.renderer.documentContainer;
|
|
1729
1729
|
y && (y.style.opacity = "1");
|
|
1730
1730
|
})
|
|
1731
1731
|
), u = a.values$.pipe(
|
|
1732
|
-
|
|
1732
|
+
pe(({ layoutAutoResize: m }) => m === "container"),
|
|
1733
1733
|
Y(() => r.context.watch("rootElement")),
|
|
1734
|
-
|
|
1734
|
+
pe(Z),
|
|
1735
1735
|
Y((m) => Qe(m)),
|
|
1736
1736
|
In(100),
|
|
1737
|
-
|
|
1737
|
+
pe(Z),
|
|
1738
1738
|
V(() => {
|
|
1739
1739
|
r?.layout();
|
|
1740
1740
|
})
|
|
@@ -1748,14 +1748,14 @@ const Ei = (n) => j([
|
|
|
1748
1748
|
).subscribe();
|
|
1749
1749
|
const d = r.spine.pages.pipe(
|
|
1750
1750
|
Ge({ refCount: !0, bufferSize: 1 })
|
|
1751
|
-
),
|
|
1751
|
+
), g = Mi(r), p = Ei(r), h = Ti(r);
|
|
1752
1752
|
return P(
|
|
1753
1753
|
c,
|
|
1754
1754
|
l,
|
|
1755
1755
|
u,
|
|
1756
1756
|
d,
|
|
1757
|
-
p,
|
|
1758
1757
|
g,
|
|
1758
|
+
p,
|
|
1759
1759
|
h
|
|
1760
1760
|
).pipe(K(r.$.destroy$)).subscribe(), {
|
|
1761
1761
|
...r,
|
|
@@ -1820,7 +1820,7 @@ class Ai extends ye {
|
|
|
1820
1820
|
getDocumentFrame() {
|
|
1821
1821
|
}
|
|
1822
1822
|
}
|
|
1823
|
-
const
|
|
1823
|
+
const Ni = (n) => (e) => {
|
|
1824
1824
|
const t = n({
|
|
1825
1825
|
...e,
|
|
1826
1826
|
getRenderer(r) {
|
|
@@ -1875,9 +1875,9 @@ const Ri = (n) => (e) => {
|
|
|
1875
1875
|
i.disconnect(), o.disconnect(), t.destroy();
|
|
1876
1876
|
}
|
|
1877
1877
|
};
|
|
1878
|
-
},
|
|
1879
|
-
|
|
1880
|
-
if (!
|
|
1878
|
+
}, Ri = (n, e) => n.links$.pipe(
|
|
1879
|
+
x((t) => {
|
|
1880
|
+
if (!Rn(t.target, "a") || t.type !== "click") return;
|
|
1881
1881
|
const i = new URL(t.target.href), o = `${i.origin}${i.pathname}`;
|
|
1882
1882
|
n.context.manifest?.spineItems.some(
|
|
1883
1883
|
(r) => r.href === o
|
|
@@ -2321,7 +2321,7 @@ class zi extends Q {
|
|
|
2321
2321
|
}
|
|
2322
2322
|
class G {
|
|
2323
2323
|
constructor() {
|
|
2324
|
-
this.isDestroyed = !1, this.destroySubject = new
|
|
2324
|
+
this.isDestroyed = !1, this.destroySubject = new N(), this.destroy$ = this.destroySubject.asObservable();
|
|
2325
2325
|
}
|
|
2326
2326
|
destroy() {
|
|
2327
2327
|
this.isDestroyed || (this.isDestroyed = !0, this.destroySubject.next(), this.destroySubject.complete());
|
|
@@ -2330,7 +2330,7 @@ class G {
|
|
|
2330
2330
|
const Wi = 500;
|
|
2331
2331
|
class _i extends G {
|
|
2332
2332
|
constructor(e, t) {
|
|
2333
|
-
super(), this.scrollNavigationController = e, this.locker = t, this.navigationSubject = new
|
|
2333
|
+
super(), this.scrollNavigationController = e, this.locker = t, this.navigationSubject = new N(), this.navigation$ = this.navigationSubject.asObservable();
|
|
2334
2334
|
const i = this.scrollNavigationController.userScroll$.pipe(
|
|
2335
2335
|
sn((o) => {
|
|
2336
2336
|
const s = this.locker.lock();
|
|
@@ -2343,7 +2343,7 @@ class _i extends G {
|
|
|
2343
2343
|
re
|
|
2344
2344
|
),
|
|
2345
2345
|
U(),
|
|
2346
|
-
|
|
2346
|
+
x(() => {
|
|
2347
2347
|
const r = this.scrollNavigationController.fromScrollPosition(
|
|
2348
2348
|
this.scrollNavigationController.scrollPosition
|
|
2349
2349
|
);
|
|
@@ -2381,37 +2381,37 @@ const Hi = (n) => n.pagination.state$.pipe(
|
|
|
2381
2381
|
};
|
|
2382
2382
|
}
|
|
2383
2383
|
),
|
|
2384
|
-
|
|
2384
|
+
R(O)
|
|
2385
2385
|
), Bi = ({ reader: n, duration: e }) => (t) => {
|
|
2386
2386
|
let i;
|
|
2387
2387
|
const o = () => {
|
|
2388
2388
|
i?.(), i = void 0;
|
|
2389
2389
|
};
|
|
2390
2390
|
return t.pipe(
|
|
2391
|
-
|
|
2391
|
+
x(() => {
|
|
2392
2392
|
i || (i = n?.navigation.lock());
|
|
2393
2393
|
}),
|
|
2394
2394
|
rn(e, re, {
|
|
2395
2395
|
trailing: !0,
|
|
2396
2396
|
leading: !0
|
|
2397
2397
|
}),
|
|
2398
|
-
|
|
2398
|
+
x(o),
|
|
2399
2399
|
me(o)
|
|
2400
2400
|
);
|
|
2401
2401
|
}, Xi = (n) => (e) => {
|
|
2402
2402
|
const t = n(e), i = Hi(t), o = new Ui(t), s = new zi(t), r = new _i(
|
|
2403
2403
|
t.navigation.scrollNavigationController,
|
|
2404
2404
|
t.navigation.locker
|
|
2405
|
-
), a =
|
|
2406
|
-
|
|
2405
|
+
), a = Ri(t, o), c = r.navigation$.pipe(
|
|
2406
|
+
x((d) => {
|
|
2407
2407
|
t.navigation.navigate(d);
|
|
2408
2408
|
})
|
|
2409
2409
|
);
|
|
2410
2410
|
return P(a, c).pipe(T(t.$.destroy$)).subscribe(), {
|
|
2411
2411
|
...t,
|
|
2412
2412
|
load: (d) => {
|
|
2413
|
-
const { cfi:
|
|
2414
|
-
t.load(
|
|
2413
|
+
const { cfi: g, ...p } = d;
|
|
2414
|
+
t.load(p), g && o.goToCfi(g, { animate: !1 });
|
|
2415
2415
|
},
|
|
2416
2416
|
destroy: () => {
|
|
2417
2417
|
r.destroy(), t.destroy();
|
|
@@ -2419,7 +2419,7 @@ const Hi = (n) => n.pagination.state$.pipe(
|
|
|
2419
2419
|
navigation: {
|
|
2420
2420
|
...t.navigation,
|
|
2421
2421
|
state$: i,
|
|
2422
|
-
throttleLock: ({ duration: d, trigger:
|
|
2422
|
+
throttleLock: ({ duration: d, trigger: g }) => g.pipe(Bi({ duration: d, reader: t })),
|
|
2423
2423
|
panNavigator: s,
|
|
2424
2424
|
turnBottom: o.turnBottom.bind(o),
|
|
2425
2425
|
turnTop: o.turnTop.bind(o),
|
|
@@ -2452,10 +2452,10 @@ const Hi = (n) => n.pagination.state$.pipe(
|
|
|
2452
2452
|
a.lastIndexOf("/")
|
|
2453
2453
|
), u = n.substring(0, n.lastIndexOf("/")), l = n.endsWith(a), d = u !== "" && u.endsWith(c);
|
|
2454
2454
|
if (l || d) {
|
|
2455
|
-
const
|
|
2455
|
+
const p = t.spineItems.findIndex(
|
|
2456
2456
|
(f) => f.href === s.href
|
|
2457
2457
|
);
|
|
2458
|
-
if (i <
|
|
2458
|
+
if (i < p) return o;
|
|
2459
2459
|
const m = {
|
|
2460
2460
|
title: s.title,
|
|
2461
2461
|
path: s.path
|
|
@@ -2498,10 +2498,10 @@ const Hi = (n) => n.pagination.state$.pipe(
|
|
|
2498
2498
|
U(),
|
|
2499
2499
|
z(n.layoutInfo$),
|
|
2500
2500
|
S(([s, r]) => {
|
|
2501
|
-
const a = n.context, c = a.manifest?.renditionLayout === "pre-paginated", u = a.manifest?.spineItems.length || 0, l = a.manifest?.spineItems.slice(0, e).reduce((f, I) => f + (I.progressionWeight ?? 0), 0) || 0, d = n.spineItemsManager.getSpineItemIndex(o) ?? 0,
|
|
2501
|
+
const a = n.context, c = a.manifest?.renditionLayout === "pre-paginated", u = a.manifest?.spineItems.length || 0, l = a.manifest?.spineItems.slice(0, e).reduce((f, I) => f + (I.progressionWeight ?? 0), 0) || 0, d = n.spineItemsManager.getSpineItemIndex(o) ?? 0, g = n.context.manifest?.spineItems.length ?? 0, p = r.pages.filter((f) => f.itemIndex === d).length ?? 0, h = a.manifest?.spineItems[e]?.progressionWeight ?? // if no progressionWeight is defined we "assume" the document weight to be
|
|
2502
2502
|
// relative to the total number of documents
|
|
2503
|
-
(d + 1) /
|
|
2504
|
-
let m = (t + 1) * (h /
|
|
2503
|
+
(d + 1) / g;
|
|
2504
|
+
let m = (t + 1) * (h / p);
|
|
2505
2505
|
!c && o.renditionLayout === "reflowable" && !s && (m = 0);
|
|
2506
2506
|
let y = l + m;
|
|
2507
2507
|
return a.manifest?.renditionFlow === "scrolled-continuous" && (s ? m = Ji(
|
|
@@ -2512,7 +2512,7 @@ const Hi = (n) => n.pagination.state$.pipe(
|
|
|
2512
2512
|
l,
|
|
2513
2513
|
h,
|
|
2514
2514
|
m
|
|
2515
|
-
)), e === u - 1 && t ===
|
|
2515
|
+
)), e === u - 1 && t === p - 1 && y > 0.99 ? 1 : y;
|
|
2516
2516
|
})
|
|
2517
2517
|
), Qi = (n) => n.spine.layout$.pipe(
|
|
2518
2518
|
Ie(10, re),
|
|
@@ -2527,7 +2527,7 @@ const Hi = (n) => n.pagination.state$.pipe(
|
|
|
2527
2527
|
*/
|
|
2528
2528
|
numberOfTotalPages: n.spine.pages.value.pages.length
|
|
2529
2529
|
})),
|
|
2530
|
-
|
|
2530
|
+
R(O),
|
|
2531
2531
|
ne({
|
|
2532
2532
|
numberOfPagesPerItems: [],
|
|
2533
2533
|
numberOfTotalPages: 0
|
|
@@ -2614,7 +2614,7 @@ const Hi = (n) => n.pagination.state$.pipe(
|
|
|
2614
2614
|
}))
|
|
2615
2615
|
)
|
|
2616
2616
|
),
|
|
2617
|
-
|
|
2617
|
+
R(O)
|
|
2618
2618
|
);
|
|
2619
2619
|
return { paginationInfo$: j([
|
|
2620
2620
|
o,
|
|
@@ -2632,12 +2632,12 @@ const Hi = (n) => n.pagination.state$.pipe(
|
|
|
2632
2632
|
r.endPageIndexInSpineItem ?? 0
|
|
2633
2633
|
)
|
|
2634
2634
|
})),
|
|
2635
|
-
|
|
2635
|
+
x((r) => {
|
|
2636
2636
|
i.next(r);
|
|
2637
2637
|
}),
|
|
2638
2638
|
J(1)
|
|
2639
2639
|
), getPaginationInfo: () => i.value };
|
|
2640
|
-
},
|
|
2640
|
+
}, de = (n) => We({
|
|
2641
2641
|
spineIndex: n.index,
|
|
2642
2642
|
spineId: n.id
|
|
2643
2643
|
}), Wt = ({
|
|
@@ -2646,7 +2646,7 @@ const Hi = (n) => n.pagination.state$.pipe(
|
|
|
2646
2646
|
item: t
|
|
2647
2647
|
}) => {
|
|
2648
2648
|
const i = "ownerDocument" in n ? n.ownerDocument : n.startContainer.ownerDocument;
|
|
2649
|
-
return !i || !i?.documentElement || n === i ?
|
|
2649
|
+
return !i || !i?.documentElement || n === i ? de(t) : On(n) ? We({
|
|
2650
2650
|
start: {
|
|
2651
2651
|
node: n.startContainer,
|
|
2652
2652
|
offset: n.startOffset,
|
|
@@ -2666,19 +2666,13 @@ const Hi = (n) => n.pagination.state$.pipe(
|
|
|
2666
2666
|
spineId: t.id
|
|
2667
2667
|
});
|
|
2668
2668
|
}, He = ({
|
|
2669
|
-
|
|
2670
|
-
|
|
2671
|
-
|
|
2672
|
-
|
|
2673
|
-
|
|
2674
|
-
|
|
2675
|
-
|
|
2676
|
-
return o && s instanceof HTMLIFrameElement && s.contentWindow?.document ? Wt({
|
|
2677
|
-
nodeOrRange: o.node,
|
|
2678
|
-
offset: o.offset,
|
|
2679
|
-
item: e.item
|
|
2680
|
-
}).trim() : he(e.item);
|
|
2681
|
-
}, io = (n, e) => Wt({
|
|
2669
|
+
spineItem: n,
|
|
2670
|
+
pageNode: e
|
|
2671
|
+
}) => Wt({
|
|
2672
|
+
nodeOrRange: e.node,
|
|
2673
|
+
offset: e.offset,
|
|
2674
|
+
item: n
|
|
2675
|
+
}).trim(), io = (n, e) => Wt({
|
|
2682
2676
|
nodeOrRange: n,
|
|
2683
2677
|
item: e
|
|
2684
2678
|
}), Zs = (n) => n.index.toString(), pt = (n) => n[0]?.index === 6 && n.length > 1, Be = (n) => {
|
|
@@ -2747,10 +2741,10 @@ const Hi = (n) => n.pagination.state$.pipe(
|
|
|
2747
2741
|
const t = n.spineItemsManager.get(e);
|
|
2748
2742
|
if (!t)
|
|
2749
2743
|
throw new Error("Spine item not found");
|
|
2750
|
-
const i =
|
|
2744
|
+
const i = de(t.item);
|
|
2751
2745
|
return {
|
|
2752
2746
|
...n.cfi.parseCfi(i),
|
|
2753
|
-
cfi:
|
|
2747
|
+
cfi: de(t.item),
|
|
2754
2748
|
itemIndex: t.index,
|
|
2755
2749
|
node: null
|
|
2756
2750
|
};
|
|
@@ -2801,7 +2795,7 @@ class ao {
|
|
|
2801
2795
|
const s = this.reader.spineItemsManager.get(
|
|
2802
2796
|
o.meta.itemIndex ?? 0
|
|
2803
2797
|
), r = s?.renditionLayout === "reflowable", a = i.mode === "shallow" || !r || !s ? () => {
|
|
2804
|
-
} : this.reader.spine.spineItemsLoader.forceOpen([s.index]), c = "cfi" in t ? t.cfi : void 0, u = c ? this.locatorsByKey.get(c) : void 0, l = (
|
|
2798
|
+
} : this.reader.spine.spineItemsLoader.forceOpen([s.index]), c = "cfi" in t ? t.cfi : void 0, u = c ? this.locatorsByKey.get(c) : void 0, l = (g) => g.pipe(
|
|
2805
2799
|
me(() => {
|
|
2806
2800
|
c && this.deregisterMemoizedStream(c), setTimeout(() => {
|
|
2807
2801
|
a();
|
|
@@ -2811,19 +2805,19 @@ class ao {
|
|
|
2811
2805
|
if (c && u)
|
|
2812
2806
|
return u.observerCount++, l(
|
|
2813
2807
|
u.consolidate$.pipe(
|
|
2814
|
-
S(({ resource:
|
|
2815
|
-
resource:
|
|
2816
|
-
meta:
|
|
2808
|
+
S(({ resource: g, meta: p }) => ({
|
|
2809
|
+
resource: g,
|
|
2810
|
+
meta: p
|
|
2817
2811
|
}))
|
|
2818
2812
|
)
|
|
2819
2813
|
);
|
|
2820
2814
|
const d = this.reader.spine.layout$.pipe(
|
|
2821
2815
|
Ie(10),
|
|
2822
2816
|
ne(o),
|
|
2823
|
-
an((
|
|
2824
|
-
S((
|
|
2825
|
-
...
|
|
2826
|
-
meta:
|
|
2817
|
+
an((g) => ro(g.meta, this.reader).pipe(
|
|
2818
|
+
S((p) => ({
|
|
2819
|
+
...g,
|
|
2820
|
+
meta: p
|
|
2827
2821
|
}))
|
|
2828
2822
|
), o),
|
|
2829
2823
|
J({ refCount: !0, bufferSize: 1 })
|
|
@@ -2863,16 +2857,16 @@ const co = (n) => (e) => {
|
|
|
2863
2857
|
}, uo = (n) => ({
|
|
2864
2858
|
put: (s, r) => new Promise((a, c) => {
|
|
2865
2859
|
const u = n.transaction(["store"], "readwrite");
|
|
2866
|
-
u.onerror = (
|
|
2867
|
-
c(
|
|
2860
|
+
u.onerror = (g) => {
|
|
2861
|
+
c(g);
|
|
2868
2862
|
}, u.oncomplete = () => {
|
|
2869
2863
|
a();
|
|
2870
2864
|
};
|
|
2871
2865
|
const d = u.objectStore("store").put(r, s);
|
|
2872
2866
|
d.onsuccess = () => {
|
|
2873
2867
|
a();
|
|
2874
|
-
}, d.onerror = (
|
|
2875
|
-
c(
|
|
2868
|
+
}, d.onerror = (g) => {
|
|
2869
|
+
c(g);
|
|
2876
2870
|
};
|
|
2877
2871
|
}),
|
|
2878
2872
|
keys: () => new Promise((s, r) => {
|
|
@@ -2923,7 +2917,7 @@ const co = (n) => (e) => {
|
|
|
2923
2917
|
};
|
|
2924
2918
|
}), lo = (n) => {
|
|
2925
2919
|
let e = Date.now().toString();
|
|
2926
|
-
const t = new
|
|
2920
|
+
const t = new N(), i = (c) => {
|
|
2927
2921
|
if (typeof c == "string" || typeof c == "object") {
|
|
2928
2922
|
const u = typeof c == "object" ? c.id : c;
|
|
2929
2923
|
return n.manifest?.spineItems.find((l) => l.id === u);
|
|
@@ -2932,11 +2926,11 @@ const co = (n) => (e) => {
|
|
|
2932
2926
|
}, o = async (c, u) => {
|
|
2933
2927
|
const l = i(c);
|
|
2934
2928
|
if (!l) return new Response("Item not found", { status: 404 });
|
|
2935
|
-
const
|
|
2936
|
-
if (
|
|
2937
|
-
return new Response(
|
|
2938
|
-
const
|
|
2939
|
-
return s(l,
|
|
2929
|
+
const g = await (await Ve("prose-reader")).get(`${e}_${l.id}`);
|
|
2930
|
+
if (g)
|
|
2931
|
+
return new Response(g, { status: 200 });
|
|
2932
|
+
const p = u && await u(l) || await fetch(l.href);
|
|
2933
|
+
return s(l, p.clone()), p;
|
|
2940
2934
|
}, s = (c, u) => {
|
|
2941
2935
|
t.next({ id: c, data: u });
|
|
2942
2936
|
};
|
|
@@ -2946,7 +2940,7 @@ const co = (n) => (e) => {
|
|
|
2946
2940
|
return l ? k(
|
|
2947
2941
|
un([Ve("prose-reader"), k(u.blob())])
|
|
2948
2942
|
).pipe(
|
|
2949
|
-
Y(([d,
|
|
2943
|
+
Y(([d, g]) => k(d.put(`${e}_${l.id}`, g))),
|
|
2950
2944
|
st((d) => (A.error(d), _))
|
|
2951
2945
|
) : _;
|
|
2952
2946
|
}),
|
|
@@ -3036,7 +3030,7 @@ class mo extends G {
|
|
|
3036
3030
|
super();
|
|
3037
3031
|
const t = e.contentDocument || e.contentWindow?.document;
|
|
3038
3032
|
if (!t)
|
|
3039
|
-
this.selectionChange$ =
|
|
3033
|
+
this.selectionChange$ = he, this.selectionOver$ = he;
|
|
3040
3034
|
else {
|
|
3041
3035
|
const i = ct(t.body, {
|
|
3042
3036
|
childList: !0,
|
|
@@ -3089,7 +3083,7 @@ class mo extends G {
|
|
|
3089
3083
|
const fo = (n) => n.watch("isLoaded").pipe(
|
|
3090
3084
|
w(() => {
|
|
3091
3085
|
const e = n.renderer.getDocumentFrame(), t = e?.contentDocument || e?.contentWindow?.document;
|
|
3092
|
-
if (!e || !t) return
|
|
3086
|
+
if (!e || !t) return he;
|
|
3093
3087
|
const i = new mo(e);
|
|
3094
3088
|
return P(
|
|
3095
3089
|
i.selectionChange$.pipe(
|
|
@@ -3116,20 +3110,20 @@ const fo = (n) => n.watch("isLoaded").pipe(
|
|
|
3116
3110
|
})
|
|
3117
3111
|
);
|
|
3118
3112
|
}),
|
|
3119
|
-
|
|
3113
|
+
R()
|
|
3120
3114
|
), yo = (n) => (e) => {
|
|
3121
3115
|
const t = n(e);
|
|
3122
3116
|
let i;
|
|
3123
3117
|
const o = t.spineItemsManager.items$.pipe(
|
|
3124
3118
|
w((l) => {
|
|
3125
|
-
const d = l.map((
|
|
3126
|
-
const
|
|
3127
|
-
return fo(
|
|
3119
|
+
const d = l.map((g) => {
|
|
3120
|
+
const p = t.spineItemsManager.getSpineItemIndex(g) ?? 0;
|
|
3121
|
+
return fo(g).pipe(
|
|
3128
3122
|
S((h) => {
|
|
3129
3123
|
if (h)
|
|
3130
3124
|
return {
|
|
3131
3125
|
...h,
|
|
3132
|
-
itemIndex:
|
|
3126
|
+
itemIndex: p
|
|
3133
3127
|
};
|
|
3134
3128
|
})
|
|
3135
3129
|
);
|
|
@@ -3137,19 +3131,19 @@ const fo = (n) => n.watch("isLoaded").pipe(
|
|
|
3137
3131
|
return P(...d);
|
|
3138
3132
|
}),
|
|
3139
3133
|
ne(void 0),
|
|
3140
|
-
|
|
3141
|
-
|
|
3134
|
+
R(),
|
|
3135
|
+
x((l) => {
|
|
3142
3136
|
i = l;
|
|
3143
3137
|
}),
|
|
3144
3138
|
J({ refCount: !0, bufferSize: 1 })
|
|
3145
3139
|
), s = o, r = o.pipe(
|
|
3146
3140
|
S((l) => !!l),
|
|
3147
|
-
|
|
3141
|
+
R(),
|
|
3148
3142
|
C((l) => l),
|
|
3149
3143
|
D()
|
|
3150
3144
|
), a = r.pipe(
|
|
3151
3145
|
w(() => s),
|
|
3152
|
-
|
|
3146
|
+
R(),
|
|
3153
3147
|
C((l) => !l),
|
|
3154
3148
|
D()
|
|
3155
3149
|
), c = o.pipe(
|
|
@@ -3307,18 +3301,18 @@ class $o extends Q {
|
|
|
3307
3301
|
constructor(e, t, i, o, s) {
|
|
3308
3302
|
super({
|
|
3309
3303
|
element: void 0
|
|
3310
|
-
}), this.viewport = e, this.settings = t, this.hookManager = i, this.spine = o, this.context = s, this.navigateSubject = new
|
|
3304
|
+
}), this.viewport = e, this.settings = t, this.hookManager = i, this.spine = o, this.context = s, this.navigateSubject = new N(), this.scrollingSubject = new q(!1), this.isScrolling$ = this.scrollingSubject.asObservable(), this.setViewportPosition = ({
|
|
3311
3305
|
position: d
|
|
3312
3306
|
}) => {
|
|
3313
|
-
const
|
|
3307
|
+
const g = this.value.element;
|
|
3314
3308
|
this.scrollingSubject.next(!0);
|
|
3315
|
-
const
|
|
3316
|
-
|
|
3317
|
-
left:
|
|
3318
|
-
top:
|
|
3309
|
+
const p = this.fromSpinePosition(d);
|
|
3310
|
+
g?.scrollTo({
|
|
3311
|
+
left: p.x,
|
|
3312
|
+
top: p.y,
|
|
3319
3313
|
behavior: "instant"
|
|
3320
3314
|
}), Te(1).pipe(
|
|
3321
|
-
|
|
3315
|
+
x(() => {
|
|
3322
3316
|
this.scrollingSubject.next(!1);
|
|
3323
3317
|
}),
|
|
3324
3318
|
T(P(this.scrollingSubject.pipe(Ft(1)), this.destroy$))
|
|
@@ -3326,19 +3320,19 @@ class $o extends Q {
|
|
|
3326
3320
|
};
|
|
3327
3321
|
const r = this.context.pipe(
|
|
3328
3322
|
Ke(["rootElement"]),
|
|
3329
|
-
|
|
3323
|
+
x(({ rootElement: d }) => {
|
|
3330
3324
|
if (!d) return;
|
|
3331
|
-
const
|
|
3332
|
-
|
|
3325
|
+
const g = document.createElement("div");
|
|
3326
|
+
g.setAttribute(`data-${si}`, ""), g.appendChild(this.viewport.value.element), d.appendChild(g), this.update({ element: g });
|
|
3333
3327
|
})
|
|
3334
3328
|
), a = j([
|
|
3335
3329
|
t.watch(["computedPageTurnMode"]),
|
|
3336
3330
|
this.watch("element")
|
|
3337
3331
|
]).pipe(
|
|
3338
|
-
|
|
3339
|
-
|
|
3332
|
+
x(([{ computedPageTurnMode: d }, g]) => {
|
|
3333
|
+
g && (d === "scrollable" ? g.style.display = "block" : g.style.display = "contents");
|
|
3340
3334
|
})
|
|
3341
|
-
), c = this.navigateSubject.pipe(
|
|
3335
|
+
), c = this.navigateSubject.pipe(x(this.setViewportPosition));
|
|
3342
3336
|
this.isNavigating$ = this.navigateSubject.pipe(
|
|
3343
3337
|
ne(!1),
|
|
3344
3338
|
w(() => P(v(!0), v(!1))),
|
|
@@ -3361,14 +3355,14 @@ class $o extends Q {
|
|
|
3361
3355
|
ne(!0)
|
|
3362
3356
|
)
|
|
3363
3357
|
),
|
|
3364
|
-
|
|
3358
|
+
R(),
|
|
3365
3359
|
ne(!1)
|
|
3366
3360
|
), l = j([
|
|
3367
3361
|
u,
|
|
3368
3362
|
this.isScrolling$
|
|
3369
3363
|
]).pipe(
|
|
3370
3364
|
S(
|
|
3371
|
-
([d,
|
|
3365
|
+
([d, g]) => d || g
|
|
3372
3366
|
),
|
|
3373
3367
|
J(1)
|
|
3374
3368
|
);
|
|
@@ -3377,12 +3371,12 @@ class $o extends Q {
|
|
|
3377
3371
|
w(
|
|
3378
3372
|
(d) => t.watch(["computedPageTurnMode"]).pipe(
|
|
3379
3373
|
w(
|
|
3380
|
-
({ computedPageTurnMode:
|
|
3374
|
+
({ computedPageTurnMode: g }) => g === "controlled" ? he : X(d, "scroll").pipe(
|
|
3381
3375
|
z(l),
|
|
3382
3376
|
C(
|
|
3383
|
-
([,
|
|
3377
|
+
([, p]) => !p
|
|
3384
3378
|
),
|
|
3385
|
-
S(([
|
|
3379
|
+
S(([p]) => p)
|
|
3386
3380
|
)
|
|
3387
3381
|
)
|
|
3388
3382
|
)
|
|
@@ -3419,7 +3413,7 @@ class $o extends Q {
|
|
|
3419
3413
|
}
|
|
3420
3414
|
}
|
|
3421
3415
|
const To = (n, e, t, i, o) => {
|
|
3422
|
-
const s = n.clientWidth, r = n.clientHeight, a = n.scrollLeft, c = n.scrollTop, u = a + s / 2 - i, l = c + r / 2 - o, d = t / e,
|
|
3416
|
+
const s = n.clientWidth, r = n.clientHeight, a = n.scrollLeft, c = n.scrollTop, u = a + s / 2 - i, l = c + r / 2 - o, d = t / e, g = u * d, p = l * d, h = g - s / 2 + i, m = p - r / 2 + o;
|
|
3423
3417
|
return new xo({
|
|
3424
3418
|
x: h,
|
|
3425
3419
|
y: m
|
|
@@ -3436,11 +3430,11 @@ const To = (n, e, t, i, o) => {
|
|
|
3436
3430
|
`data-${W}-zooming-direction`,
|
|
3437
3431
|
d
|
|
3438
3432
|
), n < 1 ? o.style.transformOrigin = "top" : n > 1 && (o.style.transformOrigin = `${c}px ${u}px`), o.style.transform = `scale(${n})`;
|
|
3439
|
-
const
|
|
3433
|
+
const g = i.fromScrollPosition(
|
|
3440
3434
|
l
|
|
3441
3435
|
);
|
|
3442
3436
|
e.navigation.navigate({
|
|
3443
|
-
position:
|
|
3437
|
+
position: g
|
|
3444
3438
|
});
|
|
3445
3439
|
}, we = 200;
|
|
3446
3440
|
class Lo extends Q {
|
|
@@ -3449,7 +3443,7 @@ class Lo extends Q {
|
|
|
3449
3443
|
isZooming: !1,
|
|
3450
3444
|
currentScale: 1,
|
|
3451
3445
|
currentPosition: { x: 0, y: 0 }
|
|
3452
|
-
}), this.reader = e, this.enterSubject = new
|
|
3446
|
+
}), this.reader = e, this.enterSubject = new N(), this.exitSubject = new N();
|
|
3453
3447
|
const t = this.enterSubject.pipe(
|
|
3454
3448
|
w((o) => {
|
|
3455
3449
|
const { scale: s = 1, animate: r = !1 } = o ?? {}, a = this.reader.viewport.value.element;
|
|
@@ -3464,7 +3458,7 @@ class Lo extends Q {
|
|
|
3464
3458
|
currentScale: 1,
|
|
3465
3459
|
currentPosition: { x: 0, y: 0 }
|
|
3466
3460
|
}), this.updateZoom(s), s !== 1 && this.isControlled ? Te(o?.animate ? we : 0).pipe(
|
|
3467
|
-
|
|
3461
|
+
x(() => {
|
|
3468
3462
|
this.reader.layout();
|
|
3469
3463
|
})
|
|
3470
3464
|
) : _;
|
|
@@ -3483,7 +3477,7 @@ class Lo extends Q {
|
|
|
3483
3477
|
), o?.animate && this.isControlled && (s.style.transition = `transform ${we}ms`), this.updateZoom(1, { x: 0, y: 0 }), s.style.transform = "", this.mergeCompare({
|
|
3484
3478
|
isZooming: !1
|
|
3485
3479
|
}), Te(o?.animate ? we : 0).pipe(
|
|
3486
|
-
|
|
3480
|
+
x(() => {
|
|
3487
3481
|
const r = this.reader.viewport.value.element;
|
|
3488
3482
|
r.style.transformOrigin = "", r.style.transition = "", this.isControlled && this.reader.layout();
|
|
3489
3483
|
}),
|
|
@@ -3569,7 +3563,7 @@ const ft = `${Vt}-enhancer-zoom`, Mo = (n) => (e) => {
|
|
|
3569
3563
|
class Co {
|
|
3570
3564
|
constructor() {
|
|
3571
3565
|
this.navigationSubject = new ot(1), this.viewportStateSubject = new q("free"), this.paginationSubject = new ot(), this.navigationIsLockedSubject = new q(!1), this.pagination$ = this.paginationSubject.asObservable(), this.navigationUnlocked$ = this.navigationIsLockedSubject.pipe(
|
|
3572
|
-
|
|
3566
|
+
R(),
|
|
3573
3567
|
C((e) => !e)
|
|
3574
3568
|
), this.viewportState$ = this.viewportStateSubject.asObservable(), this.viewportFree$ = this.viewportState$.pipe(
|
|
3575
3569
|
C((e) => e === "free")
|
|
@@ -3584,7 +3578,7 @@ class Eo extends Q {
|
|
|
3584
3578
|
assumedRenditionLayout: "reflowable"
|
|
3585
3579
|
}), this.bridgeEvent = new Co(), this.manifest$ = this.pipe(
|
|
3586
3580
|
ie((e) => e.manifest),
|
|
3587
|
-
|
|
3581
|
+
pe(Z),
|
|
3588
3582
|
be()
|
|
3589
3583
|
), this.isRTL = () => this.value.manifest?.readingDirection === "rtl";
|
|
3590
3584
|
}
|
|
@@ -3623,7 +3617,7 @@ class Do extends Q {
|
|
|
3623
3617
|
renditionLayout: i?.renditionLayout,
|
|
3624
3618
|
computedPageTurnMode: s
|
|
3625
3619
|
})),
|
|
3626
|
-
|
|
3620
|
+
R(O),
|
|
3627
3621
|
S(
|
|
3628
3622
|
({
|
|
3629
3623
|
hasVerticalWriting: i,
|
|
@@ -3672,8 +3666,8 @@ class Ao {
|
|
|
3672
3666
|
(r) => e === r.name
|
|
3673
3667
|
).map((r) => {
|
|
3674
3668
|
let a = () => v(void 0);
|
|
3675
|
-
const c = new
|
|
3676
|
-
a =
|
|
3669
|
+
const c = new N(), u = (g) => {
|
|
3670
|
+
a = g;
|
|
3677
3671
|
}, l = () => (c.next(), c.complete(), a() ?? v(void 0)), d = r.runFn({
|
|
3678
3672
|
// biome-ignore lint/suspicious/noExplicitAny: TODO
|
|
3679
3673
|
...i,
|
|
@@ -3703,7 +3697,7 @@ class Ao {
|
|
|
3703
3697
|
return j(s);
|
|
3704
3698
|
}
|
|
3705
3699
|
}
|
|
3706
|
-
const
|
|
3700
|
+
const No = "[data-prose-reader-scroll-navigator]{height:100%;width:100%;position:relative;overflow-y:scroll;overflow-x:hidden}[data-prose-reader-viewport]{background-color:#fff;position:relative;height:100%;width:100%}", Ro = (n) => ({
|
|
3707
3701
|
x: -n.x,
|
|
3708
3702
|
y: -n.y
|
|
3709
3703
|
}), Oo = (n) => n instanceof DOMMatrix ? new M({
|
|
@@ -3715,13 +3709,13 @@ const Ro = "[data-prose-reader-scroll-navigator]{height:100%;width:100%;position
|
|
|
3715
3709
|
}), Vo = "navigation/ViewportNavigator", yt = A.namespace(Vo);
|
|
3716
3710
|
class jo extends G {
|
|
3717
3711
|
constructor(e, t, i, o, s) {
|
|
3718
|
-
super(), this.settings = e, this.hookManager = t, this.context = i, this.spine = o, this.viewport = s, this.navigateSubject = new
|
|
3712
|
+
super(), this.settings = e, this.hookManager = t, this.context = i, this.spine = o, this.viewport = s, this.navigateSubject = new N(), this.element$ = new q(
|
|
3719
3713
|
document.createElement("div")
|
|
3720
3714
|
);
|
|
3721
3715
|
const r = this.spine.element$.pipe(
|
|
3722
3716
|
C(Z),
|
|
3723
3717
|
z(this.element$),
|
|
3724
|
-
|
|
3718
|
+
x(([l, d]) => {
|
|
3725
3719
|
d.style.cssText = `
|
|
3726
3720
|
height: 100%;
|
|
3727
3721
|
width: 100%;
|
|
@@ -3736,18 +3730,18 @@ class jo extends G {
|
|
|
3736
3730
|
a,
|
|
3737
3731
|
this.element$
|
|
3738
3732
|
]).pipe(
|
|
3739
|
-
|
|
3733
|
+
x(([, l]) => {
|
|
3740
3734
|
e.values.computedPageTurnMode === "scrollable" ? l.style.display = "contents" : l.style.display = "block";
|
|
3741
3735
|
})
|
|
3742
3736
|
);
|
|
3743
3737
|
this.layout$ = c.pipe(
|
|
3744
|
-
|
|
3738
|
+
x(() => {
|
|
3745
3739
|
yt.info("layout", e.values);
|
|
3746
3740
|
}),
|
|
3747
3741
|
D()
|
|
3748
3742
|
);
|
|
3749
3743
|
const u = this.navigateSubject.pipe(
|
|
3750
|
-
|
|
3744
|
+
x((l) => {
|
|
3751
3745
|
yt.info("Navigation requested", l);
|
|
3752
3746
|
})
|
|
3753
3747
|
);
|
|
@@ -3763,9 +3757,9 @@ class jo extends G {
|
|
|
3763
3757
|
return d.style.setProperty("transition", "none"), d.style.setProperty("opacity", "1"), P(
|
|
3764
3758
|
v(!0),
|
|
3765
3759
|
v(null).pipe(
|
|
3766
|
-
|
|
3760
|
+
ge(() => {
|
|
3767
3761
|
if (l?.type !== "manualAdjust") return v(!1);
|
|
3768
|
-
const
|
|
3762
|
+
const g = l.animation === "snap" ? e.values.snapAnimationDuration : e.values.computedPageTurnAnimationDuration, p = l.animation === "snap" ? "slide" : e.values.computedPageTurnAnimation;
|
|
3769
3763
|
return v(l).pipe(
|
|
3770
3764
|
/**
|
|
3771
3765
|
* @important
|
|
@@ -3776,14 +3770,14 @@ class jo extends G {
|
|
|
3776
3770
|
* However when user is repeatedly turning page, we can improve smoothness by delaying a bit the adjustment
|
|
3777
3771
|
*/
|
|
3778
3772
|
l.shouldAnimate ? Pe(1, re) : xe,
|
|
3779
|
-
|
|
3773
|
+
x((h) => {
|
|
3780
3774
|
const m = this.element$.getValue();
|
|
3781
|
-
h.shouldAnimate ?
|
|
3775
|
+
h.shouldAnimate ? p === "fade" ? (m.style.setProperty(
|
|
3782
3776
|
"transition",
|
|
3783
|
-
`opacity ${
|
|
3784
|
-
), m.style.setProperty("opacity", "0")) : (l.animation === "snap" ||
|
|
3777
|
+
`opacity ${g / 2}ms`
|
|
3778
|
+
), m.style.setProperty("opacity", "0")) : (l.animation === "snap" || p === "slide") && (m.style.setProperty(
|
|
3785
3779
|
"transition",
|
|
3786
|
-
`transform ${
|
|
3780
|
+
`transform ${g}ms`
|
|
3787
3781
|
), m.style.setProperty("opacity", "1")) : (m.style.setProperty("transition", "none"), m.style.setProperty("opacity", "1"));
|
|
3788
3782
|
}),
|
|
3789
3783
|
/**
|
|
@@ -3794,17 +3788,17 @@ class jo extends G {
|
|
|
3794
3788
|
* need to adjust to anchor to the payload position. This is because we use viewport computed position,
|
|
3795
3789
|
* not the value set by `setProperty`
|
|
3796
3790
|
*/
|
|
3797
|
-
|
|
3798
|
-
|
|
3791
|
+
x((h) => {
|
|
3792
|
+
p !== "fade" && this.setViewportPosition(h.position);
|
|
3799
3793
|
}),
|
|
3800
|
-
l.shouldAnimate ? Pe(
|
|
3801
|
-
|
|
3794
|
+
l.shouldAnimate ? Pe(g / 2, re) : xe,
|
|
3795
|
+
x((h) => {
|
|
3802
3796
|
const m = this.element$.getValue();
|
|
3803
|
-
|
|
3797
|
+
p === "fade" && (this.setViewportPosition(h.position), m.style.setProperty("opacity", "1"));
|
|
3804
3798
|
}),
|
|
3805
|
-
l.shouldAnimate ? Pe(
|
|
3806
|
-
|
|
3807
|
-
|
|
3799
|
+
l.shouldAnimate ? Pe(g / 2, re) : xe,
|
|
3800
|
+
x((h) => {
|
|
3801
|
+
p === "fade" && this.setViewportPosition(h.position);
|
|
3808
3802
|
})
|
|
3809
3803
|
);
|
|
3810
3804
|
}),
|
|
@@ -3825,7 +3819,7 @@ class jo extends G {
|
|
|
3825
3819
|
* for remark about flicker / fonts smoothing
|
|
3826
3820
|
*/
|
|
3827
3821
|
setViewportPosition(e) {
|
|
3828
|
-
const t = this.element$.getValue(), i =
|
|
3822
|
+
const t = this.element$.getValue(), i = Ro(e);
|
|
3829
3823
|
t.style.transform = `translate(${i.x}px, ${i.y}px)`, this.hookManager.execute("onViewportOffsetAdjust", void 0, {});
|
|
3830
3824
|
}
|
|
3831
3825
|
navigate(e) {
|
|
@@ -3869,7 +3863,7 @@ const ko = () => (n) => n.pipe(
|
|
|
3869
3863
|
}))
|
|
3870
3864
|
)),
|
|
3871
3865
|
ko(),
|
|
3872
|
-
|
|
3866
|
+
R(
|
|
3873
3867
|
(i, o) => i.navigation.paginationBeginCfi === o.navigation.paginationBeginCfi
|
|
3874
3868
|
),
|
|
3875
3869
|
S(
|
|
@@ -4012,23 +4006,23 @@ const ko = () => (n) => n.pipe(
|
|
|
4012
4006
|
spineItem: c,
|
|
4013
4007
|
cfi: u,
|
|
4014
4008
|
directionFromLastNavigation: l
|
|
4015
|
-
} = r, { navigationSnapThreshold: d, computedPageTurnMode:
|
|
4009
|
+
} = r, { navigationSnapThreshold: d, computedPageTurnMode: g } = n.values;
|
|
4016
4010
|
if (c !== void 0) {
|
|
4017
|
-
const
|
|
4018
|
-
if (
|
|
4011
|
+
const p = e.get(c);
|
|
4012
|
+
if (p) return p;
|
|
4019
4013
|
}
|
|
4020
4014
|
if (typeof c == "number")
|
|
4021
4015
|
return c > e.items.length - 1 ? e.get(e.items.length - 1) : e.get(0);
|
|
4022
4016
|
if (u) {
|
|
4023
|
-
const
|
|
4024
|
-
if (
|
|
4017
|
+
const p = e.getSpineItemFromCfi(u);
|
|
4018
|
+
if (p) return p;
|
|
4025
4019
|
}
|
|
4026
|
-
if (a &&
|
|
4027
|
-
const { beginIndex:
|
|
4020
|
+
if (a && g === "controlled") {
|
|
4021
|
+
const { beginIndex: p, endIndex: h } = i.getVisibleSpineItemsFromPosition({
|
|
4028
4022
|
position: a,
|
|
4029
4023
|
threshold: d,
|
|
4030
4024
|
restrictToScreen: !1
|
|
4031
|
-
}) ?? {}, m = (l === "forward" || l === "anchor" ? h :
|
|
4025
|
+
}) ?? {}, m = (l === "forward" || l === "anchor" ? h : p) ?? p, y = e.get(m);
|
|
4032
4026
|
if (!y) return;
|
|
4033
4027
|
const { endPageIndex: f, beginPageIndex: I } = i.getVisiblePagesFromViewportPosition({
|
|
4034
4028
|
position: a,
|
|
@@ -4038,14 +4032,14 @@ const ko = () => (n) => n.pipe(
|
|
|
4038
4032
|
}) ?? {}, b = (l === "forward" || l === "anchor" ? f : I) ?? 0, F = t.getNavigationForSpineItemPage({
|
|
4039
4033
|
pageIndex: b,
|
|
4040
4034
|
spineItemId: y
|
|
4041
|
-
}),
|
|
4035
|
+
}), $ = i.getVisibleSpineItemsFromPosition({
|
|
4042
4036
|
position: F,
|
|
4043
4037
|
threshold: d,
|
|
4044
4038
|
restrictToScreen: !1
|
|
4045
|
-
}), L = l === "forward" || l === "anchor" ?
|
|
4039
|
+
}), L = l === "forward" || l === "anchor" ? $?.beginIndex : $?.endIndex;
|
|
4046
4040
|
return e.get(L);
|
|
4047
4041
|
}
|
|
4048
|
-
return a &&
|
|
4042
|
+
return a && g === "scrollable" ? i.getSpineItemFromPosition(a) : e.get(0);
|
|
4049
4043
|
};
|
|
4050
4044
|
return o.pipe(
|
|
4051
4045
|
S(({ navigation: r, ...a }) => {
|
|
@@ -4097,11 +4091,11 @@ const ko = () => (n) => n.pipe(
|
|
|
4097
4091
|
spineItem: u,
|
|
4098
4092
|
threshold: a,
|
|
4099
4093
|
restrictToScreen: !1
|
|
4100
|
-
}) ?? {},
|
|
4101
|
-
pageIndex:
|
|
4094
|
+
}) ?? {}, g = (r.directionFromLastNavigation === "forward" || r.directionFromLastNavigation === "anchor" ? l : d) ?? 0, p = i.getNavigationForSpineItemPage({
|
|
4095
|
+
pageIndex: g,
|
|
4102
4096
|
spineItemId: u
|
|
4103
4097
|
}), h = t.getVisiblePagesFromViewportPosition({
|
|
4104
|
-
position:
|
|
4098
|
+
position: p,
|
|
4105
4099
|
spineItem: u,
|
|
4106
4100
|
threshold: { type: "percentage", value: 0 },
|
|
4107
4101
|
restrictToScreen: !0
|
|
@@ -4149,7 +4143,7 @@ class Xt {
|
|
|
4149
4143
|
constructor() {
|
|
4150
4144
|
this.isLockedSubject = new q(0), this.isLocked$ = this.isLockedSubject.pipe(
|
|
4151
4145
|
S((e) => !!e),
|
|
4152
|
-
|
|
4146
|
+
R()
|
|
4153
4147
|
);
|
|
4154
4148
|
}
|
|
4155
4149
|
lock() {
|
|
@@ -4177,39 +4171,39 @@ const Yo = ({
|
|
|
4177
4171
|
if (e.url !== void 0 && (u || l || // when spine item is ready dimensions may have not changed but the position
|
|
4178
4172
|
// of dom elements may have!
|
|
4179
4173
|
r && !e.spineItemIsReady)) {
|
|
4180
|
-
const
|
|
4174
|
+
const p = t.getNavigationForUrl(
|
|
4181
4175
|
e.url
|
|
4182
4176
|
);
|
|
4183
|
-
if (
|
|
4184
|
-
return
|
|
4177
|
+
if (p)
|
|
4178
|
+
return p.position;
|
|
4185
4179
|
}
|
|
4186
|
-
const
|
|
4187
|
-
if (
|
|
4180
|
+
const g = e.cfi ?? e.paginationBeginCfi;
|
|
4181
|
+
if (g !== void 0 && !Be(g) && (u || l || // when spine item is ready dimensions may have not changed but the position
|
|
4188
4182
|
// of dom elements may have!
|
|
4189
4183
|
r && !e.spineItemIsReady)) {
|
|
4190
|
-
const
|
|
4191
|
-
if (
|
|
4192
|
-
return
|
|
4184
|
+
const p = t.getNavigationForCfi(g);
|
|
4185
|
+
if (p)
|
|
4186
|
+
return p;
|
|
4193
4187
|
}
|
|
4194
4188
|
if (c && d && e.directionFromLastNavigation === "backward") {
|
|
4195
|
-
const
|
|
4189
|
+
const p = new E({
|
|
4196
4190
|
x: (e.positionInSpineItem?.x ?? 0) + u,
|
|
4197
4191
|
y: (e.positionInSpineItem?.y ?? 0) + l
|
|
4198
4192
|
});
|
|
4199
4193
|
return t.getNavigationFromSpineItemPosition({
|
|
4200
4194
|
spineItem: s,
|
|
4201
|
-
spineItemPosition:
|
|
4195
|
+
spineItemPosition: p
|
|
4202
4196
|
});
|
|
4203
4197
|
}
|
|
4204
4198
|
if (e.positionInSpineItem && e.spineItemHeight && e.spineItemWidth) {
|
|
4205
|
-
const
|
|
4199
|
+
const p = n.spineItemLocator.getSpineItemPageIndexFromPosition({
|
|
4206
4200
|
itemWidth: e.spineItemWidth,
|
|
4207
4201
|
itemHeight: e.spineItemHeight,
|
|
4208
4202
|
isUsingVerticalWriting: !!e.spineItemIsUsingVerticalWriting,
|
|
4209
4203
|
position: e.positionInSpineItem
|
|
4210
4204
|
});
|
|
4211
4205
|
return t.getNavigationForSpineItemPage({
|
|
4212
|
-
pageIndex:
|
|
4206
|
+
pageIndex: p,
|
|
4213
4207
|
spineItemId: s
|
|
4214
4208
|
});
|
|
4215
4209
|
}
|
|
@@ -4239,7 +4233,7 @@ const Yo = ({
|
|
|
4239
4233
|
if (u === n.spineItemTop && c === n.spineItemHeight && !l)
|
|
4240
4234
|
return o.getNavigationForSpineIndexOrId(a);
|
|
4241
4235
|
if (u !== n.spineItemTop) {
|
|
4242
|
-
const
|
|
4236
|
+
const g = e.getSafeSpineItemPositionFromUnsafeSpineItemPosition(
|
|
4243
4237
|
n.positionInSpineItem ?? new E({
|
|
4244
4238
|
x: 0,
|
|
4245
4239
|
y: 0
|
|
@@ -4247,18 +4241,18 @@ const Yo = ({
|
|
|
4247
4241
|
a
|
|
4248
4242
|
);
|
|
4249
4243
|
return e.getSpinePositionFromSpineItemPosition({
|
|
4250
|
-
spineItemPosition:
|
|
4244
|
+
spineItemPosition: g,
|
|
4251
4245
|
spineItem: a
|
|
4252
4246
|
});
|
|
4253
4247
|
}
|
|
4254
4248
|
if (u === n.spineItemTop && c !== n.spineItemHeight) {
|
|
4255
|
-
const
|
|
4256
|
-
y: n.directionFromLastNavigation === "backward" ? c -
|
|
4249
|
+
const g = (n.spineItemHeight ?? d.y) - d.y, p = new E({
|
|
4250
|
+
y: n.directionFromLastNavigation === "backward" ? c - g : d.y,
|
|
4257
4251
|
x: n.position.x
|
|
4258
4252
|
});
|
|
4259
4253
|
if (l) {
|
|
4260
4254
|
const h = e.getSafeSpineItemPositionFromUnsafeSpineItemPosition(
|
|
4261
|
-
|
|
4255
|
+
p,
|
|
4262
4256
|
a
|
|
4263
4257
|
);
|
|
4264
4258
|
return e.getSpinePositionFromSpineItemPosition({
|
|
@@ -4269,7 +4263,7 @@ const Yo = ({
|
|
|
4269
4263
|
if (!l) {
|
|
4270
4264
|
if (!(n.position.y < u)) {
|
|
4271
4265
|
const m = new E({
|
|
4272
|
-
y: c -
|
|
4266
|
+
y: c - g,
|
|
4273
4267
|
x: n.position.x
|
|
4274
4268
|
});
|
|
4275
4269
|
return e.getSpinePositionFromSpineItemPosition({
|
|
@@ -4347,7 +4341,7 @@ class Ko extends G {
|
|
|
4347
4341
|
position: f,
|
|
4348
4342
|
id: I
|
|
4349
4343
|
})),
|
|
4350
|
-
|
|
4344
|
+
R(
|
|
4351
4345
|
({ position: f, ...I }, { position: b, ...F }) => O(I, F) && O(f, b)
|
|
4352
4346
|
),
|
|
4353
4347
|
J(1)
|
|
@@ -4460,7 +4454,7 @@ class Ko extends G {
|
|
|
4460
4454
|
P(l, u)
|
|
4461
4455
|
)
|
|
4462
4456
|
))
|
|
4463
|
-
),
|
|
4457
|
+
), g = P(
|
|
4464
4458
|
d,
|
|
4465
4459
|
l
|
|
4466
4460
|
).pipe(
|
|
@@ -4505,16 +4499,16 @@ class Ko extends G {
|
|
|
4505
4499
|
}),
|
|
4506
4500
|
S(({ navigation: f }) => f),
|
|
4507
4501
|
D()
|
|
4508
|
-
),
|
|
4502
|
+
), p = Uo(
|
|
4509
4503
|
t,
|
|
4510
4504
|
this.navigationSubject,
|
|
4511
4505
|
a
|
|
4512
4506
|
), h = P(
|
|
4513
|
-
|
|
4507
|
+
g,
|
|
4514
4508
|
u,
|
|
4515
|
-
|
|
4509
|
+
p
|
|
4516
4510
|
), m = (f) => f.pipe(
|
|
4517
|
-
|
|
4511
|
+
x(([I, b]) => {
|
|
4518
4512
|
Jo.info(
|
|
4519
4513
|
`navigation updated from ${I.meta.triggeredBy} of type ${I.type}`,
|
|
4520
4514
|
{
|
|
@@ -4524,12 +4518,12 @@ class Ko extends G {
|
|
|
4524
4518
|
), this.navigationSubject.next(I);
|
|
4525
4519
|
})
|
|
4526
4520
|
), y = (f) => f.pipe(
|
|
4527
|
-
|
|
4528
|
-
const F = I.type === "scroll",
|
|
4521
|
+
x(([I, b]) => {
|
|
4522
|
+
const F = I.type === "scroll", $ = I.meta.triggeredBy === "pagination", L = I.meta.triggeredBy === "restoration", H = O(
|
|
4529
4523
|
b.position,
|
|
4530
4524
|
I.position
|
|
4531
4525
|
);
|
|
4532
|
-
if (F && !L ||
|
|
4526
|
+
if (F && !L || $ || H)
|
|
4533
4527
|
return;
|
|
4534
4528
|
const B = {
|
|
4535
4529
|
position: I.position,
|
|
@@ -4614,8 +4608,8 @@ const Fe = (n, e, t) => {
|
|
|
4614
4608
|
});
|
|
4615
4609
|
if (i)
|
|
4616
4610
|
return vt(t.y, s, d);
|
|
4617
|
-
const
|
|
4618
|
-
return c ? d - 1 -
|
|
4611
|
+
const g = vt(l, o, d);
|
|
4612
|
+
return c ? d - 1 - g : g;
|
|
4619
4613
|
}, es = ({
|
|
4620
4614
|
pageIndex: n,
|
|
4621
4615
|
itemLayout: e,
|
|
@@ -4654,14 +4648,14 @@ const Fe = (n, e, t) => {
|
|
|
4654
4648
|
const i = (a, c, u) => {
|
|
4655
4649
|
let l;
|
|
4656
4650
|
a?.nodeName === "img" || a?.textContent === "" && a.nodeType === Node.ELEMENT_NODE ? l = a.getBoundingClientRect().x : a && (l = (a ? Cn(a, c) : void 0)?.getBoundingClientRect().x || l);
|
|
4657
|
-
const d = u.layoutInfo?.width || 0,
|
|
4651
|
+
const d = u.layoutInfo?.width || 0, g = t.pageSize.width;
|
|
4658
4652
|
if (l !== void 0) {
|
|
4659
|
-
const
|
|
4653
|
+
const p = ke(
|
|
4660
4654
|
l,
|
|
4661
|
-
|
|
4655
|
+
g,
|
|
4662
4656
|
d
|
|
4663
4657
|
);
|
|
4664
|
-
return new E({ x:
|
|
4658
|
+
return new E({ x: p, y: 0 });
|
|
4665
4659
|
}
|
|
4666
4660
|
};
|
|
4667
4661
|
return {
|
|
@@ -4685,12 +4679,12 @@ const Fe = (n, e, t) => {
|
|
|
4685
4679
|
pageTurnMode: e.values.pageTurnMode
|
|
4686
4680
|
}),
|
|
4687
4681
|
getSpineItemPageIndexFromNode: (a, c, u) => {
|
|
4688
|
-
const l = i(a, c, u), { height: d, width:
|
|
4682
|
+
const l = i(a, c, u), { height: d, width: g } = u.layoutInfo;
|
|
4689
4683
|
return l ? wt({
|
|
4690
4684
|
isUsingVerticalWriting: !!u.isUsingVerticalWriting(),
|
|
4691
4685
|
position: l,
|
|
4692
4686
|
itemHeight: d,
|
|
4693
|
-
itemWidth:
|
|
4687
|
+
itemWidth: g,
|
|
4694
4688
|
isRTL: n.isRTL(),
|
|
4695
4689
|
pageWidth: t.pageSize.width,
|
|
4696
4690
|
pageHeight: t.pageSize.height,
|
|
@@ -4714,27 +4708,27 @@ const Fe = (n, e, t) => {
|
|
|
4714
4708
|
});
|
|
4715
4709
|
},
|
|
4716
4710
|
getSpineItemPagePositionFromSpineItemPosition: (a, c, u) => {
|
|
4717
|
-
const { width: l, height: d } = u.layoutInfo,
|
|
4711
|
+
const { width: l, height: d } = u.layoutInfo, g = t.pageSize.width, p = t.pageSize.height;
|
|
4718
4712
|
if (!!u.isUsingVerticalWriting()) {
|
|
4719
4713
|
const y = Fe(
|
|
4720
|
-
|
|
4714
|
+
p,
|
|
4721
4715
|
c,
|
|
4722
4716
|
d
|
|
4723
4717
|
);
|
|
4724
|
-
return new
|
|
4718
|
+
return new Re({
|
|
4725
4719
|
x: a.x,
|
|
4726
4720
|
y: a.y - y
|
|
4727
4721
|
});
|
|
4728
4722
|
}
|
|
4729
|
-
const m = Fe(
|
|
4723
|
+
const m = Fe(g, c, l);
|
|
4730
4724
|
if (n.isRTL()) {
|
|
4731
|
-
const y = l - (c + 1) *
|
|
4732
|
-
return new
|
|
4725
|
+
const y = l - (c + 1) * g;
|
|
4726
|
+
return new Re({
|
|
4733
4727
|
x: a.x - Math.max(0, y),
|
|
4734
4728
|
y: a.y
|
|
4735
4729
|
});
|
|
4736
4730
|
}
|
|
4737
|
-
return new
|
|
4731
|
+
return new Re({
|
|
4738
4732
|
x: a.x - m,
|
|
4739
4733
|
y: a.y
|
|
4740
4734
|
});
|
|
@@ -4782,15 +4776,15 @@ function Gt({
|
|
|
4782
4776
|
s || 0
|
|
4783
4777
|
), a = r.bottom - 1, c = Math.max(0, n.y), u = Math.min(c, a);
|
|
4784
4778
|
if (e) {
|
|
4785
|
-
const
|
|
4779
|
+
const p = Math.min(o, n.x), h = Math.max(p, r.left);
|
|
4786
4780
|
return new M({
|
|
4787
4781
|
x: h,
|
|
4788
4782
|
y: u
|
|
4789
4783
|
});
|
|
4790
4784
|
}
|
|
4791
|
-
const l = r.right - 1, d = Math.max(0, n.x),
|
|
4785
|
+
const l = r.right - 1, d = Math.max(0, n.x), g = Math.min(d, l);
|
|
4792
4786
|
return new M({
|
|
4793
|
-
x:
|
|
4787
|
+
x: g,
|
|
4794
4788
|
y: u
|
|
4795
4789
|
});
|
|
4796
4790
|
}
|
|
@@ -4812,9 +4806,9 @@ const Pt = ({
|
|
|
4812
4806
|
i.items.length - 1
|
|
4813
4807
|
), c = s.getSpineItemSpineLayoutInfo(a), u = c.bottom - t, l = Math.min(r.y, u);
|
|
4814
4808
|
if (e) {
|
|
4815
|
-
const
|
|
4809
|
+
const g = Math.min(0, r.x);
|
|
4816
4810
|
return new M({
|
|
4817
|
-
x:
|
|
4811
|
+
x: g,
|
|
4818
4812
|
y: l
|
|
4819
4813
|
});
|
|
4820
4814
|
}
|
|
@@ -5006,35 +5000,35 @@ const Pt = ({
|
|
|
5006
5000
|
viewport: s
|
|
5007
5001
|
});
|
|
5008
5002
|
return {
|
|
5009
|
-
getNavigationForUrl: (
|
|
5003
|
+
getNavigationForUrl: (p) => as({
|
|
5010
5004
|
context: n,
|
|
5011
5005
|
spineItemsManager: e,
|
|
5012
5006
|
spineLocator: t,
|
|
5013
|
-
url:
|
|
5007
|
+
url: p,
|
|
5014
5008
|
pageSizeWidth: s.pageSize.width,
|
|
5015
5009
|
visibleAreaRectWidth: s.absoluteViewport.width,
|
|
5016
5010
|
spine: o
|
|
5017
5011
|
}),
|
|
5018
|
-
getNavigationForSpineItemPage: (
|
|
5019
|
-
...
|
|
5012
|
+
getNavigationForSpineItemPage: (p) => ns({
|
|
5013
|
+
...p,
|
|
5020
5014
|
spineItemsManager: e,
|
|
5021
5015
|
spineItemNavigationResolver: r,
|
|
5022
5016
|
spineLocator: t,
|
|
5023
5017
|
viewport: s
|
|
5024
5018
|
}),
|
|
5025
|
-
getNavigationFromSpineItemPosition: (
|
|
5026
|
-
...
|
|
5019
|
+
getNavigationFromSpineItemPosition: (p) => cs({
|
|
5020
|
+
...p,
|
|
5027
5021
|
spineItemLocator: t.spineItemLocator,
|
|
5028
5022
|
spineLocator: t,
|
|
5029
5023
|
viewport: s
|
|
5030
5024
|
}),
|
|
5031
|
-
getNavigationForCfi: (
|
|
5032
|
-
const h = e.getSpineItemFromCfi(
|
|
5033
|
-
cfi:
|
|
5025
|
+
getNavigationForCfi: (p) => {
|
|
5026
|
+
const h = e.getSpineItemFromCfi(p), { node: m, offset: y = 0 } = _t({
|
|
5027
|
+
cfi: p,
|
|
5034
5028
|
spineItemsManager: e
|
|
5035
5029
|
});
|
|
5036
5030
|
if (!h) {
|
|
5037
|
-
A.warn(us, `unable to detect item id from cfi ${
|
|
5031
|
+
A.warn(us, `unable to detect item id from cfi ${p}`);
|
|
5038
5032
|
return;
|
|
5039
5033
|
}
|
|
5040
5034
|
const f = m ? r.getNavigationFromNode(h, m, y) : new E({ x: 0, y: 0 }), I = t.getSpinePositionFromSpineItemPosition({
|
|
@@ -5047,10 +5041,10 @@ const Pt = ({
|
|
|
5047
5041
|
visibleAreaRectWidth: s.absoluteViewport.width
|
|
5048
5042
|
});
|
|
5049
5043
|
},
|
|
5050
|
-
getNavigationForLastPage: (
|
|
5051
|
-
const h = r.getNavigationForLastPage(
|
|
5044
|
+
getNavigationForLastPage: (p) => {
|
|
5045
|
+
const h = r.getNavigationForLastPage(p), m = t.getSpinePositionFromSpineItemPosition({
|
|
5052
5046
|
spineItemPosition: h,
|
|
5053
|
-
spineItem:
|
|
5047
|
+
spineItem: p
|
|
5054
5048
|
});
|
|
5055
5049
|
return te({
|
|
5056
5050
|
position: m,
|
|
@@ -5058,8 +5052,8 @@ const Pt = ({
|
|
|
5058
5052
|
visibleAreaRectWidth: s.absoluteViewport.width
|
|
5059
5053
|
});
|
|
5060
5054
|
},
|
|
5061
|
-
getNavigationForSpineIndexOrId: (
|
|
5062
|
-
const h = e.get(
|
|
5055
|
+
getNavigationForSpineIndexOrId: (p) => {
|
|
5056
|
+
const h = e.get(p);
|
|
5063
5057
|
if (h) {
|
|
5064
5058
|
const m = t.getSpinePositionFromSpineItem(h);
|
|
5065
5059
|
return te({
|
|
@@ -5070,14 +5064,14 @@ const Pt = ({
|
|
|
5070
5064
|
}
|
|
5071
5065
|
return new M({ x: 0, y: 0 });
|
|
5072
5066
|
},
|
|
5073
|
-
getNavigationForPosition: (
|
|
5074
|
-
viewportPosition:
|
|
5067
|
+
getNavigationForPosition: (p) => Ye({
|
|
5068
|
+
viewportPosition: p,
|
|
5075
5069
|
spineItemNavigationResolver: r,
|
|
5076
5070
|
spineLocator: t,
|
|
5077
5071
|
viewport: s
|
|
5078
5072
|
}),
|
|
5079
|
-
getMostPredominantNavigationForPosition: (
|
|
5080
|
-
const h = i.values.computedPageTurnDirection, m = 0.5, y = h === "horizontal" ?
|
|
5073
|
+
getMostPredominantNavigationForPosition: (p) => {
|
|
5074
|
+
const h = i.values.computedPageTurnDirection, m = 0.5, y = h === "horizontal" ? p.x + s.absoluteViewport.width * m : 0, f = h === "horizontal" ? 0 : p.y + s.absoluteViewport.height * m, I = Pt({
|
|
5081
5075
|
position: new M({
|
|
5082
5076
|
x: y,
|
|
5083
5077
|
y: f
|
|
@@ -5095,25 +5089,25 @@ const Pt = ({
|
|
|
5095
5089
|
viewport: s
|
|
5096
5090
|
});
|
|
5097
5091
|
},
|
|
5098
|
-
fromUnboundSpinePosition: (
|
|
5099
|
-
position:
|
|
5092
|
+
fromUnboundSpinePosition: (p) => Pt({
|
|
5093
|
+
position: p,
|
|
5100
5094
|
isRTL: n.isRTL(),
|
|
5101
5095
|
pageSizeHeight: s.pageSize.height,
|
|
5102
5096
|
visibleAreaRectWidth: s.absoluteViewport.width,
|
|
5103
5097
|
spineItemsManager: e,
|
|
5104
5098
|
spine: o
|
|
5105
5099
|
}),
|
|
5106
|
-
fromOutOfBoundsSpinePosition: (
|
|
5107
|
-
position:
|
|
5100
|
+
fromOutOfBoundsSpinePosition: (p) => Gt({
|
|
5101
|
+
position: p,
|
|
5108
5102
|
isRTL: n.isRTL(),
|
|
5109
5103
|
spineItemsManager: e,
|
|
5110
5104
|
spine: o,
|
|
5111
5105
|
viewportWidth: s.absoluteViewport.width
|
|
5112
5106
|
}),
|
|
5113
|
-
isNavigationGoingForwardFrom: (
|
|
5114
|
-
arePositionsDifferent: (
|
|
5115
|
-
getAdjustedPositionForSpread: (
|
|
5116
|
-
position:
|
|
5107
|
+
isNavigationGoingForwardFrom: (p, h) => i.values.computedPageTurnDirection === "vertical" ? p.y > h.y : p.x > h.x,
|
|
5108
|
+
arePositionsDifferent: (p, h) => p.x !== h.x || p.y !== h.y,
|
|
5109
|
+
getAdjustedPositionForSpread: (p) => te({
|
|
5110
|
+
position: p,
|
|
5117
5111
|
pageSizeWidth: s.pageSize.width,
|
|
5118
5112
|
visibleAreaRectWidth: s.absoluteViewport.width
|
|
5119
5113
|
}),
|
|
@@ -5127,7 +5121,7 @@ const Pt = ({
|
|
|
5127
5121
|
settings: o,
|
|
5128
5122
|
viewport: s
|
|
5129
5123
|
}) => {
|
|
5130
|
-
const r = new
|
|
5124
|
+
const r = new N(), a = r.asObservable(), c = new Xt(), u = ls({
|
|
5131
5125
|
context: e,
|
|
5132
5126
|
settings: o,
|
|
5133
5127
|
spineItemsManager: n,
|
|
@@ -5146,7 +5140,7 @@ const Pt = ({
|
|
|
5146
5140
|
t,
|
|
5147
5141
|
i,
|
|
5148
5142
|
e
|
|
5149
|
-
),
|
|
5143
|
+
), g = new Ko(
|
|
5150
5144
|
o,
|
|
5151
5145
|
e,
|
|
5152
5146
|
a,
|
|
@@ -5155,11 +5149,11 @@ const Pt = ({
|
|
|
5155
5149
|
u,
|
|
5156
5150
|
i,
|
|
5157
5151
|
c.isLocked$
|
|
5158
|
-
),
|
|
5152
|
+
), p = j([
|
|
5159
5153
|
l.isNavigating$,
|
|
5160
5154
|
d.isNavigating$,
|
|
5161
5155
|
c.isLocked$,
|
|
5162
|
-
|
|
5156
|
+
g.locker.isLocked$
|
|
5163
5157
|
]).pipe(
|
|
5164
5158
|
ie((y) => y.some((f) => f) ? "busy" : "free"),
|
|
5165
5159
|
be(),
|
|
@@ -5167,14 +5161,14 @@ const Pt = ({
|
|
|
5167
5161
|
);
|
|
5168
5162
|
return {
|
|
5169
5163
|
destroy: () => {
|
|
5170
|
-
l.destroy(),
|
|
5164
|
+
l.destroy(), g.destroy();
|
|
5171
5165
|
},
|
|
5172
|
-
getNavigation: () =>
|
|
5173
|
-
internalNavigator:
|
|
5166
|
+
getNavigation: () => g.navigation,
|
|
5167
|
+
internalNavigator: g,
|
|
5174
5168
|
scrollNavigationController: d,
|
|
5175
5169
|
controlledNavigationController: l,
|
|
5176
5170
|
locker: c,
|
|
5177
|
-
navigationState$:
|
|
5171
|
+
navigationState$: p,
|
|
5178
5172
|
navigate: (y) => {
|
|
5179
5173
|
r.next(y);
|
|
5180
5174
|
},
|
|
@@ -5186,7 +5180,7 @@ const Pt = ({
|
|
|
5186
5180
|
return c.lock();
|
|
5187
5181
|
},
|
|
5188
5182
|
navigationResolver: u,
|
|
5189
|
-
navigation$:
|
|
5183
|
+
navigation$: g.navigation$
|
|
5190
5184
|
};
|
|
5191
5185
|
};
|
|
5192
5186
|
class ps extends Q {
|
|
@@ -5226,14 +5220,14 @@ class gs extends G {
|
|
|
5226
5220
|
return this.context.bridgeEvent.navigationUnlocked$.pipe(
|
|
5227
5221
|
$t(1),
|
|
5228
5222
|
z(this.context.bridgeEvent.navigation$),
|
|
5229
|
-
|
|
5223
|
+
x(([, u]) => {
|
|
5230
5224
|
const { position: l } = u, d = this.pagination.value, {
|
|
5231
|
-
beginIndex:
|
|
5232
|
-
endIndex:
|
|
5225
|
+
beginIndex: g,
|
|
5226
|
+
endIndex: p
|
|
5233
5227
|
} = this.spine.locator.getVisibleSpineItemsFromPosition({
|
|
5234
5228
|
position: l,
|
|
5235
5229
|
threshold: { type: "percentage", value: 0.5 }
|
|
5236
|
-
}) ?? {}, h = this.spineItemsManager.get(
|
|
5230
|
+
}) ?? {}, h = this.spineItemsManager.get(g), m = this.spineItemsManager.get(p);
|
|
5237
5231
|
if (!h || !m) return;
|
|
5238
5232
|
const y = d.beginCfi, f = d.endCfi, { beginPageIndex: I = 0 } = c({
|
|
5239
5233
|
spineItem: h,
|
|
@@ -5241,16 +5235,16 @@ class gs extends G {
|
|
|
5241
5235
|
}) ?? {}, { endPageIndex: b = 0 } = c({
|
|
5242
5236
|
spineItem: m,
|
|
5243
5237
|
position: l
|
|
5244
|
-
}) ?? {}, F = y === void 0 || Be(y) || d.beginSpineItemIndex !==
|
|
5238
|
+
}) ?? {}, F = y === void 0 || Be(y) || d.beginSpineItemIndex !== g, $ = d.endSpineItemIndex !== p || f === void 0 || Be(f), L = F ? de(h.item) : y, H = $ ? de(m.item) : f, B = h.numberOfPages, se = m.numberOfPages;
|
|
5245
5239
|
this.pagination.update({
|
|
5246
5240
|
beginCfi: L,
|
|
5247
5241
|
beginNumberOfPagesInSpineItem: B,
|
|
5248
5242
|
beginPageIndexInSpineItem: I,
|
|
5249
|
-
beginSpineItemIndex:
|
|
5243
|
+
beginSpineItemIndex: g,
|
|
5250
5244
|
endCfi: H,
|
|
5251
5245
|
endNumberOfPagesInSpineItem: se,
|
|
5252
5246
|
endPageIndexInSpineItem: b,
|
|
5253
|
-
endSpineItemIndex:
|
|
5247
|
+
endSpineItemIndex: p,
|
|
5254
5248
|
navigationId: u.id
|
|
5255
5249
|
});
|
|
5256
5250
|
})
|
|
@@ -5258,7 +5252,7 @@ class gs extends G {
|
|
|
5258
5252
|
})
|
|
5259
5253
|
), a = r.pipe(
|
|
5260
5254
|
De(this.context.bridgeEvent.viewportFree$),
|
|
5261
|
-
|
|
5255
|
+
x(() => {
|
|
5262
5256
|
const {
|
|
5263
5257
|
beginSpineItemIndex: c,
|
|
5264
5258
|
endSpineItemIndex: u,
|
|
@@ -5267,18 +5261,24 @@ class gs extends G {
|
|
|
5267
5261
|
} = this.pagination.value;
|
|
5268
5262
|
if (l === void 0 || d === void 0 || c === void 0 || u === void 0)
|
|
5269
5263
|
return;
|
|
5270
|
-
const
|
|
5271
|
-
|
|
5272
|
-
|
|
5273
|
-
|
|
5274
|
-
|
|
5275
|
-
|
|
5276
|
-
|
|
5277
|
-
|
|
5278
|
-
|
|
5279
|
-
|
|
5280
|
-
|
|
5281
|
-
|
|
5264
|
+
const g = this.spineItemsManager.get(c), p = this.spineItemsManager.get(u);
|
|
5265
|
+
if (g === void 0 || p === void 0) return;
|
|
5266
|
+
const h = this.spine.pages.fromSpineItemPageIndex(
|
|
5267
|
+
g,
|
|
5268
|
+
l
|
|
5269
|
+
), m = this.spine.pages.fromSpineItemPageIndex(
|
|
5270
|
+
p,
|
|
5271
|
+
d
|
|
5272
|
+
);
|
|
5273
|
+
this.pagination.update({
|
|
5274
|
+
beginCfi: h?.firstVisibleNode ? He({
|
|
5275
|
+
spineItem: g.item,
|
|
5276
|
+
pageNode: h?.firstVisibleNode
|
|
5277
|
+
}) : de(g.item),
|
|
5278
|
+
endCfi: m?.firstVisibleNode ? He({
|
|
5279
|
+
spineItem: p.item,
|
|
5280
|
+
pageNode: m?.firstVisibleNode
|
|
5281
|
+
}) : de(p.item)
|
|
5282
5282
|
});
|
|
5283
5283
|
})
|
|
5284
5284
|
);
|
|
@@ -5296,7 +5296,7 @@ class ms extends G {
|
|
|
5296
5296
|
...this.getDefaultSettings(),
|
|
5297
5297
|
...e
|
|
5298
5298
|
};
|
|
5299
|
-
this.inputSettings = t, this.outputSettingsUpdateSubject = new
|
|
5299
|
+
this.inputSettings = t, this.outputSettingsUpdateSubject = new N(), this._settings$ = this.outputSettingsUpdateSubject.asObservable().pipe(J(1)), this._settings$.subscribe();
|
|
5300
5300
|
}
|
|
5301
5301
|
_prepareUpdate(e) {
|
|
5302
5302
|
const t = $e(this.inputSettings, e), i = this.getOutputSettings(t), o = !O(this.outputSettings, i);
|
|
@@ -5326,8 +5326,8 @@ class ms extends G {
|
|
|
5326
5326
|
}
|
|
5327
5327
|
watch(e) {
|
|
5328
5328
|
return this.values$.pipe(
|
|
5329
|
-
|
|
5330
|
-
|
|
5329
|
+
Nt(e),
|
|
5330
|
+
R(O)
|
|
5331
5331
|
);
|
|
5332
5332
|
}
|
|
5333
5333
|
destroy() {
|
|
@@ -5337,7 +5337,7 @@ class ms extends G {
|
|
|
5337
5337
|
class fs extends ms {
|
|
5338
5338
|
constructor(e, t) {
|
|
5339
5339
|
super(e), this.context = t, t.watch(["manifest", "hasVerticalWriting"]).pipe(
|
|
5340
|
-
|
|
5340
|
+
x(() => this.update(this.values)),
|
|
5341
5341
|
T(this.destroy$)
|
|
5342
5342
|
).subscribe();
|
|
5343
5343
|
}
|
|
@@ -5394,20 +5394,20 @@ class ys extends ye {
|
|
|
5394
5394
|
}
|
|
5395
5395
|
class Ss extends G {
|
|
5396
5396
|
constructor(e, t, i, o, s, r, a) {
|
|
5397
|
-
super(), this.item = e, this.containerElement = t, this.context = i, this.hookManager = o, this.renderer = s, this.settings = r, this.viewport = a, this.layoutTriggerSubject = new
|
|
5397
|
+
super(), this.item = e, this.containerElement = t, this.context = i, this.hookManager = o, this.renderer = s, this.settings = r, this.viewport = a, this.layoutTriggerSubject = new N(), this.lastLayout = null, this.computeLayoutInformation = ({
|
|
5398
5398
|
isLastItem: u,
|
|
5399
5399
|
horizontalOffset: l
|
|
5400
5400
|
}) => {
|
|
5401
|
-
let d = this.viewport.value.pageSize.width,
|
|
5402
|
-
const
|
|
5401
|
+
let d = this.viewport.value.pageSize.width, g = "none";
|
|
5402
|
+
const p = l % this.viewport.absoluteViewport.width === 0, h = this.context.manifest, m = Bt(h) ?? !1;
|
|
5403
5403
|
if (this.settings.values.computedSpreadMode) {
|
|
5404
|
-
!m && this.renderer.renditionLayout === "reflowable" && !u && (d = this.viewport.value.pageSize.width * 2), !m && this.renderer.renditionLayout === "reflowable" && u &&
|
|
5405
|
-
const y =
|
|
5406
|
-
this.item.pageSpreadRight &&
|
|
5404
|
+
!m && this.renderer.renditionLayout === "reflowable" && !u && (d = this.viewport.value.pageSize.width * 2), !m && this.renderer.renditionLayout === "reflowable" && u && p && (d = this.viewport.value.pageSize.width * 2);
|
|
5405
|
+
const y = p && u && m;
|
|
5406
|
+
this.item.pageSpreadRight && p && !this.context.isRTL() ? (g = "before", d = this.viewport.value.pageSize.width * 2) : this.item.pageSpreadLeft && p && this.context.isRTL() ? (g = "before", d = this.viewport.value.pageSize.width * 2) : y && (this.context.isRTL() ? g = "before" : g = "after", d = this.viewport.value.pageSize.width * 2);
|
|
5407
5407
|
}
|
|
5408
5408
|
return {
|
|
5409
5409
|
minimumWidth: d,
|
|
5410
|
-
blankPagePosition:
|
|
5410
|
+
blankPagePosition: g
|
|
5411
5411
|
};
|
|
5412
5412
|
}, this.adjustPositionOfElement = ({
|
|
5413
5413
|
right: u,
|
|
@@ -5419,12 +5419,12 @@ class Ss extends G {
|
|
|
5419
5419
|
minimumWidth: u,
|
|
5420
5420
|
edgeX: l,
|
|
5421
5421
|
edgeY: d
|
|
5422
|
-
}) => (
|
|
5423
|
-
S((
|
|
5422
|
+
}) => (g) => g.pipe(
|
|
5423
|
+
S((p) => {
|
|
5424
5424
|
const h = O(
|
|
5425
5425
|
this.lastLayout?.pageSize,
|
|
5426
5426
|
this.viewport.pageSize
|
|
5427
|
-
) ? this.lastLayout : void 0, { width: m, height: y } = h ?? {}, { width: f = m, height: I = y } =
|
|
5427
|
+
) ? this.lastLayout : void 0, { width: m, height: y } = h ?? {}, { width: f = m, height: I = y } = p ?? {}, { width: b, height: F } = this.viewport.pageSize, $ = this.validateDimension(
|
|
5428
5428
|
f ?? b,
|
|
5429
5429
|
b,
|
|
5430
5430
|
u
|
|
@@ -5434,15 +5434,15 @@ class Ss extends G {
|
|
|
5434
5434
|
F
|
|
5435
5435
|
);
|
|
5436
5436
|
return this.lastLayout = {
|
|
5437
|
-
width:
|
|
5437
|
+
width: $,
|
|
5438
5438
|
height: L,
|
|
5439
5439
|
pageSize: this.viewport.pageSize
|
|
5440
|
-
}, this.containerElement.style.width = `${
|
|
5440
|
+
}, this.containerElement.style.width = `${$}px`, this.containerElement.style.height = `${L}px`, this.settings.values.computedPageTurnDirection === "vertical" ? (this.adjustPositionOfElement({
|
|
5441
5441
|
top: d,
|
|
5442
5442
|
left: l
|
|
5443
|
-
}), { width:
|
|
5443
|
+
}), { width: $, height: L }) : (this.adjustPositionOfElement(
|
|
5444
5444
|
this.context.isRTL() ? { right: l, top: 0 } : { left: l, top: 0 }
|
|
5445
|
-
), { width:
|
|
5445
|
+
), { width: $, height: L });
|
|
5446
5446
|
})
|
|
5447
5447
|
), this.layout = (u) => {
|
|
5448
5448
|
const l = Xn(this.didLayout$.pipe(U()));
|
|
@@ -5450,7 +5450,7 @@ class Ss extends G {
|
|
|
5450
5450
|
};
|
|
5451
5451
|
const c = this.layoutTriggerSubject.pipe(
|
|
5452
5452
|
w(
|
|
5453
|
-
({ spreadPosition: u, horizontalOffset: l, isLastItem: d, edgeX:
|
|
5453
|
+
({ spreadPosition: u, horizontalOffset: l, isLastItem: d, edgeX: g, edgeY: p }) => {
|
|
5454
5454
|
const { blankPagePosition: h, minimumWidth: m } = this.computeLayoutInformation({ horizontalOffset: l, isLastItem: d });
|
|
5455
5455
|
this.hookManager.execute("item.onBeforeLayout", void 0, {
|
|
5456
5456
|
blankPagePosition: h,
|
|
@@ -5472,8 +5472,8 @@ class Ss extends G {
|
|
|
5472
5472
|
*/
|
|
5473
5473
|
this.updateContainerLayout({
|
|
5474
5474
|
minimumWidth: m,
|
|
5475
|
-
edgeX:
|
|
5476
|
-
edgeY:
|
|
5475
|
+
edgeX: g,
|
|
5476
|
+
edgeY: p
|
|
5477
5477
|
}),
|
|
5478
5478
|
S((f) => (this.hookManager.execute("item.onAfterLayout", void 0, {
|
|
5479
5479
|
blankPagePosition: h,
|
|
@@ -5552,11 +5552,11 @@ class Zt extends Q {
|
|
|
5552
5552
|
this.viewport
|
|
5553
5553
|
);
|
|
5554
5554
|
const l = this.renderer.state$.pipe(
|
|
5555
|
-
V(({ state: d, error:
|
|
5555
|
+
V(({ state: d, error: g }) => {
|
|
5556
5556
|
this.mergeCompare({
|
|
5557
5557
|
isLoaded: d === "loaded",
|
|
5558
5558
|
isError: d === "error",
|
|
5559
|
-
error: d === "error" ?
|
|
5559
|
+
error: d === "error" ? g : void 0
|
|
5560
5560
|
});
|
|
5561
5561
|
})
|
|
5562
5562
|
);
|
|
@@ -5644,7 +5644,7 @@ class bs extends G {
|
|
|
5644
5644
|
);
|
|
5645
5645
|
const r = this.forcedOpenSubject.pipe(
|
|
5646
5646
|
S((u) => Array.from(u.keys()).sort((l, d) => l - d)),
|
|
5647
|
-
|
|
5647
|
+
R(hn),
|
|
5648
5648
|
J({ bufferSize: 1, refCount: !0 })
|
|
5649
5649
|
);
|
|
5650
5650
|
P(
|
|
@@ -5660,11 +5660,11 @@ class bs extends G {
|
|
|
5660
5660
|
De(this.context.bridgeEvent.viewportFree$),
|
|
5661
5661
|
z(this.context.bridgeEvent.navigation$, r),
|
|
5662
5662
|
S(([, u, l]) => {
|
|
5663
|
-
const { numberOfAdjacentSpineItemToPreLoad: d } = o.values, { beginIndex:
|
|
5663
|
+
const { numberOfAdjacentSpineItemToPreLoad: d } = o.values, { beginIndex: g = 0, endIndex: p = 0 } = i.getVisibleSpineItemsFromPosition({
|
|
5664
5664
|
position: u.position,
|
|
5665
5665
|
threshold: { type: "percentage", value: 0 },
|
|
5666
5666
|
useAbsoluteViewport: !1
|
|
5667
|
-
}) || {}, h = d === 1 / 0 ? 0 :
|
|
5667
|
+
}) || {}, h = d === 1 / 0 ? 0 : g - d, m = d === 1 / 0 ? t.items.length - 1 : p + d, y = Array.from(
|
|
5668
5668
|
{ length: m - h + 1 },
|
|
5669
5669
|
(I, b) => h + b
|
|
5670
5670
|
), f = [...l, ...y];
|
|
@@ -5779,21 +5779,21 @@ const Ps = ({
|
|
|
5779
5779
|
viewportPosition: a,
|
|
5780
5780
|
restrictToScreen: c
|
|
5781
5781
|
}) => {
|
|
5782
|
-
const u = a.x, l = a.x + (a.width - 1), d = a.y,
|
|
5782
|
+
const u = a.x, l = a.x + (a.width - 1), d = a.y, g = Math.max(
|
|
5783
5783
|
a.y + (a.height - 1),
|
|
5784
5784
|
0
|
|
5785
|
-
),
|
|
5785
|
+
), p = Math.max(
|
|
5786
5786
|
0,
|
|
5787
5787
|
Math.min(t, l) - Math.max(e, u)
|
|
5788
5788
|
), h = Math.max(
|
|
5789
5789
|
0,
|
|
5790
|
-
Math.min(n,
|
|
5790
|
+
Math.min(n, g) - Math.max(i, d)
|
|
5791
5791
|
);
|
|
5792
|
-
if (
|
|
5792
|
+
if (p <= 0 || h <= 0) return { visible: !1 };
|
|
5793
5793
|
const y = $s({
|
|
5794
5794
|
threshold: r,
|
|
5795
5795
|
visibleHeightOfItem: h,
|
|
5796
|
-
visibleWidthOfItem:
|
|
5796
|
+
visibleWidthOfItem: p,
|
|
5797
5797
|
viewportPosition: a
|
|
5798
5798
|
});
|
|
5799
5799
|
return c ? { visible: y } : {
|
|
@@ -5802,7 +5802,7 @@ const Ps = ({
|
|
|
5802
5802
|
itemWidth: o,
|
|
5803
5803
|
threshold: r,
|
|
5804
5804
|
visibleHeightOfItem: h,
|
|
5805
|
-
visibleWidthOfItem:
|
|
5805
|
+
visibleWidthOfItem: p
|
|
5806
5806
|
}) || y
|
|
5807
5807
|
};
|
|
5808
5808
|
}, qe = ({
|
|
@@ -5835,7 +5835,7 @@ const Ps = ({
|
|
|
5835
5835
|
spineItemsManager: i,
|
|
5836
5836
|
spineLayout: o
|
|
5837
5837
|
}) || i.get(0), c = i.items.reduce(
|
|
5838
|
-
(
|
|
5838
|
+
(p, h) => {
|
|
5839
5839
|
const m = o.getSpineItemSpineLayoutInfo(h), y = s ? r.absoluteViewport : r.relativeViewport, f = Jt(
|
|
5840
5840
|
n,
|
|
5841
5841
|
r.absoluteViewport,
|
|
@@ -5849,15 +5849,15 @@ const Ps = ({
|
|
|
5849
5849
|
viewportPosition: I,
|
|
5850
5850
|
restrictToScreen: t
|
|
5851
5851
|
});
|
|
5852
|
-
return b ? [...
|
|
5852
|
+
return b ? [...p, h] : p;
|
|
5853
5853
|
},
|
|
5854
5854
|
[]
|
|
5855
5855
|
), u = c[0] ?? a, l = c[c.length - 1] ?? u;
|
|
5856
5856
|
if (!u || !l) return;
|
|
5857
|
-
const d = i.getSpineItemIndex(u),
|
|
5857
|
+
const d = i.getSpineItemIndex(u), g = i.getSpineItemIndex(l);
|
|
5858
5858
|
return {
|
|
5859
5859
|
beginIndex: d ?? 0,
|
|
5860
|
-
endIndex:
|
|
5860
|
+
endIndex: g ?? 0
|
|
5861
5861
|
};
|
|
5862
5862
|
}, Fs = ({
|
|
5863
5863
|
spineItemsManager: n,
|
|
@@ -6049,7 +6049,7 @@ class Cs extends Q {
|
|
|
6049
6049
|
z(r),
|
|
6050
6050
|
w(([, { pageSize: a }]) => {
|
|
6051
6051
|
const c = t.items.reduce(
|
|
6052
|
-
(l, d,
|
|
6052
|
+
(l, d, g) => {
|
|
6053
6053
|
const h = new Array(d.numberOfPages).fill(void 0).map((m, y) => {
|
|
6054
6054
|
const f = i.getSpineItemPositionFromPageIndex({
|
|
6055
6055
|
spineItem: d,
|
|
@@ -6073,7 +6073,7 @@ class Cs extends Q {
|
|
|
6073
6073
|
x: f.x,
|
|
6074
6074
|
y: f.y
|
|
6075
6075
|
}),
|
|
6076
|
-
itemIndex:
|
|
6076
|
+
itemIndex: g,
|
|
6077
6077
|
absolutePageIndex: l.length + y,
|
|
6078
6078
|
spineItem: d,
|
|
6079
6079
|
pageIndex: y
|
|
@@ -6085,11 +6085,11 @@ class Cs extends Q {
|
|
|
6085
6085
|
);
|
|
6086
6086
|
return j(
|
|
6087
6087
|
c.map((l) => {
|
|
6088
|
-
const { spineItem: d, ...
|
|
6088
|
+
const { spineItem: d, ...g } = l;
|
|
6089
6089
|
if (l.spineItem.value.isLoaded) {
|
|
6090
|
-
const
|
|
6091
|
-
if (
|
|
6092
|
-
const h =
|
|
6090
|
+
const p = l.spineItem.renderer?.getDocumentFrame();
|
|
6091
|
+
if (p && p?.contentWindow?.document && p.contentWindow.document.body !== null) {
|
|
6092
|
+
const h = p.contentWindow.document;
|
|
6093
6093
|
return et().pipe(
|
|
6094
6094
|
S(() => {
|
|
6095
6095
|
const m = Ln(
|
|
@@ -6097,14 +6097,14 @@ class Cs extends Q {
|
|
|
6097
6097
|
l.layout
|
|
6098
6098
|
);
|
|
6099
6099
|
return {
|
|
6100
|
-
...
|
|
6100
|
+
...g,
|
|
6101
6101
|
firstVisibleNode: m
|
|
6102
6102
|
};
|
|
6103
6103
|
})
|
|
6104
6104
|
);
|
|
6105
6105
|
}
|
|
6106
6106
|
}
|
|
6107
|
-
return v({ ...
|
|
6107
|
+
return v({ ...g, firstVisibleNode: void 0 });
|
|
6108
6108
|
})
|
|
6109
6109
|
);
|
|
6110
6110
|
}),
|
|
@@ -6120,7 +6120,7 @@ class Es extends G {
|
|
|
6120
6120
|
...t.map(
|
|
6121
6121
|
(i) => i.pipe(
|
|
6122
6122
|
S((o) => ({ item: i, ...o })),
|
|
6123
|
-
|
|
6123
|
+
R(O)
|
|
6124
6124
|
)
|
|
6125
6125
|
)
|
|
6126
6126
|
)),
|
|
@@ -6148,7 +6148,7 @@ class Es extends G {
|
|
|
6148
6148
|
}
|
|
6149
6149
|
class Ds extends G {
|
|
6150
6150
|
constructor(e, t, i, o, s) {
|
|
6151
|
-
super(), this.spineItemsManager = e, this.spineItemsObserver = t, this.context = i, this.settings = o, this.viewport = s, this.externalLayoutTrigger = new
|
|
6151
|
+
super(), this.spineItemsManager = e, this.spineItemsObserver = t, this.context = i, this.settings = o, this.viewport = s, this.externalLayoutTrigger = new N(), this.spineItemsRelativeLayouts = [];
|
|
6152
6152
|
const r = P(
|
|
6153
6153
|
t.itemLoad$,
|
|
6154
6154
|
t.itemUnload$
|
|
@@ -6157,7 +6157,7 @@ class Ds extends G {
|
|
|
6157
6157
|
r
|
|
6158
6158
|
);
|
|
6159
6159
|
this.layout$ = a.pipe(
|
|
6160
|
-
|
|
6160
|
+
x(() => {
|
|
6161
6161
|
this.spineItemsManager.items.forEach((c) => {
|
|
6162
6162
|
c.markDirty();
|
|
6163
6163
|
});
|
|
@@ -6166,15 +6166,15 @@ class Ds extends G {
|
|
|
6166
6166
|
w(
|
|
6167
6167
|
() => this.spineItemsManager.items.reduce(
|
|
6168
6168
|
(c, u, l) => c.pipe(
|
|
6169
|
-
ln(({ horizontalOffset: d, verticalOffset:
|
|
6170
|
-
const
|
|
6171
|
-
|
|
6169
|
+
ln(({ horizontalOffset: d, verticalOffset: g }) => {
|
|
6170
|
+
const p = d % s.absoluteViewport.width === 0, h = l === e.items.length - 1, m = o.values.computedPageTurnDirection === "vertical", y = i.isRTL(), f = this.getSpreadPosition(
|
|
6171
|
+
p,
|
|
6172
6172
|
y
|
|
6173
6173
|
), { edgeX: I, edgeY: b } = this.getStartEdges(
|
|
6174
6174
|
m,
|
|
6175
|
-
g,
|
|
6176
|
-
d,
|
|
6177
6175
|
p,
|
|
6176
|
+
d,
|
|
6177
|
+
g,
|
|
6178
6178
|
s.absoluteViewport.height
|
|
6179
6179
|
);
|
|
6180
6180
|
return u.layout({
|
|
@@ -6184,19 +6184,19 @@ class Ds extends G {
|
|
|
6184
6184
|
edgeX: I,
|
|
6185
6185
|
edgeY: b
|
|
6186
6186
|
}).pipe(
|
|
6187
|
-
S(({ width: F, height:
|
|
6187
|
+
S(({ width: F, height: $ }) => {
|
|
6188
6188
|
const L = this.createSpineItemLayout(
|
|
6189
6189
|
m,
|
|
6190
6190
|
y,
|
|
6191
6191
|
I,
|
|
6192
6192
|
b,
|
|
6193
6193
|
F,
|
|
6194
|
-
|
|
6194
|
+
$,
|
|
6195
6195
|
s.absoluteViewport.width
|
|
6196
6196
|
);
|
|
6197
6197
|
return this.spineItemsRelativeLayouts[l] = L, {
|
|
6198
6198
|
horizontalOffset: I + F,
|
|
6199
|
-
verticalOffset: m ? b +
|
|
6199
|
+
verticalOffset: m ? b + $ : 0
|
|
6200
6200
|
};
|
|
6201
6201
|
})
|
|
6202
6202
|
);
|
|
@@ -6211,7 +6211,7 @@ class Ds extends G {
|
|
|
6211
6211
|
}
|
|
6212
6212
|
watchForVerticalWritingUpdate() {
|
|
6213
6213
|
this.spineItemsObserver.itemLoad$.pipe(
|
|
6214
|
-
|
|
6214
|
+
x((e) => {
|
|
6215
6215
|
this.context.update({
|
|
6216
6216
|
hasVerticalWriting: e.isUsingVerticalWriting()
|
|
6217
6217
|
});
|
|
@@ -6312,7 +6312,7 @@ class As extends G {
|
|
|
6312
6312
|
this.viewport
|
|
6313
6313
|
);
|
|
6314
6314
|
const c = e.watch("rootElement").pipe(
|
|
6315
|
-
|
|
6315
|
+
pe(Z),
|
|
6316
6316
|
V((l) => {
|
|
6317
6317
|
const d = l.ownerDocument.createElement("div");
|
|
6318
6318
|
d.style.cssText = `
|
|
@@ -6327,9 +6327,9 @@ class As extends G {
|
|
|
6327
6327
|
V(([l, d]) => {
|
|
6328
6328
|
if (!d) return;
|
|
6329
6329
|
this.spineItemsManager.destroyItems();
|
|
6330
|
-
const
|
|
6331
|
-
(
|
|
6332
|
-
|
|
6330
|
+
const g = l.spineItems.map(
|
|
6331
|
+
(p, h) => new Zt(
|
|
6332
|
+
p,
|
|
6333
6333
|
d,
|
|
6334
6334
|
this.context,
|
|
6335
6335
|
this.settings,
|
|
@@ -6338,7 +6338,7 @@ class As extends G {
|
|
|
6338
6338
|
this.viewport
|
|
6339
6339
|
)
|
|
6340
6340
|
);
|
|
6341
|
-
this.spineItemsManager.addMany(
|
|
6341
|
+
this.spineItemsManager.addMany(g);
|
|
6342
6342
|
})
|
|
6343
6343
|
);
|
|
6344
6344
|
P(u, c).pipe(K(this.destroy$)).subscribe();
|
|
@@ -6359,7 +6359,7 @@ class As extends G {
|
|
|
6359
6359
|
super.destroy(), this.pages.destroy(), this.spineItemsLoader.destroy(), this.elementSubject.getValue()?.remove(), this.elementSubject.complete();
|
|
6360
6360
|
}
|
|
6361
6361
|
}
|
|
6362
|
-
class
|
|
6362
|
+
class Ns extends G {
|
|
6363
6363
|
constructor(e, t) {
|
|
6364
6364
|
super(), this.context = e, this.settings = t, this.orderedSpineItemsSubject = new q([]), this.items$ = this.orderedSpineItemsSubject.asObservable();
|
|
6365
6365
|
}
|
|
@@ -6402,7 +6402,7 @@ class Rs extends G {
|
|
|
6402
6402
|
});
|
|
6403
6403
|
}
|
|
6404
6404
|
}
|
|
6405
|
-
class
|
|
6405
|
+
class Rs extends Q {
|
|
6406
6406
|
constructor(e, t) {
|
|
6407
6407
|
const i = document.createElement("div");
|
|
6408
6408
|
i.setAttribute(`data-${oi}`, ""), super({
|
|
@@ -6415,13 +6415,13 @@ class Ns extends Q {
|
|
|
6415
6415
|
height: 1
|
|
6416
6416
|
}), this.context = e, this.settingsManager = t;
|
|
6417
6417
|
const o = this.settingsManager.watch(["computedSpreadMode"]).pipe(
|
|
6418
|
-
|
|
6418
|
+
x(() => {
|
|
6419
6419
|
this.mergeCompare({
|
|
6420
6420
|
pageSize: this.calculatePageSize(this.value)
|
|
6421
6421
|
});
|
|
6422
6422
|
})
|
|
6423
6423
|
), s = this.context.watch("rootElement").pipe(
|
|
6424
|
-
|
|
6424
|
+
x(() => {
|
|
6425
6425
|
this.layout();
|
|
6426
6426
|
})
|
|
6427
6427
|
);
|
|
@@ -6480,11 +6480,11 @@ class Ns extends Q {
|
|
|
6480
6480
|
}
|
|
6481
6481
|
}
|
|
6482
6482
|
const xt = `${Vt}-core`, Os = (n) => {
|
|
6483
|
-
const e = crypto.randomUUID(), t = new
|
|
6483
|
+
const e = crypto.randomUUID(), t = new N(), i = new N(), o = new Ao(), s = new Eo(), r = new fs(n, s), a = new Do(s, r), c = new Ns(s, r), u = new Rs(s, r), l = qt({
|
|
6484
6484
|
context: s,
|
|
6485
6485
|
settings: r,
|
|
6486
6486
|
viewport: u
|
|
6487
|
-
}), d = new ps(s, c),
|
|
6487
|
+
}), d = new ps(s, c), g = new As(
|
|
6488
6488
|
s,
|
|
6489
6489
|
d,
|
|
6490
6490
|
c,
|
|
@@ -6492,32 +6492,32 @@ const xt = `${Vt}-core`, Os = (n) => {
|
|
|
6492
6492
|
r,
|
|
6493
6493
|
o,
|
|
6494
6494
|
u
|
|
6495
|
-
),
|
|
6495
|
+
), p = ds({
|
|
6496
6496
|
context: s,
|
|
6497
6497
|
spineItemsManager: c,
|
|
6498
6498
|
hookManager: o,
|
|
6499
|
-
spine:
|
|
6499
|
+
spine: g,
|
|
6500
6500
|
settings: r,
|
|
6501
6501
|
viewport: u
|
|
6502
6502
|
}), h = new gs(
|
|
6503
6503
|
s,
|
|
6504
6504
|
d,
|
|
6505
6505
|
c,
|
|
6506
|
-
|
|
6506
|
+
g,
|
|
6507
6507
|
l
|
|
6508
6508
|
);
|
|
6509
|
-
|
|
6509
|
+
p.navigationState$.subscribe(s.bridgeEvent.viewportStateSubject), p.navigation$.subscribe(s.bridgeEvent.navigationSubject), p.locker.isLocked$.subscribe(
|
|
6510
6510
|
s.bridgeEvent.navigationIsLockedSubject
|
|
6511
6511
|
), d.subscribe(s.bridgeEvent.paginationSubject);
|
|
6512
6512
|
const m = () => {
|
|
6513
6513
|
t.next();
|
|
6514
|
-
}, y = (
|
|
6515
|
-
const { containerElement: L, manifest: H } =
|
|
6514
|
+
}, y = ($) => {
|
|
6515
|
+
const { containerElement: L, manifest: H } = $;
|
|
6516
6516
|
if (s.manifest) {
|
|
6517
6517
|
A.warn("loading a new book is not supported yet");
|
|
6518
6518
|
return;
|
|
6519
6519
|
}
|
|
6520
|
-
A.log("load", { options:
|
|
6520
|
+
A.log("load", { options: $ });
|
|
6521
6521
|
const B = Vs(L, e);
|
|
6522
6522
|
s.update({
|
|
6523
6523
|
manifest: H,
|
|
@@ -6525,31 +6525,28 @@ const xt = `${Vt}-core`, Os = (n) => {
|
|
|
6525
6525
|
}), m();
|
|
6526
6526
|
}, f = r.watch(["computedSpreadMode"]).pipe(Lt(1), V(m)), I = t.pipe(
|
|
6527
6527
|
V(() => {
|
|
6528
|
-
const
|
|
6529
|
-
|
|
6528
|
+
const $ = s.value.rootElement;
|
|
6529
|
+
$ && ($.style.setProperty("overflow", "hidden"), u.layout(), g.layout());
|
|
6530
6530
|
}),
|
|
6531
6531
|
K(i)
|
|
6532
6532
|
), b = P(I, f).subscribe();
|
|
6533
|
-
Ce(document, xt,
|
|
6533
|
+
Ce(document, xt, No);
|
|
6534
6534
|
const F = () => {
|
|
6535
|
-
Ee(document, xt), b.unsubscribe(), c.destroy(), h.destroy(), r.destroy(), d.destroy(), s.destroy(),
|
|
6535
|
+
Ee(document, xt), b.unsubscribe(), c.destroy(), h.destroy(), r.destroy(), d.destroy(), s.destroy(), p.destroy(), g.destroy(), a.destroy(), i.next(), i.complete(), u.destroy();
|
|
6536
6536
|
};
|
|
6537
6537
|
return {
|
|
6538
6538
|
id: e,
|
|
6539
6539
|
context: s,
|
|
6540
|
-
spine:
|
|
6540
|
+
spine: g,
|
|
6541
6541
|
hookManager: o,
|
|
6542
6542
|
cfi: {
|
|
6543
6543
|
generateCfiFromRange: io,
|
|
6544
6544
|
parseCfi: it,
|
|
6545
|
-
generateCfiForSpineItemPage:
|
|
6546
|
-
|
|
6547
|
-
spine: p
|
|
6548
|
-
}),
|
|
6549
|
-
resolveCfi: (x) => _t({ ...x, spineItemsManager: c })
|
|
6545
|
+
generateCfiForSpineItemPage: He,
|
|
6546
|
+
resolveCfi: ($) => _t({ ...$, spineItemsManager: c })
|
|
6550
6547
|
},
|
|
6551
|
-
navigation:
|
|
6552
|
-
spineItemsObserver:
|
|
6548
|
+
navigation: p,
|
|
6549
|
+
spineItemsObserver: g.spineItemsObserver,
|
|
6553
6550
|
spineItemsManager: c,
|
|
6554
6551
|
layout: m,
|
|
6555
6552
|
load: y,
|
|
@@ -6563,7 +6560,7 @@ const xt = `${Vt}-core`, Os = (n) => {
|
|
|
6563
6560
|
}
|
|
6564
6561
|
},
|
|
6565
6562
|
settings: r,
|
|
6566
|
-
renderHeadless: (
|
|
6563
|
+
renderHeadless: ($) => c.get($)?.renderer.renderHeadless() ?? v(void 0),
|
|
6567
6564
|
viewport: u,
|
|
6568
6565
|
viewportState$: s.bridgeEvent.viewportState$,
|
|
6569
6566
|
viewportFree$: s.bridgeEvent.viewportFree$,
|
|
@@ -6574,7 +6571,7 @@ const xt = `${Vt}-core`, Os = (n) => {
|
|
|
6574
6571
|
* It can typically be used to hide a loading indicator.
|
|
6575
6572
|
*/
|
|
6576
6573
|
state$: s.manifest$.pipe(
|
|
6577
|
-
ie((
|
|
6574
|
+
ie(($) => $ ? "ready" : "idle")
|
|
6578
6575
|
),
|
|
6579
6576
|
features: a,
|
|
6580
6577
|
$: {
|
|
@@ -6597,7 +6594,7 @@ const xt = `${Vt}-core`, Os = (n) => {
|
|
|
6597
6594
|
Mo(
|
|
6598
6595
|
Xi(
|
|
6599
6596
|
yi(
|
|
6600
|
-
|
|
6597
|
+
Ni(
|
|
6601
6598
|
zn(
|
|
6602
6599
|
Bn(
|
|
6603
6600
|
co(
|
|
@@ -6656,21 +6653,21 @@ export {
|
|
|
6656
6653
|
Ii as SpineItemPageSpineLayout,
|
|
6657
6654
|
E as SpineItemPosition,
|
|
6658
6655
|
Oe as SpineItemSpineLayout,
|
|
6659
|
-
|
|
6656
|
+
Ns as SpineItemsManager,
|
|
6660
6657
|
Es as SpineItemsObserver,
|
|
6661
6658
|
M as SpinePosition,
|
|
6662
6659
|
xo as UnboundScrollPosition,
|
|
6663
|
-
|
|
6660
|
+
Re as UnboundSpineItemPagePosition,
|
|
6664
6661
|
ae as UnboundSpinePosition,
|
|
6665
6662
|
Ys as VIEWPORT_ADJUSTMENT_THROTTLE,
|
|
6666
|
-
|
|
6663
|
+
Rs as Viewport,
|
|
6667
6664
|
ro as consolidate,
|
|
6668
6665
|
Js as createReader,
|
|
6669
6666
|
at as deferIdle,
|
|
6670
6667
|
Xn as deferNextResult,
|
|
6671
6668
|
He as generateCfiForSpineItemPage,
|
|
6672
6669
|
io as generateCfiFromRange,
|
|
6673
|
-
|
|
6670
|
+
de as generateRootCfi,
|
|
6674
6671
|
rt as getAttributeValueFromString,
|
|
6675
6672
|
Hs as getBase64FromBlob,
|
|
6676
6673
|
Je as getFrameViewportInfo,
|
|
@@ -6680,11 +6677,11 @@ export {
|
|
|
6680
6677
|
Vn as injectCSSToFrame,
|
|
6681
6678
|
Z as isDefined,
|
|
6682
6679
|
At as isHtmlElement,
|
|
6683
|
-
|
|
6680
|
+
Rn as isHtmlTagElement,
|
|
6684
6681
|
Be as isRootCfi,
|
|
6685
6682
|
tr as isShallowEqual,
|
|
6686
6683
|
Di as layoutEnhancer,
|
|
6687
|
-
|
|
6684
|
+
Nt as mapKeysTo,
|
|
6688
6685
|
_s as observeIntersection,
|
|
6689
6686
|
ct as observeMutation,
|
|
6690
6687
|
Qe as observeResize,
|