@prose-reader/core 1.261.0 → 1.264.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/createReaderWithEnhancer.d.ts +2 -1
- package/dist/enhancers/navigation/navigators/panNavigator.d.ts +16 -8
- package/dist/enhancers/navigation/types.d.ts +1 -1
- package/dist/enhancers/utils.d.ts +1 -0
- package/dist/enhancers/zoom/ZoomController.d.ts +9 -8
- package/dist/enhancers/zoom/constraints.d.ts +6 -0
- package/dist/enhancers/zoom/scrollable.d.ts +1 -2
- package/dist/enhancers/zoom/types.d.ts +9 -4
- package/dist/index.js +877 -825
- package/dist/index.js.map +1 -1
- package/dist/index.umd.cjs +24 -24
- package/dist/index.umd.cjs.map +1 -1
- package/dist/navigation/InternalNavigator.d.ts +2 -2
- package/dist/navigation/Navigator.d.ts +1 -1
- package/dist/reader.d.ts +1 -1
- package/dist/utils/dom.d.ts +1 -1
- package/dist/utils/frames.d.ts +1 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { switchMap as w, of as v, fromEvent as q, take as
|
|
2
|
-
import { Report as
|
|
3
|
-
import { isShallowEqual as
|
|
4
|
-
import { map as Q, distinctUntilChanged as pe, switchMap as _, first as
|
|
5
|
-
import { generate as
|
|
6
|
-
const
|
|
1
|
+
import { switchMap as w, of as v, fromEvent as q, take as Tt, map as S, from as N, takeUntil as T, Observable as oe, defer as ze, Subject as R, combineLatest as k, merge as x, EMPTY as Z, NEVER as ge, tap as P, share as E, BehaviorSubject as H, withLatestFrom as O, filter as L, first as U, mergeMap as $e, endWith as me, finalize as de, catchError as Ft, lastValueFrom as an, scheduled as cn, animationFrameScheduler as ce, distinctUntilChanged as z, exhaustMap as We, debounceTime as Se, throttleTime as un, startWith as ne, shareReplay as K, switchScan as ln, defaultIfEmpty as dn, forkJoin as pn, delay as we, timer as Te, skip as Lt, ReplaySubject as ot, identity as xe, reduce as gn, concatMap as st } from "rxjs";
|
|
2
|
+
import { Report as hn, isShallowEqual as V, shallowMergeIfDefined as Pe, getParentPath as mn, parseContentType as fn, detectMimeTypeFromName as Me, arrayEqual as yn } from "@prose-reader/shared";
|
|
3
|
+
import { isShallowEqual as sr } from "@prose-reader/shared";
|
|
4
|
+
import { map as Q, distinctUntilChanged as pe, switchMap as _, first as Mt, startWith as Sn, shareReplay as Ce, tap as j, pairwise as bn, take as In, takeUntil as G, filter as ae, debounceTime as vn, skip as Ct, mergeMap as wn, catchError as rt } from "rxjs/operators";
|
|
5
|
+
import { generate as _e, parse as Et, isIndirectionOnly as xn, isParsedCfiRange as Pn, resolve as $n } from "@prose-reader/cfi";
|
|
6
|
+
const Tn = "@prose-reader/core", D = hn.namespace(Tn, void 0, {
|
|
7
7
|
color: "#98cde7"
|
|
8
|
-
}),
|
|
8
|
+
}), Fn = [
|
|
9
9
|
"pointercancel",
|
|
10
10
|
"pointerdown",
|
|
11
11
|
"pointerenter",
|
|
@@ -17,24 +17,24 @@ const $n = "@prose-reader/core", D = gn.namespace($n, void 0, {
|
|
|
17
17
|
// `touchstart` as const,
|
|
18
18
|
// `touchend` as const,
|
|
19
19
|
];
|
|
20
|
-
function
|
|
20
|
+
function Ln(n, e, t) {
|
|
21
21
|
if ("caretPositionFromPoint" in n)
|
|
22
22
|
return n.caretPositionFromPoint(e, t);
|
|
23
23
|
if ("caretRangeFromPoint" in n && // @ts-expect-error limited availability
|
|
24
24
|
typeof n.caretRangeFromPoint < "u")
|
|
25
25
|
return n.caretRangeFromPoint(e, t);
|
|
26
26
|
}
|
|
27
|
-
const
|
|
28
|
-
const t = "body" in n ?
|
|
27
|
+
const Mn = (n, e) => {
|
|
28
|
+
const t = "body" in n ? He(n.body, e) : He(n, e), i = "createRange" in n ? n : n.ownerDocument;
|
|
29
29
|
if (t) {
|
|
30
30
|
let o, s = 0;
|
|
31
31
|
const r = i.createRange();
|
|
32
32
|
return Array.from(t.childNodes).some((a) => {
|
|
33
33
|
r.selectNodeContents(a);
|
|
34
|
-
const c = r.getClientRects(), u =
|
|
34
|
+
const c = r.getClientRects(), u = Cn(c, e);
|
|
35
35
|
if (u) {
|
|
36
36
|
o = r.cloneRange();
|
|
37
|
-
const l =
|
|
37
|
+
const l = Ln(
|
|
38
38
|
i,
|
|
39
39
|
Math.ceil(u.left),
|
|
40
40
|
Math.ceil(u.top)
|
|
@@ -47,30 +47,30 @@ const Ln = (n, e) => {
|
|
|
47
47
|
offset: s
|
|
48
48
|
} : { node: t, offset: 0 };
|
|
49
49
|
}
|
|
50
|
-
},
|
|
51
|
-
const t = n.getBoundingClientRect(), i =
|
|
50
|
+
}, He = (n, e) => {
|
|
51
|
+
const t = n.getBoundingClientRect(), i = Dt(
|
|
52
52
|
t,
|
|
53
53
|
e
|
|
54
54
|
);
|
|
55
55
|
let o;
|
|
56
56
|
i !== "before" && i !== "after" && (o = n);
|
|
57
57
|
for (const s of n.children) {
|
|
58
|
-
const r =
|
|
58
|
+
const r = He(s, e);
|
|
59
59
|
if (r)
|
|
60
60
|
return r;
|
|
61
61
|
}
|
|
62
62
|
return o;
|
|
63
63
|
};
|
|
64
|
-
function
|
|
64
|
+
function Dt(n, { left: e, right: t }) {
|
|
65
65
|
return n.left <= e && n.right <= e ? "before" : n.left <= e && n.right > e && n.right <= t ? "partially-before" : n.left <= t && n.right > t ? "partially-after" : n.left > t ? "after" : "within";
|
|
66
66
|
}
|
|
67
|
-
function
|
|
67
|
+
function Cn(n, e) {
|
|
68
68
|
return Array.from(n).find((t) => {
|
|
69
|
-
const i =
|
|
69
|
+
const i = Dt(t, e);
|
|
70
70
|
return i !== "before" && i !== "after";
|
|
71
71
|
});
|
|
72
72
|
}
|
|
73
|
-
const
|
|
73
|
+
const En = (n, e) => {
|
|
74
74
|
if (n.nodeType !== Node.CDATA_SECTION_NODE && n.nodeType !== Node.DOCUMENT_TYPE_NODE) {
|
|
75
75
|
const t = n.ownerDocument?.createRange();
|
|
76
76
|
t?.selectNodeContents(n);
|
|
@@ -81,7 +81,7 @@ const Cn = (n, e) => {
|
|
|
81
81
|
}
|
|
82
82
|
return t;
|
|
83
83
|
}
|
|
84
|
-
},
|
|
84
|
+
}, Je = (n) => {
|
|
85
85
|
if (n?.target && n?.target?.ownerDocument?.defaultView) {
|
|
86
86
|
const e = n?.target?.ownerDocument?.defaultView;
|
|
87
87
|
if (e.PointerEvent && n instanceof e.PointerEvent)
|
|
@@ -92,9 +92,9 @@ const Cn = (n, e) => {
|
|
|
92
92
|
if (e.PointerEvent && n instanceof e.PointerEvent)
|
|
93
93
|
return !0;
|
|
94
94
|
}
|
|
95
|
-
return !!
|
|
96
|
-
},
|
|
97
|
-
if (
|
|
95
|
+
return !!Fn.includes(n.type);
|
|
96
|
+
}, Dn = (n) => {
|
|
97
|
+
if (Je(n)) return !1;
|
|
98
98
|
if (n?.target && n?.target?.ownerDocument?.defaultView) {
|
|
99
99
|
const e = n?.target?.ownerDocument?.defaultView;
|
|
100
100
|
if (e.MouseEvent)
|
|
@@ -106,7 +106,7 @@ const Cn = (n, e) => {
|
|
|
106
106
|
return n instanceof e.MouseEvent;
|
|
107
107
|
}
|
|
108
108
|
return !1;
|
|
109
|
-
},
|
|
109
|
+
}, Rn = (n) => {
|
|
110
110
|
if (n?.target && n?.target?.ownerDocument?.defaultView) {
|
|
111
111
|
const e = n?.target?.ownerDocument?.defaultView;
|
|
112
112
|
if (e.TouchEvent)
|
|
@@ -118,7 +118,7 @@ const Cn = (n, e) => {
|
|
|
118
118
|
return n instanceof e.TouchEvent;
|
|
119
119
|
}
|
|
120
120
|
return !1;
|
|
121
|
-
},
|
|
121
|
+
}, An = () => document.createElement("div"), Rt = (n) => {
|
|
122
122
|
const e = [
|
|
123
123
|
"img",
|
|
124
124
|
// Images
|
|
@@ -134,8 +134,8 @@ const Cn = (n, e) => {
|
|
|
134
134
|
// JavaScript files
|
|
135
135
|
].join(",");
|
|
136
136
|
return Array.from(n?.querySelectorAll(e) || []);
|
|
137
|
-
},
|
|
138
|
-
if (
|
|
137
|
+
}, On = (n) => {
|
|
138
|
+
if (Rt(n).forEach((t) => {
|
|
139
139
|
const i = t.getAttribute("src") || t.getAttribute("href");
|
|
140
140
|
i?.startsWith("blob:") && n?.defaultView?.URL.revokeObjectURL(i);
|
|
141
141
|
}), n) {
|
|
@@ -152,7 +152,7 @@ const Cn = (n, e) => {
|
|
|
152
152
|
}
|
|
153
153
|
}
|
|
154
154
|
};
|
|
155
|
-
function
|
|
155
|
+
function At(n, e, t = []) {
|
|
156
156
|
if (typeof n != "object" || n === null) return !1;
|
|
157
157
|
for (const i of e)
|
|
158
158
|
if (!(i in n)) return !1;
|
|
@@ -161,19 +161,19 @@ function Rt(n, e, t = []) {
|
|
|
161
161
|
return !1;
|
|
162
162
|
return !0;
|
|
163
163
|
}
|
|
164
|
-
function
|
|
165
|
-
return
|
|
164
|
+
function Ot(n) {
|
|
165
|
+
return At(
|
|
166
166
|
n,
|
|
167
167
|
["nodeType"],
|
|
168
168
|
[]
|
|
169
169
|
// biome-ignore lint/suspicious/noExplicitAny: TODO
|
|
170
170
|
) && n.nodeType === Node.ELEMENT_NODE;
|
|
171
171
|
}
|
|
172
|
-
function
|
|
173
|
-
return
|
|
172
|
+
function Nn(n, e) {
|
|
173
|
+
return Ot(n) && n.tagName.toLowerCase() === e.toLowerCase();
|
|
174
174
|
}
|
|
175
|
-
function
|
|
176
|
-
return
|
|
175
|
+
function Vn(n) {
|
|
176
|
+
return At(
|
|
177
177
|
n,
|
|
178
178
|
[
|
|
179
179
|
"startContainer",
|
|
@@ -186,10 +186,12 @@ function Nn(n) {
|
|
|
186
186
|
["setStart", "setEnd", "selectNodeContents"]
|
|
187
187
|
);
|
|
188
188
|
}
|
|
189
|
-
const
|
|
189
|
+
const Ee = (n, e, t, i) => {
|
|
190
190
|
const o = n.createElement("style");
|
|
191
|
-
o.id = e, o.innerHTML = t, i ? n.head.prepend(o) : n.head.appendChild(o)
|
|
192
|
-
|
|
191
|
+
return o.id = e, o.innerHTML = t, i ? n.head.prepend(o) : n.head.appendChild(o), () => {
|
|
192
|
+
De(n, e);
|
|
193
|
+
};
|
|
194
|
+
}, De = (n, e) => {
|
|
193
195
|
if (n?.head) {
|
|
194
196
|
const t = n.getElementById(e);
|
|
195
197
|
t && t.remove();
|
|
@@ -197,11 +199,11 @@ const Ze = (n, e, t, i) => {
|
|
|
197
199
|
}, at = (n, e) => {
|
|
198
200
|
const t = new RegExp(`${e}\\s*=\\s*([0-9.]+)`, "i"), i = n.match(t) || [], o = i[1] || "0";
|
|
199
201
|
return i && Number.parseFloat(o) || 0;
|
|
200
|
-
},
|
|
201
|
-
n?.contentDocument?.head &&
|
|
202
|
-
},
|
|
203
|
-
n?.contentDocument &&
|
|
204
|
-
},
|
|
202
|
+
}, jn = (n, e, t, i) => {
|
|
203
|
+
n?.contentDocument?.head && Ee(n.contentDocument, e, t, i);
|
|
204
|
+
}, Xs = (n, e) => {
|
|
205
|
+
n?.contentDocument && De(n.contentDocument, e);
|
|
206
|
+
}, ie = (n, e, t, i) => {
|
|
205
207
|
if (!n) return;
|
|
206
208
|
const o = n?.contentDocument?.getElementById(
|
|
207
209
|
e
|
|
@@ -210,7 +212,7 @@ const Ze = (n, e, t, i) => {
|
|
|
210
212
|
o.innerHTML = t;
|
|
211
213
|
return;
|
|
212
214
|
}
|
|
213
|
-
|
|
215
|
+
jn(n, e, t, i);
|
|
214
216
|
}, Ke = (n) => {
|
|
215
217
|
if (n?.contentDocument) {
|
|
216
218
|
const t = n.contentDocument.querySelector("meta[name='viewport']");
|
|
@@ -227,17 +229,17 @@ const Ze = (n, e, t, i) => {
|
|
|
227
229
|
}
|
|
228
230
|
}
|
|
229
231
|
return { hasViewport: !1 };
|
|
230
|
-
},
|
|
232
|
+
}, kn = (n) => n.pipe(
|
|
231
233
|
w((e) => e.src === "about:blank" && e.contentDocument?.readyState === "complete" && e.contentDocument.body ? v(e) : q(e, "load").pipe(
|
|
232
|
-
|
|
234
|
+
Tt(1),
|
|
233
235
|
S(() => e)
|
|
234
236
|
))
|
|
235
|
-
),
|
|
237
|
+
), Un = (n) => n.pipe(
|
|
236
238
|
w((e) => {
|
|
237
239
|
const t = e?.contentDocument?.fonts.ready;
|
|
238
240
|
return t ? N(t).pipe(S(() => e)) : v(void 0);
|
|
239
241
|
})
|
|
240
|
-
),
|
|
242
|
+
), zn = (n) => (e) => {
|
|
241
243
|
const t = n(e), i = new IntersectionObserver((o) => {
|
|
242
244
|
o.forEach((s) => {
|
|
243
245
|
s.isIntersecting ? s.target.removeAttribute("tab-index") : s.target.setAttribute("tab-index", "-1");
|
|
@@ -250,7 +252,7 @@ const Ze = (n, e, t, i) => {
|
|
|
250
252
|
if (!r) return;
|
|
251
253
|
const a = r.renderer.getDocumentFrame();
|
|
252
254
|
if (!a) return;
|
|
253
|
-
|
|
255
|
+
ie(
|
|
254
256
|
a,
|
|
255
257
|
"prose-reader-accessibility",
|
|
256
258
|
`
|
|
@@ -272,7 +274,7 @@ const Ze = (n, e, t, i) => {
|
|
|
272
274
|
), {
|
|
273
275
|
...t
|
|
274
276
|
};
|
|
275
|
-
},
|
|
277
|
+
}, Wn = (n) => (e) => {
|
|
276
278
|
const t = n(e);
|
|
277
279
|
return t.context.watch("rootElement").pipe(T(t.context.destroy$)).subscribe((i) => {
|
|
278
280
|
if (!i) return;
|
|
@@ -284,7 +286,7 @@ const Ze = (n, e, t, i) => {
|
|
|
284
286
|
const s = t.spineItemsManager.get(i)?.renderer.getDocumentFrame();
|
|
285
287
|
s && s.contentDocument?.body.setAttribute("tabindex", "-1");
|
|
286
288
|
}), t;
|
|
287
|
-
},
|
|
289
|
+
}, Oe = ({
|
|
288
290
|
position: n,
|
|
289
291
|
frameElement: e
|
|
290
292
|
}) => {
|
|
@@ -293,13 +295,13 @@ const Ze = (n, e, t, i) => {
|
|
|
293
295
|
clientX: a,
|
|
294
296
|
clientY: c
|
|
295
297
|
};
|
|
296
|
-
},
|
|
298
|
+
}, _n = (n, e, t, i) => {
|
|
297
299
|
const o = e?.view?.frameElement;
|
|
298
300
|
if (!e || !o) return n;
|
|
299
301
|
const s = t.getSpineItemFromIframe(o), r = o, { height: a, width: c } = i.pageSize;
|
|
300
302
|
if (!s || !(r instanceof HTMLIFrameElement)) return n;
|
|
301
|
-
if (
|
|
302
|
-
const { clientX: u, clientY: l } =
|
|
303
|
+
if (Je(n)) {
|
|
304
|
+
const { clientX: u, clientY: l } = Oe({
|
|
303
305
|
position: n,
|
|
304
306
|
frameElement: r
|
|
305
307
|
}), d = new PointerEvent(n.type, {
|
|
@@ -313,8 +315,8 @@ const Ze = (n, e, t, i) => {
|
|
|
313
315
|
enumerable: !0
|
|
314
316
|
}), d;
|
|
315
317
|
}
|
|
316
|
-
if (
|
|
317
|
-
const { clientX: u, clientY: l } =
|
|
318
|
+
if (Dn(n)) {
|
|
319
|
+
const { clientX: u, clientY: l } = Oe({
|
|
318
320
|
position: n,
|
|
319
321
|
frameElement: r
|
|
320
322
|
}), d = new MouseEvent(n.type, {
|
|
@@ -327,9 +329,9 @@ const Ze = (n, e, t, i) => {
|
|
|
327
329
|
enumerable: !0
|
|
328
330
|
}), d;
|
|
329
331
|
}
|
|
330
|
-
if (
|
|
332
|
+
if (Rn(n)) {
|
|
331
333
|
const u = Array.from(n.touches).map((d) => {
|
|
332
|
-
const { clientX: g, clientY: h } =
|
|
334
|
+
const { clientX: g, clientY: h } = Oe({
|
|
333
335
|
position: d,
|
|
334
336
|
frameElement: r
|
|
335
337
|
});
|
|
@@ -350,7 +352,7 @@ const Ze = (n, e, t, i) => {
|
|
|
350
352
|
}), l;
|
|
351
353
|
}
|
|
352
354
|
return n;
|
|
353
|
-
},
|
|
355
|
+
}, Hn = [
|
|
354
356
|
"pointercancel",
|
|
355
357
|
"pointerdown",
|
|
356
358
|
"pointerenter",
|
|
@@ -359,21 +361,21 @@ const Ze = (n, e, t, i) => {
|
|
|
359
361
|
"pointerout",
|
|
360
362
|
"pointerover",
|
|
361
363
|
"pointerup"
|
|
362
|
-
],
|
|
363
|
-
...
|
|
364
|
+
], Bn = [
|
|
365
|
+
...Hn
|
|
364
366
|
/*, ...mouseEvents*/
|
|
365
|
-
],
|
|
367
|
+
], Xn = (n) => (e) => {
|
|
366
368
|
const t = n(e);
|
|
367
369
|
return t.hookManager.register(
|
|
368
370
|
"item.onDocumentLoad",
|
|
369
371
|
({ destroy: i, itemId: o }) => {
|
|
370
372
|
const s = t.spineItemsManager.get(o), r = s?.renderer.getDocumentFrame();
|
|
371
373
|
if (!r || !s) return;
|
|
372
|
-
const a =
|
|
374
|
+
const a = Bn.map((c) => {
|
|
373
375
|
const u = (l) => {
|
|
374
376
|
let d = l;
|
|
375
|
-
if (
|
|
376
|
-
const g =
|
|
377
|
+
if (Je(l) && (d = new PointerEvent(l.type, l)), d !== l) {
|
|
378
|
+
const g = _n(
|
|
377
379
|
d,
|
|
378
380
|
l,
|
|
379
381
|
t.spine.locator,
|
|
@@ -393,15 +395,15 @@ const Ze = (n, e, t, i) => {
|
|
|
393
395
|
});
|
|
394
396
|
}
|
|
395
397
|
), t;
|
|
396
|
-
},
|
|
398
|
+
}, Nt = (n) => Q((e) => Object.entries(e).reduce(
|
|
397
399
|
(t, [i, o]) => n.includes(i) ? {
|
|
398
400
|
...t,
|
|
399
401
|
[i]: o
|
|
400
402
|
} : t,
|
|
401
403
|
{}
|
|
402
|
-
)), Qe = (n) => (e) => e.pipe(
|
|
404
|
+
)), Qe = (n) => (e) => e.pipe(Nt(n), pe(V));
|
|
403
405
|
function et(n) {
|
|
404
|
-
return new
|
|
406
|
+
return new oe((e) => {
|
|
405
407
|
const t = new ResizeObserver((i) => {
|
|
406
408
|
e.next(i);
|
|
407
409
|
});
|
|
@@ -410,22 +412,22 @@ function et(n) {
|
|
|
410
412
|
};
|
|
411
413
|
});
|
|
412
414
|
}
|
|
413
|
-
const
|
|
415
|
+
const Re = (n) => (e) => e.pipe(
|
|
414
416
|
_(
|
|
415
417
|
(t) => n.pipe(
|
|
416
|
-
|
|
418
|
+
Mt(),
|
|
417
419
|
Q(() => t)
|
|
418
420
|
)
|
|
419
421
|
)
|
|
420
|
-
),
|
|
422
|
+
), Yn = (n) => {
|
|
421
423
|
let e;
|
|
422
424
|
const t = n.subscribe((i) => {
|
|
423
425
|
e = { result: i };
|
|
424
426
|
});
|
|
425
427
|
return () => (t.unsubscribe(), e ? v(e.result) : n);
|
|
426
428
|
};
|
|
427
|
-
function
|
|
428
|
-
return new
|
|
429
|
+
function Vt() {
|
|
430
|
+
return new oe((n) => {
|
|
429
431
|
if (window.requestIdleCallback) {
|
|
430
432
|
const t = window.requestIdleCallback(() => {
|
|
431
433
|
n.next(), n.complete();
|
|
@@ -439,16 +441,16 @@ function Nt() {
|
|
|
439
441
|
});
|
|
440
442
|
}
|
|
441
443
|
function ct(n) {
|
|
442
|
-
return
|
|
444
|
+
return ze(() => Vt().pipe(_(n)));
|
|
443
445
|
}
|
|
444
|
-
const ut = (n, e) => new
|
|
446
|
+
const ut = (n, e) => new oe((t) => {
|
|
445
447
|
const i = new MutationObserver((o) => {
|
|
446
448
|
t.next(o);
|
|
447
449
|
});
|
|
448
450
|
return i.observe(n, e), () => i.disconnect();
|
|
449
451
|
});
|
|
450
|
-
function
|
|
451
|
-
return new
|
|
452
|
+
function Ys(n, e) {
|
|
453
|
+
return new oe((t) => {
|
|
452
454
|
const i = new IntersectionObserver((o) => {
|
|
453
455
|
t.next(o);
|
|
454
456
|
}, e);
|
|
@@ -457,26 +459,26 @@ function Xs(n, e) {
|
|
|
457
459
|
};
|
|
458
460
|
});
|
|
459
461
|
}
|
|
460
|
-
class
|
|
462
|
+
class jt {
|
|
461
463
|
constructor(e, t) {
|
|
462
464
|
this.settingsManager = t;
|
|
463
|
-
const i =
|
|
465
|
+
const i = Pe(
|
|
464
466
|
this.getDefaultSettings(),
|
|
465
467
|
e
|
|
466
468
|
);
|
|
467
|
-
this.outputSettings = this.computeOutputSettings(i), this.inputSettings =
|
|
469
|
+
this.outputSettings = this.computeOutputSettings(i), this.inputSettings = Pe(
|
|
468
470
|
this.getDefaultSettings(),
|
|
469
471
|
e
|
|
470
472
|
), this.outputSettingsUpdateSubject = new R(), this.values$ = k([
|
|
471
473
|
this.settingsManager.values$,
|
|
472
|
-
this.outputSettingsUpdateSubject.pipe(
|
|
474
|
+
this.outputSettingsUpdateSubject.pipe(Sn(this.outputSettings))
|
|
473
475
|
]).pipe(
|
|
474
476
|
Q(([o, s]) => ({ ...o, ...s })),
|
|
475
477
|
Ce(1)
|
|
476
478
|
), this.values$.subscribe();
|
|
477
479
|
}
|
|
478
480
|
_prepareUpdate(e) {
|
|
479
|
-
const t = this.getCleanedParentInputSettings(e), i = this.settingsManager._prepareUpdate(t), o =
|
|
481
|
+
const t = this.getCleanedParentInputSettings(e), i = this.settingsManager._prepareUpdate(t), o = Pe(this.inputSettings, e), s = this.computeOutputSettings(o), r = this.hasSettingsChanged(s);
|
|
480
482
|
return {
|
|
481
483
|
hasChanged: r || i.hasChanged,
|
|
482
484
|
commit: () => (this.inputSettings = o, this.outputSettings = s, !i.hasChanged && r && this.outputSettingsUpdateSubject.next(s), {
|
|
@@ -505,7 +507,7 @@ class Vt {
|
|
|
505
507
|
this.outputSettingsUpdateSubject.complete();
|
|
506
508
|
}
|
|
507
509
|
}
|
|
508
|
-
const
|
|
510
|
+
const qs = (n) => {
|
|
509
511
|
const e = new FileReader();
|
|
510
512
|
return new Promise((t) => {
|
|
511
513
|
e.addEventListener(
|
|
@@ -517,7 +519,7 @@ const Ys = (n) => {
|
|
|
517
519
|
), e.readAsDataURL(n);
|
|
518
520
|
});
|
|
519
521
|
};
|
|
520
|
-
let
|
|
522
|
+
let qn = class extends jt {
|
|
521
523
|
computeOutputSettings(e) {
|
|
522
524
|
return e;
|
|
523
525
|
}
|
|
@@ -543,8 +545,8 @@ let Yn = class extends Vt {
|
|
|
543
545
|
};
|
|
544
546
|
}
|
|
545
547
|
};
|
|
546
|
-
const
|
|
547
|
-
const { fontScale: t, lineHeight: i, fontWeight: o, fontJustification: s } = e, r = new R(), a = n(e), c = new
|
|
548
|
+
const Gn = (n) => (e) => {
|
|
549
|
+
const { fontScale: t, lineHeight: i, fontWeight: o, fontJustification: s } = e, r = new R(), a = n(e), c = new qn(
|
|
548
550
|
{
|
|
549
551
|
fontScale: t,
|
|
550
552
|
lineHeight: i,
|
|
@@ -564,7 +566,7 @@ const qn = (n) => (e) => {
|
|
|
564
566
|
a.spineItemsManager.items.forEach((h) => {
|
|
565
567
|
if (h.renditionLayout !== "pre-paginated") {
|
|
566
568
|
const p = h.renderer.getDocumentFrame();
|
|
567
|
-
p &&
|
|
569
|
+
p && ie(p, "prose-reader-fonts", u());
|
|
568
570
|
}
|
|
569
571
|
}), g && a.layout();
|
|
570
572
|
};
|
|
@@ -572,11 +574,11 @@ const qn = (n) => (e) => {
|
|
|
572
574
|
const h = a.spineItemsManager.get(g);
|
|
573
575
|
if (h?.renditionLayout !== "pre-paginated") {
|
|
574
576
|
const p = h?.renderer.getDocumentFrame();
|
|
575
|
-
p &&
|
|
577
|
+
p && ie(p, "prose-reader-fonts", u());
|
|
576
578
|
}
|
|
577
579
|
});
|
|
578
580
|
const d = (g) => g.pipe(
|
|
579
|
-
|
|
581
|
+
bn(),
|
|
580
582
|
S(([h, p]) => p.fontScale !== h.fontScale || p.lineHeight !== h.lineHeight)
|
|
581
583
|
);
|
|
582
584
|
return c.values$.pipe(
|
|
@@ -590,7 +592,7 @@ const qn = (n) => (e) => {
|
|
|
590
592
|
},
|
|
591
593
|
settings: c
|
|
592
594
|
};
|
|
593
|
-
},
|
|
595
|
+
}, Zn = (n) => (e) => {
|
|
594
596
|
const t = n(e), i = (o) => q(o, "keyup").pipe(
|
|
595
597
|
S((s) => {
|
|
596
598
|
const { pageTurnDirection: r, computedPageTurnMode: a } = t.settings.values;
|
|
@@ -613,7 +615,7 @@ const qn = (n) => (e) => {
|
|
|
613
615
|
);
|
|
614
616
|
return i(document).pipe(T(t.$.destroy$)).subscribe(), t.spineItemsManager.items$.pipe(
|
|
615
617
|
w(
|
|
616
|
-
(o) =>
|
|
618
|
+
(o) => x(
|
|
617
619
|
...o.map(
|
|
618
620
|
(s) => s.watch("isLoaded").pipe(
|
|
619
621
|
w(() => {
|
|
@@ -626,9 +628,9 @@ const qn = (n) => (e) => {
|
|
|
626
628
|
),
|
|
627
629
|
T(t.$.destroy$)
|
|
628
630
|
).subscribe(), t;
|
|
629
|
-
},
|
|
631
|
+
}, Jn = (n) => n.spine.spineItemsManager.items$.pipe(
|
|
630
632
|
w(
|
|
631
|
-
(e) =>
|
|
633
|
+
(e) => x(
|
|
632
634
|
...e.map((t) => t.watch("isLoaded").pipe(
|
|
633
635
|
w(() => {
|
|
634
636
|
const i = t.renderer.getDocumentFrame();
|
|
@@ -638,12 +640,12 @@ const qn = (n) => (e) => {
|
|
|
638
640
|
).map(
|
|
639
641
|
(r) => q(r, "click")
|
|
640
642
|
);
|
|
641
|
-
return
|
|
643
|
+
return x(...s);
|
|
642
644
|
})
|
|
643
645
|
))
|
|
644
646
|
)
|
|
645
647
|
),
|
|
646
|
-
|
|
648
|
+
P((e) => {
|
|
647
649
|
e.preventDefault();
|
|
648
650
|
}),
|
|
649
651
|
E()
|
|
@@ -693,13 +695,13 @@ const Le = class Le extends X {
|
|
|
693
695
|
me(null),
|
|
694
696
|
U()
|
|
695
697
|
).pipe(
|
|
696
|
-
|
|
698
|
+
Re(this.context.bridgeEvent.viewportFree$),
|
|
697
699
|
w(() => {
|
|
698
700
|
const a = this.hookManager.execute("item.onDocumentLoad", this.item.id, {
|
|
699
701
|
itemId: this.item.id,
|
|
700
702
|
documentContainer: s
|
|
701
703
|
}).filter(
|
|
702
|
-
(c) => c instanceof
|
|
704
|
+
(c) => c instanceof oe
|
|
703
705
|
);
|
|
704
706
|
return k([v(null), ...a]).pipe(U());
|
|
705
707
|
})
|
|
@@ -714,17 +716,17 @@ const Le = class Le extends X {
|
|
|
714
716
|
const i = t.pipe(
|
|
715
717
|
w(() => (this.stateSubject.next("unloading"), this.context.bridgeEvent.viewportFree$.pipe(
|
|
716
718
|
U(),
|
|
717
|
-
|
|
719
|
+
P(() => {
|
|
718
720
|
this.hookManager.destroy("item.onDocumentLoad", this.item.id);
|
|
719
721
|
}),
|
|
720
722
|
w(() => this.onUnload().pipe(me(null), U())),
|
|
721
|
-
|
|
723
|
+
P(() => {
|
|
722
724
|
this.stateSubject.next("idle");
|
|
723
725
|
}),
|
|
724
726
|
T(this.load$)
|
|
725
727
|
)))
|
|
726
728
|
);
|
|
727
|
-
|
|
729
|
+
x(this.unload$, i).pipe(T(this.destroy$)).subscribe();
|
|
728
730
|
}
|
|
729
731
|
setDocumentContainer(e) {
|
|
730
732
|
this._documentContainer = e, this._documentContainer.classList.add(
|
|
@@ -751,7 +753,7 @@ const Le = class Le extends X {
|
|
|
751
753
|
}
|
|
752
754
|
renderHeadless() {
|
|
753
755
|
const e = new R();
|
|
754
|
-
return
|
|
756
|
+
return ze(() => this.onRenderHeadless({ release: e })).pipe(
|
|
755
757
|
me(void 0),
|
|
756
758
|
U(),
|
|
757
759
|
S((t) => {
|
|
@@ -766,11 +768,11 @@ const Le = class Le extends X {
|
|
|
766
768
|
de(() => {
|
|
767
769
|
e.complete();
|
|
768
770
|
}),
|
|
769
|
-
|
|
771
|
+
Ft((t) => (D.error(t), v(void 0)))
|
|
770
772
|
);
|
|
771
773
|
}
|
|
772
774
|
layout(e) {
|
|
773
|
-
return
|
|
775
|
+
return ze(() => this.onLayout(e));
|
|
774
776
|
}
|
|
775
777
|
destroy() {
|
|
776
778
|
this.unload(), this.stateSubject.complete(), super.destroy();
|
|
@@ -795,25 +797,25 @@ const Le = class Le extends X {
|
|
|
795
797
|
};
|
|
796
798
|
Le.DOCUMENT_CONTAINER_CLASS_NAME = "prose-reader-document-container";
|
|
797
799
|
let fe = Le;
|
|
798
|
-
const
|
|
800
|
+
const Kn = (n) => new URL(n.href);
|
|
799
801
|
class tt {
|
|
800
802
|
constructor(e, t) {
|
|
801
803
|
this.item = e, this.settings = t;
|
|
802
804
|
}
|
|
803
805
|
async getResource() {
|
|
804
|
-
return await
|
|
806
|
+
return await an(
|
|
805
807
|
this.settings.values.getResource?.(this.item) ?? v(void 0)
|
|
806
|
-
) ??
|
|
808
|
+
) ?? Kn(this.item);
|
|
807
809
|
}
|
|
808
810
|
async fetchResource() {
|
|
809
811
|
const e = await this.getResource();
|
|
810
812
|
return e instanceof Response ? e : e instanceof URL ? fetch(e) : e;
|
|
811
813
|
}
|
|
812
814
|
}
|
|
813
|
-
const
|
|
815
|
+
const kt = (n, e) => {
|
|
814
816
|
const t = n.startsWith("file://"), i = t ? n.replace("file://", "http://") : n, o = new URL(e, i).toString();
|
|
815
817
|
return t ? o.replace("http://", "file://") : o;
|
|
816
|
-
},
|
|
818
|
+
}, Qn = async (n, e, t, i, o) => {
|
|
817
819
|
if (!n || !n.defaultView) return;
|
|
818
820
|
const s = e.sheet;
|
|
819
821
|
if (s)
|
|
@@ -830,7 +832,7 @@ const jt = (n, e) => {
|
|
|
830
832
|
return p;
|
|
831
833
|
const m = p.match(/url\(['"]?([^'"]+)['"]?\)/);
|
|
832
834
|
if (!m) return p;
|
|
833
|
-
const y = m[1] ?? "", f = i.manifest?.items.find(({ href: b }) => `${
|
|
835
|
+
const y = m[1] ?? "", f = i.manifest?.items.find(({ href: b }) => `${kt(t, y).toLowerCase()}`.endsWith(
|
|
834
836
|
`${b.toLowerCase()}`
|
|
835
837
|
));
|
|
836
838
|
if (f) {
|
|
@@ -861,10 +863,10 @@ const jt = (n, e) => {
|
|
|
861
863
|
} catch (r) {
|
|
862
864
|
console.error("Could not access stylesheet rules:", r);
|
|
863
865
|
}
|
|
864
|
-
},
|
|
866
|
+
}, ei = (n, e, t, i, o) => {
|
|
865
867
|
const s = e.getAttribute("src") || e.getAttribute("href");
|
|
866
868
|
if (!s) return v(null);
|
|
867
|
-
const r = i.manifest?.items.find(({ href: c }) => `${
|
|
869
|
+
const r = i.manifest?.items.find(({ href: c }) => `${kt(t, s).toLowerCase()}`.endsWith(
|
|
868
870
|
`${c.toLowerCase()}`
|
|
869
871
|
));
|
|
870
872
|
if (!r) return v(null);
|
|
@@ -880,10 +882,10 @@ const jt = (n, e) => {
|
|
|
880
882
|
if (e.hasAttribute("src"))
|
|
881
883
|
e.setAttribute("src", u);
|
|
882
884
|
else if (e.hasAttribute("href") && (e.setAttribute("href", u), n?.defaultView && e instanceof n.defaultView.HTMLLinkElement))
|
|
883
|
-
return new
|
|
885
|
+
return new oe((l) => {
|
|
884
886
|
e.onload = async () => {
|
|
885
887
|
try {
|
|
886
|
-
e.sheet && await
|
|
888
|
+
e.sheet && await Qn(
|
|
887
889
|
n,
|
|
888
890
|
e,
|
|
889
891
|
t,
|
|
@@ -898,16 +900,16 @@ const jt = (n, e) => {
|
|
|
898
900
|
return v(null);
|
|
899
901
|
})
|
|
900
902
|
);
|
|
901
|
-
},
|
|
903
|
+
}, ti = ({
|
|
902
904
|
settings: n,
|
|
903
905
|
item: e,
|
|
904
906
|
context: t
|
|
905
907
|
}) => (i) => i.pipe(
|
|
906
908
|
w((o) => {
|
|
907
|
-
const s =
|
|
909
|
+
const s = Rt(
|
|
908
910
|
o.contentDocument
|
|
909
|
-
), r =
|
|
910
|
-
(c) =>
|
|
911
|
+
), r = mn(e.href), a = s.map(
|
|
912
|
+
(c) => ei(
|
|
911
913
|
o.contentDocument,
|
|
912
914
|
c,
|
|
913
915
|
r,
|
|
@@ -917,11 +919,11 @@ const jt = (n, e) => {
|
|
|
917
919
|
);
|
|
918
920
|
return k(a).pipe(S(() => o));
|
|
919
921
|
})
|
|
920
|
-
),
|
|
921
|
-
|
|
922
|
-
},
|
|
922
|
+
), ni = (n) => {
|
|
923
|
+
On(n?.contentDocument);
|
|
924
|
+
}, Zs = "@prose-reader/core", Js = 0, Ks = 200, ii = [".xhtml", ".html", ".htm"], W = "prose-reader", Ut = `${W}-style`, oi = `data-${W}-id`, si = `${W}-viewport`, ri = `${W}-scroll-navigator`, ai = async (n, e) => {
|
|
923
925
|
if (typeof n == "string") return n;
|
|
924
|
-
const t =
|
|
926
|
+
const t = fn(n.headers.get("Content-Type") || "") || Me(e.href);
|
|
925
927
|
if (["image/jpg", "image/jpeg", "image/png", "image/webp"].some(
|
|
926
928
|
(o) => o === t
|
|
927
929
|
)) {
|
|
@@ -957,11 +959,11 @@ const jt = (n, e) => {
|
|
|
957
959
|
</body>
|
|
958
960
|
</html>
|
|
959
961
|
` : await n.text();
|
|
960
|
-
},
|
|
962
|
+
}, ci = ({
|
|
961
963
|
item: n,
|
|
962
964
|
resourcesHandler: e
|
|
963
965
|
}) => {
|
|
964
|
-
const t = (i) =>
|
|
966
|
+
const t = (i) => ai(i, n);
|
|
965
967
|
return (i) => i.pipe(
|
|
966
968
|
w((o) => N(e.getResource()).pipe(
|
|
967
969
|
w((s) => s instanceof URL && n.href.startsWith(window.location.origin) && // we have an encoding and it's a valid html
|
|
@@ -971,7 +973,7 @@ const jt = (n, e) => {
|
|
|
971
973
|
"text/html",
|
|
972
974
|
"text/xml"
|
|
973
975
|
].includes(n.mediaType) || // no encoding ? then try to detect html
|
|
974
|
-
!n.mediaType &&
|
|
976
|
+
!n.mediaType && ii.some(
|
|
975
977
|
(a) => n.href.endsWith(a)
|
|
976
978
|
)) ? (o?.setAttribute("src", n.href), v(o)) : (s instanceof URL ? N(e.fetchResource()) : v(s)).pipe(
|
|
977
979
|
w((a) => {
|
|
@@ -979,21 +981,21 @@ const jt = (n, e) => {
|
|
|
979
981
|
throw new Error("Invalid resource");
|
|
980
982
|
return N(t(a));
|
|
981
983
|
}),
|
|
982
|
-
|
|
984
|
+
P((a) => {
|
|
983
985
|
if (a) {
|
|
984
986
|
const c = new Blob([a], { type: "text/html" }), u = URL.createObjectURL(c);
|
|
985
987
|
o?.setAttribute("src", u);
|
|
986
988
|
}
|
|
987
989
|
}),
|
|
988
990
|
S(() => o),
|
|
989
|
-
|
|
991
|
+
Ft((a) => (D.error(
|
|
990
992
|
`Error while trying to fetch or load resource for item ${n.id}`,
|
|
991
993
|
s
|
|
992
994
|
), D.error(a), v(o)))
|
|
993
995
|
))
|
|
994
996
|
))
|
|
995
997
|
);
|
|
996
|
-
},
|
|
998
|
+
}, ui = () => {
|
|
997
999
|
const n = document.createElement("iframe");
|
|
998
1000
|
return n.frameBorder = "no", n.tabIndex = 0, n.setAttribute(
|
|
999
1001
|
"sandbox",
|
|
@@ -1008,12 +1010,12 @@ const jt = (n, e) => {
|
|
|
1008
1010
|
border: 0px none transparent;
|
|
1009
1011
|
padding: 0px;
|
|
1010
1012
|
`, n.setAttribute("role", "main"), n;
|
|
1011
|
-
},
|
|
1013
|
+
}, zt = () => `
|
|
1012
1014
|
body {
|
|
1013
1015
|
margin: 0;
|
|
1014
1016
|
}
|
|
1015
1017
|
}
|
|
1016
|
-
`,
|
|
1018
|
+
`, Wt = ({
|
|
1017
1019
|
pageHeight: n,
|
|
1018
1020
|
pageWidth: e,
|
|
1019
1021
|
frameElement: t
|
|
@@ -1026,12 +1028,12 @@ const jt = (n, e) => {
|
|
|
1026
1028
|
n / (i.height ?? 1)
|
|
1027
1029
|
), computedWidthScale: o, viewportDimensions: i };
|
|
1028
1030
|
}
|
|
1029
|
-
},
|
|
1031
|
+
}, li = ({
|
|
1030
1032
|
columnWidth: n,
|
|
1031
1033
|
enableTouch: e,
|
|
1032
1034
|
spreadPosition: t
|
|
1033
1035
|
}, i) => `
|
|
1034
|
-
${
|
|
1036
|
+
${zt()}
|
|
1035
1037
|
body {
|
|
1036
1038
|
${i ? "" : `
|
|
1037
1039
|
display: flex;
|
|
@@ -1049,9 +1051,9 @@ const jt = (n, e) => {
|
|
|
1049
1051
|
}
|
|
1050
1052
|
|
|
1051
1053
|
html, body {
|
|
1052
|
-
${e ? `
|
|
1054
|
+
${e ? "" : `
|
|
1053
1055
|
touch-action: none
|
|
1054
|
-
`
|
|
1056
|
+
`}
|
|
1055
1057
|
}
|
|
1056
1058
|
|
|
1057
1059
|
img {
|
|
@@ -1071,12 +1073,12 @@ const jt = (n, e) => {
|
|
|
1071
1073
|
object-fit:contain;
|
|
1072
1074
|
`}
|
|
1073
1075
|
}
|
|
1074
|
-
`,
|
|
1076
|
+
`, di = ({
|
|
1075
1077
|
pageHeight: n,
|
|
1076
1078
|
pageWidth: e
|
|
1077
1079
|
}) => ({ columnHeight: n, columnWidth: e }), lt = (n, e) => {
|
|
1078
1080
|
n.style.width = `${e.width}px`, n.style.height = `${e.height}px`;
|
|
1079
|
-
},
|
|
1081
|
+
}, pi = ({
|
|
1080
1082
|
minPageSpread: n,
|
|
1081
1083
|
blankPagePosition: e,
|
|
1082
1084
|
spreadPosition: t,
|
|
@@ -1088,15 +1090,15 @@ const jt = (n, e) => {
|
|
|
1088
1090
|
}) => {
|
|
1089
1091
|
const c = n * o;
|
|
1090
1092
|
if (s?.contentDocument && s?.contentWindow) {
|
|
1091
|
-
const { viewportDimensions: u, computedScale: l = 1 } =
|
|
1093
|
+
const { viewportDimensions: u, computedScale: l = 1 } = Wt({ frameElement: s, pageHeight: i, pageWidth: o }) ?? {}, d = o, g = i, h = li(
|
|
1092
1094
|
{
|
|
1093
|
-
...
|
|
1095
|
+
...di({ pageHeight: i, pageWidth: o }),
|
|
1094
1096
|
enableTouch: a,
|
|
1095
1097
|
spreadPosition: t
|
|
1096
1098
|
},
|
|
1097
1099
|
u
|
|
1098
1100
|
);
|
|
1099
|
-
if (
|
|
1101
|
+
if (ie(s, "prose-reader-css", h), u ? lt(s, {
|
|
1100
1102
|
width: u.width ?? 1,
|
|
1101
1103
|
height: u.height ?? 1
|
|
1102
1104
|
}) : lt(s, {
|
|
@@ -1120,8 +1122,8 @@ const jt = (n, e) => {
|
|
|
1120
1122
|
return { width: c, height: g };
|
|
1121
1123
|
}
|
|
1122
1124
|
return { width: c, height: i };
|
|
1123
|
-
},
|
|
1124
|
-
${
|
|
1125
|
+
}, gi = () => `
|
|
1126
|
+
${zt()}
|
|
1125
1127
|
html {
|
|
1126
1128
|
width: 100%;
|
|
1127
1129
|
height: 100%;
|
|
@@ -1135,7 +1137,7 @@ const jt = (n, e) => {
|
|
|
1135
1137
|
html, body {
|
|
1136
1138
|
touch-action: none;
|
|
1137
1139
|
}
|
|
1138
|
-
`,
|
|
1140
|
+
`, hi = ({
|
|
1139
1141
|
isScrollable: n,
|
|
1140
1142
|
enableTouch: e
|
|
1141
1143
|
}) => `
|
|
@@ -1144,9 +1146,9 @@ const jt = (n, e) => {
|
|
|
1144
1146
|
width: 100%;
|
|
1145
1147
|
margin: 0;
|
|
1146
1148
|
padding: 0;
|
|
1147
|
-
${e ? `
|
|
1149
|
+
${e ? "" : `
|
|
1148
1150
|
touch-action: none
|
|
1149
|
-
`
|
|
1151
|
+
`}
|
|
1150
1152
|
}
|
|
1151
1153
|
${n ? `
|
|
1152
1154
|
img {
|
|
@@ -1160,7 +1162,7 @@ const jt = (n, e) => {
|
|
|
1160
1162
|
display: block;
|
|
1161
1163
|
}
|
|
1162
1164
|
` : ""}
|
|
1163
|
-
`,
|
|
1165
|
+
`, mi = ({
|
|
1164
1166
|
width: n,
|
|
1165
1167
|
columnHeight: e,
|
|
1166
1168
|
columnWidth: t
|
|
@@ -1228,7 +1230,7 @@ const jt = (n, e) => {
|
|
|
1228
1230
|
td {
|
|
1229
1231
|
max-width: ${t}px;
|
|
1230
1232
|
}
|
|
1231
|
-
`,
|
|
1233
|
+
`, fi = ({
|
|
1232
1234
|
isUsingVerticalWriting: n,
|
|
1233
1235
|
minimumWidth: e,
|
|
1234
1236
|
pageHeight: t,
|
|
@@ -1244,7 +1246,7 @@ const jt = (n, e) => {
|
|
|
1244
1246
|
};
|
|
1245
1247
|
}, Ie = (n, e) => {
|
|
1246
1248
|
n.style.width = `${e.width}px`, n.style.height = `${e.height}px`;
|
|
1247
|
-
},
|
|
1249
|
+
}, yi = ({
|
|
1248
1250
|
pageHeight: n,
|
|
1249
1251
|
pageWidth: e,
|
|
1250
1252
|
frameElement: t,
|
|
@@ -1258,7 +1260,7 @@ const jt = (n, e) => {
|
|
|
1258
1260
|
}) => {
|
|
1259
1261
|
const l = o * e, d = i?.renditionLayout === "reflowable" && i?.renditionFlow === "scrolled-continuous", g = d ? Math.min(400, n) : n;
|
|
1260
1262
|
t?.style.setProperty("width", `${e}px`), d ? t?.style.removeProperty("height") : t?.style.setProperty("height", `${g}px`);
|
|
1261
|
-
const { viewportDimensions: h, computedScale: p = 1 } =
|
|
1263
|
+
const { viewportDimensions: h, computedScale: p = 1 } = Wt({
|
|
1262
1264
|
frameElement: t,
|
|
1263
1265
|
pageHeight: g,
|
|
1264
1266
|
pageWidth: e
|
|
@@ -1266,10 +1268,10 @@ const jt = (n, e) => {
|
|
|
1266
1268
|
if (t?.contentDocument && t?.contentWindow && t.contentDocument.body) {
|
|
1267
1269
|
let y = e, f = g;
|
|
1268
1270
|
if (h?.hasViewport)
|
|
1269
|
-
|
|
1271
|
+
ie(
|
|
1270
1272
|
t,
|
|
1271
1273
|
"prose-reader-html-renderer-framce-css",
|
|
1272
|
-
|
|
1274
|
+
gi()
|
|
1273
1275
|
), Ie(t, {
|
|
1274
1276
|
width: h.width ?? 1,
|
|
1275
1277
|
height: h.height ?? 1
|
|
@@ -1281,18 +1283,18 @@ const jt = (n, e) => {
|
|
|
1281
1283
|
`translate(-50%, -50%) scale(${p})`
|
|
1282
1284
|
), t?.style.setProperty("transform-origin", "center center");
|
|
1283
1285
|
else {
|
|
1284
|
-
const I = a ?
|
|
1286
|
+
const I = a ? hi({
|
|
1285
1287
|
isScrollable: i?.renditionFlow === "scrolled-continuous",
|
|
1286
1288
|
enableTouch: c
|
|
1287
|
-
}) :
|
|
1288
|
-
|
|
1289
|
+
}) : mi(
|
|
1290
|
+
fi({
|
|
1289
1291
|
isUsingVerticalWriting: u,
|
|
1290
1292
|
minimumWidth: l,
|
|
1291
1293
|
pageHeight: g,
|
|
1292
1294
|
pageWidth: e
|
|
1293
1295
|
})
|
|
1294
1296
|
);
|
|
1295
|
-
if (
|
|
1297
|
+
if (ie(t, "prose-reader-css", I, !0), u)
|
|
1296
1298
|
f = Math.ceil(
|
|
1297
1299
|
t.contentDocument.documentElement.scrollHeight / g
|
|
1298
1300
|
) * g, Ie(t, {
|
|
@@ -1317,38 +1319,38 @@ const jt = (n, e) => {
|
|
|
1317
1319
|
return y % l === 0 ? t?.style.setProperty("margin-left", "0px") : (y = y + e, s && !u && t?.style.setProperty("margin-left", `${e}px`)), { width: y, height: f };
|
|
1318
1320
|
}
|
|
1319
1321
|
};
|
|
1320
|
-
class
|
|
1322
|
+
class Si extends fe {
|
|
1321
1323
|
constructor() {
|
|
1322
1324
|
super(...arguments), this.isImageType = () => !!(this.item.mediaType ?? Me(this.item.href))?.startsWith("image/");
|
|
1323
1325
|
}
|
|
1324
1326
|
onCreateDocument() {
|
|
1325
|
-
const e =
|
|
1327
|
+
const e = ui();
|
|
1326
1328
|
return this.setDocumentContainer(e), v(e);
|
|
1327
1329
|
}
|
|
1328
1330
|
onLoadDocument() {
|
|
1329
1331
|
const e = this.getFrameElement();
|
|
1330
1332
|
if (!e) throw new Error("invalid frame");
|
|
1331
1333
|
return v(e).pipe(
|
|
1332
|
-
|
|
1334
|
+
ci({
|
|
1333
1335
|
item: this.item,
|
|
1334
1336
|
resourcesHandler: this.resourcesHandler,
|
|
1335
1337
|
settings: this.settings
|
|
1336
1338
|
}),
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
+
Re(this.context.bridgeEvent.viewportFree$),
|
|
1340
|
+
P(() => {
|
|
1339
1341
|
this.attach();
|
|
1340
1342
|
}),
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
+
kn,
|
|
1344
|
+
ti({
|
|
1343
1345
|
context: this.context,
|
|
1344
1346
|
item: this.item,
|
|
1345
1347
|
settings: this.settings
|
|
1346
1348
|
}),
|
|
1347
|
-
|
|
1349
|
+
Un
|
|
1348
1350
|
);
|
|
1349
1351
|
}
|
|
1350
1352
|
onUnload() {
|
|
1351
|
-
return
|
|
1353
|
+
return ni(this.getFrameElement()), this.detach(), Z;
|
|
1352
1354
|
}
|
|
1353
1355
|
onLayout({
|
|
1354
1356
|
minPageSpread: e,
|
|
@@ -1359,9 +1361,14 @@ class yi extends fe {
|
|
|
1359
1361
|
if (!r) return v(void 0);
|
|
1360
1362
|
const a = !!this.writingMode?.startsWith("vertical");
|
|
1361
1363
|
if (this.item.renditionLayout === "pre-paginated" || !this.item.renditionLayout && this.context.manifest?.renditionLayout === "pre-paginated") {
|
|
1362
|
-
const u =
|
|
1364
|
+
const u = pi({
|
|
1363
1365
|
blankPagePosition: t,
|
|
1364
|
-
|
|
1366
|
+
/**
|
|
1367
|
+
* When we have scrollable content, we use "native" touch event from the frame instead of
|
|
1368
|
+
* our own gestures.
|
|
1369
|
+
* @todo move this into scroll navigator
|
|
1370
|
+
*/
|
|
1371
|
+
enableTouch: this.settings.values.computedPageTurnMode === "scrollable",
|
|
1365
1372
|
frameElement: r,
|
|
1366
1373
|
isRTL: this.context.isRTL(),
|
|
1367
1374
|
minPageSpread: e,
|
|
@@ -1371,7 +1378,7 @@ class yi extends fe {
|
|
|
1371
1378
|
});
|
|
1372
1379
|
return v(u);
|
|
1373
1380
|
}
|
|
1374
|
-
const c =
|
|
1381
|
+
const c = yi({
|
|
1375
1382
|
pageHeight: s,
|
|
1376
1383
|
pageWidth: o,
|
|
1377
1384
|
frameElement: r,
|
|
@@ -1381,7 +1388,12 @@ class yi extends fe {
|
|
|
1381
1388
|
isRTL: this.context.isRTL(),
|
|
1382
1389
|
minPageSpread: e,
|
|
1383
1390
|
isImageType: this.isImageType(),
|
|
1384
|
-
|
|
1391
|
+
/**
|
|
1392
|
+
* When we have scrollable content, we use "native" touch event from the frame instead of
|
|
1393
|
+
* our own gestures.
|
|
1394
|
+
* @todo move this into scroll navigator
|
|
1395
|
+
*/
|
|
1396
|
+
enableTouch: this.settings.values.computedPageTurnMode === "scrollable"
|
|
1385
1397
|
});
|
|
1386
1398
|
return v(c);
|
|
1387
1399
|
}
|
|
@@ -1439,13 +1451,13 @@ class yi extends fe {
|
|
|
1439
1451
|
return this.getFrameElement();
|
|
1440
1452
|
}
|
|
1441
1453
|
}
|
|
1442
|
-
const
|
|
1454
|
+
const bi = (n) => (e) => {
|
|
1443
1455
|
const t = n({
|
|
1444
1456
|
...e,
|
|
1445
1457
|
getRenderer(o) {
|
|
1446
|
-
return e.getRenderer?.(o) ?? ((r) => new
|
|
1458
|
+
return e.getRenderer?.(o) ?? ((r) => new Si(r));
|
|
1447
1459
|
}
|
|
1448
|
-
}), i =
|
|
1460
|
+
}), i = Jn(t);
|
|
1449
1461
|
return i.pipe(T(t.$.destroy$)).subscribe(), {
|
|
1450
1462
|
...t,
|
|
1451
1463
|
links$: i
|
|
@@ -1461,35 +1473,35 @@ class nt {
|
|
|
1461
1473
|
}
|
|
1462
1474
|
class C {
|
|
1463
1475
|
constructor(e) {
|
|
1464
|
-
this.__symbol = Symbol("SpineItemPosition"), this.x = e.x, this.y = e.y;
|
|
1476
|
+
this.__symbol = /* @__PURE__ */ Symbol("SpineItemPosition"), this.x = e.x, this.y = e.y;
|
|
1465
1477
|
}
|
|
1466
1478
|
}
|
|
1467
|
-
class
|
|
1479
|
+
class Ne {
|
|
1468
1480
|
constructor(e) {
|
|
1469
|
-
this.__symbol = Symbol("SpineItemPagePosition"), this.x = e.x, this.y = e.y;
|
|
1481
|
+
this.__symbol = /* @__PURE__ */ Symbol("SpineItemPagePosition"), this.x = e.x, this.y = e.y;
|
|
1470
1482
|
}
|
|
1471
1483
|
}
|
|
1472
|
-
class
|
|
1484
|
+
class Ii extends nt {
|
|
1473
1485
|
constructor() {
|
|
1474
1486
|
super(...arguments), this.__symbol = "SpineItemPageLayout";
|
|
1475
1487
|
}
|
|
1476
1488
|
}
|
|
1477
|
-
class
|
|
1489
|
+
class Be extends nt {
|
|
1478
1490
|
constructor() {
|
|
1479
1491
|
super(...arguments), this.__symbol = "SpineItemSpineLayout";
|
|
1480
1492
|
}
|
|
1481
1493
|
}
|
|
1482
|
-
class
|
|
1494
|
+
class vi extends nt {
|
|
1483
1495
|
constructor() {
|
|
1484
1496
|
super(...arguments), this.__symbol = "SpineItemPageSpineLayout";
|
|
1485
1497
|
}
|
|
1486
1498
|
}
|
|
1487
|
-
class
|
|
1499
|
+
class _t {
|
|
1488
1500
|
constructor(e) {
|
|
1489
1501
|
this.x = e.x, this.y = e.y;
|
|
1490
1502
|
}
|
|
1491
1503
|
}
|
|
1492
|
-
class M extends
|
|
1504
|
+
class M extends _t {
|
|
1493
1505
|
constructor() {
|
|
1494
1506
|
super(...arguments), this.__symbol = "SpinePosition";
|
|
1495
1507
|
}
|
|
@@ -1497,28 +1509,28 @@ class M extends Wt {
|
|
|
1497
1509
|
return new M(e);
|
|
1498
1510
|
}
|
|
1499
1511
|
}
|
|
1500
|
-
class
|
|
1512
|
+
class ue extends _t {
|
|
1501
1513
|
constructor() {
|
|
1502
1514
|
super(...arguments), this.__symbol = "UnboundSpinePosition";
|
|
1503
1515
|
}
|
|
1504
1516
|
static from(e) {
|
|
1505
|
-
return new
|
|
1517
|
+
return new ue(e);
|
|
1506
1518
|
}
|
|
1507
1519
|
}
|
|
1508
|
-
const
|
|
1520
|
+
const wi = (n, e) => {
|
|
1509
1521
|
const t = e.getBoundingClientRect(), { x: i, y: o } = n, { left: s, top: r } = t, a = t.width / e.offsetWidth, c = t.height / e.offsetHeight, u = i - s, l = o - r;
|
|
1510
1522
|
return {
|
|
1511
1523
|
x: u / a,
|
|
1512
1524
|
y: l / c
|
|
1513
1525
|
};
|
|
1514
|
-
},
|
|
1515
|
-
|
|
1526
|
+
}, xi = (n, e) => new ue(
|
|
1527
|
+
wi(n, e)
|
|
1516
1528
|
), Pi = (n) => ({
|
|
1517
|
-
getSpinePositionFromClientPosition: (e) => n.spine.element ?
|
|
1518
|
-
}),
|
|
1529
|
+
getSpinePositionFromClientPosition: (e) => n.spine.element ? xi(e, n.spine.element) : void 0
|
|
1530
|
+
}), $i = (n) => {
|
|
1519
1531
|
let e;
|
|
1520
1532
|
const t = n.context.watch("rootElement").pipe(
|
|
1521
|
-
_((c) => c ? new
|
|
1533
|
+
_((c) => c ? new oe(() => (e = c.ownerDocument.createElement("div"), e.style.cssText = `
|
|
1522
1534
|
position: absolute;
|
|
1523
1535
|
left: 0;
|
|
1524
1536
|
top: 0;
|
|
@@ -1528,7 +1540,7 @@ const vi = (n, e) => {
|
|
|
1528
1540
|
`, c.appendChild(e), () => {
|
|
1529
1541
|
e?.remove(), e = void 0;
|
|
1530
1542
|
})) : ge)
|
|
1531
|
-
), i = (c) =>
|
|
1543
|
+
), i = (c) => cn(c, ce).pipe(
|
|
1532
1544
|
j(() => {
|
|
1533
1545
|
e?.style.setProperty(
|
|
1534
1546
|
"visibility",
|
|
@@ -1543,7 +1555,7 @@ const vi = (n, e) => {
|
|
|
1543
1555
|
);
|
|
1544
1556
|
})
|
|
1545
1557
|
), s = i(n.viewportFree$).pipe(
|
|
1546
|
-
|
|
1558
|
+
In(1)
|
|
1547
1559
|
), a = n.settings.values$.pipe(
|
|
1548
1560
|
Q(() => n.settings.values.computedPageTurnMode),
|
|
1549
1561
|
pe()
|
|
@@ -1553,12 +1565,12 @@ const vi = (n, e) => {
|
|
|
1553
1565
|
),
|
|
1554
1566
|
G(n.$.destroy$)
|
|
1555
1567
|
);
|
|
1556
|
-
return
|
|
1557
|
-
},
|
|
1568
|
+
return x(t, a);
|
|
1569
|
+
}, Ti = (n) => {
|
|
1558
1570
|
n.hookManager.register("item.onDocumentLoad", ({ itemId: e }) => {
|
|
1559
1571
|
n.spineItemsManager.get(e)?.renderer.getDocumentFrame()?.setAttribute("scrolling", "no");
|
|
1560
1572
|
});
|
|
1561
|
-
},
|
|
1573
|
+
}, Fi = (n) => {
|
|
1562
1574
|
n.hookManager.register(
|
|
1563
1575
|
"item.onAfterLayout",
|
|
1564
1576
|
({ item: e, blankPagePosition: t, minimumWidth: i }) => {
|
|
@@ -1575,12 +1587,12 @@ const vi = (n, e) => {
|
|
|
1575
1587
|
}
|
|
1576
1588
|
}
|
|
1577
1589
|
);
|
|
1578
|
-
},
|
|
1590
|
+
}, Li = (n) => n.spineItemsManager.items$.pipe(
|
|
1579
1591
|
w(
|
|
1580
|
-
(e) =>
|
|
1592
|
+
(e) => x(
|
|
1581
1593
|
...e.map(
|
|
1582
1594
|
(t) => t.pipe(
|
|
1583
|
-
|
|
1595
|
+
P((i) => {
|
|
1584
1596
|
t.containerElement.dataset.isDirty = i.iDirty.toString(), t.containerElement.dataset.isReady = i.isReady.toString();
|
|
1585
1597
|
})
|
|
1586
1598
|
)
|
|
@@ -1588,7 +1600,7 @@ const vi = (n, e) => {
|
|
|
1588
1600
|
)
|
|
1589
1601
|
)
|
|
1590
1602
|
);
|
|
1591
|
-
let
|
|
1603
|
+
let Mi = class extends jt {
|
|
1592
1604
|
computeOutputSettings(e) {
|
|
1593
1605
|
return e;
|
|
1594
1606
|
}
|
|
@@ -1614,21 +1626,21 @@ let Li = class extends Vt {
|
|
|
1614
1626
|
};
|
|
1615
1627
|
}
|
|
1616
1628
|
};
|
|
1617
|
-
const
|
|
1629
|
+
const Ci = (n) => k([
|
|
1618
1630
|
n.viewport.watch(["width", "height"]),
|
|
1619
1631
|
n.context.watch("manifest")
|
|
1620
1632
|
]).pipe(
|
|
1621
|
-
|
|
1633
|
+
P(([{ width: e, height: t }, i]) => {
|
|
1622
1634
|
const o = e > t;
|
|
1623
1635
|
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 });
|
|
1624
1636
|
})
|
|
1625
|
-
),
|
|
1637
|
+
), Ei = (n) => (e) => {
|
|
1626
1638
|
const {
|
|
1627
1639
|
pageHorizontalMargin: t,
|
|
1628
1640
|
pageVerticalMargin: i,
|
|
1629
1641
|
layoutAutoResize: o,
|
|
1630
1642
|
layoutLayerTransition: s
|
|
1631
|
-
} = e, r = n(e), a = new
|
|
1643
|
+
} = e, r = n(e), a = new Mi(
|
|
1632
1644
|
{
|
|
1633
1645
|
pageHorizontalMargin: t,
|
|
1634
1646
|
pageVerticalMargin: i,
|
|
@@ -1650,9 +1662,9 @@ const Mi = (n) => k([
|
|
|
1650
1662
|
const A = F.height - I * 2;
|
|
1651
1663
|
let Y = F.width - b * 2, B = b * 2;
|
|
1652
1664
|
m.isUsingVerticalWriting() && (Y = F.width - b * 2, $ = A, B = I * 2);
|
|
1653
|
-
const
|
|
1654
|
-
|
|
1655
|
-
|
|
1665
|
+
const re = m?.renderer.getDocumentFrame();
|
|
1666
|
+
re && ie(
|
|
1667
|
+
re,
|
|
1656
1668
|
"prose-layout-enhancer-css",
|
|
1657
1669
|
`
|
|
1658
1670
|
body {
|
|
@@ -1675,7 +1687,7 @@ const Mi = (n) => k([
|
|
|
1675
1687
|
`
|
|
1676
1688
|
);
|
|
1677
1689
|
}
|
|
1678
|
-
}),
|
|
1690
|
+
}), Fi(r), Ti(r), r.hookManager.register(
|
|
1679
1691
|
"item.onDocumentCreated",
|
|
1680
1692
|
({ documentContainer: p }) => {
|
|
1681
1693
|
p.style.opacity = "0", a.values.layoutLayerTransition && (p.style.transition = "opacity 300ms");
|
|
@@ -1685,24 +1697,24 @@ const Mi = (n) => k([
|
|
|
1685
1697
|
r.settings.values.computedPageTurnMode !== "scrollable" && y?.setAttribute("tab-index", "0");
|
|
1686
1698
|
});
|
|
1687
1699
|
const c = r.spineItemsObserver.itemIsReady$.pipe(
|
|
1688
|
-
|
|
1700
|
+
ae(({ isReady: p }) => p),
|
|
1689
1701
|
j(({ item: p }) => {
|
|
1690
1702
|
const m = p.renderer.documentContainer;
|
|
1691
1703
|
m && (m.style.opacity = "1");
|
|
1692
1704
|
})
|
|
1693
1705
|
), u = a.values$.pipe(
|
|
1694
|
-
|
|
1706
|
+
ae(({ layoutAutoResize: p }) => p === "container"),
|
|
1695
1707
|
_(() => r.context.watch("rootElement")),
|
|
1696
|
-
|
|
1708
|
+
ae(J),
|
|
1697
1709
|
_((p) => et(p)),
|
|
1698
|
-
|
|
1699
|
-
|
|
1710
|
+
vn(100),
|
|
1711
|
+
ae(J),
|
|
1700
1712
|
j(() => {
|
|
1701
1713
|
r?.layout();
|
|
1702
1714
|
})
|
|
1703
|
-
), l =
|
|
1715
|
+
), l = $i(r);
|
|
1704
1716
|
a.watch(["pageHorizontalMargin", "pageVerticalMargin"]).pipe(
|
|
1705
|
-
|
|
1717
|
+
Ct(1),
|
|
1706
1718
|
j(() => {
|
|
1707
1719
|
r.layout();
|
|
1708
1720
|
}),
|
|
@@ -1710,8 +1722,8 @@ const Mi = (n) => k([
|
|
|
1710
1722
|
).subscribe();
|
|
1711
1723
|
const d = r.spine.pages.pipe(
|
|
1712
1724
|
Ce({ refCount: !0, bufferSize: 1 })
|
|
1713
|
-
), g =
|
|
1714
|
-
return
|
|
1725
|
+
), g = Li(r), h = Ci(r);
|
|
1726
|
+
return x(
|
|
1715
1727
|
c,
|
|
1716
1728
|
l,
|
|
1717
1729
|
u,
|
|
@@ -1728,9 +1740,9 @@ const Mi = (n) => k([
|
|
|
1728
1740
|
layoutInfo$: d,
|
|
1729
1741
|
coordinates: Pi(r)
|
|
1730
1742
|
};
|
|
1731
|
-
},
|
|
1743
|
+
}, Di = `${W}-enhancer-loading`, Ht = `${Di}-container`, Ri = (n, e) => {
|
|
1732
1744
|
const t = n.ownerDocument.createElement("div");
|
|
1733
|
-
return t.classList.add(
|
|
1745
|
+
return t.classList.add(Ht), t.style.cssText = `
|
|
1734
1746
|
height: 100%;
|
|
1735
1747
|
width: 100%;
|
|
1736
1748
|
max-width: ${e.absoluteViewport.width}px;
|
|
@@ -1746,7 +1758,7 @@ const Mi = (n) => k([
|
|
|
1746
1758
|
background-color: white;
|
|
1747
1759
|
z-index: 1;
|
|
1748
1760
|
`, t;
|
|
1749
|
-
},
|
|
1761
|
+
}, Ai = ({
|
|
1750
1762
|
container: n,
|
|
1751
1763
|
item: e
|
|
1752
1764
|
}) => {
|
|
@@ -1763,17 +1775,17 @@ const Mi = (n) => k([
|
|
|
1763
1775
|
max-width: 300px;
|
|
1764
1776
|
width: 80%;
|
|
1765
1777
|
`, n.appendChild(t), n.appendChild(i), n;
|
|
1766
|
-
},
|
|
1767
|
-
const { loadingElementCreate: t =
|
|
1778
|
+
}, Oi = (n) => (e) => {
|
|
1779
|
+
const { loadingElementCreate: t = Ai } = e, i = n(e), o = (c) => v(
|
|
1768
1780
|
c.reduce((u, { item: l, element: d }) => {
|
|
1769
1781
|
d.style.zIndex = "0";
|
|
1770
1782
|
const g = d.querySelector(
|
|
1771
|
-
`.${
|
|
1783
|
+
`.${Ht}`
|
|
1772
1784
|
);
|
|
1773
1785
|
if (g instanceof HTMLElement)
|
|
1774
1786
|
return u[l.id] = g, u;
|
|
1775
1787
|
const h = t({
|
|
1776
|
-
container:
|
|
1788
|
+
container: Ri(d, i.viewport),
|
|
1777
1789
|
item: l
|
|
1778
1790
|
});
|
|
1779
1791
|
return d.appendChild(h), u[l.id] = h, u;
|
|
@@ -1809,7 +1821,7 @@ const Mi = (n) => k([
|
|
|
1809
1821
|
);
|
|
1810
1822
|
return a.pipe(
|
|
1811
1823
|
_(
|
|
1812
|
-
(c) =>
|
|
1824
|
+
(c) => x(
|
|
1813
1825
|
s(c),
|
|
1814
1826
|
r(c)
|
|
1815
1827
|
)
|
|
@@ -1824,7 +1836,7 @@ const Mi = (n) => k([
|
|
|
1824
1836
|
}
|
|
1825
1837
|
};
|
|
1826
1838
|
};
|
|
1827
|
-
class
|
|
1839
|
+
class Ni extends fe {
|
|
1828
1840
|
getImageElement() {
|
|
1829
1841
|
const e = this.documentContainer;
|
|
1830
1842
|
if (e instanceof HTMLImageElement)
|
|
@@ -1876,12 +1888,12 @@ class Oi extends fe {
|
|
|
1876
1888
|
getDocumentFrame() {
|
|
1877
1889
|
}
|
|
1878
1890
|
}
|
|
1879
|
-
const
|
|
1891
|
+
const Vi = (n) => (e) => {
|
|
1880
1892
|
const t = n({
|
|
1881
1893
|
...e,
|
|
1882
1894
|
getRenderer(r) {
|
|
1883
1895
|
const a = e.getRenderer?.(r), u = !!(r.mediaType ?? Me(r.href))?.startsWith("image/");
|
|
1884
|
-
return !a && u ? (l) => new
|
|
1896
|
+
return !a && u ? (l) => new Ni(l) : a;
|
|
1885
1897
|
}
|
|
1886
1898
|
}), i = new IntersectionObserver(
|
|
1887
1899
|
(r) => {
|
|
@@ -1931,15 +1943,15 @@ const Ni = (n) => (e) => {
|
|
|
1931
1943
|
i.disconnect(), o.disconnect(), t.destroy();
|
|
1932
1944
|
}
|
|
1933
1945
|
};
|
|
1934
|
-
},
|
|
1935
|
-
|
|
1936
|
-
if (!
|
|
1946
|
+
}, ji = (n, e) => n.links$.pipe(
|
|
1947
|
+
P((t) => {
|
|
1948
|
+
if (!Nn(t.target, "a") || t.type !== "click") return;
|
|
1937
1949
|
const i = new URL(t.target.href), o = `${i.origin}${i.pathname}`;
|
|
1938
1950
|
n.context.manifest?.spineItems.some(
|
|
1939
1951
|
(r) => r.href === o
|
|
1940
1952
|
) && e.goToUrl(i);
|
|
1941
1953
|
})
|
|
1942
|
-
),
|
|
1954
|
+
), ee = D.namespace("navigation"), ki = ({
|
|
1943
1955
|
position: n,
|
|
1944
1956
|
spineItem: e,
|
|
1945
1957
|
pageHeight: t,
|
|
@@ -1971,7 +1983,7 @@ const Ni = (n) => (e) => {
|
|
|
1971
1983
|
const u = o.getSpineItemPositionFromSpinePosition(
|
|
1972
1984
|
n,
|
|
1973
1985
|
a
|
|
1974
|
-
), l =
|
|
1986
|
+
), l = ki({
|
|
1975
1987
|
position: u,
|
|
1976
1988
|
spineItem: a,
|
|
1977
1989
|
pageHeight: s.pageSize.height,
|
|
@@ -1993,7 +2005,7 @@ const Ni = (n) => (e) => {
|
|
|
1993
2005
|
x: 0
|
|
1994
2006
|
})
|
|
1995
2007
|
);
|
|
1996
|
-
},
|
|
2008
|
+
}, Ui = ({
|
|
1997
2009
|
position: n,
|
|
1998
2010
|
spineItem: e,
|
|
1999
2011
|
context: t,
|
|
@@ -2037,7 +2049,7 @@ const Ni = (n) => (e) => {
|
|
|
2037
2049
|
return i.getAdjustedPositionForSpread(l);
|
|
2038
2050
|
}
|
|
2039
2051
|
return i.getAdjustedPositionForSpread(u);
|
|
2040
|
-
},
|
|
2052
|
+
}, zi = ({
|
|
2041
2053
|
position: n,
|
|
2042
2054
|
spineItem: e,
|
|
2043
2055
|
pageHeight: t,
|
|
@@ -2069,7 +2081,7 @@ const Ni = (n) => (e) => {
|
|
|
2069
2081
|
const u = o.getSpineItemPositionFromSpinePosition(
|
|
2070
2082
|
n,
|
|
2071
2083
|
a
|
|
2072
|
-
), l =
|
|
2084
|
+
), l = zi({
|
|
2073
2085
|
position: u,
|
|
2074
2086
|
spineItem: a,
|
|
2075
2087
|
pageHeight: s.pageSize.height,
|
|
@@ -2083,15 +2095,15 @@ const Ni = (n) => (e) => {
|
|
|
2083
2095
|
spineItemPosition: l,
|
|
2084
2096
|
spineItem: a
|
|
2085
2097
|
}) : e.fromUnboundSpinePosition(
|
|
2086
|
-
r === "horizontal" ? new
|
|
2098
|
+
r === "horizontal" ? new ue({
|
|
2087
2099
|
x: n.x + s.pageSize.width,
|
|
2088
2100
|
y: 0
|
|
2089
|
-
}) : new
|
|
2101
|
+
}) : new ue({
|
|
2090
2102
|
y: n.y + s.pageSize.height,
|
|
2091
2103
|
x: 0
|
|
2092
2104
|
})
|
|
2093
2105
|
);
|
|
2094
|
-
},
|
|
2106
|
+
}, Wi = ({
|
|
2095
2107
|
position: n,
|
|
2096
2108
|
spineItem: e,
|
|
2097
2109
|
context: t,
|
|
@@ -2139,7 +2151,7 @@ const Ni = (n) => (e) => {
|
|
|
2139
2151
|
}
|
|
2140
2152
|
return i.getAdjustedPositionForSpread(u);
|
|
2141
2153
|
};
|
|
2142
|
-
class
|
|
2154
|
+
class _i {
|
|
2143
2155
|
constructor(e) {
|
|
2144
2156
|
this.reader = e, this.movingLastDelta = { x: 0, y: 0 }, this.movingLastPosition = new M({ x: 0, y: 0 }), this.unlock = void 0;
|
|
2145
2157
|
}
|
|
@@ -2158,7 +2170,7 @@ class Wi {
|
|
|
2158
2170
|
turnRightOrBottom() {
|
|
2159
2171
|
const e = this.reader.navigation.getNavigation(), t = this.reader.spineItemsManager.get(e.spineItem);
|
|
2160
2172
|
if (!t) return;
|
|
2161
|
-
const i =
|
|
2173
|
+
const i = Wi({
|
|
2162
2174
|
context: this.reader.context,
|
|
2163
2175
|
navigationResolver: this.reader.navigation.navigationResolver,
|
|
2164
2176
|
position: e.position,
|
|
@@ -2176,7 +2188,7 @@ class Wi {
|
|
|
2176
2188
|
turnLeftOrTop() {
|
|
2177
2189
|
const e = this.reader.navigation.getNavigation(), t = this.reader.spineItemsManager.get(e.spineItem);
|
|
2178
2190
|
if (!t) return;
|
|
2179
|
-
const i =
|
|
2191
|
+
const i = Ui({
|
|
2180
2192
|
context: this.reader.context,
|
|
2181
2193
|
navigationResolver: this.reader.navigation.navigationResolver,
|
|
2182
2194
|
position: e.position,
|
|
@@ -2203,7 +2215,7 @@ class Wi {
|
|
|
2203
2215
|
}) {
|
|
2204
2216
|
const i = this.reader.spineItemsManager.get(e);
|
|
2205
2217
|
if (i === void 0) {
|
|
2206
|
-
|
|
2218
|
+
ee.warn(
|
|
2207
2219
|
"goToSpineItem",
|
|
2208
2220
|
`Ignore navigation to ${e} since the item does not exist`
|
|
2209
2221
|
);
|
|
@@ -2236,7 +2248,7 @@ class Wi {
|
|
|
2236
2248
|
}
|
|
2237
2249
|
goToRightSpineItem() {
|
|
2238
2250
|
if (this.reader.settings.values.computedPageTurnDirection === "vertical") {
|
|
2239
|
-
|
|
2251
|
+
ee.warn(
|
|
2240
2252
|
"You cannot call this navigation method on vertical direction"
|
|
2241
2253
|
);
|
|
2242
2254
|
return;
|
|
@@ -2251,7 +2263,7 @@ class Wi {
|
|
|
2251
2263
|
}
|
|
2252
2264
|
goToLeftSpineItem() {
|
|
2253
2265
|
if (this.reader.settings.values.computedPageTurnDirection === "vertical") {
|
|
2254
|
-
|
|
2266
|
+
ee.warn(
|
|
2255
2267
|
"You cannot call this navigation method on vertical direction"
|
|
2256
2268
|
);
|
|
2257
2269
|
return;
|
|
@@ -2260,7 +2272,7 @@ class Wi {
|
|
|
2260
2272
|
}
|
|
2261
2273
|
goToTopSpineItem() {
|
|
2262
2274
|
if (this.reader.settings.values.computedPageTurnDirection === "horizontal") {
|
|
2263
|
-
|
|
2275
|
+
ee.warn(
|
|
2264
2276
|
"You cannot call this navigation method on horizontal direction"
|
|
2265
2277
|
);
|
|
2266
2278
|
return;
|
|
@@ -2269,7 +2281,7 @@ class Wi {
|
|
|
2269
2281
|
}
|
|
2270
2282
|
goToBottomSpineItem() {
|
|
2271
2283
|
if (this.reader.settings.values.computedPageTurnDirection === "horizontal") {
|
|
2272
|
-
|
|
2284
|
+
ee.warn(
|
|
2273
2285
|
"You cannot call this navigation method on horizontal direction"
|
|
2274
2286
|
);
|
|
2275
2287
|
return;
|
|
@@ -2285,7 +2297,7 @@ class Wi {
|
|
|
2285
2297
|
pageIndex: e,
|
|
2286
2298
|
spineItemId: t
|
|
2287
2299
|
});
|
|
2288
|
-
|
|
2300
|
+
ee.debug(".goToPageOfSpineItem()", {
|
|
2289
2301
|
pageIndex: e,
|
|
2290
2302
|
spineItemId: t,
|
|
2291
2303
|
...i,
|
|
@@ -2300,7 +2312,7 @@ class Wi {
|
|
|
2300
2312
|
...t
|
|
2301
2313
|
}) {
|
|
2302
2314
|
const i = this.reader.spine.pages.fromAbsolutePageIndex(e);
|
|
2303
|
-
if (
|
|
2315
|
+
if (ee.debug(".goToAbsolutePageIndex()", {
|
|
2304
2316
|
absolutePageIndex: e,
|
|
2305
2317
|
...t,
|
|
2306
2318
|
foundInfo: i
|
|
@@ -2318,62 +2330,107 @@ class Wi {
|
|
|
2318
2330
|
}
|
|
2319
2331
|
}
|
|
2320
2332
|
}
|
|
2321
|
-
class
|
|
2333
|
+
class se extends oe {
|
|
2322
2334
|
constructor(e) {
|
|
2323
|
-
|
|
2335
|
+
super((t) => this.stateSubject.pipe(T(this._destroy$)).subscribe(t)), this._destroy$ = new R(), this.destroy$ = this._destroy$.asObservable(), this.stateSubject = new H(e);
|
|
2324
2336
|
}
|
|
2325
|
-
|
|
2337
|
+
next(e) {
|
|
2338
|
+
this.stateSubject.next(e);
|
|
2339
|
+
}
|
|
2340
|
+
/**
|
|
2341
|
+
* Default shallow compare.
|
|
2342
|
+
*/
|
|
2343
|
+
mergeCompare(e) {
|
|
2344
|
+
const t = { ...this.value, ...e };
|
|
2345
|
+
V(this.value, t) || this.stateSubject.next(t);
|
|
2346
|
+
}
|
|
2347
|
+
watch(e) {
|
|
2348
|
+
return Array.isArray(e) ? this.stateSubject.pipe(Qe(e)) : this.stateSubject.pipe(
|
|
2349
|
+
S((t) => t[e]),
|
|
2350
|
+
z(V)
|
|
2351
|
+
);
|
|
2352
|
+
}
|
|
2353
|
+
get value() {
|
|
2354
|
+
return this.stateSubject.value;
|
|
2355
|
+
}
|
|
2356
|
+
destroy() {
|
|
2357
|
+
this.stateSubject.complete(), this._destroy$.complete();
|
|
2358
|
+
}
|
|
2359
|
+
}
|
|
2360
|
+
class Hi extends se {
|
|
2361
|
+
constructor(e) {
|
|
2362
|
+
super({
|
|
2363
|
+
lastDelta: { x: 0, y: 0 },
|
|
2364
|
+
lastPosition: new M({ x: 0, y: 0 }),
|
|
2365
|
+
lastStartPosition: new M({ x: 0, y: 0 }),
|
|
2366
|
+
isStarted: !1
|
|
2367
|
+
}), this.reader = e, this.unlock = void 0;
|
|
2368
|
+
}
|
|
2369
|
+
start(e) {
|
|
2370
|
+
this.unlock?.(), this.unlock = this.reader.navigation.lock(), this.mergeCompare({
|
|
2371
|
+
isStarted: !0,
|
|
2372
|
+
lastDelta: e,
|
|
2373
|
+
lastStartPosition: this.reader.navigation.controlledNavigationController.viewportPosition,
|
|
2374
|
+
lastPosition: this.reader.navigation.controlledNavigationController.viewportPosition
|
|
2375
|
+
});
|
|
2376
|
+
}
|
|
2377
|
+
stop(e) {
|
|
2378
|
+
this.panMoveTo(e), this.mergeCompare({
|
|
2379
|
+
isStarted: !1
|
|
2380
|
+
}), this.unlock?.();
|
|
2381
|
+
}
|
|
2382
|
+
panMoveTo(e) {
|
|
2326
2383
|
if (this.reader.settings.values.computedPageTurnMode === "scrollable") {
|
|
2327
|
-
|
|
2384
|
+
ee.warn(
|
|
2328
2385
|
"pan control is not available on free page turn mode"
|
|
2329
2386
|
);
|
|
2330
2387
|
return;
|
|
2331
2388
|
}
|
|
2332
|
-
|
|
2333
|
-
|
|
2334
|
-
|
|
2389
|
+
if (!this.value.isStarted) {
|
|
2390
|
+
ee.error("Pan navigator is not started");
|
|
2391
|
+
return;
|
|
2392
|
+
}
|
|
2393
|
+
const t = this.reader.settings.values.computedPageTurnDirection;
|
|
2394
|
+
let i = this.reader.navigation.getNavigation().position;
|
|
2335
2395
|
if (e) {
|
|
2336
|
-
const
|
|
2337
|
-
|
|
2338
|
-
),
|
|
2339
|
-
|
|
2396
|
+
const o = this.reader.viewport.absoluteViewport.width / this.reader.viewport.relativeViewport.width, s = Math.floor(e.x) - (this.value.lastDelta?.x || 0), r = Math.floor(e.y) - (this.value.lastDelta?.y || 0), a = Math.floor(
|
|
2397
|
+
t === "horizontal" ? this.value.lastPosition.x - s / o : 0
|
|
2398
|
+
), c = Math.floor(
|
|
2399
|
+
t === "horizontal" ? 0 : this.value.lastPosition.y - r / o
|
|
2340
2400
|
);
|
|
2341
|
-
|
|
2342
|
-
x:
|
|
2343
|
-
y:
|
|
2344
|
-
}), this.
|
|
2401
|
+
i = new M({
|
|
2402
|
+
x: a,
|
|
2403
|
+
y: c
|
|
2404
|
+
}), this.mergeCompare({
|
|
2405
|
+
lastDelta: e
|
|
2406
|
+
});
|
|
2345
2407
|
} else
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
|
|
2350
|
-
|
|
2351
|
-
}), this.unlock?.();
|
|
2352
|
-
return;
|
|
2353
|
-
}
|
|
2354
|
-
this.reader.navigation.navigate({
|
|
2355
|
-
position: s,
|
|
2408
|
+
i = this.value.lastPosition;
|
|
2409
|
+
this.mergeCompare({
|
|
2410
|
+
lastPosition: i
|
|
2411
|
+
}), this.reader.navigation.navigate({
|
|
2412
|
+
position: i,
|
|
2356
2413
|
animation: !1
|
|
2357
2414
|
});
|
|
2358
2415
|
}
|
|
2359
2416
|
}
|
|
2360
|
-
const
|
|
2361
|
-
class
|
|
2417
|
+
const Bi = 500;
|
|
2418
|
+
class Xi extends X {
|
|
2362
2419
|
constructor(e, t) {
|
|
2363
2420
|
super(), this.scrollNavigationController = e, this.locker = t, this.navigationSubject = new R(), this.navigation$ = this.navigationSubject.asObservable();
|
|
2364
2421
|
const i = this.scrollNavigationController.userScroll$.pipe(
|
|
2365
|
-
|
|
2422
|
+
We((o) => {
|
|
2366
2423
|
const s = this.locker.lock();
|
|
2367
|
-
return
|
|
2424
|
+
return x(
|
|
2368
2425
|
this.scrollNavigationController.userScroll$,
|
|
2369
2426
|
v(o)
|
|
2370
2427
|
).pipe(
|
|
2371
2428
|
Se(
|
|
2372
|
-
|
|
2373
|
-
|
|
2429
|
+
Bi,
|
|
2430
|
+
ce
|
|
2374
2431
|
),
|
|
2375
2432
|
U(),
|
|
2376
|
-
|
|
2433
|
+
P(() => {
|
|
2377
2434
|
const r = this.scrollNavigationController.fromScrollPosition(
|
|
2378
2435
|
this.scrollNavigationController.scrollPosition
|
|
2379
2436
|
);
|
|
@@ -2389,10 +2446,10 @@ class Bi extends X {
|
|
|
2389
2446
|
);
|
|
2390
2447
|
})
|
|
2391
2448
|
);
|
|
2392
|
-
|
|
2449
|
+
x(i).pipe(T(this.destroy$)).subscribe();
|
|
2393
2450
|
}
|
|
2394
2451
|
}
|
|
2395
|
-
const
|
|
2452
|
+
const Yi = (n) => n.pagination.state$.pipe(
|
|
2396
2453
|
O(n.context.manifest$, n.settings.values$),
|
|
2397
2454
|
S(
|
|
2398
2455
|
([
|
|
@@ -2412,32 +2469,32 @@ const Xi = (n) => n.pagination.state$.pipe(
|
|
|
2412
2469
|
}
|
|
2413
2470
|
),
|
|
2414
2471
|
z(V)
|
|
2415
|
-
),
|
|
2472
|
+
), qi = ({ reader: n, duration: e }) => (t) => {
|
|
2416
2473
|
let i;
|
|
2417
2474
|
const o = () => {
|
|
2418
2475
|
i?.(), i = void 0;
|
|
2419
2476
|
};
|
|
2420
2477
|
return t.pipe(
|
|
2421
|
-
|
|
2478
|
+
P(() => {
|
|
2422
2479
|
i || (i = n?.navigation.lock());
|
|
2423
2480
|
}),
|
|
2424
|
-
|
|
2481
|
+
un(e, ce, {
|
|
2425
2482
|
trailing: !0,
|
|
2426
2483
|
leading: !0
|
|
2427
2484
|
}),
|
|
2428
|
-
|
|
2485
|
+
P(o),
|
|
2429
2486
|
de(o)
|
|
2430
2487
|
);
|
|
2431
|
-
},
|
|
2432
|
-
const t = n(e), i =
|
|
2488
|
+
}, Gi = (n) => (e) => {
|
|
2489
|
+
const t = n(e), i = Yi(t), o = new _i(t), s = new Hi(t), r = new Xi(
|
|
2433
2490
|
t.navigation.scrollNavigationController,
|
|
2434
2491
|
t.navigation.locker
|
|
2435
|
-
), a =
|
|
2436
|
-
|
|
2492
|
+
), a = ji(t, o), c = r.navigation$.pipe(
|
|
2493
|
+
P((d) => {
|
|
2437
2494
|
t.navigation.navigate(d);
|
|
2438
2495
|
})
|
|
2439
2496
|
);
|
|
2440
|
-
return
|
|
2497
|
+
return x(a, c).pipe(T(t.$.destroy$)).subscribe(), {
|
|
2441
2498
|
...t,
|
|
2442
2499
|
load: (d) => {
|
|
2443
2500
|
const { cfi: g, ...h } = d;
|
|
@@ -2449,8 +2506,8 @@ const Xi = (n) => n.pagination.state$.pipe(
|
|
|
2449
2506
|
navigation: {
|
|
2450
2507
|
...t.navigation,
|
|
2451
2508
|
state$: i,
|
|
2452
|
-
throttleLock: ({ duration: d, trigger: g }) => g.pipe(
|
|
2453
|
-
|
|
2509
|
+
throttleLock: ({ duration: d, trigger: g }) => g.pipe(qi({ duration: d, reader: t })),
|
|
2510
|
+
panNavigator: s,
|
|
2454
2511
|
turnBottom: o.turnBottom.bind(o),
|
|
2455
2512
|
turnTop: o.turnTop.bind(o),
|
|
2456
2513
|
turnLeftOrTop: o.turnLeftOrTop.bind(o),
|
|
@@ -2472,7 +2529,7 @@ const Xi = (n) => n.pagination.state$.pipe(
|
|
|
2472
2529
|
goToAbsolutePageIndex: o.goToAbsolutePageIndex.bind(o)
|
|
2473
2530
|
}
|
|
2474
2531
|
};
|
|
2475
|
-
},
|
|
2532
|
+
}, Bt = (n, e, t) => {
|
|
2476
2533
|
const i = t.spineItems.findIndex(
|
|
2477
2534
|
(o) => o.href === n
|
|
2478
2535
|
);
|
|
@@ -2489,7 +2546,7 @@ const Xi = (n) => n.pagination.state$.pipe(
|
|
|
2489
2546
|
const m = {
|
|
2490
2547
|
title: s.title,
|
|
2491
2548
|
path: s.path
|
|
2492
|
-
}, y =
|
|
2549
|
+
}, y = Bt(n, s.contents, t);
|
|
2493
2550
|
return y ? {
|
|
2494
2551
|
...m,
|
|
2495
2552
|
subChapter: y
|
|
@@ -2497,19 +2554,19 @@ const Xi = (n) => n.pagination.state$.pipe(
|
|
|
2497
2554
|
}
|
|
2498
2555
|
return o;
|
|
2499
2556
|
}, void 0);
|
|
2500
|
-
},
|
|
2557
|
+
}, Zi = (n, e) => {
|
|
2501
2558
|
const { href: t } = e;
|
|
2502
|
-
return
|
|
2503
|
-
},
|
|
2559
|
+
return Bt(t, n.nav?.toc ?? [], n);
|
|
2560
|
+
}, Ji = (n) => {
|
|
2504
2561
|
const e = n.context.manifest, t = n.spineItemsManager.items;
|
|
2505
2562
|
return e ? t.reduce(
|
|
2506
|
-
(i, { item: o }) => (i[o.id] =
|
|
2563
|
+
(i, { item: o }) => (i[o.id] = Zi(e, o), i),
|
|
2507
2564
|
{}
|
|
2508
2565
|
) : {};
|
|
2509
|
-
},
|
|
2510
|
-
|
|
2511
|
-
S(() =>
|
|
2512
|
-
),
|
|
2566
|
+
}, Ki = (n) => n.spineItemsManager.items$.pipe(
|
|
2567
|
+
ne([]),
|
|
2568
|
+
S(() => Ji(n))
|
|
2569
|
+
), Qi = (n, e, t) => n + e * t, eo = (n, e, t) => {
|
|
2513
2570
|
const { height: i, width: o } = t.layout.layoutInfo, { top: s, left: r } = n.spine.getSpineItemSpineLayoutInfo(t);
|
|
2514
2571
|
return n.settings.values.computedPageTurnDirection === "vertical" ? Math.max(
|
|
2515
2572
|
0,
|
|
@@ -2524,7 +2581,7 @@ const Xi = (n) => n.pagination.state$.pipe(
|
|
|
2524
2581
|
(e.x - r + n.viewport.absoluteViewport.width) / o
|
|
2525
2582
|
)
|
|
2526
2583
|
);
|
|
2527
|
-
},
|
|
2584
|
+
}, to = (n, e, t, i, o) => o.isReady$.pipe(
|
|
2528
2585
|
U(),
|
|
2529
2586
|
O(n.layoutInfo$),
|
|
2530
2587
|
S(([s, r]) => {
|
|
@@ -2534,18 +2591,18 @@ const Xi = (n) => n.pagination.state$.pipe(
|
|
|
2534
2591
|
let m = (t + 1) * (p / h);
|
|
2535
2592
|
!c && o.renditionLayout === "reflowable" && !s && (m = 0);
|
|
2536
2593
|
let y = l + m;
|
|
2537
|
-
return a.manifest?.renditionFlow === "scrolled-continuous" && (s ? m =
|
|
2594
|
+
return a.manifest?.renditionFlow === "scrolled-continuous" && (s ? m = eo(
|
|
2538
2595
|
n,
|
|
2539
2596
|
i,
|
|
2540
2597
|
o
|
|
2541
|
-
) : m = 0, y =
|
|
2598
|
+
) : m = 0, y = Qi(
|
|
2542
2599
|
l,
|
|
2543
2600
|
p,
|
|
2544
2601
|
m
|
|
2545
2602
|
)), e === u - 1 && t === h - 1 && y > 0.99 ? 1 : y;
|
|
2546
2603
|
})
|
|
2547
|
-
),
|
|
2548
|
-
Se(10,
|
|
2604
|
+
), no = (n) => n.spine.layout$.pipe(
|
|
2605
|
+
Se(10, ce),
|
|
2549
2606
|
O(n.pagination.state$),
|
|
2550
2607
|
S(() => ({
|
|
2551
2608
|
numberOfPagesPerItems: n.spineItemsManager.items.reduce(
|
|
@@ -2558,11 +2615,11 @@ const Xi = (n) => n.pagination.state$.pipe(
|
|
|
2558
2615
|
numberOfTotalPages: n.spine.pages.value.pages.length
|
|
2559
2616
|
})),
|
|
2560
2617
|
z(V),
|
|
2561
|
-
|
|
2618
|
+
ne({
|
|
2562
2619
|
numberOfPagesPerItems: [],
|
|
2563
2620
|
numberOfTotalPages: 0
|
|
2564
2621
|
})
|
|
2565
|
-
),
|
|
2622
|
+
), io = (n, e, t, i) => {
|
|
2566
2623
|
const o = e.beginSpineItemIndex !== void 0 ? n.spineItemsManager.get(e.beginSpineItemIndex) : void 0, s = e.endSpineItemIndex !== void 0 ? n.spineItemsManager.get(e.endSpineItemIndex) : void 0;
|
|
2567
2624
|
return v({
|
|
2568
2625
|
...e,
|
|
@@ -2593,7 +2650,7 @@ const Xi = (n) => n.pagination.state$.pipe(
|
|
|
2593
2650
|
// hasPreviousChapter: (reader.spine.spineItemIndex || 0) < (manifest.readingOrder.length - 1),
|
|
2594
2651
|
// numberOfSpineItems: context.manifest?.readingOrder.length,
|
|
2595
2652
|
});
|
|
2596
|
-
},
|
|
2653
|
+
}, oo = (n) => k([
|
|
2597
2654
|
n.pagination.state$,
|
|
2598
2655
|
// Usually pagination change if layout changes (number of pages) however it is especially
|
|
2599
2656
|
// useful for like webtoon where you still have one page but only the layout will give you the final size
|
|
@@ -2602,7 +2659,7 @@ const Xi = (n) => n.pagination.state$.pipe(
|
|
|
2602
2659
|
]).pipe(
|
|
2603
2660
|
w(([e]) => {
|
|
2604
2661
|
const t = e.endSpineItemIndex !== void 0 ? n.spineItemsManager.get(e.endSpineItemIndex) : void 0;
|
|
2605
|
-
return t ?
|
|
2662
|
+
return t ? to(
|
|
2606
2663
|
n,
|
|
2607
2664
|
e.endSpineItemIndex ?? 0,
|
|
2608
2665
|
e.endPageIndexInSpineItem || 0,
|
|
@@ -2610,8 +2667,8 @@ const Xi = (n) => n.pagination.state$.pipe(
|
|
|
2610
2667
|
t
|
|
2611
2668
|
) : v(0);
|
|
2612
2669
|
})
|
|
2613
|
-
),
|
|
2614
|
-
const e =
|
|
2670
|
+
), so = (n) => {
|
|
2671
|
+
const e = Ki(n), t = no(n), i = new H({
|
|
2615
2672
|
...n.pagination.state,
|
|
2616
2673
|
beginChapterInfo: void 0,
|
|
2617
2674
|
beginCfi: void 0,
|
|
@@ -2629,10 +2686,10 @@ const Xi = (n) => n.pagination.state$.pipe(
|
|
|
2629
2686
|
}), o = k([
|
|
2630
2687
|
n.pagination.state$,
|
|
2631
2688
|
e,
|
|
2632
|
-
|
|
2689
|
+
oo(n)
|
|
2633
2690
|
]).pipe(
|
|
2634
2691
|
w(
|
|
2635
|
-
([r, a, c]) =>
|
|
2692
|
+
([r, a, c]) => io(
|
|
2636
2693
|
n,
|
|
2637
2694
|
r,
|
|
2638
2695
|
a,
|
|
@@ -2662,21 +2719,21 @@ const Xi = (n) => n.pagination.state$.pipe(
|
|
|
2662
2719
|
r.endPageIndexInSpineItem ?? 0
|
|
2663
2720
|
)
|
|
2664
2721
|
})),
|
|
2665
|
-
|
|
2722
|
+
P((r) => {
|
|
2666
2723
|
i.next(r);
|
|
2667
2724
|
}),
|
|
2668
2725
|
K(1)
|
|
2669
2726
|
), getPaginationInfo: () => i.value };
|
|
2670
|
-
}, he = (n) =>
|
|
2727
|
+
}, he = (n) => _e({
|
|
2671
2728
|
spineIndex: n.index,
|
|
2672
2729
|
spineId: n.id
|
|
2673
|
-
}),
|
|
2730
|
+
}), Xt = ({
|
|
2674
2731
|
nodeOrRange: n,
|
|
2675
2732
|
offset: e,
|
|
2676
2733
|
item: t
|
|
2677
2734
|
}) => {
|
|
2678
2735
|
const i = "ownerDocument" in n ? n.ownerDocument : n.startContainer.ownerDocument;
|
|
2679
|
-
return !i || !i?.documentElement || n === i ? he(t) :
|
|
2736
|
+
return !i || !i?.documentElement || n === i ? he(t) : Vn(n) ? _e({
|
|
2680
2737
|
start: {
|
|
2681
2738
|
node: n.startContainer,
|
|
2682
2739
|
offset: n.startOffset,
|
|
@@ -2689,13 +2746,13 @@ const Xi = (n) => n.pagination.state$.pipe(
|
|
|
2689
2746
|
spineIndex: t.index,
|
|
2690
2747
|
spineId: t.id
|
|
2691
2748
|
}
|
|
2692
|
-
}) :
|
|
2749
|
+
}) : _e({
|
|
2693
2750
|
node: n,
|
|
2694
2751
|
offset: e,
|
|
2695
2752
|
spineIndex: t.index,
|
|
2696
2753
|
spineId: t.id
|
|
2697
2754
|
});
|
|
2698
|
-
},
|
|
2755
|
+
}, Xe = ({
|
|
2699
2756
|
pageIndex: n,
|
|
2700
2757
|
spineItem: e,
|
|
2701
2758
|
spine: t
|
|
@@ -2703,26 +2760,26 @@ const Xi = (n) => n.pagination.state$.pipe(
|
|
|
2703
2760
|
const o = t.pages.value.pages.find(
|
|
2704
2761
|
(r) => r.itemIndex === e.index && r.pageIndex === n
|
|
2705
2762
|
)?.firstVisibleNode, s = e.renderer.getDocumentFrame();
|
|
2706
|
-
return o && s instanceof HTMLIFrameElement && s.contentWindow?.document ?
|
|
2763
|
+
return o && s instanceof HTMLIFrameElement && s.contentWindow?.document ? Xt({
|
|
2707
2764
|
nodeOrRange: o.node,
|
|
2708
2765
|
offset: o.offset,
|
|
2709
2766
|
item: e.item
|
|
2710
2767
|
}).trim() : he(e.item);
|
|
2711
|
-
},
|
|
2768
|
+
}, ro = (n, e) => Xt({
|
|
2712
2769
|
nodeOrRange: n,
|
|
2713
2770
|
item: e
|
|
2714
|
-
}),
|
|
2715
|
-
const e =
|
|
2716
|
-
return
|
|
2717
|
-
},
|
|
2718
|
-
const e =
|
|
2771
|
+
}), er = (n) => n.index.toString(), gt = (n) => n[0]?.index === 6 && n.length > 1, Ye = (n) => {
|
|
2772
|
+
const e = Et(n);
|
|
2773
|
+
return xn(e);
|
|
2774
|
+
}, ao = (n) => Array.isArray(n) ? n[0] && gt(n[0]) ? n[0] : void 0 : n.parent[0] && gt(n.parent[0]) ? n.parent[0] : void 0, it = (n) => {
|
|
2775
|
+
const e = Et(n), s = ((ao(e) ?? [])[1]?.index ?? 2) / 2 - 1, r = Pn(e), a = r ? e.end.at(-1)?.at(-1)?.offset : e.at(-1)?.at(-1)?.offset;
|
|
2719
2776
|
return {
|
|
2720
2777
|
isCfiRange: r,
|
|
2721
2778
|
cleanedCfi: n,
|
|
2722
2779
|
itemIndex: s,
|
|
2723
2780
|
offset: a ?? 0
|
|
2724
2781
|
};
|
|
2725
|
-
},
|
|
2782
|
+
}, Yt = ({
|
|
2726
2783
|
cfi: n,
|
|
2727
2784
|
spineItemsManager: e
|
|
2728
2785
|
}) => {
|
|
@@ -2738,7 +2795,7 @@ const Xi = (n) => n.pagination.state$.pipe(
|
|
|
2738
2795
|
const r = s.contentWindow?.document;
|
|
2739
2796
|
if (r)
|
|
2740
2797
|
try {
|
|
2741
|
-
const a =
|
|
2798
|
+
const a = $n(n, r, {
|
|
2742
2799
|
throwOnError: !0
|
|
2743
2800
|
});
|
|
2744
2801
|
return {
|
|
@@ -2765,7 +2822,7 @@ const Xi = (n) => n.pagination.state$.pipe(
|
|
|
2765
2822
|
spineItem: o,
|
|
2766
2823
|
node: null
|
|
2767
2824
|
};
|
|
2768
|
-
},
|
|
2825
|
+
}, co = (n, e) => {
|
|
2769
2826
|
if ("cfi" in e) {
|
|
2770
2827
|
const { itemIndex: s, ...r } = n.cfi.parseCfi(e.cfi);
|
|
2771
2828
|
return {
|
|
@@ -2785,10 +2842,10 @@ const Xi = (n) => n.pagination.state$.pipe(
|
|
|
2785
2842
|
itemIndex: t.index,
|
|
2786
2843
|
node: null
|
|
2787
2844
|
};
|
|
2788
|
-
},
|
|
2845
|
+
}, uo = (n, e) => {
|
|
2789
2846
|
let t = n?.itemPageIndex;
|
|
2790
2847
|
const { itemIndex: i, ...o } = e.cfi.parseCfi(n.cfi), s = e.spineItemsManager.get(i);
|
|
2791
|
-
return s ?
|
|
2848
|
+
return s ? Vt().pipe(
|
|
2792
2849
|
O(s.isReady$),
|
|
2793
2850
|
S(([, r]) => {
|
|
2794
2851
|
const {
|
|
@@ -2818,7 +2875,7 @@ const Xi = (n) => n.pagination.state$.pipe(
|
|
|
2818
2875
|
})
|
|
2819
2876
|
) : v({ ...n, itemIndex: i, ...o });
|
|
2820
2877
|
};
|
|
2821
|
-
class
|
|
2878
|
+
class lo {
|
|
2822
2879
|
constructor(e) {
|
|
2823
2880
|
this.reader = e, this.locatorsByKey = /* @__PURE__ */ new Map(), this.deregisterMemoizedStream = (t) => {
|
|
2824
2881
|
const i = this.locatorsByKey.get(t);
|
|
@@ -2826,7 +2883,7 @@ class uo {
|
|
|
2826
2883
|
}, this.locate = (t, i) => {
|
|
2827
2884
|
const o = {
|
|
2828
2885
|
resource: t,
|
|
2829
|
-
meta:
|
|
2886
|
+
meta: co(this.reader, t)
|
|
2830
2887
|
};
|
|
2831
2888
|
return ct(() => {
|
|
2832
2889
|
const s = this.reader.spineItemsManager.get(
|
|
@@ -2850,8 +2907,8 @@ class uo {
|
|
|
2850
2907
|
);
|
|
2851
2908
|
const d = this.reader.spine.layout$.pipe(
|
|
2852
2909
|
Se(10),
|
|
2853
|
-
|
|
2854
|
-
|
|
2910
|
+
ne(o),
|
|
2911
|
+
ln((g) => uo(g.meta, this.reader).pipe(
|
|
2855
2912
|
S((h) => ({
|
|
2856
2913
|
...g,
|
|
2857
2914
|
meta: h
|
|
@@ -2870,14 +2927,14 @@ class uo {
|
|
|
2870
2927
|
return Array.isArray(e) ? ct(
|
|
2871
2928
|
() => k(
|
|
2872
2929
|
e.map((i) => this.locate(i, t ?? {}))
|
|
2873
|
-
).pipe(
|
|
2930
|
+
).pipe(dn([]))
|
|
2874
2931
|
) : this.locate(e, t ?? {});
|
|
2875
2932
|
}
|
|
2876
2933
|
}
|
|
2877
|
-
const
|
|
2878
|
-
const t = n(e), { paginationInfo$: i, getPaginationInfo: o } =
|
|
2934
|
+
const po = (n) => (e) => {
|
|
2935
|
+
const t = n(e), { paginationInfo$: i, getPaginationInfo: o } = so(t);
|
|
2879
2936
|
i.pipe(T(t.$.destroy$)).subscribe();
|
|
2880
|
-
const s = new
|
|
2937
|
+
const s = new lo(t);
|
|
2881
2938
|
return {
|
|
2882
2939
|
...t,
|
|
2883
2940
|
locateResource: s.locateResource.bind(s),
|
|
@@ -2891,7 +2948,7 @@ const lo = (n) => (e) => {
|
|
|
2891
2948
|
}
|
|
2892
2949
|
}
|
|
2893
2950
|
};
|
|
2894
|
-
},
|
|
2951
|
+
}, go = (n) => ({
|
|
2895
2952
|
put: (s, r) => new Promise((a, c) => {
|
|
2896
2953
|
const u = n.transaction(["store"], "readwrite");
|
|
2897
2954
|
u.onerror = (g) => {
|
|
@@ -2943,16 +3000,16 @@ const lo = (n) => (e) => {
|
|
|
2943
3000
|
a(d);
|
|
2944
3001
|
};
|
|
2945
3002
|
})
|
|
2946
|
-
}),
|
|
3003
|
+
}), Ve = async (n) => new Promise((e, t) => {
|
|
2947
3004
|
const i = window.indexedDB.open(n);
|
|
2948
3005
|
i.onerror = (o) => {
|
|
2949
3006
|
t(o);
|
|
2950
3007
|
}, i.onsuccess = () => {
|
|
2951
|
-
e(
|
|
3008
|
+
e(go(i.result));
|
|
2952
3009
|
}, i.onupgradeneeded = () => {
|
|
2953
3010
|
i.result.createObjectStore("store");
|
|
2954
3011
|
};
|
|
2955
|
-
}),
|
|
3012
|
+
}), ho = (n) => {
|
|
2956
3013
|
let e = Date.now().toString();
|
|
2957
3014
|
const t = new R(), i = (c) => {
|
|
2958
3015
|
if (typeof c == "string" || typeof c == "object") {
|
|
@@ -2963,7 +3020,7 @@ const lo = (n) => (e) => {
|
|
|
2963
3020
|
}, o = async (c, u) => {
|
|
2964
3021
|
const l = i(c);
|
|
2965
3022
|
if (!l) return new Response("Item not found", { status: 404 });
|
|
2966
|
-
const g = await (await
|
|
3023
|
+
const g = await (await Ve("prose-reader")).get(`${e}_${l.id}`);
|
|
2967
3024
|
if (g)
|
|
2968
3025
|
return new Response(g, { status: 200 });
|
|
2969
3026
|
const h = u && await u(l) || await fetch(l.href);
|
|
@@ -2972,10 +3029,10 @@ const lo = (n) => (e) => {
|
|
|
2972
3029
|
t.next({ id: c, data: u });
|
|
2973
3030
|
};
|
|
2974
3031
|
t.asObservable().pipe(
|
|
2975
|
-
|
|
3032
|
+
wn(({ id: c, data: u }) => {
|
|
2976
3033
|
const l = i(c);
|
|
2977
3034
|
return l ? N(
|
|
2978
|
-
|
|
3035
|
+
pn([Ve("prose-reader"), N(u.blob())])
|
|
2979
3036
|
).pipe(
|
|
2980
3037
|
_(([d, g]) => N(d.put(`${e}_${l.id}`, g))),
|
|
2981
3038
|
rt((d) => (D.error(d), Z))
|
|
@@ -2988,8 +3045,8 @@ const lo = (n) => (e) => {
|
|
|
2988
3045
|
e = Date.now().toString();
|
|
2989
3046
|
})
|
|
2990
3047
|
);
|
|
2991
|
-
return
|
|
2992
|
-
_(() => (D.debug("Cleanup up old cache..."), N(
|
|
3048
|
+
return x(r).pipe(
|
|
3049
|
+
_(() => (D.debug("Cleanup up old cache..."), N(Ve("prose-reader")).pipe(
|
|
2993
3050
|
_(
|
|
2994
3051
|
(c) => N(c.keys()).pipe(
|
|
2995
3052
|
Q(
|
|
@@ -3010,8 +3067,8 @@ const lo = (n) => (e) => {
|
|
|
3010
3067
|
t.complete();
|
|
3011
3068
|
}
|
|
3012
3069
|
};
|
|
3013
|
-
},
|
|
3014
|
-
const t = n(e), i =
|
|
3070
|
+
}, mo = (n) => (e) => {
|
|
3071
|
+
const t = n(e), i = ho(t.context);
|
|
3015
3072
|
return {
|
|
3016
3073
|
...t,
|
|
3017
3074
|
// $: {
|
|
@@ -3023,7 +3080,7 @@ const lo = (n) => (e) => {
|
|
|
3023
3080
|
}
|
|
3024
3081
|
// load,
|
|
3025
3082
|
};
|
|
3026
|
-
},
|
|
3083
|
+
}, fo = (n, e) => {
|
|
3027
3084
|
const t = n.node.ownerDocument?.createRange(), i = n.node.compareDocumentPosition(e.node);
|
|
3028
3085
|
if (t) {
|
|
3029
3086
|
try {
|
|
@@ -3043,14 +3100,14 @@ const lo = (n) => (e) => {
|
|
|
3043
3100
|
}
|
|
3044
3101
|
return t;
|
|
3045
3102
|
}
|
|
3046
|
-
},
|
|
3103
|
+
}, yo = ({
|
|
3047
3104
|
selection: n,
|
|
3048
3105
|
spineItem: e
|
|
3049
3106
|
}) => {
|
|
3050
3107
|
const { anchorNode: t, anchorOffset: i, focusNode: o, focusOffset: s } = n;
|
|
3051
3108
|
if (!(!t || !o))
|
|
3052
3109
|
try {
|
|
3053
|
-
return
|
|
3110
|
+
return fo(
|
|
3054
3111
|
{ node: t, offset: i },
|
|
3055
3112
|
{ node: o, offset: s }
|
|
3056
3113
|
);
|
|
@@ -3062,7 +3119,7 @@ const lo = (n) => (e) => {
|
|
|
3062
3119
|
return;
|
|
3063
3120
|
}
|
|
3064
3121
|
};
|
|
3065
|
-
class
|
|
3122
|
+
class So extends X {
|
|
3066
3123
|
constructor(e) {
|
|
3067
3124
|
super();
|
|
3068
3125
|
const t = e.contentDocument || e.contentWindow?.document;
|
|
@@ -3085,16 +3142,16 @@ class yo extends X {
|
|
|
3085
3142
|
)
|
|
3086
3143
|
)
|
|
3087
3144
|
) : v(null);
|
|
3088
|
-
this.selectionChange$ =
|
|
3145
|
+
this.selectionChange$ = x(
|
|
3089
3146
|
q(t, "selectionchange"),
|
|
3090
3147
|
i
|
|
3091
3148
|
).pipe(
|
|
3092
3149
|
S(() => t.getSelection()),
|
|
3093
|
-
T(
|
|
3150
|
+
T(x(o, this.destroy$)),
|
|
3094
3151
|
me(null)
|
|
3095
3152
|
), this.selectionOver$ = q(t, "pointerdown").pipe(
|
|
3096
3153
|
w(
|
|
3097
|
-
() =>
|
|
3154
|
+
() => x(
|
|
3098
3155
|
q(t, "pointerup"),
|
|
3099
3156
|
q(t, "pointercancel"),
|
|
3100
3157
|
q(t, "contextmenu")
|
|
@@ -3112,17 +3169,17 @@ class yo extends X {
|
|
|
3112
3169
|
L(J)
|
|
3113
3170
|
)
|
|
3114
3171
|
),
|
|
3115
|
-
T(
|
|
3172
|
+
T(x(o, this.destroy$))
|
|
3116
3173
|
);
|
|
3117
3174
|
}
|
|
3118
3175
|
}
|
|
3119
3176
|
}
|
|
3120
|
-
const
|
|
3177
|
+
const bo = (n) => n.watch("isLoaded").pipe(
|
|
3121
3178
|
w(() => {
|
|
3122
3179
|
const e = n.renderer.getDocumentFrame(), t = e?.contentDocument || e?.contentWindow?.document;
|
|
3123
3180
|
if (!e || !t) return ge;
|
|
3124
|
-
const i = new
|
|
3125
|
-
return
|
|
3181
|
+
const i = new So(e);
|
|
3182
|
+
return x(
|
|
3126
3183
|
i.selectionChange$.pipe(
|
|
3127
3184
|
S((o) => {
|
|
3128
3185
|
if (o?.toString())
|
|
@@ -3148,14 +3205,14 @@ const So = (n) => n.watch("isLoaded").pipe(
|
|
|
3148
3205
|
);
|
|
3149
3206
|
}),
|
|
3150
3207
|
z()
|
|
3151
|
-
),
|
|
3208
|
+
), Io = (n) => (e) => {
|
|
3152
3209
|
const t = n(e);
|
|
3153
3210
|
let i;
|
|
3154
3211
|
const o = t.spineItemsManager.items$.pipe(
|
|
3155
3212
|
w((l) => {
|
|
3156
3213
|
const d = l.map((g) => {
|
|
3157
3214
|
const h = t.spineItemsManager.getSpineItemIndex(g) ?? 0;
|
|
3158
|
-
return
|
|
3215
|
+
return bo(g).pipe(
|
|
3159
3216
|
S((p) => {
|
|
3160
3217
|
if (p)
|
|
3161
3218
|
return {
|
|
@@ -3165,11 +3222,11 @@ const So = (n) => n.watch("isLoaded").pipe(
|
|
|
3165
3222
|
})
|
|
3166
3223
|
);
|
|
3167
3224
|
});
|
|
3168
|
-
return
|
|
3225
|
+
return x(...d);
|
|
3169
3226
|
}),
|
|
3170
|
-
|
|
3227
|
+
ne(void 0),
|
|
3171
3228
|
z(),
|
|
3172
|
-
|
|
3229
|
+
P((l) => {
|
|
3173
3230
|
i = l;
|
|
3174
3231
|
}),
|
|
3175
3232
|
K({ refCount: !0, bufferSize: 1 })
|
|
@@ -3191,10 +3248,10 @@ const So = (n) => n.watch("isLoaded").pipe(
|
|
|
3191
3248
|
w((l) => q(l, "pointerdown")),
|
|
3192
3249
|
O(s),
|
|
3193
3250
|
S(([, l]) => l),
|
|
3194
|
-
|
|
3251
|
+
ne(void 0),
|
|
3195
3252
|
K({ refCount: !0, bufferSize: 1 })
|
|
3196
3253
|
);
|
|
3197
|
-
return
|
|
3254
|
+
return x(s, u).pipe(T(t.$.destroy$)).subscribe(), {
|
|
3198
3255
|
...t,
|
|
3199
3256
|
selection: {
|
|
3200
3257
|
selection$: s,
|
|
@@ -3203,7 +3260,7 @@ const So = (n) => n.watch("isLoaded").pipe(
|
|
|
3203
3260
|
selectionOver$: c,
|
|
3204
3261
|
lastSelectionOnPointerdown$: u,
|
|
3205
3262
|
getSelection: () => i,
|
|
3206
|
-
createOrderedRangeFromSelection:
|
|
3263
|
+
createOrderedRangeFromSelection: yo
|
|
3207
3264
|
}
|
|
3208
3265
|
};
|
|
3209
3266
|
}, ht = [
|
|
@@ -3221,7 +3278,7 @@ const So = (n) => n.watch("isLoaded").pipe(
|
|
|
3221
3278
|
backgroundColor: "#191717",
|
|
3222
3279
|
foregroundColor: "#f1ebeb"
|
|
3223
3280
|
}
|
|
3224
|
-
],
|
|
3281
|
+
], vo = (n) => (e) => {
|
|
3225
3282
|
const t = n(e), i = new H(
|
|
3226
3283
|
e.theme ?? "bright"
|
|
3227
3284
|
), o = () => {
|
|
@@ -3253,14 +3310,14 @@ const So = (n) => n.watch("isLoaded").pipe(
|
|
|
3253
3310
|
}, r = () => {
|
|
3254
3311
|
t.spineItemsManager.items.forEach((a) => {
|
|
3255
3312
|
const c = a.renderer.getDocumentFrame();
|
|
3256
|
-
c &&
|
|
3313
|
+
c && ie(c, "prose-reader-theme", o()), s({ container: a.element });
|
|
3257
3314
|
});
|
|
3258
3315
|
};
|
|
3259
3316
|
return t.hookManager.register("item.onDocumentLoad", ({ itemId: a }) => {
|
|
3260
3317
|
const c = t.spineItemsManager.get(a);
|
|
3261
3318
|
if (c?.renditionLayout !== "pre-paginated") {
|
|
3262
3319
|
const u = c?.renderer.getDocumentFrame();
|
|
3263
|
-
u &&
|
|
3320
|
+
u && ie(u, "prose-reader-theme", o());
|
|
3264
3321
|
}
|
|
3265
3322
|
}), t.spineItemsManager.items$.pipe(
|
|
3266
3323
|
j(
|
|
@@ -3286,65 +3343,55 @@ const So = (n) => n.watch("isLoaded").pipe(
|
|
|
3286
3343
|
}
|
|
3287
3344
|
}
|
|
3288
3345
|
};
|
|
3289
|
-
},
|
|
3290
|
-
|
|
3291
|
-
|
|
3292
|
-
|
|
3293
|
-
|
|
3294
|
-
|
|
3346
|
+
}, wo = (n) => (e) => {
|
|
3347
|
+
const t = n(e);
|
|
3348
|
+
return {
|
|
3349
|
+
...t,
|
|
3350
|
+
utils: {
|
|
3351
|
+
isOrIsWithinValidLink: (s) => !!(Ot(s) && (s.nodeName === "a" ? s : s.closest("a"))?.getAttribute("href")),
|
|
3352
|
+
injectScopedCSS: (s, r, a) => {
|
|
3353
|
+
const c = a.replace("${id}", t.id);
|
|
3354
|
+
return Ee(s, `${r}-${t.id}`, c);
|
|
3355
|
+
}
|
|
3356
|
+
}
|
|
3357
|
+
};
|
|
3358
|
+
};
|
|
3295
3359
|
navigator.userAgent.indexOf("") > -1 && navigator.userAgent.indexOf("Chrome") <= -1;
|
|
3296
|
-
const
|
|
3297
|
-
|
|
3298
|
-
|
|
3299
|
-
|
|
3300
|
-
|
|
3301
|
-
|
|
3302
|
-
|
|
3303
|
-
|
|
3304
|
-
|
|
3305
|
-
|
|
3306
|
-
|
|
3307
|
-
|
|
3308
|
-
const t = { ...this.value, ...e };
|
|
3309
|
-
V(this.value, t) || this.stateSubject.next(t);
|
|
3310
|
-
}
|
|
3311
|
-
watch(e) {
|
|
3312
|
-
return Array.isArray(e) ? this.stateSubject.pipe(Qe(e)) : this.stateSubject.pipe(
|
|
3313
|
-
S((t) => t[e]),
|
|
3314
|
-
z(V)
|
|
3315
|
-
);
|
|
3316
|
-
}
|
|
3317
|
-
get value() {
|
|
3318
|
-
return this.stateSubject.value;
|
|
3319
|
-
}
|
|
3320
|
-
destroy() {
|
|
3321
|
-
this.stateSubject.complete(), this._destroy$.complete();
|
|
3322
|
-
}
|
|
3323
|
-
}
|
|
3324
|
-
const xo = (n, e, t) => {
|
|
3360
|
+
const xo = (n) => (e) => n(e), Po = "[data-prose-reader-scroll-navigator][data-prose-reader-zooming=true]{overflow:scroll}[data-prose-reader-scroll-navigator][data-prose-reader-zooming=true][data-prose-reader-zooming-direction=down]{overflow-x:auto}", mt = (n, e, t) => {
|
|
3361
|
+
const { clientWidth: i, clientHeight: o } = t.value.element, s = {
|
|
3362
|
+
maxX: 0,
|
|
3363
|
+
minX: i * (1 - e),
|
|
3364
|
+
maxY: 0,
|
|
3365
|
+
minY: o * (1 - e)
|
|
3366
|
+
};
|
|
3367
|
+
return {
|
|
3368
|
+
x: Math.min(Math.max(n.x, s.minX), s.maxX),
|
|
3369
|
+
y: Math.min(Math.max(n.y, s.minY), s.maxY)
|
|
3370
|
+
};
|
|
3371
|
+
}, $o = (n, e, t) => {
|
|
3325
3372
|
t.style.transformOrigin = "0 0";
|
|
3326
3373
|
const i = `translate3d(${e.x}px, ${e.y}px, 0px)`, o = `scale(${n})`;
|
|
3327
3374
|
t.style.transform = `${i} ${o}`;
|
|
3328
|
-
},
|
|
3375
|
+
}, To = (n, e, t, i) => {
|
|
3329
3376
|
const o = e / n, s = t.clientWidth, r = t.clientHeight, a = s / 2 - i.x, c = r / 2 - i.y;
|
|
3330
3377
|
return {
|
|
3331
3378
|
x: i.x + a * (1 - o),
|
|
3332
3379
|
y: i.y + c * (1 - o)
|
|
3333
3380
|
};
|
|
3334
3381
|
};
|
|
3335
|
-
class
|
|
3382
|
+
class qt {
|
|
3336
3383
|
constructor(e) {
|
|
3337
3384
|
this.x = e.x, this.y = e.y;
|
|
3338
3385
|
}
|
|
3339
3386
|
}
|
|
3340
|
-
class
|
|
3387
|
+
class ft extends qt {
|
|
3341
3388
|
}
|
|
3342
|
-
class
|
|
3389
|
+
class Fo extends qt {
|
|
3343
3390
|
constructor() {
|
|
3344
|
-
super(...arguments), this.__symbol = Symbol("UnboundScrollPosition");
|
|
3391
|
+
super(...arguments), this.__symbol = /* @__PURE__ */ Symbol("UnboundScrollPosition");
|
|
3345
3392
|
}
|
|
3346
3393
|
}
|
|
3347
|
-
class
|
|
3394
|
+
class Lo extends se {
|
|
3348
3395
|
constructor(e, t, i, o, s) {
|
|
3349
3396
|
super({
|
|
3350
3397
|
element: void 0
|
|
@@ -3359,33 +3406,33 @@ class Fo extends ue {
|
|
|
3359
3406
|
top: h.y,
|
|
3360
3407
|
behavior: "instant"
|
|
3361
3408
|
}), Te(1).pipe(
|
|
3362
|
-
|
|
3409
|
+
P(() => {
|
|
3363
3410
|
this.scrollingSubject.next(!1);
|
|
3364
3411
|
}),
|
|
3365
|
-
T(
|
|
3412
|
+
T(x(this.scrollingSubject.pipe(Lt(1)), this.destroy$))
|
|
3366
3413
|
).subscribe(), this.hookManager.execute("onViewportOffsetAdjust", void 0, {});
|
|
3367
3414
|
};
|
|
3368
3415
|
const r = this.context.pipe(
|
|
3369
3416
|
Qe(["rootElement"]),
|
|
3370
|
-
|
|
3417
|
+
P(({ rootElement: d }) => {
|
|
3371
3418
|
if (!d) return;
|
|
3372
3419
|
const g = document.createElement("div");
|
|
3373
|
-
g.setAttribute(`data-${
|
|
3420
|
+
g.setAttribute(`data-${ri}`, ""), g.appendChild(this.viewport.value.element), d.appendChild(g), this.update({ element: g });
|
|
3374
3421
|
})
|
|
3375
3422
|
), a = k([
|
|
3376
3423
|
t.watch(["computedPageTurnMode"]),
|
|
3377
3424
|
this.watch("element")
|
|
3378
3425
|
]).pipe(
|
|
3379
|
-
|
|
3426
|
+
P(([{ computedPageTurnMode: d }, g]) => {
|
|
3380
3427
|
g && (d === "scrollable" ? g.style.display = "block" : g.style.display = "contents");
|
|
3381
3428
|
})
|
|
3382
|
-
), c = this.navigateSubject.pipe(
|
|
3429
|
+
), c = this.navigateSubject.pipe(P(this.setViewportPosition));
|
|
3383
3430
|
this.isNavigating$ = this.navigateSubject.pipe(
|
|
3384
|
-
|
|
3385
|
-
w(() =>
|
|
3431
|
+
ne(!1),
|
|
3432
|
+
w(() => x(v(!0), v(!1))),
|
|
3386
3433
|
K(1)
|
|
3387
3434
|
);
|
|
3388
|
-
const u =
|
|
3435
|
+
const u = x(
|
|
3389
3436
|
o.element$.pipe(
|
|
3390
3437
|
L(J),
|
|
3391
3438
|
w((d) => et(d))
|
|
@@ -3399,11 +3446,11 @@ class Fo extends ue {
|
|
|
3399
3446
|
w(
|
|
3400
3447
|
() => Te(10).pipe(
|
|
3401
3448
|
S(() => !1),
|
|
3402
|
-
|
|
3449
|
+
ne(!0)
|
|
3403
3450
|
)
|
|
3404
3451
|
),
|
|
3405
3452
|
z(),
|
|
3406
|
-
|
|
3453
|
+
ne(!1)
|
|
3407
3454
|
), l = k([
|
|
3408
3455
|
u,
|
|
3409
3456
|
this.isScrolling$
|
|
@@ -3429,7 +3476,7 @@ class Fo extends ue {
|
|
|
3429
3476
|
)
|
|
3430
3477
|
),
|
|
3431
3478
|
E()
|
|
3432
|
-
),
|
|
3479
|
+
), x(r, a, c).pipe(T(this.destroy$)).subscribe();
|
|
3433
3480
|
}
|
|
3434
3481
|
update(e) {
|
|
3435
3482
|
this.mergeCompare(e);
|
|
@@ -3439,48 +3486,52 @@ class Fo extends ue {
|
|
|
3439
3486
|
}
|
|
3440
3487
|
fromScrollPosition(e) {
|
|
3441
3488
|
const t = this.viewport.scaleFactor;
|
|
3442
|
-
return new
|
|
3489
|
+
return new ue({
|
|
3443
3490
|
x: e.x / t,
|
|
3444
3491
|
y: e.y / t
|
|
3445
3492
|
});
|
|
3446
3493
|
}
|
|
3447
3494
|
fromSpinePosition(e) {
|
|
3448
3495
|
const t = this.viewport.scaleFactor;
|
|
3449
|
-
return new
|
|
3496
|
+
return new ft({
|
|
3450
3497
|
x: e.x * t,
|
|
3451
3498
|
y: e.y * t
|
|
3452
3499
|
});
|
|
3453
3500
|
}
|
|
3454
3501
|
get scrollPosition() {
|
|
3455
3502
|
const e = this.value.element;
|
|
3456
|
-
return new
|
|
3503
|
+
return new ft({
|
|
3457
3504
|
x: e?.scrollLeft ?? 0,
|
|
3458
3505
|
y: e?.scrollTop ?? 0
|
|
3459
3506
|
});
|
|
3460
3507
|
}
|
|
3461
3508
|
}
|
|
3462
|
-
const
|
|
3509
|
+
const Mo = (n, e, t, i, o) => {
|
|
3463
3510
|
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, h = l * d, p = g - s / 2 + i, m = h - r / 2 + o;
|
|
3464
|
-
return new
|
|
3511
|
+
return new Fo({
|
|
3465
3512
|
x: p,
|
|
3466
3513
|
y: m
|
|
3467
3514
|
});
|
|
3468
|
-
},
|
|
3469
|
-
const t = e.viewport, i = e.navigation.scrollNavigationController, o = t.value.element, s = i.value.element, r = i.value.element, a = Math.round(t.scaleFactor * 100) / 100, c = o.offsetLeft, u = o.offsetTop, l =
|
|
3470
|
-
s ??
|
|
3515
|
+
}, Co = (n, e) => {
|
|
3516
|
+
const t = e.viewport, i = e.navigation.scrollNavigationController, o = t.value.element, s = i.value.element, r = i.value.element, a = Math.round(t.scaleFactor * 100) / 100, c = o.offsetLeft, u = o.offsetTop, l = Mo(
|
|
3517
|
+
s ?? An(),
|
|
3471
3518
|
a,
|
|
3472
3519
|
n,
|
|
3473
3520
|
c,
|
|
3474
3521
|
u
|
|
3475
3522
|
), d = n < 1 ? "down" : "up";
|
|
3476
|
-
|
|
3523
|
+
r?.setAttribute(
|
|
3477
3524
|
`data-${W}-zooming-direction`,
|
|
3478
3525
|
d
|
|
3479
|
-
), n < 1 ? o.style.transformOrigin = "top" : n > 1 && (o.style.transformOrigin = `${c}px ${u}px`), o.style.transform = `scale(${n})
|
|
3526
|
+
), n < 1 ? o.style.transformOrigin = "top" : n > 1 && (o.style.transformOrigin = `${c}px ${u}px`), o.style.transform = `scale(${n})`;
|
|
3527
|
+
const g = i.fromScrollPosition(
|
|
3480
3528
|
l
|
|
3481
3529
|
);
|
|
3530
|
+
e.navigation.navigate({
|
|
3531
|
+
position: g
|
|
3532
|
+
});
|
|
3482
3533
|
}, ve = 200;
|
|
3483
|
-
class
|
|
3534
|
+
class Eo extends se {
|
|
3484
3535
|
constructor(e) {
|
|
3485
3536
|
super({
|
|
3486
3537
|
isZooming: !1,
|
|
@@ -3501,7 +3552,7 @@ class Co extends ue {
|
|
|
3501
3552
|
currentScale: 1,
|
|
3502
3553
|
currentPosition: { x: 0, y: 0 }
|
|
3503
3554
|
}), this.updateZoom(s), s !== 1 && this.isControlled ? Te(o?.animate ? ve : 0).pipe(
|
|
3504
|
-
|
|
3555
|
+
P(() => {
|
|
3505
3556
|
this.reader.layout();
|
|
3506
3557
|
})
|
|
3507
3558
|
) : Z;
|
|
@@ -3517,18 +3568,18 @@ class Co extends ue {
|
|
|
3517
3568
|
), this.scrollNavigationController.value.element?.setAttribute(
|
|
3518
3569
|
`data-${W}-zooming`,
|
|
3519
3570
|
"false"
|
|
3520
|
-
), o?.animate && this.isControlled && (s.style.transition = `transform ${ve}ms`), this.updateZoom(1, { x: 0, y: 0 }), s.style.transform = "",
|
|
3521
|
-
|
|
3571
|
+
), o?.animate && this.isControlled && (s.style.transition = `transform ${ve}ms`), this.updateZoom(1, { x: 0, y: 0 }), s.style.transform = "", this.mergeCompare({
|
|
3572
|
+
isZooming: !1
|
|
3573
|
+
}), Te(o?.animate ? ve : 0).pipe(
|
|
3574
|
+
P(() => {
|
|
3522
3575
|
const r = this.reader.viewport.value.element;
|
|
3523
|
-
r.style.transformOrigin = "", r.style.transition = "", this.isControlled && this.reader.layout()
|
|
3524
|
-
isZooming: !1
|
|
3525
|
-
});
|
|
3576
|
+
r.style.transformOrigin = "", r.style.transition = "", this.isControlled && this.reader.layout();
|
|
3526
3577
|
}),
|
|
3527
3578
|
T(this.enterSubject)
|
|
3528
3579
|
);
|
|
3529
3580
|
})
|
|
3530
3581
|
);
|
|
3531
|
-
|
|
3582
|
+
x(t, i).pipe(T(this.destroy$)).subscribe();
|
|
3532
3583
|
}
|
|
3533
3584
|
enter(e) {
|
|
3534
3585
|
this.enterSubject.next(e);
|
|
@@ -3536,25 +3587,29 @@ class Co extends ue {
|
|
|
3536
3587
|
exit(e) {
|
|
3537
3588
|
this.exitSubject.next(e);
|
|
3538
3589
|
}
|
|
3539
|
-
move(e) {
|
|
3540
|
-
this.isControlled && (this.viewport.element.style.transition = "", this.updateZoom(this.value.currentScale, e
|
|
3590
|
+
move(e, t) {
|
|
3591
|
+
this.isControlled && (this.viewport.element.style.transition = "", this.updateZoom(this.value.currentScale, e, {
|
|
3592
|
+
constraints: t?.constrain === "within-viewport" ? (...i) => mt(...i, this.reader.viewport) : void 0
|
|
3593
|
+
}));
|
|
3541
3594
|
}
|
|
3542
|
-
scaleAt(e) {
|
|
3595
|
+
scaleAt(e, t) {
|
|
3543
3596
|
this.viewport.element.style.transition = "";
|
|
3544
|
-
const
|
|
3545
|
-
this.updateZoom(
|
|
3597
|
+
const o = Math.ceil(e * 100) / 100;
|
|
3598
|
+
this.updateZoom(o, void 0, {
|
|
3599
|
+
constraints: t?.constrain === "within-viewport" ? (...s) => mt(...s, this.reader.viewport) : void 0
|
|
3600
|
+
});
|
|
3546
3601
|
}
|
|
3547
|
-
updateZoom(e, t) {
|
|
3602
|
+
updateZoom(e, t, i) {
|
|
3548
3603
|
if (this.isControlled) {
|
|
3549
|
-
const
|
|
3604
|
+
const o = t || To(
|
|
3550
3605
|
this.value.currentScale,
|
|
3551
3606
|
e,
|
|
3552
3607
|
this.viewport.element,
|
|
3553
3608
|
this.value.currentPosition
|
|
3554
|
-
);
|
|
3555
|
-
return this.applyZoom(e,
|
|
3609
|
+
), s = i?.constraints?.(o, e) ?? o;
|
|
3610
|
+
return this.applyZoom(e, s), this.mergeCompare({
|
|
3556
3611
|
currentScale: e,
|
|
3557
|
-
currentPosition:
|
|
3612
|
+
currentPosition: s
|
|
3558
3613
|
});
|
|
3559
3614
|
}
|
|
3560
3615
|
this.applyZoom(e, t ?? this.value.currentPosition), this.mergeCompare({
|
|
@@ -3562,18 +3617,11 @@ class Co extends ue {
|
|
|
3562
3617
|
});
|
|
3563
3618
|
}
|
|
3564
3619
|
applyZoom(e, t) {
|
|
3565
|
-
|
|
3566
|
-
|
|
3567
|
-
|
|
3568
|
-
|
|
3569
|
-
|
|
3570
|
-
);
|
|
3571
|
-
else {
|
|
3572
|
-
const i = Mo(e, this.reader);
|
|
3573
|
-
this.reader.navigation.navigate({
|
|
3574
|
-
position: i
|
|
3575
|
-
});
|
|
3576
|
-
}
|
|
3620
|
+
this.isControlled ? $o(
|
|
3621
|
+
e,
|
|
3622
|
+
t,
|
|
3623
|
+
this.viewport.element
|
|
3624
|
+
) : Co(e, this.reader);
|
|
3577
3625
|
}
|
|
3578
3626
|
get isControlled() {
|
|
3579
3627
|
return this.reader.settings.values.computedPageTurnMode === "controlled";
|
|
@@ -3585,11 +3633,11 @@ class Co extends ue {
|
|
|
3585
3633
|
return this.reader.viewport.value;
|
|
3586
3634
|
}
|
|
3587
3635
|
}
|
|
3588
|
-
const
|
|
3589
|
-
const t = n(e), i = new
|
|
3590
|
-
|
|
3636
|
+
const yt = `${Ut}-enhancer-zoom`, Do = (n) => (e) => {
|
|
3637
|
+
const t = n(e), i = new Eo(t);
|
|
3638
|
+
Ee(document, yt, Po);
|
|
3591
3639
|
const o = () => {
|
|
3592
|
-
|
|
3640
|
+
De(document, yt), i.destroy(), t.destroy();
|
|
3593
3641
|
}, s = i;
|
|
3594
3642
|
return {
|
|
3595
3643
|
...t,
|
|
@@ -3605,8 +3653,8 @@ const ft = `${kt}-enhancer-zoom`, Eo = (n) => (e) => {
|
|
|
3605
3653
|
}
|
|
3606
3654
|
}
|
|
3607
3655
|
};
|
|
3608
|
-
},
|
|
3609
|
-
class
|
|
3656
|
+
}, Gt = (n) => n?.renditionLayout === "pre-paginated" || n?.spineItems.every((e) => e.renditionLayout === "pre-paginated");
|
|
3657
|
+
class Ro {
|
|
3610
3658
|
constructor() {
|
|
3611
3659
|
this.navigationSubject = new ot(1), this.viewportStateSubject = new H("free"), this.paginationSubject = new ot(), this.navigationIsLockedSubject = new H(!1), this.pagination$ = this.paginationSubject.asObservable(), this.navigationUnlocked$ = this.navigationIsLockedSubject.pipe(
|
|
3612
3660
|
z(),
|
|
@@ -3618,13 +3666,13 @@ class Do {
|
|
|
3618
3666
|
), this.navigation$ = this.navigationSubject.asObservable();
|
|
3619
3667
|
}
|
|
3620
3668
|
}
|
|
3621
|
-
class
|
|
3669
|
+
class Ao extends se {
|
|
3622
3670
|
constructor() {
|
|
3623
3671
|
super({
|
|
3624
3672
|
assumedRenditionLayout: "reflowable"
|
|
3625
|
-
}), this.bridgeEvent = new
|
|
3673
|
+
}), this.bridgeEvent = new Ro(), this.manifest$ = this.pipe(
|
|
3626
3674
|
Q((e) => e.manifest),
|
|
3627
|
-
|
|
3675
|
+
ae(J),
|
|
3628
3676
|
pe()
|
|
3629
3677
|
), this.isRTL = () => this.value.manifest?.readingDirection === "rtl";
|
|
3630
3678
|
}
|
|
@@ -3633,7 +3681,7 @@ class Ro extends ue {
|
|
|
3633
3681
|
...t,
|
|
3634
3682
|
...e,
|
|
3635
3683
|
...e.manifest && {
|
|
3636
|
-
isFullyPrePaginated:
|
|
3684
|
+
isFullyPrePaginated: Gt(i),
|
|
3637
3685
|
assumedRenditionLayout: i?.renditionLayout ?? "reflowable"
|
|
3638
3686
|
}
|
|
3639
3687
|
};
|
|
@@ -3646,7 +3694,7 @@ class Ro extends ue {
|
|
|
3646
3694
|
return this.manifest?.readingDirection;
|
|
3647
3695
|
}
|
|
3648
3696
|
}
|
|
3649
|
-
class
|
|
3697
|
+
class Oo extends se {
|
|
3650
3698
|
constructor(e, t) {
|
|
3651
3699
|
super({
|
|
3652
3700
|
supportedPageTurnAnimation: ["fade", "none", "slide"],
|
|
@@ -3681,7 +3729,7 @@ class Ao extends ue {
|
|
|
3681
3729
|
).subscribe(this.next.bind(this));
|
|
3682
3730
|
}
|
|
3683
3731
|
}
|
|
3684
|
-
class
|
|
3732
|
+
class No {
|
|
3685
3733
|
constructor() {
|
|
3686
3734
|
this._hooks = [], this._hookExecutions = [];
|
|
3687
3735
|
}
|
|
@@ -3743,17 +3791,17 @@ class Oo {
|
|
|
3743
3791
|
return k(s);
|
|
3744
3792
|
}
|
|
3745
3793
|
}
|
|
3746
|
-
const
|
|
3794
|
+
const Vo = "[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%}", jo = (n) => ({
|
|
3747
3795
|
x: -n.x,
|
|
3748
3796
|
y: -n.y
|
|
3749
|
-
}),
|
|
3797
|
+
}), ko = (n) => n instanceof DOMMatrix ? new M({
|
|
3750
3798
|
x: -n.e,
|
|
3751
3799
|
y: -n.f
|
|
3752
3800
|
}) : new M({
|
|
3753
3801
|
x: -n.x,
|
|
3754
3802
|
y: -n.y
|
|
3755
|
-
}),
|
|
3756
|
-
class
|
|
3803
|
+
}), Uo = "navigation/ViewportNavigator", St = D.namespace(Uo);
|
|
3804
|
+
class zo extends X {
|
|
3757
3805
|
constructor(e, t, i, o, s) {
|
|
3758
3806
|
super(), this.settings = e, this.hookManager = t, this.context = i, this.spine = o, this.viewport = s, this.navigateSubject = new R(), this.element$ = new H(
|
|
3759
3807
|
document.createElement("div")
|
|
@@ -3761,7 +3809,7 @@ class Uo extends X {
|
|
|
3761
3809
|
const r = this.spine.element$.pipe(
|
|
3762
3810
|
L(J),
|
|
3763
3811
|
O(this.element$),
|
|
3764
|
-
|
|
3812
|
+
P(([l, d]) => {
|
|
3765
3813
|
d.style.cssText = `
|
|
3766
3814
|
height: 100%;
|
|
3767
3815
|
width: 100%;
|
|
@@ -3776,19 +3824,19 @@ class Uo extends X {
|
|
|
3776
3824
|
a,
|
|
3777
3825
|
this.element$
|
|
3778
3826
|
]).pipe(
|
|
3779
|
-
|
|
3827
|
+
P(([, l]) => {
|
|
3780
3828
|
e.values.computedPageTurnMode === "scrollable" ? l.style.display = "contents" : l.style.display = "block";
|
|
3781
3829
|
})
|
|
3782
3830
|
);
|
|
3783
3831
|
this.layout$ = c.pipe(
|
|
3784
|
-
|
|
3785
|
-
|
|
3832
|
+
P(() => {
|
|
3833
|
+
St.info("layout", e.values);
|
|
3786
3834
|
}),
|
|
3787
3835
|
E()
|
|
3788
3836
|
);
|
|
3789
3837
|
const u = this.navigateSubject.pipe(
|
|
3790
|
-
|
|
3791
|
-
|
|
3838
|
+
P((l) => {
|
|
3839
|
+
St.info("Navigation requested", l);
|
|
3792
3840
|
})
|
|
3793
3841
|
);
|
|
3794
3842
|
this.isNavigating$ = u.pipe(
|
|
@@ -3800,7 +3848,7 @@ class Uo extends X {
|
|
|
3800
3848
|
})),
|
|
3801
3849
|
w((l) => {
|
|
3802
3850
|
const d = this.element$.getValue();
|
|
3803
|
-
return d.style.setProperty("transition", "none"), d.style.setProperty("opacity", "1"),
|
|
3851
|
+
return d.style.setProperty("transition", "none"), d.style.setProperty("opacity", "1"), x(
|
|
3804
3852
|
v(!0),
|
|
3805
3853
|
v(null).pipe(
|
|
3806
3854
|
$e(() => {
|
|
@@ -3815,8 +3863,8 @@ class Uo extends X {
|
|
|
3815
3863
|
* anything for x ms while we effectively adjust. We want it to be immediate.
|
|
3816
3864
|
* However when user is repeatedly turning page, we can improve smoothness by delaying a bit the adjustment
|
|
3817
3865
|
*/
|
|
3818
|
-
l.shouldAnimate ? we(1,
|
|
3819
|
-
|
|
3866
|
+
l.shouldAnimate ? we(1, ce) : xe,
|
|
3867
|
+
P((p) => {
|
|
3820
3868
|
const m = this.element$.getValue();
|
|
3821
3869
|
p.shouldAnimate ? h === "fade" ? (m.style.setProperty(
|
|
3822
3870
|
"transition",
|
|
@@ -3834,16 +3882,16 @@ class Uo extends X {
|
|
|
3834
3882
|
* need to adjust to anchor to the payload position. This is because we use viewport computed position,
|
|
3835
3883
|
* not the value set by `setProperty`
|
|
3836
3884
|
*/
|
|
3837
|
-
|
|
3885
|
+
P((p) => {
|
|
3838
3886
|
h !== "fade" && this.setViewportPosition(p.position);
|
|
3839
3887
|
}),
|
|
3840
|
-
l.shouldAnimate ? we(g / 2,
|
|
3841
|
-
|
|
3888
|
+
l.shouldAnimate ? we(g / 2, ce) : xe,
|
|
3889
|
+
P((p) => {
|
|
3842
3890
|
const m = this.element$.getValue();
|
|
3843
3891
|
h === "fade" && (this.setViewportPosition(p.position), m.style.setProperty("opacity", "1"));
|
|
3844
3892
|
}),
|
|
3845
|
-
l.shouldAnimate ? we(g / 2,
|
|
3846
|
-
|
|
3893
|
+
l.shouldAnimate ? we(g / 2, ce) : xe,
|
|
3894
|
+
P((p) => {
|
|
3847
3895
|
h === "fade" && this.setViewportPosition(p.position);
|
|
3848
3896
|
})
|
|
3849
3897
|
);
|
|
@@ -3852,9 +3900,9 @@ class Uo extends X {
|
|
|
3852
3900
|
)
|
|
3853
3901
|
);
|
|
3854
3902
|
}),
|
|
3855
|
-
|
|
3903
|
+
ne(!1),
|
|
3856
3904
|
K(1)
|
|
3857
|
-
),
|
|
3905
|
+
), x(r, this.isNavigating$, this.layout$).pipe(T(this.destroy$)).subscribe();
|
|
3858
3906
|
}
|
|
3859
3907
|
/**
|
|
3860
3908
|
* Programmatically set the viewport position.
|
|
@@ -3865,7 +3913,7 @@ class Uo extends X {
|
|
|
3865
3913
|
* for remark about flicker / fonts smoothing
|
|
3866
3914
|
*/
|
|
3867
3915
|
setViewportPosition(e) {
|
|
3868
|
-
const t = this.element$.getValue(), i =
|
|
3916
|
+
const t = this.element$.getValue(), i = jo(e);
|
|
3869
3917
|
t.style.transform = `translate(${i.x}px, ${i.y}px)`, this.hookManager.execute("onViewportOffsetAdjust", void 0, {});
|
|
3870
3918
|
}
|
|
3871
3919
|
navigate(e) {
|
|
@@ -3880,10 +3928,10 @@ class Uo extends X {
|
|
|
3880
3928
|
if (!i || i === "none")
|
|
3881
3929
|
return new M({ x: 0, y: 0 });
|
|
3882
3930
|
const o = new DOMMatrix(i);
|
|
3883
|
-
return
|
|
3931
|
+
return ko(o);
|
|
3884
3932
|
}
|
|
3885
3933
|
}
|
|
3886
|
-
const
|
|
3934
|
+
const Wo = () => (n) => n.pipe(
|
|
3887
3935
|
S(({ navigation: e, pagination: t, ...i }) => ({
|
|
3888
3936
|
navigation: {
|
|
3889
3937
|
...e,
|
|
@@ -3891,7 +3939,7 @@ const zo = () => (n) => n.pipe(
|
|
|
3891
3939
|
},
|
|
3892
3940
|
...i
|
|
3893
3941
|
}))
|
|
3894
|
-
),
|
|
3942
|
+
), _o = (n, e, t) => n.bridgeEvent.pagination$.pipe(
|
|
3895
3943
|
O(e),
|
|
3896
3944
|
L(
|
|
3897
3945
|
([i, o]) => i.navigationId === o.id
|
|
@@ -3908,7 +3956,7 @@ const zo = () => (n) => n.pipe(
|
|
|
3908
3956
|
navigation: o
|
|
3909
3957
|
}))
|
|
3910
3958
|
)),
|
|
3911
|
-
|
|
3959
|
+
Wo(),
|
|
3912
3960
|
z(
|
|
3913
3961
|
(i, o) => i.navigation.paginationBeginCfi === o.navigation.paginationBeginCfi
|
|
3914
3962
|
),
|
|
@@ -3920,14 +3968,14 @@ const zo = () => (n) => n.pipe(
|
|
|
3920
3968
|
}
|
|
3921
3969
|
})
|
|
3922
3970
|
)
|
|
3923
|
-
),
|
|
3971
|
+
), Ho = ({ navigationResolver: n }) => (e) => e.pipe(
|
|
3924
3972
|
S(([t, i]) => {
|
|
3925
3973
|
const o = {
|
|
3926
3974
|
type: "api",
|
|
3927
3975
|
meta: {
|
|
3928
3976
|
triggeredBy: "user"
|
|
3929
3977
|
},
|
|
3930
|
-
id: Symbol(),
|
|
3978
|
+
id: /* @__PURE__ */ Symbol(),
|
|
3931
3979
|
animation: "turn",
|
|
3932
3980
|
...t,
|
|
3933
3981
|
/**
|
|
@@ -3957,7 +4005,7 @@ const zo = () => (n) => n.pipe(
|
|
|
3957
4005
|
navigation: o
|
|
3958
4006
|
};
|
|
3959
4007
|
})
|
|
3960
|
-
),
|
|
4008
|
+
), Bo = ({ navigationResolver: n }) => (e) => e.pipe(
|
|
3961
4009
|
S((t) => {
|
|
3962
4010
|
if (t.navigation.cfi) {
|
|
3963
4011
|
const i = n.getNavigationForCfi(
|
|
@@ -3974,16 +4022,16 @@ const zo = () => (n) => n.pipe(
|
|
|
3974
4022
|
}
|
|
3975
4023
|
return t;
|
|
3976
4024
|
})
|
|
3977
|
-
),
|
|
4025
|
+
), Xo = ({
|
|
3978
4026
|
navigation: n,
|
|
3979
4027
|
previousNavigation: e,
|
|
3980
4028
|
settings: t
|
|
3981
|
-
}) => n.directionFromLastNavigation ? n.directionFromLastNavigation : n.url !== void 0 || n.cfi !== void 0 ? "anchor" : e.spineItem === void 0 || n.spineItem || !n.position ? "forward" : t.values.computedPageTurnDirection === "vertical" ? n.position.y > e.position.y || n.position.y === e.position.y && e.directionFromLastNavigation !== "backward" ? "forward" : "backward" : Math.abs(n.position.x) > Math.abs(e.position.x) || n.position.x === e.position.x && e.directionFromLastNavigation !== "backward" ? "forward" : "backward",
|
|
4029
|
+
}) => n.directionFromLastNavigation ? n.directionFromLastNavigation : n.url !== void 0 || n.cfi !== void 0 ? "anchor" : e.spineItem === void 0 || n.spineItem || !n.position ? "forward" : t.values.computedPageTurnDirection === "vertical" ? n.position.y > e.position.y || n.position.y === e.position.y && e.directionFromLastNavigation !== "backward" ? "forward" : "backward" : Math.abs(n.position.x) > Math.abs(e.position.x) || n.position.x === e.position.x && e.directionFromLastNavigation !== "backward" ? "forward" : "backward", Yo = ({
|
|
3982
4030
|
context: n,
|
|
3983
4031
|
settings: e
|
|
3984
4032
|
}) => (t) => t.pipe(
|
|
3985
4033
|
S(({ navigation: i, previousNavigation: o }) => {
|
|
3986
|
-
const s =
|
|
4034
|
+
const s = Xo({
|
|
3987
4035
|
navigation: i,
|
|
3988
4036
|
previousNavigation: o,
|
|
3989
4037
|
settings: e
|
|
@@ -3997,7 +4045,7 @@ const zo = () => (n) => n.pipe(
|
|
|
3997
4045
|
direction: s
|
|
3998
4046
|
};
|
|
3999
4047
|
})
|
|
4000
|
-
),
|
|
4048
|
+
), qo = ({
|
|
4001
4049
|
spineItemsManager: n,
|
|
4002
4050
|
navigationResolver: e,
|
|
4003
4051
|
settings: t
|
|
@@ -4028,7 +4076,7 @@ const zo = () => (n) => n.pipe(
|
|
|
4028
4076
|
},
|
|
4029
4077
|
...s
|
|
4030
4078
|
};
|
|
4031
|
-
const a = e.getNavigationForSpineIndexOrId(r), c = t.values.computedPageTurnMode === "scrollable" ? new
|
|
4079
|
+
const a = e.getNavigationForSpineIndexOrId(r), c = t.values.computedPageTurnMode === "scrollable" ? new ue({
|
|
4032
4080
|
x: a.x + s.previousNavigation.position.x,
|
|
4033
4081
|
y: a.y
|
|
4034
4082
|
}) : e.fromUnboundSpinePosition(a);
|
|
@@ -4040,7 +4088,7 @@ const zo = () => (n) => n.pipe(
|
|
|
4040
4088
|
...s
|
|
4041
4089
|
};
|
|
4042
4090
|
})
|
|
4043
|
-
),
|
|
4091
|
+
), bt = ({
|
|
4044
4092
|
settings: n,
|
|
4045
4093
|
spineItemsManager: e,
|
|
4046
4094
|
navigationResolver: t,
|
|
@@ -4099,7 +4147,7 @@ const zo = () => (n) => n.pipe(
|
|
|
4099
4147
|
};
|
|
4100
4148
|
})
|
|
4101
4149
|
);
|
|
4102
|
-
},
|
|
4150
|
+
}, It = ({ spine: n }) => (e) => e.pipe(
|
|
4103
4151
|
w(({ navigation: t, ...i }) => {
|
|
4104
4152
|
const o = n.getSpineItemSpineLayoutInfo(
|
|
4105
4153
|
t.spineItem
|
|
@@ -4122,7 +4170,7 @@ const zo = () => (n) => n.pipe(
|
|
|
4122
4170
|
)
|
|
4123
4171
|
);
|
|
4124
4172
|
})
|
|
4125
|
-
),
|
|
4173
|
+
), je = ({
|
|
4126
4174
|
settings: n,
|
|
4127
4175
|
spineItemsManager: e,
|
|
4128
4176
|
spineLocator: t,
|
|
@@ -4166,7 +4214,7 @@ const zo = () => (n) => n.pipe(
|
|
|
4166
4214
|
...a
|
|
4167
4215
|
}))
|
|
4168
4216
|
);
|
|
4169
|
-
},
|
|
4217
|
+
}, Go = ({ navigationResolver: n }) => (e) => e.pipe(
|
|
4170
4218
|
S((t) => {
|
|
4171
4219
|
if (t.navigation.url) {
|
|
4172
4220
|
const i = n.getNavigationForUrl(
|
|
@@ -4185,7 +4233,7 @@ const zo = () => (n) => n.pipe(
|
|
|
4185
4233
|
return t;
|
|
4186
4234
|
})
|
|
4187
4235
|
);
|
|
4188
|
-
class
|
|
4236
|
+
class Zt {
|
|
4189
4237
|
constructor() {
|
|
4190
4238
|
this.isLockedSubject = new H(0), this.isLocked$ = this.isLockedSubject.pipe(
|
|
4191
4239
|
S((e) => !!e),
|
|
@@ -4199,7 +4247,7 @@ class Gt {
|
|
|
4199
4247
|
};
|
|
4200
4248
|
}
|
|
4201
4249
|
}
|
|
4202
|
-
const
|
|
4250
|
+
const Zo = ({
|
|
4203
4251
|
spineLocator: n,
|
|
4204
4252
|
navigation: e,
|
|
4205
4253
|
navigationResolver: t,
|
|
@@ -4224,7 +4272,7 @@ const Go = ({
|
|
|
4224
4272
|
return h.position;
|
|
4225
4273
|
}
|
|
4226
4274
|
const g = e.cfi ?? e.paginationBeginCfi;
|
|
4227
|
-
if (g !== void 0 && !
|
|
4275
|
+
if (g !== void 0 && !Ye(g) && (u || l || // when spine item is ready dimensions may have not changed but the position
|
|
4228
4276
|
// of dom elements may have!
|
|
4229
4277
|
r && !e.spineItemIsReady)) {
|
|
4230
4278
|
const h = t.getNavigationForCfi(g);
|
|
@@ -4256,7 +4304,7 @@ const Go = ({
|
|
|
4256
4304
|
return c ? t.getNavigationForPosition(e.position) : t.getNavigationForSpineIndexOrId(s);
|
|
4257
4305
|
})
|
|
4258
4306
|
) : v(new M({ x: 0, y: 0 }));
|
|
4259
|
-
},
|
|
4307
|
+
}, Jo = ({
|
|
4260
4308
|
navigation: n,
|
|
4261
4309
|
spineLocator: e,
|
|
4262
4310
|
spineItemsManager: t,
|
|
@@ -4325,7 +4373,7 @@ const Go = ({
|
|
|
4325
4373
|
}
|
|
4326
4374
|
}
|
|
4327
4375
|
return n.position;
|
|
4328
|
-
},
|
|
4376
|
+
}, Ko = ({
|
|
4329
4377
|
navigation: n,
|
|
4330
4378
|
spineItemsManager: e,
|
|
4331
4379
|
settings: t,
|
|
@@ -4333,7 +4381,7 @@ const Go = ({
|
|
|
4333
4381
|
navigationResolver: o,
|
|
4334
4382
|
spine: s
|
|
4335
4383
|
}) => t.values.computedPageTurnMode === "scrollable" ? v(
|
|
4336
|
-
|
|
4384
|
+
Jo({
|
|
4337
4385
|
navigation: n,
|
|
4338
4386
|
spineLocator: i,
|
|
4339
4387
|
navigationResolver: o,
|
|
@@ -4341,19 +4389,19 @@ const Go = ({
|
|
|
4341
4389
|
spineItemsManager: e,
|
|
4342
4390
|
spine: s
|
|
4343
4391
|
})
|
|
4344
|
-
) :
|
|
4392
|
+
) : Zo({
|
|
4345
4393
|
navigation: n,
|
|
4346
4394
|
spineLocator: i,
|
|
4347
4395
|
navigationResolver: o,
|
|
4348
4396
|
spineItemsManager: e,
|
|
4349
4397
|
spine: s
|
|
4350
|
-
}),
|
|
4398
|
+
}), vt = ({
|
|
4351
4399
|
settings: n,
|
|
4352
4400
|
navigationResolver: e,
|
|
4353
4401
|
context: t,
|
|
4354
4402
|
spine: i
|
|
4355
4403
|
}) => (o) => o.pipe(
|
|
4356
|
-
w((s) =>
|
|
4404
|
+
w((s) => Ko({
|
|
4357
4405
|
spineLocator: i.locator,
|
|
4358
4406
|
navigation: s.navigation,
|
|
4359
4407
|
navigationResolver: e,
|
|
@@ -4370,10 +4418,10 @@ const Go = ({
|
|
|
4370
4418
|
}
|
|
4371
4419
|
}))
|
|
4372
4420
|
))
|
|
4373
|
-
),
|
|
4374
|
-
class
|
|
4421
|
+
), Qo = "navigation/InternalNavigator", es = D.namespace(Qo);
|
|
4422
|
+
class ts extends X {
|
|
4375
4423
|
constructor(e, t, i, o, s, r, a, c) {
|
|
4376
|
-
super(), this.settings = e, this.context = t, this.userNavigation$ = i, this.controlledNavigationController = o, this.scrollNavigationController = s, this.navigationResolver = r, this.spine = a, this.
|
|
4424
|
+
super(), this.settings = e, this.context = t, this.userNavigation$ = i, this.controlledNavigationController = o, this.scrollNavigationController = s, this.navigationResolver = r, this.spine = a, this.isRestorationLocked$ = c, this.navigationSubject = new H({
|
|
4377
4425
|
animation: !1,
|
|
4378
4426
|
position: new M({ x: 0, y: 0 }),
|
|
4379
4427
|
meta: {
|
|
@@ -4381,8 +4429,8 @@ class es extends X {
|
|
|
4381
4429
|
},
|
|
4382
4430
|
spineItemIsReady: !1,
|
|
4383
4431
|
type: "api",
|
|
4384
|
-
id: Symbol()
|
|
4385
|
-
}), this.navigated$ = this.navigationSubject.pipe(
|
|
4432
|
+
id: /* @__PURE__ */ Symbol()
|
|
4433
|
+
}), this.navigated$ = this.navigationSubject.pipe(Lt(1)), this.navigation$ = this.navigationSubject.pipe(
|
|
4386
4434
|
S(({ position: f, id: b }) => ({
|
|
4387
4435
|
position: f,
|
|
4388
4436
|
id: b
|
|
@@ -4391,44 +4439,44 @@ class es extends X {
|
|
|
4391
4439
|
({ position: f, ...b }, { position: I, ...F }) => V(b, F) && V(f, I)
|
|
4392
4440
|
),
|
|
4393
4441
|
K(1)
|
|
4394
|
-
), this.locker = new
|
|
4442
|
+
), this.locker = new Zt();
|
|
4395
4443
|
const u = i.pipe(
|
|
4396
4444
|
O(this.navigationSubject),
|
|
4397
|
-
|
|
4445
|
+
Ho({
|
|
4398
4446
|
navigationResolver: r
|
|
4399
4447
|
}),
|
|
4400
4448
|
/**
|
|
4401
4449
|
* Url lookup is heavier so we start with it to fill
|
|
4402
4450
|
* as much information as needed to reduce later lookup
|
|
4403
4451
|
*/
|
|
4404
|
-
|
|
4452
|
+
Go({
|
|
4405
4453
|
navigationResolver: r
|
|
4406
4454
|
}),
|
|
4407
4455
|
/**
|
|
4408
4456
|
* Cfi lookup is heavier so we start with it to fill
|
|
4409
4457
|
* as much information as needed to reduce later lookup
|
|
4410
4458
|
*/
|
|
4411
|
-
|
|
4459
|
+
Bo({
|
|
4412
4460
|
navigationResolver: r
|
|
4413
4461
|
}),
|
|
4414
|
-
|
|
4415
|
-
|
|
4462
|
+
Yo({ context: t, settings: e }),
|
|
4463
|
+
bt({
|
|
4416
4464
|
navigationResolver: r,
|
|
4417
4465
|
settings: e,
|
|
4418
4466
|
spineItemsManager: a.spineItemsManager,
|
|
4419
4467
|
spineLocator: a.locator
|
|
4420
4468
|
}),
|
|
4421
|
-
|
|
4469
|
+
je({
|
|
4422
4470
|
navigationResolver: r,
|
|
4423
4471
|
settings: e,
|
|
4424
4472
|
spineItemsManager: a.spineItemsManager,
|
|
4425
4473
|
spineLocator: a.locator
|
|
4426
4474
|
}),
|
|
4427
|
-
|
|
4475
|
+
It({
|
|
4428
4476
|
spine: a
|
|
4429
4477
|
})
|
|
4430
4478
|
).pipe(
|
|
4431
|
-
|
|
4479
|
+
qo({
|
|
4432
4480
|
navigationResolver: r,
|
|
4433
4481
|
spineItemsManager: a.spineItemsManager,
|
|
4434
4482
|
settings: e
|
|
@@ -4437,7 +4485,7 @@ class es extends X {
|
|
|
4437
4485
|
w(([f, b]) => {
|
|
4438
4486
|
const I = f.navigation.cfi || f.navigation.url || e.values.computedPageTurnMode === "scrollable" || b;
|
|
4439
4487
|
return v(f).pipe(
|
|
4440
|
-
I ?
|
|
4488
|
+
I ? xe : vt({
|
|
4441
4489
|
navigationResolver: r,
|
|
4442
4490
|
settings: e,
|
|
4443
4491
|
spine: a,
|
|
@@ -4445,7 +4493,7 @@ class es extends X {
|
|
|
4445
4493
|
})
|
|
4446
4494
|
);
|
|
4447
4495
|
}),
|
|
4448
|
-
|
|
4496
|
+
je({
|
|
4449
4497
|
spineItemsManager: a.spineItemsManager,
|
|
4450
4498
|
spineLocator: a.locator,
|
|
4451
4499
|
settings: e,
|
|
@@ -4474,7 +4522,7 @@ class es extends X {
|
|
|
4474
4522
|
);
|
|
4475
4523
|
}),
|
|
4476
4524
|
E()
|
|
4477
|
-
), d =
|
|
4525
|
+
), d = x(
|
|
4478
4526
|
o.layout$,
|
|
4479
4527
|
a.layout$
|
|
4480
4528
|
).pipe(
|
|
@@ -4497,15 +4545,15 @@ class es extends X {
|
|
|
4497
4545
|
* it has been controlled outside.
|
|
4498
4546
|
*/
|
|
4499
4547
|
T(
|
|
4500
|
-
|
|
4548
|
+
x(l, u)
|
|
4501
4549
|
)
|
|
4502
4550
|
))
|
|
4503
|
-
), g =
|
|
4551
|
+
), g = x(
|
|
4504
4552
|
d,
|
|
4505
4553
|
l
|
|
4506
4554
|
).pipe(
|
|
4507
4555
|
S((f) => ({ navigation: f })),
|
|
4508
|
-
|
|
4556
|
+
vt({
|
|
4509
4557
|
navigationResolver: r,
|
|
4510
4558
|
settings: e,
|
|
4511
4559
|
context: t,
|
|
@@ -4528,16 +4576,16 @@ class es extends X {
|
|
|
4528
4576
|
* eg: after the reader load and the user has never navigated
|
|
4529
4577
|
* yet.
|
|
4530
4578
|
*/
|
|
4531
|
-
|
|
4579
|
+
bt({
|
|
4532
4580
|
navigationResolver: r,
|
|
4533
4581
|
settings: e,
|
|
4534
4582
|
spineItemsManager: a.spineItemsManager,
|
|
4535
4583
|
spineLocator: a.locator
|
|
4536
4584
|
}),
|
|
4537
|
-
|
|
4585
|
+
It({
|
|
4538
4586
|
spine: a
|
|
4539
4587
|
}),
|
|
4540
|
-
|
|
4588
|
+
je({
|
|
4541
4589
|
spineItemsManager: a.spineItemsManager,
|
|
4542
4590
|
spineLocator: a.locator,
|
|
4543
4591
|
settings: e,
|
|
@@ -4545,17 +4593,17 @@ class es extends X {
|
|
|
4545
4593
|
}),
|
|
4546
4594
|
S(({ navigation: f }) => f),
|
|
4547
4595
|
E()
|
|
4548
|
-
), h =
|
|
4596
|
+
), h = _o(
|
|
4549
4597
|
t,
|
|
4550
4598
|
this.navigationSubject,
|
|
4551
4599
|
a
|
|
4552
|
-
), p =
|
|
4600
|
+
), p = x(
|
|
4553
4601
|
g,
|
|
4554
4602
|
u,
|
|
4555
4603
|
h
|
|
4556
4604
|
), m = (f) => f.pipe(
|
|
4557
|
-
|
|
4558
|
-
|
|
4605
|
+
P(([b, I]) => {
|
|
4606
|
+
es.info(
|
|
4559
4607
|
`navigation updated from ${b.meta.triggeredBy} of type ${b.type}`,
|
|
4560
4608
|
{
|
|
4561
4609
|
previousNavigation: I,
|
|
@@ -4564,7 +4612,7 @@ class es extends X {
|
|
|
4564
4612
|
), this.navigationSubject.next(b);
|
|
4565
4613
|
})
|
|
4566
4614
|
), y = (f) => f.pipe(
|
|
4567
|
-
|
|
4615
|
+
P(([b, I]) => {
|
|
4568
4616
|
const F = b.type === "scroll", $ = b.meta.triggeredBy === "pagination", A = b.meta.triggeredBy === "restoration", Y = V(
|
|
4569
4617
|
I.position,
|
|
4570
4618
|
b.position
|
|
@@ -4607,20 +4655,20 @@ class es extends X {
|
|
|
4607
4655
|
const Fe = (n, e, t) => {
|
|
4608
4656
|
const i = t - n, o = t * (e * n) / (t || 1);
|
|
4609
4657
|
return Math.max(0, Math.min(i, o));
|
|
4610
|
-
},
|
|
4611
|
-
const i =
|
|
4658
|
+
}, qe = (n, e) => (e || 0) === 0 || (n || 0) === 0 ? 1 : Math.floor(Math.max(1, n / e)), ke = (n, e, t) => {
|
|
4659
|
+
const i = qe(t, e), o = [...Array(i)].map((s, r) => r * e);
|
|
4612
4660
|
return n >= i * e ? o[o.length - 1] || 0 : o.find((s) => n < s + e) || 0;
|
|
4613
|
-
},
|
|
4661
|
+
}, wt = (n, e, t) => {
|
|
4614
4662
|
const i = [...Array(t)].map((o, s) => s * e);
|
|
4615
4663
|
return n <= 0 || t === 0 ? 0 : n >= t * e ? t - 1 : i.findIndex((o) => n < o + e) ?? 0;
|
|
4616
|
-
},
|
|
4664
|
+
}, ns = ({
|
|
4617
4665
|
itemWidth: n,
|
|
4618
4666
|
itemHeight: e,
|
|
4619
4667
|
spineItemPosition: t
|
|
4620
4668
|
}) => new C({
|
|
4621
4669
|
x: Math.min(n, Math.max(0, t.x)),
|
|
4622
4670
|
y: Math.min(e, Math.max(0, t.y))
|
|
4623
|
-
}),
|
|
4671
|
+
}), Jt = ({
|
|
4624
4672
|
itemHeight: n,
|
|
4625
4673
|
itemWidth: e,
|
|
4626
4674
|
isUsingVerticalWriting: t,
|
|
@@ -4628,7 +4676,7 @@ const Fe = (n, e, t) => {
|
|
|
4628
4676
|
pageHeight: o,
|
|
4629
4677
|
pageTurnDirection: s,
|
|
4630
4678
|
pageTurnMode: r
|
|
4631
|
-
}) => s === "vertical" && r === "scrollable" ? 1 : t || s === "vertical" ?
|
|
4679
|
+
}) => s === "vertical" && r === "scrollable" ? 1 : t || s === "vertical" ? qe(n, o) : qe(e, i), xt = ({
|
|
4632
4680
|
itemWidth: n,
|
|
4633
4681
|
itemHeight: e,
|
|
4634
4682
|
position: t,
|
|
@@ -4639,11 +4687,11 @@ const Fe = (n, e, t) => {
|
|
|
4639
4687
|
pageTurnMode: a,
|
|
4640
4688
|
isRTL: c
|
|
4641
4689
|
}) => {
|
|
4642
|
-
const l =
|
|
4690
|
+
const l = ns({
|
|
4643
4691
|
spineItemPosition: t,
|
|
4644
4692
|
itemHeight: e,
|
|
4645
4693
|
itemWidth: n
|
|
4646
|
-
}).x, d =
|
|
4694
|
+
}).x, d = Jt({
|
|
4647
4695
|
isUsingVerticalWriting: i,
|
|
4648
4696
|
itemHeight: e,
|
|
4649
4697
|
itemWidth: n,
|
|
@@ -4653,10 +4701,10 @@ const Fe = (n, e, t) => {
|
|
|
4653
4701
|
pageTurnMode: a
|
|
4654
4702
|
});
|
|
4655
4703
|
if (i)
|
|
4656
|
-
return
|
|
4657
|
-
const g =
|
|
4704
|
+
return wt(t.y, s, d);
|
|
4705
|
+
const g = wt(l, o, d);
|
|
4658
4706
|
return c ? d - 1 - g : g;
|
|
4659
|
-
},
|
|
4707
|
+
}, is = ({
|
|
4660
4708
|
pageIndex: n,
|
|
4661
4709
|
itemLayout: e,
|
|
4662
4710
|
context: t,
|
|
@@ -4686,17 +4734,17 @@ const Fe = (n, e, t) => {
|
|
|
4686
4734
|
x: s,
|
|
4687
4735
|
y: 0
|
|
4688
4736
|
});
|
|
4689
|
-
},
|
|
4737
|
+
}, Kt = ({
|
|
4690
4738
|
context: n,
|
|
4691
4739
|
settings: e,
|
|
4692
4740
|
viewport: t
|
|
4693
4741
|
}) => {
|
|
4694
4742
|
const i = (a, c, u) => {
|
|
4695
4743
|
let l;
|
|
4696
|
-
a?.nodeName === "img" || a?.textContent === "" && a.nodeType === Node.ELEMENT_NODE ? l = a.getBoundingClientRect().x : a && (l = (a ?
|
|
4744
|
+
a?.nodeName === "img" || a?.textContent === "" && a.nodeType === Node.ELEMENT_NODE ? l = a.getBoundingClientRect().x : a && (l = (a ? En(a, c) : void 0)?.getBoundingClientRect().x || l);
|
|
4697
4745
|
const d = u.layout.layoutInfo?.width || 0, g = t.pageSize.width;
|
|
4698
4746
|
if (l !== void 0) {
|
|
4699
|
-
const h =
|
|
4747
|
+
const h = ke(
|
|
4700
4748
|
l,
|
|
4701
4749
|
g,
|
|
4702
4750
|
d
|
|
@@ -4709,14 +4757,14 @@ const Fe = (n, e, t) => {
|
|
|
4709
4757
|
getSpineItemPositionFromPageIndex: ({
|
|
4710
4758
|
pageIndex: a,
|
|
4711
4759
|
spineItem: c
|
|
4712
|
-
}) =>
|
|
4760
|
+
}) => is({
|
|
4713
4761
|
context: n,
|
|
4714
4762
|
isUsingVerticalWriting: !!c.isUsingVerticalWriting(),
|
|
4715
4763
|
itemLayout: c.layout.layoutInfo,
|
|
4716
4764
|
pageIndex: a,
|
|
4717
4765
|
viewport: t
|
|
4718
4766
|
}),
|
|
4719
|
-
getSpineItemPageIndexFromPosition: (a) =>
|
|
4767
|
+
getSpineItemPageIndexFromPosition: (a) => xt({
|
|
4720
4768
|
...a,
|
|
4721
4769
|
isRTL: n.isRTL(),
|
|
4722
4770
|
pageWidth: t.pageSize.width,
|
|
@@ -4726,7 +4774,7 @@ const Fe = (n, e, t) => {
|
|
|
4726
4774
|
}),
|
|
4727
4775
|
getSpineItemPageIndexFromNode: (a, c, u) => {
|
|
4728
4776
|
const l = i(a, c, u), { height: d, width: g } = u.layout.layoutInfo;
|
|
4729
|
-
return l ?
|
|
4777
|
+
return l ? xt({
|
|
4730
4778
|
isUsingVerticalWriting: !!u.isUsingVerticalWriting(),
|
|
4731
4779
|
position: l,
|
|
4732
4780
|
itemHeight: d,
|
|
@@ -4741,12 +4789,12 @@ const Fe = (n, e, t) => {
|
|
|
4741
4789
|
getSpineItemClosestPositionFromUnsafePosition: (a, c) => {
|
|
4742
4790
|
const { width: u, height: l } = c.layout.layoutInfo;
|
|
4743
4791
|
return new C({
|
|
4744
|
-
x:
|
|
4792
|
+
x: ke(
|
|
4745
4793
|
a.x,
|
|
4746
4794
|
t.pageSize.width,
|
|
4747
4795
|
u
|
|
4748
4796
|
),
|
|
4749
|
-
y:
|
|
4797
|
+
y: ke(
|
|
4750
4798
|
a.y,
|
|
4751
4799
|
t.pageSize.height,
|
|
4752
4800
|
l
|
|
@@ -4761,7 +4809,7 @@ const Fe = (n, e, t) => {
|
|
|
4761
4809
|
c,
|
|
4762
4810
|
d
|
|
4763
4811
|
);
|
|
4764
|
-
return new
|
|
4812
|
+
return new Ne({
|
|
4765
4813
|
x: a.x,
|
|
4766
4814
|
y: a.y - y
|
|
4767
4815
|
});
|
|
@@ -4769,23 +4817,23 @@ const Fe = (n, e, t) => {
|
|
|
4769
4817
|
const m = Fe(g, c, l);
|
|
4770
4818
|
if (n.isRTL()) {
|
|
4771
4819
|
const y = l - (c + 1) * g;
|
|
4772
|
-
return new
|
|
4820
|
+
return new Ne({
|
|
4773
4821
|
x: a.x - Math.max(0, y),
|
|
4774
4822
|
y: a.y
|
|
4775
4823
|
});
|
|
4776
4824
|
}
|
|
4777
|
-
return new
|
|
4825
|
+
return new Ne({
|
|
4778
4826
|
x: a.x - m,
|
|
4779
4827
|
y: a.y
|
|
4780
4828
|
});
|
|
4781
4829
|
}
|
|
4782
4830
|
};
|
|
4783
|
-
},
|
|
4831
|
+
}, os = ({
|
|
4784
4832
|
context: n,
|
|
4785
4833
|
settings: e,
|
|
4786
4834
|
viewport: t
|
|
4787
4835
|
}) => {
|
|
4788
|
-
const i =
|
|
4836
|
+
const i = Kt({
|
|
4789
4837
|
context: n,
|
|
4790
4838
|
settings: e,
|
|
4791
4839
|
viewport: t
|
|
@@ -4809,7 +4857,7 @@ const Fe = (n, e, t) => {
|
|
|
4809
4857
|
) || new C({ x: 0, y: 0 })
|
|
4810
4858
|
};
|
|
4811
4859
|
};
|
|
4812
|
-
function
|
|
4860
|
+
function Qt({
|
|
4813
4861
|
position: n,
|
|
4814
4862
|
isRTL: e,
|
|
4815
4863
|
spineItemsManager: t,
|
|
@@ -4842,7 +4890,7 @@ const Pt = ({
|
|
|
4842
4890
|
visibleAreaRectWidth: o,
|
|
4843
4891
|
spine: s
|
|
4844
4892
|
}) => {
|
|
4845
|
-
const r =
|
|
4893
|
+
const r = Qt({
|
|
4846
4894
|
position: n,
|
|
4847
4895
|
isRTL: e,
|
|
4848
4896
|
spineItemsManager: i,
|
|
@@ -4863,14 +4911,14 @@ const Pt = ({
|
|
|
4863
4911
|
x: Math.min(r.x, d),
|
|
4864
4912
|
y: l
|
|
4865
4913
|
});
|
|
4866
|
-
},
|
|
4914
|
+
}, te = ({
|
|
4867
4915
|
position: { x: n, y: e },
|
|
4868
4916
|
pageSizeWidth: t,
|
|
4869
4917
|
visibleAreaRectWidth: i
|
|
4870
4918
|
}) => {
|
|
4871
4919
|
const s = n % i !== 0 ? n - t : n;
|
|
4872
4920
|
return new M({ x: s, y: e });
|
|
4873
|
-
},
|
|
4921
|
+
}, Ge = ({
|
|
4874
4922
|
viewportPosition: n,
|
|
4875
4923
|
spineLocator: e,
|
|
4876
4924
|
spineItemNavigationResolver: t,
|
|
@@ -4888,14 +4936,14 @@ const Pt = ({
|
|
|
4888
4936
|
spineItemPosition: r,
|
|
4889
4937
|
spineItem: o
|
|
4890
4938
|
});
|
|
4891
|
-
return
|
|
4939
|
+
return te({
|
|
4892
4940
|
position: a,
|
|
4893
4941
|
pageSizeWidth: i.pageSize.width,
|
|
4894
4942
|
visibleAreaRectWidth: i.absoluteViewport.width
|
|
4895
4943
|
});
|
|
4896
4944
|
}
|
|
4897
4945
|
return new M({ x: 0, y: 0 });
|
|
4898
|
-
},
|
|
4946
|
+
}, ss = ({
|
|
4899
4947
|
pageIndex: n,
|
|
4900
4948
|
spineItemsManager: e,
|
|
4901
4949
|
spineItemId: t,
|
|
@@ -4906,7 +4954,7 @@ const Pt = ({
|
|
|
4906
4954
|
const r = e.get(t);
|
|
4907
4955
|
if (!r) {
|
|
4908
4956
|
const u = n * s.pageSize.width;
|
|
4909
|
-
return
|
|
4957
|
+
return Ge({
|
|
4910
4958
|
viewportPosition: new M({ x: u, y: 0 }),
|
|
4911
4959
|
spineItemNavigationResolver: o,
|
|
4912
4960
|
spineLocator: i,
|
|
@@ -4920,33 +4968,33 @@ const Pt = ({
|
|
|
4920
4968
|
spineItemPosition: a,
|
|
4921
4969
|
spineItem: r
|
|
4922
4970
|
});
|
|
4923
|
-
return
|
|
4971
|
+
return te({
|
|
4924
4972
|
position: c,
|
|
4925
4973
|
pageSizeWidth: s.pageSize.width,
|
|
4926
4974
|
visibleAreaRectWidth: s.absoluteViewport.width
|
|
4927
4975
|
});
|
|
4928
|
-
},
|
|
4976
|
+
}, rs = (n, e) => {
|
|
4929
4977
|
if (e && e instanceof HTMLIFrameElement)
|
|
4930
4978
|
return n.startsWith("#") ? e.contentDocument?.getElementById(
|
|
4931
4979
|
n.replace("#", "")
|
|
4932
4980
|
) : e.contentDocument?.querySelector(n);
|
|
4933
|
-
},
|
|
4981
|
+
}, as = ({
|
|
4934
4982
|
anchor: n,
|
|
4935
4983
|
spineItem: e,
|
|
4936
4984
|
spine: t
|
|
4937
4985
|
}) => {
|
|
4938
|
-
const i =
|
|
4986
|
+
const i = rs(
|
|
4939
4987
|
n,
|
|
4940
4988
|
e.renderer.getDocumentFrame()
|
|
4941
4989
|
);
|
|
4942
4990
|
return i ? t.spineItemLocator.getSpineItemPositionFromNode(i, 0, e)?.x ?? 0 : 0;
|
|
4943
|
-
},
|
|
4991
|
+
}, cs = ({
|
|
4944
4992
|
anchor: n,
|
|
4945
4993
|
spineItem: e,
|
|
4946
4994
|
spineLocator: t,
|
|
4947
4995
|
spine: i
|
|
4948
4996
|
}) => {
|
|
4949
|
-
const o =
|
|
4997
|
+
const o = as({
|
|
4950
4998
|
anchor: n,
|
|
4951
4999
|
spineItem: e,
|
|
4952
5000
|
spine: i
|
|
@@ -4955,7 +5003,7 @@ const Pt = ({
|
|
|
4955
5003
|
spineItemPosition: new C({ x: o, y: 0 }),
|
|
4956
5004
|
spineItem: e
|
|
4957
5005
|
});
|
|
4958
|
-
},
|
|
5006
|
+
}, us = ({
|
|
4959
5007
|
anchor: n,
|
|
4960
5008
|
spineItem: e,
|
|
4961
5009
|
spineLocator: t,
|
|
@@ -4963,18 +5011,18 @@ const Pt = ({
|
|
|
4963
5011
|
pageSizeWidth: o,
|
|
4964
5012
|
visibleAreaRectWidth: s
|
|
4965
5013
|
}) => {
|
|
4966
|
-
const r =
|
|
5014
|
+
const r = cs({
|
|
4967
5015
|
anchor: n,
|
|
4968
5016
|
spineItem: e,
|
|
4969
5017
|
spineLocator: t,
|
|
4970
5018
|
spine: i
|
|
4971
5019
|
});
|
|
4972
|
-
return
|
|
5020
|
+
return te({
|
|
4973
5021
|
position: r,
|
|
4974
5022
|
pageSizeWidth: o,
|
|
4975
5023
|
visibleAreaRectWidth: s
|
|
4976
5024
|
});
|
|
4977
|
-
},
|
|
5025
|
+
}, ls = ({
|
|
4978
5026
|
spine: n,
|
|
4979
5027
|
spineItemsManager: e,
|
|
4980
5028
|
spineLocator: t,
|
|
@@ -4990,7 +5038,7 @@ const Pt = ({
|
|
|
4990
5038
|
if (u) {
|
|
4991
5039
|
const l = e.get(u.id);
|
|
4992
5040
|
if (l) {
|
|
4993
|
-
const d =
|
|
5041
|
+
const d = us({
|
|
4994
5042
|
anchor: a.hash,
|
|
4995
5043
|
spineItem: l,
|
|
4996
5044
|
spine: n,
|
|
@@ -4999,7 +5047,7 @@ const Pt = ({
|
|
|
4999
5047
|
visibleAreaRectWidth: r
|
|
5000
5048
|
});
|
|
5001
5049
|
return {
|
|
5002
|
-
position:
|
|
5050
|
+
position: te({
|
|
5003
5051
|
position: d,
|
|
5004
5052
|
pageSizeWidth: s,
|
|
5005
5053
|
visibleAreaRectWidth: r
|
|
@@ -5013,7 +5061,7 @@ const Pt = ({
|
|
|
5013
5061
|
console.error(a);
|
|
5014
5062
|
return;
|
|
5015
5063
|
}
|
|
5016
|
-
},
|
|
5064
|
+
}, ds = ({
|
|
5017
5065
|
spineItem: n,
|
|
5018
5066
|
spineItemPosition: e,
|
|
5019
5067
|
spineLocator: t,
|
|
@@ -5027,12 +5075,12 @@ const Pt = ({
|
|
|
5027
5075
|
spineItemPosition: s,
|
|
5028
5076
|
spineItem: n
|
|
5029
5077
|
});
|
|
5030
|
-
return
|
|
5078
|
+
return te({
|
|
5031
5079
|
position: r,
|
|
5032
5080
|
pageSizeWidth: o.pageSize.width,
|
|
5033
5081
|
visibleAreaRectWidth: o.absoluteViewport.width
|
|
5034
5082
|
});
|
|
5035
|
-
},
|
|
5083
|
+
}, ps = "spineNavigator", gs = ({
|
|
5036
5084
|
context: n,
|
|
5037
5085
|
spineItemsManager: e,
|
|
5038
5086
|
locator: t,
|
|
@@ -5040,13 +5088,13 @@ const Pt = ({
|
|
|
5040
5088
|
spine: o,
|
|
5041
5089
|
viewport: s
|
|
5042
5090
|
}) => {
|
|
5043
|
-
const r =
|
|
5091
|
+
const r = os({
|
|
5044
5092
|
context: n,
|
|
5045
5093
|
settings: i,
|
|
5046
5094
|
viewport: s
|
|
5047
5095
|
});
|
|
5048
5096
|
return {
|
|
5049
|
-
getNavigationForUrl: (h) =>
|
|
5097
|
+
getNavigationForUrl: (h) => ls({
|
|
5050
5098
|
context: n,
|
|
5051
5099
|
spineItemsManager: e,
|
|
5052
5100
|
spineLocator: t,
|
|
@@ -5055,33 +5103,33 @@ const Pt = ({
|
|
|
5055
5103
|
visibleAreaRectWidth: s.absoluteViewport.width,
|
|
5056
5104
|
spine: o
|
|
5057
5105
|
}),
|
|
5058
|
-
getNavigationForSpineItemPage: (h) =>
|
|
5106
|
+
getNavigationForSpineItemPage: (h) => ss({
|
|
5059
5107
|
...h,
|
|
5060
5108
|
spineItemsManager: e,
|
|
5061
5109
|
spineItemNavigationResolver: r,
|
|
5062
5110
|
spineLocator: t,
|
|
5063
5111
|
viewport: s
|
|
5064
5112
|
}),
|
|
5065
|
-
getNavigationFromSpineItemPosition: (h) =>
|
|
5113
|
+
getNavigationFromSpineItemPosition: (h) => ds({
|
|
5066
5114
|
...h,
|
|
5067
5115
|
spineItemLocator: t.spineItemLocator,
|
|
5068
5116
|
spineLocator: t,
|
|
5069
5117
|
viewport: s
|
|
5070
5118
|
}),
|
|
5071
5119
|
getNavigationForCfi: (h) => {
|
|
5072
|
-
const p = e.getSpineItemFromCfi(h), { node: m, offset: y = 0 } =
|
|
5120
|
+
const p = e.getSpineItemFromCfi(h), { node: m, offset: y = 0 } = Yt({
|
|
5073
5121
|
cfi: h,
|
|
5074
5122
|
spineItemsManager: e
|
|
5075
5123
|
});
|
|
5076
5124
|
if (!p) {
|
|
5077
|
-
D.warn(
|
|
5125
|
+
D.warn(ps, `unable to detect item id from cfi ${h}`);
|
|
5078
5126
|
return;
|
|
5079
5127
|
}
|
|
5080
5128
|
const f = m ? r.getNavigationFromNode(p, m, y) : new C({ x: 0, y: 0 }), b = t.getSpinePositionFromSpineItemPosition({
|
|
5081
5129
|
spineItemPosition: f,
|
|
5082
5130
|
spineItem: p
|
|
5083
5131
|
});
|
|
5084
|
-
return
|
|
5132
|
+
return te({
|
|
5085
5133
|
position: b,
|
|
5086
5134
|
pageSizeWidth: s.pageSize.width,
|
|
5087
5135
|
visibleAreaRectWidth: s.absoluteViewport.width
|
|
@@ -5092,7 +5140,7 @@ const Pt = ({
|
|
|
5092
5140
|
spineItemPosition: p,
|
|
5093
5141
|
spineItem: h
|
|
5094
5142
|
});
|
|
5095
|
-
return
|
|
5143
|
+
return te({
|
|
5096
5144
|
position: m,
|
|
5097
5145
|
pageSizeWidth: s.pageSize.width,
|
|
5098
5146
|
visibleAreaRectWidth: s.absoluteViewport.width
|
|
@@ -5102,7 +5150,7 @@ const Pt = ({
|
|
|
5102
5150
|
const p = e.get(h);
|
|
5103
5151
|
if (p) {
|
|
5104
5152
|
const m = t.getSpinePositionFromSpineItem(p);
|
|
5105
|
-
return
|
|
5153
|
+
return te({
|
|
5106
5154
|
position: m,
|
|
5107
5155
|
pageSizeWidth: s.pageSize.width,
|
|
5108
5156
|
visibleAreaRectWidth: s.absoluteViewport.width
|
|
@@ -5110,7 +5158,7 @@ const Pt = ({
|
|
|
5110
5158
|
}
|
|
5111
5159
|
return new M({ x: 0, y: 0 });
|
|
5112
5160
|
},
|
|
5113
|
-
getNavigationForPosition: (h) =>
|
|
5161
|
+
getNavigationForPosition: (h) => Ge({
|
|
5114
5162
|
viewportPosition: h,
|
|
5115
5163
|
spineItemNavigationResolver: r,
|
|
5116
5164
|
spineLocator: t,
|
|
@@ -5128,7 +5176,7 @@ const Pt = ({
|
|
|
5128
5176
|
spineItemsManager: e,
|
|
5129
5177
|
spine: o
|
|
5130
5178
|
});
|
|
5131
|
-
return
|
|
5179
|
+
return Ge({
|
|
5132
5180
|
spineItemNavigationResolver: r,
|
|
5133
5181
|
spineLocator: t,
|
|
5134
5182
|
viewportPosition: b,
|
|
@@ -5143,7 +5191,7 @@ const Pt = ({
|
|
|
5143
5191
|
spineItemsManager: e,
|
|
5144
5192
|
spine: o
|
|
5145
5193
|
}),
|
|
5146
|
-
fromOutOfBoundsSpinePosition: (h) =>
|
|
5194
|
+
fromOutOfBoundsSpinePosition: (h) => Qt({
|
|
5147
5195
|
position: h,
|
|
5148
5196
|
isRTL: n.isRTL(),
|
|
5149
5197
|
spineItemsManager: e,
|
|
@@ -5152,14 +5200,14 @@ const Pt = ({
|
|
|
5152
5200
|
}),
|
|
5153
5201
|
isNavigationGoingForwardFrom: (h, p) => i.values.computedPageTurnDirection === "vertical" ? h.y > p.y : h.x > p.x,
|
|
5154
5202
|
arePositionsDifferent: (h, p) => h.x !== p.x || h.y !== p.y,
|
|
5155
|
-
getAdjustedPositionForSpread: (h) =>
|
|
5203
|
+
getAdjustedPositionForSpread: (h) => te({
|
|
5156
5204
|
position: h,
|
|
5157
5205
|
pageSizeWidth: s.pageSize.width,
|
|
5158
5206
|
visibleAreaRectWidth: s.absoluteViewport.width
|
|
5159
5207
|
}),
|
|
5160
5208
|
spineItemNavigator: r
|
|
5161
5209
|
};
|
|
5162
|
-
},
|
|
5210
|
+
}, hs = ({
|
|
5163
5211
|
spineItemsManager: n,
|
|
5164
5212
|
context: e,
|
|
5165
5213
|
hookManager: t,
|
|
@@ -5167,26 +5215,26 @@ const Pt = ({
|
|
|
5167
5215
|
settings: o,
|
|
5168
5216
|
viewport: s
|
|
5169
5217
|
}) => {
|
|
5170
|
-
const r = new R(), a = r.asObservable(), c = new
|
|
5218
|
+
const r = new R(), a = r.asObservable(), c = new Zt(), u = gs({
|
|
5171
5219
|
context: e,
|
|
5172
5220
|
settings: o,
|
|
5173
5221
|
spineItemsManager: n,
|
|
5174
5222
|
locator: i.locator,
|
|
5175
5223
|
spine: i,
|
|
5176
5224
|
viewport: s
|
|
5177
|
-
}), l = new
|
|
5225
|
+
}), l = new zo(
|
|
5178
5226
|
o,
|
|
5179
5227
|
t,
|
|
5180
5228
|
e,
|
|
5181
5229
|
i,
|
|
5182
5230
|
s
|
|
5183
|
-
), d = new
|
|
5231
|
+
), d = new Lo(
|
|
5184
5232
|
s,
|
|
5185
5233
|
o,
|
|
5186
5234
|
t,
|
|
5187
5235
|
i,
|
|
5188
5236
|
e
|
|
5189
|
-
), g = new
|
|
5237
|
+
), g = new ts(
|
|
5190
5238
|
o,
|
|
5191
5239
|
e,
|
|
5192
5240
|
a,
|
|
@@ -5214,10 +5262,14 @@ const Pt = ({
|
|
|
5214
5262
|
scrollNavigationController: d,
|
|
5215
5263
|
controlledNavigationController: l,
|
|
5216
5264
|
locker: c,
|
|
5217
|
-
|
|
5265
|
+
navigationState$: h,
|
|
5218
5266
|
navigate: (y) => {
|
|
5219
5267
|
r.next(y);
|
|
5220
5268
|
},
|
|
5269
|
+
/**
|
|
5270
|
+
* Prevent further navigation until the lock is released.
|
|
5271
|
+
* Useful if you want to start navigation by panning for example.
|
|
5272
|
+
*/
|
|
5221
5273
|
lock() {
|
|
5222
5274
|
return c.lock();
|
|
5223
5275
|
},
|
|
@@ -5225,7 +5277,7 @@ const Pt = ({
|
|
|
5225
5277
|
navigation$: g.navigation$
|
|
5226
5278
|
};
|
|
5227
5279
|
};
|
|
5228
|
-
class
|
|
5280
|
+
class ms extends se {
|
|
5229
5281
|
constructor(e, t) {
|
|
5230
5282
|
super({
|
|
5231
5283
|
beginPageIndexInSpineItem: void 0,
|
|
@@ -5243,10 +5295,10 @@ class hs extends ue {
|
|
|
5243
5295
|
this.mergeCompare(e);
|
|
5244
5296
|
}
|
|
5245
5297
|
}
|
|
5246
|
-
class
|
|
5298
|
+
class fs extends X {
|
|
5247
5299
|
constructor(e, t, i, o, s) {
|
|
5248
5300
|
super(), this.context = e, this.pagination = t, this.spineItemsManager = i, this.spine = o, this.spineItemLocator = s;
|
|
5249
|
-
const r =
|
|
5301
|
+
const r = x(
|
|
5250
5302
|
this.context.bridgeEvent.navigation$,
|
|
5251
5303
|
o.layout$
|
|
5252
5304
|
).pipe(
|
|
@@ -5260,9 +5312,9 @@ class ms extends X {
|
|
|
5260
5312
|
threshold: { type: "percentage", value: 0.5 }
|
|
5261
5313
|
});
|
|
5262
5314
|
return this.context.bridgeEvent.navigationUnlocked$.pipe(
|
|
5263
|
-
|
|
5315
|
+
Tt(1),
|
|
5264
5316
|
O(this.context.bridgeEvent.navigation$),
|
|
5265
|
-
|
|
5317
|
+
P(([, u]) => {
|
|
5266
5318
|
const { position: l } = u, d = this.pagination.value, {
|
|
5267
5319
|
beginIndex: g,
|
|
5268
5320
|
endIndex: h
|
|
@@ -5277,14 +5329,14 @@ class ms extends X {
|
|
|
5277
5329
|
}) ?? {}, { endPageIndex: I = 0 } = c({
|
|
5278
5330
|
spineItem: m,
|
|
5279
5331
|
position: l
|
|
5280
|
-
}) ?? {}, F = y === void 0 ||
|
|
5332
|
+
}) ?? {}, F = y === void 0 || Ye(y) || d.beginSpineItemIndex !== g, $ = d.endSpineItemIndex !== h || f === void 0 || Ye(f), A = F ? he(p.item) : y, Y = $ ? he(m.item) : f, B = p.numberOfPages, re = m.numberOfPages;
|
|
5281
5333
|
this.pagination.update({
|
|
5282
5334
|
beginCfi: A,
|
|
5283
5335
|
beginNumberOfPagesInSpineItem: B,
|
|
5284
5336
|
beginPageIndexInSpineItem: b,
|
|
5285
5337
|
beginSpineItemIndex: g,
|
|
5286
5338
|
endCfi: Y,
|
|
5287
|
-
endNumberOfPagesInSpineItem:
|
|
5339
|
+
endNumberOfPagesInSpineItem: re,
|
|
5288
5340
|
endPageIndexInSpineItem: I,
|
|
5289
5341
|
endSpineItemIndex: h,
|
|
5290
5342
|
navigationId: u.id
|
|
@@ -5293,8 +5345,8 @@ class ms extends X {
|
|
|
5293
5345
|
);
|
|
5294
5346
|
})
|
|
5295
5347
|
), a = r.pipe(
|
|
5296
|
-
|
|
5297
|
-
|
|
5348
|
+
Re(this.context.bridgeEvent.viewportFree$),
|
|
5349
|
+
P(() => {
|
|
5298
5350
|
const {
|
|
5299
5351
|
beginSpineItemIndex: c,
|
|
5300
5352
|
endSpineItemIndex: u,
|
|
@@ -5305,12 +5357,12 @@ class ms extends X {
|
|
|
5305
5357
|
return;
|
|
5306
5358
|
const g = this.spineItemsManager.get(c), h = this.spineItemsManager.get(u);
|
|
5307
5359
|
g === void 0 || h === void 0 || this.pagination.update({
|
|
5308
|
-
beginCfi:
|
|
5360
|
+
beginCfi: Xe({
|
|
5309
5361
|
pageIndex: l,
|
|
5310
5362
|
spineItem: g,
|
|
5311
5363
|
spine: this.spine
|
|
5312
5364
|
}),
|
|
5313
|
-
endCfi:
|
|
5365
|
+
endCfi: Xe({
|
|
5314
5366
|
pageIndex: d,
|
|
5315
5367
|
spineItem: h,
|
|
5316
5368
|
spine: this.spine
|
|
@@ -5318,14 +5370,14 @@ class ms extends X {
|
|
|
5318
5370
|
});
|
|
5319
5371
|
})
|
|
5320
5372
|
);
|
|
5321
|
-
|
|
5373
|
+
x(r, a).pipe(T(this.destroy$)).subscribe();
|
|
5322
5374
|
}
|
|
5323
5375
|
}
|
|
5324
|
-
const
|
|
5376
|
+
const ys = ({
|
|
5325
5377
|
manifest: n,
|
|
5326
5378
|
spreadMode: e
|
|
5327
5379
|
}) => n?.renditionFlow === "scrolled-continuous" ? !1 : e;
|
|
5328
|
-
class
|
|
5380
|
+
class Ss extends X {
|
|
5329
5381
|
constructor(e) {
|
|
5330
5382
|
super();
|
|
5331
5383
|
const t = {
|
|
@@ -5335,7 +5387,7 @@ class ys extends X {
|
|
|
5335
5387
|
this.inputSettings = t, this.outputSettingsUpdateSubject = new R(), this._settings$ = this.outputSettingsUpdateSubject.asObservable().pipe(K(1)), this._settings$.subscribe();
|
|
5336
5388
|
}
|
|
5337
5389
|
_prepareUpdate(e) {
|
|
5338
|
-
const t =
|
|
5390
|
+
const t = Pe(this.inputSettings, e), i = this.getOutputSettings(t), o = !V(this.outputSettings, i);
|
|
5339
5391
|
return {
|
|
5340
5392
|
hasChanged: o,
|
|
5341
5393
|
state: i,
|
|
@@ -5362,7 +5414,7 @@ class ys extends X {
|
|
|
5362
5414
|
}
|
|
5363
5415
|
watch(e) {
|
|
5364
5416
|
return this.values$.pipe(
|
|
5365
|
-
|
|
5417
|
+
Nt(e),
|
|
5366
5418
|
z(V)
|
|
5367
5419
|
);
|
|
5368
5420
|
}
|
|
@@ -5370,10 +5422,10 @@ class ys extends X {
|
|
|
5370
5422
|
super.destroy(), this.outputSettingsUpdateSubject.complete();
|
|
5371
5423
|
}
|
|
5372
5424
|
}
|
|
5373
|
-
class
|
|
5425
|
+
class bs extends Ss {
|
|
5374
5426
|
constructor(e, t) {
|
|
5375
5427
|
super(e), this.context = t, t.watch(["manifest", "hasVerticalWriting"]).pipe(
|
|
5376
|
-
|
|
5428
|
+
P(() => this.update(this.values)),
|
|
5377
5429
|
T(this.destroy$)
|
|
5378
5430
|
).subscribe();
|
|
5379
5431
|
}
|
|
@@ -5383,7 +5435,7 @@ class Ss extends ys {
|
|
|
5383
5435
|
computedPageTurnAnimation: e.pageTurnAnimation,
|
|
5384
5436
|
computedPageTurnMode: e.pageTurnMode,
|
|
5385
5437
|
computedPageTurnAnimationDuration: 0,
|
|
5386
|
-
computedSpreadMode:
|
|
5438
|
+
computedSpreadMode: ys({
|
|
5387
5439
|
spreadMode: e.spreadMode,
|
|
5388
5440
|
manifest: t
|
|
5389
5441
|
})
|
|
@@ -5409,7 +5461,7 @@ class Ss extends ys {
|
|
|
5409
5461
|
};
|
|
5410
5462
|
}
|
|
5411
5463
|
}
|
|
5412
|
-
class
|
|
5464
|
+
class Is extends fe {
|
|
5413
5465
|
onUnload() {
|
|
5414
5466
|
return Z;
|
|
5415
5467
|
}
|
|
@@ -5428,7 +5480,7 @@ class bs extends fe {
|
|
|
5428
5480
|
getDocumentFrame() {
|
|
5429
5481
|
}
|
|
5430
5482
|
}
|
|
5431
|
-
class
|
|
5483
|
+
class vs extends X {
|
|
5432
5484
|
constructor(e, t, i, o, s, r, a) {
|
|
5433
5485
|
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 R(), this.lastLayout = null, this.applyDimsAfterLayout = ({
|
|
5434
5486
|
blankPagePosition: c,
|
|
@@ -5458,7 +5510,7 @@ class Is extends X {
|
|
|
5458
5510
|
}), { width: I, height: F };
|
|
5459
5511
|
})
|
|
5460
5512
|
), this.layout = (c) => {
|
|
5461
|
-
const u =
|
|
5513
|
+
const u = Yn(this.layout$.pipe(U()));
|
|
5462
5514
|
return this.layoutTriggerSubject.next(c), u();
|
|
5463
5515
|
}, this.adjustPositionOfElement = ({
|
|
5464
5516
|
right: c,
|
|
@@ -5480,7 +5532,7 @@ class Is extends X {
|
|
|
5480
5532
|
minimumWidth: l,
|
|
5481
5533
|
spreadPosition: d
|
|
5482
5534
|
});
|
|
5483
|
-
return
|
|
5535
|
+
return x(
|
|
5484
5536
|
v({ type: "start" }),
|
|
5485
5537
|
g.pipe(
|
|
5486
5538
|
this.applyDimsAfterLayout(c),
|
|
@@ -5513,7 +5565,7 @@ class Is extends X {
|
|
|
5513
5565
|
};
|
|
5514
5566
|
}
|
|
5515
5567
|
}
|
|
5516
|
-
class
|
|
5568
|
+
class en extends se {
|
|
5517
5569
|
constructor(e, t, i, o, s, r, a) {
|
|
5518
5570
|
super({
|
|
5519
5571
|
isLoaded: !1,
|
|
@@ -5529,7 +5581,7 @@ class Qt extends ue {
|
|
|
5529
5581
|
});
|
|
5530
5582
|
}, this.destroy = () => {
|
|
5531
5583
|
super.destroy(), this.containerElement.remove(), this.renderer.destroy();
|
|
5532
|
-
}, this.isUsingVerticalWriting = () => !!this.renderer.writingMode?.startsWith("vertical"), this.containerElement =
|
|
5584
|
+
}, this.isUsingVerticalWriting = () => !!this.renderer.writingMode?.startsWith("vertical"), this.containerElement = ws(
|
|
5533
5585
|
t,
|
|
5534
5586
|
e,
|
|
5535
5587
|
s
|
|
@@ -5545,7 +5597,7 @@ class Qt extends ue {
|
|
|
5545
5597
|
resourcesHandler: this.resourcesHandler,
|
|
5546
5598
|
viewport: this.viewport
|
|
5547
5599
|
};
|
|
5548
|
-
this.renderer = c ? c(u) : new
|
|
5600
|
+
this.renderer = c ? c(u) : new Is(u), this.layout = new vs(
|
|
5549
5601
|
e,
|
|
5550
5602
|
this.containerElement,
|
|
5551
5603
|
i,
|
|
@@ -5568,7 +5620,7 @@ class Qt extends ue {
|
|
|
5568
5620
|
});
|
|
5569
5621
|
})
|
|
5570
5622
|
);
|
|
5571
|
-
this.needsLayout$ =
|
|
5623
|
+
this.needsLayout$ = x(this.unloaded$, this.loaded$), x(
|
|
5572
5624
|
/**
|
|
5573
5625
|
* @important
|
|
5574
5626
|
* The order is important here. We want to ensure the state value
|
|
@@ -5607,11 +5659,11 @@ class Qt extends ue {
|
|
|
5607
5659
|
get unloaded$() {
|
|
5608
5660
|
return this.renderer.state$.pipe(
|
|
5609
5661
|
pe(),
|
|
5610
|
-
|
|
5662
|
+
ae((e) => e !== "idle"),
|
|
5611
5663
|
_(
|
|
5612
5664
|
() => this.renderer.state$.pipe(
|
|
5613
|
-
|
|
5614
|
-
|
|
5665
|
+
ae((e) => e === "idle"),
|
|
5666
|
+
Mt()
|
|
5615
5667
|
)
|
|
5616
5668
|
)
|
|
5617
5669
|
);
|
|
@@ -5620,7 +5672,7 @@ class Qt extends ue {
|
|
|
5620
5672
|
return this.renderer.renditionLayout;
|
|
5621
5673
|
}
|
|
5622
5674
|
get numberOfPages() {
|
|
5623
|
-
return
|
|
5675
|
+
return Jt({
|
|
5624
5676
|
isUsingVerticalWriting: !!this.isUsingVerticalWriting(),
|
|
5625
5677
|
itemHeight: this.layout.layoutInfo.height,
|
|
5626
5678
|
itemWidth: this.layout.layoutInfo.width,
|
|
@@ -5631,22 +5683,22 @@ class Qt extends ue {
|
|
|
5631
5683
|
});
|
|
5632
5684
|
}
|
|
5633
5685
|
}
|
|
5634
|
-
const
|
|
5686
|
+
const ws = (n, e, t) => {
|
|
5635
5687
|
const i = n.ownerDocument.createElement("div");
|
|
5636
5688
|
return i.classList.add("spineItem"), i.classList.add(`spineItem-${e.renditionLayout ?? "reflowable"}`), i.style.cssText = `
|
|
5637
5689
|
position: absolute;
|
|
5638
5690
|
overflow: hidden;
|
|
5639
5691
|
`, i.dataset.isReady = "false", t.execute("item.onBeforeContainerCreated", void 0, { element: i }), i;
|
|
5640
5692
|
};
|
|
5641
|
-
class
|
|
5693
|
+
class xs extends X {
|
|
5642
5694
|
constructor(e, t, i, o, s) {
|
|
5643
5695
|
super(), this.context = e, this.spineItemsManager = t, this.spineLocator = i, this.settings = o, this.spineLayout = s, this.forcedOpenSubject = new H([]);
|
|
5644
5696
|
const r = this.forcedOpenSubject.pipe(
|
|
5645
5697
|
S((u) => [...new Set(u.flat())].sort()),
|
|
5646
|
-
z(
|
|
5698
|
+
z(yn),
|
|
5647
5699
|
K({ bufferSize: 1, refCount: !0 })
|
|
5648
5700
|
);
|
|
5649
|
-
|
|
5701
|
+
x(
|
|
5650
5702
|
this.context.bridgeEvent.navigation$,
|
|
5651
5703
|
this.spineLayout.layout$,
|
|
5652
5704
|
r,
|
|
@@ -5655,8 +5707,8 @@ class ws extends X {
|
|
|
5655
5707
|
// this can be changed by whatever we want and SHOULD not break navigation.
|
|
5656
5708
|
// Ideally loading faster is better but loading too close to user navigating can
|
|
5657
5709
|
// be dangerous.
|
|
5658
|
-
Se(100,
|
|
5659
|
-
|
|
5710
|
+
Se(100, ce),
|
|
5711
|
+
Re(this.context.bridgeEvent.viewportFree$),
|
|
5660
5712
|
O(this.context.bridgeEvent.navigation$, r),
|
|
5661
5713
|
S(([, u, l]) => {
|
|
5662
5714
|
const { numberOfAdjacentSpineItemToPreLoad: d } = o.values, { beginIndex: g = 0, endIndex: h = 0 } = i.getVisibleSpineItemsFromPosition({
|
|
@@ -5689,16 +5741,16 @@ class ws extends X {
|
|
|
5689
5741
|
super.destroy(), this.forcedOpenSubject.complete();
|
|
5690
5742
|
}
|
|
5691
5743
|
}
|
|
5692
|
-
const
|
|
5744
|
+
const tn = (n, e, t) => {
|
|
5693
5745
|
const i = (t.width - e.width) / 2, o = (t.height - e.height) / 2;
|
|
5694
|
-
return new
|
|
5746
|
+
return new ue({
|
|
5695
5747
|
x: n.x - i,
|
|
5696
5748
|
y: n.y - o
|
|
5697
5749
|
});
|
|
5698
5750
|
};
|
|
5699
5751
|
class ye extends DOMRect {
|
|
5700
5752
|
constructor() {
|
|
5701
|
-
super(...arguments), this.__symbol = Symbol("ViewportPosition");
|
|
5753
|
+
super(...arguments), this.__symbol = /* @__PURE__ */ Symbol("ViewportPosition");
|
|
5702
5754
|
}
|
|
5703
5755
|
static from(e, t) {
|
|
5704
5756
|
if (t) {
|
|
@@ -5716,15 +5768,15 @@ class ye extends DOMRect {
|
|
|
5716
5768
|
}
|
|
5717
5769
|
class Ps {
|
|
5718
5770
|
constructor({ width: e, height: t }) {
|
|
5719
|
-
this.__symbol = Symbol("AbsoluteViewport"), this.width = e, this.height = t;
|
|
5771
|
+
this.__symbol = /* @__PURE__ */ Symbol("AbsoluteViewport"), this.width = e, this.height = t;
|
|
5720
5772
|
}
|
|
5721
5773
|
}
|
|
5722
|
-
class
|
|
5774
|
+
class $s {
|
|
5723
5775
|
constructor({ width: e, height: t }) {
|
|
5724
|
-
this.__symbol = Symbol("RelativeViewport"), this.width = e, this.height = t;
|
|
5776
|
+
this.__symbol = /* @__PURE__ */ Symbol("RelativeViewport"), this.width = e, this.height = t;
|
|
5725
5777
|
}
|
|
5726
5778
|
}
|
|
5727
|
-
const
|
|
5779
|
+
const Ts = ({
|
|
5728
5780
|
pageIndex: n,
|
|
5729
5781
|
spineItemOrId: e,
|
|
5730
5782
|
spineItemsManager: t
|
|
@@ -5746,7 +5798,7 @@ const $s = ({
|
|
|
5746
5798
|
{ currentAbsolutePage: 0, found: !1 }
|
|
5747
5799
|
);
|
|
5748
5800
|
return s;
|
|
5749
|
-
},
|
|
5801
|
+
}, Fs = ({
|
|
5750
5802
|
itemHeight: n,
|
|
5751
5803
|
itemWidth: e,
|
|
5752
5804
|
visibleWidthOfItem: t,
|
|
@@ -5755,7 +5807,7 @@ const $s = ({
|
|
|
5755
5807
|
}) => {
|
|
5756
5808
|
const s = t / e, r = i / n;
|
|
5757
5809
|
return o.type === "percentage" ? s >= o.value && r >= o.value : t >= o.value && i >= o.value;
|
|
5758
|
-
},
|
|
5810
|
+
}, Ls = ({
|
|
5759
5811
|
visibleWidthOfItem: n,
|
|
5760
5812
|
visibleHeightOfItem: e,
|
|
5761
5813
|
threshold: t,
|
|
@@ -5763,7 +5815,7 @@ const $s = ({
|
|
|
5763
5815
|
}) => {
|
|
5764
5816
|
const o = n / i.width, s = e / i.height;
|
|
5765
5817
|
return t.type === "percentage" ? s >= t.value && o >= t.value : e >= t.value && n >= t.value;
|
|
5766
|
-
},
|
|
5818
|
+
}, nn = ({
|
|
5767
5819
|
itemPosition: {
|
|
5768
5820
|
bottom: n,
|
|
5769
5821
|
left: e,
|
|
@@ -5787,14 +5839,14 @@ const $s = ({
|
|
|
5787
5839
|
Math.min(n, g) - Math.max(i, d)
|
|
5788
5840
|
);
|
|
5789
5841
|
if (h <= 0 || p <= 0) return { visible: !1 };
|
|
5790
|
-
const y =
|
|
5842
|
+
const y = Ls({
|
|
5791
5843
|
threshold: r,
|
|
5792
5844
|
visibleHeightOfItem: p,
|
|
5793
5845
|
visibleWidthOfItem: h,
|
|
5794
5846
|
viewportPosition: a
|
|
5795
5847
|
});
|
|
5796
5848
|
return c ? { visible: y } : {
|
|
5797
|
-
visible:
|
|
5849
|
+
visible: Fs({
|
|
5798
5850
|
itemHeight: s,
|
|
5799
5851
|
itemWidth: o,
|
|
5800
5852
|
threshold: r,
|
|
@@ -5802,7 +5854,7 @@ const $s = ({
|
|
|
5802
5854
|
visibleWidthOfItem: h
|
|
5803
5855
|
}) || y
|
|
5804
5856
|
};
|
|
5805
|
-
},
|
|
5857
|
+
}, Ze = ({
|
|
5806
5858
|
position: n,
|
|
5807
5859
|
spineItemsManager: e,
|
|
5808
5860
|
spineLayout: t
|
|
@@ -5812,13 +5864,13 @@ const $s = ({
|
|
|
5812
5864
|
return u && l;
|
|
5813
5865
|
});
|
|
5814
5866
|
return n.x === 0 && !i ? e.items[0] : i;
|
|
5815
|
-
},
|
|
5867
|
+
}, Ue = ({
|
|
5816
5868
|
spineItemPosition: n,
|
|
5817
5869
|
itemLayout: { left: e, top: t }
|
|
5818
5870
|
}) => new M({
|
|
5819
5871
|
x: e + n.x,
|
|
5820
5872
|
y: t + n.y
|
|
5821
|
-
}),
|
|
5873
|
+
}), Ms = ({
|
|
5822
5874
|
position: n,
|
|
5823
5875
|
threshold: e,
|
|
5824
5876
|
restrictToScreen: t,
|
|
@@ -5827,20 +5879,20 @@ const $s = ({
|
|
|
5827
5879
|
useAbsoluteViewport: s = !0,
|
|
5828
5880
|
viewport: r
|
|
5829
5881
|
}) => {
|
|
5830
|
-
const a =
|
|
5882
|
+
const a = Ze({
|
|
5831
5883
|
position: n,
|
|
5832
5884
|
spineItemsManager: i,
|
|
5833
5885
|
spineLayout: o
|
|
5834
5886
|
}) || i.get(0), c = i.items.reduce(
|
|
5835
5887
|
(h, p) => {
|
|
5836
|
-
const m = o.getSpineItemSpineLayoutInfo(p), y = s ? r.absoluteViewport : r.relativeViewport, f =
|
|
5888
|
+
const m = o.getSpineItemSpineLayoutInfo(p), y = s ? r.absoluteViewport : r.relativeViewport, f = tn(
|
|
5837
5889
|
n,
|
|
5838
5890
|
r.absoluteViewport,
|
|
5839
5891
|
y
|
|
5840
5892
|
), b = ye.from(
|
|
5841
5893
|
f,
|
|
5842
5894
|
y
|
|
5843
|
-
), { visible: I } =
|
|
5895
|
+
), { visible: I } = nn({
|
|
5844
5896
|
itemPosition: m,
|
|
5845
5897
|
threshold: e,
|
|
5846
5898
|
viewportPosition: b,
|
|
@@ -5856,7 +5908,7 @@ const $s = ({
|
|
|
5856
5908
|
beginIndex: d ?? 0,
|
|
5857
5909
|
endIndex: g ?? 0
|
|
5858
5910
|
};
|
|
5859
|
-
},
|
|
5911
|
+
}, Cs = ({
|
|
5860
5912
|
spineItemsManager: n,
|
|
5861
5913
|
context: e,
|
|
5862
5914
|
spineItemLocator: t,
|
|
@@ -5877,7 +5929,7 @@ const $s = ({
|
|
|
5877
5929
|
x: Math.max(p.x - y, 0),
|
|
5878
5930
|
y: Math.max(p.y - f, 0)
|
|
5879
5931
|
});
|
|
5880
|
-
}, a = (p) =>
|
|
5932
|
+
}, a = (p) => Ue({
|
|
5881
5933
|
spineItemPosition: new C({ x: 0, y: 0 }),
|
|
5882
5934
|
itemLayout: o.getSpineItemSpineLayoutInfo(p)
|
|
5883
5935
|
}), c = (p) => n.items.find((m) => m.renderer.getDocumentFrame() === p), u = (p, m, y) => {
|
|
@@ -5902,12 +5954,12 @@ const $s = ({
|
|
|
5902
5954
|
useAbsoluteViewport: b = !0,
|
|
5903
5955
|
viewport: I
|
|
5904
5956
|
}) => {
|
|
5905
|
-
const F = y.numberOfPages, A = Array.from(Array(F)).map((
|
|
5906
|
-
const
|
|
5957
|
+
const F = y.numberOfPages, A = Array.from(Array(F)).map((re, be) => {
|
|
5958
|
+
const Ae = t.getSpineItemPositionFromPageIndex({
|
|
5907
5959
|
pageIndex: be,
|
|
5908
5960
|
spineItem: y
|
|
5909
|
-
}), le =
|
|
5910
|
-
spineItemPosition:
|
|
5961
|
+
}), le = Ue({
|
|
5962
|
+
spineItemPosition: Ae,
|
|
5911
5963
|
itemLayout: o.getSpineItemSpineLayoutInfo(y)
|
|
5912
5964
|
});
|
|
5913
5965
|
return {
|
|
@@ -5922,21 +5974,21 @@ const $s = ({
|
|
|
5922
5974
|
}
|
|
5923
5975
|
};
|
|
5924
5976
|
}).reduce(
|
|
5925
|
-
(
|
|
5926
|
-
const le = b ? I.absoluteViewport : I.relativeViewport,
|
|
5977
|
+
(re, { absolutePosition: be, index: Ae }) => {
|
|
5978
|
+
const le = b ? I.absoluteViewport : I.relativeViewport, on = tn(
|
|
5927
5979
|
p,
|
|
5928
5980
|
I.absoluteViewport,
|
|
5929
5981
|
le
|
|
5930
|
-
),
|
|
5931
|
-
|
|
5982
|
+
), sn = ye.from(
|
|
5983
|
+
on,
|
|
5932
5984
|
le
|
|
5933
|
-
), { visible:
|
|
5934
|
-
viewportPosition:
|
|
5985
|
+
), { visible: rn } = nn({
|
|
5986
|
+
viewportPosition: sn,
|
|
5935
5987
|
restrictToScreen: f,
|
|
5936
5988
|
threshold: m,
|
|
5937
5989
|
itemPosition: be
|
|
5938
5990
|
});
|
|
5939
|
-
return
|
|
5991
|
+
return rn ? [...re, Ae] : re;
|
|
5940
5992
|
},
|
|
5941
5993
|
[]
|
|
5942
5994
|
), Y = A[0], B = A[A.length - 1] ?? Y;
|
|
@@ -5952,7 +6004,7 @@ const $s = ({
|
|
|
5952
6004
|
spineItemPosition: m
|
|
5953
6005
|
}) => {
|
|
5954
6006
|
const y = o.getSpineItemSpineLayoutInfo(p);
|
|
5955
|
-
return
|
|
6007
|
+
return Ue({
|
|
5956
6008
|
itemLayout: y,
|
|
5957
6009
|
spineItemPosition: m
|
|
5958
6010
|
});
|
|
@@ -5960,12 +6012,12 @@ const $s = ({
|
|
|
5960
6012
|
/**
|
|
5961
6013
|
* @deprecated use Pages
|
|
5962
6014
|
*/
|
|
5963
|
-
_getAbsolutePageIndexFromPageIndex: (p) =>
|
|
6015
|
+
_getAbsolutePageIndexFromPageIndex: (p) => Ts({
|
|
5964
6016
|
...p,
|
|
5965
6017
|
spineItemsManager: n
|
|
5966
6018
|
}),
|
|
5967
6019
|
getSpineItemPagePositionFromSpinePosition: (p) => {
|
|
5968
|
-
const m =
|
|
6020
|
+
const m = Ze({
|
|
5969
6021
|
position: p,
|
|
5970
6022
|
spineItemsManager: n,
|
|
5971
6023
|
spineLayout: o
|
|
@@ -5994,14 +6046,14 @@ const $s = ({
|
|
|
5994
6046
|
},
|
|
5995
6047
|
getSpinePositionFromSpineItem: a,
|
|
5996
6048
|
getSpineItemPositionFromSpinePosition: r,
|
|
5997
|
-
getSpineItemFromPosition: (p) =>
|
|
6049
|
+
getSpineItemFromPosition: (p) => Ze({
|
|
5998
6050
|
position: p,
|
|
5999
6051
|
spineItemsManager: n,
|
|
6000
6052
|
spineLayout: o
|
|
6001
6053
|
}),
|
|
6002
6054
|
getSpineItemFromIframe: c,
|
|
6003
6055
|
getSpineItemPageIndexFromNode: u,
|
|
6004
|
-
getVisibleSpineItemsFromPosition: (p) =>
|
|
6056
|
+
getVisibleSpineItemsFromPosition: (p) => Ms({
|
|
6005
6057
|
spineItemsManager: n,
|
|
6006
6058
|
spineLayout: o,
|
|
6007
6059
|
viewport: s,
|
|
@@ -6024,10 +6076,10 @@ const $s = ({
|
|
|
6024
6076
|
});
|
|
6025
6077
|
}
|
|
6026
6078
|
};
|
|
6027
|
-
},
|
|
6079
|
+
}, Es = D.namespace("spine"), Ds = ({
|
|
6028
6080
|
position: n,
|
|
6029
6081
|
pageSize: e
|
|
6030
|
-
}) => new
|
|
6082
|
+
}) => new vi({
|
|
6031
6083
|
...n,
|
|
6032
6084
|
left: n.x,
|
|
6033
6085
|
top: n.y,
|
|
@@ -6036,7 +6088,7 @@ const $s = ({
|
|
|
6036
6088
|
bottom: n.y + e.height,
|
|
6037
6089
|
right: n.x + e.width
|
|
6038
6090
|
});
|
|
6039
|
-
class
|
|
6091
|
+
class Rs extends se {
|
|
6040
6092
|
constructor(e, t, i, o, s, r) {
|
|
6041
6093
|
super({ pages: [] }), this.spineLayout = e, this.spineItemsManager = t, this.spineItemLocator = i, this.context = o, this.locator = s, this.viewport = r, this.fromSpineItemPageIndex = (a, c) => this.value.pages.find(
|
|
6042
6094
|
(u) => u.itemIndex === a.index && u.pageIndex === c
|
|
@@ -6054,11 +6106,11 @@ class Ds extends ue {
|
|
|
6054
6106
|
spineItemPosition: f
|
|
6055
6107
|
});
|
|
6056
6108
|
return {
|
|
6057
|
-
absoluteLayout:
|
|
6109
|
+
absoluteLayout: Ds({
|
|
6058
6110
|
pageSize: a,
|
|
6059
6111
|
position: b
|
|
6060
6112
|
}),
|
|
6061
|
-
layout: new
|
|
6113
|
+
layout: new Ii({
|
|
6062
6114
|
left: f.x,
|
|
6063
6115
|
right: f.x + a.width,
|
|
6064
6116
|
top: f.y,
|
|
@@ -6081,11 +6133,11 @@ class Ds extends ue {
|
|
|
6081
6133
|
return k(
|
|
6082
6134
|
c.map((l) => {
|
|
6083
6135
|
const { spineItem: d, ...g } = l;
|
|
6084
|
-
return new
|
|
6136
|
+
return new oe((h) => {
|
|
6085
6137
|
const p = l.spineItem.renderer?.getDocumentFrame();
|
|
6086
6138
|
let m;
|
|
6087
6139
|
p && p?.contentWindow?.document && // very important because it is being used by next functions
|
|
6088
|
-
p.contentWindow.document.body !== null && (m =
|
|
6140
|
+
p.contentWindow.document.body !== null && (m = Mn(
|
|
6089
6141
|
p.contentWindow.document,
|
|
6090
6142
|
l.layout
|
|
6091
6143
|
)), h.next({ ...g, firstVisibleNode: m });
|
|
@@ -6093,19 +6145,19 @@ class Ds extends ue {
|
|
|
6093
6145
|
})
|
|
6094
6146
|
);
|
|
6095
6147
|
}),
|
|
6096
|
-
S((a) => (
|
|
6148
|
+
S((a) => (Es.info("Pages layout", a), { pages: a })),
|
|
6097
6149
|
E()
|
|
6098
6150
|
), this.layout$.pipe(T(this.destroy$)).subscribe(this.next.bind(this));
|
|
6099
6151
|
}
|
|
6100
6152
|
}
|
|
6101
|
-
class
|
|
6153
|
+
class As extends X {
|
|
6102
6154
|
constructor(e, t) {
|
|
6103
6155
|
super(), this.spineItemsManager = e, this.spineLocator = t, this.itemIsReady$ = this.spineItemsManager.items$.pipe(
|
|
6104
6156
|
w((i) => {
|
|
6105
6157
|
const o = i.map(
|
|
6106
6158
|
(s) => s.isReady$.pipe(S((r) => ({ item: s, isReady: r })))
|
|
6107
6159
|
);
|
|
6108
|
-
return
|
|
6160
|
+
return x(...o);
|
|
6109
6161
|
}),
|
|
6110
6162
|
E()
|
|
6111
6163
|
), this.itemResize$ = this.spineItemsManager.items$.pipe(
|
|
@@ -6115,13 +6167,13 @@ class Rs extends X {
|
|
|
6115
6167
|
S((r) => ({ entries: r, item: s }))
|
|
6116
6168
|
)
|
|
6117
6169
|
);
|
|
6118
|
-
return
|
|
6170
|
+
return x(...o);
|
|
6119
6171
|
}),
|
|
6120
6172
|
E()
|
|
6121
6173
|
);
|
|
6122
6174
|
}
|
|
6123
6175
|
}
|
|
6124
|
-
const
|
|
6176
|
+
const Os = ({
|
|
6125
6177
|
horizontalOffset: n,
|
|
6126
6178
|
verticalOffset: e,
|
|
6127
6179
|
context: t,
|
|
@@ -6154,7 +6206,7 @@ const As = ({
|
|
|
6154
6206
|
top: b,
|
|
6155
6207
|
left: I
|
|
6156
6208
|
});
|
|
6157
|
-
const F = p + I, $ = m + b, A = new
|
|
6209
|
+
const F = p + I, $ = m + b, A = new Be({
|
|
6158
6210
|
left: I,
|
|
6159
6211
|
right: F,
|
|
6160
6212
|
top: b,
|
|
@@ -6173,7 +6225,7 @@ const As = ({
|
|
|
6173
6225
|
a.layout.adjustPositionOfElement(
|
|
6174
6226
|
t.isRTL() ? { right: n, top: 0 } : { left: n, top: 0 }
|
|
6175
6227
|
);
|
|
6176
|
-
const y = t.isRTL() ? c.absoluteViewport.width - n - p : n, f = new
|
|
6228
|
+
const y = t.isRTL() ? c.absoluteViewport.width - n - p : n, f = new Be({
|
|
6177
6229
|
right: t.isRTL() ? c.absoluteViewport.width - n : n + p,
|
|
6178
6230
|
left: y,
|
|
6179
6231
|
x: y,
|
|
@@ -6191,22 +6243,22 @@ const As = ({
|
|
|
6191
6243
|
})
|
|
6192
6244
|
);
|
|
6193
6245
|
};
|
|
6194
|
-
class
|
|
6246
|
+
class Ns extends X {
|
|
6195
6247
|
constructor(e, t, i, o) {
|
|
6196
6248
|
super(), this.spineItemsManager = e, this.context = t, this.settings = i, this.viewport = o, this.layoutSubject = new R(), this.spineItemsRelativeLayouts = [], e.items$.pipe(
|
|
6197
|
-
|
|
6249
|
+
P(() => {
|
|
6198
6250
|
this.spineItemsRelativeLayouts = [];
|
|
6199
6251
|
}),
|
|
6200
6252
|
w((r) => {
|
|
6201
6253
|
const a = r.map(
|
|
6202
6254
|
(u) => u.needsLayout$.pipe(
|
|
6203
|
-
|
|
6255
|
+
P(() => {
|
|
6204
6256
|
this.layout();
|
|
6205
6257
|
})
|
|
6206
6258
|
)
|
|
6207
6259
|
), c = r.map(
|
|
6208
6260
|
(u) => u.loaded$.pipe(
|
|
6209
|
-
|
|
6261
|
+
P(() => {
|
|
6210
6262
|
u.isUsingVerticalWriting() ? this.context.update({
|
|
6211
6263
|
hasVerticalWriting: !0
|
|
6212
6264
|
}) : this.context.update({
|
|
@@ -6215,32 +6267,32 @@ class Os extends X {
|
|
|
6215
6267
|
})
|
|
6216
6268
|
)
|
|
6217
6269
|
);
|
|
6218
|
-
return
|
|
6270
|
+
return x(...a, ...c);
|
|
6219
6271
|
})
|
|
6220
6272
|
).pipe(T(this.destroy$)).subscribe();
|
|
6221
6273
|
const s = new H(!1);
|
|
6222
6274
|
this.layout$ = this.layoutSubject.pipe(
|
|
6223
|
-
|
|
6275
|
+
P(() => {
|
|
6224
6276
|
this.spineItemsManager.items.forEach((r) => {
|
|
6225
6277
|
r.markDirty();
|
|
6226
6278
|
});
|
|
6227
6279
|
}),
|
|
6228
6280
|
Se(50),
|
|
6229
6281
|
// queue layout until previous layout is done
|
|
6230
|
-
|
|
6282
|
+
We(
|
|
6231
6283
|
() => s.pipe(
|
|
6232
6284
|
L((r) => !r),
|
|
6233
6285
|
U()
|
|
6234
6286
|
)
|
|
6235
6287
|
),
|
|
6236
|
-
|
|
6288
|
+
We(() => {
|
|
6237
6289
|
s.next(!0);
|
|
6238
|
-
const r = this.context.manifest, a =
|
|
6290
|
+
const r = this.context.manifest, a = Gt(r) ?? !1;
|
|
6239
6291
|
return N(this.spineItemsManager.items).pipe(
|
|
6240
|
-
|
|
6292
|
+
gn(
|
|
6241
6293
|
(u, l, d) => u.pipe(
|
|
6242
6294
|
st(
|
|
6243
|
-
({ horizontalOffset: g, verticalOffset: h }) =>
|
|
6295
|
+
({ horizontalOffset: g, verticalOffset: h }) => Os({
|
|
6244
6296
|
context: this.context,
|
|
6245
6297
|
horizontalOffset: g,
|
|
6246
6298
|
index: d,
|
|
@@ -6273,14 +6325,14 @@ class Os extends X {
|
|
|
6273
6325
|
);
|
|
6274
6326
|
}),
|
|
6275
6327
|
E()
|
|
6276
|
-
),
|
|
6328
|
+
), x(this.layout$).pipe(T(this.destroy$)).subscribe();
|
|
6277
6329
|
}
|
|
6278
6330
|
layout() {
|
|
6279
6331
|
this.layoutSubject.next(void 0);
|
|
6280
6332
|
}
|
|
6281
6333
|
getSpineItemSpineLayoutInfo(e) {
|
|
6282
6334
|
const t = this.spineItemsManager.getSpineItemIndex(e) ?? 0;
|
|
6283
|
-
return this.spineItemsRelativeLayouts[t] || new
|
|
6335
|
+
return this.spineItemsRelativeLayouts[t] || new Be({
|
|
6284
6336
|
left: 0,
|
|
6285
6337
|
right: 0,
|
|
6286
6338
|
top: 0,
|
|
@@ -6298,32 +6350,32 @@ class Os extends X {
|
|
|
6298
6350
|
super.destroy(), this.layoutSubject.complete();
|
|
6299
6351
|
}
|
|
6300
6352
|
}
|
|
6301
|
-
class
|
|
6353
|
+
class Vs extends X {
|
|
6302
6354
|
constructor(e, t, i, o, s, r, a) {
|
|
6303
6355
|
super(), this.context = e, this.pagination = t, this.spineItemsManager = i, this.spineItemLocator = o, this.settings = s, this.hookManager = r, this.viewport = a, this.elementSubject = new H(
|
|
6304
6356
|
void 0
|
|
6305
|
-
), this.element$ = this.elementSubject.asObservable(), this.spineLayout = new
|
|
6357
|
+
), this.element$ = this.elementSubject.asObservable(), this.spineLayout = new Ns(
|
|
6306
6358
|
i,
|
|
6307
6359
|
e,
|
|
6308
6360
|
s,
|
|
6309
6361
|
a
|
|
6310
|
-
), this.locator =
|
|
6362
|
+
), this.locator = Cs({
|
|
6311
6363
|
context: e,
|
|
6312
6364
|
spineItemsManager: i,
|
|
6313
6365
|
spineItemLocator: o,
|
|
6314
6366
|
settings: s,
|
|
6315
6367
|
spineLayout: this.spineLayout,
|
|
6316
6368
|
viewport: a
|
|
6317
|
-
}), this.spineItemsLoader = new
|
|
6369
|
+
}), this.spineItemsLoader = new xs(
|
|
6318
6370
|
this.context,
|
|
6319
6371
|
i,
|
|
6320
6372
|
this.locator,
|
|
6321
6373
|
s,
|
|
6322
6374
|
this.spineLayout
|
|
6323
|
-
), this.spineItemsObserver = new
|
|
6375
|
+
), this.spineItemsObserver = new As(
|
|
6324
6376
|
i,
|
|
6325
6377
|
this.locator
|
|
6326
|
-
), this.pages = new
|
|
6378
|
+
), this.pages = new Rs(
|
|
6327
6379
|
this.spineLayout,
|
|
6328
6380
|
this.spineItemsManager,
|
|
6329
6381
|
this.spineItemLocator,
|
|
@@ -6332,7 +6384,7 @@ class Ns extends X {
|
|
|
6332
6384
|
this.viewport
|
|
6333
6385
|
);
|
|
6334
6386
|
const c = e.watch("rootElement").pipe(
|
|
6335
|
-
|
|
6387
|
+
ae(J),
|
|
6336
6388
|
j((l) => {
|
|
6337
6389
|
const d = l.ownerDocument.createElement("div");
|
|
6338
6390
|
d.style.cssText = `
|
|
@@ -6348,7 +6400,7 @@ class Ns extends X {
|
|
|
6348
6400
|
if (!d) return;
|
|
6349
6401
|
this.spineItemsManager.destroyItems();
|
|
6350
6402
|
const g = l.spineItems.map(
|
|
6351
|
-
(h, p) => new
|
|
6403
|
+
(h, p) => new en(
|
|
6352
6404
|
h,
|
|
6353
6405
|
d,
|
|
6354
6406
|
this.context,
|
|
@@ -6361,7 +6413,7 @@ class Ns extends X {
|
|
|
6361
6413
|
this.spineItemsManager.addMany(g);
|
|
6362
6414
|
})
|
|
6363
6415
|
);
|
|
6364
|
-
|
|
6416
|
+
x(u, c).pipe(G(this.destroy$)).subscribe();
|
|
6365
6417
|
}
|
|
6366
6418
|
get element() {
|
|
6367
6419
|
return this.elementSubject.getValue();
|
|
@@ -6379,7 +6431,7 @@ class Ns extends X {
|
|
|
6379
6431
|
super.destroy(), this.pages.destroy(), this.spineItemsLoader.destroy(), this.elementSubject.getValue()?.remove(), this.elementSubject.complete();
|
|
6380
6432
|
}
|
|
6381
6433
|
}
|
|
6382
|
-
class
|
|
6434
|
+
class js extends X {
|
|
6383
6435
|
constructor(e, t) {
|
|
6384
6436
|
super(), this.context = e, this.settings = t, this.orderedSpineItemsSubject = new H([]), this.items$ = this.orderedSpineItemsSubject.asObservable();
|
|
6385
6437
|
}
|
|
@@ -6393,7 +6445,7 @@ class Vs extends X {
|
|
|
6393
6445
|
return i > o ? "after" : i === o ? "same" : "before";
|
|
6394
6446
|
}
|
|
6395
6447
|
getSpineItemIndex(e) {
|
|
6396
|
-
const t = e instanceof
|
|
6448
|
+
const t = e instanceof en ? e : this.get(e);
|
|
6397
6449
|
if (!t) return;
|
|
6398
6450
|
const i = this.orderedSpineItemsSubject.value.indexOf(t);
|
|
6399
6451
|
return i < 0 ? void 0 : i;
|
|
@@ -6422,10 +6474,10 @@ class Vs extends X {
|
|
|
6422
6474
|
});
|
|
6423
6475
|
}
|
|
6424
6476
|
}
|
|
6425
|
-
class
|
|
6477
|
+
class ks extends se {
|
|
6426
6478
|
constructor(e, t) {
|
|
6427
6479
|
const i = document.createElement("div");
|
|
6428
|
-
i.setAttribute(`data-${
|
|
6480
|
+
i.setAttribute(`data-${si}`, ""), super({
|
|
6429
6481
|
element: i,
|
|
6430
6482
|
pageSize: {
|
|
6431
6483
|
width: 1,
|
|
@@ -6435,17 +6487,17 @@ class js extends ue {
|
|
|
6435
6487
|
height: 1
|
|
6436
6488
|
}), this.context = e, this.settingsManager = t;
|
|
6437
6489
|
const o = this.settingsManager.watch(["computedSpreadMode"]).pipe(
|
|
6438
|
-
|
|
6490
|
+
P(() => {
|
|
6439
6491
|
this.mergeCompare({
|
|
6440
6492
|
pageSize: this.calculatePageSize(this.value)
|
|
6441
6493
|
});
|
|
6442
6494
|
})
|
|
6443
6495
|
), s = this.context.watch("rootElement").pipe(
|
|
6444
|
-
|
|
6496
|
+
P(() => {
|
|
6445
6497
|
this.layout();
|
|
6446
6498
|
})
|
|
6447
6499
|
);
|
|
6448
|
-
|
|
6500
|
+
x(o, s).pipe(T(this.destroy$)).subscribe();
|
|
6449
6501
|
}
|
|
6450
6502
|
calculatePageSize(e) {
|
|
6451
6503
|
const { computedSpreadMode: t } = this.settingsManager.values;
|
|
@@ -6493,18 +6545,18 @@ class js extends ue {
|
|
|
6493
6545
|
*/
|
|
6494
6546
|
get relativeViewport() {
|
|
6495
6547
|
const e = this.absoluteViewport, t = this.scaleFactor;
|
|
6496
|
-
return new
|
|
6548
|
+
return new $s({
|
|
6497
6549
|
width: e.width / t,
|
|
6498
6550
|
height: e.height / t
|
|
6499
6551
|
});
|
|
6500
6552
|
}
|
|
6501
6553
|
}
|
|
6502
|
-
const
|
|
6503
|
-
const e = crypto.randomUUID(), t = new R(), i = new R(), o = new
|
|
6554
|
+
const $t = `${Ut}-core`, Us = (n) => {
|
|
6555
|
+
const e = crypto.randomUUID(), t = new R(), i = new R(), o = new No(), s = new Ao(), r = new bs(n, s), a = new Oo(s, r), c = new js(s, r), u = new ks(s, r), l = Kt({
|
|
6504
6556
|
context: s,
|
|
6505
6557
|
settings: r,
|
|
6506
6558
|
viewport: u
|
|
6507
|
-
}), d = new
|
|
6559
|
+
}), d = new ms(s, c), g = new Vs(
|
|
6508
6560
|
s,
|
|
6509
6561
|
d,
|
|
6510
6562
|
c,
|
|
@@ -6512,21 +6564,21 @@ const xt = `${kt}-core`, ks = (n) => {
|
|
|
6512
6564
|
r,
|
|
6513
6565
|
o,
|
|
6514
6566
|
u
|
|
6515
|
-
), h =
|
|
6567
|
+
), h = hs({
|
|
6516
6568
|
context: s,
|
|
6517
6569
|
spineItemsManager: c,
|
|
6518
6570
|
hookManager: o,
|
|
6519
6571
|
spine: g,
|
|
6520
6572
|
settings: r,
|
|
6521
6573
|
viewport: u
|
|
6522
|
-
}), p = new
|
|
6574
|
+
}), p = new fs(
|
|
6523
6575
|
s,
|
|
6524
6576
|
d,
|
|
6525
6577
|
c,
|
|
6526
6578
|
g,
|
|
6527
6579
|
l
|
|
6528
6580
|
);
|
|
6529
|
-
h.
|
|
6581
|
+
h.navigationState$.subscribe(s.bridgeEvent.viewportStateSubject), h.navigation$.subscribe(s.bridgeEvent.navigationSubject), h.locker.isLocked$.subscribe(
|
|
6530
6582
|
s.bridgeEvent.navigationIsLockedSubject
|
|
6531
6583
|
), d.subscribe(s.bridgeEvent.paginationSubject);
|
|
6532
6584
|
const m = () => {
|
|
@@ -6538,21 +6590,21 @@ const xt = `${kt}-core`, ks = (n) => {
|
|
|
6538
6590
|
return;
|
|
6539
6591
|
}
|
|
6540
6592
|
D.log("load", { options: $ });
|
|
6541
|
-
const B =
|
|
6593
|
+
const B = zs(A, e);
|
|
6542
6594
|
s.update({
|
|
6543
6595
|
manifest: Y,
|
|
6544
6596
|
rootElement: B
|
|
6545
6597
|
}), m();
|
|
6546
|
-
}, f = r.watch(["computedSpreadMode"]).pipe(
|
|
6598
|
+
}, f = r.watch(["computedSpreadMode"]).pipe(Ct(1), j(m)), b = t.pipe(
|
|
6547
6599
|
j(() => {
|
|
6548
6600
|
const $ = s.value.rootElement;
|
|
6549
6601
|
$ && ($.style.setProperty("overflow", "hidden"), u.layout(), g.layout());
|
|
6550
6602
|
}),
|
|
6551
6603
|
G(i)
|
|
6552
|
-
), I =
|
|
6553
|
-
|
|
6604
|
+
), I = x(b, f).subscribe();
|
|
6605
|
+
Ee(document, $t, Vo);
|
|
6554
6606
|
const F = () => {
|
|
6555
|
-
|
|
6607
|
+
De(document, $t), I.unsubscribe(), c.destroy(), p.destroy(), r.destroy(), d.destroy(), s.destroy(), h.destroy(), g.destroy(), a.destroy(), i.next(), i.complete(), u.destroy();
|
|
6556
6608
|
};
|
|
6557
6609
|
return {
|
|
6558
6610
|
id: e,
|
|
@@ -6560,13 +6612,13 @@ const xt = `${kt}-core`, ks = (n) => {
|
|
|
6560
6612
|
spine: g,
|
|
6561
6613
|
hookManager: o,
|
|
6562
6614
|
cfi: {
|
|
6563
|
-
generateCfiFromRange:
|
|
6615
|
+
generateCfiFromRange: ro,
|
|
6564
6616
|
parseCfi: it,
|
|
6565
|
-
generateCfiForSpineItemPage: ($) =>
|
|
6617
|
+
generateCfiForSpineItemPage: ($) => Xe({
|
|
6566
6618
|
...$,
|
|
6567
6619
|
spine: g
|
|
6568
6620
|
}),
|
|
6569
|
-
resolveCfi: ($) =>
|
|
6621
|
+
resolveCfi: ($) => Yt({ ...$, spineItemsManager: c })
|
|
6570
6622
|
},
|
|
6571
6623
|
navigation: h,
|
|
6572
6624
|
spineItemsObserver: g.spineItemsObserver,
|
|
@@ -6601,31 +6653,31 @@ const xt = `${kt}-core`, ks = (n) => {
|
|
|
6601
6653
|
destroy$: i
|
|
6602
6654
|
}
|
|
6603
6655
|
};
|
|
6604
|
-
},
|
|
6656
|
+
}, zs = (n, e) => (n.style.cssText = `
|
|
6605
6657
|
${n.style.cssText}
|
|
6606
6658
|
background-color: white;
|
|
6607
6659
|
position: relative;
|
|
6608
|
-
`, n.classList.add(`${W}-reader`), n.setAttribute(
|
|
6660
|
+
`, n.classList.add(`${W}-reader`), n.setAttribute(oi, e), n.setAttribute("data-prose-reader-container", e), n), tr = (
|
|
6609
6661
|
//__
|
|
6610
|
-
|
|
6611
|
-
|
|
6612
|
-
|
|
6613
|
-
|
|
6614
|
-
|
|
6615
|
-
|
|
6616
|
-
|
|
6617
|
-
|
|
6618
|
-
|
|
6619
|
-
|
|
6620
|
-
|
|
6621
|
-
|
|
6622
|
-
|
|
6623
|
-
|
|
6624
|
-
|
|
6625
|
-
|
|
6626
|
-
|
|
6662
|
+
Io(
|
|
6663
|
+
Zn(
|
|
6664
|
+
Oi(
|
|
6665
|
+
xo(
|
|
6666
|
+
Gn(
|
|
6667
|
+
zn(
|
|
6668
|
+
mo(
|
|
6669
|
+
wo(
|
|
6670
|
+
Do(
|
|
6671
|
+
Gi(
|
|
6672
|
+
bi(
|
|
6673
|
+
Vi(
|
|
6674
|
+
Wn(
|
|
6675
|
+
vo(
|
|
6676
|
+
po(
|
|
6677
|
+
Ei(
|
|
6678
|
+
Xn(
|
|
6627
6679
|
// __
|
|
6628
|
-
|
|
6680
|
+
Us
|
|
6629
6681
|
)
|
|
6630
6682
|
)
|
|
6631
6683
|
)
|
|
@@ -6643,83 +6695,83 @@ const xt = `${kt}-core`, ks = (n) => {
|
|
|
6643
6695
|
)
|
|
6644
6696
|
)
|
|
6645
6697
|
)
|
|
6646
|
-
),
|
|
6698
|
+
), nr = (n) => (e) => n(e);
|
|
6647
6699
|
export {
|
|
6648
|
-
|
|
6649
|
-
|
|
6650
|
-
|
|
6700
|
+
_t as AbstractSpinePosition,
|
|
6701
|
+
Ao as Context,
|
|
6702
|
+
zo as ControlledNavigationController,
|
|
6651
6703
|
X as DestroyableClass,
|
|
6652
6704
|
fe as DocumentRenderer,
|
|
6653
|
-
|
|
6654
|
-
|
|
6705
|
+
Oo as Features,
|
|
6706
|
+
oi as HTML_ATTRIBUTE_DATA_READER_ID,
|
|
6655
6707
|
W as HTML_PREFIX,
|
|
6656
|
-
|
|
6657
|
-
|
|
6658
|
-
|
|
6659
|
-
|
|
6660
|
-
|
|
6661
|
-
|
|
6708
|
+
ri as HTML_PREFIX_SCROLL_NAVIGATOR,
|
|
6709
|
+
si as HTML_PREFIX_VIEWPORT,
|
|
6710
|
+
Ut as HTML_STYLE_PREFIX,
|
|
6711
|
+
No as HookManager,
|
|
6712
|
+
ii as ITEM_EXTENSION_VALID_FOR_FRAME_SRC,
|
|
6713
|
+
ts as InternalNavigator,
|
|
6662
6714
|
nt as LayoutEntry,
|
|
6663
|
-
|
|
6664
|
-
|
|
6665
|
-
|
|
6666
|
-
|
|
6667
|
-
|
|
6668
|
-
|
|
6669
|
-
|
|
6715
|
+
Zt as Locker,
|
|
6716
|
+
Ks as PAGINATION_UPDATE_AFTER_VIEWPORT_ADJUSTMENT_DEBOUNCE,
|
|
6717
|
+
Zs as PROSE_READER_NAMESPACE,
|
|
6718
|
+
Rs as Pages,
|
|
6719
|
+
ms as Pagination,
|
|
6720
|
+
fs as PaginationController,
|
|
6721
|
+
se as ReactiveEntity,
|
|
6670
6722
|
tt as ResourceHandler,
|
|
6671
|
-
|
|
6672
|
-
|
|
6673
|
-
|
|
6674
|
-
|
|
6675
|
-
|
|
6676
|
-
|
|
6677
|
-
|
|
6678
|
-
|
|
6723
|
+
lo as ResourcesLocator,
|
|
6724
|
+
Lo as ScrollNavigationController,
|
|
6725
|
+
ft as ScrollPosition,
|
|
6726
|
+
Ss as SettingsManager,
|
|
6727
|
+
Vs as Spine,
|
|
6728
|
+
en as SpineItem,
|
|
6729
|
+
Ii as SpineItemPageLayout,
|
|
6730
|
+
vi as SpineItemPageSpineLayout,
|
|
6679
6731
|
C as SpineItemPosition,
|
|
6680
|
-
|
|
6681
|
-
|
|
6682
|
-
|
|
6732
|
+
Be as SpineItemSpineLayout,
|
|
6733
|
+
js as SpineItemsManager,
|
|
6734
|
+
As as SpineItemsObserver,
|
|
6683
6735
|
M as SpinePosition,
|
|
6684
|
-
|
|
6685
|
-
|
|
6686
|
-
|
|
6687
|
-
|
|
6688
|
-
|
|
6689
|
-
|
|
6690
|
-
|
|
6736
|
+
Fo as UnboundScrollPosition,
|
|
6737
|
+
Ne as UnboundSpineItemPagePosition,
|
|
6738
|
+
ue as UnboundSpinePosition,
|
|
6739
|
+
Js as VIEWPORT_ADJUSTMENT_THROTTLE,
|
|
6740
|
+
ks as Viewport,
|
|
6741
|
+
uo as consolidate,
|
|
6742
|
+
tr as createReader,
|
|
6691
6743
|
ct as deferIdle,
|
|
6692
|
-
|
|
6693
|
-
|
|
6694
|
-
|
|
6744
|
+
Yn as deferNextResult,
|
|
6745
|
+
Xe as generateCfiForSpineItemPage,
|
|
6746
|
+
ro as generateCfiFromRange,
|
|
6695
6747
|
he as generateRootCfi,
|
|
6696
6748
|
at as getAttributeValueFromString,
|
|
6697
|
-
|
|
6749
|
+
qs as getBase64FromBlob,
|
|
6698
6750
|
Ke as getFrameViewportInfo,
|
|
6699
|
-
|
|
6700
|
-
|
|
6701
|
-
|
|
6702
|
-
|
|
6751
|
+
er as getItemAnchor,
|
|
6752
|
+
bi as htmlEnhancer,
|
|
6753
|
+
Vt as idle,
|
|
6754
|
+
jn as injectCSSToFrame,
|
|
6703
6755
|
J as isDefined,
|
|
6704
|
-
|
|
6705
|
-
|
|
6706
|
-
|
|
6707
|
-
|
|
6708
|
-
|
|
6709
|
-
|
|
6710
|
-
|
|
6756
|
+
Ot as isHtmlElement,
|
|
6757
|
+
Nn as isHtmlTagElement,
|
|
6758
|
+
Ye as isRootCfi,
|
|
6759
|
+
sr as isShallowEqual,
|
|
6760
|
+
Ei as layoutEnhancer,
|
|
6761
|
+
Nt as mapKeysTo,
|
|
6762
|
+
Ys as observeIntersection,
|
|
6711
6763
|
ut as observeMutation,
|
|
6712
6764
|
et as observeResize,
|
|
6713
|
-
|
|
6765
|
+
po as paginationEnhancer,
|
|
6714
6766
|
it as parseCfi,
|
|
6715
|
-
|
|
6716
|
-
|
|
6717
|
-
|
|
6718
|
-
|
|
6719
|
-
|
|
6720
|
-
|
|
6721
|
-
|
|
6722
|
-
|
|
6767
|
+
Xs as removeCSS,
|
|
6768
|
+
Yt as resolveCfi,
|
|
6769
|
+
nr as rootEnhancer,
|
|
6770
|
+
Ds as spinePositionToSpineItemSpineLayout,
|
|
6771
|
+
ie as upsertCSSToFrame,
|
|
6772
|
+
kn as waitForFrameLoad,
|
|
6773
|
+
Un as waitForFrameReady,
|
|
6774
|
+
Re as waitForSwitch,
|
|
6723
6775
|
Qe as watchKeys
|
|
6724
6776
|
};
|
|
6725
6777
|
//# sourceMappingURL=index.js.map
|