@readium/navigator 2.0.0-beta.2 → 2.0.0-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +126 -166
- package/dist/index.umd.cjs +12 -12
- package/package.json +1 -1
- package/src/epub/css/ReadiumCSS.ts +3 -19
- package/src/epub/preferences/EpubDefaults.ts +2 -5
- package/src/epub/preferences/EpubPreferences.ts +2 -5
- package/src/epub/preferences/EpubPreferencesEditor.ts +1 -14
- package/src/epub/preferences/EpubSettings.ts +0 -7
- package/src/helpers/lineLength.ts +22 -74
- package/types/src/epub/css/ReadiumCSS.d.ts +0 -1
- package/types/src/epub/preferences/EpubDefaults.d.ts +0 -2
- package/types/src/epub/preferences/EpubPreferences.d.ts +0 -2
- package/types/src/epub/preferences/EpubPreferencesEditor.d.ts +0 -1
- package/types/src/epub/preferences/EpubSettings.d.ts +0 -2
- package/types/src/helpers/lineLength.d.ts +2 -16
package/dist/index.js
CHANGED
|
@@ -26,7 +26,7 @@ let xA = class Ze {
|
|
|
26
26
|
return this.compression !== void 0 && (t.compression = this.compression), this.originalLength !== void 0 && (t.originalLength = this.originalLength), this.profile !== void 0 && (t.profile = this.profile), this.scheme !== void 0 && (t.scheme = this.scheme), t;
|
|
27
27
|
}
|
|
28
28
|
};
|
|
29
|
-
class
|
|
29
|
+
class R {
|
|
30
30
|
constructor(t) {
|
|
31
31
|
this.otherProperties = t;
|
|
32
32
|
}
|
|
@@ -35,7 +35,7 @@ class Q {
|
|
|
35
35
|
*/
|
|
36
36
|
static deserialize(t) {
|
|
37
37
|
if (t)
|
|
38
|
-
return new
|
|
38
|
+
return new R(t);
|
|
39
39
|
}
|
|
40
40
|
/**
|
|
41
41
|
* Serializes a [Properties] to its RWPM JSON representation.
|
|
@@ -50,19 +50,19 @@ class Q {
|
|
|
50
50
|
const e = Object.assign({}, this.otherProperties);
|
|
51
51
|
for (const A in t)
|
|
52
52
|
e[A] = t[A];
|
|
53
|
-
return new
|
|
53
|
+
return new R(e);
|
|
54
54
|
}
|
|
55
55
|
}
|
|
56
|
-
Object.defineProperty(
|
|
56
|
+
Object.defineProperty(R.prototype, "encryption", {
|
|
57
57
|
get: function() {
|
|
58
58
|
return xA.deserialize(this.otherProperties.encrypted);
|
|
59
59
|
}
|
|
60
60
|
});
|
|
61
|
-
var p = /* @__PURE__ */ ((i) => (i.fixed = "fixed", i.reflowable = "reflowable", i))(p || {}), it = /* @__PURE__ */ ((i) => (i.auto = "auto", i.landscape = "landscape", i.portrait = "portrait", i))(it || {}), W = /* @__PURE__ */ ((i) => (i.left = "left", i.right = "right", i.center = "center", i))(W || {}),
|
|
62
|
-
|
|
61
|
+
var p = /* @__PURE__ */ ((i) => (i.fixed = "fixed", i.reflowable = "reflowable", i))(p || {}), it = /* @__PURE__ */ ((i) => (i.auto = "auto", i.landscape = "landscape", i.portrait = "portrait", i))(it || {}), W = /* @__PURE__ */ ((i) => (i.left = "left", i.right = "right", i.center = "center", i))(W || {}), Ct = /* @__PURE__ */ ((i) => (i.auto = "auto", i.both = "both", i.none = "none", i.landscape = "landscape", i))(Ct || {});
|
|
62
|
+
R.prototype.getContains = function() {
|
|
63
63
|
return new Set(this.otherProperties.contains || []);
|
|
64
64
|
};
|
|
65
|
-
|
|
65
|
+
R.prototype.getLayout = function() {
|
|
66
66
|
return this.otherProperties.layout;
|
|
67
67
|
};
|
|
68
68
|
class d {
|
|
@@ -688,7 +688,7 @@ class X {
|
|
|
688
688
|
type: t.type,
|
|
689
689
|
title: t.title,
|
|
690
690
|
rels: t.rel ? t.rel instanceof Array ? new Set(t.rel) : /* @__PURE__ */ new Set([t.rel]) : void 0,
|
|
691
|
-
properties:
|
|
691
|
+
properties: R.deserialize(t.properties),
|
|
692
692
|
height: D(t.height),
|
|
693
693
|
width: D(t.width),
|
|
694
694
|
duration: D(t.duration),
|
|
@@ -738,7 +738,7 @@ class X {
|
|
|
738
738
|
addProperties(t) {
|
|
739
739
|
var e;
|
|
740
740
|
const A = X.deserialize(this.serialize());
|
|
741
|
-
return A.properties = A.properties ? (e = A.properties) == null ? void 0 : e.add(t) : new
|
|
741
|
+
return A.properties = A.properties ? (e = A.properties) == null ? void 0 : e.add(t) : new R(t), A;
|
|
742
742
|
}
|
|
743
743
|
/**
|
|
744
744
|
* Creates a [Locator] from a reading order [Link].
|
|
@@ -1078,46 +1078,46 @@ let PA = class iA {
|
|
|
1078
1078
|
return this.since !== void 0 && (t.since = this.since.toISOString()), this.until !== void 0 && (t.until = this.until.toISOString()), t;
|
|
1079
1079
|
}
|
|
1080
1080
|
};
|
|
1081
|
-
|
|
1081
|
+
R.prototype.getNumberOfItems = function() {
|
|
1082
1082
|
return D(this.otherProperties.numberOfItems);
|
|
1083
1083
|
};
|
|
1084
|
-
|
|
1084
|
+
R.prototype.getPrice = function() {
|
|
1085
1085
|
return bA.deserialize(this.otherProperties.price);
|
|
1086
1086
|
};
|
|
1087
|
-
|
|
1087
|
+
R.prototype.getIndirectAcquisitions = function() {
|
|
1088
1088
|
const i = this.otherProperties.indirectAcquisition;
|
|
1089
1089
|
if (i && i instanceof Array)
|
|
1090
1090
|
return i.map((t) => vA.deserialize(t)).filter((t) => t !== void 0);
|
|
1091
1091
|
};
|
|
1092
|
-
|
|
1092
|
+
R.prototype.getHolds = function() {
|
|
1093
1093
|
return te.deserialize(this.otherProperties.holds);
|
|
1094
1094
|
};
|
|
1095
|
-
|
|
1095
|
+
R.prototype.getCopies = function() {
|
|
1096
1096
|
return ee.deserialize(this.otherProperties.copies);
|
|
1097
1097
|
};
|
|
1098
|
-
|
|
1098
|
+
R.prototype.getAvailability = function() {
|
|
1099
1099
|
return PA.deserialize(this.otherProperties.availability);
|
|
1100
1100
|
};
|
|
1101
|
-
|
|
1101
|
+
R.prototype.getAuthenticate = function() {
|
|
1102
1102
|
return X.deserialize(this.otherProperties.authenticate);
|
|
1103
1103
|
};
|
|
1104
1104
|
var I = /* @__PURE__ */ ((i) => (i.auto = "auto", i.btt = "btt", i.ltr = "ltr", i.rtl = "rtl", i.ttb = "ttb", i))(I || {});
|
|
1105
|
-
|
|
1105
|
+
R.prototype.getClipped = function() {
|
|
1106
1106
|
return this.otherProperties.clipped;
|
|
1107
1107
|
};
|
|
1108
|
-
|
|
1108
|
+
R.prototype.getFit = function() {
|
|
1109
1109
|
return this.otherProperties.fit;
|
|
1110
1110
|
};
|
|
1111
|
-
|
|
1111
|
+
R.prototype.getOrientation = function() {
|
|
1112
1112
|
return this.otherProperties.orientation;
|
|
1113
1113
|
};
|
|
1114
|
-
|
|
1114
|
+
R.prototype.getOverflow = function() {
|
|
1115
1115
|
return this.otherProperties.overflow;
|
|
1116
1116
|
};
|
|
1117
|
-
|
|
1117
|
+
R.prototype.getPage = function() {
|
|
1118
1118
|
return this.otherProperties.page || void 0;
|
|
1119
1119
|
};
|
|
1120
|
-
|
|
1120
|
+
R.prototype.getSpread = function() {
|
|
1121
1121
|
return this.otherProperties.spread || void 0;
|
|
1122
1122
|
};
|
|
1123
1123
|
var K;
|
|
@@ -1427,7 +1427,7 @@ class ie {
|
|
|
1427
1427
|
return this.compression !== void 0 && (t.compression = this.compression), this.originalLength !== void 0 && (t.originalLength = this.originalLength), this.profile !== void 0 && (t.profile = this.profile), this.scheme !== void 0 && (t.scheme = this.scheme), t;
|
|
1428
1428
|
}
|
|
1429
1429
|
}
|
|
1430
|
-
class
|
|
1430
|
+
class Q {
|
|
1431
1431
|
constructor(t) {
|
|
1432
1432
|
this.otherProperties = t;
|
|
1433
1433
|
}
|
|
@@ -1436,7 +1436,7 @@ class Y {
|
|
|
1436
1436
|
*/
|
|
1437
1437
|
static deserialize(t) {
|
|
1438
1438
|
if (t)
|
|
1439
|
-
return new
|
|
1439
|
+
return new Q(t);
|
|
1440
1440
|
}
|
|
1441
1441
|
/**
|
|
1442
1442
|
* Serializes a [Properties] to its RWPM JSON representation.
|
|
@@ -1451,18 +1451,18 @@ class Y {
|
|
|
1451
1451
|
const e = Object.assign({}, this.otherProperties);
|
|
1452
1452
|
for (const A in t)
|
|
1453
1453
|
e[A] = t[A];
|
|
1454
|
-
return new
|
|
1454
|
+
return new Q(e);
|
|
1455
1455
|
}
|
|
1456
1456
|
}
|
|
1457
|
-
Object.defineProperty(
|
|
1457
|
+
Object.defineProperty(Q.prototype, "encryption", {
|
|
1458
1458
|
get: function() {
|
|
1459
1459
|
return ie.deserialize(this.otherProperties.encrypted);
|
|
1460
1460
|
}
|
|
1461
1461
|
});
|
|
1462
|
-
|
|
1462
|
+
Q.prototype.getContains = function() {
|
|
1463
1463
|
return new Set(this.otherProperties.contains || []);
|
|
1464
1464
|
};
|
|
1465
|
-
|
|
1465
|
+
Q.prototype.getLayout = function() {
|
|
1466
1466
|
return this.otherProperties.layout;
|
|
1467
1467
|
};
|
|
1468
1468
|
class u {
|
|
@@ -2089,7 +2089,7 @@ class at {
|
|
|
2089
2089
|
type: t.type,
|
|
2090
2090
|
title: t.title,
|
|
2091
2091
|
rels: t.rel ? t.rel instanceof Array ? new Set(t.rel) : /* @__PURE__ */ new Set([t.rel]) : void 0,
|
|
2092
|
-
properties:
|
|
2092
|
+
properties: Q.deserialize(t.properties),
|
|
2093
2093
|
height: b(t.height),
|
|
2094
2094
|
width: b(t.width),
|
|
2095
2095
|
duration: b(t.duration),
|
|
@@ -2139,7 +2139,7 @@ class at {
|
|
|
2139
2139
|
addProperties(t) {
|
|
2140
2140
|
var e;
|
|
2141
2141
|
const A = at.deserialize(this.serialize());
|
|
2142
|
-
return A.properties = A.properties ? (e = A.properties) == null ? void 0 : e.add(t) : new
|
|
2142
|
+
return A.properties = A.properties ? (e = A.properties) == null ? void 0 : e.add(t) : new Q(t), A;
|
|
2143
2143
|
}
|
|
2144
2144
|
/**
|
|
2145
2145
|
* Creates a [Locator] from a reading order [Link].
|
|
@@ -2482,45 +2482,45 @@ class ae {
|
|
|
2482
2482
|
return this.since !== void 0 && (t.since = this.since.toISOString()), this.until !== void 0 && (t.until = this.until.toISOString()), t;
|
|
2483
2483
|
}
|
|
2484
2484
|
}
|
|
2485
|
-
|
|
2485
|
+
Q.prototype.getNumberOfItems = function() {
|
|
2486
2486
|
return b(this.otherProperties.numberOfItems);
|
|
2487
2487
|
};
|
|
2488
|
-
|
|
2488
|
+
Q.prototype.getPrice = function() {
|
|
2489
2489
|
return re.deserialize(this.otherProperties.price);
|
|
2490
2490
|
};
|
|
2491
|
-
|
|
2491
|
+
Q.prototype.getIndirectAcquisitions = function() {
|
|
2492
2492
|
const i = this.otherProperties.indirectAcquisition;
|
|
2493
2493
|
if (i && i instanceof Array)
|
|
2494
2494
|
return i.map((t) => Mt.deserialize(t)).filter((t) => t !== void 0);
|
|
2495
2495
|
};
|
|
2496
|
-
|
|
2496
|
+
Q.prototype.getHolds = function() {
|
|
2497
2497
|
return se.deserialize(this.otherProperties.holds);
|
|
2498
2498
|
};
|
|
2499
|
-
|
|
2499
|
+
Q.prototype.getCopies = function() {
|
|
2500
2500
|
return oe.deserialize(this.otherProperties.copies);
|
|
2501
2501
|
};
|
|
2502
|
-
|
|
2502
|
+
Q.prototype.getAvailability = function() {
|
|
2503
2503
|
return ae.deserialize(this.otherProperties.availability);
|
|
2504
2504
|
};
|
|
2505
|
-
|
|
2505
|
+
Q.prototype.getAuthenticate = function() {
|
|
2506
2506
|
return at.deserialize(this.otherProperties.authenticate);
|
|
2507
2507
|
};
|
|
2508
|
-
|
|
2508
|
+
Q.prototype.getClipped = function() {
|
|
2509
2509
|
return this.otherProperties.clipped;
|
|
2510
2510
|
};
|
|
2511
|
-
|
|
2511
|
+
Q.prototype.getFit = function() {
|
|
2512
2512
|
return this.otherProperties.fit;
|
|
2513
2513
|
};
|
|
2514
|
-
|
|
2514
|
+
Q.prototype.getOrientation = function() {
|
|
2515
2515
|
return this.otherProperties.orientation;
|
|
2516
2516
|
};
|
|
2517
|
-
|
|
2517
|
+
Q.prototype.getOverflow = function() {
|
|
2518
2518
|
return this.otherProperties.overflow;
|
|
2519
2519
|
};
|
|
2520
|
-
|
|
2520
|
+
Q.prototype.getPage = function() {
|
|
2521
2521
|
return this.otherProperties.page || void 0;
|
|
2522
2522
|
};
|
|
2523
|
-
|
|
2523
|
+
Q.prototype.getSpread = function() {
|
|
2524
2524
|
return this.otherProperties.spread || void 0;
|
|
2525
2525
|
};
|
|
2526
2526
|
var q;
|
|
@@ -2586,7 +2586,7 @@ function li(i, t, e) {
|
|
|
2586
2586
|
function Ht(i) {
|
|
2587
2587
|
return (i | -i) >> 31 & 1;
|
|
2588
2588
|
}
|
|
2589
|
-
function
|
|
2589
|
+
function ye(i, t, e, A) {
|
|
2590
2590
|
let n = i.P[e], r = i.M[e];
|
|
2591
2591
|
const s = A >>> 31, o = t[e] | s, a = o | r, h = (o & n) + n ^ n | o;
|
|
2592
2592
|
let l = r | ~(h | n), c = n & h;
|
|
@@ -2633,7 +2633,7 @@ function oA(i, t, e) {
|
|
|
2633
2633
|
m < h.length ? M = h[m] : (M = a.get(m), typeof M > "u" && (M = o));
|
|
2634
2634
|
let B = 0;
|
|
2635
2635
|
for (let E = 0; E <= l; E += 1)
|
|
2636
|
-
B =
|
|
2636
|
+
B = ye(s, M, E, B), c[E] += B;
|
|
2637
2637
|
if (c[l] - B <= e && l < r && (M[l + 1] & 1 || B < 0)) {
|
|
2638
2638
|
l += 1, s.P[l] = -1, s.M[l] = 0;
|
|
2639
2639
|
let E;
|
|
@@ -2642,7 +2642,7 @@ function oA(i, t, e) {
|
|
|
2642
2642
|
E = f === 0 ? n : f;
|
|
2643
2643
|
} else
|
|
2644
2644
|
E = n;
|
|
2645
|
-
c[l] = c[l - 1] + E - B +
|
|
2645
|
+
c[l] = c[l - 1] + E - B + ye(s, M, l, B);
|
|
2646
2646
|
} else
|
|
2647
2647
|
for (; l > 0 && c[l] >= e + n; )
|
|
2648
2648
|
l -= 1;
|
|
@@ -2669,7 +2669,7 @@ function aA(i, t, e) {
|
|
|
2669
2669
|
}), A += 1);
|
|
2670
2670
|
return n.length > 0 ? n : ci(i, t, e);
|
|
2671
2671
|
}
|
|
2672
|
-
function
|
|
2672
|
+
function Ce(i, t) {
|
|
2673
2673
|
return t.length === 0 || i.length === 0 ? 0 : 1 - aA(i, t, t.length)[0].errors / t.length;
|
|
2674
2674
|
}
|
|
2675
2675
|
function gi(i, t, e = {}) {
|
|
@@ -2679,13 +2679,13 @@ function gi(i, t, e = {}) {
|
|
|
2679
2679
|
if (n.length === 0)
|
|
2680
2680
|
return null;
|
|
2681
2681
|
const r = (o) => {
|
|
2682
|
-
const a = 1 - o.errors / t.length, h = e.prefix ?
|
|
2682
|
+
const a = 1 - o.errors / t.length, h = e.prefix ? Ce(
|
|
2683
2683
|
i.slice(
|
|
2684
2684
|
Math.max(0, o.start - e.prefix.length),
|
|
2685
2685
|
o.start
|
|
2686
2686
|
),
|
|
2687
2687
|
e.prefix
|
|
2688
|
-
) : 1, l = e.suffix ?
|
|
2688
|
+
) : 1, l = e.suffix ? Ce(
|
|
2689
2689
|
i.slice(o.end, o.end + e.suffix.length),
|
|
2690
2690
|
e.suffix
|
|
2691
2691
|
) : 1;
|
|
@@ -3299,7 +3299,7 @@ const wi = (i) => {
|
|
|
3299
3299
|
const t = wi(i);
|
|
3300
3300
|
return Ii(t) < 128;
|
|
3301
3301
|
}, Ui = "Highlight" in window, Ne = ["IMG", "IMAGE", "AUDIO", "VIDEO", "SVG"];
|
|
3302
|
-
class
|
|
3302
|
+
class yi {
|
|
3303
3303
|
/**
|
|
3304
3304
|
* Creates a DecorationGroup object
|
|
3305
3305
|
* @param id Unique HTML ID-adhering name of the group
|
|
@@ -3394,14 +3394,14 @@ class Ci {
|
|
|
3394
3394
|
getComputedStyle(this.wnd.document.documentElement).getPropertyValue(
|
|
3395
3395
|
"column-count"
|
|
3396
3396
|
)
|
|
3397
|
-
), l = a / (h || 1), c = this.wnd.document.scrollingElement, g = c.scrollLeft, m = c.scrollTop, M = (w, U,
|
|
3397
|
+
), l = a / (h || 1), c = this.wnd.document.scrollingElement, g = c.scrollLeft, m = c.scrollTop, M = (w, U, Y) => {
|
|
3398
3398
|
var nt, mt, ce, ge, de, ue;
|
|
3399
3399
|
if (w.style.position = "absolute", ((mt = (nt = t.decoration) == null ? void 0 : nt.style) == null ? void 0 : mt.width) === "viewport") {
|
|
3400
3400
|
w.style.width = `${a}px`, w.style.height = `${U.height}px`;
|
|
3401
3401
|
let bt = Math.floor(U.left / a) * a;
|
|
3402
3402
|
w.style.left = `${bt + g}px`, w.style.top = `${U.top + m}px`;
|
|
3403
3403
|
} else if (((ge = (ce = t.decoration) == null ? void 0 : ce.style) == null ? void 0 : ge.width) === "bounds")
|
|
3404
|
-
w.style.width = `${
|
|
3404
|
+
w.style.width = `${Y.width}px`, w.style.height = `${U.height}px`, w.style.left = `${Y.left + g}px`, w.style.top = `${U.top + m}px`;
|
|
3405
3405
|
else if (((ue = (de = t.decoration) == null ? void 0 : de.style) == null ? void 0 : ue.width) === "page") {
|
|
3406
3406
|
w.style.width = `${l}px`, w.style.height = `${U.height}px`;
|
|
3407
3407
|
let bt = Math.floor(U.left / l) * l;
|
|
@@ -3434,10 +3434,10 @@ class Ci {
|
|
|
3434
3434
|
!0
|
|
3435
3435
|
// doNotMergeHorizontallyAlignedRects
|
|
3436
3436
|
);
|
|
3437
|
-
w = w.sort((U,
|
|
3437
|
+
w = w.sort((U, Y) => U.top < Y.top ? -1 : U.top > Y.top ? 1 : 0);
|
|
3438
3438
|
for (let U of w) {
|
|
3439
|
-
const
|
|
3440
|
-
|
|
3439
|
+
const Y = F.cloneNode(!0);
|
|
3440
|
+
Y.style.setProperty("pointer-events", "none"), M(Y, U, B), o.append(Y);
|
|
3441
3441
|
}
|
|
3442
3442
|
}
|
|
3443
3443
|
t.container = o, t.clickableElements = Array.from(
|
|
@@ -3489,7 +3489,7 @@ const mA = class Zt extends Dt {
|
|
|
3489
3489
|
mount(t, e) {
|
|
3490
3490
|
return this.wnd = t, e.register("decorate", Zt.moduleName, (A, n) => {
|
|
3491
3491
|
const r = A;
|
|
3492
|
-
r.decoration && r.decoration.locator && (r.decoration.locator = tt.deserialize(r.decoration.locator)), this.groups.has(r.group) || this.groups.set(r.group, new
|
|
3492
|
+
r.decoration && r.decoration.locator && (r.decoration.locator = tt.deserialize(r.decoration.locator)), this.groups.has(r.group) || this.groups.set(r.group, new yi(
|
|
3493
3493
|
t,
|
|
3494
3494
|
e,
|
|
3495
3495
|
`readium-decoration-${this.lastGroupId++}`,
|
|
@@ -3518,7 +3518,7 @@ const mA = class Zt extends Dt {
|
|
|
3518
3518
|
}
|
|
3519
3519
|
};
|
|
3520
3520
|
mA.moduleName = "decorator";
|
|
3521
|
-
let
|
|
3521
|
+
let Ci = mA;
|
|
3522
3522
|
const Se = "readium-snapper-style", MA = class Kt extends Dt {
|
|
3523
3523
|
constructor() {
|
|
3524
3524
|
super(...arguments), this.protected = !1;
|
|
@@ -3560,15 +3560,19 @@ function Ri(i) {
|
|
|
3560
3560
|
return i.clientHeight - e - A;
|
|
3561
3561
|
}
|
|
3562
3562
|
function xe(i) {
|
|
3563
|
-
const t = i
|
|
3564
|
-
|
|
3565
|
-
|
|
3566
|
-
const e =
|
|
3567
|
-
|
|
3568
|
-
|
|
3569
|
-
|
|
3570
|
-
|
|
3563
|
+
const t = pA(i);
|
|
3564
|
+
if (!t)
|
|
3565
|
+
return !1;
|
|
3566
|
+
const e = i.document.querySelectorAll("div[id^='readium-virtual-page']");
|
|
3567
|
+
for (const a of e)
|
|
3568
|
+
a.remove();
|
|
3569
|
+
const A = e.length, n = i.document.scrollingElement.scrollWidth, r = i.visualViewport.width, s = Math.round(n / r * t) % t, o = t === 1 || s === 0 ? 0 : t - s;
|
|
3570
|
+
if (o > 0)
|
|
3571
|
+
for (let a = 0; a < o; a++) {
|
|
3572
|
+
const h = i.document.createElement("div");
|
|
3573
|
+
h.setAttribute("id", `readium-virtual-page-${a}`), h.dataset.readium = "true", CSS.supports("break-before", "column") ? h.style.breakBefore = "column" : (CSS.supports("break-inside", "avoid-column") && (h.style.breakInside = "avoid-column"), h.style.height = Ri(i.document.documentElement) + "px"), h.innerHTML = "​", i.document.body.appendChild(h);
|
|
3571
3574
|
}
|
|
3575
|
+
return A !== o;
|
|
3572
3576
|
}
|
|
3573
3577
|
function Qi(i) {
|
|
3574
3578
|
return i < 0.5 ? 2 * i * i : -1 + (4 - 2 * i) * i;
|
|
@@ -4058,7 +4062,7 @@ class UA extends Dt {
|
|
|
4058
4062
|
}
|
|
4059
4063
|
}
|
|
4060
4064
|
UA.moduleName = "peripherals";
|
|
4061
|
-
const
|
|
4065
|
+
const yA = class qt extends Dt {
|
|
4062
4066
|
constructor() {
|
|
4063
4067
|
super(...arguments), this.mediaPlayingCount = 0, this.allAnimations = /* @__PURE__ */ new Set();
|
|
4064
4068
|
}
|
|
@@ -4112,7 +4116,7 @@ const CA = class qt extends Dt {
|
|
|
4112
4116
|
), Reflect.defineProperty(t.navigator, "epubReadingSystem", {
|
|
4113
4117
|
value: {
|
|
4114
4118
|
name: "readium-ts-toolkit",
|
|
4115
|
-
version: "2.0.0-beta.
|
|
4119
|
+
version: "2.0.0-beta.2",
|
|
4116
4120
|
hasFeature: (n, r = "") => {
|
|
4117
4121
|
switch (n) {
|
|
4118
4122
|
case "dom-manipulation":
|
|
@@ -4159,9 +4163,9 @@ const CA = class qt extends Dt {
|
|
|
4159
4163
|
return t.removeEventListener("error", this.wndOnErr), t.removeEventListener("play", this.onMediaPlayEvent), t.removeEventListener("pause", this.onMediaPauseEvent), this.allAnimations.forEach((A) => A.cancel()), this.allAnimations.clear(), e.log("Setup Unmounted"), !0;
|
|
4160
4164
|
}
|
|
4161
4165
|
};
|
|
4162
|
-
|
|
4163
|
-
let
|
|
4164
|
-
const Ve = "readium-viewport", RA = class At extends
|
|
4166
|
+
yA.moduleName = "setup";
|
|
4167
|
+
let CA = yA;
|
|
4168
|
+
const Ve = "readium-viewport", RA = class At extends CA {
|
|
4165
4169
|
onViewportWidthChanged(t) {
|
|
4166
4170
|
const e = t.target;
|
|
4167
4171
|
Nt(e, "--RS__viewportWidth", `${e.innerWidth}px`);
|
|
@@ -4195,7 +4199,7 @@ const Ve = "readium-viewport", RA = class At extends yA {
|
|
|
4195
4199
|
};
|
|
4196
4200
|
RA.moduleName = "reflowable_setup";
|
|
4197
4201
|
let Vi = RA;
|
|
4198
|
-
const De = "readium-fixed-style", QA = class Z extends
|
|
4202
|
+
const De = "readium-fixed-style", QA = class Z extends CA {
|
|
4199
4203
|
mount(t, e) {
|
|
4200
4204
|
if (!super.mount(t, e))
|
|
4201
4205
|
return !1;
|
|
@@ -4255,7 +4259,7 @@ const bi = [
|
|
|
4255
4259
|
Di,
|
|
4256
4260
|
Vi,
|
|
4257
4261
|
UA,
|
|
4258
|
-
|
|
4262
|
+
Ci,
|
|
4259
4263
|
Ti,
|
|
4260
4264
|
ji
|
|
4261
4265
|
].map((i) => [i.moduleName, i]));
|
|
@@ -4533,16 +4537,16 @@ class Hi {
|
|
|
4533
4537
|
}), this.currentBaseURL !== void 0 && t.baseURL !== this.currentBaseURL && (this.blobs.forEach((f) => URL.revokeObjectURL(f)), this.blobs.clear()), this.currentBaseURL = t.baseURL;
|
|
4534
4538
|
const g = async (f) => {
|
|
4535
4539
|
var U;
|
|
4536
|
-
if (n && (this.blobs.forEach((
|
|
4537
|
-
const
|
|
4538
|
-
|
|
4540
|
+
if (n && (this.blobs.forEach((Y) => URL.revokeObjectURL(Y)), this.blobs.clear(), this.pendingUpdates.clear()), this.pendingUpdates.has(f) && ((U = this.pendingUpdates.get(f)) == null ? void 0 : U.inPool) === !1) {
|
|
4541
|
+
const Y = this.blobs.get(f);
|
|
4542
|
+
Y && (URL.revokeObjectURL(Y), this.blobs.delete(f), this.pendingUpdates.delete(f));
|
|
4539
4543
|
}
|
|
4540
4544
|
if (this.pool.has(f)) {
|
|
4541
|
-
const
|
|
4545
|
+
const Y = this.pool.get(f);
|
|
4542
4546
|
if (!this.blobs.has(f))
|
|
4543
|
-
await
|
|
4547
|
+
await Y.destroy(), this.pool.delete(f), this.pendingUpdates.delete(f);
|
|
4544
4548
|
else {
|
|
4545
|
-
await
|
|
4549
|
+
await Y.load(A);
|
|
4546
4550
|
return;
|
|
4547
4551
|
}
|
|
4548
4552
|
}
|
|
@@ -5175,7 +5179,7 @@ class Ki {
|
|
|
5175
5179
|
if (A.length > 1)
|
|
5176
5180
|
return;
|
|
5177
5181
|
const r = A[0], s = (o = r.properties) == null ? void 0 : o.getOrientation();
|
|
5178
|
-
n === 0 && (s === it.landscape || s !== it.portrait && ((r.width || 0) > (r.height || 0) || ((a = r.properties) == null ? void 0 : a.getSpread()) ===
|
|
5182
|
+
n === 0 && (s === it.landscape || s !== it.portrait && ((r.width || 0) > (r.height || 0) || ((a = r.properties) == null ? void 0 : a.getSpread()) === Ct.both)) && (this.shift = !1), e && ((h = r.properties) == null ? void 0 : h.getPage()) === W.center && this.spreads[n - 1][0].addProperties({ addBlank: !0 }), s === it.portrait && ((l = r.properties) == null ? void 0 : l.getPage()) !== "center" && ((c = r.properties) == null ? void 0 : c.otherProperties.number) > 1 ? e = !0 : e = !1;
|
|
5179
5183
|
}), this.shift || this.index(t, !0);
|
|
5180
5184
|
}
|
|
5181
5185
|
buildSpreads(t) {
|
|
@@ -5196,7 +5200,7 @@ const He = 8, ke = 5, qi = 300, _i = 15e3, $i = 250, tn = 150, en = 500;
|
|
|
5196
5200
|
class An {
|
|
5197
5201
|
constructor(t, e, A) {
|
|
5198
5202
|
var n;
|
|
5199
|
-
if (this.pool = /* @__PURE__ */ new Map(), this.blobs = /* @__PURE__ */ new Map(), this.inprogress = /* @__PURE__ */ new Map(), this.delayedShow = /* @__PURE__ */ new Map(), this.delayedTimeout = /* @__PURE__ */ new Map(), this.previousFrames = [], this.width = 0, this.height = 0, this.transform = "", this.currentSlide = 0, this.spread = !0, this.orientationInternal = -1, this.container = t, this.positions = e, this.pub = A, this.spreadPresentation = ((n = A.metadata.getPresentation()) == null ? void 0 : n.spread) ||
|
|
5203
|
+
if (this.pool = /* @__PURE__ */ new Map(), this.blobs = /* @__PURE__ */ new Map(), this.inprogress = /* @__PURE__ */ new Map(), this.delayedShow = /* @__PURE__ */ new Map(), this.delayedTimeout = /* @__PURE__ */ new Map(), this.previousFrames = [], this.width = 0, this.height = 0, this.transform = "", this.currentSlide = 0, this.spread = !0, this.orientationInternal = -1, this.container = t, this.positions = e, this.pub = A, this.spreadPresentation = ((n = A.metadata.getPresentation()) == null ? void 0 : n.spread) || Ct.auto, this.pub.metadata.effectiveReadingProgression !== I.rtl && this.pub.metadata.effectiveReadingProgression !== I.ltr)
|
|
5200
5204
|
throw Error("Unsupported reading progression for EPUB");
|
|
5201
5205
|
this.spreader = new Ki(this.pub), this.containerHeightCached = t.clientHeight, this.bookElement = document.createElement("div"), this.bookElement.ariaLabel = "Book", this.bookElement.tabIndex = -1, this.updateBookStyle(!0), this.spineElement = document.createElement("div"), this.spineElement.ariaLabel = "Spine", this.bookElement.appendChild(this.spineElement), this.container.appendChild(this.bookElement), this.updateSpineStyle(!0), this.peripherals = new Zi(this), this.pub.readingOrder.items.forEach((r) => {
|
|
5202
5206
|
var o, a;
|
|
@@ -5248,7 +5252,7 @@ class An {
|
|
|
5248
5252
|
return 50;
|
|
5249
5253
|
}
|
|
5250
5254
|
get portrait() {
|
|
5251
|
-
return this.spreadPresentation ===
|
|
5255
|
+
return this.spreadPresentation === Ct.none ? !0 : (this.orientationInternal === -1 && (this.orientationInternal = this.containerHeightCached > this.container.clientWidth ? 1 : 0), this.orientationInternal === 1);
|
|
5252
5256
|
}
|
|
5253
5257
|
updateSpineStyle(t, e = !0) {
|
|
5254
5258
|
let A = "0";
|
|
@@ -5433,7 +5437,7 @@ class An {
|
|
|
5433
5437
|
let w = !1;
|
|
5434
5438
|
const U = window.setTimeout(async () => {
|
|
5435
5439
|
this.delayedTimeout.set(M, 0);
|
|
5436
|
-
const
|
|
5440
|
+
const Y = this.makeSpread(this.reAlign(B)), nt = this.spreadPosition(Y, E), mt = this.pool.get(M);
|
|
5437
5441
|
await mt.load(A, this.blobs.get(M)), this.peripherals.isScaled || await mt.show(nt), this.delayedShow.delete(M), w = !0, f();
|
|
5438
5442
|
}, qi);
|
|
5439
5443
|
setTimeout(() => {
|
|
@@ -5700,7 +5704,7 @@ var ht = {
|
|
|
5700
5704
|
posix: null
|
|
5701
5705
|
};
|
|
5702
5706
|
ht.posix = ht;
|
|
5703
|
-
var We = ht, pt = /* @__PURE__ */ ((i) => (i.start = "start", i.left = "left", i.right = "right", i.justify = "justify", i))(pt || {}), Bt = /* @__PURE__ */ ((i) => (i.day = "day", i.sepia = "sepia", i.night = "night", i.custom = "custom", i))(Bt || {}),
|
|
5707
|
+
var We = ht, pt = /* @__PURE__ */ ((i) => (i.start = "start", i.left = "left", i.right = "right", i.justify = "justify", i))(pt || {}), Bt = /* @__PURE__ */ ((i) => (i.day = "day", i.sepia = "sepia", i.night = "night", i.custom = "custom", i))(Bt || {}), y = /* @__PURE__ */ ((i) => (i.margin = "margin", i.lineLength = "lineLength", i.columns = "columns", i))(y || {});
|
|
5704
5708
|
const Tt = {
|
|
5705
5709
|
range: [0.7, 4],
|
|
5706
5710
|
step: 0.05
|
|
@@ -5720,7 +5724,7 @@ function sn(i, t) {
|
|
|
5720
5724
|
function T(i) {
|
|
5721
5725
|
return typeof i == "string" ? i : i === null ? null : void 0;
|
|
5722
5726
|
}
|
|
5723
|
-
function
|
|
5727
|
+
function C(i) {
|
|
5724
5728
|
return typeof i == "boolean" || i == null ? i : void 0;
|
|
5725
5729
|
}
|
|
5726
5730
|
function lt(i, t) {
|
|
@@ -5730,7 +5734,7 @@ function lt(i, t) {
|
|
|
5730
5734
|
function ct(i) {
|
|
5731
5735
|
return typeof i == "boolean" || typeof i == "number" && i >= 0 ? i : i === null ? null : void 0;
|
|
5732
5736
|
}
|
|
5733
|
-
function
|
|
5737
|
+
function z(i) {
|
|
5734
5738
|
if (i !== void 0)
|
|
5735
5739
|
return i === null ? null : i < 0 ? void 0 : i;
|
|
5736
5740
|
}
|
|
@@ -5747,7 +5751,7 @@ function Wt(i, t) {
|
|
|
5747
5751
|
}
|
|
5748
5752
|
class Et {
|
|
5749
5753
|
constructor(t = {}) {
|
|
5750
|
-
this.backgroundColor = T(t.backgroundColor), this.blendFilter =
|
|
5754
|
+
this.backgroundColor = T(t.backgroundColor), this.blendFilter = C(t.blendFilter), this.constraint = z(t.constraint), this.columnCount = z(t.columnCount), this.darkenFilter = ct(t.darkenFilter), this.deprecatedFontSize = C(t.deprecatedFontSize), this.fontFamily = T(t.fontFamily), this.fontSize = gt(t.fontSize, Tt.range), this.fontSizeNormalize = C(t.fontSizeNormalize), this.fontOpticalSizing = C(t.fontOpticalSizing), this.fontOverride = C(t.fontOverride), this.fontWeight = gt(t.fontWeight, jt.range), this.fontWidth = gt(t.fontWidth, Vt.range), this.hyphens = C(t.hyphens), this.invertFilter = ct(t.invertFilter), this.invertGaijiFilter = ct(t.invertGaijiFilter), this.iPadOSPatch = C(t.iPadOSPatch), this.layoutStrategy = lt(t.layoutStrategy, y), this.letterSpacing = z(t.letterSpacing), this.ligatures = C(t.ligatures), this.lineHeight = z(t.lineHeight), this.linkColor = T(t.linkColor), this.noRuby = C(t.noRuby), this.pageGutter = z(t.pageGutter), this.paragraphIndent = z(t.paragraphIndent), this.paragraphSpacing = z(t.paragraphSpacing), this.scroll = C(t.scroll), this.selectionBackgroundColor = T(t.selectionBackgroundColor), this.selectionTextColor = T(t.selectionTextColor), this.textAlign = lt(t.textAlign, pt), this.textColor = T(t.textColor), this.textNormalization = C(t.textNormalization), this.theme = lt(t.theme, Bt), this.visitedColor = T(t.visitedColor), this.wordSpacing = z(t.wordSpacing), this.optimalLineLength = z(t.optimalLineLength), this.maximalLineLength = z(t.maximalLineLength), this.minimalLineLength = z(t.minimalLineLength);
|
|
5751
5755
|
}
|
|
5752
5756
|
static serialize(t) {
|
|
5753
5757
|
const { ...e } = t;
|
|
@@ -5764,7 +5768,7 @@ class Et {
|
|
|
5764
5768
|
merging(t) {
|
|
5765
5769
|
const e = { ...this };
|
|
5766
5770
|
for (const A of Object.keys(t))
|
|
5767
|
-
t[A] !== void 0 && (A !== "maximalLineLength" || t[A] === null || t[A] >= (t.
|
|
5771
|
+
t[A] !== void 0 && (A !== "maximalLineLength" || t[A] === null || t[A] >= (t.optimalLineLength ?? e.optimalLineLength ?? 65)) && (A !== "minimalLineLength" || t[A] === null || t[A] <= (t.optimalLineLength ?? e.optimalLineLength ?? 65)) && (e[A] = t[A]);
|
|
5768
5772
|
return new Et(e);
|
|
5769
5773
|
}
|
|
5770
5774
|
}
|
|
@@ -5777,40 +5781,16 @@ const on = "'Iowan Old Style', Sitka, 'Sitka Text', Palatino, 'Book Antiqua', 'U
|
|
|
5777
5781
|
}, dn = 16, Le = gn.RS__oldStyleTf;
|
|
5778
5782
|
class ft {
|
|
5779
5783
|
constructor(t) {
|
|
5780
|
-
this._optimalLineLength = null, this._canvas = document.createElement("canvas"), this._optimalChars = t.optimalChars, this._minChars = t.minChars, this._maxChars = t.maxChars, this.
|
|
5781
|
-
}
|
|
5782
|
-
set minChars(t) {
|
|
5783
|
-
t !== this._minChars && (this._minChars = t, this._minDivider = this._minChars && this._minChars < this._optimalChars ? this._optimalChars / this._minChars : this._minChars === null ? null : 1);
|
|
5784
|
-
}
|
|
5785
|
-
set optimalChars(t) {
|
|
5786
|
-
t !== this._optimalChars && (this._optimalChars = t, this._optimalLineLength = this.getOptimalLineLength());
|
|
5787
|
-
}
|
|
5788
|
-
set maxChars(t) {
|
|
5789
|
-
t !== this._maxChars && (this._maxChars = t, this._maxMultiplier = this._maxChars && this._maxChars > this._optimalChars ? this._maxChars / this._optimalChars : this._maxChars === null ? null : 1);
|
|
5790
|
-
}
|
|
5791
|
-
set userChars(t) {
|
|
5792
|
-
t !== this._userChars && (this._userChars = t, this._userMultiplier = this._userChars ? this._userChars / this._optimalChars : null);
|
|
5793
|
-
}
|
|
5794
|
-
set letterSpacing(t) {
|
|
5795
|
-
t !== this._letterSpacing && (this._letterSpacing = Math.round(t * this._baseFontSize), this._optimalLineLength = this.getOptimalLineLength());
|
|
5784
|
+
this._optimalLineLength = null, this._canvas = document.createElement("canvas"), this._optimalChars = t.optimalChars, this._minChars = t.minChars, this._maxChars = t.maxChars, this._baseFontSize = t.baseFontSize || dn, this._fontFace = t.fontFace || Le, this._sample = t.sample || null, this._pageGutter = t.pageGutter || 0, this._letterSpacing = t.letterSpacing ? Math.round(t.letterSpacing * this._baseFontSize) : 0, this._wordSpacing = t.wordSpacing ? Math.round(t.wordSpacing * this._baseFontSize) : 0, this._isCJK = t.isCJK || !1, this._getRelative = t.getRelative || !1, this._padding = this._pageGutter * 2, this._minDivider = this._minChars && this._minChars < this._optimalChars ? this._optimalChars / this._minChars : this._minChars === null ? null : 1, this._maxMultiplier = this._maxChars && this._maxChars > this._optimalChars ? this._maxChars / this._optimalChars : this._maxChars === null ? null : 1, this._approximatedWordSpaces = ft.approximateWordSpaces(this._optimalChars, this._sample);
|
|
5796
5785
|
}
|
|
5797
|
-
|
|
5798
|
-
|
|
5786
|
+
updateMultipliers() {
|
|
5787
|
+
this._minDivider = this._minChars && this._minChars < this._optimalChars ? this._optimalChars / this._minChars : this._minChars === null ? null : 1, this._maxMultiplier = this._maxChars && this._maxChars > this._optimalChars ? this._maxChars / this._optimalChars : this._maxChars === null ? null : 1;
|
|
5799
5788
|
}
|
|
5800
|
-
|
|
5801
|
-
|
|
5802
|
-
|
|
5803
|
-
|
|
5804
|
-
this._fontFace = t || Le, this._optimalLineLength = this.getOptimalLineLength();
|
|
5805
|
-
}
|
|
5806
|
-
set sample(t) {
|
|
5807
|
-
t !== this._sample && (this._sample = t, this._approximatedWordSpaces = ft.approximateWordSpaces(this._optimalChars, this._sample));
|
|
5808
|
-
}
|
|
5809
|
-
set pageGutter(t) {
|
|
5810
|
-
t !== this._pageGutter && (this._pageGutter = t, this._padding = this._pageGutter * 2, this._optimalLineLength = this.getOptimalLineLength());
|
|
5811
|
-
}
|
|
5812
|
-
set relativeGetters(t) {
|
|
5813
|
-
t !== this._getRelative && (this._getRelative = t);
|
|
5789
|
+
// Batch update to guarantee up-to-date values
|
|
5790
|
+
// Not filtering because pretty much everything can
|
|
5791
|
+
// trigger a recomputation anyway.
|
|
5792
|
+
update(t) {
|
|
5793
|
+
t.optimalChars && (this._optimalChars = t.optimalChars), t.minChars !== void 0 && (this._minChars = t.minChars), t.maxChars !== void 0 && (this._maxChars = t.maxChars), t.baseFontSize && (this._baseFontSize = t.baseFontSize), t.fontFace !== void 0 && (this._fontFace = t.fontFace || Le), t.letterSpacing && (this._letterSpacing = t.letterSpacing), t.wordSpacing && (this._wordSpacing = t.wordSpacing), t.isCJK != null && (this._isCJK = t.isCJK), t.pageGutter && (this._pageGutter = t.pageGutter), t.getRelative && (this._getRelative = t.getRelative), t.sample && (this._sample = t.sample, this._approximatedWordSpaces = ft.approximateWordSpaces(this._optimalChars, this._sample)), this.updateMultipliers(), this._optimalLineLength = this.getOptimalLineLength();
|
|
5814
5794
|
}
|
|
5815
5795
|
get baseFontSize() {
|
|
5816
5796
|
return this._baseFontSize;
|
|
@@ -5818,9 +5798,6 @@ class ft {
|
|
|
5818
5798
|
get minimalLineLength() {
|
|
5819
5799
|
return this._optimalLineLength || (this._optimalLineLength = this.getOptimalLineLength()), this._minDivider !== null ? Math.round(this._optimalLineLength / this._minDivider + this._padding) / (this._getRelative ? this._baseFontSize : 1) : null;
|
|
5820
5800
|
}
|
|
5821
|
-
get userLineLength() {
|
|
5822
|
-
return this._optimalLineLength || (this._optimalLineLength = this.getOptimalLineLength()), this._userMultiplier !== null ? Math.round(this._optimalLineLength * this._userMultiplier + this._padding) / (this._getRelative ? this._baseFontSize : 1) : null;
|
|
5823
|
-
}
|
|
5824
5801
|
get maximalLineLength() {
|
|
5825
5802
|
return this._optimalLineLength || (this._optimalLineLength = this.getOptimalLineLength()), this._maxMultiplier !== null ? Math.round(this._optimalLineLength * this._maxMultiplier + this._padding) / (this._getRelative ? this._baseFontSize : 1) : null;
|
|
5826
5803
|
}
|
|
@@ -5830,7 +5807,6 @@ class ft {
|
|
|
5830
5807
|
get all() {
|
|
5831
5808
|
return this._optimalLineLength || (this._optimalLineLength = this.getOptimalLineLength()), {
|
|
5832
5809
|
min: this.minimalLineLength,
|
|
5833
|
-
user: this.userLineLength,
|
|
5834
5810
|
max: this.maximalLineLength,
|
|
5835
5811
|
optimal: this.optimalLineLength,
|
|
5836
5812
|
baseFontSize: this._baseFontSize
|
|
@@ -5879,7 +5855,7 @@ class ft {
|
|
|
5879
5855
|
}
|
|
5880
5856
|
class un {
|
|
5881
5857
|
constructor(t) {
|
|
5882
|
-
this.backgroundColor = T(t.backgroundColor) || null, this.blendFilter =
|
|
5858
|
+
this.backgroundColor = T(t.backgroundColor) || null, this.blendFilter = C(t.blendFilter) ?? !1, this.constraint = z(t.constraint) || 0, this.columnCount = z(t.columnCount) || null, this.darkenFilter = ct(t.darkenFilter) ?? !1, this.deprecatedFontSize = C(t.deprecatedFontSize), (this.deprecatedFontSize === !1 || this.deprecatedFontSize === null) && (this.deprecatedFontSize = !CSS.supports("zoom", "1")), this.fontFamily = T(t.fontFamily) || null, this.fontSize = gt(t.fontSize, Tt.range) || 1, this.fontSizeNormalize = C(t.fontSizeNormalize) ?? !1, this.fontOpticalSizing = C(t.fontOpticalSizing) ?? null, this.fontOverride = C(t.fontOverride) ?? null, this.fontWeight = gt(t.fontWeight, jt.range) || null, this.fontWidth = gt(t.fontWidth, Vt.range) || null, this.hyphens = C(t.hyphens) ?? null, this.invertFilter = ct(t.invertFilter) ?? !1, this.invertGaijiFilter = ct(t.invertGaijiFilter) ?? !1, this.iPadOSPatch = t.iPadOSPatch === !1 ? !1 : xt.OS.iPadOS && xt.iOSRequest === "desktop", this.layoutStrategy = lt(t.layoutStrategy, y) || y.lineLength, this.letterSpacing = z(t.letterSpacing) || null, this.ligatures = C(t.ligatures) ?? null, this.lineHeight = z(t.lineHeight) || null, this.linkColor = T(t.linkColor) || null, this.noRuby = C(t.noRuby) ?? !1, this.pageGutter = Wt(z(t.pageGutter), 20), this.paragraphIndent = z(t.paragraphIndent) ?? null, this.paragraphSpacing = z(t.paragraphSpacing) ?? null, this.scroll = C(t.scroll) ?? !1, this.selectionBackgroundColor = T(t.selectionBackgroundColor) || null, this.selectionTextColor = T(t.selectionTextColor) || null, this.textAlign = lt(t.textAlign, pt) || null, this.textColor = T(t.textColor) || null, this.textNormalization = C(t.textNormalization) ?? !1, this.theme = lt(t.theme, Bt) || null, this.visitedColor = T(t.visitedColor) || null, this.wordSpacing = z(t.wordSpacing) || null, this.optimalLineLength = z(t.optimalLineLength) || 65, this.maximalLineLength = Wt(sn(t.maximalLineLength, this.optimalLineLength), 80), this.minimalLineLength = Wt(rn(t.minimalLineLength, this.optimalLineLength), 40);
|
|
5883
5859
|
}
|
|
5884
5860
|
}
|
|
5885
5861
|
class V {
|
|
@@ -6218,7 +6194,7 @@ class Oe {
|
|
|
6218
6194
|
onChange: (t) => {
|
|
6219
6195
|
this.updatePreference("layoutStrategy", t || null);
|
|
6220
6196
|
},
|
|
6221
|
-
supportedValues: Object.values(
|
|
6197
|
+
supportedValues: Object.values(y)
|
|
6222
6198
|
});
|
|
6223
6199
|
}
|
|
6224
6200
|
get letterSpacing() {
|
|
@@ -6256,18 +6232,6 @@ class Oe {
|
|
|
6256
6232
|
step: 0.1
|
|
6257
6233
|
});
|
|
6258
6234
|
}
|
|
6259
|
-
get lineLength() {
|
|
6260
|
-
return new S({
|
|
6261
|
-
initialValue: this.preferences.lineLength,
|
|
6262
|
-
effectiveValue: this.settings.lineLength || this.settings.optimalLineLength,
|
|
6263
|
-
isEffective: this.layout === p.reflowable && this.preferences.lineLength !== null,
|
|
6264
|
-
onChange: (t) => {
|
|
6265
|
-
this.updatePreference("lineLength", t || null);
|
|
6266
|
-
},
|
|
6267
|
-
supportedRange: [20, 100],
|
|
6268
|
-
step: 1
|
|
6269
|
-
});
|
|
6270
|
-
}
|
|
6271
6235
|
get linkColor() {
|
|
6272
6236
|
return new V({
|
|
6273
6237
|
initialValue: this.preferences.linkColor,
|
|
@@ -6317,7 +6281,7 @@ class Oe {
|
|
|
6317
6281
|
return new S({
|
|
6318
6282
|
initialValue: this.preferences.optimalLineLength,
|
|
6319
6283
|
effectiveValue: this.settings.optimalLineLength,
|
|
6320
|
-
isEffective: this.layout === p.reflowable
|
|
6284
|
+
isEffective: this.layout === p.reflowable,
|
|
6321
6285
|
onChange: (t) => {
|
|
6322
6286
|
this.updatePreference("optimalLineLength", t);
|
|
6323
6287
|
},
|
|
@@ -6456,10 +6420,10 @@ class Oe {
|
|
|
6456
6420
|
}
|
|
6457
6421
|
class Xe {
|
|
6458
6422
|
constructor(t, e) {
|
|
6459
|
-
this.backgroundColor = t.backgroundColor || e.backgroundColor || null, this.blendFilter = typeof t.blendFilter == "boolean" ? t.blendFilter : e.blendFilter ?? null, this.columnCount = t.columnCount !== void 0 ? t.columnCount : e.columnCount !== void 0 ? e.columnCount : null, this.constraint = t.constraint || e.constraint, this.darkenFilter = typeof t.darkenFilter == "boolean" ? t.darkenFilter : e.darkenFilter ?? null, this.deprecatedFontSize = typeof t.deprecatedFontSize == "boolean" ? t.deprecatedFontSize : e.deprecatedFontSize ?? null, this.fontFamily = t.fontFamily || e.fontFamily || null, this.fontSize = t.fontSize !== void 0 ? t.fontSize : e.fontSize !== void 0 ? e.fontSize : null, this.fontSizeNormalize = typeof t.fontSizeNormalize == "boolean" ? t.fontSizeNormalize : e.fontSizeNormalize ?? null, this.fontOpticalSizing = typeof t.fontOpticalSizing == "boolean" ? t.fontOpticalSizing : e.fontOpticalSizing ?? null, this.fontOverride = typeof t.fontOverride == "boolean" ? t.fontOverride : e.fontOverride ?? null, this.fontWeight = t.fontWeight !== void 0 ? t.fontWeight : e.fontWeight !== void 0 ? e.fontWeight : null, this.fontWidth = t.fontWidth !== void 0 ? t.fontWidth : e.fontWidth !== void 0 ? e.fontWidth : null, this.hyphens = typeof t.hyphens == "boolean" ? t.hyphens : e.hyphens ?? null, this.invertFilter = typeof t.invertFilter == "boolean" ? t.invertFilter : e.invertFilter ?? null, this.invertGaijiFilter = typeof t.invertGaijiFilter == "boolean" ? t.invertGaijiFilter : e.invertGaijiFilter ?? null, this.iPadOSPatch = this.deprecatedFontSize || t.iPadOSPatch === !1 ? !1 : t.iPadOSPatch === !0 ? xt.OS.iPadOS && xt.iOSRequest === "desktop" : e.iPadOSPatch, this.layoutStrategy = t.layoutStrategy || e.layoutStrategy || null, this.letterSpacing = t.letterSpacing !== void 0 ? t.letterSpacing : e.letterSpacing !== void 0 ? e.letterSpacing : null, this.ligatures = typeof t.ligatures == "boolean" ? t.ligatures : e.ligatures ?? null, this.lineHeight = t.lineHeight !== void 0 ? t.lineHeight : e.lineHeight !== void 0 ? e.lineHeight : null, this.
|
|
6423
|
+
this.backgroundColor = t.backgroundColor || e.backgroundColor || null, this.blendFilter = typeof t.blendFilter == "boolean" ? t.blendFilter : e.blendFilter ?? null, this.columnCount = t.columnCount !== void 0 ? t.columnCount : e.columnCount !== void 0 ? e.columnCount : null, this.constraint = t.constraint || e.constraint, this.darkenFilter = typeof t.darkenFilter == "boolean" ? t.darkenFilter : e.darkenFilter ?? null, this.deprecatedFontSize = typeof t.deprecatedFontSize == "boolean" ? t.deprecatedFontSize : e.deprecatedFontSize ?? null, this.fontFamily = t.fontFamily || e.fontFamily || null, this.fontSize = t.fontSize !== void 0 ? t.fontSize : e.fontSize !== void 0 ? e.fontSize : null, this.fontSizeNormalize = typeof t.fontSizeNormalize == "boolean" ? t.fontSizeNormalize : e.fontSizeNormalize ?? null, this.fontOpticalSizing = typeof t.fontOpticalSizing == "boolean" ? t.fontOpticalSizing : e.fontOpticalSizing ?? null, this.fontOverride = typeof t.fontOverride == "boolean" ? t.fontOverride : e.fontOverride ?? null, this.fontWeight = t.fontWeight !== void 0 ? t.fontWeight : e.fontWeight !== void 0 ? e.fontWeight : null, this.fontWidth = t.fontWidth !== void 0 ? t.fontWidth : e.fontWidth !== void 0 ? e.fontWidth : null, this.hyphens = typeof t.hyphens == "boolean" ? t.hyphens : e.hyphens ?? null, this.invertFilter = typeof t.invertFilter == "boolean" ? t.invertFilter : e.invertFilter ?? null, this.invertGaijiFilter = typeof t.invertGaijiFilter == "boolean" ? t.invertGaijiFilter : e.invertGaijiFilter ?? null, this.iPadOSPatch = this.deprecatedFontSize || t.iPadOSPatch === !1 ? !1 : t.iPadOSPatch === !0 ? xt.OS.iPadOS && xt.iOSRequest === "desktop" : e.iPadOSPatch, this.layoutStrategy = t.layoutStrategy || e.layoutStrategy || null, this.letterSpacing = t.letterSpacing !== void 0 ? t.letterSpacing : e.letterSpacing !== void 0 ? e.letterSpacing : null, this.ligatures = typeof t.ligatures == "boolean" ? t.ligatures : e.ligatures ?? null, this.lineHeight = t.lineHeight !== void 0 ? t.lineHeight : e.lineHeight !== void 0 ? e.lineHeight : null, this.linkColor = t.linkColor || e.linkColor || null, this.maximalLineLength = t.maximalLineLength === null ? null : t.maximalLineLength || e.maximalLineLength || null, this.minimalLineLength = t.minimalLineLength === null ? null : t.minimalLineLength || e.minimalLineLength || null, this.noRuby = typeof t.noRuby == "boolean" ? t.noRuby : e.noRuby ?? null, this.optimalLineLength = t.optimalLineLength || e.optimalLineLength, this.pageGutter = t.pageGutter !== void 0 ? t.pageGutter : e.pageGutter !== void 0 ? e.pageGutter : null, this.paragraphIndent = t.paragraphIndent !== void 0 ? t.paragraphIndent : e.paragraphIndent !== void 0 ? e.paragraphIndent : null, this.paragraphSpacing = t.paragraphSpacing !== void 0 ? t.paragraphSpacing : e.paragraphSpacing !== void 0 ? e.paragraphSpacing : null, this.scroll = typeof t.scroll == "boolean" ? t.scroll : e.scroll ?? null, this.selectionBackgroundColor = t.selectionBackgroundColor || e.selectionBackgroundColor || null, this.selectionTextColor = t.selectionTextColor || e.selectionTextColor || null, this.textAlign = t.textAlign || e.textAlign || null, this.textColor = t.textColor || e.textColor || null, this.textNormalization = typeof t.textNormalization == "boolean" ? t.textNormalization : e.textNormalization ?? null, this.theme = t.theme || e.theme || null, this.visitedColor = t.visitedColor || e.visitedColor || null, this.wordSpacing = t.wordSpacing !== void 0 ? t.wordSpacing : e.wordSpacing !== void 0 ? e.wordSpacing : null;
|
|
6460
6424
|
}
|
|
6461
6425
|
}
|
|
6462
|
-
function
|
|
6426
|
+
function yt(i) {
|
|
6463
6427
|
const t = getComputedStyle(i), e = parseFloat(t.paddingLeft || "0"), A = parseFloat(t.paddingRight || "0");
|
|
6464
6428
|
return i.clientWidth - e - A;
|
|
6465
6429
|
}
|
|
@@ -6510,16 +6474,15 @@ class wn extends zA {
|
|
|
6510
6474
|
}
|
|
6511
6475
|
class In {
|
|
6512
6476
|
constructor(t) {
|
|
6513
|
-
this.rsProperties = t.rsProperties, this.userProperties = t.userProperties, this.lineLengths = t.lineLengths, this.container = t.container, this.containerParent = t.container.parentElement || document.documentElement, this.constraint = t.constraint, this.layoutStrategy = t.layoutStrategy ||
|
|
6477
|
+
this.rsProperties = t.rsProperties, this.userProperties = t.userProperties, this.lineLengths = t.lineLengths, this.container = t.container, this.containerParent = t.container.parentElement || document.documentElement, this.constraint = t.constraint, this.layoutStrategy = t.layoutStrategy || y.lineLength, this.cachedColCount = t.userProperties.colCount, this.effectiveContainerWidth = yt(this.containerParent);
|
|
6514
6478
|
}
|
|
6515
6479
|
update(t) {
|
|
6516
|
-
this.cachedColCount = t.columnCount, t.constraint !== this.constraint && (this.constraint = t.constraint), t.layoutStrategy && t.layoutStrategy !== this.layoutStrategy && (this.layoutStrategy = t.layoutStrategy), t.pageGutter !== this.rsProperties.pageGutter && (this.rsProperties.pageGutter = t.pageGutter), this.
|
|
6480
|
+
this.cachedColCount = t.columnCount, t.constraint !== this.constraint && (this.constraint = t.constraint), t.layoutStrategy && t.layoutStrategy !== this.layoutStrategy && (this.layoutStrategy = t.layoutStrategy), t.pageGutter !== this.rsProperties.pageGutter && (this.rsProperties.pageGutter = t.pageGutter), this.lineLengths.update({
|
|
6517
6481
|
fontFace: t.fontFamily,
|
|
6518
6482
|
letterSpacing: t.letterSpacing,
|
|
6519
6483
|
pageGutter: t.pageGutter,
|
|
6520
6484
|
wordSpacing: t.wordSpacing,
|
|
6521
6485
|
optimalChars: t.optimalLineLength,
|
|
6522
|
-
userChars: t.lineLength,
|
|
6523
6486
|
minChars: t.minimalLineLength,
|
|
6524
6487
|
maxChars: t.maximalLineLength
|
|
6525
6488
|
});
|
|
@@ -6562,18 +6525,15 @@ class In {
|
|
|
6562
6525
|
};
|
|
6563
6526
|
this.userProperties = new NA(A);
|
|
6564
6527
|
}
|
|
6565
|
-
updateLineLengths(t) {
|
|
6566
|
-
t.fontFace !== void 0 && (this.lineLengths.fontFace = t.fontFace), t.letterSpacing !== void 0 && (this.lineLengths.letterSpacing = t.letterSpacing || 0), t.pageGutter !== void 0 && (this.lineLengths.pageGutter = t.pageGutter || 0), t.wordSpacing !== void 0 && (this.lineLengths.wordSpacing = t.wordSpacing || 0), t.optimalChars && (this.lineLengths.optimalChars = t.optimalChars), t.userChars !== void 0 && (this.lineLengths.userChars = t.userChars), t.minChars !== void 0 && (this.lineLengths.minChars = t.minChars), t.maxChars !== void 0 && (this.lineLengths.maxChars = t.maxChars);
|
|
6567
|
-
}
|
|
6568
6528
|
updateLayout(t, e, A, n) {
|
|
6569
6529
|
return A ?? this.userProperties.view === "scroll" ? this.computeScrollLength(t, e) : this.paginate(t, e, n);
|
|
6570
6530
|
}
|
|
6571
6531
|
getCompensatedMetrics(t, e) {
|
|
6572
|
-
const A = t || this.userProperties.fontSize || 1, n = A < 1 ? this.layoutStrategy ===
|
|
6532
|
+
const A = t || this.userProperties.fontSize || 1, n = A < 1 ? this.layoutStrategy === y.margin ? 1 / (A + 3e-3) : 1 / A : e ? A : 1;
|
|
6573
6533
|
return {
|
|
6574
6534
|
zoomFactor: A,
|
|
6575
6535
|
zoomCompensation: n,
|
|
6576
|
-
optimal: Math.round(this.lineLengths.
|
|
6536
|
+
optimal: Math.round(this.lineLengths.optimalLineLength) * A,
|
|
6577
6537
|
minimal: this.lineLengths.minimalLineLength !== null ? Math.round(this.lineLengths.minimalLineLength * A) : null,
|
|
6578
6538
|
maximal: this.lineLengths.maximalLineLength !== null ? Math.round(this.lineLengths.maximalLineLength * A) : null
|
|
6579
6539
|
};
|
|
@@ -6582,7 +6542,7 @@ class In {
|
|
|
6582
6542
|
// TODO: As scroll shows, the effective line-length
|
|
6583
6543
|
// should be the same as uncompensated when scale >= 1
|
|
6584
6544
|
paginate(t, e, A) {
|
|
6585
|
-
const n = Math.round(
|
|
6545
|
+
const n = Math.round(yt(this.containerParent) - this.constraint), r = this.getCompensatedMetrics(t, e), s = r.zoomCompensation, o = r.optimal, a = r.minimal, h = r.maximal;
|
|
6586
6546
|
let l = 1, c = n;
|
|
6587
6547
|
if (A === void 0)
|
|
6588
6548
|
return {
|
|
@@ -6591,14 +6551,14 @@ class In {
|
|
|
6591
6551
|
effectiveLineLength: Math.round(c / l * s)
|
|
6592
6552
|
};
|
|
6593
6553
|
if (A === null) {
|
|
6594
|
-
if (this.layoutStrategy ===
|
|
6554
|
+
if (this.layoutStrategy === y.margin)
|
|
6595
6555
|
if (n >= o) {
|
|
6596
6556
|
l = Math.floor(n / o);
|
|
6597
6557
|
const g = Math.round(l * (o * s));
|
|
6598
6558
|
c = Math.min(g, n);
|
|
6599
6559
|
} else
|
|
6600
6560
|
l = 1, c = n;
|
|
6601
|
-
else if (this.layoutStrategy ===
|
|
6561
|
+
else if (this.layoutStrategy === y.lineLength)
|
|
6602
6562
|
if (n < o || h === null)
|
|
6603
6563
|
l = 1, c = n;
|
|
6604
6564
|
else {
|
|
@@ -6606,7 +6566,7 @@ class In {
|
|
|
6606
6566
|
const g = Math.round(l * (h * s));
|
|
6607
6567
|
c = Math.min(g, n);
|
|
6608
6568
|
}
|
|
6609
|
-
else if (this.layoutStrategy ===
|
|
6569
|
+
else if (this.layoutStrategy === y.columns)
|
|
6610
6570
|
if (n >= o)
|
|
6611
6571
|
if (h === null)
|
|
6612
6572
|
l = Math.floor(n / o), c = n;
|
|
@@ -6620,17 +6580,17 @@ class In {
|
|
|
6620
6580
|
} else if (A > 1) {
|
|
6621
6581
|
const g = Math.round(A * (a !== null ? a : o));
|
|
6622
6582
|
if (n >= g) {
|
|
6623
|
-
if (l = A, this.layoutStrategy ===
|
|
6583
|
+
if (l = A, this.layoutStrategy === y.margin) {
|
|
6624
6584
|
const m = Math.round(l * (o * s));
|
|
6625
6585
|
c = Math.min(m, n);
|
|
6626
|
-
} else if (this.layoutStrategy ===
|
|
6586
|
+
} else if (this.layoutStrategy === y.lineLength || this.layoutStrategy === y.columns) {
|
|
6627
6587
|
if (h === null)
|
|
6628
6588
|
c = n;
|
|
6629
6589
|
else {
|
|
6630
6590
|
const m = Math.round(l * (h * s));
|
|
6631
6591
|
c = Math.min(m, n);
|
|
6632
6592
|
}
|
|
6633
|
-
this.layoutStrategy ===
|
|
6593
|
+
this.layoutStrategy === y.columns && console.error("Columns strategy is not compatible with a column count whose value is a number. Falling back to lineLength strategy.");
|
|
6634
6594
|
}
|
|
6635
6595
|
} else {
|
|
6636
6596
|
a !== null && n < Math.round(A * a) ? l = Math.floor(n / a) : l = A;
|
|
@@ -6638,17 +6598,17 @@ class In {
|
|
|
6638
6598
|
c = Math.min(m, n);
|
|
6639
6599
|
}
|
|
6640
6600
|
} else if (l = 1, n >= o) {
|
|
6641
|
-
if (this.layoutStrategy ===
|
|
6601
|
+
if (this.layoutStrategy === y.margin) {
|
|
6642
6602
|
const g = Math.round(o * s);
|
|
6643
6603
|
c = Math.min(g, n);
|
|
6644
|
-
} else if (this.layoutStrategy ===
|
|
6604
|
+
} else if (this.layoutStrategy === y.lineLength || this.layoutStrategy === y.columns) {
|
|
6645
6605
|
if (h === null)
|
|
6646
6606
|
c = n;
|
|
6647
6607
|
else {
|
|
6648
6608
|
const g = Math.round(h * s);
|
|
6649
6609
|
c = Math.min(g, n);
|
|
6650
6610
|
}
|
|
6651
|
-
this.layoutStrategy ===
|
|
6611
|
+
this.layoutStrategy === y.columns && console.error("Columns strategy is not compatible with a column count whose value is a number. Falling back to lineLength strategy.");
|
|
6652
6612
|
}
|
|
6653
6613
|
} else
|
|
6654
6614
|
c = n;
|
|
@@ -6660,13 +6620,13 @@ class In {
|
|
|
6660
6620
|
}
|
|
6661
6621
|
// This behaves as paginate where colCount = 1
|
|
6662
6622
|
computeScrollLength(t, e) {
|
|
6663
|
-
const A = Math.round(
|
|
6623
|
+
const A = Math.round(yt(this.containerParent) - this.constraint), n = this.getCompensatedMetrics(t && (t < 1 || e) ? t : 1, e), r = n.zoomCompensation, s = n.optimal, o = n.maximal;
|
|
6664
6624
|
let a, h = A, l = Math.round(s * r);
|
|
6665
|
-
if (this.layoutStrategy ===
|
|
6625
|
+
if (this.layoutStrategy === y.margin) {
|
|
6666
6626
|
const c = Math.min(Math.round(s * r), A);
|
|
6667
6627
|
l = e ? c : Math.round(c * r);
|
|
6668
|
-
} else if (this.layoutStrategy ===
|
|
6669
|
-
if (this.layoutStrategy ===
|
|
6628
|
+
} else if (this.layoutStrategy === y.lineLength || this.layoutStrategy === y.columns)
|
|
6629
|
+
if (this.layoutStrategy === y.columns && console.error("Columns strategy is not compatible with scroll. Falling back to lineLength strategy."), o === null)
|
|
6670
6630
|
l = A;
|
|
6671
6631
|
else {
|
|
6672
6632
|
const c = Math.min(Math.round(o * r), A);
|
|
@@ -6780,7 +6740,7 @@ class SA extends ZA {
|
|
|
6780
6740
|
async resizeHandler() {
|
|
6781
6741
|
const t = this.container.parentElement || document.documentElement;
|
|
6782
6742
|
if (this.layout === p.fixed)
|
|
6783
|
-
this.container.style.width = `${
|
|
6743
|
+
this.container.style.width = `${yt(t) - this._settings.constraint}px`, this.framePool.resizeHandler();
|
|
6784
6744
|
else {
|
|
6785
6745
|
const e = this._css.userProperties.colCount, A = this._css.userProperties.lineLength;
|
|
6786
6746
|
this._css.resizeHandler(), (this._css.userProperties.view !== "scroll" && e !== this._css.userProperties.colCount || A !== this._css.userProperties.lineLength) && await this.commitCSS(this._css);
|
|
@@ -7093,7 +7053,7 @@ class SA extends ZA {
|
|
|
7093
7053
|
return this.go(t.locator, e, A);
|
|
7094
7054
|
}
|
|
7095
7055
|
}
|
|
7096
|
-
class
|
|
7056
|
+
class yn {
|
|
7097
7057
|
constructor(t) {
|
|
7098
7058
|
var e;
|
|
7099
7059
|
this.sourceNode = null, this.listeners = {}, this.isMutedValue = !1, this.isPlayingValue = !1, this.isPausedValue = !1, this.isLoadingValue = !1, this.isLoadedValue = !1, this.isEndedValue = !1, this.playback = t.playback, this.audioContext = t.audioContext, this.gainNode = (e = this.audioContext) == null ? void 0 : e.createGain(), this.setVolume(this.playback.state.volume), this.mediaElement = document.createElement("audio"), this.mediaElement.crossOrigin = "use-credentials", this.mediaElement.addEventListener(
|
|
@@ -7284,7 +7244,7 @@ export {
|
|
|
7284
7244
|
Gi as FrameManager,
|
|
7285
7245
|
Hi as FramePoolManager,
|
|
7286
7246
|
Wi as HorizontalThird,
|
|
7287
|
-
|
|
7247
|
+
y as LayoutStrategy,
|
|
7288
7248
|
ft as LineLengths,
|
|
7289
7249
|
XA as Navigator,
|
|
7290
7250
|
V as Preference,
|
|
@@ -7296,7 +7256,7 @@ export {
|
|
|
7296
7256
|
NA as UserProperties,
|
|
7297
7257
|
Li as VerticalThird,
|
|
7298
7258
|
ZA as VisualNavigator,
|
|
7299
|
-
|
|
7259
|
+
yn as WebAudioEngine,
|
|
7300
7260
|
Tt as fontSizeRangeConfig,
|
|
7301
7261
|
jt as fontWeightRangeConfig,
|
|
7302
7262
|
Vt as fontWidthRangeConfig,
|