@readium/navigator 2.0.0-beta.2 → 2.0.0-beta.3

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 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 Q {
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 Q(t);
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 Q(e);
53
+ return new R(e);
54
54
  }
55
55
  }
56
- Object.defineProperty(Q.prototype, "encryption", {
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 || {}), yt = /* @__PURE__ */ ((i) => (i.auto = "auto", i.both = "both", i.none = "none", i.landscape = "landscape", i))(yt || {});
62
- Q.prototype.getContains = function() {
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
- Q.prototype.getLayout = function() {
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: Q.deserialize(t.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 Q(t), A;
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
- Q.prototype.getNumberOfItems = function() {
1081
+ R.prototype.getNumberOfItems = function() {
1082
1082
  return D(this.otherProperties.numberOfItems);
1083
1083
  };
1084
- Q.prototype.getPrice = function() {
1084
+ R.prototype.getPrice = function() {
1085
1085
  return bA.deserialize(this.otherProperties.price);
1086
1086
  };
1087
- Q.prototype.getIndirectAcquisitions = function() {
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
- Q.prototype.getHolds = function() {
1092
+ R.prototype.getHolds = function() {
1093
1093
  return te.deserialize(this.otherProperties.holds);
1094
1094
  };
1095
- Q.prototype.getCopies = function() {
1095
+ R.prototype.getCopies = function() {
1096
1096
  return ee.deserialize(this.otherProperties.copies);
1097
1097
  };
1098
- Q.prototype.getAvailability = function() {
1098
+ R.prototype.getAvailability = function() {
1099
1099
  return PA.deserialize(this.otherProperties.availability);
1100
1100
  };
1101
- Q.prototype.getAuthenticate = function() {
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
- Q.prototype.getClipped = function() {
1105
+ R.prototype.getClipped = function() {
1106
1106
  return this.otherProperties.clipped;
1107
1107
  };
1108
- Q.prototype.getFit = function() {
1108
+ R.prototype.getFit = function() {
1109
1109
  return this.otherProperties.fit;
1110
1110
  };
1111
- Q.prototype.getOrientation = function() {
1111
+ R.prototype.getOrientation = function() {
1112
1112
  return this.otherProperties.orientation;
1113
1113
  };
1114
- Q.prototype.getOverflow = function() {
1114
+ R.prototype.getOverflow = function() {
1115
1115
  return this.otherProperties.overflow;
1116
1116
  };
1117
- Q.prototype.getPage = function() {
1117
+ R.prototype.getPage = function() {
1118
1118
  return this.otherProperties.page || void 0;
1119
1119
  };
1120
- Q.prototype.getSpread = function() {
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 Y {
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 Y(t);
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 Y(e);
1454
+ return new Q(e);
1455
1455
  }
1456
1456
  }
1457
- Object.defineProperty(Y.prototype, "encryption", {
1457
+ Object.defineProperty(Q.prototype, "encryption", {
1458
1458
  get: function() {
1459
1459
  return ie.deserialize(this.otherProperties.encrypted);
1460
1460
  }
1461
1461
  });
1462
- Y.prototype.getContains = function() {
1462
+ Q.prototype.getContains = function() {
1463
1463
  return new Set(this.otherProperties.contains || []);
1464
1464
  };
1465
- Y.prototype.getLayout = function() {
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: Y.deserialize(t.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 Y(t), A;
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
- Y.prototype.getNumberOfItems = function() {
2485
+ Q.prototype.getNumberOfItems = function() {
2486
2486
  return b(this.otherProperties.numberOfItems);
2487
2487
  };
2488
- Y.prototype.getPrice = function() {
2488
+ Q.prototype.getPrice = function() {
2489
2489
  return re.deserialize(this.otherProperties.price);
2490
2490
  };
2491
- Y.prototype.getIndirectAcquisitions = function() {
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
- Y.prototype.getHolds = function() {
2496
+ Q.prototype.getHolds = function() {
2497
2497
  return se.deserialize(this.otherProperties.holds);
2498
2498
  };
2499
- Y.prototype.getCopies = function() {
2499
+ Q.prototype.getCopies = function() {
2500
2500
  return oe.deserialize(this.otherProperties.copies);
2501
2501
  };
2502
- Y.prototype.getAvailability = function() {
2502
+ Q.prototype.getAvailability = function() {
2503
2503
  return ae.deserialize(this.otherProperties.availability);
2504
2504
  };
2505
- Y.prototype.getAuthenticate = function() {
2505
+ Q.prototype.getAuthenticate = function() {
2506
2506
  return at.deserialize(this.otherProperties.authenticate);
2507
2507
  };
2508
- Y.prototype.getClipped = function() {
2508
+ Q.prototype.getClipped = function() {
2509
2509
  return this.otherProperties.clipped;
2510
2510
  };
2511
- Y.prototype.getFit = function() {
2511
+ Q.prototype.getFit = function() {
2512
2512
  return this.otherProperties.fit;
2513
2513
  };
2514
- Y.prototype.getOrientation = function() {
2514
+ Q.prototype.getOrientation = function() {
2515
2515
  return this.otherProperties.orientation;
2516
2516
  };
2517
- Y.prototype.getOverflow = function() {
2517
+ Q.prototype.getOverflow = function() {
2518
2518
  return this.otherProperties.overflow;
2519
2519
  };
2520
- Y.prototype.getPage = function() {
2520
+ Q.prototype.getPage = function() {
2521
2521
  return this.otherProperties.page || void 0;
2522
2522
  };
2523
- Y.prototype.getSpread = function() {
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 Ce(i, t, e, A) {
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 = Ce(s, M, E, B), c[E] += 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 + Ce(s, M, l, 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 ye(i, t) {
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 ? ye(
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 ? ye(
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 Ci {
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, z) => {
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 = `${z.width}px`, w.style.height = `${U.height}px`, w.style.left = `${z.left + g}px`, w.style.top = `${U.top + m}px`;
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, z) => U.top < z.top ? -1 : U.top > z.top ? 1 : 0);
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 z = F.cloneNode(!0);
3440
- z.style.setProperty("pointer-events", "none"), M(z, U, B), o.append(z);
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 Ci(
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 yi = mA;
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;
@@ -4058,7 +4058,7 @@ class UA extends Dt {
4058
4058
  }
4059
4059
  }
4060
4060
  UA.moduleName = "peripherals";
4061
- const CA = class qt extends Dt {
4061
+ const yA = class qt extends Dt {
4062
4062
  constructor() {
4063
4063
  super(...arguments), this.mediaPlayingCount = 0, this.allAnimations = /* @__PURE__ */ new Set();
4064
4064
  }
@@ -4159,9 +4159,9 @@ const CA = class qt extends Dt {
4159
4159
  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
4160
  }
4161
4161
  };
4162
- CA.moduleName = "setup";
4163
- let yA = CA;
4164
- const Ve = "readium-viewport", RA = class At extends yA {
4162
+ yA.moduleName = "setup";
4163
+ let CA = yA;
4164
+ const Ve = "readium-viewport", RA = class At extends CA {
4165
4165
  onViewportWidthChanged(t) {
4166
4166
  const e = t.target;
4167
4167
  Nt(e, "--RS__viewportWidth", `${e.innerWidth}px`);
@@ -4195,7 +4195,7 @@ const Ve = "readium-viewport", RA = class At extends yA {
4195
4195
  };
4196
4196
  RA.moduleName = "reflowable_setup";
4197
4197
  let Vi = RA;
4198
- const De = "readium-fixed-style", QA = class Z extends yA {
4198
+ const De = "readium-fixed-style", QA = class Z extends CA {
4199
4199
  mount(t, e) {
4200
4200
  if (!super.mount(t, e))
4201
4201
  return !1;
@@ -4255,7 +4255,7 @@ const bi = [
4255
4255
  Di,
4256
4256
  Vi,
4257
4257
  UA,
4258
- yi,
4258
+ Ci,
4259
4259
  Ti,
4260
4260
  ji
4261
4261
  ].map((i) => [i.moduleName, i]));
@@ -4533,16 +4533,16 @@ class Hi {
4533
4533
  }), this.currentBaseURL !== void 0 && t.baseURL !== this.currentBaseURL && (this.blobs.forEach((f) => URL.revokeObjectURL(f)), this.blobs.clear()), this.currentBaseURL = t.baseURL;
4534
4534
  const g = async (f) => {
4535
4535
  var U;
4536
- if (n && (this.blobs.forEach((z) => URL.revokeObjectURL(z)), this.blobs.clear(), this.pendingUpdates.clear()), this.pendingUpdates.has(f) && ((U = this.pendingUpdates.get(f)) == null ? void 0 : U.inPool) === !1) {
4537
- const z = this.blobs.get(f);
4538
- z && (URL.revokeObjectURL(z), this.blobs.delete(f), this.pendingUpdates.delete(f));
4536
+ 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) {
4537
+ const Y = this.blobs.get(f);
4538
+ Y && (URL.revokeObjectURL(Y), this.blobs.delete(f), this.pendingUpdates.delete(f));
4539
4539
  }
4540
4540
  if (this.pool.has(f)) {
4541
- const z = this.pool.get(f);
4541
+ const Y = this.pool.get(f);
4542
4542
  if (!this.blobs.has(f))
4543
- await z.destroy(), this.pool.delete(f), this.pendingUpdates.delete(f);
4543
+ await Y.destroy(), this.pool.delete(f), this.pendingUpdates.delete(f);
4544
4544
  else {
4545
- await z.load(A);
4545
+ await Y.load(A);
4546
4546
  return;
4547
4547
  }
4548
4548
  }
@@ -5175,7 +5175,7 @@ class Ki {
5175
5175
  if (A.length > 1)
5176
5176
  return;
5177
5177
  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()) === yt.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;
5178
+ 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
5179
  }), this.shift || this.index(t, !0);
5180
5180
  }
5181
5181
  buildSpreads(t) {
@@ -5196,7 +5196,7 @@ const He = 8, ke = 5, qi = 300, _i = 15e3, $i = 250, tn = 150, en = 500;
5196
5196
  class An {
5197
5197
  constructor(t, e, A) {
5198
5198
  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) || yt.auto, this.pub.metadata.effectiveReadingProgression !== I.rtl && this.pub.metadata.effectiveReadingProgression !== I.ltr)
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) || Ct.auto, this.pub.metadata.effectiveReadingProgression !== I.rtl && this.pub.metadata.effectiveReadingProgression !== I.ltr)
5200
5200
  throw Error("Unsupported reading progression for EPUB");
5201
5201
  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
5202
  var o, a;
@@ -5248,7 +5248,7 @@ class An {
5248
5248
  return 50;
5249
5249
  }
5250
5250
  get portrait() {
5251
- return this.spreadPresentation === yt.none ? !0 : (this.orientationInternal === -1 && (this.orientationInternal = this.containerHeightCached > this.container.clientWidth ? 1 : 0), this.orientationInternal === 1);
5251
+ return this.spreadPresentation === Ct.none ? !0 : (this.orientationInternal === -1 && (this.orientationInternal = this.containerHeightCached > this.container.clientWidth ? 1 : 0), this.orientationInternal === 1);
5252
5252
  }
5253
5253
  updateSpineStyle(t, e = !0) {
5254
5254
  let A = "0";
@@ -5433,7 +5433,7 @@ class An {
5433
5433
  let w = !1;
5434
5434
  const U = window.setTimeout(async () => {
5435
5435
  this.delayedTimeout.set(M, 0);
5436
- const z = this.makeSpread(this.reAlign(B)), nt = this.spreadPosition(z, E), mt = this.pool.get(M);
5436
+ const Y = this.makeSpread(this.reAlign(B)), nt = this.spreadPosition(Y, E), mt = this.pool.get(M);
5437
5437
  await mt.load(A, this.blobs.get(M)), this.peripherals.isScaled || await mt.show(nt), this.delayedShow.delete(M), w = !0, f();
5438
5438
  }, qi);
5439
5439
  setTimeout(() => {
@@ -5700,7 +5700,7 @@ var ht = {
5700
5700
  posix: null
5701
5701
  };
5702
5702
  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 || {}), C = /* @__PURE__ */ ((i) => (i.margin = "margin", i.lineLength = "lineLength", i.columns = "columns", i))(C || {});
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 || {}), y = /* @__PURE__ */ ((i) => (i.margin = "margin", i.lineLength = "lineLength", i.columns = "columns", i))(y || {});
5704
5704
  const Tt = {
5705
5705
  range: [0.7, 4],
5706
5706
  step: 0.05
@@ -5720,7 +5720,7 @@ function sn(i, t) {
5720
5720
  function T(i) {
5721
5721
  return typeof i == "string" ? i : i === null ? null : void 0;
5722
5722
  }
5723
- function R(i) {
5723
+ function C(i) {
5724
5724
  return typeof i == "boolean" || i == null ? i : void 0;
5725
5725
  }
5726
5726
  function lt(i, t) {
@@ -5730,7 +5730,7 @@ function lt(i, t) {
5730
5730
  function ct(i) {
5731
5731
  return typeof i == "boolean" || typeof i == "number" && i >= 0 ? i : i === null ? null : void 0;
5732
5732
  }
5733
- function y(i) {
5733
+ function z(i) {
5734
5734
  if (i !== void 0)
5735
5735
  return i === null ? null : i < 0 ? void 0 : i;
5736
5736
  }
@@ -5747,7 +5747,7 @@ function Wt(i, t) {
5747
5747
  }
5748
5748
  class Et {
5749
5749
  constructor(t = {}) {
5750
- this.backgroundColor = T(t.backgroundColor), this.blendFilter = R(t.blendFilter), this.constraint = y(t.constraint), this.columnCount = y(t.columnCount), this.darkenFilter = ct(t.darkenFilter), this.deprecatedFontSize = R(t.deprecatedFontSize), this.fontFamily = T(t.fontFamily), this.fontSize = gt(t.fontSize, Tt.range), this.fontSizeNormalize = R(t.fontSizeNormalize), this.fontOpticalSizing = R(t.fontOpticalSizing), this.fontOverride = R(t.fontOverride), this.fontWeight = gt(t.fontWeight, jt.range), this.fontWidth = gt(t.fontWidth, Vt.range), this.hyphens = R(t.hyphens), this.invertFilter = ct(t.invertFilter), this.invertGaijiFilter = ct(t.invertGaijiFilter), this.iPadOSPatch = R(t.iPadOSPatch), this.layoutStrategy = lt(t.layoutStrategy, C), this.letterSpacing = y(t.letterSpacing), this.ligatures = R(t.ligatures), this.lineHeight = y(t.lineHeight), this.linkColor = T(t.linkColor), this.noRuby = R(t.noRuby), this.pageGutter = y(t.pageGutter), this.paragraphIndent = y(t.paragraphIndent), this.paragraphSpacing = y(t.paragraphSpacing), this.scroll = R(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 = R(t.textNormalization), this.theme = lt(t.theme, Bt), this.visitedColor = T(t.visitedColor), this.wordSpacing = y(t.wordSpacing), this.lineLength = y(t.lineLength), this.optimalLineLength = y(t.optimalLineLength), this.maximalLineLength = y(t.maximalLineLength), this.minimalLineLength = y(t.minimalLineLength);
5750
+ 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
5751
  }
5752
5752
  static serialize(t) {
5753
5753
  const { ...e } = t;
@@ -5764,7 +5764,7 @@ class Et {
5764
5764
  merging(t) {
5765
5765
  const e = { ...this };
5766
5766
  for (const A of Object.keys(t))
5767
- t[A] !== void 0 && (A !== "maximalLineLength" || t[A] === null || t[A] >= (t.lineLength ?? e.lineLength ?? t.optimalLineLength ?? e.optimalLineLength ?? 65)) && (A !== "minimalLineLength" || t[A] === null || t[A] <= (t.lineLength ?? e.lineLength ?? t.optimalLineLength ?? e.optimalLineLength ?? 65)) && (e[A] = t[A]);
5767
+ 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
5768
  return new Et(e);
5769
5769
  }
5770
5770
  }
@@ -5777,40 +5777,16 @@ const on = "'Iowan Old Style', Sitka, 'Sitka Text', Palatino, 'Book Antiqua', 'U
5777
5777
  }, dn = 16, Le = gn.RS__oldStyleTf;
5778
5778
  class ft {
5779
5779
  constructor(t) {
5780
- this._optimalLineLength = null, this._canvas = document.createElement("canvas"), this._optimalChars = t.optimalChars, this._minChars = t.minChars, this._maxChars = t.maxChars, this._userChars = t.userChars || null, 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._userMultiplier = this._userChars ? this._userChars / this._optimalChars : null, 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);
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());
5780
+ 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
5781
  }
5797
- set wordSpacing(t) {
5798
- t !== this._wordSpacing && (this._wordSpacing = Math.round(t * this._baseFontSize), this._optimalLineLength = this.getOptimalLineLength());
5782
+ updateMultipliers() {
5783
+ 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
5784
  }
5800
- set baseFontSize(t) {
5801
- this._baseFontSize = t, this._optimalLineLength = this.getOptimalLineLength();
5802
- }
5803
- set fontFace(t) {
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);
5785
+ // Batch update to guarantee up-to-date values
5786
+ // Not filtering because pretty much everything can
5787
+ // trigger a recomputation anyway.
5788
+ update(t) {
5789
+ 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
5790
  }
5815
5791
  get baseFontSize() {
5816
5792
  return this._baseFontSize;
@@ -5818,9 +5794,6 @@ class ft {
5818
5794
  get minimalLineLength() {
5819
5795
  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
5796
  }
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
5797
  get maximalLineLength() {
5825
5798
  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
5799
  }
@@ -5830,7 +5803,6 @@ class ft {
5830
5803
  get all() {
5831
5804
  return this._optimalLineLength || (this._optimalLineLength = this.getOptimalLineLength()), {
5832
5805
  min: this.minimalLineLength,
5833
- user: this.userLineLength,
5834
5806
  max: this.maximalLineLength,
5835
5807
  optimal: this.optimalLineLength,
5836
5808
  baseFontSize: this._baseFontSize
@@ -5879,7 +5851,7 @@ class ft {
5879
5851
  }
5880
5852
  class un {
5881
5853
  constructor(t) {
5882
- this.backgroundColor = T(t.backgroundColor) || null, this.blendFilter = R(t.blendFilter) ?? !1, this.constraint = y(t.constraint) || 0, this.columnCount = y(t.columnCount) || null, this.darkenFilter = ct(t.darkenFilter) ?? !1, this.deprecatedFontSize = R(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 = R(t.fontSizeNormalize) ?? !1, this.fontOpticalSizing = R(t.fontOpticalSizing) ?? null, this.fontOverride = R(t.fontOverride) ?? null, this.fontWeight = gt(t.fontWeight, jt.range) || null, this.fontWidth = gt(t.fontWidth, Vt.range) || null, this.hyphens = R(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, C) || C.lineLength, this.letterSpacing = y(t.letterSpacing) || null, this.ligatures = R(t.ligatures) ?? null, this.lineHeight = y(t.lineHeight) || null, this.linkColor = T(t.linkColor) || null, this.noRuby = R(t.noRuby) ?? !1, this.pageGutter = Wt(y(t.pageGutter), 20), this.paragraphIndent = y(t.paragraphIndent) ?? null, this.paragraphSpacing = y(t.paragraphSpacing) ?? null, this.scroll = R(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 = R(t.textNormalization) ?? !1, this.theme = lt(t.theme, Bt) || null, this.visitedColor = T(t.visitedColor) || null, this.wordSpacing = y(t.wordSpacing) || null, this.lineLength = y(t.lineLength) || null, this.optimalLineLength = y(t.optimalLineLength) || 65, this.maximalLineLength = Wt(sn(t.maximalLineLength, this.lineLength || this.optimalLineLength), 80), this.minimalLineLength = Wt(rn(t.minimalLineLength, this.lineLength || this.optimalLineLength), 40);
5854
+ 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
5855
  }
5884
5856
  }
5885
5857
  class V {
@@ -6218,7 +6190,7 @@ class Oe {
6218
6190
  onChange: (t) => {
6219
6191
  this.updatePreference("layoutStrategy", t || null);
6220
6192
  },
6221
- supportedValues: Object.values(C)
6193
+ supportedValues: Object.values(y)
6222
6194
  });
6223
6195
  }
6224
6196
  get letterSpacing() {
@@ -6256,18 +6228,6 @@ class Oe {
6256
6228
  step: 0.1
6257
6229
  });
6258
6230
  }
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
6231
  get linkColor() {
6272
6232
  return new V({
6273
6233
  initialValue: this.preferences.linkColor,
@@ -6317,7 +6277,7 @@ class Oe {
6317
6277
  return new S({
6318
6278
  initialValue: this.preferences.optimalLineLength,
6319
6279
  effectiveValue: this.settings.optimalLineLength,
6320
- isEffective: this.layout === p.reflowable && !this.settings.lineLength,
6280
+ isEffective: this.layout === p.reflowable,
6321
6281
  onChange: (t) => {
6322
6282
  this.updatePreference("optimalLineLength", t);
6323
6283
  },
@@ -6456,10 +6416,10 @@ class Oe {
6456
6416
  }
6457
6417
  class Xe {
6458
6418
  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.lineLength = t.lineLength !== void 0 ? t.lineLength : e.lineLength !== void 0 ? e.lineLength : 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;
6419
+ 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
6420
  }
6461
6421
  }
6462
- function Ct(i) {
6422
+ function yt(i) {
6463
6423
  const t = getComputedStyle(i), e = parseFloat(t.paddingLeft || "0"), A = parseFloat(t.paddingRight || "0");
6464
6424
  return i.clientWidth - e - A;
6465
6425
  }
@@ -6510,16 +6470,15 @@ class wn extends zA {
6510
6470
  }
6511
6471
  class In {
6512
6472
  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 || C.lineLength, this.cachedColCount = t.userProperties.colCount, this.effectiveContainerWidth = Ct(this.containerParent);
6473
+ 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
6474
  }
6515
6475
  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.updateLineLengths({
6476
+ 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
6477
  fontFace: t.fontFamily,
6518
6478
  letterSpacing: t.letterSpacing,
6519
6479
  pageGutter: t.pageGutter,
6520
6480
  wordSpacing: t.wordSpacing,
6521
6481
  optimalChars: t.optimalLineLength,
6522
- userChars: t.lineLength,
6523
6482
  minChars: t.minimalLineLength,
6524
6483
  maxChars: t.maximalLineLength
6525
6484
  });
@@ -6562,18 +6521,15 @@ class In {
6562
6521
  };
6563
6522
  this.userProperties = new NA(A);
6564
6523
  }
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
6524
  updateLayout(t, e, A, n) {
6569
6525
  return A ?? this.userProperties.view === "scroll" ? this.computeScrollLength(t, e) : this.paginate(t, e, n);
6570
6526
  }
6571
6527
  getCompensatedMetrics(t, e) {
6572
- const A = t || this.userProperties.fontSize || 1, n = A < 1 ? this.layoutStrategy === C.margin ? 1 / (A + 3e-3) : 1 / A : e ? A : 1;
6528
+ const A = t || this.userProperties.fontSize || 1, n = A < 1 ? this.layoutStrategy === y.margin ? 1 / (A + 3e-3) : 1 / A : e ? A : 1;
6573
6529
  return {
6574
6530
  zoomFactor: A,
6575
6531
  zoomCompensation: n,
6576
- optimal: Math.round(this.lineLengths.userLineLength || this.lineLengths.optimalLineLength) * A,
6532
+ optimal: Math.round(this.lineLengths.optimalLineLength) * A,
6577
6533
  minimal: this.lineLengths.minimalLineLength !== null ? Math.round(this.lineLengths.minimalLineLength * A) : null,
6578
6534
  maximal: this.lineLengths.maximalLineLength !== null ? Math.round(this.lineLengths.maximalLineLength * A) : null
6579
6535
  };
@@ -6582,7 +6538,7 @@ class In {
6582
6538
  // TODO: As scroll shows, the effective line-length
6583
6539
  // should be the same as uncompensated when scale >= 1
6584
6540
  paginate(t, e, A) {
6585
- const n = Math.round(Ct(this.containerParent) - this.constraint), r = this.getCompensatedMetrics(t, e), s = r.zoomCompensation, o = r.optimal, a = r.minimal, h = r.maximal;
6541
+ 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
6542
  let l = 1, c = n;
6587
6543
  if (A === void 0)
6588
6544
  return {
@@ -6591,14 +6547,14 @@ class In {
6591
6547
  effectiveLineLength: Math.round(c / l * s)
6592
6548
  };
6593
6549
  if (A === null) {
6594
- if (this.layoutStrategy === C.margin)
6550
+ if (this.layoutStrategy === y.margin)
6595
6551
  if (n >= o) {
6596
6552
  l = Math.floor(n / o);
6597
6553
  const g = Math.round(l * (o * s));
6598
6554
  c = Math.min(g, n);
6599
6555
  } else
6600
6556
  l = 1, c = n;
6601
- else if (this.layoutStrategy === C.lineLength)
6557
+ else if (this.layoutStrategy === y.lineLength)
6602
6558
  if (n < o || h === null)
6603
6559
  l = 1, c = n;
6604
6560
  else {
@@ -6606,7 +6562,7 @@ class In {
6606
6562
  const g = Math.round(l * (h * s));
6607
6563
  c = Math.min(g, n);
6608
6564
  }
6609
- else if (this.layoutStrategy === C.columns)
6565
+ else if (this.layoutStrategy === y.columns)
6610
6566
  if (n >= o)
6611
6567
  if (h === null)
6612
6568
  l = Math.floor(n / o), c = n;
@@ -6620,17 +6576,17 @@ class In {
6620
6576
  } else if (A > 1) {
6621
6577
  const g = Math.round(A * (a !== null ? a : o));
6622
6578
  if (n >= g) {
6623
- if (l = A, this.layoutStrategy === C.margin) {
6579
+ if (l = A, this.layoutStrategy === y.margin) {
6624
6580
  const m = Math.round(l * (o * s));
6625
6581
  c = Math.min(m, n);
6626
- } else if (this.layoutStrategy === C.lineLength || this.layoutStrategy === C.columns) {
6582
+ } else if (this.layoutStrategy === y.lineLength || this.layoutStrategy === y.columns) {
6627
6583
  if (h === null)
6628
6584
  c = n;
6629
6585
  else {
6630
6586
  const m = Math.round(l * (h * s));
6631
6587
  c = Math.min(m, n);
6632
6588
  }
6633
- this.layoutStrategy === C.columns && console.error("Columns strategy is not compatible with a column count whose value is a number. Falling back to lineLength strategy.");
6589
+ 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
6590
  }
6635
6591
  } else {
6636
6592
  a !== null && n < Math.round(A * a) ? l = Math.floor(n / a) : l = A;
@@ -6638,17 +6594,17 @@ class In {
6638
6594
  c = Math.min(m, n);
6639
6595
  }
6640
6596
  } else if (l = 1, n >= o) {
6641
- if (this.layoutStrategy === C.margin) {
6597
+ if (this.layoutStrategy === y.margin) {
6642
6598
  const g = Math.round(o * s);
6643
6599
  c = Math.min(g, n);
6644
- } else if (this.layoutStrategy === C.lineLength || this.layoutStrategy === C.columns) {
6600
+ } else if (this.layoutStrategy === y.lineLength || this.layoutStrategy === y.columns) {
6645
6601
  if (h === null)
6646
6602
  c = n;
6647
6603
  else {
6648
6604
  const g = Math.round(h * s);
6649
6605
  c = Math.min(g, n);
6650
6606
  }
6651
- this.layoutStrategy === C.columns && console.error("Columns strategy is not compatible with a column count whose value is a number. Falling back to lineLength strategy.");
6607
+ 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
6608
  }
6653
6609
  } else
6654
6610
  c = n;
@@ -6660,13 +6616,13 @@ class In {
6660
6616
  }
6661
6617
  // This behaves as paginate where colCount = 1
6662
6618
  computeScrollLength(t, e) {
6663
- const A = Math.round(Ct(this.containerParent) - this.constraint), n = this.getCompensatedMetrics(t && (t < 1 || e) ? t : 1, e), r = n.zoomCompensation, s = n.optimal, o = n.maximal;
6619
+ 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
6620
  let a, h = A, l = Math.round(s * r);
6665
- if (this.layoutStrategy === C.margin) {
6621
+ if (this.layoutStrategy === y.margin) {
6666
6622
  const c = Math.min(Math.round(s * r), A);
6667
6623
  l = e ? c : Math.round(c * r);
6668
- } else if (this.layoutStrategy === C.lineLength || this.layoutStrategy === C.columns)
6669
- if (this.layoutStrategy === C.columns && console.error("Columns strategy is not compatible with scroll. Falling back to lineLength strategy."), o === null)
6624
+ } else if (this.layoutStrategy === y.lineLength || this.layoutStrategy === y.columns)
6625
+ if (this.layoutStrategy === y.columns && console.error("Columns strategy is not compatible with scroll. Falling back to lineLength strategy."), o === null)
6670
6626
  l = A;
6671
6627
  else {
6672
6628
  const c = Math.min(Math.round(o * r), A);
@@ -6780,7 +6736,7 @@ class SA extends ZA {
6780
6736
  async resizeHandler() {
6781
6737
  const t = this.container.parentElement || document.documentElement;
6782
6738
  if (this.layout === p.fixed)
6783
- this.container.style.width = `${Ct(t) - this._settings.constraint}px`, this.framePool.resizeHandler();
6739
+ this.container.style.width = `${yt(t) - this._settings.constraint}px`, this.framePool.resizeHandler();
6784
6740
  else {
6785
6741
  const e = this._css.userProperties.colCount, A = this._css.userProperties.lineLength;
6786
6742
  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 +7049,7 @@ class SA extends ZA {
7093
7049
  return this.go(t.locator, e, A);
7094
7050
  }
7095
7051
  }
7096
- class Cn {
7052
+ class yn {
7097
7053
  constructor(t) {
7098
7054
  var e;
7099
7055
  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 +7240,7 @@ export {
7284
7240
  Gi as FrameManager,
7285
7241
  Hi as FramePoolManager,
7286
7242
  Wi as HorizontalThird,
7287
- C as LayoutStrategy,
7243
+ y as LayoutStrategy,
7288
7244
  ft as LineLengths,
7289
7245
  XA as Navigator,
7290
7246
  V as Preference,
@@ -7296,7 +7252,7 @@ export {
7296
7252
  NA as UserProperties,
7297
7253
  Li as VerticalThird,
7298
7254
  ZA as VisualNavigator,
7299
- Cn as WebAudioEngine,
7255
+ yn as WebAudioEngine,
7300
7256
  Tt as fontSizeRangeConfig,
7301
7257
  jt as fontWeightRangeConfig,
7302
7258
  Vt as fontWidthRangeConfig,